@gataca/qr 0.0.21 → 0.0.22
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/gat-icon-alert-0ad19b26.js +14 -0
- package/dist/cjs/gataca-autoqr.cjs.entry.js +106 -0
- package/dist/cjs/gataca-qr_2.cjs.entry.js +295 -0
- package/dist/cjs/gataca-qrws.cjs.entry.js +252 -0
- package/dist/cjs/gataca-ssibutton_2.cjs.entry.js +317 -0
- package/dist/cjs/gatacaqr.cjs.js +19 -0
- package/dist/cjs/index-93d47a75.js +1469 -0
- package/dist/cjs/index.cjs.js +16 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/qr-code-styling-412bbc7a.js +28 -0
- package/dist/cjs/utils-ef28b844.js +27 -0
- package/dist/collection/assets/icons/gat-icon-alert.svg +5 -0
- package/dist/collection/assets/icons/gat-icon-check.svg +5 -0
- package/dist/collection/assets/icons/gat-icon-refresh.svg +4 -0
- package/dist/collection/assets/images/logo_gataca.svg +7 -0
- package/dist/collection/collection-manifest.json +17 -0
- package/dist/collection/components/gataca-autoqr/gataca-autoqr.css +116 -0
- package/dist/collection/components/gataca-autoqr/gataca-autoqr.js +347 -0
- package/dist/collection/components/gataca-qr/components/qr/QR.js +5 -0
- package/dist/collection/components/gataca-qr/components/readQR/ReadQR.js +11 -0
- package/dist/collection/components/gataca-qr/components/readQR/components/AnimatedLoader.js +4 -0
- package/dist/collection/components/gataca-qr/components/retryButton/RetryButton.js +13 -0
- package/dist/collection/components/gataca-qr/components/success/Success.js +8 -0
- package/dist/collection/components/gataca-qr/gataca-qr.css +399 -0
- package/dist/collection/components/gataca-qr/gataca-qr.js +988 -0
- package/dist/collection/components/gataca-qrdisplay/gataca-qrdisplay.js +178 -0
- package/dist/collection/components/gataca-qrws/components/qr/QR.js +5 -0
- package/dist/collection/components/gataca-qrws/components/readQR/ReadQR.js +11 -0
- package/dist/collection/components/gataca-qrws/components/readQR/components/AnimatedLoader.js +4 -0
- package/dist/collection/components/gataca-qrws/components/retryButton/RetryButton.js +13 -0
- package/dist/collection/components/gataca-qrws/components/success/Success.js +8 -0
- package/dist/collection/components/gataca-qrws/gataca-qrws.css +400 -0
- package/dist/collection/components/gataca-qrws/gataca-qrws.js +997 -0
- package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.css +116 -0
- package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.js +981 -0
- package/dist/collection/components/gataca-ssibuttonws/gataca-ssibuttonws.css +116 -0
- package/dist/collection/components/gataca-ssibuttonws/gataca-ssibuttonws.js +434 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/utils/index.js +1 -0
- package/dist/collection/utils/utils.js +22 -0
- package/dist/components/gat-icon-alert.js +30 -0
- package/dist/components/gataca-autoqr.js +163 -0
- package/dist/components/gataca-qr.js +6 -0
- package/dist/components/gataca-qr2.js +310 -0
- package/dist/components/gataca-qrdisplay.js +6 -0
- package/dist/components/gataca-qrdisplay2.js +95 -0
- package/dist/components/gataca-qrws.js +6 -0
- package/dist/components/gataca-qrws2.js +311 -0
- package/dist/components/gataca-ssibutton.js +6 -0
- package/dist/{gatacaqr/gataca-ssibutton.entry.js → components/gataca-ssibutton2.js} +80 -10
- package/dist/components/gataca-ssibuttonws.js +6 -0
- package/dist/{gatacaqr/gataca-ssibuttonws.entry.js → components/gataca-ssibuttonws2.js} +56 -8
- package/dist/components/index.js +8 -0
- package/dist/{gatacaqr/gat-icon-alert-13a1894e.js → esm/gat-icon-alert-7b06ef3a.js} +3 -1
- package/dist/{gatacaqr → esm}/gataca-autoqr.entry.js +6 -5
- package/dist/{gatacaqr/gataca-qr.entry.js → esm/gataca-qr_2.entry.js} +52 -11
- package/dist/{gatacaqr → esm}/gataca-qrws.entry.js +8 -8
- package/dist/esm/gataca-ssibutton_2.entry.js +312 -0
- package/dist/esm/gatacaqr.js +17 -0
- package/dist/esm/index-2be54f32.js +1443 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/qr-code-styling-0eeb38d5.js +26 -0
- package/dist/gatacaqr/gatacaqr.esm.js +1 -129
- package/dist/gatacaqr/index.esm.js +1 -1
- package/dist/gatacaqr/p-0be4566d.js +1 -0
- package/dist/gatacaqr/p-2cd7b062.js +1 -0
- package/dist/gatacaqr/p-5ae5f952.js +2 -0
- package/dist/gatacaqr/p-5e81ab9e.entry.js +1 -0
- package/dist/gatacaqr/p-92a2e6f0.entry.js +1 -0
- package/dist/gatacaqr/p-9af5d2fe.entry.js +1 -0
- package/dist/gatacaqr/p-dc592fa5.entry.js +1 -0
- package/dist/gatacaqr/p-ea783014.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/gataca-autoqr/gataca-autoqr.d.ts +6 -0
- package/dist/types/components/gataca-qr/components/qr/QR.d.ts +2 -0
- package/dist/types/components/gataca-qr/gataca-qr.d.ts +6 -0
- package/dist/types/components/gataca-qrdisplay/gataca-qrdisplay.d.ts +6 -0
- package/dist/types/components/gataca-qrws/components/qr/QR.d.ts +2 -0
- package/dist/types/components/gataca-qrws/gataca-qrws.d.ts +6 -0
- package/dist/types/components/gataca-ssibutton/gataca-ssibutton.d.ts +6 -0
- package/dist/types/components/gataca-ssibuttonws/gataca-ssibuttonws.d.ts +6 -0
- package/dist/types/components.d.ts +49 -0
- package/package.json +1 -1
- package/dist/gatacaqr/app-globals-0f993ce5.js +0 -3
- package/dist/gatacaqr/css-shim-8eec97b3.js +0 -4
- package/dist/gatacaqr/dom-1b0cf05d.js +0 -73
- package/dist/gatacaqr/gataca-qrdisplay-55780157.js +0 -97
- package/dist/gatacaqr/gataca-qrdisplay.entry.js +0 -2
- package/dist/gatacaqr/index-4bc6f36b.js +0 -3262
- package/dist/gatacaqr/shadow-css-146f2f6f.js +0 -387
- /package/dist/{gatacaqr → esm}/utils-63e7a33b.js +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const logoGatacaSvg = 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDc2IDcxIiB3aWR0aD0iNzEiIGhlaWdodD0iNjYiPgoJPHRpdGxlPlZlY3RvciAoMyktc3ZnPC90aXRsZT4KCTxzdHlsZT4KCQkuczAgeyBmaWxsOiAjNDc0NWI3IH0gCgk8L3N0eWxlPgoJPHBhdGggaWQ9IkxheWVyIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsYXNzPSJzMCIgZD0ibTcyLjIgMzguNGMyLjIgMy4zIDMuNSA3LjIgMy41IDExLjQgMCAxMS4yLTguOCAyMC4yLTE5LjkgMjAuN3EtMC40IDAtMC44IDBjLTMgMC01LjgtMC42LTguNC0xLjdxLTIuMS0xLTMuOC0yLjMtMS4xLTAuOC0yLjEtMS43LTEuMy0xLjItMi4zLTIuNi0wLjUgMC42LTEgMS4yYy0zLjggNC40LTkuNCA3LjEtMTUuNyA3LjEtNi43IDAtMTIuNi0zLjItMTYuNC04LjEtMi43LTMuNS00LjMtNy44LTQuMy0xMi42IDAtMTAuNiA4LTE5LjMgMTguMy0yMC41LTEuMS0yLjUtMS43LTUuMi0xLjctOC4xIDAtMTEuNSA5LjMtMjAuNyAyMC44LTIwLjcgMTAuMiAwIDE4LjcgNy40IDIwLjQgMTcuMnEwLjMgMS43IDAuMyAzLjVjMCAyLjktMC42IDUuNi0xLjcgOC4xIDYuMiAwLjcgMTEuNiA0LjIgMTQuOCA5LjF6bS00NC43LTIzLjVjLTMuNCA2LTEuNCAxMy41IDQuNSAxN3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M0MzkgMjIuNDQ4OCAxOC45OTQ3QzIyLjQ0NzggMTguNjQ1NSAyMi4zNTU0IDE4LjMwMjYgMjIuMTgwOCAxOC4wMDAyTDEzLjcxMDggMy44NjAyQzEzLjUzMjUgMy41NjYzMSAxMy4yODE1IDMuMzIzMzIgMTIuOTgxOSAzLjE1NDY5QzEyLjY4MjQgMi45ODYwNSAxMi4zNDQ1IDIuODk3NDYgMTIuMDAwOCAyLjg5NzQ2QzExLjY1NyAyLjg5NzQ2IDExLjMxOTEgMi45ODYwNSAxMS4wMTk2IDMuMTU0NjlDMTAuNzIgMy4zMjMzMiAxMC40NjkgMy41NjYzMSAxMC4yOTA4IDMuODYwMlYzLjg2MDJaIiBzdHJva2U9IiNDRDJCMzEiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CjxwYXRoIGQ9Ik0xMiA5VjEzIiBzdHJva2U9IiNDRDJCMzEiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CjxwYXRoIGQ9Ik0xMiAxN0gxMi4wMSIgc3Ryb2tlPSIjQ0QyQjMxIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K';
|
|
10
|
+
|
|
11
|
+
exports.gatIconAlertSvg = gatIconAlertSvg;
|
|
12
|
+
exports.gatIconCheckSvg = gatIconCheckSvg;
|
|
13
|
+
exports.gatIconRefreshSvg = gatIconRefreshSvg;
|
|
14
|
+
exports.logoGatacaSvg = logoGatacaSvg;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-93d47a75.js');
|
|
6
|
+
|
|
7
|
+
const gatacaAutoqrCss = "@import url(\"https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap\"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:\"\";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.buttonContainer{display:inline-block;text-align:right;padding:10px;position:relative}.gatacaButtonWrapper{margin:8px}.gatacaButtonWrapper .gatacaButton{display:flex;min-width:100px;padding:8px 8px;background-color:white;font-size:12px;font-family:\"Work Sans\", sans-serif;letter-spacing:1px;font-weight:2;justify-content:space-between;align-items:center;border-radius:6px;border:1px solid rgba(24, 27, 94, 0.5);color:rgba(24, 27, 94, 0.8);box-shadow:0px 1px 3px rgba(48, 48, 48, 0.15);cursor:pointer}.gatacaButtonWrapper .gatacaButton>span{margin-right:10px}.gatacaButtonWrapper .gatacaButton:hover{box-shadow:0px 2px 8px rgba(48, 48, 48, 0.1)}.gatacaButtonWrapper .buttonText{text-align:right;font-size:8px;color:rgba(24, 27, 94, 0.5);font-family:\"Helvetica Neue\", sans-serif;letter-spacing:1px;padding-right:8px;font-weight:1}.gatacaButtonWrapper .buttonImg{height:25px;width:25px;margin:0;margin-right:20px}";
|
|
8
|
+
|
|
9
|
+
const DEFAULT_REPOSITORY = "https://studio.gataca.io/api/v1/qrconfigs";
|
|
10
|
+
const fixFunctions = (data) => {
|
|
11
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12
|
+
data.errorCallback = deserializeFunction((_a = data.errorCallback) === null || _a === void 0 ? void 0 : _a.toString());
|
|
13
|
+
data.successCallback = deserializeFunction((_b = data.successCallback) === null || _b === void 0 ? void 0 : _b.toString());
|
|
14
|
+
data.wsOnMessage = deserializeFunction((_c = data.wsOnMessage) === null || _c === void 0 ? void 0 : _c.toString());
|
|
15
|
+
data.wsOnOpen = deserializeFunction((_d = data.wsOnOpen) === null || _d === void 0 ? void 0 : _d.toString());
|
|
16
|
+
data.checkStatus = deserializeFunction((_e = data.checkStatus) === null || _e === void 0 ? void 0 : _e.toString());
|
|
17
|
+
data.createSession = deserializeFunction((_f = data.createSession) === null || _f === void 0 ? void 0 : _f.toString());
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
const deserializeFunction = (data) => {
|
|
21
|
+
if (data) {
|
|
22
|
+
return new Function("return " + data)();
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
};
|
|
26
|
+
const GatacaAutoQR = class {
|
|
27
|
+
constructor(hostRef) {
|
|
28
|
+
index.registerInstance(this, hostRef);
|
|
29
|
+
this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7);
|
|
30
|
+
this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7);
|
|
31
|
+
this.configId = undefined;
|
|
32
|
+
this.qrType = "svg";
|
|
33
|
+
this.configRepository = DEFAULT_REPOSITORY;
|
|
34
|
+
this.successCallback = undefined;
|
|
35
|
+
this.errorCallback = undefined;
|
|
36
|
+
this.checkStatus = undefined;
|
|
37
|
+
this.createSession = undefined;
|
|
38
|
+
this.wsOnOpen = undefined;
|
|
39
|
+
this.wsOnMessage = undefined;
|
|
40
|
+
this.config = undefined;
|
|
41
|
+
this.loading = undefined;
|
|
42
|
+
this.loading = true;
|
|
43
|
+
fetch(this.configRepository + "/" + this.configId, {
|
|
44
|
+
method: "GET",
|
|
45
|
+
headers: {
|
|
46
|
+
"Content-Type": "application/json",
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
.then((response) => {
|
|
50
|
+
response
|
|
51
|
+
.json()
|
|
52
|
+
.then((data) => {
|
|
53
|
+
data = fixFunctions(data);
|
|
54
|
+
this.config = data;
|
|
55
|
+
this.loading = false;
|
|
56
|
+
})
|
|
57
|
+
.catch((err) => {
|
|
58
|
+
console.log("Cannot retrieve selected config", err);
|
|
59
|
+
this.loading = false;
|
|
60
|
+
});
|
|
61
|
+
})
|
|
62
|
+
.catch((err) => {
|
|
63
|
+
console.log("Cannot retrieve selected config", err);
|
|
64
|
+
this.loading = false;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Retrieve manually the session data on a successful login
|
|
69
|
+
*/
|
|
70
|
+
async getSessionData() {
|
|
71
|
+
return this.qr.getSessionData();
|
|
72
|
+
}
|
|
73
|
+
selectQR() {
|
|
74
|
+
if (this.config.useButton) {
|
|
75
|
+
if (this.config.useWs) {
|
|
76
|
+
this.qr = (index.h("gataca-ssibuttonws", { buttonText: this.config.buttonText, wsOnMessage: this.wsOnMessage || this.config.wsOnMessage, wsOnOpen: this.wsOnOpen || this.config.wsOnOpen, successCallback: this.successCallback || this.config.successCallback, errorCallback: this.errorCallback || this.config.errorCallback, qrType: this.qrType, qrRole: this.config.qrRole, callbackServer: this.config.callbackServer, sessionTimeout: this.config.sessionTimeout, socketEndpoint: this.config.socketEndpoint, autostart: true, autorefresh: this.config.autorefresh, v: this.config.v, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this.qr = (index.h("gataca-ssibutton", { buttonText: this.config.buttonText, checkStatus: this.checkStatus || this.config.checkStatus, createSession: this.createSession || this.config.createSession, successCallback: this.successCallback || this.config.successCallback, errorCallback: this.errorCallback || this.config.errorCallback, qrType: this.qrType, qrRole: this.config.qrRole, callbackServer: this.config.callbackServer, sessionTimeout: this.config.sessionTimeout, pollingFrequency: this.config.pollingFrequency, autorefresh: this.config.autorefresh, v: this.config.v, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
if (this.config.useWs) {
|
|
84
|
+
this.qr = (index.h("gataca-qrws", { wsOnMessage: this.wsOnMessage || this.config.wsOnMessage, wsOnOpen: this.wsOnOpen || this.config.wsOnOpen, successCallback: this.successCallback || this.config.successCallback, qrType: this.qrType, errorCallback: this.errorCallback || this.config.errorCallback, qrRole: this.config.qrRole, callbackServer: this.config.callbackServer, sessionTimeout: this.config.sessionTimeout, socketEndpoint: this.config.socketEndpoint, autostart: this.config.autostart, autorefresh: this.config.autorefresh, v: this.config.v, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
this.qr = (index.h("gataca-qr", { checkStatus: this.checkStatus || this.config.checkStatus, createSession: this.createSession || this.config.createSession, successCallback: this.successCallback || this.config.successCallback, qrType: this.qrType, errorCallback: this.errorCallback || this.config.errorCallback, qrRole: this.config.qrRole, callbackServer: this.config.callbackServer, sessionTimeout: this.config.sessionTimeout, pollingFrequency: this.config.pollingFrequency, autostart: this.config.autostart, autorefresh: this.config.autorefresh, v: this.config.v, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
render() {
|
|
92
|
+
if (this.loading) {
|
|
93
|
+
//TODO: Improve loading message
|
|
94
|
+
return index.h("div", null, "Loading...");
|
|
95
|
+
}
|
|
96
|
+
if (this.config) {
|
|
97
|
+
this.selectQR();
|
|
98
|
+
return this.qr;
|
|
99
|
+
}
|
|
100
|
+
//TODO: Improve error message
|
|
101
|
+
return index.h("div", null, "Error loading your config...");
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
GatacaAutoQR.style = gatacaAutoqrCss;
|
|
105
|
+
|
|
106
|
+
exports.gataca_autoqr = GatacaAutoQR;
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-93d47a75.js');
|
|
6
|
+
const gatIconAlert = require('./gat-icon-alert-0ad19b26.js');
|
|
7
|
+
const qrCodeStyling = require('./qr-code-styling-412bbc7a.js');
|
|
8
|
+
const utils = require('./utils-ef28b844.js');
|
|
9
|
+
|
|
10
|
+
const GatacaQRDisplay = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.qrData = undefined;
|
|
14
|
+
this.qrType = "svg";
|
|
15
|
+
this.size = 256;
|
|
16
|
+
this.logoSize = 0;
|
|
17
|
+
this.logoSrc = undefined;
|
|
18
|
+
this.qrColor = "#1E1E20";
|
|
19
|
+
this.rounded = true;
|
|
20
|
+
}
|
|
21
|
+
componentDidLoad() {
|
|
22
|
+
const qrCode = new qrCodeStyling.QRCodeStyling({
|
|
23
|
+
data: this.qrData,
|
|
24
|
+
width: this.size,
|
|
25
|
+
height: this.size,
|
|
26
|
+
image: this.logoSize > 0 ? this.logoSrc || gatIconAlert.logoGatacaSvg : undefined,
|
|
27
|
+
margin: 10,
|
|
28
|
+
type: this.qrType,
|
|
29
|
+
dotsOptions: {
|
|
30
|
+
color: this.qrColor,
|
|
31
|
+
type: this.rounded ? "dots" : "square",
|
|
32
|
+
},
|
|
33
|
+
cornersSquareOptions: {
|
|
34
|
+
type: this.rounded ? "extra-rounded" : "square",
|
|
35
|
+
},
|
|
36
|
+
cornersDotOptions: {
|
|
37
|
+
type: this.rounded ? "dot" : "square",
|
|
38
|
+
},
|
|
39
|
+
imageOptions: {
|
|
40
|
+
margin: 2,
|
|
41
|
+
imageSize: this.logoSize,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
qrCode.append(this.qr);
|
|
45
|
+
}
|
|
46
|
+
render() {
|
|
47
|
+
return (index.h("div", { ref: (el) => {
|
|
48
|
+
this.qr = el;
|
|
49
|
+
} }));
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const Success = (props) => {
|
|
54
|
+
const { modalHeight, successLoginLabel } = props;
|
|
55
|
+
return (index.h("div", { class: "success", style: {
|
|
56
|
+
height: modalHeight ? (modalHeight === null || modalHeight === void 0 ? void 0 : modalHeight.toString()) + "px" : "300px",
|
|
57
|
+
} },
|
|
58
|
+
index.h("img", { src: gatIconAlert.gatIconCheckSvg, height: 52, width: 52 }),
|
|
59
|
+
index.h("p", { class: "successMsg" }, successLoginLabel)));
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const RetryButton = (props) => {
|
|
63
|
+
var _a;
|
|
64
|
+
const { errorMessage, modalWidth, clickInsideBoxLabel, refreshQrLabel, scanQrLabel, waitingStartSessionLabel, display, renderRetryQR, } = props;
|
|
65
|
+
return (index.h("div", { class: "reload", style: {
|
|
66
|
+
width: (modalWidth - 48).toString() + "px",
|
|
67
|
+
height: modalWidth ? ((_a = (modalWidth - 48)) === null || _a === void 0 ? void 0 : _a.toString()) + "px" : "",
|
|
68
|
+
} },
|
|
69
|
+
index.h("div", { id: "notify", onClick: () => display() },
|
|
70
|
+
index.h("img", { src: gatIconAlert.gatIconRefreshSvg, height: 24, width: 24 }),
|
|
71
|
+
index.h("p", { class: "notify-text" },
|
|
72
|
+
clickInsideBoxLabel,
|
|
73
|
+
" "),
|
|
74
|
+
errorMessage ? (index.h("p", { class: "notify-text bold" }, refreshQrLabel)) : (index.h("p", { class: "notify-text bold" }, scanQrLabel)),
|
|
75
|
+
errorMessage && (index.h("div", { class: "alert", style: {
|
|
76
|
+
width: (modalWidth - 48).toString() + "px",
|
|
77
|
+
} },
|
|
78
|
+
index.h("img", { src: gatIconAlert.gatIconAlertSvg, height: 24, width: 24 }),
|
|
79
|
+
index.h("p", null, errorMessage)))),
|
|
80
|
+
index.h("div", { id: "qrwait" }, renderRetryQR(waitingStartSessionLabel))));
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const AnimatedLoader = () => {
|
|
84
|
+
return (index.h("div", { class: "containerLoader" },
|
|
85
|
+
index.h("div", { class: "loader" },
|
|
86
|
+
index.h("div", { class: "loader__item loader__item__1" }),
|
|
87
|
+
index.h("div", { class: "loader__item loader__item__2" }),
|
|
88
|
+
index.h("div", { class: "loader__item loader__item__3" }),
|
|
89
|
+
index.h("div", { class: "loader__item loader__item__4" }),
|
|
90
|
+
index.h("div", { class: "loader__item loader__item__5" }),
|
|
91
|
+
index.h("div", { class: "loader__item loader__item__6" }),
|
|
92
|
+
index.h("div", { class: "loader__item loader__item__7" }),
|
|
93
|
+
index.h("div", { class: "loader__item loader__item__8" }))));
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const ReadQR = (props) => {
|
|
97
|
+
var _a;
|
|
98
|
+
const { modalWidth, readQrMessages, renderQR, url, sizeQR } = props;
|
|
99
|
+
return (index.h("div", { class: "blured", style: {
|
|
100
|
+
width: (modalWidth - 48).toString() + "px",
|
|
101
|
+
height: modalWidth ? ((_a = (modalWidth - 48)) === null || _a === void 0 ? void 0 : _a.toString()) + "px" : "",
|
|
102
|
+
} },
|
|
103
|
+
index.h("div", { id: "notify" },
|
|
104
|
+
index.h(AnimatedLoader, null),
|
|
105
|
+
index.h("p", { class: "notify-text" }, readQrMessages === null || readQrMessages === void 0 ? void 0 :
|
|
106
|
+
readQrMessages.title,
|
|
107
|
+
" "),
|
|
108
|
+
index.h("p", { class: "notify-text bold" }, readQrMessages === null || readQrMessages === void 0 ? void 0 : readQrMessages.description)),
|
|
109
|
+
index.h("div", { id: "qrwait" }, renderQR(url, false, sizeQR))));
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const QR = (props) => {
|
|
113
|
+
const { value, useLogo, logoSrc, size, qrType } = props;
|
|
114
|
+
return (index.h("gataca-qrdisplay", { qrData: value, rounded: true, qrType: qrType, size: size, "logo-size": useLogo ? 0.33 : 0, "logo-src": logoSrc }));
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const gatacaQrCss = "@import url(\"https://fonts.googleapis.com/css2?family=Ubuntu:wght@100;300;400;500;600;700&display=swap\"); @import url(\"https://fonts.googleapis.com/css2?family=Poppins:wght@100;300;400;500;600;700&display=swap\"); @import url(\"https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap\"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:\"\";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.brandSection{padding-top:5px;display:flex;align-items:center}.brandSection .gatacaImgSmall{height:13px;width:13px;margin:0;margin-right:10px}.popUpContainer .large-modal{width:300px;min-height:350px}.popUpContainer .modal-window{position:relative;border-radius:6px;overflow:hidden;color:rgba(24, 27, 94, 0.8);box-shadow:0px 3px 10px rgba(48, 48, 48, 0.1);display:flex;flex-direction:column;justify-content:space-between;align-items:center;display:flex;z-index:1001;padding:1px;background-color:white;border-radius:12px;-webkit-transition:opacity 0.5s, visibility 0s 0.5s;transition:opacity 0.5s, visibility 0s 0.5s;visibility:hidden;opacity:0}.popUpContainer .modal-window__content{width:100%;height:100%;text-align:left}.popUpContainer .modal-window__content .hidenText{display:none}.popUpContainer .modal-window .modalText{font-family:\"Ubuntu\", \"Work Sans\", \"Helvetica Neue\", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px;margin-top:10px;letter-spacing:1px}.popUpContainer .modal-window .qrTitleContainer{padding:14px 24px;padding-bottom:0px}.popUpContainer .modal-window .qrTitle{font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .modal-window .qrDescription{font-family:\"Poppins\", \"Ubuntu\", \"Work Sans\", \"Helvetica Neue\", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074}.popUpContainer .modal-window .bold{font-weight:700}.popUpContainer .modal-window .qrBrand{margin-top:4px;font-size:14px;font-weight:400;line-height:16.5px;display:flex;align-items:center}.popUpContainer .modal-window .qrBrand img{margin-left:5px;height:12px}.popUpContainer .modal-window .qr-section{width:252px;height:252px}.popUpContainer .noBoxShadow{box-shadow:none}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}.success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.success>img{padding-bottom:12px}.success>.successMsg{line-height:23.5px;color:var(--neutral-1000, #1e1e20);text-align:center;font-family:\"Ubuntu\", \"Work Sans\", \"Helvetica Neue\", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px}.reload,.blured{height:252px;width:252px;border:1px dashed #a1a1a1;border-radius:12px;position:relative;top:24px;margin:0 24px 24px;display:flex;overflow:hidden;justify-content:center;align-items:center}#qrwait{display:flex;justify-content:center}#qrwait,#notify{width:100%;height:100%;top:0;left:0;border-radius:20px}#notify{z-index:10;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;display:flex;flex-direction:column;box-sizing:border-box;padding:20px;background:rgba(255, 255, 255, 0.95)}#notify>img{padding-bottom:12px}.alert{display:flex;flex-direction:row;justify-content:start;width:252px;position:absolute;bottom:0px;border:1px solid #ee888c;background:#ffdedf;border-radius:11px;box-sizing:border-box;padding:12px;align-items:center;gap:12px}.alert>img{margin:0}.alert>p{font-family:\"Poppins\", \"Ubuntu\", \"Work Sans\", \"Helvetica Neue\", sans-serif;font-size:14px;font-style:normal;font-weight:400;margin-top:0;line-height:16px;color:#1e1e20}.notify-text{font-family:\"Poppins\", \"Ubuntu\", \"Work Sans\", \"Helvetica Neue\", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074;text-align:center}.containerLoader{display:flex;justify-content:center;align-items:center;width:30px;height:30px;margin-bottom:12px}.loader{position:relative;margin-left:0 !important}.loader__item{position:absolute;width:9.68px;height:4px;background:transparent;border-radius:2px}.loader__item__1{transform:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-webkit-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-moz-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-o-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);animation:blink 0.8333333333s linear 0.1041666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.1041666667s infinite;-moz-animation:blink 0.8333333333s linear 0.1041666667s infinite;-o-animation:blink 0.8333333333s linear 0.1041666667s infinite}.loader__item__2{transform:translate(-4.84px, 8.5px) rotate(90deg);-webkit-animation:translate(-4.84px, 8.5px) rotate(90deg);-moz-animation:translate(-4.84px, 8.5px) rotate(90deg);-o-animation:translate(-4.84px, 8.5px) rotate(90deg);animation:blink 0.8333333333s linear 0.2083333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.2083333333s infinite;-moz-animation:blink 0.8333333333s linear 0.2083333333s infinite;-o-animation:blink 0.8333333333s linear 0.2083333333s infinite}.loader__item__3{transform:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-webkit-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-moz-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-o-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);animation:blink 0.8333333333s linear 0.3125s infinite;-webkit-animation:blink 0.8333333333s linear 0.3125s infinite;-moz-animation:blink 0.8333333333s linear 0.3125s infinite;-o-animation:blink 0.8333333333s linear 0.3125s infinite}.loader__item__4{transform:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-webkit-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-moz-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-o-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);animation:blink 0.8333333333s linear 0.4166666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.4166666667s infinite;-moz-animation:blink 0.8333333333s linear 0.4166666667s infinite;-o-animation:blink 0.8333333333s linear 0.4166666667s infinite}.loader__item__5{transform:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-webkit-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-moz-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-o-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);animation:blink 0.8333333333s linear 0.5208333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.5208333333s infinite;-moz-animation:blink 0.8333333333s linear 0.5208333333s infinite;-o-animation:blink 0.8333333333s linear 0.5208333333s infinite}.loader__item__6{transform:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-webkit-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-moz-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-o-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);animation:blink 0.8333333333s linear 0.625s infinite;-webkit-animation:blink 0.8333333333s linear 0.625s infinite;-moz-animation:blink 0.8333333333s linear 0.625s infinite;-o-animation:blink 0.8333333333s linear 0.625s infinite}.loader__item__7{transform:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-webkit-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-moz-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-o-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);animation:blink 0.8333333333s linear 0.7291666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.7291666667s infinite;-moz-animation:blink 0.8333333333s linear 0.7291666667s infinite;-o-animation:blink 0.8333333333s linear 0.7291666667s infinite}.loader__item__8{transform:translate(5.6631628524px, -1.99913122px) rotate(360deg);-webkit-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);-moz-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);-o-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);animation:blink 0.8333333333s linear 0.8333333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.8333333333s infinite;-moz-animation:blink 0.8333333333s linear 0.8333333333s infinite;-o-animation:blink 0.8333333333s linear 0.8333333333s infinite}.loader__item__8{max-width:8.5px}@keyframes blink{0%{background:#4745B7}100%{background:#CCCBF8}}@keyframes rotate{0%{transform:rotate(0deg)}100%{background:rotate(360deg)}}";
|
|
118
|
+
|
|
119
|
+
const DEEP_LINK_PREFIX = "https://api.gataca.io/qr/redirect.html";
|
|
120
|
+
//Default values
|
|
121
|
+
const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
|
|
122
|
+
const DEFAULT_POLLING_FREQ = 3;
|
|
123
|
+
const GatacaQR = class {
|
|
124
|
+
constructor(hostRef) { index.registerInstance(this, hostRef); this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7); this.checkStatus = undefined; this.createSession = undefined; this.successCallback = undefined; this.errorCallback = undefined; this.qrRole = undefined; this.qrType = "svg"; this.callbackServer = undefined; this.autostart = true; this.autorefresh = false; this.v = "3"; this.qrModalTitle = "Quick Access"; this.modalTitleColor = "#4745B7"; this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet"; this.hideModalTexts = false; this.hideModalBoxShadow = false; this.hideBrandTitle = false; this.logoSize = 0; this.logoSrc = gatIconAlert.logoGatacaSvg; this.qrSize = 300; this.modalWidth = 300; this.modalHeight = undefined; this.qrCodeExpiredLabel = "QR Code expired"; this.credentialsNotValidatedLabel = "User credentials not validated"; this.clickInsideBoxLabel = "Click inside the box to"; this.refreshQrLabel = "Refresh QR Code"; this.scanQrLabel = "Scan QR Code"; this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time"; this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated"; this.failedLoginErrorLabel = "No successful login"; this.successLoginLabel = "Successful Connection!"; this.byBrandLabel = "by Gataca"; this.waitingStartSessionLabel = "waiting to start a session"; this.readQrTitle = "Processing..."; this.readQrDescription = "Please wait a moment"; this.hideQrModalDescription = false; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT; this.pollingFrequency = DEFAULT_POLLING_FREQ; this.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = utils.RESULT_STATUS.NOT_STARTED; }
|
|
125
|
+
disconnectedCallback() {
|
|
126
|
+
this.stop();
|
|
127
|
+
}
|
|
128
|
+
async componentDidLoad() {
|
|
129
|
+
if (this.autostart) {
|
|
130
|
+
await this.display();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Force manually the display of a QR
|
|
135
|
+
*/
|
|
136
|
+
async display() {
|
|
137
|
+
await this.getSessionId();
|
|
138
|
+
this.result = utils.RESULT_STATUS.ONGOING;
|
|
139
|
+
this.poll()
|
|
140
|
+
.then((data) => {
|
|
141
|
+
this.result = utils.RESULT_STATUS.SUCCESS;
|
|
142
|
+
this.sessionData = data;
|
|
143
|
+
this.gatacaLoginCompleted.emit(data);
|
|
144
|
+
this.successCallback(data);
|
|
145
|
+
})
|
|
146
|
+
.catch((err) => {
|
|
147
|
+
this.clean();
|
|
148
|
+
let expired = err === utils.RESULT_STATUS.EXPIRED;
|
|
149
|
+
if (expired && this.autorefresh) {
|
|
150
|
+
this.display();
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
if (err !== utils.RESULT_STATUS.NOT_STARTED) {
|
|
154
|
+
let error = expired
|
|
155
|
+
? new Error(this.userNotScanInTimeErrorLabel)
|
|
156
|
+
: new Error(this.credsNotValidatedErrorLabel);
|
|
157
|
+
this.result = err;
|
|
158
|
+
this.gatacaLoginFailed.emit(error);
|
|
159
|
+
this.errorCallback(error);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
if (utils.checkMobile() && this.dynamicLink) {
|
|
164
|
+
window.location.href = this.getLink();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Stop manually an ongoing session
|
|
169
|
+
*/
|
|
170
|
+
async stop() {
|
|
171
|
+
this.clean();
|
|
172
|
+
if (this.result === utils.RESULT_STATUS.ONGOING || utils.RESULT_STATUS.READ) {
|
|
173
|
+
this.result = utils.RESULT_STATUS.NOT_STARTED;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
clean() {
|
|
177
|
+
this.sessionData = undefined;
|
|
178
|
+
this.sessionId = undefined;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Retrieve manually the session data on a successful login
|
|
182
|
+
*/
|
|
183
|
+
async getSessionData() {
|
|
184
|
+
return this.sessionData
|
|
185
|
+
? Promise.resolve(this.sessionData)
|
|
186
|
+
: Promise.reject(new Error(this.failedLoginErrorLabel));
|
|
187
|
+
}
|
|
188
|
+
async getSessionId() {
|
|
189
|
+
if (this.sessionId) {
|
|
190
|
+
return this.sessionId;
|
|
191
|
+
}
|
|
192
|
+
let { sessionId, authenticationRequest } = await this.createSession();
|
|
193
|
+
this.sessionId = sessionId;
|
|
194
|
+
this.authenticationRequest = authenticationRequest;
|
|
195
|
+
return this.sessionId;
|
|
196
|
+
}
|
|
197
|
+
getLink() {
|
|
198
|
+
if (this.v === "2") {
|
|
199
|
+
return this.authenticationRequest;
|
|
200
|
+
}
|
|
201
|
+
const authRequestEncoded = "?dl=" + utils.base64UrlEncode(this.authenticationRequest);
|
|
202
|
+
return DEEP_LINK_PREFIX + authRequestEncoded;
|
|
203
|
+
}
|
|
204
|
+
async poll() {
|
|
205
|
+
let endTime = new Date().getTime() +
|
|
206
|
+
(this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
|
|
207
|
+
let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
|
|
208
|
+
let checkFunc = async (component) => {
|
|
209
|
+
if (component.result === utils.RESULT_STATUS.NOT_STARTED) {
|
|
210
|
+
return { result: utils.RESULT_STATUS.NOT_STARTED };
|
|
211
|
+
}
|
|
212
|
+
let id = await component.getSessionId();
|
|
213
|
+
return component.checkStatus(id);
|
|
214
|
+
};
|
|
215
|
+
let component = this;
|
|
216
|
+
let checkCondition = async function (resolve, reject) {
|
|
217
|
+
// If the condition is met, we're done!
|
|
218
|
+
let { result, data } = await checkFunc(component);
|
|
219
|
+
switch (result) {
|
|
220
|
+
case utils.RESULT_STATUS.SUCCESS:
|
|
221
|
+
resolve(data);
|
|
222
|
+
break;
|
|
223
|
+
case utils.RESULT_STATUS.READ:
|
|
224
|
+
component.result = utils.RESULT_STATUS.READ;
|
|
225
|
+
case utils.RESULT_STATUS.ONGOING:
|
|
226
|
+
if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
|
|
227
|
+
setTimeout(checkCondition, interval, resolve, reject);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
reject(utils.RESULT_STATUS.EXPIRED);
|
|
231
|
+
}
|
|
232
|
+
break;
|
|
233
|
+
default:
|
|
234
|
+
reject(result);
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
return new Promise(checkCondition);
|
|
239
|
+
}
|
|
240
|
+
renderQRSection() {
|
|
241
|
+
switch (this.result) {
|
|
242
|
+
case utils.RESULT_STATUS.NOT_STARTED:
|
|
243
|
+
return this.renderRetryButton();
|
|
244
|
+
case utils.RESULT_STATUS.ONGOING:
|
|
245
|
+
return this.renderQR(this.getLink(), true);
|
|
246
|
+
case utils.RESULT_STATUS.EXPIRED:
|
|
247
|
+
return this.renderRetryButton(this.qrCodeExpiredLabel);
|
|
248
|
+
case utils.RESULT_STATUS.FAILED:
|
|
249
|
+
return this.renderRetryButton(this.credentialsNotValidatedLabel);
|
|
250
|
+
case utils.RESULT_STATUS.SUCCESS:
|
|
251
|
+
return this.renderSuccess();
|
|
252
|
+
case utils.RESULT_STATUS.READ:
|
|
253
|
+
return this.renderReadQR({
|
|
254
|
+
title: this === null || this === void 0 ? void 0 : this.readQrTitle,
|
|
255
|
+
description: this === null || this === void 0 ? void 0 : this.readQrDescription,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
renderSuccess() {
|
|
260
|
+
return (index.h(Success, { modalHeight: this === null || this === void 0 ? void 0 : this.modalHeight, successLoginLabel: this === null || this === void 0 ? void 0 : this.successLoginLabel }));
|
|
261
|
+
}
|
|
262
|
+
renderRetryButton(errorMessage) {
|
|
263
|
+
return (index.h(RetryButton, { errorMessage: errorMessage, modalWidth: this === null || this === void 0 ? void 0 : this.modalWidth, clickInsideBoxLabel: this === null || this === void 0 ? void 0 : this.clickInsideBoxLabel, refreshQrLabel: this === null || this === void 0 ? void 0 : this.refreshQrLabel, scanQrLabel: this === null || this === void 0 ? void 0 : this.scanQrLabel, waitingStartSessionLabel: this === null || this === void 0 ? void 0 : this.waitingStartSessionLabel, display: this.display.bind(this), renderRetryQR: this.renderRetryQR.bind(this) }));
|
|
264
|
+
}
|
|
265
|
+
renderReadQR(readQrMessages) {
|
|
266
|
+
return (index.h(ReadQR, { modalWidth: this === null || this === void 0 ? void 0 : this.modalWidth, readQrMessages: readQrMessages, url: this.getLink(), sizeQR: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, renderQR: this.renderQR.bind(this) }));
|
|
267
|
+
}
|
|
268
|
+
renderQR(value, useLogo) {
|
|
269
|
+
return (index.h(QR, { value: value, qrType: this.qrType, useLogo: useLogo, size: (this === null || this === void 0 ? void 0 : this.qrSize) || undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc }));
|
|
270
|
+
}
|
|
271
|
+
renderRetryQR(value, useLogo) {
|
|
272
|
+
return (index.h(QR, { value: value, useLogo: useLogo, qrType: this.qrType, size: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc }));
|
|
273
|
+
}
|
|
274
|
+
render() {
|
|
275
|
+
var _a, _b;
|
|
276
|
+
return (index.h("div", { class: "popUpContainer" }, index.h("div", { class: `is-visible modal-window ${this.hideModalTexts ? "" : "large-modal"} ${this.hideModalBoxShadow ? "noBoxShadow" : ""}`, style: {
|
|
277
|
+
width: (this.modalWidth - 2).toString() + "px",
|
|
278
|
+
height: this.modalHeight
|
|
279
|
+
? ((_a = (this.modalHeight - 2)) === null || _a === void 0 ? void 0 : _a.toString()) + "px"
|
|
280
|
+
: "",
|
|
281
|
+
}, onClick: (event) => {
|
|
282
|
+
event.stopPropagation();
|
|
283
|
+
} }, index.h("div", { class: "modal-window__content" }, index.h("div", { class: `qrTitleContainer ${this.hideModalTexts ? "hidenText" : ""}` }, index.h("p", { class: "qrTitle modalText", style: { color: this.modalTitleColor || "#1e1e20" } }, this.qrModalTitle), !this.hideBrandTitle && (index.h("p", { class: "qrBrand modalText" }, this.byBrandLabel, " ", index.h("span", null, index.h("img", { src: gatIconAlert.logoGatacaSvg })))), this.result !== utils.RESULT_STATUS.SUCCESS &&
|
|
284
|
+
!this.hideQrModalDescription && (index.h("p", { class: "qrDescription modalText" }, this.qrModalDescription))), index.h("div", { class: "qrSection", style: {
|
|
285
|
+
width: this.modalWidth.toString() + "px",
|
|
286
|
+
height: this.modalWidth
|
|
287
|
+
? ((_b = this.modalWidth) === null || _b === void 0 ? void 0 : _b.toString()) + "px"
|
|
288
|
+
: "",
|
|
289
|
+
} }, this.renderQRSection())))));
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
GatacaQR.style = gatacaQrCss;
|
|
293
|
+
|
|
294
|
+
exports.gataca_qr = GatacaQR;
|
|
295
|
+
exports.gataca_qrdisplay = GatacaQRDisplay;
|