smartcomply-web-sdk 1.0.93 → 1.0.95

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.93";
25
+ static readonly VERSION = "1.0.95";
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.93";
128
+ SmartComply.VERSION = "1.0.95";
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.93";
25
+ static readonly VERSION = "1.0.95";
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.93";
124
+ SmartComply.VERSION = "1.0.95";
125
125
  //# sourceMappingURL=Smartcomply.js.map
@@ -1,4 +1,4 @@
1
- import { VerifyIdentityResponse } from "../types/onboarding";
1
+ import { SDKChannel, ChannelsByCategory, 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,41 @@ 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;
61
+ /**
62
+ * Picks the channel list for the "Select document type" / "Select ID type"
63
+ * screen — the one list that actually matches this screen's mode, not a
64
+ * flat list mixing both categories.
65
+ *
66
+ * Reported live: the deployed widget's document-scan screen showed a bare
67
+ * "Passport" (data_verification, number-entry) right next to "Document
68
+ * Verification - Passport" (document_verification, scan) as if they were
69
+ * the same kind of option — because channels[country] used to be one flat
70
+ * list with no category split at all. Splitting the backend response
71
+ * (SDKSecureLoaderView, adhere-backend) into {data_verification,
72
+ * document_verification} only helps if this screen then reads the ONE
73
+ * list matching globalDocFlow, instead of still flattening both — that's
74
+ * what actually removes the duplicate, not just how each entry displays
75
+ * (see isChannelDocumentFlow above, which only decides that).
76
+ */
77
+ export declare function selectIdTypesForScreen(byCategory: ChannelsByCategory | undefined, globalDocFlow: boolean): (string | SDKChannel)[];
43
78
  /**
44
79
  * Whether a showErrorStep() message is about an expired/invalid resume or
45
80
  * 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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mDxB,OAAO,CAAC,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"}
@@ -67,6 +67,49 @@ 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
+ }
92
+ /**
93
+ * Picks the channel list for the "Select document type" / "Select ID type"
94
+ * screen — the one list that actually matches this screen's mode, not a
95
+ * flat list mixing both categories.
96
+ *
97
+ * Reported live: the deployed widget's document-scan screen showed a bare
98
+ * "Passport" (data_verification, number-entry) right next to "Document
99
+ * Verification - Passport" (document_verification, scan) as if they were
100
+ * the same kind of option — because channels[country] used to be one flat
101
+ * list with no category split at all. Splitting the backend response
102
+ * (SDKSecureLoaderView, adhere-backend) into {data_verification,
103
+ * document_verification} only helps if this screen then reads the ONE
104
+ * list matching globalDocFlow, instead of still flattening both — that's
105
+ * what actually removes the duplicate, not just how each entry displays
106
+ * (see isChannelDocumentFlow above, which only decides that).
107
+ */
108
+ export function selectIdTypesForScreen(byCategory, globalDocFlow) {
109
+ if (!byCategory)
110
+ return [];
111
+ return (globalDocFlow ? byCategory.document_verification : byCategory.data_verification) || [];
112
+ }
70
113
  /**
71
114
  * Whether a showErrorStep() message is about an expired/invalid resume or
72
115
  * resubmit link (RESUME_TARGET_UNAVAILABLE / NOT_A_RESUME_TOKEN — see
@@ -735,8 +778,11 @@ export class SmartComplyFlow {
735
778
  return "liveness";
736
779
  }
737
780
  if (info.failure_stage === "document" && info.country && info.identifier_type) {
781
+ // A document-stage resume always references a document_verification
782
+ // channel by its doc code — channels[country] is now split by
783
+ // category (see ChannelsByCategory), so search that list directly.
738
784
  const channels = this.sdkConfig?.channels || {};
739
- const idTypes = channels[info.country] || [];
785
+ const idTypes = channels[info.country]?.document_verification || [];
740
786
  const match = idTypes.find((idType) => {
741
787
  const code = typeof idType === "string" ? idType : (idType.code || idType.name);
742
788
  return code === info.identifier_type;
@@ -1112,7 +1158,9 @@ export class SmartComplyFlow {
1112
1158
  subtitle.textContent = "Choose the country that issued your ID";
1113
1159
  container.appendChild(subtitle);
1114
1160
  for (const country of countries) {
1115
- const card = this.createOptionCard(COUNTRY_LABELS[country] || country, `${channels[country].length} ID type${channels[country].length > 1 ? "s" : ""} available`, () => {
1161
+ const count = channels[country].data_verification.length
1162
+ + channels[country].document_verification.length;
1163
+ const card = this.createOptionCard(COUNTRY_LABELS[country] || country, `${count} ID type${count > 1 ? "s" : ""} available`, () => {
1116
1164
  this.selectedCountry = country;
1117
1165
  this.showStep("id_type");
1118
1166
  });
@@ -1132,14 +1180,14 @@ export class SmartComplyFlow {
1132
1180
  : "Choose the ID you want to verify";
1133
1181
  container.appendChild(subtitle);
1134
1182
  const channels = this.sdkConfig?.channels || {};
1135
- const idTypes = channels[this.selectedCountry] || [];
1183
+ const idTypes = selectIdTypesForScreen(channels[this.selectedCountry], globalDocFlow);
1136
1184
  for (const idType of idTypes) {
1137
1185
  const typeName = typeof idType === "string" ? idType : idType.name;
1138
1186
  // Use code (canonical) for API calls, fallback to name for backward compatibility
1139
1187
  const typeCode = typeof idType === "string" ? idType : (idType.code || idType.name);
1140
- // Detect per-channel: does THIS specific channel have upload fields?
1141
- const channelFields = typeof idType !== "string" ? (idType.fields || []) : [];
1142
- const isThisDocFlow = channelFields.some((f) => isUploadFieldType(f.type)) || globalDocFlow;
1188
+ // Detect per-channel, not from the config's overall mode — see
1189
+ // isChannelDocumentFlow's docstring for why.
1190
+ const isThisDocFlow = isChannelDocumentFlow(idType, globalDocFlow);
1143
1191
  const info = resolveIdTypeInfo(typeName, isThisDocFlow);
1144
1192
  // Prefer the backend-provided back-side flag; fall back to local heuristics only when absent.
1145
1193
  const requiresBackFromBackend = typeof idType !== "string" ? idType.requires_back_side : undefined;
@@ -1177,12 +1225,9 @@ export class SmartComplyFlow {
1177
1225
  this.selectedChannelId = idType.id;
1178
1226
  this.selectedChannelFields = idType.fields || []; // guard null/undefined from backend
1179
1227
  }
1180
- // Route: use explicit verification_type when set (more reliable than inspecting all channels)
1181
- // Fallback to per-channel upload field check for mixed / unconfigured setups
1182
- const hasUpload = (this.selectedChannelFields).some((f) => isUploadFieldType(f.type));
1183
- const vType = this.sdkConfig?.verification_type;
1184
- const vTypes = vType ? (Array.isArray(vType) ? vType : [vType]) : [];
1185
- const isDocChannel = hasUpload || (vTypes.length > 0 && vTypes.includes("document_verification"));
1228
+ // Route on THIS channel, same as isThisDocFlow above — see
1229
+ // isChannelDocumentFlow's docstring.
1230
+ const isDocChannel = isChannelDocumentFlow(idType, globalDocFlow);
1186
1231
  this.showStep(isDocChannel ? "document_capture" : "id_input");
1187
1232
  });
1188
1233
  container.appendChild(card);
@@ -2728,10 +2773,16 @@ export class SmartComplyFlow {
2728
2773
  if (types.includes("data_verification"))
2729
2774
  return false;
2730
2775
  }
2731
- // 2. Fallback: inspect channel fields — any upload field = document flow
2776
+ // 2. Fallback: inspect channel fields — any upload field = document flow.
2777
+ // channels[country] is now split {data_verification, document_verification}
2778
+ // (see ChannelsByCategory) — flatten both sub-lists per country, not the
2779
+ // per-country objects themselves.
2732
2780
  const channels = this.sdkConfig?.channels || {};
2733
2781
  const allFields = Object.values(channels)
2734
- .flat()
2782
+ .flatMap((byCategory) => [
2783
+ ...(byCategory.data_verification || []),
2784
+ ...(byCategory.document_verification || []),
2785
+ ])
2735
2786
  .flatMap((ch) => ch.fields || []);
2736
2787
  return allFields.some((f) => isUploadFieldType(f.type));
2737
2788
  }