doct-ui-auth-kit 1.0.1 → 1.0.3

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 (44) hide show
  1. package/dist/adapters/http-auth-adapter.d.ts +2 -1
  2. package/dist/auth/index.d.ts +23 -0
  3. package/dist/auth-methods/google.d.ts +3 -63
  4. package/dist/auth-methods/index.d.ts +1 -2
  5. package/dist/auth-methods/use-google-auth.d.ts +69 -0
  6. package/dist/components/layout/auth-layout-preset.d.ts +25 -0
  7. package/dist/components/layout/auth-layout-public.d.ts +17 -0
  8. package/dist/components/layout/auth-layout-wrapper.d.ts +23 -0
  9. package/dist/components/layout/index.d.ts +5 -3
  10. package/dist/constants/demo-slider.d.ts +0 -2
  11. package/dist/constants/index.d.ts +2 -1
  12. package/dist/constants/layout-presets.d.ts +10 -0
  13. package/dist/core/auth-api-adapter.d.ts +6 -0
  14. package/dist/core/auth-context.d.ts +4 -8
  15. package/dist/core/auth-flow.d.ts +2 -2
  16. package/dist/core/auth-types.d.ts +3 -1
  17. package/dist/core/sso-session.d.ts +37 -11
  18. package/dist/core/use-auth-flow.d.ts +22 -19
  19. package/dist/hooks/index.d.ts +1 -1
  20. package/dist/hooks/use-otp-verification.d.ts +9 -2
  21. package/dist/hooks/use-signup-form.d.ts +18 -8
  22. package/dist/index.d.ts +2 -1
  23. package/dist/index.js +3438 -3091
  24. package/dist/main-logo.svg +3 -0
  25. package/dist/pages/index.d.ts +0 -2
  26. package/dist/pages/main-login.d.ts +2 -6
  27. package/dist/pages/otp-verification.d.ts +3 -1
  28. package/dist/pages/signup.d.ts +14 -6
  29. package/dist/pages.js +6 -8
  30. package/dist/signup-x-Jm7XKn.js +668 -0
  31. package/dist/stories/components/default-footer.d.ts +5 -0
  32. package/dist/stories/components/enterprise-header.d.ts +5 -0
  33. package/dist/stories/components/index.d.ts +2 -0
  34. package/dist/types/forms.d.ts +3 -87
  35. package/dist/types/index.d.ts +5 -4
  36. package/dist/types/layout-presets.d.ts +29 -0
  37. package/package.json +1 -1
  38. package/dist/components/auth/repeat-login.d.ts +0 -24
  39. package/dist/components/form/rhf-password-field.d.ts +0 -2
  40. package/dist/pages/conflict.d.ts +0 -12
  41. package/dist/pages/foreign-email-collect.d.ts +0 -16
  42. package/dist/signup-CHqsrPuW.js +0 -797
  43. package/dist/types/common.d.ts +0 -25
  44. package/dist/types/user.d.ts +0 -31
@@ -1,5 +1,6 @@
1
1
  import type { KeyboardEvent } from 'react';
2
2
  import type { Control, FieldValues } from 'react-hook-form';
3
+ /** Base props shared by RHF form field components. */
3
4
  export interface BaseFormFieldProps {
4
5
  name: string;
5
6
  label?: string;
@@ -10,6 +11,7 @@ export interface BaseFormFieldProps {
10
11
  error?: string;
11
12
  helperText?: string;
12
13
  }
14
+ /** Props for the text/email/number input field component. */
13
15
  export interface RHFInputFieldProps extends BaseFormFieldProps {
14
16
  type?: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'search';
15
17
  autoComplete?: string;
@@ -20,32 +22,13 @@ export interface RHFInputFieldProps extends BaseFormFieldProps {
20
22
  onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
21
23
  numericOnly?: boolean;
22
24
  }
23
- export interface RHFPasswordFieldProps extends BaseFormFieldProps {
24
- showPassword?: boolean;
25
- togglePasswordVisibility?: () => void;
26
- control?: Control<FieldValues>;
27
- }
28
- export interface RHFTextareaFieldProps extends BaseFormFieldProps {
29
- rows?: number;
30
- maxLength?: number;
31
- minLength?: number;
32
- resize?: 'none' | 'vertical' | 'horizontal' | 'both';
33
- control?: Control<FieldValues>;
34
- }
35
- export interface RHFPhoneInputFieldProps extends BaseFormFieldProps {
36
- countryCode?: string;
37
- preferredCountries?: string[];
38
- enableSearch?: boolean;
39
- searchPlaceholder?: string;
40
- autoFormat?: boolean;
41
- control?: Control<FieldValues>;
42
- }
43
25
  /** Props for RHF wrapper around DoctPhoneInput (docthub-core-components). */
44
26
  export interface RHFDoctPhoneInputFieldProps extends BaseFormFieldProps {
45
27
  defaultCountry?: string;
46
28
  variant?: 'default' | 'flag';
47
29
  control?: Control<FieldValues>;
48
30
  }
31
+ /** Props for the OTP input field component. */
49
32
  export interface RHFOtpInputFieldProps extends BaseFormFieldProps {
50
33
  length?: number;
51
34
  type?: 'text' | 'number' | 'password';
@@ -55,70 +38,3 @@ export interface RHFOtpInputFieldProps extends BaseFormFieldProps {
55
38
  inputClassName?: string;
56
39
  control?: Control<FieldValues>;
57
40
  }
58
- export interface FormLayoutProps {
59
- children: React.ReactNode;
60
- className?: string;
61
- onSubmit?: (data: Record<string, unknown>) => void;
62
- onReset?: () => void;
63
- }
64
- export interface FormHeaderProps {
65
- title: string;
66
- subtitle?: string;
67
- onBack?: () => void;
68
- className?: string;
69
- }
70
- export interface FormFooterProps {
71
- children: React.ReactNode;
72
- className?: string;
73
- }
74
- export interface FormCardProps {
75
- children: React.ReactNode;
76
- className?: string;
77
- title?: string;
78
- subtitle?: string;
79
- headerActions?: React.ReactNode;
80
- footerActions?: React.ReactNode;
81
- }
82
- export interface ValidationRule {
83
- required?: boolean;
84
- minLength?: number;
85
- maxLength?: number;
86
- pattern?: RegExp;
87
- min?: number;
88
- max?: number;
89
- email?: boolean;
90
- url?: boolean;
91
- custom?: (value: unknown) => boolean | string;
92
- }
93
- export interface FormValidationSchema {
94
- [fieldName: string]: ValidationRule;
95
- }
96
- export interface FormState {
97
- isValid: boolean;
98
- isDirty: boolean;
99
- isSubmitting: boolean;
100
- errors: Record<string, string>;
101
- touched: Record<string, boolean>;
102
- values: Record<string, unknown>;
103
- }
104
- export interface FormSubmissionOptions {
105
- validateOnSubmit?: boolean;
106
- resetOnSuccess?: boolean;
107
- showSuccessMessage?: boolean;
108
- successMessage?: string;
109
- onSuccess?: (data: Record<string, unknown>) => void;
110
- onError?: (error: unknown) => void;
111
- }
112
- export interface UseFormReturn<T = Record<string, unknown>> {
113
- register: (name: keyof T) => object;
114
- handleSubmit: (onSubmit: (data: T) => void) => (e: React.FormEvent) => void;
115
- watch: (name?: keyof T) => unknown;
116
- setValue: (name: keyof T, value: T[keyof T]) => void;
117
- getValues: () => T;
118
- reset: (values?: T) => void;
119
- formState: FormState;
120
- errors: Record<keyof T, string>;
121
- isValid: boolean;
122
- isDirty: boolean;
123
- isSubmitting: boolean;
124
- }
@@ -1,6 +1,7 @@
1
1
  /**
2
- * Central export file for all types and interfaces
3
- * Import types from here: import type { User, ApiResponse } from '@/types';
2
+ * Central export file for all types and interfaces.
3
+ * Import types from here: import type { RHFInputFieldProps } from '@/types';
4
4
  */
5
- export * from './common';
6
- export * from './user';
5
+ export * from './auth-layout-types';
6
+ export * from './forms';
7
+ export * from './layout-presets';
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Layout preset types for the Auth SDK.
3
+ * Presets control structure only: width, alignment, slider vs standalone.
4
+ * They do NOT control auth methods, MFA, or flow behavior.
5
+ */
6
+ import type { AuthLayoutAlign, AuthLayoutMaxWidth, AuthLayoutVariant } from './auth-layout-types';
7
+ /** Layout type: two-panel with slider vs single centered column. */
8
+ export type LayoutType = 'withSlider' | 'standalone';
9
+ /**
10
+ * Named presets for auth screens. Kept minimal to avoid preset explosion.
11
+ * Add new presets only for distinct layout structures, not for auth methods.
12
+ */
13
+ export type LayoutPresetName = 'login' | 'signup' | 'verification' | '';
14
+ /**
15
+ * Structure-only config derived from a preset.
16
+ * Used by AuthLayout to render the correct shell (slider, width, alignment).
17
+ */
18
+ export interface LayoutPresetConfig {
19
+ /** Whether to show the two-panel slider (e.g. login) or standalone column. */
20
+ layoutType: LayoutType;
21
+ /** Mobile vs desktop spacing/breakpoints. */
22
+ variant: AuthLayoutVariant;
23
+ /** Max width of the content area. */
24
+ maxWidth: AuthLayoutMaxWidth;
25
+ /** Constrain main content to 320px when 'sm'. */
26
+ contentWidth: 'sm' | 'default';
27
+ /** Title/description alignment. */
28
+ align: AuthLayoutAlign;
29
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doct-ui-auth-kit",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
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",
@@ -1,24 +0,0 @@
1
- export interface RepeatLoginProps {
2
- /**
3
- * Last used authentication method shown in the description and 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
- }
14
- /**
15
- * Repeat login experience for returning users.
16
- *
17
- * Renders the central auth card used in the "USER LOGIN SCREEN - REPEAT"
18
- * Figma design, including title, description and two actions.
19
- *
20
- * This component is layout-aware and is intended to be used inside
21
- * an existing `AuthLayout.Root` so that it can adapt between
22
- * desktop and mobile variants.
23
- */
24
- export declare function RepeatLogin({ lastUsedMethod, onContinueWithLastMethod, onUseAnotherMethod, }: Readonly<RepeatLoginProps>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +0,0 @@
1
- import type { RHFPasswordFieldProps } from '@/types/forms';
2
- export declare function RHFPasswordField({ name, label, placeholder, className, control, required, showPassword: showPasswordProp, togglePasswordVisibility, }: RHFPasswordFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +0,0 @@
1
- import type { AuthError } from '@/core/auth-types';
2
- export interface ConflictPageProps {
3
- /** Conflict error with optional linked identifier (e.g. masked phone or email). */
4
- error: AuthError | null;
5
- /** Handler when user chooses to go back and edit input. */
6
- onGoBack?: () => void;
7
- }
8
- /**
9
- * Conflict error page: shown when identifier is already linked to another account.
10
- * Slot into AuthLayout.Body; layout shell is provided by the consumer.
11
- */
12
- export declare function ConflictPage({ error, onGoBack }: Readonly<ConflictPageProps>): import("react/jsx-runtime").JSX.Element;
@@ -1,16 +0,0 @@
1
- export interface ForeignEmailCollectPageProps {
2
- /** Masked phone (e.g. "+** ***1234") for display. */
3
- maskedPhone?: string;
4
- /** Handler when form is submitted with fullName and email. */
5
- onSubmit?: (data: {
6
- fullName: string;
7
- email: string;
8
- }) => void;
9
- /** Handler when back is clicked. */
10
- onBack?: () => void;
11
- }
12
- /**
13
- * Foreign (non-Indian) phone flow: collect full name and email; OTP will be sent to email.
14
- * Slot into AuthLayout.Body; layout shell is provided by the consumer.
15
- */
16
- export declare function ForeignEmailCollectPage({ maskedPhone, onSubmit, }: Readonly<ForeignEmailCollectPageProps>): import("react/jsx-runtime").JSX.Element;