@shopbite-de/storefront 2.4.0 → 2.6.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 +13 -1
- package/CLAUDE.md +7 -4
- package/api-types/storeApiSchema.json +62 -6
- package/api-types/storeApiTypes.d.ts +23 -4
- package/app/components/Checkout/DeliveryTimeSelect.vue +39 -18
- package/app/components/Checkout/Summary.vue +5 -1
- package/app/components/Home/Categories.vue +2 -2
- package/app/components/Home/Facts.vue +9 -4
- package/app/components/Home/Hero.vue +8 -2
- package/app/components/Navigation/MobileTop.vue +1 -1
- package/app/components/Order/Detail.vue +3 -4
- package/app/composables/useAddressAutocomplete.ts +3 -11
- package/app/composables/useCheckoutMethodGuard.ts +1 -1
- package/app/composables/useDeliveryTime.ts +8 -5
- package/app/composables/useShippingLeadTime.ts +17 -0
- package/app/composables/useShippingMethodChoice.ts +2 -2
- package/app/composables/useShopBiteConfig.ts +10 -1
- package/app/composables/useTrackEvent.ts +4 -3
- package/app/pages/account/recover/password/index.vue +10 -0
- package/app/pages/registrierung/bestaetigen.vue +4 -0
- package/app/utils/leadTime.ts +97 -0
- package/app/utils/openingHours.ts +1 -1
- package/app/utils/schema.ts +2 -2
- package/app/utils/trackingUrl.ts +39 -0
- package/content/index.yml +16 -16
- package/content/zahlung-und-versand.md +3 -3
- package/content.config.ts +2 -2
- package/docs/notes/2026-07-04-issue-239-hydration-mismatches.md +1 -1
- package/docs/notes/2026-09-08-issue-244-category-url-trailing-slash.md +2 -2
- package/docs/notes/2026-09-10-issue-251-shop-data-in-base-layer.md +4 -4
- package/docs/notes/2026-09-10-issue-272-restaurant-schema.md +3 -3
- package/docs/notes/2026-09-10-issue-273-performance-media.md +4 -4
- package/docs/notes/2026-09-10-issue-274-seo-basics.md +6 -6
- package/docs/notes/2026-09-10-issue-275-accessibility.md +3 -3
- package/docs/notes/2026-09-10-issue-290-footer-nap.md +5 -5
- package/docs/notes/2026-09-10-issue-294-matomo-without-config.md +1 -1
- package/docs/notes/2026-09-10-issue-296-track-direct-search.md +1 -1
- package/docs/notes/2026-09-10-issue-312-store-api-criteria-post.md +3 -3
- package/docs/notes/2026-09-10-issue-313-wishlist-scoped-tailwind.md +1 -1
- package/docs/notes/2026-09-10-issue-314-mobile-js-cost.md +1 -1
- package/docs/notes/2026-09-12-issue-319-stylesheet-cost.md +1 -1
- package/docs/notes/2026-09-12-issue-325-product-card.md +2 -2
- package/docs/notes/2026-09-12-issue-327-home-hero.md +2 -2
- package/docs/notes/2026-09-13-issue-332-home-info-cards.md +1 -1
- package/docs/notes/2026-09-13-quick-view-flicker.md +1 -1
- package/docs/notes/2026-09-14-demo-noindex.md +2 -2
- package/docs/notes/2026-09-17-quick-view-compact-options.md +1 -1
- package/docs/notes/2026-09-21-issue-273-cache-and-demo-video.md +1 -1
- package/docs/notes/2026-09-21-issue-363-non-fatal-404.md +2 -2
- package/docs/notes/2026-09-21-issue-366-wishlist-404.md +1 -1
- package/docs/notes/2026-09-21-issue-378-dev-modules.md +1 -1
- package/docs/notes/2026-10-05-issue-289-product-deep-links.md +1 -1
- package/docs/notes/2026-10-05-issue-400-menu-item-ingredients-diet.md +1 -1
- package/docs/notes/2026-10-05-issue-401-restaurant-schema-ordering.md +1 -1
- package/docs/notes/2026-10-05-issue-402-llms-txt.md +1 -1
- package/docs/notes/2026-10-05-issue-403-ai-crawlers.md +1 -1
- package/docs/notes/2026-10-05-issue-404-faq.md +1 -1
- package/docs/notes/2026-10-06-old-seo-url-redirect.md +5 -5
- package/docs/notes/2026-10-07-issue-434-property-group-projection.md +1 -1
- package/nuxt.config.ts +56 -8
- package/package.json +3 -2
- package/server/api/address/autocomplete.get.ts +79 -14
- package/server/api/listing/[categoryId].get.ts +5 -28
- package/server/api/search.get.ts +4 -18
- package/server/api/shopbite/config.get.ts +1 -1
- package/server/plugins/bounded-cache.ts +28 -0
- package/server/plugins/security-headers.ts +54 -0
- package/server/routes/llms.txt.ts +6 -5
- package/server/utils/addressAutocomplete.ts +181 -0
- package/server/utils/listingParams.ts +117 -0
- package/server/utils/llmsTxt.ts +7 -3
- package/server/utils/securityHeaders.ts +165 -0
- package/server/utils/shopBiteConfig.ts +1 -1
- package/test/layer/nuxt.config.ts +2 -2
- package/test/nuxt/AccountPagesPreset.test.ts +10 -10
- package/test/nuxt/AuthPagesPreset.test.ts +3 -0
- package/test/nuxt/CheckoutFormsPreset.test.ts +5 -5
- package/test/nuxt/CheckoutOnePage.test.ts +4 -1
- package/test/nuxt/CheckoutSummary.test.ts +42 -3
- package/test/nuxt/DeliveryTimeSelect.test.ts +181 -0
- package/test/nuxt/HeaderFooterPreset.test.ts +10 -10
- package/test/nuxt/HomeFaq.test.ts +1 -1
- package/test/nuxt/HomeLeadTimes.test.ts +78 -0
- package/test/nuxt/NavigationMobileTop.test.ts +1 -1
- package/test/nuxt/OrderPagesPreset.test.ts +22 -2
- package/test/nuxt/RegisterConfirmPage.test.ts +12 -0
- package/test/nuxt/useAddressAutocomplete.test.ts +7 -22
- package/test/nuxt/useCheckoutMethodGuard.test.ts +1 -1
- package/test/nuxt/useDeliveryTime.test.ts +30 -6
- package/test/nuxt/useShippingLeadTime.test.ts +66 -0
- package/test/nuxt/useShippingMethodChoice.test.ts +1 -1
- package/test/nuxt/useShopBiteConfig.test.ts +57 -3
- package/test/nuxt/useTrackEvent.test.ts +16 -0
- package/test/unit/addressAutocomplete.spec.ts +247 -0
- package/test/unit/boundedCache.spec.ts +231 -0
- package/test/unit/highlight.spec.ts +2 -2
- package/test/unit/leadTime.spec.ts +86 -0
- package/test/unit/llmsTxt.spec.ts +30 -29
- package/test/unit/openingHours.spec.ts +3 -3
- package/test/unit/schema.spec.ts +29 -32
- package/test/unit/securityHeaders.spec.ts +254 -0
- package/test/unit/seo.spec.ts +23 -29
- package/test/unit/sitemap.spec.ts +1 -1
- package/test/unit/trackingUrl.spec.ts +48 -0
package/.env.example
CHANGED
|
@@ -20,6 +20,11 @@ OPENAPI_ACCESS_KEY=key
|
|
|
20
20
|
OPENAPI_JSON_URL="https://shopware.shopbite.net"
|
|
21
21
|
|
|
22
22
|
NUXT_GEOAPIFY_API_KEY=
|
|
23
|
+
# Per-IP limit of address lookups that reach Geoapify (token bucket in
|
|
24
|
+
# memory; capacity 0 = off, e.g. when the reverse proxy limits the route).
|
|
25
|
+
# The client IP is read from X-Forwarded-For.
|
|
26
|
+
NUXT_ADDRESS_AUTOCOMPLETE_RATE_LIMIT_CAPACITY=20
|
|
27
|
+
NUXT_ADDRESS_AUTOCOMPLETE_RATE_LIMIT_REFILL_PER_MINUTE=20
|
|
23
28
|
|
|
24
29
|
# Matomo loads only when both values are set
|
|
25
30
|
NUXT_PUBLIC_SCRIPTS_MATOMO_ANALYTICS_MATOMO_URL=
|
|
@@ -39,7 +44,7 @@ NUXT_PUBLIC_SITE_TELEPHONE=
|
|
|
39
44
|
NUXT_PUBLIC_SITE_GOOGLE_BUSINESS_PROFILE_URL=
|
|
40
45
|
# Restaurant schema (schema.org), e.g. "€€"
|
|
41
46
|
NUXT_PUBLIC_SITE_PRICE_RANGE=
|
|
42
|
-
# Comma-separated, e.g. "
|
|
47
|
+
# Comma-separated, e.g. "12345 Musterstadt, 12346 Beispieldorf"
|
|
43
48
|
NUXT_PUBLIC_SITE_DELIVERY_AREAS=
|
|
44
49
|
NUXT_PUBLIC_SITE_GEO_LATITUDE=
|
|
45
50
|
NUXT_PUBLIC_SITE_GEO_LONGITUDE=
|
|
@@ -53,3 +58,10 @@ NUXT_STORE_NAME="ShopBite"
|
|
|
53
58
|
STORE_DESCRIPTION="Reduziere deine Kosten und steigere deinen Umsatz"
|
|
54
59
|
# Secret of POST /api/_cache/purge, the backoffice empties the Store API caches after menu changes (empty = off)
|
|
55
60
|
NUXT_CACHE_PURGE_SECRET=
|
|
61
|
+
|
|
62
|
+
# Bound of the in-memory server cache (LRU); max entries 0 = unbounded
|
|
63
|
+
NUXT_CACHE_STORAGE_MAX_ENTRIES=5000
|
|
64
|
+
NUXT_CACHE_STORAGE_MAX_SIZE_MB=128
|
|
65
|
+
# Sortings accepted by the listing and search routes, comma-separated
|
|
66
|
+
# (empty = Shopware's standard sortings; add custom sorting keys here)
|
|
67
|
+
NUXT_LISTING_SORTINGS=
|
package/CLAUDE.md
CHANGED
|
@@ -92,7 +92,8 @@ Custom ShopBite plugin endpoints are prefixed `shopbite.*` in the operations typ
|
|
|
92
92
|
Key custom composables:
|
|
93
93
|
|
|
94
94
|
- **`useBusinessHours`** – opening hours with multi-interval support; Sunday is day 7 (not 0)
|
|
95
|
-
- **`useDeliveryTime`** – validates slots in 5-minute increments, accounts for
|
|
95
|
+
- **`useDeliveryTime`** – validates slots in 5-minute increments, accounts for the lead time of the selected shipping method (`useShippingLeadTime`; 30 minutes until the config is loaded), handles holidays
|
|
96
|
+
- **Lead time per shipping method** (shopbite#6) – `/store-api/shopbite/config` returns `shippingMethods: [{ id, fulfillment: "delivery" | "pickup", leadTimeMinutes }]` (active methods of the sales channel); there is no global `deliveryTime` any more and no guessing from method names. `app/utils/leadTime.ts` (also used by llms.txt): `shippingLeadTime()` for a method (unlisted = delivery without lead time), `fulfillmentLeadTime()` = first method of a fulfillment (`null` without one; home hero/facts and llms.txt then leave the time out), `FULFILLMENT_WORDING` (Wunschlieferzeit/Wunschabholzeit, Liefer-/Abholzeiten), `wishedTimeComment()`/`parseWishedTime()`. `useShippingLeadTime()` follows the checkout's selected shipping method (time field, hint, empty states, comment prefix). The order's `customerComment` is `Wunschlieferzeit: HH:MM` or `Wunschabholzeit: HH:MM`; readers accept both (older orders always say Wunschlieferzeit). `useShopBiteConfig()` exposes `deliveryTime`/`pickupTime` (lead time of the first delivery/pickup method or `null`) and `leadTimeFor(method)`; the home facts have `kind: delivery` and `kind: pickup`
|
|
96
97
|
- **`useAddToCart`** – products with extras/toppings use UUID v5 (product ID + sorted extras) as container item reference; simple products bypass the container
|
|
97
98
|
- **`useAddressAutocomplete`** – proxies Geoapify through `/api/address/autocomplete` to avoid exposing the API key client-side
|
|
98
99
|
- **`useShopBiteConfig`** – fetches delivery config and checkout state from the custom Shopware plugin; the server renders from the cached `/api/shopbite/config` (60 s), the browser loads it from Shopware after hydration (`useLiveShopData`) and the checkout every 10 s (`Checkout/Summary.vue`). The plugin does not enforce the checkout switch, so the browser's value is the gate and must come from Shopware
|
|
@@ -112,7 +113,7 @@ The storefront reads plain Shopware entities with fixed names; seed data must ma
|
|
|
112
113
|
|
|
113
114
|
### Server routes
|
|
114
115
|
|
|
115
|
-
`server/api/address/autocomplete.get.ts` — Geoapify proxy (keeps API key server-side).
|
|
116
|
+
`server/api/address/autocomplete.get.ts` — Geoapify proxy (keeps API key server-side). Passes on only `text` (3–200 characters), `lang` (`/^[a-z]{2}$/`) and `limit` (1–10), 400 otherwise; the area filter comes from `public.shopBite.addressAutocomplete.boundingBox`, never from the query. Upstream errors are logged with the key redacted and answered with a generic 502 (ofetch messages contain the request URL). Identical lookups come from a bounded in-memory cache (5 min, 500 entries); lookups reaching Geoapify are rate limited per client IP (`addressAutocomplete.rateLimit`, token bucket in memory per process, capacity 0 = off; the IP comes from `X-Forwarded-For`, so the app must run behind a proxy that sets it). Helpers in `server/utils/addressAutocomplete.ts`.
|
|
116
117
|
`server/utils/shopware/adminApiClient.ts` — Admin API client for server-side Shopware operations requiring elevated credentials.
|
|
117
118
|
`server/api/__sitemap__/urls.get.ts` — dynamic `@nuxtjs/sitemap` source (navigation categories from the Store API).
|
|
118
119
|
`server/routes/llms.txt.ts` — `/llms.txt` for AI assistants (#402): shop, hours, ordering and the menu with prices, ingredients and diets as Markdown, built by the pure `server/utils/llmsTxt.ts`; `swr` 1 h. Every Store API source is optional (`Promise.allSettled`), content pages blocked in `robots.txt` are left out.
|
|
@@ -120,14 +121,16 @@ The storefront reads plain Shopware entities with fixed names; seed data must ma
|
|
|
120
121
|
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).
|
|
121
122
|
`modules/dev-tooling.ts` registers `@nuxt/eslint`, `@nuxt/hints` and `@nuxt/test-utils/module` only when the storefront itself is the project (not for shops extending the layer, not inside `node_modules`); they are devDependencies, so never add them to `modules` in `nuxt.config.ts` (#378).
|
|
122
123
|
The cached Store API handlers (`defineCachedEventHandler`, TTL `public.shopBite.cacheTtl`, a day for products, listings, categories) can be emptied by the backoffice: `POST /api/_cache/purge` with `Authorization: Bearer $NUXT_CACHE_PURGE_SECRET` (route off without the secret, #484). `server/utils/cachePurge.ts` picks the Nitro keys (`cache:nitro:handlers:<name>:<escaped key>`) by id, so a new cached handler needs its `name` in `ALL` there and the id in its `getKey`.
|
|
124
|
+
The Nitro cache is bounded (`server/plugins/bounded-cache.ts`): an LRU (`unstorage/drivers/lru-cache`) mounted at `cache:` with at most `cacheStorage.maxEntries` entries (5000) and `maxSizeMb` of serialised data (128), `NUXT_CACHE_STORAGE_*`; evicted entries are fetched again. A shop that mounts its own `nitro.storage.cache` keeps it, `maxEntries` 0 leaves the cache unbounded. `/api/listing/[categoryId]` and `/api/search` validate their parameters before they become keys (`server/utils/listingParams.ts`, 400 otherwise): category id and `properties`/`manufacturer` as 32-hex ids (`|`-separated, at most 50, lower-cased, deduplicated and sorted), `order` from `listingSortings` (empty = Shopware's standard sortings `name-asc`, `name-desc`, `price-asc`, `price-desc`, `topseller`, `score`; add custom sortings there), `p` 1–20, text queries at most 100 characters with whitespace collapsed.
|
|
123
125
|
Layout data is cached the same way, because every page renders it, a 404 too (once its own page and once `/__nuxt_error`): a vulnerability scanner probing 404 paths otherwise multiplied its request rate at Shopware many times over. With warm caches an SSR request asks Shopware only for `/context` (per visitor: cart, login); paths with non-ASCII characters that pass the known-path filter still make their SEO lookups uncached, and the browser loads config, hours and holidays once per page load (below). Handlers and TTLs (`cacheTtl.*`, `NUXT_PUBLIC_SHOP_BITE_CACHE_TTL_*`): `/api/navigation/[type]` (`main`, `footer`, `menu`, `home`; key includes the menu root; `navigation`, a day), `/api/breadcrumb/[categoryId]` (`category`; an empty breadcrumb, i.e. an unknown id, is a 404 and not cached), `/api/top-sellers` (`listing`), `/api/payment-methods` (Restaurant schema, asked without a visitor context; `paymentMethods`, 1 h), `/api/shopbite/config` (cached function `shopbite-config`, `config`, 60 s), `/api/shopbite/business-hours` and `/holidays` (`businessHours`/`holidays`, 5 min), `/api/seo-url?path=` (function `seo-url`, `seoUrl`, 10 min; key = lookup field (`pathInfo` for technical URLs, else `seoPathInfo`) + lower-cased value; only matches that spell the looked-up value up to case are stored, because Shopware's collation also ignores accents and trailing spaces and each such variant would add an entry). Config, hours, holidays and the SEO caches use `swr: false`: with Nitro's default `swr: true` an expired entry is still served once, so the TTL would not cap the staleness. A failed Shopware request is never cached. During an outage the layout handlers and `shopBiteConfig()` serve the last good answer per key and otherwise fail fast with 503; after a failure each handler asks Shopware again only after 30 s (`createResilientLoader`, `server/utils/backoff.ts`), and `storeApiGet`/`storeApiPost` do not retry (ofetch retries a GET once by default). Use the loader in a new cached handler. Before an order, `Checkout/Summary.vue` asks Shopware for the checkout switch (`checkCheckoutEnabled`) and does not order when it is off or cannot be checked. Only server-side rendering reads config, hours and holidays from the cache: `useAsyncData` reuses the server payload at hydration (a `refresh()` during hydration does not fetch either), so `useLiveShopData` (app.vue, error.vue) reloads the three keys from Shopware with `refreshNuxtData` after hydration; store status, delivery time choice and order buttons then act on that. Keys contain no language or context: like all cached handlers they call Shopware with the sales channel's access key only. Every purge (any target) empties the layout handlers (`LAYOUT`), the lists and the cached functions `seo-url`, `seo-paths`, `shopbite-config`; `{ "layout": true }` empties only the layout data (and `llms.txt`), for changes of hours, closing days or the checkout switch.
|
|
124
126
|
|
|
127
|
+
`server/plugins/security-headers.ts` sends the headers of `runtimeConfig.securityHeaders` (`NUXT_SECURITY_HEADERS_*`, empty value = header off, builders in `server/utils/securityHeaders.ts`) with every response: HSTS (only when `public.storeUrl` is https), `nosniff`, `X-Frame-Options: DENY` plus `Content-Security-Policy: frame-ancestors 'none'`, `Referrer-Policy`, `Permissions-Policy` (camera, microphone, geolocation, usb, browsing-topics off; Web Share and clipboard stay allowed). Rendered HTML gets `Cache-Control: private, no-store` (it may carry the visitor's cart or login, `useUserContextInSSR`) unless a route rule sets one, loses `x-powered-by`, and gets a `Content-Security-Policy-Report-Only` (self, Shopware endpoint, Matomo, extra hosts from `contentSecurityPolicyReportOnly.scriptSrc`/`connectSrc`/`imgSrc`, optional `reportUri`) whose `script-src` lists the sha256 of each inline script of that response (Nuxt's config script and the import map; JSON payload and JSON-LD are data blocks). Inline styles stay allowed (Vue style bindings). The service worker caches no pages (no `runtimeCaching`), so personalised HTML never lands in CacheStorage.
|
|
125
128
|
`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).
|
|
126
129
|
`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).
|
|
127
130
|
|
|
128
131
|
### Client-side JavaScript budget (#314)
|
|
129
132
|
|
|
130
|
-
- Nothing that the first paint does not need belongs in the entry chunk. Components that only some shops use go behind `Lazy…` + `v-if` (`SalesChannelSwitch`); the Matomo registry is imported in `plugins/matomo.ts` after `onNuxtReady`, tracking pushes to `_paq` via `useTrackEvent`.
|
|
133
|
+
- Nothing that the first paint does not need belongs in the entry chunk. Components that only some shops use go behind `Lazy…` + `v-if` (`SalesChannelSwitch`); the Matomo registry is imported in `plugins/matomo.ts` after `onNuxtReady`, tracking pushes to `_paq` via `useTrackEvent`. Tracked URLs (`setCustomUrl`) go through `trackingUrl()` (`app/utils/trackingUrl.ts`): no fragment, and of the query only campaign parameters (`utm_*`, `mtm_*`, `pk_*`, `matomo_*`) and the quick view configuration (`produkt`, `ohne`, `extras`), because e-mail links carry one-time secrets; the password reset and registration confirmation pages also `router.replace` their query away once read.
|
|
131
134
|
- Overlays (`SbSheet`, collapsibles) are created on first use (`v-if` + `nextTick()` before opening), not mounted with the page — mounting forces a layout of the whole page.
|
|
132
135
|
- Long lists render on the server and hydrate on scroll: `hydrateWhenVisible(Component)` (`app/utils`) keeps the markup and the chunk, Used for the bon cards and the footer.
|
|
133
136
|
- `NuxtLink` prefetches on interaction only (`experimental.defaults.nuxtLink`), and Rolldown groups shared framework/UI modules into two chunks (`vite.build.rollupOptions.output.codeSplitting`). Measure with Lighthouse behind the h2 proxy (see `docs/notes/2026-09-10-issue-314-mobile-js-cost.md`) before changing either.
|
|
@@ -145,7 +148,7 @@ Layout data is cached the same way, because every page renders it, a 404 too (on
|
|
|
145
148
|
- No toasts (removed in #445, other responses to be designed): results and errors show where they happen, e.g. `role="alert"` boxes in forms and the checkout, `role="status"` regions, the voucher error at its field.
|
|
146
149
|
- Menu (#441): `Category/Listing.vue` has three columns from `lg` (`MenuCategoryIndex` word list, the list, `MenuCartPanel`), `NavigationMobileTop` below `lg` (section chips; the open section's sub-categories as a second chip row led by "Alle", the current chip scrolls into view); `MenuSectionHeader` and `MenuBonCard` (one column, number strip, `photo` for the `bonPhoto` view). The card's button adds a product straight to the cart unless `productNeedsChoice()` (a parent with variants, `childCount` in the listing projection), which opens the quick view; extras stay optional. Cards hydrate on approach (`hydrateWhenVisible`), so a click on a card that has not hydrated yet is lost. Filters live in an `SbSheet`, sorting is an `SbSelect` (`toSortingOptions()`). A section with sub-sections (#487) lists its dishes grouped: direct dishes first, then an `h2` per sub-section in navigation order (`groupBySubsections()`/`findCategory()` in `app/utils/menuGroups.ts`, needs `categoryIds` in the listing projection); the sub-section pages stay.
|
|
147
150
|
- Product sheet (#442): `SbSheet` with a bon header (a custom `#header` gets the full width below a toolbar with the `#actions` and the close button; next to the buttons a long name broke after four letters on a 393 px phone) (number strip, name as `DialogTitle`, diet and description as `DialogDescription`); `Configurator` shows variants as `SbChoiceGroup` (required), `DeselectIngredient` as `SbChip` ingredient chips (pressed = included), `CrossSelling` as `SbCheckbox` rows with a search, `Detail` a sticky footer with `SbStepper` and the add button.
|
|
148
|
-
- Cart and checkout (#443): `MenuOrderMode` (`useOrderMode`) and the checkout's shipping section list ALL active shipping methods (`useShippingMethodChoice`, `onlyAvailable: false`), because a delivery-area rule on the shipping city never matches before the guest has an address (
|
|
151
|
+
- Cart and checkout (#443): `MenuOrderMode` (`useOrderMode`) and the checkout's shipping section list ALL active shipping methods (`useShippingMethodChoice`, `onlyAvailable: false`), because a delivery-area rule on the shipping city never matches before the guest has an address (fixed in 2.0.3); `useCheckoutMethodGuard` switches only a blocked payment method, a blocked shipping method is reported in the checkout and never switched to pickup. It shows the shipping methods as an `SbSegmentedControl` only when there are two to four. The header cart opens an `SbSheet`; `Cart/Item` uses `SbStepper` (remove at 1). The checkout is one page, `/bestellung/kasse` (the old step routes 301 there, `routeRules`): numbered sections Lieferung oder Abholung (`CheckoutPaymentAndDelivery part="shipping"`), Wann, Ihre Angaben (`CheckoutLoginOrRegister` with Reka tabs, `UserRegistrationForm` (logic in `useRegistrationForm`) / `UserLoginForm`, or `UserDetail`), Bezahlung (`part="payment"`) and the order card in `Checkout/Summary.vue`; the order button says "Zahlungspflichtig bestellen" (§ 312j BGB). Forms validate with Zod on submit and show errors at the fields plus a focused summary in form order; `AddressFields` sets `autocomplete`.
|
|
149
152
|
- Order and account (#445): `/bestellung/<id>/erfolg` and `/bestellung/<id>` render `OrderConfirmation` (`OrderDetail`: facts incl. the wished time from the `customerComment`, receipt lines, totals; call card), `/bestellung/<id>/fehler` a payment retry. Login, registration, password pages and the registration confirmation render in `UserAuthPanel`; the account pages in `layouts/account.vue` (link navigation with `aria-current`) with `UserAccountHeader`; `AddressForm` (also used when an address is edited in the checkout). Irreversible actions confirm with `SbConfirmDialog` (focus starts on "Abbrechen"). Search, contact (`useContactForm`), wishlist (`useWishlistEntries`, #467), content pages and `error.vue` (with its own `Header`/`Footer`, because the error page replaces `app.vue`) use the same pieces.
|
|
150
153
|
- Home page (#444): `pages/index.vue` renders `HomeHero` (kicker, `[highlight]{.text-primary}` part in the accent colour via `splitHighlight()`, buttons from `hero.links`, live status, rating card from the Google `usp`; the photo is `hero.image` with the blurred video `hero.poster` as fallback, cropped 4:5 at `hero.imagePosition` (object-position); it sits in a `<picture>` with a `min-width: 640px` source, so phones load a 1 px GIF), `HomeFacts` (`features`), `HomeCategories` (word list, `useHomeMenuCategories`; a wide first category image switches to a full-width photo below the words, and `sizes` asks for the width the crop needs, since thumbnails are picked by width), `HomeHighlights` (top sellers as bon cards), `HomeRestaurant` (`gallery` + opening hours in the SSR HTML) and the two-column `HomeFaq`; `cta` and `mittagstisch` in `content/index.yml` are not shown.
|
|
151
154
|
- Header and footer (#455): `Header.vue` (logo, main nav, status pill, phone, account, wishlist, cart button opening the cart `SbSheet`, menu `SbSheet` on phones), `Footer.vue` (address, hours, footer navigation columns). `app.vue` has the skip link to `main#inhalt`.
|
|
@@ -10683,18 +10683,74 @@
|
|
|
10683
10683
|
"type": "boolean",
|
|
10684
10684
|
"description": "Whether checkout is enabled for ShopBite"
|
|
10685
10685
|
},
|
|
10686
|
-
"
|
|
10687
|
-
"type": "
|
|
10688
|
-
"
|
|
10689
|
-
"description": "
|
|
10686
|
+
"addressStreet": {
|
|
10687
|
+
"type": "string",
|
|
10688
|
+
"nullable": true,
|
|
10689
|
+
"description": "Street and number of the shop, null if not configured"
|
|
10690
|
+
},
|
|
10691
|
+
"addressPostalCode": {
|
|
10692
|
+
"type": "string",
|
|
10693
|
+
"nullable": true,
|
|
10694
|
+
"description": "Postal code of the shop, null if not configured"
|
|
10695
|
+
},
|
|
10696
|
+
"addressCity": {
|
|
10697
|
+
"type": "string",
|
|
10698
|
+
"nullable": true,
|
|
10699
|
+
"description": "City of the shop, null if not configured"
|
|
10700
|
+
},
|
|
10701
|
+
"telephone": {
|
|
10702
|
+
"type": "string",
|
|
10703
|
+
"nullable": true,
|
|
10704
|
+
"description": "Telephone number in display format (e.g. +49 123 456789), null if not configured"
|
|
10705
|
+
},
|
|
10706
|
+
"googleBusinessProfileUrl": {
|
|
10707
|
+
"type": "string",
|
|
10708
|
+
"format": "uri",
|
|
10709
|
+
"nullable": true,
|
|
10710
|
+
"description": "Link to the shop's Google Business Profile, null if not configured"
|
|
10690
10711
|
},
|
|
10691
10712
|
"menuCategoryId": {
|
|
10692
10713
|
"type": "string",
|
|
10693
10714
|
"pattern": "^[0-9a-f]{32}$",
|
|
10694
10715
|
"description": "Root category of the menu: the configured menu category, else the navigation category of the sales channel"
|
|
10716
|
+
},
|
|
10717
|
+
"shippingMethods": {
|
|
10718
|
+
"type": "array",
|
|
10719
|
+
"description": "The active shipping methods of the sales channel with fulfillment and lead time (shipping method custom fields shopbite_fulfillment and shopbite_lead_time_minutes; without a value: delivery and 30 minutes)",
|
|
10720
|
+
"items": {
|
|
10721
|
+
"type": "object",
|
|
10722
|
+
"properties": {
|
|
10723
|
+
"id": {
|
|
10724
|
+
"type": "string",
|
|
10725
|
+
"pattern": "^[0-9a-f]{32}$"
|
|
10726
|
+
},
|
|
10727
|
+
"fulfillment": {
|
|
10728
|
+
"type": "string",
|
|
10729
|
+
"enum": [
|
|
10730
|
+
"delivery",
|
|
10731
|
+
"pickup"
|
|
10732
|
+
]
|
|
10733
|
+
},
|
|
10734
|
+
"leadTimeMinutes": {
|
|
10735
|
+
"type": "integer",
|
|
10736
|
+
"minimum": 1,
|
|
10737
|
+
"maximum": 1440,
|
|
10738
|
+
"description": "Minutes until the order is delivered or ready for pickup"
|
|
10739
|
+
}
|
|
10740
|
+
},
|
|
10741
|
+
"required": [
|
|
10742
|
+
"id",
|
|
10743
|
+
"fulfillment",
|
|
10744
|
+
"leadTimeMinutes"
|
|
10745
|
+
]
|
|
10746
|
+
}
|
|
10695
10747
|
}
|
|
10696
10748
|
},
|
|
10697
|
-
"required": [
|
|
10749
|
+
"required": [
|
|
10750
|
+
"isCheckoutEnabled",
|
|
10751
|
+
"menuCategoryId",
|
|
10752
|
+
"shippingMethods"
|
|
10753
|
+
]
|
|
10698
10754
|
},
|
|
10699
10755
|
"BusinessHour": {
|
|
10700
10756
|
"type": "object",
|
|
@@ -16899,7 +16955,7 @@
|
|
|
16899
16955
|
"get": {
|
|
16900
16956
|
"tags": ["ShopBite"],
|
|
16901
16957
|
"summary": "Get ShopBite configuration",
|
|
16902
|
-
"description": "Retrieves ShopBite configuration including checkout status and
|
|
16958
|
+
"description": "Retrieves ShopBite configuration including checkout status and the fulfillment and lead time of each shipping method",
|
|
16903
16959
|
"operationId": "shopbite.config.get",
|
|
16904
16960
|
"parameters": [],
|
|
16905
16961
|
"responses": {
|
|
@@ -5358,12 +5358,31 @@ export type Schemas = {
|
|
|
5358
5358
|
readonly updatedAt?: string;
|
|
5359
5359
|
};
|
|
5360
5360
|
ShopBiteConfig: {
|
|
5361
|
-
/**
|
|
5362
|
-
|
|
5361
|
+
/** City of the shop, null if not configured */
|
|
5362
|
+
addressCity?: string | null;
|
|
5363
|
+
/** Postal code of the shop, null if not configured */
|
|
5364
|
+
addressPostalCode?: string | null;
|
|
5365
|
+
/** Street and number of the shop, null if not configured */
|
|
5366
|
+
addressStreet?: string | null;
|
|
5367
|
+
/**
|
|
5368
|
+
* Format: uri
|
|
5369
|
+
* Link to the shop's Google Business Profile, null if not configured
|
|
5370
|
+
*/
|
|
5371
|
+
googleBusinessProfileUrl?: string | null;
|
|
5363
5372
|
/** Whether checkout is enabled for ShopBite */
|
|
5364
5373
|
isCheckoutEnabled: boolean;
|
|
5365
|
-
/** Root category of the menu: the configured menu category, else the navigation category of the sales channel
|
|
5366
|
-
menuCategoryId
|
|
5374
|
+
/** Root category of the menu: the configured menu category, else the navigation category of the sales channel */
|
|
5375
|
+
menuCategoryId: string;
|
|
5376
|
+
/** The active shipping methods of the sales channel with fulfillment and lead time (shipping method custom fields shopbite_fulfillment and shopbite_lead_time_minutes; without a value: delivery and 30 minutes) */
|
|
5377
|
+
shippingMethods: {
|
|
5378
|
+
/** @enum {string} */
|
|
5379
|
+
fulfillment: "delivery" | "pickup";
|
|
5380
|
+
id: string;
|
|
5381
|
+
/** Minutes until the order is delivered or ready for pickup */
|
|
5382
|
+
leadTimeMinutes: number;
|
|
5383
|
+
}[];
|
|
5384
|
+
/** Telephone number in display format (e.g. +49 123 456789), null if not configured */
|
|
5385
|
+
telephone?: string | null;
|
|
5367
5386
|
};
|
|
5368
5387
|
ShopBiteWishlistItem: {
|
|
5369
5388
|
/** Format: date-time */
|
|
@@ -13,7 +13,9 @@ const emit = defineEmits<{
|
|
|
13
13
|
(e: "update:valid", value: boolean): void;
|
|
14
14
|
}>();
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
// Lead time and wording follow the selected shipping method (shopbite#6).
|
|
17
|
+
const { fulfillment, leadTime } = useShippingLeadTime();
|
|
18
|
+
const wording = computed(() => FULFILLMENT_WORDING[fulfillment.value]);
|
|
17
19
|
|
|
18
20
|
const selected = ref<string>(props.modelValue ?? "");
|
|
19
21
|
const now = ref<Date>(new Date());
|
|
@@ -90,7 +92,32 @@ function roundToNext5MinInterval(timeString: string | null): string {
|
|
|
90
92
|
return `${newHours.toString().padStart(2, "0")}:${newMinutes.toString().padStart(2, "0")}`;
|
|
91
93
|
}
|
|
92
94
|
|
|
93
|
-
|
|
95
|
+
/**
|
|
96
|
+
* A 5-minute slot within min and max: rounded up, else the last slot before
|
|
97
|
+
* max. A clamped raw minimum such as 16:43 failed the 5-minute check.
|
|
98
|
+
*/
|
|
99
|
+
function slotWithin(time: string, min: string, max: string): string {
|
|
100
|
+
const rounded = roundToNext5MinInterval(time);
|
|
101
|
+
if (rounded <= max) return rounded;
|
|
102
|
+
const parts = max.split(":").map(Number);
|
|
103
|
+
const total = Math.floor(((parts[0] ?? 0) * 60 + (parts[1] ?? 0)) / 5) * 5;
|
|
104
|
+
const last = `${Math.floor(total / 60)
|
|
105
|
+
.toString()
|
|
106
|
+
.padStart(2, "0")}:${(total % 60).toString().padStart(2, "0")}`;
|
|
107
|
+
return last >= min ? last : rounded;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Whether the time is the one filled in here (earliest slot), not one the
|
|
111
|
+
// guest chose: it follows the earliest slot, e.g. to an earlier one after a
|
|
112
|
+
// switch from delivery to pickup (shopbite#6).
|
|
113
|
+
const isPrefilled = ref(false);
|
|
114
|
+
|
|
115
|
+
function setSelected(time: string): void {
|
|
116
|
+
if (time === selected.value) return;
|
|
117
|
+
selected.value = time;
|
|
118
|
+
emit("update:modelValue", time);
|
|
119
|
+
}
|
|
120
|
+
|
|
94
121
|
watch(
|
|
95
122
|
[minTime, maxTime],
|
|
96
123
|
() => {
|
|
@@ -102,26 +129,20 @@ watch(
|
|
|
102
129
|
return;
|
|
103
130
|
}
|
|
104
131
|
|
|
105
|
-
if (!selected.value) {
|
|
106
|
-
|
|
107
|
-
|
|
132
|
+
if (!selected.value || isPrefilled.value) {
|
|
133
|
+
setSelected(slotWithin(minTime.value, minTime.value, maxTime.value));
|
|
134
|
+
isPrefilled.value = true;
|
|
108
135
|
return;
|
|
109
136
|
}
|
|
110
137
|
|
|
111
|
-
if (
|
|
112
|
-
selected.value &&
|
|
113
|
-
!isTimeWithinBounds(selected.value, minTime.value, maxTime.value)
|
|
114
|
-
) {
|
|
138
|
+
if (!isTimeWithinBounds(selected.value, minTime.value, maxTime.value)) {
|
|
115
139
|
const clampedTime = clampTimeToInterval(
|
|
116
140
|
selected.value,
|
|
117
141
|
minTime.value,
|
|
118
142
|
maxTime.value,
|
|
119
143
|
now.value,
|
|
120
144
|
);
|
|
121
|
-
|
|
122
|
-
selected.value = clampedTime;
|
|
123
|
-
emit("update:modelValue", clampedTime);
|
|
124
|
-
}
|
|
145
|
+
setSelected(slotWithin(clampedTime, minTime.value, maxTime.value));
|
|
125
146
|
}
|
|
126
147
|
},
|
|
127
148
|
{ immediate: true },
|
|
@@ -129,6 +150,7 @@ watch(
|
|
|
129
150
|
|
|
130
151
|
function handleTimeInput(event: Event): void {
|
|
131
152
|
const value = (event.target as HTMLInputElement).value;
|
|
153
|
+
isPrefilled.value = false;
|
|
132
154
|
selected.value = value;
|
|
133
155
|
emit("update:modelValue", value || null);
|
|
134
156
|
}
|
|
@@ -147,7 +169,7 @@ function handleTimeInput(event: Event): void {
|
|
|
147
169
|
<strong class="block"
|
|
148
170
|
>Öffnungszeiten konnten nicht geladen werden</strong
|
|
149
171
|
>
|
|
150
|
-
Ohne Öffnungszeiten können wir keine
|
|
172
|
+
Ohne Öffnungszeiten können wir keine {{ wording.time }} anbieten.
|
|
151
173
|
</span>
|
|
152
174
|
<SbButton variant="secondary" @click="retryOpeningHours"
|
|
153
175
|
>Erneut versuchen</SbButton
|
|
@@ -164,7 +186,7 @@ function handleTimeInput(event: Event): void {
|
|
|
164
186
|
<SbField
|
|
165
187
|
id="delivery-time"
|
|
166
188
|
v-slot="{ id, describedBy, invalid }"
|
|
167
|
-
label="
|
|
189
|
+
:label="wording.wishedTime"
|
|
168
190
|
:hint="validationError ? undefined : helperText"
|
|
169
191
|
:error="validationError ?? undefined"
|
|
170
192
|
>
|
|
@@ -184,9 +206,8 @@ function handleTimeInput(event: Event): void {
|
|
|
184
206
|
/>
|
|
185
207
|
</ClientOnly>
|
|
186
208
|
</SbField>
|
|
187
|
-
<p class="text-sm text-sb-ink-muted">
|
|
188
|
-
|
|
189
|
-
länger dauern.
|
|
209
|
+
<p v-if="leadTime !== null" class="text-sm text-sb-ink-muted">
|
|
210
|
+
{{ wording.leadTimeHint(leadTime) }}
|
|
190
211
|
</p>
|
|
191
212
|
</template>
|
|
192
213
|
<p v-else class="text-sm text-sb-ink-muted" aria-busy="true">
|
|
@@ -9,6 +9,7 @@ const { refreshCart } = useCart();
|
|
|
9
9
|
const { isLoggedIn, isGuestSession, refreshUser } = useUser();
|
|
10
10
|
const { isCheckoutEnabled, refresh, checkCheckoutEnabled } =
|
|
11
11
|
useShopBiteConfig();
|
|
12
|
+
const { fulfillment } = useShippingLeadTime();
|
|
12
13
|
const { trackOrder } = useTrackEvent();
|
|
13
14
|
const { isLoading: isLoadingOpeningHours, hasFailed: hasOpeningHoursFailed } =
|
|
14
15
|
useOpeningHoursData();
|
|
@@ -121,7 +122,10 @@ async function handleCreateOrder() {
|
|
|
121
122
|
if (!(await hasAvailableCheckoutMethods())) return;
|
|
122
123
|
|
|
123
124
|
const order = await createOrder({
|
|
124
|
-
customerComment:
|
|
125
|
+
customerComment: wishedTimeComment(
|
|
126
|
+
fulfillment.value,
|
|
127
|
+
selectedDeliveryTime.value,
|
|
128
|
+
),
|
|
125
129
|
});
|
|
126
130
|
|
|
127
131
|
trackOrder(order);
|
|
@@ -5,8 +5,8 @@ import type { Schemas } from "#shopware";
|
|
|
5
5
|
* Menu sections of the presets on the home page (#444): a word list in the
|
|
6
6
|
* display font on the darker band, no dish counts. On desktop one photo
|
|
7
7
|
* follows the hovered or focused section (category media from Shopware);
|
|
8
|
-
* phones get the words stacked and no photo. Wide category banners (as
|
|
9
|
-
*
|
|
8
|
+
* phones get the words stacked and no photo. Wide category banners (as
|
|
9
|
+
* some shops use) do not fit the 4:5 column: then the photo spans the width
|
|
10
10
|
* below the words in the banner's own aspect ratio.
|
|
11
11
|
*/
|
|
12
12
|
withDefaults(
|
|
@@ -4,7 +4,7 @@ export type FeatureCardProps = {
|
|
|
4
4
|
title: string;
|
|
5
5
|
description: string;
|
|
6
6
|
icon?: string;
|
|
7
|
-
kind?: "hours" | "delivery" | "reservation";
|
|
7
|
+
kind?: "hours" | "delivery" | "pickup" | "reservation";
|
|
8
8
|
lead?: string;
|
|
9
9
|
link?: { label: string; to: string };
|
|
10
10
|
};
|
|
@@ -12,12 +12,13 @@ export type FeatureCardProps = {
|
|
|
12
12
|
/**
|
|
13
13
|
* Facts row under the hero of the presets (#444): the `features` of
|
|
14
14
|
* content/index.yml as four columns with a strong top rule. Today's hours
|
|
15
|
-
* and the delivery
|
|
15
|
+
* and the delivery and pickup times are live, like on the feature cards
|
|
16
|
+
* (#332, shopbite#6).
|
|
16
17
|
*/
|
|
17
18
|
const props = defineProps<{ features: FeatureCardProps[] }>();
|
|
18
19
|
|
|
19
20
|
const { businessHours } = useBusinessHours();
|
|
20
|
-
const { deliveryTime } = useShopBiteConfig();
|
|
21
|
+
const { deliveryTime, pickupTime } = useShopBiteConfig();
|
|
21
22
|
|
|
22
23
|
const items = computed(() =>
|
|
23
24
|
props.features.map((feature) => {
|
|
@@ -25,9 +26,13 @@ const items = computed(() =>
|
|
|
25
26
|
if (feature.kind === "hours" && businessHours.value) {
|
|
26
27
|
lead = formatTodayHours(businessHours.value, new Date());
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
+
// lead times of the delivery and pickup methods (shopbite#6)
|
|
30
|
+
if (feature.kind === "delivery" && deliveryTime.value !== null) {
|
|
29
31
|
lead = `In ca. ${deliveryTime.value} Minuten bei Ihnen`;
|
|
30
32
|
}
|
|
33
|
+
if (feature.kind === "pickup" && pickupTime.value !== null) {
|
|
34
|
+
lead = `Abholbereit in ca. ${pickupTime.value} Minuten`;
|
|
35
|
+
}
|
|
31
36
|
return { ...feature, lead };
|
|
32
37
|
}),
|
|
33
38
|
);
|
|
@@ -42,7 +42,8 @@ const rating = computed(() => {
|
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
const { status } = useStoreStatus();
|
|
45
|
-
|
|
45
|
+
// lead times of the delivery and pickup methods (shopbite#6)
|
|
46
|
+
const { deliveryTime, pickupTime } = useShopBiteConfig();
|
|
46
47
|
|
|
47
48
|
const statusLabel = computed(() => {
|
|
48
49
|
if (!status.value) return "";
|
|
@@ -120,7 +121,12 @@ const BLANK =
|
|
|
120
121
|
/>
|
|
121
122
|
{{ statusLabel }}
|
|
122
123
|
</span>
|
|
123
|
-
<span
|
|
124
|
+
<span v-if="deliveryTime !== null"
|
|
125
|
+
>Lieferung ca. {{ deliveryTime }} Min</span
|
|
126
|
+
>
|
|
127
|
+
<span v-if="pickupTime !== null"
|
|
128
|
+
>Abholung ca. {{ pickupTime }} Min</span
|
|
129
|
+
>
|
|
124
130
|
</p>
|
|
125
131
|
<template #fallback>
|
|
126
132
|
<span class="h-6" aria-hidden="true" />
|
|
@@ -6,7 +6,7 @@ import { useNavigation } from "~/composables/useNavigation";
|
|
|
6
6
|
* Menu categories as horizontally scrolling rows on phones and tablets
|
|
7
7
|
* (#445); the desktop menu has the word-list index (MenuCategoryIndex).
|
|
8
8
|
* The first row holds the menu sections. When the open section has
|
|
9
|
-
* sub-categories (
|
|
9
|
+
* sub-categories (e.g. Fleischgerichte → Vom Rind, Hähnchen …),
|
|
10
10
|
* a second row lists them, led by "Alle" for the section itself; deeper
|
|
11
11
|
* levels follow in the same row. The current chip scrolls into view.
|
|
12
12
|
*/
|
|
@@ -33,10 +33,9 @@ const shippingMethod = computed(() => {
|
|
|
33
33
|
const method = props.order.deliveries?.[0]?.shippingMethod;
|
|
34
34
|
return method?.translated?.name ?? method?.name;
|
|
35
35
|
});
|
|
36
|
-
// The checkout stores the chosen time as "Wunschlieferzeit: …"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
);
|
|
36
|
+
// The checkout stores the chosen time as "Wunschlieferzeit: …" or
|
|
37
|
+
// "Wunschabholzeit: …" (Summary.vue, wishedTimeComment).
|
|
38
|
+
const wishedTime = computed(() => parseWishedTime(props.order.customerComment));
|
|
40
39
|
|
|
41
40
|
// Restaurants sell gross prices; net orders (B2B) list the tax on top.
|
|
42
41
|
const taxLabel = computed(() =>
|
|
@@ -25,23 +25,15 @@ interface GeoapifyResponse {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export function useAddressAutocomplete() {
|
|
28
|
-
const { boundingBoxCoordinates } = useAddressSuggestionArea();
|
|
29
|
-
|
|
30
28
|
async function getSuggestions(text: string): Promise<AddressSuggestion[]> {
|
|
31
29
|
if (!text || text.length < 3) {
|
|
32
30
|
return [];
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
try {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
limit: 5,
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
if (boundingBoxCoordinates.value) {
|
|
43
|
-
query.filter = `rect:${boundingBoxCoordinates.value}`;
|
|
44
|
-
}
|
|
34
|
+
// The server route applies the configured area
|
|
35
|
+
// (`addressAutocomplete.boundingBox`) itself.
|
|
36
|
+
const query = { text, lang: "de", limit: 5 };
|
|
45
37
|
|
|
46
38
|
const { data } = await useFetch<GeoapifyResponse>(
|
|
47
39
|
"/api/address/autocomplete",
|
|
@@ -51,7 +51,7 @@ type MethodGuardConfig<M extends CheckoutMethod> = {
|
|
|
51
51
|
* A blocked shipping method is only reported, never switched: its rule
|
|
52
52
|
* usually needs the shipping address (delivery area), which a guest enters
|
|
53
53
|
* after choosing delivery or pickup. Switching turned every delivery into
|
|
54
|
-
* a pickup before the address was known (
|
|
54
|
+
* a pickup before the address was known (2.0.2). With an
|
|
55
55
|
* address the checkout says the method is not possible and the customer
|
|
56
56
|
* picks another one.
|
|
57
57
|
*/
|
|
@@ -10,7 +10,8 @@ function isTimeWithinBounds(
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export function useDeliveryTime(now: Ref<Date>) {
|
|
13
|
-
|
|
13
|
+
// lead time of the selected shipping method (shopbite#6)
|
|
14
|
+
const { leadTime, fulfillment } = useShippingLeadTime();
|
|
14
15
|
const {
|
|
15
16
|
getServiceIntervals,
|
|
16
17
|
getEarliestSelectableTime,
|
|
@@ -19,12 +20,14 @@ export function useDeliveryTime(now: Ref<Date>) {
|
|
|
19
20
|
} = useBusinessHours();
|
|
20
21
|
const { isClosedHoliday } = useHolidays();
|
|
21
22
|
|
|
23
|
+
const wording = computed(() => FULFILLMENT_WORDING[fulfillment.value]);
|
|
24
|
+
|
|
22
25
|
const earliest = computed<Date>(() =>
|
|
23
|
-
getEarliestSelectableTime(now.value,
|
|
26
|
+
getEarliestSelectableTime(now.value, leadTime.value),
|
|
24
27
|
);
|
|
25
28
|
|
|
26
29
|
const activeInterval = computed<ServiceInterval | null>(() =>
|
|
27
|
-
findActiveInterval(now.value,
|
|
30
|
+
findActiveInterval(now.value, leadTime.value),
|
|
28
31
|
);
|
|
29
32
|
|
|
30
33
|
const minTime = computed<string | null>(() => {
|
|
@@ -76,9 +79,9 @@ export function useDeliveryTime(now: Ref<Date>) {
|
|
|
76
79
|
const intervals = getServiceIntervals(now.value);
|
|
77
80
|
const lastInterval = intervals.at(-1);
|
|
78
81
|
if (lastInterval && earliest.value > lastInterval.end) {
|
|
79
|
-
return
|
|
82
|
+
return `Heute sind keine ${wording.value.times} mehr verfügbar.`;
|
|
80
83
|
}
|
|
81
|
-
return
|
|
84
|
+
return `Aktuell keine ${wording.value.time} verfügbar. Bitte später erneut versuchen.`;
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
const startStr = toTimeString(interval.start);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fulfillment (delivery or pickup) and lead time of the shipping method
|
|
3
|
+
* selected in the checkout (shopbite#6), from `shippingMethods` of the
|
|
4
|
+
* plugin configuration. Switching the method updates both. Before the
|
|
5
|
+
* configuration is loaded it is a delivery without a lead time.
|
|
6
|
+
*/
|
|
7
|
+
export function useShippingLeadTime() {
|
|
8
|
+
const { selectedShippingMethod } = useCheckout();
|
|
9
|
+
const { leadTimeFor } = useShopBiteConfig();
|
|
10
|
+
|
|
11
|
+
const current = computed(() => leadTimeFor(selectedShippingMethod.value));
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
fulfillment: computed(() => current.value.fulfillment),
|
|
15
|
+
leadTime: computed(() => current.value.minutes),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -6,8 +6,8 @@ import type { Schemas } from "#shopware";
|
|
|
6
6
|
*
|
|
7
7
|
* `useCheckout().getShippingMethods()` asks the Store API for the methods
|
|
8
8
|
* whose availability rule matches right now. A rule on the shipping
|
|
9
|
-
* address (
|
|
10
|
-
*
|
|
9
|
+
* address (e.g. "Valide Lieferung", city Musterstadt, Nebenort or
|
|
10
|
+
* Beispieldorf) never matches before the guest has entered an address, so
|
|
11
11
|
* "Lieferung" vanished from the choice. Whether the chosen method works
|
|
12
12
|
* for the address is checked in the cart (`shipping-method-blocked`).
|
|
13
13
|
*/
|
|
@@ -51,9 +51,18 @@ export function useShopBiteConfig() {
|
|
|
51
51
|
return data.value?.isCheckoutEnabled ?? false;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/** Fulfillment and lead time of a shipping method (shopbite#6). */
|
|
55
|
+
function leadTimeFor(method: { id?: string } | null | undefined): LeadTime {
|
|
56
|
+
return shippingLeadTime(data.value, method);
|
|
57
|
+
}
|
|
58
|
+
|
|
54
59
|
return {
|
|
55
60
|
checkCheckoutEnabled,
|
|
56
|
-
|
|
61
|
+
leadTimeFor,
|
|
62
|
+
/** Lead time of the delivery method, `null` without one. */
|
|
63
|
+
deliveryTime: computed(() => fulfillmentLeadTime(data.value, "delivery")),
|
|
64
|
+
/** Lead time of the pickup method, `null` without one. */
|
|
65
|
+
pickupTime: computed(() => fulfillmentLeadTime(data.value, "pickup")),
|
|
57
66
|
isCheckoutEnabled: computed(() => data.value?.isCheckoutEnabled ?? false),
|
|
58
67
|
refresh,
|
|
59
68
|
};
|
|
@@ -16,9 +16,10 @@ export function useTrackEvent() {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
// Page views are pushed by `plugins/matomo.ts` (initial page and every
|
|
19
|
-
// `page:finish`), not by the registry's page watcher.
|
|
19
|
+
// `page:finish`), not by the registry's page watcher. The URL keeps only
|
|
20
|
+
// harmless query parameters (`trackingUrl`): e-mail links carry secrets.
|
|
20
21
|
function trackPageView(path: string) {
|
|
21
|
-
push(["setCustomUrl", path]);
|
|
22
|
+
push(["setCustomUrl", trackingUrl(path)]);
|
|
22
23
|
push(["setDocumentTitle", document.title]);
|
|
23
24
|
push(["trackPageView"]);
|
|
24
25
|
}
|
|
@@ -75,7 +76,7 @@ export function useTrackEvent() {
|
|
|
75
76
|
productNumber: string,
|
|
76
77
|
path: string,
|
|
77
78
|
) {
|
|
78
|
-
push(["setCustomUrl", path]);
|
|
79
|
+
push(["setCustomUrl", trackingUrl(path)]);
|
|
79
80
|
push([
|
|
80
81
|
"trackEvent",
|
|
81
82
|
"Product",
|