@sparkvault/sdk-js 19.0.0 → 19.1.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 (132) hide show
  1. package/README.md +26 -4
  2. package/dist/npm/chunks/index-BnP-2w0t.cjs +13025 -0
  3. package/dist/npm/chunks/index-BnP-2w0t.cjs.map +1 -0
  4. package/dist/npm/chunks/index-CgR08uMG.mjs +12960 -0
  5. package/dist/npm/chunks/index-CgR08uMG.mjs.map +1 -0
  6. package/dist/npm/identity.cjs +23 -0
  7. package/dist/npm/identity.cjs.map +1 -0
  8. package/dist/npm/identity.mjs +12 -0
  9. package/dist/npm/identity.mjs.map +1 -0
  10. package/dist/{index.cjs → npm/index.cjs} +799 -13755
  11. package/dist/npm/index.cjs.map +1 -0
  12. package/dist/{index.mjs → npm/index.mjs} +200 -13155
  13. package/dist/npm/index.mjs.map +1 -0
  14. package/dist/sparkvault-identity.js +2 -0
  15. package/dist/sparkvault-identity.js.map +1 -0
  16. package/dist/sparkvault.js +1 -1
  17. package/dist/types/identity.d.ts +8 -0
  18. package/dist/{index.d.ts → types/index.d.ts} +4 -790
  19. package/dist/types/shared/errors-C-gjmGBs.d.ts +800 -0
  20. package/package.json +20 -9
  21. package/dist/api-base.d.ts +0 -116
  22. package/dist/auto-init.d.ts +0 -32
  23. package/dist/config.d.ts +0 -79
  24. package/dist/entropy/index.d.ts +0 -35
  25. package/dist/entropy/types.d.ts +0 -32
  26. package/dist/errors.d.ts +0 -146
  27. package/dist/folders/index.d.ts +0 -102
  28. package/dist/folders/types.d.ts +0 -91
  29. package/dist/health.d.ts +0 -18
  30. package/dist/http.d.ts +0 -46
  31. package/dist/index.cjs.map +0 -1
  32. package/dist/index.mjs.map +0 -1
  33. package/dist/ingots/fetch-download.d.ts +0 -78
  34. package/dist/ingots/history.d.ts +0 -4
  35. package/dist/ingots/index.d.ts +0 -388
  36. package/dist/ingots/revision.d.ts +0 -4
  37. package/dist/ingots/types.d.ts +0 -556
  38. package/dist/logger.d.ts +0 -32
  39. package/dist/notify/index.d.ts +0 -154
  40. package/dist/notify/types.d.ts +0 -232
  41. package/dist/products/help-desk/client.d.ts +0 -198
  42. package/dist/products/help-desk/desk-id.d.ts +0 -2
  43. package/dist/products/help-desk/form-draft.d.ts +0 -37
  44. package/dist/products/help-desk/form-types.d.ts +0 -123
  45. package/dist/products/help-desk/form.d.ts +0 -83
  46. package/dist/products/help-desk/index.d.ts +0 -47
  47. package/dist/products/help-desk/kb-client.d.ts +0 -48
  48. package/dist/products/help-desk/kb-types.d.ts +0 -59
  49. package/dist/products/help-desk/modal.d.ts +0 -8
  50. package/dist/products/help-desk/styles.d.ts +0 -9
  51. package/dist/products/help-desk/support-analytics-types.d.ts +0 -32
  52. package/dist/products/help-desk/support-analytics.d.ts +0 -3
  53. package/dist/products/help-desk/support-brand.d.ts +0 -49
  54. package/dist/products/help-desk/support-controller.d.ts +0 -4
  55. package/dist/products/help-desk/support-history.d.ts +0 -38
  56. package/dist/products/help-desk/support-launcher.d.ts +0 -12
  57. package/dist/products/help-desk/support-styles.d.ts +0 -14
  58. package/dist/products/help-desk/support-types.d.ts +0 -66
  59. package/dist/products/help-desk/support-view.d.ts +0 -173
  60. package/dist/products/help-desk/types.d.ts +0 -285
  61. package/dist/products/help-desk/widget-identity.d.ts +0 -32
  62. package/dist/products/identity/api.d.ts +0 -237
  63. package/dist/products/identity/container.d.ts +0 -44
  64. package/dist/products/identity/dialog-launcher.d.ts +0 -133
  65. package/dist/products/identity/federation-flow.d.ts +0 -31
  66. package/dist/products/identity/handlers/otp-handler.d.ts +0 -69
  67. package/dist/products/identity/handlers/passkey-handler.d.ts +0 -105
  68. package/dist/products/identity/handlers/sparklink-handler.d.ts +0 -34
  69. package/dist/products/identity/index.d.ts +0 -296
  70. package/dist/products/identity/inline-container.d.ts +0 -53
  71. package/dist/products/identity/methods.d.ts +0 -19
  72. package/dist/products/identity/modal.d.ts +0 -51
  73. package/dist/products/identity/pending-signin.d.ts +0 -102
  74. package/dist/products/identity/popup-launcher.d.ts +0 -73
  75. package/dist/products/identity/renderer.d.ts +0 -525
  76. package/dist/products/identity/state.d.ts +0 -84
  77. package/dist/products/identity/styles.d.ts +0 -31
  78. package/dist/products/identity/types.d.ts +0 -561
  79. package/dist/products/identity/utils/cooldown-timer.d.ts +0 -73
  80. package/dist/products/identity/utils.d.ts +0 -85
  81. package/dist/products/identity/views/backup-verify.d.ts +0 -42
  82. package/dist/products/identity/views/base.d.ts +0 -51
  83. package/dist/products/identity/views/error.d.ts +0 -65
  84. package/dist/products/identity/views/icons.d.ts +0 -41
  85. package/dist/products/identity/views/identity-input.d.ts +0 -80
  86. package/dist/products/identity/views/index.d.ts +0 -20
  87. package/dist/products/identity/views/loading.d.ts +0 -23
  88. package/dist/products/identity/views/method-button.d.ts +0 -14
  89. package/dist/products/identity/views/method-select.d.ts +0 -42
  90. package/dist/products/identity/views/origin-not-allowed.d.ts +0 -25
  91. package/dist/products/identity/views/otp-verify.d.ts +0 -58
  92. package/dist/products/identity/views/passkey-auto.d.ts +0 -22
  93. package/dist/products/identity/views/passkey-prompt.d.ts +0 -25
  94. package/dist/products/identity/views/passkey.d.ts +0 -38
  95. package/dist/products/identity/views/product-not-configured.d.ts +0 -21
  96. package/dist/products/identity/views/service-unavailable.d.ts +0 -21
  97. package/dist/products/identity/views/sms-consent.d.ts +0 -16
  98. package/dist/products/identity/views/sparklink-waiting.d.ts +0 -40
  99. package/dist/products/identity/views/two-factor.d.ts +0 -37
  100. package/dist/products/index.d.ts +0 -51
  101. package/dist/products/messaging/index.d.ts +0 -38
  102. package/dist/products/messaging/types.d.ts +0 -162
  103. package/dist/products/notify/index.d.ts +0 -436
  104. package/dist/products/notify/project-types.d.ts +0 -44
  105. package/dist/products/notify/projects.d.ts +0 -15
  106. package/dist/products/notify/types.d.ts +0 -1327
  107. package/dist/products/structured-ingots/index.d.ts +0 -31
  108. package/dist/products/structured-ingots/types-client.d.ts +0 -19
  109. package/dist/products/structured-ingots/types.d.ts +0 -293
  110. package/dist/products/structured-ingots/validation.d.ts +0 -25
  111. package/dist/request-path.d.ts +0 -44
  112. package/dist/sparks/index.d.ts +0 -91
  113. package/dist/sparks/types.d.ts +0 -304
  114. package/dist/ui/chrome.d.ts +0 -16
  115. package/dist/ui/ds-tokens.d.ts +0 -59
  116. package/dist/ui/inline-shell.d.ts +0 -19
  117. package/dist/ui/live-region.d.ts +0 -15
  118. package/dist/ui/modal-shell.d.ts +0 -67
  119. package/dist/ui/target.d.ts +0 -6
  120. package/dist/utils/dom.d.ts +0 -26
  121. package/dist/vault-session.d.ts +0 -2
  122. package/dist/vaults/index.d.ts +0 -254
  123. package/dist/vaults/types.d.ts +0 -368
  124. package/dist/vaults/upload/api.d.ts +0 -310
  125. package/dist/vaults/upload/chrome.d.ts +0 -21
  126. package/dist/vaults/upload/container.d.ts +0 -37
  127. package/dist/vaults/upload/index.d.ts +0 -76
  128. package/dist/vaults/upload/inline-container.d.ts +0 -41
  129. package/dist/vaults/upload/modal.d.ts +0 -55
  130. package/dist/vaults/upload/renderer.d.ts +0 -150
  131. package/dist/vaults/upload/styles.d.ts +0 -14
  132. package/dist/vaults/upload/types.d.ts +0 -220
@@ -1,150 +0,0 @@
1
- /**
2
- * Upload Renderer
3
- *
4
- * Orchestrates view state and rendering for vault upload flows.
5
- * Manages the complete upload lifecycle: form, uploading (the bytes moving,
6
- * then SparkVault securing the file until it confirms the save), completion.
7
- */
8
- import type { UploadOptions, UploadResult, UploadProgress } from './types';
9
- import type { UploadContainer } from './container';
10
- import { UploadApi } from './api';
11
- interface RendererCallbacks {
12
- onSuccess: (result: UploadResult) => void;
13
- onError: (error: Error) => void;
14
- onCancel: () => void;
15
- onProgress?: (progress: UploadProgress) => void;
16
- onReady?: () => void;
17
- }
18
- export declare class UploadRenderer {
19
- private readonly api;
20
- private readonly container;
21
- private readonly options;
22
- private readonly callbacks;
23
- private viewState;
24
- private config;
25
- private selectedFile;
26
- private fileInputElement;
27
- private uploadModal;
28
- private isInlineMode;
29
- private hybridModalInitialized;
30
- private closed;
31
- private cancelled;
32
- private uploadGeneration;
33
- private uploadInFlight;
34
- private ready;
35
- /**
36
- * A browser tab closed or reloaded mid-transfer loses the upload, so the
37
- * tab asks first while one runs (holdPage). Each renderer holds the page
38
- * with its own listener, so one ending never releases another's hold.
39
- */
40
- private readonly warnBeforeLeaving;
41
- constructor(container: UploadContainer, api: UploadApi, options: UploadOptions, callbacks: RendererCallbacks);
42
- /**
43
- * Start the upload flow.
44
- */
45
- start(): Promise<void>;
46
- /**
47
- * Close the upload flow.
48
- * Cancels all pending API requests and active uploads (aborting the session
49
- * signal tears down any in-flight TUS chunk) to prevent orphaned operations.
50
- */
51
- close(): void;
52
- /**
53
- * Cancel the flow: tear everything down and fire the cancel contract
54
- * exactly once. onCancel and onError are mutually exclusive: a deliberate
55
- * cancellation (user close, programmatic close, or a new upload replacing
56
- * this renderer) must never surface as an error to the host.
57
- */
58
- cancel(): void;
59
- /**
60
- * The dialog's dismissals: Escape, a tap on its backdrop, and its close
61
- * button, which the uploading view hides. While an upload runs, Escape and
62
- * a tap are too easy to do by accident to end it, as in the dialog inline
63
- * mode runs the upload in (renderInModal): the view's Cancel upload stops
64
- * it, and once SparkVault secures the file nothing does.
65
- */
66
- private handleClose;
67
- private setState;
68
- /**
69
- * Targeted DOM update for an already-rendered uploading view: progress fill
70
- * width plus the percentage and byte-count labels. Returns false when the
71
- * uploading view is not in the DOM, so the caller falls back to a full render.
72
- */
73
- private updateUploadProgress;
74
- private render;
75
- /**
76
- * A redraw replaces the control the person just used, so once the widget is
77
- * ready (this.ready) focus never drops to the page: it lands on Upload
78
- * securely once a file is chosen, on the drop target before one is, and on
79
- * the heading every other view leads with (tabindex -1: it takes focus
80
- * without joining the Tab order). The loading view has nothing to focus.
81
- */
82
- private focusView;
83
- /**
84
- * Render the uploading state in a modal overlay (for inline mode).
85
- * This provides the full polished experience during upload.
86
- */
87
- private renderInModal;
88
- private renderLoading;
89
- private renderForm;
90
- private renderUploading;
91
- private renderComplete;
92
- /**
93
- * Copy the Ingot ID, saying beside it that it landed ("Copied", for
94
- * COPIED_SHOWS_MS) or that the browser refused it, and how to take the ID
95
- * instead. A browser without the clipboard API refuses like one that denies
96
- * it.
97
- */
98
- private copyIngotId;
99
- /**
100
- * A file whose every byte reached SparkVault, which is still saving it and
101
- * finishes on its own: received, never failed, so it reads as an outcome,
102
- * with the way on to another file.
103
- */
104
- private renderReceived;
105
- private renderError;
106
- /** The button that takes the person back to the form, with or without the chosen file. */
107
- private recoveryButton;
108
- /**
109
- * Whether a file the person drops, picks, pastes or removes counts: only on
110
- * the form, and only while no upload runs (uploadInFlight). The paste
111
- * listener hears the whole page in every view, and a file it took mid-upload
112
- * would start a second upload beside the first.
113
- */
114
- private formTakesFile;
115
- private handleFileSelect;
116
- private openFileSelector;
117
- private cleanupFileInput;
118
- private pasteHandler;
119
- private setupPasteHandler;
120
- private cleanupPasteHandler;
121
- private startUpload;
122
- /**
123
- * Stop the upload whose bytes are moving. The stopped upload's late events
124
- * render nothing and tell the host nothing (uploadGeneration).
125
- *
126
- * A file the host chose itself skipped the form, so its upload ends the
127
- * widget through the cancel contract (cancel(): the transfer aborted with
128
- * the session, onCancel, UserCancelledError), and the host offers its own
129
- * way on. A file chosen on the widget returns to the form, still chosen, so
130
- * a wrong or slow pick costs one tap: the transfer is aborted with the
131
- * session's signal, a fresh session serves the next upload, and neither
132
- * callback fires, since the widget stays open and the host hears of the
133
- * next upload.
134
- */
135
- private cancelUpload;
136
- /**
137
- * Ask before the page is closed or reloaded while an upload runs
138
- * (this.warnBeforeLeaving), or stop asking.
139
- */
140
- private holdPage;
141
- /**
142
- * Show a failure (`action`: the way on it offers, none for a page that
143
- * could not load), and tell the host through onError. A file received whole
144
- * and still being saved reads as received, never as a failure; the host
145
- * still hears it through onError, with its code, which tells it never to
146
- * upload the file again.
147
- */
148
- private handleApiError;
149
- }
150
- export {};
@@ -1,14 +0,0 @@
1
- /**
2
- * Upload Widget Styles
3
- *
4
- * SparkVault design system, product register, as the identity modal: slate
5
- * neutrals with Action Blue carrying interactivity, on a light card that turns
6
- * to the dark surface while the upload runs. Every color is the design
7
- * system's (ui/ds-tokens).
8
- */
9
- /**
10
- * Inject upload widget styles into the document head.
11
- * Idempotent: the stylesheet is static and shared by every widget instance;
12
- * per-instance behavior (backdrop blur, dark mode) is driven by class toggles.
13
- */
14
- export declare function injectUploadStyles(): void;
@@ -1,220 +0,0 @@
1
- /**
2
- * Vault Upload Module Types
3
- *
4
- * Types for the embedded vault upload widget.
5
- */
6
- /**
7
- * Branding configuration from vault upload info.
8
- */
9
- export interface UploadBranding {
10
- /** Organization name */
11
- organizationName: string;
12
- /** Light theme logo URL */
13
- logoLightUrl: string | null;
14
- /** Dark theme logo URL */
15
- logoDarkUrl: string | null;
16
- }
17
- /**
18
- * Encryption information for the vault.
19
- */
20
- export interface EncryptionInfo {
21
- /** Encryption algorithm (e.g., 'AES-256-GCM') */
22
- algorithm: string;
23
- /** Key derivation method (e.g., 'Triple Zero-Trust') */
24
- keyDerivation: string;
25
- /** Post-quantum protection status */
26
- postQuantum: string;
27
- }
28
- /**
29
- * Vault upload configuration from API.
30
- */
31
- export interface VaultUploadConfig {
32
- /** Vault ID */
33
- vaultId: string;
34
- /** Vault name */
35
- vaultName: string;
36
- /** Maximum upload size in bytes */
37
- maxSizeBytes: number;
38
- /** Branding information */
39
- branding: UploadBranding;
40
- /** Encryption details */
41
- encryption: EncryptionInfo;
42
- /** Forge status */
43
- forgeStatus: 'active' | 'inactive';
44
- }
45
- /**
46
- * Options for upload().
47
- * - Without `target`: Opens a dialog (modal)
48
- * - With `target`: Renders inline into the specified element
49
- */
50
- export interface UploadOptions {
51
- /** Vault ID to upload to */
52
- vaultId: string;
53
- /**
54
- * Target element for inline rendering. Can be:
55
- * - A CSS selector string (e.g., "#upload-container")
56
- * - An HTMLElement reference
57
- * - Omitted for dialog mode (default)
58
- */
59
- target?: string | HTMLElement;
60
- /** Override backdrop blur for this dialog (uses global config if omitted) */
61
- backdropBlur?: boolean;
62
- /** Hide the "Upload another file" button once a file is sent (for single-file flows) */
63
- hideUploadAnother?: boolean;
64
- /**
65
- * Skip the success screen entirely. On completion the SDK fires onSuccess
66
- * and closes the dialog, so a host site can render its own post-upload UI.
67
- */
68
- hideSuccessScreen?: boolean;
69
- /**
70
- * Upload this File directly, skipping the SDK's drop-zone. The host owns
71
- * file selection (its own button, picker, or drop target) and hands the
72
- * File to the SDK, which shows only the secure-upload progress dialog.
73
- */
74
- file?: File;
75
- /**
76
- * Vault Access Token, sent only on the upload's POST, where it supplies the
77
- * vault key in place of the System DVAK the widget setting provisions; a
78
- * read-only VAT is refused 403. It does not lift the vault's Embedded Upload
79
- * Widget setting: the widget opens by reading the vault's upload info, a
80
- * request that carries no VAT and is refused (UPLOAD_SOURCE_DISABLED) while
81
- * the setting is off.
82
- */
83
- token?: string;
84
- /**
85
- * Slash-delimited folder path within the vault (e.g. "Accounts/001xx").
86
- * Missing path segments are find-or-created. Omitted means the vault root.
87
- */
88
- folder?: string;
89
- /** Callback when upload completes successfully */
90
- onSuccess?: (result: UploadResult) => void;
91
- /** Callback when an error occurs */
92
- onError?: (error: Error) => void;
93
- /** Callback when user cancels */
94
- onCancel?: () => void;
95
- /** Callback for upload progress */
96
- onProgress?: (progress: UploadProgress) => void;
97
- /**
98
- * Called once the widget has read the vault's upload page and shows its
99
- * form (or, given a `file`, starts uploading it). A failure after it is the
100
- * widget's to show, with the way on its failure leaves (the same file
101
- * again, or another); one before it means the upload page could not load.
102
- */
103
- onReady?: () => void;
104
- }
105
- /** Options for attach() - binds upload to element clicks */
106
- export interface UploadAttachOptions {
107
- /** Vault ID to upload to */
108
- vaultId: string;
109
- /** Callback when upload completes successfully */
110
- onSuccess?: (result: UploadResult) => void;
111
- /** Callback when an error occurs */
112
- onError?: (error: Error) => void;
113
- /** Callback when user cancels */
114
- onCancel?: () => void;
115
- /** Callback for upload progress */
116
- onProgress?: (progress: UploadProgress) => void;
117
- }
118
- /**
119
- * Upload progress information.
120
- */
121
- export interface UploadProgress {
122
- /** Bytes uploaded */
123
- bytesUploaded: number;
124
- /** Total bytes */
125
- bytesTotal: number;
126
- /** Percentage (0-100) */
127
- percentage: number;
128
- /**
129
- * Current phase: 'uploading' while the bytes move and while SparkVault
130
- * secures the file (percentage 100 once every byte is sent, before the save
131
- * is confirmed; an upload can still fail then). 'ceremony' once SparkVault
132
- * has confirmed the save, reported once, then 'complete' as the upload
133
- * ends. No phase runs on a timer.
134
- */
135
- phase: 'uploading' | 'ceremony' | 'complete';
136
- }
137
- /**
138
- * Successful upload result.
139
- */
140
- export interface UploadResult {
141
- /** Ingot ID */
142
- ingotId: string;
143
- /** Vault ID */
144
- vaultId: string;
145
- /** Original filename */
146
- filename: string;
147
- /** File size in bytes */
148
- sizeBytes: number;
149
- /** Upload time in UTC, as "YYYY-MM-DD HH:MM:SS UTC" */
150
- uploadTime: string;
151
- }
152
- /**
153
- * Upload view states.
154
- */
155
- export type UploadViewState = {
156
- view: 'loading';
157
- } | {
158
- view: 'form';
159
- config: VaultUploadConfig;
160
- error?: string;
161
- }
162
- /** `securing`: every byte is sent, and SparkVault is saving the file. */
163
- | {
164
- view: 'uploading';
165
- file: File;
166
- ingotId: string;
167
- requestId: string | null;
168
- progress: number;
169
- bytesUploaded: number;
170
- securing: boolean;
171
- } | {
172
- view: 'complete';
173
- result: UploadResult;
174
- config: VaultUploadConfig;
175
- }
176
- /** A file received whole that SparkVault is still saving (RECEIVED_STILL_SAVING). */
177
- | {
178
- view: 'received';
179
- message: string;
180
- action: UploadRecovery | null;
181
- } | {
182
- view: 'error';
183
- title: string;
184
- message: string;
185
- action?: UploadRecovery | null;
186
- };
187
- /**
188
- * The way on an error view offers after an upload of the chosen file failed:
189
- * its button's label, and whether the form keeps the chosen file for it.
190
- */
191
- export interface UploadRecovery {
192
- label: string;
193
- keepFile: boolean;
194
- }
195
- /**
196
- * API response for vault upload info.
197
- */
198
- export interface VaultUploadInfoResponse {
199
- vault_id: string;
200
- vault_name: string;
201
- max_size_bytes: number;
202
- branding: {
203
- organization_name: string;
204
- logo_light_url: string | null;
205
- logo_dark_url: string | null;
206
- };
207
- encryption: {
208
- algorithm: string;
209
- key_derivation: string;
210
- post_quantum: string;
211
- };
212
- forge_status: 'active' | 'inactive';
213
- }
214
- /**
215
- * API response for initiating upload.
216
- */
217
- export interface InitiateUploadResponse {
218
- forge_url: string;
219
- ingot_id: string;
220
- }