@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/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/react.js +14 -7
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +14 -7
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
- package/src/analytics.ts +23 -12
package/dist/react.mjs
CHANGED
|
@@ -682,18 +682,25 @@ function minOf(value) {
|
|
|
682
682
|
if (!Array.isArray(value)) return value;
|
|
683
683
|
return value.length ? Math.min(...value) : void 0;
|
|
684
684
|
}
|
|
685
|
+
function knownLocationName(table, slug) {
|
|
686
|
+
if (!slug || !table) return void 0;
|
|
687
|
+
const key = Object.hasOwn(table, slug) ? slug : slug.toLowerCase();
|
|
688
|
+
return Object.hasOwn(table, key) && table[key] || void 0;
|
|
689
|
+
}
|
|
685
690
|
function trackSearchResults(input) {
|
|
686
|
-
const { pathFilters, applied, listingIds, page } = input;
|
|
687
|
-
const location = displayPathLocation(
|
|
688
|
-
pathFilters.location,
|
|
689
|
-
input.locationNames
|
|
690
|
-
);
|
|
691
|
+
const { pathFilters, applied, locationNames, listingIds, page } = input;
|
|
691
692
|
emitSiteEvent("property_search", {
|
|
692
693
|
query: applied.query || void 0,
|
|
693
694
|
business_type: catalogBusinessType(pathFilters.listingType),
|
|
694
695
|
property_type: pathFilters.propertyType,
|
|
695
|
-
location_city:
|
|
696
|
-
|
|
696
|
+
location_city: knownLocationName(
|
|
697
|
+
locationNames?.cities,
|
|
698
|
+
pathFilters.location?.city
|
|
699
|
+
),
|
|
700
|
+
location_neighborhood: knownLocationName(
|
|
701
|
+
locationNames?.neighborhoods,
|
|
702
|
+
pathFilters.location?.neighborhood
|
|
703
|
+
),
|
|
697
704
|
min_price: pathFilters.price?.min,
|
|
698
705
|
max_price: pathFilters.price?.max,
|
|
699
706
|
min_bedrooms: minOf(pathFilters.bedrooms),
|