@sparkvault/sdk-js 17.0.1 → 18.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +8 -8
  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 +255 -229
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.ts +153 -161
  11. package/dist/index.mjs +255 -229
  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/help-desk/client.d.ts +0 -4
  18. package/dist/products/help-desk/kb-types.d.ts +1 -2
  19. package/dist/products/help-desk/types.d.ts +1 -5
  20. package/dist/products/help-desk/widget-identity.d.ts +2 -2
  21. package/dist/products/identity/api.d.ts +5 -5
  22. package/dist/products/identity/dialog-launcher.d.ts +2 -2
  23. package/dist/products/identity/handlers/otp-handler.d.ts +1 -1
  24. package/dist/products/identity/handlers/passkey-handler.d.ts +4 -4
  25. package/dist/products/identity/index.d.ts +11 -11
  26. package/dist/products/identity/renderer.d.ts +10 -10
  27. package/dist/products/identity/types.d.ts +10 -10
  28. package/dist/products/identity/utils.d.ts +3 -3
  29. package/dist/products/identity/views/backup-verify.d.ts +3 -3
  30. package/dist/products/identity/views/error.d.ts +1 -1
  31. package/dist/products/identity/views/identity-input.d.ts +1 -1
  32. package/dist/products/identity/views/method-select.d.ts +1 -1
  33. package/dist/products/identity/views/origin-not-allowed.d.ts +2 -2
  34. package/dist/products/identity/views/passkey-auto.d.ts +1 -1
  35. package/dist/products/identity/views/product-not-configured.d.ts +2 -2
  36. package/dist/products/identity/views/service-unavailable.d.ts +1 -1
  37. package/dist/products/index.d.ts +1 -1
  38. package/dist/products/notify/index.d.ts +21 -21
  39. package/dist/products/notify/types.d.ts +65 -65
  40. package/dist/products/structured-ingots/types.d.ts +2 -2
  41. package/dist/sparks/index.d.ts +1 -1
  42. package/dist/sparkvault.js +1 -1
  43. package/dist/sparkvault.js.map +1 -1
  44. package/dist/utils/dom.d.ts +3 -3
  45. package/dist/vaults/index.d.ts +2 -2
  46. package/dist/vaults/types.d.ts +2 -2
  47. package/dist/vaults/upload/api.d.ts +14 -14
  48. package/dist/vaults/upload/renderer.d.ts +1 -1
  49. package/dist/vaults/upload/styles.d.ts +1 -1
  50. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -88,7 +88,7 @@ function givenUpUploadId({ created, uploadId }) {
88
88
  * The codes Core's activation refuses an upload with, which Forge's refusal
89
89
  * map reads (the status is Core's):
90
90
  * - UPLOAD_CONTRACT_MISMATCH (409): a finalize or session from another
91
- * publication contract than Core's, a mixed deployment that converges — the
91
+ * publication contract than Core's, a mixed deployment that converges, so the
92
92
  * upload is kept and its finalize tried again.
93
93
  * - UPLOAD_PROTOCOL_RETIRED (410): a session from a contract Core no longer
94
94
  * publishes, which never can be.
@@ -834,7 +834,7 @@ class ValidationError extends SparkVaultError {
834
834
  }
835
835
  }
836
836
  /**
837
- * Plan required gate (402 PLAN_REQUIRED) — the account has no active
837
+ * Plan required gate (402 PLAN_REQUIRED): the account has no active
838
838
  * subscription and attempted a billable/create action. Surface a subscribe CTA
839
839
  * to admins, or "ask your account admin" to members.
840
840
  */
@@ -865,7 +865,7 @@ class UsageCreditFundingReviewError extends SparkVaultError {
865
865
  }
866
866
  }
867
867
  /**
868
- * Quota exceeded gate (402 QUOTA_EXCEEDED) — a pooled-capacity limit is
868
+ * Quota exceeded gate (402 QUOTA_EXCEEDED): a pooled-capacity limit is
869
869
  * exhausted. `resource` identifies which pool so callers can point the CTA at
870
870
  * the right capacity block.
871
871
  */
@@ -881,7 +881,7 @@ class QuotaExceededError extends SparkVaultError {
881
881
  }
882
882
  /**
883
883
  * Notify subscription gate (403 NOTIFY_SUBSCRIPTION_REQUIRED or
884
- * NOTIFY_PROJECT_SUBSCRIPTION_REQUIRED) — the account or selected project
884
+ * NOTIFY_PROJECT_SUBSCRIPTION_REQUIRED): the account or selected project
885
885
  * does not hold Notify and attempted a send that names no accepted send's
886
886
  * `sendId` (a replay of an accepted send, the same request under its `sendId`,
887
887
  * is answered with the stored send), or a config save that selects a new
@@ -1149,12 +1149,24 @@ const SPARKVAULT_FILES_HOST = 'files.sv';
1149
1149
  /**
1150
1150
  * The help-desk domain: each organization's help desk lives at a host under
1151
1151
  * it, and every custom help-desk domain points its CNAME at it. The whole
1152
- * subtree is reserved — no organization claims a name in it as its own
1153
- * domain — but none of its hosts is owned: a tenant's help-desk host is never
1152
+ * subtree is reserved (no organization claims a name in it as its own
1153
+ * domain), but none of its hosts is owned: a tenant's help-desk host is never
1154
1154
  * trusted the way a platform host is (isSparkVaultOwnedHostname).
1155
1155
  */
1156
1156
  const SPARKVAULT_HELP_DESK_DOMAIN = 'help.sv';
1157
1157
 
1158
+ /**
1159
+ * The Help Desk sign-in host (`https://signin.help.sv`): the one fixed host of
1160
+ * the window Help Desk's own sign-in opens (`/{desk_id}/{challenge_id}`) and
1161
+ * of the one redirect URI its Identity client registers (`/callback`). Its
1162
+ * label is a reserved organization handle (organization-handle.js), so no desk
1163
+ * can hold it, and the help.sv Worker serves the portal's shell on it as on
1164
+ * every host of the domain. Like every host under the help-desk domain it is
1165
+ * reserved and not owned (isSparkVaultOwnedHostname). Core takes the window's
1166
+ * steps only from exactly this origin.
1167
+ */
1168
+ const SPARKVAULT_HELP_DESK_SIGN_IN_HOST = `signin.${SPARKVAULT_HELP_DESK_DOMAIN}`;
1169
+
1158
1170
  /**
1159
1171
  * Notify's mail domain: each organization's Notify mail goes from a host under
1160
1172
  * it, as its help desk's goes from one under the help-desk domain. On the web
@@ -1370,7 +1382,7 @@ class SparkVaultApi {
1370
1382
  constructor(timeoutMs = DEFAULT_TIMEOUT_MS$1) {
1371
1383
  /**
1372
1384
  * Abort controller for the current session. Replaced by resetSession()
1373
- * at the start of every user-facing session — an aborted controller can
1385
+ * at the start of every user-facing session, so an aborted controller can
1374
1386
  * never leak into the next session.
1375
1387
  */
1376
1388
  this.closeController = new AbortController();
@@ -1384,7 +1396,7 @@ class SparkVaultApi {
1384
1396
  isAborted() {
1385
1397
  return this.closeController.signal.aborted;
1386
1398
  }
1387
- /** The current session's abort signal — for callers that need to wire it into XHR/etc. */
1399
+ /** The current session's abort signal, for callers that need to wire it into XHR/etc. */
1388
1400
  getAbortSignal() {
1389
1401
  return this.closeController.signal;
1390
1402
  }
@@ -1434,7 +1446,7 @@ class SparkVaultApi {
1434
1446
  * transport shares.
1435
1447
  */
1436
1448
  rawRequest(url, options) {
1437
- // Only send Content-Type when there's actually a body — otherwise GETs
1449
+ // Only send Content-Type when there's actually a body; otherwise GETs
1438
1450
  // with no payload would carry a misleading content-type header.
1439
1451
  const headers = { Accept: 'application/json' };
1440
1452
  if (options.body !== undefined)
@@ -1665,7 +1677,7 @@ class HttpClient {
1665
1677
  * and every other answer is the base error under the service's own code.
1666
1678
  * Each carries the service's code (`serviceCode`), which tells apart two
1667
1679
  * refusals that share a typed class's `code`, and the answer's `Retry-After`
1668
- * (`retryAfterMs`), the floor for whoever retries it — the SDK's own
1680
+ * (`retryAfterMs`), the floor for whoever retries it: the SDK's own
1669
1681
  * transfers when the answer is a download link's mint, and the host page
1670
1682
  * otherwise.
1671
1683
  */
@@ -1691,7 +1703,7 @@ class HttpClient {
1691
1703
  case 403:
1692
1704
  // A Notify send, or a config save selecting a new sending domain, refused
1693
1705
  // because the account does not hold Notify is a billing gate, not a
1694
- // credential problem — give it its own catchable type.
1706
+ // credential problem; give it its own catchable type.
1695
1707
  if (code === 'NOTIFY_SUBSCRIPTION_REQUIRED' || code === 'NOTIFY_PROJECT_SUBSCRIPTION_REQUIRED') {
1696
1708
  return new NotifySubscriptionRequiredError(message, details, retryAfterMs, code);
1697
1709
  }
@@ -2705,9 +2717,9 @@ function identityTypesParam(types) {
2705
2717
  return types ? { [SIGNIN_IDENTITY_TYPES.param]: formatSigninIdentityTypes(types) } : {};
2706
2718
  }
2707
2719
  /**
2708
- * This page as a navigation return target: origin, path, and query — the query
2709
- * carries the page's own state (app routing, or the sign-in page's validated
2710
- * destination) — without the fragment, which is the channel a result returns
2720
+ * This page as a navigation return target: origin, path, and query (the query
2721
+ * carries the page's own state, whether app routing or the sign-in page's validated
2722
+ * destination), without the fragment, which is the channel a result returns
2711
2723
  * in.
2712
2724
  */
2713
2725
  function currentPageReturnUrl() {
@@ -2920,7 +2932,7 @@ class IdentityApi extends SparkVaultApi {
2920
2932
  }
2921
2933
  /**
2922
2934
  * Check whether the SVID resolved from an email or phone has registered
2923
- * passkeys (`has_passkey`; cross-tenant — single global RP), for a
2935
+ * passkeys (`has_passkey`; cross-tenant, single global RP), for a
2924
2936
  * verification that admits passkeys.
2925
2937
  */
2926
2938
  async checkPasskey(identity, identityType = 'email', authContext) {
@@ -2929,7 +2941,7 @@ class IdentityApi extends SparkVaultApi {
2929
2941
  }
2930
2942
  /**
2931
2943
  * Redeem a one-time sign-in code (with its PKCE verifier) for the sign-in
2932
- * result — the shared return leg for `flow: 'redirect'` and the silent SSO
2944
+ * result: the shared return leg for `flow: 'redirect'` and the silent SSO
2933
2945
  * self-heal. The code arrives in the URL fragment after the hosted page
2934
2946
  * navigates back; it is single-use, 60s-lived, and bound to this page's
2935
2947
  * origin server-side.
@@ -3065,7 +3077,7 @@ class IdentityApi extends SparkVaultApi {
3065
3077
  }
3066
3078
  /**
3067
3079
  * Skip a post-login recommendation, suppressing it server-side for 30 days.
3068
- * Authorized by the login's verification token. Best-effort — a failure here
3080
+ * Authorized by the login's verification token. Best-effort: a failure here
3069
3081
  * must not block completing the login.
3070
3082
  */
3071
3083
  async dismissRecommendation(params) {
@@ -3140,7 +3152,7 @@ class IdentityApi extends SparkVaultApi {
3140
3152
  });
3141
3153
  }
3142
3154
  /**
3143
- * Claim the SparkLink click's result by kindling — the WebSocket-loss
3155
+ * Claim the SparkLink click's result by kindling, the WebSocket-loss
3144
3156
  * fallback. The SDK calls this when its socket was suspended with the tab and
3145
3157
  * it refocuses. Returns what the click produced (a completed login, or its
3146
3158
  * second-factor challenge), or null while still pending (not yet clicked) or
@@ -3176,7 +3188,7 @@ function signinRefParam(signinRef) {
3176
3188
  * Read a SparkLink result event. The WebSocket push and the kindling reclaim
3177
3189
  * carry the same server-built event, so this is the one reader for both.
3178
3190
  * Returns null for anything that is not a usable result: a still-pending
3179
- * reclaim, or an event missing what its type requires — a challenge without a
3191
+ * reclaim, or an event missing what its type requires, such as a challenge without a
3180
3192
  * ticket, or a completed login with neither a token (default flow) nor the
3181
3193
  * redirect that continues it (OIDC hosted login).
3182
3194
  */
@@ -3266,7 +3278,7 @@ class IdentityApiError extends SparkVaultError {
3266
3278
  * script, and the invisible formatting marks a contacts app wraps a number in.
3267
3279
  * The separators and marks are dropped. Anything else is refused, never
3268
3280
  * dropped: stripping it would fold part of the text into the number and deliver
3269
- * to someone else's line — a letter or a dial-control character (',' and ';'
3281
+ * to someone else's line. A letter or a dial-control character (',' and ';'
3270
3282
  * pause, '#' and '*' are keypad tones) carries an extension ("x2", ",89"), a
3271
3283
  * digit of another script ('٧', '7') is a digit the ASCII read would silently
3272
3284
  * lose, and a '+' after a digit declares nothing.
@@ -3280,7 +3292,7 @@ class IdentityApiError extends SparkVaultError {
3280
3292
  /** A '+' before any digit: the caller declared the country code. */
3281
3293
  const DECLARED_COUNTRY_CODE = /^\D*\+/;
3282
3294
 
3283
- /** E.164 digits once a country code is declared: 8–15, never a leading 0. */
3295
+ /** E.164 digits once a country code is declared: 8 to 15, never a leading 0. */
3284
3296
  const E164_DIGITS = /^[1-9]\d{7,14}$/;
3285
3297
 
3286
3298
  /** Invisible formatting marks (bidi embeddings, zero-width characters), in any number. */
@@ -3769,12 +3781,12 @@ class VerificationState {
3769
3781
  * abandoned-window backstop, and a `window.closed` poll that surfaces a manual
3770
3782
  * close as a cancellation.
3771
3783
  */
3772
- /** Default popup dimensions — a centered login/ceremony window. */
3784
+ /** Default popup dimensions: a centered login/ceremony window. */
3773
3785
  const DEFAULT_WIDTH = 480;
3774
3786
  const DEFAULT_HEIGHT = 640;
3775
3787
  /**
3776
3788
  * Default timeout for popup operations: 30 minutes. This is an
3777
- * abandoned-window backstop — never a liveness gate. A person mid-login is
3789
+ * abandoned-window backstop, never a liveness gate. A person mid-login is
3778
3790
  * often slow for legitimate reasons (waiting out an OTP resend backoff,
3779
3791
  * fetching their phone for a cross-device passkey, hunting for an alternative
3780
3792
  * method), and yanking the window away from them mid-flow is far worse than
@@ -3792,7 +3804,7 @@ const CLOSED_POLL_INTERVAL_MS = 500;
3792
3804
  * (host page serves `Cross-Origin-Opener-Policy: same-origin`) flips to
3793
3805
  * `closed` on the first poll while the real window stays open in front of the
3794
3806
  * user; a human closing a window they asked for takes longer than this. A slow
3795
- * network can only delay the ready ping — it never makes `closed` true — so a
3807
+ * network can only delay the ready ping (it never makes `closed` true), so a
3796
3808
  * legitimate popup on a slow connection cannot trip this.
3797
3809
  */
3798
3810
  const SEVERED_DETECT_WINDOW_MS = 2500;
@@ -3812,7 +3824,7 @@ class PopupLauncher {
3812
3824
  return new Promise((resolve, reject) => {
3813
3825
  const left = Math.round((window.screen.width - width) / 2);
3814
3826
  const top = Math.round((window.screen.height - height) / 2);
3815
- // Synchronous open inside the caller's user gesture — any await before
3827
+ // Synchronous open inside the caller's user gesture: any await before
3816
3828
  // this point would let the browser treat the popup as programmatic and
3817
3829
  // block it.
3818
3830
  const popup = window.open(options.url, options.windowName, `width=${width},height=${height},left=${left},top=${top},popup=1`);
@@ -3830,7 +3842,7 @@ class PopupLauncher {
3830
3842
  clearInterval(pollClosedId);
3831
3843
  };
3832
3844
  const handleMessage = (event) => {
3833
- // Only trust the server-validated Identity origin — never the broader
3845
+ // Only trust the server-validated Identity origin, never the broader
3834
3846
  // sparkvault.com family (XSS or subdomain-takeover relay).
3835
3847
  if (event.origin !== options.trustedOrigin) {
3836
3848
  return;
@@ -3868,7 +3880,7 @@ class PopupLauncher {
3868
3880
  settled = true;
3869
3881
  cleanup();
3870
3882
  // `closed` going true right after open, before the page ever pinged,
3871
- // is a dead handle (COOP severance — see SEVERED_DETECT_WINDOW_MS),
3883
+ // is a dead handle (COOP severance; see SEVERED_DETECT_WINDOW_MS),
3872
3884
  // not a person closing the window: the real window is still open but
3873
3885
  // can never postMessage back, so retrying the popup can never work.
3874
3886
  if (!readyReceived && Date.now() - openedAt <= SEVERED_DETECT_WINDOW_MS) {
@@ -3900,7 +3912,7 @@ const POPUP_WIDTH = 450;
3900
3912
  const POPUP_HEIGHT = 500;
3901
3913
  /**
3902
3914
  * Device-level hint the Identity API sets on every completed passkey login
3903
- * (products/product-identity/src/utils/passkey-hint-cookie.js — the cookie
3915
+ * (products/product-identity/src/utils/passkey-hint-cookie.js; the cookie
3904
3916
  * NAME is the wire contract between the two). Host-locked to the Identity
3905
3917
  * origin and deliberately JS-readable, it means "a passkey login has completed
3906
3918
  * in this browser", which is what licenses auto-starting the discoverable
@@ -3967,7 +3979,7 @@ class PasskeyHandler {
3967
3979
  * Verify user with an existing passkey.
3968
3980
  *
3969
3981
  * On the Identity origin (the hosted widget / hosted login) the ceremony runs
3970
- * inline — same-origin with the RP id, one tap, no popup. On a third-party
3982
+ * inline: same-origin with the RP id, one tap, no popup. On a third-party
3971
3983
  * origin the rpId would not match the document, so it falls back to the popup
3972
3984
  * served from the Identity origin. (Verification, unlike registration, is
3973
3985
  * supported in cross-origin iframes, so the embedded widget uses the inline
@@ -3981,7 +3993,7 @@ class PasskeyHandler {
3981
3993
  }
3982
3994
  /**
3983
3995
  * True when the SDK is running ON the Identity origin and the browser exposes
3984
- * WebAuthn — the only place an inline ceremony's rpId matches the document.
3996
+ * WebAuthn, the only place an inline ceremony's rpId matches the document.
3985
3997
  */
3986
3998
  canRunCeremonyInline() {
3987
3999
  return typeof window !== 'undefined'
@@ -3992,8 +4004,8 @@ class PasskeyHandler {
3992
4004
  /**
3993
4005
  * True when the discoverable ceremony may be fired WITHOUT a user gesture:
3994
4006
  * the flow is running on the Identity origin (the inline ceremony needs no
3995
- * popup, so no gesture) AND this browser carries the passkey-hint cookie —
3996
- * a passkey login has completed here before. First visits never see an
4007
+ * popup, so no gesture) AND this browser carries the passkey-hint cookie
4008
+ * (a passkey login has completed here before). First visits never see an
3997
4009
  * unprompted system sheet.
3998
4010
  */
3999
4011
  canAutoVerify() {
@@ -4331,7 +4343,7 @@ class OtpHandler {
4331
4343
  signinRef: this.state.signinRef,
4332
4344
  });
4333
4345
  // Primary factor accepted, but the account requires a second factor.
4334
- // Not a success and not a retry — hand the ticket up to drive the 2FA step.
4346
+ // Not a success and not a retry: hand the ticket up to drive the 2FA step.
4335
4347
  if (response.second_factor_required && response.ticket) {
4336
4348
  return {
4337
4349
  success: false,
@@ -4866,7 +4878,7 @@ function methodIconGlyph(iconName) {
4866
4878
  case 'users':
4867
4879
  return createUsersIcon();
4868
4880
  default:
4869
- // Neutral placeholder — deliberately NOT the email envelope, so an
4881
+ // Neutral placeholder, deliberately NOT the email envelope, so an
4870
4882
  // unmapped icon name surfaces the gap instead of impersonating email.
4871
4883
  return createGenericMethodIcon();
4872
4884
  }
@@ -4882,7 +4894,7 @@ function createEmailIcon() {
4882
4894
  return svg;
4883
4895
  }
4884
4896
  function createSmsIcon() {
4885
- // Chat bubble — the text-message channel, distinct from the voice-call
4897
+ // Chat bubble: the text-message channel, distinct from the voice-call
4886
4898
  // handset (createPhoneIcon) so SMS and voice OTP read differently.
4887
4899
  const svg = createSvgElement('0 0 20 20', 20, 20);
4888
4900
  svg.setAttribute('stroke', 'currentColor');
@@ -4905,7 +4917,7 @@ function createPhoneIcon() {
4905
4917
  return svg;
4906
4918
  }
4907
4919
  function createGenericMethodIcon() {
4908
- // Neutral rounded badge with a center dot — a placeholder for an unmapped
4920
+ // Neutral rounded badge with a center dot: a placeholder for an unmapped
4909
4921
  // icon name, deliberately unlike any real method glyph.
4910
4922
  const svg = createSvgElement('0 0 20 20', 20, 20);
4911
4923
  svg.setAttribute('stroke', 'currentColor');
@@ -6077,7 +6089,7 @@ class PasskeyView {
6077
6089
  *
6078
6090
  * Shown behind the browser's passkey sheet while an auto-started discoverable
6079
6091
  * ceremony runs (returning browsers carrying the passkey-hint cookie). The
6080
- * ceremony was fired without a click, so this screen has no action button —
6092
+ * ceremony was fired without a click, so this screen has no action button,
6081
6093
  * only a live status and an escape hatch to the identifier form for anyone
6082
6094
  * who wants a different method (or whose sheet hangs).
6083
6095
  */
@@ -6202,7 +6214,7 @@ class PasskeyPromptView {
6202
6214
  * Includes a "Not now" skip that suppresses this method's prompt for 30 days
6203
6215
  * (handled by the renderer).
6204
6216
  *
6205
- * Sibling of PasskeyPromptView — same low-friction, skippable shape.
6217
+ * Sibling of PasskeyPromptView: same low-friction, skippable shape.
6206
6218
  */
6207
6219
  class BackupVerifyView {
6208
6220
  constructor(props) {
@@ -6526,7 +6538,7 @@ class SparkLinkWaitingView {
6526
6538
  * Professional enterprise-quality error display with clear visual hierarchy.
6527
6539
  */
6528
6540
  /**
6529
- * Error codes that mean the site owner's Identity access is blocked — the
6541
+ * Error codes that mean the site owner's Identity access is blocked: the
6530
6542
  * free trial was exhausted or expired, or a paid plan hit its capacity wall.
6531
6543
  * The end user can do nothing about these, so the ErrorView renders a friendly,
6532
6544
  * non-leaky interstitial (no "Try Again", no debug code badge) exactly like
@@ -6643,7 +6655,7 @@ class ErrorView {
6643
6655
  contentSection.appendChild(title);
6644
6656
  contentSection.appendChild(message);
6645
6657
  if (isGenuine) {
6646
- // Error code badge — useful for debugging genuine errors only.
6658
+ // Error code badge, useful for debugging genuine errors only.
6647
6659
  const codeBadge = document.createElement('div');
6648
6660
  codeBadge.className = 'sv-error-code-badge';
6649
6661
  const codeLabel = document.createElement('span');
@@ -6754,7 +6766,7 @@ function withAlpha(hex, alpha) {
6754
6766
  * Service Unavailable View
6755
6767
  *
6756
6768
  * Shown when the identity config endpoint is unreachable.
6757
- * Clean, professional, branded — no error codes or technical jargon.
6769
+ * Clean, professional, branded, with no error codes or technical jargon.
6758
6770
  */
6759
6771
  function createShieldIcon() {
6760
6772
  const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
@@ -6853,8 +6865,8 @@ class ServiceUnavailableView {
6853
6865
  *
6854
6866
  * Full-dialog terminal screen shown when the SparkVault Identity Product has
6855
6867
  * not been configured for the account that the JS SDK is configured against. The
6856
- * audience is the website owner / developer — this is a misconfiguration
6857
- * surface, not an end-user error — so the dialog drops customer branding and
6868
+ * audience is the website owner / developer: this is a misconfiguration
6869
+ * surface, not an end-user error, so the dialog drops customer branding and
6858
6870
  * presents itself as an unmistakable SparkVault notice.
6859
6871
  */
6860
6872
  const ACTIVATION_URL = 'https://app.sparkvault.com/products/identity';
@@ -7019,8 +7031,8 @@ class ProductNotConfiguredView {
7019
7031
  *
7020
7032
  * Full-dialog terminal screen shown when the embedding site's origin is not in
7021
7033
  * the account's verified-domains allowlist. The audience is the website owner /
7022
- * developer — this is a misconfiguration surface, not an end-user error, and it
7023
- * is permanent (retrying never clears an origin block) — so the dialog drops
7034
+ * developer: this is a misconfiguration surface, not an end-user error, and it
7035
+ * is permanent (retrying never clears an origin block), so the dialog drops
7024
7036
  * customer branding, offers no "Try Again", names the blocked origin, and
7025
7037
  * points to the place that fixes it. Reuses the SparkVault-notice styling from
7026
7038
  * the product-not-configured view.
@@ -7043,7 +7055,7 @@ function createBadge() {
7043
7055
  surface.setAttribute('stroke', DS.slate200);
7044
7056
  surface.setAttribute('stroke-width', '1');
7045
7057
  svg.appendChild(surface);
7046
- // Globe with a slash — an unrecognized domain.
7058
+ // Globe with a slash: an unrecognized domain.
7047
7059
  const globe = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
7048
7060
  globe.setAttribute('cx', '32');
7049
7061
  globe.setAttribute('cy', '32');
@@ -7146,7 +7158,7 @@ class OriginNotAllowedView {
7146
7158
  ownerLabel.textContent = 'Are you the site owner?';
7147
7159
  const ownerHint = document.createElement('span');
7148
7160
  ownerHint.className = 'sv-not-activated-owner-hint';
7149
- // textContent (not innerHTML) — the origin is server-reported but we never
7161
+ // textContent (not innerHTML): the origin is server-reported but we never
7150
7162
  // trust it into the DOM as markup.
7151
7163
  ownerHint.textContent = this.props.origin
7152
7164
  ? `Add ${this.props.origin} to your verified domains in SparkVault, then reload this page.`
@@ -7240,7 +7252,7 @@ function progressHook() {
7240
7252
  function progressStart() { progressHook()?.start(); }
7241
7253
  function progressDone() { progressHook()?.done(); }
7242
7254
  /**
7243
- * End-user copy for a blocked Identity. Intentionally non-leaky — it never names
7255
+ * End-user copy for a blocked Identity. Intentionally non-leaky: it never names
7244
7256
  * the trial, billing, usage, or any owner-facing internal. When the site's
7245
7257
  * company name is known it is surfaced so the screen reads as the site's own and
7246
7258
  * the visitor is pointed back to the site for help (never to SparkVault). The
@@ -7345,7 +7357,7 @@ class IdentityRenderer {
7345
7357
  * Seed the verification identity from the render options, deriving the
7346
7358
  * channel (email vs phone) from the value itself rather than trusting which
7347
7359
  * option field carried it. The hosted login forwards a simple-mode identity
7348
- * hint — which may be a phone number — as `email`; keying off the value keeps
7360
+ * hint (which may be a phone number) as `email`; keying off the value keeps
7349
7361
  * the method list AND the OTP delivery target aligned with the real channel
7350
7362
  * instead of falling back to the email methods. Normalizes to E.164 /
7351
7363
  * lowercased email so the code goes to the canonical identifier.
@@ -7371,7 +7383,7 @@ class IdentityRenderer {
7371
7383
  }
7372
7384
  /**
7373
7385
  * True when the identifier is fixed by the flow and the person must prove
7374
- * that exact identity — the invite / simple-redirect case. There is no
7386
+ * that exact identity: the invite / simple-redirect case. There is no
7375
7387
  * identifier-entry step to return to, so the picker must not offer a
7376
7388
  * "change identity" back link that would let them verify a different
7377
7389
  * identifier than the one they were invited as.
@@ -7418,7 +7430,7 @@ class IdentityRenderer {
7418
7430
  if (this.api.isConfigPreloaded()) {
7419
7431
  // Config fetch already started - race it against a 50ms timeout
7420
7432
  // If config is ready (or almost ready), we skip the loading flash.
7421
- // A rejected preload (e.g. product_not_configured) must not abort start() —
7433
+ // A rejected preload (e.g. product_not_configured) must not abort start():
7422
7434
  // swallow here and let the in-modal try/catch below route to the
7423
7435
  // correct error view.
7424
7436
  const timeoutPromise = new Promise((resolve) => setTimeout(() => resolve(null), 50));
@@ -7467,8 +7479,8 @@ class IdentityRenderer {
7467
7479
  * would otherwise escape. In the default embedded/dialog mode that escape is
7468
7480
  * exactly the "closes silently" failure: the host's `onError` runs, the
7469
7481
  * embedding page tears the iframe down, and the user is left with no message.
7470
- * Render the error in the SparkVault dialog — consistent with how every
7471
- * in-flow error already behaves — so the dialog stays open and the user can
7482
+ * Render the error in the SparkVault dialog, consistent with how every
7483
+ * in-flow error already behaves, so the dialog stays open and the user can
7472
7484
  * retry or close it (→ onCancel).
7473
7485
  */
7474
7486
  showStartupError(error) {
@@ -7482,7 +7494,7 @@ class IdentityRenderer {
7482
7494
  * Map a config-fetch error to the appropriate terminal view.
7483
7495
  *
7484
7496
  * Two failures are permanent developer-misconfigurations, not transient
7485
- * outages, so they get dedicated terminal screens (no "Try Again" — retrying
7497
+ * outages, so they get dedicated terminal screens (no "Try Again", since retrying
7486
7498
  * can never clear them) instead of the generic service-unavailable view:
7487
7499
  * - `product_not_configured`: the account has not configured Identity.
7488
7500
  * - `ORIGIN_NOT_ALLOWED`: this site's domain is not on the account's
@@ -7751,7 +7763,7 @@ class IdentityRenderer {
7751
7763
  }
7752
7764
  // Returning browser on the Identity origin (passkey-hint cookie present):
7753
7765
  // auto-start the discoverable ceremony instead of asking for an identifier
7754
- // — the Google-style one-touch return. A cancel lands on the identifier
7766
+ // (the Google-style one-touch return). A cancel lands on the identifier
7755
7767
  // form, which keeps a "Sign in with a passkey" way back in. A provider
7756
7768
  // that starts on its own once the pending reference lands goes first, as
7757
7769
  // with the reference held (startWithFederation), so the identifier form
@@ -7780,7 +7792,7 @@ class IdentityRenderer {
7780
7792
  * Fired on open for returning browsers and from the identifier form's
7781
7793
  * "Sign in with a passkey" shortcut. Anything short of a terminal outcome
7782
7794
  * (dismissed sheet, no credential on the device, transient failure) falls
7783
- * back to the identifier form with no error banner — the person simply
7795
+ * back to the identifier form with no error banner: the person simply
7784
7796
  * lands where a first-time visitor starts.
7785
7797
  */
7786
7798
  async launchDiscoverableVerify() {
@@ -8085,7 +8097,7 @@ class IdentityRenderer {
8085
8097
  // Leaving the SparkLink waiting view (e.g. "Choose another method") must
8086
8098
  // tear down its WebSocket + refocus listeners and clear the kindling, or a
8087
8099
  // later tab refocus would fire a stale claim for an abandoned flow.
8088
- // Idempotent — a no-op when SparkLink was never armed.
8100
+ // Idempotent: a no-op when SparkLink was never armed.
8089
8101
  this.cleanupSparkLink();
8090
8102
  const autoRoute = options.autoRoute !== false;
8091
8103
  if (!this.sdkConfig)
@@ -8150,7 +8162,7 @@ class IdentityRenderer {
8150
8162
  }
8151
8163
  // When a passkey is already registered for this identifier, jump
8152
8164
  // straight to the WebAuthn ceremony instead of asking the user to
8153
- // pick a method — it is the safest, fastest option. The back arrow on
8165
+ // pick a method: it is the safest, fastest option. The back arrow on
8154
8166
  // the passkey view re-enters this method with autoRoute=false so the
8155
8167
  // user lands on the full picker (passkey still listed) and can pick
8156
8168
  // a code or SparkLink instead. A provider that starts on its own once the
@@ -8184,7 +8196,7 @@ class IdentityRenderer {
8184
8196
  // - a list the provider is missing from only while the page's ask for the
8185
8197
  // sign-in's reference is out (federationAwaitingReference): with the
8186
8198
  // reference held the provider leads it, so it is never one method.
8187
- // (Passkey auto-route above still applies — a biometric prompt costs
8199
+ // (Passkey auto-route above still applies: a biometric prompt costs
8188
8200
  // nothing and can be dismissed.)
8189
8201
  const sendsToSuppliedPhone = this.identityPrefilled && methods[0].identityType === 'phone';
8190
8202
  const heldFederation = methods[0].type === 'federation' && !this.federationMayAutoStart;
@@ -8289,7 +8301,7 @@ class IdentityRenderer {
8289
8301
  }
8290
8302
  handleIdentitySubmit(result) {
8291
8303
  this.verificationState.setIdentity(result.value, result.type);
8292
- // The person typed this identifier, so it is theirs to change — a no-hint
8304
+ // The person typed this identifier, so it is theirs to change: a no-hint
8293
8305
  // simple-mode session must keep the back link + single-method auto-proceed.
8294
8306
  this.identityPrefilled = false;
8295
8307
  this.showMethodSelect();
@@ -8385,7 +8397,7 @@ class IdentityRenderer {
8385
8397
  if (!result.success) {
8386
8398
  this.cleanupSparkLink();
8387
8399
  // A blocked Identity (trial exhausted/expired, paid capacity) is
8388
- // terminal — show the "sign-in unavailable" interstitial, not a
8400
+ // terminal: show the "sign-in unavailable" interstitial, not a
8389
8401
  // retryable "Try Again" that invites retrying a permanently-blocked
8390
8402
  // login. Mirrors the otp send path.
8391
8403
  if (this.renderBlockedInterstitial(result.errorCode))
@@ -8473,7 +8485,7 @@ class IdentityRenderer {
8473
8485
  else if (this.renderBlockedInterstitial(result.errorCode)) ;
8474
8486
  else if (this.renderIdentityTypeRefusal(result.errorCode, result.error)) ;
8475
8487
  else if (result.errorCode === 'identity_locked') {
8476
- // The identity is locked down — a dedicated, actionable state, not a
8488
+ // The identity is locked down: a dedicated, actionable state, not a
8477
8489
  // generic "invalid code" retry. The person must manage it at auth.sv.
8478
8490
  this.setState({
8479
8491
  view: 'error',
@@ -8544,7 +8556,7 @@ class IdentityRenderer {
8544
8556
  if (error instanceof IdentityApiError && this.renderIdentityTypeRefusal(error.code, message))
8545
8557
  return;
8546
8558
  // The login ticket is not consumed on a wrong code, so the user can retry
8547
- // against the same ticket — re-render the view carrying the error.
8559
+ // against the same ticket: re-render the view carrying the error.
8548
8560
  this.setState({ view: 'two-factor', ticket, methods, error: message });
8549
8561
  }
8550
8562
  }
@@ -8601,14 +8613,14 @@ class IdentityRenderer {
8601
8613
  return true;
8602
8614
  }
8603
8615
  if (this.renderBlockedInterstitial(result.errorCode)) {
8604
- // Terminal interstitial already rendered — the owner must subscribe.
8616
+ // Terminal interstitial already rendered: the owner must subscribe.
8605
8617
  return true;
8606
8618
  }
8607
8619
  if (this.renderIdentityTypeRefusal(result.errorCode, result.error)) {
8608
8620
  return true;
8609
8621
  }
8610
8622
  if (result.errorCode === 'identity_locked') {
8611
- // Dedicated state — retrying cannot unlock the identity.
8623
+ // Dedicated state: retrying cannot unlock the identity.
8612
8624
  this.setState({
8613
8625
  view: 'error',
8614
8626
  code: 'identity_locked',
@@ -8632,7 +8644,7 @@ class IdentityRenderer {
8632
8644
  void this.showMethodSelect({ autoRoute: false });
8633
8645
  }
8634
8646
  else if (result.errorType === 'not_found') {
8635
- // No passkey yet — pivot the same screen to registration.
8647
+ // No passkey yet: pivot the same screen to registration.
8636
8648
  this.setState({
8637
8649
  view: 'passkey',
8638
8650
  recipient: this.recipient,
@@ -8686,7 +8698,7 @@ class IdentityRenderer {
8686
8698
  }
8687
8699
  /**
8688
8700
  * Leave for the social provider. The renderer runs on the Identity origin's
8689
- * sign-in page, and the round trip returns to that same page — query intact,
8701
+ * sign-in page, and the round trip returns to that same page, query intact,
8690
8702
  * because the query carries the destination the page was opened for (the
8691
8703
  * popup's `origin`, or the redirect mode's handoff parameters), which the
8692
8704
  * page re-gates before releasing the result. The state stored here is what
@@ -8853,7 +8865,7 @@ class IdentityRenderer {
8853
8865
  * The server returns an ordered `recommendations` list (passkey upsell,
8854
8866
  * backup verification, …); this walks it, rendering the step views the SDK
8855
8867
  * supports and finalizing when the queue drains. A redirect target skips the
8856
- * pipeline. A future nudge is one new recommendation type + view case — no
8868
+ * pipeline. A future nudge is one new recommendation type + view case, no
8857
8869
  * primary-login handler changes.
8858
8870
  */
8859
8871
  runPostLogin(result) {
@@ -8886,7 +8898,7 @@ class IdentityRenderer {
8886
8898
  this.setState({ view: 'backup-verify', missingType: next.missingType, pendingResult: result });
8887
8899
  }
8888
8900
  else {
8889
- // A recommendation type this SDK build does not render — skip it.
8901
+ // A recommendation type this SDK build does not render: skip it.
8890
8902
  this.advancePostLogin();
8891
8903
  }
8892
8904
  }
@@ -9037,7 +9049,7 @@ class IdentityRenderer {
9037
9049
  // Directly trigger passkey registration
9038
9050
  const result = await this.passkeyHandler.register(pendingResult.token);
9039
9051
  if (result.success && result.result) {
9040
- // Passkey created — adopt its fresh token/session as the result to
9052
+ // Passkey created: adopt its fresh token/session as the result to
9041
9053
  // finalize with (and to authorize any later backup-attach step), then
9042
9054
  // advance to the next recommendation.
9043
9055
  this.postLoginResult = result.result;
@@ -9175,7 +9187,7 @@ class IdentityRenderer {
9175
9187
  case 'sparklink_verified':
9176
9188
  case 'sparklink_second_factor': {
9177
9189
  const outcome = parseSparkLinkEvent(data);
9178
- // A result the sign-in cannot use — e.g. "verified" with no token —
9190
+ // A result the sign-in cannot use (e.g. "verified" with no token)
9179
9191
  // can never complete it; say so rather than report a hollow success.
9180
9192
  if (!outcome) {
9181
9193
  this.failSparkLink();
@@ -9189,7 +9201,7 @@ class IdentityRenderer {
9189
9201
  this.failSparkLink();
9190
9202
  break;
9191
9203
  case 'sparklink_resent':
9192
- // Server auto-resent a new link — update countdown timer
9204
+ // Server auto-resent a new link: update countdown timer
9193
9205
  if (typeof data.expiresAt === 'number') {
9194
9206
  this.setState({
9195
9207
  view: 'sparklink-waiting',
@@ -9210,7 +9222,7 @@ class IdentityRenderer {
9210
9222
  *
9211
9223
  * A completed login runs the post-login pipeline, which hands the host the
9212
9224
  * full result (including any redirect URL) before attempting top-level
9213
- * navigation — the host page is the source of truth for what happens next;
9225
+ * navigation: the host page is the source of truth for what happens next;
9214
9226
  * the SDK's window.location.href call is a fallback for hosts that delegate
9215
9227
  * navigation entirely to the SDK. A login held at the second-factor gate
9216
9228
  * opens the two-factor view, exactly as after an emailed code.
@@ -9253,7 +9265,7 @@ class IdentityRenderer {
9253
9265
  * is suspended (mobile: the user leaves to the mail app). On refocus, if the
9254
9266
  * socket is no longer open, reclaim the click's result once by kindling. A
9255
9267
  * single ~2s retry covers returning before the server finished writing it.
9256
- * Deliberately NOT a polling loop — it fires only on refocus, and only when
9268
+ * Deliberately NOT a polling loop: it fires only on refocus, and only when
9257
9269
  * the socket is actually gone.
9258
9270
  */
9259
9271
  armSparkLinkRefocusClaim() {
@@ -9297,7 +9309,7 @@ class IdentityRenderer {
9297
9309
  this.applySparkLinkOutcome(outcome);
9298
9310
  return;
9299
9311
  }
9300
- // Pending — the click may still be processing server-side. One short retry,
9312
+ // Pending: the click may still be processing server-side. One short retry,
9301
9313
  // then stop. No ongoing polling. Tracked so cleanup can cancel it.
9302
9314
  if (allowRetry && this.sparkLinkKindling === kindling) {
9303
9315
  this.sparkLinkRetryTimer = setTimeout(() => {
@@ -9515,9 +9527,9 @@ function getStyles(options) {
9515
9527
  textSecondary: isDark ? DS.darkTextMuted : DS.slate600,
9516
9528
  textMuted: isDark ? withAlpha(DS.white, 0.45) : DS.slate500,
9517
9529
  textOnPrimary: DS.white,
9518
- // Focus — two-tone ring: inner surface gap + accent-derived outer ring.
9530
+ // Focus, a two-tone ring: inner surface gap + accent-derived outer ring.
9519
9531
  focusRing: `0 0 0 2px ${surface}, 0 0 0 4px ${focusRingColor}`,
9520
- // Shadows — DS-weight: lean on hairlines, keep elevation subtle.
9532
+ // Shadows, DS-weight: lean on hairlines, keep elevation subtle.
9521
9533
  shadowSm: isDark
9522
9534
  ? '0 1px 2px rgba(0, 0, 0, 0.4)'
9523
9535
  : DS.shadowSm,
@@ -11559,7 +11571,7 @@ class DialogLauncher {
11559
11571
  return;
11560
11572
  }
11561
11573
  if (message.error === 'cancelled') {
11562
- // The person explicitly backed out inside the popup — end the flow rather
11574
+ // The person explicitly backed out inside the popup: end the flow rather
11563
11575
  // than offer to reopen to the same place.
11564
11576
  this.finishCancel();
11565
11577
  return;
@@ -11572,7 +11584,7 @@ class DialogLauncher {
11572
11584
  return;
11573
11585
  // Severed handle (COOP: same-origin on the host page): the popup is open in
11574
11586
  // front of the person and working, but postMessage can never deliver and a
11575
- // retry popup severs identically — the ONLY flow that can complete is the
11587
+ // retry popup severs identically. The ONLY flow that can complete is the
11576
11588
  // redirect flow, so switch to it. When the owner can't arm the redirect
11577
11589
  // return leg it resolves false and we degrade to the retry alert.
11578
11590
  if (error instanceof PopupSeveredError && this.callbacks.onPopupSevered) {
@@ -11860,14 +11872,14 @@ function onBodyReady(callback) {
11860
11872
  }
11861
11873
  }
11862
11874
  /**
11863
- * Attach a click handler to every element matching `selector` — both elements
11875
+ * Attach a click handler to every element matching `selector`: both elements
11864
11876
  * present once the DOM is ready and elements added later (observed via
11865
11877
  * MutationObserver).
11866
11878
  *
11867
11879
  * Each call is fully self-contained: the element bookkeeping lives in this
11868
11880
  * closure, so the returned cleanup removes only the listeners this call
11869
- * registered. Multiple attachments — different selectors, or even the same
11870
- * element attached twice — never interfere with one another.
11881
+ * registered. Multiple attachments (different selectors, or even the same
11882
+ * element attached twice) never interfere with one another.
11871
11883
  *
11872
11884
  * @param selector - CSS selector for elements to attach to
11873
11885
  * @param onClick - Click handler to register on every matching element
@@ -12147,7 +12159,7 @@ const PORTAL_SECTIONS = ['home', 'identity', 'security', 'sessions', 'sites'];
12147
12159
  // algorithm-confused token cannot masquerade as valid.
12148
12160
  const ACCEPTED_TOKEN_ALGS = ['EdDSA', 'RS256'];
12149
12161
  /**
12150
- * Whether `handleRedirectResult()` has anything to do on this load — a returned
12162
+ * Whether `handleRedirectResult()` has anything to do on this load: a returned
12151
12163
  * sign-in fragment to consume, or a pending sign-in to self-heal. Public + side
12152
12164
  * effect-free (peeks, never consumes) so a host that defers SDK init for
12153
12165
  * performance can cheaply decide whether to boot the SDK on a given page load,
@@ -12226,7 +12238,7 @@ class IdentityModule {
12226
12238
  ensurePreconnect(config.identityBaseUrl);
12227
12239
  }
12228
12240
  /**
12229
- * Build a deep link into the person's auth.sv Identity portal — where they
12241
+ * Build a deep link into the person's auth.sv Identity portal, where they
12230
12242
  * manage their verified identity, passkeys, sessions, and connected sites
12231
12243
  * across every SparkVault-integrated site. Send a signed-in user here to
12232
12244
  * self-serve;
@@ -12268,7 +12280,7 @@ class IdentityModule {
12268
12280
  * SSO hub session on the Identity origin),
12269
12281
  * the browser surfaces a "Continue as …" prompt with no popup, redirect, or
12270
12282
  * typing. Requires a registered `clientId` in the SDK config and a browser
12271
- * with FedCM support — callers should feature-detect with
12283
+ * with FedCM support: callers should feature-detect with
12272
12284
  * `IdentityModule.isFedcmAvailable()` and fall back to `signIn()` otherwise.
12273
12285
  *
12274
12286
  * @returns the verified result, or `null` when the browser has no FedCM
@@ -12300,7 +12312,7 @@ class IdentityModule {
12300
12312
  }
12301
12313
  const nonce = options.nonce ?? (await this.api.drawAuthorizationValues()).nonce;
12302
12314
  // The FedCM IdP is the IDENTITY origin (where sign-in runs and the SSO hub
12303
- // cookie lives) — not the auth.sv portal. The config, its endpoints, and
12315
+ // cookie lives), not the auth.sv portal. The config, its endpoints, and
12304
12316
  // the credentialed accounts fetch must all be same-origin with that cookie.
12305
12317
  const configURL = `${this.config.identityBaseUrl}/${this.config.accountId}/fedcm/config.json`;
12306
12318
  // A restriction rides the provider's `params`, which the browser hands the
@@ -12359,7 +12371,7 @@ class IdentityModule {
12359
12371
  * This is the single programmatic entry point; `attach()` binds it to element
12360
12372
  * clicks. The popup runs the flow top-level on the Identity origin (so
12361
12373
  * login's `__Host-` hub cookie is a first-party write and cross-domain SSO
12362
- * works) and posts the result back — the promise resolves with it.
12374
+ * works) and posts the result back; the promise resolves with it.
12363
12375
  *
12364
12376
  * Resilience: pair this with `handleRedirectResult()` on page load. If the
12365
12377
  * popup's result is ever lost (a mobile browser discards the backgrounded
@@ -12419,7 +12431,7 @@ class IdentityModule {
12419
12431
  backdropBlur: options.backdropBlur ?? this.config.backdropBlur,
12420
12432
  };
12421
12433
  // Inline rendering (target) and explicit local mode run the flow in this
12422
- // document — that is how the SparkVault-hosted sign-in page itself runs
12434
+ // document: that is how the SparkVault-hosted sign-in page itself runs
12423
12435
  // the flow. Otherwise sign-in leaves this page: a top-level redirect to
12424
12436
  // the sign-in page on the Identity origin (so login's first-party SSO
12425
12437
  // cookie persists), returning via handleRedirectResult().
@@ -12598,8 +12610,8 @@ class IdentityModule {
12598
12610
  throw new ValidationError('Invalid token header');
12599
12611
  }
12600
12612
  // Accept exactly the algorithms the Identity server signs with; reject
12601
- // everything else — `none` (unsigned), a symmetric or algorithm-confused
12602
- // token, or an absent alg — none of which could pass the server-side JWKS
12613
+ // everything else: `none` (unsigned), a symmetric or algorithm-confused
12614
+ // token, or an absent alg, none of which could pass the server-side JWKS
12603
12615
  // verification the host performs before trusting the token.
12604
12616
  const alg = header.alg;
12605
12617
  if (typeof alg !== 'string' || !ACCEPTED_TOKEN_ALGS.includes(alg)) {
@@ -12623,17 +12635,17 @@ class IdentityModule {
12623
12635
  return payload;
12624
12636
  }
12625
12637
  /**
12626
- * Complete a sign-in on page load — the return leg of `signIn()`. Call once
12638
+ * Complete a sign-in on page load: the return leg of `signIn()`. Call once
12627
12639
  * on every page load; it resolves `null` when there is nothing to do.
12628
12640
  *
12629
12641
  * It handles two cases:
12630
- * 1. A one-time code is in the URL fragment (`#sv_code=…`) — the popup's
12642
+ * 1. A one-time code is in the URL fragment (`#sv_code=…`): the popup's
12631
12643
  * result was lost and self-heal navigated here, or `flow: 'redirect'`
12632
12644
  * returned. Redeem it server-side and hand the full result to
12633
12645
  * `onSuccess` (and resolve with it).
12634
12646
  * 2. A sign-in was in flight but never delivered (a mobile browser
12635
12647
  * discarded the backgrounded opener tab, killing the popup's
12636
- * postMessage) — silently re-mint from the SSO session the popup signed
12648
+ * postMessage): silently re-mint from the SSO session the popup signed
12637
12649
  * in or chose, by navigating this tab through the silent SSO endpoint
12638
12650
  * and straight back with a code (case 1 on return). The bounce names
12639
12651
  * the sign-in's reference, and the endpoint mints only when the
@@ -12641,7 +12653,7 @@ class IdentityModule {
12641
12653
  * such session (a sign-in that opened none, such as one through the
12642
12654
  * account's own identity provider) it comes back logged-out, no oracle.
12643
12655
  *
12644
- * The code is one-time, PKCE-bound, and origin-locked — never the token. The
12656
+ * The code is one-time, PKCE-bound, and origin-locked, never the token. The
12645
12657
  * host must still verify `result.token` server-side via the Identity JWKS.
12646
12658
  *
12647
12659
  * @example Call on page load; sign-in clicks stay unchanged.
@@ -12659,7 +12671,7 @@ class IdentityModule {
12659
12671
  }
12660
12672
  // A silent-SSO recovery that found no live session returns `#sso=…`; strip
12661
12673
  // it so the logged-out load is clean, retire the one-shot state/verifier the
12662
- // outbound bounce staged (dead now — no code came back), and do not re-bounce
12674
+ // outbound bounce staged (dead now: no code came back), and do not re-bounce
12663
12675
  // (handled below).
12664
12676
  if (params.get('sso')) {
12665
12677
  this.clearUrlFragment();
@@ -12678,7 +12690,7 @@ class IdentityModule {
12678
12690
  const code = params.get('sv_code');
12679
12691
  const errorCode = params.get('sv_error');
12680
12692
  // A returned fragment means this sign-in resolved (redeem, cancel, or
12681
- // error), so retire any pending marker — otherwise it could fire one
12693
+ // error), so retire any pending marker; otherwise it could fire one
12682
12694
  // spurious silent bounce on a later load inside its TTL.
12683
12695
  removePendingMarker();
12684
12696
  // Consume exactly once: fragment and one-shot state/verifier are cleared
@@ -12713,8 +12725,8 @@ class IdentityModule {
12713
12725
  // here: the code is PKCE- and origin-bound to this tab, and a recovery
12714
12726
  // bounce only ever mints for the account its `login_hint` named (see
12715
12727
  // startRecoveryBounce). The redeemed result exposes just that account's
12716
- // PRIMARY identifier — not necessarily the one the caller signed in
12717
- // with — so re-checking it here could only discard valid sign-ins.
12728
+ // PRIMARY identifier (not necessarily the one the caller signed in
12729
+ // with), so re-checking it here could only discard valid sign-ins.
12718
12730
  const raw = await this.api.redeemHandoffCode(code, codeVerifier);
12719
12731
  const result = {
12720
12732
  token: raw.token,
@@ -12737,7 +12749,7 @@ class IdentityModule {
12737
12749
  * Silently re-mint the sign-in result from the SSO session the popup signed
12738
12750
  * in or chose. Navigates this tab through the silent SSO endpoint
12739
12751
  * (a top-level GET, so the `SameSite=Lax` hub cookie rides along) which,
12740
- * PKCE-bound, returns a one-time code in the fragment — handled by case 1 on
12752
+ * PKCE-bound, returns a one-time code in the fragment, handled by case 1 on
12741
12753
  * return. No-op (stays put) if session storage or WebCrypto is unavailable,
12742
12754
  * so a degraded environment simply never recovers rather than erroring. The
12743
12755
  * bounce's PKCE verifier and state are a draw from the Identity origin
@@ -12753,7 +12765,7 @@ class IdentityModule {
12753
12765
  const sso = new URL(`${this.config.identityBaseUrl}/${this.config.accountId}/sso`);
12754
12766
  // With several hub sessions, login_hint names the account the interrupted
12755
12767
  // sign-in was addressing: /sso mints silently ONLY for a hint that matched
12756
- // exactly one hub session's verified identifiers — every unsatisfiable hint
12768
+ // exactly one hub session's verified identifiers, and every unsatisfiable hint
12757
12769
  // (a stranger's address, an ambiguous match, an account not eligible here)
12758
12770
  // comes back with no result at all rather than a different account's.
12759
12771
  if (pending.hint) {
@@ -12913,14 +12925,14 @@ class IdentityModule {
12913
12925
  // nothing below can match.
12914
12926
  }
12915
12927
  // A `#token` is accepted only as the answer to a sign-in THIS browser
12916
- // started — the renderer stores the state before leaving for the
12928
+ // started: the renderer stores the state before leaving for the
12917
12929
  // provider. Anyone can compose a URL carrying their own genuinely-signed
12918
12930
  // token, so a fragment with no stored state, or a different one, is an
12919
12931
  // unsolicited result (login CSRF) and is refused.
12920
12932
  if (!expectedState || params.get(SIGNIN_RESULT_FRAGMENT.state) !== expectedState) {
12921
12933
  throw new ValidationError('Invalid OAuth state');
12922
12934
  }
12923
- // Unverified client-side decode — surfaces the claims for the result
12935
+ // Unverified client-side decode: surfaces the claims for the result
12924
12936
  // shape and rejects an obviously-bad token (expiry/issuer/audience/alg).
12925
12937
  // The host MUST still verify result.token server-side via the Identity
12926
12938
  // JWKS before trusting any claim for an authorization decision.
@@ -12991,7 +13003,7 @@ class IdentityModule {
12991
13003
  * Whether the preloaded config has already settled as a *permanent* failure
12992
13004
  * the popup can't surface (origin not allowed, or product not configured).
12993
13005
  * Used to skip the launcher and show the error dialog in-page immediately.
12994
- * Returns false — proceed to the launcher — when config is not preloaded,
13006
+ * Returns false (proceed to the launcher) when config is not preloaded,
12995
13007
  * still in flight (raced against a short timeout so the common path is never
12996
13008
  * delayed), resolved, or failed only transiently (the launcher surfaces a
12997
13009
  * transient failure in its own dialog).
@@ -13005,7 +13017,7 @@ class IdentityModule {
13005
13017
  this.api.getConfig(),
13006
13018
  new Promise((resolve) => setTimeout(() => resolve(PENDING), 50)),
13007
13019
  ]);
13008
- // Resolved with config, or still pending after the timeout — either way,
13020
+ // Resolved with config, or still pending after the timeout: either way,
13009
13021
  // don't block the iframe path.
13010
13022
  return false;
13011
13023
  }
@@ -13037,7 +13049,7 @@ class IdentityModule {
13037
13049
  *
13038
13050
  * @internal Used only by the SparkVault-hosted sign-in popup and hosted login
13039
13051
  * page (which own their chrome and pass `renderMode: 'local'`). Customer
13040
- * integrations have no inline mode — use `signIn()` / `attach()`.
13052
+ * integrations have no inline mode; use `signIn()` / `attach()`.
13041
13053
  */
13042
13054
  async render(options) {
13043
13055
  const returned = await this.consumeRedirectResult();
@@ -13063,8 +13075,8 @@ class IdentityModule {
13063
13075
 
13064
13076
  /**
13065
13077
  * The caller-supplied send idempotency key. It becomes part of the send's
13066
- * storage key, so `#` (the key separator) is excluded — no caller id can forge a
13067
- * key-segment boundary into another tenant's namespace — and the length bound
13078
+ * storage key, so `#` (the key separator) is excluded (no caller id can forge a
13079
+ * key-segment boundary into another tenant's namespace), and the length bound
13068
13080
  * keeps the key inside the store's key-size limit.
13069
13081
  */
13070
13082
  const NOTIFY_SEND_ID_PATTERN = /^[A-Za-z0-9_.:-]+$/;
@@ -13326,14 +13338,14 @@ class NotifyProjectsModule {
13326
13338
  }
13327
13339
 
13328
13340
  /**
13329
- * Notify Product Module — the TENANT (sender) surface.
13341
+ * Notify Product Module: the TENANT (sender) surface.
13330
13342
  *
13331
13343
  * The counterpart to `sv.notify`: where that module is SparkVault's own
13332
13344
  * first-party inbox, which a signed-in SparkVault user reads for the
13333
13345
  * notifications SparkVault delivered to them `in_app`, this one is the
13334
- * account-scoped product surface a tenant's BACKEND drives — send, send
13346
+ * account-scoped product surface a tenant's BACKEND drives (send, send
13335
13347
  * history, recall, sender-side inbox reads and state, send status, receipts,
13336
- * the account's Notify config, and who its email is from.
13348
+ * the account's Notify config, and who its email is from).
13337
13349
  * A tenant reads its own recipients' feeds here (`getInbox`), never through
13338
13350
  * `sv.notify`. Every method maps to
13339
13351
  * `/v1/products/notify/*` and is authorized by the caller's account, so the
@@ -13348,7 +13360,7 @@ class NotifyProjectsModule {
13348
13360
  * and metadata.
13349
13361
  */
13350
13362
  /**
13351
- * The caller-supplied idempotency key's accepted shape — the server's own rule,
13363
+ * The caller-supplied idempotency key's accepted shape: the server's own rule,
13352
13364
  * so a malformed key fails locally instead of on the wire.
13353
13365
  */
13354
13366
  function isSendId(value) {
@@ -13367,7 +13379,7 @@ const BULK_MARK_STATES$1 = NOTIFY_INBOX_BULK_MARK_STATES;
13367
13379
  * The five secure-by-default preset bundles: the server's own table, in this
13368
13380
  * SDK's camelCase shape.
13369
13381
  *
13370
- * There is no preset endpoint — presets are a merge over the one send contract,
13382
+ * There is no preset endpoint: presets are a merge over the one send contract,
13371
13383
  * so they are applied client-side and produce an ordinary `send` request. Caller
13372
13384
  * arguments win over a preset's defaults wherever they state a value;
13373
13385
  * `channels` left unset lets the account config resolve the ladder per category.
@@ -13436,8 +13448,8 @@ class NotifyProductModule {
13436
13448
  * recipient, and enqueue delivery across the resolved channel ladder.
13437
13449
  *
13438
13450
  * `sendId` is the idempotency key. Replaying an existing one with the same
13439
- * request returns the stored send unchanged — never re-sealed, never
13440
- * re-delivered — flagged `idempotent`; another request under it is refused 400
13451
+ * request returns the stored send unchanged (never re-sealed, never
13452
+ * re-delivered), flagged `idempotent`; another request under it is refused 400
13441
13453
  * (`sendId` on `CreateNotifySendOptions`).
13442
13454
  *
13443
13455
  * The send speaks in your organization's name, and one that would email
@@ -13451,12 +13463,12 @@ class NotifyProductModule {
13451
13463
  * | Status | `serviceCode` | `details` | Next |
13452
13464
  * | --- | --- | --- | --- |
13453
13465
  * | 403 | `NOTIFY_CHANNEL_NOT_AVAILABLE` | `{ field, channels }` | Name only `in_app` and `email` |
13454
- * | 409 | `NOTIFY_SENDER_NAME_REQUIRED` | — | Name the organization in Settings |
13466
+ * | 409 | `NOTIFY_SENDER_NAME_REQUIRED` | none | Name the organization in Settings |
13455
13467
  * | 409 | `NOTIFY_SENDER_NAME_RESERVED` | `{ reason: 'reserved_name' }` | Rename the organization |
13456
13468
  * | 409 | `HANDLE_REQUIRED` | `{ product: 'notify' }` | Choose the organization's handle in Company Settings |
13457
13469
  * | 429 | `NOTIFY_EMAIL_ADMISSION_LIMIT` | `{ limit, window: 'hour', resets_at }` | Wait `retryAfterMs`, then send |
13458
- * | 503 | `EMAIL_SETUP_BUSY` | — | Retry the same send after `retryAfterMs` |
13459
- * | 503 | `NOTIFY_EMAIL_CAPACITY_UNAVAILABLE` | — | Retry the same send |
13470
+ * | 503 | `EMAIL_SETUP_BUSY` | none | Retry the same send after `retryAfterMs` |
13471
+ * | 503 | `NOTIFY_EMAIL_CAPACITY_UNAVAILABLE` | none | Retry the same send |
13460
13472
  *
13461
13473
  * A replay is answered from the stored send and meets none of them again.
13462
13474
  *
@@ -13470,7 +13482,7 @@ class NotifyProductModule {
13470
13482
  * category: 'transactional',
13471
13483
  * });
13472
13484
  *
13473
- * @example Send a stored file — the unsealed vault proves you hold its key
13485
+ * @example Send a stored file: the unsealed vault proves you hold its key
13474
13486
  * const vault = await sv.vaults.unseal('vlt_abc', process.env.CONTRACTS_DVAK);
13475
13487
  * await sv.products.notify.send({
13476
13488
  * sendId: `contract:${contract.id}`,
@@ -13501,7 +13513,7 @@ class NotifyProductModule {
13501
13513
  return response.data;
13502
13514
  }
13503
13515
  /**
13504
- * Frictionless informational ping — no verification, view-only, delivered
13516
+ * Frictionless informational ping: no verification, view-only, delivered
13505
13517
  * INLINE (plaintext) so it is read at a glance. Channels resolve from the
13506
13518
  * account config, narrowed to the ones that render cleartext.
13507
13519
  *
@@ -13576,7 +13588,7 @@ class NotifyProductModule {
13576
13588
  * grant still opens, never the content; a plaintext row carries its body.
13577
13589
  * Treat the answer as sensitive and keep it out of logs.
13578
13590
  *
13579
- * A page can come back SHORT of `limit` yet still carry a non-null cursor —
13591
+ * A page can come back SHORT of `limit` yet still carry a non-null cursor:
13580
13592
  * follow the cursor; never treat a short page as the end.
13581
13593
  *
13582
13594
  * @example
@@ -13599,7 +13611,7 @@ class NotifyProductModule {
13599
13611
  }
13600
13612
  /**
13601
13613
  * Apply a terminal display state to one row (idempotent). `createdAt` MUST be
13602
- * the row's own `created_at`, round-tripped from the feed row — the id alone
13614
+ * the row's own `created_at`, round-tripped from the feed row; the id alone
13603
13615
  * cannot address the row. Any mark (seen, read or archived) marks the row seen,
13604
13616
  * which stops its escalation.
13605
13617
  *
@@ -13655,7 +13667,7 @@ class NotifyProductModule {
13655
13667
  }
13656
13668
  // ── Send history & recall ───────────────────────────────────────────────────
13657
13669
  /**
13658
- * The account's send history, newest first — what you sent, to how many, and
13670
+ * The account's send history, newest first: what you sent, to how many, and
13659
13671
  * how it landed.
13660
13672
  *
13661
13673
  * Metadata only by construction: the history index does not project the
@@ -13688,13 +13700,13 @@ class NotifyProductModule {
13688
13700
  *
13689
13701
  * `mode: 'grant'` (the default) drops access and leaves the content intact.
13690
13702
  * `mode: 'content'` hard-burns the sealed spark so it is unreadable for
13691
- * everyone — spark-backed sends only: an ingot send merely references the
13703
+ * everyone. Spark-backed sends only: an ingot send merely references the
13692
13704
  * owner's durable vault content, so a content recall of one is a 400, refused
13693
13705
  * before anything is revoked or stopped.
13694
13706
  *
13695
13707
  * Idempotent: a grant already revoked (or already consumed) counts as recalled,
13696
13708
  * so a repeated call converges rather than accumulating failures. One
13697
- * recipient's failure never stops the rest — the response reports every one.
13709
+ * recipient's failure never stops the rest; the response reports every one.
13698
13710
  *
13699
13711
  * PLAINTEXT SENDS CANNOT BE RECALLED (400): they delivered their body inline,
13700
13712
  * in the clear, and minted no grant. There is nothing to revoke, and saying
@@ -13729,7 +13741,7 @@ class NotifyProductModule {
13729
13741
  // ── Status & receipts ───────────────────────────────────────────────────────
13730
13742
  /**
13731
13743
  * The sender's per-recipient delivery rollup for one send: who it reached and
13732
- * how far each recipient got. Metadata only — never the pointer, and no contact
13744
+ * how far each recipient got. Metadata only: never the pointer, and no contact
13733
13745
  * beyond the handle each recipient was addressed by (`recipient_id`).
13734
13746
  *
13735
13747
  * @example
@@ -13763,7 +13775,7 @@ class NotifyProductModule {
13763
13775
  /**
13764
13776
  * Every receipt for one send, each attached to the recipient who produced it.
13765
13777
  * The walk reads the account's receipts back to the send's creation, and no
13766
- * further. One call is bounded: when `truncated` is true it stopped first —
13778
+ * further. One call is bounded: when `truncated` is true it stopped first;
13767
13779
  * pass the returned `cursor` back in to resume exactly where it stopped.
13768
13780
  *
13769
13781
  * @example
@@ -13800,7 +13812,7 @@ class NotifyProductModule {
13800
13812
  * Merge a partial patch onto the account's config overrides. Unknown keys are
13801
13813
  * rejected before any write.
13802
13814
  *
13803
- * Delete a category by storing an explicit `null` TOMBSTONE — that is what keeps
13815
+ * Delete a category by storing an explicit `null` TOMBSTONE: that is what keeps
13804
13816
  * a seeded default from re-appearing on the next merge. The reserved `security`
13805
13817
  * category can neither be removed nor made optional, the promotional
13806
13818
  * categories `marketing` and `product` can never be made required: their email
@@ -13811,7 +13823,7 @@ class NotifyProductModule {
13811
13823
  * The `events` section configures the outbound event webhook: `webhook_url`
13812
13824
  * must be https on a public host, and `secret` (16-256 chars) signs every event
13813
13825
  * body as `X-SparkVault-Signature: hex(HMAC-SHA256(secret, rawBody))`. Both
13814
- * are WRITE-ONLY — reads report `events.webhook_url_set`,
13826
+ * are WRITE-ONLY: reads report `events.webhook_url_set`,
13815
13827
  * `events.webhook_url_host` and `events.secret_set`, never the values. A
13816
13828
  * `webhook_url` on another host or port needs a new `secret` in the same
13817
13829
  * patch (400 `VALIDATION_ERROR` naming `events.secret`), so a secret never
@@ -13831,7 +13843,7 @@ class NotifyProductModule {
13831
13843
  * await sv.products.notify.updateConfig({
13832
13844
  * categories: {
13833
13845
  * weekly_newsletter: { label: 'Weekly newsletter', required: false },
13834
- * marketing: null, // tombstone — remove the seeded default
13846
+ * marketing: null, // tombstone: remove the seeded default
13835
13847
  * },
13836
13848
  * events: {
13837
13849
  * webhook_url: 'https://api.example.com/hooks/sparkvault',
@@ -14737,8 +14749,8 @@ Array.from({ length: 1 << BRAND_BITS.size }, (_, mask) =>
14737
14749
  * presets, size limits, the operator display and desk mode choices, the
14738
14750
  * operator queue's views and orders, the reply review list's views and
14739
14751
  * states, the response-time histogram's bucket edges, the sections of a
14740
- * desk's settings an address names, and the messages the widget's native
14741
- * sign-in posts between the website and its first-party page live here for
14752
+ * desk's settings an address names, and the messages Help Desk's own
14753
+ * sign-in posts between the website and its sign-in window live here for
14742
14754
  * the same reason. So does the one rule a typed or pasted sign-in code is
14743
14755
  * read by (helpDeskPinDigits), which every sign-in form applies. So does the
14744
14756
  * one way a client names a message it sends (newMessageId), which the
@@ -14766,14 +14778,15 @@ const HELP_DESK_CLOSE_REASONS = Object.freeze(['resolved', 'duplicate', 'spam'])
14766
14778
  Object.freeze(HELP_DESK_CLOSE_REASONS.filter((reason) => reason !== 'duplicate'));
14767
14779
 
14768
14780
  /**
14769
- * The messages the widget's native sign-in exchanges between the website's
14770
- * window (the JS SDK's openWidgetIdentity) and the first-party page it opens
14771
- * on auth.sv (Core's widget-identity-page.js), each posted to the other's
14772
- * exact origin: the page asks its opener for the challenge's state (`ready`),
14773
- * the opener answers its own popup alone (`state`), and the page reports the
14774
- * sign-in's code or its cancellation (`result`). Every message names its
14775
- * challenge, and the state is never in the page's URL or its server-rendered
14776
- * context, so only the window that started a challenge can complete it.
14781
+ * The messages Help Desk's own sign-in exchanges between the website's
14782
+ * window (the JS SDK's openWidgetIdentity) and the sign-in window it opens on
14783
+ * the Help Desk sign-in host (the portal's sign-in window page): the window
14784
+ * asks its opener for the challenge's state (`ready`), the opener answers its
14785
+ * own popup alone, at the sign-in origin (`state`), and the window reports
14786
+ * the sign-in's code, only once the person confirms it, or its cancellation
14787
+ * (`result`) to the website's origin alone. Every message names its
14788
+ * challenge, and the state is never in the window's URL, so only the window
14789
+ * that started a challenge can complete it.
14777
14790
  */
14778
14791
  const HELP_DESK_WIDGET_IDENTITY_MESSAGES = Object.freeze({
14779
14792
  ready: 'sparkvault:help-desk:identity-ready',
@@ -14944,6 +14957,8 @@ const HELP_DESK_ROLES = Object.freeze(['manager', 'agent', 'trainee']);
14944
14957
  * hold_tickets be assigned, mentioned, alerted and balanced-assigned
14945
14958
  * configure_desk edit the desk's settings, queues, routing, alerts and knowledge base
14946
14959
  * configure_chat the desk's chat intake and new-ticket chat notifications
14960
+ * activate_desk activate the desk on a company vault by presenting its key: the first
14961
+ * activation, a deactivated desk's, and a move to another vault
14947
14962
  * assign_roles choose who holds which role on the desk
14948
14963
  * view_analytics the desk's analytics, its CSV and the operator breakdown
14949
14964
  * manage_requesters block or unblock a requester
@@ -14958,6 +14973,11 @@ const HELP_DESK_ROLES = Object.freeze(['manager', 'agent', 'trainee']);
14958
14973
  * A Trainee keeps no saved replies: they use every one, and their reply is
14959
14974
  * reviewed before it reaches a customer, so no text of theirs reaches one
14960
14975
  * through another operator's reply unreviewed.
14976
+ *
14977
+ * A company admin alone activates a desk: presenting a company vault's key is
14978
+ * the company's consent to the help desk opening every file in that vault, so
14979
+ * no desk role gives it. Deactivating, which only withdraws that access, is
14980
+ * the desk's configurers' (`configure_desk`).
14961
14981
  */
14962
14982
  const EVERY_ROLE = HELP_DESK_ROLES;
14963
14983
  const capability = (roles, { admin = false, requiresAdmin = false } = {}) =>
@@ -14975,6 +14995,7 @@ Object.freeze({
14975
14995
  hold_tickets: capability(EVERY_ROLE),
14976
14996
  configure_desk: capability(['manager'], { admin: true }),
14977
14997
  configure_chat: capability([], { admin: true }),
14998
+ activate_desk: capability([], { admin: true }),
14978
14999
  assign_roles: capability(['manager'], { admin: true }),
14979
15000
  view_analytics: capability(['manager']),
14980
15001
  manage_requesters: capability(['manager']),
@@ -15371,14 +15392,14 @@ function refused(reason) {
15371
15392
  */
15372
15393
  /**
15373
15394
  * Time-to-first-byte bound: how long the download host may take to return
15374
- * response headers. This bounds only the wait for a transfer to start — a
15395
+ * response headers. This bounds only the wait for a transfer to start: a
15375
15396
  * signed link either begins serving promptly or is not going to.
15376
15397
  */
15377
15398
  const DOWNLOAD_TTFB_TIMEOUT_MS = 30000;
15378
15399
  /**
15379
15400
  * Liveness bound on the response body: the longest tolerated gap between two
15380
15401
  * chunks, rearmed on every chunk. Progress, not wall clock, bounds the
15381
- * transfer — a large file over a slow link still completes, while a stalled
15402
+ * transfer: a large file over a slow link still completes, while a stalled
15382
15403
  * connection fails promptly enough to retry.
15383
15404
  */
15384
15405
  const DOWNLOAD_IDLE_TIMEOUT_MS = 60000;
@@ -16060,7 +16081,7 @@ function mapFolder(wire) {
16060
16081
  */
16061
16082
  /**
16062
16083
  * Error class for upload API errors. Inherits `code` and `statusCode` from
16063
- * SparkVaultError — no duplicate `httpStatus` field.
16084
+ * SparkVaultError, with no duplicate `httpStatus` field.
16064
16085
  *
16065
16086
  * A failed transfer request also carries what the transfer policy
16066
16087
  * (`@sparkvault/app-sdk/transfer-retry`) makes of its answer, read where the
@@ -16140,15 +16161,15 @@ function parseLengthHeader(raw) {
16140
16161
  /**
16141
16162
  * Abort a stalled chunk PATCH after this long with no upload progress.
16142
16163
  * XHR's own `timeout` measures total request duration, which would abort a
16143
- * slow-but-progressing 50MB chunk — so a chunk fails only after the
16164
+ * slow-but-progressing 50MB chunk, so a chunk fails only after the
16144
16165
  * connection has been completely silent for the full window.
16145
16166
  */
16146
16167
  const CHUNK_INACTIVITY_TIMEOUT_MS = 60000;
16147
16168
  /**
16148
16169
  * How many consecutive timeouts end the finalization receipt early.
16149
16170
  *
16150
- * A genuinely slow finalize shows up as ONE timeout — the PATCH that started
16151
- * the re-drive — followed by 409s from the writer that is working on it.
16171
+ * A genuinely slow finalize shows up as ONE timeout (the PATCH that started
16172
+ * the re-drive) followed by 409s from the writer that is working on it.
16152
16173
  * Back-to-back timeouts mean nobody is answering at all, and spending the
16153
16174
  * whole retry budget on a black-holed socket would freeze the widget at 100%
16154
16175
  * for minutes with nothing for the user to act on.
@@ -16190,8 +16211,8 @@ function uploadRefusedError(coreCode, message, status, outcome) {
16190
16211
  return new UploadApiError(message ?? REFUSAL_WORDING.get(coreCode) ?? REFUSED_MESSAGE, 'upload_refused', status, { status, coreCode }, outcome);
16191
16212
  }
16192
16213
  /**
16193
- * Core's refusal of a request that stages an upload — a create, a
16194
- * replacement, the widget's initiation — read as the upload's verdict: a final
16214
+ * Core's refusal of a request that stages an upload (a create, a
16215
+ * replacement, the widget's initiation) read as the upload's verdict: a final
16195
16216
  * refusal of Core's (UPLOAD_FINAL_REFUSAL_CODES, the answer's own code: a
16196
16217
  * later staging of the same file superseded it before its token was minted,
16197
16218
  * 410 UPLOAD_SUPERSEDED) is the `upload_refused` a transfer answer naming it
@@ -16448,7 +16469,7 @@ class UploadApi extends SparkVaultApi {
16448
16469
  * Vault upload info by vault id, memoized for the life of this client.
16449
16470
  *
16450
16471
  * The client is built once with the SDK and the map dies with the page, so
16451
- * the memo cannot outlive the page it decorates — which is why there is no
16472
+ * the memo cannot outlive the page it decorates, which is why there is no
16452
16473
  * TTL and no invalidation API to get wrong. It deliberately survives
16453
16474
  * `resetSession()`, alongside the other long-lived per-client state.
16454
16475
  */
@@ -16461,7 +16482,7 @@ class UploadApi extends SparkVaultApi {
16461
16482
  * retries, a cancel aside; a refused API call it raises with its status is
16462
16483
  * Core's verdict, never a transfer's, so of the policy's reading it carries
16463
16484
  * only the floor Core named (`retryAfterMs`), for whoever acts on the
16464
- * refusal — and Core's final refusal of the upload a call stages is that
16485
+ * refusal, and Core's final refusal of the upload a call stages is that
16465
16486
  * upload's `upload_refused` ({@link stagingRefusal}).
16466
16487
  */
16467
16488
  makeError(message, code, statusCode, details, retryAfterMs = null) {
@@ -16505,13 +16526,13 @@ class UploadApi extends SparkVaultApi {
16505
16526
  /**
16506
16527
  * Get vault upload info (public endpoint), fetched at most once per vault.
16507
16528
  *
16508
- * Every widget interaction — `upload()`, `pop()`, `render()`, and each click
16509
- * an `attach()` handler serves — starts by asking for this, and the answer is
16529
+ * Every widget interaction (`upload()`, `pop()`, `render()`, and each click
16530
+ * an `attach()` handler serves) starts by asking for this, and the answer is
16510
16531
  * pure display and geometry: the vault's name, its branding, and the size it
16511
16532
  * advertises. It authorizes nothing. The server re-validates the vault, its
16512
16533
  * upload source, the request origin, and the file size on the POST that
16513
16534
  * actually creates the upload, and that re-validation is the correctness
16514
- * backstop for this whole flow — a memoized answer can never widen what an
16535
+ * backstop for this whole flow: a memoized answer can never widen what an
16515
16536
  * upload is allowed to do, and the backstop must stay in place.
16516
16537
  *
16517
16538
  * Only a successful answer is kept: a rejection evicts its entry so the next
@@ -16584,7 +16605,7 @@ class UploadApi extends SparkVaultApi {
16584
16605
  /**
16585
16606
  * Upload a file to Forge over the TUS resumable protocol (v1.0.0).
16586
16607
  *
16587
- * The single canonical browser transfer path — the upload widget and the
16608
+ * The single canonical browser transfer path: the upload widget and the
16588
16609
  * authenticated `ingots.upload` flow both go through here (one canonical
16589
16610
  * transfer path). Creates the session, PATCHes chunks sized exactly by the
16590
16611
  * server's `X-Chunk-Size` (Forge fixes the geometry at 50MB, which keeps
@@ -16595,7 +16616,7 @@ class UploadApi extends SparkVaultApi {
16595
16616
  * Every answer is read through the transfer policy
16596
16617
  * (`@sparkvault/app-sdk/transfer-retry`) and every retry spends one budget
16597
16618
  * ({@link TusTransfer}). A chunk that fails in transit is resent only from
16598
- * an offset the server just named — a 409's own `Upload-Offset` at once,
16619
+ * an offset the server just named: a 409's own `Upload-Offset` at once,
16599
16620
  * otherwise a HEAD after the backoff ({@link offsetAfterFailure}); a session
16600
16621
  * the server no longer holds throws `session_gone`, which only a new upload
16601
16622
  * recovers from (any code of Core's the server named rides
@@ -16794,7 +16815,7 @@ class UploadApi extends SparkVaultApi {
16794
16815
  await waitToRetry(transfer.budget, failure, transfer.uploadUrl, transfer.sessionSignal);
16795
16816
  }
16796
16817
  /**
16797
- * Confirm the server finalized a fully received upload — the one receipt
16818
+ * Confirm the server finalized a fully received upload: the one receipt
16798
16819
  * every transfer ends on.
16799
16820
  *
16800
16821
  * The server persists the session's final offset BEFORE it finalizes, so a
@@ -16802,7 +16823,7 @@ class UploadApi extends SparkVaultApi {
16802
16823
  * size while finalization failed or is still running, and reporting that as
16803
16824
  * success would hand the user a stored file whose ingot was never published.
16804
16825
  * The zero-length PATCH at the final offset is the server's finalization
16805
- * re-drive — it short-circuits to 204 on an already-finalized session, and
16826
+ * re-drive: it short-circuits to 204 on an already-finalized session, and
16806
16827
  * on a received-but-unfinalized one it answers only after publication.
16807
16828
  *
16808
16829
  * While another request finalizes the receipt answers 409 with
@@ -16834,7 +16855,7 @@ class UploadApi extends SparkVaultApi {
16834
16855
  }
16835
16856
  catch (error) {
16836
16857
  const failure = transferFailure(error);
16837
- // Any answer at all — a 409 above all — proves someone is on the other
16858
+ // Any answer at all (a 409 above all) proves someone is on the other
16838
16859
  // end, so the timeout tally starts over.
16839
16860
  consecutiveTimeouts = failure.code === 'timeout' ? consecutiveTimeouts + 1 : 0;
16840
16861
  if (consecutiveTimeouts >= FINALIZE_MAX_CONSECUTIVE_TIMEOUTS) {
@@ -16889,12 +16910,12 @@ class UploadApi extends SparkVaultApi {
16889
16910
  return this.checkResumeOffset(await this.headUploadOffset(transfer.uploadUrl, RESUME_CHECK), transfer);
16890
16911
  }
16891
16912
  /**
16892
- * Judge an offset the server named for the upload to resume from — a HEAD's,
16893
- * or a 409's `Upload-Offset` — the one place a server-reported resume point
16913
+ * Judge an offset the server named for the upload to resume from (a HEAD's,
16914
+ * or a 409's `Upload-Offset`): the one place a server-reported resume point
16894
16915
  * is judged.
16895
16916
  *
16896
16917
  * Forge commits a chunk before it answers, so a PATCH that died in transit
16897
- * may have landed in full or not at all (never in part — the chunk object
16918
+ * may have landed in full or not at all (never in part: the chunk object
16898
16919
  * is written atomically before the offset advances); only the session's own
16899
16920
  * persisted offset knows which, and the client's arithmetic is worthless
16900
16921
  * here.
@@ -17054,7 +17075,7 @@ class UploadApi extends SparkVaultApi {
17054
17075
  });
17055
17076
  }
17056
17077
  /**
17057
- * Read the server's persisted upload offset via a TUS HEAD request — the one
17078
+ * Read the server's persisted upload offset via a TUS HEAD request: the one
17058
17079
  * place the client asks Forge where a session really stands.
17059
17080
  *
17060
17081
  * @param check - Which caller this read serves; shapes the failure copy.
@@ -17140,7 +17161,7 @@ const NAME_CONFLICT_POLICIES = ['upsert', 'complete_pending', 'refuse', 'new_nam
17140
17161
  *
17141
17162
  * Uploads and downloads run over the single canonical Forge TUS transfer path
17142
17163
  * (shared with the public upload widget), with server-side finalization and
17143
- * download-host allowlisting enforced — no per-size branching.
17164
+ * download-host allowlisting enforced, with no per-size branching.
17144
17165
  */
17145
17166
  class IngotsModule {
17146
17167
  constructor(config, http) {
@@ -17248,16 +17269,16 @@ class IngotsModule {
17248
17269
  }
17249
17270
  }
17250
17271
  /**
17251
- * Send a file's bytes to an upload session — the `uploadUrl` a
17252
- * {@link createUpload} returned — over the resumable transfer every SDK
17272
+ * Send a file's bytes to an upload session (the `uploadUrl` a
17273
+ * {@link createUpload} returned) over the resumable transfer every SDK
17253
17274
  * upload uses. Resolves only once the server confirms the ingot is
17254
17275
  * published, so a resolved promise never stands for a stored file whose
17255
17276
  * ingot never went live.
17256
17277
  *
17257
17278
  * Transient failures are retried inside the transfer; a session the server
17258
17279
  * no longer holds (it expired, was cancelled, or its ingot was removed)
17259
- * rejects with code `session_gone`, and only a new upload session — a new
17260
- * {@link createUpload}, or {@link upload} again — can store the file. An
17280
+ * rejects with code `session_gone`, and only a new upload session (a new
17281
+ * {@link createUpload}, or {@link upload} again) can store the file. An
17261
17282
  * upload the server refused (the account's storage pool cannot take it, a
17262
17283
  * later upload replaced it, or its vault is scheduled for deletion: a 409
17263
17284
  * `VAULT_DELETION_SCHEDULED`, whose session the server keeps until the
@@ -17354,9 +17375,9 @@ class IngotsModule {
17354
17375
  *
17355
17376
  * Creates the upload session, streams the file to Forge over TUS, then
17356
17377
  * confirms the server finalized the upload before resolving. A file the
17357
- * server refused — another upload of it superseded this one, at its create
17378
+ * server refused (another upload of it superseded this one, at its create
17358
17379
  * or while it streamed, the storage pool cannot take it, or its vault is
17359
- * scheduled for deletion (a 409 `VAULT_DELETION_SCHEDULED`) — rejects with
17380
+ * scheduled for deletion (a 409 `VAULT_DELETION_SCHEDULED`)) rejects with
17360
17381
  * code `upload_refused`, as {@link sendUpload} does. An upload that rejects
17361
17382
  * any way but one the server received whole ({@link isReceivedUploadFailure}:
17362
17383
  * the server publishes or ends that one on its own) is given up: the end of
@@ -17755,7 +17776,7 @@ class IngotsModule {
17755
17776
  await this.http.delete(apiPath `/v1/vaults/${vaultId}/ingots/${id}/sharing/invite/${invite}`, { vat: vault.vatToken });
17756
17777
  }
17757
17778
  /**
17758
- * Batch content-HMAC existence check — the pre-upload dedup handshake.
17779
+ * Batch content-HMAC existence check: the pre-upload dedup handshake.
17759
17780
  * Returns which of the supplied vault-keyed HMACs already exist on active
17760
17781
  * ingots in the vault, so callers can skip transferring those bytes.
17761
17782
  *
@@ -17798,7 +17819,7 @@ class IngotsModule {
17798
17819
  }
17799
17820
  /**
17800
17821
  * Request a Forge upload session for a new ingot.
17801
- * Shared by createUpload and upload — the single ingot-create path.
17822
+ * Shared by createUpload and upload: the single ingot-create path.
17802
17823
  */
17803
17824
  async requestUploadSession(vault, body) {
17804
17825
  const payload = {
@@ -17836,7 +17857,7 @@ class IngotsModule {
17836
17857
  * Run the canonical TUS transfer for a created/replaced ingot.
17837
17858
  *
17838
17859
  * The transfer resolves only once the server has confirmed finalization, so
17839
- * the ingot this returns is always a published one — never a stored file
17860
+ * the ingot this returns is always a published one, never a stored file
17840
17861
  * whose ingot never went active.
17841
17862
  */
17842
17863
  async transferAndFinalize(session, minted, file, onProgress) {
@@ -17941,22 +17962,24 @@ function mapInvitation(wire) {
17941
17962
  };
17942
17963
  }
17943
17964
 
17944
- /** The native support ceremony. Identity receipts stay inside the first-party window. */
17965
+ /** The native support ceremony. Identity's answer stays inside the Help Desk sign-in window. */
17945
17966
  const VALUE = /^[A-Za-z0-9_-]{43}$/;
17967
+ /** The one origin the sign-in window runs on. Never read from the challenge's sign-in URL, which is checked against it. */
17968
+ const SIGN_IN_ORIGIN = `https://${SPARKVAULT_HELP_DESK_SIGN_IN_HOST}`;
17946
17969
  /** The website's own opener policy cut the window off: no retry on this page can work, only its owner can fix it. */
17947
17970
  const SEVERED_MESSAGE = 'This website stops the support sign-in window from reporting back, so sign-in cannot finish here. Let the website\'s owner know.';
17948
- /** How often the sign-in window's handle is checked once it leaves for the sign-in page. */
17971
+ /** How often the sign-in window's handle is checked once it leaves for its start page. */
17949
17972
  const HANDLE_CHECK_MS = 500;
17950
17973
  /**
17951
17974
  * What a sign-in window's handle reading `closed` before its page's ready
17952
17975
  * message means. A website serving `Cross-Origin-Opener-Policy: same-origin`
17953
- * severs the window the moment its auth.sv page loads: the handle reads
17976
+ * severs the window the moment its start page loads: the handle reads
17954
17977
  * `closed` while the window stays open in front of the person, showing that
17955
17978
  * page's own "not connected" notice. So:
17956
17979
  * - the website's page holding focus again means the person closed the
17957
17980
  * window and is back on it: a cancellation;
17958
17981
  * - a handle that reads `closed` at the first check after the window left
17959
- * for the sign-in page, while the website's page still lacks focus, is a
17982
+ * for its start page, while the website's page still lacks focus, is a
17960
17983
  * severance: the window is still in front of the person, for no person
17961
17984
  * closes it that fast and then leaves the website;
17962
17985
  * - anything else cannot be told apart (a severance on a slow load, or a
@@ -17973,6 +17996,19 @@ function closedBeforeReady(firstCheck) {
17973
17996
  return new PopupSeveredError(SEVERED_MESSAGE);
17974
17997
  return new SparkVaultError('Support sign-in did not start. Try again.', 'HELP_DESK_WIDGET_SIGN_IN_INTERRUPTED');
17975
17998
  }
17999
+ /**
18000
+ * The challenge's start page, `https://signin.help.sv/{desk_id}/{challenge_id}`:
18001
+ * its sign-in URL when that is exactly the sign-in window's page for this
18002
+ * desk and this challenge, and the challenge's other values have their
18003
+ * shapes; else null.
18004
+ */
18005
+ function startPage(value, deskId) {
18006
+ if (!value || ![value.challenge_id, value.verifier, value.state].every((part) => typeof part === 'string' && VALUE.test(part)) ||
18007
+ !Number.isSafeInteger(value.expires_at))
18008
+ return null;
18009
+ const expected = `${SIGN_IN_ORIGIN}/${deskId}/${value.challenge_id}`;
18010
+ return value.sign_in_url === expected ? expected : null;
18011
+ }
17976
18012
  /**
17977
18013
  * Open synchronously inside the user's gesture, before preparing the server
17978
18014
  * challenge. A session redeemed after the sign-in already ended (cancelled,
@@ -17995,7 +18031,6 @@ function openWidgetIdentity(options, prepare, ready, redeem, discard, deskId) {
17995
18031
  catch { /* The popup may already have navigated. */ }
17996
18032
  return new Promise((resolve, reject) => {
17997
18033
  let challenge = null;
17998
- let firstPartyOrigin = null;
17999
18034
  let settled = false;
18000
18035
  let checking = false;
18001
18036
  let interval;
@@ -18040,19 +18075,19 @@ function openWidgetIdentity(options, prepare, ready, redeem, discard, deskId) {
18040
18075
  finish(null, session);
18041
18076
  };
18042
18077
  const receive = (event) => {
18043
- if (!challenge || event.source !== popup || event.origin !== firstPartyOrigin)
18078
+ if (!challenge || event.source !== popup || event.origin !== SIGN_IN_ORIGIN)
18044
18079
  return;
18045
18080
  const data = event.data;
18046
18081
  if (!data || data.challenge_id !== challenge.challenge_id)
18047
18082
  return;
18048
- // The first-party page this window opened asks for the challenge's
18049
- // state, without which Core takes none of its steps: only this popup,
18050
- // at the first-party origin, is ever answered, so a sign-in link opened
18051
- // in any other window or browser completes nothing.
18083
+ // The sign-in window this page opened asks for the challenge's state,
18084
+ // without which Core takes none of its steps: only this popup, at the
18085
+ // sign-in origin, is ever answered, so a sign-in link opened in any
18086
+ // other window or browser completes nothing.
18052
18087
  if (data.type === HELP_DESK_WIDGET_IDENTITY_MESSAGES.ready) {
18053
18088
  if (watch)
18054
18089
  clearInterval(watch);
18055
- popup.postMessage({ type: HELP_DESK_WIDGET_IDENTITY_MESSAGES.state, challenge_id: challenge.challenge_id, state: challenge.state }, event.origin);
18090
+ popup.postMessage({ type: HELP_DESK_WIDGET_IDENTITY_MESSAGES.state, challenge_id: challenge.challenge_id, state: challenge.state }, SIGN_IN_ORIGIN);
18056
18091
  return;
18057
18092
  }
18058
18093
  if (data.type !== HELP_DESK_WIDGET_IDENTITY_MESSAGES.result || data.state !== challenge.state)
@@ -18069,10 +18104,8 @@ function openWidgetIdentity(options, prepare, ready, redeem, discard, deskId) {
18069
18104
  void prepare().then((value) => {
18070
18105
  if (settled)
18071
18106
  return;
18072
- const url = new URL(value.sign_in_url);
18073
- if (!VALUE.test(value.challenge_id) || !VALUE.test(value.verifier) || !VALUE.test(value.state) || !Number.isSafeInteger(value.expires_at) ||
18074
- url.protocol !== 'https:' || url.origin !== 'https://auth.sv' || url.username || url.password || url.search || url.hash ||
18075
- url.pathname !== `/help-desk/${deskId}/${value.challenge_id}`)
18107
+ const url = startPage(value, deskId);
18108
+ if (!url)
18076
18109
  throw new SparkVaultError('The support sign-in address is invalid.', 'HELP_DESK_INVALID_RESPONSE');
18077
18110
  // The window still holds this page's own placeholder, which no opener
18078
18111
  // policy severs: closed now, the person closed it.
@@ -18081,8 +18114,7 @@ function openWidgetIdentity(options, prepare, ready, redeem, discard, deskId) {
18081
18114
  return;
18082
18115
  }
18083
18116
  challenge = value;
18084
- firstPartyOrigin = url.origin;
18085
- popup.location.replace(url.href);
18117
+ popup.location.replace(url);
18086
18118
  // A window whose handle dies before its page asks for the state can
18087
18119
  // never be handed it, so the sign-in ends at once (closedBeforeReady)
18088
18120
  // rather than polling until the challenge expires.
@@ -18093,8 +18125,8 @@ function openWidgetIdentity(options, prepare, ready, redeem, discard, deskId) {
18093
18125
  finish(closedBeforeReady(checks === 1));
18094
18126
  }, HANDLE_CHECK_MS);
18095
18127
  // Code delivery must survive a browser severing window.opener during
18096
- // the first-party Identity redirect. Polling knows only the original
18097
- // challenge and verifier; no Identity JWT ever reaches this page.
18128
+ // the window's Identity round trip. Polling knows only the original
18129
+ // challenge and verifier; no Identity token ever reaches this page.
18098
18130
  interval = setInterval(() => {
18099
18131
  if (settled || checking || !challenge)
18100
18132
  return;
@@ -18236,7 +18268,7 @@ class HelpDeskClient {
18236
18268
  this.releasedTokens = new Map();
18237
18269
  this.ownsSession = false;
18238
18270
  // Frozen copies of the records this client reads, so a page changing the desk it handed in (`HelpDeskConnectOptions.desk`) changes nothing here.
18239
- this.desk = Object.freeze({ ...desk, branding: Object.freeze({ ...desk.branding }), identity: desk.identity ? Object.freeze({ ...desk.identity }) : null,
18271
+ this.desk = Object.freeze({ ...desk, branding: Object.freeze({ ...desk.branding }),
18240
18272
  external_identity: desk.external_identity ? Object.freeze({ ...desk.external_identity }) : undefined,
18241
18273
  ticket_access_control: desk.ticket_access_control ? Object.freeze({ ...desk.ticket_access_control }) : undefined });
18242
18274
  this.http = http;
@@ -18618,10 +18650,6 @@ class HelpDeskClient {
18618
18650
  challenge_id: options.challengeId, binding_secret: options.bindingSecret, code: options.code,
18619
18651
  });
18620
18652
  }
18621
- /** Identity completion still requires a server-approved desk portal origin. */
18622
- completeIdentity(options) {
18623
- return this.establish(apiPath `/v1/hd/desks/${this.desk.desk_id}/auth/identity/complete`, { token: options.token });
18624
- }
18625
18653
  /** Uninstalled result: the owning form/controller decides when the new requester becomes current. */
18626
18654
  signInWidgetIdentity(options = {}) {
18627
18655
  const revision = this.revision;
@@ -18640,8 +18668,8 @@ class HelpDeskClient {
18640
18668
  const result = await this.send('POST', apiPath `/v1/hd/desks/${this.desk.desk_id}/auth/widget/redeem`, {
18641
18669
  challenge_id: challenge.challenge_id, verifier: challenge.verifier, ...(code && { code }),
18642
18670
  }, undefined, false);
18643
- // A native sign-in opens a session at the desk's issuer: an email sign-in's customer is linked to
18644
- // its Secure Identity (`identity`); a sign-in by the organization's own identity provider carries
18671
+ // A native sign-in opens a session at SparkVault's Identity: an email sign-in's customer carries
18672
+ // the `identity` assurance; a sign-in by the organization's own identity provider carries
18645
18673
  // the `federated` mark and the `federated` assurance together, never one without the other.
18646
18674
  const customer = result?.customer;
18647
18675
  const nativeIdentity = customer?.federated === true ? customer.assurance === 'federated' : customer?.assurance === 'identity';
@@ -19138,7 +19166,7 @@ function lastExtension(name) {
19138
19166
  * server never reads the plaintext of an uploaded ingot, so the policy splits
19139
19167
  * by where the bytes are: the NAME rule runs on the server at initiate and in
19140
19168
  * the browser before an upload starts; the SNIFF rule runs wherever the bytes
19141
- * are at hand — in the browser over the file's first slice, and on the server
19169
+ * are at hand, in the browser over the file's first slice and on the server
19142
19170
  * over an inbound email's parts. The type a ticket stores a file under, which
19143
19171
  * the MIME registry decides, is server-only: ./attachment-policy-node.js.
19144
19172
  *
@@ -21776,9 +21804,7 @@ function mountHelpDeskForm(client, options) {
21776
21804
  return;
21777
21805
  }
21778
21806
  hosted.hidden = newRequestUrl === null;
21779
- message(client.desk.auth_mode === 'identity_unavailable'
21780
- ? 'This help desk cannot sign you in right now. Try again later.'
21781
- : 'This help desk requires sign-in. Open it in a new tab to sign in and submit your request there.');
21807
+ message('This help desk requires sign-in. Open it in a new tab to sign in and submit your request there.');
21782
21808
  }
21783
21809
  async function submit() {
21784
21810
  if (pending || completed || destroyed)
@@ -26789,7 +26815,7 @@ function createHelpDeskSupport(config, options) {
26789
26815
  sourceArticleId = undefined;
26790
26816
  }
26791
26817
  /**
26792
- * Switch account from the contact form: auth.sv's chooser opens in this
26818
+ * Switch account from the contact form: the window's chooser opens in this
26793
26819
  * gesture, the current session staying current until another account's is
26794
26820
  * redeemed. A window that closes or fails rejects, nothing changed, for the
26795
26821
  * form to say so; a redeemed session takes the old one's place.
@@ -27309,7 +27335,7 @@ function idempotencyHeaders(key) {
27309
27335
  if (key === undefined)
27310
27336
  return undefined;
27311
27337
  if (typeof key !== 'string' || !/^[\x20-\x7E]{8,128}$/.test(key))
27312
- throw new ValidationError('idempotencyKey must contain 8–128 printable ASCII characters');
27338
+ throw new ValidationError('idempotencyKey must contain 8 to 128 printable ASCII characters');
27313
27339
  return { 'Idempotency-Key': key };
27314
27340
  }
27315
27341
  /** Empty pages are legitimate; a repeated cursor is never drained forever. */
@@ -28005,7 +28031,7 @@ function createSecuritySidebar(branding) {
28005
28031
  const STYLE_ID = 'sparkvault-upload-styles';
28006
28032
  /**
28007
28033
  * Inject upload widget styles into the document head.
28008
- * Idempotent: the stylesheet is static and shared by every widget instance —
28034
+ * Idempotent: the stylesheet is static and shared by every widget instance;
28009
28035
  * per-instance behavior (backdrop blur, dark mode) is driven by class toggles.
28010
28036
  */
28011
28037
  function injectUploadStyles() {
@@ -29468,7 +29494,7 @@ class UploadRenderer {
29468
29494
  this.hybridModalInitialized = false;
29469
29495
  // Lifecycle flags: a closed renderer must never render or fire callbacks,
29470
29496
  // and onCancel fires at most once per renderer (mutually exclusive with
29471
- // onError — see cancel()/handleApiError).
29497
+ // onError; see cancel()/handleApiError).
29472
29498
  this.closed = false;
29473
29499
  this.cancelled = false;
29474
29500
  // Counts the uploads this renderer started; an upload whose number is no
@@ -29554,7 +29580,7 @@ class UploadRenderer {
29554
29580
  }
29555
29581
  /**
29556
29582
  * Cancel the flow: tear everything down and fire the cancel contract
29557
- * exactly once. onCancel and onError are mutually exclusive — a deliberate
29583
+ * exactly once. onCancel and onError are mutually exclusive: a deliberate
29558
29584
  * cancellation (user close, programmatic close, or a new upload replacing
29559
29585
  * this renderer) must never surface as an error to the host.
29560
29586
  */
@@ -29578,7 +29604,7 @@ class UploadRenderer {
29578
29604
  this.cancel();
29579
29605
  }
29580
29606
  setState(state) {
29581
- // A closed renderer never renders again — a progress event racing the
29607
+ // A closed renderer never renders again: a progress event racing the
29582
29608
  // teardown must not resurrect the hybrid-mode modal or touch the DOM.
29583
29609
  if (this.closed)
29584
29610
  return;
@@ -29586,7 +29612,7 @@ class UploadRenderer {
29586
29612
  this.viewState = state;
29587
29613
  // Progress events fire many times per second for the whole transfer.
29588
29614
  // While the uploading view is already on screen, mutate its progress
29589
- // nodes in place instead of tearing down and rebuilding the subtree —
29615
+ // nodes in place instead of tearing down and rebuilding the subtree:
29590
29616
  // a full rebuild per event thrashes the DOM and restarts the progress
29591
29617
  // bar's CSS transition and the stage-arrow animation on every tick. The
29592
29618
  // view re-renders once, when every byte is sent and SparkVault is
@@ -30250,7 +30276,7 @@ class UploadRenderer {
30250
30276
  const sent = { bytesUploaded: file.size, bytesTotal: file.size, percentage: 100 };
30251
30277
  this.callbacks.onProgress?.({ ...sent, phase: 'ceremony' });
30252
30278
  this.callbacks.onProgress?.({ ...sent, phase: 'complete' });
30253
- // Silent mode: skip the success screen — fire onSuccess and close so
30279
+ // Silent mode: skip the success screen, fire onSuccess and close so
30254
30280
  // the host site can render its own post-upload UI.
30255
30281
  if (this.options.hideSuccessScreen) {
30256
30282
  this.callbacks.onSuccess(result);
@@ -30325,8 +30351,8 @@ class UploadRenderer {
30325
30351
  handleApiError(error, action = null) {
30326
30352
  // A closed renderer must not surface errors: cancelling mid-transfer
30327
30353
  // aborts the in-flight request, whose 'cancelled' rejection races the
30328
- // teardown. The host has already received onCancel — onCancel and
30329
- // onError are mutually exclusive — and the container is destroyed, so
30354
+ // teardown. The host has already received onCancel (onCancel and
30355
+ // onError are mutually exclusive) and the container is destroyed, so
30330
30356
  // there is nothing left to render into.
30331
30357
  if (this.closed || isCancellationError(error)) {
30332
30358
  return;
@@ -30486,7 +30512,7 @@ class VaultUploadModule {
30486
30512
  }
30487
30513
  // Public-API aliases. The dashboard's vault-edit screen and the SDK docs
30488
30514
  // document sv.vaults.upload.pop({ vaultId }) and
30489
- // sv.vaults.upload.render({ vaultId, target }) — both defer to upload().
30515
+ // sv.vaults.upload.render({ vaultId, target }); both defer to upload().
30490
30516
  /** Open the upload widget as a popup. Equivalent to `upload(options)`. */
30491
30517
  async pop(options) {
30492
30518
  return this.upload(options);
@@ -30660,7 +30686,7 @@ class VaultsModule {
30660
30686
  };
30661
30687
  }
30662
30688
  /**
30663
- * Retain this many previous versions of each file or structured object (0–50,
30689
+ * Retain this many previous versions of each file or structured object (0 to 50,
30664
30690
  * default 0). Interactive company administrators only. Applies on each ingot's
30665
30691
  * next successful content change; retained versions count toward storage usage.
30666
30692
  */
@@ -30718,7 +30744,7 @@ class VaultsModule {
30718
30744
  * Requires the vault's exact name as confirmation, matched case-sensitively.
30719
30745
  * The name is sent base64(UTF-8) as the `X-Confirm-Name-B64` header so a vault
30720
30746
  * named with any Unicode (emoji, CJK, the U+202F in macOS-style names) is
30721
- * deletable — an HTTP header value cannot carry non-latin1 characters.
30747
+ * deletable: an HTTP header value cannot carry non-latin1 characters.
30722
30748
  *
30723
30749
  * @example
30724
30750
  * await sv.vaults.delete('vlt_abc', 'My Vault');
@@ -31024,7 +31050,7 @@ class SparksModule {
31024
31050
  };
31025
31051
  }
31026
31052
  /**
31027
- * Read (and burn) a spark. Reading is destructive — the spark can be read
31053
+ * Read (and burn) a spark. Reading is destructive: the spark can be read
31028
31054
  * exactly once.
31029
31055
  * Supply the source vault's VAT for a Structured Ingots field Spark.
31030
31056
  *
@@ -31230,7 +31256,7 @@ class EntropyModule {
31230
31256
  /**
31231
31257
  * Generate `n` random bytes as a Uint8Array.
31232
31258
  *
31233
- * SECURITY: this returns raw *server* entropy — it is NOT finished key
31259
+ * SECURITY: this returns raw *server* entropy; it is NOT finished key
31234
31260
  * material. Client secret keys MUST hybrid-mix it: XOR the returned bytes with
31235
31261
  * a local CSPRNG (`crypto.getRandomValues`) before use, so the server share
31236
31262
  * alone can never determine the key.
@@ -31238,7 +31264,7 @@ class EntropyModule {
31238
31264
  * @example
31239
31265
  * const serverEntropy = await sv.entropy.generateBytes(32);
31240
31266
  * const localEntropy = crypto.getRandomValues(new Uint8Array(32));
31241
- * // Hybrid-mixed key material — safe to use as a secret key.
31267
+ * // Hybrid-mixed key material, safe to use as a secret key.
31242
31268
  * const key = serverEntropy.map((b, i) => b ^ localEntropy[i]);
31243
31269
  */
31244
31270
  async generateBytes(n) {
@@ -31287,7 +31313,7 @@ function validateEntropyRequest(bytes, format) {
31287
31313
  * Web Push registration. It is
31288
31314
  * not a tenant's inbox for its own end users: a tenant reads its recipients'
31289
31315
  * feeds with `sv.products.notify.getInbox`. The recipient is ALWAYS derived
31290
- * from the session on the server — no method takes a `recipient_id`, and any
31316
+ * from the session on the server: no method takes a `recipient_id`, and any
31291
31317
  * account/recipient a caller might try to supply is ignored. This mirrors
31292
31318
  * `@sparkvault/sdk-mobile`'s notify client; device push registration is
31293
31319
  * intentionally omitted (Expo-only on mobile).
@@ -31329,7 +31355,7 @@ class NotifyModule {
31329
31355
  this.http = http;
31330
31356
  }
31331
31357
  /**
31332
- * The caller's own inbox feed (newest first). Follow `cursor` to page — a
31358
+ * The caller's own inbox feed (newest first). Follow `cursor` to page: a
31333
31359
  * page can come back short of `limit` yet still carry a non-null cursor.
31334
31360
  *
31335
31361
  * @example
@@ -31343,7 +31369,7 @@ class NotifyModule {
31343
31369
  }
31344
31370
  /**
31345
31371
  * Bounded unseen badge count for the caller's own inbox. `capped` true means
31346
- * the true count is at/beyond the ceiling — render "N+".
31372
+ * the true count is at/beyond the ceiling: render "N+".
31347
31373
  *
31348
31374
  * @example
31349
31375
  * const { unread_count, capped } = await sv.notify.getUnreadCount();
@@ -31355,7 +31381,7 @@ class NotifyModule {
31355
31381
  /**
31356
31382
  * Apply a terminal display state to one of the caller's own rows (idempotent).
31357
31383
  * `createdAt` MUST be the row's own `created_at` (round-tripped from the list
31358
- * row) — the id alone cannot address the row.
31384
+ * row); the id alone cannot address the row.
31359
31385
  *
31360
31386
  * @example
31361
31387
  * await sv.notify.markState('ntf_abc', { createdAt: row.created_at, state: 'read' });
@@ -31379,7 +31405,7 @@ class NotifyModule {
31379
31405
  }
31380
31406
  /**
31381
31407
  * Bulk-mark ONE bounded page of the caller's inbox and return the server's
31382
- * payload verbatim. `cursor` comes back non-null while rows remain — thread it
31408
+ * payload verbatim. `cursor` comes back non-null while rows remain: thread it
31383
31409
  * into the next call. `archived` is per-row only (no GSI to page over), so the
31384
31410
  * bulk states are `seen` and `read`.
31385
31411
  *
@@ -31414,10 +31440,10 @@ class NotifyModule {
31414
31440
  * clears the unseen marker too, so the badge zeroes with it. Idempotent.
31415
31441
  *
31416
31442
  * `complete` is false when the loop stopped at the page bound with rows still
31417
- * unmarked — an inbox deeper than the bound finishes on a second call. Without
31443
+ * unmarked: an inbox deeper than the bound finishes on a second call. Without
31418
31444
  * it a truncated drain looks exactly like a finished one.
31419
31445
  *
31420
- * An error mid-drain propagates — the pages already marked stay marked, and a
31446
+ * An error mid-drain propagates: the pages already marked stay marked, and a
31421
31447
  * re-run picks up the remainder.
31422
31448
  *
31423
31449
  * @example
@@ -31449,7 +31475,7 @@ class NotifyModule {
31449
31475
  }
31450
31476
  /**
31451
31477
  * The platform VAPID public key for `pushManager.subscribe()`. `configured`
31452
- * is false until the server-side VAPID keypair is provisioned — hide the
31478
+ * is false until the server-side VAPID keypair is provisioned: hide the
31453
31479
  * enable-notifications affordance while false.
31454
31480
  */
31455
31481
  async getWebPushKey() {
@@ -31563,8 +31589,8 @@ class NotifyModule {
31563
31589
  }
31564
31590
  }
31565
31591
  // A subscription made against the current key is reused: registering it
31566
- // again refreshes its server TTL. One made against another key is dead — its
31567
- // push service refuses every push signed with this one — so it is replaced.
31592
+ // again refreshes its server TTL. One made against another key is dead (its
31593
+ // push service refuses every push signed with this one), so it is replaced.
31568
31594
  const held = await registration.pushManager.getSubscription();
31569
31595
  const existing = held && isBoundToKey(held, applicationServerKey) ? held : null;
31570
31596
  if (held && !existing) {
@@ -31736,7 +31762,7 @@ class SparkVault {
31736
31762
  return new SparkVault(config);
31737
31763
  }
31738
31764
  /**
31739
- * Whether a sign-in needs completing on this page load — a returned handoff
31765
+ * Whether a sign-in needs completing on this page load: a returned handoff
31740
31766
  * fragment, or a popup whose result was lost (a mobile opener-tab discard).
31741
31767
  * Side effect-free and instance-free, so a host that defers SDK init for
31742
31768
  * performance can cheaply decide whether to boot the SDK and call
@@ -31748,7 +31774,7 @@ class SparkVault {
31748
31774
  }
31749
31775
  /** Get the SDK version */
31750
31776
  static get version() {
31751
- return '17.0.1';
31777
+ return '18.0.0';
31752
31778
  }
31753
31779
  }
31754
31780
  if (typeof window !== 'undefined') {