@ekyc_qoobiss/qbs-ect-cmp 3.6.44 → 3.6.46

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 (48) hide show
  1. package/dist/cjs/{TranslationUtils-2d932eab.js → TranslationUtils-8f794c41.js} +12 -0
  2. package/dist/cjs/agreement-check_17.cjs.entry.js +208 -301
  3. package/dist/cjs/random-actions.cjs.entry.js +1 -1
  4. package/dist/collection/components/base-component.js +11 -44
  5. package/dist/collection/components/common/agreement-check/agreement-check.js +0 -4
  6. package/dist/collection/components/common/camera-error/camera-error.js +3 -10
  7. package/dist/collection/components/common/capture-error/capture-error.js +3 -8
  8. package/dist/collection/components/common/how-to-info/how-to-info.js +2 -4
  9. package/dist/collection/components/common/id-capture/id-capture.js +2 -3
  10. package/dist/collection/components/common/selfie-capture/selfie-capture.js +1 -3
  11. package/dist/collection/components/flow/agreement-info/agreement-info.js +4 -5
  12. package/dist/collection/components/flow/landing-validation/landing-validation.js +5 -11
  13. package/dist/collection/components/flow/mobile-redirect/mobile-redirect.js +6 -7
  14. package/dist/collection/components/flow/process-id/process-id.js +10 -8
  15. package/dist/collection/components/flow/sms-code-validation/sms-code-validation.js +5 -12
  16. package/dist/collection/components/flow/sms-send/sms-send.js +5 -11
  17. package/dist/collection/components/flow/user-liveness/user-liveness.js +7 -10
  18. package/dist/collection/components/identification-component/identification-component.js +14 -18
  19. package/dist/collection/helpers/ApiCall.js +10 -0
  20. package/dist/collection/helpers/textValues.js +1 -0
  21. package/dist/collection/models/FlowSteps.js +1 -0
  22. package/dist/esm/{TranslationUtils-0039c82d.js → TranslationUtils-770d32d7.js} +12 -0
  23. package/dist/esm/agreement-check_17.entry.js +208 -301
  24. package/dist/esm/random-actions.entry.js +1 -1
  25. package/dist/qbs-ect-cmp/{p-0c1eead0.entry.js → p-1aa8595e.entry.js} +1 -1
  26. package/dist/qbs-ect-cmp/{p-fca9e256.entry.js → p-36eff211.entry.js} +2 -2
  27. package/dist/qbs-ect-cmp/p-a073c59e.js +1 -0
  28. package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
  29. package/dist/types/components/base-component.d.ts +3 -12
  30. package/dist/types/components/common/agreement-check/agreement-check.d.ts +0 -1
  31. package/dist/types/components/common/camera-error/camera-error.d.ts +0 -1
  32. package/dist/types/components/common/capture-error/capture-error.d.ts +0 -1
  33. package/dist/types/components/common/how-to-info/how-to-info.d.ts +0 -1
  34. package/dist/types/components/common/id-capture/id-capture.d.ts +0 -1
  35. package/dist/types/components/common/selfie-capture/selfie-capture.d.ts +0 -1
  36. package/dist/types/components/flow/agreement-info/agreement-info.d.ts +0 -1
  37. package/dist/types/components/flow/landing-validation/landing-validation.d.ts +0 -1
  38. package/dist/types/components/flow/mobile-redirect/mobile-redirect.d.ts +0 -1
  39. package/dist/types/components/flow/process-id/process-id.d.ts +1 -1
  40. package/dist/types/components/flow/sms-code-validation/sms-code-validation.d.ts +0 -1
  41. package/dist/types/components/flow/sms-send/sms-send.d.ts +0 -1
  42. package/dist/types/components/flow/user-liveness/user-liveness.d.ts +0 -1
  43. package/dist/types/components/identification-component/identification-component.d.ts +0 -2
  44. package/dist/types/helpers/ApiCall.d.ts +3 -0
  45. package/dist/types/helpers/textValues.d.ts +1 -0
  46. package/dist/types/models/FlowSteps.d.ts +2 -1
  47. package/package.json +1 -1
  48. package/dist/qbs-ect-cmp/p-b969ca3e.js +0 -1
@@ -7,11 +7,12 @@ import Events from '../../helpers/Events';
7
7
  import * as uuid from 'uuid';
8
8
  import packageJson from '../../../package.json';
9
9
  import { getLogMessage } from '../../utils/utils';
10
- import { BaseComponent } from '../base-component';
11
10
  import { Browser } from '../../models/IDevice';
12
11
  import { FlowMoments, FlowSteps } from '../../models/FlowSteps';
13
12
  // @ts-ignore
14
13
  import loaderImg from '../../assets/loader.svg';
14
+ import { DeviceDetection } from '../../helpers/DeviceDetection';
15
+ import { ApiCall } from '../../helpers/ApiCall';
15
16
  export class IdentificationComponent {
16
17
  async onTokenChange(newValue, _oldValue) {
17
18
  if (store.debug)
@@ -26,7 +27,7 @@ export class IdentificationComponent {
26
27
  }
27
28
  agreementAcceptanceEmitted(data) {
28
29
  try {
29
- this.baseComponent.apiCall.GenerateAgreement(data.detail.agreementType);
30
+ ApiCall.instance.GenerateAgreement(data.detail.agreementType);
30
31
  }
31
32
  catch (e) {
32
33
  this.apiErrorEmitter(e, 'Agreement Acceptance');
@@ -50,7 +51,7 @@ export class IdentificationComponent {
50
51
  }
51
52
  let apiLogData = { message: this.errorTitle, stack: this.errorMessage, zone };
52
53
  try {
53
- await this.baseComponent.apiCall.AddLog(apiLogData, getLogMessage(this.order_id, this.redirect_id, this.token));
54
+ await ApiCall.instance.AddLog(apiLogData, getLogMessage(this.order_id, this.redirect_id, this.token));
54
55
  }
55
56
  catch (_g) { }
56
57
  Events.flowError(this.errorTitle);
@@ -64,7 +65,6 @@ export class IdentificationComponent {
64
65
  }
65
66
  constructor() {
66
67
  this.logInit = {};
67
- this.flowStatusToSet = FlowStatus.NONE;
68
68
  this.initialised = false;
69
69
  this.token = undefined;
70
70
  this.order_id = undefined;
@@ -75,6 +75,7 @@ export class IdentificationComponent {
75
75
  this.lang_iso = undefined;
76
76
  this.errorMessage = undefined;
77
77
  this.errorTitle = undefined;
78
+ ApiCall.getInstance();
78
79
  }
79
80
  async componentWillLoad() {
80
81
  Events.init(window);
@@ -83,8 +84,6 @@ export class IdentificationComponent {
83
84
  if (this.env && this.env != '') {
84
85
  store.environment = this.env;
85
86
  }
86
- this.baseComponent = new BaseComponent(FlowSteps.ComponentLoaded);
87
- this.baseComponent.setErrorCallback(this.apiErrorEmitter);
88
87
  if (store.debug)
89
88
  this.logInit = getLogMessage(this.order_id, this.redirect_id, this.token);
90
89
  if (this.token) {
@@ -122,19 +121,13 @@ export class IdentificationComponent {
122
121
  store.requestId = savedRequest;
123
122
  this.order_id = savedRequest;
124
123
  }
125
- if (this.flowStatusToSet == FlowStatus.NONE) {
126
- var flowSt = sessionStorage.getItem(SessionKeys.FlowStatusKey);
127
- if (flowSt) {
128
- this.flowStatusToSet = FlowStatus[flowSt];
129
- }
130
- else {
131
- this.flowStatusToSet = FlowStatus.LANDING;
132
- }
133
- }
134
124
  }
135
125
  async componentDidLoad() {
126
+ try {
127
+ store.flowStatus = await ApiCall.instance.GetFlowState();
128
+ }
129
+ catch (e) { }
136
130
  await this.initializeRequest();
137
- store.flowStatus = this.flowStatusToSet;
138
131
  }
139
132
  async initializeRequest() {
140
133
  if (this.initialised) {
@@ -144,13 +137,16 @@ export class IdentificationComponent {
144
137
  if (store.environment == 'DEMO') {
145
138
  return;
146
139
  }
140
+ if (!store.device) {
141
+ store.device = new DeviceDetection().getDevice();
142
+ }
147
143
  if (store.device.browser == Browser.Mi) {
148
144
  this.apiErrorEmitter('Mi Browser nu este acceptat. Va rugam utilizati Chrome.', 'Request Initialisation RequestId:' + store.requestId + ' RedirectId:' + store.redirectId);
149
145
  return;
150
146
  }
151
147
  try {
152
148
  if (store.debug)
153
- this.baseComponent.apiCall.AddLog({ phase: 'debug mode' }, this.logInit);
149
+ ApiCall.instance.AddLog({ phase: 'debug mode' }, this.logInit);
154
150
  }
155
151
  catch (_a) { }
156
152
  try {
@@ -159,7 +155,7 @@ export class IdentificationComponent {
159
155
  this.redirect_id = store.redirectId;
160
156
  }
161
157
  if (store.token != '' && (store.requestId != '' || store.redirectId != '')) {
162
- await this.baseComponent.apiCall.AddIdentificationRequest(store.device, packageJson.version);
158
+ await ApiCall.instance.AddIdentificationRequest(store.device, packageJson.version);
163
159
  if (!this.order_id || this.order_id == '') {
164
160
  this.order_id = store.requestId;
165
161
  }
@@ -4,6 +4,12 @@ import { ApiUrls } from './textValues';
4
4
  import { FlowStatus } from '../models/FlowStatus';
5
5
  import { FlowMoments, FlowSteps } from '../models/FlowSteps';
6
6
  export class ApiCall {
7
+ static getInstance() {
8
+ if (!ApiCall.instance) {
9
+ ApiCall.instance = new ApiCall();
10
+ }
11
+ return ApiCall.instance;
12
+ }
7
13
  constructor() {
8
14
  this.serviceErrors = ['Service Unavailable', 'Unauthorized'];
9
15
  this.toBase64 = (file) => new Promise((resolve, reject) => {
@@ -223,4 +229,8 @@ export class ApiCall {
223
229
  let result = await this.get(this.urls.StartFlow + '?requesId=' + store.requestId);
224
230
  return FlowStatus[result.state];
225
231
  }
232
+ async GetFlowState() {
233
+ let result = await this.get(this.urls.CurrentFlowState + '?requesId=' + store.requestId);
234
+ return FlowStatus[result.state];
235
+ }
226
236
  }
@@ -47,5 +47,6 @@ export class ApiUrls {
47
47
  this.Translations = this.uriEnv + 'validation/translations/get';
48
48
  this.StartFlow = this.uriEnv + 'flowstate/startflow';
49
49
  this.NextFlowState = this.uriEnv + 'flowstate/getnextstate';
50
+ this.CurrentFlowState = this.uriEnv + 'flowstate/getcurrentstate';
50
51
  }
51
52
  }
@@ -21,6 +21,7 @@ export var FlowSteps;
21
21
  FlowSteps[FlowSteps["SelfieError"] = 'selfie-error'] = "SelfieError";
22
22
  FlowSteps[FlowSteps["End"] = 'end'] = "End";
23
23
  FlowSteps[FlowSteps["CameraError"] = 'camera-error'] = "CameraError";
24
+ FlowSteps[FlowSteps["Default"] = 'default'] = "Default";
24
25
  })(FlowSteps || (FlowSteps = {}));
25
26
  export var FlowMoments;
26
27
  (function (FlowMoments) {
@@ -268,6 +268,7 @@ class ApiUrls {
268
268
  this.Translations = this.uriEnv + 'validation/translations/get';
269
269
  this.StartFlow = this.uriEnv + 'flowstate/startflow';
270
270
  this.NextFlowState = this.uriEnv + 'flowstate/getnextstate';
271
+ this.CurrentFlowState = this.uriEnv + 'flowstate/getcurrentstate';
271
272
  }
272
273
  }
273
274
 
@@ -321,6 +322,7 @@ var FlowSteps;
321
322
  FlowSteps[FlowSteps["SelfieError"] = 'selfie-error'] = "SelfieError";
322
323
  FlowSteps[FlowSteps["End"] = 'end'] = "End";
323
324
  FlowSteps[FlowSteps["CameraError"] = 'camera-error'] = "CameraError";
325
+ FlowSteps[FlowSteps["Default"] = 'default'] = "Default";
324
326
  })(FlowSteps || (FlowSteps = {}));
325
327
  var FlowMoments;
326
328
  (function (FlowMoments) {
@@ -330,6 +332,12 @@ var FlowMoments;
330
332
  })(FlowMoments || (FlowMoments = {}));
331
333
 
332
334
  class ApiCall {
335
+ static getInstance() {
336
+ if (!ApiCall.instance) {
337
+ ApiCall.instance = new ApiCall();
338
+ }
339
+ return ApiCall.instance;
340
+ }
333
341
  constructor() {
334
342
  this.serviceErrors = ['Service Unavailable', 'Unauthorized'];
335
343
  this.toBase64 = (file) => new Promise((resolve, reject) => {
@@ -549,6 +557,10 @@ class ApiCall {
549
557
  let result = await this.get(this.urls.StartFlow + '?requesId=' + state.requestId);
550
558
  return FlowStatus[result.state];
551
559
  }
560
+ async GetFlowState() {
561
+ let result = await this.get(this.urls.CurrentFlowState + '?requesId=' + state.requestId);
562
+ return FlowStatus[result.state];
563
+ }
552
564
  }
553
565
 
554
566
  class TranslationsController {