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,80 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { DayCounts, DayRange } from "./shared.ts";
|
|
3
|
+
declare const metricSchema: z.ZodEnum<{
|
|
4
|
+
bounced: "bounced";
|
|
5
|
+
replied: "replied";
|
|
6
|
+
unsubscribed: "unsubscribed";
|
|
7
|
+
positive: "positive";
|
|
8
|
+
clicked: "clicked";
|
|
9
|
+
contacted: "contacted";
|
|
10
|
+
opened: "opened";
|
|
11
|
+
sent: "sent";
|
|
12
|
+
}>;
|
|
13
|
+
export type AnomalyMetric = z.infer<typeof metricSchema>;
|
|
14
|
+
export interface Anomaly {
|
|
15
|
+
/** `YYYY-MM-DD`. */
|
|
16
|
+
readonly date: string;
|
|
17
|
+
readonly metric: AnomalyMetric;
|
|
18
|
+
readonly value: number;
|
|
19
|
+
readonly baselineMean: number;
|
|
20
|
+
/** Days with data the baseline was built from. */
|
|
21
|
+
readonly baselinePoints: number;
|
|
22
|
+
/** `null` when the baseline was flat: with no spread there is no z-score. */
|
|
23
|
+
readonly zScore: number | null;
|
|
24
|
+
/**
|
|
25
|
+
* How the day was judged. `z_score`: it is `threshold` standard deviations
|
|
26
|
+
* or more from the baseline mean. `flat_baseline`: every baseline day had
|
|
27
|
+
* the same count and this day has another.
|
|
28
|
+
*/
|
|
29
|
+
readonly judgedBy: "flat_baseline" | "z_score";
|
|
30
|
+
readonly direction: "above" | "below";
|
|
31
|
+
readonly finding: string;
|
|
32
|
+
}
|
|
33
|
+
export interface MetricCoverage {
|
|
34
|
+
readonly metric: AnomalyMetric;
|
|
35
|
+
/** Checked days the vendor reports this count for. */
|
|
36
|
+
readonly daysWithData: number;
|
|
37
|
+
/** Of those, the days that had a usable baseline. */
|
|
38
|
+
readonly daysTested: number;
|
|
39
|
+
readonly testable: boolean;
|
|
40
|
+
/** Why no day could be tested. `null` when at least one was. */
|
|
41
|
+
readonly reason: string | null;
|
|
42
|
+
}
|
|
43
|
+
export interface AnomalyOptions {
|
|
44
|
+
readonly metrics: readonly AnomalyMetric[];
|
|
45
|
+
readonly threshold: number;
|
|
46
|
+
readonly baselineDays: number;
|
|
47
|
+
readonly minBaselinePoints: number;
|
|
48
|
+
/** The first day that is tested. Earlier days only feed baselines. */
|
|
49
|
+
readonly firstDay: string;
|
|
50
|
+
}
|
|
51
|
+
export interface AnomalyScan {
|
|
52
|
+
/** Newest first, then the largest break first. */
|
|
53
|
+
readonly anomalies: readonly Anomaly[];
|
|
54
|
+
readonly metrics: readonly MetricCoverage[];
|
|
55
|
+
}
|
|
56
|
+
export interface Anomalies extends AnomalyScan {
|
|
57
|
+
/** The campaign's ref, or `workspace`. */
|
|
58
|
+
readonly scope: string;
|
|
59
|
+
/** The days checked. */
|
|
60
|
+
readonly period: DayRange;
|
|
61
|
+
readonly threshold: number;
|
|
62
|
+
}
|
|
63
|
+
/** Holds each day's count to the days before it. `series` is oldest first and includes the baseline days. */
|
|
64
|
+
export declare const findAnomalies: (series: readonly DayCounts[], options: AnomalyOptions) => AnomalyScan;
|
|
65
|
+
export declare const anomalies: import("../define.ts").InsightDefinition<"anomalies", {
|
|
66
|
+
baseline_days: number;
|
|
67
|
+
campaign: string | null;
|
|
68
|
+
days: number;
|
|
69
|
+
metrics: ("bounced" | "replied" | "unsubscribed" | "positive" | "clicked" | "contacted" | "opened" | "sent")[];
|
|
70
|
+
min_baseline_points: number;
|
|
71
|
+
threshold: number;
|
|
72
|
+
}, Anomalies, {
|
|
73
|
+
baseline_days?: number | undefined;
|
|
74
|
+
campaign?: string | null | undefined;
|
|
75
|
+
days?: number | undefined;
|
|
76
|
+
metrics?: ("bounced" | "replied" | "unsubscribed" | "positive" | "clicked" | "contacted" | "opened" | "sent")[] | undefined;
|
|
77
|
+
min_baseline_points?: number | undefined;
|
|
78
|
+
threshold?: number | undefined;
|
|
79
|
+
}>;
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { DiagnosisFinding } from "./diagnosis-checks.ts";
|
|
2
|
+
import type { CampaignLabel, OpenRange, Rates, Totals } from "./shared.ts";
|
|
3
|
+
export interface CampaignDiagnosis extends CampaignLabel {
|
|
4
|
+
readonly period: OpenRange;
|
|
5
|
+
readonly totals: Totals;
|
|
6
|
+
readonly rates: Rates;
|
|
7
|
+
/** Most serious first. Empty when nothing was found in what could be checked. */
|
|
8
|
+
readonly findings: readonly DiagnosisFinding[];
|
|
9
|
+
/** What could not be checked, and why. */
|
|
10
|
+
readonly notChecked: readonly string[];
|
|
11
|
+
readonly summary: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const campaignDiagnosis: import("../define.ts").InsightDefinition<"campaignDiagnosis", {
|
|
14
|
+
campaign: string;
|
|
15
|
+
daily_limit_share: number;
|
|
16
|
+
max_bounce_rate: number;
|
|
17
|
+
max_send_drop: number;
|
|
18
|
+
max_senders: number;
|
|
19
|
+
min_positive_share: number;
|
|
20
|
+
min_reply_rate: number;
|
|
21
|
+
min_sent: number;
|
|
22
|
+
min_weekly_hours: number;
|
|
23
|
+
recent_days: number;
|
|
24
|
+
from: string | null;
|
|
25
|
+
to: string | null;
|
|
26
|
+
}, CampaignDiagnosis, {
|
|
27
|
+
campaign: string;
|
|
28
|
+
daily_limit_share?: number | undefined;
|
|
29
|
+
max_bounce_rate?: number | undefined;
|
|
30
|
+
max_send_drop?: number | undefined;
|
|
31
|
+
max_senders?: number | undefined;
|
|
32
|
+
min_positive_share?: number | undefined;
|
|
33
|
+
min_reply_rate?: number | undefined;
|
|
34
|
+
min_sent?: number | undefined;
|
|
35
|
+
min_weekly_hours?: number | undefined;
|
|
36
|
+
recent_days?: number | undefined;
|
|
37
|
+
from?: string | null | undefined;
|
|
38
|
+
to?: string | null | undefined;
|
|
39
|
+
}>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CampaignLabel, CampaignTotals, Measured, OpenRange } from "./shared.ts";
|
|
3
|
+
declare const metricSchema: z.ZodEnum<{
|
|
4
|
+
reply_rate: "reply_rate";
|
|
5
|
+
bounce_rate: "bounce_rate";
|
|
6
|
+
positive_reply_rate: "positive_reply_rate";
|
|
7
|
+
}>;
|
|
8
|
+
export type RankingMetric = z.infer<typeof metricSchema>;
|
|
9
|
+
export interface RankedCampaign extends CampaignLabel, Measured {
|
|
10
|
+
/** 1 is the best. */
|
|
11
|
+
readonly rank: number;
|
|
12
|
+
readonly sent: number | null;
|
|
13
|
+
}
|
|
14
|
+
export interface UnrankedCampaign extends CampaignLabel {
|
|
15
|
+
readonly sent: number | null;
|
|
16
|
+
readonly reason: string;
|
|
17
|
+
}
|
|
18
|
+
export interface RankingGap {
|
|
19
|
+
/** The rate of the campaign ranked first. */
|
|
20
|
+
readonly top: number | null;
|
|
21
|
+
/** The median rate of the ranked campaigns. */
|
|
22
|
+
readonly median: number | null;
|
|
23
|
+
/** `top` minus `median`. */
|
|
24
|
+
readonly difference: number | null;
|
|
25
|
+
}
|
|
26
|
+
export interface Ranking {
|
|
27
|
+
/** Best first: by the low end of the interval, or by the high end, lowest first, for bounce rate. */
|
|
28
|
+
readonly ranked: readonly RankedCampaign[];
|
|
29
|
+
readonly tooFewSends: readonly UnrankedCampaign[];
|
|
30
|
+
/** Campaigns whose count for this metric the vendor does not report. */
|
|
31
|
+
readonly unknown: readonly UnrankedCampaign[];
|
|
32
|
+
readonly gap: RankingGap;
|
|
33
|
+
}
|
|
34
|
+
export interface CampaignRanking extends Ranking {
|
|
35
|
+
readonly metric: RankingMetric;
|
|
36
|
+
readonly better: "higher" | "lower";
|
|
37
|
+
readonly period: OpenRange;
|
|
38
|
+
}
|
|
39
|
+
/** Ranks campaigns that sent enough, and sets the rest aside with the reason. */
|
|
40
|
+
export declare const rankCampaigns: (entries: readonly CampaignTotals[], metric: RankingMetric, minSent: number) => Ranking;
|
|
41
|
+
export declare const campaignRanking: import("../define.ts").InsightDefinition<"campaignRanking", {
|
|
42
|
+
metric: "reply_rate" | "bounce_rate" | "positive_reply_rate";
|
|
43
|
+
min_sent: number;
|
|
44
|
+
max_campaigns: number;
|
|
45
|
+
statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
|
|
46
|
+
from: string | null;
|
|
47
|
+
to: string | null;
|
|
48
|
+
}, CampaignRanking, {
|
|
49
|
+
metric?: "reply_rate" | "bounce_rate" | "positive_reply_rate" | undefined;
|
|
50
|
+
min_sent?: number | undefined;
|
|
51
|
+
max_campaigns?: number | undefined;
|
|
52
|
+
statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
|
|
53
|
+
from?: string | null | undefined;
|
|
54
|
+
to?: string | null | undefined;
|
|
55
|
+
}>;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Channel } from "../../internal/entities.ts";
|
|
2
|
+
import type { ProportionTest } from "../stats.ts";
|
|
3
|
+
import type { Measured, OpenRange, Totals } from "./shared.ts";
|
|
4
|
+
export interface ChannelGroup extends Totals {
|
|
5
|
+
readonly channel: Channel;
|
|
6
|
+
readonly campaigns: number;
|
|
7
|
+
readonly replyRate: Measured;
|
|
8
|
+
readonly positiveRate: Measured;
|
|
9
|
+
/** Connection requests accepted out of those sent. `null` for email. */
|
|
10
|
+
readonly acceptance: Measured | null;
|
|
11
|
+
}
|
|
12
|
+
export interface ProviderGroup extends ChannelGroup {
|
|
13
|
+
readonly provider: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ChannelComparison {
|
|
16
|
+
/** The channel with the higher reply rate. */
|
|
17
|
+
readonly higher: Channel;
|
|
18
|
+
/** The higher reply rate minus the lower one. */
|
|
19
|
+
readonly difference: number;
|
|
20
|
+
readonly test: ProportionTest;
|
|
21
|
+
}
|
|
22
|
+
export interface ChannelMix {
|
|
23
|
+
readonly period: OpenRange;
|
|
24
|
+
/** Email first, then LinkedIn; only the channels that have campaigns. */
|
|
25
|
+
readonly channels: readonly ChannelGroup[];
|
|
26
|
+
/** `null` when there is one channel, or a channel has no counts to compare. */
|
|
27
|
+
readonly comparison: ChannelComparison | null;
|
|
28
|
+
readonly finding: string;
|
|
29
|
+
/** The same numbers for each tool and channel. */
|
|
30
|
+
readonly byProvider: readonly ProviderGroup[];
|
|
31
|
+
}
|
|
32
|
+
export declare const channelMix: import("../define.ts").InsightDefinition<"channelMix", {
|
|
33
|
+
alpha: number;
|
|
34
|
+
max_campaigns: number;
|
|
35
|
+
statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
|
|
36
|
+
from: string | null;
|
|
37
|
+
to: string | null;
|
|
38
|
+
}, ChannelMix, {
|
|
39
|
+
alpha?: number | undefined;
|
|
40
|
+
max_campaigns?: number | undefined;
|
|
41
|
+
statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
|
|
42
|
+
from?: string | null | undefined;
|
|
43
|
+
to?: string | null | undefined;
|
|
44
|
+
}>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Anomaly } from "./anomalies.ts";
|
|
2
|
+
import type { RankedCampaign } from "./campaign-ranking.ts";
|
|
3
|
+
import type { Comparison } from "./period-comparison.ts";
|
|
4
|
+
import type { CampaignLabel, DayRange } from "./shared.ts";
|
|
5
|
+
export interface BounceProblem extends CampaignLabel {
|
|
6
|
+
readonly bounced: number | null;
|
|
7
|
+
readonly sent: number | null;
|
|
8
|
+
readonly rate: number;
|
|
9
|
+
readonly low: number | null;
|
|
10
|
+
readonly high: number | null;
|
|
11
|
+
}
|
|
12
|
+
export interface LeadRunway extends CampaignLabel {
|
|
13
|
+
/** Leads still active in the campaign. */
|
|
14
|
+
readonly remaining: number;
|
|
15
|
+
readonly dailyContactRate: number | null;
|
|
16
|
+
/** An estimate: `remaining` at the recent daily pace. */
|
|
17
|
+
readonly daysLeft: number;
|
|
18
|
+
}
|
|
19
|
+
export interface ActionItem {
|
|
20
|
+
readonly kind: "add_leads" | "check_anomaly" | "fix_bounces" | "reply_rate_fell" | "review_campaign";
|
|
21
|
+
/** The campaign's ref, or `null` when the item is about the whole account. */
|
|
22
|
+
readonly campaign: string | null;
|
|
23
|
+
readonly campaignName: string | null;
|
|
24
|
+
readonly action: string;
|
|
25
|
+
/** The number behind the item. */
|
|
26
|
+
readonly number: number | null;
|
|
27
|
+
}
|
|
28
|
+
export interface ClientReport {
|
|
29
|
+
readonly days: number;
|
|
30
|
+
readonly period: DayRange;
|
|
31
|
+
readonly previousPeriod: DayRange;
|
|
32
|
+
readonly campaigns: number;
|
|
33
|
+
/** Every campaign read, added together: this period, the one before and the change. */
|
|
34
|
+
readonly totals: Comparison;
|
|
35
|
+
/** Best campaigns by the low end of the reply rate interval. */
|
|
36
|
+
readonly top: readonly RankedCampaign[];
|
|
37
|
+
/** Worst campaigns, worst first. Never repeats one in `top`. */
|
|
38
|
+
readonly bottom: readonly RankedCampaign[];
|
|
39
|
+
/** Worst first. */
|
|
40
|
+
readonly bounceProblems: readonly BounceProblem[];
|
|
41
|
+
/** Unusual days in the period, workspace-wide. `null` when the adapter cannot serve them. */
|
|
42
|
+
readonly anomalies: readonly Anomaly[] | null;
|
|
43
|
+
/** Active campaigns about to run out of leads, soonest first. `null` when the adapter cannot serve them. */
|
|
44
|
+
readonly runningOutOfLeads: readonly LeadRunway[] | null;
|
|
45
|
+
/** What to do, most pressing first. */
|
|
46
|
+
readonly actions: readonly ActionItem[];
|
|
47
|
+
/** The sections left out because the adapter cannot serve them. */
|
|
48
|
+
readonly leftOut: readonly string[];
|
|
49
|
+
}
|
|
50
|
+
export declare const clientReport: import("../define.ts").InsightDefinition<"clientReport", {
|
|
51
|
+
alpha: number;
|
|
52
|
+
anomaly_threshold: number;
|
|
53
|
+
baseline_days: number;
|
|
54
|
+
days: number;
|
|
55
|
+
max_bounce_rate: number;
|
|
56
|
+
max_leads_per_campaign: number;
|
|
57
|
+
min_baseline_points: number;
|
|
58
|
+
min_sent: number;
|
|
59
|
+
runway_days: number;
|
|
60
|
+
top: number;
|
|
61
|
+
max_campaigns: number;
|
|
62
|
+
statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
|
|
63
|
+
}, ClientReport, {
|
|
64
|
+
alpha?: number | undefined;
|
|
65
|
+
anomaly_threshold?: number | undefined;
|
|
66
|
+
baseline_days?: number | undefined;
|
|
67
|
+
days?: number | undefined;
|
|
68
|
+
max_bounce_rate?: number | undefined;
|
|
69
|
+
max_leads_per_campaign?: number | undefined;
|
|
70
|
+
min_baseline_points?: number | undefined;
|
|
71
|
+
min_sent?: number | undefined;
|
|
72
|
+
runway_days?: number | undefined;
|
|
73
|
+
top?: number | undefined;
|
|
74
|
+
max_campaigns?: number | undefined;
|
|
75
|
+
statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
|
|
76
|
+
}>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CampaignSettings } from "../../internal/entities-account.ts";
|
|
2
|
+
import type { Campaign, Sender } from "../../internal/entities.ts";
|
|
3
|
+
import type { Rates, Totals } from "./shared.ts";
|
|
4
|
+
export type DiagnosisCode = "falling_sends" | "few_positive_replies" | "high_bounce_rate" | "inactive_sender" | "low_reply_rate" | "no_recent_sends" | "schedule_limits_volume" | "short_sequence" | "too_little_volume" | "tracking_off";
|
|
5
|
+
export interface DiagnosisFinding {
|
|
6
|
+
readonly code: DiagnosisCode;
|
|
7
|
+
readonly severity: "high" | "low" | "medium";
|
|
8
|
+
readonly finding: string;
|
|
9
|
+
/** The numbers the finding rests on. `null` is one the vendor does not report. */
|
|
10
|
+
readonly numbers: Readonly<Record<string, number | null>>;
|
|
11
|
+
/** What to look at next. */
|
|
12
|
+
readonly next: string;
|
|
13
|
+
}
|
|
14
|
+
export interface RecentSends {
|
|
15
|
+
/** How many days each window covers. */
|
|
16
|
+
readonly days: number;
|
|
17
|
+
/** Messages sent in the last `days`. `null` when the vendor reports none. */
|
|
18
|
+
readonly sent: number | null;
|
|
19
|
+
/** Messages sent in the `days` before those. */
|
|
20
|
+
readonly before: number | null;
|
|
21
|
+
/** Days in the recent window the vendor reports a send count for. */
|
|
22
|
+
readonly daysWithData: number;
|
|
23
|
+
}
|
|
24
|
+
/** What was read about the campaign. A part that could not be read is `null`. */
|
|
25
|
+
export interface Facts {
|
|
26
|
+
readonly campaign: Campaign;
|
|
27
|
+
readonly totals: Totals;
|
|
28
|
+
readonly opened: number | null;
|
|
29
|
+
readonly rates: Rates;
|
|
30
|
+
readonly settings: CampaignSettings | null;
|
|
31
|
+
/** Steps in the main sequence. */
|
|
32
|
+
readonly steps: number | null;
|
|
33
|
+
readonly senders: readonly Sender[] | null;
|
|
34
|
+
readonly recent: RecentSends | null;
|
|
35
|
+
}
|
|
36
|
+
export interface Limits {
|
|
37
|
+
readonly minReplyRate: number;
|
|
38
|
+
readonly maxBounceRate: number;
|
|
39
|
+
readonly minSent: number;
|
|
40
|
+
readonly minPositiveShare: number;
|
|
41
|
+
readonly maxSendDrop: number;
|
|
42
|
+
readonly minWeeklyHours: number;
|
|
43
|
+
readonly dailyLimitShare: number;
|
|
44
|
+
}
|
|
45
|
+
/** Every finding, most serious first. */
|
|
46
|
+
export declare const diagnose: (facts: Facts, limits: Limits) => DiagnosisFinding[];
|
|
47
|
+
/** Rates that could not be judged because the vendor reports no count for them. */
|
|
48
|
+
export declare const unknownRates: (facts: Facts) => string[];
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
export declare const OPS_INSIGHTS: readonly [import("../define.ts").InsightDefinition<"campaignDiagnosis", {
|
|
2
|
+
campaign: string;
|
|
3
|
+
daily_limit_share: number;
|
|
4
|
+
max_bounce_rate: number;
|
|
5
|
+
max_send_drop: number;
|
|
6
|
+
max_senders: number;
|
|
7
|
+
min_positive_share: number;
|
|
8
|
+
min_reply_rate: number;
|
|
9
|
+
min_sent: number;
|
|
10
|
+
min_weekly_hours: number;
|
|
11
|
+
recent_days: number;
|
|
12
|
+
from: string | null;
|
|
13
|
+
to: string | null;
|
|
14
|
+
}, import("./campaign-diagnosis.ts").CampaignDiagnosis, {
|
|
15
|
+
campaign: string;
|
|
16
|
+
daily_limit_share?: number | undefined;
|
|
17
|
+
max_bounce_rate?: number | undefined;
|
|
18
|
+
max_send_drop?: number | undefined;
|
|
19
|
+
max_senders?: number | undefined;
|
|
20
|
+
min_positive_share?: number | undefined;
|
|
21
|
+
min_reply_rate?: number | undefined;
|
|
22
|
+
min_sent?: number | undefined;
|
|
23
|
+
min_weekly_hours?: number | undefined;
|
|
24
|
+
recent_days?: number | undefined;
|
|
25
|
+
from?: string | null | undefined;
|
|
26
|
+
to?: string | null | undefined;
|
|
27
|
+
}>, import("../define.ts").InsightDefinition<"pipelineForecast", {
|
|
28
|
+
campaign: string;
|
|
29
|
+
days: number;
|
|
30
|
+
max_leads: number;
|
|
31
|
+
}, import("./pipeline-forecast.ts").PipelineForecast, {
|
|
32
|
+
campaign: string;
|
|
33
|
+
days?: number | undefined;
|
|
34
|
+
max_leads?: number | undefined;
|
|
35
|
+
}>, import("../define.ts").InsightDefinition<"anomalies", {
|
|
36
|
+
baseline_days: number;
|
|
37
|
+
campaign: string | null;
|
|
38
|
+
days: number;
|
|
39
|
+
metrics: ("bounced" | "replied" | "unsubscribed" | "positive" | "clicked" | "contacted" | "opened" | "sent")[];
|
|
40
|
+
min_baseline_points: number;
|
|
41
|
+
threshold: number;
|
|
42
|
+
}, import("./anomalies.ts").Anomalies, {
|
|
43
|
+
baseline_days?: number | undefined;
|
|
44
|
+
campaign?: string | null | undefined;
|
|
45
|
+
days?: number | undefined;
|
|
46
|
+
metrics?: ("bounced" | "replied" | "unsubscribed" | "positive" | "clicked" | "contacted" | "opened" | "sent")[] | undefined;
|
|
47
|
+
min_baseline_points?: number | undefined;
|
|
48
|
+
threshold?: number | undefined;
|
|
49
|
+
}>, import("../define.ts").InsightDefinition<"periodComparison", {
|
|
50
|
+
alpha: number;
|
|
51
|
+
days: number;
|
|
52
|
+
min_sent: number;
|
|
53
|
+
max_campaigns: number;
|
|
54
|
+
statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
|
|
55
|
+
}, import("./period-comparison.ts").PeriodComparison, {
|
|
56
|
+
alpha?: number | undefined;
|
|
57
|
+
days?: number | undefined;
|
|
58
|
+
min_sent?: number | undefined;
|
|
59
|
+
max_campaigns?: number | undefined;
|
|
60
|
+
statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
|
|
61
|
+
}>, import("../define.ts").InsightDefinition<"campaignRanking", {
|
|
62
|
+
metric: "reply_rate" | "bounce_rate" | "positive_reply_rate";
|
|
63
|
+
min_sent: number;
|
|
64
|
+
max_campaigns: number;
|
|
65
|
+
statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
|
|
66
|
+
from: string | null;
|
|
67
|
+
to: string | null;
|
|
68
|
+
}, import("./campaign-ranking.ts").CampaignRanking, {
|
|
69
|
+
metric?: "reply_rate" | "bounce_rate" | "positive_reply_rate" | undefined;
|
|
70
|
+
min_sent?: number | undefined;
|
|
71
|
+
max_campaigns?: number | undefined;
|
|
72
|
+
statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
|
|
73
|
+
from?: string | null | undefined;
|
|
74
|
+
to?: string | null | undefined;
|
|
75
|
+
}>, import("../define.ts").InsightDefinition<"channelMix", {
|
|
76
|
+
alpha: number;
|
|
77
|
+
max_campaigns: number;
|
|
78
|
+
statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
|
|
79
|
+
from: string | null;
|
|
80
|
+
to: string | null;
|
|
81
|
+
}, import("./channel-mix.ts").ChannelMix, {
|
|
82
|
+
alpha?: number | undefined;
|
|
83
|
+
max_campaigns?: number | undefined;
|
|
84
|
+
statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
|
|
85
|
+
from?: string | null | undefined;
|
|
86
|
+
to?: string | null | undefined;
|
|
87
|
+
}>, import("../define.ts").InsightDefinition<"tagRollup", {
|
|
88
|
+
min_sent: number;
|
|
89
|
+
max_campaigns: number;
|
|
90
|
+
statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
|
|
91
|
+
from: string | null;
|
|
92
|
+
to: string | null;
|
|
93
|
+
}, import("./tag-rollup.ts").TagRollup, {
|
|
94
|
+
min_sent?: number | undefined;
|
|
95
|
+
max_campaigns?: number | undefined;
|
|
96
|
+
statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
|
|
97
|
+
from?: string | null | undefined;
|
|
98
|
+
to?: string | null | undefined;
|
|
99
|
+
}>, import("../define.ts").InsightDefinition<"clientReport", {
|
|
100
|
+
alpha: number;
|
|
101
|
+
anomaly_threshold: number;
|
|
102
|
+
baseline_days: number;
|
|
103
|
+
days: number;
|
|
104
|
+
max_bounce_rate: number;
|
|
105
|
+
max_leads_per_campaign: number;
|
|
106
|
+
min_baseline_points: number;
|
|
107
|
+
min_sent: number;
|
|
108
|
+
runway_days: number;
|
|
109
|
+
top: number;
|
|
110
|
+
max_campaigns: number;
|
|
111
|
+
statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
|
|
112
|
+
}, import("./client-report.ts").ClientReport, {
|
|
113
|
+
alpha?: number | undefined;
|
|
114
|
+
anomaly_threshold?: number | undefined;
|
|
115
|
+
baseline_days?: number | undefined;
|
|
116
|
+
days?: number | undefined;
|
|
117
|
+
max_bounce_rate?: number | undefined;
|
|
118
|
+
max_leads_per_campaign?: number | undefined;
|
|
119
|
+
min_baseline_points?: number | undefined;
|
|
120
|
+
min_sent?: number | undefined;
|
|
121
|
+
runway_days?: number | undefined;
|
|
122
|
+
top?: number | undefined;
|
|
123
|
+
max_campaigns?: number | undefined;
|
|
124
|
+
statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
|
|
125
|
+
}>];
|
|
126
|
+
export type { Anomalies, Anomaly, AnomalyMetric, MetricCoverage, } from "./anomalies.ts";
|
|
127
|
+
export type { CampaignDiagnosis } from "./campaign-diagnosis.ts";
|
|
128
|
+
export type { CampaignRanking, RankedCampaign, RankingGap, RankingMetric, UnrankedCampaign, } from "./campaign-ranking.ts";
|
|
129
|
+
export type { ChannelComparison, ChannelGroup, ChannelMix, ProviderGroup, } from "./channel-mix.ts";
|
|
130
|
+
export type { ActionItem, BounceProblem, ClientReport, LeadRunway, } from "./client-report.ts";
|
|
131
|
+
export type { DiagnosisCode, DiagnosisFinding } from "./diagnosis-checks.ts";
|
|
132
|
+
export type { CampaignComparison, Comparison, PeriodComparison, PeriodNumbers, ThinCampaign, } from "./period-comparison.ts";
|
|
133
|
+
export type { Estimate, PipelineForecast } from "./pipeline-forecast.ts";
|
|
134
|
+
export type { CampaignLabel, DayRange, Measured, OpenRange, Rates, Totals, } from "./shared.ts";
|
|
135
|
+
export type { TagGroup, TagRollup } from "./tag-rollup.ts";
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { Campaign, CampaignStatus } from "../../internal/entities.ts";
|
|
2
|
+
import type { MetricCounts } from "../../internal/metrics.ts";
|
|
3
|
+
import type { InsightContext } from "../define.ts";
|
|
4
|
+
import type { ProportionTest } from "../stats.ts";
|
|
5
|
+
import type { CampaignLabel, DayRange, Totals } from "./shared.ts";
|
|
6
|
+
/** Counts and rates for one period, or the change between two. `null` is unknown. */
|
|
7
|
+
export interface PeriodNumbers extends Totals {
|
|
8
|
+
readonly replyRate: number | null;
|
|
9
|
+
readonly positiveRate: number | null;
|
|
10
|
+
readonly bounceRate: number | null;
|
|
11
|
+
}
|
|
12
|
+
export interface Comparison {
|
|
13
|
+
readonly current: PeriodNumbers;
|
|
14
|
+
readonly previous: PeriodNumbers;
|
|
15
|
+
/** `current` minus `previous`, field by field. Rates change in points: 0.02 is two points. */
|
|
16
|
+
readonly change: PeriodNumbers;
|
|
17
|
+
/** The two-proportion test on the reply rate. `null` when it cannot be run. */
|
|
18
|
+
readonly replyRateTest: ProportionTest | null;
|
|
19
|
+
/** Whether the reply rate moved by more than chance. */
|
|
20
|
+
readonly verdict: "down" | "no_real_change" | "unknown" | "up";
|
|
21
|
+
readonly finding: string;
|
|
22
|
+
}
|
|
23
|
+
export interface CampaignComparison extends CampaignLabel, Comparison {
|
|
24
|
+
}
|
|
25
|
+
export interface ThinCampaign extends CampaignLabel {
|
|
26
|
+
readonly currentSent: number | null;
|
|
27
|
+
readonly previousSent: number | null;
|
|
28
|
+
}
|
|
29
|
+
export interface PeriodComparison {
|
|
30
|
+
readonly days: number;
|
|
31
|
+
readonly current: DayRange;
|
|
32
|
+
readonly previous: DayRange;
|
|
33
|
+
/** Largest change in reply rate first. */
|
|
34
|
+
readonly campaigns: readonly CampaignComparison[];
|
|
35
|
+
readonly tooFewSends: readonly ThinCampaign[];
|
|
36
|
+
/** Every campaign read, added together. */
|
|
37
|
+
readonly total: Comparison;
|
|
38
|
+
/** The vendor's own workspace totals. `null` when the adapter has none. */
|
|
39
|
+
readonly workspace: Comparison | null;
|
|
40
|
+
}
|
|
41
|
+
/** Compares two periods of counts: both sides, the change, and whether the reply rate really moved. */
|
|
42
|
+
export declare const comparePeriods: (current: Totals, previous: Totals, alpha: number) => Comparison;
|
|
43
|
+
export interface ComparedAcross {
|
|
44
|
+
readonly comparison: Comparison;
|
|
45
|
+
/** The rates that leave rows out, by period. Empty when every row is in every rate. */
|
|
46
|
+
readonly partial: readonly string[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Compares two periods that are each several rows added up (campaigns, or
|
|
50
|
+
* the tools of a combined instance). Counts are every row's; each rate is
|
|
51
|
+
* over the rows that report both sides of it.
|
|
52
|
+
*/
|
|
53
|
+
export declare const compareAcross: (current: readonly MetricCounts[], previous: readonly MetricCounts[], alpha: number) => ComparedAcross;
|
|
54
|
+
export interface CampaignPeriods {
|
|
55
|
+
readonly campaign: Campaign;
|
|
56
|
+
readonly current: MetricCounts;
|
|
57
|
+
readonly previous: MetricCounts;
|
|
58
|
+
}
|
|
59
|
+
export interface Periods {
|
|
60
|
+
readonly current: DayRange;
|
|
61
|
+
readonly previous: DayRange;
|
|
62
|
+
readonly campaigns: readonly CampaignPeriods[];
|
|
63
|
+
}
|
|
64
|
+
/** Each campaign's totals for the last `days` and the `days` before: two stats requests per campaign. */
|
|
65
|
+
export declare const readPeriods: (context: InsightContext, options: {
|
|
66
|
+
readonly days: number;
|
|
67
|
+
readonly max_campaigns: number;
|
|
68
|
+
readonly statuses: readonly CampaignStatus[];
|
|
69
|
+
}) => Promise<Periods>;
|
|
70
|
+
/** Every campaign's two periods added together. */
|
|
71
|
+
export declare const totalOf: (campaigns: readonly CampaignPeriods[], alpha: number) => ComparedAcross;
|
|
72
|
+
/** Says in a note which rates of a total leave rows out. Returns the comparison. */
|
|
73
|
+
export declare const noted: (context: InsightContext, where: string, across: ComparedAcross, rows?: string) => Comparison;
|
|
74
|
+
export declare const periodComparison: import("../define.ts").InsightDefinition<"periodComparison", {
|
|
75
|
+
alpha: number;
|
|
76
|
+
days: number;
|
|
77
|
+
min_sent: number;
|
|
78
|
+
max_campaigns: number;
|
|
79
|
+
statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
|
|
80
|
+
}, PeriodComparison, {
|
|
81
|
+
alpha?: number | undefined;
|
|
82
|
+
days?: number | undefined;
|
|
83
|
+
min_sent?: number | undefined;
|
|
84
|
+
max_campaigns?: number | undefined;
|
|
85
|
+
statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
|
|
86
|
+
}>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Campaign, LeadStatus } from "../../internal/entities.ts";
|
|
2
|
+
import type { InsightContext } from "../define.ts";
|
|
3
|
+
import type { CampaignLabel, Measured } from "./shared.ts";
|
|
4
|
+
/** A figure with the range the 95% interval of the rate gives. */
|
|
5
|
+
export interface Estimate {
|
|
6
|
+
readonly expected: number | null;
|
|
7
|
+
readonly low: number | null;
|
|
8
|
+
readonly high: number | null;
|
|
9
|
+
}
|
|
10
|
+
export interface PipelineForecast extends CampaignLabel {
|
|
11
|
+
/** Always `true`: every figure below `remaining` is a projection, not a count. */
|
|
12
|
+
readonly estimate: true;
|
|
13
|
+
readonly leadsRead: number;
|
|
14
|
+
/** `false` when `max_leads` stopped the read, so `remaining` is a minimum. */
|
|
15
|
+
readonly leadsComplete: boolean;
|
|
16
|
+
readonly byStatus: Readonly<Record<LeadStatus, number>>;
|
|
17
|
+
/** Leads still active in the campaign: not replied, bounced, unsubscribed, paused or finished. */
|
|
18
|
+
readonly remaining: number;
|
|
19
|
+
/** New leads contacted per day over the last `days`. `null` when the vendor has no daily contacted count. */
|
|
20
|
+
readonly dailyContactRate: number | null;
|
|
21
|
+
/** `remaining` divided by `dailyContactRate`. */
|
|
22
|
+
readonly daysLeft: number | null;
|
|
23
|
+
/** The campaign's reply rate so far, over its whole history. */
|
|
24
|
+
readonly replyRate: Measured;
|
|
25
|
+
readonly positiveRate: Measured;
|
|
26
|
+
readonly expectedReplies: Estimate;
|
|
27
|
+
readonly expectedPositive: Estimate;
|
|
28
|
+
readonly assumptions: readonly string[];
|
|
29
|
+
readonly finding: string;
|
|
30
|
+
}
|
|
31
|
+
/** Reads one campaign's leads, totals and recent pace, and projects what is left. */
|
|
32
|
+
export declare const forecastCampaign: (context: InsightContext, campaign: Campaign, options: {
|
|
33
|
+
readonly days: number;
|
|
34
|
+
readonly maxLeads: number;
|
|
35
|
+
}) => Promise<PipelineForecast>;
|
|
36
|
+
export declare const pipelineForecast: import("../define.ts").InsightDefinition<"pipelineForecast", {
|
|
37
|
+
campaign: string;
|
|
38
|
+
days: number;
|
|
39
|
+
max_leads: number;
|
|
40
|
+
}, PipelineForecast, {
|
|
41
|
+
campaign: string;
|
|
42
|
+
days?: number | undefined;
|
|
43
|
+
max_leads?: number | undefined;
|
|
44
|
+
}>;
|