smartcomply-web-sdk 1.0.35 → 1.0.36

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.
@@ -4925,7 +4925,10 @@ var SmartComplySDK = (() => {
4925
4925
  docVideo.play().catch(() => {
4926
4926
  });
4927
4927
  const cleanup = () => {
4928
- if (docRoot.parentElement) docRoot.parentElement.removeChild(docRoot);
4928
+ try {
4929
+ docRoot.remove();
4930
+ } catch (_2) {
4931
+ }
4929
4932
  this.docCaptureRoot = null;
4930
4933
  };
4931
4934
  const captureBtn = bottomPanel.querySelector("#sc-capture-doc-btn");
@@ -4968,12 +4971,14 @@ var SmartComplySDK = (() => {
4968
4971
  }
4969
4972
  unmount() {
4970
4973
  this.stopTimer();
4971
- if (this.docCaptureRoot?.parentElement) {
4972
- this.docCaptureRoot.parentElement.removeChild(this.docCaptureRoot);
4973
- this.docCaptureRoot = null;
4974
+ try {
4975
+ this.docCaptureRoot?.remove();
4976
+ } catch (_2) {
4974
4977
  }
4975
- if (this.root?.parentElement) {
4976
- this.root.parentElement.removeChild(this.root);
4978
+ this.docCaptureRoot = null;
4979
+ try {
4980
+ this.root?.remove();
4981
+ } catch (_2) {
4977
4982
  }
4978
4983
  this.root = null;
4979
4984
  this.videoEl = null;
@@ -5655,7 +5660,7 @@ var SmartComplySDK = (() => {
5655
5660
  }
5656
5661
  requiresBackSide(documentType) {
5657
5662
  const type = documentType.toLowerCase();
5658
- return type.includes("voter") || type.includes("nin") || type.includes("driver") || type.includes("license") || type.includes("national id") || type.includes("national id card") || type.includes("ghana");
5663
+ return type.includes("voter") || type.includes("driver") || type.includes("license") || type.includes("national id") || type.includes("national id card") || type.includes("ghana");
5659
5664
  }
5660
5665
  shouldCaptureBackSide(documentType) {
5661
5666
  return this.requiresBackOverride !== void 0 ? this.requiresBackOverride : this.requiresBackSide(documentType);
@@ -6359,24 +6364,21 @@ var SmartComplySDK = (() => {
6359
6364
  };
6360
6365
  function resolveIdTypeInfo(typeName, isDocumentFlow) {
6361
6366
  const u2 = typeName.toUpperCase();
6362
- const withFace = u2.includes("WITH FACE") || u2.includes("FACE");
6363
6367
  const advanced = u2.includes("ADVANCED");
6368
+ const cleanName = typeName.replace(/\s*with\s+face\s*/gi, " ").replace(/\s*\(NIN\)\s*/gi, " ").replace(/\s*\(BVN\)\s*/gi, " ").replace(/\s{2,}/g, " ").trim();
6364
6369
  const requiresBackSide = (type) => {
6365
6370
  const t2 = type.toLowerCase();
6366
- return t2.includes("voter") || t2.includes("nin") || t2.includes("driver") || t2.includes("license") || t2.includes("national id") || t2.includes("national id card");
6371
+ return t2.includes("voter") || t2.includes("driver") || t2.includes("license") || t2.includes("national id") || t2.includes("national id card");
6367
6372
  };
6368
6373
  if (u2.includes("BVN") || u2.includes("BANK VERIFICATION")) {
6369
- const extra = withFace ? " + selfie photo" : "";
6370
- return { icon: "\u{1F3E6}", desc: `Enter your 11-digit BVN${extra}`, requiresBack: false };
6374
+ return { icon: "\u{1F3E6}", desc: "Enter your 11-digit Bank Verification Number (BVN)", requiresBack: false };
6371
6375
  }
6372
6376
  if (u2.includes("NIN") || u2.includes("NATIONAL IDENTITY NUMBER")) {
6373
- const extra = withFace ? " + selfie photo" : "";
6374
- return { icon: "\u{1F194}", desc: `Enter your 11-digit NIN${extra}`, requiresBack: false };
6377
+ return { icon: "\u{1F194}", desc: "Enter your 11-digit National Identification Number (NIN)", requiresBack: false };
6375
6378
  }
6376
6379
  if (u2.includes("GHANA")) {
6377
6380
  if (isDocumentFlow) return { icon: "\u{1FAAA}", desc: "Capture or upload your Ghana Card", requiresBack: true };
6378
- const extra = withFace ? " + selfie photo" : "";
6379
- return { icon: "\u{1FAAA}", desc: `Enter your Ghana Card number${extra}`, requiresBack: false };
6381
+ return { icon: "\u{1FAAA}", desc: "Enter your Ghana Card number", requiresBack: false };
6380
6382
  }
6381
6383
  if (u2.includes("SSNIT"))
6382
6384
  return { icon: "\u{1F3DB}\uFE0F", desc: "Enter your SSNIT number", requiresBack: false };
@@ -6512,8 +6514,9 @@ var SmartComplySDK = (() => {
6512
6514
  if (this.overlay) {
6513
6515
  this.overlay.style.opacity = "0";
6514
6516
  setTimeout(() => {
6515
- if (this.overlay?.parentElement) {
6516
- this.overlay.parentElement.removeChild(this.overlay);
6517
+ try {
6518
+ this.overlay?.remove();
6519
+ } catch (_2) {
6517
6520
  }
6518
6521
  this.overlay = null;
6519
6522
  this.modal = null;
@@ -6849,8 +6852,9 @@ var SmartComplySDK = (() => {
6849
6852
  if (requiresBack && isThisDocFlow) {
6850
6853
  subtitle2 += " \u26A0\uFE0F Both sides required";
6851
6854
  }
6855
+ const displayName = typeName.replace(/\s*with\s+face\s*/gi, " ").replace(/\s*\(NIN\)\s*/gi, " ").replace(/\s*\(BVN\)\s*/gi, " ").replace(/\s{2,}/g, " ").trim();
6852
6856
  const card = this.createOptionCard(
6853
- `${info.icon} ${typeName}`,
6857
+ `${info.icon} ${displayName}`,
6854
6858
  subtitle2,
6855
6859
  () => {
6856
6860
  const idTypeChanged = this.selectedIdType !== typeCode;
@@ -6884,7 +6888,8 @@ var SmartComplySDK = (() => {
6884
6888
  container.style.cssText += "display:flex;flex-direction:column;gap:16px;";
6885
6889
  const dataFields = this.selectedChannelFields.filter((f2) => f2.type !== "upload");
6886
6890
  const info = resolveIdTypeInfo(this.selectedIdTypeName || this.selectedIdType, false);
6887
- const title = this.createStepTitle(`${info.icon} ${this.selectedIdTypeName || this.selectedIdType}`);
6891
+ const cleanStepTitle = (this.selectedIdTypeName || this.selectedIdType).replace(/\s*with\s+face\s*/gi, " ").replace(/\s*\(NIN\)\s*/gi, " ").replace(/\s*\(BVN\)\s*/gi, " ").replace(/\s{2,}/g, " ").trim();
6892
+ const title = this.createStepTitle(`${info.icon} ${cleanStepTitle}`);
6888
6893
  container.appendChild(title);
6889
6894
  const subtitle = document.createElement("div");
6890
6895
  subtitle.style.cssText = `color:${this.theme.textSecondary};font-size:13px;margin-top:-8px;`;
@@ -7103,69 +7108,65 @@ var SmartComplySDK = (() => {
7103
7108
  }
7104
7109
  // ── Processing ────────────────────────────────────────────────────
7105
7110
  renderProcessing(container) {
7106
- container.style.cssText += "display:flex;flex-direction:column;align-items:center;gap:20px;padding:20px 16px;min-height:400px;";
7111
+ container.style.cssText += "display:flex;flex-direction:column;align-items:center;gap:14px;padding:16px;";
7107
7112
  const animationWrap = document.createElement("div");
7108
- animationWrap.style.cssText = "position:relative;width:80px;height:80px;";
7113
+ animationWrap.style.cssText = "position:relative;width:52px;height:52px;flex-shrink:0;";
7109
7114
  const spinner = document.createElement("div");
7110
7115
  spinner.style.cssText = `
7111
7116
  position:absolute;inset:0;border-radius:50%;
7112
- border:4px solid ${this.theme.border};
7117
+ border:3px solid ${this.theme.border};
7113
7118
  border-top-color:${this.theme.primary};
7114
- animation:sc-spin 1s linear infinite;
7119
+ animation:sc-spin 0.9s linear infinite;
7115
7120
  `;
7116
7121
  animationWrap.appendChild(spinner);
7117
7122
  const centerIcon = document.createElement("div");
7118
7123
  centerIcon.style.cssText = `
7119
7124
  position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
7120
- font-size:28px;
7125
+ font-size:20px;
7121
7126
  `;
7122
7127
  centerIcon.textContent = "\u{1F50D}";
7123
7128
  animationWrap.appendChild(centerIcon);
7124
7129
  container.appendChild(animationWrap);
7125
7130
  const title = document.createElement("div");
7126
- title.style.cssText = `color:${this.theme.text};font-size:18px;font-weight:600;text-align:center;`;
7127
- title.textContent = "Processing Your Documents";
7131
+ title.style.cssText = `color:${this.theme.text};font-size:15px;font-weight:700;text-align:center;`;
7132
+ title.textContent = "Processing your document";
7128
7133
  container.appendChild(title);
7129
7134
  const subtitle = document.createElement("div");
7130
- subtitle.style.cssText = `color:${this.theme.textSecondary};font-size:13px;text-align:center;max-width:280px;line-height:1.5;`;
7131
- subtitle.textContent = "Scanning and verifying your identity documents. This may take a few moments.";
7135
+ subtitle.style.cssText = `color:${this.theme.textSecondary};font-size:12px;text-align:center;max-width:260px;line-height:1.5;`;
7136
+ subtitle.textContent = "Scanning and verifying your ID. This usually takes a few seconds.";
7132
7137
  container.appendChild(subtitle);
7133
7138
  const stepsContainer = document.createElement("div");
7134
7139
  stepsContainer.style.cssText = `
7135
- width:100%;max-width:400px;display:flex;flex-direction:column;gap:12px;
7136
- margin-top:16px;
7140
+ width:100%;display:grid;grid-template-columns:1fr 1fr;gap:8px;
7137
7141
  `;
7138
7142
  const steps = [
7139
- { id: "uploading", text: "Uploading documents", icon: "\u{1F4E4}" },
7140
- { id: "scanning", text: "Scanning for information", icon: "\u{1F50D}" },
7141
- { id: "verifying", text: "Verifying authenticity", icon: "\u2713" },
7142
- { id: "analyzing", text: "Analyzing document quality", icon: "\u{1F52C}" }
7143
+ { id: "uploading", text: "Uploading", icon: "\u{1F4E4}" },
7144
+ { id: "scanning", text: "Scanning", icon: "\u{1F50D}" },
7145
+ { id: "verifying", text: "Verifying", icon: "\u2713" },
7146
+ { id: "analyzing", text: "Checking quality", icon: "\u{1F52C}" }
7143
7147
  ];
7144
- steps.forEach((step, index) => {
7148
+ steps.forEach((step) => {
7145
7149
  const stepEl = document.createElement("div");
7146
7150
  stepEl.style.cssText = `
7147
- display:flex;align-items:center;gap:12px;padding:12px;border-radius:10px;
7151
+ display:flex;align-items:center;gap:8px;padding:9px 10px;border-radius:10px;
7148
7152
  background:${this.theme.cardBg};border:1px solid ${this.theme.border};
7149
7153
  transition:all 0.3s ease;
7150
7154
  `;
7151
7155
  stepEl.id = `processing-step-${step.id}`;
7152
7156
  const iconEl = document.createElement("div");
7153
7157
  iconEl.style.cssText = `
7154
- width:32px;height:32px;border-radius:8px;display:flex;align-items:center;justify-content:center;
7155
- font-size:14px;background:${this.theme.shimmer};border:1px solid ${this.theme.border};
7158
+ width:26px;height:26px;border-radius:7px;flex-shrink:0;
7159
+ display:flex;align-items:center;justify-content:center;
7160
+ font-size:12px;background:${this.theme.shimmer};
7156
7161
  `;
7157
7162
  iconEl.textContent = step.icon;
7158
7163
  iconEl.id = `step-icon-${step.id}`;
7159
7164
  const textEl = document.createElement("div");
7160
- textEl.style.cssText = `flex:1;color:${this.theme.textSecondary};font-size:13px;font-weight:500;`;
7165
+ textEl.style.cssText = `flex:1;color:${this.theme.textSecondary};font-size:11px;font-weight:500;`;
7161
7166
  textEl.textContent = step.text;
7162
7167
  textEl.id = `step-text-${step.id}`;
7163
7168
  const statusEl = document.createElement("div");
7164
- statusEl.style.cssText = `
7165
- width:20px;height:20px;border-radius:50%;
7166
- border:2px solid ${this.theme.border};
7167
- position:relative;
7168
- `;
7169
+ statusEl.style.cssText = `width:16px;height:16px;border-radius:50%;border:2px solid ${this.theme.border};position:relative;flex-shrink:0;`;
7169
7170
  statusEl.id = `step-status-${step.id}`;
7170
7171
  stepEl.appendChild(iconEl);
7171
7172
  stepEl.appendChild(textEl);