smartcomply-web-sdk 1.0.78 → 1.0.80

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.
@@ -5103,6 +5103,15 @@ var SmartComplySDK = (() => {
5103
5103
  if (!isDebugEnabled()) return;
5104
5104
  console.info(`${PREFIX} ℹ ${message}`, ...args);
5105
5105
  },
5106
+ /**
5107
+ * Emit a low-noise informational message that's always visible, debug
5108
+ * mode or not — for the rare case (e.g. the SDK version on init) where
5109
+ * knowing this without having to flip on debug logging first matters
5110
+ * more than staying silent by default.
5111
+ */
5112
+ always(message, ...args) {
5113
+ console.info(`${PREFIX} ${message}`, ...args);
5114
+ },
5106
5115
  /** Emit a warning (always visible). */
5107
5116
  warn(message, ...args) {
5108
5117
  console.warn(`${PREFIX} ⚠ ${message}`, ...args);
@@ -5695,7 +5704,7 @@ var SmartComplySDK = (() => {
5695
5704
  };
5696
5705
 
5697
5706
  // src/client/Smartcomply.ts
5698
- var SmartComply = class {
5707
+ var _SmartComply = class _SmartComply {
5699
5708
  constructor(config) {
5700
5709
  this._sessionToken = null;
5701
5710
  this._sessionExpiresAt = null;
@@ -5710,6 +5719,7 @@ var SmartComplySDK = (() => {
5710
5719
  this.http = new HttpClient(config);
5711
5720
  this.onboarding = new OnboardingModule(this.http);
5712
5721
  this.liveness = new LivenessModule(this.http);
5722
+ SDKLogger.always(`v${_SmartComply.VERSION}`);
5713
5723
  }
5714
5724
  /** Current session token (null if not created yet) */
5715
5725
  get sessionToken() {
@@ -5761,6 +5771,17 @@ var SmartComplySDK = (() => {
5761
5771
  return config;
5762
5772
  }
5763
5773
  };
5774
+ /**
5775
+ * Package version, hardcoded to match package.json — bump this alongside
5776
+ * every version bump there (same manual-sync convention already used for
5777
+ * MEDIAPIPE_VERSION in camera/FaceDetector.ts). Exists so a client's
5778
+ * running version can be confirmed directly (SmartComply.VERSION, or the
5779
+ * console log on construction below) instead of trusting that whatever
5780
+ * CDN tag they installed with (e.g. @1, which floats to the latest
5781
+ * matching release) actually resolved to the version they expect.
5782
+ */
5783
+ _SmartComply.VERSION = "1.0.80";
5784
+ var SmartComply = _SmartComply;
5764
5785
 
5765
5786
  // src/flow/theme.ts
5766
5787
  var RADIUS = {
@@ -7218,6 +7239,7 @@ var SmartComplySDK = (() => {
7218
7239
  this.stepLabel = null;
7219
7240
  this.stageDots = null;
7220
7241
  this.brandLabel = null;
7242
+ this.brandLogoImg = null;
7221
7243
  // State
7222
7244
  this.sdkConfig = null;
7223
7245
  this.currentStep = "loading";
@@ -7247,6 +7269,11 @@ var SmartComplySDK = (() => {
7247
7269
  this._keydownHandler = null;
7248
7270
  this._visibilityHandler = null;
7249
7271
  this._hiddenAtMs = null;
7272
+ // Set just before a re-background restart re-renders the liveness step
7273
+ // (see the visibilitychange handler below), read once by renderLiveness
7274
+ // to show a "your scan was interrupted" notice instead of silently
7275
+ // swapping back into a fresh scan with no explanation.
7276
+ this._restartedAfterBackground = false;
7250
7277
  this._popstateHandler = null;
7251
7278
  this._historyGuardActive = false;
7252
7279
  // Retry safety — max 3 confirmation rejections or liveness failures per session
@@ -7461,6 +7488,7 @@ var SmartComplySDK = (() => {
7461
7488
  if (hiddenAt === null) return;
7462
7489
  const awayMs = Date.now() - hiddenAt;
7463
7490
  if (awayMs >= REBACKGROUND_RESTART_MS && this.currentStep === "liveness") {
7491
+ this._restartedAfterBackground = true;
7464
7492
  this.showStep("liveness");
7465
7493
  }
7466
7494
  };
@@ -7512,6 +7540,10 @@ var SmartComplySDK = (() => {
7512
7540
  if (this.brandLabel && this.sdkConfig.brand_name) {
7513
7541
  this.brandLabel.textContent = this.sdkConfig.brand_name;
7514
7542
  }
7543
+ if (this.brandLogoImg && this.sdkConfig.logo_url) {
7544
+ this.brandLogoImg.src = this.sdkConfig.logo_url;
7545
+ this.brandLogoImg.style.display = "block";
7546
+ }
7515
7547
  if (this.isDestroyed) return;
7516
7548
  this.showStep("welcome");
7517
7549
  } catch (err) {
@@ -7656,8 +7688,21 @@ var SmartComplySDK = (() => {
7656
7688
  color:${this.theme.primary};
7657
7689
  background:linear-gradient(135deg,${this.theme.primary}22,${this.theme.primaryGlow});
7658
7690
  border:1.5px solid ${this.theme.primary}33;
7691
+ overflow:hidden;
7659
7692
  `;
7660
- iconWrap.innerHTML = icon(isDocFlow ? "id-card" : "shield", 24);
7693
+ const logoUrl = this.sdkConfig?.logo_url;
7694
+ if (logoUrl) {
7695
+ const logoImg = document.createElement("img");
7696
+ logoImg.src = logoUrl;
7697
+ logoImg.alt = "";
7698
+ logoImg.style.cssText = "width:100%;height:100%;object-fit:contain;padding:6px;";
7699
+ logoImg.addEventListener("error", () => {
7700
+ iconWrap.innerHTML = icon(isDocFlow ? "id-card" : "shield", 24);
7701
+ });
7702
+ iconWrap.appendChild(logoImg);
7703
+ } else {
7704
+ iconWrap.innerHTML = icon(isDocFlow ? "id-card" : "shield", 24);
7705
+ }
7661
7706
  topRow.appendChild(iconWrap);
7662
7707
  const badge = document.createElement("div");
7663
7708
  badge.style.cssText = `
@@ -8694,11 +8739,20 @@ var SmartComplySDK = (() => {
8694
8739
  // ── Liveness ────────────────────────────────────────────────────
8695
8740
  renderLiveness(container) {
8696
8741
  container.style.cssText += "display:flex;flex-direction:column;gap:14px;";
8742
+ const restartedAfterBackground = this._restartedAfterBackground;
8743
+ this._restartedAfterBackground = false;
8697
8744
  if (this._livenessFailures >= _SmartComplyFlow.MAX_RETRIES) {
8698
8745
  this._renderRetryLimitReached(container);
8699
8746
  return;
8700
8747
  }
8701
8748
  const attemptId = ++this._livenessAttemptId;
8749
+ if (restartedAfterBackground) {
8750
+ const notice = document.createElement("div");
8751
+ notice.setAttribute("role", "status");
8752
+ notice.style.cssText = `width:100%;padding:10px 14px;border-radius:10px;background:${this.theme.warning}18;border:1px solid ${this.theme.warning}40;color:${this.theme.warning};font-size:12px;text-align:left;line-height:1.5;`;
8753
+ notice.textContent = "Your scan was interrupted when you left the page. Starting over — please stay on this screen until it's done.";
8754
+ container.appendChild(notice);
8755
+ }
8702
8756
  const title = this.createStepTitle("Face verification");
8703
8757
  container.appendChild(title);
8704
8758
  const desc = document.createElement("div");
@@ -8848,6 +8902,16 @@ var SmartComplySDK = (() => {
8848
8902
  }
8849
8903
  });
8850
8904
  leftArea.appendChild(this.headerBackBtn);
8905
+ this.brandLogoImg = document.createElement("img");
8906
+ this.brandLogoImg.alt = "";
8907
+ this.brandLogoImg.style.cssText = `
8908
+ height:28px;max-width:120px;object-fit:contain;flex-shrink:0;
8909
+ display:none;
8910
+ `;
8911
+ this.brandLogoImg.addEventListener("error", () => {
8912
+ if (this.brandLogoImg) this.brandLogoImg.style.display = "none";
8913
+ });
8914
+ leftArea.appendChild(this.brandLogoImg);
8851
8915
  this.brandLabel = document.createElement("div");
8852
8916
  this.brandLabel.setAttribute("aria-label", "Verification provider");
8853
8917
  this.brandLabel.style.cssText = `