@revenexx/cover 0.21.2 → 0.22.1
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/categories.ts +1 -0
- package/app/api/offers.ts +1 -0
- package/app/app.config.ts +18 -0
- package/app/components/OgImage/CoverPage.takumi.vue +37 -0
- package/app/components/RevenexxForm.vue +21 -6
- package/app/components/account/approvals/AccountPendingApprovals.vue +19 -1
- package/app/components/account/approvals/AccountPendingOrderDetail.vue +3 -0
- package/app/components/account/carts/AccountCartsTable.vue +11 -1
- package/app/components/account/orderlists/AccountOrderListDetail.vue +32 -3
- package/app/components/account/organization/AccountOrganization.vue +1 -1
- package/app/components/auth/AuthForgotPasswordPanel.vue +7 -2
- package/app/components/auth/AuthLoginPanel.vue +23 -8
- package/app/components/auth/AuthRegisterTeaser.vue +1 -1
- package/app/components/cart/position/CartPosition.vue +11 -4
- package/app/components/cart/quickadd/CartQuickAdd.vue +4 -2
- package/app/components/cart/recommend/CartRecommendCard.vue +1 -0
- package/app/components/cart/switcher/CartSwitcher.vue +1 -0
- package/app/components/cart/view/CartListHeader.vue +5 -0
- package/app/components/cart/view/CartSummaryPanel.vue +7 -2
- package/app/components/cart/view/CartView.vue +4 -2
- package/app/components/checkout/onepage/CheckoutDeliverySection.vue +3 -0
- package/app/components/checkout/onepage/CheckoutGate.vue +4 -2
- package/app/components/checkout/onepage/CheckoutGuestDetailsSection.vue +2 -1
- package/app/components/checkout/onepage/CheckoutPaymentSection.vue +1 -1
- package/app/components/layout/header/LocaleSwitcher.vue +7 -9
- package/app/components/product/detail/ProductDetailAddToCart.vue +17 -11
- package/app/components/product/detail/ProductDetailImageGallery.vue +101 -8
- package/app/components/product/detail/ProductDetailVariantRow.vue +84 -4
- package/app/components/product/detail/ProductDetailVariants.vue +75 -11
- package/app/components/product/detail/ProductDetailView.vue +64 -69
- package/app/components/ui/forms/FormKitDatePicker.vue +8 -2
- package/app/composables/useAuthStore.ts +21 -4
- package/app/composables/useCategories.ts +24 -0
- package/app/composables/useCategoryAnswer.ts +30 -0
- package/app/composables/useCategorySeo.ts +62 -0
- package/app/composables/useCheckoutOnePage.ts +15 -4
- package/app/composables/useDefaultUiLanguage.ts +14 -0
- package/app/composables/useOgImageReady.ts +16 -0
- package/app/composables/useProductAnswer.ts +121 -0
- package/app/composables/useProductLocales.ts +21 -10
- package/app/composables/useProductSeo.ts +145 -0
- package/app/composables/useRouteSubject.ts +23 -3
- package/app/composables/useSeoContext.ts +164 -0
- package/app/composables/useSeoHead.ts +189 -0
- package/app/composables/useSeoRules.ts +23 -0
- package/app/formkit.config.ts +1 -1
- package/app/interfaces/seo.ts +48 -0
- package/app/layouts/default.vue +2 -8
- package/app/layouts/focus.vue +3 -1
- package/app/payments/psp/novalnet.ts +25 -3
- package/app/payments/psp/novalnetStyle.ts +186 -0
- package/app/shared/categoryTree.ts +7 -0
- package/app/shared/locale.ts +8 -0
- package/app/shared/productLocales.ts +62 -1
- package/app/shared/requestedDate.ts +49 -0
- package/app/shared/seoRules.ts +297 -0
- package/app/shared/structuredData.ts +104 -0
- package/i18n/locales/de/account.json +4 -0
- package/i18n/locales/de/checkout.json +1 -0
- package/i18n/locales/de/common.json +6 -0
- package/i18n/locales/de/pages.json +109 -0
- package/i18n/locales/en/account.json +4 -0
- package/i18n/locales/en/checkout.json +1 -0
- package/i18n/locales/en/common.json +6 -0
- package/i18n/locales/en/pages.json +109 -0
- package/nuxt.config.ts +140 -1
- package/package.json +10 -3
- package/server/api/auth/otp.post.ts +4 -8
- package/server/api/auth/otp.put.ts +20 -11
- package/server/api/categories/[slug]/exists.get.ts +28 -0
- package/server/api/offers/guest.get.ts +53 -0
- package/server/api/orders/index.post.ts +18 -12
- package/server/api/payment/methods.post.ts +2 -33
- package/server/api/product/[id]/locales.get.ts +9 -3
- package/server/data/product-detail.json +0 -20
- package/server/dev/errorHandler.ts +9 -5
- package/server/dev/typesense/autoSeed.ts +63 -0
- package/server/dev/typesense/seed.ts +4 -43
- package/server/dev/typesense/seedProducts.ts +87 -0
- package/server/interfaces/category.ts +5 -0
- package/server/interfaces/product.ts +13 -6
- package/server/middleware/missing-media.ts +2 -2
- package/server/plugins/previewHostNoindex.ts +21 -0
- package/server/plugins/seoSiteConfig.ts +62 -0
- package/server/routes/robots.txt.ts +21 -0
- package/server/services/ApiCategoryService.ts +6 -0
- package/server/services/ApiProductService.ts +2 -2
- package/server/services/LocalFileCategoryService.ts +6 -0
- package/server/utils/liveCatalog.ts +83 -18
- package/server/utils/livePrices.ts +12 -3
- package/server/utils/locale.ts +3 -8
- package/server/utils/offerService.ts +8 -3
- package/server/utils/paymentOptions.ts +49 -0
- package/server/utils/promotionsService.ts +25 -0
- package/server/utils/revenexxSdk.ts +7 -1
- package/server/utils/seoRequestHost.ts +21 -0
- package/server/utils/storefrontMessages.ts +5 -5
- package/server/utils/storefrontSeoRules.ts +298 -0
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
*
|
|
17
17
|
* A chip's absolutely positioned empty span pads its remove button out to a
|
|
18
18
|
* 3rem hit area on coarse pointers only.
|
|
19
|
+
*
|
|
20
|
+
* Below md the table gives way to a card list (UiTableCardList, PO-23) and a
|
|
21
|
+
* sort select stands in for the header buttons; both read the same sort state.
|
|
19
22
|
*/
|
|
20
23
|
import type {
|
|
21
24
|
ProductVariant,
|
|
@@ -300,6 +303,30 @@ const priceHeader = computed(() => {
|
|
|
300
303
|
function axisLabel(axis: ProductVariantAxis): string {
|
|
301
304
|
return axis.unit ? `${axis.label} (${axis.unit})` : axis.label;
|
|
302
305
|
}
|
|
306
|
+
|
|
307
|
+
/** The header sort buttons as select entries for the phone card list. */
|
|
308
|
+
const mobileSortTargets = computed<{ target: ProductVariantSort; label: string }[]>(() => [
|
|
309
|
+
{ target: { kind: "sku" }, label: t("product.detail.sku") },
|
|
310
|
+
...props.axes.map(axis => ({ target: { kind: "axis", code: axis.code } as ProductVariantSort, label: axisLabel(axis) })),
|
|
311
|
+
{ target: { kind: "name" }, label: t("product.variants.columns.name") },
|
|
312
|
+
]);
|
|
313
|
+
|
|
314
|
+
const mobileSortItems = computed(() => mobileSortTargets.value.flatMap(({ target, label }) => [
|
|
315
|
+
{ value: `${sortId(target)}|asc`, label: t("table.sortAsc", { column: label }) },
|
|
316
|
+
{ value: `${sortId(target)}|desc`, label: t("table.sortDesc", { column: label }) },
|
|
317
|
+
]));
|
|
318
|
+
|
|
319
|
+
const mobileSort = computed({
|
|
320
|
+
get: () => `${sortId(sort.value)}|${isAscending.value ? "asc" : "desc"}`,
|
|
321
|
+
set: (value: string) => {
|
|
322
|
+
const [id, direction] = value.split("|");
|
|
323
|
+
const match = mobileSortTargets.value.find(entry => sortId(entry.target) === id);
|
|
324
|
+
if (match) {
|
|
325
|
+
sort.value = match.target;
|
|
326
|
+
isAscending.value = direction !== "desc";
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
});
|
|
303
330
|
</script>
|
|
304
331
|
|
|
305
332
|
<template>
|
|
@@ -338,7 +365,8 @@ function axisLabel(axis: ProductVariantAxis): string {
|
|
|
338
365
|
type="search"
|
|
339
366
|
inputmode="numeric"
|
|
340
367
|
size="sm"
|
|
341
|
-
class="w-44"
|
|
368
|
+
class="w-full md:w-44"
|
|
369
|
+
:ui="{ base: 'max-lg:min-h-11' }"
|
|
342
370
|
:icon="icon('search')"
|
|
343
371
|
:placeholder="t('product.detail.sku')"
|
|
344
372
|
:aria-label="t('product.variants.filterSkuAria')"
|
|
@@ -353,7 +381,7 @@ function axisLabel(axis: ProductVariantAxis): string {
|
|
|
353
381
|
variant="outline"
|
|
354
382
|
size="sm"
|
|
355
383
|
tabindex="0"
|
|
356
|
-
class="cursor-pointer"
|
|
384
|
+
class="cursor-pointer max-lg:min-h-11"
|
|
357
385
|
:trailing-icon="icon('chevron-down')"
|
|
358
386
|
>
|
|
359
387
|
{{ axisLabel(axis) }}
|
|
@@ -380,7 +408,7 @@ function axisLabel(axis: ProductVariantAxis): string {
|
|
|
380
408
|
v-for="option in axisOptions(axis.code)"
|
|
381
409
|
:key="option.value"
|
|
382
410
|
>
|
|
383
|
-
<label class="group/row flex cursor-pointer items-center gap-2.5">
|
|
411
|
+
<label class="group/row flex cursor-pointer items-center gap-2.5 max-lg:min-h-11">
|
|
384
412
|
<UCheckbox
|
|
385
413
|
:model-value="isSelected(axis.code, option.value)"
|
|
386
414
|
tabindex="0"
|
|
@@ -403,7 +431,7 @@ function axisLabel(axis: ProductVariantAxis): string {
|
|
|
403
431
|
variant="ghost"
|
|
404
432
|
size="sm"
|
|
405
433
|
block
|
|
406
|
-
class="cursor-pointer"
|
|
434
|
+
class="cursor-pointer max-lg:min-h-11"
|
|
407
435
|
@click="clearAxis(axis.code)"
|
|
408
436
|
>
|
|
409
437
|
{{ t('product.variants.clearAxis') }}
|
|
@@ -418,7 +446,7 @@ function axisLabel(axis: ProductVariantAxis): string {
|
|
|
418
446
|
:variant="availableOnly ? 'subtle' : 'outline'"
|
|
419
447
|
size="sm"
|
|
420
448
|
tabindex="0"
|
|
421
|
-
class="cursor-pointer"
|
|
449
|
+
class="cursor-pointer max-lg:min-h-11"
|
|
422
450
|
:aria-pressed="availableOnly"
|
|
423
451
|
@click="availableOnly = !availableOnly"
|
|
424
452
|
>
|
|
@@ -461,7 +489,7 @@ function axisLabel(axis: ProductVariantAxis): string {
|
|
|
461
489
|
color="neutral"
|
|
462
490
|
variant="ghost"
|
|
463
491
|
size="sm"
|
|
464
|
-
class="cursor-pointer"
|
|
492
|
+
class="cursor-pointer max-lg:min-h-11"
|
|
465
493
|
@click="resetFilters"
|
|
466
494
|
>
|
|
467
495
|
{{ t('product.variants.resetAll') }}
|
|
@@ -469,7 +497,43 @@ function axisLabel(axis: ProductVariantAxis): string {
|
|
|
469
497
|
</div>
|
|
470
498
|
</div>
|
|
471
499
|
|
|
472
|
-
<
|
|
500
|
+
<UiTableCardList
|
|
501
|
+
v-model:sort="mobileSort"
|
|
502
|
+
class="mt-4"
|
|
503
|
+
:rows="visibleRows"
|
|
504
|
+
:row-key="row => row.id"
|
|
505
|
+
:sort-items="mobileSortItems"
|
|
506
|
+
>
|
|
507
|
+
<template #item="{ row }">
|
|
508
|
+
<ProductDetailVariantRow
|
|
509
|
+
layout="card"
|
|
510
|
+
:row="row"
|
|
511
|
+
:axes="axes"
|
|
512
|
+
:to="linkFor(row)"
|
|
513
|
+
:tax-rate="taxRate"
|
|
514
|
+
:category-slug="categorySlug"
|
|
515
|
+
:subcategory-slug="subcategorySlug"
|
|
516
|
+
:show-order-button="showOrderButton"
|
|
517
|
+
/>
|
|
518
|
+
</template>
|
|
519
|
+
<template #empty>
|
|
520
|
+
<p class="py-8 text-center text-sm text-muted">
|
|
521
|
+
{{ t('product.variants.empty') }}
|
|
522
|
+
<button
|
|
523
|
+
type="button"
|
|
524
|
+
class="text-primary hover:underline cursor-pointer min-h-11"
|
|
525
|
+
@click="resetFilters"
|
|
526
|
+
>
|
|
527
|
+
{{ t('product.variants.reset') }}
|
|
528
|
+
</button>
|
|
529
|
+
</p>
|
|
530
|
+
</template>
|
|
531
|
+
</UiTableCardList>
|
|
532
|
+
|
|
533
|
+
<!-- relative: the order column's sr-only header label is absolutely
|
|
534
|
+
positioned; without a positioned ancestor here it escaped this
|
|
535
|
+
scroller and widened the whole page on phones by ~300px. -->
|
|
536
|
+
<div class="relative hidden md:block -mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
|
|
473
537
|
<div class="inline-block min-w-full px-4 py-2 align-middle sm:px-6 lg:px-8">
|
|
474
538
|
<table class="w-full text-sm">
|
|
475
539
|
<thead>
|
|
@@ -480,7 +544,7 @@ function axisLabel(axis: ProductVariantAxis): string {
|
|
|
480
544
|
>
|
|
481
545
|
<button
|
|
482
546
|
type="button"
|
|
483
|
-
class="inline-flex items-center gap-1 hover:text-highlighted cursor-pointer"
|
|
547
|
+
class="inline-flex items-center gap-1 hover:text-highlighted cursor-pointer max-lg:min-h-11"
|
|
484
548
|
@click="toggleSort({ kind: 'sku' })"
|
|
485
549
|
>
|
|
486
550
|
{{ t('product.detail.sku') }}
|
|
@@ -499,7 +563,7 @@ function axisLabel(axis: ProductVariantAxis): string {
|
|
|
499
563
|
>
|
|
500
564
|
<button
|
|
501
565
|
type="button"
|
|
502
|
-
class="inline-flex items-center gap-1 hover:text-highlighted cursor-pointer"
|
|
566
|
+
class="inline-flex items-center gap-1 hover:text-highlighted cursor-pointer max-lg:min-h-11"
|
|
503
567
|
@click="toggleSort({ kind: 'axis', code: axis.code })"
|
|
504
568
|
>
|
|
505
569
|
{{ axisLabel(axis) }}
|
|
@@ -518,7 +582,7 @@ function axisLabel(axis: ProductVariantAxis): string {
|
|
|
518
582
|
>
|
|
519
583
|
<button
|
|
520
584
|
type="button"
|
|
521
|
-
class="inline-flex items-center gap-1 hover:text-highlighted cursor-pointer"
|
|
585
|
+
class="inline-flex items-center gap-1 hover:text-highlighted cursor-pointer max-lg:min-h-11"
|
|
522
586
|
@click="toggleSort({ kind: 'name' })"
|
|
523
587
|
>
|
|
524
588
|
{{ t('product.variants.columns.name') }}
|
|
@@ -589,7 +653,7 @@ function axisLabel(axis: ProductVariantAxis): string {
|
|
|
589
653
|
color="neutral"
|
|
590
654
|
variant="outline"
|
|
591
655
|
size="sm"
|
|
592
|
-
class="cursor-pointer"
|
|
656
|
+
class="cursor-pointer max-lg:min-h-11"
|
|
593
657
|
:trailing-icon="icon('chevron-down')"
|
|
594
658
|
:label="t('product.variants.showAll', { count: sortedRows.length })"
|
|
595
659
|
@click="isExpanded = true"
|
|
@@ -13,20 +13,20 @@ import type { ProductDetailCategory } from "../../../interfaces/product-detail";
|
|
|
13
13
|
*/
|
|
14
14
|
const localePath = useLocalePath();
|
|
15
15
|
|
|
16
|
-
const { slug, id } = useRouteProductSubject();
|
|
16
|
+
const { slug, id, categorySegments } = useRouteProductSubject();
|
|
17
17
|
|
|
18
|
+
const detail = useProductDetail(id);
|
|
18
19
|
const {
|
|
19
|
-
status,
|
|
20
|
+
status, error,
|
|
20
21
|
productInfo, mainImages, model3d, longDescription,
|
|
21
22
|
stocks, attributes, prices, taxRate, offerPending,
|
|
22
23
|
productCategories, categorySlug, subcategorySlug,
|
|
23
24
|
formatPrice, getDetailImageUrl, ready,
|
|
24
|
-
} =
|
|
25
|
+
} = detail;
|
|
25
26
|
await ready();
|
|
26
27
|
|
|
27
28
|
const { icon } = useIcons();
|
|
28
29
|
const { t } = useI18n();
|
|
29
|
-
const toast = useToast();
|
|
30
30
|
const cartStore = useCartStore();
|
|
31
31
|
|
|
32
32
|
const currentCartQuantity = computed(() => {
|
|
@@ -62,22 +62,17 @@ const notFound = computed(
|
|
|
62
62
|
() => !slug.value || (status.value !== "pending" && !productInfo.value),
|
|
63
63
|
);
|
|
64
64
|
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
// guarded template below.)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
65
|
+
// The HTTP answer: 404, 410 or a 301 for no product, a 301 for an outdated
|
|
66
|
+
// slug (PE-1236). Decided AFTER the await above: on the server a non-sync
|
|
67
|
+
// watcher runs once at setup and is then stopped, so a watchEffect here would
|
|
68
|
+
// evaluate before the fetch resolved and always see a product. (Never let an
|
|
69
|
+
// empty product crash the render into a 500 — see the guarded template below.)
|
|
70
|
+
const answersItself = await useProductAnswer({
|
|
71
|
+
slug, requestedCategory: categorySegments, productInfo, error, categorySlug, subcategorySlug,
|
|
72
|
+
});
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
await navigator.clipboard.writeText(productInfo.value.sku);
|
|
79
|
-
toast.add({ title: t("product.detail.skuCopied"), duration: 1200, icon: icon("copy-check") });
|
|
80
|
-
}
|
|
74
|
+
// Title, description, robots and canonical from the domain's SEO rules (PE-1235).
|
|
75
|
+
useProductSeo(detail, { notFound: () => !answersItself || notFound.value });
|
|
81
76
|
|
|
82
77
|
const rootCategory = computed(() =>
|
|
83
78
|
productCategories.value.find((c: ProductDetailCategory) => c.type === "root"),
|
|
@@ -99,11 +94,33 @@ const breadcrumb = computed(() => [
|
|
|
99
94
|
: []),
|
|
100
95
|
{ label: productInfo.value?.name ?? (status.value === "pending" ? "..." : t("product.detail.notFoundTitle")) },
|
|
101
96
|
]);
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Phones collapse the trail to its nearest linked parent (PO-23): the full
|
|
100
|
+
* trail squeezed every crumb to an ellipsis, and the product name is the H1
|
|
101
|
+
* right below anyway.
|
|
102
|
+
*/
|
|
103
|
+
const breadcrumbParent = computed(() => breadcrumb.value.findLast(item => item.to !== undefined));
|
|
102
104
|
</script>
|
|
103
105
|
|
|
104
106
|
<template>
|
|
105
107
|
<UContainer class="py-6">
|
|
106
|
-
<UBreadcrumb
|
|
108
|
+
<UBreadcrumb
|
|
109
|
+
class="hidden md:block"
|
|
110
|
+
:items="breadcrumb"
|
|
111
|
+
/>
|
|
112
|
+
<NuxtLink
|
|
113
|
+
v-if="breadcrumbParent?.to"
|
|
114
|
+
:to="breadcrumbParent.to"
|
|
115
|
+
class="md:hidden -ms-1 inline-flex items-center gap-1 min-h-11 pe-2 text-sm text-muted
|
|
116
|
+
hover:text-highlighted transition-colors"
|
|
117
|
+
>
|
|
118
|
+
<UIcon
|
|
119
|
+
:name="icon('chevron-left')"
|
|
120
|
+
class="size-4 shrink-0"
|
|
121
|
+
/>
|
|
122
|
+
{{ breadcrumbParent.label }}
|
|
123
|
+
</NuxtLink>
|
|
107
124
|
|
|
108
125
|
<CategorySkeletonCategoryDetailSkeleton v-if="status === 'pending'" />
|
|
109
126
|
|
|
@@ -116,11 +133,11 @@ const breadcrumb = computed(() => [
|
|
|
116
133
|
|
|
117
134
|
<div
|
|
118
135
|
v-else
|
|
119
|
-
class="mt-8"
|
|
136
|
+
class="mt-4 md:mt-8"
|
|
120
137
|
>
|
|
121
|
-
<div class="grid grid-cols-1
|
|
138
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-8 lg:gap-10 xl:gap-14 items-start">
|
|
122
139
|
<ProductDetailImageGallery
|
|
123
|
-
class="
|
|
140
|
+
class="md:sticky md:top-(--ui-header-height)"
|
|
124
141
|
:images="mainImages"
|
|
125
142
|
:get-image-url="getDetailImageUrl"
|
|
126
143
|
:model-url="model3d?.url"
|
|
@@ -129,28 +146,12 @@ const breadcrumb = computed(() => [
|
|
|
129
146
|
|
|
130
147
|
<div class="flex flex-col gap-6">
|
|
131
148
|
<!-- Identity -->
|
|
132
|
-
<
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
</h1>
|
|
139
|
-
<button
|
|
140
|
-
type="button"
|
|
141
|
-
tabindex="0"
|
|
142
|
-
class="mt-2 inline-flex items-center gap-1.5 text-sm text-muted
|
|
143
|
-
hover:text-highlighted transition-colors cursor-pointer"
|
|
144
|
-
:title="t('product.detail.copySku')"
|
|
145
|
-
@click="copySku"
|
|
146
|
-
>
|
|
147
|
-
{{ t('product.detail.sku') }}: {{ productInfo.sku }}
|
|
148
|
-
<UIcon
|
|
149
|
-
:name="icon('copy')"
|
|
150
|
-
class="size-3.5"
|
|
151
|
-
/>
|
|
152
|
-
</button>
|
|
153
|
-
</div>
|
|
149
|
+
<ProductDetailIdentity
|
|
150
|
+
:manufacturer="productInfo.manufacturer"
|
|
151
|
+
:name="productInfo.name"
|
|
152
|
+
:sku="productInfo.sku"
|
|
153
|
+
:logo="productInfo.manufacturerLogo"
|
|
154
|
+
/>
|
|
154
155
|
|
|
155
156
|
<!-- Price (Offer domain — hydrates after first paint) -->
|
|
156
157
|
<USkeleton
|
|
@@ -237,35 +238,29 @@ const breadcrumb = computed(() => [
|
|
|
237
238
|
</div>
|
|
238
239
|
|
|
239
240
|
<!-- The siblings of this article: one row each, with a column per axis
|
|
240
|
-
that distinguishes them. Rendered only where the model has any.
|
|
241
|
-
|
|
241
|
+
that distinguishes them. Rendered only where the model has any.
|
|
242
|
+
Both sections below draw their own top border and spacing (they
|
|
243
|
+
also stand alone as blokkli blocks), so no wrapper adds a second. -->
|
|
244
|
+
<ProductDetailVariants
|
|
242
245
|
v-if="variants.length"
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
show-filters
|
|
254
|
-
show-order-button
|
|
255
|
-
/>
|
|
256
|
-
</div>
|
|
246
|
+
:variants="variants"
|
|
247
|
+
:axes="axes"
|
|
248
|
+
:model="model"
|
|
249
|
+
:tax-rate="taxRate"
|
|
250
|
+
:link-for="variantLink"
|
|
251
|
+
:category-slug="categorySlug ?? ''"
|
|
252
|
+
:subcategory-slug="subcategorySlug"
|
|
253
|
+
show-filters
|
|
254
|
+
show-order-button
|
|
255
|
+
/>
|
|
257
256
|
|
|
258
257
|
<!-- What is sold alongside it. A way into the catalogue rather than a
|
|
259
258
|
second buy box, so the tiles carry no price and cost no offer call. -->
|
|
260
|
-
<
|
|
259
|
+
<ProductDetailAssociations
|
|
261
260
|
v-if="associationGroups.length"
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
:groups="associationGroups"
|
|
266
|
-
:link-for="variantLink"
|
|
267
|
-
/>
|
|
268
|
-
</div>
|
|
261
|
+
:groups="associationGroups"
|
|
262
|
+
:link-for="variantLink"
|
|
263
|
+
/>
|
|
269
264
|
</div>
|
|
270
265
|
</UContainer>
|
|
271
266
|
</template>
|
|
@@ -7,7 +7,8 @@ import type { FormKitFrameworkContext } from "@formkit/core";
|
|
|
7
7
|
* `type="datepicker"` (see formkit.config.ts). Values travel as ISO
|
|
8
8
|
* "YYYY-MM-DD" strings, so the input drops into any string-backed form
|
|
9
9
|
* state. Min/max and a date filter come in via the FormKit props
|
|
10
|
-
* `minDays`/`maxDays`/`disableWeekends
|
|
10
|
+
* `minDays`/`maxDays`/`disableWeekends`; `clearable: false` keeps a chosen
|
|
11
|
+
* date from being removed again (a field that must always hold one).
|
|
11
12
|
*/
|
|
12
13
|
const props = defineProps<{
|
|
13
14
|
context: FormKitFrameworkContext;
|
|
@@ -49,6 +50,7 @@ const maxValue = computed(() => {
|
|
|
49
50
|
});
|
|
50
51
|
|
|
51
52
|
const disableWeekends = computed(() => Boolean(props.context.disableWeekends));
|
|
53
|
+
const clearable = computed(() => props.context.clearable !== false && props.context.clearable !== "false");
|
|
52
54
|
|
|
53
55
|
function isDateDisabled(date: { toDate: (tz: string) => Date }): boolean {
|
|
54
56
|
if (!disableWeekends.value) {
|
|
@@ -59,6 +61,10 @@ function isDateDisabled(date: { toDate: (tz: string) => Date }): boolean {
|
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
function onSelect(value: CalendarDate | null | undefined): void {
|
|
64
|
+
if (!value && !clearable.value) {
|
|
65
|
+
open.value = false;
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
62
68
|
props.context.node.input(value ? value.toString() : "");
|
|
63
69
|
open.value = false;
|
|
64
70
|
}
|
|
@@ -106,7 +112,7 @@ function clear(): void {
|
|
|
106
112
|
@update:model-value="onSelect($event as CalendarDate | null)"
|
|
107
113
|
/>
|
|
108
114
|
<div
|
|
109
|
-
v-if="calendarValue"
|
|
115
|
+
v-if="calendarValue && clearable"
|
|
110
116
|
class="flex justify-end pt-1"
|
|
111
117
|
>
|
|
112
118
|
<UButton
|
|
@@ -73,11 +73,19 @@ export const useAuthStore = defineStore("auth", () => {
|
|
|
73
73
|
const session = ref<StoredSession | null>(null);
|
|
74
74
|
|
|
75
75
|
const isLoggedIn = computed(() => user.value !== null);
|
|
76
|
+
/**
|
|
77
|
+
* Whether the signed-in user is known yet. The user is resolved in the
|
|
78
|
+
* browser only (auth-init.client.ts), so during SSR and until /api/auth/me
|
|
79
|
+
* answers, `user` is null for everybody — a view that shows more to its
|
|
80
|
+
* owner can wait on this instead of rendering the stranger's version first.
|
|
81
|
+
*/
|
|
82
|
+
const resolved = ref(false);
|
|
76
83
|
|
|
77
84
|
const loading = ref(false);
|
|
78
85
|
const error = ref<string | null>(null);
|
|
79
86
|
|
|
80
87
|
function markAuthenticated() {
|
|
88
|
+
resolved.value = true;
|
|
81
89
|
localStorage.setItem(WAS_AUTHENTICATED_KEY, "1");
|
|
82
90
|
}
|
|
83
91
|
|
|
@@ -167,17 +175,23 @@ export const useAuthStore = defineStore("auth", () => {
|
|
|
167
175
|
}
|
|
168
176
|
};
|
|
169
177
|
|
|
170
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* Hand the secret back and become signed in, exactly as a password would.
|
|
180
|
+
*
|
|
181
|
+
* A link carries its `userId`. A code is confirmed with the address it was
|
|
182
|
+
* asked for: the customers app answers no user to a code request since 5.0,
|
|
183
|
+
* and a `userId` an older one answered goes along while it still does.
|
|
184
|
+
*/
|
|
171
185
|
const confirmSignInMail = async (
|
|
172
186
|
kind: "magic-link" | "otp",
|
|
173
|
-
{ userId, secret }: { userId
|
|
187
|
+
{ userId, email, secret }: { userId?: string | null; email?: string; secret: string },
|
|
174
188
|
) => {
|
|
175
189
|
loading.value = true;
|
|
176
190
|
error.value = null;
|
|
177
191
|
try {
|
|
178
192
|
const result = await $fetch<{ user: AuthUser; session: StoredSession }>(`/api/auth/${kind}`, {
|
|
179
193
|
method: "PUT",
|
|
180
|
-
body: { userId, secret },
|
|
194
|
+
body: { ...(userId ? { userId } : {}), ...(email ? { email } : {}), secret },
|
|
181
195
|
});
|
|
182
196
|
user.value = result.user;
|
|
183
197
|
session.value = result.session;
|
|
@@ -274,10 +288,13 @@ export const useAuthStore = defineStore("auth", () => {
|
|
|
274
288
|
session.value = null;
|
|
275
289
|
await handleAuthExpiry();
|
|
276
290
|
}
|
|
291
|
+
finally {
|
|
292
|
+
resolved.value = true;
|
|
293
|
+
}
|
|
277
294
|
};
|
|
278
295
|
|
|
279
296
|
return {
|
|
280
|
-
user, session, isLoggedIn, loading, error,
|
|
297
|
+
user, session, isLoggedIn, resolved, loading, error,
|
|
281
298
|
register, login, logout,
|
|
282
299
|
requestSignInMail, confirmSignInMail,
|
|
283
300
|
requestRecovery, confirmRecovery,
|
|
@@ -52,6 +52,30 @@ export function chunkIntoColumns(
|
|
|
52
52
|
return columns;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Asks the BFF whether a category URL's segments name a category the
|
|
57
|
+
* catalogue has (PE-1236): true or false, null when the catalogue could not be
|
|
58
|
+
* read. The navigation tree cannot answer it: live, it is cut to two levels,
|
|
59
|
+
* while products (and their breadcrumbs) hang at a leaf of any depth.
|
|
60
|
+
*
|
|
61
|
+
* Call it in setup, before the first await; the returned function forwards
|
|
62
|
+
* the request's cookies, so the demo/live switch applies.
|
|
63
|
+
*/
|
|
64
|
+
export function useCategoryExists(): (slug: string, subcategory?: string) => Promise<boolean | null> {
|
|
65
|
+
const requestFetch = useRequestFetch();
|
|
66
|
+
return async (slug, subcategory) => {
|
|
67
|
+
try {
|
|
68
|
+
const answer = await requestFetch<{ exists: boolean }>(categoriesApi.exists(slug), {
|
|
69
|
+
query: subcategory ? { subcategory } : undefined,
|
|
70
|
+
});
|
|
71
|
+
return answer.exists;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
55
79
|
export const useCategories = () => {
|
|
56
80
|
const localePath = useLocalePath();
|
|
57
81
|
const { icon } = useIcons();
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from "vue";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The HTTP answer of a category URL (PE-1236): a category or subcategory the
|
|
5
|
+
* catalogue does not have is a 404, not a listing of nothing under the slug
|
|
6
|
+
* with a 200 (a soft 404). Asked of the BFF, which knows every code of the
|
|
7
|
+
* catalogue, a leaf deeper than the navigation's two levels too; when the
|
|
8
|
+
* catalogue could not be read the page renders as before rather than turn
|
|
9
|
+
* every category away.
|
|
10
|
+
*
|
|
11
|
+
* A category's previous slug gets no 301 here: the slug is the catalogue's
|
|
12
|
+
* category code, which carries no id and no history, so Cover cannot tell a
|
|
13
|
+
* renamed category from one that never existed. Until the catalogue keeps
|
|
14
|
+
* that history, a renamed category's old URL is redirected at the edge (seo
|
|
15
|
+
* redirects, G1).
|
|
16
|
+
*/
|
|
17
|
+
export async function useCategoryAnswer(page: {
|
|
18
|
+
readonly categorySlug: MaybeRefOrGetter<string | undefined>;
|
|
19
|
+
readonly subcategorySlug: MaybeRefOrGetter<string | undefined>;
|
|
20
|
+
}): Promise<void> {
|
|
21
|
+
// The status code is the server's to send; a client navigation is not held up.
|
|
22
|
+
if (!import.meta.server) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const slug = toValue(page.categorySlug);
|
|
26
|
+
const exists = slug ? await useCategoryExists()(slug, toValue(page.subcategorySlug)) : false;
|
|
27
|
+
if (exists === false) {
|
|
28
|
+
throw createError({ statusCode: 404, statusMessage: "Category not found", fatal: true });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from "vue";
|
|
2
|
+
|
|
3
|
+
import { hasListingFilters } from "../shared/seoRules";
|
|
4
|
+
import type { ListingResponse } from "./useProductListing";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The category page's SEO from the domain's rules (PE-1235), for every page
|
|
8
|
+
* that lists a category: the blökkli theme's template page and the demo shop's.
|
|
9
|
+
*
|
|
10
|
+
* The clean category URL and its pages are indexable, each page its own
|
|
11
|
+
* canonical. Facet, price and in-category search permutations are
|
|
12
|
+
* near-duplicates of it: they stay out of the index and name the clean
|
|
13
|
+
* category URL as their canonical, whatever page they are on. An empty
|
|
14
|
+
* category or a page beyond its last is thin content and stays out of the
|
|
15
|
+
* index too; sort and tracking parameters are stripped from the canonical.
|
|
16
|
+
* Emptiness is read from the listing the page already fetched
|
|
17
|
+
* (useCategoryListing, key `category`).
|
|
18
|
+
*/
|
|
19
|
+
export function useCategorySeo(category: {
|
|
20
|
+
readonly name: MaybeRefOrGetter<string | undefined>;
|
|
21
|
+
/** The parent category's name, on a subcategory. */
|
|
22
|
+
readonly parent?: MaybeRefOrGetter<string | undefined>;
|
|
23
|
+
/** A preview or anything else that must not be indexed. */
|
|
24
|
+
readonly noindex?: MaybeRefOrGetter<boolean>;
|
|
25
|
+
/** A preview, whose links must not be followed either. */
|
|
26
|
+
readonly nofollow?: MaybeRefOrGetter<boolean>;
|
|
27
|
+
}): void {
|
|
28
|
+
const route = useRoute();
|
|
29
|
+
const rules = useSeoRules();
|
|
30
|
+
const { data: listing } = useNuxtData<ListingResponse | null>("listing:category");
|
|
31
|
+
|
|
32
|
+
const filtered = computed(() => hasListingFilters(route.query, rules.value));
|
|
33
|
+
/** Nothing listed: an empty category, or a page beyond its last (`?page=9999`). */
|
|
34
|
+
const empty = computed(() => listing.value?.products.length === 0);
|
|
35
|
+
|
|
36
|
+
useSeoContext({
|
|
37
|
+
type: "category",
|
|
38
|
+
values: () => ({ name: toValue(category.name), parent: toValue(category.parent) }),
|
|
39
|
+
title: () => toValue(category.name),
|
|
40
|
+
noindex: () => Boolean(toValue(category.noindex)) || filtered.value || empty.value,
|
|
41
|
+
nofollow: category.nofollow,
|
|
42
|
+
canonicalPath: () => (filtered.value ? route.path : undefined),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// The trail in the structured data (PE-1103), from the category routes'
|
|
46
|
+
// own params: /category/<category>[/<subcategory>].
|
|
47
|
+
const { t } = useI18n();
|
|
48
|
+
const localePath = useLocalePath();
|
|
49
|
+
useSchemaOrg([
|
|
50
|
+
defineBreadcrumb(computed(() => {
|
|
51
|
+
const parent = toValue(category.parent);
|
|
52
|
+
const parentSlug = route.params.subcategory ? String(route.params.category) : undefined;
|
|
53
|
+
return {
|
|
54
|
+
itemListElement: [
|
|
55
|
+
{ name: t("nav.home"), item: localePath("/") },
|
|
56
|
+
...(parentSlug && parent ? [{ name: parent, item: localePath(`/category/${parentSlug}`) }] : []),
|
|
57
|
+
{ name: toValue(category.name) ?? "", item: route.path },
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
})),
|
|
61
|
+
]);
|
|
62
|
+
}
|
|
@@ -4,6 +4,7 @@ import type { CartCalculation } from "../interfaces/cart-calculation";
|
|
|
4
4
|
import type { CheckoutOnePageForm, CheckoutProfile } from "../interfaces/checkout";
|
|
5
5
|
import { checkoutAddressFieldOf, checkoutAddressRefusalOf } from "../shared/checkoutAddressRefusal";
|
|
6
6
|
import { browserSession, purchaseFromCart, stashPurchase } from "../shared/themeEvents";
|
|
7
|
+
import { calendarToday, earliestRequestedDate } from "../shared/requestedDate";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Who is checking out:
|
|
@@ -71,7 +72,17 @@ export function useCheckoutOnePage() {
|
|
|
71
72
|
const customerType = useState<CheckoutCustomerType>("checkout-customer-type", () => "account");
|
|
72
73
|
const isGuest = computed(() => customerType.value !== "account");
|
|
73
74
|
|
|
74
|
-
|
|
75
|
+
// The delivery date every order must carry where the merchant requires one
|
|
76
|
+
// (`checkout.requestedDateRequired`): the earliest day they can deliver,
|
|
77
|
+
// prefilled so the buyer sees it and can only move it later.
|
|
78
|
+
const appConfig = useAppConfig();
|
|
79
|
+
const requestedDateRequired = computed(() => Boolean(appConfig.checkout?.requestedDateRequired));
|
|
80
|
+
const defaultRequestedDate = (): string => requestedDateRequired.value
|
|
81
|
+
? earliestRequestedDate(Number(appConfig.checkout?.earliestDeliveryDays ?? 0), calendarToday())
|
|
82
|
+
: "";
|
|
83
|
+
const emptyForm = (): CheckoutOnePageForm => ({ ...EMPTY_FORM, requestedDate: defaultRequestedDate() });
|
|
84
|
+
|
|
85
|
+
const form = useState<CheckoutOnePageForm>("checkout-one-page-form", emptyForm);
|
|
75
86
|
const guestContact = useState("checkout-guest-contact", () => ({ email: "", phone: "" }));
|
|
76
87
|
const guestShipping = useState<CheckoutGuestAddress>("checkout-guest-shipping", () => ({ ...EMPTY_GUEST_ADDRESS }));
|
|
77
88
|
const guestBilling = useState<CheckoutGuestAddress>("checkout-guest-billing", () => ({ ...EMPTY_GUEST_ADDRESS }));
|
|
@@ -94,7 +105,7 @@ export function useCheckoutOnePage() {
|
|
|
94
105
|
|
|
95
106
|
const requestedDateError = (value: string): string | null => {
|
|
96
107
|
if (!value) {
|
|
97
|
-
return null;
|
|
108
|
+
return requestedDateRequired.value ? t("onepage.errors.requestedDateRequired") : null;
|
|
98
109
|
}
|
|
99
110
|
const date = new Date(value);
|
|
100
111
|
if (isNaN(date.getTime())) {
|
|
@@ -163,7 +174,7 @@ export function useCheckoutOnePage() {
|
|
|
163
174
|
|
|
164
175
|
function initFromProfile(p: CheckoutProfile) {
|
|
165
176
|
form.value = {
|
|
166
|
-
...
|
|
177
|
+
...emptyForm(),
|
|
167
178
|
shippingAddressId: p.defaultShippingAddressId,
|
|
168
179
|
billingAddressId: p.defaultBillingAddressId,
|
|
169
180
|
deliveryMethod: p.defaultDeliveryMethod,
|
|
@@ -541,7 +552,7 @@ export function useCheckoutOnePage() {
|
|
|
541
552
|
}
|
|
542
553
|
|
|
543
554
|
function reset() {
|
|
544
|
-
form.value =
|
|
555
|
+
form.value = emptyForm();
|
|
545
556
|
guestContact.value = { email: "", phone: "" };
|
|
546
557
|
guestShipping.value = { ...EMPTY_GUEST_ADDRESS };
|
|
547
558
|
guestBilling.value = { ...EMPTY_GUEST_ADDRESS };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shop's default UI language: the i18n default locale, else its first
|
|
3
|
+
* locale. The language the pages render in for a content locale without UI
|
|
4
|
+
* strings of its own (PE-866). One rule for the language switcher and the
|
|
5
|
+
* document head, so `<html lang>` and the switcher never disagree.
|
|
6
|
+
*/
|
|
7
|
+
export function useDefaultUiLanguage() {
|
|
8
|
+
const { locales } = useI18n();
|
|
9
|
+
const runtimeConfig = useRuntimeConfig();
|
|
10
|
+
return computed(() => {
|
|
11
|
+
const i18nConfig = runtimeConfig.public as { i18n?: { defaultLocale?: string }; defaultLocale?: string };
|
|
12
|
+
return i18nConfig.i18n?.defaultLocale || i18nConfig.defaultLocale || locales.value[0]?.code || "de";
|
|
13
|
+
});
|
|
14
|
+
}
|