@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
@@ -1,331 +1,333 @@
1
- import { printLogs } from './utils';
2
- export var callbackTypeEnum;
3
- (function (callbackTypeEnum) {
4
- callbackTypeEnum["isValid"] = "isValid";
5
- callbackTypeEnum["predict"] = "predict";
6
- callbackTypeEnum["enroll"] = "enroll";
7
- callbackTypeEnum["frontScan"] = "frontScan";
8
- callbackTypeEnum["passportScan"] = "passportScan";
9
- callbackTypeEnum["documentScanNoFace"] = "documentScanNoFace";
10
- callbackTypeEnum["backScan"] = "backScan";
11
- callbackTypeEnum["faceLogin"] = "faceLogin";
12
- callbackTypeEnum["faceISO"] = "faceISO";
13
- callbackTypeEnum["delete"] = "delete";
14
- callbackTypeEnum["documentOcr"] = "documentOcr";
15
- callbackTypeEnum["continuousPredict"] = "continuousPredict";
16
- callbackTypeEnum["ageEstimation"] = "ageEstimation";
17
- callbackTypeEnum["faceCompare"] = "faceCompare";
18
- callbackTypeEnum["faceCompareDocumentAndFace"] = "faceCompareDocumentAndFace";
19
- callbackTypeEnum["compareEmbeddings"] = "compareEmbeddings";
20
- })(callbackTypeEnum || (callbackTypeEnum = {}));
21
- export const createCallback = ({ type, callbackFunction, returnType, imageData, portrait, isMobile, }) => {
22
- const createCallbackIsValid = ({ callback, returnType }) => (operation, id, response_str) => {
23
- const isResponse = response_str.length > 0;
24
- printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
25
- printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
26
- printLogs(`[JS RESPONSE]: id: `, id || 'null');
27
- if (isResponse) {
28
- const returnValue = JSON.parse(response_str);
29
- const returnData = {
30
- call_status: returnValue.call_status.return_status,
31
- face_validation_status: returnValue.faces.faces[0].face_validation_status,
32
- antispoof_status: returnValue.faces.faces[0].antispoofing_status,
33
- };
34
- if (operation === 'validate_face') {
35
- if (returnType && returnType === 'all') {
36
- callback(returnValue);
37
- }
38
- else {
39
- callback(returnData);
40
- }
41
- }
42
- }
43
- };
44
- const createCallbackEnroll = ({ callback, returnType }) => (operation, id, response_str) => {
45
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
46
- const isResponse = response_str.length > 0;
47
- printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
48
- printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
49
- printLogs(`[JS RESPONSE]: id: `, id || 'null');
50
- if (isResponse) {
51
- const returnValue = JSON.parse(response_str);
52
- if (operation === 'user_enroll') {
53
- const returnData = {
54
- mf_token: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.mf_token,
55
- callback_status: (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _b === void 0 ? void 0 : _b.return_status,
56
- face_validation_status: (_d = (_c = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _c === void 0 ? void 0 : _c.face) === null || _d === void 0 ? void 0 : _d.face_validation_status,
57
- antispoof_status: (_f = (_e = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _e === void 0 ? void 0 : _e.face) === null || _f === void 0 ? void 0 : _f.antispoofing_status,
58
- encrypted_embeddings: (_g = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _g === void 0 ? void 0 : _g.embedding,
59
- iso_image: (_k = (_j = (_h = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _h === void 0 ? void 0 : _h.cropped_images) === null || _j === void 0 ? void 0 : _j.items) === null || _k === void 0 ? void 0 : _k.iso,
60
- api_response: (_l = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _l === void 0 ? void 0 : _l.response,
61
- face_position: (_o = (_m = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _m === void 0 ? void 0 : _m.face) === null || _o === void 0 ? void 0 : _o.face_position,
62
- };
63
- if (returnType && returnType === 'all') {
64
- callback(returnValue);
65
- }
66
- else {
67
- callback(returnData);
68
- }
69
- }
70
- }
71
- };
72
- const createCallbackPredict = ({ callback, returnType }) => (operation, id, response_str) => {
73
- var _a, _b, _c, _d, _e, _f, _g, _h;
74
- const isResponse = response_str.length > 0;
75
- printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
76
- printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
77
- printLogs(`[JS RESPONSE]: id: `, id || 'null');
78
- if (isResponse) {
79
- const returnValue = JSON.parse(response_str);
80
- const cache_content = returnValue.uber_operation_result.cache_content;
81
- if (cache_content) {
82
- localStorage.setItem('cache_content', cache_content);
83
- }
84
- const returnData = {
85
- mf_token: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.mf_token,
86
- callback_status: (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _b === void 0 ? void 0 : _b.return_status,
87
- face_validation_status: (_d = (_c = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _c === void 0 ? void 0 : _c.face) === null || _d === void 0 ? void 0 : _d.face_validation_status,
88
- antispoof_status: (_f = (_e = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _e === void 0 ? void 0 : _e.face) === null || _f === void 0 ? void 0 : _f.antispoofing_status,
89
- api_response: (_g = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _g === void 0 ? void 0 : _g.response,
90
- encrypted_embeddings: (_h = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _h === void 0 ? void 0 : _h.embedding,
91
- cache_content: cache_content,
92
- };
93
- if (operation === 'user_predict') {
94
- if (returnType && returnType === 'all') {
95
- callback(returnValue);
96
- }
97
- else {
98
- callback(returnData);
99
- }
100
- }
101
- }
102
- };
103
- const createCallbackFrontDlScan = ({ callback, returnType, inputImage }) => (operation, id, response_str) => {
104
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
105
- const isResponse = response_str.length > 0;
106
- printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
107
- printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
108
- printLogs(`[JS RESPONSE]: id: `, id || 'null');
109
- if (isResponse) {
110
- if (operation === 'doc_scan_front') {
111
- const returnValue = JSON.parse(response_str);
112
- const returnData = {
113
- callback_status: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.return_status,
114
- doc_validation_status: (_c = (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _b === void 0 ? void 0 : _b.document) === null || _c === void 0 ? void 0 : _c.document_validation_status,
115
- cropped_document: (_f = (_e = (_d = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _d === void 0 ? void 0 : _d.cropped_images) === null || _e === void 0 ? void 0 : _e.items) === null || _f === void 0 ? void 0 : _f.document,
116
- cropped_mugshot: (_j = (_h = (_g = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _g === void 0 ? void 0 : _g.cropped_images) === null || _h === void 0 ? void 0 : _h.items) === null || _j === void 0 ? void 0 : _j.mugshot,
117
- input_image: ((_l = (_k = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _k === void 0 ? void 0 : _k.document) === null || _l === void 0 ? void 0 : _l.document_validation_status) === 0 ? inputImage : undefined,
118
- embedding: (_m = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _m === void 0 ? void 0 : _m.embedding,
119
- api_request: (_o = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _o === void 0 ? void 0 : _o.request,
120
- barcode_detection_status: ((_q = (_p = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _p === void 0 ? void 0 : _p.barcode) === null || _q === void 0 ? void 0 : _q.bar_code_detection_status) === 0,
121
- };
122
- if (returnType === 'all') {
123
- callback(returnValue);
124
- }
125
- else {
126
- callback(returnData);
127
- }
128
- }
129
- }
130
- };
131
- const createCallbackPassportScan = ({ callback, returnType }) => (operation, id, response_str) => {
132
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
133
- const isResponse = response_str.length > 0;
134
- printLogs(`[JS RESPONSE]: Passport response_str': `, isResponse ? JSON.parse(response_str) : '');
135
- printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
136
- printLogs(`[JS RESPONSE]: id: `, id || 'null');
137
- if (isResponse) {
138
- if (operation === 'doc_scan_front') {
139
- const returnValue = JSON.parse(response_str);
140
- const returnData = {
141
- callback_status: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.return_status,
142
- doc_validation_status: (_c = (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _b === void 0 ? void 0 : _b.document) === null || _c === void 0 ? void 0 : _c.document_validation_status,
143
- cropped_document: (_f = (_e = (_d = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _d === void 0 ? void 0 : _d.cropped_images) === null || _e === void 0 ? void 0 : _e.items) === null || _f === void 0 ? void 0 : _f.document,
144
- cropped_mugshot: (_j = (_h = (_g = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _g === void 0 ? void 0 : _g.cropped_images) === null || _h === void 0 ? void 0 : _h.items) === null || _j === void 0 ? void 0 : _j.mugshot,
145
- embedding: (_k = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _k === void 0 ? void 0 : _k.embedding,
146
- mrz_text_detected: ((_m = (_l = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _l === void 0 ? void 0 : _l.document) === null || _m === void 0 ? void 0 : _m.mrz_text.length) > 0,
147
- };
148
- if (returnType === 'all') {
149
- callback(returnValue);
150
- }
151
- else {
152
- callback(returnData);
153
- }
154
- }
155
- }
156
- };
157
- const createCallbackDelete = ({ callback }) => (operation, id, response_str) => {
158
- const isResponse = response_str.length > 0;
159
- printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
160
- printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
161
- printLogs(`[JS RESPONSE]: id: `, id || 'null');
162
- if (isResponse) {
163
- const returnValue = JSON.parse(response_str);
164
- const returnData = {
165
- call_status: returnValue.call_status.return_status,
166
- delete_status: returnValue.user_delete.status,
167
- delete_message: returnValue.user_delete.message,
168
- };
169
- if (operation === 'delete') {
170
- callback(returnData);
171
- }
172
- }
173
- };
174
- const createCallbackPredictAge = ({ callback, portrait, returnType }) => (operation, id, response_str) => {
175
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
176
- const isResponse = response_str.length > 0;
177
- printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
178
- printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
179
- printLogs(`[JS RESPONSE]: id: `, id || 'null');
180
- if (isResponse) {
181
- const returnValue = JSON.parse(response_str);
182
- const returnData = {
183
- mf_token: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.mf_token,
184
- face_validation_status: (_c = (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _b === void 0 ? void 0 : _b.face) === null || _c === void 0 ? void 0 : _c.face_validation_status,
185
- antispoof_status: (_e = (_d = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _d === void 0 ? void 0 : _d.face) === null || _e === void 0 ? void 0 : _e.antispoofing_status,
186
- call_status: (_f = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _f === void 0 ? void 0 : _f.return_status,
187
- api_request: (_g = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _g === void 0 ? void 0 : _g.request,
188
- embedding: (_h = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _h === void 0 ? void 0 : _h.embedding,
189
- remove_glasses: (_j = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _j === void 0 ? void 0 : _j.young_person_with_glasses,
190
- };
191
- if (operation === 'estimate_age') {
192
- if (returnType && returnType === 'all') {
193
- callback(Object.assign(Object.assign({}, returnValue), { portrait }));
194
- }
195
- else {
196
- callback(Object.assign(Object.assign({}, returnData), { portrait }));
197
- }
198
- }
199
- }
200
- };
201
- const createCallbackCompareDocumentAndFace = ({ callback, returnType }) => (operation, id, response_str) => {
202
- const isResponse = response_str.length > 0;
203
- printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
204
- printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
205
- printLogs(`[JS RESPONSE]: id: `, id || 'null');
206
- if (isResponse) {
207
- if (operation === 'compare_mugshot_and_face') {
208
- const returnValue = JSON.parse(response_str);
209
- const returnData = {
210
- image_a_face_validation_status: returnValue.face_compare.a_face_validation_status,
211
- image_b_face_validation_status: returnValue.face_compare.b_face_validation_status,
212
- call_status: returnValue.call_status.return_status,
213
- compare_score: returnValue.face_compare.conf_score,
214
- compare_status: returnValue.face_compare.result,
215
- };
216
- if (returnType === 'all') {
217
- callback(returnValue);
218
- }
219
- else {
220
- callback(returnData);
221
- }
222
- }
223
- }
224
- };
225
- const createCallbackBackDlScan = ({ callback, returnType, isMobile = false }) => (operation, id, response_str) => {
226
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
227
- const isResponse = response_str.length > 0;
228
- printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
229
- printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
230
- printLogs(`[JS RESPONSE]: id: `, id || 'null');
231
- if (isResponse) {
232
- const returnValue = JSON.parse(response_str);
233
- const returnData = {
234
- callback_status: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.return_status,
235
- doc_validation_status: (_c = (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _b === void 0 ? void 0 : _b.document) === null || _c === void 0 ? void 0 : _c.document_validation_status,
236
- barcode_detection_status: (_e = (_d = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _d === void 0 ? void 0 : _d.barcode) === null || _e === void 0 ? void 0 : _e.bar_code_detection_status,
237
- cropped_document_base64: (_h = (_g = (_f = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _f === void 0 ? void 0 : _f.cropped_images) === null || _g === void 0 ? void 0 : _g.items) === null || _h === void 0 ? void 0 : _h.document,
238
- cropped_barcode_base64: (_l = (_k = (_j = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _j === void 0 ? void 0 : _j.cropped_images) === null || _k === void 0 ? void 0 : _k.items) === null || _l === void 0 ? void 0 : _l.barcode,
239
- barcode_data: (_o = (_m = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _m === void 0 ? void 0 : _m.barcode) === null || _o === void 0 ? void 0 : _o.barcode_data,
240
- is_mobile: isMobile,
241
- };
242
- if (operation === 'doc_scan_back') {
243
- if (returnType && returnType === 'all') {
244
- callback(returnValue);
245
- }
246
- else {
247
- callback(returnData);
248
- }
249
- }
250
- }
251
- };
252
- const createCallbackCompareEmbeddings = ({ callback, returnType }) => (operation, id, response_str) => {
253
- var _a, _b, _c, _d, _e;
254
- const isResponse = response_str.length > 0;
255
- printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
256
- printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
257
- printLogs(`[JS RESPONSE]: id: `, id || 'null');
258
- if (isResponse) {
259
- if (operation === 'compare_embeddings') {
260
- const returnValue = JSON.parse(response_str);
261
- const returnData = {
262
- confidence_score: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _a === void 0 ? void 0 : _a.confidence_score,
263
- call_status: (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _b === void 0 ? void 0 : _b.return_status,
264
- call_status_message: (_c = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _c === void 0 ? void 0 : _c.return_message,
265
- is_same_face: (_d = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _d === void 0 ? void 0 : _d.is_same_face,
266
- api_request: (_e = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _e === void 0 ? void 0 : _e.request,
267
- };
268
- if (returnType === 'all') {
269
- callback(returnValue);
270
- }
271
- else {
272
- callback(returnData);
273
- }
274
- }
275
- }
276
- };
277
- const createCallbackDocumentOcr = ({ callback }) => (operation, id, response_str) => {
278
- var _a, _b, _c;
279
- const isResponse = response_str.length > 0;
280
- printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
281
- printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
282
- printLogs(`[JS RESPONSE]: id: `, id || 'null');
283
- if (isResponse) {
284
- if (operation === 'doc_ocr_front') {
285
- const returnValue = JSON.parse(response_str);
286
- const returnData = {
287
- api_request: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _a === void 0 ? void 0 : _a.request,
288
- call_status: (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _b === void 0 ? void 0 : _b.return_status,
289
- call_status_message: (_c = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _c === void 0 ? void 0 : _c.return_message,
290
- };
291
- if (returnType === 'all') {
292
- callback(returnValue);
293
- }
294
- else {
295
- callback(returnData);
296
- }
297
- }
298
- }
299
- };
300
- switch (type) {
301
- case callbackTypeEnum.isValid:
302
- return createCallbackIsValid({ callback: callbackFunction });
303
- case callbackTypeEnum.enroll:
304
- return createCallbackEnroll({ callback: callbackFunction });
305
- case callbackTypeEnum.predict:
306
- return createCallbackPredict({ callback: callbackFunction });
307
- case callbackTypeEnum.faceLogin:
308
- return createCallbackPredict({ callback: callbackFunction });
309
- case callbackTypeEnum.continuousPredict:
310
- return createCallbackPredict({ callback: callbackFunction });
311
- case callbackTypeEnum.delete:
312
- return createCallbackDelete({ callback: callbackFunction });
313
- case callbackTypeEnum.frontScan:
314
- return createCallbackFrontDlScan({ callback: callbackFunction, inputImage: imageData });
315
- case callbackTypeEnum.backScan:
316
- return createCallbackBackDlScan({ callback: callbackFunction, returnType, isMobile });
317
- case callbackTypeEnum.faceCompareDocumentAndFace:
318
- return createCallbackCompareDocumentAndFace({ callback: callbackFunction });
319
- case callbackTypeEnum.compareEmbeddings:
320
- return createCallbackCompareEmbeddings({ callback: callbackFunction, returnType });
321
- case callbackTypeEnum.ageEstimation:
322
- return createCallbackPredictAge({ callback: callbackFunction, portrait, returnType });
323
- case callbackTypeEnum.passportScan:
324
- return createCallbackPassportScan({ callback: callbackFunction });
325
- case callbackTypeEnum.documentOcr:
326
- return createCallbackDocumentOcr({ callback: callbackFunction });
327
- default:
328
- return null;
329
- }
330
- };
1
+ /* eslint-disable */
2
+ import { printLogs } from './utils';
3
+ export var callbackTypeEnum;
4
+ (function (callbackTypeEnum) {
5
+ callbackTypeEnum["isValid"] = "isValid";
6
+ callbackTypeEnum["predict"] = "predict";
7
+ callbackTypeEnum["enroll"] = "enroll";
8
+ callbackTypeEnum["frontScan"] = "frontScan";
9
+ callbackTypeEnum["passportScan"] = "passportScan";
10
+ callbackTypeEnum["documentScanNoFace"] = "documentScanNoFace";
11
+ callbackTypeEnum["backScan"] = "backScan";
12
+ callbackTypeEnum["faceLogin"] = "faceLogin";
13
+ callbackTypeEnum["faceISO"] = "faceISO";
14
+ callbackTypeEnum["delete"] = "delete";
15
+ callbackTypeEnum["documentOcr"] = "documentOcr";
16
+ callbackTypeEnum["continuousPredict"] = "continuousPredict";
17
+ callbackTypeEnum["ageEstimation"] = "ageEstimation";
18
+ callbackTypeEnum["faceCompare"] = "faceCompare";
19
+ callbackTypeEnum["faceCompareDocumentAndFace"] = "faceCompareDocumentAndFace";
20
+ callbackTypeEnum["compareEmbeddings"] = "compareEmbeddings";
21
+ })(callbackTypeEnum || (callbackTypeEnum = {}));
22
+ export const createCallback = ({ type, callbackFunction, returnType, imageData, portrait, isMobile, }) => {
23
+ const createCallbackIsValid = ({ callback, returnType }) => (operation, id, response_str) => {
24
+ const isResponse = response_str.length > 0;
25
+ printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
26
+ printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
27
+ printLogs(`[JS RESPONSE]: id: `, id || 'null');
28
+ if (isResponse) {
29
+ const returnValue = JSON.parse(response_str);
30
+ const returnData = {
31
+ call_status: returnValue.call_status.return_status,
32
+ face_validation_status: returnValue.faces.faces[0].face_validation_status,
33
+ antispoof_status: returnValue.faces.faces[0].antispoofing_status,
34
+ };
35
+ if (operation === 'validate_face') {
36
+ if (returnType && returnType === 'all') {
37
+ callback(returnValue);
38
+ }
39
+ else {
40
+ callback(returnData);
41
+ }
42
+ }
43
+ }
44
+ };
45
+ const createCallbackEnroll = ({ callback, returnType }) => (operation, id, response_str) => {
46
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
47
+ const isResponse = response_str.length > 0;
48
+ printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
49
+ printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
50
+ printLogs(`[JS RESPONSE]: id: `, id || 'null');
51
+ if (isResponse) {
52
+ const returnValue = JSON.parse(response_str);
53
+ if (operation === 'user_enroll') {
54
+ const returnData = {
55
+ mf_token: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.mf_token,
56
+ callback_status: (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _b === void 0 ? void 0 : _b.return_status,
57
+ face_validation_status: (_d = (_c = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _c === void 0 ? void 0 : _c.face) === null || _d === void 0 ? void 0 : _d.face_validation_status,
58
+ antispoof_status: (_f = (_e = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _e === void 0 ? void 0 : _e.face) === null || _f === void 0 ? void 0 : _f.antispoofing_status,
59
+ encrypted_embeddings: (_g = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _g === void 0 ? void 0 : _g.embedding,
60
+ iso_image: (_k = (_j = (_h = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _h === void 0 ? void 0 : _h.cropped_images) === null || _j === void 0 ? void 0 : _j.items) === null || _k === void 0 ? void 0 : _k.iso,
61
+ api_response: (_l = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _l === void 0 ? void 0 : _l.response,
62
+ face_position: (_o = (_m = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _m === void 0 ? void 0 : _m.face) === null || _o === void 0 ? void 0 : _o.face_position,
63
+ };
64
+ if (returnType && returnType === 'all') {
65
+ callback(returnValue);
66
+ }
67
+ else {
68
+ callback(returnData);
69
+ }
70
+ }
71
+ }
72
+ };
73
+ const createCallbackPredict = ({ callback, returnType }) => (operation, id, response_str) => {
74
+ var _a, _b, _c, _d, _e, _f, _g, _h;
75
+ const isResponse = response_str.length > 0;
76
+ printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
77
+ printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
78
+ printLogs(`[JS RESPONSE]: id: `, id || 'null');
79
+ if (isResponse) {
80
+ const returnValue = JSON.parse(response_str);
81
+ const cache_content = returnValue.uber_operation_result.cache_content;
82
+ if (cache_content) {
83
+ localStorage.setItem('cache_content', cache_content);
84
+ }
85
+ const returnData = {
86
+ mf_token: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.mf_token,
87
+ callback_status: (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _b === void 0 ? void 0 : _b.return_status,
88
+ face_validation_status: (_d = (_c = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _c === void 0 ? void 0 : _c.face) === null || _d === void 0 ? void 0 : _d.face_validation_status,
89
+ antispoof_status: (_f = (_e = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _e === void 0 ? void 0 : _e.face) === null || _f === void 0 ? void 0 : _f.antispoofing_status,
90
+ api_response: (_g = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _g === void 0 ? void 0 : _g.response,
91
+ encrypted_embeddings: (_h = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _h === void 0 ? void 0 : _h.embedding,
92
+ cache_content: cache_content,
93
+ };
94
+ if (operation === 'user_predict') {
95
+ if (returnType && returnType === 'all') {
96
+ callback(returnValue);
97
+ }
98
+ else {
99
+ callback(returnData);
100
+ }
101
+ }
102
+ }
103
+ };
104
+ const createCallbackFrontDlScan = ({ callback, returnType, inputImage }) => (operation, id, response_str) => {
105
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
106
+ const isResponse = response_str.length > 0;
107
+ printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
108
+ printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
109
+ printLogs(`[JS RESPONSE]: id: `, id || 'null');
110
+ if (isResponse) {
111
+ if (operation === 'doc_scan_front') {
112
+ const returnValue = JSON.parse(response_str);
113
+ const returnData = {
114
+ callback_status: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.return_status,
115
+ doc_validation_status: (_c = (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _b === void 0 ? void 0 : _b.document) === null || _c === void 0 ? void 0 : _c.document_validation_status,
116
+ cropped_document: (_f = (_e = (_d = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _d === void 0 ? void 0 : _d.cropped_images) === null || _e === void 0 ? void 0 : _e.items) === null || _f === void 0 ? void 0 : _f.document,
117
+ cropped_mugshot: (_j = (_h = (_g = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _g === void 0 ? void 0 : _g.cropped_images) === null || _h === void 0 ? void 0 : _h.items) === null || _j === void 0 ? void 0 : _j.mugshot,
118
+ input_image: ((_l = (_k = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _k === void 0 ? void 0 : _k.document) === null || _l === void 0 ? void 0 : _l.document_validation_status) === 0 ? inputImage : undefined,
119
+ embedding: (_m = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _m === void 0 ? void 0 : _m.embedding,
120
+ api_request: (_o = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _o === void 0 ? void 0 : _o.request,
121
+ barcode_detection_status: ((_q = (_p = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _p === void 0 ? void 0 : _p.barcode) === null || _q === void 0 ? void 0 : _q.bar_code_detection_status) === 0,
122
+ };
123
+ if (returnType === 'all') {
124
+ callback(returnValue);
125
+ }
126
+ else {
127
+ callback(returnData);
128
+ }
129
+ }
130
+ }
131
+ };
132
+ const createCallbackPassportScan = ({ callback, returnType }) => (operation, id, response_str) => {
133
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
134
+ const isResponse = response_str.length > 0;
135
+ printLogs(`[JS RESPONSE]: Passport response_str': `, isResponse ? JSON.parse(response_str) : '');
136
+ printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
137
+ printLogs(`[JS RESPONSE]: id: `, id || 'null');
138
+ if (isResponse) {
139
+ if (operation === 'doc_scan_front') {
140
+ const returnValue = JSON.parse(response_str);
141
+ const returnData = {
142
+ callback_status: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.return_status,
143
+ doc_validation_status: (_c = (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _b === void 0 ? void 0 : _b.document) === null || _c === void 0 ? void 0 : _c.document_validation_status,
144
+ cropped_document: (_f = (_e = (_d = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _d === void 0 ? void 0 : _d.cropped_images) === null || _e === void 0 ? void 0 : _e.items) === null || _f === void 0 ? void 0 : _f.document,
145
+ cropped_mugshot: (_j = (_h = (_g = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _g === void 0 ? void 0 : _g.cropped_images) === null || _h === void 0 ? void 0 : _h.items) === null || _j === void 0 ? void 0 : _j.mugshot,
146
+ embedding: (_k = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _k === void 0 ? void 0 : _k.embedding,
147
+ mrz_text_detected: ((_m = (_l = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _l === void 0 ? void 0 : _l.document) === null || _m === void 0 ? void 0 : _m.mrz_text.length) > 0,
148
+ };
149
+ if (returnType === 'all') {
150
+ callback(returnValue);
151
+ }
152
+ else {
153
+ callback(returnData);
154
+ }
155
+ }
156
+ }
157
+ };
158
+ const createCallbackDelete = ({ callback }) => (operation, id, response_str) => {
159
+ const isResponse = response_str.length > 0;
160
+ printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
161
+ printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
162
+ printLogs(`[JS RESPONSE]: id: `, id || 'null');
163
+ if (isResponse) {
164
+ const returnValue = JSON.parse(response_str);
165
+ const returnData = {
166
+ call_status: returnValue.call_status.return_status,
167
+ delete_status: returnValue.user_delete.status,
168
+ delete_message: returnValue.user_delete.message,
169
+ };
170
+ if (operation === 'delete') {
171
+ callback(returnData);
172
+ }
173
+ }
174
+ };
175
+ const createCallbackPredictAge = ({ callback, portrait, returnType }) => (operation, id, response_str) => {
176
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
177
+ const isResponse = response_str.length > 0;
178
+ printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
179
+ printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
180
+ printLogs(`[JS RESPONSE]: id: `, id || 'null');
181
+ if (isResponse) {
182
+ const returnValue = JSON.parse(response_str);
183
+ const returnData = {
184
+ mf_token: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.mf_token,
185
+ face_validation_status: (_c = (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _b === void 0 ? void 0 : _b.face) === null || _c === void 0 ? void 0 : _c.face_validation_status,
186
+ antispoof_status: (_e = (_d = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _d === void 0 ? void 0 : _d.face) === null || _e === void 0 ? void 0 : _e.antispoofing_status,
187
+ call_status: (_f = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _f === void 0 ? void 0 : _f.return_status,
188
+ api_request: (_g = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _g === void 0 ? void 0 : _g.request,
189
+ embedding: (_h = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _h === void 0 ? void 0 : _h.embedding,
190
+ remove_glasses: (_j = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _j === void 0 ? void 0 : _j.young_person_with_glasses,
191
+ execution_time_ms: (_k = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _k === void 0 ? void 0 : _k.execution_time_ms,
192
+ };
193
+ if (operation === 'estimate_age') {
194
+ if (returnType && returnType === 'all') {
195
+ callback(Object.assign(Object.assign({}, returnValue), { portrait }));
196
+ }
197
+ else {
198
+ callback(Object.assign(Object.assign({}, returnData), { portrait }));
199
+ }
200
+ }
201
+ }
202
+ };
203
+ const createCallbackCompareDocumentAndFace = ({ callback, returnType }) => (operation, id, response_str) => {
204
+ const isResponse = response_str.length > 0;
205
+ printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
206
+ printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
207
+ printLogs(`[JS RESPONSE]: id: `, id || 'null');
208
+ if (isResponse) {
209
+ if (operation === 'compare_mugshot_and_face') {
210
+ const returnValue = JSON.parse(response_str);
211
+ const returnData = {
212
+ image_a_face_validation_status: returnValue.face_compare.a_face_validation_status,
213
+ image_b_face_validation_status: returnValue.face_compare.b_face_validation_status,
214
+ call_status: returnValue.call_status.return_status,
215
+ compare_score: returnValue.face_compare.conf_score,
216
+ compare_status: returnValue.face_compare.result,
217
+ };
218
+ if (returnType === 'all') {
219
+ callback(returnValue);
220
+ }
221
+ else {
222
+ callback(returnData);
223
+ }
224
+ }
225
+ }
226
+ };
227
+ const createCallbackBackDlScan = ({ callback, returnType, isMobile = false }) => (operation, id, response_str) => {
228
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
229
+ const isResponse = response_str.length > 0;
230
+ printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
231
+ printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
232
+ printLogs(`[JS RESPONSE]: id: `, id || 'null');
233
+ if (isResponse) {
234
+ const returnValue = JSON.parse(response_str);
235
+ const returnData = {
236
+ callback_status: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _a === void 0 ? void 0 : _a.return_status,
237
+ doc_validation_status: (_c = (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _b === void 0 ? void 0 : _b.document) === null || _c === void 0 ? void 0 : _c.document_validation_status,
238
+ barcode_detection_status: (_e = (_d = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _d === void 0 ? void 0 : _d.barcode) === null || _e === void 0 ? void 0 : _e.bar_code_detection_status,
239
+ cropped_document_base64: (_h = (_g = (_f = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _f === void 0 ? void 0 : _f.cropped_images) === null || _g === void 0 ? void 0 : _g.items) === null || _h === void 0 ? void 0 : _h.document,
240
+ cropped_barcode_base64: (_l = (_k = (_j = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _j === void 0 ? void 0 : _j.cropped_images) === null || _k === void 0 ? void 0 : _k.items) === null || _l === void 0 ? void 0 : _l.barcode,
241
+ barcode_data: (_o = (_m = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _m === void 0 ? void 0 : _m.barcode) === null || _o === void 0 ? void 0 : _o.barcode_data,
242
+ is_mobile: isMobile,
243
+ };
244
+ if (operation === 'doc_scan_back') {
245
+ if (returnType && returnType === 'all') {
246
+ callback(returnValue);
247
+ }
248
+ else {
249
+ callback(returnData);
250
+ }
251
+ }
252
+ }
253
+ };
254
+ const createCallbackCompareEmbeddings = ({ callback, returnType }) => (operation, id, response_str) => {
255
+ var _a, _b, _c, _d, _e;
256
+ const isResponse = response_str.length > 0;
257
+ printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
258
+ printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
259
+ printLogs(`[JS RESPONSE]: id: `, id || 'null');
260
+ if (isResponse) {
261
+ if (operation === 'compare_embeddings') {
262
+ const returnValue = JSON.parse(response_str);
263
+ const returnData = {
264
+ confidence_score: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _a === void 0 ? void 0 : _a.confidence_score,
265
+ call_status: (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _b === void 0 ? void 0 : _b.return_status,
266
+ call_status_message: (_c = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _c === void 0 ? void 0 : _c.return_message,
267
+ is_same_face: (_d = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _d === void 0 ? void 0 : _d.is_same_face,
268
+ api_request: (_e = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _e === void 0 ? void 0 : _e.request,
269
+ };
270
+ if (returnType === 'all') {
271
+ callback(returnValue);
272
+ }
273
+ else {
274
+ callback(returnData);
275
+ }
276
+ }
277
+ }
278
+ };
279
+ const createCallbackDocumentOcr = ({ callback }) => (operation, id, response_str) => {
280
+ var _a, _b, _c;
281
+ const isResponse = response_str.length > 0;
282
+ printLogs(`[JS RESPONSE]: response_str': `, isResponse ? JSON.parse(response_str) : '');
283
+ printLogs(`[JS RESPONSE]: operation': `, operation || 'null');
284
+ printLogs(`[JS RESPONSE]: id: `, id || 'null');
285
+ if (isResponse) {
286
+ if (operation === 'doc_ocr_front') {
287
+ const returnValue = JSON.parse(response_str);
288
+ const returnData = {
289
+ api_request: (_a = returnValue === null || returnValue === void 0 ? void 0 : returnValue.uber_operation_result) === null || _a === void 0 ? void 0 : _a.request,
290
+ call_status: (_b = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _b === void 0 ? void 0 : _b.return_status,
291
+ call_status_message: (_c = returnValue === null || returnValue === void 0 ? void 0 : returnValue.call_status) === null || _c === void 0 ? void 0 : _c.return_message,
292
+ };
293
+ if (returnType === 'all') {
294
+ callback(returnValue);
295
+ }
296
+ else {
297
+ callback(returnData);
298
+ }
299
+ }
300
+ }
301
+ };
302
+ switch (type) {
303
+ case callbackTypeEnum.isValid:
304
+ return createCallbackIsValid({ callback: callbackFunction });
305
+ case callbackTypeEnum.enroll:
306
+ return createCallbackEnroll({ callback: callbackFunction });
307
+ case callbackTypeEnum.predict:
308
+ return createCallbackPredict({ callback: callbackFunction });
309
+ case callbackTypeEnum.faceLogin:
310
+ return createCallbackPredict({ callback: callbackFunction });
311
+ case callbackTypeEnum.continuousPredict:
312
+ return createCallbackPredict({ callback: callbackFunction });
313
+ case callbackTypeEnum.delete:
314
+ return createCallbackDelete({ callback: callbackFunction });
315
+ case callbackTypeEnum.frontScan:
316
+ return createCallbackFrontDlScan({ callback: callbackFunction, inputImage: imageData });
317
+ case callbackTypeEnum.backScan:
318
+ return createCallbackBackDlScan({ callback: callbackFunction, returnType, isMobile });
319
+ case callbackTypeEnum.faceCompareDocumentAndFace:
320
+ return createCallbackCompareDocumentAndFace({ callback: callbackFunction });
321
+ case callbackTypeEnum.compareEmbeddings:
322
+ return createCallbackCompareEmbeddings({ callback: callbackFunction, returnType });
323
+ case callbackTypeEnum.ageEstimation:
324
+ return createCallbackPredictAge({ callback: callbackFunction, portrait, returnType });
325
+ case callbackTypeEnum.passportScan:
326
+ return createCallbackPassportScan({ callback: callbackFunction });
327
+ case callbackTypeEnum.documentOcr:
328
+ return createCallbackDocumentOcr({ callback: callbackFunction });
329
+ default:
330
+ return null;
331
+ }
332
+ };
331
333
  //# sourceMappingURL=createCallback.js.map