@@ -119,6 +119,7 @@ const createSignInFixtureHelpers = (baseClient: ClientJSON) => {
119119 type SignInFactorTwoParams = {
120120 identifier ?: string ;
121121 supportPhoneCode ?: boolean ;
122+ supportEmailCode ?: boolean ;
122123 supportTotp ?: boolean ;
123124 supportBackupCode ?: boolean ;
124125 supportResetPasswordEmail ?: boolean ;
@@ -185,17 +186,21 @@ const createSignInFixtureHelpers = (baseClient: ClientJSON) => {
185186 } as SignInJSON ;
186187 } ;
187188
188- const startSignInFactorTwo = ( params ?: SignInFactorTwoParams ) => {
189+ const startSignInVerification = (
190+ status : Extract < SignInJSON [ 'status' ] , 'needs_client_trust' | 'needs_second_factor' > ,
191+ params ?: SignInFactorTwoParams ,
192+ ) => {
189193 const {
190194 identifier = '+30 691 1111111' ,
191195 supportPhoneCode = true ,
196+ supportEmailCode,
192197 supportTotp,
193198 supportBackupCode,
194199 supportResetPasswordEmail,
195200 supportResetPasswordPhone,
196201 } = params || { } ;
197202 baseClient . sign_in = {
198- status : 'needs_second_factor' ,
203+ status,
199204 identifier,
200205 ...( supportResetPasswordEmail
201206 ? {
@@ -216,13 +221,20 @@ const createSignInFixtureHelpers = (baseClient: ClientJSON) => {
216221 supported_identifiers : [ 'email_address' , 'phone_number' ] ,
217222 supported_second_factors : [
218223 ...( supportPhoneCode ? [ { strategy : 'phone_code' , safe_identifier : identifier || 'n*****@clerk.com' } ] : [ ] ) ,
224+ ...( supportEmailCode ? [ { strategy : 'email_code' , safe_identifier : 'n*****@clerk.com' } ] : [ ] ) ,
219225 ...( supportTotp ? [ { strategy : 'totp' , safe_identifier : identifier || 'n*****@clerk.com' } ] : [ ] ) ,
220226 ...( supportBackupCode ? [ { strategy : 'backup_code' , safe_identifier : identifier || 'n*****@clerk.com' } ] : [ ] ) ,
221227 ] ,
222228 user_data : { ...( createUserFixture ( ) as any ) } ,
223229 } as SignInJSON ;
224230 } ;
225231
232+ const startSignInFactorTwo = ( params ?: SignInFactorTwoParams ) =>
233+ startSignInVerification ( 'needs_second_factor' , params ) ;
234+
235+ const startSignInClientTrust = ( params ?: SignInFactorTwoParams ) =>
236+ startSignInVerification ( 'needs_client_trust' , params ) ;
237+
226238 const startSignInWithProtectCheck = ( params ?: {
227239 expiresAt ?: number ;
228240 uiHints ?: Record < string , string > ;
@@ -249,7 +261,13 @@ const createSignInFixtureHelpers = (baseClient: ClientJSON) => {
249261 } as SignInJSON ;
250262 } ;
251263
252- return { startSignInWithEmailAddress, startSignInWithPhoneNumber, startSignInFactorTwo, startSignInWithProtectCheck } ;
264+ return {
265+ startSignInWithEmailAddress,
266+ startSignInWithPhoneNumber,
267+ startSignInFactorTwo,
268+ startSignInClientTrust,
269+ startSignInWithProtectCheck,
270+ } ;
253271} ;
254272
255273const createSignUpFixtureHelpers = ( baseClient : ClientJSON ) => {
0 commit comments