@frankieone/one-sdk 1.7.14-rc.2 → 1.7.14-rc.4
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/cli/darwin-amd64/onesdk-cli +0 -0
- package/dist/cli/darwin-arm64/onesdk-cli +0 -0
- package/dist/cli/linux-amd64/onesdk-cli +0 -0
- package/dist/cli/linux-arm64/onesdk-cli +0 -0
- package/dist/cli/templateGenerator.js +20 -2
- package/dist/cli/windows-amd64/onesdk-cli.exe +0 -0
- package/dist/commit.txt +1 -1
- package/dist/esm/modules/cli/index.d.ts +7 -1
- package/dist/esm/modules/cli/index.d.ts.map +1 -1
- package/dist/esm/modules/cli/index.js +3 -3
- package/dist/esm/modules/cli/index.js.map +1 -1
- package/dist/esm/modules/cli/template/index.d.ts +6 -9
- package/dist/esm/modules/cli/template/index.d.ts.map +1 -1
- package/dist/esm/modules/cli/template/index.js +63 -5
- package/dist/esm/modules/cli/template/index.js.map +1 -1
- package/dist/esm/modules/cli/template/templateIdv.d.ts +1 -1
- package/dist/esm/modules/cli/template/templateIdv.d.ts.map +1 -1
- package/dist/esm/modules/cli/template/templateIdv.js +63 -39
- package/dist/esm/modules/cli/template/templateIdv.js.map +1 -1
- package/dist/esm/modules/cli/template/templateIdvReview.d.ts +1 -1
- package/dist/esm/modules/cli/template/templateIdvReview.d.ts.map +1 -1
- package/dist/esm/modules/cli/template/templateIdvReview.js +106 -77
- package/dist/esm/modules/cli/template/templateIdvReview.js.map +1 -1
- package/dist/esm/modules/cli/template/templateManualKyc.d.ts +1 -1
- package/dist/esm/modules/cli/template/templateManualKyc.d.ts.map +1 -1
- package/dist/esm/modules/cli/template/templateManualKyc.js +192 -149
- package/dist/esm/modules/cli/template/templateManualKyc.js.map +1 -1
- package/dist/esm/modules/idv/vendors/Sumsub/index.d.ts.map +1 -1
- package/dist/esm/modules/idv/vendors/Sumsub/index.js +24 -11
- package/dist/esm/modules/idv/vendors/Sumsub/index.js.map +1 -1
- package/dist/esm/modules/meta.json +1 -1
- package/package.json +2 -2
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
/* eslint-disable no-undef */
|
|
4
4
|
/* eslint-disable no-console */
|
|
5
|
+
function parseArgs(args) {
|
|
6
|
+
return {
|
|
7
|
+
flowId: args[2],
|
|
8
|
+
env: args[3],
|
|
9
|
+
cid: args[4],
|
|
10
|
+
ccid: args[5],
|
|
11
|
+
apiKey: args[6],
|
|
12
|
+
};
|
|
13
|
+
}
|
|
5
14
|
|
|
6
15
|
(async () => {
|
|
7
16
|
try {
|
|
@@ -17,8 +26,17 @@
|
|
|
17
26
|
throw new Error('generateOneSdkFlow is not a function');
|
|
18
27
|
}
|
|
19
28
|
|
|
20
|
-
const flowId = process.argv
|
|
21
|
-
|
|
29
|
+
const { flowId, env, cid, ccid, apiKey } = parseArgs(process.argv);
|
|
30
|
+
|
|
31
|
+
process.stdout.write(
|
|
32
|
+
generateOneSdkFlow({
|
|
33
|
+
flowId,
|
|
34
|
+
env,
|
|
35
|
+
cid,
|
|
36
|
+
ccid,
|
|
37
|
+
apiKey,
|
|
38
|
+
}),
|
|
39
|
+
);
|
|
22
40
|
} catch (error) {
|
|
23
41
|
console.error('Error loading module:', error);
|
|
24
42
|
}
|
|
Binary file
|
package/dist/commit.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
ff831968ea9638416b9aa21f65ac4f7bc695ccdc
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../modules/cli/index.js"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../modules/cli/index.js"],"names":[],"mappings":"AAGA;;;;;;WAEC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import createHTML from './template/index.js';
|
|
2
2
|
// @param {string} flowId - the id of the flow to generate, idv / idv_review / manual_kyc
|
|
3
|
-
export default function generateOneSdkFlow(flowId) {
|
|
4
|
-
return
|
|
3
|
+
export default function generateOneSdkFlow({ flowId, env, cid, ccid, apiKey }) {
|
|
4
|
+
return createHTML(flowId)({ env, cid, ccid, apiKey });
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../modules/cli/index.js"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../modules/cli/index.js"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAE7C,yFAAyF;AACzF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE;IAC3E,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
export default
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
import { templateIdv } from './templateIdv.js';
|
|
8
|
-
import { templateIdvReview } from './templateIdvReview.js';
|
|
9
|
-
import { templateManualKyc } from './templateManualKyc.js';
|
|
1
|
+
export default function createHTML(flowId: any): ({ env, cid, ccid, apiKey }: {
|
|
2
|
+
env: any;
|
|
3
|
+
cid: any;
|
|
4
|
+
ccid: any;
|
|
5
|
+
apiKey: any;
|
|
6
|
+
}) => string;
|
|
10
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../modules/cli/template/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../modules/cli/template/index.js"],"names":[],"mappings":"AAuDA;;;;;aAkBC"}
|
|
@@ -1,10 +1,68 @@
|
|
|
1
1
|
import { templateIdv } from './templateIdv.js';
|
|
2
2
|
import { templateIdvReview } from './templateIdvReview.js';
|
|
3
3
|
import { templateManualKyc } from './templateManualKyc.js';
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const backendURL = {
|
|
5
|
+
dev: "https://backend.latest.frankiefinancial.io",
|
|
6
|
+
qa: "https://backend.qa.frankiefinancial.io",
|
|
7
|
+
uat: "https://backend.kycaml.uat.frankiefinancial.io",
|
|
8
|
+
prod: "https://backend.kycaml.frankiefinancial.io",
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
+
const js = String.raw;
|
|
11
|
+
const createRequestTokenFunction = ({ env, cid, ccid, apiKey }) => js `
|
|
12
|
+
// Function to get an authentication token from the FrankieOne API
|
|
13
|
+
// This token is required to initialize OneSDK
|
|
14
|
+
async function getToken() {
|
|
15
|
+
// WARNING: This is for testing purposes only
|
|
16
|
+
// In production, token generation should happen server-side for security
|
|
17
|
+
|
|
18
|
+
// Replace these placeholder values with your actual credentials
|
|
19
|
+
const customerId = '${cid}';
|
|
20
|
+
// Optional: leave empty if not applicable (for multi-tenant setups)
|
|
21
|
+
const customerChildId = '${ccid}';
|
|
22
|
+
const apiKey = '${apiKey}';
|
|
23
|
+
|
|
24
|
+
// Create authentication key by base64 encoding the credentials
|
|
25
|
+
const authKey = btoa(
|
|
26
|
+
[customerId, customerChildId, apiKey].filter(Boolean).join(':'),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
// Replace this with your own logic to generate a unique customer reference
|
|
30
|
+
const customerReference = Math.random().toString(36).substring(2);
|
|
31
|
+
|
|
32
|
+
// Request a machine session token from FrankieOne
|
|
33
|
+
const tokenResponse = await fetch(
|
|
34
|
+
'${backendURL[env]}/auth/v2/machine-session',
|
|
35
|
+
{
|
|
36
|
+
method: 'POST',
|
|
37
|
+
headers: {
|
|
38
|
+
authorization: 'machine ' + authKey,
|
|
39
|
+
'Content-Type': 'application/json',
|
|
40
|
+
},
|
|
41
|
+
body: JSON.stringify({
|
|
42
|
+
permissions: {
|
|
43
|
+
preset: 'one-sdk',
|
|
44
|
+
reference: customerReference,
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
return await tokenResponse.json();
|
|
51
|
+
}`;
|
|
52
|
+
export default function createHTML(flowId) {
|
|
53
|
+
return function ({ env, cid, ccid, apiKey }) {
|
|
54
|
+
const getTokenImpl = createRequestTokenFunction({ env, cid, ccid, apiKey });
|
|
55
|
+
switch (flowId) {
|
|
56
|
+
case 'idv':
|
|
57
|
+
return templateIdv(getTokenImpl);
|
|
58
|
+
case 'idv_review':
|
|
59
|
+
return templateIdvReview(getTokenImpl);
|
|
60
|
+
case 'manual_kyc':
|
|
61
|
+
return templateManualKyc(getTokenImpl);
|
|
62
|
+
default:
|
|
63
|
+
return 'Unknown flow ID';
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
;
|
|
10
68
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/cli/template/index.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/cli/template/index.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EA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Root":"","sources":["../../../../../modules/cli/template/templateIdv.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templateIdv.d.ts","sourceRoot":"","sources":["../../../../../modules/cli/template/templateIdv.js"],"names":[],"mappings":"AAEO,uDAsFC"}
|
|
@@ -1,61 +1,85 @@
|
|
|
1
1
|
const html = String.raw;
|
|
2
|
-
export const templateIdv =
|
|
2
|
+
export const templateIdv = (getTokenImpl) => html `<!-- Generated by OneSDK CLI -->
|
|
3
|
+
<!-- More information: https://docs.frankieone.com/v1.14.1/docs/about-onesdk -->
|
|
4
|
+
|
|
5
|
+
<!DOCTYPE html>
|
|
6
|
+
<html lang="en">
|
|
3
7
|
<head>
|
|
4
|
-
<!-- UTF-8 encoding
|
|
8
|
+
<!-- UTF-8 encoding ensures proper display of special characters in the UI -->
|
|
5
9
|
<meta charset="utf-8" />
|
|
6
10
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>
|
|
11
|
+
<title>OneSDK - IDV</title>
|
|
12
|
+
|
|
13
|
+
<!-- Load the OneSDK library from FrankieOne CDN -->
|
|
14
|
+
<!-- You can change the version number in the URL to use a different version -->
|
|
8
15
|
<script src="https://assets.frankiefinancial.io/one-sdk/v1/oneSdk.umd.js"></script>
|
|
9
16
|
|
|
10
17
|
<script>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
${getTokenImpl}
|
|
19
|
+
|
|
20
|
+
// Main function to initialize and start OneSDK
|
|
21
|
+
async function startOneSdk() {
|
|
22
|
+
const sessionToken = await getToken();
|
|
23
|
+
|
|
24
|
+
// Initialize OneSDK with configuration
|
|
25
|
+
const oneSdk = await OneSdk({
|
|
26
|
+
session: {
|
|
27
|
+
token: sessionToken,
|
|
28
|
+
},
|
|
29
|
+
mode: 'production',
|
|
30
|
+
recipe: {
|
|
31
|
+
form: {
|
|
32
|
+
provider: {
|
|
33
|
+
name: 'react',
|
|
34
|
+
// UNCOMMENT AND ADD YOUR KEY to use Google Places address autocomplete
|
|
35
|
+
// googleApiKey: "<GOOGLE_API_KEY>",
|
|
22
36
|
},
|
|
23
37
|
},
|
|
24
|
-
}
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Create an IDV (Identity Verification) flow instance
|
|
42
|
+
const idv = oneSdk.flow('idv');
|
|
25
43
|
|
|
26
|
-
|
|
44
|
+
// Mount the IDV flow to the container element
|
|
45
|
+
idv.mount('#idv-el');
|
|
27
46
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
47
|
+
// Handle loading states during verification
|
|
48
|
+
idv.on('loading', () => {
|
|
49
|
+
console.log('loading');
|
|
50
|
+
});
|
|
32
51
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
52
|
+
// Handle verification results
|
|
53
|
+
idv.on('results', async ({ checkStatus, document, entityId }) => {
|
|
54
|
+
if (checkStatus) {
|
|
55
|
+
console.log('results succesful');
|
|
56
|
+
} else {
|
|
57
|
+
console.log('no data returned');
|
|
58
|
+
}
|
|
59
|
+
});
|
|
40
60
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
61
|
+
// Handle errors during verification
|
|
62
|
+
idv.on('error', ({ message, payload }) => {
|
|
63
|
+
console.log('received error');
|
|
64
|
+
console.log(message, payload);
|
|
65
|
+
});
|
|
45
66
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
67
|
+
// Handle completion of document detection/capture
|
|
68
|
+
idv.on('detection_complete', (message) => {
|
|
69
|
+
console.log('capture finished');
|
|
70
|
+
console.log(message);
|
|
71
|
+
});
|
|
50
72
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
73
|
+
// Log all OneSDK events to console for debugging
|
|
74
|
+
idv.on('*', (message) => {
|
|
75
|
+
console.log(message);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
55
78
|
</script>
|
|
56
79
|
</head>
|
|
57
80
|
|
|
58
81
|
<body style="background-color: white" onload="startOneSdk()">
|
|
82
|
+
<!-- Container element where OneSDK will mount its UI components -->
|
|
59
83
|
<div
|
|
60
84
|
id="idv-el"
|
|
61
85
|
style="top: 0; left: 0; width: 100%; height: 100%; display: block"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateIdv.js","sourceRoot":"","sources":["../../../../../modules/cli/template/templateIdv.js"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC;AAExB,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAA
|
|
1
|
+
{"version":3,"file":"templateIdv.js","sourceRoot":"","sources":["../../../../../modules/cli/template/templateIdv.js"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC;AAExB,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,YAAY,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;MAgB3C,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAsEV,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export function templateIdvReview(getTokenImpl: any): string;
|
|
2
2
|
//# sourceMappingURL=templateIdvReview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateIdvReview.d.ts","sourceRoot":"","sources":["../../../../../modules/cli/template/templateIdvReview.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templateIdvReview.d.ts","sourceRoot":"","sources":["../../../../../modules/cli/template/templateIdvReview.js"],"names":[],"mappings":"AAEO,6DA6HC"}
|
|
@@ -1,95 +1,124 @@
|
|
|
1
1
|
const html = String.raw;
|
|
2
|
-
export const templateIdvReview =
|
|
2
|
+
export const templateIdvReview = (getTokenImpl) => html `<!-- Generated by OneSDK CLI -->
|
|
3
|
+
<!-- More information: https://docs.frankieone.com/v1.14.1/docs/about-onesdk -->
|
|
4
|
+
|
|
5
|
+
<!DOCTYPE html>
|
|
6
|
+
<html lang="en">
|
|
3
7
|
<head>
|
|
4
|
-
<!-- UTF-8 encoding
|
|
8
|
+
<!-- UTF-8 encoding ensures proper display of special characters in the UI -->
|
|
5
9
|
<meta charset="utf-8" />
|
|
6
10
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>
|
|
11
|
+
<title>OneSDK - IDV+Review</title>
|
|
12
|
+
|
|
13
|
+
<!-- Load the OneSDK library from FrankieOne CDN -->
|
|
14
|
+
<!-- You can change the version number in the URL to use a different version -->
|
|
8
15
|
<script src="https://assets.frankiefinancial.io/one-sdk/v1/oneSdk.umd.js"></script>
|
|
9
16
|
|
|
10
17
|
<script>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
${getTokenImpl}
|
|
19
|
+
|
|
20
|
+
// Main function to initialize and start OneSDK
|
|
21
|
+
async function startOneSdk() {
|
|
22
|
+
const sessionToken = await getToken();
|
|
23
|
+
|
|
24
|
+
// Initialize OneSDK with configuration
|
|
25
|
+
const oneSdk = await OneSdk({
|
|
26
|
+
session: {
|
|
27
|
+
token: sessionToken,
|
|
28
|
+
},
|
|
29
|
+
mode: 'production',
|
|
30
|
+
recipe: {
|
|
31
|
+
form: {
|
|
32
|
+
provider: {
|
|
33
|
+
name: 'react',
|
|
34
|
+
// UNCOMMENT AND ADD YOUR KEY to use Google Places address autocomplete
|
|
35
|
+
// googleApiKey: "<GOOGLE_API_KEY>",
|
|
22
36
|
},
|
|
23
37
|
},
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Create an IDV flow instance for identity verification
|
|
42
|
+
const idv = oneSdk.flow('idv');
|
|
43
|
+
|
|
44
|
+
// Create loading screens to show during different stages
|
|
45
|
+
const loading1 = oneSdk.component('form', {
|
|
46
|
+
name: 'LOADING',
|
|
47
|
+
title: { label: 'Loading...' },
|
|
48
|
+
descriptions: [{ label: '' }],
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const loading2 = oneSdk.component('form', {
|
|
52
|
+
name: 'LOADING',
|
|
53
|
+
title: { label: 'Processing results...' },
|
|
54
|
+
descriptions: [
|
|
55
|
+
{
|
|
56
|
+
label:
|
|
57
|
+
"Hold tight, this can take up to 30 seconds. Please do not refresh this page or click the 'back' button on your browser.",
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Create review component for OCR (Optical Character Recognition) review
|
|
63
|
+
const review = oneSdk.component('form', {
|
|
64
|
+
name: 'REVIEW',
|
|
65
|
+
type: 'ocr',
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Mount the IDV flow to the container element
|
|
69
|
+
idv.mount('#idv-el');
|
|
70
|
+
|
|
71
|
+
// Handle loading states
|
|
72
|
+
let before = true;
|
|
73
|
+
idv.on('loading', (display) => {
|
|
74
|
+
if (display) {
|
|
75
|
+
if (before) {
|
|
76
|
+
loading1.mount('#loading1');
|
|
59
77
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
idv.on('results', async ({ checkStatus, document, entityId }) => {
|
|
65
|
-
if (checkStatus) {
|
|
66
|
-
console.log('results succesful');
|
|
67
|
-
loading2.unmount();
|
|
68
|
-
review.mount('#idv-el');
|
|
69
|
-
} else {
|
|
70
|
-
console.log('no data returned');
|
|
78
|
+
} else {
|
|
79
|
+
if (before) {
|
|
80
|
+
loading1.unmount();
|
|
71
81
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
console.log(
|
|
82
|
-
loading2.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
before = false;
|
|
83
|
+
}
|
|
84
|
+
console.log(before);
|
|
85
|
+
console.log(display);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// Handle verification results
|
|
89
|
+
idv.on('results', async ({ checkStatus, document, entityId }) => {
|
|
90
|
+
if (checkStatus) {
|
|
91
|
+
console.log('results succesful');
|
|
92
|
+
loading2.unmount();
|
|
93
|
+
review.mount('#idv-el');
|
|
94
|
+
} else {
|
|
95
|
+
console.log('no data returned');
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Handle errors during verification
|
|
100
|
+
idv.on('error', ({ message, payload }) => {
|
|
101
|
+
console.log('received error');
|
|
102
|
+
console.log(message, payload);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Handle completion of document detection/capture
|
|
106
|
+
idv.on('detection_complete', (message) => {
|
|
107
|
+
console.log('capture finished');
|
|
108
|
+
console.log(message);
|
|
109
|
+
loading2.mount('#loading2');
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// Log all events for debugging
|
|
113
|
+
idv.on('*', (message) => {
|
|
114
|
+
console.log(message);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
89
117
|
</script>
|
|
90
118
|
</head>
|
|
91
119
|
|
|
92
120
|
<body style="background-color: white" onload="startOneSdk()">
|
|
121
|
+
<!-- Container element where OneSDK will mount its UI components -->
|
|
93
122
|
<div
|
|
94
123
|
id="idv-el"
|
|
95
124
|
style="top: 0; left: 0; width: 100%; height: 100%; display: block"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateIdvReview.js","sourceRoot":"","sources":["../../../../../modules/cli/template/templateIdvReview.js"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC;AAExB,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAA
|
|
1
|
+
{"version":3,"file":"templateIdvReview.js","sourceRoot":"","sources":["../../../../../modules/cli/template/templateIdvReview.js"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC;AAExB,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,YAAY,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;MAgBjD,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA6GV,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export function templateManualKyc(getTokenImpl: any): string;
|
|
2
2
|
//# sourceMappingURL=templateManualKyc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateManualKyc.d.ts","sourceRoot":"","sources":["../../../../../modules/cli/template/templateManualKyc.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templateManualKyc.d.ts","sourceRoot":"","sources":["../../../../../modules/cli/template/templateManualKyc.js"],"names":[],"mappings":"AAEO,6DAsNC"}
|
|
@@ -1,170 +1,213 @@
|
|
|
1
1
|
const html = String.raw;
|
|
2
|
-
export const templateManualKyc =
|
|
2
|
+
export const templateManualKyc = (getTokenImpl) => html `<!-- Generated by OneSDK CLI
|
|
3
|
+
This is a sample HTML template for integrating FrankieOne's OneSDK * It
|
|
4
|
+
implements a complete KYC (Know Your Customer) flow with multiple steps: *
|
|
5
|
+
Welcome -> Consent -> Personal Details -> Document Upload -> Review -> Result
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
<!DOCTYPE html>
|
|
9
|
+
<html lang="en">
|
|
3
10
|
<head>
|
|
4
|
-
<!-- UTF-8 encoding
|
|
11
|
+
<!-- UTF-8 encoding ensures proper display of international characters -->
|
|
5
12
|
<meta charset="utf-8" />
|
|
6
13
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>
|
|
14
|
+
<title>OneSDK - Manual KYC</title>
|
|
15
|
+
|
|
16
|
+
<!-- Load the OneSDK library from FrankieOne CDN -->
|
|
17
|
+
<!-- You can change the version number in the URL to use a different version -->
|
|
8
18
|
<script src="https://assets.frankiefinancial.io/one-sdk/v1/oneSdk.umd.js"></script>
|
|
9
19
|
|
|
10
20
|
<script>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
${getTokenImpl}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Main function to initialize and configure OneSDK
|
|
25
|
+
* Sets up the complete KYC flow with all necessary screens and event handlers
|
|
26
|
+
*/
|
|
27
|
+
async function startOneSdk() {
|
|
28
|
+
const sessionToken = await getToken();
|
|
29
|
+
|
|
30
|
+
// Initialize OneSDK with basic configuration
|
|
31
|
+
const oneSdk = await OneSdk({
|
|
32
|
+
session: {
|
|
33
|
+
token: sessionToken,
|
|
34
|
+
},
|
|
35
|
+
mode: 'production',
|
|
36
|
+
recipe: {
|
|
37
|
+
form: {
|
|
38
|
+
provider: {
|
|
39
|
+
name: 'react',
|
|
40
|
+
// UNCOMMENT AND ADD YOUR KEY to use Google Places address autocomplete
|
|
41
|
+
// googleApiKey: "<GOOGLE_API_KEY>",
|
|
23
42
|
},
|
|
24
43
|
},
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Enable debug logging of all OneSDK events
|
|
48
|
+
oneSdkInstance.on('*', console.log);
|
|
49
|
+
|
|
50
|
+
// Get the container where OneSDK UI will be mounted
|
|
51
|
+
const appContainer = document.querySelector('#idv-el');
|
|
52
|
+
|
|
53
|
+
// Create components for each step of the KYC flow
|
|
54
|
+
// Each component is configured with specific options for its purpose
|
|
55
|
+
|
|
56
|
+
// Welcome screen - Initial landing page
|
|
57
|
+
const welcome = oneSdkInstance.component('form', {
|
|
58
|
+
name: 'WELCOME',
|
|
59
|
+
mode: 'individual',
|
|
60
|
+
type: 'manual',
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Consent screen - Get user permission
|
|
64
|
+
const consent = oneSdkInstance.component('form', {
|
|
65
|
+
name: 'CONSENT',
|
|
66
|
+
mode: 'individual',
|
|
67
|
+
type: 'manual',
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Personal details form
|
|
71
|
+
const personal = oneSdkInstance.component('form', {
|
|
72
|
+
name: 'PERSONAL',
|
|
73
|
+
mode: 'individual',
|
|
74
|
+
type: 'manual',
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Document upload screen
|
|
78
|
+
const documents = oneSdkInstance.component('form', {
|
|
79
|
+
name: 'DOCUMENT',
|
|
80
|
+
mode: 'individual',
|
|
81
|
+
type: 'manual',
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Review screen - Final verification step
|
|
85
|
+
const review = oneSdkInstance.component('form', {
|
|
86
|
+
name: 'REVIEW',
|
|
87
|
+
mode: 'individual',
|
|
88
|
+
type: 'manual',
|
|
89
|
+
verify: true,
|
|
90
|
+
customResult: true,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// Various result screens based on verification outcome
|
|
94
|
+
const success = oneSdkInstance.component('form', {
|
|
95
|
+
name: 'RESULT',
|
|
96
|
+
mode: 'individual',
|
|
97
|
+
state: 'SUCCESS',
|
|
98
|
+
type: 'manual',
|
|
99
|
+
cta: {
|
|
100
|
+
label: 'Continue',
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const failed = oneSdkInstance.component('form', {
|
|
105
|
+
name: 'RESULT',
|
|
106
|
+
mode: 'individual',
|
|
107
|
+
state: 'FAIL',
|
|
108
|
+
type: 'manual',
|
|
109
|
+
cta: {
|
|
110
|
+
label: 'Continue',
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const partial = oneSdkInstance.component('form', {
|
|
115
|
+
name: 'RESULT',
|
|
116
|
+
mode: 'individual',
|
|
117
|
+
state: 'PARTIAL',
|
|
118
|
+
type: 'manual',
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const pending = oneSdkInstance.component('form', {
|
|
122
|
+
name: 'RESULT',
|
|
123
|
+
mode: 'individual',
|
|
124
|
+
state: 'PENDING',
|
|
125
|
+
type: 'manual',
|
|
126
|
+
cta: {
|
|
127
|
+
label: 'Continue',
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
const retry = oneSdkInstance.component('form', {
|
|
132
|
+
name: 'RETRY',
|
|
133
|
+
mode: 'individual',
|
|
134
|
+
type: 'manual',
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// Set up the flow between screens using event handlers
|
|
138
|
+
// Each handler listens for completion of current screen and shows the next
|
|
139
|
+
|
|
140
|
+
welcome.on('form:welcome:ready', () => {
|
|
141
|
+
consent.mount(appContainer);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// When consent is given, show personal details form
|
|
145
|
+
consent.on('form:consent:ready', async () => {
|
|
146
|
+
personal.mount(appContainer);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
personal.on('form:personal:ready', async () => {
|
|
150
|
+
documents.mount(appContainer);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// Allow navigation back to personal details
|
|
154
|
+
documents.on('form:document:back', async () => {
|
|
155
|
+
personal.mount(appContainer);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
documents.on('form:document:ready', async () => {
|
|
159
|
+
review.mount(appContainer);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// Handle different verification outcomes
|
|
163
|
+
review.on('form:review:success', async () => {
|
|
164
|
+
success.mount(appContainer);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
review.on('form:review:failed', async () => {
|
|
168
|
+
failed.mount(appContainer);
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
review.on('form:review:pending', () => {
|
|
172
|
+
pending.mount(appContainer);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
// Handle partial success with retry logic
|
|
176
|
+
let retryCount = 0;
|
|
177
|
+
review.on('form:review:partial', async () => {
|
|
178
|
+
if (retryCount < 2) {
|
|
179
|
+
retryCount += 1;
|
|
180
|
+
partial.mount(appContainer);
|
|
181
|
+
} else {
|
|
182
|
+
failed.mount(appContainer);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
111
185
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
186
|
+
// Log final verification outcomes
|
|
187
|
+
pending.on('form:result:pending', async () => {
|
|
188
|
+
console.log('form result pending');
|
|
189
|
+
});
|
|
115
190
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
191
|
+
success.on('form:result:success', async () => {
|
|
192
|
+
console.log('form result success');
|
|
193
|
+
});
|
|
119
194
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
195
|
+
failed.on('form:result:failed', async () => {
|
|
196
|
+
console.log('form result failed');
|
|
197
|
+
});
|
|
123
198
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
199
|
+
partial.on('form:result:partial', async () => {
|
|
200
|
+
retry.mount(appContainer);
|
|
201
|
+
});
|
|
127
202
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
review.on('form:review:pending', () => {
|
|
133
|
-
pending.mount(appContainer);
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
let retryCount = 0;
|
|
137
|
-
review.on('form:review:partial', async () => {
|
|
138
|
-
if (retryCount < 2) {
|
|
139
|
-
retryCount += 1;
|
|
140
|
-
partial.mount(appContainer);
|
|
141
|
-
} else {
|
|
142
|
-
failed.mount(appContainer);
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
pending.on('form:result:pending', async () => {
|
|
147
|
-
console.log('form result pending');
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
success.on('form:result:success', async () => {
|
|
151
|
-
console.log('form result success');
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
failed.on('form:result:failed', async () => {
|
|
155
|
-
console.log('form result failed');
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
partial.on('form:result:partial', async () => {
|
|
159
|
-
retry.mount(appContainer);
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
welcome.mount(appContainer);
|
|
163
|
-
}
|
|
203
|
+
// Start the flow by mounting the welcome screen
|
|
204
|
+
welcome.mount(appContainer);
|
|
205
|
+
}
|
|
164
206
|
</script>
|
|
165
207
|
</head>
|
|
166
208
|
|
|
167
209
|
<body style="background-color: white" onload="startOneSdk()">
|
|
210
|
+
<!-- Container where OneSDK will render its UI -->
|
|
168
211
|
<div
|
|
169
212
|
id="idv-el"
|
|
170
213
|
style="top: 0; left: 0; width: 100%; height: 100%; display: block"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateManualKyc.js","sourceRoot":"","sources":["../../../../../modules/cli/template/templateManualKyc.js"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC;AAExB,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAA
|
|
1
|
+
{"version":3,"file":"templateManualKyc.js","sourceRoot":"","sources":["../../../../../modules/cli/template/templateManualKyc.js"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC;AAExB,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,YAAY,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;;;MAmBjD,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAmMV,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../modules/idv/vendors/Sumsub/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../modules/idv/vendors/Sumsub/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAc,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAMzD,OAAO,EAAa,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAkDhF,eAAO,MAAM,UAAU;;;;;;;;mBAlDR,CAAC;;;;;;;;;;CAsKf,CAAC"}
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { mkEventHub, OneSDKError } from '../../../common/index.js';
|
|
11
11
|
import { defineWrapper } from '../../../common/modules/defineModule.js';
|
|
12
12
|
import { useFormToReviewResults } from '../../../common/vendors/form/useForm.js';
|
|
13
13
|
import { install } from '../../../common/vendors/sumsub/index.js';
|
|
@@ -15,14 +15,14 @@ import { feat } from '../../../features.config.js';
|
|
|
15
15
|
import { IDVClient, IDVStatus } from '../../../frankie-client/clients/IDVClient.js';
|
|
16
16
|
import { createSession } from '../../../ocr/vendors/common/createSession.js';
|
|
17
17
|
import { checkStatusEventMapping } from '../common/checkStatusEventMapping.js';
|
|
18
|
-
const initProcess = (_a) => __awaiter(void 0, [_a], void 0, function* ({ eventHub,
|
|
18
|
+
const initProcess = (_a) => __awaiter(void 0, [_a], void 0, function* ({ eventHub, idvClient, vendorParameters, entityId, }) {
|
|
19
19
|
try {
|
|
20
20
|
const results = yield idvClient.initProcess({
|
|
21
21
|
isSynchronous: true,
|
|
22
22
|
vendorParameters,
|
|
23
23
|
});
|
|
24
24
|
checkStatusEventMapping({
|
|
25
|
-
eventHub
|
|
25
|
+
eventHub,
|
|
26
26
|
results,
|
|
27
27
|
entityId,
|
|
28
28
|
});
|
|
@@ -42,7 +42,7 @@ const removeVendorSDK = (mountElement) => {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
export const initialise = defineWrapper('sumsub', (shared, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
-
var _a, _b;
|
|
45
|
+
var _a, _b, _c;
|
|
46
46
|
const { recipe, frankieClient } = shared;
|
|
47
47
|
const { mountElement, eventHub } = options;
|
|
48
48
|
const idvClient = new IDVClient(frankieClient);
|
|
@@ -53,9 +53,25 @@ export const initialise = defineWrapper('sumsub', (shared, options) => __awaiter
|
|
|
53
53
|
const { entityId, token, vendorParameters } = idvSession;
|
|
54
54
|
const containsReviewScreen = feat(`modules.idv.containsReviewScreen.sumsub`);
|
|
55
55
|
const recipeProvideReviewScreen = (_b = (_a = recipe.idv) === null || _a === void 0 ? void 0 : _a.provideReviewScreen) !== null && _b !== void 0 ? _b : feat('recipeDefaults.idv.provideReviewScreen');
|
|
56
|
-
const attachForm = !containsReviewScreen
|
|
56
|
+
const attachForm = (_c = (!containsReviewScreen && recipeProvideReviewScreen)) !== null && _c !== void 0 ? _c : false;
|
|
57
57
|
const privateEventHub = mkEventHub();
|
|
58
|
-
privateEventHub.on('results',
|
|
58
|
+
privateEventHub.on('results', (results) => {
|
|
59
|
+
const levelName = vendorParameters === null || vendorParameters === void 0 ? void 0 : vendorParameters.levelName;
|
|
60
|
+
if (levelName === 'basic-kyc-level') {
|
|
61
|
+
useFormToReviewResults({
|
|
62
|
+
oneSdkInstance: shared.oneSdkInstance,
|
|
63
|
+
localEventHub: eventHub,
|
|
64
|
+
mountElement,
|
|
65
|
+
attachForm: attachForm,
|
|
66
|
+
})(results);
|
|
67
|
+
}
|
|
68
|
+
if (levelName === 'POA_ONLY') {
|
|
69
|
+
eventHub.emit('loading', false, {
|
|
70
|
+
message: 'Completed process successfully',
|
|
71
|
+
});
|
|
72
|
+
eventHub.emit('results', results);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
59
75
|
privateEventHub.on(['input_required', 'processing', 'error'], () => eventHub.emit('loading', false, {
|
|
60
76
|
message: 'Completed process unsuccessfully',
|
|
61
77
|
}));
|
|
@@ -87,16 +103,13 @@ export const initialise = defineWrapper('sumsub', (shared, options) => __awaiter
|
|
|
87
103
|
eventHub.emit('ready', { domElement: mountElement });
|
|
88
104
|
break;
|
|
89
105
|
case 'idCheck.onApplicantStatusChanged':
|
|
90
|
-
if ((payload === null || payload === void 0 ? void 0 : payload.reviewStatus) === '
|
|
106
|
+
if ((payload === null || payload === void 0 ? void 0 : payload.reviewStatus) === 'completed') {
|
|
91
107
|
eventHub.emit('detection_complete');
|
|
92
|
-
}
|
|
93
|
-
else if ((payload === null || payload === void 0 ? void 0 : payload.reviewStatus) === 'completed') {
|
|
94
108
|
eventHub.emit('loading', true, {
|
|
95
109
|
message: 'Retrieving IDV results',
|
|
96
110
|
});
|
|
97
111
|
yield initProcess({
|
|
98
|
-
eventHub,
|
|
99
|
-
privateEventHub,
|
|
112
|
+
eventHub: privateEventHub,
|
|
100
113
|
idvClient,
|
|
101
114
|
vendorParameters,
|
|
102
115
|
entityId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../modules/idv/vendors/Sumsub/index.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../modules/idv/vendors/Sumsub/index.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAGhF,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAEzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE5E,MAAM,WAAW,GAAG,KAUjB,EAAE,4CAVsB,EACzB,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,QAAQ,GAMT;IACC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,WAAW,CAAC;YAC1C,aAAa,EAAE,IAAI;YACnB,gBAAgB;SACjB,CAAC,CAAC;QAEH,uBAAuB,CAAC;YACtB,QAAQ;YACR,OAAO;YACP,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,QA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T,CAAC,CAAC;oBAEH,eAAe,CAAC,YAAY,CAAC,CAAC;gBAChC,CAAC;gBACD,MAAM;QACV,CAAC;IACH,CAAC,CAAA,CACF;SACA,KAAK,EAAE;SACP,MAAM,CAAC,YAAY,CAAC,CAAC;AAC1B,CAAC,CAAA,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "version": "1.7.14-rc.
|
|
1
|
+
{ "version": "1.7.14-rc.4" }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frankieone/one-sdk",
|
|
3
|
-
"version": "1.7.14-rc.
|
|
3
|
+
"version": "1.7.14-rc.4",
|
|
4
4
|
"cliVersion": "0.0.1",
|
|
5
5
|
"description": "FrankieOne OneSDK",
|
|
6
6
|
"keywords": [],
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"tsc-check": "tsc -p ./tsconfig.modules.json --noEmit",
|
|
53
53
|
"tsc-check-all": "tsc -p ./tsconfig.json --noEmit",
|
|
54
54
|
"test": "jest --clearCache && jest --detectOpenHandles --silent --expand",
|
|
55
|
-
"test:analyze": "node --expose-gc ./node_modules/.bin/jest --
|
|
55
|
+
"test:analyze": "node --expose-gc ./node_modules/.bin/jest --silent --coverage --logHeapUsage",
|
|
56
56
|
"watch": "webpack --watch",
|
|
57
57
|
"watch:css": "npx tailwindcss -o styles/f1-style.css --watch",
|
|
58
58
|
"prepare": "husky"
|