@propeller-commerce/propeller-v2-react-ui 0.18.0 → 0.19.0
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 +84 -12
- package/dist/index.cjs +332 -214
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +94 -10
- package/dist/index.d.ts +94 -10
- package/dist/index.js +334 -216
- package/dist/index.js.map +1 -1
- package/dist/pure.cjs +16 -14
- package/dist/pure.cjs.map +1 -1
- package/dist/pure.d.cts +38 -1
- package/dist/pure.d.ts +38 -1
- package/dist/pure.js +17 -15
- package/dist/pure.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/dist/pure.cjs
CHANGED
|
@@ -269,20 +269,21 @@ var ItemStock_default = React__namespace.memo(ItemStock);
|
|
|
269
269
|
function getProductName(orderItem, language) {
|
|
270
270
|
return propellerV2CoreUi.getLocalizedValue(orderItem?.product?.names, language, "") || orderItem?.name || "Unknown Product";
|
|
271
271
|
}
|
|
272
|
-
function getClusterUrl(orderItem, language) {
|
|
272
|
+
function getClusterUrl(orderItem, language, urls) {
|
|
273
273
|
const cluster = orderItem?.product?.cluster;
|
|
274
274
|
if (!cluster) return "";
|
|
275
275
|
const id = cluster.clusterId;
|
|
276
276
|
const slug = propellerV2CoreUi.getLocalizedValue(cluster.slugs, language, "");
|
|
277
277
|
if (!id || !slug) return "";
|
|
278
|
-
return `/cluster/${id}/${slug}`;
|
|
278
|
+
return urls?.getClusterUrl?.(cluster, language) || `/cluster/${id}/${slug}`;
|
|
279
279
|
}
|
|
280
|
-
function getProductUrl(orderItem, language) {
|
|
281
|
-
const cu = getClusterUrl(orderItem, language);
|
|
280
|
+
function getProductUrl(orderItem, language, urls) {
|
|
281
|
+
const cu = getClusterUrl(orderItem, language, urls);
|
|
282
282
|
if (cu) return cu;
|
|
283
|
-
const
|
|
284
|
-
const
|
|
285
|
-
|
|
283
|
+
const product = orderItem?.product;
|
|
284
|
+
const id = product?.productId;
|
|
285
|
+
const slug = propellerV2CoreUi.getLocalizedValue(product?.slugs, language, "");
|
|
286
|
+
if (id && slug) return urls?.getProductUrl?.(product, language) || `/product/${id}/${slug}`;
|
|
286
287
|
return "";
|
|
287
288
|
}
|
|
288
289
|
function OrderItemCard(props) {
|
|
@@ -299,7 +300,7 @@ function OrderItemCard(props) {
|
|
|
299
300
|
const productName = getProductName(item, props.language);
|
|
300
301
|
const productSku = item?.product?.sku || item?.sku || "";
|
|
301
302
|
const productImage = item?.product?.media?.images?.items?.[0]?.imageVariants?.[0]?.url || "";
|
|
302
|
-
const productUrl = getProductUrl(item, props.language);
|
|
303
|
+
const productUrl = getProductUrl(item, props.language, props.configuration?.urls);
|
|
303
304
|
const quantity = item?.quantity || 0;
|
|
304
305
|
const priceTotal = item?.priceTotal || 0;
|
|
305
306
|
const discount = item?.discount || 0;
|
|
@@ -312,7 +313,7 @@ function OrderItemCard(props) {
|
|
|
312
313
|
return props.formatPrice(price);
|
|
313
314
|
}
|
|
314
315
|
if (!price && price !== 0) return "-";
|
|
315
|
-
return propellerV2CoreUi.formatPrice(price, { symbol: props.currency ?? "\u20AC" });
|
|
316
|
+
return propellerV2CoreUi.formatPrice(price, { symbol: props.currency ?? "\u20AC", locale: propellerV2CoreUi.localeForLanguage(props.language) });
|
|
316
317
|
}
|
|
317
318
|
const discountDisplay = discountPercentage > 0 ? `${formatItemPrice(discount)} (${discountPercentage.toFixed(2).replace(".", ",")}%)` : formatItemPrice(discount);
|
|
318
319
|
return /* @__PURE__ */ jsxRuntime.jsxs("tbody", { className: "propeller-order-item-card", children: [
|
|
@@ -453,7 +454,7 @@ function OrderSummary(props) {
|
|
|
453
454
|
if (props.formatPrice) {
|
|
454
455
|
return props.formatPrice(price);
|
|
455
456
|
}
|
|
456
|
-
return propellerV2CoreUi.formatPrice(price || 0, { symbol: props.currency ?? "\u20AC" });
|
|
457
|
+
return propellerV2CoreUi.formatPrice(price || 0, { symbol: props.currency ?? "\u20AC", locale: propellerV2CoreUi.localeForLanguage(props.language) });
|
|
457
458
|
}
|
|
458
459
|
function numericDate(dateString) {
|
|
459
460
|
const d = new Date(dateString);
|
|
@@ -561,7 +562,7 @@ function OrderTotals(props) {
|
|
|
561
562
|
const postageData = props.order?.postageData;
|
|
562
563
|
function formatItemPrice(price) {
|
|
563
564
|
if (props.formatPrice) return props.formatPrice(price);
|
|
564
|
-
return propellerV2CoreUi.formatPrice(price || 0, { symbol: props.currency ?? "\u20AC" });
|
|
565
|
+
return propellerV2CoreUi.formatPrice(price || 0, { symbol: props.currency ?? "\u20AC", locale: propellerV2CoreUi.localeForLanguage(props.language) });
|
|
565
566
|
}
|
|
566
567
|
const subtotal = total?.gross || 0;
|
|
567
568
|
const hasDiscount = !!total && total.discountType !== propellerSdkV2.OrderDiscountType.N && total.discountValue > 0;
|
|
@@ -689,7 +690,7 @@ function ProductBulkPrices(props) {
|
|
|
689
690
|
function getPrice(tier) {
|
|
690
691
|
const value = includeTax ? tier.net : tier.gross;
|
|
691
692
|
if (value === null || value === void 0) return "";
|
|
692
|
-
return propellerV2CoreUi.formatPrice(value, { symbol: props.currency ?? "\u20AC" });
|
|
693
|
+
return propellerV2CoreUi.formatPrice(value, { symbol: props.currency ?? "\u20AC", locale: propellerV2CoreUi.localeForLanguage(props.language) });
|
|
693
694
|
}
|
|
694
695
|
function getQuantityLabel(tier, index) {
|
|
695
696
|
const discount = tier.discount;
|
|
@@ -700,13 +701,14 @@ function ProductBulkPrices(props) {
|
|
|
700
701
|
if (nextQty) return `${qty}\u2013${nextQty - 1}`;
|
|
701
702
|
return `${qty}+`;
|
|
702
703
|
}
|
|
704
|
+
const title = props.labels?.title ?? "Volume pricing";
|
|
703
705
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: !isHidden && hasItems ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
704
706
|
"div",
|
|
705
707
|
{
|
|
706
708
|
className: cn(`propeller-product-bulk-prices ${props.className || ""}`),
|
|
707
709
|
"data-include-tax": includeTax ? "true" : "false",
|
|
708
710
|
children: [
|
|
709
|
-
|
|
711
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "propeller-product-bulk-prices__title text-base font-semibold text-foreground mb-3", children: title }) : null,
|
|
710
712
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-product-bulk-prices__table-wrapper overflow-hidden rounded-container border border-border", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "propeller-product-bulk-prices__table w-full text-sm", children: [
|
|
711
713
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "propeller-product-bulk-prices__thead bg-muted/50", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
712
714
|
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "propeller-product-bulk-prices__th propeller-product-bulk-prices__th--quantity px-4 py-2 text-left font-medium text-muted-foreground", children: propellerV2CoreUi.getLabel(props.labels, "quantityFrom", "Qty from") }),
|
|
@@ -803,7 +805,7 @@ function ProductPriceDisplay(props) {
|
|
|
803
805
|
}
|
|
804
806
|
function formatPrice5(value) {
|
|
805
807
|
if (value === null || value === void 0) return "";
|
|
806
|
-
return propellerV2CoreUi.formatPrice(value, { symbol: props.currency ?? "\u20AC" });
|
|
808
|
+
return propellerV2CoreUi.formatPrice(value, { symbol: props.currency ?? "\u20AC", locale: propellerV2CoreUi.localeForLanguage(props.language) });
|
|
807
809
|
}
|
|
808
810
|
function getOptionsTotal(useNet) {
|
|
809
811
|
const options = props.options || [];
|