wineater-bot 4.9.6 → 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/dist/wineater-chatbot.mjs +2998 -2948
- package/dist/wineater-chatbot.umd.js +23 -23
- package/package.json +1 -1
- package/src/App.svelte +10 -0
- package/src/components/Header.svelte +32 -3
- package/src/components/WineTile.svelte +3 -0
- package/src/components/ui/Action.svelte +1 -1
- package/src/services/ui-config/projects-config 2.ts +72 -0
- package/src/services/ui-config/projects-config.ts +1 -0
- package/src/services/ui-config/types.ts +1 -0
package/package.json
CHANGED
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}
|
|
@@ -7,13 +7,42 @@
|
|
|
7
7
|
import Fish from './icons/Fish.svelte';
|
|
8
8
|
|
|
9
9
|
let lang = $derived(appStore.getAppLanguage());
|
|
10
|
-
|
|
10
|
+
let uiConfig = $derived(appStore.getUiConfig());
|
|
11
|
+
let titleText = $derived(window?.wineaterData?.TITLE_TEXT || uiConfig?.titleText || null);
|
|
11
12
|
let ShowedIcon = $state(Meat);
|
|
13
|
+
|
|
14
|
+
// splits a custom title into text/keyword segments so the meal/mood/occasion
|
|
15
|
+
// icons can be placed right next to their matching word
|
|
16
|
+
function splitTitleText(text: string) {
|
|
17
|
+
return text
|
|
18
|
+
.split(/(meal|mood|occasion)/gi)
|
|
19
|
+
.map((part) => ({ keyword: /^(meal|mood|occasion)$/i.test(part) ? part.toLowerCase() : null, text: part }));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let titleSegments = $derived(titleText ? splitTitleText(titleText) : null);
|
|
12
23
|
</script>
|
|
13
24
|
|
|
14
25
|
<div class="wr-Header">
|
|
15
|
-
{#if
|
|
16
|
-
<h1 class="wr-Header-title">
|
|
26
|
+
{#if titleSegments}
|
|
27
|
+
<h1 class="wr-Header-title">
|
|
28
|
+
{#each titleSegments as segment}
|
|
29
|
+
{#if segment.keyword === 'meal'}
|
|
30
|
+
<span onmouseenter={() => (ShowedIcon = Fish)} onmouseleave={() => (ShowedIcon = Meat)}>
|
|
31
|
+
<ShowedIcon className="wr-Header-icon" size="28" />
|
|
32
|
+
</span><span class="wr-Header-label">{segment.text}</span>
|
|
33
|
+
{:else if segment.keyword === 'mood'}
|
|
34
|
+
<Heart className="wr-Header-icon" size="28" /><span class="wr-Header-label"
|
|
35
|
+
>{segment.text}</span
|
|
36
|
+
>
|
|
37
|
+
{:else if segment.keyword === 'occasion'}
|
|
38
|
+
<Diamond className="wr-Header-icon" size="28" /><span class="wr-Header-label"
|
|
39
|
+
>{segment.text}</span
|
|
40
|
+
>
|
|
41
|
+
{:else}
|
|
42
|
+
{segment.text}
|
|
43
|
+
{/if}
|
|
44
|
+
{/each}
|
|
45
|
+
</h1>
|
|
17
46
|
{:else}
|
|
18
47
|
<h1 class="wr-Header-title">
|
|
19
48
|
{getTranslation({ key: 'headerLine1', lang })}
|
|
@@ -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"
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ProjectUiConfig } from "./types";
|
|
2
|
+
|
|
3
|
+
export const projectConfigs: Record<string, ProjectUiConfig> = {
|
|
4
|
+
"0": {
|
|
5
|
+
logoUrl: null,
|
|
6
|
+
brandColor: "#7B2BEB",
|
|
7
|
+
},
|
|
8
|
+
"25": {
|
|
9
|
+
logoUrl: null,
|
|
10
|
+
brandColor: "#000000",
|
|
11
|
+
wineaterColor: "#000000",
|
|
12
|
+
buttonUppercase: true,
|
|
13
|
+
customCss: `
|
|
14
|
+
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
|
|
15
|
+
:root { --wineater-font-primary: 'Roboto', sans-serif; }
|
|
16
|
+
#wr-Custom {
|
|
17
|
+
.wr-Search-input {
|
|
18
|
+
border-color: #7c7c7c;
|
|
19
|
+
color: #7c7c7c;
|
|
20
|
+
}
|
|
21
|
+
.wr-Search-button:hover {
|
|
22
|
+
background: #E3BE8D;
|
|
23
|
+
opacity: 1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.wr-WineTile-params {
|
|
27
|
+
color: #7c7c7c;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.wr-WineTilePopup-reason {
|
|
31
|
+
color: #000000;
|
|
32
|
+
}
|
|
33
|
+
.wr-WineTilePopup-tag {
|
|
34
|
+
color: #000000;
|
|
35
|
+
background: rgba(239,239,239,0.7);
|
|
36
|
+
border-color: transparent;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.wr-WineTile-action {
|
|
40
|
+
background: transparent;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.wr-WineTile-action:hover {
|
|
44
|
+
background: #000000;
|
|
45
|
+
color: #ffffff;
|
|
46
|
+
box-shadow: none;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
`,
|
|
50
|
+
translations: {
|
|
51
|
+
fr: {
|
|
52
|
+
"wineDetails.buy": "voir plus"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"21": {
|
|
57
|
+
logoUrl: "https://www.intermarche.com/images/logoIntermarche.svg",
|
|
58
|
+
brandColor: "#B81242",
|
|
59
|
+
wineaterColor: "#7B2BEB",
|
|
60
|
+
buttonUppercase: true,
|
|
61
|
+
customCss: "",
|
|
62
|
+
translations: {}
|
|
63
|
+
},
|
|
64
|
+
"26": {
|
|
65
|
+
logoUrl: "https://paladarlondon.com/wp-content/uploads/2021/05/cropped-cropped-Paladar-Logo-1473x464-min-768x219.png",
|
|
66
|
+
brandColor: "#B81242",
|
|
67
|
+
wineaterColor: "#7B2BEB",
|
|
68
|
+
buttonUppercase: true,
|
|
69
|
+
customCss: "",
|
|
70
|
+
translations: {}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
@@ -124,6 +124,7 @@ export const projectConfigs: Record<string, ProjectUiConfig> = {
|
|
|
124
124
|
logoUrl: null,
|
|
125
125
|
brandColor: "#8bae98",
|
|
126
126
|
wineaterColor: "#8bae98",
|
|
127
|
+
titleText: "Looking for the perfect bottle? Ask our AI Sommelier for personalised recommendations, whatever the meal, mood or occasion.",
|
|
127
128
|
customCss: `
|
|
128
129
|
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500&display=swap');
|
|
129
130
|
:root { --wineater-font-primary: 'Montserrat', Verdana, Helvetica, Arial, sans-serif; }
|
|
@@ -7,6 +7,7 @@ export type ProjectUiConfig = {
|
|
|
7
7
|
wineaterColor?: string;
|
|
8
8
|
customCss?: string | null;
|
|
9
9
|
buttonUppercase?: boolean;
|
|
10
|
+
titleText?: string | null;
|
|
10
11
|
translations?: Partial<Record<LanguageCode, Record<string, string>>>;
|
|
11
12
|
}
|
|
12
13
|
export type UiConfig = ProjectUiConfig & {
|