@sparkvault/sdk-js 5.0.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.
@@ -46,6 +46,20 @@ export declare class IdentityRenderer {
46
46
  * Otherwise shows loading state while fetching config.
47
47
  */
48
48
  start(): Promise<void>;
49
+ /**
50
+ * Surface a terminal startup failure *inside* the dialog instead of letting
51
+ * it reject to the host.
52
+ *
53
+ * `start()` already routes config-fetch failures to an in-dialog view via its
54
+ * own catch, but an unexpected throw (or a throw while rendering that view)
55
+ * would otherwise escape. In the default embedded/dialog mode that escape is
56
+ * exactly the "closes silently" failure: the host's `onError` runs, the
57
+ * embedding page tears the iframe down, and the user is left with no message.
58
+ * Render the error in the SparkVault dialog — consistent with how every
59
+ * in-flow error already behaves — so the dialog stays open and the user can
60
+ * retry or close it (→ onCancel).
61
+ */
62
+ showStartupError(error: unknown): void;
49
63
  /**
50
64
  * Map a config-fetch error to the appropriate terminal view.
51
65
  *
@@ -5833,6 +5833,25 @@ class IdentityRenderer {
5833
5833
  this.setState(this.viewStateForConfigError(error));
5834
5834
  }
5835
5835
  }
5836
+ /**
5837
+ * Surface a terminal startup failure *inside* the dialog instead of letting
5838
+ * it reject to the host.
5839
+ *
5840
+ * `start()` already routes config-fetch failures to an in-dialog view via its
5841
+ * own catch, but an unexpected throw (or a throw while rendering that view)
5842
+ * would otherwise escape. In the default embedded/dialog mode that escape is
5843
+ * exactly the "closes silently" failure: the host's `onError` runs, the
5844
+ * embedding page tears the iframe down, and the user is left with no message.
5845
+ * Render the error in the SparkVault dialog — consistent with how every
5846
+ * in-flow error already behaves — so the dialog stays open and the user can
5847
+ * retry or close it (→ onCancel).
5848
+ */
5849
+ showStartupError(error) {
5850
+ if (!this.container.isOpen()) {
5851
+ this.container.createLoading({ backdropBlur: this.options.backdropBlur }, () => this.handleClose());
5852
+ }
5853
+ this.setState(this.viewStateForConfigError(error));
5854
+ }
5836
5855
  /**
5837
5856
  * Map a config-fetch error to the appropriate terminal view.
5838
5857
  *
@@ -7786,8 +7805,13 @@ class IdentityModule {
7786
7805
  const startLocalRender = (container) => {
7787
7806
  this.renderer = new IdentityRenderer(container, this.api, mergedOptions, hostCallbacks);
7788
7807
  this.renderer.start().catch((error) => {
7789
- options.onError?.(error);
7790
- rejectRef(error);
7808
+ // A startup failure must surface inside the SparkVault dialog, never
7809
+ // close it silently. Rejecting here would, in the default embedded
7810
+ // mode, run the host's onError and let the embedding page remove the
7811
+ // iframe — leaving the user with a vanished dialog and no error. Render
7812
+ // the error in-dialog instead (consistent with every in-flow error);
7813
+ // the promise settles later via the user's retry/close.
7814
+ this.renderer?.showStartupError(error);
7791
7815
  });
7792
7816
  };
7793
7817
  if (!useLocal) {