@blotoutio/providers-blotout-wallet-sdk 0.56.0 → 0.58.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
@@ -446,7 +446,7 @@ let BlotoutWallet = class BlotoutWallet extends s {
446
446
  try {
447
447
  await this.transitionTo('loading');
448
448
  if (email) {
449
- window.edgetag('user', 'email', email);
449
+ window.edgetag('user', 'email', email, {}, { destination: this.edgeURL });
450
450
  const response = await fetch(this.getUrl('/user/email'), {
451
451
  method: 'POST',
452
452
  body: JSON.stringify({
@@ -458,6 +458,7 @@ let BlotoutWallet = class BlotoutWallet extends s {
458
458
  throw new Error(`Could not save email ${response.status}: ${await response.text()}`);
459
459
  }
460
460
  this.dispatchEvent(new CustomEvent('blotout-wallet-email-saved', { bubbles: true }));
461
+ window.edgetag('tag', 'WalletEmailSaved', {}, {}, { destination: this.edgeURL });
461
462
  }
462
463
  if (this.lastExpiredCart) {
463
464
  await this.storeApi.addItems(this.lastExpiredCart.items);
@@ -480,6 +481,8 @@ let BlotoutWallet = class BlotoutWallet extends s {
480
481
  if (!response.ok) {
481
482
  throw new Error(`Could not update status in DB - ${response.status}: ${response.text}\n\n${await response.text()}`);
482
483
  }
484
+ // Send the request as beacon as there could be a immediate redirect in the next step
485
+ window.edgetag('tag', 'WalletCartRestored', {}, {}, { method: 'beacon' });
483
486
  // Redirect to custom path
484
487
  if (this.restoreRedirect) {
485
488
  try {
@@ -564,7 +567,7 @@ let BlotoutWallet = class BlotoutWallet extends s {
564
567
  this.restoredContent = () => {
565
568
  return x `
566
569
  ${cartTick({ class: 'icon' })}
567
- <div>Cart restored sucessfully!</div>
570
+ <div>Cart restored successfully!</div>
568
571
  `;
569
572
  };
570
573
  this.failedContent = () => {
@@ -625,6 +628,7 @@ let BlotoutWallet = class BlotoutWallet extends s {
625
628
  setTimeout(() => {
626
629
  this.showModal();
627
630
  }, 1000);
631
+ window.edgetag('tag', 'WalletCartExpiredOnVisit', {}, {}, { destination: this.edgeURL });
628
632
  }
629
633
  })
630
634
  .catch(logger.error);
@@ -670,6 +674,7 @@ let BlotoutWallet = class BlotoutWallet extends s {
670
674
  if (!response.ok) {
671
675
  throw new Error(`Could not mark cart as skipped - ${response.status}: ${await response.text()}`);
672
676
  }
677
+ window.edgetag('tag', 'WalletCartDeclined', {}, {}, { destination: this.edgeURL });
673
678
  this.lastExpiredCart = undefined;
674
679
  })
675
680
  .catch(logger.error);
@@ -863,6 +868,11 @@ const init = (params) => {
863
868
  }
864
869
  }
865
870
  if ((_c = params.manifest.variables) === null || _c === void 0 ? void 0 : _c['enabled']) {
871
+ // if the component is already defined, skip creating the element to avoid
872
+ // layering multiple widgets
873
+ if (window[registryKey].wallet) {
874
+ return;
875
+ }
866
876
  const element = (window[registryKey].wallet =
867
877
  document.createElement('blotout-wallet'));
868
878
  const theme = (_d = params.manifest.variables) === null || _d === void 0 ? void 0 : _d['theme'];
package/index.js CHANGED
@@ -447,7 +447,7 @@ var ProvidersBlotoutWalletSdk = (function () {
447
447
  try {
448
448
  await this.transitionTo('loading');
449
449
  if (email) {
450
- window.edgetag('user', 'email', email);
450
+ window.edgetag('user', 'email', email, {}, { destination: this.edgeURL });
451
451
  const response = await fetch(this.getUrl('/user/email'), {
452
452
  method: 'POST',
453
453
  body: JSON.stringify({
@@ -459,6 +459,7 @@ var ProvidersBlotoutWalletSdk = (function () {
459
459
  throw new Error(`Could not save email ${response.status}: ${await response.text()}`);
460
460
  }
461
461
  this.dispatchEvent(new CustomEvent('blotout-wallet-email-saved', { bubbles: true }));
462
+ window.edgetag('tag', 'WalletEmailSaved', {}, {}, { destination: this.edgeURL });
462
463
  }
463
464
  if (this.lastExpiredCart) {
464
465
  await this.storeApi.addItems(this.lastExpiredCart.items);
@@ -481,6 +482,8 @@ var ProvidersBlotoutWalletSdk = (function () {
481
482
  if (!response.ok) {
482
483
  throw new Error(`Could not update status in DB - ${response.status}: ${response.text}\n\n${await response.text()}`);
483
484
  }
485
+ // Send the request as beacon as there could be a immediate redirect in the next step
486
+ window.edgetag('tag', 'WalletCartRestored', {}, {}, { method: 'beacon' });
484
487
  // Redirect to custom path
485
488
  if (this.restoreRedirect) {
486
489
  try {
@@ -565,7 +568,7 @@ var ProvidersBlotoutWalletSdk = (function () {
565
568
  this.restoredContent = () => {
566
569
  return x `
567
570
  ${cartTick({ class: 'icon' })}
568
- <div>Cart restored sucessfully!</div>
571
+ <div>Cart restored successfully!</div>
569
572
  `;
570
573
  };
571
574
  this.failedContent = () => {
@@ -626,6 +629,7 @@ var ProvidersBlotoutWalletSdk = (function () {
626
629
  setTimeout(() => {
627
630
  this.showModal();
628
631
  }, 1000);
632
+ window.edgetag('tag', 'WalletCartExpiredOnVisit', {}, {}, { destination: this.edgeURL });
629
633
  }
630
634
  })
631
635
  .catch(logger.error);
@@ -671,6 +675,7 @@ var ProvidersBlotoutWalletSdk = (function () {
671
675
  if (!response.ok) {
672
676
  throw new Error(`Could not mark cart as skipped - ${response.status}: ${await response.text()}`);
673
677
  }
678
+ window.edgetag('tag', 'WalletCartDeclined', {}, {}, { destination: this.edgeURL });
674
679
  this.lastExpiredCart = undefined;
675
680
  })
676
681
  .catch(logger.error);
@@ -864,6 +869,11 @@ var ProvidersBlotoutWalletSdk = (function () {
864
869
  }
865
870
  }
866
871
  if ((_c = params.manifest.variables) === null || _c === void 0 ? void 0 : _c['enabled']) {
872
+ // if the component is already defined, skip creating the element to avoid
873
+ // layering multiple widgets
874
+ if (window[registryKey].wallet) {
875
+ return;
876
+ }
867
877
  const element = (window[registryKey].wallet =
868
878
  document.createElement('blotout-wallet'));
869
879
  const theme = (_d = params.manifest.variables) === null || _d === void 0 ? void 0 : _d['theme'];
package/index.mjs CHANGED
@@ -444,7 +444,7 @@ let BlotoutWallet = class BlotoutWallet extends s {
444
444
  try {
445
445
  await this.transitionTo('loading');
446
446
  if (email) {
447
- window.edgetag('user', 'email', email);
447
+ window.edgetag('user', 'email', email, {}, { destination: this.edgeURL });
448
448
  const response = await fetch(this.getUrl('/user/email'), {
449
449
  method: 'POST',
450
450
  body: JSON.stringify({
@@ -456,6 +456,7 @@ let BlotoutWallet = class BlotoutWallet extends s {
456
456
  throw new Error(`Could not save email ${response.status}: ${await response.text()}`);
457
457
  }
458
458
  this.dispatchEvent(new CustomEvent('blotout-wallet-email-saved', { bubbles: true }));
459
+ window.edgetag('tag', 'WalletEmailSaved', {}, {}, { destination: this.edgeURL });
459
460
  }
460
461
  if (this.lastExpiredCart) {
461
462
  await this.storeApi.addItems(this.lastExpiredCart.items);
@@ -478,6 +479,8 @@ let BlotoutWallet = class BlotoutWallet extends s {
478
479
  if (!response.ok) {
479
480
  throw new Error(`Could not update status in DB - ${response.status}: ${response.text}\n\n${await response.text()}`);
480
481
  }
482
+ // Send the request as beacon as there could be a immediate redirect in the next step
483
+ window.edgetag('tag', 'WalletCartRestored', {}, {}, { method: 'beacon' });
481
484
  // Redirect to custom path
482
485
  if (this.restoreRedirect) {
483
486
  try {
@@ -562,7 +565,7 @@ let BlotoutWallet = class BlotoutWallet extends s {
562
565
  this.restoredContent = () => {
563
566
  return x `
564
567
  ${cartTick({ class: 'icon' })}
565
- <div>Cart restored sucessfully!</div>
568
+ <div>Cart restored successfully!</div>
566
569
  `;
567
570
  };
568
571
  this.failedContent = () => {
@@ -623,6 +626,7 @@ let BlotoutWallet = class BlotoutWallet extends s {
623
626
  setTimeout(() => {
624
627
  this.showModal();
625
628
  }, 1000);
629
+ window.edgetag('tag', 'WalletCartExpiredOnVisit', {}, {}, { destination: this.edgeURL });
626
630
  }
627
631
  })
628
632
  .catch(logger.error);
@@ -668,6 +672,7 @@ let BlotoutWallet = class BlotoutWallet extends s {
668
672
  if (!response.ok) {
669
673
  throw new Error(`Could not mark cart as skipped - ${response.status}: ${await response.text()}`);
670
674
  }
675
+ window.edgetag('tag', 'WalletCartDeclined', {}, {}, { destination: this.edgeURL });
671
676
  this.lastExpiredCart = undefined;
672
677
  })
673
678
  .catch(logger.error);
@@ -861,6 +866,11 @@ const init = (params) => {
861
866
  }
862
867
  }
863
868
  if ((_c = params.manifest.variables) === null || _c === void 0 ? void 0 : _c['enabled']) {
869
+ // if the component is already defined, skip creating the element to avoid
870
+ // layering multiple widgets
871
+ if (window[registryKey].wallet) {
872
+ return;
873
+ }
864
874
  const element = (window[registryKey].wallet =
865
875
  document.createElement('blotout-wallet'));
866
876
  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.56.0",
3
+ "version": "0.58.0",
4
4
  "description": "Blotout Wallet SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",