@hexclave/tanstack-start 1.0.20 → 1.0.22
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/README.md +187 -7
- package/dist/clickmap/clickmap-core.js +1 -1
- package/dist/clickmap/index.js +2 -2
- package/dist/components/api-key-dialogs.d.ts +1 -1
- package/dist/components/api-key-dialogs.js +2 -2
- package/dist/components/credential-sign-in.js +1 -1
- package/dist/components/credential-sign-up.js +1 -1
- package/dist/components/magic-link-sign-in.js +1 -1
- package/dist/components/team-switcher.js +1 -1
- package/dist/components-page/account-settings/active-sessions/active-sessions-page.js +1 -1
- 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/password-section.js +1 -1
- package/dist/components-page/account-settings/profile-page/profile-page.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/components-page/auth-page.js +1 -1
- package/dist/components-page/cli-auth-confirm.js +1 -1
- package/dist/components-page/cli-auth-confirm.test.js +1 -1
- package/dist/components-page/forgot-password.js +1 -1
- package/dist/components-page/oauth-callback.js +15 -20
- package/dist/components-page/oauth-callback.js.map +1 -1
- package/dist/components-page/oauth-callback.test.d.ts +1 -0
- package/dist/components-page/oauth-callback.test.js +90 -0
- package/dist/components-page/oauth-callback.test.js.map +1 -0
- package/dist/components-page/onboarding.js +1 -1
- package/dist/components-page/password-reset.js +1 -1
- package/dist/components-page/team-creation.js +1 -1
- package/dist/dev-tool/dev-tool-core.js +1 -1
- package/dist/dev-tool/index.js +1 -1
- package/dist/esm/clickmap/clickmap-core.js +1 -1
- package/dist/esm/clickmap/index.js +2 -2
- package/dist/esm/components/api-key-dialogs.d.ts +1 -1
- package/dist/esm/components/api-key-dialogs.js +2 -2
- package/dist/esm/components/credential-sign-in.js +1 -1
- package/dist/esm/components/credential-sign-up.js +1 -1
- package/dist/esm/components/magic-link-sign-in.js +1 -1
- package/dist/esm/components/team-switcher.js +1 -1
- package/dist/esm/components-page/account-settings/active-sessions/active-sessions-page.js +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/password-section.js +1 -1
- package/dist/esm/components-page/account-settings/profile-page/profile-page.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/components-page/auth-page.js +1 -1
- package/dist/esm/components-page/cli-auth-confirm.js +1 -1
- package/dist/esm/components-page/cli-auth-confirm.test.js +1 -1
- package/dist/esm/components-page/forgot-password.js +1 -1
- package/dist/esm/components-page/oauth-callback.js +15 -20
- package/dist/esm/components-page/oauth-callback.js.map +1 -1
- package/dist/esm/components-page/oauth-callback.test.d.ts +1 -0
- package/dist/esm/components-page/oauth-callback.test.js +89 -0
- package/dist/esm/components-page/oauth-callback.test.js.map +1 -0
- package/dist/esm/components-page/onboarding.js +1 -1
- package/dist/esm/components-page/password-reset.js +1 -1
- package/dist/esm/components-page/team-creation.js +1 -1
- package/dist/esm/dev-tool/dev-tool-core.js +1 -1
- package/dist/esm/dev-tool/index.js +1 -1
- package/dist/esm/generated/quetzal-translations.d.ts +2 -2
- package/dist/esm/lib/auth.d.ts.map +1 -1
- package/dist/esm/lib/auth.js +33 -12
- package/dist/esm/lib/auth.js.map +1 -1
- package/dist/esm/lib/auth.test.js +25 -10
- package/dist/esm/lib/auth.test.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +2 -1
- 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 +1 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js +54 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +4 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.js +30 -6
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/common.js +2 -2
- package/dist/esm/lib/hexclave-app/apps/implementations/event-tracker.d.ts +1 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/event-tracker.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/event-tracker.js +18 -14
- package/dist/esm/lib/hexclave-app/apps/implementations/event-tracker.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/event-tracker.test.js +4 -8
- package/dist/esm/lib/hexclave-app/apps/implementations/event-tracker.test.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.js +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/session-replay.d.ts +3 -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 +20 -14
- package/dist/esm/lib/hexclave-app/apps/implementations/session-replay.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/session-replay.test.js +4 -9
- package/dist/esm/lib/hexclave-app/apps/implementations/session-replay.test.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/interfaces/admin-app.d.ts +1 -0
- package/dist/esm/lib/hexclave-app/apps/interfaces/admin-app.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/interfaces/admin-app.js.map +1 -1
- package/dist/esm/providers/theme-provider.js +1 -1
- package/dist/generated/quetzal-translations.d.ts +2 -2
- package/dist/lib/auth.d.ts.map +1 -1
- package/dist/lib/auth.js +32 -11
- package/dist/lib/auth.js.map +1 -1
- package/dist/lib/auth.test.js +23 -8
- package/dist/lib/auth.test.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +1 -0
- 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 +1 -0
- package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js +54 -0
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +4 -1
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.d.ts.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.js +29 -5
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/common.js +2 -2
- package/dist/lib/hexclave-app/apps/implementations/event-tracker.d.ts +1 -0
- package/dist/lib/hexclave-app/apps/implementations/event-tracker.d.ts.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/event-tracker.js +17 -13
- package/dist/lib/hexclave-app/apps/implementations/event-tracker.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/event-tracker.test.js +4 -8
- package/dist/lib/hexclave-app/apps/implementations/event-tracker.test.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/server-app-impl.js +1 -1
- package/dist/lib/hexclave-app/apps/implementations/session-replay.d.ts +3 -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 +20 -13
- package/dist/lib/hexclave-app/apps/implementations/session-replay.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/session-replay.test.js +4 -9
- package/dist/lib/hexclave-app/apps/implementations/session-replay.test.js.map +1 -1
- package/dist/lib/hexclave-app/apps/interfaces/admin-app.d.ts +1 -0
- package/dist/lib/hexclave-app/apps/interfaces/admin-app.d.ts.map +1 -1
- package/dist/lib/hexclave-app/apps/interfaces/admin-app.js.map +1 -1
- package/dist/providers/theme-provider.js +1 -1
- package/package.json +3 -3
- package/src/components-page/oauth-callback.test.tsx +109 -0
- package/src/components-page/oauth-callback.tsx +14 -19
- package/src/lib/auth.test.ts +32 -10
- package/src/lib/auth.ts +41 -7
- package/src/lib/hexclave-app/apps/implementations/admin-app-impl.ts +2 -1
- package/src/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.ts +66 -0
- package/src/lib/hexclave-app/apps/implementations/client-app-impl.ts +39 -3
- package/src/lib/hexclave-app/apps/implementations/event-tracker.test.ts +5 -13
- package/src/lib/hexclave-app/apps/implementations/event-tracker.ts +19 -14
- package/src/lib/hexclave-app/apps/implementations/session-replay.test.ts +4 -20
- package/src/lib/hexclave-app/apps/implementations/session-replay.ts +19 -12
- package/src/lib/hexclave-app/apps/interfaces/admin-app.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-callback.test.js","names":["vi","TranslationProviderClient","OAuthCallback","KnownErrors"],"sources":["../../src/components-page/oauth-callback.test.tsx"],"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//===========================================\n// @vitest-environment jsdom\n\nimport { KnownErrors } from \"@hexclave/shared\";\nimport React, { act } from \"react\";\nimport { createRoot, type Root } from \"react-dom/client\";\nimport { afterEach, beforeEach, describe, expect, it, vi } from \"vitest\";\nimport type { StackClientApp } from \"../lib/hexclave-app/apps/interfaces/client-app\";\nimport { TranslationProviderClient } from \"../providers/translation-provider-client\";\nimport { OAuthCallback } from \"./oauth-callback\";\n\nconst appMockState = vi.hoisted(() => ({ app: null as unknown }));\n\nvi.mock(\"..\", () => ({\n useStackApp: () => {\n if (appMockState.app == null) {\n throw new Error(\"Expected test app to be set before rendering.\");\n }\n return appMockState.app;\n },\n}));\n\nvi.mock(\"@hexclave/ui\", async () => {\n const React = await import(\"react\");\n return {\n Button: (props: { children: React.ReactNode, onClick?: () => void }) => (\n <button type=\"button\" onClick={props.onClick}>{props.children}</button>\n ),\n Spinner: () => <div data-testid=\"spinner\" />,\n Typography: (props: { children: React.ReactNode }) => <div>{props.children}</div>,\n cn: (...classes: (string | false | null | undefined)[]) => classes.filter(Boolean).join(\" \"),\n };\n});\n\nconst previousActEnvironment = Reflect.get(globalThis, \"IS_REACT_ACT_ENVIRONMENT\");\n\nfunction createAppTestDouble(options: {\n callOAuthCallback: () => Promise<boolean>,\n}) {\n const app = {\n callOAuthCallback: options.callOAuthCallback,\n redirectToSignIn: vi.fn(async () => {}),\n redirectToHome: vi.fn(async () => {}),\n };\n\n // This test double intentionally implements only the StackClientApp surface\n // that OAuthCallback and the rendered error card touch.\n return app as unknown as StackClientApp<true>;\n}\n\nlet root: Root | null = null;\nlet container: HTMLDivElement | null = null;\n\nasync function renderWithApp(app: StackClientApp<true>) {\n appMockState.app = app;\n container = document.createElement(\"div\");\n document.body.append(container);\n root = createRoot(container);\n await act(async () => {\n root?.render(\n <TranslationProviderClient quetzalKeys={new Map()} quetzalLocale={new Map()}>\n <OAuthCallback />\n </TranslationProviderClient>\n );\n });\n}\n\nasync function flushEffects() {\n await act(async () => {\n await new Promise((resolve) => setTimeout(resolve, 0));\n });\n}\n\ndescribe(\"OAuthCallback\", () => {\n beforeEach(() => {\n Reflect.set(globalThis, \"IS_REACT_ACT_ENVIRONMENT\", true);\n });\n\n afterEach(() => {\n act(() => {\n root?.unmount();\n });\n container?.remove();\n root = null;\n container = null;\n appMockState.app = null;\n vi.restoreAllMocks();\n Reflect.set(globalThis, \"IS_REACT_ACT_ENVIRONMENT\", previousActEnvironment);\n });\n\n it(\"renders backend-encoded OAuth callback errors on the callback page\", async () => {\n const errorMessage = \"Your sign up was rejected by an administrator's sign-up rule.\";\n const callOAuthCallback = vi.fn(async () => {\n throw new KnownErrors.SignUpRejected(errorMessage);\n });\n const app = createAppTestDouble({ callOAuthCallback });\n\n await renderWithApp(app);\n await flushEffects();\n\n expect(callOAuthCallback).toHaveBeenCalledOnce();\n expect(container?.textContent).toContain(\"SIGN_UP_REJECTED\");\n expect(container?.textContent).toContain(errorMessage);\n expect(app.redirectToSignIn).not.toHaveBeenCalled();\n });\n});\n"],"mappings":";;;;;;;;;;;;AAcA,MAAM,eAAeA,UAAG,eAAe,EAAE,KAAK,MAAiB,EAAE;AAEjEA,UAAG,KAAK,aAAa,EACnB,mBAAmB;AACjB,KAAI,aAAa,OAAO,KACtB,OAAM,IAAI,MAAM,gDAAgD;AAElE,QAAO,aAAa;GAEvB,EAAE;AAEHA,UAAG,KAAK,gBAAgB,YAAY;AACpB,OAAM,OAAO;AAC3B,QAAO;EACL,SAAS,UACP,2CAAC;GAAO,MAAK;GAAS,SAAS,MAAM;aAAU,MAAM;IAAkB;EAEzE,eAAe,2CAAC,SAAI,eAAY,YAAY;EAC5C,aAAa,UAAyC,2CAAC,mBAAK,MAAM,WAAe;EACjF,KAAK,GAAG,YAAmD,QAAQ,OAAO,QAAQ,CAAC,KAAK,IAAI;EAC7F;EACD;AAEF,MAAM,yBAAyB,QAAQ,IAAI,YAAY,2BAA2B;AAElF,SAAS,oBAAoB,SAE1B;AASD,QARY;EACV,mBAAmB,QAAQ;EAC3B,kBAAkBA,UAAG,GAAG,YAAY,GAAG;EACvC,gBAAgBA,UAAG,GAAG,YAAY,GAAG;EACtC;;AAOH,IAAI,OAAoB;AACxB,IAAI,YAAmC;AAEvC,eAAe,cAAc,KAA2B;AACtD,cAAa,MAAM;AACnB,aAAY,SAAS,cAAc,MAAM;AACzC,UAAS,KAAK,OAAO,UAAU;AAC/B,yCAAkB,UAAU;AAC5B,sBAAU,YAAY;AACpB,QAAM,OACJ,2CAACC;GAA0B,6BAAa,IAAI,KAAK;GAAE,+BAAe,IAAI,KAAK;aACzE,2CAACC,sCAAgB;IACS,CAC7B;GACD;;AAGJ,eAAe,eAAe;AAC5B,sBAAU,YAAY;AACpB,QAAM,IAAI,SAAS,YAAY,WAAW,SAAS,EAAE,CAAC;GACtD;;qBAGK,uBAAuB;AAC9B,8BAAiB;AACf,UAAQ,IAAI,YAAY,4BAA4B,KAAK;GACzD;AAEF,6BAAgB;AACd,uBAAU;AACR,SAAM,SAAS;IACf;AACF,aAAW,QAAQ;AACnB,SAAO;AACP,cAAY;AACZ,eAAa,MAAM;AACnB,YAAG,iBAAiB;AACpB,UAAQ,IAAI,YAAY,4BAA4B,uBAAuB;GAC3E;AAEF,gBAAG,sEAAsE,YAAY;EACnF,MAAM,eAAe;EACrB,MAAM,oBAAoBF,UAAG,GAAG,YAAY;AAC1C,SAAM,IAAIG,6BAAY,eAAe,aAAa;IAClD;EACF,MAAM,MAAM,oBAAoB,EAAE,mBAAmB,CAAC;AAEtD,QAAM,cAAc,IAAI;AACxB,QAAM,cAAc;AAEpB,qBAAO,kBAAkB,CAAC,sBAAsB;AAChD,qBAAO,WAAW,YAAY,CAAC,UAAU,mBAAmB;AAC5D,qBAAO,WAAW,YAAY,CAAC,UAAU,aAAa;AACtD,qBAAO,IAAI,iBAAiB,CAAC,IAAI,kBAAkB;GACnD;EACF"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_chunk = require('../chunk-BE-pF4vm.js');
|
|
5
|
-
let _hexclave_shared_dist_utils_promises = require("@hexclave/shared/dist/utils/promises");
|
|
6
5
|
let _hookform_resolvers_yup = require("@hookform/resolvers/yup");
|
|
7
6
|
let _hexclave_shared_dist_schema_fields = require("@hexclave/shared/dist/schema-fields");
|
|
7
|
+
let _hexclave_shared_dist_utils_promises = require("@hexclave/shared/dist/utils/promises");
|
|
8
8
|
let _hexclave_ui = require("@hexclave/ui");
|
|
9
9
|
let react = require("react");
|
|
10
10
|
let react_hook_form = require("react-hook-form");
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
4
|
const require_chunk = require('../chunk-BE-pF4vm.js');
|
|
5
|
-
let _hexclave_shared_dist_utils_promises = require("@hexclave/shared/dist/utils/promises");
|
|
6
5
|
let _hookform_resolvers_yup = require("@hookform/resolvers/yup");
|
|
7
6
|
let _hexclave_shared_dist_schema_fields = require("@hexclave/shared/dist/schema-fields");
|
|
7
|
+
let _hexclave_shared_dist_utils_promises = require("@hexclave/shared/dist/utils/promises");
|
|
8
8
|
let _hexclave_ui = require("@hexclave/ui");
|
|
9
9
|
let react = require("react");
|
|
10
10
|
let react_hook_form = require("react-hook-form");
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_chunk = require('../chunk-BE-pF4vm.js');
|
|
5
|
-
let _hexclave_shared_dist_utils_promises = require("@hexclave/shared/dist/utils/promises");
|
|
6
5
|
let _hookform_resolvers_yup = require("@hookform/resolvers/yup");
|
|
7
6
|
let _hexclave_shared_dist_schema_fields = require("@hexclave/shared/dist/schema-fields");
|
|
7
|
+
let _hexclave_shared_dist_utils_promises = require("@hexclave/shared/dist/utils/promises");
|
|
8
8
|
let _hexclave_ui = require("@hexclave/ui");
|
|
9
9
|
let react = require("react");
|
|
10
10
|
let react_hook_form = require("react-hook-form");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_chunk = require('../chunk-BE-pF4vm.js');
|
|
3
|
-
let _hexclave_shared_dist_utils_dev_tool = require("@hexclave/shared/dist/utils/dev-tool");
|
|
4
3
|
let _hexclave_shared_dist_utils_promises = require("@hexclave/shared/dist/utils/promises");
|
|
4
|
+
let _hexclave_shared_dist_utils_dev_tool = require("@hexclave/shared/dist/utils/dev-tool");
|
|
5
5
|
let ___in_page_ui_dom_js = require("../in-page-ui/dom.js");
|
|
6
6
|
let ___lib_hexclave_app_common_js = require("../lib/hexclave-app/common.js");
|
|
7
7
|
let _hexclave_shared_dist_utils_urls = require("@hexclave/shared/dist/utils/urls");
|
package/dist/dev-tool/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_chunk = require('../chunk-BE-pF4vm.js');
|
|
3
|
+
let _hexclave_shared_dist_utils_errors = require("@hexclave/shared/dist/utils/errors");
|
|
3
4
|
let _hexclave_shared_dist_utils_promises = require("@hexclave/shared/dist/utils/promises");
|
|
4
5
|
let ___in_page_ui_dom_js = require("../in-page-ui/dom.js");
|
|
5
|
-
let _hexclave_shared_dist_utils_errors = require("@hexclave/shared/dist/utils/errors");
|
|
6
6
|
let _hexclave_shared_dist_utils_urls = require("@hexclave/shared/dist/utils/urls");
|
|
7
7
|
|
|
8
8
|
//#region src/dev-tool/index.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
1
2
|
import { AnalyticsClickmapResponseBodySchema } from "@hexclave/shared/dist/interface/admin-metrics";
|
|
2
3
|
import { CLICKMAP_OVERLAY_RESUME_STORAGE_KEY, CLICKMAP_OVERLAY_TOKEN_STORAGE_KEY, CLICKMAP_OVERLAY_TOKEN_UPDATED_EVENT } from "@hexclave/shared/dist/utils/analytics-clickmap-overlay";
|
|
3
4
|
import { CLICKMAP_ROOT_ID, DEV_TOOL_ROOT_ID } from "@hexclave/shared/dist/utils/dev-tool";
|
|
4
5
|
import { cssEscapeIdent } from "@hexclave/shared/dist/utils/dom";
|
|
5
6
|
import { buildElementsChain, parseElementsChain } from "@hexclave/shared/dist/utils/elements-chain";
|
|
6
|
-
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
7
7
|
import { stringCompare } from "@hexclave/shared/dist/utils/strings";
|
|
8
8
|
import { getGlobalUiInstance, h, hasAppendChild, setGlobalUiInstance, setHtml } from "../in-page-ui/dom.js";
|
|
9
9
|
import { hexclaveAppInternalsSymbol } from "../lib/hexclave-app/common.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { captureError } from "@hexclave/shared/dist/utils/errors";
|
|
2
2
|
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
3
|
+
import { CLICKMAP_OVERLAY_RESUME_STORAGE_KEY, CLICKMAP_OVERLAY_TOKEN_UPDATED_EVENT } from "@hexclave/shared/dist/utils/analytics-clickmap-overlay";
|
|
3
4
|
import { canMountIntoDom } from "../in-page-ui/dom.js";
|
|
4
|
-
import { captureError } from "@hexclave/shared/dist/utils/errors";
|
|
5
5
|
|
|
6
6
|
//#region src/clickmap/index.ts
|
|
7
7
|
function consumeResumeSentinel() {
|
|
@@ -4,7 +4,7 @@ import { ApiKey, ApiKeyCreationOptions, ApiKeyType } from "../lib/hexclave-app/a
|
|
|
4
4
|
//#region src/components/api-key-dialogs.d.ts
|
|
5
5
|
declare const neverInMs: number;
|
|
6
6
|
declare const expiresInOptions: {
|
|
7
|
-
readonly [x: number]: "
|
|
7
|
+
readonly [x: number]: "1 day" | "7 days" | "30 days" | "90 days" | "1 year" | "Never";
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* Dialog for creating a new API key
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
4
|
-
import { captureError } from "@hexclave/shared/dist/utils/errors";
|
|
5
3
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
6
4
|
import { yupObject, yupString } from "@hexclave/shared/dist/schema-fields";
|
|
5
|
+
import { captureError } from "@hexclave/shared/dist/utils/errors";
|
|
6
|
+
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
7
7
|
import { ActionDialog, Button, CopyField, Input, Label, Typography } from "@hexclave/ui";
|
|
8
8
|
import { useState } from "react";
|
|
9
9
|
import { useForm } from "react-hook-form";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
4
3
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
5
4
|
import { passwordSchema, strictEmailSchema, yupObject } from "@hexclave/shared/dist/schema-fields";
|
|
5
|
+
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
6
6
|
import { Button, Input, Label, PasswordInput } from "@hexclave/ui";
|
|
7
7
|
import { useState } from "react";
|
|
8
8
|
import { useForm } from "react-hook-form";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { runAsynchronously, runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
4
3
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
5
4
|
import { passwordSchema, strictEmailSchema, yupObject } from "@hexclave/shared/dist/schema-fields";
|
|
5
|
+
import { runAsynchronously, runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
6
6
|
import { Button, Input, Label, PasswordInput } from "@hexclave/ui";
|
|
7
7
|
import React, { useState } from "react";
|
|
8
8
|
import { useForm } from "react-hook-form";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
4
3
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
5
4
|
import { strictEmailSchema, yupObject } from "@hexclave/shared/dist/schema-fields";
|
|
5
|
+
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
6
6
|
import { Button, Input, InputOTP, InputOTPGroup, InputOTPSlot, Label, Typography } from "@hexclave/ui";
|
|
7
7
|
import { useEffect, useState } from "react";
|
|
8
8
|
import { useForm } from "react-hook-form";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
4
3
|
import { HexclaveAssertionError } from "@hexclave/shared/dist/utils/errors";
|
|
4
|
+
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
5
5
|
import { Button, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Skeleton, Typography, cn } from "@hexclave/ui";
|
|
6
6
|
import { Suspense, useMemo } from "react";
|
|
7
7
|
import { useStackApp, useUser } from "../index.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
2
1
|
import { captureError } from "@hexclave/shared/dist/utils/errors";
|
|
2
|
+
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
3
3
|
import { ActionCell, Badge, Button, Skeleton, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Typography } from "@hexclave/ui";
|
|
4
4
|
import { useEffect, useState } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
2
1
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
3
2
|
import { strictEmailSchema, yupObject } from "@hexclave/shared/dist/schema-fields";
|
|
3
|
+
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
4
4
|
import { ActionCell, Badge, Button, Input, Table, TableBody, TableCell, TableRow, Typography } from "@hexclave/ui";
|
|
5
5
|
import { useEffect, useState } from "react";
|
|
6
6
|
import { useForm } from "react-hook-form";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
2
1
|
import { throwErr } from "@hexclave/shared/dist/utils/errors";
|
|
2
|
+
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
3
3
|
import { Button, Input, Typography } from "@hexclave/ui";
|
|
4
4
|
import { useEffect, useState } from "react";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { runAsynchronously, runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
2
1
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
3
2
|
import { passwordSchema, yupObject, yupString } from "@hexclave/shared/dist/schema-fields";
|
|
3
|
+
import { runAsynchronously, runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
4
4
|
import { Button, Input, Label, PasswordInput, Typography } from "@hexclave/ui";
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
import { useForm } from "react-hook-form";
|
|
@@ -3,8 +3,8 @@ import { useUser } from "../../../lib/hooks.js";
|
|
|
3
3
|
import { useTranslation } from "../../../lib/translations.js";
|
|
4
4
|
import { PageLayout } from "../page-layout.js";
|
|
5
5
|
import { Section } from "../section.js";
|
|
6
|
-
import { ProfileImageEditor } from "../../../components/profile-image-editor.js";
|
|
7
6
|
import { EditableText } from "../editable-text.js";
|
|
7
|
+
import { ProfileImageEditor } from "../../../components/profile-image-editor.js";
|
|
8
8
|
|
|
9
9
|
//#region src/components-page/account-settings/profile-page/profile-page.tsx
|
|
10
10
|
function ProfilePage(props) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
2
1
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
3
2
|
import { yupObject, yupString } from "@hexclave/shared/dist/schema-fields";
|
|
3
|
+
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
4
4
|
import { Button, Input } from "@hexclave/ui";
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
import { useForm } from "react-hook-form";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
2
1
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
3
2
|
import { strictEmailSchema, yupObject } from "@hexclave/shared/dist/schema-fields";
|
|
3
|
+
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
4
4
|
import { Button, Input, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Typography } from "@hexclave/ui";
|
|
5
5
|
import { useEffect, useState } from "react";
|
|
6
6
|
import { useForm } from "react-hook-form";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
4
3
|
import { captureError } from "@hexclave/shared/dist/utils/errors";
|
|
4
|
+
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
5
5
|
import { Skeleton, Tabs, TabsContent, TabsList, TabsTrigger, Typography, cn } from "@hexclave/ui";
|
|
6
6
|
import { Suspense, useMemo } from "react";
|
|
7
7
|
import { useStackApp, useUser } from "../index.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
4
|
-
import { hexclaveAppInternalsSymbol } from "../lib/hexclave-app/common.js";
|
|
5
4
|
import { Typography } from "@hexclave/ui";
|
|
6
5
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
7
6
|
import { useTranslation } from "../lib/translations.js";
|
|
8
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
import { useStackApp } from "../lib/hooks.js";
|
|
9
|
+
import { hexclaveAppInternalsSymbol } from "../lib/hexclave-app/common.js";
|
|
10
10
|
import { MessageCard } from "../components/message-cards/message-card.js";
|
|
11
11
|
|
|
12
12
|
//#region src/components-page/cli-auth-confirm.tsx
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
2
|
-
import { hexclaveAppInternalsSymbol } from "../lib/hexclave-app/common.js";
|
|
3
2
|
import React, { act } from "react";
|
|
4
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { hexclaveAppInternalsSymbol } from "../lib/hexclave-app/common.js";
|
|
5
5
|
import { createRoot } from "react-dom/client";
|
|
6
6
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
7
7
|
import { HexclaveContext } from "../providers/hexclave-context.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
4
3
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
5
4
|
import { strictEmailSchema, yupObject } from "@hexclave/shared/dist/schema-fields";
|
|
5
|
+
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
6
6
|
import { Button, Input, Label, Typography, cn } from "@hexclave/ui";
|
|
7
7
|
import { useState } from "react";
|
|
8
8
|
import { useForm } from "react-hook-form";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
4
3
|
import { captureError } from "@hexclave/shared/dist/utils/errors";
|
|
4
|
+
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
5
5
|
import { Spinner, cn } from "@hexclave/ui";
|
|
6
6
|
import { useEffect, useRef, useState } from "react";
|
|
7
7
|
import { useStackApp } from "../index.js";
|
|
@@ -10,7 +10,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
import { KnownError } from "@hexclave/shared";
|
|
11
11
|
import { MaybeFullPage } from "../components/elements/maybe-full-page.js";
|
|
12
12
|
import { StyledLink } from "../components/link.js";
|
|
13
|
-
import {
|
|
13
|
+
import { ErrorPage } from "./error-page.js";
|
|
14
14
|
|
|
15
15
|
//#region src/components-page/oauth-callback.tsx
|
|
16
16
|
function OAuthCallback({ fullPage }) {
|
|
@@ -18,36 +18,32 @@ function OAuthCallback({ fullPage }) {
|
|
|
18
18
|
const app = useStackApp();
|
|
19
19
|
const called = useRef(false);
|
|
20
20
|
const [showRedirectLink, setShowRedirectLink] = useState(false);
|
|
21
|
-
const [
|
|
21
|
+
const [errorSearchParams, setErrorSearchParams] = useState(null);
|
|
22
22
|
useEffect(() => runAsynchronously(async () => {
|
|
23
23
|
if (called.current) return;
|
|
24
24
|
called.current = true;
|
|
25
|
-
const redirectToError = async (url) => {
|
|
26
|
-
const urlString = url.toString();
|
|
27
|
-
if (app[hexclaveAppInternalsSymbol].getRedirectMethod() === "none") {
|
|
28
|
-
setRedirectUrl(urlString);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
await app[hexclaveAppInternalsSymbol].redirectToUrl(urlString, { replace: true });
|
|
32
|
-
};
|
|
33
25
|
try {
|
|
34
26
|
if (!await app.callOAuthCallback()) await app.redirectToSignIn({ noRedirectBack: true });
|
|
35
27
|
} catch (e) {
|
|
36
28
|
if (KnownError.isKnownError(e)) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
setErrorSearchParams({
|
|
30
|
+
errorCode: e.errorCode,
|
|
31
|
+
message: e.message,
|
|
32
|
+
details: JSON.stringify(e.details ?? {})
|
|
33
|
+
});
|
|
42
34
|
return;
|
|
43
35
|
}
|
|
44
36
|
captureError("<OAuthCallback />", e);
|
|
45
|
-
|
|
37
|
+
setErrorSearchParams({});
|
|
46
38
|
}
|
|
47
39
|
}), [app]);
|
|
48
40
|
useEffect(() => {
|
|
49
41
|
setTimeout(() => setShowRedirectLink(true), 3e3);
|
|
50
42
|
}, []);
|
|
43
|
+
if (errorSearchParams != null) return /* @__PURE__ */ jsx(ErrorPage, {
|
|
44
|
+
searchParams: errorSearchParams,
|
|
45
|
+
fullPage
|
|
46
|
+
});
|
|
51
47
|
return /* @__PURE__ */ jsx(MaybeFullPage, {
|
|
52
48
|
fullPage: fullPage ?? false,
|
|
53
49
|
containerClassName: "flex items-center justify-center",
|
|
@@ -56,11 +52,10 @@ function OAuthCallback({ fullPage }) {
|
|
|
56
52
|
children: [/* @__PURE__ */ jsx("div", {
|
|
57
53
|
className: "flex flex-col justify-center items-center gap-4",
|
|
58
54
|
children: /* @__PURE__ */ jsx(Spinner, { size: 20 })
|
|
59
|
-
}), showRedirectLink
|
|
55
|
+
}), showRedirectLink ? /* @__PURE__ */ jsxs("p", { children: [t("If you are not redirected automatically, "), /* @__PURE__ */ jsx(StyledLink, {
|
|
60
56
|
className: "whitespace-nowrap",
|
|
61
|
-
href:
|
|
57
|
+
href: "#",
|
|
62
58
|
onClick: (e) => {
|
|
63
|
-
if (redirectUrl != null) return;
|
|
64
59
|
e.preventDefault();
|
|
65
60
|
runAsynchronously(app.redirectToHome());
|
|
66
61
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-callback.js","names":[],"sources":["../../../src/components-page/oauth-callback.tsx"],"sourcesContent":["'use client';\n\n\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//===========================================\n\nimport { KnownError } from \"@hexclave/shared\";\nimport { captureError } from \"@hexclave/shared/dist/utils/errors\";\nimport { runAsynchronously } from \"@hexclave/shared/dist/utils/promises\";\nimport { Spinner, cn } from \"@hexclave/ui\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { useStackApp } from \"..\";\nimport { MaybeFullPage } from \"../components/elements/maybe-full-page\";\nimport { StyledLink } from \"../components/link\";\nimport {
|
|
1
|
+
{"version":3,"file":"oauth-callback.js","names":[],"sources":["../../../src/components-page/oauth-callback.tsx"],"sourcesContent":["'use client';\n\n\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//===========================================\n\nimport { KnownError } from \"@hexclave/shared\";\nimport { captureError } from \"@hexclave/shared/dist/utils/errors\";\nimport { runAsynchronously } from \"@hexclave/shared/dist/utils/promises\";\nimport { Spinner, cn } from \"@hexclave/ui\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { useStackApp } from \"..\";\nimport { MaybeFullPage } from \"../components/elements/maybe-full-page\";\nimport { StyledLink } from \"../components/link\";\nimport { useTranslation } from \"../lib/translations\";\nimport { ErrorPage } from \"./error-page\";\n\nexport function OAuthCallback({ fullPage }: { fullPage?: boolean }) {\n const { t } = useTranslation();\n const app = useStackApp();\n const called = useRef(false);\n const [showRedirectLink, setShowRedirectLink] = useState(false);\n const [errorSearchParams, setErrorSearchParams] = useState<Record<string, string> | null>(null);\n\n useEffect(() => runAsynchronously(async () => {\n if (called.current) return;\n called.current = true;\n try {\n const hasRedirected = await app.callOAuthCallback();\n if (!hasRedirected) {\n await app.redirectToSignIn({ noRedirectBack: true });\n }\n } catch (e) {\n if (KnownError.isKnownError(e)) {\n setErrorSearchParams({\n errorCode: e.errorCode,\n message: e.message,\n details: JSON.stringify(e.details ?? {}),\n });\n return;\n }\n captureError(\"<OAuthCallback />\", e);\n setErrorSearchParams({});\n }\n }), [app]);\n\n useEffect(() => {\n setTimeout(() => setShowRedirectLink(true), 3000);\n }, []);\n\n if (errorSearchParams != null) {\n return <ErrorPage searchParams={errorSearchParams} fullPage={fullPage} />;\n }\n\n return (\n <MaybeFullPage\n fullPage={fullPage ?? false}\n containerClassName=\"flex items-center justify-center\"\n >\n <div\n className={cn(\n \"text-center justify-center items-center stack-scope flex flex-col gap-4 max-w-[380px]\",\n fullPage ? \"p-4\" : \"p-0\"\n )}\n >\n <div className=\"flex flex-col justify-center items-center gap-4\">\n <Spinner size={20} />\n </div>\n {showRedirectLink ? <p>{t('If you are not redirected automatically, ')}<StyledLink\n className=\"whitespace-nowrap\"\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n runAsynchronously(app.redirectToHome());\n }}\n >{t(\"click here\")}</StyledLink></p> : null}\n </div>\n </MaybeFullPage>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,SAAgB,cAAc,EAAE,YAAoC;CAClE,MAAM,EAAE,MAAM,gBAAgB;CAC9B,MAAM,MAAM,aAAa;CACzB,MAAM,SAAS,OAAO,MAAM;CAC5B,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,MAAM;CAC/D,MAAM,CAAC,mBAAmB,wBAAwB,SAAwC,KAAK;AAE/F,iBAAgB,kBAAkB,YAAY;AAC5C,MAAI,OAAO,QAAS;AACpB,SAAO,UAAU;AACjB,MAAI;AAEF,OAAI,CADkB,MAAM,IAAI,mBAAmB,CAEjD,OAAM,IAAI,iBAAiB,EAAE,gBAAgB,MAAM,CAAC;WAE/C,GAAG;AACV,OAAI,WAAW,aAAa,EAAE,EAAE;AAC9B,yBAAqB;KACnB,WAAW,EAAE;KACb,SAAS,EAAE;KACX,SAAS,KAAK,UAAU,EAAE,WAAW,EAAE,CAAC;KACzC,CAAC;AACF;;AAEF,gBAAa,qBAAqB,EAAE;AACpC,wBAAqB,EAAE,CAAC;;GAE1B,EAAE,CAAC,IAAI,CAAC;AAEV,iBAAgB;AACd,mBAAiB,oBAAoB,KAAK,EAAE,IAAK;IAChD,EAAE,CAAC;AAEN,KAAI,qBAAqB,KACvB,QAAO,oBAAC;EAAU,cAAc;EAA6B;GAAY;AAG3E,QACE,oBAAC;EACC,UAAU,YAAY;EACtB,oBAAmB;YAEnB,qBAAC;GACC,WAAW,GACT,yFACA,WAAW,QAAQ,MACpB;cAED,oBAAC;IAAI,WAAU;cACb,oBAAC,WAAQ,MAAM,KAAM;KACjB,EACL,mBAAmB,qBAAC,kBAAG,EAAE,4CAA4C,EAAC,oBAAC;IACtE,WAAU;IACV,MAAK;IACL,UAAU,MAAM;AACd,OAAE,gBAAgB;AAClB,uBAAkB,IAAI,gBAAgB,CAAC;;cAEzC,EAAE,aAAa;KAAc,IAAI,GAAG;IAClC;GACQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React, { act } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { KnownErrors } from "@hexclave/shared";
|
|
4
|
+
import { createRoot } from "react-dom/client";
|
|
5
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
6
|
+
import { OAuthCallback } from "./oauth-callback.js";
|
|
7
|
+
import { TranslationProviderClient } from "../providers/translation-provider-client.js";
|
|
8
|
+
|
|
9
|
+
//#region src/components-page/oauth-callback.test.tsx
|
|
10
|
+
// @vitest-environment jsdom
|
|
11
|
+
const appMockState = vi.hoisted(() => ({ app: null }));
|
|
12
|
+
vi.mock("..", () => ({ useStackApp: () => {
|
|
13
|
+
if (appMockState.app == null) throw new Error("Expected test app to be set before rendering.");
|
|
14
|
+
return appMockState.app;
|
|
15
|
+
} }));
|
|
16
|
+
vi.mock("@hexclave/ui", async () => {
|
|
17
|
+
await import("react");
|
|
18
|
+
return {
|
|
19
|
+
Button: (props) => /* @__PURE__ */ jsx("button", {
|
|
20
|
+
type: "button",
|
|
21
|
+
onClick: props.onClick,
|
|
22
|
+
children: props.children
|
|
23
|
+
}),
|
|
24
|
+
Spinner: () => /* @__PURE__ */ jsx("div", { "data-testid": "spinner" }),
|
|
25
|
+
Typography: (props) => /* @__PURE__ */ jsx("div", { children: props.children }),
|
|
26
|
+
cn: (...classes) => classes.filter(Boolean).join(" ")
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
const previousActEnvironment = Reflect.get(globalThis, "IS_REACT_ACT_ENVIRONMENT");
|
|
30
|
+
function createAppTestDouble(options) {
|
|
31
|
+
return {
|
|
32
|
+
callOAuthCallback: options.callOAuthCallback,
|
|
33
|
+
redirectToSignIn: vi.fn(async () => {}),
|
|
34
|
+
redirectToHome: vi.fn(async () => {})
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
let root = null;
|
|
38
|
+
let container = null;
|
|
39
|
+
async function renderWithApp(app) {
|
|
40
|
+
appMockState.app = app;
|
|
41
|
+
container = document.createElement("div");
|
|
42
|
+
document.body.append(container);
|
|
43
|
+
root = createRoot(container);
|
|
44
|
+
await act(async () => {
|
|
45
|
+
root?.render(/* @__PURE__ */ jsx(TranslationProviderClient, {
|
|
46
|
+
quetzalKeys: /* @__PURE__ */ new Map(),
|
|
47
|
+
quetzalLocale: /* @__PURE__ */ new Map(),
|
|
48
|
+
children: /* @__PURE__ */ jsx(OAuthCallback, {})
|
|
49
|
+
}));
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
async function flushEffects() {
|
|
53
|
+
await act(async () => {
|
|
54
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
describe("OAuthCallback", () => {
|
|
58
|
+
beforeEach(() => {
|
|
59
|
+
Reflect.set(globalThis, "IS_REACT_ACT_ENVIRONMENT", true);
|
|
60
|
+
});
|
|
61
|
+
afterEach(() => {
|
|
62
|
+
act(() => {
|
|
63
|
+
root?.unmount();
|
|
64
|
+
});
|
|
65
|
+
container?.remove();
|
|
66
|
+
root = null;
|
|
67
|
+
container = null;
|
|
68
|
+
appMockState.app = null;
|
|
69
|
+
vi.restoreAllMocks();
|
|
70
|
+
Reflect.set(globalThis, "IS_REACT_ACT_ENVIRONMENT", previousActEnvironment);
|
|
71
|
+
});
|
|
72
|
+
it("renders backend-encoded OAuth callback errors on the callback page", async () => {
|
|
73
|
+
const errorMessage = "Your sign up was rejected by an administrator's sign-up rule.";
|
|
74
|
+
const callOAuthCallback = vi.fn(async () => {
|
|
75
|
+
throw new KnownErrors.SignUpRejected(errorMessage);
|
|
76
|
+
});
|
|
77
|
+
const app = createAppTestDouble({ callOAuthCallback });
|
|
78
|
+
await renderWithApp(app);
|
|
79
|
+
await flushEffects();
|
|
80
|
+
expect(callOAuthCallback).toHaveBeenCalledOnce();
|
|
81
|
+
expect(container?.textContent).toContain("SIGN_UP_REJECTED");
|
|
82
|
+
expect(container?.textContent).toContain(errorMessage);
|
|
83
|
+
expect(app.redirectToSignIn).not.toHaveBeenCalled();
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
export { };
|
|
89
|
+
//# sourceMappingURL=oauth-callback.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-callback.test.js","names":[],"sources":["../../../src/components-page/oauth-callback.test.tsx"],"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//===========================================\n// @vitest-environment jsdom\n\nimport { KnownErrors } from \"@hexclave/shared\";\nimport React, { act } from \"react\";\nimport { createRoot, type Root } from \"react-dom/client\";\nimport { afterEach, beforeEach, describe, expect, it, vi } from \"vitest\";\nimport type { StackClientApp } from \"../lib/hexclave-app/apps/interfaces/client-app\";\nimport { TranslationProviderClient } from \"../providers/translation-provider-client\";\nimport { OAuthCallback } from \"./oauth-callback\";\n\nconst appMockState = vi.hoisted(() => ({ app: null as unknown }));\n\nvi.mock(\"..\", () => ({\n useStackApp: () => {\n if (appMockState.app == null) {\n throw new Error(\"Expected test app to be set before rendering.\");\n }\n return appMockState.app;\n },\n}));\n\nvi.mock(\"@hexclave/ui\", async () => {\n const React = await import(\"react\");\n return {\n Button: (props: { children: React.ReactNode, onClick?: () => void }) => (\n <button type=\"button\" onClick={props.onClick}>{props.children}</button>\n ),\n Spinner: () => <div data-testid=\"spinner\" />,\n Typography: (props: { children: React.ReactNode }) => <div>{props.children}</div>,\n cn: (...classes: (string | false | null | undefined)[]) => classes.filter(Boolean).join(\" \"),\n };\n});\n\nconst previousActEnvironment = Reflect.get(globalThis, \"IS_REACT_ACT_ENVIRONMENT\");\n\nfunction createAppTestDouble(options: {\n callOAuthCallback: () => Promise<boolean>,\n}) {\n const app = {\n callOAuthCallback: options.callOAuthCallback,\n redirectToSignIn: vi.fn(async () => {}),\n redirectToHome: vi.fn(async () => {}),\n };\n\n // This test double intentionally implements only the StackClientApp surface\n // that OAuthCallback and the rendered error card touch.\n return app as unknown as StackClientApp<true>;\n}\n\nlet root: Root | null = null;\nlet container: HTMLDivElement | null = null;\n\nasync function renderWithApp(app: StackClientApp<true>) {\n appMockState.app = app;\n container = document.createElement(\"div\");\n document.body.append(container);\n root = createRoot(container);\n await act(async () => {\n root?.render(\n <TranslationProviderClient quetzalKeys={new Map()} quetzalLocale={new Map()}>\n <OAuthCallback />\n </TranslationProviderClient>\n );\n });\n}\n\nasync function flushEffects() {\n await act(async () => {\n await new Promise((resolve) => setTimeout(resolve, 0));\n });\n}\n\ndescribe(\"OAuthCallback\", () => {\n beforeEach(() => {\n Reflect.set(globalThis, \"IS_REACT_ACT_ENVIRONMENT\", true);\n });\n\n afterEach(() => {\n act(() => {\n root?.unmount();\n });\n container?.remove();\n root = null;\n container = null;\n appMockState.app = null;\n vi.restoreAllMocks();\n Reflect.set(globalThis, \"IS_REACT_ACT_ENVIRONMENT\", previousActEnvironment);\n });\n\n it(\"renders backend-encoded OAuth callback errors on the callback page\", async () => {\n const errorMessage = \"Your sign up was rejected by an administrator's sign-up rule.\";\n const callOAuthCallback = vi.fn(async () => {\n throw new KnownErrors.SignUpRejected(errorMessage);\n });\n const app = createAppTestDouble({ callOAuthCallback });\n\n await renderWithApp(app);\n await flushEffects();\n\n expect(callOAuthCallback).toHaveBeenCalledOnce();\n expect(container?.textContent).toContain(\"SIGN_UP_REJECTED\");\n expect(container?.textContent).toContain(errorMessage);\n expect(app.redirectToSignIn).not.toHaveBeenCalled();\n });\n});\n"],"mappings":";;;;;;;;;;AAcA,MAAM,eAAe,GAAG,eAAe,EAAE,KAAK,MAAiB,EAAE;AAEjE,GAAG,KAAK,aAAa,EACnB,mBAAmB;AACjB,KAAI,aAAa,OAAO,KACtB,OAAM,IAAI,MAAM,gDAAgD;AAElE,QAAO,aAAa;GAEvB,EAAE;AAEH,GAAG,KAAK,gBAAgB,YAAY;AACpB,OAAM,OAAO;AAC3B,QAAO;EACL,SAAS,UACP,oBAAC;GAAO,MAAK;GAAS,SAAS,MAAM;aAAU,MAAM;IAAkB;EAEzE,eAAe,oBAAC,SAAI,eAAY,YAAY;EAC5C,aAAa,UAAyC,oBAAC,mBAAK,MAAM,WAAe;EACjF,KAAK,GAAG,YAAmD,QAAQ,OAAO,QAAQ,CAAC,KAAK,IAAI;EAC7F;EACD;AAEF,MAAM,yBAAyB,QAAQ,IAAI,YAAY,2BAA2B;AAElF,SAAS,oBAAoB,SAE1B;AASD,QARY;EACV,mBAAmB,QAAQ;EAC3B,kBAAkB,GAAG,GAAG,YAAY,GAAG;EACvC,gBAAgB,GAAG,GAAG,YAAY,GAAG;EACtC;;AAOH,IAAI,OAAoB;AACxB,IAAI,YAAmC;AAEvC,eAAe,cAAc,KAA2B;AACtD,cAAa,MAAM;AACnB,aAAY,SAAS,cAAc,MAAM;AACzC,UAAS,KAAK,OAAO,UAAU;AAC/B,QAAO,WAAW,UAAU;AAC5B,OAAM,IAAI,YAAY;AACpB,QAAM,OACJ,oBAAC;GAA0B,6BAAa,IAAI,KAAK;GAAE,+BAAe,IAAI,KAAK;aACzE,oBAAC,kBAAgB;IACS,CAC7B;GACD;;AAGJ,eAAe,eAAe;AAC5B,OAAM,IAAI,YAAY;AACpB,QAAM,IAAI,SAAS,YAAY,WAAW,SAAS,EAAE,CAAC;GACtD;;AAGJ,SAAS,uBAAuB;AAC9B,kBAAiB;AACf,UAAQ,IAAI,YAAY,4BAA4B,KAAK;GACzD;AAEF,iBAAgB;AACd,YAAU;AACR,SAAM,SAAS;IACf;AACF,aAAW,QAAQ;AACnB,SAAO;AACP,cAAY;AACZ,eAAa,MAAM;AACnB,KAAG,iBAAiB;AACpB,UAAQ,IAAI,YAAY,4BAA4B,uBAAuB;GAC3E;AAEF,IAAG,sEAAsE,YAAY;EACnF,MAAM,eAAe;EACrB,MAAM,oBAAoB,GAAG,GAAG,YAAY;AAC1C,SAAM,IAAI,YAAY,eAAe,aAAa;IAClD;EACF,MAAM,MAAM,oBAAoB,EAAE,mBAAmB,CAAC;AAEtD,QAAM,cAAc,IAAI;AACxB,QAAM,cAAc;AAEpB,SAAO,kBAAkB,CAAC,sBAAsB;AAChD,SAAO,WAAW,YAAY,CAAC,UAAU,mBAAmB;AAC5D,SAAO,WAAW,YAAY,CAAC,UAAU,aAAa;AACtD,SAAO,IAAI,iBAAiB,CAAC,IAAI,kBAAkB;GACnD;EACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { runAsynchronously, runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
4
3
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
5
4
|
import { strictEmailSchema, yupObject } from "@hexclave/shared/dist/schema-fields";
|
|
5
|
+
import { runAsynchronously, runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
6
6
|
import { Button, Input, Typography } from "@hexclave/ui";
|
|
7
7
|
import { useState } from "react";
|
|
8
8
|
import { useForm } from "react-hook-form";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
4
3
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
5
4
|
import { passwordSchema, yupObject, yupString } from "@hexclave/shared/dist/schema-fields";
|
|
5
|
+
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
6
6
|
import { Button, Label, PasswordInput, Typography, cn } from "@hexclave/ui";
|
|
7
7
|
import { useState } from "react";
|
|
8
8
|
import { useForm } from "react-hook-form";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
4
3
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
5
4
|
import { yupObject, yupString } from "@hexclave/shared/dist/schema-fields";
|
|
5
|
+
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
6
6
|
import { Button, Input, Label, Typography } from "@hexclave/ui";
|
|
7
7
|
import { useState } from "react";
|
|
8
8
|
import { useForm } from "react-hook-form";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DEV_TOOL_ROOT_ID } from "@hexclave/shared/dist/utils/dev-tool";
|
|
2
1
|
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
2
|
+
import { DEV_TOOL_ROOT_ID } from "@hexclave/shared/dist/utils/dev-tool";
|
|
3
3
|
import { getGlobalUiInstance, h, hasAppendChild, setGlobalUiInstance, setHtml } from "../in-page-ui/dom.js";
|
|
4
4
|
import { hexclaveAppInternalsSymbol } from "../lib/hexclave-app/common.js";
|
|
5
5
|
import { isLocalhost } from "@hexclave/shared/dist/utils/urls";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { captureError } from "@hexclave/shared/dist/utils/errors";
|
|
1
2
|
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
2
3
|
import { canMountIntoDom } from "../in-page-ui/dom.js";
|
|
3
|
-
import { captureError } from "@hexclave/shared/dist/utils/errors";
|
|
4
4
|
import { isLocalhost } from "@hexclave/shared/dist/utils/urls";
|
|
5
5
|
|
|
6
6
|
//#region src/dev-tool/index.ts
|