@@ -116,14 +116,19 @@ function SignUpStartInternal(): JSX.Element {
116
116
} as const ;
117
117
118
118
const hasTicket = ! ! formState . ticket . value ;
119
+ const hasExistingSignUpWithTicket = ! ! (
120
+ signUp . id &&
121
+ signUp . status !== null &&
122
+ ( getClerkQueryParam ( '__clerk_ticket' ) || getClerkQueryParam ( '__clerk_invitation_token' ) )
123
+ ) ;
119
124
const hasEmail = ! ! formState . emailAddress . value ;
120
125
const isProgressiveSignUp = userSettings . signUp . progressive ;
121
126
const isLegalConsentEnabled = userSettings . signUp . legal_consent_enabled ;
122
127
const oidcPrompt = ctx . oidcPrompt ;
123
128
124
129
const fields = determineActiveFields ( {
125
130
attributes,
126
- hasTicket,
131
+ hasTicket : hasTicket || hasExistingSignUpWithTicket ,
127
132
hasEmail,
128
133
activeCommIdentifierType,
129
134
isProgressiveSignUp,
@@ -243,7 +248,7 @@ function SignUpStartInternal(): JSX.Element {
243
248
fieldsToSubmit . push ( { id : 'unsafeMetadata' , value : unsafeMetadata } as any ) ;
244
249
}
245
250
246
- if ( fields . ticket ) {
251
+ if ( fields . ticket || hasExistingSignUpWithTicket ) {
247
252
const noop = ( ) => { } ;
248
253
// fieldsToSubmit: Constructing a fake fields object for strategy.
249
254
fieldsToSubmit . push ( {
@@ -254,6 +259,21 @@ function SignUpStartInternal(): JSX.Element {
254
259
onChange : noop ,
255
260
setError : noop ,
256
261
} as any ) ;
262
+
263
+ // Get ticket value from query params if it exists
264
+ if ( ! fields . ticket && hasExistingSignUpWithTicket ) {
265
+ const ticketValue = getClerkQueryParam ( '__clerk_ticket' ) || getClerkQueryParam ( '__clerk_invitation_token' ) ;
266
+ if ( ticketValue ) {
267
+ fieldsToSubmit . push ( {
268
+ id : 'ticket' ,
269
+ value : ticketValue ,
270
+ clearFeedback : noop ,
271
+ setValue : noop ,
272
+ onChange : noop ,
273
+ setError : noop ,
274
+ } as any ) ;
275
+ }
276
+ }
257
277
}
258
278
259
279
// If the user has already selected an alternative phone code provider, we use that.
@@ -299,7 +319,7 @@ function SignUpStartInternal(): JSX.Element {
299
319
const redirectUrlComplete = ctx . afterSignUpUrl || '/' ;
300
320
301
321
let signUpAttempt : Promise < SignUpResource > ;
302
- if ( ! fields . ticket ) {
322
+ if ( ! fields . ticket && ! hasExistingSignUpWithTicket ) {
303
323
signUpAttempt = signUp . create ( buildRequest ( fieldsToSubmit ) ) ;
304
324
} else {
305
325
signUpAttempt = signUp . upsert ( buildRequest ( fieldsToSubmit ) ) ;
@@ -331,9 +351,11 @@ function SignUpStartInternal(): JSX.Element {
331
351
const shouldShowForm = showFormFields ( userSettings ) && visibleFields . length > 0 ;
332
352
333
353
const showOauthProviders =
334
- ( ! hasTicket || missingRequirementsWithTicket ) && userSettings . authenticatableSocialStrategies . length > 0 ;
335
- const showWeb3Providers = ! hasTicket && userSettings . web3FirstFactors . length > 0 ;
336
- const showAlternativePhoneCodeProviders = ! hasTicket && userSettings . alternativePhoneCodeChannels . length > 0 ;
354
+ ( ! ( hasTicket || hasExistingSignUpWithTicket ) || missingRequirementsWithTicket ) &&
355
+ userSettings . authenticatableSocialStrategies . length > 0 ;
356
+ const showWeb3Providers = ! ( hasTicket || hasExistingSignUpWithTicket ) && userSettings . web3FirstFactors . length > 0 ;
357
+ const showAlternativePhoneCodeProviders =
358
+ ! ( hasTicket || hasExistingSignUpWithTicket ) && userSettings . alternativePhoneCodeChannels . length > 0 ;
337
359
338
360
const onAlternativePhoneCodeUseAnotherMethod = ( ) => {
339
361
setAlternativePhoneCodeProvider ( null ) ;
@@ -344,7 +366,7 @@ function SignUpStartInternal(): JSX.Element {
344
366
setAlternativePhoneCodeProvider ( phoneCodeProvider ) ;
345
367
} ;
346
368
347
- if ( mode !== SIGN_UP_MODES . PUBLIC && ! hasTicket ) {
369
+ if ( mode !== SIGN_UP_MODES . PUBLIC && ! ( hasTicket || hasExistingSignUpWithTicket ) ) {
348
370
return < SignUpRestrictedAccess /> ;
349
371
}
350
372
0 commit comments