@ekyc_qoobiss/qbs-ect-cmp 1.2.6 → 1.2.8
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/_commonjsHelpers-c0bd7d34.js +528 -0
- package/dist/cjs/{agreement-check_17.cjs.entry.js → agreement-check_16.cjs.entry.js} +192 -3650
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mobile-redirect.cjs.entry.js +2969 -0
- package/dist/cjs/qbs-ect-cmp.cjs.js +1 -1
- package/dist/collection/components/flow/landing-validation/landing-validation.js +5 -1
- package/dist/collection/components/flow/sms-code-validation/sms-code-validation.js +1 -0
- package/dist/collection/components/identification-component/identification-component.css +4 -69
- package/dist/collection/components/identification-component/identification-component.js +8 -8
- package/dist/collection/helpers/Events.js +13 -5
- package/dist/collection/helpers/textValues.js +1 -0
- package/dist/esm/_commonjsHelpers-d06997a2.js +511 -0
- package/dist/esm/{agreement-check_17.entry.js → agreement-check_16.entry.js} +28 -3485
- package/dist/esm/{index-9d69e511.js → index-5d6f9123.js} +1 -1
- package/dist/esm/loader-dots.entry.js +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mobile-redirect.entry.js +2965 -0
- package/dist/esm/qbs-ect-cmp.js +3 -3
- package/dist/qbs-ect-cmp/{p-b406e636.entry.js → p-139820b9.entry.js} +24 -24
- package/dist/qbs-ect-cmp/p-72635f9d.entry.js +1 -0
- package/dist/qbs-ect-cmp/{p-4c8e922b.entry.js → p-7c33dd41.entry.js} +1 -1
- package/dist/qbs-ect-cmp/p-80888f13.js +1 -0
- package/dist/qbs-ect-cmp/{p-06e42b28.js → p-aacd7024.js} +1 -1
- package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
- package/dist/types/components/flow/landing-validation/landing-validation.d.ts +1 -0
- package/dist/types/components/identification-component/identification-component.d.ts +1 -1
- package/dist/types/components.d.ts +2 -2
- package/dist/types/helpers/Events.d.ts +2 -1
- package/dist/types/helpers/textValues.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-79f82518.js');
|
|
4
|
+
|
|
5
|
+
exports.OrderStatuses = void 0;
|
|
6
|
+
(function (OrderStatuses) {
|
|
7
|
+
OrderStatuses[OrderStatuses["Capturing"] = 0] = "Capturing";
|
|
8
|
+
OrderStatuses[OrderStatuses["FinishedCapturing"] = 1] = "FinishedCapturing";
|
|
9
|
+
OrderStatuses[OrderStatuses["Waiting"] = 2] = "Waiting";
|
|
10
|
+
OrderStatuses[OrderStatuses["NotFound"] = 3] = "NotFound";
|
|
11
|
+
})(exports.OrderStatuses || (exports.OrderStatuses = {}));
|
|
12
|
+
|
|
13
|
+
const appendToMap = (map, propName, value) => {
|
|
14
|
+
const items = map.get(propName);
|
|
15
|
+
if (!items) {
|
|
16
|
+
map.set(propName, [value]);
|
|
17
|
+
}
|
|
18
|
+
else if (!items.includes(value)) {
|
|
19
|
+
items.push(value);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const debounce = (fn, ms) => {
|
|
23
|
+
let timeoutId;
|
|
24
|
+
return (...args) => {
|
|
25
|
+
if (timeoutId) {
|
|
26
|
+
clearTimeout(timeoutId);
|
|
27
|
+
}
|
|
28
|
+
timeoutId = setTimeout(() => {
|
|
29
|
+
timeoutId = 0;
|
|
30
|
+
fn(...args);
|
|
31
|
+
}, ms);
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Check if a possible element isConnected.
|
|
37
|
+
* The property might not be there, so we check for it.
|
|
38
|
+
*
|
|
39
|
+
* We want it to return true if isConnected is not a property,
|
|
40
|
+
* otherwise we would remove these elements and would not update.
|
|
41
|
+
*
|
|
42
|
+
* Better leak in Edge than to be useless.
|
|
43
|
+
*/
|
|
44
|
+
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
45
|
+
const cleanupElements = debounce((map) => {
|
|
46
|
+
for (let key of map.keys()) {
|
|
47
|
+
map.set(key, map.get(key).filter(isConnected));
|
|
48
|
+
}
|
|
49
|
+
}, 2000);
|
|
50
|
+
const stencilSubscription = () => {
|
|
51
|
+
if (typeof index.getRenderingRef !== 'function') {
|
|
52
|
+
// If we are not in a stencil project, we do nothing.
|
|
53
|
+
// This function is not really exported by @stencil/core.
|
|
54
|
+
return {};
|
|
55
|
+
}
|
|
56
|
+
const elmsToUpdate = new Map();
|
|
57
|
+
return {
|
|
58
|
+
dispose: () => elmsToUpdate.clear(),
|
|
59
|
+
get: (propName) => {
|
|
60
|
+
const elm = index.getRenderingRef();
|
|
61
|
+
if (elm) {
|
|
62
|
+
appendToMap(elmsToUpdate, propName, elm);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
set: (propName) => {
|
|
66
|
+
const elements = elmsToUpdate.get(propName);
|
|
67
|
+
if (elements) {
|
|
68
|
+
elmsToUpdate.set(propName, elements.filter(index.forceUpdate));
|
|
69
|
+
}
|
|
70
|
+
cleanupElements(elmsToUpdate);
|
|
71
|
+
},
|
|
72
|
+
reset: () => {
|
|
73
|
+
elmsToUpdate.forEach((elms) => elms.forEach(index.forceUpdate));
|
|
74
|
+
cleanupElements(elmsToUpdate);
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const unwrap = (val) => (typeof val === 'function' ? val() : val);
|
|
80
|
+
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
81
|
+
const unwrappedState = unwrap(defaultState);
|
|
82
|
+
let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
|
|
83
|
+
const handlers = {
|
|
84
|
+
dispose: [],
|
|
85
|
+
get: [],
|
|
86
|
+
set: [],
|
|
87
|
+
reset: [],
|
|
88
|
+
};
|
|
89
|
+
const reset = () => {
|
|
90
|
+
var _a;
|
|
91
|
+
// When resetting the state, the default state may be a function - unwrap it to invoke it.
|
|
92
|
+
// otherwise, the state won't be properly reset
|
|
93
|
+
states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));
|
|
94
|
+
handlers.reset.forEach((cb) => cb());
|
|
95
|
+
};
|
|
96
|
+
const dispose = () => {
|
|
97
|
+
// Call first dispose as resetting the state would
|
|
98
|
+
// cause less updates ;)
|
|
99
|
+
handlers.dispose.forEach((cb) => cb());
|
|
100
|
+
reset();
|
|
101
|
+
};
|
|
102
|
+
const get = (propName) => {
|
|
103
|
+
handlers.get.forEach((cb) => cb(propName));
|
|
104
|
+
return states.get(propName);
|
|
105
|
+
};
|
|
106
|
+
const set = (propName, value) => {
|
|
107
|
+
const oldValue = states.get(propName);
|
|
108
|
+
if (shouldUpdate(value, oldValue, propName)) {
|
|
109
|
+
states.set(propName, value);
|
|
110
|
+
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const state = (typeof Proxy === 'undefined'
|
|
114
|
+
? {}
|
|
115
|
+
: new Proxy(unwrappedState, {
|
|
116
|
+
get(_, propName) {
|
|
117
|
+
return get(propName);
|
|
118
|
+
},
|
|
119
|
+
ownKeys(_) {
|
|
120
|
+
return Array.from(states.keys());
|
|
121
|
+
},
|
|
122
|
+
getOwnPropertyDescriptor() {
|
|
123
|
+
return {
|
|
124
|
+
enumerable: true,
|
|
125
|
+
configurable: true,
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
has(_, propName) {
|
|
129
|
+
return states.has(propName);
|
|
130
|
+
},
|
|
131
|
+
set(_, propName, value) {
|
|
132
|
+
set(propName, value);
|
|
133
|
+
return true;
|
|
134
|
+
},
|
|
135
|
+
}));
|
|
136
|
+
const on = (eventName, callback) => {
|
|
137
|
+
handlers[eventName].push(callback);
|
|
138
|
+
return () => {
|
|
139
|
+
removeFromArray(handlers[eventName], callback);
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
const onChange = (propName, cb) => {
|
|
143
|
+
const unSet = on('set', (key, newValue) => {
|
|
144
|
+
if (key === propName) {
|
|
145
|
+
cb(newValue);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
// We need to unwrap the defaultState because it might be a function.
|
|
149
|
+
// Otherwise we might not be sending the right reset value.
|
|
150
|
+
const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
|
|
151
|
+
return () => {
|
|
152
|
+
unSet();
|
|
153
|
+
unReset();
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
const use = (...subscriptions) => {
|
|
157
|
+
const unsubs = subscriptions.reduce((unsubs, subscription) => {
|
|
158
|
+
if (subscription.set) {
|
|
159
|
+
unsubs.push(on('set', subscription.set));
|
|
160
|
+
}
|
|
161
|
+
if (subscription.get) {
|
|
162
|
+
unsubs.push(on('get', subscription.get));
|
|
163
|
+
}
|
|
164
|
+
if (subscription.reset) {
|
|
165
|
+
unsubs.push(on('reset', subscription.reset));
|
|
166
|
+
}
|
|
167
|
+
if (subscription.dispose) {
|
|
168
|
+
unsubs.push(on('dispose', subscription.dispose));
|
|
169
|
+
}
|
|
170
|
+
return unsubs;
|
|
171
|
+
}, []);
|
|
172
|
+
return () => unsubs.forEach((unsub) => unsub());
|
|
173
|
+
};
|
|
174
|
+
const forceUpdate = (key) => {
|
|
175
|
+
const oldValue = states.get(key);
|
|
176
|
+
handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
|
|
177
|
+
};
|
|
178
|
+
return {
|
|
179
|
+
state,
|
|
180
|
+
get,
|
|
181
|
+
set,
|
|
182
|
+
on,
|
|
183
|
+
onChange,
|
|
184
|
+
use,
|
|
185
|
+
dispose,
|
|
186
|
+
reset,
|
|
187
|
+
forceUpdate,
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
const removeFromArray = (array, item) => {
|
|
191
|
+
const index = array.indexOf(item);
|
|
192
|
+
if (index >= 0) {
|
|
193
|
+
array[index] = array[array.length - 1];
|
|
194
|
+
array.length--;
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const createStore = (defaultState, shouldUpdate) => {
|
|
199
|
+
const map = createObservableMap(defaultState, shouldUpdate);
|
|
200
|
+
map.use(stencilSubscription());
|
|
201
|
+
return map;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
exports.FlowStatus = void 0;
|
|
205
|
+
(function (FlowStatus) {
|
|
206
|
+
FlowStatus[FlowStatus["LANDING"] = 0] = "LANDING";
|
|
207
|
+
FlowStatus[FlowStatus["AGREEMENT"] = 1] = "AGREEMENT";
|
|
208
|
+
FlowStatus[FlowStatus["PHONE"] = 2] = "PHONE";
|
|
209
|
+
FlowStatus[FlowStatus["CODE"] = 3] = "CODE";
|
|
210
|
+
FlowStatus[FlowStatus["CODEERROR"] = 4] = "CODEERROR";
|
|
211
|
+
FlowStatus[FlowStatus["ID"] = 5] = "ID";
|
|
212
|
+
FlowStatus[FlowStatus["LIVENESS"] = 6] = "LIVENESS";
|
|
213
|
+
FlowStatus[FlowStatus["COMPLETE"] = 7] = "COMPLETE";
|
|
214
|
+
FlowStatus[FlowStatus["ERROREND"] = 8] = "ERROREND";
|
|
215
|
+
})(exports.FlowStatus || (exports.FlowStatus = {}));
|
|
216
|
+
|
|
217
|
+
class GlobalValues {
|
|
218
|
+
}
|
|
219
|
+
GlobalValues.FooterText = 'Qoobiss eKYC';
|
|
220
|
+
GlobalValues.VideoLenght = 3100;
|
|
221
|
+
class HowToValues extends GlobalValues {
|
|
222
|
+
}
|
|
223
|
+
HowToValues.IdTitile = 'Prezintă actul tău de identitate';
|
|
224
|
+
HowToValues.IdSubTitileFace = 'Este necesară captarea actului de identitate. Urmează intrucțiunile ce vor fi afișate pe ecran.';
|
|
225
|
+
HowToValues.IdSubTitileBack = 'Este necesară captarea actului de identitate. Urmează intrucțiunile ce vor fi afișate pe ecran.';
|
|
226
|
+
HowToValues.IdButton = 'Sunt gata!';
|
|
227
|
+
HowToValues.SelfieTitile = 'Validare video';
|
|
228
|
+
HowToValues.SelfieSubTitile = 'Este necesară realizarea unei înregistrări video. Respectă intrucțiunile ce vor fi afișate pe ecran.';
|
|
229
|
+
HowToValues.SelfieButton = 'Sunt gata!';
|
|
230
|
+
class LandingValues extends GlobalValues {
|
|
231
|
+
}
|
|
232
|
+
LandingValues.Title = 'Validarea identității la distanță este o procedură simplă și rapidă';
|
|
233
|
+
LandingValues.Description = 'Asigură-te că ai:';
|
|
234
|
+
LandingValues.IdInfo = 'Actul de identitate, în original';
|
|
235
|
+
LandingValues.DeviceInfo = 'Un telefon mobil sau un calculator cu camera web';
|
|
236
|
+
LandingValues.SmsInfo = 'Acces la un telefon mobil ce permite primirea de mesaje SMS';
|
|
237
|
+
LandingValues.Warning = 'ATENȚIE! În cadrul acestui proces se poate utiliza doar cartea de identitate Românească.';
|
|
238
|
+
LandingValues.WarningMd = 'ATENȚIE! In cadrul acestui proces se pot utiliza doar buletinele de identitate din Republica Moldova.';
|
|
239
|
+
LandingValues.Terms = 'Prin continuarea procesului, confirmi că ai citit termenii de utilizare și ești de acord cu aceștia.';
|
|
240
|
+
LandingValues.Button = 'Am înțeles';
|
|
241
|
+
LandingValues.ButtonLeave = 'Nu sunt pregătit';
|
|
242
|
+
class PhoneValidationValues extends GlobalValues {
|
|
243
|
+
}
|
|
244
|
+
PhoneValidationValues.Title = 'Este necesar să validăm numărul tău de telefon';
|
|
245
|
+
PhoneValidationValues.Description = 'Introdu mai jos numarul tau de telefon:';
|
|
246
|
+
PhoneValidationValues.Button = 'Trimite SMS de verificare';
|
|
247
|
+
PhoneValidationValues.Label = 'Numarul tau de telefon';
|
|
248
|
+
class CodeValidationValues extends GlobalValues {
|
|
249
|
+
}
|
|
250
|
+
CodeValidationValues.Title = 'Introdu codul de validare primit prin sms:';
|
|
251
|
+
CodeValidationValues.Description = ' ';
|
|
252
|
+
CodeValidationValues.Button = 'Validează';
|
|
253
|
+
CodeValidationValues.Error = 'Codul introdus nu este valid. Asigură-te că îl introduci corect';
|
|
254
|
+
class CompleteValues extends GlobalValues {
|
|
255
|
+
}
|
|
256
|
+
CompleteValues.Title = 'Procesul a fost finalizat.';
|
|
257
|
+
CompleteValues.Description = 'Vei fi redirecționat în câteva momente.';
|
|
258
|
+
CompleteValues.Message = 'Îți mulțumim!';
|
|
259
|
+
class SessionKeys {
|
|
260
|
+
}
|
|
261
|
+
SessionKeys.FlowStatusKey = 'qbs-ect-flowstatus';
|
|
262
|
+
SessionKeys.RequestIdKey = 'qbs-ect-requestid';
|
|
263
|
+
SessionKeys.TokenKey = 'qbs-ect-token';
|
|
264
|
+
SessionKeys.InitialisedKey = 'qbs-ect-initialised';
|
|
265
|
+
SessionKeys.HasIdBackKey = 'qbs-ect-has-id-back';
|
|
266
|
+
SessionKeys.AgreementValidationKey = 'qbs-ect-agreement-validation';
|
|
267
|
+
SessionKeys.PhoneValidationKey = 'qbs-ect-phone-validation';
|
|
268
|
+
class IdCaptureValues extends GlobalValues {
|
|
269
|
+
}
|
|
270
|
+
IdCaptureValues.Button = 'Încerc din nou';
|
|
271
|
+
IdCaptureValues.Title = 'Încadrează actul de identitate în chenarul de pe ecran.';
|
|
272
|
+
IdCaptureValues.TitleBack = 'Încadrează spatele actului de identitate în chenarul de pe ecran.';
|
|
273
|
+
IdCaptureValues.TtileRotate = 'Întoarce actul de identitate.';
|
|
274
|
+
IdCaptureValues.Error = 'Procesul a eșuat. Te rugăm să respecți întocmai instrucțiunile de pe ecran. Ai grijă să încadrezi integral actul în chenraul de pe ecran și să nu apară reflexii de lumină pe suprafața acestuia.';
|
|
275
|
+
IdCaptureValues.IDPoseMapping = {
|
|
276
|
+
0: '',
|
|
277
|
+
1: 'Înclină actul de identitate spre spate.',
|
|
278
|
+
2: '',
|
|
279
|
+
3: '',
|
|
280
|
+
4: '',
|
|
281
|
+
};
|
|
282
|
+
IdCaptureValues.IDPoseDemoMapping = {
|
|
283
|
+
0: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_front.mp4',
|
|
284
|
+
1: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_front_tilt.mp4',
|
|
285
|
+
2: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_rotate.mp4',
|
|
286
|
+
3: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_back.mp4',
|
|
287
|
+
4: 'https://ekyc.blob.core.windows.net/$web/animations/id/id_back_tilt.mp4',
|
|
288
|
+
};
|
|
289
|
+
IdCaptureValues.Loading = 'Transferăm datele. Asteptați...';
|
|
290
|
+
class SelfieCaptureValues extends GlobalValues {
|
|
291
|
+
}
|
|
292
|
+
SelfieCaptureValues.Title = 'Încadrează fața în chenarul de pe ecran.';
|
|
293
|
+
SelfieCaptureValues.FinalTitle = 'Îndreaptă capul și încadrează fața în chenarul de pe ecran.';
|
|
294
|
+
SelfieCaptureValues.Error = 'Procesul a eșuat. Te rugăm să respecți întocmai instrucțiunile de pe ecran.';
|
|
295
|
+
SelfieCaptureValues.Loading = 'Transferăm datele. Asteptați...';
|
|
296
|
+
SelfieCaptureValues.FacePoseMapping = {
|
|
297
|
+
0: 'Întoarce capul spre stânga.',
|
|
298
|
+
1: 'Întoarce capul spre dreapta.',
|
|
299
|
+
2: 'Înclină capul spre spate.',
|
|
300
|
+
3: 'Înclină capul în față.',
|
|
301
|
+
// 4: 'Înclină capul spre stânga.',
|
|
302
|
+
// 5: 'Înclină capul spre dreapta.',
|
|
303
|
+
4: '',
|
|
304
|
+
};
|
|
305
|
+
SelfieCaptureValues.FacePoseDemoMapping = {
|
|
306
|
+
0: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_rotate_left.mp4',
|
|
307
|
+
1: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_rotate_right.mp4',
|
|
308
|
+
2: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_back.mp4',
|
|
309
|
+
3: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_front.mp4',
|
|
310
|
+
// 4: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_left.mp4',
|
|
311
|
+
// 5: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_right.mp4',
|
|
312
|
+
4: 'https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_main.mp4',
|
|
313
|
+
};
|
|
314
|
+
class AgreementInfoValues extends GlobalValues {
|
|
315
|
+
}
|
|
316
|
+
AgreementInfoValues.Title = 'Pentru începerea identificării avem nevoie de acordurile tale:';
|
|
317
|
+
AgreementInfoValues.Button = 'Încep identificarea';
|
|
318
|
+
AgreementInfoValues.Terms = 'Am luat la cunoștință și sunt de acord cu Termenii și condițiile generale de utilizare';
|
|
319
|
+
AgreementInfoValues.Agreement = 'Îmi exprim acordul pentru prelucrarea datelor cu caracter personal';
|
|
320
|
+
class AgreementCheckValues extends GlobalValues {
|
|
321
|
+
}
|
|
322
|
+
AgreementCheckValues.ButtonYes = 'Sunt de acord';
|
|
323
|
+
AgreementCheckValues.ButtonNo = 'Nu sunt de acord';
|
|
324
|
+
class ApiUrls {
|
|
325
|
+
constructor() {
|
|
326
|
+
this.uriEnv = '/';
|
|
327
|
+
this.uriEnv = state.environment == 'QA' ? '/dev_' : '/';
|
|
328
|
+
this.OtpSend = this.uriEnv + 'validation/otp/send';
|
|
329
|
+
this.OtpCheck = this.uriEnv + 'validation/otp/check';
|
|
330
|
+
this.IdentityInsert = this.uriEnv + 'validation/identity/insert';
|
|
331
|
+
this.UploadCapture = this.uriEnv + 'validation/upload/capture';
|
|
332
|
+
this.GetAgreement = this.uriEnv + 'validation/agreement/content';
|
|
333
|
+
this.GenerateAgreement = this.uriEnv + 'validation/agreement/generate';
|
|
334
|
+
this.SendLink = this.uriEnv + 'validation/otp/sendlink';
|
|
335
|
+
this.GetStatus = this.uriEnv + 'validation/identity/status';
|
|
336
|
+
this.AddLog = this.uriEnv + 'validation/logs/add';
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
class MobileRedirectValues extends GlobalValues {
|
|
340
|
+
}
|
|
341
|
+
MobileRedirectValues.InfoTop = 'Pentru a continua scanați codul de mai jos cu un smartphone.';
|
|
342
|
+
MobileRedirectValues.InfoBottom = 'Sau introduceți un număr de telefon pentru a primi link-ul pe smartphone.';
|
|
343
|
+
MobileRedirectValues.Validation = 'Număr de telefon invalid!';
|
|
344
|
+
MobileRedirectValues.InfoWaiting = 'Așteptăm finalizarea procesului pe smartphone.';
|
|
345
|
+
|
|
346
|
+
const { state, onChange } = createStore({
|
|
347
|
+
flowStatus: exports.FlowStatus.LANDING,
|
|
348
|
+
environment: 'PROD',
|
|
349
|
+
requestId: '',
|
|
350
|
+
redirectId: '',
|
|
351
|
+
initialised: false,
|
|
352
|
+
token: '',
|
|
353
|
+
cameraIds: [],
|
|
354
|
+
cameraId: '',
|
|
355
|
+
hasIdBack: false,
|
|
356
|
+
agreementsValidation: true,
|
|
357
|
+
phoneValidation: true,
|
|
358
|
+
phoneNumber: '',
|
|
359
|
+
apiBaseUrl: 'https://apiro.id-kyc.com',
|
|
360
|
+
});
|
|
361
|
+
onChange('flowStatus', value => {
|
|
362
|
+
sessionStorage.setItem(SessionKeys.FlowStatusKey, exports.FlowStatus[value]);
|
|
363
|
+
});
|
|
364
|
+
onChange('token', value => {
|
|
365
|
+
sessionStorage.setItem(SessionKeys.TokenKey, value);
|
|
366
|
+
});
|
|
367
|
+
onChange('requestId', value => {
|
|
368
|
+
sessionStorage.setItem(SessionKeys.RequestIdKey, value);
|
|
369
|
+
});
|
|
370
|
+
onChange('initialised', value => {
|
|
371
|
+
sessionStorage.setItem(SessionKeys.InitialisedKey, String(value));
|
|
372
|
+
});
|
|
373
|
+
onChange('hasIdBack', value => {
|
|
374
|
+
sessionStorage.setItem(SessionKeys.HasIdBackKey, String(value));
|
|
375
|
+
});
|
|
376
|
+
onChange('agreementsValidation', value => {
|
|
377
|
+
sessionStorage.setItem(SessionKeys.AgreementValidationKey, String(value));
|
|
378
|
+
});
|
|
379
|
+
onChange('phoneValidation', value => {
|
|
380
|
+
sessionStorage.setItem(SessionKeys.PhoneValidationKey, String(value));
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
class ApiCall {
|
|
384
|
+
constructor() {
|
|
385
|
+
this.toBase64 = (file) => new Promise((resolve, reject) => {
|
|
386
|
+
const reader = new FileReader();
|
|
387
|
+
reader.readAsDataURL(file);
|
|
388
|
+
reader.onload = () => resolve(reader.result);
|
|
389
|
+
reader.onerror = error => reject(error);
|
|
390
|
+
});
|
|
391
|
+
this.urls = new ApiUrls();
|
|
392
|
+
}
|
|
393
|
+
async http(request) {
|
|
394
|
+
const response = await fetch(request);
|
|
395
|
+
if (!response.ok) {
|
|
396
|
+
throw new Error(response.statusText);
|
|
397
|
+
}
|
|
398
|
+
try {
|
|
399
|
+
// may error if there is no body
|
|
400
|
+
return await response.json();
|
|
401
|
+
}
|
|
402
|
+
catch (ex) {
|
|
403
|
+
throw new Error('No json found in response ' + ex);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
async post(url, data) {
|
|
407
|
+
return await this.http(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
|
+
}
|
|
416
|
+
async get(url) {
|
|
417
|
+
return await this.http(new Request(state.apiBaseUrl + url, {
|
|
418
|
+
method: 'GET',
|
|
419
|
+
headers: {
|
|
420
|
+
'Content-Type': 'application/json',
|
|
421
|
+
'Authorization': 'IDKYC-TOKEN ' + state.token,
|
|
422
|
+
},
|
|
423
|
+
}));
|
|
424
|
+
}
|
|
425
|
+
async SendOTPCode(requestId, phoneNumber) {
|
|
426
|
+
let data = { requestId: requestId, phone: phoneNumber };
|
|
427
|
+
let jsonResp = await this.post(this.urls.OtpSend, JSON.stringify(data));
|
|
428
|
+
return jsonResp.sent;
|
|
429
|
+
}
|
|
430
|
+
async CheckOTPCode(requestId, otpCode) {
|
|
431
|
+
let data = { requestId: requestId, otp: otpCode };
|
|
432
|
+
let jsonResp = await this.post(this.urls.OtpCheck, JSON.stringify(data));
|
|
433
|
+
return jsonResp.valid;
|
|
434
|
+
}
|
|
435
|
+
async AddIdentificationRequest(deviceInfo) {
|
|
436
|
+
let data = {
|
|
437
|
+
requestId: state.requestId,
|
|
438
|
+
clientDeviceInfo: JSON.stringify(deviceInfo),
|
|
439
|
+
redirectId: state.redirectId,
|
|
440
|
+
phoneNumber: state.phoneNumber,
|
|
441
|
+
};
|
|
442
|
+
let jsonResp = await this.post(this.urls.IdentityInsert, JSON.stringify(data));
|
|
443
|
+
if (state.requestId == '') {
|
|
444
|
+
state.requestId = jsonResp.requestId;
|
|
445
|
+
}
|
|
446
|
+
state.hasIdBack = jsonResp.hasIdBack;
|
|
447
|
+
state.agreementsValidation = jsonResp.agreementsValidation;
|
|
448
|
+
state.phoneValidation = jsonResp.phoneValidation;
|
|
449
|
+
state.phoneNumber = jsonResp.phoneNumber;
|
|
450
|
+
return true;
|
|
451
|
+
}
|
|
452
|
+
async UploadFileForRequestB64(requestId, type, file) {
|
|
453
|
+
let data = {
|
|
454
|
+
requestId: requestId,
|
|
455
|
+
type: type,
|
|
456
|
+
data: await this.toBase64(file),
|
|
457
|
+
};
|
|
458
|
+
let respJson = await this.post(this.urls.UploadCapture, JSON.stringify(data));
|
|
459
|
+
if (!state.hasIdBack && type == 'IdFront') {
|
|
460
|
+
return respJson.isValid;
|
|
461
|
+
}
|
|
462
|
+
if (state.hasIdBack && type == 'IdBack') {
|
|
463
|
+
return respJson.isValid;
|
|
464
|
+
}
|
|
465
|
+
return true;
|
|
466
|
+
}
|
|
467
|
+
async GetAgreement(agreementType) {
|
|
468
|
+
let resp = await this.get(this.urls.GetAgreement + '?type=' + agreementType + '&requestId=' + state.requestId);
|
|
469
|
+
return resp.htmlText;
|
|
470
|
+
}
|
|
471
|
+
async GenerateAgreement(agreementType) {
|
|
472
|
+
let data = { requestId: state.requestId, documentType: agreementType };
|
|
473
|
+
let resp = await this.post(this.urls.GenerateAgreement, JSON.stringify(data));
|
|
474
|
+
return resp.generation;
|
|
475
|
+
}
|
|
476
|
+
async GetStatus(requestId) {
|
|
477
|
+
let resp = await this.get(this.urls.GetStatus + '?orderId=' + requestId);
|
|
478
|
+
return exports.OrderStatuses[resp.status];
|
|
479
|
+
}
|
|
480
|
+
async SendLink(link, phoneNumber) {
|
|
481
|
+
let data = { requestId: state.requestId, link: link, phoneNumber: phoneNumber };
|
|
482
|
+
let resp = await this.post(this.urls.SendLink, JSON.stringify(data));
|
|
483
|
+
return resp.sent;
|
|
484
|
+
}
|
|
485
|
+
async AddLog(error) {
|
|
486
|
+
try {
|
|
487
|
+
let data = { requestId: state.requestId, action: exports.FlowStatus[state.flowStatus], message: JSON.stringify(error !== null && error !== void 0 ? error : 'no error data') };
|
|
488
|
+
let result = await this.post(this.urls.AddLog, JSON.stringify(data));
|
|
489
|
+
return result.saved;
|
|
490
|
+
}
|
|
491
|
+
catch (_a) { }
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
function getDefaultExportFromCjs (x) {
|
|
496
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
function createCommonjsModule(fn, basedir, module) {
|
|
500
|
+
return module = {
|
|
501
|
+
path: basedir,
|
|
502
|
+
exports: {},
|
|
503
|
+
require: function (path, base) {
|
|
504
|
+
return commonjsRequire();
|
|
505
|
+
}
|
|
506
|
+
}, fn(module, module.exports), module.exports;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
function commonjsRequire () {
|
|
510
|
+
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
exports.AgreementCheckValues = AgreementCheckValues;
|
|
514
|
+
exports.AgreementInfoValues = AgreementInfoValues;
|
|
515
|
+
exports.ApiCall = ApiCall;
|
|
516
|
+
exports.CodeValidationValues = CodeValidationValues;
|
|
517
|
+
exports.CompleteValues = CompleteValues;
|
|
518
|
+
exports.GlobalValues = GlobalValues;
|
|
519
|
+
exports.HowToValues = HowToValues;
|
|
520
|
+
exports.IdCaptureValues = IdCaptureValues;
|
|
521
|
+
exports.LandingValues = LandingValues;
|
|
522
|
+
exports.MobileRedirectValues = MobileRedirectValues;
|
|
523
|
+
exports.PhoneValidationValues = PhoneValidationValues;
|
|
524
|
+
exports.SelfieCaptureValues = SelfieCaptureValues;
|
|
525
|
+
exports.SessionKeys = SessionKeys;
|
|
526
|
+
exports.createCommonjsModule = createCommonjsModule;
|
|
527
|
+
exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
|
|
528
|
+
exports.state = state;
|