@ekyc_qoobiss/qbs-ect-cmp 1.5.19 → 1.5.21

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 (50) hide show
  1. package/README.md +4 -3
  2. package/dist/cjs/agreement-check_12.cjs.entry.js +11 -3
  3. package/dist/collection/components/identification-component/identification-component.js +11 -3
  4. package/dist/components/ApiCall.js +156 -0
  5. package/dist/components/Cameras.js +100 -0
  6. package/dist/components/agreement-check.d.ts +11 -0
  7. package/dist/components/agreement-check.js +6 -0
  8. package/dist/components/agreement-check2.js +45 -0
  9. package/dist/components/agreement-info.d.ts +11 -0
  10. package/dist/components/agreement-info.js +6 -0
  11. package/dist/components/agreement-info2.js +76 -0
  12. package/dist/components/camera-comp.d.ts +11 -0
  13. package/dist/components/camera-comp.js +6 -0
  14. package/dist/components/camera.js +4609 -0
  15. package/dist/components/capture-error.d.ts +11 -0
  16. package/dist/components/capture-error.js +6 -0
  17. package/dist/components/capture-error2.js +69 -0
  18. package/dist/components/end-redirect.d.ts +11 -0
  19. package/dist/components/end-redirect.js +6 -0
  20. package/dist/components/end-redirect2.js +37 -0
  21. package/dist/components/how-to-info.d.ts +11 -0
  22. package/dist/components/how-to-info.js +6 -0
  23. package/dist/components/how-to-info2.js +92 -0
  24. package/dist/components/id-back-capture.d.ts +11 -0
  25. package/dist/components/id-back-capture.js +6 -0
  26. package/dist/components/id-back-capture2.js +142 -0
  27. package/dist/components/id-capture.d.ts +11 -0
  28. package/dist/components/id-capture.js +6 -0
  29. package/dist/components/id-capture2.js +142 -0
  30. package/dist/components/identification-component.d.ts +11 -0
  31. package/dist/components/identification-component.js +411 -0
  32. package/dist/components/index.d.ts +34 -0
  33. package/dist/components/index.js +14 -0
  34. package/dist/components/landing-validation.d.ts +11 -0
  35. package/dist/components/landing-validation.js +6 -0
  36. package/dist/components/landing-validation2.js +61 -0
  37. package/dist/components/loader-dots.d.ts +11 -0
  38. package/dist/components/loader-dots.js +33 -0
  39. package/dist/components/selfie-capture.d.ts +11 -0
  40. package/dist/components/selfie-capture.js +6 -0
  41. package/dist/components/selfie-capture2.js +140 -0
  42. package/dist/components/sms-code-validation.d.ts +11 -0
  43. package/dist/components/sms-code-validation.js +6 -0
  44. package/dist/components/sms-code-validation2.js +98 -0
  45. package/dist/components/store.js +209 -0
  46. package/dist/components/textValues.js +84 -0
  47. package/dist/esm/agreement-check_12.entry.js +11 -3
  48. package/dist/qbs-ect-cmp/{p-82e35041.entry.js → p-d2c3c6ec.entry.js} +1 -1
  49. package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
  50. package/package.json +1 -1
package/README.md CHANGED
@@ -17,10 +17,11 @@ The wev compoment has to be included in the html markup like this:
17
17
  \*.html
18
18
 
19
19
  ```sh
20
- <identification-component token="{{ token }}" order_id="{{ orderId }}"></identification-component>
20
+ <identification-component token="{{ token }}" order_id="{{ orderId }}" api_url="{{ apiUrl }}"></identification-component>
21
21
  ```
22
22
 
23
- There are two parameters:
23
+ There are three parameters:
24
24
 
25
25
  - token - which is the token that was obtained using the API Key on the server side;
26
- - order_id - is a unique ID that will be used for the current identification request when obtaining the processed data from the REST API Service.
26
+ - order_id - is a unique ID that will be used for the current identification request when obtaining the processed data from the REST API Service;
27
+ - api_url - is the url provided to you by our team;
@@ -5777,13 +5777,21 @@ const IdentificationComponent = class {
5777
5777
  }
5778
5778
  }
5779
5779
  async componentWillLoad() {
5780
- state.token = this.token;
5781
- state.requestId = this.order_id;
5780
+ if (this.token) {
5781
+ state.token = this.token;
5782
+ }
5783
+ if (this.order_id) {
5784
+ state.requestId = this.order_id;
5785
+ sessionStorage.setItem(SessionKeys.RequestIdKey, state.requestId);
5786
+ }
5782
5787
  state.apiBaseUrl = this.api_url;
5783
5788
  await this.initializeRequest();
5784
5789
  }
5785
5790
  componentWillRender() {
5786
- state.requestId = sessionStorage.getItem(SessionKeys.RequestIdKey);
5791
+ var reqId = sessionStorage.getItem(SessionKeys.RequestIdKey);
5792
+ if (reqId) {
5793
+ state.requestId = reqId;
5794
+ }
5787
5795
  state.flowStatus = sessionStorage.getItem(SessionKeys.FlowStatusKey);
5788
5796
  if (!state.flowStatus) {
5789
5797
  state.flowStatus = 'LANDING';
@@ -197,13 +197,21 @@ export class IdentificationComponent {
197
197
  }
198
198
  }
199
199
  async componentWillLoad() {
200
- store.token = this.token;
201
- store.requestId = this.order_id;
200
+ if (this.token) {
201
+ store.token = this.token;
202
+ }
203
+ if (this.order_id) {
204
+ store.requestId = this.order_id;
205
+ sessionStorage.setItem(SessionKeys.RequestIdKey, store.requestId);
206
+ }
202
207
  store.apiBaseUrl = this.api_url;
203
208
  await this.initializeRequest();
204
209
  }
205
210
  componentWillRender() {
206
- store.requestId = sessionStorage.getItem(SessionKeys.RequestIdKey);
211
+ var reqId = sessionStorage.getItem(SessionKeys.RequestIdKey);
212
+ if (reqId) {
213
+ store.requestId = reqId;
214
+ }
207
215
  store.flowStatus = sessionStorage.getItem(SessionKeys.FlowStatusKey);
208
216
  if (!store.flowStatus) {
209
217
  store.flowStatus = 'LANDING';
@@ -0,0 +1,156 @@
1
+ import { s as state } from './store.js';
2
+
3
+ class ApiCall {
4
+ constructor() {
5
+ this.toBase64 = (file) => new Promise((resolve, reject) => {
6
+ const reader = new FileReader();
7
+ reader.readAsDataURL(file);
8
+ reader.onload = () => resolve(reader.result);
9
+ reader.onerror = error => reject(error);
10
+ });
11
+ }
12
+ async Post(url, data) {
13
+ try {
14
+ let resp = await fetch(state.apiBaseUrl + url, {
15
+ method: 'POST',
16
+ body: data,
17
+ headers: {
18
+ 'Content-Type': 'application/json',
19
+ 'Authorization': 'IDKYC-TOKEN ' + state.token,
20
+ // 'ApiKey': '2E1DF612-E9F3-4B8A-9154-5256E412D90C',
21
+ },
22
+ });
23
+ if (!resp.ok) {
24
+ return new Error(resp.statusText);
25
+ }
26
+ return await resp.json();
27
+ }
28
+ catch (err) {
29
+ console.log(err);
30
+ return err;
31
+ }
32
+ }
33
+ async Get(url) {
34
+ try {
35
+ let resp = await fetch(state.apiBaseUrl + url, {
36
+ method: 'GET',
37
+ headers: {
38
+ 'Content-Type': 'application/json',
39
+ 'Authorization': 'IDKYC-TOKEN ' + state.token,
40
+ // 'ApiKey': '2E1DF612-E9F3-4B8A-9154-5256E412D90C',
41
+ },
42
+ });
43
+ if (!resp.ok) {
44
+ return new Error(resp.statusText);
45
+ }
46
+ return await resp.json();
47
+ }
48
+ catch (err) {
49
+ console.log(err);
50
+ return err;
51
+ }
52
+ }
53
+ async SendOTPCode(requestId, phoneNumber) {
54
+ let data = { requestId: requestId, phone: phoneNumber };
55
+ let jsonResp = await this.Post('/validation/otp/send', JSON.stringify(data));
56
+ if (typeof jsonResp != 'boolean') {
57
+ return false;
58
+ }
59
+ return jsonResp;
60
+ }
61
+ async CheckOTPCode(requestId, otpCode) {
62
+ let data = { requestId: requestId, otp: otpCode };
63
+ let jsonResp = await this.Post('/validation/otp/check', JSON.stringify(data));
64
+ if (typeof jsonResp != 'boolean') {
65
+ return false;
66
+ }
67
+ return jsonResp;
68
+ }
69
+ async AddIdentificationRequest(requestId, deviceInfo) {
70
+ let data = { requestId: requestId, clientDeviceInfo: deviceInfo };
71
+ let jsonResp = await this.Post('/validation/identity/insert', JSON.stringify(data));
72
+ if (typeof jsonResp.hasIdBack == 'boolean') {
73
+ state.hasIdBack = jsonResp.hasIdBack;
74
+ return true;
75
+ }
76
+ else {
77
+ return false;
78
+ }
79
+ }
80
+ async UploadFileForRequestB64(requestId, type, file) {
81
+ let data = {
82
+ requestId: requestId,
83
+ type: type,
84
+ data: await this.toBase64(file),
85
+ };
86
+ let respJson = await this.Post('/validation/upload/capture', JSON.stringify(data));
87
+ if (respJson && respJson.file_path) {
88
+ if (type == 'IdFront') {
89
+ return respJson.isValid;
90
+ }
91
+ return true;
92
+ }
93
+ else {
94
+ return false;
95
+ }
96
+ }
97
+ async UploadFileForRequest(requestId, type, file) {
98
+ try {
99
+ let data = new FormData();
100
+ data.append('requestId', requestId);
101
+ data.append('type', type);
102
+ data.append('file', file);
103
+ let resp = await fetch(state.apiBaseUrl + '/validation/upload/file', {
104
+ method: 'POST',
105
+ body: data,
106
+ });
107
+ if (!resp.ok) {
108
+ console.log(resp.statusText);
109
+ return false;
110
+ }
111
+ let respJson = await resp.json();
112
+ if (respJson && respJson.file_path) {
113
+ if (type == 'IdFront') {
114
+ return respJson.isValid;
115
+ }
116
+ return true;
117
+ }
118
+ else {
119
+ return false;
120
+ }
121
+ }
122
+ catch (err) {
123
+ console.log(err);
124
+ return false;
125
+ }
126
+ }
127
+ async GetAgreement(agreementType) {
128
+ try {
129
+ let resp = await this.Get('/validation/agreement/content?type=' + agreementType + '&requestId=' + state.requestId);
130
+ if (resp) {
131
+ return resp.htmlText;
132
+ }
133
+ return '';
134
+ }
135
+ catch (err) {
136
+ console.log(err);
137
+ return '';
138
+ }
139
+ }
140
+ async GenerateAgreement(agreementType) {
141
+ try {
142
+ let data = { requestId: state.requestId, documentType: agreementType };
143
+ let resp = await this.Post('/validation/agreement/generate', JSON.stringify(data));
144
+ if (typeof resp != 'boolean') {
145
+ return false;
146
+ }
147
+ return resp;
148
+ }
149
+ catch (err) {
150
+ console.log(err);
151
+ return false;
152
+ }
153
+ }
154
+ }
155
+
156
+ export { ApiCall as A };
@@ -0,0 +1,100 @@
1
+ class Cameras {
2
+ async GetCameras(deviceInfo) {
3
+ var allDevices = [];
4
+ const devices = await navigator.mediaDevices.enumerateDevices();
5
+ const videoDevices = devices.filter(device => device.kind === 'videoinput');
6
+ for (const device of videoDevices) {
7
+ const updatedConstraints = this.GetConstraints(device.deviceId, deviceInfo);
8
+ const stream = await navigator.mediaDevices.getUserMedia(updatedConstraints);
9
+ stream.getVideoTracks().forEach(track => {
10
+ if (deviceInfo.isFirefox) {
11
+ const settings = track.getSettings();
12
+ let facingMode = settings.facingMode && settings.facingMode.length > 0 ? settings.facingMode[0] : '';
13
+ facingMode = facingMode === 'e' ? 'environment' : facingMode;
14
+ allDevices.push({
15
+ deviceId: device.deviceId,
16
+ name: device.label,
17
+ height: settings.height,
18
+ width: settings.width,
19
+ frameRate: Number(settings.frameRate.max),
20
+ torch: false,
21
+ recommended: false,
22
+ facingMode: facingMode,
23
+ });
24
+ }
25
+ else {
26
+ const capabilities = track.getCapabilities();
27
+ let facingMode = capabilities.facingMode && capabilities.facingMode.length > 0 ? capabilities.facingMode[0] : '';
28
+ facingMode = facingMode === 'e' ? 'environment' : facingMode;
29
+ allDevices.push({
30
+ deviceId: device.deviceId,
31
+ name: device.label,
32
+ height: capabilities.height.max,
33
+ width: capabilities.width.max,
34
+ frameRate: Number(capabilities.frameRate.max),
35
+ torch: capabilities.torch,
36
+ recommended: false,
37
+ facingMode: facingMode,
38
+ });
39
+ }
40
+ });
41
+ stream.getTracks().forEach(track => {
42
+ track.stop();
43
+ });
44
+ }
45
+ if (allDevices.length > 0) {
46
+ allDevices = allDevices.sort((a, b) => b.frameRate - a.frameRate);
47
+ var firstOption = allDevices.find(i => i.name.indexOf('0,') != -1 && i.facingMode === 'environment');
48
+ if (firstOption) {
49
+ allDevices[allDevices.indexOf(firstOption)].recommended = true;
50
+ }
51
+ else {
52
+ var firstEnv = allDevices.find(i => i.facingMode === 'environment');
53
+ if (firstEnv) {
54
+ allDevices[allDevices.indexOf(firstEnv)].recommended = true;
55
+ }
56
+ }
57
+ }
58
+ return allDevices;
59
+ }
60
+ GetConstraints(selectedDeviceId, device, portrait = false) {
61
+ let constraints = {
62
+ audio: false,
63
+ video: {
64
+ frameRate: 30
65
+ }
66
+ };
67
+ if (selectedDeviceId) {
68
+ constraints.video.deviceId = {
69
+ exact: selectedDeviceId,
70
+ };
71
+ }
72
+ if (device.isWin) {
73
+ constraints.video.width = { ideal: 1280 };
74
+ }
75
+ else {
76
+ if (portrait) {
77
+ constraints.video.facingMode = 'user';
78
+ constraints.video.width = { ideal: 1280 };
79
+ constraints.video.height = { ideal: 720 };
80
+ }
81
+ else {
82
+ constraints.video.facingMode = 'environment';
83
+ constraints.video.width = { ideal: 740 };
84
+ constraints.video.aspectRatio = 1;
85
+ }
86
+ }
87
+ return constraints;
88
+ }
89
+ GetRecommendedCamera(cameras) {
90
+ if (cameras && cameras.length > 0) {
91
+ var recommDevice = cameras.find(c => c.recommended);
92
+ if (recommDevice) {
93
+ return recommDevice;
94
+ }
95
+ }
96
+ return null;
97
+ }
98
+ }
99
+
100
+ export { Cameras as C };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface AgreementCheck extends Components.AgreementCheck, HTMLElement {}
4
+ export const AgreementCheck: {
5
+ prototype: AgreementCheck;
6
+ new (): AgreementCheck;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { A as AgreementCheck$1, d as defineCustomElement$1 } from './agreement-check2.js';
2
+
3
+ const AgreementCheck = AgreementCheck$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { AgreementCheck, defineCustomElement };
@@ -0,0 +1,45 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+ import { A as ApiCall } from './ApiCall.js';
3
+ import { A as AgreementCheckValues, a as AgreementInfoValues } from './textValues.js';
4
+
5
+ const agreementCheckCss = "";
6
+
7
+ const AgreementCheck = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
8
+ constructor() {
9
+ super();
10
+ this.__registerHost();
11
+ this.agreementAcceptance = createEvent(this, "agreementAcceptance", 7);
12
+ this.agreementType = undefined;
13
+ this.htmlContent = undefined;
14
+ this.apiCalls = new ApiCall();
15
+ }
16
+ async componentDidLoad() {
17
+ this.htmlContent = await this.apiCalls.GetAgreement(this.agreementType);
18
+ }
19
+ async buttonClick(result) {
20
+ this.agreementAcceptance.emit({ agreementType: this.agreementType, result });
21
+ }
22
+ render() {
23
+ let content = (h("div", { class: "container" }, h("div", { class: "row" }, h("div", { innerHTML: this.htmlContent }), h("div", { class: "pos-relative" }, h("div", { class: "d-flex two-buttons" }, h("button", { class: "normal-button red-button", onClick: () => this.buttonClick(false) }, AgreementCheckValues.ButtonNo), h("button", { class: "normal-button", onClick: () => this.buttonClick(true) }, AgreementCheckValues.ButtonYes)), h("p", { class: "main-text font-size-18 text-right mb-0" }, AgreementInfoValues.FooterText)))));
24
+ return this.htmlContent ? content : h("div", null);
25
+ }
26
+ static get style() { return agreementCheckCss; }
27
+ }, [0, "agreement-check", {
28
+ "agreementType": [1, "agreement-type"],
29
+ "htmlContent": [32]
30
+ }]);
31
+ function defineCustomElement() {
32
+ if (typeof customElements === "undefined") {
33
+ return;
34
+ }
35
+ const components = ["agreement-check"];
36
+ components.forEach(tagName => { switch (tagName) {
37
+ case "agreement-check":
38
+ if (!customElements.get(tagName)) {
39
+ customElements.define(tagName, AgreementCheck);
40
+ }
41
+ break;
42
+ } });
43
+ }
44
+
45
+ export { AgreementCheck as A, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface AgreementInfo extends Components.AgreementInfo, HTMLElement {}
4
+ export const AgreementInfo: {
5
+ prototype: AgreementInfo;
6
+ new (): AgreementInfo;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { A as AgreementInfo$1, d as defineCustomElement$1 } from './agreement-info2.js';
2
+
3
+ const AgreementInfo = AgreementInfo$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { AgreementInfo, defineCustomElement };
@@ -0,0 +1,76 @@
1
+ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
+ import { s as state } from './store.js';
3
+ import { a as AgreementInfoValues } from './textValues.js';
4
+ import { d as defineCustomElement$1 } from './agreement-check2.js';
5
+
6
+ const agreementInfoCss = "";
7
+
8
+ const AgreementInfo = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
9
+ constructor() {
10
+ super();
11
+ this.__registerHost();
12
+ this.agreementsChecked = undefined;
13
+ this.termsChecked = undefined;
14
+ this.openAgreements = undefined;
15
+ this.openTerms = undefined;
16
+ this.agreementsChecked = false;
17
+ this.termsChecked = false;
18
+ }
19
+ componentWillLoad() {
20
+ this.openAgreements = false;
21
+ this.openTerms = false;
22
+ }
23
+ buttonClick() {
24
+ if (this.agreementsChecked && this.termsChecked) {
25
+ state.flowStatus = 'PHONE';
26
+ }
27
+ }
28
+ agreementAcceptanceEmitted(data) {
29
+ if (data.detail.agreementType == 'agreement') {
30
+ this.agreementsChecked = data.detail.result;
31
+ this.openAgreements = false;
32
+ }
33
+ if (data.detail.agreementType == 'terms') {
34
+ this.termsChecked = data.detail.result;
35
+ this.openTerms = false;
36
+ }
37
+ }
38
+ agreementsClicked() {
39
+ this.openAgreements = true;
40
+ }
41
+ termsClicked() {
42
+ this.openTerms = true;
43
+ }
44
+ render() {
45
+ let agreementsCheck = h("agreement-check", { agreementType: "agreement" });
46
+ let termsCheck = h("agreement-check", { agreementType: "terms" });
47
+ let mainComp = (h("div", { class: "container" }, h("div", { class: "row" }, h("div", null, h("h1", null, AgreementInfoValues.Title), h("div", { class: "d-flex space-between align-center" }, h("h3", { class: "main-text font-size-2", onClick: () => this.agreementsClicked() }, h("input", { type: "checkbox", readOnly: true, checked: this.agreementsChecked }), AgreementInfoValues.Agreement)), h("div", { class: "d-flex space-between align-center" }, h("h3", { class: "main-text font-size-2", onClick: () => this.termsClicked() }, h("input", { type: "checkbox", readOnly: true, checked: this.termsChecked }), AgreementInfoValues.Terms))), h("div", { class: "pos-relative" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", onClick: () => this.buttonClick() }, AgreementInfoValues.Button), h("p", { class: "main-text font-size-18 text-right mb-0" }, AgreementInfoValues.FooterText))))));
48
+ return this.openAgreements ? agreementsCheck : this.openTerms ? termsCheck : mainComp;
49
+ }
50
+ static get style() { return agreementInfoCss; }
51
+ }, [0, "agreement-info", {
52
+ "agreementsChecked": [32],
53
+ "termsChecked": [32],
54
+ "openAgreements": [32],
55
+ "openTerms": [32]
56
+ }, [[0, "agreementAcceptance", "agreementAcceptanceEmitted"]]]);
57
+ function defineCustomElement() {
58
+ if (typeof customElements === "undefined") {
59
+ return;
60
+ }
61
+ const components = ["agreement-info", "agreement-check"];
62
+ components.forEach(tagName => { switch (tagName) {
63
+ case "agreement-info":
64
+ if (!customElements.get(tagName)) {
65
+ customElements.define(tagName, AgreementInfo);
66
+ }
67
+ break;
68
+ case "agreement-check":
69
+ if (!customElements.get(tagName)) {
70
+ defineCustomElement$1();
71
+ }
72
+ break;
73
+ } });
74
+ }
75
+
76
+ export { AgreementInfo as A, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface CameraComp extends Components.CameraComp, HTMLElement {}
4
+ export const CameraComp: {
5
+ prototype: CameraComp;
6
+ new (): CameraComp;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { C as Camera, d as defineCustomElement$1 } from './camera.js';
2
+
3
+ const CameraComp = Camera;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { CameraComp, defineCustomElement };