@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,318 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+ import { d as defineCustomElement$1 } from './gataca-qrdisplay2.js';
3
+ import { R as RESULT_STATUS } from './gat-icon-alert.js';
4
+ import { d as defineCustomElement$2 } from './gataca-qr2.js';
5
+
6
+ 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}";
7
+
8
+ 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=";
9
+ //Default values
10
+ const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
11
+ const DEFAULT_POLLING_FREQ = 3;
12
+ const GatacaSSIButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
13
+ constructor() {
14
+ super();
15
+ this.__registerHost();
16
+ this.__attachShadow();
17
+ this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
18
+ this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
19
+ this.buttonText = "Easy login";
20
+ this.checkStatus = undefined;
21
+ this.createSession = undefined;
22
+ this.successCallback = undefined;
23
+ this.errorCallback = undefined;
24
+ this.handleCheckAppLoading = undefined;
25
+ this.checkAppTimeout = 6;
26
+ this.qrRole = undefined;
27
+ this.callbackServer = undefined;
28
+ this.sessionTimeout = undefined;
29
+ this.pollingFrequency = undefined;
30
+ this.autorefresh = false;
31
+ this.v = "3";
32
+ this.qrModalTitle = "Quick Access";
33
+ this.modalTitleColor = "#4745B7";
34
+ this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
35
+ this.hideBrandTitle = false;
36
+ this.dynamicLink = true;
37
+ this.logoSize = 0;
38
+ this.logoSrc = undefined;
39
+ this.qrCodeExpiredLabel = "QR Code expired";
40
+ this.credentialsNotValidatedLabel = "User credentials not validated";
41
+ this.clickInsideBoxLabel = "Click inside the box to";
42
+ this.refreshQrLabel = "Refresh QR Code";
43
+ this.scanQrLabel = "Scan QR Code";
44
+ this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time";
45
+ this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated";
46
+ this.failedLoginErrorLabel = "No successful login";
47
+ this.successLoginLabel = "Successful Connection!";
48
+ this.byBrandLabel = "by Gataca";
49
+ this.waitingStartSessionLabel = "waiting to start a session";
50
+ this.hideQrModalDescription = false;
51
+ this.open = false;
52
+ this.sessionId = undefined;
53
+ this.authenticationRequest = undefined;
54
+ this.sessionData = undefined;
55
+ this.result = RESULT_STATUS.NOT_STARTED;
56
+ this.qr = (h("gataca-qr", { ref: (el) => (this.qrElement = el), checkStatus: this.checkStatus, createSession: this.createSession, successCallback: this.successCallback, errorCallback: this.errorCallback, qrRole: this.qrRole, 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 }));
57
+ }
58
+ /**
59
+ * Retrieve manually the session data on a successful login
60
+ */
61
+ async getSessionData() {
62
+ return this.qr.getSessionData();
63
+ }
64
+ async getSessionId() {
65
+ if (this.sessionId) {
66
+ return this.sessionId;
67
+ }
68
+ let { sessionId, authenticationRequest } = await this.createSession();
69
+ this.sessionId = sessionId;
70
+ this.authenticationRequest = authenticationRequest;
71
+ return this.sessionId;
72
+ }
73
+ /**
74
+ * Force manually the start polling
75
+ */
76
+ async startMobilePolling() {
77
+ await this.getSessionId();
78
+ this.result = RESULT_STATUS.ONGOING;
79
+ this.poll()
80
+ .then((data) => {
81
+ this.result = 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 === RESULT_STATUS.EXPIRED;
89
+ if (expired && this.autorefresh) {
90
+ this.startMobilePolling();
91
+ }
92
+ else {
93
+ if (err !== 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
+ }
104
+ /**
105
+ * Stop manually an ongoing session
106
+ */
107
+ async stop() {
108
+ this.clean();
109
+ if (this.result === RESULT_STATUS.ONGOING || RESULT_STATUS.READ) {
110
+ this.result = RESULT_STATUS.NOT_STARTED;
111
+ }
112
+ }
113
+ clean() {
114
+ this.sessionData = undefined;
115
+ this.sessionId = undefined;
116
+ }
117
+ renderModal() {
118
+ return this.qr;
119
+ }
120
+ async poll() {
121
+ let endTime = new Date().getTime() +
122
+ (this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
123
+ let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
124
+ let checkFunc = async (component) => {
125
+ if (component.result === RESULT_STATUS.NOT_STARTED) {
126
+ return { result: RESULT_STATUS.NOT_STARTED };
127
+ }
128
+ let id = await component.getSessionId();
129
+ return component.checkStatus(id);
130
+ };
131
+ let component = this;
132
+ let checkCondition = async function (resolve, reject) {
133
+ // If the condition is met, we're done!
134
+ let { result, data } = await checkFunc(component);
135
+ switch (result) {
136
+ case RESULT_STATUS.SUCCESS:
137
+ resolve(data);
138
+ break;
139
+ case RESULT_STATUS.READ:
140
+ component.result = RESULT_STATUS.READ;
141
+ case RESULT_STATUS.ONGOING:
142
+ if (component.sessionTimeout > 0 && new Date().getTime() < endTime) {
143
+ setTimeout(checkCondition, interval, resolve, reject);
144
+ }
145
+ else {
146
+ reject(RESULT_STATUS.EXPIRED);
147
+ }
148
+ break;
149
+ default:
150
+ reject(result);
151
+ break;
152
+ }
153
+ };
154
+ return new Promise(checkCondition);
155
+ }
156
+ isAppInstalled(appScheme, callback) {
157
+ let timeout;
158
+ let detected = false;
159
+ if (appScheme === null || appScheme === void 0 ? void 0 : appScheme.length) {
160
+ window.location.href = appScheme;
161
+ }
162
+ const waitTimeToCheckApp = this.checkAppTimeout * 1000;
163
+ setTimeout(() => {
164
+ if (!detected) {
165
+ callback(false);
166
+ }
167
+ cleanup();
168
+ }, waitTimeToCheckApp);
169
+ const handleVisibilityChange = () => {
170
+ if (document.hidden) {
171
+ detected = true;
172
+ callback(true);
173
+ this.startMobilePolling();
174
+ cleanup();
175
+ }
176
+ };
177
+ document.addEventListener("visibilitychange", handleVisibilityChange);
178
+ function cleanup() {
179
+ clearTimeout(timeout);
180
+ document.removeEventListener("visibilitychange", handleVisibilityChange);
181
+ }
182
+ }
183
+ renderDesktopButton() {
184
+ return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
185
+ this.open = !this.open;
186
+ setTimeout(() => {
187
+ var _a, _b;
188
+ if (this.open) {
189
+ (_a = this.qrElement) === null || _a === void 0 ? void 0 : _a.display();
190
+ }
191
+ else {
192
+ (_b = this.qrElement) === null || _b === void 0 ? void 0 : _b.stop();
193
+ }
194
+ }, 0);
195
+ } }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
196
+ }
197
+ async getAuthRequest() {
198
+ let { authenticationRequest } = await this.createSession();
199
+ return authenticationRequest;
200
+ }
201
+ renderMobileButton(isAndroid, isIos) {
202
+ let loading = false;
203
+ const handleLoading = (isLoading) => {
204
+ loading = isLoading;
205
+ if (this.handleCheckAppLoading) {
206
+ this.handleCheckAppLoading(isLoading);
207
+ }
208
+ };
209
+ const executeRedirection = async () => {
210
+ handleLoading(true);
211
+ const androidStoreLink = "https://play.google.com/store/apps/details?id=com.gataca.identity";
212
+ const iosStoreLink = "https://apps.apple.com/us/app/gataca/id1498607616";
213
+ try {
214
+ const appScheme = await this.getAuthRequest();
215
+ this.isAppInstalled(appScheme, (installed) => {
216
+ if (!installed) {
217
+ this.stop();
218
+ if (isAndroid) {
219
+ window.location.href = androidStoreLink;
220
+ }
221
+ else if (isIos) {
222
+ window.location.href = iosStoreLink;
223
+ }
224
+ }
225
+ handleLoading(false);
226
+ });
227
+ }
228
+ catch (error) {
229
+ this.stop();
230
+ handleLoading(false);
231
+ }
232
+ };
233
+ return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
234
+ executeRedirection();
235
+ }, disabled: loading }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
236
+ }
237
+ render() {
238
+ const userAgent =
239
+ // @ts-ignore
240
+ (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);
241
+ const isAndroid = /android/i.test(userAgent);
242
+ const isIos =
243
+ // @ts-ignore
244
+ (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) ||
245
+ (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
246
+ const isMobile = isAndroid || isIos;
247
+ return (h("div", { class: "buttonContainer" }, isMobile && this.v === "3"
248
+ ? this.renderMobileButton(isAndroid, isIos)
249
+ : this.renderDesktopButton(), this.open && (!isMobile || this.v === "3") && this.renderModal()));
250
+ }
251
+ static get style() { return gatacaSsibuttonCss; }
252
+ }, [1, "gataca-ssibutton", {
253
+ "buttonText": [1, "button-text"],
254
+ "checkStatus": [16],
255
+ "createSession": [16],
256
+ "successCallback": [16],
257
+ "errorCallback": [16],
258
+ "handleCheckAppLoading": [16],
259
+ "checkAppTimeout": [2, "check-app-timeout"],
260
+ "qrRole": [1, "qr-role"],
261
+ "callbackServer": [1, "callback-server"],
262
+ "sessionTimeout": [2, "session-timeout"],
263
+ "pollingFrequency": [2, "polling-frequency"],
264
+ "autorefresh": [4],
265
+ "v": [1],
266
+ "qrModalTitle": [1, "qr-modal-title"],
267
+ "modalTitleColor": [1, "modal-title-color"],
268
+ "qrModalDescription": [1, "qr-modal-description"],
269
+ "hideBrandTitle": [4, "hide-brand-title"],
270
+ "dynamicLink": [4, "dynamic-link"],
271
+ "logoSize": [2, "logo-size"],
272
+ "logoSrc": [1, "logo-src"],
273
+ "qrCodeExpiredLabel": [1, "qr-code-expired-label"],
274
+ "credentialsNotValidatedLabel": [1, "credentials-not-validated-label"],
275
+ "clickInsideBoxLabel": [1, "click-inside-box-label"],
276
+ "refreshQrLabel": [1, "refresh-qr-label"],
277
+ "scanQrLabel": [1, "scan-qr-label"],
278
+ "userNotScanInTimeErrorLabel": [1, "user-not-scan-in-time-error-label"],
279
+ "credsNotValidatedErrorLabel": [1, "creds-not-validated-error-label"],
280
+ "failedLoginErrorLabel": [1, "failed-login-error-label"],
281
+ "successLoginLabel": [1, "success-login-label"],
282
+ "byBrandLabel": [1, "by-brand-label"],
283
+ "waitingStartSessionLabel": [1, "waiting-start-session-label"],
284
+ "hideQrModalDescription": [4, "hide-qr-modal-description"],
285
+ "open": [32],
286
+ "sessionId": [32],
287
+ "authenticationRequest": [32],
288
+ "sessionData": [32],
289
+ "result": [32],
290
+ "getSessionData": [64],
291
+ "startMobilePolling": [64],
292
+ "stop": [64]
293
+ }]);
294
+ function defineCustomElement() {
295
+ if (typeof customElements === "undefined") {
296
+ return;
297
+ }
298
+ const components = ["gataca-ssibutton", "gataca-qr", "gataca-qrdisplay"];
299
+ components.forEach(tagName => { switch (tagName) {
300
+ case "gataca-ssibutton":
301
+ if (!customElements.get(tagName)) {
302
+ customElements.define(tagName, GatacaSSIButton);
303
+ }
304
+ break;
305
+ case "gataca-qr":
306
+ if (!customElements.get(tagName)) {
307
+ defineCustomElement$2();
308
+ }
309
+ break;
310
+ case "gataca-qrdisplay":
311
+ if (!customElements.get(tagName)) {
312
+ defineCustomElement$1();
313
+ }
314
+ break;
315
+ } });
316
+ }
317
+
318
+ export { GatacaSSIButton as G, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface GatacaSsibuttonws extends Components.GatacaSsibuttonws, HTMLElement {}
4
+ export const GatacaSsibuttonws: {
5
+ prototype: GatacaSsibuttonws;
6
+ new (): GatacaSsibuttonws;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { G as GatacaSSIButtonWS, d as defineCustomElement$1 } from './gataca-ssibuttonws2.js';
2
+
3
+ const GatacaSsibuttonws = GatacaSSIButtonWS;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { GatacaSsibuttonws, defineCustomElement };
@@ -0,0 +1,102 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+ import { d as defineCustomElement$2 } from './gataca-qrdisplay2.js';
3
+ import { d as defineCustomElement$1 } from './gataca-qrws2.js';
4
+
5
+ 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}";
6
+
7
+ 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=";
8
+ const GatacaSSIButtonWS = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
9
+ constructor() {
10
+ super();
11
+ this.__registerHost();
12
+ this.__attachShadow();
13
+ this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
14
+ this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
15
+ this.buttonText = "Easy login";
16
+ this.successCallback = undefined;
17
+ this.errorCallback = undefined;
18
+ this.qrRole = undefined;
19
+ this.callbackServer = undefined;
20
+ this.socketEndpoint = undefined;
21
+ this.sessionTimeout = undefined;
22
+ this.wsOnOpen = undefined;
23
+ this.wsOnMessage = undefined;
24
+ this.autostart = true;
25
+ this.autorefresh = false;
26
+ this.v = "3";
27
+ this.qrModalTitle = "Quick Access";
28
+ this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
29
+ this.hideBrandTitle = false;
30
+ this.dynamicLink = true;
31
+ this.open = false;
32
+ this.qr = (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 }));
33
+ }
34
+ /**
35
+ * Retrieve manually the session data on a successful login
36
+ */
37
+ async getSessionData() {
38
+ return this.qr.getSessionData();
39
+ }
40
+ renderModal() {
41
+ return this.qr;
42
+ }
43
+ renderButton() {
44
+ return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
45
+ this.open = !this.open;
46
+ if (this.open) {
47
+ this.qr.display();
48
+ }
49
+ else {
50
+ this.qr.stop();
51
+ }
52
+ } }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
53
+ }
54
+ render() {
55
+ return (h("div", { class: "buttonContainer" }, this.renderButton(), this.open && this.renderModal()));
56
+ }
57
+ static get style() { return gatacaSsibuttonwsCss; }
58
+ }, [1, "gataca-ssibuttonws", {
59
+ "buttonText": [1, "button-text"],
60
+ "successCallback": [16],
61
+ "errorCallback": [16],
62
+ "qrRole": [1, "qr-role"],
63
+ "callbackServer": [1, "callback-server"],
64
+ "socketEndpoint": [1, "socket-endpoint"],
65
+ "sessionTimeout": [2, "session-timeout"],
66
+ "wsOnOpen": [16],
67
+ "wsOnMessage": [16],
68
+ "autostart": [4],
69
+ "autorefresh": [4],
70
+ "v": [1],
71
+ "qrModalTitle": [1, "qr-modal-title"],
72
+ "qrModalDescription": [1, "qr-modal-description"],
73
+ "hideBrandTitle": [4, "hide-brand-title"],
74
+ "dynamicLink": [4, "dynamic-link"],
75
+ "open": [32],
76
+ "getSessionData": [64]
77
+ }]);
78
+ function defineCustomElement() {
79
+ if (typeof customElements === "undefined") {
80
+ return;
81
+ }
82
+ const components = ["gataca-ssibuttonws", "gataca-qrdisplay", "gataca-qrws"];
83
+ components.forEach(tagName => { switch (tagName) {
84
+ case "gataca-ssibuttonws":
85
+ if (!customElements.get(tagName)) {
86
+ customElements.define(tagName, GatacaSSIButtonWS);
87
+ }
88
+ break;
89
+ case "gataca-qrdisplay":
90
+ if (!customElements.get(tagName)) {
91
+ defineCustomElement$2();
92
+ }
93
+ break;
94
+ case "gataca-qrws":
95
+ if (!customElements.get(tagName)) {
96
+ defineCustomElement$1();
97
+ }
98
+ break;
99
+ } });
100
+ }
101
+
102
+ export { GatacaSSIButtonWS as G, defineCustomElement as d };
@@ -0,0 +1,27 @@
1
+ /* gatacaqr custom elements */
2
+ export { GatacaAutoQR as GatacaAutoqr } from '../types/components/gataca-autoqr/gataca-autoqr';
3
+ export { GatacaQR as GatacaQr } from '../types/components/gataca-qr/gataca-qr';
4
+ export { GatacaQRDisplay as GatacaQrdisplay } from '../types/components/gataca-qrdisplay/gataca-qrdisplay';
5
+ export { GatacaQRWS as GatacaQrws } from '../types/components/gataca-qrws/gataca-qrws';
6
+ export { GatacaSSIButton as GatacaSsibutton } from '../types/components/gataca-ssibutton/gataca-ssibutton';
7
+ export { GatacaSSIButtonWS as GatacaSsibuttonws } from '../types/components/gataca-ssibuttonws/gataca-ssibuttonws';
8
+
9
+ /**
10
+ * Used to manually set the base path where assets can be found.
11
+ * If the script is used as "module", it's recommended to use "import.meta.url",
12
+ * such as "setAssetPath(import.meta.url)". Other options include
13
+ * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
14
+ * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
15
+ * But do note that this configuration depends on how your script is bundled, or lack of
16
+ * bundling, and where your assets can be loaded from. Additionally custom bundling
17
+ * will have to ensure the static assets are copied to its build directory.
18
+ */
19
+ export declare const setAssetPath: (path: string) => void;
20
+
21
+ export interface SetPlatformOptions {
22
+ raf?: (c: FrameRequestCallback) => number;
23
+ ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
24
+ rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
25
+ }
26
+ export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
27
+ export * from '../types';
@@ -0,0 +1,8 @@
1
+ export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
2
+ export { R as RESULT_STATUS, b as base64UrlEncode, c as checkMobile } from './gat-icon-alert.js';
3
+ export { GatacaAutoqr, defineCustomElement as defineCustomElementGatacaAutoqr } from './gataca-autoqr.js';
4
+ export { GatacaQr, defineCustomElement as defineCustomElementGatacaQr } from './gataca-qr.js';
5
+ export { GatacaQrdisplay, defineCustomElement as defineCustomElementGatacaQrdisplay } from './gataca-qrdisplay.js';
6
+ export { GatacaQrws, defineCustomElement as defineCustomElementGatacaQrws } from './gataca-qrws.js';
7
+ export { GatacaSsibutton, defineCustomElement as defineCustomElementGatacaSsibutton } from './gataca-ssibutton.js';
8
+ export { GatacaSsibuttonws, defineCustomElement as defineCustomElementGatacaSsibuttonws } from './gataca-ssibuttonws.js';
@@ -0,0 +1,9 @@
1
+ const logoGatacaSvg = 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDc2IDcx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C40NjkgMy41NjYzMSAxMC4yOTA4IDMuODYwMlYzLjg2MDJaIiBzdHJva2U9IiNDRDJCMzEiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CjxwYXRoIGQ9Ik0xMiA5VjEzIiBzdHJva2U9IiNDRDJCMzEiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CjxwYXRoIGQ9Ik0xMiAxN0gxMi4wMSIgc3Ryb2tlPSIjQ0QyQjMxIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K';
8
+
9
+ export { gatIconRefreshSvg as a, gatIconAlertSvg as b, gatIconCheckSvg as g, logoGatacaSvg as l };
@@ -0,0 +1,101 @@
1
+ import { r as registerInstance, c as createEvent, h } from './index-2be54f32.js';
2
+
3
+ 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}";
4
+
5
+ const DEFAULT_REPOSITORY = "https://studio.gataca.io/api/v1/qrconfigs";
6
+ const fixFunctions = (data) => {
7
+ var _a, _b, _c, _d, _e, _f;
8
+ data.errorCallback = deserializeFunction((_a = data.errorCallback) === null || _a === void 0 ? void 0 : _a.toString());
9
+ data.successCallback = deserializeFunction((_b = data.successCallback) === null || _b === void 0 ? void 0 : _b.toString());
10
+ data.wsOnMessage = deserializeFunction((_c = data.wsOnMessage) === null || _c === void 0 ? void 0 : _c.toString());
11
+ data.wsOnOpen = deserializeFunction((_d = data.wsOnOpen) === null || _d === void 0 ? void 0 : _d.toString());
12
+ data.checkStatus = deserializeFunction((_e = data.checkStatus) === null || _e === void 0 ? void 0 : _e.toString());
13
+ data.createSession = deserializeFunction((_f = data.createSession) === null || _f === void 0 ? void 0 : _f.toString());
14
+ return data;
15
+ };
16
+ const deserializeFunction = (data) => {
17
+ if (data) {
18
+ return new Function("return " + data)();
19
+ }
20
+ return undefined;
21
+ };
22
+ const GatacaAutoQR = class {
23
+ constructor(hostRef) {
24
+ registerInstance(this, hostRef);
25
+ this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
26
+ this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
27
+ this.configId = undefined;
28
+ this.configRepository = DEFAULT_REPOSITORY;
29
+ this.successCallback = undefined;
30
+ this.errorCallback = undefined;
31
+ this.checkStatus = undefined;
32
+ this.createSession = undefined;
33
+ this.wsOnOpen = undefined;
34
+ this.wsOnMessage = undefined;
35
+ this.config = undefined;
36
+ this.loading = undefined;
37
+ this.loading = true;
38
+ fetch(this.configRepository + "/" + this.configId, {
39
+ method: "GET",
40
+ headers: {
41
+ "Content-Type": "application/json",
42
+ },
43
+ })
44
+ .then((response) => {
45
+ response
46
+ .json()
47
+ .then((data) => {
48
+ data = fixFunctions(data);
49
+ this.config = data;
50
+ this.loading = false;
51
+ })
52
+ .catch((err) => {
53
+ console.log("Cannot retrieve selected config", err);
54
+ this.loading = false;
55
+ });
56
+ })
57
+ .catch((err) => {
58
+ console.log("Cannot retrieve selected config", err);
59
+ this.loading = false;
60
+ });
61
+ }
62
+ /**
63
+ * Retrieve manually the session data on a successful login
64
+ */
65
+ async getSessionData() {
66
+ return this.qr.getSessionData();
67
+ }
68
+ selectQR() {
69
+ if (this.config.useButton) {
70
+ if (this.config.useWs) {
71
+ this.qr = (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, v: this.config.v, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
72
+ }
73
+ else {
74
+ this.qr = (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, v: this.config.v, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
75
+ }
76
+ }
77
+ else {
78
+ if (this.config.useWs) {
79
+ this.qr = (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, v: this.config.v, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
80
+ }
81
+ else {
82
+ this.qr = (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, v: this.config.v, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
83
+ }
84
+ }
85
+ }
86
+ render() {
87
+ if (this.loading) {
88
+ //TODO: Improve loading message
89
+ return h("div", null, "Loading...");
90
+ }
91
+ if (this.config) {
92
+ this.selectQR();
93
+ return this.qr;
94
+ }
95
+ //TODO: Improve error message
96
+ return h("div", null, "Error loading your config...");
97
+ }
98
+ };
99
+ GatacaAutoQR.style = gatacaAutoqrCss;
100
+
101
+ export { GatacaAutoQR as gataca_autoqr };