wineater-bot 2.0.1 → 2.1.0

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/src/js/chatbot.js CHANGED
@@ -89,16 +89,24 @@ export class Chatbot {
89
89
  }
90
90
 
91
91
  displayResults(wines) {
92
+ console.log(wines);
92
93
  const messageContainer = document.getElementById('message-container');
93
94
  trackRecommendationsGet(wines.map(value => value.Title));
94
95
  wines.forEach(wine => {
96
+
97
+ const recDiv = document.createElement('div');
98
+ recDiv.className = 'wine-recommendation';
99
+
95
100
  const wineDiv = document.createElement('div');
96
101
  wineDiv.className = 'wine-item';
102
+ recDiv.appendChild(wineDiv);
97
103
 
98
104
  const image = document.createElement('img');
99
105
  image.src = wine.Image;
100
106
  wineDiv.appendChild(image);
101
107
 
108
+ console.log(wineDiv, 'wine div');
109
+
102
110
  const contentDiv = document.createElement('div');
103
111
  contentDiv.innerHTML = `
104
112
  <strong>${wine.Title}</strong><br>
@@ -116,11 +124,16 @@ export class Chatbot {
116
124
  window.open(wine.Url, '_blank'); // Open the link in a new tab
117
125
  });
118
126
  wineDiv.appendChild(contentDiv);
127
+
128
+ const reasonDiv = document.createElement('div');
129
+ reasonDiv.className = 'wine-description';
130
+ reasonDiv.innerHTML = wine.Reason;
131
+ recDiv.appendChild(reasonDiv);
119
132
  // const suggestionDiv = document.createElement('div');
120
133
  // suggestionDiv.innerHTML = `${translator.translate('reason')}: ${wine.Reason}<br>`;
121
134
  // wineDiv.appendChild(suggestionDiv);
122
- messageContainer.appendChild(wineDiv);
123
- this.displayFirstMessage(wine.Reason);
135
+ console.log(recDiv);
136
+ messageContainer.appendChild(recDiv);
124
137
  });
125
138
  messageContainer.scrollTop = messageContainer.scrollHeight;
126
139
  }
package/src/js/i18n.js CHANGED
@@ -6,12 +6,17 @@ class Translator {
6
6
  this.language = 'en'; // Default to English
7
7
  this.translations = {
8
8
  fr: {
9
- welcomeMessage: "Sublimez votre expérience gastronomique. Il vous suffit de donner les détails de votre plat, et obtenez la recommandation de compagnon de vin idéale. Que voulez-vous manger?",
9
+ welcomeMessage: "Quel plat allez-vous déguster ? Décrivez-le-moi et je vous proposerai le vin qui l'accompagnera parfaitement.",
10
10
  noResultsFound: "Aucun résultat trouvé.",
11
11
  somethingWentWrong: "Désolé, quelque chose a mal tourné.",
12
- chatButton: "Accorder le vin au dîner",
12
+ chatButton1: "Trouvez l'accord parfait",
13
+ chatButton2: "Associez le vin",
14
+ chatButton3: "Obtenez des conseils",
15
+ chatTitle: "Accord Mets & Vins 🍷",
16
+ chatSubtitle: "Décrivez votre plat et obtenez une recommandation en 30 secondes",
13
17
  inputPlaceholder: "ex., Salade de thon",
14
18
  sendButton: "Accorder",
19
+ poweredBy: "Propulsé par",
15
20
  price: "Prix",
16
21
  region: "Région",
17
22
  type: "Type",
@@ -22,12 +27,17 @@ class Translator {
22
27
  clearChatButton: "Effacer le chat"
23
28
  },
24
29
  es: {
25
- welcomeMessage: "Mejore su experiencia gastronómica. Solo proporcione los detalles de su plato y obtenga la recomendación de vino ideal. ¿Qué le gustaría comer?",
30
+ welcomeMessage: "¿Qué vas a comer? Cuéntame tu plato y te recomendaré el maridaje perfecto.",
26
31
  noResultsFound: "No se encontraron resultados.",
27
32
  somethingWentWrong: "Lo sentimos, algo salió mal.",
28
- chatButton: "Maridaje ideal",
33
+ chatButton1: "Encuentra tu maridaje",
34
+ chatButton2: "Combina vino ya",
35
+ chatButton3: "Recibe asesoría ahora",
36
+ chatTitle: "Maridaje de Vinos 🍷",
37
+ chatSubtitle: "Describe tu comida y obtén una recomendación en 30 segundos",
29
38
  inputPlaceholder: "ej., Ensalada de atún",
30
- sendButton: "Maridar",
39
+ sendButton: "Combinar",
40
+ poweredBy: "Desarrollado por",
31
41
  price: "Precio",
32
42
  region: "Región",
33
43
  type: "Tipo",
@@ -38,12 +48,17 @@ class Translator {
38
48
  clearChatButton: "Limpiar el chat"
39
49
  },
40
50
  en: {
41
- welcomeMessage: "Enhance your dining experience. Just provide your dish details and get the ideal wine pairing. What would you like to eat?",
51
+ welcomeMessage: "What are you planning to eat? Share your dish and I'll recommend the perfect wine pairing for your meal.",
42
52
  noResultsFound: "No results found.",
43
53
  somethingWentWrong: "Sorry, something went wrong.",
44
- chatButton: "Pair wine with dinner",
45
- inputPlaceholder: "e.g., Tuna Salad",
46
- sendButton: "Pair",
54
+ chatButton1: "Find Your Pairing",
55
+ chatButton2: "Pair Wine Now",
56
+ chatButton3: "Get Wine Advice",
57
+ chatTitle: "Wine Pairing Assistant 🍷",
58
+ chatSubtitle: "Describe your meal and get a recommendation in 30 seconds",
59
+ inputPlaceholder: "e.g., Tuna salad",
60
+ sendButton: "Match",
61
+ poweredBy: "Powered by",
47
62
  price: "Price",
48
63
  region: "Region",
49
64
  type: "Type",
@@ -54,12 +69,17 @@ class Translator {
54
69
  clearChatButton: "Clear Chat"
55
70
  },
56
71
  de: {
57
- welcomeMessage: "Verbessern Sie Ihr kulinarisches Erlebnis. Geben Sie einfach die Details Ihres Gerichts an und erhalten Sie die ideale Weinempfehlung. Was möchten Sie essen?",
72
+ welcomeMessage: "Was möchten Sie essen? Beschreiben Sie Ihr Gericht und ich empfehle Ihnen den perfekten Wein dazu.",
58
73
  noResultsFound: "Keine Ergebnisse gefunden.",
59
74
  somethingWentWrong: "Entschuldigung, etwas ist schief gelaufen.",
60
- chatButton: "Wein zum Abendessen",
75
+ chatButton1: "Finde Dein Pairing",
76
+ chatButton2: "Wein jetzt wählen",
77
+ chatButton3: "Erhalte Weinberatung",
78
+ chatTitle: "Wein & Speisen 🍷",
79
+ chatSubtitle: "Beschreiben Sie Ihr Gericht und erhalten Sie in 30 Sekunden eine Empfehlung",
61
80
  inputPlaceholder: "z.B., Thunfischsalat",
62
81
  sendButton: "Kombinieren",
82
+ poweredBy: "Unterstützt von",
63
83
  price: "Preis",
64
84
  region: "Region",
65
85
  type: "Typ",
@@ -72,13 +92,16 @@ class Translator {
72
92
  };
73
93
  }
74
94
 
75
- async fetchConfig(storeName = 'Demo') {
95
+ async fetchConfig(storeName) {
96
+ console.log(storeName);
76
97
  try {
77
98
  const config = await this.api.getStoreConfig(storeName);
99
+ console.log(config);
78
100
  this.language = config.lang;
79
101
  } catch (e) {
80
102
  this.language = 'en'; // Fallback to English
81
103
  }
104
+ console.log(this.language);
82
105
  }
83
106
 
84
107
  translate(key) {