smartcomply-web-sdk 1.0.99 β†’ 1.0.101

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.
Files changed (55) hide show
  1. package/dist/client/Smartcomply.d.ts +1 -1
  2. package/dist/client/Smartcomply.d.ts.map +1 -1
  3. package/dist/client/Smartcomply.js +1 -1
  4. package/dist/client/Smartcomply.js.map +1 -1
  5. package/dist/esm/client/Smartcomply.d.ts +1 -1
  6. package/dist/esm/client/Smartcomply.d.ts.map +1 -1
  7. package/dist/esm/client/Smartcomply.js +1 -1
  8. package/dist/esm/client/Smartcomply.js.map +1 -1
  9. package/dist/esm/flow/DocumentCapture.d.ts +3 -19
  10. package/dist/esm/flow/DocumentCapture.d.ts.map +1 -1
  11. package/dist/esm/flow/DocumentCapture.js +22 -170
  12. package/dist/esm/flow/DocumentCapture.js.map +1 -1
  13. package/dist/esm/flow/SmartComplyFlow.d.ts +0 -1
  14. package/dist/esm/flow/SmartComplyFlow.d.ts.map +1 -1
  15. package/dist/esm/flow/SmartComplyFlow.js +67 -94
  16. package/dist/esm/flow/SmartComplyFlow.js.map +1 -1
  17. package/dist/esm/types/onboarding.d.ts +2 -0
  18. package/dist/esm/types/onboarding.d.ts.map +1 -1
  19. package/dist/esm/utils/channels.d.ts +15 -0
  20. package/dist/esm/utils/channels.d.ts.map +1 -1
  21. package/dist/esm/utils/channels.js +41 -0
  22. package/dist/esm/utils/channels.js.map +1 -1
  23. package/dist/esm/utils/constants.d.ts +9 -8
  24. package/dist/esm/utils/constants.d.ts.map +1 -1
  25. package/dist/esm/utils/constants.js +10 -9
  26. package/dist/esm/utils/constants.js.map +1 -1
  27. package/dist/esm/utils/documentRules.d.ts +1 -2
  28. package/dist/esm/utils/documentRules.d.ts.map +1 -1
  29. package/dist/esm/utils/documentRules.js +1 -2
  30. package/dist/esm/utils/documentRules.js.map +1 -1
  31. package/dist/flow/DocumentCapture.d.ts +3 -19
  32. package/dist/flow/DocumentCapture.d.ts.map +1 -1
  33. package/dist/flow/DocumentCapture.js +22 -170
  34. package/dist/flow/DocumentCapture.js.map +1 -1
  35. package/dist/flow/SmartComplyFlow.d.ts +0 -1
  36. package/dist/flow/SmartComplyFlow.d.ts.map +1 -1
  37. package/dist/flow/SmartComplyFlow.js +65 -92
  38. package/dist/flow/SmartComplyFlow.js.map +1 -1
  39. package/dist/smartcomply.browser.js +94 -256
  40. package/dist/smartcomply.browser.js.map +3 -3
  41. package/dist/types/onboarding.d.ts +2 -0
  42. package/dist/types/onboarding.d.ts.map +1 -1
  43. package/dist/utils/channels.d.ts +15 -0
  44. package/dist/utils/channels.d.ts.map +1 -1
  45. package/dist/utils/channels.js +44 -0
  46. package/dist/utils/channels.js.map +1 -1
  47. package/dist/utils/constants.d.ts +9 -8
  48. package/dist/utils/constants.d.ts.map +1 -1
  49. package/dist/utils/constants.js +10 -9
  50. package/dist/utils/constants.js.map +1 -1
  51. package/dist/utils/documentRules.d.ts +1 -2
  52. package/dist/utils/documentRules.d.ts.map +1 -1
  53. package/dist/utils/documentRules.js +1 -2
  54. package/dist/utils/documentRules.js.map +1 -1
  55. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SmartComplyFlow.d.ts","sourceRoot":"","sources":["../../src/flow/SmartComplyFlow.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,UAAU,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAM5G,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAoB,YAAY,EAAE,MAAM,wBAAwB,CAAC;AA4CxE,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,WAAW,CAAC,EAAE,MAAM,CA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,mBAAmB;IAsB3B,OAAO,CAAC,qBAAqB;IAmB7B,sGAAsG;IACtG,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,cAAc;IAsBtB;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;IAO1B;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,cAAc;IAmFtB,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,YAAY;CAiCrB"}
@@ -9,7 +9,6 @@ const Smartcomply_1 = require("../client/Smartcomply");
9
9
  const theme_1 = require("./theme");
10
10
  const DocumentCapture_1 = require("./DocumentCapture");
11
11
  const channels_1 = require("../utils/channels");
12
- const documentFiles_1 = require("../utils/documentFiles");
13
12
  const device_1 = require("../utils/device");
14
13
  const documentRules_1 = require("../utils/documentRules");
15
14
  const constants_1 = require("../utils/constants");
@@ -60,15 +59,9 @@ const STEP_ORDER = [
60
59
  "liveness",
61
60
  "done",
62
61
  ];
63
- const COUNTRY_LABELS = {
64
- nigeria: "πŸ‡³πŸ‡¬ Nigeria",
65
- global: "🌍 Other Countries",
66
- ghana: "πŸ‡¬πŸ‡­ Ghana",
67
- kenya: "πŸ‡°πŸ‡ͺ Kenya",
68
- south_africa: "πŸ‡ΏπŸ‡¦ South Africa",
69
- united_states: "πŸ‡ΊπŸ‡Έ United States",
70
- united_kingdom: "πŸ‡¬πŸ‡§ United Kingdom",
71
- };
62
+ // From this many countries up, the country screen shows a search box: a
63
+ // setup can offer passports from every supported country (188).
64
+ const COUNTRY_SEARCH_MIN = 7;
72
65
  /**
73
66
  * Whether a SPECIFIC channel is a document-scan item, vs. a plain
74
67
  * number-entry one. channels[country] is a flat list that can mix
@@ -311,24 +304,6 @@ function _parseOcrDate(raw) {
311
304
  const d = new Date(s);
312
305
  return isNaN(d.getTime()) ? null : d;
313
306
  }
314
- // ── W12: Image compression before document upload ────────────────────────────
315
- async function _compressImage(blob, maxWidth = 1600, quality = 0.85) {
316
- try {
317
- const bmp = await createImageBitmap(blob);
318
- const scale = Math.min(1, maxWidth / bmp.width);
319
- const w = Math.round(bmp.width * scale);
320
- const h = Math.round(bmp.height * scale);
321
- const canvas = document.createElement("canvas");
322
- canvas.width = w;
323
- canvas.height = h;
324
- canvas.getContext("2d").drawImage(bmp, 0, 0, w, h);
325
- bmp.close();
326
- return await new Promise((res, rej) => canvas.toBlob(b => b ? res(b) : rej(new Error("Compression failed")), "image/jpeg", quality));
327
- }
328
- catch {
329
- return blob; // fallback to original on any error
330
- }
331
- }
332
307
  // ── Document type code β†’ human label ─────────────────────────────────────────
333
308
  function _formatDocType(code) {
334
309
  const map = {
@@ -1171,15 +1146,47 @@ class SmartComplyFlow {
1171
1146
  subtitle.style.cssText = `color:${this.theme.textSecondary};font-size:13px;margin-top:-8px;`;
1172
1147
  subtitle.textContent = "Choose the country that issued your ID";
1173
1148
  container.appendChild(subtitle);
1174
- for (const country of countries) {
1175
- const count = channels[country].data_verification.length
1176
- + channels[country].document_verification.length;
1177
- const card = this.createOptionCard(COUNTRY_LABELS[country] || country, `${count} ID type${count > 1 ? "s" : ""} available`, () => {
1178
- this.selectedCountry = country;
1179
- this.showStep("id_type");
1180
- });
1181
- container.appendChild(card);
1149
+ const list = document.createElement("div");
1150
+ list.setAttribute("role", "list");
1151
+ list.style.cssText = "display:flex;flex-direction:column;gap:10px;max-height:min(52vh,420px);overflow-y:auto;padding:2px;";
1152
+ const renderList = (query) => {
1153
+ list.innerHTML = "";
1154
+ const matches = (0, channels_1.filterCountries)(channels, query);
1155
+ if (matches.length === 0) {
1156
+ const empty = document.createElement("div");
1157
+ empty.setAttribute("role", "status");
1158
+ empty.style.cssText = `color:${this.theme.textSecondary};font-size:13px;line-height:1.6;padding:8px 2px;`;
1159
+ empty.textContent = `No country matches "${query.trim()}". Check the spelling or try another name.`;
1160
+ list.appendChild(empty);
1161
+ return;
1162
+ }
1163
+ for (const country of matches) {
1164
+ const count = channels[country].data_verification.length
1165
+ + channels[country].document_verification.length;
1166
+ const card = this.createOptionCard((0, channels_1.countryLabel)(channels, country), `${count} ID type${count > 1 ? "s" : ""} available`, () => {
1167
+ this.selectedCountry = country;
1168
+ this.showStep("id_type");
1169
+ });
1170
+ card.setAttribute("role", "listitem");
1171
+ list.appendChild(card);
1172
+ }
1173
+ };
1174
+ if (countries.length >= COUNTRY_SEARCH_MIN) {
1175
+ const search = document.createElement("input");
1176
+ search.type = "search";
1177
+ search.placeholder = "Search countries";
1178
+ search.setAttribute("aria-label", "Search countries");
1179
+ search.autocomplete = "off";
1180
+ search.style.cssText = `
1181
+ width:100%;box-sizing:border-box;padding:11px 14px;border-radius:${theme_1.RADIUS.md}px;
1182
+ background:${this.theme.cardBg};color:${this.theme.text};
1183
+ border:1.5px solid ${this.theme.border};font-size:14px;outline-offset:2px;
1184
+ `;
1185
+ search.addEventListener("input", () => renderList(search.value));
1186
+ container.appendChild(search);
1182
1187
  }
1188
+ renderList("");
1189
+ container.appendChild(list);
1183
1190
  }
1184
1191
  // ── ID Type Select ──────────────────────────────────────────────
1185
1192
  renderIdTypeSelect(container) {
@@ -1767,8 +1774,15 @@ class SmartComplyFlow {
1767
1774
  faceWrap.appendChild(faceImg);
1768
1775
  container.appendChild(faceWrap);
1769
1776
  }
1770
- // Expiry soon warning
1771
- if (this._ocrExpirySoon && !this._ocrIsExpired) {
1777
+ // Expired or expiring-soon notice
1778
+ if (this._ocrIsExpired) {
1779
+ const expired = document.createElement("div");
1780
+ expired.setAttribute("role", "alert");
1781
+ expired.style.cssText = `width:100%;padding:10px 14px;border-radius:10px;background:${this.theme.errorBg};border:1px solid ${this.theme.error}40;color:${this.theme.error};font-size:12px;text-align:left;line-height:1.5;`;
1782
+ expired.textContent = "⚠️ This document has expired. You can continue, but a check with an expired document won't be approved. Use a valid document if you have one.";
1783
+ container.appendChild(expired);
1784
+ }
1785
+ else if (this._ocrExpirySoon) {
1772
1786
  const warn = document.createElement("div");
1773
1787
  warn.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;`;
1774
1788
  warn.textContent = "⚠️ Your document expires soon. Some services may not accept it, but you can still continue.";
@@ -1871,12 +1885,10 @@ class SmartComplyFlow {
1871
1885
  polls++;
1872
1886
  try {
1873
1887
  const result = await this.sdk.liveness.pollResult(entryId);
1874
- // W7: Expired document β€” stop, do not proceed to liveness
1875
- if (result.is_expired === true) {
1876
- container.innerHTML = "";
1877
- this._renderExpiredDocument(container);
1878
- return;
1879
- }
1888
+ // An expired document does not stop the flow: liveness and the face
1889
+ // match still run so the client gets the full result, and the backend
1890
+ // fails the check at the end with "Document has expired." The confirm
1891
+ // screen tells the user (see _ocrIsExpired).
1880
1892
  // W8: OCR quality fail β€” offer retake
1881
1893
  if (result.ocr_quality_failed === true) {
1882
1894
  container.innerHTML = "";
@@ -1952,32 +1964,6 @@ class SmartComplyFlow {
1952
1964
  // First poll after 3s β€” give OCR submission time to start
1953
1965
  this._ocrPollTimer = setTimeout(poll, 3000);
1954
1966
  }
1955
- _renderExpiredDocument(container) {
1956
- container.style.cssText += "display:flex;flex-direction:column;align-items:center;text-align:center;gap:14px;padding:20px 0;";
1957
- const icon = document.createElement("div");
1958
- icon.style.cssText = `width:72px;height:72px;border-radius:50%;background:${this.theme.errorBg};border:3px solid ${this.theme.error};display:flex;align-items:center;justify-content:center;font-size:28px;`;
1959
- icon.textContent = "πŸ“…";
1960
- container.appendChild(icon);
1961
- const t = document.createElement("h2");
1962
- t.style.cssText = `color:${this.theme.text};font-size:${theme_1.TYPE.heading}px;font-weight:700;margin:0;`;
1963
- t.textContent = "Document Expired";
1964
- container.appendChild(t);
1965
- const d = document.createElement("p");
1966
- d.style.cssText = `color:${this.theme.textSecondary};font-size:13px;margin:0;max-width:280px;line-height:1.6;`;
1967
- d.textContent = "The document you submitted has expired. Please use a valid, current ID.";
1968
- container.appendChild(d);
1969
- const retryBtn = this.createPrimaryButton("Try a different document");
1970
- retryBtn.addEventListener("click", () => {
1971
- this.livenessEntryId = null;
1972
- this.documentBlob = null;
1973
- this.documentBackBlob = null;
1974
- this.showStep("document_capture");
1975
- });
1976
- container.appendChild(retryBtn);
1977
- const endBtn = this.createSecondaryButton("End session");
1978
- endBtn.addEventListener("click", () => { this.options.onError?.(new Error("Document expired")); this.close(); });
1979
- container.appendChild(endBtn);
1980
- }
1981
1967
  _renderOcrQualityFail(container, reason) {
1982
1968
  container.style.cssText += "display:flex;flex-direction:column;align-items:center;text-align:center;gap:14px;padding:20px 0;";
1983
1969
  const icon = document.createElement("div");
@@ -2165,15 +2151,11 @@ class SmartComplyFlow {
2165
2151
  * Process document capture result with front/back support
2166
2152
  */
2167
2153
  async processDocumentCaptureResult(result, captureContainer, container) {
2168
- // B2+P2: Compress both images once here. Do NOT assign documentBlob twice
2169
- // (old code set it to the raw blob first, then overwrote with compressed).
2170
- // processDocumentBlob also ran _compressImage β€” that second pass is removed
2171
- // below so compression only happens once.
2172
- // A PDF is sent as-is: only photos are re-encoded.
2173
- this.documentBlob = (0, documentFiles_1.isPdf)(result.front) ? result.front : await _compressImage(result.front, 1600, 0.85);
2174
- this.documentBackBlob = !result.back
2175
- ? null
2176
- : (0, documentFiles_1.isPdf)(result.back) ? result.back : await _compressImage(result.back, 1600, 0.85);
2154
+ // Uploaded exactly as captured or picked, photo or PDF: re-encoding a
2155
+ // small passport photo as JPEG blurred its machine-readable lines and the
2156
+ // OCR rejected a clear Rwandan passport as "country: unknown".
2157
+ this.documentBlob = result.front;
2158
+ this.documentBackBlob = result.back || null;
2177
2159
  this._documentViaCamera = result.viaCamera;
2178
2160
  // Process the front image β€” pass the already-compressed blob
2179
2161
  await this.processDocumentBlob(this.documentBlob, captureContainer, container);
@@ -2186,12 +2168,11 @@ class SmartComplyFlow {
2186
2168
  let retryCount = 0;
2187
2169
  const attemptProcessing = async () => {
2188
2170
  try {
2189
- // Validate blob β€” compression already done in processDocumentCaptureResult (P2)
2190
2171
  if (!blob || blob.size === 0) {
2191
2172
  throw new Error("Failed to capture document. Please try again.");
2192
2173
  }
2193
- if (blob.size > 5 * 1024 * 1024) {
2194
- throw new Error("Document image is too large. Please retake in better lighting or use a clearer photo.");
2174
+ if (blob.size > constants_1.MAX_DOCUMENT_BYTES) {
2175
+ throw new Error(`Document is too large. Please use a file smaller than ${Math.round(constants_1.MAX_DOCUMENT_BYTES / (1024 * 1024))}MB.`);
2195
2176
  }
2196
2177
  this.documentBlob = blob;
2197
2178
  // Show scanning state
@@ -2210,11 +2191,7 @@ class SmartComplyFlow {
2210
2191
  || this.idNumber
2211
2192
  || this.selectedIdType
2212
2193
  || `DOC-${Date.now()}`;
2213
- const COUNTRY_CODES = {
2214
- nigeria: "NG", ghana: "GH", kenya: "KE",
2215
- south_africa: "ZA", united_states: "US", united_kingdom: "GB", global: "US",
2216
- };
2217
- const country = COUNTRY_CODES[this.selectedCountry] || this.selectedCountry.toUpperCase().slice(0, 2);
2194
+ const country = (0, channels_1.countryCodeFor)(this.sdkConfig?.channels || {}, this.selectedCountry);
2218
2195
  const deviceMeta = (0, device_1.collectDeviceMetadata)();
2219
2196
  let createResult;
2220
2197
  try {
@@ -2404,11 +2381,7 @@ class SmartComplyFlow {
2404
2381
  ? ""
2405
2382
  : (this.idNumber || Object.values(this.collectedFields)[0] || this.selectedIdType || `DOC-${Date.now()}`);
2406
2383
  const identifierType = isDataVerification ? "" : this.selectedIdType;
2407
- const COUNTRY_CODES = {
2408
- nigeria: "NG", ghana: "GH", kenya: "KE",
2409
- south_africa: "ZA", united_states: "US", united_kingdom: "GB", global: "US",
2410
- };
2411
- const country = COUNTRY_CODES[this.selectedCountry] || this.selectedCountry.toUpperCase().slice(0, 2);
2384
+ const country = (0, channels_1.countryCodeFor)(this.sdkConfig?.channels || {}, this.selectedCountry);
2412
2385
  // Start liveness check (this handles camera, detection, recording, submission)
2413
2386
  // If livenessEntryId exists (document flow), reuse it instead of creating a new one
2414
2387
  this.sdk.liveness