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

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,7 +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';
41
+ const checkoutCookie = 'checkout_session_lookup';
40
42
 
41
43
  const init = () => { };
42
44
 
@@ -70,14 +72,30 @@ const registryKey = Symbol.for('blotout-wallet');
70
72
 
71
73
  // eslint-disable-next-line @nx/enforce-module-boundaries
72
74
  const tag = () => {
75
+ var _a;
73
76
  if (!window) {
74
77
  return;
75
78
  }
76
79
  const platform = window[registryKey].platform;
77
80
  switch (platform) {
78
81
  case 'SHOPIFY': {
79
- const cartToken = getCookieValue(cartTokenCookie);
82
+ let cartToken = getCookieValue(cartTokenCookie);
80
83
  const cartCurrency = getCookieValue(cartCurrencyCookie);
84
+ if (!cartToken) {
85
+ cartToken = getCookieValue(cartTokenTwoCookie);
86
+ }
87
+ if (!cartToken) {
88
+ const checkoutSession = getCookieValue(checkoutCookie);
89
+ try {
90
+ const checkout = JSON.parse(checkoutSession);
91
+ if (((_a = checkout === null || checkout === void 0 ? void 0 : checkout.keys) === null || _a === void 0 ? void 0 : _a.length) > 0) {
92
+ cartToken = checkout.keys[checkout.keys.length - 1].source_id;
93
+ }
94
+ }
95
+ catch {
96
+ // do nothing
97
+ }
98
+ }
81
99
  return { platform, cartToken, cartCurrency };
82
100
  }
83
101
  default: {
package/index.js CHANGED
@@ -37,7 +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';
42
+ const checkoutCookie = 'checkout_session_lookup';
41
43
 
42
44
  const init = () => { };
43
45
 
@@ -71,14 +73,30 @@ var ProvidersBlotoutWalletSdk = (function () {
71
73
 
72
74
  // eslint-disable-next-line @nx/enforce-module-boundaries
73
75
  const tag = () => {
76
+ var _a;
74
77
  if (!window) {
75
78
  return;
76
79
  }
77
80
  const platform = window[registryKey].platform;
78
81
  switch (platform) {
79
82
  case 'SHOPIFY': {
80
- const cartToken = getCookieValue(cartTokenCookie);
83
+ let cartToken = getCookieValue(cartTokenCookie);
81
84
  const cartCurrency = getCookieValue(cartCurrencyCookie);
85
+ if (!cartToken) {
86
+ cartToken = getCookieValue(cartTokenTwoCookie);
87
+ }
88
+ if (!cartToken) {
89
+ const checkoutSession = getCookieValue(checkoutCookie);
90
+ try {
91
+ const checkout = JSON.parse(checkoutSession);
92
+ if (((_a = checkout === null || checkout === void 0 ? void 0 : checkout.keys) === null || _a === void 0 ? void 0 : _a.length) > 0) {
93
+ cartToken = checkout.keys[checkout.keys.length - 1].source_id;
94
+ }
95
+ }
96
+ catch {
97
+ // do nothing
98
+ }
99
+ }
82
100
  return { platform, cartToken, cartCurrency };
83
101
  }
84
102
  default: {
package/index.mjs CHANGED
@@ -34,7 +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';
39
+ const checkoutCookie = 'checkout_session_lookup';
38
40
 
39
41
  const init = () => { };
40
42
 
@@ -68,14 +70,30 @@ const registryKey = Symbol.for('blotout-wallet');
68
70
 
69
71
  // eslint-disable-next-line @nx/enforce-module-boundaries
70
72
  const tag = () => {
73
+ var _a;
71
74
  if (!window) {
72
75
  return;
73
76
  }
74
77
  const platform = window[registryKey].platform;
75
78
  switch (platform) {
76
79
  case 'SHOPIFY': {
77
- const cartToken = getCookieValue(cartTokenCookie);
80
+ let cartToken = getCookieValue(cartTokenCookie);
78
81
  const cartCurrency = getCookieValue(cartCurrencyCookie);
82
+ if (!cartToken) {
83
+ cartToken = getCookieValue(cartTokenTwoCookie);
84
+ }
85
+ if (!cartToken) {
86
+ const checkoutSession = getCookieValue(checkoutCookie);
87
+ try {
88
+ const checkout = JSON.parse(checkoutSession);
89
+ if (((_a = checkout === null || checkout === void 0 ? void 0 : checkout.keys) === null || _a === void 0 ? void 0 : _a.length) > 0) {
90
+ cartToken = checkout.keys[checkout.keys.length - 1].source_id;
91
+ }
92
+ }
93
+ catch {
94
+ // do nothing
95
+ }
96
+ }
79
97
  return { platform, cartToken, cartCurrency };
80
98
  }
81
99
  default: {
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.1",
4
4
  "description": "Blotout Wallet SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",