@hexclave/tanstack-start 1.0.64 → 1.0.66
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/{admin-app-impl-Cdh1oCee.d.ts → admin-app-impl-WvWhAoAp.d.ts} +2 -2
- package/dist/{admin-app-impl-Cdh1oCee.d.ts.map → admin-app-impl-WvWhAoAp.d.ts.map} +1 -1
- package/dist/auth-page-YnM_LtbN.d.ts.map +1 -1
- package/dist/cli-auth-confirm-BW3PYpKb.d.ts.map +1 -1
- package/dist/components/api-key-dialogs.d.ts +1 -1
- package/dist/components/api-key-dialogs.js +4 -4
- package/dist/components/credential-sign-in.js +3 -3
- package/dist/components/credential-sign-up.js +5 -5
- package/dist/components/elements/sidebar-layout.js +2 -2
- package/dist/components/elements/user-avatar.js +1 -1
- package/dist/components/magic-link-sign-in.js +5 -5
- package/dist/components/message-cards/no-auth-methods-message-card.d.ts +13 -0
- package/dist/components/message-cards/no-auth-methods-message-card.d.ts.map +1 -0
- package/dist/components/message-cards/no-auth-methods-message-card.js +75 -0
- package/dist/components/message-cards/no-auth-methods-message-card.js.map +1 -0
- package/dist/components/message-cards/predefined-message-card.js +1 -1
- package/dist/components/passkey-button.js +1 -1
- package/dist/components/profile-image-editor.js +1 -1
- package/dist/components/team-icon.js +1 -1
- package/dist/components/team-switcher.js +1 -1
- package/dist/components/user-button.js +1 -1
- package/dist/components-page/account-settings/editable-text.js +1 -1
- package/dist/components-page/account-settings/email-and-auth/emails-section.js +3 -3
- package/dist/components-page/account-settings/email-and-auth/password-section.js +3 -3
- package/dist/components-page/account-settings/teams/team-creation-page.js +3 -3
- package/dist/components-page/account-settings/teams/team-member-invitation-section.js +4 -4
- package/dist/components-page/account-settings.js +3 -3
- package/dist/components-page/auth-page.js +8 -3
- package/dist/components-page/auth-page.js.map +1 -1
- package/dist/components-page/cli-auth-confirm.js +8 -2
- package/dist/components-page/cli-auth-confirm.js.map +1 -1
- package/dist/components-page/cli-auth-confirm.test.js +42 -0
- package/dist/components-page/cli-auth-confirm.test.js.map +1 -1
- package/dist/components-page/forgot-password.js +5 -5
- package/dist/components-page/hexclave-handler-client.js +1 -1
- package/dist/components-page/mfa.js +3 -3
- package/dist/components-page/oauth-callback.js +1 -1
- package/dist/components-page/onboarding.js +4 -4
- package/dist/components-page/password-reset.js +8 -8
- package/dist/components-page/team-creation.js +5 -5
- package/dist/esm/components/api-key-dialogs.d.ts +1 -1
- package/dist/esm/components/api-key-dialogs.js +4 -4
- package/dist/esm/components/credential-sign-in.js +3 -3
- package/dist/esm/components/credential-sign-up.js +5 -5
- package/dist/esm/components/elements/sidebar-layout.js +2 -2
- package/dist/esm/components/elements/user-avatar.js +1 -1
- package/dist/esm/components/magic-link-sign-in.js +5 -5
- package/dist/esm/components/message-cards/no-auth-methods-message-card.d.ts +13 -0
- package/dist/esm/components/message-cards/no-auth-methods-message-card.d.ts.map +1 -0
- package/dist/esm/components/message-cards/no-auth-methods-message-card.js +74 -0
- package/dist/esm/components/message-cards/no-auth-methods-message-card.js.map +1 -0
- package/dist/esm/components/message-cards/predefined-message-card.js +1 -1
- package/dist/esm/components/passkey-button.js +1 -1
- package/dist/esm/components/profile-image-editor.js +1 -1
- package/dist/esm/components/team-icon.js +1 -1
- package/dist/esm/components/team-switcher.js +1 -1
- package/dist/esm/components/user-button.js +1 -1
- package/dist/esm/components-page/account-settings/editable-text.js +1 -1
- package/dist/esm/components-page/account-settings/email-and-auth/emails-section.js +3 -3
- package/dist/esm/components-page/account-settings/email-and-auth/password-section.js +3 -3
- package/dist/esm/components-page/account-settings/teams/team-creation-page.js +3 -3
- package/dist/esm/components-page/account-settings/teams/team-member-invitation-section.js +4 -4
- package/dist/esm/components-page/account-settings.js +3 -3
- package/dist/esm/components-page/auth-page.d.ts.map +1 -1
- package/dist/esm/components-page/auth-page.js +8 -3
- package/dist/esm/components-page/auth-page.js.map +1 -1
- package/dist/esm/components-page/cli-auth-confirm.d.ts.map +1 -1
- package/dist/esm/components-page/cli-auth-confirm.js +8 -2
- package/dist/esm/components-page/cli-auth-confirm.js.map +1 -1
- package/dist/esm/components-page/cli-auth-confirm.test.js +42 -0
- package/dist/esm/components-page/cli-auth-confirm.test.js.map +1 -1
- package/dist/esm/components-page/forgot-password.js +5 -5
- package/dist/esm/components-page/hexclave-handler-client.js +1 -1
- package/dist/esm/components-page/mfa.js +3 -3
- package/dist/esm/components-page/oauth-callback.js +1 -1
- package/dist/esm/components-page/onboarding.js +4 -4
- package/dist/esm/components-page/password-reset.js +7 -7
- package/dist/esm/components-page/team-creation.js +5 -5
- package/dist/esm/generated/global-css.d.ts +1 -1
- package/dist/esm/generated/global-css.js +1 -1
- package/dist/esm/generated/global-css.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 +2 -2
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/common.js +2 -2
- package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.d.ts +1 -1
- package/dist/esm/lib/hexclave-app/users/index.d.ts +1 -1
- package/dist/generated/global-css.d.ts +1 -1
- package/dist/generated/global-css.js +1 -1
- package/dist/generated/global-css.js.map +1 -1
- package/dist/generated/quetzal-translations.d.ts +1 -1
- package/dist/{hexclave-provider-Dxrf-i1f.d.ts → hexclave-provider-CN52q2zh.d.ts} +2 -2
- package/dist/{hexclave-provider-Dxrf-i1f.d.ts.map → hexclave-provider-CN52q2zh.d.ts.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/implementations/common.js +2 -2
- package/dist/lib/hexclave-app/apps/implementations/index.d.ts +1 -1
- package/dist/lib/hexclave-app/apps/implementations/server-app-impl.d.ts +1 -1
- package/dist/providers/hexclave-provider.d.ts +1 -1
- package/dist/providers/translation-provider.d.ts +1 -1
- package/dist/{quetzal-translations-CK45_4Dm.d.ts → quetzal-translations-XeH3zQ9l.d.ts} +3 -3
- package/dist/{quetzal-translations-CK45_4Dm.d.ts.map → quetzal-translations-XeH3zQ9l.d.ts.map} +1 -1
- package/dist/{translation-provider-DQ3BJepJ.d.ts → translation-provider-WOaZXqAz.d.ts} +2 -2
- package/dist/{translation-provider-DQ3BJepJ.d.ts.map → translation-provider-WOaZXqAz.d.ts.map} +1 -1
- package/package.json +3 -3
- package/src/components/message-cards/no-auth-methods-message-card.tsx +57 -0
- package/src/components-page/auth-page.tsx +18 -1
- package/src/components-page/cli-auth-confirm.test.tsx +55 -0
- package/src/components-page/cli-auth-confirm.tsx +11 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-auth-confirm.test.js","names":[],"sources":["../../../src/components-page/cli-auth-confirm.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 { runAsynchronously } from \"@hexclave/shared/dist/utils/promises\";\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 { hexclaveAppInternalsSymbol } from \"../lib/hexclave-app/common\";\nimport { HexclaveContext } from \"../providers/hexclave-context\";\nimport { useCliAuthConfirmation } from \"./cli-auth-confirm\";\n\nconst previousActEnvironment = Reflect.get(globalThis, \"IS_REACT_ACT_ENVIRONMENT\");\n\nfunction responseJson(data: unknown, init?: ResponseInit) {\n return new Response(JSON.stringify(data), {\n status: init?.status ?? 200,\n headers: { \"Content-Type\": \"application/json\" },\n });\n}\n\nfunction createAppTestDouble(options: {\n user: unknown,\n sendRequest: (path: string, requestOptions: RequestInit) => Promise<Response>,\n signInWithTokens?: (tokens: { accessToken: string, refreshToken: string }) => Promise<void>,\n redirectToSignIn?: (options: { replace: true }) => Promise<void>,\n redirectToSignUp?: (options: { replace: true }) => Promise<void>,\n}) {\n const app = {\n useUser: () => options.user,\n redirectToSignIn: options.redirectToSignIn ?? vi.fn(async () => {}),\n redirectToSignUp: options.redirectToSignUp ?? vi.fn(async () => {}),\n [hexclaveAppInternalsSymbol]: {\n sendRequest: options.sendRequest,\n signInWithTokens: options.signInWithTokens ?? vi.fn(async () => {}),\n },\n };\n\n // This test double intentionally implements only the StackClientApp surface\n // that useCliAuthConfirmation touches.\n return app as unknown as StackClientApp<true>;\n}\n\nfunction HookProbe() {\n const cliAuth = useCliAuthConfirmation();\n return (\n <>\n <div data-testid=\"status\">{cliAuth.status}</div>\n <div data-testid=\"error\">{cliAuth.error?.message}</div>\n <button type=\"button\" onClick={() => runAsynchronously(cliAuth.authorize)}>authorize</button>\n <button onClick={cliAuth.retry}>retry</button>\n </>\n );\n}\n\nlet root: Root | null = null;\nlet container: HTMLDivElement | null = null;\n\nasync function renderWithApp(app: StackClientApp<true>) {\n container = document.createElement(\"div\");\n document.body.append(container);\n root = createRoot(container);\n await act(async () => {\n root?.render(\n <HexclaveContext.Provider value={{ app }}>\n <HookProbe />\n </HexclaveContext.Provider>\n );\n });\n}\n\nfunction getByTestId(testId: string): HTMLElement {\n const element = container?.querySelector(`[data-testid=\"${testId}\"]`);\n if (!(element instanceof HTMLElement)) {\n throw new Error(`Could not find test element ${testId}`);\n }\n return element;\n}\n\nfunction getButton(label: string): HTMLButtonElement {\n const button = [...container?.querySelectorAll(\"button\") ?? []]\n .find((element) => element.textContent === label);\n if (!(button instanceof HTMLButtonElement)) {\n throw new Error(`Could not find button ${label}`);\n }\n return button;\n}\n\ndescribe(\"useCliAuthConfirmation\", () => {\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 vi.restoreAllMocks();\n window.history.replaceState({}, \"\", \"/\");\n Reflect.set(globalThis, \"IS_REACT_ACT_ENVIRONMENT\", previousActEnvironment);\n });\n\n it(\"completes CLI auth with the current user's refresh token\", async () => {\n window.history.replaceState({}, \"\", \"/handler/cli-auth-confirm?login_code=login-code\");\n const getTokens = vi.fn(async () => ({ refreshToken: \"refresh-token\" }));\n const sendRequest = vi.fn(async (_path: string, _requestOptions: RequestInit) => new Response(null, { status: 200 }));\n const app = createAppTestDouble({\n user: { currentSession: { getTokens } },\n sendRequest,\n });\n\n await renderWithApp(app);\n await act(async () => {\n getButton(\"authorize\").click();\n });\n\n expect(getByTestId(\"status\").textContent).toBe(\"success\");\n expect(getTokens).toHaveBeenCalledOnce();\n expect(sendRequest).toHaveBeenCalledOnce();\n expect(sendRequest.mock.calls[0][0]).toBe(\"/auth/cli/complete\");\n expect(JSON.parse(String(sendRequest.mock.calls[0][1].body))).toMatchInlineSnapshot(`\n {\n \"login_code\": \"login-code\",\n \"refresh_token\": \"refresh-token\",\n }\n `);\n });\n\n it(\"ignores duplicate authorize clicks before React re-renders\", async () => {\n window.history.replaceState({}, \"\", \"/handler/cli-auth-confirm?login_code=login-code\");\n const getTokens = vi.fn(async () => ({ refreshToken: \"refresh-token\" }));\n const sendRequest = vi.fn(async (_path: string, _requestOptions: RequestInit) => new Response(null, { status: 200 }));\n const app = createAppTestDouble({\n user: { currentSession: { getTokens } },\n sendRequest,\n });\n\n await renderWithApp(app);\n await act(async () => {\n const authorizeButton = getButton(\"authorize\");\n authorizeButton.click();\n authorizeButton.click();\n });\n\n expect(sendRequest).toHaveBeenCalledOnce();\n });\n\n it(\"claims anonymous CLI sessions before redirecting to sign-up\", async () => {\n window.history.replaceState({}, \"\", \"/handler/cli-auth-confirm?login_code=login-code\");\n const signInWithTokens = vi.fn(async (_tokens: { accessToken: string, refreshToken: string }) => {});\n const redirectToSignUp = vi.fn(async (_options: { replace: true }) => {});\n const sendRequest = vi.fn(async (_path: string, _requestOptions: RequestInit) => new Response(null, { status: 200 }))\n .mockResolvedValueOnce(responseJson({ cli_session_state: \"anonymous\" }))\n .mockResolvedValueOnce(responseJson({ access_token: \"access-token\", refresh_token: \"refresh-token\" }));\n const app = createAppTestDouble({\n user: null,\n sendRequest,\n signInWithTokens,\n redirectToSignUp,\n });\n\n await renderWithApp(app);\n await act(async () => {\n getButton(\"authorize\").click();\n });\n\n expect(redirectToSignUp).toHaveBeenCalledWith({ replace: true });\n expect(signInWithTokens).toHaveBeenCalledWith({\n accessToken: \"access-token\",\n refreshToken: \"refresh-token\",\n });\n expect(sessionStorage.getItem(\"hexclave-cli-auth-confirmed\")).toBe(\"login-code\");\n expect(sendRequest.mock.calls.map(call => JSON.parse(String(call[1].body)))).toMatchInlineSnapshot(`\n [\n {\n \"login_code\": \"login-code\",\n \"mode\": \"check\",\n },\n {\n \"login_code\": \"login-code\",\n \"mode\": \"claim-anon-session\",\n },\n ]\n `);\n });\n\n it(\"reports invalid when the login code is missing\", async () => {\n window.history.replaceState({}, \"\", \"/handler/cli-auth-confirm\");\n const app = createAppTestDouble({\n user: null,\n sendRequest: vi.fn(async (_path: string, _requestOptions: RequestInit) => new Response(null, { status: 200 })),\n });\n\n await renderWithApp(app);\n\n expect(getByTestId(\"status\").textContent).toBe(\"invalid\");\n });\n});\n"],"mappings":";;;;;;;;;;AAeA,MAAM,yBAAyB,QAAQ,IAAI,YAAY,0BAA0B;AAEjF,SAAS,aAAa,MAAe,MAAqB;CACxD,OAAO,IAAI,SAAS,KAAK,UAAU,IAAI,GAAG;EACxC,QAAQ,MAAM,UAAU;EACxB,SAAS,EAAE,gBAAgB,mBAAmB;CAChD,CAAC;AACH;AAEA,SAAS,oBAAoB,SAM1B;CAaD,OAAO;EAXL,eAAe,QAAQ;EACvB,kBAAkB,QAAQ,oBAAoB,GAAG,GAAG,YAAY,CAAC,CA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AAsB;;;;;;;;;;;KAWlG;CACH,CAAC;CAED,GAAG,kDAAkD,YAAY;EAC/D,OAAO,QAAQ,aAAa,CAAC,GAAG,IAAI,2BAA2B;EAM/D,MAAM,cALM,oBAAoB;GAC9B,MAAM;GACN,aAAa,GAAG,GAAG,OAAO,OAAe,oBAAiC,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC,CAAC;EAC/G,CAEsB,CAAC;EAEvB,OAAO,YAAY,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,SAAS;CAC1D,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"cli-auth-confirm.test.js","names":[],"sources":["../../../src/components-page/cli-auth-confirm.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 { runAsynchronously } from \"@hexclave/shared/dist/utils/promises\";\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 { hexclaveAppInternalsSymbol } from \"../lib/hexclave-app/common\";\nimport { HexclaveContext } from \"../providers/hexclave-context\";\nimport { useCliAuthConfirmation } from \"./cli-auth-confirm\";\n\nconst previousActEnvironment = Reflect.get(globalThis, \"IS_REACT_ACT_ENVIRONMENT\");\n\nfunction responseJson(data: unknown, init?: ResponseInit) {\n return new Response(JSON.stringify(data), {\n status: init?.status ?? 200,\n headers: { \"Content-Type\": \"application/json\" },\n });\n}\n\nfunction createAppTestDouble(options: {\n user: unknown,\n sendRequest: (path: string, requestOptions: RequestInit) => Promise<Response>,\n signInWithTokens?: (tokens: { accessToken: string, refreshToken: string }) => Promise<void>,\n redirectToSignIn?: (options: { replace: true }) => Promise<void>,\n redirectToSignUp?: (options: { replace: true }) => Promise<void>,\n redirectToOnboarding?: (options: { replace: true }) => Promise<void>,\n}) {\n const app = {\n useUser: () => options.user,\n redirectToSignIn: options.redirectToSignIn ?? vi.fn(async () => {}),\n redirectToSignUp: options.redirectToSignUp ?? vi.fn(async () => {}),\n redirectToOnboarding: options.redirectToOnboarding ?? vi.fn(async () => {}),\n [hexclaveAppInternalsSymbol]: {\n sendRequest: options.sendRequest,\n signInWithTokens: options.signInWithTokens ?? vi.fn(async () => {}),\n },\n };\n\n // This test double intentionally implements only the StackClientApp surface\n // that useCliAuthConfirmation touches.\n return app as unknown as StackClientApp<true>;\n}\n\nfunction HookProbe() {\n const cliAuth = useCliAuthConfirmation();\n return (\n <>\n <div data-testid=\"status\">{cliAuth.status}</div>\n <div data-testid=\"error\">{cliAuth.error?.message}</div>\n <button type=\"button\" onClick={() => runAsynchronously(cliAuth.authorize)}>authorize</button>\n <button onClick={cliAuth.retry}>retry</button>\n </>\n );\n}\n\nlet root: Root | null = null;\nlet container: HTMLDivElement | null = null;\n\nasync function renderWithApp(app: StackClientApp<true>) {\n container = document.createElement(\"div\");\n document.body.append(container);\n root = createRoot(container);\n await act(async () => {\n root?.render(\n <HexclaveContext.Provider value={{ app }}>\n <HookProbe />\n </HexclaveContext.Provider>\n );\n });\n}\n\nfunction getByTestId(testId: string): HTMLElement {\n const element = container?.querySelector(`[data-testid=\"${testId}\"]`);\n if (!(element instanceof HTMLElement)) {\n throw new Error(`Could not find test element ${testId}`);\n }\n return element;\n}\n\nfunction getButton(label: string): HTMLButtonElement {\n const button = [...container?.querySelectorAll(\"button\") ?? []]\n .find((element) => element.textContent === label);\n if (!(button instanceof HTMLButtonElement)) {\n throw new Error(`Could not find button ${label}`);\n }\n return button;\n}\n\ndescribe(\"useCliAuthConfirmation\", () => {\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 vi.restoreAllMocks();\n sessionStorage.clear();\n window.history.replaceState({}, \"\", \"/\");\n Reflect.set(globalThis, \"IS_REACT_ACT_ENVIRONMENT\", previousActEnvironment);\n });\n\n it(\"completes CLI auth with the current user's refresh token\", async () => {\n window.history.replaceState({}, \"\", \"/handler/cli-auth-confirm?login_code=login-code\");\n const getTokens = vi.fn(async () => ({ refreshToken: \"refresh-token\" }));\n const sendRequest = vi.fn(async (_path: string, _requestOptions: RequestInit) => new Response(null, { status: 200 }));\n const app = createAppTestDouble({\n user: { currentSession: { getTokens } },\n sendRequest,\n });\n\n await renderWithApp(app);\n await act(async () => {\n getButton(\"authorize\").click();\n });\n\n expect(getByTestId(\"status\").textContent).toBe(\"success\");\n expect(getTokens).toHaveBeenCalledOnce();\n expect(sendRequest).toHaveBeenCalledOnce();\n expect(sendRequest.mock.calls[0][0]).toBe(\"/auth/cli/complete\");\n expect(JSON.parse(String(sendRequest.mock.calls[0][1].body))).toMatchInlineSnapshot(`\n {\n \"login_code\": \"login-code\",\n \"refresh_token\": \"refresh-token\",\n }\n `);\n });\n\n it(\"redirects restricted users to onboarding without completing CLI auth\", async () => {\n window.history.replaceState({}, \"\", \"/handler/cli-auth-confirm?login_code=login-code\");\n const redirectToOnboarding = vi.fn(async (_options: { replace: true }) => {});\n const sendRequest = vi.fn(async (_path: string, _requestOptions: RequestInit) => new Response(null, { status: 200 }));\n const app = createAppTestDouble({\n user: {\n isRestricted: true,\n isAnonymous: false,\n currentSession: {\n getTokens: vi.fn(async () => ({ refreshToken: \"restricted-refresh-token\" })),\n },\n },\n sendRequest,\n redirectToOnboarding,\n });\n\n await renderWithApp(app);\n await act(async () => {\n getButton(\"authorize\").click();\n });\n\n expect(redirectToOnboarding).toHaveBeenCalledWith({ replace: true });\n expect(sessionStorage.getItem(\"hexclave-cli-auth-confirmed\")).toBe(\"login-code\");\n expect(sendRequest).not.toHaveBeenCalled();\n });\n\n it(\"redirects anonymous users to sign-up without completing CLI auth\", async () => {\n window.history.replaceState({}, \"\", \"/handler/cli-auth-confirm?login_code=login-code\");\n const redirectToSignUp = vi.fn(async (_options: { replace: true }) => {});\n const sendRequest = vi.fn(async (_path: string, _requestOptions: RequestInit) => new Response(null, { status: 200 }));\n const app = createAppTestDouble({\n user: {\n isRestricted: true,\n isAnonymous: true,\n currentSession: {\n getTokens: vi.fn(async () => ({ refreshToken: \"anonymous-refresh-token\" })),\n },\n },\n sendRequest,\n redirectToSignUp,\n });\n\n await renderWithApp(app);\n await act(async () => {\n getButton(\"authorize\").click();\n });\n\n expect(redirectToSignUp).toHaveBeenCalledWith({ replace: true });\n expect(sessionStorage.getItem(\"hexclave-cli-auth-confirmed\")).toBe(\"login-code\");\n expect(sendRequest).not.toHaveBeenCalled();\n });\n\n it(\"ignores duplicate authorize clicks before React re-renders\", async () => {\n window.history.replaceState({}, \"\", \"/handler/cli-auth-confirm?login_code=login-code\");\n const getTokens = vi.fn(async () => ({ refreshToken: \"refresh-token\" }));\n const sendRequest = vi.fn(async (_path: string, _requestOptions: RequestInit) => new Response(null, { status: 200 }));\n const app = createAppTestDouble({\n user: { currentSession: { getTokens } },\n sendRequest,\n });\n\n await renderWithApp(app);\n await act(async () => {\n const authorizeButton = getButton(\"authorize\");\n authorizeButton.click();\n authorizeButton.click();\n });\n\n expect(sendRequest).toHaveBeenCalledOnce();\n });\n\n it(\"claims anonymous CLI sessions before redirecting to sign-up\", async () => {\n window.history.replaceState({}, \"\", \"/handler/cli-auth-confirm?login_code=login-code\");\n const signInWithTokens = vi.fn(async (_tokens: { accessToken: string, refreshToken: string }) => {});\n const redirectToSignUp = vi.fn(async (_options: { replace: true }) => {});\n const sendRequest = vi.fn(async (_path: string, _requestOptions: RequestInit) => new Response(null, { status: 200 }))\n .mockResolvedValueOnce(responseJson({ cli_session_state: \"anonymous\" }))\n .mockResolvedValueOnce(responseJson({ access_token: \"access-token\", refresh_token: \"refresh-token\" }));\n const app = createAppTestDouble({\n user: null,\n sendRequest,\n signInWithTokens,\n redirectToSignUp,\n });\n\n await renderWithApp(app);\n await act(async () => {\n getButton(\"authorize\").click();\n });\n\n expect(redirectToSignUp).toHaveBeenCalledWith({ replace: true });\n expect(signInWithTokens).toHaveBeenCalledWith({\n accessToken: \"access-token\",\n refreshToken: \"refresh-token\",\n });\n expect(sessionStorage.getItem(\"hexclave-cli-auth-confirmed\")).toBe(\"login-code\");\n expect(sendRequest.mock.calls.map(call => JSON.parse(String(call[1].body)))).toMatchInlineSnapshot(`\n [\n {\n \"login_code\": \"login-code\",\n \"mode\": \"check\",\n },\n {\n \"login_code\": \"login-code\",\n \"mode\": \"claim-anon-session\",\n },\n ]\n `);\n });\n\n it(\"reports invalid when the login code is missing\", async () => {\n window.history.replaceState({}, \"\", \"/handler/cli-auth-confirm\");\n const app = createAppTestDouble({\n user: null,\n sendRequest: vi.fn(async (_path: string, _requestOptions: RequestInit) => new Response(null, { status: 200 })),\n });\n\n await renderWithApp(app);\n\n expect(getByTestId(\"status\").textContent).toBe(\"invalid\");\n });\n});\n"],"mappings":";;;;;;;;;;AAeA,MAAM,yBAAyB,QAAQ,IAAI,YAAY,0BAA0B;AAEjF,SAAS,aAAa,MAAe,MAAqB;CACxD,OAAO,IAAI,SAAS,KAAK,UAAU,IAAI,GAAG;EACxC,QAAQ,MAAM,UAAU;EACxB,SAAS,EAAE,gBAAgB,mBAAmB;CAChD,CAAC;AACH;AAEA,SAAS,oBAAoB,SAO1B;CAcD,OAAO;EAZL,eAAe,QAAQ;EACvB,kBAAkB,QAAQ,oBAAoB,GAAG,GAAG,YAAY,CAAC,CAAC;EAClE,kBAAkB,QAAQ,oBAAoB,GAAG,GAAG,YAAY,CAAC,CAAC;EAClE,sBAAsB,QAAQ,wBAAwB,GAAG,GAAG,YAAY,CAAC,CAAC;GACzE,6BAA6B;GAC5B,aAAa,QAAQ;GACrB,kBAAkB,QAAQ,oBAAoB,GAAG,GAAG,YAAY,CAAC,CAAC;EACpE;CAKO;AACX;AAEA,SAAS,YAAY;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QAAQ,aAAa,CAAC,GAAG,IAAI,2BAA2B;EAM/D,MAAM,cALM,oBAAoB;GAC9B,MAAM;GACN,aAAa,GAAG,GAAG,OAAO,OAAe,oBAAiC,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC,CAAC;EAC/G,CAEsB,CAAC;EAEvB,OAAO,YAAY,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,SAAS;CAC1D,CAAC;AACH,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
3
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
4
|
+
import { strictEmailSchema, yupObject } from "@hexclave/shared/dist/schema-fields";
|
|
3
5
|
import { Button, Input, Label, Typography, cn } from "@hexclave/ui";
|
|
4
6
|
import { useState } from "react";
|
|
7
|
+
import { useForm } from "react-hook-form";
|
|
5
8
|
import { useStackApp, useUser } from "../index.js";
|
|
6
|
-
import {
|
|
9
|
+
import { FormWarningText } from "../components/elements/form-warning.js";
|
|
7
10
|
import { useTranslation } from "../lib/translations.js";
|
|
8
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { MaybeFullPage } from "../components/elements/maybe-full-page.js";
|
|
9
13
|
import { StyledLink } from "../components/link.js";
|
|
10
14
|
import { PredefinedMessageCard } from "../components/message-cards/predefined-message-card.js";
|
|
11
|
-
import { yupResolver } from "@hookform/resolvers/yup";
|
|
12
|
-
import { strictEmailSchema, yupObject } from "@hexclave/shared/dist/schema-fields";
|
|
13
|
-
import { useForm } from "react-hook-form";
|
|
14
|
-
import { FormWarningText } from "../components/elements/form-warning.js";
|
|
15
15
|
//#region src/components-page/forgot-password.tsx
|
|
16
16
|
function ForgotPasswordForm({ onSent }) {
|
|
17
17
|
const { t } = useTranslation();
|
|
@@ -3,13 +3,13 @@ import { HexclaveAssertionError, captureError } from "@hexclave/shared/dist/util
|
|
|
3
3
|
import { Suspense, useEffect, useMemo, useRef, useSyncExternalStore } from "react";
|
|
4
4
|
import { SignIn, SignUp } from "../index.js";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { useStackApp as useStackApp$1 } from "../lib/hooks.js";
|
|
6
7
|
import { KnownError } from "@hexclave/shared";
|
|
7
8
|
import { use } from "@hexclave/shared/dist/utils/react";
|
|
8
9
|
import { KnownErrorMessageCard } from "../components/message-cards/known-error-message-card.js";
|
|
9
10
|
import { MessageCard as MessageCard$1 } from "../components/message-cards/message-card.js";
|
|
10
11
|
import { PredefinedMessageCard } from "../components/message-cards/predefined-message-card.js";
|
|
11
12
|
import { CliAuthConfirmation } from "./cli-auth-confirm.js";
|
|
12
|
-
import { useStackApp as useStackApp$1 } from "../lib/hooks.js";
|
|
13
13
|
import { hexclaveAppInternalsSymbol } from "../lib/hexclave-app/index.js";
|
|
14
14
|
import { filterUndefined } from "@hexclave/shared/dist/utils/objects";
|
|
15
15
|
import { getRelativePart } from "@hexclave/shared/dist/utils/urls";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Button, InputOTP, InputOTPGroup, InputOTPSlot, Spinner, Typography, cn } from "@hexclave/ui";
|
|
3
|
-
import { CheckIcon } from "lucide-react";
|
|
4
3
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
5
4
|
import { useStackApp } from "../index.js";
|
|
6
|
-
import {
|
|
5
|
+
import { FormWarningText } from "../components/elements/form-warning.js";
|
|
7
6
|
import { useTranslation } from "../lib/translations.js";
|
|
8
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
import { KnownErrors } from "@hexclave/shared";
|
|
10
|
-
import {
|
|
9
|
+
import { CheckIcon } from "lucide-react";
|
|
10
|
+
import { MaybeFullPage } from "../components/elements/maybe-full-page.js";
|
|
11
11
|
//#region src/components-page/mfa.tsx
|
|
12
12
|
function MfaForm({ onSuccess, onCancel }) {
|
|
13
13
|
const hexclaveApp = useStackApp();
|
|
@@ -5,10 +5,10 @@ import { captureError } from "@hexclave/shared/dist/utils/errors";
|
|
|
5
5
|
import { Spinner, cn } from "@hexclave/ui";
|
|
6
6
|
import { useEffect, useRef, useState } from "react";
|
|
7
7
|
import { useStackApp } from "../index.js";
|
|
8
|
-
import { MaybeFullPage } from "../components/elements/maybe-full-page.js";
|
|
9
8
|
import { useTranslation } from "../lib/translations.js";
|
|
10
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
10
|
import { KnownError } from "@hexclave/shared";
|
|
11
|
+
import { MaybeFullPage } from "../components/elements/maybe-full-page.js";
|
|
12
12
|
import { StyledLink } from "../components/link.js";
|
|
13
13
|
import { ErrorPage } from "./error-page.js";
|
|
14
14
|
//#region src/components-page/oauth-callback.tsx
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { runAsynchronously, runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
3
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
4
|
+
import { strictEmailSchema, yupObject } from "@hexclave/shared/dist/schema-fields";
|
|
3
5
|
import { Button, Input, Typography } from "@hexclave/ui";
|
|
4
6
|
import { useState } from "react";
|
|
7
|
+
import { useForm } from "react-hook-form";
|
|
5
8
|
import { useStackApp, useUser } from "../index.js";
|
|
9
|
+
import { FormWarningText } from "../components/elements/form-warning.js";
|
|
6
10
|
import { useTranslation } from "../lib/translations.js";
|
|
7
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
12
|
import { MessageCard as MessageCard$1 } from "../components/message-cards/message-card.js";
|
|
9
|
-
import { yupResolver } from "@hookform/resolvers/yup";
|
|
10
|
-
import { strictEmailSchema, yupObject } from "@hexclave/shared/dist/schema-fields";
|
|
11
|
-
import { useForm } from "react-hook-form";
|
|
12
|
-
import { FormWarningText } from "../components/elements/form-warning.js";
|
|
13
13
|
//#region src/components-page/onboarding.tsx
|
|
14
14
|
function Onboarding(props) {
|
|
15
15
|
const { t } = useTranslation();
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { runAsynchronouslyWithAlert } from "@hexclave/shared/dist/utils/promises";
|
|
3
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
4
|
+
import { passwordSchema, yupObject, yupString } from "@hexclave/shared/dist/schema-fields";
|
|
3
5
|
import { Button, Label, PasswordInput, Typography, cn } from "@hexclave/ui";
|
|
4
6
|
import { useState } from "react";
|
|
7
|
+
import { useForm } from "react-hook-form";
|
|
5
8
|
import { useStackApp } from "../index.js";
|
|
6
|
-
import {
|
|
9
|
+
import { FormWarningText } from "../components/elements/form-warning.js";
|
|
7
10
|
import { useTranslation } from "../lib/translations.js";
|
|
8
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { getPasswordError } from "@hexclave/shared/dist/helpers/password";
|
|
13
|
+
import * as yup from "yup";
|
|
9
14
|
import { KnownErrors } from "@hexclave/shared";
|
|
15
|
+
import { MaybeFullPage } from "../components/elements/maybe-full-page.js";
|
|
10
16
|
import { use } from "@hexclave/shared/dist/utils/react";
|
|
11
17
|
import { MessageCard as MessageCard$1 } from "../components/message-cards/message-card.js";
|
|
12
18
|
import { PredefinedMessageCard } from "../components/message-cards/predefined-message-card.js";
|
|
13
|
-
import { yupResolver } from "@hookform/resolvers/yup";
|
|
14
|
-
import { passwordSchema, yupObject, yupString } from "@hexclave/shared/dist/schema-fields";
|
|
15
|
-
import { useForm } from "react-hook-form";
|
|
16
|
-
import { FormWarningText } from "../components/elements/form-warning.js";
|
|
17
19
|
import { cacheFunction } from "@hexclave/shared/dist/utils/caches";
|
|
18
|
-
import { getPasswordError } from "@hexclave/shared/dist/helpers/password";
|
|
19
|
-
import * as yup from "yup";
|
|
20
20
|
//#region src/components-page/password-reset.tsx
|
|
21
21
|
function PasswordResetForm(props) {
|
|
22
22
|
const { t } = useTranslation();
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
|
|
3
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
4
|
+
import { yupObject, yupString } from "@hexclave/shared/dist/schema-fields";
|
|
3
5
|
import { Button, Input, Label, Typography } from "@hexclave/ui";
|
|
4
6
|
import { useState } from "react";
|
|
7
|
+
import { useForm } from "react-hook-form";
|
|
5
8
|
import { MessageCard, useStackApp, useUser } from "../index.js";
|
|
6
|
-
import {
|
|
9
|
+
import { FormWarningText } from "../components/elements/form-warning.js";
|
|
7
10
|
import { useTranslation } from "../lib/translations.js";
|
|
8
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import {
|
|
10
|
-
import { yupObject, yupString } from "@hexclave/shared/dist/schema-fields";
|
|
11
|
-
import { useForm } from "react-hook-form";
|
|
12
|
-
import { FormWarningText } from "../components/elements/form-warning.js";
|
|
12
|
+
import { MaybeFullPage } from "../components/elements/maybe-full-page.js";
|
|
13
13
|
//#region src/components-page/team-creation.tsx
|
|
14
14
|
function TeamCreation(props) {
|
|
15
15
|
const { t } = useTranslation();
|