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
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "doct-ui-auth-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Composable React auth SDK – layouts, login/signup/OTP pages, SSO provider, and auth flow hooks for Docthub",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
7
8
|
"types": "./dist/index.d.ts",
|
|
8
9
|
"files": ["dist", "README.md"],
|
|
9
10
|
"keywords": [
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
},
|
|
24
25
|
"scripts": {
|
|
25
26
|
"dev": "vite",
|
|
26
|
-
"build": "
|
|
27
|
+
"build": "vite build && tsc -p tsconfig.build.json",
|
|
27
28
|
"prepublishOnly": "npm run build",
|
|
28
29
|
"lint": "biome lint .",
|
|
29
30
|
"preview": "vite preview",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AuthApiAdapter } from '../core/auth-api-adapter';
|
|
2
|
-
/**
|
|
3
|
-
* Creates an AuthApiAdapter that calls the given API base URL.
|
|
4
|
-
* Expects routes: POST /api/auth/send-otp, verify-otp, complete-profile,
|
|
5
|
-
* authenticate-provider, validate-session, refresh-session; GET validate-session
|
|
6
|
-
* (with credentials) for validateSessionFromCookie.
|
|
7
|
-
*/
|
|
8
|
-
export declare function createHttpAuthAdapter(baseUrl: string): AuthApiAdapter;
|
package/dist/adapters/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createHttpAuthAdapter } from './http-auth-adapter';
|
package/dist/auth/index.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { SSOAuthProvider } from '../core/auth-provider';
|
|
2
|
-
import { OtpVerificationProps } from '../pages/otp-verification';
|
|
3
|
-
import { 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,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Apple Sign-In (future-ready stub).
|
|
3
|
-
* Implement when backend supports Apple ID credential validation.
|
|
4
|
-
*/
|
|
5
|
-
export interface UseAppleSignInOptions {
|
|
6
|
-
/** Apple client ID (Services ID). */
|
|
7
|
-
clientId: string;
|
|
8
|
-
/** Redirect URI registered in Apple Developer. */
|
|
9
|
-
redirectUri: string;
|
|
10
|
-
/** Callback when user signs in; receives the authorization code or id_token. */
|
|
11
|
-
onCredential: (credential: string) => void;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Stub: Apple Sign-In hook. Not implemented yet.
|
|
15
|
-
* Use adapter.authenticateWithProvider({ provider: 'apple', credential }) when you have the token.
|
|
16
|
-
*/
|
|
17
|
-
export declare function useAppleSignIn(options: UseAppleSignInOptions): {
|
|
18
|
-
triggerSignIn: () => void;
|
|
19
|
-
};
|
|
@@ -1,69 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { RHFDoctPhoneInputFieldProps } from '../../types/forms';
|
|
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 +0,0 @@
|
|
|
1
|
-
import { RHFInputFieldProps } from '../../types/forms';
|
|
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,30 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { 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 element or string rendered below the logo. */
|
|
14
|
-
title?: ReactNode;
|
|
15
|
-
/** Description element or string rendered below the title. */
|
|
16
|
-
description?: ReactNode;
|
|
17
|
-
/** Footer element rendered at the bottom of the layout. */
|
|
18
|
-
footer?: ReactNode;
|
|
19
|
-
/** Header element rendered above the main content area. */
|
|
20
|
-
header?: ReactNode;
|
|
21
|
-
/** Custom back button element rendered in place of the logo slot. */
|
|
22
|
-
backButton?: ReactNode;
|
|
23
|
-
/** Extra class for root. */
|
|
24
|
-
className?: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Layout shell driven by a preset. Structure only — no auth logic.
|
|
28
|
-
* Use for advanced usage when you need a consistent layout without wiring AuthFlow.
|
|
29
|
-
*/
|
|
30
|
-
export declare function AuthLayoutPreset({ preset, children, logo, title, description, footer, header, backButton, className, }: AuthLayoutPresetProps): React.ReactElement;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AuthLayoutPreset } from './auth-layout-preset';
|
|
2
|
-
/** Compound layout + preset-based layout. Use .Root/.Header/... for composition, .Preset for preset. */
|
|
3
|
-
export declare const AuthLayout: {
|
|
4
|
-
Preset: typeof AuthLayoutPreset;
|
|
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;
|
|
13
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
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. */
|
|
4
|
-
export type AuthLayoutType = 'withSlider' | 'standalone';
|
|
5
|
-
/** Props for the AuthLayoutWrapper component that assembles the auth page shell. */
|
|
6
|
-
export interface AuthLayoutWrapperProps {
|
|
7
|
-
/** Main content (typically the form body) rendered inside the layout. */
|
|
8
|
-
children: ReactNode;
|
|
9
|
-
/** Layout mode controlling the outer chrome. @default `'withSlider'` */
|
|
10
|
-
layoutType?: AuthLayoutType;
|
|
11
|
-
/** Logo or back-button element rendered at the top of the content area. */
|
|
12
|
-
logo?: ReactNode;
|
|
13
|
-
/** Heading element or string rendered below the logo. */
|
|
14
|
-
title?: ReactNode;
|
|
15
|
-
/** Descriptive text or element rendered below the title. */
|
|
16
|
-
description?: ReactNode;
|
|
17
|
-
/** Footer element rendered at the bottom of the content area. */
|
|
18
|
-
footer?: ReactNode;
|
|
19
|
-
/** Header element rendered above the main content area. */
|
|
20
|
-
header?: ReactNode;
|
|
21
|
-
/** Called when the back button is clicked. Pass `null` to hide the back button explicitly. */
|
|
22
|
-
onBack?: (() => void) | null;
|
|
23
|
-
/** Custom back button element. When provided, overrides the default back arrow button. */
|
|
24
|
-
backButton?: ReactNode;
|
|
25
|
-
/** Image URLs for the slider panel (only used when `layoutType` is `'withSlider'`). */
|
|
26
|
-
sliderImages?: string[];
|
|
27
|
-
/** Auto-play interval in milliseconds for the slider. */
|
|
28
|
-
sliderAutoPlayInterval?: number;
|
|
29
|
-
/** Titles displayed alongside each slider image. */
|
|
30
|
-
sliderTitles?: (ReactNode | string)[];
|
|
31
|
-
/** Layout variant controlling responsive behavior (e.g. `'desktop'`, `'mobile'`). */
|
|
32
|
-
variant?: AuthLayoutVariant;
|
|
33
|
-
/** Maximum width constraint for the content area (e.g. `'sm'`, `'md'`, `'lg'`). @default `'sm'` */
|
|
34
|
-
maxWidth?: AuthLayoutMaxWidth;
|
|
35
|
-
/** Content width preset: `'sm'` for narrow forms, `'default'` for standard width. @default `'default'` */
|
|
36
|
-
contentWidth?: 'sm' | 'default';
|
|
37
|
-
/** Horizontal alignment of logo, title, and description. @default `'center'` */
|
|
38
|
-
align?: AuthLayoutAlign;
|
|
39
|
-
/** Additional CSS class name(s) applied to the outermost layout element. */
|
|
40
|
-
className?: string;
|
|
41
|
-
}
|
|
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,89 +0,0 @@
|
|
|
1
|
-
import { AuthLayoutBodyProps, AuthLayoutDescriptionProps, AuthLayoutFooterProps, AuthLayoutHeaderProps, AuthLayoutLogoProps, AuthLayoutMainProps, AuthLayoutRootProps, AuthLayoutTitleProps } from '../../types/auth-layout-types';
|
|
2
|
-
/**
|
|
3
|
-
* Root container component for auth layouts.
|
|
4
|
-
* Provides layout context to child slot components.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```tsx
|
|
8
|
-
* <AuthLayout.Root variant="desktop" maxWidth="md">
|
|
9
|
-
* <AuthLayout.Header>...</AuthLayout.Header>
|
|
10
|
-
* <AuthLayout.Logo>...</AuthLayout.Logo>
|
|
11
|
-
* <AuthLayout.Title>...</AuthLayout.Title>
|
|
12
|
-
* <AuthLayout.Description>...</AuthLayout.Description>
|
|
13
|
-
* <AuthLayout.Body>...</AuthLayout.Body>
|
|
14
|
-
* <AuthLayout.Footer>...</AuthLayout.Footer>
|
|
15
|
-
* </AuthLayout.Root>
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
declare function AuthLayoutRoot({ children, variant, maxWidth, className, contentClassName, }: Readonly<AuthLayoutRootProps>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
/**
|
|
20
|
-
* Header slot component - renders differently based on layout variant.
|
|
21
|
-
* In desktop variant, renders top-right. In mobile variant, renders above logo.
|
|
22
|
-
*/
|
|
23
|
-
declare function AuthLayoutHeader({ children, className, }: Readonly<AuthLayoutHeaderProps>): import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
/**
|
|
25
|
-
* Logo slot component - alignment configurable via align prop
|
|
26
|
-
*/
|
|
27
|
-
declare function AuthLayoutLogo({ children, align, className, }: Readonly<AuthLayoutLogoProps>): import("react/jsx-runtime").JSX.Element;
|
|
28
|
-
/**
|
|
29
|
-
* Title slot component - alignment configurable via align prop
|
|
30
|
-
*/
|
|
31
|
-
declare function AuthLayoutTitle({ children, align, className, }: Readonly<AuthLayoutTitleProps>): import("react/jsx-runtime").JSX.Element;
|
|
32
|
-
/**
|
|
33
|
-
* Description slot component - alignment configurable via align prop
|
|
34
|
-
*/
|
|
35
|
-
declare function AuthLayoutDescription({ children, align, className, }: Readonly<AuthLayoutDescriptionProps>): import("react/jsx-runtime").JSX.Element;
|
|
36
|
-
/**
|
|
37
|
-
* Body slot component - main content area with vertical spacing
|
|
38
|
-
*/
|
|
39
|
-
declare function AuthLayoutBody({ children, className, }: Readonly<AuthLayoutBodyProps>): import("react/jsx-runtime").JSX.Element;
|
|
40
|
-
/**
|
|
41
|
-
* Main content wrapper - centers and constrains width of inner slots
|
|
42
|
-
*/
|
|
43
|
-
declare function AuthLayoutMain({ children, sm, className, }: Readonly<AuthLayoutMainProps>): import("react/jsx-runtime").JSX.Element;
|
|
44
|
-
/**
|
|
45
|
-
* Footer slot component - centered with consistent spacing
|
|
46
|
-
*/
|
|
47
|
-
declare function AuthLayoutFooter({ children, className, }: Readonly<AuthLayoutFooterProps>): import("react/jsx-runtime").JSX.Element;
|
|
48
|
-
/**
|
|
49
|
-
* Compound component for authentication layouts.
|
|
50
|
-
* Uses composition pattern for maximum flexibility and scalability.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```tsx
|
|
54
|
-
* <AuthLayout.Root variant="desktop" maxWidth="md">
|
|
55
|
-
* <AuthLayout.Header>
|
|
56
|
-
* <EnterpriseHeader />
|
|
57
|
-
* </AuthLayout.Header>
|
|
58
|
-
* <AuthLayout.Main>
|
|
59
|
-
* <AuthLayout.Logo>
|
|
60
|
-
* <img src="/logo.svg" alt="Docthub" />
|
|
61
|
-
* </AuthLayout.Logo>
|
|
62
|
-
* <AuthLayout.Title>
|
|
63
|
-
* <h1>The Healthcare Career App</h1>
|
|
64
|
-
* </AuthLayout.Title>
|
|
65
|
-
* <AuthLayout.Description>
|
|
66
|
-
* <p>Continue to Signup</p>
|
|
67
|
-
* </AuthLayout.Description>
|
|
68
|
-
* <AuthLayout.Body>
|
|
69
|
-
* <button>Continue with Mobile</button>
|
|
70
|
-
* <button>Continue with Email</button>
|
|
71
|
-
* </AuthLayout.Body>
|
|
72
|
-
* </AuthLayout.Main>
|
|
73
|
-
* <AuthLayout.Footer>
|
|
74
|
-
* <p>Terms and Privacy</p>
|
|
75
|
-
* </AuthLayout.Footer>
|
|
76
|
-
* </AuthLayout.Root>
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
|
79
|
-
export declare const AuthLayout: {
|
|
80
|
-
Root: typeof AuthLayoutRoot;
|
|
81
|
-
Header: typeof AuthLayoutHeader;
|
|
82
|
-
Main: typeof AuthLayoutMain;
|
|
83
|
-
Logo: typeof AuthLayoutLogo;
|
|
84
|
-
Title: typeof AuthLayoutTitle;
|
|
85
|
-
Description: typeof AuthLayoutDescription;
|
|
86
|
-
Body: typeof AuthLayoutBody;
|
|
87
|
-
Footer: typeof AuthLayoutFooter;
|
|
88
|
-
};
|
|
89
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ImageSliderProps } from '../../types';
|
|
2
|
-
export type { ImageSliderProps } from '../../types';
|
|
3
|
-
/**
|
|
4
|
-
* Image slider component with indicator dots.
|
|
5
|
-
* Supports both controlled and uncontrolled modes.
|
|
6
|
-
*
|
|
7
|
-
* @example Uncontrolled mode (manages its own state)
|
|
8
|
-
* ```tsx
|
|
9
|
-
* <ImageSlider
|
|
10
|
-
* images={['/image1.jpg', '/image2.jpg']}
|
|
11
|
-
* autoPlayInterval={3000}
|
|
12
|
-
* onSlideChange={(index) => console.log('Slide changed to', index)}
|
|
13
|
-
* />
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* @example Controlled mode (parent manages state)
|
|
17
|
-
* ```tsx
|
|
18
|
-
* const [activeIndex, setActiveIndex] = useState(0);
|
|
19
|
-
*
|
|
20
|
-
* <ImageSlider
|
|
21
|
-
* images={['/image1.jpg', '/image2.jpg']}
|
|
22
|
-
* activeIndex={activeIndex}
|
|
23
|
-
* onSlideChange={setActiveIndex}
|
|
24
|
-
* onNavigate={setActiveIndex}
|
|
25
|
-
* />
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare function ImageSlider({ images, autoPlayInterval, className, hideIndicators, onSlideChange, activeIndex: controlledIndex, onNavigate, }: Readonly<ImageSliderProps>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type { AuthLayoutAlign, AuthLayoutBodyProps, AuthLayoutDescriptionProps, AuthLayoutFooterProps, AuthLayoutHeaderProps, AuthLayoutLogoProps, AuthLayoutMainProps, AuthLayoutMaxWidth, AuthLayoutRootProps, AuthLayoutTitleProps, AuthLayoutVariant, } from '../../types/auth-layout-types';
|
|
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';
|
|
5
|
-
export type { ImageSliderProps } from './image-slider';
|
|
6
|
-
export { ImageSlider } from './image-slider';
|
|
7
|
-
export type { MainLayoutProps } from './main-layout';
|
|
8
|
-
export { MainLayout } from './main-layout';
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { MainLayoutProps, MarketingPanelProps } from '../../types';
|
|
2
|
-
export type { MainLayoutProps, MarketingPanelProps } from '../../types';
|
|
3
|
-
/**
|
|
4
|
-
* Marketing panel component - displays CTA, image slider, and indicators
|
|
5
|
-
*/
|
|
6
|
-
declare function MarketingPanel({ sliderImages, sliderAutoPlayInterval, activeSlideIndex, onSlideChange, ctaText, sliderTitles, className, }: Readonly<MarketingPanelProps>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
/**
|
|
8
|
-
* Main layout component - two-panel layout for authentication pages.
|
|
9
|
-
* Left panel displays marketing content, right panel displays auth content.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```tsx
|
|
13
|
-
* <MainLayout
|
|
14
|
-
* sliderImages={['/image1.jpg', '/image2.jpg']}
|
|
15
|
-
* ctaText="Get Healthcare Career App Now!"
|
|
16
|
-
* >
|
|
17
|
-
* <AuthLayout.Root variant="desktop" maxWidth="md">
|
|
18
|
-
* <AuthLayout.Header>...</AuthLayout.Header>
|
|
19
|
-
* <AuthLayout.Main>
|
|
20
|
-
* <AuthLayout.Logo>...</AuthLayout.Logo>
|
|
21
|
-
* <AuthLayout.Title>...</AuthLayout.Title>
|
|
22
|
-
* <AuthLayout.Body>...</AuthLayout.Body>
|
|
23
|
-
* </AuthLayout.Main>
|
|
24
|
-
* <AuthLayout.Footer>...</AuthLayout.Footer>
|
|
25
|
-
* </AuthLayout.Root>
|
|
26
|
-
* </MainLayout>
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export declare function MainLayout({ sliderImages, sliderAutoPlayInterval, ctaText, sliderTitles, className, marketingClassName, contentClassName, children, }: Readonly<MainLayoutProps>): import("react/jsx-runtime").JSX.Element;
|
|
30
|
-
export { MarketingPanel };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Demo data for MainLayout marketing slider.
|
|
3
|
-
* Used in Storybook and anywhere a consistent demo slider is needed.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Marketing slider images exported from Figma.
|
|
7
|
-
* These are static PNG images saved in /public/slider/.
|
|
8
|
-
*
|
|
9
|
-
* To update: Export frames from Figma (nodes 2179:2215, 2179:2226, 2179:2236, 2179:2246, 2179:2256)
|
|
10
|
-
* and save as slide-1.png through slide-5.png in the public/slider/ directory.
|
|
11
|
-
*/
|
|
12
|
-
export declare const DEMO_SLIDER_IMAGES: string[];
|
|
13
|
-
/** Default auto-play interval (ms) for the demo slider. */
|
|
14
|
-
export declare const DEMO_SLIDER_AUTO_PLAY_INTERVAL = 5000;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { LayoutPresetConfig, LayoutPresetName } from '../types/layout-presets';
|
|
2
|
-
/**
|
|
3
|
-
* Returns layout structure config for a preset name.
|
|
4
|
-
* Empty string returns undefined (caller uses full composition / no preset).
|
|
5
|
-
*/
|
|
6
|
-
export declare function getLayoutPresetConfig(preset: LayoutPresetName): LayoutPresetConfig | undefined;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AuthFlowContextValue } from '../types';
|
|
2
|
-
export type { AuthFlowActions, AuthFlowContextValue, AuthFlowProviderConfig, } from '../types';
|
|
3
|
-
export declare const AuthFlowContext: import('react').Context<AuthFlowContextValue | null>;
|
|
4
|
-
/**
|
|
5
|
-
* Hook to access auth flow state and actions. Must be used within SSOAuthProvider.
|
|
6
|
-
*/
|
|
7
|
-
export declare function useAuthFlow(): AuthFlowContextValue;
|
|
8
|
-
/**
|
|
9
|
-
* Hook to access SSO session state only. Must be used within SSOAuthProvider.
|
|
10
|
-
*/
|
|
11
|
-
export declare function useAuthSession(): {
|
|
12
|
-
session: import('../types').SSOSession | null;
|
|
13
|
-
isAuthenticated: boolean;
|
|
14
|
-
isLoading: boolean;
|
|
15
|
-
signOut: () => void;
|
|
16
|
-
authMethod: import('../types').AuthMethod | null;
|
|
17
|
-
};
|
package/dist/core/auth-flow.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { SSOAuthProviderProps } from '../types';
|
|
2
|
-
export type { SSOAuthConfig, SSOAuthProviderProps } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* SSO Auth provider: runs session check on mount, holds flow state, and provides async actions.
|
|
5
|
-
*/
|
|
6
|
-
export declare function SSOAuthProvider({ config, children }: SSOAuthProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Re-export of auth domain types from central types folder.
|
|
3
|
-
* Prefer importing from @/types; this file keeps @/core/auth-types working.
|
|
4
|
-
*/
|
|
5
|
-
export type { AuthError, AuthErrorCode, AuthenticateWithProviderParams, AuthMethod, AuthStep, CompleteProfileParams, RepeatLoginInfo, SendOtpResponse, SSOSession, SSOUser, UserType, VerifyOtpResponse, } from '../types';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { StoredRepeatLogin } from '../types';
|
|
2
|
-
export type { StoredRepeatLogin } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* Reads repeat-login info from localStorage if present.
|
|
5
|
-
* Safe to call in browser; returns null in SSR or when not found.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getRepeatLoginInfo(): StoredRepeatLogin | null;
|
|
8
|
-
/**
|
|
9
|
-
* Saves repeat-login info to localStorage after successful auth.
|
|
10
|
-
*/
|
|
11
|
-
export declare function setRepeatLoginInfo(info: StoredRepeatLogin): void;
|
|
12
|
-
/**
|
|
13
|
-
* Clears repeat-login info (e.g. on sign out).
|
|
14
|
-
*/
|
|
15
|
-
export declare function clearRepeatLoginInfo(): void;
|
package/dist/core/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SSO Auth SDK core: types, adapter, provider, flow, session, device detection.
|
|
3
|
-
*/
|
|
4
|
-
export * from './auth-api-adapter';
|
|
5
|
-
export * from './auth-context';
|
|
6
|
-
export * from './auth-flow';
|
|
7
|
-
export * from './auth-provider';
|
|
8
|
-
export * from './auth-types';
|
|
9
|
-
export * from './device-detection';
|
|
10
|
-
export * from './sso-session';
|
|
11
|
-
export * from './use-auth-flow';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { AxiosAuthInterceptorInstance, TokenStorageStrategy } from '../types';
|
|
2
|
-
export type { AxiosAuthInterceptorInstance, AxiosRequestConfig, TokenStorageStrategy, } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* Token storage using localStorage (single-origin).
|
|
5
|
-
* Suitable for dev or when all Docthub apps share the same origin.
|
|
6
|
-
*/
|
|
7
|
-
export declare function localStorageTokenStorage(): TokenStorageStrategy;
|
|
8
|
-
/**
|
|
9
|
-
* Token storage when the token lives in a server-set cookie (e.g. HttpOnly).
|
|
10
|
-
* The client never reads or writes the token; the server sets the cookie on
|
|
11
|
-
* login and reads it from the request. Use with validateSessionFromCookie
|
|
12
|
-
* in your adapter and createAxiosAuthInterceptors (withCredentials) so the
|
|
13
|
-
* cookie is sent on every request.
|
|
14
|
-
*/
|
|
15
|
-
export declare function serverCookieTokenStorage(): TokenStorageStrategy;
|
|
16
|
-
/**
|
|
17
|
-
* Attaches request and response interceptors to an axios instance for SSO auth
|
|
18
|
-
* when using server-side cookies (e.g. serverCookieTokenStorage):
|
|
19
|
-
* - Request: sets withCredentials so the browser sends cookies on every request.
|
|
20
|
-
* - Response: on 401, calls onUnauthorized (e.g. redirect to login).
|
|
21
|
-
*
|
|
22
|
-
* @param axiosInstance - Your axios instance (e.g. axios.create({ baseURL: '...' }))
|
|
23
|
-
* @param onUnauthorized - Optional callback when a response has status 401
|
|
24
|
-
*/
|
|
25
|
-
export declare function createAxiosAuthInterceptors(axiosInstance: AxiosAuthInterceptorInstance, onUnauthorized?: () => void): void;
|
|
26
|
-
/**
|
|
27
|
-
* useAuthSession hook is implemented in auth-context (uses AuthFlowContext).
|
|
28
|
-
* Re-exported from core index for consumer convenience.
|
|
29
|
-
*/
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { AuthFlowAction, AuthFlowState, AuthStep } from '../types';
|
|
2
|
-
export type { AuthFlowAction, AuthFlowState, IdentifierType } from '../types';
|
|
3
|
-
export declare const INITIAL_STEP: AuthStep;
|
|
4
|
-
export declare function getInitialAuthFlowState(): AuthFlowState;
|
|
5
|
-
export declare function authFlowReducer(state: AuthFlowState, action: AuthFlowAction): AuthFlowState;
|
package/dist/hooks/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { type EmailFormValues, type LoginEntryFormValues, type LoginEntryMode, type PhoneFormValues, type UseLoginEntryFormOptions, type UseLoginEntryFormReturn, useLoginEntryForm, } from './use-login-entry-form';
|
|
2
|
-
export { type MainAuthPageHandlers, type MainLoginAppleProviderConfig, type MainLoginGoogleProviderConfig, type MainLoginPageProvidersConfig, type UseMainAuthPageHandlersOptions, useMainAuthPageHandlers, } from './use-main-auth-page-handlers';
|
|
3
|
-
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';
|
|
4
|
-
export { type UseRepeatLoginOptions, type UseRepeatLoginReturn, useRepeatLogin, } from './use-repeat-login';
|
|
5
|
-
export { type SignupEmailFormValues, type SignupEntryMode, type SignupFormValues, type SignupPhoneFormValues, type UseSignupFormOptions, type UseSignupFormReturn, useSignupForm, } from './use-signup-form';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { UseLoginEntryFormOptions, UseLoginEntryFormReturn } from '../types';
|
|
2
|
-
export type { EmailFormValues, LoginEntryFormValues, LoginEntryMode, LoginEntrySubmitData, LoginEntrySuccessParams, PhoneFormValues, UseLoginEntryFormOptions, UseLoginEntryFormReturn, } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* Form state and validation for the login entry screen (phone or email).
|
|
5
|
-
* Business logic: when submitApi is provided, hook runs validate → submitApi(data) → onSuccess() (e.g. redirect).
|
|
6
|
-
* Use with LoginEntry component or build a custom UI with the returned methods.
|
|
7
|
-
*/
|
|
8
|
-
export declare function useLoginEntryForm({ mode, onSubmit, submitApi, onSuccess, onError, }: UseLoginEntryFormOptions): UseLoginEntryFormReturn;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { MainAuthPageHandlers, UseMainAuthPageHandlersOptions } from '../types';
|
|
2
|
-
export type { MainAuthPageHandlers, MainLoginAppleProviderConfig, MainLoginGoogleProviderConfig, MainLoginPageProvidersConfig, UseMainAuthPageHandlersOptions, } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* Main auth page business logic: resolves CTA handlers from optional overrides and optional provider config.
|
|
5
|
-
* When providers.google / providers.apple are set, the lib runs Google/Apple OAuth and calls onCredential;
|
|
6
|
-
* otherwise uses overrides or no-op defaults.
|
|
7
|
-
*/
|
|
8
|
-
export declare function useMainAuthPageHandlers(options?: Readonly<UseMainAuthPageHandlersOptions>): MainAuthPageHandlers;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { OtpVerificationMode, UseOtpVerificationOptions, UseOtpVerificationReturn } from '../types';
|
|
2
|
-
export type { OtpFormValues, OtpVerificationMode, UseOtpVerificationOptions, UseOtpVerificationReturn, } from '../types';
|
|
3
|
-
/** Instruction line below recipient (Figma: "Kindly check your Email Inbox."). */
|
|
4
|
-
export declare const DEFAULT_OTP_INSTRUCTIONS: Record<OtpVerificationMode, string>;
|
|
5
|
-
export declare const DEFAULT_OTP_TITLES: Record<OtpVerificationMode, string>;
|
|
6
|
-
/** Re-export for consumers who import from hooks. */
|
|
7
|
-
export { getResendCooldownSeconds, OTP_LENGTH, RESEND_COOLDOWN_EMAIL_SECONDS, RESEND_COOLDOWN_PHONE_SECONDS, } from '../validations';
|
|
8
|
-
/**
|
|
9
|
-
* Form state, resend countdown, and validation for OTP verification.
|
|
10
|
-
* When submitApi is provided, hook runs: validate → submitApi(otp) → onSuccess() (e.g. redirect).
|
|
11
|
-
*/
|
|
12
|
-
export declare function useOtpVerification({ mode, onSubmit, onResendCode, submitApi, onSuccess, onError, }: UseOtpVerificationOptions): UseOtpVerificationReturn;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { UseRepeatLoginOptions, UseRepeatLoginReturn } from '../types';
|
|
2
|
-
export type { UseRepeatLoginOptions, UseRepeatLoginReturn } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* Business logic for repeat login: continue with last method (sync or async via continueApi).
|
|
5
|
-
* When continueApi is provided, runs: continueApi() → onSuccess(); otherwise calls onContinueWithLastMethod.
|
|
6
|
-
*/
|
|
7
|
-
export declare function useRepeatLogin(options?: UseRepeatLoginOptions): UseRepeatLoginReturn;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { UseSignupFormOptions, UseSignupFormReturn } from '../types';
|
|
2
|
-
export type { SignupEmailFormValues, SignupEntryMode, SignupForeignFormValues, SignupFormValues, SignupPhoneFormValues, SignupSubmitData, UseSignupFormOptions, UseSignupFormReturn, } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* Form state and validation for the signup screen (full name + phone or email, or foreign: all three).
|
|
5
|
-
* When submitApi is provided, hook runs: validate → submitApi(data) → onSuccess() (e.g. redirect).
|
|
6
|
-
*/
|
|
7
|
-
export declare function useSignupForm({ mode, defaultPhone, onSubmit, submitApi, onSuccess, onError, }: UseSignupFormOptions): UseSignupFormReturn;
|