outbound-sdk 0.11.0 → 0.13.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/dist/alerts/index.js +1 -1
- package/dist/budget/index.js +1 -1
- package/dist/cards/index.js +217 -100
- package/dist/cards/sender-tool-cards.d.ts +6 -0
- package/dist/chunks/{chunk-UAHYPASH.js → chunk-3LRIWQEJ.js} +2 -1
- package/dist/chunks/{chunk-UZLFZZ2U.js → chunk-6BSFR5SF.js} +14 -2
- package/dist/chunks/{chunk-FTK4JS65.js → chunk-BTIJ24UY.js} +89 -9
- package/dist/chunks/{chunk-OVTYA3IB.js → chunk-EAG5NIPM.js} +614 -206
- package/dist/chunks/{chunk-A7DLJUA6.js → chunk-FT6HMMMP.js} +3 -1
- package/dist/chunks/chunk-I7GBBHD2.js +80 -0
- package/dist/chunks/{chunk-UOJG4VYF.js → chunk-LD5OAELW.js} +1 -1
- package/dist/chunks/{chunk-KMQHXFIZ.js → chunk-LJNU4LAR.js} +2094 -1014
- package/dist/chunks/{chunk-POBAY3TI.js → chunk-NLYGMVXS.js} +30 -0
- package/dist/chunks/{chunk-V7JKTNRO.js → chunk-OE45PREW.js} +1 -1
- package/dist/chunks/{chunk-MEEJIIIA.js → chunk-OP2GL7ZT.js} +77 -8
- package/dist/chunks/{chunk-YFJ3OQZS.js → chunk-OPLXELPS.js} +5 -1
- package/dist/chunks/{chunk-CVLGFVDC.js → chunk-PDYE6CWS.js} +136 -64
- package/dist/chunks/{chunk-OMCDMELK.js → chunk-PUIHJFK4.js} +1 -1
- package/dist/chunks/{chunk-MPE6VLLY.js → chunk-UZ4YWUZ7.js} +1 -1
- package/dist/chunks/{tools-AVJ3XJ5A.js → tools-VCCH3JNL.js} +13 -6
- package/dist/cli/bin.js +11 -10
- package/dist/cli/config.d.ts +0 -2
- package/dist/cli/index.js +10 -9
- package/dist/cli/offered.d.ts +31 -2
- package/dist/cli/serve.d.ts +4 -2
- package/dist/combine/index.js +60 -4
- package/dist/emailbison/index.js +4 -4
- package/dist/fixtures/index.js +4 -4
- package/dist/heyreach/index.js +17 -6
- package/dist/identity/index.js +46 -11
- package/dist/identity/keys.d.ts +1 -1
- package/dist/index.js +8 -6
- package/dist/insights/capped.d.ts +14 -1
- package/dist/insights/define.d.ts +8 -6
- package/dist/insights/index.d.ts +1 -1
- package/dist/insights/index.js +12 -61
- package/dist/insights/inputs.generated.d.ts +91 -16
- package/dist/insights/ops/campaign-ranking.d.ts +8 -1
- package/dist/insights/ops/channel-mix.d.ts +8 -1
- package/dist/insights/ops/client-report.d.ts +28 -18
- package/dist/insights/ops/client-runway.d.ts +43 -0
- package/dist/insights/ops/index.d.ts +6 -1
- package/dist/insights/ops/period-comparison.d.ts +35 -2
- package/dist/insights/ops/pipeline-forecast.d.ts +14 -9
- package/dist/insights/ops/shared.d.ts +49 -2
- package/dist/insights/ops/tag-rollup.d.ts +8 -1
- package/dist/insights/people/coverage.d.ts +26 -0
- package/dist/insights/people/dropped-replies-check.d.ts +19 -3
- package/dist/insights/people/dropped-replies.d.ts +6 -2
- package/dist/insights/people/find.d.ts +5 -4
- package/dist/insights/people/hot-leads.d.ts +10 -1
- package/dist/insights/people/index.d.ts +26 -2
- package/dist/insights/people/lead-collisions.d.ts +18 -1
- package/dist/insights/people/person-summary.d.ts +15 -3
- package/dist/insights/people/suppression-check.d.ts +18 -1
- package/dist/insights/people/thread-context.d.ts +79 -0
- package/dist/insights/people/thread-contexts.d.ts +59 -0
- package/dist/insights/people/thread-read.d.ts +33 -0
- package/dist/insights/registry.d.ts +29 -3
- package/dist/insights/senders/domain-health.d.ts +1 -1
- package/dist/insights/senders/index.d.ts +1 -1
- package/dist/insights/senders/read.d.ts +9 -0
- package/dist/insights/tools.d.ts +35 -2
- package/dist/instantly/adapter.d.ts +3 -2
- package/dist/instantly/capabilities.d.ts +5 -0
- package/dist/instantly/index.js +255 -66
- package/dist/instantly/lead-ids.d.ts +11 -0
- package/dist/instantly/map-lead.d.ts +19 -2
- package/dist/instantly/senders.d.ts +3 -0
- package/dist/internal/adapter.d.ts +7 -0
- package/dist/internal/capabilities.d.ts +8 -0
- package/dist/internal/entities.d.ts +24 -1
- package/dist/internal/fields.d.ts +10 -0
- package/dist/internal/outbound/api.d.ts +12 -0
- package/dist/internal/outbound/operations-account.d.ts +4 -1
- package/dist/internal/outbound/outbound.d.ts +2 -1
- package/dist/internal/outbound/specs-account.d.ts +2 -1
- package/dist/internal/person.d.ts +32 -0
- package/dist/internal/records.d.ts +2 -2
- package/dist/internal/reply-people.d.ts +25 -7
- package/dist/internal/runway.d.ts +38 -5
- package/dist/internal/url.d.ts +2 -1
- package/dist/loader/index.js +1 -1
- package/dist/memory/data.d.ts +2 -1
- package/dist/memory/index.js +6 -4
- package/dist/redact/index.d.ts +1 -1
- package/dist/redact/index.js +62 -31
- package/dist/redact/plugin.d.ts +13 -11
- package/dist/redact/tokens.d.ts +18 -1
- package/dist/smartlead/index.js +21 -7
- package/dist/tools/account-tools.d.ts +0 -5
- package/dist/tools/ai-sdk.js +5 -3
- package/dist/tools/campaign-tools.d.ts +0 -4
- package/dist/tools/claude-agent.js +5 -3
- package/dist/tools/deliverability-check.d.ts +9 -0
- package/dist/tools/index.js +6 -4
- package/dist/tools/people-tools.d.ts +4 -1
- package/dist/tools/person-input.d.ts +17 -0
- package/dist/tools/registry.d.ts +8 -1
- package/dist/tools/sender-health.d.ts +8 -0
- package/dist/tools/sender-impact.d.ts +38 -0
- package/dist/tools/shared.d.ts +5 -0
- package/dist/webhooks/index.js +6 -6
- package/package.json +1 -1
- /package/dist/chunks/{chunk-5XLR6XVV.js → chunk-HNYJO6B4.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { Campaign, CampaignStatus } from "../../internal/entities.ts";
|
|
3
3
|
import type { MetricCounts } from "../../internal/metrics.ts";
|
|
4
|
-
import type { CampaignsRead } from "../capped.ts";
|
|
4
|
+
import type { CampaignsRead, SkippedTool } from "../capped.ts";
|
|
5
5
|
import type { Price } from "../cost.ts";
|
|
6
6
|
import type { InsightContext } from "../define.ts";
|
|
7
7
|
/** The UTC day of a time, as `YYYY-MM-DD`. */
|
|
@@ -87,6 +87,14 @@ export declare const baseIn: (basis: ReplyBasis) => Base;
|
|
|
87
87
|
/** What a per-lead rate divides by: leads contacted, or messages sent when the vendor does not count leads. */
|
|
88
88
|
export declare const perLeadBasis: (counts: Totals) => ReplyBasis;
|
|
89
89
|
export declare const perLeadBase: Base;
|
|
90
|
+
/**
|
|
91
|
+
* What a rate over several rows divides replies by, the same for every row:
|
|
92
|
+
* leads contacted, unless a row has replies and messages sent but no lead
|
|
93
|
+
* contacted (its leads were first contacted before the range, so only
|
|
94
|
+
* follow-ups went out), when it is messages sent. A row that does not
|
|
95
|
+
* report the basis is left out of the rate, never divided by another count.
|
|
96
|
+
*/
|
|
97
|
+
export declare const replyBasisAcross: (rows: readonly Totals[]) => ReplyBasis;
|
|
90
98
|
/**
|
|
91
99
|
* What two periods divide replies by, the same for both: messages sent when
|
|
92
100
|
* both report them, since replies in a week answer messages sent that week
|
|
@@ -124,13 +132,15 @@ export interface MeasuredAcross extends RateCoverage {
|
|
|
124
132
|
export declare const measureAcross: <Row>(rows: readonly Row[], countOf: (row: Row) => number | null, baseOf: (row: Row) => number | null) => MeasuredAcross;
|
|
125
133
|
export interface RatesAcross {
|
|
126
134
|
readonly rates: Rates;
|
|
135
|
+
/** What the reply and positive reply rates divide by, the same for every row. */
|
|
136
|
+
readonly replyRateBasis: ReplyBasis;
|
|
127
137
|
/** The rates that leave rows out, in words: `bounce rate (1 of 2)`. Empty when every row is in every rate. */
|
|
128
138
|
readonly partial: readonly string[];
|
|
129
139
|
}
|
|
130
140
|
/** Names a rate that leaves rows out, or nothing when every row is in it. */
|
|
131
141
|
export declare const partialRate: (name: string, across: RateCoverage) => string[];
|
|
132
142
|
/** The three rates over several rows of counts, each over the rows that report it. */
|
|
133
|
-
export declare const ratesAcross: (rows: readonly Totals[],
|
|
143
|
+
export declare const ratesAcross: (rows: readonly Totals[], basis?: ReplyBasis) => RatesAcross;
|
|
134
144
|
/** The note for rates that leave rows out. `where` names the group, for example `Tag saas`. */
|
|
135
145
|
export declare const partialNote: (where: string, partial: readonly string[], rows?: string) => string;
|
|
136
146
|
/** How much a campaign sent: messages, or leads contacted when messages are not reported. */
|
|
@@ -146,6 +156,8 @@ export interface CampaignTotals {
|
|
|
146
156
|
export interface EveryCampaignTotals {
|
|
147
157
|
readonly entries: CampaignTotals[];
|
|
148
158
|
readonly read: CampaignsRead;
|
|
159
|
+
/** The tools of a combined instance none of whose campaigns was read. */
|
|
160
|
+
readonly skipped: readonly SkippedTool[];
|
|
149
161
|
}
|
|
150
162
|
export interface ListInput extends OpenRange {
|
|
151
163
|
readonly max_campaigns: number;
|
|
@@ -159,6 +171,41 @@ export interface ListInput extends OpenRange {
|
|
|
159
171
|
* having no counts when it has some.
|
|
160
172
|
*/
|
|
161
173
|
export declare const readCampaignTotals: (context: InsightContext, input: ListInput) => Promise<EveryCampaignTotals>;
|
|
174
|
+
/**
|
|
175
|
+
* A tool of a combined instance left out of the answer because none of its
|
|
176
|
+
* campaigns is in the states asked for, with its own workspace totals for
|
|
177
|
+
* the period, so activity it had there is named rather than lost.
|
|
178
|
+
*/
|
|
179
|
+
export interface ToolLeftOut extends SkippedTool {
|
|
180
|
+
/** The tool's workspace totals for the period. `null` when it has no workspace stats. */
|
|
181
|
+
readonly counts: Totals | null;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* The tools left out, each with its workspace totals for the range: one
|
|
185
|
+
* stats request each. A note names those that sent or got replies in it.
|
|
186
|
+
*/
|
|
187
|
+
export declare const toolsLeftOut: (context: InsightContext, skipped: readonly SkippedTool[], range: OpenRange) => Promise<ToolLeftOut[]>;
|
|
188
|
+
/**
|
|
189
|
+
* What a set of counts covers, so two reply figures that differ can be told
|
|
190
|
+
* apart. `replied` and `positive` count leads, not reply messages, with
|
|
191
|
+
* automatic replies left out of `replied`.
|
|
192
|
+
*/
|
|
193
|
+
export interface CountsBasis {
|
|
194
|
+
/**
|
|
195
|
+
* `campaigns`: the campaigns read, added together, so only those in the
|
|
196
|
+
* states asked for. `workspace`: the vendor's own workspace totals, which
|
|
197
|
+
* count every campaign whatever its state.
|
|
198
|
+
*/
|
|
199
|
+
readonly covers: "campaigns" | "workspace";
|
|
200
|
+
/** `people`: `replied` and `positive` count leads, not reply messages. */
|
|
201
|
+
readonly replies: "people";
|
|
202
|
+
/** Automatic replies are left out of `replied`. */
|
|
203
|
+
readonly autoReplies: "excluded";
|
|
204
|
+
/** The same, in a sentence. */
|
|
205
|
+
readonly description: string;
|
|
206
|
+
}
|
|
207
|
+
export declare const campaignsBasis: (campaigns: number, statuses: readonly string[]) => CountsBasis;
|
|
208
|
+
export declare const WORKSPACE_BASIS: CountsBasis;
|
|
162
209
|
export interface DayCounts {
|
|
163
210
|
/** `YYYY-MM-DD`. */
|
|
164
211
|
readonly date: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CampaignsRead } from "../capped.ts";
|
|
2
|
-
import type { OpenRange, Rates, Totals } from "./shared.ts";
|
|
2
|
+
import type { OpenRange, Rates, ReplyBasis, Totals } from "./shared.ts";
|
|
3
3
|
/**
|
|
4
4
|
* A tag's counts are every campaign's added up. Each rate counts only the
|
|
5
5
|
* campaigns that report both sides of it, so its `count` and `of` can be
|
|
@@ -17,6 +17,13 @@ export interface TagRollup extends CampaignsRead {
|
|
|
17
17
|
/** Best first, by the low end of the reply rate interval. */
|
|
18
18
|
readonly tags: readonly TagGroup[];
|
|
19
19
|
readonly tooFewSends: readonly TagGroup[];
|
|
20
|
+
/**
|
|
21
|
+
* What every reply and positive reply rate divides by: leads contacted, or
|
|
22
|
+
* messages sent when a campaign has replies in the range but contacted no
|
|
23
|
+
* new lead in it.
|
|
24
|
+
* Always set by the insight; optional so a value built by hand stays valid.
|
|
25
|
+
*/
|
|
26
|
+
readonly replyRateBasis?: ReplyBasis;
|
|
20
27
|
}
|
|
21
28
|
export declare const tagRollup: import("../define.ts").InsightDefinition<"tagRollup", {
|
|
22
29
|
min_sent: number;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** One part of the data a cap left unread, and the input that raises it. */
|
|
2
|
+
export interface Gap {
|
|
3
|
+
/** What was read and what was left, for example `20 campaigns, with more unread`. */
|
|
4
|
+
readonly read: string;
|
|
5
|
+
/** The input that raises the cap, or `null` when a request cap stopped the read. */
|
|
6
|
+
readonly input: string | null;
|
|
7
|
+
}
|
|
8
|
+
/** What a check over campaigns read of them and of their leads. */
|
|
9
|
+
export interface CampaignsChecked {
|
|
10
|
+
readonly campaigns: number;
|
|
11
|
+
readonly moreCampaignsExist: boolean;
|
|
12
|
+
/** `true` when a request cap, not `max_campaigns`, stopped the campaign listing. */
|
|
13
|
+
readonly campaignsCut: boolean;
|
|
14
|
+
readonly campaignsWithMoreLeads: number;
|
|
15
|
+
/** Campaigns whose leads a request cap, not `max_leads_per_campaign`, stopped. */
|
|
16
|
+
readonly leadsCut: number;
|
|
17
|
+
readonly maxLeads: number;
|
|
18
|
+
}
|
|
19
|
+
/** The gaps in the campaigns and their leads. */
|
|
20
|
+
export declare const campaignGaps: (read: CampaignsChecked) => Gap[];
|
|
21
|
+
/**
|
|
22
|
+
* What a check left out, or `null` when it covered everything: "The check
|
|
23
|
+
* is incomplete: it read only 20 campaigns, with more in those statuses
|
|
24
|
+
* unread (max_campaigns). Raise max_campaigns to check the rest."
|
|
25
|
+
*/
|
|
26
|
+
export declare const gapsSentence: (gaps: readonly Gap[]) => string | null;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { Message, Reply } from "../../internal/entities.ts";
|
|
2
2
|
import type { InsightContext } from "../define.ts";
|
|
3
|
+
import type { LabelledReply, ThreadContext } from "./thread-context.ts";
|
|
3
4
|
export declare const HOUR = 3600000;
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The thread's context fields (`activity`, `meeting`, `vendorSentiment`,
|
|
7
|
+
* `followUp`) are always set by dropped_replies; optional so a value built
|
|
8
|
+
* by hand stays valid.
|
|
9
|
+
*/
|
|
10
|
+
export interface DroppedReply extends Partial<ThreadContext> {
|
|
5
11
|
/** The oldest reply in the conversation that got no answer. */
|
|
6
12
|
readonly reply: string;
|
|
7
13
|
readonly lead: string | null;
|
|
@@ -22,8 +28,14 @@ export interface DroppedReply {
|
|
|
22
28
|
readonly unansweredReplies: number;
|
|
23
29
|
/** Whether the conversation was read by its thread or by the lead's timeline. */
|
|
24
30
|
readonly checkedBy: "thread" | "timeline";
|
|
31
|
+
/** What was found, with the latest message and any meeting the vendor records. */
|
|
25
32
|
readonly finding: string;
|
|
26
33
|
}
|
|
34
|
+
/** A dropped reply before its lead is read, with the conversation it was found in. */
|
|
35
|
+
export type FoundDropped = Omit<DroppedReply, keyof ThreadContext> & {
|
|
36
|
+
readonly labelled: LabelledReply;
|
|
37
|
+
readonly messages: readonly Message[];
|
|
38
|
+
};
|
|
27
39
|
export interface Conversation {
|
|
28
40
|
readonly by: "thread" | "timeline" | null;
|
|
29
41
|
readonly id: string;
|
|
@@ -46,7 +58,11 @@ export interface Checkable extends Conversation {
|
|
|
46
58
|
}
|
|
47
59
|
interface Checked {
|
|
48
60
|
answered: number;
|
|
49
|
-
|
|
61
|
+
/** Conversations whose latest message, read in full, is an automatic reply. */
|
|
62
|
+
automatic: number;
|
|
63
|
+
/** The listed replies of those conversations. */
|
|
64
|
+
automaticReplies: number;
|
|
65
|
+
readonly dropped: FoundDropped[];
|
|
50
66
|
tooRecent: number;
|
|
51
67
|
/** Conversations whose read failed. */
|
|
52
68
|
unread: number;
|
|
@@ -58,5 +74,5 @@ interface Checked {
|
|
|
58
74
|
* and its answer may lie past the stop. The rest are read in full, since a
|
|
59
75
|
* campaign send after the reply counts as an answer too.
|
|
60
76
|
*/
|
|
61
|
-
export declare const check: (context: InsightContext, checkable: readonly Checkable[], sent: SentByHand | null, olderThanHours: number) => Promise<Checked>;
|
|
77
|
+
export declare const check: (context: InsightContext, checkable: readonly Checkable[], sent: SentByHand | null, olderThanHours: number, includeAuto: boolean) => Promise<Checked>;
|
|
62
78
|
export {};
|
|
@@ -6,7 +6,11 @@ export interface DroppedReplies {
|
|
|
6
6
|
readonly repliesRead: number;
|
|
7
7
|
/** Left out for a category that needs no answer. */
|
|
8
8
|
readonly skippedByCategory: number;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Left out because they are flagged automatic, by the vendor or by a fixed
|
|
11
|
+
* rule, or because their conversation, read in full, ends in an automatic
|
|
12
|
+
* reply. 0 with `include_auto`.
|
|
13
|
+
*/
|
|
10
14
|
readonly skippedAuto: number;
|
|
11
15
|
/**
|
|
12
16
|
* Set aside because their conversation belongs to no campaign, such as a
|
|
@@ -15,7 +19,7 @@ export interface DroppedReplies {
|
|
|
15
19
|
* set by dropped_replies; optional so a value built by hand stays valid.
|
|
16
20
|
*/
|
|
17
21
|
readonly notInCampaign?: number | null;
|
|
18
|
-
/** Conversations the remaining replies belong to. */
|
|
22
|
+
/** Conversations the remaining replies belong to: answered, dropped, tooRecent and unchecked add up to it. */
|
|
19
23
|
readonly conversations: number;
|
|
20
24
|
readonly answered: number;
|
|
21
25
|
readonly dropped: number;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { Lead } from "../../internal/entities.ts";
|
|
2
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
3
|
/** Every exact identifier a lead carries. */
|
|
6
4
|
export declare const keysOfLead: (lead: Lead) => string[];
|
|
7
5
|
export interface FoundPerson {
|
|
@@ -10,8 +8,11 @@ export interface FoundPerson {
|
|
|
10
8
|
/** One record per campaign the person is in. */
|
|
11
9
|
readonly records: readonly Lead[];
|
|
12
10
|
}
|
|
13
|
-
/**
|
|
14
|
-
|
|
11
|
+
/**
|
|
12
|
+
* A lead ref whose lead must be read (`leads.get`) for its identifiers. A
|
|
13
|
+
* ref whose vendor id is already an address or a profile URL needs no read.
|
|
14
|
+
*/
|
|
15
|
+
export declare const refNeedsRead: (identifier: string) => boolean;
|
|
15
16
|
/**
|
|
16
17
|
* Asks the vendor for the person by each identifier. A record that carries a
|
|
17
18
|
* second identifier is looked up under that one too, so an email address can
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ThreadContext } from "./thread-context.ts";
|
|
1
2
|
/** Points per signal. `null` when the vendor reports nothing for that signal. */
|
|
2
3
|
export interface HotLeadParts {
|
|
3
4
|
readonly interest: number | null;
|
|
@@ -6,7 +7,13 @@ export interface HotLeadParts {
|
|
|
6
7
|
readonly opens: number | null;
|
|
7
8
|
readonly recency: number | null;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The thread's context fields (`activity`, `meeting`, `vendorSentiment`,
|
|
12
|
+
* `followUp`) are always set by hot_leads; optional so a value built by hand
|
|
13
|
+
* stays valid. A score ranks interest; `followUp` says from the thread
|
|
14
|
+
* whether a reply is owed.
|
|
15
|
+
*/
|
|
16
|
+
export interface HotLead extends Partial<ThreadContext> {
|
|
10
17
|
readonly lead: string;
|
|
11
18
|
readonly email: string | null;
|
|
12
19
|
readonly linkedinUrl: string | null;
|
|
@@ -74,6 +81,7 @@ export declare const hotLeads: import("../define.ts").InsightDefinition<"hotLead
|
|
|
74
81
|
max_age_days: number;
|
|
75
82
|
include_engagement_only: boolean;
|
|
76
83
|
positive_labels: string[];
|
|
84
|
+
read_threads: boolean;
|
|
77
85
|
recency_days: number;
|
|
78
86
|
weight_click: number;
|
|
79
87
|
weight_interest: number;
|
|
@@ -89,6 +97,7 @@ export declare const hotLeads: import("../define.ts").InsightDefinition<"hotLead
|
|
|
89
97
|
max_age_days?: number | undefined;
|
|
90
98
|
include_engagement_only?: boolean | undefined;
|
|
91
99
|
positive_labels?: string[] | undefined;
|
|
100
|
+
read_threads?: boolean | undefined;
|
|
92
101
|
recency_days?: number | undefined;
|
|
93
102
|
weight_click?: number | undefined;
|
|
94
103
|
weight_interest?: number | undefined;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
export declare const PEOPLE_INSIGHTS: readonly [import("../define.ts").InsightDefinition<"personSummary", {
|
|
2
2
|
max_campaigns: number;
|
|
3
|
-
|
|
3
|
+
email?: string | undefined;
|
|
4
|
+
lead_ref?: string | undefined;
|
|
5
|
+
linkedin_url?: string | undefined;
|
|
6
|
+
person?: string | undefined;
|
|
4
7
|
}, import("./person-summary.ts").PersonSummary, {
|
|
5
|
-
|
|
8
|
+
email?: string | undefined;
|
|
9
|
+
lead_ref?: string | undefined;
|
|
10
|
+
linkedin_url?: string | undefined;
|
|
11
|
+
person?: string | undefined;
|
|
6
12
|
max_campaigns?: number | undefined;
|
|
7
13
|
}>, import("../define.ts").InsightDefinition<"accountSummary", {
|
|
8
14
|
allow_free_domains: boolean;
|
|
@@ -61,6 +67,7 @@ export declare const PEOPLE_INSIGHTS: readonly [import("../define.ts").InsightDe
|
|
|
61
67
|
max_age_days: number;
|
|
62
68
|
include_engagement_only: boolean;
|
|
63
69
|
positive_labels: string[];
|
|
70
|
+
read_threads: boolean;
|
|
64
71
|
recency_days: number;
|
|
65
72
|
weight_click: number;
|
|
66
73
|
weight_interest: number;
|
|
@@ -76,12 +83,27 @@ export declare const PEOPLE_INSIGHTS: readonly [import("../define.ts").InsightDe
|
|
|
76
83
|
max_age_days?: number | undefined;
|
|
77
84
|
include_engagement_only?: boolean | undefined;
|
|
78
85
|
positive_labels?: string[] | undefined;
|
|
86
|
+
read_threads?: boolean | undefined;
|
|
79
87
|
recency_days?: number | undefined;
|
|
80
88
|
weight_click?: number | undefined;
|
|
81
89
|
weight_interest?: number | undefined;
|
|
82
90
|
weight_open?: number | undefined;
|
|
83
91
|
weight_recency?: number | undefined;
|
|
84
92
|
weight_reply?: number | undefined;
|
|
93
|
+
}>, import("../define.ts").InsightDefinition<"threadContext", {
|
|
94
|
+
bodies: "none" | "snippet" | null;
|
|
95
|
+
cursor: string | null;
|
|
96
|
+
leads: string[];
|
|
97
|
+
max_messages: number;
|
|
98
|
+
page_size: number;
|
|
99
|
+
threads: string[];
|
|
100
|
+
}, import("./thread-contexts.ts").ThreadContexts, {
|
|
101
|
+
bodies?: "none" | "snippet" | null | undefined;
|
|
102
|
+
cursor?: string | null | undefined;
|
|
103
|
+
leads?: string[] | undefined;
|
|
104
|
+
max_messages?: number | undefined;
|
|
105
|
+
page_size?: number | undefined;
|
|
106
|
+
threads?: string[] | undefined;
|
|
85
107
|
}>, import("../define.ts").InsightDefinition<"personalizationGaps", {
|
|
86
108
|
campaign: string;
|
|
87
109
|
limit: number;
|
|
@@ -98,4 +120,6 @@ export type { HotLead, HotLeadParts, HotLeads } from "./hot-leads.ts";
|
|
|
98
120
|
export type { CollisionCampaign, LeadCollision, LeadCollisions, } from "./lead-collisions.ts";
|
|
99
121
|
export type { PersonCampaign, PersonSummary } from "./person-summary.ts";
|
|
100
122
|
export type { CopyVariable, GapLead, PersonalizationGaps, VariableUse, } from "./personalization-gaps.ts";
|
|
123
|
+
export type { FollowUpAssessment, FollowUpBasis, LatestMessage, ThreadActivity, ThreadContext, VendorSentiment, } from "./thread-context.ts";
|
|
124
|
+
export type { ThreadContexts, ThreadMessage, ThreadRecord, Uncovered, } from "./thread-contexts.ts";
|
|
101
125
|
export type { SuppressionCampaign, SuppressionCheck, SuppressionMatch, SuppressionViolation, } from "./suppression-check.ts";
|
|
@@ -20,10 +20,23 @@ export interface LeadCollision {
|
|
|
20
20
|
readonly finding: string;
|
|
21
21
|
}
|
|
22
22
|
export interface LeadCollisions {
|
|
23
|
+
/**
|
|
24
|
+
* The answer in one sentence, coverage first: how many people overlap, or
|
|
25
|
+
* what the caps left unread when the check is incomplete. Never "nobody"
|
|
26
|
+
* from part of the data.
|
|
27
|
+
*/
|
|
28
|
+
readonly finding: string;
|
|
23
29
|
/** Most active campaigns first, then most campaigns, then collisions across tools, then by identifier. */
|
|
24
30
|
readonly collisions: readonly LeadCollision[];
|
|
25
31
|
readonly totals: {
|
|
26
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Collisions returned, or `null` when a cap left campaigns or leads
|
|
34
|
+
* unread: the check is incomplete and `collisionsFound` is only a lower
|
|
35
|
+
* bound. The counts below are of the collisions found.
|
|
36
|
+
*/
|
|
37
|
+
readonly collisions: number | null;
|
|
38
|
+
/** Collisions returned among what was read. Raising a cap never lowers it. */
|
|
39
|
+
readonly collisionsFound: number;
|
|
27
40
|
/** Collisions returned in which two or more memberships are still active. */
|
|
28
41
|
readonly concurrent: number;
|
|
29
42
|
/**
|
|
@@ -37,6 +50,10 @@ export interface LeadCollisions {
|
|
|
37
50
|
readonly leadsRead: number;
|
|
38
51
|
/** Leads with neither an email address nor a LinkedIn profile, which cannot be matched. */
|
|
39
52
|
readonly leadsWithoutIdentifier: number;
|
|
53
|
+
/** `true` when `max_campaigns` or a request cap left campaigns in the statuses unread. */
|
|
54
|
+
readonly moreCampaignsExist: boolean;
|
|
55
|
+
/** Campaigns whose leads were read only in part. */
|
|
56
|
+
readonly campaignsWithMoreLeads: number;
|
|
40
57
|
};
|
|
41
58
|
}
|
|
42
59
|
export declare const leadCollisions: import("../define.ts").InsightDefinition<"leadCollisions", {
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ThreadContext } from "./thread-context.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The thread's context fields (`activity`, `meeting`, `vendorSentiment`,
|
|
4
|
+
* `followUp`) are always set by person_summary; optional so a value built
|
|
5
|
+
* by hand stays valid.
|
|
6
|
+
*/
|
|
7
|
+
export interface PersonCampaign extends Partial<ThreadContext> {
|
|
2
8
|
readonly campaign: string | null;
|
|
3
9
|
readonly campaignName: string | null;
|
|
4
10
|
readonly campaignStatus: string | null;
|
|
@@ -61,8 +67,14 @@ export interface PersonSummary {
|
|
|
61
67
|
}
|
|
62
68
|
export declare const personSummary: import("../define.ts").InsightDefinition<"personSummary", {
|
|
63
69
|
max_campaigns: number;
|
|
64
|
-
|
|
70
|
+
email?: string | undefined;
|
|
71
|
+
lead_ref?: string | undefined;
|
|
72
|
+
linkedin_url?: string | undefined;
|
|
73
|
+
person?: string | undefined;
|
|
65
74
|
}, PersonSummary, {
|
|
66
|
-
|
|
75
|
+
email?: string | undefined;
|
|
76
|
+
lead_ref?: string | undefined;
|
|
77
|
+
linkedin_url?: string | undefined;
|
|
78
|
+
person?: string | undefined;
|
|
67
79
|
max_campaigns?: number | undefined;
|
|
68
80
|
}>;
|
|
@@ -23,12 +23,25 @@ export interface SuppressionCampaign {
|
|
|
23
23
|
readonly violations: number;
|
|
24
24
|
}
|
|
25
25
|
export interface SuppressionCheck {
|
|
26
|
+
/**
|
|
27
|
+
* The answer in one sentence, coverage first: how many violations in how
|
|
28
|
+
* many campaigns, or what the caps left unread when the check is
|
|
29
|
+
* incomplete. Never "none" from part of the data.
|
|
30
|
+
*/
|
|
31
|
+
readonly finding: string;
|
|
26
32
|
/** Leads still `active` first, then by campaign and lead. */
|
|
27
33
|
readonly violations: readonly SuppressionViolation[];
|
|
28
34
|
/** Every campaign checked, most violations first. */
|
|
29
35
|
readonly byCampaign: readonly SuppressionCampaign[];
|
|
30
36
|
readonly totals: {
|
|
31
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Violations in every campaign and against every entry, or `null` when
|
|
39
|
+
* a cap left campaigns, leads or block entries unread: the check is
|
|
40
|
+
* incomplete and `violationsFound` is only a lower bound.
|
|
41
|
+
*/
|
|
42
|
+
readonly violations: number | null;
|
|
43
|
+
/** Violations in what was read. Raising a cap never lowers it. */
|
|
44
|
+
readonly violationsFound: number;
|
|
32
45
|
/**
|
|
33
46
|
* Leads on the block list whose status is not in `lead_statuses`, so not
|
|
34
47
|
* counted as violations: most often they unsubscribed (which is why they
|
|
@@ -54,6 +67,10 @@ export interface SuppressionCheck {
|
|
|
54
67
|
readonly moreBlockEntriesExist: boolean;
|
|
55
68
|
/** `true` when `max_leads_per_campaign` stopped a campaign's read with more leads left. */
|
|
56
69
|
readonly moreLeadsExist: boolean;
|
|
70
|
+
/** Campaigns whose leads were read only in part. */
|
|
71
|
+
readonly campaignsWithMoreLeads: number;
|
|
72
|
+
/** `true` when `max_campaigns` or a request cap left campaigns in the statuses unread. */
|
|
73
|
+
readonly moreCampaignsExist: boolean;
|
|
57
74
|
};
|
|
58
75
|
}
|
|
59
76
|
export declare const suppressionCheck: import("../define.ts").InsightDefinition<"suppressionCheck", {
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Lead, MeetingStatus, Message, ReplyCategory } from "../../internal/entities.ts";
|
|
2
|
+
import type { OutboundApi } from "../../internal/outbound/api.ts";
|
|
3
|
+
/** A wait as a person says it: in hours under two days, in whole days after. */
|
|
4
|
+
export declare const waited: (hours: number) => string;
|
|
5
|
+
/** The newest message of a conversation, without its body. */
|
|
6
|
+
export type LatestMessage = Omit<Message, "bodyHtml" | "bodyText">;
|
|
7
|
+
/** Who wrote last in a conversation, and when, from the messages read. */
|
|
8
|
+
export interface ThreadActivity {
|
|
9
|
+
/** Messages read in the conversation. 0 when it was not read. */
|
|
10
|
+
readonly messagesRead: number;
|
|
11
|
+
/** The newest message with a time. `null` when none was read. */
|
|
12
|
+
readonly latest: LatestMessage | null;
|
|
13
|
+
readonly lastInboundAt: string | null;
|
|
14
|
+
readonly lastOutboundAt: string | null;
|
|
15
|
+
}
|
|
16
|
+
/** What the vendor says about interest, kept apart from the follow-up assessment. */
|
|
17
|
+
export interface VendorSentiment {
|
|
18
|
+
/** The vendor's category on the reply the result is about. `null` when it is not about one. */
|
|
19
|
+
readonly replyCategory: ReplyCategory | null;
|
|
20
|
+
/** The vendor's label on the lead, such as `Interested`. */
|
|
21
|
+
readonly leadLabel: string | null;
|
|
22
|
+
/** What `leadLabel` means, in reply categories. */
|
|
23
|
+
readonly leadCategory: ReplyCategory | null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The rule that decided `needed`: `answered` (the latest message is
|
|
27
|
+
* outbound), `meeting` (the vendor records a meeting booked, held or won),
|
|
28
|
+
* `inbound_unanswered` (the latest message is inbound and not automatic),
|
|
29
|
+
* `automatic` (the latest message is an automatic reply), `no_messages` (the
|
|
30
|
+
* conversation read holds none with a time), `not_read` (it was not read).
|
|
31
|
+
*/
|
|
32
|
+
export type FollowUpBasis = "answered" | "automatic" | "inbound_unanswered" | "meeting" | "no_messages" | "not_read";
|
|
33
|
+
export interface FollowUpAssessment {
|
|
34
|
+
/**
|
|
35
|
+
* `true` when the latest message is inbound, not automatic and the vendor
|
|
36
|
+
* records no meeting; `false` when the vendor records a meeting booked,
|
|
37
|
+
* held or won, read or not, or the latest message is outbound; `null` when
|
|
38
|
+
* the rules cannot tell. A vendor label alone never sets it.
|
|
39
|
+
*/
|
|
40
|
+
readonly needed: boolean | null;
|
|
41
|
+
readonly basis: FollowUpBasis;
|
|
42
|
+
/** The facts the rules used, as sentences. */
|
|
43
|
+
readonly evidence: readonly string[];
|
|
44
|
+
/** What the rules could not check, as sentences. */
|
|
45
|
+
readonly unchecked: readonly string[];
|
|
46
|
+
}
|
|
47
|
+
export interface ThreadContext {
|
|
48
|
+
readonly activity: ThreadActivity;
|
|
49
|
+
/** The meeting the vendor records on the lead. `null` when it records none or the lead was not read. */
|
|
50
|
+
readonly meeting: MeetingStatus | null;
|
|
51
|
+
readonly vendorSentiment: VendorSentiment;
|
|
52
|
+
readonly followUp: FollowUpAssessment;
|
|
53
|
+
}
|
|
54
|
+
/** The reply a result is about, when the vendor labelled it. */
|
|
55
|
+
export interface LabelledReply {
|
|
56
|
+
readonly ref: string;
|
|
57
|
+
readonly category: ReplyCategory;
|
|
58
|
+
readonly sentAt: string | null;
|
|
59
|
+
}
|
|
60
|
+
export interface ThreadFacts {
|
|
61
|
+
/** The conversation's messages, in any order. `null` when it was not read. */
|
|
62
|
+
readonly messages: readonly Message[] | null;
|
|
63
|
+
/** Why the conversation was not read. */
|
|
64
|
+
readonly notRead?: string | undefined;
|
|
65
|
+
/** The lead record. `null` when it was not read or there is none. */
|
|
66
|
+
readonly lead: Lead | null;
|
|
67
|
+
readonly provider: string;
|
|
68
|
+
/** `false` where the vendor records no meeting on a lead. */
|
|
69
|
+
readonly meetingsRecorded: boolean;
|
|
70
|
+
readonly labelled?: LabelledReply | null | undefined;
|
|
71
|
+
readonly now: number;
|
|
72
|
+
}
|
|
73
|
+
/** `false` where the adapter never fills a lead's `meeting`. */
|
|
74
|
+
export declare const recordsMeetings: (outbound: OutboundApi) => boolean;
|
|
75
|
+
export declare const withoutBody: ({ bodyHtml: _html, bodyText: _text, ...rest }: Message) => LatestMessage;
|
|
76
|
+
export declare const activityOf: (messages: readonly Message[] | null) => ThreadActivity;
|
|
77
|
+
export declare const assessFollowUp: (facts: ThreadFacts, activity: ThreadActivity) => FollowUpAssessment;
|
|
78
|
+
/** Activity, meeting, vendor sentiment and the follow-up assessment of one conversation. */
|
|
79
|
+
export declare const threadContext: (facts: ThreadFacts) => ThreadContext;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { untrusted } from "../../tools/shared.ts";
|
|
2
|
+
import type { LatestMessage, ThreadContext } from "./thread-context.ts";
|
|
3
|
+
import type { Target } from "./thread-read.ts";
|
|
4
|
+
/** One message of a conversation, with a snippet instead of its body. */
|
|
5
|
+
export type ThreadMessage = LatestMessage & {
|
|
6
|
+
readonly snippet: ReturnType<typeof untrusted>;
|
|
7
|
+
};
|
|
8
|
+
export interface ThreadRecord extends ThreadContext {
|
|
9
|
+
readonly target: Target;
|
|
10
|
+
/** The lead the conversation is with. `null` when no message names one. */
|
|
11
|
+
readonly lead: string | null;
|
|
12
|
+
readonly email: string | null;
|
|
13
|
+
readonly linkedinUrl: string | null;
|
|
14
|
+
readonly campaign: string | null;
|
|
15
|
+
readonly threadIds: readonly string[];
|
|
16
|
+
/** The newest `max_messages` messages, oldest first. */
|
|
17
|
+
readonly messages: readonly ThreadMessage[];
|
|
18
|
+
/** Messages read but left out by `max_messages`. */
|
|
19
|
+
readonly messagesOmitted: number;
|
|
20
|
+
}
|
|
21
|
+
export interface Uncovered {
|
|
22
|
+
readonly target: Target;
|
|
23
|
+
readonly reason: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ThreadContexts {
|
|
26
|
+
/** In the order asked: leads first, then threads. */
|
|
27
|
+
readonly threads: readonly ThreadRecord[];
|
|
28
|
+
readonly coverage: {
|
|
29
|
+
/** Distinct leads and threads asked for, over every page. */
|
|
30
|
+
readonly requested: number;
|
|
31
|
+
/** Asked for and read on this page. */
|
|
32
|
+
readonly checked: number;
|
|
33
|
+
/** Read, with at least one message. */
|
|
34
|
+
readonly found: number;
|
|
35
|
+
/** Read and empty: an unknown thread, or a lead never written to. */
|
|
36
|
+
readonly notFound: readonly Uncovered[];
|
|
37
|
+
/** Asked for on this page but not read, with why. Their records say the same. */
|
|
38
|
+
readonly unchecked: readonly Uncovered[];
|
|
39
|
+
/** Asked for and left to later pages. */
|
|
40
|
+
readonly remaining: number;
|
|
41
|
+
/** Pass as `cursor` to read the next page. `null` on the last page. */
|
|
42
|
+
readonly nextCursor: string | null;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export declare const threadContexts: import("../define.ts").InsightDefinition<"threadContext", {
|
|
46
|
+
bodies: "none" | "snippet" | null;
|
|
47
|
+
cursor: string | null;
|
|
48
|
+
leads: string[];
|
|
49
|
+
max_messages: number;
|
|
50
|
+
page_size: number;
|
|
51
|
+
threads: string[];
|
|
52
|
+
}, ThreadContexts, {
|
|
53
|
+
bodies?: "none" | "snippet" | null | undefined;
|
|
54
|
+
cursor?: string | null | undefined;
|
|
55
|
+
leads?: string[] | undefined;
|
|
56
|
+
max_messages?: number | undefined;
|
|
57
|
+
page_size?: number | undefined;
|
|
58
|
+
threads?: string[] | undefined;
|
|
59
|
+
}>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Lead, Message } from "../../internal/entities.ts";
|
|
2
|
+
import type { InsightContext } from "../define.ts";
|
|
3
|
+
import type { ThreadContext } from "./thread-context.ts";
|
|
4
|
+
export interface Target {
|
|
5
|
+
readonly kind: "lead" | "thread";
|
|
6
|
+
readonly id: string;
|
|
7
|
+
}
|
|
8
|
+
export interface Read {
|
|
9
|
+
readonly target: Target;
|
|
10
|
+
/** `null` when the read failed. */
|
|
11
|
+
readonly messages: readonly Message[] | null;
|
|
12
|
+
/** Why the conversation was not read, such as `the read failed with NotFound`. */
|
|
13
|
+
readonly failed: string | null;
|
|
14
|
+
}
|
|
15
|
+
export declare const readConversation: (context: InsightContext, target: Target, bodies: boolean) => Promise<Read>;
|
|
16
|
+
/**
|
|
17
|
+
* Snippets unless asked for none, or none when redact masks message text.
|
|
18
|
+
* Asking for snippets that redact masks is refused.
|
|
19
|
+
*/
|
|
20
|
+
export declare const bodiesOf: (context: InsightContext, asked: "none" | "snippet" | null) => "none" | "snippet";
|
|
21
|
+
/**
|
|
22
|
+
* Refuses, before any request, a target this instance cannot read: a redact
|
|
23
|
+
* token from another session, which would reach the vendor as it is and fail
|
|
24
|
+
* there; text that is not a lead ref; a ref of another tool or workspace.
|
|
25
|
+
*/
|
|
26
|
+
export declare const refuseUnreadable: (context: InsightContext, targets: readonly Target[]) => void;
|
|
27
|
+
/** A lead's messages in its own campaign: a vendor that uses one id in every campaign returns them all. */
|
|
28
|
+
export declare const inCampaign: (messages: readonly Message[], lead: Lead | null | undefined) => Message[];
|
|
29
|
+
/**
|
|
30
|
+
* The context of each lead's conversation, read from its timeline, by lead
|
|
31
|
+
* ref. Where the tool cannot read a timeline, each is unread with that reason.
|
|
32
|
+
*/
|
|
33
|
+
export declare const leadContexts: (context: InsightContext, leads: readonly Lead[], skipped?: string | null) => Promise<Map<string, ThreadContext>>;
|