@gataca/qr 0.0.21 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/gat-icon-alert-0ad19b26.js +14 -0
- package/dist/cjs/gataca-autoqr.cjs.entry.js +106 -0
- package/dist/cjs/gataca-qr_2.cjs.entry.js +295 -0
- package/dist/cjs/gataca-qrws.cjs.entry.js +252 -0
- package/dist/cjs/gataca-ssibutton_2.cjs.entry.js +317 -0
- package/dist/cjs/gatacaqr.cjs.js +19 -0
- package/dist/cjs/index-93d47a75.js +1469 -0
- package/dist/cjs/index.cjs.js +16 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/qr-code-styling-412bbc7a.js +28 -0
- package/dist/cjs/utils-ef28b844.js +27 -0
- package/dist/collection/assets/icons/gat-icon-alert.svg +5 -0
- package/dist/collection/assets/icons/gat-icon-check.svg +5 -0
- package/dist/collection/assets/icons/gat-icon-refresh.svg +4 -0
- package/dist/collection/assets/images/logo_gataca.svg +7 -0
- package/dist/collection/collection-manifest.json +17 -0
- package/dist/collection/components/gataca-autoqr/gataca-autoqr.css +116 -0
- package/dist/collection/components/gataca-autoqr/gataca-autoqr.js +347 -0
- package/dist/collection/components/gataca-qr/components/qr/QR.js +5 -0
- package/dist/collection/components/gataca-qr/components/readQR/ReadQR.js +11 -0
- package/dist/collection/components/gataca-qr/components/readQR/components/AnimatedLoader.js +4 -0
- package/dist/collection/components/gataca-qr/components/retryButton/RetryButton.js +13 -0
- package/dist/collection/components/gataca-qr/components/success/Success.js +8 -0
- package/dist/collection/components/gataca-qr/gataca-qr.css +399 -0
- package/dist/collection/components/gataca-qr/gataca-qr.js +988 -0
- package/dist/collection/components/gataca-qrdisplay/gataca-qrdisplay.js +178 -0
- package/dist/collection/components/gataca-qrws/components/qr/QR.js +5 -0
- package/dist/collection/components/gataca-qrws/components/readQR/ReadQR.js +11 -0
- package/dist/collection/components/gataca-qrws/components/readQR/components/AnimatedLoader.js +4 -0
- package/dist/collection/components/gataca-qrws/components/retryButton/RetryButton.js +13 -0
- package/dist/collection/components/gataca-qrws/components/success/Success.js +8 -0
- package/dist/collection/components/gataca-qrws/gataca-qrws.css +400 -0
- package/dist/collection/components/gataca-qrws/gataca-qrws.js +997 -0
- package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.css +116 -0
- package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.js +981 -0
- package/dist/collection/components/gataca-ssibuttonws/gataca-ssibuttonws.css +116 -0
- package/dist/collection/components/gataca-ssibuttonws/gataca-ssibuttonws.js +434 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/utils/index.js +1 -0
- package/dist/collection/utils/utils.js +22 -0
- package/dist/components/gat-icon-alert.js +30 -0
- package/dist/components/gataca-autoqr.js +163 -0
- package/dist/components/gataca-qr.js +6 -0
- package/dist/components/gataca-qr2.js +310 -0
- package/dist/components/gataca-qrdisplay.js +6 -0
- package/dist/components/gataca-qrdisplay2.js +95 -0
- package/dist/components/gataca-qrws.js +6 -0
- package/dist/components/gataca-qrws2.js +311 -0
- package/dist/components/gataca-ssibutton.js +6 -0
- package/dist/{gatacaqr/gataca-ssibutton.entry.js → components/gataca-ssibutton2.js} +80 -10
- package/dist/components/gataca-ssibuttonws.js +6 -0
- package/dist/{gatacaqr/gataca-ssibuttonws.entry.js → components/gataca-ssibuttonws2.js} +56 -8
- package/dist/components/index.js +8 -0
- package/dist/{gatacaqr/gat-icon-alert-13a1894e.js → esm/gat-icon-alert-7b06ef3a.js} +3 -1
- package/dist/{gatacaqr → esm}/gataca-autoqr.entry.js +6 -5
- package/dist/{gatacaqr/gataca-qr.entry.js → esm/gataca-qr_2.entry.js} +53 -12
- package/dist/{gatacaqr → esm}/gataca-qrws.entry.js +9 -9
- package/dist/esm/gataca-ssibutton_2.entry.js +312 -0
- package/dist/esm/gatacaqr.js +17 -0
- package/dist/esm/index-2be54f32.js +1443 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/qr-code-styling-0eeb38d5.js +26 -0
- package/dist/gatacaqr/gatacaqr.esm.js +1 -129
- package/dist/gatacaqr/index.esm.js +1 -1
- package/dist/gatacaqr/p-0be4566d.js +1 -0
- package/dist/gatacaqr/p-0f339cfa.entry.js +1 -0
- package/dist/gatacaqr/p-1f784e14.entry.js +1 -0
- package/dist/gatacaqr/p-2cd7b062.js +1 -0
- package/dist/gatacaqr/p-5ae5f952.js +2 -0
- package/dist/gatacaqr/p-5e81ab9e.entry.js +1 -0
- package/dist/gatacaqr/p-92a2e6f0.entry.js +1 -0
- package/dist/gatacaqr/p-ea783014.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/gataca-autoqr/gataca-autoqr.d.ts +6 -0
- package/dist/types/components/gataca-qr/components/qr/QR.d.ts +2 -0
- package/dist/types/components/gataca-qr/gataca-qr.d.ts +7 -1
- package/dist/types/components/gataca-qrdisplay/gataca-qrdisplay.d.ts +6 -0
- package/dist/types/components/gataca-qrws/components/qr/QR.d.ts +2 -0
- package/dist/types/components/gataca-qrws/gataca-qrws.d.ts +7 -1
- package/dist/types/components/gataca-ssibutton/gataca-ssibutton.d.ts +6 -0
- package/dist/types/components/gataca-ssibuttonws/gataca-ssibuttonws.d.ts +6 -0
- package/dist/types/components.d.ts +49 -0
- package/package.json +1 -1
- package/dist/gatacaqr/app-globals-0f993ce5.js +0 -3
- package/dist/gatacaqr/css-shim-8eec97b3.js +0 -4
- package/dist/gatacaqr/dom-1b0cf05d.js +0 -73
- package/dist/gatacaqr/gataca-qrdisplay-55780157.js +0 -97
- package/dist/gatacaqr/gataca-qrdisplay.entry.js +0 -2
- package/dist/gatacaqr/index-4bc6f36b.js +0 -3262
- package/dist/gatacaqr/shadow-css-146f2f6f.js +0 -387
- /package/dist/{gatacaqr → esm}/utils-63e7a33b.js +0 -0
|
@@ -0,0 +1,312 @@
|
|
|
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.qrType = "svg";
|
|
18
|
+
this.autostart = true;
|
|
19
|
+
this.checkStatus = undefined;
|
|
20
|
+
this.createSession = undefined;
|
|
21
|
+
this.successCallback = undefined;
|
|
22
|
+
this.errorCallback = undefined;
|
|
23
|
+
this.handleCheckAppLoading = undefined;
|
|
24
|
+
this.checkAppTimeout = 6;
|
|
25
|
+
this.qrRole = undefined;
|
|
26
|
+
this.callbackServer = undefined;
|
|
27
|
+
this.sessionTimeout = undefined;
|
|
28
|
+
this.pollingFrequency = undefined;
|
|
29
|
+
this.autorefresh = false;
|
|
30
|
+
this.v = "3";
|
|
31
|
+
this.qrModalTitle = "Quick Access";
|
|
32
|
+
this.modalTitleColor = "#4745B7";
|
|
33
|
+
this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
|
|
34
|
+
this.hideBrandTitle = false;
|
|
35
|
+
this.dynamicLink = true;
|
|
36
|
+
this.logoSize = 0;
|
|
37
|
+
this.logoSrc = undefined;
|
|
38
|
+
this.qrCodeExpiredLabel = "QR Code expired";
|
|
39
|
+
this.credentialsNotValidatedLabel = "User credentials not validated";
|
|
40
|
+
this.clickInsideBoxLabel = "Click inside the box to";
|
|
41
|
+
this.refreshQrLabel = "Refresh QR Code";
|
|
42
|
+
this.scanQrLabel = "Scan QR Code";
|
|
43
|
+
this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time";
|
|
44
|
+
this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated";
|
|
45
|
+
this.failedLoginErrorLabel = "No successful login";
|
|
46
|
+
this.successLoginLabel = "Successful Connection!";
|
|
47
|
+
this.byBrandLabel = "by Gataca";
|
|
48
|
+
this.waitingStartSessionLabel = "waiting to start a session";
|
|
49
|
+
this.hideQrModalDescription = false;
|
|
50
|
+
this.open = false;
|
|
51
|
+
this.sessionId = undefined;
|
|
52
|
+
this.authenticationRequest = undefined;
|
|
53
|
+
this.sessionData = undefined;
|
|
54
|
+
this.result = RESULT_STATUS.NOT_STARTED;
|
|
55
|
+
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, qrType: this.qrType, 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 }));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Retrieve manually the session data on a successful login
|
|
59
|
+
*/
|
|
60
|
+
async getSessionData() {
|
|
61
|
+
return this.qr.getSessionData();
|
|
62
|
+
}
|
|
63
|
+
async getSessionId() {
|
|
64
|
+
if (this.sessionId) {
|
|
65
|
+
return this.sessionId;
|
|
66
|
+
}
|
|
67
|
+
let { sessionId, authenticationRequest } = await this.createSession();
|
|
68
|
+
this.sessionId = sessionId;
|
|
69
|
+
this.authenticationRequest = authenticationRequest;
|
|
70
|
+
return this.sessionId;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Force manually the start polling
|
|
74
|
+
*/
|
|
75
|
+
async startMobilePolling() {
|
|
76
|
+
await this.getSessionId();
|
|
77
|
+
this.result = RESULT_STATUS.ONGOING;
|
|
78
|
+
this.poll()
|
|
79
|
+
.then((data) => {
|
|
80
|
+
this.result = RESULT_STATUS.SUCCESS;
|
|
81
|
+
this.sessionData = data;
|
|
82
|
+
this.gatacaLoginCompleted.emit(data);
|
|
83
|
+
this.successCallback(data);
|
|
84
|
+
})
|
|
85
|
+
.catch((err) => {
|
|
86
|
+
this.clean();
|
|
87
|
+
let expired = err === RESULT_STATUS.EXPIRED;
|
|
88
|
+
if (expired && this.autorefresh) {
|
|
89
|
+
this.startMobilePolling();
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
if (err !== RESULT_STATUS.NOT_STARTED) {
|
|
93
|
+
let error = expired
|
|
94
|
+
? new Error(this.userNotScanInTimeErrorLabel)
|
|
95
|
+
: new Error(this.credsNotValidatedErrorLabel);
|
|
96
|
+
this.result = err;
|
|
97
|
+
this.gatacaLoginFailed.emit(error);
|
|
98
|
+
this.errorCallback(error);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Stop manually an ongoing session
|
|
105
|
+
*/
|
|
106
|
+
async stop() {
|
|
107
|
+
this.clean();
|
|
108
|
+
if (this.result === RESULT_STATUS.ONGOING || RESULT_STATUS.READ) {
|
|
109
|
+
this.result = RESULT_STATUS.NOT_STARTED;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
clean() {
|
|
113
|
+
this.sessionData = undefined;
|
|
114
|
+
this.sessionId = undefined;
|
|
115
|
+
}
|
|
116
|
+
renderModal() {
|
|
117
|
+
return this.qr;
|
|
118
|
+
}
|
|
119
|
+
async poll() {
|
|
120
|
+
let endTime = new Date().getTime() +
|
|
121
|
+
(this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
|
|
122
|
+
let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
|
|
123
|
+
let checkFunc = async (component) => {
|
|
124
|
+
if (component.result === RESULT_STATUS.NOT_STARTED) {
|
|
125
|
+
return { result: RESULT_STATUS.NOT_STARTED };
|
|
126
|
+
}
|
|
127
|
+
let id = await component.getSessionId();
|
|
128
|
+
return component.checkStatus(id);
|
|
129
|
+
};
|
|
130
|
+
let component = this;
|
|
131
|
+
let checkCondition = async function (resolve, reject) {
|
|
132
|
+
// If the condition is met, we're done!
|
|
133
|
+
let { result, data } = await checkFunc(component);
|
|
134
|
+
switch (result) {
|
|
135
|
+
case RESULT_STATUS.SUCCESS:
|
|
136
|
+
resolve(data);
|
|
137
|
+
break;
|
|
138
|
+
case RESULT_STATUS.READ:
|
|
139
|
+
component.result = RESULT_STATUS.READ;
|
|
140
|
+
case RESULT_STATUS.ONGOING:
|
|
141
|
+
if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
|
|
142
|
+
setTimeout(checkCondition, interval, resolve, reject);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
reject(RESULT_STATUS.EXPIRED);
|
|
146
|
+
}
|
|
147
|
+
break;
|
|
148
|
+
default:
|
|
149
|
+
reject(result);
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
return new Promise(checkCondition);
|
|
154
|
+
}
|
|
155
|
+
isAppInstalled(appScheme, callback) {
|
|
156
|
+
let timeout;
|
|
157
|
+
let detected = false;
|
|
158
|
+
if (appScheme === null || appScheme === void 0 ? void 0 : appScheme.length) {
|
|
159
|
+
window.location.href = appScheme;
|
|
160
|
+
}
|
|
161
|
+
const waitTimeToCheckApp = this.checkAppTimeout * 1000;
|
|
162
|
+
timeout = setTimeout(() => {
|
|
163
|
+
if (!detected) {
|
|
164
|
+
callback(false);
|
|
165
|
+
}
|
|
166
|
+
cleanup();
|
|
167
|
+
}, waitTimeToCheckApp);
|
|
168
|
+
const handleVisibilityChange = () => {
|
|
169
|
+
if (document.hidden) {
|
|
170
|
+
detected = true;
|
|
171
|
+
callback(true);
|
|
172
|
+
if (!this.autostart) {
|
|
173
|
+
this.startMobilePolling();
|
|
174
|
+
}
|
|
175
|
+
cleanup();
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
179
|
+
function cleanup() {
|
|
180
|
+
clearTimeout(timeout);
|
|
181
|
+
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
renderDesktopButton() {
|
|
185
|
+
return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
|
|
186
|
+
this.open = !this.open;
|
|
187
|
+
setTimeout(() => {
|
|
188
|
+
var _a, _b;
|
|
189
|
+
if (this.open) {
|
|
190
|
+
(_a = this.qrElement) === null || _a === void 0 ? void 0 : _a.display();
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
(_b = this.qrElement) === null || _b === void 0 ? void 0 : _b.stop();
|
|
194
|
+
}
|
|
195
|
+
}, 0);
|
|
196
|
+
} }, h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
|
|
197
|
+
}
|
|
198
|
+
async getAuthRequest() {
|
|
199
|
+
let { authenticationRequest } = await this.createSession();
|
|
200
|
+
return authenticationRequest;
|
|
201
|
+
}
|
|
202
|
+
renderMobileButton(isAndroid, isIos) {
|
|
203
|
+
if (this.autostart) {
|
|
204
|
+
this.startMobilePolling();
|
|
205
|
+
}
|
|
206
|
+
let loading = false;
|
|
207
|
+
const handleLoading = (isLoading) => {
|
|
208
|
+
loading = isLoading;
|
|
209
|
+
if (this.handleCheckAppLoading) {
|
|
210
|
+
this.handleCheckAppLoading(isLoading);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
const executeRedirection = async () => {
|
|
214
|
+
handleLoading(true);
|
|
215
|
+
const androidStoreLink = "https://play.google.com/store/apps/details?id=com.gataca.identity";
|
|
216
|
+
const iosStoreLink = "https://apps.apple.com/us/app/gataca/id1498607616";
|
|
217
|
+
try {
|
|
218
|
+
const appScheme = await this.getAuthRequest();
|
|
219
|
+
this.isAppInstalled(appScheme, (installed) => {
|
|
220
|
+
if (!installed) {
|
|
221
|
+
this.stop();
|
|
222
|
+
if (isAndroid) {
|
|
223
|
+
window.location.href = androidStoreLink;
|
|
224
|
+
}
|
|
225
|
+
else if (isIos) {
|
|
226
|
+
window.location.href = iosStoreLink;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
handleLoading(false);
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
this.stop();
|
|
234
|
+
handleLoading(false);
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
|
|
238
|
+
executeRedirection();
|
|
239
|
+
}, disabled: loading }, h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
|
|
240
|
+
}
|
|
241
|
+
render() {
|
|
242
|
+
const userAgent =
|
|
243
|
+
// @ts-ignore
|
|
244
|
+
(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);
|
|
245
|
+
const isAndroid = /android/i.test(userAgent);
|
|
246
|
+
const isIos =
|
|
247
|
+
// @ts-ignore
|
|
248
|
+
(/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) ||
|
|
249
|
+
(navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
|
|
250
|
+
const isMobile = isAndroid || isIos;
|
|
251
|
+
return (h("div", { class: "buttonContainer" }, isMobile && this.v === "3"
|
|
252
|
+
? this.renderMobileButton(isAndroid, isIos)
|
|
253
|
+
: this.renderDesktopButton(), this.open && (!isMobile || this.v === "3") && this.renderModal()));
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
GatacaSSIButton.style = gatacaSsibuttonCss;
|
|
257
|
+
|
|
258
|
+
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}";
|
|
259
|
+
|
|
260
|
+
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=";
|
|
261
|
+
const GatacaSSIButtonWS = class {
|
|
262
|
+
constructor(hostRef) {
|
|
263
|
+
registerInstance(this, hostRef);
|
|
264
|
+
this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
|
|
265
|
+
this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
|
|
266
|
+
this.buttonText = "Easy login";
|
|
267
|
+
this.successCallback = undefined;
|
|
268
|
+
this.errorCallback = undefined;
|
|
269
|
+
this.qrType = "svg";
|
|
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 = (h("gataca-qrws", { wsOnMessage: this.wsOnMessage, wsOnOpen: this.wsOnOpen, successCallback: this.successCallback, errorCallback: this.errorCallback, qrRole: this.qrRole, qrType: this.qrType, 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 (h("div", { class: "gatacaButtonWrapper" }, 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
|
+
} }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
|
|
305
|
+
}
|
|
306
|
+
render() {
|
|
307
|
+
return (h("div", { class: "buttonContainer" }, this.renderButton(), this.open && this.renderModal()));
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
GatacaSSIButtonWS.style = gatacaSsibuttonwsCss;
|
|
311
|
+
|
|
312
|
+
export { GatacaSSIButton as gataca_ssibutton, GatacaSSIButtonWS as gataca_ssibuttonws };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-2be54f32.js';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Stencil Client Patch Browser v2.19.3 | MIT Licensed | https://stenciljs.com
|
|
5
|
+
*/
|
|
6
|
+
const patchBrowser = () => {
|
|
7
|
+
const importMeta = import.meta.url;
|
|
8
|
+
const opts = {};
|
|
9
|
+
if (importMeta !== '') {
|
|
10
|
+
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
11
|
+
}
|
|
12
|
+
return promiseResolve(opts);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
patchBrowser().then(options => {
|
|
16
|
+
return bootstrapLazy([["gataca-qr_2",[[1,"gataca-qr",{"checkStatus":[16],"createSession":[16],"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"qrType":[1,"qr-type"],"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"],"qrType":[1,"qr-type"],"size":[2],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrColor":[1,"qr-color"],"rounded":[4]}]]],["gataca-qrws",[[1,"gataca-qrws",{"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"qrType":[1,"qr-type"],"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",[[1,"gataca-ssibutton",{"buttonText":[1,"button-text"],"qrType":[1,"qr-type"],"autostart":[4],"checkStatus":[16],"createSession":[16],"successCallback":[16],"errorCallback":[16],"handleCheckAppLoading":[16],"checkAppTimeout":[2,"check-app-timeout"],"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],"qrType":[1,"qr-type"],"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",[[1,"gataca-autoqr",{"configId":[1,"config-id"],"qrType":[1,"qr-type"],"configRepository":[1,"config-repository"],"successCallback":[16],"errorCallback":[16],"checkStatus":[16],"createSession":[16],"wsOnOpen":[16],"wsOnMessage":[16],"config":[32],"loading":[32],"getSessionData":[64]}]]]], options);
|
|
17
|
+
});
|