@constructive-io/sheets 0.11.0 → 0.13.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.
- package/dist/advanced.cjs +24 -18
- package/dist/advanced.cjs.map +1 -1
- package/dist/advanced.js +1 -1
- package/dist/auth.cjs +25 -51
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +0 -6
- package/dist/auth.d.ts +0 -6
- package/dist/auth.js +1 -1
- package/dist/{chunk-J67BAGEN.js → chunk-CBXNKMN6.js} +23 -12
- package/dist/chunk-CBXNKMN6.js.map +1 -0
- package/dist/{chunk-FNWOEA5F.js → chunk-MXVNIKES.js} +26 -52
- package/dist/chunk-MXVNIKES.js.map +1 -0
- package/dist/{date-editor-QT47WY5T.js → date-editor-ZFNDKYBD.js} +3 -8
- package/dist/date-editor-ZFNDKYBD.js.map +1 -0
- package/dist/index.cjs +55 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/{map-picker-5G32CUU4.js → map-picker-ZUGGOIZS.js} +3 -3
- package/dist/{map-picker-5G32CUU4.js.map → map-picker-ZUGGOIZS.js.map} +1 -1
- package/package.json +7 -7
- package/dist/chunk-FNWOEA5F.js.map +0 -1
- package/dist/chunk-J67BAGEN.js.map +0 -1
- package/dist/date-editor-QT47WY5T.js.map +0 -1
|
@@ -297,14 +297,7 @@ var SIGN_UP_MUTATION = (
|
|
|
297
297
|
`
|
|
298
298
|
mutation SignUp($input: SignUpInput!) {
|
|
299
299
|
signUp(input: $input) {
|
|
300
|
-
|
|
301
|
-
id
|
|
302
|
-
userId
|
|
303
|
-
accessToken
|
|
304
|
-
accessTokenExpiresAt
|
|
305
|
-
isVerified
|
|
306
|
-
totpEnabled
|
|
307
|
-
}
|
|
300
|
+
clientMutationId
|
|
308
301
|
}
|
|
309
302
|
}
|
|
310
303
|
`
|
|
@@ -316,27 +309,19 @@ function useSheetsRegister() {
|
|
|
316
309
|
return useMutation2({
|
|
317
310
|
mutationKey: ["sheets", "auth", "signUp"],
|
|
318
311
|
mutationFn: async (formData) => {
|
|
319
|
-
|
|
312
|
+
await executeAuthMutation(
|
|
320
313
|
config,
|
|
321
314
|
SIGN_UP_MUTATION,
|
|
322
315
|
{
|
|
323
316
|
input: {
|
|
324
317
|
email: formData.email,
|
|
325
|
-
password: formData.password
|
|
326
|
-
rememberMe: formData.rememberMe ?? true
|
|
318
|
+
password: formData.password
|
|
327
319
|
}
|
|
328
320
|
}
|
|
329
321
|
);
|
|
330
|
-
|
|
331
|
-
const token = signUpResult ? toAuthToken(signUpResult) : null;
|
|
332
|
-
return { token, email: formData.email, identityKey: signUpResult?.userId ?? null };
|
|
322
|
+
return { email: formData.email };
|
|
333
323
|
},
|
|
334
|
-
onSuccess: (
|
|
335
|
-
if (token) {
|
|
336
|
-
const databaseId = config.databaseId || "default";
|
|
337
|
-
setStoredToken(databaseId, token.accessToken, token.expiresAt, identityKey);
|
|
338
|
-
storeApi.getState().setAuthenticated(token.accessToken, token.expiresAt, identityKey);
|
|
339
|
-
}
|
|
324
|
+
onSuccess: () => {
|
|
340
325
|
queryClient.invalidateQueries({ queryKey: ["sheets"] });
|
|
341
326
|
},
|
|
342
327
|
onError: () => {
|
|
@@ -437,8 +422,7 @@ var loginSchema = z.object({
|
|
|
437
422
|
var registerSchema = z.object({
|
|
438
423
|
email: emailSchema,
|
|
439
424
|
password: z.string().min(1, "Password is required"),
|
|
440
|
-
confirmPassword: z.string().min(1, "Please confirm your password")
|
|
441
|
-
rememberMe: z.boolean().optional()
|
|
425
|
+
confirmPassword: z.string().min(1, "Please confirm your password")
|
|
442
426
|
}).refine((data) => data.password === data.confirmPassword, {
|
|
443
427
|
message: "Passwords do not match",
|
|
444
428
|
path: ["confirmPassword"]
|
|
@@ -471,7 +455,7 @@ function AuthErrorAlert({ error, className }) {
|
|
|
471
455
|
"aria-live": "polite",
|
|
472
456
|
"aria-hidden": !hasError,
|
|
473
457
|
className: cn(
|
|
474
|
-
"overflow-hidden transition-
|
|
458
|
+
"overflow-hidden transition-[max-height,opacity] duration-(--duration-slow) ease-out",
|
|
475
459
|
hasError ? "max-h-32" : "max-h-0",
|
|
476
460
|
className
|
|
477
461
|
),
|
|
@@ -482,7 +466,7 @@ function AuthErrorAlert({ error, className }) {
|
|
|
482
466
|
"flex items-start gap-2.5 rounded-md px-3 py-2.5",
|
|
483
467
|
"bg-destructive/8 border border-destructive/20",
|
|
484
468
|
"text-destructive text-sm text-left",
|
|
485
|
-
"transition-opacity duration-
|
|
469
|
+
"transition-opacity duration-(--duration-slow)",
|
|
486
470
|
hasError ? "opacity-100" : "opacity-0"
|
|
487
471
|
),
|
|
488
472
|
children: [
|
|
@@ -712,19 +696,19 @@ function SheetsLoginForm({ onLogin, onShowForgot, onShowRegister, defaultEmail =
|
|
|
712
696
|
// src/auth/ui/register-form.tsx
|
|
713
697
|
import { useRef as useRef2, useState as useState2 } from "react";
|
|
714
698
|
import { useForm as useForm2 } from "@tanstack/react-form";
|
|
699
|
+
import { CheckCircleIcon } from "lucide-react";
|
|
715
700
|
import { Button as Button3 } from "@constructive-io/ui/button";
|
|
716
|
-
import { Checkbox as Checkbox2 } from "@constructive-io/ui/checkbox";
|
|
717
701
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
718
702
|
function SheetsRegisterForm({ onRegister, onShowLogin, defaultEmail = "" }) {
|
|
719
703
|
const [error, setError] = useState2(null);
|
|
720
704
|
const [isSubmitting, setIsSubmitting] = useState2(false);
|
|
705
|
+
const [isSuccess, setIsSuccess] = useState2(false);
|
|
721
706
|
const passwordInputRef = useRef2(null);
|
|
722
707
|
const form = useForm2({
|
|
723
708
|
defaultValues: {
|
|
724
709
|
email: defaultEmail,
|
|
725
710
|
password: "",
|
|
726
|
-
confirmPassword: ""
|
|
727
|
-
rememberMe: true
|
|
711
|
+
confirmPassword: ""
|
|
728
712
|
},
|
|
729
713
|
onSubmit: async ({ value }) => {
|
|
730
714
|
setError(null);
|
|
@@ -732,6 +716,7 @@ function SheetsRegisterForm({ onRegister, onShowLogin, defaultEmail = "" }) {
|
|
|
732
716
|
try {
|
|
733
717
|
const validatedData = registerSchema.parse(value);
|
|
734
718
|
await onRegister(validatedData);
|
|
719
|
+
setIsSuccess(true);
|
|
735
720
|
} catch (err) {
|
|
736
721
|
setError(parseGraphQLError(err).message);
|
|
737
722
|
} finally {
|
|
@@ -739,6 +724,15 @@ function SheetsRegisterForm({ onRegister, onShowLogin, defaultEmail = "" }) {
|
|
|
739
724
|
}
|
|
740
725
|
}
|
|
741
726
|
});
|
|
727
|
+
if (isSuccess) {
|
|
728
|
+
return /* @__PURE__ */ jsxs4("div", { className: "space-y-5 text-center", children: [
|
|
729
|
+
/* @__PURE__ */ jsx5("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx5("div", { className: "bg-success/10 flex h-12 w-12 items-center justify-center rounded-full", children: /* @__PURE__ */ jsx5(CheckCircleIcon, { className: "text-success h-6 w-6" }) }) }),
|
|
730
|
+
/* @__PURE__ */ jsxs4("div", { className: "space-y-1.5", children: [
|
|
731
|
+
/* @__PURE__ */ jsx5("h3", { className: "text-lg font-semibold", children: "Check your email" }),
|
|
732
|
+
/* @__PURE__ */ jsx5("p", { className: "text-muted-foreground text-sm", children: "We've sent a link to confirm your address. Open it, then sign in with your password." })
|
|
733
|
+
] })
|
|
734
|
+
] });
|
|
735
|
+
}
|
|
742
736
|
return /* @__PURE__ */ jsxs4("div", { className: "space-y-5", children: [
|
|
743
737
|
/* @__PURE__ */ jsxs4(
|
|
744
738
|
"form",
|
|
@@ -779,26 +773,6 @@ function SheetsRegisterForm({ onRegister, onShowLogin, defaultEmail = "" }) {
|
|
|
779
773
|
type: "password"
|
|
780
774
|
}
|
|
781
775
|
) }),
|
|
782
|
-
/* @__PURE__ */ jsx5(form.Field, { name: "rememberMe", children: (field) => /* @__PURE__ */ jsxs4("div", { className: "flex items-center space-x-2", children: [
|
|
783
|
-
/* @__PURE__ */ jsx5(
|
|
784
|
-
Checkbox2,
|
|
785
|
-
{
|
|
786
|
-
id: "rememberMe",
|
|
787
|
-
checked: field.state.value,
|
|
788
|
-
onCheckedChange: (checked) => {
|
|
789
|
-
field.handleChange(checked === true);
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
),
|
|
793
|
-
/* @__PURE__ */ jsx5(
|
|
794
|
-
"label",
|
|
795
|
-
{
|
|
796
|
-
htmlFor: "rememberMe",
|
|
797
|
-
className: "text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
798
|
-
children: "Remember me"
|
|
799
|
-
}
|
|
800
|
-
)
|
|
801
|
-
] }) }),
|
|
802
776
|
/* @__PURE__ */ jsx5("div", { className: "pt-2", children: /* @__PURE__ */ jsx5(
|
|
803
777
|
AuthLoadingButton,
|
|
804
778
|
{
|
|
@@ -834,7 +808,7 @@ function SheetsRegisterForm({ onRegister, onShowLogin, defaultEmail = "" }) {
|
|
|
834
808
|
// src/auth/ui/forgot-password-form.tsx
|
|
835
809
|
import { useState as useState3 } from "react";
|
|
836
810
|
import { useForm as useForm3 } from "@tanstack/react-form";
|
|
837
|
-
import { CheckCircleIcon } from "lucide-react";
|
|
811
|
+
import { CheckCircleIcon as CheckCircleIcon2 } from "lucide-react";
|
|
838
812
|
import { Button as Button4 } from "@constructive-io/ui/button";
|
|
839
813
|
|
|
840
814
|
// src/auth/ui/auth-screen-header.tsx
|
|
@@ -898,7 +872,7 @@ function SheetsForgotPasswordForm({ onForgotPassword, onShowLogin }) {
|
|
|
898
872
|
});
|
|
899
873
|
if (isSuccess) {
|
|
900
874
|
return /* @__PURE__ */ jsxs6("div", { className: "space-y-5 text-center", children: [
|
|
901
|
-
/* @__PURE__ */ jsx7("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx7("div", { className: "bg-success/10 flex h-12 w-12 items-center justify-center rounded-full", children: /* @__PURE__ */ jsx7(
|
|
875
|
+
/* @__PURE__ */ jsx7("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx7("div", { className: "bg-success/10 flex h-12 w-12 items-center justify-center rounded-full", children: /* @__PURE__ */ jsx7(CheckCircleIcon2, { className: "text-success h-6 w-6" }) }) }),
|
|
902
876
|
/* @__PURE__ */ jsxs6("div", { className: "space-y-1.5", children: [
|
|
903
877
|
/* @__PURE__ */ jsx7("h3", { className: "text-lg font-semibold", children: "Check your email" }),
|
|
904
878
|
/* @__PURE__ */ jsx7("p", { className: "text-muted-foreground text-sm", children: "We've sent a password reset link to your email address." })
|
|
@@ -975,7 +949,7 @@ function SheetsForgotPasswordForm({ onForgotPassword, onShowLogin }) {
|
|
|
975
949
|
// src/auth/ui/reset-password-form.tsx
|
|
976
950
|
import * as React from "react";
|
|
977
951
|
import { useForm as useForm4 } from "@tanstack/react-form";
|
|
978
|
-
import { CheckCircleIcon as
|
|
952
|
+
import { CheckCircleIcon as CheckCircleIcon3 } from "lucide-react";
|
|
979
953
|
import { Button as Button5 } from "@constructive-io/ui/button";
|
|
980
954
|
|
|
981
955
|
// src/auth/utils/validators.ts
|
|
@@ -1073,7 +1047,7 @@ function SheetsResetPasswordForm({
|
|
|
1073
1047
|
});
|
|
1074
1048
|
if (isSuccess) {
|
|
1075
1049
|
return /* @__PURE__ */ jsxs8("div", { className: "space-y-5 text-center", children: [
|
|
1076
|
-
/* @__PURE__ */ jsx9("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx9("div", { className: "bg-success/10 flex h-12 w-12 items-center justify-center rounded-full", children: /* @__PURE__ */ jsx9(
|
|
1050
|
+
/* @__PURE__ */ jsx9("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx9("div", { className: "bg-success/10 flex h-12 w-12 items-center justify-center rounded-full", children: /* @__PURE__ */ jsx9(CheckCircleIcon3, { className: "text-success h-6 w-6" }) }) }),
|
|
1077
1051
|
/* @__PURE__ */ jsxs8("div", { className: "space-y-1.5", children: [
|
|
1078
1052
|
/* @__PURE__ */ jsx9("h3", { className: "text-lg font-semibold", children: "Password reset successful" }),
|
|
1079
1053
|
/* @__PURE__ */ jsx9("p", { className: "text-muted-foreground text-sm", children: "Your password has been reset successfully. You can now sign in with your new password." })
|
|
@@ -1311,4 +1285,4 @@ export {
|
|
|
1311
1285
|
useSheetsResetPassword,
|
|
1312
1286
|
SheetsAuthGate
|
|
1313
1287
|
};
|
|
1314
|
-
//# sourceMappingURL=chunk-
|
|
1288
|
+
//# sourceMappingURL=chunk-MXVNIKES.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/auth/hooks/use-login.ts","../src/auth/utils/auth-errors.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/auth-gate.tsx","../src/auth/ui/login-form.tsx","../src/auth/utils/schemas.ts","../src/auth/ui/auth-error-alert.tsx","../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":["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","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 { 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 { 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'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 { 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'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'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,SAAS,aAAa,sBAAsB;;;AC0BrC,IAAM,cAAc;AAAA;AAAA,EAE1B,qBAAqB;AAAA;AAAA,EACrB,oBAAoB;AAAA,EACpB,gCAAgC;AAAA,EAChC,kBAAkB;AAAA;AAAA,EAGlB,mBAAmB;AAAA,EACnB,cAAc;AAAA;AAAA,EAGd,gBAAgB;AAAA;AAAA,EAGhB,kBAAkB;AAAA,EAClB,cAAc;AAAA,EACd,wBAAwB;AACzB;AAYO,IAAM,iBAA4C;AAAA,EACxD,CAAC,YAAY,mBAAmB,GAAG;AAAA,EACnC,CAAC,YAAY,kBAAkB,GAAG;AAAA,EAClC,CAAC,YAAY,8BAA8B,GAC1C;AAAA,EACD,CAAC,YAAY,gBAAgB,GAC5B;AAAA,EACD,CAAC,YAAY,iBAAiB,GAC7B;AAAA,EACD,CAAC,YAAY,YAAY,GAAG;AAAA,EAC5B,CAAC,YAAY,cAAc,GAC1B;AAAA,EACD,CAAC,YAAY,gBAAgB,GAC5B;AAAA,EACD,CAAC,YAAY,YAAY,GACxB;AAAA,EACD,CAAC,YAAY,sBAAsB,GAClC;AACF;AAKO,IAAM,wBAAwB;AA0B9B,IAAM,YAAN,MAAM,mBAAkB,MAAM;AAAA,EACpB;AAAA,EACA;AAAA,EAEhB,YAAY,MAAiB,eAAwB;AACpD,UAAM,cAAc,iBAAiB,eAAe,IAAI;AACxD,UAAM,WAAW;AACjB,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,cAAc;AAEnB,QAAI,MAAM,mBAAmB;AA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AAA,UACvD,aAAa,MAAM,QAAQ,OAAO;AAAA;AAAA,MACnC;AAAA,MAEA,SAAS,YACT,gBAAAA;AAAA,QAAC;AAAA;AAAA,UACA,kBAAkB,CAAC,SAAS,uBAAuB,YAAY,IAAI;AAAA,UACnE,aAAa,MAAM,QAAQ,OAAO;AAAA;AAAA,MACnC;AAAA,MAEA,SAAS,WACT,gBAAAA;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":["codeMatch","message","useMutation","useQueryClient","useQueryClient","useMutation","useMutation","useMutation","useMutation","useQueryClient","useQueryClient","useMutation","useState","Button","jsx","jsxs","jsx","jsx","jsxs","Button","useRef","useState","useForm","Button","jsx","jsxs","useState","useRef","useForm","Button","useState","useForm","CheckCircleIcon","Button","jsx","jsxs","jsx","jsxs","useState","useForm","CheckCircleIcon","Button","useForm","CheckCircleIcon","Button","jsx","jsxs","jsx","jsxs","useForm","CheckCircleIcon","Button","jsx","jsx","jsxs","useState"]}
|
|
@@ -167,10 +167,6 @@ var dateValueToDate = (dateValue) => {
|
|
|
167
167
|
return null;
|
|
168
168
|
}
|
|
169
169
|
};
|
|
170
|
-
function dateOnlyStringFromCalendarValue(dateValue) {
|
|
171
|
-
const date = dateValueToDate(dateValue);
|
|
172
|
-
return date ? toLocalDateString(date) : "";
|
|
173
|
-
}
|
|
174
170
|
var DateEditor = ({ value, onFinishedEditing, dateType: forcedDateType }) => {
|
|
175
171
|
const currentDateValue = typeof value === "string" ? value : "";
|
|
176
172
|
const dateType = resolveDateType(currentDateValue, forcedDateType);
|
|
@@ -304,7 +300,7 @@ var DateEditor = ({ value, onFinishedEditing, dateType: forcedDateType }) => {
|
|
|
304
300
|
step: "1",
|
|
305
301
|
value: formatForInput(dateValue, "time"),
|
|
306
302
|
onChange: (e) => handleTimeChange(e.target.value),
|
|
307
|
-
className: "bg-muted/40 border-border/40 text-foreground w-full rounded-md border px-3 py-2 text-sm outline-none focus:border-
|
|
303
|
+
className: "bg-muted/40 border-border/40 text-foreground w-full rounded-md border px-3 py-2 text-sm outline-none focus-visible:border-ring/60 focus-visible:ring-[3px] focus-visible:ring-ring/35",
|
|
308
304
|
autoFocus: true
|
|
309
305
|
}
|
|
310
306
|
) })
|
|
@@ -327,7 +323,7 @@ var DateEditor = ({ value, onFinishedEditing, dateType: forcedDateType }) => {
|
|
|
327
323
|
step: "1",
|
|
328
324
|
value: dateValue ? new Date(dateValue).toTimeString().split(" ")[0].slice(0, 8) : "",
|
|
329
325
|
onChange: (e) => handleTimeChange(e.target.value),
|
|
330
|
-
className: "bg-muted/40 border-border/40 text-foreground w-full rounded-md border px-2.5 py-1.5 text-sm outline-none focus:border-
|
|
326
|
+
className: "bg-muted/40 border-border/40 text-foreground w-full rounded-md border px-2.5 py-1.5 text-sm outline-none focus-visible:border-ring/60 focus-visible:ring-[3px] focus-visible:ring-ring/35"
|
|
331
327
|
}
|
|
332
328
|
) })
|
|
333
329
|
] })
|
|
@@ -352,7 +348,6 @@ var DateEditor = ({ value, onFinishedEditing, dateType: forcedDateType }) => {
|
|
|
352
348
|
};
|
|
353
349
|
export {
|
|
354
350
|
DateEditor,
|
|
355
|
-
dateOnlyStringFromCalendarValue,
|
|
356
351
|
extractDateOnly,
|
|
357
352
|
formatDate,
|
|
358
353
|
formatForInput,
|
|
@@ -360,4 +355,4 @@ export {
|
|
|
360
355
|
resolveDateType,
|
|
361
356
|
toLocalDateString
|
|
362
357
|
};
|
|
363
|
-
//# sourceMappingURL=date-editor-
|
|
358
|
+
//# sourceMappingURL=date-editor-ZFNDKYBD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/grid/editors/date-editor.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { parseDate as parseAriaDate } from '@internationalized/date';\nimport type { DateValue as DateValueType } from 'react-aria-components';\n\nimport { Button } from '@constructive-io/ui/button';\nimport { Calendar } from '@constructive-io/ui/calendar-rac';\n\nimport { DATE_TIME_TYPES } from '../../cell-types/cell-type-groups';\nimport { sheetsLocale } from '../../utils/sheets-i18n';\n\nimport { EditorFocusTrap } from './editor-focus-trap';\nimport { OVERLAY } from './overlay-presets';\n\nconst TIME_RE = /(\\d{1,2}):(\\d{2})(?::(\\d{2}))?(?:\\.\\d+)?/;\nconst MAC_UA_RE = /Mac|iPod|iPhone|iPad/;\n\nexport type DateEditorType = 'date' | 'datetime' | 'timestamptz' | 'time';\n\nconst DATE_ONLY_RE = /^\\d{4}-\\d{2}-\\d{2}/;\n\nfunction pad2(value: number): string {\n\treturn String(value).padStart(2, '0');\n}\n\n// Format a Date as a calendar date string using LOCAL getters (never UTC).\n// This is the correct serialization for date-only values: the wall-clock day\n// the user picked is preserved regardless of timezone.\nexport function toLocalDateString(d: Date): string {\n\treturn `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;\n}\n\n// If the value is a string whose literal calendar date is already known\n// (starts with YYYY-MM-DD), return that 10-char slice verbatim. Otherwise null.\n// Date-only strings must never round-trip through a Date object.\nexport function extractDateOnly(v: unknown): string | null {\n\tif (typeof v === 'string' && DATE_ONLY_RE.test(v)) {\n\t\treturn v.slice(0, 10);\n\t}\n\treturn null;\n}\n\nfunction normalizeTimeValue(value: unknown): string {\n\tif (value == null) return '';\n\n\tif (value instanceof Date) {\n\t\tif (isNaN(value.getTime())) return '';\n\t\treturn `${pad2(value.getHours())}:${pad2(value.getMinutes())}:${pad2(value.getSeconds())}`;\n\t}\n\n\tconst asString = String(value).trim();\n\tif (!asString) return '';\n\n\t// Match both time-only values and datetime-like values with a time component.\n\tconst match = asString.match(TIME_RE);\n\tif (!match) return '';\n\n\tconst hours = Number(match[1] ?? 0);\n\tconst minutes = Number(match[2] ?? 0);\n\tconst seconds = Number(match[3] ?? 0);\n\tif (\n\t\t!Number.isFinite(hours) ||\n\t\t!Number.isFinite(minutes) ||\n\t\t!Number.isFinite(seconds) ||\n\t\thours < 0 ||\n\t\thours > 23 ||\n\t\tminutes < 0 ||\n\t\tminutes > 59 ||\n\t\tseconds < 0 ||\n\t\tseconds > 59\n\t) {\n\t\treturn '';\n\t}\n\n\treturn `${pad2(hours)}:${pad2(minutes)}:${pad2(seconds)}`;\n}\n\n// Determine date type from cell data or explicit context\nexport const getDateType = (value: any): DateEditorType => {\n\t// Try to infer from the value format\n\tif (typeof value === 'string') {\n\t\tif (value.includes('T') || value.includes(' ')) {\n\t\t\treturn value.includes('+') || value.includes('Z') ? 'timestamptz' : 'datetime';\n\t\t}\n\t\tif (value.includes(':') && !value.includes('-')) {\n\t\t\treturn 'time';\n\t\t}\n\t}\n\treturn 'date'; // Default fallback\n};\n\nexport function resolveDateType(value: unknown, explicitType?: string): DateEditorType {\n\tif (explicitType && DATE_TIME_TYPES.has(explicitType)) {\n\t\treturn explicitType as DateEditorType;\n\t}\n\treturn getDateType(value);\n}\n\n// Format date for display based on type\nexport const formatDate = (val: unknown, dateType: DateEditorType): string => {\n\tif (!val) return '';\n\n\tif (dateType === 'time') {\n\t\tif (typeof val === 'string') {\n\t\t\treturn val.trim();\n\t\t}\n\t\tconst normalized = normalizeTimeValue(val);\n\t\treturn normalized || String(val);\n\t}\n\n\ttry {\n\t\t// Date-only display must use the literal calendar date, never a UTC\n\t\t// conversion (which shifts the day in any UTC+ zone). Prefer the literal\n\t\t// slice and never round-trip a Date.\n\t\tif (dateType === 'date') {\n\t\t\tconst literal = extractDateOnly(val);\n\t\t\tif (literal) return literal;\n\t\t\tif (val instanceof Date) {\n\t\t\t\treturn isNaN(val.getTime()) ? String(val) : toLocalDateString(val);\n\t\t\t}\n\t\t\treturn String(val);\n\t\t}\n\n\t\tlet date: Date;\n\t\tif (val instanceof Date) {\n\t\t\tdate = val;\n\t\t} else if (typeof val === 'string') {\n\t\t\tdate = new Date(val);\n\t\t} else {\n\t\t\treturn String(val);\n\t\t}\n\n\t\tif (isNaN(date.getTime())) return String(val);\n\n\t\tswitch (dateType) {\n\t\t\tcase 'datetime':\n\t\t\tcase 'timestamptz':\n\t\t\t\treturn date.toLocaleDateString(sheetsLocale(), {\n\t\t\t\t\tyear: 'numeric',\n\t\t\t\t\tmonth: 'short',\n\t\t\t\t\tday: 'numeric',\n\t\t\t\t\thour: '2-digit',\n\t\t\t\t\tminute: '2-digit',\n\t\t\t\t\thour12: false,\n\t\t\t\t});\n\t\t\tdefault: {\n\t\t\t\t// Default branch is treated as date-only semantics.\n\t\t\t\tconst literal = extractDateOnly(val);\n\t\t\t\tif (literal) return literal;\n\t\t\t\treturn toLocalDateString(date);\n\t\t\t}\n\t\t}\n\t} catch {\n\t\treturn String(val);\n\t}\n};\n\n// Format date for input based on type\nexport const formatForInput = (val: unknown, inputType: string): string => {\n\tif (!val) return '';\n\n\tif (inputType === 'time') {\n\t\treturn normalizeTimeValue(val);\n\t}\n\n\t// Date-only input must reflect the literal calendar date, never a UTC shift.\n\tif (inputType === 'date') {\n\t\tconst literal = extractDateOnly(val);\n\t\tif (literal) return literal;\n\t\tif (val instanceof Date) {\n\t\t\treturn isNaN(val.getTime()) ? '' : toLocalDateString(val);\n\t\t}\n\t\treturn '';\n\t}\n\n\ttry {\n\t\tlet date: Date;\n\t\tif (val instanceof Date) {\n\t\t\tdate = val;\n\t\t} else if (typeof val === 'string') {\n\t\t\tdate = new Date(val);\n\t\t} else {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (isNaN(date.getTime())) return '';\n\n\t\tswitch (inputType) {\n\t\t\tcase 'datetime-local':\n\t\t\t\treturn date.toISOString().slice(0, 16);\n\t\t\tdefault:\n\t\t\t\treturn '';\n\t\t}\n\t} catch {\n\t\treturn '';\n\t}\n};\n\n// Convert a date input to a DateValue for the calendar.\n// Date-only strings are parsed by their literal calendar date (no Date round-trip),\n// so the calendar seeds on exactly the stored day in any timezone.\nconst dateToDateValue = (date: Date | string | null): DateValueType | null => {\n\tif (!date) return null;\n\n\ttry {\n\t\tconst literal = extractDateOnly(date);\n\t\tif (literal) {\n\t\t\treturn parseAriaDate(literal);\n\t\t}\n\n\t\tconst jsDate = date instanceof Date ? date : new Date(date);\n\t\tif (isNaN(jsDate.getTime())) return null;\n\n\t\treturn parseAriaDate(toLocalDateString(jsDate));\n\t} catch {\n\t\treturn null;\n\t}\n};\n\n// Convert DateValue to JavaScript Date\nconst dateValueToDate = (dateValue: DateValueType | null): Date | null => {\n\tif (!dateValue) return null;\n\n\ttry {\n\t\treturn new Date(dateValue.year, dateValue.month - 1, dateValue.day);\n\t} catch {\n\t\treturn null;\n\t}\n};\n\ninterface DateEditorProps {\n\tvalue: unknown;\n\tonFinishedEditing: (next?: unknown) => void;\n\tdateType?: DateEditorType;\n}\n\nexport const DateEditor: React.FC<DateEditorProps> = ({ value, onFinishedEditing, dateType: forcedDateType }) => {\n\t// Extract current date data from the raw value\n\tconst currentDateValue = typeof value === 'string' ? value : '';\n\tconst dateType = resolveDateType(currentDateValue, forcedDateType);\n\n\tconst [dateValue, setDateValue] = useState<string | Date | null>(currentDateValue);\n\tconst [selectedDate, setSelectedDate] = useState<DateValueType | null>(\n\t\tdateToDateValue(currentDateValue || new Date()),\n\t);\n\n\tconst keyContainerRef = useRef<HTMLDivElement>(null);\n\n\tconst isTimeOnly = dateType === 'time';\n\tconst isDateTimeType = dateType === 'datetime' || dateType === 'timestamptz';\n\n\tconst handleDateSelect = useCallback(\n\t\t(dateValue: DateValueType | readonly DateValueType[] | null) => {\n\t\t\t// The shared Calendar also supports multi-select, so its public\n\t\t\t// callback includes arrays. This editor is intentionally single-date.\n\t\t\tif (Array.isArray(dateValue)) return;\n\t\t\tconst selectedValue = dateValue as DateValueType | null;\n\t\t\tsetSelectedDate(selectedValue);\n\t\t\tconst jsDate = dateValueToDate(selectedValue);\n\n\t\t\tif (jsDate) {\n\t\t\t\t// For datetime types, preserve existing time if available\n\t\t\t\tif (isDateTimeType && currentDateValue) {\n\t\t\t\t\tconst currentDate = new Date(currentDateValue);\n\t\t\t\t\tif (!isNaN(currentDate.getTime())) {\n\t\t\t\t\t\tjsDate.setHours(currentDate.getHours(), currentDate.getMinutes(), currentDate.getSeconds());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsetDateValue(jsDate);\n\t\t\t}\n\t\t},\n\t\t[isDateTimeType, currentDateValue],\n\t);\n\n\tconst handleTimeChange = useCallback(\n\t\t(timeValue: string) => {\n\t\t\tif (!timeValue) return;\n\n\t\t\tif (isTimeOnly) {\n\t\t\t\tconst normalizedTime = normalizeTimeValue(timeValue);\n\t\t\t\tsetDateValue(normalizedTime);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst [hours, minutes, seconds = 0] = timeValue.split(':').map(Number);\n\t\t\tconst targetDate: Date = selectedDate\n\t\t\t\t? dateValueToDate(selectedDate) || new Date()\n\t\t\t\t: currentDateValue\n\t\t\t\t\t? new Date(currentDateValue)\n\t\t\t\t\t: new Date();\n\n\t\t\ttargetDate.setHours(hours || 0, minutes || 0, seconds || 0, 0);\n\t\t\tsetDateValue(targetDate);\n\t\t},\n\t\t[isTimeOnly, selectedDate, currentDateValue],\n\t);\n\n\tconst handleSave = useCallback(() => {\n\t\tlet finalValue: string;\n\n\t\tif (!dateValue) {\n\t\t\tfinalValue = '';\n\t\t} else {\n\t\t\tif (dateType === 'time') {\n\t\t\t\tfinalValue = normalizeTimeValue(dateValue);\n\t\t\t\tif (!finalValue) {\n\t\t\t\t\tfinalValue = String(dateValue).trim();\n\t\t\t\t}\n\t\t\t\treturn onFinishedEditing(finalValue);\n\t\t\t}\n\n\t\t\t// Date-only path: serialize the literal calendar date with LOCAL getters.\n\t\t\t// A UTC conversion (toISOString) shifts the day backwards in any UTC+\n\t\t\t// zone — that is the write corruption this guards against.\n\t\t\tif (dateType === 'date') {\n\t\t\t\tconst literal = extractDateOnly(dateValue);\n\t\t\t\tif (literal) {\n\t\t\t\t\tfinalValue = literal;\n\t\t\t\t} else if (dateValue instanceof Date) {\n\t\t\t\t\tfinalValue = isNaN(dateValue.getTime()) ? '' : toLocalDateString(dateValue);\n\t\t\t\t} else {\n\t\t\t\t\tfinalValue = '';\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst date = dateValue instanceof Date ? dateValue : new Date(dateValue);\n\n\t\t\t\tif (isNaN(date.getTime())) {\n\t\t\t\t\tfinalValue = '';\n\t\t\t\t} else {\n\t\t\t\t\tswitch (dateType) {\n\t\t\t\t\t\tcase 'datetime':\n\t\t\t\t\t\t\tfinalValue = date.toISOString().slice(0, 19); // Remove Z\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'timestamptz':\n\t\t\t\t\t\t\tfinalValue = date.toISOString();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t// Default branch is treated as date-only semantics.\n\t\t\t\t\t\t\tconst literal = extractDateOnly(dateValue);\n\t\t\t\t\t\t\tfinalValue = literal ?? toLocalDateString(date);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Emit the raw formatted date string\n\t\tonFinishedEditing(finalValue);\n\t}, [dateValue, dateType, onFinishedEditing]);\n\n\tconst handleCancel = useCallback(() => {\n\t\tonFinishedEditing();\n\t}, [onFinishedEditing]);\n\n\t// Refs for native key handler\n\tconst actionsRef = useRef({ handleSave, handleCancel });\n\tactionsRef.current = { handleSave, handleCancel };\n\n\t// Native DOM keydown listener — prevents Glide from intercepting keys in portal context\n\tuseEffect(() => {\n\t\tconst el = keyContainerRef.current;\n\t\tif (!el) return;\n\t\tconst handler = (e: KeyboardEvent) => {\n\t\t\tconst { handleSave, handleCancel } = actionsRef.current;\n\n\t\t\tif (e.key === 'Escape') {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t\thandleCancel();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ((e.key === 'Enter' && (e.metaKey || e.ctrlKey)) || (e.key === 's' && (e.metaKey || e.ctrlKey))) {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t\thandleSave();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Stop Tab from reaching Glide\n\t\t\tif (e.key === 'Tab') {\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\t\t};\n\t\tel.addEventListener('keydown', handler);\n\t\treturn () => el.removeEventListener('keydown', handler);\n\t}, []);\n\n\tconst displayValue = formatDate(dateValue, dateType);\n\n\tconst isMac = typeof navigator !== 'undefined' && MAC_UA_RE.test(navigator.userAgent);\n\tconst modKey = isMac ? '⌘' : 'Ctrl';\n\n\treturn (\n\t\t<EditorFocusTrap\n\t\t\tonEscape={handleCancel}\n\t\t\tclassName={`bg-popover ${OVERLAY.sm} rounded-lg border p-2.5 shadow-lg`}\n\t\t>\n\t\t\t<div ref={keyContainerRef}>\n\t\t\t\t{isTimeOnly ? (\n\t\t\t\t\t// Time-only: compact input\n\t\t\t\t\t<div className='space-y-2'>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\ttype='time'\n\t\t\t\t\t\t\tstep='1'\n\t\t\t\t\t\t\tvalue={formatForInput(dateValue, 'time')}\n\t\t\t\t\t\t\tonChange={(e) => handleTimeChange(e.target.value)}\n\t\t\t\t\t\t\tclassName='bg-muted/40 border-border/40 text-foreground w-full rounded-md border px-3 py-2 text-sm outline-none focus-visible:border-ring/60 focus-visible:ring-[3px] focus-visible:ring-ring/35'\n\t\t\t\t\t\t\tautoFocus\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t// Date / DateTime: calendar + optional time\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{/* Selected date display */}\n\t\t\t\t\t\t<div className='text-muted-foreground mb-1 px-1 text-xs font-medium tabular-nums'>\n\t\t\t\t\t\t\t{displayValue || 'No date selected'}\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t{/* Calendar */}\n\t\t\t\t\t\t<Calendar\n\t\t\t\t\t\t\tvalue={selectedDate}\n\t\t\t\t\t\t\tonChange={handleDateSelect}\n\t\t\t\t\t\t\taria-label='Select date'\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t{/* Time input for datetime types */}\n\t\t\t\t\t\t{isDateTimeType && (\n\t\t\t\t\t\t\t<div className='mt-2 px-1'>\n\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\ttype='time'\n\t\t\t\t\t\t\t\t\tstep='1'\n\t\t\t\t\t\t\t\t\tvalue={dateValue ? new Date(dateValue).toTimeString().split(' ')[0].slice(0, 8) : ''}\n\t\t\t\t\t\t\t\t\tonChange={(e) => handleTimeChange(e.target.value)}\n\t\t\t\t\t\t\t\t\tclassName='bg-muted/40 border-border/40 text-foreground w-full rounded-md border px-2.5 py-1.5 text-sm outline-none focus-visible:border-ring/60 focus-visible:ring-[3px] focus-visible:ring-ring/35'\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\n\t\t\t\t{/* Footer — hints + save */}\n\t\t\t\t<div className='mt-3 flex items-center justify-between gap-4 border-t px-1 pt-2.5'>\n\t\t\t\t\t<div className='text-muted-foreground flex items-center gap-3 text-xs'>\n\t\t\t\t\t\t<span className='inline-flex shrink-0 items-center gap-1'>\n\t\t\t\t\t\t\t<kbd className='bg-muted/60 border-border/40 inline-flex min-h-5 min-w-5 items-center justify-center rounded border font-sans text-[11px] leading-tight'>{modKey}</kbd>\n\t\t\t\t\t\t\t<kbd className='bg-muted/60 border-border/40 inline-flex min-h-5 min-w-5 items-center justify-center rounded border font-sans text-[11px] leading-tight'>↵</kbd>\n\t\t\t\t\t\t\t<span>save</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span className='inline-flex shrink-0 items-center gap-1'>\n\t\t\t\t\t\t\t<kbd className='bg-muted/60 border-border/40 inline-flex min-h-5 items-center justify-center rounded border px-1.5 font-sans text-[11px] leading-tight'>Esc</kbd>\n\t\t\t\t\t\t\t<span>cancel</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<Button onClick={handleSave} size='xs' variant='default' className='shrink-0'>\n\t\t\t\t\t\tSave\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</EditorFocusTrap>\n\t);\n};\n"],"mappings":";;;;;;;;;;;AAAA,SAAgB,aAAa,WAAW,QAAQ,gBAAgB;AAChE,SAAS,aAAa,qBAAqB;AAG3C,SAAS,cAAc;AACvB,SAAS,gBAAgB;AA0YnB,cAWD,YAXC;AAlYN,IAAM,UAAU;AAChB,IAAM,YAAY;AAIlB,IAAM,eAAe;AAErB,SAAS,KAAK,OAAuB;AACpC,SAAO,OAAO,KAAK,EAAE,SAAS,GAAG,GAAG;AACrC;AAKO,SAAS,kBAAkB,GAAiB;AAClD,SAAO,GAAG,EAAE,YAAY,CAAC,IAAI,KAAK,EAAE,SAAS,IAAI,CAAC,CAAC,IAAI,KAAK,EAAE,QAAQ,CAAC,CAAC;AACzE;AAKO,SAAS,gBAAgB,GAA2B;AAC1D,MAAI,OAAO,MAAM,YAAY,aAAa,KAAK,CAAC,GAAG;AAClD,WAAO,EAAE,MAAM,GAAG,EAAE;AAAA,EACrB;AACA,SAAO;AACR;AAEA,SAAS,mBAAmB,OAAwB;AACnD,MAAI,SAAS,KAAM,QAAO;AAE1B,MAAI,iBAAiB,MAAM;AAC1B,QAAI,MAAM,MAAM,QAAQ,CAAC,EAAG,QAAO;AACnC,WAAO,GAAG,KAAK,MAAM,SAAS,CAAC,CAAC,IAAI,KAAK,MAAM,WAAW,CAAC,CAAC,IAAI,KAAK,MAAM,WAAW,CAAC,CAAC;AAAA,EACzF;AAEA,QAAM,WAAW,OAAO,KAAK,EAAE,KAAK;AACpC,MAAI,CAAC,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