outbound-sdk 0.5.0 → 0.6.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.
Files changed (42) hide show
  1. package/dist/cards/format.d.ts +1 -1
  2. package/dist/cards/index.js +47 -18
  3. package/dist/cards/parts.d.ts +1 -6
  4. package/dist/chunks/{chunk-X4RDBD4J.js → chunk-3JOC5DGD.js} +26 -7
  5. package/dist/chunks/chunk-53DCVFUB.js +55 -0
  6. package/dist/chunks/{chunk-3S32R2MH.js → chunk-MGR6HREO.js} +0 -51
  7. package/dist/chunks/{chunk-EHSJGQ5K.js → chunk-PHNQ3WC2.js} +1 -1
  8. package/dist/chunks/{chunk-6TKFISG4.js → chunk-SXGCKCAR.js} +4 -2
  9. package/dist/chunks/{chunk-WGW3ROLY.js → chunk-TFICTGM2.js} +1 -1
  10. package/dist/chunks/{chunk-BN6WCAWX.js → chunk-W22SDX6S.js} +1 -1
  11. package/dist/cli/bin.js +3 -3
  12. package/dist/cli/index.js +2 -2
  13. package/dist/cli/output.d.ts +9 -0
  14. package/dist/emailbison/index.js +3 -2
  15. package/dist/heyreach/index.js +4 -2
  16. package/dist/insights/copy/copy-preview.d.ts +58 -0
  17. package/dist/insights/copy/copy-reuse.d.ts +0 -13
  18. package/dist/insights/copy/index.d.ts +9 -0
  19. package/dist/insights/copy/reuse-base.d.ts +0 -2
  20. package/dist/insights/copy/shared.d.ts +3 -8
  21. package/dist/insights/copy/step-funnel.d.ts +1 -12
  22. package/dist/insights/copy/variant-test.d.ts +0 -5
  23. package/dist/insights/index.js +504 -413
  24. package/dist/insights/inputs.generated.d.ts +21 -24
  25. package/dist/insights/ops/campaign-diagnosis.d.ts +0 -2
  26. package/dist/insights/ops/client-report.d.ts +0 -2
  27. package/dist/insights/ops/index.d.ts +0 -4
  28. package/dist/insights/ops/shared.d.ts +0 -2
  29. package/dist/insights/registry.d.ts +8 -8
  30. package/dist/insights/senders/bounce-watch.d.ts +0 -11
  31. package/dist/insights/senders/domain-health.d.ts +0 -7
  32. package/dist/insights/senders/index.d.ts +0 -4
  33. package/dist/insights/senders/sender-load.d.ts +0 -2
  34. package/dist/insights/types.d.ts +1 -1
  35. package/dist/insights/variables.d.ts +33 -0
  36. package/dist/instantly/index.js +5 -3
  37. package/dist/loader/index.js +1 -1
  38. package/dist/smartlead/index.js +5 -3
  39. package/dist/webhooks/index.js +5 -4
  40. package/package.json +1 -1
  41. package/dist/internal/renamed.d.ts +0 -28
  42. /package/dist/chunks/{chunk-5J7GGV62.js → chunk-UWUPUMM2.js} +0 -0
@@ -15,7 +15,7 @@ export declare const clip: (value: string, max: number) => string;
15
15
  export declare const str: (value: Json | undefined, key: string) => string | null;
16
16
  /** A string field for display: made inert, or a dash. */
17
17
  export declare const show: (value: Json | undefined, key: string) => string;
18
- /** A campaign's name: `campaignName`, or `name` in a result stored before it. */
18
+ /** A campaign's name, as an insight's campaign row carries it. */
19
19
  export declare const campaignNameOf: (value: Json | undefined) => string;
20
20
  export declare const num: (value: Json | undefined, key: string) => number | null;
21
21
  export declare const bool: (value: Json | undefined, key: string) => boolean | null;
@@ -33,7 +33,7 @@ var str = (value, key) => {
33
33
  return raw2 === null ? null : safe(raw2);
34
34
  };
35
35
  var show = (value, key) => str(value, key) ?? DASH;
36
- var campaignNameOf = (value) => str(value, "campaignName") ?? show(value, "name");
36
+ var campaignNameOf = (value) => show(value, "campaignName");
37
37
  var num = (value, key) => count(field(value, key));
38
38
  var bool = (value, key) => flag(field(value, key));
39
39
  var rows = (value, key) => objects(field(value, key));
@@ -230,18 +230,7 @@ var pieChart = (title, points2) => {
230
230
  var LEFT = "left";
231
231
  var RIGHT = "right";
232
232
  var measured = (value) => pctRange(num(value, "rate"), num(value, "low"), num(value, "high"));
233
- var withInterval = (value, rateKey = "rate", intervalKey = "interval") => {
234
- const interval = child(value, intervalKey);
235
- return pctRange(
236
- num(value, rateKey),
237
- num(value, "low") ?? num(interval, "low"),
238
- num(value, "high") ?? num(interval, "high")
239
- );
240
- };
241
- var replyRate = (value) => {
242
- const rate2 = child(child(value, "rates"), "replyRate");
243
- return "rate" in rate2 ? measured(rate2) : withInterval(value, "replyRate", "replyRateInterval");
244
- };
233
+ var replyRate = (value) => measured(child(child(value, "rates"), "replyRate"));
245
234
  var totalStats = (totals) => [
246
235
  ["Sent", int(num(totals, "sent"))],
247
236
  ["Replies", int(num(totals, "replied"))],
@@ -343,7 +332,7 @@ var variantTest = (data) => {
343
332
  stepOf(tested, "step"),
344
333
  `${show(variant, "variantKey")}${str(tested, "leader") === str(variant, "variantKey") ? " \u2605" : ""}`,
345
334
  int(num(variant, "sent")),
346
- withInterval(variant)
335
+ measured(variant)
347
336
  ])
348
337
  )
349
338
  },
@@ -375,6 +364,45 @@ var copyAudit = (data) => {
375
364
  title: "Copy audit"
376
365
  };
377
366
  };
367
+ var copyPreview = (data) => {
368
+ const lead = child(data, "lead");
369
+ const totals = child(data, "totals");
370
+ const unfilled = num(totals, "unfilled") ?? 0;
371
+ const variants = rows(data, "steps").flatMap(
372
+ (step) => rows(step, "variants").map((variant) => ({ step, variant }))
373
+ );
374
+ return {
375
+ bullets: [
376
+ ...new Set(
377
+ variants.flatMap(({ variant }) => strings(variant, "unfilled"))
378
+ )
379
+ ].map((name) => `\u{1F7E1} \`${name}\` is left as written.`),
380
+ finding: str(lead, "lead") === null ? "No lead was read, so the copy is shown as written." : `Rendered for ${str(lead, "email") ?? str(lead, "linkedinUrl") ?? "one lead"}, who has ${int(
381
+ num(lead, "variablesFilled")
382
+ )} of ${plural(num(totals, "variables") ?? 0, "variable")} filled.`,
383
+ stats: [
384
+ ["Steps", int(num(totals, "steps"))],
385
+ ["Variants", int(num(totals, "variants"))],
386
+ ["Variables", int(num(totals, "variables"))],
387
+ ["Left as written", int(unfilled)]
388
+ ],
389
+ subtitle: show(data, "campaign"),
390
+ table: {
391
+ align: [RIGHT, LEFT, LEFT, LEFT],
392
+ headers: ["Step", "Variant", "Subject", "Body"],
393
+ rows: variants.map(({ step, variant }) => {
394
+ const rendered = child(variant, "rendered");
395
+ return [
396
+ stepOf(step, "step"),
397
+ show(variant, "variantKey"),
398
+ clip(str(rendered, "subject") ?? DASH, 60),
399
+ clip(str(rendered, "bodyText") ?? DASH, 120)
400
+ ];
401
+ })
402
+ },
403
+ title: "Copy preview"
404
+ };
405
+ };
378
406
  var copyLabel = (piece) => clip(str(piece, "subject") ?? str(piece, "bodyPreview") ?? DASH, 60);
379
407
  var copyReuse = (data) => {
380
408
  const reused = rows(data, "reused");
@@ -397,7 +425,7 @@ var copyReuse = (data) => {
397
425
  copyLabel(piece),
398
426
  int(num(piece, "campaigns")),
399
427
  int(num(piece, "sent")),
400
- pct(num(piece, "replyRate")),
428
+ pct(num(child(child(piece, "rates"), "replyRate"), "rate")),
401
429
  pct(num(piece, "spread"))
402
430
  ])
403
431
  },
@@ -433,6 +461,7 @@ var replyTiming = (data) => {
433
461
  };
434
462
  var COPY_CARDS = /* @__PURE__ */ new Map([
435
463
  ["copy_audit", copyAudit],
464
+ ["copy_preview", copyPreview],
436
465
  ["copy_reuse", copyReuse],
437
466
  ["reply_timing", replyTiming],
438
467
  ["step_funnel", stepFunnel],
@@ -945,11 +974,11 @@ var PEOPLE_CARDS = /* @__PURE__ */ new Map([
945
974
 
946
975
  // src/cards/sender-cards.ts
947
976
  var senderName = (sender) => str(sender, "address") ?? str(sender, "name") ?? show(sender, "sender");
948
- var warmupRate = (warmup2) => num(warmup2, "rate") ?? num(warmup2, "spamRate");
977
+ var warmupRate = (warmup2) => num(warmup2, "rate");
949
978
  var bounceWatch = (data) => {
950
979
  const totals = child(data, "totals");
951
980
  const over = rows(data, "over");
952
- const threshold = pct(num(data, "maxBounceRate") ?? num(data, "threshold"));
981
+ const threshold = pct(num(data, "maxBounceRate"));
953
982
  return {
954
983
  finding: verdict(
955
984
  (num(totals, "over") ?? 0) + (num(totals, "clean") ?? 0),
@@ -970,7 +999,7 @@ var bounceWatch = (data) => {
970
999
  campaignNameOf(campaign),
971
1000
  int(num(campaign, "sent")),
972
1001
  int(num(campaign, "bounced")),
973
- withInterval(campaign)
1002
+ measured(campaign)
974
1003
  ])
975
1004
  },
976
1005
  title: "Bounce watch"
@@ -4,12 +4,7 @@ export declare const LEFT = "left";
4
4
  export declare const RIGHT = "right";
5
5
  /** A rate with `low` and `high` beside it, as the ops insights report one. */
6
6
  export declare const measured: (value: Json | undefined) => string;
7
- /**
8
- * A rate with `low` and `high` beside it, or the `interval` object a result
9
- * stored before those carries.
10
- */
11
- export declare const withInterval: (value: JsonObject, rateKey?: string, intervalKey?: string) => string;
12
- /** A row's `rates.replyRate`, or its older `replyRate` and `replyRateInterval`. */
7
+ /** A row's `rates.replyRate`, with its interval. */
13
8
  export declare const replyRate: (value: JsonObject) => string;
14
9
  /** Sent, replies, positive and bounced, as fields. */
15
10
  export declare const totalStats: (totals: Json | undefined) => Stat[];
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-QGRZDTX4.js";
14
14
  import {
15
15
  fromEnv
16
- } from "./chunk-5J7GGV62.js";
16
+ } from "./chunk-UWUPUMM2.js";
17
17
  import {
18
18
  OutboundError
19
19
  } from "./chunk-J7DDZ4C2.js";
@@ -123,6 +123,7 @@ var GLOBAL_FLAGS = [
123
123
  "max-requests",
124
124
  "no-redact",
125
125
  "provider",
126
+ "raw",
126
127
  "redact"
127
128
  ];
128
129
  var checkFlags = (name, flags, given) => {
@@ -394,6 +395,7 @@ var GLOBAL_HELP = [
394
395
  "Options:",
395
396
  " --provider <id> the adapter to use, or all for every provider whose key is set (default: OUTBOUND_SDK_PROVIDER)",
396
397
  " --compact print JSON on one line",
398
+ " --raw keep each record's raw vendor payload (left out by default)",
397
399
  " --config <file> load plugins from a file whose default export is defineConfig({ plugins })",
398
400
  " --redact mask personal fields (on by default for mcp)",
399
401
  " --no-redact do not mask personal fields, even for mcp",
@@ -626,6 +628,26 @@ var createMcpServer = (outbound, options = {}) => {
626
628
  };
627
629
  };
628
630
 
631
+ // src/cli/output.ts
632
+ var isRecord = (value) => isJsonObject(value) && "ref" in value && "schemaVersion" in value;
633
+ var withoutRaw = (value) => {
634
+ if (Array.isArray(value)) {
635
+ return value.map(withoutRaw);
636
+ }
637
+ if (!isJsonObject(value)) {
638
+ return value;
639
+ }
640
+ return Object.fromEntries(
641
+ Object.entries(value).filter(([key]) => !(key === "raw" && isRecord(value))).map(([key, item]) => [key, withoutRaw(item)])
642
+ );
643
+ };
644
+ var printAnswer = (write, value, options) => {
645
+ const shown = options.raw === true ? value : withoutRaw(value);
646
+ write(
647
+ options.compact === true ? JSON.stringify(shown) : JSON.stringify(shown, null, 2)
648
+ );
649
+ };
650
+
629
651
  // src/cli/stdio.ts
630
652
  import process from "node:process";
631
653
  import { createInterface } from "node:readline";
@@ -759,6 +781,7 @@ var OPTIONS = {
759
781
  "max-requests": { type: "string" },
760
782
  "no-redact": { type: "boolean" },
761
783
  provider: { type: "string" },
784
+ raw: { type: "boolean" },
762
785
  redact: { type: "boolean" },
763
786
  sequence: { type: "boolean" },
764
787
  settings: { type: "boolean" },
@@ -789,9 +812,6 @@ var serve = async (outbound, io, unmasked) => {
789
812
  });
790
813
  await serveStdio(server, { input: io.stdin?.() ?? [], write: io.stdout });
791
814
  };
792
- var print = (io, value, compact) => {
793
- io.stdout(compact ? JSON.stringify(value) : JSON.stringify(value, null, 2));
794
- };
795
815
  var parseStrict = (argv) => parseArgs({ allowPositionals: true, args: [...argv], options: OPTIONS });
796
816
  var helpFor = (name, asked) => {
797
817
  const command = name === void 0 ? void 0 : COMMANDS.get(name);
@@ -837,7 +857,6 @@ var parse = (argv) => {
837
857
  var run = async (argv, io) => {
838
858
  try {
839
859
  const { help, name, rest, values } = parse(argv);
840
- const compact = values.compact === true;
841
860
  if (await runSelf(name, values, io.npm ?? runNpm, io.stdout)) {
842
861
  return 0;
843
862
  }
@@ -846,7 +865,7 @@ var run = async (argv, io) => {
846
865
  return 0;
847
866
  }
848
867
  if (name === "providers") {
849
- print(io, listProviders(), compact);
868
+ printAnswer(io.stdout, listProviders(), values);
850
869
  return 0;
851
870
  }
852
871
  const command = name === void 0 ? void 0 : COMMANDS.get(name);
@@ -866,7 +885,7 @@ var run = async (argv, io) => {
866
885
  note: io.stderr,
867
886
  positionals: rest
868
887
  });
869
- print(io, answer, compact);
888
+ printAnswer(io.stdout, answer, values);
870
889
  return name === "tool" && field(answer, "ok") === false ? 1 : 0;
871
890
  } catch (error) {
872
891
  const code = OutboundError.is(error) ? error.code : "Error";
@@ -0,0 +1,55 @@
1
+ // src/internal/text.ts
2
+ var ENTITIES = /* @__PURE__ */ new Map([
3
+ ["amp", "&"],
4
+ ["apos", "'"],
5
+ ["gt", ">"],
6
+ ["lt", "<"],
7
+ ["nbsp", " "],
8
+ ["quot", '"']
9
+ ]);
10
+ var decodeEntity = (match, body) => {
11
+ if (body.startsWith("#")) {
12
+ const code = body[1]?.toLowerCase() === "x" ? Number.parseInt(body.slice(2), 16) : Number(body.slice(1));
13
+ return Number.isInteger(code) && code > 0 && code <= 1114111 ? String.fromCodePoint(code) : match;
14
+ }
15
+ return ENTITIES.get(body.toLowerCase()) ?? match;
16
+ };
17
+ var looksLikeHtml = (value) => /<[a-z!/][^>]*>/iu.test(value);
18
+ var htmlToText = (html) => html.replaceAll(/<(?:script|style)\b[^>]*>[\s\S]*?<\/(?:script|style)>/giu, "").replaceAll(/<br\s*\/?>/giu, "\n").replaceAll(/<\/(?:p|div|li|tr|h[1-6])>/giu, "\n").replaceAll(/<[^>]+>/gu, "").replaceAll(
19
+ /&(?<body>#x?[\da-f]+|[a-z]+);/giu,
20
+ (match, body) => decodeEntity(match, body)
21
+ ).replaceAll(/[ \t]+\n/gu, "\n").replaceAll(/\n{3,}/gu, "\n\n").trim();
22
+ var QUOTE_MARKERS = [
23
+ /^On .{0,200}wrote:\s*$/u,
24
+ /^-{2,}\s*Original Message\s*-{2,}\s*$/iu,
25
+ /^From:\s.+$/u,
26
+ /^Sent from my \w+/u,
27
+ /^_{10,}\s*$/u
28
+ ];
29
+ var stripQuotedHistory = (text) => {
30
+ const lines = text.split(/\r?\n/u);
31
+ const cut = lines.findIndex(
32
+ (line, index) => QUOTE_MARKERS.some((marker) => marker.test(line.trim())) || // A run of ">" lines to the end of the message is the quoted thread.
33
+ line.trimStart().startsWith(">") && lines.slice(index).every(
34
+ (rest) => rest.trim() === "" || rest.trimStart().startsWith(">")
35
+ )
36
+ );
37
+ return (cut === -1 ? lines : lines.slice(0, cut)).join("\n").trim();
38
+ };
39
+ var normalizeBody = (body, includeBody) => {
40
+ if (!includeBody || body === null || body.trim() === "") {
41
+ return { bodyHtml: null, bodyText: null };
42
+ }
43
+ const isHtml = looksLikeHtml(body);
44
+ const plain = stripQuotedHistory(isHtml ? htmlToText(body) : body);
45
+ return {
46
+ bodyHtml: isHtml ? body : null,
47
+ bodyText: plain === "" ? null : plain
48
+ };
49
+ };
50
+
51
+ export {
52
+ looksLikeHtml,
53
+ htmlToText,
54
+ normalizeBody
55
+ };
@@ -81,62 +81,11 @@ var leadStanding = (progress, outcome) => {
81
81
  return { ...outcome, progress, status: headline() };
82
82
  };
83
83
 
84
- // src/internal/text.ts
85
- var ENTITIES = /* @__PURE__ */ new Map([
86
- ["amp", "&"],
87
- ["apos", "'"],
88
- ["gt", ">"],
89
- ["lt", "<"],
90
- ["nbsp", " "],
91
- ["quot", '"']
92
- ]);
93
- var decodeEntity = (match, body) => {
94
- if (body.startsWith("#")) {
95
- const code = body[1]?.toLowerCase() === "x" ? Number.parseInt(body.slice(2), 16) : Number(body.slice(1));
96
- return Number.isInteger(code) && code > 0 && code <= 1114111 ? String.fromCodePoint(code) : match;
97
- }
98
- return ENTITIES.get(body.toLowerCase()) ?? match;
99
- };
100
- var looksLikeHtml = (value) => /<[a-z!/][^>]*>/iu.test(value);
101
- var htmlToText = (html) => html.replaceAll(/<(?:script|style)\b[^>]*>[\s\S]*?<\/(?:script|style)>/giu, "").replaceAll(/<br\s*\/?>/giu, "\n").replaceAll(/<\/(?:p|div|li|tr|h[1-6])>/giu, "\n").replaceAll(/<[^>]+>/gu, "").replaceAll(
102
- /&(?<body>#x?[\da-f]+|[a-z]+);/giu,
103
- (match, body) => decodeEntity(match, body)
104
- ).replaceAll(/[ \t]+\n/gu, "\n").replaceAll(/\n{3,}/gu, "\n\n").trim();
105
- var QUOTE_MARKERS = [
106
- /^On .{0,200}wrote:\s*$/u,
107
- /^-{2,}\s*Original Message\s*-{2,}\s*$/iu,
108
- /^From:\s.+$/u,
109
- /^Sent from my \w+/u,
110
- /^_{10,}\s*$/u
111
- ];
112
- var stripQuotedHistory = (text) => {
113
- const lines = text.split(/\r?\n/u);
114
- const cut = lines.findIndex(
115
- (line, index) => QUOTE_MARKERS.some((marker) => marker.test(line.trim())) || // A run of ">" lines to the end of the message is the quoted thread.
116
- line.trimStart().startsWith(">") && lines.slice(index).every(
117
- (rest) => rest.trim() === "" || rest.trimStart().startsWith(">")
118
- )
119
- );
120
- return (cut === -1 ? lines : lines.slice(0, cut)).join("\n").trim();
121
- };
122
- var normalizeBody = (body, includeBody) => {
123
- if (!includeBody || body === null || body.trim() === "") {
124
- return { bodyHtml: null, bodyText: null };
125
- }
126
- const isHtml = looksLikeHtml(body);
127
- const plain = stripQuotedHistory(isHtml ? htmlToText(body) : body);
128
- return {
129
- bodyHtml: isHtml ? body : null,
130
- bodyText: plain === "" ? null : plain
131
- };
132
- };
133
-
134
84
  export {
135
85
  variantKey,
136
86
  toVariant,
137
87
  fromOne,
138
88
  listIn,
139
89
  leadStanding,
140
- normalizeBody,
141
90
  createVendorClient
142
91
  };
@@ -3,7 +3,7 @@ import {
3
3
  leadStanding,
4
4
  toVariant,
5
5
  variantKey
6
- } from "./chunk-3S32R2MH.js";
6
+ } from "./chunk-MGR6HREO.js";
7
7
  import {
8
8
  eventData,
9
9
  recordBase,
@@ -1,9 +1,11 @@
1
1
  import {
2
2
  createVendorClient,
3
3
  leadStanding,
4
- listIn,
4
+ listIn
5
+ } from "./chunk-MGR6HREO.js";
6
+ import {
5
7
  normalizeBody
6
- } from "./chunk-3S32R2MH.js";
8
+ } from "./chunk-53DCVFUB.js";
7
9
  import {
8
10
  eventData,
9
11
  eventTypesOf,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  run
3
- } from "./chunk-X4RDBD4J.js";
3
+ } from "./chunk-3JOC5DGD.js";
4
4
 
5
5
  // src/cli/bin.ts
6
6
  import process from "node:process";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fromOne,
3
3
  variantKey
4
- } from "./chunk-3S32R2MH.js";
4
+ } from "./chunk-MGR6HREO.js";
5
5
  import {
6
6
  eventData,
7
7
  refTo
package/dist/cli/bin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import "../chunks/chunk-WGW3ROLY.js";
3
- import "../chunks/chunk-X4RDBD4J.js";
2
+ import "../chunks/chunk-TFICTGM2.js";
3
+ import "../chunks/chunk-3JOC5DGD.js";
4
4
  import "../chunks/chunk-OLPMBRXM.js";
5
5
  import "../chunks/chunk-BK5SLY32.js";
6
6
  import "../chunks/chunk-HWHI4LFY.js";
@@ -17,7 +17,7 @@ import "../chunks/chunk-QGRZDTX4.js";
17
17
  import "../chunks/chunk-QAKJ76HB.js";
18
18
  import "../chunks/chunk-NAWZ73QS.js";
19
19
  import "../chunks/chunk-FHKSLCVW.js";
20
- import "../chunks/chunk-5J7GGV62.js";
20
+ import "../chunks/chunk-UWUPUMM2.js";
21
21
  import "../chunks/chunk-GFDNRWR3.js";
22
22
  import "../chunks/chunk-J7DDZ4C2.js";
23
23
  import "../chunks/chunk-BLCJHP5H.js";
package/dist/cli/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  defineConfig,
5
5
  run,
6
6
  serveStdio
7
- } from "../chunks/chunk-X4RDBD4J.js";
7
+ } from "../chunks/chunk-3JOC5DGD.js";
8
8
  import "../chunks/chunk-OLPMBRXM.js";
9
9
  import "../chunks/chunk-BK5SLY32.js";
10
10
  import "../chunks/chunk-HWHI4LFY.js";
@@ -21,7 +21,7 @@ import "../chunks/chunk-QGRZDTX4.js";
21
21
  import "../chunks/chunk-QAKJ76HB.js";
22
22
  import "../chunks/chunk-NAWZ73QS.js";
23
23
  import "../chunks/chunk-FHKSLCVW.js";
24
- import "../chunks/chunk-5J7GGV62.js";
24
+ import "../chunks/chunk-UWUPUMM2.js";
25
25
  import "../chunks/chunk-GFDNRWR3.js";
26
26
  import "../chunks/chunk-J7DDZ4C2.js";
27
27
  import "../chunks/chunk-BLCJHP5H.js";
@@ -0,0 +1,9 @@
1
+ import type { Json } from "../internal/json.ts";
2
+ /** The CLI's own `--compact` and `--raw`. */
3
+ export interface PrintOptions {
4
+ readonly compact?: boolean | undefined;
5
+ readonly raw?: boolean | undefined;
6
+ }
7
+ /** The answer with `raw` taken off every record in it, at any depth. */
8
+ export declare const withoutRaw: (value: Json) => Json;
9
+ export declare const printAnswer: (write: (text: string) => void, value: Json, options: PrintOptions) => void;
@@ -22,7 +22,7 @@ import {
22
22
  toTag,
23
23
  toWebhook,
24
24
  toWorkspace
25
- } from "../chunks/chunk-6TKFISG4.js";
25
+ } from "../chunks/chunk-SXGCKCAR.js";
26
26
  import {
27
27
  flatMapPage,
28
28
  mapPage,
@@ -32,7 +32,8 @@ import {
32
32
  import {
33
33
  toVariant,
34
34
  variantKey
35
- } from "../chunks/chunk-3S32R2MH.js";
35
+ } from "../chunks/chunk-MGR6HREO.js";
36
+ import "../chunks/chunk-53DCVFUB.js";
36
37
  import {
37
38
  defineNative,
38
39
  inPath,
@@ -11,10 +11,12 @@ import {
11
11
  createVendorClient,
12
12
  leadStanding,
13
13
  listIn,
14
- normalizeBody,
15
14
  toVariant,
16
15
  variantKey
17
- } from "../chunks/chunk-3S32R2MH.js";
16
+ } from "../chunks/chunk-MGR6HREO.js";
17
+ import {
18
+ normalizeBody
19
+ } from "../chunks/chunk-53DCVFUB.js";
18
20
  import {
19
21
  defineNative
20
22
  } from "../chunks/chunk-NAKXLBA6.js";
@@ -0,0 +1,58 @@
1
+ export interface CopyText {
2
+ readonly subject: string | null;
3
+ readonly body: string | null;
4
+ }
5
+ export interface RenderedCopy extends CopyText {
6
+ /** The rendered body as plain text, with HTML tags removed. `null` when there is no body. */
7
+ readonly bodyText: string | null;
8
+ }
9
+ export interface PreviewVariant {
10
+ readonly variantKey: string;
11
+ /** The copy exactly as the campaign stores it. */
12
+ readonly template: CopyText;
13
+ /** The copy with the lead's values, or each variable's fallback, put in. */
14
+ readonly rendered: RenderedCopy;
15
+ /**
16
+ * Variables left as written because the lead has no value and the copy no
17
+ * fallback. A sender signature or another variable the tool fills itself
18
+ * at send time is listed here too.
19
+ */
20
+ readonly unfilled: readonly string[];
21
+ }
22
+ export interface PreviewStep {
23
+ /** The step, counted from 0. */
24
+ readonly step: number;
25
+ readonly action: string;
26
+ readonly delayDays: number | null;
27
+ readonly variants: readonly PreviewVariant[];
28
+ }
29
+ export interface PreviewLead {
30
+ readonly lead: string;
31
+ readonly email: string | null;
32
+ readonly linkedinUrl: string | null;
33
+ /** How many of the copy's variables this lead has a value for. */
34
+ readonly variablesFilled: number;
35
+ }
36
+ export interface CopyPreview {
37
+ readonly campaign: string;
38
+ /** The lead the copy is rendered for. `null` when no lead was read. */
39
+ readonly lead: PreviewLead | null;
40
+ readonly steps: readonly PreviewStep[];
41
+ readonly totals: {
42
+ readonly steps: number;
43
+ readonly variants: number;
44
+ /** Distinct variables in the copy. */
45
+ readonly variables: number;
46
+ /** Distinct variables left as written in at least one variant. */
47
+ readonly unfilled: number;
48
+ };
49
+ }
50
+ export declare const copyPreview: import("../define.ts").InsightDefinition<"copyPreview", {
51
+ campaign: string;
52
+ lead: string | null;
53
+ max_leads: number;
54
+ }, CopyPreview, {
55
+ campaign: string;
56
+ lead?: string | null | undefined;
57
+ max_leads?: number | undefined;
58
+ }>;
@@ -1,4 +1,3 @@
1
- import type { Interval } from "../stats.ts";
2
1
  import type { BasedRate, RateBasis } from "./shared.ts";
3
2
  export interface CopyUse {
4
3
  readonly campaign: string;
@@ -14,12 +13,6 @@ export interface CopyUse {
14
13
  };
15
14
  /** What the rate divides by: leads contacted or messages sent. */
16
15
  readonly basis: RateBasis | null;
17
- /** @deprecated Use `rates.replyRate.of`. Removed in 0.6.0. */
18
- readonly trials: number | null;
19
- /** @deprecated Use `rates.replyRate.rate`. Removed in 0.6.0. */
20
- readonly replyRate: number | null;
21
- /** @deprecated Use `rates.replyRate.low` and `.high`. Removed in 0.6.0. */
22
- readonly replyRateInterval: Interval | null;
23
16
  }
24
17
  export interface CopyPiece {
25
18
  readonly contentHash: string;
@@ -34,12 +27,6 @@ export interface CopyPiece {
34
27
  readonly replyRate: BasedRate;
35
28
  };
36
29
  readonly basis: RateBasis | null;
37
- /** @deprecated Use `rates.replyRate.of`. Removed in 0.6.0. */
38
- readonly trials: number | null;
39
- /** @deprecated Use `rates.replyRate.rate`. Removed in 0.6.0. */
40
- readonly replyRate: number | null;
41
- /** @deprecated Use `rates.replyRate.low` and `.high`. Removed in 0.6.0. */
42
- readonly replyRateInterval: Interval | null;
43
30
  }
44
31
  export interface ReusedCopy extends CopyPiece {
45
32
  /** Best reply rate first; a campaign with no known rate is last. */
@@ -40,6 +40,14 @@ export declare const COPY_INSIGHTS: readonly [import("../define.ts").InsightDefi
40
40
  max_links?: number | undefined;
41
41
  max_subject_chars?: number | undefined;
42
42
  spam_words?: string[] | undefined;
43
+ }>, import("../define.ts").InsightDefinition<"copyPreview", {
44
+ campaign: string;
45
+ lead: string | null;
46
+ max_leads: number;
47
+ }, import("./copy-preview.ts").CopyPreview, {
48
+ campaign: string;
49
+ lead?: string | null | undefined;
50
+ max_leads?: number | undefined;
43
51
  }>, import("../define.ts").InsightDefinition<"copyReuse", {
44
52
  max_campaigns: number;
45
53
  min_sent: number;
@@ -61,6 +69,7 @@ export declare const COPY_INSIGHTS: readonly [import("../define.ts").InsightDefi
61
69
  }>];
62
70
  export type { CheckName, Severity } from "./copy-checks.ts";
63
71
  export type { CheckCount, CopyAudit, CopyFinding } from "./copy-audit.ts";
72
+ export type { CopyPreview, CopyText, PreviewLead, PreviewStep, PreviewVariant, RenderedCopy, } from "./copy-preview.ts";
64
73
  export type { CopyPiece, CopyReuse, CopyUse, ReusedCopy, } from "./copy-reuse.ts";
65
74
  export type { HourCount, ReplyTiming, TimeTable, WeekdayCount, } from "./reply-timing.ts";
66
75
  export type { FunnelStep, FunnelVariant, StepFunnel } from "./step-funnel.ts";
@@ -6,8 +6,6 @@ import type { Base, RateBasis } from "./shared.ts";
6
6
  export type BaseOf = (counts: MetricCounts) => Base;
7
7
  export declare const pooled: (counts: readonly (MetricCounts | null)[], baseOf: BaseOf) => {
8
8
  sent: number | null;
9
- trials: number | null;
10
- interval: import("../stats.ts").Interval | null;
11
9
  basis: RateBasis | null;
12
10
  count: number | null;
13
11
  of: number | null;
@@ -1,7 +1,6 @@
1
1
  import type { MetricRow } from "../../internal/entities.ts";
2
2
  import type { MetricCounts } from "../../internal/metrics.ts";
3
3
  import type { Measured as Rate } from "../ops/shared.ts";
4
- import type { Interval } from "../stats.ts";
5
4
  export interface DayRange {
6
5
  readonly from: string | undefined;
7
6
  readonly to: string | undefined;
@@ -48,14 +47,10 @@ export interface BasedRate extends Rate {
48
47
  /** What `of` counts. */
49
48
  readonly basis: RateBasis | null;
50
49
  }
51
- export interface Measured extends BasedRate {
52
- /** @deprecated Use `of`. Removed in 0.6.0. */
53
- readonly trials: number | null;
54
- /** @deprecated Use `low` and `high`. Removed in 0.6.0. */
55
- readonly interval: Interval | null;
56
- }
50
+ /** A measured rate. */
51
+ export type Measured = BasedRate;
57
52
  export declare const measure: (count: number | null, base: Base) => Measured;
58
- /** The rate alone, without the deprecated `trials` and `interval`. */
53
+ /** The rate alone, without any field a caller added beside it. */
59
54
  export declare const replyRateOf: (measured: Measured | null) => BasedRate;
60
55
  /** Adds rows of counts; a count no row reports stays `null`. */
61
56
  export declare const sumRows: (rows: readonly MetricRow[]) => MetricCounts;