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

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/dist/index.d.cts CHANGED
@@ -4961,12 +4961,13 @@ interface ItemsOverviewProps {
4961
4961
  /** Labels for the component */ labels?: Record<string, string>;
4962
4962
  /** Currency symbol used by the default formatter. Default: `'€'`. */ currency?: string;
4963
4963
  /** Active language for localized surcharge names. */ language?: string;
4964
+ /** Include tax in the line prices. Resolved from `<PropellerProvider>` when omitted; defaults to `false`. */ includeTax?: boolean;
4964
4965
  }
4965
4966
  /**
4966
4967
  * Renders a compact read-only list of cart line items, including bundles and
4967
4968
  * configurable child options, with optional image, SKU, availability and price.
4968
4969
  */
4969
- declare function ItemsOverview(props: ItemsOverviewProps): React$1.JSX.Element;
4970
+ declare function ItemsOverview(rawProps: ItemsOverviewProps): React$1.JSX.Element;
4970
4971
 
4971
4972
  /**
4972
4973
  * @rsc-blocked — Client-only component: interactive state (useState/useReducer).
package/dist/index.d.ts CHANGED
@@ -4961,12 +4961,13 @@ interface ItemsOverviewProps {
4961
4961
  /** Labels for the component */ labels?: Record<string, string>;
4962
4962
  /** Currency symbol used by the default formatter. Default: `'€'`. */ currency?: string;
4963
4963
  /** Active language for localized surcharge names. */ language?: string;
4964
+ /** Include tax in the line prices. Resolved from `<PropellerProvider>` when omitted; defaults to `false`. */ includeTax?: boolean;
4964
4965
  }
4965
4966
  /**
4966
4967
  * Renders a compact read-only list of cart line items, including bundles and
4967
4968
  * configurable child options, with optional image, SKU, availability and price.
4968
4969
  */
4969
- declare function ItemsOverview(props: ItemsOverviewProps): React$1.JSX.Element;
4970
+ declare function ItemsOverview(rawProps: ItemsOverviewProps): React$1.JSX.Element;
4970
4971
 
4971
4972
  /**
4972
4973
  * @rsc-blocked — Client-only component: interactive state (useState/useReducer).
package/dist/index.js CHANGED
@@ -12839,7 +12839,9 @@ function getBundleNonLeaders(item) {
12839
12839
  if (!items) return [];
12840
12840
  return items.filter((bi) => bi.isLeader !== YesNo.Y);
12841
12841
  }
12842
- function ItemsOverview(props) {
12842
+ function ItemsOverview(rawProps) {
12843
+ const props = useInfraProps(rawProps);
12844
+ const useTax = !!props.includeTax;
12843
12845
  const containerClass = props.itemsOverviewContainerClass || "cart-items-overview";
12844
12846
  const itemNameClickable = props.itemNameClickable !== void 0 ? props.itemNameClickable : true;
12845
12847
  const showAvailability = props.showAvailability !== void 0 ? props.showAvailability : true;
@@ -12855,6 +12857,13 @@ function ItemsOverview(props) {
12855
12857
  }
12856
12858
  return formatPrice(price || 0, { symbol: currencySymbol });
12857
12859
  }
12860
+ function lineTotal(item) {
12861
+ return (useTax ? item.totalSumNet : item.totalSum) || 0;
12862
+ }
12863
+ function bundlePrice(price) {
12864
+ if (!price) return void 0;
12865
+ return useTax ? price.net : price.gross;
12866
+ }
12858
12867
  function getItemSurcharges(item) {
12859
12868
  const list = (item.surcharges ?? []).filter(
12860
12869
  (s) => s.enabled !== false
@@ -12917,12 +12926,12 @@ function ItemsOverview(props) {
12917
12926
  /* @__PURE__ */ jsxs("div", { children: [
12918
12927
  /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start gap-2", children: [
12919
12928
  /* @__PURE__ */ jsx("span", { className: "propeller-items-overview__item-title text-sm font-medium leading-tight text-foreground line-clamp-2", children: item.bundle?.name || "Bundle" }),
12920
- showPrice && money(item.bundle?.price?.net) ? /* @__PURE__ */ jsx("span", { className: "propeller-items-overview__item-price font-semibold text-sm text-foreground whitespace-nowrap", children: money(item.bundle?.price?.net) }) : null
12929
+ showPrice && money(bundlePrice(item.bundle?.price)) ? /* @__PURE__ */ jsx("span", { className: "propeller-items-overview__item-price font-semibold text-sm text-foreground whitespace-nowrap", children: money(bundlePrice(item.bundle?.price)) }) : null
12921
12930
  ] }),
12922
12931
  /* @__PURE__ */ jsxs("div", { className: "propeller-items-overview__item-bundle mt-1.5 space-y-1 border-l-2 border-secondary/10 pl-2", children: [
12923
12932
  leader ? /* @__PURE__ */ jsxs("div", { className: "propeller-items-overview__item-bundle-leader flex justify-between items-center text-xs", children: [
12924
12933
  /* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: leader.product.names?.[0]?.value || "Product" }),
12925
- money(leader.price?.net) ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground whitespace-nowrap ml-2", children: money(leader.price?.net) }) : null
12934
+ money(bundlePrice(leader.price)) ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground whitespace-nowrap ml-2", children: money(bundlePrice(leader.price)) }) : null
12926
12935
  ] }) : null,
12927
12936
  getBundleNonLeaders(item).map((bundleItem, idx) => /* @__PURE__ */ jsxs(
12928
12937
  "div",
@@ -12930,7 +12939,7 @@ function ItemsOverview(props) {
12930
12939
  className: "propeller-items-overview__item-bundle-item flex justify-between items-center text-xs text-muted-foreground",
12931
12940
  children: [
12932
12941
  /* @__PURE__ */ jsx("span", { className: "line-clamp-1", children: bundleItem.product?.names?.[0]?.value || "Product" }),
12933
- money(bundleItem.price?.net) ? /* @__PURE__ */ jsx("span", { className: "text-foreground-subtle whitespace-nowrap ml-2", children: money(bundleItem.price?.net) }) : null
12942
+ money(bundlePrice(bundleItem.price)) ? /* @__PURE__ */ jsx("span", { className: "text-foreground-subtle whitespace-nowrap ml-2", children: money(bundlePrice(bundleItem.price)) }) : null
12934
12943
  ]
12935
12944
  },
12936
12945
  idx
@@ -12953,7 +12962,7 @@ function ItemsOverview(props) {
12953
12962
  children: getItemName(item)
12954
12963
  }
12955
12964
  ) : /* @__PURE__ */ jsx("p", { className: "propeller-items-overview__item-title font-medium text-sm leading-tight line-clamp-2", children: getItemName(item) }),
12956
- showPrice ? /* @__PURE__ */ 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
12965
+ showPrice ? /* @__PURE__ */ jsx("span", { className: "propeller-items-overview__item-price font-semibold text-sm text-foreground whitespace-nowrap", children: formatItemPrice(lineTotal(item)) }) : null
12957
12966
  ] }),
12958
12967
  showSku && itemSku ? /* @__PURE__ */ jsxs("p", { className: "propeller-items-overview__item-sku text-xs text-muted-foreground mt-0.5", children: [
12959
12968
  "SKU: ",
@@ -12969,7 +12978,7 @@ function ItemsOverview(props) {
12969
12978
  className: "propeller-items-overview__item-option flex justify-between items-center text-xs text-muted-foreground",
12970
12979
  children: [
12971
12980
  /* @__PURE__ */ jsx("span", { className: "line-clamp-1", children: child.product?.names?.[0]?.value || "Option" }),
12972
- /* @__PURE__ */ jsx("span", { className: "text-foreground-subtle whitespace-nowrap ml-2", children: formatItemPrice(child.totalSum || 0) })
12981
+ /* @__PURE__ */ jsx("span", { className: "text-foreground-subtle whitespace-nowrap ml-2", children: formatItemPrice(lineTotal(child)) })
12973
12982
  ]
12974
12983
  },
12975
12984
  idx