@sparkvault/sdk 1.23.5 → 1.23.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/identity/api.d.ts +2 -2
- package/dist/sparkvault.cjs.js +25 -9
- package/dist/sparkvault.cjs.js.map +1 -1
- package/dist/sparkvault.esm.js +25 -9
- package/dist/sparkvault.esm.js.map +1 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/dist/vaults/upload/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/sparkvault.esm.js
CHANGED
|
@@ -782,7 +782,7 @@ class IdentityApi {
|
|
|
782
782
|
*
|
|
783
783
|
* Returns:
|
|
784
784
|
* - email_valid: whether the email domain has valid MX records
|
|
785
|
-
* -
|
|
785
|
+
* - has_passkey: whether any passkeys are registered (only meaningful if email_valid)
|
|
786
786
|
*/
|
|
787
787
|
async checkPasskey(email) {
|
|
788
788
|
return this.request('POST', '/passkey/check', { email });
|
|
@@ -932,6 +932,7 @@ class IdentityApiError extends Error {
|
|
|
932
932
|
this.name = 'IdentityApiError';
|
|
933
933
|
this.code = code;
|
|
934
934
|
this.statusCode = statusCode;
|
|
935
|
+
Object.setPrototypeOf(this, IdentityApiError.prototype);
|
|
935
936
|
}
|
|
936
937
|
}
|
|
937
938
|
|
|
@@ -1279,10 +1280,10 @@ class PasskeyHandler {
|
|
|
1279
1280
|
async checkPasskey() {
|
|
1280
1281
|
try {
|
|
1281
1282
|
const response = await this.api.checkPasskey(this.state.recipient);
|
|
1282
|
-
this.state.setPasskeyStatus(response.
|
|
1283
|
+
this.state.setPasskeyStatus(response.has_passkey);
|
|
1283
1284
|
return {
|
|
1284
1285
|
emailValid: response.email_valid,
|
|
1285
|
-
hasPasskey: response.
|
|
1286
|
+
hasPasskey: response.has_passkey,
|
|
1286
1287
|
};
|
|
1287
1288
|
}
|
|
1288
1289
|
catch (error) {
|
|
@@ -6511,6 +6512,7 @@ class UploadApiError extends SparkVaultError {
|
|
|
6511
6512
|
super(message, code, httpStatus);
|
|
6512
6513
|
this.httpStatus = httpStatus;
|
|
6513
6514
|
this.name = 'UploadApiError';
|
|
6515
|
+
Object.setPrototypeOf(this, UploadApiError.prototype);
|
|
6514
6516
|
}
|
|
6515
6517
|
}
|
|
6516
6518
|
/**
|
|
@@ -9009,8 +9011,6 @@ class UploadRenderer {
|
|
|
9009
9011
|
renderError(state) {
|
|
9010
9012
|
const div = document.createElement('div');
|
|
9011
9013
|
div.className = 'svu-error-view';
|
|
9012
|
-
const statusCode = state.httpStatus || 404;
|
|
9013
|
-
const statusText = statusCode === 402 ? 'Service Unavailable' : 'Resource Not Found';
|
|
9014
9014
|
div.innerHTML = `
|
|
9015
9015
|
<div class="svu-error-icon">
|
|
9016
9016
|
<svg width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
@@ -9019,7 +9019,7 @@ class UploadRenderer {
|
|
|
9019
9019
|
</svg>
|
|
9020
9020
|
</div>
|
|
9021
9021
|
|
|
9022
|
-
<h2 class="svu-error-title">${
|
|
9022
|
+
<h2 class="svu-error-title">${this.escapeHtml(state.title)}</h2>
|
|
9023
9023
|
|
|
9024
9024
|
<p class="svu-error-message">${this.escapeHtml(state.message)}</p>
|
|
9025
9025
|
|
|
@@ -9279,11 +9279,23 @@ class UploadRenderer {
|
|
|
9279
9279
|
}
|
|
9280
9280
|
handleApiError(error) {
|
|
9281
9281
|
if (error instanceof UploadApiError) {
|
|
9282
|
-
|
|
9283
|
-
|
|
9282
|
+
if (error.code === 'UPLOAD_SOURCE_DISABLED') {
|
|
9283
|
+
// The vault exists but the embedded widget isn't enabled.
|
|
9284
|
+
// This is almost always a developer/admin oversight, so the message
|
|
9285
|
+
// points at the dashboard rather than the end user.
|
|
9284
9286
|
this.setState({
|
|
9285
9287
|
view: 'error',
|
|
9286
|
-
|
|
9288
|
+
title: 'Upload Widget Not Enabled',
|
|
9289
|
+
message: 'This vault has not enabled the embedded upload widget. Enable it on the vault\'s settings page in the SparkVault dashboard to start accepting uploads here.',
|
|
9290
|
+
code: 'UPLOAD_SOURCE_DISABLED',
|
|
9291
|
+
httpStatus: error.httpStatus,
|
|
9292
|
+
});
|
|
9293
|
+
}
|
|
9294
|
+
else if (error.httpStatus === 404) {
|
|
9295
|
+
this.setState({
|
|
9296
|
+
view: 'error',
|
|
9297
|
+
title: 'Upload Page Not Found',
|
|
9298
|
+
message: 'The requested upload endpoint could not be located. This may occur if the upload link has expired or was entered incorrectly.',
|
|
9287
9299
|
code: 'NOT_FOUND',
|
|
9288
9300
|
httpStatus: 404,
|
|
9289
9301
|
});
|
|
@@ -9291,6 +9303,7 @@ class UploadRenderer {
|
|
|
9291
9303
|
else if (error.httpStatus === 402) {
|
|
9292
9304
|
this.setState({
|
|
9293
9305
|
view: 'error',
|
|
9306
|
+
title: 'Service Unavailable',
|
|
9294
9307
|
message: 'This upload endpoint has been temporarily disabled due to an account billing issue. Please contact the organization\'s administrator.',
|
|
9295
9308
|
code: 'PAYMENT_REQUIRED',
|
|
9296
9309
|
httpStatus: 402,
|
|
@@ -9299,6 +9312,7 @@ class UploadRenderer {
|
|
|
9299
9312
|
else {
|
|
9300
9313
|
this.setState({
|
|
9301
9314
|
view: 'error',
|
|
9315
|
+
title: 'Upload Failed',
|
|
9302
9316
|
message: error.message,
|
|
9303
9317
|
code: error.code,
|
|
9304
9318
|
httpStatus: error.httpStatus,
|
|
@@ -9309,6 +9323,7 @@ class UploadRenderer {
|
|
|
9309
9323
|
else if (error instanceof Error) {
|
|
9310
9324
|
this.setState({
|
|
9311
9325
|
view: 'error',
|
|
9326
|
+
title: 'Upload Failed',
|
|
9312
9327
|
message: error.message,
|
|
9313
9328
|
code: 'UNKNOWN_ERROR',
|
|
9314
9329
|
});
|
|
@@ -9318,6 +9333,7 @@ class UploadRenderer {
|
|
|
9318
9333
|
const err = new Error('An unexpected error occurred');
|
|
9319
9334
|
this.setState({
|
|
9320
9335
|
view: 'error',
|
|
9336
|
+
title: 'Upload Failed',
|
|
9321
9337
|
message: err.message,
|
|
9322
9338
|
code: 'UNKNOWN_ERROR',
|
|
9323
9339
|
});
|