smartcomply-web-sdk 1.0.92 → 1.0.94

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.
@@ -22,7 +22,7 @@ export declare class SmartComply {
22
22
  * CDN tag they installed with (e.g. @1, which floats to the latest
23
23
  * matching release) actually resolved to the version they expect.
24
24
  */
25
- static readonly VERSION = "1.0.92";
25
+ static readonly VERSION = "1.0.94";
26
26
  private http;
27
27
  private clientId;
28
28
  private _sessionToken;
@@ -125,5 +125,5 @@ exports.SmartComply = SmartComply;
125
125
  * CDN tag they installed with (e.g. @1, which floats to the latest
126
126
  * matching release) actually resolved to the version they expect.
127
127
  */
128
- SmartComply.VERSION = "1.0.92";
128
+ SmartComply.VERSION = "1.0.94";
129
129
  //# sourceMappingURL=Smartcomply.js.map
@@ -22,7 +22,7 @@ export declare class SmartComply {
22
22
  * CDN tag they installed with (e.g. @1, which floats to the latest
23
23
  * matching release) actually resolved to the version they expect.
24
24
  */
25
- static readonly VERSION = "1.0.92";
25
+ static readonly VERSION = "1.0.94";
26
26
  private http;
27
27
  private clientId;
28
28
  private _sessionToken;
@@ -121,5 +121,5 @@ export class SmartComply {
121
121
  * CDN tag they installed with (e.g. @1, which floats to the latest
122
122
  * matching release) actually resolved to the version they expect.
123
123
  */
124
- SmartComply.VERSION = "1.0.92";
124
+ SmartComply.VERSION = "1.0.94";
125
125
  //# sourceMappingURL=Smartcomply.js.map
@@ -1,4 +1,4 @@
1
- import { VerifyIdentityResponse } from "../types/onboarding";
1
+ import { SDKChannel, VerifyIdentityResponse } from "../types/onboarding";
2
2
  import { Environment } from "../client/Config";
3
3
  import { BackSideMode } from "../utils/documentRules";
4
4
  export interface FlowOptions {
@@ -40,6 +40,24 @@ export interface FlowResult {
40
40
  submittedAt: string | null;
41
41
  verificationResult?: VerifyIdentityResponse;
42
42
  }
43
+ /**
44
+ * Whether a SPECIFIC channel is a document-scan item, vs. a plain
45
+ * number-entry one. channels[country] is a flat list that can mix
46
+ * data_verification channels (e.g. bare "Passport", a number-entry lookup)
47
+ * with document_verification channels (e.g. "Document Verification -
48
+ * Passport", a scan) whenever an SDK config's verification_type covers
49
+ * both modes — a real, valid dual-mode setup, not a misconfiguration.
50
+ *
51
+ * Reported live: with both modes enabled, every channel rendered and
52
+ * routed as a document scan, including number-entry ones — because the
53
+ * per-channel decision fell back to the config's overall
54
+ * globalDocFlow/verification_type the moment document_verification was
55
+ * enabled ANYWHERE in the config, instead of checking whether THIS
56
+ * channel actually has an upload field. A legacy string-only channel
57
+ * (typeof idType === "string") carries no fields array to check at all,
58
+ * so that's the only case the global flow mode is still used for.
59
+ */
60
+ export declare function isChannelDocumentFlow(idType: string | SDKChannel, globalDocFlow: boolean): boolean;
43
61
  /**
44
62
  * Whether a showErrorStep() message is about an expired/invalid resume or
45
63
  * resubmit link (RESUME_TARGET_UNAVAILABLE / NOT_A_RESUME_TOKEN — see
@@ -1 +1 @@
1
- {"version":3,"file":"SmartComplyFlow.d.ts","sourceRoot":"","sources":["../../../src/flow/SmartComplyFlow.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAIxF,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,CAAC;IACrB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IAC1C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,IAA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A+E7B,OAAO,CAAC,qBAAqB;IAuI7B,OAAO,CAAC,aAAa;IA6HrB,OAAO,CAAC,sBAAsB;IAyB9B,OAAO,CAAC,qBAAqB;IA0C7B;;;;;;;;OAQG;IACH,OAAO,CAAC,iCAAiC;IA6BzC;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAwBzB,OAAO,CAAC,UAAU;IA+ClB,OAAO,CAAC,wBAAwB;IAqBhC,OAAO,CAAC,cAAc;IAUtB;;OAEG;YACW,4BAA4B;IAiB1C;;OAEG;YACW,mBAAmB;IA4HjC,OAAO,CAAC,6BAA6B;IA8DrC,OAAO,CAAC,cAAc;IA4HtB,OAAO,CAAC,aAAa;IAiHrB,OAAO,CAAC,YAAY;IAqHpB,OAAO,CAAC,YAAY;IAyBpB,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,gBAAgB;IAmDxB,OAAO,CAAC,mBAAmB;IAsB3B,OAAO,CAAC,qBAAqB;IAmB7B,sGAAsG;IACtG,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,cAAc;IAgBtB;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;IAO1B;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,cAAc;IAmFtB,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,YAAY;CAiCrB"}
@@ -67,6 +67,28 @@ const COUNTRY_LABELS = {
67
67
  function isUploadFieldType(type) {
68
68
  return type === "upload" || type === "image" || type === "file";
69
69
  }
70
+ /**
71
+ * Whether a SPECIFIC channel is a document-scan item, vs. a plain
72
+ * number-entry one. channels[country] is a flat list that can mix
73
+ * data_verification channels (e.g. bare "Passport", a number-entry lookup)
74
+ * with document_verification channels (e.g. "Document Verification -
75
+ * Passport", a scan) whenever an SDK config's verification_type covers
76
+ * both modes — a real, valid dual-mode setup, not a misconfiguration.
77
+ *
78
+ * Reported live: with both modes enabled, every channel rendered and
79
+ * routed as a document scan, including number-entry ones — because the
80
+ * per-channel decision fell back to the config's overall
81
+ * globalDocFlow/verification_type the moment document_verification was
82
+ * enabled ANYWHERE in the config, instead of checking whether THIS
83
+ * channel actually has an upload field. A legacy string-only channel
84
+ * (typeof idType === "string") carries no fields array to check at all,
85
+ * so that's the only case the global flow mode is still used for.
86
+ */
87
+ export function isChannelDocumentFlow(idType, globalDocFlow) {
88
+ if (typeof idType === "string")
89
+ return globalDocFlow;
90
+ return (idType.fields || []).some((f) => isUploadFieldType(f.type));
91
+ }
70
92
  /**
71
93
  * Whether a showErrorStep() message is about an expired/invalid resume or
72
94
  * resubmit link (RESUME_TARGET_UNAVAILABLE / NOT_A_RESUME_TOKEN — see
@@ -722,6 +744,16 @@ export class SmartComplyFlow {
722
744
  // value (renderLiveness sends it as a required field) the same way
723
745
  // the liveness-only welcome-screen path already handles this.
724
746
  this.selectedCountry = info.country || this.selectedCountry || "global";
747
+ // A resume link is typically opened in a fresh tab/session (from an
748
+ // email or SMS), which starts with identityCheckId at its default
749
+ // null — it is only ever set in-memory by the onboarding/verify
750
+ // step (see above) and was never carried over here. Without this,
751
+ // a data-verification entry that failed liveness would resubmit
752
+ // with identity_check omitted, silently dropping the link this
753
+ // entry's identifier/identifier_type depend on (isDataVerification
754
+ // in renderLiveness would read false even though this WAS a data
755
+ // verification). Restore it whenever the backend reports one.
756
+ this.identityCheckId = info.identity_check_id ?? null;
725
757
  return "liveness";
726
758
  }
727
759
  if (info.failure_stage === "document" && info.country && info.identifier_type) {
@@ -1127,9 +1159,9 @@ export class SmartComplyFlow {
1127
1159
  const typeName = typeof idType === "string" ? idType : idType.name;
1128
1160
  // Use code (canonical) for API calls, fallback to name for backward compatibility
1129
1161
  const typeCode = typeof idType === "string" ? idType : (idType.code || idType.name);
1130
- // Detect per-channel: does THIS specific channel have upload fields?
1131
- const channelFields = typeof idType !== "string" ? (idType.fields || []) : [];
1132
- const isThisDocFlow = channelFields.some((f) => isUploadFieldType(f.type)) || globalDocFlow;
1162
+ // Detect per-channel, not from the config's overall mode — see
1163
+ // isChannelDocumentFlow's docstring for why.
1164
+ const isThisDocFlow = isChannelDocumentFlow(idType, globalDocFlow);
1133
1165
  const info = resolveIdTypeInfo(typeName, isThisDocFlow);
1134
1166
  // Prefer the backend-provided back-side flag; fall back to local heuristics only when absent.
1135
1167
  const requiresBackFromBackend = typeof idType !== "string" ? idType.requires_back_side : undefined;
@@ -1167,12 +1199,9 @@ export class SmartComplyFlow {
1167
1199
  this.selectedChannelId = idType.id;
1168
1200
  this.selectedChannelFields = idType.fields || []; // guard null/undefined from backend
1169
1201
  }
1170
- // Route: use explicit verification_type when set (more reliable than inspecting all channels)
1171
- // Fallback to per-channel upload field check for mixed / unconfigured setups
1172
- const hasUpload = (this.selectedChannelFields).some((f) => isUploadFieldType(f.type));
1173
- const vType = this.sdkConfig?.verification_type;
1174
- const vTypes = vType ? (Array.isArray(vType) ? vType : [vType]) : [];
1175
- const isDocChannel = hasUpload || (vTypes.length > 0 && vTypes.includes("document_verification"));
1202
+ // Route on THIS channel, same as isThisDocFlow above — see
1203
+ // isChannelDocumentFlow's docstring.
1204
+ const isDocChannel = isChannelDocumentFlow(idType, globalDocFlow);
1176
1205
  this.showStep(isDocChannel ? "document_capture" : "id_input");
1177
1206
  });
1178
1207
  container.appendChild(card);