@blotoutio/providers-trybe-sdk 1.76.3 → 1.77.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.
Files changed (4) hide show
  1. package/index.cjs.js +67 -23
  2. package/index.js +67 -23
  3. package/index.mjs +67 -23
  4. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -1,6 +1,47 @@
1
1
  'use strict';
2
2
 
3
3
  const packageName = 'trybe';
4
+ /**
5
+ * Returns the Trybe visitor-ID cookie name for a given store ID.
6
+ * The Trybe pixel sets a cookie named `ugc_vid_{storeId}` in the browser.
7
+ */
8
+ const vidCookieKey = (storeId) => `ugc_vid_${storeId}`;
9
+
10
+ const getCookieValue = (key) => {
11
+ var _a;
12
+ try {
13
+ if (!document || !document.cookie) {
14
+ return '';
15
+ }
16
+ const cookies = parseCookies(document.cookie);
17
+ return (_a = cookies[key]) !== null && _a !== void 0 ? _a : '';
18
+ }
19
+ catch {
20
+ return '';
21
+ }
22
+ };
23
+ const parseCookies = (cookie) => {
24
+ return Object.fromEntries(cookie
25
+ .split(/;\s+/)
26
+ .map((r) => r.split('=').map((str) => str.trim()))
27
+ .map(([cookieKey, ...cookieValues]) => {
28
+ const cookieValue = cookieValues.join('=');
29
+ if (!cookieKey) {
30
+ return [];
31
+ }
32
+ let decodedValue = '';
33
+ if (cookieValue) {
34
+ try {
35
+ decodedValue = decodeURIComponent(cookieValue);
36
+ }
37
+ catch (e) {
38
+ console.log(`Unable to decode cookie ${cookieKey}: ${e}`);
39
+ decodedValue = cookieValue;
40
+ }
41
+ }
42
+ return [cookieKey, decodedValue];
43
+ }));
44
+ };
4
45
 
5
46
  const canLog = () => {
6
47
  try {
@@ -35,7 +76,7 @@ const logger = {
35
76
  };
36
77
 
37
78
  const tag = ({ eventName, data, manifestVariables }) => {
38
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
79
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
39
80
  try {
40
81
  if (!(window === null || window === void 0 ? void 0 : window._trybe)) {
41
82
  return {};
@@ -49,7 +90,10 @@ const tag = ({ eventName, data, manifestVariables }) => {
49
90
  return {};
50
91
  }
51
92
  const d = (data !== null && data !== void 0 ? data : {});
52
- const vid = window._trybe.vid;
93
+ // The pixel keeps the visitor ID in the ugc_vid_{storeId} cookie
94
+ const storeId = (_b = manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['storeId']) !== null && _b !== void 0 ? _b : '';
95
+ const vid = window._trybe.vid ||
96
+ (storeId ? getCookieValue(vidCookieKey(storeId)) : '');
53
97
  if (!vid) {
54
98
  return {};
55
99
  }
@@ -58,14 +102,14 @@ const tag = ({ eventName, data, manifestVariables }) => {
58
102
  const item = Array.isArray(d['contents'])
59
103
  ? d['contents'][0]
60
104
  : null;
61
- (_c = (_b = window._trybe).trackProductViewed) === null || _c === void 0 ? void 0 : _c.call(_b, {
105
+ (_d = (_c = window._trybe).trackProductViewed) === null || _d === void 0 ? void 0 : _d.call(_c, {
62
106
  vid,
63
- productId: String((_e = (_d = item === null || item === void 0 ? void 0 : item['id']) !== null && _d !== void 0 ? _d : d['productId']) !== null && _e !== void 0 ? _e : ''),
64
- productName: String((_g = (_f = item === null || item === void 0 ? void 0 : item['title']) !== null && _f !== void 0 ? _f : d['productName']) !== null && _g !== void 0 ? _g : ''),
65
- price: Number((_j = (_h = item === null || item === void 0 ? void 0 : item['item_price']) !== null && _h !== void 0 ? _h : d['price']) !== null && _j !== void 0 ? _j : 0),
66
- currency: String((_k = d['currency']) !== null && _k !== void 0 ? _k : 'USD'),
67
- productUrl: String((_l = d['productUrl']) !== null && _l !== void 0 ? _l : window.location.href),
68
- imageUrl: String((_o = (_m = item === null || item === void 0 ? void 0 : item['imageUrl']) !== null && _m !== void 0 ? _m : d['imageUrl']) !== null && _o !== void 0 ? _o : ''),
107
+ productId: String((_f = (_e = item === null || item === void 0 ? void 0 : item['id']) !== null && _e !== void 0 ? _e : d['productId']) !== null && _f !== void 0 ? _f : ''),
108
+ productName: String((_h = (_g = item === null || item === void 0 ? void 0 : item['title']) !== null && _g !== void 0 ? _g : d['productName']) !== null && _h !== void 0 ? _h : ''),
109
+ price: Number((_k = (_j = item === null || item === void 0 ? void 0 : item['item_price']) !== null && _j !== void 0 ? _j : d['price']) !== null && _k !== void 0 ? _k : 0),
110
+ currency: String((_l = d['currency']) !== null && _l !== void 0 ? _l : 'USD'),
111
+ productUrl: String((_m = d['productUrl']) !== null && _m !== void 0 ? _m : window.location.href),
112
+ imageUrl: String((_p = (_o = item === null || item === void 0 ? void 0 : item['imageUrl']) !== null && _o !== void 0 ? _o : d['imageUrl']) !== null && _p !== void 0 ? _p : ''),
69
113
  });
70
114
  break;
71
115
  }
@@ -73,13 +117,13 @@ const tag = ({ eventName, data, manifestVariables }) => {
73
117
  const item = Array.isArray(d['contents'])
74
118
  ? d['contents'][0]
75
119
  : null;
76
- (_q = (_p = window._trybe).trackAddToCart) === null || _q === void 0 ? void 0 : _q.call(_p, {
120
+ (_r = (_q = window._trybe).trackAddToCart) === null || _r === void 0 ? void 0 : _r.call(_q, {
77
121
  vid,
78
- productId: String((_s = (_r = item === null || item === void 0 ? void 0 : item['id']) !== null && _r !== void 0 ? _r : d['productId']) !== null && _s !== void 0 ? _s : ''),
79
- productName: String((_u = (_t = item === null || item === void 0 ? void 0 : item['title']) !== null && _t !== void 0 ? _t : d['productName']) !== null && _u !== void 0 ? _u : ''),
80
- quantity: Number((_w = (_v = item === null || item === void 0 ? void 0 : item['quantity']) !== null && _v !== void 0 ? _v : d['quantity']) !== null && _w !== void 0 ? _w : 1),
81
- price: Number((_y = (_x = item === null || item === void 0 ? void 0 : item['item_price']) !== null && _x !== void 0 ? _x : d['price']) !== null && _y !== void 0 ? _y : 0),
82
- currency: String((_z = d['currency']) !== null && _z !== void 0 ? _z : 'USD'),
122
+ productId: String((_t = (_s = item === null || item === void 0 ? void 0 : item['id']) !== null && _s !== void 0 ? _s : d['productId']) !== null && _t !== void 0 ? _t : ''),
123
+ productName: String((_v = (_u = item === null || item === void 0 ? void 0 : item['title']) !== null && _u !== void 0 ? _u : d['productName']) !== null && _v !== void 0 ? _v : ''),
124
+ quantity: Number((_x = (_w = item === null || item === void 0 ? void 0 : item['quantity']) !== null && _w !== void 0 ? _w : d['quantity']) !== null && _x !== void 0 ? _x : 1),
125
+ price: Number((_z = (_y = item === null || item === void 0 ? void 0 : item['item_price']) !== null && _y !== void 0 ? _y : d['price']) !== null && _z !== void 0 ? _z : 0),
126
+ currency: String((_0 = d['currency']) !== null && _0 !== void 0 ? _0 : 'USD'),
83
127
  });
84
128
  break;
85
129
  }
@@ -87,20 +131,20 @@ const tag = ({ eventName, data, manifestVariables }) => {
87
131
  const contents = Array.isArray(d['contents'])
88
132
  ? d['contents']
89
133
  : [];
90
- (_1 = (_0 = window._trybe).trackCheckoutStarted) === null || _1 === void 0 ? void 0 : _1.call(_0, {
134
+ (_2 = (_1 = window._trybe).trackCheckoutStarted) === null || _2 === void 0 ? void 0 : _2.call(_1, {
91
135
  vid,
92
- cartValue: Number((_2 = d['value']) !== null && _2 !== void 0 ? _2 : 0),
93
- currency: String((_3 = d['currency']) !== null && _3 !== void 0 ? _3 : 'USD'),
94
- itemCount: contents.length || Number((_4 = d['itemCount']) !== null && _4 !== void 0 ? _4 : 0),
136
+ cartValue: Number((_3 = d['value']) !== null && _3 !== void 0 ? _3 : 0),
137
+ currency: String((_4 = d['currency']) !== null && _4 !== void 0 ? _4 : 'USD'),
138
+ itemCount: contents.length || Number((_5 = d['itemCount']) !== null && _5 !== void 0 ? _5 : 0),
95
139
  });
96
140
  break;
97
141
  }
98
142
  case 'Purchase': {
99
- (_6 = (_5 = window._trybe).trackCheckoutCompleted) === null || _6 === void 0 ? void 0 : _6.call(_5, {
143
+ (_7 = (_6 = window._trybe).trackCheckoutCompleted) === null || _7 === void 0 ? void 0 : _7.call(_6, {
100
144
  vid,
101
- orderId: String((_7 = d['orderId']) !== null && _7 !== void 0 ? _7 : ''),
102
- orderValue: Number((_8 = d['value']) !== null && _8 !== void 0 ? _8 : 0),
103
- currency: String((_9 = d['currency']) !== null && _9 !== void 0 ? _9 : 'USD'),
145
+ orderId: String((_8 = d['orderId']) !== null && _8 !== void 0 ? _8 : ''),
146
+ orderValue: Number((_9 = d['value']) !== null && _9 !== void 0 ? _9 : 0),
147
+ currency: String((_10 = d['currency']) !== null && _10 !== void 0 ? _10 : 'USD'),
104
148
  });
105
149
  break;
106
150
  }
package/index.js CHANGED
@@ -2,6 +2,47 @@ var ProvidersTrybeSdk = (function () {
2
2
  'use strict';
3
3
 
4
4
  const packageName = 'trybe';
5
+ /**
6
+ * Returns the Trybe visitor-ID cookie name for a given store ID.
7
+ * The Trybe pixel sets a cookie named `ugc_vid_{storeId}` in the browser.
8
+ */
9
+ const vidCookieKey = (storeId) => `ugc_vid_${storeId}`;
10
+
11
+ const getCookieValue = (key) => {
12
+ var _a;
13
+ try {
14
+ if (!document || !document.cookie) {
15
+ return '';
16
+ }
17
+ const cookies = parseCookies(document.cookie);
18
+ return (_a = cookies[key]) !== null && _a !== void 0 ? _a : '';
19
+ }
20
+ catch {
21
+ return '';
22
+ }
23
+ };
24
+ const parseCookies = (cookie) => {
25
+ return Object.fromEntries(cookie
26
+ .split(/;\s+/)
27
+ .map((r) => r.split('=').map((str) => str.trim()))
28
+ .map(([cookieKey, ...cookieValues]) => {
29
+ const cookieValue = cookieValues.join('=');
30
+ if (!cookieKey) {
31
+ return [];
32
+ }
33
+ let decodedValue = '';
34
+ if (cookieValue) {
35
+ try {
36
+ decodedValue = decodeURIComponent(cookieValue);
37
+ }
38
+ catch (e) {
39
+ console.log(`Unable to decode cookie ${cookieKey}: ${e}`);
40
+ decodedValue = cookieValue;
41
+ }
42
+ }
43
+ return [cookieKey, decodedValue];
44
+ }));
45
+ };
5
46
 
6
47
  const canLog = () => {
7
48
  try {
@@ -36,7 +77,7 @@ var ProvidersTrybeSdk = (function () {
36
77
  };
37
78
 
38
79
  const tag = ({ eventName, data, manifestVariables }) => {
39
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
80
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
40
81
  try {
41
82
  if (!(window === null || window === void 0 ? void 0 : window._trybe)) {
42
83
  return {};
@@ -50,7 +91,10 @@ var ProvidersTrybeSdk = (function () {
50
91
  return {};
51
92
  }
52
93
  const d = (data !== null && data !== void 0 ? data : {});
53
- const vid = window._trybe.vid;
94
+ // The pixel keeps the visitor ID in the ugc_vid_{storeId} cookie
95
+ const storeId = (_b = manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['storeId']) !== null && _b !== void 0 ? _b : '';
96
+ const vid = window._trybe.vid ||
97
+ (storeId ? getCookieValue(vidCookieKey(storeId)) : '');
54
98
  if (!vid) {
55
99
  return {};
56
100
  }
@@ -59,14 +103,14 @@ var ProvidersTrybeSdk = (function () {
59
103
  const item = Array.isArray(d['contents'])
60
104
  ? d['contents'][0]
61
105
  : null;
62
- (_c = (_b = window._trybe).trackProductViewed) === null || _c === void 0 ? void 0 : _c.call(_b, {
106
+ (_d = (_c = window._trybe).trackProductViewed) === null || _d === void 0 ? void 0 : _d.call(_c, {
63
107
  vid,
64
- productId: String((_e = (_d = item === null || item === void 0 ? void 0 : item['id']) !== null && _d !== void 0 ? _d : d['productId']) !== null && _e !== void 0 ? _e : ''),
65
- productName: String((_g = (_f = item === null || item === void 0 ? void 0 : item['title']) !== null && _f !== void 0 ? _f : d['productName']) !== null && _g !== void 0 ? _g : ''),
66
- price: Number((_j = (_h = item === null || item === void 0 ? void 0 : item['item_price']) !== null && _h !== void 0 ? _h : d['price']) !== null && _j !== void 0 ? _j : 0),
67
- currency: String((_k = d['currency']) !== null && _k !== void 0 ? _k : 'USD'),
68
- productUrl: String((_l = d['productUrl']) !== null && _l !== void 0 ? _l : window.location.href),
69
- imageUrl: String((_o = (_m = item === null || item === void 0 ? void 0 : item['imageUrl']) !== null && _m !== void 0 ? _m : d['imageUrl']) !== null && _o !== void 0 ? _o : ''),
108
+ productId: String((_f = (_e = item === null || item === void 0 ? void 0 : item['id']) !== null && _e !== void 0 ? _e : d['productId']) !== null && _f !== void 0 ? _f : ''),
109
+ productName: String((_h = (_g = item === null || item === void 0 ? void 0 : item['title']) !== null && _g !== void 0 ? _g : d['productName']) !== null && _h !== void 0 ? _h : ''),
110
+ price: Number((_k = (_j = item === null || item === void 0 ? void 0 : item['item_price']) !== null && _j !== void 0 ? _j : d['price']) !== null && _k !== void 0 ? _k : 0),
111
+ currency: String((_l = d['currency']) !== null && _l !== void 0 ? _l : 'USD'),
112
+ productUrl: String((_m = d['productUrl']) !== null && _m !== void 0 ? _m : window.location.href),
113
+ imageUrl: String((_p = (_o = item === null || item === void 0 ? void 0 : item['imageUrl']) !== null && _o !== void 0 ? _o : d['imageUrl']) !== null && _p !== void 0 ? _p : ''),
70
114
  });
71
115
  break;
72
116
  }
@@ -74,13 +118,13 @@ var ProvidersTrybeSdk = (function () {
74
118
  const item = Array.isArray(d['contents'])
75
119
  ? d['contents'][0]
76
120
  : null;
77
- (_q = (_p = window._trybe).trackAddToCart) === null || _q === void 0 ? void 0 : _q.call(_p, {
121
+ (_r = (_q = window._trybe).trackAddToCart) === null || _r === void 0 ? void 0 : _r.call(_q, {
78
122
  vid,
79
- productId: String((_s = (_r = item === null || item === void 0 ? void 0 : item['id']) !== null && _r !== void 0 ? _r : d['productId']) !== null && _s !== void 0 ? _s : ''),
80
- productName: String((_u = (_t = item === null || item === void 0 ? void 0 : item['title']) !== null && _t !== void 0 ? _t : d['productName']) !== null && _u !== void 0 ? _u : ''),
81
- quantity: Number((_w = (_v = item === null || item === void 0 ? void 0 : item['quantity']) !== null && _v !== void 0 ? _v : d['quantity']) !== null && _w !== void 0 ? _w : 1),
82
- price: Number((_y = (_x = item === null || item === void 0 ? void 0 : item['item_price']) !== null && _x !== void 0 ? _x : d['price']) !== null && _y !== void 0 ? _y : 0),
83
- currency: String((_z = d['currency']) !== null && _z !== void 0 ? _z : 'USD'),
123
+ productId: String((_t = (_s = item === null || item === void 0 ? void 0 : item['id']) !== null && _s !== void 0 ? _s : d['productId']) !== null && _t !== void 0 ? _t : ''),
124
+ productName: String((_v = (_u = item === null || item === void 0 ? void 0 : item['title']) !== null && _u !== void 0 ? _u : d['productName']) !== null && _v !== void 0 ? _v : ''),
125
+ quantity: Number((_x = (_w = item === null || item === void 0 ? void 0 : item['quantity']) !== null && _w !== void 0 ? _w : d['quantity']) !== null && _x !== void 0 ? _x : 1),
126
+ price: Number((_z = (_y = item === null || item === void 0 ? void 0 : item['item_price']) !== null && _y !== void 0 ? _y : d['price']) !== null && _z !== void 0 ? _z : 0),
127
+ currency: String((_0 = d['currency']) !== null && _0 !== void 0 ? _0 : 'USD'),
84
128
  });
85
129
  break;
86
130
  }
@@ -88,20 +132,20 @@ var ProvidersTrybeSdk = (function () {
88
132
  const contents = Array.isArray(d['contents'])
89
133
  ? d['contents']
90
134
  : [];
91
- (_1 = (_0 = window._trybe).trackCheckoutStarted) === null || _1 === void 0 ? void 0 : _1.call(_0, {
135
+ (_2 = (_1 = window._trybe).trackCheckoutStarted) === null || _2 === void 0 ? void 0 : _2.call(_1, {
92
136
  vid,
93
- cartValue: Number((_2 = d['value']) !== null && _2 !== void 0 ? _2 : 0),
94
- currency: String((_3 = d['currency']) !== null && _3 !== void 0 ? _3 : 'USD'),
95
- itemCount: contents.length || Number((_4 = d['itemCount']) !== null && _4 !== void 0 ? _4 : 0),
137
+ cartValue: Number((_3 = d['value']) !== null && _3 !== void 0 ? _3 : 0),
138
+ currency: String((_4 = d['currency']) !== null && _4 !== void 0 ? _4 : 'USD'),
139
+ itemCount: contents.length || Number((_5 = d['itemCount']) !== null && _5 !== void 0 ? _5 : 0),
96
140
  });
97
141
  break;
98
142
  }
99
143
  case 'Purchase': {
100
- (_6 = (_5 = window._trybe).trackCheckoutCompleted) === null || _6 === void 0 ? void 0 : _6.call(_5, {
144
+ (_7 = (_6 = window._trybe).trackCheckoutCompleted) === null || _7 === void 0 ? void 0 : _7.call(_6, {
101
145
  vid,
102
- orderId: String((_7 = d['orderId']) !== null && _7 !== void 0 ? _7 : ''),
103
- orderValue: Number((_8 = d['value']) !== null && _8 !== void 0 ? _8 : 0),
104
- currency: String((_9 = d['currency']) !== null && _9 !== void 0 ? _9 : 'USD'),
146
+ orderId: String((_8 = d['orderId']) !== null && _8 !== void 0 ? _8 : ''),
147
+ orderValue: Number((_9 = d['value']) !== null && _9 !== void 0 ? _9 : 0),
148
+ currency: String((_10 = d['currency']) !== null && _10 !== void 0 ? _10 : 'USD'),
105
149
  });
106
150
  break;
107
151
  }
package/index.mjs CHANGED
@@ -1,4 +1,45 @@
1
1
  const packageName = 'trybe';
2
+ /**
3
+ * Returns the Trybe visitor-ID cookie name for a given store ID.
4
+ * The Trybe pixel sets a cookie named `ugc_vid_{storeId}` in the browser.
5
+ */
6
+ const vidCookieKey = (storeId) => `ugc_vid_${storeId}`;
7
+
8
+ const getCookieValue = (key) => {
9
+ var _a;
10
+ try {
11
+ if (!document || !document.cookie) {
12
+ return '';
13
+ }
14
+ const cookies = parseCookies(document.cookie);
15
+ return (_a = cookies[key]) !== null && _a !== void 0 ? _a : '';
16
+ }
17
+ catch {
18
+ return '';
19
+ }
20
+ };
21
+ const parseCookies = (cookie) => {
22
+ return Object.fromEntries(cookie
23
+ .split(/;\s+/)
24
+ .map((r) => r.split('=').map((str) => str.trim()))
25
+ .map(([cookieKey, ...cookieValues]) => {
26
+ const cookieValue = cookieValues.join('=');
27
+ if (!cookieKey) {
28
+ return [];
29
+ }
30
+ let decodedValue = '';
31
+ if (cookieValue) {
32
+ try {
33
+ decodedValue = decodeURIComponent(cookieValue);
34
+ }
35
+ catch (e) {
36
+ console.log(`Unable to decode cookie ${cookieKey}: ${e}`);
37
+ decodedValue = cookieValue;
38
+ }
39
+ }
40
+ return [cookieKey, decodedValue];
41
+ }));
42
+ };
2
43
 
3
44
  const canLog = () => {
4
45
  try {
@@ -33,7 +74,7 @@ const logger = {
33
74
  };
34
75
 
35
76
  const tag = ({ eventName, data, manifestVariables }) => {
36
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
77
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
37
78
  try {
38
79
  if (!(window === null || window === void 0 ? void 0 : window._trybe)) {
39
80
  return {};
@@ -47,7 +88,10 @@ const tag = ({ eventName, data, manifestVariables }) => {
47
88
  return {};
48
89
  }
49
90
  const d = (data !== null && data !== void 0 ? data : {});
50
- const vid = window._trybe.vid;
91
+ // The pixel keeps the visitor ID in the ugc_vid_{storeId} cookie
92
+ const storeId = (_b = manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['storeId']) !== null && _b !== void 0 ? _b : '';
93
+ const vid = window._trybe.vid ||
94
+ (storeId ? getCookieValue(vidCookieKey(storeId)) : '');
51
95
  if (!vid) {
52
96
  return {};
53
97
  }
@@ -56,14 +100,14 @@ const tag = ({ eventName, data, manifestVariables }) => {
56
100
  const item = Array.isArray(d['contents'])
57
101
  ? d['contents'][0]
58
102
  : null;
59
- (_c = (_b = window._trybe).trackProductViewed) === null || _c === void 0 ? void 0 : _c.call(_b, {
103
+ (_d = (_c = window._trybe).trackProductViewed) === null || _d === void 0 ? void 0 : _d.call(_c, {
60
104
  vid,
61
- productId: String((_e = (_d = item === null || item === void 0 ? void 0 : item['id']) !== null && _d !== void 0 ? _d : d['productId']) !== null && _e !== void 0 ? _e : ''),
62
- productName: String((_g = (_f = item === null || item === void 0 ? void 0 : item['title']) !== null && _f !== void 0 ? _f : d['productName']) !== null && _g !== void 0 ? _g : ''),
63
- price: Number((_j = (_h = item === null || item === void 0 ? void 0 : item['item_price']) !== null && _h !== void 0 ? _h : d['price']) !== null && _j !== void 0 ? _j : 0),
64
- currency: String((_k = d['currency']) !== null && _k !== void 0 ? _k : 'USD'),
65
- productUrl: String((_l = d['productUrl']) !== null && _l !== void 0 ? _l : window.location.href),
66
- imageUrl: String((_o = (_m = item === null || item === void 0 ? void 0 : item['imageUrl']) !== null && _m !== void 0 ? _m : d['imageUrl']) !== null && _o !== void 0 ? _o : ''),
105
+ productId: String((_f = (_e = item === null || item === void 0 ? void 0 : item['id']) !== null && _e !== void 0 ? _e : d['productId']) !== null && _f !== void 0 ? _f : ''),
106
+ productName: String((_h = (_g = item === null || item === void 0 ? void 0 : item['title']) !== null && _g !== void 0 ? _g : d['productName']) !== null && _h !== void 0 ? _h : ''),
107
+ price: Number((_k = (_j = item === null || item === void 0 ? void 0 : item['item_price']) !== null && _j !== void 0 ? _j : d['price']) !== null && _k !== void 0 ? _k : 0),
108
+ currency: String((_l = d['currency']) !== null && _l !== void 0 ? _l : 'USD'),
109
+ productUrl: String((_m = d['productUrl']) !== null && _m !== void 0 ? _m : window.location.href),
110
+ imageUrl: String((_p = (_o = item === null || item === void 0 ? void 0 : item['imageUrl']) !== null && _o !== void 0 ? _o : d['imageUrl']) !== null && _p !== void 0 ? _p : ''),
67
111
  });
68
112
  break;
69
113
  }
@@ -71,13 +115,13 @@ const tag = ({ eventName, data, manifestVariables }) => {
71
115
  const item = Array.isArray(d['contents'])
72
116
  ? d['contents'][0]
73
117
  : null;
74
- (_q = (_p = window._trybe).trackAddToCart) === null || _q === void 0 ? void 0 : _q.call(_p, {
118
+ (_r = (_q = window._trybe).trackAddToCart) === null || _r === void 0 ? void 0 : _r.call(_q, {
75
119
  vid,
76
- productId: String((_s = (_r = item === null || item === void 0 ? void 0 : item['id']) !== null && _r !== void 0 ? _r : d['productId']) !== null && _s !== void 0 ? _s : ''),
77
- productName: String((_u = (_t = item === null || item === void 0 ? void 0 : item['title']) !== null && _t !== void 0 ? _t : d['productName']) !== null && _u !== void 0 ? _u : ''),
78
- quantity: Number((_w = (_v = item === null || item === void 0 ? void 0 : item['quantity']) !== null && _v !== void 0 ? _v : d['quantity']) !== null && _w !== void 0 ? _w : 1),
79
- price: Number((_y = (_x = item === null || item === void 0 ? void 0 : item['item_price']) !== null && _x !== void 0 ? _x : d['price']) !== null && _y !== void 0 ? _y : 0),
80
- currency: String((_z = d['currency']) !== null && _z !== void 0 ? _z : 'USD'),
120
+ productId: String((_t = (_s = item === null || item === void 0 ? void 0 : item['id']) !== null && _s !== void 0 ? _s : d['productId']) !== null && _t !== void 0 ? _t : ''),
121
+ productName: String((_v = (_u = item === null || item === void 0 ? void 0 : item['title']) !== null && _u !== void 0 ? _u : d['productName']) !== null && _v !== void 0 ? _v : ''),
122
+ quantity: Number((_x = (_w = item === null || item === void 0 ? void 0 : item['quantity']) !== null && _w !== void 0 ? _w : d['quantity']) !== null && _x !== void 0 ? _x : 1),
123
+ price: Number((_z = (_y = item === null || item === void 0 ? void 0 : item['item_price']) !== null && _y !== void 0 ? _y : d['price']) !== null && _z !== void 0 ? _z : 0),
124
+ currency: String((_0 = d['currency']) !== null && _0 !== void 0 ? _0 : 'USD'),
81
125
  });
82
126
  break;
83
127
  }
@@ -85,20 +129,20 @@ const tag = ({ eventName, data, manifestVariables }) => {
85
129
  const contents = Array.isArray(d['contents'])
86
130
  ? d['contents']
87
131
  : [];
88
- (_1 = (_0 = window._trybe).trackCheckoutStarted) === null || _1 === void 0 ? void 0 : _1.call(_0, {
132
+ (_2 = (_1 = window._trybe).trackCheckoutStarted) === null || _2 === void 0 ? void 0 : _2.call(_1, {
89
133
  vid,
90
- cartValue: Number((_2 = d['value']) !== null && _2 !== void 0 ? _2 : 0),
91
- currency: String((_3 = d['currency']) !== null && _3 !== void 0 ? _3 : 'USD'),
92
- itemCount: contents.length || Number((_4 = d['itemCount']) !== null && _4 !== void 0 ? _4 : 0),
134
+ cartValue: Number((_3 = d['value']) !== null && _3 !== void 0 ? _3 : 0),
135
+ currency: String((_4 = d['currency']) !== null && _4 !== void 0 ? _4 : 'USD'),
136
+ itemCount: contents.length || Number((_5 = d['itemCount']) !== null && _5 !== void 0 ? _5 : 0),
93
137
  });
94
138
  break;
95
139
  }
96
140
  case 'Purchase': {
97
- (_6 = (_5 = window._trybe).trackCheckoutCompleted) === null || _6 === void 0 ? void 0 : _6.call(_5, {
141
+ (_7 = (_6 = window._trybe).trackCheckoutCompleted) === null || _7 === void 0 ? void 0 : _7.call(_6, {
98
142
  vid,
99
- orderId: String((_7 = d['orderId']) !== null && _7 !== void 0 ? _7 : ''),
100
- orderValue: Number((_8 = d['value']) !== null && _8 !== void 0 ? _8 : 0),
101
- currency: String((_9 = d['currency']) !== null && _9 !== void 0 ? _9 : 'USD'),
143
+ orderId: String((_8 = d['orderId']) !== null && _8 !== void 0 ? _8 : ''),
144
+ orderValue: Number((_9 = d['value']) !== null && _9 !== void 0 ? _9 : 0),
145
+ currency: String((_10 = d['currency']) !== null && _10 !== void 0 ? _10 : 'USD'),
102
146
  });
103
147
  break;
104
148
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/providers-trybe-sdk",
3
- "version": "1.76.3",
3
+ "version": "1.77.1",
4
4
  "description": "Trybe Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",