@sparkvault/sdk-js 17.0.1 → 17.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +3 -3
  2. package/dist/api-base.d.ts +2 -2
  3. package/dist/config.d.ts +1 -1
  4. package/dist/entropy/index.d.ts +2 -2
  5. package/dist/entropy/types.d.ts +1 -1
  6. package/dist/errors.d.ts +3 -3
  7. package/dist/http.d.ts +1 -1
  8. package/dist/index.cjs +197 -189
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.ts +150 -150
  11. package/dist/index.mjs +197 -189
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/ingots/index.d.ts +10 -10
  14. package/dist/ingots/types.d.ts +3 -3
  15. package/dist/notify/index.d.ts +8 -8
  16. package/dist/notify/types.d.ts +10 -10
  17. package/dist/products/identity/api.d.ts +5 -5
  18. package/dist/products/identity/dialog-launcher.d.ts +2 -2
  19. package/dist/products/identity/handlers/otp-handler.d.ts +1 -1
  20. package/dist/products/identity/handlers/passkey-handler.d.ts +4 -4
  21. package/dist/products/identity/index.d.ts +11 -11
  22. package/dist/products/identity/renderer.d.ts +10 -10
  23. package/dist/products/identity/types.d.ts +10 -10
  24. package/dist/products/identity/utils.d.ts +3 -3
  25. package/dist/products/identity/views/backup-verify.d.ts +3 -3
  26. package/dist/products/identity/views/error.d.ts +1 -1
  27. package/dist/products/identity/views/identity-input.d.ts +1 -1
  28. package/dist/products/identity/views/method-select.d.ts +1 -1
  29. package/dist/products/identity/views/origin-not-allowed.d.ts +2 -2
  30. package/dist/products/identity/views/passkey-auto.d.ts +1 -1
  31. package/dist/products/identity/views/product-not-configured.d.ts +2 -2
  32. package/dist/products/identity/views/service-unavailable.d.ts +1 -1
  33. package/dist/products/index.d.ts +1 -1
  34. package/dist/products/notify/index.d.ts +21 -21
  35. package/dist/products/notify/types.d.ts +65 -65
  36. package/dist/products/structured-ingots/types.d.ts +2 -2
  37. package/dist/sparks/index.d.ts +1 -1
  38. package/dist/sparkvault.js +1 -1
  39. package/dist/sparkvault.js.map +1 -1
  40. package/dist/utils/dom.d.ts +3 -3
  41. package/dist/vaults/index.d.ts +2 -2
  42. package/dist/vaults/types.d.ts +2 -2
  43. package/dist/vaults/upload/api.d.ts +14 -14
  44. package/dist/vaults/upload/renderer.d.ts +1 -1
  45. package/dist/vaults/upload/styles.d.ts +1 -1
  46. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -92,7 +92,7 @@ function givenUpUploadId({ created, uploadId }) {
92
92
  * The codes Core's activation refuses an upload with, which Forge's refusal
93
93
  * map reads (the status is Core's):
94
94
  * - UPLOAD_CONTRACT_MISMATCH (409): a finalize or session from another
95
- * publication contract than Core's, a mixed deployment that converges — the
95
+ * publication contract than Core's, a mixed deployment that converges, so the
96
96
  * upload is kept and its finalize tried again.
97
97
  * - UPLOAD_PROTOCOL_RETIRED (410): a session from a contract Core no longer
98
98
  * publishes, which never can be.
@@ -838,7 +838,7 @@ class ValidationError extends SparkVaultError {
838
838
  }
839
839
  }
840
840
  /**
841
- * Plan required gate (402 PLAN_REQUIRED) — the account has no active
841
+ * Plan required gate (402 PLAN_REQUIRED): the account has no active
842
842
  * subscription and attempted a billable/create action. Surface a subscribe CTA
843
843
  * to admins, or "ask your account admin" to members.
844
844
  */
@@ -869,7 +869,7 @@ class UsageCreditFundingReviewError extends SparkVaultError {
869
869
  }
870
870
  }
871
871
  /**
872
- * Quota exceeded gate (402 QUOTA_EXCEEDED) — a pooled-capacity limit is
872
+ * Quota exceeded gate (402 QUOTA_EXCEEDED): a pooled-capacity limit is
873
873
  * exhausted. `resource` identifies which pool so callers can point the CTA at
874
874
  * the right capacity block.
875
875
  */
@@ -885,7 +885,7 @@ class QuotaExceededError extends SparkVaultError {
885
885
  }
886
886
  /**
887
887
  * Notify subscription gate (403 NOTIFY_SUBSCRIPTION_REQUIRED or
888
- * NOTIFY_PROJECT_SUBSCRIPTION_REQUIRED) — the account or selected project
888
+ * NOTIFY_PROJECT_SUBSCRIPTION_REQUIRED): the account or selected project
889
889
  * does not hold Notify and attempted a send that names no accepted send's
890
890
  * `sendId` (a replay of an accepted send, the same request under its `sendId`,
891
891
  * is answered with the stored send), or a config save that selects a new
@@ -1153,8 +1153,8 @@ const SPARKVAULT_FILES_HOST = 'files.sv';
1153
1153
  /**
1154
1154
  * The help-desk domain: each organization's help desk lives at a host under
1155
1155
  * it, and every custom help-desk domain points its CNAME at it. The whole
1156
- * subtree is reserved — no organization claims a name in it as its own
1157
- * domain — but none of its hosts is owned: a tenant's help-desk host is never
1156
+ * subtree is reserved (no organization claims a name in it as its own
1157
+ * domain), but none of its hosts is owned: a tenant's help-desk host is never
1158
1158
  * trusted the way a platform host is (isSparkVaultOwnedHostname).
1159
1159
  */
1160
1160
  const SPARKVAULT_HELP_DESK_DOMAIN = 'help.sv';
@@ -1374,7 +1374,7 @@ class SparkVaultApi {
1374
1374
  constructor(timeoutMs = DEFAULT_TIMEOUT_MS$1) {
1375
1375
  /**
1376
1376
  * Abort controller for the current session. Replaced by resetSession()
1377
- * at the start of every user-facing session — an aborted controller can
1377
+ * at the start of every user-facing session, so an aborted controller can
1378
1378
  * never leak into the next session.
1379
1379
  */
1380
1380
  this.closeController = new AbortController();
@@ -1388,7 +1388,7 @@ class SparkVaultApi {
1388
1388
  isAborted() {
1389
1389
  return this.closeController.signal.aborted;
1390
1390
  }
1391
- /** The current session's abort signal — for callers that need to wire it into XHR/etc. */
1391
+ /** The current session's abort signal, for callers that need to wire it into XHR/etc. */
1392
1392
  getAbortSignal() {
1393
1393
  return this.closeController.signal;
1394
1394
  }
@@ -1438,7 +1438,7 @@ class SparkVaultApi {
1438
1438
  * transport shares.
1439
1439
  */
1440
1440
  rawRequest(url, options) {
1441
- // Only send Content-Type when there's actually a body — otherwise GETs
1441
+ // Only send Content-Type when there's actually a body; otherwise GETs
1442
1442
  // with no payload would carry a misleading content-type header.
1443
1443
  const headers = { Accept: 'application/json' };
1444
1444
  if (options.body !== undefined)
@@ -1669,7 +1669,7 @@ class HttpClient {
1669
1669
  * and every other answer is the base error under the service's own code.
1670
1670
  * Each carries the service's code (`serviceCode`), which tells apart two
1671
1671
  * refusals that share a typed class's `code`, and the answer's `Retry-After`
1672
- * (`retryAfterMs`), the floor for whoever retries it — the SDK's own
1672
+ * (`retryAfterMs`), the floor for whoever retries it: the SDK's own
1673
1673
  * transfers when the answer is a download link's mint, and the host page
1674
1674
  * otherwise.
1675
1675
  */
@@ -1695,7 +1695,7 @@ class HttpClient {
1695
1695
  case 403:
1696
1696
  // A Notify send, or a config save selecting a new sending domain, refused
1697
1697
  // because the account does not hold Notify is a billing gate, not a
1698
- // credential problem — give it its own catchable type.
1698
+ // credential problem; give it its own catchable type.
1699
1699
  if (code === 'NOTIFY_SUBSCRIPTION_REQUIRED' || code === 'NOTIFY_PROJECT_SUBSCRIPTION_REQUIRED') {
1700
1700
  return new NotifySubscriptionRequiredError(message, details, retryAfterMs, code);
1701
1701
  }
@@ -2709,9 +2709,9 @@ function identityTypesParam(types) {
2709
2709
  return types ? { [SIGNIN_IDENTITY_TYPES.param]: formatSigninIdentityTypes(types) } : {};
2710
2710
  }
2711
2711
  /**
2712
- * This page as a navigation return target: origin, path, and query — the query
2713
- * carries the page's own state (app routing, or the sign-in page's validated
2714
- * destination) — without the fragment, which is the channel a result returns
2712
+ * This page as a navigation return target: origin, path, and query (the query
2713
+ * carries the page's own state, whether app routing or the sign-in page's validated
2714
+ * destination), without the fragment, which is the channel a result returns
2715
2715
  * in.
2716
2716
  */
2717
2717
  function currentPageReturnUrl() {
@@ -2924,7 +2924,7 @@ class IdentityApi extends SparkVaultApi {
2924
2924
  }
2925
2925
  /**
2926
2926
  * Check whether the SVID resolved from an email or phone has registered
2927
- * passkeys (`has_passkey`; cross-tenant — single global RP), for a
2927
+ * passkeys (`has_passkey`; cross-tenant, single global RP), for a
2928
2928
  * verification that admits passkeys.
2929
2929
  */
2930
2930
  async checkPasskey(identity, identityType = 'email', authContext) {
@@ -2933,7 +2933,7 @@ class IdentityApi extends SparkVaultApi {
2933
2933
  }
2934
2934
  /**
2935
2935
  * Redeem a one-time sign-in code (with its PKCE verifier) for the sign-in
2936
- * result — the shared return leg for `flow: 'redirect'` and the silent SSO
2936
+ * result: the shared return leg for `flow: 'redirect'` and the silent SSO
2937
2937
  * self-heal. The code arrives in the URL fragment after the hosted page
2938
2938
  * navigates back; it is single-use, 60s-lived, and bound to this page's
2939
2939
  * origin server-side.
@@ -3069,7 +3069,7 @@ class IdentityApi extends SparkVaultApi {
3069
3069
  }
3070
3070
  /**
3071
3071
  * Skip a post-login recommendation, suppressing it server-side for 30 days.
3072
- * Authorized by the login's verification token. Best-effort — a failure here
3072
+ * Authorized by the login's verification token. Best-effort: a failure here
3073
3073
  * must not block completing the login.
3074
3074
  */
3075
3075
  async dismissRecommendation(params) {
@@ -3144,7 +3144,7 @@ class IdentityApi extends SparkVaultApi {
3144
3144
  });
3145
3145
  }
3146
3146
  /**
3147
- * Claim the SparkLink click's result by kindling — the WebSocket-loss
3147
+ * Claim the SparkLink click's result by kindling, the WebSocket-loss
3148
3148
  * fallback. The SDK calls this when its socket was suspended with the tab and
3149
3149
  * it refocuses. Returns what the click produced (a completed login, or its
3150
3150
  * second-factor challenge), or null while still pending (not yet clicked) or
@@ -3180,7 +3180,7 @@ function signinRefParam(signinRef) {
3180
3180
  * Read a SparkLink result event. The WebSocket push and the kindling reclaim
3181
3181
  * carry the same server-built event, so this is the one reader for both.
3182
3182
  * Returns null for anything that is not a usable result: a still-pending
3183
- * reclaim, or an event missing what its type requires — a challenge without a
3183
+ * reclaim, or an event missing what its type requires, such as a challenge without a
3184
3184
  * ticket, or a completed login with neither a token (default flow) nor the
3185
3185
  * redirect that continues it (OIDC hosted login).
3186
3186
  */
@@ -3270,7 +3270,7 @@ class IdentityApiError extends SparkVaultError {
3270
3270
  * script, and the invisible formatting marks a contacts app wraps a number in.
3271
3271
  * The separators and marks are dropped. Anything else is refused, never
3272
3272
  * dropped: stripping it would fold part of the text into the number and deliver
3273
- * to someone else's line — a letter or a dial-control character (',' and ';'
3273
+ * to someone else's line. A letter or a dial-control character (',' and ';'
3274
3274
  * pause, '#' and '*' are keypad tones) carries an extension ("x2", ",89"), a
3275
3275
  * digit of another script ('٧', '7') is a digit the ASCII read would silently
3276
3276
  * lose, and a '+' after a digit declares nothing.
@@ -3284,7 +3284,7 @@ class IdentityApiError extends SparkVaultError {
3284
3284
  /** A '+' before any digit: the caller declared the country code. */
3285
3285
  const DECLARED_COUNTRY_CODE = /^\D*\+/;
3286
3286
 
3287
- /** E.164 digits once a country code is declared: 8–15, never a leading 0. */
3287
+ /** E.164 digits once a country code is declared: 8 to 15, never a leading 0. */
3288
3288
  const E164_DIGITS = /^[1-9]\d{7,14}$/;
3289
3289
 
3290
3290
  /** Invisible formatting marks (bidi embeddings, zero-width characters), in any number. */
@@ -3773,12 +3773,12 @@ class VerificationState {
3773
3773
  * abandoned-window backstop, and a `window.closed` poll that surfaces a manual
3774
3774
  * close as a cancellation.
3775
3775
  */
3776
- /** Default popup dimensions — a centered login/ceremony window. */
3776
+ /** Default popup dimensions: a centered login/ceremony window. */
3777
3777
  const DEFAULT_WIDTH = 480;
3778
3778
  const DEFAULT_HEIGHT = 640;
3779
3779
  /**
3780
3780
  * Default timeout for popup operations: 30 minutes. This is an
3781
- * abandoned-window backstop — never a liveness gate. A person mid-login is
3781
+ * abandoned-window backstop, never a liveness gate. A person mid-login is
3782
3782
  * often slow for legitimate reasons (waiting out an OTP resend backoff,
3783
3783
  * fetching their phone for a cross-device passkey, hunting for an alternative
3784
3784
  * method), and yanking the window away from them mid-flow is far worse than
@@ -3796,7 +3796,7 @@ const CLOSED_POLL_INTERVAL_MS = 500;
3796
3796
  * (host page serves `Cross-Origin-Opener-Policy: same-origin`) flips to
3797
3797
  * `closed` on the first poll while the real window stays open in front of the
3798
3798
  * user; a human closing a window they asked for takes longer than this. A slow
3799
- * network can only delay the ready ping — it never makes `closed` true — so a
3799
+ * network can only delay the ready ping (it never makes `closed` true), so a
3800
3800
  * legitimate popup on a slow connection cannot trip this.
3801
3801
  */
3802
3802
  const SEVERED_DETECT_WINDOW_MS = 2500;
@@ -3816,7 +3816,7 @@ class PopupLauncher {
3816
3816
  return new Promise((resolve, reject) => {
3817
3817
  const left = Math.round((window.screen.width - width) / 2);
3818
3818
  const top = Math.round((window.screen.height - height) / 2);
3819
- // Synchronous open inside the caller's user gesture — any await before
3819
+ // Synchronous open inside the caller's user gesture: any await before
3820
3820
  // this point would let the browser treat the popup as programmatic and
3821
3821
  // block it.
3822
3822
  const popup = window.open(options.url, options.windowName, `width=${width},height=${height},left=${left},top=${top},popup=1`);
@@ -3834,7 +3834,7 @@ class PopupLauncher {
3834
3834
  clearInterval(pollClosedId);
3835
3835
  };
3836
3836
  const handleMessage = (event) => {
3837
- // Only trust the server-validated Identity origin — never the broader
3837
+ // Only trust the server-validated Identity origin, never the broader
3838
3838
  // sparkvault.com family (XSS or subdomain-takeover relay).
3839
3839
  if (event.origin !== options.trustedOrigin) {
3840
3840
  return;
@@ -3872,7 +3872,7 @@ class PopupLauncher {
3872
3872
  settled = true;
3873
3873
  cleanup();
3874
3874
  // `closed` going true right after open, before the page ever pinged,
3875
- // is a dead handle (COOP severance — see SEVERED_DETECT_WINDOW_MS),
3875
+ // is a dead handle (COOP severance; see SEVERED_DETECT_WINDOW_MS),
3876
3876
  // not a person closing the window: the real window is still open but
3877
3877
  // can never postMessage back, so retrying the popup can never work.
3878
3878
  if (!readyReceived && Date.now() - openedAt <= SEVERED_DETECT_WINDOW_MS) {
@@ -3904,7 +3904,7 @@ const POPUP_WIDTH = 450;
3904
3904
  const POPUP_HEIGHT = 500;
3905
3905
  /**
3906
3906
  * Device-level hint the Identity API sets on every completed passkey login
3907
- * (products/product-identity/src/utils/passkey-hint-cookie.js — the cookie
3907
+ * (products/product-identity/src/utils/passkey-hint-cookie.js; the cookie
3908
3908
  * NAME is the wire contract between the two). Host-locked to the Identity
3909
3909
  * origin and deliberately JS-readable, it means "a passkey login has completed
3910
3910
  * in this browser", which is what licenses auto-starting the discoverable
@@ -3971,7 +3971,7 @@ class PasskeyHandler {
3971
3971
  * Verify user with an existing passkey.
3972
3972
  *
3973
3973
  * On the Identity origin (the hosted widget / hosted login) the ceremony runs
3974
- * inline — same-origin with the RP id, one tap, no popup. On a third-party
3974
+ * inline: same-origin with the RP id, one tap, no popup. On a third-party
3975
3975
  * origin the rpId would not match the document, so it falls back to the popup
3976
3976
  * served from the Identity origin. (Verification, unlike registration, is
3977
3977
  * supported in cross-origin iframes, so the embedded widget uses the inline
@@ -3985,7 +3985,7 @@ class PasskeyHandler {
3985
3985
  }
3986
3986
  /**
3987
3987
  * True when the SDK is running ON the Identity origin and the browser exposes
3988
- * WebAuthn — the only place an inline ceremony's rpId matches the document.
3988
+ * WebAuthn, the only place an inline ceremony's rpId matches the document.
3989
3989
  */
3990
3990
  canRunCeremonyInline() {
3991
3991
  return typeof window !== 'undefined'
@@ -3996,8 +3996,8 @@ class PasskeyHandler {
3996
3996
  /**
3997
3997
  * True when the discoverable ceremony may be fired WITHOUT a user gesture:
3998
3998
  * the flow is running on the Identity origin (the inline ceremony needs no
3999
- * popup, so no gesture) AND this browser carries the passkey-hint cookie —
4000
- * a passkey login has completed here before. First visits never see an
3999
+ * popup, so no gesture) AND this browser carries the passkey-hint cookie
4000
+ * (a passkey login has completed here before). First visits never see an
4001
4001
  * unprompted system sheet.
4002
4002
  */
4003
4003
  canAutoVerify() {
@@ -4335,7 +4335,7 @@ class OtpHandler {
4335
4335
  signinRef: this.state.signinRef,
4336
4336
  });
4337
4337
  // Primary factor accepted, but the account requires a second factor.
4338
- // Not a success and not a retry — hand the ticket up to drive the 2FA step.
4338
+ // Not a success and not a retry: hand the ticket up to drive the 2FA step.
4339
4339
  if (response.second_factor_required && response.ticket) {
4340
4340
  return {
4341
4341
  success: false,
@@ -4870,7 +4870,7 @@ function methodIconGlyph(iconName) {
4870
4870
  case 'users':
4871
4871
  return createUsersIcon();
4872
4872
  default:
4873
- // Neutral placeholder — deliberately NOT the email envelope, so an
4873
+ // Neutral placeholder, deliberately NOT the email envelope, so an
4874
4874
  // unmapped icon name surfaces the gap instead of impersonating email.
4875
4875
  return createGenericMethodIcon();
4876
4876
  }
@@ -4886,7 +4886,7 @@ function createEmailIcon() {
4886
4886
  return svg;
4887
4887
  }
4888
4888
  function createSmsIcon() {
4889
- // Chat bubble — the text-message channel, distinct from the voice-call
4889
+ // Chat bubble: the text-message channel, distinct from the voice-call
4890
4890
  // handset (createPhoneIcon) so SMS and voice OTP read differently.
4891
4891
  const svg = createSvgElement('0 0 20 20', 20, 20);
4892
4892
  svg.setAttribute('stroke', 'currentColor');
@@ -4909,7 +4909,7 @@ function createPhoneIcon() {
4909
4909
  return svg;
4910
4910
  }
4911
4911
  function createGenericMethodIcon() {
4912
- // Neutral rounded badge with a center dot — a placeholder for an unmapped
4912
+ // Neutral rounded badge with a center dot: a placeholder for an unmapped
4913
4913
  // icon name, deliberately unlike any real method glyph.
4914
4914
  const svg = createSvgElement('0 0 20 20', 20, 20);
4915
4915
  svg.setAttribute('stroke', 'currentColor');
@@ -6081,7 +6081,7 @@ class PasskeyView {
6081
6081
  *
6082
6082
  * Shown behind the browser's passkey sheet while an auto-started discoverable
6083
6083
  * ceremony runs (returning browsers carrying the passkey-hint cookie). The
6084
- * ceremony was fired without a click, so this screen has no action button —
6084
+ * ceremony was fired without a click, so this screen has no action button,
6085
6085
  * only a live status and an escape hatch to the identifier form for anyone
6086
6086
  * who wants a different method (or whose sheet hangs).
6087
6087
  */
@@ -6206,7 +6206,7 @@ class PasskeyPromptView {
6206
6206
  * Includes a "Not now" skip that suppresses this method's prompt for 30 days
6207
6207
  * (handled by the renderer).
6208
6208
  *
6209
- * Sibling of PasskeyPromptView — same low-friction, skippable shape.
6209
+ * Sibling of PasskeyPromptView: same low-friction, skippable shape.
6210
6210
  */
6211
6211
  class BackupVerifyView {
6212
6212
  constructor(props) {
@@ -6530,7 +6530,7 @@ class SparkLinkWaitingView {
6530
6530
  * Professional enterprise-quality error display with clear visual hierarchy.
6531
6531
  */
6532
6532
  /**
6533
- * Error codes that mean the site owner's Identity access is blocked — the
6533
+ * Error codes that mean the site owner's Identity access is blocked: the
6534
6534
  * free trial was exhausted or expired, or a paid plan hit its capacity wall.
6535
6535
  * The end user can do nothing about these, so the ErrorView renders a friendly,
6536
6536
  * non-leaky interstitial (no "Try Again", no debug code badge) exactly like
@@ -6647,7 +6647,7 @@ class ErrorView {
6647
6647
  contentSection.appendChild(title);
6648
6648
  contentSection.appendChild(message);
6649
6649
  if (isGenuine) {
6650
- // Error code badge — useful for debugging genuine errors only.
6650
+ // Error code badge, useful for debugging genuine errors only.
6651
6651
  const codeBadge = document.createElement('div');
6652
6652
  codeBadge.className = 'sv-error-code-badge';
6653
6653
  const codeLabel = document.createElement('span');
@@ -6758,7 +6758,7 @@ function withAlpha(hex, alpha) {
6758
6758
  * Service Unavailable View
6759
6759
  *
6760
6760
  * Shown when the identity config endpoint is unreachable.
6761
- * Clean, professional, branded — no error codes or technical jargon.
6761
+ * Clean, professional, branded, with no error codes or technical jargon.
6762
6762
  */
6763
6763
  function createShieldIcon() {
6764
6764
  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
@@ -6857,8 +6857,8 @@ class ServiceUnavailableView {
6857
6857
  *
6858
6858
  * Full-dialog terminal screen shown when the SparkVault Identity Product has
6859
6859
  * not been configured for the account that the JS SDK is configured against. The
6860
- * audience is the website owner / developer — this is a misconfiguration
6861
- * surface, not an end-user error — so the dialog drops customer branding and
6860
+ * audience is the website owner / developer: this is a misconfiguration
6861
+ * surface, not an end-user error, so the dialog drops customer branding and
6862
6862
  * presents itself as an unmistakable SparkVault notice.
6863
6863
  */
6864
6864
  const ACTIVATION_URL = 'https://app.sparkvault.com/products/identity';
@@ -7023,8 +7023,8 @@ class ProductNotConfiguredView {
7023
7023
  *
7024
7024
  * Full-dialog terminal screen shown when the embedding site's origin is not in
7025
7025
  * the account's verified-domains allowlist. The audience is the website owner /
7026
- * developer — this is a misconfiguration surface, not an end-user error, and it
7027
- * is permanent (retrying never clears an origin block) — so the dialog drops
7026
+ * developer: this is a misconfiguration surface, not an end-user error, and it
7027
+ * is permanent (retrying never clears an origin block), so the dialog drops
7028
7028
  * customer branding, offers no "Try Again", names the blocked origin, and
7029
7029
  * points to the place that fixes it. Reuses the SparkVault-notice styling from
7030
7030
  * the product-not-configured view.
@@ -7047,7 +7047,7 @@ function createBadge() {
7047
7047
  surface.setAttribute('stroke', DS.slate200);
7048
7048
  surface.setAttribute('stroke-width', '1');
7049
7049
  svg.appendChild(surface);
7050
- // Globe with a slash — an unrecognized domain.
7050
+ // Globe with a slash: an unrecognized domain.
7051
7051
  const globe = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
7052
7052
  globe.setAttribute('cx', '32');
7053
7053
  globe.setAttribute('cy', '32');
@@ -7150,7 +7150,7 @@ class OriginNotAllowedView {
7150
7150
  ownerLabel.textContent = 'Are you the site owner?';
7151
7151
  const ownerHint = document.createElement('span');
7152
7152
  ownerHint.className = 'sv-not-activated-owner-hint';
7153
- // textContent (not innerHTML) — the origin is server-reported but we never
7153
+ // textContent (not innerHTML): the origin is server-reported but we never
7154
7154
  // trust it into the DOM as markup.
7155
7155
  ownerHint.textContent = this.props.origin
7156
7156
  ? `Add ${this.props.origin} to your verified domains in SparkVault, then reload this page.`
@@ -7244,7 +7244,7 @@ function progressHook() {
7244
7244
  function progressStart() { progressHook()?.start(); }
7245
7245
  function progressDone() { progressHook()?.done(); }
7246
7246
  /**
7247
- * End-user copy for a blocked Identity. Intentionally non-leaky — it never names
7247
+ * End-user copy for a blocked Identity. Intentionally non-leaky: it never names
7248
7248
  * the trial, billing, usage, or any owner-facing internal. When the site's
7249
7249
  * company name is known it is surfaced so the screen reads as the site's own and
7250
7250
  * the visitor is pointed back to the site for help (never to SparkVault). The
@@ -7349,7 +7349,7 @@ class IdentityRenderer {
7349
7349
  * Seed the verification identity from the render options, deriving the
7350
7350
  * channel (email vs phone) from the value itself rather than trusting which
7351
7351
  * option field carried it. The hosted login forwards a simple-mode identity
7352
- * hint — which may be a phone number — as `email`; keying off the value keeps
7352
+ * hint (which may be a phone number) as `email`; keying off the value keeps
7353
7353
  * the method list AND the OTP delivery target aligned with the real channel
7354
7354
  * instead of falling back to the email methods. Normalizes to E.164 /
7355
7355
  * lowercased email so the code goes to the canonical identifier.
@@ -7375,7 +7375,7 @@ class IdentityRenderer {
7375
7375
  }
7376
7376
  /**
7377
7377
  * True when the identifier is fixed by the flow and the person must prove
7378
- * that exact identity — the invite / simple-redirect case. There is no
7378
+ * that exact identity: the invite / simple-redirect case. There is no
7379
7379
  * identifier-entry step to return to, so the picker must not offer a
7380
7380
  * "change identity" back link that would let them verify a different
7381
7381
  * identifier than the one they were invited as.
@@ -7422,7 +7422,7 @@ class IdentityRenderer {
7422
7422
  if (this.api.isConfigPreloaded()) {
7423
7423
  // Config fetch already started - race it against a 50ms timeout
7424
7424
  // If config is ready (or almost ready), we skip the loading flash.
7425
- // A rejected preload (e.g. product_not_configured) must not abort start() —
7425
+ // A rejected preload (e.g. product_not_configured) must not abort start():
7426
7426
  // swallow here and let the in-modal try/catch below route to the
7427
7427
  // correct error view.
7428
7428
  const timeoutPromise = new Promise((resolve) => setTimeout(() => resolve(null), 50));
@@ -7471,8 +7471,8 @@ class IdentityRenderer {
7471
7471
  * would otherwise escape. In the default embedded/dialog mode that escape is
7472
7472
  * exactly the "closes silently" failure: the host's `onError` runs, the
7473
7473
  * embedding page tears the iframe down, and the user is left with no message.
7474
- * Render the error in the SparkVault dialog — consistent with how every
7475
- * in-flow error already behaves — so the dialog stays open and the user can
7474
+ * Render the error in the SparkVault dialog, consistent with how every
7475
+ * in-flow error already behaves, so the dialog stays open and the user can
7476
7476
  * retry or close it (→ onCancel).
7477
7477
  */
7478
7478
  showStartupError(error) {
@@ -7486,7 +7486,7 @@ class IdentityRenderer {
7486
7486
  * Map a config-fetch error to the appropriate terminal view.
7487
7487
  *
7488
7488
  * Two failures are permanent developer-misconfigurations, not transient
7489
- * outages, so they get dedicated terminal screens (no "Try Again" — retrying
7489
+ * outages, so they get dedicated terminal screens (no "Try Again", since retrying
7490
7490
  * can never clear them) instead of the generic service-unavailable view:
7491
7491
  * - `product_not_configured`: the account has not configured Identity.
7492
7492
  * - `ORIGIN_NOT_ALLOWED`: this site's domain is not on the account's
@@ -7755,7 +7755,7 @@ class IdentityRenderer {
7755
7755
  }
7756
7756
  // Returning browser on the Identity origin (passkey-hint cookie present):
7757
7757
  // auto-start the discoverable ceremony instead of asking for an identifier
7758
- // — the Google-style one-touch return. A cancel lands on the identifier
7758
+ // (the Google-style one-touch return). A cancel lands on the identifier
7759
7759
  // form, which keeps a "Sign in with a passkey" way back in. A provider
7760
7760
  // that starts on its own once the pending reference lands goes first, as
7761
7761
  // with the reference held (startWithFederation), so the identifier form
@@ -7784,7 +7784,7 @@ class IdentityRenderer {
7784
7784
  * Fired on open for returning browsers and from the identifier form's
7785
7785
  * "Sign in with a passkey" shortcut. Anything short of a terminal outcome
7786
7786
  * (dismissed sheet, no credential on the device, transient failure) falls
7787
- * back to the identifier form with no error banner — the person simply
7787
+ * back to the identifier form with no error banner: the person simply
7788
7788
  * lands where a first-time visitor starts.
7789
7789
  */
7790
7790
  async launchDiscoverableVerify() {
@@ -8089,7 +8089,7 @@ class IdentityRenderer {
8089
8089
  // Leaving the SparkLink waiting view (e.g. "Choose another method") must
8090
8090
  // tear down its WebSocket + refocus listeners and clear the kindling, or a
8091
8091
  // later tab refocus would fire a stale claim for an abandoned flow.
8092
- // Idempotent — a no-op when SparkLink was never armed.
8092
+ // Idempotent: a no-op when SparkLink was never armed.
8093
8093
  this.cleanupSparkLink();
8094
8094
  const autoRoute = options.autoRoute !== false;
8095
8095
  if (!this.sdkConfig)
@@ -8154,7 +8154,7 @@ class IdentityRenderer {
8154
8154
  }
8155
8155
  // When a passkey is already registered for this identifier, jump
8156
8156
  // straight to the WebAuthn ceremony instead of asking the user to
8157
- // pick a method — it is the safest, fastest option. The back arrow on
8157
+ // pick a method: it is the safest, fastest option. The back arrow on
8158
8158
  // the passkey view re-enters this method with autoRoute=false so the
8159
8159
  // user lands on the full picker (passkey still listed) and can pick
8160
8160
  // a code or SparkLink instead. A provider that starts on its own once the
@@ -8188,7 +8188,7 @@ class IdentityRenderer {
8188
8188
  // - a list the provider is missing from only while the page's ask for the
8189
8189
  // sign-in's reference is out (federationAwaitingReference): with the
8190
8190
  // reference held the provider leads it, so it is never one method.
8191
- // (Passkey auto-route above still applies — a biometric prompt costs
8191
+ // (Passkey auto-route above still applies: a biometric prompt costs
8192
8192
  // nothing and can be dismissed.)
8193
8193
  const sendsToSuppliedPhone = this.identityPrefilled && methods[0].identityType === 'phone';
8194
8194
  const heldFederation = methods[0].type === 'federation' && !this.federationMayAutoStart;
@@ -8293,7 +8293,7 @@ class IdentityRenderer {
8293
8293
  }
8294
8294
  handleIdentitySubmit(result) {
8295
8295
  this.verificationState.setIdentity(result.value, result.type);
8296
- // The person typed this identifier, so it is theirs to change — a no-hint
8296
+ // The person typed this identifier, so it is theirs to change: a no-hint
8297
8297
  // simple-mode session must keep the back link + single-method auto-proceed.
8298
8298
  this.identityPrefilled = false;
8299
8299
  this.showMethodSelect();
@@ -8389,7 +8389,7 @@ class IdentityRenderer {
8389
8389
  if (!result.success) {
8390
8390
  this.cleanupSparkLink();
8391
8391
  // A blocked Identity (trial exhausted/expired, paid capacity) is
8392
- // terminal — show the "sign-in unavailable" interstitial, not a
8392
+ // terminal: show the "sign-in unavailable" interstitial, not a
8393
8393
  // retryable "Try Again" that invites retrying a permanently-blocked
8394
8394
  // login. Mirrors the otp send path.
8395
8395
  if (this.renderBlockedInterstitial(result.errorCode))
@@ -8477,7 +8477,7 @@ class IdentityRenderer {
8477
8477
  else if (this.renderBlockedInterstitial(result.errorCode)) ;
8478
8478
  else if (this.renderIdentityTypeRefusal(result.errorCode, result.error)) ;
8479
8479
  else if (result.errorCode === 'identity_locked') {
8480
- // The identity is locked down — a dedicated, actionable state, not a
8480
+ // The identity is locked down: a dedicated, actionable state, not a
8481
8481
  // generic "invalid code" retry. The person must manage it at auth.sv.
8482
8482
  this.setState({
8483
8483
  view: 'error',
@@ -8548,7 +8548,7 @@ class IdentityRenderer {
8548
8548
  if (error instanceof IdentityApiError && this.renderIdentityTypeRefusal(error.code, message))
8549
8549
  return;
8550
8550
  // The login ticket is not consumed on a wrong code, so the user can retry
8551
- // against the same ticket — re-render the view carrying the error.
8551
+ // against the same ticket: re-render the view carrying the error.
8552
8552
  this.setState({ view: 'two-factor', ticket, methods, error: message });
8553
8553
  }
8554
8554
  }
@@ -8605,14 +8605,14 @@ class IdentityRenderer {
8605
8605
  return true;
8606
8606
  }
8607
8607
  if (this.renderBlockedInterstitial(result.errorCode)) {
8608
- // Terminal interstitial already rendered — the owner must subscribe.
8608
+ // Terminal interstitial already rendered: the owner must subscribe.
8609
8609
  return true;
8610
8610
  }
8611
8611
  if (this.renderIdentityTypeRefusal(result.errorCode, result.error)) {
8612
8612
  return true;
8613
8613
  }
8614
8614
  if (result.errorCode === 'identity_locked') {
8615
- // Dedicated state — retrying cannot unlock the identity.
8615
+ // Dedicated state: retrying cannot unlock the identity.
8616
8616
  this.setState({
8617
8617
  view: 'error',
8618
8618
  code: 'identity_locked',
@@ -8636,7 +8636,7 @@ class IdentityRenderer {
8636
8636
  void this.showMethodSelect({ autoRoute: false });
8637
8637
  }
8638
8638
  else if (result.errorType === 'not_found') {
8639
- // No passkey yet — pivot the same screen to registration.
8639
+ // No passkey yet: pivot the same screen to registration.
8640
8640
  this.setState({
8641
8641
  view: 'passkey',
8642
8642
  recipient: this.recipient,
@@ -8690,7 +8690,7 @@ class IdentityRenderer {
8690
8690
  }
8691
8691
  /**
8692
8692
  * Leave for the social provider. The renderer runs on the Identity origin's
8693
- * sign-in page, and the round trip returns to that same page — query intact,
8693
+ * sign-in page, and the round trip returns to that same page, query intact,
8694
8694
  * because the query carries the destination the page was opened for (the
8695
8695
  * popup's `origin`, or the redirect mode's handoff parameters), which the
8696
8696
  * page re-gates before releasing the result. The state stored here is what
@@ -8857,7 +8857,7 @@ class IdentityRenderer {
8857
8857
  * The server returns an ordered `recommendations` list (passkey upsell,
8858
8858
  * backup verification, …); this walks it, rendering the step views the SDK
8859
8859
  * supports and finalizing when the queue drains. A redirect target skips the
8860
- * pipeline. A future nudge is one new recommendation type + view case — no
8860
+ * pipeline. A future nudge is one new recommendation type + view case, no
8861
8861
  * primary-login handler changes.
8862
8862
  */
8863
8863
  runPostLogin(result) {
@@ -8890,7 +8890,7 @@ class IdentityRenderer {
8890
8890
  this.setState({ view: 'backup-verify', missingType: next.missingType, pendingResult: result });
8891
8891
  }
8892
8892
  else {
8893
- // A recommendation type this SDK build does not render — skip it.
8893
+ // A recommendation type this SDK build does not render: skip it.
8894
8894
  this.advancePostLogin();
8895
8895
  }
8896
8896
  }
@@ -9041,7 +9041,7 @@ class IdentityRenderer {
9041
9041
  // Directly trigger passkey registration
9042
9042
  const result = await this.passkeyHandler.register(pendingResult.token);
9043
9043
  if (result.success && result.result) {
9044
- // Passkey created — adopt its fresh token/session as the result to
9044
+ // Passkey created: adopt its fresh token/session as the result to
9045
9045
  // finalize with (and to authorize any later backup-attach step), then
9046
9046
  // advance to the next recommendation.
9047
9047
  this.postLoginResult = result.result;
@@ -9179,7 +9179,7 @@ class IdentityRenderer {
9179
9179
  case 'sparklink_verified':
9180
9180
  case 'sparklink_second_factor': {
9181
9181
  const outcome = parseSparkLinkEvent(data);
9182
- // A result the sign-in cannot use — e.g. "verified" with no token —
9182
+ // A result the sign-in cannot use (e.g. "verified" with no token)
9183
9183
  // can never complete it; say so rather than report a hollow success.
9184
9184
  if (!outcome) {
9185
9185
  this.failSparkLink();
@@ -9193,7 +9193,7 @@ class IdentityRenderer {
9193
9193
  this.failSparkLink();
9194
9194
  break;
9195
9195
  case 'sparklink_resent':
9196
- // Server auto-resent a new link — update countdown timer
9196
+ // Server auto-resent a new link: update countdown timer
9197
9197
  if (typeof data.expiresAt === 'number') {
9198
9198
  this.setState({
9199
9199
  view: 'sparklink-waiting',
@@ -9214,7 +9214,7 @@ class IdentityRenderer {
9214
9214
  *
9215
9215
  * A completed login runs the post-login pipeline, which hands the host the
9216
9216
  * full result (including any redirect URL) before attempting top-level
9217
- * navigation — the host page is the source of truth for what happens next;
9217
+ * navigation: the host page is the source of truth for what happens next;
9218
9218
  * the SDK's window.location.href call is a fallback for hosts that delegate
9219
9219
  * navigation entirely to the SDK. A login held at the second-factor gate
9220
9220
  * opens the two-factor view, exactly as after an emailed code.
@@ -9257,7 +9257,7 @@ class IdentityRenderer {
9257
9257
  * is suspended (mobile: the user leaves to the mail app). On refocus, if the
9258
9258
  * socket is no longer open, reclaim the click's result once by kindling. A
9259
9259
  * single ~2s retry covers returning before the server finished writing it.
9260
- * Deliberately NOT a polling loop — it fires only on refocus, and only when
9260
+ * Deliberately NOT a polling loop: it fires only on refocus, and only when
9261
9261
  * the socket is actually gone.
9262
9262
  */
9263
9263
  armSparkLinkRefocusClaim() {
@@ -9301,7 +9301,7 @@ class IdentityRenderer {
9301
9301
  this.applySparkLinkOutcome(outcome);
9302
9302
  return;
9303
9303
  }
9304
- // Pending — the click may still be processing server-side. One short retry,
9304
+ // Pending: the click may still be processing server-side. One short retry,
9305
9305
  // then stop. No ongoing polling. Tracked so cleanup can cancel it.
9306
9306
  if (allowRetry && this.sparkLinkKindling === kindling) {
9307
9307
  this.sparkLinkRetryTimer = setTimeout(() => {
@@ -9519,9 +9519,9 @@ function getStyles(options) {
9519
9519
  textSecondary: isDark ? DS.darkTextMuted : DS.slate600,
9520
9520
  textMuted: isDark ? withAlpha(DS.white, 0.45) : DS.slate500,
9521
9521
  textOnPrimary: DS.white,
9522
- // Focus — two-tone ring: inner surface gap + accent-derived outer ring.
9522
+ // Focus, a two-tone ring: inner surface gap + accent-derived outer ring.
9523
9523
  focusRing: `0 0 0 2px ${surface}, 0 0 0 4px ${focusRingColor}`,
9524
- // Shadows — DS-weight: lean on hairlines, keep elevation subtle.
9524
+ // Shadows, DS-weight: lean on hairlines, keep elevation subtle.
9525
9525
  shadowSm: isDark
9526
9526
  ? '0 1px 2px rgba(0, 0, 0, 0.4)'
9527
9527
  : DS.shadowSm,
@@ -11563,7 +11563,7 @@ class DialogLauncher {
11563
11563
  return;
11564
11564
  }
11565
11565
  if (message.error === 'cancelled') {
11566
- // The person explicitly backed out inside the popup — end the flow rather
11566
+ // The person explicitly backed out inside the popup: end the flow rather
11567
11567
  // than offer to reopen to the same place.
11568
11568
  this.finishCancel();
11569
11569
  return;
@@ -11576,7 +11576,7 @@ class DialogLauncher {
11576
11576
  return;
11577
11577
  // Severed handle (COOP: same-origin on the host page): the popup is open in
11578
11578
  // front of the person and working, but postMessage can never deliver and a
11579
- // retry popup severs identically — the ONLY flow that can complete is the
11579
+ // retry popup severs identically. The ONLY flow that can complete is the
11580
11580
  // redirect flow, so switch to it. When the owner can't arm the redirect
11581
11581
  // return leg it resolves false and we degrade to the retry alert.
11582
11582
  if (error instanceof PopupSeveredError && this.callbacks.onPopupSevered) {
@@ -11864,14 +11864,14 @@ function onBodyReady(callback) {
11864
11864
  }
11865
11865
  }
11866
11866
  /**
11867
- * Attach a click handler to every element matching `selector` — both elements
11867
+ * Attach a click handler to every element matching `selector`: both elements
11868
11868
  * present once the DOM is ready and elements added later (observed via
11869
11869
  * MutationObserver).
11870
11870
  *
11871
11871
  * Each call is fully self-contained: the element bookkeeping lives in this
11872
11872
  * closure, so the returned cleanup removes only the listeners this call
11873
- * registered. Multiple attachments — different selectors, or even the same
11874
- * element attached twice — never interfere with one another.
11873
+ * registered. Multiple attachments (different selectors, or even the same
11874
+ * element attached twice) never interfere with one another.
11875
11875
  *
11876
11876
  * @param selector - CSS selector for elements to attach to
11877
11877
  * @param onClick - Click handler to register on every matching element
@@ -12151,7 +12151,7 @@ const PORTAL_SECTIONS = ['home', 'identity', 'security', 'sessions', 'sites'];
12151
12151
  // algorithm-confused token cannot masquerade as valid.
12152
12152
  const ACCEPTED_TOKEN_ALGS = ['EdDSA', 'RS256'];
12153
12153
  /**
12154
- * Whether `handleRedirectResult()` has anything to do on this load — a returned
12154
+ * Whether `handleRedirectResult()` has anything to do on this load: a returned
12155
12155
  * sign-in fragment to consume, or a pending sign-in to self-heal. Public + side
12156
12156
  * effect-free (peeks, never consumes) so a host that defers SDK init for
12157
12157
  * performance can cheaply decide whether to boot the SDK on a given page load,
@@ -12230,7 +12230,7 @@ class IdentityModule {
12230
12230
  ensurePreconnect(config.identityBaseUrl);
12231
12231
  }
12232
12232
  /**
12233
- * Build a deep link into the person's auth.sv Identity portal — where they
12233
+ * Build a deep link into the person's auth.sv Identity portal, where they
12234
12234
  * manage their verified identity, passkeys, sessions, and connected sites
12235
12235
  * across every SparkVault-integrated site. Send a signed-in user here to
12236
12236
  * self-serve;
@@ -12272,7 +12272,7 @@ class IdentityModule {
12272
12272
  * SSO hub session on the Identity origin),
12273
12273
  * the browser surfaces a "Continue as …" prompt with no popup, redirect, or
12274
12274
  * typing. Requires a registered `clientId` in the SDK config and a browser
12275
- * with FedCM support — callers should feature-detect with
12275
+ * with FedCM support: callers should feature-detect with
12276
12276
  * `IdentityModule.isFedcmAvailable()` and fall back to `signIn()` otherwise.
12277
12277
  *
12278
12278
  * @returns the verified result, or `null` when the browser has no FedCM
@@ -12304,7 +12304,7 @@ class IdentityModule {
12304
12304
  }
12305
12305
  const nonce = options.nonce ?? (await this.api.drawAuthorizationValues()).nonce;
12306
12306
  // The FedCM IdP is the IDENTITY origin (where sign-in runs and the SSO hub
12307
- // cookie lives) — not the auth.sv portal. The config, its endpoints, and
12307
+ // cookie lives), not the auth.sv portal. The config, its endpoints, and
12308
12308
  // the credentialed accounts fetch must all be same-origin with that cookie.
12309
12309
  const configURL = `${this.config.identityBaseUrl}/${this.config.accountId}/fedcm/config.json`;
12310
12310
  // A restriction rides the provider's `params`, which the browser hands the
@@ -12363,7 +12363,7 @@ class IdentityModule {
12363
12363
  * This is the single programmatic entry point; `attach()` binds it to element
12364
12364
  * clicks. The popup runs the flow top-level on the Identity origin (so
12365
12365
  * login's `__Host-` hub cookie is a first-party write and cross-domain SSO
12366
- * works) and posts the result back — the promise resolves with it.
12366
+ * works) and posts the result back; the promise resolves with it.
12367
12367
  *
12368
12368
  * Resilience: pair this with `handleRedirectResult()` on page load. If the
12369
12369
  * popup's result is ever lost (a mobile browser discards the backgrounded
@@ -12423,7 +12423,7 @@ class IdentityModule {
12423
12423
  backdropBlur: options.backdropBlur ?? this.config.backdropBlur,
12424
12424
  };
12425
12425
  // Inline rendering (target) and explicit local mode run the flow in this
12426
- // document — that is how the SparkVault-hosted sign-in page itself runs
12426
+ // document: that is how the SparkVault-hosted sign-in page itself runs
12427
12427
  // the flow. Otherwise sign-in leaves this page: a top-level redirect to
12428
12428
  // the sign-in page on the Identity origin (so login's first-party SSO
12429
12429
  // cookie persists), returning via handleRedirectResult().
@@ -12602,8 +12602,8 @@ class IdentityModule {
12602
12602
  throw new ValidationError('Invalid token header');
12603
12603
  }
12604
12604
  // Accept exactly the algorithms the Identity server signs with; reject
12605
- // everything else — `none` (unsigned), a symmetric or algorithm-confused
12606
- // token, or an absent alg — none of which could pass the server-side JWKS
12605
+ // everything else: `none` (unsigned), a symmetric or algorithm-confused
12606
+ // token, or an absent alg, none of which could pass the server-side JWKS
12607
12607
  // verification the host performs before trusting the token.
12608
12608
  const alg = header.alg;
12609
12609
  if (typeof alg !== 'string' || !ACCEPTED_TOKEN_ALGS.includes(alg)) {
@@ -12627,17 +12627,17 @@ class IdentityModule {
12627
12627
  return payload;
12628
12628
  }
12629
12629
  /**
12630
- * Complete a sign-in on page load — the return leg of `signIn()`. Call once
12630
+ * Complete a sign-in on page load: the return leg of `signIn()`. Call once
12631
12631
  * on every page load; it resolves `null` when there is nothing to do.
12632
12632
  *
12633
12633
  * It handles two cases:
12634
- * 1. A one-time code is in the URL fragment (`#sv_code=…`) — the popup's
12634
+ * 1. A one-time code is in the URL fragment (`#sv_code=…`): the popup's
12635
12635
  * result was lost and self-heal navigated here, or `flow: 'redirect'`
12636
12636
  * returned. Redeem it server-side and hand the full result to
12637
12637
  * `onSuccess` (and resolve with it).
12638
12638
  * 2. A sign-in was in flight but never delivered (a mobile browser
12639
12639
  * discarded the backgrounded opener tab, killing the popup's
12640
- * postMessage) — silently re-mint from the SSO session the popup signed
12640
+ * postMessage): silently re-mint from the SSO session the popup signed
12641
12641
  * in or chose, by navigating this tab through the silent SSO endpoint
12642
12642
  * and straight back with a code (case 1 on return). The bounce names
12643
12643
  * the sign-in's reference, and the endpoint mints only when the
@@ -12645,7 +12645,7 @@ class IdentityModule {
12645
12645
  * such session (a sign-in that opened none, such as one through the
12646
12646
  * account's own identity provider) it comes back logged-out, no oracle.
12647
12647
  *
12648
- * The code is one-time, PKCE-bound, and origin-locked — never the token. The
12648
+ * The code is one-time, PKCE-bound, and origin-locked, never the token. The
12649
12649
  * host must still verify `result.token` server-side via the Identity JWKS.
12650
12650
  *
12651
12651
  * @example Call on page load; sign-in clicks stay unchanged.
@@ -12663,7 +12663,7 @@ class IdentityModule {
12663
12663
  }
12664
12664
  // A silent-SSO recovery that found no live session returns `#sso=…`; strip
12665
12665
  // it so the logged-out load is clean, retire the one-shot state/verifier the
12666
- // outbound bounce staged (dead now — no code came back), and do not re-bounce
12666
+ // outbound bounce staged (dead now: no code came back), and do not re-bounce
12667
12667
  // (handled below).
12668
12668
  if (params.get('sso')) {
12669
12669
  this.clearUrlFragment();
@@ -12682,7 +12682,7 @@ class IdentityModule {
12682
12682
  const code = params.get('sv_code');
12683
12683
  const errorCode = params.get('sv_error');
12684
12684
  // A returned fragment means this sign-in resolved (redeem, cancel, or
12685
- // error), so retire any pending marker — otherwise it could fire one
12685
+ // error), so retire any pending marker; otherwise it could fire one
12686
12686
  // spurious silent bounce on a later load inside its TTL.
12687
12687
  removePendingMarker();
12688
12688
  // Consume exactly once: fragment and one-shot state/verifier are cleared
@@ -12717,8 +12717,8 @@ class IdentityModule {
12717
12717
  // here: the code is PKCE- and origin-bound to this tab, and a recovery
12718
12718
  // bounce only ever mints for the account its `login_hint` named (see
12719
12719
  // startRecoveryBounce). The redeemed result exposes just that account's
12720
- // PRIMARY identifier — not necessarily the one the caller signed in
12721
- // with — so re-checking it here could only discard valid sign-ins.
12720
+ // PRIMARY identifier (not necessarily the one the caller signed in
12721
+ // with), so re-checking it here could only discard valid sign-ins.
12722
12722
  const raw = await this.api.redeemHandoffCode(code, codeVerifier);
12723
12723
  const result = {
12724
12724
  token: raw.token,
@@ -12741,7 +12741,7 @@ class IdentityModule {
12741
12741
  * Silently re-mint the sign-in result from the SSO session the popup signed
12742
12742
  * in or chose. Navigates this tab through the silent SSO endpoint
12743
12743
  * (a top-level GET, so the `SameSite=Lax` hub cookie rides along) which,
12744
- * PKCE-bound, returns a one-time code in the fragment — handled by case 1 on
12744
+ * PKCE-bound, returns a one-time code in the fragment, handled by case 1 on
12745
12745
  * return. No-op (stays put) if session storage or WebCrypto is unavailable,
12746
12746
  * so a degraded environment simply never recovers rather than erroring. The
12747
12747
  * bounce's PKCE verifier and state are a draw from the Identity origin
@@ -12757,7 +12757,7 @@ class IdentityModule {
12757
12757
  const sso = new URL(`${this.config.identityBaseUrl}/${this.config.accountId}/sso`);
12758
12758
  // With several hub sessions, login_hint names the account the interrupted
12759
12759
  // sign-in was addressing: /sso mints silently ONLY for a hint that matched
12760
- // exactly one hub session's verified identifiers — every unsatisfiable hint
12760
+ // exactly one hub session's verified identifiers, and every unsatisfiable hint
12761
12761
  // (a stranger's address, an ambiguous match, an account not eligible here)
12762
12762
  // comes back with no result at all rather than a different account's.
12763
12763
  if (pending.hint) {
@@ -12917,14 +12917,14 @@ class IdentityModule {
12917
12917
  // nothing below can match.
12918
12918
  }
12919
12919
  // A `#token` is accepted only as the answer to a sign-in THIS browser
12920
- // started — the renderer stores the state before leaving for the
12920
+ // started: the renderer stores the state before leaving for the
12921
12921
  // provider. Anyone can compose a URL carrying their own genuinely-signed
12922
12922
  // token, so a fragment with no stored state, or a different one, is an
12923
12923
  // unsolicited result (login CSRF) and is refused.
12924
12924
  if (!expectedState || params.get(SIGNIN_RESULT_FRAGMENT.state) !== expectedState) {
12925
12925
  throw new ValidationError('Invalid OAuth state');
12926
12926
  }
12927
- // Unverified client-side decode — surfaces the claims for the result
12927
+ // Unverified client-side decode: surfaces the claims for the result
12928
12928
  // shape and rejects an obviously-bad token (expiry/issuer/audience/alg).
12929
12929
  // The host MUST still verify result.token server-side via the Identity
12930
12930
  // JWKS before trusting any claim for an authorization decision.
@@ -12995,7 +12995,7 @@ class IdentityModule {
12995
12995
  * Whether the preloaded config has already settled as a *permanent* failure
12996
12996
  * the popup can't surface (origin not allowed, or product not configured).
12997
12997
  * Used to skip the launcher and show the error dialog in-page immediately.
12998
- * Returns false — proceed to the launcher — when config is not preloaded,
12998
+ * Returns false (proceed to the launcher) when config is not preloaded,
12999
12999
  * still in flight (raced against a short timeout so the common path is never
13000
13000
  * delayed), resolved, or failed only transiently (the launcher surfaces a
13001
13001
  * transient failure in its own dialog).
@@ -13009,7 +13009,7 @@ class IdentityModule {
13009
13009
  this.api.getConfig(),
13010
13010
  new Promise((resolve) => setTimeout(() => resolve(PENDING), 50)),
13011
13011
  ]);
13012
- // Resolved with config, or still pending after the timeout — either way,
13012
+ // Resolved with config, or still pending after the timeout: either way,
13013
13013
  // don't block the iframe path.
13014
13014
  return false;
13015
13015
  }
@@ -13041,7 +13041,7 @@ class IdentityModule {
13041
13041
  *
13042
13042
  * @internal Used only by the SparkVault-hosted sign-in popup and hosted login
13043
13043
  * page (which own their chrome and pass `renderMode: 'local'`). Customer
13044
- * integrations have no inline mode — use `signIn()` / `attach()`.
13044
+ * integrations have no inline mode; use `signIn()` / `attach()`.
13045
13045
  */
13046
13046
  async render(options) {
13047
13047
  const returned = await this.consumeRedirectResult();
@@ -13067,8 +13067,8 @@ class IdentityModule {
13067
13067
 
13068
13068
  /**
13069
13069
  * The caller-supplied send idempotency key. It becomes part of the send's
13070
- * storage key, so `#` (the key separator) is excluded — no caller id can forge a
13071
- * key-segment boundary into another tenant's namespace — and the length bound
13070
+ * storage key, so `#` (the key separator) is excluded (no caller id can forge a
13071
+ * key-segment boundary into another tenant's namespace), and the length bound
13072
13072
  * keeps the key inside the store's key-size limit.
13073
13073
  */
13074
13074
  const NOTIFY_SEND_ID_PATTERN = /^[A-Za-z0-9_.:-]+$/;
@@ -13330,14 +13330,14 @@ class NotifyProjectsModule {
13330
13330
  }
13331
13331
 
13332
13332
  /**
13333
- * Notify Product Module — the TENANT (sender) surface.
13333
+ * Notify Product Module: the TENANT (sender) surface.
13334
13334
  *
13335
13335
  * The counterpart to `sv.notify`: where that module is SparkVault's own
13336
13336
  * first-party inbox, which a signed-in SparkVault user reads for the
13337
13337
  * notifications SparkVault delivered to them `in_app`, this one is the
13338
- * account-scoped product surface a tenant's BACKEND drives — send, send
13338
+ * account-scoped product surface a tenant's BACKEND drives (send, send
13339
13339
  * history, recall, sender-side inbox reads and state, send status, receipts,
13340
- * the account's Notify config, and who its email is from.
13340
+ * the account's Notify config, and who its email is from).
13341
13341
  * A tenant reads its own recipients' feeds here (`getInbox`), never through
13342
13342
  * `sv.notify`. Every method maps to
13343
13343
  * `/v1/products/notify/*` and is authorized by the caller's account, so the
@@ -13352,7 +13352,7 @@ class NotifyProjectsModule {
13352
13352
  * and metadata.
13353
13353
  */
13354
13354
  /**
13355
- * The caller-supplied idempotency key's accepted shape — the server's own rule,
13355
+ * The caller-supplied idempotency key's accepted shape: the server's own rule,
13356
13356
  * so a malformed key fails locally instead of on the wire.
13357
13357
  */
13358
13358
  function isSendId(value) {
@@ -13371,7 +13371,7 @@ const BULK_MARK_STATES$1 = NOTIFY_INBOX_BULK_MARK_STATES;
13371
13371
  * The five secure-by-default preset bundles: the server's own table, in this
13372
13372
  * SDK's camelCase shape.
13373
13373
  *
13374
- * There is no preset endpoint — presets are a merge over the one send contract,
13374
+ * There is no preset endpoint: presets are a merge over the one send contract,
13375
13375
  * so they are applied client-side and produce an ordinary `send` request. Caller
13376
13376
  * arguments win over a preset's defaults wherever they state a value;
13377
13377
  * `channels` left unset lets the account config resolve the ladder per category.
@@ -13440,8 +13440,8 @@ class NotifyProductModule {
13440
13440
  * recipient, and enqueue delivery across the resolved channel ladder.
13441
13441
  *
13442
13442
  * `sendId` is the idempotency key. Replaying an existing one with the same
13443
- * request returns the stored send unchanged — never re-sealed, never
13444
- * re-delivered — flagged `idempotent`; another request under it is refused 400
13443
+ * request returns the stored send unchanged (never re-sealed, never
13444
+ * re-delivered), flagged `idempotent`; another request under it is refused 400
13445
13445
  * (`sendId` on `CreateNotifySendOptions`).
13446
13446
  *
13447
13447
  * The send speaks in your organization's name, and one that would email
@@ -13455,12 +13455,12 @@ class NotifyProductModule {
13455
13455
  * | Status | `serviceCode` | `details` | Next |
13456
13456
  * | --- | --- | --- | --- |
13457
13457
  * | 403 | `NOTIFY_CHANNEL_NOT_AVAILABLE` | `{ field, channels }` | Name only `in_app` and `email` |
13458
- * | 409 | `NOTIFY_SENDER_NAME_REQUIRED` | — | Name the organization in Settings |
13458
+ * | 409 | `NOTIFY_SENDER_NAME_REQUIRED` | none | Name the organization in Settings |
13459
13459
  * | 409 | `NOTIFY_SENDER_NAME_RESERVED` | `{ reason: 'reserved_name' }` | Rename the organization |
13460
13460
  * | 409 | `HANDLE_REQUIRED` | `{ product: 'notify' }` | Choose the organization's handle in Company Settings |
13461
13461
  * | 429 | `NOTIFY_EMAIL_ADMISSION_LIMIT` | `{ limit, window: 'hour', resets_at }` | Wait `retryAfterMs`, then send |
13462
- * | 503 | `EMAIL_SETUP_BUSY` | — | Retry the same send after `retryAfterMs` |
13463
- * | 503 | `NOTIFY_EMAIL_CAPACITY_UNAVAILABLE` | — | Retry the same send |
13462
+ * | 503 | `EMAIL_SETUP_BUSY` | none | Retry the same send after `retryAfterMs` |
13463
+ * | 503 | `NOTIFY_EMAIL_CAPACITY_UNAVAILABLE` | none | Retry the same send |
13464
13464
  *
13465
13465
  * A replay is answered from the stored send and meets none of them again.
13466
13466
  *
@@ -13474,7 +13474,7 @@ class NotifyProductModule {
13474
13474
  * category: 'transactional',
13475
13475
  * });
13476
13476
  *
13477
- * @example Send a stored file — the unsealed vault proves you hold its key
13477
+ * @example Send a stored file: the unsealed vault proves you hold its key
13478
13478
  * const vault = await sv.vaults.unseal('vlt_abc', process.env.CONTRACTS_DVAK);
13479
13479
  * await sv.products.notify.send({
13480
13480
  * sendId: `contract:${contract.id}`,
@@ -13505,7 +13505,7 @@ class NotifyProductModule {
13505
13505
  return response.data;
13506
13506
  }
13507
13507
  /**
13508
- * Frictionless informational ping — no verification, view-only, delivered
13508
+ * Frictionless informational ping: no verification, view-only, delivered
13509
13509
  * INLINE (plaintext) so it is read at a glance. Channels resolve from the
13510
13510
  * account config, narrowed to the ones that render cleartext.
13511
13511
  *
@@ -13580,7 +13580,7 @@ class NotifyProductModule {
13580
13580
  * grant still opens, never the content; a plaintext row carries its body.
13581
13581
  * Treat the answer as sensitive and keep it out of logs.
13582
13582
  *
13583
- * A page can come back SHORT of `limit` yet still carry a non-null cursor —
13583
+ * A page can come back SHORT of `limit` yet still carry a non-null cursor:
13584
13584
  * follow the cursor; never treat a short page as the end.
13585
13585
  *
13586
13586
  * @example
@@ -13603,7 +13603,7 @@ class NotifyProductModule {
13603
13603
  }
13604
13604
  /**
13605
13605
  * Apply a terminal display state to one row (idempotent). `createdAt` MUST be
13606
- * the row's own `created_at`, round-tripped from the feed row — the id alone
13606
+ * the row's own `created_at`, round-tripped from the feed row; the id alone
13607
13607
  * cannot address the row. Any mark (seen, read or archived) marks the row seen,
13608
13608
  * which stops its escalation.
13609
13609
  *
@@ -13659,7 +13659,7 @@ class NotifyProductModule {
13659
13659
  }
13660
13660
  // ── Send history & recall ───────────────────────────────────────────────────
13661
13661
  /**
13662
- * The account's send history, newest first — what you sent, to how many, and
13662
+ * The account's send history, newest first: what you sent, to how many, and
13663
13663
  * how it landed.
13664
13664
  *
13665
13665
  * Metadata only by construction: the history index does not project the
@@ -13692,13 +13692,13 @@ class NotifyProductModule {
13692
13692
  *
13693
13693
  * `mode: 'grant'` (the default) drops access and leaves the content intact.
13694
13694
  * `mode: 'content'` hard-burns the sealed spark so it is unreadable for
13695
- * everyone — spark-backed sends only: an ingot send merely references the
13695
+ * everyone. Spark-backed sends only: an ingot send merely references the
13696
13696
  * owner's durable vault content, so a content recall of one is a 400, refused
13697
13697
  * before anything is revoked or stopped.
13698
13698
  *
13699
13699
  * Idempotent: a grant already revoked (or already consumed) counts as recalled,
13700
13700
  * so a repeated call converges rather than accumulating failures. One
13701
- * recipient's failure never stops the rest — the response reports every one.
13701
+ * recipient's failure never stops the rest; the response reports every one.
13702
13702
  *
13703
13703
  * PLAINTEXT SENDS CANNOT BE RECALLED (400): they delivered their body inline,
13704
13704
  * in the clear, and minted no grant. There is nothing to revoke, and saying
@@ -13733,7 +13733,7 @@ class NotifyProductModule {
13733
13733
  // ── Status & receipts ───────────────────────────────────────────────────────
13734
13734
  /**
13735
13735
  * The sender's per-recipient delivery rollup for one send: who it reached and
13736
- * how far each recipient got. Metadata only — never the pointer, and no contact
13736
+ * how far each recipient got. Metadata only: never the pointer, and no contact
13737
13737
  * beyond the handle each recipient was addressed by (`recipient_id`).
13738
13738
  *
13739
13739
  * @example
@@ -13767,7 +13767,7 @@ class NotifyProductModule {
13767
13767
  /**
13768
13768
  * Every receipt for one send, each attached to the recipient who produced it.
13769
13769
  * The walk reads the account's receipts back to the send's creation, and no
13770
- * further. One call is bounded: when `truncated` is true it stopped first —
13770
+ * further. One call is bounded: when `truncated` is true it stopped first;
13771
13771
  * pass the returned `cursor` back in to resume exactly where it stopped.
13772
13772
  *
13773
13773
  * @example
@@ -13804,7 +13804,7 @@ class NotifyProductModule {
13804
13804
  * Merge a partial patch onto the account's config overrides. Unknown keys are
13805
13805
  * rejected before any write.
13806
13806
  *
13807
- * Delete a category by storing an explicit `null` TOMBSTONE — that is what keeps
13807
+ * Delete a category by storing an explicit `null` TOMBSTONE: that is what keeps
13808
13808
  * a seeded default from re-appearing on the next merge. The reserved `security`
13809
13809
  * category can neither be removed nor made optional, the promotional
13810
13810
  * categories `marketing` and `product` can never be made required: their email
@@ -13815,7 +13815,7 @@ class NotifyProductModule {
13815
13815
  * The `events` section configures the outbound event webhook: `webhook_url`
13816
13816
  * must be https on a public host, and `secret` (16-256 chars) signs every event
13817
13817
  * body as `X-SparkVault-Signature: hex(HMAC-SHA256(secret, rawBody))`. Both
13818
- * are WRITE-ONLY — reads report `events.webhook_url_set`,
13818
+ * are WRITE-ONLY: reads report `events.webhook_url_set`,
13819
13819
  * `events.webhook_url_host` and `events.secret_set`, never the values. A
13820
13820
  * `webhook_url` on another host or port needs a new `secret` in the same
13821
13821
  * patch (400 `VALIDATION_ERROR` naming `events.secret`), so a secret never
@@ -13835,7 +13835,7 @@ class NotifyProductModule {
13835
13835
  * await sv.products.notify.updateConfig({
13836
13836
  * categories: {
13837
13837
  * weekly_newsletter: { label: 'Weekly newsletter', required: false },
13838
- * marketing: null, // tombstone — remove the seeded default
13838
+ * marketing: null, // tombstone: remove the seeded default
13839
13839
  * },
13840
13840
  * events: {
13841
13841
  * webhook_url: 'https://api.example.com/hooks/sparkvault',
@@ -14948,6 +14948,8 @@ const HELP_DESK_ROLES = Object.freeze(['manager', 'agent', 'trainee']);
14948
14948
  * hold_tickets be assigned, mentioned, alerted and balanced-assigned
14949
14949
  * configure_desk edit the desk's settings, queues, routing, alerts and knowledge base
14950
14950
  * configure_chat the desk's chat intake and new-ticket chat notifications
14951
+ * activate_desk activate the desk on a company vault by presenting its key: the first
14952
+ * activation, a deactivated desk's, and a move to another vault
14951
14953
  * assign_roles choose who holds which role on the desk
14952
14954
  * view_analytics the desk's analytics, its CSV and the operator breakdown
14953
14955
  * manage_requesters block or unblock a requester
@@ -14962,6 +14964,11 @@ const HELP_DESK_ROLES = Object.freeze(['manager', 'agent', 'trainee']);
14962
14964
  * A Trainee keeps no saved replies: they use every one, and their reply is
14963
14965
  * reviewed before it reaches a customer, so no text of theirs reaches one
14964
14966
  * through another operator's reply unreviewed.
14967
+ *
14968
+ * A company admin alone activates a desk: presenting a company vault's key is
14969
+ * the company's consent to the help desk opening every file in that vault, so
14970
+ * no desk role gives it. Deactivating, which only withdraws that access, is
14971
+ * the desk's configurers' (`configure_desk`).
14965
14972
  */
14966
14973
  const EVERY_ROLE = HELP_DESK_ROLES;
14967
14974
  const capability = (roles, { admin = false, requiresAdmin = false } = {}) =>
@@ -14979,6 +14986,7 @@ Object.freeze({
14979
14986
  hold_tickets: capability(EVERY_ROLE),
14980
14987
  configure_desk: capability(['manager'], { admin: true }),
14981
14988
  configure_chat: capability([], { admin: true }),
14989
+ activate_desk: capability([], { admin: true }),
14982
14990
  assign_roles: capability(['manager'], { admin: true }),
14983
14991
  view_analytics: capability(['manager']),
14984
14992
  manage_requesters: capability(['manager']),
@@ -15375,14 +15383,14 @@ function refused(reason) {
15375
15383
  */
15376
15384
  /**
15377
15385
  * Time-to-first-byte bound: how long the download host may take to return
15378
- * response headers. This bounds only the wait for a transfer to start — a
15386
+ * response headers. This bounds only the wait for a transfer to start: a
15379
15387
  * signed link either begins serving promptly or is not going to.
15380
15388
  */
15381
15389
  const DOWNLOAD_TTFB_TIMEOUT_MS = 30000;
15382
15390
  /**
15383
15391
  * Liveness bound on the response body: the longest tolerated gap between two
15384
15392
  * chunks, rearmed on every chunk. Progress, not wall clock, bounds the
15385
- * transfer — a large file over a slow link still completes, while a stalled
15393
+ * transfer: a large file over a slow link still completes, while a stalled
15386
15394
  * connection fails promptly enough to retry.
15387
15395
  */
15388
15396
  const DOWNLOAD_IDLE_TIMEOUT_MS = 60000;
@@ -16064,7 +16072,7 @@ function mapFolder(wire) {
16064
16072
  */
16065
16073
  /**
16066
16074
  * Error class for upload API errors. Inherits `code` and `statusCode` from
16067
- * SparkVaultError — no duplicate `httpStatus` field.
16075
+ * SparkVaultError, with no duplicate `httpStatus` field.
16068
16076
  *
16069
16077
  * A failed transfer request also carries what the transfer policy
16070
16078
  * (`@sparkvault/app-sdk/transfer-retry`) makes of its answer, read where the
@@ -16144,15 +16152,15 @@ function parseLengthHeader(raw) {
16144
16152
  /**
16145
16153
  * Abort a stalled chunk PATCH after this long with no upload progress.
16146
16154
  * XHR's own `timeout` measures total request duration, which would abort a
16147
- * slow-but-progressing 50MB chunk — so a chunk fails only after the
16155
+ * slow-but-progressing 50MB chunk, so a chunk fails only after the
16148
16156
  * connection has been completely silent for the full window.
16149
16157
  */
16150
16158
  const CHUNK_INACTIVITY_TIMEOUT_MS = 60000;
16151
16159
  /**
16152
16160
  * How many consecutive timeouts end the finalization receipt early.
16153
16161
  *
16154
- * A genuinely slow finalize shows up as ONE timeout — the PATCH that started
16155
- * the re-drive — followed by 409s from the writer that is working on it.
16162
+ * A genuinely slow finalize shows up as ONE timeout (the PATCH that started
16163
+ * the re-drive) followed by 409s from the writer that is working on it.
16156
16164
  * Back-to-back timeouts mean nobody is answering at all, and spending the
16157
16165
  * whole retry budget on a black-holed socket would freeze the widget at 100%
16158
16166
  * for minutes with nothing for the user to act on.
@@ -16194,8 +16202,8 @@ function uploadRefusedError(coreCode, message, status, outcome) {
16194
16202
  return new UploadApiError(message ?? REFUSAL_WORDING.get(coreCode) ?? REFUSED_MESSAGE, 'upload_refused', status, { status, coreCode }, outcome);
16195
16203
  }
16196
16204
  /**
16197
- * Core's refusal of a request that stages an upload — a create, a
16198
- * replacement, the widget's initiation — read as the upload's verdict: a final
16205
+ * Core's refusal of a request that stages an upload (a create, a
16206
+ * replacement, the widget's initiation) read as the upload's verdict: a final
16199
16207
  * refusal of Core's (UPLOAD_FINAL_REFUSAL_CODES, the answer's own code: a
16200
16208
  * later staging of the same file superseded it before its token was minted,
16201
16209
  * 410 UPLOAD_SUPERSEDED) is the `upload_refused` a transfer answer naming it
@@ -16452,7 +16460,7 @@ class UploadApi extends SparkVaultApi {
16452
16460
  * Vault upload info by vault id, memoized for the life of this client.
16453
16461
  *
16454
16462
  * The client is built once with the SDK and the map dies with the page, so
16455
- * the memo cannot outlive the page it decorates — which is why there is no
16463
+ * the memo cannot outlive the page it decorates, which is why there is no
16456
16464
  * TTL and no invalidation API to get wrong. It deliberately survives
16457
16465
  * `resetSession()`, alongside the other long-lived per-client state.
16458
16466
  */
@@ -16465,7 +16473,7 @@ class UploadApi extends SparkVaultApi {
16465
16473
  * retries, a cancel aside; a refused API call it raises with its status is
16466
16474
  * Core's verdict, never a transfer's, so of the policy's reading it carries
16467
16475
  * only the floor Core named (`retryAfterMs`), for whoever acts on the
16468
- * refusal — and Core's final refusal of the upload a call stages is that
16476
+ * refusal, and Core's final refusal of the upload a call stages is that
16469
16477
  * upload's `upload_refused` ({@link stagingRefusal}).
16470
16478
  */
16471
16479
  makeError(message, code, statusCode, details, retryAfterMs = null) {
@@ -16509,13 +16517,13 @@ class UploadApi extends SparkVaultApi {
16509
16517
  /**
16510
16518
  * Get vault upload info (public endpoint), fetched at most once per vault.
16511
16519
  *
16512
- * Every widget interaction — `upload()`, `pop()`, `render()`, and each click
16513
- * an `attach()` handler serves — starts by asking for this, and the answer is
16520
+ * Every widget interaction (`upload()`, `pop()`, `render()`, and each click
16521
+ * an `attach()` handler serves) starts by asking for this, and the answer is
16514
16522
  * pure display and geometry: the vault's name, its branding, and the size it
16515
16523
  * advertises. It authorizes nothing. The server re-validates the vault, its
16516
16524
  * upload source, the request origin, and the file size on the POST that
16517
16525
  * actually creates the upload, and that re-validation is the correctness
16518
- * backstop for this whole flow — a memoized answer can never widen what an
16526
+ * backstop for this whole flow: a memoized answer can never widen what an
16519
16527
  * upload is allowed to do, and the backstop must stay in place.
16520
16528
  *
16521
16529
  * Only a successful answer is kept: a rejection evicts its entry so the next
@@ -16588,7 +16596,7 @@ class UploadApi extends SparkVaultApi {
16588
16596
  /**
16589
16597
  * Upload a file to Forge over the TUS resumable protocol (v1.0.0).
16590
16598
  *
16591
- * The single canonical browser transfer path — the upload widget and the
16599
+ * The single canonical browser transfer path: the upload widget and the
16592
16600
  * authenticated `ingots.upload` flow both go through here (one canonical
16593
16601
  * transfer path). Creates the session, PATCHes chunks sized exactly by the
16594
16602
  * server's `X-Chunk-Size` (Forge fixes the geometry at 50MB, which keeps
@@ -16599,7 +16607,7 @@ class UploadApi extends SparkVaultApi {
16599
16607
  * Every answer is read through the transfer policy
16600
16608
  * (`@sparkvault/app-sdk/transfer-retry`) and every retry spends one budget
16601
16609
  * ({@link TusTransfer}). A chunk that fails in transit is resent only from
16602
- * an offset the server just named — a 409's own `Upload-Offset` at once,
16610
+ * an offset the server just named: a 409's own `Upload-Offset` at once,
16603
16611
  * otherwise a HEAD after the backoff ({@link offsetAfterFailure}); a session
16604
16612
  * the server no longer holds throws `session_gone`, which only a new upload
16605
16613
  * recovers from (any code of Core's the server named rides
@@ -16798,7 +16806,7 @@ class UploadApi extends SparkVaultApi {
16798
16806
  await waitToRetry(transfer.budget, failure, transfer.uploadUrl, transfer.sessionSignal);
16799
16807
  }
16800
16808
  /**
16801
- * Confirm the server finalized a fully received upload — the one receipt
16809
+ * Confirm the server finalized a fully received upload: the one receipt
16802
16810
  * every transfer ends on.
16803
16811
  *
16804
16812
  * The server persists the session's final offset BEFORE it finalizes, so a
@@ -16806,7 +16814,7 @@ class UploadApi extends SparkVaultApi {
16806
16814
  * size while finalization failed or is still running, and reporting that as
16807
16815
  * success would hand the user a stored file whose ingot was never published.
16808
16816
  * The zero-length PATCH at the final offset is the server's finalization
16809
- * re-drive — it short-circuits to 204 on an already-finalized session, and
16817
+ * re-drive: it short-circuits to 204 on an already-finalized session, and
16810
16818
  * on a received-but-unfinalized one it answers only after publication.
16811
16819
  *
16812
16820
  * While another request finalizes the receipt answers 409 with
@@ -16838,7 +16846,7 @@ class UploadApi extends SparkVaultApi {
16838
16846
  }
16839
16847
  catch (error) {
16840
16848
  const failure = transferFailure(error);
16841
- // Any answer at all — a 409 above all — proves someone is on the other
16849
+ // Any answer at all (a 409 above all) proves someone is on the other
16842
16850
  // end, so the timeout tally starts over.
16843
16851
  consecutiveTimeouts = failure.code === 'timeout' ? consecutiveTimeouts + 1 : 0;
16844
16852
  if (consecutiveTimeouts >= FINALIZE_MAX_CONSECUTIVE_TIMEOUTS) {
@@ -16893,12 +16901,12 @@ class UploadApi extends SparkVaultApi {
16893
16901
  return this.checkResumeOffset(await this.headUploadOffset(transfer.uploadUrl, RESUME_CHECK), transfer);
16894
16902
  }
16895
16903
  /**
16896
- * Judge an offset the server named for the upload to resume from — a HEAD's,
16897
- * or a 409's `Upload-Offset` — the one place a server-reported resume point
16904
+ * Judge an offset the server named for the upload to resume from (a HEAD's,
16905
+ * or a 409's `Upload-Offset`): the one place a server-reported resume point
16898
16906
  * is judged.
16899
16907
  *
16900
16908
  * Forge commits a chunk before it answers, so a PATCH that died in transit
16901
- * may have landed in full or not at all (never in part — the chunk object
16909
+ * may have landed in full or not at all (never in part: the chunk object
16902
16910
  * is written atomically before the offset advances); only the session's own
16903
16911
  * persisted offset knows which, and the client's arithmetic is worthless
16904
16912
  * here.
@@ -17058,7 +17066,7 @@ class UploadApi extends SparkVaultApi {
17058
17066
  });
17059
17067
  }
17060
17068
  /**
17061
- * Read the server's persisted upload offset via a TUS HEAD request — the one
17069
+ * Read the server's persisted upload offset via a TUS HEAD request: the one
17062
17070
  * place the client asks Forge where a session really stands.
17063
17071
  *
17064
17072
  * @param check - Which caller this read serves; shapes the failure copy.
@@ -17144,7 +17152,7 @@ const NAME_CONFLICT_POLICIES = ['upsert', 'complete_pending', 'refuse', 'new_nam
17144
17152
  *
17145
17153
  * Uploads and downloads run over the single canonical Forge TUS transfer path
17146
17154
  * (shared with the public upload widget), with server-side finalization and
17147
- * download-host allowlisting enforced — no per-size branching.
17155
+ * download-host allowlisting enforced, with no per-size branching.
17148
17156
  */
17149
17157
  class IngotsModule {
17150
17158
  constructor(config, http) {
@@ -17252,16 +17260,16 @@ class IngotsModule {
17252
17260
  }
17253
17261
  }
17254
17262
  /**
17255
- * Send a file's bytes to an upload session — the `uploadUrl` a
17256
- * {@link createUpload} returned — over the resumable transfer every SDK
17263
+ * Send a file's bytes to an upload session (the `uploadUrl` a
17264
+ * {@link createUpload} returned) over the resumable transfer every SDK
17257
17265
  * upload uses. Resolves only once the server confirms the ingot is
17258
17266
  * published, so a resolved promise never stands for a stored file whose
17259
17267
  * ingot never went live.
17260
17268
  *
17261
17269
  * Transient failures are retried inside the transfer; a session the server
17262
17270
  * no longer holds (it expired, was cancelled, or its ingot was removed)
17263
- * rejects with code `session_gone`, and only a new upload session — a new
17264
- * {@link createUpload}, or {@link upload} again — can store the file. An
17271
+ * rejects with code `session_gone`, and only a new upload session (a new
17272
+ * {@link createUpload}, or {@link upload} again) can store the file. An
17265
17273
  * upload the server refused (the account's storage pool cannot take it, a
17266
17274
  * later upload replaced it, or its vault is scheduled for deletion: a 409
17267
17275
  * `VAULT_DELETION_SCHEDULED`, whose session the server keeps until the
@@ -17358,9 +17366,9 @@ class IngotsModule {
17358
17366
  *
17359
17367
  * Creates the upload session, streams the file to Forge over TUS, then
17360
17368
  * confirms the server finalized the upload before resolving. A file the
17361
- * server refused — another upload of it superseded this one, at its create
17369
+ * server refused (another upload of it superseded this one, at its create
17362
17370
  * or while it streamed, the storage pool cannot take it, or its vault is
17363
- * scheduled for deletion (a 409 `VAULT_DELETION_SCHEDULED`) — rejects with
17371
+ * scheduled for deletion (a 409 `VAULT_DELETION_SCHEDULED`)) rejects with
17364
17372
  * code `upload_refused`, as {@link sendUpload} does. An upload that rejects
17365
17373
  * any way but one the server received whole ({@link isReceivedUploadFailure}:
17366
17374
  * the server publishes or ends that one on its own) is given up: the end of
@@ -17759,7 +17767,7 @@ class IngotsModule {
17759
17767
  await this.http.delete(apiPath `/v1/vaults/${vaultId}/ingots/${id}/sharing/invite/${invite}`, { vat: vault.vatToken });
17760
17768
  }
17761
17769
  /**
17762
- * Batch content-HMAC existence check — the pre-upload dedup handshake.
17770
+ * Batch content-HMAC existence check: the pre-upload dedup handshake.
17763
17771
  * Returns which of the supplied vault-keyed HMACs already exist on active
17764
17772
  * ingots in the vault, so callers can skip transferring those bytes.
17765
17773
  *
@@ -17802,7 +17810,7 @@ class IngotsModule {
17802
17810
  }
17803
17811
  /**
17804
17812
  * Request a Forge upload session for a new ingot.
17805
- * Shared by createUpload and upload — the single ingot-create path.
17813
+ * Shared by createUpload and upload: the single ingot-create path.
17806
17814
  */
17807
17815
  async requestUploadSession(vault, body) {
17808
17816
  const payload = {
@@ -17840,7 +17848,7 @@ class IngotsModule {
17840
17848
  * Run the canonical TUS transfer for a created/replaced ingot.
17841
17849
  *
17842
17850
  * The transfer resolves only once the server has confirmed finalization, so
17843
- * the ingot this returns is always a published one — never a stored file
17851
+ * the ingot this returns is always a published one, never a stored file
17844
17852
  * whose ingot never went active.
17845
17853
  */
17846
17854
  async transferAndFinalize(session, minted, file, onProgress) {
@@ -19142,7 +19150,7 @@ function lastExtension(name) {
19142
19150
  * server never reads the plaintext of an uploaded ingot, so the policy splits
19143
19151
  * by where the bytes are: the NAME rule runs on the server at initiate and in
19144
19152
  * the browser before an upload starts; the SNIFF rule runs wherever the bytes
19145
- * are at hand — in the browser over the file's first slice, and on the server
19153
+ * are at hand, in the browser over the file's first slice and on the server
19146
19154
  * over an inbound email's parts. The type a ticket stores a file under, which
19147
19155
  * the MIME registry decides, is server-only: ./attachment-policy-node.js.
19148
19156
  *
@@ -27313,7 +27321,7 @@ function idempotencyHeaders(key) {
27313
27321
  if (key === undefined)
27314
27322
  return undefined;
27315
27323
  if (typeof key !== 'string' || !/^[\x20-\x7E]{8,128}$/.test(key))
27316
- throw new ValidationError('idempotencyKey must contain 8–128 printable ASCII characters');
27324
+ throw new ValidationError('idempotencyKey must contain 8 to 128 printable ASCII characters');
27317
27325
  return { 'Idempotency-Key': key };
27318
27326
  }
27319
27327
  /** Empty pages are legitimate; a repeated cursor is never drained forever. */
@@ -28009,7 +28017,7 @@ function createSecuritySidebar(branding) {
28009
28017
  const STYLE_ID = 'sparkvault-upload-styles';
28010
28018
  /**
28011
28019
  * Inject upload widget styles into the document head.
28012
- * Idempotent: the stylesheet is static and shared by every widget instance —
28020
+ * Idempotent: the stylesheet is static and shared by every widget instance;
28013
28021
  * per-instance behavior (backdrop blur, dark mode) is driven by class toggles.
28014
28022
  */
28015
28023
  function injectUploadStyles() {
@@ -29472,7 +29480,7 @@ class UploadRenderer {
29472
29480
  this.hybridModalInitialized = false;
29473
29481
  // Lifecycle flags: a closed renderer must never render or fire callbacks,
29474
29482
  // and onCancel fires at most once per renderer (mutually exclusive with
29475
- // onError — see cancel()/handleApiError).
29483
+ // onError; see cancel()/handleApiError).
29476
29484
  this.closed = false;
29477
29485
  this.cancelled = false;
29478
29486
  // Counts the uploads this renderer started; an upload whose number is no
@@ -29558,7 +29566,7 @@ class UploadRenderer {
29558
29566
  }
29559
29567
  /**
29560
29568
  * Cancel the flow: tear everything down and fire the cancel contract
29561
- * exactly once. onCancel and onError are mutually exclusive — a deliberate
29569
+ * exactly once. onCancel and onError are mutually exclusive: a deliberate
29562
29570
  * cancellation (user close, programmatic close, or a new upload replacing
29563
29571
  * this renderer) must never surface as an error to the host.
29564
29572
  */
@@ -29582,7 +29590,7 @@ class UploadRenderer {
29582
29590
  this.cancel();
29583
29591
  }
29584
29592
  setState(state) {
29585
- // A closed renderer never renders again — a progress event racing the
29593
+ // A closed renderer never renders again: a progress event racing the
29586
29594
  // teardown must not resurrect the hybrid-mode modal or touch the DOM.
29587
29595
  if (this.closed)
29588
29596
  return;
@@ -29590,7 +29598,7 @@ class UploadRenderer {
29590
29598
  this.viewState = state;
29591
29599
  // Progress events fire many times per second for the whole transfer.
29592
29600
  // While the uploading view is already on screen, mutate its progress
29593
- // nodes in place instead of tearing down and rebuilding the subtree —
29601
+ // nodes in place instead of tearing down and rebuilding the subtree:
29594
29602
  // a full rebuild per event thrashes the DOM and restarts the progress
29595
29603
  // bar's CSS transition and the stage-arrow animation on every tick. The
29596
29604
  // view re-renders once, when every byte is sent and SparkVault is
@@ -30254,7 +30262,7 @@ class UploadRenderer {
30254
30262
  const sent = { bytesUploaded: file.size, bytesTotal: file.size, percentage: 100 };
30255
30263
  this.callbacks.onProgress?.({ ...sent, phase: 'ceremony' });
30256
30264
  this.callbacks.onProgress?.({ ...sent, phase: 'complete' });
30257
- // Silent mode: skip the success screen — fire onSuccess and close so
30265
+ // Silent mode: skip the success screen, fire onSuccess and close so
30258
30266
  // the host site can render its own post-upload UI.
30259
30267
  if (this.options.hideSuccessScreen) {
30260
30268
  this.callbacks.onSuccess(result);
@@ -30329,8 +30337,8 @@ class UploadRenderer {
30329
30337
  handleApiError(error, action = null) {
30330
30338
  // A closed renderer must not surface errors: cancelling mid-transfer
30331
30339
  // aborts the in-flight request, whose 'cancelled' rejection races the
30332
- // teardown. The host has already received onCancel — onCancel and
30333
- // onError are mutually exclusive — and the container is destroyed, so
30340
+ // teardown. The host has already received onCancel (onCancel and
30341
+ // onError are mutually exclusive) and the container is destroyed, so
30334
30342
  // there is nothing left to render into.
30335
30343
  if (this.closed || isCancellationError(error)) {
30336
30344
  return;
@@ -30490,7 +30498,7 @@ class VaultUploadModule {
30490
30498
  }
30491
30499
  // Public-API aliases. The dashboard's vault-edit screen and the SDK docs
30492
30500
  // document sv.vaults.upload.pop({ vaultId }) and
30493
- // sv.vaults.upload.render({ vaultId, target }) — both defer to upload().
30501
+ // sv.vaults.upload.render({ vaultId, target }); both defer to upload().
30494
30502
  /** Open the upload widget as a popup. Equivalent to `upload(options)`. */
30495
30503
  async pop(options) {
30496
30504
  return this.upload(options);
@@ -30664,7 +30672,7 @@ class VaultsModule {
30664
30672
  };
30665
30673
  }
30666
30674
  /**
30667
- * Retain this many previous versions of each file or structured object (0–50,
30675
+ * Retain this many previous versions of each file or structured object (0 to 50,
30668
30676
  * default 0). Interactive company administrators only. Applies on each ingot's
30669
30677
  * next successful content change; retained versions count toward storage usage.
30670
30678
  */
@@ -30722,7 +30730,7 @@ class VaultsModule {
30722
30730
  * Requires the vault's exact name as confirmation, matched case-sensitively.
30723
30731
  * The name is sent base64(UTF-8) as the `X-Confirm-Name-B64` header so a vault
30724
30732
  * named with any Unicode (emoji, CJK, the U+202F in macOS-style names) is
30725
- * deletable — an HTTP header value cannot carry non-latin1 characters.
30733
+ * deletable: an HTTP header value cannot carry non-latin1 characters.
30726
30734
  *
30727
30735
  * @example
30728
30736
  * await sv.vaults.delete('vlt_abc', 'My Vault');
@@ -31028,7 +31036,7 @@ class SparksModule {
31028
31036
  };
31029
31037
  }
31030
31038
  /**
31031
- * Read (and burn) a spark. Reading is destructive — the spark can be read
31039
+ * Read (and burn) a spark. Reading is destructive: the spark can be read
31032
31040
  * exactly once.
31033
31041
  * Supply the source vault's VAT for a Structured Ingots field Spark.
31034
31042
  *
@@ -31234,7 +31242,7 @@ class EntropyModule {
31234
31242
  /**
31235
31243
  * Generate `n` random bytes as a Uint8Array.
31236
31244
  *
31237
- * SECURITY: this returns raw *server* entropy — it is NOT finished key
31245
+ * SECURITY: this returns raw *server* entropy; it is NOT finished key
31238
31246
  * material. Client secret keys MUST hybrid-mix it: XOR the returned bytes with
31239
31247
  * a local CSPRNG (`crypto.getRandomValues`) before use, so the server share
31240
31248
  * alone can never determine the key.
@@ -31242,7 +31250,7 @@ class EntropyModule {
31242
31250
  * @example
31243
31251
  * const serverEntropy = await sv.entropy.generateBytes(32);
31244
31252
  * const localEntropy = crypto.getRandomValues(new Uint8Array(32));
31245
- * // Hybrid-mixed key material — safe to use as a secret key.
31253
+ * // Hybrid-mixed key material, safe to use as a secret key.
31246
31254
  * const key = serverEntropy.map((b, i) => b ^ localEntropy[i]);
31247
31255
  */
31248
31256
  async generateBytes(n) {
@@ -31291,7 +31299,7 @@ function validateEntropyRequest(bytes, format) {
31291
31299
  * Web Push registration. It is
31292
31300
  * not a tenant's inbox for its own end users: a tenant reads its recipients'
31293
31301
  * feeds with `sv.products.notify.getInbox`. The recipient is ALWAYS derived
31294
- * from the session on the server — no method takes a `recipient_id`, and any
31302
+ * from the session on the server: no method takes a `recipient_id`, and any
31295
31303
  * account/recipient a caller might try to supply is ignored. This mirrors
31296
31304
  * `@sparkvault/sdk-mobile`'s notify client; device push registration is
31297
31305
  * intentionally omitted (Expo-only on mobile).
@@ -31333,7 +31341,7 @@ class NotifyModule {
31333
31341
  this.http = http;
31334
31342
  }
31335
31343
  /**
31336
- * The caller's own inbox feed (newest first). Follow `cursor` to page — a
31344
+ * The caller's own inbox feed (newest first). Follow `cursor` to page: a
31337
31345
  * page can come back short of `limit` yet still carry a non-null cursor.
31338
31346
  *
31339
31347
  * @example
@@ -31347,7 +31355,7 @@ class NotifyModule {
31347
31355
  }
31348
31356
  /**
31349
31357
  * Bounded unseen badge count for the caller's own inbox. `capped` true means
31350
- * the true count is at/beyond the ceiling — render "N+".
31358
+ * the true count is at/beyond the ceiling: render "N+".
31351
31359
  *
31352
31360
  * @example
31353
31361
  * const { unread_count, capped } = await sv.notify.getUnreadCount();
@@ -31359,7 +31367,7 @@ class NotifyModule {
31359
31367
  /**
31360
31368
  * Apply a terminal display state to one of the caller's own rows (idempotent).
31361
31369
  * `createdAt` MUST be the row's own `created_at` (round-tripped from the list
31362
- * row) — the id alone cannot address the row.
31370
+ * row); the id alone cannot address the row.
31363
31371
  *
31364
31372
  * @example
31365
31373
  * await sv.notify.markState('ntf_abc', { createdAt: row.created_at, state: 'read' });
@@ -31383,7 +31391,7 @@ class NotifyModule {
31383
31391
  }
31384
31392
  /**
31385
31393
  * Bulk-mark ONE bounded page of the caller's inbox and return the server's
31386
- * payload verbatim. `cursor` comes back non-null while rows remain — thread it
31394
+ * payload verbatim. `cursor` comes back non-null while rows remain: thread it
31387
31395
  * into the next call. `archived` is per-row only (no GSI to page over), so the
31388
31396
  * bulk states are `seen` and `read`.
31389
31397
  *
@@ -31418,10 +31426,10 @@ class NotifyModule {
31418
31426
  * clears the unseen marker too, so the badge zeroes with it. Idempotent.
31419
31427
  *
31420
31428
  * `complete` is false when the loop stopped at the page bound with rows still
31421
- * unmarked — an inbox deeper than the bound finishes on a second call. Without
31429
+ * unmarked: an inbox deeper than the bound finishes on a second call. Without
31422
31430
  * it a truncated drain looks exactly like a finished one.
31423
31431
  *
31424
- * An error mid-drain propagates — the pages already marked stay marked, and a
31432
+ * An error mid-drain propagates: the pages already marked stay marked, and a
31425
31433
  * re-run picks up the remainder.
31426
31434
  *
31427
31435
  * @example
@@ -31453,7 +31461,7 @@ class NotifyModule {
31453
31461
  }
31454
31462
  /**
31455
31463
  * The platform VAPID public key for `pushManager.subscribe()`. `configured`
31456
- * is false until the server-side VAPID keypair is provisioned — hide the
31464
+ * is false until the server-side VAPID keypair is provisioned: hide the
31457
31465
  * enable-notifications affordance while false.
31458
31466
  */
31459
31467
  async getWebPushKey() {
@@ -31567,8 +31575,8 @@ class NotifyModule {
31567
31575
  }
31568
31576
  }
31569
31577
  // A subscription made against the current key is reused: registering it
31570
- // again refreshes its server TTL. One made against another key is dead — its
31571
- // push service refuses every push signed with this one — so it is replaced.
31578
+ // again refreshes its server TTL. One made against another key is dead (its
31579
+ // push service refuses every push signed with this one), so it is replaced.
31572
31580
  const held = await registration.pushManager.getSubscription();
31573
31581
  const existing = held && isBoundToKey(held, applicationServerKey) ? held : null;
31574
31582
  if (held && !existing) {
@@ -31740,7 +31748,7 @@ class SparkVault {
31740
31748
  return new SparkVault(config);
31741
31749
  }
31742
31750
  /**
31743
- * Whether a sign-in needs completing on this page load — a returned handoff
31751
+ * Whether a sign-in needs completing on this page load: a returned handoff
31744
31752
  * fragment, or a popup whose result was lost (a mobile opener-tab discard).
31745
31753
  * Side effect-free and instance-free, so a host that defers SDK init for
31746
31754
  * performance can cheaply decide whether to boot the SDK and call
@@ -31752,7 +31760,7 @@ class SparkVault {
31752
31760
  }
31753
31761
  /** Get the SDK version */
31754
31762
  static get version() {
31755
- return '17.0.1';
31763
+ return '17.0.2';
31756
31764
  }
31757
31765
  }
31758
31766
  if (typeof window !== 'undefined') {