@revenexx/cover 0.10.1 → 0.11.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 (107) hide show
  1. package/app/api/account.ts +4 -0
  2. package/app/assets/css/cover.css +9 -0
  3. package/app/components/RevenexxForm.vue +4 -0
  4. package/app/components/account/AccountSidebar.vue +2 -5
  5. package/app/components/account/dashboard/AccountDashboardKpis.vue +74 -34
  6. package/app/components/account/dashboard/AccountDashboardQuickActions.vue +24 -6
  7. package/app/components/account/organization/AccountOrganization.vue +3 -1
  8. package/app/components/account/team/AccountTeam.vue +32 -7
  9. package/app/components/auth/AuthForgotPasswordPanel.vue +9 -4
  10. package/app/components/auth/AuthLoginPanel.vue +5 -3
  11. package/app/components/cart/actions/CartSaveToListModal.vue +5 -0
  12. package/app/components/cart/item/CartItem.vue +17 -75
  13. package/app/components/cart/position/CartPosition.vue +17 -30
  14. package/app/components/cart/quote/CartQuoteRequestModal.vue +9 -1
  15. package/app/components/category/view/GridView.vue +10 -1
  16. package/app/components/category/view/ListView.vue +10 -1
  17. package/app/components/checkout/confirmation/CheckoutConfirmationActions.vue +2 -0
  18. package/app/components/checkout/onepage/CheckoutAddressSection.vue +4 -4
  19. package/app/components/checkout/onepage/CheckoutDeliverySection.vue +18 -2
  20. package/app/components/checkout/onepage/CheckoutGate.vue +2 -0
  21. package/app/components/checkout/onepage/CheckoutOnePageView.vue +1 -1
  22. package/app/components/checkout/onepage/CheckoutPaymentSection.vue +10 -0
  23. package/app/components/checkout/onepage/CheckoutSummarySection.vue +7 -1
  24. package/app/components/layout/Region.vue +13 -0
  25. package/app/components/layout/footer/Footer.vue +8 -0
  26. package/app/components/layout/header/AppBar.vue +4 -3
  27. package/app/components/layout/header/MainNav.vue +3 -3
  28. package/app/components/listing/ListingResults.vue +3 -1
  29. package/app/components/product/card/Compact.vue +10 -1
  30. package/app/components/product/detail/ProductDetailAddToCart.vue +51 -18
  31. package/app/components/product/detail/ProductDetailIdentity.vue +1 -1
  32. package/app/components/product/detail/ProductDetailPriceRequest.vue +1 -1
  33. package/app/components/product/detail/ProductDetailSaveToList.vue +10 -0
  34. package/app/composables/useAccountDashboard.ts +0 -10
  35. package/app/composables/useAccountNavigation.ts +35 -0
  36. package/app/composables/useAuthStore.ts +2 -0
  37. package/app/composables/useCategoryListing.ts +6 -0
  38. package/app/composables/useCheckoutOnePage.ts +21 -2
  39. package/app/composables/useMasterDataEditable.ts +23 -0
  40. package/app/composables/useProductCard.ts +29 -2
  41. package/app/composables/useProductListing.ts +79 -0
  42. package/app/composables/useQuantityStepper.ts +90 -0
  43. package/app/composables/useQuickActions.ts +35 -0
  44. package/app/composables/useRoleGrants.ts +32 -0
  45. package/app/composables/useSearchListing.ts +4 -0
  46. package/app/composables/useThemeEvents.ts +144 -0
  47. package/app/config/accountDashboard.ts +26 -0
  48. package/app/config/quickActions.ts +40 -5
  49. package/app/interfaces/account/dashboard.ts +2 -0
  50. package/app/interfaces/auth.ts +13 -2
  51. package/app/interfaces/quantity-stepper.ts +17 -0
  52. package/app/layouts/default.vue +19 -10
  53. package/app/layouts/focus.vue +28 -7
  54. package/app/middleware/checkout-guard.ts +7 -1
  55. package/app/pages/punchout/transfer.vue +22 -0
  56. package/app/plugins/theme-events.client.ts +132 -0
  57. package/app/shared/themeEvents.ts +445 -0
  58. package/i18n/locales/de/account.json +7 -0
  59. package/i18n/locales/de/auth.json +1 -0
  60. package/i18n/locales/de/cart.json +2 -1
  61. package/i18n/locales/de/checkout.json +2 -1
  62. package/i18n/locales/de/common.json +2 -0
  63. package/i18n/locales/de/cover.json +44 -0
  64. package/i18n/locales/de/editor.json +47 -1
  65. package/i18n/locales/en/account.json +7 -0
  66. package/i18n/locales/en/auth.json +1 -0
  67. package/i18n/locales/en/cart.json +2 -1
  68. package/i18n/locales/en/checkout.json +2 -1
  69. package/i18n/locales/en/common.json +2 -0
  70. package/i18n/locales/en/cover.json +44 -0
  71. package/i18n/locales/en/editor.json +47 -1
  72. package/nuxt.config.ts +15 -1
  73. package/package.json +5 -2
  74. package/server/api/account/orders/[id]/cancel.post.ts +1 -1
  75. package/server/api/account/orders/[id]/messages.get.ts +1 -1
  76. package/server/api/account/orders/[id]/messages.post.ts +1 -1
  77. package/server/api/account/orders/[id]/return.post.ts +1 -0
  78. package/server/api/account/orders/[id].get.ts +1 -1
  79. package/server/api/account/pending-approvals/index.get.ts +1 -0
  80. package/server/api/account/profile.get.ts +3 -1
  81. package/server/api/auth/login.post.ts +6 -0
  82. package/server/api/auth/magic-link.put.ts +6 -1
  83. package/server/api/auth/otp.put.ts +6 -1
  84. package/server/api/carts/[id]/activate.post.ts +1 -0
  85. package/server/api/carts/[id]/index.delete.ts +1 -0
  86. package/server/api/carts/[id]/index.put.ts +1 -0
  87. package/server/api/carts/[id]/items.post.ts +1 -0
  88. package/server/api/orders/index.post.ts +33 -0
  89. package/server/api/quick-actions.get.ts +6 -38
  90. package/server/middleware/buyer-principal.ts +18 -0
  91. package/server/routes/punchout/start.get.ts +2 -2
  92. package/server/services/ApiAddressBookService.ts +43 -1
  93. package/server/services/ApiAuthService.ts +98 -17
  94. package/server/services/ApiCartService.ts +3 -10
  95. package/server/services/ApiOrganizationService.ts +7 -2
  96. package/server/services/ApiTeamService.ts +93 -21
  97. package/server/utils/buyerIdentity.ts +168 -0
  98. package/server/utils/cartOwnership.ts +27 -0
  99. package/server/utils/liveOrderLists.ts +50 -23
  100. package/server/utils/liveOrders.ts +39 -24
  101. package/server/utils/livePrices.ts +7 -15
  102. package/server/utils/masterData.ts +29 -0
  103. package/server/utils/passwordlessSignIn.ts +13 -4
  104. package/server/utils/pendingApprovals.ts +29 -7
  105. package/server/utils/procurementCheckout.ts +2 -0
  106. package/server/utils/quickActionCatalogue.ts +53 -0
  107. package/server/utils/revenexxSdk.ts +116 -2
@@ -1,4 +1,6 @@
1
1
  <script setup lang="ts">
2
+ import { cartEcommerce } from "../../../shared/themeEvents";
3
+
2
4
  /**
3
5
  * Send the cart in as a quotation request (RX-783).
4
6
  *
@@ -23,6 +25,7 @@ const validityDays = computed(() => quoteTermsForRequest.value?.defaultValidityD
23
25
  const localePath = useLocalePath();
24
26
  const toast = useToast();
25
27
  const cart = useCartStore();
28
+ const themeEvents = useThemeEvents();
26
29
  const { request, submitting } = useQuoteRequest();
27
30
  const { data: profile, status: profileStatus } = useCheckoutProfileSource();
28
31
 
@@ -45,8 +48,10 @@ const canSubmit = computed(() => Boolean(shippingAddressId.value && billingAddre
45
48
 
46
49
  async function submit(): Promise<void> {
47
50
  try {
51
+ // What goes into the quote, read before the cart is handed over below.
52
+ const quoted = cart.items.filter(i => !i.requisitionId);
48
53
  const result = await request({
49
- items: cart.items.filter(i => !i.requisitionId).map(i => ({
54
+ items: quoted.map(i => ({
50
55
  id: String(i.id),
51
56
  sku: i.sku,
52
57
  name: i.name,
@@ -59,6 +64,9 @@ async function submit(): Promise<void> {
59
64
  ...(note.value.trim() ? { note: note.value.trim() } : {}),
60
65
  ...(props.reason ? { reason: props.reason } : {}),
61
66
  });
67
+ if (quoted.length) {
68
+ themeEvents.emit("request_quote", { ecommerce: cartEcommerce(quoted) });
69
+ }
62
70
  // The server handed the cart over to the quote; the local copy follows.
63
71
  cart.clearCart();
64
72
  open.value = false;
@@ -7,6 +7,10 @@ const props = withDefaults(defineProps<{
7
7
  showOrderIcon?: boolean;
8
8
  /** Look of the order button when the product can't be bought. */
9
9
  disabledOrderStyle?: "default" | "muted";
10
+ /** The list this card is shown in, reported when it is opened. */
11
+ listId?: string;
12
+ /** 1-based position in that list. */
13
+ listPosition?: number;
10
14
  }>(), {
11
15
  showOrderIcon: true,
12
16
  disabledOrderStyle: "default",
@@ -14,7 +18,10 @@ const props = withDefaults(defineProps<{
14
18
 
15
19
  const { t } = useI18n();
16
20
  const { icon } = useIcons();
17
- const { url } = useProductCard(() => props.product);
21
+ const { url, select } = useProductCard(
22
+ () => props.product,
23
+ () => ({ listId: props.listId, position: props.listPosition }),
24
+ );
18
25
  const { isOutOfStock, hasPrice, addToCart } = useProductCardActions(() => props.product);
19
26
 
20
27
  const orderDisabled = computed(() => isOutOfStock.value || !hasPrice.value);
@@ -40,6 +47,7 @@ const orderButtonClass = computed(() => {
40
47
  <template #header>
41
48
  <NuxtLink
42
49
  :to="url"
50
+ @click="select"
43
51
  :aria-label="`View ${product.name}`"
44
52
  tabindex="0"
45
53
  class="block focus-visible:outline-none focus-visible:ring-2
@@ -57,6 +65,7 @@ const orderButtonClass = computed(() => {
57
65
  <div class="flex flex-col gap-2">
58
66
  <NuxtLink
59
67
  :to="url"
68
+ @click="select"
60
69
  tabindex="0"
61
70
  class="text-m font-medium text-highlighted leading-snug
62
71
  hover:text-(--ui-primary) transition-colors"
@@ -3,10 +3,17 @@ import type { ProductList } from "../../../interfaces/product-list";
3
3
 
4
4
  const props = defineProps<{
5
5
  product: ProductList;
6
+ /** The list this card is shown in, reported when it is opened. */
7
+ listId?: string;
8
+ /** 1-based position in that list. */
9
+ listPosition?: number;
6
10
  }>();
7
11
 
8
12
  const { t } = useI18n();
9
- const { url } = useProductCard(() => props.product);
13
+ const { url, select } = useProductCard(
14
+ () => props.product,
15
+ () => ({ listId: props.listId, position: props.listPosition }),
16
+ );
10
17
  const { isOutOfStock, hasPrice, addToCart } = useProductCardActions(() => props.product);
11
18
  </script>
12
19
 
@@ -18,6 +25,7 @@ const { isOutOfStock, hasPrice, addToCart } = useProductCardActions(() => props.
18
25
  <div class="flex flex-row items-center gap-4 p-4">
19
26
  <NuxtLink
20
27
  :to="url"
28
+ @click="select"
21
29
  :aria-label="`View ${product.name}`"
22
30
  tabindex="0"
23
31
  class="shrink-0 focus-visible:outline-none focus-visible:ring-2
@@ -34,6 +42,7 @@ const { isOutOfStock, hasPrice, addToCart } = useProductCardActions(() => props.
34
42
  <div class="flex-1 min-w-0 flex flex-col gap-1">
35
43
  <NuxtLink
36
44
  :to="url"
45
+ @click="select"
37
46
  tabindex="0"
38
47
  class="text-base font-medium text-highlighted leading-snug
39
48
  hover:text-(--ui-primary) transition-colors truncate"
@@ -34,6 +34,7 @@ function continueShopping() {
34
34
  <UButton
35
35
  color="primary"
36
36
  size="lg"
37
+ class="min-h-11 lg:min-h-0"
37
38
  tabindex="0"
38
39
  :label="t('confirmation.continueShopping')"
39
40
  :trailing-icon="icon('arrow-right')"
@@ -44,6 +45,7 @@ function continueShopping() {
44
45
  color="neutral"
45
46
  variant="outline"
46
47
  size="lg"
48
+ class="min-h-11 lg:min-h-0"
47
49
  tabindex="0"
48
50
  :label="type === 'requisition' ? t('confirmation.viewRequisition') : t('confirmation.viewOrder')"
49
51
  :to="detailLink"
@@ -34,12 +34,12 @@ function changeBilling() {
34
34
  <!-- Shipping + billing side by side -->
35
35
  <div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
36
36
  <!-- Shipping address -->
37
- <div class="space-y-2">
37
+ <div class="flex flex-col gap-2">
38
38
  <p class="text-sm font-medium text-muted">
39
39
  {{ t('onepage.address.shipping') }}
40
40
  </p>
41
41
  <div
42
- class="flex items-start justify-between gap-4 p-4 rounded-lg h-full
42
+ class="flex-1 flex items-start justify-between gap-4 p-4 rounded-lg
43
43
  border border-(--ui-border) bg-(--ui-bg-elevated)"
44
44
  >
45
45
  <!-- Loading skeleton -->
@@ -92,12 +92,12 @@ function changeBilling() {
92
92
  </div>
93
93
 
94
94
  <!-- Billing address -->
95
- <div class="space-y-2">
95
+ <div class="flex flex-col gap-2">
96
96
  <p class="text-sm font-medium text-muted">
97
97
  {{ t('onepage.address.billing') }}
98
98
  </p>
99
99
  <div
100
- class="flex items-start justify-between gap-4 p-4 rounded-lg h-full
100
+ class="flex-1 flex items-start justify-between gap-4 p-4 rounded-lg
101
101
  border border-(--ui-border) bg-(--ui-bg-elevated)"
102
102
  >
103
103
  <!-- Loading skeleton -->
@@ -1,7 +1,8 @@
1
1
  <script setup lang="ts">
2
2
  import CheckoutSectionTitle from "./CheckoutSectionTitle.vue";
3
3
 
4
- import type { DeliveryOption } from "../../../interfaces/delivery";
4
+ import type { DeliveryMethod, DeliveryOption } from "../../../interfaces/delivery";
5
+ import { cartEcommerce } from "../../../shared/themeEvents";
5
6
 
6
7
  const { icon } = useIcons();
7
8
  const { t, locale } = useI18n();
@@ -11,6 +12,21 @@ const partialShipmentAllowed = computed(() => (orders.value?.partialShipment ??
11
12
  const { form, profile, profileLoading, fieldErrors, validateField } = useCheckoutOnePage();
12
13
  const { formatCurrency } = useCartSummaryFormatting();
13
14
  const cartStore = useCartStore();
15
+ const themeEvents = useThemeEvents();
16
+
17
+ /**
18
+ * The buyer chose how it is delivered. Reported as `add_shipping_info` on the
19
+ * buyer's own choice only — never for the default the section preselects.
20
+ */
21
+ function selectDelivery(method: DeliveryMethod): void {
22
+ const changed = form.value.deliveryMethod !== method;
23
+ form.value.deliveryMethod = method;
24
+ if (changed && cartStore.items.length) {
25
+ themeEvents.emit("add_shipping_info", {
26
+ ecommerce: cartEcommerce(cartStore.items, { shipping_tier: String(method).slice(0, 64) }),
27
+ });
28
+ }
29
+ }
14
30
 
15
31
  // "How can THIS order ship?" — the BFF resolves it (live: shipping app
16
32
  // incl. matrix pricing/free-above/country restrictions; mock: the demo
@@ -144,7 +160,7 @@ watch([deliveryOptions, () => form.value.deliveryMethod], ([options, selected])
144
160
  ? 'border-(--ui-primary) bg-primary/5 ring-1 ring-(--ui-primary)'
145
161
  : 'border-(--ui-border) hover:border-(--ui-border-accented)'"
146
162
  :aria-pressed="form.deliveryMethod === option.method"
147
- @click="form.deliveryMethod = option.method"
163
+ @click="selectDelivery(option.method)"
148
164
  >
149
165
  <div class="flex items-start justify-between gap-3">
150
166
  <div class="min-w-0">
@@ -47,6 +47,7 @@ const { b2b: guestB2b, b2c: guestB2c } = useGuestOrdering();
47
47
  color="neutral"
48
48
  variant="outline"
49
49
  block
50
+ class="min-h-11 lg:min-h-0"
50
51
  tabindex="0"
51
52
  :icon="icon('company')"
52
53
  :label="t('onepage.gate.guestBusiness')"
@@ -57,6 +58,7 @@ const { b2b: guestB2b, b2c: guestB2c } = useGuestOrdering();
57
58
  color="neutral"
58
59
  variant="outline"
59
60
  block
61
+ class="min-h-11 lg:min-h-0"
60
62
  tabindex="0"
61
63
  :icon="icon('user')"
62
64
  :label="t('onepage.gate.guestPrivate')"
@@ -54,7 +54,7 @@ async function onSignedIn(): Promise<void> {
54
54
  </h1>
55
55
  </div>
56
56
 
57
- <div class="grid lg:grid-cols-[1fr_360px] xl:grid-cols-[1fr_420px] gap-8 items-start">
57
+ <div class="grid grid-cols-1 lg:grid-cols-[1fr_360px] xl:grid-cols-[1fr_420px] gap-8 items-start">
58
58
  <!-- Left: form sections -->
59
59
  <div class="space-y-6">
60
60
  <CheckoutGuestDetailsSection v-if="isGuest" />
@@ -2,6 +2,7 @@
2
2
  import CheckoutSectionTitle from "./CheckoutSectionTitle.vue";
3
3
 
4
4
  import type { PaymentMethod, PaymentOption } from "../../../interfaces/payment";
5
+ import { cartEcommerce } from "../../../shared/themeEvents";
5
6
 
6
7
  const { icon } = useIcons();
7
8
  const { t, locale } = useI18n();
@@ -85,7 +86,16 @@ const costCenterOptions = computed(() =>
85
86
  })) ?? [],
86
87
  );
87
88
 
89
+ const themeEvents = useThemeEvents();
90
+
88
91
  function selectMethod(method: PaymentMethod) {
92
+ // `add_payment_info` on the buyer's own choice — not for the default the
93
+ // section reconciles to on its own (the watch above).
94
+ if (form.value.paymentMethod !== method && cartStore.items.length) {
95
+ themeEvents.emit("add_payment_info", {
96
+ ecommerce: cartEcommerce(cartStore.items, { payment_type: String(method).slice(0, 64) }),
97
+ });
98
+ }
89
99
  form.value.paymentMethod = method;
90
100
  if (method !== "po_number") {
91
101
  form.value.poNumber = "";
@@ -153,8 +153,12 @@ async function handlePlaceOrder() {
153
153
  v-model="form.promoCode"
154
154
  :placeholder="t('onepage.summary.promoCodePlaceholder')"
155
155
  class="flex-1"
156
+ :ui="{ base: 'min-h-11 lg:min-h-0' }"
156
157
  />
157
- <UButton variant="outline">
158
+ <UButton
159
+ variant="outline"
160
+ class="min-h-11 lg:min-h-0"
161
+ >
158
162
  {{ t('onepage.summary.applyPromo') }}
159
163
  </UButton>
160
164
  </div>
@@ -189,6 +193,7 @@ async function handlePlaceOrder() {
189
193
  <!-- Place order / submit requisition -->
190
194
  <UButton
191
195
  block
196
+ class="min-h-11 lg:min-h-0"
192
197
  :disabled="isRequester ? submitting : !canSubmit"
193
198
  :loading="submitting"
194
199
  @click="handlePlaceOrder"
@@ -199,6 +204,7 @@ async function handlePlaceOrder() {
199
204
  <!-- Back to cart -->
200
205
  <UButton
201
206
  block
207
+ class="min-h-11 lg:min-h-0"
202
208
  variant="ghost"
203
209
  color="neutral"
204
210
  :to="to('/cart')"
@@ -0,0 +1,13 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * A named layout extension point (`header`, `footer`). The design system
4
+ * renders its default content — the slot — unchanged; a theme layer overrides
5
+ * this component (same path) to add tenant-authored content before or after
6
+ * it, or to replace it (ADR-0111).
7
+ */
8
+ defineProps<{ name: string }>();
9
+ </script>
10
+
11
+ <template>
12
+ <slot />
13
+ </template>
@@ -143,6 +143,14 @@ const year = new Date().getFullYear();
143
143
  >
144
144
  {{ t(link.label) }}
145
145
  </NuxtLink>
146
+ <!-- Reopens the cookie choice (Consent Manager). Renders nothing in
147
+ the editor, where no banner is shown either. -->
148
+ <ConsentPreferencesLink
149
+ class="text-xs text-dimmed dark:text-white/70 cursor-pointer
150
+ hover:text-default dark:hover:text-white transition-colors"
151
+ >
152
+ {{ t('footer.cookieSettings') }}
153
+ </ConsentPreferencesLink>
146
154
  </nav>
147
155
 
148
156
  <!-- Social icons -->
@@ -9,11 +9,12 @@ const { t } = useI18n();
9
9
  const localePath = useLocalePath();
10
10
  const isMenuOpen = ref(false);
11
11
 
12
- // Symmetric grid: flexible side columns keep the wide search column truly
13
- // centered in the header, independent of logo/action widths.
12
+ // Symmetric flexible side columns keep the search truly centered in the
13
+ // header; their max-content minimum means the logo and actions (labels at xl)
14
+ // can never be squeezed — the search column gives way first on tablet.
14
15
  const headerUi = {
15
16
  container: [
16
- "grid grid-cols-[1fr_minmax(0,46rem)_1fr] items-center gap-4 lg:gap-6",
17
+ "grid grid-cols-[minmax(max-content,1fr)_minmax(0,46rem)_minmax(max-content,1fr)] items-center gap-4 lg:gap-6",
17
18
  "h-(--ui-header-height)",
18
19
  "px-4 sm:px-6 lg:px-8",
19
20
  "max-w-(--ui-container) mx-auto w-full",
@@ -100,11 +100,11 @@ function isActive(to: string): boolean {
100
100
  >
101
101
  <div
102
102
  class="px-4 sm:px-6 lg:px-8 max-w-(--ui-container) mx-auto w-full
103
- py-3 flex items-center gap-8"
103
+ py-3 flex items-center gap-4 lg:gap-8"
104
104
  >
105
105
  <ul
106
106
  role="list"
107
- class="flex-1 flex items-center gap-6 lg:gap-8"
107
+ class="flex-1 flex items-center gap-4 lg:gap-8"
108
108
  >
109
109
  <!--
110
110
  A panel item's trigger is a button, not a link: its job is the
@@ -147,7 +147,7 @@ function isActive(to: string): boolean {
147
147
  </ul>
148
148
  <ul
149
149
  role="list"
150
- class="hidden md:flex items-center gap-6"
150
+ class="hidden md:flex items-center gap-4 lg:gap-6"
151
151
  >
152
152
  <li
153
153
  v-for="item in mainNavigationSecondary"
@@ -68,9 +68,11 @@ const cardProps = computed(() => viewMode.value === "list"
68
68
  >
69
69
  <component
70
70
  :is="productComponent"
71
- v-for="product in listing.products.value"
71
+ v-for="(product, index) in listing.products.value"
72
72
  :key="product.id"
73
73
  :product="product"
74
+ :list-id="listing.listId?.()"
75
+ :list-position="(listing.page.value - 1) * listing.perPage + index + 1"
74
76
  v-bind="cardProps"
75
77
  />
76
78
  </div>
@@ -23,6 +23,10 @@ const props = withDefaults(defineProps<{
23
23
  * no stock; `info` always links to the detail page.
24
24
  */
25
25
  action?: "order" | "info";
26
+ /** The list this card is shown in, reported when it is opened. */
27
+ listId?: string;
28
+ /** 1-based position in that list. */
29
+ listPosition?: number;
26
30
  }>(), {
27
31
  action: "order",
28
32
  });
@@ -34,7 +38,10 @@ const { public: { locale } } = useRuntimeConfig();
34
38
  const { taxIncludedPrices } = useShopSettings();
35
39
  const currency = useDisplayCurrency();
36
40
 
37
- const { url } = useProductCard(() => props.product);
41
+ const { url, select } = useProductCard(
42
+ () => props.product,
43
+ () => ({ listId: props.listId, position: props.listPosition }),
44
+ );
38
45
  const { isOutOfStock, hasPrice, addToCart } = useProductCardActions(() => props.product);
39
46
 
40
47
  const canOrder = computed(() =>
@@ -63,6 +70,7 @@ function formatPrice(price: number): string {
63
70
  <div class="group flex h-full flex-col rounded-lg border border-(--ui-border) p-3 transition-colors hover:border-primary/60">
64
71
  <NuxtLink
65
72
  :to="url"
73
+ @click="select"
66
74
  tabindex="-1"
67
75
  aria-hidden="true"
68
76
  class="block"
@@ -84,6 +92,7 @@ function formatPrice(price: number): string {
84
92
 
85
93
  <NuxtLink
86
94
  :to="url"
95
+ @click="select"
87
96
  class="mt-2 block text-sm leading-snug line-clamp-2 text-highlighted group-hover:text-primary"
88
97
  >
89
98
  {{ props.product.name }}
@@ -35,6 +35,40 @@ const quantityInvalid = computed(() => quantity.value < 1);
35
35
  const quantityExceeded = computed(() =>
36
36
  currentCartQuantity.value + quantity.value > effectiveMaxQuantity.value,
37
37
  );
38
+ /**
39
+ * What this buy box may still add: the line ceiling less what the cart already
40
+ * holds. Never below 1 — a line that is already full keeps the stepper at 1 and
41
+ * lets add-to-cart explain why it refuses.
42
+ */
43
+ const remainingQuantity = computed(() =>
44
+ Math.max(1, effectiveMaxQuantity.value - currentCartQuantity.value),
45
+ );
46
+
47
+ // Same stepper rules as the cart page and the mini-cart; here the quantity is
48
+ // the amount to add, not a cart line.
49
+ const {
50
+ inputValue: quantityInput,
51
+ notice: quantityNotice,
52
+ canDecrease,
53
+ decrease,
54
+ increase,
55
+ onInput: onQuantityInput,
56
+ commit: commitQuantity,
57
+ } = useQuantityStepper({
58
+ quantity: () => quantity.value,
59
+ max: () => remainingQuantity.value,
60
+ apply: (next) => {
61
+ quantity.value = next;
62
+ },
63
+ });
64
+
65
+ // Adding to the cart shrinks what is left to add; an amount that no longer fits
66
+ // follows it down, so the next + never makes the number drop.
67
+ watch(remainingQuantity, (remaining) => {
68
+ if (quantity.value > remaining) {
69
+ quantity.value = remaining;
70
+ }
71
+ });
38
72
 
39
73
  let exceededTimer: ReturnType<typeof setTimeout> | null = null;
40
74
  const showQuantityExceeded = ref(false);
@@ -76,17 +110,6 @@ function buildPriceTiers(prices: { [key: string]: number }[]): CartItemPriceTier
76
110
  .sort((a, b) => a.minQuantity - b.minQuantity);
77
111
  }
78
112
 
79
- function setQuantity(next: number) {
80
- quantity.value = Math.max(1, Math.min(next, 999999));
81
- }
82
-
83
- function onQuantityInput(event: Event) {
84
- const input = event.target as HTMLInputElement;
85
- const sanitized = input.value.replace(/[^0-9]/g, "").slice(0, 6);
86
- input.value = sanitized;
87
- quantity.value = parseInt(sanitized) || 0;
88
- }
89
-
90
113
  function addToCart() {
91
114
  if (quantityInvalid.value) {
92
115
  return;
@@ -146,33 +169,37 @@ onUnmounted(() => {
146
169
  :icon="icon('minus')"
147
170
  color="neutral"
148
171
  variant="ghost"
172
+ class="min-h-11 min-w-11 justify-center lg:min-h-0 lg:min-w-0"
149
173
  tabindex="0"
150
- :disabled="quantity <= 1"
174
+ :disabled="!canDecrease"
151
175
  :aria-label="t('cart.item.ariaDecreaseQuantity', { name: product.name })"
152
- @click="setQuantity(quantity - 1)"
176
+ @click="decrease"
153
177
  />
154
178
  <input
155
- :value="String(quantity)"
179
+ v-model="quantityInput"
156
180
  type="text"
157
181
  inputmode="numeric"
158
- class="w-12 text-center text-sm font-medium bg-transparent
182
+ class="w-12 self-stretch text-center text-sm font-medium bg-transparent
159
183
  focus:outline-none"
160
184
  :aria-label="t('product.detail.quantity')"
161
185
  @input="onQuantityInput"
186
+ @keydown.enter.prevent="commitQuantity"
187
+ @blur="commitQuantity"
162
188
  >
163
189
  <UButton
164
190
  :icon="icon('plus')"
165
191
  color="neutral"
166
192
  variant="ghost"
193
+ class="min-h-11 min-w-11 justify-center lg:min-h-0 lg:min-w-0"
167
194
  tabindex="0"
168
195
  :aria-label="t('cart.item.ariaIncreaseQuantity', { name: product.name })"
169
- @click="setQuantity(quantity + 1)"
196
+ @click="increase"
170
197
  />
171
198
  </div>
172
199
  <UButton
173
200
  :icon="icon('cart')"
174
201
  size="lg"
175
- class="flex-1 justify-center"
202
+ class="flex-1 justify-center min-h-11 lg:min-h-0"
176
203
  tabindex="0"
177
204
  :label="t('product.actions.addToCart')"
178
205
  :disabled="quantityInvalid"
@@ -182,11 +209,17 @@ onUnmounted(() => {
182
209
  </div>
183
210
 
184
211
  <UiFeedbackErrorBoundary
185
- v-if="showQuantityExceeded"
212
+ v-if="showQuantityExceeded || quantityNotice === 'max'"
186
213
  :title="t('product.actions.maxQuantityReachedTitle', { count: currentCartQuantity })"
187
214
  :description="t('product.actions.maxQuantityReachedDescription', { max: effectiveMaxQuantity })"
188
215
  :show-retry="false"
189
216
  />
217
+ <UiFeedbackErrorBoundary
218
+ v-if="quantityNotice === 'invalid'"
219
+ :title="t('product.actions.invalidQuantityTitle')"
220
+ :description="t('product.actions.invalidQuantityDescription')"
221
+ :show-retry="false"
222
+ />
190
223
 
191
224
  <!-- B2B incentives -->
192
225
  <ul
@@ -74,7 +74,7 @@ async function copySku(): Promise<void> {
74
74
  <button
75
75
  type="button"
76
76
  tabindex="0"
77
- class="mt-2 inline-flex items-center gap-1.5 text-sm text-muted
77
+ class="mt-2 inline-flex items-center gap-1.5 min-h-11 lg:min-h-0 text-sm text-muted
78
78
  hover:text-highlighted transition-colors cursor-pointer"
79
79
  :title="t('product.detail.copySku')"
80
80
  @click="copySku"
@@ -32,7 +32,7 @@ const to = computed(() => ({
32
32
  variant="link"
33
33
  color="neutral"
34
34
  size="sm"
35
- class="px-0"
35
+ class="px-0 min-h-11 lg:min-h-0"
36
36
  :icon="icon('mail')"
37
37
  :label="t('forms.priceRequest.cta')"
38
38
  />
@@ -1,5 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import type { OrderList, OrderListPosition } from "../../../interfaces/account/order-lists";
3
+ import { cartEcommerce } from "../../../shared/themeEvents";
3
4
 
4
5
  /**
5
6
  * "Add to order list" on the product detail page: shows on how many
@@ -27,6 +28,12 @@ const { icon } = useIcons();
27
28
  const { t } = useI18n();
28
29
  const toast = useToast();
29
30
  const auth = useAuthStore();
31
+ const themeEvents = useThemeEvents();
32
+
33
+ /** `add_to_orderlist` — the article went onto a list (not off one). */
34
+ function reportAdded(): void {
35
+ themeEvents.emit("add_to_orderlist", { ecommerce: cartEcommerce([buildPosition()]) });
36
+ }
30
37
 
31
38
  const open = ref(false);
32
39
  const busyListId = ref<string | null>(null);
@@ -91,6 +98,7 @@ async function toggle(list: OrderList): Promise<void> {
91
98
  });
92
99
  await refresh();
93
100
  if (!removing) {
101
+ reportAdded();
94
102
  lastUsedId.value = list.id;
95
103
  localStorage.setItem(LAST_USED_STORAGE, list.id);
96
104
  }
@@ -122,6 +130,7 @@ async function createAndAdd(): Promise<void> {
122
130
  body: { name, kind: "shopping", public: false, positions: [buildPosition()] },
123
131
  });
124
132
  await refresh();
133
+ reportAdded();
125
134
  lastUsedId.value = created.id;
126
135
  localStorage.setItem(LAST_USED_STORAGE, created.id);
127
136
  newListName.value = "";
@@ -163,6 +172,7 @@ async function createAndAdd(): Promise<void> {
163
172
  color="neutral"
164
173
  variant="outline"
165
174
  size="lg"
175
+ class="min-h-11 min-w-11 justify-center lg:min-h-0 lg:min-w-0"
166
176
  tabindex="0"
167
177
  :icon="icon('order-list')"
168
178
  :aria-label="t('orderLists.saveTo.button')"
@@ -82,22 +82,12 @@ export const useAccountDashboard = () => {
82
82
  return Number.isNaN(parsed.getTime()) ? value : d(parsed, { dateStyle: "medium" });
83
83
  };
84
84
 
85
- /* ---- quick actions ----------------------------------------------------- */
86
- const quickActions = [
87
- { to: "/account/direct-order", labelKey: "directOrder.title", token: "direct-order" },
88
- { to: "/account/orders", labelKey: "account.nav.orders", token: "orders" },
89
- { to: "/account/order-lists", labelKey: "account.nav.orderLists", token: "order-list" },
90
- { to: "/account/requisitions", labelKey: "account.nav.requisitions", token: "check" },
91
- { to: "/account/cost-centers", labelKey: "account.nav.costCenters", token: "briefcase" },
92
- ];
93
-
94
85
  return {
95
86
  t,
96
87
  auth,
97
88
  formatCurrency,
98
89
  formatDate,
99
90
  statusColors,
100
- quickActions,
101
91
  ordersPending,
102
92
  contextPending,
103
93
  requisitionsPending,
@@ -0,0 +1,35 @@
1
+ import type { ComputedRef } from "vue";
2
+
3
+ import type { AccountNavGroup } from "../config/navigation";
4
+
5
+ import { accountNavigation } from "../config/navigation";
6
+
7
+ export interface UseAccountNavigationReturn {
8
+ /** The sidebar groups in effect for this request. */
9
+ readonly navigation: ComputedRef<AccountNavGroup[]>;
10
+ /** True when a theme published the tenant's own account menu for this request. */
11
+ readonly isTenantAuthored: ComputedRef<boolean>;
12
+ }
13
+
14
+ /**
15
+ * The account navigation in effect, resolved in the same priority order the
16
+ * header uses (see MainNav):
17
+ * 1. per-request useState — a theme publishing the tenant's LIVE account
18
+ * menu (request-scoped, so multi-tenant safe)
19
+ * 2. app.config override — a theme's shipped defaults (custom-theme)
20
+ * 3. the layer's built-in full B2B tree
21
+ * The sidebar renders it; the quick-action catalogue is limited by it.
22
+ */
23
+ export function useAccountNavigation(): UseAccountNavigationReturn {
24
+ const appConfig = useAppConfig();
25
+ const liveAccountNavigation = useState<AccountNavGroup[] | null>("cover:nav:accountNavigation", () => null);
26
+
27
+ const navigation = computed<AccountNavGroup[]>(() =>
28
+ liveAccountNavigation.value
29
+ ?? (appConfig.accountNavigation as AccountNavGroup[] | undefined)
30
+ ?? accountNavigation,
31
+ );
32
+ const isTenantAuthored = computed(() => liveAccountNavigation.value !== null);
33
+
34
+ return { navigation, isTenantAuthored };
35
+ }
@@ -40,6 +40,8 @@ function mapAuthError(err: unknown, context: "login" | "recovery" | "register" =
40
40
  : "auth.login.errors.invalidCredentials";
41
41
  case "user_blocked":
42
42
  return "auth.login.errors.accountBlocked";
43
+ case "organization_blocked":
44
+ return "auth.login.errors.organizationBlocked";
43
45
  case "general_rate_limit_exceeded":
44
46
  return context === "recovery"
45
47
  ? "auth.recovery.errors.rateLimited"