fix(leads): label ticket leads; event leads list no longer crashes on source TICKET
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
This commit is contained in:
1 parent
02aa19a686
commit
5c2cb605b9
7 files changed
+23
-2
No files matched your search
@@ -695,6 +695,8 @@ INSERT INTO message (code, content, area) SELECT 'LeadSourceInvite', JSON_OBJECT
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '邀请') WHERE LOWER(code) = LOWER('LeadSourceInvite') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'LeadSourceWeb', JSON_OBJECT('en_US', 'Web page', 'zh_CN', '网页'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('LeadSourceWeb') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '网页') WHERE LOWER(code) = LOWER('LeadSourceWeb') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'LeadSourceTicket', JSON_OBJECT('en_US', 'Ticket', 'zh_CN', '门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('LeadSourceTicket') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票') WHERE LOWER(code) = LOWER('LeadSourceTicket') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'LeadWebPage', JSON_OBJECT('en_US', 'Web page: {path}', 'zh_CN', '网页:{path}'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('LeadWebPage') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '网页:{path}') WHERE LOWER(code) = LOWER('LeadWebPage') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'LeadCampaign', JSON_OBJECT('en_US', 'Campaign: {tags}', 'zh_CN', '推广活动:{tags}'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('LeadCampaign') AND area = 'A');
|
||||
|
||||
@@ -89,4 +89,6 @@ INSERT INTO message (code, content, area) SELECT 'TktRenameWarning', JSON_OBJECT
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保存后此门票将获得新的链接和二维码,旧的将失效。') WHERE LOWER(code) = LOWER('TktRenameWarning') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'TktSaveAttendee', JSON_OBJECT('en_US', 'Save attendee', 'zh_CN', '保存参加者'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('TktSaveAttendee') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保存参加者') WHERE LOWER(code) = LOWER('TktSaveAttendee') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'LeadSourceTicket', JSON_OBJECT('en_US', 'Ticket', 'zh_CN', '门票'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('LeadSourceTicket') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '门票') WHERE LOWER(code) = LOWER('LeadSourceTicket') AND area = 'A';
|
||||
UPDATE catalog_meta SET version = version + 1, updated_at = NOW() WHERE id = 1;
|
||||
@@ -153,6 +153,21 @@ describe("EventLeadsDetailPage (listing)", { timeout: 20000 }, () => {
|
||||
expect(card.getByText("Source: QR")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("labels ticket leads (buyers and consenting attendees) as Ticket", async () => {
|
||||
mocks.listEventLeads.mockResolvedValue({
|
||||
items: [{
|
||||
eventLeadUuid: "el-1", eventUuid: "evt-1", leadUuid: "lead-1", name: "John Doe", mobile: null, email: null,
|
||||
companyName: null, jobTitle: null, leadType: "NEW", salesperson: null, temperature: null, status: "OPEN",
|
||||
interests: [], nextFollowUpDate: null, notes: null, capturedAt: "2025-06-01", attended: null, source: "TICKET",
|
||||
}],
|
||||
total: 1,
|
||||
});
|
||||
render(<EventLeadsDetailPage />);
|
||||
const row = (await screen.findByRole("link", { name: "John Doe" })).closest("tr")!;
|
||||
expect(within(row).getAllByRole("cell").at(-1)!.textContent).toBe("Ticket");
|
||||
expect(within(screen.getByTestId("lead-card")).getByText("Source: Ticket")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("filters by attendance for the list and the export", async () => {
|
||||
const user = userEvent.setup();
|
||||
render(<EventLeadsDetailPage />);
|
||||
|
||||
@@ -28,7 +28,7 @@ const TEMPERATURE_OPTIONS = [{ value: "HOT", label: "LeadHot" }, { value: "WARM"
|
||||
const STATUS_OPTIONS = [{ value: "OPEN", label: "LeadOpen" }, { value: "CONTACTED", label: "LeadContacted" }, { value: "QUALIFIED", label: "LeadQualified" }, { value: "WON", label: "LeadWon" }, { value: "LOST", label: "LeadLost" }];
|
||||
const LEAD_TYPE_OPTIONS = [{ value: "NEW", label: "LeadNew" }, { value: "EXISTING", label: "LeadExisting" }];
|
||||
const ATTENDED_OPTIONS = [{ value: "true", label: "GuestAttended" }, { value: "false", label: "LeadNotAttended" }];
|
||||
const SOURCE_LABEL = { STAFF: "LeadSourceStaff", QR: "LeadSourceQr", INVITE: "LeadSourceInvite", WEB: "LeadSourceWeb" } as const;
|
||||
const SOURCE_LABEL = { STAFF: "LeadSourceStaff", QR: "LeadSourceQr", INVITE: "LeadSourceInvite", WEB: "LeadSourceWeb", TICKET: "LeadSourceTicket" } as const;
|
||||
const TEMPERATURE_BADGE = { HOT: "negative", WARM: "warning", COLD: "neutral" } as const;
|
||||
const STATUS_BADGE = { OPEN: "neutral", CONTACTED: "neutral", QUALIFIED: "contrast", WON: "positive", LOST: "negative" } as const;
|
||||
|
||||
|
||||
@@ -356,6 +356,7 @@ export const DEFAULT_MESSAGES: Record<string, string> = {
|
||||
LeadSourceQr: "QR",
|
||||
LeadSourceInvite: "Invite",
|
||||
LeadSourceWeb: "Web page",
|
||||
LeadSourceTicket: "Ticket",
|
||||
LeadWebPage: "Web page: {path}",
|
||||
LeadCampaign: "Campaign: {tags}",
|
||||
LeadHot: "Hot",
|
||||
|
||||
@@ -710,6 +710,7 @@
|
||||
"MsgsConfirmImport": "确认导入",
|
||||
"MsgsImportSummary": "已创建 {created} 条,已更新 {updated} 条,失败 {errors} 条。",
|
||||
"LeadSourceWeb": "网页",
|
||||
"LeadSourceTicket": "门票",
|
||||
"LeadWebPage": "网页:{path}",
|
||||
"LeadCampaign": "推广活动:{tags}",
|
||||
"BO_PAGES": "网页",
|
||||
|
||||
@@ -251,7 +251,7 @@ export interface EventLeadRow {
|
||||
capturedAt: string;
|
||||
companyId?: number;
|
||||
attended?: boolean;
|
||||
source?: "STAFF" | "QR" | "INVITE" | "WEB";
|
||||
source?: "STAFF" | "QR" | "INVITE" | "WEB" | "TICKET";
|
||||
/** A web page sign-up's page address and UTM tags. */
|
||||
pagePath?: string | null;
|
||||
utmSource?: string | null;
|
||||
|
||||
Reference in new issue
Block a user