@gataca/qr 0.0.19 → 0.0.21

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 (95) hide show
  1. package/dist/gatacaqr/app-globals-0f993ce5.js +3 -0
  2. package/dist/gatacaqr/css-shim-8eec97b3.js +4 -0
  3. package/dist/gatacaqr/dom-1b0cf05d.js +73 -0
  4. package/dist/{esm/gat-icon-alert-7b06ef3a.js → gatacaqr/gat-icon-alert-13a1894e.js} +1 -3
  5. package/dist/{esm → gatacaqr}/gataca-autoqr.entry.js +1 -1
  6. package/dist/{esm/gataca-qr_2.entry.js → gatacaqr/gataca-qr.entry.js} +17 -81
  7. package/dist/gatacaqr/gataca-qrdisplay-55780157.js +97 -0
  8. package/dist/gatacaqr/gataca-qrdisplay.entry.js +2 -0
  9. package/dist/{esm → gatacaqr}/gataca-qrws.entry.js +3 -3
  10. package/dist/{components/gataca-ssibutton2.js → gatacaqr/gataca-ssibutton.entry.js} +10 -84
  11. package/dist/{components/gataca-ssibuttonws2.js → gatacaqr/gataca-ssibuttonws.entry.js} +7 -53
  12. package/dist/gatacaqr/gatacaqr.esm.js +129 -1
  13. package/dist/gatacaqr/index-4bc6f36b.js +3262 -0
  14. package/dist/gatacaqr/index.esm.js +1 -1
  15. package/dist/gatacaqr/shadow-css-146f2f6f.js +387 -0
  16. package/dist/types/components/gataca-qr/components/qr/QR.d.ts +0 -1
  17. package/dist/types/components/gataca-qr/gataca-qr.d.ts +0 -5
  18. package/dist/types/components/gataca-qrdisplay/gataca-qrdisplay.d.ts +0 -5
  19. package/dist/types/components/gataca-ssibutton/gataca-ssibutton.d.ts +0 -5
  20. package/dist/types/components.d.ts +0 -24
  21. package/package.json +1 -1
  22. package/dist/cjs/gat-icon-alert-0ad19b26.js +0 -14
  23. package/dist/cjs/gataca-autoqr.cjs.entry.js +0 -105
  24. package/dist/cjs/gataca-qr_2.cjs.entry.js +0 -318
  25. package/dist/cjs/gataca-qrws.cjs.entry.js +0 -252
  26. package/dist/cjs/gataca-ssibutton_2.cjs.entry.js +0 -320
  27. package/dist/cjs/gatacaqr.cjs.js +0 -19
  28. package/dist/cjs/index-8638645b.js +0 -1482
  29. package/dist/cjs/index.cjs.js +0 -16
  30. package/dist/cjs/loader.cjs.js +0 -21
  31. package/dist/cjs/qr-code-styling-412bbc7a.js +0 -28
  32. package/dist/cjs/utils-ef28b844.js +0 -27
  33. package/dist/collection/assets/icons/gat-icon-alert.svg +0 -5
  34. package/dist/collection/assets/icons/gat-icon-check.svg +0 -5
  35. package/dist/collection/assets/icons/gat-icon-refresh.svg +0 -4
  36. package/dist/collection/assets/images/logo_gataca.svg +0 -7
  37. package/dist/collection/collection-manifest.json +0 -17
  38. package/dist/collection/components/gataca-autoqr/gataca-autoqr.css +0 -116
  39. package/dist/collection/components/gataca-autoqr/gataca-autoqr.js +0 -323
  40. package/dist/collection/components/gataca-qr/components/qr/QR.js +0 -5
  41. package/dist/collection/components/gataca-qr/components/readQR/ReadQR.js +0 -11
  42. package/dist/collection/components/gataca-qr/components/readQR/components/AnimatedLoader.js +0 -4
  43. package/dist/collection/components/gataca-qr/components/retryButton/RetryButton.js +0 -13
  44. package/dist/collection/components/gataca-qr/components/success/Success.js +0 -8
  45. package/dist/collection/components/gataca-qr/gataca-qr.css +0 -399
  46. package/dist/collection/components/gataca-qr/gataca-qr.js +0 -1001
  47. package/dist/collection/components/gataca-qrdisplay/gataca-qrdisplay.js +0 -176
  48. package/dist/collection/components/gataca-qrws/components/qr/QR.js +0 -5
  49. package/dist/collection/components/gataca-qrws/components/readQR/ReadQR.js +0 -11
  50. package/dist/collection/components/gataca-qrws/components/readQR/components/AnimatedLoader.js +0 -4
  51. package/dist/collection/components/gataca-qrws/components/retryButton/RetryButton.js +0 -13
  52. package/dist/collection/components/gataca-qrws/components/success/Success.js +0 -8
  53. package/dist/collection/components/gataca-qrws/gataca-qrws.css +0 -400
  54. package/dist/collection/components/gataca-qrws/gataca-qrws.js +0 -974
  55. package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.css +0 -116
  56. package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.js +0 -979
  57. package/dist/collection/components/gataca-ssibuttonws/gataca-ssibuttonws.css +0 -116
  58. package/dist/collection/components/gataca-ssibuttonws/gataca-ssibuttonws.js +0 -410
  59. package/dist/collection/index.js +0 -2
  60. package/dist/collection/utils/index.js +0 -1
  61. package/dist/collection/utils/utils.js +0 -22
  62. package/dist/components/gat-icon-alert.js +0 -30
  63. package/dist/components/gataca-autoqr.js +0 -161
  64. package/dist/components/gataca-qr.js +0 -6
  65. package/dist/components/gataca-qr2.js +0 -329
  66. package/dist/components/gataca-qrdisplay.js +0 -6
  67. package/dist/components/gataca-qrdisplay2.js +0 -99
  68. package/dist/components/gataca-qrws.js +0 -6
  69. package/dist/components/gataca-qrws2.js +0 -310
  70. package/dist/components/gataca-ssibutton.js +0 -6
  71. package/dist/components/gataca-ssibuttonws.js +0 -6
  72. package/dist/components/index.js +0 -8
  73. package/dist/esm/gataca-ssibutton_2.entry.js +0 -315
  74. package/dist/esm/gatacaqr.js +0 -17
  75. package/dist/esm/index-af2994f7.js +0 -1455
  76. package/dist/esm/index.js +0 -1
  77. package/dist/esm/loader.js +0 -17
  78. package/dist/esm/polyfills/core-js.js +0 -11
  79. package/dist/esm/polyfills/css-shim.js +0 -1
  80. package/dist/esm/polyfills/dom.js +0 -79
  81. package/dist/esm/polyfills/es5-html-element.js +0 -1
  82. package/dist/esm/polyfills/index.js +0 -34
  83. package/dist/esm/polyfills/system.js +0 -6
  84. package/dist/esm/qr-code-styling-0eeb38d5.js +0 -26
  85. package/dist/gatacaqr/p-0be4566d.js +0 -1
  86. package/dist/gatacaqr/p-2cd7b062.js +0 -1
  87. package/dist/gatacaqr/p-3ca3bb1a.entry.js +0 -1
  88. package/dist/gatacaqr/p-57b89b78.entry.js +0 -1
  89. package/dist/gatacaqr/p-88af482f.entry.js +0 -1
  90. package/dist/gatacaqr/p-ba0417e2.js +0 -2
  91. package/dist/gatacaqr/p-d59ae0ab.entry.js +0 -1
  92. package/dist/gatacaqr/p-ea783014.js +0 -1
  93. package/dist/index.cjs.js +0 -1
  94. package/dist/index.js +0 -1
  95. /package/dist/{esm → gatacaqr}/utils-63e7a33b.js +0 -0
@@ -1,318 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-8638645b.js');
6
- const gatIconAlert = require('./gat-icon-alert-0ad19b26.js');
7
- const qrCodeStyling = require('./qr-code-styling-412bbc7a.js');
8
- const utils = require('./utils-ef28b844.js');
9
-
10
- const GatacaQRDisplay = class {
11
- constructor(hostRef) {
12
- index.registerInstance(this, hostRef);
13
- this.qrId = undefined;
14
- this.qrData = undefined;
15
- this.size = 256;
16
- this.logoSize = 0;
17
- this.logoSrc = undefined;
18
- this.qrColor = "#1E1E20";
19
- this.rounded = true;
20
- }
21
- componentDidLoad() {
22
- const qrCode = new qrCodeStyling.QRCodeStyling({
23
- data: this.qrData,
24
- width: this.size,
25
- height: this.size,
26
- image: this.logoSize > 0 ? this.logoSrc || gatIconAlert.logoGatacaSvg : undefined,
27
- margin: 10,
28
- type: "canvas",
29
- dotsOptions: {
30
- color: this.qrColor,
31
- type: this.rounded ? "dots" : "square",
32
- },
33
- cornersSquareOptions: {
34
- type: this.rounded ? "extra-rounded" : "square",
35
- },
36
- cornersDotOptions: {
37
- type: this.rounded ? "dot" : "square",
38
- },
39
- imageOptions: {
40
- margin: 2,
41
- imageSize: this.logoSize,
42
- },
43
- });
44
- this.qr.id = this.qrId;
45
- qrCode.append(this.qr);
46
- }
47
- render() {
48
- return (index.h("div", {
49
- // id={this.qrId}
50
- ref: (el) => {
51
- this.qr = el;
52
- }
53
- }));
54
- }
55
- };
56
-
57
- const Success = (props) => {
58
- const { modalHeight, successLoginLabel } = props;
59
- return (index.h("div", { class: "success", style: {
60
- height: modalHeight ? (modalHeight === null || modalHeight === void 0 ? void 0 : modalHeight.toString()) + "px" : "300px",
61
- } },
62
- index.h("img", { src: gatIconAlert.gatIconCheckSvg, height: 52, width: 52 }),
63
- index.h("p", { class: "successMsg" }, successLoginLabel)));
64
- };
65
-
66
- const RetryButton = (props) => {
67
- var _a;
68
- const { errorMessage, modalWidth, clickInsideBoxLabel, refreshQrLabel, scanQrLabel, waitingStartSessionLabel, display, renderRetryQR, } = props;
69
- return (index.h("div", { class: "reload", style: {
70
- width: (modalWidth - 48).toString() + "px",
71
- height: modalWidth ? ((_a = (modalWidth - 48)) === null || _a === void 0 ? void 0 : _a.toString()) + "px" : "",
72
- } },
73
- index.h("div", { id: "notify", onClick: () => display() },
74
- index.h("img", { src: gatIconAlert.gatIconRefreshSvg, height: 24, width: 24 }),
75
- index.h("p", { class: "notify-text" },
76
- clickInsideBoxLabel,
77
- " "),
78
- errorMessage ? (index.h("p", { class: "notify-text bold" }, refreshQrLabel)) : (index.h("p", { class: "notify-text bold" }, scanQrLabel)),
79
- errorMessage && (index.h("div", { class: "alert", style: {
80
- width: (modalWidth - 48).toString() + "px",
81
- } },
82
- index.h("img", { src: gatIconAlert.gatIconAlertSvg, height: 24, width: 24 }),
83
- index.h("p", null, errorMessage)))),
84
- index.h("div", { id: "qrwait" }, renderRetryQR(waitingStartSessionLabel))));
85
- };
86
-
87
- const AnimatedLoader = () => {
88
- return (index.h("div", { class: "containerLoader" },
89
- index.h("div", { class: "loader" },
90
- index.h("div", { class: "loader__item loader__item__1" }),
91
- index.h("div", { class: "loader__item loader__item__2" }),
92
- index.h("div", { class: "loader__item loader__item__3" }),
93
- index.h("div", { class: "loader__item loader__item__4" }),
94
- index.h("div", { class: "loader__item loader__item__5" }),
95
- index.h("div", { class: "loader__item loader__item__6" }),
96
- index.h("div", { class: "loader__item loader__item__7" }),
97
- index.h("div", { class: "loader__item loader__item__8" }))));
98
- };
99
-
100
- const ReadQR = (props) => {
101
- var _a;
102
- const { modalWidth, readQrMessages } = props;
103
- return (index.h("div", { class: "blured", style: {
104
- width: (modalWidth - 48).toString() + "px",
105
- height: modalWidth ? ((_a = (modalWidth - 48)) === null || _a === void 0 ? void 0 : _a.toString()) + "px" : "",
106
- } },
107
- index.h("div", { id: "notify" },
108
- index.h(AnimatedLoader, null),
109
- index.h("p", { class: "notify-text" }, readQrMessages === null || readQrMessages === void 0 ? void 0 :
110
- readQrMessages.title,
111
- " "),
112
- index.h("p", { class: "notify-text bold" }, readQrMessages === null || readQrMessages === void 0 ? void 0 : readQrMessages.description)),
113
- index.h("div", { id: "qrwait" })));
114
- };
115
-
116
- const QR = (props) => {
117
- const { value, useLogo, logoSrc, size, qrId } = props;
118
- return (index.h("gataca-qrdisplay", { id: qrId, qrData: value, rounded: true, size: size, "logo-size": useLogo ? 0.33 : 0, "logo-src": logoSrc }));
119
- };
120
-
121
- 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)}}";
122
-
123
- const DEEP_LINK_PREFIX = "https://api.gataca.io/qr/redirect.html";
124
- //Default values
125
- const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
126
- const DEFAULT_POLLING_FREQ = 3;
127
- const GatacaQR = class {
128
- constructor(hostRef) { index.registerInstance(this, hostRef); this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7); this.checkStatus = undefined; this.createSession = undefined; this.successCallback = undefined; this.errorCallback = undefined; this.qrId = undefined; this.qrRole = undefined; this.callbackServer = undefined; this.autostart = true; this.autorefresh = false; this.v = "3"; this.qrModalTitle = "Quick Access"; this.modalTitleColor = "#4745B7"; this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet"; this.hideModalTexts = false; this.hideModalBoxShadow = false; this.hideBrandTitle = false; this.logoSize = 0; this.logoSrc = gatIconAlert.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 = utils.RESULT_STATUS.NOT_STARTED; }
129
- disconnectedCallback() {
130
- this.stop();
131
- }
132
- async componentDidLoad() {
133
- if (this.autostart) {
134
- await this.display();
135
- }
136
- }
137
- /**
138
- * Force manually the display of a QR
139
- */
140
- async display() {
141
- await this.getSessionId();
142
- this.result = utils.RESULT_STATUS.ONGOING;
143
- console.log("display0", "this.result", this.result);
144
- index.forceUpdate(this);
145
- console.log("display1", "this.result", this.result);
146
- this.poll()
147
- .then((data) => {
148
- this.result = utils.RESULT_STATUS.SUCCESS;
149
- console.log("display2", "this.result", this.result);
150
- index.forceUpdate(this);
151
- console.log("display3", "this.result", this.result);
152
- this.sessionData = data;
153
- this.gatacaLoginCompleted.emit(data);
154
- this.successCallback(data);
155
- })
156
- .catch((err) => {
157
- this.clean();
158
- let expired = err === utils.RESULT_STATUS.EXPIRED;
159
- if (expired && this.autorefresh) {
160
- this.display();
161
- }
162
- else {
163
- if (err !== utils.RESULT_STATUS.NOT_STARTED) {
164
- let error = expired
165
- ? new Error(this.userNotScanInTimeErrorLabel)
166
- : new Error(this.credsNotValidatedErrorLabel);
167
- this.result = err;
168
- console.log("display4", "this.result", this.result);
169
- index.forceUpdate(this);
170
- console.log("display5", "this.result", this.result);
171
- this.gatacaLoginFailed.emit(error);
172
- this.errorCallback(error);
173
- }
174
- }
175
- });
176
- if (utils.checkMobile() && this.dynamicLink) {
177
- window.location.href = this.getLink();
178
- }
179
- }
180
- /**
181
- * Stop manually an ongoing session
182
- */
183
- async stop() {
184
- this.clean();
185
- if (this.result === utils.RESULT_STATUS.ONGOING || utils.RESULT_STATUS.READ) {
186
- this.result = utils.RESULT_STATUS.NOT_STARTED;
187
- }
188
- }
189
- clean() {
190
- this.sessionData = undefined;
191
- this.sessionId = undefined;
192
- }
193
- /**
194
- * Retrieve manually the session data on a successful login
195
- */
196
- async getSessionData() {
197
- return this.sessionData
198
- ? Promise.resolve(this.sessionData)
199
- : Promise.reject(new Error(this.failedLoginErrorLabel));
200
- }
201
- async getSessionId() {
202
- if (this.sessionId) {
203
- return this.sessionId;
204
- }
205
- // console.log("111 getSessionId", "this.sessionId", this.sessionId);
206
- if (this.createSession) {
207
- let { sessionId, authenticationRequest } = await this.createSession();
208
- // console.log("222 getSessionId", "sessionId", sessionId);
209
- this.sessionId = sessionId;
210
- this.authenticationRequest = authenticationRequest;
211
- }
212
- // console.log("333 getSessionId", "this.sessionId", this.sessionId);
213
- return this.sessionId;
214
- }
215
- getLink() {
216
- if (this.v === "2") {
217
- return this.authenticationRequest;
218
- }
219
- const authRequestEncoded = "?dl=" + utils.base64UrlEncode(this.authenticationRequest);
220
- return DEEP_LINK_PREFIX + authRequestEncoded;
221
- }
222
- async poll() {
223
- let endTime = new Date().getTime() +
224
- (this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
225
- let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
226
- let checkFunc = async (component) => {
227
- if (component.result === utils.RESULT_STATUS.NOT_STARTED) {
228
- return { result: utils.RESULT_STATUS.NOT_STARTED };
229
- }
230
- let id = await component.getSessionId();
231
- return component.checkStatus(id);
232
- };
233
- let component = this;
234
- let checkCondition = async function (resolve, reject) {
235
- // If the condition is met, we're done!
236
- let { result, data } = await checkFunc(component);
237
- switch (result) {
238
- case utils.RESULT_STATUS.SUCCESS:
239
- resolve(data);
240
- break;
241
- case utils.RESULT_STATUS.READ:
242
- component.result = utils.RESULT_STATUS.READ;
243
- case utils.RESULT_STATUS.ONGOING:
244
- if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
245
- setTimeout(checkCondition, interval, resolve, reject);
246
- }
247
- else {
248
- reject(utils.RESULT_STATUS.EXPIRED);
249
- }
250
- break;
251
- default:
252
- reject(result);
253
- break;
254
- }
255
- };
256
- return new Promise(checkCondition);
257
- }
258
- renderQRSection() {
259
- console.log("renderQRSection", "this.result", this.result);
260
- switch (this.result) {
261
- case utils.RESULT_STATUS.NOT_STARTED:
262
- return this.renderRetryButton();
263
- case utils.RESULT_STATUS.ONGOING:
264
- return this.renderQR(this.getLink(), true);
265
- case utils.RESULT_STATUS.EXPIRED:
266
- return this.renderRetryButton(this.qrCodeExpiredLabel);
267
- case utils.RESULT_STATUS.FAILED:
268
- return this.renderRetryButton(this.credentialsNotValidatedLabel);
269
- case utils.RESULT_STATUS.SUCCESS:
270
- return this.renderSuccess();
271
- case utils.RESULT_STATUS.READ:
272
- return this.renderReadQR({
273
- title: this === null || this === void 0 ? void 0 : this.readQrTitle,
274
- description: this === null || this === void 0 ? void 0 : this.readQrDescription,
275
- });
276
- }
277
- }
278
- renderSuccess() {
279
- console.log("renderSuccess", "this.result", this.result);
280
- return (index.h(Success, { modalHeight: this === null || this === void 0 ? void 0 : this.modalHeight, successLoginLabel: this === null || this === void 0 ? void 0 : this.successLoginLabel }));
281
- }
282
- renderRetryButton(errorMessage) {
283
- return (index.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) }));
284
- }
285
- renderReadQR(readQrMessages) {
286
- console.log("renderReadQR", readQrMessages);
287
- return (index.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 }));
288
- }
289
- renderQR(value, useLogo) {
290
- console.log("renderQR", value, useLogo);
291
- return (index.h(QR, { qrId: this.qrId, value: value, useLogo: useLogo, size: (this === null || this === void 0 ? void 0 : this.qrSize) || undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc }));
292
- }
293
- renderRetryQR(value, useLogo) {
294
- // console.log("this.qrId", this.qrId);
295
- return (index.h(QR, { qrId: this.qrId, value: value, useLogo: useLogo, size: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc }));
296
- }
297
- render() {
298
- var _a, _b;
299
- return (index.h("div", { class: "popUpContainer" }, index.h("div", { class: `is-visible modal-window ${this.hideModalTexts ? "" : "large-modal"} ${this.hideModalBoxShadow ? "noBoxShadow" : ""}`, style: {
300
- width: (this.modalWidth - 2).toString() + "px",
301
- height: this.modalHeight
302
- ? ((_a = (this.modalHeight - 2)) === null || _a === void 0 ? void 0 : _a.toString()) + "px"
303
- : "",
304
- }, onClick: (event) => {
305
- event.stopPropagation();
306
- } }, index.h("div", { class: "modal-window__content" }, index.h("div", { class: `qrTitleContainer ${this.hideModalTexts ? "hidenText" : ""}` }, index.h("p", { class: "qrTitle modalText", style: { color: this.modalTitleColor || "#1e1e20" } }, this.qrModalTitle), !this.hideBrandTitle && (index.h("p", { class: "qrBrand modalText" }, this.byBrandLabel, " ", index.h("span", null, index.h("img", { src: gatIconAlert.logoGatacaSvg })))), this.result !== utils.RESULT_STATUS.SUCCESS &&
307
- !this.hideQrModalDescription && (index.h("p", { class: "qrDescription modalText" }, this.qrModalDescription))), index.h("div", { class: "qrSection", style: {
308
- width: this.modalWidth.toString() + "px",
309
- height: this.modalWidth
310
- ? ((_b = this.modalWidth) === null || _b === void 0 ? void 0 : _b.toString()) + "px"
311
- : "",
312
- } }, this.renderQRSection())))));
313
- }
314
- };
315
- GatacaQR.style = gatacaQrCss;
316
-
317
- exports.gataca_qr = GatacaQR;
318
- exports.gataca_qrdisplay = GatacaQRDisplay;
@@ -1,252 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-8638645b.js');
6
- const gatIconAlert = require('./gat-icon-alert-0ad19b26.js');
7
- require('./qr-code-styling-412bbc7a.js');
8
- const utils = require('./utils-ef28b844.js');
9
-
10
- const Success = (props) => {
11
- const { modalHeight, successLoginLabel } = props;
12
- return (index.h("div", { class: "success", style: {
13
- height: modalHeight ? (modalHeight === null || modalHeight === void 0 ? void 0 : modalHeight.toString()) + "px" : "300px",
14
- } },
15
- index.h("img", { src: gatIconAlert.gatIconCheckSvg, height: 52, width: 52 }),
16
- index.h("p", { class: "successMsg" }, successLoginLabel)));
17
- };
18
-
19
- const RetryButton = (props) => {
20
- var _a;
21
- const { errorMessage, modalWidth, clickInsideBoxLabel, refreshQrLabel, scanQrLabel, waitingStartSessionLabel, display, renderRetryQR, } = props;
22
- return (index.h("div", { class: "reload", style: {
23
- width: (modalWidth - 48).toString() + "px",
24
- height: modalWidth ? ((_a = (modalWidth - 48)) === null || _a === void 0 ? void 0 : _a.toString()) + "px" : "",
25
- } },
26
- index.h("div", { id: "notify", onClick: () => display() },
27
- index.h("img", { src: gatIconAlert.gatIconRefreshSvg, height: 24, width: 24 }),
28
- index.h("p", { class: "notify-text" },
29
- clickInsideBoxLabel,
30
- " "),
31
- errorMessage ? (index.h("p", { class: "notify-text bold" }, refreshQrLabel)) : (index.h("p", { class: "notify-text bold" }, scanQrLabel)),
32
- errorMessage && (index.h("div", { class: "alert", style: {
33
- width: (modalWidth - 48).toString() + "px",
34
- } },
35
- index.h("img", { src: gatIconAlert.gatIconAlertSvg, height: 24, width: 24 }),
36
- index.h("p", null, errorMessage)))),
37
- index.h("div", { id: "qrwait" }, renderRetryQR(waitingStartSessionLabel))));
38
- };
39
-
40
- const QR = (props) => {
41
- const { value, useLogo, logoSrc, size } = props;
42
- return (index.h("gataca-qrdisplay", { qrData: value, rounded: true, size: size, "logo-size": useLogo ? 0.33 : 0, "logo-src": logoSrc }));
43
- };
44
-
45
- const AnimatedLoader = () => {
46
- return (index.h("div", { class: "containerLoader" },
47
- index.h("div", { class: "loader" },
48
- index.h("div", { class: "loader__item loader__item__1" }),
49
- index.h("div", { class: "loader__item loader__item__2" }),
50
- index.h("div", { class: "loader__item loader__item__3" }),
51
- index.h("div", { class: "loader__item loader__item__4" }),
52
- index.h("div", { class: "loader__item loader__item__5" }),
53
- index.h("div", { class: "loader__item loader__item__6" }),
54
- index.h("div", { class: "loader__item loader__item__7" }),
55
- index.h("div", { class: "loader__item loader__item__8" }))));
56
- };
57
-
58
- const ReadQR = (props) => {
59
- var _a;
60
- const { modalWidth, readQrMessages, renderQR, url, sizeQR } = props;
61
- return (index.h("div", { class: "blured", style: {
62
- width: (modalWidth - 48).toString() + "px",
63
- height: modalWidth ? ((_a = (modalWidth - 48)) === null || _a === void 0 ? void 0 : _a.toString()) + "px" : "",
64
- } },
65
- index.h("div", { id: "notify" },
66
- index.h(AnimatedLoader, null),
67
- index.h("p", { class: "notify-text" }, readQrMessages === null || readQrMessages === void 0 ? void 0 :
68
- readQrMessages.title,
69
- " "),
70
- index.h("p", { class: "notify-text bold" }, readQrMessages === null || readQrMessages === void 0 ? void 0 : readQrMessages.description)),
71
- index.h("div", { id: "qrwait" }, renderQR(url, false, sizeQR))));
72
- };
73
-
74
- const gatacaQrwsCss = "@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)}}";
75
-
76
- const DEEP_LINK_PREFIX = "https://api.gataca.io/qr/redirect.html";
77
- const DEFAULT_SESSION_TIMEOUT = 300;
78
- const QR_ROLE_CONNECT = "connect";
79
- const GatacaQRWS = class {
80
- constructor(hostRef) { index.registerInstance(this, hostRef); this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7); this.successCallback = undefined; this.errorCallback = undefined; this.qrRole = undefined; this.callbackServer = undefined; this.socketEndpoint = undefined; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT; this.wsOnOpen = undefined; this.wsOnMessage = 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 = gatIconAlert.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.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = utils.RESULT_STATUS.NOT_STARTED; }
81
- disconnectedCallback() {
82
- this.stop();
83
- }
84
- async componentDidLoad() {
85
- if (this.autostart) {
86
- await this.display();
87
- }
88
- }
89
- /**
90
- * Force manually the display of a QR
91
- */
92
- async display() {
93
- let socket = new WebSocket(this.socketEndpoint);
94
- setTimeout(() => {
95
- this.socket.close(1000, "");
96
- }, 1000 * this.sessionTimeout);
97
- this.socket = socket;
98
- socket.onopen = () => {
99
- if (this.wsOnOpen)
100
- this.wsOnOpen(this.socket);
101
- };
102
- socket.onmessage = (msg) => {
103
- if (this.wsOnMessage) {
104
- this.wsOnMessage(this.socket, msg);
105
- }
106
- else {
107
- let wsresp = JSON.parse(msg.data);
108
- if (!!wsresp.sessionId) {
109
- this.handleWSResponse(wsresp);
110
- }
111
- }
112
- };
113
- socket.onerror = () => {
114
- let error = new Error("Error connecting with server");
115
- this.result = utils.RESULT_STATUS.FAILED;
116
- this.gatacaLoginFailed.emit(error);
117
- this.errorCallback(error);
118
- socket.close(1000, "");
119
- };
120
- socket.onclose = () => {
121
- if (this.result === utils.RESULT_STATUS.ONGOING || utils.RESULT_STATUS.READ) {
122
- this.result = utils.RESULT_STATUS.EXPIRED;
123
- }
124
- if (this.result === utils.RESULT_STATUS.EXPIRED) {
125
- if (this.autorefresh) {
126
- this.display();
127
- }
128
- else {
129
- let error = new Error("User did not scan the QR in the alloted time");
130
- this.gatacaLoginFailed.emit(error);
131
- this.errorCallback(error);
132
- }
133
- }
134
- };
135
- if (utils.checkMobile() && this.dynamicLink) {
136
- window.location.href = this.getLink();
137
- }
138
- }
139
- sessionMsgReceived(event) {
140
- let wsresp = event.detail;
141
- this.handleWSResponse(wsresp);
142
- }
143
- handleWSResponse(wsresp) {
144
- this.result = wsresp.result;
145
- switch (wsresp.result) {
146
- case utils.RESULT_STATUS.ONGOING:
147
- case utils.RESULT_STATUS.READ:
148
- this.sessionId = wsresp.sessionId;
149
- this.authenticationRequest = wsresp.authenticationRequest;
150
- break;
151
- case utils.RESULT_STATUS.SUCCESS:
152
- this.sessionData = wsresp.authenticatedUserData;
153
- this.gatacaLoginCompleted.emit(wsresp.authenticatedUserData);
154
- this.successCallback(wsresp.authenticatedUserData);
155
- this.socket.close(1000, "");
156
- break;
157
- case utils.RESULT_STATUS.FAILED:
158
- this.socket.close();
159
- let error = new Error("Provided user credentials couldn't be validated");
160
- this.gatacaLoginFailed.emit(error);
161
- this.errorCallback(error);
162
- break;
163
- case utils.RESULT_STATUS.EXPIRED:
164
- this.socket.close();
165
- if (this.autorefresh) {
166
- this.display();
167
- }
168
- else {
169
- let error = new Error("User did not scan the QR in the alloted time");
170
- this.gatacaLoginFailed.emit(error);
171
- this.errorCallback(error);
172
- }
173
- }
174
- }
175
- /**
176
- * Stop manually an ongoing session
177
- */
178
- async stop() {
179
- this.sessionData = undefined;
180
- this.sessionId = undefined;
181
- this.socket.close(1000, "Client stopped the connection");
182
- }
183
- /**
184
- * Retrieve manually the session data on a successful login
185
- */
186
- async getSessionData() {
187
- return this.sessionData
188
- ? Promise.resolve(this.sessionData)
189
- : Promise.reject(new Error("No successful login"));
190
- }
191
- getLink() {
192
- if (this.v === "2" && this.qrRole == QR_ROLE_CONNECT) {
193
- return this.authenticationRequest;
194
- }
195
- const authRequestEncoded = "?dl=" + utils.base64UrlEncode(this.authenticationRequest);
196
- return DEEP_LINK_PREFIX + authRequestEncoded;
197
- }
198
- renderQRSection() {
199
- switch (this.result) {
200
- case utils.RESULT_STATUS.NOT_STARTED:
201
- return this.renderRetryButton();
202
- case utils.RESULT_STATUS.ONGOING:
203
- return this.renderQR(this.getLink(), true);
204
- case utils.RESULT_STATUS.EXPIRED:
205
- return this.renderRetryButton(this.qrCodeExpiredLabel);
206
- case utils.RESULT_STATUS.FAILED:
207
- return this.renderRetryButton(this.credentialsNotValidatedLabel);
208
- case utils.RESULT_STATUS.SUCCESS:
209
- return this.renderSuccess();
210
- case utils.RESULT_STATUS.READ:
211
- return this.renderReadQR({
212
- title: this === null || this === void 0 ? void 0 : this.readQrTitle,
213
- description: this === null || this === void 0 ? void 0 : this.readQrDescription,
214
- });
215
- }
216
- }
217
- renderSuccess() {
218
- return (index.h(Success, { modalHeight: this === null || this === void 0 ? void 0 : this.modalHeight, successLoginLabel: this === null || this === void 0 ? void 0 : this.successLoginLabel }));
219
- }
220
- renderRetryButton(errorMessage) {
221
- return (index.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) }));
222
- }
223
- renderReadQR(readQrMessages) {
224
- return (index.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) }));
225
- }
226
- renderQR(value, useLogo) {
227
- return (index.h(QR, { value: value, useLogo: useLogo, size: (this === null || this === void 0 ? void 0 : this.qrSize) || undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc }));
228
- }
229
- renderRetryQR(value, useLogo) {
230
- return (index.h(QR, { value: value, useLogo: useLogo, size: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc }));
231
- }
232
- render() {
233
- var _a, _b;
234
- return (index.h("div", { class: "popUpContainer" }, index.h("div", { class: `is-visible modal-window ${this.hideModalTexts ? "" : "large-modal"} ${this.hideModalBoxShadow ? "noBoxShadow" : ""}`, style: {
235
- width: (this.modalWidth - 2).toString() + "px",
236
- height: this.modalHeight
237
- ? ((_a = (this.modalHeight - 2)) === null || _a === void 0 ? void 0 : _a.toString()) + "px"
238
- : "",
239
- }, onClick: (event) => {
240
- event.stopPropagation();
241
- } }, index.h("div", { class: "modal-window__content" }, index.h("div", { class: `qrTitleContainer ${this.hideModalTexts ? "hidenText" : ""}` }, index.h("p", { class: "qrTitle modalText", style: { color: this.modalTitleColor || "#1e1e20" } }, this.qrModalTitle), !this.hideBrandTitle && (index.h("p", { class: "qrBrand modalText" }, this.byBrandLabel, " ", index.h("span", null, index.h("img", { src: gatIconAlert.logoGatacaSvg })))), this.result !== utils.RESULT_STATUS.SUCCESS &&
242
- !this.hideQrModalDescription && (index.h("p", { class: "qrDescription modalText" }, this.qrModalDescription))), index.h("div", { class: "qrSection", style: {
243
- width: this.modalWidth.toString() + "px",
244
- height: this.modalWidth
245
- ? ((_b = this.modalWidth) === null || _b === void 0 ? void 0 : _b.toString()) + "px"
246
- : "",
247
- } }, this.renderQRSection())))));
248
- }
249
- };
250
- GatacaQRWS.style = gatacaQrwsCss;
251
-
252
- exports.gataca_qrws = GatacaQRWS;