@gataca/qr 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/cjs/gataca-autoqr.cjs.entry.js +105 -0
  2. package/dist/cjs/gataca-qr_2.cjs.entry.js +230 -0
  3. package/dist/cjs/gataca-qrws.cjs.entry.js +176 -0
  4. package/dist/cjs/gataca-ssibutton_2.cjs.entry.js +129 -0
  5. package/dist/cjs/gatacaqr.cjs.js +1 -1
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/logo_gataca-f3dc6840.js +14 -0
  8. package/dist/{esm/gataca-autoqr_6.entry.js → cjs/qr-code-styling-412bbc7a.js} +2 -603
  9. package/dist/collection/components/gataca-qr/gataca-qr.css +11 -2
  10. package/dist/collection/components/gataca-qr/gataca-qr.js +110 -10
  11. package/dist/components/gataca-qr2.js +26 -10
  12. package/dist/esm/gataca-autoqr.entry.js +101 -0
  13. package/dist/esm/gataca-qr_2.entry.js +225 -0
  14. package/dist/esm/gataca-qrws.entry.js +172 -0
  15. package/dist/esm/gataca-ssibutton_2.entry.js +124 -0
  16. package/dist/esm/gatacaqr.js +1 -1
  17. package/dist/esm/loader.js +1 -1
  18. package/dist/esm/logo_gataca-57ad0363.js +9 -0
  19. package/dist/{cjs/gataca-autoqr_6.cjs.entry.js → esm/qr-code-styling-0eeb38d5.js} +1 -613
  20. package/dist/gatacaqr/gatacaqr.esm.js +1 -1
  21. package/dist/gatacaqr/p-0be4566d.js +1 -0
  22. package/dist/gatacaqr/p-35b616ba.entry.js +1 -0
  23. package/dist/gatacaqr/p-5eb106c0.entry.js +1 -0
  24. package/dist/gatacaqr/p-66ad21ac.entry.js +1 -0
  25. package/dist/gatacaqr/p-6adc6933.js +1 -0
  26. package/dist/gatacaqr/p-b834ef88.entry.js +1 -0
  27. package/dist/types/components/gataca-qr/gataca-qr.d.ts +27 -2
  28. package/dist/types/components.d.ts +42 -2
  29. package/package.json +40 -38
  30. package/dist/gatacaqr/p-b37057bb.entry.js +0 -1
@@ -79,9 +79,14 @@ img {
79
79
  margin-right: 10px;
80
80
  }
81
81
 
82
+ .popUpContainer .large-modal {
83
+ width: 300px;
84
+ min-height: 350px;
85
+ }
82
86
  .popUpContainer .modal-window {
83
87
  position: relative;
84
88
  border-radius: 6px;
89
+ overflow: hidden;
85
90
  color: rgba(24, 27, 94, 0.8);
86
91
  box-shadow: 0px 3px 10px rgba(48, 48, 48, 0.1);
87
92
  display: flex;
@@ -90,10 +95,8 @@ img {
90
95
  align-items: center;
91
96
  display: flex;
92
97
  z-index: 1001;
93
- width: 300px;
94
98
  padding: 1px;
95
99
  background-color: white;
96
- min-height: 350px;
97
100
  border-radius: 12px;
98
101
  -webkit-transition: opacity 0.5s, visibility 0s 0.5s;
99
102
  transition: opacity 0.5s, visibility 0s 0.5s;
@@ -105,6 +108,9 @@ img {
105
108
  height: 100%;
106
109
  text-align: left;
107
110
  }
111
+ .popUpContainer .modal-window__content .hidenText {
112
+ display: none;
113
+ }
108
114
  .popUpContainer .modal-window p {
109
115
  font-family: "Ubuntu", "Work Sans", "Helvetica Neue", sans-serif;
110
116
  font-size: 20px;
@@ -151,6 +157,9 @@ img {
151
157
  width: 252px;
152
158
  height: 252px;
153
159
  }
160
+ .popUpContainer .noBoxShadow {
161
+ box-shadow: none;
162
+ }
154
163
  .popUpContainer .reload {
155
164
  height: 252px;
156
165
  width: 252px;
@@ -15,7 +15,7 @@ const FUNCTION_ROLES = {
15
15
  certify: "credential",
16
16
  };
17
17
  export class GatacaQR {
18
- constructor() { this.checkStatus = undefined; this.createSession = undefined; this.successCallback = undefined; this.errorCallback = undefined; this.qrRole = undefined; this.callbackServer = undefined; this.autostart = true; this.autorefresh = false; this.v2 = false; 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 = false; this.logoSize = 0; this.logoSrc = logoGataca; 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.hideQrModalDescription = false; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT; this.pollingFrequency = DEFAULT_POLLING_FREQ; this.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = RESULT_STATUS.NOT_STARTED; }
18
+ constructor() { this.checkStatus = undefined; this.createSession = undefined; this.successCallback = undefined; this.errorCallback = undefined; this.qrRole = undefined; this.callbackServer = undefined; this.autostart = true; this.autorefresh = false; this.v2 = false; this.qrModalTitle = "Quick Access"; this.modalTitleColor = "#4745B7"; this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet"; this.hideModalTexts = false; this.hideModalBoxShadow = false; this.hideBrandTitle = false; this.logoSize = 0; this.logoSrc = logoGataca; this.qrSize = 300; this.modalWidth = 300; this.modalHeight = undefined; this.qrCodeExpiredLabel = "QR Code expired"; this.credentialsNotValidatedLabel = "User credentials not validated"; this.clickInsideBoxLabel = "Click inside the box to"; this.refreshQrLabel = "Refresh QR Code"; this.scanQrLabel = "Scan QR Code"; this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time"; this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated"; this.failedLoginErrorLabel = "No successful login"; this.successLoginLabel = "Successful Connection!"; this.byBrandLabel = "by Gataca"; this.waitingStartSessionLabel = "waiting to start a session"; this.hideQrModalDescription = false; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT; this.pollingFrequency = DEFAULT_POLLING_FREQ; this.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = RESULT_STATUS.NOT_STARTED; }
19
19
  disconnectedCallback() {
20
20
  this.stop();
21
21
  }
@@ -89,7 +89,7 @@ export class GatacaQR {
89
89
  return this.sessionId;
90
90
  }
91
91
  getLink() {
92
- if (this.v2 && this.qrRole == QR_ROLE_CONNECT) {
92
+ if (this.v2) {
93
93
  return this.authenticationRequest;
94
94
  }
95
95
  let op = FUNCTION_ROLES[this.qrRole];
@@ -142,7 +142,7 @@ export class GatacaQR {
142
142
  case RESULT_STATUS.NOT_STARTED:
143
143
  return this.renderRetryButton();
144
144
  case RESULT_STATUS.ONGOING:
145
- return this.renderQR(this.getLink(), 300, true);
145
+ return this.renderQR(this.getLink(), true);
146
146
  case RESULT_STATUS.EXPIRED:
147
147
  return this.renderRetryButton(this.qrCodeExpiredLabel);
148
148
  case RESULT_STATUS.FAILED:
@@ -152,18 +152,29 @@ export class GatacaQR {
152
152
  }
153
153
  }
154
154
  renderSuccess() {
155
- return (h("div", { class: "success" }, h("img", { src: successIcon, height: 52, width: 52 }), h("p", { class: "successMsg" }, this.successLoginLabel)));
155
+ var _a;
156
+ return (h("div", { class: "success", style: {
157
+ height: this.modalHeight
158
+ ? ((_a = this.modalHeight) === null || _a === void 0 ? void 0 : _a.toString()) + "px"
159
+ : "300px",
160
+ } }, h("img", { src: successIcon, height: 52, width: 52 }), h("p", { class: "successMsg" }, this.successLoginLabel)));
156
161
  }
157
162
  renderRetryButton(errorMessage) {
158
- return (h("div", { class: "reload" }, h("div", { id: "notify", onClick: () => this.display() }, h("img", { src: refreshIcon, height: 24, width: 24 }), h("p", { class: "qrDescription" }, this.clickInsideBoxLabel, " "), errorMessage ? (h("p", { class: "qrDescription bold" }, this.refreshQrLabel)) : (h("p", { class: "qrDescription bold" }, this.scanQrLabel, "e")), errorMessage && (h("div", { class: "alert" }, h("img", { src: alertIcon, height: 24, width: 24 }), h("p", null, errorMessage)))), h("div", { id: "qrwait" }, this.renderQR(this.waitingStartSessionLabel, 250))));
163
+ return (h("div", { class: "reload" }, h("div", { id: "notify", onClick: () => this.display() }, h("img", { src: refreshIcon, height: 24, width: 24 }), h("p", { class: "qrDescription" }, this.clickInsideBoxLabel, " "), errorMessage ? (h("p", { class: "qrDescription bold" }, this.refreshQrLabel)) : (h("p", { class: "qrDescription bold" }, this.scanQrLabel, "e")), errorMessage && (h("div", { class: "alert" }, h("img", { src: alertIcon, height: 24, width: 24 }), h("p", null, errorMessage)))), h("div", { id: "qrwait" }, this.renderQR(this.waitingStartSessionLabel))));
159
164
  }
160
- renderQR(value, size, useLogo) {
161
- return (h("gataca-qrdisplay", { qrData: value, rounded: true, size: size, "logo-size": useLogo ? 0.33 : 0, "logo-src": this.logoSrc }));
165
+ renderQR(value, useLogo) {
166
+ return (h("gataca-qrdisplay", { qrData: value, rounded: true, size: this.qrSize, "logo-size": useLogo ? 0.33 : 0, "logo-src": this.logoSrc }));
162
167
  }
163
168
  render() {
164
- return (h("div", { class: "popUpContainer" }, h("div", { class: "modal-window is-visible", onClick: (event) => {
169
+ var _a;
170
+ return (h("div", { class: "popUpContainer" }, h("div", { class: `is-visible modal-window ${this.hideModalTexts ? "" : "large-modal"} ${this.hideModalBoxShadow ? "noBoxShadow" : ""}`, style: {
171
+ width: (this.modalWidth - 2).toString() + "px",
172
+ height: this.modalHeight
173
+ ? ((_a = (this.modalHeight - 2)) === null || _a === void 0 ? void 0 : _a.toString()) + "px"
174
+ : "",
175
+ }, onClick: (event) => {
165
176
  event.stopPropagation();
166
- } }, h("div", { class: "modal-window__content" }, h("div", { class: "qrTitleContainer" }, h("p", { class: "qrTitle", style: { color: this.modalTitleColor || "#1e1e20" } }, this.qrModalTitle), !this.hideBrandTitle && (h("p", { class: "qrBrand" }, this.byBrandLabel, " ", h("span", null, h("img", { src: logoGataca })))), this.result !== RESULT_STATUS.SUCCESS &&
177
+ } }, h("div", { class: "modal-window__content" }, h("div", { class: `qrTitleContainer ${this.hideModalTexts ? "hidenText" : ""}` }, h("p", { class: "qrTitle", style: { color: this.modalTitleColor || "#1e1e20" } }, this.qrModalTitle), !this.hideBrandTitle && (h("p", { class: "qrBrand" }, this.byBrandLabel, " ", h("span", null, h("img", { src: logoGataca })))), this.result !== RESULT_STATUS.SUCCESS &&
167
178
  !this.hideQrModalDescription && (h("p", { class: "qrDescription" }, this.qrModalDescription))), h("div", { class: "qrSection" }, this.renderQRSection())))));
168
179
  }
169
180
  static get is() { return "gataca-qr"; }
@@ -272,7 +283,7 @@ export class GatacaQR {
272
283
  "optional": false,
273
284
  "docs": {
274
285
  "tags": [],
275
- "text": "***Mandatory***\nDecide if scanning the credential as a verifier to request credentials\nor as an issuer too issue credentials.\nOptions: connect | certify"
286
+ "text": "***Mandatory just for V1***\nDecide if scanning the credential as a verifier to request credentials\nor as an issuer too issue credentials.\nOptions: connect | certify"
276
287
  },
277
288
  "attribute": "qr-role",
278
289
  "reflect": false
@@ -402,6 +413,42 @@ export class GatacaQR {
402
413
  "reflect": false,
403
414
  "defaultValue": "\"Sign up or sign in by scanning the QR Code with the Gataca Wallet\""
404
415
  },
416
+ "hideModalTexts": {
417
+ "type": "boolean",
418
+ "mutable": false,
419
+ "complexType": {
420
+ "original": "boolean",
421
+ "resolved": "boolean",
422
+ "references": {}
423
+ },
424
+ "required": false,
425
+ "optional": true,
426
+ "docs": {
427
+ "tags": [],
428
+ "text": "_[Optional]_\nBoolean to show or not show the modal title, brandTitle and description"
429
+ },
430
+ "attribute": "hide-modal-texts",
431
+ "reflect": false,
432
+ "defaultValue": "false"
433
+ },
434
+ "hideModalBoxShadow": {
435
+ "type": "boolean",
436
+ "mutable": false,
437
+ "complexType": {
438
+ "original": "boolean",
439
+ "resolved": "boolean",
440
+ "references": {}
441
+ },
442
+ "required": false,
443
+ "optional": true,
444
+ "docs": {
445
+ "tags": [],
446
+ "text": "_[Optional]_\nBoolean to show or not show the modal title, brandTitle and description"
447
+ },
448
+ "attribute": "hide-modal-box-shadow",
449
+ "reflect": false,
450
+ "defaultValue": "false"
451
+ },
405
452
  "hideBrandTitle": {
406
453
  "type": "boolean",
407
454
  "mutable": false,
@@ -456,6 +503,59 @@ export class GatacaQR {
456
503
  "reflect": false,
457
504
  "defaultValue": "logoGataca"
458
505
  },
506
+ "qrSize": {
507
+ "type": "number",
508
+ "mutable": false,
509
+ "complexType": {
510
+ "original": "number",
511
+ "resolved": "number",
512
+ "references": {}
513
+ },
514
+ "required": false,
515
+ "optional": true,
516
+ "docs": {
517
+ "tags": [],
518
+ "text": "_[Optional]_\nSize of QR Displayed"
519
+ },
520
+ "attribute": "qr-size",
521
+ "reflect": false,
522
+ "defaultValue": "300"
523
+ },
524
+ "modalWidth": {
525
+ "type": "number",
526
+ "mutable": false,
527
+ "complexType": {
528
+ "original": "number",
529
+ "resolved": "number",
530
+ "references": {}
531
+ },
532
+ "required": false,
533
+ "optional": true,
534
+ "docs": {
535
+ "tags": [],
536
+ "text": "_[Optional]_\nWidth of the modal"
537
+ },
538
+ "attribute": "modal-width",
539
+ "reflect": false,
540
+ "defaultValue": "300"
541
+ },
542
+ "modalHeight": {
543
+ "type": "number",
544
+ "mutable": false,
545
+ "complexType": {
546
+ "original": "number",
547
+ "resolved": "number",
548
+ "references": {}
549
+ },
550
+ "required": false,
551
+ "optional": true,
552
+ "docs": {
553
+ "tags": [],
554
+ "text": "_[Optional]_\nHeight of the modal"
555
+ },
556
+ "attribute": "modal-height",
557
+ "reflect": false
558
+ },
459
559
  "qrCodeExpiredLabel": {
460
560
  "type": "string",
461
561
  "mutable": false,
@@ -2,7 +2,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
2
2
  import { R as RESULT_STATUS, c as checkMobile, b as base64UrlEncode, g as gatIconCheckSvg, a as gatIconRefreshSvg, d as gatIconAlertSvg } from './gat-icon-refresh.js';
3
3
  import { l as logoGatacaSvg, d as defineCustomElement$1 } from './gataca-qrdisplay2.js';
4
4
 
5
- const gatacaQrCss = "@import url(\"https://fonts.googleapis.com/css2?family=Ubuntu:wght@100;300;400;500;600;700&display=swap\"); @import url(\"https://fonts.googleapis.com/css2?family=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 .modal-window{position:relative;border-radius:6px;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;width:300px;padding:1px;background-color:white;min-height:350px;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 p{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;color:#1e1e20}.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-weight:400;font-size:14px;line-height:16.5px;padding-top:12px;padding-bottom:5px;color:#A1A1A1}.popUpContainer .modal-window .bold{font-weight:600}.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 .reload{height:252px;width:252px;border:1px dashed #A1A1A1;border-radius:12px;position:relative;margin:24px;display:flex;justify-content:center;align-items:center}.popUpContainer #qrwait{display:flex;justify-content:center}.popUpContainer #qrwait,.popUpContainer #notify{width:100%;height:100%;top:0;left:0;border-radius:20px}.popUpContainer #notify{z-index:10;background-color:gray;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;align-self:center;display:flex;flex-direction:column;padding:24px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:20px;background:rgba(255, 255, 255, 0.9);}.popUpContainer .notify-text{font-family:\"Work Sans\";font-style:normal;font-weight:400;font-size:14px;line-height:16px;text-align:center;font-feature-settings:\"salt\" on;color:#8B8B8B;flex:none;order:1;align-self:stretch;flex-grow:0}.popUpContainer .alert{display:flex;flex-direction:row;align-items:center;justify-content:start;width:252px;position:absolute;bottom:0;background:#FFE5E5;border-radius:12px}.popUpContainer .alert img{margin:12px}.popUpContainer .alert p{font-weight:400;font-size:14px;line-height:16px;color:black}.popUpContainer .success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.popUpContainer .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;}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}";
5
+ const gatacaQrCss = "@import url(\"https://fonts.googleapis.com/css2?family=Ubuntu:wght@100;300;400;500;600;700&display=swap\"); @import url(\"https://fonts.googleapis.com/css2?family=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 p{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;color:#1e1e20}.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-weight:400;font-size:14px;line-height:16.5px;padding-top:12px;padding-bottom:5px;color:#A1A1A1}.popUpContainer .modal-window .bold{font-weight:600}.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 .reload{height:252px;width:252px;border:1px dashed #A1A1A1;border-radius:12px;position:relative;margin:24px;display:flex;justify-content:center;align-items:center}.popUpContainer #qrwait{display:flex;justify-content:center}.popUpContainer #qrwait,.popUpContainer #notify{width:100%;height:100%;top:0;left:0;border-radius:20px}.popUpContainer #notify{z-index:10;background-color:gray;position:absolute;justify-self:center;justify-items:center;justify-content:center;align-items:center;align-content:center;align-self:center;display:flex;flex-direction:column;padding:24px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:20px;background:rgba(255, 255, 255, 0.9);}.popUpContainer .notify-text{font-family:\"Work Sans\";font-style:normal;font-weight:400;font-size:14px;line-height:16px;text-align:center;font-feature-settings:\"salt\" on;color:#8B8B8B;flex:none;order:1;align-self:stretch;flex-grow:0}.popUpContainer .alert{display:flex;flex-direction:row;align-items:center;justify-content:start;width:252px;position:absolute;bottom:0;background:#FFE5E5;border-radius:12px}.popUpContainer .alert img{margin:12px}.popUpContainer .alert p{font-weight:400;font-size:14px;line-height:16px;color:black}.popUpContainer .success{display:flex;height:300px;flex-direction:column;justify-content:center;align-items:center;padding:0px}.popUpContainer .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;}.popUpContainer .is-visible{opacity:1;visibility:visible}.is-transparent{opacity:0}";
6
6
 
7
7
  const DEEP_LINK_PREFIX = "https://gataca.page.link/?apn=com.gatacaapp&ibi=com.gataca.wallet&link=";
8
8
  //Default values
@@ -14,7 +14,7 @@ const FUNCTION_ROLES = {
14
14
  certify: "credential",
15
15
  };
16
16
  const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
17
- constructor() { super(); this.__registerHost(); this.__attachShadow(); this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7); this.checkStatus = undefined; this.createSession = undefined; this.successCallback = undefined; this.errorCallback = undefined; this.qrRole = undefined; this.callbackServer = undefined; this.autostart = true; this.autorefresh = false; this.v2 = false; 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 = false; this.logoSize = 0; this.logoSrc = logoGatacaSvg; 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.hideQrModalDescription = false; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT; this.pollingFrequency = DEFAULT_POLLING_FREQ; this.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = RESULT_STATUS.NOT_STARTED; }
17
+ constructor() { super(); this.__registerHost(); this.__attachShadow(); this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7); this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7); this.checkStatus = undefined; this.createSession = undefined; this.successCallback = undefined; this.errorCallback = undefined; this.qrRole = undefined; this.callbackServer = undefined; this.autostart = true; this.autorefresh = false; this.v2 = false; this.qrModalTitle = "Quick Access"; this.modalTitleColor = "#4745B7"; this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet"; this.hideModalTexts = false; this.hideModalBoxShadow = false; this.hideBrandTitle = false; this.logoSize = 0; this.logoSrc = logoGatacaSvg; this.qrSize = 300; this.modalWidth = 300; this.modalHeight = undefined; this.qrCodeExpiredLabel = "QR Code expired"; this.credentialsNotValidatedLabel = "User credentials not validated"; this.clickInsideBoxLabel = "Click inside the box to"; this.refreshQrLabel = "Refresh QR Code"; this.scanQrLabel = "Scan QR Code"; this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time"; this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated"; this.failedLoginErrorLabel = "No successful login"; this.successLoginLabel = "Successful Connection!"; this.byBrandLabel = "by Gataca"; this.waitingStartSessionLabel = "waiting to start a session"; this.hideQrModalDescription = false; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT; this.pollingFrequency = DEFAULT_POLLING_FREQ; this.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = RESULT_STATUS.NOT_STARTED; }
18
18
  disconnectedCallback() {
19
19
  this.stop();
20
20
  }
@@ -88,7 +88,7 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
88
88
  return this.sessionId;
89
89
  }
90
90
  getLink() {
91
- if (this.v2 && this.qrRole == QR_ROLE_CONNECT) {
91
+ if (this.v2) {
92
92
  return this.authenticationRequest;
93
93
  }
94
94
  let op = FUNCTION_ROLES[this.qrRole];
@@ -141,7 +141,7 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
141
141
  case RESULT_STATUS.NOT_STARTED:
142
142
  return this.renderRetryButton();
143
143
  case RESULT_STATUS.ONGOING:
144
- return this.renderQR(this.getLink(), 300, true);
144
+ return this.renderQR(this.getLink(), true);
145
145
  case RESULT_STATUS.EXPIRED:
146
146
  return this.renderRetryButton(this.qrCodeExpiredLabel);
147
147
  case RESULT_STATUS.FAILED:
@@ -151,18 +151,29 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
151
151
  }
152
152
  }
153
153
  renderSuccess() {
154
- return (h("div", { class: "success" }, h("img", { src: gatIconCheckSvg, height: 52, width: 52 }), h("p", { class: "successMsg" }, this.successLoginLabel)));
154
+ var _a;
155
+ return (h("div", { class: "success", style: {
156
+ height: this.modalHeight
157
+ ? ((_a = this.modalHeight) === null || _a === void 0 ? void 0 : _a.toString()) + "px"
158
+ : "300px",
159
+ } }, h("img", { src: gatIconCheckSvg, height: 52, width: 52 }), h("p", { class: "successMsg" }, this.successLoginLabel)));
155
160
  }
156
161
  renderRetryButton(errorMessage) {
157
- return (h("div", { class: "reload" }, h("div", { id: "notify", onClick: () => this.display() }, h("img", { src: gatIconRefreshSvg, height: 24, width: 24 }), h("p", { class: "qrDescription" }, this.clickInsideBoxLabel, " "), errorMessage ? (h("p", { class: "qrDescription bold" }, this.refreshQrLabel)) : (h("p", { class: "qrDescription bold" }, this.scanQrLabel, "e")), errorMessage && (h("div", { class: "alert" }, h("img", { src: gatIconAlertSvg, height: 24, width: 24 }), h("p", null, errorMessage)))), h("div", { id: "qrwait" }, this.renderQR(this.waitingStartSessionLabel, 250))));
162
+ return (h("div", { class: "reload" }, h("div", { id: "notify", onClick: () => this.display() }, h("img", { src: gatIconRefreshSvg, height: 24, width: 24 }), h("p", { class: "qrDescription" }, this.clickInsideBoxLabel, " "), errorMessage ? (h("p", { class: "qrDescription bold" }, this.refreshQrLabel)) : (h("p", { class: "qrDescription bold" }, this.scanQrLabel, "e")), errorMessage && (h("div", { class: "alert" }, h("img", { src: gatIconAlertSvg, height: 24, width: 24 }), h("p", null, errorMessage)))), h("div", { id: "qrwait" }, this.renderQR(this.waitingStartSessionLabel))));
158
163
  }
159
- renderQR(value, size, useLogo) {
160
- return (h("gataca-qrdisplay", { qrData: value, rounded: true, size: size, "logo-size": useLogo ? 0.33 : 0, "logo-src": this.logoSrc }));
164
+ renderQR(value, useLogo) {
165
+ return (h("gataca-qrdisplay", { qrData: value, rounded: true, size: this.qrSize, "logo-size": useLogo ? 0.33 : 0, "logo-src": this.logoSrc }));
161
166
  }
162
167
  render() {
163
- return (h("div", { class: "popUpContainer" }, h("div", { class: "modal-window is-visible", onClick: (event) => {
168
+ var _a;
169
+ return (h("div", { class: "popUpContainer" }, h("div", { class: `is-visible modal-window ${this.hideModalTexts ? "" : "large-modal"} ${this.hideModalBoxShadow ? "noBoxShadow" : ""}`, style: {
170
+ width: (this.modalWidth - 2).toString() + "px",
171
+ height: this.modalHeight
172
+ ? ((_a = (this.modalHeight - 2)) === null || _a === void 0 ? void 0 : _a.toString()) + "px"
173
+ : "",
174
+ }, onClick: (event) => {
164
175
  event.stopPropagation();
165
- } }, h("div", { class: "modal-window__content" }, h("div", { class: "qrTitleContainer" }, h("p", { class: "qrTitle", style: { color: this.modalTitleColor || "#1e1e20" } }, this.qrModalTitle), !this.hideBrandTitle && (h("p", { class: "qrBrand" }, this.byBrandLabel, " ", h("span", null, h("img", { src: logoGatacaSvg })))), this.result !== RESULT_STATUS.SUCCESS &&
176
+ } }, h("div", { class: "modal-window__content" }, h("div", { class: `qrTitleContainer ${this.hideModalTexts ? "hidenText" : ""}` }, h("p", { class: "qrTitle", style: { color: this.modalTitleColor || "#1e1e20" } }, this.qrModalTitle), !this.hideBrandTitle && (h("p", { class: "qrBrand" }, this.byBrandLabel, " ", h("span", null, h("img", { src: logoGatacaSvg })))), this.result !== RESULT_STATUS.SUCCESS &&
166
177
  !this.hideQrModalDescription && (h("p", { class: "qrDescription" }, this.qrModalDescription))), h("div", { class: "qrSection" }, this.renderQRSection())))));
167
178
  }
168
179
  static get style() { return gatacaQrCss; }
@@ -179,9 +190,14 @@ const GatacaQR = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
179
190
  "qrModalTitle": [1, "qr-modal-title"],
180
191
  "modalTitleColor": [1, "modal-title-color"],
181
192
  "qrModalDescription": [1, "qr-modal-description"],
193
+ "hideModalTexts": [4, "hide-modal-texts"],
194
+ "hideModalBoxShadow": [4, "hide-modal-box-shadow"],
182
195
  "hideBrandTitle": [4, "hide-brand-title"],
183
196
  "logoSize": [2, "logo-size"],
184
197
  "logoSrc": [1, "logo-src"],
198
+ "qrSize": [2, "qr-size"],
199
+ "modalWidth": [2, "modal-width"],
200
+ "modalHeight": [2, "modal-height"],
185
201
  "qrCodeExpiredLabel": [1, "qr-code-expired-label"],
186
202
  "credentialsNotValidatedLabel": [1, "credentials-not-validated-label"],
187
203
  "clickInsideBoxLabel": [1, "click-inside-box-label"],
@@ -0,0 +1,101 @@
1
+ import { r as registerInstance, c as createEvent, h } from './index-80311733.js';
2
+
3
+ const gatacaAutoqrCss = "@import url(\"https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400&display=swap\"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:\"\";content:none}table{border-collapse:collapse;border-spacing:0}.img-fluid{height:auto;max-width:50%}img{margin-left:auto;margin-right:auto}.buttonContainer{display:inline-block;text-align:right;padding:10px;position:relative}.gatacaButtonWrapper{margin:8px}.gatacaButtonWrapper .gatacaButton{display:flex;min-width:100px;padding:8px 8px;background-color:white;font-size:12px;font-family:\"Work Sans\", sans-serif;letter-spacing:1px;font-weight:2;justify-content:space-between;align-items:center;border-radius:6px;border:1px solid rgba(24, 27, 94, 0.5);color:rgba(24, 27, 94, 0.8);box-shadow:0px 1px 3px rgba(48, 48, 48, 0.15);cursor:pointer}.gatacaButtonWrapper .gatacaButton>span{margin-right:10px}.gatacaButtonWrapper .gatacaButton:hover{box-shadow:0px 2px 8px rgba(48, 48, 48, 0.1)}.gatacaButtonWrapper .buttonText{text-align:right;font-size:8px;color:rgba(24, 27, 94, 0.5);font-family:\"Helvetica Neue\", sans-serif;letter-spacing:1px;padding-right:8px;font-weight:1}.gatacaButtonWrapper .buttonImg{height:25px;width:25px;margin:0;margin-right:20px}";
4
+
5
+ const DEFAULT_REPOSITORY = "https://studio.gataca.io/api/v1/qrconfigs";
6
+ const fixFunctions = (data) => {
7
+ var _a, _b, _c, _d, _e, _f;
8
+ data.errorCallback = deserializeFunction((_a = data.errorCallback) === null || _a === void 0 ? void 0 : _a.toString());
9
+ data.successCallback = deserializeFunction((_b = data.successCallback) === null || _b === void 0 ? void 0 : _b.toString());
10
+ data.wsOnMessage = deserializeFunction((_c = data.wsOnMessage) === null || _c === void 0 ? void 0 : _c.toString());
11
+ data.wsOnOpen = deserializeFunction((_d = data.wsOnOpen) === null || _d === void 0 ? void 0 : _d.toString());
12
+ data.checkStatus = deserializeFunction((_e = data.checkStatus) === null || _e === void 0 ? void 0 : _e.toString());
13
+ data.createSession = deserializeFunction((_f = data.createSession) === null || _f === void 0 ? void 0 : _f.toString());
14
+ return data;
15
+ };
16
+ const deserializeFunction = (data) => {
17
+ if (data) {
18
+ return new Function("return " + data)();
19
+ }
20
+ return undefined;
21
+ };
22
+ const GatacaAutoQR = class {
23
+ constructor(hostRef) {
24
+ registerInstance(this, hostRef);
25
+ this.gatacaLoginCompleted = createEvent(this, "gatacaLoginCompleted", 7);
26
+ this.gatacaLoginFailed = createEvent(this, "gatacaLoginFailed", 7);
27
+ this.configId = undefined;
28
+ this.configRepository = DEFAULT_REPOSITORY;
29
+ this.successCallback = undefined;
30
+ this.errorCallback = undefined;
31
+ this.checkStatus = undefined;
32
+ this.createSession = undefined;
33
+ this.wsOnOpen = undefined;
34
+ this.wsOnMessage = undefined;
35
+ this.config = undefined;
36
+ this.loading = undefined;
37
+ this.loading = true;
38
+ fetch(this.configRepository + "/" + this.configId, {
39
+ method: "GET",
40
+ headers: {
41
+ "Content-Type": "application/json",
42
+ },
43
+ })
44
+ .then((response) => {
45
+ response
46
+ .json()
47
+ .then((data) => {
48
+ data = fixFunctions(data);
49
+ this.config = data;
50
+ this.loading = false;
51
+ })
52
+ .catch((err) => {
53
+ console.log("Cannot retrieve selected config", err);
54
+ this.loading = false;
55
+ });
56
+ })
57
+ .catch((err) => {
58
+ console.log("Cannot retrieve selected config", err);
59
+ this.loading = false;
60
+ });
61
+ }
62
+ /**
63
+ * Retrieve manually the session data on a successful login
64
+ */
65
+ async getSessionData() {
66
+ return this.qr.getSessionData();
67
+ }
68
+ selectQR() {
69
+ if (this.config.useButton) {
70
+ if (this.config.useWs) {
71
+ this.qr = (h("gataca-ssibuttonws", { buttonText: this.config.buttonText, wsOnMessage: this.wsOnMessage || this.config.wsOnMessage, wsOnOpen: this.wsOnOpen || this.config.wsOnOpen, successCallback: this.successCallback || this.config.successCallback, errorCallback: this.errorCallback || this.config.errorCallback, qrRole: this.config.qrRole, callbackServer: this.config.callbackServer, sessionTimeout: this.config.sessionTimeout, socketEndpoint: this.config.socketEndpoint, autostart: true, autorefresh: this.config.autorefresh, v2: this.config.v2, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
72
+ }
73
+ else {
74
+ this.qr = (h("gataca-ssibutton", { buttonText: this.config.buttonText, checkStatus: this.checkStatus || this.config.checkStatus, createSession: this.createSession || this.config.createSession, successCallback: this.successCallback || this.config.successCallback, errorCallback: this.errorCallback || this.config.errorCallback, qrRole: this.config.qrRole, callbackServer: this.config.callbackServer, sessionTimeout: this.config.sessionTimeout, pollingFrequency: this.config.pollingFrequency, autorefresh: this.config.autorefresh, v2: this.config.v2, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
75
+ }
76
+ }
77
+ else {
78
+ if (this.config.useWs) {
79
+ this.qr = (h("gataca-qrws", { wsOnMessage: this.wsOnMessage || this.config.wsOnMessage, wsOnOpen: this.wsOnOpen || this.config.wsOnOpen, successCallback: this.successCallback || this.config.successCallback, errorCallback: this.errorCallback || this.config.errorCallback, qrRole: this.config.qrRole, callbackServer: this.config.callbackServer, sessionTimeout: this.config.sessionTimeout, socketEndpoint: this.config.socketEndpoint, autostart: this.config.autostart, autorefresh: this.config.autorefresh, v2: this.config.v2, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
80
+ }
81
+ else {
82
+ this.qr = (h("gataca-qr", { checkStatus: this.checkStatus || this.config.checkStatus, createSession: this.createSession || this.config.createSession, successCallback: this.successCallback || this.config.successCallback, errorCallback: this.errorCallback || this.config.errorCallback, qrRole: this.config.qrRole, callbackServer: this.config.callbackServer, sessionTimeout: this.config.sessionTimeout, pollingFrequency: this.config.pollingFrequency, autostart: this.config.autostart, autorefresh: this.config.autorefresh, v2: this.config.v2, qrModalTitle: this.config.qrModalTitle, qrModalDescription: this.config.qrModalDescription, hideBrandTitle: this.config.hideBrandTitle, dynamicLink: this.config.dynamicLink }));
83
+ }
84
+ }
85
+ }
86
+ render() {
87
+ if (this.loading) {
88
+ //TODO: Improve loading message
89
+ return h("div", null, "Loading...");
90
+ }
91
+ if (this.config) {
92
+ this.selectQR();
93
+ return this.qr;
94
+ }
95
+ //TODO: Improve error message
96
+ return h("div", null, "Error loading your config...");
97
+ }
98
+ };
99
+ GatacaAutoQR.style = gatacaAutoqrCss;
100
+
101
+ export { GatacaAutoQR as gataca_autoqr };