feat(auth): referrer code at signup and agent code in profile

Optional referrer agent code in registration with field validation UX. Show read-only agent referral code in profile edit and desktop overview.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-04 10:38:16 +03:30
co-authored by Cursor
parent 9c35450b31
commit f252749d18
7 changed files with 132 additions and 7 deletions
+10 -1
View File
@@ -10,6 +10,7 @@ type PendingOtp = {
isRegister: boolean
firstName?: string
lastName?: string
referrerAgentCode?: string
}
let memoryPending: PendingOtp | null = null
@@ -50,7 +51,12 @@ function setPendingOtp(value: PendingOtp | null) {
export async function sendOtp(
phone: string,
options: { firstName?: string; lastName?: string; isRegister: boolean },
options: {
firstName?: string
lastName?: string
isRegister: boolean
referrerAgentCode?: string
},
): Promise<{ success: boolean; message: string }> {
const normalized = normalizePhone(phone)
if (!/^09\d{9}$/.test(normalized)) {
@@ -62,11 +68,13 @@ export async function sendOtp(
}
try {
const referrerAgentCode = options.referrerAgentCode?.trim() || undefined
setPendingOtp({
phone: normalized,
isRegister: options.isRegister,
firstName: options.firstName,
lastName: options.lastName,
referrerAgentCode,
})
const res = await apiRequest<{ success: boolean; message: string; debugCode?: string }>(
'/auth/otp/request',
@@ -78,6 +86,7 @@ export async function sendOtp(
firstName: options.firstName,
lastName: options.lastName,
isRegister: options.isRegister,
referrerAgentCode,
},
},
)