@garagem-ai/site-sdk 0.13.4 → 0.13.5

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
@@ -71,6 +71,19 @@ var LISTING_TYPE_ALIASES = {
71
71
  rental: ["alugar"]
72
72
  };
73
73
 
74
+ // ../search-url/listing-identity.ts
75
+ var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
76
+ var LISTING_CODE_RE = /^(?:[A-Za-z0-9]+|[A-Z0-9]+(?:-[A-Z0-9]+)+)$/;
77
+ var LETTER_CODE_RE = /^[A-Z]{5}$/;
78
+ function isShortListingIdentity(segment) {
79
+ if (UUID_RE.test(segment) || LETTER_CODE_RE.test(segment)) return true;
80
+ return /\d/.test(segment) && LISTING_CODE_RE.test(segment);
81
+ }
82
+ function isShortListingPath(pathname) {
83
+ const parts = (pathname.split(/[?#]/)[0] ?? "").split("/").filter(Boolean);
84
+ return parts.length === 2 && parts[0] === SEARCH_BASE_ROUTE && isShortListingIdentity(parts[1] ?? "");
85
+ }
86
+
74
87
  // ../search-url/path.ts
75
88
  function toArray(value) {
76
89
  if (value === void 0) return [];
@@ -167,6 +180,7 @@ function parseSearchPublicPath(pathname, dictionary = emptySearchUrlDictionary()
167
180
  if (segments.some((segment) => segment.toLowerCase().startsWith("id-"))) {
168
181
  return null;
169
182
  }
183
+ if (isShortListingPath(raw)) return null;
170
184
  const filters = {};
171
185
  const locationParts = [];
172
186
  const propertyTypes = [];
@@ -499,9 +513,9 @@ function pathnameOnly(pathname) {
499
513
  return String(pathname || "").split(/[?#]/)[0] || "/";
500
514
  }
501
515
  function isListingDetailPath(pathname) {
502
- const parts = pathnameOnly(pathname).split("/").filter(Boolean);
503
- const last = parts[parts.length - 1] || "";
504
- return last.toLowerCase().startsWith("id-");
516
+ const path = pathnameOnly(pathname);
517
+ const last = path.split("/").filter(Boolean).pop() || "";
518
+ return last.toLowerCase().startsWith("id-") || isShortListingPath(path);
505
519
  }
506
520
  function readPublicSearch(pathname, search, dictionary) {
507
521
  const pathFilters = parseSearchPublicPath2(pathnameOnly(pathname), dictionary) || {};