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