samva 0.34.0 → 0.36.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 (129) hide show
  1. package/AGENTS.md +17 -0
  2. package/README.md +2 -1
  3. package/dist/client/sdk.gen.d.ts +325 -331
  4. package/dist/client/sdk.gen.js +406 -454
  5. package/dist/client/types.gen.d.ts +3465 -750
  6. package/dist/effect/agents.d.ts +222 -17
  7. package/dist/effect/agents.js +7 -1
  8. package/dist/effect/analytics.d.ts +21 -15
  9. package/dist/effect/api-keys.d.ts +30 -24
  10. package/dist/effect/campaigns.d.ts +695 -39
  11. package/dist/effect/categories.d.ts +3 -3
  12. package/dist/effect/contact-groups.d.ts +15 -15
  13. package/dist/effect/contacts.d.ts +56 -52
  14. package/dist/effect/conversations.d.ts +51 -45
  15. package/dist/effect/email.d.ts +82 -82
  16. package/dist/effect/errors.d.ts +1 -1
  17. package/dist/effect/errors.js +2 -2
  18. package/dist/effect/extension-installations.d.ts +64 -12
  19. package/dist/effect/extensions.d.ts +16 -16
  20. package/dist/effect/generated/agents.d.ts +2902 -150
  21. package/dist/effect/generated/agents.js +219 -31
  22. package/dist/effect/generated/analytics.d.ts +127 -136
  23. package/dist/effect/generated/analytics.js +72 -37
  24. package/dist/effect/generated/api-keys.d.ts +243 -47
  25. package/dist/effect/generated/api-keys.js +27 -12
  26. package/dist/effect/generated/attachments.d.ts +89 -1
  27. package/dist/effect/generated/attachments.js +10 -2
  28. package/dist/effect/generated/brands.d.ts +133 -1
  29. package/dist/effect/generated/brands.js +22 -10
  30. package/dist/effect/generated/campaigns.d.ts +1467 -143
  31. package/dist/effect/generated/campaigns.js +84 -20
  32. package/dist/effect/generated/contact-events.d.ts +26 -4
  33. package/dist/effect/generated/contact-events.js +5 -3
  34. package/dist/effect/generated/contact-groups.d.ts +233 -13
  35. package/dist/effect/generated/contact-groups.js +33 -17
  36. package/dist/effect/generated/contacts.d.ts +634 -96
  37. package/dist/effect/generated/contacts.js +82 -20
  38. package/dist/effect/generated/conversations.d.ts +501 -108
  39. package/dist/effect/generated/conversations.js +106 -22
  40. package/dist/effect/generated/custom-fields.d.ts +89 -1
  41. package/dist/effect/generated/custom-fields.js +11 -3
  42. package/dist/effect/generated/email.d.ts +1447 -83
  43. package/dist/effect/generated/email.js +167 -43
  44. package/dist/effect/generated/events.d.ts +51 -7
  45. package/dist/effect/generated/events.js +9 -5
  46. package/dist/effect/generated/extension-installations.d.ts +1052 -77
  47. package/dist/effect/generated/extension-installations.js +45 -31
  48. package/dist/effect/generated/extensions.d.ts +123 -13
  49. package/dist/effect/generated/extensions.js +20 -10
  50. package/dist/effect/generated/feedback.d.ts +23 -1
  51. package/dist/effect/generated/feedback.js +6 -4
  52. package/dist/effect/generated/index.d.ts +3 -1
  53. package/dist/effect/generated/journeys.d.ts +684 -16
  54. package/dist/effect/generated/journeys.js +37 -9
  55. package/dist/effect/generated/mailboxes.d.ts +6169 -1734
  56. package/dist/effect/generated/mailboxes.js +549 -344
  57. package/dist/effect/generated/media.d.ts +125 -15
  58. package/dist/effect/generated/media.js +15 -2
  59. package/dist/effect/generated/messages.d.ts +2036 -117
  60. package/dist/effect/generated/messages.js +286 -54
  61. package/dist/effect/generated/namespaces.d.ts +215 -55
  62. package/dist/effect/generated/namespaces.js +30 -12
  63. package/dist/effect/generated/newsletter-domains.d.ts +98 -12
  64. package/dist/effect/generated/newsletter-domains.js +20 -13
  65. package/dist/effect/generated/newsletter-issues.d.ts +354 -19
  66. package/dist/effect/generated/newsletter-issues.js +162 -98
  67. package/dist/effect/generated/newsletters.d.ts +123 -13
  68. package/dist/effect/generated/newsletters.js +19 -9
  69. package/dist/effect/generated/operations.d.ts +76 -10
  70. package/dist/effect/generated/operations.js +12 -6
  71. package/dist/effect/generated/organizations.d.ts +287 -7
  72. package/dist/effect/generated/organizations.js +33 -5
  73. package/dist/effect/generated/policies.d.ts +953 -0
  74. package/dist/effect/generated/policies.js +116 -0
  75. package/dist/effect/generated/scheduled-messages.d.ts +4418 -49
  76. package/dist/effect/generated/scheduled-messages.js +77 -13
  77. package/dist/effect/generated/shared.d.ts +3213 -521
  78. package/dist/effect/generated/shared.js +713 -128
  79. package/dist/effect/generated/subscriptions.d.ts +23 -1
  80. package/dist/effect/generated/subscriptions.js +6 -4
  81. package/dist/effect/generated/templates.d.ts +2081 -693
  82. package/dist/effect/generated/templates.js +482 -267
  83. package/dist/effect/generated/topic-forms.d.ts +111 -1
  84. package/dist/effect/generated/topic-forms.js +23 -13
  85. package/dist/effect/generated/topics.d.ts +353 -43
  86. package/dist/effect/generated/topics.js +67 -19
  87. package/dist/effect/generated/webhooks.d.ts +318 -57
  88. package/dist/effect/generated/webhooks.js +68 -17
  89. package/dist/effect/generated/whoami.d.ts +35 -5
  90. package/dist/effect/generated/whoami.js +4 -2
  91. package/dist/effect/generated-metadata.d.ts +56 -32
  92. package/dist/effect/generated-metadata.js +137 -105
  93. package/dist/effect/index.d.ts +1 -0
  94. package/dist/effect/index.js +3 -2
  95. package/dist/effect/internal/client.js +1 -1
  96. package/dist/effect/internal/email-sender.d.ts +1 -1
  97. package/dist/effect/internal/operation.js +5 -32
  98. package/dist/effect/internal/send.d.ts +1 -1
  99. package/dist/effect/journeys.d.ts +169 -83
  100. package/dist/effect/mailboxes.d.ts +978 -301
  101. package/dist/effect/mailboxes.js +1 -11
  102. package/dist/effect/media.d.ts +1 -1
  103. package/dist/effect/messages.d.ts +40 -40
  104. package/dist/effect/namespaces.d.ts +15 -15
  105. package/dist/effect/newsletter-domains.d.ts +5 -5
  106. package/dist/effect/newsletters.d.ts +1 -1
  107. package/dist/effect/operations.d.ts +11 -11
  108. package/dist/effect/organizations.d.ts +2 -2
  109. package/dist/effect/policies.d.ts +65 -0
  110. package/dist/effect/policies.js +16 -0
  111. package/dist/effect/scheduled-messages.d.ts +869 -8
  112. package/dist/effect/templates.d.ts +43 -45
  113. package/dist/effect/templates.js +5 -3
  114. package/dist/effect/topics.d.ts +23 -23
  115. package/dist/effect/webhooks.d.ts +29 -26
  116. package/dist/index.js +2 -2
  117. package/dist/mailbox/test.js +11 -4
  118. package/dist/mailbox/types.d.ts +39 -3
  119. package/dist/normalize.js +13 -1
  120. package/dist/package.js +1 -1
  121. package/dist/promises/client.d.ts +4 -2
  122. package/dist/promises/client.js +5 -3
  123. package/dist/promises/errors.gen.d.ts +38 -2
  124. package/dist/promises/errors.gen.js +394 -34
  125. package/dist/promises/index.js +2 -2
  126. package/dist/promises/types.gen.d.ts +1 -1
  127. package/dist/service-map.d.ts +39 -28
  128. package/dist/service-map.js +220 -782
  129. package/package.json +13 -8
@@ -1,5 +1,4 @@
1
1
  import type { SamvaClient } from "../promises/client";
2
- type SendResult = Awaited<ReturnType<SamvaClient["mailboxes"]["reply"]>>;
3
2
  export type ExtensionManifest = {
4
3
  readonly name: string;
5
4
  readonly displayName: string;
@@ -35,6 +34,41 @@ export type ActionResolution = {
35
34
  /** The denial reason; null for an approval or a cancellation. */
36
35
  readonly reason: string | null;
37
36
  };
37
+ /** Why a mailbox action was allowed, held, or refused. */
38
+ export type ActionDecision = {
39
+ readonly id: string;
40
+ readonly reviewRound: number;
41
+ readonly requirement: "run" | "model" | "person" | "never";
42
+ readonly decider: "rule" | "model" | "person" | "agent";
43
+ readonly outcome: "allow" | "hold" | "refuse";
44
+ readonly reason: string;
45
+ readonly scopes: readonly PolicyScope[];
46
+ readonly rule?: {
47
+ readonly scope: PolicyScope;
48
+ readonly index: number;
49
+ } | undefined;
50
+ readonly guard?: string | undefined;
51
+ readonly guardReason?: string | undefined;
52
+ readonly resolution?: {
53
+ readonly by: string;
54
+ readonly at: string;
55
+ readonly as: "approved" | "edited" | "denied" | "alwaysAllowed";
56
+ readonly diff?: {
57
+ readonly text?: {
58
+ readonly before: string | null;
59
+ readonly after: string | null;
60
+ } | undefined;
61
+ readonly html?: {
62
+ readonly before: string | null;
63
+ readonly after: string | null;
64
+ } | undefined;
65
+ } | undefined;
66
+ } | undefined;
67
+ };
68
+ type PolicyScope = {
69
+ readonly kind: "organization" | "mailbox" | "agent" | "apiKey";
70
+ readonly id: string;
71
+ };
38
72
  export type CampaignAttribution = {
39
73
  readonly campaignId: string;
40
74
  readonly runId: string;
@@ -89,9 +123,10 @@ export type EventData = {
89
123
  "mailbox.action.pending_approval": MailboxEventScope & {
90
124
  readonly action: {
91
125
  readonly state?: "approvalRequired";
92
- readonly decision?: Readonly<NonNullable<SendResult["decision"]>>;
126
+ readonly decision: ActionDecision;
127
+ readonly reviewRound: number;
93
128
  readonly id: string;
94
- readonly type: "sendMessage" | "reply" | "updateDraft" | "createNote" | "assignThread" | "changeThreadState" | "call" | "extensionRequest" | "toolCall";
129
+ readonly type: "sendMessage" | "reply" | "updateDraft" | "createNote" | "assignThread" | "changeThreadState" | "call" | "extensionRequest" | "toolCall" | "handoff";
95
130
  readonly threadId: string | null;
96
131
  readonly reason: string | null;
97
132
  readonly proposedBy: WebhookActor;
@@ -115,6 +150,7 @@ export type EventData = {
115
150
  "mailbox.action.resolved": MailboxEventScope & {
116
151
  readonly action: {
117
152
  readonly id: string;
153
+ readonly reviewRound: number;
118
154
  readonly type: EventData["mailbox.action.pending_approval"]["action"]["type"];
119
155
  readonly threadId: string | null;
120
156
  readonly proposedBy: WebhookActor;
package/dist/normalize.js CHANGED
@@ -2,9 +2,21 @@
2
2
  function toRecipientArray(recipient) {
3
3
  return Array.isArray(recipient) ? recipient : [recipient];
4
4
  }
5
+ /**
6
+ * A caller's recipient, in the ergonomic forms the SDK accepts: an address string, an object with
7
+ * the declared address, a `{ id }` reference to a contact, or a listed contact that carries an
8
+ * address and its own id and profile fields.
9
+ */
5
10
  function normalizeMessageRecipient(recipient) {
6
11
  if (typeof recipient === "string") return { email: recipient };
7
- if ("contactId" in recipient || "email" in recipient || "phone" in recipient) return recipient;
12
+ const { contactId, email, phone, name, displayName } = recipient;
13
+ if (contactId !== void 0) return recipient;
14
+ if (email !== void 0 || phone !== void 0) return {
15
+ ...email === void 0 ? {} : { email },
16
+ ...phone === void 0 ? {} : { phone },
17
+ ...name === void 0 ? {} : { name },
18
+ ...displayName === void 0 ? {} : { displayName }
19
+ };
8
20
  return { contactId: recipient.id };
9
21
  }
10
22
  function normalizeRecipients(recipient) {
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.34.0";
2
+ var version = "0.36.0";
3
3
  export { version };
4
4
 
5
5
  //# sourceMappingURL=package.js.map
@@ -27,7 +27,7 @@
27
27
  * ```
28
28
  */
29
29
  import { type Client, type Config } from "../client/client";
30
- import { Agents as agents, Analytics as analytics, ApiKeys as apiKeys, Attachments as attachments, Brands as brands, Campaigns as campaigns, ContactGroups as contactGroups, ContactEvents as contactEvents, Contacts as contacts, Conversations as conversations, CustomFields as customFields, Email as email, ExtensionInstallations as extensionInstallations, Extensions as extensions, Events as events, Feedback as feedback, Journeys as journeys, Mailboxes as mailboxes, Media as media, Messages as messages, Namespaces as namespaces, Operations as operations, Organizations as organizations, ScheduledMessages as scheduledMessages, Subscriptions as subscriptions, Templates as templates, Topics as topics, TopicForms as topicForms, Newsletters as newsletters, Webhooks as webhooks, Whoami as whoami } from "../client/sdk.gen";
30
+ import { Agents as agents, Analytics as analytics, ApiKeys as apiKeys, Attachments as attachments, Brands as brands, Campaigns as campaigns, ContactGroups as contactGroups, ContactEvents as contactEvents, Contacts as contacts, Conversations as conversations, CustomFields as customFields, Email as email, ExtensionInstallations as extensionInstallations, Extensions as extensions, Events as events, Feedback as feedback, Journeys as journeys, Mailboxes as mailboxes, Media as media, Messages as messages, Namespaces as namespaces, Operations as operations, Organizations as organizations, Policies as policies, ScheduledMessages as scheduledMessages, Subscriptions as subscriptions, Templates as templates, Topics as topics, TopicForms as topicForms, Newsletters as newsletters, Webhooks as webhooks, Whoami as whoami } from "../client/sdk.gen";
31
31
  import type { MessagesSendData } from "../client/types.gen";
32
32
  import { MailboxEventStream, type MailboxEventStreamOptions } from "../mailbox-events";
33
33
  import { type RequestPolicy } from "./request";
@@ -51,7 +51,7 @@ export type SamvaClientConfig = (SamvaClientConfigBase & {
51
51
  apiKey?: never;
52
52
  });
53
53
  type MessageSendBody = MessagesSendData["body"];
54
- type MessageRecipient = MessageSendBody["to"][number];
54
+ type MessageRecipient = EmailMessageSendBody["to"][number];
55
55
  type MessageSendRequestOptions<ThrowOnError extends boolean = false> = Omit<NonNullable<Parameters<typeof messages.send<ThrowOnError>>[1]>, "client">;
56
56
  type MessageSendOptions<ThrowOnError extends boolean = false> = MessageSendRequestOptions<ThrowOnError> & {
57
57
  /** Sent as the `idempotency-key` header; defaults to a fresh UUID per call. */
@@ -143,6 +143,7 @@ export interface SamvaRawClient {
143
143
  readonly operations: typeof operations;
144
144
  readonly apiKeys: typeof apiKeys;
145
145
  readonly organizations: typeof organizations;
146
+ readonly policies: typeof policies;
146
147
  readonly attachments: typeof attachments;
147
148
  readonly contactGroups: typeof contactGroups;
148
149
  readonly customFields: typeof customFields;
@@ -185,6 +186,7 @@ export interface SamvaClient {
185
186
  readonly operations: DirectService<typeof operations>;
186
187
  readonly apiKeys: DirectService<typeof apiKeys>;
187
188
  readonly organizations: DirectService<typeof organizations>;
189
+ readonly policies: DirectService<typeof policies>;
188
190
  readonly attachments: DirectService<typeof attachments>;
189
191
  readonly contactGroups: DirectService<typeof contactGroups>;
190
192
  readonly customFields: DirectService<typeof customFields>;
@@ -2,9 +2,9 @@ import { CLIENT_ATTRIBUTION_HEADER, clientAttribution } from "../client-attribut
2
2
  import { mergeHeaders } from "../client/client/utils.gen.js";
3
3
  import { createClient as createClient$1 } from "../client/client/client.gen.js";
4
4
  import { SamvaOperations } from "../effect/generated-metadata.js";
5
- import { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MailboxSendConflictError, MailboxSendRefusedError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, TemplateSourceError, UnauthorizedError, ValidationError, fromApiError } from "./errors.gen.js";
5
+ import { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MailboxSendConflictError, MailboxSendRefusedError, MalformedRequestError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, TemplateInUseError, TemplateSourceError, UnauthorizedError, ValidationError, WhatsAppServiceWindowClosedError, fromApiError } from "./errors.gen.js";
6
6
  import { configureRequests } from "./request.js";
7
- import { Agents, Analytics, ApiKeys, Attachments, Brands, Campaigns, ContactEvents, ContactGroups, Contacts, Conversations, CustomFields, Email, Events, ExtensionInstallations, Extensions, Feedback, Journeys, Mailboxes, Media, Messages, Namespaces, Newsletters, Operations, Organizations, ScheduledMessages, Subscriptions, Templates, TopicForms, Topics, Webhooks, Whoami } from "../client/sdk.gen.js";
7
+ import { Agents, Analytics, ApiKeys, Attachments, Brands, Campaigns, ContactEvents, ContactGroups, Contacts, Conversations, CustomFields, Email, Events, ExtensionInstallations, Extensions, Feedback, Journeys, Mailboxes, Media, Messages, Namespaces, Newsletters, Operations, Organizations, Policies, ScheduledMessages, Subscriptions, Templates, TopicForms, Topics, Webhooks, Whoami } from "../client/sdk.gen.js";
8
8
  import { MediaUploadError, mediaCreateBody, planInlineUploads, withUploadedAttachments } from "../inline-attachments.js";
9
9
  import { MailboxEventStream } from "../mailbox-events.js";
10
10
  import { buildEmailSendPayload, buildMessagesSendPayload, replyToEmailsPayload } from "../normalize.js";
@@ -256,6 +256,7 @@ function makeClient(config) {
256
256
  operations: createBoundService(Operations, clientInstance),
257
257
  apiKeys: createBoundService(ApiKeys, clientInstance),
258
258
  organizations: createBoundService(Organizations, clientInstance),
259
+ policies: createBoundService(Policies, clientInstance),
259
260
  attachments: createBoundService(Attachments, clientInstance),
260
261
  contactGroups: createBoundService(ContactGroups, clientInstance),
261
262
  customFields: createBoundService(CustomFields, clientInstance),
@@ -296,6 +297,7 @@ function makeClient(config) {
296
297
  operations: createDirectService(raw.operations),
297
298
  apiKeys: createDirectService(raw.apiKeys),
298
299
  organizations: createDirectService(raw.organizations),
300
+ policies: createDirectService(raw.policies),
299
301
  attachments: createDirectService(raw.attachments),
300
302
  contactGroups: createDirectService(raw.contactGroups),
301
303
  customFields: createDirectService(raw.customFields),
@@ -319,6 +321,6 @@ function makeClient(config) {
319
321
  }));
320
322
  return result;
321
323
  }
322
- export { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MailboxSendConflictError, MailboxSendRefusedError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, TemplateSourceError, UnauthorizedError, ValidationError, clientWithIdempotency, createBoundClient, createClient, fromApiError };
324
+ export { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MailboxSendConflictError, MailboxSendRefusedError, MalformedRequestError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, TemplateInUseError, TemplateSourceError, UnauthorizedError, ValidationError, WhatsAppServiceWindowClosedError, clientWithIdempotency, createBoundClient, createClient, fromApiError };
323
325
 
324
326
  //# sourceMappingURL=client.js.map
@@ -1,5 +1,5 @@
1
1
  import type * as Wire from "../client/types.gen";
2
- export type SamvaApiErrorTag = "AnalyticsQueryError" | "BillingProviderError" | "BrandAddressRequiredError" | "CampaignFooterRequiredError" | "ConflictError" | "DeliveryUnavailableError" | "EmailChannelError" | "ExternalServiceError" | "FlagDisabledError" | "ForbiddenError" | "FromAddressRequiredError" | "GatewayTimeoutError" | "InternalError" | "MailboxSendConflictError" | "MailboxSendRefusedError" | "OnboardingReviewRequiredError" | "PaymentRequiredError" | "RateLimitedError" | "ResourceNotFoundError" | "SenderNotReadyError" | "ServiceUnavailableError" | "TemplateSourceError" | "UnauthorizedError" | "ValidationError";
2
+ export type SamvaApiErrorTag = "AnalyticsQueryError" | "BillingProviderError" | "BrandAddressRequiredError" | "CampaignFooterRequiredError" | "ConflictError" | "DeliveryUnavailableError" | "EmailChannelError" | "ExternalServiceError" | "FlagDisabledError" | "ForbiddenError" | "FromAddressRequiredError" | "GatewayTimeoutError" | "InternalError" | "MailboxSendConflictError" | "MailboxSendRefusedError" | "MalformedRequestError" | "OnboardingReviewRequiredError" | "PaymentRequiredError" | "RateLimitedError" | "ResourceNotFoundError" | "SenderNotReadyError" | "ServiceUnavailableError" | "TemplateInUseError" | "TemplateSourceError" | "UnauthorizedError" | "ValidationError" | "WhatsAppServiceWindowClosedError";
3
3
  export interface SamvaApiErrorContext {
4
4
  readonly request?: Request | undefined;
5
5
  readonly response?: Response | undefined;
@@ -167,6 +167,16 @@ export declare class MailboxSendRefusedError extends SamvaApiError<"MailboxSendR
167
167
  readonly "receipt": Wire.MailboxSendReceipt;
168
168
  constructor(payload: Omit<MailboxSendRefusedErrorPayload, "_tag">, context?: SamvaApiErrorContext);
169
169
  }
170
+ type MalformedRequestErrorPayload = {
171
+ readonly _tag: "MalformedRequestError";
172
+ readonly fields: Record<string, Array<string>>;
173
+ readonly message: string;
174
+ };
175
+ export declare class MalformedRequestError extends SamvaApiError<"MalformedRequestError"> {
176
+ readonly _tag: "MalformedRequestError";
177
+ readonly "fields": Record<string, Array<string>>;
178
+ constructor(payload: Omit<MalformedRequestErrorPayload, "_tag">, context?: SamvaApiErrorContext);
179
+ }
170
180
  type OnboardingReviewRequiredErrorPayload = {
171
181
  readonly _tag: "OnboardingReviewRequiredError";
172
182
  readonly code: "review_required" | "review_in_progress" | "information_required" | "review_rejected" | "identity_review_required" | "identity_review_rejected" | "identity_changed";
@@ -243,6 +253,22 @@ export declare class ServiceUnavailableError extends SamvaApiError<"ServiceUnava
243
253
  readonly "retryAfterSeconds": number;
244
254
  constructor(payload: Omit<ServiceUnavailableErrorPayload, "_tag">, context?: SamvaApiErrorContext);
245
255
  }
256
+ type TemplateInUseErrorPayload = {
257
+ readonly _tag: "TemplateInUseError";
258
+ readonly message: string;
259
+ readonly references: Array<{
260
+ readonly kind: string;
261
+ readonly id: string;
262
+ }>;
263
+ };
264
+ export declare class TemplateInUseError extends SamvaApiError<"TemplateInUseError"> {
265
+ readonly _tag: "TemplateInUseError";
266
+ readonly "references": Array<{
267
+ readonly kind: string;
268
+ readonly id: string;
269
+ }>;
270
+ constructor(payload: Omit<TemplateInUseErrorPayload, "_tag">, context?: SamvaApiErrorContext);
271
+ }
246
272
  type TemplateSourceErrorPayload = {
247
273
  readonly _tag: "TemplateSourceError";
248
274
  readonly diagnostics: Array<{
@@ -317,7 +343,17 @@ export declare class ValidationError extends SamvaApiError<"ValidationError"> {
317
343
  readonly "fields"?: Record<string, Array<string>> | null;
318
344
  constructor(payload: Omit<ValidationErrorPayload, "_tag">, context?: SamvaApiErrorContext);
319
345
  }
320
- export type AnySamvaApiError = AnalyticsQueryError | BillingProviderError | BrandAddressRequiredError | CampaignFooterRequiredError | ConflictError | DeliveryUnavailableError | EmailChannelError | ExternalServiceError | FlagDisabledError | ForbiddenError | FromAddressRequiredError | GatewayTimeoutError | InternalError | MailboxSendConflictError | MailboxSendRefusedError | OnboardingReviewRequiredError | PaymentRequiredError | RateLimitedError | ResourceNotFoundError | SenderNotReadyError | ServiceUnavailableError | TemplateSourceError | UnauthorizedError | ValidationError;
346
+ type WhatsAppServiceWindowClosedErrorPayload = {
347
+ readonly _tag: "WhatsAppServiceWindowClosedError";
348
+ readonly closedAt: string | null;
349
+ readonly message: string;
350
+ };
351
+ export declare class WhatsAppServiceWindowClosedError extends SamvaApiError<"WhatsAppServiceWindowClosedError"> {
352
+ readonly _tag: "WhatsAppServiceWindowClosedError";
353
+ readonly "closedAt": string | null;
354
+ constructor(payload: Omit<WhatsAppServiceWindowClosedErrorPayload, "_tag">, context?: SamvaApiErrorContext);
355
+ }
356
+ export type AnySamvaApiError = AnalyticsQueryError | BillingProviderError | BrandAddressRequiredError | CampaignFooterRequiredError | ConflictError | DeliveryUnavailableError | EmailChannelError | ExternalServiceError | FlagDisabledError | ForbiddenError | FromAddressRequiredError | GatewayTimeoutError | InternalError | MailboxSendConflictError | MailboxSendRefusedError | MalformedRequestError | OnboardingReviewRequiredError | PaymentRequiredError | RateLimitedError | ResourceNotFoundError | SenderNotReadyError | ServiceUnavailableError | TemplateInUseError | TemplateSourceError | UnauthorizedError | ValidationError | WhatsAppServiceWindowClosedError;
321
357
  /** Convert a decoded error payload into its generated JavaScript error class. */
322
358
  export declare function fromApiError(error: unknown, context?: SamvaApiErrorContext): AnySamvaApiError | SamvaTransportError;
323
359
  export {};