@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
@@ -71,7 +71,7 @@ export interface VerifyOptions {
71
71
  * Container chrome for inline (`target`) rendering. `'card'` (default) wraps
72
72
  * the flow in a bordered, rounded surface with the SparkVault footer. `'bare'`
73
73
  * drops the surface and footer so a host page (e.g. the SparkVault sign-in
74
- * page) can supply its own full-window chrome — logo, background, footer.
74
+ * page) can supply its own full-window chrome: logo, background, footer.
75
75
  * Ignored in dialog mode.
76
76
  */
77
77
  chrome?: 'card' | 'bare';
@@ -80,13 +80,13 @@ export interface VerifyOptions {
80
80
  /**
81
81
  * How sign-in leaves this page. `'auto'` (default) and `'popup'` open the
82
82
  * first-party popup; `'redirect'` navigates this tab to the sign-in page
83
- * instead (its return leg is `handleRedirectResult()`) — the opt-out for
83
+ * instead (its return leg is `handleRedirectResult()`), the opt-out for
84
84
  * hosts that prefer a full-page redirect over a popup on mobile.
85
85
  */
86
86
  flow?: 'auto' | 'popup' | 'redirect';
87
87
  /**
88
88
  * `'select_account'` always shows the sign-in page's account chooser instead
89
- * of silently continuing as the current account — even when only one saved
89
+ * of silently continuing as the current account, even when only one saved
90
90
  * account exists. Any other value is dropped at URL serialization.
91
91
  */
92
92
  prompt?: 'select_account';
@@ -111,7 +111,7 @@ export interface VerifyOptions {
111
111
  identityTypes?: SigninIdentityType[];
112
112
  /**
113
113
  * Rendering strategy (internal). `'local'` renders the flow directly in this
114
- * document — used inside the popup that runs the flow, and forced for inline
114
+ * document: used inside the popup that runs the flow, and forced for inline
115
115
  * (`target`) rendering. Dialog mode (omitted) renders a thin launcher and
116
116
  * opens the popup.
117
117
  */
@@ -205,7 +205,7 @@ export interface PortalUrlOptions {
205
205
  /**
206
206
  * Focus a specific connected site on the Sites screen (an `acc_…` account ID).
207
207
  * When `section` is `'sites'` and `site` is omitted, defaults to this SDK's
208
- * own `accountId` — i.e. "manage this site". Ignored for other sections.
208
+ * own `accountId` (i.e. "manage this site"). Ignored for other sections.
209
209
  */
210
210
  site?: string;
211
211
  }
@@ -228,7 +228,7 @@ export interface VerifyResult {
228
228
  recommendations?: Recommendation[];
229
229
  }
230
230
  /**
231
- * Options for `signIn()` — the customer-facing popup sign-in. The popup owns its
231
+ * Options for `signIn()`: the customer-facing popup sign-in. The popup owns its
232
232
  * rendering, so there is no inline `target`/`renderMode`/`chrome`/`signinRef`/
233
233
  * `completesInWindow` here; those are internal to the SparkVault-hosted
234
234
  * sign-in surfaces.
@@ -248,7 +248,7 @@ export type RenderOptions = Omit<VerifyOptions, 'identityTypes'> & {
248
248
  /** The verified identity returned by `signIn()`. */
249
249
  export type SignInResult = VerifyResult;
250
250
  /**
251
- * Options for `handleRedirectResult()` — call once on every page load. It
251
+ * Options for `handleRedirectResult()`. Call once on every page load. It
252
252
  * redeems a returned sign-in code (from `flow: 'redirect'` or the silent SSO
253
253
  * self-heal) and, when a popup result was lost, triggers that self-heal. It
254
254
  * no-ops otherwise.
@@ -310,7 +310,7 @@ export interface TokenClaims {
310
310
  email_verified?: boolean;
311
311
  /**
312
312
  * The person's public avatar URL (my.auth.sv), present only when they have a visible
313
- * avatar. The URL always renders an image — their photo, or a neutral placeholder.
313
+ * avatar. The URL always renders an image: their photo, or a neutral placeholder.
314
314
  */
315
315
  picture?: string;
316
316
  }
@@ -407,7 +407,7 @@ export interface BackupSendResponse {
407
407
  method?: 'email' | 'sms' | 'voice';
408
408
  /** Code expiry (Unix seconds). */
409
409
  expires_at?: number;
410
- /** True when the identifier is already on the identity — no code was sent. */
410
+ /** True when the identifier is already on the identity; no code was sent. */
411
411
  already_verified?: boolean;
412
412
  }
413
413
  /** Response to POST /backup-verification/verify. */
@@ -470,7 +470,7 @@ export interface SecondFactorVerifyResponse {
470
470
  recommendations?: RawRecommendation[];
471
471
  }
472
472
  /**
473
- * What a SparkLink click produced for the sign-in waiting on it — pushed over
473
+ * What a SparkLink click produced for the sign-in waiting on it, pushed over
474
474
  * the WebSocket, or reclaimed by kindling when the socket was lost. Either the
475
475
  * login completed, or it is held at the second-factor gate and the SDK
476
476
  * collects the code in its two-factor view.
@@ -37,9 +37,9 @@ export declare function callerIdentityTypes(identityTypes: SigninIdentityType[]
37
37
  */
38
38
  export declare function identityTypesParam(types: readonly SigninIdentityType[] | null): Record<string, string>;
39
39
  /**
40
- * This page as a navigation return target: origin, path, and query — the query
41
- * carries the page's own state (app routing, or the sign-in page's validated
42
- * destination) — without the fragment, which is the channel a result returns
40
+ * This page as a navigation return target: origin, path, and query (the query
41
+ * carries the page's own state, whether app routing or the sign-in page's validated
42
+ * destination), without the fragment, which is the channel a result returns
43
43
  * in.
44
44
  */
45
45
  export declare function currentPageReturnUrl(): string;
@@ -7,15 +7,15 @@
7
7
  * Includes a "Not now" skip that suppresses this method's prompt for 30 days
8
8
  * (handled by the renderer).
9
9
  *
10
- * Sibling of PasskeyPromptView — same low-friction, skippable shape.
10
+ * Sibling of PasskeyPromptView: same low-friction, skippable shape.
11
11
  */
12
12
  import type { View } from './base';
13
13
  export interface BackupVerifyViewProps {
14
- /** Which identifier to collect — the inverse of what they logged in with. */
14
+ /** Which identifier to collect: the inverse of what they logged in with. */
15
15
  missingType: 'email' | 'phone';
16
16
  /** Submit the validated identifier to send a code. */
17
17
  onSubmit: (value: string) => void;
18
- /** Skip ("Not now") — suppresses this method for 30 days. */
18
+ /** Skip ("Not now"): suppresses this method for 30 days. */
19
19
  onSkip: () => void;
20
20
  /** Error to display (e.g. send failed, or identifier already in use). */
21
21
  error?: string;
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import type { View } from './base';
7
7
  /**
8
- * Error codes that mean the site owner's Identity access is blocked — the
8
+ * Error codes that mean the site owner's Identity access is blocked: the
9
9
  * free trial was exhausted or expired, or a paid plan hit its capacity wall.
10
10
  * The end user can do nothing about these, so the ErrorView renders a friendly,
11
11
  * non-leaky interstitial (no "Try Again", no debug code badge) exactly like
@@ -24,7 +24,7 @@ export interface IdentityInputViewProps {
24
24
  /** Called with validated identity */
25
25
  onSubmit: (result: IdentityInputResult) => void;
26
26
  /**
27
- * When set, offer a "Sign in with a passkey" shortcut below the form —
27
+ * When set, offer a "Sign in with a passkey" shortcut below the form:
28
28
  * the way back into the discoverable ceremony for a returning browser
29
29
  * whose auto-started prompt was dismissed.
30
30
  */
@@ -12,7 +12,7 @@ import type { IdentityType } from './identity-input';
12
12
  import type { MethodMetadata } from '../types';
13
13
  export interface MethodSelectViewProps {
14
14
  email?: string;
15
- /** Channel of the identifier being verified — drives the back-link label. */
15
+ /** Channel of the identifier being verified; drives the back-link label. */
16
16
  identityType?: IdentityType;
17
17
  methods: MethodMetadata[];
18
18
  onSelectMethod: (method: MethodMetadata) => void;
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Full-dialog terminal screen shown when the embedding site's origin is not in
5
5
  * the account's verified-domains allowlist. The audience is the website owner /
6
- * developer — this is a misconfiguration surface, not an end-user error, and it
7
- * is permanent (retrying never clears an origin block) — so the dialog drops
6
+ * developer: this is a misconfiguration surface, not an end-user error, and it
7
+ * is permanent (retrying never clears an origin block), so the dialog drops
8
8
  * customer branding, offers no "Try Again", names the blocked origin, and
9
9
  * points to the place that fixes it. Reuses the SparkVault-notice styling from
10
10
  * the product-not-configured view.
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Shown behind the browser's passkey sheet while an auto-started discoverable
5
5
  * ceremony runs (returning browsers carrying the passkey-hint cookie). The
6
- * ceremony was fired without a click, so this screen has no action button —
6
+ * ceremony was fired without a click, so this screen has no action button,
7
7
  * only a live status and an escape hatch to the identifier form for anyone
8
8
  * who wants a different method (or whose sheet hangs).
9
9
  */
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Full-dialog terminal screen shown when the SparkVault Identity Product has
5
5
  * not been configured for the account that the JS SDK is configured against. The
6
- * audience is the website owner / developer — this is a misconfiguration
7
- * surface, not an end-user error — so the dialog drops customer branding and
6
+ * audience is the website owner / developer: this is a misconfiguration
7
+ * surface, not an end-user error, so the dialog drops customer branding and
8
8
  * presents itself as an unmistakable SparkVault notice.
9
9
  */
10
10
  import type { View } from './base';
@@ -2,7 +2,7 @@
2
2
  * Service Unavailable View
3
3
  *
4
4
  * Shown when the identity config endpoint is unreachable.
5
- * Clean, professional, branded — no error codes or technical jargon.
5
+ * Clean, professional, branded, with no error codes or technical jargon.
6
6
  */
7
7
  import type { View } from './base';
8
8
  export interface ServiceUnavailableViewProps {
@@ -17,7 +17,7 @@ export declare class ProductsModule {
17
17
  /** Identity verification product (passkey, OTP, SparkLink, social). */
18
18
  readonly identity: IdentityModule;
19
19
  /**
20
- * Notify product — the tenant/sender surface (send, sender-side inbox, status,
20
+ * Notify product: the tenant/sender surface (send, sender-side inbox, status,
21
21
  * receipts, config). Distinct from `sv.notify`, which is the signed-in
22
22
  * recipient's own inbox.
23
23
  */
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Notify Product Module — the TENANT (sender) surface.
2
+ * Notify Product Module: the TENANT (sender) surface.
3
3
  *
4
4
  * The counterpart to `sv.notify`: where that module is SparkVault's own
5
5
  * first-party inbox, which a signed-in SparkVault user reads for the
6
6
  * notifications SparkVault delivered to them `in_app`, this one is the
7
- * account-scoped product surface a tenant's BACKEND drives — send, send
7
+ * account-scoped product surface a tenant's BACKEND drives (send, send
8
8
  * history, recall, sender-side inbox reads and state, send status, receipts,
9
- * the account's Notify config, and who its email is from.
9
+ * the account's Notify config, and who its email is from).
10
10
  * A tenant reads its own recipients' feeds here (`getInbox`), never through
11
11
  * `sv.notify`. Every method maps to
12
12
  * `/v1/products/notify/*` and is authorized by the caller's account, so the
@@ -27,7 +27,7 @@ import type { CreateNotifySendOptions, NotifySendResult, NotifyPreset, NotifyPre
27
27
  * The five secure-by-default preset bundles: the server's own table, in this
28
28
  * SDK's camelCase shape.
29
29
  *
30
- * There is no preset endpoint — presets are a merge over the one send contract,
30
+ * There is no preset endpoint: presets are a merge over the one send contract,
31
31
  * so they are applied client-side and produce an ordinary `send` request. Caller
32
32
  * arguments win over a preset's defaults wherever they state a value;
33
33
  * `channels` left unset lets the account config resolve the ladder per category.
@@ -70,8 +70,8 @@ export declare class NotifyProductModule {
70
70
  * recipient, and enqueue delivery across the resolved channel ladder.
71
71
  *
72
72
  * `sendId` is the idempotency key. Replaying an existing one with the same
73
- * request returns the stored send unchanged — never re-sealed, never
74
- * re-delivered — flagged `idempotent`; another request under it is refused 400
73
+ * request returns the stored send unchanged (never re-sealed, never
74
+ * re-delivered), flagged `idempotent`; another request under it is refused 400
75
75
  * (`sendId` on `CreateNotifySendOptions`).
76
76
  *
77
77
  * The send speaks in your organization's name, and one that would email
@@ -85,12 +85,12 @@ export declare class NotifyProductModule {
85
85
  * | Status | `serviceCode` | `details` | Next |
86
86
  * | --- | --- | --- | --- |
87
87
  * | 403 | `NOTIFY_CHANNEL_NOT_AVAILABLE` | `{ field, channels }` | Name only `in_app` and `email` |
88
- * | 409 | `NOTIFY_SENDER_NAME_REQUIRED` | — | Name the organization in Settings |
88
+ * | 409 | `NOTIFY_SENDER_NAME_REQUIRED` | none | Name the organization in Settings |
89
89
  * | 409 | `NOTIFY_SENDER_NAME_RESERVED` | `{ reason: 'reserved_name' }` | Rename the organization |
90
90
  * | 409 | `HANDLE_REQUIRED` | `{ product: 'notify' }` | Choose the organization's handle in Company Settings |
91
91
  * | 429 | `NOTIFY_EMAIL_ADMISSION_LIMIT` | `{ limit, window: 'hour', resets_at }` | Wait `retryAfterMs`, then send |
92
- * | 503 | `EMAIL_SETUP_BUSY` | — | Retry the same send after `retryAfterMs` |
93
- * | 503 | `NOTIFY_EMAIL_CAPACITY_UNAVAILABLE` | — | Retry the same send |
92
+ * | 503 | `EMAIL_SETUP_BUSY` | none | Retry the same send after `retryAfterMs` |
93
+ * | 503 | `NOTIFY_EMAIL_CAPACITY_UNAVAILABLE` | none | Retry the same send |
94
94
  *
95
95
  * A replay is answered from the stored send and meets none of them again.
96
96
  *
@@ -104,7 +104,7 @@ export declare class NotifyProductModule {
104
104
  * category: 'transactional',
105
105
  * });
106
106
  *
107
- * @example Send a stored file — the unsealed vault proves you hold its key
107
+ * @example Send a stored file: the unsealed vault proves you hold its key
108
108
  * const vault = await sv.vaults.unseal('vlt_abc', process.env.CONTRACTS_DVAK);
109
109
  * await sv.products.notify.send({
110
110
  * sendId: `contract:${contract.id}`,
@@ -116,7 +116,7 @@ export declare class NotifyProductModule {
116
116
  */
117
117
  send(options: CreateNotifySendOptions): Promise<NotifySendResult>;
118
118
  /**
119
- * Frictionless informational ping — no verification, view-only, delivered
119
+ * Frictionless informational ping: no verification, view-only, delivered
120
120
  * INLINE (plaintext) so it is read at a glance. Channels resolve from the
121
121
  * account config, narrowed to the ones that render cleartext.
122
122
  *
@@ -180,7 +180,7 @@ export declare class NotifyProductModule {
180
180
  * grant still opens, never the content; a plaintext row carries its body.
181
181
  * Treat the answer as sensitive and keep it out of logs.
182
182
  *
183
- * A page can come back SHORT of `limit` yet still carry a non-null cursor —
183
+ * A page can come back SHORT of `limit` yet still carry a non-null cursor:
184
184
  * follow the cursor; never treat a short page as the end.
185
185
  *
186
186
  * @example
@@ -192,7 +192,7 @@ export declare class NotifyProductModule {
192
192
  getInbox(options: ListNotifyInboxOptions): Promise<ListNotifyInboxResponse>;
193
193
  /**
194
194
  * Apply a terminal display state to one row (idempotent). `createdAt` MUST be
195
- * the row's own `created_at`, round-tripped from the feed row — the id alone
195
+ * the row's own `created_at`, round-tripped from the feed row; the id alone
196
196
  * cannot address the row. Any mark (seen, read or archived) marks the row seen,
197
197
  * which stops its escalation.
198
198
  *
@@ -219,7 +219,7 @@ export declare class NotifyProductModule {
219
219
  */
220
220
  markInboxAll(options: MarkNotifyInboxAllOptions): Promise<MarkNotifyInboxAllResponse>;
221
221
  /**
222
- * The account's send history, newest first — what you sent, to how many, and
222
+ * The account's send history, newest first: what you sent, to how many, and
223
223
  * how it landed.
224
224
  *
225
225
  * Metadata only by construction: the history index does not project the
@@ -247,13 +247,13 @@ export declare class NotifyProductModule {
247
247
  *
248
248
  * `mode: 'grant'` (the default) drops access and leaves the content intact.
249
249
  * `mode: 'content'` hard-burns the sealed spark so it is unreadable for
250
- * everyone — spark-backed sends only: an ingot send merely references the
250
+ * everyone. Spark-backed sends only: an ingot send merely references the
251
251
  * owner's durable vault content, so a content recall of one is a 400, refused
252
252
  * before anything is revoked or stopped.
253
253
  *
254
254
  * Idempotent: a grant already revoked (or already consumed) counts as recalled,
255
255
  * so a repeated call converges rather than accumulating failures. One
256
- * recipient's failure never stops the rest — the response reports every one.
256
+ * recipient's failure never stops the rest; the response reports every one.
257
257
  *
258
258
  * PLAINTEXT SENDS CANNOT BE RECALLED (400): they delivered their body inline,
259
259
  * in the clear, and minted no grant. There is nothing to revoke, and saying
@@ -272,7 +272,7 @@ export declare class NotifyProductModule {
272
272
  recallSend(sendId: string, options?: RecallNotifySendOptions): Promise<RecallNotifySendResponse>;
273
273
  /**
274
274
  * The sender's per-recipient delivery rollup for one send: who it reached and
275
- * how far each recipient got. Metadata only — never the pointer, and no contact
275
+ * how far each recipient got. Metadata only: never the pointer, and no contact
276
276
  * beyond the handle each recipient was addressed by (`recipient_id`).
277
277
  *
278
278
  * @example
@@ -293,7 +293,7 @@ export declare class NotifyProductModule {
293
293
  /**
294
294
  * Every receipt for one send, each attached to the recipient who produced it.
295
295
  * The walk reads the account's receipts back to the send's creation, and no
296
- * further. One call is bounded: when `truncated` is true it stopped first —
296
+ * further. One call is bounded: when `truncated` is true it stopped first;
297
297
  * pass the returned `cursor` back in to resume exactly where it stopped.
298
298
  *
299
299
  * @example
@@ -324,7 +324,7 @@ export declare class NotifyProductModule {
324
324
  * Merge a partial patch onto the account's config overrides. Unknown keys are
325
325
  * rejected before any write.
326
326
  *
327
- * Delete a category by storing an explicit `null` TOMBSTONE — that is what keeps
327
+ * Delete a category by storing an explicit `null` TOMBSTONE: that is what keeps
328
328
  * a seeded default from re-appearing on the next merge. The reserved `security`
329
329
  * category can neither be removed nor made optional, the promotional
330
330
  * categories `marketing` and `product` can never be made required: their email
@@ -335,7 +335,7 @@ export declare class NotifyProductModule {
335
335
  * The `events` section configures the outbound event webhook: `webhook_url`
336
336
  * must be https on a public host, and `secret` (16-256 chars) signs every event
337
337
  * body as `X-SparkVault-Signature: hex(HMAC-SHA256(secret, rawBody))`. Both
338
- * are WRITE-ONLY — reads report `events.webhook_url_set`,
338
+ * are WRITE-ONLY: reads report `events.webhook_url_set`,
339
339
  * `events.webhook_url_host` and `events.secret_set`, never the values. A
340
340
  * `webhook_url` on another host or port needs a new `secret` in the same
341
341
  * patch (400 `VALIDATION_ERROR` naming `events.secret`), so a secret never
@@ -355,7 +355,7 @@ export declare class NotifyProductModule {
355
355
  * await sv.products.notify.updateConfig({
356
356
  * categories: {
357
357
  * weekly_newsletter: { label: 'Weekly newsletter', required: false },
358
- * marketing: null, // tombstone — remove the seeded default
358
+ * marketing: null, // tombstone: remove the seeded default
359
359
  * },
360
360
  * events: {
361
361
  * webhook_url: 'https://api.example.com/hooks/sparkvault',