Skip to content

Commit a940c39

Browse files
authored
fix(shared): PrepareSecondFactorParams email code params (#7175)
1 parent 296fb0b commit a940c39

File tree

4 files changed

+191
-10
lines changed

4 files changed

+191
-10
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/shared': patch
3+
---
4+
5+
Add email codes as an option to `PrepareSecondFactorParams`

packages/shared/src/types/factors.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ export type PhoneCodeSecondFactorConfig = {
139139
phoneNumberId?: string;
140140
};
141141

142+
export type EmailCodeSecondFactorConfig = {
143+
strategy: EmailCodeStrategy;
144+
emailAddressId?: string;
145+
};
146+
142147
export type EmailCodeAttempt = {
143148
strategy: EmailCodeStrategy;
144149
code: string;

packages/shared/src/types/signInCommon.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type {
44
EmailCodeAttempt,
55
EmailCodeConfig,
66
EmailCodeFactor,
7+
EmailCodeSecondFactorConfig,
78
EmailLinkConfig,
89
EmailLinkFactor,
910
EnterpriseSSOConfig,
@@ -117,7 +118,7 @@ export type AttemptFirstFactorParams =
117118
| ResetPasswordPhoneCodeAttempt
118119
| ResetPasswordEmailCodeAttempt;
119120

120-
export type PrepareSecondFactorParams = PhoneCodeSecondFactorConfig;
121+
export type PrepareSecondFactorParams = PhoneCodeSecondFactorConfig | EmailCodeSecondFactorConfig;
121122

122123
export type AttemptSecondFactorParams = PhoneCodeAttempt | TOTPAttempt | BackupCodeAttempt | EmailCodeAttempt;
123124

0 commit comments

Comments
 (0)