@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,408 @@
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.lang_iso = undefined;
75
+ this.idSide = '';
76
+ this.errorMessage = undefined;
77
+ this.errorTitle = undefined;
78
+ }
79
+ async componentWillLoad() {
80
+ Events.init(window);
81
+ Events.flowEvent(FlowSteps.ComponentLoaded, FlowMoments.Initialized);
82
+ store.apiBaseUrl = this.api_url;
83
+ if (this.env && this.env != '') {
84
+ store.environment = this.env;
85
+ }
86
+ this.baseComponent = new BaseComponent(FlowSteps.ComponentLoaded);
87
+ this.baseComponent.setErrorCallback(this.apiErrorEmitter);
88
+ if (store.debug)
89
+ this.logInit = getLogMessage(this.order_id, this.redirect_id, this.token);
90
+ if (this.token) {
91
+ if (store.debug)
92
+ console.log('Store Token set with property value: ' + this.token);
93
+ store.token = this.token;
94
+ }
95
+ else if (store.token == '') {
96
+ store.token = sessionStorage.getItem(SessionKeys.TokenKey);
97
+ this.token = store.token;
98
+ if (store.debug)
99
+ console.log('Store Token set with session value: ' + store.token);
100
+ }
101
+ if (this.redirect_id) {
102
+ store.redirectId = this.redirect_id;
103
+ }
104
+ if (this.phone_number && this.phone_number != '') {
105
+ store.phoneNumber = this.phone_number;
106
+ }
107
+ if (this.lang_iso && this.lang_iso != '') {
108
+ store.langIso = this.lang_iso;
109
+ }
110
+ var ini = sessionStorage.getItem(SessionKeys.InitialisedKey);
111
+ if (ini && ini.toLowerCase() == 'true') {
112
+ store.initialised = true;
113
+ }
114
+ var hasIdBk = sessionStorage.getItem(SessionKeys.HasIdBackKey);
115
+ if (hasIdBk && hasIdBk.toLowerCase() == 'true') {
116
+ store.hasIdBack = true;
117
+ }
118
+ var agrVal = sessionStorage.getItem(SessionKeys.AgreementValidationKey);
119
+ if (agrVal && agrVal.toLowerCase() == 'true') {
120
+ store.agreementsValidation = true;
121
+ }
122
+ var phoneVal = sessionStorage.getItem(SessionKeys.PhoneValidationKey);
123
+ if (phoneVal && phoneVal.toLowerCase() == 'true') {
124
+ store.phoneValidation = true;
125
+ }
126
+ const savedRequest = sessionStorage.getItem(SessionKeys.RequestIdKey);
127
+ if (this.order_id && this.order_id != '') {
128
+ store.requestId = this.order_id;
129
+ if (store.debug)
130
+ console.log('Current RequestId has value: ' + this.order_id);
131
+ if (savedRequest && savedRequest != '' && savedRequest != this.order_id) {
132
+ if (store.debug)
133
+ console.log('Session RequestId: ' + savedRequest + ' has different value than property one: ' + this.order_id);
134
+ this.flowStatusToSet = FlowStatus.LANDING;
135
+ store.initialised = false;
136
+ }
137
+ }
138
+ else if (savedRequest) {
139
+ if (store.debug)
140
+ console.log('Current RequestId has no value, setting with session value: ' + savedRequest);
141
+ store.requestId = savedRequest;
142
+ this.order_id = savedRequest;
143
+ }
144
+ if (this.flowStatusToSet == FlowStatus.NONE) {
145
+ var flowSt = sessionStorage.getItem(SessionKeys.FlowStatusKey);
146
+ if (flowSt) {
147
+ this.flowStatusToSet = FlowStatus[flowSt];
148
+ }
149
+ else {
150
+ this.flowStatusToSet = FlowStatus.LANDING;
151
+ }
152
+ }
153
+ }
154
+ async componentDidLoad() {
155
+ await this.initializeRequest();
156
+ store.flowStatus = this.flowStatusToSet;
157
+ }
158
+ componentWillRender() {
159
+ if (this.idSide == '') {
160
+ this.idSide = store.hasIdBack ? 'front' : '';
161
+ }
162
+ }
163
+ async initializeRequest() {
164
+ if (store.initialised) {
165
+ return;
166
+ }
167
+ if (store.environment == 'DEMO') {
168
+ store.initialised = true;
169
+ return;
170
+ }
171
+ if (store.device.browser == Browser.Mi) {
172
+ this.apiErrorEmitter('Mi Browser nu este acceptat. Va rugam utilizati Chrome.', 'Request Initialisation RequestId:' + store.requestId + ' RedirectId:' + store.redirectId);
173
+ return;
174
+ }
175
+ try {
176
+ if (store.debug)
177
+ this.baseComponent.apiCall.AddLog({ phase: 'debug mode' }, this.logInit);
178
+ }
179
+ catch (_a) { }
180
+ try {
181
+ if (!store.device.isMobile && store.redirectId == '') {
182
+ store.redirectId = uuid.v4();
183
+ this.redirect_id = store.redirectId;
184
+ }
185
+ if (store.token != '' && (store.requestId != '' || store.redirectId != '')) {
186
+ store.initialised = await this.baseComponent.apiCall.AddIdentificationRequest(store.device, packageJson.version);
187
+ if (!this.order_id || this.order_id == '') {
188
+ this.order_id = store.requestId;
189
+ }
190
+ }
191
+ }
192
+ catch (e) {
193
+ this.apiErrorEmitter(e, 'Request Initialisation RequestId:' + store.requestId + ' RedirectId:' + store.redirectId);
194
+ }
195
+ ML5.getInstance();
196
+ }
197
+ disconnectedCallback() {
198
+ Events.flowEvent(FlowSteps.ComponentLoaded, FlowMoments.Finalized);
199
+ }
200
+ render() {
201
+ let currentBlock = (h("div", { class: "container" }, h("div", { class: "row" }, h("div", { class: "div-ci align-center" }, h("img", { src: loaderImg })))));
202
+ if (store.device.isMobile || store.environment == 'DEMO') {
203
+ if (store.flowStatus == FlowStatus.LANDING) {
204
+ currentBlock = h("landing-validation", null);
205
+ }
206
+ }
207
+ else if (store.flowStatus != FlowStatus.NONE) {
208
+ currentBlock = h("mobile-redirect", null);
209
+ }
210
+ if (store.flowStatus == FlowStatus.AGREEMENT) {
211
+ currentBlock = h("agreement-info", null);
212
+ }
213
+ if (store.flowStatus == FlowStatus.PHONE) {
214
+ currentBlock = h("sms-code-validation", null);
215
+ }
216
+ if (store.flowStatus == FlowStatus.CODE) {
217
+ currentBlock = h("sms-code-validation", null);
218
+ }
219
+ if (store.flowStatus == FlowStatus.CODEERROR) {
220
+ currentBlock = h("sms-code-validation", null);
221
+ }
222
+ if (store.flowStatus == FlowStatus.ID) {
223
+ currentBlock = h("process-id", null);
224
+ }
225
+ if (store.flowStatus == FlowStatus.LIVENESS) {
226
+ currentBlock = h("user-liveness", { id: "camera" });
227
+ }
228
+ if (store.flowStatus == FlowStatus.COMPLETE) {
229
+ currentBlock = h("end-redirect", null);
230
+ }
231
+ if (store.flowStatus == FlowStatus.ERROREND) {
232
+ currentBlock = h("error-end", { errorTitle: this.errorTitle, message: this.errorMessage });
233
+ }
234
+ if (store.flowStatus == FlowStatus.CAMERAERROR) {
235
+ currentBlock = h("camera-error", null);
236
+ }
237
+ return h("div", null, currentBlock);
238
+ }
239
+ static get is() { return "identification-component"; }
240
+ static get encapsulation() { return "shadow"; }
241
+ static get originalStyleUrls() {
242
+ return {
243
+ "$": ["identification-component.css"]
244
+ };
245
+ }
246
+ static get styleUrls() {
247
+ return {
248
+ "$": ["identification-component.css"]
249
+ };
250
+ }
251
+ static get properties() {
252
+ return {
253
+ "token": {
254
+ "type": "string",
255
+ "mutable": true,
256
+ "complexType": {
257
+ "original": "string",
258
+ "resolved": "string",
259
+ "references": {}
260
+ },
261
+ "required": false,
262
+ "optional": false,
263
+ "docs": {
264
+ "tags": [],
265
+ "text": ""
266
+ },
267
+ "attribute": "token",
268
+ "reflect": true
269
+ },
270
+ "order_id": {
271
+ "type": "string",
272
+ "mutable": true,
273
+ "complexType": {
274
+ "original": "string",
275
+ "resolved": "string",
276
+ "references": {}
277
+ },
278
+ "required": false,
279
+ "optional": false,
280
+ "docs": {
281
+ "tags": [],
282
+ "text": ""
283
+ },
284
+ "attribute": "order_id",
285
+ "reflect": true
286
+ },
287
+ "api_url": {
288
+ "type": "string",
289
+ "mutable": true,
290
+ "complexType": {
291
+ "original": "string",
292
+ "resolved": "string",
293
+ "references": {}
294
+ },
295
+ "required": false,
296
+ "optional": false,
297
+ "docs": {
298
+ "tags": [],
299
+ "text": ""
300
+ },
301
+ "attribute": "api_url",
302
+ "reflect": true
303
+ },
304
+ "env": {
305
+ "type": "string",
306
+ "mutable": true,
307
+ "complexType": {
308
+ "original": "string",
309
+ "resolved": "string",
310
+ "references": {}
311
+ },
312
+ "required": false,
313
+ "optional": false,
314
+ "docs": {
315
+ "tags": [],
316
+ "text": ""
317
+ },
318
+ "attribute": "env",
319
+ "reflect": true
320
+ },
321
+ "redirect_id": {
322
+ "type": "string",
323
+ "mutable": true,
324
+ "complexType": {
325
+ "original": "string",
326
+ "resolved": "string",
327
+ "references": {}
328
+ },
329
+ "required": false,
330
+ "optional": false,
331
+ "docs": {
332
+ "tags": [],
333
+ "text": ""
334
+ },
335
+ "attribute": "redirect_id",
336
+ "reflect": true
337
+ },
338
+ "phone_number": {
339
+ "type": "string",
340
+ "mutable": true,
341
+ "complexType": {
342
+ "original": "string",
343
+ "resolved": "string",
344
+ "references": {}
345
+ },
346
+ "required": false,
347
+ "optional": false,
348
+ "docs": {
349
+ "tags": [],
350
+ "text": ""
351
+ },
352
+ "attribute": "phone_number",
353
+ "reflect": true
354
+ },
355
+ "lang_iso": {
356
+ "type": "string",
357
+ "mutable": true,
358
+ "complexType": {
359
+ "original": "string",
360
+ "resolved": "string",
361
+ "references": {}
362
+ },
363
+ "required": false,
364
+ "optional": false,
365
+ "docs": {
366
+ "tags": [],
367
+ "text": ""
368
+ },
369
+ "attribute": "lang_iso",
370
+ "reflect": true
371
+ }
372
+ };
373
+ }
374
+ static get states() {
375
+ return {
376
+ "idSide": {},
377
+ "errorMessage": {},
378
+ "errorTitle": {}
379
+ };
380
+ }
381
+ static get watchers() {
382
+ return [{
383
+ "propName": "token",
384
+ "methodName": "onTokenChange"
385
+ }];
386
+ }
387
+ static get listeners() {
388
+ return [{
389
+ "name": "agreementAcceptance",
390
+ "method": "agreementAcceptanceEmitted",
391
+ "target": undefined,
392
+ "capture": false,
393
+ "passive": false
394
+ }, {
395
+ "name": "apiError",
396
+ "method": "apiErrorEmitter",
397
+ "target": undefined,
398
+ "capture": false,
399
+ "passive": false
400
+ }, {
401
+ "name": "scroll",
402
+ "method": "handleScroll",
403
+ "target": "window",
404
+ "capture": false,
405
+ "passive": true
406
+ }];
407
+ }
408
+ }
File without changes
@@ -0,0 +1,223 @@
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,7 +1,6 @@
1
- import { B as Browser } from './IDevice-15ecfdeb.js';
2
- import { s as state } from './textValues-6bcc85dd.js';
3
-
4
- class Cameras {
1
+ import { Browser } from '../models/IDevice';
2
+ import store from './store';
3
+ export class Cameras {
5
4
  async GetCameras(deviceInfo) {
6
5
  var allDevices = [];
7
6
  const devices = await navigator.mediaDevices.enumerateDevices();
@@ -115,8 +114,8 @@ class Cameras {
115
114
  let cam = new Cameras();
116
115
  let cameras = (await cam.GetCameras(device)).filter(c => c.facingMode == 'environment');
117
116
  var recommCamera = cam.GetRecommendedCamera(cameras);
118
- state.cameraIds = cameras.map(camera => camera.deviceId);
119
- state.cameraId = recommCamera === null || recommCamera === void 0 ? void 0 : recommCamera.deviceId;
117
+ store.cameraIds = cameras.map(camera => camera.deviceId);
118
+ store.cameraId = recommCamera === null || recommCamera === void 0 ? void 0 : recommCamera.deviceId;
120
119
  return true;
121
120
  }
122
121
  catch (e) {
@@ -127,6 +126,4 @@ class Cameras {
127
126
  throw e;
128
127
  }
129
128
  }
130
- }
131
-
132
- export { Cameras as C };
129
+ }