@ekyc_qoobiss/qbs-ect-cmp 3.6.29 → 3.6.31

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.
@@ -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,28 +14,26 @@ class TranslationsController {
10
14
  }
11
15
  }
12
16
  getLocale(element = document.body) {
13
- const closestElement = element.closest('[lang]');
14
- return closestElement ? closestElement.lang : store.langIso;
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();
18
- const existingTranslations = JSON.parse(sessionStorage.getItem(`i18n.${locale}`));
19
- if (existingTranslations && Object.keys(existingTranslations).length > 0) {
20
- return existingTranslations;
21
- }
22
- else {
23
- try {
24
- const result = await fetch(`/i18n/${locale}.json`);
25
- if (result.ok) {
26
- const data = await result.json();
27
- sessionStorage.setItem(`i18n.${locale}`, JSON.stringify(data));
28
- return data;
29
- }
30
- }
31
- catch (exception) {
32
- console.error(`Error loading locale: ${locale}`, exception);
27
+ try {
28
+ const result = this.apiCall.GetTranslations(locale);
29
+ if (result) {
30
+ return result;
33
31
  }
34
32
  }
33
+ catch (exception) {
34
+ console.error(`Error loading locale: ${locale}`, exception);
35
+ return null;
36
+ }
35
37
  }
36
38
  }
37
39
  export const Translations = new TranslationsController();
@@ -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
  }
@@ -1,5 +1,14 @@
1
1
  import { a as getRenderingRef, f as forceUpdate } from './index-cf54a432.js';
2
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
+
3
12
  const appendToMap = (map, propName, value) => {
4
13
  const items = map.get(propName);
5
14
  if (!items) {
@@ -251,6 +260,7 @@ class ApiUrls {
251
260
  this.AddLog = this.uriEnv + 'validation/logs/add';
252
261
  this.AddStep = this.uriEnv + 'validation/logs/step';
253
262
  this.AbortRequest = this.uriEnv + 'validation/identity/abort';
263
+ this.Translations = this.uriEnv + 'validation/translations/get';
254
264
  }
255
265
  }
256
266
 
@@ -299,7 +309,264 @@ onChange('phoneValidation', value => {
299
309
  sessionStorage.setItem(SessionKeys.PhoneValidationKey, String(value));
300
310
  });
301
311
 
312
+ var FlowSteps;
313
+ (function (FlowSteps) {
314
+ FlowSteps[FlowSteps["ComponentLoaded"] = 'component-loaded'] = "ComponentLoaded";
315
+ FlowSteps[FlowSteps["MobileRedirect"] = 'mobile-redirect'] = "MobileRedirect";
316
+ FlowSteps[FlowSteps["Landing"] = 'landing'] = "Landing";
317
+ FlowSteps[FlowSteps["Agreements"] = 'agreements'] = "Agreements";
318
+ FlowSteps[FlowSteps["OtpSend"] = 'otp-send'] = "OtpSend";
319
+ FlowSteps[FlowSteps["OtpCheck"] = 'otp-check'] = "OtpCheck";
320
+ FlowSteps[FlowSteps["CiFront"] = 'ci-front'] = "CiFront";
321
+ FlowSteps[FlowSteps["CiFrontHowTo"] = 'ci-front-how-to'] = "CiFrontHowTo";
322
+ FlowSteps[FlowSteps["CiFrontCapture"] = 'ci-front-capture'] = "CiFrontCapture";
323
+ FlowSteps[FlowSteps["CiBack"] = 'ci-back'] = "CiBack";
324
+ FlowSteps[FlowSteps["CiBackHowTo"] = 'ci-back-how-to'] = "CiBackHowTo";
325
+ FlowSteps[FlowSteps["CiBackCapture"] = 'ci-back-capture'] = "CiBackCapture";
326
+ FlowSteps[FlowSteps["CiTilt"] = 'ci-tilt'] = "CiTilt";
327
+ FlowSteps[FlowSteps["CiError"] = 'ci-error'] = "CiError";
328
+ FlowSteps[FlowSteps["SelfieHowTo"] = 'selfie-how-to'] = "SelfieHowTo";
329
+ FlowSteps[FlowSteps["SelfieTilt"] = 'selfie-tilt'] = "SelfieTilt";
330
+ FlowSteps[FlowSteps["SelfieCapture"] = 'selfie-capture'] = "SelfieCapture";
331
+ FlowSteps[FlowSteps["Selfie"] = 'selfie'] = "Selfie";
332
+ FlowSteps[FlowSteps["SelfieError"] = 'selfie-error'] = "SelfieError";
333
+ FlowSteps[FlowSteps["End"] = 'end'] = "End";
334
+ FlowSteps[FlowSteps["CameraError"] = 'camera-error'] = "CameraError";
335
+ })(FlowSteps || (FlowSteps = {}));
336
+ var FlowMoments;
337
+ (function (FlowMoments) {
338
+ FlowMoments[FlowMoments["Initialized"] = 'initialized'] = "Initialized";
339
+ FlowMoments[FlowMoments["Finalized"] = 'finalized'] = "Finalized";
340
+ FlowMoments[FlowMoments["None"] = 'none'] = "None";
341
+ })(FlowMoments || (FlowMoments = {}));
342
+
343
+ class ApiCall {
344
+ constructor() {
345
+ this.serviceErrors = ['Service Unavailable', 'Unauthorized'];
346
+ this.toBase64 = (file) => new Promise((resolve, reject) => {
347
+ const reader = new FileReader();
348
+ reader.readAsDataURL(file);
349
+ reader.onload = () => resolve(reader.result);
350
+ reader.onerror = error => reject(error);
351
+ });
352
+ this.urls = new ApiUrls();
353
+ }
354
+ // private async http2<T>(method: string, url: string, data: string): Promise<T> {
355
+ // return new Promise((resolve, reject) => {
356
+ // var xhr = new XMLHttpRequest();
357
+ // xhr.open(method, url);
358
+ // xhr.onload = function () {
359
+ // if (xhr.status >= 200 && xhr.status < 300) {
360
+ // resolve(xhr.response);
361
+ // } else {
362
+ // reject({
363
+ // status: xhr.status,
364
+ // statusText: xhr.statusText,
365
+ // });
366
+ // }
367
+ // };
368
+ // xhr.onerror = function () {
369
+ // reject({
370
+ // status: xhr.status,
371
+ // statusText: xhr.statusText,
372
+ // });
373
+ // };
374
+ // xhr.send(data);
375
+ // });
376
+ // }
377
+ async http(request) {
378
+ const response = await fetch(request);
379
+ if (!response.ok) {
380
+ throw new Error(response.statusText);
381
+ }
382
+ try {
383
+ // may error if there is no body
384
+ return await response.json();
385
+ }
386
+ catch (ex) {
387
+ throw new Error('No json found in response ' + ex);
388
+ }
389
+ }
390
+ async post(url, data, withRetry = true) {
391
+ var request = new Request(state.apiBaseUrl + url, {
392
+ method: 'POST',
393
+ body: data,
394
+ headers: {
395
+ 'Content-Type': 'application/json',
396
+ 'Authorization': 'IDKYC-TOKEN ' + state.token,
397
+ },
398
+ });
399
+ try {
400
+ return await this.http(request);
401
+ }
402
+ catch (ex) {
403
+ if (!withRetry || this.serviceErrors.includes(ex.message)) {
404
+ throw ex;
405
+ }
406
+ this.AddLog('Error in post ', ex);
407
+ try {
408
+ var request2 = new Request(state.apiBaseUrl + url, {
409
+ method: 'POST',
410
+ body: data,
411
+ headers: {
412
+ 'Content-Type': 'application/json',
413
+ 'Authorization': 'IDKYC-TOKEN ' + state.token,
414
+ },
415
+ });
416
+ return await this.http(request2);
417
+ }
418
+ catch (ex2) {
419
+ this.AddLog('Error in post ', ex2);
420
+ var request3 = new Request(state.apiBaseUrl + url, {
421
+ method: 'POST',
422
+ body: data,
423
+ headers: {
424
+ 'Content-Type': 'application/json',
425
+ 'Authorization': 'IDKYC-TOKEN ' + state.token,
426
+ },
427
+ });
428
+ return await this.http(request3);
429
+ }
430
+ }
431
+ }
432
+ async get(url, withRetry = true) {
433
+ var request = new Request(state.apiBaseUrl + url, {
434
+ method: 'GET',
435
+ headers: {
436
+ 'Content-Type': 'application/json',
437
+ 'Authorization': 'IDKYC-TOKEN ' + state.token,
438
+ },
439
+ });
440
+ try {
441
+ return await this.http(request);
442
+ }
443
+ catch (ex) {
444
+ if (!withRetry || this.serviceErrors.includes(ex.message)) {
445
+ throw ex;
446
+ }
447
+ this.AddLog('Error in get ', ex);
448
+ try {
449
+ var request2 = new Request(state.apiBaseUrl + url, {
450
+ method: 'GET',
451
+ headers: {
452
+ 'Content-Type': 'application/json',
453
+ 'Authorization': 'IDKYC-TOKEN ' + state.token,
454
+ },
455
+ });
456
+ return await this.http(request2);
457
+ }
458
+ catch (ex2) {
459
+ this.AddLog('Error in get ', ex2);
460
+ var request3 = new Request(state.apiBaseUrl + url, {
461
+ method: 'GET',
462
+ headers: {
463
+ 'Content-Type': 'application/json',
464
+ 'Authorization': 'IDKYC-TOKEN ' + state.token,
465
+ },
466
+ });
467
+ return await this.http(request3);
468
+ }
469
+ }
470
+ }
471
+ async SendOTPCode(requestId, phoneNumber) {
472
+ let data = { requestId: requestId, phone: phoneNumber };
473
+ let jsonResp = await this.post(this.urls.OtpSend, JSON.stringify(data));
474
+ return jsonResp.sent;
475
+ }
476
+ async CheckOTPCode(requestId, otpCode) {
477
+ let data = { requestId: requestId, otp: otpCode };
478
+ let jsonResp = await this.post(this.urls.OtpCheck, JSON.stringify(data));
479
+ return jsonResp.valid;
480
+ }
481
+ async AddIdentificationRequest(deviceInfo, version) {
482
+ if (state.debug)
483
+ console.log('Calling identity request with store:' + JSON.stringify(state));
484
+ let data = {
485
+ requestId: state.requestId,
486
+ clientDeviceInfo: JSON.stringify(deviceInfo),
487
+ redirectId: state.redirectId,
488
+ phoneNumber: state.phoneNumber,
489
+ version: version,
490
+ };
491
+ let jsonResp = await this.post(this.urls.IdentityInsert, JSON.stringify(data));
492
+ if (state.requestId == '') {
493
+ state.requestId = jsonResp.requestId;
494
+ }
495
+ state.hasIdBack = jsonResp.hasIdBack;
496
+ state.hasIdTilt = jsonResp.hasIdTilt;
497
+ state.hasSelfieGesture = jsonResp.hasSelfieGesture;
498
+ state.agreementsValidation = jsonResp.agreementsValidation;
499
+ state.phoneValidation = jsonResp.phoneValidation;
500
+ state.phoneNumber = jsonResp.phoneNumber;
501
+ return true;
502
+ }
503
+ async UploadFileForRequestB64(requestId, type, file) {
504
+ let data = {
505
+ requestId: requestId,
506
+ type: type,
507
+ data: await this.toBase64(file),
508
+ };
509
+ let respJson = await this.post(this.urls.UploadCapture, JSON.stringify(data));
510
+ if (!state.hasIdBack && type == 'IdFront') {
511
+ return respJson.isValid;
512
+ }
513
+ if (state.hasIdBack && type == 'IdBack') {
514
+ return respJson.isValid;
515
+ }
516
+ if (type == 'Selfie') {
517
+ return respJson.isValid;
518
+ }
519
+ return true;
520
+ }
521
+ async GetAgreement(agreementType) {
522
+ let resp = await this.get(this.urls.GetAgreement + '?type=' + agreementType + '&requestId=' + state.requestId);
523
+ return resp.htmlText;
524
+ }
525
+ async GenerateAgreement(agreementType) {
526
+ let data = { requestId: state.requestId, documentType: agreementType };
527
+ let resp = await this.post(this.urls.GenerateAgreement, JSON.stringify(data));
528
+ return resp.generation;
529
+ }
530
+ async GetStatus(requestId) {
531
+ let resp = await this.get(this.urls.GetStatus + '?orderId=' + requestId);
532
+ return OrderStatuses[resp.status];
533
+ }
534
+ async SendLink(link, phoneNumber) {
535
+ let data = { requestId: state.requestId, link: link, phoneNumber: phoneNumber };
536
+ let resp = await this.post(this.urls.SendLink, JSON.stringify(data));
537
+ return resp.sent;
538
+ }
539
+ async AddLog(error, context) {
540
+ try {
541
+ let data = {
542
+ requestId: state.requestId,
543
+ action: FlowStatus[state.flowStatus],
544
+ message: JSON.stringify({ error, context }),
545
+ };
546
+ let result = await this.post(this.urls.AddLog, JSON.stringify(data), false);
547
+ return result.saved;
548
+ }
549
+ catch (_a) { }
550
+ }
551
+ async AddStep(step, moment) {
552
+ let data = { requestId: state.requestId, redirectId: state.redirectId, step: FlowSteps[step], moment: FlowMoments[moment], timestamp: new Date().toISOString() };
553
+ let result = await this.post(this.urls.AddStep, JSON.stringify(data));
554
+ return result.saved;
555
+ }
556
+ async AbortRequest() {
557
+ let result = await this.post(this.urls.AbortRequest, JSON.stringify({ requestId: state.requestId }));
558
+ return result.saved;
559
+ }
560
+ async GetTranslations(langIso) {
561
+ let result = await this.get(this.urls.Translations + '?langIso=' + langIso);
562
+ return result;
563
+ }
564
+ }
565
+
302
566
  class TranslationsController {
567
+ constructor() {
568
+ this.apiCall = new ApiCall();
569
+ }
303
570
  async getValues() {
304
571
  if (this.values) {
305
572
  return this.values;
@@ -310,30 +577,28 @@ class TranslationsController {
310
577
  }
311
578
  }
312
579
  getLocale(element = document.body) {
313
- const closestElement = element.closest('[lang]');
314
- return closestElement ? closestElement.lang : state.langIso;
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
+ }
315
587
  }
316
588
  async fetchTranslations() {
317
589
  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);
590
+ try {
591
+ const result = this.apiCall.GetTranslations(locale);
592
+ if (result) {
593
+ return result;
333
594
  }
334
595
  }
596
+ catch (exception) {
597
+ console.error(`Error loading locale: ${locale}`, exception);
598
+ return null;
599
+ }
335
600
  }
336
601
  }
337
602
  const Translations = new TranslationsController();
338
603
 
339
- export { ApiUrls as A, FlowStatus as F, IdCaptureValues as I, SessionKeys as S, Translations as T, SelfieCaptureValues as a, state as s };
604
+ 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 };
@@ -1,264 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-cf54a432.js';
2
- import { A as ApiUrls, s as state, F as FlowStatus, T as Translations, S as SessionKeys, I as IdCaptureValues, a as SelfieCaptureValues } from './TranslationUtils-8ceeb437.js';
3
-
4
- var OrderStatuses;
5
- (function (OrderStatuses) {
6
- OrderStatuses[OrderStatuses["Capturing"] = 0] = "Capturing";
7
- OrderStatuses[OrderStatuses["FinishedCapturing"] = 1] = "FinishedCapturing";
8
- OrderStatuses[OrderStatuses["Waiting"] = 2] = "Waiting";
9
- OrderStatuses[OrderStatuses["NotFound"] = 3] = "NotFound";
10
- OrderStatuses[OrderStatuses["Aborted"] = 4] = "Aborted";
11
- })(OrderStatuses || (OrderStatuses = {}));
12
-
13
- var FlowSteps;
14
- (function (FlowSteps) {
15
- FlowSteps[FlowSteps["ComponentLoaded"] = 'component-loaded'] = "ComponentLoaded";
16
- FlowSteps[FlowSteps["MobileRedirect"] = 'mobile-redirect'] = "MobileRedirect";
17
- FlowSteps[FlowSteps["Landing"] = 'landing'] = "Landing";
18
- FlowSteps[FlowSteps["Agreements"] = 'agreements'] = "Agreements";
19
- FlowSteps[FlowSteps["OtpSend"] = 'otp-send'] = "OtpSend";
20
- FlowSteps[FlowSteps["OtpCheck"] = 'otp-check'] = "OtpCheck";
21
- FlowSteps[FlowSteps["CiFront"] = 'ci-front'] = "CiFront";
22
- FlowSteps[FlowSteps["CiFrontHowTo"] = 'ci-front-how-to'] = "CiFrontHowTo";
23
- FlowSteps[FlowSteps["CiFrontCapture"] = 'ci-front-capture'] = "CiFrontCapture";
24
- FlowSteps[FlowSteps["CiBack"] = 'ci-back'] = "CiBack";
25
- FlowSteps[FlowSteps["CiBackHowTo"] = 'ci-back-how-to'] = "CiBackHowTo";
26
- FlowSteps[FlowSteps["CiBackCapture"] = 'ci-back-capture'] = "CiBackCapture";
27
- FlowSteps[FlowSteps["CiTilt"] = 'ci-tilt'] = "CiTilt";
28
- FlowSteps[FlowSteps["CiError"] = 'ci-error'] = "CiError";
29
- FlowSteps[FlowSteps["SelfieHowTo"] = 'selfie-how-to'] = "SelfieHowTo";
30
- FlowSteps[FlowSteps["SelfieTilt"] = 'selfie-tilt'] = "SelfieTilt";
31
- FlowSteps[FlowSteps["SelfieCapture"] = 'selfie-capture'] = "SelfieCapture";
32
- FlowSteps[FlowSteps["Selfie"] = 'selfie'] = "Selfie";
33
- FlowSteps[FlowSteps["SelfieError"] = 'selfie-error'] = "SelfieError";
34
- FlowSteps[FlowSteps["End"] = 'end'] = "End";
35
- FlowSteps[FlowSteps["CameraError"] = 'camera-error'] = "CameraError";
36
- })(FlowSteps || (FlowSteps = {}));
37
- var FlowMoments;
38
- (function (FlowMoments) {
39
- FlowMoments[FlowMoments["Initialized"] = 'initialized'] = "Initialized";
40
- FlowMoments[FlowMoments["Finalized"] = 'finalized'] = "Finalized";
41
- FlowMoments[FlowMoments["None"] = 'none'] = "None";
42
- })(FlowMoments || (FlowMoments = {}));
43
-
44
- class ApiCall {
45
- constructor() {
46
- this.serviceErrors = ['Service Unavailable', 'Unauthorized'];
47
- this.toBase64 = (file) => new Promise((resolve, reject) => {
48
- const reader = new FileReader();
49
- reader.readAsDataURL(file);
50
- reader.onload = () => resolve(reader.result);
51
- reader.onerror = error => reject(error);
52
- });
53
- this.urls = new ApiUrls();
54
- }
55
- // private async http2<T>(method: string, url: string, data: string): Promise<T> {
56
- // return new Promise((resolve, reject) => {
57
- // var xhr = new XMLHttpRequest();
58
- // xhr.open(method, url);
59
- // xhr.onload = function () {
60
- // if (xhr.status >= 200 && xhr.status < 300) {
61
- // resolve(xhr.response);
62
- // } else {
63
- // reject({
64
- // status: xhr.status,
65
- // statusText: xhr.statusText,
66
- // });
67
- // }
68
- // };
69
- // xhr.onerror = function () {
70
- // reject({
71
- // status: xhr.status,
72
- // statusText: xhr.statusText,
73
- // });
74
- // };
75
- // xhr.send(data);
76
- // });
77
- // }
78
- async http(request) {
79
- const response = await fetch(request);
80
- if (!response.ok) {
81
- throw new Error(response.statusText);
82
- }
83
- try {
84
- // may error if there is no body
85
- return await response.json();
86
- }
87
- catch (ex) {
88
- throw new Error('No json found in response ' + ex);
89
- }
90
- }
91
- async post(url, data, withRetry = true) {
92
- var request = new Request(state.apiBaseUrl + url, {
93
- method: 'POST',
94
- body: data,
95
- headers: {
96
- 'Content-Type': 'application/json',
97
- 'Authorization': 'IDKYC-TOKEN ' + state.token,
98
- },
99
- });
100
- try {
101
- return await this.http(request);
102
- }
103
- catch (ex) {
104
- if (!withRetry || this.serviceErrors.includes(ex.message)) {
105
- throw ex;
106
- }
107
- this.AddLog('Error in post ', ex);
108
- try {
109
- var request2 = new Request(state.apiBaseUrl + url, {
110
- method: 'POST',
111
- body: data,
112
- headers: {
113
- 'Content-Type': 'application/json',
114
- 'Authorization': 'IDKYC-TOKEN ' + state.token,
115
- },
116
- });
117
- return await this.http(request2);
118
- }
119
- catch (ex2) {
120
- this.AddLog('Error in post ', ex2);
121
- var request3 = new Request(state.apiBaseUrl + url, {
122
- method: 'POST',
123
- body: data,
124
- headers: {
125
- 'Content-Type': 'application/json',
126
- 'Authorization': 'IDKYC-TOKEN ' + state.token,
127
- },
128
- });
129
- return await this.http(request3);
130
- }
131
- }
132
- }
133
- async get(url, withRetry = true) {
134
- var request = new Request(state.apiBaseUrl + url, {
135
- method: 'GET',
136
- headers: {
137
- 'Content-Type': 'application/json',
138
- 'Authorization': 'IDKYC-TOKEN ' + state.token,
139
- },
140
- });
141
- try {
142
- return await this.http(request);
143
- }
144
- catch (ex) {
145
- if (!withRetry || this.serviceErrors.includes(ex.message)) {
146
- throw ex;
147
- }
148
- this.AddLog('Error in get ', ex);
149
- try {
150
- var request2 = new Request(state.apiBaseUrl + url, {
151
- method: 'GET',
152
- headers: {
153
- 'Content-Type': 'application/json',
154
- 'Authorization': 'IDKYC-TOKEN ' + state.token,
155
- },
156
- });
157
- return await this.http(request2);
158
- }
159
- catch (ex2) {
160
- this.AddLog('Error in get ', ex2);
161
- var request3 = new Request(state.apiBaseUrl + url, {
162
- method: 'GET',
163
- headers: {
164
- 'Content-Type': 'application/json',
165
- 'Authorization': 'IDKYC-TOKEN ' + state.token,
166
- },
167
- });
168
- return await this.http(request3);
169
- }
170
- }
171
- }
172
- async SendOTPCode(requestId, phoneNumber) {
173
- let data = { requestId: requestId, phone: phoneNumber };
174
- let jsonResp = await this.post(this.urls.OtpSend, JSON.stringify(data));
175
- return jsonResp.sent;
176
- }
177
- async CheckOTPCode(requestId, otpCode) {
178
- let data = { requestId: requestId, otp: otpCode };
179
- let jsonResp = await this.post(this.urls.OtpCheck, JSON.stringify(data));
180
- return jsonResp.valid;
181
- }
182
- async AddIdentificationRequest(deviceInfo, version) {
183
- if (state.debug)
184
- console.log('Calling identity request with store:' + JSON.stringify(state));
185
- let data = {
186
- requestId: state.requestId,
187
- clientDeviceInfo: JSON.stringify(deviceInfo),
188
- redirectId: state.redirectId,
189
- phoneNumber: state.phoneNumber,
190
- version: version,
191
- };
192
- let jsonResp = await this.post(this.urls.IdentityInsert, JSON.stringify(data));
193
- if (state.requestId == '') {
194
- state.requestId = jsonResp.requestId;
195
- }
196
- state.hasIdBack = jsonResp.hasIdBack;
197
- state.hasIdTilt = jsonResp.hasIdTilt;
198
- state.hasSelfieGesture = jsonResp.hasSelfieGesture;
199
- state.agreementsValidation = jsonResp.agreementsValidation;
200
- state.phoneValidation = jsonResp.phoneValidation;
201
- state.phoneNumber = jsonResp.phoneNumber;
202
- return true;
203
- }
204
- async UploadFileForRequestB64(requestId, type, file) {
205
- let data = {
206
- requestId: requestId,
207
- type: type,
208
- data: await this.toBase64(file),
209
- };
210
- let respJson = await this.post(this.urls.UploadCapture, JSON.stringify(data));
211
- if (!state.hasIdBack && type == 'IdFront') {
212
- return respJson.isValid;
213
- }
214
- if (state.hasIdBack && type == 'IdBack') {
215
- return respJson.isValid;
216
- }
217
- if (type == 'Selfie') {
218
- return respJson.isValid;
219
- }
220
- return true;
221
- }
222
- async GetAgreement(agreementType) {
223
- let resp = await this.get(this.urls.GetAgreement + '?type=' + agreementType + '&requestId=' + state.requestId);
224
- return resp.htmlText;
225
- }
226
- async GenerateAgreement(agreementType) {
227
- let data = { requestId: state.requestId, documentType: agreementType };
228
- let resp = await this.post(this.urls.GenerateAgreement, JSON.stringify(data));
229
- return resp.generation;
230
- }
231
- async GetStatus(requestId) {
232
- let resp = await this.get(this.urls.GetStatus + '?orderId=' + requestId);
233
- return OrderStatuses[resp.status];
234
- }
235
- async SendLink(link, phoneNumber) {
236
- let data = { requestId: state.requestId, link: link, phoneNumber: phoneNumber };
237
- let resp = await this.post(this.urls.SendLink, JSON.stringify(data));
238
- return resp.sent;
239
- }
240
- async AddLog(error, context) {
241
- try {
242
- let data = {
243
- requestId: state.requestId,
244
- action: FlowStatus[state.flowStatus],
245
- message: JSON.stringify({ error, context }),
246
- };
247
- let result = await this.post(this.urls.AddLog, JSON.stringify(data), false);
248
- return result.saved;
249
- }
250
- catch (_a) { }
251
- }
252
- async AddStep(step, moment) {
253
- let data = { requestId: state.requestId, redirectId: state.redirectId, step: FlowSteps[step], moment: FlowMoments[moment], timestamp: new Date().toISOString() };
254
- let result = await this.post(this.urls.AddStep, JSON.stringify(data));
255
- return result.saved;
256
- }
257
- async AbortRequest() {
258
- let result = await this.post(this.urls.AbortRequest, JSON.stringify({ requestId: state.requestId }));
259
- return result.saved;
260
- }
261
- }
2
+ import { A as ApiCall, s as state, F as FlowMoments, a as FlowSteps, T as Translations, b as FlowStatus, S as SessionKeys, I as IdCaptureValues, O as OrderStatuses, c as SelfieCaptureValues } from './TranslationUtils-2450f38e.js';
262
3
 
263
4
  var MobileOS;
264
5
  (function (MobileOS) {
@@ -5796,7 +5537,7 @@ function v4(options, buf, offset) {
5796
5537
  }
5797
5538
 
5798
5539
  const name = "@ekyc_qoobiss/qbs-ect-cmp";
5799
- const version$1 = "3.6.29";
5540
+ const version$1 = "3.6.31";
5800
5541
  const description = "Person Identification Component";
5801
5542
  const main = "./dist/index.cjs.js";
5802
5543
  const module = "./dist/index.js";
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h } from './index-cf54a432.js';
2
- import { T as Translations } from './TranslationUtils-8ceeb437.js';
2
+ import { T as Translations } from './TranslationUtils-2450f38e.js';
3
3
 
4
4
  const randomActionsCss = "";
5
5