wineater-bot 1.4.3 → 1.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wineater-bot",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "src/index.js",
@@ -15,6 +15,13 @@ function setCookie(name, value, days) {
15
15
  const parts = value.split(`; ${name}=`);
16
16
  if (parts.length === 2) return parts.pop().split(';').shift();
17
17
  }
18
+
19
+ // Function to URL encode the data
20
+ function urlEncodeData(data) {
21
+ return Object.keys(data)
22
+ .map(key => encodeURIComponent(key) + '=' + encodeURIComponent(data[key]))
23
+ .join('&');
24
+ }
18
25
 
19
26
  // Функция для отправки событий в Mixpanel
20
27
  function trackEvent(event, properties) {
@@ -28,10 +35,10 @@ function setCookie(name, value, days) {
28
35
  fetch(endpoint, {
29
36
  method: 'POST',
30
37
  headers: {
31
- 'Content-Type': 'application/json',
38
+ 'Content-Type': 'application/x-www-form-urlencoded',
32
39
  'Authentication': token
33
40
  },
34
- body: JSON.stringify(data)
41
+ body: urlEncodeData(data)
35
42
  }).then(response => {
36
43
  if (!response.ok) {
37
44
  console.error('Mixpanel tracking failed', response);