@gataca/qr 0.0.7

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 (119) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/gat-icon-alert-0ad19b26.js +14 -0
  3. package/dist/cjs/gataca-autoqr.cjs.entry.js +105 -0
  4. package/dist/cjs/gataca-qr_2.cjs.entry.js +294 -0
  5. package/dist/cjs/gataca-qrws.cjs.entry.js +252 -0
  6. package/dist/cjs/gataca-ssibutton_2.cjs.entry.js +309 -0
  7. package/dist/cjs/gatacaqr.cjs.js +19 -0
  8. package/dist/cjs/index-93d47a75.js +1469 -0
  9. package/dist/cjs/index.cjs.js +16 -0
  10. package/dist/cjs/loader.cjs.js +21 -0
  11. package/dist/cjs/qr-code-styling-412bbc7a.js +28 -0
  12. package/dist/cjs/utils-ef28b844.js +27 -0
  13. package/dist/collection/assets/icons/gat-icon-alert.svg +5 -0
  14. package/dist/collection/assets/icons/gat-icon-check.svg +5 -0
  15. package/dist/collection/assets/icons/gat-icon-refresh.svg +4 -0
  16. package/dist/collection/assets/images/logo_gataca.svg +7 -0
  17. package/dist/collection/collection-manifest.json +17 -0
  18. package/dist/collection/components/gataca-autoqr/gataca-autoqr.css +116 -0
  19. package/dist/collection/components/gataca-autoqr/gataca-autoqr.js +323 -0
  20. package/dist/collection/components/gataca-qr/components/qr/QR.js +5 -0
  21. package/dist/collection/components/gataca-qr/components/readQR/ReadQR.js +11 -0
  22. package/dist/collection/components/gataca-qr/components/readQR/components/AnimatedLoader.js +4 -0
  23. package/dist/collection/components/gataca-qr/components/retryButton/RetryButton.js +13 -0
  24. package/dist/collection/components/gataca-qr/components/success/Success.js +8 -0
  25. package/dist/collection/components/gataca-qr/gataca-qr.css +399 -0
  26. package/dist/collection/components/gataca-qr/gataca-qr.js +965 -0
  27. package/dist/collection/components/gataca-qrdisplay/gataca-qrdisplay.js +154 -0
  28. package/dist/collection/components/gataca-qrws/components/qr/QR.js +5 -0
  29. package/dist/collection/components/gataca-qrws/components/readQR/ReadQR.js +11 -0
  30. package/dist/collection/components/gataca-qrws/components/readQR/components/AnimatedLoader.js +4 -0
  31. package/dist/collection/components/gataca-qrws/components/retryButton/RetryButton.js +13 -0
  32. package/dist/collection/components/gataca-qrws/components/success/Success.js +8 -0
  33. package/dist/collection/components/gataca-qrws/gataca-qrws.css +400 -0
  34. package/dist/collection/components/gataca-qrws/gataca-qrws.js +974 -0
  35. package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.css +116 -0
  36. package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.js +933 -0
  37. package/dist/collection/components/gataca-ssibuttonws/gataca-ssibuttonws.css +116 -0
  38. package/dist/collection/components/gataca-ssibuttonws/gataca-ssibuttonws.js +410 -0
  39. package/dist/collection/index.js +2 -0
  40. package/dist/collection/utils/index.js +1 -0
  41. package/dist/collection/utils/utils.js +22 -0
  42. package/dist/components/gat-icon-alert.js +30 -0
  43. package/dist/components/gataca-autoqr.d.ts +11 -0
  44. package/dist/components/gataca-autoqr.js +161 -0
  45. package/dist/components/gataca-qr.d.ts +11 -0
  46. package/dist/components/gataca-qr.js +6 -0
  47. package/dist/components/gataca-qr2.js +309 -0
  48. package/dist/components/gataca-qrdisplay.d.ts +11 -0
  49. package/dist/components/gataca-qrdisplay.js +6 -0
  50. package/dist/components/gataca-qrdisplay2.js +93 -0
  51. package/dist/components/gataca-qrws.d.ts +11 -0
  52. package/dist/components/gataca-qrws.js +6 -0
  53. package/dist/components/gataca-qrws2.js +310 -0
  54. package/dist/components/gataca-ssibutton.d.ts +11 -0
  55. package/dist/components/gataca-ssibutton.js +6 -0
  56. package/dist/components/gataca-ssibutton2.js +318 -0
  57. package/dist/components/gataca-ssibuttonws.d.ts +11 -0
  58. package/dist/components/gataca-ssibuttonws.js +6 -0
  59. package/dist/components/gataca-ssibuttonws2.js +102 -0
  60. package/dist/components/index.d.ts +27 -0
  61. package/dist/components/index.js +8 -0
  62. package/dist/esm/gat-icon-alert-7b06ef3a.js +9 -0
  63. package/dist/esm/gataca-autoqr.entry.js +101 -0
  64. package/dist/esm/gataca-qr_2.entry.js +289 -0
  65. package/dist/esm/gataca-qrws.entry.js +248 -0
  66. package/dist/esm/gataca-ssibutton_2.entry.js +304 -0
  67. package/dist/esm/gatacaqr.js +17 -0
  68. package/dist/esm/index-2be54f32.js +1443 -0
  69. package/dist/esm/index.js +1 -0
  70. package/dist/esm/loader.js +17 -0
  71. package/dist/esm/polyfills/core-js.js +11 -0
  72. package/dist/esm/polyfills/css-shim.js +1 -0
  73. package/dist/esm/polyfills/dom.js +79 -0
  74. package/dist/esm/polyfills/es5-html-element.js +1 -0
  75. package/dist/esm/polyfills/index.js +34 -0
  76. package/dist/esm/polyfills/system.js +6 -0
  77. package/dist/esm/qr-code-styling-0eeb38d5.js +26 -0
  78. package/dist/esm/utils-63e7a33b.js +24 -0
  79. package/dist/gatacaqr/gatacaqr.esm.js +1 -0
  80. package/dist/gatacaqr/index.esm.js +1 -0
  81. package/dist/gatacaqr/p-0381ab9a.entry.js +1 -0
  82. package/dist/gatacaqr/p-0be4566d.js +1 -0
  83. package/dist/gatacaqr/p-16298cb4.entry.js +1 -0
  84. package/dist/gatacaqr/p-2cd7b062.js +1 -0
  85. package/dist/gatacaqr/p-5ae5f952.js +2 -0
  86. package/dist/gatacaqr/p-68f20267.entry.js +1 -0
  87. package/dist/gatacaqr/p-9e9af27e.entry.js +1 -0
  88. package/dist/gatacaqr/p-ea783014.js +1 -0
  89. package/dist/index.cjs.js +1 -0
  90. package/dist/index.js +1 -0
  91. package/dist/types/components/gataca-autoqr/gataca-autoqr.d.ts +85 -0
  92. package/dist/types/components/gataca-qr/components/qr/QR.d.ts +9 -0
  93. package/dist/types/components/gataca-qr/components/readQR/ReadQR.d.ts +13 -0
  94. package/dist/types/components/gataca-qr/components/readQR/components/AnimatedLoader.d.ts +2 -0
  95. package/dist/types/components/gataca-qr/components/retryButton/RetryButton.d.ts +13 -0
  96. package/dist/types/components/gataca-qr/components/success/Success.d.ts +7 -0
  97. package/dist/types/components/gataca-qr/gataca-qr.d.ts +246 -0
  98. package/dist/types/components/gataca-qrdisplay/gataca-qrdisplay.d.ts +35 -0
  99. package/dist/types/components/gataca-qrws/components/qr/QR.d.ts +9 -0
  100. package/dist/types/components/gataca-qrws/components/readQR/ReadQR.d.ts +13 -0
  101. package/dist/types/components/gataca-qrws/components/readQR/components/AnimatedLoader.d.ts +2 -0
  102. package/dist/types/components/gataca-qrws/components/retryButton/RetryButton.d.ts +13 -0
  103. package/dist/types/components/gataca-qrws/components/success/Success.d.ts +7 -0
  104. package/dist/types/components/gataca-qrws/gataca-qrws.d.ts +239 -0
  105. package/dist/types/components/gataca-ssibutton/gataca-ssibutton.d.ts +218 -0
  106. package/dist/types/components/gataca-ssibuttonws/gataca-ssibuttonws.d.ts +110 -0
  107. package/dist/types/components.d.ts +1326 -0
  108. package/dist/types/index.d.ts +2 -0
  109. package/dist/types/stencil-public-runtime.d.ts +1581 -0
  110. package/dist/types/utils/index.d.ts +1 -0
  111. package/dist/types/utils/utils.d.ts +57 -0
  112. package/loader/cdn.js +3 -0
  113. package/loader/index.cjs.js +3 -0
  114. package/loader/index.d.ts +12 -0
  115. package/loader/index.es2017.js +3 -0
  116. package/loader/index.js +4 -0
  117. package/loader/package.json +11 -0
  118. package/package.json +45 -0
  119. package/readme.md +69 -0
@@ -0,0 +1,252 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-93d47a75.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;
@@ -0,0 +1,309 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-93d47a75.js');
6
+ require('./qr-code-styling-412bbc7a.js');
7
+ const utils = require('./utils-ef28b844.js');
8
+
9
+ 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}";
10
+
11
+ 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=";
12
+ //Default values
13
+ const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
14
+ const DEFAULT_POLLING_FREQ = 3;
15
+ const GatacaSSIButton = class {
16
+ constructor(hostRef) {
17
+ index.registerInstance(this, hostRef);
18
+ this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7);
19
+ this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7);
20
+ this.buttonText = "Easy login";
21
+ this.checkStatus = undefined;
22
+ this.createSession = undefined;
23
+ this.successCallback = undefined;
24
+ this.errorCallback = undefined;
25
+ this.handleCheckAppLoading = undefined;
26
+ this.checkAppTimeout = 6;
27
+ this.qrRole = undefined;
28
+ this.callbackServer = undefined;
29
+ this.sessionTimeout = undefined;
30
+ this.pollingFrequency = undefined;
31
+ this.autorefresh = false;
32
+ this.v = "3";
33
+ this.qrModalTitle = "Quick Access";
34
+ this.modalTitleColor = "#4745B7";
35
+ this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
36
+ this.hideBrandTitle = false;
37
+ this.dynamicLink = true;
38
+ this.logoSize = 0;
39
+ this.logoSrc = undefined;
40
+ this.qrCodeExpiredLabel = "QR Code expired";
41
+ this.credentialsNotValidatedLabel = "User credentials not validated";
42
+ this.clickInsideBoxLabel = "Click inside the box to";
43
+ this.refreshQrLabel = "Refresh QR Code";
44
+ this.scanQrLabel = "Scan QR Code";
45
+ this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time";
46
+ this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated";
47
+ this.failedLoginErrorLabel = "No successful login";
48
+ this.successLoginLabel = "Successful Connection!";
49
+ this.byBrandLabel = "by Gataca";
50
+ this.waitingStartSessionLabel = "waiting to start a session";
51
+ this.hideQrModalDescription = false;
52
+ this.open = false;
53
+ this.sessionId = undefined;
54
+ this.authenticationRequest = undefined;
55
+ this.sessionData = undefined;
56
+ this.result = utils.RESULT_STATUS.NOT_STARTED;
57
+ this.qr = (index.h("gataca-qr", { ref: (el) => (this.qrElement = el), checkStatus: this.checkStatus, createSession: this.createSession, successCallback: this.successCallback, errorCallback: this.errorCallback, qrRole: this.qrRole, callbackServer: this.callbackServer, sessionTimeout: this.sessionTimeout, pollingFrequency: this.pollingFrequency, autostart: true, 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 }));
58
+ }
59
+ /**
60
+ * Retrieve manually the session data on a successful login
61
+ */
62
+ async getSessionData() {
63
+ return this.qr.getSessionData();
64
+ }
65
+ async getSessionId() {
66
+ if (this.sessionId) {
67
+ return this.sessionId;
68
+ }
69
+ let { sessionId, authenticationRequest } = await this.createSession();
70
+ this.sessionId = sessionId;
71
+ this.authenticationRequest = authenticationRequest;
72
+ return this.sessionId;
73
+ }
74
+ /**
75
+ * Force manually the start polling
76
+ */
77
+ async startMobilePolling() {
78
+ await this.getSessionId();
79
+ this.result = utils.RESULT_STATUS.ONGOING;
80
+ this.poll()
81
+ .then((data) => {
82
+ this.result = utils.RESULT_STATUS.SUCCESS;
83
+ this.sessionData = data;
84
+ this.gatacaLoginCompleted.emit(data);
85
+ this.successCallback(data);
86
+ })
87
+ .catch((err) => {
88
+ this.clean();
89
+ let expired = err === utils.RESULT_STATUS.EXPIRED;
90
+ if (expired && this.autorefresh) {
91
+ this.startMobilePolling();
92
+ }
93
+ else {
94
+ if (err !== utils.RESULT_STATUS.NOT_STARTED) {
95
+ let error = expired
96
+ ? new Error(this.userNotScanInTimeErrorLabel)
97
+ : new Error(this.credsNotValidatedErrorLabel);
98
+ this.result = err;
99
+ this.gatacaLoginFailed.emit(error);
100
+ this.errorCallback(error);
101
+ }
102
+ }
103
+ });
104
+ }
105
+ /**
106
+ * Stop manually an ongoing session
107
+ */
108
+ async stop() {
109
+ this.clean();
110
+ if (this.result === utils.RESULT_STATUS.ONGOING || utils.RESULT_STATUS.READ) {
111
+ this.result = utils.RESULT_STATUS.NOT_STARTED;
112
+ }
113
+ }
114
+ clean() {
115
+ this.sessionData = undefined;
116
+ this.sessionId = undefined;
117
+ }
118
+ renderModal() {
119
+ return this.qr;
120
+ }
121
+ async poll() {
122
+ let endTime = new Date().getTime() +
123
+ (this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
124
+ let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
125
+ let checkFunc = async (component) => {
126
+ if (component.result === utils.RESULT_STATUS.NOT_STARTED) {
127
+ return { result: utils.RESULT_STATUS.NOT_STARTED };
128
+ }
129
+ let id = await component.getSessionId();
130
+ return component.checkStatus(id);
131
+ };
132
+ let component = this;
133
+ let checkCondition = async function (resolve, reject) {
134
+ // If the condition is met, we're done!
135
+ let { result, data } = await checkFunc(component);
136
+ switch (result) {
137
+ case utils.RESULT_STATUS.SUCCESS:
138
+ resolve(data);
139
+ break;
140
+ case utils.RESULT_STATUS.READ:
141
+ component.result = utils.RESULT_STATUS.READ;
142
+ case utils.RESULT_STATUS.ONGOING:
143
+ if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
144
+ setTimeout(checkCondition, interval, resolve, reject);
145
+ }
146
+ else {
147
+ reject(utils.RESULT_STATUS.EXPIRED);
148
+ }
149
+ break;
150
+ default:
151
+ reject(result);
152
+ break;
153
+ }
154
+ };
155
+ return new Promise(checkCondition);
156
+ }
157
+ isAppInstalled(appScheme, callback) {
158
+ let timeout;
159
+ let detected = false;
160
+ if (appScheme === null || appScheme === void 0 ? void 0 : appScheme.length) {
161
+ window.location.href = appScheme;
162
+ }
163
+ const waitTimeToCheckApp = this.checkAppTimeout * 1000;
164
+ setTimeout(() => {
165
+ if (!detected) {
166
+ callback(false);
167
+ }
168
+ cleanup();
169
+ }, waitTimeToCheckApp);
170
+ const handleVisibilityChange = () => {
171
+ if (document.hidden) {
172
+ detected = true;
173
+ callback(true);
174
+ this.startMobilePolling();
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 (index.h("div", { class: "gatacaButtonWrapper" }, index.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
+ } }, index.h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), index.h("span", null, this.buttonText))));
197
+ }
198
+ async getAuthRequest() {
199
+ let { authenticationRequest } = await this.createSession();
200
+ return authenticationRequest;
201
+ }
202
+ renderMobileButton(isAndroid, isIos) {
203
+ let loading = false;
204
+ const handleLoading = (isLoading) => {
205
+ loading = isLoading;
206
+ if (this.handleCheckAppLoading) {
207
+ this.handleCheckAppLoading(isLoading);
208
+ }
209
+ };
210
+ const executeRedirection = async () => {
211
+ handleLoading(true);
212
+ const androidStoreLink = "https://play.google.com/store/apps/details?id=com.gataca.identity";
213
+ const iosStoreLink = "https://apps.apple.com/us/app/gataca/id1498607616";
214
+ try {
215
+ const appScheme = await this.getAuthRequest();
216
+ this.isAppInstalled(appScheme, (installed) => {
217
+ if (!installed) {
218
+ this.stop();
219
+ if (isAndroid) {
220
+ window.location.href = androidStoreLink;
221
+ }
222
+ else if (isIos) {
223
+ window.location.href = iosStoreLink;
224
+ }
225
+ }
226
+ handleLoading(false);
227
+ });
228
+ }
229
+ catch (error) {
230
+ this.stop();
231
+ handleLoading(false);
232
+ }
233
+ };
234
+ return (index.h("div", { class: "gatacaButtonWrapper" }, index.h("button", { class: "gatacaButton", onClick: () => {
235
+ executeRedirection();
236
+ }, disabled: loading }, index.h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), index.h("span", null, this.buttonText))));
237
+ }
238
+ render() {
239
+ const userAgent =
240
+ // @ts-ignore
241
+ (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);
242
+ const isAndroid = /android/i.test(userAgent);
243
+ const isIos =
244
+ // @ts-ignore
245
+ (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) ||
246
+ (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
247
+ const isMobile = isAndroid || isIos;
248
+ return (index.h("div", { class: "buttonContainer" }, isMobile && this.v === "3"
249
+ ? this.renderMobileButton(isAndroid, isIos)
250
+ : this.renderDesktopButton(), this.open && (!isMobile || this.v === "3") && this.renderModal()));
251
+ }
252
+ };
253
+ GatacaSSIButton.style = gatacaSsibuttonCss;
254
+
255
+ 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}";
256
+
257
+ 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=";
258
+ const GatacaSSIButtonWS = class {
259
+ constructor(hostRef) {
260
+ index.registerInstance(this, hostRef);
261
+ this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7);
262
+ this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7);
263
+ this.buttonText = "Easy login";
264
+ this.successCallback = undefined;
265
+ this.errorCallback = undefined;
266
+ this.qrRole = undefined;
267
+ this.callbackServer = undefined;
268
+ this.socketEndpoint = undefined;
269
+ this.sessionTimeout = undefined;
270
+ this.wsOnOpen = undefined;
271
+ this.wsOnMessage = undefined;
272
+ this.autostart = true;
273
+ this.autorefresh = false;
274
+ this.v = "3";
275
+ this.qrModalTitle = "Quick Access";
276
+ this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
277
+ this.hideBrandTitle = false;
278
+ this.dynamicLink = true;
279
+ this.open = false;
280
+ this.qr = (index.h("gataca-qrws", { wsOnMessage: this.wsOnMessage, wsOnOpen: this.wsOnOpen, successCallback: this.successCallback, errorCallback: this.errorCallback, qrRole: this.qrRole, 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 }));
281
+ }
282
+ /**
283
+ * Retrieve manually the session data on a successful login
284
+ */
285
+ async getSessionData() {
286
+ return this.qr.getSessionData();
287
+ }
288
+ renderModal() {
289
+ return this.qr;
290
+ }
291
+ renderButton() {
292
+ return (index.h("div", { class: "gatacaButtonWrapper" }, index.h("button", { class: "gatacaButton", onClick: () => {
293
+ this.open = !this.open;
294
+ if (this.open) {
295
+ this.qr.display();
296
+ }
297
+ else {
298
+ this.qr.stop();
299
+ }
300
+ } }, index.h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), index.h("span", null, this.buttonText))));
301
+ }
302
+ render() {
303
+ return (index.h("div", { class: "buttonContainer" }, this.renderButton(), this.open && this.renderModal()));
304
+ }
305
+ };
306
+ GatacaSSIButtonWS.style = gatacaSsibuttonwsCss;
307
+
308
+ exports.gataca_ssibutton = GatacaSSIButton;
309
+ exports.gataca_ssibuttonws = GatacaSSIButtonWS;
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-93d47a75.js');
4
+
5
+ /*
6
+ Stencil Client Patch Browser v2.19.3 | MIT Licensed | https://stenciljs.com
7
+ */
8
+ const patchBrowser = () => {
9
+ const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('gatacaqr.cjs.js', document.baseURI).href));
10
+ const opts = {};
11
+ if (importMeta !== '') {
12
+ opts.resourcesUrl = new URL('.', importMeta).href;
13
+ }
14
+ return index.promiseResolve(opts);
15
+ };
16
+
17
+ patchBrowser().then(options => {
18
+ return index.bootstrapLazy([["gataca-qr_2.cjs",[[1,"gataca-qr",{"checkStatus":[16],"createSession":[16],"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideModalTexts":[4,"hide-modal-texts"],"hideModalBoxShadow":[4,"hide-modal-box-shadow"],"hideBrandTitle":[4,"hide-brand-title"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrSize":[2,"qr-size"],"modalWidth":[2,"modal-width"],"modalHeight":[2,"modal-height"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"readQrTitle":[1,"read-qr-title"],"readQrDescription":[1,"read-qr-description"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"sessionTimeout":[2,"session-timeout"],"pollingFrequency":[2,"polling-frequency"],"dynamicLink":[4,"dynamic-link"],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"display":[64],"stop":[64],"getSessionData":[64]}],[0,"gataca-qrdisplay",{"qrData":[1,"qr-data"],"size":[2],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrColor":[1,"qr-color"],"rounded":[4]}]]],["gataca-qrws.cjs",[[1,"gataca-qrws",{"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"socketEndpoint":[1,"socket-endpoint"],"sessionTimeout":[2,"session-timeout"],"wsOnOpen":[16],"wsOnMessage":[16],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideModalTexts":[4,"hide-modal-texts"],"hideModalBoxShadow":[4,"hide-modal-box-shadow"],"hideBrandTitle":[4,"hide-brand-title"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrSize":[2,"qr-size"],"modalWidth":[2,"modal-width"],"modalHeight":[2,"modal-height"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"readQrTitle":[1,"read-qr-title"],"readQrDescription":[1,"read-qr-description"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"dynamicLink":[4,"dynamic-link"],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"display":[64],"stop":[64],"getSessionData":[64]},[[2,"sessionMsg","sessionMsgReceived"]]]]],["gataca-ssibutton_2.cjs",[[1,"gataca-ssibutton",{"buttonText":[1,"button-text"],"checkStatus":[16],"createSession":[16],"successCallback":[16],"errorCallback":[16],"handleCheckAppLoading":[16],"checkAppTimeout":[2,"check-app-timeout"],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"sessionTimeout":[2,"session-timeout"],"pollingFrequency":[2,"polling-frequency"],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"open":[32],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"getSessionData":[64],"startMobilePolling":[64],"stop":[64]}],[1,"gataca-ssibuttonws",{"buttonText":[1,"button-text"],"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"socketEndpoint":[1,"socket-endpoint"],"sessionTimeout":[2,"session-timeout"],"wsOnOpen":[16],"wsOnMessage":[16],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"open":[32],"getSessionData":[64]}]]],["gataca-autoqr.cjs",[[1,"gataca-autoqr",{"configId":[1,"config-id"],"configRepository":[1,"config-repository"],"successCallback":[16],"errorCallback":[16],"checkStatus":[16],"createSession":[16],"wsOnOpen":[16],"wsOnMessage":[16],"config":[32],"loading":[32],"getSessionData":[64]}]]]], options);
19
+ });