@privateid/ultrapass-web-sdk 1.2.0 → 1.3.1-1300478

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 (237) hide show
  1. package/README.md +75 -75
  2. package/dist/apiUtils.d.ts +46 -46
  3. package/dist/apiUtils.js +922 -921
  4. package/dist/apiUtils.js.map +1 -1
  5. package/dist/application/index.d.ts +7 -7
  6. package/dist/application/index.js +27 -25
  7. package/dist/application/index.js.map +1 -1
  8. package/dist/application/modules/core/document/DocumentService.d.ts +22 -22
  9. package/dist/application/modules/core/document/DocumentService.js +254 -254
  10. package/dist/application/modules/core/document/document.constants.d.ts +15 -15
  11. package/dist/application/modules/core/document/document.constants.js +21 -21
  12. package/dist/application/modules/core/document/document.domain.d.ts +7 -7
  13. package/dist/application/modules/core/document/document.domain.js +1 -1
  14. package/dist/application/modules/core/document/document.types.d.ts +17 -17
  15. package/dist/application/modules/core/document/document.types.js +1 -1
  16. package/dist/application/modules/core/document/document.utils.d.ts +3 -3
  17. package/dist/application/modules/core/document/document.utils.js +58 -58
  18. package/dist/application/modules/core/document/index.d.ts +3 -3
  19. package/dist/application/modules/core/document/index.js +1 -1
  20. package/dist/application/modules/core/face/FaceService.d.ts +33 -33
  21. package/dist/application/modules/core/face/FaceService.js +228 -221
  22. package/dist/application/modules/core/face/FaceService.js.map +1 -1
  23. package/dist/application/modules/core/face/face.constants.d.ts +53 -53
  24. package/dist/application/modules/core/face/face.constants.js +53 -53
  25. package/dist/application/modules/core/face/face.domain.d.ts +10 -10
  26. package/dist/application/modules/core/face/face.domain.js +1 -1
  27. package/dist/application/modules/core/face/face.types.d.ts +41 -38
  28. package/dist/application/modules/core/face/face.types.js +1 -1
  29. package/dist/application/modules/core/face/face.utils.d.ts +15 -15
  30. package/dist/application/modules/core/face/face.utils.js +101 -101
  31. package/dist/application/modules/core/face/index.d.ts +3 -3
  32. package/dist/application/modules/core/face/index.js +1 -1
  33. package/dist/application/modules/global/shared.constants.d.ts +2 -2
  34. package/dist/application/modules/global/shared.constants.js +2 -2
  35. package/dist/application/modules/global/shared.utils.d.ts +25 -25
  36. package/dist/application/modules/global/shared.utils.js +100 -100
  37. package/dist/application/modules/global/shared.utils.js.map +1 -1
  38. package/dist/application/modules/internal/feature-flag/LDFeatureFlagService.d.ts +9 -0
  39. package/dist/application/modules/internal/feature-flag/LDFeatureFlagService.js +32 -0
  40. package/dist/application/modules/internal/feature-flag/LDFeatureFlagService.js.map +1 -0
  41. package/dist/application/modules/internal/feature-flag/feature-flag-init.d.ts +11 -0
  42. package/dist/application/modules/internal/feature-flag/feature-flag-init.js +24 -0
  43. package/dist/application/modules/internal/feature-flag/feature-flag-init.js.map +1 -0
  44. package/dist/application/modules/internal/feature-flag/feature-flag.domain.d.ts +10 -0
  45. package/dist/application/modules/internal/feature-flag/feature-flag.domain.js +7 -0
  46. package/dist/application/modules/internal/feature-flag/feature-flag.domain.js.map +1 -0
  47. package/dist/application/modules/internal/feature-flag/featureFlagInit.d.ts +11 -0
  48. package/dist/application/modules/internal/feature-flag/featureFlagInit.js +44 -0
  49. package/dist/application/modules/internal/feature-flag/featureFlagInit.js.map +1 -0
  50. package/dist/application/modules/internal/feature-flag/index.d.ts +2 -0
  51. package/dist/application/modules/internal/feature-flag/index.js +3 -0
  52. package/dist/application/modules/internal/feature-flag/index.js.map +1 -0
  53. package/dist/application/modules/internal/shared/index.d.ts +2 -0
  54. package/dist/application/modules/internal/shared/index.js +3 -0
  55. package/dist/application/modules/internal/shared/index.js.map +1 -0
  56. package/dist/application/modules/internal/shared/shared.constants.d.ts +2 -0
  57. package/dist/application/modules/internal/shared/shared.constants.js +3 -0
  58. package/dist/application/modules/internal/shared/shared.constants.js.map +1 -0
  59. package/dist/application/modules/internal/shared/shared.utils.d.ts +44 -0
  60. package/dist/application/modules/internal/shared/shared.utils.js +204 -0
  61. package/dist/application/modules/internal/shared/shared.utils.js.map +1 -0
  62. package/dist/application/modules/internal/wasm-orchestrator/WasmOrchestratorService.d.ts +28 -0
  63. package/dist/application/modules/internal/wasm-orchestrator/WasmOrchestratorService.js +380 -0
  64. package/dist/application/modules/internal/wasm-orchestrator/WasmOrchestratorService.js.map +1 -0
  65. package/dist/application/modules/internal/wasm-orchestrator/index.d.ts +6 -0
  66. package/dist/application/modules/internal/wasm-orchestrator/index.js +9 -0
  67. package/dist/application/modules/internal/wasm-orchestrator/index.js.map +1 -0
  68. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.constants.d.ts +28 -0
  69. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.constants.js +35 -0
  70. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.constants.js.map +1 -0
  71. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.domain.d.ts +51 -0
  72. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.domain.js +2 -0
  73. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.domain.js.map +1 -0
  74. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.types.d.ts +142 -0
  75. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.types.js +2 -0
  76. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.types.js.map +1 -0
  77. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.utils.d.ts +86 -0
  78. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.utils.js +201 -0
  79. package/dist/application/modules/internal/wasm-orchestrator/wasm-orchestrator.utils.js.map +1 -0
  80. package/dist/application/modules/support/camera/CameraServiceFactory.d.ts +10 -8
  81. package/dist/application/modules/support/camera/CameraServiceFactory.js +33 -32
  82. package/dist/application/modules/support/camera/CameraServiceFactory.js.map +1 -1
  83. package/dist/application/modules/support/camera/camera.constants.d.ts +9 -9
  84. package/dist/application/modules/support/camera/camera.constants.js +48 -48
  85. package/dist/application/modules/support/camera/camera.domain.d.ts +15 -15
  86. package/dist/application/modules/support/camera/camera.domain.js +1 -1
  87. package/dist/application/modules/support/camera/camera.types.d.ts +42 -42
  88. package/dist/application/modules/support/camera/camera.types.js +10 -10
  89. package/dist/application/modules/support/camera/camera.utils.d.ts +157 -157
  90. package/dist/application/modules/support/camera/camera.utils.js +623 -637
  91. package/dist/application/modules/support/camera/camera.utils.js.map +1 -1
  92. package/dist/application/modules/support/camera/index.d.ts +24 -25
  93. package/dist/application/modules/support/camera/index.js +27 -29
  94. package/dist/application/modules/support/camera/index.js.map +1 -1
  95. package/dist/application/modules/support/camera/services/BaseCameraService.d.ts +41 -37
  96. package/dist/application/modules/support/camera/services/BaseCameraService.js +278 -277
  97. package/dist/application/modules/support/camera/services/BaseCameraService.js.map +1 -1
  98. package/dist/application/modules/support/camera/services/DesktopCameraService.d.ts +5 -5
  99. package/dist/application/modules/support/camera/services/DesktopCameraService.js +46 -45
  100. package/dist/application/modules/support/camera/services/DesktopCameraService.js.map +1 -1
  101. package/dist/application/modules/support/camera/services/FirefoxCameraService.d.ts +5 -5
  102. package/dist/application/modules/support/camera/services/FirefoxCameraService.js +46 -45
  103. package/dist/application/modules/support/camera/services/FirefoxCameraService.js.map +1 -1
  104. package/dist/application/modules/support/camera/services/MacSafariCameraService.d.ts +5 -5
  105. package/dist/application/modules/support/camera/services/MacSafariCameraService.js +47 -46
  106. package/dist/application/modules/support/camera/services/MacSafariCameraService.js.map +1 -1
  107. package/dist/application/modules/support/camera/services/MobileCameraService.d.ts +5 -5
  108. package/dist/application/modules/support/camera/services/MobileCameraService.js +133 -129
  109. package/dist/application/modules/support/camera/services/MobileCameraService.js.map +1 -1
  110. package/dist/application/modules/support/engine/EngineService.d.ts +15 -0
  111. package/dist/application/modules/support/engine/EngineService.js +106 -0
  112. package/dist/application/modules/support/engine/EngineService.js.map +1 -0
  113. package/dist/application/modules/support/engine/engine.constants.d.ts +33 -0
  114. package/dist/application/modules/support/engine/engine.constants.js +35 -0
  115. package/dist/application/modules/support/engine/engine.constants.js.map +1 -0
  116. package/dist/application/modules/support/engine/engine.domain.d.ts +23 -0
  117. package/dist/application/modules/support/engine/engine.domain.js +2 -0
  118. package/dist/application/modules/support/engine/engine.domain.js.map +1 -0
  119. package/dist/application/modules/support/engine/engine.types.d.ts +32 -0
  120. package/dist/application/modules/support/engine/engine.types.js +2 -0
  121. package/dist/application/modules/support/engine/engine.types.js.map +1 -0
  122. package/dist/application/modules/support/engine/engine.utils.d.ts +65 -0
  123. package/dist/application/modules/support/engine/engine.utils.js +135 -0
  124. package/dist/application/modules/support/engine/engine.utils.js.map +1 -0
  125. package/dist/application/modules/support/engine/index.d.ts +3 -0
  126. package/dist/application/modules/support/engine/index.js +2 -0
  127. package/dist/application/modules/support/engine/index.js.map +1 -0
  128. package/dist/application/modules/support/permissions/PermissionsService.d.ts +55 -0
  129. package/dist/application/modules/support/permissions/PermissionsService.js +184 -0
  130. package/dist/application/modules/support/permissions/PermissionsService.js.map +1 -0
  131. package/dist/application/modules/support/permissions/index.d.ts +4 -0
  132. package/dist/application/modules/support/permissions/index.js +3 -0
  133. package/dist/application/modules/support/permissions/index.js.map +1 -0
  134. package/dist/application/modules/support/permissions/permission.utils.d.ts +6 -0
  135. package/dist/application/modules/support/permissions/permission.utils.js +34 -0
  136. package/dist/application/modules/support/permissions/permission.utils.js.map +1 -0
  137. package/dist/application/modules/support/permissions/permissions.domain.d.ts +6 -0
  138. package/dist/application/modules/support/permissions/permissions.domain.js +2 -0
  139. package/dist/application/modules/support/permissions/permissions.domain.js.map +1 -0
  140. package/dist/application/modules/support/permissions/permissions.types.d.ts +9 -0
  141. package/dist/application/modules/support/permissions/permissions.types.js +2 -0
  142. package/dist/application/modules/support/permissions/permissions.types.js.map +1 -0
  143. package/dist/application/modules/support/wasm/WasmService.d.ts +25 -25
  144. package/dist/application/modules/support/wasm/WasmService.js +156 -155
  145. package/dist/application/modules/support/wasm/WasmService.js.map +1 -1
  146. package/dist/application/modules/support/wasm/index.d.ts +6 -6
  147. package/dist/application/modules/support/wasm/index.js +8 -8
  148. package/dist/application/modules/support/wasm/wasm.constants.d.ts +78 -78
  149. package/dist/application/modules/support/wasm/wasm.constants.js +86 -86
  150. package/dist/application/modules/support/wasm/wasm.domain.d.ts +52 -52
  151. package/dist/application/modules/support/wasm/wasm.domain.js +1 -1
  152. package/dist/application/modules/support/wasm/wasm.types.d.ts +119 -118
  153. package/dist/application/modules/support/wasm/wasm.types.js +1 -1
  154. package/dist/application/modules/support/wasm/wasm.utils.d.ts +88 -88
  155. package/dist/application/modules/support/wasm/wasm.utils.js +243 -243
  156. package/dist/application/modules/support/wasm-orchestrator/WasmOrchestratorService.d.ts +28 -0
  157. package/dist/application/modules/support/wasm-orchestrator/WasmOrchestratorService.js +324 -0
  158. package/dist/application/modules/support/wasm-orchestrator/WasmOrchestratorService.js.map +1 -0
  159. package/dist/application/modules/support/wasm-orchestrator/index.d.ts +6 -0
  160. package/dist/application/modules/support/wasm-orchestrator/index.js +9 -0
  161. package/dist/application/modules/support/wasm-orchestrator/index.js.map +1 -0
  162. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.constants.d.ts +36 -0
  163. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.constants.js +44 -0
  164. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.constants.js.map +1 -0
  165. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.domain.d.ts +47 -0
  166. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.domain.js +2 -0
  167. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.domain.js.map +1 -0
  168. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.types.d.ts +136 -0
  169. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.types.js +2 -0
  170. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.types.js.map +1 -0
  171. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.utils.d.ts +91 -0
  172. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.utils.js +250 -0
  173. package/dist/application/modules/support/wasm-orchestrator/wasm-orchestrator.utils.js.map +1 -0
  174. package/dist/application/workers/index.d.ts +42 -42
  175. package/dist/application/workers/index.js +8 -8
  176. package/dist/application/workers/wasm/WasmWorkerService.d.ts +66 -0
  177. package/dist/application/workers/wasm/WasmWorkerService.js +801 -0
  178. package/dist/application/workers/wasm/WasmWorkerService.js.map +1 -0
  179. package/dist/application/workers/wasm/index.d.ts +4 -0
  180. package/dist/application/workers/wasm/index.js +9 -0
  181. package/dist/application/workers/wasm/index.js.map +1 -0
  182. package/dist/application/workers/wasm/wasm-worker.constants.d.ts +5 -0
  183. package/dist/application/workers/wasm/wasm-worker.constants.js +6 -0
  184. package/dist/application/workers/wasm/wasm-worker.constants.js.map +1 -0
  185. package/dist/application/workers/wasm/wasm-worker.domain.d.ts +99 -0
  186. package/dist/application/workers/wasm/wasm-worker.domain.js +2 -0
  187. package/dist/application/workers/wasm/wasm-worker.domain.js.map +1 -0
  188. package/dist/application/workers/wasm/wasm-worker.types.d.ts +88 -0
  189. package/dist/application/workers/wasm/wasm-worker.types.js +2 -0
  190. package/dist/application/workers/wasm/wasm-worker.types.js.map +1 -0
  191. package/dist/application/workers/wasm/wasm-worker.utils.d.ts +10 -0
  192. package/dist/application/workers/wasm/wasm-worker.utils.js +130 -0
  193. package/dist/application/workers/wasm/wasm-worker.utils.js.map +1 -0
  194. package/dist/buildConfig.d.ts +3 -0
  195. package/dist/buildConfig.js +7 -0
  196. package/dist/buildConfig.js.map +1 -0
  197. package/dist/cameraUtils.d.ts +77 -77
  198. package/dist/cameraUtils.js +361 -360
  199. package/dist/cameraUtils.js.map +1 -1
  200. package/dist/constants.d.ts +9 -9
  201. package/dist/constants.js +13 -12
  202. package/dist/constants.js.map +1 -1
  203. package/dist/createCallback.d.ts +56 -56
  204. package/dist/createCallback.js +332 -330
  205. package/dist/createCallback.js.map +1 -1
  206. package/dist/dbUtils.d.ts +14 -14
  207. package/dist/dbUtils.js +148 -147
  208. package/dist/dbUtils.js.map +1 -1
  209. package/dist/envUtils.d.ts +4 -4
  210. package/dist/envUtils.js +16 -15
  211. package/dist/envUtils.js.map +1 -1
  212. package/dist/faceModule.d.ts +196 -196
  213. package/dist/faceModule.js +978 -981
  214. package/dist/faceModule.js.map +1 -1
  215. package/dist/featureFlagInit.d.ts +11 -0
  216. package/dist/featureFlagInit.js +44 -0
  217. package/dist/featureFlagInit.js.map +1 -0
  218. package/dist/index.d.ts +38 -38
  219. package/dist/index.js +82 -82
  220. package/dist/main.d.ts +30 -13
  221. package/dist/main.js +84 -51
  222. package/dist/main.js.map +1 -1
  223. package/dist/types.d.ts +139 -139
  224. package/dist/types.js +77 -77
  225. package/dist/utils.d.ts +84 -84
  226. package/dist/utils.js +580 -579
  227. package/dist/utils.js.map +1 -1
  228. package/package.json +102 -102
  229. package/wasm/ultra/nosimd/{25.11.13-1357710 → 26.01.08-1300478}/privid_fhe_uber.js +18 -18
  230. package/wasm/ultra/nosimd/{25.11.13-1357710 → 26.01.08-1300478}/privid_fhe_uber.wasm +0 -0
  231. package/wasm/ultra/nosimd/version.json +2 -2
  232. package/wasm/ultra/simd/{25.11.13-1357710 → 26.01.08-1300478}/privid_fhe_uber.js +18 -18
  233. package/wasm/ultra/simd/{25.11.13-1357710 → 26.01.08-1300478}/privid_fhe_uber.wasm +0 -0
  234. package/wasm/ultra/simd/version.json +2 -2
  235. package/workers/comlink.min.js +7 -7
  236. package/workers/comlink.min.js.map +1 -1
  237. package/workers/wasm.worker.js +936 -924
package/dist/apiUtils.js CHANGED
@@ -1,922 +1,923 @@
1
- // import { Base64, DLType, HCType, LOGTYPE, VerifyType } from './types';
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- import { convertPngBase64ToJpegBase64 } from './utils';
12
- // const rand = () => Math.random().toString(36).substr(2);
13
- // export const postImages = (image: Base64) =>
14
- // fetch(`${apiUrl}/upload-img`, {
15
- // method: 'POST',
16
- // headers: {
17
- // Accept: 'application/json',
18
- // 'Content-Type': 'application/json',
19
- // },
20
- // body: JSON.stringify({ image }),
21
- // });
22
- // /**
23
- // * @category Api
24
- // * @param pramUuid UUID to delete
25
- // * @param callback Callback called once the delete is completed
26
- // */
27
- // export async function deleteUuid(guid: string, callback: () => void) {
28
- // const myHeaders = new Headers();
29
- // myHeaders.append('Accept', 'application/json, text/plain, */*');
30
- // myHeaders.append('Accept-Encoding', 'gzip, deflate, br');
31
- // myHeaders.append('x-api-key', apiKey);
32
- // const formdata = new FormData();
33
- // formdata.append('guid', guid);
34
- // formdata.append('api_key', apiKey);
35
- // const requestOptions: RequestInit = {
36
- // method: 'POST',
37
- // headers: myHeaders,
38
- // body: formdata,
39
- // mode: 'no-cors',
40
- // };
41
- // try {
42
- // await fetch(`${apiUrl}/deleteUser`, requestOptions);
43
- // callback();
44
- // } catch (e) {
45
- // printLogs('', e, getDebugType(), LOGTYPE.ERROR);
46
- // }
47
- // }
48
- // export async function getPhrases(): Promise<Array<string>> {
49
- // const requestOptions: RequestInit = {
50
- // method: 'POST',
51
- // };
52
- // const res = await fetch(`${apiUrl}/getLivenessPhrases`, requestOptions);
53
- // return res.json();
54
- // }
55
- // export async function sendOTP(phone_number: string): Promise<string> {
56
- // if (!phone_number) return '';
57
- // const token = rand() + rand();
58
- // const requestOptions: RequestInit = {
59
- // method: 'POST',
60
- // body: JSON.stringify({
61
- // phone_number,
62
- // token,
63
- // api_key: apiKey,
64
- // hostURL: window.location.href,
65
- // customerName: 'betmgm',
66
- // }),
67
- // };
68
- // const res = await fetch(`${apiUrl}/sendOTP`, requestOptions);
69
- // return res.json();
70
- // }
71
- // export async function verifyOTP(otp: string, token: string): Promise<string> {
72
- // const requestOptions: RequestInit = {
73
- // method: 'POST',
74
- // body: JSON.stringify({
75
- // token,
76
- // otp,
77
- // }),
78
- // };
79
- // const res = await fetch(`${apiUrl}/verifyOTP`, requestOptions);
80
- // return res.json();
81
- // }
82
- // type createUserProps = {
83
- // id?: string;
84
- // guid?: string;
85
- // phone?: string;
86
- // phoneVerified?: boolean;
87
- // email?: string;
88
- // emailVerified?: boolean;
89
- // ssn4?: string;
90
- // ssn9?: string;
91
- // userConsent: boolean;
92
- // userConsentDate: string;
93
- // userFaceEnrollConsent?: boolean;
94
- // consentVersion?: string;
95
- // consentContent?: string;
96
- // portrait?: string;
97
- // };
98
- // export async function createUser(payload: createUserProps): Promise<string> {
99
- // const userInfo = {
100
- // token: payload.id,
101
- // phone: payload.phone,
102
- // phoneVerified: payload.phoneVerified,
103
- // email: payload.email,
104
- // emailVerified: payload.emailVerified,
105
- // ssn: payload.ssn4,
106
- // ssn4: payload.ssn4,
107
- // ssn9: payload.ssn9,
108
- // userConsent: payload.userConsent,
109
- // userConsentDate: payload.userConsentDate,
110
- // userFaceEnrollConsent: payload.userFaceEnrollConsent,
111
- // consentVersion: payload.consentVersion,
112
- // consentContent: payload.consentContent,
113
- // };
114
- // const requestOptions: RequestInit = {
115
- // method: 'POST',
116
- // body: JSON.stringify(userInfo),
117
- // headers: {
118
- // 'x-api-key': apiKey,
119
- // 'Content-Type': 'application/json',
120
- // },
121
- // };
122
- // const res = await fetch(`${apiUrl}/user/create`, requestOptions);
123
- // return res.json();
124
- // }
125
- // export async function sendEmail(email: string, uuid: string, skin: string, customerName: string): Promise<string> {
126
- // const token = rand() + rand();
127
- // const requestOptions: RequestInit = {
128
- // method: 'POST',
129
- // body: JSON.stringify({
130
- // skin,
131
- // customerName,
132
- // alias: uuid,
133
- // hostUrl: window.location.href,
134
- // version: '1.0',
135
- // api_key: apiKey,
136
- // email_address: email,
137
- // token,
138
- // action: 'exact_url',
139
- // }),
140
- // headers: {
141
- // 'Content-Type': 'application/json',
142
- // 'x-api-key': apiKey,
143
- // },
144
- // };
145
- // const res = await fetch(`${apiUrl}/requestAuthLink`, requestOptions);
146
- // return res.json();
147
- // }
148
- // export async function expandUri(shortUrl: string): Promise<string> {
149
- // const requestOptions: RequestInit = {
150
- // method: 'POST',
151
- // body: JSON.stringify({
152
- // shortUrl,
153
- // api_key: apiKey,
154
- // }),
155
- // headers: {
156
- // 'Content-Type': 'application/json',
157
- // 'x-api-key': apiKey,
158
- // },
159
- // };
160
- // const res = await fetch(`${apiUrl}/expandUri`, requestOptions);
161
- // return res.json();
162
- // }
163
- // type VerifyTokenProps = {
164
- // code: string;
165
- // type: VerifyType;
166
- // };
167
- // export async function verifyToken({ code, type }: VerifyTokenProps): Promise<string> {
168
- // const requestOptions: RequestInit = {
169
- // method: 'POST',
170
- // body: JSON.stringify({ code, type }),
171
- // headers: {
172
- // 'Content-Type': 'application/json',
173
- // 'x-api-key': apiKey,
174
- // },
175
- // };
176
- // const res = await fetch(`${apiUrl}/user/verif_code`, requestOptions);
177
- // return res.json();
178
- // }
179
- // export async function sendSmsCode({ id, phone }: { id: string; phone: string }): Promise<string> {
180
- // const requestOptions: RequestInit = {
181
- // method: 'POST',
182
- // body: JSON.stringify({ token: id, phone }),
183
- // headers: {
184
- // 'Content-Type': 'application/json',
185
- // 'x-api-key': apiKey,
186
- // },
187
- // };
188
- // const res = await fetch(`${apiUrl}/user/send_code`, requestOptions);
189
- // return res.json();
190
- // }
191
- // export async function sendEnrollSms({ id }: { id: string }): Promise<string> {
192
- // const requestOptions: RequestInit = {
193
- // method: 'POST',
194
- // body: JSON.stringify({ token: id }),
195
- // headers: {
196
- // 'Content-Type': 'application/json',
197
- // 'x-api-key': apiKey,
198
- // },
199
- // };
200
- // const res = await fetch(`${apiUrl}/user/send_redirectSms`, requestOptions);
201
- // return res.json();
202
- // }
203
- // export async function sendMessage({
204
- // id,
205
- // type,
206
- // endpoint,
207
- // message,
208
- // email,
209
- // subject,
210
- // phone,
211
- // }: {
212
- // id: string;
213
- // type: 'email' | 'phone';
214
- // endpoint: string;
215
- // message: string;
216
- // email?: string;
217
- // subject?: string;
218
- // phone?: string;
219
- // }): Promise<string> {
220
- // const requestOptions: RequestInit = {
221
- // method: 'POST',
222
- // body: JSON.stringify({ token: id, type, email, subject, phone, endpoint, message }),
223
- // headers: {
224
- // 'Content-Type': 'application/json',
225
- // 'x-api-key': apiKey,
226
- // },
227
- // };
228
- // const res = await fetch(`${apiUrl}/user/sendMessage`, requestOptions);
229
- // return res.json();
230
- // }
231
- // export async function uploadPortrait({ id, portrait }: { id: string; portrait: string }): Promise<string> {
232
- // const requestOptions: RequestInit = {
233
- // method: 'POST',
234
- // body: JSON.stringify({ token: id, portrait }),
235
- // headers: {
236
- // 'Content-Type': 'application/json',
237
- // 'x-api-key': apiKey,
238
- // },
239
- // };
240
- // const res = await fetch(`${apiUrl}/user/upload/portrait`, requestOptions);
241
- // return res.json();
242
- // }
243
- // type UploadDlProps = {
244
- // id: string;
245
- // type: DLType;
246
- // image?: string;
247
- // barcode?: string;
248
- // process_ocr?: boolean;
249
- // };
250
- // export async function uploadDL({ id, type, image, barcode, process_ocr }: UploadDlProps): Promise<string> {
251
- // let payload;
252
- // if (type === DLType.BARCODEJSON) {
253
- // payload = {
254
- // token: id,
255
- // type,
256
- // barcode,
257
- // };
258
- // } else {
259
- // payload = {
260
- // token: id,
261
- // type,
262
- // image,
263
- // process_ocr,
264
- // };
265
- // }
266
- // if (type === DLType.BARCODEJSON && !barcode) throw new Error("Barcode data is required for 'barcodeJson' type.");
267
- // else if (type !== DLType.BARCODEJSON && !image) throw new Error('Image is required.');
268
- // const requestOptions: RequestInit = {
269
- // method: 'POST',
270
- // body: JSON.stringify(payload),
271
- // headers: {
272
- // 'Content-Type': 'application/json',
273
- // 'x-api-key': apiKey,
274
- // },
275
- // };
276
- // const res = await fetch(`${apiUrl}/user/upload/dl`, requestOptions);
277
- // return res.json();
278
- // }
279
- // type UploadHcProps = {
280
- // id: string;
281
- // type: HCType;
282
- // image?: string;
283
- // processOcr?: boolean;
284
- // };
285
- // export async function uploadHC({ id, type, image, processOcr }: UploadHcProps): Promise<string> {
286
- // const payload = {
287
- // token: id,
288
- // type,
289
- // image,
290
- // process_ocr: processOcr,
291
- // };
292
- // const requestOptions: RequestInit = {
293
- // method: 'POST',
294
- // body: JSON.stringify(payload),
295
- // headers: {
296
- // 'Content-Type': 'application/json',
297
- // 'x-api-key': apiKey,
298
- // },
299
- // };
300
- // const res = await fetch(`${apiUrl}/user/upload/hc`, requestOptions);
301
- // return res.json();
302
- // }
303
- // export async function getUserStatus({ id }: { id: string }): Promise<{
304
- // complianceReview: boolean;
305
- // expiredDate: string;
306
- // expiredID: boolean;
307
- // manualPIIEntry: boolean;
308
- // orchestrationStatus: string;
309
- // requestResAddress: boolean;
310
- // requestSSN4: boolean;
311
- // requestSSN9: boolean;
312
- // requestScanID: boolean;
313
- // toBeEncrypted: boolean;
314
- // underAge: boolean;
315
- // userApproved: boolean;
316
- // userBiometric: string;
317
- // userRegistered: boolean;
318
- // userScanId: boolean;
319
- // }> {
320
- // const payload = { token: id };
321
- // const requestOptions: RequestInit = {
322
- // method: 'POST',
323
- // body: JSON.stringify(payload),
324
- // headers: {
325
- // 'Content-Type': 'application/json',
326
- // 'x-api-key': apiKey,
327
- // },
328
- // };
329
- // const res = await fetch(`${apiUrl}/user/status`, requestOptions);
330
- // return res.json();
331
- // }
332
- // type Attributes = {
333
- // uuid?: string;
334
- // guid?: string;
335
- // ssn?: string;
336
- // ssn4?: string;
337
- // govId?: {
338
- // firstName?: string;
339
- // lastName?: string;
340
- // portraitConfScore?: number;
341
- // address?: {
342
- // addressLine1?: string;
343
- // addressLine2?: string;
344
- // city?: string;
345
- // state?: string;
346
- // zipCode?: string;
347
- // country?: string;
348
- // };
349
- // idDocumentNumber?: string;
350
- // };
351
- // preferred?: {
352
- // firstName?: string;
353
- // lastName?: string;
354
- // dob?: string;
355
- // address?: {
356
- // addressLine1?: string;
357
- // addressLine2?: string;
358
- // city?: string;
359
- // state?: string;
360
- // zipCode?: string;
361
- // country?: string;
362
- // };
363
- // idDocumentNumber?: string;
364
- // };
365
- // };
366
- // export async function updateUser({ id, attributes }: { id: string; attributes: Attributes }): Promise<string> {
367
- // const payload = { token: id, attributes };
368
- // const requestOptions: RequestInit = {
369
- // method: 'POST',
370
- // body: JSON.stringify(payload),
371
- // headers: {
372
- // 'Content-Type': 'application/json',
373
- // 'x-api-key': apiKey,
374
- // },
375
- // };
376
- // const res = await fetch(`${apiUrl}/user/update`, requestOptions);
377
- // return res.json();
378
- // }
379
- // export async function verifyUser({
380
- // id,
381
- // apiValue,
382
- // organizationApiKey,
383
- // }: {
384
- // id: string;
385
- // apiValue: string;
386
- // organizationApiKey: string;
387
- // }): Promise<any> {
388
- // const payload = { token: id };
389
- // const requestOptions: RequestInit = {
390
- // method: 'POST',
391
- // body: JSON.stringify(payload),
392
- // headers: {
393
- // 'Content-Type': 'application/json',
394
- // x_api_key: organizationApiKey,
395
- // },
396
- // };
397
- // const res = await fetch(`${orchestrationAPIUrl}/verify/${apiValue}`, requestOptions);
398
- // return res.json();
399
- // }
400
- // export async function getProductGroups(): Promise<any> {
401
- // const requestOptions: RequestInit = {
402
- // method: 'GET',
403
- // headers: {
404
- // 'Content-Type': 'application/json',
405
- // 'x-api-key': apiKey,
406
- // },
407
- // };
408
- // const res = await fetch(`${orchestrationAPIUrl}/product-group/list/prod`, requestOptions);
409
- // return res.json();
410
- // }
411
- // export async function transmit({
412
- // id,
413
- // url,
414
- // sessionToken,
415
- // final,
416
- // apiToken,
417
- // }: {
418
- // id: string;
419
- // url: string;
420
- // sessionToken: string;
421
- // apiToken?: string;
422
- // final: boolean;
423
- // }) {
424
- // const payload = { token: id, url, sessionToken, apiToken, final };
425
- // const requestOptions: RequestInit = {
426
- // method: 'POST',
427
- // body: JSON.stringify(payload),
428
- // headers: {
429
- // 'Content-Type': 'application/json',
430
- // 'x-api-key': apiKey,
431
- // },
432
- // };
433
- // return fetch(`${orchestrationAPIUrl}/transmit`, requestOptions);
434
- // }
435
- // export async function validateSecurityToken({ token, uuid }: { token: string; uuid: string }) {
436
- // const payload = { api_key: apiKey, uuid, securityToken: token, IAL: '1' };
437
- // const requestOptions: RequestInit = {
438
- // method: 'POST',
439
- // body: JSON.stringify(payload),
440
- // headers: {
441
- // 'Content-Type': 'application/json',
442
- // 'x-api-key': apiKey,
443
- // },
444
- // };
445
- // const result = await (await fetch(`${apiUrl}/isSecurityTokenValid`, requestOptions)).json();
446
- // return result;
447
- // }
448
- // export enum VerificationType {
449
- // IDENTITY = 'IDENTITY',
450
- // AGE = 'AGE',
451
- // }
452
- // export async function createVerificationSession({
453
- // successUrl,
454
- // failureUrl,
455
- // type,
456
- // productGroupId,
457
- // }: {
458
- // successUrl: string;
459
- // failureUrl: string;
460
- // type: VerificationType;
461
- // productGroupId: string;
462
- // }): Promise<any> {
463
- // const payload = { successUrl, failureUrl, type, productGroupId };
464
- // const requestOptions: RequestInit = {
465
- // method: 'POST',
466
- // body: JSON.stringify(payload),
467
- // headers: {
468
- // 'Content-Type': 'application/json',
469
- // 'x-api-key': apiKey,
470
- // },
471
- // };
472
- // const result = await (await fetch(`${orchestrationAPIUrl}/verification-session’`, requestOptions)).json();
473
- // return result;
474
- // }
475
- // // api v2
476
- // enum SessionType {
477
- // Identity = 'IDENTITY',
478
- // Age = 'AGE',
479
- // }
480
- // export interface VerificationSessionPayload {
481
- // successUrl: string;
482
- // failureUrl: string;
483
- // type: SessionType; // identity or age
484
- // productGroupId: string;
485
- // customerIn?: boolean; // customer information v1 only
486
- // }
487
- // export const createVerificationSessionV2 = async ({
488
- // successUrl,
489
- // failureUrl,
490
- // type,
491
- // productGroupId,
492
- // customerIn,
493
- // }: VerificationSessionPayload) => {
494
- // try {
495
- // const payload = {
496
- // successUrl,
497
- // failureUrl,
498
- // type,
499
- // productGroupId,
500
- // customerIn,
501
- // };
502
- // const requestOptions: RequestInit = {
503
- // method: 'POST',
504
- // body: JSON.stringify(payload),
505
- // headers: {
506
- // 'Content-Type': 'application/json',
507
- // x_api_key: apiKey,
508
- // },
509
- // };
510
- // const result = await (await fetch(`${orchestrationAPIUrl}/v2/verification-session`, requestOptions)).json();
511
- // return result;
512
- // } catch (err) {
513
- // return err;
514
- // }
515
- // };
516
- // export type createUserWithSessionProp = {
517
- // sessionToken: string;
518
- // ssn?: string;
519
- // phone?: string;
520
- // email?: string;
521
- // };
522
- // export const createUserWithSession = async ({ sessionToken, ssn, email, phone }: createUserWithSessionProp) => {
523
- // const payload = { ssn, email, phone };
524
- // const requestOptions: RequestInit = {
525
- // method: 'POST',
526
- // body: JSON.stringify(payload),
527
- // headers: {
528
- // 'Content-Type': 'application/json',
529
- // x_api_key: apiKey,
530
- // },
531
- // };
532
- // const result = await (
533
- // await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/user`, requestOptions)
534
- // ).json();
535
- // return result;
536
- // };
537
- // export type updateUserManualInputWithSessionProps = {
538
- // sessionToken: string;
539
- // firstName?: string;
540
- // lastName?: string;
541
- // dob?: string;
542
- // address?: {
543
- // addressLine1?: string;
544
- // addressLine2?: string;
545
- // city?: string;
546
- // state?: string;
547
- // zipCode?: string;
548
- // country?: string;
549
- // };
550
- // ssn?: string;
551
- // };
552
- // export const updateUserManualInputWithSession = async ({
553
- // sessionToken,
554
- // firstName,
555
- // lastName,
556
- // dob,
557
- // address,
558
- // }: updateUserManualInputWithSessionProps) => {
559
- // const payload = { firstName, lastName, dob, ...address };
560
- // const requestOptions: RequestInit = {
561
- // method: 'POST',
562
- // body: JSON.stringify(payload),
563
- // headers: {
564
- // 'Content-Type': 'application/json',
565
- // x_api_key: apiKey,
566
- // },
567
- // };
568
- // const result = await (
569
- // await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/user/manual-input`, requestOptions)
570
- // ).json();
571
- // return result;
572
- // };
573
- // export enum createDocumentUploadIdTypeEnum {
574
- // health_card = 'health_card',
575
- // passport = 'passport',
576
- // drivers_license = 'drivers_license',
577
- // }
578
- // export type createDocumentUploadIdType = {
579
- // sessionToken: string;
580
- // documentType: createDocumentUploadIdTypeEnum;
581
- // content?: any;
582
- // };
583
- // export const createDocumentUploadIdWithSession = async ({
584
- // sessionToken,
585
- // documentType,
586
- // content,
587
- // }: createDocumentUploadIdType) => {
588
- // const payload = { content };
589
- // const requestOptions: RequestInit = {
590
- // method: 'POST',
591
- // body: JSON.stringify(payload),
592
- // headers: {
593
- // 'Content-Type': 'application/json',
594
- // x_api_key: apiKey,
595
- // },
596
- // };
597
- // const result = await (
598
- // await fetch(
599
- // `${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/document/${documentType}
600
- // `,
601
- // requestOptions,
602
- // )
603
- // ).json();
604
- // return result;
605
- // };
606
- // export enum documentImageTypeEnum {
607
- // FRONT = 'front',
608
- // BACK = 'back',
609
- // FRONT_CROPPED_DOCUMENT = 'front_cropped_document',
610
- // BACK_CROPPED_DOCUMENT = 'back_cropped_document',
611
- // FRONT_MUGSHOT = 'front_mugshot',
612
- // BACK_BARCODE = 'back_barcode',
613
- // }
614
- // export type uploadDocumentImageWithSessionProps = {
615
- // sessionToken: string;
616
- // documentId: string;
617
- // documentImageType: documentImageTypeEnum;
618
- // imageString: string;
619
- // };
620
- // export const uploadDocumentImageWithSession = async ({
621
- // sessionToken,
622
- // documentId,
623
- // documentImageType,
624
- // imageString,
625
- // }: uploadDocumentImageWithSessionProps) => {
626
- // const payload = { type: documentImageType, data: imageString };
627
- // const requestOptions: RequestInit = {
628
- // method: 'POST',
629
- // body: JSON.stringify(payload),
630
- // headers: {
631
- // 'Content-Type': 'application/json',
632
- // x_api_key: apiKey,
633
- // },
634
- // };
635
- // const result = await (
636
- // await fetch(
637
- // `${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/${documentId}/img
638
- // `,
639
- // requestOptions,
640
- // )
641
- // ).json();
642
- // return result;
643
- // };
644
- // interface updateDocumentContentInterface {
645
- // sessionToken: string;
646
- // documentId: string;
647
- // content: any;
648
- // }
649
- // export const updateDocumentContent = async ({ sessionToken, documentId, content }: updateDocumentContentInterface) => {
650
- // const payload = { content };
651
- // const requestOptions: RequestInit = {
652
- // method: 'PUT',
653
- // body: JSON.stringify(payload),
654
- // headers: {
655
- // 'Content-Type': 'application/json',
656
- // x_api_key: apiKey,
657
- // },
658
- // };
659
- // const result = await (
660
- // await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/document/${documentId}`, requestOptions)
661
- // ).json();
662
- // return result;
663
- // };
664
- // export type uploadEnrollImageWithSessionProps = {
665
- // sessionToken: string;
666
- // imageString: string;
667
- // };
668
- // export const uploadEnrollImageWithSession = async ({
669
- // sessionToken,
670
- // imageString,
671
- // }: uploadEnrollImageWithSessionProps) => {
672
- // const payload = { data: imageString };
673
- // const requestOptions: RequestInit = {
674
- // method: 'POST',
675
- // body: JSON.stringify(payload),
676
- // headers: {
677
- // 'Content-Type': 'application/json',
678
- // x_api_key: apiKey,
679
- // },
680
- // };
681
- // const result = await (
682
- // await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/img`, requestOptions)
683
- // ).json();
684
- // return result;
685
- // };
686
- // export enum updateTypeEnum {
687
- // enroll = 'enroll',
688
- // compare = 'compare',
689
- // personalDetails = 'personalDetails',
690
- // }
691
- // export type updateUserWithSessionProps = {
692
- // sessionToken: string;
693
- // guid?: string;
694
- // uuid?: string;
695
- // ssn?: string;
696
- // email?: string;
697
- // phone?: string;
698
- // portrait_conf_score?: string;
699
- // updateType: updateTypeEnum;
700
- // };
701
- // export const updateUserWithSession = async ({
702
- // sessionToken,
703
- // guid,
704
- // uuid,
705
- // email,
706
- // phone,
707
- // ssn,
708
- // portrait_conf_score,
709
- // updateType,
710
- // }: updateUserWithSessionProps) => {
711
- // let payload;
712
- // if (updateType === updateTypeEnum.enroll) {
713
- // payload = {
714
- // guid,
715
- // uuid,
716
- // };
717
- // } else if (updateType === updateTypeEnum.compare) {
718
- // payload = {
719
- // portrait_conf_score,
720
- // };
721
- // } else if (updateType === updateTypeEnum.personalDetails) {
722
- // payload = {
723
- // email,
724
- // phone,
725
- // ssn,
726
- // };
727
- // } else {
728
- // return;
729
- // }
730
- // const requestOptions: RequestInit = {
731
- // method: 'POST',
732
- // body: JSON.stringify(payload),
733
- // headers: {
734
- // 'Content-Type': 'application/json',
735
- // x_api_key: apiKey,
736
- // },
737
- // };
738
- // const result = await (
739
- // await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/user/update`, requestOptions)
740
- // ).json();
741
- // return result;
742
- // };
743
- // export const verifyIdWithSession = async ({ sessionToken }: { sessionToken: string }) => {
744
- // const requestOptions: RequestInit = {
745
- // method: 'POST',
746
- // headers: {
747
- // 'Content-Type': 'application/json',
748
- // x_api_key: apiKey,
749
- // },
750
- // };
751
- // const result = await (await fetch(`${orchestrationAPIUrl}/v3/verify-id/${sessionToken}`, requestOptions)).json();
752
- // return result;
753
- // };
754
- // export const verifySessionTokenV2 = async ({ sessionToken }: { sessionToken: string }) => {
755
- // const requestOptions: RequestInit = {
756
- // method: 'GET',
757
- // headers: {
758
- // 'Content-Type': 'application/json',
759
- // x_api_key: apiKey,
760
- // },
761
- // };
762
- // const result = await (
763
- // await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}`, requestOptions)
764
- // ).json();
765
- // return result;
766
- // };
767
- // export const createFederationHash = async ({ sesstionToken }: { sesstionToken: string }) => {
768
- // const requestOptions: RequestInit = {
769
- // method: 'POST',
770
- // headers: {
771
- // 'Content-Type': 'application/json',
772
- // x_api_key: apiKey,
773
- // },
774
- // };
775
- // const result = await (
776
- // await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sesstionToken}/federation-hash`, requestOptions)
777
- // ).json();
778
- // return result;
779
- // };
780
- // export const deletePasskey = async (uuid: any) => {
781
- // try {
782
- // const response = await fetch(`${orchestrationAPIUrl}/v2/passkey/delete-authentication`, {
783
- // method: 'DELETE',
784
- // headers: {
785
- // 'Content-Type': 'application/json',
786
- // x_api_key: apiKey,
787
- // },
788
- // // credentials: 'include',
789
- // body: JSON.stringify({ uuid }),
790
- // });
791
- // const result = await response.json();
792
- // return result;
793
- // } catch (error) {
794
- // return error;
795
- // }
796
- // };
797
- // // Auth with session API
798
- // interface createAuthSessionInterface {
799
- // requiredAAL: number;
800
- // productGroupId: string;
801
- // actionFlow: string;
802
- // requiredIAL: number;
803
- // requiredFAL: number;
804
- // interactionUID?: string;
805
- // }
806
- // export const createAuthSession = async ({
807
- // requiredAAL,
808
- // productGroupId,
809
- // requiredFAL,
810
- // requiredIAL,
811
- // actionFlow,
812
- // interactionUID,
813
- // }: createAuthSessionInterface) => {
814
- // const payload = { requiredAAL, productGroupId, requiredFAL, requiredIAL, interactionUID, actionFlow };
815
- // const requestOptions: RequestInit = {
816
- // method: 'POST',
817
- // body: JSON.stringify(payload),
818
- // headers: {
819
- // 'Content-Type': 'application/json',
820
- // x_api_key: apiKey,
821
- // },
822
- // };
823
- // const result = await (await fetch(`${orchestrationAPIUrl}/v2/auth-session`, requestOptions)).json();
824
- // return result;
825
- // };
826
- // export const generateAuthPasskeyOptions = async ({ uuid, sessionToken }: { uuid: string; sessionToken: string }) => {
827
- // const payload = { uuid };
828
- // const requestOptions: RequestInit = {
829
- // method: 'POST',
830
- // body: JSON.stringify(payload),
831
- // headers: {
832
- // 'Content-Type': 'application/json',
833
- // x_api_key: apiKey,
834
- // },
835
- // };
836
- // const result = await (
837
- // await fetch(
838
- // `${orchestrationAPIUrl}/v2/auth/${sessionToken}/passkey/generate-authentication-options`,
839
- // requestOptions,
840
- // )
841
- // ).json();
842
- // return result;
843
- // };
844
- // export const verifyAuthPasskey = async ({
845
- // uuid,
846
- // sessionToken,
847
- // data, // Generate passkey options
848
- // }: {
849
- // uuid: string;
850
- // sessionToken: string;
851
- // data: any;
852
- // }) => {
853
- // const payload = { uuid, data };
854
- // const requestOptions: RequestInit = {
855
- // method: 'POST',
856
- // body: JSON.stringify(payload),
857
- // headers: {
858
- // 'Content-Type': 'application/json',
859
- // x_api_key: apiKey,
860
- // },
861
- // };
862
- // const result = await (
863
- // await fetch(`${orchestrationAPIUrl}/v2/auth-session/${sessionToken}/passkey/verify-authentication`, requestOptions)
864
- // ).json();
865
- // return result;
866
- // };
867
- export const createDocumentDL = ({ baseUrl, token }) => __awaiter(void 0, void 0, void 0, function* () {
868
- const requestOptions = {
869
- method: 'POST',
870
- headers: {
871
- 'Content-Type': 'application/json',
872
- },
873
- };
874
- const result = yield (yield fetch(`${baseUrl}/${token}/document/drivers_license`, requestOptions)).json();
875
- return result;
876
- });
877
- export const updateDocumentDetails = ({ baseUrl, token, documentId, params, }) => __awaiter(void 0, void 0, void 0, function* () {
878
- const requestOptions = {
879
- method: 'PUT',
880
- headers: {
881
- 'Content-Type': 'application/json',
882
- },
883
- body: JSON.stringify(params),
884
- };
885
- const result = yield (yield fetch(`${baseUrl}/v2/verification-session/${token}/document/${documentId}`, requestOptions)).json();
886
- return result;
887
- });
888
- export var documentImageTypeEnum;
889
- (function (documentImageTypeEnum) {
890
- documentImageTypeEnum["FRONTDLORIGINAL"] = "front";
891
- documentImageTypeEnum["FRONTDLHEADSHOT"] = "front_mugshot";
892
- documentImageTypeEnum["FRONTDLCROPPED"] = "front_cropped_document";
893
- documentImageTypeEnum["BACKDLORIGINAL"] = "back";
894
- documentImageTypeEnum["BACKDLCROPPED"] = "back_cropped_document";
895
- documentImageTypeEnum["BACKDLBARCODE"] = "back_barcode";
896
- })(documentImageTypeEnum || (documentImageTypeEnum = {}));
897
- export const uploadDocumentImage = ({ baseUrl, token, documentId, params, }) => __awaiter(void 0, void 0, void 0, function* () {
898
- const pngBase64 = params.data;
899
- const jpegBase64 = yield convertPngBase64ToJpegBase64(pngBase64);
900
- const requestOptions = {
901
- method: 'POST',
902
- headers: {
903
- 'Content-Type': 'application/json',
904
- },
905
- body: JSON.stringify(Object.assign(Object.assign({}, params), { data: jpegBase64 })),
906
- };
907
- const result = yield (yield fetch(`${baseUrl}/v2/verification-session/${token}/${documentId}/img`, requestOptions)).json();
908
- return result;
909
- });
910
- // Update User Details
911
- export const updateUserDetails = ({ baseUrl, token, params, }) => __awaiter(void 0, void 0, void 0, function* () {
912
- const requestOptions = {
913
- method: 'POST',
914
- headers: {
915
- 'Content-Type': 'application/json',
916
- },
917
- body: JSON.stringify(params),
918
- };
919
- const result = yield (yield fetch(`${baseUrl}/v2/verification-session/${token}/user/update`, requestOptions)).json();
920
- return result;
921
- });
1
+ /* eslint-disable */
2
+ // import { Base64, DLType, HCType, LOGTYPE, VerifyType } from './types';
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ import { convertPngBase64ToJpegBase64 } from './utils';
13
+ // const rand = () => Math.random().toString(36).substr(2);
14
+ // export const postImages = (image: Base64) =>
15
+ // fetch(`${apiUrl}/upload-img`, {
16
+ // method: 'POST',
17
+ // headers: {
18
+ // Accept: 'application/json',
19
+ // 'Content-Type': 'application/json',
20
+ // },
21
+ // body: JSON.stringify({ image }),
22
+ // });
23
+ // /**
24
+ // * @category Api
25
+ // * @param pramUuid UUID to delete
26
+ // * @param callback Callback called once the delete is completed
27
+ // */
28
+ // export async function deleteUuid(guid: string, callback: () => void) {
29
+ // const myHeaders = new Headers();
30
+ // myHeaders.append('Accept', 'application/json, text/plain, */*');
31
+ // myHeaders.append('Accept-Encoding', 'gzip, deflate, br');
32
+ // myHeaders.append('x-api-key', apiKey);
33
+ // const formdata = new FormData();
34
+ // formdata.append('guid', guid);
35
+ // formdata.append('api_key', apiKey);
36
+ // const requestOptions: RequestInit = {
37
+ // method: 'POST',
38
+ // headers: myHeaders,
39
+ // body: formdata,
40
+ // mode: 'no-cors',
41
+ // };
42
+ // try {
43
+ // await fetch(`${apiUrl}/deleteUser`, requestOptions);
44
+ // callback();
45
+ // } catch (e) {
46
+ // printLogs('', e, getDebugType(), LOGTYPE.ERROR);
47
+ // }
48
+ // }
49
+ // export async function getPhrases(): Promise<Array<string>> {
50
+ // const requestOptions: RequestInit = {
51
+ // method: 'POST',
52
+ // };
53
+ // const res = await fetch(`${apiUrl}/getLivenessPhrases`, requestOptions);
54
+ // return res.json();
55
+ // }
56
+ // export async function sendOTP(phone_number: string): Promise<string> {
57
+ // if (!phone_number) return '';
58
+ // const token = rand() + rand();
59
+ // const requestOptions: RequestInit = {
60
+ // method: 'POST',
61
+ // body: JSON.stringify({
62
+ // phone_number,
63
+ // token,
64
+ // api_key: apiKey,
65
+ // hostURL: window.location.href,
66
+ // customerName: 'betmgm',
67
+ // }),
68
+ // };
69
+ // const res = await fetch(`${apiUrl}/sendOTP`, requestOptions);
70
+ // return res.json();
71
+ // }
72
+ // export async function verifyOTP(otp: string, token: string): Promise<string> {
73
+ // const requestOptions: RequestInit = {
74
+ // method: 'POST',
75
+ // body: JSON.stringify({
76
+ // token,
77
+ // otp,
78
+ // }),
79
+ // };
80
+ // const res = await fetch(`${apiUrl}/verifyOTP`, requestOptions);
81
+ // return res.json();
82
+ // }
83
+ // type createUserProps = {
84
+ // id?: string;
85
+ // guid?: string;
86
+ // phone?: string;
87
+ // phoneVerified?: boolean;
88
+ // email?: string;
89
+ // emailVerified?: boolean;
90
+ // ssn4?: string;
91
+ // ssn9?: string;
92
+ // userConsent: boolean;
93
+ // userConsentDate: string;
94
+ // userFaceEnrollConsent?: boolean;
95
+ // consentVersion?: string;
96
+ // consentContent?: string;
97
+ // portrait?: string;
98
+ // };
99
+ // export async function createUser(payload: createUserProps): Promise<string> {
100
+ // const userInfo = {
101
+ // token: payload.id,
102
+ // phone: payload.phone,
103
+ // phoneVerified: payload.phoneVerified,
104
+ // email: payload.email,
105
+ // emailVerified: payload.emailVerified,
106
+ // ssn: payload.ssn4,
107
+ // ssn4: payload.ssn4,
108
+ // ssn9: payload.ssn9,
109
+ // userConsent: payload.userConsent,
110
+ // userConsentDate: payload.userConsentDate,
111
+ // userFaceEnrollConsent: payload.userFaceEnrollConsent,
112
+ // consentVersion: payload.consentVersion,
113
+ // consentContent: payload.consentContent,
114
+ // };
115
+ // const requestOptions: RequestInit = {
116
+ // method: 'POST',
117
+ // body: JSON.stringify(userInfo),
118
+ // headers: {
119
+ // 'x-api-key': apiKey,
120
+ // 'Content-Type': 'application/json',
121
+ // },
122
+ // };
123
+ // const res = await fetch(`${apiUrl}/user/create`, requestOptions);
124
+ // return res.json();
125
+ // }
126
+ // export async function sendEmail(email: string, uuid: string, skin: string, customerName: string): Promise<string> {
127
+ // const token = rand() + rand();
128
+ // const requestOptions: RequestInit = {
129
+ // method: 'POST',
130
+ // body: JSON.stringify({
131
+ // skin,
132
+ // customerName,
133
+ // alias: uuid,
134
+ // hostUrl: window.location.href,
135
+ // version: '1.0',
136
+ // api_key: apiKey,
137
+ // email_address: email,
138
+ // token,
139
+ // action: 'exact_url',
140
+ // }),
141
+ // headers: {
142
+ // 'Content-Type': 'application/json',
143
+ // 'x-api-key': apiKey,
144
+ // },
145
+ // };
146
+ // const res = await fetch(`${apiUrl}/requestAuthLink`, requestOptions);
147
+ // return res.json();
148
+ // }
149
+ // export async function expandUri(shortUrl: string): Promise<string> {
150
+ // const requestOptions: RequestInit = {
151
+ // method: 'POST',
152
+ // body: JSON.stringify({
153
+ // shortUrl,
154
+ // api_key: apiKey,
155
+ // }),
156
+ // headers: {
157
+ // 'Content-Type': 'application/json',
158
+ // 'x-api-key': apiKey,
159
+ // },
160
+ // };
161
+ // const res = await fetch(`${apiUrl}/expandUri`, requestOptions);
162
+ // return res.json();
163
+ // }
164
+ // type VerifyTokenProps = {
165
+ // code: string;
166
+ // type: VerifyType;
167
+ // };
168
+ // export async function verifyToken({ code, type }: VerifyTokenProps): Promise<string> {
169
+ // const requestOptions: RequestInit = {
170
+ // method: 'POST',
171
+ // body: JSON.stringify({ code, type }),
172
+ // headers: {
173
+ // 'Content-Type': 'application/json',
174
+ // 'x-api-key': apiKey,
175
+ // },
176
+ // };
177
+ // const res = await fetch(`${apiUrl}/user/verif_code`, requestOptions);
178
+ // return res.json();
179
+ // }
180
+ // export async function sendSmsCode({ id, phone }: { id: string; phone: string }): Promise<string> {
181
+ // const requestOptions: RequestInit = {
182
+ // method: 'POST',
183
+ // body: JSON.stringify({ token: id, phone }),
184
+ // headers: {
185
+ // 'Content-Type': 'application/json',
186
+ // 'x-api-key': apiKey,
187
+ // },
188
+ // };
189
+ // const res = await fetch(`${apiUrl}/user/send_code`, requestOptions);
190
+ // return res.json();
191
+ // }
192
+ // export async function sendEnrollSms({ id }: { id: string }): Promise<string> {
193
+ // const requestOptions: RequestInit = {
194
+ // method: 'POST',
195
+ // body: JSON.stringify({ token: id }),
196
+ // headers: {
197
+ // 'Content-Type': 'application/json',
198
+ // 'x-api-key': apiKey,
199
+ // },
200
+ // };
201
+ // const res = await fetch(`${apiUrl}/user/send_redirectSms`, requestOptions);
202
+ // return res.json();
203
+ // }
204
+ // export async function sendMessage({
205
+ // id,
206
+ // type,
207
+ // endpoint,
208
+ // message,
209
+ // email,
210
+ // subject,
211
+ // phone,
212
+ // }: {
213
+ // id: string;
214
+ // type: 'email' | 'phone';
215
+ // endpoint: string;
216
+ // message: string;
217
+ // email?: string;
218
+ // subject?: string;
219
+ // phone?: string;
220
+ // }): Promise<string> {
221
+ // const requestOptions: RequestInit = {
222
+ // method: 'POST',
223
+ // body: JSON.stringify({ token: id, type, email, subject, phone, endpoint, message }),
224
+ // headers: {
225
+ // 'Content-Type': 'application/json',
226
+ // 'x-api-key': apiKey,
227
+ // },
228
+ // };
229
+ // const res = await fetch(`${apiUrl}/user/sendMessage`, requestOptions);
230
+ // return res.json();
231
+ // }
232
+ // export async function uploadPortrait({ id, portrait }: { id: string; portrait: string }): Promise<string> {
233
+ // const requestOptions: RequestInit = {
234
+ // method: 'POST',
235
+ // body: JSON.stringify({ token: id, portrait }),
236
+ // headers: {
237
+ // 'Content-Type': 'application/json',
238
+ // 'x-api-key': apiKey,
239
+ // },
240
+ // };
241
+ // const res = await fetch(`${apiUrl}/user/upload/portrait`, requestOptions);
242
+ // return res.json();
243
+ // }
244
+ // type UploadDlProps = {
245
+ // id: string;
246
+ // type: DLType;
247
+ // image?: string;
248
+ // barcode?: string;
249
+ // process_ocr?: boolean;
250
+ // };
251
+ // export async function uploadDL({ id, type, image, barcode, process_ocr }: UploadDlProps): Promise<string> {
252
+ // let payload;
253
+ // if (type === DLType.BARCODEJSON) {
254
+ // payload = {
255
+ // token: id,
256
+ // type,
257
+ // barcode,
258
+ // };
259
+ // } else {
260
+ // payload = {
261
+ // token: id,
262
+ // type,
263
+ // image,
264
+ // process_ocr,
265
+ // };
266
+ // }
267
+ // if (type === DLType.BARCODEJSON && !barcode) throw new Error("Barcode data is required for 'barcodeJson' type.");
268
+ // else if (type !== DLType.BARCODEJSON && !image) throw new Error('Image is required.');
269
+ // const requestOptions: RequestInit = {
270
+ // method: 'POST',
271
+ // body: JSON.stringify(payload),
272
+ // headers: {
273
+ // 'Content-Type': 'application/json',
274
+ // 'x-api-key': apiKey,
275
+ // },
276
+ // };
277
+ // const res = await fetch(`${apiUrl}/user/upload/dl`, requestOptions);
278
+ // return res.json();
279
+ // }
280
+ // type UploadHcProps = {
281
+ // id: string;
282
+ // type: HCType;
283
+ // image?: string;
284
+ // processOcr?: boolean;
285
+ // };
286
+ // export async function uploadHC({ id, type, image, processOcr }: UploadHcProps): Promise<string> {
287
+ // const payload = {
288
+ // token: id,
289
+ // type,
290
+ // image,
291
+ // process_ocr: processOcr,
292
+ // };
293
+ // const requestOptions: RequestInit = {
294
+ // method: 'POST',
295
+ // body: JSON.stringify(payload),
296
+ // headers: {
297
+ // 'Content-Type': 'application/json',
298
+ // 'x-api-key': apiKey,
299
+ // },
300
+ // };
301
+ // const res = await fetch(`${apiUrl}/user/upload/hc`, requestOptions);
302
+ // return res.json();
303
+ // }
304
+ // export async function getUserStatus({ id }: { id: string }): Promise<{
305
+ // complianceReview: boolean;
306
+ // expiredDate: string;
307
+ // expiredID: boolean;
308
+ // manualPIIEntry: boolean;
309
+ // orchestrationStatus: string;
310
+ // requestResAddress: boolean;
311
+ // requestSSN4: boolean;
312
+ // requestSSN9: boolean;
313
+ // requestScanID: boolean;
314
+ // toBeEncrypted: boolean;
315
+ // underAge: boolean;
316
+ // userApproved: boolean;
317
+ // userBiometric: string;
318
+ // userRegistered: boolean;
319
+ // userScanId: boolean;
320
+ // }> {
321
+ // const payload = { token: id };
322
+ // const requestOptions: RequestInit = {
323
+ // method: 'POST',
324
+ // body: JSON.stringify(payload),
325
+ // headers: {
326
+ // 'Content-Type': 'application/json',
327
+ // 'x-api-key': apiKey,
328
+ // },
329
+ // };
330
+ // const res = await fetch(`${apiUrl}/user/status`, requestOptions);
331
+ // return res.json();
332
+ // }
333
+ // type Attributes = {
334
+ // uuid?: string;
335
+ // guid?: string;
336
+ // ssn?: string;
337
+ // ssn4?: string;
338
+ // govId?: {
339
+ // firstName?: string;
340
+ // lastName?: string;
341
+ // portraitConfScore?: number;
342
+ // address?: {
343
+ // addressLine1?: string;
344
+ // addressLine2?: string;
345
+ // city?: string;
346
+ // state?: string;
347
+ // zipCode?: string;
348
+ // country?: string;
349
+ // };
350
+ // idDocumentNumber?: string;
351
+ // };
352
+ // preferred?: {
353
+ // firstName?: string;
354
+ // lastName?: string;
355
+ // dob?: string;
356
+ // address?: {
357
+ // addressLine1?: string;
358
+ // addressLine2?: string;
359
+ // city?: string;
360
+ // state?: string;
361
+ // zipCode?: string;
362
+ // country?: string;
363
+ // };
364
+ // idDocumentNumber?: string;
365
+ // };
366
+ // };
367
+ // export async function updateUser({ id, attributes }: { id: string; attributes: Attributes }): Promise<string> {
368
+ // const payload = { token: id, attributes };
369
+ // const requestOptions: RequestInit = {
370
+ // method: 'POST',
371
+ // body: JSON.stringify(payload),
372
+ // headers: {
373
+ // 'Content-Type': 'application/json',
374
+ // 'x-api-key': apiKey,
375
+ // },
376
+ // };
377
+ // const res = await fetch(`${apiUrl}/user/update`, requestOptions);
378
+ // return res.json();
379
+ // }
380
+ // export async function verifyUser({
381
+ // id,
382
+ // apiValue,
383
+ // organizationApiKey,
384
+ // }: {
385
+ // id: string;
386
+ // apiValue: string;
387
+ // organizationApiKey: string;
388
+ // }): Promise<any> {
389
+ // const payload = { token: id };
390
+ // const requestOptions: RequestInit = {
391
+ // method: 'POST',
392
+ // body: JSON.stringify(payload),
393
+ // headers: {
394
+ // 'Content-Type': 'application/json',
395
+ // x_api_key: organizationApiKey,
396
+ // },
397
+ // };
398
+ // const res = await fetch(`${orchestrationAPIUrl}/verify/${apiValue}`, requestOptions);
399
+ // return res.json();
400
+ // }
401
+ // export async function getProductGroups(): Promise<any> {
402
+ // const requestOptions: RequestInit = {
403
+ // method: 'GET',
404
+ // headers: {
405
+ // 'Content-Type': 'application/json',
406
+ // 'x-api-key': apiKey,
407
+ // },
408
+ // };
409
+ // const res = await fetch(`${orchestrationAPIUrl}/product-group/list/prod`, requestOptions);
410
+ // return res.json();
411
+ // }
412
+ // export async function transmit({
413
+ // id,
414
+ // url,
415
+ // sessionToken,
416
+ // final,
417
+ // apiToken,
418
+ // }: {
419
+ // id: string;
420
+ // url: string;
421
+ // sessionToken: string;
422
+ // apiToken?: string;
423
+ // final: boolean;
424
+ // }) {
425
+ // const payload = { token: id, url, sessionToken, apiToken, final };
426
+ // const requestOptions: RequestInit = {
427
+ // method: 'POST',
428
+ // body: JSON.stringify(payload),
429
+ // headers: {
430
+ // 'Content-Type': 'application/json',
431
+ // 'x-api-key': apiKey,
432
+ // },
433
+ // };
434
+ // return fetch(`${orchestrationAPIUrl}/transmit`, requestOptions);
435
+ // }
436
+ // export async function validateSecurityToken({ token, uuid }: { token: string; uuid: string }) {
437
+ // const payload = { api_key: apiKey, uuid, securityToken: token, IAL: '1' };
438
+ // const requestOptions: RequestInit = {
439
+ // method: 'POST',
440
+ // body: JSON.stringify(payload),
441
+ // headers: {
442
+ // 'Content-Type': 'application/json',
443
+ // 'x-api-key': apiKey,
444
+ // },
445
+ // };
446
+ // const result = await (await fetch(`${apiUrl}/isSecurityTokenValid`, requestOptions)).json();
447
+ // return result;
448
+ // }
449
+ // export enum VerificationType {
450
+ // IDENTITY = 'IDENTITY',
451
+ // AGE = 'AGE',
452
+ // }
453
+ // export async function createVerificationSession({
454
+ // successUrl,
455
+ // failureUrl,
456
+ // type,
457
+ // productGroupId,
458
+ // }: {
459
+ // successUrl: string;
460
+ // failureUrl: string;
461
+ // type: VerificationType;
462
+ // productGroupId: string;
463
+ // }): Promise<any> {
464
+ // const payload = { successUrl, failureUrl, type, productGroupId };
465
+ // const requestOptions: RequestInit = {
466
+ // method: 'POST',
467
+ // body: JSON.stringify(payload),
468
+ // headers: {
469
+ // 'Content-Type': 'application/json',
470
+ // 'x-api-key': apiKey,
471
+ // },
472
+ // };
473
+ // const result = await (await fetch(`${orchestrationAPIUrl}/verification-session’`, requestOptions)).json();
474
+ // return result;
475
+ // }
476
+ // // api v2
477
+ // enum SessionType {
478
+ // Identity = 'IDENTITY',
479
+ // Age = 'AGE',
480
+ // }
481
+ // export interface VerificationSessionPayload {
482
+ // successUrl: string;
483
+ // failureUrl: string;
484
+ // type: SessionType; // identity or age
485
+ // productGroupId: string;
486
+ // customerIn?: boolean; // customer information v1 only
487
+ // }
488
+ // export const createVerificationSessionV2 = async ({
489
+ // successUrl,
490
+ // failureUrl,
491
+ // type,
492
+ // productGroupId,
493
+ // customerIn,
494
+ // }: VerificationSessionPayload) => {
495
+ // try {
496
+ // const payload = {
497
+ // successUrl,
498
+ // failureUrl,
499
+ // type,
500
+ // productGroupId,
501
+ // customerIn,
502
+ // };
503
+ // const requestOptions: RequestInit = {
504
+ // method: 'POST',
505
+ // body: JSON.stringify(payload),
506
+ // headers: {
507
+ // 'Content-Type': 'application/json',
508
+ // x_api_key: apiKey,
509
+ // },
510
+ // };
511
+ // const result = await (await fetch(`${orchestrationAPIUrl}/v2/verification-session`, requestOptions)).json();
512
+ // return result;
513
+ // } catch (err) {
514
+ // return err;
515
+ // }
516
+ // };
517
+ // export type createUserWithSessionProp = {
518
+ // sessionToken: string;
519
+ // ssn?: string;
520
+ // phone?: string;
521
+ // email?: string;
522
+ // };
523
+ // export const createUserWithSession = async ({ sessionToken, ssn, email, phone }: createUserWithSessionProp) => {
524
+ // const payload = { ssn, email, phone };
525
+ // const requestOptions: RequestInit = {
526
+ // method: 'POST',
527
+ // body: JSON.stringify(payload),
528
+ // headers: {
529
+ // 'Content-Type': 'application/json',
530
+ // x_api_key: apiKey,
531
+ // },
532
+ // };
533
+ // const result = await (
534
+ // await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/user`, requestOptions)
535
+ // ).json();
536
+ // return result;
537
+ // };
538
+ // export type updateUserManualInputWithSessionProps = {
539
+ // sessionToken: string;
540
+ // firstName?: string;
541
+ // lastName?: string;
542
+ // dob?: string;
543
+ // address?: {
544
+ // addressLine1?: string;
545
+ // addressLine2?: string;
546
+ // city?: string;
547
+ // state?: string;
548
+ // zipCode?: string;
549
+ // country?: string;
550
+ // };
551
+ // ssn?: string;
552
+ // };
553
+ // export const updateUserManualInputWithSession = async ({
554
+ // sessionToken,
555
+ // firstName,
556
+ // lastName,
557
+ // dob,
558
+ // address,
559
+ // }: updateUserManualInputWithSessionProps) => {
560
+ // const payload = { firstName, lastName, dob, ...address };
561
+ // const requestOptions: RequestInit = {
562
+ // method: 'POST',
563
+ // body: JSON.stringify(payload),
564
+ // headers: {
565
+ // 'Content-Type': 'application/json',
566
+ // x_api_key: apiKey,
567
+ // },
568
+ // };
569
+ // const result = await (
570
+ // await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/user/manual-input`, requestOptions)
571
+ // ).json();
572
+ // return result;
573
+ // };
574
+ // export enum createDocumentUploadIdTypeEnum {
575
+ // health_card = 'health_card',
576
+ // passport = 'passport',
577
+ // drivers_license = 'drivers_license',
578
+ // }
579
+ // export type createDocumentUploadIdType = {
580
+ // sessionToken: string;
581
+ // documentType: createDocumentUploadIdTypeEnum;
582
+ // content?: any;
583
+ // };
584
+ // export const createDocumentUploadIdWithSession = async ({
585
+ // sessionToken,
586
+ // documentType,
587
+ // content,
588
+ // }: createDocumentUploadIdType) => {
589
+ // const payload = { content };
590
+ // const requestOptions: RequestInit = {
591
+ // method: 'POST',
592
+ // body: JSON.stringify(payload),
593
+ // headers: {
594
+ // 'Content-Type': 'application/json',
595
+ // x_api_key: apiKey,
596
+ // },
597
+ // };
598
+ // const result = await (
599
+ // await fetch(
600
+ // `${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/document/${documentType}
601
+ // `,
602
+ // requestOptions,
603
+ // )
604
+ // ).json();
605
+ // return result;
606
+ // };
607
+ // export enum documentImageTypeEnum {
608
+ // FRONT = 'front',
609
+ // BACK = 'back',
610
+ // FRONT_CROPPED_DOCUMENT = 'front_cropped_document',
611
+ // BACK_CROPPED_DOCUMENT = 'back_cropped_document',
612
+ // FRONT_MUGSHOT = 'front_mugshot',
613
+ // BACK_BARCODE = 'back_barcode',
614
+ // }
615
+ // export type uploadDocumentImageWithSessionProps = {
616
+ // sessionToken: string;
617
+ // documentId: string;
618
+ // documentImageType: documentImageTypeEnum;
619
+ // imageString: string;
620
+ // };
621
+ // export const uploadDocumentImageWithSession = async ({
622
+ // sessionToken,
623
+ // documentId,
624
+ // documentImageType,
625
+ // imageString,
626
+ // }: uploadDocumentImageWithSessionProps) => {
627
+ // const payload = { type: documentImageType, data: imageString };
628
+ // const requestOptions: RequestInit = {
629
+ // method: 'POST',
630
+ // body: JSON.stringify(payload),
631
+ // headers: {
632
+ // 'Content-Type': 'application/json',
633
+ // x_api_key: apiKey,
634
+ // },
635
+ // };
636
+ // const result = await (
637
+ // await fetch(
638
+ // `${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/${documentId}/img
639
+ // `,
640
+ // requestOptions,
641
+ // )
642
+ // ).json();
643
+ // return result;
644
+ // };
645
+ // interface updateDocumentContentInterface {
646
+ // sessionToken: string;
647
+ // documentId: string;
648
+ // content: any;
649
+ // }
650
+ // export const updateDocumentContent = async ({ sessionToken, documentId, content }: updateDocumentContentInterface) => {
651
+ // const payload = { content };
652
+ // const requestOptions: RequestInit = {
653
+ // method: 'PUT',
654
+ // body: JSON.stringify(payload),
655
+ // headers: {
656
+ // 'Content-Type': 'application/json',
657
+ // x_api_key: apiKey,
658
+ // },
659
+ // };
660
+ // const result = await (
661
+ // await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/document/${documentId}`, requestOptions)
662
+ // ).json();
663
+ // return result;
664
+ // };
665
+ // export type uploadEnrollImageWithSessionProps = {
666
+ // sessionToken: string;
667
+ // imageString: string;
668
+ // };
669
+ // export const uploadEnrollImageWithSession = async ({
670
+ // sessionToken,
671
+ // imageString,
672
+ // }: uploadEnrollImageWithSessionProps) => {
673
+ // const payload = { data: imageString };
674
+ // const requestOptions: RequestInit = {
675
+ // method: 'POST',
676
+ // body: JSON.stringify(payload),
677
+ // headers: {
678
+ // 'Content-Type': 'application/json',
679
+ // x_api_key: apiKey,
680
+ // },
681
+ // };
682
+ // const result = await (
683
+ // await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/img`, requestOptions)
684
+ // ).json();
685
+ // return result;
686
+ // };
687
+ // export enum updateTypeEnum {
688
+ // enroll = 'enroll',
689
+ // compare = 'compare',
690
+ // personalDetails = 'personalDetails',
691
+ // }
692
+ // export type updateUserWithSessionProps = {
693
+ // sessionToken: string;
694
+ // guid?: string;
695
+ // uuid?: string;
696
+ // ssn?: string;
697
+ // email?: string;
698
+ // phone?: string;
699
+ // portrait_conf_score?: string;
700
+ // updateType: updateTypeEnum;
701
+ // };
702
+ // export const updateUserWithSession = async ({
703
+ // sessionToken,
704
+ // guid,
705
+ // uuid,
706
+ // email,
707
+ // phone,
708
+ // ssn,
709
+ // portrait_conf_score,
710
+ // updateType,
711
+ // }: updateUserWithSessionProps) => {
712
+ // let payload;
713
+ // if (updateType === updateTypeEnum.enroll) {
714
+ // payload = {
715
+ // guid,
716
+ // uuid,
717
+ // };
718
+ // } else if (updateType === updateTypeEnum.compare) {
719
+ // payload = {
720
+ // portrait_conf_score,
721
+ // };
722
+ // } else if (updateType === updateTypeEnum.personalDetails) {
723
+ // payload = {
724
+ // email,
725
+ // phone,
726
+ // ssn,
727
+ // };
728
+ // } else {
729
+ // return;
730
+ // }
731
+ // const requestOptions: RequestInit = {
732
+ // method: 'POST',
733
+ // body: JSON.stringify(payload),
734
+ // headers: {
735
+ // 'Content-Type': 'application/json',
736
+ // x_api_key: apiKey,
737
+ // },
738
+ // };
739
+ // const result = await (
740
+ // await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}/user/update`, requestOptions)
741
+ // ).json();
742
+ // return result;
743
+ // };
744
+ // export const verifyIdWithSession = async ({ sessionToken }: { sessionToken: string }) => {
745
+ // const requestOptions: RequestInit = {
746
+ // method: 'POST',
747
+ // headers: {
748
+ // 'Content-Type': 'application/json',
749
+ // x_api_key: apiKey,
750
+ // },
751
+ // };
752
+ // const result = await (await fetch(`${orchestrationAPIUrl}/v3/verify-id/${sessionToken}`, requestOptions)).json();
753
+ // return result;
754
+ // };
755
+ // export const verifySessionTokenV2 = async ({ sessionToken }: { sessionToken: string }) => {
756
+ // const requestOptions: RequestInit = {
757
+ // method: 'GET',
758
+ // headers: {
759
+ // 'Content-Type': 'application/json',
760
+ // x_api_key: apiKey,
761
+ // },
762
+ // };
763
+ // const result = await (
764
+ // await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sessionToken}`, requestOptions)
765
+ // ).json();
766
+ // return result;
767
+ // };
768
+ // export const createFederationHash = async ({ sesstionToken }: { sesstionToken: string }) => {
769
+ // const requestOptions: RequestInit = {
770
+ // method: 'POST',
771
+ // headers: {
772
+ // 'Content-Type': 'application/json',
773
+ // x_api_key: apiKey,
774
+ // },
775
+ // };
776
+ // const result = await (
777
+ // await fetch(`${orchestrationAPIUrl}/v2/verification-session/${sesstionToken}/federation-hash`, requestOptions)
778
+ // ).json();
779
+ // return result;
780
+ // };
781
+ // export const deletePasskey = async (uuid: any) => {
782
+ // try {
783
+ // const response = await fetch(`${orchestrationAPIUrl}/v2/passkey/delete-authentication`, {
784
+ // method: 'DELETE',
785
+ // headers: {
786
+ // 'Content-Type': 'application/json',
787
+ // x_api_key: apiKey,
788
+ // },
789
+ // // credentials: 'include',
790
+ // body: JSON.stringify({ uuid }),
791
+ // });
792
+ // const result = await response.json();
793
+ // return result;
794
+ // } catch (error) {
795
+ // return error;
796
+ // }
797
+ // };
798
+ // // Auth with session API
799
+ // interface createAuthSessionInterface {
800
+ // requiredAAL: number;
801
+ // productGroupId: string;
802
+ // actionFlow: string;
803
+ // requiredIAL: number;
804
+ // requiredFAL: number;
805
+ // interactionUID?: string;
806
+ // }
807
+ // export const createAuthSession = async ({
808
+ // requiredAAL,
809
+ // productGroupId,
810
+ // requiredFAL,
811
+ // requiredIAL,
812
+ // actionFlow,
813
+ // interactionUID,
814
+ // }: createAuthSessionInterface) => {
815
+ // const payload = { requiredAAL, productGroupId, requiredFAL, requiredIAL, interactionUID, actionFlow };
816
+ // const requestOptions: RequestInit = {
817
+ // method: 'POST',
818
+ // body: JSON.stringify(payload),
819
+ // headers: {
820
+ // 'Content-Type': 'application/json',
821
+ // x_api_key: apiKey,
822
+ // },
823
+ // };
824
+ // const result = await (await fetch(`${orchestrationAPIUrl}/v2/auth-session`, requestOptions)).json();
825
+ // return result;
826
+ // };
827
+ // export const generateAuthPasskeyOptions = async ({ uuid, sessionToken }: { uuid: string; sessionToken: string }) => {
828
+ // const payload = { uuid };
829
+ // const requestOptions: RequestInit = {
830
+ // method: 'POST',
831
+ // body: JSON.stringify(payload),
832
+ // headers: {
833
+ // 'Content-Type': 'application/json',
834
+ // x_api_key: apiKey,
835
+ // },
836
+ // };
837
+ // const result = await (
838
+ // await fetch(
839
+ // `${orchestrationAPIUrl}/v2/auth/${sessionToken}/passkey/generate-authentication-options`,
840
+ // requestOptions,
841
+ // )
842
+ // ).json();
843
+ // return result;
844
+ // };
845
+ // export const verifyAuthPasskey = async ({
846
+ // uuid,
847
+ // sessionToken,
848
+ // data, // Generate passkey options
849
+ // }: {
850
+ // uuid: string;
851
+ // sessionToken: string;
852
+ // data: any;
853
+ // }) => {
854
+ // const payload = { uuid, data };
855
+ // const requestOptions: RequestInit = {
856
+ // method: 'POST',
857
+ // body: JSON.stringify(payload),
858
+ // headers: {
859
+ // 'Content-Type': 'application/json',
860
+ // x_api_key: apiKey,
861
+ // },
862
+ // };
863
+ // const result = await (
864
+ // await fetch(`${orchestrationAPIUrl}/v2/auth-session/${sessionToken}/passkey/verify-authentication`, requestOptions)
865
+ // ).json();
866
+ // return result;
867
+ // };
868
+ export const createDocumentDL = ({ baseUrl, token }) => __awaiter(void 0, void 0, void 0, function* () {
869
+ const requestOptions = {
870
+ method: 'POST',
871
+ headers: {
872
+ 'Content-Type': 'application/json',
873
+ },
874
+ };
875
+ const result = yield (yield fetch(`${baseUrl}/${token}/document/drivers_license`, requestOptions)).json();
876
+ return result;
877
+ });
878
+ export const updateDocumentDetails = ({ baseUrl, token, documentId, params, }) => __awaiter(void 0, void 0, void 0, function* () {
879
+ const requestOptions = {
880
+ method: 'PUT',
881
+ headers: {
882
+ 'Content-Type': 'application/json',
883
+ },
884
+ body: JSON.stringify(params),
885
+ };
886
+ const result = yield (yield fetch(`${baseUrl}/v2/verification-session/${token}/document/${documentId}`, requestOptions)).json();
887
+ return result;
888
+ });
889
+ export var documentImageTypeEnum;
890
+ (function (documentImageTypeEnum) {
891
+ documentImageTypeEnum["FRONTDLORIGINAL"] = "front";
892
+ documentImageTypeEnum["FRONTDLHEADSHOT"] = "front_mugshot";
893
+ documentImageTypeEnum["FRONTDLCROPPED"] = "front_cropped_document";
894
+ documentImageTypeEnum["BACKDLORIGINAL"] = "back";
895
+ documentImageTypeEnum["BACKDLCROPPED"] = "back_cropped_document";
896
+ documentImageTypeEnum["BACKDLBARCODE"] = "back_barcode";
897
+ })(documentImageTypeEnum || (documentImageTypeEnum = {}));
898
+ export const uploadDocumentImage = ({ baseUrl, token, documentId, params, }) => __awaiter(void 0, void 0, void 0, function* () {
899
+ const pngBase64 = params.data;
900
+ const jpegBase64 = yield convertPngBase64ToJpegBase64(pngBase64);
901
+ const requestOptions = {
902
+ method: 'POST',
903
+ headers: {
904
+ 'Content-Type': 'application/json',
905
+ },
906
+ body: JSON.stringify(Object.assign(Object.assign({}, params), { data: jpegBase64 })),
907
+ };
908
+ const result = yield (yield fetch(`${baseUrl}/v2/verification-session/${token}/${documentId}/img`, requestOptions)).json();
909
+ return result;
910
+ });
911
+ // Update User Details
912
+ export const updateUserDetails = ({ baseUrl, token, params, }) => __awaiter(void 0, void 0, void 0, function* () {
913
+ const requestOptions = {
914
+ method: 'POST',
915
+ headers: {
916
+ 'Content-Type': 'application/json',
917
+ },
918
+ body: JSON.stringify(params),
919
+ };
920
+ const result = yield (yield fetch(`${baseUrl}/v2/verification-session/${token}/user/update`, requestOptions)).json();
921
+ return result;
922
+ });
922
923
  //# sourceMappingURL=apiUtils.js.map