@shopbite-de/storefront 1.22.2 → 1.23.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/.github/workflows/build.yaml +1 -1
- package/.github/workflows/ci.yaml +3 -3
- package/.nuxtrc +1 -1
- package/.prettierignore +2 -1
- package/api-types/storeApiSchema.json +1 -1
- package/api-types/storeApiTypes.d.ts +1 -3
- package/app/app.vue +6 -3
- package/app/assets/css/main.css +47 -47
- package/app/components/AnimatedSection.vue +2 -10
- package/app/components/Cart/Item.vue +1 -4
- package/app/components/Cart/QuickView.vue +1 -4
- package/app/components/Category/Listing.vue +19 -13
- package/app/components/Hero.vue +3 -3
- package/app/components/Order/Detail.vue +2 -10
- package/app/components/Product/CardFooter.vue +1 -4
- package/app/components/Wishlist.vue +2 -4
- package/app/composables/useCommercePrice.ts +61 -0
- package/app/composables/useProductCrossSelling.ts +1 -6
- package/app/pages/konto/bestellungen.vue +1 -4
- package/content/index.yml +3 -3
- package/docs/notes/2026-07-04-issue-239-hydration-mismatches.md +78 -0
- package/nuxt.config.ts +34 -5
- package/package.json +41 -41
- package/pnpm-workspace.yaml +8 -0
- package/public/screenshot-desktop.png +0 -0
- package/public/screenshot-mobile.png +0 -0
- package/test/nuxt/useCommercePrice.test.ts +57 -0
|
@@ -25,7 +25,7 @@ jobs:
|
|
|
25
25
|
|
|
26
26
|
- uses: pnpm/action-setup@v5
|
|
27
27
|
with:
|
|
28
|
-
version: 10.33.
|
|
28
|
+
version: 10.33.2
|
|
29
29
|
|
|
30
30
|
- uses: actions/setup-node@v6
|
|
31
31
|
with:
|
|
@@ -69,7 +69,7 @@ jobs:
|
|
|
69
69
|
|
|
70
70
|
- uses: pnpm/action-setup@v5
|
|
71
71
|
with:
|
|
72
|
-
version: 10.33.
|
|
72
|
+
version: 10.33.2
|
|
73
73
|
|
|
74
74
|
- uses: actions/setup-node@v6
|
|
75
75
|
with:
|
|
@@ -102,7 +102,7 @@ jobs:
|
|
|
102
102
|
|
|
103
103
|
- uses: pnpm/action-setup@v5
|
|
104
104
|
with:
|
|
105
|
-
version: 10.33.
|
|
105
|
+
version: 10.33.2
|
|
106
106
|
|
|
107
107
|
- uses: actions/setup-node@v6
|
|
108
108
|
with:
|
package/.nuxtrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
setups.@nuxt/test-utils="4.0.
|
|
1
|
+
setups.@nuxt/test-utils="4.0.3"
|
package/.prettierignore
CHANGED
|
@@ -16758,4 +16758,4 @@
|
|
|
16758
16758
|
}
|
|
16759
16759
|
}
|
|
16760
16760
|
]
|
|
16761
|
-
}
|
|
16761
|
+
}
|
|
@@ -2517,9 +2517,7 @@ export type Schemas = {
|
|
|
2517
2517
|
};
|
|
2518
2518
|
NavigationRouteResponse: components["schemas"]["Category"][];
|
|
2519
2519
|
NavigationType:
|
|
2520
|
-
| "
|
|
2521
|
-
| "footer-navigation"
|
|
2522
|
-
| "service-navigation";
|
|
2520
|
+
"main-navigation" | "footer-navigation" | "service-navigation";
|
|
2523
2521
|
NewsletterRecipient: {
|
|
2524
2522
|
/** Format: date-time */
|
|
2525
2523
|
readonly createdAt?: string;
|
package/app/app.vue
CHANGED
|
@@ -49,9 +49,12 @@ const { data: sessionContextData } = await useAsyncData(
|
|
|
49
49
|
},
|
|
50
50
|
);
|
|
51
51
|
|
|
52
|
+
const { setPriceConfig } = useCommercePrice();
|
|
53
|
+
|
|
52
54
|
if (sessionContextData.value) {
|
|
53
|
-
|
|
54
|
-
currencyCode: sessionContextData.value.currency?.isoCode
|
|
55
|
+
setPriceConfig({
|
|
56
|
+
currencyCode: sessionContextData.value.currency?.isoCode,
|
|
57
|
+
localeCode: sessionContextData.value.languageInfo?.localeCode,
|
|
55
58
|
});
|
|
56
59
|
useSessionContext(sessionContextData.value);
|
|
57
60
|
}
|
|
@@ -110,7 +113,7 @@ useHead({
|
|
|
110
113
|
</script>
|
|
111
114
|
|
|
112
115
|
<template>
|
|
113
|
-
<
|
|
116
|
+
<VitePwaManifest />
|
|
114
117
|
<NuxtLoadingIndicator />
|
|
115
118
|
|
|
116
119
|
<UApp :toaster="appConfig.toaster">
|
package/app/assets/css/main.css
CHANGED
|
@@ -4,60 +4,60 @@
|
|
|
4
4
|
@source "../../../content/**/*";
|
|
5
5
|
|
|
6
6
|
@theme {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
--font-sans: "Public Sans", sans-serif;
|
|
8
|
+
--color-brand-50: #fff4ed;
|
|
9
|
+
--color-brand-100: #ffe4d1;
|
|
10
|
+
--color-brand-200: #ffc8a3;
|
|
11
|
+
--color-brand-300: #ffa169;
|
|
12
|
+
--color-brand-400: #ff7a2d;
|
|
13
|
+
--color-brand-500: #ff5b00;
|
|
14
|
+
--color-brand-600: #e64d00;
|
|
15
|
+
--color-brand-700: #c23d00;
|
|
16
|
+
--color-brand-800: #9a3200;
|
|
17
|
+
--color-brand-900: #7a2800;
|
|
18
|
+
--color-brand-950: #471500;
|
|
19
|
+
--color-neutral-950: #171717;
|
|
20
|
+
|
|
21
|
+
/* This is important because apple devices will zoom in when the font size is below 16px */
|
|
22
|
+
--text-sm: 16px;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
:root {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
26
|
+
--ui-primary: var(--color-brand-500);
|
|
27
|
+
|
|
28
|
+
--ui-bg: #fff;
|
|
29
|
+
--ui-bg-muted: #f5f5f5;
|
|
30
|
+
--ui-bg-elevated: var(--color-brand-50);
|
|
31
|
+
--ui-bg-accented: var(--color-brand-200);
|
|
32
|
+
--ui-bg-inverted: #171717;
|
|
33
|
+
|
|
34
|
+
--ui-border-accented: var(--color-brand-200);
|
|
35
|
+
--ui-border: #e5e5e5;
|
|
36
|
+
|
|
37
|
+
--ui-text-accented: #171717;
|
|
38
|
+
--ui-text-default: #404040;
|
|
39
|
+
--ui-text-muted: #737373;
|
|
40
|
+
--ui-text-dimmed: #a3a3a3;
|
|
41
|
+
--ui-text-inverted: #fff;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
:root.dark {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
45
|
+
--ui-bg: #171717;
|
|
46
|
+
--ui-bg-muted: #1f1f1f;
|
|
47
|
+
--ui-bg-elevated: #2a2a2a;
|
|
48
|
+
--ui-bg-accented: #333333;
|
|
49
|
+
--ui-bg-inverted: #fff;
|
|
50
|
+
|
|
51
|
+
--ui-border-accented: #333333;
|
|
52
|
+
--ui-border: #333333;
|
|
53
|
+
|
|
54
|
+
--ui-text-accented: #ffffff;
|
|
55
|
+
--ui-text-default: #cccccc;
|
|
56
|
+
--ui-text-muted: #999999;
|
|
57
|
+
--ui-text-dimmed: #666666;
|
|
58
|
+
--ui-text-inverted: #171717;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
html {
|
|
62
|
-
|
|
62
|
+
scroll-behavior: smooth;
|
|
63
63
|
}
|
|
@@ -3,17 +3,9 @@ import { useScrollAnimation } from "~/composables/useScrollAnimation";
|
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
5
|
animation?:
|
|
6
|
-
| "fade-
|
|
7
|
-
| "fade-down"
|
|
8
|
-
| "fade-left"
|
|
9
|
-
| "fade-right"
|
|
10
|
-
| "fade"
|
|
11
|
-
| "scale";
|
|
6
|
+
"fade-up" | "fade-down" | "fade-left" | "fade-right" | "fade" | "scale";
|
|
12
7
|
duration?:
|
|
13
|
-
| "duration-
|
|
14
|
-
| "duration-700"
|
|
15
|
-
| "duration-1000"
|
|
16
|
-
| "duration-1500";
|
|
8
|
+
"duration-500" | "duration-700" | "duration-1000" | "duration-1500";
|
|
17
9
|
delay?: string;
|
|
18
10
|
threshold?: number;
|
|
19
11
|
rootMargin?: string;
|
|
@@ -14,10 +14,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
const { removeItem, changeProductQuantity } = useCart();
|
|
17
|
-
const { getFormattedPrice } =
|
|
18
|
-
currencyCode: "EUR",
|
|
19
|
-
localeCode: "de-DE",
|
|
20
|
-
});
|
|
17
|
+
const { getFormattedPrice } = useCommercePrice();
|
|
21
18
|
|
|
22
19
|
// Use computed for reactive quantity with proper null checks
|
|
23
20
|
const quantity = computed({
|
|
@@ -35,17 +35,21 @@ async function resetFilters() {
|
|
|
35
35
|
|
|
36
36
|
useCategorySeo(category);
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
// Derived from the listing data instead of snapshotted at setup time: on the
|
|
39
|
+
// server the listing resolves after setup, so a snapshot would render
|
|
40
|
+
// "Sortieren" while client hydration (payload already present) would render
|
|
41
|
+
// the actual sorting label — a hydration mismatch (#239).
|
|
42
|
+
// The placeholder is never stored as an override, so the select keeps
|
|
43
|
+
// following the listing data until the user explicitly picks a sorting.
|
|
44
|
+
const SORTING_PLACEHOLDER = "Sortieren";
|
|
45
|
+
const sortingOverride = ref<string | null>(null);
|
|
46
|
+
const currentSorting = computed<string>({
|
|
47
|
+
get: () =>
|
|
48
|
+
sortingOverride.value ?? currentSortingOrder.value ?? SORTING_PLACEHOLDER,
|
|
49
|
+
set: (val) => {
|
|
50
|
+
sortingOverride.value = val === SORTING_PLACEHOLDER ? null : val;
|
|
46
51
|
},
|
|
47
|
-
|
|
48
|
-
);
|
|
52
|
+
});
|
|
49
53
|
|
|
50
54
|
const propertyFilters = computed<Schemas["PropertyGroup"][]>(
|
|
51
55
|
() =>
|
|
@@ -91,7 +95,9 @@ let filterChain = Promise.resolve();
|
|
|
91
95
|
|
|
92
96
|
watch(selectedListingFilters, (newFilters, oldFilters) => {
|
|
93
97
|
if (newFilters[0]?.value === oldFilters?.[0]?.value) return;
|
|
94
|
-
|
|
98
|
+
// setFilters doesn't send an order, so the response falls back to the
|
|
99
|
+
// default sorting; drop the override so the select follows it (#249).
|
|
100
|
+
currentSorting.value = SORTING_PLACEHOLDER;
|
|
95
101
|
filterChain = filterChain
|
|
96
102
|
.catch(() => {})
|
|
97
103
|
.then(() => setFilters(newFilters))
|
|
@@ -99,12 +105,12 @@ watch(selectedListingFilters, (newFilters, oldFilters) => {
|
|
|
99
105
|
});
|
|
100
106
|
|
|
101
107
|
watch(currentSorting, async (val) => {
|
|
102
|
-
if (val === currentSortingOrder.value) return;
|
|
108
|
+
if (val === SORTING_PLACEHOLDER || val === currentSortingOrder.value) return;
|
|
103
109
|
const sortingQuery = {
|
|
104
110
|
query: currentFilters.value?.search,
|
|
105
111
|
properties: currentFilters.value?.properties?.join("|"),
|
|
106
112
|
};
|
|
107
|
-
await changeSorting(val
|
|
113
|
+
await changeSorting(val, sortingQuery);
|
|
108
114
|
});
|
|
109
115
|
|
|
110
116
|
const moreThanOneFilterAndOption = computed<boolean>(
|
package/app/components/Hero.vue
CHANGED
|
@@ -36,7 +36,7 @@ onMounted(() => {
|
|
|
36
36
|
</script>
|
|
37
37
|
|
|
38
38
|
<template>
|
|
39
|
-
<div class="relative">
|
|
39
|
+
<div class="relative isolate overflow-hidden">
|
|
40
40
|
<video
|
|
41
41
|
ref="videoRef"
|
|
42
42
|
autoplay
|
|
@@ -44,11 +44,11 @@ onMounted(() => {
|
|
|
44
44
|
muted
|
|
45
45
|
playsinline
|
|
46
46
|
fetchpriority="high"
|
|
47
|
-
class="absolute inset-0 w-full h-full object-cover -z-10"
|
|
47
|
+
class="absolute inset-0 w-full h-full object-cover -z-10 blur-sm scale-105"
|
|
48
48
|
>
|
|
49
49
|
<source :src="backgroundVideo" type="video/mp4" />
|
|
50
50
|
</video>
|
|
51
|
-
<div class="bg-black/50
|
|
51
|
+
<div class="bg-black/50">
|
|
52
52
|
<UPageHero
|
|
53
53
|
:title="title"
|
|
54
54
|
:description="description"
|
|
@@ -8,10 +8,7 @@ const props = defineProps<{
|
|
|
8
8
|
|
|
9
9
|
const { order } = toRefs(props);
|
|
10
10
|
|
|
11
|
-
const { getFormattedPrice } =
|
|
12
|
-
currencyCode: "EUR",
|
|
13
|
-
localeCode: "de-DE",
|
|
14
|
-
});
|
|
11
|
+
const { getFormattedPrice } = useCommercePrice();
|
|
15
12
|
|
|
16
13
|
const lineItems = computed(() =>
|
|
17
14
|
order.value?.lineItems?.filter(
|
|
@@ -24,12 +21,7 @@ const paymentState = computed(
|
|
|
24
21
|
);
|
|
25
22
|
|
|
26
23
|
type BadgeColor =
|
|
27
|
-
| "
|
|
28
|
-
| "error"
|
|
29
|
-
| "warning"
|
|
30
|
-
| "info"
|
|
31
|
-
| "neutral"
|
|
32
|
-
| "primary";
|
|
24
|
+
"success" | "error" | "warning" | "info" | "neutral" | "primary";
|
|
33
25
|
|
|
34
26
|
const paymentStateColor = computed((): BadgeColor => {
|
|
35
27
|
switch (paymentState.value?.technicalName) {
|
|
@@ -14,10 +14,7 @@ const emit = defineEmits<{
|
|
|
14
14
|
|
|
15
15
|
const { isCheckoutEnabled } = useShopBiteConfig();
|
|
16
16
|
|
|
17
|
-
const { getFormattedPrice } =
|
|
18
|
-
currencyCode: "EUR",
|
|
19
|
-
localeCode: "de-DE",
|
|
20
|
-
});
|
|
17
|
+
const { getFormattedPrice } = useCommercePrice();
|
|
21
18
|
|
|
22
19
|
const openDetails = ref(false);
|
|
23
20
|
|
|
@@ -14,6 +14,7 @@ const props = withDefaults(
|
|
|
14
14
|
|
|
15
15
|
const { getWishlistProducts, items } = useWishlist();
|
|
16
16
|
const { apiClient } = useShopwareContext();
|
|
17
|
+
const { getFormattedPrice } = useCommercePrice();
|
|
17
18
|
const {
|
|
18
19
|
isAddingToCart,
|
|
19
20
|
addingItemId,
|
|
@@ -158,10 +159,7 @@ onMounted(async () => {
|
|
|
158
159
|
</h3>
|
|
159
160
|
<p class="text-base font-bold text-primary-600">
|
|
160
161
|
{{
|
|
161
|
-
|
|
162
|
-
currencyCode: "EUR",
|
|
163
|
-
localeCode: "de-DE",
|
|
164
|
-
}).getFormattedPrice(
|
|
162
|
+
getFormattedPrice(
|
|
165
163
|
product.calculatedPrice.totalPrice,
|
|
166
164
|
)
|
|
167
165
|
}}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export interface CommercePriceConfig {
|
|
2
|
+
currencyCode: string;
|
|
3
|
+
localeCode: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const DEFAULT_CONFIG: CommercePriceConfig = {
|
|
7
|
+
currencyCode: "EUR",
|
|
8
|
+
localeCode: "de-DE",
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Platform-agnostic price formatting.
|
|
13
|
+
*
|
|
14
|
+
* The shop-wide currency/locale is seeded once from the commerce backend's
|
|
15
|
+
* session context (see `app.vue`) via `setPriceConfig` and shared through
|
|
16
|
+
* `useState`, so server render and client hydration always format
|
|
17
|
+
* identically — never based on the visitor's browser locale.
|
|
18
|
+
*/
|
|
19
|
+
export function useCommercePrice(params?: Partial<CommercePriceConfig>) {
|
|
20
|
+
const config = useState<CommercePriceConfig>("commerce-price-config", () => ({
|
|
21
|
+
...DEFAULT_CONFIG,
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
function setPriceConfig(update: Partial<CommercePriceConfig>) {
|
|
25
|
+
config.value = {
|
|
26
|
+
currencyCode: update.currencyCode || config.value.currencyCode,
|
|
27
|
+
localeCode: update.localeCode || config.value.localeCode,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const currencyCode = computed(
|
|
32
|
+
() => params?.currencyCode ?? config.value.currencyCode,
|
|
33
|
+
);
|
|
34
|
+
const localeCode = computed(
|
|
35
|
+
() => params?.localeCode ?? config.value.localeCode,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
// Memoized: constructing Intl.NumberFormat is expensive and listing pages
|
|
39
|
+
// format many prices per render.
|
|
40
|
+
const formatter = computed(
|
|
41
|
+
() =>
|
|
42
|
+
new Intl.NumberFormat(localeCode.value, {
|
|
43
|
+
style: "currency",
|
|
44
|
+
currency: currencyCode.value,
|
|
45
|
+
}),
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
function getFormattedPrice(value: number | string | undefined): string {
|
|
49
|
+
if (value === undefined) {
|
|
50
|
+
return "";
|
|
51
|
+
}
|
|
52
|
+
return formatter.value.format(+value);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
getFormattedPrice,
|
|
57
|
+
setPriceConfig,
|
|
58
|
+
currencyCode,
|
|
59
|
+
localeCode,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { Schemas } from "#shopware";
|
|
2
2
|
import type { AssociationItem } from "~/types/Association";
|
|
3
3
|
|
|
4
|
-
const DEFAULT_CURRENCY = "EUR";
|
|
5
|
-
const DEFAULT_LOCALE = "de-DE";
|
|
6
4
|
const DEFAULT_ICON = "i-lucide-plus";
|
|
7
5
|
|
|
8
6
|
function mapAssociationToItems(
|
|
@@ -23,10 +21,7 @@ function mapAssociationToItems(
|
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
export function useProductCrossSelling(getProductId: () => string) {
|
|
26
|
-
const { getFormattedPrice } =
|
|
27
|
-
currencyCode: DEFAULT_CURRENCY,
|
|
28
|
-
localeCode: DEFAULT_LOCALE,
|
|
29
|
-
});
|
|
24
|
+
const { getFormattedPrice } = useCommercePrice();
|
|
30
25
|
|
|
31
26
|
const { data, pending: isAssociationsLoading } = useFetch<
|
|
32
27
|
Schemas["CrossSellingElement"][]
|
package/content/index.yml
CHANGED
|
@@ -30,7 +30,7 @@ hero:
|
|
|
30
30
|
size: xl
|
|
31
31
|
color: neutral
|
|
32
32
|
variant: outline
|
|
33
|
-
to:
|
|
33
|
+
to: "tel:+490610477777"
|
|
34
34
|
target: _blank
|
|
35
35
|
features:
|
|
36
36
|
title: Alle [Informationen]{.text-primary} auf einen Blick
|
|
@@ -101,7 +101,7 @@ mittagstisch:
|
|
|
101
101
|
icon: i-lucide-info
|
|
102
102
|
links:
|
|
103
103
|
- label: Reservieren
|
|
104
|
-
to:
|
|
104
|
+
to: "tel:+49610471427"
|
|
105
105
|
color: neutral
|
|
106
106
|
variant: subtle
|
|
107
107
|
trailingIcon: i-lucide-phone
|
|
@@ -116,4 +116,4 @@ cta:
|
|
|
116
116
|
- label: Tisch reservieren
|
|
117
117
|
to: tel:+49610471427
|
|
118
118
|
variant: outline
|
|
119
|
-
trailingIcon: i-lucide-phone
|
|
119
|
+
trailingIcon: i-lucide-phone
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Issue #239 — SSR hydration mismatches on category pages
|
|
2
|
+
|
|
3
|
+
Date: 2026-07-04 · Branch: `fix/239-hydration-mismatch-category-pages`
|
|
4
|
+
|
|
5
|
+
## Symptom
|
|
6
|
+
|
|
7
|
+
`Hydration completed but contains mismatches.` — 466 occurrences/7d in
|
|
8
|
+
OpenObserve RUM, concentrated on `/c/*` category pages (Pizza worst).
|
|
9
|
+
In production Vue only reports **structural/text** mismatches, not
|
|
10
|
+
attribute/class ones, so the culprits had to be differing DOM nodes or text.
|
|
11
|
+
|
|
12
|
+
## Root causes (both reproduced locally)
|
|
13
|
+
|
|
14
|
+
### 1. Sorting select snapshotted before listing data existed
|
|
15
|
+
|
|
16
|
+
`Category/Listing.vue` initialized `currentSorting` with
|
|
17
|
+
`ref(currentSortingOrder.value ?? "Sortieren")`.
|
|
18
|
+
|
|
19
|
+
- **Server:** setup runs *before* `useLazyAsyncData` resolves (it is awaited
|
|
20
|
+
later via `onServerPrefetch`), so the snapshot was always `"Sortieren"`.
|
|
21
|
+
- **Client hydration:** the payload is already present at setup, so the
|
|
22
|
+
snapshot was the real sorting key and the `USelect` rendered its label
|
|
23
|
+
(e.g. "Nr. 1-100") → text mismatch on **every** category page load.
|
|
24
|
+
|
|
25
|
+
**Fix:** derive the select value from listing data with a writable computed
|
|
26
|
+
(`sortingOverride ?? currentSortingOrder ?? "Sortieren"`). Both environments
|
|
27
|
+
now render from the same source. Bonus: SSR now shows the actual sorting.
|
|
28
|
+
|
|
29
|
+
**Rule of thumb:** never snapshot async-data-derived values with `ref(...)`
|
|
30
|
+
in setup — derive them with `computed` so SSR and hydration agree.
|
|
31
|
+
|
|
32
|
+
### 2. Price formatting depended on the visitor's browser locale
|
|
33
|
+
|
|
34
|
+
`usePrice` from `@shopware/composables` is a `createSharedComposable`: only
|
|
35
|
+
the **first** call's params count. `app.vue` called it first *without*
|
|
36
|
+
`localeCode`, which falls back to the browser locale. Server rendered
|
|
37
|
+
`8,00 €` (de), any non-German browser hydrated `€8.00` → text mismatch on
|
|
38
|
+
every product card. All the `localeCode: "de-DE"` params passed at other
|
|
39
|
+
call sites were silently ignored.
|
|
40
|
+
|
|
41
|
+
**Fix:** new platform-agnostic `useCommercePrice` composable (pure
|
|
42
|
+
`Intl.NumberFormat`, zero Shopware imports). Shop-wide currency + locale are
|
|
43
|
+
seeded once in `app.vue` from the session context
|
|
44
|
+
(`currency.isoCode` + `languageInfo.localeCode`) and shared via `useState`,
|
|
45
|
+
so they serialize into the payload and are identical on both sides.
|
|
46
|
+
All 8 `usePrice` call sites migrated; `usePrice` is no longer used.
|
|
47
|
+
|
|
48
|
+
This is a step toward the multi-platform goal: only the seeding in
|
|
49
|
+
`app.vue` is Shopware-aware; the composable itself is backend-neutral.
|
|
50
|
+
|
|
51
|
+
## Verification
|
|
52
|
+
|
|
53
|
+
- Playwright script loading category pages in dev mode (Vue prints detailed
|
|
54
|
+
mismatch warnings there): 2 mismatch types before, **0 after**.
|
|
55
|
+
- Note: the dev backend uses `/speisekarte/<cat>/` seo URLs, not `/c/*` —
|
|
56
|
+
same `[...all].vue` + `CategoryListing` component, different seo template.
|
|
57
|
+
- `Intl` formats `de-DE` currency with a **non-breaking space** (U+00A0)
|
|
58
|
+
before `€` — tests assert it explicitly via ` `.
|
|
59
|
+
|
|
60
|
+
## Out of scope, noticed on the way
|
|
61
|
+
|
|
62
|
+
- `pnpm typecheck` is broken on main: `vue-tsc` is not a devDependency, and
|
|
63
|
+
installing it temporarily surfaces pre-existing type errors in ~8 files
|
|
64
|
+
(none related to this fix). → separate issue
|
|
65
|
+
- Every filter change in `Category/Listing.vue` set `currentSorting` to
|
|
66
|
+
`"Sortieren"`, which triggered a second, redundant listing fetch with
|
|
67
|
+
`order=Sortieren` racing the `setFilters` fetch (Shopware silently ignores
|
|
68
|
+
the invalid order). Filed as #249 — then fixed in this PR after Copilot's
|
|
69
|
+
review flagged the same spot: the placeholder is treated as "no override"
|
|
70
|
+
and the sorting watcher ignores it.
|
|
71
|
+
- `AnimatedSection` renders product cards with `opacity-0` in SSR HTML
|
|
72
|
+
(IntersectionObserver reveals them post-mount) — content invisible without
|
|
73
|
+
JS; potential SEO/CLS concern. → suggested issue
|
|
74
|
+
- `Header/Right.vue` hardcodes the phone number `tel:+49610471427` in the
|
|
75
|
+
base layer — should come from config for multi-tenant demo shops.
|
|
76
|
+
→ suggested issue
|
|
77
|
+
- The 16 home-page mismatches from the RUM data were **not** reproducible
|
|
78
|
+
locally; likely environment-specific. Re-check telemetry after this fix.
|
package/nuxt.config.ts
CHANGED
|
@@ -115,38 +115,68 @@ export default defineNuxtConfig({
|
|
|
115
115
|
},
|
|
116
116
|
|
|
117
117
|
pwa: {
|
|
118
|
+
registerType: "autoUpdate",
|
|
118
119
|
manifest: {
|
|
120
|
+
id: "/",
|
|
121
|
+
scope: "/",
|
|
119
122
|
name: storeName,
|
|
120
123
|
short_name: storeName,
|
|
124
|
+
description: storeDescription,
|
|
121
125
|
theme_color: "#ff5b00",
|
|
126
|
+
background_color: "#ffffff",
|
|
122
127
|
display: "standalone",
|
|
123
128
|
start_url: "/",
|
|
129
|
+
screenshots: [
|
|
130
|
+
{
|
|
131
|
+
src: "screenshot-mobile.png",
|
|
132
|
+
sizes: "390x844",
|
|
133
|
+
type: "image/png",
|
|
134
|
+
form_factor: "narrow",
|
|
135
|
+
label: storeName,
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
src: "screenshot-desktop.png",
|
|
139
|
+
sizes: "1280x800",
|
|
140
|
+
type: "image/png",
|
|
141
|
+
form_factor: "wide",
|
|
142
|
+
label: storeName,
|
|
143
|
+
},
|
|
144
|
+
],
|
|
124
145
|
icons: [
|
|
125
146
|
{
|
|
126
147
|
src: "logo-192.png",
|
|
127
148
|
sizes: "192x192",
|
|
128
149
|
type: "image/png",
|
|
150
|
+
purpose: "any",
|
|
129
151
|
},
|
|
130
152
|
{
|
|
131
153
|
src: "logo-512.png",
|
|
132
154
|
sizes: "512x512",
|
|
133
155
|
type: "image/png",
|
|
156
|
+
purpose: "any",
|
|
134
157
|
},
|
|
135
158
|
{
|
|
136
159
|
src: "logo-512.png",
|
|
137
160
|
sizes: "512x512",
|
|
138
161
|
type: "image/png",
|
|
139
|
-
purpose: "
|
|
162
|
+
purpose: "maskable",
|
|
140
163
|
},
|
|
141
164
|
],
|
|
142
165
|
},
|
|
143
166
|
workbox: {
|
|
144
167
|
globPatterns: ["**/*.{js,css,html,png,svg,ico}"],
|
|
145
168
|
globIgnores: ["**/_payload.json"],
|
|
169
|
+
navigateFallback: null,
|
|
170
|
+
runtimeCaching: [
|
|
171
|
+
{
|
|
172
|
+
urlPattern: "/",
|
|
173
|
+
handler: "NetworkFirst",
|
|
174
|
+
},
|
|
175
|
+
],
|
|
146
176
|
},
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
177
|
+
devOptions: {
|
|
178
|
+
enabled: true,
|
|
179
|
+
type: "module",
|
|
150
180
|
},
|
|
151
181
|
},
|
|
152
182
|
|
|
@@ -191,7 +221,6 @@ export default defineNuxtConfig({
|
|
|
191
221
|
"@nuxt/image",
|
|
192
222
|
"@nuxt/content",
|
|
193
223
|
"@nuxtjs/robots",
|
|
194
|
-
"@vite-pwa/nuxt",
|
|
195
224
|
"@nuxt/ui",
|
|
196
225
|
"@nuxt/scripts",
|
|
197
226
|
"@nuxt/test-utils/module",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopbite-de/storefront",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"main": "nuxt.config.ts",
|
|
5
5
|
"description": "Shopware storefront for food delivery shops",
|
|
6
6
|
"keywords": [
|
|
@@ -20,55 +20,55 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@headlessui/vue": "^1.7.23",
|
|
22
22
|
"@heroicons/vue": "^2.2.0",
|
|
23
|
-
"@iconify-json/lucide": "^1.2.
|
|
24
|
-
"@iconify-json/simple-icons": "^1.2.
|
|
23
|
+
"@iconify-json/lucide": "^1.2.116",
|
|
24
|
+
"@iconify-json/simple-icons": "^1.2.88",
|
|
25
25
|
"@nuxt/content": "3.12.0",
|
|
26
26
|
"@nuxt/image": "^2.0.0",
|
|
27
|
-
"@nuxt/scripts": "0.13.
|
|
28
|
-
"@nuxt/ui": "^4.
|
|
29
|
-
"@nuxtjs/robots": "^6.
|
|
27
|
+
"@nuxt/scripts": "0.13.4",
|
|
28
|
+
"@nuxt/ui": "^4.9.0",
|
|
29
|
+
"@nuxtjs/robots": "^6.1.2",
|
|
30
30
|
"@pinia/nuxt": "0.11.3",
|
|
31
|
-
"@sentry/nuxt": "^10.
|
|
32
|
-
"@shopware/api-client": "^1.
|
|
33
|
-
"@shopware/api-gen": "^1.
|
|
34
|
-
"@shopware/composables": "^1.
|
|
35
|
-
"@shopware/helpers": "^1.
|
|
36
|
-
"@shopware/nuxt-module": "^1.
|
|
37
|
-
"@unhead/vue": "^2.1.
|
|
31
|
+
"@sentry/nuxt": "^10.63.0",
|
|
32
|
+
"@shopware/api-client": "^1.5.0",
|
|
33
|
+
"@shopware/api-gen": "^1.5.0",
|
|
34
|
+
"@shopware/composables": "^1.12.0",
|
|
35
|
+
"@shopware/helpers": "^1.7.1",
|
|
36
|
+
"@shopware/nuxt-module": "^1.5.0",
|
|
37
|
+
"@unhead/vue": "^2.1.15",
|
|
38
38
|
"@vite-pwa/nuxt": "^1.1.1",
|
|
39
|
-
"@vueuse/core": "^14.
|
|
40
|
-
"dotenv": "^17.
|
|
41
|
-
"fflate": "^0.8.
|
|
42
|
-
"nuxt": "^4.4.
|
|
39
|
+
"@vueuse/core": "^14.3.0",
|
|
40
|
+
"dotenv": "^17.4.2",
|
|
41
|
+
"fflate": "^0.8.3",
|
|
42
|
+
"nuxt": "^4.4.8",
|
|
43
43
|
"nuxt-vitalizer": "2.0.0",
|
|
44
|
-
"uuid": "^13.0.
|
|
44
|
+
"uuid": "^13.0.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@nuxt/hints": "1.0.3",
|
|
48
47
|
"@iconify-json/heroicons": "^1.2.3",
|
|
49
|
-
"@iconify-json/hugeicons": "^1.2.
|
|
50
|
-
"@nuxt/devtools-kit": "^3.2.
|
|
51
|
-
"@nuxt/eslint": "^1.
|
|
52
|
-
"@nuxt/
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"@typescript-eslint/
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"@vue/
|
|
61
|
-
"@vue/
|
|
62
|
-
"@vue/
|
|
63
|
-
"
|
|
48
|
+
"@iconify-json/hugeicons": "^1.2.30",
|
|
49
|
+
"@nuxt/devtools-kit": "^3.2.4",
|
|
50
|
+
"@nuxt/eslint": "^1.16.0",
|
|
51
|
+
"@nuxt/hints": "1.0.3",
|
|
52
|
+
"@nuxt/test-utils": "^4.0.3",
|
|
53
|
+
"@playwright/test": "^1.61.1",
|
|
54
|
+
"@types/node": "^25.9.4",
|
|
55
|
+
"@typescript-eslint/eslint-plugin": "^8.62.1",
|
|
56
|
+
"@typescript-eslint/parser": "^8.62.1",
|
|
57
|
+
"@vitejs/plugin-vue": "^6.0.7",
|
|
58
|
+
"@vitest/ui": "4.1.5",
|
|
59
|
+
"@vue/compiler-dom": "^3.5.39",
|
|
60
|
+
"@vue/server-renderer": "^3.5.39",
|
|
61
|
+
"@vue/test-utils": "^2.4.11",
|
|
62
|
+
"@vue/typescript-plugin": "^3.3.6",
|
|
63
|
+
"eslint": "^10.6.0",
|
|
64
64
|
"eslint-config-prettier": "^10.1.8",
|
|
65
|
-
"happy-dom": "^20.
|
|
66
|
-
"jsdom": "^29.
|
|
67
|
-
"playwright-core": "^1.
|
|
68
|
-
"prettier": "^3.
|
|
69
|
-
"tailwindcss": "^4.2
|
|
70
|
-
"typescript": "^6.0.
|
|
71
|
-
"vitest": "^4.1.
|
|
65
|
+
"happy-dom": "^20.10.6",
|
|
66
|
+
"jsdom": "^29.1.1",
|
|
67
|
+
"playwright-core": "^1.61.1",
|
|
68
|
+
"prettier": "^3.9.4",
|
|
69
|
+
"tailwindcss": "^4.3.2",
|
|
70
|
+
"typescript": "^6.0.3",
|
|
71
|
+
"vitest": "^4.1.9"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"build": "nuxt build",
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { useCommercePrice } from "~/composables/useCommercePrice";
|
|
3
|
+
|
|
4
|
+
describe("useCommercePrice", () => {
|
|
5
|
+
it("formats prices with the de-DE / EUR defaults", () => {
|
|
6
|
+
const { getFormattedPrice } = useCommercePrice();
|
|
7
|
+
|
|
8
|
+
// Intl uses a non-breaking space between amount and currency symbol
|
|
9
|
+
expect(getFormattedPrice(8)).toBe("8,00\u00A0€");
|
|
10
|
+
expect(getFormattedPrice(1234.5)).toBe("1.234,50\u00A0€");
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("returns an empty string for undefined values", () => {
|
|
14
|
+
const { getFormattedPrice } = useCommercePrice();
|
|
15
|
+
|
|
16
|
+
expect(getFormattedPrice(undefined)).toBe("");
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("formats string values numerically", () => {
|
|
20
|
+
const { getFormattedPrice } = useCommercePrice();
|
|
21
|
+
|
|
22
|
+
expect(getFormattedPrice("7.5")).toBe("7,50\u00A0€");
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("uses the shared config seeded via setPriceConfig", () => {
|
|
26
|
+
const { setPriceConfig } = useCommercePrice();
|
|
27
|
+
setPriceConfig({ currencyCode: "USD", localeCode: "en-US" });
|
|
28
|
+
|
|
29
|
+
// A separate call site picks up the shared state
|
|
30
|
+
const { getFormattedPrice } = useCommercePrice();
|
|
31
|
+
expect(getFormattedPrice(8)).toBe("$8.00");
|
|
32
|
+
|
|
33
|
+
setPriceConfig({ currencyCode: "EUR", localeCode: "de-DE" });
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("ignores empty values in setPriceConfig and keeps previous config", () => {
|
|
37
|
+
const { setPriceConfig, getFormattedPrice } = useCommercePrice();
|
|
38
|
+
setPriceConfig({ currencyCode: "", localeCode: undefined });
|
|
39
|
+
|
|
40
|
+
expect(getFormattedPrice(8)).toBe("8,00\u00A0€");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("accepts locale codes with non-canonical casing (Shopware sends de-De)", () => {
|
|
44
|
+
const { getFormattedPrice } = useCommercePrice({ localeCode: "de-De" });
|
|
45
|
+
|
|
46
|
+
expect(getFormattedPrice(8)).toBe("8,00\u00A0€");
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("lets per-call-site params override the shared config", () => {
|
|
50
|
+
const { getFormattedPrice } = useCommercePrice({
|
|
51
|
+
currencyCode: "USD",
|
|
52
|
+
localeCode: "en-US",
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
expect(getFormattedPrice(8)).toBe("$8.00");
|
|
56
|
+
});
|
|
57
|
+
});
|