Add after-hours callbacks and persistent ad attribution to all four landings
- The callback dialog switches its copy outside business hours (shared/business-hours.ts); such leads get a "нерабочее время" tag, a marker in the deal name and a line in the note in amoCRM. - utm_*, yclid and gclid are read on page load and kept for 30 days (src/lib/attribution.ts), last tagged visit wins, and are sent with every lead. - The callback dialog is rebuilt: focus trap, focus return, phone masking and a full-number check. - fitnes drops the floating MobileCta; header and mobile bars follow the new dialog state in the other three. - Add the latest design mockups under legacy/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
56ff5839b8
commit
a61d53962a
145 files changed
+9242
-523
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { businessHours } from '../../shared/business-hours.ts'
|
||||
import type { CallClickPayload, LeadPayload } from '../../shared/lead.ts'
|
||||
import type { AmoCustomField, AmoFieldEntry } from './amocrm.ts'
|
||||
|
||||
@@ -21,6 +22,8 @@ const LABELS: Record<string, string> = {
|
||||
utm_campaign: 'utm_campaign',
|
||||
utm_content: 'utm_content',
|
||||
utm_term: 'utm_term',
|
||||
yclid: 'yclid',
|
||||
gclid: 'gclid',
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,6 +48,8 @@ const CANDIDATES: Record<string, { codes: string[]; names: string[] }> = {
|
||||
utm_campaign: { codes: ['UTM_CAMPAIGN'], names: ['utm_campaign'] },
|
||||
utm_content: { codes: ['UTM_CONTENT'], names: ['utm_content'] },
|
||||
utm_term: { codes: ['UTM_TERM'], names: ['utm_term'] },
|
||||
yclid: { codes: ['YCLID'], names: ['yclid'] },
|
||||
gclid: { codes: ['GCLID'], names: ['gclid'] },
|
||||
}
|
||||
|
||||
/** Field types we know how to write a plain string into. */
|
||||
@@ -142,7 +147,7 @@ export function mapLead(payload: LeadPayload, fieldMap: LeadFieldMap): MappedLea
|
||||
comment: payload.comment,
|
||||
page: payload.page,
|
||||
referrer: payload.referrer,
|
||||
form: payload.form === 'callback' ? 'Быстрый обратный звонок' : 'Заявка на конфигурацию',
|
||||
form: formLabel(payload),
|
||||
...payload.utm,
|
||||
}
|
||||
|
||||
@@ -154,15 +159,30 @@ export function mapLead(payload: LeadPayload, fieldMap: LeadFieldMap): MappedLea
|
||||
`Заявка с лендинга «${LANDING}»`,
|
||||
`${LABELS.phone}: ${payload.phone}`,
|
||||
payload.email ? `${LABELS.email}: ${payload.email}` : undefined,
|
||||
payload.after_hours
|
||||
? `Оставлена в нерабочее время (${businessHours.label}) — посетителю обещан звонок в ближайшее рабочее время.`
|
||||
: undefined,
|
||||
].filter(Boolean) as string[]
|
||||
|
||||
return { fields, note: [...header, ...leftovers].join('\n') }
|
||||
}
|
||||
|
||||
function formLabel(payload: LeadPayload): string {
|
||||
if (payload.form === 'request') return 'Заявка на конфигурацию'
|
||||
return payload.after_hours ? 'Обратный звонок в нерабочее время' : 'Быстрый обратный звонок'
|
||||
}
|
||||
|
||||
/** Lead title shown in the pipeline. */
|
||||
export function buildLeadName(payload: LeadPayload): string {
|
||||
const who = payload.company ?? payload.name
|
||||
return payload.form === 'callback' ? `Обратный звонок — ${who}` : `Recovery Zone — ${who}`
|
||||
if (payload.form === 'request') return `Recovery Zone — ${who}`
|
||||
return payload.after_hours ? `Обратный звонок (нерабочее время) — ${who}` : `Обратный звонок — ${who}`
|
||||
}
|
||||
|
||||
/** Form tag, plus a second one that lets managers filter overnight callbacks. */
|
||||
export function buildLeadTags(payload: LeadPayload): string[] {
|
||||
if (payload.form === 'request') return ['заявка с сайта']
|
||||
return payload.after_hours ? ['обратный звонок', 'нерабочее время'] : ['обратный звонок']
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@ import { AmoClient, type AmoContact, type AmoFieldEntry } from './amocrm.ts'
|
||||
import {
|
||||
buildCallClickName,
|
||||
buildLeadName,
|
||||
buildLeadTags,
|
||||
mapCallClick,
|
||||
mapLead,
|
||||
resolveLeadFieldMap,
|
||||
@@ -115,7 +116,7 @@ export class LeadService {
|
||||
name: buildLeadName(payload),
|
||||
contactId,
|
||||
fields,
|
||||
tags: [payload.form === 'callback' ? 'обратный звонок' : 'заявка с сайта'],
|
||||
tags: buildLeadTags(payload),
|
||||
})
|
||||
|
||||
// 3. Everything the account has no field for lands in a readable note.
|
||||
|
||||
Reference in new issue
Block a user