@revenexx/cover 0.7.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 (175) hide show
  1. package/app/api/account.ts +4 -0
  2. package/app/api/forms.ts +1 -0
  3. package/app/app.config.ts +17 -12
  4. package/app/assets/css/cover.css +9 -0
  5. package/app/components/RevenexxForm.vue +84 -12
  6. package/app/components/account/AccountShell.vue +18 -0
  7. package/app/components/account/AccountSidebar.vue +2 -5
  8. package/app/components/account/approvals/AccountPendingApprovals.vue +178 -0
  9. package/app/components/account/dashboard/AccountDashboardKpis.vue +74 -34
  10. package/app/components/account/dashboard/AccountDashboardQuickActions.vue +24 -6
  11. package/app/components/account/orderlists/AccountOrderListDetail.vue +47 -4
  12. package/app/components/account/orders/AccountOrderDetail.vue +186 -1
  13. package/app/components/account/organization/AccountOrganization.vue +3 -1
  14. package/app/components/account/payments/AccountPayments.vue +129 -0
  15. package/app/components/account/quotes/AccountQuoteDetail.vue +48 -16
  16. package/app/components/account/team/AccountTeam.vue +32 -7
  17. package/app/components/auth/AuthForgotPasswordPanel.vue +9 -4
  18. package/app/components/auth/AuthLoginPanel.vue +136 -18
  19. package/app/components/auth/AuthMagicLinkPanel.vue +70 -0
  20. package/app/components/cart/actions/CartSaveToListModal.vue +5 -0
  21. package/app/components/cart/item/CartItem.vue +17 -75
  22. package/app/components/cart/position/CartPosition.vue +17 -30
  23. package/app/components/cart/quote/CartQuoteRequestModal.vue +9 -1
  24. package/app/components/cart/view/CartSummaryPanel.vue +54 -0
  25. package/app/components/category/view/GridView.vue +10 -1
  26. package/app/components/category/view/ListView.vue +10 -1
  27. package/app/components/checkout/confirmation/CheckoutConfirmationActions.vue +2 -0
  28. package/app/components/checkout/onepage/CheckoutAddressSection.vue +4 -4
  29. package/app/components/checkout/onepage/CheckoutDeliverySection.vue +31 -3
  30. package/app/components/checkout/onepage/CheckoutGate.vue +10 -7
  31. package/app/components/checkout/onepage/CheckoutOnePageView.vue +1 -1
  32. package/app/components/checkout/onepage/CheckoutPaymentSection.vue +10 -0
  33. package/app/components/checkout/onepage/CheckoutSummarySection.vue +7 -1
  34. package/app/components/form/FormPage.vue +40 -0
  35. package/app/components/layout/Region.vue +13 -0
  36. package/app/components/layout/footer/Footer.vue +8 -0
  37. package/app/components/layout/header/AppBar.vue +11 -4
  38. package/app/components/layout/header/MainNav.vue +26 -4
  39. package/app/components/layout/header/MobileMenu.vue +12 -0
  40. package/app/components/listing/ListingResults.vue +3 -1
  41. package/app/components/product/card/Compact.vue +10 -1
  42. package/app/components/product/detail/ProductDetailAddToCart.vue +51 -18
  43. package/app/components/product/detail/ProductDetailIdentity.vue +1 -1
  44. package/app/components/product/detail/ProductDetailPriceRequest.vue +39 -0
  45. package/app/components/product/detail/ProductDetailSaveToList.vue +10 -0
  46. package/app/components/product/detail/ProductDetailView.vue +57 -0
  47. package/app/composables/useAccountDashboard.ts +0 -10
  48. package/app/composables/useAccountHold.ts +45 -0
  49. package/app/composables/useAccountNavigation.ts +35 -0
  50. package/app/composables/useAccountPayments.ts +21 -0
  51. package/app/composables/useAccountQuotes.ts +15 -2
  52. package/app/composables/useAuthStore.ts +84 -2
  53. package/app/composables/useAuthoredForms.ts +26 -0
  54. package/app/composables/useAvailableOffers.ts +42 -0
  55. package/app/composables/useCategoryListing.ts +6 -0
  56. package/app/composables/useCheckoutOnePage.ts +21 -2
  57. package/app/composables/useGuestOrdering.ts +28 -0
  58. package/app/composables/useMasterDataEditable.ts +45 -7
  59. package/app/composables/useOrderListRules.ts +21 -1
  60. package/app/composables/usePendingApprovals.ts +37 -0
  61. package/app/composables/useProductCard.ts +29 -2
  62. package/app/composables/useProductListing.ts +79 -0
  63. package/app/composables/useQuantityStepper.ts +90 -0
  64. package/app/composables/useQuickActions.ts +35 -0
  65. package/app/composables/useRoleGrants.ts +32 -0
  66. package/app/composables/useSearchListing.ts +4 -0
  67. package/app/composables/useThemeEvents.ts +144 -0
  68. package/app/config/accountDashboard.ts +26 -0
  69. package/app/config/icons.ts +2 -0
  70. package/app/config/navigation.ts +2 -2
  71. package/app/config/quickActions.ts +40 -5
  72. package/app/formkit.config.ts +14 -0
  73. package/app/interfaces/account/approvals.ts +37 -0
  74. package/app/interfaces/account/dashboard.ts +2 -0
  75. package/app/interfaces/account/order-list.ts +29 -0
  76. package/app/interfaces/account/order-lists.ts +9 -0
  77. package/app/interfaces/account/payments.ts +48 -0
  78. package/app/interfaces/auth.ts +24 -2
  79. package/app/interfaces/b2b.ts +8 -8
  80. package/app/interfaces/offers.ts +35 -0
  81. package/app/interfaces/quantity-stepper.ts +17 -0
  82. package/app/interfaces/shopSettings.ts +77 -0
  83. package/app/layouts/default.vue +19 -10
  84. package/app/layouts/focus.vue +28 -7
  85. package/app/middleware/checkout-guard.ts +7 -1
  86. package/app/pages/punchout/transfer.vue +22 -0
  87. package/app/plugins/account-hold.client.ts +20 -0
  88. package/app/plugins/shop-settings.ts +27 -12
  89. package/app/plugins/theme-events.client.ts +132 -0
  90. package/app/shared/themeEvents.ts +445 -0
  91. package/i18n/locales/de/account.json +87 -0
  92. package/i18n/locales/de/auth.json +30 -0
  93. package/i18n/locales/de/cart.json +9 -1
  94. package/i18n/locales/de/checkout.json +4 -2
  95. package/i18n/locales/de/common.json +4 -0
  96. package/i18n/locales/de/cover.json +44 -0
  97. package/i18n/locales/de/editor.json +47 -1
  98. package/i18n/locales/de/forms.json +27 -0
  99. package/i18n/locales/en/account.json +87 -0
  100. package/i18n/locales/en/auth.json +30 -0
  101. package/i18n/locales/en/cart.json +9 -1
  102. package/i18n/locales/en/checkout.json +4 -2
  103. package/i18n/locales/en/common.json +4 -0
  104. package/i18n/locales/en/cover.json +44 -0
  105. package/i18n/locales/en/editor.json +47 -1
  106. package/i18n/locales/en/forms.json +27 -0
  107. package/nuxt.config.ts +15 -1
  108. package/package.json +6 -2
  109. package/server/api/account/address/[id].delete.ts +1 -1
  110. package/server/api/account/address/[id].put.ts +1 -1
  111. package/server/api/account/address/index.post.ts +1 -1
  112. package/server/api/account/order-lists/[id].get.ts +37 -3
  113. package/server/api/account/orders/[id]/cancel.post.ts +54 -0
  114. package/server/api/account/orders/[id]/messages.get.ts +63 -0
  115. package/server/api/account/orders/[id]/messages.post.ts +44 -0
  116. package/server/api/account/orders/[id]/return.post.ts +1 -0
  117. package/server/api/account/orders/[id].get.ts +1 -1
  118. package/server/api/account/organization.put.ts +1 -1
  119. package/server/api/account/payments.get.ts +54 -0
  120. package/server/api/account/pending-approvals/[id]/approve.post.ts +10 -0
  121. package/server/api/account/pending-approvals/[id]/decline.post.ts +10 -0
  122. package/server/api/account/pending-approvals/index.get.ts +26 -0
  123. package/server/api/account/profile.get.ts +3 -1
  124. package/server/api/account/profile.put.ts +1 -1
  125. package/server/api/account/quotes/[id]/decline.post.ts +35 -6
  126. package/server/api/account/team/[id].put.ts +1 -1
  127. package/server/api/account/team.post.ts +1 -1
  128. package/server/api/auth/login.post.ts +6 -0
  129. package/server/api/auth/magic-link.post.ts +32 -0
  130. package/server/api/auth/magic-link.put.ts +35 -0
  131. package/server/api/auth/otp.post.ts +33 -0
  132. package/server/api/auth/otp.put.ts +33 -0
  133. package/server/api/carts/[id]/activate.post.ts +1 -0
  134. package/server/api/carts/[id]/index.delete.ts +1 -0
  135. package/server/api/carts/[id]/index.put.ts +1 -0
  136. package/server/api/carts/[id]/items.post.ts +1 -0
  137. package/server/api/checkout/profile.get.ts +6 -3
  138. package/server/api/forms/[slug]/submit.post.ts +27 -16
  139. package/server/api/forms/[slug].get.ts +9 -1
  140. package/server/api/forms/index.get.ts +23 -0
  141. package/server/api/orders/index.post.ts +41 -0
  142. package/server/api/promotions/available.post.ts +37 -0
  143. package/server/api/quick-actions.get.ts +6 -38
  144. package/server/config/account/organization.json +0 -4
  145. package/server/config/shop/app-settings.json +4 -0
  146. package/server/data/forms/authored.json +337 -0
  147. package/server/interfaces/forms.ts +51 -0
  148. package/server/middleware/buyer-principal.ts +18 -0
  149. package/server/routes/punchout/start.get.ts +2 -2
  150. package/server/services/ApiAddressBookService.ts +43 -1
  151. package/server/services/ApiAuthService.ts +101 -10
  152. package/server/services/ApiCartService.ts +3 -10
  153. package/server/services/ApiFormsService.ts +56 -0
  154. package/server/services/ApiOrganizationService.ts +7 -2
  155. package/server/services/ApiTeamService.ts +93 -21
  156. package/server/services/MockB2BContextService.ts +1 -5
  157. package/server/services/MockFormsService.ts +63 -0
  158. package/server/utils/accountPayments.ts +45 -0
  159. package/server/utils/appSettings.ts +69 -4
  160. package/server/utils/buyerIdentity.ts +168 -0
  161. package/server/utils/cartOwnership.ts +27 -0
  162. package/server/utils/forms.ts +62 -14
  163. package/server/utils/formsService.ts +29 -0
  164. package/server/utils/liveOrderLists.ts +50 -23
  165. package/server/utils/liveOrders.ts +65 -24
  166. package/server/utils/livePrices.ts +7 -15
  167. package/server/utils/masterData.ts +60 -11
  168. package/server/utils/passwordlessSignIn.ts +82 -0
  169. package/server/utils/pendingApprovals.ts +175 -0
  170. package/server/utils/procurementCheckout.ts +2 -0
  171. package/server/utils/promotionsService.ts +90 -0
  172. package/server/utils/quickActionCatalogue.ts +53 -0
  173. package/server/utils/quotesService.ts +15 -0
  174. package/server/utils/revenexxSdk.ts +116 -2
  175. package/server/utils/shopSettings.ts +35 -4
@@ -0,0 +1,26 @@
1
+ import type { AccountDashboardKpiId } from "../interfaces/account/dashboard";
2
+
3
+ /** Every dashboard KPI, in the order the band renders them. */
4
+ export const ACCOUNT_DASHBOARD_KPI_IDS: readonly AccountDashboardKpiId[] = [
5
+ "openOrders",
6
+ "awaitingApproval",
7
+ "spend30",
8
+ "budgetUsed",
9
+ ];
10
+
11
+ function isAccountDashboardKpiId(id: string): id is AccountDashboardKpiId {
12
+ return (ACCOUNT_DASHBOARD_KPI_IDS as readonly string[]).includes(id);
13
+ }
14
+
15
+ /**
16
+ * Narrows a requested KPI selection (a block option, a tenant setting) to the
17
+ * KPIs that exist, in canonical order and without duplicates. A selection that
18
+ * leaves nothing valid — empty, or only unknown ids — resolves to the full set:
19
+ * the band always shows at least one KPI, and an editor who unchecks every box
20
+ * gets the default rather than an empty frame.
21
+ */
22
+ export function resolveAccountDashboardKpis(ids: readonly string[]): AccountDashboardKpiId[] {
23
+ const requested = new Set(ids.filter(isAccountDashboardKpiId));
24
+ const resolved = ACCOUNT_DASHBOARD_KPI_IDS.filter(id => requested.has(id));
25
+ return resolved.length > 0 ? resolved : [...ACCOUNT_DASHBOARD_KPI_IDS];
26
+ }
@@ -123,6 +123,8 @@ export const coverIconGroups: CoverIconGroup[] = [
123
123
  "package": "box",
124
124
  "delivery": "delivery",
125
125
  "payment": "card",
126
+ // An offer a buyer has not earned yet — the cart's "you could still get".
127
+ "offer": "ticket-sale",
126
128
  "store": "shop",
127
129
  "direct-order": "keyboard",
128
130
  "order-list": "clipboard-list",
@@ -33,7 +33,7 @@ export const footerLinks = {
33
33
  support: {
34
34
  heading: "Support",
35
35
  links: [
36
- { label: "Contact", to: "/support/contact" },
36
+ { label: "Contact", to: "/contact" },
37
37
  { label: "Documentation", to: "/support/docs" },
38
38
  { label: "System Status", to: "/support/status" },
39
39
  { label: "Request Quote", to: "/quote" },
@@ -117,7 +117,7 @@ export const topbarUsps: TopbarUsp[] = [
117
117
 
118
118
  /** Right side of the topbar — quick links. */
119
119
  export const topbarQuickLinks: NavItem[] = [
120
- { labelKey: "topbar.contact", to: "/support/contact" },
120
+ { labelKey: "topbar.contact", to: "/contact" },
121
121
  { labelKey: "topbar.aboutUs", to: "/about" },
122
122
  { labelKey: "topbar.locations", to: "/locations" },
123
123
  ];
@@ -1,4 +1,4 @@
1
- import type { AccountNavLink } from "./navigation";
1
+ import type { AccountNavGroup, AccountNavLink } from "./navigation";
2
2
 
3
3
  import { accountNavigation } from "./navigation";
4
4
 
@@ -28,9 +28,9 @@ export interface QuickAction {
28
28
  }
29
29
 
30
30
  /**
31
- * Render AND editor order in one list: the blokkli checkboxes control sorts any
32
- * selection back into the declared option order, so there is no authorable
33
- * ordering — this array is the only place tile order is decided. It opens with
31
+ * Catalogue order: what the picker overlay lists, and the order of a resolved
32
+ * allowed set. Tile order on the page is the editor's own — the picker stores
33
+ * its selection in authored order (see `resolveQuickActions`). It opens with
34
34
  * the four shortcuts the live shop shows by default.
35
35
  */
36
36
  const QUICK_ACTION_ORDER: readonly string[] = [
@@ -60,6 +60,18 @@ export const DEFAULT_QUICK_ACTION_IDS: readonly string[] = [
60
60
  "cart",
61
61
  ];
62
62
 
63
+ /**
64
+ * The account dashboard's quick-access widget default — what an instance
65
+ * without an authored selection shows, in this order.
66
+ */
67
+ export const DASHBOARD_QUICK_ACTION_IDS: readonly string[] = [
68
+ "direct-order",
69
+ "orders",
70
+ "order-lists",
71
+ "requisitions",
72
+ "cost-centers",
73
+ ];
74
+
63
75
  /**
64
76
  * Shortcuts with no `accountNavigation` counterpart. The direct-order tile is
65
77
  * labelled "Schnellerfassung" rather than the page's own "Direktbestellung":
@@ -87,7 +99,7 @@ const ICON_OVERRIDES: Record<string, string> = {
87
99
  };
88
100
 
89
101
  /** `/account` → `dashboard`, `/account/cost-centers` → `cost-centers`. */
90
- function actionIdForPath(path: string): string {
102
+ export function actionIdForPath(path: string): string {
91
103
  if (path === "/account") {
92
104
  return "dashboard";
93
105
  }
@@ -136,3 +148,26 @@ export const QUICK_ACTION_IDS: readonly string[] = quickActions.map(action => ac
136
148
  export function resolveQuickActions(ids: readonly string[]): QuickAction[] {
137
149
  return ids.flatMap(id => quickActions.find(action => action.id === id) ?? []);
138
150
  }
151
+
152
+ /**
153
+ * The ids a given account navigation permits, in catalogue order. A shortcut
154
+ * is only offered — in the picker and on the page — when the sidebar links its
155
+ * target, so a tile never points where the tenant's nav does not: a tenant
156
+ * whose nav has no Kostenstellen gets no Kostenstellen tile.
157
+ *
158
+ * The two standalone shortcuts are exempt: they are never nav links by design,
159
+ * so the nav cannot vouch for them and does not need to. `null` stands for
160
+ * "no tenant nav" (the layer's static tree) and permits the whole catalogue.
161
+ */
162
+ export function allowedQuickActionIds(nav: readonly AccountNavGroup[] | null): string[] {
163
+ if (nav === null) {
164
+ return [...QUICK_ACTION_IDS];
165
+ }
166
+ const permitted = new Set(Object.keys(STANDALONE_ACTIONS));
167
+ for (const group of nav) {
168
+ for (const link of group.links) {
169
+ permitted.add(actionIdForPath(link.to));
170
+ }
171
+ }
172
+ return QUICK_ACTION_IDS.filter(id => permitted.has(id));
173
+ }
@@ -66,6 +66,20 @@ export default defineFormKitConfig({
66
66
  input: "w-4 h-4 rounded border-(--ui-border) accent-(--ui-primary)",
67
67
  label: "text-sm text-highlighted !font-normal",
68
68
  },
69
+ // A radio inherits `global.input` without this, so every option
70
+ // rendered as a full-width bordered box. The Cockpit's palette offers
71
+ // radio groups, so an operator could author a form the shop could not
72
+ // render presentably — and "choose one" is the second thing anybody
73
+ // puts on a contact form.
74
+ radio: {
75
+ options: "flex flex-col gap-2",
76
+ option: "flex items-center",
77
+ wrapper: "flex items-center gap-2 cursor-pointer",
78
+ inner: "flex items-center !w-auto",
79
+ input: "w-4 h-4 border-(--ui-border) accent-(--ui-primary)",
80
+ label: "text-sm text-highlighted !font-normal",
81
+ legend: "text-sm font-medium text-highlighted",
82
+ },
69
83
  }),
70
84
  },
71
85
  });
@@ -0,0 +1,37 @@
1
+ /**
2
+ * What is waiting on this approver.
3
+ *
4
+ * A different question from "what did my company ask for", and the one an approver
5
+ * signs in to answer. The shop showed only the second, so the person whose whole
6
+ * reason for being there is to say yes or no found a list of other people's
7
+ * requests with no buttons on it — and the deciding happened in the Cockpit, which
8
+ * is not where a buying organisation works.
9
+ */
10
+ export interface PendingApproval {
11
+ id: string;
12
+ /** The request this layer belongs to. */
13
+ requestId: string;
14
+ /** Its number, as the requester knows it. */
15
+ requestNumber: string | null;
16
+ /** Who asked. */
17
+ requestedBy: string | null;
18
+ /** What it comes to, where the request states a figure. */
19
+ total: number | null;
20
+ currency: string | null;
21
+ /** The cost centre it books to. */
22
+ costCentreCode: string | null;
23
+ /**
24
+ * Which layer of the chain this is.
25
+ *
26
+ * Approvals are stacked: approving one unlocks the next, and the request is
27
+ * approved when the last of them is. A queue that hid the position would make
28
+ * an approver think theirs was the only signature needed.
29
+ */
30
+ layer: number;
31
+ /** When it landed on this desk. */
32
+ at: string;
33
+ }
34
+
35
+ export interface PendingApprovalsResponse {
36
+ approvals: PendingApproval[];
37
+ }
@@ -0,0 +1,2 @@
1
+ /** The KPIs the account dashboard band can show, keyed as in `account.dashboard.stats.*`. */
2
+ export type AccountDashboardKpiId = "openOrders" | "awaitingApproval" | "spend30" | "budgetUsed";
@@ -59,6 +59,35 @@ export interface AccountOrder {
59
59
  readonly approvers?: string[];
60
60
  /** Returns already requested against this order. */
61
61
  readonly returns?: AccountOrderReturn[];
62
+ /**
63
+ * Whether the buyer may still call this order off.
64
+ *
65
+ * The orders app refuses a cancellation once anything has shipped, and holds
66
+ * one that is on hold where the merchant said a hold blocks it too. So the
67
+ * shop asks rather than deciding: a button that produces an error is worse
68
+ * than no button.
69
+ */
70
+ readonly cancellable?: boolean;
71
+ /** Where cancelling requires the buyer to say why, as the merchant set it. */
72
+ readonly cancelNeedsReason?: boolean;
73
+ /**
74
+ * What has been said about this order, buyer-visible only.
75
+ *
76
+ * The merchant's desk keeps its own notes beside these and the buyer never
77
+ * sees them — a trail is a record of a conversation WITH the buyer, and the
78
+ * desk's remarks about a customer are not part of it.
79
+ */
80
+ readonly messages?: AccountOrderMessage[];
81
+ }
82
+
83
+ /** One thing said about an order, by either side. */
84
+ export interface AccountOrderMessage {
85
+ readonly id: string;
86
+ readonly body: string;
87
+ readonly author: string | null;
88
+ readonly at: string;
89
+ /** True where the buyer wrote it, so the two sides read apart. */
90
+ readonly fromBuyer: boolean;
62
91
  }
63
92
 
64
93
  export interface AccountOrderListResponse {
@@ -20,6 +20,15 @@ export interface OrderListPosition {
20
20
  customSku?: string;
21
21
  categorySlug?: string;
22
22
  subcategorySlug?: string;
23
+ /**
24
+ * Whether the shop still carries this part.
25
+ *
26
+ * A list is a decision somebody made once and everybody orders from since, so
27
+ * it outlives the catalogue: a seal is discontinued and the list still names it.
28
+ * Undefined where the question could not be asked — a failed catalogue read
29
+ * must not make a part look discontinued.
30
+ */
31
+ available?: boolean;
23
32
  }
24
33
 
25
34
  export interface OrderList {
@@ -0,0 +1,48 @@
1
+ /**
2
+ * What the buyer still owes, and what they have already paid.
3
+ *
4
+ * A B2B buyer on account does not ask "did my card go through" — they ask which
5
+ * invoices are open and which are late, because somebody in their accounts
6
+ * department is asking them. The platform has kept this all along and no shop
7
+ * showed it, so the answer was a telephone call to the merchant.
8
+ *
9
+ * Amounts are in the currency the payment was taken in; a buyer trading in two
10
+ * currencies has two sets of figures and they are never added together.
11
+ */
12
+ export type AccountPaymentState =
13
+ | "open"
14
+ | "pending"
15
+ | "authorized"
16
+ | "paid"
17
+ | "partially_paid"
18
+ | "refunded"
19
+ | "failed";
20
+
21
+ export interface AccountPayment {
22
+ id: string;
23
+ /** The order this is for, as the buyer knows it. */
24
+ orderNumber: string | null;
25
+ amount: number;
26
+ currency: string;
27
+ state: AccountPaymentState;
28
+ /** How it was to be paid, in the merchant's own words for it. */
29
+ method: string | null;
30
+ /** When the money arrived, where it has. */
31
+ paidAt: string | null;
32
+ /** When it is due. Absent where the merchant set no term. */
33
+ dueAt: string | null;
34
+ /**
35
+ * Past its due date and still unpaid.
36
+ *
37
+ * Computed from the date rather than read from the dunning stage: a merchant
38
+ * who has not started chasing still has an overdue invoice, and the buyer who
39
+ * wants to settle it before the chasing starts is the one this is for.
40
+ */
41
+ overdue: boolean;
42
+ }
43
+
44
+ export interface AccountPaymentsResponse {
45
+ payments: AccountPayment[];
46
+ /** Still owed, per currency — never summed across them. */
47
+ outstanding: Array<{ currency: string; amount: number }>;
48
+ }
@@ -16,6 +16,24 @@ export interface AuthUser {
16
16
  contactId?: string;
17
17
  /** The contact's B2B organization, when one applies. */
18
18
  organizationId?: string;
19
+ /**
20
+ * Whether this account may act.
21
+ *
22
+ * The platform answers it — a blocked, pending or rejected contact is not
23
+ * active — and the shop used to throw the answer away, so every such buyer saw
24
+ * the whole shop, filled a cart, and was refused at the write by an error that
25
+ * explained nothing. Undefined where the source does not say, which is the demo
26
+ * and every older session cookie: absent means active, because that is what it
27
+ * meant before anybody asked.
28
+ */
29
+ active?: boolean;
30
+ /**
31
+ * What this person's role lets them do in their organization
32
+ * (`contacts.manage`, `addresses.manage`, …), derived by the customers app on
33
+ * every read. Undefined where the source does not say — the demo personas;
34
+ * a live session always states it, an empty list included.
35
+ */
36
+ permissions?: string[];
19
37
  }
20
38
 
21
39
  /**
@@ -62,9 +80,13 @@ export interface StoredSession {
62
80
  personaId?: string;
63
81
  /** Set for public-API sessions — the platform user behind the session. */
64
82
  userId?: string;
65
- /** Set for public-API sessions — the customers-app contact (cart owner). */
83
+ /**
84
+ * Written by sessions older than RAD-155 and IGNORED on read: the browser
85
+ * can rewrite this cookie, so the contact and organization are taken from
86
+ * the identity service per request instead (server/utils/buyerIdentity).
87
+ */
66
88
  contactId?: string;
67
- /** Set for public-API sessions — the contact's organization (price scope). */
89
+ /** As contactId — legacy, never trusted. */
68
90
  organizationId?: string;
69
91
  }
70
92
 
@@ -37,14 +37,14 @@ export interface OrganizationSettings {
37
37
  minOrderValue: number;
38
38
  };
39
39
  checkout: {
40
- /** Guest ordering without an account, per customer type. */
41
- guestOrdering: {
42
- /** Business customers (company data required). */
43
- b2b: boolean;
44
- /** Private customers (no company data, gross prices). */
45
- b2c: boolean;
46
- };
47
- /** The order/PO number is a mandatory field. */
40
+ /**
41
+ * The order/PO number is a mandatory field.
42
+ *
43
+ * Whether somebody may order WITHOUT an account used to sit here too. It
44
+ * is the orders app's, because that app refuses such a placement itself —
45
+ * a shop holding a second answer could offer a buyer a whole checkout to
46
+ * be turned away at the end of it.
47
+ */
48
48
  orderNumberRequired: boolean;
49
49
  };
50
50
  }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * What this buyer could still get.
3
+ *
4
+ * A different question from what their cart is owed, and the promotions app makes
5
+ * the point itself: a shop that can only answer the second can only tell a buyer
6
+ * about a discount after they have already earned it. This one answers the first —
7
+ * each offer says how far away it is, and "12 € more" is the sentence that raises
8
+ * an order value.
9
+ *
10
+ * Deliberately not called a promotion. A buyer does not read "promotion"; they read
11
+ * an offer they are twelve euros short of.
12
+ */
13
+ export interface AvailableOffer {
14
+ id: string;
15
+ /** What the merchant named it — shown as it stands. */
16
+ name: string;
17
+ /** True where the cart already qualifies: earned, not merely available. */
18
+ reached: boolean;
19
+ /** A code has to be entered for this one; the code itself is never sent. */
20
+ needsCode: boolean;
21
+ /**
22
+ * How far away it is, where the distance is a number the buyer can act on.
23
+ *
24
+ * `value` is an amount in the cart's currency, `quantity` a count of units.
25
+ * Absent where the condition is not a number — "only for first orders" has no
26
+ * distance, and a shop that invented one would be lying about what to do next.
27
+ */
28
+ missing?: { kind: "value" | "quantity"; amount: number; required: number };
29
+ }
30
+
31
+ export interface AvailableOffersResponse {
32
+ offers: AvailableOffer[];
33
+ /** How many the merchant has in total, when more exist than are listed. */
34
+ total: number;
35
+ }
@@ -0,0 +1,17 @@
1
+ /** Why a quantity stepper refused or corrected an entry. */
2
+ export type QuantityStepperNotice = "max" | "invalid";
3
+
4
+ export interface QuantityStepperOptions {
5
+ /** The committed quantity — a cart line's, or a buy box's amount to add. */
6
+ readonly quantity: () => number;
7
+ /** Ceiling for this stepper; `undefined` falls back to CART_MAX_QUANTITY. */
8
+ readonly max: () => number | undefined;
9
+ /**
10
+ * Lowest value the minus button reaches. 1 by default; the mini-cart uses 0,
11
+ * where the store reads a zero quantity as "remove this line". Typed input
12
+ * below 1 always reverts — nobody removes a position by typing.
13
+ */
14
+ readonly min?: number;
15
+ /** Commits a validated, clamped quantity. */
16
+ readonly apply: (next: number) => void;
17
+ }
@@ -31,6 +31,12 @@ export interface CartAppSettings {
31
31
  maxLines: number;
32
32
  /** carts.max_quantity_per_line — ceiling per line; 0 = no limit. */
33
33
  maxQuantityPerLine: number;
34
+ /**
35
+ * carts.default_currency — what a cart is denominated in when nothing else
36
+ * says. Asked wherever a figure has to be stated before a cart exists, so the
37
+ * shop does not fall back to a currency of its own choosing.
38
+ */
39
+ currency: string;
34
40
  }
35
41
 
36
42
  /* ------------------------------------------------------------------ */
@@ -56,6 +62,21 @@ export interface OrderAppSettings {
56
62
  * entirely on what will happen to it.
57
63
  */
58
64
  onUnorderablePosition: "place" | "drop" | "refuse";
65
+ /**
66
+ * orders.guest_ordering — which kind of shopper may order with no account.
67
+ *
68
+ * The shop used to carry this in its own configuration, which meant two
69
+ * storefronts on one tenant could disagree and a merchant who wanted it off
70
+ * had to ask a developer.
71
+ */
72
+ guestOrdering: "both" | "b2c" | "b2b" | "none";
73
+ /**
74
+ * orders.partial_shipment — whether a delivery may leave the rest open.
75
+ *
76
+ * `never` is the merchant whose goods are worthless half-delivered. The shop
77
+ * then does not ask a buyer to choose, because the answer is already given.
78
+ */
79
+ partialShipment: "allowed" | "never";
59
80
  }
60
81
 
61
82
  /* ------------------------------------------------------------------ */
@@ -137,6 +158,15 @@ export interface OrderListAppSettings {
137
158
  maxLists: number;
138
159
  /** orderlists.shared_lists_editable — may the whole company edit a shared list. */
139
160
  sharedEditable: boolean;
161
+ /**
162
+ * orderlists.on_missing_article — what becomes of a position whose part the
163
+ * shop no longer carries: take it anyway, leave it out, or refuse the lot.
164
+ *
165
+ * Not an edge case. A list is a decision made once and ordered from for years,
166
+ * so it outlives the catalogue it was written from; this is what happens to
167
+ * every list eventually.
168
+ */
169
+ onMissingArticle: "include" | "skip" | "fail";
140
170
  /** orderlists.cart_merge_mode — adding a list to a cart appends or replaces. */
141
171
  cartMergeMode: "append" | "replace";
142
172
  /** orderlists.default_kind — the kind a new list starts as; null = unset. */
@@ -181,6 +211,25 @@ export interface SignInAppSettings {
181
211
  export interface AccountAppSettings {
182
212
  /** customers.single_default_address_per_type — one default per address type. */
183
213
  singleDefaultAddressPerType: boolean;
214
+ /**
215
+ * customers.self_service_master_data — how much of their own data a buyer may
216
+ * change here.
217
+ *
218
+ * Where an ERP is the record, an edit in the shop is a second truth the next
219
+ * import overwrites. The shop used to answer this with four flags of its own,
220
+ * which hid the forms while the platform went on accepting the write.
221
+ */
222
+ selfService: "all" | "addresses_only" | "none";
223
+ /**
224
+ * customers.blocked_contact_behavior — what a buyer whose account is on hold
225
+ * may still do: keep what their role grants, browse the catalogue only, or
226
+ * nothing at all.
227
+ *
228
+ * The platform enforces it on the permission set. The shop reads it to say
229
+ * WHY, because a buyer who fills a cart and is refused at the write learns
230
+ * only that something is broken.
231
+ */
232
+ blockedBuyer: "keep" | "catalog_only" | "deny_all";
184
233
  }
185
234
 
186
235
  /* ------------------------------------------------------------------ */
@@ -205,6 +254,33 @@ export interface ProcurementAppSettings {
205
254
  gate: "none" | "booking_account";
206
255
  }
207
256
 
257
+ /* ------------------------------------------------------------------ */
258
+ /* Authored forms */
259
+ /* ------------------------------------------------------------------ */
260
+
261
+ export interface FormAppSettings {
262
+ /**
263
+ * forms.honeypot_field — the name of a decoy field the storefront renders
264
+ * hidden. A human never fills it; a bot fills everything, and a submission
265
+ * that arrives with it filled in is spam.
266
+ *
267
+ * The app expects the SHOP to render it — it can only judge what it is sent.
268
+ * So a tenant who configured a trap and a storefront that never rendered the
269
+ * field add up to no trap at all, which is what shipped: null here means the
270
+ * merchant named none, and the empty string the app declares means the same.
271
+ */
272
+ honeypotField: string | null;
273
+ /**
274
+ * forms.spam_handling — what becomes of a caught submission. `flag` stores it
275
+ * marked as spam so a false positive is recoverable; `reject` refuses it and
276
+ * nothing is stored, no automation ever hears about it.
277
+ *
278
+ * The storefront reads it to know what to SAY: under `reject` a caught
279
+ * visitor is told their message did not arrive, because it did not.
280
+ */
281
+ spamHandling: "flag" | "reject";
282
+ }
283
+
208
284
  /* ------------------------------------------------------------------ */
209
285
  /* The whole answer */
210
286
  /* ------------------------------------------------------------------ */
@@ -222,6 +298,7 @@ export interface ShopSettings {
222
298
  account: AccountAppSettings;
223
299
  inventory: InventoryAppSettings;
224
300
  procurement: ProcurementAppSettings;
301
+ forms: FormAppSettings;
225
302
  /**
226
303
  * Whether these came from the platform apps or from the bundled demo
227
304
  * tenant. Both are configured values read the same way, so no surface has
@@ -62,23 +62,32 @@ async function handleSearch(q: string): Promise<void> {
62
62
  >
63
63
  Skip to main content
64
64
  </a>
65
- <LayoutHeaderTopBar />
66
- <LayoutHeaderAppBar />
67
- <div class="md:hidden border-b border-(--ui-border) px-4 py-2">
68
- <UiFormsSearchInput
69
- class="w-full"
70
- @search="handleSearch"
71
- />
72
- </div>
73
- <LayoutHeaderMainNav />
65
+ <!-- Layout extension points (ADR-0111): the code header and footer are
66
+ the regions' default content; a theme may add to or replace them. -->
67
+ <LayoutRegion name="header">
68
+ <LayoutHeaderTopBar />
69
+ <LayoutHeaderAppBar />
70
+ <div class="md:hidden border-b border-(--ui-border) px-4 py-2">
71
+ <UiFormsSearchInput
72
+ class="w-full"
73
+ @search="handleSearch"
74
+ />
75
+ </div>
76
+ <LayoutHeaderMainNav />
77
+ </LayoutRegion>
74
78
  <UiDebugPiniaStateCard v-if="false" />
75
79
  <UMain id="main-content">
76
80
  <slot />
77
81
  </UMain>
78
- <LayoutFooter />
82
+ <LayoutRegion name="footer">
83
+ <LayoutFooter />
84
+ </LayoutRegion>
79
85
  <CartDrawer v-if="!isCartOrCheckoutPage" />
80
86
  <CartTargetModal />
81
87
  </div>
88
+ <!-- The cookie choice (Consent Manager): rendered by this shop's own
89
+ server when one is owed, never in the editor or a preview. -->
90
+ <ConsentBanner />
82
91
  </Body>
83
92
  </Html>
84
93
  </template>
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import type { CheckoutCustomerType } from "../composables/useCheckoutOnePage";
2
3
  import type { ShopContact } from "../config/navigation";
3
4
  import { legalLinks as defaultLegalLinks, shopContact as noContact } from "../config/navigation";
4
5
 
@@ -18,7 +19,18 @@ const year = new Date().getFullYear();
18
19
  // Checkout gets a subtly tinted page background so the white section
19
20
  // cards and the summary stand out from the canvas.
20
21
  const route = useRoute();
21
- const tinted = computed(() => /\/checkout(\/|$)/.test(route.path));
22
+ const isCheckoutRoute = computed(() => /\/checkout(\/|$)/.test(route.path));
23
+ const customerType = useState<CheckoutCustomerType>("checkout-customer-type", () => "account");
24
+ const isGuestCheckout = computed(() => isCheckoutRoute.value && customerType.value !== "account");
25
+ const tinted = computed(() => isCheckoutRoute.value || /\/forgot-password(\/|$)/.test(route.path));
26
+
27
+ function onHeaderBackClick(event: MouseEvent): void {
28
+ if (!isGuestCheckout.value) {
29
+ return;
30
+ }
31
+ event.preventDefault();
32
+ customerType.value = "account";
33
+ }
22
34
  </script>
23
35
 
24
36
  <template>
@@ -34,14 +46,15 @@ const tinted = computed(() => /\/checkout(\/|$)/.test(route.path));
34
46
  <div class="w-full max-w-(--ui-container) mx-auto px-4 sm:px-6 lg:px-8 flex-1 pb-20">
35
47
  <header class="pt-10 flex items-center">
36
48
  <div class="flex-1">
37
- <LayoutAppLogo />
49
+ <LayoutAppLogo class="inline-flex min-h-11 items-center" />
38
50
  </div>
39
51
  <NuxtLink
40
- :to="localePath('/')"
52
+ :to="isGuestCheckout ? '#' : localePath(isCheckoutRoute ? '/cart' : '/')"
41
53
  tabindex="0"
42
- class="hover:underline underline-offset-4 decoration-2 text-sm"
54
+ class="inline-flex min-h-11 items-center text-sm decoration-2 underline-offset-4 hover:underline"
55
+ @click="onHeaderBackClick"
43
56
  >
44
- {{ t('nav.backToShop') }}
57
+ {{ t(isGuestCheckout ? 'onepage.gate.backToSelection' : isCheckoutRoute ? 'nav.backToCart' : 'nav.backToShop') }}
45
58
  </NuxtLink>
46
59
  </header>
47
60
  <main>
@@ -64,7 +77,7 @@ const tinted = computed(() => /\/checkout(\/|$)/.test(route.path));
64
77
  <a
65
78
  v-if="shopContact.email"
66
79
  :href="`mailto:${shopContact.email}`"
67
- class="text-xs text-dimmed hover:text-default transition-colors"
80
+ class="inline-flex min-h-11 items-center text-xs text-dimmed transition-colors hover:text-default"
68
81
  >
69
82
  {{ shopContact.email }}
70
83
  </a>
@@ -73,14 +86,22 @@ const tinted = computed(() => /\/checkout(\/|$)/.test(route.path));
73
86
  :key="link.to"
74
87
  :to="localePath(link.to)"
75
88
  tabindex="0"
76
- class="text-xs text-dimmed hover:text-default transition-colors"
89
+ class="inline-flex min-h-11 items-center text-xs text-dimmed transition-colors hover:text-default"
77
90
  >
78
91
  {{ link.label }}
79
92
  </NuxtLink>
93
+ <ConsentPreferencesLink
94
+ class="text-xs text-dimmed hover:text-default transition-colors cursor-pointer"
95
+ >
96
+ {{ t('footer.cookieSettings') }}
97
+ </ConsentPreferencesLink>
80
98
  </nav>
81
99
  </div>
82
100
  </footer>
83
101
  </div>
102
+ <!-- The cookie choice (Consent Manager): rendered by this shop's own
103
+ server when one is owed, never in the editor or a preview. -->
104
+ <ConsentBanner />
84
105
  </Body>
85
106
  </Html>
86
107
  </template>