@gataca/qr 4.0.3 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/cjs/gataca-autoqr.cjs.entry.js +1 -1
  2. package/dist/cjs/gataca-qr_3.cjs.entry.js +128 -24
  3. package/dist/cjs/gataca-qrws.cjs.entry.js +141 -21
  4. package/dist/cjs/gataca-ssibuttonws.cjs.entry.js +1 -1
  5. package/dist/cjs/gatacaqr.cjs.js +2 -2
  6. package/dist/cjs/{index-1332a8ce.js → index-d8d3dfde.js} +32 -0
  7. package/dist/cjs/index.cjs.js +2 -1
  8. package/dist/cjs/loader.cjs.js +2 -2
  9. package/dist/cjs/{utils-c6edb275.js → utils-17b0a5ba.js} +44 -0
  10. package/dist/collection/components/gataca-qr/components/qr/QR.js +9 -1
  11. package/dist/collection/components/gataca-qr/components/retryButton/RetryButton.js +5 -2
  12. package/dist/collection/components/gataca-qr/gataca-qr.css +6 -0
  13. package/dist/collection/components/gataca-qr/gataca-qr.js +86 -16
  14. package/dist/collection/components/gataca-qrdisplay/gataca-qrdisplay.js +28 -4
  15. package/dist/collection/components/gataca-qrws/components/qr/QR.js +9 -1
  16. package/dist/collection/components/gataca-qrws/components/retryButton/RetryButton.js +5 -2
  17. package/dist/collection/components/gataca-qrws/gataca-qrws.css +7 -0
  18. package/dist/collection/components/gataca-qrws/gataca-qrws.js +125 -17
  19. package/dist/collection/utils/utils.js +43 -0
  20. package/dist/components/gat-icon-check.js +44 -1
  21. package/dist/components/gataca-qr2.js +105 -19
  22. package/dist/components/gataca-qrdisplay2.js +25 -4
  23. package/dist/components/gataca-qrws2.js +144 -20
  24. package/dist/components/index.js +1 -1
  25. package/dist/esm/gataca-autoqr.entry.js +1 -1
  26. package/dist/esm/gataca-qr_3.entry.js +129 -25
  27. package/dist/esm/gataca-qrws.entry.js +141 -21
  28. package/dist/esm/gataca-ssibuttonws.entry.js +1 -1
  29. package/dist/esm/gatacaqr.js +2 -2
  30. package/dist/esm/{index-055790a7.js → index-dca2ab22.js} +32 -0
  31. package/dist/esm/index.js +1 -1
  32. package/dist/esm/loader.js +2 -2
  33. package/dist/esm/{utils-22df0ce4.js → utils-e4a08623.js} +44 -1
  34. package/dist/gatacaqr/gatacaqr.esm.js +1 -1
  35. package/dist/gatacaqr/index.esm.js +1 -1
  36. package/dist/gatacaqr/{p-0501e224.js → p-143c0080.js} +1 -1
  37. package/dist/gatacaqr/p-2dc7190a.entry.js +1 -0
  38. package/dist/gatacaqr/{p-49cf321c.entry.js → p-2e8accf9.entry.js} +1 -1
  39. package/dist/gatacaqr/p-85af64b1.js +2 -0
  40. package/dist/gatacaqr/{p-c65f810b.entry.js → p-d27dabe4.entry.js} +1 -1
  41. package/dist/gatacaqr/p-e172581d.entry.js +1 -0
  42. package/dist/types/components/gataca-qr/components/qr/QR.d.ts +1 -0
  43. package/dist/types/components/gataca-qr/components/retryButton/RetryButton.d.ts +0 -2
  44. package/dist/types/components/gataca-qr/gataca-qr.d.ts +5 -2
  45. package/dist/types/components/gataca-qrdisplay/gataca-qrdisplay.d.ts +4 -0
  46. package/dist/types/components/gataca-qrws/components/qr/QR.d.ts +1 -0
  47. package/dist/types/components/gataca-qrws/components/retryButton/RetryButton.d.ts +0 -2
  48. package/dist/types/components/gataca-qrws/gataca-qrws.d.ts +8 -2
  49. package/dist/types/utils/utils.d.ts +5 -0
  50. package/package.json +1 -1
  51. package/dist/gatacaqr/p-2083dd06.entry.js +0 -1
  52. package/dist/gatacaqr/p-f5a4f65c.entry.js +0 -1
  53. package/dist/gatacaqr/p-fccf9d4d.js +0 -2
@@ -1,7 +1,7 @@
1
1
  import { h } from '@stencil/core';
2
2
  import logoGataca from '../../assets/images/logo_gataca.svg';
3
3
  import '../gataca-qrdisplay/gataca-qrdisplay';
4
- import { base64UrlEncode, checkMobile, RESULT_STATUS } from '../../utils/utils';
4
+ import { base64UrlEncode, checkMobile, RESULT_STATUS, shortenUrlIfPossible } from '../../utils/utils';
5
5
  import { Success } from './components/success/Success';
6
6
  import { RetryButton } from './components/retryButton/RetryButton';
7
7
  import { QR } from './components/qr/QR';
@@ -10,7 +10,54 @@ const DEEP_LINK_PREFIX = 'https://api.gataca.io/qr/redirect.html';
10
10
  const DEFAULT_SESSION_TIMEOUT = 300;
11
11
  const QR_ROLE_CONNECT = 'connect';
12
12
  export class GatacaQRWS {
13
- constructor() { this.successCallback = undefined; this.errorCallback = undefined; this.qrRole = undefined; this.qrType = 'svg'; this.callbackServer = undefined; this.socketEndpoint = undefined; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT; this.wsOnOpen = undefined; this.wsOnMessage = undefined; this.autostart = true; this.autorefresh = false; this.v = '3'; this.qrModalTitle = 'Quick Access'; this.modalTitleColor = '#4745B7'; this.qrModalDescription = 'Sign up or sign in by scanning the QR Code with the Gataca Wallet'; this.hideModalTexts = false; this.hideModalBoxShadow = false; this.hideBrandTitle = false; this.logoSize = 0; this.logoSrc = logoGataca; this.qrSize = 300; this.modalWidth = 300; this.modalHeight = undefined; this.qrCodeExpiredLabel = 'QR Code expired'; this.credentialsNotValidatedLabel = 'User credentials not validated'; this.clickInsideBoxLabel = 'Click inside the box to'; this.refreshQrLabel = 'Refresh QR Code'; this.scanQrLabel = 'Scan QR Code'; this.userNotScanInTimeErrorLabel = 'User did not scan the QR in the allowed time'; this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated"; this.failedLoginErrorLabel = 'No successful login'; this.successLoginLabel = 'Successful Connection!'; this.byBrandLabel = 'by Gataca'; this.waitingStartSessionLabel = 'waiting to start a session'; this.readQrTitle = 'Processing...'; this.readQrDescription = 'Please wait a moment'; this.hideQrModalDescription = false; this.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = RESULT_STATUS.NOT_STARTED; }
13
+ constructor() {
14
+ this.qrRefreshGeneration = 0;
15
+ this.lastShortenRaw = null;
16
+ this.successCallback = undefined;
17
+ this.errorCallback = undefined;
18
+ this.qrRole = undefined;
19
+ this.qrType = 'svg';
20
+ this.callbackServer = undefined;
21
+ this.socketEndpoint = undefined;
22
+ this.sessionTimeout = DEFAULT_SESSION_TIMEOUT;
23
+ this.wsOnOpen = undefined;
24
+ this.wsOnMessage = undefined;
25
+ this.autostart = true;
26
+ this.autorefresh = false;
27
+ this.v = '3';
28
+ this.qrModalTitle = 'Quick Access';
29
+ this.modalTitleColor = '#4745B7';
30
+ this.qrModalDescription = 'Sign up or sign in by scanning the QR Code with the Gataca Wallet';
31
+ this.hideModalTexts = false;
32
+ this.hideModalBoxShadow = false;
33
+ this.hideBrandTitle = false;
34
+ this.logoSize = 0;
35
+ this.logoSrc = logoGataca;
36
+ this.qrSize = 300;
37
+ this.modalWidth = 300;
38
+ this.modalHeight = 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.readQrTitle = 'Processing...';
51
+ this.readQrDescription = 'Please wait a moment';
52
+ this.hideQrModalDescription = false;
53
+ this.dynamicLink = true;
54
+ this.sessionId = undefined;
55
+ this.authenticationRequest = undefined;
56
+ this.sessionData = undefined;
57
+ this.result = RESULT_STATUS.NOT_STARTED;
58
+ this.qrHref = '';
59
+ this.qrShortenPending = false;
60
+ }
14
61
  disconnectedCallback() {
15
62
  this.stop();
16
63
  }
@@ -23,6 +70,10 @@ export class GatacaQRWS {
23
70
  * Force manually the display of a QR
24
71
  */
25
72
  async display() {
73
+ this.qrHref = '';
74
+ this.qrShortenPending = false;
75
+ this.lastShortenRaw = null;
76
+ this.qrRefreshGeneration++;
26
77
  let socket = new WebSocket(this.socketEndpoint);
27
78
  setTimeout(() => {
28
79
  this.socket.close(1000, '');
@@ -77,10 +128,16 @@ export class GatacaQRWS {
77
128
  this.result = wsresp.result;
78
129
  switch (wsresp.result) {
79
130
  case RESULT_STATUS.ONGOING:
80
- case RESULT_STATUS.READ:
131
+ case RESULT_STATUS.READ: {
81
132
  this.sessionId = wsresp.sessionId;
82
133
  this.authenticationRequest = wsresp.authenticationRequest;
134
+ const raw = this.buildRawLink();
135
+ if (raw === null || raw === void 0 ? void 0 : raw.trim()) {
136
+ this.qrShortenPending = true;
137
+ void this.refreshQrHref();
138
+ }
83
139
  break;
140
+ }
84
141
  case RESULT_STATUS.SUCCESS:
85
142
  this.sessionData = wsresp.authenticatedUserData;
86
143
  this.gatacaLoginCompleted.emit(wsresp.authenticatedUserData);
@@ -111,6 +168,9 @@ export class GatacaQRWS {
111
168
  async stop() {
112
169
  this.sessionData = undefined;
113
170
  this.sessionId = undefined;
171
+ this.qrHref = '';
172
+ this.qrShortenPending = false;
173
+ this.lastShortenRaw = null;
114
174
  this.socket.close(1000, 'Client stopped the connection');
115
175
  }
116
176
  /**
@@ -119,19 +179,56 @@ export class GatacaQRWS {
119
179
  async getSessionData() {
120
180
  return this.sessionData ? Promise.resolve(this.sessionData) : Promise.reject(new Error('No successful login'));
121
181
  }
122
- getLink() {
182
+ buildRawLink() {
183
+ var _a;
123
184
  if (this.v === '2' && this.qrRole == QR_ROLE_CONNECT) {
124
- return this.authenticationRequest;
185
+ return (_a = this.authenticationRequest) !== null && _a !== void 0 ? _a : '';
125
186
  }
126
187
  const authRequestEncoded = '?dl=' + base64UrlEncode(this.authenticationRequest);
127
188
  return DEEP_LINK_PREFIX + authRequestEncoded;
128
189
  }
190
+ async refreshQrHref() {
191
+ var _a, _b, _c;
192
+ const raw = this.buildRawLink();
193
+ if (!(raw === null || raw === void 0 ? void 0 : raw.trim())) {
194
+ this.qrShortenPending = false;
195
+ return;
196
+ }
197
+ if (raw === this.lastShortenRaw && ((_a = this.qrHref) === null || _a === void 0 ? void 0 : _a.trim())) {
198
+ this.qrShortenPending = false;
199
+ return;
200
+ }
201
+ if (this.qrShortenPending && raw === this.lastShortenRaw && !((_b = this.qrHref) === null || _b === void 0 ? void 0 : _b.trim())) {
202
+ return;
203
+ }
204
+ const gen = ++this.qrRefreshGeneration;
205
+ this.lastShortenRaw = raw;
206
+ try {
207
+ const shortened = await shortenUrlIfPossible(raw);
208
+ const now = this.buildRawLink();
209
+ if (now === raw) {
210
+ this.qrHref = shortened;
211
+ }
212
+ else if (!((_c = this.qrHref) === null || _c === void 0 ? void 0 : _c.trim())) {
213
+ this.qrHref = now;
214
+ }
215
+ }
216
+ finally {
217
+ if (gen === this.qrRefreshGeneration) {
218
+ this.qrShortenPending = false;
219
+ }
220
+ }
221
+ }
222
+ getLink() {
223
+ return this.qrHref || this.buildRawLink();
224
+ }
129
225
  renderQRSection() {
226
+ var _a, _b, _c;
130
227
  switch (this.result) {
131
228
  case RESULT_STATUS.NOT_STARTED:
132
229
  return this.renderRetryButton();
133
230
  case RESULT_STATUS.ONGOING:
134
- return this.renderQR(this.getLink(), true);
231
+ return this.qrShortenPending || !((_a = this.qrHref) === null || _a === void 0 ? void 0 : _a.trim()) ? this.renderQrLoadingSlot() : this.renderQR(this.getLink(), true, undefined, !!((_b = this.qrHref) === null || _b === void 0 ? void 0 : _b.trim()));
135
232
  case RESULT_STATUS.EXPIRED:
136
233
  return this.renderRetryButton(this.qrCodeExpiredLabel);
137
234
  case RESULT_STATUS.FAILED:
@@ -139,26 +236,35 @@ export class GatacaQRWS {
139
236
  case RESULT_STATUS.SUCCESS:
140
237
  return this.renderSuccess();
141
238
  case RESULT_STATUS.READ:
142
- return this.renderReadQR({
143
- title: this === null || this === void 0 ? void 0 : this.readQrTitle,
144
- description: this === null || this === void 0 ? void 0 : this.readQrDescription
145
- });
239
+ return this.qrShortenPending || !((_c = this.qrHref) === null || _c === void 0 ? void 0 : _c.trim())
240
+ ? this.renderQrLoadingSlot()
241
+ : this.renderReadQR({
242
+ title: this === null || this === void 0 ? void 0 : this.readQrTitle,
243
+ description: this === null || this === void 0 ? void 0 : this.readQrDescription
244
+ });
146
245
  }
147
246
  }
148
247
  renderSuccess() {
149
248
  return h(Success, { modalHeight: this === null || this === void 0 ? void 0 : this.modalHeight, successLoginLabel: this === null || this === void 0 ? void 0 : this.successLoginLabel });
150
249
  }
151
250
  renderRetryButton(errorMessage) {
152
- return (h(RetryButton, { errorMessage: errorMessage, modalWidth: this === null || this === void 0 ? void 0 : this.modalWidth, clickInsideBoxLabel: this === null || this === void 0 ? void 0 : this.clickInsideBoxLabel, refreshQrLabel: this === null || this === void 0 ? void 0 : this.refreshQrLabel, scanQrLabel: this === null || this === void 0 ? void 0 : this.scanQrLabel, waitingStartSessionLabel: this === null || this === void 0 ? void 0 : this.waitingStartSessionLabel, display: this.display.bind(this), renderRetryQR: this.renderRetryQR.bind(this) }));
251
+ return (h(RetryButton, { errorMessage: errorMessage, modalWidth: this === null || this === void 0 ? void 0 : this.modalWidth, clickInsideBoxLabel: this === null || this === void 0 ? void 0 : this.clickInsideBoxLabel, refreshQrLabel: this === null || this === void 0 ? void 0 : this.refreshQrLabel, scanQrLabel: this === null || this === void 0 ? void 0 : this.scanQrLabel, display: this.display.bind(this) }));
153
252
  }
154
253
  renderReadQR(readQrMessages) {
155
- return h(ReadQR, { modalWidth: this === null || this === void 0 ? void 0 : this.modalWidth, readQrMessages: readQrMessages, url: this.getLink(), sizeQR: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, renderQR: this.renderQR.bind(this) });
254
+ var _a;
255
+ const linkReady = !!((_a = this.qrHref) === null || _a === void 0 ? void 0 : _a.trim());
256
+ return (h(ReadQR, { modalWidth: this === null || this === void 0 ? void 0 : this.modalWidth, readQrMessages: readQrMessages, url: this.getLink(), sizeQR: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, renderQR: (url, useLogo, size) => this.renderQR(url, useLogo, size, linkReady) }));
156
257
  }
157
- renderQR(value, useLogo, sizeQR) {
158
- return h(QR, { value: value, qrType: this.qrType, useLogo: useLogo && this.logoSize !== 0, size: sizeQR || (this === null || this === void 0 ? void 0 : this.qrSize) || undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc });
258
+ renderQR(value, useLogo, sizeQR, linkReady = true) {
259
+ return h(QR, { value: value, qrType: this.qrType, useLogo: useLogo && this.logoSize !== 0, size: sizeQR || (this === null || this === void 0 ? void 0 : this.qrSize) || undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc, linkReady: linkReady });
159
260
  }
160
- renderRetryQR(value, useLogo) {
161
- return h(QR, { value: value, qrType: this.qrType, useLogo: useLogo && this.logoSize !== 0, size: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc });
261
+ renderQrLoadingSlot() {
262
+ const s = this.qrSize || 300;
263
+ return (h("div", { class: "qr-loading-slot", style: {
264
+ width: s + 'px',
265
+ height: s + 'px',
266
+ margin: '0 auto'
267
+ } }));
162
268
  }
163
269
  render() {
164
270
  var _a, _b;
@@ -883,7 +989,9 @@ export class GatacaQRWS {
883
989
  "sessionId": {},
884
990
  "authenticationRequest": {},
885
991
  "sessionData": {},
886
- "result": {}
992
+ "result": {},
993
+ "qrHref": {},
994
+ "qrShortenPending": {}
887
995
  };
888
996
  }
889
997
  static get events() {
@@ -20,4 +20,47 @@ export var RESULT_STATUS;
20
20
  RESULT_STATUS[RESULT_STATUS["EXPIRED"] = 3] = "EXPIRED";
21
21
  RESULT_STATUS[RESULT_STATUS["READ"] = 5] = "READ";
22
22
  })(RESULT_STATUS || (RESULT_STATUS = {}));
23
+ const GATACA_SHORTEN_API = 'https://links.gataca.io/api/v1/short';
24
+ function extractShortUrlFromResponse(body) {
25
+ if (!body || typeof body !== 'object') {
26
+ return null;
27
+ }
28
+ const o = body;
29
+ for (const key of ['url', 'shortUrl', 'short_url', 'link']) {
30
+ const v = o[key];
31
+ if (typeof v === 'string' && v.trim() !== '') {
32
+ return v;
33
+ }
34
+ }
35
+ return null;
36
+ }
37
+ /**
38
+ * POSTs the link to shortener. On success with a non-empty url in the body, returns that url;
39
+ * otherwise returns the original link.
40
+ */
41
+ export async function shortenUrlIfPossible(link) {
42
+ const trimmedLink = (link === null || link === void 0 ? void 0 : link.trim()) || '';
43
+ const linkHasLength = trimmedLink === null || trimmedLink === void 0 ? void 0 : trimmedLink.length;
44
+ if (!linkHasLength) {
45
+ return link !== null && link !== void 0 ? link : '';
46
+ }
47
+ try {
48
+ const res = await fetch(GATACA_SHORTEN_API, {
49
+ method: 'POST',
50
+ mode: 'cors',
51
+ credentials: 'omit',
52
+ headers: { 'Content-Type': 'application/json' },
53
+ body: JSON.stringify({ url: trimmedLink })
54
+ });
55
+ if (res.status !== 200 && res.status !== 201) {
56
+ return link;
57
+ }
58
+ const data = await res.json().catch(() => null);
59
+ const short = extractShortUrlFromResponse(data);
60
+ return short !== null && short !== void 0 ? short : link;
61
+ }
62
+ catch (_a) {
63
+ return link;
64
+ }
65
+ }
23
66
  //
@@ -20,10 +20,53 @@ var RESULT_STATUS;
20
20
  RESULT_STATUS[RESULT_STATUS["EXPIRED"] = 3] = "EXPIRED";
21
21
  RESULT_STATUS[RESULT_STATUS["READ"] = 5] = "READ";
22
22
  })(RESULT_STATUS || (RESULT_STATUS = {}));
23
+ const GATACA_SHORTEN_API = 'https://links.gataca.io/api/v1/short';
24
+ function extractShortUrlFromResponse(body) {
25
+ if (!body || typeof body !== 'object') {
26
+ return null;
27
+ }
28
+ const o = body;
29
+ for (const key of ['url', 'shortUrl', 'short_url', 'link']) {
30
+ const v = o[key];
31
+ if (typeof v === 'string' && v.trim() !== '') {
32
+ return v;
33
+ }
34
+ }
35
+ return null;
36
+ }
37
+ /**
38
+ * POSTs the link to shortener. On success with a non-empty url in the body, returns that url;
39
+ * otherwise returns the original link.
40
+ */
41
+ async function shortenUrlIfPossible(link) {
42
+ const trimmedLink = (link === null || link === void 0 ? void 0 : link.trim()) || '';
43
+ const linkHasLength = trimmedLink === null || trimmedLink === void 0 ? void 0 : trimmedLink.length;
44
+ if (!linkHasLength) {
45
+ return link !== null && link !== void 0 ? link : '';
46
+ }
47
+ try {
48
+ const res = await fetch(GATACA_SHORTEN_API, {
49
+ method: 'POST',
50
+ mode: 'cors',
51
+ credentials: 'omit',
52
+ headers: { 'Content-Type': 'application/json' },
53
+ body: JSON.stringify({ url: trimmedLink })
54
+ });
55
+ if (res.status !== 200 && res.status !== 201) {
56
+ return link;
57
+ }
58
+ const data = await res.json().catch(() => null);
59
+ const short = extractShortUrlFromResponse(data);
60
+ return short !== null && short !== void 0 ? short : link;
61
+ }
62
+ catch (_a) {
63
+ return link;
64
+ }
65
+ }
23
66
  //
24
67
 
25
68
  const gatIconAlertSvg = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEwLjI5MDggMy44NjAyTDEuODIwNzUgMTguMDAwMkMxLjY0NjEyIDE4LjMwMjYgMS41NTM3MiAxOC42NDU1IDEuNTUyNzQgMTguOTk0N0MxLjU1MTc2IDE5LjM0MzkgMS42NDIyNCAxOS42ODczIDEuODE1MTggMTkuOTkwN0MxLjk4ODEyIDIwLjI5NDEgMi4yMzc0OCAyMC41NDcgMi41Mzg0NiAyMC43MjQxQzIuODM5NDQgMjAuOTAxMiAzLjE4MTU1IDIwLjk5NjQgMy41MzA3NSAyMS4wMDAySDIwLjQ3MDhDMjAuODIgMjAuOTk2NCAyMS4xNjIxIDIwLjkwMTIgMjEuNDYzIDIwLjcyNDFDMjEuNzY0IDIwLjU0NyAyMi4wMTM0IDIwLjI5NDEgMjIuMTg2MyAxOS45OTA3QzIyLjM1OTMgMTkuNjg3MyAyMi40NDk3IDE5LjM0MzkgMjIuNDQ4OCAxOC45OTQ3QzIyLjQ0NzggMTguNjQ1NSAyMi4zNTU0IDE4LjMwMjYgMjIuMTgwOCAxOC4wMDAyTDEzLjcxMDggMy44NjAyQzEzLjUzMjUgMy41NjYzMSAxMy4yODE1IDMuMzIzMzIgMTIuOTgxOSAzLjE1NDY5QzEyLjY4MjQgMi45ODYwNSAxMi4zNDQ1IDIuODk3NDYgMTIuMDAwOCAyLjg5NzQ2QzExLjY1NyAyLjg5NzQ2IDExLjMxOTEgMi45ODYwNSAxMS4wMTk2IDMuMTU0NjlDMTAuNzIgMy4zMjMzMiAxMC40NjkgMy41NjYzMSAxMC4yOTA4IDMuODYwMlYzLjg2MDJaIiBzdHJva2U9IiNDRDJCMzEiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CjxwYXRoIGQ9Ik0xMiA5VjEzIiBzdHJva2U9IiNDRDJCMzEiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CjxwYXRoIGQ9Ik0xMiAxN0gxMi4wMSIgc3Ryb2tlPSIjQ0QyQjMxIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K';
26
69
 
27
70
  const gatIconCheckSvg = 'data:image/svg+xml;base64,Cjxzdmcgd2lkdGg9IjUyIiBoZWlnaHQ9IjUzIiB2aWV3Qm94PSIwIDAgNTIgNTMiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxjaXJjbGUgY3g9IjI2IiBjeT0iMjYuNjcxOSIgcj0iMjYiIGZpbGw9IiMzRDlBNTAiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0zOC41MiAxNy43NDk1QzM5LjU4MDUgMTguODA5OSAzOS41ODA1IDIwLjUyOTMgMzguNTIgMjEuNTg5OEwyMy41ODQ2IDM2LjUyNTFDMjIuNTI0MiAzNy41ODU2IDIwLjgwNDggMzcuNTg1NiAxOS43NDQzIDM2LjUyNTFMMTIuOTU1NSAyOS43MzYzQzExLjg5NSAyOC42NzU5IDExLjg5NSAyNi45NTY1IDEyLjk1NTUgMjUuODk2QzE0LjAxNiAyNC44MzU1IDE1LjczNTQgMjQuODM1NSAxNi43OTU4IDI1Ljg5NkwyMS42NjQ1IDMwLjc2NDdMMzQuNjc5NyAxNy43NDk1QzM1Ljc0MDIgMTYuNjg5IDM3LjQ1OTUgMTYuNjg5IDM4LjUyIDE3Ljc0OTVaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K';
28
71
 
29
- export { RESULT_STATUS as R, gatIconCheckSvg as a, base64UrlEncode as b, checkMobile as c, gatIconAlertSvg as g };
72
+ export { RESULT_STATUS as R, gatIconCheckSvg as a, base64UrlEncode as b, checkMobile as c, gatIconAlertSvg as g, shortenUrlIfPossible as s };
@@ -1,9 +1,17 @@
1
1
  import { h, proxyCustomElement, HTMLElement, createEvent } from '@stencil/core/internal/client';
2
2
  import { l as logoGatacaSvg, d as defineCustomElement$1 } from './gataca-qrdisplay2.js';
3
- import { g as gatIconAlertSvg, a as gatIconCheckSvg, R as RESULT_STATUS, c as checkMobile, b as base64UrlEncode } from './gat-icon-check.js';
3
+ import { g as gatIconAlertSvg, a as gatIconCheckSvg, R as RESULT_STATUS, c as checkMobile, b as base64UrlEncode, s as shortenUrlIfPossible } from './gat-icon-check.js';
4
4
 
5
5
  const QR = (props) => {
6
- const { value, useLogo, logoSrc, size, qrType, style } = props;
6
+ const { value, useLogo, logoSrc, size, qrType, style, linkReady = true } = props;
7
+ const s = size !== null && size !== void 0 ? size : 256;
8
+ if (!linkReady) {
9
+ return (h("div", { class: "qr-loading-slot", style: {
10
+ width: s + 'px',
11
+ height: s + 'px',
12
+ margin: '0 auto'
13
+ } }));
14
+ }
7
15
  return h("gataca-qrdisplay", { qrData: value, rounded: true, qrType: qrType, size: size, "logo-size": useLogo ? 0.33 : 0, "logo-src": logoSrc, qrColor: style === null || style === void 0 ? void 0 : style.color, bgColor: style === null || style === void 0 ? void 0 : style.bgColor });
8
16
  };
9
17
 
@@ -53,7 +61,7 @@ const RefreshIcon = (props) => {
53
61
 
54
62
  const RetryButton = (props) => {
55
63
  var _a;
56
- const { errorMessage, modalWidth, clickInsideBoxLabel, refreshQrLabel, scanQrLabel, waitingStartSessionLabel, style, display, renderRetryQR } = props;
64
+ const { errorMessage, modalWidth, clickInsideBoxLabel, refreshQrLabel, scanQrLabel, style, display } = props;
57
65
  const bgStyle = { backgroundColor: (style === null || style === void 0 ? void 0 : style.bgColor) ? style === null || style === void 0 ? void 0 : style.bgColor : 'white' };
58
66
  const alertBgStyle = { backgroundColor: (style === null || style === void 0 ? void 0 : style.alertBgColor) ? style === null || style === void 0 ? void 0 : style.alertBgColor : '#ffdedf' };
59
67
  const alertBorderColor = { borderColor: (style === null || style === void 0 ? void 0 : style.alertBorderColor) ? style === null || style === void 0 ? void 0 : style.alertBorderColor : '#ee888c' };
@@ -72,7 +80,10 @@ const RetryButton = (props) => {
72
80
  errorMessage && (h("div", { class: "alert", style: Object.assign(Object.assign({ width: (modalWidth - 48).toString() + 'px' }, alertBgStyle), { border: `1px solid ${alertBorderColor}` }) },
73
81
  h("img", { src: gatIconAlertSvg, height: 24, width: 24 }),
74
82
  h("p", { style: { color: (style === null || style === void 0 ? void 0 : style.color) ? style === null || style === void 0 ? void 0 : style.color : '#1e1e20' } }, errorMessage)))),
75
- h("div", { id: "qrwait" }, renderRetryQR(waitingStartSessionLabel))));
83
+ h("div", { id: "qrwait", class: "qr-placeholder-slot", style: {
84
+ width: (modalWidth - 48).toString() + 'px',
85
+ height: modalWidth ? (modalWidth - 48).toString() + 'px' : ''
86
+ } })));
76
87
  };
77
88
 
78
89
  const Success = (props) => {
@@ -85,14 +96,65 @@ const Success = (props) => {
85
96
  h("p", { class: "successMsg", style: colorStyle }, successLoginLabel)));
86
97
  };
87
98
 
88
- const gatacaQrCss = "@import url(\"https://fonts.googleapis.com/css2?family=Ubuntu:wght@100;300;400;500;600;700&display=swap\"); @import url(\"https://fonts.googleapis.com/css2?family=Poppins:wght@100;300;400;500;600;700&display=swap\"); @import url(\"https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap\"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:\"\";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.brandSection{padding-top:5px;display:flex;align-items:center}.brandSection .gatacaImgSmall{height:13px;width:13px;margin:0;margin-right:10px}.popUpContainer .large-modal{width:300px;min-height:350px}.popUpContainer .modal-window{position:relative;border-radius:6px;overflow:hidden;color:rgba(24, 27, 94, 0.8);box-shadow:0px 3px 10px rgba(48, 48, 48, 0.1);display:flex;flex-direction:column;justify-content:space-between;align-items:center;display:flex;z-index:1001;padding:1px;background-color:white;border-radius:12px;-webkit-transition:opacity 0.5s, visibility 0s 0.5s;transition:opacity 0.5s, visibility 0s 0.5s;visibility:hidden;opacity:0}.popUpContainer .modal-window__content{width:100%;height:100%;text-align:left}.popUpContainer .modal-window__content .hidenText{display:none}.popUpContainer .modal-window .modalText{font-family:\"Ubuntu\", \"Work Sans\", \"Helvetica Neue\", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px;margin-top:10px;letter-spacing:1px}.popUpContainer .modal-window .qrTitleContainer{padding:14px 24px;padding-bottom:0px}.popUpContainer .modal-window .qrTitle{font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .modal-window .qrDescription{font-family:\"Poppins\", \"Ubuntu\", \"Work Sans\", \"Helvetica Neue\", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074}.popUpContainer .modal-window .bold{font-weight:700}.popUpContainer .modal-window .qrBrand{margin-top:4px;font-size:14px;font-weight:400;line-height:16.5px;display:flex;align-items:center}.popUpContainer .modal-window .qrBrand img{margin-left:5px;height:12px}.popUpContainer .modal-window .qr-section{width:252px;height:252px}.popUpContainer .noBoxShadow{box-shadow:none}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}.success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.success>img{padding-bottom:12px}.success>.successMsg{line-height:23.5px;color:var(--neutral-1000, #1e1e20);text-align:center;font-family:\"Ubuntu\", \"Work Sans\", \"Helvetica Neue\", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px}.reload,.blured{height:252px;width:252px;border:1px dashed #a1a1a1;border-radius:20px;position:relative;top:24px;margin:0 24px 24px;display:flex;overflow:hidden;justify-content:center;align-items:center}#qrwait{display:flex;justify-content:center}#qrwait,#notify{width:100%;height:100%;top:0;left:0;border-radius:20px}#notify{z-index:10;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;display:flex;flex-direction:column;box-sizing:border-box;padding:20px;background:rgba(255, 255, 255, 0.95)}#notify>svg{padding-bottom:12px}.alert{display:flex;flex-direction:row;justify-content:start;width:252px;position:absolute;bottom:0px;border:1px solid #ee888c;background:#ffdedf;border-radius:11px;box-sizing:border-box;padding:12px;align-items:center;gap:12px}.alert>img{margin:0}.alert>p{font-family:\"Poppins\", \"Ubuntu\", \"Work Sans\", \"Helvetica Neue\", sans-serif;font-size:14px;font-style:normal;font-weight:400;margin-top:0;line-height:16px;color:#1e1e20}.notify-text{font-family:\"Poppins\", \"Ubuntu\", \"Work Sans\", \"Helvetica Neue\", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074;text-align:center}.containerLoader{display:flex;justify-content:center;align-items:center;width:30px;height:30px;margin-bottom:12px}.loader{position:relative;margin-left:0 !important}.loader__item{position:absolute;width:9.68px;height:4px;background-color:var(--loader-color, #4745B7);border-radius:2px;--to-opacity:1;opacity:var(--to-opacity)}.loader__item__1{transform:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-webkit-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-moz-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-o-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);--to-opacity:calc(1 - (0 / 8));animation:blink 0.8333333333s linear 0.1041666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.1041666667s infinite;-moz-animation:blink 0.8333333333s linear 0.1041666667s infinite;-o-animation:blink 0.8333333333s linear 0.1041666667s infinite}.loader__item__2{transform:translate(-4.84px, 8.5px) rotate(90deg);-webkit-animation:translate(-4.84px, 8.5px) rotate(90deg);-moz-animation:translate(-4.84px, 8.5px) rotate(90deg);-o-animation:translate(-4.84px, 8.5px) rotate(90deg);--to-opacity:calc(1 - (1 / 8));animation:blink 0.8333333333s linear 0.2083333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.2083333333s infinite;-moz-animation:blink 0.8333333333s linear 0.2083333333s infinite;-o-animation:blink 0.8333333333s linear 0.2083333333s infinite}.loader__item__3{transform:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-webkit-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-moz-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-o-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);--to-opacity:calc(1 - (2 / 8));animation:blink 0.8333333333s linear 0.3125s infinite;-webkit-animation:blink 0.8333333333s linear 0.3125s infinite;-moz-animation:blink 0.8333333333s linear 0.3125s infinite;-o-animation:blink 0.8333333333s linear 0.3125s infinite}.loader__item__4{transform:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-webkit-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-moz-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-o-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);--to-opacity:calc(1 - (3 / 8));animation:blink 0.8333333333s linear 0.4166666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.4166666667s infinite;-moz-animation:blink 0.8333333333s linear 0.4166666667s infinite;-o-animation:blink 0.8333333333s linear 0.4166666667s infinite}.loader__item__5{transform:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-webkit-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-moz-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-o-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);--to-opacity:calc(1 - (4 / 8));animation:blink 0.8333333333s linear 0.5208333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.5208333333s infinite;-moz-animation:blink 0.8333333333s linear 0.5208333333s infinite;-o-animation:blink 0.8333333333s linear 0.5208333333s infinite}.loader__item__6{transform:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-webkit-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-moz-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-o-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);--to-opacity:calc(1 - (5 / 8));animation:blink 0.8333333333s linear 0.625s infinite;-webkit-animation:blink 0.8333333333s linear 0.625s infinite;-moz-animation:blink 0.8333333333s linear 0.625s infinite;-o-animation:blink 0.8333333333s linear 0.625s infinite}.loader__item__7{transform:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-webkit-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-moz-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-o-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);--to-opacity:calc(1 - (6 / 8));animation:blink 0.8333333333s linear 0.7291666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.7291666667s infinite;-moz-animation:blink 0.8333333333s linear 0.7291666667s infinite;-o-animation:blink 0.8333333333s linear 0.7291666667s infinite}.loader__item__8{transform:translate(5.6631628524px, -1.99913122px) rotate(360deg);-webkit-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);-moz-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);-o-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);--to-opacity:calc(1 - (7 / 8));animation:blink 0.8333333333s linear 0.8333333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.8333333333s infinite;-moz-animation:blink 0.8333333333s linear 0.8333333333s infinite;-o-animation:blink 0.8333333333s linear 0.8333333333s infinite}.loader__item__8{max-width:8.5px}@keyframes blink{0%{opacity:1}100%{opacity:var(--to-opacity)}}@keyframes rotate{0%{transform:rotate(0deg)}100%{background:rotate(360deg)}}";
99
+ const gatacaQrCss = "@import url(\"https://fonts.googleapis.com/css2?family=Ubuntu:wght@100;300;400;500;600;700&display=swap\"); @import url(\"https://fonts.googleapis.com/css2?family=Poppins:wght@100;300;400;500;600;700&display=swap\"); @import url(\"https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap\"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:\"\";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.brandSection{padding-top:5px;display:flex;align-items:center}.brandSection .gatacaImgSmall{height:13px;width:13px;margin:0;margin-right:10px}.popUpContainer .large-modal{width:300px;min-height:350px}.popUpContainer .modal-window{position:relative;border-radius:6px;overflow:hidden;color:rgba(24, 27, 94, 0.8);box-shadow:0px 3px 10px rgba(48, 48, 48, 0.1);display:flex;flex-direction:column;justify-content:space-between;align-items:center;display:flex;z-index:1001;padding:1px;background-color:white;border-radius:12px;-webkit-transition:opacity 0.5s, visibility 0s 0.5s;transition:opacity 0.5s, visibility 0s 0.5s;visibility:hidden;opacity:0}.popUpContainer .modal-window__content{width:100%;height:100%;text-align:left}.popUpContainer .modal-window__content .hidenText{display:none}.popUpContainer .modal-window .modalText{font-family:\"Ubuntu\", \"Work Sans\", \"Helvetica Neue\", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px;margin-top:10px;letter-spacing:1px}.popUpContainer .modal-window .qrTitleContainer{padding:14px 24px;padding-bottom:0px}.popUpContainer .modal-window .qrTitle{font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .modal-window .qrDescription{font-family:\"Poppins\", \"Ubuntu\", \"Work Sans\", \"Helvetica Neue\", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074}.popUpContainer .modal-window .bold{font-weight:700}.popUpContainer .modal-window .qrBrand{margin-top:4px;font-size:14px;font-weight:400;line-height:16.5px;display:flex;align-items:center}.popUpContainer .modal-window .qrBrand img{margin-left:5px;height:12px}.popUpContainer .modal-window .qr-section{width:252px;height:252px}.popUpContainer .noBoxShadow{box-shadow:none}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}.success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.success>img{padding-bottom:12px}.success>.successMsg{line-height:23.5px;color:var(--neutral-1000, #1e1e20);text-align:center;font-family:\"Ubuntu\", \"Work Sans\", \"Helvetica Neue\", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px}.reload,.blured{height:252px;width:252px;border:1px dashed #a1a1a1;border-radius:20px;position:relative;top:24px;margin:0 24px 24px;display:flex;overflow:hidden;justify-content:center;align-items:center}#qrwait{display:flex;justify-content:center}.qr-placeholder-slot{box-sizing:border-box;border-radius:12px;background:rgba(0, 0, 0, 0.04)}#qrwait,#notify{width:100%;height:100%;top:0;left:0;border-radius:20px}#notify{z-index:10;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;display:flex;flex-direction:column;box-sizing:border-box;padding:20px;background:rgba(255, 255, 255, 0.95)}#notify>svg{padding-bottom:12px}.alert{display:flex;flex-direction:row;justify-content:start;width:252px;position:absolute;bottom:0px;border:1px solid #ee888c;background:#ffdedf;border-radius:11px;box-sizing:border-box;padding:12px;align-items:center;gap:12px}.alert>img{margin:0}.alert>p{font-family:\"Poppins\", \"Ubuntu\", \"Work Sans\", \"Helvetica Neue\", sans-serif;font-size:14px;font-style:normal;font-weight:400;margin-top:0;line-height:16px;color:#1e1e20}.notify-text{font-family:\"Poppins\", \"Ubuntu\", \"Work Sans\", \"Helvetica Neue\", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074;text-align:center}.containerLoader{display:flex;justify-content:center;align-items:center;width:30px;height:30px;margin-bottom:12px}.loader{position:relative;margin-left:0 !important}.loader__item{position:absolute;width:9.68px;height:4px;background-color:var(--loader-color, #4745B7);border-radius:2px;--to-opacity:1;opacity:var(--to-opacity)}.loader__item__1{transform:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-webkit-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-moz-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-o-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);--to-opacity:calc(1 - (0 / 8));animation:blink 0.8333333333s linear 0.1041666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.1041666667s infinite;-moz-animation:blink 0.8333333333s linear 0.1041666667s infinite;-o-animation:blink 0.8333333333s linear 0.1041666667s infinite}.loader__item__2{transform:translate(-4.84px, 8.5px) rotate(90deg);-webkit-animation:translate(-4.84px, 8.5px) rotate(90deg);-moz-animation:translate(-4.84px, 8.5px) rotate(90deg);-o-animation:translate(-4.84px, 8.5px) rotate(90deg);--to-opacity:calc(1 - (1 / 8));animation:blink 0.8333333333s linear 0.2083333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.2083333333s infinite;-moz-animation:blink 0.8333333333s linear 0.2083333333s infinite;-o-animation:blink 0.8333333333s linear 0.2083333333s infinite}.loader__item__3{transform:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-webkit-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-moz-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-o-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);--to-opacity:calc(1 - (2 / 8));animation:blink 0.8333333333s linear 0.3125s infinite;-webkit-animation:blink 0.8333333333s linear 0.3125s infinite;-moz-animation:blink 0.8333333333s linear 0.3125s infinite;-o-animation:blink 0.8333333333s linear 0.3125s infinite}.loader__item__4{transform:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-webkit-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-moz-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-o-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);--to-opacity:calc(1 - (3 / 8));animation:blink 0.8333333333s linear 0.4166666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.4166666667s infinite;-moz-animation:blink 0.8333333333s linear 0.4166666667s infinite;-o-animation:blink 0.8333333333s linear 0.4166666667s infinite}.loader__item__5{transform:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-webkit-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-moz-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-o-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);--to-opacity:calc(1 - (4 / 8));animation:blink 0.8333333333s linear 0.5208333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.5208333333s infinite;-moz-animation:blink 0.8333333333s linear 0.5208333333s infinite;-o-animation:blink 0.8333333333s linear 0.5208333333s infinite}.loader__item__6{transform:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-webkit-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-moz-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-o-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);--to-opacity:calc(1 - (5 / 8));animation:blink 0.8333333333s linear 0.625s infinite;-webkit-animation:blink 0.8333333333s linear 0.625s infinite;-moz-animation:blink 0.8333333333s linear 0.625s infinite;-o-animation:blink 0.8333333333s linear 0.625s infinite}.loader__item__7{transform:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-webkit-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-moz-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-o-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);--to-opacity:calc(1 - (6 / 8));animation:blink 0.8333333333s linear 0.7291666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.7291666667s infinite;-moz-animation:blink 0.8333333333s linear 0.7291666667s infinite;-o-animation:blink 0.8333333333s linear 0.7291666667s infinite}.loader__item__8{transform:translate(5.6631628524px, -1.99913122px) rotate(360deg);-webkit-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);-moz-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);-o-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);--to-opacity:calc(1 - (7 / 8));animation:blink 0.8333333333s linear 0.8333333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.8333333333s infinite;-moz-animation:blink 0.8333333333s linear 0.8333333333s infinite;-o-animation:blink 0.8333333333s linear 0.8333333333s infinite}.loader__item__8{max-width:8.5px}@keyframes blink{0%{opacity:1}100%{opacity:var(--to-opacity)}}@keyframes rotate{0%{transform:rotate(0deg)}100%{background:rotate(360deg)}}";
89
100
 
90
101
  const DEEP_LINK_PREFIX = 'https://api.gataca.io/qr/redirect.html';
91
102
  //Default values
92
103
  const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
93
104
  const DEFAULT_POLLING_FREQ = 3;
94
105
  const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
95
- constructor() { super(); this.__registerHost(); this.__attachShadow(); this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7); this.checkStatus = undefined; this.createSession = undefined; this.successCallback = undefined; this.errorCallback = undefined; this.qrRole = undefined; this.qrType = 'svg'; this.callbackServer = undefined; this.autostart = true; this.autorefresh = false; this.v = '3'; this.qrModalTitle = 'Quick Access'; this.modalTitleColor = '#4745B7'; this.qrModalDescription = 'Sign up or sign in by scanning the QR Code with the Gataca Wallet'; this.hideModalTexts = false; this.hideModalBoxShadow = false; this.hideBrandTitle = false; this.logoSize = 0; this.logoSrc = logoGatacaSvg; this.qrSize = 300; this.modalWidth = 300; this.modalHeight = undefined; this.qrCodeExpiredLabel = 'QR Code expired'; this.credentialsNotValidatedLabel = 'User credentials not validated'; this.clickInsideBoxLabel = 'Click inside the box to'; this.refreshQrLabel = 'Refresh QR Code'; this.scanQrLabel = 'Scan QR Code'; this.userNotScanInTimeErrorLabel = 'User did not scan the QR in the allowed time'; this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated"; this.failedLoginErrorLabel = 'No successful login'; this.successLoginLabel = 'Successful Connection!'; this.byBrandLabel = 'by Gataca'; this.waitingStartSessionLabel = 'waiting to start a session'; this.readQrTitle = 'Processing...'; this.readQrDescription = 'Please wait a moment'; this.hideQrModalDescription = false; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT; this.pollingFrequency = DEFAULT_POLLING_FREQ; this.dynamicLink = true; this.qrStyle = undefined; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = RESULT_STATUS.NOT_STARTED; }
106
+ constructor() {
107
+ super();
108
+ this.__registerHost();
109
+ this.__attachShadow();
110
+ this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
111
+ this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
112
+ this.lastShortenRaw = null;
113
+ this.checkStatus = undefined;
114
+ this.createSession = undefined;
115
+ this.successCallback = undefined;
116
+ this.errorCallback = undefined;
117
+ this.qrRole = undefined;
118
+ this.qrType = 'svg';
119
+ this.callbackServer = undefined;
120
+ this.autostart = true;
121
+ this.autorefresh = false;
122
+ this.v = '3';
123
+ this.qrModalTitle = 'Quick Access';
124
+ this.modalTitleColor = '#4745B7';
125
+ this.qrModalDescription = 'Sign up or sign in by scanning the QR Code with the Gataca Wallet';
126
+ this.hideModalTexts = false;
127
+ this.hideModalBoxShadow = false;
128
+ this.hideBrandTitle = false;
129
+ this.logoSize = 0;
130
+ this.logoSrc = logoGatacaSvg;
131
+ this.qrSize = 300;
132
+ this.modalWidth = 300;
133
+ this.modalHeight = undefined;
134
+ this.qrCodeExpiredLabel = 'QR Code expired';
135
+ this.credentialsNotValidatedLabel = 'User credentials not validated';
136
+ this.clickInsideBoxLabel = 'Click inside the box to';
137
+ this.refreshQrLabel = 'Refresh QR Code';
138
+ this.scanQrLabel = 'Scan QR Code';
139
+ this.userNotScanInTimeErrorLabel = 'User did not scan the QR in the allowed time';
140
+ this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated";
141
+ this.failedLoginErrorLabel = 'No successful login';
142
+ this.successLoginLabel = 'Successful Connection!';
143
+ this.byBrandLabel = 'by Gataca';
144
+ this.waitingStartSessionLabel = 'waiting to start a session';
145
+ this.readQrTitle = 'Processing...';
146
+ this.readQrDescription = 'Please wait a moment';
147
+ this.hideQrModalDescription = false;
148
+ this.sessionTimeout = DEFAULT_SESSION_TIMEOUT;
149
+ this.pollingFrequency = DEFAULT_POLLING_FREQ;
150
+ this.dynamicLink = true;
151
+ this.qrStyle = undefined;
152
+ this.sessionId = undefined;
153
+ this.authenticationRequest = undefined;
154
+ this.sessionData = undefined;
155
+ this.result = RESULT_STATUS.NOT_STARTED;
156
+ this.qrHref = '';
157
+ }
96
158
  disconnectedCallback() {
97
159
  this.stop();
98
160
  }
@@ -106,6 +168,7 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
106
168
  */
107
169
  async display() {
108
170
  await this.getSessionId();
171
+ await this.refreshQrHref();
109
172
  this.result = RESULT_STATUS.ONGOING;
110
173
  this.poll()
111
174
  .then((data) => {
@@ -133,6 +196,30 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
133
196
  window.location.href = this.getLink();
134
197
  }
135
198
  }
199
+ buildRawLink() {
200
+ var _a;
201
+ if (this.v === '2') {
202
+ return (_a = this.authenticationRequest) !== null && _a !== void 0 ? _a : '';
203
+ }
204
+ const authRequestEncoded = '?dl=' + base64UrlEncode(this.authenticationRequest);
205
+ return DEEP_LINK_PREFIX + authRequestEncoded;
206
+ }
207
+ async refreshQrHref() {
208
+ var _a;
209
+ const raw = this.buildRawLink();
210
+ if (raw === this.lastShortenRaw) {
211
+ return;
212
+ }
213
+ this.lastShortenRaw = raw;
214
+ const shortened = await shortenUrlIfPossible(raw !== null && raw !== void 0 ? raw : '');
215
+ const now = this.buildRawLink();
216
+ if (now === raw) {
217
+ this.qrHref = shortened;
218
+ }
219
+ else if (!((_a = this.qrHref) === null || _a === void 0 ? void 0 : _a.trim())) {
220
+ this.qrHref = now;
221
+ }
222
+ }
136
223
  /**
137
224
  * Stop manually an ongoing session
138
225
  */
@@ -145,6 +232,8 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
145
232
  clean() {
146
233
  this.sessionData = undefined;
147
234
  this.sessionId = undefined;
235
+ this.qrHref = '';
236
+ this.lastShortenRaw = null;
148
237
  }
149
238
  /**
150
239
  * Retrieve manually the session data on a successful login
@@ -162,11 +251,7 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
162
251
  return this.sessionId;
163
252
  }
164
253
  getLink() {
165
- if (this.v === '2') {
166
- return this.authenticationRequest;
167
- }
168
- const authRequestEncoded = '?dl=' + base64UrlEncode(this.authenticationRequest);
169
- return DEEP_LINK_PREFIX + authRequestEncoded;
254
+ return this.qrHref || this.buildRawLink();
170
255
  }
171
256
  async poll() {
172
257
  let endTime = new Date().getTime() + (this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
@@ -204,11 +289,12 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
204
289
  return new Promise(checkCondition);
205
290
  }
206
291
  renderQRSection() {
292
+ var _a;
207
293
  switch (this.result) {
208
294
  case RESULT_STATUS.NOT_STARTED:
209
295
  return this.renderRetryButton();
210
296
  case RESULT_STATUS.ONGOING:
211
- return this.renderQR(this.getLink(), true);
297
+ return this.renderQR(this.getLink(), true, undefined, !!((_a = this.qrHref) === null || _a === void 0 ? void 0 : _a.trim()));
212
298
  case RESULT_STATUS.EXPIRED:
213
299
  return this.renderRetryButton(this.qrCodeExpiredLabel);
214
300
  case RESULT_STATUS.FAILED:
@@ -226,16 +312,15 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
226
312
  return h(Success, { modalHeight: this === null || this === void 0 ? void 0 : this.modalHeight, successLoginLabel: this === null || this === void 0 ? void 0 : this.successLoginLabel, style: this === null || this === void 0 ? void 0 : this.qrStyle });
227
313
  }
228
314
  renderRetryButton(errorMessage) {
229
- return (h(RetryButton, { errorMessage: errorMessage, modalWidth: this === null || this === void 0 ? void 0 : this.modalWidth, clickInsideBoxLabel: this === null || this === void 0 ? void 0 : this.clickInsideBoxLabel, refreshQrLabel: this === null || this === void 0 ? void 0 : this.refreshQrLabel, scanQrLabel: this === null || this === void 0 ? void 0 : this.scanQrLabel, waitingStartSessionLabel: this === null || this === void 0 ? void 0 : this.waitingStartSessionLabel, display: this.display.bind(this), renderRetryQR: this.renderRetryQR.bind(this), style: this === null || this === void 0 ? void 0 : this.qrStyle }));
315
+ return (h(RetryButton, { errorMessage: errorMessage, modalWidth: this === null || this === void 0 ? void 0 : this.modalWidth, clickInsideBoxLabel: this === null || this === void 0 ? void 0 : this.clickInsideBoxLabel, refreshQrLabel: this === null || this === void 0 ? void 0 : this.refreshQrLabel, scanQrLabel: this === null || this === void 0 ? void 0 : this.scanQrLabel, display: this.display.bind(this), style: this === null || this === void 0 ? void 0 : this.qrStyle }));
230
316
  }
231
317
  renderReadQR(readQrMessages) {
232
- return (h(ReadQR, { modalWidth: this === null || this === void 0 ? void 0 : this.modalWidth, readQrMessages: readQrMessages, url: this.getLink(), sizeQR: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, renderQR: this.renderQR.bind(this), style: this.qrStyle }));
233
- }
234
- renderQR(value, useLogo, sizeQR) {
235
- return h(QR, { value: value, qrType: this.qrType, useLogo: useLogo && this.logoSize !== 0, size: sizeQR || (this === null || this === void 0 ? void 0 : this.qrSize) || undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc, style: this === null || this === void 0 ? void 0 : this.qrStyle });
318
+ var _a;
319
+ const linkReady = !!((_a = this.qrHref) === null || _a === void 0 ? void 0 : _a.trim());
320
+ return (h(ReadQR, { modalWidth: this === null || this === void 0 ? void 0 : this.modalWidth, readQrMessages: readQrMessages, url: this.getLink(), sizeQR: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, renderQR: (url, useLogo, size) => this.renderQR(url, useLogo, size, linkReady), style: this.qrStyle }));
236
321
  }
237
- renderRetryQR(value, useLogo) {
238
- return h(QR, { value: value, useLogo: useLogo && this.logoSize !== 0, qrType: this.qrType, size: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc, style: this === null || this === void 0 ? void 0 : this.qrStyle });
322
+ renderQR(value, useLogo, sizeQR, linkReady = true) {
323
+ return (h(QR, { value: value, qrType: this.qrType, useLogo: useLogo && this.logoSize !== 0, size: sizeQR || (this === null || this === void 0 ? void 0 : this.qrSize) || undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc, style: this === null || this === void 0 ? void 0 : this.qrStyle, linkReady: linkReady }));
239
324
  }
240
325
  render() {
241
326
  var _a, _b, _c, _d, _e, _f;
@@ -296,6 +381,7 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
296
381
  "authenticationRequest": [32],
297
382
  "sessionData": [32],
298
383
  "result": [32],
384
+ "qrHref": [32],
299
385
  "display": [64],
300
386
  "stop": [64],
301
387
  "getSessionData": [64]
@@ -40,8 +40,8 @@ const GatacaQRDisplay = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
40
40
  this.bgColor = '#FFFFFF';
41
41
  this.rounded = true;
42
42
  }
43
- componentDidLoad() {
44
- const qrCode = new QRCodeStyling({
43
+ getQrOptions() {
44
+ return {
45
45
  data: this.qrData,
46
46
  width: this.size,
47
47
  height: this.size,
@@ -65,14 +65,35 @@ const GatacaQRDisplay = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
65
65
  backgroundOptions: {
66
66
  color: this.bgColor
67
67
  }
68
- });
69
- qrCode.append(this.qr);
68
+ };
69
+ }
70
+ componentDidLoad() {
71
+ this.mountOrUpdateQr();
72
+ }
73
+ onQrDataChange() {
74
+ this.mountOrUpdateQr();
75
+ }
76
+ mountOrUpdateQr() {
77
+ var _a;
78
+ if (!((_a = this.qrData) === null || _a === void 0 ? void 0 : _a.trim()) || !this.qr) {
79
+ return;
80
+ }
81
+ if (!this.qrCode) {
82
+ this.qrCode = new QRCodeStyling(this.getQrOptions());
83
+ this.qrCode.append(this.qr);
84
+ }
85
+ else {
86
+ this.qrCode.update({ data: this.qrData });
87
+ }
70
88
  }
71
89
  render() {
72
90
  return (h("div", { ref: (el) => {
73
91
  this.qr = el;
74
92
  } }));
75
93
  }
94
+ static get watchers() { return {
95
+ "qrData": ["onQrDataChange"]
96
+ }; }
76
97
  }, [0, "gataca-qrdisplay", {
77
98
  "qrData": [1, "qr-data"],
78
99
  "qrType": [1, "qr-type"],