in frontend/src/pages/accounts/profile.page.tsx [235:276]
alias: getFullAddress(alias),
}),
{ type: "error" },
);
}
};
// We pull UTM parameters from query
const {
utm_campaign = "",
utm_medium = "",
utm_source = "",
} = router.query || {};
const isFreeUserOnboardingActive = isFlagActive(
runtimeData.data,
"free_user_onboarding",
);
// We validate UTM parameters to ensure they match the expected values for the onboarding campaign
const isValidUtmParameters =
utm_campaign === "relay-onboarding" &&
utm_source === "relay-onboarding" &&
utm_medium === "email";
// Determine if the user is part of the target audience for onboarding
// This checks if the user does not have a premium account and has not completed all onboarding steps
const isOnboarding =
profile.onboarding_free_state <
getRuntimeConfig().maxOnboardingFreeAvailable;
const isTargetAudience = !profile.has_premium && isOnboarding;
// Conditions: onboarding is active, UTM parameters are valid OR the user has less than or equal to
// 2 masks (if in onboarding process, up to 3), and the user is part of the target audience
if (
isFreeUserOnboardingActive &&
(isValidUtmParameters ||
allAliases.length <= 2 ||
(profile.onboarding_free_state > 0 && allAliases.length <= 3)) &&
isTargetAudience
) {
const onNextStep = (step: number) => {
profileData.update(profile.id, {