@garagem-ai/site-sdk 0.13.1 → 0.13.2

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.js CHANGED
@@ -710,18 +710,25 @@ function minOf(value) {
710
710
  if (!Array.isArray(value)) return value;
711
711
  return value.length ? Math.min(...value) : void 0;
712
712
  }
713
+ function knownLocationName(table, slug) {
714
+ if (!slug || !table) return void 0;
715
+ const key = Object.hasOwn(table, slug) ? slug : slug.toLowerCase();
716
+ return Object.hasOwn(table, key) && table[key] || void 0;
717
+ }
713
718
  function trackSearchResults(input) {
714
- const { pathFilters, applied, listingIds, page } = input;
715
- const location = displayPathLocation(
716
- pathFilters.location,
717
- input.locationNames
718
- );
719
+ const { pathFilters, applied, locationNames, listingIds, page } = input;
719
720
  emitSiteEvent("property_search", {
720
721
  query: applied.query || void 0,
721
722
  business_type: catalogBusinessType(pathFilters.listingType),
722
723
  property_type: pathFilters.propertyType,
723
- location_city: location?.city,
724
- location_neighborhood: location?.neighborhood,
724
+ location_city: knownLocationName(
725
+ locationNames?.cities,
726
+ pathFilters.location?.city
727
+ ),
728
+ location_neighborhood: knownLocationName(
729
+ locationNames?.neighborhoods,
730
+ pathFilters.location?.neighborhood
731
+ ),
725
732
  min_price: pathFilters.price?.min,
726
733
  max_price: pathFilters.price?.max,
727
734
  min_bedrooms: minOf(pathFilters.bedrooms),