@garagem-ai/site-sdk 0.13.6 → 0.14.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/react.mjs CHANGED
@@ -1444,9 +1444,21 @@ import { useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2, useSta
1444
1444
  function listingLocationLabel(location) {
1445
1445
  return [location.neighborhood, location.city, location.state].map((part) => part ? String(part).trim() : "").filter(Boolean).join(", ");
1446
1446
  }
1447
+ function cardPriceLabel(isPrivate, collapsed, price, formattedPrice) {
1448
+ if (isPrivate) return "Sob consulta";
1449
+ if (collapsed && price != null) return `A partir de ${formattedPrice}`;
1450
+ return formattedPrice;
1451
+ }
1447
1452
  function toListingCardModel(listing) {
1448
1453
  const isPrivate = listing.priceVisibility === "private";
1449
1454
  const area = listing.property?.usableArea ?? listing.property?.totalArea;
1455
+ const unitCount = listing.development?.unitCount;
1456
+ const collapsed = typeof unitCount === "number" && unitCount > 1;
1457
+ const formattedPrice = formatListingPrice(
1458
+ listing.price,
1459
+ "pt-BR",
1460
+ listing.currency ?? "BRL"
1461
+ );
1450
1462
  return {
1451
1463
  href: listingPublicPath(listing),
1452
1464
  title: listing.title,
@@ -1454,7 +1466,12 @@ function toListingCardModel(listing) {
1454
1466
  businessLabel: listingBusinessLabel(listing.businessType),
1455
1467
  priceVisibility: listing.priceVisibility,
1456
1468
  price: listing.price,
1457
- priceLabel: isPrivate ? "Sob consulta" : formatListingPrice(listing.price, "pt-BR", listing.currency ?? "BRL"),
1469
+ priceLabel: cardPriceLabel(
1470
+ isPrivate,
1471
+ collapsed,
1472
+ listing.price,
1473
+ formattedPrice
1474
+ ),
1458
1475
  pricePeriod: listing.businessType === "rental" && !isPrivate && listing.price != null ? "/m\xEAs" : null,
1459
1476
  locationLabel: listingLocationLabel(listing.location || {}),
1460
1477
  propertyType: listing.property?.type ?? null,
@@ -1463,7 +1480,8 @@ function toListingCardModel(listing) {
1463
1480
  bedrooms: listing.property?.bedrooms ?? null,
1464
1481
  bathrooms: listing.property?.bathrooms ?? null,
1465
1482
  parkingSpaces: listing.property?.parkingSpaces ?? null,
1466
- areaM2: area ?? null
1483
+ areaM2: area ?? null,
1484
+ unitCount: collapsed && typeof unitCount === "number" ? unitCount : null
1467
1485
  };
1468
1486
  }
1469
1487