@propeller-commerce/propeller-v2-react-ui 0.15.3 → 0.15.5

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,41 @@ 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.15.5] - 2026-08-10
12
+
13
+ ### Fixed
14
+
15
+ - `useMenu` no longer drops categories that lack a translation in the active
16
+ language. The query filtered server-side — `names(language: $language)` — so a
17
+ category with no entry for that language came back with `names: []` and
18
+ `slugs: []`. `mapCategory`'s `?? raw.names?.[0]` fallback then had nothing to
19
+ fall back to, and the row rendered with a blank label and an empty slug:
20
+ invisible and unclickable. Switching a bilingual storefront to a language with
21
+ partial translations collapsed the menu to whichever categories happened to be
22
+ translated (PWP-927).
23
+
24
+ `names` and `slugs` are now fetched unfiltered — every translation — and
25
+ `mapCategory` picks the active language, falling back to whichever translation
26
+ exists. `slugs` gained a `language` field so the slug follows the same rule as
27
+ the name. `$language` is gone from the query signature (an unused variable is
28
+ a GraphQL validation error); it still keys the cache and drives the pick.
29
+
30
+ ## [0.15.4] - 2026-08-10
31
+
32
+ ### Fixed
33
+
34
+ - `<ItemsOverview>` follows the Incl./Excl. BTW toggle. It never resolved infra,
35
+ so it printed `item.price × quantity` — always excl. VAT — while `<CartItem>`
36
+ on the cart page printed `totalSumNet` (incl.). The same lines therefore
37
+ appeared on two different tax bases in consecutive checkout steps. It now
38
+ reads `includeTax` (and `currency` / `language`, which also silently fell back
39
+ to `'€'` and no language) from `<PropellerProvider>`, and takes line totals
40
+ from `totalSum` / `totalSumNet` — the same fields `<CartItem>` reads. Bundle,
41
+ bundle-item and child-option prices switch on the same basis.
42
+
43
+ Hosts that already render inside `<PropellerProvider>` need no change; pass
44
+ `includeTax` explicitly to override.
45
+
11
46
  ## [0.15.3] - 2026-08-10
12
47
 
13
48
  ### Fixed
package/dist/index.cjs CHANGED
@@ -1592,15 +1592,15 @@ function buildCategoriesQuery(depth) {
1592
1592
  categories {
1593
1593
  categoryId
1594
1594
  hidden
1595
- names(language: $language) { value language }
1596
- slugs(language: $language) { value }
1595
+ names { value language }
1596
+ slugs { value language }
1597
1597
  ${buildCategoriesQuery(depth - 1)}
1598
1598
  }
1599
1599
  `;
1600
1600
  }
1601
1601
  function mapCategory(raw, language) {
1602
1602
  const nameEntry = raw.names?.find((n) => n.language === language) ?? raw.names?.[0];
1603
- const slugEntry = raw.slugs?.[0];
1603
+ const slugEntry = raw.slugs?.find((s) => s.language === language) ?? raw.slugs?.[0];
1604
1604
  return {
1605
1605
  categoryId: raw.categoryId,
1606
1606
  name: nameEntry?.value ?? "",
@@ -1676,17 +1676,17 @@ function useMenu(options) {
1676
1676
  inflightFetches.set(key, promise);
1677
1677
  try {
1678
1678
  const gql = `
1679
- query Menu($categoryId: Float, $language: String) {
1679
+ query Menu($categoryId: Float) {
1680
1680
  category(categoryId: $categoryId) {
1681
1681
  categoryId
1682
1682
  hidden
1683
- names(language: $language) { value language }
1684
- slugs(language: $language) { value }
1683
+ names { value language }
1684
+ slugs { value language }
1685
1685
  ${buildCategoriesQuery(depth)}
1686
1686
  }
1687
1687
  }
1688
1688
  `;
1689
- const variables = { categoryId: rootCategoryId, language };
1689
+ const variables = { categoryId: rootCategoryId };
1690
1690
  const data = await graphqlClient.query(gql, variables);
1691
1691
  const root = data?.category ?? null;
1692
1692
  const items = root ? (root.categories ?? []).filter((cat) => !isHidden(cat)).map((cat) => mapCategory(cat, language)) : [];
@@ -12859,7 +12859,9 @@ function getBundleNonLeaders(item) {
12859
12859
  if (!items) return [];
12860
12860
  return items.filter((bi) => bi.isLeader !== propellerSdkV2.YesNo.Y);
12861
12861
  }
12862
- function ItemsOverview(props) {
12862
+ function ItemsOverview(rawProps) {
12863
+ const props = useInfraProps(rawProps);
12864
+ const useTax = !!props.includeTax;
12863
12865
  const containerClass = props.itemsOverviewContainerClass || "cart-items-overview";
12864
12866
  const itemNameClickable = props.itemNameClickable !== void 0 ? props.itemNameClickable : true;
12865
12867
  const showAvailability = props.showAvailability !== void 0 ? props.showAvailability : true;
@@ -12875,6 +12877,13 @@ function ItemsOverview(props) {
12875
12877
  }
12876
12878
  return propellerV2CoreUi.formatPrice(price || 0, { symbol: currencySymbol });
12877
12879
  }
12880
+ function lineTotal(item) {
12881
+ return (useTax ? item.totalSumNet : item.totalSum) || 0;
12882
+ }
12883
+ function bundlePrice(price) {
12884
+ if (!price) return void 0;
12885
+ return useTax ? price.net : price.gross;
12886
+ }
12878
12887
  function getItemSurcharges(item) {
12879
12888
  const list = (item.surcharges ?? []).filter(
12880
12889
  (s) => s.enabled !== false
@@ -12937,12 +12946,12 @@ function ItemsOverview(props) {
12937
12946
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12938
12947
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-start gap-2", children: [
12939
12948
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-items-overview__item-title text-sm font-medium leading-tight text-foreground line-clamp-2", children: item.bundle?.name || "Bundle" }),
12940
- showPrice && money(item.bundle?.price?.net) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-items-overview__item-price font-semibold text-sm text-foreground whitespace-nowrap", children: money(item.bundle?.price?.net) }) : null
12949
+ showPrice && money(bundlePrice(item.bundle?.price)) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-items-overview__item-price font-semibold text-sm text-foreground whitespace-nowrap", children: money(bundlePrice(item.bundle?.price)) }) : null
12941
12950
  ] }),
12942
12951
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-items-overview__item-bundle mt-1.5 space-y-1 border-l-2 border-secondary/10 pl-2", children: [
12943
12952
  leader ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-items-overview__item-bundle-leader flex justify-between items-center text-xs", children: [
12944
12953
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-foreground", children: leader.product.names?.[0]?.value || "Product" }),
12945
- money(leader.price?.net) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground whitespace-nowrap ml-2", children: money(leader.price?.net) }) : null
12954
+ money(bundlePrice(leader.price)) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground whitespace-nowrap ml-2", children: money(bundlePrice(leader.price)) }) : null
12946
12955
  ] }) : null,
12947
12956
  getBundleNonLeaders(item).map((bundleItem, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
12948
12957
  "div",
@@ -12950,7 +12959,7 @@ function ItemsOverview(props) {
12950
12959
  className: "propeller-items-overview__item-bundle-item flex justify-between items-center text-xs text-muted-foreground",
12951
12960
  children: [
12952
12961
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "line-clamp-1", children: bundleItem.product?.names?.[0]?.value || "Product" }),
12953
- money(bundleItem.price?.net) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-subtle whitespace-nowrap ml-2", children: money(bundleItem.price?.net) }) : null
12962
+ money(bundlePrice(bundleItem.price)) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-subtle whitespace-nowrap ml-2", children: money(bundlePrice(bundleItem.price)) }) : null
12954
12963
  ]
12955
12964
  },
12956
12965
  idx
@@ -12973,7 +12982,7 @@ function ItemsOverview(props) {
12973
12982
  children: getItemName(item)
12974
12983
  }
12975
12984
  ) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "propeller-items-overview__item-title font-medium text-sm leading-tight line-clamp-2", children: getItemName(item) }),
12976
- showPrice ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-items-overview__item-price font-semibold text-sm text-foreground whitespace-nowrap", children: formatItemPrice((item.price || 0) * (item.quantity || 1)) }) : null
12985
+ showPrice ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-items-overview__item-price font-semibold text-sm text-foreground whitespace-nowrap", children: formatItemPrice(lineTotal(item)) }) : null
12977
12986
  ] }),
12978
12987
  showSku && itemSku ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "propeller-items-overview__item-sku text-xs text-muted-foreground mt-0.5", children: [
12979
12988
  "SKU: ",
@@ -12989,7 +12998,7 @@ function ItemsOverview(props) {
12989
12998
  className: "propeller-items-overview__item-option flex justify-between items-center text-xs text-muted-foreground",
12990
12999
  children: [
12991
13000
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "line-clamp-1", children: child.product?.names?.[0]?.value || "Option" }),
12992
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-subtle whitespace-nowrap ml-2", children: formatItemPrice(child.totalSum || 0) })
13001
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-subtle whitespace-nowrap ml-2", children: formatItemPrice(lineTotal(child)) })
12993
13002
  ]
12994
13003
  },
12995
13004
  idx