smartcomply-web-sdk 1.0.95 → 1.0.96
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.d.ts.map +1 -1
- package/dist/client/Smartcomply.js +6 -2
- package/dist/client/Smartcomply.js.map +1 -1
- package/dist/esm/client/Smartcomply.d.ts +1 -1
- package/dist/esm/client/Smartcomply.d.ts.map +1 -1
- package/dist/esm/client/Smartcomply.js +6 -2
- package/dist/esm/client/Smartcomply.js.map +1 -1
- package/dist/esm/flow/SmartComplyFlow.d.ts.map +1 -1
- package/dist/esm/flow/SmartComplyFlow.js +1 -7
- package/dist/esm/flow/SmartComplyFlow.js.map +1 -1
- package/dist/esm/utils/channels.d.ts +16 -0
- package/dist/esm/utils/channels.d.ts.map +1 -0
- package/dist/esm/utils/channels.js +48 -0
- package/dist/esm/utils/channels.js.map +1 -0
- package/dist/flow/SmartComplyFlow.d.ts.map +1 -1
- package/dist/flow/SmartComplyFlow.js +4 -10
- package/dist/flow/SmartComplyFlow.js.map +1 -1
- package/dist/smartcomply.browser.js +31 -5
- package/dist/smartcomply.browser.js.map +4 -4
- package/dist/utils/channels.d.ts +16 -0
- package/dist/utils/channels.d.ts.map +1 -0
- package/dist/utils/channels.js +52 -0
- package/dist/utils/channels.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ChannelsByCategory } from "../types/onboarding";
|
|
2
|
+
export declare function isUploadFieldType(type: unknown): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Returns initialize/'s channels as {data_verification, document_verification}
|
|
5
|
+
* per country, whichever shape the backend sent.
|
|
6
|
+
*
|
|
7
|
+
* Backends without the category split send one flat list per country, and
|
|
8
|
+
* reading .data_verification off that list crashed the country screen
|
|
9
|
+
* ("Cannot read properties of undefined (reading 'length')"), leaving the
|
|
10
|
+
* widget stuck after "Get Started". A flat list is split the same way
|
|
11
|
+
* isChannelDocumentFlow decides per channel: any upload field means a
|
|
12
|
+
* document scan; anything else, including a legacy string channel, is a
|
|
13
|
+
* number-entry lookup. A country whose value is neither shape is dropped.
|
|
14
|
+
*/
|
|
15
|
+
export declare function normalizeChannels(raw: unknown): Record<string, ChannelsByCategory>;
|
|
16
|
+
//# sourceMappingURL=channels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../src/utils/channels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAc,MAAM,qBAAqB,CAAC;AAMrE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAExD;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAwBlF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isUploadFieldType = isUploadFieldType;
|
|
4
|
+
exports.normalizeChannels = normalizeChannels;
|
|
5
|
+
// Backend/admin data tags document-capture fields inconsistently — the field
|
|
6
|
+
// renderer already treats "image" and "file" as file inputs alongside
|
|
7
|
+
// "upload", so flow-routing decisions must recognize the same set or a channel
|
|
8
|
+
// tagged "image"/"file" silently falls back to the number-entry screen.
|
|
9
|
+
function isUploadFieldType(type) {
|
|
10
|
+
return type === "upload" || type === "image" || type === "file";
|
|
11
|
+
}
|
|
12
|
+
function isChannelList(value) {
|
|
13
|
+
return Array.isArray(value);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Returns initialize/'s channels as {data_verification, document_verification}
|
|
17
|
+
* per country, whichever shape the backend sent.
|
|
18
|
+
*
|
|
19
|
+
* Backends without the category split send one flat list per country, and
|
|
20
|
+
* reading .data_verification off that list crashed the country screen
|
|
21
|
+
* ("Cannot read properties of undefined (reading 'length')"), leaving the
|
|
22
|
+
* widget stuck after "Get Started". A flat list is split the same way
|
|
23
|
+
* isChannelDocumentFlow decides per channel: any upload field means a
|
|
24
|
+
* document scan; anything else, including a legacy string channel, is a
|
|
25
|
+
* number-entry lookup. A country whose value is neither shape is dropped.
|
|
26
|
+
*/
|
|
27
|
+
function normalizeChannels(raw) {
|
|
28
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
29
|
+
return {};
|
|
30
|
+
const grouped = {};
|
|
31
|
+
for (const [country, value] of Object.entries(raw)) {
|
|
32
|
+
if (isChannelList(value)) {
|
|
33
|
+
grouped[country] = { data_verification: [], document_verification: [] };
|
|
34
|
+
for (const channel of value) {
|
|
35
|
+
const isDocument = typeof channel !== "string" &&
|
|
36
|
+
(channel.fields || []).some((f) => isUploadFieldType(f.type));
|
|
37
|
+
grouped[country][isDocument ? "document_verification" : "data_verification"].push(channel);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else if (value && typeof value === "object") {
|
|
41
|
+
const byCategory = value;
|
|
42
|
+
grouped[country] = {
|
|
43
|
+
data_verification: isChannelList(byCategory.data_verification) ? byCategory.data_verification : [],
|
|
44
|
+
document_verification: isChannelList(byCategory.document_verification)
|
|
45
|
+
? byCategory.document_verification
|
|
46
|
+
: [],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return grouped;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=channels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channels.js","sourceRoot":"","sources":["../../src/utils/channels.ts"],"names":[],"mappings":";;AAMA,8CAEC;AAkBD,8CAwBC;AAhDD,6EAA6E;AAC7E,sEAAsE;AACtE,+EAA+E;AAC/E,wEAAwE;AACxE,SAAgB,iBAAiB,CAAC,IAAa;IAC7C,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,OAAO,IAAI,IAA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