feat: add website enrichment crawler
This commit is contained in:
@@ -21,6 +21,21 @@ type LeadDiscoveryContactInput = {
|
||||
usableEmail?: string | null;
|
||||
};
|
||||
|
||||
export type LeadDiscoveryContactStatus =
|
||||
| "new"
|
||||
| "missing_contact"
|
||||
| "audit_ready"
|
||||
| "outreach_ready"
|
||||
| "contacted"
|
||||
| "replied"
|
||||
| "do_not_contact";
|
||||
|
||||
type WebsiteEnrichmentScheduleInput = {
|
||||
websiteUrl?: string | null;
|
||||
websiteDomain?: string | null;
|
||||
contactStatus: LeadDiscoveryContactStatus;
|
||||
};
|
||||
|
||||
export type LeadDiscoveryPriority = "high" | "medium" | "low" | "defer" | "blocked";
|
||||
|
||||
type LeadDiscoveryPriorityInput = {
|
||||
@@ -39,7 +54,7 @@ type LeadDiscoveryLeadRecordInput<TCampaignId extends string, TRunId extends str
|
||||
now: number;
|
||||
};
|
||||
|
||||
function optionalString(value: string | null) {
|
||||
function optionalString(value: string | null | undefined) {
|
||||
return value && value.trim().length > 0 ? value : undefined;
|
||||
}
|
||||
|
||||
@@ -91,6 +106,16 @@ export function getLeadDiscoveryContactStatus(
|
||||
return "missing_contact";
|
||||
}
|
||||
|
||||
export function shouldScheduleWebsiteEnrichment(
|
||||
input: WebsiteEnrichmentScheduleInput,
|
||||
) {
|
||||
const hasWebsiteData =
|
||||
optionalString(input.websiteUrl) !== undefined ||
|
||||
optionalString(input.websiteDomain) !== undefined;
|
||||
|
||||
return input.contactStatus === "missing_contact" && hasWebsiteData;
|
||||
}
|
||||
|
||||
export function buildLeadDiscoveryLeadRecord<
|
||||
TCampaignId extends string,
|
||||
TRunId extends string,
|
||||
|
||||
Reference in New Issue
Block a user