@gataca/qr 4.2.0 → 4.2.2

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.
@@ -421,6 +421,7 @@ const GatacaSSIButton = class {
421
421
  this.gatacaLoginCompleted = index.createEvent(this, "gatacaLoginCompleted", 7);
422
422
  this.gatacaLoginFailed = index.createEvent(this, "gatacaLoginFailed", 7);
423
423
  this.gatacaButtonPushed = index.createEvent(this, "gatacaButtonPushed", 7);
424
+ this.dcapiCallInProgress = false;
424
425
  this.getRequestFromUri = async (authRequest) => {
425
426
  const requrl = new URL(authRequest);
426
427
  const requri = requrl.searchParams.get('request_uri');
@@ -431,14 +432,31 @@ const GatacaSSIButton = class {
431
432
  'Content-Type': 'application/json'
432
433
  }
433
434
  });
434
- const jwt = await response.json();
435
+ const rawResponse = await response.text();
436
+ let jwt = rawResponse;
437
+ try {
438
+ const parsedResponse = JSON.parse(rawResponse);
439
+ if (typeof parsedResponse === 'string') {
440
+ jwt = parsedResponse;
441
+ }
442
+ else if (parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.jwt) {
443
+ jwt = parsedResponse.jwt;
444
+ }
445
+ }
446
+ catch (error) {
447
+ console.log('[DCAPI] Raw response is likely already the compact JWT string');
448
+ }
435
449
  const parts = jwt.split('.');
450
+ if (parts.length < 3) {
451
+ throw new Error('[DCAPI] Invalid JWT format from request_uri');
452
+ }
436
453
  const base64 = parts[1].replace(/-/g, '+').replace(/_/g, '/');
437
454
  const decoded = window.atob(base64);
438
455
  let parsed = JSON.parse(decoded);
439
456
  parsed.response_mode = 'dc_api';
440
457
  return parsed;
441
458
  }
459
+ throw new Error('[DCAPI] authenticationRequest does not contain request_uri');
442
460
  };
443
461
  this.buttonText = 'Easy login';
444
462
  this.buttonDCAPIText = 'Login with Device Credentials';
@@ -497,8 +515,7 @@ const GatacaSSIButton = class {
497
515
  const protocols = ['org-iso-mdoc', 'openid4vp', 'openid4vci'];
498
516
  //@ts-ignore
499
517
  const supportedProtocols = protocols.filter(window.DigitalCredential.userAgentAllowsProtocol);
500
- console.log(supportedProtocols, protocols);
501
- return true;
518
+ return supportedProtocols.length > 0;
502
519
  }
503
520
  /**
504
521
  * Retrieve manually the session data on a successful login
@@ -682,9 +699,8 @@ const GatacaSSIButton = class {
682
699
  executeRedirection();
683
700
  }, disabled: loading }, index.h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), index.h("span", null, this.buttonText))));
684
701
  }
685
- renderDCAPIButton(isAndroid, isIos) {
702
+ renderDCAPIButton() {
686
703
  let loading = false;
687
- console.log('Maybe act different', isAndroid, isIos);
688
704
  const handleLoading = (isLoading) => {
689
705
  loading = isLoading;
690
706
  if (this.handleCheckAppLoading) {
@@ -692,6 +708,10 @@ const GatacaSSIButton = class {
692
708
  }
693
709
  };
694
710
  const executeDCAPICall = async () => {
711
+ if (this.dcapiCallInProgress) {
712
+ return;
713
+ }
714
+ this.dcapiCallInProgress = true;
695
715
  handleLoading(true);
696
716
  try {
697
717
  const authRequest = await this.getAuthRequest();
@@ -707,7 +727,7 @@ const GatacaSSIButton = class {
707
727
  ]
708
728
  }
709
729
  });
710
- if (credentialResponse.constructor.name == 'DigitalCredential') {
730
+ if (!credentialResponse) {
711
731
  console.log('Digital Credential - Response Data: ' + credentialResponse);
712
732
  }
713
733
  //@ts-ignore
@@ -715,6 +735,9 @@ const GatacaSSIButton = class {
715
735
  }
716
736
  catch (error) {
717
737
  this.stop();
738
+ }
739
+ finally {
740
+ this.dcapiCallInProgress = false;
718
741
  handleLoading(false);
719
742
  }
720
743
  };
@@ -733,7 +756,7 @@ const GatacaSSIButton = class {
733
756
  (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
734
757
  const isMobile = isAndroid || isIos;
735
758
  const displayDCApi = this.supportsDCAPI();
736
- return (index.h("div", null, index.h("div", { class: "buttonContainer" }, isMobile && this.v === '3' ? this.renderMobileButton(isAndroid, isIos) : this.renderDesktopButton(), this.open && (!isMobile || this.v === '3') && this.renderModal()), displayDCApi /** && isMobile */ && index.h("div", { class: "buttonContainer" }, this.renderDCAPIButton(isAndroid, isIos))));
759
+ return (index.h("div", null, index.h("div", { class: "buttonContainer" }, isMobile && this.v === '3' ? (displayDCApi ? this.renderDCAPIButton() : this.renderMobileButton(isAndroid, isIos)) : this.renderDesktopButton(), this.open && !displayDCApi && (!isMobile || this.v === '3') && this.renderModal())));
737
760
  }
738
761
  };
739
762
  GatacaSSIButton.style = gatacaSsibuttonCss;
@@ -7,6 +7,7 @@ const DEFAULT_SESSION_TIMEOUT = 300; //5mins as in connect
7
7
  const DEFAULT_POLLING_FREQ = 3;
8
8
  export class GatacaSSIButton {
9
9
  constructor() {
10
+ this.dcapiCallInProgress = false;
10
11
  this.getRequestFromUri = async (authRequest) => {
11
12
  const requrl = new URL(authRequest);
12
13
  const requri = requrl.searchParams.get('request_uri');
@@ -17,14 +18,31 @@ export class GatacaSSIButton {
17
18
  'Content-Type': 'application/json'
18
19
  }
19
20
  });
20
- const jwt = await response.json();
21
+ const rawResponse = await response.text();
22
+ let jwt = rawResponse;
23
+ try {
24
+ const parsedResponse = JSON.parse(rawResponse);
25
+ if (typeof parsedResponse === 'string') {
26
+ jwt = parsedResponse;
27
+ }
28
+ else if (parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.jwt) {
29
+ jwt = parsedResponse.jwt;
30
+ }
31
+ }
32
+ catch (error) {
33
+ console.log('[DCAPI] Raw response is likely already the compact JWT string');
34
+ }
21
35
  const parts = jwt.split('.');
36
+ if (parts.length < 3) {
37
+ throw new Error('[DCAPI] Invalid JWT format from request_uri');
38
+ }
22
39
  const base64 = parts[1].replace(/-/g, '+').replace(/_/g, '/');
23
40
  const decoded = window.atob(base64);
24
41
  let parsed = JSON.parse(decoded);
25
42
  parsed.response_mode = 'dc_api';
26
43
  return parsed;
27
44
  }
45
+ throw new Error('[DCAPI] authenticationRequest does not contain request_uri');
28
46
  };
29
47
  this.buttonText = 'Easy login';
30
48
  this.buttonDCAPIText = 'Login with Device Credentials';
@@ -83,8 +101,7 @@ export class GatacaSSIButton {
83
101
  const protocols = ['org-iso-mdoc', 'openid4vp', 'openid4vci'];
84
102
  //@ts-ignore
85
103
  const supportedProtocols = protocols.filter(window.DigitalCredential.userAgentAllowsProtocol);
86
- console.log(supportedProtocols, protocols);
87
- return true;
104
+ return supportedProtocols.length > 0;
88
105
  }
89
106
  /**
90
107
  * Retrieve manually the session data on a successful login
@@ -268,9 +285,8 @@ export class GatacaSSIButton {
268
285
  executeRedirection();
269
286
  }, disabled: loading }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
270
287
  }
271
- renderDCAPIButton(isAndroid, isIos) {
288
+ renderDCAPIButton() {
272
289
  let loading = false;
273
- console.log('Maybe act different', isAndroid, isIos);
274
290
  const handleLoading = (isLoading) => {
275
291
  loading = isLoading;
276
292
  if (this.handleCheckAppLoading) {
@@ -278,6 +294,10 @@ export class GatacaSSIButton {
278
294
  }
279
295
  };
280
296
  const executeDCAPICall = async () => {
297
+ if (this.dcapiCallInProgress) {
298
+ return;
299
+ }
300
+ this.dcapiCallInProgress = true;
281
301
  handleLoading(true);
282
302
  try {
283
303
  const authRequest = await this.getAuthRequest();
@@ -293,7 +313,7 @@ export class GatacaSSIButton {
293
313
  ]
294
314
  }
295
315
  });
296
- if (credentialResponse.constructor.name == 'DigitalCredential') {
316
+ if (!credentialResponse) {
297
317
  console.log('Digital Credential - Response Data: ' + credentialResponse);
298
318
  }
299
319
  //@ts-ignore
@@ -301,6 +321,9 @@ export class GatacaSSIButton {
301
321
  }
302
322
  catch (error) {
303
323
  this.stop();
324
+ }
325
+ finally {
326
+ this.dcapiCallInProgress = false;
304
327
  handleLoading(false);
305
328
  }
306
329
  };
@@ -319,7 +342,7 @@ export class GatacaSSIButton {
319
342
  (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
320
343
  const isMobile = isAndroid || isIos;
321
344
  const displayDCApi = this.supportsDCAPI();
322
- return (h("div", null, h("div", { class: "buttonContainer" }, isMobile && this.v === '3' ? this.renderMobileButton(isAndroid, isIos) : this.renderDesktopButton(), this.open && (!isMobile || this.v === '3') && this.renderModal()), displayDCApi /** && isMobile */ && h("div", { class: "buttonContainer" }, this.renderDCAPIButton(isAndroid, isIos))));
345
+ return (h("div", null, h("div", { class: "buttonContainer" }, isMobile && this.v === '3' ? (displayDCApi ? this.renderDCAPIButton() : this.renderMobileButton(isAndroid, isIos)) : this.renderDesktopButton(), this.open && !displayDCApi && (!isMobile || this.v === '3') && this.renderModal())));
323
346
  }
324
347
  static get is() { return "gataca-ssibutton"; }
325
348
  static get encapsulation() { return "shadow"; }
@@ -17,6 +17,7 @@ const GatacaSSIButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
17
17
  this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
18
18
  this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
19
19
  this.gatacaButtonPushed = createEvent(this, "gatacaButtonPushed", 7);
20
+ this.dcapiCallInProgress = false;
20
21
  this.getRequestFromUri = async (authRequest) => {
21
22
  const requrl = new URL(authRequest);
22
23
  const requri = requrl.searchParams.get('request_uri');
@@ -27,14 +28,31 @@ const GatacaSSIButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
27
28
  'Content-Type': 'application/json'
28
29
  }
29
30
  });
30
- const jwt = await response.json();
31
+ const rawResponse = await response.text();
32
+ let jwt = rawResponse;
33
+ try {
34
+ const parsedResponse = JSON.parse(rawResponse);
35
+ if (typeof parsedResponse === 'string') {
36
+ jwt = parsedResponse;
37
+ }
38
+ else if (parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.jwt) {
39
+ jwt = parsedResponse.jwt;
40
+ }
41
+ }
42
+ catch (error) {
43
+ console.log('[DCAPI] Raw response is likely already the compact JWT string');
44
+ }
31
45
  const parts = jwt.split('.');
46
+ if (parts.length < 3) {
47
+ throw new Error('[DCAPI] Invalid JWT format from request_uri');
48
+ }
32
49
  const base64 = parts[1].replace(/-/g, '+').replace(/_/g, '/');
33
50
  const decoded = window.atob(base64);
34
51
  let parsed = JSON.parse(decoded);
35
52
  parsed.response_mode = 'dc_api';
36
53
  return parsed;
37
54
  }
55
+ throw new Error('[DCAPI] authenticationRequest does not contain request_uri');
38
56
  };
39
57
  this.buttonText = 'Easy login';
40
58
  this.buttonDCAPIText = 'Login with Device Credentials';
@@ -93,8 +111,7 @@ const GatacaSSIButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
93
111
  const protocols = ['org-iso-mdoc', 'openid4vp', 'openid4vci'];
94
112
  //@ts-ignore
95
113
  const supportedProtocols = protocols.filter(window.DigitalCredential.userAgentAllowsProtocol);
96
- console.log(supportedProtocols, protocols);
97
- return true;
114
+ return supportedProtocols.length > 0;
98
115
  }
99
116
  /**
100
117
  * Retrieve manually the session data on a successful login
@@ -278,9 +295,8 @@ const GatacaSSIButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
278
295
  executeRedirection();
279
296
  }, disabled: loading }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
280
297
  }
281
- renderDCAPIButton(isAndroid, isIos) {
298
+ renderDCAPIButton() {
282
299
  let loading = false;
283
- console.log('Maybe act different', isAndroid, isIos);
284
300
  const handleLoading = (isLoading) => {
285
301
  loading = isLoading;
286
302
  if (this.handleCheckAppLoading) {
@@ -288,6 +304,10 @@ const GatacaSSIButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
288
304
  }
289
305
  };
290
306
  const executeDCAPICall = async () => {
307
+ if (this.dcapiCallInProgress) {
308
+ return;
309
+ }
310
+ this.dcapiCallInProgress = true;
291
311
  handleLoading(true);
292
312
  try {
293
313
  const authRequest = await this.getAuthRequest();
@@ -303,7 +323,7 @@ const GatacaSSIButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
303
323
  ]
304
324
  }
305
325
  });
306
- if (credentialResponse.constructor.name == 'DigitalCredential') {
326
+ if (!credentialResponse) {
307
327
  console.log('Digital Credential - Response Data: ' + credentialResponse);
308
328
  }
309
329
  //@ts-ignore
@@ -311,6 +331,9 @@ const GatacaSSIButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
311
331
  }
312
332
  catch (error) {
313
333
  this.stop();
334
+ }
335
+ finally {
336
+ this.dcapiCallInProgress = false;
314
337
  handleLoading(false);
315
338
  }
316
339
  };
@@ -329,7 +352,7 @@ const GatacaSSIButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
329
352
  (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
330
353
  const isMobile = isAndroid || isIos;
331
354
  const displayDCApi = this.supportsDCAPI();
332
- return (h("div", null, h("div", { class: "buttonContainer" }, isMobile && this.v === '3' ? this.renderMobileButton(isAndroid, isIos) : this.renderDesktopButton(), this.open && (!isMobile || this.v === '3') && this.renderModal()), displayDCApi /** && isMobile */ && h("div", { class: "buttonContainer" }, this.renderDCAPIButton(isAndroid, isIos))));
355
+ return (h("div", null, h("div", { class: "buttonContainer" }, isMobile && this.v === '3' ? (displayDCApi ? this.renderDCAPIButton() : this.renderMobileButton(isAndroid, isIos)) : this.renderDesktopButton(), this.open && !displayDCApi && (!isMobile || this.v === '3') && this.renderModal())));
333
356
  }
334
357
  static get style() { return gatacaSsibuttonCss; }
335
358
  }, [1, "gataca-ssibutton", {
@@ -417,6 +417,7 @@ const GatacaSSIButton = class {
417
417
  this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
418
418
  this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
419
419
  this.gatacaButtonPushed = createEvent(this, "gatacaButtonPushed", 7);
420
+ this.dcapiCallInProgress = false;
420
421
  this.getRequestFromUri = async (authRequest) => {
421
422
  const requrl = new URL(authRequest);
422
423
  const requri = requrl.searchParams.get('request_uri');
@@ -427,14 +428,31 @@ const GatacaSSIButton = class {
427
428
  'Content-Type': 'application/json'
428
429
  }
429
430
  });
430
- const jwt = await response.json();
431
+ const rawResponse = await response.text();
432
+ let jwt = rawResponse;
433
+ try {
434
+ const parsedResponse = JSON.parse(rawResponse);
435
+ if (typeof parsedResponse === 'string') {
436
+ jwt = parsedResponse;
437
+ }
438
+ else if (parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.jwt) {
439
+ jwt = parsedResponse.jwt;
440
+ }
441
+ }
442
+ catch (error) {
443
+ console.log('[DCAPI] Raw response is likely already the compact JWT string');
444
+ }
431
445
  const parts = jwt.split('.');
446
+ if (parts.length < 3) {
447
+ throw new Error('[DCAPI] Invalid JWT format from request_uri');
448
+ }
432
449
  const base64 = parts[1].replace(/-/g, '+').replace(/_/g, '/');
433
450
  const decoded = window.atob(base64);
434
451
  let parsed = JSON.parse(decoded);
435
452
  parsed.response_mode = 'dc_api';
436
453
  return parsed;
437
454
  }
455
+ throw new Error('[DCAPI] authenticationRequest does not contain request_uri');
438
456
  };
439
457
  this.buttonText = 'Easy login';
440
458
  this.buttonDCAPIText = 'Login with Device Credentials';
@@ -493,8 +511,7 @@ const GatacaSSIButton = class {
493
511
  const protocols = ['org-iso-mdoc', 'openid4vp', 'openid4vci'];
494
512
  //@ts-ignore
495
513
  const supportedProtocols = protocols.filter(window.DigitalCredential.userAgentAllowsProtocol);
496
- console.log(supportedProtocols, protocols);
497
- return true;
514
+ return supportedProtocols.length > 0;
498
515
  }
499
516
  /**
500
517
  * Retrieve manually the session data on a successful login
@@ -678,9 +695,8 @@ const GatacaSSIButton = class {
678
695
  executeRedirection();
679
696
  }, disabled: loading }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
680
697
  }
681
- renderDCAPIButton(isAndroid, isIos) {
698
+ renderDCAPIButton() {
682
699
  let loading = false;
683
- console.log('Maybe act different', isAndroid, isIos);
684
700
  const handleLoading = (isLoading) => {
685
701
  loading = isLoading;
686
702
  if (this.handleCheckAppLoading) {
@@ -688,6 +704,10 @@ const GatacaSSIButton = class {
688
704
  }
689
705
  };
690
706
  const executeDCAPICall = async () => {
707
+ if (this.dcapiCallInProgress) {
708
+ return;
709
+ }
710
+ this.dcapiCallInProgress = true;
691
711
  handleLoading(true);
692
712
  try {
693
713
  const authRequest = await this.getAuthRequest();
@@ -703,7 +723,7 @@ const GatacaSSIButton = class {
703
723
  ]
704
724
  }
705
725
  });
706
- if (credentialResponse.constructor.name == 'DigitalCredential') {
726
+ if (!credentialResponse) {
707
727
  console.log('Digital Credential - Response Data: ' + credentialResponse);
708
728
  }
709
729
  //@ts-ignore
@@ -711,6 +731,9 @@ const GatacaSSIButton = class {
711
731
  }
712
732
  catch (error) {
713
733
  this.stop();
734
+ }
735
+ finally {
736
+ this.dcapiCallInProgress = false;
714
737
  handleLoading(false);
715
738
  }
716
739
  };
@@ -729,7 +752,7 @@ const GatacaSSIButton = class {
729
752
  (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
730
753
  const isMobile = isAndroid || isIos;
731
754
  const displayDCApi = this.supportsDCAPI();
732
- return (h("div", null, h("div", { class: "buttonContainer" }, isMobile && this.v === '3' ? this.renderMobileButton(isAndroid, isIos) : this.renderDesktopButton(), this.open && (!isMobile || this.v === '3') && this.renderModal()), displayDCApi /** && isMobile */ && h("div", { class: "buttonContainer" }, this.renderDCAPIButton(isAndroid, isIos))));
755
+ return (h("div", null, h("div", { class: "buttonContainer" }, isMobile && this.v === '3' ? (displayDCApi ? this.renderDCAPIButton() : this.renderMobileButton(isAndroid, isIos)) : this.renderDesktopButton(), this.open && !displayDCApi && (!isMobile || this.v === '3') && this.renderModal())));
733
756
  }
734
757
  };
735
758
  GatacaSSIButton.style = gatacaSsibuttonCss;
@@ -1 +1 @@
1
- import{p as e,b as a}from"./p-85af64b1.js";(()=>{const a=import.meta.url,r={};return""!==a&&(r.resourcesUrl=new URL(".",a).href),e(r)})().then((e=>a([["p-e172581d",[[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]}]]],["p-2dc7190a",[[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"]]]]],["p-2e8accf9",[[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]}]]],["p-d27dabe4",[[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]}]]]],e)));
1
+ import{p as e,b as a}from"./p-85af64b1.js";(()=>{const a=import.meta.url,r={};return""!==a&&(r.resourcesUrl=new URL(".",a).href),e(r)})().then((e=>a([["p-36ff5224",[[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]}]]],["p-2dc7190a",[[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"]]]]],["p-2e8accf9",[[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]}]]],["p-d27dabe4",[[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]}]]]],e)));
@@ -1 +1 @@
1
- import{r as t,h as i,c as e}from"./p-85af64b1.js";import{l as s,Q as a,g as n,a as o}from"./p-29119208.js";import{R as r,c as l,b as d,s as h}from"./p-143c0080.js";const c=class{constructor(i){t(this,i),this.qrData=void 0,this.qrType="svg",this.size=256,this.logoSize=0,this.logoSrc=void 0,this.qrColor="#1E1E20",this.bgColor="#FFFFFF",this.rounded=!0}getQrOptions(){return{data:this.qrData,width:this.size,height:this.size,image:this.logoSize>0?this.logoSrc||s:void 0,margin:10,type:this.qrType,dotsOptions:{color:this.qrColor,type:this.rounded?"dots":"square"},cornersSquareOptions:{type:this.rounded?"extra-rounded":"square"},cornersDotOptions:{type:this.rounded?"dot":"square"},imageOptions:{margin:2,imageSize:this.logoSize},backgroundOptions:{color:this.bgColor}}}componentDidLoad(){this.mountOrUpdateQr()}onQrDataChange(){this.mountOrUpdateQr()}mountOrUpdateQr(){var t;(null===(t=this.qrData)||void 0===t?void 0:t.trim())&&this.qr&&(this.qrCode?this.qrCode.update({data:this.qrData}):(this.qrCode=new a(this.getQrOptions()),this.qrCode.append(this.qr)))}render(){return i("div",{ref:t=>{this.qr=t}})}static get watchers(){return{qrData:["onQrDataChange"]}}},p=t=>{const{value:e,useLogo:s,logoSrc:a,size:n,qrType:o,style:r,linkReady:l=!0}=t,d=null!=n?n:256;return l?i("gataca-qrdisplay",{qrData:e,rounded:!0,qrType:o,size:n,"logo-size":s?.33:0,"logo-src":a,qrColor:null==r?void 0:r.color,bgColor:null==r?void 0:r.bgColor}):i("div",{class:"qr-loading-slot",style:{width:d+"px",height:d+"px",margin:"0 auto"}})},u=t=>{const{color:e="#4745B7"}=t;return i("div",{class:"containerLoader",style:{"--loader-color":e}},i("div",{class:"loader"},i("div",{class:"loader__item loader__item__1"}),i("div",{class:"loader__item loader__item__2"}),i("div",{class:"loader__item loader__item__3"}),i("div",{class:"loader__item loader__item__4"}),i("div",{class:"loader__item loader__item__5"}),i("div",{class:"loader__item loader__item__6"}),i("div",{class:"loader__item loader__item__7"}),i("div",{class:"loader__item loader__item__8"})))},g=t=>{var e;const{modalWidth:s,readQrMessages:a,renderQR:n,url:o,sizeQR:r,style:l}=t,d={backgroundColor:(null==l?void 0:l.bgColor)?null==l?void 0:l.bgColor:"white"},h={color:(null==l?void 0:l.color)?null==l?void 0:l.color:"#707074"};return i("div",{class:"blured",style:{width:(s-48).toString()+"px",height:s?(null===(e=s-48)||void 0===e?void 0:e.toString())+"px":"",backgroundColor:null==l?void 0:l.bgColor,color:null==l?void 0:l.color,border:(null==l?void 0:l.color)?`1px dashed ${null==l?void 0:l.color}`:"1px dashed #a1a1a1"}},i("div",{id:"notify",style:d},i(u,{color:null==l?void 0:l.color}),i("p",{class:"notify-text",style:h},null==a?void 0:a.title," "),i("p",{class:"notify-text bold",style:h},null==a?void 0:a.description)),i("div",{id:"qrwait"},n(o,!1,r)))},m=t=>{const{height:e=24,width:s=24,color:a}=t,n=a||"#8B8B8B";return i("svg",{width:s,height:e,viewBox:`0 0 ${s} ${e}`,fill:"none",xmlns:"http://www.w3.org/2000/svg"},i("path",{d:"M23 4V10H17",stroke:n,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),i("path",{d:"M20.4899 15C19.8399 16.8399 18.6094 18.4187 16.984 19.4985C15.3586 20.5783 13.4263 21.1006 11.4783 20.9866C9.53026 20.8726 7.67203 20.1286 6.18363 18.8667C4.69524 17.6047 3.6573 15.8932 3.22625 13.9901C2.79519 12.0869 2.99436 10.0952 3.79374 8.31508C4.59313 6.53496 5.94942 5.06288 7.65823 4.12065C9.36705 3.17843 11.3358 2.81711 13.2678 3.09116C15.1999 3.3652 16.9905 4.25975 18.3699 5.64001L22.9999 10",stroke:n,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}))},b=t=>{var e;const{errorMessage:s,modalWidth:a,clickInsideBoxLabel:o,refreshQrLabel:r,scanQrLabel:l,style:d,display:h}=t,c={backgroundColor:(null==d?void 0:d.bgColor)?null==d?void 0:d.bgColor:"white"},p={backgroundColor:(null==d?void 0:d.alertBgColor)?null==d?void 0:d.alertBgColor:"#ffdedf"},u={borderColor:(null==d?void 0:d.alertBorderColor)?null==d?void 0:d.alertBorderColor:"#ee888c"},g={color:(null==d?void 0:d.color)?null==d?void 0:d.color:"#707074"};return i("div",{class:"reload",style:{width:(a-48).toString()+"px",height:a?(null===(e=a-48)||void 0===e?void 0:e.toString())+"px":"",border:(null==d?void 0:d.color)?`1px dashed ${null==d?void 0:d.color}`:"1px dashed #a1a1a1"}},i("div",{id:"notify",onClick:()=>h(),style:c},i(m,{color:null==d?void 0:d.color,height:24,width:24}),i("p",{class:"notify-text",style:g},o," "),i("p",{class:"notify-text bold",style:g},s?r:l),s&&i("div",{class:"alert",style:Object.assign(Object.assign({width:(a-48).toString()+"px"},p),{border:`1px solid ${u}`})},i("img",{src:n,height:24,width:24}),i("p",{style:{color:(null==d?void 0:d.color)?null==d?void 0:d.color:"#1e1e20"}},s))),i("div",{id:"qrwait",class:"qr-placeholder-slot",style:{width:(a-48).toString()+"px",height:a?(a-48).toString()+"px":""}}))},v=t=>{const{modalHeight:e,successLoginLabel:s,style:a}=t,n={color:(null==a?void 0:a.color)?null==a?void 0:a.color:"#1e1e20"};return i("div",{class:"success",style:{height:e?(null==e?void 0:e.toString())+"px":"300px"}},i("img",{src:o,height:52,width:52}),i("p",{class:"successMsg",style:n},s))},x=class{constructor(i){t(this,i),this.gatacaLoginCompleted=e(this,"gatacaLoginCompleted",7),this.gatacaLoginFailed=e(this,"gatacaLoginFailed",7),this.lastShortenRaw=null,this.checkStatus=void 0,this.createSession=void 0,this.successCallback=void 0,this.errorCallback=void 0,this.qrRole=void 0,this.qrType="svg",this.callbackServer=void 0,this.autostart=!0,this.autorefresh=!1,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=!1,this.hideModalBoxShadow=!1,this.hideBrandTitle=!1,this.logoSize=0,this.logoSrc=s,this.qrSize=300,this.modalWidth=300,this.modalHeight=void 0,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=!1,this.sessionTimeout=300,this.pollingFrequency=3,this.dynamicLink=!0,this.qrStyle=void 0,this.sessionId=void 0,this.authenticationRequest=void 0,this.sessionData=void 0,this.result=r.NOT_STARTED,this.qrHref=""}disconnectedCallback(){this.stop()}async componentDidLoad(){this.autostart&&await this.display()}async display(){await this.getSessionId(),await this.refreshQrHref(),this.result=r.ONGOING,this.poll().then((t=>{this.result=r.SUCCESS,this.sessionData=t,this.gatacaLoginCompleted.emit(t),this.successCallback(t)})).catch((t=>{this.clean();let i=t===r.EXPIRED;if(i&&this.autorefresh)this.display();else if(t!==r.NOT_STARTED){let e=i?new Error(this.userNotScanInTimeErrorLabel):new Error(this.credsNotValidatedErrorLabel);this.result=t,this.gatacaLoginFailed.emit(e),this.errorCallback(e)}})),l()&&this.dynamicLink&&(window.location.href=this.getLink())}buildRawLink(){var t;return"2"===this.v?null!==(t=this.authenticationRequest)&&void 0!==t?t:"":"https://api.gataca.io/qr/redirect.html?dl="+d(this.authenticationRequest)}async refreshQrHref(){var t;const i=this.buildRawLink();if(i===this.lastShortenRaw)return;this.lastShortenRaw=i;const e=await h(null!=i?i:""),s=this.buildRawLink();s===i?this.qrHref=e:(null===(t=this.qrHref)||void 0===t?void 0:t.trim())||(this.qrHref=s)}async stop(){this.clean(),(this.result===r.ONGOING||r.READ)&&(this.result=r.NOT_STARTED)}clean(){this.sessionData=void 0,this.sessionId=void 0,this.qrHref="",this.lastShortenRaw=null}async getSessionData(){return this.sessionData?Promise.resolve(this.sessionData):Promise.reject(new Error(this.failedLoginErrorLabel))}async getSessionId(){if(this.sessionId)return this.sessionId;let{sessionId:t,authenticationRequest:i}=await this.createSession();return this.sessionId=t,this.authenticationRequest=i,this.sessionId}getLink(){return this.qrHref||this.buildRawLink()}async poll(){let t=(new Date).getTime()+1e3*(this.sessionTimeout||300),i=1e3*(this.pollingFrequency||3),e=this,s=async function(a,n){let{result:o,data:l}=await(async t=>{if(t.result===r.NOT_STARTED)return{result:r.NOT_STARTED};let i=await t.getSessionId();return t.checkStatus(i)})(e);switch(o){case r.SUCCESS:a(l);break;case r.READ:e.result=r.READ;case r.ONGOING:e.sessionTimeout>0&&(new Date).getTime()<t?setTimeout(s,i,a,n):n(r.EXPIRED);break;default:n(o)}};return new Promise(s)}renderQRSection(){var t;switch(this.result){case r.NOT_STARTED:return this.renderRetryButton();case r.ONGOING:return this.renderQR(this.getLink(),!0,void 0,!!(null===(t=this.qrHref)||void 0===t?void 0:t.trim()));case r.EXPIRED:return this.renderRetryButton(this.qrCodeExpiredLabel);case r.FAILED:return this.renderRetryButton(this.credentialsNotValidatedLabel);case r.SUCCESS:return this.renderSuccess();case r.READ:return this.renderReadQR({title:null==this?void 0:this.readQrTitle,description:null==this?void 0:this.readQrDescription})}}renderSuccess(){return i(v,{modalHeight:null==this?void 0:this.modalHeight,successLoginLabel:null==this?void 0:this.successLoginLabel,style:null==this?void 0:this.qrStyle})}renderRetryButton(t){return i(b,{errorMessage:t,modalWidth:null==this?void 0:this.modalWidth,clickInsideBoxLabel:null==this?void 0:this.clickInsideBoxLabel,refreshQrLabel:null==this?void 0:this.refreshQrLabel,scanQrLabel:null==this?void 0:this.scanQrLabel,display:this.display.bind(this),style:null==this?void 0:this.qrStyle})}renderReadQR(t){var e;const s=!!(null===(e=this.qrHref)||void 0===e?void 0:e.trim());return i(g,{modalWidth:null==this?void 0:this.modalWidth,readQrMessages:t,url:this.getLink(),sizeQR:(null==this?void 0:this.qrSize)?(null==this?void 0:this.qrSize)-50:void 0,renderQR:(t,i,e)=>this.renderQR(t,i,e,s),style:this.qrStyle})}renderQR(t,e,s,a=!0){return i(p,{value:t,qrType:this.qrType,useLogo:e&&0!==this.logoSize,size:s||(null==this?void 0:this.qrSize)||void 0,logoSrc:null==this?void 0:this.logoSrc,style:null==this?void 0:this.qrStyle,linkReady:a})}render(){var t,e,a,n,o,l;return i("div",{class:"popUpContainer"},i("div",{class:`is-visible modal-window ${this.hideModalTexts?"":"large-modal"} ${this.hideModalBoxShadow?"noBoxShadow":""}`,style:{width:(this.modalWidth-2).toString()+"px",height:this.modalHeight?(null===(t=this.modalHeight-2)||void 0===t?void 0:t.toString())+"px":"",backgroundColor:(null===(e=null==this?void 0:this.qrStyle)||void 0===e?void 0:e.bgColor)?null===(a=null==this?void 0:this.qrStyle)||void 0===a?void 0:a.bgColor:"white",boxShadow:(null===(n=null==this?void 0:this.qrStyle)||void 0===n?void 0:n.boxShadow)?null===(o=null==this?void 0:this.qrStyle)||void 0===o?void 0:o.boxShadow:"0px 3px 10px rgba(48, 48, 48, 0.1);"},onClick:t=>{t.stopPropagation()}},i("div",{class:"modal-window__content"},i("div",{class:"qrTitleContainer "+(this.hideModalTexts?"hidenText":"")},i("p",{class:"qrTitle modalText",style:{color:this.modalTitleColor||"#1e1e20"}},this.qrModalTitle),!this.hideBrandTitle&&i("p",{class:"qrBrand modalText"},this.byBrandLabel," ",i("span",null,i("img",{src:s}))),this.result!==r.SUCCESS&&!this.hideQrModalDescription&&i("p",{class:"qrDescription modalText"},this.qrModalDescription)),i("div",{class:"qrSection",style:{width:this.modalWidth.toString()+"px",height:this.modalWidth?(null===(l=this.modalWidth)||void 0===l?void 0:l.toString())+"px":""}},this.renderQRSection()))))}};x.style='@import url("https://fonts.googleapis.com/css2?family=Ubuntu:wght@100;300;400;500;600;700&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@100;300;400;500;600;700&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:"";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.brandSection{padding-top:5px;display:flex;align-items:center}.brandSection .gatacaImgSmall{height:13px;width:13px;margin:0;margin-right:10px}.popUpContainer .large-modal{width:300px;min-height:350px}.popUpContainer .modal-window{position:relative;border-radius:6px;overflow:hidden;color:rgba(24, 27, 94, 0.8);box-shadow:0px 3px 10px rgba(48, 48, 48, 0.1);display:flex;flex-direction:column;justify-content:space-between;align-items:center;display:flex;z-index:1001;padding:1px;background-color:white;border-radius:12px;-webkit-transition:opacity 0.5s, visibility 0s 0.5s;transition:opacity 0.5s, visibility 0s 0.5s;visibility:hidden;opacity:0}.popUpContainer .modal-window__content{width:100%;height:100%;text-align:left}.popUpContainer .modal-window__content .hidenText{display:none}.popUpContainer .modal-window .modalText{font-family:"Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px;margin-top:10px;letter-spacing:1px}.popUpContainer .modal-window .qrTitleContainer{padding:14px 24px;padding-bottom:0px}.popUpContainer .modal-window .qrTitle{font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .modal-window .qrDescription{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074}.popUpContainer .modal-window .bold{font-weight:700}.popUpContainer .modal-window .qrBrand{margin-top:4px;font-size:14px;font-weight:400;line-height:16.5px;display:flex;align-items:center}.popUpContainer .modal-window .qrBrand img{margin-left:5px;height:12px}.popUpContainer .modal-window .qr-section{width:252px;height:252px}.popUpContainer .noBoxShadow{box-shadow:none}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}.success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.success>img{padding-bottom:12px}.success>.successMsg{line-height:23.5px;color:var(--neutral-1000, #1e1e20);text-align:center;font-family:"Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px}.reload,.blured{height:252px;width:252px;border:1px dashed #a1a1a1;border-radius:20px;position:relative;top:24px;margin:0 24px 24px;display:flex;overflow:hidden;justify-content:center;align-items:center}#qrwait{display:flex;justify-content:center}.qr-placeholder-slot{box-sizing:border-box;border-radius:12px;background:rgba(0, 0, 0, 0.04)}#qrwait,#notify{width:100%;height:100%;top:0;left:0;border-radius:20px}#notify{z-index:10;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;display:flex;flex-direction:column;box-sizing:border-box;padding:20px;background:rgba(255, 255, 255, 0.95)}#notify>svg{padding-bottom:12px}.alert{display:flex;flex-direction:row;justify-content:start;width:252px;position:absolute;bottom:0px;border:1px solid #ee888c;background:#ffdedf;border-radius:11px;box-sizing:border-box;padding:12px;align-items:center;gap:12px}.alert>img{margin:0}.alert>p{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;margin-top:0;line-height:16px;color:#1e1e20}.notify-text{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074;text-align:center}.containerLoader{display:flex;justify-content:center;align-items:center;width:30px;height:30px;margin-bottom:12px}.loader{position:relative;margin-left:0 !important}.loader__item{position:absolute;width:9.68px;height:4px;background-color:var(--loader-color, #4745B7);border-radius:2px;--to-opacity:1;opacity:var(--to-opacity)}.loader__item__1{transform:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-webkit-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-moz-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-o-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);--to-opacity:calc(1 - (0 / 8));animation:blink 0.8333333333s linear 0.1041666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.1041666667s infinite;-moz-animation:blink 0.8333333333s linear 0.1041666667s infinite;-o-animation:blink 0.8333333333s linear 0.1041666667s infinite}.loader__item__2{transform:translate(-4.84px, 8.5px) rotate(90deg);-webkit-animation:translate(-4.84px, 8.5px) rotate(90deg);-moz-animation:translate(-4.84px, 8.5px) rotate(90deg);-o-animation:translate(-4.84px, 8.5px) rotate(90deg);--to-opacity:calc(1 - (1 / 8));animation:blink 0.8333333333s linear 0.2083333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.2083333333s infinite;-moz-animation:blink 0.8333333333s linear 0.2083333333s infinite;-o-animation:blink 0.8333333333s linear 0.2083333333s infinite}.loader__item__3{transform:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-webkit-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-moz-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-o-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);--to-opacity:calc(1 - (2 / 8));animation:blink 0.8333333333s linear 0.3125s infinite;-webkit-animation:blink 0.8333333333s linear 0.3125s infinite;-moz-animation:blink 0.8333333333s linear 0.3125s infinite;-o-animation:blink 0.8333333333s linear 0.3125s infinite}.loader__item__4{transform:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-webkit-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-moz-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-o-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);--to-opacity:calc(1 - (3 / 8));animation:blink 0.8333333333s linear 0.4166666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.4166666667s infinite;-moz-animation:blink 0.8333333333s linear 0.4166666667s infinite;-o-animation:blink 0.8333333333s linear 0.4166666667s infinite}.loader__item__5{transform:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-webkit-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-moz-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-o-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);--to-opacity:calc(1 - (4 / 8));animation:blink 0.8333333333s linear 0.5208333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.5208333333s infinite;-moz-animation:blink 0.8333333333s linear 0.5208333333s infinite;-o-animation:blink 0.8333333333s linear 0.5208333333s infinite}.loader__item__6{transform:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-webkit-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-moz-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-o-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);--to-opacity:calc(1 - (5 / 8));animation:blink 0.8333333333s linear 0.625s infinite;-webkit-animation:blink 0.8333333333s linear 0.625s infinite;-moz-animation:blink 0.8333333333s linear 0.625s infinite;-o-animation:blink 0.8333333333s linear 0.625s infinite}.loader__item__7{transform:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-webkit-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-moz-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-o-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);--to-opacity:calc(1 - (6 / 8));animation:blink 0.8333333333s linear 0.7291666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.7291666667s infinite;-moz-animation:blink 0.8333333333s linear 0.7291666667s infinite;-o-animation:blink 0.8333333333s linear 0.7291666667s infinite}.loader__item__8{transform:translate(5.6631628524px, -1.99913122px) rotate(360deg);-webkit-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);-moz-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);-o-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);--to-opacity:calc(1 - (7 / 8));animation:blink 0.8333333333s linear 0.8333333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.8333333333s infinite;-moz-animation:blink 0.8333333333s linear 0.8333333333s infinite;-o-animation:blink 0.8333333333s linear 0.8333333333s infinite}.loader__item__8{max-width:8.5px}@keyframes blink{0%{opacity:1}100%{opacity:var(--to-opacity)}}@keyframes rotate{0%{transform:rotate(0deg)}100%{background:rotate(360deg)}}';const f="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAYAAACN1PRVAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHvSURBVHgB3ZZPTttAFMbfe3YjL7qYLopcpZXSG7Q3CDfIsqrSJpyg5QQtJ2h7glgUdVs4AeEE5AYEQSDAgtnw357Hm0hAQDaeIRFCfFKyeKPxzzPzvc+DUKCZN80GEv1ABgWOQgSdGbOwv7u0nDueV4zjTzUIKhuAZna4vdQFR828azbI0K/TI/qodaLvjlP+tLDGDCs+IKv9Lbsi7kcv0w9541Q0EREPYcoieEQ9KiyECRXHzbpBUOcnYTfPFOOaaGVx9WsLiDrSIp0iU0wFNgIx/AQyc9I/OmOjy+Y8aBvHQcDUYebewc6/Xtk8J5htcg5efEPGhk0JtqkyBjo7DuZcnuO2sqCyKv8rUDmfTS9IBURqBAL+I6CkzBjOMOs22TLY21n8fl17KzXR3uDvb/CQk0GEdfvN07QvpnAOaGfYaRT25JzU6+rnG2tTpcWAy+Cp0m3U/URLms8HWfg/rn6RFaGSs9KQkZMpvGBWNs2Vandt46ac6YNBuc0fDLMaOU5DFybQ8039p/KJ4bq4rwPewtqoM/1gsCm/NfBXvWjgHhhuDAeLyd3qVSifHQULeZkou9EqemLhmUmav8qrZ4GEMGA7ivzjKvfeqGptFV2YdWPMPHHq0cCh3DdpVdLl/XCY9J1gVvbCiWa6N+JLocPFjCsx9cAAAAAASUVORK5CYII=",w=class{constructor(s){t(this,s),this.gatacaLoginCompleted=e(this,"gatacaLoginCompleted",7),this.gatacaLoginFailed=e(this,"gatacaLoginFailed",7),this.gatacaButtonPushed=e(this,"gatacaButtonPushed",7),this.getRequestFromUri=async t=>{const i=new URL(t).searchParams.get("request_uri");if(i){const t=await fetch(i,{method:"GET",headers:{"Content-Type":"application/json"}}),e=(await t.json()).split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),s=window.atob(e);let a=JSON.parse(s);return a.response_mode="dc_api",a}},this.buttonText="Easy login",this.buttonDCAPIText="Login with Device Credentials",this.qrType="svg",this.autostart=!0,this.checkStatus=void 0,this.createSession=void 0,this.fillSession=void 0,this.successCallback=void 0,this.errorCallback=void 0,this.handleCheckAppLoading=void 0,this.checkAppTimeout=6,this.qrRole=void 0,this.callbackServer=void 0,this.sessionTimeout=void 0,this.pollingFrequency=void 0,this.autorefresh=!1,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.hideBrandTitle=!1,this.dynamicLink=!0,this.logoSize=0,this.logoSrc=void 0,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.enableDcApi=!1,this.hideQrModalDescription=!1,this.qrStyle=void 0,this.open=!1,this.sessionId=void 0,this.authenticationRequest=void 0,this.sessionData=void 0,this.result=r.NOT_STARTED,this.qr=i("gataca-qr",{ref:t=>this.qrElement=t,checkStatus:this.checkStatus,createSession:this.createSession,successCallback:this.successCallback,errorCallback:this.errorCallback,qrRole:this.qrRole,qrType:this.qrType,callbackServer:this.callbackServer,sessionTimeout:this.sessionTimeout,pollingFrequency:this.pollingFrequency,autostart:this.autostart,autorefresh:this.autorefresh,v:this.v,qrModalTitle:this.qrModalTitle,qrModalDescription:this.qrModalDescription,hideBrandTitle:this.hideBrandTitle,dynamicLink:this.dynamicLink,logoSize:this.logoSize,logoSrc:this.logoSrc,modalTitleColor:this.modalTitleColor,qrCodeExpiredLabel:this.qrCodeExpiredLabel,credentialsNotValidatedLabel:this.credentialsNotValidatedLabel,clickInsideBoxLabel:this.clickInsideBoxLabel,refreshQrLabel:this.refreshQrLabel,scanQrLabel:this.scanQrLabel,userNotScanInTimeErrorLabel:this.userNotScanInTimeErrorLabel,credsNotValidatedErrorLabel:this.credsNotValidatedErrorLabel,failedLoginErrorLabel:this.failedLoginErrorLabel,successLoginLabel:this.successLoginLabel,byBrandLabel:this.byBrandLabel,waitingStartSessionLabel:this.waitingStartSessionLabel,hideQrModalDescription:this.hideQrModalDescription,qrStyle:this.qrStyle})}supportsDCAPI(){if(!this.enableDcApi)return!1;if(void 0===window.DigitalCredential)return!1;const t=["org-iso-mdoc","openid4vp","openid4vci"],i=t.filter(window.DigitalCredential.userAgentAllowsProtocol);return console.log(i,t),!0}async getSessionData(){return this.qr.getSessionData()}async getSessionId(){if(this.sessionId)return this.sessionId;let{sessionId:t,authenticationRequest:i}=await this.createSession();return this.sessionId=t,this.authenticationRequest=i,this.sessionId}async startMobilePolling(){await this.getSessionId(),this.result=r.ONGOING,this.poll().then((t=>{this.result=r.SUCCESS,this.sessionData=t,this.gatacaLoginCompleted.emit(t),this.successCallback(t)})).catch((t=>{this.clean();let i=t===r.EXPIRED;if(i&&this.autorefresh)this.startMobilePolling();else if(t!==r.NOT_STARTED){let e=i?new Error(this.userNotScanInTimeErrorLabel):new Error(this.credsNotValidatedErrorLabel);this.result=t,this.gatacaLoginFailed.emit(e),this.errorCallback(e)}}))}async stop(){this.clean(),(this.result===r.ONGOING||r.READ)&&(this.result=r.NOT_STARTED)}clean(){this.sessionData=void 0,this.sessionId=void 0}renderModal(){return this.qr}async poll(){let t=(new Date).getTime()+1e3*(this.sessionTimeout||300),i=1e3*(this.pollingFrequency||3),e=this,s=async function(a,n){let{result:o,data:l}=await(async t=>{if(t.result===r.NOT_STARTED)return{result:r.NOT_STARTED};let i=await t.getSessionId();return t.checkStatus(i)})(e);switch(o){case r.SUCCESS:a(l);break;case r.READ:e.result=r.READ;case r.ONGOING:e.sessionTimeout>0&&(new Date).getTime()<t?setTimeout(s,i,a,n):n(r.EXPIRED);break;default:n(o)}};return new Promise(s)}isAppInstalled(t,i){let e,s=!1;(null==t?void 0:t.length)&&(window.location.href=t),e=setTimeout((()=>{s||i(!1),n()}),1e3*this.checkAppTimeout);const a=()=>{document.hidden&&(s=!0,i(!0),this.autostart||this.startMobilePolling(),n())};function n(){clearTimeout(e),document.removeEventListener("visibilitychange",a)}document.addEventListener("visibilitychange",a)}renderDesktopButton(){return i("div",{class:"gatacaButtonWrapper"},i("button",{class:"gatacaButton",onClick:()=>{this.open=!this.open,setTimeout((()=>{var t,i;this.open?null===(t=this.qrElement)||void 0===t||t.display():null===(i=this.qrElement)||void 0===i||i.stop()}),0)}},i("img",{src:f,class:"buttonImg",alt:this.buttonText}),i("span",null,this.buttonText)))}async getAuthRequest(){let{authenticationRequest:t}=await this.createSession();return t}renderMobileButton(t,e){this.autostart&&!this.supportsDCAPI()&&this.startMobilePolling();let s=!1;const a=t=>{s=t,this.handleCheckAppLoading&&this.handleCheckAppLoading(t)},n=async()=>{a(!0);try{const i=await this.getAuthRequest();this.isAppInstalled(i,(i=>{i||(this.stop(),t?window.location.href="https://play.google.com/store/apps/details?id=com.gataca.identity":e&&(window.location.href="https://apps.apple.com/us/app/gataca/id1498607616")),a(!1)}))}catch(t){this.stop(),a(!1)}};return i("div",{class:"gatacaButtonWrapper"},i("button",{class:"gatacaButton",onClick:()=>{this.gatacaButtonPushed.emit(),n()},disabled:s},i("img",{src:f,class:"buttonImg",alt:this.buttonText}),i("span",null,this.buttonText)))}renderDCAPIButton(t,e){let s=!1;console.log("Maybe act different",t,e);const a=t=>{s=t,this.handleCheckAppLoading&&this.handleCheckAppLoading(t)},n=async()=>{a(!0);try{const t=await this.getAuthRequest();let i=await this.getRequestFromUri(t),e=await navigator.credentials.get({digital:{requests:[{protocol:"openid4vp-v1-unsigned",data:i}]}});"DigitalCredential"==e.constructor.name&&console.log("Digital Credential - Response Data: "+e),await this.fillSession(i,null==e?void 0:e.data)}catch(t){this.stop(),a(!1)}};return i("div",{class:"gatacaButtonWrapper"},i("button",{class:"gatacaButton",onClick:()=>{this.gatacaButtonPushed.emit(),n()},disabled:s},i("img",{src:f,class:"buttonImg",alt:this.buttonDCAPIText}),i("span",null,this.buttonDCAPIText)))}render(){const t=(null===navigator||void 0===navigator?void 0:navigator.userAgent)||(null===navigator||void 0===navigator?void 0:navigator.vendor)||(null===window||void 0===window?void 0:window.opera),e=/android/i.test(t),s=/iPad|iPhone|iPod/.test(t)&&!window.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,a=e||s,n=this.supportsDCAPI();return i("div",null,i("div",{class:"buttonContainer"},a&&"3"===this.v?this.renderMobileButton(e,s):this.renderDesktopButton(),this.open&&(!a||"3"===this.v)&&this.renderModal()),n&&i("div",{class:"buttonContainer"},this.renderDCAPIButton(e,s)))}};w.style='@import url("https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:"";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.buttonContainer{display:inline-block;text-align:right;padding:10px;position:relative}.gatacaButtonWrapper{margin:8px}.gatacaButtonWrapper .gatacaButton{display:flex;min-width:100px;padding:8px 8px;background-color:white;font-size:12px;font-family:"Work Sans", sans-serif;letter-spacing:1px;font-weight:2;justify-content:space-between;align-items:center;border-radius:6px;border:1px solid rgba(24, 27, 94, 0.5);color:rgba(24, 27, 94, 0.8);box-shadow:0px 1px 3px rgba(48, 48, 48, 0.15);cursor:pointer}.gatacaButtonWrapper .gatacaButton>span{margin-right:10px}.gatacaButtonWrapper .gatacaButton:hover{box-shadow:0px 2px 8px rgba(48, 48, 48, 0.1)}.gatacaButtonWrapper .buttonText{text-align:right;font-size:8px;color:rgba(24, 27, 94, 0.5);font-family:"Helvetica Neue", sans-serif;letter-spacing:1px;padding-right:8px;font-weight:1}.gatacaButtonWrapper .buttonImg{height:25px;width:25px;margin:0;margin-right:20px}';export{x as gataca_qr,c as gataca_qrdisplay,w as gataca_ssibutton}
1
+ import{r as t,h as i,c as e}from"./p-85af64b1.js";import{l as s,Q as a,g as n,a as o}from"./p-29119208.js";import{R as r,c as l,b as d,s as h}from"./p-143c0080.js";const c=class{constructor(i){t(this,i),this.qrData=void 0,this.qrType="svg",this.size=256,this.logoSize=0,this.logoSrc=void 0,this.qrColor="#1E1E20",this.bgColor="#FFFFFF",this.rounded=!0}getQrOptions(){return{data:this.qrData,width:this.size,height:this.size,image:this.logoSize>0?this.logoSrc||s:void 0,margin:10,type:this.qrType,dotsOptions:{color:this.qrColor,type:this.rounded?"dots":"square"},cornersSquareOptions:{type:this.rounded?"extra-rounded":"square"},cornersDotOptions:{type:this.rounded?"dot":"square"},imageOptions:{margin:2,imageSize:this.logoSize},backgroundOptions:{color:this.bgColor}}}componentDidLoad(){this.mountOrUpdateQr()}onQrDataChange(){this.mountOrUpdateQr()}mountOrUpdateQr(){var t;(null===(t=this.qrData)||void 0===t?void 0:t.trim())&&this.qr&&(this.qrCode?this.qrCode.update({data:this.qrData}):(this.qrCode=new a(this.getQrOptions()),this.qrCode.append(this.qr)))}render(){return i("div",{ref:t=>{this.qr=t}})}static get watchers(){return{qrData:["onQrDataChange"]}}},p=t=>{const{value:e,useLogo:s,logoSrc:a,size:n,qrType:o,style:r,linkReady:l=!0}=t,d=null!=n?n:256;return l?i("gataca-qrdisplay",{qrData:e,rounded:!0,qrType:o,size:n,"logo-size":s?.33:0,"logo-src":a,qrColor:null==r?void 0:r.color,bgColor:null==r?void 0:r.bgColor}):i("div",{class:"qr-loading-slot",style:{width:d+"px",height:d+"px",margin:"0 auto"}})},u=t=>{const{color:e="#4745B7"}=t;return i("div",{class:"containerLoader",style:{"--loader-color":e}},i("div",{class:"loader"},i("div",{class:"loader__item loader__item__1"}),i("div",{class:"loader__item loader__item__2"}),i("div",{class:"loader__item loader__item__3"}),i("div",{class:"loader__item loader__item__4"}),i("div",{class:"loader__item loader__item__5"}),i("div",{class:"loader__item loader__item__6"}),i("div",{class:"loader__item loader__item__7"}),i("div",{class:"loader__item loader__item__8"})))},g=t=>{var e;const{modalWidth:s,readQrMessages:a,renderQR:n,url:o,sizeQR:r,style:l}=t,d={backgroundColor:(null==l?void 0:l.bgColor)?null==l?void 0:l.bgColor:"white"},h={color:(null==l?void 0:l.color)?null==l?void 0:l.color:"#707074"};return i("div",{class:"blured",style:{width:(s-48).toString()+"px",height:s?(null===(e=s-48)||void 0===e?void 0:e.toString())+"px":"",backgroundColor:null==l?void 0:l.bgColor,color:null==l?void 0:l.color,border:(null==l?void 0:l.color)?`1px dashed ${null==l?void 0:l.color}`:"1px dashed #a1a1a1"}},i("div",{id:"notify",style:d},i(u,{color:null==l?void 0:l.color}),i("p",{class:"notify-text",style:h},null==a?void 0:a.title," "),i("p",{class:"notify-text bold",style:h},null==a?void 0:a.description)),i("div",{id:"qrwait"},n(o,!1,r)))},m=t=>{const{height:e=24,width:s=24,color:a}=t,n=a||"#8B8B8B";return i("svg",{width:s,height:e,viewBox:`0 0 ${s} ${e}`,fill:"none",xmlns:"http://www.w3.org/2000/svg"},i("path",{d:"M23 4V10H17",stroke:n,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),i("path",{d:"M20.4899 15C19.8399 16.8399 18.6094 18.4187 16.984 19.4985C15.3586 20.5783 13.4263 21.1006 11.4783 20.9866C9.53026 20.8726 7.67203 20.1286 6.18363 18.8667C4.69524 17.6047 3.6573 15.8932 3.22625 13.9901C2.79519 12.0869 2.99436 10.0952 3.79374 8.31508C4.59313 6.53496 5.94942 5.06288 7.65823 4.12065C9.36705 3.17843 11.3358 2.81711 13.2678 3.09116C15.1999 3.3652 16.9905 4.25975 18.3699 5.64001L22.9999 10",stroke:n,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}))},b=t=>{var e;const{errorMessage:s,modalWidth:a,clickInsideBoxLabel:o,refreshQrLabel:r,scanQrLabel:l,style:d,display:h}=t,c={backgroundColor:(null==d?void 0:d.bgColor)?null==d?void 0:d.bgColor:"white"},p={backgroundColor:(null==d?void 0:d.alertBgColor)?null==d?void 0:d.alertBgColor:"#ffdedf"},u={borderColor:(null==d?void 0:d.alertBorderColor)?null==d?void 0:d.alertBorderColor:"#ee888c"},g={color:(null==d?void 0:d.color)?null==d?void 0:d.color:"#707074"};return i("div",{class:"reload",style:{width:(a-48).toString()+"px",height:a?(null===(e=a-48)||void 0===e?void 0:e.toString())+"px":"",border:(null==d?void 0:d.color)?`1px dashed ${null==d?void 0:d.color}`:"1px dashed #a1a1a1"}},i("div",{id:"notify",onClick:()=>h(),style:c},i(m,{color:null==d?void 0:d.color,height:24,width:24}),i("p",{class:"notify-text",style:g},o," "),i("p",{class:"notify-text bold",style:g},s?r:l),s&&i("div",{class:"alert",style:Object.assign(Object.assign({width:(a-48).toString()+"px"},p),{border:`1px solid ${u}`})},i("img",{src:n,height:24,width:24}),i("p",{style:{color:(null==d?void 0:d.color)?null==d?void 0:d.color:"#1e1e20"}},s))),i("div",{id:"qrwait",class:"qr-placeholder-slot",style:{width:(a-48).toString()+"px",height:a?(a-48).toString()+"px":""}}))},v=t=>{const{modalHeight:e,successLoginLabel:s,style:a}=t,n={color:(null==a?void 0:a.color)?null==a?void 0:a.color:"#1e1e20"};return i("div",{class:"success",style:{height:e?(null==e?void 0:e.toString())+"px":"300px"}},i("img",{src:o,height:52,width:52}),i("p",{class:"successMsg",style:n},s))},x=class{constructor(i){t(this,i),this.gatacaLoginCompleted=e(this,"gatacaLoginCompleted",7),this.gatacaLoginFailed=e(this,"gatacaLoginFailed",7),this.lastShortenRaw=null,this.checkStatus=void 0,this.createSession=void 0,this.successCallback=void 0,this.errorCallback=void 0,this.qrRole=void 0,this.qrType="svg",this.callbackServer=void 0,this.autostart=!0,this.autorefresh=!1,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=!1,this.hideModalBoxShadow=!1,this.hideBrandTitle=!1,this.logoSize=0,this.logoSrc=s,this.qrSize=300,this.modalWidth=300,this.modalHeight=void 0,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=!1,this.sessionTimeout=300,this.pollingFrequency=3,this.dynamicLink=!0,this.qrStyle=void 0,this.sessionId=void 0,this.authenticationRequest=void 0,this.sessionData=void 0,this.result=r.NOT_STARTED,this.qrHref=""}disconnectedCallback(){this.stop()}async componentDidLoad(){this.autostart&&await this.display()}async display(){await this.getSessionId(),await this.refreshQrHref(),this.result=r.ONGOING,this.poll().then((t=>{this.result=r.SUCCESS,this.sessionData=t,this.gatacaLoginCompleted.emit(t),this.successCallback(t)})).catch((t=>{this.clean();let i=t===r.EXPIRED;if(i&&this.autorefresh)this.display();else if(t!==r.NOT_STARTED){let e=i?new Error(this.userNotScanInTimeErrorLabel):new Error(this.credsNotValidatedErrorLabel);this.result=t,this.gatacaLoginFailed.emit(e),this.errorCallback(e)}})),l()&&this.dynamicLink&&(window.location.href=this.getLink())}buildRawLink(){var t;return"2"===this.v?null!==(t=this.authenticationRequest)&&void 0!==t?t:"":"https://api.gataca.io/qr/redirect.html?dl="+d(this.authenticationRequest)}async refreshQrHref(){var t;const i=this.buildRawLink();if(i===this.lastShortenRaw)return;this.lastShortenRaw=i;const e=await h(null!=i?i:""),s=this.buildRawLink();s===i?this.qrHref=e:(null===(t=this.qrHref)||void 0===t?void 0:t.trim())||(this.qrHref=s)}async stop(){this.clean(),(this.result===r.ONGOING||r.READ)&&(this.result=r.NOT_STARTED)}clean(){this.sessionData=void 0,this.sessionId=void 0,this.qrHref="",this.lastShortenRaw=null}async getSessionData(){return this.sessionData?Promise.resolve(this.sessionData):Promise.reject(new Error(this.failedLoginErrorLabel))}async getSessionId(){if(this.sessionId)return this.sessionId;let{sessionId:t,authenticationRequest:i}=await this.createSession();return this.sessionId=t,this.authenticationRequest=i,this.sessionId}getLink(){return this.qrHref||this.buildRawLink()}async poll(){let t=(new Date).getTime()+1e3*(this.sessionTimeout||300),i=1e3*(this.pollingFrequency||3),e=this,s=async function(a,n){let{result:o,data:l}=await(async t=>{if(t.result===r.NOT_STARTED)return{result:r.NOT_STARTED};let i=await t.getSessionId();return t.checkStatus(i)})(e);switch(o){case r.SUCCESS:a(l);break;case r.READ:e.result=r.READ;case r.ONGOING:e.sessionTimeout>0&&(new Date).getTime()<t?setTimeout(s,i,a,n):n(r.EXPIRED);break;default:n(o)}};return new Promise(s)}renderQRSection(){var t;switch(this.result){case r.NOT_STARTED:return this.renderRetryButton();case r.ONGOING:return this.renderQR(this.getLink(),!0,void 0,!!(null===(t=this.qrHref)||void 0===t?void 0:t.trim()));case r.EXPIRED:return this.renderRetryButton(this.qrCodeExpiredLabel);case r.FAILED:return this.renderRetryButton(this.credentialsNotValidatedLabel);case r.SUCCESS:return this.renderSuccess();case r.READ:return this.renderReadQR({title:null==this?void 0:this.readQrTitle,description:null==this?void 0:this.readQrDescription})}}renderSuccess(){return i(v,{modalHeight:null==this?void 0:this.modalHeight,successLoginLabel:null==this?void 0:this.successLoginLabel,style:null==this?void 0:this.qrStyle})}renderRetryButton(t){return i(b,{errorMessage:t,modalWidth:null==this?void 0:this.modalWidth,clickInsideBoxLabel:null==this?void 0:this.clickInsideBoxLabel,refreshQrLabel:null==this?void 0:this.refreshQrLabel,scanQrLabel:null==this?void 0:this.scanQrLabel,display:this.display.bind(this),style:null==this?void 0:this.qrStyle})}renderReadQR(t){var e;const s=!!(null===(e=this.qrHref)||void 0===e?void 0:e.trim());return i(g,{modalWidth:null==this?void 0:this.modalWidth,readQrMessages:t,url:this.getLink(),sizeQR:(null==this?void 0:this.qrSize)?(null==this?void 0:this.qrSize)-50:void 0,renderQR:(t,i,e)=>this.renderQR(t,i,e,s),style:this.qrStyle})}renderQR(t,e,s,a=!0){return i(p,{value:t,qrType:this.qrType,useLogo:e&&0!==this.logoSize,size:s||(null==this?void 0:this.qrSize)||void 0,logoSrc:null==this?void 0:this.logoSrc,style:null==this?void 0:this.qrStyle,linkReady:a})}render(){var t,e,a,n,o,l;return i("div",{class:"popUpContainer"},i("div",{class:`is-visible modal-window ${this.hideModalTexts?"":"large-modal"} ${this.hideModalBoxShadow?"noBoxShadow":""}`,style:{width:(this.modalWidth-2).toString()+"px",height:this.modalHeight?(null===(t=this.modalHeight-2)||void 0===t?void 0:t.toString())+"px":"",backgroundColor:(null===(e=null==this?void 0:this.qrStyle)||void 0===e?void 0:e.bgColor)?null===(a=null==this?void 0:this.qrStyle)||void 0===a?void 0:a.bgColor:"white",boxShadow:(null===(n=null==this?void 0:this.qrStyle)||void 0===n?void 0:n.boxShadow)?null===(o=null==this?void 0:this.qrStyle)||void 0===o?void 0:o.boxShadow:"0px 3px 10px rgba(48, 48, 48, 0.1);"},onClick:t=>{t.stopPropagation()}},i("div",{class:"modal-window__content"},i("div",{class:"qrTitleContainer "+(this.hideModalTexts?"hidenText":"")},i("p",{class:"qrTitle modalText",style:{color:this.modalTitleColor||"#1e1e20"}},this.qrModalTitle),!this.hideBrandTitle&&i("p",{class:"qrBrand modalText"},this.byBrandLabel," ",i("span",null,i("img",{src:s}))),this.result!==r.SUCCESS&&!this.hideQrModalDescription&&i("p",{class:"qrDescription modalText"},this.qrModalDescription)),i("div",{class:"qrSection",style:{width:this.modalWidth.toString()+"px",height:this.modalWidth?(null===(l=this.modalWidth)||void 0===l?void 0:l.toString())+"px":""}},this.renderQRSection()))))}};x.style='@import url("https://fonts.googleapis.com/css2?family=Ubuntu:wght@100;300;400;500;600;700&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@100;300;400;500;600;700&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:"";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.brandSection{padding-top:5px;display:flex;align-items:center}.brandSection .gatacaImgSmall{height:13px;width:13px;margin:0;margin-right:10px}.popUpContainer .large-modal{width:300px;min-height:350px}.popUpContainer .modal-window{position:relative;border-radius:6px;overflow:hidden;color:rgba(24, 27, 94, 0.8);box-shadow:0px 3px 10px rgba(48, 48, 48, 0.1);display:flex;flex-direction:column;justify-content:space-between;align-items:center;display:flex;z-index:1001;padding:1px;background-color:white;border-radius:12px;-webkit-transition:opacity 0.5s, visibility 0s 0.5s;transition:opacity 0.5s, visibility 0s 0.5s;visibility:hidden;opacity:0}.popUpContainer .modal-window__content{width:100%;height:100%;text-align:left}.popUpContainer .modal-window__content .hidenText{display:none}.popUpContainer .modal-window .modalText{font-family:"Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px;margin-top:10px;letter-spacing:1px}.popUpContainer .modal-window .qrTitleContainer{padding:14px 24px;padding-bottom:0px}.popUpContainer .modal-window .qrTitle{font-size:20px;font-weight:600;line-height:23.5px}.popUpContainer .modal-window .qrDescription{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074}.popUpContainer .modal-window .bold{font-weight:700}.popUpContainer .modal-window .qrBrand{margin-top:4px;font-size:14px;font-weight:400;line-height:16.5px;display:flex;align-items:center}.popUpContainer .modal-window .qrBrand img{margin-left:5px;height:12px}.popUpContainer .modal-window .qr-section{width:252px;height:252px}.popUpContainer .noBoxShadow{box-shadow:none}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}.success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.success>img{padding-bottom:12px}.success>.successMsg{line-height:23.5px;color:var(--neutral-1000, #1e1e20);text-align:center;font-family:"Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:20px;font-style:normal;font-weight:700;line-height:24px}.reload,.blured{height:252px;width:252px;border:1px dashed #a1a1a1;border-radius:20px;position:relative;top:24px;margin:0 24px 24px;display:flex;overflow:hidden;justify-content:center;align-items:center}#qrwait{display:flex;justify-content:center}.qr-placeholder-slot{box-sizing:border-box;border-radius:12px;background:rgba(0, 0, 0, 0.04)}#qrwait,#notify{width:100%;height:100%;top:0;left:0;border-radius:20px}#notify{z-index:10;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;display:flex;flex-direction:column;box-sizing:border-box;padding:20px;background:rgba(255, 255, 255, 0.95)}#notify>svg{padding-bottom:12px}.alert{display:flex;flex-direction:row;justify-content:start;width:252px;position:absolute;bottom:0px;border:1px solid #ee888c;background:#ffdedf;border-radius:11px;box-sizing:border-box;padding:12px;align-items:center;gap:12px}.alert>img{margin:0}.alert>p{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;margin-top:0;line-height:16px;color:#1e1e20}.notify-text{font-family:"Poppins", "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:16px;color:#707074;text-align:center}.containerLoader{display:flex;justify-content:center;align-items:center;width:30px;height:30px;margin-bottom:12px}.loader{position:relative;margin-left:0 !important}.loader__item{position:absolute;width:9.68px;height:4px;background-color:var(--loader-color, #4745B7);border-radius:2px;--to-opacity:1;opacity:var(--to-opacity)}.loader__item__1{transform:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-webkit-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-moz-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);-o-animation:translate(2.5846212025px, 5.4246212025px) rotate(45deg);--to-opacity:calc(1 - (0 / 8));animation:blink 0.8333333333s linear 0.1041666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.1041666667s infinite;-moz-animation:blink 0.8333333333s linear 0.1041666667s infinite;-o-animation:blink 0.8333333333s linear 0.1041666667s infinite}.loader__item__2{transform:translate(-4.84px, 8.5px) rotate(90deg);-webkit-animation:translate(-4.84px, 8.5px) rotate(90deg);-moz-animation:translate(-4.84px, 8.5px) rotate(90deg);-o-animation:translate(-4.84px, 8.5px) rotate(90deg);--to-opacity:calc(1 - (1 / 8));animation:blink 0.8333333333s linear 0.2083333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.2083333333s infinite;-moz-animation:blink 0.8333333333s linear 0.2083333333s infinite;-o-animation:blink 0.8333333333s linear 0.2083333333s infinite}.loader__item__3{transform:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-webkit-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-moz-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);-o-animation:translate(-12.2646212025px, 5.4246212025px) rotate(135deg);--to-opacity:calc(1 - (2 / 8));animation:blink 0.8333333333s linear 0.3125s infinite;-webkit-animation:blink 0.8333333333s linear 0.3125s infinite;-moz-animation:blink 0.8333333333s linear 0.3125s infinite;-o-animation:blink 0.8333333333s linear 0.3125s infinite}.loader__item__4{transform:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-webkit-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-moz-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);-o-animation:translate(-15.3399999992px, -1.9999999999px) rotate(180deg);--to-opacity:calc(1 - (3 / 8));animation:blink 0.8333333333s linear 0.4166666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.4166666667s infinite;-moz-animation:blink 0.8333333333s linear 0.4166666667s infinite;-o-animation:blink 0.8333333333s linear 0.4166666667s infinite}.loader__item__5{transform:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-webkit-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-moz-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);-o-animation:translate(-12.2646210959px, -9.4246211842px) rotate(225deg);--to-opacity:calc(1 - (4 / 8));animation:blink 0.8333333333s linear 0.5208333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.5208333333s infinite;-moz-animation:blink 0.8333333333s linear 0.5208333333s infinite;-o-animation:blink 0.8333333333s linear 0.5208333333s infinite}.loader__item__6{transform:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-webkit-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-moz-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);-o-animation:translate(-4.8399941857px, -12.499998805px) rotate(270deg);--to-opacity:calc(1 - (5 / 8));animation:blink 0.8333333333s linear 0.625s infinite;-webkit-animation:blink 0.8333333333s linear 0.625s infinite;-moz-animation:blink 0.8333333333s linear 0.625s infinite;-o-animation:blink 0.8333333333s linear 0.625s infinite}.loader__item__7{transform:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-webkit-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-moz-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);-o-animation:translate(2.5847915061px, -9.4245803212px) rotate(315deg);--to-opacity:calc(1 - (6 / 8));animation:blink 0.8333333333s linear 0.7291666667s infinite;-webkit-animation:blink 0.8333333333s linear 0.7291666667s infinite;-moz-animation:blink 0.8333333333s linear 0.7291666667s infinite;-o-animation:blink 0.8333333333s linear 0.7291666667s infinite}.loader__item__8{transform:translate(5.6631628524px, -1.99913122px) rotate(360deg);-webkit-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);-moz-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);-o-animation:translate(5.6631628524px, -1.99913122px) rotate(360deg);--to-opacity:calc(1 - (7 / 8));animation:blink 0.8333333333s linear 0.8333333333s infinite;-webkit-animation:blink 0.8333333333s linear 0.8333333333s infinite;-moz-animation:blink 0.8333333333s linear 0.8333333333s infinite;-o-animation:blink 0.8333333333s linear 0.8333333333s infinite}.loader__item__8{max-width:8.5px}@keyframes blink{0%{opacity:1}100%{opacity:var(--to-opacity)}}@keyframes rotate{0%{transform:rotate(0deg)}100%{background:rotate(360deg)}}';const f="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAYAAACN1PRVAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHvSURBVHgB3ZZPTttAFMbfe3YjL7qYLopcpZXSG7Q3CDfIsqrSJpyg5QQtJ2h7glgUdVs4AeEE5AYEQSDAgtnw357Hm0hAQDaeIRFCfFKyeKPxzzPzvc+DUKCZN80GEv1ABgWOQgSdGbOwv7u0nDueV4zjTzUIKhuAZna4vdQFR828azbI0K/TI/qodaLvjlP+tLDGDCs+IKv9Lbsi7kcv0w9541Q0EREPYcoieEQ9KiyECRXHzbpBUOcnYTfPFOOaaGVx9WsLiDrSIp0iU0wFNgIx/AQyc9I/OmOjy+Y8aBvHQcDUYebewc6/Xtk8J5htcg5efEPGhk0JtqkyBjo7DuZcnuO2sqCyKv8rUDmfTS9IBURqBAL+I6CkzBjOMOs22TLY21n8fl17KzXR3uDvb/CQk0GEdfvN07QvpnAOaGfYaRT25JzU6+rnG2tTpcWAy+Cp0m3U/URLms8HWfg/rn6RFaGSs9KQkZMpvGBWNs2Vandt46ac6YNBuc0fDLMaOU5DFybQ8039p/KJ4bq4rwPewtqoM/1gsCm/NfBXvWjgHhhuDAeLyd3qVSifHQULeZkou9EqemLhmUmav8qrZ4GEMGA7ivzjKvfeqGptFV2YdWPMPHHq0cCh3DdpVdLl/XCY9J1gVvbCiWa6N+JLocPFjCsx9cAAAAAASUVORK5CYII=",w=class{constructor(s){t(this,s),this.gatacaLoginCompleted=e(this,"gatacaLoginCompleted",7),this.gatacaLoginFailed=e(this,"gatacaLoginFailed",7),this.gatacaButtonPushed=e(this,"gatacaButtonPushed",7),this.dcapiCallInProgress=!1,this.getRequestFromUri=async t=>{const i=new URL(t).searchParams.get("request_uri");if(i){const t=await fetch(i,{method:"GET",headers:{"Content-Type":"application/json"}}),e=await t.text();let s=e;try{const t=JSON.parse(e);"string"==typeof t?s=t:(null==t?void 0:t.jwt)&&(s=t.jwt)}catch(t){console.log("[DCAPI] Raw response is likely already the compact JWT string")}const a=s.split(".");if(a.length<3)throw new Error("[DCAPI] Invalid JWT format from request_uri");const n=a[1].replace(/-/g,"+").replace(/_/g,"/"),o=window.atob(n);let r=JSON.parse(o);return r.response_mode="dc_api",r}throw new Error("[DCAPI] authenticationRequest does not contain request_uri")},this.buttonText="Easy login",this.buttonDCAPIText="Login with Device Credentials",this.qrType="svg",this.autostart=!0,this.checkStatus=void 0,this.createSession=void 0,this.fillSession=void 0,this.successCallback=void 0,this.errorCallback=void 0,this.handleCheckAppLoading=void 0,this.checkAppTimeout=6,this.qrRole=void 0,this.callbackServer=void 0,this.sessionTimeout=void 0,this.pollingFrequency=void 0,this.autorefresh=!1,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.hideBrandTitle=!1,this.dynamicLink=!0,this.logoSize=0,this.logoSrc=void 0,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.enableDcApi=!1,this.hideQrModalDescription=!1,this.qrStyle=void 0,this.open=!1,this.sessionId=void 0,this.authenticationRequest=void 0,this.sessionData=void 0,this.result=r.NOT_STARTED,this.qr=i("gataca-qr",{ref:t=>this.qrElement=t,checkStatus:this.checkStatus,createSession:this.createSession,successCallback:this.successCallback,errorCallback:this.errorCallback,qrRole:this.qrRole,qrType:this.qrType,callbackServer:this.callbackServer,sessionTimeout:this.sessionTimeout,pollingFrequency:this.pollingFrequency,autostart:this.autostart,autorefresh:this.autorefresh,v:this.v,qrModalTitle:this.qrModalTitle,qrModalDescription:this.qrModalDescription,hideBrandTitle:this.hideBrandTitle,dynamicLink:this.dynamicLink,logoSize:this.logoSize,logoSrc:this.logoSrc,modalTitleColor:this.modalTitleColor,qrCodeExpiredLabel:this.qrCodeExpiredLabel,credentialsNotValidatedLabel:this.credentialsNotValidatedLabel,clickInsideBoxLabel:this.clickInsideBoxLabel,refreshQrLabel:this.refreshQrLabel,scanQrLabel:this.scanQrLabel,userNotScanInTimeErrorLabel:this.userNotScanInTimeErrorLabel,credsNotValidatedErrorLabel:this.credsNotValidatedErrorLabel,failedLoginErrorLabel:this.failedLoginErrorLabel,successLoginLabel:this.successLoginLabel,byBrandLabel:this.byBrandLabel,waitingStartSessionLabel:this.waitingStartSessionLabel,hideQrModalDescription:this.hideQrModalDescription,qrStyle:this.qrStyle})}supportsDCAPI(){return!!this.enableDcApi&&(void 0!==window.DigitalCredential&&["org-iso-mdoc","openid4vp","openid4vci"].filter(window.DigitalCredential.userAgentAllowsProtocol).length>0)}async getSessionData(){return this.qr.getSessionData()}async getSessionId(){if(this.sessionId)return this.sessionId;let{sessionId:t,authenticationRequest:i}=await this.createSession();return this.sessionId=t,this.authenticationRequest=i,this.sessionId}async startMobilePolling(){await this.getSessionId(),this.result=r.ONGOING,this.poll().then((t=>{this.result=r.SUCCESS,this.sessionData=t,this.gatacaLoginCompleted.emit(t),this.successCallback(t)})).catch((t=>{this.clean();let i=t===r.EXPIRED;if(i&&this.autorefresh)this.startMobilePolling();else if(t!==r.NOT_STARTED){let e=i?new Error(this.userNotScanInTimeErrorLabel):new Error(this.credsNotValidatedErrorLabel);this.result=t,this.gatacaLoginFailed.emit(e),this.errorCallback(e)}}))}async stop(){this.clean(),(this.result===r.ONGOING||r.READ)&&(this.result=r.NOT_STARTED)}clean(){this.sessionData=void 0,this.sessionId=void 0}renderModal(){return this.qr}async poll(){let t=(new Date).getTime()+1e3*(this.sessionTimeout||300),i=1e3*(this.pollingFrequency||3),e=this,s=async function(a,n){let{result:o,data:l}=await(async t=>{if(t.result===r.NOT_STARTED)return{result:r.NOT_STARTED};let i=await t.getSessionId();return t.checkStatus(i)})(e);switch(o){case r.SUCCESS:a(l);break;case r.READ:e.result=r.READ;case r.ONGOING:e.sessionTimeout>0&&(new Date).getTime()<t?setTimeout(s,i,a,n):n(r.EXPIRED);break;default:n(o)}};return new Promise(s)}isAppInstalled(t,i){let e,s=!1;(null==t?void 0:t.length)&&(window.location.href=t),e=setTimeout((()=>{s||i(!1),n()}),1e3*this.checkAppTimeout);const a=()=>{document.hidden&&(s=!0,i(!0),this.autostart||this.startMobilePolling(),n())};function n(){clearTimeout(e),document.removeEventListener("visibilitychange",a)}document.addEventListener("visibilitychange",a)}renderDesktopButton(){return i("div",{class:"gatacaButtonWrapper"},i("button",{class:"gatacaButton",onClick:()=>{this.open=!this.open,setTimeout((()=>{var t,i;this.open?null===(t=this.qrElement)||void 0===t||t.display():null===(i=this.qrElement)||void 0===i||i.stop()}),0)}},i("img",{src:f,class:"buttonImg",alt:this.buttonText}),i("span",null,this.buttonText)))}async getAuthRequest(){let{authenticationRequest:t}=await this.createSession();return t}renderMobileButton(t,e){this.autostart&&!this.supportsDCAPI()&&this.startMobilePolling();let s=!1;const a=t=>{s=t,this.handleCheckAppLoading&&this.handleCheckAppLoading(t)},n=async()=>{a(!0);try{const i=await this.getAuthRequest();this.isAppInstalled(i,(i=>{i||(this.stop(),t?window.location.href="https://play.google.com/store/apps/details?id=com.gataca.identity":e&&(window.location.href="https://apps.apple.com/us/app/gataca/id1498607616")),a(!1)}))}catch(t){this.stop(),a(!1)}};return i("div",{class:"gatacaButtonWrapper"},i("button",{class:"gatacaButton",onClick:()=>{this.gatacaButtonPushed.emit(),n()},disabled:s},i("img",{src:f,class:"buttonImg",alt:this.buttonText}),i("span",null,this.buttonText)))}renderDCAPIButton(){let t=!1;const e=i=>{t=i,this.handleCheckAppLoading&&this.handleCheckAppLoading(i)},s=async()=>{if(!this.dcapiCallInProgress){this.dcapiCallInProgress=!0,e(!0);try{const t=await this.getAuthRequest();let i=await this.getRequestFromUri(t),s=await navigator.credentials.get({digital:{requests:[{protocol:"openid4vp-v1-unsigned",data:i}]}});s||console.log("Digital Credential - Response Data: "+s),await this.fillSession(i,null==s?void 0:s.data)}catch(t){this.stop()}finally{this.dcapiCallInProgress=!1,e(!1)}}};return i("div",{class:"gatacaButtonWrapper"},i("button",{class:"gatacaButton",onClick:()=>{this.gatacaButtonPushed.emit(),s()},disabled:t},i("img",{src:f,class:"buttonImg",alt:this.buttonDCAPIText}),i("span",null,this.buttonDCAPIText)))}render(){const t=(null===navigator||void 0===navigator?void 0:navigator.userAgent)||(null===navigator||void 0===navigator?void 0:navigator.vendor)||(null===window||void 0===window?void 0:window.opera),e=/android/i.test(t),s=/iPad|iPhone|iPod/.test(t)&&!window.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,a=e||s,n=this.supportsDCAPI();return i("div",null,i("div",{class:"buttonContainer"},a&&"3"===this.v?n?this.renderDCAPIButton():this.renderMobileButton(e,s):this.renderDesktopButton(),this.open&&!n&&(!a||"3"===this.v)&&this.renderModal()))}};w.style='@import url("https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:"";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.buttonContainer{display:inline-block;text-align:right;padding:10px;position:relative}.gatacaButtonWrapper{margin:8px}.gatacaButtonWrapper .gatacaButton{display:flex;min-width:100px;padding:8px 8px;background-color:white;font-size:12px;font-family:"Work Sans", sans-serif;letter-spacing:1px;font-weight:2;justify-content:space-between;align-items:center;border-radius:6px;border:1px solid rgba(24, 27, 94, 0.5);color:rgba(24, 27, 94, 0.8);box-shadow:0px 1px 3px rgba(48, 48, 48, 0.15);cursor:pointer}.gatacaButtonWrapper .gatacaButton>span{margin-right:10px}.gatacaButtonWrapper .gatacaButton:hover{box-shadow:0px 2px 8px rgba(48, 48, 48, 0.1)}.gatacaButtonWrapper .buttonText{text-align:right;font-size:8px;color:rgba(24, 27, 94, 0.5);font-family:"Helvetica Neue", sans-serif;letter-spacing:1px;padding-right:8px;font-weight:1}.gatacaButtonWrapper .buttonImg{height:25px;width:25px;margin:0;margin-right:20px}';export{x as gataca_qr,c as gataca_qrdisplay,w as gataca_ssibutton}
@@ -5,6 +5,7 @@ import { RESULT_STATUS } from '../../utils/utils';
5
5
  import { GatacaQR, qrStyle } from '../gataca-qr/gataca-qr';
6
6
  export declare class GatacaSSIButton {
7
7
  qr: GatacaQR;
8
+ private dcapiCallInProgress;
8
9
  private qrElement;
9
10
  constructor();
10
11
  /**
@@ -257,6 +258,6 @@ export declare class GatacaSSIButton {
257
258
  request: any;
258
259
  uri: string;
259
260
  }>;
260
- renderDCAPIButton(isAndroid: boolean, isIos: boolean): any;
261
+ renderDCAPIButton(): any;
261
262
  render(): any;
262
263
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gataca/qr",
3
- "version": "4.2.0",
3
+ "version": "4.2.2",
4
4
  "description": "Gataca component to display presentation requests in QR",
5
5
  "author": "Gataca <it@gataca.io>",
6
6
  "licenses": [