@revenexx/cover 0.22.0 → 0.23.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.
Files changed (113) hide show
  1. package/app/api/categories.ts +1 -0
  2. package/app/api/offers.ts +1 -0
  3. package/app/app.config.ts +13 -0
  4. package/app/components/OgImage/CoverPage.takumi.vue +37 -0
  5. package/app/components/RevenexxForm.vue +21 -6
  6. package/app/components/account/approvals/AccountPendingApprovals.vue +19 -1
  7. package/app/components/account/approvals/AccountPendingOrderDetail.vue +3 -0
  8. package/app/components/account/carts/AccountCartsTable.vue +11 -1
  9. package/app/components/account/orderlists/AccountOrderListDetail.vue +32 -3
  10. package/app/components/account/organization/AccountOrganization.vue +1 -1
  11. package/app/components/auth/AuthForgotPasswordPanel.vue +7 -2
  12. package/app/components/auth/AuthLoginPanel.vue +23 -8
  13. package/app/components/auth/AuthRegisterTeaser.vue +1 -1
  14. package/app/components/cart/position/CartPosition.vue +11 -4
  15. package/app/components/cart/quickadd/CartQuickAdd.vue +4 -2
  16. package/app/components/cart/recommend/CartRecommendCard.vue +1 -0
  17. package/app/components/cart/switcher/CartSwitcher.vue +1 -0
  18. package/app/components/cart/view/CartListHeader.vue +5 -0
  19. package/app/components/cart/view/CartSummaryPanel.vue +20 -8
  20. package/app/components/cart/view/CartView.vue +4 -2
  21. package/app/components/checkout/onepage/CheckoutGate.vue +4 -2
  22. package/app/components/checkout/onepage/CheckoutGuestDetailsSection.vue +2 -1
  23. package/app/components/checkout/onepage/CheckoutPaymentSection.vue +1 -1
  24. package/app/components/checkout/onepage/CheckoutSummarySection.vue +8 -0
  25. package/app/components/checkout/return/CheckoutPaymentReturn.vue +7 -0
  26. package/app/components/layout/footer/Footer.vue +21 -4
  27. package/app/components/layout/header/AppBar.vue +5 -2
  28. package/app/components/layout/header/LocaleSwitcher.vue +7 -9
  29. package/app/components/layout/header/MobileMenu.vue +4 -1
  30. package/app/components/product/detail/ProductDetailAddToCart.vue +17 -11
  31. package/app/components/product/detail/ProductDetailImageGallery.vue +101 -8
  32. package/app/components/product/detail/ProductDetailVariantRow.vue +84 -4
  33. package/app/components/product/detail/ProductDetailVariants.vue +75 -11
  34. package/app/components/product/detail/ProductDetailView.vue +64 -69
  35. package/app/components/punchout/action/PunchoutTransferAction.vue +4 -3
  36. package/app/composables/useAuthStore.ts +21 -4
  37. package/app/composables/useCategories.ts +24 -0
  38. package/app/composables/useCategoryAnswer.ts +30 -0
  39. package/app/composables/useCategorySeo.ts +62 -0
  40. package/app/composables/useDefaultUiLanguage.ts +14 -0
  41. package/app/composables/useOgImageReady.ts +16 -0
  42. package/app/composables/useProductAnswer.ts +121 -0
  43. package/app/composables/useProductLocales.ts +21 -10
  44. package/app/composables/useProductSeo.ts +145 -0
  45. package/app/composables/usePunchoutVisit.ts +36 -1
  46. package/app/composables/useRouteSubject.ts +23 -3
  47. package/app/composables/useSeoContext.ts +164 -0
  48. package/app/composables/useSeoHead.ts +189 -0
  49. package/app/composables/useSeoRules.ts +23 -0
  50. package/app/interfaces/punchout.ts +11 -0
  51. package/app/interfaces/seo.ts +48 -0
  52. package/app/layouts/default.vue +2 -8
  53. package/app/layouts/focus.vue +3 -1
  54. package/app/middleware/punchout-exits.global.ts +25 -0
  55. package/app/payments/psp/novalnet.ts +25 -3
  56. package/app/payments/psp/novalnetStyle.ts +186 -0
  57. package/app/plugins/punchout-links.client.ts +46 -0
  58. package/app/shared/categoryTree.ts +7 -0
  59. package/app/shared/locale.ts +8 -0
  60. package/app/shared/productLocales.ts +62 -1
  61. package/app/shared/punchoutExits.ts +156 -0
  62. package/app/shared/seoRules.ts +297 -0
  63. package/app/shared/structuredData.ts +104 -0
  64. package/i18n/locales/de/account.json +4 -0
  65. package/i18n/locales/de/common.json +6 -0
  66. package/i18n/locales/de/pages.json +109 -0
  67. package/i18n/locales/de/punchout.json +3 -0
  68. package/i18n/locales/en/account.json +4 -0
  69. package/i18n/locales/en/common.json +6 -0
  70. package/i18n/locales/en/pages.json +109 -0
  71. package/i18n/locales/en/punchout.json +3 -0
  72. package/nuxt.config.ts +140 -1
  73. package/package.json +10 -3
  74. package/server/api/auth/otp.post.ts +4 -8
  75. package/server/api/auth/otp.put.ts +20 -11
  76. package/server/api/categories/[slug]/exists.get.ts +28 -0
  77. package/server/api/offers/guest.get.ts +53 -0
  78. package/server/api/orders/index.post.ts +18 -11
  79. package/server/api/payment/methods.post.ts +2 -33
  80. package/server/api/product/[id]/locales.get.ts +9 -3
  81. package/server/data/product-detail.json +0 -20
  82. package/server/dev/errorHandler.ts +9 -5
  83. package/server/dev/typesense/autoSeed.ts +63 -0
  84. package/server/dev/typesense/seed.ts +4 -43
  85. package/server/dev/typesense/seedProducts.ts +87 -0
  86. package/server/interfaces/category.ts +5 -0
  87. package/server/interfaces/product.ts +13 -6
  88. package/server/interfaces/punchout.ts +20 -1
  89. package/server/middleware/missing-media.ts +2 -2
  90. package/server/middleware/punchout-exits.ts +45 -0
  91. package/server/middleware/punchout-visit-csp.ts +35 -0
  92. package/server/plugins/previewHostNoindex.ts +21 -0
  93. package/server/plugins/punchout-cookies.ts +48 -0
  94. package/server/plugins/seoSiteConfig.ts +62 -0
  95. package/server/routes/punchout/start.get.ts +7 -0
  96. package/server/routes/robots.txt.ts +21 -0
  97. package/server/services/ApiCategoryService.ts +6 -0
  98. package/server/services/ApiProductService.ts +2 -2
  99. package/server/services/LocalFileCategoryService.ts +6 -0
  100. package/server/utils/liveCatalog.ts +83 -18
  101. package/server/utils/livePrices.ts +12 -3
  102. package/server/utils/locale.ts +3 -8
  103. package/server/utils/offerService.ts +8 -3
  104. package/server/utils/paymentOptions.ts +49 -0
  105. package/server/utils/promotionsService.ts +25 -0
  106. package/server/utils/punchoutFrame.ts +131 -0
  107. package/server/utils/punchoutOrder.ts +40 -0
  108. package/server/utils/punchoutVisit.ts +41 -8
  109. package/server/utils/revenexxSdk.ts +7 -1
  110. package/server/utils/seoRequestHost.ts +21 -0
  111. package/server/utils/storefrontMessages.ts +5 -5
  112. package/server/utils/storefrontSeoRules.ts +298 -0
  113. package/server/middleware/punchout-hand-back-csp.ts +0 -17
@@ -13,6 +13,11 @@
13
13
  * the cue that tells a screen reader which row you are on; and the order
14
14
  * button's absolutely positioned empty span pads its hit area out to 3rem on
15
15
  * coarse pointers only.
16
+ *
17
+ * `layout="card"` is the same variant as a card for the phone list below md
18
+ * (PO-23): seven columns do not fit a phone, and in a sideways scroller the
19
+ * price and the order button were the ones off-screen. It reuses the row's
20
+ * composables, which is why it lives here and not in a component of its own.
16
21
  */
17
22
  import type { ProductList } from "../../../interfaces/product-list";
18
23
  import type { ProductVariantAxis, ProductVariantRow } from "../../../interfaces/product-variants";
@@ -27,9 +32,11 @@ const props = withDefaults(defineProps<{
27
32
  categorySlug?: string;
28
33
  subcategorySlug?: string;
29
34
  showOrderButton?: boolean;
35
+ layout?: "row" | "card";
30
36
  }>(), {
31
37
  categorySlug: "",
32
38
  showOrderButton: true,
39
+ layout: "row",
33
40
  });
34
41
 
35
42
  const { t } = useI18n();
@@ -59,14 +66,87 @@ const addToCartLabel = computed(() => t("product.actions.addToCart"));
59
66
  </script>
60
67
 
61
68
  <template>
62
- <tr :class="row.isSelf ? 'bg-primary/5' : 'hover:bg-elevated/40'">
69
+ <div
70
+ v-if="layout === 'card'"
71
+ class="-m-4 p-4 space-y-2"
72
+ :class="row.isSelf ? 'bg-primary/5 border-l-2 border-primary' : ''"
73
+ >
74
+ <div class="flex items-center justify-between gap-3">
75
+ <NuxtLink
76
+ :to="to"
77
+ class="-my-3 inline-flex min-h-11 items-center tabular-nums"
78
+ :class="row.isSelf ? 'font-semibold text-highlighted' : 'font-medium text-primary hover:underline'"
79
+ >
80
+ {{ row.sku }}
81
+ </NuxtLink>
82
+ <span class="inline-flex shrink-0 items-center gap-1.5 text-sm">
83
+ <span
84
+ class="size-2 shrink-0 rounded-full"
85
+ :class="isInStock ? 'bg-success' : 'bg-error'"
86
+ aria-hidden="true"
87
+ />
88
+ <span :class="isInStock ? 'text-success' : 'text-error'">
89
+ {{ isInStock ? t('product.stock.available') : t('product.stock.unavailable') }}
90
+ </span>
91
+ </span>
92
+ </div>
93
+
94
+ <dl
95
+ v-if="axes.length"
96
+ class="flex flex-wrap gap-x-4 gap-y-1 text-sm"
97
+ >
98
+ <div
99
+ v-for="axis in axes"
100
+ :key="axis.code"
101
+ class="flex gap-1.5"
102
+ >
103
+ <dt class="text-muted">
104
+ {{ axis.unit ? `${axis.label} (${axis.unit})` : axis.label }}
105
+ </dt>
106
+ <dd
107
+ class="tabular-nums"
108
+ :class="row.values[axis.code] ? 'text-highlighted' : 'text-muted'"
109
+ >
110
+ {{ row.values[axis.code] ?? '—' }}
111
+ </dd>
112
+ </div>
113
+ </dl>
114
+
115
+ <p
116
+ v-if="row.shortName"
117
+ class="text-sm text-muted"
118
+ >
119
+ {{ row.shortName }}
120
+ </p>
121
+
122
+ <div class="flex items-center justify-between gap-3 pt-1">
123
+ <CategoryInfoCategoryPrice :product="asProduct" />
124
+ <UButton
125
+ v-if="showOrderButton"
126
+ color="primary"
127
+ variant="outline"
128
+ class="min-h-11 shrink-0 cursor-pointer"
129
+ :disabled="!canOrder"
130
+ :title="canOrder ? addToCartLabel : t('product.variants.notOrderable')"
131
+ :aria-label="t('product.variants.addToCartAria', { sku: row.sku })"
132
+ :icon="icon('cart')"
133
+ :label="t('product.actions.order')"
134
+ @click="addToCart()"
135
+ />
136
+ </div>
137
+ </div>
138
+
139
+ <tr
140
+ v-else
141
+ :class="row.isSelf ? 'bg-primary/5' : 'hover:bg-elevated/40'"
142
+ >
63
143
  <td
64
144
  class="py-3 pr-4 whitespace-nowrap"
65
145
  :class="row.isSelf ? 'border-l-2 border-primary pl-3' : 'pl-0'"
66
146
  >
67
147
  <NuxtLink
68
148
  :to="to"
69
- class="tabular-nums"
149
+ class="tabular-nums max-lg:-my-3 max-lg:inline-flex max-lg:min-h-11 max-lg:items-center"
70
150
  :class="row.isSelf ? 'font-semibold text-highlighted' : 'text-primary hover:underline'"
71
151
  >
72
152
  {{ row.sku }}
@@ -113,7 +193,7 @@ const addToCartLabel = computed(() => t("product.actions.addToCart"));
113
193
  <button
114
194
  type="button"
115
195
  :disabled="!canOrder"
116
- class="relative inline-flex items-center gap-1.5 rounded-md py-1.5 pr-2.5 pl-2
196
+ class="relative inline-flex items-center gap-1.5 rounded-md py-1.5 pr-2.5 pl-2 max-lg:min-h-11 max-lg:min-w-11 max-lg:justify-center
117
197
  text-sm font-medium ring-1 cursor-pointer text-primary ring-(--ui-border)
118
198
  hover:bg-primary/5 disabled:cursor-not-allowed disabled:text-dimmed
119
199
  disabled:ring-(--ui-border) disabled:hover:bg-transparent
@@ -132,7 +212,7 @@ const addToCartLabel = computed(() => t("product.actions.addToCart"));
132
212
  :name="icon('cart')"
133
213
  class="size-4 shrink-0"
134
214
  />
135
- <span class="max-sm:sr-only">{{ t('product.actions.order') }}</span>
215
+ <span class="max-lg:sr-only">{{ t('product.actions.order') }}</span>
136
216
  </button>
137
217
  </td>
138
218
  </tr>
@@ -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
- <div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
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
- } = useProductDetail(id);
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
- // Reflect not-found as a real 404. Checked synchronously AFTER the await above:
66
- // on the server a non-sync watcher runs once at setup and is then stopped, so a
67
- // watchEffect here would evaluate before the fetch resolved and always see a
68
- // product. (Never let an empty product crash the render into a 500 — see the
69
- // guarded template below.)
70
- if (import.meta.server && notFound.value) {
71
- setResponseStatus(useRequestEvent(), 404);
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
- async function copySku(): Promise<void> {
75
- if (!productInfo.value) {
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 :items="breadcrumb" />
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 lg:grid-cols-2 gap-10 xl:gap-14 items-start">
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="lg:sticky lg:top-(--ui-header-height)"
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
- <div>
133
- <p class="text-xs font-semibold uppercase tracking-wide text-muted">
134
- {{ productInfo.manufacturer }}
135
- </p>
136
- <h1 class="mt-1 text-3xl font-semibold tracking-tight text-highlighted">
137
- {{ productInfo.name }}
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
- <div
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
- class="mt-14 pt-10 border-t border-(--ui-border)"
244
- >
245
- <ProductDetailVariants
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
- />
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
- <div
259
+ <ProductDetailAssociations
261
260
  v-if="associationGroups.length"
262
- class="mt-14 pt-10 border-t border-(--ui-border)"
263
- >
264
- <ProductDetailAssociations
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>
@@ -2,7 +2,8 @@
2
2
  /**
3
3
  * "Transfer cart" — the end of a punchout visit, as the buyer meets it.
4
4
  *
5
- * Offered ONLY inside a punchout session, and worded by that session's
5
+ * Offered ONLY inside a punchout session whose purchase mode hands the cart
6
+ * back (RAD-226) — after the order, for `order_and_transfer` — and worded by that session's
6
7
  * protocol: the same button is "transfer the basket back" to an SRM buyer,
7
8
  * "return the requisition" to a cXML one and "send the cart to your trade
8
9
  * software" to an IDS craftsman.
@@ -15,7 +16,7 @@
15
16
  const { icon } = useIcons();
16
17
  const { t } = useI18n();
17
18
  const { to } = useAppUrl();
18
- const { isPunchout, isReadOnly, protocol, transferLabelKey } = usePunchoutVisit();
19
+ const { isReadOnly, offersHandBack, protocol, transferLabelKey } = usePunchoutVisit();
19
20
  const cart = useCartStore();
20
21
 
21
22
  const props = withDefaults(defineProps<{
@@ -33,7 +34,7 @@ const isEmpty = computed(() => cart.items.length === 0);
33
34
 
34
35
  <template>
35
36
  <div
36
- v-if="isPunchout"
37
+ v-if="offersHandBack"
37
38
  class="space-y-2"
38
39
  >
39
40
  <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
- /** Hand the secret back and become signed in, exactly as a password would. */
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: string; secret: string },
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
+ }