@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.
- package/app/api/categories.ts +1 -0
- package/app/api/offers.ts +1 -0
- package/app/app.config.ts +13 -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 +20 -8
- package/app/components/cart/view/CartView.vue +4 -2
- 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/checkout/onepage/CheckoutSummarySection.vue +8 -0
- package/app/components/checkout/return/CheckoutPaymentReturn.vue +7 -0
- package/app/components/layout/footer/Footer.vue +21 -4
- package/app/components/layout/header/AppBar.vue +5 -2
- package/app/components/layout/header/LocaleSwitcher.vue +7 -9
- package/app/components/layout/header/MobileMenu.vue +4 -1
- 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/punchout/action/PunchoutTransferAction.vue +4 -3
- 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/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/usePunchoutVisit.ts +36 -1
- 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/interfaces/punchout.ts +11 -0
- package/app/interfaces/seo.ts +48 -0
- package/app/layouts/default.vue +2 -8
- package/app/layouts/focus.vue +3 -1
- package/app/middleware/punchout-exits.global.ts +25 -0
- package/app/payments/psp/novalnet.ts +25 -3
- package/app/payments/psp/novalnetStyle.ts +186 -0
- package/app/plugins/punchout-links.client.ts +46 -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/punchoutExits.ts +156 -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/common.json +6 -0
- package/i18n/locales/de/pages.json +109 -0
- package/i18n/locales/de/punchout.json +3 -0
- package/i18n/locales/en/account.json +4 -0
- package/i18n/locales/en/common.json +6 -0
- package/i18n/locales/en/pages.json +109 -0
- package/i18n/locales/en/punchout.json +3 -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 -11
- 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/interfaces/punchout.ts +20 -1
- package/server/middleware/missing-media.ts +2 -2
- package/server/middleware/punchout-exits.ts +45 -0
- package/server/middleware/punchout-visit-csp.ts +35 -0
- package/server/plugins/previewHostNoindex.ts +21 -0
- package/server/plugins/punchout-cookies.ts +48 -0
- package/server/plugins/seoSiteConfig.ts +62 -0
- package/server/routes/punchout/start.get.ts +7 -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/punchoutFrame.ts +131 -0
- package/server/utils/punchoutOrder.ts +40 -0
- package/server/utils/punchoutVisit.ts +41 -8
- 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
- package/server/middleware/punchout-hand-back-csp.ts +0 -17
|
@@ -18,11 +18,12 @@ const cart = useCartStore();
|
|
|
18
18
|
const actions = useCartActions();
|
|
19
19
|
const { calculation, pending } = useCartCalculation();
|
|
20
20
|
const { settings, role, workflows } = useB2BContext();
|
|
21
|
-
// Inside a punchout visit the cart
|
|
22
|
-
// back to the buyer's own procurement system, which decides
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
|
|
21
|
+
// Inside a punchout visit the cart ends where the account's purchase mode says
|
|
22
|
+
// (RAD-226): handed back to the buyer's own procurement system, which decides
|
|
23
|
+
// (`transfer`), or ordered here (`order`, `order_and_transfer`). Outside the
|
|
24
|
+
// checkout of an ordering visit, the checkout CTA is replaced rather than
|
|
25
|
+
// joined — two primary actions would be an invitation to order twice.
|
|
26
|
+
const { isPunchout, isReadOnly, offersCheckout, ordersThenHandsBack } = usePunchoutVisit();
|
|
26
27
|
const { formatCurrency } = useCartSummaryFormatting();
|
|
27
28
|
|
|
28
29
|
const codeInput = ref("");
|
|
@@ -264,12 +265,14 @@ const trustItems = computed(() => {
|
|
|
264
265
|
:placeholder="t('cart.summary.voucherPlaceholder')"
|
|
265
266
|
size="sm"
|
|
266
267
|
class="flex-1"
|
|
268
|
+
:ui="{ base: 'max-lg:min-h-11' }"
|
|
267
269
|
:disabled="codesFull"
|
|
268
270
|
@keyup.enter="applyCode"
|
|
269
271
|
/>
|
|
270
272
|
<UButton
|
|
271
273
|
size="sm"
|
|
272
274
|
variant="subtle"
|
|
275
|
+
class="max-lg:min-h-11"
|
|
273
276
|
:disabled="!codeInput.trim() || codesFull"
|
|
274
277
|
@click="applyCode"
|
|
275
278
|
>
|
|
@@ -329,13 +332,13 @@ const trustItems = computed(() => {
|
|
|
329
332
|
|
|
330
333
|
<CartApprovalsPanel :limits="calculation?.approvalLimits ?? []" />
|
|
331
334
|
|
|
332
|
-
<PunchoutTransferAction v-if="isPunchout" />
|
|
335
|
+
<PunchoutTransferAction v-if="isPunchout && !offersCheckout" />
|
|
333
336
|
<template v-else-if="quoteMessage">
|
|
334
337
|
<UButton
|
|
335
338
|
color="primary"
|
|
336
339
|
variant="solid"
|
|
337
340
|
size="lg"
|
|
338
|
-
class="w-full justify-center mt-2"
|
|
341
|
+
class="w-full justify-center mt-2 max-lg:min-h-11"
|
|
339
342
|
:icon="icon('file')"
|
|
340
343
|
:loading="pending"
|
|
341
344
|
:label="t('cart.quote.action')"
|
|
@@ -355,7 +358,7 @@ const trustItems = computed(() => {
|
|
|
355
358
|
color="primary"
|
|
356
359
|
variant="solid"
|
|
357
360
|
size="lg"
|
|
358
|
-
class="w-full justify-center mt-2"
|
|
361
|
+
class="w-full justify-center mt-2 max-lg:min-h-11"
|
|
359
362
|
:disabled="!orderable"
|
|
360
363
|
:loading="pending"
|
|
361
364
|
:label="isRequester ? t('cart.cta.requisition') : t('cart.cta.checkout')"
|
|
@@ -368,6 +371,12 @@ const trustItems = computed(() => {
|
|
|
368
371
|
>
|
|
369
372
|
{{ t('cart.cta.notOrderable') }}
|
|
370
373
|
</p>
|
|
374
|
+
<p
|
|
375
|
+
v-else-if="ordersThenHandsBack"
|
|
376
|
+
class="text-xs text-muted text-center"
|
|
377
|
+
>
|
|
378
|
+
{{ t('punchout.orderAndTransfer.hint') }}
|
|
379
|
+
</p>
|
|
371
380
|
</template>
|
|
372
381
|
|
|
373
382
|
<!-- Trust: the promises that close B2B orders -->
|
|
@@ -399,6 +408,7 @@ const trustItems = computed(() => {
|
|
|
399
408
|
variant="ghost"
|
|
400
409
|
size="xs"
|
|
401
410
|
tabindex="0"
|
|
411
|
+
class="max-lg:min-h-11"
|
|
402
412
|
:label="t('cart.export.action')"
|
|
403
413
|
@click="actions.open('export', [])"
|
|
404
414
|
/>
|
|
@@ -409,6 +419,7 @@ const trustItems = computed(() => {
|
|
|
409
419
|
variant="ghost"
|
|
410
420
|
size="xs"
|
|
411
421
|
tabindex="0"
|
|
422
|
+
class="max-lg:min-h-11"
|
|
412
423
|
:label="t('cart.actions.print')"
|
|
413
424
|
@click="printCart"
|
|
414
425
|
/>
|
|
@@ -419,6 +430,7 @@ const trustItems = computed(() => {
|
|
|
419
430
|
variant="ghost"
|
|
420
431
|
size="xs"
|
|
421
432
|
tabindex="0"
|
|
433
|
+
class="max-lg:min-h-11"
|
|
422
434
|
:label="t('cart.actions.clear')"
|
|
423
435
|
@click="cart.clearCart()"
|
|
424
436
|
/>
|
|
@@ -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
|
|
@@ -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
|
-
|
|
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>
|
|
@@ -17,6 +17,7 @@ const isRequester = computed(() => role.value === "requester");
|
|
|
17
17
|
const selectedWorkflowId = useState<string | null>("cart-selected-workflow", () => null);
|
|
18
18
|
const { to } = useAppUrl();
|
|
19
19
|
const cart = useCartStore();
|
|
20
|
+
const { ordersThenHandsBack, refresh: refreshPunchoutVisit } = usePunchoutVisit();
|
|
20
21
|
const { formatCurrency } = useCartSummaryFormatting();
|
|
21
22
|
|
|
22
23
|
// The checkout shows the same server-calculated document as the cart,
|
|
@@ -49,6 +50,13 @@ async function handlePlaceOrder() {
|
|
|
49
50
|
|
|
50
51
|
validateField("acceptedTerms");
|
|
51
52
|
const result = await submitOrder();
|
|
53
|
+
// `order_and_transfer` (RAD-226): one step — the order, then the hand-back
|
|
54
|
+
// of the ordered cart, which the hand-back page fetches and submits.
|
|
55
|
+
if (result && ordersThenHandsBack.value) {
|
|
56
|
+
await refreshPunchoutVisit();
|
|
57
|
+
await navigateTo(to("/punchout/transfer"));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
52
60
|
if (result) {
|
|
53
61
|
await navigateTo(to("/checkout/confirmation", {
|
|
54
62
|
id: result.orderId,
|
|
@@ -22,6 +22,7 @@ const { icon } = useIcons();
|
|
|
22
22
|
const { to } = useAppUrl();
|
|
23
23
|
const localePath = useLocalePath();
|
|
24
24
|
const route = useRoute();
|
|
25
|
+
const { ordersThenHandsBack, refresh: refreshPunchoutVisit } = usePunchoutVisit();
|
|
25
26
|
|
|
26
27
|
const orderId = computed(() => {
|
|
27
28
|
const raw = route.query[PSP_RETURN_ORDER_PARAM];
|
|
@@ -52,6 +53,12 @@ async function confirm(): Promise<void> {
|
|
|
52
53
|
);
|
|
53
54
|
canRetryFromAccount.value = answer.canRetryFromAccount;
|
|
54
55
|
retryUrl.value = answer.retryUrl ?? null;
|
|
56
|
+
if (answer.outcome === "paid" && ordersThenHandsBack.value) {
|
|
57
|
+
// `order_and_transfer` (RAD-226): the paid order is handed back next.
|
|
58
|
+
await refreshPunchoutVisit();
|
|
59
|
+
await navigateTo(to("/punchout/transfer"), { replace: true });
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
55
62
|
if (answer.outcome === "paid") {
|
|
56
63
|
await navigateTo(to("/checkout/confirmation", { id: answer.orderId }), { replace: true });
|
|
57
64
|
return;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { ShopContact } from "../../../config/navigation";
|
|
3
3
|
import { footerLinks as defaultFooterLinks, legalLinks as defaultLegalLinks, shopContact as noContact, withdrawalPath } from "../../../config/navigation";
|
|
4
|
+
import { punchoutRefusal } from "../../../shared/punchoutExits";
|
|
4
5
|
|
|
5
6
|
// Consumers replace the footer columns / legal links, in priority order:
|
|
6
7
|
// per-request live menus (useState, e.g. the Blokkli theme from the pages app)
|
|
@@ -14,11 +15,24 @@ import { footerLinks as defaultFooterLinks, legalLinks as defaultLegalLinks, sho
|
|
|
14
15
|
const appConfig = useAppConfig();
|
|
15
16
|
const liveFooterLinks = useState<{ heading: string; links: { label: string; to: string }[] }[] | null>("cover:nav:footerLinks", () => null);
|
|
16
17
|
const liveLegalLinks = useState<{ label: string; to: string }[] | null>("cover:nav:legalLinks", () => null);
|
|
17
|
-
|
|
18
|
+
// Punchout mode (RAD-226): a live visit has one way out, its own action in the
|
|
19
|
+
// cart, so the footer keeps only the links that stay inside the shop and lead
|
|
20
|
+
// somewhere the visit may go — no external site, no account page.
|
|
21
|
+
const { isRestricted, visit } = usePunchoutVisit();
|
|
22
|
+
const staysInVisit = (to: string) => !isRestricted.value || (to.startsWith("/") && !to.startsWith("//") && !punchoutRefusal(to, "GET", visit.value));
|
|
23
|
+
const footerLinks = computed(() => {
|
|
24
|
+
const groups = liveFooterLinks.value ?? (appConfig.footerLinks as typeof defaultFooterLinks | undefined) ?? defaultFooterLinks;
|
|
25
|
+
if (!isRestricted.value || !Array.isArray(groups)) {
|
|
26
|
+
return groups;
|
|
27
|
+
}
|
|
28
|
+
return groups
|
|
29
|
+
.map(group => ({ ...group, links: group.links.filter(link => staysInVisit(link.to)) }))
|
|
30
|
+
.filter(group => group.links.length > 0);
|
|
31
|
+
});
|
|
18
32
|
// The withdrawal entry is rendered on its own below, so a tenant menu that
|
|
19
33
|
// already lists it does not print it twice.
|
|
20
34
|
const legalLinks = computed(() => (liveLegalLinks.value ?? (appConfig.legalLinks as typeof defaultLegalLinks | undefined) ?? defaultLegalLinks)
|
|
21
|
-
.filter(link => link.to !== withdrawalPath));
|
|
35
|
+
.filter(link => link.to !== withdrawalPath && staysInVisit(link.to)));
|
|
22
36
|
// The shop's own contact details. The design system holds none, so a storefront
|
|
23
37
|
// that states nothing prints nothing rather than somebody else's address.
|
|
24
38
|
const shopContact = computed<ShopContact>(() => (appConfig.shopContact as ShopContact | undefined) ?? noContact);
|
|
@@ -166,8 +180,11 @@ const year = new Date().getFullYear();
|
|
|
166
180
|
</ConsentPreferencesLink>
|
|
167
181
|
</nav>
|
|
168
182
|
|
|
169
|
-
<!-- Social icons -->
|
|
170
|
-
<div
|
|
183
|
+
<!-- Social icons — not in a punchout visit, which never leaves the shop -->
|
|
184
|
+
<div
|
|
185
|
+
v-if="!isRestricted"
|
|
186
|
+
class="flex items-center gap-1"
|
|
187
|
+
>
|
|
171
188
|
<UButton
|
|
172
189
|
to="https://linkedin.com"
|
|
173
190
|
target="_blank"
|
|
@@ -41,6 +41,8 @@ onMounted(() => {
|
|
|
41
41
|
onUnmounted(() => mq?.removeEventListener("change", closeMenu));
|
|
42
42
|
|
|
43
43
|
const { navigateToSearch } = useSearch();
|
|
44
|
+
// Punchout mode (RAD-226): the account area and signing in or out are hidden.
|
|
45
|
+
const { isRestricted } = usePunchoutVisit();
|
|
44
46
|
</script>
|
|
45
47
|
|
|
46
48
|
<template>
|
|
@@ -70,13 +72,14 @@ const { navigateToSearch } = useSearch();
|
|
|
70
72
|
|
|
71
73
|
<template #right>
|
|
72
74
|
<LayoutHeaderActionItem
|
|
73
|
-
v-if="features.directOrder !== false"
|
|
75
|
+
v-if="features.directOrder !== false && !isRestricted"
|
|
74
76
|
:icon="icon('direct-order')"
|
|
75
77
|
:label="t('topbar.directOrder')"
|
|
76
78
|
:to="localePath('/account/direct-order')"
|
|
77
79
|
class="hidden md:flex"
|
|
78
80
|
/>
|
|
79
|
-
|
|
81
|
+
<!-- Not in a punchout visit: it has no account area, and signing in or out is not its exit (RAD-226) -->
|
|
82
|
+
<AccountMenu v-if="!isRestricted" />
|
|
80
83
|
<CartButton />
|
|
81
84
|
</template>
|
|
82
85
|
|
|
@@ -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>(
|
|
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 =
|
|
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)
|
|
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[]>(() => {
|
|
@@ -9,6 +9,7 @@ const { categoryNavItems } = useCategories();
|
|
|
9
9
|
// buyer on a phone had no way to search at all.
|
|
10
10
|
const { navigateToSearch } = useSearch();
|
|
11
11
|
const auth = useAuthStore();
|
|
12
|
+
const { isRestricted } = usePunchoutVisit();
|
|
12
13
|
const toast = useToast();
|
|
13
14
|
const { t } = useI18n();
|
|
14
15
|
const localePath = useLocalePath();
|
|
@@ -66,7 +67,9 @@ const onLogout = async () => {
|
|
|
66
67
|
|
|
67
68
|
<USeparator class="md:hidden" />
|
|
68
69
|
|
|
69
|
-
|
|
70
|
+
<!-- Punchout mode (RAD-226): no account area, no signing in or out -->
|
|
71
|
+
<template v-if="isRestricted" />
|
|
72
|
+
<template v-else-if="auth.isLoggedIn">
|
|
70
73
|
<UNavigationMenu
|
|
71
74
|
:items="accountLinks"
|
|
72
75
|
orientation="vertical"
|
|
@@ -160,7 +160,9 @@ onUnmounted(() => {
|
|
|
160
160
|
|
|
161
161
|
<template>
|
|
162
162
|
<div class="space-y-4">
|
|
163
|
-
|
|
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
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
<
|
|
49
|
-
v-else-if="
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|