fix(user): referral register links and iPhone login scroll
Use register=true in invite URLs and adjust mobile login layout so the signup button stays reachable on iOS. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -39,10 +39,12 @@ export function renderInviteLinkText(
|
||||
.replace(/[%٪]\s*نام/gu, userName)
|
||||
}
|
||||
|
||||
function resolveReferralLoginLink(referralId?: string | number | null): string {
|
||||
function resolveReferralRegisterLink(referralId?: string | number | null): string {
|
||||
const id = String(referralId ?? '').trim()
|
||||
if (!id) return ''
|
||||
|
||||
const query = `register=true&id=${encodeURIComponent(id)}`
|
||||
|
||||
let base = ''
|
||||
try {
|
||||
base = String(useSettingsStore().getSettingByKey('app_url') ?? '').trim()
|
||||
@@ -51,14 +53,14 @@ function resolveReferralLoginLink(referralId?: string | number | null): string {
|
||||
}
|
||||
|
||||
if (base) {
|
||||
return `${base.replace(/\/+$/, '')}/login?id=${encodeURIComponent(id)}`
|
||||
return `${base.replace(/\/+$/, '')}/login?${query}`
|
||||
}
|
||||
|
||||
if (typeof window !== 'undefined' && window.location?.origin) {
|
||||
return `${window.location.origin}/login?id=${encodeURIComponent(id)}`
|
||||
return `${window.location.origin}/login?${query}`
|
||||
}
|
||||
|
||||
return `/login?id=${encodeURIComponent(id)}`
|
||||
return `/login?${query}`
|
||||
}
|
||||
|
||||
export function getReferralShareText(options: {
|
||||
@@ -67,7 +69,7 @@ export function getReferralShareText(options: {
|
||||
referralId?: string | number | null
|
||||
}) {
|
||||
const userName = options.userName ?? ''
|
||||
const link = resolveReferralLoginLink(options.referralId)
|
||||
const link = resolveReferralRegisterLink(options.referralId)
|
||||
return renderInviteLinkText(getInviteLinkTemplate(), { userName, link })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user