@gataca/qr 2.0.0 → 2.0.1
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/{esm/qr-code-styling-0eeb38d5.js → cjs/gataca-autoqr_6.cjs.entry.js} +599 -1
- package/dist/cjs/gatacaqr.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/gataca-autoqr/gataca-autoqr.js +20 -1
- package/dist/collection/components/gataca-qr/gataca-qr.css +2 -0
- package/dist/collection/components/gataca-qrws/gataca-qrws.css +2 -0
- package/dist/components/gataca-autoqr.js +20 -1
- package/dist/components/gataca-qr2.js +1 -1
- package/dist/components/gataca-qrws2.js +1 -1
- package/dist/{cjs/qr-code-styling-412bbc7a.js → esm/gataca-autoqr_6.entry.js} +589 -2
- package/dist/esm/gatacaqr.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/gatacaqr/gatacaqr.esm.js +1 -1
- package/dist/gatacaqr/p-4807b345.entry.js +1 -0
- package/package.json +1 -1
- package/dist/cjs/gat-icon-refresh-751505ff.js +0 -14
- package/dist/cjs/gataca-autoqr.cjs.entry.js +0 -88
- package/dist/cjs/gataca-qr.cjs.entry.js +0 -175
- package/dist/cjs/gataca-qrdisplay_2.cjs.entry.js +0 -219
- package/dist/cjs/gataca-ssibutton_2.cjs.entry.js +0 -114
- package/dist/esm/gat-icon-refresh-179ea123.js +0 -9
- package/dist/esm/gataca-autoqr.entry.js +0 -84
- package/dist/esm/gataca-qr.entry.js +0 -171
- package/dist/esm/gataca-qrdisplay_2.entry.js +0 -214
- package/dist/esm/gataca-ssibutton_2.entry.js +0 -109
- package/dist/gatacaqr/p-0905677f.entry.js +0 -1
- package/dist/gatacaqr/p-0be4566d.js +0 -1
- package/dist/gatacaqr/p-1d35273f.entry.js +0 -1
- package/dist/gatacaqr/p-2f22c7fc.js +0 -1
- package/dist/gatacaqr/p-4139a068.entry.js +0 -1
- package/dist/gatacaqr/p-f85d7e76.entry.js +0 -1
|
@@ -1,4 +1,113 @@
|
|
|
1
|
-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-19eef502.js';
|
|
2
|
+
import { R as RESULT_STATUS, c as checkMobile, b as base64UrlEncode } from './utils-05ba6c9f.js';
|
|
3
|
+
|
|
4
|
+
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}";
|
|
5
|
+
|
|
6
|
+
const DEFAULT_REPOSITORY = "https://studio.gataca.io/api/v1/qrconfigs";
|
|
7
|
+
const fixFunctions = (data) => {
|
|
8
|
+
var _a, _b, _c, _d, _e, _f;
|
|
9
|
+
data.errorCallback = deserializeFunction((_a = data.errorCallback) === null || _a === void 0 ? void 0 : _a.toString());
|
|
10
|
+
data.successCallback = deserializeFunction((_b = data.successCallback) === null || _b === void 0 ? void 0 : _b.toString());
|
|
11
|
+
data.wsOnMessage = deserializeFunction((_c = data.wsOnMessage) === null || _c === void 0 ? void 0 : _c.toString());
|
|
12
|
+
data.wsOnOpen = deserializeFunction((_d = data.wsOnOpen) === null || _d === void 0 ? void 0 : _d.toString());
|
|
13
|
+
data.checkStatus = deserializeFunction((_e = data.checkStatus) === null || _e === void 0 ? void 0 : _e.toString());
|
|
14
|
+
data.createSession = deserializeFunction((_f = data.createSession) === null || _f === void 0 ? void 0 : _f.toString());
|
|
15
|
+
return data;
|
|
16
|
+
};
|
|
17
|
+
const deserializeFunction = (data) => {
|
|
18
|
+
if (data) {
|
|
19
|
+
return new Function("return " + data)();
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
22
|
+
};
|
|
23
|
+
const GatacaAutoQR = class {
|
|
24
|
+
constructor(hostRef) {
|
|
25
|
+
registerInstance(this, hostRef);
|
|
26
|
+
this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
|
|
27
|
+
this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
|
|
28
|
+
this.configId = undefined;
|
|
29
|
+
this.configRepository = DEFAULT_REPOSITORY;
|
|
30
|
+
this.successCallback = undefined;
|
|
31
|
+
this.errorCallback = undefined;
|
|
32
|
+
this.checkStatus = undefined;
|
|
33
|
+
this.createSession = undefined;
|
|
34
|
+
this.wsOnOpen = undefined;
|
|
35
|
+
this.wsOnMessage = undefined;
|
|
36
|
+
this.config = undefined;
|
|
37
|
+
this.loading = undefined;
|
|
38
|
+
this.loading = true;
|
|
39
|
+
fetch(this.configRepository + "/" + this.configId, {
|
|
40
|
+
method: "GET",
|
|
41
|
+
headers: {
|
|
42
|
+
"Content-Type": "application/json",
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
.then((response) => {
|
|
46
|
+
console.log("Got RESPONSE", response);
|
|
47
|
+
response
|
|
48
|
+
.json()
|
|
49
|
+
.then((data) => {
|
|
50
|
+
console.log("Got DATA", data);
|
|
51
|
+
data = fixFunctions(data);
|
|
52
|
+
this.config = data;
|
|
53
|
+
this.loading = false;
|
|
54
|
+
})
|
|
55
|
+
.catch((err) => {
|
|
56
|
+
console.log("Cannot retrieve selected config", err);
|
|
57
|
+
this.loading = false;
|
|
58
|
+
});
|
|
59
|
+
})
|
|
60
|
+
.catch((err) => {
|
|
61
|
+
console.log("Cannot retrieve selected config", err);
|
|
62
|
+
this.loading = false;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Retrieve manually the session data on a successful login
|
|
67
|
+
*/
|
|
68
|
+
async getSessionData() {
|
|
69
|
+
return this.qr.getSessionData();
|
|
70
|
+
}
|
|
71
|
+
selectQR() {
|
|
72
|
+
if (this.config.useButton) {
|
|
73
|
+
if (this.config.useWs) {
|
|
74
|
+
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, v2: this.config.v2, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
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, v2: this.config.v2, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
if (this.config.useWs) {
|
|
82
|
+
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, v2: this.config.v2, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
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, v2: this.config.v2, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
render() {
|
|
90
|
+
if (this.loading) {
|
|
91
|
+
//TODO: Improve loading message
|
|
92
|
+
return h("div", null, "Loading...");
|
|
93
|
+
}
|
|
94
|
+
if (this.config) {
|
|
95
|
+
this.selectQR();
|
|
96
|
+
return this.qr;
|
|
97
|
+
}
|
|
98
|
+
//TODO: Improve error message
|
|
99
|
+
return h("div", null, "Error loading your config...");
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
GatacaAutoQR.style = gatacaAutoqrCss;
|
|
103
|
+
|
|
104
|
+
const gatIconAlertSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEwLjI5MDggMy44NjAyTDEuODIwNzUgMTguMDAwMkMxLjY0NjEyIDE4LjMwMjYgMS41NTM3MiAxOC42NDU1IDEuNTUyNzQgMTguOTk0N0MxLjU1MTc2IDE5LjM0MzkgMS42NDIyNCAxOS42ODczIDEuODE1MTggMTkuOTkwN0MxLjk4ODEyIDIwLjI5NDEgMi4yMzc0OCAyMC41NDcgMi41Mzg0NiAyMC43MjQxQzIuODM5NDQgMjAuOTAxMiAzLjE4MTU1IDIwLjk5NjQgMy41MzA3NSAyMS4wMDAySDIwLjQ3MDhDMjAuODIgMjAuOTk2NCAyMS4xNjIxIDIwLjkwMTIgMjEuNDYzIDIwLjcyNDFDMjEuNzY0IDIwLjU0NyAyMi4wMTM0IDIwLjI5NDEgMjIuMTg2MyAxOS45OTA3QzIyLjM1OTMgMTkuNjg3MyAyMi40NDk3IDE5LjM0MzkgMjIuNDQ4OCAxOC45OTQ3QzIyL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LDM5OS43Niw1NzAuMTIsNDM4LjI2LDU1Mi40OSw0NzEuMTV6Ii8+CjwvZz4KPC9zdmc+Cg==';
|
|
2
111
|
|
|
3
112
|
function getDefaultExportFromCjs (x) {
|
|
4
113
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -25,4 +134,482 @@ var qrCodeStyling = createCommonjsModule(function (module, exports) {
|
|
|
25
134
|
|
|
26
135
|
const QRCodeStyling = /*@__PURE__*/getDefaultExportFromCjs(qrCodeStyling);
|
|
27
136
|
|
|
28
|
-
|
|
137
|
+
const GatacaQRDisplay = class {
|
|
138
|
+
constructor(hostRef) {
|
|
139
|
+
registerInstance(this, hostRef);
|
|
140
|
+
this.qrData = undefined;
|
|
141
|
+
this.size = 256;
|
|
142
|
+
this.logoSize = 0;
|
|
143
|
+
this.logoSrc = undefined;
|
|
144
|
+
this.qrColor = "#181B5E";
|
|
145
|
+
this.rounded = true;
|
|
146
|
+
}
|
|
147
|
+
componentDidLoad() {
|
|
148
|
+
const qrCode = new QRCodeStyling({
|
|
149
|
+
data: this.qrData,
|
|
150
|
+
width: this.size,
|
|
151
|
+
height: this.size,
|
|
152
|
+
image: this.logoSize > 0 ? this.logoSrc || logoGatacaSvg : undefined,
|
|
153
|
+
margin: 10,
|
|
154
|
+
type: "svg",
|
|
155
|
+
dotsOptions: {
|
|
156
|
+
color: this.qrColor,
|
|
157
|
+
type: this.rounded ? "dots" : "square",
|
|
158
|
+
},
|
|
159
|
+
cornersSquareOptions: {
|
|
160
|
+
type: this.rounded ? "extra-rounded" : "square",
|
|
161
|
+
},
|
|
162
|
+
cornersDotOptions: {
|
|
163
|
+
type: this.rounded ? "dot" : "square",
|
|
164
|
+
},
|
|
165
|
+
imageOptions: {
|
|
166
|
+
margin: 2,
|
|
167
|
+
imageSize: this.logoSize,
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
qrCode.append(this.qr);
|
|
171
|
+
}
|
|
172
|
+
render() {
|
|
173
|
+
return (h("div", { ref: (el) => {
|
|
174
|
+
this.qr = el;
|
|
175
|
+
} }));
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const gatacaQrCss = "@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 .modal-window{position:relative;border-radius:6px;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;width:300px;padding:1px;background-color:white;min-height:408px;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 p{font-family:\"Work Sans\", \"Helvetica Neue\", sans-serif;font-weight:normal;font-size:12px;letter-spacing:1px;color:#181B5E}.popUpContainer .modal-window .qrTitleContainer{padding:24px;padding-bottom:0px}.popUpContainer .modal-window .qrTitle{font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .modal-window .qrDescription{font-weight:400;font-size:14px;line-height:16.5px;padding-top:12px;padding-bottom:5px;color:#A1A1A1}.popUpContainer .modal-window .bold{font-weight:600}.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 .reload{height:252px;width:252px;border:1px dashed #A1A1A1;border-radius:12px;position:relative;margin:24px;display:flex;justify-content:center;align-items:center}.popUpContainer #qrwait{display:flex;justify-content:center}.popUpContainer #qrwait,.popUpContainer #notify{width:100%;height:100%;top:0;left:0;border-radius:20px}.popUpContainer #notify{z-index:10;background-color:gray;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;align-self:center;display:flex;flex-direction:column;padding:24px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:20px;background:rgba(255, 255, 255, 0.9);}.popUpContainer .notify-text{font-family:\"Work Sans\";font-style:normal;font-weight:400;font-size:14px;line-height:16px;text-align:center;font-feature-settings:\"salt\" on;color:#8B8B8B;flex:none;order:1;align-self:stretch;flex-grow:0}.popUpContainer .alert{display:flex;flex-direction:row;align-items:center;justify-content:start;width:252px;position:absolute;bottom:0;background:#FFE5E5;border-radius:12px}.popUpContainer .alert img{margin:12px}.popUpContainer .alert p{font-weight:400;font-size:14px;line-height:16px;color:black}.popUpContainer .success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.popUpContainer .success .successMsg{margin-top:20px;font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}";
|
|
180
|
+
|
|
181
|
+
const DEEP_LINK_PREFIX$1 = "https://gataca.page.link/?apn=com.gatacaapp&ibi=com.gataca.wallet&link=";
|
|
182
|
+
//Default values
|
|
183
|
+
const DEFAULT_SESSION_TIMEOUT$1 = 300; //5mins as in connect
|
|
184
|
+
const DEFAULT_POLLING_FREQ = 3;
|
|
185
|
+
const QR_ROLE_CONNECT$1 = "connect";
|
|
186
|
+
const FUNCTION_ROLES$1 = {
|
|
187
|
+
connect: "scan",
|
|
188
|
+
certify: "credential",
|
|
189
|
+
};
|
|
190
|
+
const GatacaQR = class {
|
|
191
|
+
constructor(hostRef) { registerInstance(this, hostRef); 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.v2 = false; this.qrModalTitle = "Quick Access"; this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet"; this.hideBrandTitle = false; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT$1; this.pollingFrequency = DEFAULT_POLLING_FREQ; this.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = RESULT_STATUS.NOT_STARTED; }
|
|
192
|
+
disconnectedCallback() {
|
|
193
|
+
this.stop();
|
|
194
|
+
}
|
|
195
|
+
async componentDidLoad() {
|
|
196
|
+
if (this.autostart) {
|
|
197
|
+
await this.display();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Force manually the display of a QR
|
|
202
|
+
*/
|
|
203
|
+
async display() {
|
|
204
|
+
await this.getSessionId();
|
|
205
|
+
this.result = RESULT_STATUS.ONGOING;
|
|
206
|
+
this.poll()
|
|
207
|
+
.then((data) => {
|
|
208
|
+
this.result = RESULT_STATUS.SUCCESS;
|
|
209
|
+
this.sessionData = data;
|
|
210
|
+
this.gatacaLoginCompleted.emit(data);
|
|
211
|
+
this.successCallback(data);
|
|
212
|
+
})
|
|
213
|
+
.catch((err) => {
|
|
214
|
+
this.clean();
|
|
215
|
+
let expired = err === RESULT_STATUS.EXPIRED;
|
|
216
|
+
if (expired && this.autorefresh) {
|
|
217
|
+
this.display();
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
if (err !== RESULT_STATUS.NOT_STARTED) {
|
|
221
|
+
let error = expired
|
|
222
|
+
? new Error("User did not scan the QR in the alloted time")
|
|
223
|
+
: new Error("Provided user credentials couldn't be validated");
|
|
224
|
+
this.result = err;
|
|
225
|
+
this.gatacaLoginFailed.emit(error);
|
|
226
|
+
this.errorCallback(error);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
if (checkMobile() && this.dynamicLink) {
|
|
231
|
+
window.location.href = this.getLink();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Stop manually an ongoing session
|
|
236
|
+
*/
|
|
237
|
+
async stop() {
|
|
238
|
+
this.clean();
|
|
239
|
+
if (this.result === RESULT_STATUS.ONGOING) {
|
|
240
|
+
this.result = RESULT_STATUS.NOT_STARTED;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
clean() {
|
|
244
|
+
this.sessionData = undefined;
|
|
245
|
+
this.sessionId = undefined;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Retrieve manually the session data on a successful login
|
|
249
|
+
*/
|
|
250
|
+
async getSessionData() {
|
|
251
|
+
return this.sessionData
|
|
252
|
+
? Promise.resolve(this.sessionData)
|
|
253
|
+
: Promise.reject(new Error("No successful login"));
|
|
254
|
+
}
|
|
255
|
+
async getSessionId() {
|
|
256
|
+
if (this.sessionId) {
|
|
257
|
+
return this.sessionId;
|
|
258
|
+
}
|
|
259
|
+
let { sessionId, authenticationRequest } = await this.createSession();
|
|
260
|
+
this.sessionId = sessionId;
|
|
261
|
+
this.authenticationRequest = authenticationRequest;
|
|
262
|
+
return this.sessionId;
|
|
263
|
+
}
|
|
264
|
+
getLink() {
|
|
265
|
+
if (this.v2 && this.qrRole == QR_ROLE_CONNECT$1) {
|
|
266
|
+
return this.authenticationRequest;
|
|
267
|
+
}
|
|
268
|
+
let op = FUNCTION_ROLES$1[this.qrRole];
|
|
269
|
+
let link = "https://gataca.page.link/" + op + "?";
|
|
270
|
+
link +=
|
|
271
|
+
this.qrRole === QR_ROLE_CONNECT$1
|
|
272
|
+
? "session=" + this.sessionId
|
|
273
|
+
: "process=" + this.sessionId;
|
|
274
|
+
link +=
|
|
275
|
+
"&callback=" + base64UrlEncode(encodeURIComponent(this.callbackServer));
|
|
276
|
+
link = encodeURIComponent(link);
|
|
277
|
+
return this.dynamicLink ? DEEP_LINK_PREFIX$1 + link : link;
|
|
278
|
+
}
|
|
279
|
+
async poll() {
|
|
280
|
+
let endTime = new Date().getTime() +
|
|
281
|
+
(this.sessionTimeout || DEFAULT_SESSION_TIMEOUT$1) * 1000;
|
|
282
|
+
let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
|
|
283
|
+
let checkFunc = async (component) => {
|
|
284
|
+
if (component.result === RESULT_STATUS.NOT_STARTED) {
|
|
285
|
+
return { result: RESULT_STATUS.NOT_STARTED };
|
|
286
|
+
}
|
|
287
|
+
let id = await component.getSessionId();
|
|
288
|
+
return component.checkStatus(id);
|
|
289
|
+
};
|
|
290
|
+
let component = this;
|
|
291
|
+
let checkCondition = async function (resolve, reject) {
|
|
292
|
+
// If the condition is met, we're done!
|
|
293
|
+
let { result, data } = await checkFunc(component);
|
|
294
|
+
switch (result) {
|
|
295
|
+
case RESULT_STATUS.SUCCESS:
|
|
296
|
+
resolve(data);
|
|
297
|
+
break;
|
|
298
|
+
case RESULT_STATUS.ONGOING:
|
|
299
|
+
if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
|
|
300
|
+
setTimeout(checkCondition, interval, resolve, reject);
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
reject(RESULT_STATUS.EXPIRED);
|
|
304
|
+
}
|
|
305
|
+
break;
|
|
306
|
+
default:
|
|
307
|
+
reject(result);
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
return new Promise(checkCondition);
|
|
312
|
+
}
|
|
313
|
+
renderQRSection() {
|
|
314
|
+
switch (this.result) {
|
|
315
|
+
case RESULT_STATUS.NOT_STARTED:
|
|
316
|
+
return this.renderRetryButton();
|
|
317
|
+
case RESULT_STATUS.ONGOING:
|
|
318
|
+
return this.renderQR(this.getLink(), 300, true);
|
|
319
|
+
case RESULT_STATUS.EXPIRED:
|
|
320
|
+
return this.renderRetryButton("QR Code expired");
|
|
321
|
+
case RESULT_STATUS.FAILED:
|
|
322
|
+
return this.renderRetryButton("User credentials not validated");
|
|
323
|
+
case RESULT_STATUS.SUCCESS:
|
|
324
|
+
return this.renderSuccess();
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
renderSuccess() {
|
|
328
|
+
return (h("div", { class: "success" }, h("img", { src: gatIconCheckSvg, height: 52, width: 52 }), h("p", { class: "successMsg" }, "Successful Connection!")));
|
|
329
|
+
}
|
|
330
|
+
renderRetryButton(errorMessage) {
|
|
331
|
+
return (h("div", { class: "reload" }, h("div", { id: "notify", onClick: () => this.display() }, h("img", { src: gatIconRefreshSvg, height: 24, width: 24 }), h("p", { class: "qrDescription" }, "Click inside the box to "), errorMessage ? (h("p", { class: "qrDescription bold" }, "Refresh QR Code")) : (h("p", { class: "qrDescription bold" }, "Scan QR Code")), errorMessage && (h("div", { class: "alert" }, h("img", { src: gatIconAlertSvg, height: 24, width: 24 }), h("p", null, errorMessage)))), h("div", { id: "qrwait" }, this.renderQR("waiting to start a session", 250))));
|
|
332
|
+
}
|
|
333
|
+
renderQR(value, size, useLogo) {
|
|
334
|
+
return (h("gataca-qrdisplay", { qrData: value, rounded: true, size: size, "logo-size": useLogo ? 0.33 : 0 }));
|
|
335
|
+
}
|
|
336
|
+
render() {
|
|
337
|
+
return (h("div", { class: "popUpContainer" }, h("div", { class: "modal-window is-visible", onClick: (event) => {
|
|
338
|
+
event.stopPropagation();
|
|
339
|
+
} }, h("div", { class: "modal-window__content" }, h("div", { class: "qrTitleContainer" }, h("p", { class: "qrTitle" }, this.qrModalTitle), !this.hideBrandTitle && (h("p", { class: "qrBrand" }, "by Gataca", " ", h("span", null, h("img", { src: logoGatacaSvg })))), this.result !== RESULT_STATUS.SUCCESS && (h("p", { class: "qrDescription" }, this.qrModalDescription))), h("div", { class: "qrSection" }, this.renderQRSection())))));
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
GatacaQR.style = gatacaQrCss;
|
|
343
|
+
|
|
344
|
+
const gatacaQrwsCss = "@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 .modal-window{position:relative;border-radius:6px;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;width:300px;min-height:408px;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 p{font-family:\"Work Sans\", \"Helvetica Neue\", sans-serif;font-weight:normal;font-size:12px;letter-spacing:1px;color:#181B5E}.popUpContainer .modal-window .qrTitleContainer{padding:24px;padding-bottom:0px}.popUpContainer .modal-window .qrTitle{font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .modal-window .qrDescription{font-weight:400;font-size:14px;line-height:16.5px;padding-top:12px;padding-bottom:5px;color:#A1A1A1}.popUpContainer .modal-window .bold{font-weight:600}.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 .reload{height:252px;width:252px;border:1px dashed #A1A1A1;border-radius:12px;position:relative;margin:24px;display:flex;justify-content:center;align-items:center}.popUpContainer #qrwait{display:flex;justify-content:center}.popUpContainer #qrwait,.popUpContainer #notify{width:100%;height:100%;top:0;left:0;border-radius:20px}.popUpContainer #notify{z-index:10;background-color:gray;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;align-self:center;display:flex;flex-direction:column;padding:24px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:20px;background:rgba(255, 255, 255, 0.9);}.popUpContainer .notify-text{font-family:\"Work Sans\";font-style:normal;font-weight:400;font-size:14px;line-height:16px;text-align:center;font-feature-settings:\"salt\" on;color:#8B8B8B;flex:none;order:1;align-self:stretch;flex-grow:0}.popUpContainer .alert{display:flex;flex-direction:row;align-items:center;justify-content:start;width:252px;position:absolute;bottom:0;background:#FFE5E5;border-radius:12px}.popUpContainer .alert img{margin:12px}.popUpContainer .alert p{font-weight:400;font-size:14px;line-height:16px;color:black}.popUpContainer .success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.popUpContainer .success .successMsg{margin-top:20px;font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}";
|
|
345
|
+
|
|
346
|
+
const DEEP_LINK_PREFIX = "https://gataca.page.link/?apn=com.gatacaapp&ibi=com.gataca.wallet&link=";
|
|
347
|
+
const DEFAULT_SESSION_TIMEOUT = 300;
|
|
348
|
+
const QR_ROLE_CONNECT = "connect";
|
|
349
|
+
const FUNCTION_ROLES = {
|
|
350
|
+
connect: "scan",
|
|
351
|
+
certify: "credential",
|
|
352
|
+
};
|
|
353
|
+
const GatacaQRWS = class {
|
|
354
|
+
constructor(hostRef) { registerInstance(this, hostRef); this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7); this.successCallback = undefined; this.errorCallback = undefined; this.qrRole = undefined; this.callbackServer = undefined; this.socketEndpoint = undefined; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT; this.wsOnOpen = undefined; this.wsOnMessage = undefined; this.autostart = true; this.autorefresh = false; this.v2 = false; this.qrModalTitle = "Quick Access"; this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet"; this.hideBrandTitle = false; this.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = RESULT_STATUS.NOT_STARTED; }
|
|
355
|
+
disconnectedCallback() {
|
|
356
|
+
this.stop();
|
|
357
|
+
}
|
|
358
|
+
async componentDidLoad() {
|
|
359
|
+
if (this.autostart) {
|
|
360
|
+
await this.display();
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Force manually the display of a QR
|
|
365
|
+
*/
|
|
366
|
+
async display() {
|
|
367
|
+
let socket = new WebSocket(this.socketEndpoint);
|
|
368
|
+
setTimeout(() => {
|
|
369
|
+
this.socket.close(1000, "");
|
|
370
|
+
}, 1000 * this.sessionTimeout);
|
|
371
|
+
this.socket = socket;
|
|
372
|
+
socket.onopen = () => {
|
|
373
|
+
if (this.wsOnOpen)
|
|
374
|
+
this.wsOnOpen(this.socket);
|
|
375
|
+
};
|
|
376
|
+
socket.onmessage = (msg) => {
|
|
377
|
+
if (this.wsOnMessage) {
|
|
378
|
+
this.wsOnMessage(this.socket, msg);
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
let wsresp = JSON.parse(msg.data);
|
|
382
|
+
if (!!wsresp.sessionId) {
|
|
383
|
+
this.handleWSResponse(wsresp);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
socket.onerror = () => {
|
|
388
|
+
let error = new Error("Error connecting with server");
|
|
389
|
+
this.result = RESULT_STATUS.FAILED;
|
|
390
|
+
this.gatacaLoginFailed.emit(error);
|
|
391
|
+
this.errorCallback(error);
|
|
392
|
+
socket.close(1000, "");
|
|
393
|
+
};
|
|
394
|
+
socket.onclose = () => {
|
|
395
|
+
if (this.result === RESULT_STATUS.ONGOING) {
|
|
396
|
+
this.result = RESULT_STATUS.EXPIRED;
|
|
397
|
+
}
|
|
398
|
+
if (this.result === RESULT_STATUS.EXPIRED) {
|
|
399
|
+
if (this.autorefresh) {
|
|
400
|
+
this.display();
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
let error = new Error("User did not scan the QR in the alloted time");
|
|
404
|
+
this.gatacaLoginFailed.emit(error);
|
|
405
|
+
this.errorCallback(error);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
if (checkMobile() && this.dynamicLink) {
|
|
410
|
+
window.location.href = this.getLink();
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
sessionMsgReceived(event) {
|
|
414
|
+
let wsresp = event.detail;
|
|
415
|
+
this.handleWSResponse(wsresp);
|
|
416
|
+
}
|
|
417
|
+
handleWSResponse(wsresp) {
|
|
418
|
+
this.result = wsresp.result;
|
|
419
|
+
switch (wsresp.result) {
|
|
420
|
+
case RESULT_STATUS.ONGOING:
|
|
421
|
+
this.sessionId = wsresp.sessionId;
|
|
422
|
+
this.authenticationRequest = wsresp.authenticationRequest;
|
|
423
|
+
break;
|
|
424
|
+
case RESULT_STATUS.SUCCESS:
|
|
425
|
+
this.sessionData = wsresp.authenticatedUserData;
|
|
426
|
+
this.gatacaLoginCompleted.emit(wsresp.authenticatedUserData);
|
|
427
|
+
this.successCallback(wsresp.authenticatedUserData);
|
|
428
|
+
this.socket.close(1000, "");
|
|
429
|
+
break;
|
|
430
|
+
case RESULT_STATUS.FAILED:
|
|
431
|
+
this.socket.close();
|
|
432
|
+
let error = new Error("Provided user credentials couldn't be validated");
|
|
433
|
+
this.gatacaLoginFailed.emit(error);
|
|
434
|
+
this.errorCallback(error);
|
|
435
|
+
break;
|
|
436
|
+
case RESULT_STATUS.EXPIRED:
|
|
437
|
+
this.socket.close();
|
|
438
|
+
if (this.autorefresh) {
|
|
439
|
+
this.display();
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
let error = new Error("User did not scan the QR in the alloted time");
|
|
443
|
+
this.gatacaLoginFailed.emit(error);
|
|
444
|
+
this.errorCallback(error);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Stop manually an ongoing session
|
|
450
|
+
*/
|
|
451
|
+
async stop() {
|
|
452
|
+
this.sessionData = undefined;
|
|
453
|
+
this.sessionId = undefined;
|
|
454
|
+
this.socket.close(1000, "Client stopped the connection");
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Retrieve manually the session data on a successful login
|
|
458
|
+
*/
|
|
459
|
+
async getSessionData() {
|
|
460
|
+
return this.sessionData
|
|
461
|
+
? Promise.resolve(this.sessionData)
|
|
462
|
+
: Promise.reject(new Error("No successful login"));
|
|
463
|
+
}
|
|
464
|
+
getLink() {
|
|
465
|
+
if (this.v2 && this.qrRole == QR_ROLE_CONNECT) {
|
|
466
|
+
return this.authenticationRequest;
|
|
467
|
+
}
|
|
468
|
+
let op = FUNCTION_ROLES[this.qrRole];
|
|
469
|
+
let link = "https://gataca.page.link/" + op + "?";
|
|
470
|
+
link +=
|
|
471
|
+
this.qrRole === QR_ROLE_CONNECT
|
|
472
|
+
? "session=" + this.sessionId
|
|
473
|
+
: "process=" + this.sessionId;
|
|
474
|
+
link +=
|
|
475
|
+
"&callback=" + base64UrlEncode(encodeURIComponent(this.callbackServer));
|
|
476
|
+
link = encodeURIComponent(link);
|
|
477
|
+
return this.dynamicLink ? DEEP_LINK_PREFIX + link : link;
|
|
478
|
+
}
|
|
479
|
+
renderQRSection() {
|
|
480
|
+
switch (this.result) {
|
|
481
|
+
case RESULT_STATUS.NOT_STARTED:
|
|
482
|
+
return this.renderRetryButton();
|
|
483
|
+
case RESULT_STATUS.ONGOING:
|
|
484
|
+
return this.renderQR(this.getLink(), 300, true);
|
|
485
|
+
case RESULT_STATUS.EXPIRED:
|
|
486
|
+
return this.renderRetryButton("QR Code expired");
|
|
487
|
+
case RESULT_STATUS.FAILED:
|
|
488
|
+
return this.renderRetryButton("User credentials not validated");
|
|
489
|
+
case RESULT_STATUS.SUCCESS:
|
|
490
|
+
return this.renderSuccess();
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
renderSuccess() {
|
|
494
|
+
return (h("div", { class: "success" }, h("img", { src: gatIconCheckSvg, height: 52, width: 52 }), h("p", { class: "successMsg" }, "Successful Connection!")));
|
|
495
|
+
}
|
|
496
|
+
renderRetryButton(errorMessage) {
|
|
497
|
+
return (h("div", { class: "reload" }, h("div", { id: "notify", onClick: () => this.display() }, h("img", { src: gatIconRefreshSvg, height: 24, width: 24 }), h("p", { class: "qrDescription" }, "Click inside the box to "), errorMessage ? (h("p", { class: "qrDescription bold" }, "Refresh QR Code")) : (h("p", { class: "qrDescription bold" }, "Scan QR Code")), errorMessage && (h("div", { class: "alert" }, h("img", { src: gatIconAlertSvg, height: 24, width: 24 }), h("p", null, errorMessage)))), h("div", { id: "qrwait" }, this.renderQR("waiting to start a session", 250))));
|
|
498
|
+
}
|
|
499
|
+
renderQR(value, size, useLogo) {
|
|
500
|
+
return (h("gataca-qrdisplay", { qrData: value, rounded: true, size: size, "logo-size": useLogo ? 0.33 : 0 }));
|
|
501
|
+
}
|
|
502
|
+
render() {
|
|
503
|
+
return (h("div", { class: "popUpContainer" }, h("div", { class: "modal-window is-visible", onClick: (event) => {
|
|
504
|
+
event.stopPropagation();
|
|
505
|
+
} }, h("div", { class: "modal-window__content" }, h("div", { class: "qrTitleContainer" }, h("p", { class: "qrTitle" }, this.qrModalTitle), !this.hideBrandTitle && (h("p", { class: "qrBrand" }, "by Gataca", " ", h("span", null, h("img", { src: logoGatacaSvg })))), this.result !== RESULT_STATUS.SUCCESS && (h("p", { class: "qrDescription" }, this.qrModalDescription))), h("div", { class: "qrSection" }, this.renderQRSection())))));
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
GatacaQRWS.style = gatacaQrwsCss;
|
|
509
|
+
|
|
510
|
+
const gatacaSsibuttonCss = "@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}";
|
|
511
|
+
|
|
512
|
+
const PHONE_ICON$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAYAAACN1PRVAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHvSURBVHgB3ZZPTttAFMbfe3YjL7qYLopcpZXSG7Q3CDfIsqrSJpyg5QQtJ2h7glgUdVs4AeEE5AYEQSDAgtnw357Hm0hAQDaeIRFCfFKyeKPxzzPzvc+DUKCZN80GEv1ABgWOQgSdGbOwv7u0nDueV4zjTzUIKhuAZna4vdQFR828azbI0K/TI/qodaLvjlP+tLDGDCs+IKv9Lbsi7kcv0w9541Q0EREPYcoieEQ9KiyECRXHzbpBUOcnYTfPFOOaaGVx9WsLiDrSIp0iU0wFNgIx/AQyc9I/OmOjy+Y8aBvHQcDUYebewc6/Xtk8J5htcg5efEPGhk0JtqkyBjo7DuZcnuO2sqCyKv8rUDmfTS9IBURqBAL+I6CkzBjOMOs22TLY21n8fl17KzXR3uDvb/CQk0GEdfvN07QvpnAOaGfYaRT25JzU6+rnG2tTpcWAy+Cp0m3U/URLms8HWfg/rn6RFaGSs9KQkZMpvGBWNs2Vandt46ac6YNBuc0fDLMaOU5DFybQ8039p/KJ4bq4rwPewtqoM/1gsCm/NfBXvWjgHhhuDAeLyd3qVSifHQULeZkou9EqemLhmUmav8qrZ4GEMGA7ivzjKvfeqGptFV2YdWPMPHHq0cCh3DdpVdLl/XCY9J1gVvbCiWa6N+JLocPFjCsx9cAAAAAASUVORK5CYII=";
|
|
513
|
+
const GatacaSSIButton = class {
|
|
514
|
+
constructor(hostRef) {
|
|
515
|
+
registerInstance(this, hostRef);
|
|
516
|
+
this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
|
|
517
|
+
this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
|
|
518
|
+
this.buttonText = "Easy login";
|
|
519
|
+
this.checkStatus = undefined;
|
|
520
|
+
this.createSession = undefined;
|
|
521
|
+
this.successCallback = undefined;
|
|
522
|
+
this.errorCallback = undefined;
|
|
523
|
+
this.qrRole = undefined;
|
|
524
|
+
this.callbackServer = undefined;
|
|
525
|
+
this.sessionTimeout = undefined;
|
|
526
|
+
this.pollingFrequency = undefined;
|
|
527
|
+
this.autorefresh = false;
|
|
528
|
+
this.v2 = false;
|
|
529
|
+
this.qrModalTitle = "Quick Access";
|
|
530
|
+
this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
|
|
531
|
+
this.hideBrandTitle = false;
|
|
532
|
+
this.dynamicLink = true;
|
|
533
|
+
this.open = false;
|
|
534
|
+
this.qr = (h("gataca-qr", { checkStatus: this.checkStatus, createSession: this.createSession, successCallback: this.successCallback, errorCallback: this.errorCallback, qrRole: this.qrRole, callbackServer: this.callbackServer, sessionTimeout: this.sessionTimeout, pollingFrequency: this.pollingFrequency, autostart: true, autorefresh: this.autorefresh, v2: this.v2, qrModalTitle: this.qrModalTitle, qrModalDescription: this.qrModalDescription, hideBrandTitle: this.hideBrandTitle, dynamicLink: this.dynamicLink }));
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Retrieve manually the session data on a successful login
|
|
538
|
+
*/
|
|
539
|
+
async getSessionData() {
|
|
540
|
+
return this.qr.getSessionData();
|
|
541
|
+
}
|
|
542
|
+
renderModal() {
|
|
543
|
+
return this.qr;
|
|
544
|
+
}
|
|
545
|
+
renderButton() {
|
|
546
|
+
return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
|
|
547
|
+
this.open = !this.open;
|
|
548
|
+
if (this.open) {
|
|
549
|
+
this.qr.display();
|
|
550
|
+
}
|
|
551
|
+
else {
|
|
552
|
+
this.qr.stop();
|
|
553
|
+
}
|
|
554
|
+
} }, h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
|
|
555
|
+
}
|
|
556
|
+
render() {
|
|
557
|
+
return (h("div", { class: "buttonContainer" }, this.renderButton(), this.open && this.renderModal()));
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
GatacaSSIButton.style = gatacaSsibuttonCss;
|
|
561
|
+
|
|
562
|
+
const gatacaSsibuttonwsCss = "@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}";
|
|
563
|
+
|
|
564
|
+
const PHONE_ICON = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAYAAACN1PRVAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHvSURBVHgB3ZZPTttAFMbfe3YjL7qYLopcpZXSG7Q3CDfIsqrSJpyg5QQtJ2h7glgUdVs4AeEE5AYEQSDAgtnw357Hm0hAQDaeIRFCfFKyeKPxzzPzvc+DUKCZN80GEv1ABgWOQgSdGbOwv7u0nDueV4zjTzUIKhuAZna4vdQFR828azbI0K/TI/qodaLvjlP+tLDGDCs+IKv9Lbsi7kcv0w9541Q0EREPYcoieEQ9KiyECRXHzbpBUOcnYTfPFOOaaGVx9WsLiDrSIp0iU0wFNgIx/AQyc9I/OmOjy+Y8aBvHQcDUYebewc6/Xtk8J5htcg5efEPGhk0JtqkyBjo7DuZcnuO2sqCyKv8rUDmfTS9IBURqBAL+I6CkzBjOMOs22TLY21n8fl17KzXR3uDvb/CQk0GEdfvN07QvpnAOaGfYaRT25JzU6+rnG2tTpcWAy+Cp0m3U/URLms8HWfg/rn6RFaGSs9KQkZMpvGBWNs2Vandt46ac6YNBuc0fDLMaOU5DFybQ8039p/KJ4bq4rwPewtqoM/1gsCm/NfBXvWjgHhhuDAeLyd3qVSifHQULeZkou9EqemLhmUmav8qrZ4GEMGA7ivzjKvfeqGptFV2YdWPMPHHq0cCh3DdpVdLl/XCY9J1gVvbCiWa6N+JLocPFjCsx9cAAAAAASUVORK5CYII=";
|
|
565
|
+
const GatacaSSIButtonWS = class {
|
|
566
|
+
constructor(hostRef) {
|
|
567
|
+
registerInstance(this, hostRef);
|
|
568
|
+
this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
|
|
569
|
+
this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
|
|
570
|
+
this.buttonText = "Easy login";
|
|
571
|
+
this.successCallback = undefined;
|
|
572
|
+
this.errorCallback = undefined;
|
|
573
|
+
this.qrRole = undefined;
|
|
574
|
+
this.callbackServer = undefined;
|
|
575
|
+
this.socketEndpoint = undefined;
|
|
576
|
+
this.sessionTimeout = undefined;
|
|
577
|
+
this.wsOnOpen = undefined;
|
|
578
|
+
this.wsOnMessage = undefined;
|
|
579
|
+
this.autostart = true;
|
|
580
|
+
this.autorefresh = false;
|
|
581
|
+
this.v2 = false;
|
|
582
|
+
this.qrModalTitle = "Quick Access";
|
|
583
|
+
this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
|
|
584
|
+
this.hideBrandTitle = false;
|
|
585
|
+
this.dynamicLink = true;
|
|
586
|
+
this.open = false;
|
|
587
|
+
this.qr = (h("gataca-qrws", { wsOnMessage: this.wsOnMessage, wsOnOpen: this.wsOnOpen, successCallback: this.successCallback, errorCallback: this.errorCallback, qrRole: this.qrRole, callbackServer: this.callbackServer, sessionTimeout: this.sessionTimeout, socketEndpoint: this.socketEndpoint, autostart: true, autorefresh: this.autorefresh, v2: this.v2, qrModalTitle: this.qrModalTitle, qrModalDescription: this.qrModalDescription, hideBrandTitle: this.hideBrandTitle, dynamicLink: this.dynamicLink }));
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Retrieve manually the session data on a successful login
|
|
591
|
+
*/
|
|
592
|
+
async getSessionData() {
|
|
593
|
+
return this.qr.getSessionData();
|
|
594
|
+
}
|
|
595
|
+
renderModal() {
|
|
596
|
+
return this.qr;
|
|
597
|
+
}
|
|
598
|
+
renderButton() {
|
|
599
|
+
return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
|
|
600
|
+
this.open = !this.open;
|
|
601
|
+
if (this.open) {
|
|
602
|
+
this.qr.display();
|
|
603
|
+
}
|
|
604
|
+
else {
|
|
605
|
+
this.qr.stop();
|
|
606
|
+
}
|
|
607
|
+
} }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
|
|
608
|
+
}
|
|
609
|
+
render() {
|
|
610
|
+
return (h("div", { class: "buttonContainer" }, this.renderButton(), this.open && this.renderModal()));
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
GatacaSSIButtonWS.style = gatacaSsibuttonwsCss;
|
|
614
|
+
|
|
615
|
+
export { GatacaAutoQR as gataca_autoqr, GatacaQR as gataca_qr, GatacaQRDisplay as gataca_qrdisplay, GatacaQRWS as gataca_qrws, GatacaSSIButton as gataca_ssibutton, GatacaSSIButtonWS as gataca_ssibuttonws };
|
package/dist/esm/gatacaqr.js
CHANGED
|
@@ -13,5 +13,5 @@ const patchBrowser = () => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
patchBrowser().then(options => {
|
|
16
|
-
return bootstrapLazy([["gataca-
|
|
16
|
+
return bootstrapLazy([["gataca-autoqr_6",[[1,"gataca-autoqr",{"configId":[1,"config-id"],"configRepository":[1,"config-repository"],"successCallback":[16],"errorCallback":[16],"checkStatus":[16],"createSession":[16],"wsOnOpen":[16],"wsOnMessage":[16],"config":[32],"loading":[32],"getSessionData":[64]}],[1,"gataca-ssibutton",{"buttonText":[1,"button-text"],"checkStatus":[16],"createSession":[16],"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"sessionTimeout":[2,"session-timeout"],"pollingFrequency":[2,"polling-frequency"],"autorefresh":[4],"v2":[4,"v-2"],"qrModalTitle":[1,"qr-modal-title"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"open":[32],"getSessionData":[64]}],[1,"gataca-ssibuttonws",{"buttonText":[1,"button-text"],"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"socketEndpoint":[1,"socket-endpoint"],"sessionTimeout":[2,"session-timeout"],"wsOnOpen":[16],"wsOnMessage":[16],"autostart":[4],"autorefresh":[4],"v2":[4,"v-2"],"qrModalTitle":[1,"qr-modal-title"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"open":[32],"getSessionData":[64]}],[1,"gataca-qr",{"checkStatus":[16],"createSession":[16],"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"autostart":[4],"autorefresh":[4],"v2":[4,"v-2"],"qrModalTitle":[1,"qr-modal-title"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"sessionTimeout":[2,"session-timeout"],"pollingFrequency":[2,"polling-frequency"],"dynamicLink":[4,"dynamic-link"],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"display":[64],"stop":[64],"getSessionData":[64]}],[1,"gataca-qrws",{"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"socketEndpoint":[1,"socket-endpoint"],"sessionTimeout":[2,"session-timeout"],"wsOnOpen":[16],"wsOnMessage":[16],"autostart":[4],"autorefresh":[4],"v2":[4,"v-2"],"qrModalTitle":[1,"qr-modal-title"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"display":[64],"stop":[64],"getSessionData":[64]},[[2,"sessionMsg","sessionMsgReceived"]]],[0,"gataca-qrdisplay",{"qrData":[1,"qr-data"],"size":[2],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrColor":[1,"qr-color"],"rounded":[4]}]]]], options);
|
|
17
17
|
});
|