wineater-bot 3.9.2 → 3.9.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
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Chatbot</title>
7
- <script>window.wineaterData = {CLIENT_TOKEN: 'Zp2mEPch8TaUtdXJ1oUYmtiW18EAeI8dZJRi7FMBCC3zzu6v41fxjUDRSIRK1Z1R', TYPE: 'widget', WIDGET_TYPE: 'store', WIDGET_WRAPPER: 'wineater-widget-conteiner'};</script>
7
+ <script>window.wineaterData = {CLIENT_TOKEN: 'l3yovIe7qdAkOCO9ZJMb0sOZLWJArwQkHkeC5Fj7IBox5GPGJoaL32dC4WRQ4Yli', WIDGET_TYPE: 'bar'};</script>
8
8
  <!-- <script type="module" src="./dist/wineater-chatbot.umd.js"></script> -->
9
9
  <script type="module" src="./src/index.js"></script>
10
10
  </head>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wineater-bot",
3
- "version": "3.9.2",
3
+ "version": "3.9.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "src/index.js",
package/src/js/widget.js CHANGED
@@ -50,6 +50,9 @@ export class WineWidget {
50
50
  this.ui.initializeSearchAnimation();
51
51
  this.search.loadInstantRecommendations();
52
52
  this.language.createLanguageSwitcher();
53
+ this.trackEvent(WIDGET_EVENTS.WIDGET_INITIALIZED, {
54
+ store_id: this.storeId
55
+ });
53
56
  }
54
57
 
55
58
  displayResults(wines, isAnimated = false) {
@@ -134,7 +137,18 @@ export class WineWidget {
134
137
  resultsContainer.insertAdjacentHTML('beforeend', wineHTML);
135
138
  const currentCard = resultsContainer.children[index];
136
139
 
137
- if (!url) {
140
+ // Add click tracking for wine cards
141
+ currentCard.addEventListener('click', (e) => {
142
+ // Don't track clicks on buy buttons or close buttons
143
+ if (!e.target.closest('.buy-btn') && !e.target.closest('.card-popup-close')) {
144
+ this.trackEvent(WIDGET_EVENTS.WINE_CARD_CLICK, {
145
+ wine_id: wine.ID,
146
+ wine_title: wine.title || wine.Title
147
+ });
148
+ }
149
+ });
150
+
151
+ if (!url && this.widgetType === 'bar') {
138
152
  const buyBtn = currentCard.querySelector('[data-toggle-info]');
139
153
  const popup = currentCard.querySelector('.card-popup');
140
154
  const closeBtn = currentCard.querySelector('.card-popup-close');