outbound-sdk 0.0.0-stage → 0.2.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 (284) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +119 -2
  3. package/dist/alerts/index.d.ts +2 -0
  4. package/dist/alerts/index.js +140 -0
  5. package/dist/alerts/plugin.d.ts +58 -0
  6. package/dist/audit/index.d.ts +33 -0
  7. package/dist/audit/index.js +60 -0
  8. package/dist/benchmarks/index.d.ts +29 -0
  9. package/dist/benchmarks/index.js +72 -0
  10. package/dist/budget/index.d.ts +21 -0
  11. package/dist/budget/index.js +71 -0
  12. package/dist/cache/index.d.ts +31 -0
  13. package/dist/cache/index.js +11 -0
  14. package/dist/cards/content.d.ts +43 -0
  15. package/dist/cards/copy-cards.d.ts +2 -0
  16. package/dist/cards/format.d.ts +39 -0
  17. package/dist/cards/index.d.ts +9 -0
  18. package/dist/cards/index.js +2070 -0
  19. package/dist/cards/notify-cards.d.ts +14 -0
  20. package/dist/cards/ops-cards.d.ts +2 -0
  21. package/dist/cards/parts.d.ts +22 -0
  22. package/dist/cards/people-cards.d.ts +2 -0
  23. package/dist/cards/render.d.ts +28 -0
  24. package/dist/cards/sender-cards.d.ts +2 -0
  25. package/dist/cards/slack-rich.d.ts +19 -0
  26. package/dist/cards/slack-text.d.ts +10 -0
  27. package/dist/cards/slack.d.ts +21 -0
  28. package/dist/cards/spec.d.ts +86 -0
  29. package/dist/cards/tool-cards.d.ts +4 -0
  30. package/dist/chunks/chunk-4O2HRTTI.js +75 -0
  31. package/dist/chunks/chunk-4PSO6JEK.js +357 -0
  32. package/dist/chunks/chunk-6CVZOUHB.js +152 -0
  33. package/dist/chunks/chunk-AFU5E5QB.js +714 -0
  34. package/dist/chunks/chunk-DJ2IUQEU.js +111 -0
  35. package/dist/chunks/chunk-E7JHLNLG.js +187 -0
  36. package/dist/chunks/chunk-FHKSLCVW.js +154 -0
  37. package/dist/chunks/chunk-FKH5N47I.js +40 -0
  38. package/dist/chunks/chunk-HZCTYL22.js +29 -0
  39. package/dist/chunks/chunk-IPUYZD4O.js +25 -0
  40. package/dist/chunks/chunk-IVH3NMQZ.js +61 -0
  41. package/dist/chunks/chunk-LVYG7XZJ.js +45 -0
  42. package/dist/chunks/chunk-NAKXLBA6.js +30 -0
  43. package/dist/chunks/chunk-NAWZ73QS.js +22 -0
  44. package/dist/chunks/chunk-PMSSUWD7.js +636 -0
  45. package/dist/chunks/chunk-PURHK3JU.js +432 -0
  46. package/dist/chunks/chunk-R3Y56YVF.js +43 -0
  47. package/dist/chunks/chunk-RCZ7ZZFU.js +92 -0
  48. package/dist/chunks/chunk-SBIZDCRY.js +106 -0
  49. package/dist/chunks/chunk-U2D34ARZ.js +41 -0
  50. package/dist/chunks/chunk-UAT3JSJZ.js +331 -0
  51. package/dist/chunks/chunk-VQSCHOBV.js +111 -0
  52. package/dist/chunks/chunk-XC6CZP73.js +80 -0
  53. package/dist/chunks/chunk-XNFESPZH.js +2307 -0
  54. package/dist/chunks/chunk-YOTW5ESM.js +118 -0
  55. package/dist/cli/bin.d.ts +2 -0
  56. package/dist/cli/bin.js +35 -0
  57. package/dist/cli/commands.d.ts +19 -0
  58. package/dist/cli/config.d.ts +22 -0
  59. package/dist/cli/index.d.ts +17 -0
  60. package/dist/cli/index.js +30 -0
  61. package/dist/cli/mcp.d.ts +14 -0
  62. package/dist/cli/stdio.d.ts +9 -0
  63. package/dist/clients/index.d.ts +2 -0
  64. package/dist/clients/index.js +117 -0
  65. package/dist/clients/plugin.d.ts +42 -0
  66. package/dist/combine/account.d.ts +4 -0
  67. package/dist/combine/adapter.d.ts +9 -0
  68. package/dist/combine/index.d.ts +2 -0
  69. package/dist/combine/index.js +420 -0
  70. package/dist/combine/route.d.ts +24 -0
  71. package/dist/exporter/index.d.ts +29 -0
  72. package/dist/exporter/index.js +77 -0
  73. package/dist/failover/index.d.ts +11 -0
  74. package/dist/failover/index.js +45 -0
  75. package/dist/fixtures/index.d.ts +27 -0
  76. package/dist/fixtures/index.js +260 -0
  77. package/dist/fixtures/scrub.d.ts +5 -0
  78. package/dist/heyreach/account.d.ts +11 -0
  79. package/dist/heyreach/adapter.d.ts +5 -0
  80. package/dist/heyreach/capabilities.d.ts +70 -0
  81. package/dist/heyreach/client.d.ts +18 -0
  82. package/dist/heyreach/inbox.d.ts +7 -0
  83. package/dist/heyreach/index.d.ts +25 -0
  84. package/dist/heyreach/index.js +1931 -0
  85. package/dist/heyreach/leads.d.ts +4 -0
  86. package/dist/heyreach/lookup.d.ts +15 -0
  87. package/dist/heyreach/map-account.d.ts +31 -0
  88. package/dist/heyreach/map-sequence.d.ts +5 -0
  89. package/dist/heyreach/map-stats.d.ts +13 -0
  90. package/dist/heyreach/map.d.ts +37 -0
  91. package/dist/heyreach/native-organization.d.ts +128 -0
  92. package/dist/heyreach/native-voice.d.ts +106 -0
  93. package/dist/heyreach/native.d.ts +496 -0
  94. package/dist/heyreach/paging.d.ts +7 -0
  95. package/dist/heyreach/webhooks.d.ts +3 -0
  96. package/dist/identity/index.d.ts +3 -0
  97. package/dist/identity/index.js +159 -0
  98. package/dist/identity/keys.d.ts +9 -0
  99. package/dist/identity/plugin.d.ts +34 -0
  100. package/dist/index.d.ts +33 -0
  101. package/dist/index.js +131 -0
  102. package/dist/insights/copy/copy-audit.d.ts +55 -0
  103. package/dist/insights/copy/copy-checks.d.ts +44 -0
  104. package/dist/insights/copy/copy-reuse.d.ts +59 -0
  105. package/dist/insights/copy/index.d.ts +67 -0
  106. package/dist/insights/copy/reply-timing.d.ts +63 -0
  107. package/dist/insights/copy/shared.d.ts +53 -0
  108. package/dist/insights/copy/step-funnel.d.ts +66 -0
  109. package/dist/insights/copy/variant-test.d.ts +64 -0
  110. package/dist/insights/define.d.ts +98 -0
  111. package/dist/insights/index.d.ts +10 -0
  112. package/dist/insights/index.js +4937 -0
  113. package/dist/insights/ops/anomalies.d.ts +80 -0
  114. package/dist/insights/ops/campaign-diagnosis.d.ts +39 -0
  115. package/dist/insights/ops/campaign-ranking.d.ts +56 -0
  116. package/dist/insights/ops/channel-mix.d.ts +44 -0
  117. package/dist/insights/ops/client-report.d.ts +76 -0
  118. package/dist/insights/ops/diagnosis-checks.d.ts +48 -0
  119. package/dist/insights/ops/index.d.ts +135 -0
  120. package/dist/insights/ops/period-comparison.d.ts +86 -0
  121. package/dist/insights/ops/pipeline-forecast.d.ts +44 -0
  122. package/dist/insights/ops/shared.d.ts +155 -0
  123. package/dist/insights/ops/tag-rollup.d.ts +32 -0
  124. package/dist/insights/people/account-summary.d.ts +68 -0
  125. package/dist/insights/people/dropped-replies.d.ts +51 -0
  126. package/dist/insights/people/find.d.ts +18 -0
  127. package/dist/insights/people/hot-leads.d.ts +67 -0
  128. package/dist/insights/people/index.d.ts +88 -0
  129. package/dist/insights/people/lead-collisions.d.ts +43 -0
  130. package/dist/insights/people/person-summary.d.ts +46 -0
  131. package/dist/insights/people/personalization-gaps.d.ts +60 -0
  132. package/dist/insights/people/read.d.ts +40 -0
  133. package/dist/insights/people/suppression-check.d.ts +53 -0
  134. package/dist/insights/plugin.d.ts +40 -0
  135. package/dist/insights/registry.d.ts +335 -0
  136. package/dist/insights/senders/bounce-watch.d.ts +70 -0
  137. package/dist/insights/senders/domain-health.d.ts +69 -0
  138. package/dist/insights/senders/index.d.ts +74 -0
  139. package/dist/insights/senders/read.d.ts +37 -0
  140. package/dist/insights/senders/sender-capacity.d.ts +67 -0
  141. package/dist/insights/senders/sender-load.d.ts +52 -0
  142. package/dist/insights/senders/settings-audit.d.ts +48 -0
  143. package/dist/insights/senders/warmup-readiness.d.ts +39 -0
  144. package/dist/insights/stats.d.ts +45 -0
  145. package/dist/insights/tools.d.ts +16 -0
  146. package/dist/insights/types.d.ts +4 -0
  147. package/dist/instantly/adapter-account.d.ts +5 -0
  148. package/dist/instantly/adapter-mail.d.ts +3 -0
  149. package/dist/instantly/adapter.d.ts +7 -0
  150. package/dist/instantly/capabilities.d.ts +85 -0
  151. package/dist/instantly/client.d.ts +24 -0
  152. package/dist/instantly/index.d.ts +27 -0
  153. package/dist/instantly/index.js +2627 -0
  154. package/dist/instantly/map-account.d.ts +38 -0
  155. package/dist/instantly/map-lead.d.ts +18 -0
  156. package/dist/instantly/map-stats.d.ts +25 -0
  157. package/dist/instantly/map.d.ts +22 -0
  158. package/dist/instantly/native-agents-sales.d.ts +161 -0
  159. package/dist/instantly/native-agents.d.ts +156 -0
  160. package/dist/instantly/native-campaigns.d.ts +101 -0
  161. package/dist/instantly/native-leads.d.ts +93 -0
  162. package/dist/instantly/native-params.d.ts +7 -0
  163. package/dist/instantly/native-search.d.ts +82 -0
  164. package/dist/instantly/native-senders.d.ts +182 -0
  165. package/dist/instantly/native-supersearch.d.ts +149 -0
  166. package/dist/instantly/native-workspace.d.ts +170 -0
  167. package/dist/instantly/native.d.ts +1081 -0
  168. package/dist/instantly/pages.d.ts +29 -0
  169. package/dist/instantly/stats.d.ts +5 -0
  170. package/dist/instantly/webhooks.d.ts +3 -0
  171. package/dist/internal/adapter.d.ts +211 -0
  172. package/dist/internal/capabilities.d.ts +104 -0
  173. package/dist/internal/client.d.ts +15 -0
  174. package/dist/internal/concurrency.d.ts +8 -0
  175. package/dist/internal/cursor.d.ts +10 -0
  176. package/dist/internal/engine/budget.d.ts +44 -0
  177. package/dist/internal/engine/engine.d.ts +45 -0
  178. package/dist/internal/engine/rate-store.d.ts +25 -0
  179. package/dist/internal/engine/request.d.ts +34 -0
  180. package/dist/internal/engine/retry.d.ts +21 -0
  181. package/dist/internal/engine/runtime.d.ts +13 -0
  182. package/dist/internal/entities-account.d.ts +205 -0
  183. package/dist/internal/entities.d.ts +493 -0
  184. package/dist/internal/env.d.ts +4 -0
  185. package/dist/internal/errors.d.ts +62 -0
  186. package/dist/internal/fields.d.ts +462 -0
  187. package/dist/internal/hooks.d.ts +55 -0
  188. package/dist/internal/json.d.ts +49 -0
  189. package/dist/internal/lead-fields.d.ts +21 -0
  190. package/dist/internal/lead-status.d.ts +13 -0
  191. package/dist/internal/limits.d.ts +34 -0
  192. package/dist/internal/metrics.d.ts +64 -0
  193. package/dist/internal/native.d.ts +81 -0
  194. package/dist/internal/outbound/api.d.ts +292 -0
  195. package/dist/internal/outbound/collections.d.ts +31 -0
  196. package/dist/internal/outbound/core.d.ts +36 -0
  197. package/dist/internal/outbound/create.d.ts +16 -0
  198. package/dist/internal/outbound/handles.d.ts +7 -0
  199. package/dist/internal/outbound/native.d.ts +4 -0
  200. package/dist/internal/outbound/operation-shared.d.ts +28 -0
  201. package/dist/internal/outbound/operations-account.d.ts +41 -0
  202. package/dist/internal/outbound/operations.d.ts +42 -0
  203. package/dist/internal/outbound/outbound.d.ts +67 -0
  204. package/dist/internal/outbound/plugins.d.ts +40 -0
  205. package/dist/internal/outbound/raw.d.ts +9 -0
  206. package/dist/internal/outbound/specs-account.d.ts +20 -0
  207. package/dist/internal/outbound/specs.d.ts +14 -0
  208. package/dist/internal/outbound/stats.d.ts +7 -0
  209. package/dist/internal/outbound/validate.d.ts +5 -0
  210. package/dist/internal/outbound/walker.d.ts +22 -0
  211. package/dist/internal/page.d.ts +14 -0
  212. package/dist/internal/record.d.ts +36 -0
  213. package/dist/internal/records.d.ts +7 -0
  214. package/dist/internal/redact.d.ts +18 -0
  215. package/dist/internal/ref.d.ts +16 -0
  216. package/dist/internal/sequence.d.ts +14 -0
  217. package/dist/internal/sha256.d.ts +6 -0
  218. package/dist/internal/text.d.ts +11 -0
  219. package/dist/internal/url.d.ts +9 -0
  220. package/dist/loader/index.d.ts +24 -0
  221. package/dist/loader/index.js +16 -0
  222. package/dist/memory/account-reads.d.ts +5 -0
  223. package/dist/memory/account.d.ts +81 -0
  224. package/dist/memory/adapter.d.ts +16 -0
  225. package/dist/memory/data.d.ts +137 -0
  226. package/dist/memory/demo.d.ts +7 -0
  227. package/dist/memory/index.d.ts +5 -0
  228. package/dist/memory/index.js +867 -0
  229. package/dist/memory/stats.d.ts +6 -0
  230. package/dist/memory/store.d.ts +18 -0
  231. package/dist/providers/index.d.ts +22 -0
  232. package/dist/providers/index.js +10 -0
  233. package/dist/reconcile/index.d.ts +2 -0
  234. package/dist/reconcile/index.js +72 -0
  235. package/dist/reconcile/plugin.d.ts +55 -0
  236. package/dist/redact/index.d.ts +2 -0
  237. package/dist/redact/index.js +197 -0
  238. package/dist/redact/plugin.d.ts +22 -0
  239. package/dist/redis/index.d.ts +41 -0
  240. package/dist/redis/index.js +114 -0
  241. package/dist/smartlead/account.d.ts +5 -0
  242. package/dist/smartlead/adapter.d.ts +5 -0
  243. package/dist/smartlead/capabilities.d.ts +87 -0
  244. package/dist/smartlead/client.d.ts +18 -0
  245. package/dist/smartlead/hmac.d.ts +7 -0
  246. package/dist/smartlead/index.d.ts +24 -0
  247. package/dist/smartlead/index.js +2329 -0
  248. package/dist/smartlead/leads.d.ts +9 -0
  249. package/dist/smartlead/lookup.d.ts +8 -0
  250. package/dist/smartlead/mail.d.ts +5 -0
  251. package/dist/smartlead/map-account.d.ts +34 -0
  252. package/dist/smartlead/map-messages.d.ts +31 -0
  253. package/dist/smartlead/map-stats.d.ts +36 -0
  254. package/dist/smartlead/map.d.ts +62 -0
  255. package/dist/smartlead/native-analytics.d.ts +242 -0
  256. package/dist/smartlead/native-campaigns.d.ts +211 -0
  257. package/dist/smartlead/native-inbox.d.ts +141 -0
  258. package/dist/smartlead/native-params.d.ts +12 -0
  259. package/dist/smartlead/native-services.d.ts +204 -0
  260. package/dist/smartlead/native.d.ts +785 -0
  261. package/dist/smartlead/shared.d.ts +29 -0
  262. package/dist/smartlead/stats.d.ts +5 -0
  263. package/dist/smartlead/webhooks.d.ts +3 -0
  264. package/dist/sync/index.d.ts +2 -0
  265. package/dist/sync/index.js +158 -0
  266. package/dist/sync/plugin.d.ts +58 -0
  267. package/dist/tools/account-tools.d.ts +21 -0
  268. package/dist/tools/ai-sdk.d.ts +8 -0
  269. package/dist/tools/ai-sdk.js +28 -0
  270. package/dist/tools/campaign-tools.d.ts +59 -0
  271. package/dist/tools/claude-agent.d.ts +18 -0
  272. package/dist/tools/claude-agent.js +42 -0
  273. package/dist/tools/index.d.ts +28 -0
  274. package/dist/tools/index.js +22 -0
  275. package/dist/tools/people-tools.d.ts +19 -0
  276. package/dist/tools/registry.d.ts +34 -0
  277. package/dist/tools/shared.d.ts +75 -0
  278. package/dist/tracing/index.d.ts +25 -0
  279. package/dist/tracing/index.js +69 -0
  280. package/dist/webhooks/index.d.ts +3 -0
  281. package/dist/webhooks/index.js +227 -0
  282. package/dist/webhooks/parse.d.ts +41 -0
  283. package/dist/webhooks/secret.d.ts +4 -0
  284. package/package.json +181 -4
@@ -0,0 +1,9 @@
1
+ import type { AdapterContext, LeadQuery, Page } from "../internal/adapter.ts";
2
+ import type { Lead } from "../internal/entities.ts";
3
+ import type { SmartleadClient } from "./client.ts";
4
+ export declare const listLeads: (client: SmartleadClient, ctx: AdapterContext, query: LeadQuery) => Promise<Page<Lead>>;
5
+ /**
6
+ * `GET /leads/{id}`, then the lead's tags from `GET /crm/leads/tags` and, for
7
+ * a lead with a category, the category list.
8
+ */
9
+ export declare const getLead: (client: SmartleadClient, ctx: AdapterContext, id: string) => Promise<Lead>;
@@ -0,0 +1,8 @@
1
+ import type { AdapterContext, LeadQuery, Page } from "../internal/adapter.ts";
2
+ import type { Lead } from "../internal/entities.ts";
3
+ import type { SmartleadClient } from "./client.ts";
4
+ /**
5
+ * The records of one address, one per campaign the lead is in: one request,
6
+ * and a second for the category names when a campaign gives a category.
7
+ */
8
+ export declare const leadsByEmail: (client: SmartleadClient, ctx: AdapterContext, query: LeadQuery) => Promise<Page<Lead>>;
@@ -0,0 +1,5 @@
1
+ import type { AdapterContext, MessageQuery, Page, ReplyQuery } from "../internal/adapter.ts";
2
+ import type { Message, Reply } from "../internal/entities.ts";
3
+ import type { SmartleadClient } from "./client.ts";
4
+ export declare const listMessages: (client: SmartleadClient, ctx: AdapterContext, query: MessageQuery) => Promise<Page<Message>>;
5
+ export declare const listReplies: (client: SmartleadClient, ctx: AdapterContext, query: ReplyQuery) => Promise<Page<Reply>>;
@@ -0,0 +1,34 @@
1
+ import type { BlockEntry, CampaignProgress, CampaignSettings, LeadList, PlacementTest, SenderHealth, Tag, WebhookSubscription } from "../internal/entities-account.ts";
2
+ import type { Json, JsonObject } from "../internal/json.ts";
3
+ import type { Identity } from "../internal/record.ts";
4
+ /** `GET /campaigns/{id}` -> how the campaign is set up to send. */
5
+ export declare const toSettings: (identity: Identity, campaignId: string, raw: JsonObject) => CampaignSettings;
6
+ /**
7
+ * `GET /campaigns/{id}/analytics`: `campaign_lead_stats` counts the
8
+ * campaign's leads by how far they got. `blocked` is Smartlead's own word
9
+ * for a lead stopped by a bounce or the block list.
10
+ */
11
+ export declare const toCampaignProgress: (identity: Identity, campaignId: string, raw: JsonObject) => CampaignProgress;
12
+ /**
13
+ * `GET /email-accounts/{id}/` and `GET /email-accounts/{id}/warmup-stats`
14
+ * (the last seven days) -> a mailbox's health. Smartlead's API reports no DNS
15
+ * records and no block list check. `raw` has no SMTP or IMAP password.
16
+ */
17
+ export declare const toHealth: (identity: Identity, account: JsonObject, stats: Json | undefined) => SenderHealth;
18
+ /**
19
+ * One item of SmartDelivery's `POST /spam-test/report`. The list gives a
20
+ * test's schedule and no creation time, next run or campaign.
21
+ */
22
+ export declare const toPlacementTest: (identity: Identity, raw: JsonObject) => PlacementTest;
23
+ /** One item of `GET /lead-list/`. */
24
+ export declare const toList: (identity: Identity, raw: JsonObject) => LeadList;
25
+ /** One item of `GET /leads/get-domain-block-list`: an address or a domain. */
26
+ export declare const toBlockEntry: (identity: Identity, raw: JsonObject) => BlockEntry[];
27
+ /** One item of `GET /email-accounts/tags`. Smartlead tags have no description. */
28
+ export declare const toTag: (identity: Identity, raw: JsonObject) => Tag;
29
+ /**
30
+ * One item of `GET /campaigns/{id}/webhooks`, or `GET /webhook/{id}`.
31
+ * `campaignId` is the campaign that was asked, used when the item does not
32
+ * name its own; a webhook read by its id has none to fall back on.
33
+ */
34
+ export declare const toWebhook: (identity: Identity, campaignId: string | null, raw: JsonObject) => WebhookSubscription;
@@ -0,0 +1,31 @@
1
+ import type { Message, Reply, ReplyCategory } from "../internal/entities.ts";
2
+ import type { Json, JsonObject } from "../internal/json.ts";
3
+ import type { Identity } from "../internal/record.ts";
4
+ /** Category id -> our category, for the ids that mean one. */
5
+ export type CategoryMap = ReadonlyMap<string, ReplyCategory>;
6
+ /**
7
+ * `GET /leads/fetch-categories` -> the meaning of each category id. Ids are
8
+ * never hardcoded: an account can rename and add categories.
9
+ */
10
+ export declare const toCategoryMap: (body: Json | undefined) => CategoryMap;
11
+ /** The map as it travels in a cursor, and back. */
12
+ export declare const categoriesToJson: (categories: CategoryMap) => JsonObject;
13
+ export declare const categoriesFromJson: (value: Json | undefined) => CategoryMap;
14
+ /** The category ids that mean `category`. */
15
+ export declare const categoryIds: (categories: CategoryMap, category: ReplyCategory) => number[];
16
+ /** One lead row of `GET /campaigns/all-leads-activities` -> its messages. */
17
+ export declare const toActivityMessages: (identity: Identity, row: JsonObject, includeBody: boolean) => Message[];
18
+ /** One item of a lead's message history: `type` is SENT or REPLY. */
19
+ export declare const toHistoryMessage: (identity: Identity, place: {
20
+ readonly campaignId: string;
21
+ readonly leadId: string;
22
+ }, item: JsonObject, includeBody: boolean) => Message;
23
+ /** `GET /master-inbox/{id}` -> every message of the thread, in order. */
24
+ export declare const toThreadMessages: (identity: Identity, thread: JsonObject, includeBody: boolean) => Message[];
25
+ /**
26
+ * One thread of `POST /master-inbox/inbox-replies` -> its replies: every
27
+ * inbound message of `message_history` when the thread carries one, otherwise
28
+ * the latest reply. The category is the lead's, so every reply of the thread
29
+ * gets the same one.
30
+ */
31
+ export declare const toInboxReplies: (identity: Identity, item: JsonObject, categories: CategoryMap, includeBody: boolean) => Reply[];
@@ -0,0 +1,36 @@
1
+ import type { MetricRow } from "../internal/entities.ts";
2
+ import type { Json, JsonObject } from "../internal/json.ts";
3
+ import type { RowScope } from "../internal/metrics.ts";
4
+ export type { RowScope } from "../internal/metrics.ts";
5
+ /** The timezone every dated request asks for. */
6
+ export declare const TIMEZONE = "UTC";
7
+ /**
8
+ * `GET /campaigns/{id}/analytics`: lifetime totals. `interested` is the
9
+ * number of leads in a category with a positive sentiment.
10
+ */
11
+ export declare const lifetimeRow: (scope: RowScope, raw: JsonObject) => MetricRow;
12
+ /**
13
+ * `GET /campaigns/{id}/analytics-by-date`: totals for a window. The window
14
+ * separates out-of-office replies, so `replied` leaves them out when it can
15
+ * and `repliedAuto` counts them.
16
+ */
17
+ export declare const windowRow: (scope: RowScope, raw: JsonObject) => MetricRow;
18
+ /** `GET /analytics/overall-stats-v2`: `data.overall_stats`. */
19
+ export declare const overallRow: (scope: RowScope, raw: JsonObject) => MetricRow;
20
+ /**
21
+ * `GET /analytics/day-wise-overall-stats`: one row per day. Its `bounced` is
22
+ * documented as always 0, so it is not read. `positive` is that day's
23
+ * `positive_replied` from `GET /analytics/day-wise-positive-reply-stats`.
24
+ */
25
+ export declare const dayRow: (scope: RowScope, raw: JsonObject, positive?: Json | undefined) => MetricRow;
26
+ /**
27
+ * One mailbox's row of `GET /analytics/mailbox/name-wise-health-metrics`, or
28
+ * `undefined` when the response has none for it: every count is then `null`.
29
+ * `opened` is not said to be unique, so it is the total.
30
+ */
31
+ export declare const mailboxRow: (scope: RowScope, raw: JsonObject | undefined) => MetricRow;
32
+ /**
33
+ * One step of `GET /campaigns/{id}/sequence-analytics`: a row per variant,
34
+ * or the step total when the step has no variants.
35
+ */
36
+ export declare const stepRows: (scope: RowScope, step: JsonObject) => MetricRow[];
@@ -0,0 +1,62 @@
1
+ import type { Campaign, CampaignStatus, Lead, ReplyCategory, Sender, Sequence, Workspace } from "../internal/entities.ts";
2
+ import type { Json, JsonObject } from "../internal/json.ts";
3
+ import type { Identity } from "../internal/record.ts";
4
+ /**
5
+ * Several endpoints are documented both bare and wrapped in
6
+ * `{ ok | success, data }`. Returns the payload either way.
7
+ */
8
+ export declare const unwrap: (body: Json | undefined) => Json | undefined;
9
+ /**
10
+ * A copy without any key that holds a credential. Email accounts come back
11
+ * with their SMTP and IMAP passwords, and webhooks with their shared secret.
12
+ */
13
+ export declare const withoutSecrets: (value: Json) => Json;
14
+ export declare const campaignStatus: (value: Json | undefined) => CampaignStatus;
15
+ export declare const toCampaign: (identity: Identity, raw: JsonObject) => Campaign;
16
+ /** `GET /campaigns/{id}/sequences`: an array of steps, bare or wrapped. */
17
+ export declare const toSequence: (identity: Identity, campaignId: string, body: Json) => Sequence;
18
+ /**
19
+ * A subsequence is a child campaign: `campaign` is its row in the campaign
20
+ * list and `body` is its own `GET /campaigns/{id}/sequences`.
21
+ */
22
+ export declare const toSubsequence: (identity: Identity, parentId: string, campaign: JsonObject, body: Json) => Sequence;
23
+ export declare const reputation: (value: Json | undefined) => number | null;
24
+ /** A mailbox. `raw` is the payload without its SMTP and IMAP passwords. */
25
+ export declare const toSender: (identity: Identity, raw: JsonObject) => Sender;
26
+ /**
27
+ * The account's lead categories, from `GET /leads/fetch-categories`: each
28
+ * id's name, and what it means for the ids whose sentiment says so.
29
+ */
30
+ export interface LeadCategories {
31
+ readonly names: Readonly<Record<string, string>>;
32
+ readonly meanings: ReadonlyMap<string, ReplyCategory>;
33
+ }
34
+ export declare const NO_CATEGORIES: LeadCategories;
35
+ /**
36
+ * A row of `GET /campaigns/{id}/leads`: the lead inside one campaign. The
37
+ * status and the creation time belong to that campaign membership.
38
+ */
39
+ export declare const toCampaignLead: (identity: Identity, campaignId: string, row: JsonObject, categories: LeadCategories) => Lead;
40
+ interface FoundPlace {
41
+ readonly campaignId: string;
42
+ /** The campaign's item: of `lead_campaign_data`, or of the lead's campaigns. */
43
+ readonly entry: JsonObject;
44
+ readonly categories: LeadCategories;
45
+ }
46
+ /**
47
+ * `GET /leads/?email=`: the lead inside one of its campaigns. `raw` has the
48
+ * shape of a campaign's lead row: the campaign's item with the lead under
49
+ * `lead`. Neither read gives the lead's status in the campaign, so the status
50
+ * is unknown unless the lead is unsubscribed, and the creation time is the
51
+ * lead's own.
52
+ */
53
+ export declare const toFoundLead: (identity: Identity, found: JsonObject, place: FoundPlace) => Lead;
54
+ /**
55
+ * `GET /leads/{id}`: the lead on its own, with no campaign. `tags` are the
56
+ * names from `GET /crm/leads/tags?leadId=`, and `categories` says what the
57
+ * lead's `category_id` means.
58
+ */
59
+ export declare const toLead: (identity: Identity, raw: JsonObject, tags: readonly string[], categories?: LeadCategories) => Lead;
60
+ /** A Smartlead client (sub-account). */
61
+ export declare const toWorkspace: (identity: Identity, raw: JsonObject) => Workspace;
62
+ export {};
@@ -0,0 +1,242 @@
1
+ export declare const ANALYTICS: {
2
+ readonly analyticsCampaignFollowUpReplyRate: {
3
+ readonly description: "The reply rate of follow-up steps (second email onwards).";
4
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/followup-reply-rate";
5
+ readonly method: "GET";
6
+ readonly params: {
7
+ readonly campaign_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
8
+ readonly client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
9
+ readonly end_date: import("../internal/native.ts").NeededParam<"query", "string">;
10
+ readonly start_date: import("../internal/native.ts").NeededParam<"query", "string">;
11
+ readonly timezone: import("../internal/native.ts").PlacedParam<"query", "string">;
12
+ };
13
+ readonly path: "/analytics/campaign/follow-up-reply-rate";
14
+ };
15
+ readonly analyticsCampaignLeadToReplyTime: {
16
+ readonly description: "The average time from a lead's first email to its reply.";
17
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/lead-to-reply-time";
18
+ readonly method: "GET";
19
+ readonly params: {
20
+ readonly campaign_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
21
+ readonly client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
22
+ readonly end_date: import("../internal/native.ts").NeededParam<"query", "string">;
23
+ readonly start_date: import("../internal/native.ts").NeededParam<"query", "string">;
24
+ readonly timezone: import("../internal/native.ts").PlacedParam<"query", "string">;
25
+ };
26
+ readonly path: "/analytics/campaign/lead-to-reply-time";
27
+ };
28
+ readonly analyticsCampaignLeadsForFirstReply: {
29
+ readonly description: "How many leads are contacted, on average, per first reply.";
30
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/leads-for-first-reply";
31
+ readonly method: "GET";
32
+ readonly params: {
33
+ readonly campaign_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
34
+ readonly client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
35
+ readonly end_date: import("../internal/native.ts").NeededParam<"query", "string">;
36
+ readonly start_date: import("../internal/native.ts").NeededParam<"query", "string">;
37
+ readonly timezone: import("../internal/native.ts").PlacedParam<"query", "string">;
38
+ };
39
+ readonly path: "/analytics/campaign/leads-take-for-first-reply";
40
+ };
41
+ readonly analyticsCampaignList: {
42
+ readonly description: "The id and name of every campaign, for analytics filters.";
43
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/campaign-list";
44
+ readonly method: "GET";
45
+ readonly params: {
46
+ client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
47
+ };
48
+ readonly path: "/analytics/campaign/list";
49
+ };
50
+ readonly analyticsCampaignPerformance: {
51
+ readonly description: "One row per campaign in a date window: counts, rates and lead totals.";
52
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/campaign-performance";
53
+ readonly method: "GET";
54
+ readonly params: {
55
+ readonly full_data: import("../internal/native.ts").PlacedParam<"query", "string">;
56
+ readonly limit: import("../internal/native.ts").PlacedParam<"query", "string">;
57
+ readonly offset: import("../internal/native.ts").PlacedParam<"query", "string">;
58
+ readonly campaign_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
59
+ readonly client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
60
+ readonly end_date: import("../internal/native.ts").NeededParam<"query", "string">;
61
+ readonly start_date: import("../internal/native.ts").NeededParam<"query", "string">;
62
+ readonly timezone: import("../internal/native.ts").PlacedParam<"query", "string">;
63
+ };
64
+ readonly path: "/analytics/campaign/overall-stats";
65
+ };
66
+ readonly analyticsCampaignResponseStats: {
67
+ readonly description: "Replies per campaign in a date window, split by reply sentiment.";
68
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/campaign-response-stats";
69
+ readonly method: "GET";
70
+ readonly params: {
71
+ readonly full_data: import("../internal/native.ts").PlacedParam<"query", "string">;
72
+ readonly campaign_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
73
+ readonly client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
74
+ readonly end_date: import("../internal/native.ts").NeededParam<"query", "string">;
75
+ readonly start_date: import("../internal/native.ts").NeededParam<"query", "string">;
76
+ readonly timezone: import("../internal/native.ts").PlacedParam<"query", "string">;
77
+ };
78
+ readonly path: "/analytics/campaign/response-stats";
79
+ };
80
+ readonly analyticsCampaignStatusStats: {
81
+ readonly description: "How many campaigns are in each status.";
82
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/campaign-status-stats";
83
+ readonly method: "GET";
84
+ readonly params: {
85
+ client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
86
+ };
87
+ readonly path: "/analytics/campaign/status-stats";
88
+ };
89
+ readonly analyticsClientList: {
90
+ readonly description: "The id and name of every client, for analytics filters.";
91
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/client-list";
92
+ readonly method: "GET";
93
+ readonly params: {
94
+ client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
95
+ };
96
+ readonly path: "/analytics/client/list";
97
+ };
98
+ readonly analyticsClientMonthlyCount: {
99
+ readonly description: "How many clients the account had, month by month.";
100
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/month-wise-client-count";
101
+ readonly method: "GET";
102
+ readonly params: {
103
+ client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
104
+ };
105
+ readonly path: "/analytics/client/month-wise-count";
106
+ };
107
+ readonly analyticsClientPerformance: {
108
+ readonly description: "One row per client in a date window, with that client's campaign totals.";
109
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/client-performance";
110
+ readonly method: "GET";
111
+ readonly params: {
112
+ readonly filter: import("../internal/native.ts").PlacedParam<"query", "string">;
113
+ readonly full_data: import("../internal/native.ts").PlacedParam<"query", "string">;
114
+ readonly limit: import("../internal/native.ts").PlacedParam<"query", "string">;
115
+ readonly offset: import("../internal/native.ts").PlacedParam<"query", "string">;
116
+ readonly client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
117
+ readonly end_date: import("../internal/native.ts").NeededParam<"query", "string">;
118
+ readonly start_date: import("../internal/native.ts").NeededParam<"query", "string">;
119
+ readonly timezone: import("../internal/native.ts").PlacedParam<"query", "string">;
120
+ };
121
+ readonly path: "/analytics/client/overall-stats";
122
+ };
123
+ readonly analyticsDailyBySentTime: {
124
+ readonly description: "Daily sent, opened, replied and bounced counts, each counted on the day its email was sent. The only daily read that reports bounces.";
125
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/day-wise-sent-time";
126
+ readonly method: "GET";
127
+ readonly params: {
128
+ readonly campaign_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
129
+ readonly client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
130
+ readonly timezone: import("../internal/native.ts").NeededParam<"query", "string">;
131
+ readonly end_date: import("../internal/native.ts").NeededParam<"query", "string">;
132
+ readonly start_date: import("../internal/native.ts").NeededParam<"query", "string">;
133
+ };
134
+ readonly path: "/analytics/day-wise-overall-stats-by-sent-time";
135
+ };
136
+ readonly analyticsDailyPositiveReplies: {
137
+ readonly description: "Positive replies per day, counted on the day of the reply.";
138
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/day-wise-positive-reply";
139
+ readonly method: "GET";
140
+ readonly params: {
141
+ readonly campaign_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
142
+ readonly client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
143
+ readonly end_date: import("../internal/native.ts").NeededParam<"query", "string">;
144
+ readonly start_date: import("../internal/native.ts").NeededParam<"query", "string">;
145
+ readonly timezone: import("../internal/native.ts").PlacedParam<"query", "string">;
146
+ };
147
+ readonly path: "/analytics/day-wise-positive-reply-stats";
148
+ };
149
+ readonly analyticsDailyPositiveRepliesBySentTime: {
150
+ readonly description: "Positive replies per day, counted on the day the replied-to email was sent.";
151
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/day-wise-positive-sent-time";
152
+ readonly method: "GET";
153
+ readonly params: {
154
+ readonly campaign_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
155
+ readonly client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
156
+ readonly timezone: import("../internal/native.ts").NeededParam<"query", "string">;
157
+ readonly end_date: import("../internal/native.ts").NeededParam<"query", "string">;
158
+ readonly start_date: import("../internal/native.ts").NeededParam<"query", "string">;
159
+ };
160
+ readonly path: "/analytics/day-wise-positive-reply-stats-by-sent-time";
161
+ };
162
+ readonly analyticsLeadCategoryResponses: {
163
+ readonly description: "Replies in a date window by lead category, with each one's share.";
164
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/lead-category-response";
165
+ readonly method: "GET";
166
+ readonly params: {
167
+ readonly campaign_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
168
+ readonly client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
169
+ readonly end_date: import("../internal/native.ts").NeededParam<"query", "string">;
170
+ readonly start_date: import("../internal/native.ts").NeededParam<"query", "string">;
171
+ readonly timezone: import("../internal/native.ts").PlacedParam<"query", "string">;
172
+ };
173
+ readonly path: "/analytics/lead/category-wise-response";
174
+ };
175
+ readonly analyticsLeadStats: {
176
+ readonly description: "Leads reached in a date window: the total, new leads and follow-ups.";
177
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/lead-stats";
178
+ readonly method: "GET";
179
+ readonly params: {
180
+ readonly campaign_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
181
+ readonly client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
182
+ readonly end_date: import("../internal/native.ts").NeededParam<"query", "string">;
183
+ readonly start_date: import("../internal/native.ts").NeededParam<"query", "string">;
184
+ readonly timezone: import("../internal/native.ts").PlacedParam<"query", "string">;
185
+ };
186
+ readonly path: "/analytics/lead/overall-stats";
187
+ };
188
+ readonly analyticsMailboxDomainHealth: {
189
+ readonly description: "Sent, opened, replied and bounced counts per sending domain in a date window.";
190
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/domain-wise-health";
191
+ readonly lane: "domain-wise-health";
192
+ readonly method: "GET";
193
+ readonly params: {
194
+ readonly full_data: import("../internal/native.ts").PlacedParam<"query", "string">;
195
+ readonly limit: import("../internal/native.ts").PlacedParam<"query", "string">;
196
+ readonly offset: import("../internal/native.ts").PlacedParam<"query", "string">;
197
+ readonly campaign_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
198
+ readonly client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
199
+ readonly end_date: import("../internal/native.ts").NeededParam<"query", "string">;
200
+ readonly start_date: import("../internal/native.ts").NeededParam<"query", "string">;
201
+ readonly timezone: import("../internal/native.ts").PlacedParam<"query", "string">;
202
+ };
203
+ readonly path: "/analytics/mailbox/domain-wise-health-metrics";
204
+ };
205
+ readonly analyticsMailboxOverall: {
206
+ readonly description: "How many mailboxes are connected, in use, disconnected, or enabled without warmup.";
207
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/mailbox-health";
208
+ readonly method: "GET";
209
+ readonly params: {
210
+ client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
211
+ };
212
+ readonly path: "/analytics/mailbox/overall-stats";
213
+ };
214
+ readonly analyticsMailboxProviderPerformance: {
215
+ readonly description: "Counts and rates in a date window per mailbox provider (Gmail, Outlook, SMTP).";
216
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/provider-performance";
217
+ readonly method: "GET";
218
+ readonly params: {
219
+ readonly full_data: import("../internal/native.ts").PlacedParam<"query", "string">;
220
+ readonly campaign_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
221
+ readonly client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
222
+ readonly end_date: import("../internal/native.ts").NeededParam<"query", "string">;
223
+ readonly start_date: import("../internal/native.ts").NeededParam<"query", "string">;
224
+ readonly timezone: import("../internal/native.ts").PlacedParam<"query", "string">;
225
+ };
226
+ readonly path: "/analytics/mailbox/provider-wise-overall-performance";
227
+ };
228
+ readonly analyticsTeamBoard: {
229
+ readonly description: "Results in a date window per team member.";
230
+ readonly docs: "https://api.smartlead.ai/api-reference/analytics/team-board-stats";
231
+ readonly method: "GET";
232
+ readonly params: {
233
+ readonly full_data: import("../internal/native.ts").PlacedParam<"query", "string">;
234
+ readonly campaign_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
235
+ readonly client_ids: import("../internal/native.ts").PlacedParam<"query", "string">;
236
+ readonly end_date: import("../internal/native.ts").NeededParam<"query", "string">;
237
+ readonly start_date: import("../internal/native.ts").NeededParam<"query", "string">;
238
+ readonly timezone: import("../internal/native.ts").PlacedParam<"query", "string">;
239
+ };
240
+ readonly path: "/analytics/team-board/overall-stats";
241
+ };
242
+ };