@propeller-commerce/propeller-v2-react-ui 0.15.10 → 0.16.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/dist/pure.cjs CHANGED
@@ -261,22 +261,22 @@ function ItemStock(props) {
261
261
  ) }) : null });
262
262
  }
263
263
  var ItemStock_default = React__namespace.memo(ItemStock);
264
- function getProductName(orderItem) {
265
- return orderItem?.product?.names?.[0]?.value || orderItem?.name || "Unknown Product";
264
+ function getProductName(orderItem, language) {
265
+ return propellerV2CoreUi.getLocalizedValue(orderItem?.product?.names, language, "") || orderItem?.name || "Unknown Product";
266
266
  }
267
- function getClusterUrl(orderItem) {
267
+ function getClusterUrl(orderItem, language) {
268
268
  const cluster = orderItem?.product?.cluster;
269
269
  if (!cluster) return "";
270
270
  const id = cluster.clusterId;
271
- const slug = cluster.slugs?.[0]?.value || "";
271
+ const slug = propellerV2CoreUi.getLocalizedValue(cluster.slugs, language, "");
272
272
  if (!id || !slug) return "";
273
273
  return `/cluster/${id}/${slug}`;
274
274
  }
275
- function getProductUrl(orderItem) {
276
- const cu = getClusterUrl(orderItem);
275
+ function getProductUrl(orderItem, language) {
276
+ const cu = getClusterUrl(orderItem, language);
277
277
  if (cu) return cu;
278
278
  const id = orderItem?.product?.productId;
279
- const slug = orderItem?.product?.slugs?.[0]?.value || "";
279
+ const slug = propellerV2CoreUi.getLocalizedValue(orderItem?.product?.slugs, language, "");
280
280
  if (id && slug) return `/product/${id}/${slug}`;
281
281
  return "";
282
282
  }
@@ -291,10 +291,10 @@ function OrderItemCard(props) {
291
291
  const showDiscount = props.showDiscount !== void 0 ? props.showDiscount : false;
292
292
  const showStockComponent = props.showStockComponent !== void 0 ? props.showStockComponent : false;
293
293
  const showItemNotes = props.showItemNotes !== void 0 ? props.showItemNotes : false;
294
- const productName = getProductName(item);
294
+ const productName = getProductName(item, props.language);
295
295
  const productSku = item?.product?.sku || item?.sku || "";
296
296
  const productImage = item?.product?.media?.images?.items?.[0]?.imageVariants?.[0]?.url || "";
297
- const productUrl = getProductUrl(item);
297
+ const productUrl = getProductUrl(item, props.language);
298
298
  const quantity = item?.quantity || 0;
299
299
  const priceTotal = item?.priceTotal || 0;
300
300
  const discount = item?.discount || 0;
@@ -409,7 +409,7 @@ function OrderItemCard(props) {
409
409
  className: "propeller-order-item-card__child-row border-0",
410
410
  "data-child": "true",
411
411
  children: [
412
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "propeller-order-item-card__cell propeller-order-item-card__cell--product px-6 py-2 pl-28", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-order-item-card__child-title text-sm text-muted-foreground", children: child.product?.names?.[0]?.value || child.name || "Unknown" }) }),
412
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "propeller-order-item-card__cell propeller-order-item-card__cell--product px-6 py-2 pl-28", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-order-item-card__child-title text-sm text-muted-foreground", children: propellerV2CoreUi.getLocalizedValue(child.product?.names, props.language, "") || child.name || "Unknown" }) }),
413
413
  showQuantity ? /* @__PURE__ */ jsxRuntime.jsx("td", { className: "propeller-order-item-card__cell propeller-order-item-card__cell--quantity px-6 py-2 text-center text-sm text-muted-foreground", children: child.quantity || 0 }) : null,
414
414
  showDiscount ? /* @__PURE__ */ jsxRuntime.jsx("td", { className: "propeller-order-item-card__cell propeller-order-item-card__cell--discount px-6 py-2 text-right text-sm text-muted-foreground" }) : null,
415
415
  showPrice ? /* @__PURE__ */ jsxRuntime.jsx("td", { className: "propeller-order-item-card__cell propeller-order-item-card__cell--price px-6 py-2 text-right whitespace-nowrap text-sm text-muted-foreground", children: formatItemPrice(child.priceTotal || 0) }) : null