@hexclave/react 1.0.28 → 1.0.30
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/esm/generated/quetzal-translations.d.ts +2 -2
- package/dist/esm/lib/hexclave-app/apps/implementations/common.js +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.d.ts +15 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.js +20 -12
- package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/session-replay.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/session-replay.js +8 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/session-replay.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/interfaces/server-app.d.ts +13 -0
- package/dist/esm/lib/hexclave-app/apps/interfaces/server-app.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/interfaces/server-app.js.map +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/common.js +1 -1
- package/dist/lib/hexclave-app/apps/implementations/server-app-impl.d.ts +15 -1
- package/dist/lib/hexclave-app/apps/implementations/server-app-impl.d.ts.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/server-app-impl.js +20 -12
- package/dist/lib/hexclave-app/apps/implementations/server-app-impl.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/session-replay.d.ts.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/session-replay.js +8 -1
- package/dist/lib/hexclave-app/apps/implementations/session-replay.js.map +1 -1
- package/dist/lib/hexclave-app/apps/interfaces/server-app.d.ts +13 -0
- package/dist/lib/hexclave-app/apps/interfaces/server-app.d.ts.map +1 -1
- package/dist/lib/hexclave-app/apps/interfaces/server-app.js.map +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 +3 -3
- package/src/lib/hexclave-app/apps/implementations/server-app-impl.ts +24 -12
- package/src/lib/hexclave-app/apps/implementations/session-replay.ts +16 -1
- package/src/lib/hexclave-app/apps/interfaces/server-app.ts +5 -0
- package/src/pushed-config-error-overlay/index.test.ts +76 -0
- package/src/pushed-config-error-overlay/index.ts +4 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
|
|
2
|
+
//===========================================
|
|
3
|
+
// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template
|
|
4
|
+
//===========================================
|
|
5
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
6
|
+
import { envVars } from "../generated/env";
|
|
7
|
+
import { StackClientApp } from "../lib/hexclave-app";
|
|
8
|
+
import { mountPushedConfigErrorOverlay } from ".";
|
|
9
|
+
|
|
10
|
+
function createMockElement() {
|
|
11
|
+
return {
|
|
12
|
+
style: {},
|
|
13
|
+
appendChild: () => {},
|
|
14
|
+
addEventListener: () => {},
|
|
15
|
+
setAttribute: () => {},
|
|
16
|
+
replaceChildren: () => {},
|
|
17
|
+
remove: () => {},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
describe("pushed config error overlay", () => {
|
|
22
|
+
afterEach(() => {
|
|
23
|
+
vi.unstubAllEnvs();
|
|
24
|
+
vi.unstubAllGlobals();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("defers the first project refresh until after construction-time callers finish", async () => {
|
|
28
|
+
const app = new StackClientApp({
|
|
29
|
+
baseUrl: "http://localhost:12345",
|
|
30
|
+
projectId: "00000000-0000-4000-8000-000000000000",
|
|
31
|
+
publishableClientKey: "stack-pk-test",
|
|
32
|
+
tokenStore: "memory",
|
|
33
|
+
redirectMethod: "none",
|
|
34
|
+
devTool: false,
|
|
35
|
+
});
|
|
36
|
+
const getProject = vi.fn(async () => ({
|
|
37
|
+
pushedConfigError: null,
|
|
38
|
+
configWarnings: [],
|
|
39
|
+
}));
|
|
40
|
+
Reflect.set(app, "getProject", getProject);
|
|
41
|
+
const appendChild = vi.fn();
|
|
42
|
+
vi.stubEnv("NODE_ENV", "development");
|
|
43
|
+
expect(Reflect.get(envVars, "NODE_ENV")).toBe("development");
|
|
44
|
+
|
|
45
|
+
vi.stubGlobal("window", {
|
|
46
|
+
"__hexclave-pushed-config-error-overlay": null,
|
|
47
|
+
location: {
|
|
48
|
+
href: "http://localhost:3000",
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
vi.stubGlobal("document", {
|
|
52
|
+
body: {
|
|
53
|
+
appendChild,
|
|
54
|
+
},
|
|
55
|
+
createElement: () => createMockElement(),
|
|
56
|
+
createTextNode: () => createMockElement(),
|
|
57
|
+
});
|
|
58
|
+
vi.stubGlobal("localStorage", {
|
|
59
|
+
getItem: () => null,
|
|
60
|
+
setItem: () => {},
|
|
61
|
+
removeItem: () => {},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const cleanup = mountPushedConfigErrorOverlay(app);
|
|
65
|
+
try {
|
|
66
|
+
expect(appendChild).toHaveBeenCalledOnce();
|
|
67
|
+
expect(getProject).not.toHaveBeenCalled();
|
|
68
|
+
|
|
69
|
+
await Promise.resolve();
|
|
70
|
+
|
|
71
|
+
expect(getProject).toHaveBeenCalledOnce();
|
|
72
|
+
} finally {
|
|
73
|
+
cleanup();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -531,7 +531,10 @@ export function mountPushedConfigErrorOverlay(app: StackClientApp<true>): () =>
|
|
|
531
531
|
});
|
|
532
532
|
};
|
|
533
533
|
|
|
534
|
-
|
|
534
|
+
// This is mounted from the base client-app constructor, which also runs
|
|
535
|
+
// before subclass field initializers. Defer the first app call so overridden
|
|
536
|
+
// methods like adminApp.getProject() can safely touch subclass caches.
|
|
537
|
+
queueMicrotask(refresh);
|
|
535
538
|
const interval = setInterval(refresh, REFRESH_INTERVAL_MS);
|
|
536
539
|
|
|
537
540
|
const cleanup = () => {
|