doct-ui-auth-kit 1.0.21 → 1.0.23

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.
@@ -30,12 +30,12 @@ interface LinkOrMergeBaseParams {
30
30
  }
31
31
  export type LinkOrMergeAccountParams = (LinkOrMergeBaseParams & {
32
32
  conflictField: 'email';
33
- oldEmail?: string;
33
+ oldEmail: string;
34
34
  newEmail: string;
35
35
  }) | (LinkOrMergeBaseParams & {
36
36
  conflictField: 'phone';
37
- oldCountryCode?: string;
38
- oldPhone?: string;
37
+ oldCountryCode: string;
38
+ oldPhone: string;
39
39
  newCountryCode: string;
40
40
  newPhone: string;
41
41
  });
@@ -5,19 +5,48 @@ import type { AuthStep, SSOSession, UserType } from './auth-types';
5
5
  /** Identifier type for OTP / profile steps. */
6
6
  export type IdentifierType = 'phone' | 'email';
7
7
  export type LinkOrMergeConflictField = IdentifierType;
8
+ export type LinkOrMergeStage = 'summary' | 'verification';
8
9
  export type LinkOrMergeState = {
10
+ stage: LinkOrMergeStage;
9
11
  conflictField: 'email';
10
12
  name: string;
13
+ existingEmail?: string;
14
+ existingCountryCode?: string;
15
+ existingPhone?: string;
11
16
  oldEmail?: string;
12
17
  newEmail: string;
13
18
  } | {
19
+ stage: LinkOrMergeStage;
14
20
  conflictField: 'phone';
15
21
  name: string;
22
+ existingEmail?: string;
23
+ existingCountryCode?: string;
24
+ existingPhone?: string;
16
25
  oldCountryCode?: string;
17
26
  oldPhone?: string;
18
27
  newCountryCode: string;
19
28
  newPhone: string;
20
29
  };
30
+ export type LinkOrMergeVerificationInput = {
31
+ conflictField: 'email';
32
+ oldEmail: string;
33
+ newEmail: string;
34
+ } | {
35
+ conflictField: 'phone';
36
+ oldCountryCode: string;
37
+ oldPhone: string;
38
+ newCountryCode: string;
39
+ newPhone: string;
40
+ };
41
+ export type LinkOrMergeSetupPayload = (Omit<Extract<LinkOrMergeState, {
42
+ conflictField: 'email';
43
+ }>, 'stage'> & {
44
+ stage?: LinkOrMergeStage;
45
+ }) | (Omit<Extract<LinkOrMergeState, {
46
+ conflictField: 'phone';
47
+ }>, 'stage'> & {
48
+ stage?: LinkOrMergeStage;
49
+ });
21
50
  /** Full state for the auth flow. */
22
51
  export interface AuthFlowState {
23
52
  step: AuthStep;
@@ -82,7 +111,9 @@ export type AuthFlowAction = {
82
111
  maskedRecipient?: string;
83
112
  } | ({
84
113
  type: 'SET_STEP_LINK_OR_MERGE';
85
- } & LinkOrMergeState) | {
114
+ } & LinkOrMergeSetupPayload) | {
115
+ type: 'SET_LINK_OR_MERGE_VERIFICATION_STAGE';
116
+ } | {
86
117
  type: 'SET_STEP_PROVIDER_PENDING';
87
118
  } | {
88
119
  type: 'SET_STEP_AUTHENTICATED';
@@ -144,7 +175,8 @@ export interface AuthFlowActions {
144
175
  provider: 'google' | 'apple';
145
176
  credential: string;
146
177
  }) => void;
147
- verifyLinkOrMerge: () => Promise<void>;
178
+ continueLinkOrMerge: () => void;
179
+ verifyLinkOrMerge: (data: LinkOrMergeVerificationInput) => Promise<void>;
148
180
  goBack: () => void;
149
181
  reset: () => void;
150
182
  signOut: () => void;
@@ -2,7 +2,7 @@
2
2
  * Props and public types for auth page components.
3
3
  */
4
4
  import type { UserType } from '../auth/auth-types';
5
- import type { IdentifierType, LinkOrMergeState } from '../auth/flow';
5
+ import type { IdentifierType, LinkOrMergeState, LinkOrMergeVerificationInput } from '../auth/flow';
6
6
  import type { LoginEntryMode } from './login-form';
7
7
  import type { UseMainAuthPageHandlersOptions } from './main-login';
8
8
  import type { OtpValidateFn, OtpVerificationMode } from './otp-verification';
@@ -88,7 +88,8 @@ export interface SignupPageFullProps extends SignupPageProps {
88
88
  export interface LinkOrMergePageProps {
89
89
  details: LinkOrMergeState;
90
90
  onBack?: (() => void) | undefined;
91
- onVerify: () => Promise<void>;
91
+ onContinue: () => void;
92
+ onVerify: (data: LinkOrMergeVerificationInput) => Promise<void>;
92
93
  }
93
94
  /** Props for OtpVerification (inner form without layout). */
94
95
  export interface OtpVerificationProps {
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "doct-ui-auth-kit",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
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
7
  "module": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
- "files": ["dist", "README.md"],
9
+ "files": [
10
+ "dist",
11
+ "README.md"
12
+ ],
10
13
  "keywords": [
11
14
  "react",
12
15
  "auth",