wineater-bot 4.9.7 → 4.9.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wineater-bot",
3
- "version": "4.9.7",
3
+ "version": "4.9.8",
4
4
  "description": "",
5
5
  "main": "dist/wineater-chatbot.mjs",
6
6
  "module": "src/index.js",
package/src/App.svelte CHANGED
@@ -200,6 +200,15 @@
200
200
  });
201
201
  }
202
202
 
203
+ function handleBuyLinkClick(wine: Wine | RecommendedWine, index: number) {
204
+ trackWidgetEvent(WIDGET_EVENTS.BUY_BUTTON_CLICKED, storeId, {
205
+ wine_id: wine.id,
206
+ wine_title: wine.title,
207
+ wine_url: wine.url,
208
+ is_mobile: window.innerWidth <= 768
209
+ });
210
+ }
211
+
203
212
  function closePopup() {
204
213
  const wine = results.find((w) => w.id === selectedWineId);
205
214
  trackWidgetEvent(WIDGET_EVENTS.WINE_DETAILS_CLOSED, storeId, {
@@ -314,6 +323,7 @@
314
323
  {isAnimating}
315
324
  translatedPopup={translatedPopups[index]}
316
325
  onBuyClick={handleBuyBtnClick}
326
+ onBuyLinkClick={handleBuyLinkClick}
317
327
  onPopupClose={closePopup}
318
328
  {onTileEnter}
319
329
  {onTileLeave}
@@ -17,6 +17,7 @@
17
17
  onTileLeave,
18
18
  onTileClick,
19
19
  onBuyClick,
20
+ onBuyLinkClick,
20
21
  onPopupClose,
21
22
  isAnimating,
22
23
  translatedPopup
@@ -29,6 +30,7 @@
29
30
  onTileLeave: (wine: Wine | RecommendedWine) => void;
30
31
  onTileClick: (event: MouseEvent, wine: Wine | RecommendedWine) => void;
31
32
  onBuyClick: (wine: Wine | RecommendedWine, index: number) => void;
33
+ onBuyLinkClick: (wine: Wine | RecommendedWine, index: number) => void;
32
34
  onPopupClose: () => void;
33
35
  isAnimating: boolean;
34
36
  translatedPopup: Partial<RecommendedWine> | null;
@@ -114,6 +116,7 @@
114
116
  {#if wine.url}
115
117
  <Action
116
118
  href={wine.url}
119
+ handleClick={() => onBuyLinkClick(wine, index)}
117
120
  className="wr-WineTile-action wr-WineTile-action--link js-WineTileAction"
118
121
  target="_blank"
119
122
  variant="outlined"
@@ -25,7 +25,7 @@
25
25
  </script>
26
26
 
27
27
  {#if href}
28
- <a class={calculatedClassName} {href} {id} {target} rel="noopener noreferrer">
28
+ <a class={calculatedClassName} {href} {id} {target} rel="noopener noreferrer" onclick={handleClick}>
29
29
  <slot></slot>
30
30
  </a>
31
31
  {:else}