@whooshbang/sdk 4.1.0 → 4.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.
- package/README.md +32 -0
- package/dist/client.d.ts +9 -1
- package/dist/client.js +98 -1
- package/dist/client.js.map +1 -1
- package/dist/recipient/element.js +160 -7
- package/dist/recipient/element.js.map +1 -1
- package/dist/recipient/hosted-entry.d.ts +5 -0
- package/dist/recipient/hosted-entry.js +89 -0
- package/dist/recipient/hosted-entry.js.map +1 -0
- package/dist/recipient/i18n/ar.js +6 -0
- package/dist/recipient/i18n/ar.js.map +1 -1
- package/dist/recipient/i18n/catalog.d.ts +6 -0
- package/dist/recipient/i18n/catalog.js.map +1 -1
- package/dist/recipient/i18n/de.js +6 -0
- package/dist/recipient/i18n/de.js.map +1 -1
- package/dist/recipient/i18n/en.js +6 -0
- package/dist/recipient/i18n/en.js.map +1 -1
- package/dist/recipient/i18n/es.js +6 -0
- package/dist/recipient/i18n/es.js.map +1 -1
- package/dist/recipient/i18n/fa.js +6 -0
- package/dist/recipient/i18n/fa.js.map +1 -1
- package/dist/recipient/i18n/fr.js +6 -0
- package/dist/recipient/i18n/fr.js.map +1 -1
- package/dist/recipient/i18n/hi.js +6 -0
- package/dist/recipient/i18n/hi.js.map +1 -1
- package/dist/recipient/i18n/id.js +6 -0
- package/dist/recipient/i18n/id.js.map +1 -1
- package/dist/recipient/i18n/it.js +6 -0
- package/dist/recipient/i18n/it.js.map +1 -1
- package/dist/recipient/i18n/nl.js +6 -0
- package/dist/recipient/i18n/nl.js.map +1 -1
- package/dist/recipient/i18n/pl.js +6 -0
- package/dist/recipient/i18n/pl.js.map +1 -1
- package/dist/recipient/i18n/pt-BR.js +6 -0
- package/dist/recipient/i18n/pt-BR.js.map +1 -1
- package/dist/recipient/i18n/ru.js +6 -0
- package/dist/recipient/i18n/ru.js.map +1 -1
- package/dist/recipient/i18n/tr.js +6 -0
- package/dist/recipient/i18n/tr.js.map +1 -1
- package/dist/recipient/i18n/uk.js +6 -0
- package/dist/recipient/i18n/uk.js.map +1 -1
- package/dist/recipient/i18n/zh-Hans.js +6 -0
- package/dist/recipient/i18n/zh-Hans.js.map +1 -1
- package/dist/recipient/view.d.ts +9 -0
- package/dist/recipient/view.js +2 -0
- package/dist/recipient/view.js.map +1 -1
- 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.
|
|
@@ -312,6 +312,12 @@ export declare class WhooshBangClient {
|
|
|
312
312
|
uploadRecipientBrandLogo(projectId: string, logo: Blob | Uint8Array, rowVersion: number, options?: RequestOptions): Promise<RecipientBrandLogoUpload>;
|
|
313
313
|
uploadNotificationImageAsset(projectId: string, environmentId: string, image: Blob | Uint8Array, options?: SideEffectRequestOptions): Promise<NotificationImageAsset>;
|
|
314
314
|
deleteNotificationImageAsset(projectId: string, environmentId: string, assetId: string, options?: RequestOptions): Promise<void>;
|
|
315
|
+
listMessageCategories(projectId: string, options?: RequestOptions): Promise<MessageCategoryCollection>;
|
|
316
|
+
createMessageCategory(projectId: string, request: CreateMessageCategoryRequest, options?: RequestOptions): Promise<MessageCategory>;
|
|
317
|
+
updateMessageCategory(projectId: string, key: string, request: UpdateMessageCategoryRequest, options?: RequestOptions): Promise<MessageCategory>;
|
|
318
|
+
deleteMessageCategory(projectId: string, key: string, options?: RequestOptions): Promise<void>;
|
|
319
|
+
getOwnCategoryPreferences(projectId: string, environmentId: string, options?: RequestOptions): Promise<SubscriberCategoryPreferenceCollection>;
|
|
320
|
+
setOwnCategoryPreference(projectId: string, environmentId: string, key: string, enabled: boolean, options?: RequestOptions): Promise<SubscriberCategoryPreference>;
|
|
315
321
|
getEnvironmentRecipientExperience(projectId: string, environmentId: string, options?: RequestOptions): Promise<EnvironmentRecipientExperience>;
|
|
316
322
|
updateEnvironmentRecipientExperience(projectId: string, environmentId: string, request: UpdateEnvironmentRecipientExperienceRequest, options?: RequestOptions): Promise<EnvironmentRecipientExperience>;
|
|
317
323
|
getSubscriberChannelSettings(projectId: string, environmentId: string, subscriberId: string, options?: RequestOptions): Promise<SubscriberChannelSettings>;
|
|
@@ -715,6 +721,8 @@ export declare class WhooshBangRecipientSessionClient {
|
|
|
715
721
|
#private;
|
|
716
722
|
constructor(options: WhooshBangRecipientSessionClientOptions);
|
|
717
723
|
getSession(options?: RequestOptions): Promise<RecipientSession>;
|
|
724
|
+
getCategoryPreferences(options?: RequestOptions): Promise<SubscriberCategoryPreferenceCollection>;
|
|
725
|
+
setCategoryPreference(key: string, enabled: boolean, options?: RequestOptions): Promise<SubscriberCategoryPreference>;
|
|
718
726
|
getRecipientBrandLogo(assetId: string, options?: RequestOptions): Promise<Blob>;
|
|
719
727
|
createProviderHandoff(request: CreateProviderHandoffRequest, options?: RequestOptions): Promise<ProviderHandoff>;
|
|
720
728
|
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`,
|
|
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({
|
|
@@ -3405,6 +3478,30 @@ export class WhooshBangRecipientSessionClient {
|
|
|
3405
3478
|
validator: validateRecipientSession,
|
|
3406
3479
|
});
|
|
3407
3480
|
}
|
|
3481
|
+
async getCategoryPreferences(options = {}) {
|
|
3482
|
+
return this.#request({
|
|
3483
|
+
method: "GET",
|
|
3484
|
+
operation: "getCategoryPreferences",
|
|
3485
|
+
options,
|
|
3486
|
+
path: "v1/recipient-session/category-preferences",
|
|
3487
|
+
sideEffect: false,
|
|
3488
|
+
validator: validateSubscriberCategoryPreferenceCollection,
|
|
3489
|
+
});
|
|
3490
|
+
}
|
|
3491
|
+
async setCategoryPreference(key, enabled, options = {}) {
|
|
3492
|
+
const operation = "setCategoryPreference";
|
|
3493
|
+
const request = { enabled };
|
|
3494
|
+
assertInput(operation, request, validateSetSubscriberCategoryPreferenceRequest);
|
|
3495
|
+
return this.#request({
|
|
3496
|
+
body: request,
|
|
3497
|
+
method: "PUT",
|
|
3498
|
+
operation,
|
|
3499
|
+
options,
|
|
3500
|
+
path: `v1/recipient-session/category-preferences/${pathSegment(operation, key, "key")}`,
|
|
3501
|
+
sideEffect: true,
|
|
3502
|
+
validator: validateSubscriberCategoryPreference,
|
|
3503
|
+
});
|
|
3504
|
+
}
|
|
3408
3505
|
async getRecipientBrandLogo(assetId, options = {}) {
|
|
3409
3506
|
const operation = "getRecipientBrandLogo";
|
|
3410
3507
|
if (!/^asset_[0-9a-f]{32}$/u.test(assetId)) {
|