@gataca/qr 0.0.7
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/LICENSE +21 -0
- package/dist/cjs/gat-icon-alert-0ad19b26.js +14 -0
- package/dist/cjs/gataca-autoqr.cjs.entry.js +105 -0
- package/dist/cjs/gataca-qr_2.cjs.entry.js +294 -0
- package/dist/cjs/gataca-qrws.cjs.entry.js +252 -0
- package/dist/cjs/gataca-ssibutton_2.cjs.entry.js +309 -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 +323 -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 +965 -0
- package/dist/collection/components/gataca-qrdisplay/gataca-qrdisplay.js +154 -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 +974 -0
- package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.css +116 -0
- package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.js +933 -0
- package/dist/collection/components/gataca-ssibuttonws/gataca-ssibuttonws.css +116 -0
- package/dist/collection/components/gataca-ssibuttonws/gataca-ssibuttonws.js +410 -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.d.ts +11 -0
- package/dist/components/gataca-autoqr.js +161 -0
- package/dist/components/gataca-qr.d.ts +11 -0
- package/dist/components/gataca-qr.js +6 -0
- package/dist/components/gataca-qr2.js +309 -0
- package/dist/components/gataca-qrdisplay.d.ts +11 -0
- package/dist/components/gataca-qrdisplay.js +6 -0
- package/dist/components/gataca-qrdisplay2.js +93 -0
- package/dist/components/gataca-qrws.d.ts +11 -0
- package/dist/components/gataca-qrws.js +6 -0
- package/dist/components/gataca-qrws2.js +310 -0
- package/dist/components/gataca-ssibutton.d.ts +11 -0
- package/dist/components/gataca-ssibutton.js +6 -0
- package/dist/components/gataca-ssibutton2.js +318 -0
- package/dist/components/gataca-ssibuttonws.d.ts +11 -0
- package/dist/components/gataca-ssibuttonws.js +6 -0
- package/dist/components/gataca-ssibuttonws2.js +102 -0
- package/dist/components/index.d.ts +27 -0
- package/dist/components/index.js +8 -0
- package/dist/esm/gat-icon-alert-7b06ef3a.js +9 -0
- package/dist/esm/gataca-autoqr.entry.js +101 -0
- package/dist/esm/gataca-qr_2.entry.js +289 -0
- package/dist/esm/gataca-qrws.entry.js +248 -0
- package/dist/esm/gataca-ssibutton_2.entry.js +304 -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/esm/utils-63e7a33b.js +24 -0
- package/dist/gatacaqr/gatacaqr.esm.js +1 -0
- package/dist/gatacaqr/index.esm.js +1 -0
- package/dist/gatacaqr/p-0381ab9a.entry.js +1 -0
- package/dist/gatacaqr/p-0be4566d.js +1 -0
- package/dist/gatacaqr/p-16298cb4.entry.js +1 -0
- package/dist/gatacaqr/p-2cd7b062.js +1 -0
- package/dist/gatacaqr/p-5ae5f952.js +2 -0
- package/dist/gatacaqr/p-68f20267.entry.js +1 -0
- package/dist/gatacaqr/p-9e9af27e.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 +85 -0
- package/dist/types/components/gataca-qr/components/qr/QR.d.ts +9 -0
- package/dist/types/components/gataca-qr/components/readQR/ReadQR.d.ts +13 -0
- package/dist/types/components/gataca-qr/components/readQR/components/AnimatedLoader.d.ts +2 -0
- package/dist/types/components/gataca-qr/components/retryButton/RetryButton.d.ts +13 -0
- package/dist/types/components/gataca-qr/components/success/Success.d.ts +7 -0
- package/dist/types/components/gataca-qr/gataca-qr.d.ts +246 -0
- package/dist/types/components/gataca-qrdisplay/gataca-qrdisplay.d.ts +35 -0
- package/dist/types/components/gataca-qrws/components/qr/QR.d.ts +9 -0
- package/dist/types/components/gataca-qrws/components/readQR/ReadQR.d.ts +13 -0
- package/dist/types/components/gataca-qrws/components/readQR/components/AnimatedLoader.d.ts +2 -0
- package/dist/types/components/gataca-qrws/components/retryButton/RetryButton.d.ts +13 -0
- package/dist/types/components/gataca-qrws/components/success/Success.d.ts +7 -0
- package/dist/types/components/gataca-qrws/gataca-qrws.d.ts +239 -0
- package/dist/types/components/gataca-ssibutton/gataca-ssibutton.d.ts +218 -0
- package/dist/types/components/gataca-ssibuttonws/gataca-ssibuttonws.d.ts +110 -0
- package/dist/types/components.d.ts +1326 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/stencil-public-runtime.d.ts +1581 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +57 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +11 -0
- package/package.json +45 -0
- package/readme.md +69 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { d as defineCustomElement$6 } from './gataca-qr2.js';
|
|
3
|
+
import { d as defineCustomElement$5 } from './gataca-qrdisplay2.js';
|
|
4
|
+
import { d as defineCustomElement$4 } from './gataca-qrws2.js';
|
|
5
|
+
import { d as defineCustomElement$3 } from './gataca-ssibutton2.js';
|
|
6
|
+
import { d as defineCustomElement$2 } from './gataca-ssibuttonws2.js';
|
|
7
|
+
|
|
8
|
+
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}";
|
|
9
|
+
|
|
10
|
+
const DEFAULT_REPOSITORY = "https://studio.gataca.io/api/v1/qrconfigs";
|
|
11
|
+
const fixFunctions = (data) => {
|
|
12
|
+
var _a, _b, _c, _d, _e, _f;
|
|
13
|
+
data.errorCallback = deserializeFunction((_a = data.errorCallback) === null || _a === void 0 ? void 0 : _a.toString());
|
|
14
|
+
data.successCallback = deserializeFunction((_b = data.successCallback) === null || _b === void 0 ? void 0 : _b.toString());
|
|
15
|
+
data.wsOnMessage = deserializeFunction((_c = data.wsOnMessage) === null || _c === void 0 ? void 0 : _c.toString());
|
|
16
|
+
data.wsOnOpen = deserializeFunction((_d = data.wsOnOpen) === null || _d === void 0 ? void 0 : _d.toString());
|
|
17
|
+
data.checkStatus = deserializeFunction((_e = data.checkStatus) === null || _e === void 0 ? void 0 : _e.toString());
|
|
18
|
+
data.createSession = deserializeFunction((_f = data.createSession) === null || _f === void 0 ? void 0 : _f.toString());
|
|
19
|
+
return data;
|
|
20
|
+
};
|
|
21
|
+
const deserializeFunction = (data) => {
|
|
22
|
+
if (data) {
|
|
23
|
+
return new Function("return " + data)();
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
};
|
|
27
|
+
const GatacaAutoQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
28
|
+
constructor() {
|
|
29
|
+
super();
|
|
30
|
+
this.__registerHost();
|
|
31
|
+
this.__attachShadow();
|
|
32
|
+
this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
|
|
33
|
+
this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
|
|
34
|
+
this.configId = undefined;
|
|
35
|
+
this.configRepository = DEFAULT_REPOSITORY;
|
|
36
|
+
this.successCallback = undefined;
|
|
37
|
+
this.errorCallback = undefined;
|
|
38
|
+
this.checkStatus = undefined;
|
|
39
|
+
this.createSession = undefined;
|
|
40
|
+
this.wsOnOpen = undefined;
|
|
41
|
+
this.wsOnMessage = undefined;
|
|
42
|
+
this.config = undefined;
|
|
43
|
+
this.loading = undefined;
|
|
44
|
+
this.loading = true;
|
|
45
|
+
fetch(this.configRepository + "/" + this.configId, {
|
|
46
|
+
method: "GET",
|
|
47
|
+
headers: {
|
|
48
|
+
"Content-Type": "application/json",
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
.then((response) => {
|
|
52
|
+
response
|
|
53
|
+
.json()
|
|
54
|
+
.then((data) => {
|
|
55
|
+
data = fixFunctions(data);
|
|
56
|
+
this.config = data;
|
|
57
|
+
this.loading = false;
|
|
58
|
+
})
|
|
59
|
+
.catch((err) => {
|
|
60
|
+
console.log("Cannot retrieve selected config", err);
|
|
61
|
+
this.loading = false;
|
|
62
|
+
});
|
|
63
|
+
})
|
|
64
|
+
.catch((err) => {
|
|
65
|
+
console.log("Cannot retrieve selected config", err);
|
|
66
|
+
this.loading = false;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Retrieve manually the session data on a successful login
|
|
71
|
+
*/
|
|
72
|
+
async getSessionData() {
|
|
73
|
+
return this.qr.getSessionData();
|
|
74
|
+
}
|
|
75
|
+
selectQR() {
|
|
76
|
+
if (this.config.useButton) {
|
|
77
|
+
if (this.config.useWs) {
|
|
78
|
+
this.qr = (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, 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 }));
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.qr = (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, 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 }));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
if (this.config.useWs) {
|
|
86
|
+
this.qr = (h("gataca-qrws", { wsOnMessage: this.wsOnMessage || this.config.wsOnMessage, wsOnOpen: this.wsOnOpen || this.config.wsOnOpen, successCallback: this.successCallback || this.config.successCallback, 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 }));
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
this.qr = (h("gataca-qr", { checkStatus: this.checkStatus || this.config.checkStatus, createSession: this.createSession || this.config.createSession, successCallback: this.successCallback || this.config.successCallback, 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 }));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
render() {
|
|
94
|
+
if (this.loading) {
|
|
95
|
+
//TODO: Improve loading message
|
|
96
|
+
return h("div", null, "Loading...");
|
|
97
|
+
}
|
|
98
|
+
if (this.config) {
|
|
99
|
+
this.selectQR();
|
|
100
|
+
return this.qr;
|
|
101
|
+
}
|
|
102
|
+
//TODO: Improve error message
|
|
103
|
+
return h("div", null, "Error loading your config...");
|
|
104
|
+
}
|
|
105
|
+
static get style() { return gatacaAutoqrCss; }
|
|
106
|
+
}, [1, "gataca-autoqr", {
|
|
107
|
+
"configId": [1, "config-id"],
|
|
108
|
+
"configRepository": [1, "config-repository"],
|
|
109
|
+
"successCallback": [16],
|
|
110
|
+
"errorCallback": [16],
|
|
111
|
+
"checkStatus": [16],
|
|
112
|
+
"createSession": [16],
|
|
113
|
+
"wsOnOpen": [16],
|
|
114
|
+
"wsOnMessage": [16],
|
|
115
|
+
"config": [32],
|
|
116
|
+
"loading": [32],
|
|
117
|
+
"getSessionData": [64]
|
|
118
|
+
}]);
|
|
119
|
+
function defineCustomElement$1() {
|
|
120
|
+
if (typeof customElements === "undefined") {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const components = ["gataca-autoqr", "gataca-qr", "gataca-qrdisplay", "gataca-qrws", "gataca-ssibutton", "gataca-ssibuttonws"];
|
|
124
|
+
components.forEach(tagName => { switch (tagName) {
|
|
125
|
+
case "gataca-autoqr":
|
|
126
|
+
if (!customElements.get(tagName)) {
|
|
127
|
+
customElements.define(tagName, GatacaAutoQR);
|
|
128
|
+
}
|
|
129
|
+
break;
|
|
130
|
+
case "gataca-qr":
|
|
131
|
+
if (!customElements.get(tagName)) {
|
|
132
|
+
defineCustomElement$6();
|
|
133
|
+
}
|
|
134
|
+
break;
|
|
135
|
+
case "gataca-qrdisplay":
|
|
136
|
+
if (!customElements.get(tagName)) {
|
|
137
|
+
defineCustomElement$5();
|
|
138
|
+
}
|
|
139
|
+
break;
|
|
140
|
+
case "gataca-qrws":
|
|
141
|
+
if (!customElements.get(tagName)) {
|
|
142
|
+
defineCustomElement$4();
|
|
143
|
+
}
|
|
144
|
+
break;
|
|
145
|
+
case "gataca-ssibutton":
|
|
146
|
+
if (!customElements.get(tagName)) {
|
|
147
|
+
defineCustomElement$3();
|
|
148
|
+
}
|
|
149
|
+
break;
|
|
150
|
+
case "gataca-ssibuttonws":
|
|
151
|
+
if (!customElements.get(tagName)) {
|
|
152
|
+
defineCustomElement$2();
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
} });
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const GatacaAutoqr = GatacaAutoQR;
|
|
159
|
+
const defineCustomElement = defineCustomElement$1;
|
|
160
|
+
|
|
161
|
+
export { GatacaAutoqr, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface GatacaQr extends Components.GatacaQr, HTMLElement {}
|
|
4
|
+
export const GatacaQr: {
|
|
5
|
+
prototype: GatacaQr;
|
|
6
|
+
new (): GatacaQr;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { h, proxyCustomElement, HTMLElement, createEvent } from '@stencil/core/internal/client';
|
|
2
|
+
import { l as logoGatacaSvg, d as defineCustomElement$1 } from './gataca-qrdisplay2.js';
|
|
3
|
+
import { g as gatIconCheckSvg, a as gatIconRefreshSvg, d as gatIconAlertSvg, R as RESULT_STATUS, c as checkMobile, b as base64UrlEncode } from './gat-icon-alert.js';
|
|
4
|
+
|
|
5
|
+
const Success = (props) => {
|
|
6
|
+
const { modalHeight, successLoginLabel } = props;
|
|
7
|
+
return (h("div", { class: "success", style: {
|
|
8
|
+
height: modalHeight ? (modalHeight === null || modalHeight === void 0 ? void 0 : modalHeight.toString()) + "px" : "300px",
|
|
9
|
+
} },
|
|
10
|
+
h("img", { src: gatIconCheckSvg, height: 52, width: 52 }),
|
|
11
|
+
h("p", { class: "successMsg" }, successLoginLabel)));
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const RetryButton = (props) => {
|
|
15
|
+
var _a;
|
|
16
|
+
const { errorMessage, modalWidth, clickInsideBoxLabel, refreshQrLabel, scanQrLabel, waitingStartSessionLabel, display, renderRetryQR, } = props;
|
|
17
|
+
return (h("div", { class: "reload", style: {
|
|
18
|
+
width: (modalWidth - 48).toString() + "px",
|
|
19
|
+
height: modalWidth ? ((_a = (modalWidth - 48)) === null || _a === void 0 ? void 0 : _a.toString()) + "px" : "",
|
|
20
|
+
} },
|
|
21
|
+
h("div", { id: "notify", onClick: () => display() },
|
|
22
|
+
h("img", { src: gatIconRefreshSvg, height: 24, width: 24 }),
|
|
23
|
+
h("p", { class: "notify-text" },
|
|
24
|
+
clickInsideBoxLabel,
|
|
25
|
+
" "),
|
|
26
|
+
errorMessage ? (h("p", { class: "notify-text bold" }, refreshQrLabel)) : (h("p", { class: "notify-text bold" }, scanQrLabel)),
|
|
27
|
+
errorMessage && (h("div", { class: "alert", style: {
|
|
28
|
+
width: (modalWidth - 48).toString() + "px",
|
|
29
|
+
} },
|
|
30
|
+
h("img", { src: gatIconAlertSvg, height: 24, width: 24 }),
|
|
31
|
+
h("p", null, errorMessage)))),
|
|
32
|
+
h("div", { id: "qrwait" }, renderRetryQR(waitingStartSessionLabel))));
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const AnimatedLoader = () => {
|
|
36
|
+
return (h("div", { class: "containerLoader" },
|
|
37
|
+
h("div", { class: "loader" },
|
|
38
|
+
h("div", { class: "loader__item loader__item__1" }),
|
|
39
|
+
h("div", { class: "loader__item loader__item__2" }),
|
|
40
|
+
h("div", { class: "loader__item loader__item__3" }),
|
|
41
|
+
h("div", { class: "loader__item loader__item__4" }),
|
|
42
|
+
h("div", { class: "loader__item loader__item__5" }),
|
|
43
|
+
h("div", { class: "loader__item loader__item__6" }),
|
|
44
|
+
h("div", { class: "loader__item loader__item__7" }),
|
|
45
|
+
h("div", { class: "loader__item loader__item__8" }))));
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const ReadQR = (props) => {
|
|
49
|
+
var _a;
|
|
50
|
+
const { modalWidth, readQrMessages, renderQR, url, sizeQR } = props;
|
|
51
|
+
return (h("div", { class: "blured", style: {
|
|
52
|
+
width: (modalWidth - 48).toString() + "px",
|
|
53
|
+
height: modalWidth ? ((_a = (modalWidth - 48)) === null || _a === void 0 ? void 0 : _a.toString()) + "px" : "",
|
|
54
|
+
} },
|
|
55
|
+
h("div", { id: "notify" },
|
|
56
|
+
h(AnimatedLoader, null),
|
|
57
|
+
h("p", { class: "notify-text" }, readQrMessages === null || readQrMessages === void 0 ? void 0 :
|
|
58
|
+
readQrMessages.title,
|
|
59
|
+
" "),
|
|
60
|
+
h("p", { class: "notify-text bold" }, readQrMessages === null || readQrMessages === void 0 ? void 0 : readQrMessages.description)),
|
|
61
|
+
h("div", { id: "qrwait" }, renderQR(url, false, sizeQR))));
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const QR = (props) => {
|
|
65
|
+
const { value, useLogo, logoSrc, size } = props;
|
|
66
|
+
return (h("gataca-qrdisplay", { qrData: value, rounded: true, size: size, "logo-size": useLogo ? 0.33 : 0, "logo-src": logoSrc }));
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
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)}}";
|
|
70
|
+
|
|
71
|
+
const DEEP_LINK_PREFIX = "https://api.gataca.io/qr/redirect.html";
|
|
72
|
+
//Default values
|
|
73
|
+
const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
|
|
74
|
+
const DEFAULT_POLLING_FREQ = 3;
|
|
75
|
+
const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
76
|
+
constructor() { super(); this.__registerHost(); this.__attachShadow(); this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7); this.checkStatus = undefined; this.createSession = undefined; this.successCallback = undefined; this.errorCallback = undefined; this.qrRole = undefined; 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 = 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 = RESULT_STATUS.NOT_STARTED; }
|
|
77
|
+
disconnectedCallback() {
|
|
78
|
+
this.stop();
|
|
79
|
+
}
|
|
80
|
+
async componentDidLoad() {
|
|
81
|
+
if (this.autostart) {
|
|
82
|
+
await this.display();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Force manually the display of a QR
|
|
87
|
+
*/
|
|
88
|
+
async display() {
|
|
89
|
+
await this.getSessionId();
|
|
90
|
+
this.result = RESULT_STATUS.ONGOING;
|
|
91
|
+
this.poll()
|
|
92
|
+
.then((data) => {
|
|
93
|
+
this.result = RESULT_STATUS.SUCCESS;
|
|
94
|
+
this.sessionData = data;
|
|
95
|
+
this.gatacaLoginCompleted.emit(data);
|
|
96
|
+
this.successCallback(data);
|
|
97
|
+
})
|
|
98
|
+
.catch((err) => {
|
|
99
|
+
this.clean();
|
|
100
|
+
let expired = err === RESULT_STATUS.EXPIRED;
|
|
101
|
+
if (expired && this.autorefresh) {
|
|
102
|
+
this.display();
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
if (err !== RESULT_STATUS.NOT_STARTED) {
|
|
106
|
+
let error = expired
|
|
107
|
+
? new Error(this.userNotScanInTimeErrorLabel)
|
|
108
|
+
: new Error(this.credsNotValidatedErrorLabel);
|
|
109
|
+
this.result = err;
|
|
110
|
+
this.gatacaLoginFailed.emit(error);
|
|
111
|
+
this.errorCallback(error);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
if (checkMobile() && this.dynamicLink) {
|
|
116
|
+
window.location.href = this.getLink();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Stop manually an ongoing session
|
|
121
|
+
*/
|
|
122
|
+
async stop() {
|
|
123
|
+
this.clean();
|
|
124
|
+
if (this.result === RESULT_STATUS.ONGOING || RESULT_STATUS.READ) {
|
|
125
|
+
this.result = RESULT_STATUS.NOT_STARTED;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
clean() {
|
|
129
|
+
this.sessionData = undefined;
|
|
130
|
+
this.sessionId = undefined;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Retrieve manually the session data on a successful login
|
|
134
|
+
*/
|
|
135
|
+
async getSessionData() {
|
|
136
|
+
return this.sessionData
|
|
137
|
+
? Promise.resolve(this.sessionData)
|
|
138
|
+
: Promise.reject(new Error(this.failedLoginErrorLabel));
|
|
139
|
+
}
|
|
140
|
+
async getSessionId() {
|
|
141
|
+
if (this.sessionId) {
|
|
142
|
+
return this.sessionId;
|
|
143
|
+
}
|
|
144
|
+
let { sessionId, authenticationRequest } = await this.createSession();
|
|
145
|
+
this.sessionId = sessionId;
|
|
146
|
+
this.authenticationRequest = authenticationRequest;
|
|
147
|
+
return this.sessionId;
|
|
148
|
+
}
|
|
149
|
+
getLink() {
|
|
150
|
+
if (this.v === "2") {
|
|
151
|
+
return this.authenticationRequest;
|
|
152
|
+
}
|
|
153
|
+
const authRequestEncoded = "?dl=" + base64UrlEncode(this.authenticationRequest);
|
|
154
|
+
return DEEP_LINK_PREFIX + authRequestEncoded;
|
|
155
|
+
}
|
|
156
|
+
async poll() {
|
|
157
|
+
let endTime = new Date().getTime() +
|
|
158
|
+
(this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
|
|
159
|
+
let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
|
|
160
|
+
let checkFunc = async (component) => {
|
|
161
|
+
if (component.result === RESULT_STATUS.NOT_STARTED) {
|
|
162
|
+
return { result: RESULT_STATUS.NOT_STARTED };
|
|
163
|
+
}
|
|
164
|
+
let id = await component.getSessionId();
|
|
165
|
+
return component.checkStatus(id);
|
|
166
|
+
};
|
|
167
|
+
let component = this;
|
|
168
|
+
let checkCondition = async function (resolve, reject) {
|
|
169
|
+
// If the condition is met, we're done!
|
|
170
|
+
let { result, data } = await checkFunc(component);
|
|
171
|
+
switch (result) {
|
|
172
|
+
case RESULT_STATUS.SUCCESS:
|
|
173
|
+
resolve(data);
|
|
174
|
+
break;
|
|
175
|
+
case RESULT_STATUS.READ:
|
|
176
|
+
component.result = RESULT_STATUS.READ;
|
|
177
|
+
case RESULT_STATUS.ONGOING:
|
|
178
|
+
if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
|
|
179
|
+
setTimeout(checkCondition, interval, resolve, reject);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
reject(RESULT_STATUS.EXPIRED);
|
|
183
|
+
}
|
|
184
|
+
break;
|
|
185
|
+
default:
|
|
186
|
+
reject(result);
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
return new Promise(checkCondition);
|
|
191
|
+
}
|
|
192
|
+
renderQRSection() {
|
|
193
|
+
switch (this.result) {
|
|
194
|
+
case RESULT_STATUS.NOT_STARTED:
|
|
195
|
+
return this.renderRetryButton();
|
|
196
|
+
case RESULT_STATUS.ONGOING:
|
|
197
|
+
return this.renderQR(this.getLink(), true);
|
|
198
|
+
case RESULT_STATUS.EXPIRED:
|
|
199
|
+
return this.renderRetryButton(this.qrCodeExpiredLabel);
|
|
200
|
+
case RESULT_STATUS.FAILED:
|
|
201
|
+
return this.renderRetryButton(this.credentialsNotValidatedLabel);
|
|
202
|
+
case RESULT_STATUS.SUCCESS:
|
|
203
|
+
return this.renderSuccess();
|
|
204
|
+
case RESULT_STATUS.READ:
|
|
205
|
+
return this.renderReadQR({
|
|
206
|
+
title: this === null || this === void 0 ? void 0 : this.readQrTitle,
|
|
207
|
+
description: this === null || this === void 0 ? void 0 : this.readQrDescription,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
renderSuccess() {
|
|
212
|
+
return (h(Success, { modalHeight: this === null || this === void 0 ? void 0 : this.modalHeight, successLoginLabel: this === null || this === void 0 ? void 0 : this.successLoginLabel }));
|
|
213
|
+
}
|
|
214
|
+
renderRetryButton(errorMessage) {
|
|
215
|
+
return (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) }));
|
|
216
|
+
}
|
|
217
|
+
renderReadQR(readQrMessages) {
|
|
218
|
+
return (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 }));
|
|
219
|
+
}
|
|
220
|
+
renderQR(value, useLogo) {
|
|
221
|
+
return (h(QR, { value: value, useLogo: useLogo, size: (this === null || this === void 0 ? void 0 : this.qrSize) || undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc }));
|
|
222
|
+
}
|
|
223
|
+
renderRetryQR(value, useLogo) {
|
|
224
|
+
return (h(QR, { value: value, useLogo: useLogo, 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 }));
|
|
225
|
+
}
|
|
226
|
+
render() {
|
|
227
|
+
var _a, _b;
|
|
228
|
+
return (h("div", { class: "popUpContainer" }, h("div", { class: `is-visible modal-window ${this.hideModalTexts ? "" : "large-modal"} ${this.hideModalBoxShadow ? "noBoxShadow" : ""}`, style: {
|
|
229
|
+
width: (this.modalWidth - 2).toString() + "px",
|
|
230
|
+
height: this.modalHeight
|
|
231
|
+
? ((_a = (this.modalHeight - 2)) === null || _a === void 0 ? void 0 : _a.toString()) + "px"
|
|
232
|
+
: "",
|
|
233
|
+
}, onClick: (event) => {
|
|
234
|
+
event.stopPropagation();
|
|
235
|
+
} }, h("div", { class: "modal-window__content" }, h("div", { class: `qrTitleContainer ${this.hideModalTexts ? "hidenText" : ""}` }, h("p", { class: "qrTitle modalText", style: { color: this.modalTitleColor || "#1e1e20" } }, this.qrModalTitle), !this.hideBrandTitle && (h("p", { class: "qrBrand modalText" }, this.byBrandLabel, " ", h("span", null, h("img", { src: logoGatacaSvg })))), this.result !== RESULT_STATUS.SUCCESS &&
|
|
236
|
+
!this.hideQrModalDescription && (h("p", { class: "qrDescription modalText" }, this.qrModalDescription))), h("div", { class: "qrSection", style: {
|
|
237
|
+
width: this.modalWidth.toString() + "px",
|
|
238
|
+
height: this.modalWidth
|
|
239
|
+
? ((_b = this.modalWidth) === null || _b === void 0 ? void 0 : _b.toString()) + "px"
|
|
240
|
+
: "",
|
|
241
|
+
} }, this.renderQRSection())))));
|
|
242
|
+
}
|
|
243
|
+
static get style() { return gatacaQrCss; }
|
|
244
|
+
}, [1, "gataca-qr", {
|
|
245
|
+
"checkStatus": [16],
|
|
246
|
+
"createSession": [16],
|
|
247
|
+
"successCallback": [16],
|
|
248
|
+
"errorCallback": [16],
|
|
249
|
+
"qrRole": [1, "qr-role"],
|
|
250
|
+
"callbackServer": [1, "callback-server"],
|
|
251
|
+
"autostart": [4],
|
|
252
|
+
"autorefresh": [4],
|
|
253
|
+
"v": [1],
|
|
254
|
+
"qrModalTitle": [1, "qr-modal-title"],
|
|
255
|
+
"modalTitleColor": [1, "modal-title-color"],
|
|
256
|
+
"qrModalDescription": [1, "qr-modal-description"],
|
|
257
|
+
"hideModalTexts": [4, "hide-modal-texts"],
|
|
258
|
+
"hideModalBoxShadow": [4, "hide-modal-box-shadow"],
|
|
259
|
+
"hideBrandTitle": [4, "hide-brand-title"],
|
|
260
|
+
"logoSize": [2, "logo-size"],
|
|
261
|
+
"logoSrc": [1, "logo-src"],
|
|
262
|
+
"qrSize": [2, "qr-size"],
|
|
263
|
+
"modalWidth": [2, "modal-width"],
|
|
264
|
+
"modalHeight": [2, "modal-height"],
|
|
265
|
+
"qrCodeExpiredLabel": [1, "qr-code-expired-label"],
|
|
266
|
+
"credentialsNotValidatedLabel": [1, "credentials-not-validated-label"],
|
|
267
|
+
"clickInsideBoxLabel": [1, "click-inside-box-label"],
|
|
268
|
+
"refreshQrLabel": [1, "refresh-qr-label"],
|
|
269
|
+
"scanQrLabel": [1, "scan-qr-label"],
|
|
270
|
+
"userNotScanInTimeErrorLabel": [1, "user-not-scan-in-time-error-label"],
|
|
271
|
+
"credsNotValidatedErrorLabel": [1, "creds-not-validated-error-label"],
|
|
272
|
+
"failedLoginErrorLabel": [1, "failed-login-error-label"],
|
|
273
|
+
"successLoginLabel": [1, "success-login-label"],
|
|
274
|
+
"byBrandLabel": [1, "by-brand-label"],
|
|
275
|
+
"waitingStartSessionLabel": [1, "waiting-start-session-label"],
|
|
276
|
+
"readQrTitle": [1, "read-qr-title"],
|
|
277
|
+
"readQrDescription": [1, "read-qr-description"],
|
|
278
|
+
"hideQrModalDescription": [4, "hide-qr-modal-description"],
|
|
279
|
+
"sessionTimeout": [2, "session-timeout"],
|
|
280
|
+
"pollingFrequency": [2, "polling-frequency"],
|
|
281
|
+
"dynamicLink": [4, "dynamic-link"],
|
|
282
|
+
"sessionId": [32],
|
|
283
|
+
"authenticationRequest": [32],
|
|
284
|
+
"sessionData": [32],
|
|
285
|
+
"result": [32],
|
|
286
|
+
"display": [64],
|
|
287
|
+
"stop": [64],
|
|
288
|
+
"getSessionData": [64]
|
|
289
|
+
}]);
|
|
290
|
+
function defineCustomElement() {
|
|
291
|
+
if (typeof customElements === "undefined") {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
const components = ["gataca-qr", "gataca-qrdisplay"];
|
|
295
|
+
components.forEach(tagName => { switch (tagName) {
|
|
296
|
+
case "gataca-qr":
|
|
297
|
+
if (!customElements.get(tagName)) {
|
|
298
|
+
customElements.define(tagName, GatacaQR);
|
|
299
|
+
}
|
|
300
|
+
break;
|
|
301
|
+
case "gataca-qrdisplay":
|
|
302
|
+
if (!customElements.get(tagName)) {
|
|
303
|
+
defineCustomElement$1();
|
|
304
|
+
}
|
|
305
|
+
break;
|
|
306
|
+
} });
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export { GatacaQR as G, defineCustomElement as d };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface GatacaQrdisplay extends Components.GatacaQrdisplay, HTMLElement {}
|
|
4
|
+
export const GatacaQrdisplay: {
|
|
5
|
+
prototype: GatacaQrdisplay;
|
|
6
|
+
new (): GatacaQrdisplay;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|