Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -0,0 +1,35 @@
export type LeadStatus = "new" | "qualified" | "converted" | "lost" | "spam";
export const ALLOWED_LEAD_STATUS_TRANSITIONS: Readonly<Record<LeadStatus, readonly LeadStatus[]>> = {
new: ["qualified", "lost", "spam"],
qualified: ["converted", "lost", "spam"],
converted: [],
lost: [],
spam: [],
};
export function canTransitionLeadStatus(from: LeadStatus, to: LeadStatus): boolean {
return from === to || ALLOWED_LEAD_STATUS_TRANSITIONS[from].includes(to);
}
const SPAM_AUTO_DELETE_DAYS = 30;
const TERMINAL_LEAD_STATUSES: ReadonlySet<LeadStatus> = new Set(["converted", "lost", "spam"]);
export function leadStatusTimestampData(status: LeadStatus, now: Date, lostAutoDeleteDays: number) {
return {
...(status === "qualified" ? { weiterverarbeitungFreigabe: "ja" as const } : {}),
...(status === "converted" ? { convertedAt: now } : {}),
...(status === "lost" ? { lostAt: now } : {}),
...(status === "spam" ? { spamMarkedAt: now } : {}),
...(TERMINAL_LEAD_STATUSES.has(status)
? {
autoDeleteAt:
status === "spam"
? new Date(now.getTime() + SPAM_AUTO_DELETE_DAYS * 24 * 60 * 60 * 1000)
: status === "lost" && lostAutoDeleteDays > 0
? new Date(now.getTime() + lostAutoDeleteDays * 24 * 60 * 60 * 1000)
: null,
}
: {}),
};
}