smartcomply-web-sdk 1.0.94 → 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.
- package/dist/client/Smartcomply.d.ts +1 -1
- package/dist/client/Smartcomply.js +1 -1
- package/dist/esm/client/Smartcomply.d.ts +1 -1
- package/dist/esm/client/Smartcomply.js +1 -1
- package/dist/esm/flow/SmartComplyFlow.d.ts +18 -1
- package/dist/esm/flow/SmartComplyFlow.d.ts.map +1 -1
- package/dist/esm/flow/SmartComplyFlow.js +37 -5
- package/dist/esm/flow/SmartComplyFlow.js.map +1 -1
- package/dist/esm/types/onboarding.d.ts +5 -1
- package/dist/esm/types/onboarding.d.ts.map +1 -1
- package/dist/flow/SmartComplyFlow.d.ts +18 -1
- package/dist/flow/SmartComplyFlow.d.ts.map +1 -1
- package/dist/flow/SmartComplyFlow.js +38 -5
- package/dist/flow/SmartComplyFlow.js.map +1 -1
- package/dist/smartcomply.browser.js +13 -5
- package/dist/smartcomply.browser.js.map +2 -2
- package/dist/types/onboarding.d.ts +5 -1
- package/dist/types/onboarding.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
124
|
+
SmartComply.VERSION = "1.0.95";
|
|
125
125
|
//# sourceMappingURL=Smartcomply.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SDKChannel, 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 {
|
|
@@ -58,6 +58,23 @@ export interface FlowResult {
|
|
|
58
58
|
* so that's the only case the global flow mode is still used for.
|
|
59
59
|
*/
|
|
60
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)[];
|
|
61
78
|
/**
|
|
62
79
|
* Whether a showErrorStep() message is about an expired/invalid resume or
|
|
63
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,EAAiB,UAAU,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;
|
|
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;AAI5G,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,CA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AAe;IAUvB,OAAO,CAAC,gBAAgB;IAmDxB,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"}
|
|
@@ -89,6 +89,27 @@ export function isChannelDocumentFlow(idType, globalDocFlow) {
|
|
|
89
89
|
return globalDocFlow;
|
|
90
90
|
return (idType.fields || []).some((f) => isUploadFieldType(f.type));
|
|
91
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
|
+
}
|
|
92
113
|
/**
|
|
93
114
|
* Whether a showErrorStep() message is about an expired/invalid resume or
|
|
94
115
|
* resubmit link (RESUME_TARGET_UNAVAILABLE / NOT_A_RESUME_TOKEN — see
|
|
@@ -757,8 +778,11 @@ export class SmartComplyFlow {
|
|
|
757
778
|
return "liveness";
|
|
758
779
|
}
|
|
759
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.
|
|
760
784
|
const channels = this.sdkConfig?.channels || {};
|
|
761
|
-
const idTypes = channels[info.country] || [];
|
|
785
|
+
const idTypes = channels[info.country]?.document_verification || [];
|
|
762
786
|
const match = idTypes.find((idType) => {
|
|
763
787
|
const code = typeof idType === "string" ? idType : (idType.code || idType.name);
|
|
764
788
|
return code === info.identifier_type;
|
|
@@ -1134,7 +1158,9 @@ export class SmartComplyFlow {
|
|
|
1134
1158
|
subtitle.textContent = "Choose the country that issued your ID";
|
|
1135
1159
|
container.appendChild(subtitle);
|
|
1136
1160
|
for (const country of countries) {
|
|
1137
|
-
const
|
|
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`, () => {
|
|
1138
1164
|
this.selectedCountry = country;
|
|
1139
1165
|
this.showStep("id_type");
|
|
1140
1166
|
});
|
|
@@ -1154,7 +1180,7 @@ export class SmartComplyFlow {
|
|
|
1154
1180
|
: "Choose the ID you want to verify";
|
|
1155
1181
|
container.appendChild(subtitle);
|
|
1156
1182
|
const channels = this.sdkConfig?.channels || {};
|
|
1157
|
-
const idTypes = channels[this.selectedCountry]
|
|
1183
|
+
const idTypes = selectIdTypesForScreen(channels[this.selectedCountry], globalDocFlow);
|
|
1158
1184
|
for (const idType of idTypes) {
|
|
1159
1185
|
const typeName = typeof idType === "string" ? idType : idType.name;
|
|
1160
1186
|
// Use code (canonical) for API calls, fallback to name for backward compatibility
|
|
@@ -2747,10 +2773,16 @@ export class SmartComplyFlow {
|
|
|
2747
2773
|
if (types.includes("data_verification"))
|
|
2748
2774
|
return false;
|
|
2749
2775
|
}
|
|
2750
|
-
// 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.
|
|
2751
2780
|
const channels = this.sdkConfig?.channels || {};
|
|
2752
2781
|
const allFields = Object.values(channels)
|
|
2753
|
-
.
|
|
2782
|
+
.flatMap((byCategory) => [
|
|
2783
|
+
...(byCategory.data_verification || []),
|
|
2784
|
+
...(byCategory.document_verification || []),
|
|
2785
|
+
])
|
|
2754
2786
|
.flatMap((ch) => ch.fields || []);
|
|
2755
2787
|
return allFields.some((f) => isUploadFieldType(f.type));
|
|
2756
2788
|
}
|