File tree Expand file tree Collapse file tree 6 files changed +43
-2
lines changed
clerk-js/src/core/resources Expand file tree Collapse file tree 6 files changed +43
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @clerk/clerk-js ' : minor
3
+ ' @clerk/types ' : minor
4
+ ---
5
+
6
+ [ Experimental] Add support for ticket sign-ins and sign-ups
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ import type {
44
44
SignInFutureResetPasswordSubmitParams ,
45
45
SignInFutureResource ,
46
46
SignInFutureSSOParams ,
47
+ SignInFutureTicketParams ,
47
48
SignInFutureTOTPVerifyParams ,
48
49
SignInIdentifier ,
49
50
SignInJSON ,
@@ -914,6 +915,11 @@ class SignInFuture implements SignInFutureResource {
914
915
} ) ;
915
916
}
916
917
918
+ async ticket ( params ?: SignInFutureTicketParams ) : Promise < { error : unknown } > {
919
+ const ticket = params ?. ticket ?? getClerkQueryParam ( '__clerk_ticket' ) ;
920
+ return this . create ( { ticket : ticket ?? undefined } ) ;
921
+ }
922
+
917
923
async finalize ( params ?: SignInFutureFinalizeParams ) : Promise < { error : unknown } > {
918
924
const { navigate } = params || { } ;
919
925
return runAsyncResourceTask ( this . resource , async ( ) => {
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import type {
25
25
SignUpFuturePhoneCodeVerifyParams ,
26
26
SignUpFutureResource ,
27
27
SignUpFutureSSOParams ,
28
+ SignUpFutureTicketParams ,
28
29
SignUpFutureUpdateParams ,
29
30
SignUpIdentificationField ,
30
31
SignUpJSON ,
@@ -44,6 +45,7 @@ import {
44
45
generateSignatureWithMetamask ,
45
46
generateSignatureWithOKXWallet ,
46
47
getBaseIdentifier ,
48
+ getClerkQueryParam ,
47
49
getCoinbaseWalletIdentifier ,
48
50
getMetamaskIdentifier ,
49
51
getOKXWalletIdentifier ,
@@ -773,6 +775,11 @@ class SignUpFuture implements SignUpFutureResource {
773
775
} ) ;
774
776
}
775
777
778
+ async ticket ( params ?: SignUpFutureTicketParams ) : Promise < { error : unknown } > {
779
+ const ticket = params ?. ticket ?? getClerkQueryParam ( '__clerk_ticket' ) ;
780
+ return this . create ( { ...params , ticket : ticket ?? undefined } ) ;
781
+ }
782
+
776
783
async finalize ( params ?: SignUpFutureFinalizeParams ) : Promise < { error : unknown } > {
777
784
const { navigate } = params || { } ;
778
785
return runAsyncResourceTask ( this . resource , async ( ) => {
Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ export class StateProxy implements State {
91
91
'verifyTOTP' ,
92
92
'verifyBackupCode' ,
93
93
] as const ) ,
94
+ ticket : this . gateMethod ( target , 'ticket' ) ,
94
95
} ,
95
96
} ;
96
97
}
@@ -119,6 +120,7 @@ export class StateProxy implements State {
119
120
update : gateMethod ( target , 'update' ) ,
120
121
sso : gateMethod ( target , 'sso' ) ,
121
122
password : gateMethod ( target , 'password' ) ,
123
+ ticket : gateMethod ( target , 'ticket' ) ,
122
124
finalize : gateMethod ( target , 'finalize' ) ,
123
125
124
126
verifications : wrapMethods ( ( ) => target ( ) . verifications , [
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ export interface SignInFutureCreateParams {
10
10
redirectUrl ?: string ;
11
11
actionCompleteRedirectUrl ?: string ;
12
12
transfer ?: boolean ;
13
+ ticket ?: string ;
13
14
}
14
15
15
16
export type SignInFuturePasswordParams =
@@ -110,6 +111,10 @@ export interface SignInFutureBackupCodeVerifyParams {
110
111
code : string ;
111
112
}
112
113
114
+ export interface SignInFutureTicketParams {
115
+ ticket : string ;
116
+ }
117
+
113
118
export interface SignInFutureFinalizeParams {
114
119
navigate ?: SetActiveNavigate ;
115
120
}
@@ -266,7 +271,12 @@ export interface SignInFutureResource {
266
271
} ;
267
272
268
273
/**
269
- * Used to convert a sign-in with `status === ‘complete’` into an active session. Will cause anything observing the
274
+ * Used to perform a ticket-based sign-in.
275
+ */
276
+ ticket : ( params ?: SignInFutureTicketParams ) => Promise < { error : unknown } > ;
277
+
278
+ /**
279
+ * Used to convert a sign-in with `status === 'complete'` into an active session. Will cause anything observing the
270
280
* session state (such as the `useUser()` hook) to update automatically.
271
281
*/
272
282
finalize : ( params ?: SignInFutureFinalizeParams ) => Promise < { error : unknown } > ;
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ interface SignUpFutureAdditionalParams {
11
11
12
12
export interface SignUpFutureCreateParams extends SignUpFutureAdditionalParams {
13
13
transfer ?: boolean ;
14
+ ticket ?: string ;
14
15
}
15
16
16
17
// This will likely get more properties
@@ -50,6 +51,10 @@ export interface SignUpFutureSSOParams {
50
51
redirectCallbackUrl : string ;
51
52
}
52
53
54
+ export interface SignUpFutureTicketParams extends SignUpFutureAdditionalParams {
55
+ ticket : string ;
56
+ }
57
+
53
58
export interface SignUpFutureFinalizeParams {
54
59
navigate ?: SetActiveNavigate ;
55
60
}
@@ -116,7 +121,12 @@ export interface SignUpFutureResource {
116
121
sso : ( params : SignUpFutureSSOParams ) => Promise < { error : unknown } > ;
117
122
118
123
/**
119
- * Used to convert a sign-up with `status === ‘complete’` into an active session. Will cause anything observing the
124
+ * Used to perform a ticket-based sign-up.
125
+ */
126
+ ticket : ( params ?: SignUpFutureTicketParams ) => Promise < { error : unknown } > ;
127
+
128
+ /**
129
+ * Used to convert a sign-up with `status === 'complete'` into an active session. Will cause anything observing the
120
130
* session state (such as the `useUser()` hook) to update automatically.
121
131
*/
122
132
finalize : ( params ?: SignUpFutureFinalizeParams ) => Promise < { error : unknown } > ;
You can’t perform that action at this time.
0 commit comments