wineater-bot 4.11.0 → 4.12.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wineater-bot",
3
- "version": "4.11.0",
3
+ "version": "4.12.0",
4
4
  "description": "",
5
5
  "main": "dist/wineater-chatbot.mjs",
6
6
  "module": "src/index.js",
package/src/App.svelte CHANGED
@@ -44,6 +44,9 @@
44
44
  // должен повторять именно тот запрос, что дал текущие results.
45
45
  let lastSearchedQuery = $state('');
46
46
  let hasMore = $state(false);
47
+ // Всё, что уже показывали по текущему запросу — «Try again» заменяет выдачу,
48
+ // и без накопления повторный клик вернул бы те же вина.
49
+ let seenIds = $state<string[]>([]);
47
50
  let appLanguage = $derived(appStore.getAppLanguage());
48
51
  let storeLanguage = $derived(appStore.getStoreLanguage());
49
52
  let apiKey = $derived(appStore.getApiKey());
@@ -138,6 +141,7 @@
138
141
  results = [];
139
142
  isAnimating = false;
140
143
  hasMore = false;
144
+ seenIds = [];
141
145
 
142
146
  query = searchQuery.trim() + ';';
143
147
  lastSearchedQuery = query;
@@ -184,16 +188,20 @@
184
188
  if (isLoadingMore || !hasMore) return;
185
189
  try {
186
190
  isLoadingMore = true;
187
- const excludeIds = results.map((w) => w.id);
191
+ // Карточки заменяются, а не дописываются, поэтому исключать надо всё
192
+ // показанное за сессию — иначе следующий клик вернёт те же вина.
193
+ seenIds = [...new Set([...seenIds, ...results.map((w) => w.id)])];
188
194
  const { recommendations, hasMore: more } = await wineaterApi.getMoreWineRecommendations(
189
195
  lastSearchedQuery,
190
- excludeIds
196
+ seenIds
191
197
  );
192
198
  trackWidgetEvent(WIDGET_EVENTS.SHOW_MORE_CLICKED, storeId, {
193
199
  query: lastSearchedQuery,
194
200
  results_count: recommendations.length
195
201
  });
196
- results = [...results, ...recommendations];
202
+ if (recommendations.length > 0) {
203
+ results = recommendations;
204
+ }
197
205
  hasMore = more;
198
206
  } catch (error) {
199
207
  console.error('[wineater] show more error:', error);
@@ -406,7 +414,7 @@
406
414
  {#if hasMore}
407
415
  <div class="wr-App-showMore">
408
416
  <Action handleClick={handleShowMore} variant="outlined">
409
- {getTranslation({ key: 'showMore', lang: appLanguage })}
417
+ {getTranslation({ key: 'tryAgain', lang: appLanguage })}
410
418
  </Action>
411
419
  </div>
412
420
  {/if}
@@ -287,11 +287,36 @@
287
287
  gap: 8px;
288
288
  }
289
289
 
290
- .wr-WineTile-action--similar {
291
- font-size: 13px;
290
+ /* :global обязателен — класс уезжает внутрь <Action>, а скоуп Svelte
291
+ действует только на разметку этого компонента, иначе правило отбрасывается
292
+ как неиспользуемое. Цвет тот же, что у Buy; подчёркивание выезжает слева. */
293
+ :global(.wr-WineTile-action--similar) {
294
+ font-size: 14px;
295
+ font-weight: 500;
292
296
  color: var(--wr-brand-color, #7b2beb);
293
- text-decoration: underline;
297
+ text-decoration: none;
298
+ background: transparent;
299
+ border: none;
294
300
  padding: 0;
301
+ position: relative;
302
+ }
303
+
304
+ :global(.wr-WineTile-action--similar)::after {
305
+ content: '';
306
+ position: absolute;
307
+ left: 0;
308
+ bottom: -2px;
309
+ width: 100%;
310
+ height: 1px;
311
+ background-color: currentColor;
312
+ transform: scaleX(0);
313
+ transform-origin: left;
314
+ transition: transform 180ms cubic-bezier(0.22, 0.61, 0.36, 1);
315
+ }
316
+
317
+ :global(.wr-WineTile-action--similar:hover)::after,
318
+ :global(.wr-WineTile-action--similar:focus-visible)::after {
319
+ transform: scaleX(1);
295
320
  }
296
321
 
297
322
  /* Hover popup inside tile */
@@ -17,7 +17,7 @@
17
17
  "type": "Type",
18
18
  "reason": "Suggestion",
19
19
  "moreInfo": "Plus d'infos",
20
- "showMore": "Plus de vins",
20
+ "tryAgain": "Réessayer",
21
21
  "similarWines": "Vins similaires",
22
22
  "byTheGlass": "Au verre",
23
23
  "winePairingIntro": "Pour ce vin, voici quelques suggestions de plats :",
@@ -83,7 +83,7 @@
83
83
  "type": "Tipo",
84
84
  "reason": "Sugerencia",
85
85
  "moreInfo": "Más info",
86
- "showMore": "Ver más",
86
+ "tryAgain": "Probar otra vez",
87
87
  "similarWines": "Vinos similares",
88
88
  "byTheGlass": "Por copa",
89
89
  "winePairingIntro": "Para este vino, aquí tienes algunas sugerencias de platos:",
@@ -149,7 +149,7 @@
149
149
  "type": "Type",
150
150
  "reason": "Suggestion",
151
151
  "moreInfo": "More info",
152
- "showMore": "Show more",
152
+ "tryAgain": "Try again",
153
153
  "similarWines": "Similar wines",
154
154
  "byTheGlass": "By the glass",
155
155
  "winePairingIntro": "For this wine, here are some suggested dishes:",
@@ -215,7 +215,7 @@
215
215
  "type": "Tip",
216
216
  "reason": "Preporuka",
217
217
  "moreInfo": "Više informacija",
218
- "showMore": "Prikaži još",
218
+ "tryAgain": "Pokušaj ponovo",
219
219
  "similarWines": "Slična vina",
220
220
  "byTheGlass": "Na čašu",
221
221
  "winePairingIntro": "Za ovo vino, preporučuju se sledeća jela:",
@@ -281,7 +281,7 @@
281
281
  "type": "Typ",
282
282
  "reason": "Anregung",
283
283
  "moreInfo": "Mehr Info",
284
- "showMore": "Mehr anzeigen",
284
+ "tryAgain": "Nochmal versuchen",
285
285
  "similarWines": "Ähnliche Weine",
286
286
  "byTheGlass": "Glasweise",
287
287
  "winePairingIntro": "Für diesen Wein gibt es folgende Essensvorschläge:",
@@ -346,7 +346,7 @@
346
346
  "type": "Тип",
347
347
  "reason": "Рекомендація",
348
348
  "moreInfo": "Докладніше",
349
- "showMore": "Показати ще",
349
+ "tryAgain": "Спробувати ще",
350
350
  "similarWines": "Схожі вина",
351
351
  "byTheGlass": "На келих",
352
352
  "winePairingIntro": "До цього вина підходять такі страви:",
@@ -412,7 +412,7 @@
412
412
  "type": "Тип",
413
413
  "reason": "Рекомендация",
414
414
  "moreInfo": "Подробнее",
415
- "showMore": "Ещё варианты",
415
+ "tryAgain": "Попробовать ещё",
416
416
  "similarWines": "Похожие вина",
417
417
  "byTheGlass": "По бокалам",
418
418
  "winePairingIntro": "К этому вину подходят следующие блюда:",
@@ -478,7 +478,7 @@
478
478
  "type": "Түрі",
479
479
  "reason": "Ұсыныс",
480
480
  "moreInfo": "Толығырақ",
481
- "showMore": "Тағы көрсету",
481
+ "tryAgain": "Қайта көру",
482
482
  "similarWines": "Ұқсас шараптар",
483
483
  "byTheGlass": "Бокалмен",
484
484
  "winePairingIntro": "Бұл шарапқа келесі тағамдар сәйкес келеді:",
@@ -544,7 +544,7 @@
544
544
  "type": "Tipo",
545
545
  "reason": "Sugestão",
546
546
  "moreInfo": "Mais informações",
547
- "showMore": "Mostrar mais",
547
+ "tryAgain": "Tentar de novo",
548
548
  "similarWines": "Vinhos semelhantes",
549
549
  "byTheGlass": "Por taça",
550
550
  "winePairingIntro": "Para este vinho, aqui estão algumas sugestões de pratos:",