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