@frankieone/one-sdk 1.7.14-rc → 1.7.14-rc.10

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 (70) hide show
  1. package/dist/cli/cli.js +130 -0
  2. package/dist/cli/darwin-amd64/onesdk-cli +0 -0
  3. package/dist/cli/darwin-arm64/onesdk-cli +0 -0
  4. package/dist/cli/linux-amd64/onesdk-cli +0 -0
  5. package/dist/cli/linux-arm64/onesdk-cli +0 -0
  6. package/dist/cli/templateGenerator.js +43 -0
  7. package/dist/cli/windows-amd64/onesdk-cli.exe +0 -0
  8. package/dist/commit.txt +1 -1
  9. package/dist/esm/modules/cli/index.d.ts +7 -1
  10. package/dist/esm/modules/cli/index.d.ts.map +1 -1
  11. package/dist/esm/modules/cli/index.js +3 -3
  12. package/dist/esm/modules/cli/index.js.map +1 -1
  13. package/dist/esm/modules/cli/template/index.d.ts +6 -9
  14. package/dist/esm/modules/cli/template/index.d.ts.map +1 -1
  15. package/dist/esm/modules/cli/template/index.js +63 -5
  16. package/dist/esm/modules/cli/template/index.js.map +1 -1
  17. package/dist/esm/modules/cli/template/templateIdv.d.ts +1 -1
  18. package/dist/esm/modules/cli/template/templateIdv.d.ts.map +1 -1
  19. package/dist/esm/modules/cli/template/templateIdv.js +104 -49
  20. package/dist/esm/modules/cli/template/templateIdv.js.map +1 -1
  21. package/dist/esm/modules/cli/template/templateIdvReview.d.ts +1 -1
  22. package/dist/esm/modules/cli/template/templateIdvReview.d.ts.map +1 -1
  23. package/dist/esm/modules/cli/template/templateIdvReview.js +142 -81
  24. package/dist/esm/modules/cli/template/templateIdvReview.js.map +1 -1
  25. package/dist/esm/modules/cli/template/templateManualKyc.d.ts +1 -1
  26. package/dist/esm/modules/cli/template/templateManualKyc.d.ts.map +1 -1
  27. package/dist/esm/modules/cli/template/templateManualKyc.js +194 -153
  28. package/dist/esm/modules/cli/template/templateManualKyc.js.map +1 -1
  29. package/dist/esm/modules/form/vendors/react/appConfig.type.d.ts +1 -0
  30. package/dist/esm/modules/form/vendors/react/appConfig.type.d.ts.map +1 -1
  31. package/dist/esm/modules/form/vendors/react/appConfig.type.js +1 -0
  32. package/dist/esm/modules/form/vendors/react/appConfig.type.js.map +1 -1
  33. package/dist/esm/modules/form/vendors/react/components/view/FrankieCardList/FrankieCardList.d.ts.map +1 -1
  34. package/dist/esm/modules/form/vendors/react/components/view/FrankieCardList/FrankieCardList.js +2 -4
  35. package/dist/esm/modules/form/vendors/react/components/view/FrankieCardList/FrankieCardList.js.map +1 -1
  36. package/dist/esm/modules/form/vendors/react/components/view/FrankieCheckbox/FrankieCheckbox.d.ts.map +1 -1
  37. package/dist/esm/modules/form/vendors/react/components/view/FrankieCheckbox/FrankieCheckbox.js +2 -2
  38. package/dist/esm/modules/form/vendors/react/components/view/FrankieCheckbox/FrankieCheckbox.js.map +1 -1
  39. package/dist/esm/modules/form/vendors/react/components/view/FrankieDescription/FrankieDescription.d.ts.map +1 -1
  40. package/dist/esm/modules/form/vendors/react/components/view/FrankieDescription/FrankieDescription.js +2 -4
  41. package/dist/esm/modules/form/vendors/react/components/view/FrankieDescription/FrankieDescription.js.map +1 -1
  42. package/dist/esm/modules/form/vendors/react/components/view/FrankieInstructionList/FrankieInstructionList.d.ts.map +1 -1
  43. package/dist/esm/modules/form/vendors/react/components/view/FrankieInstructionList/FrankieInstructionList.js +2 -4
  44. package/dist/esm/modules/form/vendors/react/components/view/FrankieInstructionList/FrankieInstructionList.js.map +1 -1
  45. package/dist/esm/modules/form/vendors/react/features/PersonalDetails/personalDetails.config.d.ts.map +1 -1
  46. package/dist/esm/modules/frankie-client/clients/DocumentClient.d.ts +5 -0
  47. package/dist/esm/modules/frankie-client/clients/DocumentClient.d.ts.map +1 -0
  48. package/dist/esm/modules/frankie-client/clients/DocumentClient.js +18 -0
  49. package/dist/esm/modules/frankie-client/clients/DocumentClient.js.map +1 -0
  50. package/dist/esm/modules/frankie-client/clients/F2/DocumentClientF2.d.ts +5 -0
  51. package/dist/esm/modules/frankie-client/clients/F2/DocumentClientF2.d.ts.map +1 -0
  52. package/dist/esm/modules/frankie-client/clients/F2/DocumentClientF2.js +18 -0
  53. package/dist/esm/modules/frankie-client/clients/F2/DocumentClientF2.js.map +1 -0
  54. package/dist/esm/modules/idv/vendors/Sumsub/index.d.ts.map +1 -1
  55. package/dist/esm/modules/idv/vendors/Sumsub/index.js +24 -11
  56. package/dist/esm/modules/idv/vendors/Sumsub/index.js.map +1 -1
  57. package/dist/esm/modules/individual/F2/index.d.ts.map +1 -1
  58. package/dist/esm/modules/individual/F2/index.js +11 -4
  59. package/dist/esm/modules/individual/F2/index.js.map +1 -1
  60. package/dist/esm/modules/individual/actions/documents.d.ts +5 -0
  61. package/dist/esm/modules/individual/actions/documents.d.ts.map +1 -1
  62. package/dist/esm/modules/individual/actions/documents.js +15 -0
  63. package/dist/esm/modules/individual/actions/documents.js.map +1 -1
  64. package/dist/esm/modules/individual/definition.d.ts +2 -0
  65. package/dist/esm/modules/individual/definition.d.ts.map +1 -1
  66. package/dist/esm/modules/individual/index.d.ts.map +1 -1
  67. package/dist/esm/modules/individual/index.js +11 -4
  68. package/dist/esm/modules/individual/index.js.map +1 -1
  69. package/dist/esm/modules/meta.json +1 -1
  70. package/package.json +3 -4
@@ -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
+ })();
package/dist/commit.txt CHANGED
@@ -1 +1 @@
1
- 2d6c164637b115a252230f9e32d5d021928a8146
1
+ e246ea258f04d53db832c140a555fa6a12f2aa20
@@ -1,2 +1,8 @@
1
- export default function generateOneSdkFlow(flowId: any): any;
1
+ export default function generateOneSdkFlow({ flowId, env, cid, ccid, apiKey }: {
2
+ flowId: any;
3
+ env: any;
4
+ cid: any;
5
+ ccid: any;
6
+ apiKey: any;
7
+ }): string;
2
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../modules/cli/index.js"],"names":[],"mappings":"AAGA,6DAEC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../modules/cli/index.js"],"names":[],"mappings":"AAGA;;;;;;WAEC"}
@@ -1,6 +1,6 @@
1
- import templateObjectMap from './template/index.js';
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 templateObjectMap[flowId];
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,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,yFAAyF;AACzF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,MAAM;IAC/C,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC"}
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 templateObjectMap;
2
- declare namespace templateObjectMap {
3
- export { templateIdv as idv };
4
- export { templateIdvReview as idv_review };
5
- export { templateManualKyc as manual_kyc };
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":";;;;;;4BAA4B,kBAAkB;kCACZ,wBAAwB;kCACxB,wBAAwB"}
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 templateObjectMap = {
5
- idv: templateIdv,
6
- idv_review: templateIdvReview,
7
- manual_kyc: templateManualKyc,
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
- export default templateObjectMap;
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,iBAAiB,GAAG;IACxB,GAAG,EAAE,WAAW;IAChB,UAAU,EAAE,iBAAiB;IAC7B,UAAU,EAAE,iBAAiB;CAC9B,CAAC;AACF,eAAe,iBAAiB,CAAC"}
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"}
@@ -1,2 +1,2 @@
1
- export const templateIdv: string;
1
+ export function templateIdv(getTokenImpl: any): string;
2
2
  //# sourceMappingURL=templateIdv.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"templateIdv.d.ts","sourceRoot":"","sources":["../../../../../modules/cli/template/templateIdv.js"],"names":[],"mappings":"AAEA,iCA8DS"}
1
+ {"version":3,"file":"templateIdv.d.ts","sourceRoot":"","sources":["../../../../../modules/cli/template/templateIdv.js"],"names":[],"mappings":"AAEO,uDAqHC"}
@@ -1,65 +1,120 @@
1
1
  const html = String.raw;
2
- export const templateIdv = html `<html lang="en">
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 you page is important as some text in the smart UI might not come out as you expect -->
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>oneSdk onboarding</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
- async function startOneSdk() {
12
- const oneSdk = await OneSdk({
13
- session: {
14
- token: GENERATED_TOKEN,
15
- },
16
- mode: 'production',
17
- recipe: {
18
- form: {
19
- provider: {
20
- name: 'react',
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: 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>",
22
34
  },
23
35
  },
24
- });
25
-
26
- const idv = oneSdk.flow('idv');
27
-
28
- idv.mount('#idv-el');
29
- idv.on('loading', () => {
30
- console.log('loading');
31
- });
32
-
33
- idv.on('results', async ({ checkStatus, document, entityId }) => {
34
- if (checkStatus) {
35
- console.log('results succesful');
36
- } else {
37
- console.log('no data returned');
38
- }
39
- });
40
-
41
- idv.on('error', ({ message, payload }) => {
42
- console.log('received error');
43
- console.log(message, payload);
44
- });
45
-
46
- idv.on('detection_complete', (message) => {
47
- console.log('capture finished');
48
- console.log(message);
49
- });
50
-
51
- idv.on('*', (message) => {
52
- console.log(message);
53
- });
54
- }
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
+ review.on('form:review:ready', async () => {
64
+ try {
65
+ // Submit the review form and run verification
66
+ let res = oneSdkIndividual.submit({ verify: true });
67
+ console.log('submit and run verification result: ', res);
68
+ successScreen.mount('#idv-el');
69
+ } catch (error) {
70
+ console.error(error);
71
+ failedScreen.mount('#idv-el');
72
+ }
73
+ });
74
+
75
+ // Mount the IDV flow to the container element
76
+ idv.mount('#idv-el');
77
+
78
+ // Handle loading states during verification
79
+ idv.on('loading', () => {
80
+ console.log('loading');
81
+ });
82
+
83
+ // Handle verification results
84
+ idv.on('results', async ({ checkStatus, document, entityId }) => {
85
+ if (checkStatus) {
86
+ console.log('results succesful');
87
+ } else {
88
+ console.log('no data returned');
89
+ }
90
+ });
91
+
92
+ // Handle errors during verification
93
+ idv.on('error', ({ message, payload }) => {
94
+ console.log('received error');
95
+ console.log(message, payload);
96
+ });
97
+
98
+ // Handle completion of document detection/capture
99
+ idv.on('detection_complete', (message) => {
100
+ console.log('capture finished');
101
+ console.log(message);
102
+ });
103
+
104
+ // Log all OneSDK events to console for debugging
105
+ idv.on('*', (message) => {
106
+ console.log(message);
107
+ });
108
+ }
55
109
  </script>
56
110
  </head>
57
111
 
58
112
  <body style="background-color: white" onload="startOneSdk()">
59
- <div
60
- id="idv-el"
61
- style="top: 0; left: 0; width: 100%; height: 100%; display: block"
62
- ></div>
113
+ <!-- Container element where OneSDK will mount its UI components -->
114
+ <div
115
+ id="idv-el"
116
+ style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center;"
117
+ ></div>
63
118
  </body>
64
119
  </html>`;
65
120
  //# sourceMappingURL=templateIdv.js.map
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA8DvB,CAAC"}
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAqGV,CAAC"}
@@ -1,2 +1,2 @@
1
- export const templateIdvReview: string;
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":"AAEA,uCAgGS"}
1
+ {"version":3,"file":"templateIdvReview.d.ts","sourceRoot":"","sources":["../../../../../modules/cli/template/templateIdvReview.js"],"names":[],"mappings":"AAEO,6DA6JC"}