@gataca/qr 0.0.9 → 0.0.11
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/gat-icon-alert-6127161a.js} +15 -1
- package/dist/cjs/{gataca-qr_2.cjs.entry.js → gataca-qr_3.cjs.entry.js} +277 -14
- package/dist/cjs/gataca-qrws.cjs.entry.js +1 -2
- package/dist/cjs/gataca-ssibuttonws.cjs.entry.js +60 -0
- package/dist/cjs/gatacaqr.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/gataca-qr/components/qr/QR.js +2 -2
- package/dist/collection/components/gataca-qr/gataca-qr.js +22 -3
- package/dist/collection/components/gataca-qrdisplay/gataca-qrdisplay.js +6 -2
- package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.js +26 -2
- package/dist/components/gataca-qr2.js +8 -5
- package/dist/components/gataca-qrdisplay2.js +6 -2
- package/dist/components/gataca-ssibutton2.js +10 -2
- package/dist/{cjs/qr-code-styling-412bbc7a.js → esm/gat-icon-alert-c9761842.js} +8 -2
- package/dist/esm/{gataca-qr_2.entry.js → gataca-qr_3.entry.js} +276 -14
- package/dist/esm/gataca-qrws.entry.js +1 -2
- package/dist/esm/gataca-ssibuttonws.entry.js +56 -0
- 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-739f5316.entry.js +1 -0
- package/dist/gatacaqr/p-8464955a.entry.js +1 -0
- package/dist/gatacaqr/p-bdd385ad.entry.js +1 -0
- package/dist/gatacaqr/p-d79c8f74.js +1 -0
- package/dist/types/components/gataca-qr/components/qr/QR.d.ts +1 -0
- package/dist/types/components/gataca-qr/gataca-qr.d.ts +5 -0
- package/dist/types/components/gataca-ssibutton/gataca-ssibutton.d.ts +5 -0
- package/dist/types/components.d.ts +16 -0
- package/package.json +1 -1
- package/dist/cjs/gat-icon-alert-0ad19b26.js +0 -14
- package/dist/cjs/gataca-ssibutton_2.cjs.entry.js +0 -313
- package/dist/esm/gat-icon-alert-7b06ef3a.js +0 -9
- package/dist/esm/gataca-ssibutton_2.entry.js +0 -308
- package/dist/gatacaqr/p-0be4566d.js +0 -1
- package/dist/gatacaqr/p-16298cb4.entry.js +0 -1
- package/dist/gatacaqr/p-78f503dc.entry.js +0 -1
- package/dist/gatacaqr/p-9e9af27e.entry.js +0 -1
- package/dist/gatacaqr/p-ea783014.js +0 -1
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-93d47a75.js');
|
|
6
|
-
require('./qr-code-styling-412bbc7a.js');
|
|
7
|
-
const utils = require('./utils-ef28b844.js');
|
|
8
|
-
|
|
9
|
-
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}";
|
|
10
|
-
|
|
11
|
-
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=";
|
|
12
|
-
//Default values
|
|
13
|
-
const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
|
|
14
|
-
const DEFAULT_POLLING_FREQ = 3;
|
|
15
|
-
const GatacaSSIButton = class {
|
|
16
|
-
constructor(hostRef) {
|
|
17
|
-
index.registerInstance(this, hostRef);
|
|
18
|
-
this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7);
|
|
19
|
-
this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7);
|
|
20
|
-
this.buttonText = "Easy login";
|
|
21
|
-
this.autostart = true;
|
|
22
|
-
this.checkStatus = undefined;
|
|
23
|
-
this.createSession = undefined;
|
|
24
|
-
this.successCallback = undefined;
|
|
25
|
-
this.errorCallback = undefined;
|
|
26
|
-
this.handleCheckAppLoading = undefined;
|
|
27
|
-
this.checkAppTimeout = 6;
|
|
28
|
-
this.qrRole = undefined;
|
|
29
|
-
this.callbackServer = undefined;
|
|
30
|
-
this.sessionTimeout = undefined;
|
|
31
|
-
this.pollingFrequency = undefined;
|
|
32
|
-
this.autorefresh = false;
|
|
33
|
-
this.v = "3";
|
|
34
|
-
this.qrModalTitle = "Quick Access";
|
|
35
|
-
this.modalTitleColor = "#4745B7";
|
|
36
|
-
this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
|
|
37
|
-
this.hideBrandTitle = false;
|
|
38
|
-
this.dynamicLink = true;
|
|
39
|
-
this.logoSize = 0;
|
|
40
|
-
this.logoSrc = undefined;
|
|
41
|
-
this.qrCodeExpiredLabel = "QR Code expired";
|
|
42
|
-
this.credentialsNotValidatedLabel = "User credentials not validated";
|
|
43
|
-
this.clickInsideBoxLabel = "Click inside the box to";
|
|
44
|
-
this.refreshQrLabel = "Refresh QR Code";
|
|
45
|
-
this.scanQrLabel = "Scan QR Code";
|
|
46
|
-
this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time";
|
|
47
|
-
this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated";
|
|
48
|
-
this.failedLoginErrorLabel = "No successful login";
|
|
49
|
-
this.successLoginLabel = "Successful Connection!";
|
|
50
|
-
this.byBrandLabel = "by Gataca";
|
|
51
|
-
this.waitingStartSessionLabel = "waiting to start a session";
|
|
52
|
-
this.hideQrModalDescription = false;
|
|
53
|
-
this.open = false;
|
|
54
|
-
this.sessionId = undefined;
|
|
55
|
-
this.authenticationRequest = undefined;
|
|
56
|
-
this.sessionData = undefined;
|
|
57
|
-
this.result = utils.RESULT_STATUS.NOT_STARTED;
|
|
58
|
-
this.qr = (index.h("gataca-qr", { ref: (el) => (this.qrElement = el), 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: this.autostart, autorefresh: this.autorefresh, v: this.v, qrModalTitle: this.qrModalTitle, qrModalDescription: this.qrModalDescription, hideBrandTitle: this.hideBrandTitle, dynamicLink: this.dynamicLink, logoSize: this.logoSize, logoSrc: this.logoSrc, modalTitleColor: this.modalTitleColor, qrCodeExpiredLabel: this.qrCodeExpiredLabel, credentialsNotValidatedLabel: this.credentialsNotValidatedLabel, clickInsideBoxLabel: this.clickInsideBoxLabel, refreshQrLabel: this.refreshQrLabel, scanQrLabel: this.scanQrLabel, userNotScanInTimeErrorLabel: this.userNotScanInTimeErrorLabel, credsNotValidatedErrorLabel: this.credsNotValidatedErrorLabel, failedLoginErrorLabel: this.failedLoginErrorLabel, successLoginLabel: this.successLoginLabel, byBrandLabel: this.byBrandLabel, waitingStartSessionLabel: this.waitingStartSessionLabel, hideQrModalDescription: this.hideQrModalDescription }));
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Retrieve manually the session data on a successful login
|
|
62
|
-
*/
|
|
63
|
-
async getSessionData() {
|
|
64
|
-
return this.qr.getSessionData();
|
|
65
|
-
}
|
|
66
|
-
async getSessionId() {
|
|
67
|
-
if (this.sessionId) {
|
|
68
|
-
return this.sessionId;
|
|
69
|
-
}
|
|
70
|
-
let { sessionId, authenticationRequest } = await this.createSession();
|
|
71
|
-
this.sessionId = sessionId;
|
|
72
|
-
this.authenticationRequest = authenticationRequest;
|
|
73
|
-
return this.sessionId;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Force manually the start polling
|
|
77
|
-
*/
|
|
78
|
-
async startMobilePolling() {
|
|
79
|
-
await this.getSessionId();
|
|
80
|
-
this.result = utils.RESULT_STATUS.ONGOING;
|
|
81
|
-
this.poll()
|
|
82
|
-
.then((data) => {
|
|
83
|
-
this.result = utils.RESULT_STATUS.SUCCESS;
|
|
84
|
-
this.sessionData = data;
|
|
85
|
-
this.gatacaLoginCompleted.emit(data);
|
|
86
|
-
this.successCallback(data);
|
|
87
|
-
})
|
|
88
|
-
.catch((err) => {
|
|
89
|
-
this.clean();
|
|
90
|
-
let expired = err === utils.RESULT_STATUS.EXPIRED;
|
|
91
|
-
if (expired && this.autorefresh) {
|
|
92
|
-
this.startMobilePolling();
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
if (err !== utils.RESULT_STATUS.NOT_STARTED) {
|
|
96
|
-
let error = expired
|
|
97
|
-
? new Error(this.userNotScanInTimeErrorLabel)
|
|
98
|
-
: new Error(this.credsNotValidatedErrorLabel);
|
|
99
|
-
this.result = err;
|
|
100
|
-
this.gatacaLoginFailed.emit(error);
|
|
101
|
-
this.errorCallback(error);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Stop manually an ongoing session
|
|
108
|
-
*/
|
|
109
|
-
async stop() {
|
|
110
|
-
this.clean();
|
|
111
|
-
if (this.result === utils.RESULT_STATUS.ONGOING || utils.RESULT_STATUS.READ) {
|
|
112
|
-
this.result = utils.RESULT_STATUS.NOT_STARTED;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
clean() {
|
|
116
|
-
this.sessionData = undefined;
|
|
117
|
-
this.sessionId = undefined;
|
|
118
|
-
}
|
|
119
|
-
renderModal() {
|
|
120
|
-
return this.qr;
|
|
121
|
-
}
|
|
122
|
-
async poll() {
|
|
123
|
-
let endTime = new Date().getTime() +
|
|
124
|
-
(this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
|
|
125
|
-
let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
|
|
126
|
-
let checkFunc = async (component) => {
|
|
127
|
-
if (component.result === utils.RESULT_STATUS.NOT_STARTED) {
|
|
128
|
-
return { result: utils.RESULT_STATUS.NOT_STARTED };
|
|
129
|
-
}
|
|
130
|
-
let id = await component.getSessionId();
|
|
131
|
-
return component.checkStatus(id);
|
|
132
|
-
};
|
|
133
|
-
let component = this;
|
|
134
|
-
let checkCondition = async function (resolve, reject) {
|
|
135
|
-
// If the condition is met, we're done!
|
|
136
|
-
let { result, data } = await checkFunc(component);
|
|
137
|
-
switch (result) {
|
|
138
|
-
case utils.RESULT_STATUS.SUCCESS:
|
|
139
|
-
resolve(data);
|
|
140
|
-
break;
|
|
141
|
-
case utils.RESULT_STATUS.READ:
|
|
142
|
-
component.result = utils.RESULT_STATUS.READ;
|
|
143
|
-
case utils.RESULT_STATUS.ONGOING:
|
|
144
|
-
if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
|
|
145
|
-
setTimeout(checkCondition, interval, resolve, reject);
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
reject(utils.RESULT_STATUS.EXPIRED);
|
|
149
|
-
}
|
|
150
|
-
break;
|
|
151
|
-
default:
|
|
152
|
-
reject(result);
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
return new Promise(checkCondition);
|
|
157
|
-
}
|
|
158
|
-
isAppInstalled(appScheme, callback) {
|
|
159
|
-
let timeout;
|
|
160
|
-
let detected = false;
|
|
161
|
-
if (appScheme === null || appScheme === void 0 ? void 0 : appScheme.length) {
|
|
162
|
-
window.location.href = appScheme;
|
|
163
|
-
}
|
|
164
|
-
const waitTimeToCheckApp = this.checkAppTimeout * 1000;
|
|
165
|
-
timeout = setTimeout(() => {
|
|
166
|
-
if (!detected) {
|
|
167
|
-
callback(false);
|
|
168
|
-
}
|
|
169
|
-
cleanup();
|
|
170
|
-
}, waitTimeToCheckApp);
|
|
171
|
-
const handleVisibilityChange = () => {
|
|
172
|
-
if (document.hidden) {
|
|
173
|
-
detected = true;
|
|
174
|
-
callback(true);
|
|
175
|
-
this.startMobilePolling();
|
|
176
|
-
cleanup();
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
180
|
-
function cleanup() {
|
|
181
|
-
clearTimeout(timeout);
|
|
182
|
-
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
renderDesktopButton() {
|
|
186
|
-
return (index.h("div", { class: "gatacaButtonWrapper" }, index.h("button", { class: "gatacaButton", onClick: () => {
|
|
187
|
-
this.open = !this.open;
|
|
188
|
-
setTimeout(() => {
|
|
189
|
-
var _a, _b;
|
|
190
|
-
if (this.open) {
|
|
191
|
-
(_a = this.qrElement) === null || _a === void 0 ? void 0 : _a.display();
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
(_b = this.qrElement) === null || _b === void 0 ? void 0 : _b.stop();
|
|
195
|
-
}
|
|
196
|
-
}, 0);
|
|
197
|
-
} }, index.h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), index.h("span", null, this.buttonText))));
|
|
198
|
-
}
|
|
199
|
-
async getAuthRequest() {
|
|
200
|
-
let { authenticationRequest } = await this.createSession();
|
|
201
|
-
return authenticationRequest;
|
|
202
|
-
}
|
|
203
|
-
renderMobileButton(isAndroid, isIos) {
|
|
204
|
-
if (this.autostart) {
|
|
205
|
-
this.startMobilePolling();
|
|
206
|
-
}
|
|
207
|
-
let loading = false;
|
|
208
|
-
const handleLoading = (isLoading) => {
|
|
209
|
-
loading = isLoading;
|
|
210
|
-
if (this.handleCheckAppLoading) {
|
|
211
|
-
this.handleCheckAppLoading(isLoading);
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
const executeRedirection = async () => {
|
|
215
|
-
handleLoading(true);
|
|
216
|
-
const androidStoreLink = "https://play.google.com/store/apps/details?id=com.gataca.identity";
|
|
217
|
-
const iosStoreLink = "https://apps.apple.com/us/app/gataca/id1498607616";
|
|
218
|
-
try {
|
|
219
|
-
const appScheme = await this.getAuthRequest();
|
|
220
|
-
this.isAppInstalled(appScheme, (installed) => {
|
|
221
|
-
if (!installed) {
|
|
222
|
-
this.stop();
|
|
223
|
-
if (isAndroid) {
|
|
224
|
-
window.location.href = androidStoreLink;
|
|
225
|
-
}
|
|
226
|
-
else if (isIos) {
|
|
227
|
-
window.location.href = iosStoreLink;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
handleLoading(false);
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
catch (error) {
|
|
234
|
-
this.stop();
|
|
235
|
-
handleLoading(false);
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
return (index.h("div", { class: "gatacaButtonWrapper" }, index.h("button", { class: "gatacaButton", onClick: () => {
|
|
239
|
-
executeRedirection();
|
|
240
|
-
}, disabled: loading }, index.h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), index.h("span", null, this.buttonText))));
|
|
241
|
-
}
|
|
242
|
-
render() {
|
|
243
|
-
const userAgent =
|
|
244
|
-
// @ts-ignore
|
|
245
|
-
(navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) || (navigator === null || navigator === void 0 ? void 0 : navigator.vendor) || (window === null || window === void 0 ? void 0 : window.opera);
|
|
246
|
-
const isAndroid = /android/i.test(userAgent);
|
|
247
|
-
const isIos =
|
|
248
|
-
// @ts-ignore
|
|
249
|
-
(/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) ||
|
|
250
|
-
(navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
|
|
251
|
-
const isMobile = isAndroid || isIos;
|
|
252
|
-
return (index.h("div", { class: "buttonContainer" }, isMobile && this.v === "3"
|
|
253
|
-
? this.renderMobileButton(isAndroid, isIos)
|
|
254
|
-
: this.renderDesktopButton(), this.open && (!isMobile || this.v === "3") && this.renderModal()));
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
GatacaSSIButton.style = gatacaSsibuttonCss;
|
|
258
|
-
|
|
259
|
-
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}";
|
|
260
|
-
|
|
261
|
-
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=";
|
|
262
|
-
const GatacaSSIButtonWS = class {
|
|
263
|
-
constructor(hostRef) {
|
|
264
|
-
index.registerInstance(this, hostRef);
|
|
265
|
-
this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7);
|
|
266
|
-
this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7);
|
|
267
|
-
this.buttonText = "Easy login";
|
|
268
|
-
this.successCallback = undefined;
|
|
269
|
-
this.errorCallback = undefined;
|
|
270
|
-
this.qrRole = undefined;
|
|
271
|
-
this.callbackServer = undefined;
|
|
272
|
-
this.socketEndpoint = undefined;
|
|
273
|
-
this.sessionTimeout = undefined;
|
|
274
|
-
this.wsOnOpen = undefined;
|
|
275
|
-
this.wsOnMessage = undefined;
|
|
276
|
-
this.autostart = true;
|
|
277
|
-
this.autorefresh = false;
|
|
278
|
-
this.v = "3";
|
|
279
|
-
this.qrModalTitle = "Quick Access";
|
|
280
|
-
this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
|
|
281
|
-
this.hideBrandTitle = false;
|
|
282
|
-
this.dynamicLink = true;
|
|
283
|
-
this.open = false;
|
|
284
|
-
this.qr = (index.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, v: this.v, qrModalTitle: this.qrModalTitle, qrModalDescription: this.qrModalDescription, hideBrandTitle: this.hideBrandTitle, dynamicLink: this.dynamicLink }));
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Retrieve manually the session data on a successful login
|
|
288
|
-
*/
|
|
289
|
-
async getSessionData() {
|
|
290
|
-
return this.qr.getSessionData();
|
|
291
|
-
}
|
|
292
|
-
renderModal() {
|
|
293
|
-
return this.qr;
|
|
294
|
-
}
|
|
295
|
-
renderButton() {
|
|
296
|
-
return (index.h("div", { class: "gatacaButtonWrapper" }, index.h("button", { class: "gatacaButton", onClick: () => {
|
|
297
|
-
this.open = !this.open;
|
|
298
|
-
if (this.open) {
|
|
299
|
-
this.qr.display();
|
|
300
|
-
}
|
|
301
|
-
else {
|
|
302
|
-
this.qr.stop();
|
|
303
|
-
}
|
|
304
|
-
} }, index.h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), index.h("span", null, this.buttonText))));
|
|
305
|
-
}
|
|
306
|
-
render() {
|
|
307
|
-
return (index.h("div", { class: "buttonContainer" }, this.renderButton(), this.open && this.renderModal()));
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
GatacaSSIButtonWS.style = gatacaSsibuttonwsCss;
|
|
311
|
-
|
|
312
|
-
exports.gataca_ssibutton = GatacaSSIButton;
|
|
313
|
-
exports.gataca_ssibuttonws = GatacaSSIButtonWS;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const logoGatacaSvg = 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDc2IDcxIiB3aWR0aD0iNzEiIGhlaWdodD0iNjYiPgoJPHRpdGxlPlZlY3RvciAoMyktc3ZnPC90aXRsZT4KCTxzdHlsZT4KCQkuczAgeyBmaWxsOiAjNDc0NWI3IH0gCgk8L3N0eWxlPgoJPHBhdGggaWQ9IkxheWVyIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsYXNzPSJzMCIgZD0ibT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xMiA5VjEzIiBzdHJva2U9IiNDRDJCMzEiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CjxwYXRoIGQ9Ik0xMiAxN0gxMi4wMSIgc3Ryb2tlPSIjQ0QyQjMxIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K';
|
|
8
|
-
|
|
9
|
-
export { gatIconRefreshSvg as a, gatIconAlertSvg as b, gatIconCheckSvg as g, logoGatacaSvg as l };
|
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h } from './index-2be54f32.js';
|
|
2
|
-
import './qr-code-styling-0eeb38d5.js';
|
|
3
|
-
import { R as RESULT_STATUS } from './utils-63e7a33b.js';
|
|
4
|
-
|
|
5
|
-
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}";
|
|
6
|
-
|
|
7
|
-
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=";
|
|
8
|
-
//Default values
|
|
9
|
-
const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
|
|
10
|
-
const DEFAULT_POLLING_FREQ = 3;
|
|
11
|
-
const GatacaSSIButton = class {
|
|
12
|
-
constructor(hostRef) {
|
|
13
|
-
registerInstance(this, hostRef);
|
|
14
|
-
this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
|
|
15
|
-
this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
|
|
16
|
-
this.buttonText = "Easy login";
|
|
17
|
-
this.autostart = true;
|
|
18
|
-
this.checkStatus = undefined;
|
|
19
|
-
this.createSession = undefined;
|
|
20
|
-
this.successCallback = undefined;
|
|
21
|
-
this.errorCallback = undefined;
|
|
22
|
-
this.handleCheckAppLoading = undefined;
|
|
23
|
-
this.checkAppTimeout = 6;
|
|
24
|
-
this.qrRole = undefined;
|
|
25
|
-
this.callbackServer = undefined;
|
|
26
|
-
this.sessionTimeout = undefined;
|
|
27
|
-
this.pollingFrequency = undefined;
|
|
28
|
-
this.autorefresh = false;
|
|
29
|
-
this.v = "3";
|
|
30
|
-
this.qrModalTitle = "Quick Access";
|
|
31
|
-
this.modalTitleColor = "#4745B7";
|
|
32
|
-
this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
|
|
33
|
-
this.hideBrandTitle = false;
|
|
34
|
-
this.dynamicLink = true;
|
|
35
|
-
this.logoSize = 0;
|
|
36
|
-
this.logoSrc = undefined;
|
|
37
|
-
this.qrCodeExpiredLabel = "QR Code expired";
|
|
38
|
-
this.credentialsNotValidatedLabel = "User credentials not validated";
|
|
39
|
-
this.clickInsideBoxLabel = "Click inside the box to";
|
|
40
|
-
this.refreshQrLabel = "Refresh QR Code";
|
|
41
|
-
this.scanQrLabel = "Scan QR Code";
|
|
42
|
-
this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time";
|
|
43
|
-
this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated";
|
|
44
|
-
this.failedLoginErrorLabel = "No successful login";
|
|
45
|
-
this.successLoginLabel = "Successful Connection!";
|
|
46
|
-
this.byBrandLabel = "by Gataca";
|
|
47
|
-
this.waitingStartSessionLabel = "waiting to start a session";
|
|
48
|
-
this.hideQrModalDescription = false;
|
|
49
|
-
this.open = false;
|
|
50
|
-
this.sessionId = undefined;
|
|
51
|
-
this.authenticationRequest = undefined;
|
|
52
|
-
this.sessionData = undefined;
|
|
53
|
-
this.result = RESULT_STATUS.NOT_STARTED;
|
|
54
|
-
this.qr = (h("gataca-qr", { ref: (el) => (this.qrElement = el), 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: this.autostart, autorefresh: this.autorefresh, v: this.v, qrModalTitle: this.qrModalTitle, qrModalDescription: this.qrModalDescription, hideBrandTitle: this.hideBrandTitle, dynamicLink: this.dynamicLink, logoSize: this.logoSize, logoSrc: this.logoSrc, modalTitleColor: this.modalTitleColor, qrCodeExpiredLabel: this.qrCodeExpiredLabel, credentialsNotValidatedLabel: this.credentialsNotValidatedLabel, clickInsideBoxLabel: this.clickInsideBoxLabel, refreshQrLabel: this.refreshQrLabel, scanQrLabel: this.scanQrLabel, userNotScanInTimeErrorLabel: this.userNotScanInTimeErrorLabel, credsNotValidatedErrorLabel: this.credsNotValidatedErrorLabel, failedLoginErrorLabel: this.failedLoginErrorLabel, successLoginLabel: this.successLoginLabel, byBrandLabel: this.byBrandLabel, waitingStartSessionLabel: this.waitingStartSessionLabel, hideQrModalDescription: this.hideQrModalDescription }));
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Retrieve manually the session data on a successful login
|
|
58
|
-
*/
|
|
59
|
-
async getSessionData() {
|
|
60
|
-
return this.qr.getSessionData();
|
|
61
|
-
}
|
|
62
|
-
async getSessionId() {
|
|
63
|
-
if (this.sessionId) {
|
|
64
|
-
return this.sessionId;
|
|
65
|
-
}
|
|
66
|
-
let { sessionId, authenticationRequest } = await this.createSession();
|
|
67
|
-
this.sessionId = sessionId;
|
|
68
|
-
this.authenticationRequest = authenticationRequest;
|
|
69
|
-
return this.sessionId;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Force manually the start polling
|
|
73
|
-
*/
|
|
74
|
-
async startMobilePolling() {
|
|
75
|
-
await this.getSessionId();
|
|
76
|
-
this.result = RESULT_STATUS.ONGOING;
|
|
77
|
-
this.poll()
|
|
78
|
-
.then((data) => {
|
|
79
|
-
this.result = RESULT_STATUS.SUCCESS;
|
|
80
|
-
this.sessionData = data;
|
|
81
|
-
this.gatacaLoginCompleted.emit(data);
|
|
82
|
-
this.successCallback(data);
|
|
83
|
-
})
|
|
84
|
-
.catch((err) => {
|
|
85
|
-
this.clean();
|
|
86
|
-
let expired = err === RESULT_STATUS.EXPIRED;
|
|
87
|
-
if (expired && this.autorefresh) {
|
|
88
|
-
this.startMobilePolling();
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
if (err !== RESULT_STATUS.NOT_STARTED) {
|
|
92
|
-
let error = expired
|
|
93
|
-
? new Error(this.userNotScanInTimeErrorLabel)
|
|
94
|
-
: new Error(this.credsNotValidatedErrorLabel);
|
|
95
|
-
this.result = err;
|
|
96
|
-
this.gatacaLoginFailed.emit(error);
|
|
97
|
-
this.errorCallback(error);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Stop manually an ongoing session
|
|
104
|
-
*/
|
|
105
|
-
async stop() {
|
|
106
|
-
this.clean();
|
|
107
|
-
if (this.result === RESULT_STATUS.ONGOING || RESULT_STATUS.READ) {
|
|
108
|
-
this.result = RESULT_STATUS.NOT_STARTED;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
clean() {
|
|
112
|
-
this.sessionData = undefined;
|
|
113
|
-
this.sessionId = undefined;
|
|
114
|
-
}
|
|
115
|
-
renderModal() {
|
|
116
|
-
return this.qr;
|
|
117
|
-
}
|
|
118
|
-
async poll() {
|
|
119
|
-
let endTime = new Date().getTime() +
|
|
120
|
-
(this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
|
|
121
|
-
let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
|
|
122
|
-
let checkFunc = async (component) => {
|
|
123
|
-
if (component.result === RESULT_STATUS.NOT_STARTED) {
|
|
124
|
-
return { result: RESULT_STATUS.NOT_STARTED };
|
|
125
|
-
}
|
|
126
|
-
let id = await component.getSessionId();
|
|
127
|
-
return component.checkStatus(id);
|
|
128
|
-
};
|
|
129
|
-
let component = this;
|
|
130
|
-
let checkCondition = async function (resolve, reject) {
|
|
131
|
-
// If the condition is met, we're done!
|
|
132
|
-
let { result, data } = await checkFunc(component);
|
|
133
|
-
switch (result) {
|
|
134
|
-
case RESULT_STATUS.SUCCESS:
|
|
135
|
-
resolve(data);
|
|
136
|
-
break;
|
|
137
|
-
case RESULT_STATUS.READ:
|
|
138
|
-
component.result = RESULT_STATUS.READ;
|
|
139
|
-
case RESULT_STATUS.ONGOING:
|
|
140
|
-
if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
|
|
141
|
-
setTimeout(checkCondition, interval, resolve, reject);
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
reject(RESULT_STATUS.EXPIRED);
|
|
145
|
-
}
|
|
146
|
-
break;
|
|
147
|
-
default:
|
|
148
|
-
reject(result);
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
return new Promise(checkCondition);
|
|
153
|
-
}
|
|
154
|
-
isAppInstalled(appScheme, callback) {
|
|
155
|
-
let timeout;
|
|
156
|
-
let detected = false;
|
|
157
|
-
if (appScheme === null || appScheme === void 0 ? void 0 : appScheme.length) {
|
|
158
|
-
window.location.href = appScheme;
|
|
159
|
-
}
|
|
160
|
-
const waitTimeToCheckApp = this.checkAppTimeout * 1000;
|
|
161
|
-
timeout = setTimeout(() => {
|
|
162
|
-
if (!detected) {
|
|
163
|
-
callback(false);
|
|
164
|
-
}
|
|
165
|
-
cleanup();
|
|
166
|
-
}, waitTimeToCheckApp);
|
|
167
|
-
const handleVisibilityChange = () => {
|
|
168
|
-
if (document.hidden) {
|
|
169
|
-
detected = true;
|
|
170
|
-
callback(true);
|
|
171
|
-
this.startMobilePolling();
|
|
172
|
-
cleanup();
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
176
|
-
function cleanup() {
|
|
177
|
-
clearTimeout(timeout);
|
|
178
|
-
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
renderDesktopButton() {
|
|
182
|
-
return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
|
|
183
|
-
this.open = !this.open;
|
|
184
|
-
setTimeout(() => {
|
|
185
|
-
var _a, _b;
|
|
186
|
-
if (this.open) {
|
|
187
|
-
(_a = this.qrElement) === null || _a === void 0 ? void 0 : _a.display();
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
(_b = this.qrElement) === null || _b === void 0 ? void 0 : _b.stop();
|
|
191
|
-
}
|
|
192
|
-
}, 0);
|
|
193
|
-
} }, h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
|
|
194
|
-
}
|
|
195
|
-
async getAuthRequest() {
|
|
196
|
-
let { authenticationRequest } = await this.createSession();
|
|
197
|
-
return authenticationRequest;
|
|
198
|
-
}
|
|
199
|
-
renderMobileButton(isAndroid, isIos) {
|
|
200
|
-
if (this.autostart) {
|
|
201
|
-
this.startMobilePolling();
|
|
202
|
-
}
|
|
203
|
-
let loading = false;
|
|
204
|
-
const handleLoading = (isLoading) => {
|
|
205
|
-
loading = isLoading;
|
|
206
|
-
if (this.handleCheckAppLoading) {
|
|
207
|
-
this.handleCheckAppLoading(isLoading);
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
const executeRedirection = async () => {
|
|
211
|
-
handleLoading(true);
|
|
212
|
-
const androidStoreLink = "https://play.google.com/store/apps/details?id=com.gataca.identity";
|
|
213
|
-
const iosStoreLink = "https://apps.apple.com/us/app/gataca/id1498607616";
|
|
214
|
-
try {
|
|
215
|
-
const appScheme = await this.getAuthRequest();
|
|
216
|
-
this.isAppInstalled(appScheme, (installed) => {
|
|
217
|
-
if (!installed) {
|
|
218
|
-
this.stop();
|
|
219
|
-
if (isAndroid) {
|
|
220
|
-
window.location.href = androidStoreLink;
|
|
221
|
-
}
|
|
222
|
-
else if (isIos) {
|
|
223
|
-
window.location.href = iosStoreLink;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
handleLoading(false);
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
catch (error) {
|
|
230
|
-
this.stop();
|
|
231
|
-
handleLoading(false);
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
|
|
235
|
-
executeRedirection();
|
|
236
|
-
}, disabled: loading }, h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
|
|
237
|
-
}
|
|
238
|
-
render() {
|
|
239
|
-
const userAgent =
|
|
240
|
-
// @ts-ignore
|
|
241
|
-
(navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) || (navigator === null || navigator === void 0 ? void 0 : navigator.vendor) || (window === null || window === void 0 ? void 0 : window.opera);
|
|
242
|
-
const isAndroid = /android/i.test(userAgent);
|
|
243
|
-
const isIos =
|
|
244
|
-
// @ts-ignore
|
|
245
|
-
(/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) ||
|
|
246
|
-
(navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
|
|
247
|
-
const isMobile = isAndroid || isIos;
|
|
248
|
-
return (h("div", { class: "buttonContainer" }, isMobile && this.v === "3"
|
|
249
|
-
? this.renderMobileButton(isAndroid, isIos)
|
|
250
|
-
: this.renderDesktopButton(), this.open && (!isMobile || this.v === "3") && this.renderModal()));
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
GatacaSSIButton.style = gatacaSsibuttonCss;
|
|
254
|
-
|
|
255
|
-
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}";
|
|
256
|
-
|
|
257
|
-
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=";
|
|
258
|
-
const GatacaSSIButtonWS = class {
|
|
259
|
-
constructor(hostRef) {
|
|
260
|
-
registerInstance(this, hostRef);
|
|
261
|
-
this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
|
|
262
|
-
this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
|
|
263
|
-
this.buttonText = "Easy login";
|
|
264
|
-
this.successCallback = undefined;
|
|
265
|
-
this.errorCallback = undefined;
|
|
266
|
-
this.qrRole = undefined;
|
|
267
|
-
this.callbackServer = undefined;
|
|
268
|
-
this.socketEndpoint = undefined;
|
|
269
|
-
this.sessionTimeout = undefined;
|
|
270
|
-
this.wsOnOpen = undefined;
|
|
271
|
-
this.wsOnMessage = undefined;
|
|
272
|
-
this.autostart = true;
|
|
273
|
-
this.autorefresh = false;
|
|
274
|
-
this.v = "3";
|
|
275
|
-
this.qrModalTitle = "Quick Access";
|
|
276
|
-
this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
|
|
277
|
-
this.hideBrandTitle = false;
|
|
278
|
-
this.dynamicLink = true;
|
|
279
|
-
this.open = false;
|
|
280
|
-
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, v: this.v, qrModalTitle: this.qrModalTitle, qrModalDescription: this.qrModalDescription, hideBrandTitle: this.hideBrandTitle, dynamicLink: this.dynamicLink }));
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Retrieve manually the session data on a successful login
|
|
284
|
-
*/
|
|
285
|
-
async getSessionData() {
|
|
286
|
-
return this.qr.getSessionData();
|
|
287
|
-
}
|
|
288
|
-
renderModal() {
|
|
289
|
-
return this.qr;
|
|
290
|
-
}
|
|
291
|
-
renderButton() {
|
|
292
|
-
return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
|
|
293
|
-
this.open = !this.open;
|
|
294
|
-
if (this.open) {
|
|
295
|
-
this.qr.display();
|
|
296
|
-
}
|
|
297
|
-
else {
|
|
298
|
-
this.qr.stop();
|
|
299
|
-
}
|
|
300
|
-
} }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
|
|
301
|
-
}
|
|
302
|
-
render() {
|
|
303
|
-
return (h("div", { class: "buttonContainer" }, this.renderButton(), this.open && this.renderModal()));
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
|
-
GatacaSSIButtonWS.style = gatacaSsibuttonwsCss;
|
|
307
|
-
|
|
308
|
-
export { GatacaSSIButton as gataca_ssibutton, GatacaSSIButtonWS as gataca_ssibuttonws };
|