@frankieone/one-sdk 1.7.15 → 1.7.16
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/cli.js +130 -0
- 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 +43 -0
- package/dist/cli/windows-amd64/onesdk-cli.exe +0 -0
- package/dist/commit.txt +1 -1
- package/dist/esm/modules/cli/index.d.ts +8 -0
- package/dist/esm/modules/cli/index.d.ts.map +1 -0
- package/dist/esm/modules/cli/index.js +6 -0
- package/dist/esm/modules/cli/index.js.map +1 -0
- package/dist/esm/modules/cli/template/index.d.ts +7 -0
- package/dist/esm/modules/cli/template/index.d.ts.map +1 -0
- package/dist/esm/modules/cli/template/index.js +68 -0
- package/dist/esm/modules/cli/template/index.js.map +1 -0
- package/dist/esm/modules/cli/template/templateIdv.d.ts +2 -0
- package/dist/esm/modules/cli/template/templateIdv.d.ts.map +1 -0
- package/dist/esm/modules/cli/template/templateIdv.js +109 -0
- package/dist/esm/modules/cli/template/templateIdv.js.map +1 -0
- package/dist/esm/modules/cli/template/templateIdvReview.d.ts +2 -0
- package/dist/esm/modules/cli/template/templateIdvReview.d.ts.map +1 -0
- package/dist/esm/modules/cli/template/templateIdvReview.js +125 -0
- package/dist/esm/modules/cli/template/templateIdvReview.js.map +1 -0
- package/dist/esm/modules/cli/template/templateManualKyc.d.ts +2 -0
- package/dist/esm/modules/cli/template/templateManualKyc.d.ts.map +1 -0
- package/dist/esm/modules/cli/template/templateManualKyc.js +215 -0
- package/dist/esm/modules/cli/template/templateManualKyc.js.map +1 -0
- package/dist/esm/modules/common/vendors/sumsub/index.d.ts +5 -0
- package/dist/esm/modules/common/vendors/sumsub/index.d.ts.map +1 -0
- package/dist/esm/modules/common/vendors/sumsub/index.js +16 -0
- package/dist/esm/modules/common/vendors/sumsub/index.js.map +1 -0
- package/dist/esm/modules/common/vendors/sumsub/sumsub.types.d.ts +29 -0
- package/dist/esm/modules/common/vendors/sumsub/sumsub.types.d.ts.map +1 -0
- package/dist/esm/modules/common/vendors/sumsub/sumsub.types.js +3 -0
- package/dist/esm/modules/common/vendors/sumsub/sumsub.types.js.map +1 -0
- package/dist/esm/modules/features.config.d.ts +1 -0
- package/dist/esm/modules/features.config.d.ts.map +1 -1
- package/dist/esm/modules/features.config.js +1 -0
- package/dist/esm/modules/features.config.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/components/view/FrankieReviewDocumentList/FrankieReviewDocumentList.js +1 -1
- package/dist/esm/modules/idv/definition.types.d.ts +2 -2
- package/dist/esm/modules/idv/definition.types.d.ts.map +1 -1
- package/dist/esm/modules/idv/index.d.ts.map +1 -1
- package/dist/esm/modules/idv/index.js +2 -0
- package/dist/esm/modules/idv/index.js.map +1 -1
- package/dist/esm/modules/idv/vendors/Incode/index.d.ts +1 -1
- package/dist/esm/modules/idv/vendors/Mastercard/index.d.ts +1 -1
- package/dist/esm/modules/idv/vendors/OcrLabs/index.d.ts +1 -1
- package/dist/esm/modules/idv/vendors/Onfido/index.d.ts +1 -1
- package/dist/esm/modules/idv/vendors/Sumsub/index.d.ts +23 -0
- package/dist/esm/modules/idv/vendors/Sumsub/index.d.ts.map +1 -0
- package/dist/esm/modules/idv/vendors/Sumsub/index.js +125 -0
- package/dist/esm/modules/idv/vendors/Sumsub/index.js.map +1 -0
- package/dist/esm/modules/idv/vendors/common/iframeUtils/defineIframeIDVWrapper.d.ts +1 -1
- package/dist/esm/modules/index.d.ts.map +1 -1
- package/dist/esm/modules/index.js.map +1 -1
- package/dist/esm/modules/meta.json +1 -1
- package/package.json +10 -4
package/dist/cli/cli.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/* eslint-disable no-undef */
|
|
4
|
+
/* eslint-disable no-console */
|
|
5
|
+
import { spawnSync, spawn } from 'node:child_process';
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import os from 'os';
|
|
9
|
+
|
|
10
|
+
const executableName = 'onesdk-cli';
|
|
11
|
+
|
|
12
|
+
const installationPath = () => {
|
|
13
|
+
const errorMsg = 'Failed to find executable path.';
|
|
14
|
+
|
|
15
|
+
// First, check the 'npm' executable path. with this we can resolve whether
|
|
16
|
+
// user using some kind of nvm or fnm or any other node version manager.
|
|
17
|
+
const whichCmd = spawnSync('which', ['npm']);
|
|
18
|
+
if (whichCmd.error) {
|
|
19
|
+
console.error(errorMsg, whichCmd.error);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
const whichOutput = whichCmd.stdout.toString().trim();
|
|
23
|
+
|
|
24
|
+
// Replace the 'npm' executable path with the 'onesdk-cli' executable path.
|
|
25
|
+
const sedCmd = spawnSync(
|
|
26
|
+
'sed',
|
|
27
|
+
['-e', 's|bin/npm|lib/node_modules/@frankieone/one-sdk/dist/cli|'],
|
|
28
|
+
{ input: whichOutput },
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
if (sedCmd.error) {
|
|
32
|
+
console.error(errorMsg, sedCmd.error);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Check if the resolved path exists.
|
|
37
|
+
const resolvedPath = sedCmd.stdout.toString().trim();
|
|
38
|
+
if (resolvedPath && fs.existsSync(resolvedPath)) {
|
|
39
|
+
return resolvedPath;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Fallback for npx and local installations
|
|
43
|
+
const npxPath = path.resolve(
|
|
44
|
+
process.cwd(),
|
|
45
|
+
'node_modules/@frankieone/one-sdk/dist/cli',
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
if (fs.existsSync(npxPath)) {
|
|
49
|
+
return npxPath;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
console.error(errorMsg, 'Executable not found');
|
|
53
|
+
process.exit(1);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const darwinExecutable = (basePath) => {
|
|
57
|
+
const arch = os.arch();
|
|
58
|
+
|
|
59
|
+
switch (arch) {
|
|
60
|
+
case 'arm64':
|
|
61
|
+
return `${basePath}/darwin-arm64/${executableName}`;
|
|
62
|
+
|
|
63
|
+
case 'x64':
|
|
64
|
+
return `${basePath}/darwin-amd64/${executableName}`;
|
|
65
|
+
|
|
66
|
+
default:
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const linuxExecutable = (basePath) => {
|
|
72
|
+
const arch = os.arch();
|
|
73
|
+
|
|
74
|
+
switch (arch) {
|
|
75
|
+
case 'arm64':
|
|
76
|
+
return `${basePath}/linux-arm64/${executableName}`;
|
|
77
|
+
|
|
78
|
+
case 'x64':
|
|
79
|
+
return `${basePath}/linux-amd64/${executableName}`;
|
|
80
|
+
|
|
81
|
+
default:
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const windowsExecutable = (basePath) => {
|
|
87
|
+
return `${basePath}/windows-amd64/${executableName}.exe`;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const executableFile = () => {
|
|
91
|
+
const basePath = installationPath();
|
|
92
|
+
const kernelName = os.type();
|
|
93
|
+
|
|
94
|
+
switch (kernelName) {
|
|
95
|
+
case 'Linux':
|
|
96
|
+
return linuxExecutable(basePath);
|
|
97
|
+
|
|
98
|
+
case 'Darwin':
|
|
99
|
+
return darwinExecutable(basePath);
|
|
100
|
+
|
|
101
|
+
case 'Windows_NT':
|
|
102
|
+
return windowsExecutable(basePath);
|
|
103
|
+
|
|
104
|
+
default:
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const executable = executableFile();
|
|
110
|
+
if (!executable) {
|
|
111
|
+
console.error('Unsupported platform.');
|
|
112
|
+
process.exit(1);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const args = process.argv.slice(2);
|
|
116
|
+
const child = spawn(executable, args, { stdio: 'inherit' });
|
|
117
|
+
|
|
118
|
+
child.on('error', (err) => {
|
|
119
|
+
console.error('Failed to start child process.', err);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
child.on('exit', (code, signal) => {
|
|
123
|
+
if (code && code !== 0) {
|
|
124
|
+
console.log('Process exited with code: ' + code);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (!code && signal) {
|
|
128
|
+
console.log('Process exited with signal: ' + signal);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/* eslint-disable no-undef */
|
|
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
|
+
}
|
|
14
|
+
|
|
15
|
+
(async () => {
|
|
16
|
+
try {
|
|
17
|
+
const isDev = process.env.CLI_MODE === 'dev';
|
|
18
|
+
const modulePath = isDev
|
|
19
|
+
? '../modules/cli/index.js'
|
|
20
|
+
: '../esm/modules/cli/index.js';
|
|
21
|
+
|
|
22
|
+
const templateModule = await import(modulePath);
|
|
23
|
+
const generateOneSdkFlow = templateModule.default;
|
|
24
|
+
|
|
25
|
+
if (typeof generateOneSdkFlow !== 'function') {
|
|
26
|
+
throw new Error('generateOneSdkFlow is not a function');
|
|
27
|
+
}
|
|
28
|
+
|
|
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
|
+
);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.error('Error loading module:', error);
|
|
42
|
+
}
|
|
43
|
+
})();
|
|
Binary file
|
package/dist/commit.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
f6ab2b2c63ce981817c71c8fe383028f84b52a4a
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../modules/cli/index.js"],"names":[],"mappings":"AAGA;;;;;;WAEC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import createHTML from './template/index.js';
|
|
2
|
+
// @param {string} flowId - the id of the flow to generate, idv / idv_review / manual_kyc
|
|
3
|
+
export default function generateOneSdkFlow({ flowId, env, cid, ccid, apiKey }) {
|
|
4
|
+
return createHTML(flowId)({ env, cid, ccid, apiKey });
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../modules/cli/template/index.js"],"names":[],"mappings":"AAuDA;;;;;aAkBC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { templateIdv } from './templateIdv.js';
|
|
2
|
+
import { templateIdvReview } from './templateIdvReview.js';
|
|
3
|
+
import { templateManualKyc } from './templateManualKyc.js';
|
|
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",
|
|
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
|
+
;
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,UAAU,GAAG;IACjB,GAAG,EAAE,4CAA4C;IACjD,EAAE,EAAE,wCAAwC;IAC5C,GAAG,EAAE,gDAAgD;IACrD,IAAI,EAAE,4CAA4C;CACnD,CAAC;AAEF,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC;AAEtB,MAAM,0BAA0B,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,CAAA;;;;;;;;4BAQzC,GAAG;;iCAEE,IAAI;wBACb,MAAM;;;;;;;;;;;;WAYnB,UAAU,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;MAiBpB,CAAC;AAEP,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,MAAM;IACvC,OAAO,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE;QACzC,MAAM,YAAY,GAAG,0BAA0B,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QAE5E,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,KAAK;gBACR,OAAO,WAAW,CAAC,YAAY,CAAC,CAAC;YAEnC,KAAK,YAAY;gBACf,OAAO,iBAAiB,CAAC,YAAY,CAAC,CAAC;YAEzC,KAAK,YAAY;gBACf,OAAO,iBAAiB,CAAC,YAAY,CAAC,CAAC;YAEzC;gBACE,OAAO,iBAAiB,CAAC;QAC7B,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAAA,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateIdv.d.ts","sourceRoot":"","sources":["../../../../../modules/cli/template/templateIdv.js"],"names":[],"mappings":"AAEO,uDA0GC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
const html = String.raw;
|
|
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">
|
|
7
|
+
<head>
|
|
8
|
+
<!-- UTF-8 encoding ensures proper display of special characters in the UI -->
|
|
9
|
+
<meta charset="utf-8" />
|
|
10
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
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 -->
|
|
15
|
+
<script src="https://assets.frankiefinancial.io/one-sdk/v1/oneSdk.umd.js"></script>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
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: sessionToken,
|
|
27
|
+
mode: 'production',
|
|
28
|
+
recipe: {
|
|
29
|
+
form: {
|
|
30
|
+
provider: {
|
|
31
|
+
name: 'react',
|
|
32
|
+
// UNCOMMENT AND ADD YOUR KEY to use Google Places address autocomplete
|
|
33
|
+
// googleApiKey: "<GOOGLE_API_KEY>",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const oneSdkIndividual = oneSdk.individual();
|
|
40
|
+
oneSdkIndividual.addConsent("general");
|
|
41
|
+
oneSdkIndividual.addConsent("docs");
|
|
42
|
+
oneSdkIndividual.addConsent("creditheader");
|
|
43
|
+
await oneSdkIndividual.submit();
|
|
44
|
+
// Create an IDV (Identity Verification) flow instance
|
|
45
|
+
const idv = oneSdk.flow('idv');
|
|
46
|
+
|
|
47
|
+
const successScreen = oneSdk.component('form', {
|
|
48
|
+
name: 'RESULT',
|
|
49
|
+
mode: 'individual',
|
|
50
|
+
type: 'manual',
|
|
51
|
+
state: 'SUCCESS',
|
|
52
|
+
title: { label: "Thanks, you're all done" },
|
|
53
|
+
cta: null,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const failedScreen = oneSdk.component("form", {
|
|
57
|
+
name: "RESULT",
|
|
58
|
+
mode: "individual",
|
|
59
|
+
state: "FAIL",
|
|
60
|
+
type: "manual",
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Mount the IDV flow to the container element
|
|
64
|
+
idv.mount('#idv-el');
|
|
65
|
+
|
|
66
|
+
// Handle loading states during verification
|
|
67
|
+
idv.on('loading', () => {
|
|
68
|
+
console.log('loading');
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// Handle verification results
|
|
72
|
+
idv.on('results', async ({ checkStatus, document, entityId }) => {
|
|
73
|
+
if (checkStatus) {
|
|
74
|
+
console.log('results succesful');
|
|
75
|
+
successScreen.mount("#idv-el");
|
|
76
|
+
} else {
|
|
77
|
+
console.log('no data returned');
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// Handle errors during verification
|
|
82
|
+
idv.on('error', ({ message, payload }) => {
|
|
83
|
+
console.log('received error');
|
|
84
|
+
console.log(message, payload);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// Handle completion of document detection/capture
|
|
88
|
+
idv.on('detection_complete', (message) => {
|
|
89
|
+
console.log('capture finished');
|
|
90
|
+
console.log(message);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// Log all OneSDK events to console for debugging
|
|
94
|
+
idv.on('*', (message) => {
|
|
95
|
+
console.log(message);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
</script>
|
|
99
|
+
</head>
|
|
100
|
+
|
|
101
|
+
<body style="background-color: white" onload="startOneSdk()">
|
|
102
|
+
<!-- Container element where OneSDK will mount its UI components -->
|
|
103
|
+
<div
|
|
104
|
+
id="idv-el"
|
|
105
|
+
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center;"
|
|
106
|
+
></div>
|
|
107
|
+
</body>
|
|
108
|
+
</html>`;
|
|
109
|
+
//# sourceMappingURL=templateIdv.js.map
|
|
@@ -0,0 +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,CAAC,YAAY,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;MAgB3C,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA0FV,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateIdvReview.d.ts","sourceRoot":"","sources":["../../../../../modules/cli/template/templateIdvReview.js"],"names":[],"mappings":"AAEO,6DA0HC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
const html = String.raw;
|
|
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">
|
|
7
|
+
<head>
|
|
8
|
+
<!-- UTF-8 encoding ensures proper display of special characters in the UI -->
|
|
9
|
+
<meta charset="utf-8" />
|
|
10
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
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 -->
|
|
15
|
+
<script src="https://assets.frankiefinancial.io/one-sdk/v1/oneSdk.umd.js"></script>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
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: sessionToken,
|
|
27
|
+
mode: 'production',
|
|
28
|
+
recipe: {
|
|
29
|
+
form: {
|
|
30
|
+
provider: {
|
|
31
|
+
name: 'react',
|
|
32
|
+
// UNCOMMENT AND ADD YOUR KEY to use Google Places address autocomplete
|
|
33
|
+
// googleApiKey: "<GOOGLE_API_KEY>",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const oneSdkIndividual = oneSdk.individual();
|
|
40
|
+
oneSdkIndividual.addConsent("general");
|
|
41
|
+
oneSdkIndividual.addConsent("docs");
|
|
42
|
+
oneSdkIndividual.addConsent("creditheader");
|
|
43
|
+
await oneSdkIndividual.submit();
|
|
44
|
+
|
|
45
|
+
// Create an IDV flow instance for identity verification
|
|
46
|
+
const idv = oneSdk.flow('idv');
|
|
47
|
+
|
|
48
|
+
// Create review component for OCR (Optical Character Recognition) review
|
|
49
|
+
const review = oneSdk.component('form', {
|
|
50
|
+
name: 'REVIEW',
|
|
51
|
+
type: 'ocr',
|
|
52
|
+
mode: 'individual',
|
|
53
|
+
verify: true
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const successScreen = oneSdk.component('form', {
|
|
57
|
+
name: 'RESULT',
|
|
58
|
+
mode: 'individual',
|
|
59
|
+
type: 'manual',
|
|
60
|
+
state: 'SUCCESS',
|
|
61
|
+
title: { label: "Thanks, you're all done" },
|
|
62
|
+
cta: null,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const failedScreen = oneSdk.component("form", {
|
|
66
|
+
name: "RESULT",
|
|
67
|
+
mode: "individual",
|
|
68
|
+
state: "FAIL",
|
|
69
|
+
type: "manual",
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
review.on('form:review:ready', async () => {
|
|
73
|
+
try {
|
|
74
|
+
// Submit the review form and run verification
|
|
75
|
+
let res = oneSdkIndividual.submit({ verify: true });
|
|
76
|
+
console.log('submit and run verification result: ', res);
|
|
77
|
+
successScreen.mount('#idv-el');
|
|
78
|
+
} catch (error) {
|
|
79
|
+
console.error(error);
|
|
80
|
+
failedScreen.mount('#idv-el');
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Mount the IDV flow to the container element
|
|
85
|
+
idv.mount('#idv-el');
|
|
86
|
+
|
|
87
|
+
// Handle verification results
|
|
88
|
+
idv.on('results', async ({ checkStatus, document, entityId }) => {
|
|
89
|
+
if (checkStatus) {
|
|
90
|
+
console.log('results succesful');
|
|
91
|
+
review.mount('#idv-el');
|
|
92
|
+
} else {
|
|
93
|
+
console.log('no data returned');
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Handle errors during verification
|
|
98
|
+
idv.on('error', ({ message, payload }) => {
|
|
99
|
+
console.log('received error');
|
|
100
|
+
console.log(message, payload);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// Handle completion of document detection/capture
|
|
104
|
+
idv.on('detection_complete', (message) => {
|
|
105
|
+
console.log('capture finished');
|
|
106
|
+
console.log(message);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// Log all events for debugging
|
|
110
|
+
idv.on('*', (message) => {
|
|
111
|
+
console.log(message);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
</script>
|
|
115
|
+
</head>
|
|
116
|
+
|
|
117
|
+
<body style="background-color: white" onload="startOneSdk()">
|
|
118
|
+
<!-- Container element where OneSDK will mount its UI components -->
|
|
119
|
+
<div
|
|
120
|
+
id="idv-el"
|
|
121
|
+
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center;"
|
|
122
|
+
></div>
|
|
123
|
+
</body>
|
|
124
|
+
</html>`;
|
|
125
|
+
//# sourceMappingURL=templateIdvReview.js.map
|
|
@@ -0,0 +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,CAAC,YAAY,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;MAgBjD,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA0GV,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateManualKyc.d.ts","sourceRoot":"","sources":["../../../../../modules/cli/template/templateManualKyc.js"],"names":[],"mappings":"AAEO,6DAoNC"}
|