wineater-bot 3.0.2 → 3.0.3

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,8 +5,8 @@
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
12
  <div id="widget-container"></div> <!-- Контейнер для виджета -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wineater-bot",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
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
@@ -31,9 +31,10 @@ export class WineWidget {
31
31
  <div class="filter-group">
32
32
  <span class="filter-label">${translator.translate('priceRange')}:</span>
33
33
  <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>
34
+ <button data-value="< 500">< $500</button>
35
+ <button data-value="500 - 1000">$500 - $1000</button>
36
+ <button data-value="> 1000">> $1000</button>
37
+ <button data-value=" " class="selected">Any</button>
37
38
  </div>
38
39
  </div>
39
40
  <div class="filter-group">
@@ -42,6 +43,7 @@ export class WineWidget {
42
43
  <button data-value="red">${translator.translate('red')}</button>
43
44
  <button data-value="white">${translator.translate('white')}</button>
44
45
  <button data-value="rose">${translator.translate('rose')}</button>
46
+ <button data-value=" " class="selected">${translator.translate('Any')}</button>
45
47
  </div>
46
48
  </div>
47
49
  <div class="filter-group">
@@ -50,6 +52,7 @@ export class WineWidget {
50
52
  <button data-value="light">${translator.translate('light')}</button>
51
53
  <button data-value="medium">${translator.translate('medium')}</button>
52
54
  <button data-value="full">${translator.translate('full')}</button>
55
+ <button data-value=" " class="selected">${translator.translate('Any')}</button>
53
56
  </div>
54
57
  </div>
55
58
  </div>
@@ -62,7 +65,9 @@ export class WineWidget {
62
65
  </div>
63
66
  <div id="wine-widget-right">
64
67
  <div id="loading-indicator" class="hidden">
65
- <img src="https://czvgkhagwvmknscoerfy.supabase.co/storage/v1/object/public/static-media/mascot.jpeg" alt="Loading" />
68
+ <div id="typing-indicator" class="typing-indicator">
69
+ <span></span><span></span><span></span>
70
+ </div>
66
71
  </div>
67
72
  <div id="wine-placeholder"></div>
68
73
  </div>
@@ -98,7 +103,7 @@ export class WineWidget {
98
103
  }
99
104
 
100
105
  async handleSearch() {
101
- const query = 'wine for' + document.getElementById('wine-search-input').value.trim();
106
+ const query = 'wine for dish:' + document.getElementById('wine-search-input').value.trim() + ';';
102
107
 
103
108
  // Учитываем текущие выбранные фильтры
104
109
  const filters = this.selectedFilters;
@@ -106,13 +111,13 @@ export class WineWidget {
106
111
  // Формируем органичную фразу с фильтрами
107
112
  const filterPhrases = [];
108
113
  if (filters.price) {
109
- filterPhrases.push(`with price ${filters.price}`);
114
+ filterPhrases.push(`price: ${filters.price || 'any'};`);
110
115
  }
111
116
  if (filters.color) {
112
- filterPhrases.push(`of color ${filters.color}`);
117
+ filterPhrases.push(`color: ${filters.color || 'any'}; `);
113
118
  }
114
119
  if (filters.intensity) {
115
- filterPhrases.push(`with intensity ${filters.intensity}`);
120
+ filterPhrases.push(`intensity: ${filters.intensity || 'any'}; `);
116
121
  }
117
122
 
118
123
  // Объединяем фильтры с основным запросом
@@ -222,7 +227,7 @@ export class WineWidget {
222
227
  }
223
228
 
224
229
  async loadInstantRecommendations() {
225
- console.log('привет')
230
+ this.showLoadingIndicator();
226
231
  try {
227
232
  const recommendations = await this.api.getInstantRecommendations();
228
233
  this.displayResults(recommendations); // Обновляем отображение рекомендаций