( args: CreateOrUpdateUserArgs, turnstile_guid: UUID | undefined, autoLinkToExistingUser: boolean = false, requestHeaders?: Headers, affiliateTrackingId?: string | null, trackingContext?: CreateOrUpdateUserTrackingContext )
| 507 | if (trackingContext?.affiliateTouch) { |
| 508 | try { |
| 509 | logImpactReferralDebug('Signup recording Impact affiliate touch', { |
| 510 | userId: user.id, |
| 511 | anonymousIdPresent: Boolean(trackingContext.anonymousId?.trim()), |
| 512 | landingPath: redactLandingPathForLogs(trackingContext.affiliateTouch.landingPath), |
| 513 | trackingValueLength: trackingContext.affiliateTouch.trackingValueLength, |
| 514 | isTrackingValueAccepted: trackingContext.affiliateTouch.isTrackingValueAccepted, |
| 515 | }); |
| 516 | await recordImpactAffiliateTouch({ |
| 517 | userId: user.id, |
| 518 | anonymousId: trackingContext.anonymousId ?? null, |
| 519 | touch: trackingContext.affiliateTouch, |
| 520 | }); |
| 521 | } catch (error) { |
| 522 | console.error('[user] failed to record affiliate touch during signup', { |
| 523 | userId: user.id, |
| 524 | error: error instanceof Error ? error.message : String(error), |
| 525 | }); |
| 526 | } |
| 527 | } |
| 528 | |
| 529 | if (trackingContext?.referralTouch) { |
| 530 | try { |
| 531 | logImpactReferralDebug('Signup recording Impact Advocate referral touch', { |
| 532 | userId: user.id, |
| 533 | anonymousIdPresent: Boolean(trackingContext.anonymousId?.trim()), |
| 534 | landingPath: redactLandingPathForLogs(trackingContext.referralTouch.landingPath), |
| 535 | rsCodePresent: Boolean(trackingContext.referralTouch.rsCode?.trim()), |
| 536 | trackingValueLength: trackingContext.referralTouch.trackingValueLength, |
| 537 | isTrackingValueAccepted: trackingContext.referralTouch.isTrackingValueAccepted, |
| 538 | }); |
| 539 | await recordImpactReferralTouch({ |
| 540 | userId: user.id, |
| 541 | anonymousId: trackingContext.anonymousId ?? null, |
| 542 | touch: trackingContext.referralTouch, |
| 543 | }); |
| 544 | } catch (error) { |
| 545 | console.error('[user] failed to record referral touch during signup', { |
| 546 | userId: user.id, |
| 547 | error: error instanceof Error ? error.message : String(error), |
| 548 | }); |
| 549 | } |
| 550 | |
| 551 | try { |
| 552 | logImpactReferralDebug('Signup queueing Impact Advocate participant registration', { |
| 553 | userId: user.id, |
| 554 | landingPath: redactLandingPathForLogs(trackingContext.referralTouch.landingPath), |
| 555 | localePresent: Boolean(trackingContext.locale?.trim()), |
| 556 | countryCode: trackingContext.countryCode ?? null, |
| 557 | }); |
| 558 | await queueImpactAdvocateParticipantRegistration({ |
| 559 | user, |
| 560 | referralTouch: trackingContext.referralTouch, |
| 561 | locale: trackingContext.locale, |
| 562 | countryCode: trackingContext.countryCode, |
| 563 | }); |
| 564 | } catch (error) { |
| 565 | console.error('[user] failed to enqueue Impact Advocate registration during signup', { |
| 566 | userId: user.id, |
no test coverage detected