@@ -21,8 +21,10 @@ import type {
2121 SignUpFutureEmailCodeVerifyParams ,
2222 SignUpFutureFinalizeParams ,
2323 SignUpFuturePasswordParams ,
24+ SignUpFuturePhoneCodeSendParams ,
25+ SignUpFuturePhoneCodeVerifyParams ,
2426 SignUpFutureResource ,
25- SignUpFutureSSoParams ,
27+ SignUpFutureSSOParams ,
2628 SignUpIdentificationField ,
2729 SignUpJSON ,
2830 SignUpJSONSnapshot ,
@@ -497,6 +499,8 @@ class SignUpFuture implements SignUpFutureResource {
497499 verifications = {
498500 sendEmailCode : this . sendEmailCode . bind ( this ) ,
499501 verifyEmailCode : this . verifyEmailCode . bind ( this ) ,
502+ sendPhoneCode : this . sendPhoneCode . bind ( this ) ,
503+ verifyPhoneCode : this . verifyPhoneCode . bind ( this ) ,
500504 } ;
501505
502506 constructor ( readonly resource : SignUp ) { }
@@ -594,7 +598,35 @@ class SignUpFuture implements SignUpFutureResource {
594598 } ) ;
595599 }
596600
597- async sso ( params : SignUpFutureSSoParams ) : Promise < { error : unknown } > {
601+ async sendPhoneCode ( params : SignUpFuturePhoneCodeSendParams ) : Promise < { error : unknown } > {
602+ const { phoneNumber, channel = 'sms' } = params ;
603+ return runAsyncResourceTask ( this . resource , async ( ) => {
604+ if ( ! this . resource . id ) {
605+ const { captchaToken, captchaWidgetType, captchaError } = await this . getCaptchaToken ( ) ;
606+ await this . resource . __internal_basePost ( {
607+ path : this . resource . pathRoot ,
608+ body : { phoneNumber, captchaToken, captchaWidgetType, captchaError } ,
609+ } ) ;
610+ }
611+
612+ await this . resource . __internal_basePost ( {
613+ body : { strategy : 'phone_code' , channel } ,
614+ action : 'prepare_verification' ,
615+ } ) ;
616+ } ) ;
617+ }
618+
619+ async verifyPhoneCode ( params : SignUpFuturePhoneCodeVerifyParams ) : Promise < { error : unknown } > {
620+ const { code } = params ;
621+ return runAsyncResourceTask ( this . resource , async ( ) => {
622+ await this . resource . __internal_basePost ( {
623+ body : { strategy : 'phone_code' , code } ,
624+ action : 'attempt_verification' ,
625+ } ) ;
626+ } ) ;
627+ }
628+
629+ async sso ( params : SignUpFutureSSOParams ) : Promise < { error : unknown } > {
598630 const { strategy, redirectUrl, redirectCallbackUrl } = params ;
599631 return runAsyncResourceTask ( this . resource , async ( ) => {
600632 const { captchaToken, captchaWidgetType, captchaError } = await this . getCaptchaToken ( ) ;
0 commit comments