wineater-bot 3.0.16 → 3.0.18
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/wineater-chatbot.mjs +275 -231
- package/dist/wineater-chatbot.umd.js +43 -42
- package/index.html +1 -1
- package/package.json +1 -1
- package/src/js/api.js +2 -2
- package/src/js/barConfig.js +3 -3
- package/src/js/i18n.js +48 -1
- package/src/js/widget-styles.js +1 -1
- package/src/js/widget.js +14 -11
package/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Chatbot</title>
|
|
7
7
|
<!-- <script type="module" src="./dist/wineater-chatbot.umd.js"></script> -->
|
|
8
|
-
<script>window.wineaterData = {CLIENT_TOKEN: '
|
|
8
|
+
<script>window.wineaterData = {CLIENT_TOKEN: 'BrB2YDr8ksFKXP3RXSW4YubF0MEVJryO8EfRiQBIZoVOyUZZSsm9xdh2tkLlOJM3', position: 'right-center', TYPE: 'widget', WIDGET_TYPE: 'bar'};</script>
|
|
9
9
|
<script type="module" src="./src/index.js"></script>
|
|
10
10
|
</head>
|
|
11
11
|
<body style="margin: 0;">
|
package/package.json
CHANGED
package/src/js/api.js
CHANGED
|
@@ -6,8 +6,8 @@ const DEMO_TOKEN='HeUw6IXuhvz6tRuXdPEGEbj3SGQ3Q2YtEc1Z8jd41Kg9LtyPb4Epu0to31SYIa
|
|
|
6
6
|
export class Api {
|
|
7
7
|
constructor(apiEndpoint) {
|
|
8
8
|
// Allow users of the library to specify their own endpoint if needed
|
|
9
|
-
|
|
10
|
-
this.baseURL = 'https://wineater-backend.vercel.app/';
|
|
9
|
+
this.baseURL = 'http://localhost:3000/';
|
|
10
|
+
// this.baseURL = 'https://wineater-backend.vercel.app/';
|
|
11
11
|
this.store = stores.find(value => window.location.href.includes(value));
|
|
12
12
|
this.token = window?.wineaterData?.CLIENT_TOKEN || DEMO_TOKEN;
|
|
13
13
|
}
|
package/src/js/barConfig.js
CHANGED
|
@@ -10,7 +10,7 @@ export const barConfig = {
|
|
|
10
10
|
"Ensalada de arúgula y parmesano",
|
|
11
11
|
"Tomate hierloom aliñado",
|
|
12
12
|
"Aceitunas LENEZ",
|
|
13
|
-
"
|
|
13
|
+
"Papatinaz",
|
|
14
14
|
"Croquetas | hongos de temporada | jamón serrano",
|
|
15
15
|
"Carpaccio Cesar",
|
|
16
16
|
"Torreznos",
|
|
@@ -31,13 +31,13 @@ export const barConfig = {
|
|
|
31
31
|
"Jamón Ibérico de bellota",
|
|
32
32
|
"Lomo ibérico",
|
|
33
33
|
"Chorizo ibérico",
|
|
34
|
-
"Plato mixto"
|
|
34
|
+
"Plato mixto iberico"
|
|
35
35
|
]
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
groupTitle: "Quesos",
|
|
39
39
|
dishes: [
|
|
40
|
-
"Selección de quesos"
|
|
40
|
+
"Selección de quesos (D’Affinois, Brie Ermitage, Manchego semi curado, Roquefort)"
|
|
41
41
|
]
|
|
42
42
|
},
|
|
43
43
|
{
|
package/src/js/i18n.js
CHANGED
|
@@ -28,6 +28,15 @@ class Translator {
|
|
|
28
28
|
widgetTitle: "TROUVEZ VOTRE VIN PARFAIT",
|
|
29
29
|
widgetSubtitle: "Partagez tout ce que vous avez en tête—votre repas, humeur, budget ou occasion—et notre sommelier IA vous recommandera le vin parfait en quelques secondes",
|
|
30
30
|
searchPlaceholder: "Entrez un mot-clé ou une description",
|
|
31
|
+
wineDetails: {
|
|
32
|
+
reason: "Raison",
|
|
33
|
+
price: "Prix",
|
|
34
|
+
region: "Région",
|
|
35
|
+
type: "Type",
|
|
36
|
+
moreInfo: "Plus d'infos",
|
|
37
|
+
sommSelection: "Sélection Somm",
|
|
38
|
+
code: "Code"
|
|
39
|
+
},
|
|
31
40
|
searchButton: "Rechercher",
|
|
32
41
|
priceRange: "Gamme de prix",
|
|
33
42
|
wineColor: "Couleur du vin",
|
|
@@ -75,6 +84,15 @@ class Translator {
|
|
|
75
84
|
widgetTitle: "ENCUENTRA TU VINO PERFECTO",
|
|
76
85
|
widgetSubtitle: "Comparte cualquier cosa que tengas en mente—tu comida, estado de ánimo, presupuesto o evento—y nuestro sommelier de IA te recomendará el vino perfecto en segundos",
|
|
77
86
|
searchPlaceholder: "Escribe una palabra clave o descripción",
|
|
87
|
+
wineDetails: {
|
|
88
|
+
reason: "Razón",
|
|
89
|
+
price: "Precio",
|
|
90
|
+
region: "Región",
|
|
91
|
+
type: "Tipo",
|
|
92
|
+
code: "Código",
|
|
93
|
+
moreInfo: "Más información",
|
|
94
|
+
sommSelection: "Selección Somm"
|
|
95
|
+
},
|
|
78
96
|
searchButton: "Buscar",
|
|
79
97
|
priceRange: "Rango de precios",
|
|
80
98
|
wineColor: "Color del vino",
|
|
@@ -122,6 +140,15 @@ class Translator {
|
|
|
122
140
|
widgetTitle: "FIND YOUR PERFECT WINE",
|
|
123
141
|
widgetSubtitle: "Share anything on your mind—your meal, mood, budget, or occasion—and our AI sommelier will recommend the perfect wine in seconds",
|
|
124
142
|
searchPlaceholder: "Enter a keyword or description",
|
|
143
|
+
wineDetails: {
|
|
144
|
+
price: "Price",
|
|
145
|
+
region: "Region",
|
|
146
|
+
type: "Type",
|
|
147
|
+
moreInfo: "More info",
|
|
148
|
+
reason: "Reason",
|
|
149
|
+
sommSelection: "Somm Selection",
|
|
150
|
+
code: "Code"
|
|
151
|
+
},
|
|
125
152
|
searchButton: "Search",
|
|
126
153
|
priceRange: "Price Range",
|
|
127
154
|
wineColor: "Wine Color",
|
|
@@ -174,6 +201,15 @@ class Translator {
|
|
|
174
201
|
"Empfohlen für eine Party"
|
|
175
202
|
],
|
|
176
203
|
searchPlaceholder: "Geben Sie ein Stichwort oder eine Beschreibung ein",
|
|
204
|
+
wineDetails: {
|
|
205
|
+
price: "Preis",
|
|
206
|
+
region: "Region",
|
|
207
|
+
type: "Typ",
|
|
208
|
+
moreInfo: "Mehr Infos",
|
|
209
|
+
sommSelection: "Somm-Auswahl",
|
|
210
|
+
reason: "Grund",
|
|
211
|
+
code: "Code"
|
|
212
|
+
},
|
|
177
213
|
searchButton: "Suche",
|
|
178
214
|
priceRange: "Preisspanne",
|
|
179
215
|
wineColor: "Weinfarbe",
|
|
@@ -205,7 +241,18 @@ class Translator {
|
|
|
205
241
|
}
|
|
206
242
|
|
|
207
243
|
translate(key) {
|
|
208
|
-
|
|
244
|
+
const keys = key.split('.'); // Разбиваем ключ на части
|
|
245
|
+
let value = this.translations[this.language];
|
|
246
|
+
|
|
247
|
+
for (const k of keys) {
|
|
248
|
+
if (value && typeof value === 'object' && k in value) {
|
|
249
|
+
value = value[k]; // Переходим к следующему уровню
|
|
250
|
+
} else {
|
|
251
|
+
return key; // Если ключ не найден, возвращаем сам ключ
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return value;
|
|
209
256
|
}
|
|
210
257
|
}
|
|
211
258
|
|
package/src/js/widget-styles.js
CHANGED
package/src/js/widget.js
CHANGED
|
@@ -210,17 +210,20 @@ export class WineWidget {
|
|
|
210
210
|
|
|
211
211
|
wines.forEach((wine, index) => {
|
|
212
212
|
const wineHTML = `
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
</
|
|
213
|
+
<div class="wine-recommendation-tile ${wine.isSommSelection ? 'somm-selection' : ''}">
|
|
214
|
+
${wine.isSommSelection ? `<div class="somm-selection-badge">${translator.translate('wineDetails.sommSelection')}</div>` : ''}
|
|
215
|
+
${!!wine.image ? `<img src="${wine.image}" alt="${wine.title}" />` : '' }
|
|
216
|
+
<div class="tile-details">
|
|
217
|
+
<strong>${wine.title}</strong>
|
|
218
|
+
<p>${translator.translate('wineDetails.price')}: ${wine.price || 'N/A'}</p>
|
|
219
|
+
<p>${translator.translate('wineDetails.region')}: ${wine.region || 'N/A'}</p>
|
|
220
|
+
<p>${translator.translate('wineDetails.type')}: ${wine.type || 'N/A'}</p>
|
|
221
|
+
${this.widgetType === 'bar' ? `<p>${translator.translate('wineDetails.reason')}: ${wine.pairing_recommendation || 'N/A'}</p>` : ''}
|
|
222
|
+
${this.widgetType === 'bar'
|
|
223
|
+
? `<p>${translator.translate('wineDetails.code')}: ${wine.url || 'N/A'}</p>`
|
|
224
|
+
: `<a href="${wine.Url}" target="_blank">${translator.translate('wineDetails.moreInfo')}</a>`}
|
|
225
|
+
</div>
|
|
226
|
+
</div>
|
|
224
227
|
`;
|
|
225
228
|
resultsContainer.insertAdjacentHTML('beforeend', wineHTML);
|
|
226
229
|
|