@sparkvault/sdk-js 15.16.0 → 15.17.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/index.cjs +46 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +74 -39
- package/dist/index.mjs +46 -6
- package/dist/index.mjs.map +1 -1
- package/dist/products/notify/types.d.ts +74 -39
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
|
@@ -22,14 +22,15 @@ import type { UnsealedVault } from '../../vaults/types';
|
|
|
22
22
|
/**
|
|
23
23
|
* Every transport the dispatch seam can carry a notification on: what a send's
|
|
24
24
|
* status, a stored ladder and a config read can name. An organization's own
|
|
25
|
-
* send, and its config's ladders, may name
|
|
25
|
+
* send, and its config's ladders, may name six of them:
|
|
26
26
|
*
|
|
27
27
|
* | Channel | An organization's send |
|
|
28
28
|
* | --- | --- |
|
|
29
29
|
* | `in_app` | Delivered by the notification's row in your Notify inbox, which your app reads through `getInbox`: the inbox lists a recipient's row when their `in_app` step runs, at once when it leads the ladder and only when that step comes due when it follows `email` (a stop that ends the ladder first, such as an unsubscribe on a non-critical send or a recall, leaves it unlisted), so a send naming `email` alone lists nothing there, and neither does one to a recipient who switched In-app off for your site on auth.sv (any send but a `security` one, which crosses that switch) |
|
|
30
30
|
* | `email` | Goes out from your organization's own sender (`getEmailSender`) |
|
|
31
31
|
* | `push`, `web_push` | Reach the devices an active member of your organization, addressed by their SparkVault user id (`usr_*`), registered with SparkVault (its phone app and browser push), titled with your organization's name first; dropped from the ladder of a recipient with none |
|
|
32
|
-
* | `sms`, `voice
|
|
32
|
+
* | `sms`, `voice` | Text and call the recipient's `phone`, once texts and calls are enabled (until then refused 403 `NOTIFY_CHANNEL_NOT_AVAILABLE`): only a phone registered with SparkVault, which a SparkVault Identity holds, in the United States for a text and the United States or Canada for a call, and never one the person switched texts or calls off for on your site, whatever the category. A text opens with your organization's name and carries a plaintext send's title and body, or a sealed send's title, instructions and link; a call speaks the same words without the link. Each is funded from your usage credits when it goes out (a text by the segment, a call by the call); dropped from the ladder of a recipient with no phone |
|
|
33
|
+
* | `whatsapp`, `rcs` | Refused 403 `NOTIFY_CHANNEL_NOT_AVAILABLE`: Notify delivers no chat message |
|
|
33
34
|
*
|
|
34
35
|
* A send's posts to your organization's own webhook, Slack channel or Teams
|
|
35
36
|
* workflow are no channel: they are its destinations (`NotifyConfig['destinations']`).
|
|
@@ -136,7 +137,8 @@ export interface NotifyDestinationTestResult {
|
|
|
136
137
|
* - `plaintext`: a short non-confidential body rendered INLINE in the channel
|
|
137
138
|
* payload. Fail-closed — at most 50 recipients, never allowed on a
|
|
138
139
|
* confidential category, and on the inline-capable channels alone, which
|
|
139
|
-
* are all
|
|
140
|
+
* are all six of an organization's (`in_app`, `email`, `sms`, `push`,
|
|
141
|
+
* `web_push`, `voice`).
|
|
140
142
|
*/
|
|
141
143
|
export type NotifyDeliveryMode = 'sealed' | 'plaintext';
|
|
142
144
|
/**
|
|
@@ -181,12 +183,15 @@ export type NotifyPresetName = 'alert' | 'secureMessage' | 'conversation' | 'app
|
|
|
181
183
|
* id (`usr_*`) of an active member of your organization, which also reaches the
|
|
182
184
|
* devices they registered with SparkVault (`push`, `web_push`); `email` is
|
|
183
185
|
* where the email channel delivers and the address a sealed send's recipient
|
|
184
|
-
* proves to open it. A bare string is an email address
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
186
|
+
* proves to open it. A bare string is an email address, an E.164 phone number
|
|
187
|
+
* (reached only by `sms` and `voice`), or one of those SparkVault ids: a bare
|
|
188
|
+
* address is also the address its recipient proves, while a bare id keys the
|
|
189
|
+
* person's inbox row and carries no address to verify. An `id` that is an email
|
|
190
|
+
* address, with no `email` beside it, is that address:
|
|
188
191
|
* `{ id: 'pat@example.com' }`, `'pat@example.com'` and
|
|
189
|
-
* `{ email: 'pat@example.com' }` are one recipient, emailed and verified alike
|
|
192
|
+
* `{ email: 'pat@example.com' }` are one recipient, emailed and verified alike;
|
|
193
|
+
* an `id` that is a phone number, with no `phone` beside it, is that phone the
|
|
194
|
+
* same way.
|
|
190
195
|
*
|
|
191
196
|
* The recipient's key is its `id`, else its `email`, trimmed, with an email
|
|
192
197
|
* address lowercased the way Identity stores it: it names their row in your
|
|
@@ -202,8 +207,9 @@ export type NotifyPresetName = 'alert' | 'secureMessage' | 'conversation' | 'app
|
|
|
202
207
|
* organization (another account's member, one still invited, or no member at
|
|
203
208
|
* all), and any id that only starts as one (`usr_`, `usr_x-1`), which names no
|
|
204
209
|
* member; a recipient with no email address that a phone number would key (a
|
|
205
|
-
* bare number, `{ phone }`, or an `id` that is an E.164 number)
|
|
206
|
-
*
|
|
210
|
+
* bare number, `{ phone }`, or an `id` that is an E.164 number) on a send whose
|
|
211
|
+
* channels name neither `sms` nor `voice`; on a sealed send, one whose only
|
|
212
|
+
* handle is a phone (`{ id, phone }`); and, on a sealed
|
|
207
213
|
* send at the default `identifier` level or at `passkey`, one with no address
|
|
208
214
|
* to verify (a bare id, or an `id` alone that is no email address): give it
|
|
209
215
|
* `{ id, email }`, or send at `verificationLevel: 'none'`.
|
|
@@ -222,8 +228,9 @@ export interface NotifyRecipientRef {
|
|
|
222
228
|
*/
|
|
223
229
|
email?: string;
|
|
224
230
|
/**
|
|
225
|
-
* E.164.
|
|
226
|
-
*
|
|
231
|
+
* E.164. What `sms` and `voice` text and call, once enabled. A recipient
|
|
232
|
+
* keyed by a phone alone needs a plaintext send whose channels name one of
|
|
233
|
+
* them; a sealed send also needs an `email`.
|
|
227
234
|
*/
|
|
228
235
|
phone?: string;
|
|
229
236
|
}
|
|
@@ -333,11 +340,12 @@ export interface CreateNotifySendOptions {
|
|
|
333
340
|
policy?: NotifySendPolicy;
|
|
334
341
|
/**
|
|
335
342
|
* Channel ladder override, in escalation order; omit to resolve from the
|
|
336
|
-
* account config per category. An organization's send names its own
|
|
337
|
-
* channels (see `NotifyChannel`): any other
|
|
343
|
+
* account config per category. An organization's send names its own six
|
|
344
|
+
* channels (see `NotifyChannel`): any other, or `sms` or `voice` before texts
|
|
345
|
+
* and calls are enabled, is refused 403, `serviceCode`
|
|
338
346
|
* `NOTIFY_CHANNEL_NOT_AVAILABLE`, `details: { field: 'channels', channels }`.
|
|
339
347
|
*/
|
|
340
|
-
channels?: Array<'in_app' | 'email' | 'push' | 'web_push'>;
|
|
348
|
+
channels?: Array<'in_app' | 'email' | 'sms' | 'push' | 'web_push' | 'voice'>;
|
|
341
349
|
escalation?: NotifyEscalation;
|
|
342
350
|
/**
|
|
343
351
|
* Channel-agnostic display title (rides the email subject). Its text-direction
|
|
@@ -497,9 +505,10 @@ export interface MarkNotifyInboxAllResponse {
|
|
|
497
505
|
* record no decline.
|
|
498
506
|
* - `failed` — the ladder ran its course (or their grant expired, or a hard
|
|
499
507
|
* bounce of their only delivery settled them), every attempt ended, and a
|
|
500
|
-
* channel gave up: it exhausted its retries,
|
|
501
|
-
* not go within 24 hours of the send
|
|
502
|
-
*
|
|
508
|
+
* channel gave up: it exhausted its retries, their deferred email, text or
|
|
509
|
+
* call could not go within 24 hours of the send, or a text or call's answer
|
|
510
|
+
* was lost after the carrier took it (it may have reached them). OUR
|
|
511
|
+
* transport gave up; the address may be perfectly good.
|
|
503
512
|
* - `suppressed` — taken out of the ladder by a decision, not a fault. Usually
|
|
504
513
|
* the PERSON chose silence (site off, category muted, every offered channel
|
|
505
514
|
* opted out, your site blocked on auth.sv for a sealed send, or the address
|
|
@@ -578,10 +587,17 @@ export interface NotifySendStatusRecipient {
|
|
|
578
587
|
* and with it a phone number or address the rollup does not otherwise carry.
|
|
579
588
|
*/
|
|
580
589
|
channel_outcomes: Partial<Record<NotifyChannel, {
|
|
581
|
-
outcome: 'delivered'
|
|
590
|
+
outcome: 'delivered'
|
|
582
591
|
/**
|
|
583
|
-
*
|
|
584
|
-
*
|
|
592
|
+
* The channel did not reach them and will not: no address or device
|
|
593
|
+
* for it, or, for a text or call, `reason` `phone_opted_out`, or a
|
|
594
|
+
* `phone_` reason it would have waited for until after its next
|
|
595
|
+
* channel was due. The ladder moves on to its next channel.
|
|
596
|
+
*/
|
|
597
|
+
| 'skipped' | 'not_implemented' | 'retryable'
|
|
598
|
+
/**
|
|
599
|
+
* An email, text or call step that could not go yet, tried again at
|
|
600
|
+
* `retry_at` for its `reason` — not terminal: a step that cannot go within 24 hours
|
|
585
601
|
* of the send is recorded `failed` instead. Left out once the
|
|
586
602
|
* recipient's record holds a stop its step meets when it wakes (they
|
|
587
603
|
* saw the notification, it was recalled, or their ladder already
|
|
@@ -591,9 +607,12 @@ export interface NotifySendStatusRecipient {
|
|
|
591
607
|
*/
|
|
592
608
|
| 'deferred'
|
|
593
609
|
/**
|
|
594
|
-
* The step exhausted its retries,
|
|
595
|
-
* within 24 hours of the send
|
|
596
|
-
*
|
|
610
|
+
* The step exhausted its retries, was deferred and could not go
|
|
611
|
+
* within 24 hours of the send, or was a text, call or email handed
|
|
612
|
+
* on whose answer was lost (`reason` `possibly_delivered`: it may
|
|
613
|
+
* have reached the person, so it is never sent again, and a new send
|
|
614
|
+
* to them could reach them twice) — terminal, unlike `retryable`.
|
|
615
|
+
* The ladder moves on to its next channel.
|
|
597
616
|
*/
|
|
598
617
|
| 'failed'
|
|
599
618
|
/**
|
|
@@ -609,15 +628,29 @@ export interface NotifySendStatusRecipient {
|
|
|
609
628
|
/** For a `deferred` step, epoch seconds it is tried again; null on every other outcome. */
|
|
610
629
|
retry_at: number | null;
|
|
611
630
|
/**
|
|
612
|
-
* For a `deferred` step, why it waits: the platform's
|
|
613
|
-
* its hourly email lane, your account's hourly email
|
|
614
|
-
* refusing for its rate, the provider's sending
|
|
615
|
-
* own mail domain the email goes out from not
|
|
616
|
-
* your organization's own sending domain not
|
|
617
|
-
* step waits while the domain is checked
|
|
618
|
-
*
|
|
631
|
+
* For a `deferred` step, why it waits. An email: the platform's
|
|
632
|
+
* per-second rate or its hourly email lane, your account's hourly email
|
|
633
|
+
* share, the provider refusing for its rate, the provider's sending
|
|
634
|
+
* paused, the platform's own mail domain the email goes out from not
|
|
635
|
+
* verified for sending, or your organization's own sending domain not
|
|
636
|
+
* verified for sending (the step waits while the domain is checked
|
|
637
|
+
* again). A text or call (the `phone_` reasons): your account's hourly
|
|
638
|
+
* or daily share of texts and calls, the platform's daily budget for
|
|
639
|
+
* them, the recipient's phone reached too recently or too often this
|
|
640
|
+
* hour, the provider refusing for its rate, or texts and calls
|
|
641
|
+
* unavailable for now. For a `skipped` text or call,
|
|
642
|
+
* `phone_opted_out`: the phone texted STOP to the number every
|
|
643
|
+
* organization's texts and calls go out from, so nothing went out;
|
|
644
|
+
* the recipient's other text and call steps are skipped the same way,
|
|
645
|
+
* the ladder carries on to its other channels, and it is never an
|
|
646
|
+
* unsubscribe from your organization (texting START to that number
|
|
647
|
+
* lifts it). For a `skipped` text or call, a `phone_` reason too: it
|
|
648
|
+
* would have waited for it until after its next channel was due, so
|
|
649
|
+
* it was passed over and the ladder went on to that channel. For a
|
|
650
|
+
* `failed` text, call or email, `possibly_delivered`. Null on every
|
|
651
|
+
* other outcome.
|
|
619
652
|
*/
|
|
620
|
-
reason: 'platform_rate' | 'platform_hourly' | 'account_hourly' | 'provider_throttled' | 'sending_paused' | 'sender_identity_unverified' | 'sending_domain_unverified' | null;
|
|
653
|
+
reason: 'platform_rate' | 'platform_hourly' | 'account_hourly' | 'provider_throttled' | 'sending_paused' | 'sender_identity_unverified' | 'sending_domain_unverified' | 'phone_account_rate' | 'phone_platform_budget' | 'phone_destination_rate' | 'phone_provider_throttled' | 'phone_unavailable' | 'phone_opted_out' | 'possibly_delivered' | null;
|
|
621
654
|
}>>;
|
|
622
655
|
/**
|
|
623
656
|
* At least one channel accepted the notification for this recipient. A
|
|
@@ -635,9 +668,10 @@ export interface NotifySendStatusRecipient {
|
|
|
635
668
|
undeliverable: boolean;
|
|
636
669
|
/**
|
|
637
670
|
* Every attempt is terminal, nothing delivered, and at least one channel's
|
|
638
|
-
* outcome is `failed`: it exhausted its retries,
|
|
639
|
-
*
|
|
640
|
-
*
|
|
671
|
+
* outcome is `failed`: it exhausted its retries, was deferred and could not
|
|
672
|
+
* go within 24 hours of the send, or was a text or call whose answer was
|
|
673
|
+
* lost — a transport problem on our side, not an address that cannot
|
|
674
|
+
* receive. A transport fact about the attempts so
|
|
641
675
|
* far, like `undeliverable`.
|
|
642
676
|
*/
|
|
643
677
|
failed: boolean;
|
|
@@ -649,7 +683,7 @@ export interface NotifySendStatusCounts {
|
|
|
649
683
|
read: number;
|
|
650
684
|
archived: number;
|
|
651
685
|
/**
|
|
652
|
-
* Recipients with a deferred email step, whatever their `state`: one no
|
|
686
|
+
* Recipients with a deferred email, text or call step, whatever their `state`: one no
|
|
653
687
|
* other channel reached reads `pending` until the step runs, and one
|
|
654
688
|
* another channel already reached reads `delivered` while it waits. A wait
|
|
655
689
|
* is not counted once the recipient's record holds a stop its step meets
|
|
@@ -1011,9 +1045,10 @@ export interface NotifyConfigDelivery {
|
|
|
1011
1045
|
escalation_enabled?: boolean;
|
|
1012
1046
|
}
|
|
1013
1047
|
/**
|
|
1014
|
-
* `delivery` as a patch writes it. Its ladders name an organization's own
|
|
1015
|
-
* channels, `in_app`, `email`, `push` and `
|
|
1016
|
-
* other
|
|
1048
|
+
* `delivery` as a patch writes it. Its ladders name an organization's own six
|
|
1049
|
+
* channels, `in_app`, `email`, `sms`, `push`, `web_push` and `voice` (see
|
|
1050
|
+
* `NotifyChannel`): any other, or `sms` or `voice` before texts and calls are
|
|
1051
|
+
* enabled, is refused 403, `serviceCode` `NOTIFY_CHANNEL_NOT_AVAILABLE`,
|
|
1017
1052
|
* `details.field` naming the ladder's field (and `details.category` the
|
|
1018
1053
|
* category, for a category's ladder in `channel_priority`), and nothing is
|
|
1019
1054
|
* stored.
|