Skip to content

Commit f158556

Browse files
mzanonibrianhdk
andauthored
feat: Shoppertainment (#86)
* feat: Shoppertainment * Update to new sdk api * tweaks * dwell * clean up * wip * review * Update src/views/Feed.vue Co-authored-by: Brian Holmgård Kristensen <bhk@relewise.com> * clean up * fixes --------- Co-authored-by: Brian Holmgård Kristensen <bhk@relewise.com>
1 parent 113d64e commit f158556

File tree

15 files changed

+499
-105
lines changed

15 files changed

+499
-105
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@
4848
"vue-eslint-parser": "^10.2.0",
4949
"vue-tsc": "^3.1.1"
5050
}
51-
}
51+
}

public/waves-pink.svg

Lines changed: 46 additions & 0 deletions
Loading

src/components/ContentTile.vue

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,19 @@ const displayName = computed(() => {
4040
</script>
4141

4242
<template>
43-
<RouterLink
44-
:to="{ name: 'content', params: { id: content.contentId } }"
45-
class="relative flex flex-col overflow-hidden bg-white text-slate-900 hover:!text-brand-500 transition duration-200 h-full">
43+
<RouterLink :to="{ name: 'content', params: { id: content.contentId } }"
44+
class="relative flex flex-col overflow-hidden text-slate-900 hover:!text-brand-500 transition duration-200 h-full">
4645
<div class="mt-2 flex gap-4 items-start h-full">
47-
<div v-if="findImage(content)"
48-
class="flex-shrink-0"
49-
:class="showSummary ? 'w-36 h-36' : 'w-28 h-28'">
50-
<Image :entity="content"/>
46+
<div v-if="findImage(content)" class="flex-shrink-0" :class="showSummary ? 'w-36 h-36' : 'w-28 h-28'">
47+
<Image :entity="content" />
5148
</div>
5249

5350
<div class="text-left flex flex-col flex-1 h-full">
54-
<h5 class="tracking-tight font-medium"
55-
:class="showSummary ? 'text-2xl' : 'text-lg'"
51+
<h5 class="tracking-tight font-medium" :class="showSummary ? 'text-2xl' : 'text-lg'"
5652
v-html="displayName">
5753
</h5>
58-
<span v-if="showSummary" class="text-slate-700 flex-1 mt-1 overflow-hidden line-clamp-2" v-html="summarySnippet"></span>
54+
<span v-if="showSummary" class="text-slate-700 flex-1 mt-1 overflow-hidden line-clamp-2"
55+
v-html="summarySnippet"></span>
5956
<div v-if="showSummary" class="mt-3 flex justify-end">
6057
<ContentSentimentButtons :content="content" />
6158
</div>

src/components/DatasetSettings.vue

Lines changed: 60 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
</button>
1414
<div class="flex-grow">
1515
<label class="text-sm block">Select dataset</label>
16-
<select :value="context.datasetId"
17-
class="mb-6"
18-
@change="setDataset(($event.target as HTMLInputElement).value)">
16+
<select :value="context.datasetId" class="mb-6"
17+
@change="setDataset(($event.target as HTMLInputElement).value)">
1918
<option v-for="dataset in datasets" :key="dataset.datasetId" :value="dataset.datasetId">
2019
{{ dataset.displayName }} ({{ dataset.datasetId }})
2120
</option>
@@ -46,17 +45,11 @@
4645
<label class="text-sm block mt-6">API Key</label>
4746
<input v-model="context.apiKey" type="text" placeholder="Api key">
4847

49-
<ListValues label="Languages"
50-
:items="context.allLanguages"
51-
:single-item="context.language"
52-
input-placeholder="LanguageCode"
53-
new-item-placeholder="New Language"/>
48+
<ListValues label="Languages" :items="context.allLanguages" :single-item="context.language"
49+
input-placeholder="LanguageCode" new-item-placeholder="New Language" />
5450

55-
<ListValues label="Currencies"
56-
:items="context.allCurrencies"
57-
:single-item="context.currencyCode"
58-
input-placeholder="CurrencyCode"
59-
new-item-placeholder="New Currency"/>
51+
<ListValues label="Currencies" :items="context.allCurrencies" :single-item="context.currencyCode"
52+
input-placeholder="CurrencyCode" new-item-placeholder="New Currency" />
6053

6154
<label class="text-sm block mt-6">Server url</label>
6255
<input v-model="context.serverUrl" type="text" placeholder="Server Url">
@@ -70,9 +63,8 @@
7063
<div class="pl-8 flex flex-col gap-6">
7164
<div>
7265
<label class="flex mt-2 items-center">
73-
<input v-model="context.allowThirdLevelCategories"
74-
class="accent-brand-500 mr-3 h-5 w-5"
75-
type="checkbox">
66+
<input v-model="context.allowThirdLevelCategories" class="accent-brand-500 mr-3 h-5 w-5"
67+
type="checkbox">
7668
Third level categories</label>
7769

7870
<p class="text-gray-500 text-sm mt-1">
@@ -95,21 +87,30 @@
9587

9688
<div>
9789
<label class="flex mt-2 items-center">
98-
<input v-model="context.userClassificationFilters" class="accent-brand-500 mr-3 h-5 w-5" type="checkbox">
99-
Hide products not available for the user's <code class="px-1">country</code> or <code class="px-1">channel</code> classification
90+
<input v-model="context.userClassificationFilters" class="accent-brand-500 mr-3 h-5 w-5"
91+
type="checkbox">
92+
Hide products not available for the user's <code class="px-1">country</code> or <code
93+
class="px-1">channel</code> classification
10094
</label>
10195
<p class="text-gray-500 text-sm mt-1">
102-
We base the filters on the product's <code>AvailableInMarkets</code> and <code>AvailableInChannels</code> data keys.
96+
We base the filters on the product's <code>AvailableInMarkets</code> and
97+
<code>AvailableInChannels</code>
98+
data keys.
10399
</p>
104100
</div>
105101

106102
<div>
107103
<label class="flex mt-2 items-center">
108-
<input v-model="context.showProductRelevanceScore" class="accent-brand-500 mr-3 h-5 w-5" type="checkbox">
104+
<input v-model="context.showProductRelevanceScore" class="accent-brand-500 mr-3 h-5 w-5"
105+
type="checkbox">
109106
Show Product Relevance Score in Search</label>
110107

111108
<p class="text-gray-500 text-sm mt-1">
112-
This will show the product relevance score in search. This can be helpful when showcasing Quality Score Thresholds for Retail Media, as it allows you to see the score and it's therefore easier to set the correct threshold.
109+
This will show the product relevance score in search. This can be helpful when showcasing Quality
110+
Score
111+
Thresholds for Retail Media, as it allows you to see the score and it's therefore easier to set the
112+
correct
113+
threshold.
113114
</p>
114115
</div>
115116

@@ -119,7 +120,8 @@
119120
Enable B2B recommendations</label>
120121

121122
<p class="text-gray-500 text-sm mt-1">
122-
This will replace the recommendation on the cart page with popular products for category with id '3_5'.
123+
This will replace the recommendation on the cart page with popular products for category with id
124+
'3_5'.
123125
</p>
124126
</div>
125127

@@ -132,22 +134,23 @@
132134
This will add a badge to product tiles when the product has variants available.
133135
</p>
134136
</div>
135-
137+
136138
<div>
137139
<label class="flex mt-2 items-center">
138140
<input v-model="context.similarProductsOnPdp" class="accent-brand-500 mr-3 h-5 w-5" type="checkbox">
139141
Similar products recommendation on PDP</label>
140142

141143
<p class="text-gray-500 text-sm mt-1">
142-
This will replace the recommendation on the PDP with a similar products recommendation with a specific category id filter when the product is sold out.
144+
This will replace the recommendation on the PDP with a similar products recommendation with a
145+
specific
146+
category id filter when the product is sold out.
143147
</p>
144148
</div>
145149

146150
<div>
147151
<label class="flex mt-2 items-center">
148-
<input v-model="context.variantBasedSearchOverlay"
149-
class="accent-brand-500 mr-3 h-5 w-5"
150-
type="checkbox">
152+
<input v-model="context.variantBasedSearchOverlay" class="accent-brand-500 mr-3 h-5 w-5"
153+
type="checkbox">
151154
Turn on the variant-based search overlay</label>
152155

153156
<p class="text-gray-500 text-sm mt-1">
@@ -157,28 +160,38 @@
157160

158161
<div>
159162
<label class="flex mt-2 items-center">
160-
<input v-model="context.searchHighlight"
161-
class="accent-brand-500 mr-3 h-5 w-5"
162-
type="checkbox">
163+
<input v-model="context.searchHighlight" class="accent-brand-500 mr-3 h-5 w-5" type="checkbox">
163164
Search Highlight</label>
164165

165166
<p class="text-gray-500 text-sm mt-1">
166-
When this is enabled, matched words in the display name of products & content in the search overlay will be highlighted.
167+
When this is enabled, matched words in the display name of products & content in the search overlay
168+
will be
169+
highlighted.
167170
</p>
168171
</div>
169172

170173
<div>
171174
<label class="flex mt-2 items-center">
172-
<input v-model="context.contentSearch"
173-
class="accent-brand-500 mr-3 h-5 w-5"
174-
type="checkbox">
175+
<input v-model="context.contentSearch" class="accent-brand-500 mr-3 h-5 w-5" type="checkbox">
175176
Content Search</label>
176177

177178
<p class="text-gray-500 text-sm mt-1">
178179
When this is enabled, content will be able to be searched for in the search overlay.
179180
</p>
180181
</div>
181182

183+
<div>
184+
<label class="flex mt-2 items-center">
185+
<input v-model="context.shoppertainmentEnabled" class="accent-brand-500 mr-3 h-5 w-5"
186+
type="checkbox">
187+
Shoppertainment</label>
188+
189+
<p class="text-gray-500 text-sm mt-1">
190+
<strong>Feature is in preview. This is not enabled on all datasets yet.</strong>
191+
When this is enabled, the Shoppertainment link wil appear in the navigation.
192+
</p>
193+
</div>
194+
182195
<div>
183196
<label class="text-sm block mt-6">Set 'Minutes ago' used for recommendations</label>
184197
<input v-model="context.recommendationsMinutesAgo" type="text">
@@ -193,13 +206,21 @@
193206
</label>
194207

195208
<p class="text-gray-500 text-sm mt-1">
196-
Automatically boosts specific products in search results and product listings based on UTM parameters in the URL:
209+
Automatically boosts specific products in search results and product listings based on UTM
210+
parameters in the
211+
URL:
197212
<br><br>
198-
• When UTM value is <code>promoted</code>: Products with the Data Key "Promoted" as <code>true</code> will receive a 50% relevance boost
213+
• When UTM value is <code>promoted</code>: Products with the Data Key "Promoted" as
214+
<code>true</code> will
215+
receive a 50% relevance boost
199216
<br>
200-
• For all other UTM values: Products with matching campaign IDs in Data Key <code>campaignIds</code> will receive a 50% relevance boost
217+
• For all other UTM values: Products with matching campaign IDs in Data Key <code>campaignIds</code>
218+
will
219+
receive a 50% relevance boost
201220
<br><br>
202-
Supported UTM parameters: <code>utm_source</code>, <code>utm_medium</code>, <code>utm_campaign</code>, <code>utm_term</code>, <code>utm_content</code>
221+
Supported UTM parameters: <code>utm_source</code>, <code>utm_medium</code>,
222+
<code>utm_campaign</code>,
223+
<code>utm_term</code>, <code>utm_content</code>
203224
</p>
204225
</div>
205226
</div>
@@ -222,7 +243,7 @@
222243
<button class="" @click="save">
223244
Save
224245
</button>
225-
246+
226247
<span v-if="saved" class="ml-4 text-green-600">
227248
Settings have been saved.
228249
</span>

src/components/FeedContentTile.vue

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<template>
2+
<RouterLink :to="{ name: 'content', params: { id: content.contentId } }"
3+
class="relative flex flex-col overflow-hidden text-slate-900 bg-white hover:!text-brand-500 transition duration-200 h-full rounded-lg p-2 shadow hover:scale-105">
4+
<div class="gap-4 items-start h-full flex flex-col">
5+
<div v-if="findImage(content)" class="flex-shrink-0">
6+
<Image :entity="content" />
7+
</div>
8+
9+
<div class="text-left flex flex-col flex-1 h-full w-full">
10+
<h5 class="tracking-tight text-lg font-semibold leading-tight line-clamp-2 h-12">
11+
{{ content.displayName }}
12+
</h5>
13+
<div class="grow"></div>
14+
<div class="flex justify-between">
15+
<span class="text-sm text-neutral-500">{{ content.data!['ByLine']?.value }}</span>
16+
<span class="flex gap-3 text-neutral-400">
17+
<ContentSentimentButtons :content="content" />
18+
</span>
19+
</div>
20+
</div>
21+
</div>
22+
</RouterLink>
23+
</template>
24+
25+
<script setup lang="ts">
26+
import type { ContentResult } from '@relewise/client';
27+
import { toRefs, type PropType } from 'vue';
28+
import Image from './Image.vue';
29+
import { findImage } from '@/helpers/imageHelper';
30+
import ContentSentimentButtons from '@/components/ContentSentimentButtons.vue';
31+
32+
const props = defineProps({
33+
content: { type: Object as PropType<ContentResult>, required: true },
34+
});
35+
36+
const { content: content } = toRefs(props);
37+
</script>

src/components/ProductTile.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const displayName = computed(() => {
3030
<template>
3131
<RouterLink
3232
:to="{ name: product.variant ? 'variant' : 'product', params: { id: product.productId, variant: product.variant?.variantId } }"
33-
class="relative flex flex-col overflow-hidden bg-white text-slate-900 hover:!text-brand-500 transition duration-200">
33+
class="relative flex flex-col overflow-hidden bg-white text-slate-900 hover:!text-brand-500 transition duration-200 rounded-lg shadow p-2 hover:scale-105">
3434
<div class="relative flex h-max-[275px] justify-center">
3535
<Image :entity="product" class="h-[275px]" />
3636
<div class="absolute top-0 left-0 flex gap-1">
@@ -84,8 +84,9 @@ const displayName = computed(() => {
8484
</div>
8585
<div class="my-2 flex items-center justify-between">
8686
<p>
87-
<span class="text-lg font-semibold text-slate-900 mr-1 leading-none">{{ $format(product.salesPrice)
88-
}}</span>
87+
<span class="text-lg font-semibold text-slate-900 mr-1 leading-none">
88+
{{ $format(product.salesPrice) }}
89+
</span>
8990
<span
9091
v-if="product.salesPrice !== product.listPrice && product.listPrice !== null && product.listPrice !== undefined"
9192
class="text-slate-900 line-through">

0 commit comments

Comments
 (0)