@oila/0account 3.5.2 → 3.5.3

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.
@@ -6,7 +6,7 @@ const index = require('./index-ef57218a.js');
6
6
 
7
7
  const defineCustomElements = (win, options) => {
8
8
  if (typeof window === 'undefined') return undefined;
9
- return index.bootstrapLazy([["qr-code_2.cjs",[[1,"zero-account",{"appId":[1,"app-id"],"updateInterval":[2,"update-interval"],"callbackURL":[1,"callback-url"],"modal":[4],"level":[1],"primaryColor":[1,"primary-color"],"secondaryColor":[1,"secondary-color"],"environment":[1],"enableWithCredentials":[4,"enable-with-credentials"],"themePreset":[1,"theme-preset"],"autoStartApp":[4,"auto-start-app"],"modalOpen":[32],"isAnimating":[32],"url":[32]},[[4,"0account-toggle-modal","toggleModal"],[4,"0account-close-modal","_closeModal"],[4,"0account-authenticated","_closeModal"],[4,"0account-logout","logout"],[4,"0account-open-app","openApp"]]],[0,"qr-code",{"url":[1],"level":[1],"class":[1],"color":[1]}]]]], options);
9
+ return index.bootstrapLazy([["qr-code_2.cjs",[[1,"zero-account",{"appId":[1,"app-id"],"updateInterval":[2,"update-interval"],"callbackURL":[1,"callback-url"],"level":[1],"environment":[1],"enableWithCredentials":[4,"enable-with-credentials"],"themePreset":[1,"theme-preset"],"autoStartApp":[4,"auto-start-app"],"modalOpen":[32],"isAnimating":[32],"url":[32]},[[4,"0account-toggle-modal","toggleModal"],[4,"0account-close-modal","_closeModal"],[4,"0account-authenticated","_closeModal"],[4,"0account-logout","logout"],[4,"0account-open-app","openApp"]]],[0,"qr-code",{"url":[1],"level":[1],"class":[1],"color":[1]}]]]], options);
10
10
  };
11
11
 
12
12
  exports.setNonce = index.setNonce;
@@ -1254,10 +1254,10 @@ const zeroAuthenticated = '0account-authenticated';
1254
1254
  // const zeroAuthenticationFailed = '0account-authentication-failed';
1255
1255
  function debounce(func, timeout = 300) {
1256
1256
  let timer;
1257
- return (...args) => {
1257
+ return () => {
1258
1258
  clearTimeout(timer);
1259
1259
  timer = setTimeout(() => {
1260
- func.apply(this, args);
1260
+ func();
1261
1261
  }, timeout);
1262
1262
  };
1263
1263
  }
@@ -1341,7 +1341,7 @@ class WS {
1341
1341
  }
1342
1342
  send(action, data) {
1343
1343
  if (!this.socket || !this.socket.readyState || this.socket.readyState !== WebSocket.OPEN) {
1344
- const retry = debounce(this.send.bind(this), 1000);
1344
+ const retry = debounce(this.send.bind(this, action, data), 1000);
1345
1345
  return retry();
1346
1346
  }
1347
1347
  const msg = {
@@ -1447,10 +1447,7 @@ const ZeroAccount = class {
1447
1447
  this.appId = undefined;
1448
1448
  this.updateInterval = 3 * 60 * 1000;
1449
1449
  this.callbackURL = DEFAULT_CALLBACK_URL;
1450
- this.modal = true;
1451
1450
  this.level = ErrorCorrectionLevel.M;
1452
- this.primaryColor = '#3C444F';
1453
- this.secondaryColor = undefined;
1454
1451
  this.environment = Environment.production;
1455
1452
  this.enableWithCredentials = false;
1456
1453
  this.themePreset = ThemePreset.light;
@@ -1484,16 +1481,14 @@ const ZeroAccount = class {
1484
1481
  this._closeModal();
1485
1482
  }
1486
1483
  openApp() {
1487
- if (this.modalOpen) {
1488
- this.refreshQR(true);
1489
- window.location.href = this.url;
1490
- }
1484
+ this.refreshQR(true);
1485
+ window.location.assign(this.url);
1491
1486
  }
1492
1487
  render() {
1493
1488
  const logoColor = this.themePreset === ThemePreset.light ? '#7263FA' : '#FFFFF9';
1494
1489
  const qrColor = '#000';
1495
- return (index.h(index.Host, { key: '16e012816a541ac508e2c7e4bfb2c86ec5e12139' }, index.h("slot", { key: 'f843c7ca9d61291c0e789ea57f7f205ff426fbb5' }), this.host.childNodes.length === 0 &&
1496
- index.h("button", { class: `button ${this.themePreset}`, onClick: () => this.toggleModal() }, index.h(Logo, { className: 'button__logo', color: logoColor }), "use 0account"), index.h("div", { key: '3a97849bd767edbd569ebd9e18d0dcd1adc0d5d2', ref: el => this.modalEl = el, onClick: (e) => this.closeModal(e), class: `modal ${this.themePreset} ${this.isAnimating ? 'modal-animated' : ''} ${this.modalOpen ? '' : 'modal--hidden'}` }, index.h("div", { key: 'b26ba193432193a6157c52be76fa3b15129760e2', class: 'modal__content' }, index.h("div", { key: '5586291e6cc5717aac240bfb9bef3b7e38240ff5', ref: el => this.closeButtonEl = el, class: 'modal__close-button' }), index.h("div", { key: '77edd32e4e29b902b20c4dbd60e348efe8c0f521', class: 'modal__qrcode__container' }, index.h("qr-code", { key: 'f0fa7b6c4ef4db32c579bf20da52bd9fef5b30cb', url: this.url, class: `modal__qrcode`, level: this.level, color: qrColor }), index.h("div", { key: '4ed77c6bfe8b90fe3907c869e54b3dfaf06f221f', class: 'circle__overlay' }, index.h("div", { key: '2d866ad14e0d42bb00f24ad572823c55413c5ffd', class: 'circle' }), index.h("div", { key: '8f29661b6d0626054dfa1d9a918666e939e0980c', class: 'circle circle--medium' }), index.h("div", { key: 'a6d5be1ba18df35063a49a4af0c64a1ca9bbe22d', class: 'circle circle--large' })), index.h(Logo, { key: '7f252c9b4df9660ad7bb21141ca2de02687056e8', className: 'modal__logo', color: logoColor })), index.h("div", { key: '69230e62468944142e4bd99ead185ee20af20b6f', class: 'modal__buttons' }, index.h("button", { key: '4d03821841d9262f3774011abee30b8a85e460eb', disabled: this.isAnimating, onClick: () => this.openApp(), class: 'modal__button' }, "Open 0account"), index.h("a", { key: 'd6e6313b40eefd3dce8a9097a298f9464eb0a86e', href: 'https://0account.com/downloads', class: 'modal__link' }, "Download"))))));
1490
+ return (index.h(index.Host, { key: 'd040d1baf982d80122894d74cb3c6a1006ad55d2' }, index.h("slot", { key: '4ef5cf8eb17120f75a55f4156b6aa35b8b606a2f' }), this.host.childNodes.length === 0 &&
1491
+ index.h("button", { class: `button ${this.themePreset}`, onClick: () => this.toggleModal() }, index.h(Logo, { className: 'button__logo', color: logoColor }), "use 0account"), index.h("div", { key: 'ef6940947a74ee650607e784a29bf688de571d6f', ref: el => this.modalEl = el, onClick: (e) => this.closeModal(e), class: `modal ${this.themePreset} ${this.isAnimating ? 'modal-animated' : ''} ${this.modalOpen ? '' : 'modal--hidden'}` }, index.h("div", { key: 'e04280fa23b3472e866b5c4245ef5b1158f6ffe4', class: 'modal__content' }, index.h("div", { key: 'faf17215389285c8694038495df5268168229e91', ref: el => this.closeButtonEl = el, class: 'modal__close-button' }), index.h("div", { key: 'e5f42d45b8f18a4301f511c9ea4c83ceb298f072', class: 'modal__qrcode__container' }, index.h("qr-code", { key: '37175c2f97073d2c98093265e765d1dd80a2df7b', url: this.url, class: `modal__qrcode`, level: this.level, color: qrColor }), index.h("div", { key: 'bdf8e52beac917b311791da030c60aef2c21bbc9', class: 'circle__overlay' }, index.h("div", { key: 'cd9d96ff07fe1564739caa9a46021abb86519415', class: 'circle' }), index.h("div", { key: 'a707a2f44968790acaf34aa756e6ac9e5bf6ab10', class: 'circle circle--medium' }), index.h("div", { key: '9d89f75b0099596a09465dc46b99a7c20a7b0265', class: 'circle circle--large' })), index.h(Logo, { key: '99f112786915ad6bc0c15e4167d284f3ee0de6a0', className: 'modal__logo', color: logoColor })), index.h("div", { key: '8189e5b4f00076e6918fa7c988e0931ea8ad53ce', class: 'modal__buttons' }, index.h("button", { key: '4d2abae182bef662107ae3408c3d5d3e11b6ce46', disabled: this.isAnimating, onClick: () => this.openApp(), class: 'modal__button' }, "Open 0account"), index.h("a", { key: '9419f987ec6a438a1b9cf27cded8b0f9e5cdadd6', href: 'https://0account.com/downloads', class: 'modal__link' }, "Download"))))));
1497
1492
  }
1498
1493
  initServices() {
1499
1494
  if (this.logger && this.uaParser && this.ws)