@blotoutio/providers-blotout-wallet-sdk 0.45.0 → 0.45.2

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
@@ -36,10 +36,9 @@ new Set([
36
36
 
37
37
  const packageName = 'blotoutWallet';
38
38
  const cartTokenCookie = 'cart';
39
+ const cartTokenTwoCookie = 'cart2';
39
40
  const cartCurrencyCookie = 'cart_currency';
40
41
 
41
- const init = () => { };
42
-
43
42
  const getCookieValue = (key) => {
44
43
  try {
45
44
  if (!document || !document.cookie) {
@@ -69,15 +68,21 @@ const registryKey = Symbol.for('blotout-wallet');
69
68
  (_a = window[registryKey]) !== null && _a !== void 0 ? _a : (window[registryKey] = {});
70
69
 
71
70
  // eslint-disable-next-line @nx/enforce-module-boundaries
72
- const tag = () => {
71
+ const tag = ({ eventName }) => {
73
72
  if (!window) {
74
73
  return;
75
74
  }
76
75
  const platform = window[registryKey].platform;
77
76
  switch (platform) {
78
77
  case 'SHOPIFY': {
79
- const cartToken = getCookieValue(cartTokenCookie);
78
+ let cartToken = getCookieValue(cartTokenCookie);
80
79
  const cartCurrency = getCookieValue(cartCurrencyCookie);
80
+ if (!cartToken) {
81
+ cartToken = getCookieValue(cartTokenTwoCookie);
82
+ }
83
+ if (eventName === 'Purchase') {
84
+ document.cookie = 'cart2=;path=/;Max-Age=0';
85
+ }
81
86
  return { platform, cartToken, cartCurrency };
82
87
  }
83
88
  default: {
@@ -89,7 +94,6 @@ const tag = () => {
89
94
  // eslint-disable-next-line @nx/enforce-module-boundaries
90
95
  const data = {
91
96
  name: packageName,
92
- init,
93
97
  tag,
94
98
  };
95
99
  try {
package/index.js CHANGED
@@ -37,10 +37,9 @@ var ProvidersBlotoutWalletSdk = (function () {
37
37
 
38
38
  const packageName = 'blotoutWallet';
39
39
  const cartTokenCookie = 'cart';
40
+ const cartTokenTwoCookie = 'cart2';
40
41
  const cartCurrencyCookie = 'cart_currency';
41
42
 
42
- const init = () => { };
43
-
44
43
  const getCookieValue = (key) => {
45
44
  try {
46
45
  if (!document || !document.cookie) {
@@ -70,15 +69,21 @@ var ProvidersBlotoutWalletSdk = (function () {
70
69
  (_a = window[registryKey]) !== null && _a !== void 0 ? _a : (window[registryKey] = {});
71
70
 
72
71
  // eslint-disable-next-line @nx/enforce-module-boundaries
73
- const tag = () => {
72
+ const tag = ({ eventName }) => {
74
73
  if (!window) {
75
74
  return;
76
75
  }
77
76
  const platform = window[registryKey].platform;
78
77
  switch (platform) {
79
78
  case 'SHOPIFY': {
80
- const cartToken = getCookieValue(cartTokenCookie);
79
+ let cartToken = getCookieValue(cartTokenCookie);
81
80
  const cartCurrency = getCookieValue(cartCurrencyCookie);
81
+ if (!cartToken) {
82
+ cartToken = getCookieValue(cartTokenTwoCookie);
83
+ }
84
+ if (eventName === 'Purchase') {
85
+ document.cookie = 'cart2=;path=/;Max-Age=0';
86
+ }
82
87
  return { platform, cartToken, cartCurrency };
83
88
  }
84
89
  default: {
@@ -90,7 +95,6 @@ var ProvidersBlotoutWalletSdk = (function () {
90
95
  // eslint-disable-next-line @nx/enforce-module-boundaries
91
96
  const data = {
92
97
  name: packageName,
93
- init,
94
98
  tag,
95
99
  };
96
100
  try {
package/index.mjs CHANGED
@@ -34,10 +34,9 @@ new Set([
34
34
 
35
35
  const packageName = 'blotoutWallet';
36
36
  const cartTokenCookie = 'cart';
37
+ const cartTokenTwoCookie = 'cart2';
37
38
  const cartCurrencyCookie = 'cart_currency';
38
39
 
39
- const init = () => { };
40
-
41
40
  const getCookieValue = (key) => {
42
41
  try {
43
42
  if (!document || !document.cookie) {
@@ -67,15 +66,21 @@ const registryKey = Symbol.for('blotout-wallet');
67
66
  (_a = window[registryKey]) !== null && _a !== void 0 ? _a : (window[registryKey] = {});
68
67
 
69
68
  // eslint-disable-next-line @nx/enforce-module-boundaries
70
- const tag = () => {
69
+ const tag = ({ eventName }) => {
71
70
  if (!window) {
72
71
  return;
73
72
  }
74
73
  const platform = window[registryKey].platform;
75
74
  switch (platform) {
76
75
  case 'SHOPIFY': {
77
- const cartToken = getCookieValue(cartTokenCookie);
76
+ let cartToken = getCookieValue(cartTokenCookie);
78
77
  const cartCurrency = getCookieValue(cartCurrencyCookie);
78
+ if (!cartToken) {
79
+ cartToken = getCookieValue(cartTokenTwoCookie);
80
+ }
81
+ if (eventName === 'Purchase') {
82
+ document.cookie = 'cart2=;path=/;Max-Age=0';
83
+ }
79
84
  return { platform, cartToken, cartCurrency };
80
85
  }
81
86
  default: {
@@ -87,7 +92,6 @@ const tag = () => {
87
92
  // eslint-disable-next-line @nx/enforce-module-boundaries
88
93
  const data = {
89
94
  name: packageName,
90
- init,
91
95
  tag,
92
96
  };
93
97
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/providers-blotout-wallet-sdk",
3
- "version": "0.45.0",
3
+ "version": "0.45.2",
4
4
  "description": "Blotout Wallet SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",