doct-ui-auth-kit 1.0.5 → 1.0.7
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/README.md +11 -0
- package/dist/adapters/http-auth-adapter.d.ts +1 -5
- package/dist/auth/index.d.ts +2 -2
- package/dist/components/form/rhf-doct-phone-input.d.ts +1 -1
- package/dist/components/form/rhf-input-field.d.ts +1 -1
- package/dist/components/form/rhf-otp-input-field.d.ts +1 -1
- package/dist/components/layout/auth-layout-preset.d.ts +7 -2
- package/dist/components/layout/auth-layout-public.d.ts +8 -12
- package/dist/components/layout/auth-layout-wrapper.d.ts +21 -2
- package/dist/components/layout/auth-layout.d.ts +1 -1
- package/dist/components/layout/image-slider.d.ts +2 -2
- package/dist/components/layout/main-layout.d.ts +2 -2
- package/dist/constants/layout-presets.d.ts +1 -5
- package/dist/core/auth-api-adapter.d.ts +1 -1
- package/dist/core/auth-context.d.ts +5 -5
- package/dist/core/auth-provider.d.ts +2 -2
- package/dist/core/auth-types.d.ts +1 -1
- package/dist/core/device-detection.d.ts +2 -6
- package/dist/core/sso-session.d.ts +2 -6
- package/dist/core/use-auth-flow.d.ts +2 -6
- package/dist/hooks/use-login-entry-form.d.ts +2 -2
- package/dist/hooks/use-main-auth-page-handlers.d.ts +2 -2
- package/dist/hooks/use-otp-verification.d.ts +3 -3
- package/dist/hooks/use-repeat-login.d.ts +2 -2
- package/dist/hooks/use-signup-form.d.ts +2 -2
- package/dist/index.d.ts +11 -36
- package/dist/index.js +3 -2
- package/dist/pages/login-entry.d.ts +4 -4
- package/dist/pages/main-login.d.ts +2 -2
- package/dist/pages/otp-verification.d.ts +2 -2
- package/dist/pages/repeat-login.d.ts +2 -2
- package/dist/pages/signup.d.ts +4 -43
- package/dist/pages.js +6 -5
- package/dist/signup-DeeuWsoF.js +1718 -0
- package/dist/types/auth-api-adapter.d.ts +1 -5
- package/dist/types/auth-layout-types.d.ts +1 -1
- package/dist/types/auth-provider.d.ts +7 -4
- package/dist/types/device-detection.d.ts +4 -1
- package/dist/types/flow.d.ts +1 -4
- package/dist/types/forms.d.ts +28 -2
- package/dist/types/layout-presets.d.ts +1 -6
- package/dist/types/layout.d.ts +1 -1
- package/dist/types/login-form.d.ts +24 -7
- package/dist/types/main-login.d.ts +11 -0
- package/dist/types/otp-verification.d.ts +15 -3
- package/dist/types/pages.d.ts +10 -10
- package/dist/types/repeat-login.d.ts +1 -0
- package/dist/types/signup-form.d.ts +10 -3
- package/dist/utils/set-form-errors-from-zod.d.ts +1 -1
- package/dist/validations/schemas.d.ts +4 -7
- package/package.json +4 -4
- package/dist/signup-BJWKwg7j.js +0 -1723
- package/dist/stories/components/default-footer.d.ts +0 -5
- package/dist/stories/components/enterprise-header.d.ts +0 -5
- package/dist/stories/components/index.d.ts +0 -2
package/README.md
CHANGED
|
@@ -29,6 +29,17 @@ import 'docthub-core-components/style.css';
|
|
|
29
29
|
import 'doct-ui-auth-kit/style.css';
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
## Required static assets
|
|
33
|
+
|
|
34
|
+
When using **`MainLoginPage`** or **`AuthLayoutWrapper`** with `layoutType="withSlider"`, the kit references static paths that are served from **your app’s** `public/` folder. The published npm package does not include these files, so you must add them yourself.
|
|
35
|
+
|
|
36
|
+
| Asset | Path in your app | Used for |
|
|
37
|
+
|-------|------------------|----------|
|
|
38
|
+
| Logo | `public/main-logo.svg` | Main login page logo (or pass a custom `logo` prop to `AuthLayoutWrapper`) |
|
|
39
|
+
| Slider images | `public/slider/slide-1.png` … `public/slider/slide-5.png` | Marketing slider on the left panel (or pass custom `sliderImages` to `AuthLayoutWrapper`) |
|
|
40
|
+
|
|
41
|
+
**To get the default assets:** copy from this repo’s `public/main-logo.svg` and `public/slider/*.png` into your app’s `public/` (and `public/slider/`) if you have the kit source. Otherwise use your own logo and slider images. You can also override at runtime by passing the `logo` and `sliderImages` props to `AuthLayoutWrapper` (or equivalent) where the API supports it.
|
|
42
|
+
|
|
32
43
|
## Consumer imports
|
|
33
44
|
|
|
34
45
|
Install the package and import components, layouts, and types from the library:
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* HTTP adapter that calls a compatible auth API (e.g. doct-auth-mock-api).
|
|
3
|
-
* Use with SSOAuthProvider: apiAdapter: createHttpAuthAdapter('http://localhost:3001')
|
|
4
|
-
*/
|
|
5
|
-
import type { AuthApiAdapter } from '@/core/auth-api-adapter';
|
|
1
|
+
import { AuthApiAdapter } from '../core/auth-api-adapter';
|
|
6
2
|
/**
|
|
7
3
|
* Creates an AuthApiAdapter that calls the given API base URL.
|
|
8
4
|
* Expects routes: POST /api/auth/send-otp, verify-otp, complete-profile,
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SSOAuthProvider } from '../core/auth-provider';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { OtpVerificationProps } from '../pages/otp-verification';
|
|
3
|
+
import { SignupPageProps } from '../pages/signup';
|
|
4
4
|
/** Simple API: full login/signup flow (method select → identifier → OTP → profile). Use inside Auth.Provider. */
|
|
5
5
|
declare function AuthLogin(): React.ReactElement;
|
|
6
6
|
/** Simple API: signup (profile completion) screen with signup layout preset. Layout only; pass props for behavior. */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RHFDoctPhoneInputFieldProps } from '../../types/forms';
|
|
2
2
|
export declare function RHFDoctPhoneInputField({ name, label, placeholder, helperText, defaultCountry, variant, required, disabled, control, error, autoFocus, }: RHFDoctPhoneInputFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RHFInputFieldProps } from '../../types/forms';
|
|
2
2
|
export declare function RHFInputField({ name, label, placeholder, className, control, required, type, disabled, onKeyDown, maxLength, numericOnly, autoFocus, }: RHFInputFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RHFOtpInputFieldProps } from '../../types/forms';
|
|
2
2
|
export declare function RHFOtpInputField({ name, label, className, control, length, inputClassName, autoFocus, }: RHFOtpInputFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { LayoutPresetName } from '../../types/layout-presets';
|
|
3
3
|
export interface AuthLayoutPresetProps {
|
|
4
4
|
/**
|
|
5
5
|
* Preset name. Controls structure only (layoutType, variant, maxWidth, contentWidth, align).
|
|
@@ -10,10 +10,15 @@ export interface AuthLayoutPresetProps {
|
|
|
10
10
|
children: ReactNode;
|
|
11
11
|
/** Optional slot overrides. When not provided, slot is empty. */
|
|
12
12
|
logo?: ReactNode;
|
|
13
|
+
/** Title element or string rendered below the logo. */
|
|
13
14
|
title?: ReactNode;
|
|
15
|
+
/** Description element or string rendered below the title. */
|
|
14
16
|
description?: ReactNode;
|
|
17
|
+
/** Footer element rendered at the bottom of the layout. */
|
|
15
18
|
footer?: ReactNode;
|
|
19
|
+
/** Header element rendered above the main content area. */
|
|
16
20
|
header?: ReactNode;
|
|
21
|
+
/** Custom back button element rendered in place of the logo slot. */
|
|
17
22
|
backButton?: ReactNode;
|
|
18
23
|
/** Extra class for root. */
|
|
19
24
|
className?: string;
|
|
@@ -1,17 +1,13 @@
|
|
|
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
1
|
import { AuthLayoutPreset } from './auth-layout-preset';
|
|
6
2
|
/** Compound layout + preset-based layout. Use .Root/.Header/... for composition, .Preset for preset. */
|
|
7
3
|
export declare const AuthLayout: {
|
|
8
4
|
Preset: typeof AuthLayoutPreset;
|
|
9
|
-
Root: ({ children, variant, maxWidth, className, contentClassName, }: Readonly<import(
|
|
10
|
-
Header: ({ children, className, }: Readonly<import(
|
|
11
|
-
Main: ({ children, sm, className, }: Readonly<import(
|
|
12
|
-
Logo: ({ children, align, className, }: Readonly<import(
|
|
13
|
-
Title: ({ children, align, className, }: Readonly<import(
|
|
14
|
-
Description: ({ children, align, className, }: Readonly<import(
|
|
15
|
-
Body: ({ children, className, }: Readonly<import(
|
|
16
|
-
Footer: ({ children, className, }: Readonly<import(
|
|
5
|
+
Root: ({ children, variant, maxWidth, className, contentClassName, }: Readonly<import('.').AuthLayoutRootProps>) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Header: ({ children, className, }: Readonly<import('.').AuthLayoutHeaderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
Main: ({ children, sm, className, }: Readonly<import('.').AuthLayoutMainProps>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
Logo: ({ children, align, className, }: Readonly<import('.').AuthLayoutLogoProps>) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
Title: ({ children, align, className, }: Readonly<import('.').AuthLayoutTitleProps>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
Description: ({ children, align, className, }: Readonly<import('.').AuthLayoutDescriptionProps>) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
Body: ({ children, className, }: Readonly<import('.').AuthLayoutBodyProps>) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
Footer: ({ children, className, }: Readonly<import('.').AuthLayoutFooterProps>) => import("react/jsx-runtime").JSX.Element;
|
|
17
13
|
};
|
|
@@ -1,23 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AuthLayoutAlign, AuthLayoutMaxWidth, AuthLayoutVariant } from '../../types/auth-layout-types';
|
|
3
|
+
/** Layout mode: `'withSlider'` renders inside a split-screen with an image slider, `'standalone'` renders without. */
|
|
3
4
|
export type AuthLayoutType = 'withSlider' | 'standalone';
|
|
5
|
+
/** Props for the AuthLayoutWrapper component that assembles the auth page shell. */
|
|
4
6
|
export interface AuthLayoutWrapperProps {
|
|
7
|
+
/** Main content (typically the form body) rendered inside the layout. */
|
|
5
8
|
children: ReactNode;
|
|
9
|
+
/** Layout mode controlling the outer chrome. @default `'withSlider'` */
|
|
6
10
|
layoutType?: AuthLayoutType;
|
|
11
|
+
/** Logo or back-button element rendered at the top of the content area. */
|
|
7
12
|
logo?: ReactNode;
|
|
13
|
+
/** Heading element or string rendered below the logo. */
|
|
8
14
|
title?: ReactNode;
|
|
15
|
+
/** Descriptive text or element rendered below the title. */
|
|
9
16
|
description?: ReactNode;
|
|
17
|
+
/** Footer element rendered at the bottom of the content area. */
|
|
10
18
|
footer?: ReactNode;
|
|
19
|
+
/** Header element rendered above the main content area. */
|
|
11
20
|
header?: ReactNode;
|
|
21
|
+
/** Called when the back button is clicked. Pass `null` to hide the back button explicitly. */
|
|
12
22
|
onBack?: (() => void) | null;
|
|
23
|
+
/** Custom back button element. When provided, overrides the default back arrow button. */
|
|
13
24
|
backButton?: ReactNode;
|
|
25
|
+
/** Image URLs for the slider panel (only used when `layoutType` is `'withSlider'`). */
|
|
14
26
|
sliderImages?: string[];
|
|
27
|
+
/** Auto-play interval in milliseconds for the slider. */
|
|
15
28
|
sliderAutoPlayInterval?: number;
|
|
29
|
+
/** Titles displayed alongside each slider image. */
|
|
16
30
|
sliderTitles?: (ReactNode | string)[];
|
|
31
|
+
/** Layout variant controlling responsive behavior (e.g. `'desktop'`, `'mobile'`). */
|
|
17
32
|
variant?: AuthLayoutVariant;
|
|
33
|
+
/** Maximum width constraint for the content area (e.g. `'sm'`, `'md'`, `'lg'`). @default `'sm'` */
|
|
18
34
|
maxWidth?: AuthLayoutMaxWidth;
|
|
35
|
+
/** Content width preset: `'sm'` for narrow forms, `'default'` for standard width. @default `'default'` */
|
|
19
36
|
contentWidth?: 'sm' | 'default';
|
|
37
|
+
/** Horizontal alignment of logo, title, and description. @default `'center'` */
|
|
20
38
|
align?: AuthLayoutAlign;
|
|
39
|
+
/** Additional CSS class name(s) applied to the outermost layout element. */
|
|
21
40
|
className?: string;
|
|
22
41
|
}
|
|
23
42
|
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,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AuthLayoutBodyProps, AuthLayoutDescriptionProps, AuthLayoutFooterProps, AuthLayoutHeaderProps, AuthLayoutLogoProps, AuthLayoutMainProps, AuthLayoutRootProps, AuthLayoutTitleProps } from '../../types/auth-layout-types';
|
|
2
2
|
/**
|
|
3
3
|
* Root container component for auth layouts.
|
|
4
4
|
* Provides layout context to child slot components.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type { ImageSliderProps } from '
|
|
1
|
+
import { ImageSliderProps } from '../../types';
|
|
2
|
+
export type { ImageSliderProps } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Image slider component with indicator dots.
|
|
5
5
|
* Supports both controlled and uncontrolled modes.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type { MainLayoutProps, MarketingPanelProps } from '
|
|
1
|
+
import { MainLayoutProps, MarketingPanelProps } from '../../types';
|
|
2
|
+
export type { MainLayoutProps, MarketingPanelProps } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Marketing panel component - displays CTA, image slider, and indicators
|
|
5
5
|
*/
|
|
@@ -1,8 +1,4 @@
|
|
|
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';
|
|
1
|
+
import { LayoutPresetConfig, LayoutPresetName } from '../types/layout-presets';
|
|
6
2
|
/**
|
|
7
3
|
* Returns layout structure config for a preset name.
|
|
8
4
|
* Empty string returns undefined (caller uses full composition / no preset).
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Consumers implement this to connect the SDK to their central auth service.
|
|
4
4
|
* The SDK never performs HTTP calls directly.
|
|
5
5
|
*/
|
|
6
|
-
export type { AuthApiAdapter, SendOtpParams, VerifyOtpParams, } from '
|
|
6
|
+
export type { AuthApiAdapter, SendOtpParams, VerifyOtpParams, } from '../types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type { AuthFlowActions, AuthFlowContextValue, AuthFlowProviderConfig, } from '
|
|
3
|
-
export declare const AuthFlowContext: import(
|
|
1
|
+
import { AuthFlowContextValue } from '../types';
|
|
2
|
+
export type { AuthFlowActions, AuthFlowContextValue, AuthFlowProviderConfig, } from '../types';
|
|
3
|
+
export declare const AuthFlowContext: import('react').Context<AuthFlowContextValue | null>;
|
|
4
4
|
/**
|
|
5
5
|
* Hook to access auth flow state and actions. Must be used within SSOAuthProvider.
|
|
6
6
|
*/
|
|
@@ -9,9 +9,9 @@ export declare function useAuthFlow(): AuthFlowContextValue;
|
|
|
9
9
|
* Hook to access SSO session state only. Must be used within SSOAuthProvider.
|
|
10
10
|
*/
|
|
11
11
|
export declare function useAuthSession(): {
|
|
12
|
-
session: import(
|
|
12
|
+
session: import('../types').SSOSession | null;
|
|
13
13
|
isAuthenticated: boolean;
|
|
14
14
|
isLoading: boolean;
|
|
15
15
|
signOut: () => void;
|
|
16
|
-
authMethod: import(
|
|
16
|
+
authMethod: import('../types').AuthMethod | null;
|
|
17
17
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type { SSOAuthConfig, SSOAuthProviderProps } from '
|
|
1
|
+
import { SSOAuthProviderProps } from '../types';
|
|
2
|
+
export type { SSOAuthConfig, SSOAuthProviderProps } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* SSO Auth provider: runs session check on mount, holds flow state, and provides async actions.
|
|
5
5
|
*/
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Re-export of auth domain types from central types folder.
|
|
3
3
|
* Prefer importing from @/types; this file keeps @/core/auth-types working.
|
|
4
4
|
*/
|
|
5
|
-
export type { AuthError, AuthErrorCode, AuthenticateWithProviderParams, AuthMethod, AuthStep, CompleteProfileParams, RepeatLoginInfo, SendOtpResponse, SSOSession, SSOUser, UserType, VerifyOtpResponse, } from '
|
|
5
|
+
export type { AuthError, AuthErrorCode, AuthenticateWithProviderParams, AuthMethod, AuthStep, CompleteProfileParams, RepeatLoginInfo, SendOtpResponse, SSOSession, SSOUser, UserType, VerifyOtpResponse, } from '../types';
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Stores last-used method and masked identifier in localStorage (device-local UX only).
|
|
4
|
-
*/
|
|
5
|
-
import type { StoredRepeatLogin } from '@/types';
|
|
6
|
-
export type { StoredRepeatLogin } from '@/types';
|
|
1
|
+
import { StoredRepeatLogin } from '../types';
|
|
2
|
+
export type { StoredRepeatLogin } from '../types';
|
|
7
3
|
/**
|
|
8
4
|
* Reads repeat-login info from localStorage if present.
|
|
9
5
|
* Safe to call in browser; returns null in SSR or when not found.
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Token storage is consumer-configurable for cross-app SSO (e.g. shared cookie domain).
|
|
4
|
-
*/
|
|
5
|
-
import type { AxiosAuthInterceptorInstance, TokenStorageStrategy } from '@/types';
|
|
6
|
-
export type { AxiosAuthInterceptorInstance, AxiosRequestConfig, TokenStorageStrategy, } from '@/types';
|
|
1
|
+
import { AxiosAuthInterceptorInstance, TokenStorageStrategy } from '../types';
|
|
2
|
+
export type { AxiosAuthInterceptorInstance, AxiosRequestConfig, TokenStorageStrategy, } from '../types';
|
|
7
3
|
/**
|
|
8
4
|
* Token storage using localStorage (single-origin).
|
|
9
5
|
* Suitable for dev or when all Docthub apps share the same origin.
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Side effects (API calls, token persistence) are performed by the provider; this module is pure.
|
|
4
|
-
*/
|
|
5
|
-
import type { AuthFlowAction, AuthFlowState, AuthStep } from '@/types';
|
|
6
|
-
export type { AuthFlowAction, AuthFlowState, IdentifierType } from '@/types';
|
|
1
|
+
import { AuthFlowAction, AuthFlowState, AuthStep } from '../types';
|
|
2
|
+
export type { AuthFlowAction, AuthFlowState, IdentifierType } from '../types';
|
|
7
3
|
export declare const INITIAL_STEP: AuthStep;
|
|
8
4
|
export declare function getInitialAuthFlowState(): AuthFlowState;
|
|
9
5
|
export declare function authFlowReducer(state: AuthFlowState, action: AuthFlowAction): AuthFlowState;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type { EmailFormValues, LoginEntryFormValues, LoginEntryMode, LoginEntrySubmitData, PhoneFormValues, UseLoginEntryFormOptions, UseLoginEntryFormReturn, } from '
|
|
1
|
+
import { UseLoginEntryFormOptions, UseLoginEntryFormReturn } from '../types';
|
|
2
|
+
export type { EmailFormValues, LoginEntryFormValues, LoginEntryMode, LoginEntrySubmitData, LoginEntrySuccessParams, PhoneFormValues, UseLoginEntryFormOptions, UseLoginEntryFormReturn, } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Form state and validation for the login entry screen (phone or email).
|
|
5
5
|
* Business logic: when submitApi is provided, hook runs validate → submitApi(data) → onSuccess() (e.g. redirect).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type { MainAuthPageHandlers, MainLoginAppleProviderConfig, MainLoginGoogleProviderConfig, MainLoginPageProvidersConfig, UseMainAuthPageHandlersOptions, } from '
|
|
1
|
+
import { MainAuthPageHandlers, UseMainAuthPageHandlersOptions } from '../types';
|
|
2
|
+
export type { MainAuthPageHandlers, MainLoginAppleProviderConfig, MainLoginGoogleProviderConfig, MainLoginPageProvidersConfig, UseMainAuthPageHandlersOptions, } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Main auth page business logic: resolves CTA handlers from optional overrides and optional provider config.
|
|
5
5
|
* When providers.google / providers.apple are set, the lib runs Google/Apple OAuth and calls onCredential;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type { OtpFormValues, OtpVerificationMode, UseOtpVerificationOptions, UseOtpVerificationReturn, } from '
|
|
1
|
+
import { OtpVerificationMode, UseOtpVerificationOptions, UseOtpVerificationReturn } from '../types';
|
|
2
|
+
export type { OtpFormValues, OtpVerificationMode, UseOtpVerificationOptions, UseOtpVerificationReturn, } from '../types';
|
|
3
3
|
/** Instruction line below recipient (Figma: "Kindly check your Email Inbox."). */
|
|
4
4
|
export declare const DEFAULT_OTP_INSTRUCTIONS: Record<OtpVerificationMode, string>;
|
|
5
5
|
export declare const DEFAULT_OTP_TITLES: Record<OtpVerificationMode, string>;
|
|
6
6
|
/** Re-export for consumers who import from hooks. */
|
|
7
|
-
export { getResendCooldownSeconds, OTP_LENGTH, RESEND_COOLDOWN_EMAIL_SECONDS, RESEND_COOLDOWN_PHONE_SECONDS, } from '
|
|
7
|
+
export { getResendCooldownSeconds, OTP_LENGTH, RESEND_COOLDOWN_EMAIL_SECONDS, RESEND_COOLDOWN_PHONE_SECONDS, } from '../validations';
|
|
8
8
|
/**
|
|
9
9
|
* Form state, resend countdown, and validation for OTP verification.
|
|
10
10
|
* When submitApi is provided, hook runs: validate → submitApi(otp) → onSuccess() (e.g. redirect).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type { UseRepeatLoginOptions, UseRepeatLoginReturn } from '
|
|
1
|
+
import { UseRepeatLoginOptions, UseRepeatLoginReturn } from '../types';
|
|
2
|
+
export type { UseRepeatLoginOptions, UseRepeatLoginReturn } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Business logic for repeat login: continue with last method (sync or async via continueApi).
|
|
5
5
|
* When continueApi is provided, runs: continueApi() → onSuccess(); otherwise calls onContinueWithLastMethod.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type { SignupEmailFormValues, SignupEntryMode, SignupForeignFormValues, SignupFormValues, SignupPhoneFormValues, SignupSubmitData, UseSignupFormOptions, UseSignupFormReturn, } from '
|
|
1
|
+
import { UseSignupFormOptions, UseSignupFormReturn } from '../types';
|
|
2
|
+
export type { SignupEmailFormValues, SignupEntryMode, SignupForeignFormValues, SignupFormValues, SignupPhoneFormValues, SignupSubmitData, UseSignupFormOptions, UseSignupFormReturn, } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Form state and validation for the signup screen (full name + phone or email, or foreign: all three).
|
|
5
5
|
* When submitApi is provided, hook runs: validate → submitApi(data) → onSuccess() (e.g. redirect).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,36 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
* AuthFlow,
|
|
13
|
-
* useAuthFlow,
|
|
14
|
-
* useAuthSession,
|
|
15
|
-
* MainLayout,
|
|
16
|
-
* AuthLayout,
|
|
17
|
-
* ImageSlider,
|
|
18
|
-
* AuthLayoutWrapper,
|
|
19
|
-
* LoginEntry,
|
|
20
|
-
* OtpVerification,
|
|
21
|
-
* useGoogleAuth,
|
|
22
|
-
* } from 'doct-ui-auth-kit';
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
import './index.css';
|
|
26
|
-
export { createHttpAuthAdapter } from '@/adapters';
|
|
27
|
-
export { Auth } from '@/auth';
|
|
28
|
-
export type { UseAppleSignInOptions, UseGoogleAuthOptions, UseGoogleAuthReturn, } from '@/auth-methods';
|
|
29
|
-
export { useAppleSignIn, useGoogleAuth } from '@/auth-methods';
|
|
30
|
-
export type { AuthLayoutPresetProps, AuthLayoutType, AuthLayoutWrapperProps, } from '@/components/layout';
|
|
31
|
-
export { AuthLayout, AuthLayoutPreset, AuthLayoutWrapper, ImageSlider, MainLayout, } from '@/components/layout';
|
|
32
|
-
export * from '@/core';
|
|
33
|
-
export * from '@/hooks';
|
|
34
|
-
export type { LoginEntryPageProps, LoginEntryProps, MainLoginPageProps, MainLoginPageProvidersConfig, OtpVerificationPageProps, OtpVerificationProps, RepeatLoginPageProps, RepeatLoginProps, SignupPageFullProps, SignupPageProps, } from '@/pages';
|
|
35
|
-
export { LoginEntry, LoginEntryPage, MainLogin, MainLoginPage, OtpVerification, OtpVerificationPage, RepeatLogin, RepeatLoginPage, Signup, SignupPage, } from '@/pages';
|
|
36
|
-
export * from '@/types';
|
|
1
|
+
export { createHttpAuthAdapter } from './adapters';
|
|
2
|
+
export { Auth } from './auth';
|
|
3
|
+
export type { UseAppleSignInOptions, UseGoogleAuthOptions, UseGoogleAuthReturn, } from './auth-methods';
|
|
4
|
+
export { useAppleSignIn, useGoogleAuth } from './auth-methods';
|
|
5
|
+
export type { AuthLayoutPresetProps, AuthLayoutType, AuthLayoutWrapperProps, } from './components/layout';
|
|
6
|
+
export { AuthLayout, AuthLayoutPreset, AuthLayoutWrapper, ImageSlider, MainLayout, } from './components/layout';
|
|
7
|
+
export * from './core';
|
|
8
|
+
export * from './hooks';
|
|
9
|
+
export type { LoginEntryPageProps, LoginEntryProps, MainLoginPageProps, MainLoginPageProvidersConfig, OtpVerificationPageProps, OtpVerificationProps, RepeatLoginPageProps, RepeatLoginProps, SignupPageFullProps, SignupPageProps, } from './pages';
|
|
10
|
+
export { LoginEntry, LoginEntryPage, MainLogin, MainLoginPage, OtpVerification, OtpVerificationPage, RepeatLogin, RepeatLoginPage, Signup, SignupPage, } from './pages';
|
|
11
|
+
export * from './types';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as G, Fragment as Kt } from "react/jsx-runtime";
|
|
2
|
-
import { f as le, A as Zr, g as Xr, u as Jr, d as zr, e as Qr, c as ei, a as Yt, b as ti, O as ni, S as ri } from "./signup-
|
|
3
|
-
import { D as a1, I as o1, L as d1, h as u1, M as l1, i as s1, j as c1, k as f1, R as $1, l as p1, m as y1, n as h1, o as m1, p as g1, q as v1 } from "./signup-
|
|
3
|
+
import { f as le, A as Zr, g as Xr, u as Jr, d as zr, e as Qr, c as ei, a as Yt, b as ti, O as ni, S as ri } from "./signup-DeeuWsoF.js";
|
|
4
|
+
import { D as a1, I as o1, L as d1, h as u1, M as l1, i as s1, j as c1, k as f1, R as $1, l as p1, m as y1, n as h1, o as m1, p as g1, q as v1 } from "./signup-DeeuWsoF.js";
|
|
4
5
|
import N, { createContext as ii, useContext as tr, useRef as nr, useCallback as ae, useMemo as We, useReducer as ai, useEffect as oi } from "react";
|
|
5
6
|
import { DoctCircularProgress as di } from "docthub-core-components";
|
|
6
7
|
function Ft(e) {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type { LoginEntryMode, LoginEntryPageProps, LoginEntryProps, } from '
|
|
1
|
+
import { LoginEntryPageProps, LoginEntryProps } from '../types';
|
|
2
|
+
export type { LoginEntryMode, LoginEntryPageProps, LoginEntryProps, } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Full LoginEntry page with AuthLayoutWrapper, back button, and slider/standalone layout.
|
|
5
5
|
* Use when rendering the login entry screen as a standalone page.
|
|
6
6
|
*
|
|
7
|
-
* @example Next.js: API call in hook, redirect
|
|
7
|
+
* @example Next.js: API call in hook, redirect with mode + recipient for OTP page
|
|
8
8
|
* ```tsx
|
|
9
9
|
* <LoginEntryPage
|
|
10
10
|
* mode="phone"
|
|
11
11
|
* onBack={() => router.back()}
|
|
12
12
|
* submitApi={(data) => api.sendOtp(data)}
|
|
13
|
-
* onSuccess={() => router.push(
|
|
13
|
+
* onSuccess={(params) => router.push(`/otp?mode=${params.mode}&recipient=${encodeURIComponent(params.recipient)}`)}
|
|
14
14
|
* />
|
|
15
15
|
* ```
|
|
16
16
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type { MainLoginAppleProviderConfig, MainLoginGoogleProviderConfig, MainLoginPageProps, MainLoginPageProvidersConfig, } from '
|
|
1
|
+
import { MainLoginPageProps } from '../types';
|
|
2
|
+
export type { MainLoginAppleProviderConfig, MainLoginGoogleProviderConfig, MainLoginPageProps, MainLoginPageProvidersConfig, } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Full MainLogin page with AuthLayoutWrapper, header, footer, and slider layout.
|
|
5
5
|
* Includes default branding and layout configuration.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type { OtpVerificationMode, OtpVerificationPageProps, OtpVerificationProps, } from '
|
|
1
|
+
import { OtpVerificationPageProps, OtpVerificationProps } from '../types';
|
|
2
|
+
export type { OtpVerificationMode, OtpVerificationPageProps, OtpVerificationProps, } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Full OTP verification page with AuthLayoutWrapper and back button.
|
|
5
5
|
* Use when rendering the OTP screen as a standalone page.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type { RepeatLoginPageProps, RepeatLoginProps } from '
|
|
1
|
+
import { RepeatLoginPageProps, RepeatLoginProps } from '../types';
|
|
2
|
+
export type { RepeatLoginPageProps, RepeatLoginProps } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Full Repeat Login page with AuthLayoutWrapper, logo, title, description, and footer.
|
|
5
5
|
* Use when rendering the repeat login screen as a standalone page.
|
package/dist/pages/signup.d.ts
CHANGED
|
@@ -1,45 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type { SignupEntryMode, SignupPageFullProps, SignupPageProps, } from '
|
|
3
|
-
/**
|
|
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
|
-
* ```
|
|
22
|
-
*/
|
|
1
|
+
import { SignupPageFullProps, SignupPageProps } from '../types';
|
|
2
|
+
export type { SignupEntryMode, SignupPageFullProps, SignupPageProps, } from '../types';
|
|
3
|
+
/** Full signup page with layout wrapper, logo, title, and description. Renders the {@link Signup} form body inside an `AuthLayoutWrapper`. */
|
|
23
4
|
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
|
-
*/
|
|
5
|
+
/** Standalone signup form component (without layout). Use inside a custom layout or when layout is handled externally. */
|
|
45
6
|
export declare function Signup(props: Readonly<SignupPageProps>): import("react/jsx-runtime").JSX.Element;
|
package/dist/pages.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { L as e, a as n, M as g, b as s, O as o, c as t, R as p, d as L, S as r, e as P } from "./signup-DeeuWsoF.js";
|
|
2
3
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
e as LoginEntry,
|
|
5
|
+
n as LoginEntryPage,
|
|
5
6
|
g as MainLogin,
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
s as MainLoginPage,
|
|
8
|
+
o as OtpVerification,
|
|
8
9
|
t as OtpVerificationPage,
|
|
9
10
|
p as RepeatLogin,
|
|
10
11
|
L as RepeatLoginPage,
|