@ekyc_qoobiss/qbs-ect-cmp 3.6.28 → 3.6.30
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.
- package/dist/cjs/{base-component-aa9e52bf.js → TranslationUtils-e23d3c71.js} +19 -234
- package/dist/cjs/agreement-check_19.cjs.entry.js +524 -284
- package/dist/cjs/random-actions.cjs.entry.js +5 -6
- package/dist/collection/components/base-component.js +0 -4
- package/dist/collection/components/common/agreement-check/agreement-check.js +6 -2
- package/dist/collection/components/common/camera-error/camera-error.js +7 -5
- package/dist/collection/components/common/capture-error/capture-error.js +12 -10
- package/dist/collection/components/common/how-to-info/how-to-info.js +11 -9
- package/dist/collection/components/common/id-back-capture/id-back-capture.js +8 -6
- package/dist/collection/components/common/id-capture/id-capture.js +6 -4
- package/dist/collection/components/common/id-tilt/id-tilt.js +6 -4
- package/dist/collection/components/common/random-actions/random-actions.js +5 -6
- package/dist/collection/components/common/selfie-capture/selfie-capture.js +7 -5
- package/dist/collection/components/common/selfie-tilt/selfie-tilt.js +8 -6
- package/dist/collection/components/flow/agreement-info/agreement-info.js +4 -2
- package/dist/collection/components/flow/end-redirect/end-redirect.js +5 -4
- package/dist/collection/components/flow/landing-validation/landing-validation.js +5 -3
- package/dist/collection/components/flow/mobile-redirect/mobile-redirect.js +8 -6
- package/dist/collection/components/flow/sms-code-validation/sms-code-validation.js +12 -10
- package/dist/collection/helpers/ApiCall.js +4 -0
- package/dist/collection/helpers/TranslationUtils.js +15 -7
- package/dist/collection/helpers/textValues.js +1 -0
- package/dist/esm/{base-component-b7f50d31.js → TranslationUtils-7c1f0f39.js} +19 -233
- package/dist/esm/agreement-check_19.entry.js +316 -76
- package/dist/esm/random-actions.entry.js +5 -6
- package/dist/qbs-ect-cmp/p-16f9efd0.entry.js +1 -0
- package/dist/qbs-ect-cmp/p-d82d57ff.js +1 -0
- package/dist/qbs-ect-cmp/{p-c32a782a.entry.js → p-fea085b0.entry.js} +2 -2
- package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
- package/dist/types/components/base-component.d.ts +0 -2
- package/dist/types/components/common/agreement-check/agreement-check.d.ts +2 -0
- package/dist/types/components/common/camera-error/camera-error.d.ts +1 -0
- package/dist/types/components/common/capture-error/capture-error.d.ts +1 -0
- package/dist/types/components/common/how-to-info/how-to-info.d.ts +2 -1
- package/dist/types/components/common/id-back-capture/id-back-capture.d.ts +1 -0
- package/dist/types/components/common/id-capture/id-capture.d.ts +1 -0
- package/dist/types/components/common/id-tilt/id-tilt.d.ts +1 -0
- package/dist/types/components/common/random-actions/random-actions.d.ts +2 -2
- package/dist/types/components/common/selfie-capture/selfie-capture.d.ts +2 -1
- package/dist/types/components/common/selfie-tilt/selfie-tilt.d.ts +2 -1
- package/dist/types/components/flow/agreement-info/agreement-info.d.ts +2 -1
- package/dist/types/components/flow/end-redirect/end-redirect.d.ts +2 -1
- package/dist/types/components/flow/landing-validation/landing-validation.d.ts +1 -0
- package/dist/types/components/flow/mobile-redirect/mobile-redirect.d.ts +1 -0
- package/dist/types/components/flow/sms-code-validation/sms-code-validation.d.ts +2 -1
- package/dist/types/helpers/ApiCall.d.ts +2 -0
- package/dist/types/helpers/TranslationUtils.d.ts +1 -0
- package/dist/types/helpers/textValues.d.ts +1 -0
- package/package.json +1 -1
- package/dist/i18n/en.json +0 -100
- package/dist/i18n/ro.json +0 -100
- package/dist/i18n/ru.json +0 -100
- package/dist/qbs-ect-cmp/p-215a7e76.entry.js +0 -1
- package/dist/qbs-ect-cmp/p-7bedffaa.js +0 -1
|
@@ -7,6 +7,7 @@ import { FlowStatus } from '../../../models/FlowStatus';
|
|
|
7
7
|
import { FlowSteps } from '../../../models/FlowSteps';
|
|
8
8
|
import { delay } from '../../../utils/utils';
|
|
9
9
|
import { BaseComponent } from '../../base-component';
|
|
10
|
+
import { Translations } from '../../../helpers/TranslationUtils';
|
|
10
11
|
export class MobileRedirect {
|
|
11
12
|
constructor() {
|
|
12
13
|
this.infoTextTop = undefined;
|
|
@@ -25,8 +26,9 @@ export class MobileRedirect {
|
|
|
25
26
|
}
|
|
26
27
|
async componentWillLoad() {
|
|
27
28
|
Events.flowStarted();
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
29
|
+
this.translations = await Translations.getValues();
|
|
30
|
+
this.infoTextTop = this.translations.MobileRedirectValues.InfoTop;
|
|
31
|
+
this.infoTextBottom = this.translations.MobileRedirectValues.InfoBottom;
|
|
30
32
|
let envUri = store.environment == 'QA' ? 'test' : 'ect';
|
|
31
33
|
let baseUri = store.hasIdBack ? 'https://onmd.id-kyc.com/' : 'https://onro.id-kyc.com/';
|
|
32
34
|
this.redirectLink = baseUri + envUri + '/mobileredirect?redirectId=' + store.redirectId;
|
|
@@ -60,12 +62,12 @@ export class MobileRedirect {
|
|
|
60
62
|
this.apiErrorEvent.emit({ message: 'No order was started for this process.' });
|
|
61
63
|
}
|
|
62
64
|
if (this.orderStatus == OrderStatuses.Capturing) {
|
|
63
|
-
this.infoTextTop = this.
|
|
65
|
+
this.infoTextTop = this.translations.MobileRedirectValues.InfoWaiting;
|
|
64
66
|
this.waitingMobile = true;
|
|
65
67
|
}
|
|
66
68
|
if (this.orderStatus == OrderStatuses.Aborted) {
|
|
67
69
|
this.waitingMobile = false;
|
|
68
|
-
this.infoTextTop = this.
|
|
70
|
+
this.infoTextTop = this.translations.MobileRedirectValues.InfoAborted;
|
|
69
71
|
Events.flowAborted();
|
|
70
72
|
}
|
|
71
73
|
}
|
|
@@ -78,7 +80,7 @@ export class MobileRedirect {
|
|
|
78
80
|
return;
|
|
79
81
|
}
|
|
80
82
|
this.waitingMobile = true;
|
|
81
|
-
this.infoTextTop = this.
|
|
83
|
+
this.infoTextTop = this.translations.MobileRedirectValues.InfoWaiting;
|
|
82
84
|
try {
|
|
83
85
|
await this.baseComponent.apiCall.SendLink(this.redirectLink, this.contact);
|
|
84
86
|
}
|
|
@@ -96,7 +98,7 @@ export class MobileRedirect {
|
|
|
96
98
|
ev.target.value = this.contact;
|
|
97
99
|
}
|
|
98
100
|
render() {
|
|
99
|
-
return (h("div", { class: "container" }, h("div", { class: "row" }, h("div", { hidden: this.waitingMobile }, h("div", { class: "text-center" }, h("p", { class: "font-size-2" }, this.infoTextTop)), h("div", { class: "qr-canvas align-center" }, h("img", { src: this.qrCode })), h("div", { class: "text-center" }, h("p", { class: "font-size-2" }, this.infoTextBottom)), h("div", { class: "input-container mb-15" }, h("label", { class: "font-size-18 mb-1 color-red", hidden: this.invalidValue == false }, h("b", null, this.
|
|
101
|
+
return (h("div", { class: "container" }, h("div", { class: "row" }, h("div", { hidden: this.waitingMobile }, h("div", { class: "text-center" }, h("p", { class: "font-size-2" }, this.infoTextTop)), h("div", { class: "qr-canvas align-center" }, h("img", { src: this.qrCode })), h("div", { class: "text-center" }, h("p", { class: "font-size-2" }, this.infoTextBottom)), h("div", { class: "input-container mb-15" }, h("label", { class: "font-size-18 mb-1 color-red", hidden: this.invalidValue == false }, h("b", null, this.translations.MobileRedirectValues.Validation)), h("input", { type: "text", id: "codeInput", class: "main-input", disabled: this.prefilledPhone, value: this.contact, onInput: ev => this.handleChangeContact(ev) })), h("div", { class: "pos-relative" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", onClick: () => this.buttonClick() }, "Trimite"), h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText)))), h("div", { hidden: this.waitingMobile == false }, h("div", { class: "text-center" }, h("p", { class: "font-size-2" }, this.infoTextTop))))));
|
|
100
102
|
}
|
|
101
103
|
static get is() { return "mobile-redirect"; }
|
|
102
104
|
static get originalStyleUrls() {
|
|
@@ -3,6 +3,7 @@ import store from '../../../helpers/store';
|
|
|
3
3
|
import { FlowStatus } from '../../../models/FlowStatus';
|
|
4
4
|
import { FlowSteps } from '../../../models/FlowSteps';
|
|
5
5
|
import { BaseComponent } from '../../base-component';
|
|
6
|
+
import { Translations } from '../../../helpers/TranslationUtils';
|
|
6
7
|
export class SmsCodeValidation {
|
|
7
8
|
constructor() {
|
|
8
9
|
this.title = undefined;
|
|
@@ -46,11 +47,12 @@ export class SmsCodeValidation {
|
|
|
46
47
|
async disconnectedCallback() {
|
|
47
48
|
await this.baseComponent.finalize();
|
|
48
49
|
}
|
|
49
|
-
componentWillRender() {
|
|
50
|
+
async componentWillRender() {
|
|
51
|
+
this.translations = await Translations.getValues();
|
|
50
52
|
if (store.flowStatus == FlowStatus.PHONE) {
|
|
51
|
-
this.title = this.
|
|
52
|
-
this.details = this.
|
|
53
|
-
this.buttonText = this.
|
|
53
|
+
this.title = this.translations.PhoneValidationValues.Title;
|
|
54
|
+
this.details = this.translations.PhoneValidationValues.Description;
|
|
55
|
+
this.buttonText = this.translations.PhoneValidationValues.Button;
|
|
54
56
|
if (store.phoneNumber && store.phoneNumber != '') {
|
|
55
57
|
this.phoneNumber = store.phoneNumber;
|
|
56
58
|
this.prefilledPhone = true;
|
|
@@ -58,9 +60,9 @@ export class SmsCodeValidation {
|
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
if (store.flowStatus == FlowStatus.CODE || store.flowStatus == FlowStatus.CODEERROR) {
|
|
61
|
-
this.title = this.
|
|
62
|
-
this.details = this.
|
|
63
|
-
this.buttonText = this.
|
|
63
|
+
this.title = this.translations.CodeValidationValues.Title;
|
|
64
|
+
this.details = this.translations.CodeValidationValues.Description;
|
|
65
|
+
this.buttonText = this.translations.CodeValidationValues.Button;
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
async componentDidLoad() {
|
|
@@ -86,15 +88,15 @@ export class SmsCodeValidation {
|
|
|
86
88
|
let inputBlock;
|
|
87
89
|
let errorBlock;
|
|
88
90
|
if (store.flowStatus == FlowStatus.CODEERROR) {
|
|
89
|
-
errorBlock = h("p", { class: "main-text font-size-18 mt-15 color-red text-center" }, this.
|
|
91
|
+
errorBlock = h("p", { class: "main-text font-size-18 mt-15 color-red text-center" }, this.translations.CodeValidationValues.Error);
|
|
90
92
|
}
|
|
91
93
|
if (store.flowStatus == FlowStatus.PHONE) {
|
|
92
|
-
inputBlock = (h("div", { class: "input-container mb-15" }, h("label", { class: "font-size-18 mb-1" }, h("b", null, this.
|
|
94
|
+
inputBlock = (h("div", { class: "input-container mb-15" }, h("label", { class: "font-size-18 mb-1" }, h("b", null, this.translations.PhoneValidationValues.Label)), h("input", { type: "tel", id: "phoneInput", class: "main-input", disabled: this.prefilledPhone, onInput: ev => this.handleChangePhone(ev), value: this.phoneNumber })));
|
|
93
95
|
}
|
|
94
96
|
else {
|
|
95
97
|
inputBlock = (h("div", { class: "input-container mb-15" }, h("input", { type: "text", id: "codeInput", class: "main-input", onInput: ev => this.handleChangeCode(ev), value: this.code })));
|
|
96
98
|
}
|
|
97
|
-
return (h("div", { class: "container" }, h("div", { class: "row row-validare" }, h("div", null, h("h1", { class: "text-center" }, this.title), errorBlock == null ? h("p", { class: "main-text font-size-2 mt-15 mb-20 text-center" }, this.details) : errorBlock), inputBlock, h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { id: "action", disabled: !this.canSend, class: "main-button", onClick: () => this.doAction() }, this.buttonText), h("p", { class: "main-text font-size-18 text-right mb-0" }, this.
|
|
99
|
+
return (h("div", { class: "container" }, h("div", { class: "row row-validare" }, h("div", null, h("h1", { class: "text-center" }, this.title), errorBlock == null ? h("p", { class: "main-text font-size-2 mt-15 mb-20 text-center" }, this.details) : errorBlock), inputBlock, h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { id: "action", disabled: !this.canSend, class: "main-button", onClick: () => this.doAction() }, this.buttonText), h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText))))));
|
|
98
100
|
}
|
|
99
101
|
static get is() { return "sms-code-validation"; }
|
|
100
102
|
static get originalStyleUrls() {
|
|
@@ -220,4 +220,8 @@ export class ApiCall {
|
|
|
220
220
|
let result = await this.post(this.urls.AbortRequest, JSON.stringify({ requestId: store.requestId }));
|
|
221
221
|
return result.saved;
|
|
222
222
|
}
|
|
223
|
+
async GetTranslations(langIso) {
|
|
224
|
+
let result = await this.get(this.urls.Translations + '?langIso=' + langIso);
|
|
225
|
+
return result;
|
|
226
|
+
}
|
|
223
227
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { ApiCall } from './ApiCall';
|
|
1
2
|
import store from './store';
|
|
2
3
|
class TranslationsController {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.apiCall = new ApiCall();
|
|
6
|
+
}
|
|
3
7
|
async getValues() {
|
|
4
8
|
if (this.values) {
|
|
5
9
|
return this.values;
|
|
@@ -10,8 +14,13 @@ class TranslationsController {
|
|
|
10
14
|
}
|
|
11
15
|
}
|
|
12
16
|
getLocale(element = document.body) {
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
if (store.langIso && store.langIso != '') {
|
|
18
|
+
return store.langIso;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
const closestElement = element.closest('[lang]');
|
|
22
|
+
return closestElement ? closestElement.lang : 'ro';
|
|
23
|
+
}
|
|
15
24
|
}
|
|
16
25
|
async fetchTranslations() {
|
|
17
26
|
const locale = this.getLocale();
|
|
@@ -21,11 +30,10 @@ class TranslationsController {
|
|
|
21
30
|
}
|
|
22
31
|
else {
|
|
23
32
|
try {
|
|
24
|
-
const result =
|
|
25
|
-
if (result
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return data;
|
|
33
|
+
const result = this.apiCall.GetTranslations(locale);
|
|
34
|
+
if (result) {
|
|
35
|
+
sessionStorage.setItem(`i18n.${locale}`, JSON.stringify(result));
|
|
36
|
+
return result;
|
|
29
37
|
}
|
|
30
38
|
}
|
|
31
39
|
catch (exception) {
|
|
@@ -44,5 +44,6 @@ export class ApiUrls {
|
|
|
44
44
|
this.AddLog = this.uriEnv + 'validation/logs/add';
|
|
45
45
|
this.AddStep = this.uriEnv + 'validation/logs/step';
|
|
46
46
|
this.AbortRequest = this.uriEnv + 'validation/identity/abort';
|
|
47
|
+
this.Translations = this.uriEnv + 'validation/translations/get';
|
|
47
48
|
}
|
|
48
49
|
}
|
|
@@ -260,6 +260,7 @@ class ApiUrls {
|
|
|
260
260
|
this.AddLog = this.uriEnv + 'validation/logs/add';
|
|
261
261
|
this.AddStep = this.uriEnv + 'validation/logs/step';
|
|
262
262
|
this.AbortRequest = this.uriEnv + 'validation/identity/abort';
|
|
263
|
+
this.Translations = this.uriEnv + 'validation/translations/get';
|
|
263
264
|
}
|
|
264
265
|
}
|
|
265
266
|
|
|
@@ -556,177 +557,16 @@ class ApiCall {
|
|
|
556
557
|
let result = await this.post(this.urls.AbortRequest, JSON.stringify({ requestId: state.requestId }));
|
|
557
558
|
return result.saved;
|
|
558
559
|
}
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
(function (MobileOS) {
|
|
563
|
-
MobileOS["Android"] = "android";
|
|
564
|
-
MobileOS["iOS"] = "ios";
|
|
565
|
-
MobileOS["Unknown"] = "unknown";
|
|
566
|
-
MobileOS["WindowsPhone"] = "Windows Phone";
|
|
567
|
-
})(MobileOS || (MobileOS = {}));
|
|
568
|
-
var DesktopOS;
|
|
569
|
-
(function (DesktopOS) {
|
|
570
|
-
DesktopOS["Linux"] = "linux";
|
|
571
|
-
DesktopOS["MacOS"] = "mac_os";
|
|
572
|
-
DesktopOS["Unix"] = "unix";
|
|
573
|
-
DesktopOS["Unknown"] = "unknown";
|
|
574
|
-
DesktopOS["Windows"] = "windows";
|
|
575
|
-
})(DesktopOS || (DesktopOS = {}));
|
|
576
|
-
var Browser;
|
|
577
|
-
(function (Browser) {
|
|
578
|
-
Browser["Chrome"] = "chrome";
|
|
579
|
-
Browser["Firefox"] = "firefox";
|
|
580
|
-
Browser["Safari"] = "safari";
|
|
581
|
-
Browser["Mi"] = "mi";
|
|
582
|
-
Browser["Unknown"] = "unknown";
|
|
583
|
-
})(Browser || (Browser = {}));
|
|
584
|
-
|
|
585
|
-
class DeviceDetection {
|
|
586
|
-
constructor() {
|
|
587
|
-
var _a, _b, _c, _d;
|
|
588
|
-
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;
|
|
589
|
-
this.safariScreenOrientation = !(screen === null || screen === void 0 ? void 0 : screen.orientation) && matchMedia('(orientation: portrait)').matches ? 'portrait-primary' : 'landscape-primary';
|
|
590
|
-
this.initialScreenOrientation = (_d = (_c = this.supportedScreenOrientation) !== null && _c !== void 0 ? _c : this.safariScreenOrientation) !== null && _d !== void 0 ? _d : 'portrait-primary';
|
|
591
|
-
this.userAgent = navigator.userAgent || navigator.vendor || window.opera || undefined;
|
|
592
|
-
this.isMobile = this.isMobileDevice();
|
|
593
|
-
this.isTablet = this.isTabletDevice();
|
|
594
|
-
this.isDesktop = !this.isMobile && !this.isTablet;
|
|
595
|
-
}
|
|
596
|
-
// Device typology
|
|
597
|
-
isMobileDevice() {
|
|
598
|
-
const regexs = [/(Android)(.+)(Mobile)/i, /BlackBerry/i, /iPhone|iPod/i, /Opera Mini/i, /IEMobile/i];
|
|
599
|
-
return regexs.some(b => this.userAgent.match(b));
|
|
600
|
-
}
|
|
601
|
-
isTabletDevice() {
|
|
602
|
-
const regex = /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/;
|
|
603
|
-
return regex.test(this.userAgent.toLowerCase());
|
|
604
|
-
}
|
|
605
|
-
// Device Operating System
|
|
606
|
-
getMobileOS() {
|
|
607
|
-
if (this.isMobileDevice()) {
|
|
608
|
-
if (/windows phone/i.test(this.userAgent))
|
|
609
|
-
return MobileOS.WindowsPhone;
|
|
610
|
-
else if (/android/i.test(this.userAgent))
|
|
611
|
-
return MobileOS.Android;
|
|
612
|
-
else if (/iPad|iPhone|iPod/.test(this.userAgent) && !window.MSStream)
|
|
613
|
-
return MobileOS.iOS;
|
|
614
|
-
return MobileOS.Unknown;
|
|
615
|
-
}
|
|
616
|
-
else
|
|
617
|
-
return undefined;
|
|
618
|
-
}
|
|
619
|
-
getDesktopOS() {
|
|
620
|
-
if (this.isDesktop) {
|
|
621
|
-
if (this.userAgent.indexOf('Win') !== -1)
|
|
622
|
-
return DesktopOS.Windows;
|
|
623
|
-
else if (this.userAgent.indexOf('Mac') !== -1)
|
|
624
|
-
return DesktopOS.MacOS;
|
|
625
|
-
else if (this.userAgent.indexOf('X11') !== -1)
|
|
626
|
-
return DesktopOS.Unix;
|
|
627
|
-
else if (this.userAgent.indexOf('Linux') !== -1)
|
|
628
|
-
return DesktopOS.Linux;
|
|
629
|
-
return DesktopOS.Unknown;
|
|
630
|
-
}
|
|
631
|
-
else
|
|
632
|
-
return undefined;
|
|
633
|
-
}
|
|
634
|
-
getDeviceOS() {
|
|
635
|
-
var _a;
|
|
636
|
-
return (_a = this.getMobileOS()) !== null && _a !== void 0 ? _a : this.getDesktopOS();
|
|
637
|
-
}
|
|
638
|
-
getBrowser() {
|
|
639
|
-
if (/XiaoMi/i.test(this.userAgent) || /MiuiBrowser/i.test(this.userAgent))
|
|
640
|
-
return Browser.Mi;
|
|
641
|
-
var isChrome = /chrome/i.test(this.userAgent);
|
|
642
|
-
if (isChrome)
|
|
643
|
-
return Browser.Chrome;
|
|
644
|
-
if (/firefox/i.test(navigator.userAgent))
|
|
645
|
-
return Browser.Firefox;
|
|
646
|
-
else if (!isChrome && /safari/i.test(navigator.userAgent))
|
|
647
|
-
return Browser.Safari;
|
|
648
|
-
else
|
|
649
|
-
return Browser.Unknown;
|
|
650
|
-
}
|
|
651
|
-
getDevice() {
|
|
652
|
-
var device = {
|
|
653
|
-
isDesktop: this.isDesktop,
|
|
654
|
-
desktopOS: this.getDesktopOS(),
|
|
655
|
-
isWindowsDesktop: this.getDeviceOS() === DesktopOS.Windows,
|
|
656
|
-
isLinuxOrUnixDesktop: this.getDeviceOS() === DesktopOS.Linux || this.getDeviceOS() === DesktopOS.Unix,
|
|
657
|
-
isMobile: this.isMobile,
|
|
658
|
-
mobileOS: this.getMobileOS(),
|
|
659
|
-
isAndroidDevice: this.getDeviceOS() === MobileOS.Android,
|
|
660
|
-
isAppleDevice: this.getDeviceOS() === MobileOS.iOS || this.getDeviceOS() === DesktopOS.MacOS,
|
|
661
|
-
isUnknownMobileDevice: this.getDeviceOS() === MobileOS.Unknown,
|
|
662
|
-
browser: this.getBrowser(),
|
|
663
|
-
isTablet: this.isTablet,
|
|
664
|
-
initialScreenOrientation: this.initialScreenOrientation,
|
|
665
|
-
};
|
|
666
|
-
return device;
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
class Events {
|
|
671
|
-
static init(element) {
|
|
672
|
-
this.callingModule = element;
|
|
673
|
-
}
|
|
674
|
-
static flowEvent(step, moment) {
|
|
675
|
-
const eventName = `ect-${step.toString()}-${moment.toString()}-event`;
|
|
676
|
-
this.callingModule.dispatchEvent(new CustomEvent(eventName, {
|
|
677
|
-
detail: {},
|
|
678
|
-
bubbles: true,
|
|
679
|
-
cancelable: true,
|
|
680
|
-
composed: true,
|
|
681
|
-
}));
|
|
682
|
-
}
|
|
683
|
-
static flowStarted() {
|
|
684
|
-
this.callingModule.dispatchEvent(new CustomEvent('ect-started', {
|
|
685
|
-
detail: {},
|
|
686
|
-
bubbles: true,
|
|
687
|
-
cancelable: true,
|
|
688
|
-
composed: true,
|
|
689
|
-
}));
|
|
690
|
-
}
|
|
691
|
-
static flowAborted() {
|
|
692
|
-
sessionStorage.clear();
|
|
693
|
-
this.callingModule.dispatchEvent(new CustomEvent('ect-aborted', {
|
|
694
|
-
detail: {},
|
|
695
|
-
bubbles: true,
|
|
696
|
-
cancelable: true,
|
|
697
|
-
composed: true,
|
|
698
|
-
}));
|
|
699
|
-
}
|
|
700
|
-
static flowCompleted() {
|
|
701
|
-
sessionStorage.clear();
|
|
702
|
-
this.callingModule.dispatchEvent(new CustomEvent('ect-completed', {
|
|
703
|
-
detail: {},
|
|
704
|
-
bubbles: true,
|
|
705
|
-
cancelable: true,
|
|
706
|
-
composed: true,
|
|
707
|
-
}));
|
|
708
|
-
}
|
|
709
|
-
static flowError(error) {
|
|
710
|
-
sessionStorage.clear();
|
|
711
|
-
this.callingModule.dispatchEvent(new CustomEvent('ect-error', {
|
|
712
|
-
detail: { error },
|
|
713
|
-
bubbles: true,
|
|
714
|
-
cancelable: true,
|
|
715
|
-
composed: true,
|
|
716
|
-
}));
|
|
717
|
-
}
|
|
718
|
-
static tokenExpired() {
|
|
719
|
-
sessionStorage.clear();
|
|
720
|
-
this.callingModule.dispatchEvent(new CustomEvent('ect-session-expired', {
|
|
721
|
-
detail: {},
|
|
722
|
-
bubbles: true,
|
|
723
|
-
cancelable: true,
|
|
724
|
-
composed: true,
|
|
725
|
-
}));
|
|
560
|
+
async GetTranslations(langIso) {
|
|
561
|
+
let result = await this.get(this.urls.Translations + '?langIso=' + langIso);
|
|
562
|
+
return result;
|
|
726
563
|
}
|
|
727
564
|
}
|
|
728
565
|
|
|
729
566
|
class TranslationsController {
|
|
567
|
+
constructor() {
|
|
568
|
+
this.apiCall = new ApiCall();
|
|
569
|
+
}
|
|
730
570
|
async getValues() {
|
|
731
571
|
if (this.values) {
|
|
732
572
|
return this.values;
|
|
@@ -737,8 +577,13 @@ class TranslationsController {
|
|
|
737
577
|
}
|
|
738
578
|
}
|
|
739
579
|
getLocale(element = document.body) {
|
|
740
|
-
|
|
741
|
-
|
|
580
|
+
if (state.langIso && state.langIso != '') {
|
|
581
|
+
return state.langIso;
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
const closestElement = element.closest('[lang]');
|
|
585
|
+
return closestElement ? closestElement.lang : 'ro';
|
|
586
|
+
}
|
|
742
587
|
}
|
|
743
588
|
async fetchTranslations() {
|
|
744
589
|
const locale = this.getLocale();
|
|
@@ -748,11 +593,10 @@ class TranslationsController {
|
|
|
748
593
|
}
|
|
749
594
|
else {
|
|
750
595
|
try {
|
|
751
|
-
const result =
|
|
752
|
-
if (result
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
return data;
|
|
596
|
+
const result = this.apiCall.GetTranslations(locale);
|
|
597
|
+
if (result) {
|
|
598
|
+
sessionStorage.setItem(`i18n.${locale}`, JSON.stringify(result));
|
|
599
|
+
return result;
|
|
756
600
|
}
|
|
757
601
|
}
|
|
758
602
|
catch (exception) {
|
|
@@ -763,62 +607,4 @@ class TranslationsController {
|
|
|
763
607
|
}
|
|
764
608
|
const Translations = new TranslationsController();
|
|
765
609
|
|
|
766
|
-
|
|
767
|
-
constructor(step) {
|
|
768
|
-
this.apiErrorEvent = null;
|
|
769
|
-
this.processError = null;
|
|
770
|
-
this.apiCall = new ApiCall();
|
|
771
|
-
if (step)
|
|
772
|
-
this.flowStep = step;
|
|
773
|
-
if (!state.device) {
|
|
774
|
-
state.device = new DeviceDetection().getDevice();
|
|
775
|
-
}
|
|
776
|
-
Translations.getValues().then(data => {
|
|
777
|
-
this.translations = data;
|
|
778
|
-
});
|
|
779
|
-
}
|
|
780
|
-
setEventEmitter(event) {
|
|
781
|
-
this.apiErrorEvent = event;
|
|
782
|
-
}
|
|
783
|
-
setErrorCallback(callback) {
|
|
784
|
-
this.processError = callback;
|
|
785
|
-
}
|
|
786
|
-
async logStep(step, moment) {
|
|
787
|
-
Events.flowEvent(step, moment);
|
|
788
|
-
try {
|
|
789
|
-
await this.apiCall.AddStep(step, moment);
|
|
790
|
-
}
|
|
791
|
-
catch (e) {
|
|
792
|
-
if (this.apiErrorEvent)
|
|
793
|
-
this.apiErrorEvent.emit(e);
|
|
794
|
-
else
|
|
795
|
-
this.processError(e, `${step}-${moment}`);
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
async initialize() {
|
|
799
|
-
Events.flowEvent(this.flowStep, FlowMoments.Initialized);
|
|
800
|
-
try {
|
|
801
|
-
await this.apiCall.AddStep(this.flowStep, FlowMoments.Initialized);
|
|
802
|
-
}
|
|
803
|
-
catch (e) {
|
|
804
|
-
if (this.apiErrorEvent)
|
|
805
|
-
this.apiErrorEvent.emit(e);
|
|
806
|
-
else
|
|
807
|
-
this.processError(e, `${this.flowStep}-${FlowMoments.Initialized}`);
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
async finalize() {
|
|
811
|
-
Events.flowEvent(this.flowStep, FlowMoments.Finalized);
|
|
812
|
-
try {
|
|
813
|
-
await this.apiCall.AddStep(this.flowStep, FlowMoments.Finalized);
|
|
814
|
-
}
|
|
815
|
-
catch (e) {
|
|
816
|
-
if (this.apiErrorEvent)
|
|
817
|
-
this.apiErrorEvent.emit(e);
|
|
818
|
-
else
|
|
819
|
-
this.processError(e, `${this.flowStep}-${FlowMoments.Finalized}`);
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
export { ApiCall as A, BaseComponent as B, Events as E, FlowSteps as F, IdCaptureValues as I, MobileOS as M, OrderStatuses as O, SessionKeys as S, FlowStatus as a, Browser as b, FlowMoments as c, SelfieCaptureValues as d, state as s };
|
|
610
|
+
export { ApiCall as A, FlowMoments as F, IdCaptureValues as I, OrderStatuses as O, SessionKeys as S, Translations as T, FlowSteps as a, FlowStatus as b, SelfieCaptureValues as c, state as s };
|