@gataca/qr 4.0.3 → 4.1.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,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-1332a8ce.js');
3
+ const index = require('./index-d8d3dfde.js');
4
4
 
5
5
  /*
6
6
  Stencil Client Patch Browser v2.19.3 | MIT Licensed | https://stenciljs.com
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["gataca-qr_3.cjs",[[1,"gataca-ssibutton",{"buttonText":[1,"button-text"],"buttonDCAPIText":[1,"button-d-c-a-p-i-text"],"qrType":[1,"qr-type"],"autostart":[4],"checkStatus":[16],"createSession":[16],"fillSession":[16],"successCallback":[16],"errorCallback":[16],"handleCheckAppLoading":[16],"checkAppTimeout":[2,"check-app-timeout"],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"sessionTimeout":[2,"session-timeout"],"pollingFrequency":[2,"polling-frequency"],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"enableDcApi":[4,"enable-dc-api"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"qrStyle":[16],"open":[32],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"getSessionData":[64],"startMobilePolling":[64],"stop":[64]}],[1,"gataca-qr",{"checkStatus":[16],"createSession":[16],"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"qrType":[1,"qr-type"],"callbackServer":[1,"callback-server"],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideModalTexts":[4,"hide-modal-texts"],"hideModalBoxShadow":[4,"hide-modal-box-shadow"],"hideBrandTitle":[4,"hide-brand-title"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrSize":[2,"qr-size"],"modalWidth":[2,"modal-width"],"modalHeight":[2,"modal-height"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"readQrTitle":[1,"read-qr-title"],"readQrDescription":[1,"read-qr-description"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"sessionTimeout":[2,"session-timeout"],"pollingFrequency":[2,"polling-frequency"],"dynamicLink":[4,"dynamic-link"],"qrStyle":[16],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"display":[64],"stop":[64],"getSessionData":[64]}],[0,"gataca-qrdisplay",{"qrData":[1,"qr-data"],"qrType":[1,"qr-type"],"size":[2],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrColor":[1,"qr-color"],"bgColor":[1,"bg-color"],"rounded":[4]}]]],["gataca-qrws.cjs",[[1,"gataca-qrws",{"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"qrType":[1,"qr-type"],"callbackServer":[1,"callback-server"],"socketEndpoint":[1,"socket-endpoint"],"sessionTimeout":[2,"session-timeout"],"wsOnOpen":[16],"wsOnMessage":[16],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideModalTexts":[4,"hide-modal-texts"],"hideModalBoxShadow":[4,"hide-modal-box-shadow"],"hideBrandTitle":[4,"hide-brand-title"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrSize":[2,"qr-size"],"modalWidth":[2,"modal-width"],"modalHeight":[2,"modal-height"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"readQrTitle":[1,"read-qr-title"],"readQrDescription":[1,"read-qr-description"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"dynamicLink":[4,"dynamic-link"],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"display":[64],"stop":[64],"getSessionData":[64]},[[2,"sessionMsg","sessionMsgReceived"]]]]],["gataca-ssibuttonws.cjs",[[1,"gataca-ssibuttonws",{"buttonText":[1,"button-text"],"successCallback":[16],"errorCallback":[16],"qrType":[1,"qr-type"],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"socketEndpoint":[1,"socket-endpoint"],"sessionTimeout":[2,"session-timeout"],"wsOnOpen":[16],"wsOnMessage":[16],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"open":[32],"getSessionData":[64]}]]],["gataca-autoqr.cjs",[[1,"gataca-autoqr",{"configId":[1,"config-id"],"qrType":[1,"qr-type"],"configRepository":[1,"config-repository"],"successCallback":[16],"errorCallback":[16],"checkStatus":[16],"createSession":[16],"wsOnOpen":[16],"wsOnMessage":[16],"config":[32],"loading":[32],"getSessionData":[64]}]]]], options);
18
+ return index.bootstrapLazy([["gataca-qr_3.cjs",[[1,"gataca-ssibutton",{"buttonText":[1,"button-text"],"buttonDCAPIText":[1,"button-d-c-a-p-i-text"],"qrType":[1,"qr-type"],"autostart":[4],"checkStatus":[16],"createSession":[16],"fillSession":[16],"successCallback":[16],"errorCallback":[16],"handleCheckAppLoading":[16],"checkAppTimeout":[2,"check-app-timeout"],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"sessionTimeout":[2,"session-timeout"],"pollingFrequency":[2,"polling-frequency"],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"enableDcApi":[4,"enable-dc-api"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"qrStyle":[16],"open":[32],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"getSessionData":[64],"startMobilePolling":[64],"stop":[64]}],[1,"gataca-qr",{"checkStatus":[16],"createSession":[16],"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"qrType":[1,"qr-type"],"callbackServer":[1,"callback-server"],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideModalTexts":[4,"hide-modal-texts"],"hideModalBoxShadow":[4,"hide-modal-box-shadow"],"hideBrandTitle":[4,"hide-brand-title"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrSize":[2,"qr-size"],"modalWidth":[2,"modal-width"],"modalHeight":[2,"modal-height"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"readQrTitle":[1,"read-qr-title"],"readQrDescription":[1,"read-qr-description"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"sessionTimeout":[2,"session-timeout"],"pollingFrequency":[2,"polling-frequency"],"dynamicLink":[4,"dynamic-link"],"qrStyle":[16],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"qrHref":[32],"display":[64],"stop":[64],"getSessionData":[64]}],[0,"gataca-qrdisplay",{"qrData":[1,"qr-data"],"qrType":[1,"qr-type"],"size":[2],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrColor":[1,"qr-color"],"bgColor":[1,"bg-color"],"rounded":[4]}]]],["gataca-qrws.cjs",[[1,"gataca-qrws",{"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"qrType":[1,"qr-type"],"callbackServer":[1,"callback-server"],"socketEndpoint":[1,"socket-endpoint"],"sessionTimeout":[2,"session-timeout"],"wsOnOpen":[16],"wsOnMessage":[16],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideModalTexts":[4,"hide-modal-texts"],"hideModalBoxShadow":[4,"hide-modal-box-shadow"],"hideBrandTitle":[4,"hide-brand-title"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrSize":[2,"qr-size"],"modalWidth":[2,"modal-width"],"modalHeight":[2,"modal-height"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"readQrTitle":[1,"read-qr-title"],"readQrDescription":[1,"read-qr-description"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"dynamicLink":[4,"dynamic-link"],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"qrHref":[32],"qrShortenPending":[32],"display":[64],"stop":[64],"getSessionData":[64]},[[2,"sessionMsg","sessionMsgReceived"]]]]],["gataca-ssibuttonws.cjs",[[1,"gataca-ssibuttonws",{"buttonText":[1,"button-text"],"successCallback":[16],"errorCallback":[16],"qrType":[1,"qr-type"],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"socketEndpoint":[1,"socket-endpoint"],"sessionTimeout":[2,"session-timeout"],"wsOnOpen":[16],"wsOnMessage":[16],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"open":[32],"getSessionData":[64]}]]],["gataca-autoqr.cjs",[[1,"gataca-autoqr",{"configId":[1,"config-id"],"qrType":[1,"qr-type"],"configRepository":[1,"config-repository"],"successCallback":[16],"errorCallback":[16],"checkStatus":[16],"createSession":[16],"wsOnOpen":[16],"wsOnMessage":[16],"config":[32],"loading":[32],"getSessionData":[64]}]]]], options);
19
19
  });
@@ -1000,6 +1000,7 @@ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propNam
1000
1000
  const setValue = (ref, propName, newVal, cmpMeta) => {
1001
1001
  // check our new property value against our internal value
1002
1002
  const hostRef = getHostRef(ref);
1003
+ const elm = hostRef.$hostElement$ ;
1003
1004
  const oldVal = hostRef.$instanceValues$.get(propName);
1004
1005
  const flags = hostRef.$flags$;
1005
1006
  const instance = hostRef.$lazyInstance$ ;
@@ -1012,6 +1013,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1012
1013
  // set our new value!
1013
1014
  hostRef.$instanceValues$.set(propName, newVal);
1014
1015
  if (instance) {
1016
+ // get an array of method names of watch functions to call
1017
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1018
+ const watchMethods = cmpMeta.$watchers$[propName];
1019
+ if (watchMethods) {
1020
+ // this instance is watching for when this property changed
1021
+ watchMethods.map((watchMethodName) => {
1022
+ try {
1023
+ // fire off each of the watch methods that are watching this property
1024
+ instance[watchMethodName](newVal, oldVal, propName);
1025
+ }
1026
+ catch (e) {
1027
+ consoleError(e, elm);
1028
+ }
1029
+ });
1030
+ }
1031
+ }
1015
1032
  if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1016
1033
  // looks like this value actually changed, so we've got work to do!
1017
1034
  // but only if we've already rendered, otherwise just chill out
@@ -1034,6 +1051,9 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1034
1051
  */
1035
1052
  const proxyComponent = (Cstr, cmpMeta, flags) => {
1036
1053
  if (cmpMeta.$members$) {
1054
+ if (Cstr.watchers) {
1055
+ cmpMeta.$watchers$ = Cstr.watchers;
1056
+ }
1037
1057
  // It's better to have a const than two Object.entries()
1038
1058
  const members = Object.entries(cmpMeta.$members$);
1039
1059
  const prototype = Cstr.prototype;
@@ -1148,6 +1168,12 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1148
1168
  endLoad();
1149
1169
  }
1150
1170
  if (!Cstr.isProxied) {
1171
+ // we've never proxied this Constructor before
1172
+ // let's add the getters/setters to its prototype before
1173
+ // the first time we create an instance of the implementation
1174
+ {
1175
+ cmpMeta.$watchers$ = Cstr.watchers;
1176
+ }
1151
1177
  proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1152
1178
  Cstr.isProxied = true;
1153
1179
  }
@@ -1171,6 +1197,9 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1171
1197
  {
1172
1198
  hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1173
1199
  }
1200
+ {
1201
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1202
+ }
1174
1203
  endNewInstance();
1175
1204
  }
1176
1205
  if (Cstr.style) {
@@ -1289,6 +1318,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1289
1318
  {
1290
1319
  cmpMeta.$listeners$ = compactMeta[3];
1291
1320
  }
1321
+ {
1322
+ cmpMeta.$watchers$ = {};
1323
+ }
1292
1324
  const tagName = cmpMeta.$tagName$;
1293
1325
  const HostElement = class extends HTMLElement {
1294
1326
  // StencilLazyHost
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const utils = require('./utils-c6edb275.js');
5
+ const utils = require('./utils-17b0a5ba.js');
6
6
 
7
7
 
8
8
 
@@ -14,3 +14,4 @@ Object.defineProperty(exports, 'RESULT_STATUS', {
14
14
  });
15
15
  exports.base64UrlEncode = utils.base64UrlEncode;
16
16
  exports.checkMobile = utils.checkMobile;
17
+ exports.shortenUrlIfPossible = utils.shortenUrlIfPossible;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-1332a8ce.js');
5
+ const index = require('./index-d8d3dfde.js');
6
6
 
7
7
  /*
8
8
  Stencil Client Patch Esm v2.19.3 | MIT Licensed | https://stenciljs.com
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["gataca-qr_3.cjs",[[1,"gataca-ssibutton",{"buttonText":[1,"button-text"],"buttonDCAPIText":[1,"button-d-c-a-p-i-text"],"qrType":[1,"qr-type"],"autostart":[4],"checkStatus":[16],"createSession":[16],"fillSession":[16],"successCallback":[16],"errorCallback":[16],"handleCheckAppLoading":[16],"checkAppTimeout":[2,"check-app-timeout"],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"sessionTimeout":[2,"session-timeout"],"pollingFrequency":[2,"polling-frequency"],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"enableDcApi":[4,"enable-dc-api"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"qrStyle":[16],"open":[32],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"getSessionData":[64],"startMobilePolling":[64],"stop":[64]}],[1,"gataca-qr",{"checkStatus":[16],"createSession":[16],"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"qrType":[1,"qr-type"],"callbackServer":[1,"callback-server"],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideModalTexts":[4,"hide-modal-texts"],"hideModalBoxShadow":[4,"hide-modal-box-shadow"],"hideBrandTitle":[4,"hide-brand-title"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrSize":[2,"qr-size"],"modalWidth":[2,"modal-width"],"modalHeight":[2,"modal-height"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"readQrTitle":[1,"read-qr-title"],"readQrDescription":[1,"read-qr-description"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"sessionTimeout":[2,"session-timeout"],"pollingFrequency":[2,"polling-frequency"],"dynamicLink":[4,"dynamic-link"],"qrStyle":[16],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"display":[64],"stop":[64],"getSessionData":[64]}],[0,"gataca-qrdisplay",{"qrData":[1,"qr-data"],"qrType":[1,"qr-type"],"size":[2],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrColor":[1,"qr-color"],"bgColor":[1,"bg-color"],"rounded":[4]}]]],["gataca-qrws.cjs",[[1,"gataca-qrws",{"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"qrType":[1,"qr-type"],"callbackServer":[1,"callback-server"],"socketEndpoint":[1,"socket-endpoint"],"sessionTimeout":[2,"session-timeout"],"wsOnOpen":[16],"wsOnMessage":[16],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideModalTexts":[4,"hide-modal-texts"],"hideModalBoxShadow":[4,"hide-modal-box-shadow"],"hideBrandTitle":[4,"hide-brand-title"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrSize":[2,"qr-size"],"modalWidth":[2,"modal-width"],"modalHeight":[2,"modal-height"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"readQrTitle":[1,"read-qr-title"],"readQrDescription":[1,"read-qr-description"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"dynamicLink":[4,"dynamic-link"],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"display":[64],"stop":[64],"getSessionData":[64]},[[2,"sessionMsg","sessionMsgReceived"]]]]],["gataca-ssibuttonws.cjs",[[1,"gataca-ssibuttonws",{"buttonText":[1,"button-text"],"successCallback":[16],"errorCallback":[16],"qrType":[1,"qr-type"],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"socketEndpoint":[1,"socket-endpoint"],"sessionTimeout":[2,"session-timeout"],"wsOnOpen":[16],"wsOnMessage":[16],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"open":[32],"getSessionData":[64]}]]],["gataca-autoqr.cjs",[[1,"gataca-autoqr",{"configId":[1,"config-id"],"qrType":[1,"qr-type"],"configRepository":[1,"config-repository"],"successCallback":[16],"errorCallback":[16],"checkStatus":[16],"createSession":[16],"wsOnOpen":[16],"wsOnMessage":[16],"config":[32],"loading":[32],"getSessionData":[64]}]]]], options);
17
+ return index.bootstrapLazy([["gataca-qr_3.cjs",[[1,"gataca-ssibutton",{"buttonText":[1,"button-text"],"buttonDCAPIText":[1,"button-d-c-a-p-i-text"],"qrType":[1,"qr-type"],"autostart":[4],"checkStatus":[16],"createSession":[16],"fillSession":[16],"successCallback":[16],"errorCallback":[16],"handleCheckAppLoading":[16],"checkAppTimeout":[2,"check-app-timeout"],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"sessionTimeout":[2,"session-timeout"],"pollingFrequency":[2,"polling-frequency"],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"enableDcApi":[4,"enable-dc-api"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"qrStyle":[16],"open":[32],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"getSessionData":[64],"startMobilePolling":[64],"stop":[64]}],[1,"gataca-qr",{"checkStatus":[16],"createSession":[16],"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"qrType":[1,"qr-type"],"callbackServer":[1,"callback-server"],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideModalTexts":[4,"hide-modal-texts"],"hideModalBoxShadow":[4,"hide-modal-box-shadow"],"hideBrandTitle":[4,"hide-brand-title"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrSize":[2,"qr-size"],"modalWidth":[2,"modal-width"],"modalHeight":[2,"modal-height"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"readQrTitle":[1,"read-qr-title"],"readQrDescription":[1,"read-qr-description"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"sessionTimeout":[2,"session-timeout"],"pollingFrequency":[2,"polling-frequency"],"dynamicLink":[4,"dynamic-link"],"qrStyle":[16],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"qrHref":[32],"display":[64],"stop":[64],"getSessionData":[64]}],[0,"gataca-qrdisplay",{"qrData":[1,"qr-data"],"qrType":[1,"qr-type"],"size":[2],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrColor":[1,"qr-color"],"bgColor":[1,"bg-color"],"rounded":[4]}]]],["gataca-qrws.cjs",[[1,"gataca-qrws",{"successCallback":[16],"errorCallback":[16],"qrRole":[1,"qr-role"],"qrType":[1,"qr-type"],"callbackServer":[1,"callback-server"],"socketEndpoint":[1,"socket-endpoint"],"sessionTimeout":[2,"session-timeout"],"wsOnOpen":[16],"wsOnMessage":[16],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"modalTitleColor":[1,"modal-title-color"],"qrModalDescription":[1,"qr-modal-description"],"hideModalTexts":[4,"hide-modal-texts"],"hideModalBoxShadow":[4,"hide-modal-box-shadow"],"hideBrandTitle":[4,"hide-brand-title"],"logoSize":[2,"logo-size"],"logoSrc":[1,"logo-src"],"qrSize":[2,"qr-size"],"modalWidth":[2,"modal-width"],"modalHeight":[2,"modal-height"],"qrCodeExpiredLabel":[1,"qr-code-expired-label"],"credentialsNotValidatedLabel":[1,"credentials-not-validated-label"],"clickInsideBoxLabel":[1,"click-inside-box-label"],"refreshQrLabel":[1,"refresh-qr-label"],"scanQrLabel":[1,"scan-qr-label"],"userNotScanInTimeErrorLabel":[1,"user-not-scan-in-time-error-label"],"credsNotValidatedErrorLabel":[1,"creds-not-validated-error-label"],"failedLoginErrorLabel":[1,"failed-login-error-label"],"successLoginLabel":[1,"success-login-label"],"byBrandLabel":[1,"by-brand-label"],"waitingStartSessionLabel":[1,"waiting-start-session-label"],"readQrTitle":[1,"read-qr-title"],"readQrDescription":[1,"read-qr-description"],"hideQrModalDescription":[4,"hide-qr-modal-description"],"dynamicLink":[4,"dynamic-link"],"sessionId":[32],"authenticationRequest":[32],"sessionData":[32],"result":[32],"qrHref":[32],"qrShortenPending":[32],"display":[64],"stop":[64],"getSessionData":[64]},[[2,"sessionMsg","sessionMsgReceived"]]]]],["gataca-ssibuttonws.cjs",[[1,"gataca-ssibuttonws",{"buttonText":[1,"button-text"],"successCallback":[16],"errorCallback":[16],"qrType":[1,"qr-type"],"qrRole":[1,"qr-role"],"callbackServer":[1,"callback-server"],"socketEndpoint":[1,"socket-endpoint"],"sessionTimeout":[2,"session-timeout"],"wsOnOpen":[16],"wsOnMessage":[16],"autostart":[4],"autorefresh":[4],"v":[1],"qrModalTitle":[1,"qr-modal-title"],"qrModalDescription":[1,"qr-modal-description"],"hideBrandTitle":[4,"hide-brand-title"],"dynamicLink":[4,"dynamic-link"],"open":[32],"getSessionData":[64]}]]],["gataca-autoqr.cjs",[[1,"gataca-autoqr",{"configId":[1,"config-id"],"qrType":[1,"qr-type"],"configRepository":[1,"config-repository"],"successCallback":[16],"errorCallback":[16],"checkStatus":[16],"createSession":[16],"wsOnOpen":[16],"wsOnMessage":[16],"config":[32],"loading":[32],"getSessionData":[64]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -22,7 +22,51 @@ exports.RESULT_STATUS = void 0;
22
22
  RESULT_STATUS[RESULT_STATUS["EXPIRED"] = 3] = "EXPIRED";
23
23
  RESULT_STATUS[RESULT_STATUS["READ"] = 5] = "READ";
24
24
  })(exports.RESULT_STATUS || (exports.RESULT_STATUS = {}));
25
+ const GATACA_SHORTEN_API = 'https://links.gataca.io/api/v1/short';
26
+ function extractShortUrlFromResponse(body) {
27
+ if (!body || typeof body !== 'object') {
28
+ return null;
29
+ }
30
+ const o = body;
31
+ for (const key of ['url', 'shortUrl', 'short_url', 'link']) {
32
+ const v = o[key];
33
+ if (typeof v === 'string' && v.trim() !== '') {
34
+ return v;
35
+ }
36
+ }
37
+ return null;
38
+ }
39
+ /**
40
+ * POSTs the link to shortener. On success with a non-empty url in the body, returns that url;
41
+ * otherwise returns the original link.
42
+ */
43
+ async function shortenUrlIfPossible(link) {
44
+ const trimmedLink = (link === null || link === void 0 ? void 0 : link.trim()) || '';
45
+ const linkHasLength = trimmedLink === null || trimmedLink === void 0 ? void 0 : trimmedLink.length;
46
+ if (!linkHasLength) {
47
+ return link !== null && link !== void 0 ? link : '';
48
+ }
49
+ try {
50
+ const res = await fetch(GATACA_SHORTEN_API, {
51
+ method: 'POST',
52
+ mode: 'cors',
53
+ credentials: 'omit',
54
+ headers: { 'Content-Type': 'application/json' },
55
+ body: JSON.stringify({ url: trimmedLink })
56
+ });
57
+ if (res.status !== 200 && res.status !== 201) {
58
+ return link;
59
+ }
60
+ const data = await res.json().catch(() => null);
61
+ const short = extractShortUrlFromResponse(data);
62
+ return short !== null && short !== void 0 ? short : link;
63
+ }
64
+ catch (_a) {
65
+ return link;
66
+ }
67
+ }
25
68
  //
26
69
 
27
70
  exports.base64UrlEncode = base64UrlEncode;
28
71
  exports.checkMobile = checkMobile;
72
+ exports.shortenUrlIfPossible = shortenUrlIfPossible;
@@ -1,5 +1,13 @@
1
1
  import { h } from '@stencil/core';
2
2
  export const QR = (props) => {
3
- const { value, useLogo, logoSrc, size, qrType, style } = props;
3
+ const { value, useLogo, logoSrc, size, qrType, style, linkReady = true } = props;
4
+ const s = size !== null && size !== void 0 ? size : 256;
5
+ if (!linkReady) {
6
+ return (h("div", { class: "qr-loading-slot", style: {
7
+ width: s + 'px',
8
+ height: s + 'px',
9
+ margin: '0 auto'
10
+ } }));
11
+ }
4
12
  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 });
5
13
  };
@@ -3,7 +3,7 @@ import alertIcon from '../../../../assets/icons/gat-icon-alert.svg';
3
3
  import { RefreshIcon } from '../../../icons/RefreshIcon';
4
4
  export const RetryButton = (props) => {
5
5
  var _a;
6
- const { errorMessage, modalWidth, clickInsideBoxLabel, refreshQrLabel, scanQrLabel, waitingStartSessionLabel, style, display, renderRetryQR } = props;
6
+ const { errorMessage, modalWidth, clickInsideBoxLabel, refreshQrLabel, scanQrLabel, style, display } = props;
7
7
  const bgStyle = { backgroundColor: (style === null || style === void 0 ? void 0 : style.bgColor) ? style === null || style === void 0 ? void 0 : style.bgColor : 'white' };
8
8
  const alertBgStyle = { backgroundColor: (style === null || style === void 0 ? void 0 : style.alertBgColor) ? style === null || style === void 0 ? void 0 : style.alertBgColor : '#ffdedf' };
9
9
  const alertBorderColor = { borderColor: (style === null || style === void 0 ? void 0 : style.alertBorderColor) ? style === null || style === void 0 ? void 0 : style.alertBorderColor : '#ee888c' };
@@ -12,5 +12,8 @@ export const RetryButton = (props) => {
12
12
  width: (modalWidth - 48).toString() + 'px',
13
13
  height: modalWidth ? ((_a = (modalWidth - 48)) === null || _a === void 0 ? void 0 : _a.toString()) + 'px' : '',
14
14
  border: (style === null || style === void 0 ? void 0 : style.color) ? `1px dashed ${style === null || style === void 0 ? void 0 : style.color}` : `1px dashed #a1a1a1`
15
- } }, h("div", { id: "notify", onClick: () => display(), style: bgStyle }, h(RefreshIcon, { color: style === null || style === void 0 ? void 0 : style.color, height: 24, width: 24 }), h("p", { class: "notify-text", style: color }, clickInsideBoxLabel, ' '), errorMessage ? (h("p", { class: "notify-text bold", style: color }, refreshQrLabel)) : (h("p", { class: "notify-text bold", style: color }, scanQrLabel)), errorMessage && (h("div", { class: "alert", style: Object.assign(Object.assign({ width: (modalWidth - 48).toString() + 'px' }, alertBgStyle), { border: `1px solid ${alertBorderColor}` }) }, h("img", { src: alertIcon, height: 24, width: 24 }), h("p", { style: { color: (style === null || style === void 0 ? void 0 : style.color) ? style === null || style === void 0 ? void 0 : style.color : '#1e1e20' } }, errorMessage)))), h("div", { id: "qrwait" }, renderRetryQR(waitingStartSessionLabel))));
15
+ } }, h("div", { id: "notify", onClick: () => display(), style: bgStyle }, h(RefreshIcon, { color: style === null || style === void 0 ? void 0 : style.color, height: 24, width: 24 }), h("p", { class: "notify-text", style: color }, clickInsideBoxLabel, ' '), errorMessage ? (h("p", { class: "notify-text bold", style: color }, refreshQrLabel)) : (h("p", { class: "notify-text bold", style: color }, scanQrLabel)), errorMessage && (h("div", { class: "alert", style: Object.assign(Object.assign({ width: (modalWidth - 48).toString() + 'px' }, alertBgStyle), { border: `1px solid ${alertBorderColor}` }) }, h("img", { src: alertIcon, height: 24, width: 24 }), h("p", { style: { color: (style === null || style === void 0 ? void 0 : style.color) ? style === null || style === void 0 ? void 0 : style.color : '#1e1e20' } }, errorMessage)))), h("div", { id: "qrwait", class: "qr-placeholder-slot", style: {
16
+ width: (modalWidth - 48).toString() + 'px',
17
+ height: modalWidth ? (modalWidth - 48).toString() + 'px' : ''
18
+ } })));
16
19
  };
@@ -212,6 +212,12 @@ img {
212
212
  justify-content: center;
213
213
  }
214
214
 
215
+ .qr-placeholder-slot {
216
+ box-sizing: border-box;
217
+ border-radius: 12px;
218
+ background: rgba(0, 0, 0, 0.04);
219
+ }
220
+
215
221
  #qrwait,
216
222
  #notify {
217
223
  width: 100%;
@@ -1,6 +1,6 @@
1
1
  import { h } from '@stencil/core';
2
2
  import logoGataca from '../../assets/images/logo_gataca.svg';
3
- import { base64UrlEncode, checkMobile, RESULT_STATUS } from '../../utils/utils';
3
+ import { base64UrlEncode, checkMobile, RESULT_STATUS, shortenUrlIfPossible } from '../../utils/utils';
4
4
  import '../gataca-qrdisplay/gataca-qrdisplay';
5
5
  import { QR } from './components/qr/QR';
6
6
  import { ReadQR } from './components/readQR/ReadQR';
@@ -11,7 +11,53 @@ const DEEP_LINK_PREFIX = 'https://api.gataca.io/qr/redirect.html';
11
11
  const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
12
12
  const DEFAULT_POLLING_FREQ = 3;
13
13
  export class GatacaQR {
14
- constructor() { 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 = 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.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; }
14
+ constructor() {
15
+ this.lastShortenRaw = null;
16
+ this.checkStatus = undefined;
17
+ this.createSession = undefined;
18
+ this.successCallback = undefined;
19
+ this.errorCallback = undefined;
20
+ this.qrRole = undefined;
21
+ this.qrType = 'svg';
22
+ this.callbackServer = undefined;
23
+ this.autostart = true;
24
+ this.autorefresh = false;
25
+ this.v = '3';
26
+ this.qrModalTitle = 'Quick Access';
27
+ this.modalTitleColor = '#4745B7';
28
+ this.qrModalDescription = 'Sign up or sign in by scanning the QR Code with the Gataca Wallet';
29
+ this.hideModalTexts = false;
30
+ this.hideModalBoxShadow = false;
31
+ this.hideBrandTitle = false;
32
+ this.logoSize = 0;
33
+ this.logoSrc = logoGataca;
34
+ this.qrSize = 300;
35
+ this.modalWidth = 300;
36
+ this.modalHeight = undefined;
37
+ this.qrCodeExpiredLabel = 'QR Code expired';
38
+ this.credentialsNotValidatedLabel = 'User credentials not validated';
39
+ this.clickInsideBoxLabel = 'Click inside the box to';
40
+ this.refreshQrLabel = 'Refresh QR Code';
41
+ this.scanQrLabel = 'Scan QR Code';
42
+ this.userNotScanInTimeErrorLabel = 'User did not scan the QR in the allowed time';
43
+ this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated";
44
+ this.failedLoginErrorLabel = 'No successful login';
45
+ this.successLoginLabel = 'Successful Connection!';
46
+ this.byBrandLabel = 'by Gataca';
47
+ this.waitingStartSessionLabel = 'waiting to start a session';
48
+ this.readQrTitle = 'Processing...';
49
+ this.readQrDescription = 'Please wait a moment';
50
+ this.hideQrModalDescription = false;
51
+ this.sessionTimeout = DEFAULT_SESSION_TIMEOUT;
52
+ this.pollingFrequency = DEFAULT_POLLING_FREQ;
53
+ this.dynamicLink = true;
54
+ this.qrStyle = undefined;
55
+ this.sessionId = undefined;
56
+ this.authenticationRequest = undefined;
57
+ this.sessionData = undefined;
58
+ this.result = RESULT_STATUS.NOT_STARTED;
59
+ this.qrHref = '';
60
+ }
15
61
  disconnectedCallback() {
16
62
  this.stop();
17
63
  }
@@ -25,6 +71,7 @@ export class GatacaQR {
25
71
  */
26
72
  async display() {
27
73
  await this.getSessionId();
74
+ await this.refreshQrHref();
28
75
  this.result = RESULT_STATUS.ONGOING;
29
76
  this.poll()
30
77
  .then((data) => {
@@ -52,6 +99,30 @@ export class GatacaQR {
52
99
  window.location.href = this.getLink();
53
100
  }
54
101
  }
102
+ buildRawLink() {
103
+ var _a;
104
+ if (this.v === '2') {
105
+ return (_a = this.authenticationRequest) !== null && _a !== void 0 ? _a : '';
106
+ }
107
+ const authRequestEncoded = '?dl=' + base64UrlEncode(this.authenticationRequest);
108
+ return DEEP_LINK_PREFIX + authRequestEncoded;
109
+ }
110
+ async refreshQrHref() {
111
+ var _a;
112
+ const raw = this.buildRawLink();
113
+ if (raw === this.lastShortenRaw) {
114
+ return;
115
+ }
116
+ this.lastShortenRaw = raw;
117
+ const shortened = await shortenUrlIfPossible(raw !== null && raw !== void 0 ? raw : '');
118
+ const now = this.buildRawLink();
119
+ if (now === raw) {
120
+ this.qrHref = shortened;
121
+ }
122
+ else if (!((_a = this.qrHref) === null || _a === void 0 ? void 0 : _a.trim())) {
123
+ this.qrHref = now;
124
+ }
125
+ }
55
126
  /**
56
127
  * Stop manually an ongoing session
57
128
  */
@@ -64,6 +135,8 @@ export class GatacaQR {
64
135
  clean() {
65
136
  this.sessionData = undefined;
66
137
  this.sessionId = undefined;
138
+ this.qrHref = '';
139
+ this.lastShortenRaw = null;
67
140
  }
68
141
  /**
69
142
  * Retrieve manually the session data on a successful login
@@ -81,11 +154,7 @@ export class GatacaQR {
81
154
  return this.sessionId;
82
155
  }
83
156
  getLink() {
84
- if (this.v === '2') {
85
- return this.authenticationRequest;
86
- }
87
- const authRequestEncoded = '?dl=' + base64UrlEncode(this.authenticationRequest);
88
- return DEEP_LINK_PREFIX + authRequestEncoded;
157
+ return this.qrHref || this.buildRawLink();
89
158
  }
90
159
  async poll() {
91
160
  let endTime = new Date().getTime() + (this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
@@ -123,11 +192,12 @@ export class GatacaQR {
123
192
  return new Promise(checkCondition);
124
193
  }
125
194
  renderQRSection() {
195
+ var _a;
126
196
  switch (this.result) {
127
197
  case RESULT_STATUS.NOT_STARTED:
128
198
  return this.renderRetryButton();
129
199
  case RESULT_STATUS.ONGOING:
130
- return this.renderQR(this.getLink(), true);
200
+ return this.renderQR(this.getLink(), true, undefined, !!((_a = this.qrHref) === null || _a === void 0 ? void 0 : _a.trim()));
131
201
  case RESULT_STATUS.EXPIRED:
132
202
  return this.renderRetryButton(this.qrCodeExpiredLabel);
133
203
  case RESULT_STATUS.FAILED:
@@ -145,16 +215,15 @@ export class GatacaQR {
145
215
  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 });
146
216
  }
147
217
  renderRetryButton(errorMessage) {
148
- 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 }));
218
+ 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 }));
149
219
  }
150
220
  renderReadQR(readQrMessages) {
151
- 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 }));
152
- }
153
- renderQR(value, useLogo, sizeQR) {
154
- 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 });
221
+ var _a;
222
+ const linkReady = !!((_a = this.qrHref) === null || _a === void 0 ? void 0 : _a.trim());
223
+ 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 }));
155
224
  }
156
- renderRetryQR(value, useLogo) {
157
- 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 });
225
+ renderQR(value, useLogo, sizeQR, linkReady = true) {
226
+ 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 }));
158
227
  }
159
228
  render() {
160
229
  var _a, _b, _c, _d, _e, _f;
@@ -904,7 +973,8 @@ export class GatacaQR {
904
973
  "sessionId": {},
905
974
  "authenticationRequest": {},
906
975
  "sessionData": {},
907
- "result": {}
976
+ "result": {},
977
+ "qrHref": {}
908
978
  };
909
979
  }
910
980
  static get events() {
@@ -12,8 +12,8 @@ export class GatacaQRDisplay {
12
12
  this.bgColor = '#FFFFFF';
13
13
  this.rounded = true;
14
14
  }
15
- componentDidLoad() {
16
- const qrCode = new QRCodeStyling({
15
+ getQrOptions() {
16
+ return {
17
17
  data: this.qrData,
18
18
  width: this.size,
19
19
  height: this.size,
@@ -37,8 +37,26 @@ export class GatacaQRDisplay {
37
37
  backgroundOptions: {
38
38
  color: this.bgColor
39
39
  }
40
- });
41
- qrCode.append(this.qr);
40
+ };
41
+ }
42
+ componentDidLoad() {
43
+ this.mountOrUpdateQr();
44
+ }
45
+ onQrDataChange() {
46
+ this.mountOrUpdateQr();
47
+ }
48
+ mountOrUpdateQr() {
49
+ var _a;
50
+ if (!((_a = this.qrData) === null || _a === void 0 ? void 0 : _a.trim()) || !this.qr) {
51
+ return;
52
+ }
53
+ if (!this.qrCode) {
54
+ this.qrCode = new QRCodeStyling(this.getQrOptions());
55
+ this.qrCode.append(this.qr);
56
+ }
57
+ else {
58
+ this.qrCode.update({ data: this.qrData });
59
+ }
42
60
  }
43
61
  render() {
44
62
  return (h("div", { ref: (el) => {
@@ -197,4 +215,10 @@ export class GatacaQRDisplay {
197
215
  }
198
216
  };
199
217
  }
218
+ static get watchers() {
219
+ return [{
220
+ "propName": "qrData",
221
+ "methodName": "onQrDataChange"
222
+ }];
223
+ }
200
224
  }
@@ -1,5 +1,13 @@
1
1
  import { h } from '@stencil/core';
2
2
  export const QR = (props) => {
3
- const { value, useLogo, logoSrc, size, qrType } = props;
3
+ const { value, useLogo, logoSrc, size, qrType, linkReady = true } = props;
4
+ const s = size !== null && size !== void 0 ? size : 256;
5
+ if (!linkReady) {
6
+ return (h("div", { class: "qr-loading-slot", style: {
7
+ width: s + 'px',
8
+ height: s + 'px',
9
+ margin: '0 auto'
10
+ } }));
11
+ }
4
12
  return h("gataca-qrdisplay", { qrData: value, rounded: true, size: size, qrType: qrType, "logo-size": useLogo ? 0.33 : 0, "logo-src": logoSrc });
5
13
  };
@@ -3,11 +3,14 @@ import refreshIcon from '../../../../assets/icons/gat-icon-refresh.svg';
3
3
  import alertIcon from '../../../../assets/icons/gat-icon-alert.svg';
4
4
  export const RetryButton = (props) => {
5
5
  var _a;
6
- const { errorMessage, modalWidth, clickInsideBoxLabel, refreshQrLabel, scanQrLabel, waitingStartSessionLabel, display, renderRetryQR } = props;
6
+ const { errorMessage, modalWidth, clickInsideBoxLabel, refreshQrLabel, scanQrLabel, display } = props;
7
7
  return (h("div", { class: "reload", style: {
8
8
  width: (modalWidth - 48).toString() + 'px',
9
9
  height: modalWidth ? ((_a = (modalWidth - 48)) === null || _a === void 0 ? void 0 : _a.toString()) + 'px' : ''
10
10
  } }, h("div", { id: "notify", onClick: () => display() }, h("img", { src: refreshIcon, height: 24, width: 24 }), h("p", { class: "notify-text" }, clickInsideBoxLabel, " "), errorMessage ? h("p", { class: "notify-text bold" }, refreshQrLabel) : h("p", { class: "notify-text bold" }, scanQrLabel), errorMessage && (h("div", { class: "alert", style: {
11
11
  width: (modalWidth - 48).toString() + 'px'
12
- } }, h("img", { src: alertIcon, height: 24, width: 24 }), h("p", null, errorMessage)))), h("div", { id: "qrwait" }, renderRetryQR(waitingStartSessionLabel))));
12
+ } }, h("img", { src: alertIcon, height: 24, width: 24 }), h("p", null, errorMessage)))), h("div", { id: "qrwait", class: "qr-placeholder-slot", style: {
13
+ width: (modalWidth - 48).toString() + 'px',
14
+ height: modalWidth ? (modalWidth - 48).toString() + 'px' : ''
15
+ } })));
13
16
  };
@@ -213,6 +213,13 @@ img {
213
213
  justify-content: center;
214
214
  }
215
215
 
216
+ .qr-placeholder-slot,
217
+ .qr-loading-slot {
218
+ box-sizing: border-box;
219
+ border-radius: 12px;
220
+ background: rgba(0, 0, 0, 0.04);
221
+ }
222
+
216
223
  #qrwait,
217
224
  #notify {
218
225
  width: 100%;