@ekyc_qoobiss/qbs-ect-cmp 3.6.25 → 3.6.27

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 (163) hide show
  1. package/dist/i18n/en.json +100 -0
  2. package/dist/i18n/ro.json +100 -0
  3. package/dist/i18n/ru.json +100 -0
  4. package/dist/{collection/helpers/Cameras.js → qbs-ect-cmp/Cameras-dfbebc29.js} +9 -6
  5. package/dist/{collection/models/CaptureFlow.js → qbs-ect-cmp/CaptureFlow-db5d90a4.js} +6 -4
  6. package/dist/{collection/libs/IDML5Detector/IDPose.js → qbs-ect-cmp/IDPose-181bcb25.js} +4 -2
  7. package/dist/{collection/models/IDevice.js → qbs-ect-cmp/IDevice-15ecfdeb.js} +6 -4
  8. package/dist/qbs-ect-cmp/ML5-657ef934.js +1370 -0
  9. package/dist/qbs-ect-cmp/Stream-b867a2be.js +3104 -0
  10. package/dist/qbs-ect-cmp/_commonjsHelpers-321aa363.js +44 -0
  11. package/dist/qbs-ect-cmp/agreement-check.entry.js +41 -0
  12. package/dist/qbs-ect-cmp/agreement-info.entry.js +66 -0
  13. package/dist/qbs-ect-cmp/app-globals-0f993ce5.js +3 -0
  14. package/dist/qbs-ect-cmp/base-component-2e490fd9.js +502 -0
  15. package/dist/qbs-ect-cmp/camera-comp.entry.js +103 -0
  16. package/dist/qbs-ect-cmp/camera-error.entry.js +59 -0
  17. package/dist/qbs-ect-cmp/capture-error.entry.js +53 -0
  18. package/dist/qbs-ect-cmp/css-shim-b7d3d95f.js +4 -0
  19. package/dist/qbs-ect-cmp/dom-64053c71.js +73 -0
  20. package/dist/qbs-ect-cmp/end-redirect.entry.js +25 -0
  21. package/dist/qbs-ect-cmp/error-end.entry.js +19 -0
  22. package/dist/qbs-ect-cmp/how-to-info.entry.js +52 -0
  23. package/dist/{collection/components/common/id-back-capture/id-back-capture.js → qbs-ect-cmp/id-back-capture.entry.js} +30 -100
  24. package/dist/{collection/components/common/id-capture/id-capture.js → qbs-ect-cmp/id-capture.entry.js} +28 -98
  25. package/dist/{collection/components/common/id-tilt/id-tilt.js → qbs-ect-cmp/id-tilt.entry.js} +28 -98
  26. package/dist/qbs-ect-cmp/identification-component.entry.js +909 -0
  27. package/dist/qbs-ect-cmp/index-78a05b9e.js +3371 -0
  28. package/dist/qbs-ect-cmp/index.esm.js +1 -0
  29. package/dist/qbs-ect-cmp/landing-validation.entry.js +90 -0
  30. package/dist/{esm → qbs-ect-cmp}/loader-dots.entry.js +1 -1
  31. package/dist/qbs-ect-cmp/mobile-redirect.entry.js +2984 -0
  32. package/dist/{collection/components/flow/process-id/process-id.js → qbs-ect-cmp/process-id.entry.js} +32 -100
  33. package/dist/qbs-ect-cmp/qbs-ect-cmp.css +320 -1
  34. package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +148 -1
  35. package/dist/{esm → qbs-ect-cmp}/random-actions.entry.js +6 -3
  36. package/dist/{collection/components/common/selfie-capture/selfie-capture.js → qbs-ect-cmp/selfie-capture.entry.js} +28 -99
  37. package/dist/{collection/components/common/selfie-tilt/selfie-tilt.js → qbs-ect-cmp/selfie-tilt.entry.js} +29 -99
  38. package/dist/qbs-ect-cmp/shadow-css-98135883.js +387 -0
  39. package/dist/qbs-ect-cmp/sms-code-validation.entry.js +106 -0
  40. package/dist/{esm/store-fdeed827.js → qbs-ect-cmp/textValues-6bcc85dd.js} +51 -147
  41. package/dist/{collection/components/flow/user-liveness/user-liveness.js → qbs-ect-cmp/user-liveness.entry.js} +30 -91
  42. package/dist/{collection/utils/utils.js → qbs-ect-cmp/utils-8225f0b7.js} +10 -8
  43. package/dist/types/components/base-component.d.ts +2 -0
  44. package/dist/types/components/common/agreement-check/agreement-check.d.ts +1 -0
  45. package/dist/types/components/common/random-actions/random-actions.d.ts +2 -0
  46. package/dist/types/components/flow/end-redirect/end-redirect.d.ts +1 -0
  47. package/dist/types/components/identification-component/identification-component.d.ts +1 -0
  48. package/dist/types/components.d.ts +2 -0
  49. package/dist/types/helpers/TranslationUtils.d.ts +9 -0
  50. package/dist/types/helpers/textValues.d.ts +8 -95
  51. package/dist/types/models/IEctStore.d.ts +1 -0
  52. package/dist/types/models/ITranslationValues.d.ts +101 -0
  53. package/package.json +1 -1
  54. package/dist/cjs/agreement-check_19.cjs.entry.js +0 -10012
  55. package/dist/cjs/index-41696e0e.js +0 -1573
  56. package/dist/cjs/index.cjs.js +0 -2
  57. package/dist/cjs/loader-dots.cjs.entry.js +0 -19
  58. package/dist/cjs/loader.cjs.js +0 -22
  59. package/dist/cjs/qbs-ect-cmp.cjs.js +0 -23
  60. package/dist/cjs/random-actions.cjs.entry.js +0 -22
  61. package/dist/cjs/store-f1a0f55c.js +0 -413
  62. package/dist/collection/assets/canvas-masks/face_green.svg +0 -8
  63. package/dist/collection/assets/canvas-masks/face_white.svg +0 -8
  64. package/dist/collection/assets/canvas-masks/id_green.svg +0 -6
  65. package/dist/collection/assets/canvas-masks/id_white.svg +0 -6
  66. package/dist/collection/assets/complete.svg +0 -4
  67. package/dist/collection/assets/landing/device.svg +0 -14
  68. package/dist/collection/assets/landing/id.svg +0 -3
  69. package/dist/collection/assets/landing/info.svg +0 -3
  70. package/dist/collection/assets/landing/validation.svg +0 -16
  71. package/dist/collection/assets/loader.svg +0 -29
  72. package/dist/collection/collection-manifest.json +0 -32
  73. package/dist/collection/components/base-component.js +0 -59
  74. package/dist/collection/components/common/agreement-check/agreement-check.css +0 -0
  75. package/dist/collection/components/common/agreement-check/agreement-check.js +0 -101
  76. package/dist/collection/components/common/camera-error/camera-error.css +0 -0
  77. package/dist/collection/components/common/camera-error/camera-error.js +0 -91
  78. package/dist/collection/components/common/capture-error/capture-error.css +0 -0
  79. package/dist/collection/components/common/capture-error/capture-error.js +0 -101
  80. package/dist/collection/components/common/how-to-info/how-to-info.css +0 -0
  81. package/dist/collection/components/common/how-to-info/how-to-info.js +0 -122
  82. package/dist/collection/components/common/id-back-capture/id-back-capture.css +0 -35
  83. package/dist/collection/components/common/id-capture/id-capture.css +0 -35
  84. package/dist/collection/components/common/id-tilt/id-tilt.css +0 -35
  85. package/dist/collection/components/common/random-actions/random-actions.css +0 -0
  86. package/dist/collection/components/common/random-actions/random-actions.js +0 -20
  87. package/dist/collection/components/common/selfie-capture/selfie-capture.css +0 -7
  88. package/dist/collection/components/common/selfie-tilt/selfie-tilt.css +0 -7
  89. package/dist/collection/components/controls/camera/camera.css +0 -47
  90. package/dist/collection/components/controls/camera/camera.js +0 -289
  91. package/dist/collection/components/controls/loader-dots/loader-dots.css +0 -61
  92. package/dist/collection/components/controls/loader-dots/loader-dots.js +0 -18
  93. package/dist/collection/components/flow/agreement-info/agreement-info.css +0 -0
  94. package/dist/collection/components/flow/agreement-info/agreement-info.js +0 -106
  95. package/dist/collection/components/flow/end-redirect/end-redirect.css +0 -128
  96. package/dist/collection/components/flow/end-redirect/end-redirect.js +0 -44
  97. package/dist/collection/components/flow/error-end/error-end.css +0 -0
  98. package/dist/collection/components/flow/error-end/error-end.js +0 -61
  99. package/dist/collection/components/flow/landing-validation/landing-validation.css +0 -0
  100. package/dist/collection/components/flow/landing-validation/landing-validation.js +0 -122
  101. package/dist/collection/components/flow/mobile-redirect/mobile-redirect.css +0 -10
  102. package/dist/collection/components/flow/mobile-redirect/mobile-redirect.js +0 -144
  103. package/dist/collection/components/flow/process-id/process-id.css +0 -0
  104. package/dist/collection/components/flow/sms-code-validation/sms-code-validation.css +0 -0
  105. package/dist/collection/components/flow/sms-code-validation/sms-code-validation.js +0 -140
  106. package/dist/collection/components/flow/user-liveness/user-liveness.css +0 -0
  107. package/dist/collection/components/identification-component/identification-component.css +0 -991
  108. package/dist/collection/components/identification-component/identification-component.js +0 -387
  109. package/dist/collection/global.js +0 -0
  110. package/dist/collection/helpers/ApiCall.js +0 -223
  111. package/dist/collection/helpers/DeviceDetection.js +0 -85
  112. package/dist/collection/helpers/Events.js +0 -58
  113. package/dist/collection/helpers/ML5.js +0 -38
  114. package/dist/collection/helpers/Stream.js +0 -229
  115. package/dist/collection/helpers/canvas.js +0 -10
  116. package/dist/collection/helpers/index.js +0 -21
  117. package/dist/collection/helpers/security.js +0 -25
  118. package/dist/collection/helpers/store.js +0 -47
  119. package/dist/collection/helpers/textValues.js +0 -145
  120. package/dist/collection/index.js +0 -1
  121. package/dist/collection/libs/FaceML5Detector/FaceML5Detector.js +0 -229
  122. package/dist/collection/libs/FaceML5Detector/FacePose.js +0 -85
  123. package/dist/collection/libs/IDML5Detector/IDML5Detector.js +0 -99
  124. package/dist/collection/models/FlowStatus.js +0 -14
  125. package/dist/collection/models/FlowSteps.js +0 -30
  126. package/dist/collection/models/IAbortResult.js +0 -1
  127. package/dist/collection/models/IAddRequest.js +0 -1
  128. package/dist/collection/models/IAgreement.js +0 -1
  129. package/dist/collection/models/ICamera.js +0 -1
  130. package/dist/collection/models/IEctStore.js +0 -1
  131. package/dist/collection/models/IGeneration.js +0 -1
  132. package/dist/collection/models/ILinkSend.js +0 -1
  133. package/dist/collection/models/ILogResult.js +0 -1
  134. package/dist/collection/models/IOrderStatus.js +0 -1
  135. package/dist/collection/models/IOtpCheck.js +0 -1
  136. package/dist/collection/models/IOtpSend.js +0 -1
  137. package/dist/collection/models/IUploadFile.js +0 -1
  138. package/dist/collection/models/IVerificationMode.js +0 -5
  139. package/dist/collection/models/OrderStatuses.js +0 -8
  140. package/dist/esm/agreement-check_19.entry.js +0 -9990
  141. package/dist/esm/index-cf54a432.js +0 -1543
  142. package/dist/esm/index.js +0 -1
  143. package/dist/esm/loader.js +0 -18
  144. package/dist/esm/polyfills/core-js.js +0 -11
  145. package/dist/esm/polyfills/css-shim.js +0 -1
  146. package/dist/esm/polyfills/dom.js +0 -79
  147. package/dist/esm/polyfills/es5-html-element.js +0 -1
  148. package/dist/esm/polyfills/index.js +0 -34
  149. package/dist/esm/polyfills/system.js +0 -6
  150. package/dist/esm/qbs-ect-cmp.js +0 -18
  151. package/dist/index.cjs.js +0 -1
  152. package/dist/index.js +0 -1
  153. package/dist/loader/cdn.js +0 -3
  154. package/dist/loader/index.cjs.js +0 -3
  155. package/dist/loader/index.d.ts +0 -21
  156. package/dist/loader/index.es2017.js +0 -3
  157. package/dist/loader/index.js +0 -4
  158. package/dist/loader/package.json +0 -11
  159. package/dist/qbs-ect-cmp/p-054dc5b3.entry.js +0 -1
  160. package/dist/qbs-ect-cmp/p-0b381be5.js +0 -1
  161. package/dist/qbs-ect-cmp/p-4ef6223b.entry.js +0 -1373
  162. package/dist/qbs-ect-cmp/p-6be3b9ca.entry.js +0 -1
  163. package/dist/qbs-ect-cmp/p-8942656c.js +0 -2
@@ -1,387 +0,0 @@
1
- import { h } from '@stencil/core';
2
- import { SessionKeys } from '../../helpers/textValues';
3
- import store from '../../helpers/store';
4
- import { ML5 } from '../../helpers/ML5';
5
- import { FlowStatus } from '../../models/FlowStatus';
6
- import Events from '../../helpers/Events';
7
- import * as uuid from 'uuid';
8
- import packageJson from '../../../package.json';
9
- import { getLogMessage } from '../../utils/utils';
10
- import { BaseComponent } from '../base-component';
11
- import { Browser } from '../../models/IDevice';
12
- import { FlowMoments, FlowSteps } from '../../models/FlowSteps';
13
- // @ts-ignore
14
- import loaderImg from '../../assets/loader.svg';
15
- export class IdentificationComponent {
16
- async onTokenChange(newValue, _oldValue) {
17
- if (store.debug)
18
- console.log('Token change called with value: ' + newValue);
19
- if (newValue == '') {
20
- newValue = store.token;
21
- return;
22
- }
23
- if (store.token !== newValue) {
24
- store.token = newValue;
25
- }
26
- }
27
- agreementAcceptanceEmitted(data) {
28
- try {
29
- this.baseComponent.apiCall.GenerateAgreement(data.detail.agreementType);
30
- }
31
- catch (e) {
32
- this.apiErrorEmitter(e, 'Agreement Acceptance');
33
- }
34
- }
35
- async apiErrorEmitter(data, zone) {
36
- var _a, _b, _c, _d, _e, _f;
37
- if (data.detail) {
38
- this.errorTitle = (_b = (_a = data.detail.message) !== null && _a !== void 0 ? _a : data.detail.status) !== null && _b !== void 0 ? _b : '';
39
- this.errorMessage = (_d = (_c = data.detail.stack) !== null && _c !== void 0 ? _c : data.detail.statusText) !== null && _d !== void 0 ? _d : '';
40
- }
41
- else if (data.message) {
42
- this.errorTitle = data.message;
43
- }
44
- else if (data.status) {
45
- this.errorTitle = (_e = data.status) !== null && _e !== void 0 ? _e : '';
46
- this.errorMessage = (_f = data.statusText) !== null && _f !== void 0 ? _f : '';
47
- }
48
- else {
49
- this.errorTitle = data;
50
- }
51
- let apiLogData = { message: this.errorTitle, stack: this.errorMessage, zone };
52
- try {
53
- await this.baseComponent.apiCall.AddLog(apiLogData, getLogMessage(this.order_id, this.redirect_id, this.token));
54
- }
55
- catch (_g) { }
56
- Events.flowError(this.errorTitle);
57
- store.flowStatus = FlowStatus.ERROREND;
58
- }
59
- handleScroll(ev) {
60
- if (ev.target.offsetHeight + ev.target.scrollTop >= ev.target.scrollHeight) {
61
- }
62
- else {
63
- }
64
- }
65
- constructor() {
66
- this.logInit = {};
67
- this.flowStatusToSet = FlowStatus.NONE;
68
- this.token = undefined;
69
- this.order_id = undefined;
70
- this.api_url = undefined;
71
- this.env = undefined;
72
- this.redirect_id = undefined;
73
- this.phone_number = undefined;
74
- this.idSide = '';
75
- this.errorMessage = undefined;
76
- this.errorTitle = undefined;
77
- }
78
- async componentWillLoad() {
79
- Events.init(window);
80
- Events.flowEvent(FlowSteps.ComponentLoaded, FlowMoments.Initialized);
81
- store.apiBaseUrl = this.api_url;
82
- if (this.env && this.env != '') {
83
- store.environment = this.env;
84
- }
85
- this.baseComponent = new BaseComponent(FlowSteps.ComponentLoaded);
86
- this.baseComponent.setErrorCallback(this.apiErrorEmitter);
87
- if (store.debug)
88
- this.logInit = getLogMessage(this.order_id, this.redirect_id, this.token);
89
- if (this.token) {
90
- if (store.debug)
91
- console.log('Store Token set with property value: ' + this.token);
92
- store.token = this.token;
93
- }
94
- else if (store.token == '') {
95
- store.token = sessionStorage.getItem(SessionKeys.TokenKey);
96
- this.token = store.token;
97
- if (store.debug)
98
- console.log('Store Token set with session value: ' + store.token);
99
- }
100
- if (this.redirect_id) {
101
- store.redirectId = this.redirect_id;
102
- }
103
- if (this.phone_number && this.phone_number != '') {
104
- store.phoneNumber = this.phone_number;
105
- }
106
- var ini = sessionStorage.getItem(SessionKeys.InitialisedKey);
107
- if (ini && ini.toLowerCase() == 'true') {
108
- store.initialised = true;
109
- }
110
- var hasIdBk = sessionStorage.getItem(SessionKeys.HasIdBackKey);
111
- if (hasIdBk && hasIdBk.toLowerCase() == 'true') {
112
- store.hasIdBack = true;
113
- }
114
- var agrVal = sessionStorage.getItem(SessionKeys.AgreementValidationKey);
115
- if (agrVal && agrVal.toLowerCase() == 'true') {
116
- store.agreementsValidation = true;
117
- }
118
- var phoneVal = sessionStorage.getItem(SessionKeys.PhoneValidationKey);
119
- if (phoneVal && phoneVal.toLowerCase() == 'true') {
120
- store.phoneValidation = true;
121
- }
122
- const savedRequest = sessionStorage.getItem(SessionKeys.RequestIdKey);
123
- if (this.order_id && this.order_id != '') {
124
- store.requestId = this.order_id;
125
- if (store.debug)
126
- console.log('Current RequestId has value: ' + this.order_id);
127
- if (savedRequest && savedRequest != '' && savedRequest != this.order_id) {
128
- if (store.debug)
129
- console.log('Session RequestId: ' + savedRequest + ' has different value than property one: ' + this.order_id);
130
- this.flowStatusToSet = FlowStatus.LANDING;
131
- store.initialised = false;
132
- }
133
- }
134
- else if (savedRequest) {
135
- if (store.debug)
136
- console.log('Current RequestId has no value, setting with session value: ' + savedRequest);
137
- store.requestId = savedRequest;
138
- this.order_id = savedRequest;
139
- }
140
- if (this.flowStatusToSet == FlowStatus.NONE) {
141
- var flowSt = sessionStorage.getItem(SessionKeys.FlowStatusKey);
142
- if (flowSt) {
143
- this.flowStatusToSet = FlowStatus[flowSt];
144
- }
145
- else {
146
- this.flowStatusToSet = FlowStatus.LANDING;
147
- }
148
- }
149
- }
150
- async componentDidLoad() {
151
- await this.initializeRequest();
152
- store.flowStatus = this.flowStatusToSet;
153
- }
154
- componentWillRender() {
155
- if (this.idSide == '') {
156
- this.idSide = store.hasIdBack ? 'front' : '';
157
- }
158
- }
159
- async initializeRequest() {
160
- if (store.initialised) {
161
- return;
162
- }
163
- if (store.environment == 'DEMO') {
164
- store.initialised = true;
165
- return;
166
- }
167
- if (store.device.browser == Browser.Mi) {
168
- this.apiErrorEmitter('Mi Browser nu este acceptat. Va rugam utilizati Chrome.', 'Request Initialisation RequestId:' + store.requestId + ' RedirectId:' + store.redirectId);
169
- return;
170
- }
171
- try {
172
- if (store.debug)
173
- this.baseComponent.apiCall.AddLog({ phase: 'debug mode' }, this.logInit);
174
- }
175
- catch (_a) { }
176
- try {
177
- if (!store.device.isMobile && store.redirectId == '') {
178
- store.redirectId = uuid.v4();
179
- this.redirect_id = store.redirectId;
180
- }
181
- if (store.token != '' && (store.requestId != '' || store.redirectId != '')) {
182
- store.initialised = await this.baseComponent.apiCall.AddIdentificationRequest(store.device, packageJson.version);
183
- if (!this.order_id || this.order_id == '') {
184
- this.order_id = store.requestId;
185
- }
186
- }
187
- }
188
- catch (e) {
189
- this.apiErrorEmitter(e, 'Request Initialisation RequestId:' + store.requestId + ' RedirectId:' + store.redirectId);
190
- }
191
- ML5.getInstance();
192
- }
193
- disconnectedCallback() {
194
- Events.flowEvent(FlowSteps.ComponentLoaded, FlowMoments.Finalized);
195
- }
196
- render() {
197
- let currentBlock = (h("div", { class: "container" }, h("div", { class: "row" }, h("div", { class: "div-ci align-center" }, h("img", { src: loaderImg })))));
198
- if (store.device.isMobile || store.environment == 'DEMO') {
199
- if (store.flowStatus == FlowStatus.LANDING) {
200
- currentBlock = h("landing-validation", null);
201
- }
202
- }
203
- else if (store.flowStatus != FlowStatus.NONE) {
204
- currentBlock = h("mobile-redirect", null);
205
- }
206
- if (store.flowStatus == FlowStatus.AGREEMENT) {
207
- currentBlock = h("agreement-info", null);
208
- }
209
- if (store.flowStatus == FlowStatus.PHONE) {
210
- currentBlock = h("sms-code-validation", null);
211
- }
212
- if (store.flowStatus == FlowStatus.CODE) {
213
- currentBlock = h("sms-code-validation", null);
214
- }
215
- if (store.flowStatus == FlowStatus.CODEERROR) {
216
- currentBlock = h("sms-code-validation", null);
217
- }
218
- if (store.flowStatus == FlowStatus.ID) {
219
- currentBlock = h("process-id", null);
220
- }
221
- if (store.flowStatus == FlowStatus.LIVENESS) {
222
- currentBlock = h("user-liveness", { id: "camera" });
223
- }
224
- if (store.flowStatus == FlowStatus.COMPLETE) {
225
- currentBlock = h("end-redirect", null);
226
- }
227
- if (store.flowStatus == FlowStatus.ERROREND) {
228
- currentBlock = h("error-end", { errorTitle: this.errorTitle, message: this.errorMessage });
229
- }
230
- if (store.flowStatus == FlowStatus.CAMERAERROR) {
231
- currentBlock = h("camera-error", null);
232
- }
233
- return h("div", null, currentBlock);
234
- }
235
- static get is() { return "identification-component"; }
236
- static get encapsulation() { return "shadow"; }
237
- static get originalStyleUrls() {
238
- return {
239
- "$": ["identification-component.css"]
240
- };
241
- }
242
- static get styleUrls() {
243
- return {
244
- "$": ["identification-component.css"]
245
- };
246
- }
247
- static get properties() {
248
- return {
249
- "token": {
250
- "type": "string",
251
- "mutable": true,
252
- "complexType": {
253
- "original": "string",
254
- "resolved": "string",
255
- "references": {}
256
- },
257
- "required": false,
258
- "optional": false,
259
- "docs": {
260
- "tags": [],
261
- "text": ""
262
- },
263
- "attribute": "token",
264
- "reflect": true
265
- },
266
- "order_id": {
267
- "type": "string",
268
- "mutable": true,
269
- "complexType": {
270
- "original": "string",
271
- "resolved": "string",
272
- "references": {}
273
- },
274
- "required": false,
275
- "optional": false,
276
- "docs": {
277
- "tags": [],
278
- "text": ""
279
- },
280
- "attribute": "order_id",
281
- "reflect": true
282
- },
283
- "api_url": {
284
- "type": "string",
285
- "mutable": true,
286
- "complexType": {
287
- "original": "string",
288
- "resolved": "string",
289
- "references": {}
290
- },
291
- "required": false,
292
- "optional": false,
293
- "docs": {
294
- "tags": [],
295
- "text": ""
296
- },
297
- "attribute": "api_url",
298
- "reflect": true
299
- },
300
- "env": {
301
- "type": "string",
302
- "mutable": true,
303
- "complexType": {
304
- "original": "string",
305
- "resolved": "string",
306
- "references": {}
307
- },
308
- "required": false,
309
- "optional": false,
310
- "docs": {
311
- "tags": [],
312
- "text": ""
313
- },
314
- "attribute": "env",
315
- "reflect": true
316
- },
317
- "redirect_id": {
318
- "type": "string",
319
- "mutable": true,
320
- "complexType": {
321
- "original": "string",
322
- "resolved": "string",
323
- "references": {}
324
- },
325
- "required": false,
326
- "optional": false,
327
- "docs": {
328
- "tags": [],
329
- "text": ""
330
- },
331
- "attribute": "redirect_id",
332
- "reflect": true
333
- },
334
- "phone_number": {
335
- "type": "string",
336
- "mutable": true,
337
- "complexType": {
338
- "original": "string",
339
- "resolved": "string",
340
- "references": {}
341
- },
342
- "required": false,
343
- "optional": false,
344
- "docs": {
345
- "tags": [],
346
- "text": ""
347
- },
348
- "attribute": "phone_number",
349
- "reflect": true
350
- }
351
- };
352
- }
353
- static get states() {
354
- return {
355
- "idSide": {},
356
- "errorMessage": {},
357
- "errorTitle": {}
358
- };
359
- }
360
- static get watchers() {
361
- return [{
362
- "propName": "token",
363
- "methodName": "onTokenChange"
364
- }];
365
- }
366
- static get listeners() {
367
- return [{
368
- "name": "agreementAcceptance",
369
- "method": "agreementAcceptanceEmitted",
370
- "target": undefined,
371
- "capture": false,
372
- "passive": false
373
- }, {
374
- "name": "apiError",
375
- "method": "apiErrorEmitter",
376
- "target": undefined,
377
- "capture": false,
378
- "passive": false
379
- }, {
380
- "name": "scroll",
381
- "method": "handleScroll",
382
- "target": "window",
383
- "capture": false,
384
- "passive": true
385
- }];
386
- }
387
- }
File without changes
@@ -1,223 +0,0 @@
1
- import { OrderStatuses } from '../models/OrderStatuses';
2
- import store from './store';
3
- import { ApiUrls } from './textValues';
4
- import { FlowStatus } from '../models/FlowStatus';
5
- import { FlowMoments, FlowSteps } from '../models/FlowSteps';
6
- export class ApiCall {
7
- constructor() {
8
- this.serviceErrors = ['Service Unavailable', 'Unauthorized'];
9
- this.toBase64 = (file) => new Promise((resolve, reject) => {
10
- const reader = new FileReader();
11
- reader.readAsDataURL(file);
12
- reader.onload = () => resolve(reader.result);
13
- reader.onerror = error => reject(error);
14
- });
15
- this.urls = new ApiUrls();
16
- }
17
- // private async http2<T>(method: string, url: string, data: string): Promise<T> {
18
- // return new Promise((resolve, reject) => {
19
- // var xhr = new XMLHttpRequest();
20
- // xhr.open(method, url);
21
- // xhr.onload = function () {
22
- // if (xhr.status >= 200 && xhr.status < 300) {
23
- // resolve(xhr.response);
24
- // } else {
25
- // reject({
26
- // status: xhr.status,
27
- // statusText: xhr.statusText,
28
- // });
29
- // }
30
- // };
31
- // xhr.onerror = function () {
32
- // reject({
33
- // status: xhr.status,
34
- // statusText: xhr.statusText,
35
- // });
36
- // };
37
- // xhr.send(data);
38
- // });
39
- // }
40
- async http(request) {
41
- const response = await fetch(request);
42
- if (!response.ok) {
43
- throw new Error(response.statusText);
44
- }
45
- try {
46
- // may error if there is no body
47
- return await response.json();
48
- }
49
- catch (ex) {
50
- throw new Error('No json found in response ' + ex);
51
- }
52
- }
53
- async post(url, data, withRetry = true) {
54
- var request = new Request(store.apiBaseUrl + url, {
55
- method: 'POST',
56
- body: data,
57
- headers: {
58
- 'Content-Type': 'application/json',
59
- 'Authorization': 'IDKYC-TOKEN ' + store.token,
60
- },
61
- });
62
- try {
63
- return await this.http(request);
64
- }
65
- catch (ex) {
66
- if (!withRetry || this.serviceErrors.includes(ex.message)) {
67
- throw ex;
68
- }
69
- this.AddLog('Error in post ', ex);
70
- try {
71
- var request2 = new Request(store.apiBaseUrl + url, {
72
- method: 'POST',
73
- body: data,
74
- headers: {
75
- 'Content-Type': 'application/json',
76
- 'Authorization': 'IDKYC-TOKEN ' + store.token,
77
- },
78
- });
79
- return await this.http(request2);
80
- }
81
- catch (ex2) {
82
- this.AddLog('Error in post ', ex2);
83
- var request3 = new Request(store.apiBaseUrl + url, {
84
- method: 'POST',
85
- body: data,
86
- headers: {
87
- 'Content-Type': 'application/json',
88
- 'Authorization': 'IDKYC-TOKEN ' + store.token,
89
- },
90
- });
91
- return await this.http(request3);
92
- }
93
- }
94
- }
95
- async get(url, withRetry = true) {
96
- var request = new Request(store.apiBaseUrl + url, {
97
- method: 'GET',
98
- headers: {
99
- 'Content-Type': 'application/json',
100
- 'Authorization': 'IDKYC-TOKEN ' + store.token,
101
- },
102
- });
103
- try {
104
- return await this.http(request);
105
- }
106
- catch (ex) {
107
- if (!withRetry || this.serviceErrors.includes(ex.message)) {
108
- throw ex;
109
- }
110
- this.AddLog('Error in get ', ex);
111
- try {
112
- var request2 = new Request(store.apiBaseUrl + url, {
113
- method: 'GET',
114
- headers: {
115
- 'Content-Type': 'application/json',
116
- 'Authorization': 'IDKYC-TOKEN ' + store.token,
117
- },
118
- });
119
- return await this.http(request2);
120
- }
121
- catch (ex2) {
122
- this.AddLog('Error in get ', ex2);
123
- var request3 = new Request(store.apiBaseUrl + url, {
124
- method: 'GET',
125
- headers: {
126
- 'Content-Type': 'application/json',
127
- 'Authorization': 'IDKYC-TOKEN ' + store.token,
128
- },
129
- });
130
- return await this.http(request3);
131
- }
132
- }
133
- }
134
- async SendOTPCode(requestId, phoneNumber) {
135
- let data = { requestId: requestId, phone: phoneNumber };
136
- let jsonResp = await this.post(this.urls.OtpSend, JSON.stringify(data));
137
- return jsonResp.sent;
138
- }
139
- async CheckOTPCode(requestId, otpCode) {
140
- let data = { requestId: requestId, otp: otpCode };
141
- let jsonResp = await this.post(this.urls.OtpCheck, JSON.stringify(data));
142
- return jsonResp.valid;
143
- }
144
- async AddIdentificationRequest(deviceInfo, version) {
145
- if (store.debug)
146
- console.log('Calling identity request with store:' + JSON.stringify(store));
147
- let data = {
148
- requestId: store.requestId,
149
- clientDeviceInfo: JSON.stringify(deviceInfo),
150
- redirectId: store.redirectId,
151
- phoneNumber: store.phoneNumber,
152
- version: version,
153
- };
154
- let jsonResp = await this.post(this.urls.IdentityInsert, JSON.stringify(data));
155
- if (store.requestId == '') {
156
- store.requestId = jsonResp.requestId;
157
- }
158
- store.hasIdBack = jsonResp.hasIdBack;
159
- store.hasIdTilt = jsonResp.hasIdTilt;
160
- store.hasSelfieGesture = jsonResp.hasSelfieGesture;
161
- store.agreementsValidation = jsonResp.agreementsValidation;
162
- store.phoneValidation = jsonResp.phoneValidation;
163
- store.phoneNumber = jsonResp.phoneNumber;
164
- return true;
165
- }
166
- async UploadFileForRequestB64(requestId, type, file) {
167
- let data = {
168
- requestId: requestId,
169
- type: type,
170
- data: await this.toBase64(file),
171
- };
172
- let respJson = await this.post(this.urls.UploadCapture, JSON.stringify(data));
173
- if (!store.hasIdBack && type == 'IdFront') {
174
- return respJson.isValid;
175
- }
176
- if (store.hasIdBack && type == 'IdBack') {
177
- return respJson.isValid;
178
- }
179
- if (type == 'Selfie') {
180
- return respJson.isValid;
181
- }
182
- return true;
183
- }
184
- async GetAgreement(agreementType) {
185
- let resp = await this.get(this.urls.GetAgreement + '?type=' + agreementType + '&requestId=' + store.requestId);
186
- return resp.htmlText;
187
- }
188
- async GenerateAgreement(agreementType) {
189
- let data = { requestId: store.requestId, documentType: agreementType };
190
- let resp = await this.post(this.urls.GenerateAgreement, JSON.stringify(data));
191
- return resp.generation;
192
- }
193
- async GetStatus(requestId) {
194
- let resp = await this.get(this.urls.GetStatus + '?orderId=' + requestId);
195
- return OrderStatuses[resp.status];
196
- }
197
- async SendLink(link, phoneNumber) {
198
- let data = { requestId: store.requestId, link: link, phoneNumber: phoneNumber };
199
- let resp = await this.post(this.urls.SendLink, JSON.stringify(data));
200
- return resp.sent;
201
- }
202
- async AddLog(error, context) {
203
- try {
204
- let data = {
205
- requestId: store.requestId,
206
- action: FlowStatus[store.flowStatus],
207
- message: JSON.stringify({ error, context }),
208
- };
209
- let result = await this.post(this.urls.AddLog, JSON.stringify(data), false);
210
- return result.saved;
211
- }
212
- catch (_a) { }
213
- }
214
- async AddStep(step, moment) {
215
- let data = { requestId: store.requestId, redirectId: store.redirectId, step: FlowSteps[step], moment: FlowMoments[moment], timestamp: new Date().toISOString() };
216
- let result = await this.post(this.urls.AddStep, JSON.stringify(data));
217
- return result.saved;
218
- }
219
- async AbortRequest() {
220
- let result = await this.post(this.urls.AbortRequest, JSON.stringify({ requestId: store.requestId }));
221
- return result.saved;
222
- }
223
- }
@@ -1,85 +0,0 @@
1
- import { Browser, DesktopOS, MobileOS } from '../models/IDevice';
2
- export class DeviceDetection {
3
- constructor() {
4
- var _a, _b, _c, _d;
5
- this.supportedScreenOrientation = (_b = (_a = ((screen === null || screen === void 0 ? void 0 : screen.orientation) || {}).type) !== null && _a !== void 0 ? _a : screen.mozOrientation) !== null && _b !== void 0 ? _b : screen.msOrientation;
6
- this.safariScreenOrientation = !(screen === null || screen === void 0 ? void 0 : screen.orientation) && matchMedia('(orientation: portrait)').matches ? 'portrait-primary' : 'landscape-primary';
7
- this.initialScreenOrientation = (_d = (_c = this.supportedScreenOrientation) !== null && _c !== void 0 ? _c : this.safariScreenOrientation) !== null && _d !== void 0 ? _d : 'portrait-primary';
8
- this.userAgent = navigator.userAgent || navigator.vendor || window.opera || undefined;
9
- this.isMobile = this.isMobileDevice();
10
- this.isTablet = this.isTabletDevice();
11
- this.isDesktop = !this.isMobile && !this.isTablet;
12
- }
13
- // Device typology
14
- isMobileDevice() {
15
- const regexs = [/(Android)(.+)(Mobile)/i, /BlackBerry/i, /iPhone|iPod/i, /Opera Mini/i, /IEMobile/i];
16
- return regexs.some(b => this.userAgent.match(b));
17
- }
18
- isTabletDevice() {
19
- const regex = /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/;
20
- return regex.test(this.userAgent.toLowerCase());
21
- }
22
- // Device Operating System
23
- getMobileOS() {
24
- if (this.isMobileDevice()) {
25
- if (/windows phone/i.test(this.userAgent))
26
- return MobileOS.WindowsPhone;
27
- else if (/android/i.test(this.userAgent))
28
- return MobileOS.Android;
29
- else if (/iPad|iPhone|iPod/.test(this.userAgent) && !window.MSStream)
30
- return MobileOS.iOS;
31
- return MobileOS.Unknown;
32
- }
33
- else
34
- return undefined;
35
- }
36
- getDesktopOS() {
37
- if (this.isDesktop) {
38
- if (this.userAgent.indexOf('Win') !== -1)
39
- return DesktopOS.Windows;
40
- else if (this.userAgent.indexOf('Mac') !== -1)
41
- return DesktopOS.MacOS;
42
- else if (this.userAgent.indexOf('X11') !== -1)
43
- return DesktopOS.Unix;
44
- else if (this.userAgent.indexOf('Linux') !== -1)
45
- return DesktopOS.Linux;
46
- return DesktopOS.Unknown;
47
- }
48
- else
49
- return undefined;
50
- }
51
- getDeviceOS() {
52
- var _a;
53
- return (_a = this.getMobileOS()) !== null && _a !== void 0 ? _a : this.getDesktopOS();
54
- }
55
- getBrowser() {
56
- if (/XiaoMi/i.test(this.userAgent) || /MiuiBrowser/i.test(this.userAgent))
57
- return Browser.Mi;
58
- var isChrome = /chrome/i.test(this.userAgent);
59
- if (isChrome)
60
- return Browser.Chrome;
61
- if (/firefox/i.test(navigator.userAgent))
62
- return Browser.Firefox;
63
- else if (!isChrome && /safari/i.test(navigator.userAgent))
64
- return Browser.Safari;
65
- else
66
- return Browser.Unknown;
67
- }
68
- getDevice() {
69
- var device = {
70
- isDesktop: this.isDesktop,
71
- desktopOS: this.getDesktopOS(),
72
- isWindowsDesktop: this.getDeviceOS() === DesktopOS.Windows,
73
- isLinuxOrUnixDesktop: this.getDeviceOS() === DesktopOS.Linux || this.getDeviceOS() === DesktopOS.Unix,
74
- isMobile: this.isMobile,
75
- mobileOS: this.getMobileOS(),
76
- isAndroidDevice: this.getDeviceOS() === MobileOS.Android,
77
- isAppleDevice: this.getDeviceOS() === MobileOS.iOS || this.getDeviceOS() === DesktopOS.MacOS,
78
- isUnknownMobileDevice: this.getDeviceOS() === MobileOS.Unknown,
79
- browser: this.getBrowser(),
80
- isTablet: this.isTablet,
81
- initialScreenOrientation: this.initialScreenOrientation,
82
- };
83
- return device;
84
- }
85
- }