@sparkvault/sdk 1.23.6 → 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.
@@ -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
 
@@ -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">${statusCode} - ${statusText}</h2>
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
- // Handle specific HTTP status codes
9283
- if (error.httpStatus === 404) {
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
- message: 'The requested upload endpoint could not be located. This may occur if the upload link has expired, been disabled, or was entered incorrectly.',
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
  });