doct-ui-auth-kit 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/doct-ui-auth-kit.css +1 -1
- package/dist/index.js +28 -27
- package/dist/pages.js +1 -1
- package/dist/signup-page-DBRzdhNj.js +1546 -0
- package/package.json +3 -2
- package/dist/adapters/http-auth-adapter.d.ts +0 -8
- package/dist/adapters/index.d.ts +0 -1
- package/dist/auth/index.d.ts +0 -23
- package/dist/auth-methods/apple.d.ts +0 -19
- package/dist/auth-methods/google.d.ts +0 -5
- package/dist/auth-methods/index.d.ts +0 -2
- package/dist/auth-methods/use-google-auth.d.ts +0 -69
- package/dist/components/form/rhf-doct-phone-input.d.ts +0 -2
- package/dist/components/form/rhf-input-field.d.ts +0 -2
- package/dist/components/form/rhf-otp-input-field.d.ts +0 -2
- package/dist/components/layout/auth-layout-preset.d.ts +0 -30
- package/dist/components/layout/auth-layout-public.d.ts +0 -13
- package/dist/components/layout/auth-layout-wrapper.d.ts +0 -42
- package/dist/components/layout/auth-layout.d.ts +0 -89
- package/dist/components/layout/image-slider.d.ts +0 -28
- package/dist/components/layout/index.d.ts +0 -8
- package/dist/components/layout/main-layout.d.ts +0 -30
- package/dist/constants/demo-slider.d.ts +0 -14
- package/dist/constants/index.d.ts +0 -2
- package/dist/constants/layout-presets.d.ts +0 -6
- package/dist/core/auth-api-adapter.d.ts +0 -6
- package/dist/core/auth-context.d.ts +0 -17
- package/dist/core/auth-flow.d.ts +0 -5
- package/dist/core/auth-provider.d.ts +0 -6
- package/dist/core/auth-types.d.ts +0 -5
- package/dist/core/device-detection.d.ts +0 -15
- package/dist/core/index.d.ts +0 -11
- package/dist/core/sso-session.d.ts +0 -29
- package/dist/core/use-auth-flow.d.ts +0 -5
- package/dist/hooks/index.d.ts +0 -5
- package/dist/hooks/use-login-entry-form.d.ts +0 -8
- package/dist/hooks/use-main-auth-page-handlers.d.ts +0 -8
- package/dist/hooks/use-otp-verification.d.ts +0 -12
- package/dist/hooks/use-repeat-login.d.ts +0 -7
- package/dist/hooks/use-signup-form.d.ts +0 -7
- package/dist/index.d.ts +0 -11
- package/dist/pages/index.d.ts +0 -5
- package/dist/pages/login-entry.d.ts +0 -42
- package/dist/pages/main-login.d.ts +0 -32
- package/dist/pages/otp-verification.d.ts +0 -45
- package/dist/pages/repeat-login.d.ts +0 -49
- package/dist/pages/signup.d.ts +0 -6
- package/dist/signup-DeeuWsoF.js +0 -1718
- package/dist/types/auth-api-adapter.d.ts +0 -39
- package/dist/types/auth-layout-types.d.ts +0 -94
- package/dist/types/auth-provider.d.ts +0 -40
- package/dist/types/auth-types.d.ts +0 -70
- package/dist/types/device-detection.d.ts +0 -10
- package/dist/types/flow.d.ts +0 -122
- package/dist/types/forms.d.ts +0 -68
- package/dist/types/index.d.ts +0 -20
- package/dist/types/layout-presets.d.ts +0 -24
- package/dist/types/layout.d.ts +0 -57
- package/dist/types/login-form.d.ts +0 -56
- package/dist/types/main-login.d.ts +0 -40
- package/dist/types/otp-verification.d.ts +0 -40
- package/dist/types/pages.d.ts +0 -133
- package/dist/types/repeat-login.d.ts +0 -29
- package/dist/types/signup-form.d.ts +0 -48
- package/dist/types/sso-session.d.ts +0 -33
- package/dist/utils/index.d.ts +0 -4
- package/dist/utils/set-form-errors-from-zod.d.ts +0 -11
- package/dist/validations/index.d.ts +0 -6
- package/dist/validations/schemas.d.ts +0 -73
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { UseFormReturn } from 'react-hook-form';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { OtpVerificationMode, otpFormSchema } from '../validations';
|
|
4
|
-
export type { OtpVerificationMode };
|
|
5
|
-
/** Form values for the OTP verification form, inferred from the Zod schema. */
|
|
6
|
-
export type OtpFormValues = z.infer<typeof otpFormSchema>;
|
|
7
|
-
/** Options for the `useOtpVerification` hook controlling mode, submission, and callbacks. */
|
|
8
|
-
export interface UseOtpVerificationOptions {
|
|
9
|
-
/** OTP mode: phone (60s cooldown) or email (2 min cooldown). */
|
|
10
|
-
mode: OtpVerificationMode;
|
|
11
|
-
/** Sync callback with OTP string. Use when parent owns API (e.g. AuthFlow). Ignored when submitApi is provided. */
|
|
12
|
-
onSubmit?: ((otp: string) => void) | undefined;
|
|
13
|
-
/** Called when the user requests a new OTP code (resend). Ignored when submitApi is provided. */
|
|
14
|
-
onResendCode?: (() => void) | undefined;
|
|
15
|
-
/** When provided, hook runs: validate → submitApi(otp) → onSuccess(). Consumer passes redirect in onSuccess. */
|
|
16
|
-
submitApi?: (otp: string) => Promise<void>;
|
|
17
|
-
/** Called after submitApi resolves (e.g. router.push('/dashboard')). */
|
|
18
|
-
onSuccess?: () => void;
|
|
19
|
-
/** Called when submitApi rejects or throws. */
|
|
20
|
-
onError?: (error: unknown) => void;
|
|
21
|
-
}
|
|
22
|
-
/** Return value of the `useOtpVerification` hook, providing form state and resend controls. */
|
|
23
|
-
export interface UseOtpVerificationReturn {
|
|
24
|
-
/** react-hook-form methods bound to the OTP form. */
|
|
25
|
-
methods: UseFormReturn<OtpFormValues>;
|
|
26
|
-
/** Submit handler to pass to the form's `onSubmit`. Validates and dispatches the OTP. */
|
|
27
|
-
handleSubmit: (data: OtpFormValues) => void;
|
|
28
|
-
/** True when current form values pass validation (for disabling Submit until valid – edge case 6). */
|
|
29
|
-
isFormValid: (data: OtpFormValues) => boolean;
|
|
30
|
-
/** Triggers a resend of the OTP code and resets the cooldown timer. */
|
|
31
|
-
handleResend: () => void;
|
|
32
|
-
/** Seconds remaining before the user can request another OTP code. */
|
|
33
|
-
resendSecondsLeft: number;
|
|
34
|
-
/** True when the resend cooldown has elapsed and the user may request a new code. */
|
|
35
|
-
canResend: boolean;
|
|
36
|
-
/** Human-readable countdown string (e.g. `"00:45"`) for display next to the resend button. */
|
|
37
|
-
timerText: string;
|
|
38
|
-
/** True while submitApi is in flight. */
|
|
39
|
-
isSubmitting: boolean;
|
|
40
|
-
}
|
package/dist/types/pages.d.ts
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { UserType } from './auth-types';
|
|
2
|
-
import { IdentifierType } from './flow';
|
|
3
|
-
import { LoginEntryMode } from './login-form';
|
|
4
|
-
import { UseMainAuthPageHandlersOptions } from './main-login';
|
|
5
|
-
import { OtpVerificationMode } from './otp-verification';
|
|
6
|
-
/** Props for MainLoginPage and MainLogin components. */
|
|
7
|
-
export type MainLoginPageProps = UseMainAuthPageHandlersOptions;
|
|
8
|
-
/** Props for LoginEntry (inner form without layout). */
|
|
9
|
-
export interface LoginEntryProps {
|
|
10
|
-
/** Mode: phone number or email input */
|
|
11
|
-
mode: LoginEntryMode;
|
|
12
|
-
/** Override title (consumers render via AuthLayout.Title) */
|
|
13
|
-
title?: string;
|
|
14
|
-
/** Override subtitle (consumers render via AuthLayout.Description) */
|
|
15
|
-
subtitle?: string;
|
|
16
|
-
/** Handler when back button is clicked (consumers render back button in AuthLayout.Logo) */
|
|
17
|
-
onBack?: () => void;
|
|
18
|
-
/**
|
|
19
|
-
* Sync callback with valid data. Use when parent owns API (e.g. AuthFlow).
|
|
20
|
-
* Ignored when submitApi is provided.
|
|
21
|
-
*/
|
|
22
|
-
onSubmit?: (data: {
|
|
23
|
-
phone?: string;
|
|
24
|
-
email?: string;
|
|
25
|
-
}) => void;
|
|
26
|
-
/**
|
|
27
|
-
* Async API call (e.g. send OTP). When provided, hook runs: validate → submitApi(data) → onSuccess().
|
|
28
|
-
* Consumer (e.g. Next.js) can pass redirect in onSuccess.
|
|
29
|
-
*/
|
|
30
|
-
submitApi?: (data: {
|
|
31
|
-
phone?: string;
|
|
32
|
-
email?: string;
|
|
33
|
-
}) => Promise<void>;
|
|
34
|
-
/** Called after submitApi succeeds; receives { mode, recipient } for OTP redirect/recipientDisplay. */
|
|
35
|
-
onSuccess?: (params: {
|
|
36
|
-
mode: LoginEntryMode;
|
|
37
|
-
recipient: string;
|
|
38
|
-
}) => void;
|
|
39
|
-
/** Called when submitApi fails. */
|
|
40
|
-
onError?: (error: unknown) => void;
|
|
41
|
-
}
|
|
42
|
-
/** Props for the full LoginEntryPage (adds optional layout overrides for story/viewport). */
|
|
43
|
-
export interface LoginEntryPageProps extends LoginEntryProps {
|
|
44
|
-
/** Layout type. Default: 'withSlider' for desktop, use 'standalone' for mobile. */
|
|
45
|
-
layoutType?: 'withSlider' | 'standalone';
|
|
46
|
-
/** Layout variant. Default derived from layoutType if not set. */
|
|
47
|
-
variant?: 'desktop' | 'mobile';
|
|
48
|
-
}
|
|
49
|
-
/** Props for Signup (inner form without layout). */
|
|
50
|
-
export interface SignupPageProps {
|
|
51
|
-
/** Indian: which field to collect. Foreign: use 'foreign' mode (name + email + phone). */
|
|
52
|
-
userType: UserType;
|
|
53
|
-
/** How user started (phone or email). */
|
|
54
|
-
loginMethod: IdentifierType;
|
|
55
|
-
/** Indian only: which field to collect (phone or email). */
|
|
56
|
-
signupCollectField: IdentifierType;
|
|
57
|
-
/** Foreign only: phone when user entered phone before signup details. */
|
|
58
|
-
pendingPhone?: string;
|
|
59
|
-
/** Sync callback with valid data. Use when parent owns API (e.g. AuthFlow). Ignored when submitApi is provided. */
|
|
60
|
-
onSubmit?: (data: {
|
|
61
|
-
fullName: string;
|
|
62
|
-
phone?: string;
|
|
63
|
-
email?: string;
|
|
64
|
-
}) => void;
|
|
65
|
-
/** Async API (e.g. complete profile). When provided, hook runs: validate → submitApi(data) → onSuccess(). */
|
|
66
|
-
submitApi?: (data: {
|
|
67
|
-
fullName: string;
|
|
68
|
-
phone?: string;
|
|
69
|
-
email?: string;
|
|
70
|
-
}) => Promise<void>;
|
|
71
|
-
/** Called after submitApi succeeds (e.g. router.push('/otp') or next step). */
|
|
72
|
-
onSuccess?: () => void;
|
|
73
|
-
/** Called when submitApi fails. */
|
|
74
|
-
onError?: (error: unknown) => void;
|
|
75
|
-
}
|
|
76
|
-
/** Props for the full SignupPage (adds optional layout overrides). */
|
|
77
|
-
export interface SignupPageFullProps extends SignupPageProps {
|
|
78
|
-
layoutType?: 'withSlider' | 'standalone';
|
|
79
|
-
variant?: 'desktop' | 'mobile';
|
|
80
|
-
}
|
|
81
|
-
/** Props for OtpVerification (inner form without layout). */
|
|
82
|
-
export interface OtpVerificationProps {
|
|
83
|
-
/** Mode: mobile (phone) or email OTP */
|
|
84
|
-
mode: OtpVerificationMode;
|
|
85
|
-
/** Title override. Default: "6 digit OTP has been sent to your Mobile" | "..." Email */
|
|
86
|
-
title?: string;
|
|
87
|
-
/** Masked phone (e.g. "+91 9825910X0X") or email (e.g. "j***@gmail.com") */
|
|
88
|
-
recipientDisplay: string;
|
|
89
|
-
/** When true, show instruction line ("Kindly check your Email Inbox."). Used for foreign user flow. */
|
|
90
|
-
isForeignUser?: boolean;
|
|
91
|
-
/** Handler when back is clicked */
|
|
92
|
-
onBack?: () => void;
|
|
93
|
-
/** Sync callback with OTP. Use when parent owns API (e.g. AuthFlow). Ignored when submitApi is provided. */
|
|
94
|
-
onSubmit?: (otp: string) => void;
|
|
95
|
-
/** Handler when user requests resend code */
|
|
96
|
-
onResendCode?: () => void;
|
|
97
|
-
/** Async API (e.g. verify OTP). When provided, hook runs: validate → submitApi(otp) → onSuccess(). */
|
|
98
|
-
submitApi?: (otp: string) => Promise<void>;
|
|
99
|
-
/** Called after submitApi succeeds (e.g. router.push('/dashboard')). */
|
|
100
|
-
onSuccess?: () => void;
|
|
101
|
-
/** Called when submitApi fails. */
|
|
102
|
-
onError?: (error: unknown) => void;
|
|
103
|
-
}
|
|
104
|
-
/** Props for the full OtpVerificationPage (adds optional layout overrides). */
|
|
105
|
-
export interface OtpVerificationPageProps extends OtpVerificationProps {
|
|
106
|
-
layoutType?: 'withSlider' | 'standalone';
|
|
107
|
-
variant?: 'desktop' | 'mobile';
|
|
108
|
-
}
|
|
109
|
-
/** Props for RepeatLogin (inner component without layout). */
|
|
110
|
-
export interface RepeatLoginProps {
|
|
111
|
-
/**
|
|
112
|
-
* Last used authentication method shown in the primary button label.
|
|
113
|
-
* Example: "Mobile", "Email".
|
|
114
|
-
*
|
|
115
|
-
* @default "Mobile"
|
|
116
|
-
*/
|
|
117
|
-
lastUsedMethod?: string;
|
|
118
|
-
/** Sync handler for primary action. Use when caller owns API (e.g. AuthFlow). Ignored when continueApi is provided. */
|
|
119
|
-
onContinueWithLastMethod?: () => void;
|
|
120
|
-
/** Handler for the secondary action (choose another method). */
|
|
121
|
-
onUseAnotherMethod?: () => void;
|
|
122
|
-
/** Async API for continue (e.g. validate session). When provided, hook runs: continueApi() → onSuccess(). */
|
|
123
|
-
continueApi?: () => Promise<void>;
|
|
124
|
-
/** Called after continueApi succeeds (e.g. router.push('/dashboard')). */
|
|
125
|
-
onSuccess?: () => void;
|
|
126
|
-
/** Called when continueApi fails. */
|
|
127
|
-
onError?: (error: unknown) => void;
|
|
128
|
-
}
|
|
129
|
-
/** Props for the full RepeatLoginPage (adds optional layout overrides). */
|
|
130
|
-
export interface RepeatLoginPageProps extends RepeatLoginProps {
|
|
131
|
-
layoutType?: 'withSlider' | 'standalone';
|
|
132
|
-
variant?: 'desktop' | 'mobile';
|
|
133
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook options and return type for repeat login (continue with last method).
|
|
3
|
-
*/
|
|
4
|
-
export interface UseRepeatLoginOptions {
|
|
5
|
-
/**
|
|
6
|
-
* Last used authentication method shown in the primary button label.
|
|
7
|
-
* @default "Mobile"
|
|
8
|
-
*/
|
|
9
|
-
lastUsedMethod?: string;
|
|
10
|
-
/** Sync handler for primary action. Use when caller owns API (e.g. AuthFlow). Ignored when continueApi is provided. */
|
|
11
|
-
onContinueWithLastMethod?: () => void;
|
|
12
|
-
/** Handler for the secondary action (choose another method). */
|
|
13
|
-
onUseAnotherMethod?: () => void;
|
|
14
|
-
/** Async API for continue (e.g. validate session). When provided, hook runs: continueApi() → onSuccess(). */
|
|
15
|
-
continueApi?: () => Promise<void>;
|
|
16
|
-
/** Called after continueApi succeeds (e.g. router.push('/dashboard')). */
|
|
17
|
-
onSuccess?: () => void;
|
|
18
|
-
/** Called when continueApi fails. */
|
|
19
|
-
onError?: (error: unknown) => void;
|
|
20
|
-
}
|
|
21
|
-
/** Return value of the `useRepeatLogin` hook, providing continue handler and display state. */
|
|
22
|
-
export interface UseRepeatLoginReturn {
|
|
23
|
-
/** Call this when the user clicks "Continue with {lastUsedMethod}". */
|
|
24
|
-
handleContinue: () => void;
|
|
25
|
-
/** True while continueApi is in flight. */
|
|
26
|
-
isSubmitting: boolean;
|
|
27
|
-
/** Resolved lastUsedMethod for display (default "Mobile"). */
|
|
28
|
-
lastUsedMethod: string;
|
|
29
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { UseFormReturn } from 'react-hook-form';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { signupEmailFormSchema, signupForeignFormSchema, signupPhoneFormSchema } from '../validations';
|
|
4
|
-
/** Signup mode: phone, email as second field, or foreign (full name + email + phone). */
|
|
5
|
-
export type SignupEntryMode = 'phone' | 'email' | 'foreign';
|
|
6
|
-
/** Form values for phone-based signup, inferred from the Zod schema. */
|
|
7
|
-
export type SignupPhoneFormValues = z.infer<typeof signupPhoneFormSchema>;
|
|
8
|
-
/** Form values for email-based signup, inferred from the Zod schema. */
|
|
9
|
-
export type SignupEmailFormValues = z.infer<typeof signupEmailFormSchema>;
|
|
10
|
-
/** Form values for foreign signup (full name + email + phone), inferred from the Zod schema. */
|
|
11
|
-
export type SignupForeignFormValues = z.infer<typeof signupForeignFormSchema>;
|
|
12
|
-
/** Discriminated union of all signup form value shapes. */
|
|
13
|
-
export type SignupFormValues = SignupPhoneFormValues | SignupEmailFormValues | SignupForeignFormValues;
|
|
14
|
-
/** Payload when signup form is valid. */
|
|
15
|
-
export type SignupSubmitData = {
|
|
16
|
-
fullName: string;
|
|
17
|
-
phone?: string;
|
|
18
|
-
email?: string;
|
|
19
|
-
};
|
|
20
|
-
export interface UseSignupFormOptions {
|
|
21
|
-
/** Mode: phone, email as second field, or foreign (name + email + phone) */
|
|
22
|
-
mode: SignupEntryMode;
|
|
23
|
-
/** For foreign mode: pre-fill phone when user already entered it. */
|
|
24
|
-
defaultPhone?: string;
|
|
25
|
-
/** Sync callback with valid data. Use when parent owns API (e.g. AuthFlow). Ignored when submitApi is provided. */
|
|
26
|
-
onSubmit?: ((data: SignupSubmitData) => void) | undefined;
|
|
27
|
-
/** When provided, hook runs: validate → submitApi(data) → onSuccess(). Consumer passes redirect in onSuccess. */
|
|
28
|
-
submitApi?: (data: SignupSubmitData) => Promise<void>;
|
|
29
|
-
/** Called after submitApi succeeds (e.g. router.push('/otp') or next step). */
|
|
30
|
-
onSuccess?: () => void;
|
|
31
|
-
/** Called when submitApi rejects or throws. */
|
|
32
|
-
onError?: (error: unknown) => void;
|
|
33
|
-
}
|
|
34
|
-
/** Return value of the `useSignupForm` hook, providing form state and mode flags. */
|
|
35
|
-
export interface UseSignupFormReturn {
|
|
36
|
-
/** react-hook-form methods bound to the current signup mode's schema. */
|
|
37
|
-
methods: UseFormReturn<SignupFormValues>;
|
|
38
|
-
/** Submit handler to pass to the form's `onSubmit`. Validates and dispatches signup data. */
|
|
39
|
-
handleSubmit: (data: SignupFormValues) => void;
|
|
40
|
-
/** True when mode is 'phone', false when mode is 'email'. For 'foreign' same as (mode === 'phone') for layout. */
|
|
41
|
-
isPhone: boolean;
|
|
42
|
-
/** True when mode is 'foreign' (full name + email + phone). */
|
|
43
|
-
isForeign: boolean;
|
|
44
|
-
/** True when current form values pass validation (for disabling Continue – edge cases 9, 16, 19). */
|
|
45
|
-
isFormValid: (data: SignupFormValues) => boolean;
|
|
46
|
-
/** True while submitApi is in flight. */
|
|
47
|
-
isSubmitting: boolean;
|
|
48
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SSO session and token storage types.
|
|
3
|
-
*/
|
|
4
|
-
/** How/where the SSO token is stored for cross-app access. */
|
|
5
|
-
export interface TokenStorageStrategy {
|
|
6
|
-
get(): string | null;
|
|
7
|
-
set(token: string, expiresAt: number): void;
|
|
8
|
-
remove(): void;
|
|
9
|
-
}
|
|
10
|
-
/** Minimal request config type for the interceptor (no axios import). */
|
|
11
|
-
export interface AxiosRequestConfig {
|
|
12
|
-
headers?: Record<string, string> | {
|
|
13
|
-
[key: string]: string;
|
|
14
|
-
};
|
|
15
|
-
withCredentials?: boolean;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Axios instance shape needed to attach auth interceptors (avoids hard axios dependency).
|
|
19
|
-
* Use createAxiosAuthInterceptors with your axios instance.
|
|
20
|
-
*/
|
|
21
|
-
export interface AxiosAuthInterceptorInstance {
|
|
22
|
-
interceptors: {
|
|
23
|
-
request: {
|
|
24
|
-
use(onFulfilled?: (config: AxiosRequestConfig) => AxiosRequestConfig | Promise<AxiosRequestConfig>, onRejected?: (err: unknown) => unknown): number;
|
|
25
|
-
};
|
|
26
|
-
response: {
|
|
27
|
-
use(onFulfilled?: (res: unknown) => unknown, onRejected?: (err: unknown) => unknown): number;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
defaults: {
|
|
31
|
-
withCredentials?: boolean;
|
|
32
|
-
};
|
|
33
|
-
}
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ZodError } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* Applies Zod validation errors to a React Hook Form setError function.
|
|
4
|
-
* Used by form submit handlers to display field-level errors from schema validation.
|
|
5
|
-
*
|
|
6
|
-
* @param error - The ZodError from schema.safeParse when validation fails
|
|
7
|
-
* @param setError - RHF's setError (e.g. methods.setError)
|
|
8
|
-
*/
|
|
9
|
-
export declare function setFormErrorsFromZod(error: ZodError, setError: (path: string, opts: {
|
|
10
|
-
message: string;
|
|
11
|
-
}) => void): void;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Central export for all validation schemas and helpers.
|
|
3
|
-
* Import from here: import { signupSchemas, loginSchemas, otpFormSchema } from '@/validations';
|
|
4
|
-
*/
|
|
5
|
-
export type { OtpVerificationMode } from './schemas';
|
|
6
|
-
export { capitalizeWords, emailSchema, fullNameSchema, getResendCooldownSeconds, loginEmailFormSchema, loginPhoneFormSchema, loginSchemas, OTP_LENGTH, otpFormSchema, phoneSchema, RESEND_COOLDOWN_EMAIL_SECONDS, RESEND_COOLDOWN_PHONE_SECONDS, signupEmailFormSchema, signupForeignFormSchema, signupPhoneFormSchema, signupSchemas, } from './schemas';
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/** Capitalize first letter of each word (PRODUCT_PROTOCOLS #25 – Naming conventions). */
|
|
3
|
-
export declare function capitalizeWords(value: string): string;
|
|
4
|
-
/**
|
|
5
|
-
* Full name: required, min 3 chars, trim, capitalize each word (Protocol #1, #25; Edge case 9).
|
|
6
|
-
*/
|
|
7
|
-
export declare const fullNameSchema: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
8
|
-
/**
|
|
9
|
-
* Phone: required; national part (after "-") digits only, length between 7 and 15.
|
|
10
|
-
* Matches Storybook/react-hook-form validate: value format "countryCode-nationalNumber" (e.g. "91-9876543210").
|
|
11
|
-
*/
|
|
12
|
-
export declare const phoneSchema: z.ZodString;
|
|
13
|
-
/**
|
|
14
|
-
* Email: required, valid format, trim and lowercase before save (Edge case 10).
|
|
15
|
-
*/
|
|
16
|
-
export declare const emailSchema: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
17
|
-
export declare const signupPhoneFormSchema: z.ZodObject<{
|
|
18
|
-
fullName: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
19
|
-
phone: z.ZodString;
|
|
20
|
-
}, z.core.$strip>;
|
|
21
|
-
export declare const signupEmailFormSchema: z.ZodObject<{
|
|
22
|
-
fullName: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
23
|
-
email: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
24
|
-
}, z.core.$strip>;
|
|
25
|
-
export declare const signupForeignFormSchema: z.ZodObject<{
|
|
26
|
-
fullName: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
27
|
-
email: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
28
|
-
phone: z.ZodString;
|
|
29
|
-
}, z.core.$strip>;
|
|
30
|
-
export declare const signupSchemas: {
|
|
31
|
-
readonly phone: z.ZodObject<{
|
|
32
|
-
fullName: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
33
|
-
phone: z.ZodString;
|
|
34
|
-
}, z.core.$strip>;
|
|
35
|
-
readonly email: z.ZodObject<{
|
|
36
|
-
fullName: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
37
|
-
email: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
38
|
-
}, z.core.$strip>;
|
|
39
|
-
readonly foreign: z.ZodObject<{
|
|
40
|
-
fullName: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
41
|
-
email: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
42
|
-
phone: z.ZodString;
|
|
43
|
-
}, z.core.$strip>;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Phone validation per PRODUCT_PROTOCOLS #2, #5 and edge cases 3–5.
|
|
47
|
-
*/
|
|
48
|
-
export declare const loginPhoneFormSchema: z.ZodObject<{
|
|
49
|
-
phone: z.ZodString;
|
|
50
|
-
}, z.core.$strip>;
|
|
51
|
-
/**
|
|
52
|
-
* Email validation: trim and lowercase per edge case 10.
|
|
53
|
-
*/
|
|
54
|
-
export declare const loginEmailFormSchema: z.ZodObject<{
|
|
55
|
-
email: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
56
|
-
}, z.core.$strip>;
|
|
57
|
-
export declare const loginSchemas: {
|
|
58
|
-
readonly phone: z.ZodObject<{
|
|
59
|
-
phone: z.ZodString;
|
|
60
|
-
}, z.core.$strip>;
|
|
61
|
-
readonly email: z.ZodObject<{
|
|
62
|
-
email: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
63
|
-
}, z.core.$strip>;
|
|
64
|
-
};
|
|
65
|
-
export declare const OTP_LENGTH = 6;
|
|
66
|
-
/** Resend cooldown: 60s for phone OTP, 2 min for email OTP (per design). */
|
|
67
|
-
export declare const RESEND_COOLDOWN_PHONE_SECONDS = 60;
|
|
68
|
-
export declare const RESEND_COOLDOWN_EMAIL_SECONDS = 120;
|
|
69
|
-
export type OtpVerificationMode = 'phone' | 'email';
|
|
70
|
-
export declare function getResendCooldownSeconds(mode: OtpVerificationMode): number;
|
|
71
|
-
export declare const otpFormSchema: z.ZodObject<{
|
|
72
|
-
otp: z.ZodArray<z.ZodString>;
|
|
73
|
-
}, z.core.$strip>;
|