@gataca/qr 3.0.10 → 4.0.0

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.
Files changed (83) hide show
  1. package/dist/{esm/qr-code-styling-0eeb38d5.js → cjs/gat-icon-check-c88a30ed.js} +15 -1
  2. package/dist/cjs/gataca-autoqr.cjs.entry.js +9 -9
  3. package/dist/cjs/gataca-qr_3.cjs.entry.js +620 -0
  4. package/dist/cjs/gataca-qrws.cjs.entry.js +39 -47
  5. package/dist/cjs/gataca-ssibuttonws.cjs.entry.js +61 -0
  6. package/dist/cjs/gatacaqr.cjs.js +1 -1
  7. package/dist/cjs/index.cjs.js +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/{utils-ef28b844.js → utils-b4e62bc0.js} +1 -1
  10. package/dist/collection/components/gataca-autoqr/gataca-autoqr.js +13 -13
  11. package/dist/collection/components/gataca-qr/components/qr/QR.js +3 -3
  12. package/dist/collection/components/gataca-qr/components/readQR/ReadQR.js +7 -5
  13. package/dist/collection/components/gataca-qr/components/readQR/components/AnimatedLoader.js +1 -1
  14. package/dist/collection/components/gataca-qr/components/retryButton/RetryButton.js +8 -8
  15. package/dist/collection/components/gataca-qr/components/success/Success.js +4 -4
  16. package/dist/collection/components/gataca-qr/gataca-qr.js +64 -55
  17. package/dist/collection/components/gataca-qrdisplay/gataca-qrdisplay.js +33 -11
  18. package/dist/collection/components/gataca-qrws/components/qr/QR.js +2 -2
  19. package/dist/collection/components/gataca-qrws/components/readQR/ReadQR.js +4 -4
  20. package/dist/collection/components/gataca-qrws/components/readQR/components/AnimatedLoader.js +1 -1
  21. package/dist/collection/components/gataca-qrws/components/retryButton/RetryButton.js +8 -8
  22. package/dist/collection/components/gataca-qrws/components/success/Success.js +4 -4
  23. package/dist/collection/components/gataca-qrws/gataca-qrws.js +49 -56
  24. package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.js +224 -54
  25. package/dist/collection/components/gataca-ssibuttonws/gataca-ssibuttonws.js +12 -12
  26. package/dist/collection/index.js +2 -2
  27. package/dist/collection/utils/index.js +1 -1
  28. package/dist/collection/utils/utils.js +1 -1
  29. package/dist/components/{gat-icon-alert.js → gat-icon-check.js} +4 -4
  30. package/dist/components/gataca-autoqr.js +9 -9
  31. package/dist/components/gataca-qr2.js +56 -63
  32. package/dist/components/gataca-qrdisplay2.js +11 -6
  33. package/dist/components/gataca-qrws2.js +35 -42
  34. package/dist/components/gataca-ssibutton2.js +114 -34
  35. package/dist/components/gataca-ssibuttonws2.js +6 -6
  36. package/dist/components/index.js +1 -1
  37. package/dist/{cjs/qr-code-styling-412bbc7a.js → esm/gat-icon-check-c188cd29.js} +8 -2
  38. package/dist/esm/gataca-autoqr.entry.js +9 -9
  39. package/dist/esm/gataca-qr_3.entry.js +614 -0
  40. package/dist/esm/gataca-qrws.entry.js +36 -44
  41. package/dist/esm/gataca-ssibuttonws.entry.js +57 -0
  42. package/dist/esm/gatacaqr.js +1 -1
  43. package/dist/esm/index.js +1 -1
  44. package/dist/esm/loader.js +1 -1
  45. package/dist/esm/{utils-63e7a33b.js → utils-21ffcc1e.js} +1 -1
  46. package/dist/gatacaqr/gatacaqr.esm.js +1 -1
  47. package/dist/gatacaqr/index.esm.js +1 -1
  48. package/dist/gatacaqr/p-5be73956.js +1 -0
  49. package/dist/gatacaqr/p-948e7d94.entry.js +1 -0
  50. package/dist/gatacaqr/p-e94e9be8.entry.js +1 -0
  51. package/dist/gatacaqr/p-fb41fad9.entry.js +1 -0
  52. package/dist/types/components/gataca-autoqr/gataca-autoqr.d.ts +7 -7
  53. package/dist/types/components/gataca-qr/components/qr/QR.d.ts +4 -2
  54. package/dist/types/components/gataca-qr/components/readQR/ReadQR.d.ts +3 -1
  55. package/dist/types/components/gataca-qr/components/readQR/components/AnimatedLoader.d.ts +1 -1
  56. package/dist/types/components/gataca-qr/components/retryButton/RetryButton.d.ts +1 -1
  57. package/dist/types/components/gataca-qr/components/success/Success.d.ts +1 -1
  58. package/dist/types/components/gataca-qr/gataca-qr.d.ts +13 -4
  59. package/dist/types/components/gataca-qrdisplay/gataca-qrdisplay.d.ts +6 -1
  60. package/dist/types/components/gataca-qrws/components/qr/QR.d.ts +2 -2
  61. package/dist/types/components/gataca-qrws/components/readQR/ReadQR.d.ts +1 -1
  62. package/dist/types/components/gataca-qrws/components/readQR/components/AnimatedLoader.d.ts +1 -1
  63. package/dist/types/components/gataca-qrws/components/retryButton/RetryButton.d.ts +1 -1
  64. package/dist/types/components/gataca-qrws/components/success/Success.d.ts +1 -1
  65. package/dist/types/components/gataca-qrws/gataca-qrws.d.ts +4 -4
  66. package/dist/types/components/gataca-ssibutton/gataca-ssibutton.d.ts +38 -5
  67. package/dist/types/components/gataca-ssibuttonws/gataca-ssibuttonws.d.ts +3 -3
  68. package/dist/types/components.d.ts +78 -36
  69. package/dist/types/index.d.ts +2 -2
  70. package/dist/types/utils/index.d.ts +1 -1
  71. package/package.json +30 -7
  72. package/dist/cjs/gat-icon-alert-0ad19b26.js +0 -14
  73. package/dist/cjs/gataca-qr_2.cjs.entry.js +0 -295
  74. package/dist/cjs/gataca-ssibutton_2.cjs.entry.js +0 -317
  75. package/dist/esm/gat-icon-alert-7b06ef3a.js +0 -9
  76. package/dist/esm/gataca-qr_2.entry.js +0 -290
  77. package/dist/esm/gataca-ssibutton_2.entry.js +0 -312
  78. package/dist/gatacaqr/p-0be4566d.js +0 -1
  79. package/dist/gatacaqr/p-3500ae66.entry.js +0 -1
  80. package/dist/gatacaqr/p-68272823.entry.js +0 -1
  81. package/dist/gatacaqr/p-92a2e6f0.entry.js +0 -1
  82. package/dist/gatacaqr/p-ea783014.js +0 -1
  83. /package/dist/gatacaqr/{p-2cd7b062.js → p-bce7e590.js} +0 -0
@@ -1,290 +0,0 @@
1
- import { r as registerInstance, h, c as createEvent } from './index-2be54f32.js';
2
- import { l as logoGatacaSvg, g as gatIconCheckSvg, a as gatIconRefreshSvg, b as gatIconAlertSvg } from './gat-icon-alert-7b06ef3a.js';
3
- import { Q as QRCodeStyling } from './qr-code-styling-0eeb38d5.js';
4
- import { R as RESULT_STATUS, c as checkMobile, b as base64UrlEncode } from './utils-63e7a33b.js';
5
-
6
- const GatacaQRDisplay = class {
7
- constructor(hostRef) {
8
- registerInstance(this, hostRef);
9
- this.qrData = undefined;
10
- this.qrType = "svg";
11
- this.size = 256;
12
- this.logoSize = 0;
13
- this.logoSrc = undefined;
14
- this.qrColor = "#1E1E20";
15
- this.rounded = true;
16
- }
17
- componentDidLoad() {
18
- const qrCode = new QRCodeStyling({
19
- data: this.qrData,
20
- width: this.size,
21
- height: this.size,
22
- image: this.logoSize > 0 ? this.logoSrc || logoGatacaSvg : undefined,
23
- margin: 10,
24
- type: this.qrType,
25
- dotsOptions: {
26
- color: this.qrColor,
27
- type: this.rounded ? "dots" : "square",
28
- },
29
- cornersSquareOptions: {
30
- type: this.rounded ? "extra-rounded" : "square",
31
- },
32
- cornersDotOptions: {
33
- type: this.rounded ? "dot" : "square",
34
- },
35
- imageOptions: {
36
- margin: 2,
37
- imageSize: this.logoSize,
38
- },
39
- });
40
- qrCode.append(this.qr);
41
- }
42
- render() {
43
- return (h("div", { ref: (el) => {
44
- this.qr = el;
45
- } }));
46
- }
47
- };
48
-
49
- const Success = (props) => {
50
- const { modalHeight, successLoginLabel } = props;
51
- return (h("div", { class: "success", style: {
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))));
77
- };
78
-
79
- const AnimatedLoader = () => {
80
- return (h("div", { class: "containerLoader" },
81
- h("div", { class: "loader" },
82
- h("div", { class: "loader__item loader__item__1" }),
83
- h("div", { class: "loader__item loader__item__2" }),
84
- h("div", { class: "loader__item loader__item__3" }),
85
- h("div", { class: "loader__item loader__item__4" }),
86
- h("div", { class: "loader__item loader__item__5" }),
87
- h("div", { class: "loader__item loader__item__6" }),
88
- h("div", { class: "loader__item loader__item__7" }),
89
- h("div", { class: "loader__item loader__item__8" }))));
90
- };
91
-
92
- const ReadQR = (props) => {
93
- var _a;
94
- const { modalWidth, readQrMessages, renderQR, url, sizeQR } = props;
95
- return (h("div", { class: "blured", style: {
96
- width: (modalWidth - 48).toString() + "px",
97
- height: modalWidth ? ((_a = (modalWidth - 48)) === null || _a === void 0 ? void 0 : _a.toString()) + "px" : "",
98
- } },
99
- h("div", { id: "notify" },
100
- h(AnimatedLoader, null),
101
- h("p", { class: "notify-text" }, readQrMessages === null || readQrMessages === void 0 ? void 0 :
102
- readQrMessages.title,
103
- " "),
104
- h("p", { class: "notify-text bold" }, readQrMessages === null || readQrMessages === void 0 ? void 0 : readQrMessages.description)),
105
- h("div", { id: "qrwait" }, renderQR(url, false, sizeQR))));
106
- };
107
-
108
- const QR = (props) => {
109
- const { value, useLogo, logoSrc, size, qrType } = props;
110
- return (h("gataca-qrdisplay", { qrData: value, rounded: true, qrType: qrType, size: size, "logo-size": useLogo ? 0.33 : 0, "logo-src": logoSrc }));
111
- };
112
-
113
- 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: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}#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
-
115
- const DEEP_LINK_PREFIX = "https://api.gataca.io/qr/redirect.html";
116
- //Default values
117
- const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
118
- const DEFAULT_POLLING_FREQ = 3;
119
- 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; }
121
- disconnectedCallback() {
122
- this.stop();
123
- }
124
- async componentDidLoad() {
125
- if (this.autostart) {
126
- await this.display();
127
- }
128
- }
129
- /**
130
- * Force manually the display of a QR
131
- */
132
- async display() {
133
- await this.getSessionId();
134
- this.result = RESULT_STATUS.ONGOING;
135
- this.poll()
136
- .then((data) => {
137
- this.result = RESULT_STATUS.SUCCESS;
138
- this.sessionData = data;
139
- this.gatacaLoginCompleted.emit(data);
140
- this.successCallback(data);
141
- })
142
- .catch((err) => {
143
- this.clean();
144
- let expired = err === RESULT_STATUS.EXPIRED;
145
- if (expired && this.autorefresh) {
146
- this.display();
147
- }
148
- else {
149
- if (err !== RESULT_STATUS.NOT_STARTED) {
150
- let error = expired
151
- ? new Error(this.userNotScanInTimeErrorLabel)
152
- : new Error(this.credsNotValidatedErrorLabel);
153
- this.result = err;
154
- this.gatacaLoginFailed.emit(error);
155
- this.errorCallback(error);
156
- }
157
- }
158
- });
159
- if (checkMobile() && this.dynamicLink) {
160
- window.location.href = this.getLink();
161
- }
162
- }
163
- /**
164
- * Stop manually an ongoing session
165
- */
166
- async stop() {
167
- this.clean();
168
- if (this.result === RESULT_STATUS.ONGOING || RESULT_STATUS.READ) {
169
- this.result = RESULT_STATUS.NOT_STARTED;
170
- }
171
- }
172
- clean() {
173
- this.sessionData = undefined;
174
- this.sessionId = undefined;
175
- }
176
- /**
177
- * Retrieve manually the session data on a successful login
178
- */
179
- async getSessionData() {
180
- return this.sessionData
181
- ? Promise.resolve(this.sessionData)
182
- : Promise.reject(new Error(this.failedLoginErrorLabel));
183
- }
184
- async getSessionId() {
185
- if (this.sessionId) {
186
- return this.sessionId;
187
- }
188
- let { sessionId, authenticationRequest } = await this.createSession();
189
- this.sessionId = sessionId;
190
- this.authenticationRequest = authenticationRequest;
191
- return this.sessionId;
192
- }
193
- getLink() {
194
- if (this.v === "2") {
195
- return this.authenticationRequest;
196
- }
197
- const authRequestEncoded = "?dl=" + base64UrlEncode(this.authenticationRequest);
198
- return DEEP_LINK_PREFIX + authRequestEncoded;
199
- }
200
- async poll() {
201
- let endTime = new Date().getTime() +
202
- (this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
203
- let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
204
- let checkFunc = async (component) => {
205
- if (component.result === RESULT_STATUS.NOT_STARTED) {
206
- return { result: RESULT_STATUS.NOT_STARTED };
207
- }
208
- let id = await component.getSessionId();
209
- return component.checkStatus(id);
210
- };
211
- let component = this;
212
- let checkCondition = async function (resolve, reject) {
213
- // If the condition is met, we're done!
214
- let { result, data } = await checkFunc(component);
215
- switch (result) {
216
- case RESULT_STATUS.SUCCESS:
217
- resolve(data);
218
- break;
219
- case RESULT_STATUS.READ:
220
- component.result = RESULT_STATUS.READ;
221
- case RESULT_STATUS.ONGOING:
222
- if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
223
- setTimeout(checkCondition, interval, resolve, reject);
224
- }
225
- else {
226
- reject(RESULT_STATUS.EXPIRED);
227
- }
228
- break;
229
- default:
230
- reject(result);
231
- break;
232
- }
233
- };
234
- return new Promise(checkCondition);
235
- }
236
- renderQRSection() {
237
- switch (this.result) {
238
- case RESULT_STATUS.NOT_STARTED:
239
- return this.renderRetryButton();
240
- case RESULT_STATUS.ONGOING:
241
- return this.renderQR(this.getLink(), true);
242
- case RESULT_STATUS.EXPIRED:
243
- return this.renderRetryButton(this.qrCodeExpiredLabel);
244
- case RESULT_STATUS.FAILED:
245
- return this.renderRetryButton(this.credentialsNotValidatedLabel);
246
- case RESULT_STATUS.SUCCESS:
247
- return this.renderSuccess();
248
- case RESULT_STATUS.READ:
249
- return this.renderReadQR({
250
- title: this === null || this === void 0 ? void 0 : this.readQrTitle,
251
- description: this === null || this === void 0 ? void 0 : this.readQrDescription,
252
- });
253
- }
254
- }
255
- renderSuccess() {
256
- return (h(Success, { modalHeight: this === null || this === void 0 ? void 0 : this.modalHeight, successLoginLabel: this === null || this === void 0 ? void 0 : this.successLoginLabel }));
257
- }
258
- renderRetryButton(errorMessage) {
259
- return (h(RetryButton, { errorMessage: errorMessage, modalWidth: this === null || this === void 0 ? void 0 : this.modalWidth, clickInsideBoxLabel: this === null || this === void 0 ? void 0 : this.clickInsideBoxLabel, refreshQrLabel: this === null || this === void 0 ? void 0 : this.refreshQrLabel, scanQrLabel: this === null || this === void 0 ? void 0 : this.scanQrLabel, waitingStartSessionLabel: this === null || this === void 0 ? void 0 : this.waitingStartSessionLabel, display: this.display.bind(this), renderRetryQR: this.renderRetryQR.bind(this) }));
260
- }
261
- renderReadQR(readQrMessages) {
262
- 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) }));
263
- }
264
- renderQR(value, useLogo, sizeQR) {
265
- 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 }));
266
- }
267
- renderRetryQR(value, useLogo) {
268
- 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 }));
269
- }
270
- render() {
271
- var _a, _b;
272
- return (h("div", { class: "popUpContainer" }, h("div", { class: `is-visible modal-window ${this.hideModalTexts ? "" : "large-modal"} ${this.hideModalBoxShadow ? "noBoxShadow" : ""}`, style: {
273
- width: (this.modalWidth - 2).toString() + "px",
274
- height: this.modalHeight
275
- ? ((_a = (this.modalHeight - 2)) === null || _a === void 0 ? void 0 : _a.toString()) + "px"
276
- : "",
277
- }, onClick: (event) => {
278
- event.stopPropagation();
279
- } }, 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 &&
280
- !this.hideQrModalDescription && (h("p", { class: "qrDescription modalText" }, this.qrModalDescription))), h("div", { class: "qrSection", style: {
281
- width: this.modalWidth.toString() + "px",
282
- height: this.modalWidth
283
- ? ((_b = this.modalWidth) === null || _b === void 0 ? void 0 : _b.toString()) + "px"
284
- : "",
285
- } }, this.renderQRSection())))));
286
- }
287
- };
288
- GatacaQR.style = gatacaQrCss;
289
-
290
- export { GatacaQR as gataca_qr, GatacaQRDisplay as gataca_qrdisplay };
@@ -1,312 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-2be54f32.js';
2
- import './qr-code-styling-0eeb38d5.js';
3
- import { R as RESULT_STATUS } from './utils-63e7a33b.js';
4
-
5
- const gatacaSsibuttonCss = "@import url(\"https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap\"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:\"\";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.buttonContainer{display:inline-block;text-align:right;padding:10px;position:relative}.gatacaButtonWrapper{margin:8px}.gatacaButtonWrapper .gatacaButton{display:flex;min-width:100px;padding:8px 8px;background-color:white;font-size:12px;font-family:\"Work Sans\", sans-serif;letter-spacing:1px;font-weight:2;justify-content:space-between;align-items:center;border-radius:6px;border:1px solid rgba(24, 27, 94, 0.5);color:rgba(24, 27, 94, 0.8);box-shadow:0px 1px 3px rgba(48, 48, 48, 0.15);cursor:pointer}.gatacaButtonWrapper .gatacaButton>span{margin-right:10px}.gatacaButtonWrapper .gatacaButton:hover{box-shadow:0px 2px 8px rgba(48, 48, 48, 0.1)}.gatacaButtonWrapper .buttonText{text-align:right;font-size:8px;color:rgba(24, 27, 94, 0.5);font-family:\"Helvetica Neue\", sans-serif;letter-spacing:1px;padding-right:8px;font-weight:1}.gatacaButtonWrapper .buttonImg{height:25px;width:25px;margin:0;margin-right:20px}";
6
-
7
- const PHONE_ICON$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAYAAACN1PRVAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHvSURBVHgB3ZZPTttAFMbfe3YjL7qYLopcpZXSG7Q3CDfIsqrSJpyg5QQtJ2h7glgUdVs4AeEE5AYEQSDAgtnw357Hm0hAQDaeIRFCfFKyeKPxzzPzvc+DUKCZN80GEv1ABgWOQgSdGbOwv7u0nDueV4zjTzUIKhuAZna4vdQFR828azbI0K/TI/qodaLvjlP+tLDGDCs+IKv9Lbsi7kcv0w9541Q0EREPYcoieEQ9KiyECRXHzbpBUOcnYTfPFOOaaGVx9WsLiDrSIp0iU0wFNgIx/AQyc9I/OmOjy+Y8aBvHQcDUYebewc6/Xtk8J5htcg5efEPGhk0JtqkyBjo7DuZcnuO2sqCyKv8rUDmfTS9IBURqBAL+I6CkzBjOMOs22TLY21n8fl17KzXR3uDvb/CQk0GEdfvN07QvpnAOaGfYaRT25JzU6+rnG2tTpcWAy+Cp0m3U/URLms8HWfg/rn6RFaGSs9KQkZMpvGBWNs2Vandt46ac6YNBuc0fDLMaOU5DFybQ8039p/KJ4bq4rwPewtqoM/1gsCm/NfBXvWjgHhhuDAeLyd3qVSifHQULeZkou9EqemLhmUmav8qrZ4GEMGA7ivzjKvfeqGptFV2YdWPMPHHq0cCh3DdpVdLl/XCY9J1gVvbCiWa6N+JLocPFjCsx9cAAAAAASUVORK5CYII=";
8
- //Default values
9
- const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
10
- const DEFAULT_POLLING_FREQ = 3;
11
- const GatacaSSIButton = class {
12
- constructor(hostRef) {
13
- registerInstance(this, hostRef);
14
- this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
15
- this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
16
- this.buttonText = "Easy login";
17
- this.qrType = "svg";
18
- this.autostart = true;
19
- this.checkStatus = undefined;
20
- this.createSession = undefined;
21
- this.successCallback = undefined;
22
- this.errorCallback = undefined;
23
- this.handleCheckAppLoading = undefined;
24
- this.checkAppTimeout = 6;
25
- this.qrRole = undefined;
26
- this.callbackServer = undefined;
27
- this.sessionTimeout = undefined;
28
- this.pollingFrequency = undefined;
29
- this.autorefresh = false;
30
- this.v = "3";
31
- this.qrModalTitle = "Quick Access";
32
- this.modalTitleColor = "#4745B7";
33
- this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
34
- this.hideBrandTitle = false;
35
- this.dynamicLink = true;
36
- this.logoSize = 0;
37
- this.logoSrc = undefined;
38
- this.qrCodeExpiredLabel = "QR Code expired";
39
- this.credentialsNotValidatedLabel = "User credentials not validated";
40
- this.clickInsideBoxLabel = "Click inside the box to";
41
- this.refreshQrLabel = "Refresh QR Code";
42
- this.scanQrLabel = "Scan QR Code";
43
- this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time";
44
- this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated";
45
- this.failedLoginErrorLabel = "No successful login";
46
- this.successLoginLabel = "Successful Connection!";
47
- this.byBrandLabel = "by Gataca";
48
- this.waitingStartSessionLabel = "waiting to start a session";
49
- this.hideQrModalDescription = false;
50
- this.open = false;
51
- this.sessionId = undefined;
52
- this.authenticationRequest = undefined;
53
- this.sessionData = undefined;
54
- this.result = RESULT_STATUS.NOT_STARTED;
55
- this.qr = (h("gataca-qr", { ref: (el) => (this.qrElement = el), checkStatus: this.checkStatus, createSession: this.createSession, successCallback: this.successCallback, errorCallback: this.errorCallback, qrRole: this.qrRole, qrType: this.qrType, callbackServer: this.callbackServer, sessionTimeout: this.sessionTimeout, pollingFrequency: this.pollingFrequency, autostart: this.autostart, autorefresh: this.autorefresh, v: this.v, qrModalTitle: this.qrModalTitle, qrModalDescription: this.qrModalDescription, hideBrandTitle: this.hideBrandTitle, dynamicLink: this.dynamicLink, logoSize: this.logoSize, logoSrc: this.logoSrc, modalTitleColor: this.modalTitleColor, qrCodeExpiredLabel: this.qrCodeExpiredLabel, credentialsNotValidatedLabel: this.credentialsNotValidatedLabel, clickInsideBoxLabel: this.clickInsideBoxLabel, refreshQrLabel: this.refreshQrLabel, scanQrLabel: this.scanQrLabel, userNotScanInTimeErrorLabel: this.userNotScanInTimeErrorLabel, credsNotValidatedErrorLabel: this.credsNotValidatedErrorLabel, failedLoginErrorLabel: this.failedLoginErrorLabel, successLoginLabel: this.successLoginLabel, byBrandLabel: this.byBrandLabel, waitingStartSessionLabel: this.waitingStartSessionLabel, hideQrModalDescription: this.hideQrModalDescription }));
56
- }
57
- /**
58
- * Retrieve manually the session data on a successful login
59
- */
60
- async getSessionData() {
61
- return this.qr.getSessionData();
62
- }
63
- async getSessionId() {
64
- if (this.sessionId) {
65
- return this.sessionId;
66
- }
67
- let { sessionId, authenticationRequest } = await this.createSession();
68
- this.sessionId = sessionId;
69
- this.authenticationRequest = authenticationRequest;
70
- return this.sessionId;
71
- }
72
- /**
73
- * Force manually the start polling
74
- */
75
- async startMobilePolling() {
76
- await this.getSessionId();
77
- this.result = RESULT_STATUS.ONGOING;
78
- this.poll()
79
- .then((data) => {
80
- this.result = RESULT_STATUS.SUCCESS;
81
- this.sessionData = data;
82
- this.gatacaLoginCompleted.emit(data);
83
- this.successCallback(data);
84
- })
85
- .catch((err) => {
86
- this.clean();
87
- let expired = err === RESULT_STATUS.EXPIRED;
88
- if (expired && this.autorefresh) {
89
- this.startMobilePolling();
90
- }
91
- else {
92
- if (err !== RESULT_STATUS.NOT_STARTED) {
93
- let error = expired
94
- ? new Error(this.userNotScanInTimeErrorLabel)
95
- : new Error(this.credsNotValidatedErrorLabel);
96
- this.result = err;
97
- this.gatacaLoginFailed.emit(error);
98
- this.errorCallback(error);
99
- }
100
- }
101
- });
102
- }
103
- /**
104
- * Stop manually an ongoing session
105
- */
106
- async stop() {
107
- this.clean();
108
- if (this.result === RESULT_STATUS.ONGOING || RESULT_STATUS.READ) {
109
- this.result = RESULT_STATUS.NOT_STARTED;
110
- }
111
- }
112
- clean() {
113
- this.sessionData = undefined;
114
- this.sessionId = undefined;
115
- }
116
- renderModal() {
117
- return this.qr;
118
- }
119
- async poll() {
120
- let endTime = new Date().getTime() +
121
- (this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
122
- let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
123
- let checkFunc = async (component) => {
124
- if (component.result === RESULT_STATUS.NOT_STARTED) {
125
- return { result: RESULT_STATUS.NOT_STARTED };
126
- }
127
- let id = await component.getSessionId();
128
- return component.checkStatus(id);
129
- };
130
- let component = this;
131
- let checkCondition = async function (resolve, reject) {
132
- // If the condition is met, we're done!
133
- let { result, data } = await checkFunc(component);
134
- switch (result) {
135
- case RESULT_STATUS.SUCCESS:
136
- resolve(data);
137
- break;
138
- case RESULT_STATUS.READ:
139
- component.result = RESULT_STATUS.READ;
140
- case RESULT_STATUS.ONGOING:
141
- if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
142
- setTimeout(checkCondition, interval, resolve, reject);
143
- }
144
- else {
145
- reject(RESULT_STATUS.EXPIRED);
146
- }
147
- break;
148
- default:
149
- reject(result);
150
- break;
151
- }
152
- };
153
- return new Promise(checkCondition);
154
- }
155
- isAppInstalled(appScheme, callback) {
156
- let timeout;
157
- let detected = false;
158
- if (appScheme === null || appScheme === void 0 ? void 0 : appScheme.length) {
159
- window.location.href = appScheme;
160
- }
161
- const waitTimeToCheckApp = this.checkAppTimeout * 1000;
162
- timeout = setTimeout(() => {
163
- if (!detected) {
164
- callback(false);
165
- }
166
- cleanup();
167
- }, waitTimeToCheckApp);
168
- const handleVisibilityChange = () => {
169
- if (document.hidden) {
170
- detected = true;
171
- callback(true);
172
- if (!this.autostart) {
173
- this.startMobilePolling();
174
- }
175
- cleanup();
176
- }
177
- };
178
- document.addEventListener("visibilitychange", handleVisibilityChange);
179
- function cleanup() {
180
- clearTimeout(timeout);
181
- document.removeEventListener("visibilitychange", handleVisibilityChange);
182
- }
183
- }
184
- renderDesktopButton() {
185
- return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
186
- this.open = !this.open;
187
- setTimeout(() => {
188
- var _a, _b;
189
- if (this.open) {
190
- (_a = this.qrElement) === null || _a === void 0 ? void 0 : _a.display();
191
- }
192
- else {
193
- (_b = this.qrElement) === null || _b === void 0 ? void 0 : _b.stop();
194
- }
195
- }, 0);
196
- } }, h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
197
- }
198
- async getAuthRequest() {
199
- let { authenticationRequest } = await this.createSession();
200
- return authenticationRequest;
201
- }
202
- renderMobileButton(isAndroid, isIos) {
203
- if (this.autostart) {
204
- this.startMobilePolling();
205
- }
206
- let loading = false;
207
- const handleLoading = (isLoading) => {
208
- loading = isLoading;
209
- if (this.handleCheckAppLoading) {
210
- this.handleCheckAppLoading(isLoading);
211
- }
212
- };
213
- const executeRedirection = async () => {
214
- handleLoading(true);
215
- const androidStoreLink = "https://play.google.com/store/apps/details?id=com.gataca.identity";
216
- const iosStoreLink = "https://apps.apple.com/us/app/gataca/id1498607616";
217
- try {
218
- const appScheme = await this.getAuthRequest();
219
- this.isAppInstalled(appScheme, (installed) => {
220
- if (!installed) {
221
- this.stop();
222
- if (isAndroid) {
223
- window.location.href = androidStoreLink;
224
- }
225
- else if (isIos) {
226
- window.location.href = iosStoreLink;
227
- }
228
- }
229
- handleLoading(false);
230
- });
231
- }
232
- catch (error) {
233
- this.stop();
234
- handleLoading(false);
235
- }
236
- };
237
- return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
238
- executeRedirection();
239
- }, disabled: loading }, h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
240
- }
241
- render() {
242
- const userAgent =
243
- // @ts-ignore
244
- (navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) || (navigator === null || navigator === void 0 ? void 0 : navigator.vendor) || (window === null || window === void 0 ? void 0 : window.opera);
245
- const isAndroid = /android/i.test(userAgent);
246
- const isIos =
247
- // @ts-ignore
248
- (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) ||
249
- (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
250
- const isMobile = isAndroid || isIos;
251
- return (h("div", { class: "buttonContainer" }, isMobile && this.v === "3"
252
- ? this.renderMobileButton(isAndroid, isIos)
253
- : this.renderDesktopButton(), this.open && (!isMobile || this.v === "3") && this.renderModal()));
254
- }
255
- };
256
- GatacaSSIButton.style = gatacaSsibuttonCss;
257
-
258
- const gatacaSsibuttonwsCss = "@import url(\"https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap\"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:\"\";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.buttonContainer{display:inline-block;text-align:right;padding:10px;position:relative}.gatacaButtonWrapper{margin:8px}.gatacaButtonWrapper .gatacaButton{display:flex;min-width:100px;padding:8px 8px;background-color:white;font-size:12px;font-family:\"Work Sans\", sans-serif;letter-spacing:1px;font-weight:2;justify-content:space-between;align-items:center;border-radius:6px;border:1px solid rgba(24, 27, 94, 0.5);color:rgba(24, 27, 94, 0.8);box-shadow:0px 1px 3px rgba(48, 48, 48, 0.15);cursor:pointer}.gatacaButtonWrapper .gatacaButton>span{margin-right:10px}.gatacaButtonWrapper .gatacaButton:hover{box-shadow:0px 2px 8px rgba(48, 48, 48, 0.1)}.gatacaButtonWrapper .buttonText{text-align:right;font-size:8px;color:rgba(24, 27, 94, 0.5);font-family:\"Helvetica Neue\", sans-serif;letter-spacing:1px;padding-right:8px;font-weight:1}.gatacaButtonWrapper .buttonImg{height:25px;width:25px;margin:0;margin-right:20px}";
259
-
260
- const PHONE_ICON = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAYAAACN1PRVAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHvSURBVHgB3ZZPTttAFMbfe3YjL7qYLopcpZXSG7Q3CDfIsqrSJpyg5QQtJ2h7glgUdVs4AeEE5AYEQSDAgtnw357Hm0hAQDaeIRFCfFKyeKPxzzPzvc+DUKCZN80GEv1ABgWOQgSdGbOwv7u0nDueV4zjTzUIKhuAZna4vdQFR828azbI0K/TI/qodaLvjlP+tLDGDCs+IKv9Lbsi7kcv0w9541Q0EREPYcoieEQ9KiyECRXHzbpBUOcnYTfPFOOaaGVx9WsLiDrSIp0iU0wFNgIx/AQyc9I/OmOjy+Y8aBvHQcDUYebewc6/Xtk8J5htcg5efEPGhk0JtqkyBjo7DuZcnuO2sqCyKv8rUDmfTS9IBURqBAL+I6CkzBjOMOs22TLY21n8fl17KzXR3uDvb/CQk0GEdfvN07QvpnAOaGfYaRT25JzU6+rnG2tTpcWAy+Cp0m3U/URLms8HWfg/rn6RFaGSs9KQkZMpvGBWNs2Vandt46ac6YNBuc0fDLMaOU5DFybQ8039p/KJ4bq4rwPewtqoM/1gsCm/NfBXvWjgHhhuDAeLyd3qVSifHQULeZkou9EqemLhmUmav8qrZ4GEMGA7ivzjKvfeqGptFV2YdWPMPHHq0cCh3DdpVdLl/XCY9J1gVvbCiWa6N+JLocPFjCsx9cAAAAAASUVORK5CYII=";
261
- const GatacaSSIButtonWS = class {
262
- constructor(hostRef) {
263
- registerInstance(this, hostRef);
264
- this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
265
- this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
266
- this.buttonText = "Easy login";
267
- this.successCallback = undefined;
268
- this.errorCallback = undefined;
269
- this.qrType = "svg";
270
- this.qrRole = undefined;
271
- this.callbackServer = undefined;
272
- this.socketEndpoint = undefined;
273
- this.sessionTimeout = undefined;
274
- this.wsOnOpen = undefined;
275
- this.wsOnMessage = undefined;
276
- this.autostart = true;
277
- this.autorefresh = false;
278
- this.v = "3";
279
- this.qrModalTitle = "Quick Access";
280
- this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
281
- this.hideBrandTitle = false;
282
- this.dynamicLink = true;
283
- this.open = false;
284
- this.qr = (h("gataca-qrws", { wsOnMessage: this.wsOnMessage, wsOnOpen: this.wsOnOpen, successCallback: this.successCallback, errorCallback: this.errorCallback, qrRole: this.qrRole, qrType: this.qrType, callbackServer: this.callbackServer, sessionTimeout: this.sessionTimeout, socketEndpoint: this.socketEndpoint, autostart: true, autorefresh: this.autorefresh, v: this.v, qrModalTitle: this.qrModalTitle, qrModalDescription: this.qrModalDescription, hideBrandTitle: this.hideBrandTitle, dynamicLink: this.dynamicLink }));
285
- }
286
- /**
287
- * Retrieve manually the session data on a successful login
288
- */
289
- async getSessionData() {
290
- return this.qr.getSessionData();
291
- }
292
- renderModal() {
293
- return this.qr;
294
- }
295
- renderButton() {
296
- return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
297
- this.open = !this.open;
298
- if (this.open) {
299
- this.qr.display();
300
- }
301
- else {
302
- this.qr.stop();
303
- }
304
- } }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
305
- }
306
- render() {
307
- return (h("div", { class: "buttonContainer" }, this.renderButton(), this.open && this.renderModal()));
308
- }
309
- };
310
- GatacaSSIButtonWS.style = gatacaSsibuttonwsCss;
311
-
312
- export { GatacaSSIButton as gataca_ssibutton, GatacaSSIButtonWS as gataca_ssibuttonws };