@gataca/qr 3.0.0 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/gataca-ssibutton_2.cjs.entry.js +193 -9
- package/dist/cjs/gatacaqr.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.js +250 -10
- package/dist/components/gataca-ssibutton2.js +201 -10
- package/dist/esm/gataca-ssibutton_2.entry.js +193 -9
- 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-761647d3.entry.js +1 -0
- package/dist/types/components/gataca-ssibutton/gataca-ssibutton.d.ts +25 -1
- package/dist/types/components.d.ts +16 -0
- package/package.json +2 -2
- package/dist/gatacaqr/p-4dc10b69.entry.js +0 -1
|
@@ -4,10 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-93d47a75.js');
|
|
6
6
|
require('./qr-code-styling-412bbc7a.js');
|
|
7
|
+
const utils = require('./utils-ef28b844.js');
|
|
7
8
|
|
|
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}";
|
|
9
10
|
|
|
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;
|
|
11
15
|
const GatacaSSIButton = class {
|
|
12
16
|
constructor(hostRef) {
|
|
13
17
|
index.registerInstance(this, hostRef);
|
|
@@ -18,6 +22,7 @@ const GatacaSSIButton = class {
|
|
|
18
22
|
this.createSession = undefined;
|
|
19
23
|
this.successCallback = undefined;
|
|
20
24
|
this.errorCallback = undefined;
|
|
25
|
+
this.handleCheckAppLoading = undefined;
|
|
21
26
|
this.qrRole = undefined;
|
|
22
27
|
this.callbackServer = undefined;
|
|
23
28
|
this.sessionTimeout = undefined;
|
|
@@ -44,7 +49,11 @@ const GatacaSSIButton = class {
|
|
|
44
49
|
this.waitingStartSessionLabel = "waiting to start a session";
|
|
45
50
|
this.hideQrModalDescription = false;
|
|
46
51
|
this.open = false;
|
|
47
|
-
this.
|
|
52
|
+
this.sessionId = undefined;
|
|
53
|
+
this.authenticationRequest = undefined;
|
|
54
|
+
this.sessionData = undefined;
|
|
55
|
+
this.result = utils.RESULT_STATUS.NOT_STARTED;
|
|
56
|
+
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: true, 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 }));
|
|
48
57
|
}
|
|
49
58
|
/**
|
|
50
59
|
* Retrieve manually the session data on a successful login
|
|
@@ -52,22 +61,197 @@ const GatacaSSIButton = class {
|
|
|
52
61
|
async getSessionData() {
|
|
53
62
|
return this.qr.getSessionData();
|
|
54
63
|
}
|
|
64
|
+
async getSessionId() {
|
|
65
|
+
if (this.sessionId) {
|
|
66
|
+
return this.sessionId;
|
|
67
|
+
}
|
|
68
|
+
let { sessionId, authenticationRequest } = await this.createSession();
|
|
69
|
+
this.sessionId = sessionId;
|
|
70
|
+
this.authenticationRequest = authenticationRequest;
|
|
71
|
+
return this.sessionId;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Force manually the start polling
|
|
75
|
+
*/
|
|
76
|
+
async startMobilePolling() {
|
|
77
|
+
await this.getSessionId();
|
|
78
|
+
this.result = utils.RESULT_STATUS.ONGOING;
|
|
79
|
+
this.poll()
|
|
80
|
+
.then((data) => {
|
|
81
|
+
this.result = utils.RESULT_STATUS.SUCCESS;
|
|
82
|
+
this.sessionData = data;
|
|
83
|
+
this.gatacaLoginCompleted.emit(data);
|
|
84
|
+
this.successCallback(data);
|
|
85
|
+
})
|
|
86
|
+
.catch((err) => {
|
|
87
|
+
this.clean();
|
|
88
|
+
let expired = err === utils.RESULT_STATUS.EXPIRED;
|
|
89
|
+
if (expired && this.autorefresh) {
|
|
90
|
+
this.startMobilePolling();
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
if (err !== utils.RESULT_STATUS.NOT_STARTED) {
|
|
94
|
+
let error = expired
|
|
95
|
+
? new Error(this.userNotScanInTimeErrorLabel)
|
|
96
|
+
: new Error(this.credsNotValidatedErrorLabel);
|
|
97
|
+
this.result = err;
|
|
98
|
+
this.gatacaLoginFailed.emit(error);
|
|
99
|
+
this.errorCallback(error);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Stop manually an ongoing session
|
|
106
|
+
*/
|
|
107
|
+
async stop() {
|
|
108
|
+
this.clean();
|
|
109
|
+
if (this.result === utils.RESULT_STATUS.ONGOING || utils.RESULT_STATUS.READ) {
|
|
110
|
+
this.result = utils.RESULT_STATUS.NOT_STARTED;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
clean() {
|
|
114
|
+
this.sessionData = undefined;
|
|
115
|
+
this.sessionId = undefined;
|
|
116
|
+
}
|
|
55
117
|
renderModal() {
|
|
56
118
|
return this.qr;
|
|
57
119
|
}
|
|
58
|
-
|
|
120
|
+
async poll() {
|
|
121
|
+
let endTime = new Date().getTime() +
|
|
122
|
+
(this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
|
|
123
|
+
let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
|
|
124
|
+
let checkFunc = async (component) => {
|
|
125
|
+
if (component.result === utils.RESULT_STATUS.NOT_STARTED) {
|
|
126
|
+
return { result: utils.RESULT_STATUS.NOT_STARTED };
|
|
127
|
+
}
|
|
128
|
+
let id = await component.getSessionId();
|
|
129
|
+
return component.checkStatus(id);
|
|
130
|
+
};
|
|
131
|
+
let component = this;
|
|
132
|
+
let checkCondition = async function (resolve, reject) {
|
|
133
|
+
// If the condition is met, we're done!
|
|
134
|
+
let { result, data } = await checkFunc(component);
|
|
135
|
+
switch (result) {
|
|
136
|
+
case utils.RESULT_STATUS.SUCCESS:
|
|
137
|
+
resolve(data);
|
|
138
|
+
break;
|
|
139
|
+
case utils.RESULT_STATUS.READ:
|
|
140
|
+
component.result = utils.RESULT_STATUS.READ;
|
|
141
|
+
case utils.RESULT_STATUS.ONGOING:
|
|
142
|
+
if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
|
|
143
|
+
setTimeout(checkCondition, interval, resolve, reject);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
reject(utils.RESULT_STATUS.EXPIRED);
|
|
147
|
+
}
|
|
148
|
+
break;
|
|
149
|
+
default:
|
|
150
|
+
reject(result);
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
return new Promise(checkCondition);
|
|
155
|
+
}
|
|
156
|
+
isAppInstalled(appScheme, callback) {
|
|
157
|
+
let timeout;
|
|
158
|
+
let detected = false;
|
|
159
|
+
if (appScheme === null || appScheme === void 0 ? void 0 : appScheme.length) {
|
|
160
|
+
window.location.href = appScheme;
|
|
161
|
+
}
|
|
162
|
+
timeout = setTimeout(() => {
|
|
163
|
+
if (!detected) {
|
|
164
|
+
setTimeout(() => {
|
|
165
|
+
if (!detected) {
|
|
166
|
+
callback(false);
|
|
167
|
+
}
|
|
168
|
+
cleanup();
|
|
169
|
+
}, 1000);
|
|
170
|
+
}
|
|
171
|
+
}, 1500);
|
|
172
|
+
const handleVisibilityChange = () => {
|
|
173
|
+
if (document.hidden) {
|
|
174
|
+
detected = true;
|
|
175
|
+
callback(true);
|
|
176
|
+
this.startMobilePolling();
|
|
177
|
+
cleanup();
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
181
|
+
function cleanup() {
|
|
182
|
+
clearTimeout(timeout);
|
|
183
|
+
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
renderDesktopButton() {
|
|
59
187
|
return (index.h("div", { class: "gatacaButtonWrapper" }, index.h("button", { class: "gatacaButton", onClick: () => {
|
|
60
188
|
this.open = !this.open;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
189
|
+
setTimeout(() => {
|
|
190
|
+
var _a, _b;
|
|
191
|
+
if (this.open) {
|
|
192
|
+
(_a = this.qrElement) === null || _a === void 0 ? void 0 : _a.display();
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
(_b = this.qrElement) === null || _b === void 0 ? void 0 : _b.stop();
|
|
196
|
+
}
|
|
197
|
+
}, 0);
|
|
67
198
|
} }, index.h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), index.h("span", null, this.buttonText))));
|
|
68
199
|
}
|
|
200
|
+
async getAuthRequest() {
|
|
201
|
+
let { authenticationRequest } = await this.createSession();
|
|
202
|
+
return authenticationRequest;
|
|
203
|
+
}
|
|
204
|
+
renderMobileButton(isAndroid, isIos) {
|
|
205
|
+
let loading = false;
|
|
206
|
+
const handleLoading = (isLoading) => {
|
|
207
|
+
loading = isLoading;
|
|
208
|
+
if (this.handleCheckAppLoading) {
|
|
209
|
+
this.handleCheckAppLoading(isLoading);
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
const executeRedirection = async () => {
|
|
213
|
+
handleLoading(true);
|
|
214
|
+
const androidStoreLink = "https://play.google.com/store/apps/details?id=com.gataca.identity";
|
|
215
|
+
const iosStoreLink = "https://apps.apple.com/us/app/gataca/id1498607616";
|
|
216
|
+
try {
|
|
217
|
+
const appScheme = await this.getAuthRequest();
|
|
218
|
+
this.isAppInstalled(appScheme, (installed) => {
|
|
219
|
+
if (!installed) {
|
|
220
|
+
setTimeout(() => {
|
|
221
|
+
this.stop();
|
|
222
|
+
if (isAndroid) {
|
|
223
|
+
window.location.href = androidStoreLink;
|
|
224
|
+
}
|
|
225
|
+
else if (isIos) {
|
|
226
|
+
window.location.href = iosStoreLink;
|
|
227
|
+
}
|
|
228
|
+
}, 500);
|
|
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
|
+
}
|
|
69
242
|
render() {
|
|
70
|
-
|
|
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()));
|
|
71
255
|
}
|
|
72
256
|
};
|
|
73
257
|
GatacaSSIButton.style = gatacaSsibuttonCss;
|
package/dist/cjs/gatacaqr.cjs.js
CHANGED
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["gataca-qr_2.cjs",[[1,"gataca-qr",{"checkStatus":[16],"createSession":[16],"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideModalTexts":[4,"hide-modal-texts"],"hideModalBoxShadow":[4,"hide-modal-box-shadow"],"hideBrandTitle":[4,"hide-brand-title"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrSize":[2,"qr-size"],"modalWidth":[2,"modal-width"],"modalHeight":[2,"modal-height"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"readQrTitle":[1,"read-qr-title"],"readQrDescription":[1,"read-qr-description"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"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]}],[0,"gataca-qrdisplay",{"qrData":[1,"qr-data"],"size":[2],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrColor":[1,"qr-color"],"rounded":[4]}]]],["gataca-qrws.cjs",[[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],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideModalTexts":[4,"hide-modal-texts"],"hideModalBoxShadow":[4,"hide-modal-box-shadow"],"hideBrandTitle":[4,"hide-brand-title"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrSize":[2,"qr-size"],"modalWidth":[2,"modal-width"],"modalHeight":[2,"modal-height"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"readQrTitle":[1,"read-qr-title"],"readQrDescription":[1,"read-qr-description"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"dynamicLink":[4,"dynamic-link"],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"display":[64],"stop":[64],"getSessionData":[64]},[[2,"sessionMsg","sessionMsgReceived"]]]]],["gataca-ssibutton_2.cjs",[[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],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"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],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"open":[32],"getSessionData":[64]}]]],["gataca-autoqr.cjs",[[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]}]]]], options);
|
|
18
|
+
return index.bootstrapLazy([["gataca-qr_2.cjs",[[1,"gataca-qr",{"checkStatus":[16],"createSession":[16],"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideModalTexts":[4,"hide-modal-texts"],"hideModalBoxShadow":[4,"hide-modal-box-shadow"],"hideBrandTitle":[4,"hide-brand-title"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrSize":[2,"qr-size"],"modalWidth":[2,"modal-width"],"modalHeight":[2,"modal-height"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"readQrTitle":[1,"read-qr-title"],"readQrDescription":[1,"read-qr-description"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"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]}],[0,"gataca-qrdisplay",{"qrData":[1,"qr-data"],"size":[2],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrColor":[1,"qr-color"],"rounded":[4]}]]],["gataca-qrws.cjs",[[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],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideModalTexts":[4,"hide-modal-texts"],"hideModalBoxShadow":[4,"hide-modal-box-shadow"],"hideBrandTitle":[4,"hide-brand-title"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrSize":[2,"qr-size"],"modalWidth":[2,"modal-width"],"modalHeight":[2,"modal-height"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"readQrTitle":[1,"read-qr-title"],"readQrDescription":[1,"read-qr-description"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"dynamicLink":[4,"dynamic-link"],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"display":[64],"stop":[64],"getSessionData":[64]},[[2,"sessionMsg","sessionMsgReceived"]]]]],["gataca-ssibutton_2.cjs",[[1,"gataca-ssibutton",{"buttonText":[1,"button-text"],"checkStatus":[16],"createSession":[16],"successCallback":[16],"errorCallback":[16],"handleCheckAppLoading":[16],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"sessionTimeout":[2,"session-timeout"],"pollingFrequency":[2,"polling-frequency"],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"open":[32],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"getSessionData":[64],"startMobilePolling":[64],"stop":[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],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"open":[32],"getSessionData":[64]}]]],["gataca-autoqr.cjs",[[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]}]]]], options);
|
|
19
19
|
});
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["gataca-qr_2.cjs",[[1,"gataca-qr",{"checkStatus":[16],"createSession":[16],"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideModalTexts":[4,"hide-modal-texts"],"hideModalBoxShadow":[4,"hide-modal-box-shadow"],"hideBrandTitle":[4,"hide-brand-title"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrSize":[2,"qr-size"],"modalWidth":[2,"modal-width"],"modalHeight":[2,"modal-height"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"readQrTitle":[1,"read-qr-title"],"readQrDescription":[1,"read-qr-description"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"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]}],[0,"gataca-qrdisplay",{"qrData":[1,"qr-data"],"size":[2],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrColor":[1,"qr-color"],"rounded":[4]}]]],["gataca-qrws.cjs",[[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],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideModalTexts":[4,"hide-modal-texts"],"hideModalBoxShadow":[4,"hide-modal-box-shadow"],"hideBrandTitle":[4,"hide-brand-title"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrSize":[2,"qr-size"],"modalWidth":[2,"modal-width"],"modalHeight":[2,"modal-height"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"readQrTitle":[1,"read-qr-title"],"readQrDescription":[1,"read-qr-description"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"dynamicLink":[4,"dynamic-link"],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"display":[64],"stop":[64],"getSessionData":[64]},[[2,"sessionMsg","sessionMsgReceived"]]]]],["gataca-ssibutton_2.cjs",[[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],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"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],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"open":[32],"getSessionData":[64]}]]],["gataca-autoqr.cjs",[[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]}]]]], options);
|
|
17
|
+
return index.bootstrapLazy([["gataca-qr_2.cjs",[[1,"gataca-qr",{"checkStatus":[16],"createSession":[16],"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideModalTexts":[4,"hide-modal-texts"],"hideModalBoxShadow":[4,"hide-modal-box-shadow"],"hideBrandTitle":[4,"hide-brand-title"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrSize":[2,"qr-size"],"modalWidth":[2,"modal-width"],"modalHeight":[2,"modal-height"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"readQrTitle":[1,"read-qr-title"],"readQrDescription":[1,"read-qr-description"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"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]}],[0,"gataca-qrdisplay",{"qrData":[1,"qr-data"],"size":[2],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrColor":[1,"qr-color"],"rounded":[4]}]]],["gataca-qrws.cjs",[[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],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideModalTexts":[4,"hide-modal-texts"],"hideModalBoxShadow":[4,"hide-modal-box-shadow"],"hideBrandTitle":[4,"hide-brand-title"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrSize":[2,"qr-size"],"modalWidth":[2,"modal-width"],"modalHeight":[2,"modal-height"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"readQrTitle":[1,"read-qr-title"],"readQrDescription":[1,"read-qr-description"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"dynamicLink":[4,"dynamic-link"],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"display":[64],"stop":[64],"getSessionData":[64]},[[2,"sessionMsg","sessionMsgReceived"]]]]],["gataca-ssibutton_2.cjs",[[1,"gataca-ssibutton",{"buttonText":[1,"button-text"],"checkStatus":[16],"createSession":[16],"successCallback":[16],"errorCallback":[16],"handleCheckAppLoading":[16],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"sessionTimeout":[2,"session-timeout"],"pollingFrequency":[2,"polling-frequency"],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"open":[32],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"getSessionData":[64],"startMobilePolling":[64],"stop":[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],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"open":[32],"getSessionData":[64]}]]],["gataca-autoqr.cjs",[[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]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { h, } from "@stencil/core";
|
|
2
2
|
import "../gataca-qrdisplay/gataca-qrdisplay";
|
|
3
|
+
import { RESULT_STATUS } from "../../utils/utils";
|
|
3
4
|
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=";
|
|
5
|
+
//Default values
|
|
6
|
+
const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
|
|
7
|
+
const DEFAULT_POLLING_FREQ = 3;
|
|
4
8
|
export class GatacaSSIButton {
|
|
5
9
|
constructor() {
|
|
6
10
|
this.buttonText = "Easy login";
|
|
@@ -8,6 +12,7 @@ export class GatacaSSIButton {
|
|
|
8
12
|
this.createSession = undefined;
|
|
9
13
|
this.successCallback = undefined;
|
|
10
14
|
this.errorCallback = undefined;
|
|
15
|
+
this.handleCheckAppLoading = undefined;
|
|
11
16
|
this.qrRole = undefined;
|
|
12
17
|
this.callbackServer = undefined;
|
|
13
18
|
this.sessionTimeout = undefined;
|
|
@@ -34,7 +39,11 @@ export class GatacaSSIButton {
|
|
|
34
39
|
this.waitingStartSessionLabel = "waiting to start a session";
|
|
35
40
|
this.hideQrModalDescription = false;
|
|
36
41
|
this.open = false;
|
|
37
|
-
this.
|
|
42
|
+
this.sessionId = undefined;
|
|
43
|
+
this.authenticationRequest = undefined;
|
|
44
|
+
this.sessionData = undefined;
|
|
45
|
+
this.result = RESULT_STATUS.NOT_STARTED;
|
|
46
|
+
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: true, 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 }));
|
|
38
47
|
}
|
|
39
48
|
/**
|
|
40
49
|
* Retrieve manually the session data on a successful login
|
|
@@ -42,22 +51,197 @@ export class GatacaSSIButton {
|
|
|
42
51
|
async getSessionData() {
|
|
43
52
|
return this.qr.getSessionData();
|
|
44
53
|
}
|
|
54
|
+
async getSessionId() {
|
|
55
|
+
if (this.sessionId) {
|
|
56
|
+
return this.sessionId;
|
|
57
|
+
}
|
|
58
|
+
let { sessionId, authenticationRequest } = await this.createSession();
|
|
59
|
+
this.sessionId = sessionId;
|
|
60
|
+
this.authenticationRequest = authenticationRequest;
|
|
61
|
+
return this.sessionId;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Force manually the start polling
|
|
65
|
+
*/
|
|
66
|
+
async startMobilePolling() {
|
|
67
|
+
await this.getSessionId();
|
|
68
|
+
this.result = RESULT_STATUS.ONGOING;
|
|
69
|
+
this.poll()
|
|
70
|
+
.then((data) => {
|
|
71
|
+
this.result = RESULT_STATUS.SUCCESS;
|
|
72
|
+
this.sessionData = data;
|
|
73
|
+
this.gatacaLoginCompleted.emit(data);
|
|
74
|
+
this.successCallback(data);
|
|
75
|
+
})
|
|
76
|
+
.catch((err) => {
|
|
77
|
+
this.clean();
|
|
78
|
+
let expired = err === RESULT_STATUS.EXPIRED;
|
|
79
|
+
if (expired && this.autorefresh) {
|
|
80
|
+
this.startMobilePolling();
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
if (err !== RESULT_STATUS.NOT_STARTED) {
|
|
84
|
+
let error = expired
|
|
85
|
+
? new Error(this.userNotScanInTimeErrorLabel)
|
|
86
|
+
: new Error(this.credsNotValidatedErrorLabel);
|
|
87
|
+
this.result = err;
|
|
88
|
+
this.gatacaLoginFailed.emit(error);
|
|
89
|
+
this.errorCallback(error);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Stop manually an ongoing session
|
|
96
|
+
*/
|
|
97
|
+
async stop() {
|
|
98
|
+
this.clean();
|
|
99
|
+
if (this.result === RESULT_STATUS.ONGOING || RESULT_STATUS.READ) {
|
|
100
|
+
this.result = RESULT_STATUS.NOT_STARTED;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
clean() {
|
|
104
|
+
this.sessionData = undefined;
|
|
105
|
+
this.sessionId = undefined;
|
|
106
|
+
}
|
|
45
107
|
renderModal() {
|
|
46
108
|
return this.qr;
|
|
47
109
|
}
|
|
48
|
-
|
|
110
|
+
async poll() {
|
|
111
|
+
let endTime = new Date().getTime() +
|
|
112
|
+
(this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
|
|
113
|
+
let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
|
|
114
|
+
let checkFunc = async (component) => {
|
|
115
|
+
if (component.result === RESULT_STATUS.NOT_STARTED) {
|
|
116
|
+
return { result: RESULT_STATUS.NOT_STARTED };
|
|
117
|
+
}
|
|
118
|
+
let id = await component.getSessionId();
|
|
119
|
+
return component.checkStatus(id);
|
|
120
|
+
};
|
|
121
|
+
let component = this;
|
|
122
|
+
let checkCondition = async function (resolve, reject) {
|
|
123
|
+
// If the condition is met, we're done!
|
|
124
|
+
let { result, data } = await checkFunc(component);
|
|
125
|
+
switch (result) {
|
|
126
|
+
case RESULT_STATUS.SUCCESS:
|
|
127
|
+
resolve(data);
|
|
128
|
+
break;
|
|
129
|
+
case RESULT_STATUS.READ:
|
|
130
|
+
component.result = RESULT_STATUS.READ;
|
|
131
|
+
case RESULT_STATUS.ONGOING:
|
|
132
|
+
if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
|
|
133
|
+
setTimeout(checkCondition, interval, resolve, reject);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
reject(RESULT_STATUS.EXPIRED);
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
default:
|
|
140
|
+
reject(result);
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
return new Promise(checkCondition);
|
|
145
|
+
}
|
|
146
|
+
isAppInstalled(appScheme, callback) {
|
|
147
|
+
let timeout;
|
|
148
|
+
let detected = false;
|
|
149
|
+
if (appScheme === null || appScheme === void 0 ? void 0 : appScheme.length) {
|
|
150
|
+
window.location.href = appScheme;
|
|
151
|
+
}
|
|
152
|
+
timeout = setTimeout(() => {
|
|
153
|
+
if (!detected) {
|
|
154
|
+
setTimeout(() => {
|
|
155
|
+
if (!detected) {
|
|
156
|
+
callback(false);
|
|
157
|
+
}
|
|
158
|
+
cleanup();
|
|
159
|
+
}, 1000);
|
|
160
|
+
}
|
|
161
|
+
}, 1500);
|
|
162
|
+
const handleVisibilityChange = () => {
|
|
163
|
+
if (document.hidden) {
|
|
164
|
+
detected = true;
|
|
165
|
+
callback(true);
|
|
166
|
+
this.startMobilePolling();
|
|
167
|
+
cleanup();
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
171
|
+
function cleanup() {
|
|
172
|
+
clearTimeout(timeout);
|
|
173
|
+
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
renderDesktopButton() {
|
|
49
177
|
return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
|
|
50
178
|
this.open = !this.open;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
179
|
+
setTimeout(() => {
|
|
180
|
+
var _a, _b;
|
|
181
|
+
if (this.open) {
|
|
182
|
+
(_a = this.qrElement) === null || _a === void 0 ? void 0 : _a.display();
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
(_b = this.qrElement) === null || _b === void 0 ? void 0 : _b.stop();
|
|
186
|
+
}
|
|
187
|
+
}, 0);
|
|
57
188
|
} }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
|
|
58
189
|
}
|
|
190
|
+
async getAuthRequest() {
|
|
191
|
+
let { authenticationRequest } = await this.createSession();
|
|
192
|
+
return authenticationRequest;
|
|
193
|
+
}
|
|
194
|
+
renderMobileButton(isAndroid, isIos) {
|
|
195
|
+
let loading = false;
|
|
196
|
+
const handleLoading = (isLoading) => {
|
|
197
|
+
loading = isLoading;
|
|
198
|
+
if (this.handleCheckAppLoading) {
|
|
199
|
+
this.handleCheckAppLoading(isLoading);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
const executeRedirection = async () => {
|
|
203
|
+
handleLoading(true);
|
|
204
|
+
const androidStoreLink = "https://play.google.com/store/apps/details?id=com.gataca.identity";
|
|
205
|
+
const iosStoreLink = "https://apps.apple.com/us/app/gataca/id1498607616";
|
|
206
|
+
try {
|
|
207
|
+
const appScheme = await this.getAuthRequest();
|
|
208
|
+
this.isAppInstalled(appScheme, (installed) => {
|
|
209
|
+
if (!installed) {
|
|
210
|
+
setTimeout(() => {
|
|
211
|
+
this.stop();
|
|
212
|
+
if (isAndroid) {
|
|
213
|
+
window.location.href = androidStoreLink;
|
|
214
|
+
}
|
|
215
|
+
else if (isIos) {
|
|
216
|
+
window.location.href = iosStoreLink;
|
|
217
|
+
}
|
|
218
|
+
}, 500);
|
|
219
|
+
}
|
|
220
|
+
handleLoading(false);
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
this.stop();
|
|
225
|
+
handleLoading(false);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
|
|
229
|
+
executeRedirection();
|
|
230
|
+
}, disabled: loading }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
|
|
231
|
+
}
|
|
59
232
|
render() {
|
|
60
|
-
|
|
233
|
+
const userAgent =
|
|
234
|
+
// @ts-ignore
|
|
235
|
+
(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);
|
|
236
|
+
const isAndroid = /android/i.test(userAgent);
|
|
237
|
+
const isIos =
|
|
238
|
+
// @ts-ignore
|
|
239
|
+
(/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) ||
|
|
240
|
+
(navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
|
|
241
|
+
const isMobile = isAndroid || isIos;
|
|
242
|
+
return (h("div", { class: "buttonContainer" }, isMobile && this.v === "3"
|
|
243
|
+
? this.renderMobileButton(isAndroid, isIos)
|
|
244
|
+
: this.renderDesktopButton(), this.open && (!isMobile || this.v === "3") && this.renderModal()));
|
|
61
245
|
}
|
|
62
246
|
static get is() { return "gataca-ssibutton"; }
|
|
63
247
|
static get encapsulation() { return "shadow"; }
|
|
@@ -171,6 +355,22 @@ export class GatacaSSIButton {
|
|
|
171
355
|
},
|
|
172
356
|
"defaultValue": "undefined"
|
|
173
357
|
},
|
|
358
|
+
"handleCheckAppLoading": {
|
|
359
|
+
"type": "unknown",
|
|
360
|
+
"mutable": false,
|
|
361
|
+
"complexType": {
|
|
362
|
+
"original": "(isCheckingApp?: boolean) => void",
|
|
363
|
+
"resolved": "(isCheckingApp?: boolean) => void",
|
|
364
|
+
"references": {}
|
|
365
|
+
},
|
|
366
|
+
"required": false,
|
|
367
|
+
"optional": true,
|
|
368
|
+
"docs": {
|
|
369
|
+
"tags": [],
|
|
370
|
+
"text": "_[Optional]_\nFunction that runs every time the loading state changes while checking if the App is installed. Only on mobile with v3."
|
|
371
|
+
},
|
|
372
|
+
"defaultValue": "undefined"
|
|
373
|
+
},
|
|
174
374
|
"qrRole": {
|
|
175
375
|
"type": "string",
|
|
176
376
|
"mutable": false,
|
|
@@ -620,7 +820,11 @@ export class GatacaSSIButton {
|
|
|
620
820
|
}
|
|
621
821
|
static get states() {
|
|
622
822
|
return {
|
|
623
|
-
"open": {}
|
|
823
|
+
"open": {},
|
|
824
|
+
"sessionId": {},
|
|
825
|
+
"authenticationRequest": {},
|
|
826
|
+
"sessionData": {},
|
|
827
|
+
"result": {}
|
|
624
828
|
};
|
|
625
829
|
}
|
|
626
830
|
static get events() {
|
|
@@ -673,6 +877,42 @@ export class GatacaSSIButton {
|
|
|
673
877
|
"text": "Retrieve manually the session data on a successful login",
|
|
674
878
|
"tags": []
|
|
675
879
|
}
|
|
880
|
+
},
|
|
881
|
+
"startMobilePolling": {
|
|
882
|
+
"complexType": {
|
|
883
|
+
"signature": "() => Promise<void>",
|
|
884
|
+
"parameters": [],
|
|
885
|
+
"references": {
|
|
886
|
+
"Promise": {
|
|
887
|
+
"location": "global"
|
|
888
|
+
},
|
|
889
|
+
"RESULT_STATUS": {
|
|
890
|
+
"location": "import",
|
|
891
|
+
"path": "../../utils/utils"
|
|
892
|
+
}
|
|
893
|
+
},
|
|
894
|
+
"return": "Promise<void>"
|
|
895
|
+
},
|
|
896
|
+
"docs": {
|
|
897
|
+
"text": "Force manually the start polling",
|
|
898
|
+
"tags": []
|
|
899
|
+
}
|
|
900
|
+
},
|
|
901
|
+
"stop": {
|
|
902
|
+
"complexType": {
|
|
903
|
+
"signature": "() => Promise<void>",
|
|
904
|
+
"parameters": [],
|
|
905
|
+
"references": {
|
|
906
|
+
"Promise": {
|
|
907
|
+
"location": "global"
|
|
908
|
+
}
|
|
909
|
+
},
|
|
910
|
+
"return": "Promise<void>"
|
|
911
|
+
},
|
|
912
|
+
"docs": {
|
|
913
|
+
"text": "Stop manually an ongoing session",
|
|
914
|
+
"tags": []
|
|
915
|
+
}
|
|
676
916
|
}
|
|
677
917
|
};
|
|
678
918
|
}
|