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

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.js CHANGED
@@ -16469,19 +16469,27 @@ function ProductSpecifications(rawProps) {
16469
16469
  (a) => (a.attributeDescription?.group || "") === group
16470
16470
  );
16471
16471
  }
16472
+ function pickLocalized(rows, isUsable) {
16473
+ const list = (rows || []).filter(isUsable);
16474
+ const lang = (props.language || "NL").toUpperCase();
16475
+ return list.find((row) => (row.language || "").toUpperCase() === lang) || list[0];
16476
+ }
16472
16477
  function getAttributeLabel(attr) {
16473
- const lang = props.language || "NL";
16474
- const descs = attr.attributeDescription?.descriptions || [];
16475
- const match = descs.find((d) => d.language === lang);
16478
+ const match = pickLocalized(
16479
+ attr.attributeDescription?.descriptions,
16480
+ (d) => !!d.value
16481
+ );
16476
16482
  return match?.value || attr.attributeDescription?.name || "";
16477
16483
  }
16478
16484
  function getAttributeValue(attr) {
16479
16485
  const v = attr.value;
16480
16486
  if (!v) return "";
16481
- const lang = props.language || "NL";
16482
16487
  if (v.type === AttributeType.TEXT) {
16483
16488
  const tv = v;
16484
- const entry = tv.textValues?.find((row) => row.language === lang);
16489
+ const entry = pickLocalized(
16490
+ tv.textValues,
16491
+ (row) => (row?.values || []).some(Boolean)
16492
+ );
16485
16493
  const vals = (entry?.values || []).filter(Boolean);
16486
16494
  return vals.join(", ");
16487
16495
  }