@shopbite-de/storefront 1.24.0 → 1.25.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/.env.example +3 -0
- package/CLAUDE.md +9 -2
- package/app/app.config.ts +3 -2
- package/app/app.vue +4 -1
- package/app/assets/css/main.css +16 -0
- package/app/components/AddToWishlist.vue +13 -6
- package/app/components/Cart/Bar.vue +102 -0
- package/app/components/Cart/QuickView.vue +4 -0
- package/app/components/Cart/Upsell.vue +106 -0
- package/app/components/Category/Listing.vue +11 -3
- package/app/components/Checkout/Summary.vue +5 -1
- package/app/components/DemoBanner.vue +13 -0
- package/app/components/Feature/Card.vue +121 -0
- package/app/components/Features.vue +14 -9
- package/app/components/Footer/Contact.vue +5 -1
- package/app/components/Header/Right.vue +44 -15
- package/app/components/Hero.vue +126 -36
- package/app/components/Product/Card.vue +102 -50
- package/app/components/Product/CardCompact.vue +72 -0
- package/app/components/Product/CardDietBadges.vue +38 -31
- package/app/components/Product/CardIngredients.vue +35 -0
- package/app/components/Product/CardSkeleton.vue +10 -18
- package/app/components/Product/Category.vue +9 -2
- package/app/components/Product/Configurator.vue +11 -7
- package/app/components/Product/CrossSelling.vue +45 -34
- package/app/components/Product/DeselectIngredient.vue +37 -31
- package/app/components/Product/Detail.vue +73 -13
- package/app/components/Product/QuickView.vue +77 -0
- package/app/components/Topseller.vue +44 -34
- package/app/composables/useAddToCart.ts +3 -30
- package/app/composables/useCartQuickView.ts +19 -0
- package/app/composables/useCartUpsell.ts +100 -0
- package/app/composables/useCategorySeo.ts +5 -4
- package/app/composables/useProductCartQuantity.ts +15 -0
- package/app/composables/useProductCrossSelling.ts +1 -0
- package/app/composables/useProductDetail.ts +15 -1
- package/app/composables/useProductEvents.ts +30 -0
- package/app/composables/useProductQuickView.ts +65 -0
- package/app/composables/useTopSellers.ts +22 -0
- package/app/composables/useTrackEvent.ts +7 -0
- package/app/pages/index.vue +3 -1
- package/app/pages/suche.vue +18 -5
- package/app/types/Association.d.ts +1 -0
- package/app/utils/openingHours.ts +31 -8
- package/app/utils/product.ts +31 -0
- package/content/index.yml +16 -11
- package/content.config.ts +13 -0
- package/docs/notes/2026-09-12-issue-319-stylesheet-cost.md +154 -0
- package/docs/notes/2026-09-12-issue-325-product-card.md +100 -0
- package/docs/notes/2026-09-12-issue-327-home-hero.md +64 -0
- package/docs/notes/2026-09-13-demo-banner.md +32 -0
- package/docs/notes/2026-09-13-issue-332-home-info-cards.md +46 -0
- package/docs/notes/2026-09-13-quick-view-flicker.md +65 -0
- package/docs/notes/2026-09-14-cart-upsell.md +105 -0
- package/docs/notes/2026-09-14-demo-noindex.md +57 -0
- package/nuxt.config.ts +24 -0
- package/package.json +1 -1
- package/scripts/perf/first-render.mjs +30 -0
- package/scripts/perf/h2-proxy.cjs +49 -0
- package/scripts/perf/lighthouse.sh +22 -0
- package/scripts/perf/quick-view-layout.mjs +126 -0
- package/server/api/listing/[categoryId].get.ts +2 -0
- package/server/api/search.get.ts +2 -0
- package/test/e2e/simple-checkout-as-recurring-customer.test.ts +13 -17
- package/test/nuxt/CartBar.test.ts +110 -0
- package/test/nuxt/CartUpsell.test.ts +125 -0
- package/test/nuxt/DemoBanner.test.ts +12 -0
- package/test/nuxt/useAddToCart.test.ts +6 -19
- package/test/nuxt/useCartUpsell.test.ts +126 -0
- package/test/nuxt/useTrackEvent.test.ts +15 -0
- package/test/unit/openingHours.spec.ts +32 -1
- package/test/unit/product.spec.ts +72 -0
- package/test/unit/useCategorySeo.spec.ts +2 -1
- package/test/visual/playwright.config.ts +33 -0
- package/test/visual/visual.spec.ts +87 -0
- package/app/components/Product/CardDescription.vue +0 -27
- package/app/components/Product/CardFooter.vue +0 -61
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { Schemas } from "#shopware";
|
|
2
|
+
|
|
3
|
+
const UPSELL_LIMIT = 6;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Suggestions on the order confirmation step (#338): products flagged with the custom
|
|
7
|
+
* field `shopbite_cart_upsell`, added with quantity 1 in one click. Named
|
|
8
|
+
* "upsell" because "cross-selling" already means the extras of a product.
|
|
9
|
+
*/
|
|
10
|
+
export function useCartUpsell() {
|
|
11
|
+
const { apiClient } = useShopwareContext();
|
|
12
|
+
const { addLineItems } = useCartMutations();
|
|
13
|
+
const { triggerCartItemAdded } = useProductEvents();
|
|
14
|
+
const { trackUpsellAdd } = useTrackEvent();
|
|
15
|
+
|
|
16
|
+
const pendingProductIds = ref(new Set<string>());
|
|
17
|
+
|
|
18
|
+
async function loadUpsellProducts(): Promise<Schemas["Product"][]> {
|
|
19
|
+
try {
|
|
20
|
+
const result = await apiClient.invoke("readProduct post /product", {
|
|
21
|
+
// A flag on a variant parent applies to all its variants.
|
|
22
|
+
|
|
23
|
+
// @ts-expect-error sw-inheritance is missing from the generated header type
|
|
24
|
+
headers: { "sw-inheritance": "true" },
|
|
25
|
+
body: {
|
|
26
|
+
filter: [
|
|
27
|
+
{
|
|
28
|
+
type: "equals",
|
|
29
|
+
field: "customFields.shopbite_cart_upsell",
|
|
30
|
+
value: true,
|
|
31
|
+
},
|
|
32
|
+
// No variant parents: one click cannot choose a variant. Shopware
|
|
33
|
+
// only counts the children of main products, so the child count
|
|
34
|
+
// of a variant is null, not 0.
|
|
35
|
+
{
|
|
36
|
+
type: "multi",
|
|
37
|
+
operator: "or",
|
|
38
|
+
queries: [
|
|
39
|
+
{ type: "equals", field: "childCount", value: 0 },
|
|
40
|
+
{ type: "equals", field: "childCount", value: null },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
limit: UPSELL_LIMIT,
|
|
45
|
+
sort: [{ field: "name", order: "ASC" }],
|
|
46
|
+
includes: {
|
|
47
|
+
product: [
|
|
48
|
+
"id",
|
|
49
|
+
"productNumber",
|
|
50
|
+
"name",
|
|
51
|
+
"translated",
|
|
52
|
+
"calculatedPrice",
|
|
53
|
+
"available",
|
|
54
|
+
"cover",
|
|
55
|
+
],
|
|
56
|
+
calculated_price: ["totalPrice"],
|
|
57
|
+
product_media: ["media"],
|
|
58
|
+
media: ["url", "thumbnails"],
|
|
59
|
+
media_thumbnail: ["url", "width"],
|
|
60
|
+
},
|
|
61
|
+
associations: {
|
|
62
|
+
cover: { associations: { media: {} } },
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
return result.data.elements;
|
|
67
|
+
} catch (e) {
|
|
68
|
+
console.error("[useCartUpsell][loadUpsellProducts]", e);
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function isAdding(productId: string): boolean {
|
|
74
|
+
return pendingProductIds.value.has(productId);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async function addUpsellProduct(product: Schemas["Product"]): Promise<void> {
|
|
78
|
+
if (isAdding(product.id)) return;
|
|
79
|
+
pendingProductIds.value.add(product.id);
|
|
80
|
+
|
|
81
|
+
try {
|
|
82
|
+
// Failures are reported by useCartMutations; it resolves undefined.
|
|
83
|
+
const newCart = await addLineItems([
|
|
84
|
+
{ id: product.id, quantity: 1, type: "product" },
|
|
85
|
+
]);
|
|
86
|
+
if (!newCart) return;
|
|
87
|
+
|
|
88
|
+
triggerCartItemAdded(product, 1);
|
|
89
|
+
trackUpsellAdd(product, 1);
|
|
90
|
+
} finally {
|
|
91
|
+
pendingProductIds.value.delete(product.id);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
loadUpsellProducts,
|
|
97
|
+
addUpsellProduct,
|
|
98
|
+
isAdding,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
@@ -39,10 +39,11 @@ export function useCategorySeo(category: Ref<Schemas["Category"] | undefined>) {
|
|
|
39
39
|
|
|
40
40
|
const siteName = computed(() => config.public.site?.name || "");
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
// Only inactive categories get their own rule; otherwise @nuxtjs/robots
|
|
43
|
+
// renders the site rule, which is noindex on the demo shop.
|
|
44
|
+
const robots = computed(() =>
|
|
45
|
+
category.value?.active === false ? "noindex,nofollow" : undefined,
|
|
46
|
+
);
|
|
46
47
|
|
|
47
48
|
const canonicalUrl = computed(() => seoUrl.value || "");
|
|
48
49
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quantity of a product in the cart, across plain line items and the
|
|
3
|
+
* container items that carry extras (the product is the first child, #325).
|
|
4
|
+
*/
|
|
5
|
+
export function useProductCartQuantity(getProductId: () => string) {
|
|
6
|
+
const { cartItems } = useCart();
|
|
7
|
+
|
|
8
|
+
const quantity = computed(() =>
|
|
9
|
+
cartItems.value
|
|
10
|
+
.filter((item) => lineItemHoldsProduct(item, getProductId()))
|
|
11
|
+
.reduce((sum, item) => sum + (item.quantity ?? 0), 0),
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
return { quantity };
|
|
15
|
+
}
|
|
@@ -4,13 +4,26 @@ import type { AssociationItemProduct } from "~/types/Association";
|
|
|
4
4
|
export function useProductDetail(getProductId: () => string) {
|
|
5
5
|
const { trackProductView } = useTrackEvent();
|
|
6
6
|
|
|
7
|
-
const { data: productDetails, pending } = useFetch<{
|
|
7
|
+
const { data: productDetails, pending: isDetailLoading } = useFetch<{
|
|
8
8
|
product: Schemas["Product"];
|
|
9
9
|
configurator?: Schemas["PropertyGroup"][];
|
|
10
10
|
}>(() => `/api/product/${getProductId()}`, {
|
|
11
11
|
key: () => `product-${getProductId() ?? "none"}`,
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
+
// The extras belong to the product family: the backend resolves the
|
|
15
|
+
// cross-selling of a variant to the one of its parent. Keyed by the listing
|
|
16
|
+
// product, the request runs alongside the detail request instead of after
|
|
17
|
+
// it, and switching a variant does not reload the extras. Together with the
|
|
18
|
+
// single loading state below this keeps the quick view from re-rendering
|
|
19
|
+
// in stages (skeleton, options, extras).
|
|
20
|
+
const { associationItems, isAssociationsLoading } =
|
|
21
|
+
useProductCrossSelling(getProductId);
|
|
22
|
+
|
|
23
|
+
const pending = computed(
|
|
24
|
+
() => isDetailLoading.value || isAssociationsLoading.value,
|
|
25
|
+
);
|
|
26
|
+
|
|
14
27
|
const {
|
|
15
28
|
selectedProduct,
|
|
16
29
|
selectedQuantity,
|
|
@@ -50,6 +63,7 @@ export function useProductDetail(getProductId: () => string) {
|
|
|
50
63
|
|
|
51
64
|
return {
|
|
52
65
|
productDetails,
|
|
66
|
+
associationItems,
|
|
53
67
|
pending,
|
|
54
68
|
selectedProduct,
|
|
55
69
|
selectedQuantity,
|
|
@@ -1,12 +1,34 @@
|
|
|
1
|
+
import type { Schemas } from "#shopware";
|
|
1
2
|
import { ref, watch } from "vue";
|
|
2
3
|
|
|
4
|
+
export type CartAddition = {
|
|
5
|
+
id: number;
|
|
6
|
+
product: Schemas["Product"];
|
|
7
|
+
quantity: number;
|
|
8
|
+
};
|
|
9
|
+
|
|
3
10
|
const productAddedTrigger = ref(0);
|
|
11
|
+
const lastCartAddition = ref<CartAddition | null>(null);
|
|
4
12
|
|
|
5
13
|
export const useProductEvents = () => {
|
|
14
|
+
/** Product added to the cart or the wishlist; closes the search. */
|
|
6
15
|
const triggerProductAdded = () => {
|
|
7
16
|
productAddedTrigger.value++;
|
|
8
17
|
};
|
|
9
18
|
|
|
19
|
+
/** A product went into the cart; the cart bar and the header badge react (#325). */
|
|
20
|
+
const triggerCartItemAdded = (
|
|
21
|
+
product: Schemas["Product"],
|
|
22
|
+
quantity: number,
|
|
23
|
+
) => {
|
|
24
|
+
lastCartAddition.value = {
|
|
25
|
+
id: productAddedTrigger.value + 1,
|
|
26
|
+
product,
|
|
27
|
+
quantity,
|
|
28
|
+
};
|
|
29
|
+
triggerProductAdded();
|
|
30
|
+
};
|
|
31
|
+
|
|
10
32
|
const onProductAdded = (callback: () => void) => {
|
|
11
33
|
watch(productAddedTrigger, () => {
|
|
12
34
|
if (productAddedTrigger.value > 0) {
|
|
@@ -15,8 +37,16 @@ export const useProductEvents = () => {
|
|
|
15
37
|
});
|
|
16
38
|
};
|
|
17
39
|
|
|
40
|
+
const onCartItemAdded = (callback: (addition: CartAddition) => void) => {
|
|
41
|
+
watch(lastCartAddition, (addition) => {
|
|
42
|
+
if (addition) callback(addition);
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
18
46
|
return {
|
|
19
47
|
triggerProductAdded,
|
|
48
|
+
triggerCartItemAdded,
|
|
20
49
|
onProductAdded,
|
|
50
|
+
onCartItemAdded,
|
|
21
51
|
};
|
|
22
52
|
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Schemas } from "#shopware";
|
|
2
|
+
import type { LocationQueryRaw } from "vue-router";
|
|
3
|
+
|
|
4
|
+
/** Query parameter that holds the product number of the open quick view. */
|
|
5
|
+
export const PRODUCT_QUICK_VIEW_PARAM = "produkt";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The product quick view (options, quantity, add to cart) is a drawer over
|
|
9
|
+
* the listing whose state lives in the URL: `?produkt=<productNumber>` opens
|
|
10
|
+
* it, so a product can be linked and the back button closes it (#325).
|
|
11
|
+
*/
|
|
12
|
+
export function useProductQuickView(
|
|
13
|
+
products: MaybeRefOrGetter<Schemas["Product"][]>,
|
|
14
|
+
) {
|
|
15
|
+
const route = useRoute();
|
|
16
|
+
const router = useRouter();
|
|
17
|
+
|
|
18
|
+
const requestedNumber = computed(() => {
|
|
19
|
+
const value = route.query[PRODUCT_QUICK_VIEW_PARAM];
|
|
20
|
+
return typeof value === "string" && value !== "" ? value : undefined;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const product = computed(() =>
|
|
24
|
+
requestedNumber.value
|
|
25
|
+
? toValue(products).find(
|
|
26
|
+
(candidate) => candidate.productNumber === requestedNumber.value,
|
|
27
|
+
)
|
|
28
|
+
: undefined,
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
// The drawer is created on first use, not with the page (#314).
|
|
32
|
+
const mounted = ref(false);
|
|
33
|
+
watch(
|
|
34
|
+
product,
|
|
35
|
+
(value) => {
|
|
36
|
+
if (value) mounted.value = true;
|
|
37
|
+
},
|
|
38
|
+
{ immediate: true },
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const open = computed({
|
|
42
|
+
get: () => product.value !== undefined,
|
|
43
|
+
set: (value) => {
|
|
44
|
+
if (!value) close();
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
function show(candidate: Schemas["Product"]) {
|
|
49
|
+
if (requestedNumber.value === candidate.productNumber) return;
|
|
50
|
+
router.push({
|
|
51
|
+
query: {
|
|
52
|
+
...route.query,
|
|
53
|
+
[PRODUCT_QUICK_VIEW_PARAM]: candidate.productNumber,
|
|
54
|
+
} satisfies LocationQueryRaw,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function close() {
|
|
59
|
+
if (!requestedNumber.value) return;
|
|
60
|
+
const { [PRODUCT_QUICK_VIEW_PARAM]: _omitted, ...query } = route.query;
|
|
61
|
+
router.replace({ query });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return { product, open, mounted, show, close };
|
|
65
|
+
}
|
|
@@ -4,20 +4,42 @@ export type useTopSellersReturn = {
|
|
|
4
4
|
loadTopSellers(): Promise<Schemas["Product"][]>;
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
+
const TOP_SELLERS_LIMIT = 8;
|
|
8
|
+
|
|
7
9
|
export function useTopSellers(): useTopSellersReturn {
|
|
8
10
|
const { apiClient } = useShopwareContext();
|
|
9
11
|
async function loadTopSellers() {
|
|
10
12
|
try {
|
|
11
13
|
const result = await apiClient.invoke("readProduct post /product", {
|
|
14
|
+
// Variants marked as top sellers inherit name, cover and properties.
|
|
15
|
+
|
|
16
|
+
// @ts-expect-error sw-inheritance is missing from the generated header type
|
|
17
|
+
headers: { "sw-inheritance": "true" },
|
|
12
18
|
body: {
|
|
13
19
|
filter: [{ type: "equals", field: "markAsTopseller", value: true }],
|
|
20
|
+
limit: TOP_SELLERS_LIMIT,
|
|
21
|
+
// What the compact card and the quick view need (#327).
|
|
14
22
|
includes: {
|
|
15
23
|
product: [
|
|
24
|
+
"id",
|
|
16
25
|
"productNumber",
|
|
17
26
|
"name",
|
|
27
|
+
"translated",
|
|
18
28
|
"description",
|
|
19
29
|
"calculatedPrice",
|
|
30
|
+
"available",
|
|
31
|
+
"cover",
|
|
32
|
+
"sortedProperties",
|
|
20
33
|
],
|
|
34
|
+
product_media: ["media"],
|
|
35
|
+
media: ["url", "thumbnails"],
|
|
36
|
+
media_thumbnail: ["width", "url"],
|
|
37
|
+
property_group: ["id", "name", "translated", "options"],
|
|
38
|
+
property_group_option: ["id", "name", "translated"],
|
|
39
|
+
},
|
|
40
|
+
associations: {
|
|
41
|
+
cover: { associations: { media: {} } },
|
|
42
|
+
properties: { associations: { group: {} } },
|
|
21
43
|
},
|
|
22
44
|
},
|
|
23
45
|
});
|
|
@@ -58,6 +58,12 @@ export function useTrackEvent() {
|
|
|
58
58
|
push(["trackEvent", "Cart", "AddToCart", product.productNumber, quantity]);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
// A separate action, so the cart suggestions are measurable apart from
|
|
62
|
+
// regular adds (#338).
|
|
63
|
+
function trackUpsellAdd(product: Schemas["Product"], quantity: number) {
|
|
64
|
+
push(["trackEvent", "Cart", "UpsellAdd", product.productNumber, quantity]);
|
|
65
|
+
}
|
|
66
|
+
|
|
61
67
|
function trackSearch(term: string, productNumbers: string[]) {
|
|
62
68
|
push(["trackSiteSearch", term, false, productNumbers.length]);
|
|
63
69
|
}
|
|
@@ -68,6 +74,7 @@ export function useTrackEvent() {
|
|
|
68
74
|
trackOrder,
|
|
69
75
|
trackAddToWishlist,
|
|
70
76
|
trackAddToCart,
|
|
77
|
+
trackUpsellAdd,
|
|
71
78
|
trackSearch,
|
|
72
79
|
};
|
|
73
80
|
}
|
package/app/pages/index.vue
CHANGED
|
@@ -39,7 +39,7 @@ useRestaurantSchema();
|
|
|
39
39
|
<template>
|
|
40
40
|
<div v-if="page" class="relative">
|
|
41
41
|
<Hero
|
|
42
|
-
:title="page.title"
|
|
42
|
+
:title="page.hero.title || page.title"
|
|
43
43
|
:background-video="page.hero.backgroundVideo"
|
|
44
44
|
:poster="page.hero.poster"
|
|
45
45
|
:description="page.description"
|
|
@@ -48,6 +48,8 @@ useRestaurantSchema();
|
|
|
48
48
|
:usps="page.hero.usps"
|
|
49
49
|
/>
|
|
50
50
|
|
|
51
|
+
<Topseller />
|
|
52
|
+
|
|
51
53
|
<USeparator :ui="{ border: 'border-primary/30' }" />
|
|
52
54
|
|
|
53
55
|
<Features
|
package/app/pages/suche.vue
CHANGED
|
@@ -68,6 +68,12 @@ const { data: fallbackProducts, refresh: refreshFallback } = useLazyAsyncData<
|
|
|
68
68
|
{ immediate: false },
|
|
69
69
|
);
|
|
70
70
|
|
|
71
|
+
// One quick view for the results and the fallback suggestions (#325).
|
|
72
|
+
const quickView = useProductQuickView(() => [
|
|
73
|
+
...elements.value,
|
|
74
|
+
...(fallbackProducts.value ?? []),
|
|
75
|
+
]);
|
|
76
|
+
|
|
71
77
|
watch(showFallback, (visible) => {
|
|
72
78
|
if (visible && !fallbackProducts.value) {
|
|
73
79
|
refreshFallback();
|
|
@@ -92,6 +98,11 @@ function submitSearch() {
|
|
|
92
98
|
<UContainer>
|
|
93
99
|
<UPage>
|
|
94
100
|
<UPageBody>
|
|
101
|
+
<LazyProductQuickView
|
|
102
|
+
v-if="quickView.mounted.value"
|
|
103
|
+
v-model:open="quickView.open.value"
|
|
104
|
+
:product="quickView.product.value"
|
|
105
|
+
/>
|
|
95
106
|
<div class="flex flex-col gap-4">
|
|
96
107
|
<div class="flex flex-col sm:flex-row gap-4">
|
|
97
108
|
<UInput
|
|
@@ -135,7 +146,7 @@ function submitSearch() {
|
|
|
135
146
|
|
|
136
147
|
<div
|
|
137
148
|
v-if="showSkeleton"
|
|
138
|
-
class="
|
|
149
|
+
class="grid grid-cols-1 gap-4 xl:grid-cols-2"
|
|
139
150
|
aria-busy="true"
|
|
140
151
|
aria-label="Produkte werden geladen"
|
|
141
152
|
>
|
|
@@ -144,7 +155,7 @@ function submitSearch() {
|
|
|
144
155
|
|
|
145
156
|
<div
|
|
146
157
|
v-else-if="elements.length > 0"
|
|
147
|
-
class="
|
|
158
|
+
class="grid grid-cols-1 gap-4 transition-opacity duration-200 xl:grid-cols-2"
|
|
148
159
|
:class="{ 'opacity-40 pointer-events-none': loading }"
|
|
149
160
|
>
|
|
150
161
|
<ProductCardWhenVisible
|
|
@@ -152,7 +163,8 @@ function submitSearch() {
|
|
|
152
163
|
:key="product.id"
|
|
153
164
|
:product="product"
|
|
154
165
|
:with-favorite-button="true"
|
|
155
|
-
:
|
|
166
|
+
:selectable="true"
|
|
167
|
+
@select="quickView.show"
|
|
156
168
|
/>
|
|
157
169
|
</div>
|
|
158
170
|
|
|
@@ -162,13 +174,14 @@ function submitSearch() {
|
|
|
162
174
|
</p>
|
|
163
175
|
<template v-if="showFallback && fallbackProducts?.length">
|
|
164
176
|
<p class="text-sm font-medium mt-2">Das könnte dir gefallen:</p>
|
|
165
|
-
<div class="
|
|
177
|
+
<div class="grid grid-cols-1 gap-4 xl:grid-cols-2">
|
|
166
178
|
<ProductCardWhenVisible
|
|
167
179
|
v-for="product in fallbackProducts"
|
|
168
180
|
:key="product.id"
|
|
169
181
|
:product="product"
|
|
170
182
|
:with-favorite-button="true"
|
|
171
|
-
:
|
|
183
|
+
:selectable="true"
|
|
184
|
+
@select="quickView.show"
|
|
172
185
|
/>
|
|
173
186
|
</div>
|
|
174
187
|
</template>
|
|
@@ -17,6 +17,36 @@ const DAY_LABELS = ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"] as const;
|
|
|
17
17
|
|
|
18
18
|
const formatTime = (time: string) => time.slice(0, 5);
|
|
19
19
|
|
|
20
|
+
/** Intervals of one weekday (1 = Monday … 7 = Sunday), e.g. `["11:30–14:30"]`. */
|
|
21
|
+
export function intervalsForDay(
|
|
22
|
+
businessHours: BusinessHourLike[],
|
|
23
|
+
dayOfWeek: number,
|
|
24
|
+
): string[] {
|
|
25
|
+
return businessHours
|
|
26
|
+
.filter(
|
|
27
|
+
(bh) => bh.dayOfWeek === dayOfWeek && bh.openingTime && bh.closingTime,
|
|
28
|
+
)
|
|
29
|
+
.sort((a, b) => a.openingTime!.localeCompare(b.openingTime!))
|
|
30
|
+
.map(
|
|
31
|
+
(bh) => `${formatTime(bh.openingTime!)}–${formatTime(bh.closingTime!)}`,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Today's hours as a sentence for the information cards (#332):
|
|
37
|
+
* `Heute 11:30–14:30 und 17:30–23:00`, or `Heute Ruhetag` on a closed day.
|
|
38
|
+
*/
|
|
39
|
+
export function formatTodayHours(
|
|
40
|
+
businessHours: BusinessHourLike[],
|
|
41
|
+
date: Date,
|
|
42
|
+
): string {
|
|
43
|
+
const dayOfWeek = date.getDay() === 0 ? 7 : date.getDay();
|
|
44
|
+
const intervals = intervalsForDay(businessHours, dayOfWeek);
|
|
45
|
+
return intervals.length === 0
|
|
46
|
+
? "Heute Ruhetag"
|
|
47
|
+
: `Heute ${intervals.join(" und ")}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
20
50
|
/**
|
|
21
51
|
* Groups business hours into display rows: consecutive days (Monday to
|
|
22
52
|
* Sunday) with the same intervals share a row. Returns an empty list if no
|
|
@@ -26,14 +56,7 @@ export function groupOpeningHours(
|
|
|
26
56
|
businessHours: BusinessHourLike[],
|
|
27
57
|
): OpeningHoursRow[] {
|
|
28
58
|
const intervalsByDay = DAY_LABELS.map((_, index) =>
|
|
29
|
-
businessHours
|
|
30
|
-
.filter(
|
|
31
|
-
(bh) => bh.dayOfWeek === index + 1 && bh.openingTime && bh.closingTime,
|
|
32
|
-
)
|
|
33
|
-
.sort((a, b) => a.openingTime!.localeCompare(b.openingTime!))
|
|
34
|
-
.map(
|
|
35
|
-
(bh) => `${formatTime(bh.openingTime!)}–${formatTime(bh.closingTime!)}`,
|
|
36
|
-
),
|
|
59
|
+
intervalsForDay(businessHours, index + 1),
|
|
37
60
|
);
|
|
38
61
|
|
|
39
62
|
if (intervalsByDay.every((intervals) => intervals.length === 0)) return [];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Schemas } from "#shopware";
|
|
2
|
+
|
|
3
|
+
const MAIN_INGREDIENTS_GROUP = "Hauptzutaten";
|
|
4
|
+
|
|
5
|
+
/** `available` is optional in the projection; missing means orderable. */
|
|
6
|
+
export function productIsAvailable(product: Schemas["Product"]): boolean {
|
|
7
|
+
return product.available !== false;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Whether a cart line item holds the product, as a plain line item or as a
|
|
12
|
+
* container item carrying extras (the product is the first child, #325).
|
|
13
|
+
*/
|
|
14
|
+
export function lineItemHoldsProduct(
|
|
15
|
+
item: Schemas["LineItem"],
|
|
16
|
+
productId: string,
|
|
17
|
+
): boolean {
|
|
18
|
+
return (
|
|
19
|
+
item.referencedId === productId ||
|
|
20
|
+
(item.children ?? []).some((child) => child.referencedId === productId)
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function getMainIngredients(
|
|
25
|
+
sortedProperties: Schemas["PropertyGroup"][] | undefined,
|
|
26
|
+
): Schemas["PropertyGroupOption"][] {
|
|
27
|
+
const group = sortedProperties?.find(
|
|
28
|
+
(propertyGroup) => propertyGroup.translated.name === MAIN_INGREDIENTS_GROUP,
|
|
29
|
+
);
|
|
30
|
+
return group?.options ?? [];
|
|
31
|
+
}
|
package/content/index.yml
CHANGED
|
@@ -5,6 +5,7 @@ seo:
|
|
|
5
5
|
title: ShopBite
|
|
6
6
|
description: Reduziere Kosten und steigere deinen Umsatz
|
|
7
7
|
hero:
|
|
8
|
+
title: Frisch gekocht, schnell geliefert.
|
|
8
9
|
backgroundVideo: https://veliu-minio.cjcbee.easypanel.host/shopbite-demo-shopware/media/f8/66/7e/1789150226/background.mp4?ts=1789150226
|
|
9
10
|
poster: /hero-poster.webp
|
|
10
11
|
headline: SHOPBITE
|
|
@@ -39,20 +40,24 @@ features:
|
|
|
39
40
|
headline: SHOPBITE
|
|
40
41
|
features:
|
|
41
42
|
- title: Öffnungszeiten
|
|
42
|
-
|
|
43
|
+
kind: hours
|
|
44
|
+
description: Samstags 17:30 - 23:30 Uhr, Dienstag ist Ruhetag.
|
|
43
45
|
icon: i-lucide-clock
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
link:
|
|
47
|
+
label: Alle Öffnungszeiten
|
|
48
|
+
to: "#oeffnungszeiten"
|
|
46
49
|
- title: Lieferung
|
|
47
|
-
|
|
50
|
+
kind: delivery
|
|
51
|
+
description: Wir liefern nach Obertshausen und Lämmerspiel. Ab 15 € frei Haus, darunter 1 € Liefergebühr.
|
|
48
52
|
icon: i-lucide-truck
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
description:
|
|
53
|
-
icon: i-lucide-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
- title: Reservierung
|
|
54
|
+
kind: reservation
|
|
55
|
+
lead: Tisch nur telefonisch
|
|
56
|
+
description: Bestellungen nehmen wir gerne online oder telefonisch entgegen.
|
|
57
|
+
icon: i-lucide-phone
|
|
58
|
+
link:
|
|
59
|
+
label: 06104 77777 anrufen
|
|
60
|
+
to: "tel:+490610477777"
|
|
56
61
|
marquee:
|
|
57
62
|
title: Das lieben unsere Kunden
|
|
58
63
|
description: Kundenbilder
|
package/content.config.ts
CHANGED
|
@@ -41,6 +41,17 @@ const createBaseSchema = () =>
|
|
|
41
41
|
const createFeatureSchema = () =>
|
|
42
42
|
createBaseSchema().extend({
|
|
43
43
|
icon: z.string().editor({ input: "icon" }),
|
|
44
|
+
// Information cards on the home page (#332): `kind` fills the lead line
|
|
45
|
+
// with live data (today's hours, delivery time), `lead` is the static
|
|
46
|
+
// alternative, `link` the card's action (a `tel:` target is a button).
|
|
47
|
+
kind: createEnum(["hours", "delivery", "reservation"]).optional(),
|
|
48
|
+
lead: z.string().optional(),
|
|
49
|
+
link: z
|
|
50
|
+
.object({
|
|
51
|
+
label: z.string().nonempty(),
|
|
52
|
+
to: z.string().nonempty(),
|
|
53
|
+
})
|
|
54
|
+
.optional(),
|
|
44
55
|
ui: z
|
|
45
56
|
.object({
|
|
46
57
|
leading: z.string().optional(),
|
|
@@ -58,6 +69,8 @@ export default defineContentConfig({
|
|
|
58
69
|
backgroundVideo: z.string().optional(),
|
|
59
70
|
poster: z.string().optional(),
|
|
60
71
|
headline: z.string().optional(),
|
|
72
|
+
// Hero title; the page title (shop name) is the fallback (#327).
|
|
73
|
+
title: z.string().optional(),
|
|
61
74
|
links: z.array(createLinkSchema()),
|
|
62
75
|
usps: z.array(
|
|
63
76
|
z.object({
|