@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.
Files changed (98) hide show
  1. package/app/api/categories.ts +1 -0
  2. package/app/api/offers.ts +1 -0
  3. package/app/app.config.ts +18 -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 +7 -2
  20. package/app/components/cart/view/CartView.vue +4 -2
  21. package/app/components/checkout/onepage/CheckoutDeliverySection.vue +3 -0
  22. package/app/components/checkout/onepage/CheckoutGate.vue +4 -2
  23. package/app/components/checkout/onepage/CheckoutGuestDetailsSection.vue +2 -1
  24. package/app/components/checkout/onepage/CheckoutPaymentSection.vue +1 -1
  25. package/app/components/layout/header/LocaleSwitcher.vue +7 -9
  26. package/app/components/product/detail/ProductDetailAddToCart.vue +17 -11
  27. package/app/components/product/detail/ProductDetailImageGallery.vue +101 -8
  28. package/app/components/product/detail/ProductDetailVariantRow.vue +84 -4
  29. package/app/components/product/detail/ProductDetailVariants.vue +75 -11
  30. package/app/components/product/detail/ProductDetailView.vue +64 -69
  31. package/app/components/ui/forms/FormKitDatePicker.vue +8 -2
  32. package/app/composables/useAuthStore.ts +21 -4
  33. package/app/composables/useCategories.ts +24 -0
  34. package/app/composables/useCategoryAnswer.ts +30 -0
  35. package/app/composables/useCategorySeo.ts +62 -0
  36. package/app/composables/useCheckoutOnePage.ts +15 -4
  37. package/app/composables/useDefaultUiLanguage.ts +14 -0
  38. package/app/composables/useOgImageReady.ts +16 -0
  39. package/app/composables/useProductAnswer.ts +121 -0
  40. package/app/composables/useProductLocales.ts +21 -10
  41. package/app/composables/useProductSeo.ts +145 -0
  42. package/app/composables/useRouteSubject.ts +23 -3
  43. package/app/composables/useSeoContext.ts +164 -0
  44. package/app/composables/useSeoHead.ts +189 -0
  45. package/app/composables/useSeoRules.ts +23 -0
  46. package/app/formkit.config.ts +1 -1
  47. package/app/interfaces/seo.ts +48 -0
  48. package/app/layouts/default.vue +2 -8
  49. package/app/layouts/focus.vue +3 -1
  50. package/app/payments/psp/novalnet.ts +25 -3
  51. package/app/payments/psp/novalnetStyle.ts +186 -0
  52. package/app/shared/categoryTree.ts +7 -0
  53. package/app/shared/locale.ts +8 -0
  54. package/app/shared/productLocales.ts +62 -1
  55. package/app/shared/requestedDate.ts +49 -0
  56. package/app/shared/seoRules.ts +297 -0
  57. package/app/shared/structuredData.ts +104 -0
  58. package/i18n/locales/de/account.json +4 -0
  59. package/i18n/locales/de/checkout.json +1 -0
  60. package/i18n/locales/de/common.json +6 -0
  61. package/i18n/locales/de/pages.json +109 -0
  62. package/i18n/locales/en/account.json +4 -0
  63. package/i18n/locales/en/checkout.json +1 -0
  64. package/i18n/locales/en/common.json +6 -0
  65. package/i18n/locales/en/pages.json +109 -0
  66. package/nuxt.config.ts +140 -1
  67. package/package.json +10 -3
  68. package/server/api/auth/otp.post.ts +4 -8
  69. package/server/api/auth/otp.put.ts +20 -11
  70. package/server/api/categories/[slug]/exists.get.ts +28 -0
  71. package/server/api/offers/guest.get.ts +53 -0
  72. package/server/api/orders/index.post.ts +18 -12
  73. package/server/api/payment/methods.post.ts +2 -33
  74. package/server/api/product/[id]/locales.get.ts +9 -3
  75. package/server/data/product-detail.json +0 -20
  76. package/server/dev/errorHandler.ts +9 -5
  77. package/server/dev/typesense/autoSeed.ts +63 -0
  78. package/server/dev/typesense/seed.ts +4 -43
  79. package/server/dev/typesense/seedProducts.ts +87 -0
  80. package/server/interfaces/category.ts +5 -0
  81. package/server/interfaces/product.ts +13 -6
  82. package/server/middleware/missing-media.ts +2 -2
  83. package/server/plugins/previewHostNoindex.ts +21 -0
  84. package/server/plugins/seoSiteConfig.ts +62 -0
  85. package/server/routes/robots.txt.ts +21 -0
  86. package/server/services/ApiCategoryService.ts +6 -0
  87. package/server/services/ApiProductService.ts +2 -2
  88. package/server/services/LocalFileCategoryService.ts +6 -0
  89. package/server/utils/liveCatalog.ts +83 -18
  90. package/server/utils/livePrices.ts +12 -3
  91. package/server/utils/locale.ts +3 -8
  92. package/server/utils/offerService.ts +8 -3
  93. package/server/utils/paymentOptions.ts +49 -0
  94. package/server/utils/promotionsService.ts +25 -0
  95. package/server/utils/revenexxSdk.ts +7 -1
  96. package/server/utils/seoRequestHost.ts +21 -0
  97. package/server/utils/storefrontMessages.ts +5 -5
  98. package/server/utils/storefrontSeoRules.ts +298 -0
@@ -264,12 +264,14 @@ const trustItems = computed(() => {
264
264
  :placeholder="t('cart.summary.voucherPlaceholder')"
265
265
  size="sm"
266
266
  class="flex-1"
267
+ :ui="{ base: 'max-lg:min-h-11' }"
267
268
  :disabled="codesFull"
268
269
  @keyup.enter="applyCode"
269
270
  />
270
271
  <UButton
271
272
  size="sm"
272
273
  variant="subtle"
274
+ class="max-lg:min-h-11"
273
275
  :disabled="!codeInput.trim() || codesFull"
274
276
  @click="applyCode"
275
277
  >
@@ -335,7 +337,7 @@ const trustItems = computed(() => {
335
337
  color="primary"
336
338
  variant="solid"
337
339
  size="lg"
338
- class="w-full justify-center mt-2"
340
+ class="w-full justify-center mt-2 max-lg:min-h-11"
339
341
  :icon="icon('file')"
340
342
  :loading="pending"
341
343
  :label="t('cart.quote.action')"
@@ -355,7 +357,7 @@ const trustItems = computed(() => {
355
357
  color="primary"
356
358
  variant="solid"
357
359
  size="lg"
358
- class="w-full justify-center mt-2"
360
+ class="w-full justify-center mt-2 max-lg:min-h-11"
359
361
  :disabled="!orderable"
360
362
  :loading="pending"
361
363
  :label="isRequester ? t('cart.cta.requisition') : t('cart.cta.checkout')"
@@ -399,6 +401,7 @@ const trustItems = computed(() => {
399
401
  variant="ghost"
400
402
  size="xs"
401
403
  tabindex="0"
404
+ class="max-lg:min-h-11"
402
405
  :label="t('cart.export.action')"
403
406
  @click="actions.open('export', [])"
404
407
  />
@@ -409,6 +412,7 @@ const trustItems = computed(() => {
409
412
  variant="ghost"
410
413
  size="xs"
411
414
  tabindex="0"
415
+ class="max-lg:min-h-11"
412
416
  :label="t('cart.actions.print')"
413
417
  @click="printCart"
414
418
  />
@@ -419,6 +423,7 @@ const trustItems = computed(() => {
419
423
  variant="ghost"
420
424
  size="xs"
421
425
  tabindex="0"
426
+ class="max-lg:min-h-11"
422
427
  :label="t('cart.actions.clear')"
423
428
  @click="cart.clearCart()"
424
429
  />
@@ -130,7 +130,7 @@ const messageColor = (severity: string) =>
130
130
  variant="outline"
131
131
  size="sm"
132
132
  tabindex="0"
133
- class="print:hidden"
133
+ class="print:hidden max-lg:min-h-11"
134
134
  :label="t('cart.quickAdd.action')"
135
135
  @click="quickAddOpen = true"
136
136
  />
@@ -178,6 +178,7 @@ const messageColor = (severity: string) =>
178
178
  variant="soft"
179
179
  size="xs"
180
180
  tabindex="0"
181
+ class="max-lg:min-h-11"
181
182
  :label="t('cart.requisition.load')"
182
183
  @click="loadRequisition(requisition)"
183
184
  />
@@ -211,7 +212,7 @@ const messageColor = (severity: string) =>
211
212
  :description="t('cart.emptyState.description')"
212
213
  class="mb-6"
213
214
  />
214
- <div class="grid sm:grid-cols-2 gap-8 items-start">
215
+ <div class="grid grid-cols-1 sm:grid-cols-2 gap-8 items-start">
215
216
  <div
216
217
  v-if="!isReadOnly"
217
218
  class="border border-(--ui-border) rounded-xl p-4 md:p-5 space-y-3"
@@ -341,6 +342,7 @@ const messageColor = (severity: string) =>
341
342
  :title="t('directOrder.title')"
342
343
  :description="t('directOrder.description')"
343
344
  :ui="{ content: 'sm:max-w-4xl' }"
345
+ :close="{ class: 'max-lg:size-11 max-lg:justify-center' }"
344
346
  >
345
347
  <template #body>
346
348
  <AccountDirectOrder
@@ -44,6 +44,8 @@ const shippingCountry = computed(() => {
44
44
  const appConfig = useAppConfig();
45
45
  const earliestDeliveryDays = computed<number>(() =>
46
46
  Number(appConfig.checkout?.earliestDeliveryDays ?? 0));
47
+ /** A date is always sent: prefilled, movable, never cleared (`checkout.requestedDateRequired`). */
48
+ const requestedDateRequired = computed<boolean>(() => Boolean(appConfig.checkout?.requestedDateRequired));
47
49
 
48
50
  const { data: rates, status: ratesStatus } = useFetch<{
49
51
  managed: boolean;
@@ -214,6 +216,7 @@ watch([deliveryOptions, () => form.value.deliveryMethod], ([options, selected])
214
216
  :min-days="earliestDeliveryDays"
215
217
  :max-days="100"
216
218
  disable-weekends
219
+ :clearable="!requestedDateRequired"
217
220
  @input="(value: unknown) => { form.requestedDate = String(value ?? ''); validateField('requestedDate'); }"
218
221
  />
219
222
  <p
@@ -29,12 +29,12 @@ const { b2b: guestB2b, b2c: guestB2c } = useGuestOrdering();
29
29
  </p>
30
30
  </div>
31
31
 
32
- <div class="grid sm:grid-cols-2 gap-10 max-w-5xl">
32
+ <div class="grid grid-cols-1 sm:grid-cols-2 gap-10 max-w-5xl">
33
33
  <AuthLoginPanel @success="emit('signedIn')" />
34
34
 
35
35
  <div
36
36
  v-if="guestB2b || guestB2c"
37
- class="border border-default py-6 px-8 rounded-lg flex flex-col gap-4"
37
+ class="border border-default py-6 px-6 sm:px-8 rounded-lg flex flex-col gap-4"
38
38
  >
39
39
  <h2 class="text-xl font-semibold text-highlighted">
40
40
  {{ t('onepage.gate.guestTitle') }}
@@ -48,6 +48,7 @@ const { b2b: guestB2b, b2c: guestB2c } = useGuestOrdering();
48
48
  variant="outline"
49
49
  block
50
50
  class="min-h-11 lg:min-h-0"
51
+ :ui="{ label: 'whitespace-normal' }"
51
52
  tabindex="0"
52
53
  :icon="icon('company')"
53
54
  :label="t('onepage.gate.guestBusiness')"
@@ -59,6 +60,7 @@ const { b2b: guestB2b, b2c: guestB2c } = useGuestOrdering();
59
60
  variant="outline"
60
61
  block
61
62
  class="min-h-11 lg:min-h-0"
63
+ :ui="{ label: 'whitespace-normal' }"
62
64
  tabindex="0"
63
65
  :icon="icon('user')"
64
66
  :label="t('onepage.gate.guestPrivate')"
@@ -40,7 +40,8 @@ const addressFields: AddressFieldRow[] = [
40
40
 
41
41
  <template>
42
42
  <div class="bg-(--ui-bg) border border-(--ui-border) rounded-xl p-6 space-y-6">
43
- <div class="flex items-center justify-between gap-3">
43
+ <!-- The badge drops under the title when both don't fit (German at 320 px). -->
44
+ <div class="flex flex-wrap items-center justify-between gap-3">
44
45
  <CheckoutSectionTitle
45
46
  :step="1"
46
47
  :title="t('onepage.sections.guestDetails')"
@@ -273,7 +273,7 @@ if (import.meta.client) {
273
273
  <div
274
274
  v-show="!psp.hostedFallback.value"
275
275
  ref="cardEl"
276
- class="w-full sm:max-w-sm p-3 rounded-lg border border-(--ui-border) bg-(--ui-bg)"
276
+ class="w-full sm:max-w-sm p-3 rounded-lg border border-(--ui-border) bg-(--ui-bg) data-[psp-fields=own]:p-0 data-[psp-fields=own]:border-0 data-[psp-fields=own]:rounded-none data-[psp-fields=own]:bg-transparent"
277
277
  />
278
278
  <p v-if="psp.hostedFallback.value" class="text-sm text-muted">{{ t('onepage.payment.cardOnProviderPage') }}</p>
279
279
  <p v-if="cardError" class="text-sm text-error-500">{{ cardError }}</p>
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { marketLanguageOptions } from "../../../shared/locale";
2
+ import { CONTENT_LOCALE_COOKIE, marketLanguageOptions } from "../../../shared/locale";
3
3
 
4
4
  /**
5
5
  * Locale selector (Smashing Magazine, "Designing A Better Language
@@ -20,13 +20,12 @@ const { icon } = useIcons();
20
20
  const { t, locale, locales } = useI18n();
21
21
  const switchLocalePath = useSwitchLocalePath();
22
22
  const localePath = useLocalePath();
23
- const { hasPage, fallbackPath } = useProductLocales();
24
- const runtimeConfig = useRuntimeConfig();
23
+ const { hasPage, fallbackPath, localizePath } = useProductLocales();
25
24
  const { markets } = useMarkets();
26
25
  const { market, setMarket, region, currencies, currency, currencySymbol, setCurrency } = useLocalePreferences(markets);
27
26
 
28
27
  /** The market locale the buyer chose (`de-CH`, `fr-FR`); read by the BFF for catalogue + search. */
29
- const contentLocale = useCookie<string>("cover-content-locale", { default: () => "", watch: true });
28
+ const contentLocale = useCookie<string>(CONTENT_LOCALE_COOKIE, { default: () => "", watch: true });
30
29
 
31
30
  const open = ref(false);
32
31
 
@@ -38,10 +37,7 @@ const marketItems = computed(() => markets.value.map(entry => ({
38
37
 
39
38
  const uiLanguages = computed(() => locales.value.map(entry => entry.code));
40
39
 
41
- const defaultUiLanguage = computed(() => {
42
- const i18nConfig = (runtimeConfig.public as { i18n?: { defaultLocale?: string }; defaultLocale?: string });
43
- return i18nConfig.i18n?.defaultLocale || i18nConfig.defaultLocale || uiLanguages.value[0] || "de";
44
- });
40
+ const defaultUiLanguage = useDefaultUiLanguage();
45
41
 
46
42
  /** The language's own name ("Deutsch", "Français"), for languages without an i18n entry. */
47
43
  function nativeLanguageName(language: string): string {
@@ -68,7 +64,9 @@ interface LanguageItem {
68
64
 
69
65
  /** Where a UI language leads: the same page, or the product's category when the product has no page there (PE-914). */
70
66
  function languageTarget(uiLocale: string): string {
71
- return hasPage(uiLocale) ? switchLocalePath(uiLocale as typeof locale.value) : localePath(fallbackPath.value, uiLocale as typeof locale.value);
67
+ return hasPage(uiLocale)
68
+ ? localizePath(switchLocalePath(uiLocale as typeof locale.value), uiLocale)
69
+ : localePath(fallbackPath.value, uiLocale as typeof locale.value);
72
70
  }
73
71
 
74
72
  const languageItems = computed<LanguageItem[]>(() => {
@@ -160,7 +160,9 @@ onUnmounted(() => {
160
160
 
161
161
  <template>
162
162
  <div class="space-y-4">
163
- <div class="flex gap-3">
163
+ <!-- Wraps on narrow phones: when the stepper and the CTA pair don't fit one
164
+ row (320 px; 375 px in German when signed in), the pair takes the next. -->
165
+ <div class="flex flex-wrap gap-3">
164
166
  <div
165
167
  class="flex items-center rounded-lg border border-(--ui-border) overflow-hidden
166
168
  shrink-0"
@@ -196,16 +198,20 @@ onUnmounted(() => {
196
198
  @click="increase"
197
199
  />
198
200
  </div>
199
- <UButton
200
- :icon="icon('cart')"
201
- size="lg"
202
- class="flex-1 justify-center min-h-11 lg:min-h-0"
203
- tabindex="0"
204
- :label="t('product.actions.addToCart')"
205
- :disabled="quantityInvalid"
206
- @click="addToCart"
207
- />
208
- <slot name="after-cta" />
201
+ <!-- CTA and the after-cta slot (signed in: the order-list button) wrap
202
+ as one pair, so the slot never ends up alone on a second row. -->
203
+ <div class="flex flex-[1_1_10rem] gap-3">
204
+ <UButton
205
+ :icon="icon('cart')"
206
+ size="lg"
207
+ class="flex-1 justify-center min-h-11 lg:min-h-0"
208
+ tabindex="0"
209
+ :label="t('product.actions.addToCart')"
210
+ :disabled="quantityInvalid"
211
+ @click="addToCart"
212
+ />
213
+ <slot name="after-cta" />
214
+ </div>
209
215
  </div>
210
216
 
211
217
  <UiFeedbackErrorBoundary
@@ -17,16 +17,89 @@ const has3d = computed(() => !!props.modelUrl);
17
17
  const initialMode = (): "image" | "model" => (props.images.length || !props.modelUrl ? "image" : "model");
18
18
  const mode = ref<"image" | "model">(initialMode());
19
19
  const selectedIndex = ref(0);
20
- const selectedImage = computed(() => props.images[selectedIndex.value]);
20
+ // The stills sit side by side in a scroll-snap track, so a finger swipe (or a
21
+ // trackpad's sideways scroll) moves between them natively; the track's scroll
22
+ // position is the source of truth for which still is shown.
23
+ const track = ref<HTMLElement | null>(null);
24
+
25
+ // A thumbnail click sets the selection first and then smooth-scrolls the track;
26
+ // the scroll events on the way pass every still in between (and round to the
27
+ // old one first), which would drag the selection back through them. While the
28
+ // code is scrolling, those events are not the user's and are ignored — until
29
+ // `scrollend`, or a timeout where the browser has no `scrollend` (Safari < 18.2).
30
+ const PROGRAMMATIC_SCROLL_TIMEOUT_MS = 1000;
31
+ let isProgrammaticScroll = false;
32
+ let programmaticScrollTimer: ReturnType<typeof setTimeout> | null = null;
33
+
34
+ function endProgrammaticScroll(): void {
35
+ isProgrammaticScroll = false;
36
+ if (programmaticScrollTimer) {
37
+ clearTimeout(programmaticScrollTimer);
38
+ programmaticScrollTimer = null;
39
+ }
40
+ }
41
+
42
+ function scrollTrackTo(index: number, isAnimated: boolean): void {
43
+ const el = track.value;
44
+ if (!el) {
45
+ return;
46
+ }
47
+ const isReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
48
+ const isSmooth = isAnimated && !isReducedMotion;
49
+ endProgrammaticScroll();
50
+ if (isSmooth) {
51
+ isProgrammaticScroll = true;
52
+ programmaticScrollTimer = setTimeout(endProgrammaticScroll, PROGRAMMATIC_SCROLL_TIMEOUT_MS);
53
+ }
54
+ el.scrollTo({ left: index * el.clientWidth, behavior: isSmooth ? "smooth" : "auto" });
55
+ }
56
+
57
+ /** The scroll came to rest: whatever moved it, the still in view is the selected one. */
58
+ function onTrackScrollEnd(): void {
59
+ endProgrammaticScroll();
60
+ onTrackScroll();
61
+ }
62
+
63
+ /** A finger or wheel on the track during a programmatic scroll takes over from it. */
64
+ function onTrackUserInput(): void {
65
+ endProgrammaticScroll();
66
+ }
67
+
68
+ function onTrackScroll(): void {
69
+ const el = track.value;
70
+ if (!el || el.clientWidth === 0 || isProgrammaticScroll) {
71
+ return;
72
+ }
73
+ const index = Math.round(el.scrollLeft / el.clientWidth);
74
+ if (index !== selectedIndex.value && index >= 0 && index < props.images.length) {
75
+ selectedIndex.value = index;
76
+ }
77
+ }
21
78
 
22
79
  function showImage(index: number): void {
80
+ const wasModel = mode.value === "model";
23
81
  selectedIndex.value = index;
24
82
  mode.value = "image";
83
+ // Coming back from 3D the track mounts fresh; the track watcher positions it.
84
+ if (!wasModel) {
85
+ scrollTrackTo(index, true);
86
+ }
25
87
  }
26
88
 
89
+ // A freshly mounted track (first render, or back from the 3D viewer) starts on
90
+ // the selected still.
91
+ watch(track, (el) => {
92
+ if (el) {
93
+ scrollTrackTo(selectedIndex.value, false);
94
+ }
95
+ });
96
+
97
+ onBeforeUnmount(endProgrammaticScroll);
98
+
27
99
  watch([() => props.images, () => props.modelUrl], () => {
28
100
  selectedIndex.value = 0;
29
101
  mode.value = initialMode();
102
+ scrollTrackTo(0, false);
30
103
  });
31
104
  </script>
32
105
 
@@ -34,7 +107,7 @@ watch([() => props.images, () => props.modelUrl], () => {
34
107
  <div class="flex flex-col gap-3">
35
108
  <div
36
109
  class="w-full aspect-square rounded-2xl overflow-hidden bg-elevated/60
37
- ring-1 ring-(--ui-border) flex items-center justify-center p-8"
110
+ ring-1 ring-(--ui-border) flex items-center justify-center"
38
111
  >
39
112
  <!-- Interactive 3D (sovereign three.js engine; no AR). The square box
40
113
  gives model-viewer a definite height so its canvas doesn't collapse. -->
@@ -43,14 +116,34 @@ watch([() => props.images, () => props.modelUrl], () => {
43
116
  :src="modelUrl"
44
117
  :poster="modelPoster || undefined"
45
118
  auto-rotate
46
- class="w-full h-full"
119
+ class="w-full h-full p-8"
47
120
  />
48
- <img
49
- v-else-if="selectedImage"
50
- :src="getImageUrl(selectedImage.url)"
51
- :alt="`Product image ${selectedIndex + 1}`"
52
- class="max-w-full max-h-full object-contain"
121
+ <div
122
+ v-else-if="images.length"
123
+ ref="track"
124
+ class="flex w-full h-full overflow-x-auto overflow-y-hidden snap-x snap-mandatory overscroll-x-contain
125
+ [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
126
+ data-testid="gallery-track"
127
+ @scroll.passive="onTrackScroll"
128
+ @scrollend="onTrackScrollEnd"
129
+ @touchstart.passive="onTrackUserInput"
130
+ @wheel.passive="onTrackUserInput"
131
+ @pointerdown="onTrackUserInput"
53
132
  >
133
+ <div
134
+ v-for="(image, index) in images"
135
+ :key="image.url"
136
+ class="w-full h-full shrink-0 snap-center snap-always flex items-center justify-center p-8"
137
+ >
138
+ <img
139
+ :src="getImageUrl(image.url)"
140
+ :alt="`Product image ${index + 1}`"
141
+ :loading="index === 0 ? 'eager' : 'lazy'"
142
+ draggable="false"
143
+ class="max-w-full max-h-full object-contain"
144
+ >
145
+ </div>
146
+ </div>
54
147
  </div>
55
148
 
56
149
  <div
@@ -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>