@revenexx/cover 0.2.24 → 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
@@ -80,6 +80,13 @@ export default defineAppConfig({
80
80
  support: true,
81
81
  },
82
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
+ },
83
90
  ui: {
84
91
  icons: nuxtUiIcons(DEFAULT_ICON_WEIGHT),
85
92
  },
@@ -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'); }"
@@ -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.24",
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 {