@whooshbang/sdk 6.0.0 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-confirmation.d.ts +35 -2
- package/dist/browser-confirmation.js +85 -30
- package/dist/browser-confirmation.js.map +1 -1
- package/dist/client.d.ts +146 -1
- package/dist/client.js +328 -1
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/recipient/digest-section.d.ts +29 -0
- package/dist/recipient/digest-section.js +400 -0
- package/dist/recipient/digest-section.js.map +1 -0
- package/dist/recipient/element.js +153 -10
- package/dist/recipient/element.js.map +1 -1
- package/dist/recipient/i18n/ar.js +37 -0
- package/dist/recipient/i18n/ar.js.map +1 -1
- package/dist/recipient/i18n/catalog.d.ts +38 -0
- package/dist/recipient/i18n/catalog.js.map +1 -1
- package/dist/recipient/i18n/de.js +37 -0
- package/dist/recipient/i18n/de.js.map +1 -1
- package/dist/recipient/i18n/en.js +37 -0
- package/dist/recipient/i18n/en.js.map +1 -1
- package/dist/recipient/i18n/es.js +37 -0
- package/dist/recipient/i18n/es.js.map +1 -1
- package/dist/recipient/i18n/fa.js +37 -0
- package/dist/recipient/i18n/fa.js.map +1 -1
- package/dist/recipient/i18n/fr.js +37 -0
- package/dist/recipient/i18n/fr.js.map +1 -1
- package/dist/recipient/i18n/hi.js +37 -0
- package/dist/recipient/i18n/hi.js.map +1 -1
- package/dist/recipient/i18n/id.js +37 -0
- package/dist/recipient/i18n/id.js.map +1 -1
- package/dist/recipient/i18n/it.js +37 -0
- package/dist/recipient/i18n/it.js.map +1 -1
- package/dist/recipient/i18n/nl.js +37 -0
- package/dist/recipient/i18n/nl.js.map +1 -1
- package/dist/recipient/i18n/pl.js +37 -0
- package/dist/recipient/i18n/pl.js.map +1 -1
- package/dist/recipient/i18n/pt-BR.js +37 -0
- package/dist/recipient/i18n/pt-BR.js.map +1 -1
- package/dist/recipient/i18n/ru.js +37 -0
- package/dist/recipient/i18n/ru.js.map +1 -1
- package/dist/recipient/i18n/tr.js +37 -0
- package/dist/recipient/i18n/tr.js.map +1 -1
- package/dist/recipient/i18n/uk.js +37 -0
- package/dist/recipient/i18n/uk.js.map +1 -1
- package/dist/recipient/i18n/zh-Hans.js +37 -0
- package/dist/recipient/i18n/zh-Hans.js.map +1 -1
- package/dist/recipient/mount.d.ts +5 -0
- package/dist/recipient/mount.js +2 -0
- package/dist/recipient/mount.js.map +1 -1
- package/dist/recipient/quiet-section.d.ts +7 -3
- package/dist/recipient/quiet-section.js +134 -7
- package/dist/recipient/quiet-section.js.map +1 -1
- package/dist/recipient/quiet-view.d.ts +20 -0
- package/dist/recipient/quiet-view.js +54 -0
- package/dist/recipient/quiet-view.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
1
|
+
/**
|
|
2
|
+
* One credential operation a signed-in person approves in the dashboard.
|
|
3
|
+
*
|
|
4
|
+
* Two handoffs share the page. The CLI's carries a public key and a loopback
|
|
5
|
+
* callback, and the result goes back to the CLI encrypted, so no dashboard
|
|
6
|
+
* authority or readable credential is persisted. An agent's (`reveal`) carries
|
|
7
|
+
* neither: the person sees the secret once on the page and copies it, and the
|
|
8
|
+
* agent only ever reads the result's metadata (FXO-3726). An agent may also
|
|
9
|
+
* hand off creating or rotating a webhook endpoint, whose signing secret is
|
|
10
|
+
* revealed the same way.
|
|
11
|
+
*/
|
|
3
12
|
export interface CredentialConfirmation {
|
|
4
13
|
apiOrigin: string;
|
|
5
14
|
organizationId: string;
|
|
@@ -11,7 +20,31 @@ export interface CredentialConfirmation {
|
|
|
11
20
|
state: string;
|
|
12
21
|
expiresAt: number;
|
|
13
22
|
}
|
|
23
|
+
/** An agent's handoff: the person approves it and sees any secret on the page. */
|
|
24
|
+
export interface RevealCredentialConfirmation {
|
|
25
|
+
apiOrigin: string;
|
|
26
|
+
organizationId: string;
|
|
27
|
+
method: "POST";
|
|
28
|
+
path: string;
|
|
29
|
+
body?: unknown;
|
|
30
|
+
reveal: true;
|
|
31
|
+
state: string;
|
|
32
|
+
expiresAt: number;
|
|
33
|
+
}
|
|
34
|
+
/** How long an agent's link stays usable: long enough for a person to open it. */
|
|
35
|
+
export declare const REVEAL_CONFIRMATION_LIFETIME_MS: number;
|
|
36
|
+
/**
|
|
37
|
+
* A reveal link is stamped by the server and checked by the person's browser,
|
|
38
|
+
* whose clock may run behind. Allow two minutes so a slow clock does not refuse
|
|
39
|
+
* a fresh link. CLI links are stamped and checked on one computer.
|
|
40
|
+
*/
|
|
41
|
+
export declare const REVEAL_CLOCK_SKEW_MS: number;
|
|
42
|
+
/** The CLI handoff: credential operations only, answered to the CLI encrypted. */
|
|
14
43
|
export declare function parseCredentialConfirmation(value: string): CredentialConfirmation;
|
|
44
|
+
/** An agent's handoff (FXO-3726): revealed on the page, never sent anywhere. */
|
|
45
|
+
export declare function parseRevealConfirmation(value: string): RevealCredentialConfirmation;
|
|
46
|
+
/** Either handoff, whichever this one is. */
|
|
47
|
+
export declare function parseAnyCredentialConfirmation(value: string): CredentialConfirmation | RevealCredentialConfirmation;
|
|
15
48
|
export declare function encryptCredentialResult(publicKey: JsonWebKey, state: string, result: unknown): Promise<string>;
|
|
16
49
|
export declare function decryptCredentialResult(privateKey: CryptoKey, state: string, encrypted: string): Promise<unknown>;
|
|
17
50
|
export declare function credentialConfirmationDigest(request: CredentialConfirmation): Promise<string>;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import { validateProblem, validateCreateOrganizationCredentialRequest, validateCreateApiCredentialRequest, validateRotateOrganizationCredentialRequest, validateRotateApiCredentialRequest, validateOrganizationCredentialCollection, validateApiCredentialCollection, validateOrganizationCredentialSecretReveal, validateApiCredentialSecretReveal, validateOrganizationCredentialRotation, validateApiCredentialRotation, validateOrganizationCredential, validateApiCredential, } from "@whooshbang/contracts";
|
|
1
|
+
import { validateProblem, validateCreateOrganizationCredentialRequest, validateCreateApiCredentialRequest, validateRotateOrganizationCredentialRequest, validateRotateApiCredentialRequest, validateOrganizationCredentialCollection, validateApiCredentialCollection, validateOrganizationCredentialSecretReveal, validateApiCredentialSecretReveal, validateOrganizationCredentialRotation, validateApiCredentialRotation, validateOrganizationCredential, validateApiCredential, validateCreateCustomerEndpointRequest, validateRotateCustomerEndpointRequest, } from "@whooshbang/contracts";
|
|
2
|
+
/** How long an agent's link stays usable: long enough for a person to open it. */
|
|
3
|
+
export const REVEAL_CONFIRMATION_LIFETIME_MS = 15 * 60_000;
|
|
4
|
+
/**
|
|
5
|
+
* A reveal link is stamped by the server and checked by the person's browser,
|
|
6
|
+
* whose clock may run behind. Allow two minutes so a slow clock does not refuse
|
|
7
|
+
* a fresh link. CLI links are stamped and checked on one computer.
|
|
8
|
+
*/
|
|
9
|
+
export const REVEAL_CLOCK_SKEW_MS = 2 * 60_000;
|
|
10
|
+
const CREDENTIAL_PATH = /^\/v1\/(?:organization|projects\/[A-Za-z0-9_-]+\/environments\/[A-Za-z0-9_-]+)\/credentials(?:\/[A-Za-z0-9_-]+\/(?:rotate|revoke))?$/u;
|
|
11
|
+
const ENDPOINT_PATH = /^\/v1\/projects\/[A-Za-z0-9_-]+\/environments\/[A-Za-z0-9_-]+\/customer-endpoints(?:\/[A-Za-z0-9_-]+\/rotate)?$/u;
|
|
2
12
|
function encoded(bytes) {
|
|
3
13
|
return btoa(Array.from(new Uint8Array(bytes), (byte) => String.fromCharCode(byte)).join(""))
|
|
4
14
|
.replaceAll("+", "-")
|
|
@@ -8,9 +18,28 @@ function encoded(bytes) {
|
|
|
8
18
|
function decoded(value) {
|
|
9
19
|
return Uint8Array.from(atob(value.replaceAll("-", "+").replaceAll("_", "/")), (c) => c.charCodeAt(0));
|
|
10
20
|
}
|
|
21
|
+
/** The CLI handoff: credential operations only, answered to the CLI encrypted. */
|
|
11
22
|
export function parseCredentialConfirmation(value) {
|
|
12
23
|
const parsed = JSON.parse(value);
|
|
13
|
-
|
|
24
|
+
if (parsed.reveal !== undefined)
|
|
25
|
+
throw new Error("Invalid or expired credential confirmation.");
|
|
26
|
+
return checkedConfirmation(parsed);
|
|
27
|
+
}
|
|
28
|
+
/** An agent's handoff (FXO-3726): revealed on the page, never sent anywhere. */
|
|
29
|
+
export function parseRevealConfirmation(value) {
|
|
30
|
+
const parsed = JSON.parse(value);
|
|
31
|
+
if (parsed.reveal !== true)
|
|
32
|
+
throw new Error("Invalid or expired credential confirmation.");
|
|
33
|
+
return checkedConfirmation(parsed);
|
|
34
|
+
}
|
|
35
|
+
/** Either handoff, whichever this one is. */
|
|
36
|
+
export function parseAnyCredentialConfirmation(value) {
|
|
37
|
+
return JSON.parse(value).reveal === true
|
|
38
|
+
? parseRevealConfirmation(value)
|
|
39
|
+
: parseCredentialConfirmation(value);
|
|
40
|
+
}
|
|
41
|
+
function checkedConfirmation(raw) {
|
|
42
|
+
const parsed = raw;
|
|
14
43
|
const api = new URL(parsed.apiOrigin);
|
|
15
44
|
if (api.origin !== parsed.apiOrigin ||
|
|
16
45
|
api.username ||
|
|
@@ -19,43 +48,68 @@ export function parseCredentialConfirmation(value) {
|
|
|
19
48
|
!(api.protocol === "http:" &&
|
|
20
49
|
["127.0.0.1", "localhost"].includes(api.hostname))))
|
|
21
50
|
throw new Error("Invalid API origin.");
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
callback.password ||
|
|
28
|
-
callback.search ||
|
|
29
|
-
callback.hash ||
|
|
30
|
-
!/^[A-Za-z0-9_-]{32,128}$/u.test(parsed.state) ||
|
|
51
|
+
const reveal = parsed.reveal === true;
|
|
52
|
+
const lifetime = reveal
|
|
53
|
+
? REVEAL_CONFIRMATION_LIFETIME_MS + REVEAL_CLOCK_SKEW_MS
|
|
54
|
+
: 300_000;
|
|
55
|
+
if (!/^[A-Za-z0-9_-]{32,128}$/u.test(parsed.state) ||
|
|
31
56
|
!Number.isFinite(parsed.expiresAt) ||
|
|
32
57
|
parsed.expiresAt <= Date.now() ||
|
|
33
|
-
parsed.expiresAt > Date.now() +
|
|
58
|
+
parsed.expiresAt > Date.now() + lifetime ||
|
|
34
59
|
typeof parsed.organizationId !== "string" ||
|
|
35
60
|
parsed.organizationId.length > 100 ||
|
|
36
|
-
!["GET", "POST"].includes(parsed.method)
|
|
37
|
-
|
|
61
|
+
!["GET", "POST"].includes(parsed.method))
|
|
62
|
+
throw new Error("Invalid or expired credential confirmation.");
|
|
63
|
+
if (reveal) {
|
|
64
|
+
// Nothing leaves the page: no key to encrypt to, no callback to call.
|
|
65
|
+
if (parsed.publicKey !== undefined || parsed.redirectUri !== undefined)
|
|
66
|
+
throw new Error("Invalid or expired credential confirmation.");
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const callback = new URL(parsed.redirectUri ?? "");
|
|
70
|
+
const key = parsed.publicKey;
|
|
71
|
+
if (parsed.reveal !== undefined ||
|
|
72
|
+
callback.protocol !== "http:" ||
|
|
73
|
+
callback.hostname !== "127.0.0.1" ||
|
|
74
|
+
!callback.port ||
|
|
75
|
+
callback.pathname !== "/callback" ||
|
|
76
|
+
callback.username ||
|
|
77
|
+
callback.password ||
|
|
78
|
+
callback.search ||
|
|
79
|
+
callback.hash ||
|
|
80
|
+
!key ||
|
|
81
|
+
key.kty !== "RSA" ||
|
|
82
|
+
key.e !== "AQAB" ||
|
|
83
|
+
typeof key.n !== "string" ||
|
|
84
|
+
key.n.length !== 342 ||
|
|
85
|
+
key.d !== undefined)
|
|
86
|
+
throw new Error("Invalid or expired credential confirmation.");
|
|
87
|
+
}
|
|
88
|
+
const credential = CREDENTIAL_PATH.test(parsed.path);
|
|
89
|
+
const endpoint = reveal && ENDPOINT_PATH.test(parsed.path);
|
|
90
|
+
if ((!credential && !endpoint) ||
|
|
38
91
|
(parsed.method === "GET" &&
|
|
39
|
-
(
|
|
92
|
+
(endpoint ||
|
|
93
|
+
parsed.path.endsWith("/rotate") ||
|
|
40
94
|
parsed.path.endsWith("/revoke") ||
|
|
41
95
|
parsed.body !== undefined)) ||
|
|
42
|
-
|
|
43
|
-
parsed.
|
|
44
|
-
typeof parsed.publicKey.n !== "string" ||
|
|
45
|
-
parsed.publicKey.n.length !== 342 ||
|
|
46
|
-
parsed.publicKey.d !== undefined) {
|
|
96
|
+
// An agent hands off a change; reading the inventory is its own tool.
|
|
97
|
+
(reveal && parsed.method === "GET"))
|
|
47
98
|
throw new Error("Invalid or expired credential confirmation.");
|
|
48
|
-
}
|
|
49
99
|
const organization = parsed.path.startsWith("/v1/organization/");
|
|
50
|
-
const validBody =
|
|
51
|
-
? parsed.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
:
|
|
57
|
-
?
|
|
58
|
-
|
|
100
|
+
const validBody = endpoint
|
|
101
|
+
? parsed.path.endsWith("/rotate")
|
|
102
|
+
? validateRotateCustomerEndpointRequest(parsed.body ?? {})
|
|
103
|
+
: validateCreateCustomerEndpointRequest(parsed.body)
|
|
104
|
+
: parsed.method === "GET" || parsed.path.endsWith("/revoke")
|
|
105
|
+
? parsed.body === undefined
|
|
106
|
+
: parsed.path.endsWith("/rotate")
|
|
107
|
+
? organization
|
|
108
|
+
? validateRotateOrganizationCredentialRequest(parsed.body)
|
|
109
|
+
: validateRotateApiCredentialRequest(parsed.body)
|
|
110
|
+
: organization
|
|
111
|
+
? validateCreateOrganizationCredentialRequest(parsed.body)
|
|
112
|
+
: validateCreateApiCredentialRequest(parsed.body);
|
|
59
113
|
if (!validBody ||
|
|
60
114
|
Object.keys(parsed).some((key) => ![
|
|
61
115
|
"apiOrigin",
|
|
@@ -65,6 +119,7 @@ export function parseCredentialConfirmation(value) {
|
|
|
65
119
|
"body",
|
|
66
120
|
"publicKey",
|
|
67
121
|
"redirectUri",
|
|
122
|
+
"reveal",
|
|
68
123
|
"state",
|
|
69
124
|
"expiresAt",
|
|
70
125
|
].includes(key)))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-confirmation.js","sourceRoot":"","sources":["../src/browser-confirmation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,2CAA2C,EAC3C,kCAAkC,EAClC,2CAA2C,EAC3C,kCAAkC,EAClC,wCAAwC,EACxC,+BAA+B,EAC/B,0CAA0C,EAC1C,iCAAiC,EACjC,sCAAsC,EACtC,6BAA6B,EAC7B,8BAA8B,EAC9B,qBAAqB,
|
|
1
|
+
{"version":3,"file":"browser-confirmation.js","sourceRoot":"","sources":["../src/browser-confirmation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,2CAA2C,EAC3C,kCAAkC,EAClC,2CAA2C,EAC3C,kCAAkC,EAClC,wCAAwC,EACxC,+BAA+B,EAC/B,0CAA0C,EAC1C,iCAAiC,EACjC,sCAAsC,EACtC,6BAA6B,EAC7B,8BAA8B,EAC9B,qBAAqB,EACrB,qCAAqC,EACrC,qCAAqC,GACtC,MAAM,uBAAuB,CAAC;AAqC/B,kFAAkF;AAClF,MAAM,CAAC,MAAM,+BAA+B,GAAG,EAAE,GAAG,MAAM,CAAC;AAC3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAG,MAAM,CAAC;AAE/C,MAAM,eAAe,GACnB,uIAAuI,CAAC;AAC1I,MAAM,aAAa,GACjB,kHAAkH,CAAC;AAErH,SAAS,OAAO,CAAC,KAAkB;IACjC,OAAO,IAAI,CACT,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CACzE,EAAE,CACH,CACF;SACE,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;SACpB,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;SACpB,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AACzB,CAA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AC,YAAY;YACX,CAAC,CAAC,0CAA0C,CAAC,KAAK,CAAC,IAAI,CAAC;YACxD,CAAC,CAAC,iCAAiC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CACnD,CAAC;AACJ,CAAC"}
|
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, CancelEscalationByKeyRequest, EscalationPathPreview, EscalationOrder, EscalationOrderCollection, SaveEscalationOrderRequest, QuietHours, SaveQuietHoursRequest, EscalationPolicy, EscalationPolicyCollection, EscalationLimits, UpdateEscalationLimitsRequest, EscalationPagingLimitReport, EscalationPolicyLevel, UpdateEscalationPolicyRequest, CancelEscalationRequest, Escalation, 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";
|
|
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, CancelEscalationByKeyRequest, EscalationPathPreview, EscalationOrder, EscalationOrderCollection, SaveEscalationOrderRequest, QuietHours, SaveQuietHoursRequest, SetDigestPreferenceRequest, SetSubscriberDigestSettingRequest, SubscriberDigestSettings, EscalationPolicy, EscalationPolicyCollection, EscalationLimits, UpdateEscalationLimitsRequest, EscalationPagingLimitReport, EscalationPolicyLevel, UpdateEscalationPolicyRequest, CancelEscalationRequest, Escalation, 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.
|
|
@@ -319,6 +319,81 @@ export interface TemplateMessageSendResult {
|
|
|
319
319
|
readonly layout_locale?: string;
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
|
+
/** A template as its author sees it: the editable draft and the published revision. */
|
|
323
|
+
export interface MessageTemplate extends MessageTemplateCatalogEntry {
|
|
324
|
+
readonly draftVersion: number;
|
|
325
|
+
readonly createdAt?: string;
|
|
326
|
+
readonly updatedAt?: string;
|
|
327
|
+
}
|
|
328
|
+
export interface CreateMessageTemplateRequest {
|
|
329
|
+
readonly name: string;
|
|
330
|
+
readonly display_name: string;
|
|
331
|
+
readonly description?: string;
|
|
332
|
+
readonly category?: string;
|
|
333
|
+
/** Editable draft; complete validation runs at publish. */
|
|
334
|
+
readonly definition: Readonly<Record<string, unknown>>;
|
|
335
|
+
}
|
|
336
|
+
export interface UpdateMessageTemplateRequest {
|
|
337
|
+
readonly name?: string;
|
|
338
|
+
readonly display_name?: string;
|
|
339
|
+
readonly description?: string;
|
|
340
|
+
readonly category?: string;
|
|
341
|
+
readonly disabled?: boolean;
|
|
342
|
+
}
|
|
343
|
+
export interface PublishedTemplateRevision {
|
|
344
|
+
readonly revision: number;
|
|
345
|
+
readonly definition: Readonly<Record<string, unknown>>;
|
|
346
|
+
readonly publishedAt: string;
|
|
347
|
+
readonly publishedBy?: string;
|
|
348
|
+
}
|
|
349
|
+
export interface PreviewMessageTemplateRequest {
|
|
350
|
+
readonly input: Readonly<Record<string, unknown>>;
|
|
351
|
+
/** `default` renders the message every channel falls back to. Omitted means email. */
|
|
352
|
+
readonly channel?: "default" | "generic" | "email" | "telegram" | "slack";
|
|
353
|
+
readonly locale?: string;
|
|
354
|
+
readonly revision?: number;
|
|
355
|
+
/** An unsaved definition to render; cannot be combined with `revision`. */
|
|
356
|
+
readonly definition?: Readonly<Record<string, unknown>>;
|
|
357
|
+
}
|
|
358
|
+
export interface MessageTemplatePreview {
|
|
359
|
+
readonly channel: "default" | "email" | "telegram" | "slack";
|
|
360
|
+
readonly subject?: string;
|
|
361
|
+
readonly html?: string;
|
|
362
|
+
readonly text?: string;
|
|
363
|
+
readonly normalizedInput: Readonly<Record<string, unknown>>;
|
|
364
|
+
readonly templateLocale: string;
|
|
365
|
+
readonly layoutLocale?: string;
|
|
366
|
+
readonly layoutId?: string;
|
|
367
|
+
readonly layoutRevision?: number;
|
|
368
|
+
readonly approximate?: true;
|
|
369
|
+
readonly payload?: Readonly<Record<string, unknown>>;
|
|
370
|
+
}
|
|
371
|
+
export interface DraftTemplateTestSendRequest {
|
|
372
|
+
readonly draft_version: number;
|
|
373
|
+
readonly input: Readonly<Record<string, unknown>>;
|
|
374
|
+
readonly to: {
|
|
375
|
+
readonly subscriber_id: string;
|
|
376
|
+
};
|
|
377
|
+
readonly connection_id?: string;
|
|
378
|
+
readonly notifier_id?: string;
|
|
379
|
+
readonly category_key?: string;
|
|
380
|
+
readonly purpose?: "service" | "marketing";
|
|
381
|
+
readonly correlation_id?: string;
|
|
382
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
383
|
+
readonly expires_at?: string;
|
|
384
|
+
}
|
|
385
|
+
export interface EmailLayout {
|
|
386
|
+
readonly id: string;
|
|
387
|
+
readonly name: string;
|
|
388
|
+
readonly isDefault: boolean;
|
|
389
|
+
readonly disabled: boolean;
|
|
390
|
+
readonly draft: Readonly<Record<string, unknown>>;
|
|
391
|
+
readonly draftVersion: number;
|
|
392
|
+
readonly latestPublishedRevision: number;
|
|
393
|
+
readonly published?: PublishedTemplateRevision;
|
|
394
|
+
readonly createdAt?: string;
|
|
395
|
+
readonly updatedAt?: string;
|
|
396
|
+
}
|
|
322
397
|
export declare class WhooshBangClient {
|
|
323
398
|
#private;
|
|
324
399
|
whoAmI(projectId: string, environmentId: string, options?: RequestOptions): Promise<WhoAmI>;
|
|
@@ -408,6 +483,46 @@ export declare class WhooshBangClient {
|
|
|
408
483
|
}, options?: RequestOptions): Promise<MessageTemplateCatalog>;
|
|
409
484
|
sendTemplateMessage(projectId: string, environmentId: string, request: TemplateMessageSendRequest, options?: SideEffectRequestOptions): Promise<TemplateMessageSendResult>;
|
|
410
485
|
getMessageTemplate(projectId: string, reference: string, options?: RequestOptions): Promise<MessageTemplateCatalogEntry>;
|
|
486
|
+
/** The template as its author sees it, including the editable draft. */
|
|
487
|
+
getMessageTemplateForAuthoring(projectId: string, reference: string, options?: RequestOptions): Promise<MessageTemplate>;
|
|
488
|
+
/** Every template, drafts and disabled ones included, for authoring. */
|
|
489
|
+
listMessageTemplatesForAuthoring(projectId: string, query?: {
|
|
490
|
+
search?: string;
|
|
491
|
+
category?: string;
|
|
492
|
+
after?: string;
|
|
493
|
+
limit?: number;
|
|
494
|
+
page?: number;
|
|
495
|
+
}, options?: RequestOptions): Promise<Omit<MessageTemplateCatalog, "items"> & {
|
|
496
|
+
readonly items: readonly MessageTemplate[];
|
|
497
|
+
}>;
|
|
498
|
+
createMessageTemplate(projectId: string, request: CreateMessageTemplateRequest, options?: RequestOptions): Promise<MessageTemplate>;
|
|
499
|
+
/** Renames, recategorises, disables or re-enables a template. */
|
|
500
|
+
updateMessageTemplate(projectId: string, templateId: string, request: UpdateMessageTemplateRequest, options?: RequestOptions): Promise<MessageTemplate>;
|
|
501
|
+
/** Replaces the draft. `draftVersion` is the version last read; a newer save refuses this one. */
|
|
502
|
+
saveMessageTemplateDraft(projectId: string, templateId: string, draftVersion: number, definition: Readonly<Record<string, unknown>>, options?: RequestOptions): Promise<MessageTemplate>;
|
|
503
|
+
/** Validates the draft completely and publishes it as the next revision. */
|
|
504
|
+
publishMessageTemplate(projectId: string, templateId: string, draftVersion: number, options?: RequestOptions): Promise<PublishedTemplateRevision>;
|
|
505
|
+
listMessageTemplateRevisions(projectId: string, templateId: string, options?: RequestOptions): Promise<{
|
|
506
|
+
readonly items: readonly PublishedTemplateRevision[];
|
|
507
|
+
}>;
|
|
508
|
+
/** Renders the draft, a revision or an unsaved definition. Nothing is sent. */
|
|
509
|
+
previewMessageTemplate(projectId: string, templateId: string, request: PreviewMessageTemplateRequest, options?: RequestOptions): Promise<MessageTemplatePreview>;
|
|
510
|
+
/** Sends the exact draft to one subscriber as a test. It never publishes. */
|
|
511
|
+
testSendMessageTemplateDraft(projectId: string, environmentId: string, templateId: string, request: DraftTemplateTestSendRequest, options?: SideEffectRequestOptions): Promise<TemplateMessageSendResult>;
|
|
512
|
+
listEmailLayouts(projectId: string, options?: RequestOptions): Promise<{
|
|
513
|
+
readonly items: readonly EmailLayout[];
|
|
514
|
+
}>;
|
|
515
|
+
getEmailLayout(projectId: string, layoutId: string, options?: RequestOptions): Promise<EmailLayout>;
|
|
516
|
+
createEmailLayout(projectId: string, request: {
|
|
517
|
+
readonly name: string;
|
|
518
|
+
readonly definition: Readonly<Record<string, unknown>>;
|
|
519
|
+
}, options?: RequestOptions): Promise<EmailLayout>;
|
|
520
|
+
saveEmailLayoutDraft(projectId: string, layoutId: string, draftVersion: number, definition: Readonly<Record<string, unknown>>, options?: RequestOptions): Promise<EmailLayout>;
|
|
521
|
+
publishEmailLayout(projectId: string, layoutId: string, draftVersion: number, options?: RequestOptions): Promise<PublishedTemplateRevision>;
|
|
522
|
+
/** Makes a published layout the project's default for email templates. */
|
|
523
|
+
setDefaultEmailLayout(projectId: string, layoutId: string, options?: RequestOptions): Promise<{
|
|
524
|
+
readonly default_layout_id: string;
|
|
525
|
+
}>;
|
|
411
526
|
createMessageCategory(projectId: string, request: CreateMessageCategoryRequest, options?: RequestOptions): Promise<MessageCategory>;
|
|
412
527
|
updateMessageCategory(projectId: string, key: string, request: UpdateMessageCategoryRequest, options?: RequestOptions): Promise<MessageCategory>;
|
|
413
528
|
deleteMessageCategory(projectId: string, key: string, options?: RequestOptions): Promise<void>;
|
|
@@ -445,6 +560,18 @@ export declare class WhooshBangClient {
|
|
|
445
560
|
* them, through their recipient session.
|
|
446
561
|
*/
|
|
447
562
|
getSubscriberQuietHours(projectId: string, environmentId: string, subscriberId: string, options?: RequestOptions): Promise<QuietHours>;
|
|
563
|
+
/**
|
|
564
|
+
* One subscriber's digest settings: for each category, the policy in
|
|
565
|
+
* effect, where each setting comes from, what the subscriber may change,
|
|
566
|
+
* their saved choices and your setting for them (FXO-3729).
|
|
567
|
+
*/
|
|
568
|
+
getSubscriberDigestSettings(projectId: string, environmentId: string, subscriberId: string, options?: RequestOptions): Promise<SubscriberDigestSettings>;
|
|
569
|
+
/**
|
|
570
|
+
* Your digest setting for one subscriber and category, and which settings
|
|
571
|
+
* they can't change; `{ setting: null }` removes it. Their own choice is
|
|
572
|
+
* kept and returns when you unlock.
|
|
573
|
+
*/
|
|
574
|
+
setSubscriberDigestSetting(projectId: string, environmentId: string, subscriberId: string, categoryKey: string, request: SetSubscriberDigestSettingRequest, options?: RequestOptions): Promise<SubscriberDigestSettings>;
|
|
448
575
|
transitionSubscriberBinding(projectId: string, environmentId: string, subscriberId: string, bindingId: string, action: "pause" | "resume" | "unsubscribe", options?: RequestOptions): Promise<SubscriberChannelSettings>;
|
|
449
576
|
setSubscriberPreferredBinding(projectId: string, environmentId: string, subscriberId: string, request: SetPreferredBindingRequest, options?: RequestOptions): Promise<SubscriberChannelSettings>;
|
|
450
577
|
acknowledgeEmailRemediation(projectId: string, environmentId: string, connectionId: string, request: AcknowledgeEmailRemediationRequest, options?: RequestOptions): Promise<ChannelConnection>;
|
|
@@ -938,6 +1065,24 @@ export declare class WhooshBangRecipientSessionClient {
|
|
|
938
1065
|
* is not theirs.
|
|
939
1066
|
*/
|
|
940
1067
|
saveQuietHours(request: SaveQuietHoursRequest, options?: RequestOptions): Promise<QuietHours>;
|
|
1068
|
+
/**
|
|
1069
|
+
* This subscriber's digest settings: only the categories whose owner lets
|
|
1070
|
+
* them choose something, with what is in effect and what they can change,
|
|
1071
|
+
* plus their Default (FXO-3729).
|
|
1072
|
+
*/
|
|
1073
|
+
getDigestSettings(options?: RequestOptions): Promise<SubscriberDigestSettings>;
|
|
1074
|
+
/**
|
|
1075
|
+
* Sets this subscriber's Default digest choice, or clears it with
|
|
1076
|
+
* `{ preference: null }`. A setting the owner doesn't offer fails with
|
|
1077
|
+
* `request_invalid` naming it, and the previous setting stays.
|
|
1078
|
+
*/
|
|
1079
|
+
setDefaultDigestPreference(request: SetDigestPreferenceRequest, options?: RequestOptions): Promise<SubscriberDigestSettings>;
|
|
1080
|
+
/**
|
|
1081
|
+
* Sets this subscriber's digest choice for one category, or clears it so
|
|
1082
|
+
* the category follows the Default again. Locked or unoffered settings
|
|
1083
|
+
* fail with `request_invalid` and the previous setting stays.
|
|
1084
|
+
*/
|
|
1085
|
+
setCategoryDigestPreference(categoryKey: string, request: SetDigestPreferenceRequest, options?: RequestOptions): Promise<SubscriberDigestSettings>;
|
|
941
1086
|
/** Turns off this subscriber's quiet hours. */
|
|
942
1087
|
resetQuietHours(options?: RequestOptions): Promise<QuietHours>;
|
|
943
1088
|
transitionBinding(bindingId: string, action: RecipientBindingAction, options?: RequestOptions): Promise<RecipientSession>;
|