@revenexx/cover 0.2.25 → 0.2.27
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/app/api/brands.ts +5 -0
- package/app/api/categories.ts +1 -0
- package/app/api/product.ts +2 -0
- package/app/app.config.ts +8 -0
- package/app/components/cart/quickadd/CartQuickAdd.vue +110 -34
- package/app/components/category/view/GridView.vue +34 -13
- package/app/components/category/view/ListView.vue +5 -5
- package/app/components/checkout/onepage/CheckoutDeliverySection.vue +29 -1
- package/app/components/checkout/onepage/CheckoutPaymentSection.vue +30 -1
- package/app/components/layout/AppLogo.vue +2 -1
- package/app/components/layout/footer/Footer.vue +9 -3
- package/app/components/layout/header/CategoryPanel.vue +92 -0
- package/app/components/layout/header/MainNav.vue +89 -2
- package/app/components/listing/ListingResults.vue +16 -2
- package/app/components/listing/ListingSubcategories.vue +124 -0
- package/app/components/product/card/Compact.vue +144 -0
- package/app/components/product/detail/ProductDetailAssociations.vue +96 -0
- package/app/components/product/detail/ProductDetailIdentity.vue +50 -5
- package/app/components/product/detail/ProductDetailVariantRow.vue +139 -0
- package/app/components/product/detail/ProductDetailVariants.vue +613 -0
- package/app/components/product/media/ProductMediaImage.vue +70 -0
- package/app/components/ui/forms/SearchInput.vue +14 -2
- package/app/components/ui/media/ImageSlider.vue +158 -0
- package/app/composables/useBranding.ts +22 -0
- package/app/composables/useBrands.ts +42 -0
- package/app/composables/useCategories.ts +55 -1
- package/app/composables/useProduct.ts +5 -4
- package/app/composables/useProductAssociations.ts +35 -0
- package/app/composables/useProductImage.ts +35 -2
- package/app/composables/useProductVariants.ts +46 -0
- package/app/composables/useSearchListing.ts +16 -5
- package/app/composables/useSubcategoryTiles.ts +36 -0
- package/app/config/navigation.ts +9 -0
- package/app/config/palette.ts +1 -0
- package/app/config/quickActions.ts +137 -0
- package/app/config/themes.ts +1 -0
- package/app/interfaces/brand.ts +16 -0
- package/app/interfaces/category.ts +45 -0
- package/app/interfaces/image-slider.ts +18 -0
- package/app/interfaces/product-associations.ts +32 -0
- package/app/interfaces/product-detail.ts +6 -0
- package/app/interfaces/product-variants.ts +73 -0
- package/i18n/locales/de/account.json +17 -0
- package/i18n/locales/de/cart.json +5 -1
- package/i18n/locales/de/checkout.json +2 -0
- package/i18n/locales/de/common.json +42 -2
- package/i18n/locales/de/editor.json +91 -0
- package/i18n/locales/de/product.json +48 -2
- package/i18n/locales/de/search.json +4 -2
- package/i18n/locales/en/account.json +17 -0
- package/i18n/locales/en/cart.json +4 -0
- package/i18n/locales/en/checkout.json +2 -0
- package/i18n/locales/en/common.json +42 -2
- package/i18n/locales/en/editor.json +91 -0
- package/i18n/locales/en/product.json +47 -1
- package/i18n/locales/en/search.json +3 -1
- package/nuxt.config.ts +10 -0
- package/package.json +3 -1
- package/public/img/brands/revenexx.svg +39 -0
- package/server/api/brands.get.ts +27 -0
- package/server/api/categories/[slug]/subcategories.get.ts +280 -0
- package/server/api/product/[id]/associations.get.ts +27 -0
- package/server/api/product/[id]/variants.get.ts +27 -0
- package/server/api/quick-actions.get.ts +43 -0
- package/server/api/typesense/search.post.ts +116 -13
- package/server/data/categories.json +5 -0
- package/server/data/product-associations.json +44 -0
- package/server/data/product-detail.json +346 -0
- package/server/data/product-list.json +340 -0
- package/server/data/product-variant-models.json +75 -0
- package/server/interfaces/brand.ts +17 -0
- package/server/interfaces/product.ts +14 -0
- package/server/services/ApiBrandService.ts +110 -0
- package/server/services/ApiProductService.ts +43 -9
- package/server/services/LocalFileProductService.ts +200 -6
- package/server/services/MockBrandService.ts +52 -0
- package/server/utils/brandService.ts +24 -0
- package/server/utils/contentTenant.ts +67 -0
- package/server/utils/liveCatalog.ts +744 -46
- package/server/utils/productService.ts +6 -1
- package/server/utils/productsSchema.ts +5 -2
- package/server/utils/revenexxCredentials.ts +258 -0
- package/server/utils/revenexxSdk.ts +38 -47
package/app/api/categories.ts
CHANGED
package/app/api/product.ts
CHANGED
package/app/app.config.ts
CHANGED
|
@@ -18,6 +18,7 @@ export default defineAppConfig({
|
|
|
18
18
|
authService: "mock",
|
|
19
19
|
productService: "mock",
|
|
20
20
|
categoryService: "mock",
|
|
21
|
+
brandService: "mock",
|
|
21
22
|
marketService: "mock",
|
|
22
23
|
cartService: "mock",
|
|
23
24
|
paymentService: "mock",
|
|
@@ -27,6 +28,13 @@ export default defineAppConfig({
|
|
|
27
28
|
inventoryService: "mock",
|
|
28
29
|
orderListService: "mock",
|
|
29
30
|
themeService: "mock",
|
|
31
|
+
// Where a live catalogue keeps a manufacturer's logo. This is a per-tenant
|
|
32
|
+
// PIM attribute on the product document, not a platform contract, so a
|
|
33
|
+
// storefront whose catalogue names it differently overrides the code here.
|
|
34
|
+
// A tenant that has no such attribute renders wordmark tiles instead.
|
|
35
|
+
brands: {
|
|
36
|
+
logoAttribute: "manufacturer_logo",
|
|
37
|
+
},
|
|
30
38
|
// Search UX defaults the layer's components read — apps may override,
|
|
31
39
|
// but the layer must ship working values (a missing `search` object
|
|
32
40
|
// crashed SearchInput with "Cannot read … 'autocompleteMinChars'").
|
|
@@ -1,42 +1,98 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { useDebounceFn } from "@vueuse/core";
|
|
3
|
+
|
|
4
|
+
import { searchApi } from "../../../api/search";
|
|
5
|
+
import type { ListingResponse } from "../../../composables/useProductListing";
|
|
3
6
|
import { getBaseUnitPrice, getPriceTiers, type Product } from "../../../composables/useProducts";
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
* Cart quick entry (spec: Warenkorb-Schnellerfassung): add positions by
|
|
7
|
-
* article number with quantity, embedded on the empty cart
|
|
8
|
-
*
|
|
10
|
+
* article number with quantity, embedded on the empty cart, available as a
|
|
11
|
+
* modal on the filled cart and as the `quick_order` content block.
|
|
12
|
+
*
|
|
13
|
+
* Matching runs server-side through the Typesense listing endpoint
|
|
14
|
+
* (`query_by: "name,sku"`), so an article number resolves against the whole
|
|
15
|
+
* catalog. Filtering the `/api/products` list client-side would have capped
|
|
16
|
+
* the lookup at that endpoint's page size — 48 articles in live mode.
|
|
9
17
|
*/
|
|
10
18
|
const { icon } = useIcons();
|
|
11
|
-
const { t } = useI18n();
|
|
19
|
+
const { locale, t } = useI18n();
|
|
12
20
|
const toast = useToast();
|
|
13
21
|
const cart = useCartStore();
|
|
14
|
-
|
|
22
|
+
// The layer ships a `search` default, but a consumer that overrides
|
|
23
|
+
// app.config without it must not break quick entry — fall back locally.
|
|
24
|
+
const appConfig = useAppConfig();
|
|
25
|
+
|
|
26
|
+
/** Enough lines to disambiguate a name, few enough to stay a dropdown. */
|
|
27
|
+
const MAX_MATCHES = 6;
|
|
28
|
+
|
|
29
|
+
const offers = useOffers();
|
|
15
30
|
|
|
16
31
|
const sku = ref("");
|
|
17
32
|
const quantity = ref("1");
|
|
18
33
|
const adding = ref(false);
|
|
34
|
+
const searching = ref(false);
|
|
35
|
+
const rawMatches = ref<Product[]>([]);
|
|
19
36
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
37
|
+
const minChars = computed(() => appConfig.search?.autocompleteMinChars ?? 2);
|
|
38
|
+
|
|
39
|
+
// Offers (price + availability) hydrate only for the few shown matches. By the
|
|
40
|
+
// time a list reaches `rawMatches` its offers are already cached, so this reads
|
|
41
|
+
// them straight out rather than kicking off the load itself.
|
|
42
|
+
const matches = offers.withOffers(() => rawMatches.value);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A row is orderable only once its offer says so. Price and availability are
|
|
46
|
+
* the Offer domain, so a row whose offer carries no price is "on request" and
|
|
47
|
+
* cannot be added — the row has to say that rather than swallow the click.
|
|
48
|
+
*/
|
|
49
|
+
const rows = computed(() => matches.value.map(product => ({
|
|
50
|
+
product,
|
|
51
|
+
hasPrice: getBaseUnitPrice(product.prices) !== null,
|
|
52
|
+
isOutOfStock: product.isOutOfStock ?? false,
|
|
53
|
+
})));
|
|
54
|
+
|
|
55
|
+
const orderableRows = computed(() => rows.value.filter(row => row.hasPrice && !row.isOutOfStock));
|
|
27
56
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
57
|
+
async function fetchMatches(q: string): Promise<void> {
|
|
58
|
+
searching.value = true;
|
|
59
|
+
try {
|
|
60
|
+
const data = await $fetch<ListingResponse | null>(searchApi.search(), {
|
|
61
|
+
method: "POST",
|
|
62
|
+
// The search route filters the index by locale; without this header it
|
|
63
|
+
// would use the browser's Accept-Language instead of the selected one.
|
|
64
|
+
headers: { "x-locale": locale.value },
|
|
65
|
+
body: { q, page: 1, perPage: MAX_MATCHES },
|
|
66
|
+
}).catch(() => null);
|
|
67
|
+
// A response that lost the race against newer typing must not win.
|
|
68
|
+
if (q !== sku.value.trim()) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const products = data?.products ?? [];
|
|
72
|
+
// Fill the offer cache BEFORE the rows appear. `withOffers` would load
|
|
73
|
+
// them in a watcher, leaving every row priceless — and so silently
|
|
74
|
+
// unaddable — for as long as POST /api/offers takes.
|
|
75
|
+
await offers.loadOffers(products);
|
|
76
|
+
if (q !== sku.value.trim()) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
rawMatches.value = products;
|
|
32
80
|
}
|
|
33
|
-
|
|
34
|
-
.
|
|
35
|
-
|
|
36
|
-
}
|
|
81
|
+
finally {
|
|
82
|
+
searching.value = false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
37
85
|
|
|
38
|
-
|
|
39
|
-
|
|
86
|
+
const debouncedFetch = useDebounceFn(fetchMatches, 250);
|
|
87
|
+
|
|
88
|
+
watch(sku, (val) => {
|
|
89
|
+
const q = val.trim();
|
|
90
|
+
if (q.length < minChars.value) {
|
|
91
|
+
rawMatches.value = [];
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
void debouncedFetch(q);
|
|
95
|
+
});
|
|
40
96
|
|
|
41
97
|
function buildTiers(prices: { [key: string]: number }[]) {
|
|
42
98
|
return getPriceTiers(prices).map(tier => ({
|
|
@@ -48,6 +104,8 @@ function buildTiers(prices: { [key: string]: number }[]) {
|
|
|
48
104
|
function addProduct(product: Product): void {
|
|
49
105
|
const qty = Math.max(1, parseInt(quantity.value, 10) || 1);
|
|
50
106
|
const price = getBaseUnitPrice(product.prices);
|
|
107
|
+
// Belt and braces: the rows and the submit button already exclude anything
|
|
108
|
+
// without a price, so reaching this is a bug rather than a user action.
|
|
51
109
|
if (price === null) {
|
|
52
110
|
return;
|
|
53
111
|
}
|
|
@@ -78,16 +136,20 @@ function addProduct(product: Product): void {
|
|
|
78
136
|
icon: icon("success"),
|
|
79
137
|
duration: 1500,
|
|
80
138
|
});
|
|
139
|
+
// Clearing the query also empties the match list through the watcher.
|
|
81
140
|
sku.value = "";
|
|
82
141
|
quantity.value = "1";
|
|
83
142
|
adding.value = false;
|
|
84
143
|
}
|
|
85
144
|
|
|
86
145
|
function onSubmit(): void {
|
|
87
|
-
const
|
|
88
|
-
|
|
146
|
+
const query = sku.value.trim().toLowerCase();
|
|
147
|
+
// An exact article number wins — but only if it can actually be ordered;
|
|
148
|
+
// otherwise fall through to the best row that can.
|
|
149
|
+
const exact = orderableRows.value.find(row => row.product.sku.toLowerCase() === query);
|
|
150
|
+
const target = exact ?? orderableRows.value[0];
|
|
89
151
|
if (target) {
|
|
90
|
-
addProduct(target);
|
|
152
|
+
addProduct(target.product);
|
|
91
153
|
}
|
|
92
154
|
}
|
|
93
155
|
</script>
|
|
@@ -118,29 +180,43 @@ function onSubmit(): void {
|
|
|
118
180
|
<UButton
|
|
119
181
|
color="primary"
|
|
120
182
|
tabindex="0"
|
|
121
|
-
:loading="adding"
|
|
122
|
-
:disabled="
|
|
183
|
+
:loading="adding || searching"
|
|
184
|
+
:disabled="orderableRows.length === 0"
|
|
123
185
|
:label="t('cart.quickAdd.add')"
|
|
124
186
|
@click="onSubmit"
|
|
125
187
|
/>
|
|
126
188
|
</div>
|
|
127
189
|
<ul
|
|
128
|
-
v-if="
|
|
190
|
+
v-if="rows.length"
|
|
129
191
|
class="border border-(--ui-border) rounded-lg divide-y divide-(--ui-border) overflow-hidden"
|
|
130
192
|
>
|
|
131
193
|
<li
|
|
132
|
-
v-for="
|
|
133
|
-
:key="product.id"
|
|
194
|
+
v-for="row in rows"
|
|
195
|
+
:key="row.product.id"
|
|
134
196
|
>
|
|
135
197
|
<button
|
|
136
198
|
type="button"
|
|
137
199
|
tabindex="0"
|
|
200
|
+
:disabled="!row.hasPrice || row.isOutOfStock"
|
|
138
201
|
class="w-full flex items-center justify-between gap-3 px-3 py-2 text-left
|
|
139
|
-
hover:bg-elevated
|
|
140
|
-
|
|
202
|
+
transition-colors enabled:hover:bg-elevated enabled:cursor-pointer
|
|
203
|
+
disabled:cursor-not-allowed disabled:opacity-60"
|
|
204
|
+
@click="addProduct(row.product)"
|
|
141
205
|
>
|
|
142
|
-
<span class="text-sm text-highlighted truncate">{{ product.name }}</span>
|
|
143
|
-
<span class="text-xs text-muted shrink-0">
|
|
206
|
+
<span class="text-sm text-highlighted truncate">{{ row.product.name }}</span>
|
|
207
|
+
<span class="text-xs text-muted shrink-0 text-right">
|
|
208
|
+
{{ row.product.sku }}
|
|
209
|
+
<!-- Why the row can't be ordered — without this the click
|
|
210
|
+
would simply do nothing and look broken. -->
|
|
211
|
+
<span
|
|
212
|
+
v-if="row.isOutOfStock"
|
|
213
|
+
class="block"
|
|
214
|
+
>{{ t("product.stock.unavailable") }}</span>
|
|
215
|
+
<span
|
|
216
|
+
v-else-if="!row.hasPrice"
|
|
217
|
+
class="block"
|
|
218
|
+
>{{ t("product.price.onRequest") }}</span>
|
|
219
|
+
</span>
|
|
144
220
|
</button>
|
|
145
221
|
</li>
|
|
146
222
|
</ul>
|
|
@@ -1,13 +1,35 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { ProductList } from "../../../interfaces/product-list";
|
|
3
3
|
|
|
4
|
-
const props = defineProps<{
|
|
4
|
+
const props = withDefaults(defineProps<{
|
|
5
5
|
product: ProductList;
|
|
6
|
-
|
|
6
|
+
/** Cart icon on the order button. */
|
|
7
|
+
showOrderIcon?: boolean;
|
|
8
|
+
/** Look of the order button when the product can't be bought. */
|
|
9
|
+
disabledOrderStyle?: "default" | "muted";
|
|
10
|
+
}>(), {
|
|
11
|
+
showOrderIcon: true,
|
|
12
|
+
disabledOrderStyle: "default",
|
|
13
|
+
});
|
|
7
14
|
|
|
8
15
|
const { t } = useI18n();
|
|
9
|
-
const {
|
|
16
|
+
const { icon } = useIcons();
|
|
17
|
+
const { url } = useProductCard(() => props.product);
|
|
10
18
|
const { isOutOfStock, hasPrice, addToCart } = useProductCardActions(() => props.product);
|
|
19
|
+
|
|
20
|
+
const orderDisabled = computed(() => isOutOfStock.value || !hasPrice.value);
|
|
21
|
+
|
|
22
|
+
// Trailing `!` — Tailwind 4's important modifier. Needed because these have to
|
|
23
|
+
// beat UButton's own solid-neutral colours, and `disabled:opacity-100!` cancels
|
|
24
|
+
// its dimming so the muted variant reads as a solid grey button.
|
|
25
|
+
const orderButtonClass = computed(() => {
|
|
26
|
+
if (!orderDisabled.value) {
|
|
27
|
+
return "cursor-pointer";
|
|
28
|
+
}
|
|
29
|
+
return props.disabledOrderStyle === "muted"
|
|
30
|
+
? "bg-elevated! text-dimmed! hover:bg-elevated! disabled:opacity-100! cursor-not-allowed"
|
|
31
|
+
: "cursor-not-allowed";
|
|
32
|
+
});
|
|
11
33
|
</script>
|
|
12
34
|
|
|
13
35
|
<template>
|
|
@@ -24,11 +46,11 @@ const { isOutOfStock, hasPrice, addToCart } = useProductCardActions(() => props.
|
|
|
24
46
|
focus-visible:ring-(--ui-primary)"
|
|
25
47
|
>
|
|
26
48
|
<div class="h-50 flex items-center justify-center">
|
|
27
|
-
<
|
|
28
|
-
:src="
|
|
49
|
+
<ProductMediaImage
|
|
50
|
+
:src="product.image"
|
|
29
51
|
:alt="product.name"
|
|
30
|
-
class="
|
|
31
|
-
|
|
52
|
+
icon-class="size-10 text-muted"
|
|
53
|
+
/>
|
|
32
54
|
</div>
|
|
33
55
|
</NuxtLink>
|
|
34
56
|
</template>
|
|
@@ -58,13 +80,12 @@ const { isOutOfStock, hasPrice, addToCart } = useProductCardActions(() => props.
|
|
|
58
80
|
/>
|
|
59
81
|
<UButton
|
|
60
82
|
:label="t('product.actions.order')"
|
|
83
|
+
:icon="showOrderIcon ? icon('cart') : undefined"
|
|
61
84
|
variant="solid"
|
|
62
|
-
:color="
|
|
63
|
-
:disabled="
|
|
64
|
-
:class="
|
|
65
|
-
|
|
66
|
-
: ''"
|
|
67
|
-
class="flex-1 justify-center cursor-pointer focus-visible:outline-none
|
|
85
|
+
:color="orderDisabled ? 'neutral' : 'primary'"
|
|
86
|
+
:disabled="orderDisabled"
|
|
87
|
+
:class="orderButtonClass"
|
|
88
|
+
class="flex-1 justify-center focus-visible:outline-none
|
|
68
89
|
focus-visible:ring-2 focus-visible:ring-(--ui-primary)"
|
|
69
90
|
tabindex="0"
|
|
70
91
|
@click="addToCart"
|
|
@@ -6,7 +6,7 @@ const props = defineProps<{
|
|
|
6
6
|
}>();
|
|
7
7
|
|
|
8
8
|
const { t } = useI18n();
|
|
9
|
-
const { url
|
|
9
|
+
const { url } = useProductCard(() => props.product);
|
|
10
10
|
const { isOutOfStock, hasPrice, addToCart } = useProductCardActions(() => props.product);
|
|
11
11
|
</script>
|
|
12
12
|
|
|
@@ -24,11 +24,11 @@ const { isOutOfStock, hasPrice, addToCart } = useProductCardActions(() => props.
|
|
|
24
24
|
focus-visible:ring-(--ui-primary) rounded"
|
|
25
25
|
>
|
|
26
26
|
<div class="w-15 h-15 sm:w-15 sm:h-15 flex items-center justify-center">
|
|
27
|
-
<
|
|
28
|
-
:src="
|
|
27
|
+
<ProductMediaImage
|
|
28
|
+
:src="product.image"
|
|
29
29
|
:alt="product.name"
|
|
30
|
-
class="
|
|
31
|
-
|
|
30
|
+
icon-class="size-6 text-muted"
|
|
31
|
+
/>
|
|
32
32
|
</div>
|
|
33
33
|
</NuxtLink>
|
|
34
34
|
<div class="flex-1 min-w-0 flex flex-col gap-1">
|
|
@@ -31,6 +31,13 @@ const { data: rates } = useFetch<{
|
|
|
31
31
|
methods: DeliveryOption[];
|
|
32
32
|
defaultMethod: string | null;
|
|
33
33
|
}>("/api/shipping/rates", {
|
|
34
|
+
// STABLE KEY, deliberately. Without one Nuxt derives it from the request —
|
|
35
|
+
// body included — and the body carries the cart total, which is 0 while the
|
|
36
|
+
// server renders and the real sum once the store has hydrated. Two different
|
|
37
|
+
// keys, so the client looked up a payload entry that did not exist, found
|
|
38
|
+
// nothing, and never refetched either: on a hard page load the section fell
|
|
39
|
+
// back to the demo profile and offered methods this merchant does not have.
|
|
40
|
+
key: "checkout-shipping-rates",
|
|
34
41
|
method: "POST",
|
|
35
42
|
body: computed(() => ({
|
|
36
43
|
amount: cartStore.subtotal,
|
|
@@ -40,8 +47,19 @@ const { data: rates } = useFetch<{
|
|
|
40
47
|
default: () => null,
|
|
41
48
|
});
|
|
42
49
|
|
|
50
|
+
/**
|
|
51
|
+
* The demo profile is a MOCK-MODE fallback and must never surface on a live
|
|
52
|
+
* storefront. When the live list is missing — the request failed, or it raced
|
|
53
|
+
* a cart that was still syncing on a hard page load — falling through to it
|
|
54
|
+
* offered methods this merchant does not have: "Express 9,90 €" on a shop that
|
|
55
|
+
* ships by quote, "Bestellschein" and "Kostenstelle" on a tenant that only
|
|
56
|
+
* knows invoice and its PSP. An empty list is honest; sample data is not.
|
|
57
|
+
*/
|
|
58
|
+
const liveShipping = computed(() => appConfig.shippingService === "api");
|
|
43
59
|
const deliveryOptions = computed<DeliveryOption[]>(() =>
|
|
44
|
-
rates.value?.methods
|
|
60
|
+
rates.value?.methods
|
|
61
|
+
?? (liveShipping.value ? [] : profile.value?.availableDeliveryMethods)
|
|
62
|
+
?? []);
|
|
45
63
|
|
|
46
64
|
// A method that became unavailable (country switch, free-above flip)
|
|
47
65
|
// resets the selection to the first available one.
|
|
@@ -124,6 +142,16 @@ watch(deliveryOptions, (options) => {
|
|
|
124
142
|
</p>
|
|
125
143
|
</button>
|
|
126
144
|
</div>
|
|
145
|
+
|
|
146
|
+
<!-- Nothing to choose from. Says so rather than leaving a blank box:
|
|
147
|
+
a live storefront no longer falls back to the demo profile, so an empty
|
|
148
|
+
list means the list could not be loaded. -->
|
|
149
|
+
<p
|
|
150
|
+
v-if="!profileLoading && !deliveryOptions.length"
|
|
151
|
+
class="text-sm text-muted"
|
|
152
|
+
>
|
|
153
|
+
{{ t('onepage.delivery.noneAvailable') }}
|
|
154
|
+
</p>
|
|
127
155
|
</fieldset>
|
|
128
156
|
|
|
129
157
|
<!-- Requested date + delivery note side by side -->
|
|
@@ -21,6 +21,13 @@ const { data: eligible } = useFetch<{
|
|
|
21
21
|
methods: PaymentOption[];
|
|
22
22
|
defaultMethod: string | null;
|
|
23
23
|
}>("/api/payment/methods", {
|
|
24
|
+
// STABLE KEY, deliberately. Without one Nuxt derives it from the request —
|
|
25
|
+
// body included — and the body carries the cart total, which is 0 while the
|
|
26
|
+
// server renders and the real sum once the store has hydrated. Two different
|
|
27
|
+
// keys, so the client looked up a payload entry that did not exist, found
|
|
28
|
+
// nothing, and never refetched either: on a hard page load the section fell
|
|
29
|
+
// back to the demo profile and offered methods this merchant does not have.
|
|
30
|
+
key: "checkout-payment-methods",
|
|
24
31
|
method: "POST",
|
|
25
32
|
body: computed(() => ({
|
|
26
33
|
amount: cartStore.total,
|
|
@@ -30,8 +37,20 @@ const { data: eligible } = useFetch<{
|
|
|
30
37
|
default: () => null,
|
|
31
38
|
});
|
|
32
39
|
|
|
40
|
+
/**
|
|
41
|
+
* The demo profile is a MOCK-MODE fallback and must never surface on a live
|
|
42
|
+
* storefront. When the live list is missing — the request failed, or it raced
|
|
43
|
+
* a cart that was still syncing on a hard page load — falling through to it
|
|
44
|
+
* offered methods this merchant does not have: "Express 9,90 €" on a shop that
|
|
45
|
+
* ships by quote, "Bestellschein" and "Kostenstelle" on a tenant that only
|
|
46
|
+
* knows invoice and its PSP. An empty list is honest; sample data is not.
|
|
47
|
+
*/
|
|
48
|
+
const appConfig = useAppConfig();
|
|
49
|
+
const livePayments = computed(() => appConfig.paymentService === "api");
|
|
33
50
|
const paymentOptions = computed<PaymentOption[]>(() =>
|
|
34
|
-
eligible.value?.methods
|
|
51
|
+
eligible.value?.methods
|
|
52
|
+
?? (livePayments.value ? [] : profile.value?.availablePaymentMethods)
|
|
53
|
+
?? []);
|
|
35
54
|
|
|
36
55
|
// A method that became ineligible (country switch, order value) resets
|
|
37
56
|
// the selection to the first available one.
|
|
@@ -179,6 +198,16 @@ if (import.meta.client) {
|
|
|
179
198
|
>
|
|
180
199
|
{{ fieldErrors.paymentMethod }}
|
|
181
200
|
</p>
|
|
201
|
+
|
|
202
|
+
<!-- Nothing to choose from. Says so rather than leaving a blank box:
|
|
203
|
+
a live storefront no longer falls back to the demo profile, so an empty
|
|
204
|
+
list means the list could not be loaded. -->
|
|
205
|
+
<p
|
|
206
|
+
v-if="!profileLoading && !paymentOptions.length"
|
|
207
|
+
class="text-sm text-muted"
|
|
208
|
+
>
|
|
209
|
+
{{ t('onepage.payment.noneAvailable') }}
|
|
210
|
+
</p>
|
|
182
211
|
</fieldset>
|
|
183
212
|
|
|
184
213
|
<!-- Method-specific fields -->
|
|
@@ -4,6 +4,12 @@ import { footerLinks as defaultFooterLinks, legalLinks as defaultLegalLinks, sho
|
|
|
4
4
|
// Consumers replace the footer columns / legal links, in priority order:
|
|
5
5
|
// per-request live menus (useState, e.g. the Blokkli theme from the pages app)
|
|
6
6
|
// → app.config override → the layer defaults (demo's full sitemap).
|
|
7
|
+
//
|
|
8
|
+
// Headings and labels are rendered through t(), matching the header
|
|
9
|
+
// (MainNav/TopBar). That is what lets a tenant supply i18n keys and have its
|
|
10
|
+
// footer follow the language switcher; vue-i18n echoes anything that is not a
|
|
11
|
+
// key, so a plain string — the layer's own defaults included — renders as
|
|
12
|
+
// written.
|
|
7
13
|
const appConfig = useAppConfig();
|
|
8
14
|
const liveFooterLinks = useState<{ heading: string; links: { label: string; to: string }[] }[] | null>("cover:nav:footerLinks", () => null);
|
|
9
15
|
const liveLegalLinks = useState<{ label: string; to: string }[] | null>("cover:nav:legalLinks", () => null);
|
|
@@ -70,7 +76,7 @@ const year = new Date().getFullYear();
|
|
|
70
76
|
class="text-xs font-semibold uppercase tracking-wider
|
|
71
77
|
text-dimmed dark:text-white/70 mb-4"
|
|
72
78
|
>
|
|
73
|
-
{{ group.heading }}
|
|
79
|
+
{{ t(group.heading) }}
|
|
74
80
|
</h3>
|
|
75
81
|
<ul
|
|
76
82
|
role="list"
|
|
@@ -86,7 +92,7 @@ const year = new Date().getFullYear();
|
|
|
86
92
|
class="text-sm text-muted dark:text-white/90
|
|
87
93
|
hover:text-default dark:hover:text-white transition-colors"
|
|
88
94
|
>
|
|
89
|
-
{{ link.label }}
|
|
95
|
+
{{ t(link.label) }}
|
|
90
96
|
</NuxtLink>
|
|
91
97
|
</li>
|
|
92
98
|
</ul>
|
|
@@ -123,7 +129,7 @@ const year = new Date().getFullYear();
|
|
|
123
129
|
class="text-xs text-dimmed dark:text-white/70
|
|
124
130
|
hover:text-default dark:hover:text-white transition-colors"
|
|
125
131
|
>
|
|
126
|
-
{{ link.label }}
|
|
132
|
+
{{ t(link.label) }}
|
|
127
133
|
</NuxtLink>
|
|
128
134
|
</nav>
|
|
129
135
|
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The catalog panel behind a main-nav item that carries `panel: "categories"`.
|
|
4
|
+
*
|
|
5
|
+
* The panel body only — MainNav owns the positioned, animated wrapper and the
|
|
6
|
+
* pointer handling, so this stays renderable on its own. The tree comes from
|
|
7
|
+
* useCategories(), which AppBar and MobileMenu already fetch, so this shares
|
|
8
|
+
* their useFetch key rather than issuing a second request.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** Where "browse the whole assortment" goes — the tenant's catalog landing page. */
|
|
12
|
+
const CATALOG_ROUTE = "/search?q=*";
|
|
13
|
+
|
|
14
|
+
const { categories, categoryPanelColumns } = useCategories();
|
|
15
|
+
const { t } = useI18n();
|
|
16
|
+
const localePath = useLocalePath();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<div class="px-4 sm:px-6 lg:px-8 max-w-(--ui-container) mx-auto w-full py-8">
|
|
21
|
+
<p
|
|
22
|
+
v-if="!categories.length"
|
|
23
|
+
class="text-sm text-muted"
|
|
24
|
+
>
|
|
25
|
+
{{ t("nav.catalog.loading") }}
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
<div
|
|
29
|
+
v-else
|
|
30
|
+
class="grid grid-cols-2 lg:grid-cols-4 gap-x-8 gap-y-8"
|
|
31
|
+
>
|
|
32
|
+
<div
|
|
33
|
+
v-for="(column, index) in categoryPanelColumns"
|
|
34
|
+
:key="index"
|
|
35
|
+
class="space-y-6"
|
|
36
|
+
>
|
|
37
|
+
<div
|
|
38
|
+
v-for="group in column"
|
|
39
|
+
:key="group.to"
|
|
40
|
+
>
|
|
41
|
+
<NuxtLink
|
|
42
|
+
:to="group.to"
|
|
43
|
+
class="block text-sm font-semibold text-highlighted hover:text-primary leading-snug"
|
|
44
|
+
>
|
|
45
|
+
{{ group.label }}
|
|
46
|
+
</NuxtLink>
|
|
47
|
+
|
|
48
|
+
<ul
|
|
49
|
+
v-if="group.links.length"
|
|
50
|
+
role="list"
|
|
51
|
+
class="mt-2 space-y-1"
|
|
52
|
+
>
|
|
53
|
+
<li
|
|
54
|
+
v-for="link in group.links"
|
|
55
|
+
:key="link.to"
|
|
56
|
+
>
|
|
57
|
+
<NuxtLink
|
|
58
|
+
:to="link.to"
|
|
59
|
+
class="block text-sm text-muted hover:text-primary leading-snug"
|
|
60
|
+
>
|
|
61
|
+
{{ link.label }}
|
|
62
|
+
</NuxtLink>
|
|
63
|
+
</li>
|
|
64
|
+
<li v-if="group.totalSubcategoryCount > group.links.length">
|
|
65
|
+
<NuxtLink
|
|
66
|
+
:to="group.to"
|
|
67
|
+
class="block text-sm text-primary hover:underline"
|
|
68
|
+
>
|
|
69
|
+
{{ t("nav.catalog.showAllGroups", { count: group.totalSubcategoryCount }) }}
|
|
70
|
+
</NuxtLink>
|
|
71
|
+
</li>
|
|
72
|
+
</ul>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<div
|
|
78
|
+
v-if="categories.length"
|
|
79
|
+
class="mt-8 pt-6 border-t border-(--ui-border) flex items-center justify-between"
|
|
80
|
+
>
|
|
81
|
+
<NuxtLink
|
|
82
|
+
:to="localePath(CATALOG_ROUTE)"
|
|
83
|
+
class="text-sm font-medium text-primary hover:underline"
|
|
84
|
+
>
|
|
85
|
+
{{ t("nav.catalog.browseAll") }}
|
|
86
|
+
</NuxtLink>
|
|
87
|
+
<span class="text-xs text-muted">
|
|
88
|
+
{{ t("nav.catalog.groupCount", { count: categories.length }) }}
|
|
89
|
+
</span>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
</template>
|