@@ -488,6 +488,27 @@ class SignUpFuture implements SignUpFutureResource {
488488 return this . resource . unverifiedFields ;
489489 }
490490
491+ get isTransferable ( ) {
492+ // TODO: we can likely remove the error code check as the status should be sufficient
493+ return (
494+ this . resource . verifications . externalAccount . status === 'transferable' &&
495+ this . resource . verifications . externalAccount . error ?. code === 'external_account_exists'
496+ ) ;
497+ }
498+
499+ get existingSession ( ) {
500+ if (
501+ ( this . resource . verifications . externalAccount . status === 'failed' ||
502+ this . resource . verifications . externalAccount . status === 'unverified' ) &&
503+ this . resource . verifications . externalAccount . error ?. code === 'identifier_already_signed_in' &&
504+ this . resource . verifications . externalAccount . error ?. meta ?. sessionId
505+ ) {
506+ return { sessionId : this . resource . verifications . externalAccount . error ?. meta ?. sessionId } ;
507+ }
508+
509+ return undefined ;
510+ }
511+
491512 private async getCaptchaToken ( ) : Promise < {
492513 captchaToken ?: string ;
493514 captchaWidgetType ?: CaptchaWidgetType ;
@@ -503,6 +524,16 @@ class SignUpFuture implements SignUpFutureResource {
503524 return { captchaToken, captchaWidgetType, captchaError } ;
504525 }
505526
527+ async create ( { transfer } : { transfer ?: boolean } ) : Promise < { error : unknown } > {
528+ return runAsyncResourceTask ( this . resource , async ( ) => {
529+ const { captchaToken, captchaWidgetType, captchaError } = await this . getCaptchaToken ( ) ;
530+ await this . resource . __internal_basePost ( {
531+ path : this . resource . pathRoot ,
532+ body : { transfer, captchaToken, captchaWidgetType, captchaError } ,
533+ } ) ;
534+ } ) ;
535+ }
536+
506537 async password ( { emailAddress, password } : { emailAddress : string ; password : string } ) : Promise < { error : unknown } > {
507538 return runAsyncResourceTask ( this . resource , async ( ) => {
508539 const { captchaToken, captchaWidgetType, captchaError } = await this . getCaptchaToken ( ) ;
@@ -539,6 +570,39 @@ class SignUpFuture implements SignUpFutureResource {
539570 } ) ;
540571 }
541572
573+ async sso ( {
574+ strategy,
575+ redirectUrl,
576+ redirectUrlComplete,
577+ } : {
578+ strategy : string ;
579+ redirectUrl : string ;
580+ redirectUrlComplete : string ;
581+ } ) : Promise < { error : unknown } > {
582+ return runAsyncResourceTask ( this . resource , async ( ) => {
583+ const { captchaToken, captchaWidgetType, captchaError } = await this . getCaptchaToken ( ) ;
584+ await this . resource . __internal_basePost ( {
585+ path : this . resource . pathRoot ,
586+ body : {
587+ strategy,
588+ redirectUrl : SignUp . clerk . buildUrlWithAuth ( redirectUrl ) ,
589+ redirectUrlComplete,
590+ captchaToken,
591+ captchaWidgetType,
592+ captchaError,
593+ } ,
594+ } ) ;
595+
596+ const { status, externalVerificationRedirectURL } = this . resource . verifications . externalAccount ;
597+
598+ if ( status === 'unverified' && ! ! externalVerificationRedirectURL ) {
599+ windowNavigate ( externalVerificationRedirectURL ) ;
600+ } else {
601+ clerkInvalidFAPIResponse ( status , SignUp . fapiClient . buildEmailAddress ( 'support' ) ) ;
602+ }
603+ } ) ;
604+ }
605+
542606 async finalize ( { navigate } : { navigate ?: SetActiveNavigate } = { } ) : Promise < { error : unknown } > {
543607 return runAsyncResourceTask ( this . resource , async ( ) => {
544608 if ( ! this . resource . createdSessionId ) {
0 commit comments