@blotoutio/providers-blotout-wallet-sdk 0.47.2 → 0.49.0

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.
package/index.cjs.js CHANGED
@@ -73,12 +73,29 @@ const getCookieValue = (key) => {
73
73
  return '';
74
74
  }
75
75
  };
76
- const setCookie = (key, value) => {
76
+ const setCookie = (key, value, options) => {
77
+ var _a;
77
78
  try {
78
79
  if (!document) {
79
80
  return;
80
81
  }
81
- document.cookie = `${key}=${value};path=/`;
82
+ const extras = [`path=${(_a = options === null || options === void 0 ? void 0 : options.path) !== null && _a !== void 0 ? _a : '/'}`];
83
+ if (options === null || options === void 0 ? void 0 : options['maxAge']) {
84
+ extras.push(`max-age=${options['maxAge']}`);
85
+ }
86
+ if (options === null || options === void 0 ? void 0 : options.expires) {
87
+ extras.push(`expires=${options.expires}`);
88
+ }
89
+ if (options === null || options === void 0 ? void 0 : options.partitioned) {
90
+ extras.push('partitioned');
91
+ }
92
+ if (options === null || options === void 0 ? void 0 : options.samesite) {
93
+ extras.push(`samesite=${options.samesite}`);
94
+ }
95
+ if (options === null || options === void 0 ? void 0 : options.secure) {
96
+ extras.push('secure');
97
+ }
98
+ document.cookie = `${key}=${value};${extras.join(';')}`;
82
99
  }
83
100
  catch {
84
101
  return;
@@ -363,6 +380,10 @@ const fadeOutToBottom = (element) => {
363
380
  return Promise.all([dialogAnimation.finished, backdropAnimation.finished]);
364
381
  };
365
382
 
383
+ /**
384
+ * Sets the max-age for the dismissed popup cookie
385
+ */
386
+ const DISMISSED_COOKIE_LIFETIME = 1800;
366
387
  let BlotoutWallet = class BlotoutWallet extends s {
367
388
  constructor() {
368
389
  super(...arguments);
@@ -464,7 +485,7 @@ let BlotoutWallet = class BlotoutWallet extends s {
464
485
  return getCookieValue('isPopUpDismissed') === '1';
465
486
  }
466
487
  dismissPopUp() {
467
- setCookie('isPopUpDismissed', '1');
488
+ setCookie('isPopUpDismissed', '1', { maxAge: DISMISSED_COOKIE_LIFETIME });
468
489
  }
469
490
  connectedCallback() {
470
491
  super.connectedCallback();
@@ -718,7 +739,7 @@ const init = (params) => {
718
739
  throw new Error('Implementation for store API missing!');
719
740
  }
720
741
  }
721
- if ((_c = params.manifest.variables) === null || _c === void 0 ? void 0 : _c['enableUI']) {
742
+ if ((_c = params.manifest.variables) === null || _c === void 0 ? void 0 : _c['enabled']) {
722
743
  const element = (window[registryKey].wallet =
723
744
  document.createElement('blotout-wallet'));
724
745
  const theme = (_d = params.manifest.variables) === null || _d === void 0 ? void 0 : _d['theme'];
package/index.js CHANGED
@@ -74,12 +74,29 @@ var ProvidersBlotoutWalletSdk = (function () {
74
74
  return '';
75
75
  }
76
76
  };
77
- const setCookie = (key, value) => {
77
+ const setCookie = (key, value, options) => {
78
+ var _a;
78
79
  try {
79
80
  if (!document) {
80
81
  return;
81
82
  }
82
- document.cookie = `${key}=${value};path=/`;
83
+ const extras = [`path=${(_a = options === null || options === void 0 ? void 0 : options.path) !== null && _a !== void 0 ? _a : '/'}`];
84
+ if (options === null || options === void 0 ? void 0 : options['maxAge']) {
85
+ extras.push(`max-age=${options['maxAge']}`);
86
+ }
87
+ if (options === null || options === void 0 ? void 0 : options.expires) {
88
+ extras.push(`expires=${options.expires}`);
89
+ }
90
+ if (options === null || options === void 0 ? void 0 : options.partitioned) {
91
+ extras.push('partitioned');
92
+ }
93
+ if (options === null || options === void 0 ? void 0 : options.samesite) {
94
+ extras.push(`samesite=${options.samesite}`);
95
+ }
96
+ if (options === null || options === void 0 ? void 0 : options.secure) {
97
+ extras.push('secure');
98
+ }
99
+ document.cookie = `${key}=${value};${extras.join(';')}`;
83
100
  }
84
101
  catch {
85
102
  return;
@@ -364,6 +381,10 @@ var ProvidersBlotoutWalletSdk = (function () {
364
381
  return Promise.all([dialogAnimation.finished, backdropAnimation.finished]);
365
382
  };
366
383
 
384
+ /**
385
+ * Sets the max-age for the dismissed popup cookie
386
+ */
387
+ const DISMISSED_COOKIE_LIFETIME = 1800;
367
388
  let BlotoutWallet = class BlotoutWallet extends s {
368
389
  constructor() {
369
390
  super(...arguments);
@@ -465,7 +486,7 @@ var ProvidersBlotoutWalletSdk = (function () {
465
486
  return getCookieValue('isPopUpDismissed') === '1';
466
487
  }
467
488
  dismissPopUp() {
468
- setCookie('isPopUpDismissed', '1');
489
+ setCookie('isPopUpDismissed', '1', { maxAge: DISMISSED_COOKIE_LIFETIME });
469
490
  }
470
491
  connectedCallback() {
471
492
  super.connectedCallback();
@@ -719,7 +740,7 @@ var ProvidersBlotoutWalletSdk = (function () {
719
740
  throw new Error('Implementation for store API missing!');
720
741
  }
721
742
  }
722
- if ((_c = params.manifest.variables) === null || _c === void 0 ? void 0 : _c['enableUI']) {
743
+ if ((_c = params.manifest.variables) === null || _c === void 0 ? void 0 : _c['enabled']) {
723
744
  const element = (window[registryKey].wallet =
724
745
  document.createElement('blotout-wallet'));
725
746
  const theme = (_d = params.manifest.variables) === null || _d === void 0 ? void 0 : _d['theme'];
package/index.mjs CHANGED
@@ -71,12 +71,29 @@ const getCookieValue = (key) => {
71
71
  return '';
72
72
  }
73
73
  };
74
- const setCookie = (key, value) => {
74
+ const setCookie = (key, value, options) => {
75
+ var _a;
75
76
  try {
76
77
  if (!document) {
77
78
  return;
78
79
  }
79
- document.cookie = `${key}=${value};path=/`;
80
+ const extras = [`path=${(_a = options === null || options === void 0 ? void 0 : options.path) !== null && _a !== void 0 ? _a : '/'}`];
81
+ if (options === null || options === void 0 ? void 0 : options['maxAge']) {
82
+ extras.push(`max-age=${options['maxAge']}`);
83
+ }
84
+ if (options === null || options === void 0 ? void 0 : options.expires) {
85
+ extras.push(`expires=${options.expires}`);
86
+ }
87
+ if (options === null || options === void 0 ? void 0 : options.partitioned) {
88
+ extras.push('partitioned');
89
+ }
90
+ if (options === null || options === void 0 ? void 0 : options.samesite) {
91
+ extras.push(`samesite=${options.samesite}`);
92
+ }
93
+ if (options === null || options === void 0 ? void 0 : options.secure) {
94
+ extras.push('secure');
95
+ }
96
+ document.cookie = `${key}=${value};${extras.join(';')}`;
80
97
  }
81
98
  catch {
82
99
  return;
@@ -361,6 +378,10 @@ const fadeOutToBottom = (element) => {
361
378
  return Promise.all([dialogAnimation.finished, backdropAnimation.finished]);
362
379
  };
363
380
 
381
+ /**
382
+ * Sets the max-age for the dismissed popup cookie
383
+ */
384
+ const DISMISSED_COOKIE_LIFETIME = 1800;
364
385
  let BlotoutWallet = class BlotoutWallet extends s {
365
386
  constructor() {
366
387
  super(...arguments);
@@ -462,7 +483,7 @@ let BlotoutWallet = class BlotoutWallet extends s {
462
483
  return getCookieValue('isPopUpDismissed') === '1';
463
484
  }
464
485
  dismissPopUp() {
465
- setCookie('isPopUpDismissed', '1');
486
+ setCookie('isPopUpDismissed', '1', { maxAge: DISMISSED_COOKIE_LIFETIME });
466
487
  }
467
488
  connectedCallback() {
468
489
  super.connectedCallback();
@@ -716,7 +737,7 @@ const init = (params) => {
716
737
  throw new Error('Implementation for store API missing!');
717
738
  }
718
739
  }
719
- if ((_c = params.manifest.variables) === null || _c === void 0 ? void 0 : _c['enableUI']) {
740
+ if ((_c = params.manifest.variables) === null || _c === void 0 ? void 0 : _c['enabled']) {
720
741
  const element = (window[registryKey].wallet =
721
742
  document.createElement('blotout-wallet'));
722
743
  const theme = (_d = params.manifest.variables) === null || _d === void 0 ? void 0 : _d['theme'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/providers-blotout-wallet-sdk",
3
- "version": "0.47.2",
3
+ "version": "0.49.0",
4
4
  "description": "Blotout Wallet SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",