@shopbite-de/storefront 1.24.0 → 1.26.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 +10 -3
- package/README.md +0 -1
- 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/DeliveryTimeSelect.vue +28 -2
- package/app/components/Checkout/Summary.vue +25 -3
- 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/useBusinessHours.ts +10 -3
- package/app/composables/useCartQuickView.ts +19 -0
- package/app/composables/useCartUpsell.ts +100 -0
- package/app/composables/useCategorySeo.ts +5 -4
- package/app/composables/useHolidays.ts +7 -3
- package/app/composables/useOpeningHoursData.ts +53 -0
- 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/bestellung/bestaetigen.vue +0 -3
- package/app/pages/bestellung/warenkorb.vue +0 -3
- package/app/pages/bestellung/zahlung-versand.vue +0 -3
- package/app/pages/bestellung.vue +22 -14
- 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/app/utils/retry.ts +17 -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/docs/notes/2026-09-16-issue-339-checkout-hydration.md +49 -0
- package/docs/notes/2026-09-16-issue-349-order-button-loading.md +39 -0
- package/docs/notes/2026-09-16-issue-350-remove-pinia.md +41 -0
- package/docs/notes/2026-09-16-issue-355-opening-hours-error.md +57 -0
- package/nuxt.config.ts +25 -2
- package/package.json +2 -3
- 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/CheckoutSummary.test.ts +127 -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/useOpeningHoursData.test.ts +120 -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/retry.spec.ts +58 -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
- package/app/composables/useCheckoutStore.ts +0 -1
- package/app/stores/checkout.ts +0 -22
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Issue #325: Product card redesign
|
|
2
|
+
|
|
3
|
+
As of 2026-09-12, branch `feature/325-product-card`.
|
|
4
|
+
|
|
5
|
+
## Decision
|
|
6
|
+
|
|
7
|
+
Design canvas "Produktkarten Varianten"
|
|
8
|
+
(https://claude.ai/code/artifact/95cc5132-1515-477f-af62-3afa79d0ee3c):
|
|
9
|
+
three directions (A compact with thumbnail, B dense menu list, C visual
|
|
10
|
+
with a large image), then three derivatives of C for shops without
|
|
11
|
+
product photos, then five levels of button emphasis. Chosen: **C1** (the
|
|
12
|
+
anatomy of C, the image block only when the product has a cover) with
|
|
13
|
+
button level **B1** (`variant="subtle"`). La Fattoria has no product
|
|
14
|
+
covers at all, the ShopBite demo a few, so the card must look finished
|
|
15
|
+
without any image.
|
|
16
|
+
|
|
17
|
+
## Changes
|
|
18
|
+
|
|
19
|
+
Second iteration (same day): the card carries no buttons at all. The
|
|
20
|
+
whole card is the control (`role="button"`, keyboard, hover ring) and opens
|
|
21
|
+
a product quick view, the "micro PDP" the customer asked for.
|
|
22
|
+
|
|
23
|
+
- `Product/Card.vue`: an `article` with `ring ring-default rounded-xl
|
|
24
|
+
shadow-md`, the cover as `h-44 object-cover` on top with the diet badge
|
|
25
|
+
as overlay, the wishlist button top right (a `@click.stop` wrapper keeps
|
|
26
|
+
it from opening the quick view), number (primary, `text-xs`), name
|
|
27
|
+
(`text-lg font-bold`), description, price on the right with either
|
|
28
|
+
"Ausverkauft" (`available === false`) or a "n× im Warenkorb" hint
|
|
29
|
+
(`useProductCartQuantity`), and the main ingredients as chips
|
|
30
|
+
(`Product/CardIngredients.vue`, replaces `CardDescription.vue`;
|
|
31
|
+
`CardDietBadges` got a `variant` prop). `selectable` (replaces
|
|
32
|
+
`withAddToCartButton`) emits `select`; the top sellers on the home page
|
|
33
|
+
are not selectable.
|
|
34
|
+
- `useProductQuickView(products)`: the open product is the `produkt`
|
|
35
|
+
query parameter (product number, e.g. `/c/Pizza/?produkt=22`). Opening
|
|
36
|
+
pushes a history entry, so the back button closes the drawer; closing
|
|
37
|
+
replaces the URL. A direct load with the parameter opens the drawer once
|
|
38
|
+
the listing holds the product. One drawer per listing (category page,
|
|
39
|
+
search page incl. fallback suggestions, `Product/Category.vue`), created
|
|
40
|
+
on first use.
|
|
41
|
+
- `Product/QuickView.vue`: `UDrawer` as bottom sheet on phones and side
|
|
42
|
+
panel from `lg` (`useMediaQuery`), title = number + name, description,
|
|
43
|
+
ingredient chips, then `Product/Detail.vue`. Only the body scrolls
|
|
44
|
+
(`container: overflow-hidden`, `body: min-h-0 overflow-y-auto`), so the
|
|
45
|
+
title stays visible above 34 extras chips; the header needs `shrink-0`
|
|
46
|
+
or the flex column squeezes it to its `min-h-8`. The button says
|
|
47
|
+
"Hinzufügen" plus the total (`aria-label` "In den Warenkorb"): the long
|
|
48
|
+
label wrapped to two lines next to the stepper on phones.
|
|
49
|
+
- `Product/Detail.vue`: variants (`Configurator`, unchanged select), extras
|
|
50
|
+
as toggle chips with surcharge (`CrossSelling.vue`, replaces the
|
|
51
|
+
`UInputMenu`), "Ohne" chips with line-through for the ingredient
|
|
52
|
+
deselection (`DeselectIngredient.vue`, replaces the `USelect`), and a
|
|
53
|
+
sticky footer with the quantity stepper and the button that shows the
|
|
54
|
+
total (unit price plus extras, times quantity; `AssociationItemProduct`
|
|
55
|
+
carries `unitPrice` for that). Skeleton while the detail loads.
|
|
56
|
+
- `Cart/Bar.vue` (mounted in `app.vue`): sticky bar at the bottom on
|
|
57
|
+
phones (`lg:hidden`) as soon as the cart holds something, "Warenkorb ·
|
|
58
|
+
n Artikel · subtotal", opens the cart drawer. `useCartQuickView` holds
|
|
59
|
+
the drawer state (`useState`) so the header button and the bar share it. The cart drawer itself is a bottom sheet on phones and a side panel from `lg`, like the product quick view, with a close button next to the title (it also closes by swiping the handle down, tapping the overlay or Escape).
|
|
60
|
+
Hidden under `/bestellung`; a spacer keeps the footer clear; the cart is
|
|
61
|
+
loaded on the client, so the bar never renders on the server. Adding a
|
|
62
|
+
product pops the bar (`--animate-cart-pop` in `main.css`, re-triggered
|
|
63
|
+
by re-keying the button) and shows "2× Pizza Salami hinzugefügt" for
|
|
64
|
+
1.8 s before the count and subtotal return; the header cart badge pops
|
|
65
|
+
as well. This replaces the add-to-cart toast: `useAddToCart` now emits
|
|
66
|
+
`triggerCartItemAdded(product, quantity)` (`useProductEvents`,
|
|
67
|
+
`onCartItemAdded`) instead of calling `useToast`.
|
|
68
|
+
- Listing and search routes add `available` to the projection.
|
|
69
|
+
- `AddToWishlist.vue` takes `size` and `variant` and an `aria-label`.
|
|
70
|
+
- Category listing, search page and `Product/Category.vue` render two
|
|
71
|
+
columns from `xl`; `CardSkeleton.vue` follows the new anatomy.
|
|
72
|
+
- The e2e helper opens the quick view from the card, checks the URL
|
|
73
|
+
parameter, sets the quantity and adds from the drawer.
|
|
74
|
+
|
|
75
|
+
`productHasOptions` (variants or cross-sellings) from the first iteration
|
|
76
|
+
is gone with the direct add-to-cart; the listing projection no longer
|
|
77
|
+
loads cross-sellings.
|
|
78
|
+
|
|
79
|
+
## Verification
|
|
80
|
+
|
|
81
|
+
- Production build with the La Fattoria API: tapping a pizza card sets
|
|
82
|
+
`?produkt=22` and opens the sheet with 34 extras chips and the "Ohne"
|
|
83
|
+
chip; one extra plus quantity 2 puts 17,00 € into the cart and the card
|
|
84
|
+
shows "2× im Warenkorb"; the back button closes the sheet;
|
|
85
|
+
`/c/Pizza/?produkt=30` opens the side panel on desktop directly; the
|
|
86
|
+
search page opens it from a result. A drink without extras shows only
|
|
87
|
+
the quantity and the button. After adding, the cart bar reads
|
|
88
|
+
"2 Artikel · 7,00 €", opens the cart drawer, and is absent on
|
|
89
|
+
`/bestellung/warenkorb` and at 1280 px. Screenshots mobile light/dark and desktop
|
|
90
|
+
reviewed, no page errors.
|
|
91
|
+
- Unit tests, Prettier, ESLint, typecheck and build pass. The unit run
|
|
92
|
+
still exits 1 because of #323.
|
|
93
|
+
- Lighthouse (first iteration, still valid as an upper bound: the card
|
|
94
|
+
now hydrates fewer components): within the run-to-run spread of `main`
|
|
95
|
+
on this machine; CDP CPU profiles of both builds equal within 5 %.
|
|
96
|
+
|
|
97
|
+
## Follow-ups (not in this issue)
|
|
98
|
+
|
|
99
|
+
- The quick view URL only resolves products of the current listing; a
|
|
100
|
+
`?produkt=` on a page that does not list the product is ignored.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Issue #327: Home page hero and top sellers
|
|
2
|
+
|
|
3
|
+
As of 2026-09-12, branch `feature/327-home-hero` (stacked on
|
|
4
|
+
`feature/325-product-card`, it uses the product quick view).
|
|
5
|
+
|
|
6
|
+
## Decision
|
|
7
|
+
|
|
8
|
+
Canvas "Startseite Hero"
|
|
9
|
+
(https://claude.ai/code/artifact/a17d8c92-1897-467b-82b3-47155fe6f0f2):
|
|
10
|
+
A (order hero, photo with gradient, one action), B (compact banner with
|
|
11
|
+
button, top sellers and category tiles first), C (light editorial with the
|
|
12
|
+
photo as a card). Chosen: **A**, full-bleed (a rounded banner and a
|
|
13
|
+
flatpay.com-style near-full-height hero were tried and dropped), plus the
|
|
14
|
+
top sellers as a horizontal scroller.
|
|
15
|
+
|
|
16
|
+
## Changes
|
|
17
|
+
|
|
18
|
+
- `Hero.vue`: full-bleed photo/video (poster preload and the ≥768 px video
|
|
19
|
+
rule of #273 unchanged) with a bottom-to-top gradient
|
|
20
|
+
(`from-neutral-950/15 … to-neutral-950/85`) instead of the flat 50 %
|
|
21
|
+
overlay; content bottom left inside the container width: USPs as a
|
|
22
|
+
compact inline row, `headline` eyebrow, title, description, a live
|
|
23
|
+
status line and the buttons. The first link is the single primary
|
|
24
|
+
button (full width on phones), further links are ghost buttons in
|
|
25
|
+
white.
|
|
26
|
+
- Status line: `useStoreStatus` ("Geöffnet bis 23:00" / "Geschlossen ·
|
|
27
|
+
öffnet …", client only, #275) and `deliveryTime` from the plugin config;
|
|
28
|
+
a `min-h-6` reserves the space before hydration (CLS 0.001).
|
|
29
|
+
- `hero.title` in the content schema (optional, falls back to the page
|
|
30
|
+
title); the demo content sets "Frisch gekocht, schnell geliefert.".
|
|
31
|
+
Existing shop content works unchanged.
|
|
32
|
+
- `Topseller.vue`: rendered on the home page directly below the hero
|
|
33
|
+
(it was not mounted anywhere before). Horizontal snap scroller of
|
|
34
|
+
`Product/CardCompact.vue` (cover or placeholder, number, name, price,
|
|
35
|
+
plus; the card opens the quick view of #325), heading with a
|
|
36
|
+
"Speisekarte" link, nothing without top sellers. Loaded with
|
|
37
|
+
`useAsyncData`.
|
|
38
|
+
- `useTopSellers`: limit 8, includes for cover, properties and
|
|
39
|
+
availability, and the `sw-inheritance` header so variants marked as top
|
|
40
|
+
sellers carry the parent's name and cover (La Fattoria marks both the
|
|
41
|
+
parent "Cordon Bleu" and its three variants; the header type of the
|
|
42
|
+
generated operation lacks `sw-inheritance`, hence the `@ts-expect-error`).
|
|
43
|
+
- Homepage docs (`content/{de,en}/docs/8.storefront/3.content.md`)
|
|
44
|
+
describe `hero.title`, the status line, the link order and the top
|
|
45
|
+
sellers.
|
|
46
|
+
|
|
47
|
+
## Verification
|
|
48
|
+
|
|
49
|
+
- Production build with the La Fattoria API: status "Geöffnet bis 23:00",
|
|
50
|
+
eight top sellers, a tap opens the quick view (`?produkt=18V`), video
|
|
51
|
+
only at 1280 px; screenshots mobile light/dark and desktop reviewed, no
|
|
52
|
+
page errors.
|
|
53
|
+
- Lighthouse mobile on `/`: the LCP element is still the poster image,
|
|
54
|
+
CLS 0.001.
|
|
55
|
+
- Unit tests (`Hero.test.ts`, `useTopSellers.test.ts` unchanged and
|
|
56
|
+
green), Prettier, ESLint, typecheck and build pass; the unit run still
|
|
57
|
+
exits 1 because of #323.
|
|
58
|
+
|
|
59
|
+
## Follow-ups
|
|
60
|
+
|
|
61
|
+
- Products without a cover show a placeholder in the top seller row; a
|
|
62
|
+
category icon per product would need the category association.
|
|
63
|
+
- The USP row still comes from `hero.usps`; a dedicated rating field
|
|
64
|
+
(value, count, link) would render the Google rating with stars.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Demo banner
|
|
2
|
+
|
|
3
|
+
Date: 2026-09-13. Branch `feature/demo-banner`.
|
|
4
|
+
|
|
5
|
+
## Goal
|
|
6
|
+
|
|
7
|
+
Demo shops in `demos/` look like real shops. A prospect (or a visitor who
|
|
8
|
+
finds the demo URL) must not mistake them for a live shop, so the
|
|
9
|
+
storefront shows a notice above the header when the feature flag
|
|
10
|
+
`shopBite.feature.demoBanner` (`NUXT_PUBLIC_SHOP_BITE_FEATURE_DEMO_BANNER`)
|
|
11
|
+
is set.
|
|
12
|
+
|
|
13
|
+
## Implementation
|
|
14
|
+
|
|
15
|
+
- `components/DemoBanner.vue` renders Nuxt UI's `UBanner` (`color="warning"`)
|
|
16
|
+
with a fixed German notice. It has no `close` and no `id`, so it cannot be
|
|
17
|
+
dismissed and nothing is persisted in `localStorage`.
|
|
18
|
+
- `app.vue` mounts it as `LazyDemoBanner v-if="shopBite.feature.demoBanner"`
|
|
19
|
+
above `Header`, so real shops do not ship the `UBanner` chunk (#314). The
|
|
20
|
+
banner is part of the SSR HTML and scrolls away; `UHeader` stays sticky.
|
|
21
|
+
- `UBanner` is found by `ui.experimental.componentDetection` because the
|
|
22
|
+
component file lives in the project layer (#319).
|
|
23
|
+
- Both demo shops set `runtimeConfig.public.shopBite.feature.demoBanner: true`
|
|
24
|
+
in their `nuxt.config.ts`. They consume the published `@shopbite-de/storefront`
|
|
25
|
+
package, so the banner appears there after the next release.
|
|
26
|
+
|
|
27
|
+
## Verified
|
|
28
|
+
|
|
29
|
+
- `pnpm vitest run test/nuxt/DemoBanner.test.ts`, `pnpm eslint`, `pnpm typecheck`.
|
|
30
|
+
- `NUXT_PUBLIC_SHOP_BITE_FEATURE_DEMO_BANNER=true pnpm dev`: the notice is in
|
|
31
|
+
the server-rendered HTML of `/` before the header; without the flag it is
|
|
32
|
+
absent.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Issue #332: Information cards on the home page
|
|
2
|
+
|
|
3
|
+
As of 2026-09-13, branch `feature/332-home-info` (from `main`).
|
|
4
|
+
|
|
5
|
+
## Decision
|
|
6
|
+
|
|
7
|
+
Canvas "Alle Informationen"
|
|
8
|
+
(https://claude.ai/code/artifact/ed95c1eb-e63b-4692-9e7d-b09340a22f4d):
|
|
9
|
+
A (three cards with a bold lead, detail text and one action) vs. B
|
|
10
|
+
(compact three-row list with expandable details). Chosen: **A**.
|
|
11
|
+
|
|
12
|
+
## Changes
|
|
13
|
+
|
|
14
|
+
- `Feature/Card.vue`: tinted icon, category label (`title`), bold lead,
|
|
15
|
+
detail (`description`), optional action (`link`; a `tel:` target is a
|
|
16
|
+
subtle button with a phone icon, anything else a text link with an
|
|
17
|
+
arrow). `kind: hours` fills the lead with today's intervals
|
|
18
|
+
(`formatTodayHours` in `app/utils/openingHours.ts`, unit-tested) and
|
|
19
|
+
shows the open/closed status from `useStoreStatus`; `kind: delivery`
|
|
20
|
+
uses `deliveryTime` from the plugin config. Both live parts are
|
|
21
|
+
`ClientOnly` with reserved height, like `Footer/StoreStatus.vue` (#275):
|
|
22
|
+
business hours load on the client and the browser's clock decides.
|
|
23
|
+
- `Features.vue`: `UPageSection` with a 1/2/3-column grid of cards instead
|
|
24
|
+
of the `features` prop; the decorative blur blobs sit behind the cards
|
|
25
|
+
(`-z-10`, they were above them before).
|
|
26
|
+
- `content.config.ts`: optional `kind`, `lead` and `link` on the feature
|
|
27
|
+
schema (also available to the Mittagstisch section, which ignores
|
|
28
|
+
them); existing content renders as before, only as cards.
|
|
29
|
+
- `Footer/Contact.vue`: `id="oeffnungszeiten"` on the opening hours block
|
|
30
|
+
so the hours card can link to it.
|
|
31
|
+
- Demo content: the three entries carry `kind`, the hours description
|
|
32
|
+
keeps only the exceptions (Saturday, closed Tuesday), the reservation
|
|
33
|
+
card gets a call button.
|
|
34
|
+
- Homepage docs (`content/{de,en}/docs/8.storefront/3.content.md`,
|
|
35
|
+
branch `docs/storefront-info-cards` stacked on
|
|
36
|
+
`docs/storefront-hero-title`).
|
|
37
|
+
|
|
38
|
+
## Verification
|
|
39
|
+
|
|
40
|
+
- Production build with the La Fattoria API: leads "Heute 11:30–14:30
|
|
41
|
+
und 17:30–23:00", "In ca. 30 Minuten bei dir", "Tisch nur telefonisch";
|
|
42
|
+
status "Geöffnet bis 14:30"; the hours link scrolls to
|
|
43
|
+
`#oeffnungszeiten`; no page errors and no hydration warnings on 390 px
|
|
44
|
+
light/dark and 1280 px.
|
|
45
|
+
- Unit tests (3 new for `formatTodayHours`), Prettier, ESLint, typecheck
|
|
46
|
+
and build pass; the unit run still exits 1 because of #323.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Quick view: flicker on open and on variant switch
|
|
2
|
+
|
|
3
|
+
Date: 2026-09-13. Branch `fix/quick-view-flicker`.
|
|
4
|
+
|
|
5
|
+
## Symptom
|
|
6
|
+
|
|
7
|
+
The product quick view drawer (`Product/QuickView.vue`, #325) flickers when
|
|
8
|
+
it opens for the first time and again whenever a variant is switched.
|
|
9
|
+
|
|
10
|
+
## Cause
|
|
11
|
+
|
|
12
|
+
`Product/Detail.vue` loaded its data in two stages. `useProductDetail`
|
|
13
|
+
fetched `/api/product/<id>` and showed a skeleton; once that arrived,
|
|
14
|
+
`Product/CrossSelling.vue` mounted and fetched
|
|
15
|
+
`/api/product/<id>/cross-selling` behind a second skeleton. The drawer
|
|
16
|
+
body therefore rendered three times: skeleton, options + extras skeleton,
|
|
17
|
+
everything. On phones the bottom sheet takes its height from the content,
|
|
18
|
+
so it grew in three steps while sliding in.
|
|
19
|
+
|
|
20
|
+
Switching a variant emitted the variant to `Detail.vue`, which passed the
|
|
21
|
+
new product to `CrossSelling.vue`; its `useFetch` key changed to the
|
|
22
|
+
variant id, `pending` went back to `true` and the extras collapsed into
|
|
23
|
+
the skeleton until the (identical) extras came back.
|
|
24
|
+
|
|
25
|
+
Measured with `scripts/perf/quick-view-layout.mjs`, which logs the drawer body per animation
|
|
26
|
+
frame against the production build with the La Fattoria data (product
|
|
27
|
+
18V "Insalata di Pollo", two variants, 12 extras):
|
|
28
|
+
|
|
29
|
+
| Viewport | Open: body height steps | Variant switch: steps |
|
|
30
|
+
| -------- | ---------------------------- | --------------------- |
|
|
31
|
+
| Mobile | 271 px → 464 px → 916 px | 916 → 464 → 916 px |
|
|
32
|
+
| Desktop | 3 renders (fixed-height panel) | 2 renders |
|
|
33
|
+
|
|
34
|
+
## Fix
|
|
35
|
+
|
|
36
|
+
- `useProductDetail` requests the cross-selling together with the product
|
|
37
|
+
detail, both keyed by the listing product id, and exposes one `pending`
|
|
38
|
+
that covers both. The body renders once, after both responses.
|
|
39
|
+
- The cross-selling stays keyed by the listing product across variant
|
|
40
|
+
switches. Shopware resolves the cross-selling of a variant to its
|
|
41
|
+
parent's (checked against the live Store API: variant and parent of 18V
|
|
42
|
+
return the same "Extras" list), so nothing is reloaded and the extras
|
|
43
|
+
keep their place and selection.
|
|
44
|
+
- `Product/CrossSelling.vue` takes the mapped associations as a prop and
|
|
45
|
+
no longer fetches or shows a skeleton.
|
|
46
|
+
- The skeleton in `Detail.vue` has the shape of the loaded body (a select,
|
|
47
|
+
a row of extras, a row of ingredients), so the single swap moves less.
|
|
48
|
+
|
|
49
|
+
After the fix (same script):
|
|
50
|
+
|
|
51
|
+
| Viewport | Open: body height steps | Variant switch: steps |
|
|
52
|
+
| -------- | ----------------------- | --------------------- |
|
|
53
|
+
| Mobile | 447 px → 916 px | none (916 px) |
|
|
54
|
+
| Desktop | 2 renders | none |
|
|
55
|
+
|
|
56
|
+
## Not changed
|
|
57
|
+
|
|
58
|
+
- The variant request (`/api/product/variant`) still runs after the select
|
|
59
|
+
changes; the options, price and name update when it returns, without a
|
|
60
|
+
loading state. That is a content update, not a re-layout.
|
|
61
|
+
- The first detail request starts about half a second after the tap,
|
|
62
|
+
because the drawer chunk is created on first use (#314) and loads
|
|
63
|
+
before `Detail.vue` mounts. Prefetching the detail from
|
|
64
|
+
`useProductQuickView.show()` would hide that, but it is a separate
|
|
65
|
+
change.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Cart upsell row
|
|
2
|
+
|
|
3
|
+
Date: 2026-09-14. Branch `feature/338-cart-upsell`, issue #338.
|
|
4
|
+
|
|
5
|
+
## Goal
|
|
6
|
+
|
|
7
|
+
Restaurants miss easy add-on sales (a dessert or a drink) before checkout.
|
|
8
|
+
Shop owners flag suggestion products with the boolean custom field
|
|
9
|
+
`shopbite_cart_upsell` (shopbite-de/shopware-plugin#18). "Cross-selling"
|
|
10
|
+
already means the extras of a product in this codebase, so the feature is
|
|
11
|
+
called upsell.
|
|
12
|
+
|
|
13
|
+
## Placement
|
|
14
|
+
|
|
15
|
+
The issue planned the row in the cart drawer. A first version there worked
|
|
16
|
+
(verified live), but Lirim decided to show it only on the order confirmation
|
|
17
|
+
step `/bestellung/bestaetigen`, inside the cart card between the line items
|
|
18
|
+
and shipping/total. The drawer and `/bestellung/warenkorb` render no row.
|
|
19
|
+
|
|
20
|
+
The confirmation step lists the line items without quantity input and delete
|
|
21
|
+
button, and that stays: a suggestion added by mistake is removed in the cart.
|
|
22
|
+
|
|
23
|
+
## Implementation
|
|
24
|
+
|
|
25
|
+
- `useCartUpsell`: `loadUpsellProducts()` reads up to 6 flagged products
|
|
26
|
+
(`readProduct post /product`, `sw-inheritance: true`, sorted by name, only
|
|
27
|
+
the fields the card needs). `addUpsellProduct()` adds a plain product line
|
|
28
|
+
item with quantity 1 through `useCartMutations().addLineItems` (queue, lock
|
|
29
|
+
retry, error toast), then pops the cart badge and tracks
|
|
30
|
+
`Cart / UpsellAdd / <productNumber> / 1`. `isAdding(id)` covers the time the
|
|
31
|
+
write is queued; a second click in that time is ignored.
|
|
32
|
+
- `Cart/Upsell.vue`: products already in the cart (plain or as a container
|
|
33
|
+
child, `lineItemHoldsProduct`) are hidden, so a card disappears once its
|
|
34
|
+
product is added; without cards nothing is rendered.
|
|
35
|
+
- `Cart/QuickView.vue` renders it lazily behind the `withUpsell` prop, which
|
|
36
|
+
only `Checkout/Summary.vue` sets.
|
|
37
|
+
- `useAsyncData(…, { server: false })`: the confirmation step is rendered on
|
|
38
|
+
the server, but `app.vue` loads the cart in `onMounted`. Filtering on the
|
|
39
|
+
server would render cards that the browser hides, so the suggestions are
|
|
40
|
+
loaded in the browser and the row appears after the request.
|
|
41
|
+
|
|
42
|
+
## Design
|
|
43
|
+
|
|
44
|
+
Iterated with Lirim on screenshots of the demo shop:
|
|
45
|
+
|
|
46
|
+
- The row sits in a tinted box (`bg-primary/5`, primary ring) with a sparkles
|
|
47
|
+
icon, the heading "Dazu passt" and the hint "Mit einem Klick zur Bestellung
|
|
48
|
+
hinzufügen". Small tiles without a frame looked like line items.
|
|
49
|
+
- One suggestion spans the full width of the card; with several, the cards are
|
|
50
|
+
85 % wide in a horizontal snap scroller, so the next one peeks in (thin
|
|
51
|
+
scrollbar for mouse users).
|
|
52
|
+
- Card: square cover flush on the left (112 px, 144 px from `sm`, placeholder
|
|
53
|
+
icon without cover), number and name, price and an "Hinzufügen" button at
|
|
54
|
+
the bottom. Below `sm` the button shows only the plus icon, the label does
|
|
55
|
+
not fit next to the price. The cover is decorative (`alt=""`).
|
|
56
|
+
|
|
57
|
+
## Variant filter (differs from the issue)
|
|
58
|
+
|
|
59
|
+
The issue excluded variant parents with `childCount = 0`. That also excludes
|
|
60
|
+
every variant: Shopware's `ProductIndexer` runs the `ChildCountUpdater` only
|
|
61
|
+
for main products (`filterVariants`: `parent_id IS NULL`), and
|
|
62
|
+
`product.child_count` is a nullable column without default
|
|
63
|
+
(`Migration1562841035AddProductChildCount`). Variants keep `NULL`; core's
|
|
64
|
+
`CheapestPriceUpdater` checks `child_count = 0 OR parent_id IS NOT NULL` for
|
|
65
|
+
the same reason. The filter is therefore `childCount = 0 OR childCount = null`,
|
|
66
|
+
which still drops parents (`> 0`) but keeps flagged variants and the variants
|
|
67
|
+
of a flagged parent (inheritance), as the plugin's help text describes.
|
|
68
|
+
|
|
69
|
+
With inheritance a variant shows the parent's name without its options, so two
|
|
70
|
+
flagged variants of one product look alike in the row.
|
|
71
|
+
|
|
72
|
+
## Verified
|
|
73
|
+
|
|
74
|
+
- `pnpm typecheck` (0 errors), `pnpm prettier`, `pnpm eslint`.
|
|
75
|
+
- `pnpm test:unit` without the local Matomo variables, as in CI. With Matomo
|
|
76
|
+
configured in `.env` the run reports the three unhandled rejections of #323,
|
|
77
|
+
which are unrelated.
|
|
78
|
+
- `pnpm build`: `components/Cart/Upsell.vue` is its own dynamic chunk; the
|
|
79
|
+
heading and the custom field name only occur in that chunk.
|
|
80
|
+
- Demo Store API (shopware.shopbite.de, plugin field deployed, Tiramisu
|
|
81
|
+
flagged): the request returns exactly `LF-144 Tiramisu` with price and
|
|
82
|
+
cover. None of the 66 variants matches `childCount = 0` although the API
|
|
83
|
+
serializes their child count as `0`, which confirms the variant filter
|
|
84
|
+
finding above.
|
|
85
|
+
- Production build against the demo backend, Playwright on 1280×800 and
|
|
86
|
+
390×844 with a guest checkout (script not committed, order not placed):
|
|
87
|
+
- drawer and `/bestellung/warenkorb`: no row, the upsell chunk is not
|
|
88
|
+
requested;
|
|
89
|
+
- `/bestellung/bestaetigen`: the server HTML has no row; after hydration the
|
|
90
|
+
Tiramisu card sits inside the cart card below the line item and above the
|
|
91
|
+
total; the request carries `sw-inheritance: true` and the filter above;
|
|
92
|
+
- plus: total 9,50 € → 15,00 €, badge 1 → 2, the row disappears, Tiramisu
|
|
93
|
+
is a line item; Matomo sends `Cart / UpsellAdd / LF-144 / 1` (tracker
|
|
94
|
+
hits were aborted in the check);
|
|
95
|
+
- layout with three suggestions checked by extending the API response in
|
|
96
|
+
the browser.
|
|
97
|
+
- Local guest registration needs a `storefrontUrl` that is a domain of the
|
|
98
|
+
sales channel; the app sends the page origin, so the check replaced
|
|
99
|
+
`http://localhost:3338` with `http://localhost:3000`.
|
|
100
|
+
|
|
101
|
+
## Found along the way
|
|
102
|
+
|
|
103
|
+
Direct loads of `/bestellung/zahlung-versand` and `/bestellung/bestaetigen`
|
|
104
|
+
log "Hydration completed but contains mismatches." and the stepper highlights
|
|
105
|
+
"Warenkorb" on the last step, also without the upsell row: #339.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Demo shop not indexable
|
|
2
|
+
|
|
3
|
+
Date: 2026-09-14. Branch `feature/demo-noindex`.
|
|
4
|
+
|
|
5
|
+
## Goal
|
|
6
|
+
|
|
7
|
+
This repository is the base layer of every production shop, but deployed as
|
|
8
|
+
the app it only runs as the ShopBite demo shop (demo.shopbite.de). The demo
|
|
9
|
+
must not be crawled. Before the change the live demo answered with
|
|
10
|
+
`X-Robots-Tag: index, follow, …` and an indexable robots.txt with a sitemap.
|
|
11
|
+
|
|
12
|
+
## Decision
|
|
13
|
+
|
|
14
|
+
The demo deployment (Dokploy) sets `NUXT_SITE_INDEXABLE=false`. Nothing in
|
|
15
|
+
`nuxt.config.ts`:
|
|
16
|
+
|
|
17
|
+
- An unconditional `site: { indexable: false }` would be merged into every shop
|
|
18
|
+
project. Pizzeria La Fattoria does not set `site.indexable`, so it would drop
|
|
19
|
+
out of search engines with the next release.
|
|
20
|
+
- A config flag limited to this repository as the root project (comparing
|
|
21
|
+
`process.cwd()` with the config directory) worked, but was rejected as too
|
|
22
|
+
much machinery for one deployment setting.
|
|
23
|
+
- nuxt-site-config reads `NUXT_SITE_INDEXABLE` at runtime (priority `runtime`),
|
|
24
|
+
so no rebuild is needed. The trade-off: the setting lives in the deployment,
|
|
25
|
+
not in the repository; without it the demo is indexable again.
|
|
26
|
+
|
|
27
|
+
With `indexable: false`, @nuxtjs/robots serves `Disallow: /` in robots.txt (no
|
|
28
|
+
sitemap entry), `X-Robots-Tag: noindex, nofollow` and the robots meta tag.
|
|
29
|
+
|
|
30
|
+
## Category pages
|
|
31
|
+
|
|
32
|
+
`useCategorySeo` set `robots: "index,follow"` for active categories. The page
|
|
33
|
+
meta replaced the module's tag, so category pages rendered `index,follow` next
|
|
34
|
+
to a noindex header on a non-indexable site, and production shops lost the
|
|
35
|
+
module's `max-image-preview:large` rule. The composable now only sets
|
|
36
|
+
`noindex,nofollow` for inactive categories and leaves the rest to the module.
|
|
37
|
+
|
|
38
|
+
## Verified
|
|
39
|
+
|
|
40
|
+
Production build with La Fattoria's Store API, `node .output/server/index.mjs`:
|
|
41
|
+
|
|
42
|
+
- `NUXT_SITE_INDEXABLE=false`: robots.txt `Disallow: /`; `/`, `/c/Pizza/` and
|
|
43
|
+
`/bestellung/warenkorb` send `X-Robots-Tag: noindex, nofollow` and render
|
|
44
|
+
`<meta name="robots" content="noindex, nofollow">`.
|
|
45
|
+
- Without the variable (production shop): robots.txt with the disallow list
|
|
46
|
+
and sitemap, `/` and `/c/Pizza/` `index, follow, max-image-preview:large, …`
|
|
47
|
+
in header and meta, `/bestellung/warenkorb` keeps its page-level
|
|
48
|
+
`noindex, nofollow`.
|
|
49
|
+
- `pnpm vitest run test/unit/useCategorySeo.spec.ts`, ESLint, Prettier,
|
|
50
|
+
`pnpm typecheck`.
|
|
51
|
+
|
|
52
|
+
## After merging
|
|
53
|
+
|
|
54
|
+
Set `NUXT_SITE_INDEXABLE=false` in the Dokploy environment of demo.shopbite.de
|
|
55
|
+
and redeploy. Pages Google has already indexed disappear slowly because
|
|
56
|
+
`Disallow: /` stops crawling before the noindex is seen; use the removal tool
|
|
57
|
+
in Google Search Console for a faster cleanup.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Checkout steps: hydration mismatches on direct load
|
|
2
|
+
|
|
3
|
+
Date: 2026-09-16. Branch `fix/339-checkout-stepper-step`, issue #339.
|
|
4
|
+
|
|
5
|
+
## Reproduced
|
|
6
|
+
|
|
7
|
+
Production build against the demo backend, guest session with one cart item
|
|
8
|
+
created through the Store API, `sw-context-token` cookie set in Playwright,
|
|
9
|
+
each step loaded directly:
|
|
10
|
+
|
|
11
|
+
| Step | Before | After |
|
|
12
|
+
| ----------------------------- | -------------------------------- | ---------------------- |
|
|
13
|
+
| `/bestellung/warenkorb` | no warning, "Warenkorb" active | unchanged |
|
|
14
|
+
| `/bestellung/zahlung-versand` | mismatch, "Warenkorb" active | no warning, step 2 |
|
|
15
|
+
| `/bestellung/bestaetigen` | mismatch, "Warenkorb" active | no warning, step 3 |
|
|
16
|
+
|
|
17
|
+
## Two causes, one pattern
|
|
18
|
+
|
|
19
|
+
Both mismatches came from a child component changing state of its parent
|
|
20
|
+
during its setup. With SSR the parent's markup rendered before that change
|
|
21
|
+
reached it (or, in the second case, after it), while the browser hydrated with
|
|
22
|
+
the other value. Vue does not patch attributes and classes in production.
|
|
23
|
+
|
|
24
|
+
1. **Stepper** (the cause suspected in the issue): the step pages called
|
|
25
|
+
`setStep(n)` of the Pinia checkout store in their setup, after
|
|
26
|
+
`bestellung.vue` had rendered `<UStepper>` with step 0. The serialized store
|
|
27
|
+
state carried the new step, so the browser hydrated with step n.
|
|
28
|
+
Fix: `bestellung.vue` derives the step from `route.path` (index in
|
|
29
|
+
`stepRoutes`); its setter navigates. The store and `useCheckoutStore` had no
|
|
30
|
+
other users (also none in `demos/` and `masala-mio/`) and are removed.
|
|
31
|
+
Pinia is still registered as a module but has no store now.
|
|
32
|
+
2. **Order button on `/bestellung/bestaetigen`**, found only after fixing the
|
|
33
|
+
stepper (the dev server prints the mismatching node):
|
|
34
|
+
`Checkout/DeliveryTimeSelect.vue` emits `update:valid` from an immediate
|
|
35
|
+
watch. No time is selected before the business hours load in the browser
|
|
36
|
+
(`app.vue` on mount), so it always emits `false` first. On the server the
|
|
37
|
+
button renders after that emit ("Wir haben aktuell leider geschlossen",
|
|
38
|
+
lock icon, disabled); `Summary.vue` started with `isValidTime = ref(true)`,
|
|
39
|
+
so the browser hydrated "Jetzt bestellen!". Fix: start with `false`.
|
|
40
|
+
|
|
41
|
+
## Verified
|
|
42
|
+
|
|
43
|
+
- Production build: no hydration warning on any step, correct active step.
|
|
44
|
+
- Client-side navigation: stepper click back to "Zahlung & Versand" and
|
|
45
|
+
"Warenkorb", "Weiter zu Prüfen & Bestellen" button forward.
|
|
46
|
+
- After the business hours load the order button reads "Jetzt bestellen!" and
|
|
47
|
+
is enabled (demo shop open).
|
|
48
|
+
- `pnpm typecheck` (0 errors), `pnpm prettier`, `pnpm eslint`,
|
|
49
|
+
`pnpm test:unit` without the Matomo variables (264 tests).
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Order button: loading state for the opening hours
|
|
2
|
+
|
|
3
|
+
Date: 2026-09-16. Branch `fix/349-order-button-loading`, issue #349.
|
|
4
|
+
|
|
5
|
+
## Problem
|
|
6
|
+
|
|
7
|
+
`app.vue` loads business hours and holidays after mounting. Until then
|
|
8
|
+
`Checkout/DeliveryTimeSelect.vue` has no time to select and reports
|
|
9
|
+
`valid = false`, and `Checkout/Summary.vue` labelled the order button
|
|
10
|
+
"Wir haben aktuell leider geschlossen". The server HTML carried that label as
|
|
11
|
+
well, so the confirmation step always said "closed" first.
|
|
12
|
+
|
|
13
|
+
## Change
|
|
14
|
+
|
|
15
|
+
`Summary.vue` reads `businessHours` and `holidays` from `useBusinessHours` and
|
|
16
|
+
`useHolidays` (the same "loaded" check as `useStoreStatus`). While either is
|
|
17
|
+
missing and customer data is available, the button is disabled, shows the
|
|
18
|
+
spinner and the label "Lade Öffnungszeiten …". "Einloggen oder Kundendaten
|
|
19
|
+
erfassen" keeps priority, it does not depend on the hours.
|
|
20
|
+
|
|
21
|
+
`DeliveryTimeSelect` was left unchanged: emitting a second state from it would
|
|
22
|
+
repeat the pattern of #339 (a child changing parent state during setup).
|
|
23
|
+
Reading the shared `useAsyncData` state directly renders the same on the
|
|
24
|
+
server and at hydration (both without data).
|
|
25
|
+
|
|
26
|
+
A failed request leaves the data empty, so the button keeps the loading state,
|
|
27
|
+
as the "Lade Öffnungszeiten..." badge of `DeliveryTimeSelect` already does.
|
|
28
|
+
Neither retries the request.
|
|
29
|
+
|
|
30
|
+
## Verified
|
|
31
|
+
|
|
32
|
+
- `test/nuxt/CheckoutSummary.test.ts`: loading, closed after loading, order
|
|
33
|
+
possible with a valid time. The loading test fails without the change.
|
|
34
|
+
- Production build against the demo backend with a guest session: the server
|
|
35
|
+
HTML has the loading label, the button then goes from
|
|
36
|
+
"Lade Öffnungszeiten …" (disabled, spinner) straight to "Jetzt bestellen!"; no "closed" in
|
|
37
|
+
between, no hydration warning.
|
|
38
|
+
- `pnpm typecheck` (0 errors), `pnpm prettier`, `pnpm eslint`,
|
|
39
|
+
`pnpm test:unit` without the Matomo variables (267 tests).
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Remove Pinia
|
|
2
|
+
|
|
3
|
+
Date: 2026-09-16. Branch `feature/350-remove-pinia`, issue #350.
|
|
4
|
+
|
|
5
|
+
## Why
|
|
6
|
+
|
|
7
|
+
#348 (#339) removed the only store, `useCheckoutStore`: the checkout stepper
|
|
8
|
+
derives its step from the route. Shared state is `useState`/`useAsyncData` in
|
|
9
|
+
composables everywhere else. `@shopware/composables`, `@shopware/nuxt-module`
|
|
10
|
+
and the demo shops (`demos/`, `masala-mio/`) do not use Pinia.
|
|
11
|
+
|
|
12
|
+
## Changes
|
|
13
|
+
|
|
14
|
+
- `@pinia/nuxt` removed from `package.json` and `modules`, `pinia` removed from
|
|
15
|
+
the `framework` code splitting group in `nuxt.config.ts`.
|
|
16
|
+
- `README.md` project structure: no `stores/` directory.
|
|
17
|
+
- Monorepo `CLAUDE.md` (not versioned): "Pinia for state" replaced.
|
|
18
|
+
|
|
19
|
+
`pinia` stays in `pnpm-lock.yaml` as an optional peer dependency of
|
|
20
|
+
`vue-router` and `@sentry/vue`; neither installs nor bundles it for us.
|
|
21
|
+
|
|
22
|
+
Shops extending the layer no longer get Pinia through it. A shop with its own
|
|
23
|
+
stores adds `@pinia/nuxt` to its own dependencies and `modules`.
|
|
24
|
+
|
|
25
|
+
## Measured
|
|
26
|
+
|
|
27
|
+
Production build, JS files the home page references (37 files):
|
|
28
|
+
|
|
29
|
+
| | Before | After |
|
|
30
|
+
| -------- | ---------- | ---------- |
|
|
31
|
+
| raw | 1,175.1 KB | 1,171.5 KB |
|
|
32
|
+
| gzip | 341.3 KB | 339.7 KB |
|
|
33
|
+
| `pinia` | 1 chunk | 0 chunks |
|
|
34
|
+
|
|
35
|
+
## Verified
|
|
36
|
+
|
|
37
|
+
- `pnpm build`, home page, category page and `/bestellung/warenkorb` in the
|
|
38
|
+
browser without console errors (apart from the demo data icon
|
|
39
|
+
`lucide:french-fries`, unrelated).
|
|
40
|
+
- `pnpm typecheck` (0 errors), `pnpm prettier`, `pnpm eslint`,
|
|
41
|
+
`pnpm test:unit` without the Matomo variables (264 tests).
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Opening hours: error state and retry in the checkout
|
|
2
|
+
|
|
3
|
+
Date: 2026-09-16. Branch `fix/355-opening-hours-error`, issue #355.
|
|
4
|
+
|
|
5
|
+
## Problem
|
|
6
|
+
|
|
7
|
+
When the business hours or holidays request failed in the browser, the
|
|
8
|
+
confirmation step kept its loading state (#349): order button disabled with
|
|
9
|
+
spinner, delivery time section "Lade Öffnungszeiten...". Nothing retried.
|
|
10
|
+
|
|
11
|
+
## Decision (Lirim)
|
|
12
|
+
|
|
13
|
+
Retry automatically first, then show an error with a button: two more attempts
|
|
14
|
+
after 1 s and 3 s; if they fail too, the delivery time section shows an alert
|
|
15
|
+
"Öffnungszeiten konnten nicht geladen werden" with "Erneut versuchen", and the
|
|
16
|
+
order button carries the same text (disabled, no spinner).
|
|
17
|
+
|
|
18
|
+
## Implementation
|
|
19
|
+
|
|
20
|
+
- `utils/retry.ts`: `withRetries(request, delays)`.
|
|
21
|
+
- `useBusinessHours`/`useHolidays`: the request is wrapped in `withRetries` with
|
|
22
|
+
`OPENING_HOURS_RETRY_DELAYS` in the browser only; on the server a retry would
|
|
23
|
+
delay every page (the footer prefetches the hours). Both now return `status`.
|
|
24
|
+
- `useOpeningHoursData`: `isLoaded` (both there), `hasFailed` (a missing one has
|
|
25
|
+
status `error` and no missing one is `pending`), `isLoading`, `retry()`
|
|
26
|
+
(refreshes only what is missing).
|
|
27
|
+
- `Checkout/Summary.vue` and `Checkout/DeliveryTimeSelect.vue` use it. The time
|
|
28
|
+
input and the holiday badge now need both data sets; before, the input showed
|
|
29
|
+
without bounds when only the holidays were loaded.
|
|
30
|
+
|
|
31
|
+
## Findings
|
|
32
|
+
|
|
33
|
+
- Nuxt's `useAsyncData` keeps `error` set while a refresh runs and resets `data`
|
|
34
|
+
to the default on failure; `status` is the reliable signal (`pending` during
|
|
35
|
+
a retry).
|
|
36
|
+
- On checkout pages the business hours are in the SSR payload
|
|
37
|
+
(`Footer/Contact.vue` prefetches them), and `app.vue`'s refresh on mount is
|
|
38
|
+
served from that payload while hydrating. The browser then requests only the
|
|
39
|
+
holidays, so a browser-side failure of the business hours request does not
|
|
40
|
+
happen on a first load.
|
|
41
|
+
- The footer renders after the checkout on the server. If its prefetch fails,
|
|
42
|
+
the payload carries the error and the browser would hydrate `status: error`
|
|
43
|
+
while the server rendered the checkout without it. `hasFailed` is therefore
|
|
44
|
+
`false` until the component is mounted.
|
|
45
|
+
|
|
46
|
+
## Verified
|
|
47
|
+
|
|
48
|
+
- Tests: `test/unit/retry.spec.ts`, `test/nuxt/useOpeningHoursData.test.ts`
|
|
49
|
+
(including "no failure before mounting"), `test/nuxt/CheckoutSummary.test.ts`
|
|
50
|
+
(error label).
|
|
51
|
+
- Production build against the demo backend, guest session, holidays request
|
|
52
|
+
answered with 500 in Playwright: three attempts, 4–6 s after loading the alert and
|
|
53
|
+
the button text, no hydration warning; "Erneut versuchen" with the request
|
|
54
|
+
unblocked loads the holidays and the button reads "Jetzt bestellen!". Without
|
|
55
|
+
blocking: unchanged flow, time input present.
|
|
56
|
+
- `pnpm typecheck` (0 errors), `pnpm prettier`, `pnpm eslint`,
|
|
57
|
+
`pnpm test:unit` without the Matomo variables (276 tests).
|