@propeller-commerce/propeller-v2-react-ui 0.15.8 → 0.15.10

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/index.d.cts CHANGED
@@ -3335,6 +3335,8 @@ interface CartIconAndSidebarProps {
3335
3335
  * localized page. Keys match CartItem's label map.
3336
3336
  */
3337
3337
  cartItemLabels?: Record<string, string>;
3338
+ /** Labels for the bonus-items block. Keys: `title`, `sku`. */
3339
+ cartBonusItemsLabels?: Record<string, string>;
3338
3340
  /** Logged-in user — used to determine purchaser role and authorization limit */
3339
3341
  user?: Contact | Customer;
3340
3342
  /** Configuration object passed to the component */
package/dist/index.d.ts CHANGED
@@ -3335,6 +3335,8 @@ interface CartIconAndSidebarProps {
3335
3335
  * localized page. Keys match CartItem's label map.
3336
3336
  */
3337
3337
  cartItemLabels?: Record<string, string>;
3338
+ /** Labels for the bonus-items block. Keys: `title`, `sku`. */
3339
+ cartBonusItemsLabels?: Record<string, string>;
3338
3340
  /** Logged-in user — used to determine purchaser role and authorization limit */
3339
3341
  user?: Contact | Customer;
3340
3342
  /** Configuration object passed to the component */
package/dist/index.js CHANGED
@@ -7477,7 +7477,15 @@ function CartIconAndSidebar(rawProps) {
7477
7477
  },
7478
7478
  item.itemId
7479
7479
  )) }),
7480
- /* @__PURE__ */ jsx(CartBonusItemsImpl, { cart: props.cart, includeTax: useTax, className: "mt-4" })
7480
+ /* @__PURE__ */ jsx(
7481
+ CartBonusItemsImpl,
7482
+ {
7483
+ cart: props.cart,
7484
+ includeTax: useTax,
7485
+ className: "mt-4",
7486
+ labels: props.cartBonusItemsLabels
7487
+ }
7488
+ )
7481
7489
  ] }),
7482
7490
  " ",
7483
7491
  items.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "propeller-cart-icon__sidebar-footer px-5 py-4 border-t border-border space-y-3 bg-surface-hover", children: [
@@ -16469,19 +16477,27 @@ function ProductSpecifications(rawProps) {
16469
16477
  (a) => (a.attributeDescription?.group || "") === group
16470
16478
  );
16471
16479
  }
16480
+ function pickLocalized(rows, isUsable) {
16481
+ const list = (rows || []).filter(isUsable);
16482
+ const lang = (props.language || "NL").toUpperCase();
16483
+ return list.find((row) => (row.language || "").toUpperCase() === lang) || list[0];
16484
+ }
16472
16485
  function getAttributeLabel(attr) {
16473
- const lang = props.language || "NL";
16474
- const descs = attr.attributeDescription?.descriptions || [];
16475
- const match = descs.find((d) => d.language === lang);
16486
+ const match = pickLocalized(
16487
+ attr.attributeDescription?.descriptions,
16488
+ (d) => !!d.value
16489
+ );
16476
16490
  return match?.value || attr.attributeDescription?.name || "";
16477
16491
  }
16478
16492
  function getAttributeValue(attr) {
16479
16493
  const v = attr.value;
16480
16494
  if (!v) return "";
16481
- const lang = props.language || "NL";
16482
16495
  if (v.type === AttributeType.TEXT) {
16483
16496
  const tv = v;
16484
- const entry = tv.textValues?.find((row) => row.language === lang);
16497
+ const entry = pickLocalized(
16498
+ tv.textValues,
16499
+ (row) => (row?.values || []).some(Boolean)
16500
+ );
16485
16501
  const vals = (entry?.values || []).filter(Boolean);
16486
16502
  return vals.join(", ");
16487
16503
  }