@sparkvault/sdk-js 8.8.4 → 8.9.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.
@@ -6250,6 +6250,12 @@ const SPARKLINK_CSP_BLOCKED_ERROR = {
6250
6250
  };
6251
6251
  class IdentityRenderer {
6252
6252
  constructor(container, api, options, callbacks) {
6253
+ // True only when the identifier was prefilled by the flow (invite / simple
6254
+ // redirect), not typed by the person. Gates the "identity is fixed" behavior
6255
+ // so a no-hint simple-mode session where the person types their own
6256
+ // identifier still gets a change-identity back link and single-method
6257
+ // auto-proceed.
6258
+ this.identityPrefilled = false;
6253
6259
  // View management
6254
6260
  this.currentView = null;
6255
6261
  this.focusTimeoutId = null;
@@ -6307,6 +6313,8 @@ class IdentityRenderer {
6307
6313
  else {
6308
6314
  this.verificationState.setIdentity(validateEmail(raw) ?? raw, 'email');
6309
6315
  }
6316
+ // The flow supplied the identifier — it is fixed, not user-changeable.
6317
+ this.identityPrefilled = true;
6310
6318
  }
6311
6319
  /**
6312
6320
  * True when the identifier is fixed by the flow and the person must prove
@@ -6316,7 +6324,8 @@ class IdentityRenderer {
6316
6324
  * identifier than the one they were invited as.
6317
6325
  */
6318
6326
  isIdentityFixed() {
6319
- return this.verificationState.authContext?.simpleMode !== undefined;
6327
+ return this.identityPrefilled
6328
+ && this.verificationState.authContext?.simpleMode !== undefined;
6320
6329
  }
6321
6330
  /**
6322
6331
  * Fire the host's onSuccess callback, swallowing any exception so a
@@ -6900,7 +6909,14 @@ class IdentityRenderer {
6900
6909
  void this.launchPasskeyVerify(true);
6901
6910
  return;
6902
6911
  }
6903
- if (methods.length === 1) {
6912
+ // A single enabled method normally auto-fires so the recipient skips a
6913
+ // redundant one-item picker. But when the identity is fixed by an invite,
6914
+ // auto-firing an OTP would silently send a code (another SMS/email) the
6915
+ // instant the recipient opens the link, with no consent and re-sent on every
6916
+ // reload. In that case render the picker as a one-tap consent gate instead;
6917
+ // the recipient taps to request the code. (Passkey auto-route above still
6918
+ // applies — a biometric prompt costs nothing and can be dismissed.)
6919
+ if (methods.length === 1 && !this.isIdentityFixed()) {
6904
6920
  this.handleMethodSelect(methods[0]);
6905
6921
  return;
6906
6922
  }
@@ -6912,6 +6928,9 @@ class IdentityRenderer {
6912
6928
  }
6913
6929
  handleIdentitySubmit(result) {
6914
6930
  this.verificationState.setIdentity(result.value, result.type);
6931
+ // The person typed this identifier, so it is theirs to change — a no-hint
6932
+ // simple-mode session must keep the back link + single-method auto-proceed.
6933
+ this.identityPrefilled = false;
6915
6934
  this.showMethodSelect();
6916
6935
  }
6917
6936
  getAllowedIdentityTypes() {