@gataca/qr 3.0.11 → 4.0.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/{esm/qr-code-styling-0eeb38d5.js → cjs/gat-icon-check-c88a30ed.js} +15 -1
- package/dist/cjs/{gataca-qr_2.cjs.entry.js → gataca-qr_3.cjs.entry.js} +398 -53
- package/dist/cjs/gataca-qrws.cjs.entry.js +6 -7
- package/dist/cjs/gataca-ssibuttonws.cjs.entry.js +61 -0
- package/dist/cjs/gatacaqr.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/gataca-qr/components/qr/QR.js +2 -2
- package/dist/collection/components/gataca-qr/components/readQR/ReadQR.js +13 -4
- package/dist/collection/components/gataca-qr/components/retryButton/RetryButton.js +3 -2
- package/dist/collection/components/gataca-qr/gataca-qr.css +1 -1
- package/dist/collection/components/gataca-qr/gataca-qr.js +31 -10
- package/dist/collection/components/gataca-qrdisplay/gataca-qrdisplay.js +22 -0
- package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.js +163 -3
- package/dist/components/{gat-icon-alert.js → gat-icon-check.js} +3 -3
- package/dist/components/gataca-qr2.js +58 -45
- package/dist/components/gataca-qrdisplay2.js +5 -0
- package/dist/components/gataca-qrws2.js +1 -1
- package/dist/components/gataca-ssibutton2.js +88 -4
- package/dist/components/index.js +1 -1
- package/dist/{cjs/qr-code-styling-412bbc7a.js → esm/gat-icon-check-c188cd29.js} +8 -2
- package/dist/esm/{gataca-qr_2.entry.js → gataca-qr_3.entry.js} +395 -51
- package/dist/esm/gataca-qrws.entry.js +1 -2
- package/dist/esm/gataca-ssibuttonws.entry.js +57 -0
- package/dist/esm/gatacaqr.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/gatacaqr/gatacaqr.esm.js +1 -1
- package/dist/gatacaqr/p-5be73956.js +1 -0
- package/dist/gatacaqr/p-831794a4.entry.js +1 -0
- package/dist/gatacaqr/p-948e7d94.entry.js +1 -0
- package/dist/gatacaqr/p-e94e9be8.entry.js +1 -0
- package/dist/types/components/gataca-qr/components/qr/QR.d.ts +3 -1
- package/dist/types/components/gataca-qr/components/readQR/ReadQR.d.ts +2 -0
- package/dist/types/components/gataca-qr/components/retryButton/RetryButton.d.ts +2 -0
- package/dist/types/components/gataca-qr/gataca-qr.d.ts +12 -2
- package/dist/types/components/gataca-qrdisplay/gataca-qrdisplay.d.ts +5 -0
- package/dist/types/components/gataca-ssibutton/gataca-ssibutton.d.ts +30 -1
- package/dist/types/components.d.ts +50 -0
- package/package.json +1 -1
- package/dist/cjs/gat-icon-alert-0ad19b26.js +0 -14
- package/dist/cjs/gataca-ssibutton_2.cjs.entry.js +0 -313
- package/dist/esm/gat-icon-alert-7b06ef3a.js +0 -9
- package/dist/esm/gataca-ssibutton_2.entry.js +0 -308
- package/dist/gatacaqr/p-0be4566d.js +0 -1
- package/dist/gatacaqr/p-2adc0bcc.entry.js +0 -1
- package/dist/gatacaqr/p-2ddbc2fc.entry.js +0 -1
- package/dist/gatacaqr/p-d2dd7c85.entry.js +0 -1
- package/dist/gatacaqr/p-ea783014.js +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h, c as createEvent } from './index-2be54f32.js';
|
|
2
|
-
import { l as logoGatacaSvg, g as
|
|
3
|
-
import { Q as QRCodeStyling } from './qr-code-styling-0eeb38d5.js';
|
|
2
|
+
import { Q as QRCodeStyling, l as logoGatacaSvg, g as gatIconRefreshSvg, a as gatIconAlertSvg, b as gatIconCheckSvg } from './gat-icon-check-c188cd29.js';
|
|
4
3
|
import { R as RESULT_STATUS, c as checkMobile, b as base64UrlEncode } from './utils-21ffcc1e.js';
|
|
5
4
|
|
|
6
5
|
const GatacaQRDisplay = class {
|
|
@@ -12,6 +11,7 @@ const GatacaQRDisplay = class {
|
|
|
12
11
|
this.logoSize = 0;
|
|
13
12
|
this.logoSrc = undefined;
|
|
14
13
|
this.qrColor = '#1E1E20';
|
|
14
|
+
this.bgColor = '#FFFFFF';
|
|
15
15
|
this.rounded = true;
|
|
16
16
|
}
|
|
17
17
|
componentDidLoad() {
|
|
@@ -35,6 +35,9 @@ const GatacaQRDisplay = class {
|
|
|
35
35
|
imageOptions: {
|
|
36
36
|
margin: 2,
|
|
37
37
|
imageSize: this.logoSize
|
|
38
|
+
},
|
|
39
|
+
backgroundOptions: {
|
|
40
|
+
color: this.bgColor
|
|
38
41
|
}
|
|
39
42
|
});
|
|
40
43
|
qrCode.append(this.qr);
|
|
@@ -46,34 +49,9 @@ const GatacaQRDisplay = class {
|
|
|
46
49
|
}
|
|
47
50
|
};
|
|
48
51
|
|
|
49
|
-
const
|
|
50
|
-
const {
|
|
51
|
-
return
|
|
52
|
-
height: modalHeight ? (modalHeight === null || modalHeight === void 0 ? void 0 : modalHeight.toString()) + 'px' : '300px'
|
|
53
|
-
} },
|
|
54
|
-
h("img", { src: gatIconCheckSvg, height: 52, width: 52 }),
|
|
55
|
-
h("p", { class: "successMsg" }, successLoginLabel)));
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const RetryButton = (props) => {
|
|
59
|
-
var _a;
|
|
60
|
-
const { errorMessage, modalWidth, clickInsideBoxLabel, refreshQrLabel, scanQrLabel, waitingStartSessionLabel, display, renderRetryQR } = props;
|
|
61
|
-
return (h("div", { class: "reload", style: {
|
|
62
|
-
width: (modalWidth - 48).toString() + 'px',
|
|
63
|
-
height: modalWidth ? ((_a = (modalWidth - 48)) === null || _a === void 0 ? void 0 : _a.toString()) + 'px' : ''
|
|
64
|
-
} },
|
|
65
|
-
h("div", { id: "notify", onClick: () => display() },
|
|
66
|
-
h("img", { src: gatIconRefreshSvg, height: 24, width: 24 }),
|
|
67
|
-
h("p", { class: "notify-text" },
|
|
68
|
-
clickInsideBoxLabel,
|
|
69
|
-
" "),
|
|
70
|
-
errorMessage ? h("p", { class: "notify-text bold" }, refreshQrLabel) : h("p", { class: "notify-text bold" }, scanQrLabel),
|
|
71
|
-
errorMessage && (h("div", { class: "alert", style: {
|
|
72
|
-
width: (modalWidth - 48).toString() + 'px'
|
|
73
|
-
} },
|
|
74
|
-
h("img", { src: gatIconAlertSvg, height: 24, width: 24 }),
|
|
75
|
-
h("p", null, errorMessage)))),
|
|
76
|
-
h("div", { id: "qrwait" }, renderRetryQR(waitingStartSessionLabel))));
|
|
52
|
+
const QR = (props) => {
|
|
53
|
+
const { value, useLogo, logoSrc, size, qrType, style } = props;
|
|
54
|
+
return h("gataca-qrdisplay", { qrData: value, rounded: true, qrType: qrType, size: size, "logo-size": useLogo ? 0.33 : 0, "logo-src": logoSrc, qrColor: style === null || style === void 0 ? void 0 : style.color, bgColor: style === null || style === void 0 ? void 0 : style.bgColor });
|
|
77
55
|
};
|
|
78
56
|
|
|
79
57
|
const AnimatedLoader = () => {
|
|
@@ -91,33 +69,68 @@ const AnimatedLoader = () => {
|
|
|
91
69
|
|
|
92
70
|
const ReadQR = (props) => {
|
|
93
71
|
var _a;
|
|
94
|
-
const { modalWidth, readQrMessages, renderQR, url, sizeQR } = props;
|
|
72
|
+
const { modalWidth, readQrMessages, renderQR, url, sizeQR, style } = props;
|
|
95
73
|
return (h("div", { class: "blured", style: {
|
|
96
74
|
width: (modalWidth - 48).toString() + 'px',
|
|
97
|
-
height: modalWidth ? ((_a = (modalWidth - 48)) === null || _a === void 0 ? void 0 : _a.toString()) + 'px' : ''
|
|
75
|
+
height: modalWidth ? ((_a = (modalWidth - 48)) === null || _a === void 0 ? void 0 : _a.toString()) + 'px' : '',
|
|
76
|
+
backgroundColor: style === null || style === void 0 ? void 0 : style.bgColor,
|
|
77
|
+
color: style === null || style === void 0 ? void 0 : style.color,
|
|
78
|
+
border: (style === null || style === void 0 ? void 0 : style.color) ? `1px dashed ${style === null || style === void 0 ? void 0 : style.color}` : `1px dashed #a1a1a1`
|
|
98
79
|
} },
|
|
99
|
-
h("div", { id: "notify"
|
|
80
|
+
h("div", { id: "notify", style: {
|
|
81
|
+
backgroundColor: (style === null || style === void 0 ? void 0 : style.bgColor) ? style === null || style === void 0 ? void 0 : style.bgColor : 'white'
|
|
82
|
+
} },
|
|
100
83
|
h(AnimatedLoader, null),
|
|
101
|
-
h("p", { class: "notify-text"
|
|
84
|
+
h("p", { class: "notify-text", style: {
|
|
85
|
+
color: (style === null || style === void 0 ? void 0 : style.color) ? style === null || style === void 0 ? void 0 : style.color : '#707074'
|
|
86
|
+
} }, readQrMessages === null || readQrMessages === void 0 ? void 0 :
|
|
102
87
|
readQrMessages.title,
|
|
103
|
-
|
|
104
|
-
h("p", { class: "notify-text bold"
|
|
88
|
+
' '),
|
|
89
|
+
h("p", { class: "notify-text bold", style: {
|
|
90
|
+
color: (style === null || style === void 0 ? void 0 : style.color) ? style === null || style === void 0 ? void 0 : style.color : '#707074'
|
|
91
|
+
} }, readQrMessages === null || readQrMessages === void 0 ? void 0 : readQrMessages.description)),
|
|
105
92
|
h("div", { id: "qrwait" }, renderQR(url, false, sizeQR))));
|
|
106
93
|
};
|
|
107
94
|
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
95
|
+
const RetryButton = (props) => {
|
|
96
|
+
var _a;
|
|
97
|
+
const { errorMessage, modalWidth, clickInsideBoxLabel, refreshQrLabel, scanQrLabel, waitingStartSessionLabel, style, display, renderRetryQR } = props;
|
|
98
|
+
return (h("div", { class: "reload", style: {
|
|
99
|
+
width: (modalWidth - 48).toString() + 'px',
|
|
100
|
+
height: modalWidth ? ((_a = (modalWidth - 48)) === null || _a === void 0 ? void 0 : _a.toString()) + 'px' : '',
|
|
101
|
+
border: (style === null || style === void 0 ? void 0 : style.color) ? `1px dashed ${style === null || style === void 0 ? void 0 : style.color}` : `1px dashed #a1a1a1`
|
|
102
|
+
} },
|
|
103
|
+
h("div", { id: "notify", onClick: () => display() },
|
|
104
|
+
h("img", { src: gatIconRefreshSvg, height: 24, width: 24 }),
|
|
105
|
+
h("p", { class: "notify-text" },
|
|
106
|
+
clickInsideBoxLabel,
|
|
107
|
+
" "),
|
|
108
|
+
errorMessage ? h("p", { class: "notify-text bold" }, refreshQrLabel) : h("p", { class: "notify-text bold" }, scanQrLabel),
|
|
109
|
+
errorMessage && (h("div", { class: "alert", style: {
|
|
110
|
+
width: (modalWidth - 48).toString() + 'px'
|
|
111
|
+
} },
|
|
112
|
+
h("img", { src: gatIconAlertSvg, height: 24, width: 24 }),
|
|
113
|
+
h("p", null, errorMessage)))),
|
|
114
|
+
h("div", { id: "qrwait" }, renderRetryQR(waitingStartSessionLabel))));
|
|
111
115
|
};
|
|
112
116
|
|
|
113
|
-
const
|
|
117
|
+
const Success = (props) => {
|
|
118
|
+
const { modalHeight, successLoginLabel } = props;
|
|
119
|
+
return (h("div", { class: 'success', style: {
|
|
120
|
+
height: modalHeight ? (modalHeight === null || modalHeight === void 0 ? void 0 : modalHeight.toString()) + 'px' : '300px'
|
|
121
|
+
} },
|
|
122
|
+
h("img", { src: gatIconCheckSvg, height: 52, width: 52 }),
|
|
123
|
+
h("p", { class: "successMsg" }, successLoginLabel)));
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const gatacaQrCss = "@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}#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)}}";
|
|
114
127
|
|
|
115
128
|
const DEEP_LINK_PREFIX = 'https://api.gataca.io/qr/redirect.html';
|
|
116
129
|
//Default values
|
|
117
|
-
const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
|
|
118
|
-
const DEFAULT_POLLING_FREQ = 3;
|
|
130
|
+
const DEFAULT_SESSION_TIMEOUT$1 = 300; //5mins as in connect
|
|
131
|
+
const DEFAULT_POLLING_FREQ$1 = 3;
|
|
119
132
|
const GatacaQR = class {
|
|
120
|
-
constructor(hostRef) { registerInstance(this, hostRef); this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7); this.checkStatus = undefined; this.createSession = undefined; this.successCallback = undefined; this.errorCallback = undefined; this.qrRole = undefined; this.qrType = 'svg'; this.callbackServer = undefined; this.autostart = true; this.autorefresh = false; this.v = '3'; this.qrModalTitle = 'Quick Access'; this.modalTitleColor = '#4745B7'; this.qrModalDescription = 'Sign up or sign in by scanning the QR Code with the Gataca Wallet'; this.hideModalTexts = false; this.hideModalBoxShadow = false; this.hideBrandTitle = false; this.logoSize = 0; this.logoSrc = logoGatacaSvg; this.qrSize = 300; this.modalWidth = 300; this.modalHeight = undefined; this.qrCodeExpiredLabel = 'QR Code expired'; this.credentialsNotValidatedLabel = 'User credentials not validated'; this.clickInsideBoxLabel = 'Click inside the box to'; this.refreshQrLabel = 'Refresh QR Code'; this.scanQrLabel = 'Scan QR Code'; this.userNotScanInTimeErrorLabel = 'User did not scan the QR in the allowed time'; this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated"; this.failedLoginErrorLabel = 'No successful login'; this.successLoginLabel = 'Successful Connection!'; this.byBrandLabel = 'by Gataca'; this.waitingStartSessionLabel = 'waiting to start a session'; this.readQrTitle = 'Processing...'; this.readQrDescription = 'Please wait a moment'; this.hideQrModalDescription = false; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT; this.pollingFrequency = DEFAULT_POLLING_FREQ; this.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = RESULT_STATUS.NOT_STARTED; }
|
|
133
|
+
constructor(hostRef) { registerInstance(this, hostRef); this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7); this.checkStatus = undefined; this.createSession = undefined; this.successCallback = undefined; this.errorCallback = undefined; this.qrRole = undefined; this.qrType = 'svg'; this.callbackServer = undefined; this.autostart = true; this.autorefresh = false; this.v = '3'; this.qrModalTitle = 'Quick Access'; this.modalTitleColor = '#4745B7'; this.qrModalDescription = 'Sign up or sign in by scanning the QR Code with the Gataca Wallet'; this.hideModalTexts = false; this.hideModalBoxShadow = false; this.hideBrandTitle = false; this.logoSize = 0; this.logoSrc = logoGatacaSvg; this.qrSize = 300; this.modalWidth = 300; this.modalHeight = undefined; this.qrCodeExpiredLabel = 'QR Code expired'; this.credentialsNotValidatedLabel = 'User credentials not validated'; this.clickInsideBoxLabel = 'Click inside the box to'; this.refreshQrLabel = 'Refresh QR Code'; this.scanQrLabel = 'Scan QR Code'; this.userNotScanInTimeErrorLabel = 'User did not scan the QR in the allowed time'; this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated"; this.failedLoginErrorLabel = 'No successful login'; this.successLoginLabel = 'Successful Connection!'; this.byBrandLabel = 'by Gataca'; this.waitingStartSessionLabel = 'waiting to start a session'; this.readQrTitle = 'Processing...'; this.readQrDescription = 'Please wait a moment'; this.hideQrModalDescription = false; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT$1; this.pollingFrequency = DEFAULT_POLLING_FREQ$1; this.dynamicLink = true; this.qrStyle = undefined; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = RESULT_STATUS.NOT_STARTED; }
|
|
121
134
|
disconnectedCallback() {
|
|
122
135
|
this.stop();
|
|
123
136
|
}
|
|
@@ -194,8 +207,8 @@ const GatacaQR = class {
|
|
|
194
207
|
return DEEP_LINK_PREFIX + authRequestEncoded;
|
|
195
208
|
}
|
|
196
209
|
async poll() {
|
|
197
|
-
let endTime = new Date().getTime() + (this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
|
|
198
|
-
let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
|
|
210
|
+
let endTime = new Date().getTime() + (this.sessionTimeout || DEFAULT_SESSION_TIMEOUT$1) * 1000;
|
|
211
|
+
let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ$1) * 1000;
|
|
199
212
|
let checkFunc = async (component) => {
|
|
200
213
|
if (component.result === RESULT_STATUS.NOT_STARTED) {
|
|
201
214
|
return { result: RESULT_STATUS.NOT_STARTED };
|
|
@@ -257,24 +270,355 @@ const GatacaQR = class {
|
|
|
257
270
|
return h(ReadQR, { modalWidth: this === null || this === void 0 ? void 0 : this.modalWidth, readQrMessages: readQrMessages, url: this.getLink(), sizeQR: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, renderQR: this.renderQR.bind(this) });
|
|
258
271
|
}
|
|
259
272
|
renderQR(value, useLogo, sizeQR) {
|
|
260
|
-
return h(QR, { value: value, qrType: this.qrType, useLogo: useLogo && this.logoSize !== 0, size: sizeQR || (this === null || this === void 0 ? void 0 : this.qrSize) || undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc });
|
|
273
|
+
return h(QR, { value: value, qrType: this.qrType, useLogo: useLogo && this.logoSize !== 0, size: sizeQR || (this === null || this === void 0 ? void 0 : this.qrSize) || undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc, style: this === null || this === void 0 ? void 0 : this.qrStyle });
|
|
261
274
|
}
|
|
262
275
|
renderRetryQR(value, useLogo) {
|
|
263
|
-
return h(QR, { value: value, useLogo: useLogo && this.logoSize !== 0, qrType: this.qrType, size: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc });
|
|
276
|
+
return h(QR, { value: value, useLogo: useLogo && this.logoSize !== 0, qrType: this.qrType, size: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc, style: this === null || this === void 0 ? void 0 : this.qrStyle });
|
|
264
277
|
}
|
|
265
278
|
render() {
|
|
266
|
-
var _a, _b;
|
|
279
|
+
var _a, _b, _c, _d, _e;
|
|
267
280
|
return (h("div", { class: "popUpContainer" }, h("div", { class: `is-visible modal-window ${this.hideModalTexts ? '' : 'large-modal'} ${this.hideModalBoxShadow ? 'noBoxShadow' : ''}`, style: {
|
|
268
281
|
width: (this.modalWidth - 2).toString() + 'px',
|
|
269
|
-
height: this.modalHeight ? ((_a = (this.modalHeight - 2)) === null || _a === void 0 ? void 0 : _a.toString()) + 'px' : ''
|
|
282
|
+
height: this.modalHeight ? ((_a = (this.modalHeight - 2)) === null || _a === void 0 ? void 0 : _a.toString()) + 'px' : '',
|
|
283
|
+
backgroundColor: ((_b = this === null || this === void 0 ? void 0 : this.qrStyle) === null || _b === void 0 ? void 0 : _b.bgColor) ? (_c = this === null || this === void 0 ? void 0 : this.qrStyle) === null || _c === void 0 ? void 0 : _c.bgColor : 'white',
|
|
284
|
+
boxShadow: ((_d = this === null || this === void 0 ? void 0 : this.qrStyle) === null || _d === void 0 ? void 0 : _d.boxShadow) ? '0px 3px 10px rgba(48, 48, 48, 0.1);' : 'none'
|
|
270
285
|
}, onClick: (event) => {
|
|
271
286
|
event.stopPropagation();
|
|
272
287
|
} }, h("div", { class: "modal-window__content" }, h("div", { class: `qrTitleContainer ${this.hideModalTexts ? 'hidenText' : ''}` }, h("p", { class: "qrTitle modalText", style: { color: this.modalTitleColor || '#1e1e20' } }, this.qrModalTitle), !this.hideBrandTitle && (h("p", { class: "qrBrand modalText" }, this.byBrandLabel, ' ', h("span", null, h("img", { src: logoGatacaSvg })))), this.result !== RESULT_STATUS.SUCCESS && !this.hideQrModalDescription && h("p", { class: "qrDescription modalText" }, this.qrModalDescription)), h("div", { class: "qrSection", style: {
|
|
273
288
|
width: this.modalWidth.toString() + 'px',
|
|
274
|
-
height: this.modalWidth ? ((
|
|
289
|
+
height: this.modalWidth ? ((_e = this.modalWidth) === null || _e === void 0 ? void 0 : _e.toString()) + 'px' : ''
|
|
275
290
|
} }, this.renderQRSection())))));
|
|
276
291
|
}
|
|
277
292
|
};
|
|
278
293
|
GatacaQR.style = gatacaQrCss;
|
|
279
294
|
|
|
280
|
-
|
|
295
|
+
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}";
|
|
296
|
+
|
|
297
|
+
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=';
|
|
298
|
+
//Default values
|
|
299
|
+
const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
|
|
300
|
+
const DEFAULT_POLLING_FREQ = 3;
|
|
301
|
+
const GatacaSSIButton = class {
|
|
302
|
+
constructor(hostRef) {
|
|
303
|
+
registerInstance(this, hostRef);
|
|
304
|
+
this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
|
|
305
|
+
this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
|
|
306
|
+
this.gatacaButtonPushed = createEvent(this, "gatacaButtonPushed", 7);
|
|
307
|
+
this.getRequestFromUri = async (authRequest) => {
|
|
308
|
+
const requrl = new URL(authRequest);
|
|
309
|
+
const requri = requrl.searchParams.get('request_uri');
|
|
310
|
+
if (requri) {
|
|
311
|
+
const response = await fetch(requri, {
|
|
312
|
+
method: 'GET',
|
|
313
|
+
headers: {
|
|
314
|
+
'Content-Type': 'application/json'
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
const jwt = await response.json();
|
|
318
|
+
const parts = jwt.split('.');
|
|
319
|
+
const base64 = parts[1].replace(/-/g, '+').replace(/_/g, '/');
|
|
320
|
+
const decoded = window.atob(base64);
|
|
321
|
+
let parsed = JSON.parse(decoded);
|
|
322
|
+
parsed.response_mode = 'dc_api';
|
|
323
|
+
return parsed;
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
this.buttonText = 'Easy login';
|
|
327
|
+
this.buttonDCAPIText = 'Login with Device Credentials';
|
|
328
|
+
this.qrType = 'svg';
|
|
329
|
+
this.autostart = true;
|
|
330
|
+
this.checkStatus = undefined;
|
|
331
|
+
this.createSession = undefined;
|
|
332
|
+
this.fillSession = undefined;
|
|
333
|
+
this.successCallback = undefined;
|
|
334
|
+
this.errorCallback = undefined;
|
|
335
|
+
this.handleCheckAppLoading = undefined;
|
|
336
|
+
this.checkAppTimeout = 6;
|
|
337
|
+
this.qrRole = undefined;
|
|
338
|
+
this.callbackServer = undefined;
|
|
339
|
+
this.sessionTimeout = undefined;
|
|
340
|
+
this.pollingFrequency = undefined;
|
|
341
|
+
this.autorefresh = false;
|
|
342
|
+
this.v = '3';
|
|
343
|
+
this.qrModalTitle = 'Quick Access';
|
|
344
|
+
this.modalTitleColor = '#4745B7';
|
|
345
|
+
this.qrModalDescription = 'Sign up or sign in by scanning the QR Code with the Gataca Wallet';
|
|
346
|
+
this.hideBrandTitle = false;
|
|
347
|
+
this.dynamicLink = true;
|
|
348
|
+
this.logoSize = 0;
|
|
349
|
+
this.logoSrc = undefined;
|
|
350
|
+
this.qrCodeExpiredLabel = 'QR Code expired';
|
|
351
|
+
this.credentialsNotValidatedLabel = 'User credentials not validated';
|
|
352
|
+
this.clickInsideBoxLabel = 'Click inside the box to';
|
|
353
|
+
this.refreshQrLabel = 'Refresh QR Code';
|
|
354
|
+
this.scanQrLabel = 'Scan QR Code';
|
|
355
|
+
this.userNotScanInTimeErrorLabel = 'User did not scan the QR in the allowed time';
|
|
356
|
+
this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated";
|
|
357
|
+
this.failedLoginErrorLabel = 'No successful login';
|
|
358
|
+
this.successLoginLabel = 'Successful Connection!';
|
|
359
|
+
this.byBrandLabel = 'by Gataca';
|
|
360
|
+
this.waitingStartSessionLabel = 'waiting to start a session';
|
|
361
|
+
this.enableDcApi = false;
|
|
362
|
+
this.hideQrModalDescription = false;
|
|
363
|
+
this.qrStyle = undefined;
|
|
364
|
+
this.open = false;
|
|
365
|
+
this.sessionId = undefined;
|
|
366
|
+
this.authenticationRequest = undefined;
|
|
367
|
+
this.sessionData = undefined;
|
|
368
|
+
this.result = RESULT_STATUS.NOT_STARTED;
|
|
369
|
+
this.qr = (h("gataca-qr", { ref: (el) => (this.qrElement = el), checkStatus: this.checkStatus, createSession: this.createSession, successCallback: this.successCallback, errorCallback: this.errorCallback, qrRole: this.qrRole, qrType: this.qrType, callbackServer: this.callbackServer, sessionTimeout: this.sessionTimeout, pollingFrequency: this.pollingFrequency, autostart: this.autostart, autorefresh: this.autorefresh, v: this.v, qrModalTitle: this.qrModalTitle, qrModalDescription: this.qrModalDescription, hideBrandTitle: this.hideBrandTitle, dynamicLink: this.dynamicLink, logoSize: this.logoSize, logoSrc: this.logoSrc, modalTitleColor: this.modalTitleColor, qrCodeExpiredLabel: this.qrCodeExpiredLabel, credentialsNotValidatedLabel: this.credentialsNotValidatedLabel, clickInsideBoxLabel: this.clickInsideBoxLabel, refreshQrLabel: this.refreshQrLabel, scanQrLabel: this.scanQrLabel, userNotScanInTimeErrorLabel: this.userNotScanInTimeErrorLabel, credsNotValidatedErrorLabel: this.credsNotValidatedErrorLabel, failedLoginErrorLabel: this.failedLoginErrorLabel, successLoginLabel: this.successLoginLabel, byBrandLabel: this.byBrandLabel, waitingStartSessionLabel: this.waitingStartSessionLabel, hideQrModalDescription: this.hideQrModalDescription, qrStyle: this.qrStyle }));
|
|
370
|
+
}
|
|
371
|
+
supportsDCAPI() {
|
|
372
|
+
// let mobile = checkMobile();
|
|
373
|
+
// if (!mobile) return false;
|
|
374
|
+
if (!this.enableDcApi) {
|
|
375
|
+
return false;
|
|
376
|
+
}
|
|
377
|
+
//@ts-ignore
|
|
378
|
+
if (typeof window.DigitalCredential === 'undefined')
|
|
379
|
+
return false;
|
|
380
|
+
const protocols = ['org-iso-mdoc', 'openid4vp', 'openid4vci'];
|
|
381
|
+
//@ts-ignore
|
|
382
|
+
const supportedProtocols = protocols.filter(window.DigitalCredential.userAgentAllowsProtocol);
|
|
383
|
+
console.log(supportedProtocols, protocols);
|
|
384
|
+
return true;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Retrieve manually the session data on a successful login
|
|
388
|
+
*/
|
|
389
|
+
async getSessionData() {
|
|
390
|
+
return this.qr.getSessionData();
|
|
391
|
+
}
|
|
392
|
+
async getSessionId() {
|
|
393
|
+
if (this.sessionId) {
|
|
394
|
+
return this.sessionId;
|
|
395
|
+
}
|
|
396
|
+
let { sessionId, authenticationRequest } = await this.createSession();
|
|
397
|
+
this.sessionId = sessionId;
|
|
398
|
+
this.authenticationRequest = authenticationRequest;
|
|
399
|
+
return this.sessionId;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Force manually the start polling
|
|
403
|
+
*/
|
|
404
|
+
async startMobilePolling() {
|
|
405
|
+
await this.getSessionId();
|
|
406
|
+
this.result = RESULT_STATUS.ONGOING;
|
|
407
|
+
this.poll()
|
|
408
|
+
.then((data) => {
|
|
409
|
+
this.result = RESULT_STATUS.SUCCESS;
|
|
410
|
+
this.sessionData = data;
|
|
411
|
+
this.gatacaLoginCompleted.emit(data);
|
|
412
|
+
this.successCallback(data);
|
|
413
|
+
})
|
|
414
|
+
.catch((err) => {
|
|
415
|
+
this.clean();
|
|
416
|
+
let expired = err === RESULT_STATUS.EXPIRED;
|
|
417
|
+
if (expired && this.autorefresh) {
|
|
418
|
+
this.startMobilePolling();
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
if (err !== RESULT_STATUS.NOT_STARTED) {
|
|
422
|
+
let error = expired ? new Error(this.userNotScanInTimeErrorLabel) : new Error(this.credsNotValidatedErrorLabel);
|
|
423
|
+
this.result = err;
|
|
424
|
+
this.gatacaLoginFailed.emit(error);
|
|
425
|
+
this.errorCallback(error);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Stop manually an ongoing session
|
|
432
|
+
*/
|
|
433
|
+
async stop() {
|
|
434
|
+
this.clean();
|
|
435
|
+
if (this.result === RESULT_STATUS.ONGOING || RESULT_STATUS.READ) {
|
|
436
|
+
this.result = RESULT_STATUS.NOT_STARTED;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
clean() {
|
|
440
|
+
this.sessionData = undefined;
|
|
441
|
+
this.sessionId = undefined;
|
|
442
|
+
}
|
|
443
|
+
renderModal() {
|
|
444
|
+
return this.qr;
|
|
445
|
+
}
|
|
446
|
+
async poll() {
|
|
447
|
+
let endTime = new Date().getTime() + (this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
|
|
448
|
+
let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
|
|
449
|
+
let checkFunc = async (component) => {
|
|
450
|
+
if (component.result === RESULT_STATUS.NOT_STARTED) {
|
|
451
|
+
return { result: RESULT_STATUS.NOT_STARTED };
|
|
452
|
+
}
|
|
453
|
+
let id = await component.getSessionId();
|
|
454
|
+
return component.checkStatus(id);
|
|
455
|
+
};
|
|
456
|
+
let component = this;
|
|
457
|
+
let checkCondition = async function (resolve, reject) {
|
|
458
|
+
// If the condition is met, we're done!
|
|
459
|
+
let { result, data } = await checkFunc(component);
|
|
460
|
+
switch (result) {
|
|
461
|
+
case RESULT_STATUS.SUCCESS:
|
|
462
|
+
resolve(data);
|
|
463
|
+
break;
|
|
464
|
+
case RESULT_STATUS.READ:
|
|
465
|
+
component.result = RESULT_STATUS.READ;
|
|
466
|
+
case RESULT_STATUS.ONGOING:
|
|
467
|
+
if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
|
|
468
|
+
setTimeout(checkCondition, interval, resolve, reject);
|
|
469
|
+
}
|
|
470
|
+
else {
|
|
471
|
+
reject(RESULT_STATUS.EXPIRED);
|
|
472
|
+
}
|
|
473
|
+
break;
|
|
474
|
+
default:
|
|
475
|
+
reject(result);
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
return new Promise(checkCondition);
|
|
480
|
+
}
|
|
481
|
+
isAppInstalled(appScheme, callback) {
|
|
482
|
+
let timeout;
|
|
483
|
+
let detected = false;
|
|
484
|
+
if (appScheme === null || appScheme === void 0 ? void 0 : appScheme.length) {
|
|
485
|
+
window.location.href = appScheme;
|
|
486
|
+
}
|
|
487
|
+
const waitTimeToCheckApp = this.checkAppTimeout * 1000;
|
|
488
|
+
timeout = setTimeout(() => {
|
|
489
|
+
if (!detected) {
|
|
490
|
+
callback(false);
|
|
491
|
+
}
|
|
492
|
+
cleanup();
|
|
493
|
+
}, waitTimeToCheckApp);
|
|
494
|
+
const handleVisibilityChange = () => {
|
|
495
|
+
if (document.hidden) {
|
|
496
|
+
detected = true;
|
|
497
|
+
callback(true);
|
|
498
|
+
if (!this.autostart) {
|
|
499
|
+
this.startMobilePolling();
|
|
500
|
+
}
|
|
501
|
+
cleanup();
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
505
|
+
function cleanup() {
|
|
506
|
+
clearTimeout(timeout);
|
|
507
|
+
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
renderDesktopButton() {
|
|
511
|
+
return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
|
|
512
|
+
this.open = !this.open;
|
|
513
|
+
setTimeout(() => {
|
|
514
|
+
var _a, _b;
|
|
515
|
+
if (this.open) {
|
|
516
|
+
(_a = this.qrElement) === null || _a === void 0 ? void 0 : _a.display();
|
|
517
|
+
}
|
|
518
|
+
else {
|
|
519
|
+
(_b = this.qrElement) === null || _b === void 0 ? void 0 : _b.stop();
|
|
520
|
+
}
|
|
521
|
+
}, 0);
|
|
522
|
+
} }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
|
|
523
|
+
}
|
|
524
|
+
async getAuthRequest() {
|
|
525
|
+
let { authenticationRequest } = await this.createSession();
|
|
526
|
+
return authenticationRequest;
|
|
527
|
+
}
|
|
528
|
+
renderMobileButton(isAndroid, isIos) {
|
|
529
|
+
if (this.autostart && !this.supportsDCAPI()) {
|
|
530
|
+
this.startMobilePolling();
|
|
531
|
+
}
|
|
532
|
+
let loading = false;
|
|
533
|
+
const handleLoading = (isLoading) => {
|
|
534
|
+
loading = isLoading;
|
|
535
|
+
if (this.handleCheckAppLoading) {
|
|
536
|
+
this.handleCheckAppLoading(isLoading);
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
const executeRedirection = async () => {
|
|
540
|
+
handleLoading(true);
|
|
541
|
+
const androidStoreLink = 'https://play.google.com/store/apps/details?id=com.gataca.identity';
|
|
542
|
+
const iosStoreLink = 'https://apps.apple.com/us/app/gataca/id1498607616';
|
|
543
|
+
try {
|
|
544
|
+
const appScheme = await this.getAuthRequest();
|
|
545
|
+
this.isAppInstalled(appScheme, (installed) => {
|
|
546
|
+
if (!installed) {
|
|
547
|
+
this.stop();
|
|
548
|
+
if (isAndroid) {
|
|
549
|
+
window.location.href = androidStoreLink;
|
|
550
|
+
}
|
|
551
|
+
else if (isIos) {
|
|
552
|
+
window.location.href = iosStoreLink;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
handleLoading(false);
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
catch (error) {
|
|
559
|
+
this.stop();
|
|
560
|
+
handleLoading(false);
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
|
|
564
|
+
this.gatacaButtonPushed.emit();
|
|
565
|
+
executeRedirection();
|
|
566
|
+
}, disabled: loading }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
|
|
567
|
+
}
|
|
568
|
+
renderDCAPIButton(isAndroid, isIos) {
|
|
569
|
+
let loading = false;
|
|
570
|
+
console.log('Maybe act different', isAndroid, isIos);
|
|
571
|
+
const handleLoading = (isLoading) => {
|
|
572
|
+
loading = isLoading;
|
|
573
|
+
if (this.handleCheckAppLoading) {
|
|
574
|
+
this.handleCheckAppLoading(isLoading);
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
const executeDCAPICall = async () => {
|
|
578
|
+
handleLoading(true);
|
|
579
|
+
try {
|
|
580
|
+
const authRequest = await this.getAuthRequest();
|
|
581
|
+
let request = await this.getRequestFromUri(authRequest);
|
|
582
|
+
let credentialResponse = await navigator.credentials.get({
|
|
583
|
+
//@ts-ignore
|
|
584
|
+
digital: {
|
|
585
|
+
requests: [
|
|
586
|
+
{
|
|
587
|
+
protocol: 'openid4vp-v1-unsigned',
|
|
588
|
+
data: request
|
|
589
|
+
}
|
|
590
|
+
]
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
if (credentialResponse.constructor.name == 'DigitalCredential') {
|
|
594
|
+
console.log('Digital Credential - Response Data: ' + credentialResponse);
|
|
595
|
+
}
|
|
596
|
+
//@ts-ignore
|
|
597
|
+
await this.fillSession(request, credentialResponse === null || credentialResponse === void 0 ? void 0 : credentialResponse.data);
|
|
598
|
+
}
|
|
599
|
+
catch (error) {
|
|
600
|
+
this.stop();
|
|
601
|
+
handleLoading(false);
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
|
|
605
|
+
this.gatacaButtonPushed.emit();
|
|
606
|
+
executeDCAPICall();
|
|
607
|
+
}, disabled: loading }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonDCAPIText }), h("span", null, this.buttonDCAPIText))));
|
|
608
|
+
}
|
|
609
|
+
render() {
|
|
610
|
+
const userAgent =
|
|
611
|
+
// @ts-ignore
|
|
612
|
+
(navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) || (navigator === null || navigator === void 0 ? void 0 : navigator.vendor) || (window === null || window === void 0 ? void 0 : window.opera);
|
|
613
|
+
const isAndroid = /android/i.test(userAgent);
|
|
614
|
+
const isIos =
|
|
615
|
+
// @ts-ignore
|
|
616
|
+
(/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
|
|
617
|
+
const isMobile = isAndroid || isIos;
|
|
618
|
+
const displayDCApi = this.supportsDCAPI();
|
|
619
|
+
return (h("div", null, h("div", { class: "buttonContainer" }, isMobile && this.v === '3' ? this.renderMobileButton(isAndroid, isIos) : this.renderDesktopButton(), this.open && (!isMobile || this.v === '3') && this.renderModal()), displayDCApi /** && isMobile */ && h("div", { class: "buttonContainer" }, this.renderDCAPIButton(isAndroid, isIos))));
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
GatacaSSIButton.style = gatacaSsibuttonCss;
|
|
623
|
+
|
|
624
|
+
export { GatacaQR as gataca_qr, GatacaQRDisplay as gataca_qrdisplay, GatacaSSIButton as gataca_ssibutton };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { h, r as registerInstance, c as createEvent } from './index-2be54f32.js';
|
|
2
|
-
import {
|
|
3
|
-
import './qr-code-styling-0eeb38d5.js';
|
|
2
|
+
import { b as gatIconCheckSvg, g as gatIconRefreshSvg, a as gatIconAlertSvg, l as logoGatacaSvg } from './gat-icon-check-c188cd29.js';
|
|
4
3
|
import { R as RESULT_STATUS, c as checkMobile, b as base64UrlEncode } from './utils-21ffcc1e.js';
|
|
5
4
|
|
|
6
5
|
const Success = (props) => {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-2be54f32.js';
|
|
2
|
+
|
|
3
|
+
const gatacaSsibuttonwsCss = "@import url(\"https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap\"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:\"\";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.buttonContainer{display:inline-block;text-align:right;padding:10px;position:relative}.gatacaButtonWrapper{margin:8px}.gatacaButtonWrapper .gatacaButton{display:flex;min-width:100px;padding:8px 8px;background-color:white;font-size:12px;font-family:\"Work Sans\", sans-serif;letter-spacing:1px;font-weight:2;justify-content:space-between;align-items:center;border-radius:6px;border:1px solid rgba(24, 27, 94, 0.5);color:rgba(24, 27, 94, 0.8);box-shadow:0px 1px 3px rgba(48, 48, 48, 0.15);cursor:pointer}.gatacaButtonWrapper .gatacaButton>span{margin-right:10px}.gatacaButtonWrapper .gatacaButton:hover{box-shadow:0px 2px 8px rgba(48, 48, 48, 0.1)}.gatacaButtonWrapper .buttonText{text-align:right;font-size:8px;color:rgba(24, 27, 94, 0.5);font-family:\"Helvetica Neue\", sans-serif;letter-spacing:1px;padding-right:8px;font-weight:1}.gatacaButtonWrapper .buttonImg{height:25px;width:25px;margin:0;margin-right:20px}";
|
|
4
|
+
|
|
5
|
+
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=';
|
|
6
|
+
const GatacaSSIButtonWS = class {
|
|
7
|
+
constructor(hostRef) {
|
|
8
|
+
registerInstance(this, hostRef);
|
|
9
|
+
this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
|
|
10
|
+
this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
|
|
11
|
+
this.buttonText = 'Easy login';
|
|
12
|
+
this.successCallback = undefined;
|
|
13
|
+
this.errorCallback = undefined;
|
|
14
|
+
this.qrType = 'svg';
|
|
15
|
+
this.qrRole = undefined;
|
|
16
|
+
this.callbackServer = undefined;
|
|
17
|
+
this.socketEndpoint = undefined;
|
|
18
|
+
this.sessionTimeout = undefined;
|
|
19
|
+
this.wsOnOpen = undefined;
|
|
20
|
+
this.wsOnMessage = undefined;
|
|
21
|
+
this.autostart = true;
|
|
22
|
+
this.autorefresh = false;
|
|
23
|
+
this.v = '3';
|
|
24
|
+
this.qrModalTitle = 'Quick Access';
|
|
25
|
+
this.qrModalDescription = 'Sign up or sign in by scanning the QR Code with the Gataca Wallet';
|
|
26
|
+
this.hideBrandTitle = false;
|
|
27
|
+
this.dynamicLink = true;
|
|
28
|
+
this.open = false;
|
|
29
|
+
this.qr = (h("gataca-qrws", { wsOnMessage: this.wsOnMessage, wsOnOpen: this.wsOnOpen, successCallback: this.successCallback, errorCallback: this.errorCallback, qrRole: this.qrRole, qrType: this.qrType, callbackServer: this.callbackServer, sessionTimeout: this.sessionTimeout, socketEndpoint: this.socketEndpoint, autostart: true, autorefresh: this.autorefresh, v: this.v, qrModalTitle: this.qrModalTitle, qrModalDescription: this.qrModalDescription, hideBrandTitle: this.hideBrandTitle, dynamicLink: this.dynamicLink }));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Retrieve manually the session data on a successful login
|
|
33
|
+
*/
|
|
34
|
+
async getSessionData() {
|
|
35
|
+
return this.qr.getSessionData();
|
|
36
|
+
}
|
|
37
|
+
renderModal() {
|
|
38
|
+
return this.qr;
|
|
39
|
+
}
|
|
40
|
+
renderButton() {
|
|
41
|
+
return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
|
|
42
|
+
this.open = !this.open;
|
|
43
|
+
if (this.open) {
|
|
44
|
+
this.qr.display();
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.qr.stop();
|
|
48
|
+
}
|
|
49
|
+
} }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
|
|
50
|
+
}
|
|
51
|
+
render() {
|
|
52
|
+
return (h("div", { class: "buttonContainer" }, this.renderButton(), this.open && this.renderModal()));
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
GatacaSSIButtonWS.style = gatacaSsibuttonwsCss;
|
|
56
|
+
|
|
57
|
+
export { GatacaSSIButtonWS as gataca_ssibuttonws };
|