@ekyc_qoobiss/qbs-ect-cmp 3.6.39 → 3.6.41

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 (67) hide show
  1. package/dist/cjs/{TranslationUtils-bfe4477a.js → TranslationUtils-dd73945b.js} +31 -43
  2. package/dist/cjs/{agreement-check_19.cjs.entry.js → agreement-check_17.cjs.entry.js} +245 -882
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/qbs-ect-cmp.cjs.js +1 -1
  5. package/dist/cjs/random-actions.cjs.entry.js +1 -1
  6. package/dist/collection/collection-manifest.json +1 -3
  7. package/dist/collection/components/common/how-to-info/how-to-info.js +11 -34
  8. package/dist/collection/components/common/id-capture/id-capture.js +39 -19
  9. package/dist/collection/components/common/selfie-capture/selfie-capture.js +26 -27
  10. package/dist/collection/components/controls/camera/camera.js +1 -62
  11. package/dist/collection/components/flow/agreement-info/agreement-info.js +4 -5
  12. package/dist/collection/components/flow/landing-validation/landing-validation.js +11 -19
  13. package/dist/collection/components/flow/mobile-redirect/mobile-redirect.js +1 -1
  14. package/dist/collection/components/flow/process-id/process-id.js +47 -161
  15. package/dist/collection/components/flow/sms-code-validation/sms-code-validation.js +7 -56
  16. package/dist/collection/components/flow/sms-send/sms-send.css +0 -0
  17. package/dist/collection/components/flow/sms-send/sms-send.js +91 -0
  18. package/dist/collection/components/flow/user-liveness/user-liveness.js +45 -118
  19. package/dist/collection/components/identification-component/identification-component.js +14 -41
  20. package/dist/collection/helpers/ApiCall.js +14 -15
  21. package/dist/collection/helpers/ML5.js +1 -1
  22. package/dist/collection/helpers/Stream.js +1 -47
  23. package/dist/collection/helpers/store.js +0 -18
  24. package/dist/collection/helpers/textValues.js +2 -0
  25. package/dist/collection/models/CaptureFlow.js +0 -16
  26. package/dist/collection/models/FlowStatus.js +16 -10
  27. package/dist/esm/{TranslationUtils-7e68bc94.js → TranslationUtils-741a728a.js} +31 -43
  28. package/dist/esm/{agreement-check_19.entry.js → agreement-check_17.entry.js} +245 -880
  29. package/dist/esm/loader.js +1 -1
  30. package/dist/esm/qbs-ect-cmp.js +1 -1
  31. package/dist/esm/random-actions.entry.js +1 -1
  32. package/dist/qbs-ect-cmp/p-87c689d6.js +1 -0
  33. package/dist/qbs-ect-cmp/{p-d1d9feaf.entry.js → p-a130edd5.entry.js} +1 -1
  34. package/dist/qbs-ect-cmp/{p-4e3b735b.entry.js → p-b3fa0a37.entry.js} +2 -2
  35. package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
  36. package/dist/types/components/common/how-to-info/how-to-info.d.ts +0 -1
  37. package/dist/types/components/common/id-capture/id-capture.d.ts +5 -1
  38. package/dist/types/components/common/selfie-capture/selfie-capture.d.ts +3 -2
  39. package/dist/types/components/controls/camera/camera.d.ts +0 -7
  40. package/dist/types/components/flow/process-id/process-id.d.ts +0 -3
  41. package/dist/types/components/flow/sms-code-validation/sms-code-validation.d.ts +0 -3
  42. package/dist/types/components/flow/sms-send/sms-send.d.ts +17 -0
  43. package/dist/types/components/flow/user-liveness/user-liveness.d.ts +2 -6
  44. package/dist/types/components/identification-component/identification-component.d.ts +1 -2
  45. package/dist/types/components.d.ts +18 -65
  46. package/dist/types/helpers/ApiCall.d.ts +9 -3
  47. package/dist/types/helpers/Stream.d.ts +0 -11
  48. package/dist/types/helpers/textValues.d.ts +2 -0
  49. package/dist/types/models/CaptureFlow.d.ts +2 -19
  50. package/dist/types/models/FlowStatus.d.ts +18 -10
  51. package/dist/types/models/IAbortResult.d.ts +1 -0
  52. package/dist/types/models/IAddRequest.d.ts +1 -1
  53. package/dist/types/models/IEctStore.d.ts +0 -6
  54. package/dist/types/models/IOtpCheck.d.ts +1 -0
  55. package/dist/types/models/IOtpSend.d.ts +1 -0
  56. package/dist/types/models/IUploadFile.d.ts +1 -0
  57. package/package.json +1 -1
  58. package/dist/collection/components/common/id-back-capture/id-back-capture.css +0 -35
  59. package/dist/collection/components/common/id-back-capture/id-back-capture.js +0 -219
  60. package/dist/collection/components/common/id-tilt/id-tilt.css +0 -35
  61. package/dist/collection/components/common/id-tilt/id-tilt.js +0 -220
  62. package/dist/collection/components/common/selfie-tilt/selfie-tilt.css +0 -7
  63. package/dist/collection/components/common/selfie-tilt/selfie-tilt.js +0 -221
  64. package/dist/qbs-ect-cmp/p-d35256e9.js +0 -1
  65. package/dist/types/components/common/id-back-capture/id-back-capture.d.ts +0 -28
  66. package/dist/types/components/common/id-tilt/id-tilt.d.ts +0 -28
  67. package/dist/types/components/common/selfie-tilt/selfie-tilt.d.ts +0 -31
@@ -5,12 +5,11 @@ import { FlowStatus } from '../../../models/FlowStatus';
5
5
  import { FlowSteps } from '../../../models/FlowSteps';
6
6
  import { getLogMessage } from '../../../utils/utils';
7
7
  import { BaseComponent } from '../../base-component';
8
- import { IdCaptureFlowStatus, CaptureUploadTypes } from '../../../models/CaptureFlow';
8
+ import { CaptureUploadTypes } from '../../../models/CaptureFlow';
9
9
  // import { IDPose } from '../../libs/IDML5Detector/IDPose';
10
10
  export class ProcessId {
11
11
  constructor() {
12
12
  this.recordingResultCount = 0;
13
- this.captureStep = undefined;
14
13
  this.showTimeout = undefined;
15
14
  this.showInvalid = undefined;
16
15
  this.flow = undefined;
@@ -22,47 +21,42 @@ export class ProcessId {
22
21
  this.initFlow();
23
22
  }
24
23
  initFlow() {
25
- this.flow = {
26
- front: {
27
- photoDone: false,
28
- recordingDone: false,
29
- fileName: 'idImage.png',
30
- recName: 'idVideo.',
31
- photoType: CaptureUploadTypes.IdFront,
32
- recType: CaptureUploadTypes.IdFrontVideo,
33
- },
34
- back: null,
35
- tilt: null,
36
- };
37
- if (store.hasIdBack) {
38
- this.flow.back = {
39
- photoDone: false,
40
- recordingDone: false,
41
- fileName: 'idBackImage.png',
42
- recName: 'idBackVideo.',
43
- photoType: CaptureUploadTypes.IdBack,
44
- recType: CaptureUploadTypes.IdBackVideo,
24
+ if (store.flowStatus == FlowStatus.IDFRONT) {
25
+ this.flow = {
26
+ capture: {
27
+ fileName: 'idImage.png',
28
+ recName: 'idVideo.',
29
+ photoType: CaptureUploadTypes.IdFront,
30
+ recType: CaptureUploadTypes.IdFrontVideo,
31
+ },
32
+ howToDone: false,
33
+ };
34
+ }
35
+ else if (store.flowStatus == FlowStatus.IDBACK) {
36
+ this.flow = {
37
+ capture: {
38
+ fileName: 'idBackImage.png',
39
+ recName: 'idBackVideo.',
40
+ photoType: CaptureUploadTypes.IdBack,
41
+ recType: CaptureUploadTypes.IdBackVideo,
42
+ },
43
+ howToDone: false,
45
44
  };
46
45
  }
47
- if (store.hasIdTilt) {
48
- this.flow.tilt = {
49
- photoDone: true,
50
- recordingDone: false,
51
- fileName: 'idTiltImage.png',
52
- recName: 'idTiltVideo.',
53
- photoType: CaptureUploadTypes.None,
54
- recType: CaptureUploadTypes.TiltVideo,
46
+ else if (store.flowStatus == FlowStatus.IDTILT) {
47
+ this.flow = {
48
+ capture: {
49
+ fileName: 'idTiltImage.png',
50
+ recName: 'idTiltVideo.',
51
+ photoType: CaptureUploadTypes.None,
52
+ recType: CaptureUploadTypes.TiltVideo,
53
+ },
54
+ howToDone: false,
55
55
  };
56
56
  }
57
- this.captureStep = IdCaptureFlowStatus.HowToFront;
58
57
  }
59
58
  howToDone() {
60
- if (this.captureStep == IdCaptureFlowStatus.HowToFront) {
61
- this.captureStep = IdCaptureFlowStatus.IdFront;
62
- }
63
- if (this.captureStep == IdCaptureFlowStatus.HowToBack) {
64
- this.captureStep = IdCaptureFlowStatus.IdBack;
65
- }
59
+ this.flow.howToDone = true;
66
60
  }
67
61
  timeElapsed() {
68
62
  this.showTimeout = true;
@@ -83,25 +77,11 @@ export class ProcessId {
83
77
  return;
84
78
  }
85
79
  try {
86
- let frontCapture = new File([idPhoto], this.flow.front.fileName, { type: 'image/png' });
87
- this.flow.front.photoDone = await this.uploadPhotos(this.flow.front.photoType, frontCapture);
88
- await this.endFlow();
89
- }
90
- catch (e) {
91
- this.apiErrorEvent.emit(e);
92
- }
93
- }
94
- async captureIdBackImage(event) {
95
- let idPhoto = event.detail;
96
- if (idPhoto.size == 0) {
97
- await this.baseComponent.apiCall.AddLog({ message: 'Empty id photo', blobData: idPhoto }, getLogMessage());
98
- this.triggerErrorFlow();
99
- return;
100
- }
101
- try {
102
- let backCapture = new File([idPhoto], this.flow.back.fileName, { type: 'image/png' });
103
- this.flow.back.photoDone = await this.uploadPhotos(this.flow.back.photoType, backCapture);
104
- await this.endFlow();
80
+ let frontCapture = new File([idPhoto], this.flow.capture.fileName, { type: 'image/png' });
81
+ let uploadPhotoDone = await this.uploadPhotos(this.flow.capture.photoType, frontCapture);
82
+ if (!uploadPhotoDone) {
83
+ this.triggerErrorFlow();
84
+ }
105
85
  }
106
86
  catch (e) {
107
87
  this.apiErrorEvent.emit(e);
@@ -119,22 +99,11 @@ export class ProcessId {
119
99
  return;
120
100
  }
121
101
  let mimeType = idRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
122
- if (this.captureStep == IdCaptureFlowStatus.IdFront) {
123
- let frontRec = new File([idRecording], this.flow.front.recName + mimeType.extension, { type: mimeType.type });
124
- this.flow.front.recordingDone = await this.uploadRecording(this.flow.front.recType, frontRec);
125
- }
126
- else if (this.captureStep == IdCaptureFlowStatus.IdBack) {
127
- let backRec = new File([idRecording], this.flow.back.recName + mimeType.extension, { type: mimeType.type });
128
- this.flow.back.recordingDone = await this.uploadRecording(this.flow.back.recType, backRec);
129
- }
130
- else if (this.captureStep == IdCaptureFlowStatus.Tilt) {
131
- let tiltRec = new File([idRecording], this.flow.tilt.recName + mimeType.extension, { type: mimeType.type });
132
- this.flow.tilt.recordingDone = await this.uploadRecording(this.flow.tilt.recType, tiltRec);
133
- }
134
- else {
135
- this.triggerErrorFlow(true);
102
+ let captureRec = new File([idRecording], this.flow.capture.recName + mimeType.extension, { type: mimeType.type });
103
+ let recordingUploaded = await this.uploadRecording(this.flow.capture.recType, captureRec);
104
+ if (!recordingUploaded) {
105
+ this.triggerErrorFlow();
136
106
  }
137
- await this.endFlow();
138
107
  this.recordingResultCount = 0;
139
108
  }
140
109
  async componentDidLoad() {
@@ -167,72 +136,9 @@ export class ProcessId {
167
136
  }
168
137
  return false;
169
138
  }
170
- triggerErrorFlow(restart = false) {
171
- if (this.captureStep == IdCaptureFlowStatus.IdBack) {
172
- restart = true;
173
- }
174
- if (restart) {
175
- this.initFlow();
176
- this.showInvalid = true;
177
- return;
178
- }
179
- if (this.captureStep == IdCaptureFlowStatus.IdFront) {
180
- this.flow.front.photoDone = false;
181
- this.flow.front.recordingDone = false;
182
- }
183
- if (this.captureStep == IdCaptureFlowStatus.IdBack) {
184
- this.flow.back.photoDone = false;
185
- this.flow.back.recordingDone = false;
186
- }
187
- if (this.captureStep == IdCaptureFlowStatus.Tilt) {
188
- this.flow.tilt.photoDone = true;
189
- this.flow.tilt.recordingDone = false;
190
- }
139
+ triggerErrorFlow() {
191
140
  this.showInvalid = true;
192
141
  }
193
- async endFlow() {
194
- if (this.captureStep == IdCaptureFlowStatus.IdFront) {
195
- if (this.flow.front.photoDone && this.flow.front.recordingDone) {
196
- if (store.hasIdBack) {
197
- this.captureStep = IdCaptureFlowStatus.IdBack;
198
- }
199
- else if (store.hasIdTilt) {
200
- this.captureStep = IdCaptureFlowStatus.Tilt;
201
- }
202
- else {
203
- this.captureStep = IdCaptureFlowStatus.End;
204
- }
205
- }
206
- else {
207
- return;
208
- }
209
- }
210
- if (this.captureStep == IdCaptureFlowStatus.IdBack && store.hasIdBack) {
211
- if (this.flow.back.photoDone && this.flow.back.recordingDone) {
212
- if (store.hasIdTilt) {
213
- this.captureStep = IdCaptureFlowStatus.Tilt;
214
- }
215
- else {
216
- this.captureStep = IdCaptureFlowStatus.End;
217
- }
218
- }
219
- else {
220
- return;
221
- }
222
- }
223
- if (this.captureStep == IdCaptureFlowStatus.Tilt && store.hasIdTilt) {
224
- if (this.flow.tilt.photoDone && this.flow.tilt.recordingDone) {
225
- this.captureStep = IdCaptureFlowStatus.End;
226
- }
227
- else {
228
- return;
229
- }
230
- }
231
- if (this.captureStep != IdCaptureFlowStatus.End) {
232
- return;
233
- }
234
- store.flowStatus = FlowStatus.LIVENESS;
235
- }
236
142
  async disconnectedCallback() {
237
143
  await this.baseComponent.finalize();
238
144
  }
@@ -248,30 +154,17 @@ export class ProcessId {
248
154
  }
249
155
  render() {
250
156
  let error = h("capture-error", { type: "ID" });
251
- let frontCapture = h("id-capture", null);
252
- let secondCapture = h("id-back-capture", null);
253
- let tiltCapture = h("id-tilt", null);
254
- let howToFront = h("how-to-info", { idSide: "front" });
255
- let howToBack = h("how-to-info", { idSide: "back" });
157
+ let capture = h("id-capture", null);
158
+ let howTo = h("how-to-info", null);
256
159
  if (this.showInvalid || this.showTimeout) {
257
160
  return error;
258
161
  }
259
- if (this.captureStep == IdCaptureFlowStatus.HowToFront) {
260
- return howToFront;
261
- }
262
- if (this.captureStep == IdCaptureFlowStatus.HowToBack) {
263
- return howToBack;
162
+ if (store.flowStatus != FlowStatus.IDTILT && this.flow.howToDone) {
163
+ return howTo;
264
164
  }
265
- if (this.captureStep == IdCaptureFlowStatus.IdFront) {
266
- return frontCapture;
267
- }
268
- if (this.captureStep == IdCaptureFlowStatus.IdBack) {
269
- return secondCapture;
270
- }
271
- if (this.captureStep == IdCaptureFlowStatus.Tilt) {
272
- return tiltCapture;
165
+ else {
166
+ return capture;
273
167
  }
274
- return h("div", null);
275
168
  }
276
169
  static get is() { return "process-id"; }
277
170
  static get originalStyleUrls() {
@@ -286,7 +179,6 @@ export class ProcessId {
286
179
  }
287
180
  static get states() {
288
181
  return {
289
- "captureStep": {},
290
182
  "showTimeout": {},
291
183
  "showInvalid": {},
292
184
  "flow": {}
@@ -335,12 +227,6 @@ export class ProcessId {
335
227
  "target": undefined,
336
228
  "capture": false,
337
229
  "passive": false
338
- }, {
339
- "name": "photoIdBackCapture",
340
- "method": "captureIdBackImage",
341
- "target": undefined,
342
- "capture": false,
343
- "passive": false
344
230
  }, {
345
231
  "name": "recordingIdCapture",
346
232
  "method": "capturedIdRecording",
@@ -9,36 +9,16 @@ export class SmsCodeValidation {
9
9
  this.title = undefined;
10
10
  this.details = undefined;
11
11
  this.buttonText = undefined;
12
- this.phoneNumber = undefined;
13
12
  this.code = undefined;
14
- this.prefilledPhone = false;
15
13
  this.canSend = false;
16
- if (store.flowStatus == FlowStatus.PHONE) {
17
- this.baseComponent = new BaseComponent(FlowSteps.OtpSend);
18
- }
19
- if (store.flowStatus == FlowStatus.CODE) {
20
- this.baseComponent = new BaseComponent(FlowSteps.OtpCheck);
21
- }
14
+ this.baseComponent = new BaseComponent(FlowSteps.OtpCheck);
22
15
  this.baseComponent.setEventEmitter(this.apiErrorEvent);
23
16
  }
24
17
  async doAction() {
25
18
  try {
26
19
  this.canSend = false;
27
- if (store.flowStatus == FlowStatus.CODE || store.flowStatus == FlowStatus.CODEERROR) {
28
- var codeChecked = await this.baseComponent.apiCall.CheckOTPCode(store.requestId, this.code);
29
- if (codeChecked === true) {
30
- store.flowStatus = FlowStatus.ID;
31
- }
32
- else {
33
- store.flowStatus = FlowStatus.CODEERROR;
34
- }
35
- }
36
- if (store.flowStatus == FlowStatus.PHONE) {
37
- var codeSent = await this.baseComponent.apiCall.SendOTPCode(store.requestId, this.phoneNumber);
38
- if (codeSent === true) {
39
- store.flowStatus = FlowStatus.CODE;
40
- }
41
- }
20
+ var codeChecked = await this.baseComponent.apiCall.CheckOTPCode(store.requestId, this.code);
21
+ store.flowStatus = FlowStatus[codeChecked.status];
42
22
  }
43
23
  catch (e) {
44
24
  this.apiErrorEvent.emit(e);
@@ -49,33 +29,13 @@ export class SmsCodeValidation {
49
29
  }
50
30
  async componentWillRender() {
51
31
  this.translations = await Translations.getValues();
52
- if (store.flowStatus == FlowStatus.PHONE) {
53
- this.title = this.translations.PhoneValidationValues.Title;
54
- this.details = this.translations.PhoneValidationValues.Description;
55
- this.buttonText = this.translations.PhoneValidationValues.Button;
56
- if (store.phoneNumber && store.phoneNumber != '') {
57
- this.phoneNumber = store.phoneNumber;
58
- this.prefilledPhone = true;
59
- this.canSend = true;
60
- }
61
- }
62
- if (store.flowStatus == FlowStatus.CODE || store.flowStatus == FlowStatus.CODEERROR) {
63
- this.title = this.translations.CodeValidationValues.Title;
64
- this.details = this.translations.CodeValidationValues.Description;
65
- this.buttonText = this.translations.CodeValidationValues.Button;
66
- }
32
+ this.title = this.translations.CodeValidationValues.Title;
33
+ this.details = this.translations.CodeValidationValues.Description;
34
+ this.buttonText = this.translations.CodeValidationValues.Button;
67
35
  }
68
36
  async componentDidLoad() {
69
37
  await this.baseComponent.initialize();
70
38
  }
71
- handleChangePhone(ev) {
72
- let value = ev.target ? ev.target.value : '';
73
- this.phoneNumber = value.replace(/\D/g, '');
74
- if (this.phoneNumber.length > 10)
75
- this.phoneNumber = this.phoneNumber.substring(0, 10);
76
- this.canSend = this.phoneNumber.length == 10;
77
- ev.target.value = this.phoneNumber;
78
- }
79
39
  handleChangeCode(ev) {
80
40
  let value = ev.target ? ev.target.value : '';
81
41
  this.code = value;
@@ -85,18 +45,11 @@ export class SmsCodeValidation {
85
45
  ev.target.value = this.code;
86
46
  }
87
47
  render() {
88
- let inputBlock;
89
48
  let errorBlock;
90
49
  if (store.flowStatus == FlowStatus.CODEERROR) {
91
50
  errorBlock = h("p", { class: "main-text font-size-18 mt-15 color-red text-center" }, this.translations.CodeValidationValues.Error);
92
51
  }
93
- if (store.flowStatus == FlowStatus.PHONE) {
94
- inputBlock = (h("div", { class: "input-container mb-15" }, h("label", { class: "font-size-18 mb-1" }, h("b", null, this.translations.PhoneValidationValues.Label)), h("input", { type: "tel", id: "phoneInput", class: "main-input", disabled: this.prefilledPhone, onInput: ev => this.handleChangePhone(ev), value: this.phoneNumber })));
95
- }
96
- else {
97
- inputBlock = (h("div", { class: "input-container mb-15" }, h("input", { type: "text", id: "codeInput", class: "main-input", onInput: ev => this.handleChangeCode(ev), value: this.code })));
98
- }
99
- return (h("div", { class: "container" }, h("div", { class: "row row-validare" }, h("div", null, h("h1", { class: "text-center" }, this.title), errorBlock == null ? h("p", { class: "main-text font-size-2 mt-15 mb-20 text-center" }, this.details) : errorBlock), inputBlock, h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { id: "action", disabled: !this.canSend, class: "main-button", onClick: () => this.doAction() }, this.buttonText), h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText))))));
52
+ return (h("div", { class: "container" }, h("div", { class: "row row-validare" }, h("div", null, h("h1", { class: "text-center" }, this.title), errorBlock == null ? h("p", { class: "main-text font-size-2 mt-15 mb-20 text-center" }, this.details) : errorBlock), h("div", { class: "input-container mb-15" }, h("input", { type: "text", id: "codeInput", class: "main-input", onInput: ev => this.handleChangeCode(ev), value: this.code })), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { id: "action", disabled: !this.canSend, class: "main-button", onClick: () => this.doAction() }, this.buttonText), h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText))))));
100
53
  }
101
54
  static get is() { return "sms-code-validation"; }
102
55
  static get originalStyleUrls() {
@@ -114,9 +67,7 @@ export class SmsCodeValidation {
114
67
  "title": {},
115
68
  "details": {},
116
69
  "buttonText": {},
117
- "phoneNumber": {},
118
70
  "code": {},
119
- "prefilledPhone": {},
120
71
  "canSend": {}
121
72
  };
122
73
  }
@@ -0,0 +1,91 @@
1
+ import { h } from '@stencil/core';
2
+ import store from '../../../helpers/store';
3
+ import { FlowStatus } from '../../../models/FlowStatus';
4
+ import { FlowSteps } from '../../../models/FlowSteps';
5
+ import { BaseComponent } from '../../base-component';
6
+ import { Translations } from '../../../helpers/TranslationUtils';
7
+ export class SmsSend {
8
+ constructor() {
9
+ this.buttonText = undefined;
10
+ this.phoneNumber = undefined;
11
+ this.prefilledPhone = false;
12
+ this.canSend = false;
13
+ this.baseComponent = new BaseComponent(FlowSteps.OtpSend);
14
+ this.baseComponent.setEventEmitter(this.apiErrorEvent);
15
+ }
16
+ async doAction() {
17
+ try {
18
+ this.canSend = false;
19
+ var codeSent = await this.baseComponent.apiCall.SendOTPCode(store.requestId, this.phoneNumber);
20
+ if (codeSent.sent === true) {
21
+ store.flowStatus = FlowStatus[codeSent.status];
22
+ }
23
+ }
24
+ catch (e) {
25
+ this.apiErrorEvent.emit(e);
26
+ }
27
+ }
28
+ async disconnectedCallback() {
29
+ await this.baseComponent.finalize();
30
+ }
31
+ async componentWillRender() {
32
+ this.translations = await Translations.getValues();
33
+ this.buttonText = this.translations.PhoneValidationValues.Button;
34
+ if (store.phoneNumber && store.phoneNumber != '') {
35
+ this.phoneNumber = store.phoneNumber;
36
+ this.prefilledPhone = true;
37
+ this.canSend = true;
38
+ }
39
+ }
40
+ async componentDidLoad() {
41
+ await this.baseComponent.initialize();
42
+ }
43
+ handleChangePhone(ev) {
44
+ let value = ev.target ? ev.target.value : '';
45
+ this.phoneNumber = value.replace(/\D/g, '');
46
+ if (this.phoneNumber.length > 10)
47
+ this.phoneNumber = this.phoneNumber.substring(0, 10);
48
+ this.canSend = this.phoneNumber.length == 10;
49
+ ev.target.value = this.phoneNumber;
50
+ }
51
+ render() {
52
+ return (h("div", { class: "container" }, h("div", { class: "row row-validare" }, h("div", { class: "input-container mb-15" }, h("label", { class: "font-size-18 mb-1" }, h("b", null, this.translations.PhoneValidationValues.Label)), h("input", { type: "tel", id: "phoneInput", class: "main-input", disabled: this.prefilledPhone, onInput: ev => this.handleChangePhone(ev), value: this.phoneNumber })), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { id: "action", disabled: !this.canSend, class: "main-button", onClick: () => this.doAction() }, this.buttonText), h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText))))));
53
+ }
54
+ static get is() { return "sms-send"; }
55
+ static get originalStyleUrls() {
56
+ return {
57
+ "$": ["sms-send.css"]
58
+ };
59
+ }
60
+ static get styleUrls() {
61
+ return {
62
+ "$": ["sms-send.css"]
63
+ };
64
+ }
65
+ static get states() {
66
+ return {
67
+ "buttonText": {},
68
+ "phoneNumber": {},
69
+ "prefilledPhone": {},
70
+ "canSend": {}
71
+ };
72
+ }
73
+ static get events() {
74
+ return [{
75
+ "method": "apiErrorEvent",
76
+ "name": "apiError",
77
+ "bubbles": true,
78
+ "cancelable": true,
79
+ "composed": true,
80
+ "docs": {
81
+ "tags": [],
82
+ "text": ""
83
+ },
84
+ "complexType": {
85
+ "original": "any",
86
+ "resolved": "any",
87
+ "references": {}
88
+ }
89
+ }];
90
+ }
91
+ }