@constructive-io/sheets 0.13.1 → 0.15.0

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 (61) hide show
  1. package/README.md +231 -148
  2. package/dist/advanced.cjs +7220 -4030
  3. package/dist/advanced.cjs.map +1 -1
  4. package/dist/advanced.d.cts +2 -2
  5. package/dist/advanced.d.ts +2 -2
  6. package/dist/advanced.js +5 -5
  7. package/dist/auth.cjs.map +1 -1
  8. package/dist/auth.js +3 -3
  9. package/dist/chunk-CJ4PRA64.js +312 -0
  10. package/dist/chunk-CJ4PRA64.js.map +1 -0
  11. package/dist/chunk-II3MSNRO.js +18 -0
  12. package/dist/chunk-II3MSNRO.js.map +1 -0
  13. package/dist/{chunk-MXVNIKES.js → chunk-J7KK4UWI.js} +6 -6
  14. package/dist/chunk-MBSHDF55.js +839 -0
  15. package/dist/chunk-MBSHDF55.js.map +1 -0
  16. package/dist/{chunk-ZKANUG3F.js → chunk-MOFFS5WQ.js} +20 -15
  17. package/dist/chunk-MOFFS5WQ.js.map +1 -0
  18. package/dist/chunk-VCBY2AMT.js +8920 -0
  19. package/dist/chunk-VCBY2AMT.js.map +1 -0
  20. package/dist/{chunk-H5HR5HUJ.js → chunk-ZOQDSOMO.js} +50 -312
  21. package/dist/chunk-ZOQDSOMO.js.map +1 -0
  22. package/dist/date-editor-ORCB43ZM.js +346 -0
  23. package/dist/date-editor-ORCB43ZM.js.map +1 -0
  24. package/dist/grid-cell-types-YNIVK4hN.d.cts +346 -0
  25. package/dist/grid-cell-types-YNIVK4hN.d.ts +346 -0
  26. package/dist/index.cjs +22910 -12084
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +1497 -337
  29. package/dist/index.d.ts +1497 -337
  30. package/dist/index.js +12833 -6142
  31. package/dist/index.js.map +1 -1
  32. package/dist/sheets-context-Bb7ZoNBg.d.cts +436 -0
  33. package/dist/sheets-context-CPuf31LS.d.ts +436 -0
  34. package/dist/testing.cjs +1253 -638
  35. package/dist/testing.cjs.map +1 -1
  36. package/dist/testing.d.cts +80 -11
  37. package/dist/testing.d.ts +80 -11
  38. package/dist/testing.js +791 -148
  39. package/dist/testing.js.map +1 -1
  40. package/package.json +5 -5
  41. package/dist/chunk-4EZ6A23C.js +0 -44
  42. package/dist/chunk-4EZ6A23C.js.map +0 -1
  43. package/dist/chunk-5QPNOKMA.js +0 -4397
  44. package/dist/chunk-5QPNOKMA.js.map +0 -1
  45. package/dist/chunk-AYMXT3ME.js +0 -540
  46. package/dist/chunk-AYMXT3ME.js.map +0 -1
  47. package/dist/chunk-H5HR5HUJ.js.map +0 -1
  48. package/dist/chunk-PZL2BCWF.js +0 -168
  49. package/dist/chunk-PZL2BCWF.js.map +0 -1
  50. package/dist/chunk-X7DHTSOX.js +0 -21
  51. package/dist/chunk-X7DHTSOX.js.map +0 -1
  52. package/dist/chunk-ZKANUG3F.js.map +0 -1
  53. package/dist/date-editor-ZFNDKYBD.js +0 -358
  54. package/dist/date-editor-ZFNDKYBD.js.map +0 -1
  55. package/dist/grid-cell-types-Pbe2m2tE.d.cts +0 -253
  56. package/dist/grid-cell-types-Pbe2m2tE.d.ts +0 -253
  57. package/dist/map-picker-ZUGGOIZS.js +0 -290
  58. package/dist/map-picker-ZUGGOIZS.js.map +0 -1
  59. package/dist/sheets-context-CY1RmDKL.d.cts +0 -244
  60. package/dist/sheets-context-Cu3Ec_ca.d.ts +0 -244
  61. /package/dist/{chunk-MXVNIKES.js.map → chunk-J7KK4UWI.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import react__default, { ComponentType } from 'react';
2
- import { E as EditorProps, C as CellCreationMetadata, S as SheetsCell } from './grid-cell-types-Pbe2m2tE.cjs';
3
- export { a as SheetsCellKind } from './grid-cell-types-Pbe2m2tE.cjs';
2
+ import { E as EditorProps, C as CellCreationMetadata, S as SheetsCell } from './grid-cell-types-YNIVK4hN.cjs';
3
+ export { a as SheetsCellKind } from './grid-cell-types-YNIVK4hN.cjs';
4
4
  import '@constructive-io/data';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import react__default, { ComponentType } from 'react';
2
- import { E as EditorProps, C as CellCreationMetadata, S as SheetsCell } from './grid-cell-types-Pbe2m2tE.js';
3
- export { a as SheetsCellKind } from './grid-cell-types-Pbe2m2tE.js';
2
+ import { E as EditorProps, C as CellCreationMetadata, S as SheetsCell } from './grid-cell-types-YNIVK4hN.js';
3
+ export { a as SheetsCellKind } from './grid-cell-types-YNIVK4hN.js';
4
4
  import '@constructive-io/data';
5
5
 
6
6
  /**
package/dist/advanced.js CHANGED
@@ -5,9 +5,9 @@ import {
5
5
  createSheetsCell,
6
6
  resolveNativeEditor,
7
7
  wrapNativeEditor
8
- } from "./chunk-5QPNOKMA.js";
9
- import "./chunk-AYMXT3ME.js";
10
- import "./chunk-H5HR5HUJ.js";
8
+ } from "./chunk-VCBY2AMT.js";
9
+ import "./chunk-MBSHDF55.js";
10
+ import "./chunk-II3MSNRO.js";
11
11
  import {
12
12
  EditorFocusTrap,
13
13
  OVERLAY,
@@ -15,9 +15,9 @@ import {
15
15
  OVERLAY_MD,
16
16
  OVERLAY_SM,
17
17
  OVERLAY_XL
18
- } from "./chunk-PZL2BCWF.js";
18
+ } from "./chunk-CJ4PRA64.js";
19
19
  import "./chunk-YDQQA46V.js";
20
- import "./chunk-X7DHTSOX.js";
20
+ import "./chunk-GGECS2BP.js";
21
21
  export {
22
22
  DOM_EDITOR_REGISTRY,
23
23
  EditorFocusTrap,
package/dist/auth.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/auth/index.ts","../src/auth/auth-gate.tsx","../src/context/sheets-context.ts","../src/store/sheets-store.ts","../src/auth/hooks/use-login.ts","../src/auth/utils/auth-errors.ts","../src/auth/utils/token-store.ts","../src/auth/auth-execute.ts","../src/auth/auth-types.ts","../src/auth/hooks/use-register.ts","../src/auth/hooks/use-forgot-password.ts","../src/auth/hooks/use-reset-password.ts","../src/auth/ui/login-form.tsx","../src/auth/utils/schemas.ts","../src/auth/ui/auth-error-alert.tsx","../src/utils/cn.ts","../src/auth/ui/auth-loading-button.tsx","../src/auth/ui/form-field.tsx","../src/auth/ui/register-form.tsx","../src/auth/ui/forgot-password-form.tsx","../src/auth/ui/auth-screen-header.tsx","../src/auth/ui/reset-password-form.tsx","../src/auth/utils/validators.ts","../src/auth/ui/password-strength.tsx","../src/auth/ui/auth-screen-layout.tsx"],"sourcesContent":["// =============================================================================\n// @constructive-io/sheets/auth — Standalone auth surface\n// =============================================================================\n// Subpath entry for consumers running Sheets in standalone (non-embedded) mode.\n// Re-exported from the root for back-compat; prefer importing from here.\n\nexport { SheetsAuthGate } from './auth-gate';\nexport type { SheetsAuthGateProps } from './auth-gate';\nexport { useSheetsLogin, useSheetsRegister, useSheetsForgotPassword, useSheetsResetPassword } from './hooks';\n","import { useState } from 'react';\n\nimport { useSheetsContext } from '../context/sheets-context';\nimport { useSheetsStore } from '../store/sheets-store';\nimport { useSheetsLogin } from './hooks/use-login';\nimport { useSheetsRegister } from './hooks/use-register';\nimport { useSheetsForgotPassword } from './hooks/use-forgot-password';\nimport { useSheetsResetPassword } from './hooks/use-reset-password';\nimport { SheetsLoginForm } from './ui/login-form';\nimport { SheetsRegisterForm } from './ui/register-form';\nimport { SheetsForgotPasswordForm } from './ui/forgot-password-form';\nimport { SheetsResetPasswordForm } from './ui/reset-password-form';\nimport { AuthScreenHeader, type AuthBrandingProps } from './ui/auth-screen-header';\nimport { AuthScreenLayout } from './ui/auth-screen-layout';\n\ntype AuthMode = 'login' | 'register' | 'forgot' | 'reset';\n\nconst AUTH_CONTENT: Record<AuthMode, { title: string; description: string }> = {\n\tlogin: {\n\t\ttitle: 'Welcome back',\n\t\tdescription: 'Sign in to your account',\n\t},\n\tregister: {\n\t\ttitle: 'Create an account',\n\t\tdescription: 'Get started with your free account',\n\t},\n\tforgot: {\n\t\ttitle: 'Reset your password',\n\t\tdescription: \"We'll send you a password reset link\",\n\t},\n\treset: {\n\t\ttitle: 'Set a new password',\n\t\tdescription: 'Enter your new password below',\n\t},\n} as const;\n\nexport interface SheetsAuthGateProps extends AuthBrandingProps {\n\tchildren: React.ReactNode;\n\tloginComponent?: React.ComponentType;\n\tresetToken?: string;\n\troleId?: string;\n}\n\nexport function SheetsAuthGate({\n\tchildren,\n\tloginComponent: CustomLoginComponent,\n\tresetToken,\n\troleId,\n\tlogo,\n\tappName,\n\tshowLogo,\n}: SheetsAuthGateProps) {\n\tconst { config } = useSheetsContext();\n\tconst isAuthenticated = useSheetsStore((s) => s.isAuthenticated);\n\n\t// Embedded mode: auth gate is transparent, always renders children\n\tif (config.auth.mode === 'embedded') {\n\t\treturn <>{children}</>;\n\t}\n\n\t// Standalone mode: check auth state\n\tif (isAuthenticated) {\n\t\treturn <>{children}</>;\n\t}\n\n\t// Not authenticated in standalone mode — show login UI\n\tif (CustomLoginComponent) {\n\t\treturn <CustomLoginComponent />;\n\t}\n\n\treturn (\n\t\t<StandaloneAuthUI\n\t\t\tresetToken={resetToken}\n\t\t\troleId={roleId}\n\t\t\tlogo={logo}\n\t\t\tappName={appName}\n\t\t\tshowLogo={showLogo}\n\t\t/>\n\t);\n}\n\ninterface StandaloneAuthUIProps extends AuthBrandingProps {\n\tresetToken?: string;\n\troleId?: string;\n}\n\nfunction StandaloneAuthUI({ resetToken, roleId, logo, appName, showLogo }: StandaloneAuthUIProps) {\n\tconst initialMode: AuthMode = resetToken ? 'reset' : 'login';\n\tconst [mode, setMode] = useState<AuthMode>(initialMode);\n\n\tconst loginMutation = useSheetsLogin();\n\tconst registerMutation = useSheetsRegister();\n\tconst forgotPasswordMutation = useSheetsForgotPassword();\n\tconst resetPasswordMutation = useSheetsResetPassword();\n\n\tconst { title, description } = AUTH_CONTENT[mode];\n\n\treturn (\n\t\t<AuthScreenLayout fill='parent' logo={logo} appName={appName} showLogo={showLogo}>\n\t\t\t<AuthScreenHeader\n\t\t\t\ttitle={title}\n\t\t\t\tdescription={description}\n\t\t\t\tlogo={logo}\n\t\t\t\tappName={appName}\n\t\t\t\tshowLogo={showLogo}\n\t\t\t/>\n\n\t\t\t<div>\n\t\t\t\t{mode === 'login' && (\n\t\t\t\t\t<SheetsLoginForm\n\t\t\t\t\t\tonLogin={(credentials) => loginMutation.mutateAsync(credentials).then(() => {})}\n\t\t\t\t\t\tonShowForgot={() => setMode('forgot')}\n\t\t\t\t\t\tonShowRegister={() => setMode('register')}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{mode === 'register' && (\n\t\t\t\t\t<SheetsRegisterForm\n\t\t\t\t\t\tonRegister={(data) => registerMutation.mutateAsync(data)}\n\t\t\t\t\t\tonShowLogin={() => setMode('login')}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{mode === 'forgot' && (\n\t\t\t\t\t<SheetsForgotPasswordForm\n\t\t\t\t\t\tonForgotPassword={(data) => forgotPasswordMutation.mutateAsync(data)}\n\t\t\t\t\t\tonShowLogin={() => setMode('login')}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{mode === 'reset' && (\n\t\t\t\t\t<SheetsResetPasswordForm\n\t\t\t\t\t\tresetToken={resetToken || ''}\n\t\t\t\t\t\troleId={roleId}\n\t\t\t\t\t\tonResetPassword={(input) => resetPasswordMutation.mutateAsync(input)}\n\t\t\t\t\t\tonShowLogin={() => setMode('login')}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</AuthScreenLayout>\n\t);\n}\n","import { createContext, useContext } from 'react';\nimport type { QueryClient } from '@tanstack/react-query';\n\nimport type { SheetsExecuteFn, SheetsUploadFn } from './sheets-execute';\nimport type { SheetsLogger } from '../utils/sheets-logger';\nimport type { CellTypePlugin } from '../cell-types/define-cell-type';\nimport type { SheetsBackendAdapter } from '../adapter/sheets-adapter';\n\nexport interface SheetsAuthEmbedded {\n\tmode: 'embedded';\n\tgetToken: () => string | null;\n\t/**\n\t * Stable, non-secret identity used to isolate cached data between users.\n\t * Hosts should return the authenticated user/session id, never the token.\n\t * When omitted, the provider uses an opaque key that changes with the token.\n\t */\n\tgetIdentityKey?: () => string | null;\n}\n\nexport interface SheetsAuthStandalone {\n\tmode: 'standalone';\n}\n\nexport interface SheetsConfig {\n\t/** Data endpoint (app-public GraphQL) */\n\tendpoint: string;\n\t/** Auth endpoint (auth GraphQL) — required for standalone mode */\n\tauthEndpoint?: string;\n\t/** Database ID for multi-tenant scoping */\n\tdatabaseId?: string;\n\t/** Auth mode */\n\tauth: SheetsAuthEmbedded | SheetsAuthStandalone;\n\t/** Field type overrides (replaces schema-builder smart tags) */\n\tfieldTypeOverrides?: Record<string, string>;\n\t/** Optional: BCP-47 locale for locale-aware date/number formatting (default 'en-US'). */\n\tlocale?: string;\n\t/** Optional: inject custom execute function */\n\texecute?: SheetsExecuteFn;\n\t/** Optional: inject custom upload function */\n\texecuteUpload?: SheetsUploadFn;\n\t/** Optional upload settings. `bucketKey` defaults to \"public\". */\n\tupload?: { bucketKey?: string };\n\t/** Optional: inject existing QueryClient */\n\tqueryClient?: QueryClient;\n\t/** Optional: inject a custom backend adapter. Defaults to the PostGraphile adapter. */\n\tadapter?: SheetsBackendAdapter;\n\t/** Optional: provider-level cell-type plugins (consumer override layer). */\n\tplugins?: CellTypePlugin[];\n\t/** Called on 401/UNAUTHENTICATED before the error is thrown. Host app handles token cleanup. */\n\tonAuthError?: () => void;\n\t/** Optional: inject a custom logger. Installed into the module logger singleton by the provider. */\n\tlogger?: SheetsLogger;\n\t/** Optional: called when a grid/editor/mutation/upload error surfaces. Host app handles reporting. */\n\tonError?: (\n\t\terror: unknown,\n\t\tctx?: { source?: 'grid' | 'editor' | 'mutation' | 'upload'; tableName?: string },\n\t) => void;\n}\n\nexport interface SheetsContextValue {\n\tconfig: SheetsConfig;\n\texecute: SheetsExecuteFn;\n\texecuteUpload: SheetsUploadFn;\n\tscopeKey: SheetsScopeKey;\n}\n\nexport interface SheetsScopeKey {\n\tdatabaseId: string | null;\n\tendpoint: string;\n\tidentityKey: string | null;\n}\n\nexport const SheetsContext = createContext<SheetsContextValue | null>(null);\n\nexport function useSheetsContext(): SheetsContextValue {\n\tconst ctx = useContext(SheetsContext);\n\tif (!ctx) {\n\t\tthrow new Error('useSheetsContext must be used within a <SheetsProvider>');\n\t}\n\treturn ctx;\n}\n","import { createContext, useContext } from 'react';\nimport { createStore, useStore as useZustandStore, type StoreApi } from 'zustand';\n\nimport { createDraftRowsSlice, type DraftRowsSlice } from './draft-rows-slice';\nimport { createRelationInfoSlice, type RelationInfoSlice } from './relation-info-slice';\n\nexport interface SheetsAuthState {\n isAuthenticated: boolean;\n accessToken: string | null;\n expiresAt: string | null;\n identityKey: string | null;\n setAuthenticated: (token: string, expiresAt: string, identityKey?: string | null) => void;\n setUnauthenticated: () => void;\n}\n\nexport type SheetsStoreState = DraftRowsSlice & RelationInfoSlice & SheetsAuthState;\n\nexport function createSheetsStore(): StoreApi<SheetsStoreState> {\n return createStore<SheetsStoreState>((set, get) => ({\n // Draft rows\n ...createDraftRowsSlice(set),\n\n // Relation info cache\n ...createRelationInfoSlice(set, get),\n\n // Auth state (standalone mode)\n isAuthenticated: false,\n accessToken: null,\n expiresAt: null,\n identityKey: null,\n setAuthenticated: (token: string, expiresAt: string, identityKey = null) =>\n set({ isAuthenticated: true, accessToken: token, expiresAt, identityKey }),\n setUnauthenticated: () => set({ isAuthenticated: false, accessToken: null, expiresAt: null, identityKey: null }),\n }));\n}\n\nexport const SheetsStoreContext = createContext<StoreApi<SheetsStoreState> | null>(null);\n\nexport function useSheetsStore<T>(selector: (state: SheetsStoreState) => T): T {\n const store = useContext(SheetsStoreContext);\n if (!store) {\n throw new Error('useSheetsStore must be used within a <SheetsProvider>');\n }\n return useZustandStore(store, selector);\n}\n\nexport function useSheetsStoreApi(): StoreApi<SheetsStoreState> {\n const store = useContext(SheetsStoreContext);\n if (!store) {\n throw new Error('useSheetsStoreApi must be used within a <SheetsProvider>');\n }\n return store;\n}\n","import { useMutation, useQueryClient } from '@tanstack/react-query';\n\nimport { createInvalidCredentialsError } from '../utils/auth-errors';\nimport type { LoginFormData } from '../utils/schemas';\nimport { useSheetsContext } from '../../context/sheets-context';\nimport { useSheetsStoreApi } from '../../store/sheets-store';\nimport { setStoredToken } from '../utils/token-store';\nimport { executeAuthMutation } from '../auth-execute';\nimport { toAuthToken, type SignInMutationResult, type SignInMutationVariables } from '../auth-types';\n\nconst SIGN_IN_MUTATION = /* GraphQL */ `\n\tmutation SignIn($input: SignInInput!) {\n\t\tsignIn(input: $input) {\n\t\t\tresult {\n\t\t\t\tid\n\t\t\t\tuserId\n\t\t\t\taccessToken\n\t\t\t\taccessTokenExpiresAt\n\t\t\t\tisVerified\n\t\t\t\ttotpEnabled\n\t\t\t}\n\t\t\tclientMutationId\n\t\t}\n\t}\n`;\n\nexport function useSheetsLogin() {\n\tconst queryClient = useQueryClient();\n\tconst { config } = useSheetsContext();\n\tconst storeApi = useSheetsStoreApi();\n\n\treturn useMutation({\n\t\tmutationKey: ['sheets', 'auth', 'signIn'],\n\t\tmutationFn: async (credentials: LoginFormData) => {\n\t\t\tconst result = await executeAuthMutation<SignInMutationResult>(\n\t\t\t\tconfig,\n\t\t\t\tSIGN_IN_MUTATION,\n\t\t\t\t{\n\t\t\t\t\tinput: {\n\t\t\t\t\t\temail: credentials.email,\n\t\t\t\t\t\tpassword: credentials.password,\n\t\t\t\t\t\trememberMe: credentials.rememberMe,\n\t\t\t\t\t},\n\t\t\t\t} satisfies SignInMutationVariables,\n\t\t\t);\n\n\t\t\tconst signInResult = result.signIn?.result;\n\t\t\tif (!signInResult) {\n\t\t\t\tthrow createInvalidCredentialsError();\n\t\t\t}\n\n\t\t\tconst token = toAuthToken(signInResult);\n\t\t\tif (!token) {\n\t\t\t\tthrow createInvalidCredentialsError();\n\t\t\t}\n\n\t\t\treturn { token, email: credentials.email, identityKey: signInResult.userId };\n\t\t},\n\t\tonSuccess: ({ token, identityKey }) => {\n\t\t\tconst databaseId = config.databaseId || 'default';\n\t\t\tsetStoredToken(databaseId, token.accessToken, token.expiresAt, identityKey);\n\t\t\tstoreApi.getState().setAuthenticated(token.accessToken, token.expiresAt, identityKey);\n\t\t\tqueryClient.invalidateQueries({ queryKey: ['sheets'] });\n\t\t},\n\t});\n}\n","/**\n * Auth Error Handling\n *\n * Centralized error code mapping and parsing for auth forms.\n * Handles GraphQL errors, validation errors (Zod-like), and custom AuthErrors.\n *\n * Backend error codes handled:\n * - INCORRECT_PASSWORD: Wrong password\n * - PASSWORD_INSECURE: Password doesn't meet security requirements\n * - ACCOUNT_LOCKED_EXCEED_ATTEMPTS: Too many failed login attempts\n * - ACCOUNT_DISABLED: Account has been disabled\n * - ACCOUNT_EXISTS: Email already registered\n * - PASSWORD_LEN: Password length invalid (must be 8-63 characters)\n * - INVITE_NOT_FOUND: Invitation code not found\n * - INVITE_LIMIT: Invitation usage limit reached\n * - INVITE_EMAIL_NOT_FOUND: Email not associated with invitation\n */\n\n// ============================================================================\n// Error Code Constants\n// ============================================================================\n\n/**\n * Known backend error codes.\n * These codes are returned in GraphQL error extensions.\n */\nexport const ERROR_CODES = {\n\t// Auth errors - login\n\tINVALID_CREDENTIALS: 'INVALID_CREDENTIALS', // Generic - prevents user enumeration\n\tINCORRECT_PASSWORD: 'INCORRECT_PASSWORD',\n\tACCOUNT_LOCKED_EXCEED_ATTEMPTS: 'ACCOUNT_LOCKED_EXCEED_ATTEMPTS',\n\tACCOUNT_DISABLED: 'ACCOUNT_DISABLED',\n\n\t// Password validation errors\n\tPASSWORD_INSECURE: 'PASSWORD_INSECURE',\n\tPASSWORD_LEN: 'PASSWORD_LEN',\n\n\t// Registration errors\n\tACCOUNT_EXISTS: 'ACCOUNT_EXISTS',\n\n\t// Invitation errors\n\tINVITE_NOT_FOUND: 'INVITE_NOT_FOUND',\n\tINVITE_LIMIT: 'INVITE_LIMIT',\n\tINVITE_EMAIL_NOT_FOUND: 'INVITE_EMAIL_NOT_FOUND',\n} as const;\n\nexport type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];\n\n// ============================================================================\n// User-Friendly Error Messages\n// ============================================================================\n\n/**\n * User-friendly error messages for each error code.\n * These messages are shown to users in the UI.\n */\nexport const ERROR_MESSAGES: Record<ErrorCode, string> = {\n\t[ERROR_CODES.INVALID_CREDENTIALS]: 'Invalid email or password.',\n\t[ERROR_CODES.INCORRECT_PASSWORD]: 'The password you entered is incorrect. Please try again.',\n\t[ERROR_CODES.ACCOUNT_LOCKED_EXCEED_ATTEMPTS]:\n\t\t'Your account has been temporarily locked due to too many failed login attempts. Please try again later or reset your password.',\n\t[ERROR_CODES.ACCOUNT_DISABLED]:\n\t\t'Your account has been disabled. Please contact support for assistance.',\n\t[ERROR_CODES.PASSWORD_INSECURE]:\n\t\t'This password is not secure enough. Please choose a stronger password.',\n\t[ERROR_CODES.PASSWORD_LEN]: 'Password must be between 8 and 63 characters long.',\n\t[ERROR_CODES.ACCOUNT_EXISTS]:\n\t\t'An account with this email already exists. Please sign in or use a different email.',\n\t[ERROR_CODES.INVITE_NOT_FOUND]:\n\t\t'The invitation code is invalid or has expired. Please check the code or request a new invitation.',\n\t[ERROR_CODES.INVITE_LIMIT]:\n\t\t'This invitation has reached its usage limit. Please request a new invitation.',\n\t[ERROR_CODES.INVITE_EMAIL_NOT_FOUND]:\n\t\t'This email is not associated with the invitation. Please use the email address the invitation was sent to.',\n};\n\n/**\n * Generic fallback message when no specific error code is matched.\n */\nexport const DEFAULT_ERROR_MESSAGE = 'Something went wrong. Please try again.';\n\n// ============================================================================\n// AuthError Class\n// ============================================================================\n\n/**\n * Custom error class for authentication errors.\n * Provides typed error codes that map to user-friendly messages.\n *\n * @example\n * ```ts\n * // Throw with a known error code\n * throw new AuthError('INVALID_CREDENTIALS');\n *\n * // Throw with custom message override\n * throw new AuthError('ACCOUNT_DISABLED', 'Your account has been suspended.');\n *\n * // In catch block, get user-friendly message\n * catch (err) {\n * if (err instanceof AuthError) {\n * setError(err.userMessage);\n * }\n * }\n * ```\n */\nexport class AuthError extends Error {\n\tpublic readonly code: ErrorCode;\n\tpublic readonly userMessage: string;\n\n\tconstructor(code: ErrorCode, customMessage?: string) {\n\t\tconst userMessage = customMessage ?? ERROR_MESSAGES[code];\n\t\tsuper(userMessage);\n\t\tthis.name = 'AuthError';\n\t\tthis.code = code;\n\t\tthis.userMessage = userMessage;\n\n\t\tif (Error.captureStackTrace) {\n\t\t\tError.captureStackTrace(this, AuthError);\n\t\t}\n\t}\n\n\t/**\n\t * Check if an error is an AuthError with a specific code.\n\t */\n\tstatic isCode(error: unknown, code: ErrorCode): error is AuthError {\n\t\treturn error instanceof AuthError && error.code === code;\n\t}\n}\n\n/**\n * Create an AuthError for invalid credentials.\n * Use this when login fails due to null token response.\n * The generic message prevents user enumeration attacks.\n */\nexport function createInvalidCredentialsError(): AuthError {\n\treturn new AuthError('INVALID_CREDENTIALS');\n}\n\n// ============================================================================\n// Configuration\n// ============================================================================\n\n/**\n * Options for parseGraphQLError.\n */\nexport interface ParseGraphQLErrorOptions {\n\t/**\n\t * Custom fallback message when no known error code is matched.\n\t * Defaults to DEFAULT_ERROR_MESSAGE.\n\t */\n\tdefaultMessage?: string;\n\n\t/**\n\t * Custom error code to message mapping to extend or override defaults.\n\t * Merged with ERROR_MESSAGES (custom takes precedence).\n\t */\n\tcustomMessages?: Record<string, string>;\n}\n\n// ============================================================================\n// Error Parsing Utilities\n// ============================================================================\n\n/**\n * Shape of a GraphQL error with extensions.\n */\ninterface GraphQLErrorLike {\n\tmessage?: string;\n\textensions?: {\n\t\tcode?: string;\n\t\t[key: string]: unknown;\n\t};\n}\n\n/**\n * Check if a value looks like a GraphQL error object.\n */\nfunction isGraphQLErrorLike(value: unknown): value is GraphQLErrorLike {\n\tif (!value || typeof value !== 'object') return false;\n\treturn 'message' in value || 'extensions' in value;\n}\n\n/**\n * Shape of a validation error (Zod-like).\n * Detected by duck typing to avoid tight coupling to Zod.\n */\ninterface ValidationErrorLike {\n\tname: string;\n\tissues: Array<{ message: string; path?: (string | number)[] }>;\n}\n\n/**\n * Check if a value looks like a Zod validation error.\n * Uses duck typing (name + issues array) for portability.\n */\nfunction isValidationError(value: unknown): value is ValidationErrorLike {\n\tif (!value || typeof value !== 'object') return false;\n\tconst err = value as Record<string, unknown>;\n\treturn (\n\t\terr.name === 'ZodError' &&\n\t\tArray.isArray(err.issues) &&\n\t\terr.issues.length > 0 &&\n\t\ttypeof err.issues[0]?.message === 'string'\n\t);\n}\n\n/**\n * Extract error code from various error formats.\n *\n * Checks (in order):\n * 1. AuthError instance (has typed code)\n * 2. error.extensions.code (GraphQL error format)\n * 3. error.code (generic error format)\n * 4. Error code embedded in message (e.g., \"Error (Code: ACCOUNT_EXISTS)\")\n * 5. Direct code match in error message (e.g., \"ACCOUNT_EXISTS\")\n */\nfunction extractErrorCode(error: unknown, knownCodes: string[]): string | null {\n\t// Handle AuthError instances\n\tif (error instanceof AuthError) {\n\t\treturn error.code;\n\t}\n\n\t// Handle GraphQLRequestError (has .errors array with GraphQL error objects)\n\tif (error && typeof error === 'object' && 'errors' in error) {\n\t\tconst gqlErrors = (error as { errors: Array<{ message?: string; extensions?: Record<string, unknown> }> })\n\t\t\t.errors;\n\t\tif (Array.isArray(gqlErrors) && gqlErrors.length > 0) {\n\t\t\tconst firstError = gqlErrors[0];\n\t\t\tif (firstError.extensions?.code) return String(firstError.extensions.code);\n\t\t\tif (firstError.message) {\n\t\t\t\tconst codeMatch = firstError.message.match(/\\(\\s*[Cc]ode:\\s*([A-Z_]+)\\s*\\)/);\n\t\t\t\tif (codeMatch) return codeMatch[1];\n\t\t\t\tfor (const code of knownCodes) {\n\t\t\t\t\tif (firstError.message.includes(code)) return code;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Handle GraphQL error with extensions\n\tif (isGraphQLErrorLike(error) && error.extensions?.code) {\n\t\treturn String(error.extensions.code);\n\t}\n\n\t// Handle error object with code property\n\tif (error && typeof error === 'object' && 'code' in error) {\n\t\tconst code = (error as { code: unknown }).code;\n\t\tif (typeof code === 'string') return code;\n\t}\n\n\t// Extract message for pattern matching\n\tlet message: string | null = null;\n\tif (error instanceof Error) {\n\t\tmessage = error.message;\n\t} else if (isGraphQLErrorLike(error) && error.message) {\n\t\tmessage = error.message;\n\t} else if (typeof error === 'string') {\n\t\tmessage = error;\n\t}\n\n\tif (!message) return null;\n\n\t// Try to extract code from message pattern: \"(Code: ERROR_CODE)\"\n\tconst codeMatch = message.match(/\\(\\s*[Cc]ode:\\s*([A-Z_]+)\\s*\\)/);\n\tif (codeMatch) {\n\t\treturn codeMatch[1];\n\t}\n\n\t// Check if any known error code appears in the message\n\tfor (const code of knownCodes) {\n\t\tif (message.includes(code)) {\n\t\t\treturn code;\n\t\t}\n\t}\n\n\treturn null;\n}\n\n/**\n * Check if an error code is a known error code.\n */\nexport function isKnownErrorCode(code: string | null): code is ErrorCode {\n\tif (!code) return false;\n\treturn Object.values(ERROR_CODES).includes(code as ErrorCode);\n}\n\n/**\n * Get the user-friendly message for an error code.\n */\nexport function getErrorMessage(code: ErrorCode): string {\n\treturn ERROR_MESSAGES[code];\n}\n\n/**\n * Check if a message looks like technical/internal error (not user-friendly).\n */\nfunction isTechnicalMessage(message: string): boolean {\n\tconst lower = message.toLowerCase();\n\treturn (\n\t\tlower.includes('graphql') ||\n\t\tlower.includes('fetch') ||\n\t\tlower.includes('network') ||\n\t\tlower.includes('econnrefused') ||\n\t\tlower.includes('undefined') ||\n\t\tlower.includes('null') ||\n\t\tlower.includes('timeout') ||\n\t\tlower.includes('connection') ||\n\t\tlower.includes('socket') ||\n\t\tlower.includes('enotfound') ||\n\t\tlower.includes('abort')\n\t);\n}\n\n// ============================================================================\n// Main Parse Function\n// ============================================================================\n\n/**\n * Result of parsing a GraphQL error.\n */\nexport interface ParsedGraphQLError {\n\t/** The extracted error code, if any */\n\tcode: string | null;\n\t/** User-friendly error message */\n\tmessage: string;\n\t/** Whether a known error code was found */\n\tisKnownError: boolean;\n\t/** Original error for debugging */\n\toriginalError: unknown;\n}\n\n/**\n * Parse a GraphQL error and return a user-friendly message.\n *\n * This function:\n * 1. Extracts the error code from various error formats\n * 2. Maps known codes to user-friendly messages\n * 3. Falls back to generic message for unknown/technical errors\n *\n * @param error - The error to parse (can be Error, GraphQL error, string, etc.)\n * @param options - Optional configuration for custom messages\n * @returns ParsedGraphQLError with code, message, and metadata\n *\n * @example\n * ```ts\n * // Basic usage\n * const { message } = parseGraphQLError(error);\n * setError(message);\n *\n * // With custom default message\n * const { message } = parseGraphQLError(error, {\n * defaultMessage: 'Unable to sign in. Please try again.'\n * });\n *\n * // With custom error code mappings\n * const { message } = parseGraphQLError(error, {\n * customMessages: {\n * 'CUSTOM_ERROR': 'A custom error occurred.',\n * }\n * });\n * ```\n */\nexport function parseGraphQLError(\n\terror: unknown,\n\toptions: ParseGraphQLErrorOptions = {}\n): ParsedGraphQLError {\n\t// Fast path for AuthError - already has user-friendly message\n\tif (error instanceof AuthError) {\n\t\treturn {\n\t\t\tcode: error.code,\n\t\t\tmessage: error.userMessage,\n\t\t\tisKnownError: true,\n\t\t\toriginalError: error,\n\t\t};\n\t}\n\n\t// Handle validation errors (Zod-like) - detect by shape, not import\n\t// This keeps the module portable without tight coupling to Zod\n\tif (isValidationError(error)) {\n\t\t// Get the first error message (most relevant for form validation)\n\t\tconst firstIssue = error.issues[0];\n\t\tconst message = firstIssue?.message || 'Validation failed. Please check your input.';\n\t\treturn {\n\t\t\tcode: 'VALIDATION_ERROR',\n\t\t\tmessage,\n\t\t\tisKnownError: true,\n\t\t\toriginalError: error,\n\t\t};\n\t}\n\n\tconst { defaultMessage = DEFAULT_ERROR_MESSAGE, customMessages = {} } = options;\n\n\t// Merge custom messages with defaults (custom takes precedence)\n\tconst allMessages: Record<string, string> = { ...ERROR_MESSAGES, ...customMessages };\n\tconst allKnownCodes = Object.keys(allMessages);\n\n\tconst code = extractErrorCode(error, allKnownCodes);\n\tconst isKnown = code !== null && code in allMessages;\n\n\tlet message: string;\n\tif (isKnown && code) {\n\t\tmessage = allMessages[code];\n\t} else {\n\t\t// Use error message if available and not technical\n\t\tif (error instanceof Error && error.message && !isTechnicalMessage(error.message)) {\n\t\t\tmessage = error.message;\n\t\t} else if (\n\t\t\terror instanceof Error &&\n\t\t\tisTechnicalMessage(error.message) &&\n\t\t\t'errors' in error &&\n\t\t\tArray.isArray((error as { errors: unknown[] }).errors)\n\t\t) {\n\t\t\t// Extract user-friendly message from GraphQLRequestError's inner errors\n\t\t\tconst innerMsg = (\n\t\t\t\t(error as { errors: Array<{ message?: string }> }).errors[0] as { message?: string } | undefined\n\t\t\t)?.message;\n\t\t\tmessage = innerMsg && !isTechnicalMessage(innerMsg) ? innerMsg : defaultMessage;\n\t\t} else {\n\t\t\tmessage = defaultMessage;\n\t\t}\n\t}\n\n\treturn {\n\t\tcode: isKnown ? code : null,\n\t\tmessage,\n\t\tisKnownError: isKnown,\n\t\toriginalError: error,\n\t};\n}\n","const KEY_PREFIX = 'sheets-auth-token';\n\nfunction storageKey(databaseId: string): string {\n\treturn `${KEY_PREFIX}:${databaseId}`;\n}\n\nfunction getStorage(): Storage | null {\n\tif (typeof window === 'undefined') return null;\n\ttry {\n\t\treturn window.localStorage;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport interface StoredToken {\n\taccessToken: string;\n\texpiresAt: string;\n\tidentityKey?: string | null;\n}\n\nexport function getStoredToken(databaseId: string): StoredToken | null {\n\tconst storage = getStorage();\n\tif (!storage) return null;\n\n\ttry {\n\t\tconst raw = storage.getItem(storageKey(databaseId));\n\t\tif (!raw) return null;\n\t\tconst parsed = JSON.parse(raw) as StoredToken;\n\t\tif (!parsed.accessToken || !parsed.expiresAt) return null;\n\t\tif (parsed.identityKey != null && typeof parsed.identityKey !== 'string') return null;\n\t\treturn parsed;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function setStoredToken(\n\tdatabaseId: string,\n\taccessToken: string,\n\texpiresAt: string,\n\tidentityKey?: string | null,\n): void {\n\tconst storage = getStorage();\n\tif (!storage) return;\n\n\ttry {\n\t\tconst data: StoredToken = { accessToken, expiresAt, identityKey };\n\t\tstorage.setItem(storageKey(databaseId), JSON.stringify(data));\n\t} catch {\n\t\t// Silently fail — localStorage might be full or unavailable\n\t}\n}\n\nexport function clearStoredToken(databaseId: string): void {\n\tconst storage = getStorage();\n\tif (!storage) return;\n\n\ttry {\n\t\tstorage.removeItem(storageKey(databaseId));\n\t} catch {\n\t\t// Silently fail\n\t}\n}\n","import type { SheetsConfig } from '../context/sheets-context';\n\n/**\n * Execute a GraphQL mutation against the auth endpoint.\n * Falls back to the data endpoint if authEndpoint is not configured.\n */\nexport async function executeAuthMutation<TResult = unknown>(\n\tconfig: SheetsConfig,\n\tquery: string,\n\tvariables?: Record<string, unknown>,\n): Promise<TResult> {\n\tconst url = config.authEndpoint || config.endpoint;\n\tif (!url) {\n\t\tthrow new Error('No auth endpoint configured.');\n\t}\n\n\tconst headers: Record<string, string> = {\n\t\t'Content-Type': 'application/json',\n\t\tAccept: 'application/graphql-response+json',\n\t};\n\n\tlet response: Response;\n\ttry {\n\t\tresponse = await fetch(url, {\n\t\t\tmethod: 'POST',\n\t\t\theaders,\n\t\t\tbody: JSON.stringify({\n\t\t\t\tquery,\n\t\t\t\t...(variables !== undefined && { variables }),\n\t\t\t}),\n\t\t});\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Network error: ${error instanceof Error ? error.message : 'Failed to connect to auth endpoint'}`,\n\t\t);\n\t}\n\n\tif (!response.ok) {\n\t\tconst { status, statusText } = response;\n\t\ttry {\n\t\t\tconst body = await response.json();\n\t\t\tif (body.errors?.length) {\n\t\t\t\tconst firstError = body.errors[0];\n\t\t\t\tconst err = new Error(firstError.message || `Auth request failed: ${status}`);\n\t\t\t\t(err as any).code = firstError.extensions?.code;\n\t\t\t\t(err as any).errors = body.errors;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (e instanceof Error && (e as any).errors) throw e;\n\t\t}\n\t\tthrow new Error(`Auth request failed: ${status} ${statusText}`);\n\t}\n\n\tconst result = await response.json();\n\n\tif (result.errors?.length) {\n\t\tconst firstError = result.errors[0];\n\t\tconst err = new Error(firstError.message || 'Auth mutation failed');\n\t\t(err as any).code = firstError.extensions?.code;\n\t\t(err as any).errors = result.errors;\n\t\tthrow err;\n\t}\n\n\treturn result.data as TResult;\n}\n","// ============================================================================\n// Auth Result Types\n// ============================================================================\n\nexport interface AuthResultRecord {\n\tid: string;\n\tuserId: string;\n\taccessToken: string;\n\taccessTokenExpiresAt: string;\n\tisVerified?: boolean | null;\n\ttotpEnabled?: boolean | null;\n}\n\n// ============================================================================\n// Generic Helper\n// ============================================================================\n\nexport type MutationVariables<TInput> = { input: TInput };\n\n// ============================================================================\n// SignIn Mutation\n// ============================================================================\n\nexport interface SignInInput {\n\temail: string;\n\tpassword: string;\n\trememberMe?: boolean;\n}\n\nexport type SignInMutationVariables = MutationVariables<SignInInput>;\n\nexport interface SignInMutationResult {\n\tsignIn?: {\n\t\tresult?: AuthResultRecord | null;\n\t\tclientMutationId?: string | null;\n\t} | null;\n}\n\n// ============================================================================\n// SignUp Mutation\n// ============================================================================\n\nexport interface SignUpInput {\n\temail: string;\n\tpassword: string;\n}\n\nexport type SignUpMutationVariables = MutationVariables<SignUpInput>;\n\nexport interface SignUpMutationResult {\n\tsignUp?: {\n\t\tclientMutationId?: string | null;\n\t} | null;\n}\n\n// ============================================================================\n// Forgot Password Mutation\n// ============================================================================\n\nexport interface ForgotPasswordInput {\n\temail: string;\n}\n\nexport type ForgotPasswordMutationVariables = MutationVariables<ForgotPasswordInput>;\n\nexport interface ForgotPasswordMutationResult {\n\tforgotPassword?: {\n\t\tclientMutationId?: string | null;\n\t} | null;\n}\n\n// ============================================================================\n// Reset Password Mutation\n// ============================================================================\n\nexport interface ResetPasswordInput {\n\tnewPassword: string;\n\tresetToken: string;\n\troleId?: string;\n}\n\nexport type ResetPasswordMutationVariables = MutationVariables<ResetPasswordInput>;\n\nexport interface ResetPasswordMutationResult {\n\tresetPassword?: {\n\t\tresult?: boolean | null;\n\t\tclientMutationId?: string | null;\n\t} | null;\n}\n\n// ============================================================================\n// Token Helper\n// ============================================================================\n\nexport function toAuthToken(record: AuthResultRecord | null | undefined): { accessToken: string; expiresAt: string } | null {\n\tif (!record?.accessToken || !record?.accessTokenExpiresAt) {\n\t\treturn null;\n\t}\n\treturn {\n\t\taccessToken: record.accessToken,\n\t\texpiresAt: record.accessTokenExpiresAt,\n\t};\n}\n","import { useMutation, useQueryClient } from '@tanstack/react-query';\n\nimport type { RegisterFormData } from '../utils/schemas';\nimport { useSheetsContext } from '../../context/sheets-context';\nimport { useSheetsStoreApi } from '../../store/sheets-store';\nimport { executeAuthMutation } from '../auth-execute';\nimport { type SignUpMutationResult, type SignUpMutationVariables } from '../auth-types';\n\nconst SIGN_UP_MUTATION = /* GraphQL */ `\n\tmutation SignUp($input: SignUpInput!) {\n\t\tsignUp(input: $input) {\n\t\t\tclientMutationId\n\t\t}\n\t}\n`;\n\nexport function useSheetsRegister() {\n\tconst queryClient = useQueryClient();\n\tconst { config } = useSheetsContext();\n\tconst storeApi = useSheetsStoreApi();\n\n\treturn useMutation({\n\t\tmutationKey: ['sheets', 'auth', 'signUp'],\n\t\tmutationFn: async (formData: RegisterFormData) => {\n\t\t\t// sign_up never signs anyone in: the address is mailed a link that does\n\t\t\tawait executeAuthMutation<SignUpMutationResult>(\n\t\t\t\tconfig,\n\t\t\t\tSIGN_UP_MUTATION,\n\t\t\t\t{\n\t\t\t\t\tinput: {\n\t\t\t\t\t\temail: formData.email,\n\t\t\t\t\t\tpassword: formData.password,\n\t\t\t\t\t},\n\t\t\t\t} satisfies SignUpMutationVariables,\n\t\t\t);\n\n\t\t\treturn { email: formData.email };\n\t\t},\n\t\tonSuccess: () => {\n\t\t\tqueryClient.invalidateQueries({ queryKey: ['sheets'] });\n\t\t},\n\t\tonError: () => {\n\t\t\tstoreApi.getState().setUnauthenticated();\n\t\t},\n\t});\n}\n","import { useMutation } from '@tanstack/react-query';\n\nimport { useSheetsContext } from '../../context/sheets-context';\nimport { executeAuthMutation } from '../auth-execute';\nimport type { ForgotPasswordMutationResult, ForgotPasswordMutationVariables } from '../auth-types';\n\nconst FORGOT_PASSWORD_MUTATION = /* GraphQL */ `\n\tmutation ForgotPassword($input: ForgotPasswordInput!) {\n\t\tforgotPassword(input: $input) {\n\t\t\tclientMutationId\n\t\t}\n\t}\n`;\n\nexport function useSheetsForgotPassword() {\n\tconst { config } = useSheetsContext();\n\n\treturn useMutation({\n\t\tmutationKey: ['sheets', 'auth', 'forgotPassword'],\n\t\tmutationFn: async ({ email }: { email: string }) => {\n\t\t\tawait executeAuthMutation<ForgotPasswordMutationResult>(\n\t\t\t\tconfig,\n\t\t\t\tFORGOT_PASSWORD_MUTATION,\n\t\t\t\t{\n\t\t\t\t\tinput: { email },\n\t\t\t\t} satisfies ForgotPasswordMutationVariables,\n\t\t\t);\n\t\t\treturn { email };\n\t\t},\n\t});\n}\n","import { useMutation, useQueryClient } from '@tanstack/react-query';\n\nimport { useSheetsContext } from '../../context/sheets-context';\nimport { executeAuthMutation } from '../auth-execute';\nimport type { ResetPasswordInput, ResetPasswordMutationResult, ResetPasswordMutationVariables } from '../auth-types';\n\nconst RESET_PASSWORD_MUTATION = /* GraphQL */ `\n\tmutation ResetPassword($input: ResetPasswordInput!) {\n\t\tresetPassword(input: $input) {\n\t\t\tresult\n\t\t\tclientMutationId\n\t\t}\n\t}\n`;\n\nexport function useSheetsResetPassword() {\n\tconst queryClient = useQueryClient();\n\tconst { config } = useSheetsContext();\n\n\treturn useMutation({\n\t\tmutationKey: ['sheets', 'auth', 'resetPassword'],\n\t\tmutationFn: async (input: ResetPasswordInput) => {\n\t\t\tconst result = await executeAuthMutation<ResetPasswordMutationResult>(\n\t\t\t\tconfig,\n\t\t\t\tRESET_PASSWORD_MUTATION,\n\t\t\t\t{\n\t\t\t\t\tinput: {\n\t\t\t\t\t\tnewPassword: input.newPassword,\n\t\t\t\t\t\tresetToken: input.resetToken,\n\t\t\t\t\t\troleId: input.roleId,\n\t\t\t\t\t},\n\t\t\t\t} satisfies ResetPasswordMutationVariables,\n\t\t\t);\n\n\t\t\tif (!result.resetPassword?.result) {\n\t\t\t\tthrow new Error('Failed to reset password. The link may have expired.');\n\t\t\t}\n\n\t\t\treturn { success: true };\n\t\t},\n\t\tonSuccess: () => {\n\t\t\tqueryClient.invalidateQueries({ queryKey: ['sheets'] });\n\t\t},\n\t});\n}\n","import { useRef, useState } from 'react';\nimport { useForm } from '@tanstack/react-form';\n\nimport { parseGraphQLError } from '../utils/auth-errors';\nimport type { LoginFormData } from '../utils/schemas';\nimport { loginSchema } from '../utils/schemas';\nimport { Button } from '@constructive-io/ui/button';\nimport { Checkbox } from '@constructive-io/ui/checkbox';\n\nimport { AuthErrorAlert } from './auth-error-alert';\nimport { AuthLoadingButton } from './auth-loading-button';\nimport { FormField } from './form-field';\n\nexport interface SheetsLoginFormProps {\n\tonLogin: (credentials: LoginFormData) => Promise<void>;\n\tonShowForgot?: () => void;\n\tonShowRegister?: () => void;\n\tdefaultEmail?: string;\n}\n\nexport function SheetsLoginForm({ onLogin, onShowForgot, onShowRegister, defaultEmail = '' }: SheetsLoginFormProps) {\n\tconst [error, setError] = useState<string | null>(null);\n\tconst [isSubmitting, setIsSubmitting] = useState(false);\n\tconst passwordInputRef = useRef<HTMLInputElement>(null);\n\n\tconst form = useForm({\n\t\tdefaultValues: {\n\t\t\temail: defaultEmail,\n\t\t\tpassword: '',\n\t\t\trememberMe: true,\n\t\t},\n\t\tonSubmit: async ({ value }) => {\n\t\t\tsetError(null);\n\t\t\tsetIsSubmitting(true);\n\n\t\t\ttry {\n\t\t\t\tconst validatedData = loginSchema.parse(value);\n\t\t\t\tawait onLogin(validatedData);\n\t\t\t} catch (err) {\n\t\t\t\tsetError(parseGraphQLError(err).message);\n\t\t\t} finally {\n\t\t\t\tsetIsSubmitting(false);\n\t\t\t}\n\t\t},\n\t\tvalidators: {\n\t\t\tonChange: ({ value }) => {\n\t\t\t\tconst result = loginSchema.safeParse(value);\n\t\t\t\tif (!result.success) {\n\t\t\t\t\treturn result.error.issues.map((issue) => issue.message).join(', ');\n\t\t\t\t}\n\t\t\t\treturn undefined;\n\t\t\t},\n\t\t},\n\t});\n\n\treturn (\n\t\t<div className='space-y-5'>\n\t\t\t<form\n\t\t\t\tonSubmit={(e) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\tform.handleSubmit();\n\t\t\t\t}}\n\t\t\t\tclassName='space-y-4 px-8'\n\t\t\t>\n\t\t\t\t<AuthErrorAlert error={error} />\n\t\t\t\t<form.Field\n\t\t\t\t\tname='email'\n\t\t\t\t\tvalidators={{\n\t\t\t\t\t\tonChange: ({ value }) => {\n\t\t\t\t\t\t\tif (!value) return 'Email is required';\n\t\t\t\t\t\t\tif (!/\\S+@\\S+\\.\\S+/.test(value)) return 'Please enter a valid email';\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{(field) => (\n\t\t\t\t\t\t<FormField\n\t\t\t\t\t\t\tfield={field}\n\t\t\t\t\t\t\tlabel='Email'\n\t\t\t\t\t\t\tplaceholder='Enter your email'\n\t\t\t\t\t\t\ttype='email'\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</form.Field>\n\n\t\t\t\t<form.Field\n\t\t\t\t\tname='password'\n\t\t\t\t\tvalidators={{\n\t\t\t\t\t\tonChange: ({ value }) => {\n\t\t\t\t\t\t\tif (!value) return 'Password is required';\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{(field) => (\n\t\t\t\t\t\t<FormField\n\t\t\t\t\t\t\tfield={field}\n\t\t\t\t\t\t\tlabel='Password'\n\t\t\t\t\t\t\tplaceholder='Enter your password'\n\t\t\t\t\t\t\ttype='password'\n\t\t\t\t\t\t\tinputRef={passwordInputRef}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</form.Field>\n\n\t\t\t\t<form.Field name='rememberMe'>\n\t\t\t\t\t{(field) => (\n\t\t\t\t\t\t<div className='flex items-center space-x-2'>\n\t\t\t\t\t\t\t<Checkbox\n\t\t\t\t\t\t\t\tid='rememberMe'\n\t\t\t\t\t\t\t\tchecked={field.state.value}\n\t\t\t\t\t\t\t\tonCheckedChange={(checked) => {\n\t\t\t\t\t\t\t\t\tfield.handleChange(checked === true);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t\thtmlFor='rememberMe'\n\t\t\t\t\t\t\t\tclassName='text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70'\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tRemember me\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</form.Field>\n\n\t\t\t\t<div className='space-y-3 pt-2'>\n\t\t\t\t\t<AuthLoadingButton\n\t\t\t\t\t\ttype='submit'\n\t\t\t\t\t\tclassName='w-full'\n\t\t\t\t\t\tisLoading={isSubmitting}\n\t\t\t\t\t\tdisabled={isSubmitting}\n\t\t\t\t\t\tdata-testid='auth-login-submit'\n\t\t\t\t\t>\n\t\t\t\t\t\tSign In\n\t\t\t\t\t</AuthLoadingButton>\n\n\t\t\t\t\t{onShowForgot && (\n\t\t\t\t\t\t<div className='text-center'>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant='link'\n\t\t\t\t\t\t\t\tclassName='text-muted-foreground hover:text-foreground h-auto p-0 text-sm'\n\t\t\t\t\t\t\t\tonClick={onShowForgot}\n\t\t\t\t\t\t\t\ttype='button'\n\t\t\t\t\t\t\t\tdata-testid='auth-forgot-link'\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tForgot your password?\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</form>\n\n\t\t\t{onShowRegister && (\n\t\t\t\t<div className='border-border/40 border-t pt-5'>\n\t\t\t\t\t<p className='text-muted-foreground text-center text-sm'>\n\t\t\t\t\t\tDon&apos;t have an account?{' '}\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant='link'\n\t\t\t\t\t\t\tclassName='text-primary hover:text-primary/80 h-auto p-0 font-medium'\n\t\t\t\t\t\t\tonClick={onShowRegister}\n\t\t\t\t\t\t\ttype='button'\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tSign up\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n","import { z } from 'zod';\n\n/**\n * Password validation schema with strong requirements\n */\nconst passwordSchema = z\n\t.string()\n\t.min(8, 'Password must be at least 8 characters')\n\t.regex(\n\t\t/^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]/,\n\t\t'Password must contain uppercase, lowercase, number, and special character',\n\t);\n\n/**\n * Email validation schema\n */\nconst emailSchema = z.string().email('Please enter a valid email address');\n\n/**\n * Login form validation schema\n */\nexport const loginSchema = z.object({\n\temail: emailSchema,\n\tpassword: z.string().min(1, 'Password is required'),\n\trememberMe: z.boolean().optional(),\n});\n\n/**\n * Registration form validation schema\n * Backend only receives email/password - confirmPassword is frontend-only validation\n * Password strength is validated by backend to avoid duplicate/conflicting rules\n */\nexport const registerSchema = z\n\t.object({\n\t\temail: emailSchema,\n\t\tpassword: z.string().min(1, 'Password is required'),\n\t\tconfirmPassword: z.string().min(1, 'Please confirm your password'),\n\t})\n\t.refine((data) => data.password === data.confirmPassword, {\n\t\tmessage: 'Passwords do not match',\n\t\tpath: ['confirmPassword'],\n\t});\n\n/**\n * Forgot password form validation schema\n */\nexport const forgotPasswordSchema = z.object({\n\temail: emailSchema,\n});\n\n/**\n * Reset password form validation schema\n */\nexport const resetPasswordSchema = z\n\t.object({\n\t\tpassword: passwordSchema,\n\t\tconfirmPassword: z.string(),\n\t\ttoken: z.string().min(1, 'Reset token is required'),\n\t})\n\t.refine((data) => data.password === data.confirmPassword, {\n\t\tmessage: 'Passwords do not match',\n\t\tpath: ['confirmPassword'],\n\t});\n\n/**\n * TypeScript types inferred from schemas\n */\nexport type LoginFormData = z.infer<typeof loginSchema>;\nexport type RegisterFormData = z.infer<typeof registerSchema>;\nexport type ForgotPasswordFormData = z.infer<typeof forgotPasswordSchema>;\nexport type ResetPasswordFormData = z.infer<typeof resetPasswordSchema>;\n","import { AlertCircleIcon } from 'lucide-react';\n\nimport { cn } from '../../utils/cn';\n\ninterface AuthErrorAlertProps {\n\terror: string | null;\n\tclassName?: string;\n}\n\nexport function AuthErrorAlert({ error, className }: AuthErrorAlertProps) {\n\tconst hasError = Boolean(error);\n\n\treturn (\n\t\t<div\n\t\t\trole='alert'\n\t\t\taria-live='polite'\n\t\t\taria-hidden={!hasError}\n\t\t\tclassName={cn(\n\t\t\t\t'overflow-hidden transition-[max-height,opacity] duration-(--duration-slow) ease-out',\n\t\t\t\thasError ? 'max-h-32' : 'max-h-0',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'flex items-start gap-2.5 rounded-md px-3 py-2.5',\n\t\t\t\t\t'bg-destructive/8 border border-destructive/20',\n\t\t\t\t\t'text-destructive text-sm text-left',\n\t\t\t\t\t'transition-opacity duration-(--duration-slow)',\n\t\t\t\t\thasError ? 'opacity-100' : 'opacity-0',\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<AlertCircleIcon className='mt-0.5 h-4 w-4 shrink-0' />\n\t\t\t\t<span className='text-pretty leading-snug'>{error}</span>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","import { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","import { ComponentProps } from 'react';\nimport { LoaderIcon } from 'lucide-react';\n\nimport { cn } from '../../utils/cn';\nimport { Button } from '@constructive-io/ui/button';\n\ninterface AuthLoadingButtonProps extends ComponentProps<typeof Button> {\n\tisLoading: boolean;\n\tloadingText?: string;\n}\n\nexport function AuthLoadingButton({\n\tchildren,\n\tisLoading,\n\tloadingText = 'Please wait...',\n\tdisabled,\n\tclassName,\n\t...props\n}: AuthLoadingButtonProps) {\n\treturn (\n\t\t<Button disabled={disabled || isLoading} className={cn('relative', className)} {...props}>\n\t\t\t{isLoading && <LoaderIcon className='mr-2 h-4 w-4 animate-spin' />}\n\t\t\t{isLoading ? loadingText : children}\n\t\t</Button>\n\t);\n}\n","import type { RefObject } from 'react';\nimport { Input } from '@constructive-io/ui/input';\nimport { FormControl, type FormControlLayout } from '@constructive-io/ui/form-control';\n\ninterface FormFieldProps {\n field: any;\n label: string;\n placeholder?: string;\n type?: string;\n className?: string;\n layout?: FormControlLayout;\n inputRef?: RefObject<HTMLInputElement | null>;\n testId?: string;\n}\n\nexport function FormField({\n field,\n label,\n placeholder,\n type = 'text',\n className,\n layout = 'floating',\n inputRef,\n testId,\n}: FormFieldProps) {\n const errors = field.state.meta.errors?.filter(Boolean) ?? [];\n const hasError = errors.length > 0;\n const errorMessage = errors[0] as string | undefined;\n\n return (\n <FormControl\n label={label}\n id={field.name}\n layout={layout}\n error={hasError ? errorMessage : undefined}\n className={className}\n >\n <Input\n ref={inputRef}\n name={field.name}\n data-testid={testId ?? field.name}\n type={type}\n placeholder={placeholder}\n value={field.state.value || ''}\n onChange={(e) => field.handleChange(e.target.value)}\n onBlur={field.handleBlur}\n />\n </FormControl>\n );\n}\n","import { useRef, useState } from 'react';\nimport { useForm } from '@tanstack/react-form';\nimport { CheckCircleIcon } from 'lucide-react';\n\nimport { parseGraphQLError } from '../utils/auth-errors';\nimport type { RegisterFormData } from '../utils/schemas';\nimport { registerSchema } from '../utils/schemas';\nimport { Button } from '@constructive-io/ui/button';\n\nimport { AuthErrorAlert } from './auth-error-alert';\nimport { AuthLoadingButton } from './auth-loading-button';\nimport { FormField } from './form-field';\n\nexport interface SheetsRegisterFormProps {\n\tonRegister: (formData: RegisterFormData) => Promise<unknown>;\n\tonShowLogin?: () => void;\n\tdefaultEmail?: string;\n}\n\nexport function SheetsRegisterForm({ onRegister, onShowLogin, defaultEmail = '' }: SheetsRegisterFormProps) {\n\tconst [error, setError] = useState<string | null>(null);\n\tconst [isSubmitting, setIsSubmitting] = useState(false);\n\tconst [isSuccess, setIsSuccess] = useState(false);\n\tconst passwordInputRef = useRef<HTMLInputElement>(null);\n\n\tconst form = useForm({\n\t\tdefaultValues: {\n\t\t\temail: defaultEmail,\n\t\t\tpassword: '',\n\t\t\tconfirmPassword: '',\n\t\t},\n\t\tonSubmit: async ({ value }) => {\n\t\t\tsetError(null);\n\t\t\tsetIsSubmitting(true);\n\n\t\t\ttry {\n\t\t\t\tconst validatedData = registerSchema.parse(value);\n\t\t\t\tawait onRegister(validatedData);\n\t\t\t\tsetIsSuccess(true);\n\t\t\t} catch (err) {\n\t\t\t\tsetError(parseGraphQLError(err).message);\n\t\t\t} finally {\n\t\t\t\tsetIsSubmitting(false);\n\t\t\t}\n\t\t},\n\t});\n\n\tif (isSuccess) {\n\t\treturn (\n\t\t\t<div className='space-y-5 text-center'>\n\t\t\t\t<div className='flex justify-center'>\n\t\t\t\t\t<div className='bg-success/10 flex h-12 w-12 items-center justify-center rounded-full'>\n\t\t\t\t\t\t<CheckCircleIcon className='text-success h-6 w-6' />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className='space-y-1.5'>\n\t\t\t\t\t<h3 className='text-lg font-semibold'>Check your email</h3>\n\t\t\t\t\t<p className='text-muted-foreground text-sm'>\n\t\t\t\t\t\tWe&apos;ve sent a link to confirm your address. Open it, then sign in with your password.\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className='space-y-5'>\n\t\t\t<form\n\t\t\t\tonSubmit={(e) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\tform.handleSubmit();\n\t\t\t\t}}\n\t\t\t\tclassName='space-y-4 px-8 pb-2'\n\t\t\t>\n\t\t\t\t<AuthErrorAlert error={error} />\n\t\t\t\t<form.Field name='email'>\n\t\t\t\t\t{(field) => (\n\t\t\t\t\t\t<FormField\n\t\t\t\t\t\t\tfield={field}\n\t\t\t\t\t\t\tlabel='Email'\n\t\t\t\t\t\t\tplaceholder='Enter your email'\n\t\t\t\t\t\t\ttype='email'\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</form.Field>\n\n\t\t\t\t<form.Field name='password'>\n\t\t\t\t\t{(field) => (\n\t\t\t\t\t\t<FormField\n\t\t\t\t\t\t\tfield={field}\n\t\t\t\t\t\t\tlabel='Password'\n\t\t\t\t\t\t\tplaceholder='Enter your password'\n\t\t\t\t\t\t\ttype='password'\n\t\t\t\t\t\t\tinputRef={passwordInputRef}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</form.Field>\n\n\t\t\t\t<form.Field name='confirmPassword'>\n\t\t\t\t\t{(field) => (\n\t\t\t\t\t\t<FormField\n\t\t\t\t\t\t\tfield={field}\n\t\t\t\t\t\t\tlabel='Confirm Password'\n\t\t\t\t\t\t\tplaceholder='Confirm your password'\n\t\t\t\t\t\t\ttype='password'\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</form.Field>\n\n\n\t\t\t\t<div className='pt-2'>\n\t\t\t\t\t<AuthLoadingButton\n\t\t\t\t\t\ttype='submit'\n\t\t\t\t\t\tclassName='w-full'\n\t\t\t\t\t\tisLoading={isSubmitting}\n\t\t\t\t\t\tdisabled={isSubmitting}\n\t\t\t\t\t\tdata-testid='auth-signup-submit'\n\t\t\t\t\t>\n\t\t\t\t\t\tCreate Account\n\t\t\t\t\t</AuthLoadingButton>\n\t\t\t\t</div>\n\t\t\t</form>\n\n\t\t\t{onShowLogin && (\n\t\t\t\t<div className='border-border/40 border-t pt-5'>\n\t\t\t\t\t<p className='text-muted-foreground text-center text-sm'>\n\t\t\t\t\t\tAlready have an account?{' '}\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant='link'\n\t\t\t\t\t\t\tclassName='text-primary hover:text-primary/80 h-auto p-0 font-medium'\n\t\t\t\t\t\t\tonClick={onShowLogin}\n\t\t\t\t\t\t\ttype='button'\n\t\t\t\t\t\t\tdata-testid='auth-signup-login-link'\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tSign in\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n","import { useState } from 'react';\nimport { useForm } from '@tanstack/react-form';\nimport { CheckCircleIcon } from 'lucide-react';\n\nimport { parseGraphQLError } from '../utils/auth-errors';\nimport type { ForgotPasswordFormData } from '../utils/schemas';\nimport { forgotPasswordSchema } from '../utils/schemas';\nimport { Button } from '@constructive-io/ui/button';\n\nimport { AuthErrorAlert } from './auth-error-alert';\nimport { AuthLoadingButton } from './auth-loading-button';\nimport { AuthScreenHeader } from './auth-screen-header';\nimport { FormField } from './form-field';\n\nexport interface SheetsForgotPasswordFormProps {\n\tonForgotPassword: (formData: ForgotPasswordFormData) => Promise<unknown>;\n\tonShowLogin?: () => void;\n}\n\nexport function SheetsForgotPasswordForm({ onForgotPassword, onShowLogin }: SheetsForgotPasswordFormProps) {\n\tconst [error, setError] = useState<string | null>(null);\n\tconst [isSubmitting, setIsSubmitting] = useState(false);\n\tconst [isSuccess, setIsSuccess] = useState(false);\n\n\tconst form = useForm({\n\t\tdefaultValues: {\n\t\t\temail: '',\n\t\t},\n\t\tonSubmit: async ({ value }) => {\n\t\t\tsetError(null);\n\t\t\tsetIsSubmitting(true);\n\n\t\t\ttry {\n\t\t\t\tconst validatedData = forgotPasswordSchema.parse(value);\n\t\t\t\tawait onForgotPassword(validatedData);\n\t\t\t\tsetIsSuccess(true);\n\t\t\t} catch (err) {\n\t\t\t\tsetError(parseGraphQLError(err).message);\n\t\t\t} finally {\n\t\t\t\tsetIsSubmitting(false);\n\t\t\t}\n\t\t},\n\t\tvalidators: {\n\t\t\tonChange: ({ value }) => {\n\t\t\t\tconst result = forgotPasswordSchema.safeParse(value);\n\t\t\t\tif (!result.success) {\n\t\t\t\t\treturn result.error.issues.map((issue) => issue.message).join(', ');\n\t\t\t\t}\n\t\t\t\treturn undefined;\n\t\t\t},\n\t\t},\n\t});\n\n\tif (isSuccess) {\n\t\treturn (\n\t\t\t<div className='space-y-5 text-center'>\n\t\t\t\t<div className='flex justify-center'>\n\t\t\t\t\t<div className='bg-success/10 flex h-12 w-12 items-center justify-center rounded-full'>\n\t\t\t\t\t\t<CheckCircleIcon className='text-success h-6 w-6' />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className='space-y-1.5'>\n\t\t\t\t\t<h3 className='text-lg font-semibold'>Check your email</h3>\n\t\t\t\t\t<p className='text-muted-foreground text-sm'>We&apos;ve sent a password reset link to your email address.</p>\n\t\t\t\t</div>\n\t\t\t\t{onShowLogin && (\n\t\t\t\t\t<div className='pt-1'>\n\t\t\t\t\t\t<Button variant='outline' type='button' onClick={onShowLogin} className='w-full'>\n\t\t\t\t\t\t\tBack to sign in\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className='space-y-5'>\n\t\t\t<AuthScreenHeader title='Reset your password' description=\"We'll send you a password reset link\" />\n\n\t\t\t<form\n\t\t\t\tonSubmit={(e) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\tform.handleSubmit();\n\t\t\t\t}}\n\t\t\t\tclassName='space-y-4 px-8'\n\t\t\t>\n\t\t\t\t<AuthErrorAlert error={error} />\n\t\t\t\t<form.Field\n\t\t\t\t\tname='email'\n\t\t\t\t\tvalidators={{\n\t\t\t\t\t\tonChange: ({ value }) => {\n\t\t\t\t\t\t\tif (!value) return 'Email is required';\n\t\t\t\t\t\t\tif (!/\\S+@\\S+\\.\\S+/.test(value)) return 'Please enter a valid email';\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{(field) => (\n\t\t\t\t\t\t<FormField\n\t\t\t\t\t\t\tfield={field}\n\t\t\t\t\t\t\tlabel='Email'\n\t\t\t\t\t\t\tplaceholder='Enter your email'\n\t\t\t\t\t\t\ttype='email'\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</form.Field>\n\n\t\t\t\t<div className='pt-2'>\n\t\t\t\t\t<AuthLoadingButton\n\t\t\t\t\t\ttype='submit'\n\t\t\t\t\t\tclassName='w-full'\n\t\t\t\t\t\tisLoading={isSubmitting}\n\t\t\t\t\t\tdisabled={isSubmitting}\n\t\t\t\t\t\tdata-testid='auth-forgot-submit'\n\t\t\t\t\t>\n\t\t\t\t\t\tSend Reset Link\n\t\t\t\t\t</AuthLoadingButton>\n\t\t\t\t</div>\n\t\t\t</form>\n\n\t\t\t{onShowLogin && (\n\t\t\t\t<div className='text-muted-foreground text-center text-sm'>\n\t\t\t\t\tRemember your password?{' '}\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant='link'\n\t\t\t\t\t\tclassName='text-primary hover:text-primary/80 h-auto p-0 font-medium'\n\t\t\t\t\t\tonClick={onShowLogin}\n\t\t\t\t\t\ttype='button'\n\t\t\t\t\t>\n\t\t\t\t\t\tSign in\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n","import * as React from 'react';\n\nimport { cn } from '../../utils/cn';\n\nexport interface AuthBrandingProps {\n\tlogo?: React.ReactNode;\n\tappName?: string;\n\tshowLogo?: boolean;\n}\n\ninterface AuthScreenHeaderProps extends AuthBrandingProps {\n\ttitle: string;\n\tdescription?: string;\n\tclassName?: string;\n}\n\nexport function AuthScreenHeader({\n\ttitle,\n\tdescription,\n\tlogo,\n\tappName,\n\tshowLogo = true,\n\tclassName,\n}: AuthScreenHeaderProps) {\n\treturn (\n\t\t<div className={cn('space-y-4 text-center', className)}>\n\t\t\t{showLogo && logo ? (\n\t\t\t\t<div className='flex items-center justify-center'>{logo}</div>\n\t\t\t) : null}\n\t\t\t{appName ? (\n\t\t\t\t<span className='text-primary text-[15px] font-semibold tracking-tight'>{appName}</span>\n\t\t\t) : null}\n\n\t\t\t<div className='space-y-1.5'>\n\t\t\t\t<h2\n\t\t\t\t\tclassName='from-foreground via-foreground to-foreground/70 bg-linear-to-br bg-clip-text text-xl\n\t\t\t\t\t\tfont-semibold tracking-tight text-transparent'\n\t\t\t\t>\n\t\t\t\t\t{title}\n\t\t\t\t</h2>\n\t\t\t\t{description ? <p className='text-muted-foreground text-[13px] leading-relaxed'>{description}</p> : null}\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","import * as React from 'react';\nimport { useForm } from '@tanstack/react-form';\nimport { CheckCircleIcon } from 'lucide-react';\n\nimport { parseGraphQLError } from '../utils/auth-errors';\nimport { resetPasswordSchema } from '../utils/schemas';\nimport { Button } from '@constructive-io/ui/button';\n\nimport { AuthErrorAlert } from './auth-error-alert';\nimport { AuthLoadingButton } from './auth-loading-button';\nimport { AuthScreenHeader } from './auth-screen-header';\nimport { FormField } from './form-field';\nimport { PasswordStrength } from './password-strength';\n\nexport interface SheetsResetPasswordFormProps {\n\tresetToken: string;\n\troleId?: string;\n\tonResetPassword: (input: { newPassword: string; resetToken: string; roleId?: string }) => Promise<unknown>;\n\tonShowLogin?: () => void;\n}\n\nexport function SheetsResetPasswordForm({\n\tresetToken,\n\troleId,\n\tonResetPassword,\n\tonShowLogin,\n}: SheetsResetPasswordFormProps) {\n\tconst [error, setError] = React.useState<string | null>(null);\n\tconst [isSubmitting, setIsSubmitting] = React.useState(false);\n\tconst [isSuccess, setIsSuccess] = React.useState(false);\n\n\tconst form = useForm({\n\t\tdefaultValues: {\n\t\t\tpassword: '',\n\t\t\tconfirmPassword: '',\n\t\t\ttoken: resetToken,\n\t\t},\n\t\tonSubmit: async ({ value }) => {\n\t\t\tsetError(null);\n\t\t\tsetIsSubmitting(true);\n\n\t\t\ttry {\n\t\t\t\tconst validatedData = resetPasswordSchema.parse(value);\n\t\t\t\tawait onResetPassword({\n\t\t\t\t\tnewPassword: validatedData.password,\n\t\t\t\t\tresetToken: validatedData.token,\n\t\t\t\t\troleId,\n\t\t\t\t});\n\t\t\t\tsetIsSuccess(true);\n\t\t\t} catch (err) {\n\t\t\t\tsetError(parseGraphQLError(err).message);\n\t\t\t} finally {\n\t\t\t\tsetIsSubmitting(false);\n\t\t\t}\n\t\t},\n\t\tvalidators: {\n\t\t\tonChange: ({ value }) => {\n\t\t\t\tconst result = resetPasswordSchema.safeParse(value);\n\t\t\t\tif (!result.success) {\n\t\t\t\t\treturn result.error.issues.map((issue) => issue.message).join(', ');\n\t\t\t\t}\n\t\t\t\treturn undefined;\n\t\t\t},\n\t\t},\n\t});\n\n\tif (isSuccess) {\n\t\treturn (\n\t\t\t<div className='space-y-5 text-center'>\n\t\t\t\t<div className='flex justify-center'>\n\t\t\t\t\t<div className='bg-success/10 flex h-12 w-12 items-center justify-center rounded-full'>\n\t\t\t\t\t\t<CheckCircleIcon className='text-success h-6 w-6' />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className='space-y-1.5'>\n\t\t\t\t\t<h3 className='text-lg font-semibold'>Password reset successful</h3>\n\t\t\t\t\t<p className='text-muted-foreground text-sm'>\n\t\t\t\t\t\tYour password has been reset successfully. You can now sign in with your new password.\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t\t{onShowLogin && (\n\t\t\t\t\t<div className='pt-1'>\n\t\t\t\t\t\t<Button type='button' onClick={onShowLogin} className='w-full'>\n\t\t\t\t\t\t\tSign in\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className='space-y-5'>\n\t\t\t<AuthScreenHeader title='Set a new password' description='Enter your new password below' />\n\n\t\t\t<form\n\t\t\t\tonSubmit={(e) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\tform.handleSubmit();\n\t\t\t\t}}\n\t\t\t\tclassName='space-y-4 px-8'\n\t\t\t>\n\t\t\t\t<AuthErrorAlert error={error} />\n\t\t\t\t<form.Field\n\t\t\t\t\tname='password'\n\t\t\t\t\tvalidators={{\n\t\t\t\t\t\tonChange: ({ value }) => {\n\t\t\t\t\t\t\tif (!value) return 'Password is required';\n\t\t\t\t\t\t\tif (value.length < 8) return 'Password must be at least 8 characters';\n\t\t\t\t\t\t\tif (!/^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]/.test(value)) {\n\t\t\t\t\t\t\t\treturn 'Password must contain uppercase, lowercase, number, and special character';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{(field) => (\n\t\t\t\t\t\t<div className='space-y-2'>\n\t\t\t\t\t\t\t<FormField\n\t\t\t\t\t\t\t\tfield={field}\n\t\t\t\t\t\t\t\tlabel='New Password'\n\t\t\t\t\t\t\t\tplaceholder='Enter your new password'\n\t\t\t\t\t\t\t\ttype='password'\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PasswordStrength password={field.state.value} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</form.Field>\n\n\t\t\t\t<form.Field\n\t\t\t\t\tname='confirmPassword'\n\t\t\t\t\tvalidators={{\n\t\t\t\t\t\tonChange: ({ value }) => {\n\t\t\t\t\t\t\tif (!value) return 'Please confirm your password';\n\t\t\t\t\t\t\tconst password = form.getFieldValue('password');\n\t\t\t\t\t\t\tif (value !== password) return 'Passwords do not match';\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{(field) => (\n\t\t\t\t\t\t<FormField\n\t\t\t\t\t\t\tfield={field}\n\t\t\t\t\t\t\tlabel='Confirm New Password'\n\t\t\t\t\t\t\tplaceholder='Confirm your new password'\n\t\t\t\t\t\t\ttype='password'\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</form.Field>\n\n\t\t\t\t<div className='pt-2'>\n\t\t\t\t\t<AuthLoadingButton\n\t\t\t\t\t\ttype='submit'\n\t\t\t\t\t\tclassName='w-full'\n\t\t\t\t\t\tisLoading={isSubmitting}\n\t\t\t\t\t\tdisabled={!form.state.canSubmit || isSubmitting}\n\t\t\t\t\t\tdata-testid='auth-reset-submit'\n\t\t\t\t\t>\n\t\t\t\t\t\tReset Password\n\t\t\t\t\t</AuthLoadingButton>\n\t\t\t\t</div>\n\t\t\t</form>\n\n\t\t\t{onShowLogin && (\n\t\t\t\t<div className='text-muted-foreground text-center text-sm'>\n\t\t\t\t\tRemember your password?{' '}\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant='link'\n\t\t\t\t\t\tclassName='text-primary hover:text-primary/80 h-auto p-0 font-medium'\n\t\t\t\t\t\tonClick={onShowLogin}\n\t\t\t\t\t\ttype='button'\n\t\t\t\t\t>\n\t\t\t\t\t\tSign in\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n","/**\n * Custom validation functions for authentication forms\n */\n\n/**\n * Calculate password strength score (0-5)\n */\nexport function getPasswordStrength(password: string): number {\n\tlet score = 0;\n\n\t// Length check\n\tif (password.length >= 8) score++;\n\n\t// Character variety checks\n\tif (/[a-z]/.test(password)) score++;\n\tif (/[A-Z]/.test(password)) score++;\n\tif (/\\d/.test(password)) score++;\n\tif (/[@$!%*?&]/.test(password)) score++;\n\n\treturn score;\n}\n\n/**\n * Get password strength label\n */\nexport function getPasswordStrengthLabel(score: number): string {\n\tconst labels = ['Very Weak', 'Weak', 'Fair', 'Good', 'Strong'];\n\treturn labels[score - 1] || 'Very Weak';\n}\n\n/**\n * Get password strength color class\n */\nexport function getPasswordStrengthColor(score: number): string {\n\tconst colors = ['bg-red-500', 'bg-orange-500', 'bg-yellow-500', 'bg-blue-500', 'bg-green-500'];\n\treturn colors[score - 1] || 'bg-red-500';\n}\n\n/**\n * Validate email format (additional validation beyond zod)\n */\nexport function validateEmail(email: string): boolean {\n\tconst emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n\treturn emailRegex.test(email);\n}\n\n/**\n * Check if password meets minimum requirements\n */\nexport function isPasswordValid(password: string): boolean {\n\treturn getPasswordStrength(password) >= 3;\n}\n\n/**\n * Async email availability check (placeholder - integrate with your API)\n */\nexport async function checkEmailAvailability(email: string): Promise<boolean> {\n\t// Placeholder implementation - replace with actual API call\n\treturn new Promise((resolve) => {\n\t\tsetTimeout(() => {\n\t\t\t// Simulate API call\n\t\t\tconst unavailableEmails = ['admin@example.com', 'test@example.com'];\n\t\t\tresolve(!unavailableEmails.includes(email));\n\t\t}, 500);\n\t});\n}\n\n/**\n * Validate password confirmation\n */\nexport function validatePasswordConfirmation(password: string, confirmPassword: string): boolean {\n\treturn password === confirmPassword && password.length > 0;\n}\n","import { getPasswordStrength, getPasswordStrengthColor, getPasswordStrengthLabel } from '../utils/validators';\nimport { cn } from '../../utils/cn';\n\ninterface PasswordStrengthProps {\n\tpassword: string;\n\tclassName?: string;\n}\n\nexport function PasswordStrength({ password, className }: PasswordStrengthProps) {\n\tconst strength = getPasswordStrength(password);\n\tconst label = getPasswordStrengthLabel(strength);\n\tconst colorClass = getPasswordStrengthColor(strength);\n\n\t// Don't show anything if password is empty\n\tif (!password) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className={cn('space-y-2', className)}>\n\t\t\t<div className='flex space-x-1'>\n\t\t\t\t{[...Array(5)].map((_, i) => (\n\t\t\t\t\t<div key={i} className={cn('h-2 w-full rounded transition-colors', i < strength ? colorClass : 'bg-muted')} />\n\t\t\t\t))}\n\t\t\t</div>\n\t\t\t<p className='text-muted-foreground text-sm'>\n\t\t\t\tPassword strength:{' '}\n\t\t\t\t<span\n\t\t\t\t\tclassName={cn('font-medium', {\n\t\t\t\t\t\t'text-red-600': strength <= 2,\n\t\t\t\t\t\t'text-yellow-600': strength === 3,\n\t\t\t\t\t\t'text-blue-600': strength === 4,\n\t\t\t\t\t\t'text-green-600': strength === 5,\n\t\t\t\t\t})}\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t</span>\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n","import * as React from 'react';\n\nimport { cn } from '../../utils/cn';\nimport { Card, CardContent } from '@constructive-io/ui/card';\n\nimport type { AuthBrandingProps } from './auth-screen-header';\n\ntype AuthScreenLayoutFill = 'viewport' | 'parent';\n\nexport interface AuthScreenLayoutProps extends AuthBrandingProps {\n\tchildren: React.ReactNode;\n\tfill?: AuthScreenLayoutFill;\n\tclassName?: string;\n}\n\nexport function AuthScreenLayout({\n\tchildren,\n\tfill = 'parent',\n\tclassName,\n}: AuthScreenLayoutProps) {\n\treturn (\n\t\t<div\n\t\t\tclassName={cn(\n\t\t\t\t'bg-background relative flex flex-col',\n\t\t\t\tfill === 'viewport' ? 'min-h-dvh w-dvw' : 'h-full w-full',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t<div className='flex flex-1 items-center justify-center p-6'>\n\t\t\t\t<div className='relative z-10 w-full max-w-md'>\n\t\t\t\t\t<Card className='overflow-h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AAAA;AAAA,UACA,kBAAkB,CAAC,SAAS,uBAAuB,YAAY,IAAI;AAAA,UACnE,aAAa,MAAM,QAAQ,OAAO;AAAA;AAAA,MACnC;AAAA,MAEA,SAAS,WACT;AAAA,QAAC;AAAA;AAAA,UACA,YAAY,cAAc;AAAA,UAC1B;AAAA,UACA,iBAAiB,CAAC,UAAU,sBAAsB,YAAY,KAAK;AAAA,UACnE,aAAa,MAAM,QAAQ,OAAO;AAAA;AAAA,MACnC;AAAA,OAEF;AAAA,KACD;AAEF;","names":["import_react","import_react","useZustandStore","codeMatch","message","import_react_query","import_react_query","import_react_query","import_react","import_button","import_lucide_react","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_react","import_react_form","import_lucide_react","import_button","import_jsx_runtime","import_react","import_react_form","import_lucide_react","import_button","import_jsx_runtime","import_jsx_runtime","import_react_form","import_lucide_react","import_button","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../src/auth/index.ts","../src/auth/auth-gate.tsx","../src/context/sheets-context.ts","../src/store/sheets-store.ts","../src/auth/hooks/use-login.ts","../src/auth/utils/auth-errors.ts","../src/auth/utils/token-store.ts","../src/auth/auth-execute.ts","../src/auth/auth-types.ts","../src/auth/hooks/use-register.ts","../src/auth/hooks/use-forgot-password.ts","../src/auth/hooks/use-reset-password.ts","../src/auth/ui/login-form.tsx","../src/auth/utils/schemas.ts","../src/auth/ui/auth-error-alert.tsx","../src/utils/cn.ts","../src/auth/ui/auth-loading-button.tsx","../src/auth/ui/form-field.tsx","../src/auth/ui/register-form.tsx","../src/auth/ui/forgot-password-form.tsx","../src/auth/ui/auth-screen-header.tsx","../src/auth/ui/reset-password-form.tsx","../src/auth/utils/validators.ts","../src/auth/ui/password-strength.tsx","../src/auth/ui/auth-screen-layout.tsx"],"sourcesContent":["// =============================================================================\n// @constructive-io/sheets/auth — Standalone auth surface\n// =============================================================================\n// Subpath entry for consumers running Sheets in standalone (non-embedded) mode.\n// Re-exported from the root for back-compat; prefer importing from here.\n\nexport { SheetsAuthGate } from './auth-gate';\nexport type { SheetsAuthGateProps } from './auth-gate';\nexport { useSheetsLogin, useSheetsRegister, useSheetsForgotPassword, useSheetsResetPassword } from './hooks';\n","import { useState } from 'react';\n\nimport { useSheetsContext } from '../context/sheets-context';\nimport { useSheetsStore } from '../store/sheets-store';\nimport { useSheetsLogin } from './hooks/use-login';\nimport { useSheetsRegister } from './hooks/use-register';\nimport { useSheetsForgotPassword } from './hooks/use-forgot-password';\nimport { useSheetsResetPassword } from './hooks/use-reset-password';\nimport { SheetsLoginForm } from './ui/login-form';\nimport { SheetsRegisterForm } from './ui/register-form';\nimport { SheetsForgotPasswordForm } from './ui/forgot-password-form';\nimport { SheetsResetPasswordForm } from './ui/reset-password-form';\nimport { AuthScreenHeader, type AuthBrandingProps } from './ui/auth-screen-header';\nimport { AuthScreenLayout } from './ui/auth-screen-layout';\n\ntype AuthMode = 'login' | 'register' | 'forgot' | 'reset';\n\nconst AUTH_CONTENT: Record<AuthMode, { title: string; description: string }> = {\n\tlogin: {\n\t\ttitle: 'Welcome back',\n\t\tdescription: 'Sign in to your account',\n\t},\n\tregister: {\n\t\ttitle: 'Create an account',\n\t\tdescription: 'Get started with your free account',\n\t},\n\tforgot: {\n\t\ttitle: 'Reset your password',\n\t\tdescription: \"We'll send you a password reset link\",\n\t},\n\treset: {\n\t\ttitle: 'Set a new password',\n\t\tdescription: 'Enter your new password below',\n\t},\n} as const;\n\nexport interface SheetsAuthGateProps extends AuthBrandingProps {\n\tchildren: React.ReactNode;\n\tloginComponent?: React.ComponentType;\n\tresetToken?: string;\n\troleId?: string;\n}\n\nexport function SheetsAuthGate({\n\tchildren,\n\tloginComponent: CustomLoginComponent,\n\tresetToken,\n\troleId,\n\tlogo,\n\tappName,\n\tshowLogo,\n}: SheetsAuthGateProps) {\n\tconst { config } = useSheetsContext();\n\tconst isAuthenticated = useSheetsStore((s) => s.isAuthenticated);\n\n\t// Embedded mode: auth gate is transparent, always renders children\n\tif (config.auth.mode === 'embedded') {\n\t\treturn <>{children}</>;\n\t}\n\n\t// Standalone mode: check auth state\n\tif (isAuthenticated) {\n\t\treturn <>{children}</>;\n\t}\n\n\t// Not authenticated in standalone mode — show login UI\n\tif (CustomLoginComponent) {\n\t\treturn <CustomLoginComponent />;\n\t}\n\n\treturn (\n\t\t<StandaloneAuthUI\n\t\t\tresetToken={resetToken}\n\t\t\troleId={roleId}\n\t\t\tlogo={logo}\n\t\t\tappName={appName}\n\t\t\tshowLogo={showLogo}\n\t\t/>\n\t);\n}\n\ninterface StandaloneAuthUIProps extends AuthBrandingProps {\n\tresetToken?: string;\n\troleId?: string;\n}\n\nfunction StandaloneAuthUI({ resetToken, roleId, logo, appName, showLogo }: StandaloneAuthUIProps) {\n\tconst initialMode: AuthMode = resetToken ? 'reset' : 'login';\n\tconst [mode, setMode] = useState<AuthMode>(initialMode);\n\n\tconst loginMutation = useSheetsLogin();\n\tconst registerMutation = useSheetsRegister();\n\tconst forgotPasswordMutation = useSheetsForgotPassword();\n\tconst resetPasswordMutation = useSheetsResetPassword();\n\n\tconst { title, description } = AUTH_CONTENT[mode];\n\n\treturn (\n\t\t<AuthScreenLayout fill='parent' logo={logo} appName={appName} showLogo={showLogo}>\n\t\t\t<AuthScreenHeader\n\t\t\t\ttitle={title}\n\t\t\t\tdescription={description}\n\t\t\t\tlogo={logo}\n\t\t\t\tappName={appName}\n\t\t\t\tshowLogo={showLogo}\n\t\t\t/>\n\n\t\t\t<div>\n\t\t\t\t{mode === 'login' && (\n\t\t\t\t\t<SheetsLoginForm\n\t\t\t\t\t\tonLogin={(credentials) => loginMutation.mutateAsync(credentials).then(() => {})}\n\t\t\t\t\t\tonShowForgot={() => setMode('forgot')}\n\t\t\t\t\t\tonShowRegister={() => setMode('register')}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{mode === 'register' && (\n\t\t\t\t\t<SheetsRegisterForm\n\t\t\t\t\t\tonRegister={(data) => registerMutation.mutateAsync(data)}\n\t\t\t\t\t\tonShowLogin={() => setMode('login')}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{mode === 'forgot' && (\n\t\t\t\t\t<SheetsForgotPasswordForm\n\t\t\t\t\t\tonForgotPassword={(data) => forgotPasswordMutation.mutateAsync(data)}\n\t\t\t\t\t\tonShowLogin={() => setMode('login')}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{mode === 'reset' && (\n\t\t\t\t\t<SheetsResetPasswordForm\n\t\t\t\t\t\tresetToken={resetToken || ''}\n\t\t\t\t\t\troleId={roleId}\n\t\t\t\t\t\tonResetPassword={(input) => resetPasswordMutation.mutateAsync(input)}\n\t\t\t\t\t\tonShowLogin={() => setMode('login')}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</AuthScreenLayout>\n\t);\n}\n","import { createContext, useContext } from 'react';\nimport type { QueryClient } from '@tanstack/react-query';\n\nimport type { DisplayFieldOverrides } from '@constructive-io/data';\n\nimport type { SheetsExecuteFn, SheetsUploadFn } from './sheets-execute';\nimport type { SheetsLogger } from '../utils/sheets-logger';\nimport type { CellTypePlugin } from '../cell-types/define-cell-type';\nimport type { SheetsBackendAdapter } from '../adapter/sheets-adapter';\nimport type { SheetsUploadConfig } from '../uploads/upload-config';\nimport type { SheetsViewStorage } from '../grid/views/view-storage';\nimport type { SheetsMapConfig } from '../utils/map-settings';\n\nexport interface SheetsAuthEmbedded {\n\tmode: 'embedded';\n\tgetToken: () => string | null;\n\t/**\n\t * Stable, non-secret identity used to isolate cached data between users.\n\t * Hosts should return the authenticated user/session id, never the token.\n\t * When omitted, the provider uses an opaque key that changes with the token.\n\t */\n\tgetIdentityKey?: () => string | null;\n}\n\nexport interface SheetsAuthStandalone {\n\tmode: 'standalone';\n}\n\nexport interface SheetsStorageTransport {\n\tendpoint: string;\n\texecute: SheetsExecuteFn;\n}\n\nexport interface SheetsConfig {\n\t/** Data endpoint (app-public GraphQL) */\n\tendpoint: string;\n\t/** Auth endpoint (auth GraphQL) — required for standalone mode */\n\tauthEndpoint?: string;\n\t/** Database ID for multi-tenant scoping */\n\tdatabaseId?: string;\n\t/** Auth mode */\n\tauth: SheetsAuthEmbedded | SheetsAuthStandalone;\n\t/** Field type overrides (replaces schema-builder smart tags) */\n\tfieldTypeOverrides?: Record<string, string>;\n\t/**\n\t * Fields that label a record of a table (relation chips, pickers, record\n\t * titles), keyed by `TableModel.key` or table name, in priority order.\n\t * Tables without an entry use the built-in display rule.\n\t */\n\tdisplayFields?: DisplayFieldOverrides;\n\t/** Optional: BCP-47 locale for locale-aware date/number formatting (default 'en-US'). */\n\tlocale?: string;\n\t/**\n\t * The geometry editor's map: tile URL and attribution, and the place search endpoint.\n\t * Default: OpenStreetMap tiles and Nominatim search. `tiles: 'off'` edits shapes as\n\t * GeoJSON text; `placeSearch: 'off'` removes the search box. With a\n\t * Content-Security-Policy, allow the tile host in `img-src` and the search endpoint in\n\t * `connect-src`.\n\t */\n\tmap?: SheetsMapConfig;\n\t/** Optional: inject custom execute function */\n\texecute?: SheetsExecuteFn;\n\t/** Optional: inject custom upload function */\n\texecuteUpload?: SheetsUploadFn;\n\t/** Storage endpoint for media uploads and download URL lookups. */\n\tstorage?: { endpoint: string; execute?: SheetsExecuteFn };\n\t/** Upload choices (bucket, owner, files table, per-column overrides); every field is optional. */\n\tupload?: SheetsUploadConfig;\n\t/**\n\t * Where saved views are kept. Default: this browser's local storage, keyed by endpoint,\n\t * database, identity and table. A host can supply server storage.\n\t */\n\tviews?: SheetsViewStorage;\n\t/** Optional: inject existing QueryClient */\n\tqueryClient?: QueryClient;\n\t/** Optional: inject a custom backend adapter. Defaults to the PostGraphile adapter. */\n\tadapter?: SheetsBackendAdapter;\n\t/** Optional: provider-level cell-type plugins (consumer override layer). */\n\tplugins?: CellTypePlugin[];\n\t/** Called on 401/UNAUTHENTICATED before the error is thrown. Host app handles token cleanup. */\n\tonAuthError?: () => void;\n\t/** Optional: inject a custom logger. Installed into the module logger singleton by the provider. */\n\tlogger?: SheetsLogger;\n\t/** Optional: called when a grid/editor/mutation/upload error surfaces. Host app handles reporting. */\n\tonError?: (\n\t\terror: unknown,\n\t\tctx?: { source?: 'grid' | 'editor' | 'mutation' | 'upload'; tableName?: string },\n\t) => void;\n}\n\nexport interface SheetsContextValue {\n\tconfig: SheetsConfig;\n\texecute: SheetsExecuteFn;\n\texecuteUpload: SheetsUploadFn;\n\tstorage?: SheetsStorageTransport;\n\tcanUpload: boolean;\n\tscopeKey: SheetsScopeKey;\n}\n\nexport interface SheetsScopeKey {\n\tdatabaseId: string | null;\n\tendpoint: string;\n\tidentityKey: string | null;\n}\n\nexport const SheetsContext = createContext<SheetsContextValue | null>(null);\n\nexport function useSheetsContext(): SheetsContextValue {\n\tconst ctx = useContext(SheetsContext);\n\tif (!ctx) {\n\t\tthrow new Error('useSheetsContext must be used within a <SheetsProvider>');\n\t}\n\treturn ctx;\n}\n","import { createContext, useContext } from 'react';\nimport { createStore, useStore as useZustandStore, type StoreApi } from 'zustand';\n\nimport { createDraftRowsSlice, type DraftRowsSlice } from './draft-rows-slice';\n\nexport interface SheetsAuthState {\n isAuthenticated: boolean;\n accessToken: string | null;\n expiresAt: string | null;\n identityKey: string | null;\n setAuthenticated: (token: string, expiresAt: string, identityKey?: string | null) => void;\n setUnauthenticated: () => void;\n}\n\nexport type SheetsStoreState = DraftRowsSlice & SheetsAuthState;\n\nexport function createSheetsStore(): StoreApi<SheetsStoreState> {\n return createStore<SheetsStoreState>((set) => ({\n // Draft rows\n ...createDraftRowsSlice(set),\n\n // Auth state (standalone mode)\n isAuthenticated: false,\n accessToken: null,\n expiresAt: null,\n identityKey: null,\n setAuthenticated: (token: string, expiresAt: string, identityKey = null) =>\n set({ isAuthenticated: true, accessToken: token, expiresAt, identityKey }),\n setUnauthenticated: () => set({ isAuthenticated: false, accessToken: null, expiresAt: null, identityKey: null }),\n }));\n}\n\nexport const SheetsStoreContext = createContext<StoreApi<SheetsStoreState> | null>(null);\n\nexport function useSheetsStore<T>(selector: (state: SheetsStoreState) => T): T {\n const store = useContext(SheetsStoreContext);\n if (!store) {\n throw new Error('useSheetsStore must be used within a <SheetsProvider>');\n }\n return useZustandStore(store, selector);\n}\n\nexport function useSheetsStoreApi(): StoreApi<SheetsStoreState> {\n const store = useContext(SheetsStoreContext);\n if (!store) {\n throw new Error('useSheetsStoreApi must be used within a <SheetsProvider>');\n }\n return store;\n}\n","import { useMutation, useQueryClient } from '@tanstack/react-query';\n\nimport { createInvalidCredentialsError } from '../utils/auth-errors';\nimport type { LoginFormData } from '../utils/schemas';\nimport { useSheetsContext } from '../../context/sheets-context';\nimport { useSheetsStoreApi } from '../../store/sheets-store';\nimport { setStoredToken } from '../utils/token-store';\nimport { executeAuthMutation } from '../auth-execute';\nimport { toAuthToken, type SignInMutationResult, type SignInMutationVariables } from '../auth-types';\n\nconst SIGN_IN_MUTATION = /* GraphQL */ `\n\tmutation SignIn($input: SignInInput!) {\n\t\tsignIn(input: $input) {\n\t\t\tresult {\n\t\t\t\tid\n\t\t\t\tuserId\n\t\t\t\taccessToken\n\t\t\t\taccessTokenExpiresAt\n\t\t\t\tisVerified\n\t\t\t\ttotpEnabled\n\t\t\t}\n\t\t\tclientMutationId\n\t\t}\n\t}\n`;\n\nexport function useSheetsLogin() {\n\tconst queryClient = useQueryClient();\n\tconst { config } = useSheetsContext();\n\tconst storeApi = useSheetsStoreApi();\n\n\treturn useMutation({\n\t\tmutationKey: ['sheets', 'auth', 'signIn'],\n\t\tmutationFn: async (credentials: LoginFormData) => {\n\t\t\tconst result = await executeAuthMutation<SignInMutationResult>(\n\t\t\t\tconfig,\n\t\t\t\tSIGN_IN_MUTATION,\n\t\t\t\t{\n\t\t\t\t\tinput: {\n\t\t\t\t\t\temail: credentials.email,\n\t\t\t\t\t\tpassword: credentials.password,\n\t\t\t\t\t\trememberMe: credentials.rememberMe,\n\t\t\t\t\t},\n\t\t\t\t} satisfies SignInMutationVariables,\n\t\t\t);\n\n\t\t\tconst signInResult = result.signIn?.result;\n\t\t\tif (!signInResult) {\n\t\t\t\tthrow createInvalidCredentialsError();\n\t\t\t}\n\n\t\t\tconst token = toAuthToken(signInResult);\n\t\t\tif (!token) {\n\t\t\t\tthrow createInvalidCredentialsError();\n\t\t\t}\n\n\t\t\treturn { token, email: credentials.email, identityKey: signInResult.userId };\n\t\t},\n\t\tonSuccess: ({ token, identityKey }) => {\n\t\t\tconst databaseId = config.databaseId || 'default';\n\t\t\tsetStoredToken(databaseId, token.accessToken, token.expiresAt, identityKey);\n\t\t\tstoreApi.getState().setAuthenticated(token.accessToken, token.expiresAt, identityKey);\n\t\t\tqueryClient.invalidateQueries({ queryKey: ['sheets'] });\n\t\t},\n\t});\n}\n","/**\n * Auth Error Handling\n *\n * Centralized error code mapping and parsing for auth forms.\n * Handles GraphQL errors, validation errors (Zod-like), and custom AuthErrors.\n *\n * Backend error codes handled:\n * - INCORRECT_PASSWORD: Wrong password\n * - PASSWORD_INSECURE: Password doesn't meet security requirements\n * - ACCOUNT_LOCKED_EXCEED_ATTEMPTS: Too many failed login attempts\n * - ACCOUNT_DISABLED: Account has been disabled\n * - ACCOUNT_EXISTS: Email already registered\n * - PASSWORD_LEN: Password length invalid (must be 8-63 characters)\n * - INVITE_NOT_FOUND: Invitation code not found\n * - INVITE_LIMIT: Invitation usage limit reached\n * - INVITE_EMAIL_NOT_FOUND: Email not associated with invitation\n */\n\n// ============================================================================\n// Error Code Constants\n// ============================================================================\n\n/**\n * Known backend error codes.\n * These codes are returned in GraphQL error extensions.\n */\nexport const ERROR_CODES = {\n\t// Auth errors - login\n\tINVALID_CREDENTIALS: 'INVALID_CREDENTIALS', // Generic - prevents user enumeration\n\tINCORRECT_PASSWORD: 'INCORRECT_PASSWORD',\n\tACCOUNT_LOCKED_EXCEED_ATTEMPTS: 'ACCOUNT_LOCKED_EXCEED_ATTEMPTS',\n\tACCOUNT_DISABLED: 'ACCOUNT_DISABLED',\n\n\t// Password validation errors\n\tPASSWORD_INSECURE: 'PASSWORD_INSECURE',\n\tPASSWORD_LEN: 'PASSWORD_LEN',\n\n\t// Registration errors\n\tACCOUNT_EXISTS: 'ACCOUNT_EXISTS',\n\n\t// Invitation errors\n\tINVITE_NOT_FOUND: 'INVITE_NOT_FOUND',\n\tINVITE_LIMIT: 'INVITE_LIMIT',\n\tINVITE_EMAIL_NOT_FOUND: 'INVITE_EMAIL_NOT_FOUND',\n} as const;\n\nexport type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];\n\n// ============================================================================\n// User-Friendly Error Messages\n// ============================================================================\n\n/**\n * User-friendly error messages for each error code.\n * These messages are shown to users in the UI.\n */\nexport const ERROR_MESSAGES: Record<ErrorCode, string> = {\n\t[ERROR_CODES.INVALID_CREDENTIALS]: 'Invalid email or password.',\n\t[ERROR_CODES.INCORRECT_PASSWORD]: 'The password you entered is incorrect. Please try again.',\n\t[ERROR_CODES.ACCOUNT_LOCKED_EXCEED_ATTEMPTS]:\n\t\t'Your account has been temporarily locked due to too many failed login attempts. Please try again later or reset your password.',\n\t[ERROR_CODES.ACCOUNT_DISABLED]:\n\t\t'Your account has been disabled. Please contact support for assistance.',\n\t[ERROR_CODES.PASSWORD_INSECURE]:\n\t\t'This password is not secure enough. Please choose a stronger password.',\n\t[ERROR_CODES.PASSWORD_LEN]: 'Password must be between 8 and 63 characters long.',\n\t[ERROR_CODES.ACCOUNT_EXISTS]:\n\t\t'An account with this email already exists. Please sign in or use a different email.',\n\t[ERROR_CODES.INVITE_NOT_FOUND]:\n\t\t'The invitation code is invalid or has expired. Please check the code or request a new invitation.',\n\t[ERROR_CODES.INVITE_LIMIT]:\n\t\t'This invitation has reached its usage limit. Please request a new invitation.',\n\t[ERROR_CODES.INVITE_EMAIL_NOT_FOUND]:\n\t\t'This email is not associated with the invitation. Please use the email address the invitation was sent to.',\n};\n\n/**\n * Generic fallback message when no specific error code is matched.\n */\nexport const DEFAULT_ERROR_MESSAGE = 'Something went wrong. Please try again.';\n\n// ============================================================================\n// AuthError Class\n// ============================================================================\n\n/**\n * Custom error class for authentication errors.\n * Provides typed error codes that map to user-friendly messages.\n *\n * @example\n * ```ts\n * // Throw with a known error code\n * throw new AuthError('INVALID_CREDENTIALS');\n *\n * // Throw with custom message override\n * throw new AuthError('ACCOUNT_DISABLED', 'Your account has been suspended.');\n *\n * // In catch block, get user-friendly message\n * catch (err) {\n * if (err instanceof AuthError) {\n * setError(err.userMessage);\n * }\n * }\n * ```\n */\nexport class AuthError extends Error {\n\tpublic readonly code: ErrorCode;\n\tpublic readonly userMessage: string;\n\n\tconstructor(code: ErrorCode, customMessage?: string) {\n\t\tconst userMessage = customMessage ?? ERROR_MESSAGES[code];\n\t\tsuper(userMessage);\n\t\tthis.name = 'AuthError';\n\t\tthis.code = code;\n\t\tthis.userMessage = userMessage;\n\n\t\tif (Error.captureStackTrace) {\n\t\t\tError.captureStackTrace(this, AuthError);\n\t\t}\n\t}\n\n\t/**\n\t * Check if an error is an AuthError with a specific code.\n\t */\n\tstatic isCode(error: unknown, code: ErrorCode): error is AuthError {\n\t\treturn error instanceof AuthError && error.code === code;\n\t}\n}\n\n/**\n * Create an AuthError for invalid credentials.\n * Use this when login fails due to null token response.\n * The generic message prevents user enumeration attacks.\n */\nexport function createInvalidCredentialsError(): AuthError {\n\treturn new AuthError('INVALID_CREDENTIALS');\n}\n\n// ============================================================================\n// Configuration\n// ============================================================================\n\n/**\n * Options for parseGraphQLError.\n */\nexport interface ParseGraphQLErrorOptions {\n\t/**\n\t * Custom fallback message when no known error code is matched.\n\t * Defaults to DEFAULT_ERROR_MESSAGE.\n\t */\n\tdefaultMessage?: string;\n\n\t/**\n\t * Custom error code to message mapping to extend or override defaults.\n\t * Merged with ERROR_MESSAGES (custom takes precedence).\n\t */\n\tcustomMessages?: Record<string, string>;\n}\n\n// ============================================================================\n// Error Parsing Utilities\n// ============================================================================\n\n/**\n * Shape of a GraphQL error with extensions.\n */\ninterface GraphQLErrorLike {\n\tmessage?: string;\n\textensions?: {\n\t\tcode?: string;\n\t\t[key: string]: unknown;\n\t};\n}\n\n/**\n * Check if a value looks like a GraphQL error object.\n */\nfunction isGraphQLErrorLike(value: unknown): value is GraphQLErrorLike {\n\tif (!value || typeof value !== 'object') return false;\n\treturn 'message' in value || 'extensions' in value;\n}\n\n/**\n * Shape of a validation error (Zod-like).\n * Detected by duck typing to avoid tight coupling to Zod.\n */\ninterface ValidationErrorLike {\n\tname: string;\n\tissues: Array<{ message: string; path?: (string | number)[] }>;\n}\n\n/**\n * Check if a value looks like a Zod validation error.\n * Uses duck typing (name + issues array) for portability.\n */\nfunction isValidationError(value: unknown): value is ValidationErrorLike {\n\tif (!value || typeof value !== 'object') return false;\n\tconst err = value as Record<string, unknown>;\n\treturn (\n\t\terr.name === 'ZodError' &&\n\t\tArray.isArray(err.issues) &&\n\t\terr.issues.length > 0 &&\n\t\ttypeof err.issues[0]?.message === 'string'\n\t);\n}\n\n/**\n * Extract error code from various error formats.\n *\n * Checks (in order):\n * 1. AuthError instance (has typed code)\n * 2. error.extensions.code (GraphQL error format)\n * 3. error.code (generic error format)\n * 4. Error code embedded in message (e.g., \"Error (Code: ACCOUNT_EXISTS)\")\n * 5. Direct code match in error message (e.g., \"ACCOUNT_EXISTS\")\n */\nfunction extractErrorCode(error: unknown, knownCodes: string[]): string | null {\n\t// Handle AuthError instances\n\tif (error instanceof AuthError) {\n\t\treturn error.code;\n\t}\n\n\t// Handle GraphQLRequestError (has .errors array with GraphQL error objects)\n\tif (error && typeof error === 'object' && 'errors' in error) {\n\t\tconst gqlErrors = (error as { errors: Array<{ message?: string; extensions?: Record<string, unknown> }> })\n\t\t\t.errors;\n\t\tif (Array.isArray(gqlErrors) && gqlErrors.length > 0) {\n\t\t\tconst firstError = gqlErrors[0];\n\t\t\tif (firstError.extensions?.code) return String(firstError.extensions.code);\n\t\t\tif (firstError.message) {\n\t\t\t\tconst codeMatch = firstError.message.match(/\\(\\s*[Cc]ode:\\s*([A-Z_]+)\\s*\\)/);\n\t\t\t\tif (codeMatch) return codeMatch[1];\n\t\t\t\tfor (const code of knownCodes) {\n\t\t\t\t\tif (firstError.message.includes(code)) return code;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Handle GraphQL error with extensions\n\tif (isGraphQLErrorLike(error) && error.extensions?.code) {\n\t\treturn String(error.extensions.code);\n\t}\n\n\t// Handle error object with code property\n\tif (error && typeof error === 'object' && 'code' in error) {\n\t\tconst code = (error as { code: unknown }).code;\n\t\tif (typeof code === 'string') return code;\n\t}\n\n\t// Extract message for pattern matching\n\tlet message: string | null = null;\n\tif (error instanceof Error) {\n\t\tmessage = error.message;\n\t} else if (isGraphQLErrorLike(error) && error.message) {\n\t\tmessage = error.message;\n\t} else if (typeof error === 'string') {\n\t\tmessage = error;\n\t}\n\n\tif (!message) return null;\n\n\t// Try to extract code from message pattern: \"(Code: ERROR_CODE)\"\n\tconst codeMatch = message.match(/\\(\\s*[Cc]ode:\\s*([A-Z_]+)\\s*\\)/);\n\tif (codeMatch) {\n\t\treturn codeMatch[1];\n\t}\n\n\t// Check if any known error code appears in the message\n\tfor (const code of knownCodes) {\n\t\tif (message.includes(code)) {\n\t\t\treturn code;\n\t\t}\n\t}\n\n\treturn null;\n}\n\n/**\n * Check if an error code is a known error code.\n */\nexport function isKnownErrorCode(code: string | null): code is ErrorCode {\n\tif (!code) return false;\n\treturn Object.values(ERROR_CODES).includes(code as ErrorCode);\n}\n\n/**\n * Get the user-friendly message for an error code.\n */\nexport function getErrorMessage(code: ErrorCode): string {\n\treturn ERROR_MESSAGES[code];\n}\n\n/**\n * Check if a message looks like technical/internal error (not user-friendly).\n */\nfunction isTechnicalMessage(message: string): boolean {\n\tconst lower = message.toLowerCase();\n\treturn (\n\t\tlower.includes('graphql') ||\n\t\tlower.includes('fetch') ||\n\t\tlower.includes('network') ||\n\t\tlower.includes('econnrefused') ||\n\t\tlower.includes('undefined') ||\n\t\tlower.includes('null') ||\n\t\tlower.includes('timeout') ||\n\t\tlower.includes('connection') ||\n\t\tlower.includes('socket') ||\n\t\tlower.includes('enotfound') ||\n\t\tlower.includes('abort')\n\t);\n}\n\n// ============================================================================\n// Main Parse Function\n// ============================================================================\n\n/**\n * Result of parsing a GraphQL error.\n */\nexport interface ParsedGraphQLError {\n\t/** The extracted error code, if any */\n\tcode: string | null;\n\t/** User-friendly error message */\n\tmessage: string;\n\t/** Whether a known error code was found */\n\tisKnownError: boolean;\n\t/** Original error for debugging */\n\toriginalError: unknown;\n}\n\n/**\n * Parse a GraphQL error and return a user-friendly message.\n *\n * This function:\n * 1. Extracts the error code from various error formats\n * 2. Maps known codes to user-friendly messages\n * 3. Falls back to generic message for unknown/technical errors\n *\n * @param error - The error to parse (can be Error, GraphQL error, string, etc.)\n * @param options - Optional configuration for custom messages\n * @returns ParsedGraphQLError with code, message, and metadata\n *\n * @example\n * ```ts\n * // Basic usage\n * const { message } = parseGraphQLError(error);\n * setError(message);\n *\n * // With custom default message\n * const { message } = parseGraphQLError(error, {\n * defaultMessage: 'Unable to sign in. Please try again.'\n * });\n *\n * // With custom error code mappings\n * const { message } = parseGraphQLError(error, {\n * customMessages: {\n * 'CUSTOM_ERROR': 'A custom error occurred.',\n * }\n * });\n * ```\n */\nexport function parseGraphQLError(\n\terror: unknown,\n\toptions: ParseGraphQLErrorOptions = {}\n): ParsedGraphQLError {\n\t// Fast path for AuthError - already has user-friendly message\n\tif (error instanceof AuthError) {\n\t\treturn {\n\t\t\tcode: error.code,\n\t\t\tmessage: error.userMessage,\n\t\t\tisKnownError: true,\n\t\t\toriginalError: error,\n\t\t};\n\t}\n\n\t// Handle validation errors (Zod-like) - detect by shape, not import\n\t// This keeps the module portable without tight coupling to Zod\n\tif (isValidationError(error)) {\n\t\t// Get the first error message (most relevant for form validation)\n\t\tconst firstIssue = error.issues[0];\n\t\tconst message = firstIssue?.message || 'Validation failed. Please check your input.';\n\t\treturn {\n\t\t\tcode: 'VALIDATION_ERROR',\n\t\t\tmessage,\n\t\t\tisKnownError: true,\n\t\t\toriginalError: error,\n\t\t};\n\t}\n\n\tconst { defaultMessage = DEFAULT_ERROR_MESSAGE, customMessages = {} } = options;\n\n\t// Merge custom messages with defaults (custom takes precedence)\n\tconst allMessages: Record<string, string> = { ...ERROR_MESSAGES, ...customMessages };\n\tconst allKnownCodes = Object.keys(allMessages);\n\n\tconst code = extractErrorCode(error, allKnownCodes);\n\tconst isKnown = code !== null && code in allMessages;\n\n\tlet message: string;\n\tif (isKnown && code) {\n\t\tmessage = allMessages[code];\n\t} else {\n\t\t// Use error message if available and not technical\n\t\tif (error instanceof Error && error.message && !isTechnicalMessage(error.message)) {\n\t\t\tmessage = error.message;\n\t\t} else if (\n\t\t\terror instanceof Error &&\n\t\t\tisTechnicalMessage(error.message) &&\n\t\t\t'errors' in error &&\n\t\t\tArray.isArray((error as { errors: unknown[] }).errors)\n\t\t) {\n\t\t\t// Extract user-friendly message from GraphQLRequestError's inner errors\n\t\t\tconst innerMsg = (\n\t\t\t\t(error as { errors: Array<{ message?: string }> }).errors[0] as { message?: string } | undefined\n\t\t\t)?.message;\n\t\t\tmessage = innerMsg && !isTechnicalMessage(innerMsg) ? innerMsg : defaultMessage;\n\t\t} else {\n\t\t\tmessage = defaultMessage;\n\t\t}\n\t}\n\n\treturn {\n\t\tcode: isKnown ? code : null,\n\t\tmessage,\n\t\tisKnownError: isKnown,\n\t\toriginalError: error,\n\t};\n}\n","const KEY_PREFIX = 'sheets-auth-token';\n\nfunction storageKey(databaseId: string): string {\n\treturn `${KEY_PREFIX}:${databaseId}`;\n}\n\nfunction getStorage(): Storage | null {\n\tif (typeof window === 'undefined') return null;\n\ttry {\n\t\treturn window.localStorage;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport interface StoredToken {\n\taccessToken: string;\n\texpiresAt: string;\n\tidentityKey?: string | null;\n}\n\nexport function getStoredToken(databaseId: string): StoredToken | null {\n\tconst storage = getStorage();\n\tif (!storage) return null;\n\n\ttry {\n\t\tconst raw = storage.getItem(storageKey(databaseId));\n\t\tif (!raw) return null;\n\t\tconst parsed = JSON.parse(raw) as StoredToken;\n\t\tif (!parsed.accessToken || !parsed.expiresAt) return null;\n\t\tif (parsed.identityKey != null && typeof parsed.identityKey !== 'string') return null;\n\t\treturn parsed;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function setStoredToken(\n\tdatabaseId: string,\n\taccessToken: string,\n\texpiresAt: string,\n\tidentityKey?: string | null,\n): void {\n\tconst storage = getStorage();\n\tif (!storage) return;\n\n\ttry {\n\t\tconst data: StoredToken = { accessToken, expiresAt, identityKey };\n\t\tstorage.setItem(storageKey(databaseId), JSON.stringify(data));\n\t} catch {\n\t\t// Silently fail — localStorage might be full or unavailable\n\t}\n}\n\nexport function clearStoredToken(databaseId: string): void {\n\tconst storage = getStorage();\n\tif (!storage) return;\n\n\ttry {\n\t\tstorage.removeItem(storageKey(databaseId));\n\t} catch {\n\t\t// Silently fail\n\t}\n}\n","import type { SheetsConfig } from '../context/sheets-context';\n\n/**\n * Execute a GraphQL mutation against the auth endpoint.\n * Falls back to the data endpoint if authEndpoint is not configured.\n */\nexport async function executeAuthMutation<TResult = unknown>(\n\tconfig: SheetsConfig,\n\tquery: string,\n\tvariables?: Record<string, unknown>,\n): Promise<TResult> {\n\tconst url = config.authEndpoint || config.endpoint;\n\tif (!url) {\n\t\tthrow new Error('No auth endpoint configured.');\n\t}\n\n\tconst headers: Record<string, string> = {\n\t\t'Content-Type': 'application/json',\n\t\tAccept: 'application/graphql-response+json',\n\t};\n\n\tlet response: Response;\n\ttry {\n\t\tresponse = await fetch(url, {\n\t\t\tmethod: 'POST',\n\t\t\theaders,\n\t\t\tbody: JSON.stringify({\n\t\t\t\tquery,\n\t\t\t\t...(variables !== undefined && { variables }),\n\t\t\t}),\n\t\t});\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Network error: ${error instanceof Error ? error.message : 'Failed to connect to auth endpoint'}`,\n\t\t);\n\t}\n\n\tif (!response.ok) {\n\t\tconst { status, statusText } = response;\n\t\ttry {\n\t\t\tconst body = await response.json();\n\t\t\tif (body.errors?.length) {\n\t\t\t\tconst firstError = body.errors[0];\n\t\t\t\tconst err = new Error(firstError.message || `Auth request failed: ${status}`);\n\t\t\t\t(err as any).code = firstError.extensions?.code;\n\t\t\t\t(err as any).errors = body.errors;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (e instanceof Error && (e as any).errors) throw e;\n\t\t}\n\t\tthrow new Error(`Auth request failed: ${status} ${statusText}`);\n\t}\n\n\tconst result = await response.json();\n\n\tif (result.errors?.length) {\n\t\tconst firstError = result.errors[0];\n\t\tconst err = new Error(firstError.message || 'Auth mutation failed');\n\t\t(err as any).code = firstError.extensions?.code;\n\t\t(err as any).errors = result.errors;\n\t\tthrow err;\n\t}\n\n\treturn result.data as TResult;\n}\n","// ============================================================================\n// Auth Result Types\n// ============================================================================\n\nexport interface AuthResultRecord {\n\tid: string;\n\tuserId: string;\n\taccessToken: string;\n\taccessTokenExpiresAt: string;\n\tisVerified?: boolean | null;\n\ttotpEnabled?: boolean | null;\n}\n\n// ============================================================================\n// Generic Helper\n// ============================================================================\n\nexport type MutationVariables<TInput> = { input: TInput };\n\n// ============================================================================\n// SignIn Mutation\n// ============================================================================\n\nexport interface SignInInput {\n\temail: string;\n\tpassword: string;\n\trememberMe?: boolean;\n}\n\nexport type SignInMutationVariables = MutationVariables<SignInInput>;\n\nexport interface SignInMutationResult {\n\tsignIn?: {\n\t\tresult?: AuthResultRecord | null;\n\t\tclientMutationId?: string | null;\n\t} | null;\n}\n\n// ============================================================================\n// SignUp Mutation\n// ============================================================================\n\nexport interface SignUpInput {\n\temail: string;\n\tpassword: string;\n}\n\nexport type SignUpMutationVariables = MutationVariables<SignUpInput>;\n\nexport interface SignUpMutationResult {\n\tsignUp?: {\n\t\tclientMutationId?: string | null;\n\t} | null;\n}\n\n// ============================================================================\n// Forgot Password Mutation\n// ============================================================================\n\nexport interface ForgotPasswordInput {\n\temail: string;\n}\n\nexport type ForgotPasswordMutationVariables = MutationVariables<ForgotPasswordInput>;\n\nexport interface ForgotPasswordMutationResult {\n\tforgotPassword?: {\n\t\tclientMutationId?: string | null;\n\t} | null;\n}\n\n// ============================================================================\n// Reset Password Mutation\n// ============================================================================\n\nexport interface ResetPasswordInput {\n\tnewPassword: string;\n\tresetToken: string;\n\troleId?: string;\n}\n\nexport type ResetPasswordMutationVariables = MutationVariables<ResetPasswordInput>;\n\nexport interface ResetPasswordMutationResult {\n\tresetPassword?: {\n\t\tresult?: boolean | null;\n\t\tclientMutationId?: string | null;\n\t} | null;\n}\n\n// ============================================================================\n// Token Helper\n// ============================================================================\n\nexport function toAuthToken(record: AuthResultRecord | null | undefined): { accessToken: string; expiresAt: string } | null {\n\tif (!record?.accessToken || !record?.accessTokenExpiresAt) {\n\t\treturn null;\n\t}\n\treturn {\n\t\taccessToken: record.accessToken,\n\t\texpiresAt: record.accessTokenExpiresAt,\n\t};\n}\n","import { useMutation, useQueryClient } from '@tanstack/react-query';\n\nimport type { RegisterFormData } from '../utils/schemas';\nimport { useSheetsContext } from '../../context/sheets-context';\nimport { useSheetsStoreApi } from '../../store/sheets-store';\nimport { executeAuthMutation } from '../auth-execute';\nimport { type SignUpMutationResult, type SignUpMutationVariables } from '../auth-types';\n\nconst SIGN_UP_MUTATION = /* GraphQL */ `\n\tmutation SignUp($input: SignUpInput!) {\n\t\tsignUp(input: $input) {\n\t\t\tclientMutationId\n\t\t}\n\t}\n`;\n\nexport function useSheetsRegister() {\n\tconst queryClient = useQueryClient();\n\tconst { config } = useSheetsContext();\n\tconst storeApi = useSheetsStoreApi();\n\n\treturn useMutation({\n\t\tmutationKey: ['sheets', 'auth', 'signUp'],\n\t\tmutationFn: async (formData: RegisterFormData) => {\n\t\t\t// sign_up never signs anyone in: the address is mailed a link that does\n\t\t\tawait executeAuthMutation<SignUpMutationResult>(\n\t\t\t\tconfig,\n\t\t\t\tSIGN_UP_MUTATION,\n\t\t\t\t{\n\t\t\t\t\tinput: {\n\t\t\t\t\t\temail: formData.email,\n\t\t\t\t\t\tpassword: formData.password,\n\t\t\t\t\t},\n\t\t\t\t} satisfies SignUpMutationVariables,\n\t\t\t);\n\n\t\t\treturn { email: formData.email };\n\t\t},\n\t\tonSuccess: () => {\n\t\t\tqueryClient.invalidateQueries({ queryKey: ['sheets'] });\n\t\t},\n\t\tonError: () => {\n\t\t\tstoreApi.getState().setUnauthenticated();\n\t\t},\n\t});\n}\n","import { useMutation } from '@tanstack/react-query';\n\nimport { useSheetsContext } from '../../context/sheets-context';\nimport { executeAuthMutation } from '../auth-execute';\nimport type { ForgotPasswordMutationResult, ForgotPasswordMutationVariables } from '../auth-types';\n\nconst FORGOT_PASSWORD_MUTATION = /* GraphQL */ `\n\tmutation ForgotPassword($input: ForgotPasswordInput!) {\n\t\tforgotPassword(input: $input) {\n\t\t\tclientMutationId\n\t\t}\n\t}\n`;\n\nexport function useSheetsForgotPassword() {\n\tconst { config } = useSheetsContext();\n\n\treturn useMutation({\n\t\tmutationKey: ['sheets', 'auth', 'forgotPassword'],\n\t\tmutationFn: async ({ email }: { email: string }) => {\n\t\t\tawait executeAuthMutation<ForgotPasswordMutationResult>(\n\t\t\t\tconfig,\n\t\t\t\tFORGOT_PASSWORD_MUTATION,\n\t\t\t\t{\n\t\t\t\t\tinput: { email },\n\t\t\t\t} satisfies ForgotPasswordMutationVariables,\n\t\t\t);\n\t\t\treturn { email };\n\t\t},\n\t});\n}\n","import { useMutation, useQueryClient } from '@tanstack/react-query';\n\nimport { useSheetsContext } from '../../context/sheets-context';\nimport { executeAuthMutation } from '../auth-execute';\nimport type { ResetPasswordInput, ResetPasswordMutationResult, ResetPasswordMutationVariables } from '../auth-types';\n\nconst RESET_PASSWORD_MUTATION = /* GraphQL */ `\n\tmutation ResetPassword($input: ResetPasswordInput!) {\n\t\tresetPassword(input: $input) {\n\t\t\tresult\n\t\t\tclientMutationId\n\t\t}\n\t}\n`;\n\nexport function useSheetsResetPassword() {\n\tconst queryClient = useQueryClient();\n\tconst { config } = useSheetsContext();\n\n\treturn useMutation({\n\t\tmutationKey: ['sheets', 'auth', 'resetPassword'],\n\t\tmutationFn: async (input: ResetPasswordInput) => {\n\t\t\tconst result = await executeAuthMutation<ResetPasswordMutationResult>(\n\t\t\t\tconfig,\n\t\t\t\tRESET_PASSWORD_MUTATION,\n\t\t\t\t{\n\t\t\t\t\tinput: {\n\t\t\t\t\t\tnewPassword: input.newPassword,\n\t\t\t\t\t\tresetToken: input.resetToken,\n\t\t\t\t\t\troleId: input.roleId,\n\t\t\t\t\t},\n\t\t\t\t} satisfies ResetPasswordMutationVariables,\n\t\t\t);\n\n\t\t\tif (!result.resetPassword?.result) {\n\t\t\t\tthrow new Error('Failed to reset password. The link may have expired.');\n\t\t\t}\n\n\t\t\treturn { success: true };\n\t\t},\n\t\tonSuccess: () => {\n\t\t\tqueryClient.invalidateQueries({ queryKey: ['sheets'] });\n\t\t},\n\t});\n}\n","import { useRef, useState } from 'react';\nimport { useForm } from '@tanstack/react-form';\n\nimport { parseGraphQLError } from '../utils/auth-errors';\nimport type { LoginFormData } from '../utils/schemas';\nimport { loginSchema } from '../utils/schemas';\nimport { Button } from '@constructive-io/ui/button';\nimport { Checkbox } from '@constructive-io/ui/checkbox';\n\nimport { AuthErrorAlert } from './auth-error-alert';\nimport { AuthLoadingButton } from './auth-loading-button';\nimport { FormField } from './form-field';\n\nexport interface SheetsLoginFormProps {\n\tonLogin: (credentials: LoginFormData) => Promise<void>;\n\tonShowForgot?: () => void;\n\tonShowRegister?: () => void;\n\tdefaultEmail?: string;\n}\n\nexport function SheetsLoginForm({ onLogin, onShowForgot, onShowRegister, defaultEmail = '' }: SheetsLoginFormProps) {\n\tconst [error, setError] = useState<string | null>(null);\n\tconst [isSubmitting, setIsSubmitting] = useState(false);\n\tconst passwordInputRef = useRef<HTMLInputElement>(null);\n\n\tconst form = useForm({\n\t\tdefaultValues: {\n\t\t\temail: defaultEmail,\n\t\t\tpassword: '',\n\t\t\trememberMe: true,\n\t\t},\n\t\tonSubmit: async ({ value }) => {\n\t\t\tsetError(null);\n\t\t\tsetIsSubmitting(true);\n\n\t\t\ttry {\n\t\t\t\tconst validatedData = loginSchema.parse(value);\n\t\t\t\tawait onLogin(validatedData);\n\t\t\t} catch (err) {\n\t\t\t\tsetError(parseGraphQLError(err).message);\n\t\t\t} finally {\n\t\t\t\tsetIsSubmitting(false);\n\t\t\t}\n\t\t},\n\t\tvalidators: {\n\t\t\tonChange: ({ value }) => {\n\t\t\t\tconst result = loginSchema.safeParse(value);\n\t\t\t\tif (!result.success) {\n\t\t\t\t\treturn result.error.issues.map((issue) => issue.message).join(', ');\n\t\t\t\t}\n\t\t\t\treturn undefined;\n\t\t\t},\n\t\t},\n\t});\n\n\treturn (\n\t\t<div className='space-y-5'>\n\t\t\t<form\n\t\t\t\tonSubmit={(e) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\tform.handleSubmit();\n\t\t\t\t}}\n\t\t\t\tclassName='space-y-4 px-8'\n\t\t\t>\n\t\t\t\t<AuthErrorAlert error={error} />\n\t\t\t\t<form.Field\n\t\t\t\t\tname='email'\n\t\t\t\t\tvalidators={{\n\t\t\t\t\t\tonChange: ({ value }) => {\n\t\t\t\t\t\t\tif (!value) return 'Email is required';\n\t\t\t\t\t\t\tif (!/\\S+@\\S+\\.\\S+/.test(value)) return 'Please enter a valid email';\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{(field) => (\n\t\t\t\t\t\t<FormField\n\t\t\t\t\t\t\tfield={field}\n\t\t\t\t\t\t\tlabel='Email'\n\t\t\t\t\t\t\tplaceholder='Enter your email'\n\t\t\t\t\t\t\ttype='email'\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</form.Field>\n\n\t\t\t\t<form.Field\n\t\t\t\t\tname='password'\n\t\t\t\t\tvalidators={{\n\t\t\t\t\t\tonChange: ({ value }) => {\n\t\t\t\t\t\t\tif (!value) return 'Password is required';\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{(field) => (\n\t\t\t\t\t\t<FormField\n\t\t\t\t\t\t\tfield={field}\n\t\t\t\t\t\t\tlabel='Password'\n\t\t\t\t\t\t\tplaceholder='Enter your password'\n\t\t\t\t\t\t\ttype='password'\n\t\t\t\t\t\t\tinputRef={passwordInputRef}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</form.Field>\n\n\t\t\t\t<form.Field name='rememberMe'>\n\t\t\t\t\t{(field) => (\n\t\t\t\t\t\t<div className='flex items-center space-x-2'>\n\t\t\t\t\t\t\t<Checkbox\n\t\t\t\t\t\t\t\tid='rememberMe'\n\t\t\t\t\t\t\t\tchecked={field.state.value}\n\t\t\t\t\t\t\t\tonCheckedChange={(checked) => {\n\t\t\t\t\t\t\t\t\tfield.handleChange(checked === true);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t\thtmlFor='rememberMe'\n\t\t\t\t\t\t\t\tclassName='text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70'\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tRemember me\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</form.Field>\n\n\t\t\t\t<div className='space-y-3 pt-2'>\n\t\t\t\t\t<AuthLoadingButton\n\t\t\t\t\t\ttype='submit'\n\t\t\t\t\t\tclassName='w-full'\n\t\t\t\t\t\tisLoading={isSubmitting}\n\t\t\t\t\t\tdisabled={isSubmitting}\n\t\t\t\t\t\tdata-testid='auth-login-submit'\n\t\t\t\t\t>\n\t\t\t\t\t\tSign In\n\t\t\t\t\t</AuthLoadingButton>\n\n\t\t\t\t\t{onShowForgot && (\n\t\t\t\t\t\t<div className='text-center'>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant='link'\n\t\t\t\t\t\t\t\tclassName='text-muted-foreground hover:text-foreground h-auto p-0 text-sm'\n\t\t\t\t\t\t\t\tonClick={onShowForgot}\n\t\t\t\t\t\t\t\ttype='button'\n\t\t\t\t\t\t\t\tdata-testid='auth-forgot-link'\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tForgot your password?\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</form>\n\n\t\t\t{onShowRegister && (\n\t\t\t\t<div className='border-border/40 border-t pt-5'>\n\t\t\t\t\t<p className='text-muted-foreground text-center text-sm'>\n\t\t\t\t\t\tDon&apos;t have an account?{' '}\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant='link'\n\t\t\t\t\t\t\tclassName='text-primary hover:text-primary/80 h-auto p-0 font-medium'\n\t\t\t\t\t\t\tonClick={onShowRegister}\n\t\t\t\t\t\t\ttype='button'\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tSign up\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n","import { z } from 'zod';\n\n/**\n * Password validation schema with strong requirements\n */\nconst passwordSchema = z\n\t.string()\n\t.min(8, 'Password must be at least 8 characters')\n\t.regex(\n\t\t/^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]/,\n\t\t'Password must contain uppercase, lowercase, number, and special character',\n\t);\n\n/**\n * Email validation schema\n */\nconst emailSchema = z.string().email('Please enter a valid email address');\n\n/**\n * Login form validation schema\n */\nexport const loginSchema = z.object({\n\temail: emailSchema,\n\tpassword: z.string().min(1, 'Password is required'),\n\trememberMe: z.boolean().optional(),\n});\n\n/**\n * Registration form validation schema\n * Backend only receives email/password - confirmPassword is frontend-only validation\n * Password strength is validated by backend to avoid duplicate/conflicting rules\n */\nexport const registerSchema = z\n\t.object({\n\t\temail: emailSchema,\n\t\tpassword: z.string().min(1, 'Password is required'),\n\t\tconfirmPassword: z.string().min(1, 'Please confirm your password'),\n\t})\n\t.refine((data) => data.password === data.confirmPassword, {\n\t\tmessage: 'Passwords do not match',\n\t\tpath: ['confirmPassword'],\n\t});\n\n/**\n * Forgot password form validation schema\n */\nexport const forgotPasswordSchema = z.object({\n\temail: emailSchema,\n});\n\n/**\n * Reset password form validation schema\n */\nexport const resetPasswordSchema = z\n\t.object({\n\t\tpassword: passwordSchema,\n\t\tconfirmPassword: z.string(),\n\t\ttoken: z.string().min(1, 'Reset token is required'),\n\t})\n\t.refine((data) => data.password === data.confirmPassword, {\n\t\tmessage: 'Passwords do not match',\n\t\tpath: ['confirmPassword'],\n\t});\n\n/**\n * TypeScript types inferred from schemas\n */\nexport type LoginFormData = z.infer<typeof loginSchema>;\nexport type RegisterFormData = z.infer<typeof registerSchema>;\nexport type ForgotPasswordFormData = z.infer<typeof forgotPasswordSchema>;\nexport type ResetPasswordFormData = z.infer<typeof resetPasswordSchema>;\n","import { AlertCircleIcon } from 'lucide-react';\n\nimport { cn } from '../../utils/cn';\n\ninterface AuthErrorAlertProps {\n\terror: string | null;\n\tclassName?: string;\n}\n\nexport function AuthErrorAlert({ error, className }: AuthErrorAlertProps) {\n\tconst hasError = Boolean(error);\n\n\treturn (\n\t\t<div\n\t\t\trole='alert'\n\t\t\taria-live='polite'\n\t\t\taria-hidden={!hasError}\n\t\t\tclassName={cn(\n\t\t\t\t'overflow-hidden transition-[max-height,opacity] duration-(--duration-slow) ease-out',\n\t\t\t\thasError ? 'max-h-32' : 'max-h-0',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'flex items-start gap-2.5 rounded-md px-3 py-2.5',\n\t\t\t\t\t'bg-destructive/8 border border-destructive/20',\n\t\t\t\t\t'text-destructive text-sm text-left',\n\t\t\t\t\t'transition-opacity duration-(--duration-slow)',\n\t\t\t\t\thasError ? 'opacity-100' : 'opacity-0',\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<AlertCircleIcon className='mt-0.5 h-4 w-4 shrink-0' />\n\t\t\t\t<span className='text-pretty leading-snug'>{error}</span>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","import { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","import { ComponentProps } from 'react';\nimport { LoaderIcon } from 'lucide-react';\n\nimport { cn } from '../../utils/cn';\nimport { Button } from '@constructive-io/ui/button';\n\ninterface AuthLoadingButtonProps extends ComponentProps<typeof Button> {\n\tisLoading: boolean;\n\tloadingText?: string;\n}\n\nexport function AuthLoadingButton({\n\tchildren,\n\tisLoading,\n\tloadingText = 'Please wait...',\n\tdisabled,\n\tclassName,\n\t...props\n}: AuthLoadingButtonProps) {\n\treturn (\n\t\t<Button disabled={disabled || isLoading} className={cn('relative', className)} {...props}>\n\t\t\t{isLoading && <LoaderIcon className='mr-2 h-4 w-4 animate-spin' />}\n\t\t\t{isLoading ? loadingText : children}\n\t\t</Button>\n\t);\n}\n","import type { RefObject } from 'react';\nimport { Input } from '@constructive-io/ui/input';\nimport { FormControl, type FormControlLayout } from '@constructive-io/ui/form-control';\n\ninterface FormFieldProps {\n field: any;\n label: string;\n placeholder?: string;\n type?: string;\n className?: string;\n layout?: FormControlLayout;\n inputRef?: RefObject<HTMLInputElement | null>;\n testId?: string;\n}\n\nexport function FormField({\n field,\n label,\n placeholder,\n type = 'text',\n className,\n layout = 'floating',\n inputRef,\n testId,\n}: FormFieldProps) {\n const errors = field.state.meta.errors?.filter(Boolean) ?? [];\n const hasError = errors.length > 0;\n const errorMessage = errors[0] as string | undefined;\n\n return (\n <FormControl\n label={label}\n id={field.name}\n layout={layout}\n error={hasError ? errorMessage : undefined}\n className={className}\n >\n <Input\n ref={inputRef}\n name={field.name}\n data-testid={testId ?? field.name}\n type={type}\n placeholder={placeholder}\n value={field.state.value || ''}\n onChange={(e) => field.handleChange(e.target.value)}\n onBlur={field.handleBlur}\n />\n </FormControl>\n );\n}\n","import { useRef, useState } from 'react';\nimport { useForm } from '@tanstack/react-form';\nimport { CheckCircleIcon } from 'lucide-react';\n\nimport { parseGraphQLError } from '../utils/auth-errors';\nimport type { RegisterFormData } from '../utils/schemas';\nimport { registerSchema } from '../utils/schemas';\nimport { Button } from '@constructive-io/ui/button';\n\nimport { AuthErrorAlert } from './auth-error-alert';\nimport { AuthLoadingButton } from './auth-loading-button';\nimport { FormField } from './form-field';\n\nexport interface SheetsRegisterFormProps {\n\tonRegister: (formData: RegisterFormData) => Promise<unknown>;\n\tonShowLogin?: () => void;\n\tdefaultEmail?: string;\n}\n\nexport function SheetsRegisterForm({ onRegister, onShowLogin, defaultEmail = '' }: SheetsRegisterFormProps) {\n\tconst [error, setError] = useState<string | null>(null);\n\tconst [isSubmitting, setIsSubmitting] = useState(false);\n\tconst [isSuccess, setIsSuccess] = useState(false);\n\tconst passwordInputRef = useRef<HTMLInputElement>(null);\n\n\tconst form = useForm({\n\t\tdefaultValues: {\n\t\t\temail: defaultEmail,\n\t\t\tpassword: '',\n\t\t\tconfirmPassword: '',\n\t\t},\n\t\tonSubmit: async ({ value }) => {\n\t\t\tsetError(null);\n\t\t\tsetIsSubmitting(true);\n\n\t\t\ttry {\n\t\t\t\tconst validatedData = registerSchema.parse(value);\n\t\t\t\tawait onRegister(validatedData);\n\t\t\t\tsetIsSuccess(true);\n\t\t\t} catch (err) {\n\t\t\t\tsetError(parseGraphQLError(err).message);\n\t\t\t} finally {\n\t\t\t\tsetIsSubmitting(false);\n\t\t\t}\n\t\t},\n\t});\n\n\tif (isSuccess) {\n\t\treturn (\n\t\t\t<div className='space-y-5 text-center'>\n\t\t\t\t<div className='flex justify-center'>\n\t\t\t\t\t<div className='bg-success/10 flex h-12 w-12 items-center justify-center rounded-full'>\n\t\t\t\t\t\t<CheckCircleIcon className='text-success h-6 w-6' />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className='space-y-1.5'>\n\t\t\t\t\t<h3 className='text-lg font-semibold'>Check your email</h3>\n\t\t\t\t\t<p className='text-muted-foreground text-sm'>\n\t\t\t\t\t\tWe&apos;ve sent a link to confirm your address. Open it, then sign in with your password.\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className='space-y-5'>\n\t\t\t<form\n\t\t\t\tonSubmit={(e) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\tform.handleSubmit();\n\t\t\t\t}}\n\t\t\t\tclassName='space-y-4 px-8 pb-2'\n\t\t\t>\n\t\t\t\t<AuthErrorAlert error={error} />\n\t\t\t\t<form.Field name='email'>\n\t\t\t\t\t{(field) => (\n\t\t\t\t\t\t<FormField\n\t\t\t\t\t\t\tfield={field}\n\t\t\t\t\t\t\tlabel='Email'\n\t\t\t\t\t\t\tplaceholder='Enter your email'\n\t\t\t\t\t\t\ttype='email'\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</form.Field>\n\n\t\t\t\t<form.Field name='password'>\n\t\t\t\t\t{(field) => (\n\t\t\t\t\t\t<FormField\n\t\t\t\t\t\t\tfield={field}\n\t\t\t\t\t\t\tlabel='Password'\n\t\t\t\t\t\t\tplaceholder='Enter your password'\n\t\t\t\t\t\t\ttype='password'\n\t\t\t\t\t\t\tinputRef={passwordInputRef}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</form.Field>\n\n\t\t\t\t<form.Field name='confirmPassword'>\n\t\t\t\t\t{(field) => (\n\t\t\t\t\t\t<FormField\n\t\t\t\t\t\t\tfield={field}\n\t\t\t\t\t\t\tlabel='Confirm Password'\n\t\t\t\t\t\t\tplaceholder='Confirm your password'\n\t\t\t\t\t\t\ttype='password'\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</form.Field>\n\n\n\t\t\t\t<div className='pt-2'>\n\t\t\t\t\t<AuthLoadingButton\n\t\t\t\t\t\ttype='submit'\n\t\t\t\t\t\tclassName='w-full'\n\t\t\t\t\t\tisLoading={isSubmitting}\n\t\t\t\t\t\tdisabled={isSubmitting}\n\t\t\t\t\t\tdata-testid='auth-signup-submit'\n\t\t\t\t\t>\n\t\t\t\t\t\tCreate Account\n\t\t\t\t\t</AuthLoadingButton>\n\t\t\t\t</div>\n\t\t\t</form>\n\n\t\t\t{onShowLogin && (\n\t\t\t\t<div className='border-border/40 border-t pt-5'>\n\t\t\t\t\t<p className='text-muted-foreground text-center text-sm'>\n\t\t\t\t\t\tAlready have an account?{' '}\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant='link'\n\t\t\t\t\t\t\tclassName='text-primary hover:text-primary/80 h-auto p-0 font-medium'\n\t\t\t\t\t\t\tonClick={onShowLogin}\n\t\t\t\t\t\t\ttype='button'\n\t\t\t\t\t\t\tdata-testid='auth-signup-login-link'\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tSign in\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n","import { useState } from 'react';\nimport { useForm } from '@tanstack/react-form';\nimport { CheckCircleIcon } from 'lucide-react';\n\nimport { parseGraphQLError } from '../utils/auth-errors';\nimport type { ForgotPasswordFormData } from '../utils/schemas';\nimport { forgotPasswordSchema } from '../utils/schemas';\nimport { Button } from '@constructive-io/ui/button';\n\nimport { AuthErrorAlert } from './auth-error-alert';\nimport { AuthLoadingButton } from './auth-loading-button';\nimport { AuthScreenHeader } from './auth-screen-header';\nimport { FormField } from './form-field';\n\nexport interface SheetsForgotPasswordFormProps {\n\tonForgotPassword: (formData: ForgotPasswordFormData) => Promise<unknown>;\n\tonShowLogin?: () => void;\n}\n\nexport function SheetsForgotPasswordForm({ onForgotPassword, onShowLogin }: SheetsForgotPasswordFormProps) {\n\tconst [error, setError] = useState<string | null>(null);\n\tconst [isSubmitting, setIsSubmitting] = useState(false);\n\tconst [isSuccess, setIsSuccess] = useState(false);\n\n\tconst form = useForm({\n\t\tdefaultValues: {\n\t\t\temail: '',\n\t\t},\n\t\tonSubmit: async ({ value }) => {\n\t\t\tsetError(null);\n\t\t\tsetIsSubmitting(true);\n\n\t\t\ttry {\n\t\t\t\tconst validatedData = forgotPasswordSchema.parse(value);\n\t\t\t\tawait onForgotPassword(validatedData);\n\t\t\t\tsetIsSuccess(true);\n\t\t\t} catch (err) {\n\t\t\t\tsetError(parseGraphQLError(err).message);\n\t\t\t} finally {\n\t\t\t\tsetIsSubmitting(false);\n\t\t\t}\n\t\t},\n\t\tvalidators: {\n\t\t\tonChange: ({ value }) => {\n\t\t\t\tconst result = forgotPasswordSchema.safeParse(value);\n\t\t\t\tif (!result.success) {\n\t\t\t\t\treturn result.error.issues.map((issue) => issue.message).join(', ');\n\t\t\t\t}\n\t\t\t\treturn undefined;\n\t\t\t},\n\t\t},\n\t});\n\n\tif (isSuccess) {\n\t\treturn (\n\t\t\t<div className='space-y-5 text-center'>\n\t\t\t\t<div className='flex justify-center'>\n\t\t\t\t\t<div className='bg-success/10 flex h-12 w-12 items-center justify-center rounded-full'>\n\t\t\t\t\t\t<CheckCircleIcon className='text-success h-6 w-6' />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className='space-y-1.5'>\n\t\t\t\t\t<h3 className='text-lg font-semibold'>Check your email</h3>\n\t\t\t\t\t<p className='text-muted-foreground text-sm'>We&apos;ve sent a password reset link to your email address.</p>\n\t\t\t\t</div>\n\t\t\t\t{onShowLogin && (\n\t\t\t\t\t<div className='pt-1'>\n\t\t\t\t\t\t<Button variant='outline' type='button' onClick={onShowLogin} className='w-full'>\n\t\t\t\t\t\t\tBack to sign in\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className='space-y-5'>\n\t\t\t<AuthScreenHeader title='Reset your password' description=\"We'll send you a password reset link\" />\n\n\t\t\t<form\n\t\t\t\tonSubmit={(e) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\tform.handleSubmit();\n\t\t\t\t}}\n\t\t\t\tclassName='space-y-4 px-8'\n\t\t\t>\n\t\t\t\t<AuthErrorAlert error={error} />\n\t\t\t\t<form.Field\n\t\t\t\t\tname='email'\n\t\t\t\t\tvalidators={{\n\t\t\t\t\t\tonChange: ({ value }) => {\n\t\t\t\t\t\t\tif (!value) return 'Email is required';\n\t\t\t\t\t\t\tif (!/\\S+@\\S+\\.\\S+/.test(value)) return 'Please enter a valid email';\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{(field) => (\n\t\t\t\t\t\t<FormField\n\t\t\t\t\t\t\tfield={field}\n\t\t\t\t\t\t\tlabel='Email'\n\t\t\t\t\t\t\tplaceholder='Enter your email'\n\t\t\t\t\t\t\ttype='email'\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</form.Field>\n\n\t\t\t\t<div className='pt-2'>\n\t\t\t\t\t<AuthLoadingButton\n\t\t\t\t\t\ttype='submit'\n\t\t\t\t\t\tclassName='w-full'\n\t\t\t\t\t\tisLoading={isSubmitting}\n\t\t\t\t\t\tdisabled={isSubmitting}\n\t\t\t\t\t\tdata-testid='auth-forgot-submit'\n\t\t\t\t\t>\n\t\t\t\t\t\tSend Reset Link\n\t\t\t\t\t</AuthLoadingButton>\n\t\t\t\t</div>\n\t\t\t</form>\n\n\t\t\t{onShowLogin && (\n\t\t\t\t<div className='text-muted-foreground text-center text-sm'>\n\t\t\t\t\tRemember your password?{' '}\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant='link'\n\t\t\t\t\t\tclassName='text-primary hover:text-primary/80 h-auto p-0 font-medium'\n\t\t\t\t\t\tonClick={onShowLogin}\n\t\t\t\t\t\ttype='button'\n\t\t\t\t\t>\n\t\t\t\t\t\tSign in\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n","import * as React from 'react';\n\nimport { cn } from '../../utils/cn';\n\nexport interface AuthBrandingProps {\n\tlogo?: React.ReactNode;\n\tappName?: string;\n\tshowLogo?: boolean;\n}\n\ninterface AuthScreenHeaderProps extends AuthBrandingProps {\n\ttitle: string;\n\tdescription?: string;\n\tclassName?: string;\n}\n\nexport function AuthScreenHeader({\n\ttitle,\n\tdescription,\n\tlogo,\n\tappName,\n\tshowLogo = true,\n\tclassName,\n}: AuthScreenHeaderProps) {\n\treturn (\n\t\t<div className={cn('space-y-4 text-center', className)}>\n\t\t\t{showLogo && logo ? (\n\t\t\t\t<div className='flex items-center justify-center'>{logo}</div>\n\t\t\t) : null}\n\t\t\t{appName ? (\n\t\t\t\t<span className='text-primary text-[15px] font-semibold tracking-tight'>{appName}</span>\n\t\t\t) : null}\n\n\t\t\t<div className='space-y-1.5'>\n\t\t\t\t<h2\n\t\t\t\t\tclassName='from-foreground via-foreground to-foreground/70 bg-linear-to-br bg-clip-text text-xl\n\t\t\t\t\t\tfont-semibold tracking-tight text-transparent'\n\t\t\t\t>\n\t\t\t\t\t{title}\n\t\t\t\t</h2>\n\t\t\t\t{description ? <p className='text-muted-foreground text-[13px] leading-relaxed'>{description}</p> : null}\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","import * as React from 'react';\nimport { useForm } from '@tanstack/react-form';\nimport { CheckCircleIcon } from 'lucide-react';\n\nimport { parseGraphQLError } from '../utils/auth-errors';\nimport { resetPasswordSchema } from '../utils/schemas';\nimport { Button } from '@constructive-io/ui/button';\n\nimport { AuthErrorAlert } from './auth-error-alert';\nimport { AuthLoadingButton } from './auth-loading-button';\nimport { AuthScreenHeader } from './auth-screen-header';\nimport { FormField } from './form-field';\nimport { PasswordStrength } from './password-strength';\n\nexport interface SheetsResetPasswordFormProps {\n\tresetToken: string;\n\troleId?: string;\n\tonResetPassword: (input: { newPassword: string; resetToken: string; roleId?: string }) => Promise<unknown>;\n\tonShowLogin?: () => void;\n}\n\nexport function SheetsResetPasswordForm({\n\tresetToken,\n\troleId,\n\tonResetPassword,\n\tonShowLogin,\n}: SheetsResetPasswordFormProps) {\n\tconst [error, setError] = React.useState<string | null>(null);\n\tconst [isSubmitting, setIsSubmitting] = React.useState(false);\n\tconst [isSuccess, setIsSuccess] = React.useState(false);\n\n\tconst form = useForm({\n\t\tdefaultValues: {\n\t\t\tpassword: '',\n\t\t\tconfirmPassword: '',\n\t\t\ttoken: resetToken,\n\t\t},\n\t\tonSubmit: async ({ value }) => {\n\t\t\tsetError(null);\n\t\t\tsetIsSubmitting(true);\n\n\t\t\ttry {\n\t\t\t\tconst validatedData = resetPasswordSchema.parse(value);\n\t\t\t\tawait onResetPassword({\n\t\t\t\t\tnewPassword: validatedData.password,\n\t\t\t\t\tresetToken: validatedData.token,\n\t\t\t\t\troleId,\n\t\t\t\t});\n\t\t\t\tsetIsSuccess(true);\n\t\t\t} catch (err) {\n\t\t\t\tsetError(parseGraphQLError(err).message);\n\t\t\t} finally {\n\t\t\t\tsetIsSubmitting(false);\n\t\t\t}\n\t\t},\n\t\tvalidators: {\n\t\t\tonChange: ({ value }) => {\n\t\t\t\tconst result = resetPasswordSchema.safeParse(value);\n\t\t\t\tif (!result.success) {\n\t\t\t\t\treturn result.error.issues.map((issue) => issue.message).join(', ');\n\t\t\t\t}\n\t\t\t\treturn undefined;\n\t\t\t},\n\t\t},\n\t});\n\n\tif (isSuccess) {\n\t\treturn (\n\t\t\t<div className='space-y-5 text-center'>\n\t\t\t\t<div className='flex justify-center'>\n\t\t\t\t\t<div className='bg-success/10 flex h-12 w-12 items-center justify-center rounded-full'>\n\t\t\t\t\t\t<CheckCircleIcon className='text-success h-6 w-6' />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className='space-y-1.5'>\n\t\t\t\t\t<h3 className='text-lg font-semibold'>Password reset successful</h3>\n\t\t\t\t\t<p className='text-muted-foreground text-sm'>\n\t\t\t\t\t\tYour password has been reset successfully. You can now sign in with your new password.\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t\t{onShowLogin && (\n\t\t\t\t\t<div className='pt-1'>\n\t\t\t\t\t\t<Button type='button' onClick={onShowLogin} className='w-full'>\n\t\t\t\t\t\t\tSign in\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className='space-y-5'>\n\t\t\t<AuthScreenHeader title='Set a new password' description='Enter your new password below' />\n\n\t\t\t<form\n\t\t\t\tonSubmit={(e) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\tform.handleSubmit();\n\t\t\t\t}}\n\t\t\t\tclassName='space-y-4 px-8'\n\t\t\t>\n\t\t\t\t<AuthErrorAlert error={error} />\n\t\t\t\t<form.Field\n\t\t\t\t\tname='password'\n\t\t\t\t\tvalidators={{\n\t\t\t\t\t\tonChange: ({ value }) => {\n\t\t\t\t\t\t\tif (!value) return 'Password is required';\n\t\t\t\t\t\t\tif (value.length < 8) return 'Password must be at least 8 characters';\n\t\t\t\t\t\t\tif (!/^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]/.test(value)) {\n\t\t\t\t\t\t\t\treturn 'Password must contain uppercase, lowercase, number, and special character';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{(field) => (\n\t\t\t\t\t\t<div className='space-y-2'>\n\t\t\t\t\t\t\t<FormField\n\t\t\t\t\t\t\t\tfield={field}\n\t\t\t\t\t\t\t\tlabel='New Password'\n\t\t\t\t\t\t\t\tplaceholder='Enter your new password'\n\t\t\t\t\t\t\t\ttype='password'\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PasswordStrength password={field.state.value} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</form.Field>\n\n\t\t\t\t<form.Field\n\t\t\t\t\tname='confirmPassword'\n\t\t\t\t\tvalidators={{\n\t\t\t\t\t\tonChange: ({ value }) => {\n\t\t\t\t\t\t\tif (!value) return 'Please confirm your password';\n\t\t\t\t\t\t\tconst password = form.getFieldValue('password');\n\t\t\t\t\t\t\tif (value !== password) return 'Passwords do not match';\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{(field) => (\n\t\t\t\t\t\t<FormField\n\t\t\t\t\t\t\tfield={field}\n\t\t\t\t\t\t\tlabel='Confirm New Password'\n\t\t\t\t\t\t\tplaceholder='Confirm your new password'\n\t\t\t\t\t\t\ttype='password'\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</form.Field>\n\n\t\t\t\t<div className='pt-2'>\n\t\t\t\t\t<AuthLoadingButton\n\t\t\t\t\t\ttype='submit'\n\t\t\t\t\t\tclassName='w-full'\n\t\t\t\t\t\tisLoading={isSubmitting}\n\t\t\t\t\t\tdisabled={!form.state.canSubmit || isSubmitting}\n\t\t\t\t\t\tdata-testid='auth-reset-submit'\n\t\t\t\t\t>\n\t\t\t\t\t\tReset Password\n\t\t\t\t\t</AuthLoadingButton>\n\t\t\t\t</div>\n\t\t\t</form>\n\n\t\t\t{onShowLogin && (\n\t\t\t\t<div className='text-muted-foreground text-center text-sm'>\n\t\t\t\t\tRemember your password?{' '}\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant='link'\n\t\t\t\t\t\tclassName='text-primary hover:text-primary/80 h-auto p-0 font-medium'\n\t\t\t\t\t\tonClick={onShowLogin}\n\t\t\t\t\t\ttype='button'\n\t\t\t\t\t>\n\t\t\t\t\t\tSign in\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n","/**\n * Custom validation functions for authentication forms\n */\n\n/**\n * Calculate password strength score (0-5)\n */\nexport function getPasswordStrength(password: string): number {\n\tlet score = 0;\n\n\t// Length check\n\tif (password.length >= 8) score++;\n\n\t// Character variety checks\n\tif (/[a-z]/.test(password)) score++;\n\tif (/[A-Z]/.test(password)) score++;\n\tif (/\\d/.test(password)) score++;\n\tif (/[@$!%*?&]/.test(password)) score++;\n\n\treturn score;\n}\n\n/**\n * Get password strength label\n */\nexport function getPasswordStrengthLabel(score: number): string {\n\tconst labels = ['Very Weak', 'Weak', 'Fair', 'Good', 'Strong'];\n\treturn labels[score - 1] || 'Very Weak';\n}\n\n/**\n * Get password strength color class\n */\nexport function getPasswordStrengthColor(score: number): string {\n\tconst colors = ['bg-red-500', 'bg-orange-500', 'bg-yellow-500', 'bg-blue-500', 'bg-green-500'];\n\treturn colors[score - 1] || 'bg-red-500';\n}\n\n/**\n * Validate email format (additional validation beyond zod)\n */\nexport function validateEmail(email: string): boolean {\n\tconst emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n\treturn emailRegex.test(email);\n}\n\n/**\n * Check if password meets minimum requirements\n */\nexport function isPasswordValid(password: string): boolean {\n\treturn getPasswordStrength(password) >= 3;\n}\n\n/**\n * Async email availability check (placeholder - integrate with your API)\n */\nexport async function checkEmailAvailability(email: string): Promise<boolean> {\n\t// Placeholder implementation - replace with actual API call\n\treturn new Promise((resolve) => {\n\t\tsetTimeout(() => {\n\t\t\t// Simulate API call\n\t\t\tconst unavailableEmails = ['admin@example.com', 'test@example.com'];\n\t\t\tresolve(!unavailableEmails.includes(email));\n\t\t}, 500);\n\t});\n}\n\n/**\n * Validate password confirmation\n */\nexport function validatePasswordConfirmation(password: string, confirmPassword: string): boolean {\n\treturn password === confirmPassword && password.length > 0;\n}\n","import { getPasswordStrength, getPasswordStrengthColor, getPasswordStrengthLabel } from '../utils/validators';\nimport { cn } from '../../utils/cn';\n\ninterface PasswordStrengthProps {\n\tpassword: string;\n\tclassName?: string;\n}\n\nexport function PasswordStrength({ password, className }: PasswordStrengthProps) {\n\tconst strength = getPasswordStrength(password);\n\tconst label = getPasswordStrengthLabel(strength);\n\tconst colorClass = getPasswordStrengthColor(strength);\n\n\t// Don't show anything if password is empty\n\tif (!password) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className={cn('space-y-2', className)}>\n\t\t\t<div className='flex space-x-1'>\n\t\t\t\t{[...Array(5)].map((_, i) => (\n\t\t\t\t\t<div key={i} className={cn('h-2 w-full rounded transition-colors', i < strength ? colorClass : 'bg-muted')} />\n\t\t\t\t))}\n\t\t\t</div>\n\t\t\t<p className='text-muted-foreground text-sm'>\n\t\t\t\tPassword strength:{' '}\n\t\t\t\t<span\n\t\t\t\t\tclassName={cn('font-medium', {\n\t\t\t\t\t\t'text-red-600': strength <= 2,\n\t\t\t\t\t\t'text-yellow-600': strength === 3,\n\t\t\t\t\t\t'text-blue-600': strength === 4,\n\t\t\t\t\t\t'text-green-600': strength === 5,\n\t\t\t\t\t})}\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t</span>\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n","import * as React from 'react';\n\nimport { cn } from '../../utils/cn';\nimport { Card, CardContent } from '@constructive-io/ui/card';\n\nimport type { AuthBrandingProps } from './auth-screen-header';\n\ntype AuthScreenLayoutFill = 'viewport' | 'parent';\n\nexport interface AuthScreenLayoutProps extends AuthBrandingProps {\n\tchildren: React.ReactNode;\n\tfill?: AuthScreenLayoutFill;\n\tclassName?: string;\n}\n\nexport function AuthScreenLayout({\n\tchildren,\n\tfill = 'parent',\n\tclassName,\n}: AuthScreenLayoutProps) {\n\treturn (\n\t\t<div\n\t\t\tclassName={cn(\n\t\t\t\t'bg-background relative flex flex-col',\n\t\t\t\tfill === 'viewport' ? 'min-h-dvh w-dvw' : 'h-full w-full',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t<div className='flex flex-1 items-center justify-center p-6'>\n\t\t\t\t<div className='relative z-10 w-full max-w-md'>\n\t\t\t\t\t<Card className='overflow-hidden border-border/80'>\n\t\t\t\t\t\t<CardContent className='space-y-2 pt-6'>{children}</CardContent>\n\t\t\t\t\t</Card>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAAyB;;;ACAzB,mBAA0C;AAyGnC,IAAM,oBAAgB,4BAAyC,IAAI;AAEnE,SAAS,mBAAuC;AACtD,QAAM,UAAM,yBAAW,aAAa;AACpC,MAAI,CAAC,KAAK;AACT,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC1E;AACA,SAAO;AACR;;;ACjHA,IAAAC,gBAA0C;AAC1C,qBAAwE;AA+BjE,IAAM,yBAAqB,6BAAiD,IAAI;AAEhF,SAAS,eAAkB,UAA6C;AAC7E,QAAM,YAAQ,0BAAW,kBAAkB;AAC3C,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AACA,aAAO,eAAAC,UAAgB,OAAO,QAAQ;AACxC;AAEO,SAAS,oBAAgD;AAC9D,QAAM,YAAQ,0BAAW,kBAAkB;AAC3C,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,0DAA0D;AAAA,EAC5E;AACA,SAAO;AACT;;;AChDA,yBAA4C;;;AC0BrC,IAAM,cAAc;AAAA;AAAA,EAE1B,qBAAqB;AAAA;AAAA,EACr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,MAAM;AAAA,UAAC,CAAC;AAAA,UAC9E,cAAc,MAAM,QAAQ,QAAQ;AAAA,UACpC,gBAAgB,MAAM,QAAQ,UAAU;AAAA;AAAA,MACzC;AAAA,MAEA,SAAS,cACT;AAAA,QAAC;AAAA;AAAA,UACA,YAAY,CAAC,SAAS,iBAAiB,YAAY,IAAI;AAAA,UACvD,aAAa,MAAM,QAAQ,OAAO;AAAA;AAAA,MACnC;AAAA,MAEA,SAAS,YACT;AAAA,QAAC;AAAA;AAAA,UACA,kBAAkB,CAAC,SAAS,uBAAuB,YAAY,IAAI;AAAA,UACnE,aAAa,MAAM,QAAQ,OAAO;AAAA;AAAA,MACnC;AAAA,MAEA,SAAS,WACT;AAAA,QAAC;AAAA;AAAA,UACA,YAAY,cAAc;AAAA,UAC1B;AAAA,UACA,iBAAiB,CAAC,UAAU,sBAAsB,YAAY,KAAK;AAAA,UACnE,aAAa,MAAM,QAAQ,OAAO;AAAA;AAAA,MACnC;AAAA,OAEF;AAAA,KACD;AAEF;","names":["import_react","import_react","useZustandStore","codeMatch","message","import_react_query","import_react_query","import_react_query","import_react","import_button","import_lucide_react","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_react","import_react_form","import_lucide_react","import_button","import_jsx_runtime","import_react","import_react_form","import_lucide_react","import_button","import_jsx_runtime","import_jsx_runtime","import_react_form","import_lucide_react","import_button","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime"]}
package/dist/auth.js CHANGED
@@ -5,9 +5,9 @@ import {
5
5
  useSheetsLogin,
6
6
  useSheetsRegister,
7
7
  useSheetsResetPassword
8
- } from "./chunk-MXVNIKES.js";
9
- import "./chunk-4EZ6A23C.js";
10
- import "./chunk-H5HR5HUJ.js";
8
+ } from "./chunk-J7KK4UWI.js";
9
+ import "./chunk-ZOQDSOMO.js";
10
+ import "./chunk-II3MSNRO.js";
11
11
  import "./chunk-YDQQA46V.js";
12
12
  export {
13
13
  SheetsAuthGate,