@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
@@ -1,44 +0,0 @@
1
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
-
3
- function getDefaultExportFromCjs (x) {
4
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
- }
6
-
7
- function createCommonjsModule(fn, basedir, module) {
8
- return module = {
9
- path: basedir,
10
- exports: {},
11
- require: function (path, base) {
12
- return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
13
- }
14
- }, fn(module, module.exports), module.exports;
15
- }
16
-
17
- function getDefaultExportFromNamespaceIfPresent (n) {
18
- return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;
19
- }
20
-
21
- function getDefaultExportFromNamespaceIfNotNamed (n) {
22
- return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
23
- }
24
-
25
- function getAugmentedNamespace(n) {
26
- if (n.__esModule) return n;
27
- var a = Object.defineProperty({}, '__esModule', {value: true});
28
- Object.keys(n).forEach(function (k) {
29
- var d = Object.getOwnPropertyDescriptor(n, k);
30
- Object.defineProperty(a, k, d.get ? d : {
31
- enumerable: true,
32
- get: function () {
33
- return n[k];
34
- }
35
- });
36
- });
37
- return a;
38
- }
39
-
40
- function commonjsRequire () {
41
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
42
- }
43
-
44
- export { createCommonjsModule as c, getDefaultExportFromCjs as g };
@@ -1,41 +0,0 @@
1
- import { r as registerInstance, e as createEvent, h } from './index-78a05b9e.js';
2
- import { A as ApiCall, B as BaseComponent, F as FlowSteps } from './base-component-2e490fd9.js';
3
- import './textValues-6bcc85dd.js';
4
- import './IDevice-15ecfdeb.js';
5
-
6
- const agreementCheckCss = "";
7
-
8
- const AgreementCheck = class {
9
- constructor(hostRef) {
10
- registerInstance(this, hostRef);
11
- this.apiErrorEvent = createEvent(this, "apiError", 7);
12
- this.agreementAcceptance = createEvent(this, "agreementAcceptance", 7);
13
- this.agreementType = undefined;
14
- this.htmlContent = undefined;
15
- this.buttonEnabled = undefined;
16
- this.scrollClass = 'scroll';
17
- this.apiCalls = new ApiCall();
18
- this.buttonEnabled = true;
19
- this.baseComponent = new BaseComponent(FlowSteps.CameraError);
20
- this.baseComponent.setEventEmitter(this.apiErrorEvent);
21
- }
22
- async componentDidLoad() {
23
- try {
24
- this.htmlContent = await this.apiCalls.GetAgreement(this.agreementType);
25
- }
26
- catch (e) {
27
- this.apiErrorEvent.emit(e);
28
- }
29
- }
30
- async buttonClick(result) {
31
- this.buttonEnabled = false;
32
- this.agreementAcceptance.emit({ agreementType: this.agreementType, result });
33
- }
34
- render() {
35
- let content = (h("div", { class: "container" }, h("div", { class: "row" }, h("div", { class: this.scrollClass, innerHTML: this.htmlContent }), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("div", { class: "d-flex two-buttons" }, h("button", { class: "normal-button red-button", disabled: !this.buttonEnabled, onClick: () => this.buttonClick(false) }, this.baseComponent.translations.AgreementCheckValues.ButtonNo), h("button", { class: "normal-button", disabled: !this.buttonEnabled, onClick: () => this.buttonClick(true) }, this.baseComponent.translations.AgreementCheckValues.ButtonYes)), h("p", { class: "main-text font-size-18 text-right mb-0" }, this.baseComponent.translations.GlobalValues.FooterText))))));
36
- return this.htmlContent ? content : h("div", null);
37
- }
38
- };
39
- AgreementCheck.style = agreementCheckCss;
40
-
41
- export { AgreementCheck as agreement_check };
@@ -1,66 +0,0 @@
1
- import { r as registerInstance, e as createEvent, h } from './index-78a05b9e.js';
2
- import { s as state, F as FlowStatus } from './textValues-6bcc85dd.js';
3
- import { B as BaseComponent, F as FlowSteps } from './base-component-2e490fd9.js';
4
- import './IDevice-15ecfdeb.js';
5
-
6
- const agreementInfoCss = "";
7
-
8
- const AgreementInfo = class {
9
- constructor(hostRef) {
10
- registerInstance(this, hostRef);
11
- this.apiErrorEvent = createEvent(this, "apiError", 7);
12
- this.agreementsChecked = undefined;
13
- this.termsChecked = undefined;
14
- this.openAgreements = undefined;
15
- this.openTerms = undefined;
16
- this.baseComponent = new BaseComponent(FlowSteps.Agreements);
17
- this.baseComponent.setEventEmitter(this.apiErrorEvent);
18
- this.agreementsChecked = false;
19
- this.termsChecked = false;
20
- }
21
- async componentDidLoad() {
22
- await this.baseComponent.initialize();
23
- }
24
- componentWillLoad() {
25
- this.openAgreements = false;
26
- this.openTerms = false;
27
- }
28
- async disconnectedCallback() {
29
- await this.baseComponent.finalize();
30
- }
31
- async buttonClick() {
32
- if (this.agreementsChecked && this.termsChecked) {
33
- if (state.phoneValidation) {
34
- state.flowStatus = FlowStatus.PHONE;
35
- }
36
- else {
37
- state.flowStatus = FlowStatus.ID;
38
- }
39
- }
40
- }
41
- agreementAcceptanceEmitted(data) {
42
- if (data.detail.agreementType == 'agreement') {
43
- this.agreementsChecked = data.detail.result;
44
- this.openAgreements = false;
45
- }
46
- if (data.detail.agreementType == 'terms') {
47
- this.termsChecked = data.detail.result;
48
- this.openTerms = false;
49
- }
50
- }
51
- agreementsClicked() {
52
- this.openAgreements = true;
53
- }
54
- termsClicked() {
55
- this.openTerms = true;
56
- }
57
- render() {
58
- let agreementsCheck = h("agreement-check", { agreementType: "agreement" });
59
- let termsCheck = h("agreement-check", { agreementType: "terms" });
60
- let mainComp = (h("div", { class: "container" }, h("div", { class: "row" }, h("div", null, h("h1", { class: "text-center" }, this.baseComponent.translations.AgreementInfoValues.Title), h("div", { class: "d-flex space-between align-center" }, h("h3", { class: "main-text font-size-2", onClick: () => this.agreementsClicked() }, h("input", { type: "checkbox", readOnly: true, checked: this.agreementsChecked }), this.baseComponent.translations.AgreementInfoValues.Agreement)), h("div", { class: "d-flex space-between align-center" }, h("h3", { class: "main-text font-size-2", onClick: () => this.termsClicked() }, h("input", { type: "checkbox", readOnly: true, checked: this.termsChecked }), this.baseComponent.translations.AgreementInfoValues.Terms))), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", onClick: () => this.buttonClick() }, this.baseComponent.translations.AgreementInfoValues.Button), h("p", { class: "main-text font-size-18 text-right mb-0" }, this.baseComponent.translations.GlobalValues.FooterText))))));
61
- return this.openAgreements ? agreementsCheck : this.openTerms ? termsCheck : mainComp;
62
- }
63
- };
64
- AgreementInfo.style = agreementInfoCss;
65
-
66
- export { AgreementInfo as agreement_info };
@@ -1,3 +0,0 @@
1
- const globalScripts = () => {};
2
-
3
- export { globalScripts as g };
@@ -1,502 +0,0 @@
1
- import { A as ApiUrls, s as state, F as FlowStatus } from './textValues-6bcc85dd.js';
2
- import { M as MobileOS, D as DesktopOS, B as Browser } from './IDevice-15ecfdeb.js';
3
-
4
- class Events {
5
- static init(element) {
6
- this.callingModule = element;
7
- }
8
- static flowEvent(step, moment) {
9
- const eventName = `ect-${step.toString()}-${moment.toString()}-event`;
10
- this.callingModule.dispatchEvent(new CustomEvent(eventName, {
11
- detail: {},
12
- bubbles: true,
13
- cancelable: true,
14
- composed: true,
15
- }));
16
- }
17
- static flowStarted() {
18
- this.callingModule.dispatchEvent(new CustomEvent('ect-started', {
19
- detail: {},
20
- bubbles: true,
21
- cancelable: true,
22
- composed: true,
23
- }));
24
- }
25
- static flowAborted() {
26
- sessionStorage.clear();
27
- this.callingModule.dispatchEvent(new CustomEvent('ect-aborted', {
28
- detail: {},
29
- bubbles: true,
30
- cancelable: true,
31
- composed: true,
32
- }));
33
- }
34
- static flowCompleted() {
35
- sessionStorage.clear();
36
- this.callingModule.dispatchEvent(new CustomEvent('ect-completed', {
37
- detail: {},
38
- bubbles: true,
39
- cancelable: true,
40
- composed: true,
41
- }));
42
- }
43
- static flowError(error) {
44
- sessionStorage.clear();
45
- this.callingModule.dispatchEvent(new CustomEvent('ect-error', {
46
- detail: { error },
47
- bubbles: true,
48
- cancelable: true,
49
- composed: true,
50
- }));
51
- }
52
- static tokenExpired() {
53
- sessionStorage.clear();
54
- this.callingModule.dispatchEvent(new CustomEvent('ect-session-expired', {
55
- detail: {},
56
- bubbles: true,
57
- cancelable: true,
58
- composed: true,
59
- }));
60
- }
61
- }
62
-
63
- var OrderStatuses;
64
- (function (OrderStatuses) {
65
- OrderStatuses[OrderStatuses["Capturing"] = 0] = "Capturing";
66
- OrderStatuses[OrderStatuses["FinishedCapturing"] = 1] = "FinishedCapturing";
67
- OrderStatuses[OrderStatuses["Waiting"] = 2] = "Waiting";
68
- OrderStatuses[OrderStatuses["NotFound"] = 3] = "NotFound";
69
- OrderStatuses[OrderStatuses["Aborted"] = 4] = "Aborted";
70
- })(OrderStatuses || (OrderStatuses = {}));
71
-
72
- var FlowSteps;
73
- (function (FlowSteps) {
74
- FlowSteps[FlowSteps["ComponentLoaded"] = 'component-loaded'] = "ComponentLoaded";
75
- FlowSteps[FlowSteps["MobileRedirect"] = 'mobile-redirect'] = "MobileRedirect";
76
- FlowSteps[FlowSteps["Landing"] = 'landing'] = "Landing";
77
- FlowSteps[FlowSteps["Agreements"] = 'agreements'] = "Agreements";
78
- FlowSteps[FlowSteps["OtpSend"] = 'otp-send'] = "OtpSend";
79
- FlowSteps[FlowSteps["OtpCheck"] = 'otp-check'] = "OtpCheck";
80
- FlowSteps[FlowSteps["CiFront"] = 'ci-front'] = "CiFront";
81
- FlowSteps[FlowSteps["CiFrontHowTo"] = 'ci-front-how-to'] = "CiFrontHowTo";
82
- FlowSteps[FlowSteps["CiFrontCapture"] = 'ci-front-capture'] = "CiFrontCapture";
83
- FlowSteps[FlowSteps["CiBack"] = 'ci-back'] = "CiBack";
84
- FlowSteps[FlowSteps["CiBackHowTo"] = 'ci-back-how-to'] = "CiBackHowTo";
85
- FlowSteps[FlowSteps["CiBackCapture"] = 'ci-back-capture'] = "CiBackCapture";
86
- FlowSteps[FlowSteps["CiTilt"] = 'ci-tilt'] = "CiTilt";
87
- FlowSteps[FlowSteps["CiError"] = 'ci-error'] = "CiError";
88
- FlowSteps[FlowSteps["SelfieHowTo"] = 'selfie-how-to'] = "SelfieHowTo";
89
- FlowSteps[FlowSteps["SelfieTilt"] = 'selfie-tilt'] = "SelfieTilt";
90
- FlowSteps[FlowSteps["SelfieCapture"] = 'selfie-capture'] = "SelfieCapture";
91
- FlowSteps[FlowSteps["Selfie"] = 'selfie'] = "Selfie";
92
- FlowSteps[FlowSteps["SelfieError"] = 'selfie-error'] = "SelfieError";
93
- FlowSteps[FlowSteps["End"] = 'end'] = "End";
94
- FlowSteps[FlowSteps["CameraError"] = 'camera-error'] = "CameraError";
95
- })(FlowSteps || (FlowSteps = {}));
96
- var FlowMoments;
97
- (function (FlowMoments) {
98
- FlowMoments[FlowMoments["Initialized"] = 'initialized'] = "Initialized";
99
- FlowMoments[FlowMoments["Finalized"] = 'finalized'] = "Finalized";
100
- FlowMoments[FlowMoments["None"] = 'none'] = "None";
101
- })(FlowMoments || (FlowMoments = {}));
102
-
103
- class ApiCall {
104
- constructor() {
105
- this.serviceErrors = ['Service Unavailable', 'Unauthorized'];
106
- this.toBase64 = (file) => new Promise((resolve, reject) => {
107
- const reader = new FileReader();
108
- reader.readAsDataURL(file);
109
- reader.onload = () => resolve(reader.result);
110
- reader.onerror = error => reject(error);
111
- });
112
- this.urls = new ApiUrls();
113
- }
114
- // private async http2<T>(method: string, url: string, data: string): Promise<T> {
115
- // return new Promise((resolve, reject) => {
116
- // var xhr = new XMLHttpRequest();
117
- // xhr.open(method, url);
118
- // xhr.onload = function () {
119
- // if (xhr.status >= 200 && xhr.status < 300) {
120
- // resolve(xhr.response);
121
- // } else {
122
- // reject({
123
- // status: xhr.status,
124
- // statusText: xhr.statusText,
125
- // });
126
- // }
127
- // };
128
- // xhr.onerror = function () {
129
- // reject({
130
- // status: xhr.status,
131
- // statusText: xhr.statusText,
132
- // });
133
- // };
134
- // xhr.send(data);
135
- // });
136
- // }
137
- async http(request) {
138
- const response = await fetch(request);
139
- if (!response.ok) {
140
- throw new Error(response.statusText);
141
- }
142
- try {
143
- // may error if there is no body
144
- return await response.json();
145
- }
146
- catch (ex) {
147
- throw new Error('No json found in response ' + ex);
148
- }
149
- }
150
- async post(url, data, withRetry = true) {
151
- var request = new Request(state.apiBaseUrl + url, {
152
- method: 'POST',
153
- body: data,
154
- headers: {
155
- 'Content-Type': 'application/json',
156
- 'Authorization': 'IDKYC-TOKEN ' + state.token,
157
- },
158
- });
159
- try {
160
- return await this.http(request);
161
- }
162
- catch (ex) {
163
- if (!withRetry || this.serviceErrors.includes(ex.message)) {
164
- throw ex;
165
- }
166
- this.AddLog('Error in post ', ex);
167
- try {
168
- var request2 = new Request(state.apiBaseUrl + url, {
169
- method: 'POST',
170
- body: data,
171
- headers: {
172
- 'Content-Type': 'application/json',
173
- 'Authorization': 'IDKYC-TOKEN ' + state.token,
174
- },
175
- });
176
- return await this.http(request2);
177
- }
178
- catch (ex2) {
179
- this.AddLog('Error in post ', ex2);
180
- var request3 = new Request(state.apiBaseUrl + url, {
181
- method: 'POST',
182
- body: data,
183
- headers: {
184
- 'Content-Type': 'application/json',
185
- 'Authorization': 'IDKYC-TOKEN ' + state.token,
186
- },
187
- });
188
- return await this.http(request3);
189
- }
190
- }
191
- }
192
- async get(url, withRetry = true) {
193
- var request = new Request(state.apiBaseUrl + url, {
194
- method: 'GET',
195
- headers: {
196
- 'Content-Type': 'application/json',
197
- 'Authorization': 'IDKYC-TOKEN ' + state.token,
198
- },
199
- });
200
- try {
201
- return await this.http(request);
202
- }
203
- catch (ex) {
204
- if (!withRetry || this.serviceErrors.includes(ex.message)) {
205
- throw ex;
206
- }
207
- this.AddLog('Error in get ', ex);
208
- try {
209
- var request2 = new Request(state.apiBaseUrl + url, {
210
- method: 'GET',
211
- headers: {
212
- 'Content-Type': 'application/json',
213
- 'Authorization': 'IDKYC-TOKEN ' + state.token,
214
- },
215
- });
216
- return await this.http(request2);
217
- }
218
- catch (ex2) {
219
- this.AddLog('Error in get ', ex2);
220
- var request3 = new Request(state.apiBaseUrl + url, {
221
- method: 'GET',
222
- headers: {
223
- 'Content-Type': 'application/json',
224
- 'Authorization': 'IDKYC-TOKEN ' + state.token,
225
- },
226
- });
227
- return await this.http(request3);
228
- }
229
- }
230
- }
231
- async SendOTPCode(requestId, phoneNumber) {
232
- let data = { requestId: requestId, phone: phoneNumber };
233
- let jsonResp = await this.post(this.urls.OtpSend, JSON.stringify(data));
234
- return jsonResp.sent;
235
- }
236
- async CheckOTPCode(requestId, otpCode) {
237
- let data = { requestId: requestId, otp: otpCode };
238
- let jsonResp = await this.post(this.urls.OtpCheck, JSON.stringify(data));
239
- return jsonResp.valid;
240
- }
241
- async AddIdentificationRequest(deviceInfo, version) {
242
- if (state.debug)
243
- console.log('Calling identity request with store:' + JSON.stringify(state));
244
- let data = {
245
- requestId: state.requestId,
246
- clientDeviceInfo: JSON.stringify(deviceInfo),
247
- redirectId: state.redirectId,
248
- phoneNumber: state.phoneNumber,
249
- version: version,
250
- };
251
- let jsonResp = await this.post(this.urls.IdentityInsert, JSON.stringify(data));
252
- if (state.requestId == '') {
253
- state.requestId = jsonResp.requestId;
254
- }
255
- state.hasIdBack = jsonResp.hasIdBack;
256
- state.hasIdTilt = jsonResp.hasIdTilt;
257
- state.hasSelfieGesture = jsonResp.hasSelfieGesture;
258
- state.agreementsValidation = jsonResp.agreementsValidation;
259
- state.phoneValidation = jsonResp.phoneValidation;
260
- state.phoneNumber = jsonResp.phoneNumber;
261
- return true;
262
- }
263
- async UploadFileForRequestB64(requestId, type, file) {
264
- let data = {
265
- requestId: requestId,
266
- type: type,
267
- data: await this.toBase64(file),
268
- };
269
- let respJson = await this.post(this.urls.UploadCapture, JSON.stringify(data));
270
- if (!state.hasIdBack && type == 'IdFront') {
271
- return respJson.isValid;
272
- }
273
- if (state.hasIdBack && type == 'IdBack') {
274
- return respJson.isValid;
275
- }
276
- if (type == 'Selfie') {
277
- return respJson.isValid;
278
- }
279
- return true;
280
- }
281
- async GetAgreement(agreementType) {
282
- let resp = await this.get(this.urls.GetAgreement + '?type=' + agreementType + '&requestId=' + state.requestId);
283
- return resp.htmlText;
284
- }
285
- async GenerateAgreement(agreementType) {
286
- let data = { requestId: state.requestId, documentType: agreementType };
287
- let resp = await this.post(this.urls.GenerateAgreement, JSON.stringify(data));
288
- return resp.generation;
289
- }
290
- async GetStatus(requestId) {
291
- let resp = await this.get(this.urls.GetStatus + '?orderId=' + requestId);
292
- return OrderStatuses[resp.status];
293
- }
294
- async SendLink(link, phoneNumber) {
295
- let data = { requestId: state.requestId, link: link, phoneNumber: phoneNumber };
296
- let resp = await this.post(this.urls.SendLink, JSON.stringify(data));
297
- return resp.sent;
298
- }
299
- async AddLog(error, context) {
300
- try {
301
- let data = {
302
- requestId: state.requestId,
303
- action: FlowStatus[state.flowStatus],
304
- message: JSON.stringify({ error, context }),
305
- };
306
- let result = await this.post(this.urls.AddLog, JSON.stringify(data), false);
307
- return result.saved;
308
- }
309
- catch (_a) { }
310
- }
311
- async AddStep(step, moment) {
312
- let data = { requestId: state.requestId, redirectId: state.redirectId, step: FlowSteps[step], moment: FlowMoments[moment], timestamp: new Date().toISOString() };
313
- let result = await this.post(this.urls.AddStep, JSON.stringify(data));
314
- return result.saved;
315
- }
316
- async AbortRequest() {
317
- let result = await this.post(this.urls.AbortRequest, JSON.stringify({ requestId: state.requestId }));
318
- return result.saved;
319
- }
320
- }
321
-
322
- class DeviceDetection {
323
- constructor() {
324
- var _a, _b, _c, _d;
325
- 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;
326
- this.safariScreenOrientation = !(screen === null || screen === void 0 ? void 0 : screen.orientation) && matchMedia('(orientation: portrait)').matches ? 'portrait-primary' : 'landscape-primary';
327
- this.initialScreenOrientation = (_d = (_c = this.supportedScreenOrientation) !== null && _c !== void 0 ? _c : this.safariScreenOrientation) !== null && _d !== void 0 ? _d : 'portrait-primary';
328
- this.userAgent = navigator.userAgent || navigator.vendor || window.opera || undefined;
329
- this.isMobile = this.isMobileDevice();
330
- this.isTablet = this.isTabletDevice();
331
- this.isDesktop = !this.isMobile && !this.isTablet;
332
- }
333
- // Device typology
334
- isMobileDevice() {
335
- const regexs = [/(Android)(.+)(Mobile)/i, /BlackBerry/i, /iPhone|iPod/i, /Opera Mini/i, /IEMobile/i];
336
- return regexs.some(b => this.userAgent.match(b));
337
- }
338
- isTabletDevice() {
339
- const regex = /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/;
340
- return regex.test(this.userAgent.toLowerCase());
341
- }
342
- // Device Operating System
343
- getMobileOS() {
344
- if (this.isMobileDevice()) {
345
- if (/windows phone/i.test(this.userAgent))
346
- return MobileOS.WindowsPhone;
347
- else if (/android/i.test(this.userAgent))
348
- return MobileOS.Android;
349
- else if (/iPad|iPhone|iPod/.test(this.userAgent) && !window.MSStream)
350
- return MobileOS.iOS;
351
- return MobileOS.Unknown;
352
- }
353
- else
354
- return undefined;
355
- }
356
- getDesktopOS() {
357
- if (this.isDesktop) {
358
- if (this.userAgent.indexOf('Win') !== -1)
359
- return DesktopOS.Windows;
360
- else if (this.userAgent.indexOf('Mac') !== -1)
361
- return DesktopOS.MacOS;
362
- else if (this.userAgent.indexOf('X11') !== -1)
363
- return DesktopOS.Unix;
364
- else if (this.userAgent.indexOf('Linux') !== -1)
365
- return DesktopOS.Linux;
366
- return DesktopOS.Unknown;
367
- }
368
- else
369
- return undefined;
370
- }
371
- getDeviceOS() {
372
- var _a;
373
- return (_a = this.getMobileOS()) !== null && _a !== void 0 ? _a : this.getDesktopOS();
374
- }
375
- getBrowser() {
376
- if (/XiaoMi/i.test(this.userAgent) || /MiuiBrowser/i.test(this.userAgent))
377
- return Browser.Mi;
378
- var isChrome = /chrome/i.test(this.userAgent);
379
- if (isChrome)
380
- return Browser.Chrome;
381
- if (/firefox/i.test(navigator.userAgent))
382
- return Browser.Firefox;
383
- else if (!isChrome && /safari/i.test(navigator.userAgent))
384
- return Browser.Safari;
385
- else
386
- return Browser.Unknown;
387
- }
388
- getDevice() {
389
- var device = {
390
- isDesktop: this.isDesktop,
391
- desktopOS: this.getDesktopOS(),
392
- isWindowsDesktop: this.getDeviceOS() === DesktopOS.Windows,
393
- isLinuxOrUnixDesktop: this.getDeviceOS() === DesktopOS.Linux || this.getDeviceOS() === DesktopOS.Unix,
394
- isMobile: this.isMobile,
395
- mobileOS: this.getMobileOS(),
396
- isAndroidDevice: this.getDeviceOS() === MobileOS.Android,
397
- isAppleDevice: this.getDeviceOS() === MobileOS.iOS || this.getDeviceOS() === DesktopOS.MacOS,
398
- isUnknownMobileDevice: this.getDeviceOS() === MobileOS.Unknown,
399
- browser: this.getBrowser(),
400
- isTablet: this.isTablet,
401
- initialScreenOrientation: this.initialScreenOrientation,
402
- };
403
- return device;
404
- }
405
- }
406
-
407
- class TranslationsController {
408
- async getValues() {
409
- if (this.values) {
410
- return this.values;
411
- }
412
- else {
413
- this.values = await this.fetchTranslations();
414
- return this.values;
415
- }
416
- }
417
- getLocale(element = document.body) {
418
- const closestElement = element.closest('[lang]');
419
- return closestElement ? closestElement.lang : state.langIso;
420
- }
421
- async fetchTranslations() {
422
- const locale = this.getLocale();
423
- const existingTranslations = JSON.parse(sessionStorage.getItem(`i18n.${locale}`));
424
- if (existingTranslations && Object.keys(existingTranslations).length > 0) {
425
- return existingTranslations;
426
- }
427
- else {
428
- try {
429
- const result = await fetch(`/i18n/${locale}.json`);
430
- if (result.ok) {
431
- const data = await result.json();
432
- sessionStorage.setItem(`i18n.${locale}`, JSON.stringify(data));
433
- return data;
434
- }
435
- }
436
- catch (exception) {
437
- console.error(`Error loading locale: ${locale}`, exception);
438
- }
439
- }
440
- }
441
- }
442
- const Translations = new TranslationsController();
443
-
444
- class BaseComponent {
445
- constructor(step) {
446
- this.apiErrorEvent = null;
447
- this.processError = null;
448
- this.apiCall = new ApiCall();
449
- if (step)
450
- this.flowStep = step;
451
- if (!state.device) {
452
- state.device = new DeviceDetection().getDevice();
453
- }
454
- Translations.getValues().then(data => {
455
- this.translations = data;
456
- });
457
- }
458
- setEventEmitter(event) {
459
- this.apiErrorEvent = event;
460
- }
461
- setErrorCallback(callback) {
462
- this.processError = callback;
463
- }
464
- async logStep(step, moment) {
465
- Events.flowEvent(step, moment);
466
- try {
467
- await this.apiCall.AddStep(step, moment);
468
- }
469
- catch (e) {
470
- if (this.apiErrorEvent)
471
- this.apiErrorEvent.emit(e);
472
- else
473
- this.processError(e, `${step}-${moment}`);
474
- }
475
- }
476
- async initialize() {
477
- Events.flowEvent(this.flowStep, FlowMoments.Initialized);
478
- try {
479
- await this.apiCall.AddStep(this.flowStep, FlowMoments.Initialized);
480
- }
481
- catch (e) {
482
- if (this.apiErrorEvent)
483
- this.apiErrorEvent.emit(e);
484
- else
485
- this.processError(e, `${this.flowStep}-${FlowMoments.Initialized}`);
486
- }
487
- }
488
- async finalize() {
489
- Events.flowEvent(this.flowStep, FlowMoments.Finalized);
490
- try {
491
- await this.apiCall.AddStep(this.flowStep, FlowMoments.Finalized);
492
- }
493
- catch (e) {
494
- if (this.apiErrorEvent)
495
- this.apiErrorEvent.emit(e);
496
- else
497
- this.processError(e, `${this.flowStep}-${FlowMoments.Finalized}`);
498
- }
499
- }
500
- }
501
-
502
- export { ApiCall as A, BaseComponent as B, Events as E, FlowSteps as F, OrderStatuses as O, FlowMoments as a };