wineater-bot 3.0.2 → 3.0.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/index.html CHANGED
@@ -5,10 +5,10 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Chatbot</title>
7
7
  <!-- <script type="module" src="https://unpkg.com/wineater-bot@1.0.0/dist/wineater-chatbot.umd.js"></script> -->
8
- <script>window.wineaterData = {CLIENT_TOKEN: 'Y3I8Pi1FruGjVmIBqpV24PtOLYjzdROuxWX9tCXh82zjz7uUPxV3ETvHhoeiLS17', position: 'right-center'};</script>
9
- <script type="module" src="./src/index.js"></script>
8
+ <script>window.wineaterData = {CLIENT_TOKEN: 'HeUw6IXuhvz6tRuXdPEGEbj3SGQ3Q2YtEc1Z8jd41Kg9LtyPb4Epu0to31SYIadG', position: 'right-center', TYPE: 'widget'};</script>
9
+ <script type="module" src="./dist/wineater-chatbot.umd.js"></script>
10
10
  </head>
11
11
  <body style="margin: 0;">
12
- <div id="widget-container"></div> <!-- Контейнер для виджета -->
12
+ <div id="wineater-widget-conteiner"></div> <!-- Контейнер для виджета -->
13
13
  </body>
14
14
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wineater-bot",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "src/index.js",
package/src/index.js CHANGED
@@ -8,11 +8,11 @@ import translator from './js/i18n.js';
8
8
  import { shouldOpenChatAutomatically } from './js/auto-open.js';
9
9
  import { toggleChatWindow, closeChatWindow, openChatWindow } from './js/ui.js';
10
10
 
11
- const DEMO_TOKEN = 'tbMTFzLbWcXFgXK8SzyFHA6kIjelFcz5VQABVPbXdXh5XZJCDQH9BcVlrv3DF3kA';
11
+ const DEMO_TOKEN = 'HeUw6IXuhvz6tRuXdPEGEbj3SGQ3Q2YtEc1Z8jd41Kg9LtyPb4Epu0to31SYIadG';
12
12
 
13
13
  class App {
14
14
  constructor() {
15
- this.stores = ['climats', 'telckel', 'biobio', 'weinpoint', 'vinigrandi', 'ampely'];
15
+ this.stores = ['climats', 'telckel', 'biobio', 'weinpoint', 'vinigrandi', 'ampely', 'test'];
16
16
  this.tracker = new Tracker({ projectKey: "PA8j9fAi49i6g2QnvpNs", '__DISABLE_SECURE_MODE': true });
17
17
  this.position = window?.wineaterData?.POSITION || 'right-center';
18
18
  this.type = window?.wineaterData?.TYPE || 'chatbot';
@@ -37,8 +37,8 @@ class App {
37
37
  }
38
38
 
39
39
  async initTranslator() {
40
- const storeName = this.store ? this.store.charAt(0).toUpperCase() + this.store.slice(1) : 'Climats';
41
- await translator.fetchConfig(storeName || 'Climats');
40
+ const storeName = this.store ? this.store.charAt(0).toUpperCase() + this.store.slice(1) : 'Test';
41
+ await translator.fetchConfig(storeName || 'Test');
42
42
  }
43
43
 
44
44
  initCookies() {
package/src/js/api.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // api.js
2
2
 
3
- const stores = ['climats', 'telckel', 'biobio', 'weinpoint', 'vinigrandi', 'ampely'];
4
- const DEMO_TOKEN='Y3I8Pi1FruGjVmIBqpV24PtOLYjzdROuxWX9tCXh82zjz7uUPxV3ETvHhoeiLS17';
3
+ const stores = ['climats', 'telckel', 'biobio', 'weinpoint', 'vinigrandi', 'ampely', 'test'];
4
+ const DEMO_TOKEN='HeUw6IXuhvz6tRuXdPEGEbj3SGQ3Q2YtEc1Z8jd41Kg9LtyPb4Epu0to31SYIadG';
5
5
 
6
6
  export class Api {
7
7
  constructor(apiEndpoint) {
package/src/js/styles.js CHANGED
@@ -435,10 +435,14 @@ border-bottom-right-radius: 15px;
435
435
  justify-content: center;
436
436
  align-items: center;
437
437
  height: 0;
438
- visibility: hidden;
438
+ visibility: hidden;
439
439
  background-color: white;
440
440
  }
441
441
 
442
+ #loading-indicator .typing-indicator {
443
+ visibility: visible;
444
+ }
445
+
442
446
  .typing-indicator span {
443
447
  display: block;
444
448
  width: 8px;
package/src/js/widget.js CHANGED
@@ -16,6 +16,7 @@ export class WineWidget {
16
16
  }
17
17
 
18
18
  initializeWidget() {
19
+ const widgetContainer = document.getElementById('wineater-widget-conteiner');
19
20
  const widgetHTML = `
20
21
  <div id="wine-widget-container">
21
22
  <div id="wine-widget-left">
@@ -31,9 +32,10 @@ export class WineWidget {
31
32
  <div class="filter-group">
32
33
  <span class="filter-label">${translator.translate('priceRange')}:</span>
33
34
  <div class="filter-buttons" id="price-buttons">
34
- <button data-value="<10"><$10</button>
35
- <button data-value="10-20">$10-$20</button>
36
- <button data-value=">20">>$20</button>
35
+ <button data-value="< 500">< $500</button>
36
+ <button data-value="500 - 1000">$500 - $1000</button>
37
+ <button data-value="> 1000">> $1000</button>
38
+ <button data-value=" " class="selected">Any</button>
37
39
  </div>
38
40
  </div>
39
41
  <div class="filter-group">
@@ -42,6 +44,7 @@ export class WineWidget {
42
44
  <button data-value="red">${translator.translate('red')}</button>
43
45
  <button data-value="white">${translator.translate('white')}</button>
44
46
  <button data-value="rose">${translator.translate('rose')}</button>
47
+ <button data-value=" " class="selected">${translator.translate('Any')}</button>
45
48
  </div>
46
49
  </div>
47
50
  <div class="filter-group">
@@ -50,6 +53,7 @@ export class WineWidget {
50
53
  <button data-value="light">${translator.translate('light')}</button>
51
54
  <button data-value="medium">${translator.translate('medium')}</button>
52
55
  <button data-value="full">${translator.translate('full')}</button>
56
+ <button data-value=" " class="selected">${translator.translate('Any')}</button>
53
57
  </div>
54
58
  </div>
55
59
  </div>
@@ -62,13 +66,15 @@ export class WineWidget {
62
66
  </div>
63
67
  <div id="wine-widget-right">
64
68
  <div id="loading-indicator" class="hidden">
65
- <img src="https://czvgkhagwvmknscoerfy.supabase.co/storage/v1/object/public/static-media/mascot.jpeg" alt="Loading" />
69
+ <div id="typing-indicator" class="typing-indicator">
70
+ <span></span><span></span><span></span>
71
+ </div>
66
72
  </div>
67
73
  <div id="wine-placeholder"></div>
68
74
  </div>
69
75
  </div>
70
76
  `;
71
- document.body.insertAdjacentHTML('beforeend', widgetHTML);
77
+ widgetContainer.insertAdjacentHTML('beforeend', widgetHTML);
72
78
  this.addEventListeners();
73
79
  }
74
80
 
@@ -98,7 +104,7 @@ export class WineWidget {
98
104
  }
99
105
 
100
106
  async handleSearch() {
101
- const query = 'wine for' + document.getElementById('wine-search-input').value.trim();
107
+ const query = 'wine for dish:' + document.getElementById('wine-search-input').value.trim() + ';';
102
108
 
103
109
  // Учитываем текущие выбранные фильтры
104
110
  const filters = this.selectedFilters;
@@ -106,13 +112,13 @@ export class WineWidget {
106
112
  // Формируем органичную фразу с фильтрами
107
113
  const filterPhrases = [];
108
114
  if (filters.price) {
109
- filterPhrases.push(`with price ${filters.price}`);
115
+ filterPhrases.push(`price: ${filters.price || 'any'};`);
110
116
  }
111
117
  if (filters.color) {
112
- filterPhrases.push(`of color ${filters.color}`);
118
+ filterPhrases.push(`color: ${filters.color || 'any'}; `);
113
119
  }
114
120
  if (filters.intensity) {
115
- filterPhrases.push(`with intensity ${filters.intensity}`);
121
+ filterPhrases.push(`intensity: ${filters.intensity || 'any'}; `);
116
122
  }
117
123
 
118
124
  // Объединяем фильтры с основным запросом
@@ -222,7 +228,7 @@ export class WineWidget {
222
228
  }
223
229
 
224
230
  async loadInstantRecommendations() {
225
- console.log('привет')
231
+ this.showLoadingIndicator();
226
232
  try {
227
233
  const recommendations = await this.api.getInstantRecommendations();
228
234
  this.displayResults(recommendations); // Обновляем отображение рекомендаций