@garagem-ai/site-sdk 0.13.3 → 0.13.4

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.mjs CHANGED
@@ -1029,6 +1029,27 @@ function lookupDisplay(table, slug) {
1029
1029
  if (!slug || !table) return slug;
1030
1030
  return table[slug] || table[String(slug).toLowerCase()] || slug;
1031
1031
  }
1032
+ var LOCATION_FIELDS = ["state", "city", "neighborhood", "street"];
1033
+ var LOCATION_TABLE_KEY = {
1034
+ state: "states",
1035
+ city: "cities",
1036
+ neighborhood: "neighborhoods",
1037
+ street: "streets"
1038
+ };
1039
+ function locationTableHasSlug(table, slug) {
1040
+ if (!table) return false;
1041
+ if (Object.hasOwn(table, slug)) return true;
1042
+ const lower = slug.toLowerCase();
1043
+ return lower !== slug && Object.hasOwn(table, lower);
1044
+ }
1045
+ function unknownSearchLocation(location, tables) {
1046
+ if (!location) return false;
1047
+ const present = LOCATION_FIELDS.filter((key) => location[key]);
1048
+ if (present.length === 0 || !tables) return false;
1049
+ return present.some(
1050
+ (key) => !locationTableHasSlug(tables[LOCATION_TABLE_KEY[key]], location[key])
1051
+ );
1052
+ }
1032
1053
  function displayPathLocation(location, values) {
1033
1054
  if (!location) return null;
1034
1055
  const table = values || {};
@@ -3250,7 +3271,10 @@ var STUDIO_SDK_CONTRACT = {
3250
3271
  */
3251
3272
  unpublishedSearchExports: [
3252
3273
  "searchChromeModel",
3253
- "rangeDraftFromPath"
3274
+ "rangeDraftFromPath",
3275
+ // `unknownSearchLocation` is in git. Prompts inline the same check with
3276
+ // `parseSearchPublicPath` + `locationsPath` until this name is on the pin.
3277
+ "unknownSearchLocation"
3254
3278
  ],
3255
3279
  /**
3256
3280
  * maps.fndn.ai helpers (static map, street view, boundaries, travel
@@ -5159,6 +5183,7 @@ export {
5159
5183
  travelTimesFromListing,
5160
5184
  truncateNationalPhoneDigits,
5161
5185
  unavailableReactImports,
5186
+ unknownSearchLocation,
5162
5187
  uploadSellerLeadPhoto,
5163
5188
  visibleSearchFilters
5164
5189
  };