smartcomply-web-sdk 1.0.95 → 1.0.97

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 (33) 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 +6 -2
  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 +6 -2
  8. package/dist/esm/client/Smartcomply.js.map +1 -1
  9. package/dist/esm/flow/DocumentCapture.d.ts +7 -0
  10. package/dist/esm/flow/DocumentCapture.d.ts.map +1 -1
  11. package/dist/esm/flow/DocumentCapture.js +11 -1
  12. package/dist/esm/flow/DocumentCapture.js.map +1 -1
  13. package/dist/esm/flow/SmartComplyFlow.d.ts.map +1 -1
  14. package/dist/esm/flow/SmartComplyFlow.js +7 -8
  15. package/dist/esm/flow/SmartComplyFlow.js.map +1 -1
  16. package/dist/esm/utils/channels.d.ts +16 -0
  17. package/dist/esm/utils/channels.d.ts.map +1 -0
  18. package/dist/esm/utils/channels.js +48 -0
  19. package/dist/esm/utils/channels.js.map +1 -0
  20. package/dist/flow/DocumentCapture.d.ts +7 -0
  21. package/dist/flow/DocumentCapture.d.ts.map +1 -1
  22. package/dist/flow/DocumentCapture.js +13 -2
  23. package/dist/flow/DocumentCapture.js.map +1 -1
  24. package/dist/flow/SmartComplyFlow.d.ts.map +1 -1
  25. package/dist/flow/SmartComplyFlow.js +9 -10
  26. package/dist/flow/SmartComplyFlow.js.map +1 -1
  27. package/dist/smartcomply.browser.js +31 -5
  28. package/dist/smartcomply.browser.js.map +4 -4
  29. package/dist/utils/channels.d.ts +16 -0
  30. package/dist/utils/channels.d.ts.map +1 -0
  31. package/dist/utils/channels.js +52 -0
  32. package/dist/utils/channels.js.map +1 -0
  33. 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,IAAI,KAAK,MAAM,CAAC;AAClE,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,iBAAiB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QACJ,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartcomply-web-sdk",
3
- "version": "1.0.95",
3
+ "version": "1.0.97",
4
4
  "description": "Drop-in identity verification (KYC) widget for web apps — face liveness, NIN/BVN, document verification",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",