@whooshbang/sdk 4.1.0 → 4.3.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 (49) hide show
  1. package/README.md +32 -0
  2. package/dist/client.d.ts +17 -3
  3. package/dist/client.js +104 -3
  4. package/dist/client.js.map +1 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/recipient/element.js +160 -7
  8. package/dist/recipient/element.js.map +1 -1
  9. package/dist/recipient/hosted-entry.d.ts +5 -0
  10. package/dist/recipient/hosted-entry.js +89 -0
  11. package/dist/recipient/hosted-entry.js.map +1 -0
  12. package/dist/recipient/i18n/ar.js +6 -0
  13. package/dist/recipient/i18n/ar.js.map +1 -1
  14. package/dist/recipient/i18n/catalog.d.ts +6 -0
  15. package/dist/recipient/i18n/catalog.js.map +1 -1
  16. package/dist/recipient/i18n/de.js +6 -0
  17. package/dist/recipient/i18n/de.js.map +1 -1
  18. package/dist/recipient/i18n/en.js +6 -0
  19. package/dist/recipient/i18n/en.js.map +1 -1
  20. package/dist/recipient/i18n/es.js +6 -0
  21. package/dist/recipient/i18n/es.js.map +1 -1
  22. package/dist/recipient/i18n/fa.js +6 -0
  23. package/dist/recipient/i18n/fa.js.map +1 -1
  24. package/dist/recipient/i18n/fr.js +6 -0
  25. package/dist/recipient/i18n/fr.js.map +1 -1
  26. package/dist/recipient/i18n/hi.js +6 -0
  27. package/dist/recipient/i18n/hi.js.map +1 -1
  28. package/dist/recipient/i18n/id.js +6 -0
  29. package/dist/recipient/i18n/id.js.map +1 -1
  30. package/dist/recipient/i18n/it.js +6 -0
  31. package/dist/recipient/i18n/it.js.map +1 -1
  32. package/dist/recipient/i18n/nl.js +6 -0
  33. package/dist/recipient/i18n/nl.js.map +1 -1
  34. package/dist/recipient/i18n/pl.js +6 -0
  35. package/dist/recipient/i18n/pl.js.map +1 -1
  36. package/dist/recipient/i18n/pt-BR.js +6 -0
  37. package/dist/recipient/i18n/pt-BR.js.map +1 -1
  38. package/dist/recipient/i18n/ru.js +6 -0
  39. package/dist/recipient/i18n/ru.js.map +1 -1
  40. package/dist/recipient/i18n/tr.js +6 -0
  41. package/dist/recipient/i18n/tr.js.map +1 -1
  42. package/dist/recipient/i18n/uk.js +6 -0
  43. package/dist/recipient/i18n/uk.js.map +1 -1
  44. package/dist/recipient/i18n/zh-Hans.js +6 -0
  45. package/dist/recipient/i18n/zh-Hans.js.map +1 -1
  46. package/dist/recipient/view.d.ts +9 -0
  47. package/dist/recipient/view.js +2 -0
  48. package/dist/recipient/view.js.map +1 -1
  49. package/package.json +2 -2
package/README.md CHANGED
@@ -371,6 +371,34 @@ authorize now. Read and write project recipient configuration using
371
371
  `projects:read` and `projects:write`; a project credential can configure only
372
372
  its own project.
373
373
 
374
+ To open the same settings on WhooshBang's hosted page, first create a recipient
375
+ session on your backend and return its `CreateRecipientSessionResponse` to your
376
+ app. The hosted page asks the opener for that response. Send it only after
377
+ checking the ready message's window and origin:
378
+
379
+ ```js
380
+ const hostedOrigin = new URL(session.hosted_url).origin;
381
+ let popup = null;
382
+ function onReady(event) {
383
+ if (
384
+ event.source !== popup ||
385
+ event.origin !== hostedOrigin ||
386
+ event.data?.type !== "whooshbang.recipient-settings.ready"
387
+ ) return;
388
+ window.removeEventListener("message", onReady);
389
+ popup.postMessage(
390
+ { type: "whooshbang.recipient-settings.session", session },
391
+ hostedOrigin,
392
+ );
393
+ }
394
+ window.addEventListener("message", onReady);
395
+ popup = window.open(session.hosted_url, "_blank");
396
+ if (!popup) window.removeEventListener("message", onReady);
397
+ ```
398
+
399
+ The capability stays in the message, not the address or page markup. The hosted
400
+ page uses the same category switches and channel controls as the embedded panel.
401
+
374
402
  ## Machine clients
375
403
 
376
404
  `createMachineCredential` generates the C0-03 secret with Web Crypto and
@@ -465,6 +493,10 @@ credit. These ceilings do not schedule an automatic SDK retry.
465
493
  | `subscriber_unbound` | Outcome | On a send, the person's channel state: they revoked their channel or never finished subscribing, so the branch is to invite them again. It is also the answer when a send names a `connection_id` and the subscriber has no connected channel at all. `createMessage` and `createMessageInEnvironment` return it. `createMachineClient` still throws it: a machine client for an unbound subscriber is setup that is wrong. |
466
494
  | `subscriber_not_connected` | Exception | A send or a connection test named a connection the subscriber has not connected through, while they are connected through another. `problem.subscriber_id` and `problem.channel` say who and where; nothing was sent. Naming the connection was the caller's choice: omit `connection_id` to let the service choose one of their channels, pick a connection they connected through, or invite them through this one. |
467
495
  | `not_consented_for_marketing` | Exception | A `marketing` send or broadcast reached an email recipient enrolled only on a service basis. Nothing was sent to that recipient and nothing was charged. Send it as `service`, or obtain marketing consent first. |
496
+ | `category_not_found` | Exception | The named category is not active in this project. Check its key before sending. |
497
+ | `category_purpose_mismatch` | Exception | The stated purpose disagrees with the category's purpose. Nothing was sent or charged. |
498
+ | `category_turned_off` | Exception | The subscriber switched this category off. Nothing was sent or charged. |
499
+ | `category_conflict` | Exception | A category key is taken, the category is in use, or its settings prevent the requested change. |
468
500
  | `recipient_configuration_invalid` | Exception | The owner's recipient-experience configuration is not usable as submitted or as stored. |
469
501
  | `recipient_origin_forbidden` | Exception | The presenting browser origin is not registered for the session. |
470
502
  | `return_destination_not_found` | Exception | The return-destination key is not configured. |
package/dist/client.d.ts CHANGED
@@ -2,7 +2,7 @@ import { type WhoAmI, type OperatorCollection, type OperatorResolution, type Cre
2
2
  import type { BillingProjectSlots, BillingPromotions, BillingPromotion, RedeemBillingPromotionRequest, AssignBillingProjectSlotsRequest, SubscriptionChange, ConfirmSubscriptionChangeRequest, BillingEntitlements, SubscriptionSelection, ProjectAttribution, UpdateProjectAttributionRequest, AutoTopUpSettings, UpdateAutoTopUpSettingsRequest, BillingAccount, CardSetup, CreateCreditPurchaseRequest, CreditPurchase, BillingInvoiceCollection, UpdateBillingReceiptEmailRequest } from "@whooshbang/contracts";
3
3
  import { type AssertEmailConsentRequest, type BindingSummary } from "@whooshbang/contracts";
4
4
  import type { InteractionOutcome } from "./interactions.js";
5
- import type { OrganizationProjection, ApiCredential, OrganizationCredential, OrganizationCredentialCollection, OrganizationCredentialRotation, OrganizationCredentialSecretReveal, ApiCredentialCollection, ApiCredentialRotation, ApiCredentialSecretReveal, AttachNotifierConnectionRequest, ChannelConnection, ChannelConnectionCollection, ConnectionProviderCollection, UsageGrouping, UsageReport, MessageState, MessageListPage, MessageDeliveryHistory, MessageNotificationImage, InteractionTimeline, UpdateEmailSenderRequest, CustomerEventDeliveryHistory, CustomerEventDeliveryAttempt, DeliveryHolds, MachineClientOperationsList, RecipientCopyCatalogue, NotifierConnectionCollection, ProjectRecipientExperience, RecipientBrandLogoUpload, NotificationImageAsset, UpdateProjectRecipientExperienceRequest, EnvironmentRecipientExperience, UpdateEnvironmentRecipientExperienceRequest, SubscriberChannelSettings, AcknowledgeEmailRemediationRequest, CreateRecipientSessionRequest, CreateRecipientSessionResponse, RecipientSession, RecipientSessionCapability, CreateProviderHandoffRequest, ProviderHandoff, SetPreferredBindingRequest, PreferredBinding, CreateSubscriberRequest, Subscriber, SubscriberDataExport, UpdateSubscriberRequest, SubscriberCollection, CloseOrganizationRequest, InviteTeammateRequest, Teammate, TeammateAccessRequest, TeammateCollection, OrganizationClosureResult, CreateSubscriberGroupRequest, UpdateSubscriberGroupRequest, SubscriberGroup, SubscriberGroupCollection, SubscriberGroupMembership, SubscriberGroupMembershipCollection, CreateGroupBroadcastRequest, GroupBroadcast, CreateOrganizationCredentialRequest, CreateApiCredentialRequest, CreateChannelConnectionRequest, CreateCustomerEndpointRequest, CreateMachineClientRequest, CreateMessageRequest, CreateProjectRequest, UpdateProjectRequest, CreateSubscriptionLinkRequest, CustomerEndpoint, CustomerEndpointAttemptCollection, CustomerEndpointCollection, CustomerEndpointMutationResult, InteractionSummary, MachineClient, MachineCredential, MachineEventAckRequest, MachineEventAckResponse, MachineEventPollResponse, Message, Problem, Project, ProjectCollection, RecipientCopyKey, RecipientCopyOverride, RecipientCopyOverrideCollection, RecipientLanguage, ProviderCapabilitiesCollection, ProviderInstallation, ProviderInstallationCollection, EmailDomain, EmailDomainCollection, CreateEmailDomainRequest, RegisterMachineCredentialRequest, RotateOrganizationCredentialRequest, RotateApiCredentialRequest, ConnectionTest, ConnectionTestCollection, CreateConnectionTestRequest, CustomerApplicationManifest, RotateChannelConnectionCredentialRequest, RotateCustomerEndpointRequest, SubscriptionLink, UpdateChannelConnectionRequest, UpdateRecipientCopyOverrideRequest } from "@whooshbang/contracts";
5
+ import type { OrganizationProjection, ApiCredential, OrganizationCredential, OrganizationCredentialCollection, OrganizationCredentialRotation, OrganizationCredentialSecretReveal, ApiCredentialCollection, ApiCredentialRotation, ApiCredentialSecretReveal, AttachNotifierConnectionRequest, ChannelConnection, ChannelConnectionCollection, ConnectionProviderCollection, UsageGrouping, UsageReport, MessageState, MessageListPage, MessageDeliveryHistory, MessageNotificationImage, InteractionTimeline, UpdateEmailSenderRequest, CustomerEventDeliveryHistory, CustomerEventDeliveryAttempt, DeliveryHolds, MachineClientOperationsList, RecipientCopyCatalogue, NotifierConnectionCollection, ProjectRecipientExperience, RecipientBrandLogoUpload, NotificationImageAsset, UpdateProjectRecipientExperienceRequest, EnvironmentRecipientExperience, UpdateEnvironmentRecipientExperienceRequest, SubscriberChannelSettings, AcknowledgeEmailRemediationRequest, CreateRecipientSessionRequest, CreateRecipientSessionResponse, RecipientSession, RecipientSessionCapability, CreateProviderHandoffRequest, ProviderHandoff, SetPreferredBindingRequest, PreferredBinding, CreateSubscriberRequest, Subscriber, SubscriberDataExport, UpdateSubscriberRequest, SubscriberCollection, CloseOrganizationRequest, InviteTeammateRequest, Teammate, TeammateAccessRequest, TeammateCollection, OrganizationClosureResult, CreateSubscriberGroupRequest, UpdateSubscriberGroupRequest, SubscriberGroup, SubscriberGroupCollection, SubscriberGroupMembership, SubscriberGroupMembershipCollection, CreateGroupBroadcastRequest, GroupBroadcast, CreateOrganizationCredentialRequest, CreateApiCredentialRequest, CreateChannelConnectionRequest, CreateCustomerEndpointRequest, CreateMachineClientRequest, CreateMessageRequest, MessageCategory, MessageCategoryCollection, CreateMessageCategoryRequest, UpdateMessageCategoryRequest, SubscriberCategoryPreference, SubscriberCategoryPreferenceCollection, CreateProjectRequest, UpdateProjectRequest, CreateSubscriptionLinkRequest, CustomerEndpoint, CustomerEndpointAttemptCollection, CustomerEndpointCollection, CustomerEndpointMutationResult, InteractionSummary, MachineClient, MachineCredential, MachineEventAckRequest, MachineEventAckResponse, MachineEventPollResponse, Message, Problem, Project, ProjectCollection, RecipientCopyKey, RecipientCopyOverride, RecipientCopyOverrideCollection, RecipientLanguage, ProviderCapabilitiesCollection, ProviderInstallation, ProviderInstallationCollection, EmailDomain, EmailDomainCollection, CreateEmailDomainRequest, RegisterMachineCredentialRequest, RotateOrganizationCredentialRequest, RotateApiCredentialRequest, ConnectionTest, ConnectionTestCollection, CreateConnectionTestRequest, CustomerApplicationManifest, RotateChannelConnectionCredentialRequest, RotateCustomerEndpointRequest, SubscriptionLink, UpdateChannelConnectionRequest, UpdateRecipientCopyOverrideRequest } from "@whooshbang/contracts";
6
6
  export type WhooshBangFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
7
7
  /**
8
8
  * The outcome of one SDK invocation, as reported to an optional logging hook.
@@ -82,11 +82,17 @@ export interface ListPageOptions extends RequestOptions {
82
82
  }
83
83
  export type ListProjectsOptions = ListPageOptions;
84
84
  export interface ListMessagesOptions extends ListPageOptions {
85
+ readonly q?: string;
85
86
  readonly connectionId?: string;
86
87
  readonly acceptedAfter?: string;
87
88
  readonly acceptedBefore?: string;
88
89
  readonly states?: readonly MessageState[];
89
90
  readonly subscriberId?: string;
91
+ readonly categoryKey?: string;
92
+ readonly noCategory?: boolean;
93
+ }
94
+ export interface ListMessageCategoriesOptions extends RequestOptions {
95
+ readonly includeArchived?: boolean;
90
96
  }
91
97
  export interface RecipientCopyCatalogueOptions extends RequestOptions {
92
98
  readonly language?: RecipientLanguage;
@@ -312,6 +318,12 @@ export declare class WhooshBangClient {
312
318
  uploadRecipientBrandLogo(projectId: string, logo: Blob | Uint8Array, rowVersion: number, options?: RequestOptions): Promise<RecipientBrandLogoUpload>;
313
319
  uploadNotificationImageAsset(projectId: string, environmentId: string, image: Blob | Uint8Array, options?: SideEffectRequestOptions): Promise<NotificationImageAsset>;
314
320
  deleteNotificationImageAsset(projectId: string, environmentId: string, assetId: string, options?: RequestOptions): Promise<void>;
321
+ listMessageCategories(projectId: string, options?: ListMessageCategoriesOptions): Promise<MessageCategoryCollection>;
322
+ createMessageCategory(projectId: string, request: CreateMessageCategoryRequest, options?: RequestOptions): Promise<MessageCategory>;
323
+ updateMessageCategory(projectId: string, key: string, request: UpdateMessageCategoryRequest, options?: RequestOptions): Promise<MessageCategory>;
324
+ deleteMessageCategory(projectId: string, key: string, options?: RequestOptions): Promise<void>;
325
+ getOwnCategoryPreferences(projectId: string, environmentId: string, options?: RequestOptions): Promise<SubscriberCategoryPreferenceCollection>;
326
+ setOwnCategoryPreference(projectId: string, environmentId: string, key: string, enabled: boolean, options?: RequestOptions): Promise<SubscriberCategoryPreference>;
315
327
  getEnvironmentRecipientExperience(projectId: string, environmentId: string, options?: RequestOptions): Promise<EnvironmentRecipientExperience>;
316
328
  updateEnvironmentRecipientExperience(projectId: string, environmentId: string, request: UpdateEnvironmentRecipientExperienceRequest, options?: RequestOptions): Promise<EnvironmentRecipientExperience>;
317
329
  getSubscriberChannelSettings(projectId: string, environmentId: string, subscriberId: string, options?: RequestOptions): Promise<SubscriberChannelSettings>;
@@ -499,8 +511,8 @@ export declare class WhooshBangClient {
499
511
  disableCustomerEndpoint(projectId: string, environmentId: string, endpointId: string, options?: RequestOptions): Promise<CustomerEndpoint>;
500
512
  listCustomerEndpointAttempts(projectId: string, environmentId: string, endpointId: string, options?: ListPageOptions): Promise<CustomerEndpointAttemptCollection>;
501
513
  /**
502
- * An environment's content-free message history, with connection, subscriber,
503
- * state and acceptance-time filters and bounded cursor or numbered pages.
514
+ * An environment's message history, with retained-text or exact-ID search,
515
+ * connection, subscriber, state and acceptance-time filters and bounded pages.
504
516
  */
505
517
  listMessagesInEnvironment(projectId: string, environmentId: string, options?: ListMessagesOptions): Promise<MessageListPage>;
506
518
  getMessageDeliveryHistory(projectId: string, environmentId: string, messageId: string, options?: RequestOptions): Promise<MessageDeliveryHistory>;
@@ -715,6 +727,8 @@ export declare class WhooshBangRecipientSessionClient {
715
727
  #private;
716
728
  constructor(options: WhooshBangRecipientSessionClientOptions);
717
729
  getSession(options?: RequestOptions): Promise<RecipientSession>;
730
+ getCategoryPreferences(options?: RequestOptions): Promise<SubscriberCategoryPreferenceCollection>;
731
+ setCategoryPreference(key: string, enabled: boolean, options?: RequestOptions): Promise<SubscriberCategoryPreference>;
718
732
  getRecipientBrandLogo(assetId: string, options?: RequestOptions): Promise<Blob>;
719
733
  createProviderHandoff(request: CreateProviderHandoffRequest, options?: RequestOptions): Promise<ProviderHandoff>;
720
734
  setPreferredBinding(request: SetPreferredBindingRequest, options?: RequestOptions): Promise<PreferredBinding>;
package/dist/client.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { validateWhoAmI, validateOperatorCollection, validateOperatorResolution, validateCreateOperatorMessageRequest, validateOperatorMessageResult, validateOperatorBroadcast, validateOperatorPreferences, validateOperatorConnectRequest, } from "@whooshbang/contracts";
2
2
  import { validateAssertEmailConsentRequest, validateBindingSummary, } from "@whooshbang/contracts";
3
- import { contractValidationErrors, validateOrganizationCredential, validateOrganizationCredentialCollection, validateOrganizationCredentialRotation, validateOrganizationCredentialSecretReveal, validateBillingProjectSlots, validateBillingPromotions, validateBillingPromotion, validateRedeemBillingPromotionRequest, validateAssignBillingProjectSlotsRequest, validateSubscriptionChange, validateConfirmSubscriptionChangeRequest, validateBillingEntitlements, validateSubscriptionSelection, validateProjectAttribution, validateUpdateProjectAttributionRequest, validateAutoTopUpSettings, validateUpdateAutoTopUpSettingsRequest, validateBillingAccount, validateCardSetup, validateCreateCreditPurchaseRequest, validateCreditPurchase, validateBillingInvoiceCollection, validateUpdateBillingReceiptEmailRequest, validateOrganizationProjection, validateApiCredential, validateApiCredentialCollection, validateApiCredentialRotation, validateApiCredentialSecretReveal, validateAttachNotifierConnectionRequest, validateChannelConnection, validateChannelConnectionCollection, validateConnectionProviderCollection, validateUsageReport, validateMessageListPage, validateMessageDeliveryHistory, validateMessageNotificationImage, validateInteractionTimeline, validateUpdateEmailSenderRequest, validateCustomerEventDeliveryHistory, validateCustomerEventDeliveryAttempt, validateDeliveryHolds, validateMachineClientOperationsList, validateRecipientCopyCatalogue, validateNotifierConnectionCollection, validateProjectRecipientExperience, validateRecipientBrandLogoUpload, validateNotificationImageAsset, validateUpdateProjectRecipientExperienceRequest, validateEnvironmentRecipientExperience, validateUpdateEnvironmentRecipientExperienceRequest, validateSubscriberChannelSettings, validateAcknowledgeEmailRemediationRequest, validateCreateRecipientSessionRequest, validateCreateRecipientSessionResponse, validateRecipientSession, validateCreateProviderHandoffRequest, validateProviderHandoff, validateSetPreferredBindingRequest, validatePreferredBinding, validateCreateSubscriberRequest, validateSubscriber, validateSubscriberDataExport, validateUpdateSubscriberRequest, validateSubscriberCollection, validateCloseOrganizationRequest, validateInviteTeammateRequest, validateTeammate, validateTeammateAccessRequest, validateTeammateCollection, validateOrganizationClosureResult, validateCreateSubscriberGroupRequest, validateUpdateSubscriberGroupRequest, validateSubscriberGroup, validateSubscriberGroupCollection, validateSubscriberGroupMembership, validateSubscriberGroupMembershipCollection, validateCreateGroupBroadcastRequest, validateGroupBroadcast, validateCreateOrganizationCredentialRequest, validateCreateApiCredentialRequest, validateCreateChannelConnectionRequest, validateCreateCustomerEndpointRequest, validateCreateMachineClientRequest, validateCreateMessageRequest, validateCreateProjectRequest, validateUpdateProjectRequest, validateCreateSubscriptionLinkRequest, validateCustomerEndpoint, validateCustomerEndpointAttemptCollection, validateCustomerEndpointCollection, validateCustomerEndpointMutationResult, validateInteractionSummary, validateMachineClient, validateMachineCredential, validateMachineEventAckRequest, validateMachineEventAckResponse, validateMachineEventPollResponse, validateMessage, validateProblem, validateProject, validateProjectCollection, validateRecipientCopyOverride, validateRecipientCopyOverrideCollection, validateProviderCapabilitiesCollection, validateProviderInstallationCollection, validateEmailDomainCollection, validateCreateEmailDomainRequest, validateRegisterMachineCredentialRequest, validateRotateOrganizationCredentialRequest, validateRotateApiCredentialRequest, validateConnectionTest, validateConnectionTestCollection, validateCreateConnectionTestRequest, validateCustomerApplicationManifest, validateRotateChannelConnectionCredentialRequest, validateRotateCustomerEndpointRequest, validateSubscriptionLink, validateUpdateChannelConnectionRequest, validateUpdateRecipientCopyOverrideRequest, } from "@whooshbang/contracts";
3
+ import { contractValidationErrors, validateOrganizationCredential, validateOrganizationCredentialCollection, validateOrganizationCredentialRotation, validateOrganizationCredentialSecretReveal, validateBillingProjectSlots, validateBillingPromotions, validateBillingPromotion, validateRedeemBillingPromotionRequest, validateAssignBillingProjectSlotsRequest, validateSubscriptionChange, validateConfirmSubscriptionChangeRequest, validateBillingEntitlements, validateSubscriptionSelection, validateProjectAttribution, validateUpdateProjectAttributionRequest, validateAutoTopUpSettings, validateUpdateAutoTopUpSettingsRequest, validateBillingAccount, validateCardSetup, validateCreateCreditPurchaseRequest, validateCreditPurchase, validateBillingInvoiceCollection, validateUpdateBillingReceiptEmailRequest, validateOrganizationProjection, validateApiCredential, validateApiCredentialCollection, validateApiCredentialRotation, validateApiCredentialSecretReveal, validateAttachNotifierConnectionRequest, validateChannelConnection, validateChannelConnectionCollection, validateConnectionProviderCollection, validateUsageReport, validateMessageListPage, validateMessageDeliveryHistory, validateMessageNotificationImage, validateInteractionTimeline, validateUpdateEmailSenderRequest, validateCustomerEventDeliveryHistory, validateCustomerEventDeliveryAttempt, validateDeliveryHolds, validateMachineClientOperationsList, validateRecipientCopyCatalogue, validateNotifierConnectionCollection, validateProjectRecipientExperience, validateRecipientBrandLogoUpload, validateNotificationImageAsset, validateUpdateProjectRecipientExperienceRequest, validateEnvironmentRecipientExperience, validateUpdateEnvironmentRecipientExperienceRequest, validateSubscriberChannelSettings, validateAcknowledgeEmailRemediationRequest, validateCreateRecipientSessionRequest, validateCreateRecipientSessionResponse, validateRecipientSession, validateCreateProviderHandoffRequest, validateProviderHandoff, validateSetPreferredBindingRequest, validatePreferredBinding, validateCreateSubscriberRequest, validateSubscriber, validateSubscriberDataExport, validateUpdateSubscriberRequest, validateSubscriberCollection, validateCloseOrganizationRequest, validateInviteTeammateRequest, validateTeammate, validateTeammateAccessRequest, validateTeammateCollection, validateOrganizationClosureResult, validateCreateSubscriberGroupRequest, validateUpdateSubscriberGroupRequest, validateSubscriberGroup, validateSubscriberGroupCollection, validateSubscriberGroupMembership, validateSubscriberGroupMembershipCollection, validateCreateGroupBroadcastRequest, validateGroupBroadcast, validateCreateOrganizationCredentialRequest, validateCreateApiCredentialRequest, validateCreateChannelConnectionRequest, validateCreateCustomerEndpointRequest, validateCreateMachineClientRequest, validateCreateMessageRequest, validateMessageCategory, validateMessageCategoryCollection, validateCreateMessageCategoryRequest, validateUpdateMessageCategoryRequest, validateSubscriberCategoryPreference, validateSubscriberCategoryPreferenceCollection, validateSetSubscriberCategoryPreferenceRequest, validateCreateProjectRequest, validateUpdateProjectRequest, validateCreateSubscriptionLinkRequest, validateCustomerEndpoint, validateCustomerEndpointAttemptCollection, validateCustomerEndpointCollection, validateCustomerEndpointMutationResult, validateInteractionSummary, validateMachineClient, validateMachineCredential, validateMachineEventAckRequest, validateMachineEventAckResponse, validateMachineEventPollResponse, validateMessage, validateProblem, validateProject, validateProjectCollection, validateRecipientCopyOverride, validateRecipientCopyOverrideCollection, validateProviderCapabilitiesCollection, validateProviderInstallationCollection, validateEmailDomainCollection, validateCreateEmailDomainRequest, validateRegisterMachineCredentialRequest, validateRotateOrganizationCredentialRequest, validateRotateApiCredentialRequest, validateConnectionTest, validateConnectionTestCollection, validateCreateConnectionTestRequest, validateCustomerApplicationManifest, validateRotateChannelConnectionCredentialRequest, validateRotateCustomerEndpointRequest, validateSubscriptionLink, validateUpdateChannelConnectionRequest, validateUpdateRecipientCopyOverrideRequest, } from "@whooshbang/contracts";
4
4
  import { validateAdditiveCompatible } from "./additive-compatibility.js";
5
5
  import { WhooshBangContractError, WhooshBangOutcomeUnknownError, WhooshBangProblemError, WhooshBangProtocolError, WhooshBangTransportError, validationError, } from "./errors.js";
6
6
  import { interactionAnswer } from "./interactions.js";
@@ -1359,6 +1359,79 @@ export class WhooshBangClient {
1359
1359
  sideEffect: true,
1360
1360
  });
1361
1361
  }
1362
+ async listMessageCategories(projectId, options = {}) {
1363
+ const operation = "listMessageCategories";
1364
+ return this.#request({
1365
+ method: "GET",
1366
+ operation,
1367
+ options,
1368
+ path: `v1/projects/${pathSegment(operation, projectId, "projectId")}/message-categories${options.includeArchived === undefined ? "" : `?include_archived=${options.includeArchived}`}`,
1369
+ sideEffect: false,
1370
+ validator: validateMessageCategoryCollection,
1371
+ });
1372
+ }
1373
+ async createMessageCategory(projectId, request, options = {}) {
1374
+ const operation = "createMessageCategory";
1375
+ assertInput(operation, request, validateCreateMessageCategoryRequest);
1376
+ return this.#request({
1377
+ body: request,
1378
+ method: "POST",
1379
+ operation,
1380
+ options,
1381
+ path: `v1/projects/${pathSegment(operation, projectId, "projectId")}/message-categories`,
1382
+ sideEffect: true,
1383
+ validator: validateMessageCategory,
1384
+ });
1385
+ }
1386
+ async updateMessageCategory(projectId, key, request, options = {}) {
1387
+ const operation = "updateMessageCategory";
1388
+ assertInput(operation, request, validateUpdateMessageCategoryRequest);
1389
+ return this.#request({
1390
+ body: request,
1391
+ method: "PUT",
1392
+ operation,
1393
+ options,
1394
+ path: `v1/projects/${pathSegment(operation, projectId, "projectId")}/message-categories/${pathSegment(operation, key, "key")}`,
1395
+ sideEffect: true,
1396
+ validator: validateMessageCategory,
1397
+ });
1398
+ }
1399
+ async deleteMessageCategory(projectId, key, options = {}) {
1400
+ const operation = "deleteMessageCategory";
1401
+ return this.#request({
1402
+ method: "DELETE",
1403
+ operation,
1404
+ options,
1405
+ path: `v1/projects/${pathSegment(operation, projectId, "projectId")}/message-categories/${pathSegment(operation, key, "key")}`,
1406
+ sideEffect: true,
1407
+ noContent: true,
1408
+ });
1409
+ }
1410
+ async getOwnCategoryPreferences(projectId, environmentId, options = {}) {
1411
+ const operation = "getOwnCategoryPreferences";
1412
+ return this.#request({
1413
+ method: "GET",
1414
+ operation,
1415
+ options,
1416
+ path: `${environmentRoot(operation, projectId, environmentId)}/notification-preferences/categories`,
1417
+ sideEffect: false,
1418
+ validator: validateSubscriberCategoryPreferenceCollection,
1419
+ });
1420
+ }
1421
+ async setOwnCategoryPreference(projectId, environmentId, key, enabled, options = {}) {
1422
+ const operation = "setOwnCategoryPreference";
1423
+ const request = { enabled };
1424
+ assertInput(operation, request, validateSetSubscriberCategoryPreferenceRequest);
1425
+ return this.#request({
1426
+ body: request,
1427
+ method: "PUT",
1428
+ operation,
1429
+ options,
1430
+ path: `${environmentRoot(operation, projectId, environmentId)}/notification-preferences/categories/${pathSegment(operation, key, "key")}`,
1431
+ sideEffect: true,
1432
+ validator: validateSubscriberCategoryPreference,
1433
+ });
1434
+ }
1362
1435
  async getEnvironmentRecipientExperience(projectId, environmentId, options = {}) {
1363
1436
  const operation = "getEnvironmentRecipientExperience";
1364
1437
  return this.#request({
@@ -2259,22 +2332,26 @@ export class WhooshBangClient {
2259
2332
  });
2260
2333
  }
2261
2334
  /**
2262
- * An environment's content-free message history, with connection, subscriber,
2263
- * state and acceptance-time filters and bounded cursor or numbered pages.
2335
+ * An environment's message history, with retained-text or exact-ID search,
2336
+ * connection, subscriber, state and acceptance-time filters and bounded pages.
2264
2337
  */
2265
2338
  async listMessagesInEnvironment(projectId, environmentId, options = {}) {
2266
2339
  const operation = "listMessagesInEnvironment";
2267
2340
  const search = new URLSearchParams(listPageQuery(operation, options, "message").slice(1));
2268
2341
  for (const [name, value] of [
2342
+ ["q", options.q],
2269
2343
  ["connection_id", options.connectionId],
2270
2344
  ["accepted_after", options.acceptedAfter],
2271
2345
  ["accepted_before", options.acceptedBefore],
2272
2346
  ["subscriber_id", options.subscriberId],
2347
+ ["category_key", options.categoryKey],
2273
2348
  ])
2274
2349
  if (value !== undefined)
2275
2350
  search.set(name, value);
2276
2351
  if (options.states !== undefined)
2277
2352
  search.set("state", options.states.join(","));
2353
+ if (options.noCategory !== undefined)
2354
+ search.set("no_category", String(options.noCategory));
2278
2355
  return this.#request({
2279
2356
  method: "GET",
2280
2357
  operation,
@@ -3405,6 +3482,30 @@ export class WhooshBangRecipientSessionClient {
3405
3482
  validator: validateRecipientSession,
3406
3483
  });
3407
3484
  }
3485
+ async getCategoryPreferences(options = {}) {
3486
+ return this.#request({
3487
+ method: "GET",
3488
+ operation: "getCategoryPreferences",
3489
+ options,
3490
+ path: "v1/recipient-session/category-preferences",
3491
+ sideEffect: false,
3492
+ validator: validateSubscriberCategoryPreferenceCollection,
3493
+ });
3494
+ }
3495
+ async setCategoryPreference(key, enabled, options = {}) {
3496
+ const operation = "setCategoryPreference";
3497
+ const request = { enabled };
3498
+ assertInput(operation, request, validateSetSubscriberCategoryPreferenceRequest);
3499
+ return this.#request({
3500
+ body: request,
3501
+ method: "PUT",
3502
+ operation,
3503
+ options,
3504
+ path: `v1/recipient-session/category-preferences/${pathSegment(operation, key, "key")}`,
3505
+ sideEffect: true,
3506
+ validator: validateSubscriberCategoryPreference,
3507
+ });
3508
+ }
3408
3509
  async getRecipientBrandLogo(assetId, options = {}) {
3409
3510
  const operation = "getRecipientBrandLogo";
3410
3511
  if (!/^asset_[0-9a-f]{32}$/u.test(assetId)) {