@propeller-commerce/propeller-v2-react-ui 0.4.21 → 0.4.23

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/CHANGELOG.md CHANGED
@@ -8,6 +8,43 @@ once it reaches 1.0. Until then (the `0.x` line) the public API may change
8
8
  between minor versions; breaking changes are called out below and in
9
9
  [MIGRATION.md](./MIGRATION.md).
10
10
 
11
+ ## [0.4.23] - 2026-07-17
12
+
13
+ ### Fixed
14
+
15
+ - `SearchBar`: the autosuggest dropdown hardcoded `price.gross` (excl. VAT) and
16
+ ignored the Incl./Excl. toggle, under-quoting every product, and showed no
17
+ tax label. It now carries both net/gross, picks the leading price from
18
+ `includeTax` (resolved from `<PropellerProvider>`), and renders an
19
+ `incl./excl.` label — consistent with `ProductPrice`/PLP/PDP. New optional
20
+ props: `includeTax`, `priceLabels` (keys `inclTax`/`exclTax`).
21
+ - `CartIconAndSidebar`: the header mini-cart rendered line items excl. VAT
22
+ (`includeTax={false}`) while the total used `totalNet` (incl. VAT) and bonus
23
+ items were pinned incl. — the lines never reconciled with the total and none
24
+ followed the toggle. All three now share one `useTax` basis (from
25
+ `includeTax`), so lines, total, and bonus items agree and respect the toggle.
26
+
27
+ ### Changed
28
+
29
+ - `DeliveryDate`: weekday/month names in the quick-pick tiles now resolve via
30
+ `labels` (keys `day_0`…`day_6`, `month_0`…`month_11`; English fallback) so
31
+ they localize with the active locale instead of hardcoded English. New
32
+ optional `language` prop (resolved from `<PropellerProvider>`) sets the
33
+ native date-input's `lang`, localizing the browser calendar chrome
34
+ (month name, weekday headers, Today/Clear).
35
+
36
+ ## [0.4.22] - 2026-07-17
37
+
38
+ ### Fixed
39
+
40
+ - `DeliveryDate`: when `skipWeekends` is on and the cart's `initialDate`
41
+ (`postageData.requestDate`) is a weekend, it was adopted verbatim — landing
42
+ the selected date in the "Other date" tile (rendered LAST, out of sequence)
43
+ and replacing the "Other date…" entry point with that date's label. Now a
44
+ weekend `initialDate` snaps to the first valid weekday tile, so the selection
45
+ lands on the leading quick-pick and the "Other date…" tile is restored. A
46
+ weekday `initialDate` is still adopted as-is.
47
+
11
48
  ## [0.4.21] - 2026-07-16
12
49
 
13
50
  ### Fixed
package/dist/index.cjs CHANGED
@@ -6725,8 +6725,9 @@ function CartIconAndSidebar(rawProps) {
6725
6725
  (sum, item) => sum + item.quantity,
6726
6726
  0
6727
6727
  );
6728
- const totalNet = props.cart?.total?.totalNet;
6729
- const totalPrice = totalNet === void 0 || totalNet === null ? money(0) : money(totalNet);
6728
+ const useTax = !!props.includeTax;
6729
+ const totalRaw = useTax ? props.cart?.total?.totalNet : props.cart?.total?.totalGross;
6730
+ const totalPrice = totalRaw === void 0 || totalRaw === null ? money(0) : money(totalRaw);
6730
6731
  const sidebarTitle = props.cartSidebarTitle || props.labels?.["cartSidebarTitle"] || "Shopping cart";
6731
6732
  const purchaserPAC = findPurchaserPAC(props.user, props.companyId);
6732
6733
  const totalGross = props.cart?.total?.totalGross ?? 0;
@@ -6936,7 +6937,7 @@ function CartIconAndSidebar(rawProps) {
6936
6937
  showCartItemNotesField: false,
6937
6938
  showCrossupsells: false,
6938
6939
  showStockComponent: false,
6939
- includeTax: false,
6940
+ includeTax: useTax,
6940
6941
  className: "propeller-cart-icon__item",
6941
6942
  children: [
6942
6943
  /* @__PURE__ */ jsxRuntime.jsx(CartItem_default.Image, { className: "w-20 h-20 flex-shrink-0 bg-surface-hover rounded-control overflow-hidden border border-border-subtle" }),
@@ -6957,7 +6958,7 @@ function CartIconAndSidebar(rawProps) {
6957
6958
  },
6958
6959
  item.itemId
6959
6960
  )) }),
6960
- /* @__PURE__ */ jsxRuntime.jsx(CartBonusItemsImpl, { cart: props.cart, includeTax: true, className: "mt-4" })
6961
+ /* @__PURE__ */ jsxRuntime.jsx(CartBonusItemsImpl, { cart: props.cart, includeTax: useTax, className: "mt-4" })
6961
6962
  ] }),
6962
6963
  " ",
6963
6964
  items.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-cart-icon__sidebar-footer px-5 py-4 border-t border-border space-y-3 bg-surface-hover", children: [
@@ -8400,7 +8401,8 @@ function computeUpcomingDates(count, skipWeekends) {
8400
8401
  }
8401
8402
  return days;
8402
8403
  }
8403
- function DeliveryDate(props) {
8404
+ function DeliveryDate(rawProps) {
8405
+ const props = useInfraProps(rawProps);
8404
8406
  const [selectedDate, setSelectedDate] = React6.useState("");
8405
8407
  const [modalOpen, setModalOpen] = React6.useState(false);
8406
8408
  const [customDateValue, setCustomDateValue] = React6.useState("");
@@ -8421,7 +8423,9 @@ function DeliveryDate(props) {
8421
8423
  if (!isoDate) return "";
8422
8424
  const date = new Date(isoDate);
8423
8425
  if (isNaN(date.getTime())) return "";
8424
- return `${WEEKDAYS[date.getDay()]}, ${MONTHS[date.getMonth()]} ${date.getDate()}`;
8426
+ const weekday = propellerV2CoreUi.getLabel(props.labels, `day_${date.getDay()}`, WEEKDAYS[date.getDay()]);
8427
+ const month = propellerV2CoreUi.getLabel(props.labels, `month_${date.getMonth()}`, MONTHS[date.getMonth()]);
8428
+ return `${weekday}, ${month} ${date.getDate()}`;
8425
8429
  }
8426
8430
  function handleSelect(isoDate) {
8427
8431
  setSelectedDate(isoDate);
@@ -8468,12 +8472,15 @@ function DeliveryDate(props) {
8468
8472
  if (props.initialDate && !selectedDate) {
8469
8473
  const dot = props.initialDate.lastIndexOf(".");
8470
8474
  const normalized = dot !== -1 ? props.initialDate.substring(0, dot) + "Z" : props.initialDate;
8471
- setSelectedDate(normalized);
8475
+ const parsed = new Date(normalized);
8476
+ const isWeekend = !isNaN(parsed.getTime()) && (parsed.getDay() === 0 || parsed.getDay() === 6);
8477
+ const adopt = skipWeekends && isWeekend && upcomingDates.length > 0 ? upcomingDates[0] : normalized;
8478
+ setSelectedDate(adopt);
8472
8479
  if (props.onDateSelect) {
8473
- props.onDateSelect(normalized);
8480
+ props.onDateSelect(adopt);
8474
8481
  }
8475
8482
  }
8476
- }, [props.initialDate, props.cart, selectedDate, props.onDateSelect, props]);
8483
+ }, [props.initialDate, props.cart, selectedDate, props.onDateSelect, props, skipWeekends, upcomingDates]);
8477
8484
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `propeller-delivery-date ${containerClass}`, children: [
8478
8485
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-delivery-date__grid grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-3", children: [
8479
8486
  upcomingDates.map((dateStr, index) => {
@@ -8532,6 +8539,7 @@ function DeliveryDate(props) {
8532
8539
  "input",
8533
8540
  {
8534
8541
  type: "date",
8542
+ lang: props.language ? props.language.toLowerCase() : void 0,
8535
8543
  className: `propeller-delivery-date__input w-full border rounded-control px-3 py-2 text-sm focus:outline-none focus:ring-2 ${customDateError ? "border-destructive focus:ring-destructive focus:border-destructive" : "border-input focus:ring-secondary focus:border-secondary"}`,
8536
8544
  min: minDate,
8537
8545
  value: customDateValue,
@@ -17144,11 +17152,17 @@ function mapToSearchBarResult(item) {
17144
17152
  const id = isCluster ? item.clusterId : item.productId;
17145
17153
  const slug = item.slugs?.[0]?.value || "";
17146
17154
  const url = isCluster ? "/cluster/" + id + "/" + slug : "/product/" + id + "/" + slug;
17155
+ const priceNet = displayItem?.price?.net || 0;
17156
+ const priceGross = displayItem?.price?.gross || 0;
17147
17157
  return {
17148
17158
  id,
17149
17159
  name: item.names?.[0]?.value || "Product",
17150
17160
  sku: item.sku || displayItem?.sku || "",
17151
- price: displayItem?.price?.gross || 0,
17161
+ // `price` stays the gross value for back-compat; the row picks net/gross
17162
+ // from the two explicit fields below per the toggle.
17163
+ price: priceGross,
17164
+ priceNet,
17165
+ priceGross,
17152
17166
  imageUrl: displayItem?.media?.images?.items?.[0]?.imageVariants?.[0]?.url || "",
17153
17167
  url,
17154
17168
  isCluster
@@ -17177,6 +17191,13 @@ function SearchBar(rawProps) {
17177
17191
  }
17178
17192
  return propellerV2CoreUi.formatPrice(price || 0, { symbol: props.currency ?? "\u20AC" });
17179
17193
  }
17194
+ const useTax = !!props.includeTax;
17195
+ function leadingPrice(result) {
17196
+ return useTax ? result.priceNet ?? result.price ?? 0 : result.priceGross ?? result.price ?? 0;
17197
+ }
17198
+ function priceTaxLabel() {
17199
+ return useTax ? propellerV2CoreUi.getLabel(props.priceLabels, "inclTax", "incl. VAT") : propellerV2CoreUi.getLabel(props.priceLabels, "exclTax", "excl. VAT");
17200
+ }
17180
17201
  function noImageUrl() {
17181
17202
  return props.noImageUrl || "";
17182
17203
  }
@@ -17295,7 +17316,10 @@ function SearchBar(rawProps) {
17295
17316
  result.sku
17296
17317
  ] }) : null
17297
17318
  ] }),
17298
- result.price !== void 0 && result.price !== null ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-search-bar__result-price text-sm font-semibold text-foreground flex-shrink-0", children: formatItemPrice(result.price) }) : null
17319
+ result.price !== void 0 && result.price !== null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-search-bar__result-price text-sm font-semibold text-foreground flex-shrink-0 text-right", children: [
17320
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-search-bar__result-price-value", children: formatItemPrice(leadingPrice(result)) }),
17321
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-search-bar__result-price-label block text-xs font-normal text-muted-foreground", children: priceTaxLabel() })
17322
+ ] }) : null
17299
17323
  ]
17300
17324
  },
17301
17325
  result.id + "-" + index