@sparkvault/sdk-js 4.1.0 → 5.0.1

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.
@@ -5829,6 +5829,25 @@ class IdentityRenderer {
5829
5829
  this.setState(this.viewStateForConfigError(error));
5830
5830
  }
5831
5831
  }
5832
+ /**
5833
+ * Surface a terminal startup failure *inside* the dialog instead of letting
5834
+ * it reject to the host.
5835
+ *
5836
+ * `start()` already routes config-fetch failures to an in-dialog view via its
5837
+ * own catch, but an unexpected throw (or a throw while rendering that view)
5838
+ * would otherwise escape. In the default embedded/dialog mode that escape is
5839
+ * exactly the "closes silently" failure: the host's `onError` runs, the
5840
+ * embedding page tears the iframe down, and the user is left with no message.
5841
+ * Render the error in the SparkVault dialog — consistent with how every
5842
+ * in-flow error already behaves — so the dialog stays open and the user can
5843
+ * retry or close it (→ onCancel).
5844
+ */
5845
+ showStartupError(error) {
5846
+ if (!this.container.isOpen()) {
5847
+ this.container.createLoading({ backdropBlur: this.options.backdropBlur }, () => this.handleClose());
5848
+ }
5849
+ this.setState(this.viewStateForConfigError(error));
5850
+ }
5832
5851
  /**
5833
5852
  * Map a config-fetch error to the appropriate terminal view.
5834
5853
  *
@@ -7782,8 +7801,13 @@ class IdentityModule {
7782
7801
  const startLocalRender = (container) => {
7783
7802
  this.renderer = new IdentityRenderer(container, this.api, mergedOptions, hostCallbacks);
7784
7803
  this.renderer.start().catch((error) => {
7785
- options.onError?.(error);
7786
- rejectRef(error);
7804
+ // A startup failure must surface inside the SparkVault dialog, never
7805
+ // close it silently. Rejecting here would, in the default embedded
7806
+ // mode, run the host's onError and let the embedding page remove the
7807
+ // iframe — leaving the user with a vanished dialog and no error. Render
7808
+ // the error in-dialog instead (consistent with every in-flow error);
7809
+ // the promise settles later via the user's retry/close.
7810
+ this.renderer?.showStartupError(error);
7787
7811
  });
7788
7812
  };
7789
7813
  if (!useLocal) {