@@ -16,7 +16,6 @@ import type {
1616 EmailCodeConfig ,
1717 EmailLinkConfig ,
1818 EnterpriseSSOConfig ,
19- OAuthStrategy ,
2019 PassKeyConfig ,
2120 PasskeyFactor ,
2221 PhoneCodeConfig ,
@@ -26,10 +25,16 @@ import type {
2625 ResetPasswordParams ,
2726 ResetPasswordPhoneCodeFactorConfig ,
2827 SamlConfig ,
29- SetActiveNavigate ,
3028 SignInCreateParams ,
3129 SignInFirstFactor ,
30+ SignInFutureCreateParams ,
31+ SignInFutureEmailCodeSendParams ,
32+ SignInFutureEmailCodeVerifyParams ,
33+ SignInFutureFinalizeParams ,
34+ SignInFuturePasswordParams ,
35+ SignInFutureResetPasswordSubmitParams ,
3236 SignInFutureResource ,
37+ SignInFutureSSOParams ,
3338 SignInIdentifier ,
3439 SignInJSON ,
3540 SignInJSONSnapshot ,
@@ -551,7 +556,8 @@ class SignInFuture implements SignInFutureResource {
551556 } ) ;
552557 }
553558
554- async verifyResetPasswordEmailCode ( { code } : { code : string } ) : Promise < { error : unknown } > {
559+ async verifyResetPasswordEmailCode ( params : SignInFutureEmailCodeVerifyParams ) : Promise < { error : unknown } > {
560+ const { code } = params ;
555561 return runAsyncResourceTask ( this . resource , async ( ) => {
556562 await this . resource . __internal_basePost ( {
557563 body : { code, strategy : 'reset_password_email_code' } ,
@@ -560,13 +566,8 @@ class SignInFuture implements SignInFutureResource {
560566 } ) ;
561567 }
562568
563- async submitResetPassword ( {
564- password,
565- signOutOfOtherSessions = true ,
566- } : {
567- password : string ;
568- signOutOfOtherSessions ?: boolean ;
569- } ) : Promise < { error : unknown } > {
569+ async submitResetPassword ( params : SignInFutureResetPasswordSubmitParams ) : Promise < { error : unknown } > {
570+ const { password, signOutOfOtherSessions = true } = params ;
570571 return runAsyncResourceTask ( this . resource , async ( ) => {
571572 await this . resource . __internal_basePost ( {
572573 body : { password, signOutOfOtherSessions } ,
@@ -575,13 +576,7 @@ class SignInFuture implements SignInFutureResource {
575576 } ) ;
576577 }
577578
578- async create ( params : {
579- identifier ?: string ;
580- strategy ?: OAuthStrategy | 'saml' | 'enterprise_sso' ;
581- redirectUrl ?: string ;
582- actionCompleteRedirectUrl ?: string ;
583- transfer ?: boolean ;
584- } ) : Promise < { error : unknown } > {
579+ async create ( params : SignInFutureCreateParams ) : Promise < { error : unknown } > {
585580 return runAsyncResourceTask ( this . resource , async ( ) => {
586581 await this . resource . __internal_basePost ( {
587582 path : this . resource . pathRoot ,
@@ -590,7 +585,8 @@ class SignInFuture implements SignInFutureResource {
590585 } ) ;
591586 }
592587
593- async password ( { identifier, password } : { identifier ?: string ; password : string } ) : Promise < { error : unknown } > {
588+ async password ( params : SignInFuturePasswordParams ) : Promise < { error : unknown } > {
589+ const { identifier, password } = params ;
594590 return runAsyncResourceTask ( this . resource , async ( ) => {
595591 const previousIdentifier = this . resource . identifier ;
596592 await this . resource . __internal_basePost ( {
@@ -600,7 +596,8 @@ class SignInFuture implements SignInFutureResource {
600596 } ) ;
601597 }
602598
603- async sendEmailCode ( { email } : { email : string } ) : Promise < { error : unknown } > {
599+ async sendEmailCode ( params : SignInFutureEmailCodeSendParams ) : Promise < { error : unknown } > {
600+ const { email } = params ;
604601 return runAsyncResourceTask ( this . resource , async ( ) => {
605602 if ( ! this . resource . id ) {
606603 await this . create ( { identifier : email } ) ;
@@ -620,7 +617,8 @@ class SignInFuture implements SignInFutureResource {
620617 } ) ;
621618 }
622619
623- async verifyEmailCode ( { code } : { code : string } ) : Promise < { error : unknown } > {
620+ async verifyEmailCode ( params : SignInFutureEmailCodeVerifyParams ) : Promise < { error : unknown } > {
621+ const { code } = params ;
624622 return runAsyncResourceTask ( this . resource , async ( ) => {
625623 await this . resource . __internal_basePost ( {
626624 body : { code, strategy : 'email_code' } ,
@@ -629,29 +627,18 @@ class SignInFuture implements SignInFutureResource {
629627 } ) ;
630628 }
631629
632- async sso ( {
633- flow = 'auto' ,
634- strategy,
635- redirectUrl,
636- redirectUrlComplete,
637- } : {
638- flow ?: 'auto' | 'modal' ;
639- strategy : OAuthStrategy | 'saml' | 'enterprise_sso' ;
640- redirectUrl : string ;
641- redirectUrlComplete : string ;
642- } ) : Promise < { error : unknown } > {
630+ async sso ( params : SignInFutureSSOParams ) : Promise < { error : unknown } > {
631+ const { flow = 'auto' , strategy, redirectUrl, redirectCallbackUrl } = params ;
643632 return runAsyncResourceTask ( this . resource , async ( ) => {
644633 if ( flow !== 'auto' ) {
645634 throw new Error ( 'modal flow is not supported yet' ) ;
646635 }
647636
648- const redirectUrlWithAuthToken = SignIn . clerk . buildUrlWithAuth ( redirectUrl ) ;
649-
650637 if ( ! this . resource . id ) {
651638 await this . create ( {
652639 strategy,
653- redirectUrl : redirectUrlWithAuthToken ,
654- actionCompleteRedirectUrl : redirectUrlComplete ,
640+ redirectUrl : SignIn . clerk . buildUrlWithAuth ( redirectCallbackUrl ) ,
641+ actionCompleteRedirectUrl : redirectUrl ,
655642 } ) ;
656643 }
657644
@@ -663,7 +650,8 @@ class SignInFuture implements SignInFutureResource {
663650 } ) ;
664651 }
665652
666- async finalize ( { navigate } : { navigate ?: SetActiveNavigate } = { } ) : Promise < { error : unknown } > {
653+ async finalize ( params ?: SignInFutureFinalizeParams ) : Promise < { error : unknown } > {
654+ const { navigate } = params || { } ;
667655 return runAsyncResourceTask ( this . resource , async ( ) => {
668656 if ( ! this . resource . createdSessionId ) {
669657 throw new Error ( 'Cannot finalize sign-in without a created session.' ) ;
0 commit comments