@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.
- package/dist/cjs/TranslationUtils-b918ffb1.js +346 -0
- package/dist/cjs/agreement-check_19.cjs.entry.js +783 -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/esm/TranslationUtils-8ceeb437.js +339 -0
- package/dist/esm/agreement-check_19.entry.js +575 -76
- package/dist/esm/random-actions.entry.js +5 -6
- package/dist/qbs-ect-cmp/p-473a4636.entry.js +1 -0
- package/dist/qbs-ect-cmp/{p-c32a782a.entry.js → p-b2c9c8d7.entry.js} +2 -2
- package/dist/qbs-ect-cmp/p-e568a07c.js +1 -0
- 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/package.json +1 -1
- package/dist/cjs/base-component-aa9e52bf.js +0 -832
- package/dist/esm/base-component-b7f50d31.js +0 -824
- package/dist/qbs-ect-cmp/p-215a7e76.entry.js +0 -1
- package/dist/qbs-ect-cmp/p-7bedffaa.js +0 -1
|
@@ -1,824 +0,0 @@
|
|
|
1
|
-
import { a as getRenderingRef, f as forceUpdate } from './index-cf54a432.js';
|
|
2
|
-
|
|
3
|
-
var OrderStatuses;
|
|
4
|
-
(function (OrderStatuses) {
|
|
5
|
-
OrderStatuses[OrderStatuses["Capturing"] = 0] = "Capturing";
|
|
6
|
-
OrderStatuses[OrderStatuses["FinishedCapturing"] = 1] = "FinishedCapturing";
|
|
7
|
-
OrderStatuses[OrderStatuses["Waiting"] = 2] = "Waiting";
|
|
8
|
-
OrderStatuses[OrderStatuses["NotFound"] = 3] = "NotFound";
|
|
9
|
-
OrderStatuses[OrderStatuses["Aborted"] = 4] = "Aborted";
|
|
10
|
-
})(OrderStatuses || (OrderStatuses = {}));
|
|
11
|
-
|
|
12
|
-
const appendToMap = (map, propName, value) => {
|
|
13
|
-
const items = map.get(propName);
|
|
14
|
-
if (!items) {
|
|
15
|
-
map.set(propName, [value]);
|
|
16
|
-
}
|
|
17
|
-
else if (!items.includes(value)) {
|
|
18
|
-
items.push(value);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const debounce = (fn, ms) => {
|
|
22
|
-
let timeoutId;
|
|
23
|
-
return (...args) => {
|
|
24
|
-
if (timeoutId) {
|
|
25
|
-
clearTimeout(timeoutId);
|
|
26
|
-
}
|
|
27
|
-
timeoutId = setTimeout(() => {
|
|
28
|
-
timeoutId = 0;
|
|
29
|
-
fn(...args);
|
|
30
|
-
}, ms);
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Check if a possible element isConnected.
|
|
36
|
-
* The property might not be there, so we check for it.
|
|
37
|
-
*
|
|
38
|
-
* We want it to return true if isConnected is not a property,
|
|
39
|
-
* otherwise we would remove these elements and would not update.
|
|
40
|
-
*
|
|
41
|
-
* Better leak in Edge than to be useless.
|
|
42
|
-
*/
|
|
43
|
-
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
44
|
-
const cleanupElements = debounce((map) => {
|
|
45
|
-
for (let key of map.keys()) {
|
|
46
|
-
map.set(key, map.get(key).filter(isConnected));
|
|
47
|
-
}
|
|
48
|
-
}, 2000);
|
|
49
|
-
const stencilSubscription = () => {
|
|
50
|
-
if (typeof getRenderingRef !== 'function') {
|
|
51
|
-
// If we are not in a stencil project, we do nothing.
|
|
52
|
-
// This function is not really exported by @stencil/core.
|
|
53
|
-
return {};
|
|
54
|
-
}
|
|
55
|
-
const elmsToUpdate = new Map();
|
|
56
|
-
return {
|
|
57
|
-
dispose: () => elmsToUpdate.clear(),
|
|
58
|
-
get: (propName) => {
|
|
59
|
-
const elm = getRenderingRef();
|
|
60
|
-
if (elm) {
|
|
61
|
-
appendToMap(elmsToUpdate, propName, elm);
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
set: (propName) => {
|
|
65
|
-
const elements = elmsToUpdate.get(propName);
|
|
66
|
-
if (elements) {
|
|
67
|
-
elmsToUpdate.set(propName, elements.filter(forceUpdate));
|
|
68
|
-
}
|
|
69
|
-
cleanupElements(elmsToUpdate);
|
|
70
|
-
},
|
|
71
|
-
reset: () => {
|
|
72
|
-
elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
|
|
73
|
-
cleanupElements(elmsToUpdate);
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const unwrap = (val) => (typeof val === 'function' ? val() : val);
|
|
79
|
-
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
80
|
-
const unwrappedState = unwrap(defaultState);
|
|
81
|
-
let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
|
|
82
|
-
const handlers = {
|
|
83
|
-
dispose: [],
|
|
84
|
-
get: [],
|
|
85
|
-
set: [],
|
|
86
|
-
reset: [],
|
|
87
|
-
};
|
|
88
|
-
const reset = () => {
|
|
89
|
-
var _a;
|
|
90
|
-
// When resetting the state, the default state may be a function - unwrap it to invoke it.
|
|
91
|
-
// otherwise, the state won't be properly reset
|
|
92
|
-
states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));
|
|
93
|
-
handlers.reset.forEach((cb) => cb());
|
|
94
|
-
};
|
|
95
|
-
const dispose = () => {
|
|
96
|
-
// Call first dispose as resetting the state would
|
|
97
|
-
// cause less updates ;)
|
|
98
|
-
handlers.dispose.forEach((cb) => cb());
|
|
99
|
-
reset();
|
|
100
|
-
};
|
|
101
|
-
const get = (propName) => {
|
|
102
|
-
handlers.get.forEach((cb) => cb(propName));
|
|
103
|
-
return states.get(propName);
|
|
104
|
-
};
|
|
105
|
-
const set = (propName, value) => {
|
|
106
|
-
const oldValue = states.get(propName);
|
|
107
|
-
if (shouldUpdate(value, oldValue, propName)) {
|
|
108
|
-
states.set(propName, value);
|
|
109
|
-
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
const state = (typeof Proxy === 'undefined'
|
|
113
|
-
? {}
|
|
114
|
-
: new Proxy(unwrappedState, {
|
|
115
|
-
get(_, propName) {
|
|
116
|
-
return get(propName);
|
|
117
|
-
},
|
|
118
|
-
ownKeys(_) {
|
|
119
|
-
return Array.from(states.keys());
|
|
120
|
-
},
|
|
121
|
-
getOwnPropertyDescriptor() {
|
|
122
|
-
return {
|
|
123
|
-
enumerable: true,
|
|
124
|
-
configurable: true,
|
|
125
|
-
};
|
|
126
|
-
},
|
|
127
|
-
has(_, propName) {
|
|
128
|
-
return states.has(propName);
|
|
129
|
-
},
|
|
130
|
-
set(_, propName, value) {
|
|
131
|
-
set(propName, value);
|
|
132
|
-
return true;
|
|
133
|
-
},
|
|
134
|
-
}));
|
|
135
|
-
const on = (eventName, callback) => {
|
|
136
|
-
handlers[eventName].push(callback);
|
|
137
|
-
return () => {
|
|
138
|
-
removeFromArray(handlers[eventName], callback);
|
|
139
|
-
};
|
|
140
|
-
};
|
|
141
|
-
const onChange = (propName, cb) => {
|
|
142
|
-
const unSet = on('set', (key, newValue) => {
|
|
143
|
-
if (key === propName) {
|
|
144
|
-
cb(newValue);
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
// We need to unwrap the defaultState because it might be a function.
|
|
148
|
-
// Otherwise we might not be sending the right reset value.
|
|
149
|
-
const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
|
|
150
|
-
return () => {
|
|
151
|
-
unSet();
|
|
152
|
-
unReset();
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
const use = (...subscriptions) => {
|
|
156
|
-
const unsubs = subscriptions.reduce((unsubs, subscription) => {
|
|
157
|
-
if (subscription.set) {
|
|
158
|
-
unsubs.push(on('set', subscription.set));
|
|
159
|
-
}
|
|
160
|
-
if (subscription.get) {
|
|
161
|
-
unsubs.push(on('get', subscription.get));
|
|
162
|
-
}
|
|
163
|
-
if (subscription.reset) {
|
|
164
|
-
unsubs.push(on('reset', subscription.reset));
|
|
165
|
-
}
|
|
166
|
-
if (subscription.dispose) {
|
|
167
|
-
unsubs.push(on('dispose', subscription.dispose));
|
|
168
|
-
}
|
|
169
|
-
return unsubs;
|
|
170
|
-
}, []);
|
|
171
|
-
return () => unsubs.forEach((unsub) => unsub());
|
|
172
|
-
};
|
|
173
|
-
const forceUpdate = (key) => {
|
|
174
|
-
const oldValue = states.get(key);
|
|
175
|
-
handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
|
|
176
|
-
};
|
|
177
|
-
return {
|
|
178
|
-
state,
|
|
179
|
-
get,
|
|
180
|
-
set,
|
|
181
|
-
on,
|
|
182
|
-
onChange,
|
|
183
|
-
use,
|
|
184
|
-
dispose,
|
|
185
|
-
reset,
|
|
186
|
-
forceUpdate,
|
|
187
|
-
};
|
|
188
|
-
};
|
|
189
|
-
const removeFromArray = (array, item) => {
|
|
190
|
-
const index = array.indexOf(item);
|
|
191
|
-
if (index >= 0) {
|
|
192
|
-
array[index] = array[array.length - 1];
|
|
193
|
-
array.length--;
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
const createStore = (defaultState, shouldUpdate) => {
|
|
198
|
-
const map = createObservableMap(defaultState, shouldUpdate);
|
|
199
|
-
map.use(stencilSubscription());
|
|
200
|
-
return map;
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
var FlowStatus;
|
|
204
|
-
(function (FlowStatus) {
|
|
205
|
-
FlowStatus[FlowStatus["LANDING"] = 0] = "LANDING";
|
|
206
|
-
FlowStatus[FlowStatus["AGREEMENT"] = 1] = "AGREEMENT";
|
|
207
|
-
FlowStatus[FlowStatus["PHONE"] = 2] = "PHONE";
|
|
208
|
-
FlowStatus[FlowStatus["CODE"] = 3] = "CODE";
|
|
209
|
-
FlowStatus[FlowStatus["CODEERROR"] = 4] = "CODEERROR";
|
|
210
|
-
FlowStatus[FlowStatus["ID"] = 5] = "ID";
|
|
211
|
-
FlowStatus[FlowStatus["LIVENESS"] = 6] = "LIVENESS";
|
|
212
|
-
FlowStatus[FlowStatus["COMPLETE"] = 7] = "COMPLETE";
|
|
213
|
-
FlowStatus[FlowStatus["ERROREND"] = 8] = "ERROREND";
|
|
214
|
-
FlowStatus[FlowStatus["CAMERAERROR"] = 9] = "CAMERAERROR";
|
|
215
|
-
FlowStatus[FlowStatus["NONE"] = 10] = "NONE";
|
|
216
|
-
})(FlowStatus || (FlowStatus = {}));
|
|
217
|
-
|
|
218
|
-
class IdCaptureValues {
|
|
219
|
-
}
|
|
220
|
-
IdCaptureValues.IDPoseDemoMapping = {
|
|
221
|
-
0: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_front.mp4',
|
|
222
|
-
1: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_front_tilt.mp4',
|
|
223
|
-
2: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_rotate.mp4',
|
|
224
|
-
3: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_back.mp4',
|
|
225
|
-
4: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_back_tilt.mp4',
|
|
226
|
-
};
|
|
227
|
-
class SelfieCaptureValues {
|
|
228
|
-
}
|
|
229
|
-
SelfieCaptureValues.FacePoseDemoMapping = {
|
|
230
|
-
0: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_rotate_left.mp4',
|
|
231
|
-
1: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_rotate_right.mp4',
|
|
232
|
-
2: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_back.mp4',
|
|
233
|
-
3: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_front.mp4',
|
|
234
|
-
// 4: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_left.mp4',
|
|
235
|
-
// 5: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_right.mp4',
|
|
236
|
-
4: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_main.mp4',
|
|
237
|
-
};
|
|
238
|
-
class SessionKeys {
|
|
239
|
-
}
|
|
240
|
-
SessionKeys.FlowStatusKey = 'qbs-ect-flowstatus';
|
|
241
|
-
SessionKeys.RequestIdKey = 'qbs-ect-requestid';
|
|
242
|
-
SessionKeys.TokenKey = 'qbs-ect-token';
|
|
243
|
-
SessionKeys.InitialisedKey = 'qbs-ect-initialised';
|
|
244
|
-
SessionKeys.HasIdBackKey = 'qbs-ect-has-id-back';
|
|
245
|
-
SessionKeys.AgreementValidationKey = 'qbs-ect-agreement-validation';
|
|
246
|
-
SessionKeys.PhoneValidationKey = 'qbs-ect-phone-validation';
|
|
247
|
-
SessionKeys.RefreshDoneKey = 'qbs-ect-refresh-done';
|
|
248
|
-
class ApiUrls {
|
|
249
|
-
constructor() {
|
|
250
|
-
this.uriEnv = '/';
|
|
251
|
-
this.uriEnv = state.environment == 'QA' ? '/dev_' : '/';
|
|
252
|
-
this.OtpSend = this.uriEnv + 'validation/otp/send';
|
|
253
|
-
this.OtpCheck = this.uriEnv + 'validation/otp/check';
|
|
254
|
-
this.IdentityInsert = this.uriEnv + 'validation/identity/insert';
|
|
255
|
-
this.UploadCapture = this.uriEnv + 'validation/upload/capture';
|
|
256
|
-
this.GetAgreement = this.uriEnv + 'validation/agreement/content';
|
|
257
|
-
this.GenerateAgreement = this.uriEnv + 'validation/agreement/generate';
|
|
258
|
-
this.SendLink = this.uriEnv + 'validation/otp/sendlink';
|
|
259
|
-
this.GetStatus = this.uriEnv + 'validation/identity/status';
|
|
260
|
-
this.AddLog = this.uriEnv + 'validation/logs/add';
|
|
261
|
-
this.AddStep = this.uriEnv + 'validation/logs/step';
|
|
262
|
-
this.AbortRequest = this.uriEnv + 'validation/identity/abort';
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
const { state, onChange } = createStore({
|
|
267
|
-
flowStatus: FlowStatus.NONE,
|
|
268
|
-
environment: 'PROD',
|
|
269
|
-
debug: false,
|
|
270
|
-
requestId: '',
|
|
271
|
-
redirectId: '',
|
|
272
|
-
initialised: false,
|
|
273
|
-
token: '',
|
|
274
|
-
cameraIds: [],
|
|
275
|
-
cameraId: '',
|
|
276
|
-
hasIdBack: false,
|
|
277
|
-
hasSelfieGesture: false,
|
|
278
|
-
hasIdTilt: false,
|
|
279
|
-
agreementsValidation: true,
|
|
280
|
-
phoneValidation: true,
|
|
281
|
-
phoneNumber: '',
|
|
282
|
-
apiBaseUrl: 'https://apiro.id-kyc.com',
|
|
283
|
-
device: null,
|
|
284
|
-
langIso: 'ro',
|
|
285
|
-
});
|
|
286
|
-
onChange('environment', value => {
|
|
287
|
-
state.debug = value == 'QA';
|
|
288
|
-
});
|
|
289
|
-
onChange('flowStatus', value => {
|
|
290
|
-
sessionStorage.setItem(SessionKeys.FlowStatusKey, FlowStatus[value]);
|
|
291
|
-
});
|
|
292
|
-
onChange('token', value => {
|
|
293
|
-
sessionStorage.setItem(SessionKeys.TokenKey, value);
|
|
294
|
-
});
|
|
295
|
-
onChange('requestId', value => {
|
|
296
|
-
sessionStorage.setItem(SessionKeys.RequestIdKey, value);
|
|
297
|
-
});
|
|
298
|
-
onChange('initialised', value => {
|
|
299
|
-
sessionStorage.setItem(SessionKeys.InitialisedKey, String(value));
|
|
300
|
-
});
|
|
301
|
-
onChange('hasIdBack', value => {
|
|
302
|
-
sessionStorage.setItem(SessionKeys.HasIdBackKey, String(value));
|
|
303
|
-
});
|
|
304
|
-
onChange('agreementsValidation', value => {
|
|
305
|
-
sessionStorage.setItem(SessionKeys.AgreementValidationKey, String(value));
|
|
306
|
-
});
|
|
307
|
-
onChange('phoneValidation', value => {
|
|
308
|
-
sessionStorage.setItem(SessionKeys.PhoneValidationKey, String(value));
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
var FlowSteps;
|
|
312
|
-
(function (FlowSteps) {
|
|
313
|
-
FlowSteps[FlowSteps["ComponentLoaded"] = 'component-loaded'] = "ComponentLoaded";
|
|
314
|
-
FlowSteps[FlowSteps["MobileRedirect"] = 'mobile-redirect'] = "MobileRedirect";
|
|
315
|
-
FlowSteps[FlowSteps["Landing"] = 'landing'] = "Landing";
|
|
316
|
-
FlowSteps[FlowSteps["Agreements"] = 'agreements'] = "Agreements";
|
|
317
|
-
FlowSteps[FlowSteps["OtpSend"] = 'otp-send'] = "OtpSend";
|
|
318
|
-
FlowSteps[FlowSteps["OtpCheck"] = 'otp-check'] = "OtpCheck";
|
|
319
|
-
FlowSteps[FlowSteps["CiFront"] = 'ci-front'] = "CiFront";
|
|
320
|
-
FlowSteps[FlowSteps["CiFrontHowTo"] = 'ci-front-how-to'] = "CiFrontHowTo";
|
|
321
|
-
FlowSteps[FlowSteps["CiFrontCapture"] = 'ci-front-capture'] = "CiFrontCapture";
|
|
322
|
-
FlowSteps[FlowSteps["CiBack"] = 'ci-back'] = "CiBack";
|
|
323
|
-
FlowSteps[FlowSteps["CiBackHowTo"] = 'ci-back-how-to'] = "CiBackHowTo";
|
|
324
|
-
FlowSteps[FlowSteps["CiBackCapture"] = 'ci-back-capture'] = "CiBackCapture";
|
|
325
|
-
FlowSteps[FlowSteps["CiTilt"] = 'ci-tilt'] = "CiTilt";
|
|
326
|
-
FlowSteps[FlowSteps["CiError"] = 'ci-error'] = "CiError";
|
|
327
|
-
FlowSteps[FlowSteps["SelfieHowTo"] = 'selfie-how-to'] = "SelfieHowTo";
|
|
328
|
-
FlowSteps[FlowSteps["SelfieTilt"] = 'selfie-tilt'] = "SelfieTilt";
|
|
329
|
-
FlowSteps[FlowSteps["SelfieCapture"] = 'selfie-capture'] = "SelfieCapture";
|
|
330
|
-
FlowSteps[FlowSteps["Selfie"] = 'selfie'] = "Selfie";
|
|
331
|
-
FlowSteps[FlowSteps["SelfieError"] = 'selfie-error'] = "SelfieError";
|
|
332
|
-
FlowSteps[FlowSteps["End"] = 'end'] = "End";
|
|
333
|
-
FlowSteps[FlowSteps["CameraError"] = 'camera-error'] = "CameraError";
|
|
334
|
-
})(FlowSteps || (FlowSteps = {}));
|
|
335
|
-
var FlowMoments;
|
|
336
|
-
(function (FlowMoments) {
|
|
337
|
-
FlowMoments[FlowMoments["Initialized"] = 'initialized'] = "Initialized";
|
|
338
|
-
FlowMoments[FlowMoments["Finalized"] = 'finalized'] = "Finalized";
|
|
339
|
-
FlowMoments[FlowMoments["None"] = 'none'] = "None";
|
|
340
|
-
})(FlowMoments || (FlowMoments = {}));
|
|
341
|
-
|
|
342
|
-
class ApiCall {
|
|
343
|
-
constructor() {
|
|
344
|
-
this.serviceErrors = ['Service Unavailable', 'Unauthorized'];
|
|
345
|
-
this.toBase64 = (file) => new Promise((resolve, reject) => {
|
|
346
|
-
const reader = new FileReader();
|
|
347
|
-
reader.readAsDataURL(file);
|
|
348
|
-
reader.onload = () => resolve(reader.result);
|
|
349
|
-
reader.onerror = error => reject(error);
|
|
350
|
-
});
|
|
351
|
-
this.urls = new ApiUrls();
|
|
352
|
-
}
|
|
353
|
-
// private async http2<T>(method: string, url: string, data: string): Promise<T> {
|
|
354
|
-
// return new Promise((resolve, reject) => {
|
|
355
|
-
// var xhr = new XMLHttpRequest();
|
|
356
|
-
// xhr.open(method, url);
|
|
357
|
-
// xhr.onload = function () {
|
|
358
|
-
// if (xhr.status >= 200 && xhr.status < 300) {
|
|
359
|
-
// resolve(xhr.response);
|
|
360
|
-
// } else {
|
|
361
|
-
// reject({
|
|
362
|
-
// status: xhr.status,
|
|
363
|
-
// statusText: xhr.statusText,
|
|
364
|
-
// });
|
|
365
|
-
// }
|
|
366
|
-
// };
|
|
367
|
-
// xhr.onerror = function () {
|
|
368
|
-
// reject({
|
|
369
|
-
// status: xhr.status,
|
|
370
|
-
// statusText: xhr.statusText,
|
|
371
|
-
// });
|
|
372
|
-
// };
|
|
373
|
-
// xhr.send(data);
|
|
374
|
-
// });
|
|
375
|
-
// }
|
|
376
|
-
async http(request) {
|
|
377
|
-
const response = await fetch(request);
|
|
378
|
-
if (!response.ok) {
|
|
379
|
-
throw new Error(response.statusText);
|
|
380
|
-
}
|
|
381
|
-
try {
|
|
382
|
-
// may error if there is no body
|
|
383
|
-
return await response.json();
|
|
384
|
-
}
|
|
385
|
-
catch (ex) {
|
|
386
|
-
throw new Error('No json found in response ' + ex);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
async post(url, data, withRetry = true) {
|
|
390
|
-
var request = new Request(state.apiBaseUrl + url, {
|
|
391
|
-
method: 'POST',
|
|
392
|
-
body: data,
|
|
393
|
-
headers: {
|
|
394
|
-
'Content-Type': 'application/json',
|
|
395
|
-
'Authorization': 'IDKYC-TOKEN ' + state.token,
|
|
396
|
-
},
|
|
397
|
-
});
|
|
398
|
-
try {
|
|
399
|
-
return await this.http(request);
|
|
400
|
-
}
|
|
401
|
-
catch (ex) {
|
|
402
|
-
if (!withRetry || this.serviceErrors.includes(ex.message)) {
|
|
403
|
-
throw ex;
|
|
404
|
-
}
|
|
405
|
-
this.AddLog('Error in post ', ex);
|
|
406
|
-
try {
|
|
407
|
-
var request2 = new Request(state.apiBaseUrl + url, {
|
|
408
|
-
method: 'POST',
|
|
409
|
-
body: data,
|
|
410
|
-
headers: {
|
|
411
|
-
'Content-Type': 'application/json',
|
|
412
|
-
'Authorization': 'IDKYC-TOKEN ' + state.token,
|
|
413
|
-
},
|
|
414
|
-
});
|
|
415
|
-
return await this.http(request2);
|
|
416
|
-
}
|
|
417
|
-
catch (ex2) {
|
|
418
|
-
this.AddLog('Error in post ', ex2);
|
|
419
|
-
var request3 = new Request(state.apiBaseUrl + url, {
|
|
420
|
-
method: 'POST',
|
|
421
|
-
body: data,
|
|
422
|
-
headers: {
|
|
423
|
-
'Content-Type': 'application/json',
|
|
424
|
-
'Authorization': 'IDKYC-TOKEN ' + state.token,
|
|
425
|
-
},
|
|
426
|
-
});
|
|
427
|
-
return await this.http(request3);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
async get(url, withRetry = true) {
|
|
432
|
-
var request = new Request(state.apiBaseUrl + url, {
|
|
433
|
-
method: 'GET',
|
|
434
|
-
headers: {
|
|
435
|
-
'Content-Type': 'application/json',
|
|
436
|
-
'Authorization': 'IDKYC-TOKEN ' + state.token,
|
|
437
|
-
},
|
|
438
|
-
});
|
|
439
|
-
try {
|
|
440
|
-
return await this.http(request);
|
|
441
|
-
}
|
|
442
|
-
catch (ex) {
|
|
443
|
-
if (!withRetry || this.serviceErrors.includes(ex.message)) {
|
|
444
|
-
throw ex;
|
|
445
|
-
}
|
|
446
|
-
this.AddLog('Error in get ', ex);
|
|
447
|
-
try {
|
|
448
|
-
var request2 = new Request(state.apiBaseUrl + url, {
|
|
449
|
-
method: 'GET',
|
|
450
|
-
headers: {
|
|
451
|
-
'Content-Type': 'application/json',
|
|
452
|
-
'Authorization': 'IDKYC-TOKEN ' + state.token,
|
|
453
|
-
},
|
|
454
|
-
});
|
|
455
|
-
return await this.http(request2);
|
|
456
|
-
}
|
|
457
|
-
catch (ex2) {
|
|
458
|
-
this.AddLog('Error in get ', ex2);
|
|
459
|
-
var request3 = new Request(state.apiBaseUrl + url, {
|
|
460
|
-
method: 'GET',
|
|
461
|
-
headers: {
|
|
462
|
-
'Content-Type': 'application/json',
|
|
463
|
-
'Authorization': 'IDKYC-TOKEN ' + state.token,
|
|
464
|
-
},
|
|
465
|
-
});
|
|
466
|
-
return await this.http(request3);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
async SendOTPCode(requestId, phoneNumber) {
|
|
471
|
-
let data = { requestId: requestId, phone: phoneNumber };
|
|
472
|
-
let jsonResp = await this.post(this.urls.OtpSend, JSON.stringify(data));
|
|
473
|
-
return jsonResp.sent;
|
|
474
|
-
}
|
|
475
|
-
async CheckOTPCode(requestId, otpCode) {
|
|
476
|
-
let data = { requestId: requestId, otp: otpCode };
|
|
477
|
-
let jsonResp = await this.post(this.urls.OtpCheck, JSON.stringify(data));
|
|
478
|
-
return jsonResp.valid;
|
|
479
|
-
}
|
|
480
|
-
async AddIdentificationRequest(deviceInfo, version) {
|
|
481
|
-
if (state.debug)
|
|
482
|
-
console.log('Calling identity request with store:' + JSON.stringify(state));
|
|
483
|
-
let data = {
|
|
484
|
-
requestId: state.requestId,
|
|
485
|
-
clientDeviceInfo: JSON.stringify(deviceInfo),
|
|
486
|
-
redirectId: state.redirectId,
|
|
487
|
-
phoneNumber: state.phoneNumber,
|
|
488
|
-
version: version,
|
|
489
|
-
};
|
|
490
|
-
let jsonResp = await this.post(this.urls.IdentityInsert, JSON.stringify(data));
|
|
491
|
-
if (state.requestId == '') {
|
|
492
|
-
state.requestId = jsonResp.requestId;
|
|
493
|
-
}
|
|
494
|
-
state.hasIdBack = jsonResp.hasIdBack;
|
|
495
|
-
state.hasIdTilt = jsonResp.hasIdTilt;
|
|
496
|
-
state.hasSelfieGesture = jsonResp.hasSelfieGesture;
|
|
497
|
-
state.agreementsValidation = jsonResp.agreementsValidation;
|
|
498
|
-
state.phoneValidation = jsonResp.phoneValidation;
|
|
499
|
-
state.phoneNumber = jsonResp.phoneNumber;
|
|
500
|
-
return true;
|
|
501
|
-
}
|
|
502
|
-
async UploadFileForRequestB64(requestId, type, file) {
|
|
503
|
-
let data = {
|
|
504
|
-
requestId: requestId,
|
|
505
|
-
type: type,
|
|
506
|
-
data: await this.toBase64(file),
|
|
507
|
-
};
|
|
508
|
-
let respJson = await this.post(this.urls.UploadCapture, JSON.stringify(data));
|
|
509
|
-
if (!state.hasIdBack && type == 'IdFront') {
|
|
510
|
-
return respJson.isValid;
|
|
511
|
-
}
|
|
512
|
-
if (state.hasIdBack && type == 'IdBack') {
|
|
513
|
-
return respJson.isValid;
|
|
514
|
-
}
|
|
515
|
-
if (type == 'Selfie') {
|
|
516
|
-
return respJson.isValid;
|
|
517
|
-
}
|
|
518
|
-
return true;
|
|
519
|
-
}
|
|
520
|
-
async GetAgreement(agreementType) {
|
|
521
|
-
let resp = await this.get(this.urls.GetAgreement + '?type=' + agreementType + '&requestId=' + state.requestId);
|
|
522
|
-
return resp.htmlText;
|
|
523
|
-
}
|
|
524
|
-
async GenerateAgreement(agreementType) {
|
|
525
|
-
let data = { requestId: state.requestId, documentType: agreementType };
|
|
526
|
-
let resp = await this.post(this.urls.GenerateAgreement, JSON.stringify(data));
|
|
527
|
-
return resp.generation;
|
|
528
|
-
}
|
|
529
|
-
async GetStatus(requestId) {
|
|
530
|
-
let resp = await this.get(this.urls.GetStatus + '?orderId=' + requestId);
|
|
531
|
-
return OrderStatuses[resp.status];
|
|
532
|
-
}
|
|
533
|
-
async SendLink(link, phoneNumber) {
|
|
534
|
-
let data = { requestId: state.requestId, link: link, phoneNumber: phoneNumber };
|
|
535
|
-
let resp = await this.post(this.urls.SendLink, JSON.stringify(data));
|
|
536
|
-
return resp.sent;
|
|
537
|
-
}
|
|
538
|
-
async AddLog(error, context) {
|
|
539
|
-
try {
|
|
540
|
-
let data = {
|
|
541
|
-
requestId: state.requestId,
|
|
542
|
-
action: FlowStatus[state.flowStatus],
|
|
543
|
-
message: JSON.stringify({ error, context }),
|
|
544
|
-
};
|
|
545
|
-
let result = await this.post(this.urls.AddLog, JSON.stringify(data), false);
|
|
546
|
-
return result.saved;
|
|
547
|
-
}
|
|
548
|
-
catch (_a) { }
|
|
549
|
-
}
|
|
550
|
-
async AddStep(step, moment) {
|
|
551
|
-
let data = { requestId: state.requestId, redirectId: state.redirectId, step: FlowSteps[step], moment: FlowMoments[moment], timestamp: new Date().toISOString() };
|
|
552
|
-
let result = await this.post(this.urls.AddStep, JSON.stringify(data));
|
|
553
|
-
return result.saved;
|
|
554
|
-
}
|
|
555
|
-
async AbortRequest() {
|
|
556
|
-
let result = await this.post(this.urls.AbortRequest, JSON.stringify({ requestId: state.requestId }));
|
|
557
|
-
return result.saved;
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
var MobileOS;
|
|
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
|
-
}));
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
class TranslationsController {
|
|
730
|
-
async getValues() {
|
|
731
|
-
if (this.values) {
|
|
732
|
-
return this.values;
|
|
733
|
-
}
|
|
734
|
-
else {
|
|
735
|
-
this.values = await this.fetchTranslations();
|
|
736
|
-
return this.values;
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
getLocale(element = document.body) {
|
|
740
|
-
const closestElement = element.closest('[lang]');
|
|
741
|
-
return closestElement ? closestElement.lang : state.langIso;
|
|
742
|
-
}
|
|
743
|
-
async fetchTranslations() {
|
|
744
|
-
const locale = this.getLocale();
|
|
745
|
-
const existingTranslations = JSON.parse(sessionStorage.getItem(`i18n.${locale}`));
|
|
746
|
-
if (existingTranslations && Object.keys(existingTranslations).length > 0) {
|
|
747
|
-
return existingTranslations;
|
|
748
|
-
}
|
|
749
|
-
else {
|
|
750
|
-
try {
|
|
751
|
-
const result = await fetch(`/i18n/${locale}.json`);
|
|
752
|
-
if (result.ok) {
|
|
753
|
-
const data = await result.json();
|
|
754
|
-
sessionStorage.setItem(`i18n.${locale}`, JSON.stringify(data));
|
|
755
|
-
return data;
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
catch (exception) {
|
|
759
|
-
console.error(`Error loading locale: ${locale}`, exception);
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
const Translations = new TranslationsController();
|
|
765
|
-
|
|
766
|
-
class BaseComponent {
|
|
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 };
|