outbound-sdk 0.6.0 → 0.7.1

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 (119) hide show
  1. package/dist/alerts/check-schema.d.ts +1 -1
  2. package/dist/alerts/index.js +6 -6
  3. package/dist/audit/index.js +2 -2
  4. package/dist/benchmarks/index.js +4 -4
  5. package/dist/budget/index.js +2 -2
  6. package/dist/cards/index.js +54 -44
  7. package/dist/chunks/{chunk-BLCJHP5H.js → chunk-45TXPJW7.js} +1 -0
  8. package/dist/chunks/chunk-4AVYRVN5.js +239 -0
  9. package/dist/chunks/{chunk-YYCT3NGV.js → chunk-65YAGEWZ.js} +24 -7
  10. package/dist/chunks/{chunk-3JOC5DGD.js → chunk-6NSCPTOY.js} +488 -127
  11. package/dist/chunks/{chunk-W22SDX6S.js → chunk-7I3EPR23.js} +3 -3
  12. package/dist/chunks/{chunk-MGR6HREO.js → chunk-BNDHEDHD.js} +2 -2
  13. package/dist/chunks/chunk-DNPNTD5W.js +81 -0
  14. package/dist/chunks/{chunk-53DCVFUB.js → chunk-FALWG5U3.js} +1 -0
  15. package/dist/chunks/{chunk-OLPMBRXM.js → chunk-GL7BABF2.js} +2 -2
  16. package/dist/chunks/{chunk-ZOAG2C6V.js → chunk-HIAK2GCI.js} +9 -2
  17. package/dist/chunks/{chunk-SXGCKCAR.js → chunk-I7DXXGNZ.js} +40 -9
  18. package/dist/chunks/{chunk-BK5SLY32.js → chunk-JRL3QRBS.js} +264 -76
  19. package/dist/chunks/{chunk-PHNQ3WC2.js → chunk-KTYTE2BU.js} +4 -3
  20. package/dist/chunks/{chunk-JWGSB7PT.js → chunk-LD6F46UT.js} +2 -2
  21. package/dist/chunks/{chunk-2D42TQFU.js → chunk-LVZGIKNF.js} +2 -2
  22. package/dist/chunks/{chunk-PQSTQKRD.js → chunk-M2VXGLLZ.js} +35 -2
  23. package/dist/chunks/{chunk-UWUPUMM2.js → chunk-MW4C6LTN.js} +2 -2
  24. package/dist/chunks/chunk-OK3GAZMT.js +51 -0
  25. package/dist/chunks/{chunk-BOWXGMN3.js → chunk-POBAY3TI.js} +80 -4
  26. package/dist/chunks/{chunk-J7DDZ4C2.js → chunk-QFC4ZHD3.js} +1 -1
  27. package/dist/chunks/{chunk-TFICTGM2.js → chunk-T5MJMW3R.js} +1 -1
  28. package/dist/chunks/{chunk-GFDNRWR3.js → chunk-UFQ4WMLU.js} +1 -1
  29. package/dist/chunks/{chunk-QAKJ76HB.js → chunk-YW6FFVSZ.js} +1 -1
  30. package/dist/cli/bin.js +14 -14
  31. package/dist/cli/by-name.d.ts +28 -0
  32. package/dist/cli/commands.d.ts +2 -1
  33. package/dist/cli/config.d.ts +3 -2
  34. package/dist/cli/envelope.d.ts +50 -0
  35. package/dist/cli/index.d.ts +5 -0
  36. package/dist/cli/index.js +13 -13
  37. package/dist/cli/listing.d.ts +13 -0
  38. package/dist/cli/native.d.ts +4 -0
  39. package/dist/cli/options.d.ts +88 -0
  40. package/dist/cli/output.d.ts +13 -1
  41. package/dist/cli/suggest.d.ts +10 -0
  42. package/dist/cli/update.d.ts +25 -2
  43. package/dist/clients/index.js +6 -6
  44. package/dist/combine/index.js +7 -7
  45. package/dist/emailbison/capabilities.d.ts +1 -0
  46. package/dist/emailbison/index.js +38 -14
  47. package/dist/emailbison/map-stats.d.ts +10 -0
  48. package/dist/exporter/index.js +2 -2
  49. package/dist/failover/index.js +2 -2
  50. package/dist/fixtures/index.js +4 -4
  51. package/dist/heyreach/capabilities.d.ts +3 -0
  52. package/dist/heyreach/index.js +34 -12
  53. package/dist/heyreach/map-account.d.ts +2 -2
  54. package/dist/identity/index.js +2 -2
  55. package/dist/index.js +9 -7
  56. package/dist/insights/copy/audit-samples.d.ts +24 -0
  57. package/dist/insights/copy/audit-variant.d.ts +34 -0
  58. package/dist/insights/copy/copy-audit.d.ts +26 -12
  59. package/dist/insights/copy/copy-preview.d.ts +16 -3
  60. package/dist/insights/copy/index.d.ts +6 -0
  61. package/dist/insights/copy/reply-timing.d.ts +4 -0
  62. package/dist/insights/copy/shared.d.ts +4 -1
  63. package/dist/insights/copy/step-funnel.d.ts +20 -6
  64. package/dist/insights/copy/variant-test.d.ts +2 -3
  65. package/dist/insights/index.js +1138 -589
  66. package/dist/insights/inputs.generated.d.ts +47 -11
  67. package/dist/insights/ops/campaign-diagnosis.d.ts +2 -0
  68. package/dist/insights/ops/diagnosis-checks.d.ts +20 -1
  69. package/dist/insights/ops/index.d.ts +2 -0
  70. package/dist/insights/ops/pipeline-forecast.d.ts +17 -6
  71. package/dist/insights/people/account-summary.d.ts +14 -1
  72. package/dist/insights/people/auto-replies.d.ts +14 -0
  73. package/dist/insights/people/dropped-replies.d.ts +1 -1
  74. package/dist/insights/people/hot-leads.d.ts +5 -1
  75. package/dist/insights/people/index.d.ts +4 -0
  76. package/dist/insights/people/lead-collisions.d.ts +11 -2
  77. package/dist/insights/people/person-summary.d.ts +19 -3
  78. package/dist/insights/people/personalization-gaps.d.ts +14 -8
  79. package/dist/insights/people/suppression-check.d.ts +9 -0
  80. package/dist/insights/registry.d.ts +12 -0
  81. package/dist/insights/step.d.ts +15 -0
  82. package/dist/insights/variables.d.ts +2 -0
  83. package/dist/instantly/capabilities.d.ts +4 -0
  84. package/dist/instantly/index.js +263 -53
  85. package/dist/instantly/map-stats.d.ts +4 -0
  86. package/dist/instantly/stats-tracking.d.ts +19 -0
  87. package/dist/instantly/thread.d.ts +9 -0
  88. package/dist/internal/adapter.d.ts +5 -0
  89. package/dist/internal/auto-reply.d.ts +20 -0
  90. package/dist/internal/capabilities.d.ts +2 -0
  91. package/dist/internal/entities-account.d.ts +1 -0
  92. package/dist/internal/entities.d.ts +79 -2
  93. package/dist/internal/fields.d.ts +37 -1
  94. package/dist/internal/metrics.d.ts +23 -1
  95. package/dist/internal/outbound/api.d.ts +2 -0
  96. package/dist/internal/records.d.ts +2 -2
  97. package/dist/internal/reply-people.d.ts +37 -0
  98. package/dist/internal/runway.d.ts +42 -0
  99. package/dist/internal/sender-screen.d.ts +9 -0
  100. package/dist/internal/tracking.d.ts +33 -0
  101. package/dist/loader/index.js +4 -4
  102. package/dist/memory/data.d.ts +2 -1
  103. package/dist/memory/index.js +23 -12
  104. package/dist/redact/index.js +3 -3
  105. package/dist/smartlead/capabilities.d.ts +4 -0
  106. package/dist/smartlead/index.js +152 -38
  107. package/dist/smartlead/map-account.d.ts +3 -0
  108. package/dist/smartlead/stats-tracking.d.ts +22 -0
  109. package/dist/sync/index.js +2 -2
  110. package/dist/tools/ai-sdk.js +8 -7
  111. package/dist/tools/by-name.d.ts +18 -0
  112. package/dist/tools/campaign-tools.d.ts +6 -2
  113. package/dist/tools/claude-agent.js +8 -7
  114. package/dist/tools/index.js +9 -8
  115. package/dist/tools/shared.d.ts +7 -0
  116. package/dist/tracing/index.js +2 -2
  117. package/dist/webhooks/index.js +12 -11
  118. package/package.json +1 -1
  119. package/dist/chunks/chunk-HWHI4LFY.js +0 -102
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Outbound,
4
4
  createOutbound,
5
5
  fullJitterBackoff
6
- } from "./chunks/chunk-YYCT3NGV.js";
6
+ } from "./chunks/chunk-65YAGEWZ.js";
7
7
  import {
8
8
  MemoryRateLimitStore
9
9
  } from "./chunks/chunk-4O2HRTTI.js";
@@ -22,7 +22,7 @@ import {
22
22
  senderHealthSchema,
23
23
  tagSchema,
24
24
  webhookSubscriptionSchema
25
- } from "./chunks/chunk-ZOAG2C6V.js";
25
+ } from "./chunks/chunk-HIAK2GCI.js";
26
26
  import "./chunks/chunk-PTZO4QXR.js";
27
27
  import {
28
28
  defineNative
@@ -41,18 +41,19 @@ import {
41
41
  metricRowSchema,
42
42
  metricScopeSchema,
43
43
  outboundEventSchema,
44
+ recipientMailProviderSchema,
44
45
  replySchema,
45
46
  senderSchema,
46
47
  senderStatusSchema,
47
48
  sequenceSchema,
48
49
  workspaceSchema
49
- } from "./chunks/chunk-BOWXGMN3.js";
50
+ } from "./chunks/chunk-POBAY3TI.js";
50
51
  import {
51
52
  METRIC_DEFINITIONS,
52
53
  computeRates,
53
54
  emptyCounts,
54
55
  sumCounts
55
- } from "./chunks/chunk-PQSTQKRD.js";
56
+ } from "./chunks/chunk-M2VXGLLZ.js";
56
57
  import {
57
58
  SCHEMA_VERSION,
58
59
  campaignStatusSchema,
@@ -61,7 +62,7 @@ import {
61
62
  import {
62
63
  makeRef,
63
64
  parseRef
64
- } from "./chunks/chunk-QAKJ76HB.js";
65
+ } from "./chunks/chunk-YW6FFVSZ.js";
65
66
  import {
66
67
  profileSlug
67
68
  } from "./chunks/chunk-NAWZ73QS.js";
@@ -75,8 +76,8 @@ import {
75
76
  REDACTED_KEY,
76
77
  makeErrorMapper,
77
78
  redactText
78
- } from "./chunks/chunk-J7DDZ4C2.js";
79
- import "./chunks/chunk-BLCJHP5H.js";
79
+ } from "./chunks/chunk-QFC4ZHD3.js";
80
+ import "./chunks/chunk-45TXPJW7.js";
80
81
  export {
81
82
  CAPABILITY_KEYS,
82
83
  DEFAULT_SHARE,
@@ -117,6 +118,7 @@ export {
117
118
  parseRef,
118
119
  placementTestSchema,
119
120
  profileSlug,
121
+ recipientMailProviderSchema,
120
122
  redactText,
121
123
  replyCategorySchema,
122
124
  replySchema,
@@ -0,0 +1,24 @@
1
+ import type { Lead, SequenceStep, SequenceVariant } from "../../internal/entities.ts";
2
+ import type { CopyFinding } from "./audit-variant.ts";
3
+ import type { Limits } from "./copy-checks.ts";
4
+ type Copy = Pick<SequenceVariant, "body" | "subject">;
5
+ /** Whether the variant's subject or body is mostly variables. */
6
+ export declare const writtenPerLead: (variant: Copy) => boolean;
7
+ /** The variable keys in the variants written per lead. */
8
+ export declare const perLeadKeys: (steps: readonly SequenceStep[]) => Set<string>;
9
+ /** The `samples` leads that fill the most of `keys`. */
10
+ export declare const pickSamples: (leads: readonly Lead[], keys: ReadonlySet<string>, samples: number) => Lead[];
11
+ export interface SampleAudit {
12
+ readonly findings: readonly CopyFinding[];
13
+ /** The leads whose rendered copy was audited in at least one variant. */
14
+ readonly leads: readonly string[];
15
+ /** Variants written per lead that no sample lead's values filled. */
16
+ readonly unaudited: number;
17
+ }
18
+ /**
19
+ * Audits each variant written per lead as each lead receives it. A lead
20
+ * whose values leave the copy mostly variables still is skipped for that
21
+ * variant: its gaps are personalization_gaps' to report.
22
+ */
23
+ export declare const auditSamples: (steps: readonly SequenceStep[], leads: readonly Lead[], limits: Limits, isEmail: boolean) => SampleAudit;
24
+ export {};
@@ -0,0 +1,34 @@
1
+ import type { SequenceStep, SequenceVariant } from "../../internal/entities.ts";
2
+ import type { StepPosition } from "../step.ts";
3
+ import type { CheckName, Limits, Severity } from "./copy-checks.ts";
4
+ export interface CopyFinding extends StepPosition {
5
+ readonly variantKey: string;
6
+ readonly action: string;
7
+ readonly check: CheckName;
8
+ readonly severity: Severity;
9
+ readonly finding: string;
10
+ /** The text that triggered the check. */
11
+ readonly text: string;
12
+ /**
13
+ * The lead whose rendered copy triggered it, for copy written per lead in
14
+ * variables. `null` when the finding is in the copy as the campaign stores
15
+ * it. Always set; optional in the type so a finding built by hand still fits.
16
+ */
17
+ readonly lead?: string | null;
18
+ }
19
+ export interface Thread {
20
+ /** The first email step. `null` when the sequence has none. */
21
+ readonly first: number | null;
22
+ /**
23
+ * The subjects the first email step sends under. `null` when they are
24
+ * written per lead and not known, so no follow-up is judged against them.
25
+ */
26
+ readonly subjects: ReadonlySet<string> | null;
27
+ }
28
+ /** Every finding in one variant. `thread` is `null` on a LinkedIn campaign. */
29
+ export declare const auditVariant: (step: SequenceStep, variant: SequenceVariant, limits: Limits, thread: Thread | null, lead: string | null) => CopyFinding[];
30
+ /**
31
+ * The first step and its subjects. `perLead` says whether a variant of it is
32
+ * written per lead; then its subjects are not known from the template.
33
+ */
34
+ export declare const threadOf: (steps: readonly SequenceStep[], perLead: (variant: SequenceVariant) => boolean) => Thread;
@@ -1,15 +1,6 @@
1
+ import type { CopyFinding } from "./audit-variant.ts";
1
2
  import type { CheckName, Severity } from "./copy-checks.ts";
2
- export interface CopyFinding {
3
- /** Counted from 0. */
4
- readonly step: number;
5
- readonly variantKey: string;
6
- readonly action: string;
7
- readonly check: CheckName;
8
- readonly severity: Severity;
9
- readonly finding: string;
10
- /** The text that triggered the check. */
11
- readonly text: string;
12
- }
3
+ export type { CopyFinding } from "./audit-variant.ts";
13
4
  export interface CheckCount {
14
5
  readonly check: CheckName;
15
6
  readonly severity: Severity;
@@ -20,7 +11,12 @@ export interface CopyAudit {
20
11
  /** The campaign's name, from the campaign record the audit reads. */
21
12
  readonly campaignName: string;
22
13
  readonly channel: "email" | "linkedin";
23
- /** `true` when no check found anything in the copy that could be read. */
14
+ /**
15
+ * `true` when no check found anything and every variant was audited.
16
+ * `false` on any finding, and also when copy written per lead could not be
17
+ * audited for every variant: then `variantsNotAudited` is above 0 and a
18
+ * note says why, and no finding does not mean a problem was found.
19
+ */
24
20
  readonly clean: boolean;
25
21
  /** High severity first, then by step and variant. */
26
22
  readonly findings: readonly CopyFinding[];
@@ -35,6 +31,20 @@ export interface CopyAudit {
35
31
  readonly variantsChecked: number;
36
32
  /** Variants whose body the vendor did not return; their body checks were skipped. */
37
33
  readonly variantsWithoutBody: number;
34
+ /**
35
+ * Variants whose subject or body is mostly variables, such as `{{body_1}}`.
36
+ * They are audited as sample leads receive them, not as stored. This and
37
+ * `leadsAudited` are always set; optional in the type so an audit built by
38
+ * hand still fits.
39
+ */
40
+ readonly variantsWrittenPerLead?: number;
41
+ /** The leads whose rendered copy was audited. Empty when no copy is written per lead. */
42
+ readonly leadsAudited?: readonly string[];
43
+ /**
44
+ * Variants written per lead that no sample lead's copy could be rendered
45
+ * for, so they were not audited at all. Above 0 makes `clean` `false`.
46
+ */
47
+ readonly variantsNotAudited?: number;
38
48
  }
39
49
  export declare const copyAudit: import("../define.ts").InsightDefinition<"copyAudit", {
40
50
  campaign: string;
@@ -43,7 +53,9 @@ export declare const copyAudit: import("../define.ts").InsightDefinition<"copyAu
43
53
  max_connection_chars: number;
44
54
  max_exclamations: number;
45
55
  max_links: number;
56
+ max_leads: number;
46
57
  max_subject_chars: number;
58
+ samples: number;
47
59
  spam_words: string[];
48
60
  }, CopyAudit, {
49
61
  campaign: string;
@@ -52,6 +64,8 @@ export declare const copyAudit: import("../define.ts").InsightDefinition<"copyAu
52
64
  max_connection_chars?: number | undefined;
53
65
  max_exclamations?: number | undefined;
54
66
  max_links?: number | undefined;
67
+ max_leads?: number | undefined;
55
68
  max_subject_chars?: number | undefined;
69
+ samples?: number | undefined;
56
70
  spam_words?: string[] | undefined;
57
71
  }>;
@@ -1,3 +1,5 @@
1
+ import type { Lead, Sequence, SequenceVariant } from "../../internal/entities.ts";
2
+ import type { StepPosition } from "../step.ts";
1
3
  export interface CopyText {
2
4
  readonly subject: string | null;
3
5
  readonly body: string | null;
@@ -19,9 +21,7 @@ export interface PreviewVariant {
19
21
  */
20
22
  readonly unfilled: readonly string[];
21
23
  }
22
- export interface PreviewStep {
23
- /** The step, counted from 0. */
24
- readonly step: number;
24
+ export interface PreviewStep extends StepPosition {
25
25
  readonly action: string;
26
26
  readonly delayDays: number | null;
27
27
  readonly variants: readonly PreviewVariant[];
@@ -47,6 +47,19 @@ export interface CopyPreview {
47
47
  readonly unfilled: number;
48
48
  };
49
49
  }
50
+ /** Distinct variable keys across every subject and body. */
51
+ export declare const keysIn: (sequence: Sequence) => Set<string>;
52
+ /** Leads by how many of `keys` they fill, most first; the first read wins a tie. */
53
+ export declare const rankLeads: (leads: readonly Lead[], keys: ReadonlySet<string>) => Lead[];
54
+ export interface RenderedVariant extends CopyText {
55
+ /** Variables left as written, as the copy writes them. */
56
+ readonly unfilled: readonly string[];
57
+ }
58
+ /**
59
+ * One variant's subject and body as `lead` receives them. With no lead, the
60
+ * copy comes back as written and every variable without a fallback is unfilled.
61
+ */
62
+ export declare const renderVariant: (variant: Pick<SequenceVariant, "body" | "subject">, lead: Lead | undefined) => RenderedVariant;
50
63
  export declare const copyPreview: import("../define.ts").InsightDefinition<"copyPreview", {
51
64
  campaign: string;
52
65
  lead: string | null;
@@ -29,7 +29,9 @@ export declare const COPY_INSIGHTS: readonly [import("../define.ts").InsightDefi
29
29
  max_connection_chars: number;
30
30
  max_exclamations: number;
31
31
  max_links: number;
32
+ max_leads: number;
32
33
  max_subject_chars: number;
34
+ samples: number;
33
35
  spam_words: string[];
34
36
  }, import("./copy-audit.ts").CopyAudit, {
35
37
  campaign: string;
@@ -38,7 +40,9 @@ export declare const COPY_INSIGHTS: readonly [import("../define.ts").InsightDefi
38
40
  max_connection_chars?: number | undefined;
39
41
  max_exclamations?: number | undefined;
40
42
  max_links?: number | undefined;
43
+ max_leads?: number | undefined;
41
44
  max_subject_chars?: number | undefined;
45
+ samples?: number | undefined;
42
46
  spam_words?: string[] | undefined;
43
47
  }>, import("../define.ts").InsightDefinition<"copyPreview", {
44
48
  campaign: string;
@@ -58,11 +62,13 @@ export declare const COPY_INSIGHTS: readonly [import("../define.ts").InsightDefi
58
62
  statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
59
63
  }>, import("../define.ts").InsightDefinition<"replyTiming", {
60
64
  campaign: string | null;
65
+ include_auto: boolean;
61
66
  max_messages: number;
62
67
  since: string | null;
63
68
  timezone_offset_minutes: number;
64
69
  }, import("./reply-timing.ts").ReplyTiming, {
65
70
  campaign?: string | null | undefined;
71
+ include_auto?: boolean | undefined;
66
72
  max_messages?: number | undefined;
67
73
  since?: string | null | undefined;
68
74
  timezone_offset_minutes?: number | undefined;
@@ -55,15 +55,19 @@ export interface ReplyTiming {
55
55
  readonly unpaired: number;
56
56
  /** `unpaired` over `received`. Over 0.25 the answer is marked partial. `null` with no reply. */
57
57
  readonly unpairedShare: number | null;
58
+ /** Received messages flagged automatic and left out of every figure; 0 with `include_auto`. Always set by reply_timing; optional so a value built by hand stays valid. */
59
+ readonly autoReplies?: number;
58
60
  };
59
61
  }
60
62
  export declare const replyTiming: import("../define.ts").InsightDefinition<"replyTiming", {
61
63
  campaign: string | null;
64
+ include_auto: boolean;
62
65
  max_messages: number;
63
66
  since: string | null;
64
67
  timezone_offset_minutes: number;
65
68
  }, ReplyTiming, {
66
69
  campaign?: string | null | undefined;
70
+ include_auto?: boolean | undefined;
67
71
  max_messages?: number | undefined;
68
72
  since?: string | null | undefined;
69
73
  timezone_offset_minutes?: number | undefined;
@@ -52,7 +52,10 @@ export type Measured = BasedRate;
52
52
  export declare const measure: (count: number | null, base: Base) => Measured;
53
53
  /** The rate alone, without any field a caller added beside it. */
54
54
  export declare const replyRateOf: (measured: Measured | null) => BasedRate;
55
- /** Adds rows of counts; a count no row reports stays `null`. */
55
+ /**
56
+ * Adds rows of counts; a count no row reports stays `null`, and an open or
57
+ * click count is `null` when any row that sent did not measure it.
58
+ */
56
59
  export declare const sumRows: (rows: readonly MetricRow[]) => MetricCounts;
57
60
  /** Groups values by a key, in first-seen order. */
58
61
  export declare const groupBy: <Value, Key>(values: readonly Value[], keyOf: (value: Value) => Key) => Map<Key, Value[]>;
@@ -1,4 +1,7 @@
1
+ import type { StepPosition } from "../step.ts";
1
2
  import type { BasedRate } from "./shared.ts";
3
+ /** Below this many replies a step's rate is too uncertain to call it reliably above the bar. */
4
+ export declare const MIN_REPLIES = 5;
2
5
  export interface FunnelVariant {
3
6
  readonly variantKey: string;
4
7
  /** The hash of the variant's current copy. `null` when the sequence no longer has the variant. */
@@ -9,9 +12,7 @@ export interface FunnelVariant {
9
12
  readonly replyRate: BasedRate;
10
13
  };
11
14
  }
12
- export interface FunnelStep {
13
- /** Counted from 0. */
14
- readonly step: number;
15
+ export interface FunnelStep extends StepPosition {
15
16
  /** `null` when the stats name a step the sequence no longer has. */
16
17
  readonly action: string | null;
17
18
  readonly delayDays: number | null;
@@ -28,7 +29,12 @@ export interface FunnelStep {
28
29
  readonly sentDrop: number | null;
29
30
  /** `sentDrop` divided by the sends of the step before. */
30
31
  readonly sentDropRate: number | null;
31
- /** `true` when the low end of the reply rate interval is above `min_reply_rate`. `null` when the rate is unknown. */
32
+ /**
33
+ * `true` when the low end of the reply rate interval is above
34
+ * `min_reply_rate` and the step has at least `MIN_REPLIES` (5) replies;
35
+ * `false` when the low end is at or under it. `null` when the rate is
36
+ * unknown, or it is above the bar on too few replies to tell.
37
+ */
32
38
  readonly earnsPlace: boolean | null;
33
39
  /** Empty when the vendor does not split step stats by variant. */
34
40
  readonly variants: readonly FunnelVariant[];
@@ -37,9 +43,17 @@ export interface StepFunnel {
37
43
  readonly campaign: string;
38
44
  /** What the numbers say, in one or two sentences. */
39
45
  readonly finding: string;
40
- /** The step with the most replies. `null` when no step has a reply. */
46
+ /** The step with the most replies, counted from 0. `null` when no step has a reply. */
47
+ readonly topStepIndex: number | null;
48
+ /** `topStepIndex` counted from 1, as a person counts. */
49
+ readonly topStepNumber: number | null;
50
+ /** @deprecated Use `topStepIndex` (the same value, counted from 0) or `topStepNumber`. Removed in 0.8.0. */
41
51
  readonly topStep: number | null;
42
- /** The last step whose reply rate is reliably above `min_reply_rate`. `null` when none is. */
52
+ /** The last step that earns its place (see `earnsPlace`), counted from 0. `null` when none does. */
53
+ readonly lastStepEarningPlaceIndex: number | null;
54
+ /** `lastStepEarningPlaceIndex` counted from 1, as a person counts. */
55
+ readonly lastStepEarningPlaceNumber: number | null;
56
+ /** @deprecated Use `lastStepEarningPlaceIndex` (the same value, counted from 0) or `lastStepEarningPlaceNumber`. Removed in 0.8.0. */
43
57
  readonly lastStepEarningPlace: number | null;
44
58
  readonly steps: readonly FunnelStep[];
45
59
  readonly totals: {
@@ -1,3 +1,4 @@
1
+ import type { StepPosition } from "../step.ts";
1
2
  import type { RateBasis } from "./shared.ts";
2
3
  declare const METRICS: readonly ["replied", "positive", "opened", "clicked"];
3
4
  type Metric = (typeof METRICS)[number];
@@ -20,9 +21,7 @@ export interface TestedVariant {
20
21
  /** Two-sided p-value against the leader. `null` for the leader, a variant not compared, and two rates that are both 0 or both 1. */
21
22
  readonly pValueVsLeader: number | null;
22
23
  }
23
- export interface VariantStepTest {
24
- /** Counted from 0. */
25
- readonly step: number;
24
+ export interface VariantStepTest extends StepPosition {
26
25
  readonly verdict: VariantVerdict;
27
26
  /** The variant with the highest rate among those with enough data. `null` when fewer than two have enough. */
28
27
  readonly leader: string | null;