@sparkvault/sdk-js 15.16.1 → 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.d.ts CHANGED
@@ -1243,14 +1243,15 @@ interface UpdateVaultUploadOptions {
1243
1243
  /**
1244
1244
  * Every transport the dispatch seam can carry a notification on: what a send's
1245
1245
  * status, a stored ladder and a config read can name. An organization's own
1246
- * send, and its config's ladders, may name four of them:
1246
+ * send, and its config's ladders, may name six of them:
1247
1247
  *
1248
1248
  * | Channel | An organization's send |
1249
1249
  * | --- | --- |
1250
1250
  * | `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) |
1251
1251
  * | `email` | Goes out from your organization's own sender (`getEmailSender`) |
1252
1252
  * | `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 |
1253
- * | `sms`, `voice`, `whatsapp`, `rcs` | Refused 403 `NOTIFY_CHANNEL_NOT_AVAILABLE`: Notify delivers no text, call or chat message |
1253
+ * | `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 |
1254
+ * | `whatsapp`, `rcs` | Refused 403 `NOTIFY_CHANNEL_NOT_AVAILABLE`: Notify delivers no chat message |
1254
1255
  *
1255
1256
  * A send's posts to your organization's own webhook, Slack channel or Teams
1256
1257
  * workflow are no channel: they are its destinations (`NotifyConfig['destinations']`).
@@ -1357,7 +1358,8 @@ interface NotifyDestinationTestResult {
1357
1358
  * - `plaintext`: a short non-confidential body rendered INLINE in the channel
1358
1359
  * payload. Fail-closed — at most 50 recipients, never allowed on a
1359
1360
  * confidential category, and on the inline-capable channels alone, which
1360
- * are all four of an organization's (`in_app`, `email`, `push`, `web_push`).
1361
+ * are all six of an organization's (`in_app`, `email`, `sms`, `push`,
1362
+ * `web_push`, `voice`).
1361
1363
  */
1362
1364
  type NotifyDeliveryMode = 'sealed' | 'plaintext';
1363
1365
  /**
@@ -1402,12 +1404,15 @@ type NotifyPresetName = 'alert' | 'secureMessage' | 'conversation' | 'approval'
1402
1404
  * id (`usr_*`) of an active member of your organization, which also reaches the
1403
1405
  * devices they registered with SparkVault (`push`, `web_push`); `email` is
1404
1406
  * where the email channel delivers and the address a sealed send's recipient
1405
- * proves to open it. A bare string is an email address or one of those
1406
- * SparkVault ids: a bare address is also the address its recipient proves,
1407
- * while a bare id keys the person's inbox row and carries no address to verify.
1408
- * An `id` that is an email address, with no `email` beside it, is that address:
1407
+ * proves to open it. A bare string is an email address, an E.164 phone number
1408
+ * (reached only by `sms` and `voice`), or one of those SparkVault ids: a bare
1409
+ * address is also the address its recipient proves, while a bare id keys the
1410
+ * person's inbox row and carries no address to verify. An `id` that is an email
1411
+ * address, with no `email` beside it, is that address:
1409
1412
  * `{ id: 'pat@example.com' }`, `'pat@example.com'` and
1410
- * `{ email: 'pat@example.com' }` are one recipient, emailed and verified alike.
1413
+ * `{ email: 'pat@example.com' }` are one recipient, emailed and verified alike;
1414
+ * an `id` that is a phone number, with no `phone` beside it, is that phone the
1415
+ * same way.
1411
1416
  *
1412
1417
  * The recipient's key is its `id`, else its `email`, trimmed, with an email
1413
1418
  * address lowercased the way Identity stores it: it names their row in your
@@ -1423,8 +1428,9 @@ type NotifyPresetName = 'alert' | 'secureMessage' | 'conversation' | 'approval'
1423
1428
  * organization (another account's member, one still invited, or no member at
1424
1429
  * all), and any id that only starts as one (`usr_`, `usr_x-1`), which names no
1425
1430
  * member; a recipient with no email address that a phone number would key (a
1426
- * bare number, `{ phone }`, or an `id` that is an E.164 number); on a sealed
1427
- * send, one whose only handle is a phone (`{ id, phone }`); and, on a sealed
1431
+ * bare number, `{ phone }`, or an `id` that is an E.164 number) on a send whose
1432
+ * channels name neither `sms` nor `voice`; on a sealed send, one whose only
1433
+ * handle is a phone (`{ id, phone }`); and, on a sealed
1428
1434
  * send at the default `identifier` level or at `passkey`, one with no address
1429
1435
  * to verify (a bare id, or an `id` alone that is no email address): give it
1430
1436
  * `{ id, email }`, or send at `verificationLevel: 'none'`.
@@ -1443,8 +1449,9 @@ interface NotifyRecipientRef {
1443
1449
  */
1444
1450
  email?: string;
1445
1451
  /**
1446
- * E.164. Notify delivers nothing to a phone, so a recipient that names one
1447
- * also needs an `email`, or, on a plaintext send, an `id`.
1452
+ * E.164. What `sms` and `voice` text and call, once enabled. A recipient
1453
+ * keyed by a phone alone needs a plaintext send whose channels name one of
1454
+ * them; a sealed send also needs an `email`.
1448
1455
  */
1449
1456
  phone?: string;
1450
1457
  }
@@ -1554,11 +1561,12 @@ interface CreateNotifySendOptions {
1554
1561
  policy?: NotifySendPolicy;
1555
1562
  /**
1556
1563
  * Channel ladder override, in escalation order; omit to resolve from the
1557
- * account config per category. An organization's send names its own four
1558
- * channels (see `NotifyChannel`): any other is refused 403, `serviceCode`
1564
+ * account config per category. An organization's send names its own six
1565
+ * channels (see `NotifyChannel`): any other, or `sms` or `voice` before texts
1566
+ * and calls are enabled, is refused 403, `serviceCode`
1559
1567
  * `NOTIFY_CHANNEL_NOT_AVAILABLE`, `details: { field: 'channels', channels }`.
1560
1568
  */
1561
- channels?: Array<'in_app' | 'email' | 'push' | 'web_push'>;
1569
+ channels?: Array<'in_app' | 'email' | 'sms' | 'push' | 'web_push' | 'voice'>;
1562
1570
  escalation?: NotifyEscalation;
1563
1571
  /**
1564
1572
  * Channel-agnostic display title (rides the email subject). Its text-direction
@@ -1718,9 +1726,10 @@ interface MarkNotifyInboxAllResponse {
1718
1726
  * record no decline.
1719
1727
  * - `failed` — the ladder ran its course (or their grant expired, or a hard
1720
1728
  * bounce of their only delivery settled them), every attempt ended, and a
1721
- * channel gave up: it exhausted its retries, or their deferred email could
1722
- * not go within 24 hours of the send. OUR transport gave up; the address may
1723
- * be perfectly good.
1729
+ * channel gave up: it exhausted its retries, their deferred email, text or
1730
+ * call could not go within 24 hours of the send, or a text or call's answer
1731
+ * was lost after the carrier took it (it may have reached them). OUR
1732
+ * transport gave up; the address may be perfectly good.
1724
1733
  * - `suppressed` — taken out of the ladder by a decision, not a fault. Usually
1725
1734
  * the PERSON chose silence (site off, category muted, every offered channel
1726
1735
  * opted out, your site blocked on auth.sv for a sealed send, or the address
@@ -1799,10 +1808,17 @@ interface NotifySendStatusRecipient {
1799
1808
  * and with it a phone number or address the rollup does not otherwise carry.
1800
1809
  */
1801
1810
  channel_outcomes: Partial<Record<NotifyChannel, {
1802
- outcome: 'delivered' | 'skipped' | 'not_implemented' | 'retryable'
1811
+ outcome: 'delivered'
1803
1812
  /**
1804
- * An email step that could not go yet, tried again at `retry_at` for
1805
- * its `reason` — not terminal: a step that cannot go within 24 hours
1813
+ * The channel did not reach them and will not: no address or device
1814
+ * for it, or, for a text or call, `reason` `phone_opted_out`, or a
1815
+ * `phone_` reason it would have waited for until after its next
1816
+ * channel was due. The ladder moves on to its next channel.
1817
+ */
1818
+ | 'skipped' | 'not_implemented' | 'retryable'
1819
+ /**
1820
+ * An email, text or call step that could not go yet, tried again at
1821
+ * `retry_at` for its `reason` — not terminal: a step that cannot go within 24 hours
1806
1822
  * of the send is recorded `failed` instead. Left out once the
1807
1823
  * recipient's record holds a stop its step meets when it wakes (they
1808
1824
  * saw the notification, it was recalled, or their ladder already
@@ -1812,9 +1828,12 @@ interface NotifySendStatusRecipient {
1812
1828
  */
1813
1829
  | 'deferred'
1814
1830
  /**
1815
- * The step exhausted its retries, or was deferred and could not go
1816
- * within 24 hours of the send — terminal, unlike `retryable`. The
1817
- * ladder moves on to its next channel.
1831
+ * The step exhausted its retries, was deferred and could not go
1832
+ * within 24 hours of the send, or was a text, call or email handed
1833
+ * on whose answer was lost (`reason` `possibly_delivered`: it may
1834
+ * have reached the person, so it is never sent again, and a new send
1835
+ * to them could reach them twice) — terminal, unlike `retryable`.
1836
+ * The ladder moves on to its next channel.
1818
1837
  */
1819
1838
  | 'failed'
1820
1839
  /**
@@ -1830,15 +1849,29 @@ interface NotifySendStatusRecipient {
1830
1849
  /** For a `deferred` step, epoch seconds it is tried again; null on every other outcome. */
1831
1850
  retry_at: number | null;
1832
1851
  /**
1833
- * For a `deferred` step, why it waits: the platform's per-second rate or
1834
- * its hourly email lane, your account's hourly email share, the provider
1835
- * refusing for its rate, the provider's sending paused, the platform's
1836
- * own mail domain the email goes out from not verified for sending, or
1837
- * your organization's own sending domain not verified for sending (the
1838
- * step waits while the domain is checked again). Null on every other
1839
- * outcome.
1852
+ * For a `deferred` step, why it waits. An email: the platform's
1853
+ * per-second rate or its hourly email lane, your account's hourly email
1854
+ * share, the provider refusing for its rate, the provider's sending
1855
+ * paused, the platform's own mail domain the email goes out from not
1856
+ * verified for sending, or your organization's own sending domain not
1857
+ * verified for sending (the step waits while the domain is checked
1858
+ * again). A text or call (the `phone_` reasons): your account's hourly
1859
+ * or daily share of texts and calls, the platform's daily budget for
1860
+ * them, the recipient's phone reached too recently or too often this
1861
+ * hour, the provider refusing for its rate, or texts and calls
1862
+ * unavailable for now. For a `skipped` text or call,
1863
+ * `phone_opted_out`: the phone texted STOP to the number every
1864
+ * organization's texts and calls go out from, so nothing went out;
1865
+ * the recipient's other text and call steps are skipped the same way,
1866
+ * the ladder carries on to its other channels, and it is never an
1867
+ * unsubscribe from your organization (texting START to that number
1868
+ * lifts it). For a `skipped` text or call, a `phone_` reason too: it
1869
+ * would have waited for it until after its next channel was due, so
1870
+ * it was passed over and the ladder went on to that channel. For a
1871
+ * `failed` text, call or email, `possibly_delivered`. Null on every
1872
+ * other outcome.
1840
1873
  */
1841
- reason: 'platform_rate' | 'platform_hourly' | 'account_hourly' | 'provider_throttled' | 'sending_paused' | 'sender_identity_unverified' | 'sending_domain_unverified' | null;
1874
+ 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;
1842
1875
  }>>;
1843
1876
  /**
1844
1877
  * At least one channel accepted the notification for this recipient. A
@@ -1856,9 +1889,10 @@ interface NotifySendStatusRecipient {
1856
1889
  undeliverable: boolean;
1857
1890
  /**
1858
1891
  * Every attempt is terminal, nothing delivered, and at least one channel's
1859
- * outcome is `failed`: it exhausted its retries, or was deferred and could
1860
- * not go within 24 hours of the send — a transport problem on our side, not
1861
- * an address that cannot receive. A transport fact about the attempts so
1892
+ * outcome is `failed`: it exhausted its retries, was deferred and could not
1893
+ * go within 24 hours of the send, or was a text or call whose answer was
1894
+ * lost — a transport problem on our side, not an address that cannot
1895
+ * receive. A transport fact about the attempts so
1862
1896
  * far, like `undeliverable`.
1863
1897
  */
1864
1898
  failed: boolean;
@@ -1870,7 +1904,7 @@ interface NotifySendStatusCounts {
1870
1904
  read: number;
1871
1905
  archived: number;
1872
1906
  /**
1873
- * Recipients with a deferred email step, whatever their `state`: one no
1907
+ * Recipients with a deferred email, text or call step, whatever their `state`: one no
1874
1908
  * other channel reached reads `pending` until the step runs, and one
1875
1909
  * another channel already reached reads `delivered` while it waits. A wait
1876
1910
  * is not counted once the recipient's record holds a stop its step meets
@@ -2232,9 +2266,10 @@ interface NotifyConfigDelivery {
2232
2266
  escalation_enabled?: boolean;
2233
2267
  }
2234
2268
  /**
2235
- * `delivery` as a patch writes it. Its ladders name an organization's own four
2236
- * channels, `in_app`, `email`, `push` and `web_push` (see `NotifyChannel`): any
2237
- * other is refused 403, `serviceCode` `NOTIFY_CHANNEL_NOT_AVAILABLE`,
2269
+ * `delivery` as a patch writes it. Its ladders name an organization's own six
2270
+ * channels, `in_app`, `email`, `sms`, `push`, `web_push` and `voice` (see
2271
+ * `NotifyChannel`): any other, or `sms` or `voice` before texts and calls are
2272
+ * enabled, is refused 403, `serviceCode` `NOTIFY_CHANNEL_NOT_AVAILABLE`,
2238
2273
  * `details.field` naming the ladder's field (and `details.category` the
2239
2274
  * category, for a category's ladder in `channel_priority`), and nothing is
2240
2275
  * stored.
package/dist/index.mjs CHANGED
@@ -11500,6 +11500,19 @@ const NOTIFY_SEND_ID_MAX_LENGTH = 128;
11500
11500
  */
11501
11501
  const NOTIFY_DESTINATION_KINDS = Object.freeze(['webhook', 'slack', 'teams']);
11502
11502
 
11503
+ /**
11504
+ * Why a destination's post FAILED: the `reason` a send status reports beside
11505
+ * that state.
11506
+ *
11507
+ * - POSSIBLY_DELIVERED: the post was sent and its answer was lost, so it may
11508
+ * have landed; it is never tried again, since that could post it twice.
11509
+ * - ATTEMPTS_EXHAUSTED: every attempt met a fault that may clear, and none was left.
11510
+ */
11511
+ const NOTIFY_DESTINATION_FAILURE_REASON = Object.freeze({
11512
+ POSSIBLY_DELIVERED: 'possibly_delivered',
11513
+ ATTEMPTS_EXHAUSTED: 'attempts_exhausted'
11514
+ });
11515
+
11503
11516
  /**
11504
11517
  * The Notify category a help desk's alerts to its own staff are classified
11505
11518
  * as: a new request in a team's queue, a customer's message, an assignment, a
@@ -11524,6 +11537,30 @@ const NOTIFY_INBOX_MARK_STATES = Object.freeze(['seen', 'read', 'archived']);
11524
11537
  */
11525
11538
  const NOTIFY_INBOX_BULK_MARK_STATES = Object.freeze(['seen', 'read']);
11526
11539
 
11540
+ /**
11541
+ * Why a channel step ended without reaching the person, beside its outcome:
11542
+ * the `reason` a send status reports on a `skipped` or `failed` entry of a
11543
+ * recipient's `channel_outcomes`. A closed set: every other skip or failure
11544
+ * reports no reason, but for a text or call passed over for the wait it would
11545
+ * have had (`skipped`, with its NOTIFY_PHONE_DEFERRAL_REASON).
11546
+ *
11547
+ * - PHONE_OPTED_OUT (`skipped`): the phone is on the opt-out list of
11548
+ * SparkVault's notification number, which every organization's texts and
11549
+ * calls go out from: its holder texted STOP to it. Nothing went out, the
11550
+ * recipient's other text or call steps on that phone are skipped the same
11551
+ * way, and their ladder carries on to its other channels: the list is the
11552
+ * number's, shared by every organization, so it is never read as an
11553
+ * unsubscribe from this one. Texting START or UNSTOP to the number takes the
11554
+ * phone off it.
11555
+ * - POSSIBLY_DELIVERED (`failed`): a text, call or email was handed on and
11556
+ * its answer was lost, so it may have reached the person. It is never sent
11557
+ * again, and a send to that recipient again could reach them twice.
11558
+ */
11559
+ Object.freeze({
11560
+ PHONE_OPTED_OUT: 'phone_opted_out',
11561
+ POSSIBLY_DELIVERED: NOTIFY_DESTINATION_FAILURE_REASON.POSSIBLY_DELIVERED
11562
+ });
11563
+
11527
11564
  /**
11528
11565
  * The five secure-by-default preset bundles, in the send API's vocabulary.
11529
11566
  *
@@ -27101,7 +27138,7 @@ class SparkVault {
27101
27138
  }
27102
27139
  /** Get the SDK version */
27103
27140
  static get version() {
27104
- return '15.16.1';
27141
+ return '15.17.0';
27105
27142
  }
27106
27143
  }
27107
27144
  if (typeof window !== 'undefined') {