@gataca/qr 4.0.3 → 4.1.1

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 (57) hide show
  1. package/dist/cjs/gataca-autoqr.cjs.entry.js +1 -1
  2. package/dist/cjs/gataca-qr_3.cjs.entry.js +130 -26
  3. package/dist/cjs/gataca-qrws.cjs.entry.js +142 -22
  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 +6 -1
  8. package/dist/cjs/loader.cjs.js +2 -2
  9. package/dist/cjs/utils-04522aa4.js +117 -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 +87 -17
  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 +126 -18
  19. package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.js +2 -2
  20. package/dist/collection/utils/utils.js +84 -0
  21. package/dist/components/gat-icon-check.js +85 -1
  22. package/dist/components/gataca-qr2.js +106 -20
  23. package/dist/components/gataca-qrdisplay2.js +25 -4
  24. package/dist/components/gataca-qrws2.js +145 -21
  25. package/dist/components/gataca-ssibutton2.js +2 -2
  26. package/dist/components/index.js +1 -1
  27. package/dist/esm/gataca-autoqr.entry.js +1 -1
  28. package/dist/esm/gataca-qr_3.entry.js +131 -27
  29. package/dist/esm/gataca-qrws.entry.js +142 -22
  30. package/dist/esm/gataca-ssibuttonws.entry.js +1 -1
  31. package/dist/esm/gatacaqr.js +2 -2
  32. package/dist/esm/{index-055790a7.js → index-dca2ab22.js} +32 -0
  33. package/dist/esm/index.js +1 -1
  34. package/dist/esm/loader.js +2 -2
  35. package/dist/esm/utils-cf9db2bd.js +109 -0
  36. package/dist/gatacaqr/gatacaqr.esm.js +1 -1
  37. package/dist/gatacaqr/index.esm.js +1 -1
  38. package/dist/gatacaqr/{p-49cf321c.entry.js → p-2e8accf9.entry.js} +1 -1
  39. package/dist/gatacaqr/p-3db0f74d.entry.js +1 -0
  40. package/dist/gatacaqr/p-775c90cf.entry.js +1 -0
  41. package/dist/gatacaqr/{p-0501e224.js → p-7b6fa63b.js} +1 -1
  42. package/dist/gatacaqr/p-85af64b1.js +2 -0
  43. package/dist/gatacaqr/{p-c65f810b.entry.js → p-d27dabe4.entry.js} +1 -1
  44. package/dist/types/components/gataca-qr/components/qr/QR.d.ts +1 -0
  45. package/dist/types/components/gataca-qr/components/retryButton/RetryButton.d.ts +0 -2
  46. package/dist/types/components/gataca-qr/gataca-qr.d.ts +5 -2
  47. package/dist/types/components/gataca-qrdisplay/gataca-qrdisplay.d.ts +4 -0
  48. package/dist/types/components/gataca-qrws/components/qr/QR.d.ts +1 -0
  49. package/dist/types/components/gataca-qrws/components/retryButton/RetryButton.d.ts +0 -2
  50. package/dist/types/components/gataca-qrws/gataca-qrws.d.ts +8 -2
  51. package/dist/types/utils/utils.d.ts +10 -0
  52. package/package.json +1 -1
  53. package/dist/cjs/utils-c6edb275.js +0 -28
  54. package/dist/esm/utils-22df0ce4.js +0 -25
  55. package/dist/gatacaqr/p-2083dd06.entry.js +0 -1
  56. package/dist/gatacaqr/p-f5a4f65c.entry.js +0 -1
  57. 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,15 +2,20 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const utils = require('./utils-c6edb275.js');
5
+ const utils = require('./utils-04522aa4.js');
6
6
 
7
7
 
8
8
 
9
+ exports.ALLOWED_APP_REDIRECT_PROTOCOLS = utils.ALLOWED_APP_REDIRECT_PROTOCOLS;
9
10
  Object.defineProperty(exports, 'RESULT_STATUS', {
10
11
  enumerable: true,
11
12
  get: function () {
12
13
  return utils.RESULT_STATUS;
13
14
  }
14
15
  });
16
+ exports.assignWindowLocationIfAllowed = utils.assignWindowLocationIfAllowed;
15
17
  exports.base64UrlEncode = utils.base64UrlEncode;
16
18
  exports.checkMobile = utils.checkMobile;
19
+ exports.isAllowedAppRedirect = utils.isAllowedAppRedirect;
20
+ exports.isAllowedNavigationRedirect = utils.isAllowedNavigationRedirect;
21
+ 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
 
@@ -0,0 +1,117 @@
1
+ 'use strict';
2
+
3
+ function checkMobile() {
4
+ var check = false;
5
+ (function (a) {
6
+ if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) ||
7
+ /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4)))
8
+ check = true;
9
+ })(navigator.userAgent || navigator.vendor);
10
+ return check;
11
+ }
12
+ function base64UrlEncode(str) {
13
+ let b64 = btoa(str);
14
+ return b64.replace(/\+/g, '-').replace(/\//g, '_').replace(/\=+$/, '');
15
+ }
16
+ exports.RESULT_STATUS = void 0;
17
+ (function (RESULT_STATUS) {
18
+ RESULT_STATUS[RESULT_STATUS["NOT_STARTED"] = -1] = "NOT_STARTED";
19
+ RESULT_STATUS[RESULT_STATUS["ONGOING"] = 0] = "ONGOING";
20
+ RESULT_STATUS[RESULT_STATUS["SUCCESS"] = 1] = "SUCCESS";
21
+ RESULT_STATUS[RESULT_STATUS["FAILED"] = 2] = "FAILED";
22
+ RESULT_STATUS[RESULT_STATUS["EXPIRED"] = 3] = "EXPIRED";
23
+ RESULT_STATUS[RESULT_STATUS["READ"] = 5] = "READ";
24
+ })(exports.RESULT_STATUS || (exports.RESULT_STATUS = {}));
25
+ const GATACA_SHORTEN_API = 'https://links.gataca.io/api/v1/short';
26
+ /** URL schemes before assigning window.location. */
27
+ const ALLOWED_APP_REDIRECT_PROTOCOLS = [
28
+ 'openid-gatc-vp',
29
+ 'openid-vp',
30
+ 'openid4vp',
31
+ 'haip-vp',
32
+ 'openid',
33
+ 'openid-gatc-credential-offer',
34
+ 'haip-vci',
35
+ 'openid-credential-offer',
36
+ 'digital-credentials'
37
+ ];
38
+ const ALLOWED_APP_REDIRECT_PROTOCOL_SET = new Set(ALLOWED_APP_REDIRECT_PROTOCOLS);
39
+ function extractRedirectProtocol(url) {
40
+ var _a;
41
+ if (typeof url !== 'string') {
42
+ return undefined;
43
+ }
44
+ const trimmed = url.trim();
45
+ if (!trimmed || /[\u0000-\u001F\u007F\\]/.test(trimmed)) {
46
+ return undefined;
47
+ }
48
+ const match = /^([a-z][a-z0-9+.-]*):/i.exec(trimmed);
49
+ return (_a = match === null || match === void 0 ? void 0 : match[1]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
50
+ }
51
+ function isAllowedAppRedirect(url) {
52
+ const protocol = extractRedirectProtocol(url);
53
+ return !!protocol && ALLOWED_APP_REDIRECT_PROTOCOL_SET.has(protocol);
54
+ }
55
+ function isAllowedNavigationRedirect(url) {
56
+ const protocol = extractRedirectProtocol(url);
57
+ return protocol === 'https' || isAllowedAppRedirect(url);
58
+ }
59
+ function assignWindowLocationIfAllowed(url, allowHttps = false) {
60
+ const allowed = allowHttps ? isAllowedNavigationRedirect(url) : isAllowedAppRedirect(url);
61
+ if (!allowed || typeof url !== 'string') {
62
+ return false;
63
+ }
64
+ window.location.href = url.trim();
65
+ return true;
66
+ }
67
+ function extractShortUrlFromResponse(body) {
68
+ if (!body || typeof body !== 'object') {
69
+ return null;
70
+ }
71
+ const o = body;
72
+ for (const key of ['url', 'shortUrl', 'short_url', 'link']) {
73
+ const v = o[key];
74
+ if (typeof v === 'string' && v.trim() !== '') {
75
+ return v;
76
+ }
77
+ }
78
+ return null;
79
+ }
80
+ /**
81
+ * POSTs the link to shortener. On success with a non-empty url in the body, returns that url;
82
+ * otherwise returns the original link.
83
+ */
84
+ async function shortenUrlIfPossible(link) {
85
+ const trimmedLink = (link === null || link === void 0 ? void 0 : link.trim()) || '';
86
+ const linkHasLength = trimmedLink === null || trimmedLink === void 0 ? void 0 : trimmedLink.length;
87
+ if (!linkHasLength) {
88
+ return link !== null && link !== void 0 ? link : '';
89
+ }
90
+ try {
91
+ const res = await fetch(GATACA_SHORTEN_API, {
92
+ method: 'POST',
93
+ mode: 'cors',
94
+ credentials: 'omit',
95
+ headers: { 'Content-Type': 'application/json' },
96
+ body: JSON.stringify({ url: trimmedLink })
97
+ });
98
+ if (res.status !== 200 && res.status !== 201) {
99
+ return link;
100
+ }
101
+ const data = await res.json().catch(() => null);
102
+ const short = extractShortUrlFromResponse(data);
103
+ return short !== null && short !== void 0 ? short : link;
104
+ }
105
+ catch (_a) {
106
+ return link;
107
+ }
108
+ }
109
+ //
110
+
111
+ exports.ALLOWED_APP_REDIRECT_PROTOCOLS = ALLOWED_APP_REDIRECT_PROTOCOLS;
112
+ exports.assignWindowLocationIfAllowed = assignWindowLocationIfAllowed;
113
+ exports.base64UrlEncode = base64UrlEncode;
114
+ exports.checkMobile = checkMobile;
115
+ exports.isAllowedAppRedirect = isAllowedAppRedirect;
116
+ exports.isAllowedNavigationRedirect = isAllowedNavigationRedirect;
117
+ 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 { assignWindowLocationIfAllowed, 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) => {
@@ -49,7 +96,31 @@ export class GatacaQR {
49
96
  }
50
97
  });
51
98
  if (checkMobile() && this.dynamicLink) {
52
- window.location.href = this.getLink();
99
+ assignWindowLocationIfAllowed(this.getLink(), true);
100
+ }
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;
53
124
  }
54
125
  }
55
126
  /**
@@ -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
  };