@propeller-commerce/propeller-v2-react-ui 0.18.0 → 0.19.1

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/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 id = orderItem?.product?.productId;
284
- const slug = propellerV2CoreUi.getLocalizedValue(orderItem?.product?.slugs, language, "");
285
- if (id && slug) return `/product/${id}/${slug}`;
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: [
@@ -391,11 +392,11 @@ function OrderItemCard(props) {
391
392
  className: isChildItem ? "propeller-order-item-card__cell propeller-order-item-card__cell--price px-6 py-2 text-right whitespace-nowrap text-sm text-muted-foreground" : "propeller-order-item-card__cell propeller-order-item-card__cell--price px-6 py-4 text-right whitespace-nowrap",
392
393
  children: (() => {
393
394
  const PriceImpl = props.priceComponent;
394
- if (PriceImpl) {
395
+ if (PriceImpl && item?.product?.price) {
395
396
  return /* @__PURE__ */ jsxRuntime.jsx(
396
397
  PriceImpl,
397
398
  {
398
- price: item?.product?.price,
399
+ price: item.product.price,
399
400
  currency: props.currency,
400
401
  labels: props.labels
401
402
  }
@@ -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
- propellerV2CoreUi.getLabel(props.labels, "title", "Volume pricing") ? /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "propeller-product-bulk-prices__title text-base font-semibold text-foreground mb-3", children: propellerV2CoreUi.getLabel(props.labels, "title", "Volume pricing") }) : null,
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 || [];