@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.
Files changed (43) hide show
  1. package/dist/components-page/account-settings/email-and-auth/emails-section.js +1 -1
  2. package/dist/components-page/account-settings/email-and-auth/mfa-section.js +1 -1
  3. package/dist/components-page/account-settings/email-and-auth/passkey-section.js +1 -1
  4. package/dist/components-page/account-settings/email-and-auth/password-section.js +2 -2
  5. package/dist/components-page/account-settings/payments/payments-panel.js +1 -1
  6. package/dist/components-page/account-settings/teams/team-creation-page.js +1 -1
  7. package/dist/components-page/account-settings/teams/team-member-invitation-section.js +1 -1
  8. package/dist/dev-tool/dev-tool-core.js +1 -1
  9. package/dist/dev-tool/dev-tool-core.js.map +1 -1
  10. package/dist/esm/components-page/account-settings/email-and-auth/emails-section.js +1 -1
  11. package/dist/esm/components-page/account-settings/email-and-auth/mfa-section.js +1 -1
  12. package/dist/esm/components-page/account-settings/email-and-auth/passkey-section.js +1 -1
  13. package/dist/esm/components-page/account-settings/email-and-auth/password-section.js +2 -2
  14. package/dist/esm/components-page/account-settings/payments/payments-panel.js +1 -1
  15. package/dist/esm/components-page/account-settings/teams/team-creation-page.js +1 -1
  16. package/dist/esm/components-page/account-settings/teams/team-member-invitation-section.js +1 -1
  17. package/dist/esm/dev-tool/dev-tool-core.js +1 -1
  18. package/dist/esm/dev-tool/dev-tool-core.js.map +1 -1
  19. package/dist/esm/generated/quetzal-translations.d.ts +2 -2
  20. package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts.map +1 -1
  21. package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.js +6 -1
  22. package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.js.map +1 -1
  23. package/dist/esm/lib/hexclave-app/apps/implementations/common.js +1 -1
  24. package/dist/esm/pushed-config-error-overlay/index.js +1 -1
  25. package/dist/esm/pushed-config-error-overlay/index.js.map +1 -1
  26. package/dist/esm/pushed-config-error-overlay/index.test.d.ts +1 -0
  27. package/dist/esm/pushed-config-error-overlay/index.test.js +67 -0
  28. package/dist/esm/pushed-config-error-overlay/index.test.js.map +1 -0
  29. package/dist/generated/quetzal-translations.d.ts +2 -2
  30. package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts.map +1 -1
  31. package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.js +6 -1
  32. package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.js.map +1 -1
  33. package/dist/lib/hexclave-app/apps/implementations/common.js +1 -1
  34. package/dist/pushed-config-error-overlay/index.js +1 -1
  35. package/dist/pushed-config-error-overlay/index.js.map +1 -1
  36. package/dist/pushed-config-error-overlay/index.test.d.ts +1 -0
  37. package/dist/pushed-config-error-overlay/index.test.js +67 -0
  38. package/dist/pushed-config-error-overlay/index.test.js.map +1 -0
  39. package/package.json +4 -4
  40. package/src/dev-tool/dev-tool-core.ts +1 -1
  41. package/src/lib/hexclave-app/apps/implementations/admin-app-impl.ts +2 -1
  42. package/src/pushed-config-error-overlay/index.test.ts +76 -0
  43. package/src/pushed-config-error-overlay/index.ts +4 -1
@@ -0,0 +1,67 @@
1
+ const require_chunk = require('../chunk-BE-pF4vm.js');
2
+ let vitest = require("vitest");
3
+ let ___lib_hexclave_app_index_js = require("../lib/hexclave-app/index.js");
4
+ let ___generated_env_js = require("../generated/env.js");
5
+ let __index_js = require("./index.js");
6
+
7
+ //#region src/pushed-config-error-overlay/index.test.ts
8
+ function createMockElement() {
9
+ return {
10
+ style: {},
11
+ appendChild: () => {},
12
+ addEventListener: () => {},
13
+ setAttribute: () => {},
14
+ replaceChildren: () => {},
15
+ remove: () => {}
16
+ };
17
+ }
18
+ (0, vitest.describe)("pushed config error overlay", () => {
19
+ (0, vitest.afterEach)(() => {
20
+ vitest.vi.unstubAllEnvs();
21
+ vitest.vi.unstubAllGlobals();
22
+ });
23
+ (0, vitest.it)("defers the first project refresh until after construction-time callers finish", async () => {
24
+ const app = new ___lib_hexclave_app_index_js.StackClientApp({
25
+ baseUrl: "http://localhost:12345",
26
+ projectId: "00000000-0000-4000-8000-000000000000",
27
+ publishableClientKey: "stack-pk-test",
28
+ tokenStore: "memory",
29
+ redirectMethod: "none",
30
+ devTool: false
31
+ });
32
+ const getProject = vitest.vi.fn(async () => ({
33
+ pushedConfigError: null,
34
+ configWarnings: []
35
+ }));
36
+ Reflect.set(app, "getProject", getProject);
37
+ const appendChild = vitest.vi.fn();
38
+ vitest.vi.stubEnv("NODE_ENV", "development");
39
+ (0, vitest.expect)(Reflect.get(___generated_env_js.envVars, "NODE_ENV")).toBe("development");
40
+ vitest.vi.stubGlobal("window", {
41
+ "__hexclave-pushed-config-error-overlay": null,
42
+ location: { href: "http://localhost:3000" }
43
+ });
44
+ vitest.vi.stubGlobal("document", {
45
+ body: { appendChild },
46
+ createElement: () => createMockElement(),
47
+ createTextNode: () => createMockElement()
48
+ });
49
+ vitest.vi.stubGlobal("localStorage", {
50
+ getItem: () => null,
51
+ setItem: () => {},
52
+ removeItem: () => {}
53
+ });
54
+ const cleanup = (0, __index_js.mountPushedConfigErrorOverlay)(app);
55
+ try {
56
+ (0, vitest.expect)(appendChild).toHaveBeenCalledOnce();
57
+ (0, vitest.expect)(getProject).not.toHaveBeenCalled();
58
+ await Promise.resolve();
59
+ (0, vitest.expect)(getProject).toHaveBeenCalledOnce();
60
+ } finally {
61
+ cleanup();
62
+ }
63
+ });
64
+ });
65
+
66
+ //#endregion
67
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","names":["StackClientApp","vi","envVars"],"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;;qBAGM,qCAAqC;AAC5C,6BAAgB;AACd,YAAG,eAAe;AAClB,YAAG,kBAAkB;GACrB;AAEF,gBAAG,iFAAiF,YAAY;EAC9F,MAAM,MAAM,IAAIA,4CAAe;GAC7B,SAAS;GACT,WAAW;GACX,sBAAsB;GACtB,YAAY;GACZ,gBAAgB;GAChB,SAAS;GACV,CAAC;EACF,MAAM,aAAaC,UAAG,GAAG,aAAa;GACpC,mBAAmB;GACnB,gBAAgB,EAAE;GACnB,EAAE;AACH,UAAQ,IAAI,KAAK,cAAc,WAAW;EAC1C,MAAM,cAAcA,UAAG,IAAI;AAC3B,YAAG,QAAQ,YAAY,cAAc;AACrC,qBAAO,QAAQ,IAAIC,6BAAS,WAAW,CAAC,CAAC,KAAK,cAAc;AAE5D,YAAG,WAAW,UAAU;GACtB,0CAA0C;GAC1C,UAAU,EACR,MAAM,yBACP;GACF,CAAC;AACF,YAAG,WAAW,YAAY;GACxB,MAAM,EACJ,aACD;GACD,qBAAqB,mBAAmB;GACxC,sBAAsB,mBAAmB;GAC1C,CAAC;AACF,YAAG,WAAW,gBAAgB;GAC5B,eAAe;GACf,eAAe;GACf,kBAAkB;GACnB,CAAC;EAEF,MAAM,wDAAwC,IAAI;AAClD,MAAI;AACF,sBAAO,YAAY,CAAC,sBAAsB;AAC1C,sBAAO,WAAW,CAAC,IAAI,kBAAkB;AAEzC,SAAM,QAAQ,SAAS;AAEvB,sBAAO,WAAW,CAAC,sBAAsB;YACjC;AACR,YAAS;;GAEX;EACF"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "//": "THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template (FOR package.json FILES, PLEASE EDIT package-template.json)",
3
3
  "name": "@hexclave/react",
4
- "version": "1.0.27",
4
+ "version": "1.0.29",
5
5
  "repository": "https://github.com/hexclave/hexclave",
6
6
  "sideEffects": false,
7
7
  "main": "./dist/index.js",
@@ -73,10 +73,9 @@
73
73
  "react-hook-form": "^7.70.0",
74
74
  "tailwindcss-animate": "^1.0.7",
75
75
  "rrweb": "^1.1.3",
76
- "tsx": "^4.21.0",
77
76
  "yup": "^1.7.1",
78
- "@hexclave/shared": "1.0.27",
79
- "@hexclave/ui": "1.0.27"
77
+ "@hexclave/shared": "1.0.29",
78
+ "@hexclave/ui": "1.0.29"
80
79
  },
81
80
  "peerDependencies": {
82
81
  "@types/react": ">=18.0.0",
@@ -112,6 +111,7 @@
112
111
  "rimraf": "^6.1.2",
113
112
  "tailwindcss": "^3.4.4",
114
113
  "tsdown": "^0.20.3",
114
+ "tsx": "^4.21.0",
115
115
  "convex": "^1.27.0"
116
116
  },
117
117
  "scripts": {
@@ -248,7 +248,7 @@ function generateRandomEmail(): string {
248
248
  for (let i = 0; i < 8; i++) {
249
249
  id += chars[Math.floor(Math.random() * chars.length)];
250
250
  }
251
- return `dev-${id}@test.hexclave.com`;
251
+ return `dev-${id}@devtool-quick-sign-up.example.com`;
252
252
  }
253
253
 
254
254
  // ---------------------------------------------------------------------------
@@ -812,7 +812,8 @@ export class _HexclaveAdminAppImplIncomplete<HasTokenStore extends boolean, Proj
812
812
  }
813
813
 
814
814
  async getEmailPreview(options: { themeId?: string | null | false, themeTsxSource?: string, templateId?: string, templateTsxSource?: string }): Promise<string> {
815
- return (await this._interface.renderEmailPreview(options)).html;
815
+ const result = Result.orThrow(await this._emailPreviewCache.getOrWait([options.themeId, options.themeTsxSource, options.templateId, options.templateTsxSource], "write-only"));
816
+ return result.html;
816
817
  }
817
818
  useEmailPreview(options: { themeId?: string | null | false, themeTsxSource?: string, templateId?: string, templateTsxSource?: string }): string {
818
819
  const crud = useAsyncCache(this._emailPreviewCache, [options.themeId, options.themeTsxSource, options.templateId, options.templateTsxSource] as const, "adminApp.useEmailPreview()");
@@ -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
- refresh();
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 = () => {