@hexclave/react 1.0.27 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components-page/account-settings/email-and-auth/emails-section.js +1 -1
- package/dist/components-page/account-settings/email-and-auth/mfa-section.js +1 -1
- package/dist/components-page/account-settings/email-and-auth/passkey-section.js +1 -1
- package/dist/components-page/account-settings/email-and-auth/password-section.js +2 -2
- package/dist/components-page/account-settings/payments/payments-panel.js +1 -1
- package/dist/components-page/account-settings/teams/team-creation-page.js +1 -1
- package/dist/components-page/account-settings/teams/team-member-invitation-section.js +1 -1
- package/dist/dev-tool/dev-tool-core.js +1 -1
- package/dist/dev-tool/dev-tool-core.js.map +1 -1
- package/dist/esm/components-page/account-settings/email-and-auth/emails-section.js +1 -1
- package/dist/esm/components-page/account-settings/email-and-auth/mfa-section.js +1 -1
- package/dist/esm/components-page/account-settings/email-and-auth/passkey-section.js +1 -1
- package/dist/esm/components-page/account-settings/email-and-auth/password-section.js +2 -2
- package/dist/esm/components-page/account-settings/payments/payments-panel.js +1 -1
- package/dist/esm/components-page/account-settings/teams/team-creation-page.js +1 -1
- package/dist/esm/components-page/account-settings/teams/team-member-invitation-section.js +1 -1
- package/dist/esm/dev-tool/dev-tool-core.js +1 -1
- package/dist/esm/dev-tool/dev-tool-core.js.map +1 -1
- package/dist/esm/generated/quetzal-translations.d.ts +2 -2
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.js +6 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/common.js +1 -1
- package/dist/esm/pushed-config-error-overlay/index.js +1 -1
- package/dist/esm/pushed-config-error-overlay/index.js.map +1 -1
- package/dist/esm/pushed-config-error-overlay/index.test.d.ts +1 -0
- package/dist/esm/pushed-config-error-overlay/index.test.js +67 -0
- package/dist/esm/pushed-config-error-overlay/index.test.js.map +1 -0
- package/dist/generated/quetzal-translations.d.ts +2 -2
- package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.js +6 -1
- package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/common.js +1 -1
- package/dist/pushed-config-error-overlay/index.js +1 -1
- package/dist/pushed-config-error-overlay/index.js.map +1 -1
- package/dist/pushed-config-error-overlay/index.test.d.ts +1 -0
- package/dist/pushed-config-error-overlay/index.test.js +67 -0
- package/dist/pushed-config-error-overlay/index.test.js.map +1 -0
- package/package.json +4 -4
- package/src/dev-tool/dev-tool-core.ts +1 -1
- package/src/lib/hexclave-app/apps/implementations/admin-app-impl.ts +2 -1
- package/src/pushed-config-error-overlay/index.test.ts +76 -0
- package/src/pushed-config-error-overlay/index.ts +4 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { StackClientApp } from "../lib/hexclave-app/index.js";
|
|
3
|
+
import { envVars } from "../generated/env.js";
|
|
4
|
+
import { mountPushedConfigErrorOverlay } from "./index.js";
|
|
5
|
+
|
|
6
|
+
//#region src/pushed-config-error-overlay/index.test.ts
|
|
7
|
+
function createMockElement() {
|
|
8
|
+
return {
|
|
9
|
+
style: {},
|
|
10
|
+
appendChild: () => {},
|
|
11
|
+
addEventListener: () => {},
|
|
12
|
+
setAttribute: () => {},
|
|
13
|
+
replaceChildren: () => {},
|
|
14
|
+
remove: () => {}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
describe("pushed config error overlay", () => {
|
|
18
|
+
afterEach(() => {
|
|
19
|
+
vi.unstubAllEnvs();
|
|
20
|
+
vi.unstubAllGlobals();
|
|
21
|
+
});
|
|
22
|
+
it("defers the first project refresh until after construction-time callers finish", async () => {
|
|
23
|
+
const app = new StackClientApp({
|
|
24
|
+
baseUrl: "http://localhost:12345",
|
|
25
|
+
projectId: "00000000-0000-4000-8000-000000000000",
|
|
26
|
+
publishableClientKey: "stack-pk-test",
|
|
27
|
+
tokenStore: "memory",
|
|
28
|
+
redirectMethod: "none",
|
|
29
|
+
devTool: false
|
|
30
|
+
});
|
|
31
|
+
const getProject = vi.fn(async () => ({
|
|
32
|
+
pushedConfigError: null,
|
|
33
|
+
configWarnings: []
|
|
34
|
+
}));
|
|
35
|
+
Reflect.set(app, "getProject", getProject);
|
|
36
|
+
const appendChild = vi.fn();
|
|
37
|
+
vi.stubEnv("NODE_ENV", "development");
|
|
38
|
+
expect(Reflect.get(envVars, "NODE_ENV")).toBe("development");
|
|
39
|
+
vi.stubGlobal("window", {
|
|
40
|
+
"__hexclave-pushed-config-error-overlay": null,
|
|
41
|
+
location: { href: "http://localhost:3000" }
|
|
42
|
+
});
|
|
43
|
+
vi.stubGlobal("document", {
|
|
44
|
+
body: { appendChild },
|
|
45
|
+
createElement: () => createMockElement(),
|
|
46
|
+
createTextNode: () => createMockElement()
|
|
47
|
+
});
|
|
48
|
+
vi.stubGlobal("localStorage", {
|
|
49
|
+
getItem: () => null,
|
|
50
|
+
setItem: () => {},
|
|
51
|
+
removeItem: () => {}
|
|
52
|
+
});
|
|
53
|
+
const cleanup = mountPushedConfigErrorOverlay(app);
|
|
54
|
+
try {
|
|
55
|
+
expect(appendChild).toHaveBeenCalledOnce();
|
|
56
|
+
expect(getProject).not.toHaveBeenCalled();
|
|
57
|
+
await Promise.resolve();
|
|
58
|
+
expect(getProject).toHaveBeenCalledOnce();
|
|
59
|
+
} finally {
|
|
60
|
+
cleanup();
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
export { };
|
|
67
|
+
//# sourceMappingURL=index.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.js","names":[],"sources":["../../../src/pushed-config-error-overlay/index.test.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { afterEach, describe, expect, it, vi } from \"vitest\";\nimport { envVars } from \"../generated/env\";\nimport { StackClientApp } from \"../lib/hexclave-app\";\nimport { mountPushedConfigErrorOverlay } from \".\";\n\nfunction createMockElement() {\n return {\n style: {},\n appendChild: () => {},\n addEventListener: () => {},\n setAttribute: () => {},\n replaceChildren: () => {},\n remove: () => {},\n };\n}\n\ndescribe(\"pushed config error overlay\", () => {\n afterEach(() => {\n vi.unstubAllEnvs();\n vi.unstubAllGlobals();\n });\n\n it(\"defers the first project refresh until after construction-time callers finish\", async () => {\n const app = new StackClientApp({\n baseUrl: \"http://localhost:12345\",\n projectId: \"00000000-0000-4000-8000-000000000000\",\n publishableClientKey: \"stack-pk-test\",\n tokenStore: \"memory\",\n redirectMethod: \"none\",\n devTool: false,\n });\n const getProject = vi.fn(async () => ({\n pushedConfigError: null,\n configWarnings: [],\n }));\n Reflect.set(app, \"getProject\", getProject);\n const appendChild = vi.fn();\n vi.stubEnv(\"NODE_ENV\", \"development\");\n expect(Reflect.get(envVars, \"NODE_ENV\")).toBe(\"development\");\n\n vi.stubGlobal(\"window\", {\n \"__hexclave-pushed-config-error-overlay\": null,\n location: {\n href: \"http://localhost:3000\",\n },\n });\n vi.stubGlobal(\"document\", {\n body: {\n appendChild,\n },\n createElement: () => createMockElement(),\n createTextNode: () => createMockElement(),\n });\n vi.stubGlobal(\"localStorage\", {\n getItem: () => null,\n setItem: () => {},\n removeItem: () => {},\n });\n\n const cleanup = mountPushedConfigErrorOverlay(app);\n try {\n expect(appendChild).toHaveBeenCalledOnce();\n expect(getProject).not.toHaveBeenCalled();\n\n await Promise.resolve();\n\n expect(getProject).toHaveBeenCalledOnce();\n } finally {\n cleanup();\n }\n });\n});\n"],"mappings":";;;;;;AASA,SAAS,oBAAoB;AAC3B,QAAO;EACL,OAAO,EAAE;EACT,mBAAmB;EACnB,wBAAwB;EACxB,oBAAoB;EACpB,uBAAuB;EACvB,cAAc;EACf;;AAGH,SAAS,qCAAqC;AAC5C,iBAAgB;AACd,KAAG,eAAe;AAClB,KAAG,kBAAkB;GACrB;AAEF,IAAG,iFAAiF,YAAY;EAC9F,MAAM,MAAM,IAAI,eAAe;GAC7B,SAAS;GACT,WAAW;GACX,sBAAsB;GACtB,YAAY;GACZ,gBAAgB;GAChB,SAAS;GACV,CAAC;EACF,MAAM,aAAa,GAAG,GAAG,aAAa;GACpC,mBAAmB;GACnB,gBAAgB,EAAE;GACnB,EAAE;AACH,UAAQ,IAAI,KAAK,cAAc,WAAW;EAC1C,MAAM,cAAc,GAAG,IAAI;AAC3B,KAAG,QAAQ,YAAY,cAAc;AACrC,SAAO,QAAQ,IAAI,SAAS,WAAW,CAAC,CAAC,KAAK,cAAc;AAE5D,KAAG,WAAW,UAAU;GACtB,0CAA0C;GAC1C,UAAU,EACR,MAAM,yBACP;GACF,CAAC;AACF,KAAG,WAAW,YAAY;GACxB,MAAM,EACJ,aACD;GACD,qBAAqB,mBAAmB;GACxC,sBAAsB,mBAAmB;GAC1C,CAAC;AACF,KAAG,WAAW,gBAAgB;GAC5B,eAAe;GACf,eAAe;GACf,kBAAkB;GACnB,CAAC;EAEF,MAAM,UAAU,8BAA8B,IAAI;AAClD,MAAI;AACF,UAAO,YAAY,CAAC,sBAAsB;AAC1C,UAAO,WAAW,CAAC,IAAI,kBAAkB;AAEzC,SAAM,QAAQ,SAAS;AAEvB,UAAO,WAAW,CAAC,sBAAsB;YACjC;AACR,YAAS;;GAEX;EACF"}
|