doct-ui-auth-kit 1.0.0 → 1.0.2

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 (42) hide show
  1. package/dist/auth/index.d.ts +23 -0
  2. package/dist/auth-methods/google.d.ts +3 -63
  3. package/dist/auth-methods/index.d.ts +1 -2
  4. package/dist/auth-methods/use-google-auth.d.ts +69 -0
  5. package/dist/components/layout/auth-layout-preset.d.ts +25 -0
  6. package/dist/components/layout/auth-layout-public.d.ts +17 -0
  7. package/dist/components/layout/auth-layout-wrapper.d.ts +23 -0
  8. package/dist/components/layout/index.d.ts +5 -3
  9. package/dist/constants/demo-slider.d.ts +0 -2
  10. package/dist/constants/index.d.ts +2 -1
  11. package/dist/constants/layout-presets.d.ts +10 -0
  12. package/dist/core/auth-context.d.ts +4 -8
  13. package/dist/core/auth-flow.d.ts +2 -2
  14. package/dist/core/auth-types.d.ts +3 -1
  15. package/dist/core/sso-session.d.ts +0 -16
  16. package/dist/core/use-auth-flow.d.ts +22 -19
  17. package/dist/hooks/index.d.ts +1 -1
  18. package/dist/hooks/use-otp-verification.d.ts +9 -2
  19. package/dist/hooks/use-signup-form.d.ts +18 -8
  20. package/dist/index.d.ts +2 -1
  21. package/dist/index.js +3275 -3067
  22. package/dist/main-logo.svg +3 -0
  23. package/dist/pages/index.d.ts +0 -2
  24. package/dist/pages/main-login.d.ts +1 -11
  25. package/dist/pages/otp-verification.d.ts +3 -1
  26. package/dist/pages/signup.d.ts +14 -6
  27. package/dist/pages.js +6 -8
  28. package/dist/signup-x-Jm7XKn.js +668 -0
  29. package/dist/stories/components/default-footer.d.ts +5 -0
  30. package/dist/stories/components/enterprise-header.d.ts +5 -0
  31. package/dist/stories/components/index.d.ts +2 -0
  32. package/dist/types/forms.d.ts +3 -87
  33. package/dist/types/index.d.ts +5 -4
  34. package/dist/types/layout-presets.d.ts +29 -0
  35. package/package.json +1 -1
  36. package/dist/components/auth/repeat-login.d.ts +0 -24
  37. package/dist/components/form/rhf-password-field.d.ts +0 -2
  38. package/dist/pages/conflict.d.ts +0 -12
  39. package/dist/pages/foreign-email-collect.d.ts +0 -16
  40. package/dist/signup-Cnybfnhd.js +0 -720
  41. package/dist/types/common.d.ts +0 -25
  42. package/dist/types/user.d.ts +0 -31
@@ -0,0 +1,23 @@
1
+ import { SSOAuthProvider } from '../core/auth-provider';
2
+ import type { OtpVerificationProps } from '../pages/otp-verification';
3
+ import type { SignupPageProps } from '../pages/signup';
4
+ /** Simple API: full login/signup flow (method select → identifier → OTP → profile). Use inside Auth.Provider. */
5
+ declare function AuthLogin(): React.ReactElement;
6
+ /** Simple API: signup (profile completion) screen with signup layout preset. Layout only; pass props for behavior. */
7
+ declare function AuthSignup(props: SignupPageProps): React.ReactElement;
8
+ /** Simple API: OTP verification screen with verification layout preset. Layout only; pass props for behavior. */
9
+ declare function AuthOtp(props: OtpVerificationProps): React.ReactElement;
10
+ /**
11
+ * Auth SDK simple + namespace API.
12
+ * - Auth.Provider: config (methods, MFA, rememberMe, apiAdapter, callbacks).
13
+ * - Auth.Login: full flow (simple).
14
+ * - Auth.Signup: signup screen with signup preset (simple).
15
+ * - Auth.Otp: OTP screen with verification preset (simple).
16
+ */
17
+ export declare const Auth: {
18
+ Provider: typeof SSOAuthProvider;
19
+ Login: typeof AuthLogin;
20
+ Signup: typeof AuthSignup;
21
+ Otp: typeof AuthOtp;
22
+ };
23
+ export type { SignupPageProps, OtpVerificationProps };
@@ -1,65 +1,5 @@
1
- import type { ReactNode } from 'react';
2
- import React from 'react';
3
- declare global {
4
- interface Window {
5
- google?: {
6
- accounts: {
7
- id: {
8
- initialize: (config: {
9
- client_id: string;
10
- callback: (response: {
11
- credential: string;
12
- }) => void;
13
- auto_select?: boolean;
14
- }) => void;
15
- prompt: (momentListener?: (moment: {
16
- getMomentType: () => string;
17
- }) => void) => void;
18
- renderButton: (element: HTMLElement, options: {
19
- theme?: string;
20
- size?: string;
21
- type?: string;
22
- text?: string;
23
- }) => void;
24
- };
25
- };
26
- };
27
- }
28
- }
29
- export interface UseGoogleOneTapOptions {
30
- /** Google OAuth 2.0 client ID. */
31
- clientId: string;
32
- /** Callback when user signs in with Google; receives the ID token (credential). */
33
- onCredential: (credential: string) => void;
34
- /** When true, show One Tap prompt after init. Default true. */
35
- enabled?: boolean;
36
- }
37
1
  /**
38
- * Loads Google Identity Services and optionally shows One Tap prompt.
39
- * Call onCredential with the ID token to pass to adapter.authenticateWithProvider.
2
+ * Google Identity Services: custom button + optional One Tap.
3
+ * Use useGoogleAuth and render your own button that calls loginWithGoogle.
40
4
  */
41
- export declare function useGoogleOneTap({ clientId, onCredential, enabled, }: UseGoogleOneTapOptions): {
42
- triggerOneTap: () => void;
43
- };
44
- export interface GoogleSignInButtonProps {
45
- /** Google OAuth 2.0 client ID. */
46
- clientId: string;
47
- /** Callback when user signs in; receives the ID token. */
48
- onCredential: (credential: string) => void;
49
- /** Optional container ref (when using the hook directly). */
50
- containerRef?: React.RefObject<HTMLDivElement | null>;
51
- }
52
- /**
53
- * Hook: renders the Google Sign-In button into the given container.
54
- * Ensure the container is in the DOM (e.g. use a ref on a div).
55
- */
56
- export declare function useGoogleSignInButton({ clientId, onCredential, containerRef, }: GoogleSignInButtonProps): void;
57
- export interface GoogleSignInButtonComponentProps {
58
- clientId: string;
59
- onCredential: (credential: string) => void;
60
- children?: ReactNode;
61
- }
62
- /**
63
- * Component: renders a div that is filled with the Google-branded sign-in button.
64
- */
65
- export declare function GoogleSignInButton({ clientId, onCredential, }: GoogleSignInButtonComponentProps): React.ReactElement;
5
+ export { type UseGoogleAuthOptions, type UseGoogleAuthReturn, useGoogleAuth, } from './use-google-auth';
@@ -1,2 +1 @@
1
- export { type UseAppleSignInOptions, useAppleSignIn } from './apple';
2
- export { GoogleSignInButton, type GoogleSignInButtonComponentProps, type GoogleSignInButtonProps, type UseGoogleOneTapOptions, useGoogleOneTap, useGoogleSignInButton, } from './google';
1
+ export { type UseGoogleAuthOptions, type UseGoogleAuthReturn, useGoogleAuth, } from './google';
@@ -0,0 +1,69 @@
1
+ /** GSI callback payload when user signs in. */
2
+ interface CredentialResponse {
3
+ credential: string;
4
+ }
5
+ /** OAuth2 Code Client callback payload (popup mode). */
6
+ interface CodeResponse {
7
+ code: string;
8
+ }
9
+ declare global {
10
+ interface Window {
11
+ google?: {
12
+ accounts: {
13
+ id: {
14
+ initialize: (config: {
15
+ client_id: string;
16
+ callback: (response: CredentialResponse) => void;
17
+ auto_select?: boolean;
18
+ /**
19
+ * When false, avoids using FedCM for One Tap prompts (helps when FedCM is
20
+ * disabled via browser/site settings).
21
+ */
22
+ use_fedcm_for_prompt?: boolean;
23
+ }) => void;
24
+ prompt: (momentListener?: (moment: {
25
+ getMomentType: () => string;
26
+ }) => void) => void;
27
+ };
28
+ oauth2: {
29
+ initCodeClient: (config: {
30
+ client_id: string;
31
+ scope: string;
32
+ ux_mode: 'popup';
33
+ callback: (response: CodeResponse) => void;
34
+ error_callback?: (error: {
35
+ type: string;
36
+ message?: string;
37
+ }) => void;
38
+ }) => {
39
+ requestCode: () => void;
40
+ };
41
+ };
42
+ };
43
+ };
44
+ }
45
+ }
46
+ export interface UseGoogleAuthOptions {
47
+ /** Google OAuth 2.0 client ID. Hook is a no-op when empty. */
48
+ clientId: string;
49
+ /**
50
+ * Called with a Google credential suitable for backend verification.
51
+ *
52
+ * - **One Tap** returns an **ID token**.
53
+ * - **Button click** uses OAuth popup and returns an **authorization code**.
54
+ *
55
+ * Your backend should verify/exchange this value for a session.
56
+ */
57
+ onCredential: (credential: string) => void;
58
+ /** When true, shows One Tap prompt automatically after init. Default false. */
59
+ enableOneTap?: boolean;
60
+ }
61
+ export interface UseGoogleAuthReturn {
62
+ /**
63
+ * Opens the Google sign-in popup (OAuth code flow).
64
+ * Intended for use with a custom "Continue with Google" button.
65
+ */
66
+ loginWithGoogle: () => Promise<void>;
67
+ }
68
+ export declare function useGoogleAuth({ clientId, onCredential, enableOneTap, }: UseGoogleAuthOptions): UseGoogleAuthReturn;
69
+ export {};
@@ -0,0 +1,25 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { LayoutPresetName } from '../../types/layout-presets';
3
+ export interface AuthLayoutPresetProps {
4
+ /**
5
+ * Preset name. Controls structure only (layoutType, variant, maxWidth, contentWidth, align).
6
+ * Use "" for no preset (children rendered as-is; use AuthLayout.Root for full composition).
7
+ */
8
+ preset: LayoutPresetName;
9
+ /** Main content (e.g. form). Rendered in layout body. */
10
+ children: ReactNode;
11
+ /** Optional slot overrides. When not provided, slot is empty. */
12
+ logo?: ReactNode;
13
+ title?: ReactNode;
14
+ description?: ReactNode;
15
+ footer?: ReactNode;
16
+ header?: ReactNode;
17
+ backButton?: ReactNode;
18
+ /** Extra class for root. */
19
+ className?: string;
20
+ }
21
+ /**
22
+ * Layout shell driven by a preset. Structure only — no auth logic.
23
+ * Use for advanced usage when you need a consistent layout without wiring AuthFlow.
24
+ */
25
+ export declare function AuthLayoutPreset({ preset, children, logo, title, description, footer, header, backButton, className, }: AuthLayoutPresetProps): React.ReactElement;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Public AuthLayout API: compound components + preset-based layout.
3
+ * Merged here to avoid circular dependencies (preset uses wrapper, wrapper uses compound).
4
+ */
5
+ import { AuthLayoutPreset } from './auth-layout-preset';
6
+ /** Compound layout + preset-based layout. Use .Root/.Header/... for composition, .Preset for preset. */
7
+ export declare const AuthLayout: {
8
+ Preset: typeof AuthLayoutPreset;
9
+ Root: ({ children, variant, maxWidth, className, contentClassName, }: Readonly<import(".").AuthLayoutRootProps>) => import("react/jsx-runtime").JSX.Element;
10
+ Header: ({ children, className, }: Readonly<import(".").AuthLayoutHeaderProps>) => import("react/jsx-runtime").JSX.Element;
11
+ Main: ({ children, sm, className, }: Readonly<import(".").AuthLayoutMainProps>) => import("react/jsx-runtime").JSX.Element;
12
+ Logo: ({ children, align, className, }: Readonly<import(".").AuthLayoutLogoProps>) => import("react/jsx-runtime").JSX.Element;
13
+ Title: ({ children, align, className, }: Readonly<import(".").AuthLayoutTitleProps>) => import("react/jsx-runtime").JSX.Element;
14
+ Description: ({ children, align, className, }: Readonly<import(".").AuthLayoutDescriptionProps>) => import("react/jsx-runtime").JSX.Element;
15
+ Body: ({ children, className, }: Readonly<import(".").AuthLayoutBodyProps>) => import("react/jsx-runtime").JSX.Element;
16
+ Footer: ({ children, className, }: Readonly<import(".").AuthLayoutFooterProps>) => import("react/jsx-runtime").JSX.Element;
17
+ };
@@ -0,0 +1,23 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { AuthLayoutAlign, AuthLayoutMaxWidth, AuthLayoutVariant } from '../../types/auth-layout-types';
3
+ export type AuthLayoutType = 'withSlider' | 'standalone';
4
+ export interface AuthLayoutWrapperProps {
5
+ children: ReactNode;
6
+ layoutType?: AuthLayoutType;
7
+ logo?: ReactNode;
8
+ title?: ReactNode;
9
+ description?: ReactNode;
10
+ footer?: ReactNode;
11
+ header?: ReactNode;
12
+ onBack?: (() => void) | null;
13
+ backButton?: ReactNode;
14
+ sliderImages?: string[];
15
+ sliderAutoPlayInterval?: number;
16
+ sliderTitles?: (ReactNode | string)[];
17
+ variant?: AuthLayoutVariant;
18
+ maxWidth?: AuthLayoutMaxWidth;
19
+ contentWidth?: 'sm' | 'default';
20
+ align?: AuthLayoutAlign;
21
+ className?: string;
22
+ }
23
+ export declare function AuthLayoutWrapper({ children, layoutType, logo, title, description, footer, header, onBack, backButton, sliderImages, sliderAutoPlayInterval, sliderTitles, variant, maxWidth, contentWidth, align, className, }: AuthLayoutWrapperProps): React.ReactElement;
@@ -1,6 +1,8 @@
1
1
  export type { AuthLayoutAlign, AuthLayoutBodyProps, AuthLayoutDescriptionProps, AuthLayoutFooterProps, AuthLayoutHeaderProps, AuthLayoutLogoProps, AuthLayoutMainProps, AuthLayoutMaxWidth, AuthLayoutRootProps, AuthLayoutTitleProps, AuthLayoutVariant, } from '../../types/auth-layout-types';
2
- export { AuthLayout } from './auth-layout';
2
+ export { AuthLayoutPreset, type AuthLayoutPresetProps, } from './auth-layout-preset';
3
+ export { AuthLayout } from './auth-layout-public';
4
+ export { type AuthLayoutType, AuthLayoutWrapper, type AuthLayoutWrapperProps, } from './auth-layout-wrapper';
3
5
  export type { ImageSliderProps } from './image-slider';
4
6
  export { ImageSlider } from './image-slider';
5
- export type { MainLayoutProps, MarketingPanelProps } from './main-layout';
6
- export { MainLayout, MarketingPanel } from './main-layout';
7
+ export type { MainLayoutProps } from './main-layout';
8
+ export { MainLayout } from './main-layout';
@@ -12,5 +12,3 @@
12
12
  export declare const DEMO_SLIDER_IMAGES: string[];
13
13
  /** Default auto-play interval (ms) for the demo slider. */
14
14
  export declare const DEMO_SLIDER_AUTO_PLAY_INTERVAL = 5000;
15
- /** Per-slide CTA titles for the demo slider (Figma: "Get Healthcare Career App Now!"). */
16
- export declare const DEMO_SLIDER_TITLES: string[];
@@ -1 +1,2 @@
1
- export { DEMO_SLIDER_AUTO_PLAY_INTERVAL, DEMO_SLIDER_IMAGES, DEMO_SLIDER_TITLES, } from './demo-slider';
1
+ export { DEMO_SLIDER_AUTO_PLAY_INTERVAL, DEMO_SLIDER_IMAGES, } from './demo-slider';
2
+ export { getLayoutPresetConfig } from './layout-presets';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Layout preset configurations. Structure only — no auth behavior.
3
+ * Used by AuthLayout when preset="login" | "signup" | "verification".
4
+ */
5
+ import type { LayoutPresetConfig, LayoutPresetName } from '../types/layout-presets';
6
+ /**
7
+ * Returns layout structure config for a preset name.
8
+ * Empty string returns undefined (caller uses full composition / no preset).
9
+ */
10
+ export declare function getLayoutPresetConfig(preset: LayoutPresetName): LayoutPresetConfig | undefined;
@@ -20,18 +20,14 @@ export interface AuthFlowActions {
20
20
  phone?: string;
21
21
  email?: string;
22
22
  }) => void;
23
- /** Foreign (non-IN) phone flow: collect fullName + email, send OTP to email. */
24
- submitForeignEmail: (data: {
25
- fullName: string;
26
- email: string;
27
- }) => void;
28
- verifyOtp: (otp: string) => void;
29
- resendOtp: () => void;
30
- completeProfile: (data: {
23
+ /** SIGNUP_DETAILS step: submit name + phone/email, then OTP (foreign) or complete (Indian). */
24
+ submitSignupDetails: (data: {
31
25
  fullName: string;
32
26
  phone?: string;
33
27
  email?: string;
34
28
  }) => void;
29
+ verifyOtp: (otp: string) => void;
30
+ resendOtp: () => void;
35
31
  providerCallback: (params: {
36
32
  provider: 'google' | 'apple';
37
33
  credential: string;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Full auth flow orchestrator. Renders the correct page per flow state.
3
- * Use inside SSOAuthProvider + AuthLayout.Main.
2
+ * Full auth flow orchestrator. Renders the correct page per flow state with appropriate layout.
3
+ * Use inside SSOAuthProvider.
4
4
  */
5
5
  export declare function AuthFlow(): import("react/jsx-runtime").JSX.Element | null;
@@ -21,8 +21,10 @@ export interface SSOSession {
21
21
  user: SSOUser;
22
22
  authMethod: AuthMethod;
23
23
  }
24
+ /** User type for layout and OTP routing: Indian (+91) vs Foreign (non +91). */
25
+ export type UserType = 'INDIAN' | 'FOREIGN';
24
26
  /** Flow states for the state machine. */
25
- export type AuthStep = 'CHECKING_SESSION' | 'REPEAT_LOGIN' | 'METHOD_SELECT' | 'PHONE_ENTRY' | 'EMAIL_ENTRY' | 'FOREIGN_EMAIL_COLLECT' | 'OTP_VERIFICATION' | 'PROFILE_COMPLETION' | 'PROVIDER_PENDING' | 'CONFLICT' | 'AUTHENTICATED';
27
+ export type AuthStep = 'CHECKING_SESSION' | 'REPEAT_LOGIN' | 'METHOD_SELECT' | 'PHONE_ENTRY' | 'EMAIL_ENTRY' | 'OTP_VERIFICATION' | 'SIGNUP_DETAILS' | 'PROVIDER_PENDING' | 'AUTHENTICATED';
26
28
  /** Error codes from the central auth service. */
27
29
  export type AuthErrorCode = 'IDENTIFIER_CONFLICT' | 'OTP_EXPIRED' | 'OTP_INVALID' | 'OTP_RATE_LIMIT' | 'SESSION_EXPIRED' | 'PROVIDER_AUTH_FAILED' | 'NETWORK_ERROR' | 'UNKNOWN';
28
30
  /** Auth error with code and optional message / linked identifier. */
@@ -2,7 +2,6 @@
2
2
  * SSO session management: token persistence strategies and useAuthSession hook.
3
3
  * Token storage is consumer-configurable for cross-app SSO (e.g. shared cookie domain).
4
4
  */
5
- import type { AuthMethod, SSOSession } from './auth-types';
6
5
  /** How/where the SSO token is stored for cross-app access. */
7
6
  export interface TokenStorageStrategy {
8
7
  get(): string | null;
@@ -14,21 +13,6 @@ export interface TokenStorageStrategy {
14
13
  * Suitable for dev or when all Docthub apps share the same origin.
15
14
  */
16
15
  export declare function localStorageTokenStorage(): TokenStorageStrategy;
17
- /**
18
- * Token storage using a cookie on the given domain (e.g. '.docthub.com').
19
- * Allows subdomains to share the SSO session. Not httpOnly (set from client).
20
- */
21
- export declare function cookieTokenStorage(domain: string): TokenStorageStrategy;
22
- /**
23
- * Return type of useAuthSession. Session and loading come from AuthFlowContext.
24
- */
25
- export interface UseAuthSessionReturn {
26
- session: SSOSession | null;
27
- isAuthenticated: boolean;
28
- isLoading: boolean;
29
- signOut: () => void;
30
- authMethod: AuthMethod | null;
31
- }
32
16
  /**
33
17
  * useAuthSession hook is implemented in auth-context (uses AuthFlowContext).
34
18
  * Re-exported from core index for consumer convenience.
@@ -2,7 +2,7 @@
2
2
  * Auth flow state machine: reducer and state type.
3
3
  * Side effects (API calls, token persistence) are performed by the provider; this module is pure.
4
4
  */
5
- import type { AuthError, AuthStep, SSOSession } from './auth-types';
5
+ import type { AuthStep, SSOSession, UserType } from './auth-types';
6
6
  /** Identifier type for OTP / profile steps. */
7
7
  export type IdentifierType = 'phone' | 'email';
8
8
  /** Full state for the auth flow. */
@@ -10,23 +10,23 @@ export interface AuthFlowState {
10
10
  step: AuthStep;
11
11
  /** Previous step for goBack. */
12
12
  lastStep: AuthStep;
13
- /** Current identifier value (phone or email) when in OTP or profile. */
13
+ /** Indian (+91) vs Foreign (non +91); drives layout and OTP routing. */
14
+ userType: UserType;
15
+ /** Current identifier value (phone or email) when in OTP or signup. */
14
16
  identifierValue: string;
15
17
  /** Type of identifier (phone vs email). */
16
18
  identifierType: IdentifierType;
17
19
  /** Masked value for display (e.g. "+91 9825910X0X"). */
18
20
  maskedRecipient: string;
19
- /** For PROFILE_COMPLETION: which field to collect (phone or email). */
20
- signupMode: IdentifierType;
21
+ /** For SIGNUP_DETAILS (Indian): which field to collect (phone or email). */
22
+ signupCollectField: IdentifierType;
21
23
  /** For REPEAT_LOGIN: last used method label. */
22
24
  lastMethod: string;
23
25
  /** Set when step is AUTHENTICATED. */
24
26
  session: SSOSession | null;
25
- /** Set when step is CONFLICT. */
26
- conflictError: AuthError | null;
27
- /** For FOREIGN_EMAIL_COLLECT: the non-IN phone we already have. */
28
- foreignPhoneValue: string;
29
- /** When set, foreign flow: use in completeProfile after OTP for new user. */
27
+ /** Foreign flow: phone value when user entered phone before signup details. */
28
+ pendingPhone: string;
29
+ /** Foreign flow: signup form data for completeProfile after OTP verify. */
30
30
  pendingFullName: string;
31
31
  pendingEmail: string;
32
32
  }
@@ -46,26 +46,29 @@ export type AuthFlowAction = {
46
46
  type: 'SET_STEP_PHONE_ENTRY';
47
47
  } | {
48
48
  type: 'SET_STEP_EMAIL_ENTRY';
49
- } | {
50
- type: 'SET_STEP_FOREIGN_EMAIL_COLLECT';
51
- phoneValue: string;
52
- maskedPhone?: string;
53
49
  } | {
54
50
  type: 'SET_STEP_OTP_VERIFICATION';
51
+ userType: UserType;
55
52
  identifierType: IdentifierType;
56
53
  value: string;
57
54
  maskedValue: string;
58
- /** Optional: from foreign flow for completeProfile after OTP. */
55
+ /** Foreign flow: for completeProfile after OTP. */
59
56
  pendingFullName?: string;
60
57
  pendingEmail?: string;
58
+ pendingPhone?: string;
61
59
  } | {
62
- type: 'SET_STEP_PROFILE_COMPLETION';
63
- signupMode: IdentifierType;
60
+ type: 'SET_STEP_SIGNUP_DETAILS';
61
+ userType: UserType;
62
+ /** Indian: which field to collect (phone or email). Foreign: ignored. */
63
+ signupCollectField: IdentifierType;
64
+ /** Foreign only: phone value when user entered phone before signup. */
65
+ pendingPhone?: string;
66
+ /** When coming from identifier entry (foreign): preserve for later OTP. */
67
+ identifierType?: IdentifierType;
68
+ identifierValue?: string;
69
+ maskedRecipient?: string;
64
70
  } | {
65
71
  type: 'SET_STEP_PROVIDER_PENDING';
66
- } | {
67
- type: 'SET_STEP_CONFLICT';
68
- error: AuthError;
69
72
  } | {
70
73
  type: 'SET_STEP_AUTHENTICATED';
71
74
  session: SSOSession;
@@ -1,3 +1,3 @@
1
1
  export { type EmailFormValues, type LoginEntryFormValues, type LoginEntryMode, type PhoneFormValues, type UseLoginEntryFormOptions, type UseLoginEntryFormReturn, useLoginEntryForm, } from './use-login-entry-form';
2
- export { DEFAULT_OTP_TITLES, OTP_LENGTH, type OtpFormValues, type OtpVerificationMode, RESEND_COOLDOWN_SECONDS, type UseOtpVerificationOptions, type UseOtpVerificationReturn, useOtpVerification, } from './use-otp-verification';
2
+ export { DEFAULT_OTP_TITLES, OTP_LENGTH, type OtpFormValues, type OtpVerificationMode, RESEND_COOLDOWN_EMAIL_SECONDS, RESEND_COOLDOWN_PHONE_SECONDS, type UseOtpVerificationOptions, type UseOtpVerificationReturn, useOtpVerification, } from './use-otp-verification';
3
3
  export { type SignupEmailFormValues, type SignupEntryMode, type SignupFormValues, type SignupPhoneFormValues, type UseSignupFormOptions, type UseSignupFormReturn, useSignupForm, } from './use-signup-form';
@@ -3,13 +3,20 @@ import { z } from 'zod';
3
3
  /** OTP verification mode: mobile (phone) or email */
4
4
  export type OtpVerificationMode = 'phone' | 'email';
5
5
  export declare const OTP_LENGTH = 6;
6
- export declare const RESEND_COOLDOWN_SECONDS = 120;
6
+ /** Resend cooldown: 60s for phone OTP, 2 min for email OTP (per design). */
7
+ export declare const RESEND_COOLDOWN_PHONE_SECONDS = 60;
8
+ export declare const RESEND_COOLDOWN_EMAIL_SECONDS = 120;
9
+ export declare function getResendCooldownSeconds(mode: OtpVerificationMode): number;
7
10
  declare const otpFormSchema: z.ZodObject<{
8
11
  otp: z.ZodArray<z.ZodString>;
9
12
  }, z.core.$strip>;
10
13
  export type OtpFormValues = z.infer<typeof otpFormSchema>;
11
14
  export declare const DEFAULT_OTP_TITLES: Record<OtpVerificationMode, string>;
15
+ /** Instruction line below recipient (Figma: "Kindly check your Email Inbox."). */
16
+ export declare const DEFAULT_OTP_INSTRUCTIONS: Record<OtpVerificationMode, string>;
12
17
  export interface UseOtpVerificationOptions {
18
+ /** OTP mode: phone (60s cooldown) or email (2 min cooldown). */
19
+ mode: OtpVerificationMode;
13
20
  onSubmit?: ((otp: string) => void) | undefined;
14
21
  onResendCode?: (() => void) | undefined;
15
22
  }
@@ -25,5 +32,5 @@ export interface UseOtpVerificationReturn {
25
32
  * Form state, resend countdown, and validation for OTP verification.
26
33
  * Use with OtpVerification component or build a custom OTP UI.
27
34
  */
28
- export declare function useOtpVerification({ onSubmit, onResendCode, }?: UseOtpVerificationOptions): UseOtpVerificationReturn;
35
+ export declare function useOtpVerification({ mode, onSubmit, onResendCode, }: UseOtpVerificationOptions): UseOtpVerificationReturn;
29
36
  export {};
@@ -1,7 +1,7 @@
1
1
  import type { UseFormReturn } from 'react-hook-form';
2
2
  import { z } from 'zod';
3
- /** Signup mode: phone number or email as the second field (after full name) */
4
- export type SignupEntryMode = 'phone' | 'email';
3
+ /** Signup mode: phone, email as second field, or foreign (full name + email + phone) */
4
+ export type SignupEntryMode = 'phone' | 'email' | 'foreign';
5
5
  declare const signupPhoneFormSchema: z.ZodObject<{
6
6
  fullName: z.ZodString;
7
7
  phone: z.ZodString;
@@ -10,13 +10,21 @@ declare const signupEmailFormSchema: z.ZodObject<{
10
10
  fullName: z.ZodString;
11
11
  email: z.ZodString;
12
12
  }, z.core.$strip>;
13
+ declare const signupForeignFormSchema: z.ZodObject<{
14
+ fullName: z.ZodString;
15
+ email: z.ZodString;
16
+ phone: z.ZodString;
17
+ }, z.core.$strip>;
13
18
  export type SignupPhoneFormValues = z.infer<typeof signupPhoneFormSchema>;
14
19
  export type SignupEmailFormValues = z.infer<typeof signupEmailFormSchema>;
15
- export type SignupFormValues = SignupPhoneFormValues | SignupEmailFormValues;
20
+ export type SignupForeignFormValues = z.infer<typeof signupForeignFormSchema>;
21
+ export type SignupFormValues = SignupPhoneFormValues | SignupEmailFormValues | SignupForeignFormValues;
16
22
  export interface UseSignupFormOptions {
17
- /** Mode: phone number or email as second field */
23
+ /** Mode: phone, email as second field, or foreign (name + email + phone) */
18
24
  mode: SignupEntryMode;
19
- /** Called with valid form data on submit. Omit or pass undefined when not needed. */
25
+ /** For foreign mode: pre-fill phone when user already entered it. */
26
+ defaultPhone?: string;
27
+ /** Called with valid form data on submit. */
20
28
  onSubmit?: ((data: {
21
29
  fullName: string;
22
30
  phone?: string;
@@ -26,12 +34,14 @@ export interface UseSignupFormOptions {
26
34
  export interface UseSignupFormReturn {
27
35
  methods: UseFormReturn<SignupFormValues>;
28
36
  handleSubmit: (data: SignupFormValues) => void;
29
- /** True when mode is 'phone', false when mode is 'email'. Use to switch between phone/email input. */
37
+ /** True when mode is 'phone', false when mode is 'email'. For 'foreign' same as (mode === 'phone') for layout. */
30
38
  isPhone: boolean;
39
+ /** True when mode is 'foreign' (full name + email + phone). */
40
+ isForeign: boolean;
31
41
  }
32
42
  /**
33
- * Form state and validation for the signup screen (full name + phone or email).
43
+ * Form state and validation for the signup screen (full name + phone or email, or foreign: all three).
34
44
  * Use with SignupPage component or build a custom signup form.
35
45
  */
36
- export declare function useSignupForm({ mode, onSubmit, }: UseSignupFormOptions): UseSignupFormReturn;
46
+ export declare function useSignupForm({ mode, defaultPhone, onSubmit, }: UseSignupFormOptions): UseSignupFormReturn;
37
47
  export {};
package/dist/index.d.ts CHANGED
@@ -13,11 +13,12 @@
13
13
  * AuthLayout,
14
14
  * LoginEntry,
15
15
  * OtpVerification,
16
- * useGoogleOneTap,
16
+ * useGoogleAuth,
17
17
  * } from 'doct-ui-auth-kit';
18
18
  * ```
19
19
  */
20
20
  export * from './adapters';
21
+ export { Auth } from './auth';
21
22
  export * from './auth-methods';
22
23
  export * from './components/layout';
23
24
  export * from './core';