@gataca/qr 2.0.2 → 2.0.4

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 (84) hide show
  1. package/dist/cjs/gataca-autoqr.cjs.entry.js +105 -0
  2. package/dist/cjs/gataca-qr_2.cjs.entry.js +219 -0
  3. package/dist/cjs/gataca-qrws.cjs.entry.js +176 -0
  4. package/dist/cjs/gataca-ssibutton_2.cjs.entry.js +129 -0
  5. package/dist/cjs/gatacaqr.cjs.js +19 -0
  6. package/dist/cjs/index-4be0cdca.js +1435 -0
  7. package/dist/cjs/index.cjs.js +16 -0
  8. package/dist/cjs/loader.cjs.js +21 -0
  9. package/dist/cjs/logo_gataca-f3dc6840.js +14 -0
  10. package/dist/cjs/qr-code-styling-412bbc7a.js +28 -0
  11. package/dist/cjs/utils-383ee834.js +26 -0
  12. package/dist/collection/assets/icons/gat-icon-alert.svg +5 -0
  13. package/dist/collection/assets/icons/gat-icon-check.svg +5 -0
  14. package/dist/collection/assets/icons/gat-icon-refresh.svg +4 -0
  15. package/dist/collection/assets/images/logo_gataca.svg +26 -0
  16. package/dist/collection/collection-manifest.json +17 -0
  17. package/dist/collection/components/gataca-autoqr/gataca-autoqr.css +116 -0
  18. package/dist/collection/components/gataca-autoqr/gataca-autoqr.js +323 -0
  19. package/dist/collection/components/gataca-qr/gataca-qr.css +261 -0
  20. package/dist/collection/components/gataca-qr/gataca-qr.js +828 -0
  21. package/dist/collection/components/gataca-qrdisplay/gataca-qrdisplay.js +154 -0
  22. package/dist/collection/components/gataca-qrws/gataca-qrws.css +251 -0
  23. package/dist/collection/components/gataca-qrws/gataca-qrws.js +566 -0
  24. package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.css +116 -0
  25. package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.js +679 -0
  26. package/dist/collection/components/gataca-ssibuttonws/gataca-ssibuttonws.css +116 -0
  27. package/dist/collection/components/gataca-ssibuttonws/gataca-ssibuttonws.js +410 -0
  28. package/dist/collection/index.js +2 -0
  29. package/dist/collection/utils/index.js +1 -0
  30. package/dist/collection/utils/utils.js +21 -0
  31. package/dist/{gatacaqr/gat-icon-refresh-8d3dc25f.js → components/gat-icon-refresh.js} +23 -1
  32. package/dist/components/gataca-autoqr.js +161 -0
  33. package/dist/components/gataca-qr.js +6 -0
  34. package/dist/components/gataca-qr2.js +227 -0
  35. package/dist/components/gataca-qrdisplay.js +6 -0
  36. package/dist/components/gataca-qrdisplay2.js +93 -0
  37. package/dist/components/gataca-qrws.js +6 -0
  38. package/dist/components/gataca-qrws2.js +212 -0
  39. package/dist/components/gataca-ssibutton.js +6 -0
  40. package/dist/{gatacaqr/gataca-ssibutton.entry.js → components/gataca-ssibutton2.js} +83 -9
  41. package/dist/components/gataca-ssibuttonws.js +6 -0
  42. package/dist/{gatacaqr/gataca-ssibuttonws.entry.js → components/gataca-ssibuttonws2.js} +53 -7
  43. package/dist/components/index.js +8 -0
  44. package/dist/{gatacaqr → esm}/gataca-autoqr.entry.js +1 -1
  45. package/dist/esm/gataca-qr_2.entry.js +214 -0
  46. package/dist/{gatacaqr → esm}/gataca-qrws.entry.js +4 -4
  47. package/dist/esm/gataca-ssibutton_2.entry.js +124 -0
  48. package/dist/esm/gatacaqr.js +17 -0
  49. package/dist/esm/index-80311733.js +1409 -0
  50. package/dist/esm/index.js +1 -0
  51. package/dist/esm/loader.js +17 -0
  52. package/dist/esm/logo_gataca-57ad0363.js +9 -0
  53. package/dist/esm/polyfills/core-js.js +11 -0
  54. package/dist/esm/polyfills/css-shim.js +1 -0
  55. package/dist/esm/polyfills/dom.js +79 -0
  56. package/dist/esm/polyfills/es5-html-element.js +1 -0
  57. package/dist/esm/polyfills/index.js +34 -0
  58. package/dist/esm/polyfills/system.js +6 -0
  59. package/dist/esm/qr-code-styling-0eeb38d5.js +26 -0
  60. package/dist/gatacaqr/gatacaqr.esm.js +1 -129
  61. package/dist/gatacaqr/index.esm.js +1 -1
  62. package/dist/gatacaqr/p-0be4566d.js +1 -0
  63. package/dist/gatacaqr/p-5b17ef39.entry.js +1 -0
  64. package/dist/gatacaqr/p-5eb106c0.entry.js +1 -0
  65. package/dist/gatacaqr/p-66ad21ac.entry.js +1 -0
  66. package/dist/gatacaqr/p-6adc6933.js +1 -0
  67. package/dist/gatacaqr/p-a5648391.js +2 -0
  68. package/dist/gatacaqr/p-b834ef88.entry.js +1 -0
  69. package/dist/gatacaqr/p-b8ba109f.js +1 -0
  70. package/dist/index.cjs.js +1 -0
  71. package/dist/index.js +1 -0
  72. package/dist/types/components/gataca-qr/gataca-qr.d.ts +76 -1
  73. package/dist/types/components/gataca-ssibutton/gataca-ssibutton.d.ts +75 -0
  74. package/dist/types/components.d.ts +242 -2
  75. package/package.json +2 -2
  76. package/dist/gatacaqr/app-globals-0f993ce5.js +0 -3
  77. package/dist/gatacaqr/css-shim-8eec97b3.js +0 -4
  78. package/dist/gatacaqr/dom-1b0cf05d.js +0 -73
  79. package/dist/gatacaqr/gataca-qr.entry.js +0 -171
  80. package/dist/gatacaqr/gataca-qrdisplay-0320bb25.js +0 -97
  81. package/dist/gatacaqr/gataca-qrdisplay.entry.js +0 -2
  82. package/dist/gatacaqr/index-d0db23e4.js +0 -3262
  83. package/dist/gatacaqr/shadow-css-146f2f6f.js +0 -387
  84. /package/dist/{gatacaqr → esm}/utils-05ba6c9f.js +0 -0
@@ -0,0 +1,105 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-4be0cdca.js');
6
+
7
+ const gatacaAutoqrCss = "@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}";
8
+
9
+ const DEFAULT_REPOSITORY = "https://studio.gataca.io/api/v1/qrconfigs";
10
+ const fixFunctions = (data) => {
11
+ var _a, _b, _c, _d, _e, _f;
12
+ data.errorCallback = deserializeFunction((_a = data.errorCallback) === null || _a === void 0 ? void 0 : _a.toString());
13
+ data.successCallback = deserializeFunction((_b = data.successCallback) === null || _b === void 0 ? void 0 : _b.toString());
14
+ data.wsOnMessage = deserializeFunction((_c = data.wsOnMessage) === null || _c === void 0 ? void 0 : _c.toString());
15
+ data.wsOnOpen = deserializeFunction((_d = data.wsOnOpen) === null || _d === void 0 ? void 0 : _d.toString());
16
+ data.checkStatus = deserializeFunction((_e = data.checkStatus) === null || _e === void 0 ? void 0 : _e.toString());
17
+ data.createSession = deserializeFunction((_f = data.createSession) === null || _f === void 0 ? void 0 : _f.toString());
18
+ return data;
19
+ };
20
+ const deserializeFunction = (data) => {
21
+ if (data) {
22
+ return new Function("return " + data)();
23
+ }
24
+ return undefined;
25
+ };
26
+ const GatacaAutoQR = class {
27
+ constructor(hostRef) {
28
+ index.registerInstance(this, hostRef);
29
+ this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7);
30
+ this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7);
31
+ this.configId = undefined;
32
+ this.configRepository = DEFAULT_REPOSITORY;
33
+ this.successCallback = undefined;
34
+ this.errorCallback = undefined;
35
+ this.checkStatus = undefined;
36
+ this.createSession = undefined;
37
+ this.wsOnOpen = undefined;
38
+ this.wsOnMessage = undefined;
39
+ this.config = undefined;
40
+ this.loading = undefined;
41
+ this.loading = true;
42
+ fetch(this.configRepository + "/" + this.configId, {
43
+ method: "GET",
44
+ headers: {
45
+ "Content-Type": "application/json",
46
+ },
47
+ })
48
+ .then((response) => {
49
+ response
50
+ .json()
51
+ .then((data) => {
52
+ data = fixFunctions(data);
53
+ this.config = data;
54
+ this.loading = false;
55
+ })
56
+ .catch((err) => {
57
+ console.log("Cannot retrieve selected config", err);
58
+ this.loading = false;
59
+ });
60
+ })
61
+ .catch((err) => {
62
+ console.log("Cannot retrieve selected config", err);
63
+ this.loading = false;
64
+ });
65
+ }
66
+ /**
67
+ * Retrieve manually the session data on a successful login
68
+ */
69
+ async getSessionData() {
70
+ return this.qr.getSessionData();
71
+ }
72
+ selectQR() {
73
+ if (this.config.useButton) {
74
+ if (this.config.useWs) {
75
+ this.qr = (index.h("gataca-ssibuttonws", { buttonText: this.config.buttonText, wsOnMessage: this.wsOnMessage || this.config.wsOnMessage, wsOnOpen: this.wsOnOpen || this.config.wsOnOpen, successCallback: this.successCallback || this.config.successCallback, errorCallback: this.errorCallback || this.config.errorCallback, qrRole: this.config.qrRole, callbackServer: this.config.callbackServer, sessionTimeout: this.config.sessionTimeout, socketEndpoint: this.config.socketEndpoint, autostart: true, autorefresh: this.config.autorefresh, v2: this.config.v2, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
76
+ }
77
+ else {
78
+ this.qr = (index.h("gataca-ssibutton", { buttonText: this.config.buttonText, checkStatus: this.checkStatus || this.config.checkStatus, createSession: this.createSession || this.config.createSession, successCallback: this.successCallback || this.config.successCallback, errorCallback: this.errorCallback || this.config.errorCallback, qrRole: this.config.qrRole, callbackServer: this.config.callbackServer, sessionTimeout: this.config.sessionTimeout, pollingFrequency: this.config.pollingFrequency, autorefresh: this.config.autorefresh, v2: this.config.v2, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
79
+ }
80
+ }
81
+ else {
82
+ if (this.config.useWs) {
83
+ this.qr = (index.h("gataca-qrws", { wsOnMessage: this.wsOnMessage || this.config.wsOnMessage, wsOnOpen: this.wsOnOpen || this.config.wsOnOpen, successCallback: this.successCallback || this.config.successCallback, errorCallback: this.errorCallback || this.config.errorCallback, qrRole: this.config.qrRole, callbackServer: this.config.callbackServer, sessionTimeout: this.config.sessionTimeout, socketEndpoint: this.config.socketEndpoint, autostart: this.config.autostart, autorefresh: this.config.autorefresh, v2: this.config.v2, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
84
+ }
85
+ else {
86
+ this.qr = (index.h("gataca-qr", { checkStatus: this.checkStatus || this.config.checkStatus, createSession: this.createSession || this.config.createSession, successCallback: this.successCallback || this.config.successCallback, errorCallback: this.errorCallback || this.config.errorCallback, qrRole: this.config.qrRole, callbackServer: this.config.callbackServer, sessionTimeout: this.config.sessionTimeout, pollingFrequency: this.config.pollingFrequency, autostart: this.config.autostart, autorefresh: this.config.autorefresh, v2: this.config.v2, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
87
+ }
88
+ }
89
+ }
90
+ render() {
91
+ if (this.loading) {
92
+ //TODO: Improve loading message
93
+ return index.h("div", null, "Loading...");
94
+ }
95
+ if (this.config) {
96
+ this.selectQR();
97
+ return this.qr;
98
+ }
99
+ //TODO: Improve error message
100
+ return index.h("div", null, "Error loading your config...");
101
+ }
102
+ };
103
+ GatacaAutoQR.style = gatacaAutoqrCss;
104
+
105
+ exports.gataca_autoqr = GatacaAutoQR;
@@ -0,0 +1,219 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-4be0cdca.js');
6
+ const logo_gataca = require('./logo_gataca-f3dc6840.js');
7
+ const qrCodeStyling = require('./qr-code-styling-412bbc7a.js');
8
+ const utils = require('./utils-383ee834.js');
9
+
10
+ const GatacaQRDisplay = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.qrData = undefined;
14
+ this.size = 256;
15
+ this.logoSize = 0;
16
+ this.logoSrc = undefined;
17
+ this.qrColor = "#1E1E20";
18
+ this.rounded = true;
19
+ }
20
+ componentDidLoad() {
21
+ const qrCode = new qrCodeStyling.QRCodeStyling({
22
+ data: this.qrData,
23
+ width: this.size,
24
+ height: this.size,
25
+ image: this.logoSize > 0 ? this.logoSrc || logo_gataca.logoGatacaSvg : undefined,
26
+ margin: 10,
27
+ type: "svg",
28
+ dotsOptions: {
29
+ color: this.qrColor,
30
+ type: this.rounded ? "dots" : "square",
31
+ },
32
+ cornersSquareOptions: {
33
+ type: this.rounded ? "extra-rounded" : "square",
34
+ },
35
+ cornersDotOptions: {
36
+ type: this.rounded ? "dot" : "square",
37
+ },
38
+ imageOptions: {
39
+ margin: 2,
40
+ imageSize: this.logoSize,
41
+ },
42
+ });
43
+ qrCode.append(this.qr);
44
+ }
45
+ render() {
46
+ return (index.h("div", { ref: (el) => {
47
+ this.qr = el;
48
+ } }));
49
+ }
50
+ };
51
+
52
+ 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=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 .modal-window{position:relative;border-radius:6px;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;width:300px;padding:1px;background-color:white;min-height:350px;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 p{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;color:#1e1e20}.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-weight:400;font-size:14px;line-height:16.5px;padding-top:12px;padding-bottom:5px;color:#A1A1A1}.popUpContainer .modal-window .bold{font-weight:600}.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 .reload{height:252px;width:252px;border:1px dashed #A1A1A1;border-radius:12px;position:relative;margin:24px;display:flex;justify-content:center;align-items:center}.popUpContainer #qrwait{display:flex;justify-content:center}.popUpContainer #qrwait,.popUpContainer #notify{width:100%;height:100%;top:0;left:0;border-radius:20px}.popUpContainer #notify{z-index:10;background-color:gray;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;align-self:center;display:flex;flex-direction:column;padding:24px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:20px;background:rgba(255, 255, 255, 0.9);}.popUpContainer .notify-text{font-family:\"Work Sans\";font-style:normal;font-weight:400;font-size:14px;line-height:16px;text-align:center;font-feature-settings:\"salt\" on;color:#8B8B8B;flex:none;order:1;align-self:stretch;flex-grow:0}.popUpContainer .alert{display:flex;flex-direction:row;align-items:center;justify-content:start;width:252px;position:absolute;bottom:0;background:#FFE5E5;border-radius:12px}.popUpContainer .alert img{margin:12px}.popUpContainer .alert p{font-weight:400;font-size:14px;line-height:16px;color:black}.popUpContainer .success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.popUpContainer .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;}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}";
53
+
54
+ const DEEP_LINK_PREFIX = "https://gataca.page.link/?apn=com.gatacaapp&ibi=com.gataca.wallet&link=";
55
+ //Default values
56
+ const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
57
+ const DEFAULT_POLLING_FREQ = 3;
58
+ const QR_ROLE_CONNECT = "connect";
59
+ const FUNCTION_ROLES = {
60
+ connect: "scan",
61
+ certify: "credential",
62
+ };
63
+ const GatacaQR = class {
64
+ 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.qrRole = undefined; this.callbackServer = undefined; this.autostart = true; this.autorefresh = false; this.v2 = false; this.qrModalTitle = "Quick Access"; this.modalTitleColor = "#4745B7"; this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet"; this.hideBrandTitle = false; this.logoSize = 0; this.logoSrc = logo_gataca.logoGatacaSvg; 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.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; }
65
+ disconnectedCallback() {
66
+ this.stop();
67
+ }
68
+ async componentDidLoad() {
69
+ if (this.autostart) {
70
+ await this.display();
71
+ }
72
+ }
73
+ /**
74
+ * Force manually the display of a QR
75
+ */
76
+ async display() {
77
+ await this.getSessionId();
78
+ this.result = utils.RESULT_STATUS.ONGOING;
79
+ this.poll()
80
+ .then((data) => {
81
+ this.result = utils.RESULT_STATUS.SUCCESS;
82
+ this.sessionData = data;
83
+ this.gatacaLoginCompleted.emit(data);
84
+ this.successCallback(data);
85
+ })
86
+ .catch((err) => {
87
+ this.clean();
88
+ let expired = err === utils.RESULT_STATUS.EXPIRED;
89
+ if (expired && this.autorefresh) {
90
+ this.display();
91
+ }
92
+ else {
93
+ if (err !== utils.RESULT_STATUS.NOT_STARTED) {
94
+ let error = expired
95
+ ? new Error(this.userNotScanInTimeErrorLabel)
96
+ : new Error(this.credsNotValidatedErrorLabel);
97
+ this.result = err;
98
+ this.gatacaLoginFailed.emit(error);
99
+ this.errorCallback(error);
100
+ }
101
+ }
102
+ });
103
+ if (utils.checkMobile() && this.dynamicLink) {
104
+ window.location.href = this.getLink();
105
+ }
106
+ }
107
+ /**
108
+ * Stop manually an ongoing session
109
+ */
110
+ async stop() {
111
+ this.clean();
112
+ if (this.result === utils.RESULT_STATUS.ONGOING) {
113
+ this.result = utils.RESULT_STATUS.NOT_STARTED;
114
+ }
115
+ }
116
+ clean() {
117
+ this.sessionData = undefined;
118
+ this.sessionId = undefined;
119
+ }
120
+ /**
121
+ * Retrieve manually the session data on a successful login
122
+ */
123
+ async getSessionData() {
124
+ return this.sessionData
125
+ ? Promise.resolve(this.sessionData)
126
+ : Promise.reject(new Error(this.failedLoginErrorLabel));
127
+ }
128
+ async getSessionId() {
129
+ if (this.sessionId) {
130
+ return this.sessionId;
131
+ }
132
+ let { sessionId, authenticationRequest } = await this.createSession();
133
+ this.sessionId = sessionId;
134
+ this.authenticationRequest = authenticationRequest;
135
+ return this.sessionId;
136
+ }
137
+ getLink() {
138
+ if (this.v2) {
139
+ return this.authenticationRequest;
140
+ }
141
+ let op = FUNCTION_ROLES[this.qrRole];
142
+ let link = "https://gataca.page.link/" + op + "?";
143
+ link +=
144
+ this.qrRole === QR_ROLE_CONNECT
145
+ ? "session=" + this.sessionId
146
+ : "process=" + this.sessionId;
147
+ link +=
148
+ "&callback=" + utils.base64UrlEncode(encodeURIComponent(this.callbackServer));
149
+ link = encodeURIComponent(link);
150
+ return this.dynamicLink ? DEEP_LINK_PREFIX + link : link;
151
+ }
152
+ async poll() {
153
+ let endTime = new Date().getTime() +
154
+ (this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
155
+ let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
156
+ let checkFunc = async (component) => {
157
+ if (component.result === utils.RESULT_STATUS.NOT_STARTED) {
158
+ return { result: utils.RESULT_STATUS.NOT_STARTED };
159
+ }
160
+ let id = await component.getSessionId();
161
+ return component.checkStatus(id);
162
+ };
163
+ let component = this;
164
+ let checkCondition = async function (resolve, reject) {
165
+ // If the condition is met, we're done!
166
+ let { result, data } = await checkFunc(component);
167
+ switch (result) {
168
+ case utils.RESULT_STATUS.SUCCESS:
169
+ resolve(data);
170
+ break;
171
+ case utils.RESULT_STATUS.ONGOING:
172
+ if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
173
+ setTimeout(checkCondition, interval, resolve, reject);
174
+ }
175
+ else {
176
+ reject(utils.RESULT_STATUS.EXPIRED);
177
+ }
178
+ break;
179
+ default:
180
+ reject(result);
181
+ break;
182
+ }
183
+ };
184
+ return new Promise(checkCondition);
185
+ }
186
+ renderQRSection() {
187
+ switch (this.result) {
188
+ case utils.RESULT_STATUS.NOT_STARTED:
189
+ return this.renderRetryButton();
190
+ case utils.RESULT_STATUS.ONGOING:
191
+ return this.renderQR(this.getLink(), 300, true);
192
+ case utils.RESULT_STATUS.EXPIRED:
193
+ return this.renderRetryButton(this.qrCodeExpiredLabel);
194
+ case utils.RESULT_STATUS.FAILED:
195
+ return this.renderRetryButton(this.credentialsNotValidatedLabel);
196
+ case utils.RESULT_STATUS.SUCCESS:
197
+ return this.renderSuccess();
198
+ }
199
+ }
200
+ renderSuccess() {
201
+ return (index.h("div", { class: "success" }, index.h("img", { src: logo_gataca.gatIconCheckSvg, height: 52, width: 52 }), index.h("p", { class: "successMsg" }, this.successLoginLabel)));
202
+ }
203
+ renderRetryButton(errorMessage) {
204
+ return (index.h("div", { class: "reload" }, index.h("div", { id: "notify", onClick: () => this.display() }, index.h("img", { src: logo_gataca.gatIconRefreshSvg, height: 24, width: 24 }), index.h("p", { class: "qrDescription" }, this.clickInsideBoxLabel, " "), errorMessage ? (index.h("p", { class: "qrDescription bold" }, this.refreshQrLabel)) : (index.h("p", { class: "qrDescription bold" }, this.scanQrLabel, "e")), errorMessage && (index.h("div", { class: "alert" }, index.h("img", { src: logo_gataca.gatIconAlertSvg, height: 24, width: 24 }), index.h("p", null, errorMessage)))), index.h("div", { id: "qrwait" }, this.renderQR(this.waitingStartSessionLabel, 250))));
205
+ }
206
+ renderQR(value, size, useLogo) {
207
+ return (index.h("gataca-qrdisplay", { qrData: value, rounded: true, size: size, "logo-size": useLogo ? 0.33 : 0, "logo-src": this.logoSrc }));
208
+ }
209
+ render() {
210
+ return (index.h("div", { class: "popUpContainer" }, index.h("div", { class: "modal-window is-visible", onClick: (event) => {
211
+ event.stopPropagation();
212
+ } }, index.h("div", { class: "modal-window__content" }, index.h("div", { class: "qrTitleContainer" }, index.h("p", { class: "qrTitle", style: { color: this.modalTitleColor || "#1e1e20" } }, this.qrModalTitle), !this.hideBrandTitle && (index.h("p", { class: "qrBrand" }, this.byBrandLabel, " ", index.h("span", null, index.h("img", { src: logo_gataca.logoGatacaSvg })))), this.result !== utils.RESULT_STATUS.SUCCESS &&
213
+ !this.hideQrModalDescription && (index.h("p", { class: "qrDescription" }, this.qrModalDescription))), index.h("div", { class: "qrSection" }, this.renderQRSection())))));
214
+ }
215
+ };
216
+ GatacaQR.style = gatacaQrCss;
217
+
218
+ exports.gataca_qr = GatacaQR;
219
+ exports.gataca_qrdisplay = GatacaQRDisplay;
@@ -0,0 +1,176 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-4be0cdca.js');
6
+ const logo_gataca = require('./logo_gataca-f3dc6840.js');
7
+ require('./qr-code-styling-412bbc7a.js');
8
+ const utils = require('./utils-383ee834.js');
9
+
10
+ const gatacaQrwsCss = "@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 .modal-window{position:relative;border-radius:6px;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;width:300px;min-height:408px;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 p{font-family:\"Work Sans\", \"Helvetica Neue\", sans-serif;font-weight:normal;font-size:12px;letter-spacing:1px;color:#1e1e20}.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-weight:400;font-size:14px;line-height:16.5px;padding-top:12px;padding-bottom:5px;color:#A1A1A1}.popUpContainer .modal-window .bold{font-weight:600}.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 .reload{height:252px;width:252px;border:1px dashed #A1A1A1;border-radius:12px;position:relative;margin:24px;display:flex;justify-content:center;align-items:center}.popUpContainer #qrwait{display:flex;justify-content:center}.popUpContainer #qrwait,.popUpContainer #notify{width:100%;height:100%;top:0;left:0;border-radius:20px}.popUpContainer #notify{z-index:10;background-color:gray;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;align-self:center;display:flex;flex-direction:column;padding:24px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:20px;background:rgba(255, 255, 255, 0.9);}.popUpContainer .notify-text{font-family:\"Work Sans\";font-style:normal;font-weight:400;font-size:14px;line-height:16px;text-align:center;font-feature-settings:\"salt\" on;color:#8B8B8B;flex:none;order:1;align-self:stretch;flex-grow:0}.popUpContainer .alert{display:flex;flex-direction:row;align-items:center;justify-content:start;width:252px;position:absolute;bottom:0;background:#FFE5E5;border-radius:12px}.popUpContainer .alert img{margin:12px}.popUpContainer .alert p{font-weight:400;font-size:14px;line-height:16px;color:black}.popUpContainer .success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.popUpContainer .success .successMsg{margin-top:20px;font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}";
11
+
12
+ const DEEP_LINK_PREFIX = "https://gataca.page.link/?apn=com.gatacaapp&ibi=com.gataca.wallet&link=";
13
+ const DEFAULT_SESSION_TIMEOUT = 300;
14
+ const QR_ROLE_CONNECT = "connect";
15
+ const FUNCTION_ROLES = {
16
+ connect: "scan",
17
+ certify: "credential",
18
+ };
19
+ const GatacaQRWS = class {
20
+ 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.v2 = false; this.qrModalTitle = "Quick Access"; this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet"; this.hideBrandTitle = false; this.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = utils.RESULT_STATUS.NOT_STARTED; }
21
+ disconnectedCallback() {
22
+ this.stop();
23
+ }
24
+ async componentDidLoad() {
25
+ if (this.autostart) {
26
+ await this.display();
27
+ }
28
+ }
29
+ /**
30
+ * Force manually the display of a QR
31
+ */
32
+ async display() {
33
+ let socket = new WebSocket(this.socketEndpoint);
34
+ setTimeout(() => {
35
+ this.socket.close(1000, "");
36
+ }, 1000 * this.sessionTimeout);
37
+ this.socket = socket;
38
+ socket.onopen = () => {
39
+ if (this.wsOnOpen)
40
+ this.wsOnOpen(this.socket);
41
+ };
42
+ socket.onmessage = (msg) => {
43
+ if (this.wsOnMessage) {
44
+ this.wsOnMessage(this.socket, msg);
45
+ }
46
+ else {
47
+ let wsresp = JSON.parse(msg.data);
48
+ if (!!wsresp.sessionId) {
49
+ this.handleWSResponse(wsresp);
50
+ }
51
+ }
52
+ };
53
+ socket.onerror = () => {
54
+ let error = new Error("Error connecting with server");
55
+ this.result = utils.RESULT_STATUS.FAILED;
56
+ this.gatacaLoginFailed.emit(error);
57
+ this.errorCallback(error);
58
+ socket.close(1000, "");
59
+ };
60
+ socket.onclose = () => {
61
+ if (this.result === utils.RESULT_STATUS.ONGOING) {
62
+ this.result = utils.RESULT_STATUS.EXPIRED;
63
+ }
64
+ if (this.result === utils.RESULT_STATUS.EXPIRED) {
65
+ if (this.autorefresh) {
66
+ this.display();
67
+ }
68
+ else {
69
+ let error = new Error("User did not scan the QR in the alloted time");
70
+ this.gatacaLoginFailed.emit(error);
71
+ this.errorCallback(error);
72
+ }
73
+ }
74
+ };
75
+ if (utils.checkMobile() && this.dynamicLink) {
76
+ window.location.href = this.getLink();
77
+ }
78
+ }
79
+ sessionMsgReceived(event) {
80
+ let wsresp = event.detail;
81
+ this.handleWSResponse(wsresp);
82
+ }
83
+ handleWSResponse(wsresp) {
84
+ this.result = wsresp.result;
85
+ switch (wsresp.result) {
86
+ case utils.RESULT_STATUS.ONGOING:
87
+ this.sessionId = wsresp.sessionId;
88
+ this.authenticationRequest = wsresp.authenticationRequest;
89
+ break;
90
+ case utils.RESULT_STATUS.SUCCESS:
91
+ this.sessionData = wsresp.authenticatedUserData;
92
+ this.gatacaLoginCompleted.emit(wsresp.authenticatedUserData);
93
+ this.successCallback(wsresp.authenticatedUserData);
94
+ this.socket.close(1000, "");
95
+ break;
96
+ case utils.RESULT_STATUS.FAILED:
97
+ this.socket.close();
98
+ let error = new Error("Provided user credentials couldn't be validated");
99
+ this.gatacaLoginFailed.emit(error);
100
+ this.errorCallback(error);
101
+ break;
102
+ case utils.RESULT_STATUS.EXPIRED:
103
+ this.socket.close();
104
+ if (this.autorefresh) {
105
+ this.display();
106
+ }
107
+ else {
108
+ let error = new Error("User did not scan the QR in the alloted time");
109
+ this.gatacaLoginFailed.emit(error);
110
+ this.errorCallback(error);
111
+ }
112
+ }
113
+ }
114
+ /**
115
+ * Stop manually an ongoing session
116
+ */
117
+ async stop() {
118
+ this.sessionData = undefined;
119
+ this.sessionId = undefined;
120
+ this.socket.close(1000, "Client stopped the connection");
121
+ }
122
+ /**
123
+ * Retrieve manually the session data on a successful login
124
+ */
125
+ async getSessionData() {
126
+ return this.sessionData
127
+ ? Promise.resolve(this.sessionData)
128
+ : Promise.reject(new Error("No successful login"));
129
+ }
130
+ getLink() {
131
+ if (this.v2 && this.qrRole == QR_ROLE_CONNECT) {
132
+ return this.authenticationRequest;
133
+ }
134
+ let op = FUNCTION_ROLES[this.qrRole];
135
+ let link = "https://gataca.page.link/" + op + "?";
136
+ link +=
137
+ this.qrRole === QR_ROLE_CONNECT
138
+ ? "session=" + this.sessionId
139
+ : "process=" + this.sessionId;
140
+ link +=
141
+ "&callback=" + utils.base64UrlEncode(encodeURIComponent(this.callbackServer));
142
+ link = encodeURIComponent(link);
143
+ return this.dynamicLink ? DEEP_LINK_PREFIX + link : link;
144
+ }
145
+ renderQRSection() {
146
+ switch (this.result) {
147
+ case utils.RESULT_STATUS.NOT_STARTED:
148
+ return this.renderRetryButton();
149
+ case utils.RESULT_STATUS.ONGOING:
150
+ return this.renderQR(this.getLink(), 300, true);
151
+ case utils.RESULT_STATUS.EXPIRED:
152
+ return this.renderRetryButton("QR Code expired");
153
+ case utils.RESULT_STATUS.FAILED:
154
+ return this.renderRetryButton("User credentials not validated");
155
+ case utils.RESULT_STATUS.SUCCESS:
156
+ return this.renderSuccess();
157
+ }
158
+ }
159
+ renderSuccess() {
160
+ return (index.h("div", { class: "success" }, index.h("img", { src: logo_gataca.gatIconCheckSvg, height: 52, width: 52 }), index.h("p", { class: "successMsg" }, "Successful Connection!")));
161
+ }
162
+ renderRetryButton(errorMessage) {
163
+ return (index.h("div", { class: "reload" }, index.h("div", { id: "notify", onClick: () => this.display() }, index.h("img", { src: logo_gataca.gatIconRefreshSvg, height: 24, width: 24 }), index.h("p", { class: "qrDescription" }, "Click inside the box to "), errorMessage ? (index.h("p", { class: "qrDescription bold" }, "Refresh QR Code")) : (index.h("p", { class: "qrDescription bold" }, "Scan QR Code")), errorMessage && (index.h("div", { class: "alert" }, index.h("img", { src: logo_gataca.gatIconAlertSvg, height: 24, width: 24 }), index.h("p", null, errorMessage)))), index.h("div", { id: "qrwait" }, this.renderQR("waiting to start a session", 250))));
164
+ }
165
+ renderQR(value, size, useLogo) {
166
+ return (index.h("gataca-qrdisplay", { qrData: value, rounded: true, size: size, "logo-size": useLogo ? 0.33 : 0 }));
167
+ }
168
+ render() {
169
+ return (index.h("div", { class: "popUpContainer" }, index.h("div", { class: "modal-window is-visible", onClick: (event) => {
170
+ event.stopPropagation();
171
+ } }, index.h("div", { class: "modal-window__content" }, index.h("div", { class: "qrTitleContainer" }, index.h("p", { class: "qrTitle" }, this.qrModalTitle), !this.hideBrandTitle && (index.h("p", { class: "qrBrand" }, "by Gataca", " ", index.h("span", null, index.h("img", { src: logo_gataca.logoGatacaSvg })))), this.result !== utils.RESULT_STATUS.SUCCESS && (index.h("p", { class: "qrDescription" }, this.qrModalDescription))), index.h("div", { class: "qrSection" }, this.renderQRSection())))));
172
+ }
173
+ };
174
+ GatacaQRWS.style = gatacaQrwsCss;
175
+
176
+ exports.gataca_qrws = GatacaQRWS;
@@ -0,0 +1,129 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-4be0cdca.js');
6
+ require('./qr-code-styling-412bbc7a.js');
7
+
8
+ 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}";
9
+
10
+ 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=";
11
+ const GatacaSSIButton = class {
12
+ constructor(hostRef) {
13
+ index.registerInstance(this, hostRef);
14
+ this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7);
15
+ this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7);
16
+ this.buttonText = "Easy login";
17
+ this.checkStatus = undefined;
18
+ this.createSession = undefined;
19
+ this.successCallback = undefined;
20
+ this.errorCallback = undefined;
21
+ this.qrRole = undefined;
22
+ this.callbackServer = undefined;
23
+ this.sessionTimeout = undefined;
24
+ this.pollingFrequency = undefined;
25
+ this.autorefresh = false;
26
+ this.v2 = false;
27
+ this.qrModalTitle = "Quick Access";
28
+ this.modalTitleColor = "#4745B7";
29
+ this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
30
+ this.hideBrandTitle = false;
31
+ this.dynamicLink = true;
32
+ this.logoSize = 0;
33
+ this.logoSrc = undefined;
34
+ this.qrCodeExpiredLabel = "QR Code expired";
35
+ this.credentialsNotValidatedLabel = "User credentials not validated";
36
+ this.clickInsideBoxLabel = "Click inside the box to";
37
+ this.refreshQrLabel = "Refresh QR Code";
38
+ this.scanQrLabel = "Scan QR Code";
39
+ this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time";
40
+ this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated";
41
+ this.failedLoginErrorLabel = "No successful login";
42
+ this.successLoginLabel = "Successful Connection!";
43
+ this.byBrandLabel = "by Gataca";
44
+ this.waitingStartSessionLabel = "waiting to start a session";
45
+ this.hideQrModalDescription = false;
46
+ this.open = false;
47
+ this.qr = (index.h("gataca-qr", { 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, v2: this.v2, 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 }));
48
+ }
49
+ /**
50
+ * Retrieve manually the session data on a successful login
51
+ */
52
+ async getSessionData() {
53
+ return this.qr.getSessionData();
54
+ }
55
+ renderModal() {
56
+ return this.qr;
57
+ }
58
+ renderButton() {
59
+ return (index.h("div", { class: "gatacaButtonWrapper" }, index.h("button", { class: "gatacaButton", onClick: () => {
60
+ this.open = !this.open;
61
+ if (this.open) {
62
+ this.qr.display();
63
+ }
64
+ else {
65
+ this.qr.stop();
66
+ }
67
+ } }, index.h("img", { src: PHONE_ICON$1, class: "buttonImg", alt: this.buttonText }), index.h("span", null, this.buttonText))));
68
+ }
69
+ render() {
70
+ return (index.h("div", { class: "buttonContainer" }, this.renderButton(), this.open && this.renderModal()));
71
+ }
72
+ };
73
+ GatacaSSIButton.style = gatacaSsibuttonCss;
74
+
75
+ 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}";
76
+
77
+ 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=";
78
+ const GatacaSSIButtonWS = class {
79
+ constructor(hostRef) {
80
+ index.registerInstance(this, hostRef);
81
+ this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7);
82
+ this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7);
83
+ this.buttonText = "Easy login";
84
+ this.successCallback = undefined;
85
+ this.errorCallback = undefined;
86
+ this.qrRole = undefined;
87
+ this.callbackServer = undefined;
88
+ this.socketEndpoint = undefined;
89
+ this.sessionTimeout = undefined;
90
+ this.wsOnOpen = undefined;
91
+ this.wsOnMessage = undefined;
92
+ this.autostart = true;
93
+ this.autorefresh = false;
94
+ this.v2 = false;
95
+ this.qrModalTitle = "Quick Access";
96
+ this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
97
+ this.hideBrandTitle = false;
98
+ this.dynamicLink = true;
99
+ this.open = false;
100
+ 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, v2: this.v2, qrModalTitle: this.qrModalTitle, qrModalDescription: this.qrModalDescription, hideBrandTitle: this.hideBrandTitle, dynamicLink: this.dynamicLink }));
101
+ }
102
+ /**
103
+ * Retrieve manually the session data on a successful login
104
+ */
105
+ async getSessionData() {
106
+ return this.qr.getSessionData();
107
+ }
108
+ renderModal() {
109
+ return this.qr;
110
+ }
111
+ renderButton() {
112
+ return (index.h("div", { class: "gatacaButtonWrapper" }, index.h("button", { class: "gatacaButton", onClick: () => {
113
+ this.open = !this.open;
114
+ if (this.open) {
115
+ this.qr.display();
116
+ }
117
+ else {
118
+ this.qr.stop();
119
+ }
120
+ } }, index.h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), index.h("span", null, this.buttonText))));
121
+ }
122
+ render() {
123
+ return (index.h("div", { class: "buttonContainer" }, this.renderButton(), this.open && this.renderModal()));
124
+ }
125
+ };
126
+ GatacaSSIButtonWS.style = gatacaSsibuttonwsCss;
127
+
128
+ exports.gataca_ssibutton = GatacaSSIButton;
129
+ exports.gataca_ssibuttonws = GatacaSSIButtonWS;