@gataca/qr 0.0.14 → 0.0.16
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 +1 -1
- package/dist/cjs/{gataca-qr_3.cjs.entry.js → gataca-qr_2.cjs.entry.js} +29 -275
- package/dist/cjs/gataca-qrws.cjs.entry.js +3 -2
- package/dist/cjs/gataca-ssibutton_2.cjs.entry.js +320 -0
- package/dist/cjs/gatacaqr.cjs.js +2 -2
- package/dist/cjs/{index-93d47a75.js → index-8638645b.js} +13 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/{esm/gat-icon-alert-c9761842.js → cjs/qr-code-styling-412bbc7a.js} +2 -8
- package/dist/collection/components/gataca-qr/gataca-qr.js +21 -9
- package/dist/collection/components/gataca-qrdisplay/gataca-qrdisplay.js +1 -1
- package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.js +2 -2
- package/dist/components/gataca-qr2.js +22 -11
- package/dist/components/gataca-qrdisplay2.js +1 -1
- package/dist/components/gataca-ssibutton2.js +2 -2
- package/dist/esm/gat-icon-alert-7b06ef3a.js +9 -0
- package/dist/esm/gataca-autoqr.entry.js +1 -1
- package/dist/esm/{gataca-qr_3.entry.js → gataca-qr_2.entry.js} +29 -274
- package/dist/esm/gataca-qrws.entry.js +3 -2
- package/dist/esm/gataca-ssibutton_2.entry.js +315 -0
- package/dist/esm/gatacaqr.js +2 -2
- package/dist/esm/{index-2be54f32.js → index-af2994f7.js} +13 -1
- package/dist/esm/loader.js +2 -2
- package/dist/{cjs/gat-icon-alert-6127161a.js → esm/qr-code-styling-0eeb38d5.js} +1 -15
- package/dist/gatacaqr/gatacaqr.esm.js +1 -1
- package/dist/gatacaqr/p-0be4566d.js +1 -0
- package/dist/gatacaqr/{p-0381ab9a.entry.js → p-3ca3bb1a.entry.js} +1 -1
- package/dist/gatacaqr/p-88af482f.entry.js +1 -0
- package/dist/gatacaqr/p-ba0417e2.js +2 -0
- package/dist/gatacaqr/p-d0b1d317.entry.js +1 -0
- package/dist/gatacaqr/p-d59ae0ab.entry.js +1 -0
- package/dist/gatacaqr/p-ea783014.js +1 -0
- package/package.json +1 -1
- package/dist/cjs/gataca-ssibuttonws.cjs.entry.js +0 -60
- package/dist/esm/gataca-ssibuttonws.entry.js +0 -56
- package/dist/gatacaqr/p-044b978b.entry.js +0 -1
- package/dist/gatacaqr/p-5ae5f952.js +0 -2
- package/dist/gatacaqr/p-8464955a.entry.js +0 -1
- package/dist/gatacaqr/p-bdd385ad.entry.js +0 -1
- package/dist/gatacaqr/p-d79c8f74.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, proxyCustomElement, HTMLElement, createEvent } from '@stencil/core/internal/client';
|
|
1
|
+
import { h, proxyCustomElement, HTMLElement, createEvent, forceUpdate } from '@stencil/core/internal/client';
|
|
2
2
|
import { l as logoGatacaSvg, d as defineCustomElement$1 } from './gataca-qrdisplay2.js';
|
|
3
3
|
import { g as gatIconCheckSvg, a as gatIconRefreshSvg, d as gatIconAlertSvg, R as RESULT_STATUS, c as checkMobile, b as base64UrlEncode } from './gat-icon-alert.js';
|
|
4
4
|
|
|
@@ -73,7 +73,7 @@ const DEEP_LINK_PREFIX = "https://api.gataca.io/qr/redirect.html";
|
|
|
73
73
|
const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
|
|
74
74
|
const DEFAULT_POLLING_FREQ = 3;
|
|
75
75
|
const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
76
|
-
constructor() { super(); this.__registerHost(); this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7); this.checkStatus = undefined; this.createSession = undefined; this.successCallback = undefined; this.errorCallback = undefined; this.qrId = undefined; this.qrRole = undefined; this.callbackServer = undefined; this.autostart = true; this.autorefresh = false; this.v = "3"; this.qrModalTitle = "Quick Access"; this.modalTitleColor = "#4745B7"; this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet"; this.hideModalTexts = false; this.hideModalBoxShadow = false; this.hideBrandTitle = false; this.logoSize = 0; this.logoSrc = logoGatacaSvg; this.qrSize = 300; this.modalWidth = 300; this.modalHeight = undefined; this.qrCodeExpiredLabel = "QR Code expired"; this.credentialsNotValidatedLabel = "User credentials not validated"; this.clickInsideBoxLabel = "Click inside the box to"; this.refreshQrLabel = "Refresh QR Code"; this.scanQrLabel = "Scan QR Code"; this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time"; this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated"; this.failedLoginErrorLabel = "No successful login"; this.successLoginLabel = "Successful Connection!"; this.byBrandLabel = "by Gataca"; this.waitingStartSessionLabel = "waiting to start a session"; this.readQrTitle = "Processing..."; this.readQrDescription = "Please wait a moment"; this.hideQrModalDescription = false; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT; this.pollingFrequency = DEFAULT_POLLING_FREQ; this.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = RESULT_STATUS.NOT_STARTED; }
|
|
76
|
+
constructor() { super(); this.__registerHost(); this.__attachShadow(); this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7); this.checkStatus = undefined; this.createSession = undefined; this.successCallback = undefined; this.errorCallback = undefined; this.qrId = undefined; this.qrRole = undefined; this.callbackServer = undefined; this.autostart = true; this.autorefresh = false; this.v = "3"; this.qrModalTitle = "Quick Access"; this.modalTitleColor = "#4745B7"; this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet"; this.hideModalTexts = false; this.hideModalBoxShadow = false; this.hideBrandTitle = false; this.logoSize = 0; this.logoSrc = logoGatacaSvg; this.qrSize = 300; this.modalWidth = 300; this.modalHeight = undefined; this.qrCodeExpiredLabel = "QR Code expired"; this.credentialsNotValidatedLabel = "User credentials not validated"; this.clickInsideBoxLabel = "Click inside the box to"; this.refreshQrLabel = "Refresh QR Code"; this.scanQrLabel = "Scan QR Code"; this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time"; this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated"; this.failedLoginErrorLabel = "No successful login"; this.successLoginLabel = "Successful Connection!"; this.byBrandLabel = "by Gataca"; this.waitingStartSessionLabel = "waiting to start a session"; this.readQrTitle = "Processing..."; this.readQrDescription = "Please wait a moment"; this.hideQrModalDescription = false; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT; this.pollingFrequency = DEFAULT_POLLING_FREQ; this.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = RESULT_STATUS.NOT_STARTED; }
|
|
77
77
|
disconnectedCallback() {
|
|
78
78
|
this.stop();
|
|
79
79
|
}
|
|
@@ -88,9 +88,15 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
88
88
|
async display() {
|
|
89
89
|
await this.getSessionId();
|
|
90
90
|
this.result = RESULT_STATUS.ONGOING;
|
|
91
|
+
console.log("display0", "this.result", this.result);
|
|
92
|
+
forceUpdate(this);
|
|
93
|
+
console.log("display1", "this.result", this.result);
|
|
91
94
|
this.poll()
|
|
92
95
|
.then((data) => {
|
|
93
96
|
this.result = RESULT_STATUS.SUCCESS;
|
|
97
|
+
console.log("display2", "this.result", this.result);
|
|
98
|
+
forceUpdate(this);
|
|
99
|
+
console.log("display3", "this.result", this.result);
|
|
94
100
|
this.sessionData = data;
|
|
95
101
|
this.gatacaLoginCompleted.emit(data);
|
|
96
102
|
this.successCallback(data);
|
|
@@ -107,6 +113,9 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
107
113
|
? new Error(this.userNotScanInTimeErrorLabel)
|
|
108
114
|
: new Error(this.credsNotValidatedErrorLabel);
|
|
109
115
|
this.result = err;
|
|
116
|
+
console.log("display4", "this.result", this.result);
|
|
117
|
+
forceUpdate(this);
|
|
118
|
+
console.log("display5", "this.result", this.result);
|
|
110
119
|
this.gatacaLoginFailed.emit(error);
|
|
111
120
|
this.errorCallback(error);
|
|
112
121
|
}
|
|
@@ -138,17 +147,17 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
138
147
|
: Promise.reject(new Error(this.failedLoginErrorLabel));
|
|
139
148
|
}
|
|
140
149
|
async getSessionId() {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
console.log("111 getSessionId", "this.sessionId", this.sessionId);
|
|
150
|
+
if (this.sessionId) {
|
|
151
|
+
return this.sessionId;
|
|
152
|
+
}
|
|
153
|
+
// console.log("111 getSessionId", "this.sessionId", this.sessionId);
|
|
145
154
|
if (this.createSession) {
|
|
146
155
|
let { sessionId, authenticationRequest } = await this.createSession();
|
|
147
|
-
console.log("222 getSessionId", "sessionId", sessionId);
|
|
156
|
+
// console.log("222 getSessionId", "sessionId", sessionId);
|
|
148
157
|
this.sessionId = sessionId;
|
|
149
158
|
this.authenticationRequest = authenticationRequest;
|
|
150
159
|
}
|
|
151
|
-
console.log("333 getSessionId", "this.sessionId", this.sessionId);
|
|
160
|
+
// console.log("333 getSessionId", "this.sessionId", this.sessionId);
|
|
152
161
|
return this.sessionId;
|
|
153
162
|
}
|
|
154
163
|
getLink() {
|
|
@@ -195,6 +204,7 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
195
204
|
return new Promise(checkCondition);
|
|
196
205
|
}
|
|
197
206
|
renderQRSection() {
|
|
207
|
+
console.log("renderQRSection", "this.result", this.result);
|
|
198
208
|
switch (this.result) {
|
|
199
209
|
case RESULT_STATUS.NOT_STARTED:
|
|
200
210
|
return this.renderRetryButton();
|
|
@@ -214,6 +224,7 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
214
224
|
}
|
|
215
225
|
}
|
|
216
226
|
renderSuccess() {
|
|
227
|
+
console.log("renderSuccess", "this.result", this.result);
|
|
217
228
|
return (h(Success, { modalHeight: this === null || this === void 0 ? void 0 : this.modalHeight, successLoginLabel: this === null || this === void 0 ? void 0 : this.successLoginLabel }));
|
|
218
229
|
}
|
|
219
230
|
renderRetryButton(errorMessage) {
|
|
@@ -223,11 +234,11 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
223
234
|
return (h(ReadQR, { modalWidth: this === null || this === void 0 ? void 0 : this.modalWidth, readQrMessages: readQrMessages, url: this.getLink(), sizeQR: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, renderQR: this.renderQR }));
|
|
224
235
|
}
|
|
225
236
|
renderQR(value, useLogo) {
|
|
226
|
-
console.log("this.qrId", this.qrId);
|
|
237
|
+
// console.log("this.qrId", this.qrId);
|
|
227
238
|
return (h(QR, { qrId: this.qrId, value: value, useLogo: useLogo, size: (this === null || this === void 0 ? void 0 : this.qrSize) || undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc }));
|
|
228
239
|
}
|
|
229
240
|
renderRetryQR(value, useLogo) {
|
|
230
|
-
console.log("this.qrId", this.qrId);
|
|
241
|
+
// console.log("this.qrId", this.qrId);
|
|
231
242
|
return (h(QR, { qrId: this.qrId, value: value, useLogo: useLogo, size: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc }));
|
|
232
243
|
}
|
|
233
244
|
render() {
|
|
@@ -248,7 +259,7 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
248
259
|
} }, this.renderQRSection())))));
|
|
249
260
|
}
|
|
250
261
|
static get style() { return gatacaQrCss; }
|
|
251
|
-
}, [
|
|
262
|
+
}, [1, "gataca-qr", {
|
|
252
263
|
"checkStatus": [16],
|
|
253
264
|
"createSession": [16],
|
|
254
265
|
"successCallback": [16],
|
|
@@ -46,7 +46,7 @@ const GatacaQRDisplay = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
46
46
|
height: this.size,
|
|
47
47
|
image: this.logoSize > 0 ? this.logoSrc || logoGatacaSvg : undefined,
|
|
48
48
|
margin: 10,
|
|
49
|
-
type: "
|
|
49
|
+
type: "canvas",
|
|
50
50
|
dotsOptions: {
|
|
51
51
|
color: this.qrColor,
|
|
52
52
|
type: this.rounded ? "dots" : "square",
|
|
@@ -55,7 +55,7 @@ const GatacaSSIButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
55
55
|
this.authenticationRequest = undefined;
|
|
56
56
|
this.sessionData = undefined;
|
|
57
57
|
this.result = RESULT_STATUS.NOT_STARTED;
|
|
58
|
-
console.log("qrId2", this.qrId);
|
|
58
|
+
// console.log("qrId2", this.qrId);
|
|
59
59
|
this.qr = (h("gataca-qr", { ref: (el) => (this.qrElement = el), qrId: this.qrId, 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 }));
|
|
60
60
|
this.qr.qrId = this.qrId;
|
|
61
61
|
}
|
|
@@ -187,7 +187,7 @@ const GatacaSSIButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
renderDesktopButton() {
|
|
190
|
-
console.log("this.qrId333", this.qrId);
|
|
190
|
+
// console.log("this.qrId333", this.qrId);
|
|
191
191
|
return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
|
|
192
192
|
this.open = !this.open;
|
|
193
193
|
setTimeout(() => {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const logoGatacaSvg = 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDc2IDcxIiB3aWR0aD0iNzEiIGhlaWdodD0iNjYiPgoJPHRpdGxlPlZlY3RvciAoMyktc3ZnPC90aXRsZT4KCTxzdHlsZT4KCQkuczAgeyBmaWxsOiAjNDc0NWI3IH0gCgk8L3N0eWxlPgoJPHBhdGggaWQ9IkxheWVyIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsYXNzPSJzMCIgZD0ibTcyLjIgMzguNGMyLjIgMy4zIDMuNSA3LjIgMy41IDExLjQgMCAxMS4yLTguOCAyMC4yLTE5LjkgMjAuN3EtMC40IDAtMC44IDBjLTMgMC01LjgtMC42LTguNC0xLjdxLTIuMS0xLTMuOC0yLjMtMS4xLTAuOC0yLjEtMS43LTEuMy0xLjItMi4zLTIuNi0wLjUgMC42LTEgMS4yYy0zLjggNC40LTkuNCA3LjEtMTUuNyA3LjEtNi43IDAtMTIuNi0zLjIt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SJyb3VuZCIvPgo8L3N2Zz4K';
|
|
8
|
+
|
|
9
|
+
export { gatIconRefreshSvg as a, gatIconAlertSvg as b, gatIconCheckSvg as g, logoGatacaSvg as l };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-af2994f7.js';
|
|
2
2
|
|
|
3
3
|
const gatacaAutoqrCss = "@import url(\"https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap\"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:\"\";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.buttonContainer{display:inline-block;text-align:right;padding:10px;position:relative}.gatacaButtonWrapper{margin:8px}.gatacaButtonWrapper .gatacaButton{display:flex;min-width:100px;padding:8px 8px;background-color:white;font-size:12px;font-family:\"Work Sans\", sans-serif;letter-spacing:1px;font-weight:2;justify-content:space-between;align-items:center;border-radius:6px;border:1px solid rgba(24, 27, 94, 0.5);color:rgba(24, 27, 94, 0.8);box-shadow:0px 1px 3px rgba(48, 48, 48, 0.15);cursor:pointer}.gatacaButtonWrapper .gatacaButton>span{margin-right:10px}.gatacaButtonWrapper .gatacaButton:hover{box-shadow:0px 2px 8px rgba(48, 48, 48, 0.1)}.gatacaButtonWrapper .buttonText{text-align:right;font-size:8px;color:rgba(24, 27, 94, 0.5);font-family:\"Helvetica Neue\", sans-serif;letter-spacing:1px;padding-right:8px;font-weight:1}.gatacaButtonWrapper .buttonImg{height:25px;width:25px;margin:0;margin-right:20px}";
|
|
4
4
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { r as registerInstance, h, c as createEvent } from './index-
|
|
2
|
-
import {
|
|
1
|
+
import { r as registerInstance, h, c as createEvent, f as forceUpdate } from './index-af2994f7.js';
|
|
2
|
+
import { l as logoGatacaSvg, g as gatIconCheckSvg, a as gatIconRefreshSvg, b as gatIconAlertSvg } from './gat-icon-alert-7b06ef3a.js';
|
|
3
|
+
import { Q as QRCodeStyling } from './qr-code-styling-0eeb38d5.js';
|
|
3
4
|
import { R as RESULT_STATUS, c as checkMobile, b as base64UrlEncode } from './utils-63e7a33b.js';
|
|
4
5
|
|
|
5
6
|
const GatacaQRDisplay = class {
|
|
@@ -20,7 +21,7 @@ const GatacaQRDisplay = class {
|
|
|
20
21
|
height: this.size,
|
|
21
22
|
image: this.logoSize > 0 ? this.logoSrc || logoGatacaSvg : undefined,
|
|
22
23
|
margin: 10,
|
|
23
|
-
type: "
|
|
24
|
+
type: "canvas",
|
|
24
25
|
dotsOptions: {
|
|
25
26
|
color: this.qrColor,
|
|
26
27
|
type: this.rounded ? "dots" : "square",
|
|
@@ -117,10 +118,10 @@ const gatacaQrCss = "@import url(\"https://fonts.googleapis.com/css2?family=Ubun
|
|
|
117
118
|
|
|
118
119
|
const DEEP_LINK_PREFIX = "https://api.gataca.io/qr/redirect.html";
|
|
119
120
|
//Default values
|
|
120
|
-
const DEFAULT_SESSION_TIMEOUT
|
|
121
|
-
const DEFAULT_POLLING_FREQ
|
|
121
|
+
const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
|
|
122
|
+
const DEFAULT_POLLING_FREQ = 3;
|
|
122
123
|
const GatacaQR = class {
|
|
123
|
-
constructor(hostRef) { registerInstance(this, hostRef); this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7); this.checkStatus = undefined; this.createSession = undefined; this.successCallback = undefined; this.errorCallback = undefined; this.qrId = undefined; this.qrRole = undefined; this.callbackServer = undefined; this.autostart = true; this.autorefresh = false; this.v = "3"; this.qrModalTitle = "Quick Access"; this.modalTitleColor = "#4745B7"; this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet"; this.hideModalTexts = false; this.hideModalBoxShadow = false; this.hideBrandTitle = false; this.logoSize = 0; this.logoSrc = logoGatacaSvg; this.qrSize = 300; this.modalWidth = 300; this.modalHeight = undefined; this.qrCodeExpiredLabel = "QR Code expired"; this.credentialsNotValidatedLabel = "User credentials not validated"; this.clickInsideBoxLabel = "Click inside the box to"; this.refreshQrLabel = "Refresh QR Code"; this.scanQrLabel = "Scan QR Code"; this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time"; this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated"; this.failedLoginErrorLabel = "No successful login"; this.successLoginLabel = "Successful Connection!"; this.byBrandLabel = "by Gataca"; this.waitingStartSessionLabel = "waiting to start a session"; this.readQrTitle = "Processing..."; this.readQrDescription = "Please wait a moment"; this.hideQrModalDescription = false; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT
|
|
124
|
+
constructor(hostRef) { registerInstance(this, hostRef); this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7); this.checkStatus = undefined; this.createSession = undefined; this.successCallback = undefined; this.errorCallback = undefined; this.qrId = undefined; this.qrRole = undefined; this.callbackServer = undefined; this.autostart = true; this.autorefresh = false; this.v = "3"; this.qrModalTitle = "Quick Access"; this.modalTitleColor = "#4745B7"; this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet"; this.hideModalTexts = false; this.hideModalBoxShadow = false; this.hideBrandTitle = false; this.logoSize = 0; this.logoSrc = logoGatacaSvg; this.qrSize = 300; this.modalWidth = 300; this.modalHeight = undefined; this.qrCodeExpiredLabel = "QR Code expired"; this.credentialsNotValidatedLabel = "User credentials not validated"; this.clickInsideBoxLabel = "Click inside the box to"; this.refreshQrLabel = "Refresh QR Code"; this.scanQrLabel = "Scan QR Code"; this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time"; this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated"; this.failedLoginErrorLabel = "No successful login"; this.successLoginLabel = "Successful Connection!"; this.byBrandLabel = "by Gataca"; this.waitingStartSessionLabel = "waiting to start a session"; this.readQrTitle = "Processing..."; this.readQrDescription = "Please wait a moment"; this.hideQrModalDescription = false; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT; this.pollingFrequency = DEFAULT_POLLING_FREQ; this.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = RESULT_STATUS.NOT_STARTED; }
|
|
124
125
|
disconnectedCallback() {
|
|
125
126
|
this.stop();
|
|
126
127
|
}
|
|
@@ -135,9 +136,15 @@ const GatacaQR = class {
|
|
|
135
136
|
async display() {
|
|
136
137
|
await this.getSessionId();
|
|
137
138
|
this.result = RESULT_STATUS.ONGOING;
|
|
139
|
+
console.log("display0", "this.result", this.result);
|
|
140
|
+
forceUpdate(this);
|
|
141
|
+
console.log("display1", "this.result", this.result);
|
|
138
142
|
this.poll()
|
|
139
143
|
.then((data) => {
|
|
140
144
|
this.result = RESULT_STATUS.SUCCESS;
|
|
145
|
+
console.log("display2", "this.result", this.result);
|
|
146
|
+
forceUpdate(this);
|
|
147
|
+
console.log("display3", "this.result", this.result);
|
|
141
148
|
this.sessionData = data;
|
|
142
149
|
this.gatacaLoginCompleted.emit(data);
|
|
143
150
|
this.successCallback(data);
|
|
@@ -154,6 +161,9 @@ const GatacaQR = class {
|
|
|
154
161
|
? new Error(this.userNotScanInTimeErrorLabel)
|
|
155
162
|
: new Error(this.credsNotValidatedErrorLabel);
|
|
156
163
|
this.result = err;
|
|
164
|
+
console.log("display4", "this.result", this.result);
|
|
165
|
+
forceUpdate(this);
|
|
166
|
+
console.log("display5", "this.result", this.result);
|
|
157
167
|
this.gatacaLoginFailed.emit(error);
|
|
158
168
|
this.errorCallback(error);
|
|
159
169
|
}
|
|
@@ -185,17 +195,17 @@ const GatacaQR = class {
|
|
|
185
195
|
: Promise.reject(new Error(this.failedLoginErrorLabel));
|
|
186
196
|
}
|
|
187
197
|
async getSessionId() {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
console.log("111 getSessionId", "this.sessionId", this.sessionId);
|
|
198
|
+
if (this.sessionId) {
|
|
199
|
+
return this.sessionId;
|
|
200
|
+
}
|
|
201
|
+
// console.log("111 getSessionId", "this.sessionId", this.sessionId);
|
|
192
202
|
if (this.createSession) {
|
|
193
203
|
let { sessionId, authenticationRequest } = await this.createSession();
|
|
194
|
-
console.log("222 getSessionId", "sessionId", sessionId);
|
|
204
|
+
// console.log("222 getSessionId", "sessionId", sessionId);
|
|
195
205
|
this.sessionId = sessionId;
|
|
196
206
|
this.authenticationRequest = authenticationRequest;
|
|
197
207
|
}
|
|
198
|
-
console.log("333 getSessionId", "this.sessionId", this.sessionId);
|
|
208
|
+
// console.log("333 getSessionId", "this.sessionId", this.sessionId);
|
|
199
209
|
return this.sessionId;
|
|
200
210
|
}
|
|
201
211
|
getLink() {
|
|
@@ -207,8 +217,8 @@ const GatacaQR = class {
|
|
|
207
217
|
}
|
|
208
218
|
async poll() {
|
|
209
219
|
let endTime = new Date().getTime() +
|
|
210
|
-
(this.sessionTimeout || DEFAULT_SESSION_TIMEOUT
|
|
211
|
-
let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ
|
|
220
|
+
(this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
|
|
221
|
+
let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
|
|
212
222
|
let checkFunc = async (component) => {
|
|
213
223
|
if (component.result === RESULT_STATUS.NOT_STARTED) {
|
|
214
224
|
return { result: RESULT_STATUS.NOT_STARTED };
|
|
@@ -242,6 +252,7 @@ const GatacaQR = class {
|
|
|
242
252
|
return new Promise(checkCondition);
|
|
243
253
|
}
|
|
244
254
|
renderQRSection() {
|
|
255
|
+
console.log("renderQRSection", "this.result", this.result);
|
|
245
256
|
switch (this.result) {
|
|
246
257
|
case RESULT_STATUS.NOT_STARTED:
|
|
247
258
|
return this.renderRetryButton();
|
|
@@ -261,6 +272,7 @@ const GatacaQR = class {
|
|
|
261
272
|
}
|
|
262
273
|
}
|
|
263
274
|
renderSuccess() {
|
|
275
|
+
console.log("renderSuccess", "this.result", this.result);
|
|
264
276
|
return (h(Success, { modalHeight: this === null || this === void 0 ? void 0 : this.modalHeight, successLoginLabel: this === null || this === void 0 ? void 0 : this.successLoginLabel }));
|
|
265
277
|
}
|
|
266
278
|
renderRetryButton(errorMessage) {
|
|
@@ -270,11 +282,11 @@ const GatacaQR = class {
|
|
|
270
282
|
return (h(ReadQR, { modalWidth: this === null || this === void 0 ? void 0 : this.modalWidth, readQrMessages: readQrMessages, url: this.getLink(), sizeQR: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, renderQR: this.renderQR }));
|
|
271
283
|
}
|
|
272
284
|
renderQR(value, useLogo) {
|
|
273
|
-
console.log("this.qrId", this.qrId);
|
|
285
|
+
// console.log("this.qrId", this.qrId);
|
|
274
286
|
return (h(QR, { qrId: this.qrId, value: value, useLogo: useLogo, size: (this === null || this === void 0 ? void 0 : this.qrSize) || undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc }));
|
|
275
287
|
}
|
|
276
288
|
renderRetryQR(value, useLogo) {
|
|
277
|
-
console.log("this.qrId", this.qrId);
|
|
289
|
+
// console.log("this.qrId", this.qrId);
|
|
278
290
|
return (h(QR, { qrId: this.qrId, value: value, useLogo: useLogo, size: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc }));
|
|
279
291
|
}
|
|
280
292
|
render() {
|
|
@@ -297,261 +309,4 @@ const GatacaQR = class {
|
|
|
297
309
|
};
|
|
298
310
|
GatacaQR.style = gatacaQrCss;
|
|
299
311
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
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=";
|
|
303
|
-
//Default values
|
|
304
|
-
const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
|
|
305
|
-
const DEFAULT_POLLING_FREQ = 3;
|
|
306
|
-
const GatacaSSIButton = class {
|
|
307
|
-
constructor(hostRef) {
|
|
308
|
-
registerInstance(this, hostRef);
|
|
309
|
-
this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
|
|
310
|
-
this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
|
|
311
|
-
this.qrId = undefined;
|
|
312
|
-
this.buttonText = "Easy login";
|
|
313
|
-
this.autostart = true;
|
|
314
|
-
this.checkStatus = undefined;
|
|
315
|
-
this.createSession = undefined;
|
|
316
|
-
this.successCallback = undefined;
|
|
317
|
-
this.errorCallback = undefined;
|
|
318
|
-
this.handleCheckAppLoading = undefined;
|
|
319
|
-
this.checkAppTimeout = 6;
|
|
320
|
-
this.qrRole = undefined;
|
|
321
|
-
this.callbackServer = undefined;
|
|
322
|
-
this.sessionTimeout = undefined;
|
|
323
|
-
this.pollingFrequency = undefined;
|
|
324
|
-
this.autorefresh = false;
|
|
325
|
-
this.v = "3";
|
|
326
|
-
this.qrModalTitle = "Quick Access";
|
|
327
|
-
this.modalTitleColor = "#4745B7";
|
|
328
|
-
this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
|
|
329
|
-
this.hideBrandTitle = false;
|
|
330
|
-
this.dynamicLink = true;
|
|
331
|
-
this.logoSize = 0;
|
|
332
|
-
this.logoSrc = undefined;
|
|
333
|
-
this.qrCodeExpiredLabel = "QR Code expired";
|
|
334
|
-
this.credentialsNotValidatedLabel = "User credentials not validated";
|
|
335
|
-
this.clickInsideBoxLabel = "Click inside the box to";
|
|
336
|
-
this.refreshQrLabel = "Refresh QR Code";
|
|
337
|
-
this.scanQrLabel = "Scan QR Code";
|
|
338
|
-
this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time";
|
|
339
|
-
this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated";
|
|
340
|
-
this.failedLoginErrorLabel = "No successful login";
|
|
341
|
-
this.successLoginLabel = "Successful Connection!";
|
|
342
|
-
this.byBrandLabel = "by Gataca";
|
|
343
|
-
this.waitingStartSessionLabel = "waiting to start a session";
|
|
344
|
-
this.hideQrModalDescription = false;
|
|
345
|
-
this.open = false;
|
|
346
|
-
this.sessionId = undefined;
|
|
347
|
-
this.authenticationRequest = undefined;
|
|
348
|
-
this.sessionData = undefined;
|
|
349
|
-
this.result = RESULT_STATUS.NOT_STARTED;
|
|
350
|
-
console.log("qrId2", this.qrId);
|
|
351
|
-
this.qr = (h("gataca-qr", { ref: (el) => (this.qrElement = el), qrId: this.qrId, 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 }));
|
|
352
|
-
this.qr.qrId = this.qrId;
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* Retrieve manually the session data on a successful login
|
|
356
|
-
*/
|
|
357
|
-
async getSessionData() {
|
|
358
|
-
return this.qr.getSessionData();
|
|
359
|
-
}
|
|
360
|
-
async getSessionId() {
|
|
361
|
-
if (this.sessionId) {
|
|
362
|
-
return this.sessionId;
|
|
363
|
-
}
|
|
364
|
-
let { sessionId, authenticationRequest } = await this.createSession();
|
|
365
|
-
this.sessionId = sessionId;
|
|
366
|
-
this.authenticationRequest = authenticationRequest;
|
|
367
|
-
return this.sessionId;
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Force manually the start polling
|
|
371
|
-
*/
|
|
372
|
-
async startMobilePolling() {
|
|
373
|
-
await this.getSessionId();
|
|
374
|
-
this.result = RESULT_STATUS.ONGOING;
|
|
375
|
-
this.poll()
|
|
376
|
-
.then((data) => {
|
|
377
|
-
this.result = RESULT_STATUS.SUCCESS;
|
|
378
|
-
this.sessionData = data;
|
|
379
|
-
this.gatacaLoginCompleted.emit(data);
|
|
380
|
-
this.successCallback(data);
|
|
381
|
-
})
|
|
382
|
-
.catch((err) => {
|
|
383
|
-
this.clean();
|
|
384
|
-
let expired = err === RESULT_STATUS.EXPIRED;
|
|
385
|
-
if (expired && this.autorefresh) {
|
|
386
|
-
this.startMobilePolling();
|
|
387
|
-
}
|
|
388
|
-
else {
|
|
389
|
-
if (err !== RESULT_STATUS.NOT_STARTED) {
|
|
390
|
-
let error = expired
|
|
391
|
-
? new Error(this.userNotScanInTimeErrorLabel)
|
|
392
|
-
: new Error(this.credsNotValidatedErrorLabel);
|
|
393
|
-
this.result = err;
|
|
394
|
-
this.gatacaLoginFailed.emit(error);
|
|
395
|
-
this.errorCallback(error);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Stop manually an ongoing session
|
|
402
|
-
*/
|
|
403
|
-
async stop() {
|
|
404
|
-
this.clean();
|
|
405
|
-
if (this.result === RESULT_STATUS.ONGOING || RESULT_STATUS.READ) {
|
|
406
|
-
this.result = RESULT_STATUS.NOT_STARTED;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
clean() {
|
|
410
|
-
this.sessionData = undefined;
|
|
411
|
-
this.sessionId = undefined;
|
|
412
|
-
}
|
|
413
|
-
renderModal() {
|
|
414
|
-
return this.qr;
|
|
415
|
-
}
|
|
416
|
-
async poll() {
|
|
417
|
-
let endTime = new Date().getTime() +
|
|
418
|
-
(this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
|
|
419
|
-
let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
|
|
420
|
-
let checkFunc = async (component) => {
|
|
421
|
-
if (component.result === RESULT_STATUS.NOT_STARTED) {
|
|
422
|
-
return { result: RESULT_STATUS.NOT_STARTED };
|
|
423
|
-
}
|
|
424
|
-
let id = await component.getSessionId();
|
|
425
|
-
return component.checkStatus(id);
|
|
426
|
-
};
|
|
427
|
-
let component = this;
|
|
428
|
-
let checkCondition = async function (resolve, reject) {
|
|
429
|
-
// If the condition is met, we're done!
|
|
430
|
-
let { result, data } = await checkFunc(component);
|
|
431
|
-
switch (result) {
|
|
432
|
-
case RESULT_STATUS.SUCCESS:
|
|
433
|
-
resolve(data);
|
|
434
|
-
break;
|
|
435
|
-
case RESULT_STATUS.READ:
|
|
436
|
-
component.result = RESULT_STATUS.READ;
|
|
437
|
-
case RESULT_STATUS.ONGOING:
|
|
438
|
-
if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
|
|
439
|
-
setTimeout(checkCondition, interval, resolve, reject);
|
|
440
|
-
}
|
|
441
|
-
else {
|
|
442
|
-
reject(RESULT_STATUS.EXPIRED);
|
|
443
|
-
}
|
|
444
|
-
break;
|
|
445
|
-
default:
|
|
446
|
-
reject(result);
|
|
447
|
-
break;
|
|
448
|
-
}
|
|
449
|
-
};
|
|
450
|
-
return new Promise(checkCondition);
|
|
451
|
-
}
|
|
452
|
-
isAppInstalled(appScheme, callback) {
|
|
453
|
-
let timeout;
|
|
454
|
-
let detected = false;
|
|
455
|
-
if (appScheme === null || appScheme === void 0 ? void 0 : appScheme.length) {
|
|
456
|
-
window.location.href = appScheme;
|
|
457
|
-
}
|
|
458
|
-
const waitTimeToCheckApp = this.checkAppTimeout * 1000;
|
|
459
|
-
timeout = setTimeout(() => {
|
|
460
|
-
if (!detected) {
|
|
461
|
-
callback(false);
|
|
462
|
-
}
|
|
463
|
-
cleanup();
|
|
464
|
-
}, waitTimeToCheckApp);
|
|
465
|
-
const handleVisibilityChange = () => {
|
|
466
|
-
if (document.hidden) {
|
|
467
|
-
detected = true;
|
|
468
|
-
callback(true);
|
|
469
|
-
if (!this.autostart) {
|
|
470
|
-
this.startMobilePolling();
|
|
471
|
-
}
|
|
472
|
-
cleanup();
|
|
473
|
-
}
|
|
474
|
-
};
|
|
475
|
-
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
476
|
-
function cleanup() {
|
|
477
|
-
clearTimeout(timeout);
|
|
478
|
-
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
renderDesktopButton() {
|
|
482
|
-
console.log("this.qrId333", this.qrId);
|
|
483
|
-
return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
|
|
484
|
-
this.open = !this.open;
|
|
485
|
-
setTimeout(() => {
|
|
486
|
-
var _a, _b;
|
|
487
|
-
this.qrElement.id = this.qrId;
|
|
488
|
-
if (this.open) {
|
|
489
|
-
(_a = this.qrElement) === null || _a === void 0 ? void 0 : _a.display();
|
|
490
|
-
}
|
|
491
|
-
else {
|
|
492
|
-
(_b = this.qrElement) === null || _b === void 0 ? void 0 : _b.stop();
|
|
493
|
-
}
|
|
494
|
-
}, 0);
|
|
495
|
-
} }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
|
|
496
|
-
}
|
|
497
|
-
async getAuthRequest() {
|
|
498
|
-
let { authenticationRequest } = await this.createSession();
|
|
499
|
-
return authenticationRequest;
|
|
500
|
-
}
|
|
501
|
-
renderMobileButton(isAndroid, isIos) {
|
|
502
|
-
if (this.autostart) {
|
|
503
|
-
this.startMobilePolling();
|
|
504
|
-
}
|
|
505
|
-
let loading = false;
|
|
506
|
-
const handleLoading = (isLoading) => {
|
|
507
|
-
loading = isLoading;
|
|
508
|
-
if (this.handleCheckAppLoading) {
|
|
509
|
-
this.handleCheckAppLoading(isLoading);
|
|
510
|
-
}
|
|
511
|
-
};
|
|
512
|
-
const executeRedirection = async () => {
|
|
513
|
-
handleLoading(true);
|
|
514
|
-
const androidStoreLink = "https://play.google.com/store/apps/details?id=com.gataca.identity";
|
|
515
|
-
const iosStoreLink = "https://apps.apple.com/us/app/gataca/id1498607616";
|
|
516
|
-
try {
|
|
517
|
-
const appScheme = await this.getAuthRequest();
|
|
518
|
-
this.isAppInstalled(appScheme, (installed) => {
|
|
519
|
-
if (!installed) {
|
|
520
|
-
this.stop();
|
|
521
|
-
if (isAndroid) {
|
|
522
|
-
window.location.href = androidStoreLink;
|
|
523
|
-
}
|
|
524
|
-
else if (isIos) {
|
|
525
|
-
window.location.href = iosStoreLink;
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
handleLoading(false);
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
|
-
catch (error) {
|
|
532
|
-
this.stop();
|
|
533
|
-
handleLoading(false);
|
|
534
|
-
}
|
|
535
|
-
};
|
|
536
|
-
return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
|
|
537
|
-
executeRedirection();
|
|
538
|
-
}, disabled: loading }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
|
|
539
|
-
}
|
|
540
|
-
render() {
|
|
541
|
-
const userAgent =
|
|
542
|
-
// @ts-ignore
|
|
543
|
-
(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);
|
|
544
|
-
const isAndroid = /android/i.test(userAgent);
|
|
545
|
-
const isIos =
|
|
546
|
-
// @ts-ignore
|
|
547
|
-
(/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) ||
|
|
548
|
-
(navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
|
|
549
|
-
const isMobile = isAndroid || isIos;
|
|
550
|
-
return (h("div", { class: "buttonContainer" }, isMobile && this.v === "3"
|
|
551
|
-
? this.renderMobileButton(isAndroid, isIos)
|
|
552
|
-
: this.renderDesktopButton(), this.open && (!isMobile || this.v === "3") && this.renderModal()));
|
|
553
|
-
}
|
|
554
|
-
};
|
|
555
|
-
GatacaSSIButton.style = gatacaSsibuttonCss;
|
|
556
|
-
|
|
557
|
-
export { GatacaQR as gataca_qr, GatacaQRDisplay as gataca_qrdisplay, GatacaSSIButton as gataca_ssibutton };
|
|
312
|
+
export { GatacaQR as gataca_qr, GatacaQRDisplay as gataca_qrdisplay };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { h, r as registerInstance, c as createEvent } from './index-
|
|
2
|
-
import { g as gatIconCheckSvg, a as gatIconRefreshSvg, b as gatIconAlertSvg, l as logoGatacaSvg } from './gat-icon-alert-
|
|
1
|
+
import { h, r as registerInstance, c as createEvent } from './index-af2994f7.js';
|
|
2
|
+
import { g as gatIconCheckSvg, a as gatIconRefreshSvg, b as gatIconAlertSvg, l as logoGatacaSvg } from './gat-icon-alert-7b06ef3a.js';
|
|
3
|
+
import './qr-code-styling-0eeb38d5.js';
|
|
3
4
|
import { R as RESULT_STATUS, c as checkMobile, b as base64UrlEncode } from './utils-63e7a33b.js';
|
|
4
5
|
|
|
5
6
|
const Success = (props) => {
|