@gataca/qr 3.0.10 → 3.0.11

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 (65) hide show
  1. package/dist/cjs/gataca-autoqr.cjs.entry.js +9 -9
  2. package/dist/cjs/gataca-qr_2.cjs.entry.js +36 -46
  3. package/dist/cjs/gataca-qrws.cjs.entry.js +35 -42
  4. package/dist/cjs/gataca-ssibutton_2.cjs.entry.js +34 -38
  5. package/dist/cjs/index.cjs.js +1 -1
  6. package/dist/cjs/{utils-ef28b844.js → utils-b4e62bc0.js} +1 -1
  7. package/dist/collection/components/gataca-autoqr/gataca-autoqr.js +13 -13
  8. package/dist/collection/components/gataca-qr/components/qr/QR.js +2 -2
  9. package/dist/collection/components/gataca-qr/components/readQR/ReadQR.js +4 -4
  10. package/dist/collection/components/gataca-qr/components/readQR/components/AnimatedLoader.js +1 -1
  11. package/dist/collection/components/gataca-qr/components/retryButton/RetryButton.js +8 -8
  12. package/dist/collection/components/gataca-qr/components/success/Success.js +4 -4
  13. package/dist/collection/components/gataca-qr/gataca-qr.js +45 -55
  14. package/dist/collection/components/gataca-qrdisplay/gataca-qrdisplay.js +12 -12
  15. package/dist/collection/components/gataca-qrws/components/qr/QR.js +2 -2
  16. package/dist/collection/components/gataca-qrws/components/readQR/ReadQR.js +4 -4
  17. package/dist/collection/components/gataca-qrws/components/readQR/components/AnimatedLoader.js +1 -1
  18. package/dist/collection/components/gataca-qrws/components/retryButton/RetryButton.js +8 -8
  19. package/dist/collection/components/gataca-qrws/components/success/Success.js +4 -4
  20. package/dist/collection/components/gataca-qrws/gataca-qrws.js +49 -56
  21. package/dist/collection/components/gataca-ssibutton/gataca-ssibutton.js +62 -52
  22. package/dist/collection/components/gataca-ssibuttonws/gataca-ssibuttonws.js +12 -12
  23. package/dist/collection/index.js +2 -2
  24. package/dist/collection/utils/index.js +1 -1
  25. package/dist/collection/utils/utils.js +1 -1
  26. package/dist/components/gat-icon-alert.js +1 -1
  27. package/dist/components/gataca-autoqr.js +9 -9
  28. package/dist/components/gataca-qr2.js +28 -38
  29. package/dist/components/gataca-qrdisplay2.js +7 -7
  30. package/dist/components/gataca-qrws2.js +34 -41
  31. package/dist/components/gataca-ssibutton2.js +27 -31
  32. package/dist/components/gataca-ssibuttonws2.js +6 -6
  33. package/dist/esm/gataca-autoqr.entry.js +9 -9
  34. package/dist/esm/gataca-qr_2.entry.js +36 -46
  35. package/dist/esm/gataca-qrws.entry.js +35 -42
  36. package/dist/esm/gataca-ssibutton_2.entry.js +34 -38
  37. package/dist/esm/index.js +1 -1
  38. package/dist/esm/{utils-63e7a33b.js → utils-21ffcc1e.js} +1 -1
  39. package/dist/gatacaqr/gatacaqr.esm.js +1 -1
  40. package/dist/gatacaqr/index.esm.js +1 -1
  41. package/dist/gatacaqr/{p-3500ae66.entry.js → p-2adc0bcc.entry.js} +1 -1
  42. package/dist/gatacaqr/p-2ddbc2fc.entry.js +1 -0
  43. package/dist/gatacaqr/{p-68272823.entry.js → p-d2dd7c85.entry.js} +1 -1
  44. package/dist/types/components/gataca-autoqr/gataca-autoqr.d.ts +7 -7
  45. package/dist/types/components/gataca-qr/components/qr/QR.d.ts +2 -2
  46. package/dist/types/components/gataca-qr/components/readQR/ReadQR.d.ts +1 -1
  47. package/dist/types/components/gataca-qr/components/readQR/components/AnimatedLoader.d.ts +1 -1
  48. package/dist/types/components/gataca-qr/components/retryButton/RetryButton.d.ts +1 -1
  49. package/dist/types/components/gataca-qr/components/success/Success.d.ts +1 -1
  50. package/dist/types/components/gataca-qr/gataca-qr.d.ts +4 -4
  51. package/dist/types/components/gataca-qrdisplay/gataca-qrdisplay.d.ts +1 -1
  52. package/dist/types/components/gataca-qrws/components/qr/QR.d.ts +2 -2
  53. package/dist/types/components/gataca-qrws/components/readQR/ReadQR.d.ts +1 -1
  54. package/dist/types/components/gataca-qrws/components/readQR/components/AnimatedLoader.d.ts +1 -1
  55. package/dist/types/components/gataca-qrws/components/retryButton/RetryButton.d.ts +1 -1
  56. package/dist/types/components/gataca-qrws/components/success/Success.d.ts +1 -1
  57. package/dist/types/components/gataca-qrws/gataca-qrws.d.ts +4 -4
  58. package/dist/types/components/gataca-ssibutton/gataca-ssibutton.d.ts +9 -5
  59. package/dist/types/components/gataca-ssibuttonws/gataca-ssibuttonws.d.ts +3 -3
  60. package/dist/types/components.d.ts +28 -36
  61. package/dist/types/index.d.ts +2 -2
  62. package/dist/types/utils/index.d.ts +1 -1
  63. package/package.json +30 -7
  64. package/dist/gatacaqr/p-92a2e6f0.entry.js +0 -1
  65. /package/dist/gatacaqr/{p-2cd7b062.js → p-bce7e590.js} +0 -0
@@ -1,16 +1,16 @@
1
- import { h, } from "@stencil/core";
2
- import logoGataca from "../../assets/images/logo_gataca.svg";
3
- import "../gataca-qrdisplay/gataca-qrdisplay";
4
- import { base64UrlEncode, checkMobile, RESULT_STATUS, } from "../../utils/utils";
5
- import { Success } from "./components/success/Success";
6
- import { RetryButton } from "./components/retryButton/RetryButton";
7
- import { QR } from "./components/qr/QR";
8
- import { ReadQR } from "./components/readQR/ReadQR";
9
- const DEEP_LINK_PREFIX = "https://api.gataca.io/qr/redirect.html";
1
+ import { h } from '@stencil/core';
2
+ import logoGataca from '../../assets/images/logo_gataca.svg';
3
+ import '../gataca-qrdisplay/gataca-qrdisplay';
4
+ import { base64UrlEncode, checkMobile, RESULT_STATUS } from '../../utils/utils';
5
+ import { Success } from './components/success/Success';
6
+ import { RetryButton } from './components/retryButton/RetryButton';
7
+ import { QR } from './components/qr/QR';
8
+ import { ReadQR } from './components/readQR/ReadQR';
9
+ const DEEP_LINK_PREFIX = 'https://api.gataca.io/qr/redirect.html';
10
10
  const DEFAULT_SESSION_TIMEOUT = 300;
11
- const QR_ROLE_CONNECT = "connect";
11
+ const QR_ROLE_CONNECT = 'connect';
12
12
  export class GatacaQRWS {
13
- constructor() { this.successCallback = undefined; this.errorCallback = undefined; this.qrRole = undefined; this.qrType = "svg"; this.callbackServer = undefined; this.socketEndpoint = undefined; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT; this.wsOnOpen = undefined; this.wsOnMessage = undefined; this.autostart = true; this.autorefresh = false; this.v = "3"; this.qrModalTitle = "Quick Access"; this.modalTitleColor = "#4745B7"; this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet"; this.hideModalTexts = false; this.hideModalBoxShadow = false; this.hideBrandTitle = false; this.logoSize = 0; this.logoSrc = logoGataca; this.qrSize = 300; this.modalWidth = 300; this.modalHeight = undefined; this.qrCodeExpiredLabel = "QR Code expired"; this.credentialsNotValidatedLabel = "User credentials not validated"; this.clickInsideBoxLabel = "Click inside the box to"; this.refreshQrLabel = "Refresh QR Code"; this.scanQrLabel = "Scan QR Code"; this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time"; this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated"; this.failedLoginErrorLabel = "No successful login"; this.successLoginLabel = "Successful Connection!"; this.byBrandLabel = "by Gataca"; this.waitingStartSessionLabel = "waiting to start a session"; this.readQrTitle = "Processing..."; this.readQrDescription = "Please wait a moment"; this.hideQrModalDescription = false; this.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = RESULT_STATUS.NOT_STARTED; }
13
+ constructor() { this.successCallback = undefined; this.errorCallback = undefined; this.qrRole = undefined; this.qrType = 'svg'; this.callbackServer = undefined; this.socketEndpoint = undefined; this.sessionTimeout = DEFAULT_SESSION_TIMEOUT; this.wsOnOpen = undefined; this.wsOnMessage = undefined; this.autostart = true; this.autorefresh = false; this.v = '3'; this.qrModalTitle = 'Quick Access'; this.modalTitleColor = '#4745B7'; this.qrModalDescription = 'Sign up or sign in by scanning the QR Code with the Gataca Wallet'; this.hideModalTexts = false; this.hideModalBoxShadow = false; this.hideBrandTitle = false; this.logoSize = 0; this.logoSrc = logoGataca; this.qrSize = 300; this.modalWidth = 300; this.modalHeight = undefined; this.qrCodeExpiredLabel = 'QR Code expired'; this.credentialsNotValidatedLabel = 'User credentials not validated'; this.clickInsideBoxLabel = 'Click inside the box to'; this.refreshQrLabel = 'Refresh QR Code'; this.scanQrLabel = 'Scan QR Code'; this.userNotScanInTimeErrorLabel = 'User did not scan the QR in the allowed time'; this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated"; this.failedLoginErrorLabel = 'No successful login'; this.successLoginLabel = 'Successful Connection!'; this.byBrandLabel = 'by Gataca'; this.waitingStartSessionLabel = 'waiting to start a session'; this.readQrTitle = 'Processing...'; this.readQrDescription = 'Please wait a moment'; this.hideQrModalDescription = false; this.dynamicLink = true; this.sessionId = undefined; this.authenticationRequest = undefined; this.sessionData = undefined; this.result = RESULT_STATUS.NOT_STARTED; }
14
14
  disconnectedCallback() {
15
15
  this.stop();
16
16
  }
@@ -25,7 +25,7 @@ export class GatacaQRWS {
25
25
  async display() {
26
26
  let socket = new WebSocket(this.socketEndpoint);
27
27
  setTimeout(() => {
28
- this.socket.close(1000, "");
28
+ this.socket.close(1000, '');
29
29
  }, 1000 * this.sessionTimeout);
30
30
  this.socket = socket;
31
31
  socket.onopen = () => {
@@ -44,11 +44,11 @@ export class GatacaQRWS {
44
44
  }
45
45
  };
46
46
  socket.onerror = () => {
47
- let error = new Error("Error connecting with server");
47
+ let error = new Error('Error connecting with server');
48
48
  this.result = RESULT_STATUS.FAILED;
49
49
  this.gatacaLoginFailed.emit(error);
50
50
  this.errorCallback(error);
51
- socket.close(1000, "");
51
+ socket.close(1000, '');
52
52
  };
53
53
  socket.onclose = () => {
54
54
  if (this.result === RESULT_STATUS.ONGOING || RESULT_STATUS.READ) {
@@ -59,7 +59,7 @@ export class GatacaQRWS {
59
59
  this.display();
60
60
  }
61
61
  else {
62
- let error = new Error("User did not scan the QR in the alloted time");
62
+ let error = new Error('User did not scan the QR in the alloted time');
63
63
  this.gatacaLoginFailed.emit(error);
64
64
  this.errorCallback(error);
65
65
  }
@@ -85,7 +85,7 @@ export class GatacaQRWS {
85
85
  this.sessionData = wsresp.authenticatedUserData;
86
86
  this.gatacaLoginCompleted.emit(wsresp.authenticatedUserData);
87
87
  this.successCallback(wsresp.authenticatedUserData);
88
- this.socket.close(1000, "");
88
+ this.socket.close(1000, '');
89
89
  break;
90
90
  case RESULT_STATUS.FAILED:
91
91
  this.socket.close();
@@ -99,7 +99,7 @@ export class GatacaQRWS {
99
99
  this.display();
100
100
  }
101
101
  else {
102
- let error = new Error("User did not scan the QR in the alloted time");
102
+ let error = new Error('User did not scan the QR in the alloted time');
103
103
  this.gatacaLoginFailed.emit(error);
104
104
  this.errorCallback(error);
105
105
  }
@@ -111,21 +111,19 @@ export class GatacaQRWS {
111
111
  async stop() {
112
112
  this.sessionData = undefined;
113
113
  this.sessionId = undefined;
114
- this.socket.close(1000, "Client stopped the connection");
114
+ this.socket.close(1000, 'Client stopped the connection');
115
115
  }
116
116
  /**
117
117
  * Retrieve manually the session data on a successful login
118
118
  */
119
119
  async getSessionData() {
120
- return this.sessionData
121
- ? Promise.resolve(this.sessionData)
122
- : Promise.reject(new Error("No successful login"));
120
+ return this.sessionData ? Promise.resolve(this.sessionData) : Promise.reject(new Error('No successful login'));
123
121
  }
124
122
  getLink() {
125
- if (this.v === "2" && this.qrRole == QR_ROLE_CONNECT) {
123
+ if (this.v === '2' && this.qrRole == QR_ROLE_CONNECT) {
126
124
  return this.authenticationRequest;
127
125
  }
128
- const authRequestEncoded = "?dl=" + base64UrlEncode(this.authenticationRequest);
126
+ const authRequestEncoded = '?dl=' + base64UrlEncode(this.authenticationRequest);
129
127
  return DEEP_LINK_PREFIX + authRequestEncoded;
130
128
  }
131
129
  renderQRSection() {
@@ -143,40 +141,35 @@ export class GatacaQRWS {
143
141
  case RESULT_STATUS.READ:
144
142
  return this.renderReadQR({
145
143
  title: this === null || this === void 0 ? void 0 : this.readQrTitle,
146
- description: this === null || this === void 0 ? void 0 : this.readQrDescription,
144
+ description: this === null || this === void 0 ? void 0 : this.readQrDescription
147
145
  });
148
146
  }
149
147
  }
150
148
  renderSuccess() {
151
- return (h(Success, { modalHeight: this === null || this === void 0 ? void 0 : this.modalHeight, successLoginLabel: this === null || this === void 0 ? void 0 : this.successLoginLabel }));
149
+ return h(Success, { modalHeight: this === null || this === void 0 ? void 0 : this.modalHeight, successLoginLabel: this === null || this === void 0 ? void 0 : this.successLoginLabel });
152
150
  }
153
151
  renderRetryButton(errorMessage) {
154
152
  return (h(RetryButton, { errorMessage: errorMessage, modalWidth: this === null || this === void 0 ? void 0 : this.modalWidth, clickInsideBoxLabel: this === null || this === void 0 ? void 0 : this.clickInsideBoxLabel, refreshQrLabel: this === null || this === void 0 ? void 0 : this.refreshQrLabel, scanQrLabel: this === null || this === void 0 ? void 0 : this.scanQrLabel, waitingStartSessionLabel: this === null || this === void 0 ? void 0 : this.waitingStartSessionLabel, display: this.display.bind(this), renderRetryQR: this.renderRetryQR.bind(this) }));
155
153
  }
156
154
  renderReadQR(readQrMessages) {
157
- return (h(ReadQR, { modalWidth: this === null || this === void 0 ? void 0 : this.modalWidth, readQrMessages: readQrMessages, url: this.getLink(), sizeQR: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, renderQR: this.renderQR.bind(this) }));
155
+ return h(ReadQR, { modalWidth: this === null || this === void 0 ? void 0 : this.modalWidth, readQrMessages: readQrMessages, url: this.getLink(), sizeQR: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, renderQR: this.renderQR.bind(this) });
158
156
  }
159
157
  renderQR(value, useLogo, sizeQR) {
160
- return (h(QR, { value: value, qrType: this.qrType, useLogo: useLogo && this.logoSize !== 0, size: sizeQR || (this === null || this === void 0 ? void 0 : this.qrSize) || undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc }));
158
+ return h(QR, { value: value, qrType: this.qrType, useLogo: useLogo && this.logoSize !== 0, size: sizeQR || (this === null || this === void 0 ? void 0 : this.qrSize) || undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc });
161
159
  }
162
160
  renderRetryQR(value, useLogo) {
163
- return (h(QR, { value: value, qrType: this.qrType, useLogo: useLogo && this.logoSize !== 0, size: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc }));
161
+ return h(QR, { value: value, qrType: this.qrType, useLogo: useLogo && this.logoSize !== 0, size: (this === null || this === void 0 ? void 0 : this.qrSize) ? (this === null || this === void 0 ? void 0 : this.qrSize) - 50 : undefined, logoSrc: this === null || this === void 0 ? void 0 : this.logoSrc });
164
162
  }
165
163
  render() {
166
164
  var _a, _b;
167
- return (h("div", { class: "popUpContainer" }, h("div", { class: `is-visible modal-window ${this.hideModalTexts ? "" : "large-modal"} ${this.hideModalBoxShadow ? "noBoxShadow" : ""}`, style: {
168
- width: (this.modalWidth - 2).toString() + "px",
169
- height: this.modalHeight
170
- ? ((_a = (this.modalHeight - 2)) === null || _a === void 0 ? void 0 : _a.toString()) + "px"
171
- : "",
165
+ return (h("div", { class: "popUpContainer" }, h("div", { class: `is-visible modal-window ${this.hideModalTexts ? '' : 'large-modal'} ${this.hideModalBoxShadow ? 'noBoxShadow' : ''}`, style: {
166
+ width: (this.modalWidth - 2).toString() + 'px',
167
+ height: this.modalHeight ? ((_a = (this.modalHeight - 2)) === null || _a === void 0 ? void 0 : _a.toString()) + 'px' : ''
172
168
  }, onClick: (event) => {
173
169
  event.stopPropagation();
174
- } }, h("div", { class: "modal-window__content" }, h("div", { class: `qrTitleContainer ${this.hideModalTexts ? "hidenText" : ""}` }, h("p", { class: "qrTitle modalText", style: { color: this.modalTitleColor || "#1e1e20" } }, this.qrModalTitle), !this.hideBrandTitle && (h("p", { class: "qrBrand modalText" }, this.byBrandLabel, " ", h("span", null, h("img", { src: logoGataca })))), this.result !== RESULT_STATUS.SUCCESS &&
175
- !this.hideQrModalDescription && (h("p", { class: "qrDescription modalText" }, this.qrModalDescription))), h("div", { class: "qrSection", style: {
176
- width: this.modalWidth.toString() + "px",
177
- height: this.modalWidth
178
- ? ((_b = this.modalWidth) === null || _b === void 0 ? void 0 : _b.toString()) + "px"
179
- : "",
170
+ } }, h("div", { class: "modal-window__content" }, h("div", { class: `qrTitleContainer ${this.hideModalTexts ? 'hidenText' : ''}` }, h("p", { class: "qrTitle modalText", style: { color: this.modalTitleColor || '#1e1e20' } }, this.qrModalTitle), !this.hideBrandTitle && (h("p", { class: "qrBrand modalText" }, this.byBrandLabel, ' ', h("span", null, h("img", { src: logoGataca })))), this.result !== RESULT_STATUS.SUCCESS && !this.hideQrModalDescription && h("p", { class: "qrDescription modalText" }, this.qrModalDescription)), h("div", { class: "qrSection", style: {
171
+ width: this.modalWidth.toString() + 'px',
172
+ height: this.modalWidth ? ((_b = this.modalWidth) === null || _b === void 0 ? void 0 : _b.toString()) + 'px' : ''
180
173
  } }, this.renderQRSection())))));
181
174
  }
182
175
  static get is() { return "gataca-qrws"; }
@@ -267,7 +260,7 @@ export class GatacaQRWS {
267
260
  },
268
261
  "attribute": "qr-type",
269
262
  "reflect": false,
270
- "defaultValue": "\"svg\""
263
+ "defaultValue": "'svg'"
271
264
  },
272
265
  "callbackServer": {
273
266
  "type": "string",
@@ -414,7 +407,7 @@ export class GatacaQRWS {
414
407
  },
415
408
  "attribute": "v",
416
409
  "reflect": false,
417
- "defaultValue": "\"3\""
410
+ "defaultValue": "'3'"
418
411
  },
419
412
  "qrModalTitle": {
420
413
  "type": "string",
@@ -432,7 +425,7 @@ export class GatacaQRWS {
432
425
  },
433
426
  "attribute": "qr-modal-title",
434
427
  "reflect": false,
435
- "defaultValue": "\"Quick Access\""
428
+ "defaultValue": "'Quick Access'"
436
429
  },
437
430
  "modalTitleColor": {
438
431
  "type": "string",
@@ -450,7 +443,7 @@ export class GatacaQRWS {
450
443
  },
451
444
  "attribute": "modal-title-color",
452
445
  "reflect": false,
453
- "defaultValue": "\"#4745B7\""
446
+ "defaultValue": "'#4745B7'"
454
447
  },
455
448
  "qrModalDescription": {
456
449
  "type": "string",
@@ -468,7 +461,7 @@ export class GatacaQRWS {
468
461
  },
469
462
  "attribute": "qr-modal-description",
470
463
  "reflect": false,
471
- "defaultValue": "\"Sign up or sign in by scanning the QR Code with the Gataca Wallet\""
464
+ "defaultValue": "'Sign up or sign in by scanning the QR Code with the Gataca Wallet'"
472
465
  },
473
466
  "hideModalTexts": {
474
467
  "type": "boolean",
@@ -629,7 +622,7 @@ export class GatacaQRWS {
629
622
  },
630
623
  "attribute": "qr-code-expired-label",
631
624
  "reflect": false,
632
- "defaultValue": "\"QR Code expired\""
625
+ "defaultValue": "'QR Code expired'"
633
626
  },
634
627
  "credentialsNotValidatedLabel": {
635
628
  "type": "string",
@@ -647,7 +640,7 @@ export class GatacaQRWS {
647
640
  },
648
641
  "attribute": "credentials-not-validated-label",
649
642
  "reflect": false,
650
- "defaultValue": "\"User credentials not validated\""
643
+ "defaultValue": "'User credentials not validated'"
651
644
  },
652
645
  "clickInsideBoxLabel": {
653
646
  "type": "string",
@@ -665,7 +658,7 @@ export class GatacaQRWS {
665
658
  },
666
659
  "attribute": "click-inside-box-label",
667
660
  "reflect": false,
668
- "defaultValue": "\"Click inside the box to\""
661
+ "defaultValue": "'Click inside the box to'"
669
662
  },
670
663
  "refreshQrLabel": {
671
664
  "type": "string",
@@ -683,7 +676,7 @@ export class GatacaQRWS {
683
676
  },
684
677
  "attribute": "refresh-qr-label",
685
678
  "reflect": false,
686
- "defaultValue": "\"Refresh QR Code\""
679
+ "defaultValue": "'Refresh QR Code'"
687
680
  },
688
681
  "scanQrLabel": {
689
682
  "type": "string",
@@ -701,7 +694,7 @@ export class GatacaQRWS {
701
694
  },
702
695
  "attribute": "scan-qr-label",
703
696
  "reflect": false,
704
- "defaultValue": "\"Scan QR Code\""
697
+ "defaultValue": "'Scan QR Code'"
705
698
  },
706
699
  "userNotScanInTimeErrorLabel": {
707
700
  "type": "string",
@@ -719,7 +712,7 @@ export class GatacaQRWS {
719
712
  },
720
713
  "attribute": "user-not-scan-in-time-error-label",
721
714
  "reflect": false,
722
- "defaultValue": "\"User did not scan the QR in the allowed time\""
715
+ "defaultValue": "'User did not scan the QR in the allowed time'"
723
716
  },
724
717
  "credsNotValidatedErrorLabel": {
725
718
  "type": "string",
@@ -755,7 +748,7 @@ export class GatacaQRWS {
755
748
  },
756
749
  "attribute": "failed-login-error-label",
757
750
  "reflect": false,
758
- "defaultValue": "\"No successful login\""
751
+ "defaultValue": "'No successful login'"
759
752
  },
760
753
  "successLoginLabel": {
761
754
  "type": "string",
@@ -773,7 +766,7 @@ export class GatacaQRWS {
773
766
  },
774
767
  "attribute": "success-login-label",
775
768
  "reflect": false,
776
- "defaultValue": "\"Successful Connection!\""
769
+ "defaultValue": "'Successful Connection!'"
777
770
  },
778
771
  "byBrandLabel": {
779
772
  "type": "string",
@@ -791,7 +784,7 @@ export class GatacaQRWS {
791
784
  },
792
785
  "attribute": "by-brand-label",
793
786
  "reflect": false,
794
- "defaultValue": "\"by Gataca\""
787
+ "defaultValue": "'by Gataca'"
795
788
  },
796
789
  "waitingStartSessionLabel": {
797
790
  "type": "string",
@@ -809,7 +802,7 @@ export class GatacaQRWS {
809
802
  },
810
803
  "attribute": "waiting-start-session-label",
811
804
  "reflect": false,
812
- "defaultValue": "\"waiting to start a session\""
805
+ "defaultValue": "'waiting to start a session'"
813
806
  },
814
807
  "readQrTitle": {
815
808
  "type": "string",
@@ -827,7 +820,7 @@ export class GatacaQRWS {
827
820
  },
828
821
  "attribute": "read-qr-title",
829
822
  "reflect": false,
830
- "defaultValue": "\"Processing...\""
823
+ "defaultValue": "'Processing...'"
831
824
  },
832
825
  "readQrDescription": {
833
826
  "type": "string",
@@ -845,7 +838,7 @@ export class GatacaQRWS {
845
838
  },
846
839
  "attribute": "read-qr-description",
847
840
  "reflect": false,
848
- "defaultValue": "\"Please wait a moment\""
841
+ "defaultValue": "'Please wait a moment'"
849
842
  },
850
843
  "hideQrModalDescription": {
851
844
  "type": "boolean",
@@ -1,14 +1,14 @@
1
- import { h, } from "@stencil/core";
2
- import "../gataca-qrdisplay/gataca-qrdisplay";
3
- import { RESULT_STATUS } from "../../utils/utils";
4
- const PHONE_ICON = "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=";
1
+ import { h } from '@stencil/core';
2
+ import '../gataca-qrdisplay/gataca-qrdisplay';
3
+ import { RESULT_STATUS } from '../../utils/utils';
4
+ const PHONE_ICON = '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=';
5
5
  //Default values
6
6
  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.buttonText = "Easy login";
11
- this.qrType = "svg";
10
+ this.buttonText = 'Easy login';
11
+ this.qrType = 'svg';
12
12
  this.autostart = true;
13
13
  this.checkStatus = undefined;
14
14
  this.createSession = undefined;
@@ -21,25 +21,25 @@ export class GatacaSSIButton {
21
21
  this.sessionTimeout = undefined;
22
22
  this.pollingFrequency = undefined;
23
23
  this.autorefresh = false;
24
- this.v = "3";
25
- this.qrModalTitle = "Quick Access";
26
- this.modalTitleColor = "#4745B7";
27
- this.qrModalDescription = "Sign up or sign in by scanning the QR Code with the Gataca Wallet";
24
+ this.v = '3';
25
+ this.qrModalTitle = 'Quick Access';
26
+ this.modalTitleColor = '#4745B7';
27
+ this.qrModalDescription = 'Sign up or sign in by scanning the QR Code with the Gataca Wallet';
28
28
  this.hideBrandTitle = false;
29
29
  this.dynamicLink = true;
30
30
  this.logoSize = 0;
31
31
  this.logoSrc = undefined;
32
- this.qrCodeExpiredLabel = "QR Code expired";
33
- this.credentialsNotValidatedLabel = "User credentials not validated";
34
- this.clickInsideBoxLabel = "Click inside the box to";
35
- this.refreshQrLabel = "Refresh QR Code";
36
- this.scanQrLabel = "Scan QR Code";
37
- this.userNotScanInTimeErrorLabel = "User did not scan the QR in the allowed time";
32
+ this.qrCodeExpiredLabel = 'QR Code expired';
33
+ this.credentialsNotValidatedLabel = 'User credentials not validated';
34
+ this.clickInsideBoxLabel = 'Click inside the box to';
35
+ this.refreshQrLabel = 'Refresh QR Code';
36
+ this.scanQrLabel = 'Scan QR Code';
37
+ this.userNotScanInTimeErrorLabel = 'User did not scan the QR in the allowed time';
38
38
  this.credsNotValidatedErrorLabel = "Provided user credentials couldn't be validated";
39
- this.failedLoginErrorLabel = "No successful login";
40
- this.successLoginLabel = "Successful Connection!";
41
- this.byBrandLabel = "by Gataca";
42
- this.waitingStartSessionLabel = "waiting to start a session";
39
+ this.failedLoginErrorLabel = 'No successful login';
40
+ this.successLoginLabel = 'Successful Connection!';
41
+ this.byBrandLabel = 'by Gataca';
42
+ this.waitingStartSessionLabel = 'waiting to start a session';
43
43
  this.hideQrModalDescription = false;
44
44
  this.open = false;
45
45
  this.sessionId = undefined;
@@ -84,9 +84,7 @@ export class GatacaSSIButton {
84
84
  }
85
85
  else {
86
86
  if (err !== RESULT_STATUS.NOT_STARTED) {
87
- let error = expired
88
- ? new Error(this.userNotScanInTimeErrorLabel)
89
- : new Error(this.credsNotValidatedErrorLabel);
87
+ let error = expired ? new Error(this.userNotScanInTimeErrorLabel) : new Error(this.credsNotValidatedErrorLabel);
90
88
  this.result = err;
91
89
  this.gatacaLoginFailed.emit(error);
92
90
  this.errorCallback(error);
@@ -111,8 +109,7 @@ export class GatacaSSIButton {
111
109
  return this.qr;
112
110
  }
113
111
  async poll() {
114
- let endTime = new Date().getTime() +
115
- (this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
112
+ let endTime = new Date().getTime() + (this.sessionTimeout || DEFAULT_SESSION_TIMEOUT) * 1000;
116
113
  let interval = (this.pollingFrequency || DEFAULT_POLLING_FREQ) * 1000;
117
114
  let checkFunc = async (component) => {
118
115
  if (component.result === RESULT_STATUS.NOT_STARTED) {
@@ -169,10 +166,10 @@ export class GatacaSSIButton {
169
166
  cleanup();
170
167
  }
171
168
  };
172
- document.addEventListener("visibilitychange", handleVisibilityChange);
169
+ document.addEventListener('visibilitychange', handleVisibilityChange);
173
170
  function cleanup() {
174
171
  clearTimeout(timeout);
175
- document.removeEventListener("visibilitychange", handleVisibilityChange);
172
+ document.removeEventListener('visibilitychange', handleVisibilityChange);
176
173
  }
177
174
  }
178
175
  renderDesktopButton() {
@@ -206,8 +203,8 @@ export class GatacaSSIButton {
206
203
  };
207
204
  const executeRedirection = async () => {
208
205
  handleLoading(true);
209
- const androidStoreLink = "https://play.google.com/store/apps/details?id=com.gataca.identity";
210
- const iosStoreLink = "https://apps.apple.com/us/app/gataca/id1498607616";
206
+ const androidStoreLink = 'https://play.google.com/store/apps/details?id=com.gataca.identity';
207
+ const iosStoreLink = 'https://apps.apple.com/us/app/gataca/id1498607616';
211
208
  try {
212
209
  const appScheme = await this.getAuthRequest();
213
210
  this.isAppInstalled(appScheme, (installed) => {
@@ -229,6 +226,7 @@ export class GatacaSSIButton {
229
226
  }
230
227
  };
231
228
  return (h("div", { class: "gatacaButtonWrapper" }, h("button", { class: "gatacaButton", onClick: () => {
229
+ this.gatacaButtonPushed.emit();
232
230
  executeRedirection();
233
231
  }, disabled: loading }, h("img", { src: PHONE_ICON, class: "buttonImg", alt: this.buttonText }), h("span", null, this.buttonText))));
234
232
  }
@@ -239,12 +237,9 @@ export class GatacaSSIButton {
239
237
  const isAndroid = /android/i.test(userAgent);
240
238
  const isIos =
241
239
  // @ts-ignore
242
- (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) ||
243
- (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
240
+ (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
244
241
  const isMobile = isAndroid || isIos;
245
- return (h("div", { class: "buttonContainer" }, isMobile && this.v === "3"
246
- ? this.renderMobileButton(isAndroid, isIos)
247
- : this.renderDesktopButton(), this.open && (!isMobile || this.v === "3") && this.renderModal()));
242
+ return (h("div", { class: "buttonContainer" }, isMobile && this.v === '3' ? this.renderMobileButton(isAndroid, isIos) : this.renderDesktopButton(), this.open && (!isMobile || this.v === '3') && this.renderModal()));
248
243
  }
249
244
  static get is() { return "gataca-ssibutton"; }
250
245
  static get encapsulation() { return "shadow"; }
@@ -276,7 +271,7 @@ export class GatacaSSIButton {
276
271
  },
277
272
  "attribute": "button-text",
278
273
  "reflect": false,
279
- "defaultValue": "\"Easy login\""
274
+ "defaultValue": "'Easy login'"
280
275
  },
281
276
  "qrType": {
282
277
  "type": "string",
@@ -299,7 +294,7 @@ export class GatacaSSIButton {
299
294
  },
300
295
  "attribute": "qr-type",
301
296
  "reflect": false,
302
- "defaultValue": "\"svg\""
297
+ "defaultValue": "'svg'"
303
298
  },
304
299
  "autostart": {
305
300
  "type": "boolean",
@@ -323,7 +318,7 @@ export class GatacaSSIButton {
323
318
  "type": "unknown",
324
319
  "mutable": false,
325
320
  "complexType": {
326
- "original": "(\n id?: string\n ) => Promise<{ result: RESULT_STATUS; data?: any }>",
321
+ "original": "(id?: string) => Promise<{result: RESULT_STATUS; data?: any}>",
327
322
  "resolved": "(id?: string) => Promise<{ result: RESULT_STATUS; data?: any; }>",
328
323
  "references": {
329
324
  "Promise": {
@@ -347,7 +342,7 @@ export class GatacaSSIButton {
347
342
  "type": "unknown",
348
343
  "mutable": false,
349
344
  "complexType": {
350
- "original": "() => Promise<{\n sessionId: string;\n authenticationRequest?: string;\n }>",
345
+ "original": "() => Promise<{\n sessionId: string;\n authenticationRequest?: string;\n }>",
351
346
  "resolved": "() => Promise<{ sessionId: string; authenticationRequest?: string; }>",
352
347
  "references": {
353
348
  "Promise": {
@@ -535,7 +530,7 @@ export class GatacaSSIButton {
535
530
  },
536
531
  "attribute": "v",
537
532
  "reflect": false,
538
- "defaultValue": "\"3\""
533
+ "defaultValue": "'3'"
539
534
  },
540
535
  "qrModalTitle": {
541
536
  "type": "string",
@@ -553,7 +548,7 @@ export class GatacaSSIButton {
553
548
  },
554
549
  "attribute": "qr-modal-title",
555
550
  "reflect": false,
556
- "defaultValue": "\"Quick Access\""
551
+ "defaultValue": "'Quick Access'"
557
552
  },
558
553
  "modalTitleColor": {
559
554
  "type": "string",
@@ -571,7 +566,7 @@ export class GatacaSSIButton {
571
566
  },
572
567
  "attribute": "modal-title-color",
573
568
  "reflect": false,
574
- "defaultValue": "\"#4745B7\""
569
+ "defaultValue": "'#4745B7'"
575
570
  },
576
571
  "qrModalDescription": {
577
572
  "type": "string",
@@ -589,7 +584,7 @@ export class GatacaSSIButton {
589
584
  },
590
585
  "attribute": "qr-modal-description",
591
586
  "reflect": false,
592
- "defaultValue": "\"Sign up or sign in by scanning the QR Code with the Gataca Wallet\""
587
+ "defaultValue": "'Sign up or sign in by scanning the QR Code with the Gataca Wallet'"
593
588
  },
594
589
  "hideBrandTitle": {
595
590
  "type": "boolean",
@@ -678,7 +673,7 @@ export class GatacaSSIButton {
678
673
  },
679
674
  "attribute": "qr-code-expired-label",
680
675
  "reflect": false,
681
- "defaultValue": "\"QR Code expired\""
676
+ "defaultValue": "'QR Code expired'"
682
677
  },
683
678
  "credentialsNotValidatedLabel": {
684
679
  "type": "string",
@@ -696,7 +691,7 @@ export class GatacaSSIButton {
696
691
  },
697
692
  "attribute": "credentials-not-validated-label",
698
693
  "reflect": false,
699
- "defaultValue": "\"User credentials not validated\""
694
+ "defaultValue": "'User credentials not validated'"
700
695
  },
701
696
  "clickInsideBoxLabel": {
702
697
  "type": "string",
@@ -714,7 +709,7 @@ export class GatacaSSIButton {
714
709
  },
715
710
  "attribute": "click-inside-box-label",
716
711
  "reflect": false,
717
- "defaultValue": "\"Click inside the box to\""
712
+ "defaultValue": "'Click inside the box to'"
718
713
  },
719
714
  "refreshQrLabel": {
720
715
  "type": "string",
@@ -732,7 +727,7 @@ export class GatacaSSIButton {
732
727
  },
733
728
  "attribute": "refresh-qr-label",
734
729
  "reflect": false,
735
- "defaultValue": "\"Refresh QR Code\""
730
+ "defaultValue": "'Refresh QR Code'"
736
731
  },
737
732
  "scanQrLabel": {
738
733
  "type": "string",
@@ -750,7 +745,7 @@ export class GatacaSSIButton {
750
745
  },
751
746
  "attribute": "scan-qr-label",
752
747
  "reflect": false,
753
- "defaultValue": "\"Scan QR Code\""
748
+ "defaultValue": "'Scan QR Code'"
754
749
  },
755
750
  "userNotScanInTimeErrorLabel": {
756
751
  "type": "string",
@@ -768,7 +763,7 @@ export class GatacaSSIButton {
768
763
  },
769
764
  "attribute": "user-not-scan-in-time-error-label",
770
765
  "reflect": false,
771
- "defaultValue": "\"User did not scan the QR in the allowed time\""
766
+ "defaultValue": "'User did not scan the QR in the allowed time'"
772
767
  },
773
768
  "credsNotValidatedErrorLabel": {
774
769
  "type": "string",
@@ -804,7 +799,7 @@ export class GatacaSSIButton {
804
799
  },
805
800
  "attribute": "failed-login-error-label",
806
801
  "reflect": false,
807
- "defaultValue": "\"No successful login\""
802
+ "defaultValue": "'No successful login'"
808
803
  },
809
804
  "successLoginLabel": {
810
805
  "type": "string",
@@ -822,7 +817,7 @@ export class GatacaSSIButton {
822
817
  },
823
818
  "attribute": "success-login-label",
824
819
  "reflect": false,
825
- "defaultValue": "\"Successful Connection!\""
820
+ "defaultValue": "'Successful Connection!'"
826
821
  },
827
822
  "byBrandLabel": {
828
823
  "type": "string",
@@ -840,7 +835,7 @@ export class GatacaSSIButton {
840
835
  },
841
836
  "attribute": "by-brand-label",
842
837
  "reflect": false,
843
- "defaultValue": "\"by Gataca\""
838
+ "defaultValue": "'by Gataca'"
844
839
  },
845
840
  "waitingStartSessionLabel": {
846
841
  "type": "string",
@@ -858,7 +853,7 @@ export class GatacaSSIButton {
858
853
  },
859
854
  "attribute": "waiting-start-session-label",
860
855
  "reflect": false,
861
- "defaultValue": "\"waiting to start a session\""
856
+ "defaultValue": "'waiting to start a session'"
862
857
  },
863
858
  "hideQrModalDescription": {
864
859
  "type": "boolean",
@@ -920,6 +915,21 @@ export class GatacaSSIButton {
920
915
  "resolved": "any",
921
916
  "references": {}
922
917
  }
918
+ }, {
919
+ "method": "gatacaButtonPushed",
920
+ "name": "gatacaButtonPushed",
921
+ "bubbles": true,
922
+ "cancelable": true,
923
+ "composed": true,
924
+ "docs": {
925
+ "tags": [],
926
+ "text": "GatacaLoginCompleted event, triggered with session data upon login success"
927
+ },
928
+ "complexType": {
929
+ "original": "any",
930
+ "resolved": "any",
931
+ "references": {}
932
+ }
923
933
  }];
924
934
  }
925
935
  static get methods() {