doct-ui-auth-kit 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/adapters/http-auth-adapter.d.ts +2 -1
  2. package/dist/auth-methods/apple.d.ts +1 -1
  3. package/dist/auth-methods/index.d.ts +1 -0
  4. package/dist/components/form/rhf-doct-phone-input.d.ts +1 -1
  5. package/dist/components/form/rhf-input-field.d.ts +1 -1
  6. package/dist/components/form/rhf-otp-input-field.d.ts +1 -1
  7. package/dist/components/layout/image-slider.d.ts +2 -19
  8. package/dist/components/layout/main-layout.d.ts +2 -46
  9. package/dist/core/auth-api-adapter.d.ts +1 -33
  10. package/dist/core/auth-context.d.ts +4 -50
  11. package/dist/core/auth-provider.d.ts +2 -35
  12. package/dist/core/auth-types.d.ts +3 -68
  13. package/dist/core/device-detection.d.ts +2 -6
  14. package/dist/core/sso-session.d.ts +20 -6
  15. package/dist/core/use-auth-flow.d.ts +2 -75
  16. package/dist/hooks/index.d.ts +2 -0
  17. package/dist/hooks/use-login-entry-form.d.ts +4 -28
  18. package/dist/hooks/use-main-auth-page-handlers.d.ts +8 -0
  19. package/dist/hooks/use-otp-verification.d.ts +7 -31
  20. package/dist/hooks/use-repeat-login.d.ts +7 -0
  21. package/dist/hooks/use-signup-form.d.ts +4 -44
  22. package/dist/index.js +2981 -3435
  23. package/dist/pages/index.d.ts +5 -5
  24. package/dist/pages/login-entry.d.ts +40 -21
  25. package/dist/pages/main-login.d.ts +30 -14
  26. package/dist/pages/otp-verification.d.ts +43 -21
  27. package/dist/pages/repeat-login.d.ts +47 -18
  28. package/dist/pages/signup.d.ts +43 -23
  29. package/dist/pages.js +5 -5
  30. package/dist/signup-BpiNvZy4.js +1714 -0
  31. package/dist/types/auth-api-adapter.d.ts +43 -0
  32. package/dist/types/auth-provider.d.ts +37 -0
  33. package/dist/types/auth-types.d.ts +70 -0
  34. package/dist/types/device-detection.d.ts +7 -0
  35. package/dist/types/flow.d.ts +125 -0
  36. package/dist/types/forms.d.ts +2 -0
  37. package/dist/types/index.d.ts +13 -0
  38. package/dist/types/layout.d.ts +57 -0
  39. package/dist/types/login-form.d.ts +39 -0
  40. package/dist/types/main-login.d.ts +29 -0
  41. package/dist/types/otp-verification.d.ts +28 -0
  42. package/dist/types/pages.d.ts +133 -0
  43. package/dist/types/repeat-login.d.ts +28 -0
  44. package/dist/types/signup-form.d.ts +41 -0
  45. package/dist/types/sso-session.d.ts +33 -0
  46. package/dist/utils/index.d.ts +4 -0
  47. package/dist/utils/set-form-errors-from-zod.d.ts +11 -0
  48. package/dist/validations/index.d.ts +6 -0
  49. package/dist/validations/schemas.d.ts +76 -0
  50. package/package.json +105 -104
  51. package/dist/signup-x-Jm7XKn.js +0 -668
@@ -1,5 +1,5 @@
1
- export { LoginEntry, type LoginEntryMode, type LoginEntryProps, } from './login-entry';
2
- export { MainLogin, type MainLoginProps } from './main-login';
3
- export { OtpVerification, type OtpVerificationMode, type OtpVerificationProps, } from './otp-verification';
4
- export { RepeatLogin, type RepeatLoginProps } from './repeat-login';
5
- export { type SignupEntryMode, SignupPage, type SignupPageProps, } from './signup';
1
+ export { type LoginEntryMode, LoginEntryPage, type LoginEntryPageProps, type LoginEntryProps, } from './login-entry';
2
+ export { type MainLoginAppleProviderConfig, type MainLoginGoogleProviderConfig, MainLoginPage, type MainLoginPageProps, type MainLoginPageProvidersConfig, } from './main-login';
3
+ export { type OtpVerificationMode, OtpVerificationPage, type OtpVerificationPageProps, type OtpVerificationProps, } from './otp-verification';
4
+ export { RepeatLoginPage, type RepeatLoginPageProps, type RepeatLoginProps, } from './repeat-login';
5
+ export { SignupPage, type SignupPageFullProps, type SignupPageProps, } from './signup';
@@ -1,23 +1,42 @@
1
- import type { LoginEntryMode } from '@/hooks/use-login-entry-form';
2
- export type { LoginEntryMode };
3
- export interface LoginEntryProps {
4
- /** Mode: phone number or email input */
5
- mode: LoginEntryMode;
6
- /** Override title (consumers render via AuthLayout.Title) */
7
- title?: string;
8
- /** Override subtitle (consumers render via AuthLayout.Description) */
9
- subtitle?: string;
10
- /** Handler when back button is clicked (consumers render back button in AuthLayout.Logo) */
11
- onBack?: () => void;
12
- /** Handler when form is submitted with valid phone or email */
13
- onSubmit?: (data: {
14
- phone?: string;
15
- email?: string;
16
- }) => void;
17
- }
1
+ import type { LoginEntryPageProps, LoginEntryProps } from '@/types';
2
+ export type { LoginEntryMode, LoginEntryPageProps, LoginEntryProps, } from '@/types';
18
3
  /**
19
- * Login entry screen: single form for phone or email based on mode.
20
- * Uses FormProvider and react-hook-form. Slot into AuthLayout.Body;
21
- * layout (MainLayout, AuthLayout with Logo, Title, etc.) is provided by the consumer.
4
+ * Full LoginEntry page with AuthLayoutWrapper, back button, and slider/standalone layout.
5
+ * Use when rendering the login entry screen as a standalone page.
6
+ *
7
+ * @example Next.js: API call in hook, redirect via callback
8
+ * ```tsx
9
+ * <LoginEntryPage
10
+ * mode="phone"
11
+ * onBack={() => router.back()}
12
+ * submitApi={(data) => api.sendOtp(data)}
13
+ * onSuccess={() => router.push('/otp')}
14
+ * />
15
+ * ```
16
+ *
17
+ * @example Sync callback (caller owns API)
18
+ * ```tsx
19
+ * <LoginEntryPage mode="phone" onSubmit={(data) => sendOtp(data)} />
20
+ * ```
22
21
  */
23
- export declare function LoginEntry({ mode, onSubmit }: Readonly<LoginEntryProps>): import("react/jsx-runtime").JSX.Element;
22
+ export declare function LoginEntryPage(props: Readonly<LoginEntryPageProps>): import("react/jsx-runtime").JSX.Element;
23
+ /**
24
+ * Login entry form body without layout wrapper.
25
+ * Single form for phone or email based on mode. Use inside your own layout or AuthFlow.
26
+ * Validation per PRODUCT_PROTOCOLS and edge cases 3–5, 18; cursor focus on first field (#26).
27
+ *
28
+ * @example With AuthFlow (sync onSubmit)
29
+ * ```tsx
30
+ * <LoginEntry mode="phone" onSubmit={(data) => actions.submitIdentifier(data)} />
31
+ * ```
32
+ *
33
+ * @example Standalone Next.js (API + redirect in hook)
34
+ * ```tsx
35
+ * <LoginEntry
36
+ * mode="phone"
37
+ * submitApi={(data) => api.sendOtp(data)}
38
+ * onSuccess={() => router.push('/otp')}
39
+ * />
40
+ * ```
41
+ */
42
+ export declare function LoginEntry(props: Readonly<LoginEntryProps>): import("react/jsx-runtime").JSX.Element;
@@ -1,16 +1,32 @@
1
- export interface MainLoginProps {
2
- /** Handler for "Continue with Mobile". */
3
- onContinueWithMobile?: () => void;
4
- /** Handler for "Continue with Email". */
5
- onContinueWithEmail?: () => void;
6
- /** Handler for "Continue with Google" (custom button; parent wires useGoogleAuth.loginWithGoogle when configured). */
7
- onContinueWithGoogle?: () => void;
8
- /** Handler for "Continue with Apple". */
9
- onContinueWithApple?: () => void;
10
- }
1
+ import type { MainLoginPageProps } from '@/types';
2
+ export type { MainLoginAppleProviderConfig, MainLoginGoogleProviderConfig, MainLoginPageProps, MainLoginPageProvidersConfig, } from '@/types';
11
3
  /**
12
- * Main login page body: four sign-in options (Mobile, Email, Google, Apple).
13
- * Intended to be slotted into AuthLayout.Body. Layout shell (AuthLayout with
14
- * Logo, Title, Description) is provided by the app or story.
4
+ * Full MainLogin page with AuthLayoutWrapper, header, footer, and slider layout.
5
+ * Includes default branding and layout configuration.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * <MainLoginPage
10
+ * onContinueWithMobile={() => navigate('/auth/phone')}
11
+ * onContinueWithEmail={() => navigate('/auth/email')}
12
+ * onContinueWithGoogle={() => navigate('/auth/google')}
13
+ * onContinueWithApple={() => navigate('/auth/apple')}
14
+ * />
15
+ * ```
15
16
  */
16
- export declare function MainLogin({ onContinueWithMobile, onContinueWithEmail, onContinueWithGoogle, onContinueWithApple, }: Readonly<MainLoginProps>): import("react/jsx-runtime").JSX.Element;
17
+ export declare const MainLoginPage: (props: Readonly<MainLoginPageProps>) => import("react/jsx-runtime").JSX.Element;
18
+ /**
19
+ * Login body component without layout wrapper.
20
+ * Displays four authentication method buttons (Mobile, Email, Google, Apple).
21
+ *
22
+ * Use this when you need custom layout or when integrating with AuthFlow.
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * <MainLogin
27
+ * onContinueWithMobile={() => navigate('/auth/phone')}
28
+ * onContinueWithEmail={() => navigate('/auth/email')}
29
+ * />
30
+ * ```
31
+ */
32
+ export declare function MainLogin(props: Readonly<MainLoginPageProps>): import("react/jsx-runtime").JSX.Element;
@@ -1,23 +1,45 @@
1
- import type { OtpVerificationMode } from '@/hooks/use-otp-verification';
2
- export type { OtpVerificationMode };
3
- export interface OtpVerificationProps {
4
- /** Mode: mobile (phone) or email OTP */
5
- mode: OtpVerificationMode;
6
- /** Title override. Default: "6 digit OTP has been sent to your Mobile" | "..." Email */
7
- title?: string;
8
- /** Masked phone (e.g. "+91 9825910X0X") or email (e.g. "j***@gmail.com") */
9
- recipientDisplay: string;
10
- /** When true, show instruction line ("Kindly check your Email Inbox."). Used for foreign user flow. */
11
- isForeignUser?: boolean;
12
- /** Handler when back is clicked */
13
- onBack?: () => void;
14
- /** Handler when form is submitted with valid 6-digit OTP */
15
- onSubmit?: (otp: string) => void;
16
- /** Handler when user requests resend code */
17
- onResendCode?: () => void;
18
- }
1
+ import type { OtpVerificationPageProps, OtpVerificationProps } from '@/types';
2
+ export type { OtpVerificationMode, OtpVerificationPageProps, OtpVerificationProps, } from '@/types';
19
3
  /**
20
- * OTP verification screen: 6-digit OTP input, resend countdown, and submit.
21
- * Slot into AuthLayout.Body; layout shell is provided by the consumer.
4
+ * Full OTP verification page with AuthLayoutWrapper and back button.
5
+ * Use when rendering the OTP screen as a standalone page.
6
+ *
7
+ * @example Next.js: API in hook, redirect from consumer
8
+ * ```tsx
9
+ * <OtpVerificationPage
10
+ * mode="phone"
11
+ * recipientDisplay="+91 9825910X0X"
12
+ * onBack={() => router.back()}
13
+ * submitApi={(otp) => api.verifyOtp(otp)}
14
+ * onSuccess={() => router.push('/dashboard')}
15
+ * onResendCode={() => api.resendOtp()}
16
+ * />
17
+ * ```
18
+ *
19
+ * @example Sync callback (AuthFlow)
20
+ * ```tsx
21
+ * <OtpVerificationPage onSubmit={(otp) => actions.verifyOtp(otp)} ... />
22
+ * ```
22
23
  */
23
- export declare function OtpVerification({ mode, title, recipientDisplay, isForeignUser, onSubmit, onResendCode, }: Readonly<OtpVerificationProps>): import("react/jsx-runtime").JSX.Element;
24
+ export declare function OtpVerificationPage(props: Readonly<OtpVerificationPageProps>): import("react/jsx-runtime").JSX.Element;
25
+ /**
26
+ * OTP verification form body without layout wrapper.
27
+ * 6-digit OTP input, resend countdown, and submit. Use inside your own layout or AuthFlow.
28
+ * Validation per edge cases 6, 7 (invalid/expired OTP); cursor focus on first OTP box (#26).
29
+ *
30
+ * @example With submitApi + onSuccess (consumer redirect)
31
+ * ```tsx
32
+ * <OtpVerification
33
+ * mode="phone"
34
+ * recipientDisplay="+91 9825910X0X"
35
+ * submitApi={(otp) => api.verifyOtp(otp)}
36
+ * onSuccess={() => router.push('/dashboard')}
37
+ * />
38
+ * ```
39
+ *
40
+ * @example Sync onSubmit (AuthFlow)
41
+ * ```tsx
42
+ * <OtpVerification onSubmit={(otp) => actions.verifyOtp(otp)} ... />
43
+ * ```
44
+ */
45
+ export declare function OtpVerification(props: Readonly<OtpVerificationProps>): import("react/jsx-runtime").JSX.Element;
@@ -1,20 +1,49 @@
1
- export interface RepeatLoginProps {
2
- /**
3
- * Last used authentication method shown in the primary button label.
4
- * Example: "Mobile", "Email".
5
- *
6
- * @default "Mobile"
7
- */
8
- lastUsedMethod?: string;
9
- /** Handler for the primary action (continue with last used method). */
10
- onContinueWithLastMethod?: () => void;
11
- /** Handler for the secondary action (choose another method). */
12
- onUseAnotherMethod?: () => void;
13
- }
1
+ import type { RepeatLoginPageProps, RepeatLoginProps } from '@/types';
2
+ export type { RepeatLoginPageProps, RepeatLoginProps } from '@/types';
14
3
  /**
15
- * Repeat login page body: primary CTA (continue with last method) and secondary
16
- * "Use another method" button. Intended to be slotted into AuthLayout.Body.
17
- * Layout shell (AuthLayout with Logo, Title, Description) is provided by the
18
- * app or story.
4
+ * Full Repeat Login page with AuthLayoutWrapper, logo, title, description, and footer.
5
+ * Use when rendering the repeat login screen as a standalone page.
6
+ *
7
+ * @example Next.js: API in lib, redirect from consumer
8
+ * ```tsx
9
+ * <RepeatLoginPage
10
+ * lastUsedMethod="Mobile"
11
+ * continueApi={() => api.validateSession()}
12
+ * onSuccess={() => router.push('/dashboard')}
13
+ * onUseAnotherMethod={() => resetFlow()}
14
+ * />
15
+ * ```
16
+ *
17
+ * @example Sync (AuthFlow)
18
+ * ```tsx
19
+ * <RepeatLoginPage
20
+ * onContinueWithLastMethod={() => actions.continueWithLastMethod()}
21
+ * onUseAnotherMethod={() => actions.reset()}
22
+ * />
23
+ * ```
19
24
  */
20
- export declare function RepeatLogin({ lastUsedMethod, onContinueWithLastMethod, onUseAnotherMethod, }: Readonly<RepeatLoginProps>): import("react/jsx-runtime").JSX.Element;
25
+ export declare function RepeatLoginPage(props: Readonly<RepeatLoginPageProps>): import("react/jsx-runtime").JSX.Element;
26
+ /**
27
+ * Repeat login body without layout wrapper.
28
+ * Primary CTA (continue with last method) and secondary "Use another method" button.
29
+ * When continueApi is provided, primary runs: continueApi() → onSuccess() (e.g. redirect).
30
+ *
31
+ * @example With continueApi + onSuccess (consumer redirect)
32
+ * ```tsx
33
+ * <RepeatLogin
34
+ * lastUsedMethod="Mobile"
35
+ * continueApi={() => api.validateSession()}
36
+ * onSuccess={() => router.push('/dashboard')}
37
+ * onUseAnotherMethod={() => resetFlow()}
38
+ * />
39
+ * ```
40
+ *
41
+ * @example Sync (AuthFlow)
42
+ * ```tsx
43
+ * <RepeatLogin
44
+ * onContinueWithLastMethod={() => actions.continueWithLastMethod()}
45
+ * onUseAnotherMethod={() => actions.reset()}
46
+ * />
47
+ * ```
48
+ */
49
+ export declare function RepeatLogin(props: Readonly<RepeatLoginProps>): import("react/jsx-runtime").JSX.Element;
@@ -1,25 +1,45 @@
1
- import type { UserType } from '@/core/auth-types';
2
- import type { IdentifierType } from '@/core/use-auth-flow';
3
- import type { SignupEntryMode } from '@/hooks/use-signup-form';
4
- export type { SignupEntryMode };
5
- export interface SignupPageProps {
6
- /** Indian: which field to collect. Foreign: use 'foreign' mode (name + email + phone). */
7
- userType: UserType;
8
- /** How user started (phone or email). */
9
- loginMethod: IdentifierType;
10
- /** Indian only: which field to collect (phone or email). */
11
- signupCollectField: IdentifierType;
12
- /** Foreign only: phone when user entered phone before signup details. */
13
- pendingPhone?: string;
14
- /** Handler when form is submitted. */
15
- onSubmit?: (data: {
16
- fullName: string;
17
- phone?: string;
18
- email?: string;
19
- }) => void;
20
- }
1
+ import type { SignupPageFullProps, SignupPageProps } from '@/types';
2
+ export type { SignupEntryMode, SignupPageFullProps, SignupPageProps, } from '@/types';
21
3
  /**
22
- * Signup screen: full name plus phone/email (Indian) or full name + email + phone (Foreign).
23
- * Always uses standalone layout when used in auth flow.
4
+ * Full Signup page with AuthLayoutWrapper, logo, and default welcome copy.
5
+ * Use when rendering the signup screen as a standalone page.
6
+ *
7
+ * @example Next.js: API in hook, redirect from consumer
8
+ * ```tsx
9
+ * <SignupPage
10
+ * userType="INDIAN"
11
+ * loginMethod="phone"
12
+ * signupCollectField="email"
13
+ * submitApi={(data) => api.completeProfile(data)}
14
+ * onSuccess={() => router.push('/otp')}
15
+ * />
16
+ * ```
17
+ *
18
+ * @example Sync onSubmit (AuthFlow)
19
+ * ```tsx
20
+ * <SignupPage onSubmit={(data) => actions.submitSignupDetails(data)} ... />
21
+ * ```
24
22
  */
25
- export declare function SignupPage({ userType, signupCollectField, pendingPhone, onSubmit, }: Readonly<SignupPageProps>): import("react/jsx-runtime").JSX.Element;
23
+ export declare function SignupPage(props: Readonly<SignupPageFullProps>): import("react/jsx-runtime").JSX.Element;
24
+ /**
25
+ * Signup form body without layout wrapper.
26
+ * Full name plus phone/email (Indian) or full name + email + phone (Foreign).
27
+ * Validation per PRODUCT_PROTOCOLS #1, #25 and edge cases 9, 10, 16, 19; cursor focus on first field (#26).
28
+ * Use inside your own layout or AuthFlow.
29
+ *
30
+ * @example With submitApi + onSuccess (consumer redirect)
31
+ * ```tsx
32
+ * <Signup
33
+ * userType="INDIAN"
34
+ * signupCollectField="email"
35
+ * submitApi={(data) => api.completeProfile(data)}
36
+ * onSuccess={() => router.push('/otp')}
37
+ * />
38
+ * ```
39
+ *
40
+ * @example Sync onSubmit (AuthFlow)
41
+ * ```tsx
42
+ * <Signup onSubmit={(data) => actions.submitSignupDetails(data)} ... />
43
+ * ```
44
+ */
45
+ export declare function Signup(props: Readonly<SignupPageProps>): import("react/jsx-runtime").JSX.Element;
package/dist/pages.js CHANGED
@@ -1,8 +1,8 @@
1
- import { L as n, M as o, O as e, R as g, S as s } from "./signup-x-Jm7XKn.js";
1
+ import { L as g, M as i, O as n, R as o, S as s } from "./signup-BpiNvZy4.js";
2
2
  export {
3
- n as LoginEntry,
4
- o as MainLogin,
5
- e as OtpVerification,
6
- g as RepeatLogin,
3
+ g as LoginEntryPage,
4
+ i as MainLoginPage,
5
+ n as OtpVerificationPage,
6
+ o as RepeatLoginPage,
7
7
  s as SignupPage
8
8
  };