Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/extension/src/generated/mdbase-app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"manifest_version": 1,
"id": "dev.mdbase.reader.extension",
"name": "mdbase Reader browser extension",
"homepage": "https://lab.mdbase-reader.pages.dev/",
"icon": "https://lab.mdbase-reader.pages.dev/favicon.svg",
"redirect_uris": ["https://lab.mdbase-reader.pages.dev/"],
"homepage": "https://reader.mdbase.dev/",
"icon": "https://reader.mdbase.dev/favicon.svg",
"redirect_uris": ["https://reader.mdbase.dev/"],
"requirements": {
"access": "full_collection",
"contracts": [
Expand Down Expand Up @@ -193,6 +193,6 @@
]
},
"installation_origins": {
"lab": { "app-runtime": ["chrome-extension://kimdfjefhbfgfecconmaiaaindjccidp"] }
"production": { "app-runtime": ["chrome-extension://kimdfjefhbfgfecconmaiaaindjccidp"] }
}
}
14 changes: 7 additions & 7 deletions apps/reader/src/grant-callback.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ it("recognises the consent popup's return, approved or declined, and nothing els

it("delivers without preempting the original SDK popup lifetime, including failed delivery", async () => {
const url = new URL("http://127.0.0.1:48222/?state=s&code=c");
const close = vi.fn();vi.stubGlobal("window",{close});
const close = vi.fn();
vi.stubGlobal("window", { close });
const deliver = vi.fn();
expect(completeAppGrantCallback(url, deliver)).toBe(true);
await new Promise(resolve=>setTimeout(resolve,0));
await new Promise((resolve) => setTimeout(resolve, 0));
expect(close).not.toHaveBeenCalled();
expect(deliver).toHaveBeenCalledWith(url.href);

expect(
completeAppGrantCallback(url, () => Promise.reject(new Error("no channel"))),
).toBe(true);
await new Promise(resolve=>setTimeout(resolve,0));
expect(completeAppGrantCallback(url, () => Promise.reject(new Error("no channel")))).toBe(true);
await new Promise((resolve) => setTimeout(resolve, 0));
expect(close).not.toHaveBeenCalled();

expect(completeAppGrantCallback(new URL("http://127.0.0.1:48222/"), deliver)).toBe(false);
expect(close).not.toHaveBeenCalled();vi.unstubAllGlobals();
expect(close).not.toHaveBeenCalled();
vi.unstubAllGlobals();
});
5 changes: 1 addition & 4 deletions apps/reader/src/grant-callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ const deliverWithSdk: Deliver = async (href) => {
};

/** Hand the callback to the original SDK owner. False when it is not one. */
export function completeAppGrantCallback(
url: URL,
deliver: Deliver = deliverWithSdk,
): boolean {
export function completeAppGrantCallback(url: URL, deliver: Deliver = deliverWithSdk): boolean {
if (!isAppGrantCallback(url)) {
return false;
}
Expand Down
1 change: 0 additions & 1 deletion docs/new-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ admission, READ/edit/reload or production release qualification.

## Prior intake notes (superseded SDK pin)


Reader is being ported from prod Connect (`@mdbase-dev/connect`) to the public application
entry of the new SDK (`@mdbase-dev/sdk`, `MdbaseConnect`).

Expand Down