wineater-bot 1.2.0 → 1.2.1

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.
@@ -1,7 +1,4 @@
1
- var p = Object.defineProperty;
2
- var g = (i, e, t) => e in i ? p(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var r = (i, e, t) => (g(i, typeof e != "symbol" ? e + "" : e, t), t);
4
- const h = `
1
+ const g = `
5
2
  @font-face {
6
3
  font-family: 'Poppins';
7
4
  src: url('https://fonts.googleapis.com/css2?family=Poppins:wght@400&display=swap');
@@ -277,13 +274,13 @@ const h = `
277
274
  visibility: visible;
278
275
  height: 50px;
279
276
  }`, c = document.createElement("style");
280
- c.textContent = h;
277
+ c.textContent = g;
281
278
  document.head.appendChild(c);
282
279
  function l() {
283
- const i = document.getElementById("chat-window"), e = document.getElementById("chat-icon");
284
- i.classList.contains("visible") ? (i.classList.remove("visible"), e.style.display = "flex") : (i.classList.add("visible"), e.style.display = "none");
280
+ const n = document.getElementById("chat-window"), t = document.getElementById("chat-icon");
281
+ n.classList.contains("visible") ? (n.classList.remove("visible"), t.style.display = "flex") : (n.classList.add("visible"), t.style.display = "none");
285
282
  }
286
- function m() {
283
+ function h() {
287
284
  document.getElementById("chat-window").classList.remove("visible");
288
285
  }
289
286
  function u() {
@@ -292,52 +289,120 @@ function u() {
292
289
  document.addEventListener("DOMContentLoaded", () => {
293
290
  setupCloseButton(), setupOutsideClick();
294
291
  });
295
- const f = ["climats", "telckel", "biobio", "weinpoint"];
296
- class b {
297
- constructor(e) {
298
- this.apiEndpoint = e || "https://api.wineater.com/dish/recommendations", this.store = f.find((t) => window.location.href.includes(t)), console.log(this.store);
292
+ const m = ["climats", "telckel", "biobio", "weinpoint"];
293
+ class p {
294
+ constructor(t) {
295
+ this.baseURL = "https://api.wineater.com/", this.store = m.find((e) => window.location.href.includes(e)), console.log(this.store);
299
296
  }
300
- async getWineRecommendations(e) {
297
+ async getStoreConfig(t) {
298
+ console.log(t);
299
+ try {
300
+ const e = await fetch(`${this.baseURL}stores/store`, {
301
+ method: "POST",
302
+ headers: {
303
+ "Content-Type": "application/json"
304
+ },
305
+ body: JSON.stringify({ store: t })
306
+ });
307
+ if (!e.ok)
308
+ throw new Error(`HTTP error! Status: ${e.status}`);
309
+ return await e.json();
310
+ } catch (e) {
311
+ throw console.error("Error fetching store configuration:", e), e;
312
+ }
313
+ }
314
+ async getWineRecommendations(t) {
301
315
  console.log(window.location.href);
302
316
  try {
303
- const t = await fetch(this.apiEndpoint, {
317
+ const e = await fetch(`${this.baseURL}dish/recommendations`, {
304
318
  method: "POST",
305
319
  headers: {
306
320
  "Content-Type": "application/json"
307
321
  },
308
- body: JSON.stringify({ text: e, store: this.store ? this.store.toString().charAt(0).toUpperCase() + this.store.slice(1) : void 0 })
309
- }), o = await t.json();
310
- if (!t.ok)
311
- throw new Error(`API call failed with status ${t.status}: ${o.message || "No additional error information"}`);
322
+ body: JSON.stringify({ text: t, store: this.store ? this.store.toString().charAt(0).toUpperCase() + this.store.slice(1) : void 0 })
323
+ }), o = await e.json();
324
+ if (!e.ok)
325
+ throw new Error(`API call failed with status ${e.status}: ${o.message || "No additional error information"}`);
312
326
  return o;
313
- } catch (t) {
314
- throw console.error("Fetching wine recommendations failed:", t.message), new Error(`Error in getWineRecommendations: ${t.message}`);
327
+ } catch (e) {
328
+ throw console.error("Fetching wine recommendations failed:", e.message), new Error(`Error in getWineRecommendations: ${e.message}`);
329
+ }
330
+ }
331
+ }
332
+ class f {
333
+ constructor() {
334
+ this.api = new p(), this.language = "en", this.translations = {
335
+ fr: {
336
+ 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?",
337
+ noResultsFound: "Aucun résultat trouvé.",
338
+ somethingWentWrong: "Désolé, quelque chose a mal tourné.",
339
+ chatButton: "Accorder le vin au dîner",
340
+ inputPlaceholder: "ex., Salade de thon",
341
+ sendButton: "Accorder",
342
+ price: "Prix",
343
+ region: "Région",
344
+ type: "Type",
345
+ moreInfo: "Plus d'infos"
346
+ },
347
+ es: {
348
+ 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?",
349
+ noResultsFound: "No se encontraron resultados.",
350
+ somethingWentWrong: "Lo sentimos, algo salió mal.",
351
+ chatButton: "Maridar vino con cena",
352
+ inputPlaceholder: "ej., Ensalada de atún",
353
+ sendButton: "Maridar",
354
+ price: "Precio",
355
+ region: "Región",
356
+ type: "Tipo",
357
+ moreInfo: "Más info"
358
+ },
359
+ en: {
360
+ welcomeMessage: "Enhance your dining experience. Just provide your dish details and get the ideal wine pairing. What would you like to eat?",
361
+ noResultsFound: "No results found.",
362
+ somethingWentWrong: "Sorry, something went wrong.",
363
+ chatButton: "Pair wine with dinner",
364
+ inputPlaceholder: "e.g., Tuna Salad",
365
+ sendButton: "Pair",
366
+ price: "Price",
367
+ region: "Region",
368
+ type: "Type",
369
+ moreInfo: "More info"
370
+ }
371
+ };
372
+ }
373
+ async fetchConfig(t) {
374
+ if (t) {
375
+ const e = await this.api.getStoreConfig(t);
376
+ this.language = e.lang;
315
377
  }
316
378
  }
379
+ translate(t) {
380
+ return this.translations[this.language][t] || t;
381
+ }
317
382
  }
383
+ const s = new f();
318
384
  class y {
319
385
  constructor() {
320
- r(this, "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?");
321
- this.api = new b(), this.displayFirstMessage(this.welcomeMessage);
386
+ this.api = new p(), this.displayFirstMessage(s.translate("welcomeMessage"));
322
387
  }
323
388
  initialize() {
324
389
  document.getElementById("send-button").addEventListener("click", () => this.handleUserInput()), document.getElementById("user-input").addEventListener("keypress", (o) => {
325
390
  o.key === "Enter" && this.handleUserInput();
326
391
  });
327
392
  }
328
- displayFirstMessage(e, t = "api") {
329
- const o = document.getElementById("message-container"), n = document.createElement("div");
330
- n.className = `message ${t}`, n.textContent = e, o.appendChild(n), o.scrollTop = o.scrollHeight;
393
+ displayFirstMessage(t, e = "api") {
394
+ const o = document.getElementById("message-container"), i = document.createElement("div");
395
+ i.className = `message ${e}`, i.textContent = t, o.appendChild(i), o.scrollTop = o.scrollHeight;
331
396
  }
332
397
  async handleUserInput() {
333
- const e = document.getElementById("user-input"), t = e.value.trim();
334
- if (t) {
335
- this.displayMessage(t, "user"), e.value = "", this.showTypingIndicator();
398
+ const t = document.getElementById("user-input"), e = t.value.trim();
399
+ if (e) {
400
+ this.displayMessage(e, "user"), t.value = "", this.showTypingIndicator();
336
401
  try {
337
- const o = await this.api.getWineRecommendations(t);
402
+ const o = await this.api.getWineRecommendations(e);
338
403
  this.hideTypingIndicator(), o && o.length ? this.displayResults(o) : this.displayMessage("No results found.", "api");
339
- } catch (o) {
340
- this.hideTypingIndicator(), console.error("Error fetching wine recommendations:", o), this.displayMessage("Sorry, something went wrong.", "api");
404
+ } catch {
405
+ this.hideTypingIndicator(), this.displayMessage(s.translate("somethingWentWrong"), "api");
341
406
  }
342
407
  }
343
408
  }
@@ -347,37 +412,37 @@ class y {
347
412
  hideTypingIndicator() {
348
413
  document.getElementById("typing-indicator").classList.remove("visible");
349
414
  }
350
- displayMessage(e, t) {
351
- const o = document.getElementById("message-container"), n = document.createElement("div");
352
- n.textContent = e, n.className = "message " + t, o.appendChild(n), o.scrollTop = o.scrollHeight;
415
+ displayMessage(t, e) {
416
+ const o = document.getElementById("message-container"), i = document.createElement("div");
417
+ i.textContent = t, i.className = "message " + e, o.appendChild(i), o.scrollTop = o.scrollHeight;
353
418
  }
354
- displayResults(e) {
355
- const t = document.getElementById("message-container");
356
- e.forEach((o) => {
357
- const n = document.createElement("div");
358
- n.className = "wine-item";
359
- const s = document.createElement("img");
360
- s.src = o.Image, n.appendChild(s);
361
- const a = document.createElement("div");
362
- a.innerHTML = `
363
- <strong>${o.Title}</strong><br>
364
- Prix: ${o.Price}<br>
365
- Région: ${o.Region}<br>
366
- Type: ${o.Type}<br>
367
- <a href="${o.Url}" target="_blank">Plus d'infos</a>
368
- `, n.appendChild(a), t.appendChild(n);
369
- }), t.scrollTop = t.scrollHeight;
419
+ displayResults(t) {
420
+ const e = document.getElementById("message-container");
421
+ t.forEach((o) => {
422
+ const i = document.createElement("div");
423
+ i.className = "wine-item";
424
+ const a = document.createElement("img");
425
+ a.src = o.Image, i.appendChild(a);
426
+ const r = document.createElement("div");
427
+ r.innerHTML = `
428
+ <strong>${o.Title}</strong><br>
429
+ ${s.translate("price")}: ${o.Price}<br>
430
+ ${s.translate("region")}: ${o.Region}<br>
431
+ ${s.translate("type")}: ${o.Type}<br>
432
+ <a href="${o.Url}" target="_blank">${s.translate("moreInfo")}</a>
433
+ `, i.appendChild(r), e.appendChild(i);
434
+ }), e.scrollTop = e.scrollHeight;
370
435
  }
371
436
  }
372
437
  document.addEventListener("DOMContentLoaded", () => {
373
- window.toggleChatWindow = l, window.closeChatWindow = m, window.openChatWindow = u;
438
+ window.toggleChatWindow = l, window.closeChatWindow = h, window.openChatWindow = u;
374
439
  });
375
- function w() {
376
- document.body.insertAdjacentHTML("beforeend", `
440
+ function b() {
441
+ const n = `
377
442
  <div id="chatbot-container">
378
443
  <div id="chat-icon" onclick="toggleChatWindow()">
379
444
  <img src="https://landing-static.s3.eu-central-1.amazonaws.com/images/chat-icon.svg" alt="Chat Icon"> <!-- Update the path to your logo image -->
380
- <span>Accorder le vin au dîner</span>
445
+ <span>${s.translate("chatButton")}</span>
381
446
  </div>
382
447
 
383
448
  <div id="chat-window" class="hidden">
@@ -394,35 +459,35 @@ function w() {
394
459
  <span></span><span></span><span></span>
395
460
  </div>
396
461
  <div id="input-container">
397
- <input type="text" id="user-input" placeholder="ex., Salade de thon">
398
- <button id="send-button">Accorder</button>
462
+ <input type="text" id="user-input" placeholder="${s.translate("inputPlaceholder")}">
463
+ <button id="send-button">${s.translate("sendButton")}</button>
399
464
  </div>
400
465
  </div>
401
466
  </div>
402
- `);
467
+ `;
468
+ document.body.insertAdjacentHTML("beforeend", n);
403
469
  }
404
- function x() {
470
+ function w() {
405
471
  document.getElementById("close-btn").addEventListener("click", l);
406
472
  }
407
- function v() {
408
- window.addEventListener("click", function(i) {
409
- const e = document.getElementById("chat-window"), t = document.getElementById("chat-icon");
410
- !e.contains(i.target) && !t.contains(i.target) && (e.classList.remove("visible"), t.style.display = "flex");
473
+ function x() {
474
+ window.addEventListener("click", function(n) {
475
+ const t = document.getElementById("chat-window"), e = document.getElementById("chat-icon");
476
+ !t.contains(n.target) && !e.contains(n.target) && (t.classList.remove("visible"), e.style.display = "flex");
411
477
  });
412
478
  }
413
- function d(i) {
414
- console.log(i);
415
- const e = document.getElementById("chat-icon"), t = document.getElementById("chat-window");
416
- e.className = "", t.className = "", i === "right-center" ? (e.classList.add("chat-icon-right-center"), t.classList.add("right-center-aligned")) : e.classList.add("chat-icon-bottom-right");
479
+ function d(n) {
480
+ console.log(n);
481
+ const t = document.getElementById("chat-icon"), e = document.getElementById("chat-window");
482
+ t.className = "", e.className = "", n === "right-center" ? (t.classList.add("chat-icon-right-center"), e.classList.add("right-center-aligned")) : t.classList.add("chat-icon-bottom-right");
417
483
  }
418
- typeof window < "u" && window.addEventListener("DOMContentLoaded", () => {
419
- const e = ["climats", "telckel", "biobio", "weinpoint"].find((o) => window.location.href.includes(o)) || null;
420
- w(), x(), v(), d(e && e === "biobio" ? "right-center" : "bottom-right"), new y().initialize();
484
+ typeof window < "u" && window.addEventListener("DOMContentLoaded", async () => {
485
+ const t = ["climats", "telckel", "biobio", "weinpoint"].find((i) => window.location.href.includes(i)) || null;
486
+ let e;
487
+ t && (e = t.charAt(0).toUpperCase() + t.slice(1)), await s.fetchConfig(e || null), b(), w(), x(), d(t && t === "biobio" ? "right-center" : "bottom-right"), new y().initialize();
421
488
  });
422
489
  export {
423
- m as closeChatWindow,
490
+ h as closeChatWindow,
424
491
  u as openChatWindow,
425
492
  l as toggleChatWindow
426
493
  };
427
-
428
-
@@ -1,4 +1,4 @@
1
- (function(n,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(n=typeof globalThis<"u"?globalThis:n||self,s(n.WineaterChatbot={}))})(this,function(n){"use strict";var v=Object.defineProperty;var E=(n,s,r)=>s in n?v(n,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[s]=r;var u=(n,s,r)=>(E(n,typeof s!="symbol"?s+"":s,r),r);const s=`
1
+ (function(a,r){typeof exports=="object"&&typeof module<"u"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(a=typeof globalThis<"u"?globalThis:a||self,r(a.WineaterChatbot={}))})(this,function(a){"use strict";const r=`
2
2
  @font-face {
3
3
  font-family: 'Poppins';
4
4
  src: url('https://fonts.googleapis.com/css2?family=Poppins:wght@400&display=swap');
@@ -273,17 +273,17 @@
273
273
  .typing-indicator.visible {
274
274
  visibility: visible;
275
275
  height: 50px;
276
- }`,r=document.createElement("style");r.textContent=s,document.head.appendChild(r);function d(){const i=document.getElementById("chat-window"),t=document.getElementById("chat-icon");i.classList.contains("visible")?(i.classList.remove("visible"),t.style.display="flex"):(i.classList.add("visible"),t.style.display="none")}function c(){document.getElementById("chat-window").classList.remove("visible")}function l(){document.getElementById("chat-window").classList.add("visible")}document.addEventListener("DOMContentLoaded",()=>{setupCloseButton(),setupOutsideClick()});const m=["climats","telckel","biobio","weinpoint"];class f{constructor(t){this.apiEndpoint=t||"https://api.wineater.com/dish/recommendations",this.store=m.find(e=>window.location.href.includes(e)),console.log(this.store)}async getWineRecommendations(t){console.log(window.location.href);try{const e=await fetch(this.apiEndpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:t,store:this.store?this.store.toString().charAt(0).toUpperCase()+this.store.slice(1):void 0})}),o=await e.json();if(!e.ok)throw new Error(`API call failed with status ${e.status}: ${o.message||"No additional error information"}`);return o}catch(e){throw console.error("Fetching wine recommendations failed:",e.message),new Error(`Error in getWineRecommendations: ${e.message}`)}}}class b{constructor(){u(this,"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?");this.api=new f,this.displayFirstMessage(this.welcomeMessage)}initialize(){document.getElementById("send-button").addEventListener("click",()=>this.handleUserInput()),document.getElementById("user-input").addEventListener("keypress",o=>{o.key==="Enter"&&this.handleUserInput()})}displayFirstMessage(t,e="api"){const o=document.getElementById("message-container"),a=document.createElement("div");a.className=`message ${e}`,a.textContent=t,o.appendChild(a),o.scrollTop=o.scrollHeight}async handleUserInput(){const t=document.getElementById("user-input"),e=t.value.trim();if(e){this.displayMessage(e,"user"),t.value="",this.showTypingIndicator();try{const o=await this.api.getWineRecommendations(e);this.hideTypingIndicator(),o&&o.length?this.displayResults(o):this.displayMessage("No results found.","api")}catch(o){this.hideTypingIndicator(),console.error("Error fetching wine recommendations:",o),this.displayMessage("Sorry, something went wrong.","api")}}}showTypingIndicator(){document.getElementById("typing-indicator").classList.add("visible")}hideTypingIndicator(){document.getElementById("typing-indicator").classList.remove("visible")}displayMessage(t,e){const o=document.getElementById("message-container"),a=document.createElement("div");a.textContent=t,a.className="message "+e,o.appendChild(a),o.scrollTop=o.scrollHeight}displayResults(t){const e=document.getElementById("message-container");t.forEach(o=>{const a=document.createElement("div");a.className="wine-item";const g=document.createElement("img");g.src=o.Image,a.appendChild(g);const h=document.createElement("div");h.innerHTML=`
277
- <strong>${o.Title}</strong><br>
278
- Prix: ${o.Price}<br>
279
- Région: ${o.Region}<br>
280
- Type: ${o.Type}<br>
281
- <a href="${o.Url}" target="_blank">Plus d'infos</a>
282
- `,a.appendChild(h),e.appendChild(a)}),e.scrollTop=e.scrollHeight}}document.addEventListener("DOMContentLoaded",()=>{window.toggleChatWindow=d,window.closeChatWindow=c,window.openChatWindow=l});function y(){document.body.insertAdjacentHTML("beforeend",`
276
+ }`,c=document.createElement("style");c.textContent=r,document.head.appendChild(c);function d(){const n=document.getElementById("chat-window"),t=document.getElementById("chat-icon");n.classList.contains("visible")?(n.classList.remove("visible"),t.style.display="flex"):(n.classList.add("visible"),t.style.display="none")}function l(){document.getElementById("chat-window").classList.remove("visible")}function p(){document.getElementById("chat-window").classList.add("visible")}document.addEventListener("DOMContentLoaded",()=>{setupCloseButton(),setupOutsideClick()});const f=["climats","telckel","biobio","weinpoint"];class g{constructor(t){this.baseURL="https://api.wineater.com/",this.store=f.find(e=>window.location.href.includes(e)),console.log(this.store)}async getStoreConfig(t){console.log(t);try{const e=await fetch(`${this.baseURL}stores/store`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({store:t})});if(!e.ok)throw new Error(`HTTP error! Status: ${e.status}`);return await e.json()}catch(e){throw console.error("Error fetching store configuration:",e),e}}async getWineRecommendations(t){console.log(window.location.href);try{const e=await fetch(`${this.baseURL}dish/recommendations`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:t,store:this.store?this.store.toString().charAt(0).toUpperCase()+this.store.slice(1):void 0})}),o=await e.json();if(!e.ok)throw new Error(`API call failed with status ${e.status}: ${o.message||"No additional error information"}`);return o}catch(e){throw console.error("Fetching wine recommendations failed:",e.message),new Error(`Error in getWineRecommendations: ${e.message}`)}}}class y{constructor(){this.api=new g,this.language="en",this.translations={fr:{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?",noResultsFound:"Aucun résultat trouvé.",somethingWentWrong:"Désolé, quelque chose a mal tourné.",chatButton:"Accorder le vin au dîner",inputPlaceholder:"ex., Salade de thon",sendButton:"Accorder",price:"Prix",region:"Région",type:"Type",moreInfo:"Plus d'infos"},es:{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?",noResultsFound:"No se encontraron resultados.",somethingWentWrong:"Lo sentimos, algo salió mal.",chatButton:"Maridar vino con cena",inputPlaceholder:"ej., Ensalada de atún",sendButton:"Maridar",price:"Precio",region:"Región",type:"Tipo",moreInfo:"Más info"},en:{welcomeMessage:"Enhance your dining experience. Just provide your dish details and get the ideal wine pairing. What would you like to eat?",noResultsFound:"No results found.",somethingWentWrong:"Sorry, something went wrong.",chatButton:"Pair wine with dinner",inputPlaceholder:"e.g., Tuna Salad",sendButton:"Pair",price:"Price",region:"Region",type:"Type",moreInfo:"More info"}}}async fetchConfig(t){if(t){const e=await this.api.getStoreConfig(t);this.language=e.lang}}translate(t){return this.translations[this.language][t]||t}}const s=new y;class b{constructor(){this.api=new g,this.displayFirstMessage(s.translate("welcomeMessage"))}initialize(){document.getElementById("send-button").addEventListener("click",()=>this.handleUserInput()),document.getElementById("user-input").addEventListener("keypress",o=>{o.key==="Enter"&&this.handleUserInput()})}displayFirstMessage(t,e="api"){const o=document.getElementById("message-container"),i=document.createElement("div");i.className=`message ${e}`,i.textContent=t,o.appendChild(i),o.scrollTop=o.scrollHeight}async handleUserInput(){const t=document.getElementById("user-input"),e=t.value.trim();if(e){this.displayMessage(e,"user"),t.value="",this.showTypingIndicator();try{const o=await this.api.getWineRecommendations(e);this.hideTypingIndicator(),o&&o.length?this.displayResults(o):this.displayMessage("No results found.","api")}catch{this.hideTypingIndicator(),this.displayMessage(s.translate("somethingWentWrong"),"api")}}}showTypingIndicator(){document.getElementById("typing-indicator").classList.add("visible")}hideTypingIndicator(){document.getElementById("typing-indicator").classList.remove("visible")}displayMessage(t,e){const o=document.getElementById("message-container"),i=document.createElement("div");i.textContent=t,i.className="message "+e,o.appendChild(i),o.scrollTop=o.scrollHeight}displayResults(t){const e=document.getElementById("message-container");t.forEach(o=>{const i=document.createElement("div");i.className="wine-item";const u=document.createElement("img");u.src=o.Image,i.appendChild(u);const m=document.createElement("div");m.innerHTML=`
277
+ <strong>${o.Title}</strong><br>
278
+ ${s.translate("price")}: ${o.Price}<br>
279
+ ${s.translate("region")}: ${o.Region}<br>
280
+ ${s.translate("type")}: ${o.Type}<br>
281
+ <a href="${o.Url}" target="_blank">${s.translate("moreInfo")}</a>
282
+ `,i.appendChild(m),e.appendChild(i)}),e.scrollTop=e.scrollHeight}}document.addEventListener("DOMContentLoaded",()=>{window.toggleChatWindow=d,window.closeChatWindow=l,window.openChatWindow=p});function w(){const n=`
283
283
  <div id="chatbot-container">
284
284
  <div id="chat-icon" onclick="toggleChatWindow()">
285
285
  <img src="https://landing-static.s3.eu-central-1.amazonaws.com/images/chat-icon.svg" alt="Chat Icon"> <!-- Update the path to your logo image -->
286
- <span>Accorder le vin au dîner</span>
286
+ <span>${s.translate("chatButton")}</span>
287
287
  </div>
288
288
 
289
289
  <div id="chat-window" class="hidden">
@@ -300,9 +300,9 @@
300
300
  <span></span><span></span><span></span>
301
301
  </div>
302
302
  <div id="input-container">
303
- <input type="text" id="user-input" placeholder="ex., Salade de thon">
304
- <button id="send-button">Accorder</button>
303
+ <input type="text" id="user-input" placeholder="${s.translate("inputPlaceholder")}">
304
+ <button id="send-button">${s.translate("sendButton")}</button>
305
305
  </div>
306
306
  </div>
307
307
  </div>
308
- `)}function w(){document.getElementById("close-btn").addEventListener("click",d)}function x(){window.addEventListener("click",function(i){const t=document.getElementById("chat-window"),e=document.getElementById("chat-icon");!t.contains(i.target)&&!e.contains(i.target)&&(t.classList.remove("visible"),e.style.display="flex")})}function p(i){console.log(i);const t=document.getElementById("chat-icon"),e=document.getElementById("chat-window");t.className="",e.className="",i==="right-center"?(t.classList.add("chat-icon-right-center"),e.classList.add("right-center-aligned")):t.classList.add("chat-icon-bottom-right")}typeof window<"u"&&window.addEventListener("DOMContentLoaded",()=>{const t=["climats","telckel","biobio","weinpoint"].find(o=>window.location.href.includes(o))||null;y(),w(),x(),p(t&&t==="biobio"?"right-center":"bottom-right"),new b().initialize()}),n.closeChatWindow=c,n.openChatWindow=l,n.toggleChatWindow=d,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
308
+ `;document.body.insertAdjacentHTML("beforeend",n)}function x(){document.getElementById("close-btn").addEventListener("click",d)}function v(){window.addEventListener("click",function(n){const t=document.getElementById("chat-window"),e=document.getElementById("chat-icon");!t.contains(n.target)&&!e.contains(n.target)&&(t.classList.remove("visible"),e.style.display="flex")})}function h(n){console.log(n);const t=document.getElementById("chat-icon"),e=document.getElementById("chat-window");t.className="",e.className="",n==="right-center"?(t.classList.add("chat-icon-right-center"),e.classList.add("right-center-aligned")):t.classList.add("chat-icon-bottom-right")}typeof window<"u"&&window.addEventListener("DOMContentLoaded",async()=>{const t=["climats","telckel","biobio","weinpoint"].find(i=>window.location.href.includes(i))||null;let e;t&&(e=t.charAt(0).toUpperCase()+t.slice(1)),await s.fetchConfig(e||null),w(),x(),v(),h(t&&t==="biobio"?"right-center":"bottom-right"),new b().initialize()}),a.closeChatWindow=l,a.openChatWindow=p,a.toggleChatWindow=d,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wineater-bot",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "src/index.js",