outbound-sdk 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +121 -2
- package/dist/alerts/index.d.ts +2 -0
- package/dist/alerts/index.js +136 -0
- package/dist/alerts/plugin.d.ts +58 -0
- package/dist/audit/index.d.ts +33 -0
- package/dist/audit/index.js +60 -0
- package/dist/benchmarks/index.d.ts +29 -0
- package/dist/benchmarks/index.js +70 -0
- package/dist/budget/index.d.ts +21 -0
- package/dist/budget/index.js +50 -0
- package/dist/cache/index.d.ts +31 -0
- package/dist/cache/index.js +11 -0
- package/dist/cards/content.d.ts +43 -0
- package/dist/cards/copy-cards.d.ts +2 -0
- package/dist/cards/format.d.ts +39 -0
- package/dist/cards/index.d.ts +9 -0
- package/dist/cards/index.js +2070 -0
- package/dist/cards/notify-cards.d.ts +14 -0
- package/dist/cards/ops-cards.d.ts +2 -0
- package/dist/cards/parts.d.ts +22 -0
- package/dist/cards/people-cards.d.ts +2 -0
- package/dist/cards/render.d.ts +28 -0
- package/dist/cards/sender-cards.d.ts +2 -0
- package/dist/cards/slack-rich.d.ts +19 -0
- package/dist/cards/slack-text.d.ts +10 -0
- package/dist/cards/slack.d.ts +21 -0
- package/dist/cards/spec.d.ts +86 -0
- package/dist/cards/tool-cards.d.ts +4 -0
- package/dist/chunks/chunk-4O2HRTTI.js +75 -0
- package/dist/chunks/chunk-7BCYLIDG.js +483 -0
- package/dist/chunks/chunk-B7V6EOAC.js +2273 -0
- package/dist/chunks/chunk-CMQ5ZHLZ.js +25 -0
- package/dist/chunks/chunk-F7MKFVIG.js +43 -0
- package/dist/chunks/chunk-FZF6CLPX.js +232 -0
- package/dist/chunks/chunk-GPEJG34O.js +53 -0
- package/dist/chunks/chunk-HEC7XFFH.js +65 -0
- package/dist/chunks/chunk-IBC52BX3.js +24 -0
- package/dist/chunks/chunk-LNCOGBMI.js +144 -0
- package/dist/chunks/chunk-LOXBLQ3I.js +180 -0
- package/dist/chunks/chunk-NAWZ73QS.js +22 -0
- package/dist/chunks/chunk-OCV66TS2.js +705 -0
- package/dist/chunks/chunk-Q465X22Y.js +548 -0
- package/dist/chunks/chunk-QTB747K4.js +100 -0
- package/dist/chunks/chunk-QZNNCXXD.js +92 -0
- package/dist/chunks/chunk-R6AM4GJR.js +105 -0
- package/dist/chunks/chunk-TIJKJJDW.js +6 -0
- package/dist/chunks/chunk-VURTOVGI.js +61 -0
- package/dist/chunks/chunk-WAM6N4OF.js +269 -0
- package/dist/chunks/chunk-WW746NJF.js +94 -0
- package/dist/chunks/chunk-XC6CZP73.js +80 -0
- package/dist/chunks/chunk-ZGHQYZEH.js +45 -0
- package/dist/cli/bin.d.ts +2 -0
- package/dist/cli/bin.js +34 -0
- package/dist/cli/commands.d.ts +16 -0
- package/dist/cli/index.d.ts +13 -0
- package/dist/cli/index.js +25 -0
- package/dist/cli/mcp.d.ts +14 -0
- package/dist/clients/index.d.ts +2 -0
- package/dist/clients/index.js +107 -0
- package/dist/clients/plugin.d.ts +42 -0
- package/dist/combine/account.d.ts +4 -0
- package/dist/combine/adapter.d.ts +9 -0
- package/dist/combine/index.d.ts +2 -0
- package/dist/combine/index.js +345 -0
- package/dist/combine/route.d.ts +17 -0
- package/dist/exporter/index.d.ts +29 -0
- package/dist/exporter/index.js +77 -0
- package/dist/failover/index.d.ts +11 -0
- package/dist/failover/index.js +45 -0
- package/dist/fixtures/index.d.ts +27 -0
- package/dist/fixtures/index.js +241 -0
- package/dist/fixtures/scrub.d.ts +5 -0
- package/dist/heyreach/account.d.ts +11 -0
- package/dist/heyreach/adapter.d.ts +5 -0
- package/dist/heyreach/capabilities.d.ts +68 -0
- package/dist/heyreach/client.d.ts +20 -0
- package/dist/heyreach/inbox.d.ts +7 -0
- package/dist/heyreach/index.d.ts +18 -0
- package/dist/heyreach/index.js +1708 -0
- package/dist/heyreach/lookup.d.ts +15 -0
- package/dist/heyreach/map-account.d.ts +25 -0
- package/dist/heyreach/map-sequence.d.ts +5 -0
- package/dist/heyreach/map-stats.d.ts +10 -0
- package/dist/heyreach/map.d.ts +35 -0
- package/dist/heyreach/native-organization.d.ts +128 -0
- package/dist/heyreach/native-voice.d.ts +106 -0
- package/dist/heyreach/native.d.ts +496 -0
- package/dist/heyreach/paging.d.ts +7 -0
- package/dist/heyreach/webhooks.d.ts +2 -0
- package/dist/identity/index.d.ts +3 -0
- package/dist/identity/index.js +148 -0
- package/dist/identity/keys.d.ts +9 -0
- package/dist/identity/plugin.d.ts +34 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +119 -0
- package/dist/insights/copy/copy-audit.d.ts +55 -0
- package/dist/insights/copy/copy-checks.d.ts +44 -0
- package/dist/insights/copy/copy-reuse.d.ts +59 -0
- package/dist/insights/copy/index.d.ts +67 -0
- package/dist/insights/copy/reply-timing.d.ts +63 -0
- package/dist/insights/copy/shared.d.ts +53 -0
- package/dist/insights/copy/step-funnel.d.ts +66 -0
- package/dist/insights/copy/variant-test.d.ts +64 -0
- package/dist/insights/define.d.ts +98 -0
- package/dist/insights/index.d.ts +10 -0
- package/dist/insights/index.js +4873 -0
- package/dist/insights/ops/anomalies.d.ts +80 -0
- package/dist/insights/ops/campaign-diagnosis.d.ts +39 -0
- package/dist/insights/ops/campaign-ranking.d.ts +56 -0
- package/dist/insights/ops/channel-mix.d.ts +44 -0
- package/dist/insights/ops/client-report.d.ts +76 -0
- package/dist/insights/ops/diagnosis-checks.d.ts +48 -0
- package/dist/insights/ops/index.d.ts +135 -0
- package/dist/insights/ops/period-comparison.d.ts +86 -0
- package/dist/insights/ops/pipeline-forecast.d.ts +44 -0
- package/dist/insights/ops/shared.d.ts +149 -0
- package/dist/insights/ops/tag-rollup.d.ts +32 -0
- package/dist/insights/people/account-summary.d.ts +68 -0
- package/dist/insights/people/dropped-replies.d.ts +51 -0
- package/dist/insights/people/find.d.ts +18 -0
- package/dist/insights/people/hot-leads.d.ts +67 -0
- package/dist/insights/people/index.d.ts +88 -0
- package/dist/insights/people/lead-collisions.d.ts +43 -0
- package/dist/insights/people/person-summary.d.ts +46 -0
- package/dist/insights/people/personalization-gaps.d.ts +60 -0
- package/dist/insights/people/read.d.ts +40 -0
- package/dist/insights/people/suppression-check.d.ts +53 -0
- package/dist/insights/plugin.d.ts +40 -0
- package/dist/insights/registry.d.ts +335 -0
- package/dist/insights/senders/bounce-watch.d.ts +70 -0
- package/dist/insights/senders/domain-health.d.ts +69 -0
- package/dist/insights/senders/index.d.ts +74 -0
- package/dist/insights/senders/read.d.ts +37 -0
- package/dist/insights/senders/sender-capacity.d.ts +67 -0
- package/dist/insights/senders/sender-load.d.ts +52 -0
- package/dist/insights/senders/settings-audit.d.ts +48 -0
- package/dist/insights/senders/warmup-readiness.d.ts +39 -0
- package/dist/insights/stats.d.ts +45 -0
- package/dist/insights/tools.d.ts +16 -0
- package/dist/insights/types.d.ts +4 -0
- package/dist/instantly/adapter-account.d.ts +5 -0
- package/dist/instantly/adapter-mail.d.ts +3 -0
- package/dist/instantly/adapter.d.ts +7 -0
- package/dist/instantly/capabilities.d.ts +83 -0
- package/dist/instantly/client.d.ts +29 -0
- package/dist/instantly/index.d.ts +20 -0
- package/dist/instantly/index.js +2372 -0
- package/dist/instantly/map-account.d.ts +23 -0
- package/dist/instantly/map-lead.d.ts +18 -0
- package/dist/instantly/map-stats.d.ts +22 -0
- package/dist/instantly/map.d.ts +24 -0
- package/dist/instantly/native-agents-sales.d.ts +161 -0
- package/dist/instantly/native-agents.d.ts +156 -0
- package/dist/instantly/native-campaigns.d.ts +101 -0
- package/dist/instantly/native-leads.d.ts +93 -0
- package/dist/instantly/native-params.d.ts +24 -0
- package/dist/instantly/native-search.d.ts +82 -0
- package/dist/instantly/native-senders.d.ts +182 -0
- package/dist/instantly/native-supersearch.d.ts +149 -0
- package/dist/instantly/native-workspace.d.ts +170 -0
- package/dist/instantly/native.d.ts +1081 -0
- package/dist/instantly/pages.d.ts +29 -0
- package/dist/instantly/stats.d.ts +5 -0
- package/dist/instantly/webhooks.d.ts +2 -0
- package/dist/internal/adapter.d.ts +189 -0
- package/dist/internal/capabilities.d.ts +86 -0
- package/dist/internal/cursor.d.ts +10 -0
- package/dist/internal/engine/budget.d.ts +44 -0
- package/dist/internal/engine/engine.d.ts +45 -0
- package/dist/internal/engine/rate-store.d.ts +25 -0
- package/dist/internal/engine/request.d.ts +27 -0
- package/dist/internal/engine/retry.d.ts +21 -0
- package/dist/internal/engine/runtime.d.ts +13 -0
- package/dist/internal/entities-account.d.ts +135 -0
- package/dist/internal/entities.d.ts +389 -0
- package/dist/internal/env.d.ts +4 -0
- package/dist/internal/errors.d.ts +57 -0
- package/dist/internal/hooks.d.ts +55 -0
- package/dist/internal/json.d.ts +40 -0
- package/dist/internal/limits.d.ts +34 -0
- package/dist/internal/metrics.d.ts +52 -0
- package/dist/internal/native.d.ts +66 -0
- package/dist/internal/outbound/api.d.ts +267 -0
- package/dist/internal/outbound/collections.d.ts +31 -0
- package/dist/internal/outbound/core.d.ts +36 -0
- package/dist/internal/outbound/create.d.ts +16 -0
- package/dist/internal/outbound/handles.d.ts +7 -0
- package/dist/internal/outbound/native.d.ts +4 -0
- package/dist/internal/outbound/operation-shared.d.ts +28 -0
- package/dist/internal/outbound/operations-account.d.ts +29 -0
- package/dist/internal/outbound/operations.d.ts +42 -0
- package/dist/internal/outbound/outbound.d.ts +64 -0
- package/dist/internal/outbound/plugins.d.ts +40 -0
- package/dist/internal/outbound/raw.d.ts +9 -0
- package/dist/internal/outbound/specs-account.d.ts +16 -0
- package/dist/internal/outbound/specs.d.ts +14 -0
- package/dist/internal/outbound/stats.d.ts +7 -0
- package/dist/internal/outbound/validate.d.ts +5 -0
- package/dist/internal/outbound/walker.d.ts +22 -0
- package/dist/internal/record.d.ts +19 -0
- package/dist/internal/redact.d.ts +18 -0
- package/dist/internal/ref.d.ts +16 -0
- package/dist/internal/sha256.d.ts +4 -0
- package/dist/internal/text.d.ts +11 -0
- package/dist/internal/url.d.ts +9 -0
- package/dist/loader/index.d.ts +12 -0
- package/dist/loader/index.js +12 -0
- package/dist/memory/account-reads.d.ts +5 -0
- package/dist/memory/account.d.ts +67 -0
- package/dist/memory/adapter.d.ts +16 -0
- package/dist/memory/data.d.ts +122 -0
- package/dist/memory/demo.d.ts +7 -0
- package/dist/memory/index.d.ts +5 -0
- package/dist/memory/index.js +792 -0
- package/dist/memory/stats.d.ts +6 -0
- package/dist/memory/store.d.ts +18 -0
- package/dist/providers/index.d.ts +22 -0
- package/dist/providers/index.js +10 -0
- package/dist/reconcile/index.d.ts +2 -0
- package/dist/reconcile/index.js +72 -0
- package/dist/reconcile/plugin.d.ts +55 -0
- package/dist/redact/index.d.ts +2 -0
- package/dist/redact/index.js +192 -0
- package/dist/redact/plugin.d.ts +22 -0
- package/dist/redis/index.d.ts +41 -0
- package/dist/redis/index.js +114 -0
- package/dist/smartlead/account.d.ts +5 -0
- package/dist/smartlead/adapter.d.ts +5 -0
- package/dist/smartlead/capabilities.d.ts +85 -0
- package/dist/smartlead/client.d.ts +23 -0
- package/dist/smartlead/hmac.d.ts +9 -0
- package/dist/smartlead/index.d.ts +17 -0
- package/dist/smartlead/index.js +2170 -0
- package/dist/smartlead/leads.d.ts +6 -0
- package/dist/smartlead/lookup.d.ts +8 -0
- package/dist/smartlead/mail.d.ts +5 -0
- package/dist/smartlead/map-account.d.ts +22 -0
- package/dist/smartlead/map-messages.d.ts +31 -0
- package/dist/smartlead/map-stats.d.ts +37 -0
- package/dist/smartlead/map.d.ts +52 -0
- package/dist/smartlead/native-analytics.d.ts +242 -0
- package/dist/smartlead/native-campaigns.d.ts +211 -0
- package/dist/smartlead/native-inbox.d.ts +141 -0
- package/dist/smartlead/native-params.d.ts +33 -0
- package/dist/smartlead/native-services.d.ts +204 -0
- package/dist/smartlead/native.d.ts +785 -0
- package/dist/smartlead/shared.d.ts +28 -0
- package/dist/smartlead/stats.d.ts +5 -0
- package/dist/smartlead/webhooks.d.ts +2 -0
- package/dist/sync/index.d.ts +2 -0
- package/dist/sync/index.js +158 -0
- package/dist/sync/plugin.d.ts +58 -0
- package/dist/tools/account-tools.d.ts +21 -0
- package/dist/tools/ai-sdk.d.ts +8 -0
- package/dist/tools/ai-sdk.js +26 -0
- package/dist/tools/campaign-tools.d.ts +59 -0
- package/dist/tools/claude-agent.d.ts +18 -0
- package/dist/tools/claude-agent.js +40 -0
- package/dist/tools/index.d.ts +28 -0
- package/dist/tools/index.js +20 -0
- package/dist/tools/people-tools.d.ts +19 -0
- package/dist/tools/registry.d.ts +34 -0
- package/dist/tools/shared.d.ts +75 -0
- package/dist/tracing/index.d.ts +25 -0
- package/dist/tracing/index.js +69 -0
- package/dist/webhooks/index.d.ts +3 -0
- package/dist/webhooks/index.js +226 -0
- package/dist/webhooks/parse.d.ts +41 -0
- package/dist/webhooks/secret.d.ts +4 -0
- package/package.json +181 -4
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { Campaign, CampaignStatus } from "../../internal/entities.ts";
|
|
3
|
+
import type { MetricCounts } from "../../internal/metrics.ts";
|
|
4
|
+
import type { ListAll } from "../../internal/outbound/api.ts";
|
|
5
|
+
import type { InsightContext } from "../define.ts";
|
|
6
|
+
/** The UTC day of a time, as `YYYY-MM-DD`. */
|
|
7
|
+
export declare const dayOf: (time: number) => string;
|
|
8
|
+
/** The day `days` after `day` (before it when negative). */
|
|
9
|
+
export declare const shiftDay: (day: string, days: number) => string;
|
|
10
|
+
export interface DayRange {
|
|
11
|
+
/** Inclusive `YYYY-MM-DD`. */
|
|
12
|
+
readonly from: string;
|
|
13
|
+
/** Inclusive `YYYY-MM-DD`. */
|
|
14
|
+
readonly to: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The `days` complete UTC days that end yesterday. Today is left out because
|
|
18
|
+
* it is not over. `back` 1 gives the `days` before those.
|
|
19
|
+
*/
|
|
20
|
+
export declare const lastDays: (now: number, days: number, back?: number) => DayRange;
|
|
21
|
+
export interface OpenRange {
|
|
22
|
+
/** Inclusive `YYYY-MM-DD`, or `null` for the start of the vendor's history. */
|
|
23
|
+
readonly from: string | null;
|
|
24
|
+
/** Inclusive `YYYY-MM-DD`, or `null` for today. */
|
|
25
|
+
readonly to: string | null;
|
|
26
|
+
}
|
|
27
|
+
/** Input fields the campaign-listing insights share. */
|
|
28
|
+
export declare const listFields: (costPerCampaign: string) => {
|
|
29
|
+
max_campaigns: z.ZodDefault<z.ZodNumber>;
|
|
30
|
+
statuses: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
31
|
+
active: "active";
|
|
32
|
+
archived: "archived";
|
|
33
|
+
completed: "completed";
|
|
34
|
+
draft: "draft";
|
|
35
|
+
paused: "paused";
|
|
36
|
+
unknown: "unknown";
|
|
37
|
+
}>>>;
|
|
38
|
+
};
|
|
39
|
+
export declare const rangeFields: {
|
|
40
|
+
from: z.ZodDefault<z.ZodNullable<z.ZodISODate>>;
|
|
41
|
+
to: z.ZodDefault<z.ZodNullable<z.ZodISODate>>;
|
|
42
|
+
};
|
|
43
|
+
export interface CampaignLabel {
|
|
44
|
+
/** The campaign's ref. */
|
|
45
|
+
readonly campaign: string;
|
|
46
|
+
readonly name: string;
|
|
47
|
+
readonly status: CampaignStatus;
|
|
48
|
+
readonly channel: "email" | "linkedin";
|
|
49
|
+
readonly provider: string;
|
|
50
|
+
}
|
|
51
|
+
export declare const labelOf: (campaign: Campaign) => CampaignLabel;
|
|
52
|
+
/** The counts every ops answer shows. `null` is a count the vendor does not report. */
|
|
53
|
+
export interface Totals {
|
|
54
|
+
readonly sent: number | null;
|
|
55
|
+
readonly contacted: number | null;
|
|
56
|
+
readonly replied: number | null;
|
|
57
|
+
readonly positive: number | null;
|
|
58
|
+
readonly bounced: number | null;
|
|
59
|
+
}
|
|
60
|
+
export declare const totalsOf: (counts: Totals) => Totals;
|
|
61
|
+
/** A rate with the counts behind it and its 95% Wilson interval. */
|
|
62
|
+
export interface Measured {
|
|
63
|
+
readonly count: number | null;
|
|
64
|
+
/** What the count is divided by. */
|
|
65
|
+
readonly of: number | null;
|
|
66
|
+
readonly rate: number | null;
|
|
67
|
+
readonly low: number | null;
|
|
68
|
+
readonly high: number | null;
|
|
69
|
+
}
|
|
70
|
+
export declare const measure: (count: number | null, of: number | null) => Measured;
|
|
71
|
+
/** What a per-lead rate divides by: leads contacted, or messages sent when the vendor does not count leads. */
|
|
72
|
+
export declare const perLeadBase: (counts: Totals) => number | null;
|
|
73
|
+
export interface Rates {
|
|
74
|
+
/** Replies divided by leads contacted (or messages sent when contacted is unknown). */
|
|
75
|
+
readonly replyRate: Measured;
|
|
76
|
+
/** Positive replies on the same base as the reply rate. */
|
|
77
|
+
readonly positiveRate: Measured;
|
|
78
|
+
/** Bounces divided by messages sent. */
|
|
79
|
+
readonly bounceRate: Measured;
|
|
80
|
+
}
|
|
81
|
+
export declare const ratesOf: (counts: Totals) => Rates;
|
|
82
|
+
/** How many of the rows added up are behind a rate. */
|
|
83
|
+
export interface RateCoverage {
|
|
84
|
+
/** Rows that report both the rate's count and what it divides by. */
|
|
85
|
+
readonly counted: number;
|
|
86
|
+
/** Rows that report either. One that reports neither adds nothing and is not left out of anything. */
|
|
87
|
+
readonly of: number;
|
|
88
|
+
}
|
|
89
|
+
export interface MeasuredAcross extends RateCoverage {
|
|
90
|
+
readonly measured: Measured;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* One rate over several rows (campaigns, or the tools of a combined
|
|
94
|
+
* instance), counting only the rows that report both sides of it: one
|
|
95
|
+
* campaign's bounces over every campaign's sends would understate the rate.
|
|
96
|
+
*/
|
|
97
|
+
export declare const measureAcross: <Row>(rows: readonly Row[], countOf: (row: Row) => number | null, baseOf: (row: Row) => number | null) => MeasuredAcross;
|
|
98
|
+
export interface RatesAcross {
|
|
99
|
+
readonly rates: Rates;
|
|
100
|
+
/** The rates that leave rows out, in words: `bounce rate (1 of 2)`. Empty when every row is in every rate. */
|
|
101
|
+
readonly partial: readonly string[];
|
|
102
|
+
}
|
|
103
|
+
/** Names a rate that leaves rows out, or nothing when every row is in it. */
|
|
104
|
+
export declare const partialRate: (name: string, across: RateCoverage) => string[];
|
|
105
|
+
/** The three rates over several rows of counts, each over the rows that report it. */
|
|
106
|
+
export declare const ratesAcross: (rows: readonly Totals[]) => RatesAcross;
|
|
107
|
+
/** The note for rates that leave rows out. `where` names the group, for example `Tag saas`. */
|
|
108
|
+
export declare const partialNote: (where: string, partial: readonly string[], rows?: string) => string;
|
|
109
|
+
/** How much a campaign sent: messages, or leads contacted when messages are not reported. */
|
|
110
|
+
export declare const volumeOf: (counts: Totals) => number | null;
|
|
111
|
+
/** `0.0525` as `5.3%`. */
|
|
112
|
+
export declare const percent: (value: number | null) => string;
|
|
113
|
+
/** Largest first, with unknown values last. */
|
|
114
|
+
export declare const descending: (left: number | null, right: number | null) => number;
|
|
115
|
+
export interface Capped<Item> {
|
|
116
|
+
readonly items: Item[];
|
|
117
|
+
/** `false` when more records exist than the cap allowed. */
|
|
118
|
+
readonly complete: boolean;
|
|
119
|
+
}
|
|
120
|
+
/** Reads a listing up to `max` records, and says whether `max` cut it short. */
|
|
121
|
+
export declare const readUpTo: <Item>(context: InsightContext, list: (max: number) => ListAll<Item>, max: number) => Promise<Capped<Item>>;
|
|
122
|
+
/**
|
|
123
|
+
* The campaigns in the given states, up to `max`. Asks the vendor per state
|
|
124
|
+
* when it can filter, and filters after reading when it cannot.
|
|
125
|
+
*/
|
|
126
|
+
export declare const readCampaigns: (context: InsightContext, statuses: readonly CampaignStatus[], max: number) => Promise<Campaign[]>;
|
|
127
|
+
/** One campaign's counts over a range, added up. Every count is `null` when the vendor reports nothing. */
|
|
128
|
+
export declare const readTotals: (context: InsightContext, campaign: string, range: OpenRange) => Promise<MetricCounts>;
|
|
129
|
+
export interface CampaignTotals {
|
|
130
|
+
readonly campaign: Campaign;
|
|
131
|
+
readonly counts: MetricCounts;
|
|
132
|
+
}
|
|
133
|
+
export interface ListInput extends OpenRange {
|
|
134
|
+
readonly max_campaigns: number;
|
|
135
|
+
readonly statuses: readonly CampaignStatus[];
|
|
136
|
+
}
|
|
137
|
+
/** Every campaign in the given states with its totals for the range: one stats request each. */
|
|
138
|
+
export declare const readCampaignTotals: (context: InsightContext, input: ListInput) => Promise<CampaignTotals[]>;
|
|
139
|
+
export interface DayCounts {
|
|
140
|
+
/** `YYYY-MM-DD`. */
|
|
141
|
+
readonly date: string;
|
|
142
|
+
readonly counts: MetricCounts;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* One entry per day the vendor reports, oldest first, for a campaign or for
|
|
146
|
+
* the workspace when `campaign` is `null`. Rows of the same day (one per
|
|
147
|
+
* tool on a combined instance) are added together.
|
|
148
|
+
*/
|
|
149
|
+
export declare const readDaily: (context: InsightContext, campaign: string | null, range: DayRange) => Promise<DayCounts[]>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { OpenRange, Rates, Totals } from "./shared.ts";
|
|
2
|
+
/**
|
|
3
|
+
* A tag's counts are every campaign's added up. Each rate counts only the
|
|
4
|
+
* campaigns that report both sides of it, so its `count` and `of` can be
|
|
5
|
+
* smaller than the totals beside it; a note says when.
|
|
6
|
+
*/
|
|
7
|
+
export interface TagGroup extends Totals, Rates {
|
|
8
|
+
/** The tag, or `null` for campaigns that carry none. */
|
|
9
|
+
readonly tag: string | null;
|
|
10
|
+
readonly campaigns: number;
|
|
11
|
+
}
|
|
12
|
+
export interface TagRollup {
|
|
13
|
+
readonly period: OpenRange;
|
|
14
|
+
/** Campaigns read. One with two tags counts in both of its tags. */
|
|
15
|
+
readonly campaigns: number;
|
|
16
|
+
/** Best first, by the low end of the reply rate interval. */
|
|
17
|
+
readonly tags: readonly TagGroup[];
|
|
18
|
+
readonly tooFewSends: readonly TagGroup[];
|
|
19
|
+
}
|
|
20
|
+
export declare const tagRollup: import("../define.ts").InsightDefinition<"tagRollup", {
|
|
21
|
+
min_sent: number;
|
|
22
|
+
max_campaigns: number;
|
|
23
|
+
statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
|
|
24
|
+
from: string | null;
|
|
25
|
+
to: string | null;
|
|
26
|
+
}, TagRollup, {
|
|
27
|
+
min_sent?: number | undefined;
|
|
28
|
+
max_campaigns?: number | undefined;
|
|
29
|
+
statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
|
|
30
|
+
from?: string | null | undefined;
|
|
31
|
+
to?: string | null | undefined;
|
|
32
|
+
}>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export interface AccountRecord {
|
|
2
|
+
readonly lead: string;
|
|
3
|
+
readonly campaign: string | null;
|
|
4
|
+
readonly provider: string;
|
|
5
|
+
readonly status: string;
|
|
6
|
+
/** The vendor's own label, for example `Interested`. */
|
|
7
|
+
readonly interest: string | null;
|
|
8
|
+
readonly opens: number | null;
|
|
9
|
+
readonly clicks: number | null;
|
|
10
|
+
readonly replies: number | null;
|
|
11
|
+
readonly lastContactedAt: string | null;
|
|
12
|
+
readonly lastRepliedAt: string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface AccountPerson {
|
|
15
|
+
readonly email: string;
|
|
16
|
+
readonly name: string | null;
|
|
17
|
+
readonly title: string | null;
|
|
18
|
+
readonly company: string | null;
|
|
19
|
+
/** The campaigns the person is in, as refs. */
|
|
20
|
+
readonly campaigns: readonly string[];
|
|
21
|
+
readonly replied: boolean;
|
|
22
|
+
/** `true` when one of their labels is a positive one. `null` when they carry no label. */
|
|
23
|
+
readonly interested: boolean | null;
|
|
24
|
+
/** Added up over their records. `null` when the vendor reports none. */
|
|
25
|
+
readonly opens: number | null;
|
|
26
|
+
readonly clicks: number | null;
|
|
27
|
+
readonly replies: number | null;
|
|
28
|
+
readonly lastRepliedAt: string | null;
|
|
29
|
+
/** One entry per campaign the person is in. */
|
|
30
|
+
readonly records: readonly AccountRecord[];
|
|
31
|
+
}
|
|
32
|
+
export interface AccountSummary {
|
|
33
|
+
readonly domain: string;
|
|
34
|
+
/** Sorted by most recent reply, then people who replied at an unknown time, then the rest by email. */
|
|
35
|
+
readonly people: readonly AccountPerson[];
|
|
36
|
+
readonly totals: {
|
|
37
|
+
readonly people: number;
|
|
38
|
+
readonly records: number;
|
|
39
|
+
readonly campaigns: number;
|
|
40
|
+
readonly replied: number;
|
|
41
|
+
readonly interested: number;
|
|
42
|
+
/** Leads looked at to find them. */
|
|
43
|
+
readonly leadsRead: number;
|
|
44
|
+
/** Leads with no email address, which a domain cannot match. */
|
|
45
|
+
readonly leadsWithoutEmail: number;
|
|
46
|
+
};
|
|
47
|
+
/** The most recent reply with a known time. `null` when no reply has one. */
|
|
48
|
+
readonly lastReply: {
|
|
49
|
+
readonly email: string;
|
|
50
|
+
readonly name: string | null;
|
|
51
|
+
readonly lead: string;
|
|
52
|
+
readonly campaign: string | null;
|
|
53
|
+
readonly at: string;
|
|
54
|
+
} | null;
|
|
55
|
+
}
|
|
56
|
+
export declare const accountSummary: import("../define.ts").InsightDefinition<"accountSummary", {
|
|
57
|
+
allow_free_domains: boolean;
|
|
58
|
+
domain: string;
|
|
59
|
+
max_campaigns: number;
|
|
60
|
+
max_leads: number;
|
|
61
|
+
positive_labels: string[];
|
|
62
|
+
}, AccountSummary, {
|
|
63
|
+
domain: string;
|
|
64
|
+
allow_free_domains?: boolean | undefined;
|
|
65
|
+
max_campaigns?: number | undefined;
|
|
66
|
+
max_leads?: number | undefined;
|
|
67
|
+
positive_labels?: string[] | undefined;
|
|
68
|
+
}>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface DroppedReply {
|
|
2
|
+
/** The oldest reply in the conversation that got no answer. */
|
|
3
|
+
readonly reply: string;
|
|
4
|
+
readonly lead: string | null;
|
|
5
|
+
readonly campaign: string | null;
|
|
6
|
+
readonly channel: "email" | "linkedin";
|
|
7
|
+
readonly provider: string;
|
|
8
|
+
readonly category: string;
|
|
9
|
+
readonly subject: string | null;
|
|
10
|
+
readonly receivedAt: string;
|
|
11
|
+
readonly hoursWaiting: number;
|
|
12
|
+
/** Replies in the conversation since the last message sent to the person. */
|
|
13
|
+
readonly unansweredReplies: number;
|
|
14
|
+
/** Whether the conversation was read by its thread or by the lead's timeline. */
|
|
15
|
+
readonly checkedBy: "thread" | "timeline";
|
|
16
|
+
readonly finding: string;
|
|
17
|
+
}
|
|
18
|
+
export interface DroppedReplies {
|
|
19
|
+
/** Longest waiting first. */
|
|
20
|
+
readonly dropped: readonly DroppedReply[];
|
|
21
|
+
readonly totals: {
|
|
22
|
+
readonly repliesRead: number;
|
|
23
|
+
/** Left out for a category that needs no answer. */
|
|
24
|
+
readonly skippedByCategory: number;
|
|
25
|
+
/** Left out because the vendor marks them as automatic. */
|
|
26
|
+
readonly skippedAuto: number;
|
|
27
|
+
/** Conversations the remaining replies belong to. */
|
|
28
|
+
readonly conversations: number;
|
|
29
|
+
readonly answered: number;
|
|
30
|
+
readonly dropped: number;
|
|
31
|
+
/** Unanswered, but waiting less than `older_than_hours`. */
|
|
32
|
+
readonly tooRecent: number;
|
|
33
|
+
/** Could not be checked: no thread or lead to read, or no time on the reply. Not counted as dropped. */
|
|
34
|
+
readonly unchecked: number;
|
|
35
|
+
};
|
|
36
|
+
readonly since: string;
|
|
37
|
+
readonly olderThanHours: number;
|
|
38
|
+
}
|
|
39
|
+
export declare const droppedReplies: import("../define.ts").InsightDefinition<"droppedReplies", {
|
|
40
|
+
categories: ("unknown" | "bounce" | "negative" | "neutral" | "ooo" | "positive" | "unsubscribe")[];
|
|
41
|
+
include_auto: boolean;
|
|
42
|
+
max_replies: number;
|
|
43
|
+
older_than_hours: number;
|
|
44
|
+
since: string | null;
|
|
45
|
+
}, DroppedReplies, {
|
|
46
|
+
categories?: ("unknown" | "bounce" | "negative" | "neutral" | "ooo" | "positive" | "unsubscribe")[] | undefined;
|
|
47
|
+
include_auto?: boolean | undefined;
|
|
48
|
+
max_replies?: number | undefined;
|
|
49
|
+
older_than_hours?: number | undefined;
|
|
50
|
+
since?: string | null | undefined;
|
|
51
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Lead } from "../../internal/entities.ts";
|
|
2
|
+
import type { InsightContext } from "../define.ts";
|
|
3
|
+
/** `email:<address>` or `linkedin:<slug>`, or `null` when the text is neither. */
|
|
4
|
+
export declare const personKey: (identifier: string) => string | null;
|
|
5
|
+
/** Every exact identifier a lead carries. */
|
|
6
|
+
export declare const keysOfLead: (lead: Lead) => string[];
|
|
7
|
+
export interface FoundPerson {
|
|
8
|
+
/** Every identifier the matching records carry, sorted. */
|
|
9
|
+
readonly keys: readonly string[];
|
|
10
|
+
/** One record per campaign the person is in. */
|
|
11
|
+
readonly records: readonly Lead[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Asks the vendor for the person by each identifier. A record that carries a
|
|
15
|
+
* second identifier is looked up under that one too, so an email address can
|
|
16
|
+
* lead to a LinkedIn record. Needs `leads.lookup`.
|
|
17
|
+
*/
|
|
18
|
+
export declare const findPerson: (context: InsightContext, identifier: string, maxRecords: number) => Promise<FoundPerson>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** Points per signal. `null` when the vendor reports nothing for that signal. */
|
|
2
|
+
export interface HotLeadParts {
|
|
3
|
+
readonly interest: number | null;
|
|
4
|
+
readonly replies: number | null;
|
|
5
|
+
readonly clicks: number | null;
|
|
6
|
+
readonly opens: number | null;
|
|
7
|
+
readonly recency: number | null;
|
|
8
|
+
}
|
|
9
|
+
export interface HotLead {
|
|
10
|
+
readonly lead: string;
|
|
11
|
+
readonly email: string | null;
|
|
12
|
+
readonly linkedinUrl: string | null;
|
|
13
|
+
readonly name: string | null;
|
|
14
|
+
readonly title: string | null;
|
|
15
|
+
readonly company: string | null;
|
|
16
|
+
readonly campaign: string | null;
|
|
17
|
+
readonly status: string;
|
|
18
|
+
readonly interest: string | null;
|
|
19
|
+
/** The sum of the known parts. */
|
|
20
|
+
readonly score: number;
|
|
21
|
+
readonly parts: HotLeadParts;
|
|
22
|
+
readonly replies: number | null;
|
|
23
|
+
readonly clicks: number | null;
|
|
24
|
+
readonly opens: number | null;
|
|
25
|
+
readonly lastRepliedAt: string | null;
|
|
26
|
+
readonly reason: string;
|
|
27
|
+
}
|
|
28
|
+
export interface HotLeads {
|
|
29
|
+
/** Highest score first, then most recent reply. Only leads that scored above 0. */
|
|
30
|
+
readonly leads: readonly HotLead[];
|
|
31
|
+
readonly totals: {
|
|
32
|
+
readonly leadsRead: number;
|
|
33
|
+
/** Leads with at least one known signal. */
|
|
34
|
+
readonly scored: number;
|
|
35
|
+
/** Scored leads with a score above 0, before `limit`. */
|
|
36
|
+
readonly hot: number;
|
|
37
|
+
/** Leads the vendor reports no label and no engagement for. Left out, not scored 0. */
|
|
38
|
+
readonly withoutData: number;
|
|
39
|
+
/** Unsubscribed or bounced leads, left out. */
|
|
40
|
+
readonly excluded: number;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export declare const hotLeads: import("../define.ts").InsightDefinition<"hotLeads", {
|
|
44
|
+
campaign: string | null;
|
|
45
|
+
count_cap: number;
|
|
46
|
+
limit: number;
|
|
47
|
+
max_leads: number;
|
|
48
|
+
positive_labels: string[];
|
|
49
|
+
recency_days: number;
|
|
50
|
+
weight_click: number;
|
|
51
|
+
weight_interest: number;
|
|
52
|
+
weight_open: number;
|
|
53
|
+
weight_recency: number;
|
|
54
|
+
weight_reply: number;
|
|
55
|
+
}, HotLeads, {
|
|
56
|
+
campaign?: string | null | undefined;
|
|
57
|
+
count_cap?: number | undefined;
|
|
58
|
+
limit?: number | undefined;
|
|
59
|
+
max_leads?: number | undefined;
|
|
60
|
+
positive_labels?: string[] | undefined;
|
|
61
|
+
recency_days?: number | undefined;
|
|
62
|
+
weight_click?: number | undefined;
|
|
63
|
+
weight_interest?: number | undefined;
|
|
64
|
+
weight_open?: number | undefined;
|
|
65
|
+
weight_recency?: number | undefined;
|
|
66
|
+
weight_reply?: number | undefined;
|
|
67
|
+
}>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export declare const PEOPLE_INSIGHTS: readonly [import("../define.ts").InsightDefinition<"personSummary", {
|
|
2
|
+
max_campaigns: number;
|
|
3
|
+
person: string;
|
|
4
|
+
}, import("./person-summary.ts").PersonSummary, {
|
|
5
|
+
person: string;
|
|
6
|
+
max_campaigns?: number | undefined;
|
|
7
|
+
}>, import("../define.ts").InsightDefinition<"accountSummary", {
|
|
8
|
+
allow_free_domains: boolean;
|
|
9
|
+
domain: string;
|
|
10
|
+
max_campaigns: number;
|
|
11
|
+
max_leads: number;
|
|
12
|
+
positive_labels: string[];
|
|
13
|
+
}, import("./account-summary.ts").AccountSummary, {
|
|
14
|
+
domain: string;
|
|
15
|
+
allow_free_domains?: boolean | undefined;
|
|
16
|
+
max_campaigns?: number | undefined;
|
|
17
|
+
max_leads?: number | undefined;
|
|
18
|
+
positive_labels?: string[] | undefined;
|
|
19
|
+
}>, import("../define.ts").InsightDefinition<"leadCollisions", {
|
|
20
|
+
max_campaigns: number;
|
|
21
|
+
max_leads_per_campaign: number;
|
|
22
|
+
statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
|
|
23
|
+
}, import("./lead-collisions.ts").LeadCollisions, {
|
|
24
|
+
max_campaigns?: number | undefined;
|
|
25
|
+
max_leads_per_campaign?: number | undefined;
|
|
26
|
+
statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
|
|
27
|
+
}>, import("../define.ts").InsightDefinition<"suppressionCheck", {
|
|
28
|
+
max_block_entries: number;
|
|
29
|
+
max_campaigns: number;
|
|
30
|
+
max_leads_per_campaign: number;
|
|
31
|
+
statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
|
|
32
|
+
}, import("./suppression-check.ts").SuppressionCheck, {
|
|
33
|
+
max_block_entries?: number | undefined;
|
|
34
|
+
max_campaigns?: number | undefined;
|
|
35
|
+
max_leads_per_campaign?: number | undefined;
|
|
36
|
+
statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
|
|
37
|
+
}>, import("../define.ts").InsightDefinition<"droppedReplies", {
|
|
38
|
+
categories: ("unknown" | "bounce" | "negative" | "neutral" | "ooo" | "positive" | "unsubscribe")[];
|
|
39
|
+
include_auto: boolean;
|
|
40
|
+
max_replies: number;
|
|
41
|
+
older_than_hours: number;
|
|
42
|
+
since: string | null;
|
|
43
|
+
}, import("./dropped-replies.ts").DroppedReplies, {
|
|
44
|
+
categories?: ("unknown" | "bounce" | "negative" | "neutral" | "ooo" | "positive" | "unsubscribe")[] | undefined;
|
|
45
|
+
include_auto?: boolean | undefined;
|
|
46
|
+
max_replies?: number | undefined;
|
|
47
|
+
older_than_hours?: number | undefined;
|
|
48
|
+
since?: string | null | undefined;
|
|
49
|
+
}>, import("../define.ts").InsightDefinition<"hotLeads", {
|
|
50
|
+
campaign: string | null;
|
|
51
|
+
count_cap: number;
|
|
52
|
+
limit: number;
|
|
53
|
+
max_leads: number;
|
|
54
|
+
positive_labels: string[];
|
|
55
|
+
recency_days: number;
|
|
56
|
+
weight_click: number;
|
|
57
|
+
weight_interest: number;
|
|
58
|
+
weight_open: number;
|
|
59
|
+
weight_recency: number;
|
|
60
|
+
weight_reply: number;
|
|
61
|
+
}, import("./hot-leads.ts").HotLeads, {
|
|
62
|
+
campaign?: string | null | undefined;
|
|
63
|
+
count_cap?: number | undefined;
|
|
64
|
+
limit?: number | undefined;
|
|
65
|
+
max_leads?: number | undefined;
|
|
66
|
+
positive_labels?: string[] | undefined;
|
|
67
|
+
recency_days?: number | undefined;
|
|
68
|
+
weight_click?: number | undefined;
|
|
69
|
+
weight_interest?: number | undefined;
|
|
70
|
+
weight_open?: number | undefined;
|
|
71
|
+
weight_recency?: number | undefined;
|
|
72
|
+
weight_reply?: number | undefined;
|
|
73
|
+
}>, import("../define.ts").InsightDefinition<"personalizationGaps", {
|
|
74
|
+
campaign: string;
|
|
75
|
+
limit: number;
|
|
76
|
+
max_leads: number;
|
|
77
|
+
}, import("./personalization-gaps.ts").PersonalizationGaps, {
|
|
78
|
+
campaign: string;
|
|
79
|
+
limit?: number | undefined;
|
|
80
|
+
max_leads?: number | undefined;
|
|
81
|
+
}>];
|
|
82
|
+
export type { AccountPerson, AccountRecord, AccountSummary, } from "./account-summary.ts";
|
|
83
|
+
export type { DroppedReplies, DroppedReply } from "./dropped-replies.ts";
|
|
84
|
+
export type { HotLead, HotLeadParts, HotLeads } from "./hot-leads.ts";
|
|
85
|
+
export type { CollisionCampaign, LeadCollision, LeadCollisions, } from "./lead-collisions.ts";
|
|
86
|
+
export type { PersonCampaign, PersonSummary } from "./person-summary.ts";
|
|
87
|
+
export type { CopyVariable, GapLead, PersonalizationGaps, VariableUse, } from "./personalization-gaps.ts";
|
|
88
|
+
export type { SuppressionCampaign, SuppressionCheck, SuppressionMatch, SuppressionViolation, } from "./suppression-check.ts";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface CollisionCampaign {
|
|
2
|
+
readonly campaign: string;
|
|
3
|
+
readonly campaignName: string;
|
|
4
|
+
readonly channel: "email" | "linkedin";
|
|
5
|
+
readonly provider: string;
|
|
6
|
+
readonly lead: string;
|
|
7
|
+
readonly leadStatus: string;
|
|
8
|
+
}
|
|
9
|
+
export interface LeadCollision {
|
|
10
|
+
/** Every exact identifier the person's records carry, as `email:` or `linkedin:` keys. */
|
|
11
|
+
readonly identifiers: readonly string[];
|
|
12
|
+
readonly campaignCount: number;
|
|
13
|
+
/** Campaigns in which the lead's own status is still `active`. */
|
|
14
|
+
readonly stillActive: number;
|
|
15
|
+
/** `across_tools` when the campaigns are in more than one tool, otherwise `within_tool`. */
|
|
16
|
+
readonly scope: "across_tools" | "within_tool";
|
|
17
|
+
readonly providers: readonly string[];
|
|
18
|
+
readonly channels: readonly string[];
|
|
19
|
+
readonly campaigns: readonly CollisionCampaign[];
|
|
20
|
+
readonly finding: string;
|
|
21
|
+
}
|
|
22
|
+
export interface LeadCollisions {
|
|
23
|
+
/** Most campaigns first, then collisions across tools, then by identifier. */
|
|
24
|
+
readonly collisions: readonly LeadCollision[];
|
|
25
|
+
readonly totals: {
|
|
26
|
+
readonly collisions: number;
|
|
27
|
+
readonly acrossTools: number;
|
|
28
|
+
readonly withinTool: number;
|
|
29
|
+
readonly campaignsRead: number;
|
|
30
|
+
readonly leadsRead: number;
|
|
31
|
+
/** Leads with neither an email address nor a LinkedIn profile, which cannot be matched. */
|
|
32
|
+
readonly leadsWithoutIdentifier: number;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export declare const leadCollisions: import("../define.ts").InsightDefinition<"leadCollisions", {
|
|
36
|
+
max_campaigns: number;
|
|
37
|
+
max_leads_per_campaign: number;
|
|
38
|
+
statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
|
|
39
|
+
}, LeadCollisions, {
|
|
40
|
+
max_campaigns?: number | undefined;
|
|
41
|
+
max_leads_per_campaign?: number | undefined;
|
|
42
|
+
statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
|
|
43
|
+
}>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface PersonCampaign {
|
|
2
|
+
readonly campaign: string | null;
|
|
3
|
+
readonly campaignName: string | null;
|
|
4
|
+
readonly campaignStatus: string | null;
|
|
5
|
+
readonly channel: "email" | "linkedin";
|
|
6
|
+
readonly provider: string;
|
|
7
|
+
readonly lead: string;
|
|
8
|
+
readonly leadStatus: string;
|
|
9
|
+
/** The vendor's own label, for example `Interested`. */
|
|
10
|
+
readonly interest: string | null;
|
|
11
|
+
readonly messagesSent: number;
|
|
12
|
+
readonly replies: number;
|
|
13
|
+
readonly replied: boolean;
|
|
14
|
+
/** Steps the person replied to, counted from 0. Empty when the vendor does not tie a reply to a step. */
|
|
15
|
+
readonly repliedSteps: readonly number[];
|
|
16
|
+
/** The last step sent, counted from 0. */
|
|
17
|
+
readonly lastStep: number | null;
|
|
18
|
+
readonly firstContactedAt: string | null;
|
|
19
|
+
readonly lastContactedAt: string | null;
|
|
20
|
+
readonly lastRepliedAt: string | null;
|
|
21
|
+
}
|
|
22
|
+
export interface PersonSummary {
|
|
23
|
+
readonly found: boolean;
|
|
24
|
+
/** Every exact identifier the records carry, as `email:` or `linkedin:` keys. */
|
|
25
|
+
readonly identifiers: readonly string[];
|
|
26
|
+
readonly campaigns: readonly PersonCampaign[];
|
|
27
|
+
readonly totals: {
|
|
28
|
+
readonly campaigns: number;
|
|
29
|
+
readonly campaignsReplied: number;
|
|
30
|
+
/** Campaigns they replied in, divided by campaigns that sent them at least one message. */
|
|
31
|
+
readonly campaignReplyRate: number | null;
|
|
32
|
+
readonly messagesSent: number;
|
|
33
|
+
readonly replies: number;
|
|
34
|
+
readonly byChannel: Readonly<Record<string, {
|
|
35
|
+
readonly messagesSent: number;
|
|
36
|
+
readonly replies: number;
|
|
37
|
+
}>>;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export declare const personSummary: import("../define.ts").InsightDefinition<"personSummary", {
|
|
41
|
+
max_campaigns: number;
|
|
42
|
+
person: string;
|
|
43
|
+
}, PersonSummary, {
|
|
44
|
+
person: string;
|
|
45
|
+
max_campaigns?: number | undefined;
|
|
46
|
+
}>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export interface VariableUse {
|
|
2
|
+
/** The step, counted from 0. */
|
|
3
|
+
readonly step: number;
|
|
4
|
+
readonly variant: string;
|
|
5
|
+
readonly field: "body" | "subject";
|
|
6
|
+
readonly fallback: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface CopyVariable {
|
|
9
|
+
/** The name as the copy writes it the first time. */
|
|
10
|
+
readonly name: string;
|
|
11
|
+
/**
|
|
12
|
+
* `builtin` for first name, last name, company, title and email; `custom`
|
|
13
|
+
* when a lead read has a custom field of that name; `unknown` when no
|
|
14
|
+
* lead read has it, which is a sender or system variable the tool fills
|
|
15
|
+
* itself, or a field nobody has.
|
|
16
|
+
*/
|
|
17
|
+
readonly source: "builtin" | "custom" | "unknown";
|
|
18
|
+
/** `false` when every use has a fallback, or the source is unknown. */
|
|
19
|
+
readonly gap: boolean;
|
|
20
|
+
readonly steps: readonly number[];
|
|
21
|
+
readonly uses: readonly VariableUse[];
|
|
22
|
+
/** Leads read with no value for it. `null` for an unknown variable. */
|
|
23
|
+
readonly leadsWithoutValue: number | null;
|
|
24
|
+
/** Leads who get broken copy from it: 0 when every use has a fallback. `null` for an unknown variable. */
|
|
25
|
+
readonly leadsAffected: number | null;
|
|
26
|
+
}
|
|
27
|
+
export interface GapLead {
|
|
28
|
+
readonly lead: string;
|
|
29
|
+
readonly email: string | null;
|
|
30
|
+
readonly linkedinUrl: string | null;
|
|
31
|
+
readonly status: string;
|
|
32
|
+
/** The variables with no value and no fallback, as the copy writes them. */
|
|
33
|
+
readonly missing: readonly string[];
|
|
34
|
+
}
|
|
35
|
+
export interface PersonalizationGaps {
|
|
36
|
+
readonly campaign: string;
|
|
37
|
+
/** Most leads affected first. */
|
|
38
|
+
readonly variables: readonly CopyVariable[];
|
|
39
|
+
/** Leads missing at least one variable, most missing first, up to `limit`. */
|
|
40
|
+
readonly leads: readonly GapLead[];
|
|
41
|
+
/** Variables no lead read has a value for and that are not built in. Check them by hand. */
|
|
42
|
+
readonly unknownVariables: readonly string[];
|
|
43
|
+
readonly totals: {
|
|
44
|
+
readonly steps: number;
|
|
45
|
+
readonly variables: number;
|
|
46
|
+
readonly leadsRead: number;
|
|
47
|
+
readonly leadsAffected: number;
|
|
48
|
+
/** Affected leads divided by leads read. `null` when no lead was read. */
|
|
49
|
+
readonly affectedRate: number | null;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export declare const personalizationGaps: import("../define.ts").InsightDefinition<"personalizationGaps", {
|
|
53
|
+
campaign: string;
|
|
54
|
+
limit: number;
|
|
55
|
+
max_leads: number;
|
|
56
|
+
}, PersonalizationGaps, {
|
|
57
|
+
campaign: string;
|
|
58
|
+
limit?: number | undefined;
|
|
59
|
+
max_leads?: number | undefined;
|
|
60
|
+
}>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { Campaign, CampaignStatus, Lead } from "../../internal/entities.ts";
|
|
3
|
+
import type { ListAll } from "../../internal/outbound/api.ts";
|
|
4
|
+
import type { InsightContext } from "../define.ts";
|
|
5
|
+
/** Reads at most `max` records, and says so in a note when more exist. */
|
|
6
|
+
export declare const readCapped: <Item>(context: InsightContext, open: (max: number) => ListAll<Item>, max: number, what: string) => Promise<Item[]>;
|
|
7
|
+
export declare const statusesField: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
8
|
+
active: "active";
|
|
9
|
+
archived: "archived";
|
|
10
|
+
completed: "completed";
|
|
11
|
+
draft: "draft";
|
|
12
|
+
paused: "paused";
|
|
13
|
+
unknown: "unknown";
|
|
14
|
+
}>>>;
|
|
15
|
+
/**
|
|
16
|
+
* Campaigns in the given statuses, up to `max`. Without a status filter on
|
|
17
|
+
* the adapter the first `max` campaigns are read and filtered here.
|
|
18
|
+
*/
|
|
19
|
+
export declare const campaignsIn: (context: InsightContext, statuses: readonly CampaignStatus[], max: number) => Promise<Campaign[]>;
|
|
20
|
+
/** The leads of one campaign, up to `max`. Needs `leads.byCampaign`. */
|
|
21
|
+
export declare const leadsOf: (context: InsightContext, campaign: string, max: number) => Promise<Lead[]>;
|
|
22
|
+
/** First and last name joined, or `null` when the vendor has neither. */
|
|
23
|
+
export declare const nameOf: (lead: Lead) => string | null;
|
|
24
|
+
/** The part of an email address after the `@`, or `null`. */
|
|
25
|
+
export declare const domainOf: (email: string | null) => string | null;
|
|
26
|
+
export declare const DEFAULT_POSITIVE_LABELS: string[];
|
|
27
|
+
export declare const positiveLabelsField: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
28
|
+
/** `null` when the lead has no label, so "not interested" is never guessed. */
|
|
29
|
+
export declare const isPositive: (label: string | null, labels: readonly string[]) => boolean | null;
|
|
30
|
+
/** Whether the vendor says the lead replied: a status, a count or a time. */
|
|
31
|
+
export declare const hasReplied: (lead: Lead) => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Says which records lack open, click and reply counts, and only when some
|
|
34
|
+
* do. One tool: the adapter's own declaration decides. A combined instance
|
|
35
|
+
* lacks `leads.engagement` as soon as one tool does, although the others
|
|
36
|
+
* still fill the counts, so there each tool is judged by the records read
|
|
37
|
+
* and the ones with no counts on any lead are named. `effect` finishes the
|
|
38
|
+
* sentence, for example `those are null`.
|
|
39
|
+
*/
|
|
40
|
+
export declare const noteEngagement: (context: InsightContext, leads: readonly Lead[], effect: string) => void;
|