@mesob/auth-react 0.0.5 → 0.0.6

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.
@@ -38,7 +38,7 @@ var ForgotPassword = ({
38
38
  const handleSubmit = form.handleSubmit(async (values) => {
39
39
  await onSubmit(values);
40
40
  });
41
- return /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "space-y-5", children: [
41
+ return /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
42
42
  /* @__PURE__ */ jsx(
43
43
  FormField,
44
44
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/auth/forgot-password.tsx"],"sourcesContent":["'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { Button } from '@mesob/ui/components/button';\nimport {\n Form,\n FormControl,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '@mesob/ui/components/form';\nimport { Input } from '@mesob/ui/components/input';\nimport { Spinner } from '@mesob/ui/components/spinner';\nimport { useTranslations } from 'next-intl';\nimport { useMemo } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { z } from 'zod';\n\ntype ForgotPasswordFormValues = {\n account: string;\n};\n\ntype ForgotPasswordProps = {\n onSubmit: (values: ForgotPasswordFormValues) => Promise<void> | void;\n isLoading?: boolean;\n onBack?: () => void;\n};\n\nexport const ForgotPassword = ({\n onSubmit,\n isLoading = false,\n}: ForgotPasswordProps) => {\n const t = useTranslations('Auth.forgotPassword');\n const forgotPasswordSchema = useMemo(\n () =>\n z.object({\n account: z.string().min(1, t('errors.accountRequired')),\n }),\n [t],\n );\n\n const form = useForm<ForgotPasswordFormValues>({\n resolver: zodResolver(forgotPasswordSchema),\n defaultValues: {\n account: '',\n },\n });\n\n const handleSubmit = form.handleSubmit(async (values) => {\n await onSubmit(values);\n });\n\n return (\n <Form {...form}>\n <form onSubmit={handleSubmit} className=\"space-y-5\">\n <FormField\n control={form.control}\n name=\"account\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.accountLabel')}</FormLabel>\n <FormControl>\n <Input\n type=\"text\"\n placeholder={t('form.accountPlaceholder')}\n {...field}\n />\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading && <Spinner />}\n {isLoading ? t('form.submitting') : t('form.submit')}\n </Button>\n </form>\n </Form>\n );\n};\n"],"mappings":";;;AAEA,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,uBAAuB;AAChC,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,SAAS;AA2CN,SACE,KADF;AA/BL,IAAM,iBAAiB,CAAC;AAAA,EAC7B;AAAA,EACA,YAAY;AACd,MAA2B;AACzB,QAAM,IAAI,gBAAgB,qBAAqB;AAC/C,QAAM,uBAAuB;AAAA,IAC3B,MACE,EAAE,OAAO;AAAA,MACP,SAAS,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,wBAAwB,CAAC;AAAA,IACxD,CAAC;AAAA,IACH,CAAC,CAAC;AAAA,EACJ;AAEA,QAAM,OAAO,QAAkC;AAAA,IAC7C,UAAU,YAAY,oBAAoB;AAAA,IAC1C,eAAe;AAAA,MACb,SAAS;AAAA,IACX;AAAA,EACF,CAAC;AAED,QAAM,eAAe,KAAK,aAAa,OAAO,WAAW;AACvD,UAAM,SAAS,MAAM;AAAA,EACvB,CAAC;AAED,SACE,oBAAC,QAAM,GAAG,MACR,+BAAC,UAAK,UAAU,cAAc,WAAU,aACtC;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,SAAS,KAAK;AAAA,QACd,MAAK;AAAA,QACL,QAAQ,CAAC,EAAE,MAAM,MACf,qBAAC,YACC;AAAA,8BAAC,aAAW,YAAE,mBAAmB,GAAE;AAAA,UACnC,oBAAC,eACC;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,aAAa,EAAE,yBAAyB;AAAA,cACvC,GAAG;AAAA;AAAA,UACN,GACF;AAAA,UACA,oBAAC,eAAY;AAAA,WACf;AAAA;AAAA,IAEJ;AAAA,IACA,qBAAC,UAAO,MAAK,UAAS,WAAU,UAAS,UAAU,WAChD;AAAA,mBAAa,oBAAC,WAAQ;AAAA,MACtB,YAAY,EAAE,iBAAiB,IAAI,EAAE,aAAa;AAAA,OACrD;AAAA,KACF,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/auth/forgot-password.tsx"],"sourcesContent":["'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { Button } from '@mesob/ui/components/button';\nimport {\n Form,\n FormControl,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '@mesob/ui/components/form';\nimport { Input } from '@mesob/ui/components/input';\nimport { Spinner } from '@mesob/ui/components/spinner';\nimport { useTranslations } from 'next-intl';\nimport { useMemo } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { z } from 'zod';\n\ntype ForgotPasswordFormValues = {\n account: string;\n};\n\ntype ForgotPasswordProps = {\n onSubmit: (values: ForgotPasswordFormValues) => Promise<void> | void;\n isLoading?: boolean;\n onBack?: () => void;\n};\n\nexport const ForgotPassword = ({\n onSubmit,\n isLoading = false,\n}: ForgotPasswordProps) => {\n const t = useTranslations('Auth.forgotPassword');\n const forgotPasswordSchema = useMemo(\n () =>\n z.object({\n account: z.string().min(1, t('errors.accountRequired')),\n }),\n [t],\n );\n\n const form = useForm<ForgotPasswordFormValues>({\n resolver: zodResolver(forgotPasswordSchema),\n defaultValues: {\n account: '',\n },\n });\n\n const handleSubmit = form.handleSubmit(async (values) => {\n await onSubmit(values);\n });\n\n return (\n <Form {...form}>\n <form onSubmit={handleSubmit} className=\"space-y-4\">\n <FormField\n control={form.control}\n name=\"account\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.accountLabel')}</FormLabel>\n <FormControl>\n <Input\n type=\"text\"\n placeholder={t('form.accountPlaceholder')}\n {...field}\n />\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading && <Spinner />}\n {isLoading ? t('form.submitting') : t('form.submit')}\n </Button>\n </form>\n </Form>\n );\n};\n"],"mappings":";;;AAEA,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,uBAAuB;AAChC,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,SAAS;AA2CN,SACE,KADF;AA/BL,IAAM,iBAAiB,CAAC;AAAA,EAC7B;AAAA,EACA,YAAY;AACd,MAA2B;AACzB,QAAM,IAAI,gBAAgB,qBAAqB;AAC/C,QAAM,uBAAuB;AAAA,IAC3B,MACE,EAAE,OAAO;AAAA,MACP,SAAS,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,wBAAwB,CAAC;AAAA,IACxD,CAAC;AAAA,IACH,CAAC,CAAC;AAAA,EACJ;AAEA,QAAM,OAAO,QAAkC;AAAA,IAC7C,UAAU,YAAY,oBAAoB;AAAA,IAC1C,eAAe;AAAA,MACb,SAAS;AAAA,IACX;AAAA,EACF,CAAC;AAED,QAAM,eAAe,KAAK,aAAa,OAAO,WAAW;AACvD,UAAM,SAAS,MAAM;AAAA,EACvB,CAAC;AAED,SACE,oBAAC,QAAM,GAAG,MACR,+BAAC,UAAK,UAAU,cAAc,WAAU,aACtC;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,SAAS,KAAK;AAAA,QACd,MAAK;AAAA,QACL,QAAQ,CAAC,EAAE,MAAM,MACf,qBAAC,YACC;AAAA,8BAAC,aAAW,YAAE,mBAAmB,GAAE;AAAA,UACnC,oBAAC,eACC;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,aAAa,EAAE,yBAAyB;AAAA,cACvC,GAAG;AAAA;AAAA,UACN,GACF;AAAA,UACA,oBAAC,eAAY;AAAA,WACf;AAAA;AAAA,IAEJ;AAAA,IACA,qBAAC,UAAO,MAAK,UAAS,WAAU,UAAS,UAAU,WAChD;AAAA,mBAAa,oBAAC,WAAQ;AAAA,MACtB,YAAY,EAAE,iBAAiB,IAAI,EAAE,aAAa;AAAA,OACrD;AAAA,KACF,GACF;AAEJ;","names":[]}
@@ -193,7 +193,7 @@ var ForgotPassword = ({
193
193
  const handleSubmit = form.handleSubmit(async (values) => {
194
194
  await onSubmit(values);
195
195
  });
196
- return /* @__PURE__ */ jsx3(Form, { ...form, children: /* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className: "space-y-5", children: [
196
+ return /* @__PURE__ */ jsx3(Form, { ...form, children: /* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
197
197
  /* @__PURE__ */ jsx3(
198
198
  FormField,
199
199
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/auth/pages/forgot-password-page.tsx","../../../../src/context/auth-provider.tsx","../../../../src/client.ts","../../../../src/constants/auth.error.codes.ts","../../../../src/utils/handle-error.ts","../../../../src/components/auth/auth-page-layout.tsx","../../../../src/components/auth/forgot-password.tsx"],"sourcesContent":["'use client';\n\nimport { useTranslations } from 'next-intl';\nimport type { ComponentProps } from 'react';\nimport { useState } from 'react';\nimport { useAuth } from '../../../context/auth-provider';\nimport type { AuthErrorContent } from '../../../utils/handle-error';\nimport { handleError } from '../../../utils/handle-error';\n\nimport { AuthPageLayout } from '../auth-page-layout';\nimport { ForgotPassword } from '../forgot-password';\n\ntype ForgotPasswordPageProps = {\n locale?: string;\n onNavigate: (path: string) => void;\n linkComponent?: React.ComponentType<ComponentProps<'a'> & { href: string }>;\n links?: {\n signIn?: string;\n };\n logoImage?: string;\n};\n\nexport const ForgotPasswordPage = ({\n onNavigate,\n linkComponent: Link,\n links,\n logoImage,\n}: ForgotPasswordPageProps) => {\n const t = useTranslations('Auth.forgotPassword');\n const { client } = useAuth();\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<AuthErrorContent | null>(null);\n\n const signInLink = links?.signIn || '/auth/sign-in';\n\n const handleSubmit = async (values: { account: string }) => {\n setIsLoading(true);\n setError(null);\n\n try {\n const res = await client.forgotPassword({ identifier: values.account });\n\n if ('verificationId' in res && res.verificationId) {\n onNavigate(`/auth/reset-password?verificationId=${res.verificationId}`);\n } else {\n onNavigate(\n `/auth/reset-password?identifier=${encodeURIComponent(values.account)}`,\n );\n }\n } catch (err) {\n handleError(err, setError, t);\n } finally {\n setIsLoading(false);\n }\n };\n\n const handleBack = () => {\n onNavigate(signInLink);\n };\n\n return (\n <AuthPageLayout\n title={t('title')}\n description={t('description')}\n error={error}\n logoImage={logoImage}\n footer={\n Link ? (\n <Link href={signInLink} className=\"text-primary hover:underline\">\n {t('footer.backToSignIn')}\n </Link>\n ) : (\n <a\n href={signInLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(signInLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {t('footer.backToSignIn')}\n </a>\n )\n }\n >\n <ForgotPassword\n onSubmit={handleSubmit}\n isLoading={isLoading}\n onBack={handleBack}\n />\n </AuthPageLayout>\n );\n};\n","'use client';\n\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport type { AuthClient } from '../client';\nimport type { AuthResponse, Session, User } from '../types';\n\ntype AuthContextValue = {\n user: User | null;\n session: Session | null;\n loading: boolean;\n error: Error | null;\n client: AuthClient;\n refresh: () => Promise<void>;\n setAuth: (data: AuthResponse) => void;\n};\n\nconst AuthContext = createContext<AuthContextValue | null>(null);\n\nexport const useAuth = () => {\n const context = useContext(AuthContext);\n if (!context) {\n throw new Error('useAuth must be used within AuthProvider');\n }\n return context;\n};\n\ntype AuthProviderProps = {\n client: AuthClient;\n children: ReactNode;\n};\n\nexport const AuthProvider = ({ client, children }: AuthProviderProps) => {\n const [user, setUser] = useState<User | null>(null);\n const [session, setSession] = useState<Session | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const refresh = useCallback(async () => {\n try {\n setLoading(true);\n setError(null);\n const data = await client.getSession();\n setUser(data.user);\n setSession(data.session);\n } catch (err) {\n setError(\n err instanceof Error ? err : new Error('Failed to fetch session'),\n );\n setUser(null);\n setSession(null);\n } finally {\n setLoading(false);\n }\n }, [client]);\n\n const setAuth = useCallback((data: AuthResponse) => {\n setUser(data.user);\n setSession(data.session);\n setError(null);\n setLoading(false);\n }, []);\n\n useEffect(() => {\n refresh();\n }, [refresh]);\n\n return (\n <AuthContext.Provider\n value={{\n user,\n session,\n loading,\n error,\n client,\n refresh,\n setAuth,\n }}\n >\n {children}\n </AuthContext.Provider>\n );\n};\n","import type {\n AuthErrorCode,\n AuthErrorResponse,\n AuthResponse,\n PendingAccountChangeResponse,\n SessionResponse,\n User,\n VerificationResponse,\n} from './types';\n\n// Backend returns error code in 'error' field (AUTH_ERRORS values)\n// or in 'code' field, message in 'message' or 'error' field\nconst validErrorCodes: readonly AuthErrorCode[] = [\n 'USER_NOT_FOUND',\n 'INVALID_PASSWORD',\n 'USER_EXISTS',\n 'VERIFICATION_EXPIRED',\n 'VERIFICATION_MISMATCH',\n 'VERIFICATION_NOT_FOUND',\n 'TOO_MANY_ATTEMPTS',\n 'REQUIRES_VERIFICATION',\n 'UNAUTHORIZED',\n 'ACCESS_DENIED',\n 'HAS_NO_PASSWORD',\n] as const;\n\nexport class AuthError extends Error {\n code?: AuthErrorCode;\n status?: number;\n details?: Record<string, unknown>;\n\n constructor(\n message: string,\n code?: AuthErrorCode,\n status?: number,\n details?: Record<string, unknown>,\n ) {\n super(message);\n this.name = 'AuthError';\n this.code = code;\n this.status = status;\n this.details = details;\n }\n}\n\nexport type AuthClientConfig = {\n baseURL: string;\n};\n\nexport class AuthClient {\n private baseURL: string;\n\n constructor(config: AuthClientConfig) {\n this.baseURL = config.baseURL.replace(/\\/$/, '');\n }\n\n private async request<T>(\n endpoint: string,\n options: RequestInit = {},\n ): Promise<T> {\n const url = `${this.baseURL}${endpoint}`;\n const response = await fetch(url, {\n ...options,\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n if (!response.ok) {\n const text = await response.text();\n let errorData: AuthErrorResponse;\n try {\n errorData = JSON.parse(text);\n } catch {\n errorData = { error: 'Unknown error', message: text };\n }\n\n // Extract error code from code, error, or message field\n // Backend returns error codes in 'error' field (e.g., { error: 'INVALID_PASSWORD' })\n const potentialCode =\n errorData.code ||\n (typeof errorData.error === 'string' ? errorData.error : null) ||\n (typeof errorData.message === 'string' ? errorData.message : null);\n const upperCode = potentialCode?.toUpperCase().trim();\n const errorCode =\n upperCode && validErrorCodes.includes(upperCode as AuthErrorCode)\n ? (upperCode as AuthErrorCode)\n : undefined;\n const errorMessage =\n errorData.message || errorData.error || 'Request failed';\n\n throw new AuthError(\n errorMessage,\n errorCode as AuthErrorCode | undefined,\n response.status,\n errorData.details,\n );\n }\n\n const data = await response.json();\n return data;\n }\n\n signUpWithEmail(data: {\n email: string;\n password: string;\n fullName: string;\n handle?: string;\n }): Promise<AuthResponse | VerificationResponse> {\n return this.request<AuthResponse | VerificationResponse>('/sign-up', {\n method: 'POST',\n body: JSON.stringify({\n email: data.email,\n password: data.password,\n fullName: data.fullName,\n handle: data.handle,\n }),\n });\n }\n\n signUpWithPhone(data: {\n phone: string;\n password: string;\n fullName: string;\n handle?: string;\n }): Promise<AuthResponse | VerificationResponse> {\n return this.request<AuthResponse | VerificationResponse>('/sign-up', {\n method: 'POST',\n body: JSON.stringify({\n phone: data.phone,\n password: data.password,\n fullName: data.fullName,\n handle: data.handle,\n }),\n });\n }\n\n checkUser(data: { identifier: string }): Promise<{ exists: boolean }> {\n return this.request<{ exists: boolean }>('/check-user', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n signInWithPassword(data: {\n identifier: string;\n password: string;\n }): Promise<AuthResponse | VerificationResponse> {\n return this.request<AuthResponse | VerificationResponse>('/sign-in', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n signOut(): Promise<{ message: string }> {\n return this.request<{ message: string }>('/sign-out', {\n method: 'POST',\n });\n }\n\n requestEmailVerification(data?: {\n email?: string;\n }): Promise<{ verificationId: string }> {\n return this.request<{ verificationId: string }>(\n '/email/verification/request',\n {\n method: 'POST',\n body: JSON.stringify(data || {}),\n },\n );\n }\n\n verifyEmail(data: {\n verificationId: string;\n code: string;\n }): Promise<AuthResponse> {\n return this.request<AuthResponse>('/email/verification/confirm', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n resendVerification(_verificationId: string): Promise<{\n verificationId: string;\n }> {\n // For email, request new verification\n return this.requestEmailVerification();\n }\n\n requestPhoneOtp(data: {\n phone: string;\n context: 'sign-up' | 'sign-in' | 'change-phone';\n }): Promise<{ verificationId: string }> {\n return this.request<{ verificationId: string }>(\n '/phone/verification/request',\n {\n method: 'POST',\n body: JSON.stringify(data),\n },\n );\n }\n\n verifyPhoneOtp(data: {\n verificationId: string;\n code: string;\n context: 'sign-up' | 'sign-in' | 'change-phone';\n }): Promise<\n AuthResponse | { user: User | null; session: null; verified: boolean }\n > {\n return this.request('/phone/verification/confirm', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n forgotPassword(data: { identifier: string }): Promise<{\n message: string;\n }> {\n return this.request<{ message: string }>('/password/forgot', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n resetPassword(data: {\n verificationId: string;\n code: string;\n password: string;\n }): Promise<AuthResponse> {\n return this.request<AuthResponse>('/password/reset', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n verifyPassword(data: { password: string }): Promise<{ message: string }> {\n return this.request<{ message: string }>('/password/verify', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n changePassword(data: {\n currentPassword: string;\n newPassword: string;\n }): Promise<{ message: string }> {\n return this.request<{ message: string }>('/password/change', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n getSession(): Promise<SessionResponse> {\n return this.request<SessionResponse>('/session', {\n method: 'GET',\n });\n }\n\n getPendingAccountChange(): Promise<PendingAccountChangeResponse> {\n return this.request<PendingAccountChangeResponse>(\n '/account-change/pending',\n {\n method: 'GET',\n },\n );\n }\n\n updateProfile(data: { fullName?: string }): Promise<{ user: User }> {\n return this.request<{ user: User }>('/profile', {\n method: 'PUT',\n body: JSON.stringify(data),\n });\n }\n\n updateEmail(data: { email: string }): Promise<{ user: User }> {\n return this.request<{ user: User }>('/profile/email', {\n method: 'PUT',\n body: JSON.stringify(data),\n });\n }\n\n updatePhone(data: { phone: string }): Promise<{ user: User }> {\n return this.request<{ user: User }>('/profile/phone', {\n method: 'PUT',\n body: JSON.stringify(data),\n });\n }\n}\n","export const AUTH_ERROR_MAPPING: Record<\n string,\n { title: string; description: string }\n> = {\n USER_NOT_FOUND: {\n title: 'Account Not Found',\n description:\n 'We could not find an account with that identifier. Please check your spelling or sign up.',\n },\n INVALID_PASSWORD: {\n title: 'Invalid Password',\n description: 'The password you entered is incorrect. Please try again.',\n },\n USER_EXISTS: {\n title: 'Account Already Exists',\n description:\n 'An account with this identifier already exists. Please sign in instead.',\n },\n VERIFICATION_EXPIRED: {\n title: 'Verification Expired',\n description:\n 'The verification code or link has expired. Please request a new one.',\n },\n VERIFICATION_MISMATCH: {\n title: 'Invalid Code',\n description:\n 'The verification code you entered is invalid. Please double-check and try again.',\n },\n VERIFICATION_NOT_FOUND: {\n title: 'Verification Not Found',\n description:\n 'We could not find a pending verification request. Please restart the process.',\n },\n TOO_MANY_ATTEMPTS: {\n title: 'Too Many Attempts',\n description:\n 'You have made too many requests recently. Please wait a moment before trying again.',\n },\n REQUIRES_VERIFICATION: {\n title: 'Verification Required',\n description:\n 'You need to verify your account before you can continue. Please check your email or phone.',\n },\n UNAUTHORIZED: {\n title: 'Unauthorized',\n description:\n 'You are not authorized to perform this action. Please sign in again.',\n },\n ACCESS_DENIED: {\n title: 'Access Denied',\n description:\n 'You do not have permission to access this resource. Please contact support if you believe this is an error.',\n },\n HAS_NO_PASSWORD: {\n title: 'No Password Set',\n description:\n 'Your account does not have a password set (e.g. social login). Please sign in with your provider or reset your password.',\n },\n};\n\nexport const validCodes = Object.keys(AUTH_ERROR_MAPPING);\n","import type { _Translator } from 'next-intl';\nimport { AuthError } from '../client';\nimport { AUTH_ERROR_MAPPING, validCodes } from '../constants/auth.error.codes';\n\nexport type AuthErrorContent = {\n title: string;\n description: string;\n};\n\nexport const handleError = (\n err: any,\n setError: (error: AuthErrorContent | null) => void,\n t: _Translator<Record<string, any>, string>,\n) => {\n if (err instanceof AuthError) {\n let errorCode = '';\n\n if (err.code && validCodes.includes(err.code)) {\n errorCode = err.code;\n } else if (err.message) {\n const messageUpper = err.message.toUpperCase().trim();\n if (validCodes.includes(messageUpper)) {\n errorCode = messageUpper;\n }\n }\n\n if (errorCode && AUTH_ERROR_MAPPING[errorCode]) {\n const mapping = AUTH_ERROR_MAPPING[errorCode];\n // Try to translate the description if a key exists, otherwise use English fallback\n // Since mapping.description is English text, we might want to check if there is a translation key\n // But for now, let's use the provided English mapping or try to find a translation if the key matches 'errors.code'\n\n // We can try to lookup translation, if it returns the key (or fallback), we might prefer the mapping text (which is nice English).\n // However, usually we prefer translation.\n // Let's rely on the mapping text primarily as per the request to \"Generate a description and title...\".\n // But if we want i18n support, we should probably add keys.\n // Given the prompt \"Generate a description... for each error code... and display\",\n // I will prioritize the static mapping I just created, but allows future i18n improvement.\n\n setError({\n title: mapping.title,\n description: mapping.description,\n });\n return;\n }\n\n // Fallback for AuthError without known code\n setError({\n title: t('errors.fallback'), // or 'Error'\n description: err.message || t('errors.fallback'),\n });\n } else {\n // Generic error\n const message = err instanceof Error ? err.message : t('errors.fallback');\n setError({\n title: 'Error',\n description: message,\n });\n }\n};\n","'use client';\n\nimport {\n Alert,\n AlertDescription,\n AlertTitle,\n} from '@mesob/ui/components/alert';\nimport { IconAlertCircle } from '@tabler/icons-react';\nimport type { ReactNode } from 'react';\nimport type { AuthErrorContent } from '../../utils/handle-error';\n\ntype AuthPageLayoutProps = {\n title: string;\n description?: string;\n children: ReactNode;\n error?: AuthErrorContent | string | null;\n footer?: ReactNode;\n logoImage?: string;\n};\n\nexport const AuthPageLayout = ({\n title,\n description,\n children,\n error,\n footer,\n logoImage,\n}: AuthPageLayoutProps) => {\n const errorContent: AuthErrorContent | null = error\n ? // biome-ignore lint/style/noNestedTernary: <explanation>\n typeof error === 'string'\n ? { title: 'Error', description: error }\n : error\n : null;\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex size-8 mb-6 w-full items-center justify-center rounded-md\">\n {/** biome-ignore lint/performance/noImgElement: logo image */}\n <img src={logoImage || ''} alt=\"Jiret\" width={42} height={42} />\n </div>\n <div className=\"text-center\">\n <h1 className=\"text-2xl font-bold tracking-tight\">{title}</h1>\n {description && (\n <p className=\"mt-2 text-sm text-muted-foreground\">{description}</p>\n )}\n </div>\n\n {children}\n\n {errorContent && (\n <Alert variant=\"destructive\">\n <IconAlertCircle className=\"h-4 w-4\" />\n <AlertTitle>{errorContent.title}</AlertTitle>\n <AlertDescription>{errorContent.description}</AlertDescription>\n </Alert>\n )}\n <div className=\"mt-2 w-full\">\n {footer && (\n <div className=\"w-full text-center text-sm text-muted-foreground\">\n {footer}\n </div>\n )}\n </div>\n </div>\n );\n};\n","'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { Button } from '@mesob/ui/components/button';\nimport {\n Form,\n FormControl,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '@mesob/ui/components/form';\nimport { Input } from '@mesob/ui/components/input';\nimport { Spinner } from '@mesob/ui/components/spinner';\nimport { useTranslations } from 'next-intl';\nimport { useMemo } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { z } from 'zod';\n\ntype ForgotPasswordFormValues = {\n account: string;\n};\n\ntype ForgotPasswordProps = {\n onSubmit: (values: ForgotPasswordFormValues) => Promise<void> | void;\n isLoading?: boolean;\n onBack?: () => void;\n};\n\nexport const ForgotPassword = ({\n onSubmit,\n isLoading = false,\n}: ForgotPasswordProps) => {\n const t = useTranslations('Auth.forgotPassword');\n const forgotPasswordSchema = useMemo(\n () =>\n z.object({\n account: z.string().min(1, t('errors.accountRequired')),\n }),\n [t],\n );\n\n const form = useForm<ForgotPasswordFormValues>({\n resolver: zodResolver(forgotPasswordSchema),\n defaultValues: {\n account: '',\n },\n });\n\n const handleSubmit = form.handleSubmit(async (values) => {\n await onSubmit(values);\n });\n\n return (\n <Form {...form}>\n <form onSubmit={handleSubmit} className=\"space-y-5\">\n <FormField\n control={form.control}\n name=\"account\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.accountLabel')}</FormLabel>\n <FormControl>\n <Input\n type=\"text\"\n placeholder={t('form.accountPlaceholder')}\n {...field}\n />\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading && <Spinner />}\n {isLoading ? t('form.submitting') : t('form.submit')}\n </Button>\n </form>\n </Form>\n );\n};\n"],"mappings":";;;AAEA,SAAS,mBAAAA,wBAAuB;AAEhC,SAAS,YAAAC,iBAAgB;;;ACFzB;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAiEH;AAnDJ,IAAM,cAAc,cAAuC,IAAI;AAExD,IAAM,UAAU,MAAM;AAC3B,QAAM,UAAU,WAAW,WAAW;AACtC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,0CAA0C;AAAA,EAC5D;AACA,SAAO;AACT;;;ACLO,IAAM,YAAN,cAAwB,MAAM;AA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AChB,aAAa,EAAE,aAAa;AAAA,MAC5B;AAAA,MACA;AAAA,MACA,QACE,OACE,gBAAAA,KAAC,QAAK,MAAM,YAAY,WAAU,gCAC/B,YAAE,qBAAqB,GAC1B,IAEA,gBAAAA;AAAA,QAAC;AAAA;AAAA,UACC,MAAM;AAAA,UACN,SAAS,CAAC,MAAM;AACd,cAAE,eAAe;AACjB,uBAAW,UAAU;AAAA,UACvB;AAAA,UACA,WAAU;AAAA,UAET,YAAE,qBAAqB;AAAA;AAAA,MAC1B;AAAA,MAIJ,0BAAAA;AAAA,QAAC;AAAA;AAAA,UACC,UAAU;AAAA,UACV;AAAA,UACA,QAAQ;AAAA;AAAA,MACV;AAAA;AAAA,EACF;AAEJ;","names":["useTranslations","useState","jsx","jsx","jsxs","jsx","useTranslations","useState"]}
1
+ {"version":3,"sources":["../../../../src/components/auth/pages/forgot-password-page.tsx","../../../../src/context/auth-provider.tsx","../../../../src/client.ts","../../../../src/constants/auth.error.codes.ts","../../../../src/utils/handle-error.ts","../../../../src/components/auth/auth-page-layout.tsx","../../../../src/components/auth/forgot-password.tsx"],"sourcesContent":["'use client';\n\nimport { useTranslations } from 'next-intl';\nimport type { ComponentProps } from 'react';\nimport { useState } from 'react';\nimport { useAuth } from '../../../context/auth-provider';\nimport type { AuthErrorContent } from '../../../utils/handle-error';\nimport { handleError } from '../../../utils/handle-error';\n\nimport { AuthPageLayout } from '../auth-page-layout';\nimport { ForgotPassword } from '../forgot-password';\n\ntype ForgotPasswordPageProps = {\n locale?: string;\n onNavigate: (path: string) => void;\n linkComponent?: React.ComponentType<ComponentProps<'a'> & { href: string }>;\n links?: {\n signIn?: string;\n };\n logoImage?: string;\n};\n\nexport const ForgotPasswordPage = ({\n onNavigate,\n linkComponent: Link,\n links,\n logoImage,\n}: ForgotPasswordPageProps) => {\n const t = useTranslations('Auth.forgotPassword');\n const { client } = useAuth();\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<AuthErrorContent | null>(null);\n\n const signInLink = links?.signIn || '/auth/sign-in';\n\n const handleSubmit = async (values: { account: string }) => {\n setIsLoading(true);\n setError(null);\n\n try {\n const res = await client.forgotPassword({ identifier: values.account });\n\n if ('verificationId' in res && res.verificationId) {\n onNavigate(`/auth/reset-password?verificationId=${res.verificationId}`);\n } else {\n onNavigate(\n `/auth/reset-password?identifier=${encodeURIComponent(values.account)}`,\n );\n }\n } catch (err) {\n handleError(err, setError, t);\n } finally {\n setIsLoading(false);\n }\n };\n\n const handleBack = () => {\n onNavigate(signInLink);\n };\n\n return (\n <AuthPageLayout\n title={t('title')}\n description={t('description')}\n error={error}\n logoImage={logoImage}\n footer={\n Link ? (\n <Link href={signInLink} className=\"text-primary hover:underline\">\n {t('footer.backToSignIn')}\n </Link>\n ) : (\n <a\n href={signInLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(signInLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {t('footer.backToSignIn')}\n </a>\n )\n }\n >\n <ForgotPassword\n onSubmit={handleSubmit}\n isLoading={isLoading}\n onBack={handleBack}\n />\n </AuthPageLayout>\n );\n};\n","'use client';\n\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport type { AuthClient } from '../client';\nimport type { AuthResponse, Session, User } from '../types';\n\ntype AuthContextValue = {\n user: User | null;\n session: Session | null;\n loading: boolean;\n error: Error | null;\n client: AuthClient;\n refresh: () => Promise<void>;\n setAuth: (data: AuthResponse) => void;\n};\n\nconst AuthContext = createContext<AuthContextValue | null>(null);\n\nexport const useAuth = () => {\n const context = useContext(AuthContext);\n if (!context) {\n throw new Error('useAuth must be used within AuthProvider');\n }\n return context;\n};\n\ntype AuthProviderProps = {\n client: AuthClient;\n children: ReactNode;\n};\n\nexport const AuthProvider = ({ client, children }: AuthProviderProps) => {\n const [user, setUser] = useState<User | null>(null);\n const [session, setSession] = useState<Session | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const refresh = useCallback(async () => {\n try {\n setLoading(true);\n setError(null);\n const data = await client.getSession();\n setUser(data.user);\n setSession(data.session);\n } catch (err) {\n setError(\n err instanceof Error ? err : new Error('Failed to fetch session'),\n );\n setUser(null);\n setSession(null);\n } finally {\n setLoading(false);\n }\n }, [client]);\n\n const setAuth = useCallback((data: AuthResponse) => {\n setUser(data.user);\n setSession(data.session);\n setError(null);\n setLoading(false);\n }, []);\n\n useEffect(() => {\n refresh();\n }, [refresh]);\n\n return (\n <AuthContext.Provider\n value={{\n user,\n session,\n loading,\n error,\n client,\n refresh,\n setAuth,\n }}\n >\n {children}\n </AuthContext.Provider>\n );\n};\n","import type {\n AuthErrorCode,\n AuthErrorResponse,\n AuthResponse,\n PendingAccountChangeResponse,\n SessionResponse,\n User,\n VerificationResponse,\n} from './types';\n\n// Backend returns error code in 'error' field (AUTH_ERRORS values)\n// or in 'code' field, message in 'message' or 'error' field\nconst validErrorCodes: readonly AuthErrorCode[] = [\n 'USER_NOT_FOUND',\n 'INVALID_PASSWORD',\n 'USER_EXISTS',\n 'VERIFICATION_EXPIRED',\n 'VERIFICATION_MISMATCH',\n 'VERIFICATION_NOT_FOUND',\n 'TOO_MANY_ATTEMPTS',\n 'REQUIRES_VERIFICATION',\n 'UNAUTHORIZED',\n 'ACCESS_DENIED',\n 'HAS_NO_PASSWORD',\n] as const;\n\nexport class AuthError extends Error {\n code?: AuthErrorCode;\n status?: number;\n details?: Record<string, unknown>;\n\n constructor(\n message: string,\n code?: AuthErrorCode,\n status?: number,\n details?: Record<string, unknown>,\n ) {\n super(message);\n this.name = 'AuthError';\n this.code = code;\n this.status = status;\n this.details = details;\n }\n}\n\nexport type AuthClientConfig = {\n baseURL: string;\n};\n\nexport class AuthClient {\n private baseURL: string;\n\n constructor(config: AuthClientConfig) {\n this.baseURL = config.baseURL.replace(/\\/$/, '');\n }\n\n private async request<T>(\n endpoint: string,\n options: RequestInit = {},\n ): Promise<T> {\n const url = `${this.baseURL}${endpoint}`;\n const response = await fetch(url, {\n ...options,\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n if (!response.ok) {\n const text = await response.text();\n let errorData: AuthErrorResponse;\n try {\n errorData = JSON.parse(text);\n } catch {\n errorData = { error: 'Unknown error', message: text };\n }\n\n // Extract error code from code, error, or message field\n // Backend returns error codes in 'error' field (e.g., { error: 'INVALID_PASSWORD' })\n const potentialCode =\n errorData.code ||\n (typeof errorData.error === 'string' ? errorData.error : null) ||\n (typeof errorData.message === 'string' ? errorData.message : null);\n const upperCode = potentialCode?.toUpperCase().trim();\n const errorCode =\n upperCode && validErrorCodes.includes(upperCode as AuthErrorCode)\n ? (upperCode as AuthErrorCode)\n : undefined;\n const errorMessage =\n errorData.message || errorData.error || 'Request failed';\n\n throw new AuthError(\n errorMessage,\n errorCode as AuthErrorCode | undefined,\n response.status,\n errorData.details,\n );\n }\n\n const data = await response.json();\n return data;\n }\n\n signUpWithEmail(data: {\n email: string;\n password: string;\n fullName: string;\n handle?: string;\n }): Promise<AuthResponse | VerificationResponse> {\n return this.request<AuthResponse | VerificationResponse>('/sign-up', {\n method: 'POST',\n body: JSON.stringify({\n email: data.email,\n password: data.password,\n fullName: data.fullName,\n handle: data.handle,\n }),\n });\n }\n\n signUpWithPhone(data: {\n phone: string;\n password: string;\n fullName: string;\n handle?: string;\n }): Promise<AuthResponse | VerificationResponse> {\n return this.request<AuthResponse | VerificationResponse>('/sign-up', {\n method: 'POST',\n body: JSON.stringify({\n phone: data.phone,\n password: data.password,\n fullName: data.fullName,\n handle: data.handle,\n }),\n });\n }\n\n checkUser(data: { identifier: string }): Promise<{ exists: boolean }> {\n return this.request<{ exists: boolean }>('/check-user', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n signInWithPassword(data: {\n identifier: string;\n password: string;\n }): Promise<AuthResponse | VerificationResponse> {\n return this.request<AuthResponse | VerificationResponse>('/sign-in', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n signOut(): Promise<{ message: string }> {\n return this.request<{ message: string }>('/sign-out', {\n method: 'POST',\n });\n }\n\n requestEmailVerification(data?: {\n email?: string;\n }): Promise<{ verificationId: string }> {\n return this.request<{ verificationId: string }>(\n '/email/verification/request',\n {\n method: 'POST',\n body: JSON.stringify(data || {}),\n },\n );\n }\n\n verifyEmail(data: {\n verificationId: string;\n code: string;\n }): Promise<AuthResponse> {\n return this.request<AuthResponse>('/email/verification/confirm', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n resendVerification(_verificationId: string): Promise<{\n verificationId: string;\n }> {\n // For email, request new verification\n return this.requestEmailVerification();\n }\n\n requestPhoneOtp(data: {\n phone: string;\n context: 'sign-up' | 'sign-in' | 'change-phone';\n }): Promise<{ verificationId: string }> {\n return this.request<{ verificationId: string }>(\n '/phone/verification/request',\n {\n method: 'POST',\n body: JSON.stringify(data),\n },\n );\n }\n\n verifyPhoneOtp(data: {\n verificationId: string;\n code: string;\n context: 'sign-up' | 'sign-in' | 'change-phone';\n }): Promise<\n AuthResponse | { user: User | null; session: null; verified: boolean }\n > {\n return this.request('/phone/verification/confirm', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n forgotPassword(data: { identifier: string }): Promise<{\n message: string;\n }> {\n return this.request<{ message: string }>('/password/forgot', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n resetPassword(data: {\n verificationId: string;\n code: string;\n password: string;\n }): Promise<AuthResponse> {\n return this.request<AuthResponse>('/password/reset', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n verifyPassword(data: { password: string }): Promise<{ message: string }> {\n return this.request<{ message: string }>('/password/verify', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n changePassword(data: {\n currentPassword: string;\n newPassword: string;\n }): Promise<{ message: string }> {\n return this.request<{ message: string }>('/password/change', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n getSession(): Promise<SessionResponse> {\n return this.request<SessionResponse>('/session', {\n method: 'GET',\n });\n }\n\n getPendingAccountChange(): Promise<PendingAccountChangeResponse> {\n return this.request<PendingAccountChangeResponse>(\n '/account-change/pending',\n {\n method: 'GET',\n },\n );\n }\n\n updateProfile(data: { fullName?: string }): Promise<{ user: User }> {\n return this.request<{ user: User }>('/profile', {\n method: 'PUT',\n body: JSON.stringify(data),\n });\n }\n\n updateEmail(data: { email: string }): Promise<{ user: User }> {\n return this.request<{ user: User }>('/profile/email', {\n method: 'PUT',\n body: JSON.stringify(data),\n });\n }\n\n updatePhone(data: { phone: string }): Promise<{ user: User }> {\n return this.request<{ user: User }>('/profile/phone', {\n method: 'PUT',\n body: JSON.stringify(data),\n });\n }\n}\n","export const AUTH_ERROR_MAPPING: Record<\n string,\n { title: string; description: string }\n> = {\n USER_NOT_FOUND: {\n title: 'Account Not Found',\n description:\n 'We could not find an account with that identifier. Please check your spelling or sign up.',\n },\n INVALID_PASSWORD: {\n title: 'Invalid Password',\n description: 'The password you entered is incorrect. Please try again.',\n },\n USER_EXISTS: {\n title: 'Account Already Exists',\n description:\n 'An account with this identifier already exists. Please sign in instead.',\n },\n VERIFICATION_EXPIRED: {\n title: 'Verification Expired',\n description:\n 'The verification code or link has expired. Please request a new one.',\n },\n VERIFICATION_MISMATCH: {\n title: 'Invalid Code',\n description:\n 'The verification code you entered is invalid. Please double-check and try again.',\n },\n VERIFICATION_NOT_FOUND: {\n title: 'Verification Not Found',\n description:\n 'We could not find a pending verification request. Please restart the process.',\n },\n TOO_MANY_ATTEMPTS: {\n title: 'Too Many Attempts',\n description:\n 'You have made too many requests recently. Please wait a moment before trying again.',\n },\n REQUIRES_VERIFICATION: {\n title: 'Verification Required',\n description:\n 'You need to verify your account before you can continue. Please check your email or phone.',\n },\n UNAUTHORIZED: {\n title: 'Unauthorized',\n description:\n 'You are not authorized to perform this action. Please sign in again.',\n },\n ACCESS_DENIED: {\n title: 'Access Denied',\n description:\n 'You do not have permission to access this resource. Please contact support if you believe this is an error.',\n },\n HAS_NO_PASSWORD: {\n title: 'No Password Set',\n description:\n 'Your account does not have a password set (e.g. social login). Please sign in with your provider or reset your password.',\n },\n};\n\nexport const validCodes = Object.keys(AUTH_ERROR_MAPPING);\n","import type { _Translator } from 'next-intl';\nimport { AuthError } from '../client';\nimport { AUTH_ERROR_MAPPING, validCodes } from '../constants/auth.error.codes';\n\nexport type AuthErrorContent = {\n title: string;\n description: string;\n};\n\nexport const handleError = (\n err: any,\n setError: (error: AuthErrorContent | null) => void,\n t: _Translator<Record<string, any>, string>,\n) => {\n if (err instanceof AuthError) {\n let errorCode = '';\n\n if (err.code && validCodes.includes(err.code)) {\n errorCode = err.code;\n } else if (err.message) {\n const messageUpper = err.message.toUpperCase().trim();\n if (validCodes.includes(messageUpper)) {\n errorCode = messageUpper;\n }\n }\n\n if (errorCode && AUTH_ERROR_MAPPING[errorCode]) {\n const mapping = AUTH_ERROR_MAPPING[errorCode];\n // Try to translate the description if a key exists, otherwise use English fallback\n // Since mapping.description is English text, we might want to check if there is a translation key\n // But for now, let's use the provided English mapping or try to find a translation if the key matches 'errors.code'\n\n // We can try to lookup translation, if it returns the key (or fallback), we might prefer the mapping text (which is nice English).\n // However, usually we prefer translation.\n // Let's rely on the mapping text primarily as per the request to \"Generate a description and title...\".\n // But if we want i18n support, we should probably add keys.\n // Given the prompt \"Generate a description... for each error code... and display\",\n // I will prioritize the static mapping I just created, but allows future i18n improvement.\n\n setError({\n title: mapping.title,\n description: mapping.description,\n });\n return;\n }\n\n // Fallback for AuthError without known code\n setError({\n title: t('errors.fallback'), // or 'Error'\n description: err.message || t('errors.fallback'),\n });\n } else {\n // Generic error\n const message = err instanceof Error ? err.message : t('errors.fallback');\n setError({\n title: 'Error',\n description: message,\n });\n }\n};\n","'use client';\n\nimport {\n Alert,\n AlertDescription,\n AlertTitle,\n} from '@mesob/ui/components/alert';\nimport { IconAlertCircle } from '@tabler/icons-react';\nimport type { ReactNode } from 'react';\nimport type { AuthErrorContent } from '../../utils/handle-error';\n\ntype AuthPageLayoutProps = {\n title: string;\n description?: string;\n children: ReactNode;\n error?: AuthErrorContent | string | null;\n footer?: ReactNode;\n logoImage?: string;\n};\n\nexport const AuthPageLayout = ({\n title,\n description,\n children,\n error,\n footer,\n logoImage,\n}: AuthPageLayoutProps) => {\n const errorContent: AuthErrorContent | null = error\n ? // biome-ignore lint/style/noNestedTernary: <explanation>\n typeof error === 'string'\n ? { title: 'Error', description: error }\n : error\n : null;\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex size-8 mb-6 w-full items-center justify-center rounded-md\">\n {/** biome-ignore lint/performance/noImgElement: logo image */}\n <img src={logoImage || ''} alt=\"Jiret\" width={42} height={42} />\n </div>\n <div className=\"text-center\">\n <h1 className=\"text-2xl font-bold tracking-tight\">{title}</h1>\n {description && (\n <p className=\"mt-2 text-sm text-muted-foreground\">{description}</p>\n )}\n </div>\n\n {children}\n\n {errorContent && (\n <Alert variant=\"destructive\">\n <IconAlertCircle className=\"h-4 w-4\" />\n <AlertTitle>{errorContent.title}</AlertTitle>\n <AlertDescription>{errorContent.description}</AlertDescription>\n </Alert>\n )}\n <div className=\"mt-2 w-full\">\n {footer && (\n <div className=\"w-full text-center text-sm text-muted-foreground\">\n {footer}\n </div>\n )}\n </div>\n </div>\n );\n};\n","'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { Button } from '@mesob/ui/components/button';\nimport {\n Form,\n FormControl,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '@mesob/ui/components/form';\nimport { Input } from '@mesob/ui/components/input';\nimport { Spinner } from '@mesob/ui/components/spinner';\nimport { useTranslations } from 'next-intl';\nimport { useMemo } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { z } from 'zod';\n\ntype ForgotPasswordFormValues = {\n account: string;\n};\n\ntype ForgotPasswordProps = {\n onSubmit: (values: ForgotPasswordFormValues) => Promise<void> | void;\n isLoading?: boolean;\n onBack?: () => void;\n};\n\nexport const ForgotPassword = ({\n onSubmit,\n isLoading = false,\n}: ForgotPasswordProps) => {\n const t = useTranslations('Auth.forgotPassword');\n const forgotPasswordSchema = useMemo(\n () =>\n z.object({\n account: z.string().min(1, t('errors.accountRequired')),\n }),\n [t],\n );\n\n const form = useForm<ForgotPasswordFormValues>({\n resolver: zodResolver(forgotPasswordSchema),\n defaultValues: {\n account: '',\n },\n });\n\n const handleSubmit = form.handleSubmit(async (values) => {\n await onSubmit(values);\n });\n\n return (\n <Form {...form}>\n <form onSubmit={handleSubmit} className=\"space-y-4\">\n <FormField\n control={form.control}\n name=\"account\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.accountLabel')}</FormLabel>\n <FormControl>\n <Input\n type=\"text\"\n placeholder={t('form.accountPlaceholder')}\n {...field}\n />\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading && <Spinner />}\n {isLoading ? t('form.submitting') : t('form.submit')}\n </Button>\n </form>\n </Form>\n );\n};\n"],"mappings":";;;AAEA,SAAS,mBAAAA,wBAAuB;AAEhC,SAAS,YAAAC,iBAAgB;;;ACFzB;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAiEH;AAnDJ,IAAM,cAAc,cAAuC,IAAI;AAExD,IAAM,UAAU,MAAM;AAC3B,QAAM,UAAU,WAAW,WAAW;AACtC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,0CAA0C;AAAA,EAC5D;AACA,SAAO;AACT;;;ACLO,IAAM,YAAN,cAAwB,MAAM;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EAEA,YACE,SACA,MACA,QACA,SACA;AACA,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,UAAU;AAAA,EACjB;AACF;;;AC3CO,IAAM,qBAGT;AAAA,EACF,gBAAgB;AAAA,IACd,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AA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B;AAAA,UACA,WAAU;AAAA,UAET,YAAE,qBAAqB;AAAA;AAAA,MAC1B;AAAA,MAIJ,0BAAAA;AAAA,QAAC;AAAA;AAAA,UACC,UAAU;AAAA,UACV;AAAA,UACA,QAAQ;AAAA;AAAA,MACV;AAAA;AAAA,EACF;AAEJ;","names":["useTranslations","useState","jsx","jsx","jsxs","jsx","useTranslations","useState"]}
package/dist/index.js CHANGED
@@ -328,7 +328,7 @@ var ForgotPassword = ({
328
328
  const handleSubmit = form.handleSubmit(async (values) => {
329
329
  await onSubmit(values);
330
330
  });
331
- return /* @__PURE__ */ jsx4(Form, { ...form, children: /* @__PURE__ */ jsxs3("form", { onSubmit: handleSubmit, className: "space-y-5", children: [
331
+ return /* @__PURE__ */ jsx4(Form, { ...form, children: /* @__PURE__ */ jsxs3("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
332
332
  /* @__PURE__ */ jsx4(
333
333
  FormField,
334
334
  {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/client.ts","../src/components/auth/auth-card.tsx","../src/components/auth/auth-page-layout.tsx","../src/components/auth/countdown.tsx","../src/components/auth/forgot-password.tsx","../src/components/auth/pages/forgot-password-page.tsx","../src/context/auth-provider.tsx","../src/constants/auth.error.codes.ts","../src/utils/handle-error.ts","../src/components/auth/pages/reset-password-page.tsx","../src/components/auth/reset-password-form.tsx","../src/components/auth/pages/sign-in-page.tsx","../src/components/auth/sign-in.tsx","../src/utils/normalize-phone.ts","../src/components/auth/pages/sign-up-page.tsx","../src/components/auth/sign-up.tsx","../src/components/auth/pages/verify-email-page.tsx","../src/components/auth/verification-form.tsx","../src/components/auth/pages/verify-phone-page.tsx","../src/factory.ts","../src/hooks/use-session.ts"],"sourcesContent":["import type {\n AuthErrorCode,\n AuthErrorResponse,\n AuthResponse,\n PendingAccountChangeResponse,\n SessionResponse,\n User,\n VerificationResponse,\n} from './types';\n\n// Backend returns error code in 'error' field (AUTH_ERRORS values)\n// or in 'code' field, message in 'message' or 'error' field\nconst validErrorCodes: readonly AuthErrorCode[] = [\n 'USER_NOT_FOUND',\n 'INVALID_PASSWORD',\n 'USER_EXISTS',\n 'VERIFICATION_EXPIRED',\n 'VERIFICATION_MISMATCH',\n 'VERIFICATION_NOT_FOUND',\n 'TOO_MANY_ATTEMPTS',\n 'REQUIRES_VERIFICATION',\n 'UNAUTHORIZED',\n 'ACCESS_DENIED',\n 'HAS_NO_PASSWORD',\n] as const;\n\nexport class AuthError extends Error {\n code?: AuthErrorCode;\n status?: number;\n details?: Record<string, unknown>;\n\n constructor(\n message: string,\n code?: AuthErrorCode,\n status?: number,\n details?: Record<string, unknown>,\n ) {\n super(message);\n this.name = 'AuthError';\n this.code = code;\n this.status = status;\n this.details = details;\n }\n}\n\nexport type AuthClientConfig = {\n baseURL: string;\n};\n\nexport class AuthClient {\n private baseURL: string;\n\n constructor(config: AuthClientConfig) {\n this.baseURL = config.baseURL.replace(/\\/$/, '');\n }\n\n private async request<T>(\n endpoint: string,\n options: RequestInit = {},\n ): Promise<T> {\n const url = `${this.baseURL}${endpoint}`;\n const response = await fetch(url, {\n ...options,\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n if (!response.ok) {\n const text = await response.text();\n let errorData: AuthErrorResponse;\n try {\n errorData = JSON.parse(text);\n } catch {\n errorData = { error: 'Unknown error', message: text };\n }\n\n // Extract error code from code, error, or message field\n // Backend returns error codes in 'error' field (e.g., { error: 'INVALID_PASSWORD' })\n const potentialCode =\n errorData.code ||\n (typeof errorData.error === 'string' ? errorData.error : null) ||\n (typeof errorData.message === 'string' ? errorData.message : null);\n const upperCode = potentialCode?.toUpperCase().trim();\n const errorCode =\n upperCode && validErrorCodes.includes(upperCode as AuthErrorCode)\n ? (upperCode as AuthErrorCode)\n : undefined;\n const errorMessage =\n errorData.message || errorData.error || 'Request failed';\n\n throw new AuthError(\n errorMessage,\n errorCode as AuthErrorCode | undefined,\n response.status,\n errorData.details,\n );\n }\n\n const data = await response.json();\n return data;\n }\n\n signUpWithEmail(data: {\n email: string;\n password: string;\n fullName: string;\n handle?: string;\n }): Promise<AuthResponse | VerificationResponse> {\n return this.request<AuthResponse | VerificationResponse>('/sign-up', {\n method: 'POST',\n body: JSON.stringify({\n email: data.email,\n password: data.password,\n fullName: data.fullName,\n handle: data.handle,\n }),\n });\n }\n\n signUpWithPhone(data: {\n phone: string;\n password: string;\n fullName: string;\n handle?: string;\n }): Promise<AuthResponse | VerificationResponse> {\n return this.request<AuthResponse | VerificationResponse>('/sign-up', {\n method: 'POST',\n body: JSON.stringify({\n phone: data.phone,\n password: data.password,\n fullName: data.fullName,\n handle: data.handle,\n }),\n });\n }\n\n checkUser(data: { identifier: string }): Promise<{ exists: boolean }> {\n return this.request<{ exists: boolean }>('/check-user', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n signInWithPassword(data: {\n identifier: string;\n password: string;\n }): Promise<AuthResponse | VerificationResponse> {\n return this.request<AuthResponse | VerificationResponse>('/sign-in', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n signOut(): Promise<{ message: string }> {\n return this.request<{ message: string }>('/sign-out', {\n method: 'POST',\n });\n }\n\n requestEmailVerification(data?: {\n email?: string;\n }): Promise<{ verificationId: string }> {\n return this.request<{ verificationId: string }>(\n '/email/verification/request',\n {\n method: 'POST',\n body: JSON.stringify(data || {}),\n },\n );\n }\n\n verifyEmail(data: {\n verificationId: string;\n code: string;\n }): Promise<AuthResponse> {\n return this.request<AuthResponse>('/email/verification/confirm', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n resendVerification(_verificationId: string): Promise<{\n verificationId: string;\n }> {\n // For email, request new verification\n return this.requestEmailVerification();\n }\n\n requestPhoneOtp(data: {\n phone: string;\n context: 'sign-up' | 'sign-in' | 'change-phone';\n }): Promise<{ verificationId: string }> {\n return this.request<{ verificationId: string }>(\n '/phone/verification/request',\n {\n method: 'POST',\n body: JSON.stringify(data),\n },\n );\n }\n\n verifyPhoneOtp(data: {\n verificationId: string;\n code: string;\n context: 'sign-up' | 'sign-in' | 'change-phone';\n }): Promise<\n AuthResponse | { user: User | null; session: null; verified: boolean }\n > {\n return this.request('/phone/verification/confirm', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n forgotPassword(data: { identifier: string }): Promise<{\n message: string;\n }> {\n return this.request<{ message: string }>('/password/forgot', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n resetPassword(data: {\n verificationId: string;\n code: string;\n password: string;\n }): Promise<AuthResponse> {\n return this.request<AuthResponse>('/password/reset', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n verifyPassword(data: { password: string }): Promise<{ message: string }> {\n return this.request<{ message: string }>('/password/verify', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n changePassword(data: {\n currentPassword: string;\n newPassword: string;\n }): Promise<{ message: string }> {\n return this.request<{ message: string }>('/password/change', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n getSession(): Promise<SessionResponse> {\n return this.request<SessionResponse>('/session', {\n method: 'GET',\n });\n }\n\n getPendingAccountChange(): Promise<PendingAccountChangeResponse> {\n return this.request<PendingAccountChangeResponse>(\n '/account-change/pending',\n {\n method: 'GET',\n },\n );\n }\n\n updateProfile(data: { fullName?: string }): Promise<{ user: User }> {\n return this.request<{ user: User }>('/profile', {\n method: 'PUT',\n body: JSON.stringify(data),\n });\n }\n\n updateEmail(data: { email: string }): Promise<{ user: User }> {\n return this.request<{ user: User }>('/profile/email', {\n method: 'PUT',\n body: JSON.stringify(data),\n });\n }\n\n updatePhone(data: { phone: string }): Promise<{ user: User }> {\n return this.request<{ user: User }>('/profile/phone', {\n method: 'PUT',\n body: JSON.stringify(data),\n });\n }\n}\n","'use client';\n\nimport type { ReactNode } from 'react';\n\ntype AuthCardProps = {\n children: ReactNode;\n};\n\nexport const AuthCard = ({ children }: AuthCardProps) => {\n return (\n <div className=\"flex min-h-screen p-4 items-center justify-center\">\n <div className=\"w-full max-w-md\">\n <div className=\"rounded-xl border bg-card p-8 shadow-lg\">\n {children}\n </div>\n </div>\n </div>\n );\n};\n","'use client';\n\nimport {\n Alert,\n AlertDescription,\n AlertTitle,\n} from '@mesob/ui/components/alert';\nimport { IconAlertCircle } from '@tabler/icons-react';\nimport type { ReactNode } from 'react';\nimport type { AuthErrorContent } from '../../utils/handle-error';\n\ntype AuthPageLayoutProps = {\n title: string;\n description?: string;\n children: ReactNode;\n error?: AuthErrorContent | string | null;\n footer?: ReactNode;\n logoImage?: string;\n};\n\nexport const AuthPageLayout = ({\n title,\n description,\n children,\n error,\n footer,\n logoImage,\n}: AuthPageLayoutProps) => {\n const errorContent: AuthErrorContent | null = error\n ? // biome-ignore lint/style/noNestedTernary: <explanation>\n typeof error === 'string'\n ? { title: 'Error', description: error }\n : error\n : null;\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex size-8 mb-6 w-full items-center justify-center rounded-md\">\n {/** biome-ignore lint/performance/noImgElement: logo image */}\n <img src={logoImage || ''} alt=\"Jiret\" width={42} height={42} />\n </div>\n <div className=\"text-center\">\n <h1 className=\"text-2xl font-bold tracking-tight\">{title}</h1>\n {description && (\n <p className=\"mt-2 text-sm text-muted-foreground\">{description}</p>\n )}\n </div>\n\n {children}\n\n {errorContent && (\n <Alert variant=\"destructive\">\n <IconAlertCircle className=\"h-4 w-4\" />\n <AlertTitle>{errorContent.title}</AlertTitle>\n <AlertDescription>{errorContent.description}</AlertDescription>\n </Alert>\n )}\n <div className=\"mt-2 w-full\">\n {footer && (\n <div className=\"w-full text-center text-sm text-muted-foreground\">\n {footer}\n </div>\n )}\n </div>\n </div>\n );\n};\n","'use client';\n\nimport { Button } from '@mesob/ui/components/button';\nimport { Spinner } from '@mesob/ui/components/spinner';\nimport { useTranslations } from 'next-intl';\nimport { useEffect, useState } from 'react';\n\ntype CountdownProps = {\n initialSeconds?: number;\n onResend: () => Promise<void> | void;\n resending?: boolean;\n};\n\nexport const Countdown = ({\n initialSeconds = 60,\n onResend,\n resending = false,\n}: CountdownProps) => {\n const t = useTranslations('Common');\n const [seconds, setSeconds] = useState(initialSeconds);\n const [isResending, setIsResending] = useState(false);\n\n useEffect(() => {\n if (seconds <= 0) {\n return;\n }\n\n const timer = setInterval(() => {\n setSeconds((prev) => {\n if (prev <= 1) {\n clearInterval(timer);\n return 0;\n }\n return prev - 1;\n });\n }, 1000);\n\n return () => clearInterval(timer);\n }, [seconds]);\n\n const handleResend = async () => {\n setIsResending(true);\n try {\n await onResend();\n setSeconds(initialSeconds);\n } catch (_error) {\n // Error handling is done by parent\n } finally {\n setIsResending(false);\n }\n };\n\n if (seconds > 0) {\n return (\n <Button variant=\"ghost\" disabled>\n {t('resendIn', { seconds })}\n </Button>\n );\n }\n\n return (\n <Button\n variant=\"ghost\"\n onClick={handleResend}\n disabled={isResending || resending}\n >\n {isResending || (resending && <Spinner />)}\n {t('resend')}\n </Button>\n );\n};\n","'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { Button } from '@mesob/ui/components/button';\nimport {\n Form,\n FormControl,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '@mesob/ui/components/form';\nimport { Input } from '@mesob/ui/components/input';\nimport { Spinner } from '@mesob/ui/components/spinner';\nimport { useTranslations } from 'next-intl';\nimport { useMemo } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { z } from 'zod';\n\ntype ForgotPasswordFormValues = {\n account: string;\n};\n\ntype ForgotPasswordProps = {\n onSubmit: (values: ForgotPasswordFormValues) => Promise<void> | void;\n isLoading?: boolean;\n onBack?: () => void;\n};\n\nexport const ForgotPassword = ({\n onSubmit,\n isLoading = false,\n}: ForgotPasswordProps) => {\n const t = useTranslations('Auth.forgotPassword');\n const forgotPasswordSchema = useMemo(\n () =>\n z.object({\n account: z.string().min(1, t('errors.accountRequired')),\n }),\n [t],\n );\n\n const form = useForm<ForgotPasswordFormValues>({\n resolver: zodResolver(forgotPasswordSchema),\n defaultValues: {\n account: '',\n },\n });\n\n const handleSubmit = form.handleSubmit(async (values) => {\n await onSubmit(values);\n });\n\n return (\n <Form {...form}>\n <form onSubmit={handleSubmit} className=\"space-y-5\">\n <FormField\n control={form.control}\n name=\"account\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.accountLabel')}</FormLabel>\n <FormControl>\n <Input\n type=\"text\"\n placeholder={t('form.accountPlaceholder')}\n {...field}\n />\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading && <Spinner />}\n {isLoading ? t('form.submitting') : t('form.submit')}\n </Button>\n </form>\n </Form>\n );\n};\n","'use client';\n\nimport { useTranslations } from 'next-intl';\nimport type { ComponentProps } from 'react';\nimport { useState } from 'react';\nimport { useAuth } from '../../../context/auth-provider';\nimport type { AuthErrorContent } from '../../../utils/handle-error';\nimport { handleError } from '../../../utils/handle-error';\n\nimport { AuthPageLayout } from '../auth-page-layout';\nimport { ForgotPassword } from '../forgot-password';\n\ntype ForgotPasswordPageProps = {\n locale?: string;\n onNavigate: (path: string) => void;\n linkComponent?: React.ComponentType<ComponentProps<'a'> & { href: string }>;\n links?: {\n signIn?: string;\n };\n logoImage?: string;\n};\n\nexport const ForgotPasswordPage = ({\n onNavigate,\n linkComponent: Link,\n links,\n logoImage,\n}: ForgotPasswordPageProps) => {\n const t = useTranslations('Auth.forgotPassword');\n const { client } = useAuth();\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<AuthErrorContent | null>(null);\n\n const signInLink = links?.signIn || '/auth/sign-in';\n\n const handleSubmit = async (values: { account: string }) => {\n setIsLoading(true);\n setError(null);\n\n try {\n const res = await client.forgotPassword({ identifier: values.account });\n\n if ('verificationId' in res && res.verificationId) {\n onNavigate(`/auth/reset-password?verificationId=${res.verificationId}`);\n } else {\n onNavigate(\n `/auth/reset-password?identifier=${encodeURIComponent(values.account)}`,\n );\n }\n } catch (err) {\n handleError(err, setError, t);\n } finally {\n setIsLoading(false);\n }\n };\n\n const handleBack = () => {\n onNavigate(signInLink);\n };\n\n return (\n <AuthPageLayout\n title={t('title')}\n description={t('description')}\n error={error}\n logoImage={logoImage}\n footer={\n Link ? (\n <Link href={signInLink} className=\"text-primary hover:underline\">\n {t('footer.backToSignIn')}\n </Link>\n ) : (\n <a\n href={signInLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(signInLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {t('footer.backToSignIn')}\n </a>\n )\n }\n >\n <ForgotPassword\n onSubmit={handleSubmit}\n isLoading={isLoading}\n onBack={handleBack}\n />\n </AuthPageLayout>\n );\n};\n","'use client';\n\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport type { AuthClient } from '../client';\nimport type { AuthResponse, Session, User } from '../types';\n\ntype AuthContextValue = {\n user: User | null;\n session: Session | null;\n loading: boolean;\n error: Error | null;\n client: AuthClient;\n refresh: () => Promise<void>;\n setAuth: (data: AuthResponse) => void;\n};\n\nconst AuthContext = createContext<AuthContextValue | null>(null);\n\nexport const useAuth = () => {\n const context = useContext(AuthContext);\n if (!context) {\n throw new Error('useAuth must be used within AuthProvider');\n }\n return context;\n};\n\ntype AuthProviderProps = {\n client: AuthClient;\n children: ReactNode;\n};\n\nexport const AuthProvider = ({ client, children }: AuthProviderProps) => {\n const [user, setUser] = useState<User | null>(null);\n const [session, setSession] = useState<Session | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const refresh = useCallback(async () => {\n try {\n setLoading(true);\n setError(null);\n const data = await client.getSession();\n setUser(data.user);\n setSession(data.session);\n } catch (err) {\n setError(\n err instanceof Error ? err : new Error('Failed to fetch session'),\n );\n setUser(null);\n setSession(null);\n } finally {\n setLoading(false);\n }\n }, [client]);\n\n const setAuth = useCallback((data: AuthResponse) => {\n setUser(data.user);\n setSession(data.session);\n setError(null);\n setLoading(false);\n }, []);\n\n useEffect(() => {\n refresh();\n }, [refresh]);\n\n return (\n <AuthContext.Provider\n value={{\n user,\n session,\n loading,\n error,\n client,\n refresh,\n setAuth,\n }}\n >\n {children}\n </AuthContext.Provider>\n );\n};\n","export const AUTH_ERROR_MAPPING: Record<\n string,\n { title: string; description: string }\n> = {\n USER_NOT_FOUND: {\n title: 'Account Not Found',\n description:\n 'We could not find an account with that identifier. Please check your spelling or sign up.',\n },\n INVALID_PASSWORD: {\n title: 'Invalid Password',\n description: 'The password you entered is incorrect. Please try again.',\n },\n USER_EXISTS: {\n title: 'Account Already Exists',\n description:\n 'An account with this identifier already exists. Please sign in instead.',\n },\n VERIFICATION_EXPIRED: {\n title: 'Verification Expired',\n description:\n 'The verification code or link has expired. Please request a new one.',\n },\n VERIFICATION_MISMATCH: {\n title: 'Invalid Code',\n description:\n 'The verification code you entered is invalid. Please double-check and try again.',\n },\n VERIFICATION_NOT_FOUND: {\n title: 'Verification Not Found',\n description:\n 'We could not find a pending verification request. Please restart the process.',\n },\n TOO_MANY_ATTEMPTS: {\n title: 'Too Many Attempts',\n description:\n 'You have made too many requests recently. Please wait a moment before trying again.',\n },\n REQUIRES_VERIFICATION: {\n title: 'Verification Required',\n description:\n 'You need to verify your account before you can continue. Please check your email or phone.',\n },\n UNAUTHORIZED: {\n title: 'Unauthorized',\n description:\n 'You are not authorized to perform this action. Please sign in again.',\n },\n ACCESS_DENIED: {\n title: 'Access Denied',\n description:\n 'You do not have permission to access this resource. Please contact support if you believe this is an error.',\n },\n HAS_NO_PASSWORD: {\n title: 'No Password Set',\n description:\n 'Your account does not have a password set (e.g. social login). Please sign in with your provider or reset your password.',\n },\n};\n\nexport const validCodes = Object.keys(AUTH_ERROR_MAPPING);\n","import type { _Translator } from 'next-intl';\nimport { AuthError } from '../client';\nimport { AUTH_ERROR_MAPPING, validCodes } from '../constants/auth.error.codes';\n\nexport type AuthErrorContent = {\n title: string;\n description: string;\n};\n\nexport const handleError = (\n err: any,\n setError: (error: AuthErrorContent | null) => void,\n t: _Translator<Record<string, any>, string>,\n) => {\n if (err instanceof AuthError) {\n let errorCode = '';\n\n if (err.code && validCodes.includes(err.code)) {\n errorCode = err.code;\n } else if (err.message) {\n const messageUpper = err.message.toUpperCase().trim();\n if (validCodes.includes(messageUpper)) {\n errorCode = messageUpper;\n }\n }\n\n if (errorCode && AUTH_ERROR_MAPPING[errorCode]) {\n const mapping = AUTH_ERROR_MAPPING[errorCode];\n // Try to translate the description if a key exists, otherwise use English fallback\n // Since mapping.description is English text, we might want to check if there is a translation key\n // But for now, let's use the provided English mapping or try to find a translation if the key matches 'errors.code'\n\n // We can try to lookup translation, if it returns the key (or fallback), we might prefer the mapping text (which is nice English).\n // However, usually we prefer translation.\n // Let's rely on the mapping text primarily as per the request to \"Generate a description and title...\".\n // But if we want i18n support, we should probably add keys.\n // Given the prompt \"Generate a description... for each error code... and display\",\n // I will prioritize the static mapping I just created, but allows future i18n improvement.\n\n setError({\n title: mapping.title,\n description: mapping.description,\n });\n return;\n }\n\n // Fallback for AuthError without known code\n setError({\n title: t('errors.fallback'), // or 'Error'\n description: err.message || t('errors.fallback'),\n });\n } else {\n // Generic error\n const message = err instanceof Error ? err.message : t('errors.fallback');\n setError({\n title: 'Error',\n description: message,\n });\n }\n};\n","'use client';\n\nimport { useTranslations } from 'next-intl';\nimport type { ComponentProps } from 'react';\nimport { useState } from 'react';\nimport { useAuth } from '../../../context/auth-provider';\nimport type { AuthErrorContent } from '../../../utils/handle-error';\nimport { handleError } from '../../../utils/handle-error';\n\nimport { AuthPageLayout } from '../auth-page-layout';\nimport { ResetPasswordForm } from '../reset-password-form';\n\ntype ResetPasswordPageProps = {\n locale?: string;\n verificationId: string;\n onNavigate: (path: string) => void;\n linkComponent?: React.ComponentType<ComponentProps<'a'> & { href: string }>;\n links?: {\n signIn?: string;\n forgotPassword?: string;\n };\n logoImage?: string;\n redirectUrl?: string;\n};\n\nexport const ResetPasswordPage = ({\n verificationId,\n onNavigate,\n linkComponent: Link,\n links,\n logoImage,\n redirectUrl,\n}: ResetPasswordPageProps) => {\n const t = useTranslations('Auth.resetPassword');\n const common = useTranslations('Common');\n const { client, refresh } = useAuth();\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<AuthErrorContent | null>(null);\n\n const signInLink = links?.signIn || '/auth/sign-in';\n const forgotPasswordLink = links?.forgotPassword || '/auth/forgot-password';\n\n const handleSubmit = async (values: {\n code: string;\n password: string;\n confirmPassword: string;\n }) => {\n if (!verificationId) {\n setError({\n title: t('errors.fallback'),\n description: t('errors.missingVerificationId'),\n });\n return;\n }\n\n setIsLoading(true);\n setError(null);\n\n try {\n await client.resetPassword({\n verificationId,\n code: values.code,\n password: values.password,\n });\n await refresh();\n onNavigate(redirectUrl || '/');\n } catch (err) {\n handleError(err, setError, t);\n } finally {\n setIsLoading(false);\n }\n };\n\n if (!verificationId) {\n return (\n <AuthPageLayout\n title={common('invalidLinkTitle')}\n description={common('invalidLinkDescription')}\n logoImage={logoImage}\n footer={\n Link ? (\n <Link\n href={forgotPasswordLink}\n className=\"text-primary hover:underline\"\n >\n {t('footer.requestNew')}\n </Link>\n ) : (\n <a\n href={forgotPasswordLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(forgotPasswordLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {t('footer.requestNew')}\n </a>\n )\n }\n >\n <div />\n </AuthPageLayout>\n );\n }\n\n return (\n <AuthPageLayout\n title={t('title')}\n description={t('description')}\n error={error}\n logoImage={logoImage}\n footer={\n Link ? (\n <div className=\"flex items-center justify-between w-full gap-2\">\n <Link href={signInLink} className=\"text-primary hover:underline\">\n {t('footer.backToSignIn')}\n </Link>\n <Link\n href={forgotPasswordLink}\n className=\"text-primary hover:underline\"\n >\n {t('footer.changeAccount')}\n </Link>\n </div>\n ) : (\n <div className=\"flex items-center justify-between w-full gap-2\">\n <a\n href={forgotPasswordLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(forgotPasswordLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {t('footer.backToSignIn')}\n </a>\n <a\n href={forgotPasswordLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(forgotPasswordLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {t('footer.changeAccount')}\n </a>\n </div>\n )\n }\n >\n <ResetPasswordForm\n verificationId={verificationId}\n onSubmit={handleSubmit}\n isLoading={isLoading}\n error={error}\n />\n </AuthPageLayout>\n );\n};\n","'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { Button } from '@mesob/ui/components/button';\nimport {\n Form,\n FormControl,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '@mesob/ui/components/form';\nimport { Input } from '@mesob/ui/components/input';\nimport {\n InputOTP,\n InputOTPGroup,\n InputOTPSlot,\n} from '@mesob/ui/components/input-otp';\nimport { Spinner } from '@mesob/ui/components/spinner';\nimport { IconEye, IconEyeOff } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { useMemo, useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { z } from 'zod';\nimport type { AuthErrorContent } from '../../utils/handle-error';\n\ntype ResetPasswordFormValues = {\n code: string;\n password: string;\n confirmPassword: string;\n};\n\ntype ResetPasswordFormProps = {\n verificationId: string;\n onSubmit: (values: ResetPasswordFormValues) => Promise<void> | void;\n isLoading?: boolean;\n error?: AuthErrorContent | string | null;\n};\n\nexport const ResetPasswordForm = ({\n onSubmit,\n isLoading = false,\n}: ResetPasswordFormProps) => {\n const t = useTranslations('Auth.resetPassword');\n const [showPassword, setShowPassword] = useState(false);\n const resetPasswordSchema = useMemo(\n () =>\n z\n .object({\n code: z.string().length(6, t('errors.codeLength')),\n password: z.string().min(8, t('errors.passwordLength')),\n confirmPassword: z.string(),\n })\n .refine((data) => data.password === data.confirmPassword, {\n message: t('errors.passwordsMismatch'),\n path: ['confirmPassword'],\n }),\n [t],\n );\n\n const form = useForm<ResetPasswordFormValues>({\n resolver: zodResolver(resetPasswordSchema),\n defaultValues: {\n code: '',\n password: '',\n confirmPassword: '',\n },\n });\n\n const handleSubmit = form.handleSubmit(async (values) => {\n await onSubmit(values);\n });\n\n return (\n <Form {...form}>\n <form onSubmit={handleSubmit} className=\"space-y-4\">\n <FormField\n control={form.control}\n name=\"code\"\n render={({ field }) => (\n <FormItem>\n <div className=\"flex justify-center\">\n <FormLabel>{t('form.codeLabel')}</FormLabel>\n </div>\n <FormControl>\n <div className=\"flex mt-2 justify-center\">\n <InputOTP maxLength={6} {...field} containerClassName=\"gap-4\">\n <InputOTPGroup className=\"gap-3 *:data-[slot=input-otp-slot]:h-12 *:data-[slot=input-otp-slot]:w-12 *:data-[slot=input-otp-slot]:rounded-md *:data-[slot=input-otp-slot]:border *:data-[slot=input-otp-slot]:text-xl\">\n <InputOTPSlot className=\"h-12\" index={0} />\n <InputOTPSlot className=\"h-12\" index={1} />\n <InputOTPSlot className=\"h-12\" index={2} />\n <InputOTPSlot className=\"h-12\" index={3} />\n <InputOTPSlot className=\"h-12\" index={4} />\n <InputOTPSlot className=\"h-12\" index={5} />\n </InputOTPGroup>\n </InputOTP>\n </div>\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n\n <FormField\n control={form.control}\n name=\"password\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.passwordLabel')}</FormLabel>\n <FormControl>\n <div className=\"relative\">\n <Input\n type={showPassword ? 'text' : 'password'}\n placeholder={t('form.passwordPlaceholder')}\n {...field}\n />\n <button\n type=\"button\"\n onClick={() => setShowPassword(!showPassword)}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground\"\n >\n {showPassword ? (\n <IconEyeOff className=\"h-4 w-4\" />\n ) : (\n <IconEye className=\"h-4 w-4\" />\n )}\n </button>\n </div>\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n\n <FormField\n control={form.control}\n name=\"confirmPassword\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.confirmPasswordLabel')}</FormLabel>\n <FormControl>\n <div className=\"relative\">\n <Input\n type={showPassword ? 'text' : 'password'}\n placeholder={t('form.passwordPlaceholder')}\n {...field}\n />\n <button\n type=\"button\"\n onClick={() => setShowPassword(!showPassword)}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground\"\n >\n {showPassword ? (\n <IconEyeOff className=\"h-4 w-4\" />\n ) : (\n <IconEye className=\"h-4 w-4\" />\n )}\n </button>\n </div>\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading && <Spinner />}\n {isLoading ? t('form.submitting') : t('form.submit')}\n </Button>\n </form>\n </Form>\n );\n};\n","'use client';\n\nimport { useTranslations } from 'next-intl';\nimport type { ComponentProps } from 'react';\nimport { useState } from 'react';\nimport { useAuth } from '../../../context/auth-provider';\nimport type { AuthErrorContent } from '../../../utils/handle-error';\nimport { handleError } from '../../../utils/handle-error';\n\nimport { AuthPageLayout } from '../auth-page-layout';\nimport { SignIn } from '../sign-in';\n\nconst isPhone = (s: string) => /^\\+?[0-9()[\\]\\s-]{6,}$/.test(s);\n\ntype SignInPageProps = {\n locale?: string;\n redirectUrl?: string;\n onNavigate: (path: string) => void;\n linkComponent?: React.ComponentType<ComponentProps<'a'> & { href: string }>;\n links?: {\n forgotPassword?: string;\n signUp?: string;\n };\n logoImage?: string;\n};\n\nexport const SignInPage = ({\n redirectUrl,\n onNavigate,\n linkComponent: Link,\n links,\n logoImage,\n}: SignInPageProps) => {\n const t = useTranslations('Auth.signIn');\n const { client, setAuth } = useAuth();\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<AuthErrorContent | null>(null);\n const [step, setStep] = useState<'identifier' | 'password'>('identifier');\n const [identifier, setIdentifier] = useState<string>('');\n\n const defaultRedirect = redirectUrl || '/dashboard';\n const forgotPasswordLink = links?.forgotPassword || '/auth/forgot-password';\n const signUpLink = links?.signUp || '/auth/sign-up';\n\n const handleSubmit = async (\n values: { account: string; password: string },\n currentStep: 'identifier' | 'password',\n ) => {\n setIsLoading(true);\n setError(null);\n\n try {\n if (currentStep === 'identifier') {\n const checkResult = await client.checkUser({\n identifier: values.account,\n });\n\n if (checkResult.exists) {\n setIdentifier(values.account);\n setStep('password');\n } else {\n const email = isPhone(values.account) ? '' : values.account;\n if (email) {\n onNavigate(`${signUpLink}?email=${encodeURIComponent(email)}`);\n } else {\n onNavigate(\n `${signUpLink}?phone=${encodeURIComponent(values.account)}`,\n );\n }\n return;\n }\n } else {\n const res = await client.signInWithPassword({\n identifier,\n password: values.password,\n });\n\n if ('verificationId' in res && res.verificationId) {\n const verifyPath = isPhone(identifier)\n ? `/auth/verify-phone?context=sign-in&verificationId=${res.verificationId}&identifier=${encodeURIComponent(identifier)}`\n : `/auth/verify-email?verificationId=${res.verificationId}`;\n onNavigate(verifyPath);\n return;\n }\n\n if ('user' in res && 'session' in res) {\n setAuth(res);\n }\n onNavigate(defaultRedirect);\n }\n } catch (err) {\n handleError(err, setError, t);\n } finally {\n setIsLoading(false);\n }\n };\n\n const handleBack = () => {\n setStep('identifier');\n setIdentifier('');\n setError(null);\n };\n\n const isStepPassword = step === 'password';\n\n return (\n <div className=\"space-y-4\">\n <AuthPageLayout\n title={t('title')}\n description={isStepPassword ? undefined : t('description')}\n error={error}\n logoImage={logoImage}\n footer={\n <div\n className=\"flex items-center justify-center w-full gap-2\"\n style={{\n justifyContent: isStepPassword ? 'space-between' : 'center',\n }}\n >\n {isStepPassword && (\n // biome-ignore lint/a11y/useKeyWithClickEvents: change account\n <p\n className=\"text-primary inline-block cursor-pointer hover:underline\"\n onClick={handleBack}\n >\n {t('changeAccount')}\n </p>\n )}\n\n {Link ? (\n <Link\n href={forgotPasswordLink}\n className=\"text-primary inline-block hover:underline\"\n >\n {t('footer.forgotPassword')}\n </Link>\n ) : (\n <a\n href={forgotPasswordLink}\n className=\"text-primary inline-block hover:underline\"\n >\n {t('footer.forgotPassword')}\n </a>\n )}\n </div>\n }\n >\n <SignIn\n onSubmit={handleSubmit}\n isLoading={isLoading}\n identifier={identifier}\n step={step}\n />\n </AuthPageLayout>\n </div>\n );\n};\n","'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { Button } from '@mesob/ui/components/button';\nimport {\n Form,\n FormControl,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '@mesob/ui/components/form';\nimport { Input } from '@mesob/ui/components/input';\nimport { Spinner } from '@mesob/ui/components/spinner';\nimport { IconEye, IconEyeOff } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { useMemo, useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { z } from 'zod';\nimport { normalizePhone } from '../../utils/normalize-phone';\n\ntype SignInFormValues = {\n account: string;\n password: string;\n};\n\ntype SignInProps = {\n onSubmit: (\n values: SignInFormValues,\n step: 'identifier' | 'password',\n ) => Promise<void> | void;\n isLoading?: boolean;\n identifier?: string;\n step?: 'identifier' | 'password';\n onBack?: () => void;\n};\n\nexport const SignIn = ({\n onSubmit,\n isLoading = false,\n identifier = '',\n step = 'identifier',\n onBack: _onBack,\n}: SignInProps) => {\n const t = useTranslations('Auth.signIn');\n const [showPassword, setShowPassword] = useState(false);\n\n const identifierSchema = useMemo(\n () =>\n z.object({\n account: z\n .string()\n .trim()\n .min(1, { message: t('errors.requiredField') })\n .refine(\n (val) => {\n const isEmail = z.string().email().safeParse(val).success;\n const phoneRegex = /^(\\+2519|2519|09)\\d{8}$/;\n const isPhone = phoneRegex.test(val);\n return isEmail || isPhone;\n },\n {\n message: t('errors.invalidEmailOrPhone'),\n },\n ),\n }),\n [t],\n );\n\n const passwordSchema = useMemo(\n () =>\n z.object({\n password: z\n .string()\n .min(8, t('errors.passwordLength'))\n .max(128, t('errors.longPasswordError')),\n }),\n [t],\n );\n\n const identifierForm = useForm<{ account: string }>({\n resolver: zodResolver(identifierSchema),\n defaultValues: {\n account: identifier,\n },\n });\n\n const passwordForm = useForm<{ password: string }>({\n resolver: zodResolver(passwordSchema),\n defaultValues: {\n password: '',\n },\n });\n\n const handleIdentifierSubmit = identifierForm.handleSubmit(async (values) => {\n const phoneRegex = /^(\\+2519|2519|09)\\d{8}$/;\n const normalizedAccount = phoneRegex.test(values.account)\n ? normalizePhone(values.account)\n : values.account;\n await onSubmit({ account: normalizedAccount, password: '' }, 'identifier');\n });\n\n const handlePasswordSubmit = passwordForm.handleSubmit(async (values) => {\n await onSubmit(\n { account: identifier, password: values.password },\n 'password',\n );\n });\n\n if (step === 'password') {\n return (\n <Form {...passwordForm}>\n <form onSubmit={handlePasswordSubmit} className=\"space-y-4\">\n <div className=\"text-center\">\n <p className=\"text-sm text-muted-foreground mb-2\">\n {t('form.enterPasswordFor')}\n </p>\n <p className=\"font-bold\">{identifier}</p>\n </div>\n <FormField\n control={passwordForm.control}\n name=\"password\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.passwordLabel')}</FormLabel>\n <FormControl>\n <div className=\"relative\">\n <Input\n type={showPassword ? 'text' : 'password'}\n placeholder={t('form.passwordPlaceholder')}\n autoComplete=\"current-password\"\n {...field}\n />\n <button\n type=\"button\"\n onClick={() => setShowPassword(!showPassword)}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground\"\n >\n {showPassword ? (\n <IconEyeOff className=\"h-4 w-4\" />\n ) : (\n <IconEye className=\"h-4 w-4\" />\n )}\n </button>\n </div>\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading ? t('form.submitting') : t('form.submit')}\n </Button>\n </form>\n </Form>\n );\n }\n\n return (\n <Form {...identifierForm}>\n <form onSubmit={handleIdentifierSubmit} className=\"space-y-4\">\n <FormField\n control={identifierForm.control}\n name=\"account\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.accountLabel')}</FormLabel>\n <FormControl>\n <Input\n type=\"text\"\n placeholder={t('form.accountPlaceholder')}\n {...field}\n />\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading && <Spinner />}\n {isLoading ? t('form.submitting') : t('form.continue')}\n </Button>\n </form>\n </Form>\n );\n};\n","export function normalizePhone(phone: string): string {\n const cleaned = phone.trim().replace(/\\s/g, '');\n if (cleaned.startsWith('+2519')) {\n return cleaned;\n }\n if (cleaned.startsWith('2519')) {\n return `+${cleaned}`;\n }\n if (cleaned.startsWith('09')) {\n return `+251${cleaned.slice(1)}`;\n }\n if (cleaned.startsWith('9') && cleaned.length === 9) {\n return `+251${cleaned}`;\n }\n return cleaned;\n}\n","'use client';\n\nimport { useTranslations } from 'next-intl';\nimport type { ComponentProps } from 'react';\nimport { useState } from 'react';\nimport { useAuth } from '../../../context/auth-provider';\nimport type { AuthErrorContent } from '../../../utils/handle-error';\nimport { handleError } from '../../../utils/handle-error';\n\nimport { AuthPageLayout } from '../auth-page-layout';\nimport { SignUp } from '../sign-up';\n\nconst isPhone = (s: string) => /^\\+?[0-9()[\\]\\s-]{6,}$/.test(s);\n\ntype SignUpFormValues = {\n fullName: string;\n identifier: string;\n handle?: string;\n password: string;\n confirmPassword: string;\n};\n\ntype SignUpPageProps = {\n locale?: string;\n redirectUrl?: string;\n onNavigate: (path: string) => void;\n linkComponent?: React.ComponentType<ComponentProps<'a'> & { href: string }>;\n links?: {\n signIn?: string;\n };\n initialIdentifier?: string;\n logoImage?: string;\n};\n\nexport const SignUpPage = ({\n redirectUrl,\n onNavigate,\n linkComponent: Link,\n links,\n initialIdentifier,\n logoImage,\n}: SignUpPageProps) => {\n const t = useTranslations('Auth.signUp');\n const { client, setAuth } = useAuth();\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<AuthErrorContent | null>(null);\n\n const signInLink = links?.signIn || '/auth/sign-in';\n\n const handleSubmit = async (values: SignUpFormValues) => {\n setIsLoading(true);\n setError(null);\n\n try {\n const identifier = values.identifier;\n const usingPhone = isPhone(identifier);\n\n const res = usingPhone\n ? await client.signUpWithPhone({\n phone: identifier,\n password: values.password,\n fullName: values.fullName,\n handle: values.handle,\n })\n : await client.signUpWithEmail({\n email: identifier,\n password: values.password,\n fullName: values.fullName,\n handle: values.handle,\n });\n\n if ('verificationId' in res && res.verificationId) {\n if (usingPhone) {\n onNavigate(\n `/auth/verify-phone?context=sign-up&verificationId=${res.verificationId}&phone=${encodeURIComponent(identifier)}`,\n );\n } else {\n onNavigate(\n `/auth/verify-email?verificationId=${res.verificationId}&email=${encodeURIComponent(identifier)}`,\n );\n }\n return;\n }\n\n if ('user' in res && 'session' in res) {\n setAuth(res);\n }\n onNavigate(redirectUrl || '/');\n } catch (err) {\n handleError(err, setError, t);\n } finally {\n setIsLoading(false);\n }\n };\n\n return (\n <AuthPageLayout\n title={t('title')}\n description={t('description')}\n error={error}\n logoImage={logoImage}\n footer={\n <p>\n {t('footer.hasAccount')}{' '}\n {Link ? (\n <Link href={signInLink} className=\"text-primary hover:underline\">\n {t('footer.signInCta')}\n </Link>\n ) : (\n <a\n href={signInLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(signInLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {t('footer.signInCta')}\n </a>\n )}\n </p>\n }\n >\n <SignUp\n onSubmit={handleSubmit}\n isLoading={isLoading}\n initialIdentifier={initialIdentifier}\n />\n </AuthPageLayout>\n );\n};\n","'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { Button } from '@mesob/ui/components/button';\nimport {\n Form,\n FormControl,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '@mesob/ui/components/form';\nimport { Input } from '@mesob/ui/components/input';\nimport { IconEye, IconEyeOff } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { useEffect, useMemo, useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { z } from 'zod';\n\nconst isPhone = (s: string) => /^\\+?[0-9()[\\]\\s-]{6,}$/.test(s);\n\ntype SignUpFormValues = {\n fullName: string;\n identifier: string;\n handle?: string;\n password: string;\n confirmPassword: string;\n};\n\ntype SignUpProps = {\n onSubmit: (values: SignUpFormValues) => Promise<void> | void;\n isLoading?: boolean;\n initialIdentifier?: string;\n};\n\nexport const SignUp = ({\n onSubmit,\n isLoading = false,\n initialIdentifier,\n}: SignUpProps) => {\n const t = useTranslations('Auth.signUp');\n const hasInitialIdentifier = !!initialIdentifier;\n const [showPassword, setShowPassword] = useState(false);\n const [showConfirmPassword, setShowConfirmPassword] = useState(false);\n\n const signUpSchema = useMemo(\n () =>\n z\n .object({\n fullName: z.string().min(1, t('errors.fullNameRequired')),\n identifier: z\n .string()\n .min(1, t('errors.contactRequired'))\n .refine(\n (val) => {\n if (!val) {\n return false;\n }\n return val.includes('@') || isPhone(val);\n },\n {\n message: t('errors.invalidEmailOrPhone'),\n },\n ),\n password: z\n .string()\n .min(8, t('errors.passwordLength'))\n .max(128, t('errors.longPasswordError')),\n confirmPassword: z.string(),\n })\n .refine((data) => data.password === data.confirmPassword, {\n message: t('errors.passwordsMismatch'),\n path: ['confirmPassword'],\n }),\n [t],\n );\n\n const form = useForm<SignUpFormValues>({\n resolver: zodResolver(signUpSchema),\n defaultValues: {\n fullName: '',\n identifier: initialIdentifier || '',\n password: '',\n confirmPassword: '',\n },\n });\n\n useEffect(() => {\n if (initialIdentifier) {\n form.setValue('identifier', initialIdentifier);\n }\n }, [initialIdentifier, form]);\n\n const handleSubmit = form.handleSubmit(async (values) => {\n await onSubmit(values);\n });\n\n const getIdentifierLabel = () => {\n if (!hasInitialIdentifier) {\n return t('form.accountLabel') || 'Email/Phone';\n }\n if (initialIdentifier?.includes('@')) {\n return t('form.emailLabel');\n }\n return t('form.phoneLabel');\n };\n const identifierLabel = getIdentifierLabel();\n\n return (\n <Form {...form}>\n <form onSubmit={handleSubmit} className=\"space-y-4\">\n <FormField\n control={form.control}\n name=\"fullName\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.fullNameLabel')}</FormLabel>\n <FormControl>\n <Input placeholder={t('form.fullNamePlaceholder')} {...field} />\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <FormField\n control={form.control}\n name=\"identifier\"\n render={({ field }) => (\n <FormItem>\n <FormLabel className={hasInitialIdentifier ? 'block' : undefined}>\n {identifierLabel}\n </FormLabel>\n <FormControl>\n <Input\n type={field.value.includes('@') ? 'email' : 'tel'}\n placeholder={\n hasInitialIdentifier\n ? undefined\n : t('form.accountPlaceholder') || 'Email or phone number'\n }\n {...field}\n disabled={hasInitialIdentifier}\n />\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <FormField\n control={form.control}\n name=\"password\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.passwordLabel')}</FormLabel>\n <FormControl>\n <div className=\"relative\">\n <Input\n type={showPassword ? 'text' : 'password'}\n placeholder={t('form.passwordPlaceholder')}\n {...field}\n />\n <button\n type=\"button\"\n onClick={() => setShowPassword(!showPassword)}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground\"\n >\n {showPassword ? (\n <IconEyeOff className=\"h-4 w-4\" />\n ) : (\n <IconEye className=\"h-4 w-4\" />\n )}\n </button>\n </div>\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <FormField\n control={form.control}\n name=\"confirmPassword\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.confirmPasswordLabel')}</FormLabel>\n <FormControl>\n <div className=\"relative\">\n <Input\n type={showConfirmPassword ? 'text' : 'password'}\n placeholder={t('form.passwordPlaceholder')}\n {...field}\n />\n <button\n type=\"button\"\n onClick={() => setShowConfirmPassword(!showConfirmPassword)}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground\"\n >\n {showConfirmPassword ? (\n <IconEyeOff className=\"h-4 w-4\" />\n ) : (\n <IconEye className=\"h-4 w-4\" />\n )}\n </button>\n </div>\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading ? t('form.submitting') : t('form.submit')}\n </Button>\n </form>\n </Form>\n );\n};\n","'use client';\n\nimport { useTranslations } from 'next-intl';\nimport type { ComponentProps } from 'react';\nimport { useState } from 'react';\nimport { useAuth } from '../../../context/auth-provider';\nimport type { AuthErrorContent } from '../../../utils/handle-error';\nimport { handleError } from '../../../utils/handle-error';\n\nimport { AuthPageLayout } from '../auth-page-layout';\nimport { VerificationForm } from '../verification-form';\n\ntype VerifyEmailPageProps = {\n locale?: string;\n verificationId: string;\n email: string;\n onNavigate: (path: string) => void;\n linkComponent?: React.ComponentType<ComponentProps<'a'> & { href: string }>;\n links?: {\n signIn?: string;\n };\n logoImage?: string;\n redirectUrl: string;\n};\n\nexport const VerifyEmailPage = ({\n verificationId,\n onNavigate,\n linkComponent: Link,\n links,\n email,\n logoImage,\n redirectUrl,\n}: VerifyEmailPageProps) => {\n const t = useTranslations('Auth.verification');\n const common = useTranslations('Common');\n const footer = useTranslations('Auth.forgotPassword.footer');\n const { client, setAuth } = useAuth();\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<AuthErrorContent | null>(null);\n\n const signInLink = links?.signIn || '/auth/sign-in';\n\n const handleSubmit = async (values: { code: string }) => {\n if (!verificationId) {\n setError({\n title: t('errors.fallback'),\n description: t('errors.missingVerificationId'),\n });\n return;\n }\n\n setIsLoading(true);\n setError(null);\n\n try {\n const res = await client.verifyEmail({\n verificationId,\n code: values.code,\n });\n if ('user' in res && 'session' in res) {\n setAuth(res);\n }\n onNavigate(redirectUrl || '/');\n } catch (err) {\n handleError(err, setError, t);\n } finally {\n setIsLoading(false);\n }\n };\n\n const handleResend = async () => {\n setError(null);\n try {\n const res = await client.requestEmailVerification({ email });\n if (res.verificationId) {\n onNavigate(\n `/auth/verify-email?verificationId=${res.verificationId}&email=${encodeURIComponent(email)}`,\n );\n } else {\n setError({\n title: t('errors.fallback'),\n description: t('errors.resendFailed'),\n });\n }\n } catch (err) {\n handleError(err, setError, t);\n }\n };\n\n if (!verificationId) {\n return (\n <AuthPageLayout\n title={common('invalidLinkTitle')}\n description={common('invalidLinkDescription')}\n footer={\n Link ? (\n <Link href={signInLink} className=\"text-primary hover:underline\">\n {footer('backToSignIn')}\n </Link>\n ) : (\n <a\n href={signInLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(signInLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {footer('backToSignIn')}\n </a>\n )\n }\n >\n <div />\n </AuthPageLayout>\n );\n }\n\n return (\n <AuthPageLayout\n title={t('email.title')}\n description={t('email.description')}\n error={error}\n logoImage={logoImage}\n footer={\n Link ? (\n <Link href={signInLink} className=\"text-primary hover:underline\">\n {footer('backToSignIn')}\n </Link>\n ) : (\n <a\n href={signInLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(signInLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {footer('backToSignIn')}\n </a>\n )\n }\n >\n <VerificationForm\n verificationId={verificationId}\n onSubmit={handleSubmit}\n onResend={handleResend}\n isLoading={isLoading}\n error={error}\n />\n </AuthPageLayout>\n );\n};\n","'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { Button } from '@mesob/ui/components/button';\nimport {\n Form,\n FormControl,\n FormField,\n FormItem,\n FormMessage,\n} from '@mesob/ui/components/form';\nimport {\n InputOTP,\n InputOTPGroup,\n InputOTPSlot,\n} from '@mesob/ui/components/input-otp';\nimport { Spinner } from '@mesob/ui/components/spinner';\nimport { useTranslations } from 'next-intl';\nimport { useMemo } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { z } from 'zod';\nimport type { AuthErrorContent } from '../../utils/handle-error';\nimport { Countdown } from './countdown';\n\ntype VerificationFormValues = {\n code: string;\n};\n\ntype VerificationFormProps = {\n verificationId: string;\n onSubmit: (values: VerificationFormValues) => Promise<void> | void;\n onResend: () => Promise<void> | void;\n isLoading?: boolean;\n error?: AuthErrorContent | string | null;\n};\n\nexport const VerificationForm = ({\n onSubmit,\n onResend,\n isLoading = false,\n}: VerificationFormProps) => {\n const t = useTranslations('Auth.verification');\n const verificationSchema = useMemo(\n () =>\n z.object({\n code: z.string().length(6, t('form.codeLength')),\n }),\n [t],\n );\n const form = useForm<VerificationFormValues>({\n resolver: zodResolver(verificationSchema),\n defaultValues: {\n code: '',\n },\n });\n\n return (\n <Form {...form}>\n <form className=\"space-y-4\">\n <FormField\n control={form.control}\n name=\"code\"\n render={({ field }) => (\n <FormItem>\n <FormControl>\n <div className=\"flex justify-center\">\n <InputOTP\n maxLength={6}\n id=\"otp\"\n required\n value={field.value ?? ''}\n onChange={field.onChange}\n onBlur={field.onBlur}\n containerClassName=\"gap-4 justify-center mb-2 flex items-center\"\n >\n <InputOTPGroup className=\"gap-3 *:data-[slot=input-otp-slot]:h-12 *:data-[slot=input-otp-slot]:w-12 *:data-[slot=input-otp-slot]:rounded-md *:data-[slot=input-otp-slot]:border *:data-[slot=input-otp-slot]:text-xl\">\n <InputOTPSlot className=\"h-12\" index={0} />\n <InputOTPSlot className=\"h-12\" index={1} />\n <InputOTPSlot className=\"h-12\" index={2} />\n <InputOTPSlot className=\"h-12\" index={3} />\n <InputOTPSlot className=\"h-12\" index={4} />\n <InputOTPSlot className=\"h-12\" index={5} />\n </InputOTPGroup>\n </InputOTP>\n </div>\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n\n <div className=\"flex justify-between items-center\">\n <Countdown onResend={onResend} resending={isLoading} />\n <Button\n type=\"button\"\n onClick={() => {\n form.handleSubmit(async (values) => {\n await onSubmit(values);\n })();\n }}\n disabled={isLoading || form.watch('code').length !== 6}\n >\n {isLoading && <Spinner />}\n {t('form.confirm')}\n </Button>\n </div>\n </form>\n </Form>\n );\n};\n","'use client';\n\nimport { useTranslations } from 'next-intl';\nimport type { ComponentProps } from 'react';\nimport { useState } from 'react';\nimport { useAuth } from '../../../context/auth-provider';\nimport type { AuthResponse } from '../../../types';\nimport type { AuthErrorContent } from '../../../utils/handle-error';\nimport { handleError } from '../../../utils/handle-error';\n\nimport { AuthPageLayout } from '../auth-page-layout';\nimport { VerificationForm } from '../verification-form';\n\ntype VerifyPhonePageProps = {\n locale?: string;\n verificationId: string;\n context: 'sign-in' | 'sign-up';\n phone?: string;\n onNavigate: (path: string) => void;\n linkComponent?: React.ComponentType<ComponentProps<'a'> & { href: string }>;\n links?: {\n signIn?: string;\n };\n logoImage?: string;\n redirectUrl?: string;\n};\nexport const VerifyPhonePage = ({\n verificationId,\n context,\n phone = '',\n onNavigate,\n linkComponent: Link,\n links,\n logoImage,\n redirectUrl,\n}: VerifyPhonePageProps) => {\n const t = useTranslations('Auth.verification');\n const common = useTranslations('Common');\n const footer = useTranslations('Auth.forgotPassword.footer');\n const { client, refresh, setAuth } = useAuth();\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<AuthErrorContent | null>(null);\n\n const signInLink = links?.signIn || '/auth/sign-in';\n\n const handleSubmit = async (values: { code: string }) => {\n if (!verificationId) {\n setError({\n title: t('errors.fallback'),\n description: t('errors.fallback'),\n });\n return;\n }\n\n setIsLoading(true);\n setError(null);\n\n try {\n const res = await client.verifyPhoneOtp({\n verificationId,\n code: values.code,\n context,\n });\n if (res && 'user' in res && 'session' in res && res.session) {\n setAuth(res as AuthResponse);\n onNavigate(redirectUrl || '/');\n return;\n }\n await refresh();\n onNavigate(redirectUrl || '/');\n } catch (err) {\n handleError(err, setError, t);\n } finally {\n setIsLoading(false);\n }\n };\n\n const handleResend = async () => {\n setError(null);\n try {\n const targetPhone = context === 'sign-up' ? phone : null;\n if (!targetPhone) {\n setError({\n title: t('errors.fallback'),\n description: t('phone.missingPhone'),\n });\n return;\n }\n const res = await client.requestPhoneOtp({ phone: targetPhone, context });\n if (res && 'verificationId' in res && res.verificationId) {\n onNavigate(\n `/auth/verify-phone?context=${context}&verificationId=${res.verificationId}&phone=${targetPhone}`,\n );\n return;\n }\n setError({\n title: t('errors.fallback'),\n description: t('phone.resendFailed'),\n });\n } catch (err) {\n handleError(err, setError, t);\n }\n };\n\n if (!verificationId) {\n return (\n <AuthPageLayout\n title={common('invalidLinkTitle')}\n description={common('invalidLinkDescription')}\n footer={\n Link ? (\n <Link href={signInLink} className=\"text-primary hover:underline\">\n {footer('backToSignIn')}\n </Link>\n ) : (\n <a\n href={signInLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(signInLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {footer('backToSignIn')}\n </a>\n )\n }\n >\n <div />\n </AuthPageLayout>\n );\n }\n\n return (\n <AuthPageLayout\n title={t('phone.title')}\n description={t('phone.description', {\n target: phone || t('phone.missingPhone'),\n })}\n error={error}\n logoImage={logoImage}\n footer={\n Link ? (\n <Link href={signInLink} className=\"text-primary hover:underline\">\n {footer('backToSignIn')}\n </Link>\n ) : (\n <a\n href={signInLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(signInLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {footer('backToSignIn')}\n </a>\n )\n }\n >\n <VerificationForm\n verificationId={verificationId}\n onSubmit={handleSubmit}\n onResend={handleResend}\n isLoading={isLoading}\n error={error}\n />\n </AuthPageLayout>\n );\n};\n","import type { AuthClientConfig } from './client';\nimport { AuthClient } from './client';\n\nexport const createAuthClient = (config: AuthClientConfig) => {\n const client = new AuthClient(config);\n\n return {\n signUpWithEmail: client.signUpWithEmail.bind(client),\n signUpWithPhone: client.signUpWithPhone.bind(client),\n signInWithPassword: client.signInWithPassword.bind(client),\n signOut: client.signOut.bind(client),\n requestEmailVerification: client.requestEmailVerification.bind(client),\n verifyEmail: client.verifyEmail.bind(client),\n resendVerification: client.resendVerification.bind(client),\n requestPhoneOtp: client.requestPhoneOtp.bind(client),\n verifyPhoneOtp: client.verifyPhoneOtp.bind(client),\n forgotPassword: client.forgotPassword.bind(client),\n resetPassword: client.resetPassword.bind(client),\n changePassword: client.changePassword.bind(client),\n getSession: client.getSession.bind(client),\n useSession: () => {\n // This will be used via AuthProvider context\n throw new Error('useSession must be used within AuthProvider');\n },\n };\n};\n","'use client';\n\nimport { useAuth } from '../context/auth-provider';\n\nexport const useSession = () => {\n const { user, session, loading, error, refresh } = useAuth();\n\n return {\n user,\n session,\n isLoading: loading,\n isAuthenticated: !!user && !!session,\n error,\n refresh,\n };\n};\n"],"mappings":";;;AAYA,IAAM,kBAA4C;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,YAAN,cAAwB,MAAM;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EAEA,YACE,SACA,MACA,QACA,SACA;AACA,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,UAAU;AAAA,EACjB;AACF;AAMO,IAAM,aAAN,MAAiB;AAAA,EACd;AAAA,EAER,YAAY,QAA0B;AACpC,SAAK,UAAU,OAAO,QAAQ,QAAQ,OAAO,EAAE;AAAA,EACjD;AAAA,EAEA,MAAc,QACZ,UACA,UAAuB,CAAC,GACZ;AACZ,UAAM,MAAM,GAAG,KAAK,OAAO,GAAG,QAAQ;AACtC,UAAM,WAAW,MAAM,MAAM,KAAK;AAAA,MAChC,GAAG;AAAA,MACH,aAAa;AAAA,MACb,SAAS;AAAA,QACP,gBAAgB;AAAA,QAChB,GAAG,QAAQ;AAAA,MACb;AAAA,IACF,CAAC;AACD,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,OAAO,MAAM,SAAS,KAAK;AACjC,UAAI;AACJ,UAAI;AACF,oBAAY,KAAK,MAAM,IAAI;AAAA,MAC7B,QAAQ;AACN,oBAAY,EAAE,OAAO,iBAAiB,SAAS,KAAK;AAAA,MACtD;AAIA,YAAM,gBACJ,UAAU,SACT,OAAO,UAAU,UAAU,WAAW,UAAU,QAAQ,UACxD,OAAO,UAAU,YAAY,WAAW,U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AAAA,MACxB;AAAA,MAIJ,0BAAAA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,UAAU;AAAA,UACV,UAAU;AAAA,UACV;AAAA,UACA;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;;;ACtKO,IAAM,mBAAmB,CAAC,WAA6B;AAC5D,QAAM,SAAS,IAAI,WAAW,MAAM;AAEpC,SAAO;AAAA,IACL,iBAAiB,OAAO,gBAAgB,KAAK,MAAM;AAAA,IACnD,iBAAiB,OAAO,gBAAgB,KAAK,MAAM;AAAA,IACnD,oBAAoB,OAAO,mBAAmB,KAAK,MAAM;AAAA,IACzD,SAAS,OAAO,QAAQ,KAAK,MAAM;AAAA,IACnC,0BAA0B,OAAO,yBAAyB,KAAK,MAAM;AAAA,IACrE,aAAa,OAAO,YAAY,KAAK,MAAM;AAAA,IAC3C,oBAAoB,OAAO,mBAAmB,KAAK,MAAM;AAAA,IACzD,iBAAiB,OAAO,gBAAgB,KAAK,MAAM;AAAA,IACnD,gBAAgB,OAAO,eAAe,KAAK,MAAM;AAAA,IACjD,gBAAgB,OAAO,eAAe,KAAK,MAAM;AAAA,IACjD,eAAe,OAAO,cAAc,KAAK,MAAM;AAAA,IAC/C,gBAAgB,OAAO,eAAe,KAAK,MAAM;AAAA,IACjD,YAAY,OAAO,WAAW,KAAK,MAAM;AAAA,IACzC,YAAY,MAAM;AAEhB,YAAM,IAAI,MAAM,6CAA6C;AAAA,IAC/D;AAAA,EACF;AACF;;;ACrBO,IAAM,aAAa,MAAM;AAC9B,QAAM,EAAE,MAAM,SAAS,SAAS,OAAO,QAAQ,IAAI,QAAQ;AAE3D,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,iBAAiB,CAAC,CAAC,QAAQ,CAAC,CAAC;AAAA,IAC7B;AAAA,IACA;AAAA,EACF;AACF;","names":["jsx","jsx","jsxs","Button","Spinner","useTranslations","jsx","jsxs","useTranslations","useState","useEffect","useState","jsx","jsx","useTranslations","useState","useTranslations","useState","zodResolver","Button","Form","FormControl","FormField","FormItem","FormLabel","FormMessage","Input","Spinner","useTranslations","useMemo","useState","useForm","z","jsx","jsxs","jsx","jsxs","useTranslations","useState","useTranslations","useState","zodResolver","Button","Form","FormControl","FormField","FormItem","FormLabel","FormMessage","Input","Spinner","IconEye","IconEyeOff","useTranslations","useMemo","useState","useForm","z","jsx","jsxs","useTranslations","useState","useMemo","z","isPhone","useForm","zodResolver","Form","FormField","FormItem","FormLabel","FormControl","Input","IconEyeOff","IconEye","FormMessage","Button","Spinner","jsx","jsxs","useTranslations","useState","useTranslations","useState","zodResolver","Button","Form","FormControl","FormField","FormItem","FormLabel","FormMessage","Input","IconEye","IconEyeOff","useTranslations","useEffect","useMemo","useState","useForm","z","jsx","jsxs","isPhone","jsx","jsxs","isPhone","useTranslations","useState","useTranslations","useState","zodResolver","Button","Form","FormControl","FormField","FormItem","FormMessage","InputOTP","InputOTPGroup","InputOTPSlot","Spinner","useTranslations","useMemo","useForm","z","jsx","jsxs","useTranslations","useMemo","z","useForm","zodResolver","Form","FormField","FormItem","FormControl","InputOTP","InputOTPGroup","InputOTPSlot","FormMessage","Button","Spinner","jsx","useTranslations","useState","useTranslations","useState","jsx","useTranslations","useState"]}
1
+ {"version":3,"sources":["../src/client.ts","../src/components/auth/auth-card.tsx","../src/components/auth/auth-page-layout.tsx","../src/components/auth/countdown.tsx","../src/components/auth/forgot-password.tsx","../src/components/auth/pages/forgot-password-page.tsx","../src/context/auth-provider.tsx","../src/constants/auth.error.codes.ts","../src/utils/handle-error.ts","../src/components/auth/pages/reset-password-page.tsx","../src/components/auth/reset-password-form.tsx","../src/components/auth/pages/sign-in-page.tsx","../src/components/auth/sign-in.tsx","../src/utils/normalize-phone.ts","../src/components/auth/pages/sign-up-page.tsx","../src/components/auth/sign-up.tsx","../src/components/auth/pages/verify-email-page.tsx","../src/components/auth/verification-form.tsx","../src/components/auth/pages/verify-phone-page.tsx","../src/factory.ts","../src/hooks/use-session.ts"],"sourcesContent":["import type {\n AuthErrorCode,\n AuthErrorResponse,\n AuthResponse,\n PendingAccountChangeResponse,\n SessionResponse,\n User,\n VerificationResponse,\n} from './types';\n\n// Backend returns error code in 'error' field (AUTH_ERRORS values)\n// or in 'code' field, message in 'message' or 'error' field\nconst validErrorCodes: readonly AuthErrorCode[] = [\n 'USER_NOT_FOUND',\n 'INVALID_PASSWORD',\n 'USER_EXISTS',\n 'VERIFICATION_EXPIRED',\n 'VERIFICATION_MISMATCH',\n 'VERIFICATION_NOT_FOUND',\n 'TOO_MANY_ATTEMPTS',\n 'REQUIRES_VERIFICATION',\n 'UNAUTHORIZED',\n 'ACCESS_DENIED',\n 'HAS_NO_PASSWORD',\n] as const;\n\nexport class AuthError extends Error {\n code?: AuthErrorCode;\n status?: number;\n details?: Record<string, unknown>;\n\n constructor(\n message: string,\n code?: AuthErrorCode,\n status?: number,\n details?: Record<string, unknown>,\n ) {\n super(message);\n this.name = 'AuthError';\n this.code = code;\n this.status = status;\n this.details = details;\n }\n}\n\nexport type AuthClientConfig = {\n baseURL: string;\n};\n\nexport class AuthClient {\n private baseURL: string;\n\n constructor(config: AuthClientConfig) {\n this.baseURL = config.baseURL.replace(/\\/$/, '');\n }\n\n private async request<T>(\n endpoint: string,\n options: RequestInit = {},\n ): Promise<T> {\n const url = `${this.baseURL}${endpoint}`;\n const response = await fetch(url, {\n ...options,\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n });\n if (!response.ok) {\n const text = await response.text();\n let errorData: AuthErrorResponse;\n try {\n errorData = JSON.parse(text);\n } catch {\n errorData = { error: 'Unknown error', message: text };\n }\n\n // Extract error code from code, error, or message field\n // Backend returns error codes in 'error' field (e.g., { error: 'INVALID_PASSWORD' })\n const potentialCode =\n errorData.code ||\n (typeof errorData.error === 'string' ? errorData.error : null) ||\n (typeof errorData.message === 'string' ? errorData.message : null);\n const upperCode = potentialCode?.toUpperCase().trim();\n const errorCode =\n upperCode && validErrorCodes.includes(upperCode as AuthErrorCode)\n ? (upperCode as AuthErrorCode)\n : undefined;\n const errorMessage =\n errorData.message || errorData.error || 'Request failed';\n\n throw new AuthError(\n errorMessage,\n errorCode as AuthErrorCode | undefined,\n response.status,\n errorData.details,\n );\n }\n\n const data = await response.json();\n return data;\n }\n\n signUpWithEmail(data: {\n email: string;\n password: string;\n fullName: string;\n handle?: string;\n }): Promise<AuthResponse | VerificationResponse> {\n return this.request<AuthResponse | VerificationResponse>('/sign-up', {\n method: 'POST',\n body: JSON.stringify({\n email: data.email,\n password: data.password,\n fullName: data.fullName,\n handle: data.handle,\n }),\n });\n }\n\n signUpWithPhone(data: {\n phone: string;\n password: string;\n fullName: string;\n handle?: string;\n }): Promise<AuthResponse | VerificationResponse> {\n return this.request<AuthResponse | VerificationResponse>('/sign-up', {\n method: 'POST',\n body: JSON.stringify({\n phone: data.phone,\n password: data.password,\n fullName: data.fullName,\n handle: data.handle,\n }),\n });\n }\n\n checkUser(data: { identifier: string }): Promise<{ exists: boolean }> {\n return this.request<{ exists: boolean }>('/check-user', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n signInWithPassword(data: {\n identifier: string;\n password: string;\n }): Promise<AuthResponse | VerificationResponse> {\n return this.request<AuthResponse | VerificationResponse>('/sign-in', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n signOut(): Promise<{ message: string }> {\n return this.request<{ message: string }>('/sign-out', {\n method: 'POST',\n });\n }\n\n requestEmailVerification(data?: {\n email?: string;\n }): Promise<{ verificationId: string }> {\n return this.request<{ verificationId: string }>(\n '/email/verification/request',\n {\n method: 'POST',\n body: JSON.stringify(data || {}),\n },\n );\n }\n\n verifyEmail(data: {\n verificationId: string;\n code: string;\n }): Promise<AuthResponse> {\n return this.request<AuthResponse>('/email/verification/confirm', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n resendVerification(_verificationId: string): Promise<{\n verificationId: string;\n }> {\n // For email, request new verification\n return this.requestEmailVerification();\n }\n\n requestPhoneOtp(data: {\n phone: string;\n context: 'sign-up' | 'sign-in' | 'change-phone';\n }): Promise<{ verificationId: string }> {\n return this.request<{ verificationId: string }>(\n '/phone/verification/request',\n {\n method: 'POST',\n body: JSON.stringify(data),\n },\n );\n }\n\n verifyPhoneOtp(data: {\n verificationId: string;\n code: string;\n context: 'sign-up' | 'sign-in' | 'change-phone';\n }): Promise<\n AuthResponse | { user: User | null; session: null; verified: boolean }\n > {\n return this.request('/phone/verification/confirm', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n forgotPassword(data: { identifier: string }): Promise<{\n message: string;\n }> {\n return this.request<{ message: string }>('/password/forgot', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n resetPassword(data: {\n verificationId: string;\n code: string;\n password: string;\n }): Promise<AuthResponse> {\n return this.request<AuthResponse>('/password/reset', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n verifyPassword(data: { password: string }): Promise<{ message: string }> {\n return this.request<{ message: string }>('/password/verify', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n changePassword(data: {\n currentPassword: string;\n newPassword: string;\n }): Promise<{ message: string }> {\n return this.request<{ message: string }>('/password/change', {\n method: 'POST',\n body: JSON.stringify(data),\n });\n }\n\n getSession(): Promise<SessionResponse> {\n return this.request<SessionResponse>('/session', {\n method: 'GET',\n });\n }\n\n getPendingAccountChange(): Promise<PendingAccountChangeResponse> {\n return this.request<PendingAccountChangeResponse>(\n '/account-change/pending',\n {\n method: 'GET',\n },\n );\n }\n\n updateProfile(data: { fullName?: string }): Promise<{ user: User }> {\n return this.request<{ user: User }>('/profile', {\n method: 'PUT',\n body: JSON.stringify(data),\n });\n }\n\n updateEmail(data: { email: string }): Promise<{ user: User }> {\n return this.request<{ user: User }>('/profile/email', {\n method: 'PUT',\n body: JSON.stringify(data),\n });\n }\n\n updatePhone(data: { phone: string }): Promise<{ user: User }> {\n return this.request<{ user: User }>('/profile/phone', {\n method: 'PUT',\n body: JSON.stringify(data),\n });\n }\n}\n","'use client';\n\nimport type { ReactNode } from 'react';\n\ntype AuthCardProps = {\n children: ReactNode;\n};\n\nexport const AuthCard = ({ children }: AuthCardProps) => {\n return (\n <div className=\"flex min-h-screen p-4 items-center justify-center\">\n <div className=\"w-full max-w-md\">\n <div className=\"rounded-xl border bg-card p-8 shadow-lg\">\n {children}\n </div>\n </div>\n </div>\n );\n};\n","'use client';\n\nimport {\n Alert,\n AlertDescription,\n AlertTitle,\n} from '@mesob/ui/components/alert';\nimport { IconAlertCircle } from '@tabler/icons-react';\nimport type { ReactNode } from 'react';\nimport type { AuthErrorContent } from '../../utils/handle-error';\n\ntype AuthPageLayoutProps = {\n title: string;\n description?: string;\n children: ReactNode;\n error?: AuthErrorContent | string | null;\n footer?: ReactNode;\n logoImage?: string;\n};\n\nexport const AuthPageLayout = ({\n title,\n description,\n children,\n error,\n footer,\n logoImage,\n}: AuthPageLayoutProps) => {\n const errorContent: AuthErrorContent | null = error\n ? // biome-ignore lint/style/noNestedTernary: <explanation>\n typeof error === 'string'\n ? { title: 'Error', description: error }\n : error\n : null;\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex size-8 mb-6 w-full items-center justify-center rounded-md\">\n {/** biome-ignore lint/performance/noImgElement: logo image */}\n <img src={logoImage || ''} alt=\"Jiret\" width={42} height={42} />\n </div>\n <div className=\"text-center\">\n <h1 className=\"text-2xl font-bold tracking-tight\">{title}</h1>\n {description && (\n <p className=\"mt-2 text-sm text-muted-foreground\">{description}</p>\n )}\n </div>\n\n {children}\n\n {errorContent && (\n <Alert variant=\"destructive\">\n <IconAlertCircle className=\"h-4 w-4\" />\n <AlertTitle>{errorContent.title}</AlertTitle>\n <AlertDescription>{errorContent.description}</AlertDescription>\n </Alert>\n )}\n <div className=\"mt-2 w-full\">\n {footer && (\n <div className=\"w-full text-center text-sm text-muted-foreground\">\n {footer}\n </div>\n )}\n </div>\n </div>\n );\n};\n","'use client';\n\nimport { Button } from '@mesob/ui/components/button';\nimport { Spinner } from '@mesob/ui/components/spinner';\nimport { useTranslations } from 'next-intl';\nimport { useEffect, useState } from 'react';\n\ntype CountdownProps = {\n initialSeconds?: number;\n onResend: () => Promise<void> | void;\n resending?: boolean;\n};\n\nexport const Countdown = ({\n initialSeconds = 60,\n onResend,\n resending = false,\n}: CountdownProps) => {\n const t = useTranslations('Common');\n const [seconds, setSeconds] = useState(initialSeconds);\n const [isResending, setIsResending] = useState(false);\n\n useEffect(() => {\n if (seconds <= 0) {\n return;\n }\n\n const timer = setInterval(() => {\n setSeconds((prev) => {\n if (prev <= 1) {\n clearInterval(timer);\n return 0;\n }\n return prev - 1;\n });\n }, 1000);\n\n return () => clearInterval(timer);\n }, [seconds]);\n\n const handleResend = async () => {\n setIsResending(true);\n try {\n await onResend();\n setSeconds(initialSeconds);\n } catch (_error) {\n // Error handling is done by parent\n } finally {\n setIsResending(false);\n }\n };\n\n if (seconds > 0) {\n return (\n <Button variant=\"ghost\" disabled>\n {t('resendIn', { seconds })}\n </Button>\n );\n }\n\n return (\n <Button\n variant=\"ghost\"\n onClick={handleResend}\n disabled={isResending || resending}\n >\n {isResending || (resending && <Spinner />)}\n {t('resend')}\n </Button>\n );\n};\n","'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { Button } from '@mesob/ui/components/button';\nimport {\n Form,\n FormControl,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '@mesob/ui/components/form';\nimport { Input } from '@mesob/ui/components/input';\nimport { Spinner } from '@mesob/ui/components/spinner';\nimport { useTranslations } from 'next-intl';\nimport { useMemo } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { z } from 'zod';\n\ntype ForgotPasswordFormValues = {\n account: string;\n};\n\ntype ForgotPasswordProps = {\n onSubmit: (values: ForgotPasswordFormValues) => Promise<void> | void;\n isLoading?: boolean;\n onBack?: () => void;\n};\n\nexport const ForgotPassword = ({\n onSubmit,\n isLoading = false,\n}: ForgotPasswordProps) => {\n const t = useTranslations('Auth.forgotPassword');\n const forgotPasswordSchema = useMemo(\n () =>\n z.object({\n account: z.string().min(1, t('errors.accountRequired')),\n }),\n [t],\n );\n\n const form = useForm<ForgotPasswordFormValues>({\n resolver: zodResolver(forgotPasswordSchema),\n defaultValues: {\n account: '',\n },\n });\n\n const handleSubmit = form.handleSubmit(async (values) => {\n await onSubmit(values);\n });\n\n return (\n <Form {...form}>\n <form onSubmit={handleSubmit} className=\"space-y-4\">\n <FormField\n control={form.control}\n name=\"account\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.accountLabel')}</FormLabel>\n <FormControl>\n <Input\n type=\"text\"\n placeholder={t('form.accountPlaceholder')}\n {...field}\n />\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading && <Spinner />}\n {isLoading ? t('form.submitting') : t('form.submit')}\n </Button>\n </form>\n </Form>\n );\n};\n","'use client';\n\nimport { useTranslations } from 'next-intl';\nimport type { ComponentProps } from 'react';\nimport { useState } from 'react';\nimport { useAuth } from '../../../context/auth-provider';\nimport type { AuthErrorContent } from '../../../utils/handle-error';\nimport { handleError } from '../../../utils/handle-error';\n\nimport { AuthPageLayout } from '../auth-page-layout';\nimport { ForgotPassword } from '../forgot-password';\n\ntype ForgotPasswordPageProps = {\n locale?: string;\n onNavigate: (path: string) => void;\n linkComponent?: React.ComponentType<ComponentProps<'a'> & { href: string }>;\n links?: {\n signIn?: string;\n };\n logoImage?: string;\n};\n\nexport const ForgotPasswordPage = ({\n onNavigate,\n linkComponent: Link,\n links,\n logoImage,\n}: ForgotPasswordPageProps) => {\n const t = useTranslations('Auth.forgotPassword');\n const { client } = useAuth();\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<AuthErrorContent | null>(null);\n\n const signInLink = links?.signIn || '/auth/sign-in';\n\n const handleSubmit = async (values: { account: string }) => {\n setIsLoading(true);\n setError(null);\n\n try {\n const res = await client.forgotPassword({ identifier: values.account });\n\n if ('verificationId' in res && res.verificationId) {\n onNavigate(`/auth/reset-password?verificationId=${res.verificationId}`);\n } else {\n onNavigate(\n `/auth/reset-password?identifier=${encodeURIComponent(values.account)}`,\n );\n }\n } catch (err) {\n handleError(err, setError, t);\n } finally {\n setIsLoading(false);\n }\n };\n\n const handleBack = () => {\n onNavigate(signInLink);\n };\n\n return (\n <AuthPageLayout\n title={t('title')}\n description={t('description')}\n error={error}\n logoImage={logoImage}\n footer={\n Link ? (\n <Link href={signInLink} className=\"text-primary hover:underline\">\n {t('footer.backToSignIn')}\n </Link>\n ) : (\n <a\n href={signInLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(signInLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {t('footer.backToSignIn')}\n </a>\n )\n }\n >\n <ForgotPassword\n onSubmit={handleSubmit}\n isLoading={isLoading}\n onBack={handleBack}\n />\n </AuthPageLayout>\n );\n};\n","'use client';\n\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport type { AuthClient } from '../client';\nimport type { AuthResponse, Session, User } from '../types';\n\ntype AuthContextValue = {\n user: User | null;\n session: Session | null;\n loading: boolean;\n error: Error | null;\n client: AuthClient;\n refresh: () => Promise<void>;\n setAuth: (data: AuthResponse) => void;\n};\n\nconst AuthContext = createContext<AuthContextValue | null>(null);\n\nexport const useAuth = () => {\n const context = useContext(AuthContext);\n if (!context) {\n throw new Error('useAuth must be used within AuthProvider');\n }\n return context;\n};\n\ntype AuthProviderProps = {\n client: AuthClient;\n children: ReactNode;\n};\n\nexport const AuthProvider = ({ client, children }: AuthProviderProps) => {\n const [user, setUser] = useState<User | null>(null);\n const [session, setSession] = useState<Session | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const refresh = useCallback(async () => {\n try {\n setLoading(true);\n setError(null);\n const data = await client.getSession();\n setUser(data.user);\n setSession(data.session);\n } catch (err) {\n setError(\n err instanceof Error ? err : new Error('Failed to fetch session'),\n );\n setUser(null);\n setSession(null);\n } finally {\n setLoading(false);\n }\n }, [client]);\n\n const setAuth = useCallback((data: AuthResponse) => {\n setUser(data.user);\n setSession(data.session);\n setError(null);\n setLoading(false);\n }, []);\n\n useEffect(() => {\n refresh();\n }, [refresh]);\n\n return (\n <AuthContext.Provider\n value={{\n user,\n session,\n loading,\n error,\n client,\n refresh,\n setAuth,\n }}\n >\n {children}\n </AuthContext.Provider>\n );\n};\n","export const AUTH_ERROR_MAPPING: Record<\n string,\n { title: string; description: string }\n> = {\n USER_NOT_FOUND: {\n title: 'Account Not Found',\n description:\n 'We could not find an account with that identifier. Please check your spelling or sign up.',\n },\n INVALID_PASSWORD: {\n title: 'Invalid Password',\n description: 'The password you entered is incorrect. Please try again.',\n },\n USER_EXISTS: {\n title: 'Account Already Exists',\n description:\n 'An account with this identifier already exists. Please sign in instead.',\n },\n VERIFICATION_EXPIRED: {\n title: 'Verification Expired',\n description:\n 'The verification code or link has expired. Please request a new one.',\n },\n VERIFICATION_MISMATCH: {\n title: 'Invalid Code',\n description:\n 'The verification code you entered is invalid. Please double-check and try again.',\n },\n VERIFICATION_NOT_FOUND: {\n title: 'Verification Not Found',\n description:\n 'We could not find a pending verification request. Please restart the process.',\n },\n TOO_MANY_ATTEMPTS: {\n title: 'Too Many Attempts',\n description:\n 'You have made too many requests recently. Please wait a moment before trying again.',\n },\n REQUIRES_VERIFICATION: {\n title: 'Verification Required',\n description:\n 'You need to verify your account before you can continue. Please check your email or phone.',\n },\n UNAUTHORIZED: {\n title: 'Unauthorized',\n description:\n 'You are not authorized to perform this action. Please sign in again.',\n },\n ACCESS_DENIED: {\n title: 'Access Denied',\n description:\n 'You do not have permission to access this resource. Please contact support if you believe this is an error.',\n },\n HAS_NO_PASSWORD: {\n title: 'No Password Set',\n description:\n 'Your account does not have a password set (e.g. social login). Please sign in with your provider or reset your password.',\n },\n};\n\nexport const validCodes = Object.keys(AUTH_ERROR_MAPPING);\n","import type { _Translator } from 'next-intl';\nimport { AuthError } from '../client';\nimport { AUTH_ERROR_MAPPING, validCodes } from '../constants/auth.error.codes';\n\nexport type AuthErrorContent = {\n title: string;\n description: string;\n};\n\nexport const handleError = (\n err: any,\n setError: (error: AuthErrorContent | null) => void,\n t: _Translator<Record<string, any>, string>,\n) => {\n if (err instanceof AuthError) {\n let errorCode = '';\n\n if (err.code && validCodes.includes(err.code)) {\n errorCode = err.code;\n } else if (err.message) {\n const messageUpper = err.message.toUpperCase().trim();\n if (validCodes.includes(messageUpper)) {\n errorCode = messageUpper;\n }\n }\n\n if (errorCode && AUTH_ERROR_MAPPING[errorCode]) {\n const mapping = AUTH_ERROR_MAPPING[errorCode];\n // Try to translate the description if a key exists, otherwise use English fallback\n // Since mapping.description is English text, we might want to check if there is a translation key\n // But for now, let's use the provided English mapping or try to find a translation if the key matches 'errors.code'\n\n // We can try to lookup translation, if it returns the key (or fallback), we might prefer the mapping text (which is nice English).\n // However, usually we prefer translation.\n // Let's rely on the mapping text primarily as per the request to \"Generate a description and title...\".\n // But if we want i18n support, we should probably add keys.\n // Given the prompt \"Generate a description... for each error code... and display\",\n // I will prioritize the static mapping I just created, but allows future i18n improvement.\n\n setError({\n title: mapping.title,\n description: mapping.description,\n });\n return;\n }\n\n // Fallback for AuthError without known code\n setError({\n title: t('errors.fallback'), // or 'Error'\n description: err.message || t('errors.fallback'),\n });\n } else {\n // Generic error\n const message = err instanceof Error ? err.message : t('errors.fallback');\n setError({\n title: 'Error',\n description: message,\n });\n }\n};\n","'use client';\n\nimport { useTranslations } from 'next-intl';\nimport type { ComponentProps } from 'react';\nimport { useState } from 'react';\nimport { useAuth } from '../../../context/auth-provider';\nimport type { AuthErrorContent } from '../../../utils/handle-error';\nimport { handleError } from '../../../utils/handle-error';\n\nimport { AuthPageLayout } from '../auth-page-layout';\nimport { ResetPasswordForm } from '../reset-password-form';\n\ntype ResetPasswordPageProps = {\n locale?: string;\n verificationId: string;\n onNavigate: (path: string) => void;\n linkComponent?: React.ComponentType<ComponentProps<'a'> & { href: string }>;\n links?: {\n signIn?: string;\n forgotPassword?: string;\n };\n logoImage?: string;\n redirectUrl?: string;\n};\n\nexport const ResetPasswordPage = ({\n verificationId,\n onNavigate,\n linkComponent: Link,\n links,\n logoImage,\n redirectUrl,\n}: ResetPasswordPageProps) => {\n const t = useTranslations('Auth.resetPassword');\n const common = useTranslations('Common');\n const { client, refresh } = useAuth();\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<AuthErrorContent | null>(null);\n\n const signInLink = links?.signIn || '/auth/sign-in';\n const forgotPasswordLink = links?.forgotPassword || '/auth/forgot-password';\n\n const handleSubmit = async (values: {\n code: string;\n password: string;\n confirmPassword: string;\n }) => {\n if (!verificationId) {\n setError({\n title: t('errors.fallback'),\n description: t('errors.missingVerificationId'),\n });\n return;\n }\n\n setIsLoading(true);\n setError(null);\n\n try {\n await client.resetPassword({\n verificationId,\n code: values.code,\n password: values.password,\n });\n await refresh();\n onNavigate(redirectUrl || '/');\n } catch (err) {\n handleError(err, setError, t);\n } finally {\n setIsLoading(false);\n }\n };\n\n if (!verificationId) {\n return (\n <AuthPageLayout\n title={common('invalidLinkTitle')}\n description={common('invalidLinkDescription')}\n logoImage={logoImage}\n footer={\n Link ? (\n <Link\n href={forgotPasswordLink}\n className=\"text-primary hover:underline\"\n >\n {t('footer.requestNew')}\n </Link>\n ) : (\n <a\n href={forgotPasswordLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(forgotPasswordLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {t('footer.requestNew')}\n </a>\n )\n }\n >\n <div />\n </AuthPageLayout>\n );\n }\n\n return (\n <AuthPageLayout\n title={t('title')}\n description={t('description')}\n error={error}\n logoImage={logoImage}\n footer={\n Link ? (\n <div className=\"flex items-center justify-between w-full gap-2\">\n <Link href={signInLink} className=\"text-primary hover:underline\">\n {t('footer.backToSignIn')}\n </Link>\n <Link\n href={forgotPasswordLink}\n className=\"text-primary hover:underline\"\n >\n {t('footer.changeAccount')}\n </Link>\n </div>\n ) : (\n <div className=\"flex items-center justify-between w-full gap-2\">\n <a\n href={forgotPasswordLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(forgotPasswordLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {t('footer.backToSignIn')}\n </a>\n <a\n href={forgotPasswordLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(forgotPasswordLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {t('footer.changeAccount')}\n </a>\n </div>\n )\n }\n >\n <ResetPasswordForm\n verificationId={verificationId}\n onSubmit={handleSubmit}\n isLoading={isLoading}\n error={error}\n />\n </AuthPageLayout>\n );\n};\n","'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { Button } from '@mesob/ui/components/button';\nimport {\n Form,\n FormControl,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '@mesob/ui/components/form';\nimport { Input } from '@mesob/ui/components/input';\nimport {\n InputOTP,\n InputOTPGroup,\n InputOTPSlot,\n} from '@mesob/ui/components/input-otp';\nimport { Spinner } from '@mesob/ui/components/spinner';\nimport { IconEye, IconEyeOff } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { useMemo, useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { z } from 'zod';\nimport type { AuthErrorContent } from '../../utils/handle-error';\n\ntype ResetPasswordFormValues = {\n code: string;\n password: string;\n confirmPassword: string;\n};\n\ntype ResetPasswordFormProps = {\n verificationId: string;\n onSubmit: (values: ResetPasswordFormValues) => Promise<void> | void;\n isLoading?: boolean;\n error?: AuthErrorContent | string | null;\n};\n\nexport const ResetPasswordForm = ({\n onSubmit,\n isLoading = false,\n}: ResetPasswordFormProps) => {\n const t = useTranslations('Auth.resetPassword');\n const [showPassword, setShowPassword] = useState(false);\n const resetPasswordSchema = useMemo(\n () =>\n z\n .object({\n code: z.string().length(6, t('errors.codeLength')),\n password: z.string().min(8, t('errors.passwordLength')),\n confirmPassword: z.string(),\n })\n .refine((data) => data.password === data.confirmPassword, {\n message: t('errors.passwordsMismatch'),\n path: ['confirmPassword'],\n }),\n [t],\n );\n\n const form = useForm<ResetPasswordFormValues>({\n resolver: zodResolver(resetPasswordSchema),\n defaultValues: {\n code: '',\n password: '',\n confirmPassword: '',\n },\n });\n\n const handleSubmit = form.handleSubmit(async (values) => {\n await onSubmit(values);\n });\n\n return (\n <Form {...form}>\n <form onSubmit={handleSubmit} className=\"space-y-4\">\n <FormField\n control={form.control}\n name=\"code\"\n render={({ field }) => (\n <FormItem>\n <div className=\"flex justify-center\">\n <FormLabel>{t('form.codeLabel')}</FormLabel>\n </div>\n <FormControl>\n <div className=\"flex mt-2 justify-center\">\n <InputOTP maxLength={6} {...field} containerClassName=\"gap-4\">\n <InputOTPGroup className=\"gap-3 *:data-[slot=input-otp-slot]:h-12 *:data-[slot=input-otp-slot]:w-12 *:data-[slot=input-otp-slot]:rounded-md *:data-[slot=input-otp-slot]:border *:data-[slot=input-otp-slot]:text-xl\">\n <InputOTPSlot className=\"h-12\" index={0} />\n <InputOTPSlot className=\"h-12\" index={1} />\n <InputOTPSlot className=\"h-12\" index={2} />\n <InputOTPSlot className=\"h-12\" index={3} />\n <InputOTPSlot className=\"h-12\" index={4} />\n <InputOTPSlot className=\"h-12\" index={5} />\n </InputOTPGroup>\n </InputOTP>\n </div>\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n\n <FormField\n control={form.control}\n name=\"password\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.passwordLabel')}</FormLabel>\n <FormControl>\n <div className=\"relative\">\n <Input\n type={showPassword ? 'text' : 'password'}\n placeholder={t('form.passwordPlaceholder')}\n {...field}\n />\n <button\n type=\"button\"\n onClick={() => setShowPassword(!showPassword)}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground\"\n >\n {showPassword ? (\n <IconEyeOff className=\"h-4 w-4\" />\n ) : (\n <IconEye className=\"h-4 w-4\" />\n )}\n </button>\n </div>\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n\n <FormField\n control={form.control}\n name=\"confirmPassword\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.confirmPasswordLabel')}</FormLabel>\n <FormControl>\n <div className=\"relative\">\n <Input\n type={showPassword ? 'text' : 'password'}\n placeholder={t('form.passwordPlaceholder')}\n {...field}\n />\n <button\n type=\"button\"\n onClick={() => setShowPassword(!showPassword)}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground\"\n >\n {showPassword ? (\n <IconEyeOff className=\"h-4 w-4\" />\n ) : (\n <IconEye className=\"h-4 w-4\" />\n )}\n </button>\n </div>\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading && <Spinner />}\n {isLoading ? t('form.submitting') : t('form.submit')}\n </Button>\n </form>\n </Form>\n );\n};\n","'use client';\n\nimport { useTranslations } from 'next-intl';\nimport type { ComponentProps } from 'react';\nimport { useState } from 'react';\nimport { useAuth } from '../../../context/auth-provider';\nimport type { AuthErrorContent } from '../../../utils/handle-error';\nimport { handleError } from '../../../utils/handle-error';\n\nimport { AuthPageLayout } from '../auth-page-layout';\nimport { SignIn } from '../sign-in';\n\nconst isPhone = (s: string) => /^\\+?[0-9()[\\]\\s-]{6,}$/.test(s);\n\ntype SignInPageProps = {\n locale?: string;\n redirectUrl?: string;\n onNavigate: (path: string) => void;\n linkComponent?: React.ComponentType<ComponentProps<'a'> & { href: string }>;\n links?: {\n forgotPassword?: string;\n signUp?: string;\n };\n logoImage?: string;\n};\n\nexport const SignInPage = ({\n redirectUrl,\n onNavigate,\n linkComponent: Link,\n links,\n logoImage,\n}: SignInPageProps) => {\n const t = useTranslations('Auth.signIn');\n const { client, setAuth } = useAuth();\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<AuthErrorContent | null>(null);\n const [step, setStep] = useState<'identifier' | 'password'>('identifier');\n const [identifier, setIdentifier] = useState<string>('');\n\n const defaultRedirect = redirectUrl || '/dashboard';\n const forgotPasswordLink = links?.forgotPassword || '/auth/forgot-password';\n const signUpLink = links?.signUp || '/auth/sign-up';\n\n const handleSubmit = async (\n values: { account: string; password: string },\n currentStep: 'identifier' | 'password',\n ) => {\n setIsLoading(true);\n setError(null);\n\n try {\n if (currentStep === 'identifier') {\n const checkResult = await client.checkUser({\n identifier: values.account,\n });\n\n if (checkResult.exists) {\n setIdentifier(values.account);\n setStep('password');\n } else {\n const email = isPhone(values.account) ? '' : values.account;\n if (email) {\n onNavigate(`${signUpLink}?email=${encodeURIComponent(email)}`);\n } else {\n onNavigate(\n `${signUpLink}?phone=${encodeURIComponent(values.account)}`,\n );\n }\n return;\n }\n } else {\n const res = await client.signInWithPassword({\n identifier,\n password: values.password,\n });\n\n if ('verificationId' in res && res.verificationId) {\n const verifyPath = isPhone(identifier)\n ? `/auth/verify-phone?context=sign-in&verificationId=${res.verificationId}&identifier=${encodeURIComponent(identifier)}`\n : `/auth/verify-email?verificationId=${res.verificationId}`;\n onNavigate(verifyPath);\n return;\n }\n\n if ('user' in res && 'session' in res) {\n setAuth(res);\n }\n onNavigate(defaultRedirect);\n }\n } catch (err) {\n handleError(err, setError, t);\n } finally {\n setIsLoading(false);\n }\n };\n\n const handleBack = () => {\n setStep('identifier');\n setIdentifier('');\n setError(null);\n };\n\n const isStepPassword = step === 'password';\n\n return (\n <div className=\"space-y-4\">\n <AuthPageLayout\n title={t('title')}\n description={isStepPassword ? undefined : t('description')}\n error={error}\n logoImage={logoImage}\n footer={\n <div\n className=\"flex items-center justify-center w-full gap-2\"\n style={{\n justifyContent: isStepPassword ? 'space-between' : 'center',\n }}\n >\n {isStepPassword && (\n // biome-ignore lint/a11y/useKeyWithClickEvents: change account\n <p\n className=\"text-primary inline-block cursor-pointer hover:underline\"\n onClick={handleBack}\n >\n {t('changeAccount')}\n </p>\n )}\n\n {Link ? (\n <Link\n href={forgotPasswordLink}\n className=\"text-primary inline-block hover:underline\"\n >\n {t('footer.forgotPassword')}\n </Link>\n ) : (\n <a\n href={forgotPasswordLink}\n className=\"text-primary inline-block hover:underline\"\n >\n {t('footer.forgotPassword')}\n </a>\n )}\n </div>\n }\n >\n <SignIn\n onSubmit={handleSubmit}\n isLoading={isLoading}\n identifier={identifier}\n step={step}\n />\n </AuthPageLayout>\n </div>\n );\n};\n","'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { Button } from '@mesob/ui/components/button';\nimport {\n Form,\n FormControl,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '@mesob/ui/components/form';\nimport { Input } from '@mesob/ui/components/input';\nimport { Spinner } from '@mesob/ui/components/spinner';\nimport { IconEye, IconEyeOff } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { useMemo, useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { z } from 'zod';\nimport { normalizePhone } from '../../utils/normalize-phone';\n\ntype SignInFormValues = {\n account: string;\n password: string;\n};\n\ntype SignInProps = {\n onSubmit: (\n values: SignInFormValues,\n step: 'identifier' | 'password',\n ) => Promise<void> | void;\n isLoading?: boolean;\n identifier?: string;\n step?: 'identifier' | 'password';\n onBack?: () => void;\n};\n\nexport const SignIn = ({\n onSubmit,\n isLoading = false,\n identifier = '',\n step = 'identifier',\n onBack: _onBack,\n}: SignInProps) => {\n const t = useTranslations('Auth.signIn');\n const [showPassword, setShowPassword] = useState(false);\n\n const identifierSchema = useMemo(\n () =>\n z.object({\n account: z\n .string()\n .trim()\n .min(1, { message: t('errors.requiredField') })\n .refine(\n (val) => {\n const isEmail = z.string().email().safeParse(val).success;\n const phoneRegex = /^(\\+2519|2519|09)\\d{8}$/;\n const isPhone = phoneRegex.test(val);\n return isEmail || isPhone;\n },\n {\n message: t('errors.invalidEmailOrPhone'),\n },\n ),\n }),\n [t],\n );\n\n const passwordSchema = useMemo(\n () =>\n z.object({\n password: z\n .string()\n .min(8, t('errors.passwordLength'))\n .max(128, t('errors.longPasswordError')),\n }),\n [t],\n );\n\n const identifierForm = useForm<{ account: string }>({\n resolver: zodResolver(identifierSchema),\n defaultValues: {\n account: identifier,\n },\n });\n\n const passwordForm = useForm<{ password: string }>({\n resolver: zodResolver(passwordSchema),\n defaultValues: {\n password: '',\n },\n });\n\n const handleIdentifierSubmit = identifierForm.handleSubmit(async (values) => {\n const phoneRegex = /^(\\+2519|2519|09)\\d{8}$/;\n const normalizedAccount = phoneRegex.test(values.account)\n ? normalizePhone(values.account)\n : values.account;\n await onSubmit({ account: normalizedAccount, password: '' }, 'identifier');\n });\n\n const handlePasswordSubmit = passwordForm.handleSubmit(async (values) => {\n await onSubmit(\n { account: identifier, password: values.password },\n 'password',\n );\n });\n\n if (step === 'password') {\n return (\n <Form {...passwordForm}>\n <form onSubmit={handlePasswordSubmit} className=\"space-y-4\">\n <div className=\"text-center\">\n <p className=\"text-sm text-muted-foreground mb-2\">\n {t('form.enterPasswordFor')}\n </p>\n <p className=\"font-bold\">{identifier}</p>\n </div>\n <FormField\n control={passwordForm.control}\n name=\"password\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.passwordLabel')}</FormLabel>\n <FormControl>\n <div className=\"relative\">\n <Input\n type={showPassword ? 'text' : 'password'}\n placeholder={t('form.passwordPlaceholder')}\n autoComplete=\"current-password\"\n {...field}\n />\n <button\n type=\"button\"\n onClick={() => setShowPassword(!showPassword)}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground\"\n >\n {showPassword ? (\n <IconEyeOff className=\"h-4 w-4\" />\n ) : (\n <IconEye className=\"h-4 w-4\" />\n )}\n </button>\n </div>\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading ? t('form.submitting') : t('form.submit')}\n </Button>\n </form>\n </Form>\n );\n }\n\n return (\n <Form {...identifierForm}>\n <form onSubmit={handleIdentifierSubmit} className=\"space-y-4\">\n <FormField\n control={identifierForm.control}\n name=\"account\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.accountLabel')}</FormLabel>\n <FormControl>\n <Input\n type=\"text\"\n placeholder={t('form.accountPlaceholder')}\n {...field}\n />\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading && <Spinner />}\n {isLoading ? t('form.submitting') : t('form.continue')}\n </Button>\n </form>\n </Form>\n );\n};\n","export function normalizePhone(phone: string): string {\n const cleaned = phone.trim().replace(/\\s/g, '');\n if (cleaned.startsWith('+2519')) {\n return cleaned;\n }\n if (cleaned.startsWith('2519')) {\n return `+${cleaned}`;\n }\n if (cleaned.startsWith('09')) {\n return `+251${cleaned.slice(1)}`;\n }\n if (cleaned.startsWith('9') && cleaned.length === 9) {\n return `+251${cleaned}`;\n }\n return cleaned;\n}\n","'use client';\n\nimport { useTranslations } from 'next-intl';\nimport type { ComponentProps } from 'react';\nimport { useState } from 'react';\nimport { useAuth } from '../../../context/auth-provider';\nimport type { AuthErrorContent } from '../../../utils/handle-error';\nimport { handleError } from '../../../utils/handle-error';\n\nimport { AuthPageLayout } from '../auth-page-layout';\nimport { SignUp } from '../sign-up';\n\nconst isPhone = (s: string) => /^\\+?[0-9()[\\]\\s-]{6,}$/.test(s);\n\ntype SignUpFormValues = {\n fullName: string;\n identifier: string;\n handle?: string;\n password: string;\n confirmPassword: string;\n};\n\ntype SignUpPageProps = {\n locale?: string;\n redirectUrl?: string;\n onNavigate: (path: string) => void;\n linkComponent?: React.ComponentType<ComponentProps<'a'> & { href: string }>;\n links?: {\n signIn?: string;\n };\n initialIdentifier?: string;\n logoImage?: string;\n};\n\nexport const SignUpPage = ({\n redirectUrl,\n onNavigate,\n linkComponent: Link,\n links,\n initialIdentifier,\n logoImage,\n}: SignUpPageProps) => {\n const t = useTranslations('Auth.signUp');\n const { client, setAuth } = useAuth();\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<AuthErrorContent | null>(null);\n\n const signInLink = links?.signIn || '/auth/sign-in';\n\n const handleSubmit = async (values: SignUpFormValues) => {\n setIsLoading(true);\n setError(null);\n\n try {\n const identifier = values.identifier;\n const usingPhone = isPhone(identifier);\n\n const res = usingPhone\n ? await client.signUpWithPhone({\n phone: identifier,\n password: values.password,\n fullName: values.fullName,\n handle: values.handle,\n })\n : await client.signUpWithEmail({\n email: identifier,\n password: values.password,\n fullName: values.fullName,\n handle: values.handle,\n });\n\n if ('verificationId' in res && res.verificationId) {\n if (usingPhone) {\n onNavigate(\n `/auth/verify-phone?context=sign-up&verificationId=${res.verificationId}&phone=${encodeURIComponent(identifier)}`,\n );\n } else {\n onNavigate(\n `/auth/verify-email?verificationId=${res.verificationId}&email=${encodeURIComponent(identifier)}`,\n );\n }\n return;\n }\n\n if ('user' in res && 'session' in res) {\n setAuth(res);\n }\n onNavigate(redirectUrl || '/');\n } catch (err) {\n handleError(err, setError, t);\n } finally {\n setIsLoading(false);\n }\n };\n\n return (\n <AuthPageLayout\n title={t('title')}\n description={t('description')}\n error={error}\n logoImage={logoImage}\n footer={\n <p>\n {t('footer.hasAccount')}{' '}\n {Link ? (\n <Link href={signInLink} className=\"text-primary hover:underline\">\n {t('footer.signInCta')}\n </Link>\n ) : (\n <a\n href={signInLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(signInLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {t('footer.signInCta')}\n </a>\n )}\n </p>\n }\n >\n <SignUp\n onSubmit={handleSubmit}\n isLoading={isLoading}\n initialIdentifier={initialIdentifier}\n />\n </AuthPageLayout>\n );\n};\n","'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { Button } from '@mesob/ui/components/button';\nimport {\n Form,\n FormControl,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from '@mesob/ui/components/form';\nimport { Input } from '@mesob/ui/components/input';\nimport { IconEye, IconEyeOff } from '@tabler/icons-react';\nimport { useTranslations } from 'next-intl';\nimport { useEffect, useMemo, useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { z } from 'zod';\n\nconst isPhone = (s: string) => /^\\+?[0-9()[\\]\\s-]{6,}$/.test(s);\n\ntype SignUpFormValues = {\n fullName: string;\n identifier: string;\n handle?: string;\n password: string;\n confirmPassword: string;\n};\n\ntype SignUpProps = {\n onSubmit: (values: SignUpFormValues) => Promise<void> | void;\n isLoading?: boolean;\n initialIdentifier?: string;\n};\n\nexport const SignUp = ({\n onSubmit,\n isLoading = false,\n initialIdentifier,\n}: SignUpProps) => {\n const t = useTranslations('Auth.signUp');\n const hasInitialIdentifier = !!initialIdentifier;\n const [showPassword, setShowPassword] = useState(false);\n const [showConfirmPassword, setShowConfirmPassword] = useState(false);\n\n const signUpSchema = useMemo(\n () =>\n z\n .object({\n fullName: z.string().min(1, t('errors.fullNameRequired')),\n identifier: z\n .string()\n .min(1, t('errors.contactRequired'))\n .refine(\n (val) => {\n if (!val) {\n return false;\n }\n return val.includes('@') || isPhone(val);\n },\n {\n message: t('errors.invalidEmailOrPhone'),\n },\n ),\n password: z\n .string()\n .min(8, t('errors.passwordLength'))\n .max(128, t('errors.longPasswordError')),\n confirmPassword: z.string(),\n })\n .refine((data) => data.password === data.confirmPassword, {\n message: t('errors.passwordsMismatch'),\n path: ['confirmPassword'],\n }),\n [t],\n );\n\n const form = useForm<SignUpFormValues>({\n resolver: zodResolver(signUpSchema),\n defaultValues: {\n fullName: '',\n identifier: initialIdentifier || '',\n password: '',\n confirmPassword: '',\n },\n });\n\n useEffect(() => {\n if (initialIdentifier) {\n form.setValue('identifier', initialIdentifier);\n }\n }, [initialIdentifier, form]);\n\n const handleSubmit = form.handleSubmit(async (values) => {\n await onSubmit(values);\n });\n\n const getIdentifierLabel = () => {\n if (!hasInitialIdentifier) {\n return t('form.accountLabel') || 'Email/Phone';\n }\n if (initialIdentifier?.includes('@')) {\n return t('form.emailLabel');\n }\n return t('form.phoneLabel');\n };\n const identifierLabel = getIdentifierLabel();\n\n return (\n <Form {...form}>\n <form onSubmit={handleSubmit} className=\"space-y-4\">\n <FormField\n control={form.control}\n name=\"fullName\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.fullNameLabel')}</FormLabel>\n <FormControl>\n <Input placeholder={t('form.fullNamePlaceholder')} {...field} />\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <FormField\n control={form.control}\n name=\"identifier\"\n render={({ field }) => (\n <FormItem>\n <FormLabel className={hasInitialIdentifier ? 'block' : undefined}>\n {identifierLabel}\n </FormLabel>\n <FormControl>\n <Input\n type={field.value.includes('@') ? 'email' : 'tel'}\n placeholder={\n hasInitialIdentifier\n ? undefined\n : t('form.accountPlaceholder') || 'Email or phone number'\n }\n {...field}\n disabled={hasInitialIdentifier}\n />\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <FormField\n control={form.control}\n name=\"password\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.passwordLabel')}</FormLabel>\n <FormControl>\n <div className=\"relative\">\n <Input\n type={showPassword ? 'text' : 'password'}\n placeholder={t('form.passwordPlaceholder')}\n {...field}\n />\n <button\n type=\"button\"\n onClick={() => setShowPassword(!showPassword)}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground\"\n >\n {showPassword ? (\n <IconEyeOff className=\"h-4 w-4\" />\n ) : (\n <IconEye className=\"h-4 w-4\" />\n )}\n </button>\n </div>\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <FormField\n control={form.control}\n name=\"confirmPassword\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>{t('form.confirmPasswordLabel')}</FormLabel>\n <FormControl>\n <div className=\"relative\">\n <Input\n type={showConfirmPassword ? 'text' : 'password'}\n placeholder={t('form.passwordPlaceholder')}\n {...field}\n />\n <button\n type=\"button\"\n onClick={() => setShowConfirmPassword(!showConfirmPassword)}\n className=\"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground\"\n >\n {showConfirmPassword ? (\n <IconEyeOff className=\"h-4 w-4\" />\n ) : (\n <IconEye className=\"h-4 w-4\" />\n )}\n </button>\n </div>\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading ? t('form.submitting') : t('form.submit')}\n </Button>\n </form>\n </Form>\n );\n};\n","'use client';\n\nimport { useTranslations } from 'next-intl';\nimport type { ComponentProps } from 'react';\nimport { useState } from 'react';\nimport { useAuth } from '../../../context/auth-provider';\nimport type { AuthErrorContent } from '../../../utils/handle-error';\nimport { handleError } from '../../../utils/handle-error';\n\nimport { AuthPageLayout } from '../auth-page-layout';\nimport { VerificationForm } from '../verification-form';\n\ntype VerifyEmailPageProps = {\n locale?: string;\n verificationId: string;\n email: string;\n onNavigate: (path: string) => void;\n linkComponent?: React.ComponentType<ComponentProps<'a'> & { href: string }>;\n links?: {\n signIn?: string;\n };\n logoImage?: string;\n redirectUrl: string;\n};\n\nexport const VerifyEmailPage = ({\n verificationId,\n onNavigate,\n linkComponent: Link,\n links,\n email,\n logoImage,\n redirectUrl,\n}: VerifyEmailPageProps) => {\n const t = useTranslations('Auth.verification');\n const common = useTranslations('Common');\n const footer = useTranslations('Auth.forgotPassword.footer');\n const { client, setAuth } = useAuth();\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<AuthErrorContent | null>(null);\n\n const signInLink = links?.signIn || '/auth/sign-in';\n\n const handleSubmit = async (values: { code: string }) => {\n if (!verificationId) {\n setError({\n title: t('errors.fallback'),\n description: t('errors.missingVerificationId'),\n });\n return;\n }\n\n setIsLoading(true);\n setError(null);\n\n try {\n const res = await client.verifyEmail({\n verificationId,\n code: values.code,\n });\n if ('user' in res && 'session' in res) {\n setAuth(res);\n }\n onNavigate(redirectUrl || '/');\n } catch (err) {\n handleError(err, setError, t);\n } finally {\n setIsLoading(false);\n }\n };\n\n const handleResend = async () => {\n setError(null);\n try {\n const res = await client.requestEmailVerification({ email });\n if (res.verificationId) {\n onNavigate(\n `/auth/verify-email?verificationId=${res.verificationId}&email=${encodeURIComponent(email)}`,\n );\n } else {\n setError({\n title: t('errors.fallback'),\n description: t('errors.resendFailed'),\n });\n }\n } catch (err) {\n handleError(err, setError, t);\n }\n };\n\n if (!verificationId) {\n return (\n <AuthPageLayout\n title={common('invalidLinkTitle')}\n description={common('invalidLinkDescription')}\n footer={\n Link ? (\n <Link href={signInLink} className=\"text-primary hover:underline\">\n {footer('backToSignIn')}\n </Link>\n ) : (\n <a\n href={signInLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(signInLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {footer('backToSignIn')}\n </a>\n )\n }\n >\n <div />\n </AuthPageLayout>\n );\n }\n\n return (\n <AuthPageLayout\n title={t('email.title')}\n description={t('email.description')}\n error={error}\n logoImage={logoImage}\n footer={\n Link ? (\n <Link href={signInLink} className=\"text-primary hover:underline\">\n {footer('backToSignIn')}\n </Link>\n ) : (\n <a\n href={signInLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(signInLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {footer('backToSignIn')}\n </a>\n )\n }\n >\n <VerificationForm\n verificationId={verificationId}\n onSubmit={handleSubmit}\n onResend={handleResend}\n isLoading={isLoading}\n error={error}\n />\n </AuthPageLayout>\n );\n};\n","'use client';\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { Button } from '@mesob/ui/components/button';\nimport {\n Form,\n FormControl,\n FormField,\n FormItem,\n FormMessage,\n} from '@mesob/ui/components/form';\nimport {\n InputOTP,\n InputOTPGroup,\n InputOTPSlot,\n} from '@mesob/ui/components/input-otp';\nimport { Spinner } from '@mesob/ui/components/spinner';\nimport { useTranslations } from 'next-intl';\nimport { useMemo } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { z } from 'zod';\nimport type { AuthErrorContent } from '../../utils/handle-error';\nimport { Countdown } from './countdown';\n\ntype VerificationFormValues = {\n code: string;\n};\n\ntype VerificationFormProps = {\n verificationId: string;\n onSubmit: (values: VerificationFormValues) => Promise<void> | void;\n onResend: () => Promise<void> | void;\n isLoading?: boolean;\n error?: AuthErrorContent | string | null;\n};\n\nexport const VerificationForm = ({\n onSubmit,\n onResend,\n isLoading = false,\n}: VerificationFormProps) => {\n const t = useTranslations('Auth.verification');\n const verificationSchema = useMemo(\n () =>\n z.object({\n code: z.string().length(6, t('form.codeLength')),\n }),\n [t],\n );\n const form = useForm<VerificationFormValues>({\n resolver: zodResolver(verificationSchema),\n defaultValues: {\n code: '',\n },\n });\n\n return (\n <Form {...form}>\n <form className=\"space-y-4\">\n <FormField\n control={form.control}\n name=\"code\"\n render={({ field }) => (\n <FormItem>\n <FormControl>\n <div className=\"flex justify-center\">\n <InputOTP\n maxLength={6}\n id=\"otp\"\n required\n value={field.value ?? ''}\n onChange={field.onChange}\n onBlur={field.onBlur}\n containerClassName=\"gap-4 justify-center mb-2 flex items-center\"\n >\n <InputOTPGroup className=\"gap-3 *:data-[slot=input-otp-slot]:h-12 *:data-[slot=input-otp-slot]:w-12 *:data-[slot=input-otp-slot]:rounded-md *:data-[slot=input-otp-slot]:border *:data-[slot=input-otp-slot]:text-xl\">\n <InputOTPSlot className=\"h-12\" index={0} />\n <InputOTPSlot className=\"h-12\" index={1} />\n <InputOTPSlot className=\"h-12\" index={2} />\n <InputOTPSlot className=\"h-12\" index={3} />\n <InputOTPSlot className=\"h-12\" index={4} />\n <InputOTPSlot className=\"h-12\" index={5} />\n </InputOTPGroup>\n </InputOTP>\n </div>\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n\n <div className=\"flex justify-between items-center\">\n <Countdown onResend={onResend} resending={isLoading} />\n <Button\n type=\"button\"\n onClick={() => {\n form.handleSubmit(async (values) => {\n await onSubmit(values);\n })();\n }}\n disabled={isLoading || form.watch('code').length !== 6}\n >\n {isLoading && <Spinner />}\n {t('form.confirm')}\n </Button>\n </div>\n </form>\n </Form>\n );\n};\n","'use client';\n\nimport { useTranslations } from 'next-intl';\nimport type { ComponentProps } from 'react';\nimport { useState } from 'react';\nimport { useAuth } from '../../../context/auth-provider';\nimport type { AuthResponse } from '../../../types';\nimport type { AuthErrorContent } from '../../../utils/handle-error';\nimport { handleError } from '../../../utils/handle-error';\n\nimport { AuthPageLayout } from '../auth-page-layout';\nimport { VerificationForm } from '../verification-form';\n\ntype VerifyPhonePageProps = {\n locale?: string;\n verificationId: string;\n context: 'sign-in' | 'sign-up';\n phone?: string;\n onNavigate: (path: string) => void;\n linkComponent?: React.ComponentType<ComponentProps<'a'> & { href: string }>;\n links?: {\n signIn?: string;\n };\n logoImage?: string;\n redirectUrl?: string;\n};\nexport const VerifyPhonePage = ({\n verificationId,\n context,\n phone = '',\n onNavigate,\n linkComponent: Link,\n links,\n logoImage,\n redirectUrl,\n}: VerifyPhonePageProps) => {\n const t = useTranslations('Auth.verification');\n const common = useTranslations('Common');\n const footer = useTranslations('Auth.forgotPassword.footer');\n const { client, refresh, setAuth } = useAuth();\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<AuthErrorContent | null>(null);\n\n const signInLink = links?.signIn || '/auth/sign-in';\n\n const handleSubmit = async (values: { code: string }) => {\n if (!verificationId) {\n setError({\n title: t('errors.fallback'),\n description: t('errors.fallback'),\n });\n return;\n }\n\n setIsLoading(true);\n setError(null);\n\n try {\n const res = await client.verifyPhoneOtp({\n verificationId,\n code: values.code,\n context,\n });\n if (res && 'user' in res && 'session' in res && res.session) {\n setAuth(res as AuthResponse);\n onNavigate(redirectUrl || '/');\n return;\n }\n await refresh();\n onNavigate(redirectUrl || '/');\n } catch (err) {\n handleError(err, setError, t);\n } finally {\n setIsLoading(false);\n }\n };\n\n const handleResend = async () => {\n setError(null);\n try {\n const targetPhone = context === 'sign-up' ? phone : null;\n if (!targetPhone) {\n setError({\n title: t('errors.fallback'),\n description: t('phone.missingPhone'),\n });\n return;\n }\n const res = await client.requestPhoneOtp({ phone: targetPhone, context });\n if (res && 'verificationId' in res && res.verificationId) {\n onNavigate(\n `/auth/verify-phone?context=${context}&verificationId=${res.verificationId}&phone=${targetPhone}`,\n );\n return;\n }\n setError({\n title: t('errors.fallback'),\n description: t('phone.resendFailed'),\n });\n } catch (err) {\n handleError(err, setError, t);\n }\n };\n\n if (!verificationId) {\n return (\n <AuthPageLayout\n title={common('invalidLinkTitle')}\n description={common('invalidLinkDescription')}\n footer={\n Link ? (\n <Link href={signInLink} className=\"text-primary hover:underline\">\n {footer('backToSignIn')}\n </Link>\n ) : (\n <a\n href={signInLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(signInLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {footer('backToSignIn')}\n </a>\n )\n }\n >\n <div />\n </AuthPageLayout>\n );\n }\n\n return (\n <AuthPageLayout\n title={t('phone.title')}\n description={t('phone.description', {\n target: phone || t('phone.missingPhone'),\n })}\n error={error}\n logoImage={logoImage}\n footer={\n Link ? (\n <Link href={signInLink} className=\"text-primary hover:underline\">\n {footer('backToSignIn')}\n </Link>\n ) : (\n <a\n href={signInLink}\n onClick={(e) => {\n e.preventDefault();\n onNavigate(signInLink);\n }}\n className=\"text-primary hover:underline\"\n >\n {footer('backToSignIn')}\n </a>\n )\n }\n >\n <VerificationForm\n verificationId={verificationId}\n onSubmit={handleSubmit}\n onResend={handleResend}\n isLoading={isLoading}\n error={error}\n />\n </AuthPageLayout>\n );\n};\n","import type { AuthClientConfig } from './client';\nimport { AuthClient } from './client';\n\nexport const createAuthClient = (config: AuthClientConfig) => {\n const client = new AuthClient(config);\n\n return {\n signUpWithEmail: client.signUpWithEmail.bind(client),\n signUpWithPhone: client.signUpWithPhone.bind(client),\n signInWithPassword: client.signInWithPassword.bind(client),\n signOut: client.signOut.bind(client),\n requestEmailVerification: client.requestEmailVerification.bind(client),\n verifyEmail: client.verifyEmail.bind(client),\n resendVerification: client.resendVerification.bind(client),\n requestPhoneOtp: client.requestPhoneOtp.bind(client),\n verifyPhoneOtp: client.verifyPhoneOtp.bind(client),\n forgotPassword: client.forgotPassword.bind(client),\n resetPassword: client.resetPassword.bind(client),\n changePassword: client.changePassword.bind(client),\n getSession: client.getSession.bind(client),\n useSession: () => {\n // This will be used via AuthProvider context\n throw new Error('useSession must be used within AuthProvider');\n },\n };\n};\n","'use client';\n\nimport { useAuth } from '../context/auth-provider';\n\nexport const useSession = () => {\n const { user, session, loading, error, refresh } = useAuth();\n\n return {\n user,\n session,\n isLoading: loading,\n isAuthenticated: !!user && !!session,\n error,\n refresh,\n };\n};\n"],"mappings":";;;AAYA,IAAM,kBAA4C;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,YAAN,cAAwB,MAAM;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EAEA,YACE,SACA,MACA,QACA,SACA;AACA,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,UAAU;AAAA,EACjB;AACF;AAMO,IAAM,aAAN,MAAiB;AAAA,EACd;AAAA,EAER,YAAY,QAA0B;AACpC,SAAK,UAAU,OAAO,QAAQ,QAAQ,OAAO,EAAE;AAAA,EACjD;AAAA,EAEA,MAAc,QACZ,UACA,UAAuB,CAAC,GACZ;AACZ,UAAM,MAAM,GAAG,KAAK,OAAO,GAAG,QAAQ;AACtC,UAAM,WAAW,MAAM,MAAM,KAAK;AAAA,MAChC,GAAG;AAAA,MACH,aAAa;AAAA,MACb,SAAS;AAAA,QACP,gBAAgB;AAAA,QAChB,GAAG,QAAQ;AAAA,MACb;AAAA,IACF,CAAC;AACD,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,OAAO,MAAM,SAAS,KAAK;AACjC,UAAI;AACJ,UAAI;AACF,oBAAY,KAAK,MAAM,IAAI;AAAA,MAC7B,Q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X,iBAAiB,CAAC,CAAC,QAAQ,CAAC,CAAC;AAAA,IAC7B;AAAA,IACA;AAAA,EACF;AACF;","names":["jsx","jsx","jsxs","Button","Spinner","useTranslations","jsx","jsxs","useTranslations","useState","useEffect","useState","jsx","jsx","useTranslations","useState","useTranslations","useState","zodResolver","Button","Form","FormControl","FormField","FormItem","FormLabel","FormMessage","Input","Spinner","useTranslations","useMemo","useState","useForm","z","jsx","jsxs","jsx","jsxs","useTranslations","useState","useTranslations","useState","zodResolver","Button","Form","FormControl","FormField","FormItem","FormLabel","FormMessage","Input","Spinner","IconEye","IconEyeOff","useTranslations","useMemo","useState","useForm","z","jsx","jsxs","useTranslations","useState","useMemo","z","isPhone","useForm","zodResolver","Form","FormField","FormItem","FormLabel","FormControl","Input","IconEyeOff","IconEye","FormMessage","Button","Spinner","jsx","jsxs","useTranslations","useState","useTranslations","useState","zodResolver","Button","Form","FormControl","FormField","FormItem","FormLabel","FormMessage","Input","IconEye","IconEyeOff","useTranslations","useEffect","useMemo","useState","useForm","z","jsx","jsxs","isPhone","jsx","jsxs","isPhone","useTranslations","useState","useTranslations","useState","zodResolver","Button","Form","FormControl","FormField","FormItem","FormMessage","InputOTP","InputOTPGroup","InputOTPSlot","Spinner","useTranslations","useMemo","useForm","z","jsx","jsxs","useTranslations","useMemo","z","useForm","zodResolver","Form","FormField","FormItem","FormControl","InputOTP","InputOTPGroup","InputOTPSlot","FormMessage","Button","Spinner","jsx","useTranslations","useState","useTranslations","useState","jsx","useTranslations","useState"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mesob/auth-react",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -24,7 +24,7 @@
24
24
  "next-intl": "^4.5.6",
25
25
  "react-hook-form": "^7.66.1",
26
26
  "zod": "^4.1.12",
27
- "@mesob/ui": "0.0.5"
27
+ "@mesob/ui": "0.0.6"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/react": "^19",