@gataca/qr 4.1.0 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/gataca-qr_3.cjs.entry.js +3 -3
- package/dist/cjs/gataca-qrws.cjs.entry.js +2 -2
- package/dist/cjs/index.cjs.js +5 -1
- package/dist/cjs/{utils-17b0a5ba.js → utils-04522aa4.js} +45 -0
- package/dist/collection/components/gataca-qr/gataca-qr.js +2 -2
- package/dist/collection/components/gataca-qrws/gataca-qrws.js +2 -2
- package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.js +2 -2
- package/dist/collection/utils/utils.js +41 -0
- package/dist/components/gat-icon-check.js +42 -1
- package/dist/components/gataca-qr2.js +2 -2
- package/dist/components/gataca-qrws2.js +2 -2
- package/dist/components/gataca-ssibutton2.js +2 -2
- package/dist/components/index.js +1 -1
- package/dist/esm/gataca-qr_3.entry.js +3 -3
- package/dist/esm/gataca-qrws.entry.js +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/{utils-e4a08623.js → utils-cf9db2bd.js} +42 -1
- package/dist/gatacaqr/gatacaqr.esm.js +1 -1
- package/dist/gatacaqr/index.esm.js +1 -1
- package/dist/gatacaqr/p-3db0f74d.entry.js +1 -0
- package/dist/gatacaqr/p-775c90cf.entry.js +1 -0
- package/dist/gatacaqr/{p-143c0080.js → p-7b6fa63b.js} +1 -1
- package/dist/types/utils/utils.d.ts +5 -0
- package/package.json +1 -1
- package/dist/gatacaqr/p-2dc7190a.entry.js +0 -1
- package/dist/gatacaqr/p-e172581d.entry.js +0 -1
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d8d3dfde.js');
|
|
6
6
|
const gatIconCheck = require('./gat-icon-check-6b6780eb.js');
|
|
7
|
-
const utils = require('./utils-
|
|
7
|
+
const utils = require('./utils-04522aa4.js');
|
|
8
8
|
|
|
9
9
|
const GatacaQRDisplay = class {
|
|
10
10
|
constructor(hostRef) {
|
|
@@ -263,7 +263,7 @@ const GatacaQR = class {
|
|
|
263
263
|
}
|
|
264
264
|
});
|
|
265
265
|
if (utils.checkMobile() && this.dynamicLink) {
|
|
266
|
-
|
|
266
|
+
utils.assignWindowLocationIfAllowed(this.getLink(), true);
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
buildRawLink() {
|
|
@@ -599,7 +599,7 @@ const GatacaSSIButton = class {
|
|
|
599
599
|
let timeout;
|
|
600
600
|
let detected = false;
|
|
601
601
|
if (appScheme === null || appScheme === void 0 ? void 0 : appScheme.length) {
|
|
602
|
-
|
|
602
|
+
utils.assignWindowLocationIfAllowed(appScheme, true);
|
|
603
603
|
}
|
|
604
604
|
const waitTimeToCheckApp = this.checkAppTimeout * 1000;
|
|
605
605
|
timeout = setTimeout(() => {
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d8d3dfde.js');
|
|
6
6
|
const gatIconCheck = require('./gat-icon-check-6b6780eb.js');
|
|
7
|
-
const utils = require('./utils-
|
|
7
|
+
const utils = require('./utils-04522aa4.js');
|
|
8
8
|
|
|
9
9
|
const Success = (props) => {
|
|
10
10
|
const { modalHeight, successLoginLabel } = props;
|
|
@@ -199,7 +199,7 @@ const GatacaQRWS = class {
|
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
201
|
if (utils.checkMobile() && this.dynamicLink) {
|
|
202
|
-
|
|
202
|
+
utils.assignWindowLocationIfAllowed(this.getLink(), true);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
sessionMsgReceived(event) {
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -2,16 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const utils = require('./utils-
|
|
5
|
+
const utils = require('./utils-04522aa4.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
exports.ALLOWED_APP_REDIRECT_PROTOCOLS = utils.ALLOWED_APP_REDIRECT_PROTOCOLS;
|
|
9
10
|
Object.defineProperty(exports, 'RESULT_STATUS', {
|
|
10
11
|
enumerable: true,
|
|
11
12
|
get: function () {
|
|
12
13
|
return utils.RESULT_STATUS;
|
|
13
14
|
}
|
|
14
15
|
});
|
|
16
|
+
exports.assignWindowLocationIfAllowed = utils.assignWindowLocationIfAllowed;
|
|
15
17
|
exports.base64UrlEncode = utils.base64UrlEncode;
|
|
16
18
|
exports.checkMobile = utils.checkMobile;
|
|
19
|
+
exports.isAllowedAppRedirect = utils.isAllowedAppRedirect;
|
|
20
|
+
exports.isAllowedNavigationRedirect = utils.isAllowedNavigationRedirect;
|
|
17
21
|
exports.shortenUrlIfPossible = utils.shortenUrlIfPossible;
|
|
@@ -23,6 +23,47 @@ exports.RESULT_STATUS = void 0;
|
|
|
23
23
|
RESULT_STATUS[RESULT_STATUS["READ"] = 5] = "READ";
|
|
24
24
|
})(exports.RESULT_STATUS || (exports.RESULT_STATUS = {}));
|
|
25
25
|
const GATACA_SHORTEN_API = 'https://links.gataca.io/api/v1/short';
|
|
26
|
+
/** URL schemes before assigning window.location. */
|
|
27
|
+
const ALLOWED_APP_REDIRECT_PROTOCOLS = [
|
|
28
|
+
'openid-gatc-vp',
|
|
29
|
+
'openid-vp',
|
|
30
|
+
'openid4vp',
|
|
31
|
+
'haip-vp',
|
|
32
|
+
'openid',
|
|
33
|
+
'openid-gatc-credential-offer',
|
|
34
|
+
'haip-vci',
|
|
35
|
+
'openid-credential-offer',
|
|
36
|
+
'digital-credentials'
|
|
37
|
+
];
|
|
38
|
+
const ALLOWED_APP_REDIRECT_PROTOCOL_SET = new Set(ALLOWED_APP_REDIRECT_PROTOCOLS);
|
|
39
|
+
function extractRedirectProtocol(url) {
|
|
40
|
+
var _a;
|
|
41
|
+
if (typeof url !== 'string') {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
const trimmed = url.trim();
|
|
45
|
+
if (!trimmed || /[\u0000-\u001F\u007F\\]/.test(trimmed)) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
const match = /^([a-z][a-z0-9+.-]*):/i.exec(trimmed);
|
|
49
|
+
return (_a = match === null || match === void 0 ? void 0 : match[1]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
50
|
+
}
|
|
51
|
+
function isAllowedAppRedirect(url) {
|
|
52
|
+
const protocol = extractRedirectProtocol(url);
|
|
53
|
+
return !!protocol && ALLOWED_APP_REDIRECT_PROTOCOL_SET.has(protocol);
|
|
54
|
+
}
|
|
55
|
+
function isAllowedNavigationRedirect(url) {
|
|
56
|
+
const protocol = extractRedirectProtocol(url);
|
|
57
|
+
return protocol === 'https' || isAllowedAppRedirect(url);
|
|
58
|
+
}
|
|
59
|
+
function assignWindowLocationIfAllowed(url, allowHttps = false) {
|
|
60
|
+
const allowed = allowHttps ? isAllowedNavigationRedirect(url) : isAllowedAppRedirect(url);
|
|
61
|
+
if (!allowed || typeof url !== 'string') {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
window.location.href = url.trim();
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
26
67
|
function extractShortUrlFromResponse(body) {
|
|
27
68
|
if (!body || typeof body !== 'object') {
|
|
28
69
|
return null;
|
|
@@ -67,6 +108,10 @@ async function shortenUrlIfPossible(link) {
|
|
|
67
108
|
}
|
|
68
109
|
//
|
|
69
110
|
|
|
111
|
+
exports.ALLOWED_APP_REDIRECT_PROTOCOLS = ALLOWED_APP_REDIRECT_PROTOCOLS;
|
|
112
|
+
exports.assignWindowLocationIfAllowed = assignWindowLocationIfAllowed;
|
|
70
113
|
exports.base64UrlEncode = base64UrlEncode;
|
|
71
114
|
exports.checkMobile = checkMobile;
|
|
115
|
+
exports.isAllowedAppRedirect = isAllowedAppRedirect;
|
|
116
|
+
exports.isAllowedNavigationRedirect = isAllowedNavigationRedirect;
|
|
72
117
|
exports.shortenUrlIfPossible = shortenUrlIfPossible;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
2
|
import logoGataca from '../../assets/images/logo_gataca.svg';
|
|
3
|
-
import { base64UrlEncode, checkMobile, RESULT_STATUS, shortenUrlIfPossible } from '../../utils/utils';
|
|
3
|
+
import { assignWindowLocationIfAllowed, base64UrlEncode, checkMobile, RESULT_STATUS, shortenUrlIfPossible } from '../../utils/utils';
|
|
4
4
|
import '../gataca-qrdisplay/gataca-qrdisplay';
|
|
5
5
|
import { QR } from './components/qr/QR';
|
|
6
6
|
import { ReadQR } from './components/readQR/ReadQR';
|
|
@@ -96,7 +96,7 @@ export class GatacaQR {
|
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
if (checkMobile() && this.dynamicLink) {
|
|
99
|
-
|
|
99
|
+
assignWindowLocationIfAllowed(this.getLink(), true);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
buildRawLink() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
2
|
import logoGataca from '../../assets/images/logo_gataca.svg';
|
|
3
3
|
import '../gataca-qrdisplay/gataca-qrdisplay';
|
|
4
|
-
import { base64UrlEncode, checkMobile, RESULT_STATUS, shortenUrlIfPossible } from '../../utils/utils';
|
|
4
|
+
import { assignWindowLocationIfAllowed, base64UrlEncode, checkMobile, RESULT_STATUS, shortenUrlIfPossible } from '../../utils/utils';
|
|
5
5
|
import { Success } from './components/success/Success';
|
|
6
6
|
import { RetryButton } from './components/retryButton/RetryButton';
|
|
7
7
|
import { QR } from './components/qr/QR';
|
|
@@ -117,7 +117,7 @@ export class GatacaQRWS {
|
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
119
|
if (checkMobile() && this.dynamicLink) {
|
|
120
|
-
|
|
120
|
+
assignWindowLocationIfAllowed(this.getLink(), true);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
sessionMsgReceived(event) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
2
|
import '../gataca-qrdisplay/gataca-qrdisplay';
|
|
3
|
-
import { RESULT_STATUS } from '../../utils/utils';
|
|
3
|
+
import { assignWindowLocationIfAllowed, RESULT_STATUS } from '../../utils/utils';
|
|
4
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
5
|
//Default values
|
|
6
6
|
const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
|
|
@@ -185,7 +185,7 @@ export class GatacaSSIButton {
|
|
|
185
185
|
let timeout;
|
|
186
186
|
let detected = false;
|
|
187
187
|
if (appScheme === null || appScheme === void 0 ? void 0 : appScheme.length) {
|
|
188
|
-
|
|
188
|
+
assignWindowLocationIfAllowed(appScheme, true);
|
|
189
189
|
}
|
|
190
190
|
const waitTimeToCheckApp = this.checkAppTimeout * 1000;
|
|
191
191
|
timeout = setTimeout(() => {
|
|
@@ -21,6 +21,47 @@ export var RESULT_STATUS;
|
|
|
21
21
|
RESULT_STATUS[RESULT_STATUS["READ"] = 5] = "READ";
|
|
22
22
|
})(RESULT_STATUS || (RESULT_STATUS = {}));
|
|
23
23
|
const GATACA_SHORTEN_API = 'https://links.gataca.io/api/v1/short';
|
|
24
|
+
/** URL schemes before assigning window.location. */
|
|
25
|
+
export const ALLOWED_APP_REDIRECT_PROTOCOLS = [
|
|
26
|
+
'openid-gatc-vp',
|
|
27
|
+
'openid-vp',
|
|
28
|
+
'openid4vp',
|
|
29
|
+
'haip-vp',
|
|
30
|
+
'openid',
|
|
31
|
+
'openid-gatc-credential-offer',
|
|
32
|
+
'haip-vci',
|
|
33
|
+
'openid-credential-offer',
|
|
34
|
+
'digital-credentials'
|
|
35
|
+
];
|
|
36
|
+
const ALLOWED_APP_REDIRECT_PROTOCOL_SET = new Set(ALLOWED_APP_REDIRECT_PROTOCOLS);
|
|
37
|
+
function extractRedirectProtocol(url) {
|
|
38
|
+
var _a;
|
|
39
|
+
if (typeof url !== 'string') {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
const trimmed = url.trim();
|
|
43
|
+
if (!trimmed || /[\u0000-\u001F\u007F\\]/.test(trimmed)) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
const match = /^([a-z][a-z0-9+.-]*):/i.exec(trimmed);
|
|
47
|
+
return (_a = match === null || match === void 0 ? void 0 : match[1]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
48
|
+
}
|
|
49
|
+
export function isAllowedAppRedirect(url) {
|
|
50
|
+
const protocol = extractRedirectProtocol(url);
|
|
51
|
+
return !!protocol && ALLOWED_APP_REDIRECT_PROTOCOL_SET.has(protocol);
|
|
52
|
+
}
|
|
53
|
+
export function isAllowedNavigationRedirect(url) {
|
|
54
|
+
const protocol = extractRedirectProtocol(url);
|
|
55
|
+
return protocol === 'https' || isAllowedAppRedirect(url);
|
|
56
|
+
}
|
|
57
|
+
export function assignWindowLocationIfAllowed(url, allowHttps = false) {
|
|
58
|
+
const allowed = allowHttps ? isAllowedNavigationRedirect(url) : isAllowedAppRedirect(url);
|
|
59
|
+
if (!allowed || typeof url !== 'string') {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
window.location.href = url.trim();
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
24
65
|
function extractShortUrlFromResponse(body) {
|
|
25
66
|
if (!body || typeof body !== 'object') {
|
|
26
67
|
return null;
|
|
@@ -21,6 +21,47 @@ var RESULT_STATUS;
|
|
|
21
21
|
RESULT_STATUS[RESULT_STATUS["READ"] = 5] = "READ";
|
|
22
22
|
})(RESULT_STATUS || (RESULT_STATUS = {}));
|
|
23
23
|
const GATACA_SHORTEN_API = 'https://links.gataca.io/api/v1/short';
|
|
24
|
+
/** URL schemes before assigning window.location. */
|
|
25
|
+
const ALLOWED_APP_REDIRECT_PROTOCOLS = [
|
|
26
|
+
'openid-gatc-vp',
|
|
27
|
+
'openid-vp',
|
|
28
|
+
'openid4vp',
|
|
29
|
+
'haip-vp',
|
|
30
|
+
'openid',
|
|
31
|
+
'openid-gatc-credential-offer',
|
|
32
|
+
'haip-vci',
|
|
33
|
+
'openid-credential-offer',
|
|
34
|
+
'digital-credentials'
|
|
35
|
+
];
|
|
36
|
+
const ALLOWED_APP_REDIRECT_PROTOCOL_SET = new Set(ALLOWED_APP_REDIRECT_PROTOCOLS);
|
|
37
|
+
function extractRedirectProtocol(url) {
|
|
38
|
+
var _a;
|
|
39
|
+
if (typeof url !== 'string') {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
const trimmed = url.trim();
|
|
43
|
+
if (!trimmed || /[\u0000-\u001F\u007F\\]/.test(trimmed)) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
const match = /^([a-z][a-z0-9+.-]*):/i.exec(trimmed);
|
|
47
|
+
return (_a = match === null || match === void 0 ? void 0 : match[1]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
48
|
+
}
|
|
49
|
+
function isAllowedAppRedirect(url) {
|
|
50
|
+
const protocol = extractRedirectProtocol(url);
|
|
51
|
+
return !!protocol && ALLOWED_APP_REDIRECT_PROTOCOL_SET.has(protocol);
|
|
52
|
+
}
|
|
53
|
+
function isAllowedNavigationRedirect(url) {
|
|
54
|
+
const protocol = extractRedirectProtocol(url);
|
|
55
|
+
return protocol === 'https' || isAllowedAppRedirect(url);
|
|
56
|
+
}
|
|
57
|
+
function assignWindowLocationIfAllowed(url, allowHttps = false) {
|
|
58
|
+
const allowed = allowHttps ? isAllowedNavigationRedirect(url) : isAllowedAppRedirect(url);
|
|
59
|
+
if (!allowed || typeof url !== 'string') {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
window.location.href = url.trim();
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
24
65
|
function extractShortUrlFromResponse(body) {
|
|
25
66
|
if (!body || typeof body !== 'object') {
|
|
26
67
|
return null;
|
|
@@ -69,4 +110,4 @@ const gatIconAlertSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdod
|
|
|
69
110
|
|
|
70
111
|
const gatIconCheckSvg = 'data:image/svg+xml;base64,Cjxzdmcgd2lkdGg9IjUyIiBoZWlnaHQ9IjUzIiB2aWV3Qm94PSIwIDAgNTIgNTMiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxjaXJjbGUgY3g9IjI2IiBjeT0iMjYuNjcxOSIgcj0iMjYiIGZpbGw9IiMzRDlBNTAiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0zOC41MiAxNy43NDk1QzM5LjU4MDUgMTguODA5OSAzOS41ODA1IDIwLjUyOTMgMzguNTIgMjEuNTg5OEwyMy41ODQ2IDM2LjUyNTFDMjIuNTI0MiAzNy41ODU2IDIwLjgwNDggMzcuNTg1NiAxOS43NDQzIDM2LjUyNTFMMTIuOTU1NSAyOS43MzYzQzExLjg5NSAyOC42NzU5IDExLjg5NSAyNi45NTY1IDEyLjk1NTUgMjUuODk2QzE0LjAxNiAyNC44MzU1IDE1LjczNTQgMjQuODM1NSAxNi43OTU4IDI1Ljg5NkwyMS42NjQ1IDMwLjc2NDdMMzQuNjc5NyAxNy43NDk1QzM1Ljc0MDIgMTYuNjg5IDM3LjQ1OTUgMTYuNjg5IDM4LjUyIDE3Ljc0OTVaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K';
|
|
71
112
|
|
|
72
|
-
export { RESULT_STATUS as R,
|
|
113
|
+
export { ALLOWED_APP_REDIRECT_PROTOCOLS as A, RESULT_STATUS as R, isAllowedNavigationRedirect as a, base64UrlEncode as b, checkMobile as c, assignWindowLocationIfAllowed as d, gatIconCheckSvg as e, gatIconAlertSvg as g, isAllowedAppRedirect as i, shortenUrlIfPossible as s };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h, proxyCustomElement, HTMLElement, createEvent } from '@stencil/core/internal/client';
|
|
2
2
|
import { l as logoGatacaSvg, d as defineCustomElement$1 } from './gataca-qrdisplay2.js';
|
|
3
|
-
import { g as gatIconAlertSvg,
|
|
3
|
+
import { g as gatIconAlertSvg, e as gatIconCheckSvg, R as RESULT_STATUS, c as checkMobile, d as assignWindowLocationIfAllowed, b as base64UrlEncode, s as shortenUrlIfPossible } from './gat-icon-check.js';
|
|
4
4
|
|
|
5
5
|
const QR = (props) => {
|
|
6
6
|
const { value, useLogo, logoSrc, size, qrType, style, linkReady = true } = props;
|
|
@@ -193,7 +193,7 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
193
193
|
}
|
|
194
194
|
});
|
|
195
195
|
if (checkMobile() && this.dynamicLink) {
|
|
196
|
-
|
|
196
|
+
assignWindowLocationIfAllowed(this.getLink(), true);
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
buildRawLink() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h, proxyCustomElement, HTMLElement, createEvent } from '@stencil/core/internal/client';
|
|
2
2
|
import { l as logoGatacaSvg, d as defineCustomElement$1 } from './gataca-qrdisplay2.js';
|
|
3
|
-
import {
|
|
3
|
+
import { e as gatIconCheckSvg, g as gatIconAlertSvg, R as RESULT_STATUS, c as checkMobile, d as assignWindowLocationIfAllowed, b as base64UrlEncode, s as shortenUrlIfPossible } from './gat-icon-check.js';
|
|
4
4
|
|
|
5
5
|
const Success = (props) => {
|
|
6
6
|
const { modalHeight, successLoginLabel } = props;
|
|
@@ -197,7 +197,7 @@ const GatacaQRWS = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
197
197
|
}
|
|
198
198
|
};
|
|
199
199
|
if (checkMobile() && this.dynamicLink) {
|
|
200
|
-
|
|
200
|
+
assignWindowLocationIfAllowed(this.getLink(), true);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
sessionMsgReceived(event) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { d as defineCustomElement$1 } from './gataca-qrdisplay2.js';
|
|
3
|
-
import { R as RESULT_STATUS } from './gat-icon-check.js';
|
|
3
|
+
import { R as RESULT_STATUS, d as assignWindowLocationIfAllowed } from './gat-icon-check.js';
|
|
4
4
|
import { d as defineCustomElement$2 } from './gataca-qr2.js';
|
|
5
5
|
|
|
6
6
|
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}";
|
|
@@ -195,7 +195,7 @@ const GatacaSSIButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
195
195
|
let timeout;
|
|
196
196
|
let detected = false;
|
|
197
197
|
if (appScheme === null || appScheme === void 0 ? void 0 : appScheme.length) {
|
|
198
|
-
|
|
198
|
+
assignWindowLocationIfAllowed(appScheme, true);
|
|
199
199
|
}
|
|
200
200
|
const waitTimeToCheckApp = this.checkAppTimeout * 1000;
|
|
201
201
|
timeout = setTimeout(() => {
|
package/dist/components/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
2
|
-
export { R as RESULT_STATUS, b as base64UrlEncode, c as checkMobile, s as shortenUrlIfPossible } from './gat-icon-check.js';
|
|
2
|
+
export { A as ALLOWED_APP_REDIRECT_PROTOCOLS, R as RESULT_STATUS, d as assignWindowLocationIfAllowed, b as base64UrlEncode, c as checkMobile, i as isAllowedAppRedirect, a as isAllowedNavigationRedirect, s as shortenUrlIfPossible } from './gat-icon-check.js';
|
|
3
3
|
export { GatacaAutoqr, defineCustomElement as defineCustomElementGatacaAutoqr } from './gataca-autoqr.js';
|
|
4
4
|
export { GatacaQr, defineCustomElement as defineCustomElementGatacaQr } from './gataca-qr.js';
|
|
5
5
|
export { GatacaQrdisplay, defineCustomElement as defineCustomElementGatacaQrdisplay } from './gataca-qrdisplay.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, h, c as createEvent } from './index-dca2ab22.js';
|
|
2
2
|
import { l as logoGatacaSvg, Q as QRCodeStyling, g as gatIconAlertSvg, a as gatIconCheckSvg } from './gat-icon-check-7320c81b.js';
|
|
3
|
-
import { R as RESULT_STATUS, c as checkMobile, b as base64UrlEncode, s as shortenUrlIfPossible } from './utils-
|
|
3
|
+
import { R as RESULT_STATUS, c as checkMobile, d as assignWindowLocationIfAllowed, b as base64UrlEncode, s as shortenUrlIfPossible } from './utils-cf9db2bd.js';
|
|
4
4
|
|
|
5
5
|
const GatacaQRDisplay = class {
|
|
6
6
|
constructor(hostRef) {
|
|
@@ -259,7 +259,7 @@ const GatacaQR = class {
|
|
|
259
259
|
}
|
|
260
260
|
});
|
|
261
261
|
if (checkMobile() && this.dynamicLink) {
|
|
262
|
-
|
|
262
|
+
assignWindowLocationIfAllowed(this.getLink(), true);
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
buildRawLink() {
|
|
@@ -595,7 +595,7 @@ const GatacaSSIButton = class {
|
|
|
595
595
|
let timeout;
|
|
596
596
|
let detected = false;
|
|
597
597
|
if (appScheme === null || appScheme === void 0 ? void 0 : appScheme.length) {
|
|
598
|
-
|
|
598
|
+
assignWindowLocationIfAllowed(appScheme, true);
|
|
599
599
|
}
|
|
600
600
|
const waitTimeToCheckApp = this.checkAppTimeout * 1000;
|
|
601
601
|
timeout = setTimeout(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h, r as registerInstance, c as createEvent } from './index-dca2ab22.js';
|
|
2
2
|
import { a as gatIconCheckSvg, g as gatIconAlertSvg, l as logoGatacaSvg } from './gat-icon-check-7320c81b.js';
|
|
3
|
-
import { R as RESULT_STATUS, c as checkMobile, b as base64UrlEncode, s as shortenUrlIfPossible } from './utils-
|
|
3
|
+
import { R as RESULT_STATUS, c as checkMobile, d as assignWindowLocationIfAllowed, b as base64UrlEncode, s as shortenUrlIfPossible } from './utils-cf9db2bd.js';
|
|
4
4
|
|
|
5
5
|
const Success = (props) => {
|
|
6
6
|
const { modalHeight, successLoginLabel } = props;
|
|
@@ -195,7 +195,7 @@ const GatacaQRWS = class {
|
|
|
195
195
|
}
|
|
196
196
|
};
|
|
197
197
|
if (checkMobile() && this.dynamicLink) {
|
|
198
|
-
|
|
198
|
+
assignWindowLocationIfAllowed(this.getLink(), true);
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
sessionMsgReceived(event) {
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { R as RESULT_STATUS, b as base64UrlEncode, c as checkMobile, s as shortenUrlIfPossible } from './utils-
|
|
1
|
+
export { A as ALLOWED_APP_REDIRECT_PROTOCOLS, R as RESULT_STATUS, d as assignWindowLocationIfAllowed, b as base64UrlEncode, c as checkMobile, i as isAllowedAppRedirect, a as isAllowedNavigationRedirect, s as shortenUrlIfPossible } from './utils-cf9db2bd.js';
|
|
@@ -21,6 +21,47 @@ var RESULT_STATUS;
|
|
|
21
21
|
RESULT_STATUS[RESULT_STATUS["READ"] = 5] = "READ";
|
|
22
22
|
})(RESULT_STATUS || (RESULT_STATUS = {}));
|
|
23
23
|
const GATACA_SHORTEN_API = 'https://links.gataca.io/api/v1/short';
|
|
24
|
+
/** URL schemes before assigning window.location. */
|
|
25
|
+
const ALLOWED_APP_REDIRECT_PROTOCOLS = [
|
|
26
|
+
'openid-gatc-vp',
|
|
27
|
+
'openid-vp',
|
|
28
|
+
'openid4vp',
|
|
29
|
+
'haip-vp',
|
|
30
|
+
'openid',
|
|
31
|
+
'openid-gatc-credential-offer',
|
|
32
|
+
'haip-vci',
|
|
33
|
+
'openid-credential-offer',
|
|
34
|
+
'digital-credentials'
|
|
35
|
+
];
|
|
36
|
+
const ALLOWED_APP_REDIRECT_PROTOCOL_SET = new Set(ALLOWED_APP_REDIRECT_PROTOCOLS);
|
|
37
|
+
function extractRedirectProtocol(url) {
|
|
38
|
+
var _a;
|
|
39
|
+
if (typeof url !== 'string') {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
const trimmed = url.trim();
|
|
43
|
+
if (!trimmed || /[\u0000-\u001F\u007F\\]/.test(trimmed)) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
const match = /^([a-z][a-z0-9+.-]*):/i.exec(trimmed);
|
|
47
|
+
return (_a = match === null || match === void 0 ? void 0 : match[1]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
48
|
+
}
|
|
49
|
+
function isAllowedAppRedirect(url) {
|
|
50
|
+
const protocol = extractRedirectProtocol(url);
|
|
51
|
+
return !!protocol && ALLOWED_APP_REDIRECT_PROTOCOL_SET.has(protocol);
|
|
52
|
+
}
|
|
53
|
+
function isAllowedNavigationRedirect(url) {
|
|
54
|
+
const protocol = extractRedirectProtocol(url);
|
|
55
|
+
return protocol === 'https' || isAllowedAppRedirect(url);
|
|
56
|
+
}
|
|
57
|
+
function assignWindowLocationIfAllowed(url, allowHttps = false) {
|
|
58
|
+
const allowed = allowHttps ? isAllowedNavigationRedirect(url) : isAllowedAppRedirect(url);
|
|
59
|
+
if (!allowed || typeof url !== 'string') {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
window.location.href = url.trim();
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
24
65
|
function extractShortUrlFromResponse(body) {
|
|
25
66
|
if (!body || typeof body !== 'object') {
|
|
26
67
|
return null;
|
|
@@ -65,4 +106,4 @@ async function shortenUrlIfPossible(link) {
|
|
|
65
106
|
}
|
|
66
107
|
//
|
|
67
108
|
|
|
68
|
-
export { RESULT_STATUS as R, base64UrlEncode as b, checkMobile as c, shortenUrlIfPossible as s };
|
|
109
|
+
export { ALLOWED_APP_REDIRECT_PROTOCOLS as A, RESULT_STATUS as R, isAllowedNavigationRedirect as a, base64UrlEncode as b, checkMobile as c, assignWindowLocationIfAllowed as d, isAllowedAppRedirect as i, shortenUrlIfPossible as s };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as a}from"./p-85af64b1.js";(()=>{const a=import.meta.url,r={};return""!==a&&(r.resourcesUrl=new URL(".",a).href),e(r)})().then((e=>a([["p-
|
|
1
|
+
import{p as e,b as a}from"./p-85af64b1.js";(()=>{const a=import.meta.url,r={};return""!==a&&(r.resourcesUrl=new URL(".",a).href),e(r)})().then((e=>a([["p-3db0f74d",[[1,"gataca-ssibutton",{buttonText:[1,"button-text"],buttonDCAPIText:[1,"button-d-c-a-p-i-text"],qrType:[1,"qr-type"],autostart:[4],checkStatus:[16],createSession:[16],fillSession:[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"],enableDcApi:[4,"enable-dc-api"],hideQrModalDescription:[4,"hide-qr-modal-description"],qrStyle:[16],open:[32],sessionId:[32],authenticationRequest:[32],sessionData:[32],result:[32],getSessionData:[64],startMobilePolling:[64],stop:[64]}],[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"],qrStyle:[16],sessionId:[32],authenticationRequest:[32],sessionData:[32],result:[32],qrHref:[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"],bgColor:[1,"bg-color"],rounded:[4]}]]],["p-775c90cf",[[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],qrHref:[32],qrShortenPending:[32],display:[64],stop:[64],getSessionData:[64]},[[2,"sessionMsg","sessionMsgReceived"]]]]],["p-2e8accf9",[[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]}]]],["p-d27dabe4",[[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]}]]]],e)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{R as RESULT_STATUS,b as base64UrlEncode,c as checkMobile,s as shortenUrlIfPossible}from"./p-
|
|
1
|
+
export{A as ALLOWED_APP_REDIRECT_PROTOCOLS,R as RESULT_STATUS,d as assignWindowLocationIfAllowed,b as base64UrlEncode,c as checkMobile,i as isAllowedAppRedirect,a as isAllowedNavigationRedirect,s as shortenUrlIfPossible}from"./p-7b6fa63b.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as i,c as e}from"./p-85af64b1.js";import{l as s,Q as a,g as n,a as o}from"./p-29119208.js";import{R as r,c as l,d,b as h,s as c}from"./p-7b6fa63b.js";const p=class{constructor(i){t(this,i),this.qrData=void 0,this.qrType="svg",this.size=256,this.logoSize=0,this.logoSrc=void 0,this.qrColor="#1E1E20",this.bgColor="#FFFFFF",this.rounded=!0}getQrOptions(){return{data:this.qrData,width:this.size,height:this.size,image:this.logoSize>0?this.logoSrc||s:void 0,margin:10,type:this.qrType,dotsOptions:{color:this.qrColor,type:this.rounded?"dots":"square"},cornersSquareOptions:{type:this.rounded?"extra-rounded":"square"},cornersDotOptions:{type:this.rounded?"dot":"square"},imageOptions:{margin:2,imageSize:this.logoSize},backgroundOptions:{color:this.bgColor}}}componentDidLoad(){this.mountOrUpdateQr()}onQrDataChange(){this.mountOrUpdateQr()}mountOrUpdateQr(){var t;(null===(t=this.qrData)||void 0===t?void 0:t.trim())&&this.qr&&(this.qrCode?this.qrCode.update({data:this.qrData}):(this.qrCode=new a(this.getQrOptions()),this.qrCode.append(this.qr)))}render(){return i("div",{ref:t=>{this.qr=t}})}static get watchers(){return{qrData:["onQrDataChange"]}}},u=t=>{const{value:e,useLogo:s,logoSrc:a,size:n,qrType:o,style:r,linkReady:l=!0}=t,d=null!=n?n:256;return l?i("gataca-qrdisplay",{qrData:e,rounded:!0,qrType:o,size:n,"logo-size":s?.33:0,"logo-src":a,qrColor:null==r?void 0:r.color,bgColor:null==r?void 0:r.bgColor}):i("div",{class:"qr-loading-slot",style:{width:d+"px",height:d+"px",margin:"0 auto"}})},g=t=>{const{color:e="#4745B7"}=t;return i("div",{class:"containerLoader",style:{"--loader-color":e}},i("div",{class:"loader"},i("div",{class:"loader__item loader__item__1"}),i("div",{class:"loader__item loader__item__2"}),i("div",{class:"loader__item loader__item__3"}),i("div",{class:"loader__item loader__item__4"}),i("div",{class:"loader__item loader__item__5"}),i("div",{class:"loader__item loader__item__6"}),i("div",{class:"loader__item loader__item__7"}),i("div",{class:"loader__item loader__item__8"})))},m=t=>{var e;const{modalWidth:s,readQrMessages:a,renderQR:n,url:o,sizeQR:r,style:l}=t,d={backgroundColor:(null==l?void 0:l.bgColor)?null==l?void 0:l.bgColor:"white"},h={color:(null==l?void 0:l.color)?null==l?void 0:l.color:"#707074"};return i("div",{class:"blured",style:{width:(s-48).toString()+"px",height:s?(null===(e=s-48)||void 0===e?void 0:e.toString())+"px":"",backgroundColor:null==l?void 0:l.bgColor,color:null==l?void 0:l.color,border:(null==l?void 0:l.color)?`1px dashed ${null==l?void 0:l.color}`:"1px dashed #a1a1a1"}},i("div",{id:"notify",style:d},i(g,{color:null==l?void 0:l.color}),i("p",{class:"notify-text",style:h},null==a?void 0:a.title," "),i("p",{class:"notify-text bold",style:h},null==a?void 0:a.description)),i("div",{id:"qrwait"},n(o,!1,r)))},b=t=>{const{height:e=24,width:s=24,color:a}=t,n=a||"#8B8B8B";return i("svg",{width:s,height:e,viewBox:`0 0 ${s} ${e}`,fill:"none",xmlns:"http://www.w3.org/2000/svg"},i("path",{d:"M23 4V10H17",stroke:n,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),i("path",{d:"M20.4899 15C19.8399 16.8399 18.6094 18.4187 16.984 19.4985C15.3586 20.5783 13.4263 21.1006 11.4783 20.9866C9.53026 20.8726 7.67203 20.1286 6.18363 18.8667C4.69524 17.6047 3.6573 15.8932 3.22625 13.9901C2.79519 12.0869 2.99436 10.0952 3.79374 8.31508C4.59313 6.53496 5.94942 5.06288 7.65823 4.12065C9.36705 3.17843 11.3358 2.81711 13.2678 3.09116C15.1999 3.3652 16.9905 4.25975 18.3699 5.64001L22.9999 10",stroke:n,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}))},v=t=>{var e;const{errorMessage:s,modalWidth:a,clickInsideBoxLabel:o,refreshQrLabel:r,scanQrLabel:l,style:d,display:h}=t,c={backgroundColor:(null==d?void 0:d.bgColor)?null==d?void 0:d.bgColor:"white"},p={backgroundColor:(null==d?void 0:d.alertBgColor)?null==d?void 0:d.alertBgColor:"#ffdedf"},u={borderColor:(null==d?void 0:d.alertBorderColor)?null==d?void 0:d.alertBorderColor:"#ee888c"},g={color:(null==d?void 0:d.color)?null==d?void 0:d.color:"#707074"};return i("div",{class:"reload",style:{width:(a-48).toString()+"px",height:a?(null===(e=a-48)||void 0===e?void 0:e.toString())+"px":"",border:(null==d?void 0:d.color)?`1px dashed ${null==d?void 0:d.color}`:"1px dashed #a1a1a1"}},i("div",{id:"notify",onClick:()=>h(),style:c},i(b,{color:null==d?void 0:d.color,height:24,width:24}),i("p",{class:"notify-text",style:g},o," "),i("p",{class:"notify-text bold",style:g},s?r:l),s&&i("div",{class:"alert",style:Object.assign(Object.assign({width:(a-48).toString()+"px"},p),{border:`1px solid ${u}`})},i("img",{src:n,height:24,width:24}),i("p",{style:{color:(null==d?void 0:d.color)?null==d?void 0:d.color:"#1e1e20"}},s))),i("div",{id:"qrwait",class:"qr-placeholder-slot",style:{width:(a-48).toString()+"px",height:a?(a-48).toString()+"px":""}}))},x=t=>{const{modalHeight:e,successLoginLabel:s,style:a}=t,n={color:(null==a?void 0:a.color)?null==a?void 0:a.color:"#1e1e20"};return i("div",{class:"success",style:{height:e?(null==e?void 0:e.toString())+"px":"300px"}},i("img",{src:o,height:52,width:52}),i("p",{class:"successMsg",style:n},s))},f=class{constructor(i){t(this,i),this.gatacaLoginCompleted=e(this,"gatacaLoginCompleted",7),this.gatacaLoginFailed=e(this,"gatacaLoginFailed",7),this.lastShortenRaw=null,this.checkStatus=void 0,this.createSession=void 0,this.successCallback=void 0,this.errorCallback=void 0,this.qrRole=void 0,this.qrType="svg",this.callbackServer=void 0,this.autostart=!0,this.autorefresh=!1,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=!1,this.hideModalBoxShadow=!1,this.hideBrandTitle=!1,this.logoSize=0,this.logoSrc=s,this.qrSize=300,this.modalWidth=300,this.modalHeight=void 0,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=!1,this.sessionTimeout=300,this.pollingFrequency=3,this.dynamicLink=!0,this.qrStyle=void 0,this.sessionId=void 0,this.authenticationRequest=void 0,this.sessionData=void 0,this.result=r.NOT_STARTED,this.qrHref=""}disconnectedCallback(){this.stop()}async componentDidLoad(){this.autostart&&await this.display()}async display(){await this.getSessionId(),await this.refreshQrHref(),this.result=r.ONGOING,this.poll().then((t=>{this.result=r.SUCCESS,this.sessionData=t,this.gatacaLoginCompleted.emit(t),this.successCallback(t)})).catch((t=>{this.clean();let i=t===r.EXPIRED;if(i&&this.autorefresh)this.display();else if(t!==r.NOT_STARTED){let e=i?new Error(this.userNotScanInTimeErrorLabel):new Error(this.credsNotValidatedErrorLabel);this.result=t,this.gatacaLoginFailed.emit(e),this.errorCallback(e)}})),l()&&this.dynamicLink&&d(this.getLink(),!0)}buildRawLink(){var t;return"2"===this.v?null!==(t=this.authenticationRequest)&&void 0!==t?t:"":"https://api.gataca.io/qr/redirect.html?dl="+h(this.authenticationRequest)}async refreshQrHref(){var t;const i=this.buildRawLink();if(i===this.lastShortenRaw)return;this.lastShortenRaw=i;const e=await c(null!=i?i:""),s=this.buildRawLink();s===i?this.qrHref=e:(null===(t=this.qrHref)||void 0===t?void 0:t.trim())||(this.qrHref=s)}async stop(){this.clean(),(this.result===r.ONGOING||r.READ)&&(this.result=r.NOT_STARTED)}clean(){this.sessionData=void 0,this.sessionId=void 0,this.qrHref="",this.lastShortenRaw=null}async getSessionData(){return this.sessionData?Promise.resolve(this.sessionData):Promise.reject(new Error(this.failedLoginErrorLabel))}async getSessionId(){if(this.sessionId)return this.sessionId;let{sessionId:t,authenticationRequest:i}=await this.createSession();return this.sessionId=t,this.authenticationRequest=i,this.sessionId}getLink(){return this.qrHref||this.buildRawLink()}async poll(){let t=(new Date).getTime()+1e3*(this.sessionTimeout||300),i=1e3*(this.pollingFrequency||3),e=this,s=async function(a,n){let{result:o,data:l}=await(async t=>{if(t.result===r.NOT_STARTED)return{result:r.NOT_STARTED};let i=await t.getSessionId();return t.checkStatus(i)})(e);switch(o){case r.SUCCESS:a(l);break;case r.READ:e.result=r.READ;case r.ONGOING:e.sessionTimeout>0&&(new Date).getTime()<t?setTimeout(s,i,a,n):n(r.EXPIRED);break;default:n(o)}};return new Promise(s)}renderQRSection(){var t;switch(this.result){case r.NOT_STARTED:return this.renderRetryButton();case r.ONGOING:return this.renderQR(this.getLink(),!0,void 0,!!(null===(t=this.qrHref)||void 0===t?void 0:t.trim()));case r.EXPIRED:return this.renderRetryButton(this.qrCodeExpiredLabel);case r.FAILED:return this.renderRetryButton(this.credentialsNotValidatedLabel);case r.SUCCESS:return this.renderSuccess();case r.READ:return this.renderReadQR({title:null==this?void 0:this.readQrTitle,description:null==this?void 0:this.readQrDescription})}}renderSuccess(){return i(x,{modalHeight:null==this?void 0:this.modalHeight,successLoginLabel:null==this?void 0:this.successLoginLabel,style:null==this?void 0:this.qrStyle})}renderRetryButton(t){return i(v,{errorMessage:t,modalWidth:null==this?void 0:this.modalWidth,clickInsideBoxLabel:null==this?void 0:this.clickInsideBoxLabel,refreshQrLabel:null==this?void 0:this.refreshQrLabel,scanQrLabel:null==this?void 0:this.scanQrLabel,display:this.display.bind(this),style:null==this?void 0:this.qrStyle})}renderReadQR(t){var e;const s=!!(null===(e=this.qrHref)||void 0===e?void 0:e.trim());return i(m,{modalWidth:null==this?void 0:this.modalWidth,readQrMessages:t,url:this.getLink(),sizeQR:(null==this?void 0:this.qrSize)?(null==this?void 0:this.qrSize)-50:void 0,renderQR:(t,i,e)=>this.renderQR(t,i,e,s),style:this.qrStyle})}renderQR(t,e,s,a=!0){return i(u,{value:t,qrType:this.qrType,useLogo:e&&0!==this.logoSize,size:s||(null==this?void 0:this.qrSize)||void 0,logoSrc:null==this?void 0:this.logoSrc,style:null==this?void 0:this.qrStyle,linkReady:a})}render(){var t,e,a,n,o,l;return i("div",{class:"popUpContainer"},i("div",{class:`is-visible modal-window ${this.hideModalTexts?"":"large-modal"} ${this.hideModalBoxShadow?"noBoxShadow":""}`,style:{width:(this.modalWidth-2).toString()+"px",height:this.modalHeight?(null===(t=this.modalHeight-2)||void 0===t?void 0:t.toString())+"px":"",backgroundColor:(null===(e=null==this?void 0:this.qrStyle)||void 0===e?void 0:e.bgColor)?null===(a=null==this?void 0:this.qrStyle)||void 0===a?void 0:a.bgColor:"white",boxShadow:(null===(n=null==this?void 0:this.qrStyle)||void 0===n?void 0:n.boxShadow)?null===(o=null==this?void 0:this.qrStyle)||void 0===o?void 0:o.boxShadow:"0px 3px 10px rgba(48, 48, 48, 0.1);"},onClick:t=>{t.stopPropagation()}},i("div",{class:"modal-window__content"},i("div",{class:"qrTitleContainer "+(this.hideModalTexts?"hidenText":"")},i("p",{class:"qrTitle modalText",style:{color:this.modalTitleColor||"#1e1e20"}},this.qrModalTitle),!this.hideBrandTitle&&i("p",{class:"qrBrand modalText"},this.byBrandLabel," ",i("span",null,i("img",{src:s}))),this.result!==r.SUCCESS&&!this.hideQrModalDescription&&i("p",{class:"qrDescription modalText"},this.qrModalDescription)),i("div",{class:"qrSection",style:{width:this.modalWidth.toString()+"px",height:this.modalWidth?(null===(l=this.modalWidth)||void 0===l?void 0:l.toString())+"px":""}},this.renderQRSection()))))}};f.style='@import url("https://fonts.googleapis.com/css2?family=Ubuntu:wght@100;300;400;500;600;700&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@100;300;400;500;600;700&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:"";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.brandSection{padding-top:5px;display:flex;align-items:center}.brandSection .gatacaImgSmall{height:13px;width:13px;margin:0;margin-right:10px}.popUpContainer .large-modal{width:300px;min-height:350px}.popUpContainer .modal-window{position:relative;border-radius:6px;overflow:hidden;color:rgba(24, 27, 94, 0.8);box-shadow:0px 3px 10px rgba(48, 48, 48, 0.1);display:flex;flex-direction:column;justify-content:space-between;align-items:center;display:flex;z-index:1001;padding:1px;background-color:white;border-radius:12px;-webkit-transition:opacity 0.5s, visibility 0s 0.5s;transition:opacity 0.5s, visibility 0s 0.5s;visibility:hidden;opacity:0}.popUpContainer .modal-window__content{width:100%;height:100%;text-align:left}.popUpContainer .modal-window__content .hidenText{display:none}.popUpContainer .modal-window .modalText{font-family:"Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px;margin-top:10px;letter-spacing:1px}.popUpContainer .modal-window .qrTitleContainer{padding:14px 24px;padding-bottom:0px}.popUpContainer .modal-window .qrTitle{font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .modal-window .qrDescription{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074}.popUpContainer .modal-window .bold{font-weight:700}.popUpContainer .modal-window .qrBrand{margin-top:4px;font-size:14px;font-weight:400;line-height:16.5px;display:flex;align-items:center}.popUpContainer .modal-window .qrBrand img{margin-left:5px;height:12px}.popUpContainer .modal-window .qr-section{width:252px;height:252px}.popUpContainer .noBoxShadow{box-shadow:none}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}.success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.success>img{padding-bottom:12px}.success>.successMsg{line-height:23.5px;color:var(--neutral-1000, #1e1e20);text-align:center;font-family:"Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px}.reload,.blured{height:252px;width:252px;border:1px dashed #a1a1a1;border-radius:20px;position:relative;top:24px;margin:0 24px 24px;display:flex;overflow:hidden;justify-content:center;align-items:center}#qrwait{display:flex;justify-content:center}.qr-placeholder-slot{box-sizing:border-box;border-radius:12px;background:rgba(0, 0, 0, 0.04)}#qrwait,#notify{width:100%;height:100%;top:0;left:0;border-radius:20px}#notify{z-index:10;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;display:flex;flex-direction:column;box-sizing:border-box;padding:20px;background:rgba(255, 255, 255, 0.95)}#notify>svg{padding-bottom:12px}.alert{display:flex;flex-direction:row;justify-content:start;width:252px;position:absolute;bottom:0px;border:1px solid #ee888c;background:#ffdedf;border-radius:11px;box-sizing:border-box;padding:12px;align-items:center;gap:12px}.alert>img{margin:0}.alert>p{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;margin-top:0;line-height:16px;color:#1e1e20}.notify-text{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074;text-align:center}.containerLoader{display:flex;justify-content:center;align-items:center;width:30px;height:30px;margin-bottom:12px}.loader{position:relative;margin-left:0 !important}.loader__item{position:absolute;width:9.68px;height:4px;background-color:var(--loader-color, #4745B7);border-radius:2px;--to-opacity:1;opacity:var(--to-opacity)}.loader__item__1{transform:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-webkit-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-moz-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-o-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);--to-opacity:calc(1 - (0 / 8));animation:blink 0.8333333333s linear 0.1041666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.1041666667s infinite;-moz-animation:blink 0.8333333333s linear 0.1041666667s infinite;-o-animation:blink 0.8333333333s linear 0.1041666667s infinite}.loader__item__2{transform:translate(-4.84px, 8.5px) rotate(90deg);-webkit-animation:translate(-4.84px, 8.5px) rotate(90deg);-moz-animation:translate(-4.84px, 8.5px) rotate(90deg);-o-animation:translate(-4.84px, 8.5px) rotate(90deg);--to-opacity:calc(1 - (1 / 8));animation:blink 0.8333333333s linear 0.2083333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.2083333333s infinite;-moz-animation:blink 0.8333333333s linear 0.2083333333s infinite;-o-animation:blink 0.8333333333s linear 0.2083333333s infinite}.loader__item__3{transform:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-webkit-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-moz-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-o-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);--to-opacity:calc(1 - (2 / 8));animation:blink 0.8333333333s linear 0.3125s infinite;-webkit-animation:blink 0.8333333333s linear 0.3125s infinite;-moz-animation:blink 0.8333333333s linear 0.3125s infinite;-o-animation:blink 0.8333333333s linear 0.3125s infinite}.loader__item__4{transform:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-webkit-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-moz-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-o-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);--to-opacity:calc(1 - (3 / 8));animation:blink 0.8333333333s linear 0.4166666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.4166666667s infinite;-moz-animation:blink 0.8333333333s linear 0.4166666667s infinite;-o-animation:blink 0.8333333333s linear 0.4166666667s infinite}.loader__item__5{transform:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-webkit-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-moz-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-o-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);--to-opacity:calc(1 - (4 / 8));animation:blink 0.8333333333s linear 0.5208333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.5208333333s infinite;-moz-animation:blink 0.8333333333s linear 0.5208333333s infinite;-o-animation:blink 0.8333333333s linear 0.5208333333s infinite}.loader__item__6{transform:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-webkit-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-moz-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-o-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);--to-opacity:calc(1 - (5 / 8));animation:blink 0.8333333333s linear 0.625s infinite;-webkit-animation:blink 0.8333333333s linear 0.625s infinite;-moz-animation:blink 0.8333333333s linear 0.625s infinite;-o-animation:blink 0.8333333333s linear 0.625s infinite}.loader__item__7{transform:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-webkit-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-moz-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-o-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);--to-opacity:calc(1 - (6 / 8));animation:blink 0.8333333333s linear 0.7291666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.7291666667s infinite;-moz-animation:blink 0.8333333333s linear 0.7291666667s infinite;-o-animation:blink 0.8333333333s linear 0.7291666667s infinite}.loader__item__8{transform:translate(5.6631628524px, -1.99913122px) rotate(360deg);-webkit-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);-moz-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);-o-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);--to-opacity:calc(1 - (7 / 8));animation:blink 0.8333333333s linear 0.8333333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.8333333333s infinite;-moz-animation:blink 0.8333333333s linear 0.8333333333s infinite;-o-animation:blink 0.8333333333s linear 0.8333333333s infinite}.loader__item__8{max-width:8.5px}@keyframes blink{0%{opacity:1}100%{opacity:var(--to-opacity)}}@keyframes rotate{0%{transform:rotate(0deg)}100%{background:rotate(360deg)}}';const w="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=",y=class{constructor(s){t(this,s),this.gatacaLoginCompleted=e(this,"gatacaLoginCompleted",7),this.gatacaLoginFailed=e(this,"gatacaLoginFailed",7),this.gatacaButtonPushed=e(this,"gatacaButtonPushed",7),this.getRequestFromUri=async t=>{const i=new URL(t).searchParams.get("request_uri");if(i){const t=await fetch(i,{method:"GET",headers:{"Content-Type":"application/json"}}),e=(await t.json()).split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),s=window.atob(e);let a=JSON.parse(s);return a.response_mode="dc_api",a}},this.buttonText="Easy login",this.buttonDCAPIText="Login with Device Credentials",this.qrType="svg",this.autostart=!0,this.checkStatus=void 0,this.createSession=void 0,this.fillSession=void 0,this.successCallback=void 0,this.errorCallback=void 0,this.handleCheckAppLoading=void 0,this.checkAppTimeout=6,this.qrRole=void 0,this.callbackServer=void 0,this.sessionTimeout=void 0,this.pollingFrequency=void 0,this.autorefresh=!1,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.hideBrandTitle=!1,this.dynamicLink=!0,this.logoSize=0,this.logoSrc=void 0,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.enableDcApi=!1,this.hideQrModalDescription=!1,this.qrStyle=void 0,this.open=!1,this.sessionId=void 0,this.authenticationRequest=void 0,this.sessionData=void 0,this.result=r.NOT_STARTED,this.qr=i("gataca-qr",{ref:t=>this.qrElement=t,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,qrStyle:this.qrStyle})}supportsDCAPI(){if(!this.enableDcApi)return!1;if(void 0===window.DigitalCredential)return!1;const t=["org-iso-mdoc","openid4vp","openid4vci"],i=t.filter(window.DigitalCredential.userAgentAllowsProtocol);return console.log(i,t),!0}async getSessionData(){return this.qr.getSessionData()}async getSessionId(){if(this.sessionId)return this.sessionId;let{sessionId:t,authenticationRequest:i}=await this.createSession();return this.sessionId=t,this.authenticationRequest=i,this.sessionId}async startMobilePolling(){await this.getSessionId(),this.result=r.ONGOING,this.poll().then((t=>{this.result=r.SUCCESS,this.sessionData=t,this.gatacaLoginCompleted.emit(t),this.successCallback(t)})).catch((t=>{this.clean();let i=t===r.EXPIRED;if(i&&this.autorefresh)this.startMobilePolling();else if(t!==r.NOT_STARTED){let e=i?new Error(this.userNotScanInTimeErrorLabel):new Error(this.credsNotValidatedErrorLabel);this.result=t,this.gatacaLoginFailed.emit(e),this.errorCallback(e)}}))}async stop(){this.clean(),(this.result===r.ONGOING||r.READ)&&(this.result=r.NOT_STARTED)}clean(){this.sessionData=void 0,this.sessionId=void 0}renderModal(){return this.qr}async poll(){let t=(new Date).getTime()+1e3*(this.sessionTimeout||300),i=1e3*(this.pollingFrequency||3),e=this,s=async function(a,n){let{result:o,data:l}=await(async t=>{if(t.result===r.NOT_STARTED)return{result:r.NOT_STARTED};let i=await t.getSessionId();return t.checkStatus(i)})(e);switch(o){case r.SUCCESS:a(l);break;case r.READ:e.result=r.READ;case r.ONGOING:e.sessionTimeout>0&&(new Date).getTime()<t?setTimeout(s,i,a,n):n(r.EXPIRED);break;default:n(o)}};return new Promise(s)}isAppInstalled(t,i){let e,s=!1;(null==t?void 0:t.length)&&d(t,!0),e=setTimeout((()=>{s||i(!1),n()}),1e3*this.checkAppTimeout);const a=()=>{document.hidden&&(s=!0,i(!0),this.autostart||this.startMobilePolling(),n())};function n(){clearTimeout(e),document.removeEventListener("visibilitychange",a)}document.addEventListener("visibilitychange",a)}renderDesktopButton(){return i("div",{class:"gatacaButtonWrapper"},i("button",{class:"gatacaButton",onClick:()=>{this.open=!this.open,setTimeout((()=>{var t,i;this.open?null===(t=this.qrElement)||void 0===t||t.display():null===(i=this.qrElement)||void 0===i||i.stop()}),0)}},i("img",{src:w,class:"buttonImg",alt:this.buttonText}),i("span",null,this.buttonText)))}async getAuthRequest(){let{authenticationRequest:t}=await this.createSession();return t}renderMobileButton(t,e){this.autostart&&!this.supportsDCAPI()&&this.startMobilePolling();let s=!1;const a=t=>{s=t,this.handleCheckAppLoading&&this.handleCheckAppLoading(t)},n=async()=>{a(!0);try{const i=await this.getAuthRequest();this.isAppInstalled(i,(i=>{i||(this.stop(),t?window.location.href="https://play.google.com/store/apps/details?id=com.gataca.identity":e&&(window.location.href="https://apps.apple.com/us/app/gataca/id1498607616")),a(!1)}))}catch(t){this.stop(),a(!1)}};return i("div",{class:"gatacaButtonWrapper"},i("button",{class:"gatacaButton",onClick:()=>{this.gatacaButtonPushed.emit(),n()},disabled:s},i("img",{src:w,class:"buttonImg",alt:this.buttonText}),i("span",null,this.buttonText)))}renderDCAPIButton(t,e){let s=!1;console.log("Maybe act different",t,e);const a=t=>{s=t,this.handleCheckAppLoading&&this.handleCheckAppLoading(t)},n=async()=>{a(!0);try{const t=await this.getAuthRequest();let i=await this.getRequestFromUri(t),e=await navigator.credentials.get({digital:{requests:[{protocol:"openid4vp-v1-unsigned",data:i}]}});"DigitalCredential"==e.constructor.name&&console.log("Digital Credential - Response Data: "+e),await this.fillSession(i,null==e?void 0:e.data)}catch(t){this.stop(),a(!1)}};return i("div",{class:"gatacaButtonWrapper"},i("button",{class:"gatacaButton",onClick:()=>{this.gatacaButtonPushed.emit(),n()},disabled:s},i("img",{src:w,class:"buttonImg",alt:this.buttonDCAPIText}),i("span",null,this.buttonDCAPIText)))}render(){const t=(null===navigator||void 0===navigator?void 0:navigator.userAgent)||(null===navigator||void 0===navigator?void 0:navigator.vendor)||(null===window||void 0===window?void 0:window.opera),e=/android/i.test(t),s=/iPad|iPhone|iPod/.test(t)&&!window.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,a=e||s,n=this.supportsDCAPI();return i("div",null,i("div",{class:"buttonContainer"},a&&"3"===this.v?this.renderMobileButton(e,s):this.renderDesktopButton(),this.open&&(!a||"3"===this.v)&&this.renderModal()),n&&i("div",{class:"buttonContainer"},this.renderDCAPIButton(e,s)))}};y.style='@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}';export{f as gataca_qr,p as gataca_qrdisplay,y as gataca_ssibutton}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as i,r as t,c as e}from"./p-85af64b1.js";import{a as n,g as s,l as a}from"./p-29119208.js";import{R as o,c as r,d as l,b as d,s as h}from"./p-7b6fa63b.js";const p=t=>{const{modalHeight:e,successLoginLabel:s}=t;return i("div",{class:"success",style:{height:e?(null==e?void 0:e.toString())+"px":"300px"}},i("img",{src:n,height:52,width:52}),i("p",{class:"successMsg"},s))},c=t=>{var e;const{errorMessage:n,modalWidth:a,clickInsideBoxLabel:o,refreshQrLabel:r,scanQrLabel:l,display:d}=t;return i("div",{class:"reload",style:{width:(a-48).toString()+"px",height:a?(null===(e=a-48)||void 0===e?void 0:e.toString())+"px":""}},i("div",{id:"notify",onClick:()=>d()},i("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTIzIDRWMTBIMTciIHN0cm9rZT0iIzhCOEI4QiIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHBhdGggZD0iTTIwLjQ4OTkgMTVDMTkuODM5OSAxNi44Mzk5IDE4LjYwOTQgMTguNDE4NyAxNi45ODQgMTkuNDk4NUMxNS4zNTg2IDIwLjU3ODMgMTMuNDI2MyAyMS4xMDA2IDExLjQ3ODMgMjAuOTg2NkM5LjUzMDI2IDIwLjg3MjYgNy42NzIwMyAyMC4xMjg2IDYuMTgzNjMgMTguODY2N0M0LjY5NTI0IDE3LjYwNDcgMy42NTczIDE1Ljg5MzIgMy4yMjYyNSAxMy45OTAxQzIuNzk1MTkgMTIuMDg2OSAyLjk5NDM2IDEwLjA5NTIgMy43OTM3NCA4LjMxNTA4QzQuNTkzMTMgNi41MzQ5NiA1Ljk0OTQyIDUuMDYyODggNy42NTgyMyA0LjEyMDY1QzkuMzY3MDUgMy4xNzg0MyAxMS4zMzU4IDIuODE3MTEgMTMuMjY3OCAzLjA5MTE2QzE1LjE5OTkgMy4zNjUyIDE2Ljk5MDUgNC4yNTk3NSAxOC4zNjk5IDUuNjQwMDFMMjIuOTk5OSAxMCIgc3Ryb2tlPSIjOEI4QjhCIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K",height:24,width:24}),i("p",{class:"notify-text"},o," "),i("p",{class:"notify-text bold"},n?r:l),n&&i("div",{class:"alert",style:{width:(a-48).toString()+"px"}},i("img",{src:s,height:24,width:24}),i("p",null,n))),i("div",{id:"qrwait",class:"qr-placeholder-slot",style:{width:(a-48).toString()+"px",height:a?(a-48).toString()+"px":""}}))},g=t=>{const{value:e,useLogo:n,logoSrc:s,size:a,qrType:o,linkReady:r=!0}=t,l=null!=a?a:256;return r?i("gataca-qrdisplay",{qrData:e,rounded:!0,size:a,qrType:o,"logo-size":n?.33:0,"logo-src":s}):i("div",{class:"qr-loading-slot",style:{width:l+"px",height:l+"px",margin:"0 auto"}})},m=()=>i("div",{class:"containerLoader"},i("div",{class:"loader"},i("div",{class:"loader__item loader__item__1"}),i("div",{class:"loader__item loader__item__2"}),i("div",{class:"loader__item loader__item__3"}),i("div",{class:"loader__item loader__item__4"}),i("div",{class:"loader__item loader__item__5"}),i("div",{class:"loader__item loader__item__6"}),i("div",{class:"loader__item loader__item__7"}),i("div",{class:"loader__item loader__item__8"}))),x=t=>{var e;const{modalWidth:n,readQrMessages:s,renderQR:a,url:o,sizeQR:r}=t;return i("div",{class:"blured",style:{width:(n-48).toString()+"px",height:n?(null===(e=n-48)||void 0===e?void 0:e.toString())+"px":""}},i("div",{id:"notify"},i(m,null),i("p",{class:"notify-text"},null==s?void 0:s.title," "),i("p",{class:"notify-text bold"},null==s?void 0:s.description)),i("div",{id:"qrwait"},a(o,!1,r)))},u=class{constructor(i){t(this,i),this.gatacaLoginCompleted=e(this,"gatacaLoginCompleted",7),this.gatacaLoginFailed=e(this,"gatacaLoginFailed",7),this.qrRefreshGeneration=0,this.lastShortenRaw=null,this.successCallback=void 0,this.errorCallback=void 0,this.qrRole=void 0,this.qrType="svg",this.callbackServer=void 0,this.socketEndpoint=void 0,this.sessionTimeout=300,this.wsOnOpen=void 0,this.wsOnMessage=void 0,this.autostart=!0,this.autorefresh=!1,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=!1,this.hideModalBoxShadow=!1,this.hideBrandTitle=!1,this.logoSize=0,this.logoSrc=a,this.qrSize=300,this.modalWidth=300,this.modalHeight=void 0,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=!1,this.dynamicLink=!0,this.sessionId=void 0,this.authenticationRequest=void 0,this.sessionData=void 0,this.result=o.NOT_STARTED,this.qrHref="",this.qrShortenPending=!1}disconnectedCallback(){this.stop()}async componentDidLoad(){this.autostart&&await this.display()}async display(){this.qrHref="",this.qrShortenPending=!1,this.lastShortenRaw=null,this.qrRefreshGeneration++;let i=new WebSocket(this.socketEndpoint);setTimeout((()=>{this.socket.close(1e3,"")}),1e3*this.sessionTimeout),this.socket=i,i.onopen=()=>{this.wsOnOpen&&this.wsOnOpen(this.socket)},i.onmessage=i=>{if(this.wsOnMessage)this.wsOnMessage(this.socket,i);else{let t=JSON.parse(i.data);t.sessionId&&this.handleWSResponse(t)}},i.onerror=()=>{let t=new Error("Error connecting with server");this.result=o.FAILED,this.gatacaLoginFailed.emit(t),this.errorCallback(t),i.close(1e3,"")},i.onclose=()=>{if((this.result===o.ONGOING||o.READ)&&(this.result=o.EXPIRED),this.result===o.EXPIRED)if(this.autorefresh)this.display();else{let i=new Error("User did not scan the QR in the alloted time");this.gatacaLoginFailed.emit(i),this.errorCallback(i)}},r()&&this.dynamicLink&&l(this.getLink(),!0)}sessionMsgReceived(i){this.handleWSResponse(i.detail)}handleWSResponse(i){switch(this.result=i.result,i.result){case o.ONGOING:case o.READ:{this.sessionId=i.sessionId,this.authenticationRequest=i.authenticationRequest;const t=this.buildRawLink();(null==t?void 0:t.trim())&&(this.qrShortenPending=!0,this.refreshQrHref());break}case o.SUCCESS:this.sessionData=i.authenticatedUserData,this.gatacaLoginCompleted.emit(i.authenticatedUserData),this.successCallback(i.authenticatedUserData),this.socket.close(1e3,"");break;case o.FAILED:this.socket.close();let t=new Error("Provided user credentials couldn't be validated");this.gatacaLoginFailed.emit(t),this.errorCallback(t);break;case o.EXPIRED:if(this.socket.close(),this.autorefresh)this.display();else{let i=new Error("User did not scan the QR in the alloted time");this.gatacaLoginFailed.emit(i),this.errorCallback(i)}}}async stop(){this.sessionData=void 0,this.sessionId=void 0,this.qrHref="",this.qrShortenPending=!1,this.lastShortenRaw=null,this.socket.close(1e3,"Client stopped the connection")}async getSessionData(){return this.sessionData?Promise.resolve(this.sessionData):Promise.reject(new Error("No successful login"))}buildRawLink(){var i;return"2"===this.v&&"connect"==this.qrRole?null!==(i=this.authenticationRequest)&&void 0!==i?i:"":"https://api.gataca.io/qr/redirect.html?dl="+d(this.authenticationRequest)}async refreshQrHref(){var i,t,e;const n=this.buildRawLink();if(!(null==n?void 0:n.trim()))return void(this.qrShortenPending=!1);if(n===this.lastShortenRaw&&(null===(i=this.qrHref)||void 0===i?void 0:i.trim()))return void(this.qrShortenPending=!1);if(this.qrShortenPending&&n===this.lastShortenRaw&&!(null===(t=this.qrHref)||void 0===t?void 0:t.trim()))return;const s=++this.qrRefreshGeneration;this.lastShortenRaw=n;try{const i=await h(n),t=this.buildRawLink();t===n?this.qrHref=i:(null===(e=this.qrHref)||void 0===e?void 0:e.trim())||(this.qrHref=t)}finally{s===this.qrRefreshGeneration&&(this.qrShortenPending=!1)}}getLink(){return this.qrHref||this.buildRawLink()}renderQRSection(){var i,t,e;switch(this.result){case o.NOT_STARTED:return this.renderRetryButton();case o.ONGOING:return this.qrShortenPending||!(null===(i=this.qrHref)||void 0===i?void 0:i.trim())?this.renderQrLoadingSlot():this.renderQR(this.getLink(),!0,void 0,!!(null===(t=this.qrHref)||void 0===t?void 0:t.trim()));case o.EXPIRED:return this.renderRetryButton(this.qrCodeExpiredLabel);case o.FAILED:return this.renderRetryButton(this.credentialsNotValidatedLabel);case o.SUCCESS:return this.renderSuccess();case o.READ:return this.qrShortenPending||!(null===(e=this.qrHref)||void 0===e?void 0:e.trim())?this.renderQrLoadingSlot():this.renderReadQR({title:null==this?void 0:this.readQrTitle,description:null==this?void 0:this.readQrDescription})}}renderSuccess(){return i(p,{modalHeight:null==this?void 0:this.modalHeight,successLoginLabel:null==this?void 0:this.successLoginLabel})}renderRetryButton(t){return i(c,{errorMessage:t,modalWidth:null==this?void 0:this.modalWidth,clickInsideBoxLabel:null==this?void 0:this.clickInsideBoxLabel,refreshQrLabel:null==this?void 0:this.refreshQrLabel,scanQrLabel:null==this?void 0:this.scanQrLabel,display:this.display.bind(this)})}renderReadQR(t){var e;const n=!!(null===(e=this.qrHref)||void 0===e?void 0:e.trim());return i(x,{modalWidth:null==this?void 0:this.modalWidth,readQrMessages:t,url:this.getLink(),sizeQR:(null==this?void 0:this.qrSize)?(null==this?void 0:this.qrSize)-50:void 0,renderQR:(i,t,e)=>this.renderQR(i,t,e,n)})}renderQR(t,e,n,s=!0){return i(g,{value:t,qrType:this.qrType,useLogo:e&&0!==this.logoSize,size:n||(null==this?void 0:this.qrSize)||void 0,logoSrc:null==this?void 0:this.logoSrc,linkReady:s})}renderQrLoadingSlot(){const t=this.qrSize||300;return i("div",{class:"qr-loading-slot",style:{width:t+"px",height:t+"px",margin:"0 auto"}})}render(){var t,e;return i("div",{class:"popUpContainer"},i("div",{class:`is-visible modal-window ${this.hideModalTexts?"":"large-modal"} ${this.hideModalBoxShadow?"noBoxShadow":""}`,style:{width:(this.modalWidth-2).toString()+"px",height:this.modalHeight?(null===(t=this.modalHeight-2)||void 0===t?void 0:t.toString())+"px":""},onClick:i=>{i.stopPropagation()}},i("div",{class:"modal-window__content"},i("div",{class:"qrTitleContainer "+(this.hideModalTexts?"hidenText":"")},i("p",{class:"qrTitle modalText",style:{color:this.modalTitleColor||"#1e1e20"}},this.qrModalTitle),!this.hideBrandTitle&&i("p",{class:"qrBrand modalText"},this.byBrandLabel," ",i("span",null,i("img",{src:a}))),this.result!==o.SUCCESS&&!this.hideQrModalDescription&&i("p",{class:"qrDescription modalText"},this.qrModalDescription)),i("div",{class:"qrSection",style:{width:this.modalWidth.toString()+"px",height:this.modalWidth?(null===(e=this.modalWidth)||void 0===e?void 0:e.toString())+"px":""}},this.renderQRSection()))))}};u.style='@import url("https://fonts.googleapis.com/css2?family=Ubuntu:wght@100;300;400;500;600;700&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@100;300;400;500;600;700&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:"";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.brandSection{padding-top:5px;display:flex;align-items:center}.brandSection .gatacaImgSmall{height:13px;width:13px;margin:0;margin-right:10px}.popUpContainer .large-modal{width:300px;min-height:350px}.popUpContainer .modal-window{position:relative;border-radius:6px;overflow:hidden;color:rgba(24, 27, 94, 0.8);box-shadow:0px 3px 10px rgba(48, 48, 48, 0.1);display:flex;flex-direction:column;justify-content:space-between;align-items:center;display:flex;z-index:1001;padding:1px;background-color:white;border-radius:12px;-webkit-transition:opacity 0.5s, visibility 0s 0.5s;transition:opacity 0.5s, visibility 0s 0.5s;visibility:hidden;opacity:0}.popUpContainer .modal-window__content{width:100%;height:100%;text-align:left}.popUpContainer .modal-window__content .hidenText{display:none}.popUpContainer .modal-window .modalText{font-family:"Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px;margin-top:10px;letter-spacing:1px}.popUpContainer .modal-window .qrTitleContainer{padding:14px 24px;padding-bottom:0px}.popUpContainer .modal-window .qrTitle{font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .modal-window .qrDescription{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074}.popUpContainer .modal-window .bold{font-weight:700}.popUpContainer .modal-window .qrBrand{margin-top:4px;font-size:14px;font-weight:400;line-height:16.5px;display:flex;align-items:center}.popUpContainer .modal-window .qrBrand img{margin-left:5px;height:12px}.popUpContainer .modal-window .qr-section{width:252px;height:252px}.popUpContainer .noBoxShadow{box-shadow:none}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}.success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.success>img{padding-bottom:12px}.success>.successMsg{line-height:23.5px;color:var(--neutral-1000, #1e1e20);text-align:center;font-family:"Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px}.reload,.blured{height:252px;width:252px;border:1px dashed #a1a1a1;border-radius:12px;position:relative;top:24px;margin:0 24px 24px;display:flex;overflow:hidden;justify-content:center;align-items:center}#qrwait{display:flex;justify-content:center}.qr-placeholder-slot,.qr-loading-slot{box-sizing:border-box;border-radius:12px;background:rgba(0, 0, 0, 0.04)}#qrwait,#notify{width:100%;height:100%;top:0;left:0;border-radius:20px}#notify{z-index:10;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;display:flex;flex-direction:column;box-sizing:border-box;padding:20px;background:rgba(255, 255, 255, 0.95)}#notify>img{padding-bottom:12px}.alert{display:flex;flex-direction:row;justify-content:start;width:252px;position:absolute;bottom:0px;border:1px solid #ee888c;background:#ffdedf;border-radius:11px;box-sizing:border-box;padding:12px;align-items:center;gap:12px}.alert>img{margin:0}.alert>p{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;margin-top:0;line-height:16px;color:#1e1e20}.notify-text{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074;text-align:center}.containerLoader{display:flex;justify-content:center;align-items:center;width:30px;height:30px;margin-bottom:12px}.loader{position:relative;margin-left:0 !important}.loader__item{position:absolute;width:9.68px;height:4px;background:transparent;border-radius:2px}.loader__item__1{transform:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-webkit-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-moz-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-o-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);animation:blink 0.8333333333s linear 0.1041666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.1041666667s infinite;-moz-animation:blink 0.8333333333s linear 0.1041666667s infinite;-o-animation:blink 0.8333333333s linear 0.1041666667s infinite}.loader__item__2{transform:translate(-4.84px, 8.5px) rotate(90deg);-webkit-animation:translate(-4.84px, 8.5px) rotate(90deg);-moz-animation:translate(-4.84px, 8.5px) rotate(90deg);-o-animation:translate(-4.84px, 8.5px) rotate(90deg);animation:blink 0.8333333333s linear 0.2083333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.2083333333s infinite;-moz-animation:blink 0.8333333333s linear 0.2083333333s infinite;-o-animation:blink 0.8333333333s linear 0.2083333333s infinite}.loader__item__3{transform:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-webkit-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-moz-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-o-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);animation:blink 0.8333333333s linear 0.3125s infinite;-webkit-animation:blink 0.8333333333s linear 0.3125s infinite;-moz-animation:blink 0.8333333333s linear 0.3125s infinite;-o-animation:blink 0.8333333333s linear 0.3125s infinite}.loader__item__4{transform:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-webkit-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-moz-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-o-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);animation:blink 0.8333333333s linear 0.4166666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.4166666667s infinite;-moz-animation:blink 0.8333333333s linear 0.4166666667s infinite;-o-animation:blink 0.8333333333s linear 0.4166666667s infinite}.loader__item__5{transform:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-webkit-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-moz-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-o-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);animation:blink 0.8333333333s linear 0.5208333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.5208333333s infinite;-moz-animation:blink 0.8333333333s linear 0.5208333333s infinite;-o-animation:blink 0.8333333333s linear 0.5208333333s infinite}.loader__item__6{transform:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-webkit-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-moz-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-o-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);animation:blink 0.8333333333s linear 0.625s infinite;-webkit-animation:blink 0.8333333333s linear 0.625s infinite;-moz-animation:blink 0.8333333333s linear 0.625s infinite;-o-animation:blink 0.8333333333s linear 0.625s infinite}.loader__item__7{transform:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-webkit-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-moz-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-o-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);animation:blink 0.8333333333s linear 0.7291666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.7291666667s infinite;-moz-animation:blink 0.8333333333s linear 0.7291666667s infinite;-o-animation:blink 0.8333333333s linear 0.7291666667s infinite}.loader__item__8{transform:translate(5.6631628524px, -1.99913122px) rotate(360deg);-webkit-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);-moz-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);-o-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);animation:blink 0.8333333333s linear 0.8333333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.8333333333s infinite;-moz-animation:blink 0.8333333333s linear 0.8333333333s infinite;-o-animation:blink 0.8333333333s linear 0.8333333333s infinite}.loader__item__8{max-width:8.5px}@keyframes blink{0%{background:#4745B7}100%{background:#CCCBF8}}@keyframes rotate{0%{transform:rotate(0deg)}100%{background:rotate(360deg)}}';export{u as gataca_qrws}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function i(){var i,t=!1;return i=navigator.userAgent||navigator.vendor,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(i)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(i.substr(0,4)))&&(t=!0),t}function t(i){return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=+$/,"")}var o;!function(i){i[i.NOT_STARTED=-1]="NOT_STARTED",i[i.ONGOING=0]="ONGOING",i[i.SUCCESS=1]="SUCCESS",i[i.FAILED=2]="FAILED",i[i.EXPIRED=3]="EXPIRED",i[i.READ=5]="READ"}(o||(o={}));const n=["openid-gatc-vp","openid-vp","openid4vp","haip-vp","openid","openid-gatc-credential-offer","haip-vci","openid-credential-offer","digital-credentials"],a=new Set(n);function e(i){var t;if("string"!=typeof i)return;const o=i.trim();if(!o||/[\u0000-\u001F\u007F\\]/.test(o))return;const n=/^([a-z][a-z0-9+.-]*):/i.exec(o);return null===(t=null==n?void 0:n[1])||void 0===t?void 0:t.toLowerCase()}function r(i){const t=e(i);return!!t&&a.has(t)}function c(i){return"https"===e(i)||r(i)}function s(i,t=!1){return!(!(t?c(i):r(i))||"string"!=typeof i||(window.location.href=i.trim(),0))}async function l(i){const t=(null==i?void 0:i.trim())||"";if(!(null==t?void 0:t.length))return null!=i?i:"";try{const o=await fetch("https://links.gataca.io/api/v1/short",{method:"POST",mode:"cors",credentials:"omit",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:t})});if(200!==o.status&&201!==o.status)return i;const n=function(i){if(!i||"object"!=typeof i)return null;const t=i;for(const i of["url","shortUrl","short_url","link"]){const o=t[i];if("string"==typeof o&&""!==o.trim())return o}return null}(await o.json().catch((()=>null)));return null!=n?n:i}catch(t){return i}}export{n as A,o as R,c as a,t as b,i as c,s as d,r as i,l as s}
|
|
@@ -55,6 +55,11 @@ export declare type QRConfig = (QRLogin & QRButton) & {
|
|
|
55
55
|
useButton?: boolean;
|
|
56
56
|
useWs?: boolean;
|
|
57
57
|
};
|
|
58
|
+
/** URL schemes before assigning window.location. */
|
|
59
|
+
export declare const ALLOWED_APP_REDIRECT_PROTOCOLS: readonly string[];
|
|
60
|
+
export declare function isAllowedAppRedirect(url?: string | null): boolean;
|
|
61
|
+
export declare function isAllowedNavigationRedirect(url?: string | null): boolean;
|
|
62
|
+
export declare function assignWindowLocationIfAllowed(url?: string | null, allowHttps?: boolean): boolean;
|
|
58
63
|
/**
|
|
59
64
|
* POSTs the link to shortener. On success with a non-empty url in the body, returns that url;
|
|
60
65
|
* otherwise returns the original link.
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as i,r as t,c as e}from"./p-85af64b1.js";import{a as n,g as s,l as a}from"./p-29119208.js";import{R as o,c as r,b as l,s as d}from"./p-143c0080.js";const h=t=>{const{modalHeight:e,successLoginLabel:s}=t;return i("div",{class:"success",style:{height:e?(null==e?void 0:e.toString())+"px":"300px"}},i("img",{src:n,height:52,width:52}),i("p",{class:"successMsg"},s))},p=t=>{var e;const{errorMessage:n,modalWidth:a,clickInsideBoxLabel:o,refreshQrLabel:r,scanQrLabel:l,display:d}=t;return i("div",{class:"reload",style:{width:(a-48).toString()+"px",height:a?(null===(e=a-48)||void 0===e?void 0:e.toString())+"px":""}},i("div",{id:"notify",onClick:()=>d()},i("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTIzIDRWMTBIMTciIHN0cm9rZT0iIzhCOEI4QiIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHBhdGggZD0iTTIwLjQ4OTkgMTVDMTkuODM5OSAxNi44Mzk5IDE4LjYwOTQgMTguNDE4NyAxNi45ODQgMTkuNDk4NUMxNS4zNTg2IDIwLjU3ODMgMTMuNDI2MyAyMS4xMDA2IDExLjQ3ODMgMjAuOTg2NkM5LjUzMDI2IDIwLjg3MjYgNy42NzIwMyAyMC4xMjg2IDYuMTgzNjMgMTguODY2N0M0LjY5NTI0IDE3LjYwNDcgMy42NTczIDE1Ljg5MzIgMy4yMjYyNSAxMy45OTAxQzIuNzk1MTkgMTIuMDg2OSAyLjk5NDM2IDEwLjA5NTIgMy43OTM3NCA4LjMxNTA4QzQuNTkzMTMgNi41MzQ5NiA1Ljk0OTQyIDUuMDYyODggNy42NTgyMyA0LjEyMDY1QzkuMzY3MDUgMy4xNzg0MyAxMS4zMzU4IDIuODE3MTEgMTMuMjY3OCAzLjA5MTE2QzE1LjE5OTkgMy4zNjUyIDE2Ljk5MDUgNC4yNTk3NSAxOC4zNjk5IDUuNjQwMDFMMjIuOTk5OSAxMCIgc3Ryb2tlPSIjOEI4QjhCIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K",height:24,width:24}),i("p",{class:"notify-text"},o," "),i("p",{class:"notify-text bold"},n?r:l),n&&i("div",{class:"alert",style:{width:(a-48).toString()+"px"}},i("img",{src:s,height:24,width:24}),i("p",null,n))),i("div",{id:"qrwait",class:"qr-placeholder-slot",style:{width:(a-48).toString()+"px",height:a?(a-48).toString()+"px":""}}))},c=t=>{const{value:e,useLogo:n,logoSrc:s,size:a,qrType:o,linkReady:r=!0}=t,l=null!=a?a:256;return r?i("gataca-qrdisplay",{qrData:e,rounded:!0,size:a,qrType:o,"logo-size":n?.33:0,"logo-src":s}):i("div",{class:"qr-loading-slot",style:{width:l+"px",height:l+"px",margin:"0 auto"}})},g=()=>i("div",{class:"containerLoader"},i("div",{class:"loader"},i("div",{class:"loader__item loader__item__1"}),i("div",{class:"loader__item loader__item__2"}),i("div",{class:"loader__item loader__item__3"}),i("div",{class:"loader__item loader__item__4"}),i("div",{class:"loader__item loader__item__5"}),i("div",{class:"loader__item loader__item__6"}),i("div",{class:"loader__item loader__item__7"}),i("div",{class:"loader__item loader__item__8"}))),m=t=>{var e;const{modalWidth:n,readQrMessages:s,renderQR:a,url:o,sizeQR:r}=t;return i("div",{class:"blured",style:{width:(n-48).toString()+"px",height:n?(null===(e=n-48)||void 0===e?void 0:e.toString())+"px":""}},i("div",{id:"notify"},i(g,null),i("p",{class:"notify-text"},null==s?void 0:s.title," "),i("p",{class:"notify-text bold"},null==s?void 0:s.description)),i("div",{id:"qrwait"},a(o,!1,r)))},x=class{constructor(i){t(this,i),this.gatacaLoginCompleted=e(this,"gatacaLoginCompleted",7),this.gatacaLoginFailed=e(this,"gatacaLoginFailed",7),this.qrRefreshGeneration=0,this.lastShortenRaw=null,this.successCallback=void 0,this.errorCallback=void 0,this.qrRole=void 0,this.qrType="svg",this.callbackServer=void 0,this.socketEndpoint=void 0,this.sessionTimeout=300,this.wsOnOpen=void 0,this.wsOnMessage=void 0,this.autostart=!0,this.autorefresh=!1,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=!1,this.hideModalBoxShadow=!1,this.hideBrandTitle=!1,this.logoSize=0,this.logoSrc=a,this.qrSize=300,this.modalWidth=300,this.modalHeight=void 0,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=!1,this.dynamicLink=!0,this.sessionId=void 0,this.authenticationRequest=void 0,this.sessionData=void 0,this.result=o.NOT_STARTED,this.qrHref="",this.qrShortenPending=!1}disconnectedCallback(){this.stop()}async componentDidLoad(){this.autostart&&await this.display()}async display(){this.qrHref="",this.qrShortenPending=!1,this.lastShortenRaw=null,this.qrRefreshGeneration++;let i=new WebSocket(this.socketEndpoint);setTimeout((()=>{this.socket.close(1e3,"")}),1e3*this.sessionTimeout),this.socket=i,i.onopen=()=>{this.wsOnOpen&&this.wsOnOpen(this.socket)},i.onmessage=i=>{if(this.wsOnMessage)this.wsOnMessage(this.socket,i);else{let t=JSON.parse(i.data);t.sessionId&&this.handleWSResponse(t)}},i.onerror=()=>{let t=new Error("Error connecting with server");this.result=o.FAILED,this.gatacaLoginFailed.emit(t),this.errorCallback(t),i.close(1e3,"")},i.onclose=()=>{if((this.result===o.ONGOING||o.READ)&&(this.result=o.EXPIRED),this.result===o.EXPIRED)if(this.autorefresh)this.display();else{let i=new Error("User did not scan the QR in the alloted time");this.gatacaLoginFailed.emit(i),this.errorCallback(i)}},r()&&this.dynamicLink&&(window.location.href=this.getLink())}sessionMsgReceived(i){this.handleWSResponse(i.detail)}handleWSResponse(i){switch(this.result=i.result,i.result){case o.ONGOING:case o.READ:{this.sessionId=i.sessionId,this.authenticationRequest=i.authenticationRequest;const t=this.buildRawLink();(null==t?void 0:t.trim())&&(this.qrShortenPending=!0,this.refreshQrHref());break}case o.SUCCESS:this.sessionData=i.authenticatedUserData,this.gatacaLoginCompleted.emit(i.authenticatedUserData),this.successCallback(i.authenticatedUserData),this.socket.close(1e3,"");break;case o.FAILED:this.socket.close();let t=new Error("Provided user credentials couldn't be validated");this.gatacaLoginFailed.emit(t),this.errorCallback(t);break;case o.EXPIRED:if(this.socket.close(),this.autorefresh)this.display();else{let i=new Error("User did not scan the QR in the alloted time");this.gatacaLoginFailed.emit(i),this.errorCallback(i)}}}async stop(){this.sessionData=void 0,this.sessionId=void 0,this.qrHref="",this.qrShortenPending=!1,this.lastShortenRaw=null,this.socket.close(1e3,"Client stopped the connection")}async getSessionData(){return this.sessionData?Promise.resolve(this.sessionData):Promise.reject(new Error("No successful login"))}buildRawLink(){var i;return"2"===this.v&&"connect"==this.qrRole?null!==(i=this.authenticationRequest)&&void 0!==i?i:"":"https://api.gataca.io/qr/redirect.html?dl="+l(this.authenticationRequest)}async refreshQrHref(){var i,t,e;const n=this.buildRawLink();if(!(null==n?void 0:n.trim()))return void(this.qrShortenPending=!1);if(n===this.lastShortenRaw&&(null===(i=this.qrHref)||void 0===i?void 0:i.trim()))return void(this.qrShortenPending=!1);if(this.qrShortenPending&&n===this.lastShortenRaw&&!(null===(t=this.qrHref)||void 0===t?void 0:t.trim()))return;const s=++this.qrRefreshGeneration;this.lastShortenRaw=n;try{const i=await d(n),t=this.buildRawLink();t===n?this.qrHref=i:(null===(e=this.qrHref)||void 0===e?void 0:e.trim())||(this.qrHref=t)}finally{s===this.qrRefreshGeneration&&(this.qrShortenPending=!1)}}getLink(){return this.qrHref||this.buildRawLink()}renderQRSection(){var i,t,e;switch(this.result){case o.NOT_STARTED:return this.renderRetryButton();case o.ONGOING:return this.qrShortenPending||!(null===(i=this.qrHref)||void 0===i?void 0:i.trim())?this.renderQrLoadingSlot():this.renderQR(this.getLink(),!0,void 0,!!(null===(t=this.qrHref)||void 0===t?void 0:t.trim()));case o.EXPIRED:return this.renderRetryButton(this.qrCodeExpiredLabel);case o.FAILED:return this.renderRetryButton(this.credentialsNotValidatedLabel);case o.SUCCESS:return this.renderSuccess();case o.READ:return this.qrShortenPending||!(null===(e=this.qrHref)||void 0===e?void 0:e.trim())?this.renderQrLoadingSlot():this.renderReadQR({title:null==this?void 0:this.readQrTitle,description:null==this?void 0:this.readQrDescription})}}renderSuccess(){return i(h,{modalHeight:null==this?void 0:this.modalHeight,successLoginLabel:null==this?void 0:this.successLoginLabel})}renderRetryButton(t){return i(p,{errorMessage:t,modalWidth:null==this?void 0:this.modalWidth,clickInsideBoxLabel:null==this?void 0:this.clickInsideBoxLabel,refreshQrLabel:null==this?void 0:this.refreshQrLabel,scanQrLabel:null==this?void 0:this.scanQrLabel,display:this.display.bind(this)})}renderReadQR(t){var e;const n=!!(null===(e=this.qrHref)||void 0===e?void 0:e.trim());return i(m,{modalWidth:null==this?void 0:this.modalWidth,readQrMessages:t,url:this.getLink(),sizeQR:(null==this?void 0:this.qrSize)?(null==this?void 0:this.qrSize)-50:void 0,renderQR:(i,t,e)=>this.renderQR(i,t,e,n)})}renderQR(t,e,n,s=!0){return i(c,{value:t,qrType:this.qrType,useLogo:e&&0!==this.logoSize,size:n||(null==this?void 0:this.qrSize)||void 0,logoSrc:null==this?void 0:this.logoSrc,linkReady:s})}renderQrLoadingSlot(){const t=this.qrSize||300;return i("div",{class:"qr-loading-slot",style:{width:t+"px",height:t+"px",margin:"0 auto"}})}render(){var t,e;return i("div",{class:"popUpContainer"},i("div",{class:`is-visible modal-window ${this.hideModalTexts?"":"large-modal"} ${this.hideModalBoxShadow?"noBoxShadow":""}`,style:{width:(this.modalWidth-2).toString()+"px",height:this.modalHeight?(null===(t=this.modalHeight-2)||void 0===t?void 0:t.toString())+"px":""},onClick:i=>{i.stopPropagation()}},i("div",{class:"modal-window__content"},i("div",{class:"qrTitleContainer "+(this.hideModalTexts?"hidenText":"")},i("p",{class:"qrTitle modalText",style:{color:this.modalTitleColor||"#1e1e20"}},this.qrModalTitle),!this.hideBrandTitle&&i("p",{class:"qrBrand modalText"},this.byBrandLabel," ",i("span",null,i("img",{src:a}))),this.result!==o.SUCCESS&&!this.hideQrModalDescription&&i("p",{class:"qrDescription modalText"},this.qrModalDescription)),i("div",{class:"qrSection",style:{width:this.modalWidth.toString()+"px",height:this.modalWidth?(null===(e=this.modalWidth)||void 0===e?void 0:e.toString())+"px":""}},this.renderQRSection()))))}};x.style='@import url("https://fonts.googleapis.com/css2?family=Ubuntu:wght@100;300;400;500;600;700&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@100;300;400;500;600;700&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:"";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.brandSection{padding-top:5px;display:flex;align-items:center}.brandSection .gatacaImgSmall{height:13px;width:13px;margin:0;margin-right:10px}.popUpContainer .large-modal{width:300px;min-height:350px}.popUpContainer .modal-window{position:relative;border-radius:6px;overflow:hidden;color:rgba(24, 27, 94, 0.8);box-shadow:0px 3px 10px rgba(48, 48, 48, 0.1);display:flex;flex-direction:column;justify-content:space-between;align-items:center;display:flex;z-index:1001;padding:1px;background-color:white;border-radius:12px;-webkit-transition:opacity 0.5s, visibility 0s 0.5s;transition:opacity 0.5s, visibility 0s 0.5s;visibility:hidden;opacity:0}.popUpContainer .modal-window__content{width:100%;height:100%;text-align:left}.popUpContainer .modal-window__content .hidenText{display:none}.popUpContainer .modal-window .modalText{font-family:"Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px;margin-top:10px;letter-spacing:1px}.popUpContainer .modal-window .qrTitleContainer{padding:14px 24px;padding-bottom:0px}.popUpContainer .modal-window .qrTitle{font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .modal-window .qrDescription{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074}.popUpContainer .modal-window .bold{font-weight:700}.popUpContainer .modal-window .qrBrand{margin-top:4px;font-size:14px;font-weight:400;line-height:16.5px;display:flex;align-items:center}.popUpContainer .modal-window .qrBrand img{margin-left:5px;height:12px}.popUpContainer .modal-window .qr-section{width:252px;height:252px}.popUpContainer .noBoxShadow{box-shadow:none}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}.success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.success>img{padding-bottom:12px}.success>.successMsg{line-height:23.5px;color:var(--neutral-1000, #1e1e20);text-align:center;font-family:"Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px}.reload,.blured{height:252px;width:252px;border:1px dashed #a1a1a1;border-radius:12px;position:relative;top:24px;margin:0 24px 24px;display:flex;overflow:hidden;justify-content:center;align-items:center}#qrwait{display:flex;justify-content:center}.qr-placeholder-slot,.qr-loading-slot{box-sizing:border-box;border-radius:12px;background:rgba(0, 0, 0, 0.04)}#qrwait,#notify{width:100%;height:100%;top:0;left:0;border-radius:20px}#notify{z-index:10;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;display:flex;flex-direction:column;box-sizing:border-box;padding:20px;background:rgba(255, 255, 255, 0.95)}#notify>img{padding-bottom:12px}.alert{display:flex;flex-direction:row;justify-content:start;width:252px;position:absolute;bottom:0px;border:1px solid #ee888c;background:#ffdedf;border-radius:11px;box-sizing:border-box;padding:12px;align-items:center;gap:12px}.alert>img{margin:0}.alert>p{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;margin-top:0;line-height:16px;color:#1e1e20}.notify-text{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074;text-align:center}.containerLoader{display:flex;justify-content:center;align-items:center;width:30px;height:30px;margin-bottom:12px}.loader{position:relative;margin-left:0 !important}.loader__item{position:absolute;width:9.68px;height:4px;background:transparent;border-radius:2px}.loader__item__1{transform:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-webkit-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-moz-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-o-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);animation:blink 0.8333333333s linear 0.1041666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.1041666667s infinite;-moz-animation:blink 0.8333333333s linear 0.1041666667s infinite;-o-animation:blink 0.8333333333s linear 0.1041666667s infinite}.loader__item__2{transform:translate(-4.84px, 8.5px) rotate(90deg);-webkit-animation:translate(-4.84px, 8.5px) rotate(90deg);-moz-animation:translate(-4.84px, 8.5px) rotate(90deg);-o-animation:translate(-4.84px, 8.5px) rotate(90deg);animation:blink 0.8333333333s linear 0.2083333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.2083333333s infinite;-moz-animation:blink 0.8333333333s linear 0.2083333333s infinite;-o-animation:blink 0.8333333333s linear 0.2083333333s infinite}.loader__item__3{transform:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-webkit-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-moz-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-o-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);animation:blink 0.8333333333s linear 0.3125s infinite;-webkit-animation:blink 0.8333333333s linear 0.3125s infinite;-moz-animation:blink 0.8333333333s linear 0.3125s infinite;-o-animation:blink 0.8333333333s linear 0.3125s infinite}.loader__item__4{transform:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-webkit-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-moz-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-o-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);animation:blink 0.8333333333s linear 0.4166666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.4166666667s infinite;-moz-animation:blink 0.8333333333s linear 0.4166666667s infinite;-o-animation:blink 0.8333333333s linear 0.4166666667s infinite}.loader__item__5{transform:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-webkit-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-moz-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-o-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);animation:blink 0.8333333333s linear 0.5208333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.5208333333s infinite;-moz-animation:blink 0.8333333333s linear 0.5208333333s infinite;-o-animation:blink 0.8333333333s linear 0.5208333333s infinite}.loader__item__6{transform:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-webkit-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-moz-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-o-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);animation:blink 0.8333333333s linear 0.625s infinite;-webkit-animation:blink 0.8333333333s linear 0.625s infinite;-moz-animation:blink 0.8333333333s linear 0.625s infinite;-o-animation:blink 0.8333333333s linear 0.625s infinite}.loader__item__7{transform:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-webkit-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-moz-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-o-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);animation:blink 0.8333333333s linear 0.7291666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.7291666667s infinite;-moz-animation:blink 0.8333333333s linear 0.7291666667s infinite;-o-animation:blink 0.8333333333s linear 0.7291666667s infinite}.loader__item__8{transform:translate(5.6631628524px, -1.99913122px) rotate(360deg);-webkit-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);-moz-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);-o-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);animation:blink 0.8333333333s linear 0.8333333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.8333333333s infinite;-moz-animation:blink 0.8333333333s linear 0.8333333333s infinite;-o-animation:blink 0.8333333333s linear 0.8333333333s infinite}.loader__item__8{max-width:8.5px}@keyframes blink{0%{background:#4745B7}100%{background:#CCCBF8}}@keyframes rotate{0%{transform:rotate(0deg)}100%{background:rotate(360deg)}}';export{x as gataca_qrws}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as i,c as e}from"./p-85af64b1.js";import{l as s,Q as a,g as n,a as o}from"./p-29119208.js";import{R as r,c as l,b as d,s as h}from"./p-143c0080.js";const c=class{constructor(i){t(this,i),this.qrData=void 0,this.qrType="svg",this.size=256,this.logoSize=0,this.logoSrc=void 0,this.qrColor="#1E1E20",this.bgColor="#FFFFFF",this.rounded=!0}getQrOptions(){return{data:this.qrData,width:this.size,height:this.size,image:this.logoSize>0?this.logoSrc||s:void 0,margin:10,type:this.qrType,dotsOptions:{color:this.qrColor,type:this.rounded?"dots":"square"},cornersSquareOptions:{type:this.rounded?"extra-rounded":"square"},cornersDotOptions:{type:this.rounded?"dot":"square"},imageOptions:{margin:2,imageSize:this.logoSize},backgroundOptions:{color:this.bgColor}}}componentDidLoad(){this.mountOrUpdateQr()}onQrDataChange(){this.mountOrUpdateQr()}mountOrUpdateQr(){var t;(null===(t=this.qrData)||void 0===t?void 0:t.trim())&&this.qr&&(this.qrCode?this.qrCode.update({data:this.qrData}):(this.qrCode=new a(this.getQrOptions()),this.qrCode.append(this.qr)))}render(){return i("div",{ref:t=>{this.qr=t}})}static get watchers(){return{qrData:["onQrDataChange"]}}},p=t=>{const{value:e,useLogo:s,logoSrc:a,size:n,qrType:o,style:r,linkReady:l=!0}=t,d=null!=n?n:256;return l?i("gataca-qrdisplay",{qrData:e,rounded:!0,qrType:o,size:n,"logo-size":s?.33:0,"logo-src":a,qrColor:null==r?void 0:r.color,bgColor:null==r?void 0:r.bgColor}):i("div",{class:"qr-loading-slot",style:{width:d+"px",height:d+"px",margin:"0 auto"}})},u=t=>{const{color:e="#4745B7"}=t;return i("div",{class:"containerLoader",style:{"--loader-color":e}},i("div",{class:"loader"},i("div",{class:"loader__item loader__item__1"}),i("div",{class:"loader__item loader__item__2"}),i("div",{class:"loader__item loader__item__3"}),i("div",{class:"loader__item loader__item__4"}),i("div",{class:"loader__item loader__item__5"}),i("div",{class:"loader__item loader__item__6"}),i("div",{class:"loader__item loader__item__7"}),i("div",{class:"loader__item loader__item__8"})))},g=t=>{var e;const{modalWidth:s,readQrMessages:a,renderQR:n,url:o,sizeQR:r,style:l}=t,d={backgroundColor:(null==l?void 0:l.bgColor)?null==l?void 0:l.bgColor:"white"},h={color:(null==l?void 0:l.color)?null==l?void 0:l.color:"#707074"};return i("div",{class:"blured",style:{width:(s-48).toString()+"px",height:s?(null===(e=s-48)||void 0===e?void 0:e.toString())+"px":"",backgroundColor:null==l?void 0:l.bgColor,color:null==l?void 0:l.color,border:(null==l?void 0:l.color)?`1px dashed ${null==l?void 0:l.color}`:"1px dashed #a1a1a1"}},i("div",{id:"notify",style:d},i(u,{color:null==l?void 0:l.color}),i("p",{class:"notify-text",style:h},null==a?void 0:a.title," "),i("p",{class:"notify-text bold",style:h},null==a?void 0:a.description)),i("div",{id:"qrwait"},n(o,!1,r)))},m=t=>{const{height:e=24,width:s=24,color:a}=t,n=a||"#8B8B8B";return i("svg",{width:s,height:e,viewBox:`0 0 ${s} ${e}`,fill:"none",xmlns:"http://www.w3.org/2000/svg"},i("path",{d:"M23 4V10H17",stroke:n,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),i("path",{d:"M20.4899 15C19.8399 16.8399 18.6094 18.4187 16.984 19.4985C15.3586 20.5783 13.4263 21.1006 11.4783 20.9866C9.53026 20.8726 7.67203 20.1286 6.18363 18.8667C4.69524 17.6047 3.6573 15.8932 3.22625 13.9901C2.79519 12.0869 2.99436 10.0952 3.79374 8.31508C4.59313 6.53496 5.94942 5.06288 7.65823 4.12065C9.36705 3.17843 11.3358 2.81711 13.2678 3.09116C15.1999 3.3652 16.9905 4.25975 18.3699 5.64001L22.9999 10",stroke:n,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}))},b=t=>{var e;const{errorMessage:s,modalWidth:a,clickInsideBoxLabel:o,refreshQrLabel:r,scanQrLabel:l,style:d,display:h}=t,c={backgroundColor:(null==d?void 0:d.bgColor)?null==d?void 0:d.bgColor:"white"},p={backgroundColor:(null==d?void 0:d.alertBgColor)?null==d?void 0:d.alertBgColor:"#ffdedf"},u={borderColor:(null==d?void 0:d.alertBorderColor)?null==d?void 0:d.alertBorderColor:"#ee888c"},g={color:(null==d?void 0:d.color)?null==d?void 0:d.color:"#707074"};return i("div",{class:"reload",style:{width:(a-48).toString()+"px",height:a?(null===(e=a-48)||void 0===e?void 0:e.toString())+"px":"",border:(null==d?void 0:d.color)?`1px dashed ${null==d?void 0:d.color}`:"1px dashed #a1a1a1"}},i("div",{id:"notify",onClick:()=>h(),style:c},i(m,{color:null==d?void 0:d.color,height:24,width:24}),i("p",{class:"notify-text",style:g},o," "),i("p",{class:"notify-text bold",style:g},s?r:l),s&&i("div",{class:"alert",style:Object.assign(Object.assign({width:(a-48).toString()+"px"},p),{border:`1px solid ${u}`})},i("img",{src:n,height:24,width:24}),i("p",{style:{color:(null==d?void 0:d.color)?null==d?void 0:d.color:"#1e1e20"}},s))),i("div",{id:"qrwait",class:"qr-placeholder-slot",style:{width:(a-48).toString()+"px",height:a?(a-48).toString()+"px":""}}))},v=t=>{const{modalHeight:e,successLoginLabel:s,style:a}=t,n={color:(null==a?void 0:a.color)?null==a?void 0:a.color:"#1e1e20"};return i("div",{class:"success",style:{height:e?(null==e?void 0:e.toString())+"px":"300px"}},i("img",{src:o,height:52,width:52}),i("p",{class:"successMsg",style:n},s))},x=class{constructor(i){t(this,i),this.gatacaLoginCompleted=e(this,"gatacaLoginCompleted",7),this.gatacaLoginFailed=e(this,"gatacaLoginFailed",7),this.lastShortenRaw=null,this.checkStatus=void 0,this.createSession=void 0,this.successCallback=void 0,this.errorCallback=void 0,this.qrRole=void 0,this.qrType="svg",this.callbackServer=void 0,this.autostart=!0,this.autorefresh=!1,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=!1,this.hideModalBoxShadow=!1,this.hideBrandTitle=!1,this.logoSize=0,this.logoSrc=s,this.qrSize=300,this.modalWidth=300,this.modalHeight=void 0,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=!1,this.sessionTimeout=300,this.pollingFrequency=3,this.dynamicLink=!0,this.qrStyle=void 0,this.sessionId=void 0,this.authenticationRequest=void 0,this.sessionData=void 0,this.result=r.NOT_STARTED,this.qrHref=""}disconnectedCallback(){this.stop()}async componentDidLoad(){this.autostart&&await this.display()}async display(){await this.getSessionId(),await this.refreshQrHref(),this.result=r.ONGOING,this.poll().then((t=>{this.result=r.SUCCESS,this.sessionData=t,this.gatacaLoginCompleted.emit(t),this.successCallback(t)})).catch((t=>{this.clean();let i=t===r.EXPIRED;if(i&&this.autorefresh)this.display();else if(t!==r.NOT_STARTED){let e=i?new Error(this.userNotScanInTimeErrorLabel):new Error(this.credsNotValidatedErrorLabel);this.result=t,this.gatacaLoginFailed.emit(e),this.errorCallback(e)}})),l()&&this.dynamicLink&&(window.location.href=this.getLink())}buildRawLink(){var t;return"2"===this.v?null!==(t=this.authenticationRequest)&&void 0!==t?t:"":"https://api.gataca.io/qr/redirect.html?dl="+d(this.authenticationRequest)}async refreshQrHref(){var t;const i=this.buildRawLink();if(i===this.lastShortenRaw)return;this.lastShortenRaw=i;const e=await h(null!=i?i:""),s=this.buildRawLink();s===i?this.qrHref=e:(null===(t=this.qrHref)||void 0===t?void 0:t.trim())||(this.qrHref=s)}async stop(){this.clean(),(this.result===r.ONGOING||r.READ)&&(this.result=r.NOT_STARTED)}clean(){this.sessionData=void 0,this.sessionId=void 0,this.qrHref="",this.lastShortenRaw=null}async getSessionData(){return this.sessionData?Promise.resolve(this.sessionData):Promise.reject(new Error(this.failedLoginErrorLabel))}async getSessionId(){if(this.sessionId)return this.sessionId;let{sessionId:t,authenticationRequest:i}=await this.createSession();return this.sessionId=t,this.authenticationRequest=i,this.sessionId}getLink(){return this.qrHref||this.buildRawLink()}async poll(){let t=(new Date).getTime()+1e3*(this.sessionTimeout||300),i=1e3*(this.pollingFrequency||3),e=this,s=async function(a,n){let{result:o,data:l}=await(async t=>{if(t.result===r.NOT_STARTED)return{result:r.NOT_STARTED};let i=await t.getSessionId();return t.checkStatus(i)})(e);switch(o){case r.SUCCESS:a(l);break;case r.READ:e.result=r.READ;case r.ONGOING:e.sessionTimeout>0&&(new Date).getTime()<t?setTimeout(s,i,a,n):n(r.EXPIRED);break;default:n(o)}};return new Promise(s)}renderQRSection(){var t;switch(this.result){case r.NOT_STARTED:return this.renderRetryButton();case r.ONGOING:return this.renderQR(this.getLink(),!0,void 0,!!(null===(t=this.qrHref)||void 0===t?void 0:t.trim()));case r.EXPIRED:return this.renderRetryButton(this.qrCodeExpiredLabel);case r.FAILED:return this.renderRetryButton(this.credentialsNotValidatedLabel);case r.SUCCESS:return this.renderSuccess();case r.READ:return this.renderReadQR({title:null==this?void 0:this.readQrTitle,description:null==this?void 0:this.readQrDescription})}}renderSuccess(){return i(v,{modalHeight:null==this?void 0:this.modalHeight,successLoginLabel:null==this?void 0:this.successLoginLabel,style:null==this?void 0:this.qrStyle})}renderRetryButton(t){return i(b,{errorMessage:t,modalWidth:null==this?void 0:this.modalWidth,clickInsideBoxLabel:null==this?void 0:this.clickInsideBoxLabel,refreshQrLabel:null==this?void 0:this.refreshQrLabel,scanQrLabel:null==this?void 0:this.scanQrLabel,display:this.display.bind(this),style:null==this?void 0:this.qrStyle})}renderReadQR(t){var e;const s=!!(null===(e=this.qrHref)||void 0===e?void 0:e.trim());return i(g,{modalWidth:null==this?void 0:this.modalWidth,readQrMessages:t,url:this.getLink(),sizeQR:(null==this?void 0:this.qrSize)?(null==this?void 0:this.qrSize)-50:void 0,renderQR:(t,i,e)=>this.renderQR(t,i,e,s),style:this.qrStyle})}renderQR(t,e,s,a=!0){return i(p,{value:t,qrType:this.qrType,useLogo:e&&0!==this.logoSize,size:s||(null==this?void 0:this.qrSize)||void 0,logoSrc:null==this?void 0:this.logoSrc,style:null==this?void 0:this.qrStyle,linkReady:a})}render(){var t,e,a,n,o,l;return i("div",{class:"popUpContainer"},i("div",{class:`is-visible modal-window ${this.hideModalTexts?"":"large-modal"} ${this.hideModalBoxShadow?"noBoxShadow":""}`,style:{width:(this.modalWidth-2).toString()+"px",height:this.modalHeight?(null===(t=this.modalHeight-2)||void 0===t?void 0:t.toString())+"px":"",backgroundColor:(null===(e=null==this?void 0:this.qrStyle)||void 0===e?void 0:e.bgColor)?null===(a=null==this?void 0:this.qrStyle)||void 0===a?void 0:a.bgColor:"white",boxShadow:(null===(n=null==this?void 0:this.qrStyle)||void 0===n?void 0:n.boxShadow)?null===(o=null==this?void 0:this.qrStyle)||void 0===o?void 0:o.boxShadow:"0px 3px 10px rgba(48, 48, 48, 0.1);"},onClick:t=>{t.stopPropagation()}},i("div",{class:"modal-window__content"},i("div",{class:"qrTitleContainer "+(this.hideModalTexts?"hidenText":"")},i("p",{class:"qrTitle modalText",style:{color:this.modalTitleColor||"#1e1e20"}},this.qrModalTitle),!this.hideBrandTitle&&i("p",{class:"qrBrand modalText"},this.byBrandLabel," ",i("span",null,i("img",{src:s}))),this.result!==r.SUCCESS&&!this.hideQrModalDescription&&i("p",{class:"qrDescription modalText"},this.qrModalDescription)),i("div",{class:"qrSection",style:{width:this.modalWidth.toString()+"px",height:this.modalWidth?(null===(l=this.modalWidth)||void 0===l?void 0:l.toString())+"px":""}},this.renderQRSection()))))}};x.style='@import url("https://fonts.googleapis.com/css2?family=Ubuntu:wght@100;300;400;500;600;700&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@100;300;400;500;600;700&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:"";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.brandSection{padding-top:5px;display:flex;align-items:center}.brandSection .gatacaImgSmall{height:13px;width:13px;margin:0;margin-right:10px}.popUpContainer .large-modal{width:300px;min-height:350px}.popUpContainer .modal-window{position:relative;border-radius:6px;overflow:hidden;color:rgba(24, 27, 94, 0.8);box-shadow:0px 3px 10px rgba(48, 48, 48, 0.1);display:flex;flex-direction:column;justify-content:space-between;align-items:center;display:flex;z-index:1001;padding:1px;background-color:white;border-radius:12px;-webkit-transition:opacity 0.5s, visibility 0s 0.5s;transition:opacity 0.5s, visibility 0s 0.5s;visibility:hidden;opacity:0}.popUpContainer .modal-window__content{width:100%;height:100%;text-align:left}.popUpContainer .modal-window__content .hidenText{display:none}.popUpContainer .modal-window .modalText{font-family:"Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px;margin-top:10px;letter-spacing:1px}.popUpContainer .modal-window .qrTitleContainer{padding:14px 24px;padding-bottom:0px}.popUpContainer .modal-window .qrTitle{font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .modal-window .qrDescription{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074}.popUpContainer .modal-window .bold{font-weight:700}.popUpContainer .modal-window .qrBrand{margin-top:4px;font-size:14px;font-weight:400;line-height:16.5px;display:flex;align-items:center}.popUpContainer .modal-window .qrBrand img{margin-left:5px;height:12px}.popUpContainer .modal-window .qr-section{width:252px;height:252px}.popUpContainer .noBoxShadow{box-shadow:none}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}.success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.success>img{padding-bottom:12px}.success>.successMsg{line-height:23.5px;color:var(--neutral-1000, #1e1e20);text-align:center;font-family:"Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px}.reload,.blured{height:252px;width:252px;border:1px dashed #a1a1a1;border-radius:20px;position:relative;top:24px;margin:0 24px 24px;display:flex;overflow:hidden;justify-content:center;align-items:center}#qrwait{display:flex;justify-content:center}.qr-placeholder-slot{box-sizing:border-box;border-radius:12px;background:rgba(0, 0, 0, 0.04)}#qrwait,#notify{width:100%;height:100%;top:0;left:0;border-radius:20px}#notify{z-index:10;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;display:flex;flex-direction:column;box-sizing:border-box;padding:20px;background:rgba(255, 255, 255, 0.95)}#notify>svg{padding-bottom:12px}.alert{display:flex;flex-direction:row;justify-content:start;width:252px;position:absolute;bottom:0px;border:1px solid #ee888c;background:#ffdedf;border-radius:11px;box-sizing:border-box;padding:12px;align-items:center;gap:12px}.alert>img{margin:0}.alert>p{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;margin-top:0;line-height:16px;color:#1e1e20}.notify-text{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074;text-align:center}.containerLoader{display:flex;justify-content:center;align-items:center;width:30px;height:30px;margin-bottom:12px}.loader{position:relative;margin-left:0 !important}.loader__item{position:absolute;width:9.68px;height:4px;background-color:var(--loader-color, #4745B7);border-radius:2px;--to-opacity:1;opacity:var(--to-opacity)}.loader__item__1{transform:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-webkit-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-moz-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-o-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);--to-opacity:calc(1 - (0 / 8));animation:blink 0.8333333333s linear 0.1041666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.1041666667s infinite;-moz-animation:blink 0.8333333333s linear 0.1041666667s infinite;-o-animation:blink 0.8333333333s linear 0.1041666667s infinite}.loader__item__2{transform:translate(-4.84px, 8.5px) rotate(90deg);-webkit-animation:translate(-4.84px, 8.5px) rotate(90deg);-moz-animation:translate(-4.84px, 8.5px) rotate(90deg);-o-animation:translate(-4.84px, 8.5px) rotate(90deg);--to-opacity:calc(1 - (1 / 8));animation:blink 0.8333333333s linear 0.2083333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.2083333333s infinite;-moz-animation:blink 0.8333333333s linear 0.2083333333s infinite;-o-animation:blink 0.8333333333s linear 0.2083333333s infinite}.loader__item__3{transform:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-webkit-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-moz-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-o-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);--to-opacity:calc(1 - (2 / 8));animation:blink 0.8333333333s linear 0.3125s infinite;-webkit-animation:blink 0.8333333333s linear 0.3125s infinite;-moz-animation:blink 0.8333333333s linear 0.3125s infinite;-o-animation:blink 0.8333333333s linear 0.3125s infinite}.loader__item__4{transform:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-webkit-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-moz-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-o-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);--to-opacity:calc(1 - (3 / 8));animation:blink 0.8333333333s linear 0.4166666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.4166666667s infinite;-moz-animation:blink 0.8333333333s linear 0.4166666667s infinite;-o-animation:blink 0.8333333333s linear 0.4166666667s infinite}.loader__item__5{transform:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-webkit-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-moz-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-o-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);--to-opacity:calc(1 - (4 / 8));animation:blink 0.8333333333s linear 0.5208333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.5208333333s infinite;-moz-animation:blink 0.8333333333s linear 0.5208333333s infinite;-o-animation:blink 0.8333333333s linear 0.5208333333s infinite}.loader__item__6{transform:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-webkit-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-moz-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-o-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);--to-opacity:calc(1 - (5 / 8));animation:blink 0.8333333333s linear 0.625s infinite;-webkit-animation:blink 0.8333333333s linear 0.625s infinite;-moz-animation:blink 0.8333333333s linear 0.625s infinite;-o-animation:blink 0.8333333333s linear 0.625s infinite}.loader__item__7{transform:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-webkit-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-moz-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-o-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);--to-opacity:calc(1 - (6 / 8));animation:blink 0.8333333333s linear 0.7291666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.7291666667s infinite;-moz-animation:blink 0.8333333333s linear 0.7291666667s infinite;-o-animation:blink 0.8333333333s linear 0.7291666667s infinite}.loader__item__8{transform:translate(5.6631628524px, -1.99913122px) rotate(360deg);-webkit-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);-moz-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);-o-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);--to-opacity:calc(1 - (7 / 8));animation:blink 0.8333333333s linear 0.8333333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.8333333333s infinite;-moz-animation:blink 0.8333333333s linear 0.8333333333s infinite;-o-animation:blink 0.8333333333s linear 0.8333333333s infinite}.loader__item__8{max-width:8.5px}@keyframes blink{0%{opacity:1}100%{opacity:var(--to-opacity)}}@keyframes rotate{0%{transform:rotate(0deg)}100%{background:rotate(360deg)}}';const f="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=",w=class{constructor(s){t(this,s),this.gatacaLoginCompleted=e(this,"gatacaLoginCompleted",7),this.gatacaLoginFailed=e(this,"gatacaLoginFailed",7),this.gatacaButtonPushed=e(this,"gatacaButtonPushed",7),this.getRequestFromUri=async t=>{const i=new URL(t).searchParams.get("request_uri");if(i){const t=await fetch(i,{method:"GET",headers:{"Content-Type":"application/json"}}),e=(await t.json()).split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),s=window.atob(e);let a=JSON.parse(s);return a.response_mode="dc_api",a}},this.buttonText="Easy login",this.buttonDCAPIText="Login with Device Credentials",this.qrType="svg",this.autostart=!0,this.checkStatus=void 0,this.createSession=void 0,this.fillSession=void 0,this.successCallback=void 0,this.errorCallback=void 0,this.handleCheckAppLoading=void 0,this.checkAppTimeout=6,this.qrRole=void 0,this.callbackServer=void 0,this.sessionTimeout=void 0,this.pollingFrequency=void 0,this.autorefresh=!1,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.hideBrandTitle=!1,this.dynamicLink=!0,this.logoSize=0,this.logoSrc=void 0,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.enableDcApi=!1,this.hideQrModalDescription=!1,this.qrStyle=void 0,this.open=!1,this.sessionId=void 0,this.authenticationRequest=void 0,this.sessionData=void 0,this.result=r.NOT_STARTED,this.qr=i("gataca-qr",{ref:t=>this.qrElement=t,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,qrStyle:this.qrStyle})}supportsDCAPI(){if(!this.enableDcApi)return!1;if(void 0===window.DigitalCredential)return!1;const t=["org-iso-mdoc","openid4vp","openid4vci"],i=t.filter(window.DigitalCredential.userAgentAllowsProtocol);return console.log(i,t),!0}async getSessionData(){return this.qr.getSessionData()}async getSessionId(){if(this.sessionId)return this.sessionId;let{sessionId:t,authenticationRequest:i}=await this.createSession();return this.sessionId=t,this.authenticationRequest=i,this.sessionId}async startMobilePolling(){await this.getSessionId(),this.result=r.ONGOING,this.poll().then((t=>{this.result=r.SUCCESS,this.sessionData=t,this.gatacaLoginCompleted.emit(t),this.successCallback(t)})).catch((t=>{this.clean();let i=t===r.EXPIRED;if(i&&this.autorefresh)this.startMobilePolling();else if(t!==r.NOT_STARTED){let e=i?new Error(this.userNotScanInTimeErrorLabel):new Error(this.credsNotValidatedErrorLabel);this.result=t,this.gatacaLoginFailed.emit(e),this.errorCallback(e)}}))}async stop(){this.clean(),(this.result===r.ONGOING||r.READ)&&(this.result=r.NOT_STARTED)}clean(){this.sessionData=void 0,this.sessionId=void 0}renderModal(){return this.qr}async poll(){let t=(new Date).getTime()+1e3*(this.sessionTimeout||300),i=1e3*(this.pollingFrequency||3),e=this,s=async function(a,n){let{result:o,data:l}=await(async t=>{if(t.result===r.NOT_STARTED)return{result:r.NOT_STARTED};let i=await t.getSessionId();return t.checkStatus(i)})(e);switch(o){case r.SUCCESS:a(l);break;case r.READ:e.result=r.READ;case r.ONGOING:e.sessionTimeout>0&&(new Date).getTime()<t?setTimeout(s,i,a,n):n(r.EXPIRED);break;default:n(o)}};return new Promise(s)}isAppInstalled(t,i){let e,s=!1;(null==t?void 0:t.length)&&(window.location.href=t),e=setTimeout((()=>{s||i(!1),n()}),1e3*this.checkAppTimeout);const a=()=>{document.hidden&&(s=!0,i(!0),this.autostart||this.startMobilePolling(),n())};function n(){clearTimeout(e),document.removeEventListener("visibilitychange",a)}document.addEventListener("visibilitychange",a)}renderDesktopButton(){return i("div",{class:"gatacaButtonWrapper"},i("button",{class:"gatacaButton",onClick:()=>{this.open=!this.open,setTimeout((()=>{var t,i;this.open?null===(t=this.qrElement)||void 0===t||t.display():null===(i=this.qrElement)||void 0===i||i.stop()}),0)}},i("img",{src:f,class:"buttonImg",alt:this.buttonText}),i("span",null,this.buttonText)))}async getAuthRequest(){let{authenticationRequest:t}=await this.createSession();return t}renderMobileButton(t,e){this.autostart&&!this.supportsDCAPI()&&this.startMobilePolling();let s=!1;const a=t=>{s=t,this.handleCheckAppLoading&&this.handleCheckAppLoading(t)},n=async()=>{a(!0);try{const i=await this.getAuthRequest();this.isAppInstalled(i,(i=>{i||(this.stop(),t?window.location.href="https://play.google.com/store/apps/details?id=com.gataca.identity":e&&(window.location.href="https://apps.apple.com/us/app/gataca/id1498607616")),a(!1)}))}catch(t){this.stop(),a(!1)}};return i("div",{class:"gatacaButtonWrapper"},i("button",{class:"gatacaButton",onClick:()=>{this.gatacaButtonPushed.emit(),n()},disabled:s},i("img",{src:f,class:"buttonImg",alt:this.buttonText}),i("span",null,this.buttonText)))}renderDCAPIButton(t,e){let s=!1;console.log("Maybe act different",t,e);const a=t=>{s=t,this.handleCheckAppLoading&&this.handleCheckAppLoading(t)},n=async()=>{a(!0);try{const t=await this.getAuthRequest();let i=await this.getRequestFromUri(t),e=await navigator.credentials.get({digital:{requests:[{protocol:"openid4vp-v1-unsigned",data:i}]}});"DigitalCredential"==e.constructor.name&&console.log("Digital Credential - Response Data: "+e),await this.fillSession(i,null==e?void 0:e.data)}catch(t){this.stop(),a(!1)}};return i("div",{class:"gatacaButtonWrapper"},i("button",{class:"gatacaButton",onClick:()=>{this.gatacaButtonPushed.emit(),n()},disabled:s},i("img",{src:f,class:"buttonImg",alt:this.buttonDCAPIText}),i("span",null,this.buttonDCAPIText)))}render(){const t=(null===navigator||void 0===navigator?void 0:navigator.userAgent)||(null===navigator||void 0===navigator?void 0:navigator.vendor)||(null===window||void 0===window?void 0:window.opera),e=/android/i.test(t),s=/iPad|iPhone|iPod/.test(t)&&!window.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,a=e||s,n=this.supportsDCAPI();return i("div",null,i("div",{class:"buttonContainer"},a&&"3"===this.v?this.renderMobileButton(e,s):this.renderDesktopButton(),this.open&&(!a||"3"===this.v)&&this.renderModal()),n&&i("div",{class:"buttonContainer"},this.renderDCAPIButton(e,s)))}};w.style='@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}';export{x as gataca_qr,c as gataca_qrdisplay,w as gataca_ssibutton}
|