@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,6 +1,10 @@
1
1
  export const accountApi = {
2
2
  profile: () => "/api/account/profile",
3
+ /** The user's B2B context: organization settings, cost centers, workflows. */
4
+ context: () => "/api/account/context",
3
5
  orders: () => "/api/account/orders",
6
+ orderLists: () => "/api/account/order-lists",
7
+ requisitions: () => "/api/account/requisitions",
4
8
  orderReturn: (id: string) => `/api/account/orders/${id}/return`,
5
9
  addresses: () => "/api/account/addresses",
6
10
  addressUpdate: (id: string) => `/api/account/address/${id}`,
@@ -23,3 +23,12 @@
23
23
  .dark.dark {
24
24
  --ui-warning: var(--ui-color-warning-400);
25
25
  }
26
+
27
+ /* Keep browser autofill visually consistent with the checkout fields. */
28
+ input:-webkit-autofill,
29
+ input:-webkit-autofill:hover,
30
+ input:-webkit-autofill:focus {
31
+ -webkit-text-fill-color: var(--ui-text-highlighted);
32
+ -webkit-box-shadow: 0 0 0 1000px var(--ui-bg) inset;
33
+ box-shadow: 0 0 0 1000px var(--ui-bg) inset;
34
+ }
@@ -31,6 +31,8 @@ const props = defineProps<{
31
31
  context?: Record<string, unknown>;
32
32
  }>();
33
33
 
34
+ const themeEvents = useThemeEvents();
35
+
34
36
  const { icon } = useIcons();
35
37
  const { locale, t } = useI18n();
36
38
  const route = useRoute();
@@ -208,6 +210,8 @@ async function onSubmit(values: Record<string, unknown>) {
208
210
  }
209
211
  successMessage.value = res.success_message || t("forms.success");
210
212
  submitted.value = true;
213
+ // Which form was sent — never a word of what was typed into it.
214
+ themeEvents.emit("form_submit", { form: { form_code: props.slug.slice(0, 128), outcome: "accepted" } });
211
215
  }
212
216
  catch {
213
217
  submitError.value = t("forms.error");
@@ -1,13 +1,10 @@
1
1
  <script setup lang="ts">
2
- import { accountNavigation } from "../../config/navigation";
3
2
  import type { AccountNavGroup } from "../../config/navigation";
4
3
 
5
4
  const { icon } = useIcons();
6
5
 
7
- const appConfig = useAppConfig();
8
- const navigation = computed<AccountNavGroup[]>(() =>
9
- (appConfig.accountNavigation as AccountNavGroup[] | undefined) ?? accountNavigation,
10
- );
6
+ // Live tenant menu → app.config override → the layer's full B2B tree.
7
+ const { navigation } = useAccountNavigation();
11
8
 
12
9
  const { t } = useI18n();
13
10
  const localePath = useLocalePath();
@@ -1,5 +1,25 @@
1
1
  <script setup lang="ts">
2
- /** Dashboard KPI band: open orders, awaiting approval, 30-day spend, budget %. */
2
+ /**
3
+ * Dashboard KPI band: open orders, awaiting approval, 30-day spend, budget %.
4
+ * `kpis` picks which of them render (a block option, a tenant setting); the
5
+ * selection is narrowed through `resolveAccountDashboardKpis`, so an empty or
6
+ * unknown selection still shows the full band — never an empty frame.
7
+ */
8
+ import { ACCOUNT_DASHBOARD_KPI_IDS, resolveAccountDashboardKpis } from "../../../config/accountDashboard";
9
+ import type { AccountDashboardKpiId } from "../../../interfaces/account/dashboard";
10
+
11
+ interface KpiCell {
12
+ readonly id: AccountDashboardKpiId;
13
+ readonly labelKey: string;
14
+ readonly value: string;
15
+ readonly isWarning: boolean;
16
+ }
17
+
18
+ const props = defineProps<{
19
+ /** KPIs to show, in any order; omitted → all four. */
20
+ kpis?: readonly AccountDashboardKpiId[];
21
+ }>();
22
+
3
23
  const {
4
24
  t,
5
25
  formatCurrency,
@@ -15,7 +35,50 @@ const {
15
35
  const pending = computed(() =>
16
36
  ordersPending.value || contextPending.value || requisitionsPending.value);
17
37
 
18
- /** Divider-separated KPI cells: 2-col grid on mobile, 4-col from lg. */
38
+ const visibleKpis = computed(() => resolveAccountDashboardKpis(props.kpis ?? ACCOUNT_DASHBOARD_KPI_IDS));
39
+
40
+ const cellsById = computed<Record<AccountDashboardKpiId, KpiCell>>(() => ({
41
+ openOrders: {
42
+ id: "openOrders",
43
+ labelKey: "account.dashboard.stats.openOrders",
44
+ value: String(openOrdersCount.value),
45
+ isWarning: false,
46
+ },
47
+ awaitingApproval: {
48
+ id: "awaitingApproval",
49
+ labelKey: "account.dashboard.stats.awaitingApproval",
50
+ value: String(awaitingApprovalCount.value),
51
+ isWarning: awaitingApprovalCount.value > 0,
52
+ },
53
+ spend30: {
54
+ id: "spend30",
55
+ labelKey: "account.dashboard.stats.spend30",
56
+ value: formatCurrency(spend30.value),
57
+ isWarning: false,
58
+ },
59
+ budgetUsed: {
60
+ id: "budgetUsed",
61
+ labelKey: "account.dashboard.stats.budgetUsed",
62
+ value: budgetUtilization.value !== null ? `${budgetUtilization.value} %` : "—",
63
+ isWarning: (budgetUtilization.value ?? 0) >= 90,
64
+ },
65
+ }));
66
+
67
+ const cells = computed(() => visibleKpis.value.map(id => cellsById.value[id]));
68
+
69
+ // Static map so Tailwind's JIT emits every utility — the count is computed and
70
+ // a built class name would be purged. Two columns on mobile once there is a
71
+ // pair to show; from lg every KPI gets its own column.
72
+ const COLUMNS_CLASS: Record<number, string> = {
73
+ 1: "grid-cols-1 lg:grid-cols-1",
74
+ 2: "grid-cols-2 lg:grid-cols-2",
75
+ 3: "grid-cols-2 lg:grid-cols-3",
76
+ 4: "grid-cols-2 lg:grid-cols-4",
77
+ };
78
+
79
+ const columnsClass = computed(() => COLUMNS_CLASS[cells.value.length] ?? COLUMNS_CLASS[4]);
80
+
81
+ /** Divider-separated KPI cells: 2-col grid on mobile, one row from lg. */
19
82
  const statCell = `p-4 sm:p-5 border-(--ui-border)
20
83
  max-lg:nth-[n+3]:border-t max-lg:nth-[2n]:border-l lg:not-first:border-l`;
21
84
  </script>
@@ -27,44 +90,21 @@ const statCell = `p-4 sm:p-5 border-(--ui-border)
27
90
  />
28
91
  <dl
29
92
  v-else
30
- class="border border-(--ui-border) rounded-xl grid grid-cols-2 lg:grid-cols-4"
93
+ :class="['border border-(--ui-border) rounded-xl grid', columnsClass]"
31
94
  >
32
- <div :class="statCell">
33
- <dt class="text-sm text-muted truncate">
34
- {{ t('account.dashboard.stats.openOrders') }}
35
- </dt>
36
- <dd class="mt-1 text-2xl font-semibold text-highlighted tabular-nums">
37
- {{ openOrdersCount }}
38
- </dd>
39
- </div>
40
- <div :class="statCell">
41
- <dt class="text-sm text-muted truncate">
42
- {{ t('account.dashboard.stats.awaitingApproval') }}
43
- </dt>
44
- <dd
45
- class="mt-1 text-2xl font-semibold tabular-nums"
46
- :class="awaitingApprovalCount > 0 ? 'text-warning' : 'text-highlighted'"
47
- >
48
- {{ awaitingApprovalCount }}
49
- </dd>
50
- </div>
51
- <div :class="statCell">
52
- <dt class="text-sm text-muted truncate">
53
- {{ t('account.dashboard.stats.spend30') }}
54
- </dt>
55
- <dd class="mt-1 text-2xl font-semibold text-highlighted tabular-nums">
56
- {{ formatCurrency(spend30) }}
57
- </dd>
58
- </div>
59
- <div :class="statCell">
95
+ <div
96
+ v-for="cell in cells"
97
+ :key="cell.id"
98
+ :class="statCell"
99
+ >
60
100
  <dt class="text-sm text-muted truncate">
61
- {{ t('account.dashboard.stats.budgetUsed') }}
101
+ {{ t(cell.labelKey) }}
62
102
  </dt>
63
103
  <dd
64
104
  class="mt-1 text-2xl font-semibold tabular-nums"
65
- :class="(budgetUtilization ?? 0) >= 90 ? 'text-warning' : 'text-highlighted'"
105
+ :class="cell.isWarning ? 'text-warning' : 'text-highlighted'"
66
106
  >
67
- {{ budgetUtilization !== null ? `${budgetUtilization} %` : '—' }}
107
+ {{ cell.value }}
68
108
  </dd>
69
109
  </div>
70
110
  </dl>
@@ -1,19 +1,37 @@
1
1
  <script setup lang="ts">
2
- /** Dashboard widget: quick-access links into the most-used account areas. */
2
+ /**
3
+ * Dashboard widget: quick-access links into the most-used account areas.
4
+ * `ids` is the authored selection (a block option), in its own order; omitted
5
+ * it shows the dashboard default. Either way the list is limited to what the
6
+ * account navigation in effect links — see `useQuickActions`.
7
+ */
8
+ import { DASHBOARD_QUICK_ACTION_IDS } from "../../../config/quickActions";
9
+
10
+ const props = defineProps<{
11
+ /** Quick-action ids to show, in this order; omitted → the dashboard default. */
12
+ ids?: readonly string[];
13
+ }>();
14
+
3
15
  const { icon } = useIcons();
4
16
  const localePath = useLocalePath();
5
- const { t, quickActions } = useAccountDashboard();
17
+ const { t } = useI18n();
18
+ const { resolveAllowed } = useQuickActions();
19
+
20
+ const actions = computed(() => resolveAllowed(props.ids ?? DASHBOARD_QUICK_ACTION_IDS));
6
21
  </script>
7
22
 
8
23
  <template>
9
- <section class="border border-(--ui-border) rounded-xl overflow-hidden">
24
+ <section
25
+ v-if="actions.length"
26
+ class="border border-(--ui-border) rounded-xl overflow-hidden"
27
+ >
10
28
  <h2 class="px-4 sm:px-5 py-3 text-sm font-semibold text-highlighted bg-elevated/60 border-b border-(--ui-border)">
11
29
  {{ t('account.dashboard.quickAccess') }}
12
30
  </h2>
13
31
  <ul class="divide-y divide-(--ui-border)">
14
32
  <li
15
- v-for="action in quickActions"
16
- :key="action.to"
33
+ v-for="action in actions"
34
+ :key="action.id"
17
35
  >
18
36
  <NuxtLink
19
37
  :to="localePath(action.to)"
@@ -21,7 +39,7 @@ const { t, quickActions } = useAccountDashboard();
21
39
  hover:bg-elevated/40 transition-colors"
22
40
  >
23
41
  <UIcon
24
- :name="icon(action.token)"
42
+ :name="icon(action.icon)"
25
43
  class="size-4.5 text-primary shrink-0"
26
44
  />
27
45
  <span class="truncate">{{ t(action.labelKey) }}</span>
@@ -14,6 +14,8 @@ const { organization, status, error, updateOrganization } = useAccountOrganizati
14
14
  // Company data another system owns is shown, never changed here (the BFF
15
15
  // refuses the write as well — see account.organization.editable).
16
16
  const editable = useMasterDataEditable("organization");
17
+ // Locked by the buyer's own role rather than by the merchant — said as such.
18
+ const roleLocked = useRoleGrants().lockedByRole("organization.manage");
17
19
 
18
20
  const editing = ref(false);
19
21
  const saving = ref(false);
@@ -92,7 +94,7 @@ async function save(): Promise<void> {
92
94
  color="info"
93
95
  variant="soft"
94
96
  :icon="icon('info')"
95
- :description="t('organization.locked')"
97
+ :description="roleLocked ? t('organization.lockedRole') : t('organization.locked')"
96
98
  />
97
99
  <dl class="p-4 sm:p-5 grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-4">
98
100
  <div>
@@ -17,6 +17,31 @@ const { members, status, error, inviteMember, updateMemberRole } = useAccountTea
17
17
  // Contacts another system owns are listed, never invited or changed here
18
18
  // (the BFF refuses the write as well — see account.team.editable).
19
19
  const editable = useMasterDataEditable("team");
20
+ // A buyer whose role does not run the company's people is told so, rather than
21
+ // told the merchant maintains them; and nobody is offered a role above their
22
+ // own, their own role, or the role of somebody who outranks them (RAD-155).
23
+ const { lockedByRole, mayGrant, isSelf, outranks } = useRoleGrants();
24
+ const roleLocked = lockedByRole("contacts.manage");
25
+ const canEditMember = (member: AccountTeamMember): boolean =>
26
+ !isSelf(member.id) && !outranks(member.role);
27
+
28
+ /** The sentence for a refused save — the page's own words, keyed by the BFF's reason. */
29
+ function saveErrorTitle(err: unknown): string {
30
+ const failure = err as { statusCode?: number; data?: { data?: { type?: string } } };
31
+ const type = failure?.data?.data?.type;
32
+ if (failure?.statusCode === 404) {
33
+ return t("team.refused.notFound");
34
+ }
35
+ switch (type) {
36
+ case "role_above_own": return t("team.refused.roleAboveOwn");
37
+ case "own_role": return t("team.refused.ownRole");
38
+ case "permission_missing": return t("team.lockedRole");
39
+ case "field_merchant_owned":
40
+ case "not_self_service":
41
+ case "master_data_merchant_owned": return t("team.locked");
42
+ default: return t("team.saveError");
43
+ }
44
+ }
20
45
  const { tableUi } = useDataTable();
21
46
 
22
47
  const ROLES: AccountTeamRole[] = ["buyer", "approver", "admin", "requester"];
@@ -35,7 +60,7 @@ const statusColors: Record<AccountTeamStatus, "success" | "warning" | "error"> =
35
60
  };
36
61
 
37
62
  const roleItems = computed(() =>
38
- ROLES.map(value => ({ value, label: t(`team.roles.${value}`) })),
63
+ ROLES.filter(value => mayGrant(value)).map(value => ({ value, label: t(`team.roles.${value}`) })),
39
64
  );
40
65
 
41
66
  /* ---- search ------------------------------------------------------------ */
@@ -95,8 +120,8 @@ async function saveInvite(): Promise<void> {
95
120
  inviting.value = false;
96
121
  toast.add({ title: t("team.saved"), color: "success", icon: icon("success"), duration: 2000 });
97
122
  }
98
- catch {
99
- toast.add({ title: t("team.saveError"), color: "error", icon: icon("error"), duration: 3000 });
123
+ catch (err) {
124
+ toast.add({ title: saveErrorTitle(err), color: "error", icon: icon("error"), duration: 3000 });
100
125
  }
101
126
  finally {
102
127
  savingInvite.value = false;
@@ -125,8 +150,8 @@ async function saveEdit(): Promise<void> {
125
150
  editing.value = false;
126
151
  toast.add({ title: t("team.saved"), color: "success", icon: icon("success"), duration: 2000 });
127
152
  }
128
- catch {
129
- toast.add({ title: t("team.saveError"), color: "error", icon: icon("error"), duration: 3000 });
153
+ catch (err) {
154
+ toast.add({ title: saveErrorTitle(err), color: "error", icon: icon("error"), duration: 3000 });
130
155
  }
131
156
  finally {
132
157
  savingEdit.value = false;
@@ -149,7 +174,7 @@ async function saveEdit(): Promise<void> {
149
174
  color="info"
150
175
  variant="soft"
151
176
  :icon="icon('info')"
152
- :description="t('team.locked')"
177
+ :description="roleLocked ? t('team.lockedRole') : t('team.locked')"
153
178
  />
154
179
  <UiTableToolbar
155
180
  v-model:search="search"
@@ -218,7 +243,7 @@ async function saveEdit(): Promise<void> {
218
243
  </template>
219
244
  <template #actions-cell="{ row }">
220
245
  <div
221
- v-if="editable"
246
+ v-if="editable && canEditMember(row.original)"
222
247
  class="flex items-center justify-end gap-1"
223
248
  >
224
249
  <UTooltip :text="t('team.editTitle')">
@@ -32,7 +32,7 @@ async function onSubmit(): Promise<void> {
32
32
  </script>
33
33
 
34
34
  <template>
35
- <div class="bg-elevated py-6 px-8 rounded-lg">
35
+ <div class="w-full bg-(--ui-bg) border border-(--ui-border) rounded-xl p-6 space-y-6">
36
36
  <h2 class="text-xl font-semibold text-highlighted">
37
37
  {{ t('auth.forgotPassword.title') }}
38
38
  </h2>
@@ -40,18 +40,23 @@ async function onSubmit(): Promise<void> {
40
40
  <FormKit
41
41
  type="form"
42
42
  :actions="false"
43
- class="space-y-4 pt-6"
43
+ class="space-y-4"
44
44
  @submit="onSubmit"
45
45
  >
46
46
  <FormKit
47
47
  v-model="state.email"
48
48
  type="email"
49
- :label="t('auth.forgotPassword.fields.email')"
50
49
  name="email"
51
50
  validation="required|email"
52
51
  autocomplete="email"
52
+ input-class="h-8 py-1 bg-(--ui-bg)"
53
53
  :placeholder="t('auth.forgotPassword.fields.emailPlaceholder')"
54
- />
54
+ >
55
+ <template #label>
56
+ <span>{{ t('onepage.guest.email') }}</span>
57
+ <span class="text-error-500"> *</span>
58
+ </template>
59
+ </FormKit>
55
60
 
56
61
  <UAlert
57
62
  v-if="error"
@@ -96,7 +96,7 @@ async function onSubmit(): Promise<void> {
96
96
  </script>
97
97
 
98
98
  <template>
99
- <div class="bg-elevated py-6 px-8 rounded-lg">
99
+ <div class="bg-(--ui-bg) border border-(--ui-border) rounded-xl p-6 space-y-6">
100
100
  <h2 class="text-xl font-semibold text-highlighted">
101
101
  {{ t('auth.login.existingCustomer') }}
102
102
  </h2>
@@ -190,16 +190,17 @@ async function onSubmit(): Promise<void> {
190
190
  v-if="passwordOffered"
191
191
  type="form"
192
192
  :actions="false"
193
- class="space-y-4 pt-6"
193
+ class="space-y-4"
194
194
  @submit="onSubmit"
195
195
  >
196
196
  <FormKit
197
197
  v-model="state.email"
198
198
  type="email"
199
- :label="t('auth.login.fields.email')"
199
+ :label="t('onepage.guest.email')"
200
200
  name="email"
201
201
  validation="required|email"
202
202
  autocomplete="email"
203
+ input-class="h-8 py-1 bg-(--ui-bg)"
203
204
  :placeholder="t('auth.login.fields.emailPlaceholder')"
204
205
  />
205
206
 
@@ -210,6 +211,7 @@ async function onSubmit(): Promise<void> {
210
211
  name="password"
211
212
  validation="required|length:8"
212
213
  autocomplete="current-password"
214
+ input-class="h-8 py-1 bg-(--ui-bg)"
213
215
  :placeholder="t('auth.login.fields.passwordPlaceholder')"
214
216
  />
215
217
 
@@ -1,5 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import type { OrderList, OrderListKind, OrderListPosition } from "../../../interfaces/account/order-lists";
3
+ import { cartEcommerce } from "../../../shared/themeEvents";
3
4
 
4
5
  /**
5
6
  * Saves positions to a shopping or label list (account order lists BFF).
@@ -16,6 +17,7 @@ const { t } = useI18n();
16
17
  const toast = useToast();
17
18
  const cart = useCartStore();
18
19
  const authStore = useAuthStore();
20
+ const themeEvents = useThemeEvents();
19
21
 
20
22
  type Mode = "existing" | "new";
21
23
 
@@ -98,6 +100,9 @@ async function save(): Promise<void> {
98
100
  body: { name, kind: kind.value, public: false, positions },
99
101
  });
100
102
  }
103
+ if (positions.length) {
104
+ themeEvents.emit("add_to_orderlist", { ecommerce: cartEcommerce(positions) });
105
+ }
101
106
  toast.add({
102
107
  title: t("cart.saveToList.success", positions.length, { count: positions.length, list: name }),
103
108
  color: "success",
@@ -82,38 +82,24 @@ const detailUrl = computed(() => {
82
82
 
83
83
  return localePath(categoryProductPath([categorySlug, subcategorySlug], props.item));
84
84
  });
85
- const inputValue = ref(String(props.item.quantity));
86
85
  const confirmOpen = ref(false);
87
-
88
- const parsedInputQuantity = computed(() => {
89
- const sanitized = inputValue.value.replace(/[^0-9]/g, "");
90
- return parseInt(sanitized, 10) || 0;
91
- });
92
- const quantityInvalid = computed(() => parsedInputQuantity.value < 1);
93
- const quantityExceeded = computed(() => {
94
- if (typeof maxOrderQuantity.value !== "number") {
95
- return false;
96
- }
97
-
98
- return parsedInputQuantity.value > maxOrderQuantity.value;
99
- });
100
86
  const currentCartQuantity = computed(() => props.item.quantity);
101
87
 
102
- let quantityErrorTimer: ReturnType<typeof setTimeout> | null = null;
103
- const showQuantityError = ref(false);
104
- const maxExceededAttempted = ref(false);
105
-
106
- function triggerQuantityError() {
107
- showQuantityError.value = true;
108
- if (quantityErrorTimer !== null) {
109
- clearTimeout(quantityErrorTimer);
110
- }
111
- quantityErrorTimer = setTimeout(() => {
112
- showQuantityError.value = false;
113
- maxExceededAttempted.value = false;
114
- quantityErrorTimer = null;
115
- }, 2000);
116
- }
88
+ // Mini-cart: − at 1 removes the line (the store reads 0 as remove), so the
89
+ // stepper floor is 0 here.
90
+ const {
91
+ inputValue,
92
+ notice: quantityNotice,
93
+ decrease,
94
+ increase,
95
+ onInput: onQuantityInput,
96
+ commit: commitInput,
97
+ } = useQuantityStepper({
98
+ quantity: () => props.item.quantity,
99
+ max: () => maxOrderQuantity.value,
100
+ min: 0,
101
+ apply: next => cart.updateQuantity(props.item.id, next),
102
+ });
117
103
 
118
104
  const ariaQuantityOfLabel = computed(() =>
119
105
  t("cart.item.ariaQuantityOf", { name: props.item.name, quantity: props.item.quantity }),
@@ -128,50 +114,6 @@ const ariaIncreaseQuantityLabel = computed(() =>
128
114
  t("cart.item.ariaIncreaseQuantity", { name: props.item.name }),
129
115
  );
130
116
 
131
- watch(() => props.item.quantity, (val: number) => {
132
- inputValue.value = String(val);
133
- });
134
-
135
- function applyQuantity(nextQuantity: number) {
136
- if (typeof maxOrderQuantity.value === "number" && nextQuantity > maxOrderQuantity.value) {
137
- maxExceededAttempted.value = true;
138
- triggerQuantityError();
139
- return;
140
- }
141
- cart.updateQuantity(props.item.id, nextQuantity);
142
- }
143
-
144
- function decrease() {
145
- applyQuantity(props.item.quantity - 1);
146
- }
147
-
148
- function increase() {
149
- applyQuantity(props.item.quantity + 1);
150
- }
151
-
152
- function onQuantityInput(event: Event) {
153
- const input = event.target as HTMLInputElement;
154
- const sanitized = input.value.replace(/[^0-9]/g, "");
155
- inputValue.value = sanitized;
156
- }
157
-
158
- function commitInput() {
159
- if (quantityInvalid.value || quantityExceeded.value) {
160
- triggerQuantityError();
161
- inputValue.value = String(props.item.quantity);
162
- return;
163
- }
164
-
165
- applyQuantity(parsedInputQuantity.value);
166
- }
167
-
168
- onUnmounted(() => {
169
- if (quantityErrorTimer !== null) {
170
- clearTimeout(quantityErrorTimer);
171
- quantityErrorTimer = null;
172
- }
173
- });
174
-
175
117
  onMounted(() => {
176
118
  if (!props.item.categorySlug || !props.item.subcategorySlug) {
177
119
  void loadFallbackSlugs();
@@ -259,13 +201,13 @@ onMounted(() => {
259
201
  </template>
260
202
  </div>
261
203
  <UiFeedbackErrorBoundary
262
- v-if="showQuantityError && maxExceededAttempted && maxOrderQuantity"
204
+ v-if="quantityNotice === 'max' && maxOrderQuantity"
263
205
  :title="t('product.actions.maxQuantityReachedTitle', { count: currentCartQuantity })"
264
206
  :description="t('product.actions.maxQuantityReachedDescription', { max: maxOrderQuantity })"
265
207
  :show-retry="false"
266
208
  />
267
209
  <UiFeedbackErrorBoundary
268
- v-if="showQuantityError && quantityInvalid"
210
+ v-if="quantityNotice === 'invalid'"
269
211
  :title="t('product.actions.invalidQuantityTitle')"
270
212
  :description="t('product.actions.invalidQuantityDescription')"
271
213
  :show-retry="false"
@@ -7,7 +7,6 @@ const featureOrderLists = computed(() =>
7
7
  import { categoryProductPath } from "../../../composables/useProducts";
8
8
  import type { CalculatedCartLine } from "../../../interfaces/cart-calculation";
9
9
  import type { CartItem } from "../../../interfaces/cart-item";
10
- import { CART_MAX_QUANTITY } from "../../../interfaces/cart-item";
11
10
 
12
11
  /**
13
12
  * Full cart position (Cart 2.0): selector, drag handle, article identity,
@@ -64,31 +63,19 @@ const availabilityColor = computed(() => {
64
63
  });
65
64
 
66
65
  /* ---- quantity ---------------------------------------------------- */
67
- const inputValue = ref(String(props.item.quantity));
68
- watch(() => props.item.quantity, (val) => {
69
- inputValue.value = String(val);
66
+ const {
67
+ inputValue: quantityInput,
68
+ canDecrease,
69
+ decrease,
70
+ increase,
71
+ onInput: onQuantityInput,
72
+ commit: commitQuantity,
73
+ } = useQuantityStepper({
74
+ quantity: () => props.item.quantity,
75
+ max: () => props.item.maxOrderQuantity,
76
+ apply: next => cart.updateQuantityByKey(lineKey.value, next),
70
77
  });
71
78
 
72
- function applyQuantity(next: number): void {
73
- const clamped = Math.min(Math.max(next, 1), props.item.maxOrderQuantity ?? CART_MAX_QUANTITY);
74
- cart.updateQuantityByKey(lineKey.value, clamped);
75
- inputValue.value = String(clamped);
76
- }
77
-
78
- function onQuantityInput(event: Event): void {
79
- const input = event.target as HTMLInputElement;
80
- inputValue.value = input.value.replace(/[^0-9]/g, "").slice(0, 6);
81
- }
82
-
83
- function commitInput(): void {
84
- const parsed = parseInt(inputValue.value, 10);
85
- if (!parsed || parsed < 1) {
86
- inputValue.value = String(props.item.quantity);
87
- return;
88
- }
89
- applyQuantity(parsed);
90
- }
91
-
92
79
  // A position nobody can order reads as a warning, and one missing a cost centre
93
80
  // too: both are things the buyer has to act on before the cart will go through.
94
81
  // Everything else is a note.
@@ -293,20 +280,20 @@ const hintColor = (type: string) =>
293
280
  variant="soft"
294
281
  size="xs"
295
282
  tabindex="0"
296
- :disabled="item.quantity <= 1"
283
+ :disabled="!canDecrease"
297
284
  :aria-label="t('cart.item.ariaDecreaseQuantity', { name: item.name })"
298
- @click="applyQuantity(item.quantity - 1)"
285
+ @click="decrease"
299
286
  />
300
287
  <input
301
- v-model="inputValue"
288
+ v-model="quantityInput"
302
289
  type="text"
303
290
  inputmode="numeric"
304
291
  :aria-label="t('cart.item.ariaInputQuantity', { name: item.name })"
305
292
  class="w-14 text-center text-sm border border-(--ui-border) rounded px-1 py-0.5
306
293
  bg-transparent focus:outline-none focus:ring-1 focus:ring-(--ui-primary)"
307
294
  @input="onQuantityInput"
308
- @keydown.enter.prevent="commitInput"
309
- @blur="commitInput"
295
+ @keydown.enter.prevent="commitQuantity"
296
+ @blur="commitQuantity"
310
297
  >
311
298
  <UButton
312
299
  :icon="icon('plus')"
@@ -315,7 +302,7 @@ const hintColor = (type: string) =>
315
302
  size="xs"
316
303
  tabindex="0"
317
304
  :aria-label="t('cart.item.ariaIncreaseQuantity', { name: item.name })"
318
- @click="applyQuantity(item.quantity + 1)"
305
+ @click="increase"
319
306
  />
320
307
  </div>
321
308
  <span