@revenexx/cover 0.2.23 → 0.2.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app/app.config.ts CHANGED
@@ -54,6 +54,39 @@ export default defineAppConfig({
54
54
  sku_desc: true,
55
55
  },
56
56
  },
57
+ // The reassurance lines under the buy box and in the cart summary. Both
58
+ // are promises about THIS merchant's terms, and a storefront whose terms
59
+ // differ has to be able to take one down — a shop with three weeks of lead
60
+ // time must not tell buyers it delivers by the next working day.
61
+ //
62
+ // Maps rather than lists, for the reason spelled out at `search.sorts`:
63
+ // app.config merges with defu, which CONCATENATES arrays, so an app
64
+ // overriding a list would append to the layer's instead of replacing it.
65
+ // Booleans merge key by key, and an unset key stays on — an app that
66
+ // configures nothing behaves exactly as before.
67
+ //
68
+ // Display order follows the declaration here, not the override.
69
+ product: {
70
+ incentives: {
71
+ delivery: true,
72
+ paymentTerms: true,
73
+ volume: true,
74
+ },
75
+ },
76
+ cart: {
77
+ trust: {
78
+ delivery: true,
79
+ invoice: true,
80
+ support: true,
81
+ },
82
+ },
83
+ // The delivery step's calendar. A storefront whose goods need a lead time
84
+ // sets it here, so the date picker cannot offer a day the merchant could
85
+ // never hit — a catalogue with three weeks of lead time must not let a buyer
86
+ // request tomorrow.
87
+ checkout: {
88
+ earliestDeliveryDays: 0,
89
+ },
57
90
  ui: {
58
91
  icons: nuxtUiIcons(DEFAULT_ICON_WEIGHT),
59
92
  },
@@ -73,11 +73,24 @@ const incentiveProgress = computed(() => {
73
73
  return Math.min(100, Math.round((subtotalAmount.value / openIncentive.value.threshold) * 100));
74
74
  });
75
75
 
76
+ /**
77
+ * The promises that close B2B orders — and promises are merchant-specific. A
78
+ * storefront switches off what its own terms do not cover; a shop with three
79
+ * weeks of lead time must not tell buyers it delivers by the next working day.
80
+ * `id` is the config key, `token` only the icon. Declaration order decides
81
+ * display order, the config only membership, and an unset key stays on.
82
+ */
76
83
  const TRUST_ITEMS = [
77
- { token: "delivery", key: "cart.trust.delivery" },
78
- { token: "payment", key: "cart.trust.invoice" },
79
- { token: "phone", key: "cart.trust.support" },
84
+ { id: "delivery", token: "delivery", key: "cart.trust.delivery" },
85
+ { id: "invoice", token: "payment", key: "cart.trust.invoice" },
86
+ { id: "support", token: "phone", key: "cart.trust.support" },
80
87
  ] as const;
88
+
89
+ const appConfig = useAppConfig();
90
+ const trustItems = computed(() => {
91
+ const configured = appConfig.cart?.trust as Record<string, boolean> | undefined;
92
+ return TRUST_ITEMS.filter(item => configured?.[item.id] !== false);
93
+ });
81
94
  </script>
82
95
 
83
96
  <template>
@@ -176,12 +189,13 @@ const TRUST_ITEMS = [
176
189
 
177
190
  <!-- Trust: the promises that close B2B orders -->
178
191
  <ul
192
+ v-if="trustItems.length"
179
193
  role="list"
180
194
  class="space-y-1.5 pt-1 border-t border-(--ui-border) print:hidden"
181
195
  >
182
196
  <li
183
- v-for="item in TRUST_ITEMS"
184
- :key="item.token"
197
+ v-for="item in trustItems"
198
+ :key="item.id"
185
199
  class="flex items-start gap-2 text-xs text-muted pt-1"
186
200
  >
187
201
  <UIcon
@@ -17,6 +17,15 @@ const shippingCountry = computed(() => {
17
17
  return address?.country ?? "DE";
18
18
  });
19
19
 
20
+ /**
21
+ * The first day the merchant could realistically deliver, in days from today.
22
+ * Offering an earlier one is a request nobody can honour — see
23
+ * `checkout.earliestDeliveryDays`.
24
+ */
25
+ const appConfig = useAppConfig();
26
+ const earliestDeliveryDays = computed<number>(() =>
27
+ Number(appConfig.checkout?.earliestDeliveryDays ?? 0));
28
+
20
29
  const { data: rates } = useFetch<{
21
30
  managed: boolean;
22
31
  methods: DeliveryOption[];
@@ -93,7 +102,10 @@ watch(deliveryOptions, (options) => {
93
102
  <p class="text-sm font-semibold text-highlighted">
94
103
  {{ option.label }}
95
104
  </p>
96
- <p class="text-xs text-muted mt-0.5">
105
+ <p
106
+ v-if="option.eta"
107
+ class="text-xs text-muted mt-0.5"
108
+ >
97
109
  {{ option.eta }} {{ t('onepage.delivery.businessDays') }}
98
110
  </p>
99
111
  </div>
@@ -104,9 +116,11 @@ watch(deliveryOptions, (options) => {
104
116
  />
105
117
  </div>
106
118
  <p class="text-sm font-medium text-highlighted tabular-nums mt-2">
107
- {{ option.price === 0
108
- ? t('onepage.delivery.free')
109
- : formatCurrency(option.price) }}
119
+ {{ option.quoteRequired
120
+ ? t('onepage.delivery.onRequest')
121
+ : option.price === 0
122
+ ? t('onepage.delivery.free')
123
+ : formatCurrency(option.price) }}
110
124
  </p>
111
125
  </button>
112
126
  </div>
@@ -122,7 +136,7 @@ watch(deliveryOptions, (options) => {
122
136
  <FormKit
123
137
  type="datepicker"
124
138
  :value="form.requestedDate"
125
- :min-days="0"
139
+ :min-days="earliestDeliveryDays"
126
140
  :max-days="100"
127
141
  disable-weekends
128
142
  @input="(value: unknown) => { form.requestedDate = String(value ?? ''); validateField('requestedDate'); }"
@@ -34,6 +34,19 @@ const quantityExceeded = computed(() =>
34
34
  let exceededTimer: ReturnType<typeof setTimeout> | null = null;
35
35
  const showQuantityExceeded = ref(false);
36
36
 
37
+ /**
38
+ * The reassurance lines under the buy box. A storefront switches off what its
39
+ * terms do not cover — offering "volume pricing" where none exists is a promise
40
+ * the merchant then has to explain away. Declaration order here decides display
41
+ * order; the config only decides membership, and an unset key stays on.
42
+ */
43
+ const INCENTIVES = ["delivery", "paymentTerms", "volume"] as const;
44
+ const appConfig = useAppConfig();
45
+ const incentives = computed<string[]>(() => {
46
+ const configured = appConfig.product?.incentives as Record<string, boolean> | undefined;
47
+ return INCENTIVES.filter(key => configured?.[key] !== false);
48
+ });
49
+
37
50
  function triggerExceededError() {
38
51
  showQuantityExceeded.value = true;
39
52
  if (exceededTimer !== null) {
@@ -171,9 +184,12 @@ onUnmounted(() => {
171
184
  />
172
185
 
173
186
  <!-- B2B incentives -->
174
- <ul class="rounded-xl bg-elevated/60 ring-1 ring-(--ui-border) divide-y divide-(--ui-border)">
187
+ <ul
188
+ v-if="incentives.length"
189
+ class="rounded-xl bg-elevated/60 ring-1 ring-(--ui-border) divide-y divide-(--ui-border)"
190
+ >
175
191
  <li
176
- v-for="incentive in (['delivery', 'paymentTerms', 'volume'] as const)"
192
+ v-for="incentive in incentives"
177
193
  :key="incentive"
178
194
  class="flex items-center gap-2.5 px-3.5 py-2.5 text-sm text-muted"
179
195
  >
@@ -8,6 +8,13 @@ export interface DeliveryOption {
8
8
  method: DeliveryMethod;
9
9
  label: string;
10
10
  price: number;
11
- /** Delivery estimate in business days, e.g. "1–2". */
11
+ /** Delivery estimate in business days, e.g. "1–2". Empty when unknown. */
12
12
  eta: string;
13
+ /**
14
+ * The method applies but carries no automatic price — the merchant quotes
15
+ * it. Set when a matrix declines above its `quote_above` measure, e.g. a
16
+ * consignment past the parcel weight limit. `price` is meaningless then and
17
+ * must not be shown as a number.
18
+ */
19
+ quoteRequired?: boolean;
13
20
  }
@@ -113,6 +113,7 @@
113
113
  "method": "Liefermethode",
114
114
  "businessDays": "Werktage",
115
115
  "free": "Kostenlos",
116
+ "onRequest": "Auf Anfrage",
116
117
  "requestedDate": "Gewünschtes Lieferdatum",
117
118
  "deliveryNote": "Lieferhinweis",
118
119
  "deliveryNotePlaceholder": "Besondere Lieferanweisungen...",
@@ -113,6 +113,7 @@
113
113
  "method": "Delivery Method",
114
114
  "businessDays": "business days",
115
115
  "free": "Free",
116
+ "onRequest": "On request",
116
117
  "requestedDate": "Requested Delivery Date",
117
118
  "deliveryNote": "Delivery Note",
118
119
  "deliveryNotePlaceholder": "Special delivery instructions...",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revenexx/cover",
3
- "version": "0.2.23",
3
+ "version": "0.2.25",
4
4
  "description": "Cover \u2014 revenexx design system for Nuxt. Distributed as a Nuxt layer: generic UI components, theming tokens and stores shared by the demo shop, custom storefronts and the Blokkli theme.",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -6,9 +6,11 @@ interface ApiShippingRate {
6
6
  code: string;
7
7
  name: string;
8
8
  labels: Record<string, string> | null;
9
- price: number;
9
+ /** Null when the rate is quote-only — see `quote_required`. */
10
+ price: number | null;
10
11
  eta_days_min: number | null;
11
12
  eta_days_max: number | null;
13
+ quote_required?: boolean;
12
14
  }
13
15
 
14
16
  function formatEta(rate: ApiShippingRate): string {
@@ -55,8 +57,11 @@ export default defineEventHandler(async (event) => {
55
57
  const methods: DeliveryOption[] = rates.map(rate => ({
56
58
  method: rate.code,
57
59
  label: rate.labels?.[locale] ?? rate.name,
58
- price: rate.price,
60
+ // A quote-only rate has no price. Zero would be read as free, so the
61
+ // number is kept out of the way and the flag carries the meaning.
62
+ price: rate.price ?? 0,
59
63
  eta: formatEta(rate),
64
+ ...(rate.quote_required ? { quoteRequired: true } : {}),
60
65
  }));
61
66
 
62
67
  return {