@shopbite-de/storefront 1.26.0 → 1.27.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/.gitignore +40 -0
- package/CLAUDE.md +10 -3
- package/app/app.vue +4 -1
- package/app/components/Hero.vue +17 -7
- package/app/components/Product/CrossSelling.vue +137 -24
- package/app/components/Product/DeselectIngredient.vue +9 -2
- package/app/components/Product/Detail.vue +16 -18
- package/app/components/Product/QuickView.vue +5 -4
- package/app/components/User/RegistrationForm.vue +73 -29
- package/app/composables/useStoreStatus.ts +12 -7
- package/app/composables/useSyncWishlist.ts +119 -0
- package/app/pages/[...all].vue +9 -3
- package/app/pages/index.vue +1 -5
- package/app/pages/kontakt.vue +1 -5
- package/app/pages/registrierung/bestaetigen.vue +100 -27
- package/app/pages/registrierung/index.vue +20 -1
- package/app/utils/notFound.ts +14 -0
- package/content/index.yml +9 -9
- package/docs/notes/2026-09-17-quick-view-compact-options.md +63 -0
- package/docs/notes/2026-09-21-dependency-update.md +89 -0
- package/docs/notes/2026-09-21-issue-273-cache-and-demo-video.md +49 -0
- package/docs/notes/2026-09-21-issue-363-non-fatal-404.md +43 -0
- package/docs/notes/2026-09-21-issue-365-home-hydration-mismatch.md +47 -0
- package/docs/notes/2026-09-21-issue-366-wishlist-404.md +41 -0
- package/docs/notes/2026-09-21-issue-369-register-confirm.md +35 -0
- package/modules/public-cache.ts +44 -0
- package/node.dockerfile +3 -3
- package/nuxt.config.ts +6 -0
- package/package.json +26 -26
- package/patches/@shopware__nuxt-module@1.5.2.patch +13 -0
- package/pnpm-workspace.yaml +3 -1
- package/shopware.d.ts +1 -1
- package/test/nuxt/Hero.test.ts +60 -2
- package/test/nuxt/ProductCrossSelling.test.ts +99 -0
- package/test/nuxt/RegisterConfirmPage.test.ts +117 -0
- package/test/nuxt/RegistrationForm.test.ts +132 -2
- package/test/nuxt/notFound.test.ts +13 -0
- package/test/nuxt/useSearchTracking.test.ts +3 -0
- package/test/nuxt/useStoreStatus.test.ts +40 -10
- package/test/nuxt/useSyncWishlist.test.ts +85 -0
- package/test/unit/publicCache.spec.ts +64 -0
- package/patches/@shopware__nuxt-module@1.5.1.patch +0 -32
|
@@ -25,7 +25,7 @@ jobs:
|
|
|
25
25
|
|
|
26
26
|
- uses: pnpm/action-setup@v6
|
|
27
27
|
with:
|
|
28
|
-
version:
|
|
28
|
+
version: 12.5.1
|
|
29
29
|
|
|
30
30
|
- uses: actions/setup-node@v7
|
|
31
31
|
with:
|
|
@@ -69,7 +69,7 @@ jobs:
|
|
|
69
69
|
|
|
70
70
|
- uses: pnpm/action-setup@v6
|
|
71
71
|
with:
|
|
72
|
-
version:
|
|
72
|
+
version: 12.5.1
|
|
73
73
|
|
|
74
74
|
- uses: actions/setup-node@v7
|
|
75
75
|
with:
|
|
@@ -105,7 +105,7 @@ jobs:
|
|
|
105
105
|
|
|
106
106
|
- uses: pnpm/action-setup@v6
|
|
107
107
|
with:
|
|
108
|
-
version:
|
|
108
|
+
version: 12.5.1
|
|
109
109
|
|
|
110
110
|
- uses: actions/setup-node@v7
|
|
111
111
|
with:
|
package/.gitignore
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Nuxt dev/build outputs
|
|
2
|
+
.output
|
|
3
|
+
.data
|
|
4
|
+
.nuxt
|
|
5
|
+
.nitro
|
|
6
|
+
.cache
|
|
7
|
+
dist
|
|
8
|
+
|
|
9
|
+
# Node dependencies
|
|
10
|
+
node_modules
|
|
11
|
+
|
|
12
|
+
# Logs
|
|
13
|
+
logs
|
|
14
|
+
*.log
|
|
15
|
+
|
|
16
|
+
# Misc
|
|
17
|
+
.DS_Store
|
|
18
|
+
.fleet
|
|
19
|
+
.idea
|
|
20
|
+
|
|
21
|
+
# Local env files
|
|
22
|
+
.env
|
|
23
|
+
.env.*
|
|
24
|
+
!.env.example
|
|
25
|
+
coverage
|
|
26
|
+
test-results
|
|
27
|
+
playwright-report
|
|
28
|
+
|
|
29
|
+
# Playwright
|
|
30
|
+
/playwright-report/
|
|
31
|
+
/blob-report/
|
|
32
|
+
/playwright/.cache/
|
|
33
|
+
/playwright/.auth/
|
|
34
|
+
|
|
35
|
+
# Performance tooling (scripts/perf)
|
|
36
|
+
scripts/perf/out
|
|
37
|
+
scripts/perf/exp
|
|
38
|
+
scripts/perf/*.pem
|
|
39
|
+
test/visual/__snapshots__
|
|
40
|
+
test/visual/results
|
package/CLAUDE.md
CHANGED
|
@@ -28,6 +28,10 @@ pnpm generate-types # Regenerate api-types/storeApiTypes.d.ts from schema (the
|
|
|
28
28
|
pnpm load-schema # Reload Shopware API schema
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
### Package manager
|
|
32
|
+
|
|
33
|
+
pnpm 12 (pinned in `package.json`, CI and `node.dockerfile`). Settings live in `pnpm-workspace.yaml` (`.npmrc` is auth/registry only since pnpm 11). pnpm 12 rejects packages published less than 24 hours ago (`minimumReleaseAge`), also in an existing lockfile; update dependencies with pnpm 12 itself, not an older global pnpm (`docs/notes/2026-09-21-dependency-update.md`).
|
|
34
|
+
|
|
31
35
|
### Running a single test
|
|
32
36
|
|
|
33
37
|
```bash
|
|
@@ -47,7 +51,7 @@ Always run `nuxt typecheck` via the `pnpm typecheck` script, not via `npx vue-ts
|
|
|
47
51
|
|
|
48
52
|
- `shopware.d.ts` falls back to the api-client's default types for operations/schemas our instance does not expose, and keeps `LineItem.payload` optional.
|
|
49
53
|
- `api-gen.config.json` applies the upstream schema patches plus `api-types/storeApiSchema.shopbite.overrides.json` when generating types.
|
|
50
|
-
- `patches/@shopware__nuxt-module@1.5.
|
|
54
|
+
- `patches/@shopware__nuxt-module@1.5.2.patch` (pnpm patch) points the plugin's `ShopwareNuxtOptions` import at `./dist/index` (the package ships no `src/`). Since 1.5.2 the plugin carries its explicit type upstream, so this one line is all that is left. When Renovate bumps `@shopware/nuxt-module`, the patch must be re-applied to the new version (`pnpm patch @shopware/nuxt-module@<version>`), or dropped once upstream fixes the import.
|
|
51
55
|
|
|
52
56
|
Do not name a project composable like one from the `@shopware/composables` layer (e.g. `useCategory`): the project version shadows the layer's inside the layer's own code as well.
|
|
53
57
|
|
|
@@ -87,6 +91,7 @@ Key custom composables:
|
|
|
87
91
|
- **`useAddToCart`** – products with extras/toppings use UUID v5 (product ID + sorted extras) as container item reference; simple products bypass the container
|
|
88
92
|
- **`useAddressAutocomplete`** – proxies Geoapify through `/api/address/autocomplete` to avoid exposing the API key client-side
|
|
89
93
|
- **`useShopBiteConfig`** – fetches delivery config and checkout state from the custom Shopware plugin
|
|
94
|
+
- **`useSyncWishlist`** – deliberate override of the layer composable (copy of `@shopware/composables` 1.13.0) that does not log the expected 404/403 of a missing or disabled wishlist (#366); compare with the layer source when Renovate bumps `@shopware/composables`
|
|
90
95
|
|
|
91
96
|
### Product data model (what Shopware must contain)
|
|
92
97
|
|
|
@@ -94,7 +99,7 @@ The storefront reads plain Shopware entities with fixed names; seed data must ma
|
|
|
94
99
|
|
|
95
100
|
- **Navigation:** menu sections are the children of the sales channel navigation root (`readNavigation main-navigation`), optionally scoped by `runtimeConfig.public.shopBite.menuCategoryId`. Category icon comes from the custom field `shopbite_category_icon` (icones.js.org name such as `i-lucide-pizza`), set by the ShopBite plugin.
|
|
96
101
|
- **Property groups:** `Hauptzutaten` (ingredients on the card, deselectable on the detail page, removed ones are appended to the cart label with "-"), `Vegetarisch` and `Vegan` with the option `Ja` (diet badges), `Küche` (kitchen badge). Filterable groups appear as listing filters.
|
|
97
|
-
- **Extras:** product cross-sellings of type `productList`; the cross-selling name is the label ("Extras", "Beilagen"), the assigned products need a price and sales-channel visibility but no category. Selected extras are sent as children of a `container` line item (`useAddToCart.ts`, handled by the ShopBite plugin). The product card has no buttons: the card opens the quick view drawer (`Product/QuickView.vue`), whose state is the `produkt` query parameter (product number) via `useProductQuickView` (#325).
|
|
102
|
+
- **Extras:** product cross-sellings of type `productList`; the cross-selling name is the label ("Extras", "Beilagen"), the assigned products need a price and sales-channel visibility but no category. In the quick view each cross-selling is a collapsible checkbox list that shows 6 entries of a long list and a search field above 15 entries (`Product/CrossSelling.vue`). Selected extras are sent as children of a `container` line item (`useAddToCart.ts`, handled by the ShopBite plugin). The product card has no buttons: the card opens the quick view drawer (`Product/QuickView.vue`), whose state is the `produkt` query parameter (product number) via `useProductQuickView` (#325).
|
|
98
103
|
- **Custom fields on products:** `shopbite_receipt_print_type` (`number` prints the menu number on the receipt, `label` prints the name) and `shopbite_delivery_time_factor` (int) and `shopbite_cart_upsell` (bool, suggests the product on the order confirmation step `/bestellung/bestaetigen` via `useCartUpsell`; variant parents are never suggested, a flag on a parent applies to its variants), all from the ShopBite plugin.
|
|
99
104
|
- **Variants:** standard configurator settings (`Product/Configurator.vue`); `server/api/product/variant.get.ts` resolves a variant by option ids.
|
|
100
105
|
|
|
@@ -104,6 +109,8 @@ The storefront reads plain Shopware entities with fixed names; seed data must ma
|
|
|
104
109
|
`server/utils/shopware/adminApiClient.ts` — Admin API client for server-side Shopware operations requiring elevated credentials.
|
|
105
110
|
`server/api/__sitemap__/urls.get.ts` — dynamic `@nuxtjs/sitemap` source (navigation categories from the Store API).
|
|
106
111
|
`server/utils/storeApi.ts` — `storeApiPost()` and `MEDIA_INCLUDES` for the routes above. Always send Store API criteria as a POST body (also via `apiClient.invoke("… post …", { body })`): as `_criteria` query parameters Shopware ignores the `includes` projection and returns every field (#312).
|
|
112
|
+
Pages without content throw `createNotFoundError()` (`app/utils/notFound.ts`): fatal only in the browser, because a fatal error makes Nitro log a `[request error] [fatal]` block per scanner request (#363).
|
|
113
|
+
`modules/public-cache.ts` (local module, also active in shops extending the layer) adds a 30-day `Cache-Control` route rule for every file in the `public/` folders of all layers; Nitro serves them without one. `image.ipx.maxAge` gives resized logos the same lifetime. Replace a public file under a new name (#273).
|
|
107
114
|
`server/api/content/*.get.ts` — Nuxt Content queries for the pages. Do not call `queryCollection()` in page code: in the browser it downloads the SQLite WASM build (865 KB) on client-side navigation (#314).
|
|
108
115
|
|
|
109
116
|
### Client-side JavaScript budget (#314)
|
|
@@ -126,7 +133,7 @@ The storefront reads plain Shopware entities with fixed names; seed data must ma
|
|
|
126
133
|
- `app.vue` sets the title template (`site.titleTemplate`), canonical from the route, `og:url`, fallback `og:image` (`site.ogImage`) and `twitter:card`. Page titles are plain (`"Warenkorb"`), never suffixed with the shop name. Indexable pages use `usePageSeo` (`standalone: true` skips the template, home page); categories use `useCategorySeo`, which overrides the canonical with the SEO URL.
|
|
127
134
|
- Shopware category SEO URLs end in `/` and 404 without it, but the sitemap module strips trailing slashes from every URL. Sitemap entries that need the slash carry `_trailingSlash: true`; `server/plugins/sitemap-trailing-slash.ts` restores it in the XML. Never normalise trailing slashes of backend SEO URLs.
|
|
128
135
|
- `@nuxtjs/sitemap` must stay before `@nuxt/content` in `modules`; content collections need the `sitemap` schema field to appear in the sitemap.
|
|
129
|
-
- Shop contact data (NAP) lives in `runtimeConfig.public.site` (`address.*`, `telephone`, `googleBusinessProfileUrl`) and is rendered by `components/Footer/Contact.vue`. `useBusinessHours`/`useHolidays` use `immediate: false` (app.vue loads them on mount); a component that needs them in the SSR HTML calls `onServerPrefetch(() => refresh())`. In the browser both requests are retried twice (`withRetries`); `useOpeningHoursData` gives components the combined loading/failed state and `retry()`, and reports a failure only after mounting (a failed server prefetch would otherwise break hydration, #355).
|
|
136
|
+
- Shop contact data (NAP) lives in `runtimeConfig.public.site` (`address.*`, `telephone`, `googleBusinessProfileUrl`) and is rendered by `components/Footer/Contact.vue`. `useBusinessHours`/`useHolidays` use `immediate: false` (app.vue loads them on mount); a component that needs them in the SSR HTML calls `onServerPrefetch(() => refresh())`. In the browser both requests are retried twice (`withRetries`); `useOpeningHoursData` gives components the combined loading/failed state and `retry()`, and reports a failure only after mounting (a failed server prefetch would otherwise break hydration, #355). Anything that depends on the current time (open/closed status, "today") is computed after mounting: `useStoreStatus` starts its clock in `onMounted`, because the home page prefetches the hours on the server and the server's clock and time zone differ from the visitor's (hydration mismatch, #365).
|
|
130
137
|
|
|
131
138
|
### Testing setup
|
|
132
139
|
|
package/app/app.vue
CHANGED
|
@@ -43,9 +43,12 @@ const { refresh: refreshHolidays } = useHolidays();
|
|
|
43
43
|
const { refreshCart } = useCart();
|
|
44
44
|
const { getWishlistProducts } = useWishlist();
|
|
45
45
|
|
|
46
|
+
// The wishlist page (app/pages/merkliste.vue) loads the products itself.
|
|
47
|
+
const WISHLIST_ROUTE_NAME = "merkliste";
|
|
48
|
+
|
|
46
49
|
if (import.meta.client) {
|
|
47
50
|
// getting the wishlist products should not block SSR
|
|
48
|
-
if (
|
|
51
|
+
if (router.currentRoute.value.name !== WISHLIST_ROUTE_NAME) {
|
|
49
52
|
getWishlistProducts(); // initial page loading
|
|
50
53
|
}
|
|
51
54
|
}
|
package/app/components/Hero.vue
CHANGED
|
@@ -165,18 +165,26 @@ const secondaryLinks = computed(() => props.links.slice(1));
|
|
|
165
165
|
</p>
|
|
166
166
|
</div>
|
|
167
167
|
|
|
168
|
-
<!-- Fixed height: the status arrives after
|
|
168
|
+
<!-- Fixed height: the status arrives after mounting (#327, #365).
|
|
169
|
+
Phones get one row each for status and delivery, so a long
|
|
170
|
+
status cannot wrap the line; from sm both share one row and the
|
|
171
|
+
delivery time waits for the status. -->
|
|
169
172
|
<div
|
|
170
|
-
class="
|
|
173
|
+
class="grid items-center text-sm text-white/90 sm:flex sm:min-h-6 sm:gap-x-4"
|
|
174
|
+
:class="
|
|
175
|
+
isCheckoutEnabled
|
|
176
|
+
? 'grid-rows-[1.5rem_1.5rem]'
|
|
177
|
+
: 'grid-rows-[1.5rem]'
|
|
178
|
+
"
|
|
171
179
|
aria-live="polite"
|
|
172
180
|
>
|
|
173
181
|
<span
|
|
174
182
|
v-if="statusLabel"
|
|
175
|
-
class="
|
|
183
|
+
class="row-start-1 flex min-w-0 items-center gap-2"
|
|
176
184
|
data-testid="hero-status"
|
|
177
185
|
>
|
|
178
186
|
<span
|
|
179
|
-
class="size-2 rounded-full"
|
|
187
|
+
class="size-2 shrink-0 rounded-full"
|
|
180
188
|
:class="
|
|
181
189
|
status?.open
|
|
182
190
|
? 'bg-green-400 shadow-[0_0_0_3px_rgba(74,222,128,0.3)]'
|
|
@@ -184,11 +192,13 @@ const secondaryLinks = computed(() => props.links.slice(1));
|
|
|
184
192
|
"
|
|
185
193
|
aria-hidden="true"
|
|
186
194
|
/>
|
|
187
|
-
{{ statusLabel }}
|
|
195
|
+
<span class="truncate">{{ statusLabel }}</span>
|
|
188
196
|
</span>
|
|
189
197
|
<span
|
|
190
|
-
v-if="
|
|
191
|
-
class="inline-flex items-center gap-1.5"
|
|
198
|
+
v-if="isCheckoutEnabled"
|
|
199
|
+
class="row-start-2 inline-flex items-center gap-1.5"
|
|
200
|
+
:class="{ 'sm:hidden': !statusLabel }"
|
|
201
|
+
data-testid="hero-delivery"
|
|
192
202
|
>
|
|
193
203
|
<UIcon name="i-lucide-bike" class="size-4" />
|
|
194
204
|
Lieferung ca. {{ deliveryTime }} Min
|
|
@@ -6,7 +6,7 @@ import type {
|
|
|
6
6
|
|
|
7
7
|
// The extras are loaded by useProductDetail together with the product, so
|
|
8
8
|
// the list renders once and stays put when a variant is switched.
|
|
9
|
-
defineProps<{
|
|
9
|
+
const props = defineProps<{
|
|
10
10
|
associations: AssociationItem[];
|
|
11
11
|
}>();
|
|
12
12
|
|
|
@@ -14,50 +14,163 @@ const emit = defineEmits<{
|
|
|
14
14
|
"extras-selected": [selectedExtras: AssociationItemProduct[]];
|
|
15
15
|
}>();
|
|
16
16
|
|
|
17
|
+
// Long extras lists made the quick view a long scroll: a group shows its first
|
|
18
|
+
// entries, the rest on request, and a search field once the list is long.
|
|
19
|
+
const PREVIEW_LIMIT = 6;
|
|
20
|
+
const SEARCH_THRESHOLD = 15;
|
|
21
|
+
|
|
22
|
+
const { getFormattedPrice } = useCommercePrice();
|
|
23
|
+
|
|
17
24
|
const selectedExtras = ref<AssociationItemProduct[]>([]);
|
|
25
|
+
// Only the first group starts open, the others show their selection summary.
|
|
26
|
+
const openGroups = ref<string[]>(
|
|
27
|
+
props.associations[0] ? [props.associations[0].label] : [],
|
|
28
|
+
);
|
|
29
|
+
const expandedGroups = ref<string[]>([]);
|
|
30
|
+
const queries = ref<Record<string, string>>({});
|
|
18
31
|
|
|
19
32
|
const isSelected = (extra: AssociationItemProduct) =>
|
|
20
33
|
selectedExtras.value.some((selected) => selected.value === extra.value);
|
|
21
34
|
|
|
22
|
-
function
|
|
23
|
-
selectedExtras.value =
|
|
24
|
-
? selectedExtras.value
|
|
25
|
-
:
|
|
35
|
+
function setSelected(extra: AssociationItemProduct, selected: boolean) {
|
|
36
|
+
selectedExtras.value = selected
|
|
37
|
+
? [...selectedExtras.value, extra]
|
|
38
|
+
: selectedExtras.value.filter((item) => item.value !== extra.value);
|
|
26
39
|
}
|
|
27
40
|
|
|
41
|
+
function toggleGroup(label: string) {
|
|
42
|
+
openGroups.value = openGroups.value.includes(label)
|
|
43
|
+
? openGroups.value.filter((open) => open !== label)
|
|
44
|
+
: [...openGroups.value, label];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function visibleProducts(association: AssociationItem) {
|
|
48
|
+
const query = queries.value[association.label]?.trim().toLowerCase();
|
|
49
|
+
if (query) {
|
|
50
|
+
return association.products.filter((extra) =>
|
|
51
|
+
extra.label.toLowerCase().includes(query),
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
// Hiding one or two entries behind a button saves less than the button costs.
|
|
55
|
+
const collapsed =
|
|
56
|
+
association.products.length > PREVIEW_LIMIT + 2 &&
|
|
57
|
+
!expandedGroups.value.includes(association.label);
|
|
58
|
+
return collapsed
|
|
59
|
+
? association.products.slice(0, PREVIEW_LIMIT)
|
|
60
|
+
: association.products;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function hiddenCount(association: AssociationItem) {
|
|
64
|
+
if (queries.value[association.label]?.trim()) return 0;
|
|
65
|
+
return association.products.length - visibleProducts(association).length;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function summary(association: AssociationItem) {
|
|
69
|
+
const selected = association.products.filter(isSelected);
|
|
70
|
+
if (selected.length === 0) return "optional";
|
|
71
|
+
const price = selected.reduce(
|
|
72
|
+
(sum, extra) => sum + (extra.unitPrice ?? 0),
|
|
73
|
+
0,
|
|
74
|
+
);
|
|
75
|
+
return `${selected.length} gewählt · +${getFormattedPrice(price)}`;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const baseId = useId();
|
|
79
|
+
const groupId = (index: number) => `${baseId}-extras-${index}`;
|
|
80
|
+
|
|
28
81
|
watch(selectedExtras, () => emit("extras-selected", selectedExtras.value));
|
|
29
82
|
</script>
|
|
30
83
|
|
|
31
84
|
<template>
|
|
32
85
|
<div
|
|
33
|
-
v-for="association in associations"
|
|
86
|
+
v-for="(association, index) in associations"
|
|
34
87
|
:key="association.label"
|
|
35
|
-
class="flex flex-col
|
|
88
|
+
class="flex flex-col"
|
|
36
89
|
>
|
|
37
|
-
<
|
|
90
|
+
<button
|
|
91
|
+
type="button"
|
|
92
|
+
class="flex items-center gap-2 py-1 text-start"
|
|
93
|
+
:aria-expanded="openGroups.includes(association.label)"
|
|
94
|
+
:aria-controls="groupId(index)"
|
|
95
|
+
@click="toggleGroup(association.label)"
|
|
96
|
+
>
|
|
97
|
+
<UIcon
|
|
98
|
+
name="i-lucide-chevron-down"
|
|
99
|
+
class="size-5 shrink-0 text-muted transition-transform"
|
|
100
|
+
:class="{ '-rotate-90': !openGroups.includes(association.label) }"
|
|
101
|
+
/>
|
|
38
102
|
<span class="font-semibold text-highlighted">{{
|
|
39
103
|
association.label
|
|
40
104
|
}}</span>
|
|
41
|
-
<span
|
|
42
|
-
|
|
105
|
+
<span
|
|
106
|
+
class="ms-auto text-xs"
|
|
107
|
+
:class="
|
|
108
|
+
association.products.some(isSelected)
|
|
109
|
+
? 'font-medium text-primary'
|
|
110
|
+
: 'text-muted'
|
|
111
|
+
"
|
|
112
|
+
>
|
|
113
|
+
{{ summary(association) }}
|
|
114
|
+
</span>
|
|
115
|
+
</button>
|
|
116
|
+
|
|
43
117
|
<div
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
118
|
+
v-if="openGroups.includes(association.label)"
|
|
119
|
+
:id="groupId(index)"
|
|
120
|
+
class="flex flex-col gap-1 pt-2"
|
|
47
121
|
>
|
|
122
|
+
<UInput
|
|
123
|
+
v-if="association.products.length > SEARCH_THRESHOLD"
|
|
124
|
+
v-model="queries[association.label]"
|
|
125
|
+
icon="i-lucide-search"
|
|
126
|
+
:placeholder="`${association.label} durchsuchen`"
|
|
127
|
+
:aria-label="`${association.label} durchsuchen`"
|
|
128
|
+
class="mb-1 w-full"
|
|
129
|
+
/>
|
|
130
|
+
<div
|
|
131
|
+
class="flex flex-col divide-y divide-default"
|
|
132
|
+
role="group"
|
|
133
|
+
:aria-label="association.label"
|
|
134
|
+
>
|
|
135
|
+
<UCheckbox
|
|
136
|
+
v-for="extra in visibleProducts(association)"
|
|
137
|
+
:key="extra.value"
|
|
138
|
+
variant="card"
|
|
139
|
+
size="lg"
|
|
140
|
+
:model-value="isSelected(extra)"
|
|
141
|
+
:ui="{
|
|
142
|
+
root: 'items-center rounded-none border-0 px-1 py-2.5',
|
|
143
|
+
wrapper: 'ms-3',
|
|
144
|
+
label: 'flex items-baseline justify-between gap-3 font-normal',
|
|
145
|
+
}"
|
|
146
|
+
@update:model-value="setSelected(extra, $event === true)"
|
|
147
|
+
>
|
|
148
|
+
<template #label>
|
|
149
|
+
<span>{{ extra.label }}</span>
|
|
150
|
+
<span class="shrink-0 text-sm text-muted tabular-nums">
|
|
151
|
+
+{{ extra.price }}
|
|
152
|
+
</span>
|
|
153
|
+
</template>
|
|
154
|
+
</UCheckbox>
|
|
155
|
+
</div>
|
|
156
|
+
<p
|
|
157
|
+
v-if="
|
|
158
|
+
queries[association.label]?.trim() &&
|
|
159
|
+
visibleProducts(association).length === 0
|
|
160
|
+
"
|
|
161
|
+
class="py-2 text-sm text-muted"
|
|
162
|
+
>
|
|
163
|
+
Keine Treffer
|
|
164
|
+
</p>
|
|
48
165
|
<UButton
|
|
49
|
-
v-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
:icon="isSelected(extra) ? 'i-lucide-check' : 'i-lucide-plus'"
|
|
56
|
-
:aria-pressed="isSelected(extra)"
|
|
57
|
-
@click="toggle(extra)"
|
|
166
|
+
v-if="hiddenCount(association) > 0"
|
|
167
|
+
variant="link"
|
|
168
|
+
color="primary"
|
|
169
|
+
trailing-icon="i-lucide-chevron-down"
|
|
170
|
+
class="self-start px-1"
|
|
171
|
+
@click="expandedGroups = [...expandedGroups, association.label]"
|
|
58
172
|
>
|
|
59
|
-
{{
|
|
60
|
-
<span class="font-normal opacity-80">+{{ extra.price }}</span>
|
|
173
|
+
Alle {{ association.products.length }} anzeigen
|
|
61
174
|
</UButton>
|
|
62
175
|
</div>
|
|
63
176
|
</div>
|
|
@@ -28,7 +28,14 @@ watch(deselected, () => emit("ingredients-deselected", deselected.value));
|
|
|
28
28
|
|
|
29
29
|
<template>
|
|
30
30
|
<div v-if="ingredients.length > 0" class="flex flex-col gap-2">
|
|
31
|
-
|
|
31
|
+
<!-- The quick view lists the ingredients only here (no chip row above
|
|
32
|
+
repeating them): tapping one removes it from the order. Both states
|
|
33
|
+
carry an icon of the same size, so toggling a chip keeps its width
|
|
34
|
+
and never rewraps the row (the drawer grew on phones). -->
|
|
35
|
+
<div class="flex items-baseline justify-between">
|
|
36
|
+
<span class="font-semibold text-highlighted">Zutaten</span>
|
|
37
|
+
<span class="text-xs text-muted">antippen zum Entfernen</span>
|
|
38
|
+
</div>
|
|
32
39
|
<div
|
|
33
40
|
class="flex flex-wrap gap-2"
|
|
34
41
|
role="group"
|
|
@@ -42,7 +49,7 @@ watch(deselected, () => emit("ingredients-deselected", deselected.value));
|
|
|
42
49
|
:class="{ 'line-through': deselected.includes(ingredient) }"
|
|
43
50
|
:color="deselected.includes(ingredient) ? 'error' : 'neutral'"
|
|
44
51
|
:variant="deselected.includes(ingredient) ? 'subtle' : 'outline'"
|
|
45
|
-
:icon="deselected.includes(ingredient) ? 'i-lucide-
|
|
52
|
+
:icon="deselected.includes(ingredient) ? 'i-lucide-plus' : 'i-lucide-x'"
|
|
46
53
|
:aria-pressed="deselected.includes(ingredient)"
|
|
47
54
|
:label="ingredient"
|
|
48
55
|
@click="toggle(ingredient)"
|
|
@@ -53,9 +53,10 @@ const onAddToCart = () => emit("product-added");
|
|
|
53
53
|
</script>
|
|
54
54
|
|
|
55
55
|
<template>
|
|
56
|
-
<div class="flex flex-col gap-5">
|
|
57
|
-
<!-- One placeholder in the shape of the loaded body (options,
|
|
58
|
-
ingredients), shown until product and extras are both
|
|
56
|
+
<div class="flex flex-1 flex-col gap-5">
|
|
57
|
+
<!-- One placeholder in the shape of the loaded body (options,
|
|
58
|
+
ingredients, extras), shown until product and extras are both
|
|
59
|
+
loaded. -->
|
|
59
60
|
<div v-if="pending" class="flex flex-col gap-5" aria-busy="true">
|
|
60
61
|
<div class="flex flex-col gap-2">
|
|
61
62
|
<USkeleton class="h-5 w-24" />
|
|
@@ -64,18 +65,15 @@ const onAddToCart = () => emit("product-added");
|
|
|
64
65
|
<div class="flex flex-col gap-2">
|
|
65
66
|
<USkeleton class="h-5 w-20" />
|
|
66
67
|
<div class="flex flex-wrap gap-2">
|
|
67
|
-
<USkeleton class="h-
|
|
68
|
-
<USkeleton class="h-
|
|
69
|
-
<USkeleton class="h-
|
|
70
|
-
<USkeleton class="h-
|
|
68
|
+
<USkeleton class="h-8 w-20 rounded-full" />
|
|
69
|
+
<USkeleton class="h-8 w-24 rounded-full" />
|
|
70
|
+
<USkeleton class="h-8 w-16 rounded-full" />
|
|
71
|
+
<USkeleton class="h-8 w-28 rounded-full" />
|
|
71
72
|
</div>
|
|
72
73
|
</div>
|
|
73
|
-
<div class="flex flex-col gap-
|
|
74
|
-
<USkeleton class="h-5 w-
|
|
75
|
-
<
|
|
76
|
-
<USkeleton class="h-10 w-28 rounded-full" />
|
|
77
|
-
<USkeleton class="h-10 w-24 rounded-full" />
|
|
78
|
-
</div>
|
|
74
|
+
<div class="flex flex-col gap-3">
|
|
75
|
+
<USkeleton class="h-5 w-28" />
|
|
76
|
+
<USkeleton v-for="row in 4" :key="row" class="h-7 w-full" />
|
|
79
77
|
</div>
|
|
80
78
|
</div>
|
|
81
79
|
<template v-else-if="productDetails?.configurator">
|
|
@@ -84,16 +82,16 @@ const onAddToCart = () => emit("product-added");
|
|
|
84
82
|
:c="productDetails.configurator"
|
|
85
83
|
@variant-switched="onVariantSwitched"
|
|
86
84
|
/>
|
|
87
|
-
<ProductCrossSelling
|
|
88
|
-
v-if="associationItems.length > 0"
|
|
89
|
-
:associations="associationItems"
|
|
90
|
-
@extras-selected="onExtras"
|
|
91
|
-
/>
|
|
92
85
|
<ProductDeselectIngredient
|
|
93
86
|
v-if="selectedProduct"
|
|
94
87
|
:product="selectedProduct"
|
|
95
88
|
@ingredients-deselected="onIngredientsDeselected"
|
|
96
89
|
/>
|
|
90
|
+
<ProductCrossSelling
|
|
91
|
+
v-if="associationItems.length > 0"
|
|
92
|
+
:associations="associationItems"
|
|
93
|
+
@extras-selected="onExtras"
|
|
94
|
+
/>
|
|
97
95
|
</template>
|
|
98
96
|
|
|
99
97
|
<div
|
|
@@ -61,10 +61,11 @@ function onVariantSelected(variant: Schemas["Product"]) {
|
|
|
61
61
|
{{ description }}
|
|
62
62
|
</template>
|
|
63
63
|
<template #body>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
<!-- Diet badges only: the ingredients are listed once, in the
|
|
65
|
+
deselectable "Zutaten" section of ProductDetail. -->
|
|
66
|
+
<div class="flex flex-wrap gap-1.5 empty:hidden">
|
|
67
|
+
<ProductCardDietBadges :sorted-properties="sortedProperties" />
|
|
68
|
+
</div>
|
|
68
69
|
<ProductDetail
|
|
69
70
|
v-if="product"
|
|
70
71
|
:key="product.id"
|
|
@@ -3,19 +3,27 @@ import { createRegistrationSchema } from "~/validation/registrationSchema";
|
|
|
3
3
|
import type { RegistrationSchema } from "~/validation/registrationSchema";
|
|
4
4
|
import { ApiClientError } from "@shopware/api-client";
|
|
5
5
|
import type { FormSubmitEvent } from "@nuxt/ui";
|
|
6
|
+
import type { Schemas } from "#shopware";
|
|
6
7
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const props = withDefaults(
|
|
9
|
+
defineProps<{
|
|
10
|
+
/**
|
|
11
|
+
* Whether the visitor may skip the customer account (guest order). The
|
|
12
|
+
* registration page (`/registrierung`) always creates a real account, the
|
|
13
|
+
* checkout offers the choice.
|
|
14
|
+
*/
|
|
15
|
+
allowGuest?: boolean;
|
|
16
|
+
}>(),
|
|
17
|
+
{
|
|
18
|
+
allowGuest: true,
|
|
19
|
+
},
|
|
20
|
+
);
|
|
13
21
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
22
|
+
const config = useRuntimeConfig();
|
|
23
|
+
// Where to go after a successful registration is the caller's decision: the
|
|
24
|
+
// registration page sends the visitor to the account, the checkout continues
|
|
25
|
+
// with the order.
|
|
26
|
+
const { register } = useUser();
|
|
19
27
|
|
|
20
28
|
const state = reactive({
|
|
21
29
|
accountType: "private" as "private" | "business",
|
|
@@ -23,7 +31,7 @@ const state = reactive({
|
|
|
23
31
|
firstName: "",
|
|
24
32
|
lastName: "",
|
|
25
33
|
email: "",
|
|
26
|
-
guest:
|
|
34
|
+
guest: props.allowGuest,
|
|
27
35
|
password: "",
|
|
28
36
|
passwordConfirm: "",
|
|
29
37
|
acceptedDataProtection: false,
|
|
@@ -59,6 +67,23 @@ const state = reactive({
|
|
|
59
67
|
|
|
60
68
|
const schema = computed(() => createRegistrationSchema(state));
|
|
61
69
|
|
|
70
|
+
// The API payload keeps the negated `guest` flag, the form asks the positive
|
|
71
|
+
// question: a guest order is the default, creating an account is the opt-in.
|
|
72
|
+
const createAccount = computed({
|
|
73
|
+
get: () => !state.guest,
|
|
74
|
+
set: (value: boolean) => {
|
|
75
|
+
state.guest = !value;
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* With double opt-in enabled in Shopware the customer stays inactive until the
|
|
81
|
+
* confirmation link is clicked, so there is no session to continue with.
|
|
82
|
+
*/
|
|
83
|
+
function needsEmailConfirmation(customer: Schemas["Customer"] | undefined) {
|
|
84
|
+
return !!customer?.doubleOptInRegistration && !customer?.active;
|
|
85
|
+
}
|
|
86
|
+
|
|
62
87
|
const toast = useToast();
|
|
63
88
|
|
|
64
89
|
const billingAddressFields = ref();
|
|
@@ -93,16 +118,30 @@ async function onSubmit(event: FormSubmitEvent<RegistrationSchema>) {
|
|
|
93
118
|
}
|
|
94
119
|
|
|
95
120
|
try {
|
|
96
|
-
|
|
97
|
-
|
|
121
|
+
const customer: Schemas["Customer"] | undefined =
|
|
122
|
+
// @ts-expect-error - password is required in the API type but not for guests
|
|
123
|
+
await register(registrationData);
|
|
124
|
+
|
|
125
|
+
if (needsEmailConfirmation(customer)) {
|
|
126
|
+
toast.add({
|
|
127
|
+
title: "Fast geschafft!",
|
|
128
|
+
description:
|
|
129
|
+
"Wir haben dir eine E-Mail geschickt. Bitte bestätige den Link darin, um dein Konto zu aktivieren.",
|
|
130
|
+
color: "info",
|
|
131
|
+
});
|
|
132
|
+
} else {
|
|
133
|
+
toast.add({
|
|
134
|
+
title: registrationData.guest
|
|
135
|
+
? "Erfolgreich Kundendaten erfasst"
|
|
136
|
+
: "Konto erfolgreich erstellt",
|
|
137
|
+
color: "success",
|
|
138
|
+
});
|
|
139
|
+
}
|
|
98
140
|
|
|
99
|
-
toast.add({
|
|
100
|
-
title: "Erfolgreich Kundendaten erfasst",
|
|
101
|
-
color: "success",
|
|
102
|
-
});
|
|
103
141
|
emit(
|
|
104
142
|
"registration-success",
|
|
105
143
|
registrationData as unknown as RegistrationSchema,
|
|
144
|
+
customer,
|
|
106
145
|
);
|
|
107
146
|
} catch (error) {
|
|
108
147
|
console.error("Registration failed:", error);
|
|
@@ -136,7 +175,10 @@ const accountTypes = ref([
|
|
|
136
175
|
]);
|
|
137
176
|
|
|
138
177
|
const emit = defineEmits<{
|
|
139
|
-
"registration-success": [
|
|
178
|
+
"registration-success": [
|
|
179
|
+
data: RegistrationSchema,
|
|
180
|
+
customer: Schemas["Customer"] | undefined,
|
|
181
|
+
];
|
|
140
182
|
}>();
|
|
141
183
|
</script>
|
|
142
184
|
|
|
@@ -157,14 +199,6 @@ const emit = defineEmits<{
|
|
|
157
199
|
/>
|
|
158
200
|
</UFormField>
|
|
159
201
|
|
|
160
|
-
<UFormField name="guest">
|
|
161
|
-
<USwitch
|
|
162
|
-
v-model="state.guest"
|
|
163
|
-
label="Kein Kundenkonto erstellen"
|
|
164
|
-
class="w-full"
|
|
165
|
-
/>
|
|
166
|
-
</UFormField>
|
|
167
|
-
|
|
168
202
|
<div class="flex flex-row justify-between gap-4">
|
|
169
203
|
<UFormField label="Vorname" name="firstName" required class="w-full">
|
|
170
204
|
<UInput v-model="state.firstName" type="text" class="w-full" />
|
|
@@ -179,14 +213,24 @@ const emit = defineEmits<{
|
|
|
179
213
|
<UInput v-model="state.email" class="w-full" />
|
|
180
214
|
</UFormField>
|
|
181
215
|
|
|
182
|
-
<UFormField v-if="
|
|
216
|
+
<UFormField v-if="allowGuest" name="guest">
|
|
217
|
+
<UCheckbox
|
|
218
|
+
v-model="createAccount"
|
|
219
|
+
label="Kundenkonto anlegen"
|
|
220
|
+
description="Für schnellere Bestellungen mit gespeicherten Adressen"
|
|
221
|
+
class="w-full"
|
|
222
|
+
/>
|
|
223
|
+
</UFormField>
|
|
224
|
+
|
|
225
|
+
<UFormField v-if="!state.guest" label="Passwort" name="password" required>
|
|
183
226
|
<UInput v-model="state.password" type="password" class="w-full" />
|
|
184
227
|
</UFormField>
|
|
185
228
|
|
|
186
229
|
<UFormField
|
|
187
230
|
v-if="!state.guest"
|
|
188
|
-
label="
|
|
231
|
+
label="Passwort wiederholen"
|
|
189
232
|
name="passwordConfirm"
|
|
233
|
+
required
|
|
190
234
|
>
|
|
191
235
|
<UInput v-model="state.passwordConfirm" type="password" class="w-full" />
|
|
192
236
|
</UFormField>
|