Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions src/components/Pages/AvatarSetupPage/AvatarSetupPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { useCurrentConnectionData } from '../../../shared/connection'
import { isEmailValid } from '../../../shared/email'
import { locations } from '../../../shared/locations'
import { getStoredEmail } from '../../../shared/onboarding/getStoredEmail'
import { trackCheckpoint } from '../../../shared/onboarding/trackCheckpoint'
import { isProfileComplete } from '../../../shared/profile'
import { handleError } from '../../../shared/utils/errorHandler'
import { checkWebGpuSupport } from '../../../shared/utils/webgpu'
Expand Down Expand Up @@ -170,29 +169,6 @@ const AvatarSetupPage: React.FC = () => {
name: state.username
})

const storedEmail = state.email || getStoredEmail()

// CP3 completed: user accepted TOS and submitted username
trackCheckpoint({
checkpointId: 3,
action: 'completed',
source: 'auth',
userIdentifier: storedEmail || account?.toLowerCase(),
identifierType: storedEmail ? 'email' : 'wallet',
email: storedEmail || undefined,
wallet: account?.toLowerCase()
})

// CP4 reached: avatar creator / starting look screen shown
trackCheckpoint({
checkpointId: 4,
action: 'reached',
source: 'auth',
userIdentifier: storedEmail || account?.toLowerCase(),
identifierType: storedEmail ? 'email' : 'wallet',
email: storedEmail || undefined,
wallet: account?.toLowerCase()
})
}
} catch (e) {
// Display the error in the error box below the continue button
Expand Down Expand Up @@ -272,18 +248,6 @@ const AvatarSetupPage: React.FC = () => {
skipped: event.data.payload.result?.skipped
})

// CP4 completed: avatar customization finished and deployed
const emailForCheckpoint = state.email || getStoredEmail()
trackCheckpoint({
checkpointId: 4,
action: 'completed',
source: 'auth',
userIdentifier: emailForCheckpoint || account.toLowerCase(),
identifierType: emailForCheckpoint ? 'email' : 'wallet',
email: emailForCheckpoint || undefined,
wallet: account.toLowerCase()
})

if (referrer && EthAddress.validate(referrer)) {
try {
await trackReferral(referrer, 'PATCH')
Expand Down Expand Up @@ -389,16 +353,6 @@ const AvatarSetupPage: React.FC = () => {
setState(prev => ({ ...prev, email: storedEmail, isEmailInherited: true }))
}

trackCheckpoint({
checkpointId: 3,
action: 'reached',
source: 'auth',
userIdentifier: storedEmail || account.toLowerCase(),
identifierType: storedEmail ? 'email' : 'wallet',
email: storedEmail || undefined,
wallet: account.toLowerCase()
})

if (referrer && EthAddress.validate(referrer) && !hasTrackedReferral.current) {
await trackReferral(referrer, 'POST')
hasTrackedReferral.current = true
Expand Down
11 changes: 4 additions & 7 deletions src/components/Pages/CallbackPage/CallbackPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { isMagicExtensionError, isMagicRpcError } from '../../../shared/errors'
import { extractReferrerFromSearchParameters, locations } from '../../../shared/locations'
import { isMobileSession } from '../../../shared/mobile'
import { getStoredEmail } from '../../../shared/onboarding/getStoredEmail'
import { markReturningUser } from '../../../shared/onboarding/markReturningUser'
import { trackCheckpoint } from '../../../shared/onboarding/trackCheckpoint'
import { handleError } from '../../../shared/utils/errorHandler'
import { OAUTH_ACCESS_DENIED_ERROR, createMagicInstance } from '../../../shared/utils/magicSdk'
Expand Down Expand Up @@ -82,14 +81,14 @@ const DesktopCallbackPage = () => {

const ethAddress = connectionData.account?.toLowerCase() ?? ''

// CP2 reached: social login callback — now we have account + email
// CP2 completed: social login callback finished — we have the wallet
// and (for Magic) an email. user_id stays as the anonymousId from the
// shared Segment cookie; we just enrich the row.
const storedEmail = getStoredEmail()
trackCheckpoint({
checkpointId: 2,
action: 'reached',
action: 'completed',
source: 'auth',
userIdentifier: storedEmail || ethAddress,
identifierType: storedEmail ? 'email' : 'wallet',
email: storedEmail || undefined,
wallet: ethAddress,
metadata: { loginMethod: 'social' }
Expand All @@ -113,8 +112,6 @@ const DesktopCallbackPage = () => {
if (!profile) return
}

// Flag this user so future visits skip first-time flows
markReturningUser(account)
redirect()
} catch (error) {
handleError(error, 'Error in callback continue flow')
Expand Down
8 changes: 2 additions & 6 deletions src/components/Pages/LoginPage/AutoLoginRedirect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { ConnectionType } from '../../../modules/analytics/types'
import { useCurrentConnectionData } from '../../../shared/connection'
import { isUserRejectedTransaction } from '../../../shared/errors'
import { locations } from '../../../shared/locations'
import { markReturningUser } from '../../../shared/onboarding/markReturningUser'
import { trackCheckpoint } from '../../../shared/onboarding/trackCheckpoint'
import { checkClockSync } from '../../../shared/utils/clockSync'
import { handleError } from '../../../shared/utils/errorHandler'
Expand Down Expand Up @@ -83,13 +82,11 @@ export const AutoLoginRedirect = ({ connectionType }: Props) => {
// MetaMask connected — now verify and redirect
setPhase('verifying')

// Track CP2 reached after wallet connects (matches LoginPage behavior)
// CP2 completed: identity established via Metamask auto-login.
trackCheckpoint({
checkpointId: 2,
action: 'reached',
action: 'completed',
source: 'auth',
userIdentifier: ethAddress,
identifierType: 'wallet',
wallet: ethAddress,
metadata: { loginMethod: connectionType }
})
Expand Down Expand Up @@ -126,7 +123,6 @@ export const AutoLoginRedirect = ({ connectionType }: Props) => {
if (!profile) return
}

markReturningUser(connectionData.account ?? '')
redirect()
} catch (error) {
if (isUserRejectedTransaction(error)) {
Expand Down
7 changes: 2 additions & 5 deletions src/components/Pages/LoginPage/LoginPage.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,9 @@ jest.mock('../../../shared/utils/clockSync', () => ({
checkClockSync: jest.fn().mockResolvedValue(true)
}))

jest.mock('../../../shared/onboarding/markReturningUser', () => ({
markReturningUser: jest.fn()
}))

jest.mock('../../../shared/onboarding/trackCheckpoint', () => ({
trackCheckpoint: jest.fn()
trackCheckpoint: jest.fn(),
trackCheckpointWhenReady: jest.fn()
}))

jest.mock('../../../shared/thirdweb', () => ({
Expand Down
42 changes: 24 additions & 18 deletions src/components/Pages/LoginPage/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ import { ConnectionType } from '../../../modules/analytics/types'
import { useCurrentConnectionData } from '../../../shared/connection'
import { isErrorWithName, isUserRejectedTransaction } from '../../../shared/errors'
import { extractReferrerFromSearchParameters } from '../../../shared/locations'
import { markReturningUser } from '../../../shared/onboarding/markReturningUser'
import { trackCheckpoint } from '../../../shared/onboarding/trackCheckpoint'
import { trackCheckpoint, trackCheckpointWhenReady } from '../../../shared/onboarding/trackCheckpoint'
import { disconnectWallet, sendEmailOTP } from '../../../shared/thirdweb'
import { checkClockSync } from '../../../shared/utils/clockSync'
import { handleError } from '../../../shared/utils/errorHandler'
Expand Down Expand Up @@ -104,6 +103,14 @@ export const LoginPage = () => {
const { identity, getIdentitySignature } = useCurrentConnectionData()
const { trackLoginClick, trackLoginSuccess, trackGuestLogin } = useAnalytics()

// CP2 reached: user opened the auth login page. Anonymous identifier comes
// from the Segment cookie shared with landing on decentraland.org.
// Wrapped in `trackCheckpointWhenReady` because the analytics.js stub may
// shadow `analytics.user()` until the real library loads.
useEffect(() => {
trackCheckpointWhenReady({ checkpointId: 2, action: 'reached', source: 'auth' })
}, [])

const handleGuestLogin = useCallback(async () => {
await trackGuestLogin()
}, [trackGuestLogin])
Expand All @@ -121,7 +128,6 @@ export const LoginPage = () => {
if (!profile) return
}

markReturningUser(account)
redirect()
onRedirect?.()
},
Expand Down Expand Up @@ -159,16 +165,6 @@ export const LoginPage = () => {
// Keep the flow going even if cleanup fails.
}

trackCheckpoint({
checkpointId: 2,
action: 'reached',
source: 'auth',
userIdentifier: email,
identifierType: 'email',
email,
metadata: { loginMethod: ConnectionOptionType.EMAIL }
})

try {
// Send OTP to email
await sendEmailOTP(email)
Expand Down Expand Up @@ -232,13 +228,13 @@ export const LoginPage = () => {
setLoadingState(ConnectionLayoutState.CONNECTING_WALLET)
const connectionData = await connectToProvider(connectionType)

// Track CP2 reached after wallet connects so we have the account address
// CP2 completed: wallet identity established. The anonymousId from
// the shared Segment cookie remains the user_id; we just enrich the
// row with the wallet (and email if any was stored from a prior flow).
trackCheckpoint({
checkpointId: 2,
action: 'reached',
action: 'completed',
source: 'auth',
userIdentifier: connectionData.account?.toLowerCase() ?? '',
identifierType: 'wallet',
wallet: connectionData.account?.toLowerCase(),
metadata: { loginMethod: connectionType }
})
Expand Down Expand Up @@ -346,6 +342,16 @@ export const LoginPage = () => {

const freshIdentity = await getIdentitySignature()

// CP2 completed: Email OTP verified, identity established with email + wallet.
trackCheckpoint({
checkpointId: 2,
action: 'completed',
source: 'auth',
email: currentEmail || undefined,
wallet: address,
metadata: { loginMethod: ConnectionOptionType.EMAIL }
})

await trackLoginSuccess({
ethAddress: address,
type: ConnectionType.WEB2
Expand All @@ -370,7 +376,7 @@ export const LoginPage = () => {
setConfirmingLoginError(errorMessage || t('login.errors.something_went_wrong'))
}
},
[trackLoginSuccess, checkClockSynchronization, runProfileRedirect, getReferrerFromCurrentSearch, getIdentitySignature, t]
[trackLoginSuccess, checkClockSynchronization, runProfileRedirect, getReferrerFromCurrentSearch, getIdentitySignature, currentEmail, t]
)

const handleEmailInputChange = useCallback(() => {
Expand Down
10 changes: 0 additions & 10 deletions src/components/Pages/QuickSetupPage/QuickSetupPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import randomizeIconSvg from '../../../assets/images/randomize-icon.svg'
import { useAfterLoginRedirection } from '../../../hooks/redirection'
import { useDisabledCatalysts } from '../../../hooks/useDisabledCatalysts'
import { useCurrentConnectionData } from '../../../shared/connection'
import { trackCheckpoint } from '../../../shared/onboarding/trackCheckpoint'
import { handleError } from '../../../shared/utils/errorHandler'
import { AnimatedBackground } from '../../AnimatedBackground'
import { CustomWearablePreview } from '../../CustomWearablePreview'
Expand Down Expand Up @@ -136,15 +135,6 @@ export const QuickSetupPage = () => {
}
}

trackCheckpoint({
checkpointId: 3,
action: 'completed',
source: 'auth',
userIdentifier: account.toLowerCase(),
identifierType: 'wallet',
wallet: account.toLowerCase()
})

setShowCelebration(true)
getCelebrateAnimation()
.then(setCelebrationAnimData)
Expand Down
21 changes: 0 additions & 21 deletions src/components/Pages/SetupPage/SetupPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { createAuthServerHttpClient, createAuthServerWsClient } from '../../../s
import { useCurrentConnectionData } from '../../../shared/connection'
import { locations } from '../../../shared/locations'
import { getStoredEmail } from '../../../shared/onboarding/getStoredEmail'
import { trackCheckpoint } from '../../../shared/onboarding/trackCheckpoint'
import { isProfileComplete } from '../../../shared/profile'
import { handleError } from '../../../shared/utils/errorHandler'
import { ConnectionModal } from '../../ConnectionModal'
Expand Down Expand Up @@ -315,16 +314,6 @@ export const SetupPage = () => {
name
})

trackCheckpoint({
checkpointId: 3,
action: 'completed',
source: 'auth',
userIdentifier: email || account.toLowerCase(),
identifierType: email ? 'email' : 'wallet',
email: email || undefined,
wallet: account.toLowerCase()
})

// If the site to be redirect to is a request site, we need to recover the request and sign in.
if (requestId && provider && flags[FeatureFlagsKeys.LOGIN_ON_SETUP]) {
await signRequest(provider, requestId, account)
Expand Down Expand Up @@ -387,16 +376,6 @@ export const SetupPage = () => {
setEmail(storedEmail)
}

trackCheckpoint({
checkpointId: 3,
action: 'reached',
source: 'auth',
userIdentifier: storedEmail || account.toLowerCase(),
identifierType: storedEmail ? 'email' : 'wallet',
email: storedEmail || undefined,
wallet: account.toLowerCase()
})

if (referrer && EthAddress.validate(referrer) && !hasTrackedReferral.current) {
try {
await trackReferral(referrer, 'POST')
Expand Down
58 changes: 0 additions & 58 deletions src/shared/onboarding/markReturningUser.spec.ts

This file was deleted.

Loading
Loading