@ekyc_qoobiss/qbs-ect-cmp 3.6.27 → 3.6.29

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 (168) hide show
  1. package/dist/cjs/TranslationUtils-b918ffb1.js +346 -0
  2. package/dist/cjs/agreement-check_19.cjs.entry.js +9997 -0
  3. package/dist/cjs/index-41696e0e.js +1573 -0
  4. package/dist/cjs/index.cjs.js +2 -0
  5. package/dist/cjs/loader-dots.cjs.entry.js +19 -0
  6. package/dist/cjs/loader.cjs.js +22 -0
  7. package/dist/cjs/qbs-ect-cmp.cjs.js +23 -0
  8. package/dist/cjs/random-actions.cjs.entry.js +22 -0
  9. package/dist/collection/assets/canvas-masks/face_green.svg +8 -0
  10. package/dist/collection/assets/canvas-masks/face_white.svg +8 -0
  11. package/dist/collection/assets/canvas-masks/id_green.svg +6 -0
  12. package/dist/collection/assets/canvas-masks/id_white.svg +6 -0
  13. package/dist/collection/assets/complete.svg +4 -0
  14. package/dist/collection/assets/landing/device.svg +14 -0
  15. package/dist/collection/assets/landing/id.svg +3 -0
  16. package/dist/collection/assets/landing/info.svg +3 -0
  17. package/dist/collection/assets/landing/validation.svg +16 -0
  18. package/dist/collection/assets/loader.svg +29 -0
  19. package/dist/collection/collection-manifest.json +32 -0
  20. package/dist/collection/components/base-component.js +59 -0
  21. package/dist/collection/components/common/agreement-check/agreement-check.css +0 -0
  22. package/dist/collection/components/common/agreement-check/agreement-check.js +108 -0
  23. package/dist/collection/components/common/camera-error/camera-error.css +0 -0
  24. package/dist/collection/components/common/camera-error/camera-error.js +93 -0
  25. package/dist/collection/components/common/capture-error/capture-error.css +0 -0
  26. package/dist/collection/components/common/capture-error/capture-error.js +102 -0
  27. package/dist/collection/components/common/how-to-info/how-to-info.css +0 -0
  28. package/dist/collection/components/common/how-to-info/how-to-info.js +123 -0
  29. package/dist/collection/components/common/id-back-capture/id-back-capture.css +35 -0
  30. package/dist/{qbs-ect-cmp/id-back-capture.entry.js → collection/components/common/id-back-capture/id-back-capture.js} +102 -30
  31. package/dist/collection/components/common/id-capture/id-capture.css +35 -0
  32. package/dist/{qbs-ect-cmp/id-capture.entry.js → collection/components/common/id-capture/id-capture.js} +100 -28
  33. package/dist/collection/components/common/id-tilt/id-tilt.css +35 -0
  34. package/dist/{qbs-ect-cmp/id-tilt.entry.js → collection/components/common/id-tilt/id-tilt.js} +100 -28
  35. package/dist/collection/components/common/random-actions/random-actions.css +0 -0
  36. package/dist/collection/components/common/random-actions/random-actions.js +23 -0
  37. package/dist/collection/components/common/selfie-capture/selfie-capture.css +7 -0
  38. package/dist/{qbs-ect-cmp/selfie-capture.entry.js → collection/components/common/selfie-capture/selfie-capture.js} +102 -29
  39. package/dist/collection/components/common/selfie-tilt/selfie-tilt.css +7 -0
  40. package/dist/{qbs-ect-cmp/selfie-tilt.entry.js → collection/components/common/selfie-tilt/selfie-tilt.js} +103 -30
  41. package/dist/collection/components/controls/camera/camera.css +47 -0
  42. package/dist/collection/components/controls/camera/camera.js +289 -0
  43. package/dist/collection/components/controls/loader-dots/loader-dots.css +61 -0
  44. package/dist/collection/components/controls/loader-dots/loader-dots.js +18 -0
  45. package/dist/collection/components/flow/agreement-info/agreement-info.css +0 -0
  46. package/dist/collection/components/flow/agreement-info/agreement-info.js +107 -0
  47. package/dist/collection/components/flow/end-redirect/end-redirect.css +128 -0
  48. package/dist/collection/components/flow/end-redirect/end-redirect.js +48 -0
  49. package/dist/collection/components/flow/error-end/error-end.css +0 -0
  50. package/dist/collection/components/flow/error-end/error-end.js +61 -0
  51. package/dist/collection/components/flow/landing-validation/landing-validation.css +0 -0
  52. package/dist/collection/components/flow/landing-validation/landing-validation.js +124 -0
  53. package/dist/collection/components/flow/mobile-redirect/mobile-redirect.css +10 -0
  54. package/dist/collection/components/flow/mobile-redirect/mobile-redirect.js +145 -0
  55. package/dist/collection/components/flow/process-id/process-id.css +0 -0
  56. package/dist/{qbs-ect-cmp/process-id.entry.js → collection/components/flow/process-id/process-id.js} +100 -32
  57. package/dist/collection/components/flow/sms-code-validation/sms-code-validation.css +0 -0
  58. package/dist/collection/components/flow/sms-code-validation/sms-code-validation.js +141 -0
  59. package/dist/collection/components/flow/user-liveness/user-liveness.css +0 -0
  60. package/dist/{qbs-ect-cmp/user-liveness.entry.js → collection/components/flow/user-liveness/user-liveness.js} +91 -25
  61. package/dist/collection/components/identification-component/identification-component.css +991 -0
  62. package/dist/collection/components/identification-component/identification-component.js +408 -0
  63. package/dist/collection/global.js +0 -0
  64. package/dist/collection/helpers/ApiCall.js +223 -0
  65. package/dist/{qbs-ect-cmp/Cameras-dfbebc29.js → collection/helpers/Cameras.js} +6 -9
  66. package/dist/collection/helpers/DeviceDetection.js +85 -0
  67. package/dist/collection/helpers/Events.js +58 -0
  68. package/dist/collection/helpers/ML5.js +38 -0
  69. package/dist/collection/helpers/Stream.js +229 -0
  70. package/dist/collection/helpers/TranslationUtils.js +37 -0
  71. package/dist/collection/helpers/canvas.js +10 -0
  72. package/dist/collection/helpers/index.js +21 -0
  73. package/dist/collection/helpers/security.js +25 -0
  74. package/dist/collection/helpers/store.js +48 -0
  75. package/dist/collection/helpers/textValues.js +48 -0
  76. package/dist/collection/index.js +1 -0
  77. package/dist/collection/libs/FaceML5Detector/FaceML5Detector.js +182 -0
  78. package/dist/collection/libs/FaceML5Detector/FacePose.js +85 -0
  79. package/dist/collection/libs/IDML5Detector/IDML5Detector.js +99 -0
  80. package/dist/{qbs-ect-cmp/IDPose-181bcb25.js → collection/libs/IDML5Detector/IDPose.js} +2 -4
  81. package/dist/{qbs-ect-cmp/CaptureFlow-db5d90a4.js → collection/models/CaptureFlow.js} +4 -6
  82. package/dist/collection/models/FlowStatus.js +14 -0
  83. package/dist/collection/models/FlowSteps.js +30 -0
  84. package/dist/collection/models/IAbortResult.js +1 -0
  85. package/dist/collection/models/IAddRequest.js +1 -0
  86. package/dist/collection/models/IAgreement.js +1 -0
  87. package/dist/collection/models/ICamera.js +1 -0
  88. package/dist/{qbs-ect-cmp/IDevice-15ecfdeb.js → collection/models/IDevice.js} +4 -6
  89. package/dist/collection/models/IEctStore.js +1 -0
  90. package/dist/collection/models/IGeneration.js +1 -0
  91. package/dist/collection/models/ILinkSend.js +1 -0
  92. package/dist/collection/models/ILogResult.js +1 -0
  93. package/dist/collection/models/IOrderStatus.js +1 -0
  94. package/dist/collection/models/IOtpCheck.js +1 -0
  95. package/dist/collection/models/IOtpSend.js +1 -0
  96. package/dist/collection/models/ITranslationValues.js +1 -0
  97. package/dist/collection/models/IUploadFile.js +1 -0
  98. package/dist/collection/models/IVerificationMode.js +5 -0
  99. package/dist/collection/models/OrderStatuses.js +8 -0
  100. package/dist/{qbs-ect-cmp/utils-8225f0b7.js → collection/utils/utils.js} +8 -10
  101. package/dist/{qbs-ect-cmp/textValues-6bcc85dd.js → esm/TranslationUtils-8ceeb437.js} +84 -47
  102. package/dist/esm/agreement-check_19.entry.js +9975 -0
  103. package/dist/esm/index-cf54a432.js +1543 -0
  104. package/dist/esm/index.js +1 -0
  105. package/dist/{qbs-ect-cmp → esm}/loader-dots.entry.js +1 -1
  106. package/dist/esm/loader.js +18 -0
  107. package/dist/esm/polyfills/core-js.js +11 -0
  108. package/dist/esm/polyfills/css-shim.js +1 -0
  109. package/dist/esm/polyfills/dom.js +79 -0
  110. package/dist/esm/polyfills/es5-html-element.js +1 -0
  111. package/dist/esm/polyfills/index.js +34 -0
  112. package/dist/esm/polyfills/system.js +6 -0
  113. package/dist/esm/qbs-ect-cmp.js +18 -0
  114. package/dist/{qbs-ect-cmp → esm}/random-actions.entry.js +6 -9
  115. package/dist/index.cjs.js +1 -0
  116. package/dist/index.js +1 -0
  117. package/dist/loader/cdn.js +3 -0
  118. package/dist/loader/index.cjs.js +3 -0
  119. package/dist/loader/index.d.ts +21 -0
  120. package/dist/loader/index.es2017.js +3 -0
  121. package/dist/loader/index.js +4 -0
  122. package/dist/loader/package.json +11 -0
  123. package/dist/qbs-ect-cmp/index.esm.js +0 -1
  124. package/dist/qbs-ect-cmp/p-054dc5b3.entry.js +1 -0
  125. package/dist/qbs-ect-cmp/p-473a4636.entry.js +1 -0
  126. package/dist/qbs-ect-cmp/p-8942656c.js +2 -0
  127. package/dist/qbs-ect-cmp/p-b2c9c8d7.entry.js +1373 -0
  128. package/dist/qbs-ect-cmp/p-e568a07c.js +1 -0
  129. package/dist/qbs-ect-cmp/qbs-ect-cmp.css +1 -320
  130. package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -148
  131. package/dist/types/components/base-component.d.ts +0 -2
  132. package/dist/types/components/common/agreement-check/agreement-check.d.ts +2 -0
  133. package/dist/types/components/common/camera-error/camera-error.d.ts +1 -0
  134. package/dist/types/components/common/capture-error/capture-error.d.ts +1 -0
  135. package/dist/types/components/common/how-to-info/how-to-info.d.ts +2 -1
  136. package/dist/types/components/common/id-back-capture/id-back-capture.d.ts +1 -0
  137. package/dist/types/components/common/id-capture/id-capture.d.ts +1 -0
  138. package/dist/types/components/common/id-tilt/id-tilt.d.ts +1 -0
  139. package/dist/types/components/common/random-actions/random-actions.d.ts +2 -2
  140. package/dist/types/components/common/selfie-capture/selfie-capture.d.ts +2 -1
  141. package/dist/types/components/common/selfie-tilt/selfie-tilt.d.ts +2 -1
  142. package/dist/types/components/flow/agreement-info/agreement-info.d.ts +2 -1
  143. package/dist/types/components/flow/end-redirect/end-redirect.d.ts +2 -1
  144. package/dist/types/components/flow/landing-validation/landing-validation.d.ts +1 -0
  145. package/dist/types/components/flow/mobile-redirect/mobile-redirect.d.ts +1 -0
  146. package/dist/types/components/flow/sms-code-validation/sms-code-validation.d.ts +2 -1
  147. package/package.json +1 -1
  148. package/dist/qbs-ect-cmp/ML5-657ef934.js +0 -1370
  149. package/dist/qbs-ect-cmp/Stream-b867a2be.js +0 -3104
  150. package/dist/qbs-ect-cmp/_commonjsHelpers-321aa363.js +0 -44
  151. package/dist/qbs-ect-cmp/agreement-check.entry.js +0 -41
  152. package/dist/qbs-ect-cmp/agreement-info.entry.js +0 -66
  153. package/dist/qbs-ect-cmp/app-globals-0f993ce5.js +0 -3
  154. package/dist/qbs-ect-cmp/base-component-2e490fd9.js +0 -502
  155. package/dist/qbs-ect-cmp/camera-comp.entry.js +0 -103
  156. package/dist/qbs-ect-cmp/camera-error.entry.js +0 -59
  157. package/dist/qbs-ect-cmp/capture-error.entry.js +0 -53
  158. package/dist/qbs-ect-cmp/css-shim-b7d3d95f.js +0 -4
  159. package/dist/qbs-ect-cmp/dom-64053c71.js +0 -73
  160. package/dist/qbs-ect-cmp/end-redirect.entry.js +0 -25
  161. package/dist/qbs-ect-cmp/error-end.entry.js +0 -19
  162. package/dist/qbs-ect-cmp/how-to-info.entry.js +0 -52
  163. package/dist/qbs-ect-cmp/identification-component.entry.js +0 -909
  164. package/dist/qbs-ect-cmp/index-78a05b9e.js +0 -3371
  165. package/dist/qbs-ect-cmp/landing-validation.entry.js +0 -90
  166. package/dist/qbs-ect-cmp/mobile-redirect.entry.js +0 -2984
  167. package/dist/qbs-ect-cmp/shadow-css-98135883.js +0 -387
  168. package/dist/qbs-ect-cmp/sms-code-validation.entry.js +0 -106
@@ -0,0 +1,346 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-41696e0e.js');
4
+
5
+ const appendToMap = (map, propName, value) => {
6
+ const items = map.get(propName);
7
+ if (!items) {
8
+ map.set(propName, [value]);
9
+ }
10
+ else if (!items.includes(value)) {
11
+ items.push(value);
12
+ }
13
+ };
14
+ const debounce = (fn, ms) => {
15
+ let timeoutId;
16
+ return (...args) => {
17
+ if (timeoutId) {
18
+ clearTimeout(timeoutId);
19
+ }
20
+ timeoutId = setTimeout(() => {
21
+ timeoutId = 0;
22
+ fn(...args);
23
+ }, ms);
24
+ };
25
+ };
26
+
27
+ /**
28
+ * Check if a possible element isConnected.
29
+ * The property might not be there, so we check for it.
30
+ *
31
+ * We want it to return true if isConnected is not a property,
32
+ * otherwise we would remove these elements and would not update.
33
+ *
34
+ * Better leak in Edge than to be useless.
35
+ */
36
+ const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
37
+ const cleanupElements = debounce((map) => {
38
+ for (let key of map.keys()) {
39
+ map.set(key, map.get(key).filter(isConnected));
40
+ }
41
+ }, 2000);
42
+ const stencilSubscription = () => {
43
+ if (typeof index.getRenderingRef !== 'function') {
44
+ // If we are not in a stencil project, we do nothing.
45
+ // This function is not really exported by @stencil/core.
46
+ return {};
47
+ }
48
+ const elmsToUpdate = new Map();
49
+ return {
50
+ dispose: () => elmsToUpdate.clear(),
51
+ get: (propName) => {
52
+ const elm = index.getRenderingRef();
53
+ if (elm) {
54
+ appendToMap(elmsToUpdate, propName, elm);
55
+ }
56
+ },
57
+ set: (propName) => {
58
+ const elements = elmsToUpdate.get(propName);
59
+ if (elements) {
60
+ elmsToUpdate.set(propName, elements.filter(index.forceUpdate));
61
+ }
62
+ cleanupElements(elmsToUpdate);
63
+ },
64
+ reset: () => {
65
+ elmsToUpdate.forEach((elms) => elms.forEach(index.forceUpdate));
66
+ cleanupElements(elmsToUpdate);
67
+ },
68
+ };
69
+ };
70
+
71
+ const unwrap = (val) => (typeof val === 'function' ? val() : val);
72
+ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
73
+ const unwrappedState = unwrap(defaultState);
74
+ let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
75
+ const handlers = {
76
+ dispose: [],
77
+ get: [],
78
+ set: [],
79
+ reset: [],
80
+ };
81
+ const reset = () => {
82
+ var _a;
83
+ // When resetting the state, the default state may be a function - unwrap it to invoke it.
84
+ // otherwise, the state won't be properly reset
85
+ states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));
86
+ handlers.reset.forEach((cb) => cb());
87
+ };
88
+ const dispose = () => {
89
+ // Call first dispose as resetting the state would
90
+ // cause less updates ;)
91
+ handlers.dispose.forEach((cb) => cb());
92
+ reset();
93
+ };
94
+ const get = (propName) => {
95
+ handlers.get.forEach((cb) => cb(propName));
96
+ return states.get(propName);
97
+ };
98
+ const set = (propName, value) => {
99
+ const oldValue = states.get(propName);
100
+ if (shouldUpdate(value, oldValue, propName)) {
101
+ states.set(propName, value);
102
+ handlers.set.forEach((cb) => cb(propName, value, oldValue));
103
+ }
104
+ };
105
+ const state = (typeof Proxy === 'undefined'
106
+ ? {}
107
+ : new Proxy(unwrappedState, {
108
+ get(_, propName) {
109
+ return get(propName);
110
+ },
111
+ ownKeys(_) {
112
+ return Array.from(states.keys());
113
+ },
114
+ getOwnPropertyDescriptor() {
115
+ return {
116
+ enumerable: true,
117
+ configurable: true,
118
+ };
119
+ },
120
+ has(_, propName) {
121
+ return states.has(propName);
122
+ },
123
+ set(_, propName, value) {
124
+ set(propName, value);
125
+ return true;
126
+ },
127
+ }));
128
+ const on = (eventName, callback) => {
129
+ handlers[eventName].push(callback);
130
+ return () => {
131
+ removeFromArray(handlers[eventName], callback);
132
+ };
133
+ };
134
+ const onChange = (propName, cb) => {
135
+ const unSet = on('set', (key, newValue) => {
136
+ if (key === propName) {
137
+ cb(newValue);
138
+ }
139
+ });
140
+ // We need to unwrap the defaultState because it might be a function.
141
+ // Otherwise we might not be sending the right reset value.
142
+ const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
143
+ return () => {
144
+ unSet();
145
+ unReset();
146
+ };
147
+ };
148
+ const use = (...subscriptions) => {
149
+ const unsubs = subscriptions.reduce((unsubs, subscription) => {
150
+ if (subscription.set) {
151
+ unsubs.push(on('set', subscription.set));
152
+ }
153
+ if (subscription.get) {
154
+ unsubs.push(on('get', subscription.get));
155
+ }
156
+ if (subscription.reset) {
157
+ unsubs.push(on('reset', subscription.reset));
158
+ }
159
+ if (subscription.dispose) {
160
+ unsubs.push(on('dispose', subscription.dispose));
161
+ }
162
+ return unsubs;
163
+ }, []);
164
+ return () => unsubs.forEach((unsub) => unsub());
165
+ };
166
+ const forceUpdate = (key) => {
167
+ const oldValue = states.get(key);
168
+ handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
169
+ };
170
+ return {
171
+ state,
172
+ get,
173
+ set,
174
+ on,
175
+ onChange,
176
+ use,
177
+ dispose,
178
+ reset,
179
+ forceUpdate,
180
+ };
181
+ };
182
+ const removeFromArray = (array, item) => {
183
+ const index = array.indexOf(item);
184
+ if (index >= 0) {
185
+ array[index] = array[array.length - 1];
186
+ array.length--;
187
+ }
188
+ };
189
+
190
+ const createStore = (defaultState, shouldUpdate) => {
191
+ const map = createObservableMap(defaultState, shouldUpdate);
192
+ map.use(stencilSubscription());
193
+ return map;
194
+ };
195
+
196
+ exports.FlowStatus = void 0;
197
+ (function (FlowStatus) {
198
+ FlowStatus[FlowStatus["LANDING"] = 0] = "LANDING";
199
+ FlowStatus[FlowStatus["AGREEMENT"] = 1] = "AGREEMENT";
200
+ FlowStatus[FlowStatus["PHONE"] = 2] = "PHONE";
201
+ FlowStatus[FlowStatus["CODE"] = 3] = "CODE";
202
+ FlowStatus[FlowStatus["CODEERROR"] = 4] = "CODEERROR";
203
+ FlowStatus[FlowStatus["ID"] = 5] = "ID";
204
+ FlowStatus[FlowStatus["LIVENESS"] = 6] = "LIVENESS";
205
+ FlowStatus[FlowStatus["COMPLETE"] = 7] = "COMPLETE";
206
+ FlowStatus[FlowStatus["ERROREND"] = 8] = "ERROREND";
207
+ FlowStatus[FlowStatus["CAMERAERROR"] = 9] = "CAMERAERROR";
208
+ FlowStatus[FlowStatus["NONE"] = 10] = "NONE";
209
+ })(exports.FlowStatus || (exports.FlowStatus = {}));
210
+
211
+ class IdCaptureValues {
212
+ }
213
+ IdCaptureValues.IDPoseDemoMapping = {
214
+ 0: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_front.mp4',
215
+ 1: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_front_tilt.mp4',
216
+ 2: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_rotate.mp4',
217
+ 3: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_back.mp4',
218
+ 4: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_back_tilt.mp4',
219
+ };
220
+ class SelfieCaptureValues {
221
+ }
222
+ SelfieCaptureValues.FacePoseDemoMapping = {
223
+ 0: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_rotate_left.mp4',
224
+ 1: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_rotate_right.mp4',
225
+ 2: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_back.mp4',
226
+ 3: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_front.mp4',
227
+ // 4: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_left.mp4',
228
+ // 5: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_right.mp4',
229
+ 4: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_main.mp4',
230
+ };
231
+ class SessionKeys {
232
+ }
233
+ SessionKeys.FlowStatusKey = 'qbs-ect-flowstatus';
234
+ SessionKeys.RequestIdKey = 'qbs-ect-requestid';
235
+ SessionKeys.TokenKey = 'qbs-ect-token';
236
+ SessionKeys.InitialisedKey = 'qbs-ect-initialised';
237
+ SessionKeys.HasIdBackKey = 'qbs-ect-has-id-back';
238
+ SessionKeys.AgreementValidationKey = 'qbs-ect-agreement-validation';
239
+ SessionKeys.PhoneValidationKey = 'qbs-ect-phone-validation';
240
+ SessionKeys.RefreshDoneKey = 'qbs-ect-refresh-done';
241
+ class ApiUrls {
242
+ constructor() {
243
+ this.uriEnv = '/';
244
+ this.uriEnv = state.environment == 'QA' ? '/dev_' : '/';
245
+ this.OtpSend = this.uriEnv + 'validation/otp/send';
246
+ this.OtpCheck = this.uriEnv + 'validation/otp/check';
247
+ this.IdentityInsert = this.uriEnv + 'validation/identity/insert';
248
+ this.UploadCapture = this.uriEnv + 'validation/upload/capture';
249
+ this.GetAgreement = this.uriEnv + 'validation/agreement/content';
250
+ this.GenerateAgreement = this.uriEnv + 'validation/agreement/generate';
251
+ this.SendLink = this.uriEnv + 'validation/otp/sendlink';
252
+ this.GetStatus = this.uriEnv + 'validation/identity/status';
253
+ this.AddLog = this.uriEnv + 'validation/logs/add';
254
+ this.AddStep = this.uriEnv + 'validation/logs/step';
255
+ this.AbortRequest = this.uriEnv + 'validation/identity/abort';
256
+ }
257
+ }
258
+
259
+ const { state, onChange } = createStore({
260
+ flowStatus: exports.FlowStatus.NONE,
261
+ environment: 'PROD',
262
+ debug: false,
263
+ requestId: '',
264
+ redirectId: '',
265
+ initialised: false,
266
+ token: '',
267
+ cameraIds: [],
268
+ cameraId: '',
269
+ hasIdBack: false,
270
+ hasSelfieGesture: false,
271
+ hasIdTilt: false,
272
+ agreementsValidation: true,
273
+ phoneValidation: true,
274
+ phoneNumber: '',
275
+ apiBaseUrl: 'https://apiro.id-kyc.com',
276
+ device: null,
277
+ langIso: 'ro',
278
+ });
279
+ onChange('environment', value => {
280
+ state.debug = value == 'QA';
281
+ });
282
+ onChange('flowStatus', value => {
283
+ sessionStorage.setItem(SessionKeys.FlowStatusKey, exports.FlowStatus[value]);
284
+ });
285
+ onChange('token', value => {
286
+ sessionStorage.setItem(SessionKeys.TokenKey, value);
287
+ });
288
+ onChange('requestId', value => {
289
+ sessionStorage.setItem(SessionKeys.RequestIdKey, value);
290
+ });
291
+ onChange('initialised', value => {
292
+ sessionStorage.setItem(SessionKeys.InitialisedKey, String(value));
293
+ });
294
+ onChange('hasIdBack', value => {
295
+ sessionStorage.setItem(SessionKeys.HasIdBackKey, String(value));
296
+ });
297
+ onChange('agreementsValidation', value => {
298
+ sessionStorage.setItem(SessionKeys.AgreementValidationKey, String(value));
299
+ });
300
+ onChange('phoneValidation', value => {
301
+ sessionStorage.setItem(SessionKeys.PhoneValidationKey, String(value));
302
+ });
303
+
304
+ class TranslationsController {
305
+ async getValues() {
306
+ if (this.values) {
307
+ return this.values;
308
+ }
309
+ else {
310
+ this.values = await this.fetchTranslations();
311
+ return this.values;
312
+ }
313
+ }
314
+ getLocale(element = document.body) {
315
+ const closestElement = element.closest('[lang]');
316
+ return closestElement ? closestElement.lang : state.langIso;
317
+ }
318
+ async fetchTranslations() {
319
+ const locale = this.getLocale();
320
+ const existingTranslations = JSON.parse(sessionStorage.getItem(`i18n.${locale}`));
321
+ if (existingTranslations && Object.keys(existingTranslations).length > 0) {
322
+ return existingTranslations;
323
+ }
324
+ else {
325
+ try {
326
+ const result = await fetch(`/i18n/${locale}.json`);
327
+ if (result.ok) {
328
+ const data = await result.json();
329
+ sessionStorage.setItem(`i18n.${locale}`, JSON.stringify(data));
330
+ return data;
331
+ }
332
+ }
333
+ catch (exception) {
334
+ console.error(`Error loading locale: ${locale}`, exception);
335
+ }
336
+ }
337
+ }
338
+ }
339
+ const Translations = new TranslationsController();
340
+
341
+ exports.ApiUrls = ApiUrls;
342
+ exports.IdCaptureValues = IdCaptureValues;
343
+ exports.SelfieCaptureValues = SelfieCaptureValues;
344
+ exports.SessionKeys = SessionKeys;
345
+ exports.Translations = Translations;
346
+ exports.state = state;