@propeller-commerce/propeller-v2-react-ui 0.15.2 → 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/CHANGELOG.md +26 -0
- package/dist/index.cjs +25 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +25 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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(
|
|
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(
|
|
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
|
@@ -7795,6 +7795,12 @@ function CartSummary(rawProps) {
|
|
|
7795
7795
|
function discountAmount() {
|
|
7796
7796
|
return props.cart?.total?.discount || 0;
|
|
7797
7797
|
}
|
|
7798
|
+
function hasTransactionCosts() {
|
|
7799
|
+
return (props.cart?.paymentData?.price || 0) > 0;
|
|
7800
|
+
}
|
|
7801
|
+
function transactionCosts() {
|
|
7802
|
+
return Number(props.cart?.paymentData?.price || 0);
|
|
7803
|
+
}
|
|
7798
7804
|
function hasShippingCosts() {
|
|
7799
7805
|
return (props.cart?.postageData?.price || 0) > 0;
|
|
7800
7806
|
}
|
|
@@ -7869,6 +7875,10 @@ function CartSummary(rawProps) {
|
|
|
7869
7875
|
formatItemPrice(discountAmount())
|
|
7870
7876
|
] })
|
|
7871
7877
|
] }) : null,
|
|
7878
|
+
hasTransactionCosts() ? /* @__PURE__ */ jsxs("div", { className: "propeller-cart-summary__row flex justify-between text-muted-foreground", "data-row": "transaction-costs", children: [
|
|
7879
|
+
/* @__PURE__ */ jsx("span", { className: "propeller-cart-summary__label", children: getLabel(props.labels, "transactionCosts", "Transaction costs:") }),
|
|
7880
|
+
/* @__PURE__ */ jsx("span", { className: "propeller-cart-summary__value", children: formatItemPrice(transactionCosts()) })
|
|
7881
|
+
] }) : null,
|
|
7872
7882
|
showShippingCosts() && hasShippingCosts() ? /* @__PURE__ */ jsxs("div", { className: "propeller-cart-summary__row flex justify-between text-muted-foreground", "data-row": "shipping-costs", children: [
|
|
7873
7883
|
/* @__PURE__ */ jsx("span", { className: "propeller-cart-summary__label", children: getLabel(props.labels, "shippingCosts", "Shipping costs:") }),
|
|
7874
7884
|
/* @__PURE__ */ jsx("span", { className: "propeller-cart-summary__value", children: formatItemPrice(shippingCosts()) })
|
|
@@ -12829,7 +12839,9 @@ function getBundleNonLeaders(item) {
|
|
|
12829
12839
|
if (!items) return [];
|
|
12830
12840
|
return items.filter((bi) => bi.isLeader !== YesNo.Y);
|
|
12831
12841
|
}
|
|
12832
|
-
function ItemsOverview(
|
|
12842
|
+
function ItemsOverview(rawProps) {
|
|
12843
|
+
const props = useInfraProps(rawProps);
|
|
12844
|
+
const useTax = !!props.includeTax;
|
|
12833
12845
|
const containerClass = props.itemsOverviewContainerClass || "cart-items-overview";
|
|
12834
12846
|
const itemNameClickable = props.itemNameClickable !== void 0 ? props.itemNameClickable : true;
|
|
12835
12847
|
const showAvailability = props.showAvailability !== void 0 ? props.showAvailability : true;
|
|
@@ -12845,6 +12857,13 @@ function ItemsOverview(props) {
|
|
|
12845
12857
|
}
|
|
12846
12858
|
return formatPrice(price || 0, { symbol: currencySymbol });
|
|
12847
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
|
+
}
|
|
12848
12867
|
function getItemSurcharges(item) {
|
|
12849
12868
|
const list = (item.surcharges ?? []).filter(
|
|
12850
12869
|
(s) => s.enabled !== false
|
|
@@ -12907,12 +12926,12 @@ function ItemsOverview(props) {
|
|
|
12907
12926
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
12908
12927
|
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start gap-2", children: [
|
|
12909
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" }),
|
|
12910
|
-
showPrice && money(item.bundle?.price
|
|
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
|
|
12911
12930
|
] }),
|
|
12912
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: [
|
|
12913
12932
|
leader ? /* @__PURE__ */ jsxs("div", { className: "propeller-items-overview__item-bundle-leader flex justify-between items-center text-xs", children: [
|
|
12914
12933
|
/* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: leader.product.names?.[0]?.value || "Product" }),
|
|
12915
|
-
money(leader.price
|
|
12934
|
+
money(bundlePrice(leader.price)) ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground whitespace-nowrap ml-2", children: money(bundlePrice(leader.price)) }) : null
|
|
12916
12935
|
] }) : null,
|
|
12917
12936
|
getBundleNonLeaders(item).map((bundleItem, idx) => /* @__PURE__ */ jsxs(
|
|
12918
12937
|
"div",
|
|
@@ -12920,7 +12939,7 @@ function ItemsOverview(props) {
|
|
|
12920
12939
|
className: "propeller-items-overview__item-bundle-item flex justify-between items-center text-xs text-muted-foreground",
|
|
12921
12940
|
children: [
|
|
12922
12941
|
/* @__PURE__ */ jsx("span", { className: "line-clamp-1", children: bundleItem.product?.names?.[0]?.value || "Product" }),
|
|
12923
|
-
money(bundleItem.price
|
|
12942
|
+
money(bundlePrice(bundleItem.price)) ? /* @__PURE__ */ jsx("span", { className: "text-foreground-subtle whitespace-nowrap ml-2", children: money(bundlePrice(bundleItem.price)) }) : null
|
|
12924
12943
|
]
|
|
12925
12944
|
},
|
|
12926
12945
|
idx
|
|
@@ -12943,7 +12962,7 @@ function ItemsOverview(props) {
|
|
|
12943
12962
|
children: getItemName(item)
|
|
12944
12963
|
}
|
|
12945
12964
|
) : /* @__PURE__ */ jsx("p", { className: "propeller-items-overview__item-title font-medium text-sm leading-tight line-clamp-2", children: getItemName(item) }),
|
|
12946
|
-
showPrice ? /* @__PURE__ */ jsx("span", { className: "propeller-items-overview__item-price font-semibold text-sm text-foreground whitespace-nowrap", children: formatItemPrice((item
|
|
12965
|
+
showPrice ? /* @__PURE__ */ jsx("span", { className: "propeller-items-overview__item-price font-semibold text-sm text-foreground whitespace-nowrap", children: formatItemPrice(lineTotal(item)) }) : null
|
|
12947
12966
|
] }),
|
|
12948
12967
|
showSku && itemSku ? /* @__PURE__ */ jsxs("p", { className: "propeller-items-overview__item-sku text-xs text-muted-foreground mt-0.5", children: [
|
|
12949
12968
|
"SKU: ",
|
|
@@ -12959,7 +12978,7 @@ function ItemsOverview(props) {
|
|
|
12959
12978
|
className: "propeller-items-overview__item-option flex justify-between items-center text-xs text-muted-foreground",
|
|
12960
12979
|
children: [
|
|
12961
12980
|
/* @__PURE__ */ jsx("span", { className: "line-clamp-1", children: child.product?.names?.[0]?.value || "Option" }),
|
|
12962
|
-
/* @__PURE__ */ jsx("span", { className: "text-foreground-subtle whitespace-nowrap ml-2", children: formatItemPrice(child
|
|
12981
|
+
/* @__PURE__ */ jsx("span", { className: "text-foreground-subtle whitespace-nowrap ml-2", children: formatItemPrice(lineTotal(child)) })
|
|
12963
12982
|
]
|
|
12964
12983
|
},
|
|
12965
12984
|
idx
|