wineater-bot 2.1.2 → 2.1.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": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "src/index.js",
package/src/index.js CHANGED
@@ -13,13 +13,6 @@ const tracker = new Tracker({
13
13
  '__DISABLE_SECURE_MODE': true
14
14
  });
15
15
 
16
- flagsmith.init({
17
- environmentID: '5RfiDoiqb4dHrNdQvzbkfM',
18
- // api:"http://localhost:8000/api/v1/" set this if you are self hosting, and point it to your API
19
- cacheFlags: true, // stores flags in localStorage cache
20
- enableAnalytics: true, // See https://docs.flagsmith.com/flag-analytics/ for more info.
21
- });
22
-
23
16
  // Import your JavaScript modules here
24
17
  import { toggleChatWindow, closeChatWindow, openChatWindow } from './js/ui.js';
25
18
  import { Chatbot } from './js/chatbot.js';
@@ -44,6 +37,10 @@ export {
44
37
  openChatWindow
45
38
  };
46
39
 
40
+ function getUniqueId() {
41
+ const uniqueId = getCookie()
42
+ }
43
+
47
44
  function createChatbotUI() {
48
45
  tracker.start();
49
46
  const btnTextOption = flagsmith.getValue('chat-btn-txt');
@@ -146,13 +143,28 @@ if (typeof window !== 'undefined') {
146
143
  }
147
144
  }
148
145
  await translator.fetchConfig(capitalizeStore || 'Climats');
149
- createChatbotUI(); // Create the UI
146
+ setCookie('chatbotToken', window.wineaterData?.CLIENT_TOKEN || DEMO_TOKEN, 365);
147
+ setUniqueUserCookie();
148
+ flagsmith.init({
149
+ environmentID: '5RfiDoiqb4dHrNdQvzbkfM',
150
+ // api:"http://localhost:8000/api/v1/" set this if you are self hosting, and point it to your API
151
+ cacheFlags: false, // stores flags in localStorage cache
152
+ enableAnalytics: true,
153
+ identity: getCookie('uniqueUserID') // See https://docs.flagsmith.com/flag-analytics/ for more info.
154
+ }).then(() => {
155
+ createChatbotUI(); // Create the UI
156
+ setupCloseButton();
157
+ setupOutsideClick();
158
+ toggleChatIconPosition(position);
159
+ const myChatbot = new Chatbot();
160
+ myChatbot.initialize();
161
+ }).catch(() => {
162
+ createChatbotUI(); // Create the UI
150
163
  setupCloseButton();
151
164
  setupOutsideClick();
152
165
  toggleChatIconPosition(position);
153
- setCookie('chatbotToken', window.wineaterData?.CLIENT_TOKEN || DEMO_TOKEN, 365);
154
- setUniqueUserCookie();
155
166
  const myChatbot = new Chatbot();
156
167
  myChatbot.initialize();
168
+ });
157
169
  });
158
170
  }
@@ -38,16 +38,16 @@ export async function shouldOpenChatAutomatically() {
38
38
  if (regex.test(currentURL)) {
39
39
  try {
40
40
  // Get meta title and description from the document
41
- const metaTitle = document.querySelector('meta[name="title"]')?.getAttribute('content') || document.title;
42
- const metaDescription = document.querySelector('meta[name="description"]')?.getAttribute('content') || '';
41
+ // const metaTitle = document.querySelector('meta[name="title"]')?.getAttribute('content') || document.title;
42
+ // const metaDescription = document.querySelector('meta[name="description"]')?.getAttribute('content') || '';
43
43
 
44
44
  // Fetch dishes based on meta data
45
- const dishes = await api.getPossibleDishesWithMeta(metaTitle, metaDescription);
45
+ // const dishes = await api.getPossibleDishesWithMeta(metaTitle, metaDescription);
46
46
 
47
47
  console.log(dishes);
48
48
 
49
49
  const timer = setTimeout(() => {
50
- openChatWindowWithDishes(dishes); // Открыть чат с блюдами через 15 секунд
50
+ openChatWindow(); // Открыть чат с блюдами через 15 секунд
51
51
  }, 15000); // 15000 миллисекунд = 15 секунд
52
52
 
53
53
  // Сохраняем таймер, чтобы можно было его сбросить при ручном открытии чата
package/src/js/styles.js CHANGED
@@ -10,7 +10,7 @@ const css = `
10
10
  bottom: 20px;
11
11
  right: 20px;
12
12
  font-family: 'Poppins', sans-serif; /* Use Poppins as the main font */
13
- z-index: 1000; /* Ensure chat is above other content */
13
+ z-index: 10000; /* Ensure chat is above other content */
14
14
  }
15
15
 
16
16
  /* Styling the chat icon */
@@ -28,6 +28,7 @@ const css = `
28
28
  font-family: 'Poppins', sans-serif;
29
29
  font-size: 16px; /* Увеличенный размер текста */
30
30
  font-weight: bold;
31
+ box-sizing: border-box;
31
32
  transition: transform 0.2s ease, box-shadow 0.2s ease; /* Анимация при наведении */
32
33
  }
33
34
 
@@ -84,14 +85,18 @@ const css = `
84
85
  /* Chat window styles */
85
86
  #chat-window {
86
87
  position: fixed;
87
- bottom: 20px;
88
- right: 20px;
89
- width: 380px;
90
- background-color: white;
91
- border-radius: 24px;
92
- box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
93
- display: none;
94
- overflow: hidden;
88
+ bottom: 20px;
89
+ right: 20px;
90
+ width: 380px;
91
+ background-color: white;
92
+ border-radius: 24px;
93
+ border: 2px solid transparent;
94
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
95
+ display: none;
96
+ overflow: hidden;
97
+ background: linear-gradient(white, white) padding-box,
98
+ linear-gradient(90deg, #7B2BEB, #0044FF) border-box;
99
+
95
100
  }
96
101
 
97
102
  #chat-header {
@@ -360,10 +365,17 @@ border-top-left-radius: 4px;
360
365
  }
361
366
 
362
367
  .wine-item a {
363
- color: #0044FF;
364
- text-decoration: none;
365
- font-size: 14px;
366
- font-weight: 500;
368
+ color: #0044FF; /* Синий цвет ссылки */
369
+ text-decoration: underline; /* Подчеркивание для эффекта ссылки */
370
+ font-size: 14px; /* Размер текста */
371
+ font-weight: 500; /* Полужирный текст */
372
+ margin-top: 10px; /* Отступ сверху */
373
+ display: inline-block; /* Чтобы отступы работали корректно */
374
+ }
375
+
376
+ .wine-item a:hover {
377
+ text-decoration: none; /* Убираем подчеркивание при наведении */
378
+ color: #002699; /* Более темный синий для интерактивного эффекта */
367
379
  }
368
380
 
369
381
  .wine-description {
@@ -387,7 +399,7 @@ border-bottom-right-radius: 15px;
387
399
 
388
400
  /* Loader Styles */
389
401
  .loader {
390
- display: none;
402
+ display: none;
391
403
  width: 40px;
392
404
  height: 40px;
393
405
  margin: 20px auto;
@@ -423,7 +435,7 @@ border-bottom-right-radius: 15px;
423
435
  justify-content: center;
424
436
  align-items: center;
425
437
  height: 0;
426
- visibility: hidden;
438
+ visibility: hidden;
427
439
  background-color: white;
428
440
  }
429
441
 
@@ -477,7 +489,7 @@ border-bottom-right-radius: 15px;
477
489
  }
478
490
 
479
491
  #message-container {
480
- height: calc(100vh - 180px); /* Учитываем высоту header и input container */
492
+ height: calc(100vh - 250px); /* Учитываем высоту header и input container */
481
493
  max-height: none;
482
494
  }
483
495