@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.d.cts CHANGED
@@ -245,6 +245,16 @@ interface OrderItemCardProps {
245
245
  orderItem: OrderItem;
246
246
  /** Child order items (rendered as indented sub-rows beneath the parent) */
247
247
  childItems?: OrderItem[];
248
+ /**
249
+ * Language used to resolve localized product names and the slugs in the
250
+ * item's PDP link. Defaults to the catalog's default language.
251
+ *
252
+ * This component is RSC-safe (no hooks, no context), so the host has to pass
253
+ * it — there is nothing to read it from. Without it a non-default storefront
254
+ * renders default-language names and, worse, default-language slugs in the
255
+ * links (PWP-940).
256
+ */
257
+ language?: string;
248
258
  /** Should the item title be a link to the PDP */
249
259
  titleLinkable?: boolean;
250
260
  /** Display a small thumbnail of the order item */
package/dist/pure.d.ts CHANGED
@@ -245,6 +245,16 @@ interface OrderItemCardProps {
245
245
  orderItem: OrderItem;
246
246
  /** Child order items (rendered as indented sub-rows beneath the parent) */
247
247
  childItems?: OrderItem[];
248
+ /**
249
+ * Language used to resolve localized product names and the slugs in the
250
+ * item's PDP link. Defaults to the catalog's default language.
251
+ *
252
+ * This component is RSC-safe (no hooks, no context), so the host has to pass
253
+ * it — there is nothing to read it from. Without it a non-default storefront
254
+ * renders default-language names and, worse, default-language slugs in the
255
+ * links (PWP-940).
256
+ */
257
+ language?: string;
248
258
  /** Should the item title be a link to the PDP */
249
259
  titleLinkable?: boolean;
250
260
  /** Display a small thumbnail of the order item */
package/dist/pure.js CHANGED
@@ -1,4 +1,4 @@
1
- import { buildClusterJsonLd, safeJsonStringify, buildItemListJsonLd, buildProductJsonLd, getLabel, isContentHidden, formatPrice, getCountryName } from '@propeller-commerce/propeller-v2-core-ui';
1
+ import { buildClusterJsonLd, safeJsonStringify, buildItemListJsonLd, buildProductJsonLd, getLabel, getLocalizedValue, isContentHidden, formatPrice, getCountryName } from '@propeller-commerce/propeller-v2-core-ui';
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
4
  import { OrderDiscountType, YesNo } from '@propeller-commerce/propeller-sdk-v2';
@@ -239,22 +239,22 @@ function ItemStock(props) {
239
239
  ) }) : null });
240
240
  }
241
241
  var ItemStock_default = React.memo(ItemStock);
242
- function getProductName(orderItem) {
243
- return orderItem?.product?.names?.[0]?.value || orderItem?.name || "Unknown Product";
242
+ function getProductName(orderItem, language) {
243
+ return getLocalizedValue(orderItem?.product?.names, language, "") || orderItem?.name || "Unknown Product";
244
244
  }
245
- function getClusterUrl(orderItem) {
245
+ function getClusterUrl(orderItem, language) {
246
246
  const cluster = orderItem?.product?.cluster;
247
247
  if (!cluster) return "";
248
248
  const id = cluster.clusterId;
249
- const slug = cluster.slugs?.[0]?.value || "";
249
+ const slug = getLocalizedValue(cluster.slugs, language, "");
250
250
  if (!id || !slug) return "";
251
251
  return `/cluster/${id}/${slug}`;
252
252
  }
253
- function getProductUrl(orderItem) {
254
- const cu = getClusterUrl(orderItem);
253
+ function getProductUrl(orderItem, language) {
254
+ const cu = getClusterUrl(orderItem, language);
255
255
  if (cu) return cu;
256
256
  const id = orderItem?.product?.productId;
257
- const slug = orderItem?.product?.slugs?.[0]?.value || "";
257
+ const slug = getLocalizedValue(orderItem?.product?.slugs, language, "");
258
258
  if (id && slug) return `/product/${id}/${slug}`;
259
259
  return "";
260
260
  }
@@ -269,10 +269,10 @@ function OrderItemCard(props) {
269
269
  const showDiscount = props.showDiscount !== void 0 ? props.showDiscount : false;
270
270
  const showStockComponent = props.showStockComponent !== void 0 ? props.showStockComponent : false;
271
271
  const showItemNotes = props.showItemNotes !== void 0 ? props.showItemNotes : false;
272
- const productName = getProductName(item);
272
+ const productName = getProductName(item, props.language);
273
273
  const productSku = item?.product?.sku || item?.sku || "";
274
274
  const productImage = item?.product?.media?.images?.items?.[0]?.imageVariants?.[0]?.url || "";
275
- const productUrl = getProductUrl(item);
275
+ const productUrl = getProductUrl(item, props.language);
276
276
  const quantity = item?.quantity || 0;
277
277
  const priceTotal = item?.priceTotal || 0;
278
278
  const discount = item?.discount || 0;
@@ -387,7 +387,7 @@ function OrderItemCard(props) {
387
387
  className: "propeller-order-item-card__child-row border-0",
388
388
  "data-child": "true",
389
389
  children: [
390
- /* @__PURE__ */ jsx("td", { className: "propeller-order-item-card__cell propeller-order-item-card__cell--product px-6 py-2 pl-28", children: /* @__PURE__ */ jsx("span", { className: "propeller-order-item-card__child-title text-sm text-muted-foreground", children: child.product?.names?.[0]?.value || child.name || "Unknown" }) }),
390
+ /* @__PURE__ */ jsx("td", { className: "propeller-order-item-card__cell propeller-order-item-card__cell--product px-6 py-2 pl-28", children: /* @__PURE__ */ jsx("span", { className: "propeller-order-item-card__child-title text-sm text-muted-foreground", children: getLocalizedValue(child.product?.names, props.language, "") || child.name || "Unknown" }) }),
391
391
  showQuantity ? /* @__PURE__ */ 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,
392
392
  showDiscount ? /* @__PURE__ */ 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,
393
393
  showPrice ? /* @__PURE__ */ 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