@hellotext/hellotext 2.5.3 → 2.5.4
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/dist/hellotext.js +1 -1
- package/lib/controllers/message_controller.cjs +3 -1
- package/lib/controllers/message_controller.js +3 -1
- package/lib/models/utm.cjs +8 -4
- package/lib/models/utm.js +8 -4
- package/package.json +1 -1
- package/src/controllers/message_controller.js +3 -0
- package/src/models/utm.js +10 -6
|
@@ -84,6 +84,7 @@ let _default = /*#__PURE__*/function (_Controller) {
|
|
|
84
84
|
product: id,
|
|
85
85
|
quantity: 1
|
|
86
86
|
};
|
|
87
|
+
if (this.hasUtmValue) _hellotext.default.page.utm.save(this.utmValue);
|
|
87
88
|
_hellotext.default.track('cart.added', {
|
|
88
89
|
object_parameters: {
|
|
89
90
|
items: [item]
|
|
@@ -294,6 +295,7 @@ _default.values = {
|
|
|
294
295
|
pageStartOffset: {
|
|
295
296
|
type: Number,
|
|
296
297
|
default: 0
|
|
297
|
-
}
|
|
298
|
+
},
|
|
299
|
+
utm: Object
|
|
298
300
|
};
|
|
299
301
|
_default.targets = ['carouselContainer', 'leftFade', 'rightFade', 'carouselCard'];
|
|
@@ -83,6 +83,7 @@ var _default = /*#__PURE__*/function (_Controller) {
|
|
|
83
83
|
product: id,
|
|
84
84
|
quantity: 1
|
|
85
85
|
};
|
|
86
|
+
if (this.hasUtmValue) Hellotext.page.utm.save(this.utmValue);
|
|
86
87
|
Hellotext.track('cart.added', {
|
|
87
88
|
object_parameters: {
|
|
88
89
|
items: [item]
|
|
@@ -289,7 +290,8 @@ _default.values = {
|
|
|
289
290
|
pageStartOffset: {
|
|
290
291
|
type: Number,
|
|
291
292
|
default: 0
|
|
292
|
-
}
|
|
293
|
+
},
|
|
294
|
+
utm: Object
|
|
293
295
|
};
|
|
294
296
|
_default.targets = ['carouselContainer', 'leftFade', 'rightFade', 'carouselCard'];
|
|
295
297
|
export { _default as default };
|
package/lib/models/utm.cjs
CHANGED
|
@@ -21,12 +21,16 @@ let UTM = /*#__PURE__*/function () {
|
|
|
21
21
|
term: urlSearchParams.get('utm_term'),
|
|
22
22
|
content: urlSearchParams.get('utm_content')
|
|
23
23
|
};
|
|
24
|
-
|
|
25
|
-
const cleanUtms = Object.fromEntries(Object.entries(utmsFromUrl).filter(([_, value]) => value));
|
|
26
|
-
_cookies.Cookies.set('hello_utm', JSON.stringify(cleanUtms));
|
|
27
|
-
}
|
|
24
|
+
this.save(utmsFromUrl);
|
|
28
25
|
}
|
|
29
26
|
_createClass(UTM, [{
|
|
27
|
+
key: "save",
|
|
28
|
+
value: function save(utmParams) {
|
|
29
|
+
if (!utmParams.source || !utmParams.medium) return;
|
|
30
|
+
const cleanUtms = Object.fromEntries(Object.entries(utmParams).filter(([_, value]) => value));
|
|
31
|
+
_cookies.Cookies.set('hello_utm', JSON.stringify(cleanUtms));
|
|
32
|
+
}
|
|
33
|
+
}, {
|
|
30
34
|
key: "current",
|
|
31
35
|
get: function () {
|
|
32
36
|
try {
|
package/lib/models/utm.js
CHANGED
|
@@ -15,15 +15,19 @@ var UTM = /*#__PURE__*/function () {
|
|
|
15
15
|
term: urlSearchParams.get('utm_term'),
|
|
16
16
|
content: urlSearchParams.get('utm_content')
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
this.save(utmsFromUrl);
|
|
19
|
+
}
|
|
20
|
+
_createClass(UTM, [{
|
|
21
|
+
key: "save",
|
|
22
|
+
value: function save(utmParams) {
|
|
23
|
+
if (!utmParams.source || !utmParams.medium) return;
|
|
24
|
+
var cleanUtms = Object.fromEntries(Object.entries(utmParams).filter(_ref => {
|
|
20
25
|
var [_, value] = _ref;
|
|
21
26
|
return value;
|
|
22
27
|
}));
|
|
23
28
|
Cookies.set('hello_utm', JSON.stringify(cleanUtms));
|
|
24
29
|
}
|
|
25
|
-
}
|
|
26
|
-
_createClass(UTM, [{
|
|
30
|
+
}, {
|
|
27
31
|
key: "current",
|
|
28
32
|
get: function get() {
|
|
29
33
|
try {
|
package/package.json
CHANGED
|
@@ -8,6 +8,7 @@ export default class extends Controller {
|
|
|
8
8
|
id: String,
|
|
9
9
|
kind: String,
|
|
10
10
|
pageStartOffset: { type: Number, default: 0 },
|
|
11
|
+
utm: Object,
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
static targets = ['carouselContainer', 'leftFade', 'rightFade', 'carouselCard']
|
|
@@ -52,6 +53,8 @@ export default class extends Controller {
|
|
|
52
53
|
const { id, reference, source } = card.dataset
|
|
53
54
|
const item = { product: id, quantity: 1 }
|
|
54
55
|
|
|
56
|
+
if (this.hasUtmValue) Hellotext.page.utm.save(this.utmValue)
|
|
57
|
+
|
|
55
58
|
Hellotext.track('cart.added', {
|
|
56
59
|
object_parameters: { items: [item] },
|
|
57
60
|
source: {
|
package/src/models/utm.js
CHANGED
|
@@ -12,13 +12,17 @@ class UTM {
|
|
|
12
12
|
content: urlSearchParams.get('utm_content'),
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Object.entries(utmsFromUrl).filter(([_, value]) => value),
|
|
18
|
-
)
|
|
15
|
+
this.save(utmsFromUrl)
|
|
16
|
+
}
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
save(utmParams) {
|
|
19
|
+
if (!utmParams.source || !utmParams.medium) return
|
|
20
|
+
|
|
21
|
+
const cleanUtms = Object.fromEntries(
|
|
22
|
+
Object.entries(utmParams).filter(([_, value]) => value),
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
Cookies.set('hello_utm', JSON.stringify(cleanUtms))
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
get current() {
|