@garagem-ai/site-sdk 0.4.14 → 0.5.1
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/README.md +26 -37
- package/dist/index.d.mts +31 -19
- package/dist/index.d.ts +31 -19
- package/dist/index.js +103 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +99 -19
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +2 -98
- package/dist/react.d.ts +2 -98
- package/dist/react.js +11 -957
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +11 -955
- package/dist/react.mjs.map +1 -1
- package/dist/{search-engine-1O4sKtKb.d.mts → search-engine-4ocM0UPk.d.mts} +16 -1
- package/dist/{search-engine-1O4sKtKb.d.ts → search-engine-4ocM0UPk.d.ts} +16 -1
- package/package.json +2 -2
- package/src/index.ts +5 -0
- package/src/react/index.ts +1 -13
- package/src/react/search-chrome.tsx +0 -48
- package/src/react/search.css +2 -499
- package/src/react/styles/search-chrome-css.generated.ts +2 -2
- package/src/react/types.ts +0 -32
- package/src/search-engine.ts +47 -1
- package/src/studio-contract.ts +69 -21
- package/src/react/filter-panel.tsx +0 -248
- package/src/react/icons.tsx +0 -46
- package/src/react/search-page.tsx +0 -475
- package/src/react/search-pagination.tsx +0 -120
- package/src/react/search-query-form.tsx +0 -81
package/README.md
CHANGED
|
@@ -252,57 +252,46 @@ option on `createGaragemClient`.
|
|
|
252
252
|
## Search UI (`@garagem-ai/site-sdk/react`)
|
|
253
253
|
|
|
254
254
|
Headless URL/search helpers live on the main entry (`readPublicSearch`,
|
|
255
|
-
`hrefForPathFilters`, `toListingCardModel`, …). The
|
|
256
|
-
separate subpath — peer `react` + `next`.
|
|
255
|
+
`searchChromeModel`, `hrefForPathFilters`, `toListingCardModel`, …). The
|
|
256
|
+
React adapter is a separate subpath — peer `react` + `next`.
|
|
257
257
|
|
|
258
258
|
Studio codegen follows `STUDIO_SDK_CONTRACT`: pin
|
|
259
259
|
`@garagem-ai/site-sdk` to `minNpmVersion` and import only
|
|
260
|
-
`reactExports` (`
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
Studio.
|
|
260
|
+
`reactExports` (`usePublicSearch`, `ListingCard`, `ResultsSkeleton` on
|
|
261
|
+
the Studio pin). Preview, open-in-new-tab, and published `next build`
|
|
262
|
+
all resolve that tarball. Do **not** import npm CSS
|
|
263
|
+
(`@garagem-ai/site-sdk/react/search.css`) in Studio.
|
|
265
264
|
|
|
266
|
-
`
|
|
267
|
-
|
|
265
|
+
`ListingCard` and `ResultsSkeleton` inject card/skeleton CSS (JS
|
|
266
|
+
`<style>` tag). Search chrome (query, toolbar, sort, filters,
|
|
267
|
+
pagination, heading) is composed in the app with `usePublicSearch`.
|
|
268
268
|
|
|
269
269
|
```tsx
|
|
270
270
|
"use client";
|
|
271
|
-
import {
|
|
272
|
-
import { SearchPage, ResultsSkeleton } from "@garagem-ai/site-sdk/react";
|
|
271
|
+
import { usePublicSearch } from "@garagem-ai/site-sdk/react";
|
|
273
272
|
|
|
274
|
-
export
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
<div className="mx-auto w-full max-w-site px-4">
|
|
278
|
-
<Suspense fallback={<ResultsSkeleton />}>
|
|
279
|
-
<SearchPage
|
|
280
|
-
as="div"
|
|
281
|
-
siteId={process.env.NEXT_PUBLIC_GARAGEM_SITE_ID!}
|
|
282
|
-
variant="toolbar"
|
|
283
|
-
/>
|
|
284
|
-
</Suspense>
|
|
285
|
-
</div>
|
|
286
|
-
</main>
|
|
287
|
-
);
|
|
273
|
+
export function ImoveisSearch({ siteId }: { siteId: string }) {
|
|
274
|
+
const search = usePublicSearch({ siteId });
|
|
275
|
+
return search.listings.length;
|
|
288
276
|
}
|
|
289
277
|
```
|
|
290
278
|
|
|
291
|
-
|
|
279
|
+
Wrap that client component in `<Suspense fallback={<ResultsSkeleton />}>`
|
|
280
|
+
inside the page `<main>`. Constrain width with `.max-w-site` and
|
|
292
281
|
`--site-max-width` (`STUDIO_SITE_LAYOUT` — Editor default `80rem` / `px-4`).
|
|
293
282
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
`classNames`, `icons`, and `data-slot`. Home and search should share
|
|
283
|
+
Theme cards via CSS variables (`SEARCH_CSS_VARS` / `SEARCH_CSS_RECIPE` in
|
|
284
|
+
`globals.css`) and `data-slot`. Home and search should share
|
|
297
285
|
`ListingCard`. Listing detail maps `listingDetailModel` leaves and
|
|
298
|
-
`listingAmenityGroups`. The search H1 is SEO
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
not part of
|
|
286
|
+
`listingAmenityGroups`. The search H1 is SEO stable: count
|
|
287
|
+
`<span data-slot="search-heading-count">` first, then
|
|
288
|
+
`<h1 data-slot="search-heading-title">`. Hit count is never inside
|
|
289
|
+
`<h1>`. Presentation tokens stay framework-free on the main entry so
|
|
290
|
+
other adapters can reuse them.
|
|
291
|
+
|
|
292
|
+
Hand-written Next apps that prefer a layout tag can import
|
|
293
|
+
`SearchChromeStyles` after it ships on npm; until then it is not part of
|
|
294
|
+
the Studio pin.
|
|
306
295
|
|
|
307
296
|
## What's NOT in this release
|
|
308
297
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RequestNextOptions, L as ListingFilters, Q as QueryListingsParams, S as SearchListingsParams, C as CmsCollection, a as CmsEntriesResult, b as CmsEntry, c as ListingDetail, d as ListingsResult, e as SearchUi, f as SimilarListingsResult, g as Site, h as QueryListingsResult, i as SearchListingsResult, j as SearchPathFilters, k as SearchUiDictionary, l as QueryListingsFilters, A as AppliedSearchQuery, m as AppliedSearchChange } from './search-engine-
|
|
2
|
-
export { n as AMENITY_FALLBACK_LABELS, o as AmenityLabelDictionary, p as AmenityLabelOption, q as CmsEntryStatus, r as CmsFieldDefinition, s as CmsFieldType, t as CmsSeoData, F as FORBIDDEN_SEARCH_QUERY_KEYS, u as LISTING_AMENITY_TITLES, v as LISTING_DESCRIPTION_CLAMP, w as Listing, x as ListingAmenityGroup, y as ListingAmenityGroupKey, z as ListingAmenitySource, B as ListingBreadcrumbCrumb, D as ListingBusinessType, E as ListingCardModel, G as ListingDescriptionPreview, H as ListingDetailFieldsModel, I as ListingDetailFieldsSource, J as ListingDetailModel, K as ListingFact, M as ListingLocation, N as ListingLocationBlock, O as ListingMedia, P as ListingMediaOverlay, T as ListingPriceVisibility, U as ListingPropertySummary, V as ListingValue, W as LocationNameTables, X as QueryListingsLocation, Y as
|
|
1
|
+
import { R as RequestNextOptions, L as ListingFilters, Q as QueryListingsParams, S as SearchListingsParams, C as CmsCollection, a as CmsEntriesResult, b as CmsEntry, c as ListingDetail, d as ListingsResult, e as SearchUi, f as SimilarListingsResult, g as Site, h as QueryListingsResult, i as SearchListingsResult, j as SearchPathFilters, k as SearchUiDictionary, l as QueryListingsFilters, A as AppliedSearchQuery, m as AppliedSearchChange } from './search-engine-4ocM0UPk.mjs';
|
|
2
|
+
export { n as AMENITY_FALLBACK_LABELS, o as AmenityLabelDictionary, p as AmenityLabelOption, q as CmsEntryStatus, r as CmsFieldDefinition, s as CmsFieldType, t as CmsSeoData, F as FORBIDDEN_SEARCH_QUERY_KEYS, u as LISTING_AMENITY_TITLES, v as LISTING_DESCRIPTION_CLAMP, w as Listing, x as ListingAmenityGroup, y as ListingAmenityGroupKey, z as ListingAmenitySource, B as ListingBreadcrumbCrumb, D as ListingBusinessType, E as ListingCardModel, G as ListingDescriptionPreview, H as ListingDetailFieldsModel, I as ListingDetailFieldsSource, J as ListingDetailModel, K as ListingFact, M as ListingLocation, N as ListingLocationBlock, O as ListingMedia, P as ListingMediaOverlay, T as ListingPriceVisibility, U as ListingPropertySummary, V as ListingValue, W as LocationNameTables, X as QueryListingsLocation, Y as SEARCH_EMPTY_COPY, Z as SEARCH_SORT_RELEVANCE, _ as SearchChromeModel, $ as SearchPathLocation, a0 as SearchUiFilter, a1 as SearchUiOption, a2 as TOOLBAR_PRIMARY_FILTER_IDS, a3 as applyPathFilter, a4 as buildQueryListingsParams, a5 as canonicalizeSearchHref, a6 as clearStagedPathFilters, a7 as countFacetChoices, a8 as countOptionLabel, a9 as displayPathLocation, aa as hrefForAppliedChange, ab as hrefForPathFilters, ac as hrefWithExplicitPage, ad as isListingDetailPath, ae as labelAmenities, af as listingAmenityGroups, ag as listingBreadcrumb, ah as listingDescriptionPreview, ai as listingDetailFieldsModel, aj as listingDetailModel, ak as listingFacts, al as listingLocationBlock, am as listingLocationLabel, an as listingMapsHref, ao as listingMediaOverlays, ap as listingValues, aq as paginationPages, ar as pathFilterHasOption, as as pathFilterValue, at as publicSearchHref, au as rangeDraftFromPath, av as readPublicSearch, aw as searchChromeModel, ax as searchHrefUsesLegacyFilterQuery, ay as searchResultsHeading, az as searchSortOptions, aA as toListingCardModel, aB as toolbarFilterIds, aC as visibleSearchFilters } from './search-engine-4ocM0UPk.mjs';
|
|
3
3
|
|
|
4
4
|
/** Custom fetch implementation. Defaults to the global `fetch`. */
|
|
5
5
|
type FetchLike = typeof fetch;
|
|
@@ -343,30 +343,22 @@ declare function isStudioPreviewHost(host: string): boolean;
|
|
|
343
343
|
*/
|
|
344
344
|
declare function resolvePublicSiteId(options: ResolvePublicSiteIdOptions): Promise<string>;
|
|
345
345
|
|
|
346
|
-
/**
|
|
347
|
-
* Studio ↔ npm contract. Prompt, completeness, and recipes must read this
|
|
348
|
-
* object — do not keep a second list of required `@garagem-ai/site-sdk/react`
|
|
349
|
-
* names in apps/site.
|
|
350
|
-
*
|
|
351
|
-
* `minNpmVersion` is the tarball v0 actually installs. Optional exports exist
|
|
352
|
-
* in git and may already be on npm, but Studio codegen must not name them
|
|
353
|
-
* while chromeStrategy is self-inject (v0 copies identifiers; a layout tag
|
|
354
|
-
* also breaks the pancake stack).
|
|
355
|
-
*/
|
|
356
346
|
declare const STUDIO_SDK_PACKAGE: "@garagem-ai/site-sdk";
|
|
357
347
|
declare const STUDIO_SDK_CONTRACT: {
|
|
358
348
|
readonly package: "@garagem-ai/site-sdk";
|
|
359
349
|
/**
|
|
360
350
|
* Exact pin for generated Studio sites. Must match a tarball already on
|
|
361
|
-
* npm — v0 installs this version. After
|
|
362
|
-
*
|
|
363
|
-
* into
|
|
351
|
+
* npm — v0 installs this version. After a later changeset publishes, bump
|
|
352
|
+
* this and move that release's names from `optionalReactExports` /
|
|
353
|
+
* `unpublishedSearchExports` into the prompt-safe lists. Do not bump here
|
|
354
|
+
* until that tarball is on npm. Headless SearchPage already shipped in
|
|
355
|
+
* 0.4.12 (`visibleSearchFilters` / `toolbarFilterIds` are on that pin).
|
|
364
356
|
*/
|
|
365
357
|
readonly minNpmVersion: "0.4.12";
|
|
366
|
-
/** First release where ListingCard and ResultsSkeleton inject
|
|
358
|
+
/** First release where ListingCard and ResultsSkeleton inject card CSS. */
|
|
367
359
|
readonly selfInjectSince: "0.4.2";
|
|
368
360
|
readonly chromeStrategy: "self-inject";
|
|
369
|
-
readonly reactExports: readonly ["
|
|
361
|
+
readonly reactExports: readonly ["usePublicSearch", "ListingCard", "ResultsSkeleton"];
|
|
370
362
|
/**
|
|
371
363
|
* Names that exist in git / the unpublished patch. Completeness treats an
|
|
372
364
|
* import as `sdk-export-mismatch` when the generated pin is older than
|
|
@@ -375,15 +367,34 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
375
367
|
* throws FatalRendererError.
|
|
376
368
|
*/
|
|
377
369
|
readonly optionalReactExports: {
|
|
378
|
-
readonly SearchPageFallback: "0.4.1";
|
|
379
370
|
readonly SearchChromeStyles: "0.4.1";
|
|
380
371
|
readonly ListingDetailFields: "0.4.13";
|
|
381
372
|
};
|
|
373
|
+
/**
|
|
374
|
+
* Former `/react` chrome. Completeness flags imports as mismatch (not in
|
|
375
|
+
* `reactExports`). Prompts must not mention these names at all — v0 copies
|
|
376
|
+
* identifiers even inside “never import”.
|
|
377
|
+
*/
|
|
378
|
+
readonly retiredReactExports: readonly ["SearchPage", "SearchQueryForm", "SearchSortSelect", "FilterPanel", "SearchPagination", "SearchPageFallback"];
|
|
382
379
|
readonly forbiddenImports: readonly ["@garagem-ai/site-sdk/react/search.css"];
|
|
383
380
|
readonly leadStrategy: "visit-default";
|
|
384
381
|
readonly leadExports: readonly ["getLeadUi", "submitVisitLead", "submitContactLead", "slotsForDate", "expandVisitSchedule", "expandVisitTimeSlots", "isVisitSlotAllowed", "STUDIO_DEFAULT_VISIT_SCHEDULE"];
|
|
385
382
|
readonly listingDetailExports: readonly ["listingDetailModel", "getSimilarListings"];
|
|
386
383
|
readonly amenityExports: readonly ["listingAmenityGroups"];
|
|
384
|
+
/**
|
|
385
|
+
* Names already on the pinned npm tarball (`minNpmVersion` / 0.4.12) —
|
|
386
|
+
* safe for Studio prompts and completeness. Includes
|
|
387
|
+
* `visibleSearchFilters` + `toolbarFilterIds` (shipped in 0.4.12). Do not
|
|
388
|
+
* confuse with `unpublishedSearchExports` (`searchChromeModel`, …).
|
|
389
|
+
*/
|
|
390
|
+
readonly searchExports: readonly ["searchResultsHeading", "searchSortOptions", "visibleSearchFilters", "toolbarFilterIds", "paginationPages", "hrefWithExplicitPage"];
|
|
391
|
+
/**
|
|
392
|
+
* Main-package helpers in git / newer tarballs but not required on
|
|
393
|
+
* `minNpmVersion`. Prompts must not mention these until the pin bumps and
|
|
394
|
+
* they move into `searchExports`. Independent of the 0.4.12 filter helpers
|
|
395
|
+
* already listed in `searchExports`.
|
|
396
|
+
*/
|
|
397
|
+
readonly unpublishedSearchExports: readonly ["searchChromeModel", "rangeDraftFromPath"];
|
|
387
398
|
};
|
|
388
399
|
type StudioSdkContract = typeof STUDIO_SDK_CONTRACT;
|
|
389
400
|
/**
|
|
@@ -414,6 +425,7 @@ declare function studioSdkPinInstruction(): string;
|
|
|
414
425
|
declare function studioLeadInstruction(): string;
|
|
415
426
|
declare function studioListingDetailInstruction(): string;
|
|
416
427
|
declare function studioAmenityInstruction(): string;
|
|
428
|
+
declare function studioSearchInstruction(): string;
|
|
417
429
|
declare function studioChromeInstruction(): string;
|
|
418
430
|
/**
|
|
419
431
|
* Tokens that must not appear in Studio codegen (prompts, recipes, repair).
|
|
@@ -529,4 +541,4 @@ interface GaragemClient {
|
|
|
529
541
|
*/
|
|
530
542
|
declare function createGaragemClient(options?: CreateGaragemClientOptions): GaragemClient;
|
|
531
543
|
|
|
532
|
-
export { AppliedSearchChange, AppliedSearchQuery, CmsCollection, CmsEntriesResult, CmsEntry, type ContactLeadInput, type CreateGaragemClientOptions, type FetchLike, type GaragemClient, GaragemSdkError, type GetCmsCollectionOptions, type GetCmsCollectionsOptions, type GetCmsEntriesOptions, type GetCmsEntryOptions, type GetLeadUiOptions, type GetListingOptions, type GetListingsOptions, type GetSearchUiOptions, type GetSimilarListingsOptions, type GetSiteOptions, type HHmm, type LeadContact, type LeadField, type LeadFieldId, LeadSubmitError, type LeadSubmitErrorCode, type LeadSubmitResult, type LeadUi, ListingDetail, ListingFilters, ListingsResult, type LocationFilterInput, QueryListingsFilters, type QueryListingsOptions, QueryListingsParams, QueryListingsResult, RequestNextOptions, type ResolvePublicSiteIdOptions, SEARCH_CSS_RECIPE, SEARCH_CSS_VARS, STUDIO_DEFAULT_VISIT_SCHEDULE, STUDIO_SDK_CONTRACT, STUDIO_SDK_PACKAGE, STUDIO_SITE_LAYOUT, type SearchListingsOptions, SearchListingsParams, SearchListingsResult, SearchPathFilters, SearchUi, SearchUiDictionary, SimilarListingsResult, Site, type StudioSdkContract, VISIT_TIME_ZONE, type VisitHours, type VisitLeadInput, type VisitSchedule, type VisitScheduleConfig, coerceNpmVersion, compareSemver, composeSearchPublicHref, composeSearchPublicPath, createGaragemClient, expandVisitSchedule, expandVisitTimeSlots, formatAreaM2, formatGroupedInteger, formatListingPrice, getCmsCollection, getCmsCollections, getCmsEntries, getCmsEntry, getLeadUi, getListing, getListings, getSearchUi, getSimilarListings, getSite, hasShowcaseLeadsPostUrl, isStudioPreviewHost, isVisitSlotAllowed, listingBusinessLabel, listingLookupKey, listingPublicPath, mergeAppliedSearchQueryIntoSearch, normalizeVisitDate, normalizeVisitTime, parseAppliedSearchQuery, parseGroupedInteger, parseReactSdkNamedImports, parseSearchPublicPath, pathFiltersToQueryFilters, pathLocationToFilterInput, queryListings, reduceAppliedSearchQuery, resolvePublicSiteId, searchListings, serializeAppliedSearchQuery, slotsForDate, studioAmenityInstruction, studioChromeInstruction, studioCodegenContractViolations, studioDefaultLeadUi, studioLayoutInstruction, studioLeadInstruction, studioListingDetailInstruction, studioSdkPinInstruction, studioSearchLandmarkInstruction, studioSiteWidthCss, submitContactLead, submitVisitLead, unavailableReactImports };
|
|
544
|
+
export { AppliedSearchChange, AppliedSearchQuery, CmsCollection, CmsEntriesResult, CmsEntry, type ContactLeadInput, type CreateGaragemClientOptions, type FetchLike, type GaragemClient, GaragemSdkError, type GetCmsCollectionOptions, type GetCmsCollectionsOptions, type GetCmsEntriesOptions, type GetCmsEntryOptions, type GetLeadUiOptions, type GetListingOptions, type GetListingsOptions, type GetSearchUiOptions, type GetSimilarListingsOptions, type GetSiteOptions, type HHmm, type LeadContact, type LeadField, type LeadFieldId, LeadSubmitError, type LeadSubmitErrorCode, type LeadSubmitResult, type LeadUi, ListingDetail, ListingFilters, ListingsResult, type LocationFilterInput, QueryListingsFilters, type QueryListingsOptions, QueryListingsParams, QueryListingsResult, RequestNextOptions, type ResolvePublicSiteIdOptions, SEARCH_CSS_RECIPE, SEARCH_CSS_VARS, STUDIO_DEFAULT_VISIT_SCHEDULE, STUDIO_SDK_CONTRACT, STUDIO_SDK_PACKAGE, STUDIO_SITE_LAYOUT, type SearchListingsOptions, SearchListingsParams, SearchListingsResult, SearchPathFilters, SearchUi, SearchUiDictionary, SimilarListingsResult, Site, type StudioSdkContract, VISIT_TIME_ZONE, type VisitHours, type VisitLeadInput, type VisitSchedule, type VisitScheduleConfig, coerceNpmVersion, compareSemver, composeSearchPublicHref, composeSearchPublicPath, createGaragemClient, expandVisitSchedule, expandVisitTimeSlots, formatAreaM2, formatGroupedInteger, formatListingPrice, getCmsCollection, getCmsCollections, getCmsEntries, getCmsEntry, getLeadUi, getListing, getListings, getSearchUi, getSimilarListings, getSite, hasShowcaseLeadsPostUrl, isStudioPreviewHost, isVisitSlotAllowed, listingBusinessLabel, listingLookupKey, listingPublicPath, mergeAppliedSearchQueryIntoSearch, normalizeVisitDate, normalizeVisitTime, parseAppliedSearchQuery, parseGroupedInteger, parseReactSdkNamedImports, parseSearchPublicPath, pathFiltersToQueryFilters, pathLocationToFilterInput, queryListings, reduceAppliedSearchQuery, resolvePublicSiteId, searchListings, serializeAppliedSearchQuery, slotsForDate, studioAmenityInstruction, studioChromeInstruction, studioCodegenContractViolations, studioDefaultLeadUi, studioLayoutInstruction, studioLeadInstruction, studioListingDetailInstruction, studioSdkPinInstruction, studioSearchInstruction, studioSearchLandmarkInstruction, studioSiteWidthCss, submitContactLead, submitVisitLead, unavailableReactImports };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RequestNextOptions, L as ListingFilters, Q as QueryListingsParams, S as SearchListingsParams, C as CmsCollection, a as CmsEntriesResult, b as CmsEntry, c as ListingDetail, d as ListingsResult, e as SearchUi, f as SimilarListingsResult, g as Site, h as QueryListingsResult, i as SearchListingsResult, j as SearchPathFilters, k as SearchUiDictionary, l as QueryListingsFilters, A as AppliedSearchQuery, m as AppliedSearchChange } from './search-engine-
|
|
2
|
-
export { n as AMENITY_FALLBACK_LABELS, o as AmenityLabelDictionary, p as AmenityLabelOption, q as CmsEntryStatus, r as CmsFieldDefinition, s as CmsFieldType, t as CmsSeoData, F as FORBIDDEN_SEARCH_QUERY_KEYS, u as LISTING_AMENITY_TITLES, v as LISTING_DESCRIPTION_CLAMP, w as Listing, x as ListingAmenityGroup, y as ListingAmenityGroupKey, z as ListingAmenitySource, B as ListingBreadcrumbCrumb, D as ListingBusinessType, E as ListingCardModel, G as ListingDescriptionPreview, H as ListingDetailFieldsModel, I as ListingDetailFieldsSource, J as ListingDetailModel, K as ListingFact, M as ListingLocation, N as ListingLocationBlock, O as ListingMedia, P as ListingMediaOverlay, T as ListingPriceVisibility, U as ListingPropertySummary, V as ListingValue, W as LocationNameTables, X as QueryListingsLocation, Y as
|
|
1
|
+
import { R as RequestNextOptions, L as ListingFilters, Q as QueryListingsParams, S as SearchListingsParams, C as CmsCollection, a as CmsEntriesResult, b as CmsEntry, c as ListingDetail, d as ListingsResult, e as SearchUi, f as SimilarListingsResult, g as Site, h as QueryListingsResult, i as SearchListingsResult, j as SearchPathFilters, k as SearchUiDictionary, l as QueryListingsFilters, A as AppliedSearchQuery, m as AppliedSearchChange } from './search-engine-4ocM0UPk.js';
|
|
2
|
+
export { n as AMENITY_FALLBACK_LABELS, o as AmenityLabelDictionary, p as AmenityLabelOption, q as CmsEntryStatus, r as CmsFieldDefinition, s as CmsFieldType, t as CmsSeoData, F as FORBIDDEN_SEARCH_QUERY_KEYS, u as LISTING_AMENITY_TITLES, v as LISTING_DESCRIPTION_CLAMP, w as Listing, x as ListingAmenityGroup, y as ListingAmenityGroupKey, z as ListingAmenitySource, B as ListingBreadcrumbCrumb, D as ListingBusinessType, E as ListingCardModel, G as ListingDescriptionPreview, H as ListingDetailFieldsModel, I as ListingDetailFieldsSource, J as ListingDetailModel, K as ListingFact, M as ListingLocation, N as ListingLocationBlock, O as ListingMedia, P as ListingMediaOverlay, T as ListingPriceVisibility, U as ListingPropertySummary, V as ListingValue, W as LocationNameTables, X as QueryListingsLocation, Y as SEARCH_EMPTY_COPY, Z as SEARCH_SORT_RELEVANCE, _ as SearchChromeModel, $ as SearchPathLocation, a0 as SearchUiFilter, a1 as SearchUiOption, a2 as TOOLBAR_PRIMARY_FILTER_IDS, a3 as applyPathFilter, a4 as buildQueryListingsParams, a5 as canonicalizeSearchHref, a6 as clearStagedPathFilters, a7 as countFacetChoices, a8 as countOptionLabel, a9 as displayPathLocation, aa as hrefForAppliedChange, ab as hrefForPathFilters, ac as hrefWithExplicitPage, ad as isListingDetailPath, ae as labelAmenities, af as listingAmenityGroups, ag as listingBreadcrumb, ah as listingDescriptionPreview, ai as listingDetailFieldsModel, aj as listingDetailModel, ak as listingFacts, al as listingLocationBlock, am as listingLocationLabel, an as listingMapsHref, ao as listingMediaOverlays, ap as listingValues, aq as paginationPages, ar as pathFilterHasOption, as as pathFilterValue, at as publicSearchHref, au as rangeDraftFromPath, av as readPublicSearch, aw as searchChromeModel, ax as searchHrefUsesLegacyFilterQuery, ay as searchResultsHeading, az as searchSortOptions, aA as toListingCardModel, aB as toolbarFilterIds, aC as visibleSearchFilters } from './search-engine-4ocM0UPk.js';
|
|
3
3
|
|
|
4
4
|
/** Custom fetch implementation. Defaults to the global `fetch`. */
|
|
5
5
|
type FetchLike = typeof fetch;
|
|
@@ -343,30 +343,22 @@ declare function isStudioPreviewHost(host: string): boolean;
|
|
|
343
343
|
*/
|
|
344
344
|
declare function resolvePublicSiteId(options: ResolvePublicSiteIdOptions): Promise<string>;
|
|
345
345
|
|
|
346
|
-
/**
|
|
347
|
-
* Studio ↔ npm contract. Prompt, completeness, and recipes must read this
|
|
348
|
-
* object — do not keep a second list of required `@garagem-ai/site-sdk/react`
|
|
349
|
-
* names in apps/site.
|
|
350
|
-
*
|
|
351
|
-
* `minNpmVersion` is the tarball v0 actually installs. Optional exports exist
|
|
352
|
-
* in git and may already be on npm, but Studio codegen must not name them
|
|
353
|
-
* while chromeStrategy is self-inject (v0 copies identifiers; a layout tag
|
|
354
|
-
* also breaks the pancake stack).
|
|
355
|
-
*/
|
|
356
346
|
declare const STUDIO_SDK_PACKAGE: "@garagem-ai/site-sdk";
|
|
357
347
|
declare const STUDIO_SDK_CONTRACT: {
|
|
358
348
|
readonly package: "@garagem-ai/site-sdk";
|
|
359
349
|
/**
|
|
360
350
|
* Exact pin for generated Studio sites. Must match a tarball already on
|
|
361
|
-
* npm — v0 installs this version. After
|
|
362
|
-
*
|
|
363
|
-
* into
|
|
351
|
+
* npm — v0 installs this version. After a later changeset publishes, bump
|
|
352
|
+
* this and move that release's names from `optionalReactExports` /
|
|
353
|
+
* `unpublishedSearchExports` into the prompt-safe lists. Do not bump here
|
|
354
|
+
* until that tarball is on npm. Headless SearchPage already shipped in
|
|
355
|
+
* 0.4.12 (`visibleSearchFilters` / `toolbarFilterIds` are on that pin).
|
|
364
356
|
*/
|
|
365
357
|
readonly minNpmVersion: "0.4.12";
|
|
366
|
-
/** First release where ListingCard and ResultsSkeleton inject
|
|
358
|
+
/** First release where ListingCard and ResultsSkeleton inject card CSS. */
|
|
367
359
|
readonly selfInjectSince: "0.4.2";
|
|
368
360
|
readonly chromeStrategy: "self-inject";
|
|
369
|
-
readonly reactExports: readonly ["
|
|
361
|
+
readonly reactExports: readonly ["usePublicSearch", "ListingCard", "ResultsSkeleton"];
|
|
370
362
|
/**
|
|
371
363
|
* Names that exist in git / the unpublished patch. Completeness treats an
|
|
372
364
|
* import as `sdk-export-mismatch` when the generated pin is older than
|
|
@@ -375,15 +367,34 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
375
367
|
* throws FatalRendererError.
|
|
376
368
|
*/
|
|
377
369
|
readonly optionalReactExports: {
|
|
378
|
-
readonly SearchPageFallback: "0.4.1";
|
|
379
370
|
readonly SearchChromeStyles: "0.4.1";
|
|
380
371
|
readonly ListingDetailFields: "0.4.13";
|
|
381
372
|
};
|
|
373
|
+
/**
|
|
374
|
+
* Former `/react` chrome. Completeness flags imports as mismatch (not in
|
|
375
|
+
* `reactExports`). Prompts must not mention these names at all — v0 copies
|
|
376
|
+
* identifiers even inside “never import”.
|
|
377
|
+
*/
|
|
378
|
+
readonly retiredReactExports: readonly ["SearchPage", "SearchQueryForm", "SearchSortSelect", "FilterPanel", "SearchPagination", "SearchPageFallback"];
|
|
382
379
|
readonly forbiddenImports: readonly ["@garagem-ai/site-sdk/react/search.css"];
|
|
383
380
|
readonly leadStrategy: "visit-default";
|
|
384
381
|
readonly leadExports: readonly ["getLeadUi", "submitVisitLead", "submitContactLead", "slotsForDate", "expandVisitSchedule", "expandVisitTimeSlots", "isVisitSlotAllowed", "STUDIO_DEFAULT_VISIT_SCHEDULE"];
|
|
385
382
|
readonly listingDetailExports: readonly ["listingDetailModel", "getSimilarListings"];
|
|
386
383
|
readonly amenityExports: readonly ["listingAmenityGroups"];
|
|
384
|
+
/**
|
|
385
|
+
* Names already on the pinned npm tarball (`minNpmVersion` / 0.4.12) —
|
|
386
|
+
* safe for Studio prompts and completeness. Includes
|
|
387
|
+
* `visibleSearchFilters` + `toolbarFilterIds` (shipped in 0.4.12). Do not
|
|
388
|
+
* confuse with `unpublishedSearchExports` (`searchChromeModel`, …).
|
|
389
|
+
*/
|
|
390
|
+
readonly searchExports: readonly ["searchResultsHeading", "searchSortOptions", "visibleSearchFilters", "toolbarFilterIds", "paginationPages", "hrefWithExplicitPage"];
|
|
391
|
+
/**
|
|
392
|
+
* Main-package helpers in git / newer tarballs but not required on
|
|
393
|
+
* `minNpmVersion`. Prompts must not mention these until the pin bumps and
|
|
394
|
+
* they move into `searchExports`. Independent of the 0.4.12 filter helpers
|
|
395
|
+
* already listed in `searchExports`.
|
|
396
|
+
*/
|
|
397
|
+
readonly unpublishedSearchExports: readonly ["searchChromeModel", "rangeDraftFromPath"];
|
|
387
398
|
};
|
|
388
399
|
type StudioSdkContract = typeof STUDIO_SDK_CONTRACT;
|
|
389
400
|
/**
|
|
@@ -414,6 +425,7 @@ declare function studioSdkPinInstruction(): string;
|
|
|
414
425
|
declare function studioLeadInstruction(): string;
|
|
415
426
|
declare function studioListingDetailInstruction(): string;
|
|
416
427
|
declare function studioAmenityInstruction(): string;
|
|
428
|
+
declare function studioSearchInstruction(): string;
|
|
417
429
|
declare function studioChromeInstruction(): string;
|
|
418
430
|
/**
|
|
419
431
|
* Tokens that must not appear in Studio codegen (prompts, recipes, repair).
|
|
@@ -529,4 +541,4 @@ interface GaragemClient {
|
|
|
529
541
|
*/
|
|
530
542
|
declare function createGaragemClient(options?: CreateGaragemClientOptions): GaragemClient;
|
|
531
543
|
|
|
532
|
-
export { AppliedSearchChange, AppliedSearchQuery, CmsCollection, CmsEntriesResult, CmsEntry, type ContactLeadInput, type CreateGaragemClientOptions, type FetchLike, type GaragemClient, GaragemSdkError, type GetCmsCollectionOptions, type GetCmsCollectionsOptions, type GetCmsEntriesOptions, type GetCmsEntryOptions, type GetLeadUiOptions, type GetListingOptions, type GetListingsOptions, type GetSearchUiOptions, type GetSimilarListingsOptions, type GetSiteOptions, type HHmm, type LeadContact, type LeadField, type LeadFieldId, LeadSubmitError, type LeadSubmitErrorCode, type LeadSubmitResult, type LeadUi, ListingDetail, ListingFilters, ListingsResult, type LocationFilterInput, QueryListingsFilters, type QueryListingsOptions, QueryListingsParams, QueryListingsResult, RequestNextOptions, type ResolvePublicSiteIdOptions, SEARCH_CSS_RECIPE, SEARCH_CSS_VARS, STUDIO_DEFAULT_VISIT_SCHEDULE, STUDIO_SDK_CONTRACT, STUDIO_SDK_PACKAGE, STUDIO_SITE_LAYOUT, type SearchListingsOptions, SearchListingsParams, SearchListingsResult, SearchPathFilters, SearchUi, SearchUiDictionary, SimilarListingsResult, Site, type StudioSdkContract, VISIT_TIME_ZONE, type VisitHours, type VisitLeadInput, type VisitSchedule, type VisitScheduleConfig, coerceNpmVersion, compareSemver, composeSearchPublicHref, composeSearchPublicPath, createGaragemClient, expandVisitSchedule, expandVisitTimeSlots, formatAreaM2, formatGroupedInteger, formatListingPrice, getCmsCollection, getCmsCollections, getCmsEntries, getCmsEntry, getLeadUi, getListing, getListings, getSearchUi, getSimilarListings, getSite, hasShowcaseLeadsPostUrl, isStudioPreviewHost, isVisitSlotAllowed, listingBusinessLabel, listingLookupKey, listingPublicPath, mergeAppliedSearchQueryIntoSearch, normalizeVisitDate, normalizeVisitTime, parseAppliedSearchQuery, parseGroupedInteger, parseReactSdkNamedImports, parseSearchPublicPath, pathFiltersToQueryFilters, pathLocationToFilterInput, queryListings, reduceAppliedSearchQuery, resolvePublicSiteId, searchListings, serializeAppliedSearchQuery, slotsForDate, studioAmenityInstruction, studioChromeInstruction, studioCodegenContractViolations, studioDefaultLeadUi, studioLayoutInstruction, studioLeadInstruction, studioListingDetailInstruction, studioSdkPinInstruction, studioSearchLandmarkInstruction, studioSiteWidthCss, submitContactLead, submitVisitLead, unavailableReactImports };
|
|
544
|
+
export { AppliedSearchChange, AppliedSearchQuery, CmsCollection, CmsEntriesResult, CmsEntry, type ContactLeadInput, type CreateGaragemClientOptions, type FetchLike, type GaragemClient, GaragemSdkError, type GetCmsCollectionOptions, type GetCmsCollectionsOptions, type GetCmsEntriesOptions, type GetCmsEntryOptions, type GetLeadUiOptions, type GetListingOptions, type GetListingsOptions, type GetSearchUiOptions, type GetSimilarListingsOptions, type GetSiteOptions, type HHmm, type LeadContact, type LeadField, type LeadFieldId, LeadSubmitError, type LeadSubmitErrorCode, type LeadSubmitResult, type LeadUi, ListingDetail, ListingFilters, ListingsResult, type LocationFilterInput, QueryListingsFilters, type QueryListingsOptions, QueryListingsParams, QueryListingsResult, RequestNextOptions, type ResolvePublicSiteIdOptions, SEARCH_CSS_RECIPE, SEARCH_CSS_VARS, STUDIO_DEFAULT_VISIT_SCHEDULE, STUDIO_SDK_CONTRACT, STUDIO_SDK_PACKAGE, STUDIO_SITE_LAYOUT, type SearchListingsOptions, SearchListingsParams, SearchListingsResult, SearchPathFilters, SearchUi, SearchUiDictionary, SimilarListingsResult, Site, type StudioSdkContract, VISIT_TIME_ZONE, type VisitHours, type VisitLeadInput, type VisitSchedule, type VisitScheduleConfig, coerceNpmVersion, compareSemver, composeSearchPublicHref, composeSearchPublicPath, createGaragemClient, expandVisitSchedule, expandVisitTimeSlots, formatAreaM2, formatGroupedInteger, formatListingPrice, getCmsCollection, getCmsCollections, getCmsEntries, getCmsEntry, getLeadUi, getListing, getListings, getSearchUi, getSimilarListings, getSite, hasShowcaseLeadsPostUrl, isStudioPreviewHost, isVisitSlotAllowed, listingBusinessLabel, listingLookupKey, listingPublicPath, mergeAppliedSearchQueryIntoSearch, normalizeVisitDate, normalizeVisitTime, parseAppliedSearchQuery, parseGroupedInteger, parseReactSdkNamedImports, parseSearchPublicPath, pathFiltersToQueryFilters, pathLocationToFilterInput, queryListings, reduceAppliedSearchQuery, resolvePublicSiteId, searchListings, serializeAppliedSearchQuery, slotsForDate, studioAmenityInstruction, studioChromeInstruction, studioCodegenContractViolations, studioDefaultLeadUi, studioLayoutInstruction, studioLeadInstruction, studioListingDetailInstruction, studioSdkPinInstruction, studioSearchInstruction, studioSearchLandmarkInstruction, studioSiteWidthCss, submitContactLead, submitVisitLead, unavailableReactImports };
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,7 @@ __export(src_exports, {
|
|
|
28
28
|
LeadSubmitError: () => LeadSubmitError,
|
|
29
29
|
SEARCH_CSS_RECIPE: () => SEARCH_CSS_RECIPE,
|
|
30
30
|
SEARCH_CSS_VARS: () => SEARCH_CSS_VARS,
|
|
31
|
+
SEARCH_EMPTY_COPY: () => SEARCH_EMPTY_COPY,
|
|
31
32
|
SEARCH_SORT_RELEVANCE: () => SEARCH_SORT_RELEVANCE,
|
|
32
33
|
STUDIO_DEFAULT_VISIT_SCHEDULE: () => STUDIO_DEFAULT_VISIT_SCHEDULE,
|
|
33
34
|
STUDIO_SDK_CONTRACT: () => STUDIO_SDK_CONTRACT,
|
|
@@ -98,9 +99,11 @@ __export(src_exports, {
|
|
|
98
99
|
pathLocationToFilterInput: () => pathLocationToFilterInput,
|
|
99
100
|
publicSearchHref: () => publicSearchHref,
|
|
100
101
|
queryListings: () => queryListings,
|
|
102
|
+
rangeDraftFromPath: () => rangeDraftFromPath,
|
|
101
103
|
readPublicSearch: () => readPublicSearch,
|
|
102
104
|
reduceAppliedSearchQuery: () => reduceAppliedSearchQuery2,
|
|
103
105
|
resolvePublicSiteId: () => resolvePublicSiteId,
|
|
106
|
+
searchChromeModel: () => searchChromeModel,
|
|
104
107
|
searchHrefUsesLegacyFilterQuery: () => searchHrefUsesLegacyFilterQuery,
|
|
105
108
|
searchListings: () => searchListings,
|
|
106
109
|
searchResultsHeading: () => searchResultsHeading,
|
|
@@ -115,6 +118,7 @@ __export(src_exports, {
|
|
|
115
118
|
studioLeadInstruction: () => studioLeadInstruction,
|
|
116
119
|
studioListingDetailInstruction: () => studioListingDetailInstruction,
|
|
117
120
|
studioSdkPinInstruction: () => studioSdkPinInstruction,
|
|
121
|
+
studioSearchInstruction: () => studioSearchInstruction,
|
|
118
122
|
studioSearchLandmarkInstruction: () => studioSearchLandmarkInstruction,
|
|
119
123
|
studioSiteWidthCss: () => studioSiteWidthCss,
|
|
120
124
|
submitContactLead: () => submitContactLead,
|
|
@@ -2046,6 +2050,35 @@ function paginationPages(currentPage, totalPages, padding) {
|
|
|
2046
2050
|
for (let i = start; i <= end; i += 1) pages.push(i);
|
|
2047
2051
|
return pages;
|
|
2048
2052
|
}
|
|
2053
|
+
var SEARCH_EMPTY_COPY = "Nenhum im\xF3vel encontrado. Ajuste a busca ou os filtros.";
|
|
2054
|
+
function rangeDraftFromPath(pathFilters) {
|
|
2055
|
+
const price = pathFilters.price || {};
|
|
2056
|
+
const area = pathFilters.area || {};
|
|
2057
|
+
return {
|
|
2058
|
+
price: {
|
|
2059
|
+
min: price.min != null ? formatGroupedInteger(price.min) : "",
|
|
2060
|
+
max: price.max != null ? formatGroupedInteger(price.max) : ""
|
|
2061
|
+
},
|
|
2062
|
+
property_area_total: {
|
|
2063
|
+
min: area.min != null ? String(area.min) : "",
|
|
2064
|
+
max: area.max != null ? String(area.max) : ""
|
|
2065
|
+
}
|
|
2066
|
+
};
|
|
2067
|
+
}
|
|
2068
|
+
function searchChromeModel(schema, pathFilters, locationNames) {
|
|
2069
|
+
const filters = visibleSearchFilters(schema);
|
|
2070
|
+
const toolbarIds = new Set(toolbarFilterIds(schema));
|
|
2071
|
+
return {
|
|
2072
|
+
headingTitle: searchResultsHeading(
|
|
2073
|
+
pathFilters,
|
|
2074
|
+
schema?.dictionary,
|
|
2075
|
+
locationNames
|
|
2076
|
+
),
|
|
2077
|
+
toolbarFilters: filters.filter((filter) => toolbarIds.has(filter.id)),
|
|
2078
|
+
extraFilters: filters.filter((filter) => !toolbarIds.has(filter.id)),
|
|
2079
|
+
sortOptions: searchSortOptions(schema?.sorts)
|
|
2080
|
+
};
|
|
2081
|
+
}
|
|
2049
2082
|
|
|
2050
2083
|
// src/listing-detail.ts
|
|
2051
2084
|
var LISTING_DESCRIPTION_CLAMP = 280;
|
|
@@ -2336,20 +2369,17 @@ var STUDIO_SDK_CONTRACT = {
|
|
|
2336
2369
|
package: STUDIO_SDK_PACKAGE,
|
|
2337
2370
|
/**
|
|
2338
2371
|
* Exact pin for generated Studio sites. Must match a tarball already on
|
|
2339
|
-
* npm — v0 installs this version. After
|
|
2340
|
-
*
|
|
2341
|
-
* into
|
|
2372
|
+
* npm — v0 installs this version. After a later changeset publishes, bump
|
|
2373
|
+
* this and move that release's names from `optionalReactExports` /
|
|
2374
|
+
* `unpublishedSearchExports` into the prompt-safe lists. Do not bump here
|
|
2375
|
+
* until that tarball is on npm. Headless SearchPage already shipped in
|
|
2376
|
+
* 0.4.12 (`visibleSearchFilters` / `toolbarFilterIds` are on that pin).
|
|
2342
2377
|
*/
|
|
2343
2378
|
minNpmVersion: "0.4.12",
|
|
2344
|
-
/** First release where ListingCard and ResultsSkeleton inject
|
|
2379
|
+
/** First release where ListingCard and ResultsSkeleton inject card CSS. */
|
|
2345
2380
|
selfInjectSince: "0.4.2",
|
|
2346
2381
|
chromeStrategy: "self-inject",
|
|
2347
|
-
reactExports: [
|
|
2348
|
-
"SearchPage",
|
|
2349
|
-
"ListingCard",
|
|
2350
|
-
"usePublicSearch",
|
|
2351
|
-
"ResultsSkeleton"
|
|
2352
|
-
],
|
|
2382
|
+
reactExports: ["usePublicSearch", "ListingCard", "ResultsSkeleton"],
|
|
2353
2383
|
/**
|
|
2354
2384
|
* Names that exist in git / the unpublished patch. Completeness treats an
|
|
2355
2385
|
* import as `sdk-export-mismatch` when the generated pin is older than
|
|
@@ -2358,10 +2388,22 @@ var STUDIO_SDK_CONTRACT = {
|
|
|
2358
2388
|
* throws FatalRendererError.
|
|
2359
2389
|
*/
|
|
2360
2390
|
optionalReactExports: {
|
|
2361
|
-
SearchPageFallback: "0.4.1",
|
|
2362
2391
|
SearchChromeStyles: "0.4.1",
|
|
2363
2392
|
ListingDetailFields: "0.4.13"
|
|
2364
2393
|
},
|
|
2394
|
+
/**
|
|
2395
|
+
* Former `/react` chrome. Completeness flags imports as mismatch (not in
|
|
2396
|
+
* `reactExports`). Prompts must not mention these names at all — v0 copies
|
|
2397
|
+
* identifiers even inside “never import”.
|
|
2398
|
+
*/
|
|
2399
|
+
retiredReactExports: [
|
|
2400
|
+
"SearchPage",
|
|
2401
|
+
"SearchQueryForm",
|
|
2402
|
+
"SearchSortSelect",
|
|
2403
|
+
"FilterPanel",
|
|
2404
|
+
"SearchPagination",
|
|
2405
|
+
"SearchPageFallback"
|
|
2406
|
+
],
|
|
2365
2407
|
forbiddenImports: ["@garagem-ai/site-sdk/react/search.css"],
|
|
2366
2408
|
leadStrategy: "visit-default",
|
|
2367
2409
|
leadExports: [
|
|
@@ -2375,7 +2417,31 @@ var STUDIO_SDK_CONTRACT = {
|
|
|
2375
2417
|
"STUDIO_DEFAULT_VISIT_SCHEDULE"
|
|
2376
2418
|
],
|
|
2377
2419
|
listingDetailExports: ["listingDetailModel", "getSimilarListings"],
|
|
2378
|
-
amenityExports: ["listingAmenityGroups"]
|
|
2420
|
+
amenityExports: ["listingAmenityGroups"],
|
|
2421
|
+
/**
|
|
2422
|
+
* Names already on the pinned npm tarball (`minNpmVersion` / 0.4.12) —
|
|
2423
|
+
* safe for Studio prompts and completeness. Includes
|
|
2424
|
+
* `visibleSearchFilters` + `toolbarFilterIds` (shipped in 0.4.12). Do not
|
|
2425
|
+
* confuse with `unpublishedSearchExports` (`searchChromeModel`, …).
|
|
2426
|
+
*/
|
|
2427
|
+
searchExports: [
|
|
2428
|
+
"searchResultsHeading",
|
|
2429
|
+
"searchSortOptions",
|
|
2430
|
+
"visibleSearchFilters",
|
|
2431
|
+
"toolbarFilterIds",
|
|
2432
|
+
"paginationPages",
|
|
2433
|
+
"hrefWithExplicitPage"
|
|
2434
|
+
],
|
|
2435
|
+
/**
|
|
2436
|
+
* Main-package helpers in git / newer tarballs but not required on
|
|
2437
|
+
* `minNpmVersion`. Prompts must not mention these until the pin bumps and
|
|
2438
|
+
* they move into `searchExports`. Independent of the 0.4.12 filter helpers
|
|
2439
|
+
* already listed in `searchExports`.
|
|
2440
|
+
*/
|
|
2441
|
+
unpublishedSearchExports: [
|
|
2442
|
+
"searchChromeModel",
|
|
2443
|
+
"rangeDraftFromPath"
|
|
2444
|
+
]
|
|
2379
2445
|
};
|
|
2380
2446
|
var STUDIO_SITE_LAYOUT = {
|
|
2381
2447
|
maxWidthRem: "80rem",
|
|
@@ -2404,7 +2470,7 @@ ${studioSiteWidthCss()}
|
|
|
2404
2470
|
Every page section is two layers: (1) surface \u2014 \`section\` / header / footer \`${STUDIO_SITE_LAYOUT.surfaceClassName}\`, background to the viewport edges, no max-width class and no horizontal padding; (2) wrapper \u2014 one child \`${STUDIO_SITE_LAYOUT.wrapperClassName}\`. Header and footer use that same inner wrapper. Components fill the wrapper (\`w-full\`). Never nest a second max-width container with extra horizontal padding. ${studioSearchLandmarkInstruction()} Do not use \`ml-auto\` on the content wrapper. To make the site narrower or wider, change ONLY \`--site-max-width\` in \`app/globals.css\` (allowed: ${scale}; default ${STUDIO_SITE_LAYOUT.maxWidthRem}). Do not edit wrapper class names or horizontal padding. Full-bleed image surfaces (home hero, listing gallery) stay flush with the header \u2014 do not add vertical padding there.`;
|
|
2405
2471
|
}
|
|
2406
2472
|
function studioSearchLandmarkInstruction() {
|
|
2407
|
-
return `Search at \`/imoveis\` (hard rule). The page landmark is \`<main className="${STUDIO_SITE_LAYOUT.searchMainClassName}">\` with one child \`${STUDIO_SITE_LAYOUT.wrapperClassName}\`.
|
|
2473
|
+
return `Search at \`/imoveis\` (hard rule). The page landmark is \`<main className="${STUDIO_SITE_LAYOUT.searchMainClassName}">\` with one child \`${STUDIO_SITE_LAYOUT.wrapperClassName}\`. Wire the catalog with \`usePublicSearch\` from \`${STUDIO_SDK_PACKAGE}/react\` inside \`<Suspense fallback={<ResultsSkeleton />}>\`. Do not wrap the search UI in \`<section>\` or a second max-width. The page owns the SEO heading as \`<div data-slot="search-heading">\`: count \`<span data-slot="search-heading-count">\` FIRST, then \`<h1 data-slot="search-heading-title">\` \u2014 never put the count inside the H1 and never put the h1 first. \`pt-4 pb-12\` is the default on that search \`<main>\` \u2014 change those values if the design needs it. Flush search (glued to the header) is allowed only with \`${STUDIO_SITE_LAYOUT.searchFlushMarker}\` on that \`<main>\`. Never add that vertical padding to home heroes or listing galleries.`;
|
|
2408
2474
|
}
|
|
2409
2475
|
var REACT_SDK_NAMED_IMPORT_RE = /(?:^|[\n;])\s*import\s+(?!type\b)(?:type\s+)?\{([^}]+)\}\s+from\s+['"]@garagem-ai\/site-sdk\/react['"]/g;
|
|
2410
2476
|
var SHOWCASE_LEADS_POST_URL_RE = /\/api\/sites\/[^\s"']*\/leads(?!\/ui)/;
|
|
@@ -2476,17 +2542,31 @@ function studioListingDetailInstruction() {
|
|
|
2476
2542
|
function studioAmenityInstruction() {
|
|
2477
2543
|
return `Listing amenities: Portuguese labels from \`listingAmenityGroups(listing)\` (optional dictionary from \`getSearchUi()\`). Each group is \`{ title, labels: string[] }\` \u2014 render \`group.labels.map((label) => \u2026)\` and hide a group when \`group.labels.length === 0\`. Titles: \`Comodidades\` / \`Comodidades do condom\xEDnio\`. Never print amenity ids, never invent a local label map, and never title a section "Comodidades da unidade".`;
|
|
2478
2544
|
}
|
|
2545
|
+
function studioSearchInstruction() {
|
|
2546
|
+
const reactNames = STUDIO_SDK_CONTRACT.reactExports.join(", ");
|
|
2547
|
+
const libNames = STUDIO_SDK_CONTRACT.searchExports.join(", ");
|
|
2548
|
+
return `Search: import ${reactNames} from \`${STUDIO_SDK_PACKAGE}/react\`. From \`${STUDIO_SDK_PACKAGE}\` import ${libNames}. Call \`const search = usePublicSearch({ siteId, baseUrl: GARAGEM_API_BASE })\` in a client component inside \`<Suspense>\` (\`useSearchParams\`). Compose the page UI in the app \u2014 do not paste a canonical search TSX. Required chrome (design is free; omit none): query (\`qDraft\` / \`setQDraft\` / form \`preventDefault\` + \`submitQuery\`), heading (count span FIRST then h1 from \`searchResultsHeading(search.pathFilters, search.schema?.dictionary, search.locationNames)\` \u2014 never \`searchResultsHeading({})\`), toolbar (\`toolbarFilterIds\` + \`applyFilter\`; range \u201CAtualizar\u201D on that toolbar item only) vs sheet (\`visibleSearchFilters\` extras, \`stageFilter\`, one footer \`applyStaged\`), sort (\`searchSortOptions\` + \`setSort\`), grid (\`listings.map\` + \`ListingCard\`; \`ResultsSkeleton\` is only the Suspense fallback), pagination (\`paginationPages\` + \`hrefWithExplicitPage\`). Never interpolate \`schema\`, \`pathFilters\`, or a filter object as a React child. \`queryListings\` key is \`params\`. The URL is the document. Empty copy: ${JSON.stringify(SEARCH_EMPTY_COPY)}`;
|
|
2549
|
+
}
|
|
2479
2550
|
function studioChromeInstruction() {
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
return `Search chrome CSS is injected by ${injectors} (JS \`<style>\` tag). Never \`import "@garagem-ai/site-sdk/react/search.css"\` \u2014 v0 preview cannot load npm CSS. Do not copy SDK card/toolbar layout into the app. Theme via CSS variables in \`app/globals.css\` (\`SEARCH_CSS_RECIPE\` / \`--garagem-*\`), \`classNames\`, and \`data-slot\`.`;
|
|
2551
|
+
return `ListingCard and ResultsSkeleton inject card/skeleton CSS (JS \`<style>\` tag). Never \`import "${STUDIO_SDK_CONTRACT.forbiddenImports[0]}"\` \u2014 v0 preview cannot load npm CSS. Do not copy SDK card layout into the app. Theme cards via CSS variables in \`app/globals.css\` (\`SEARCH_CSS_RECIPE\` / \`--garagem-*\`). Search chrome (query, toolbar, sort, filters, pagination) is app-owned \u2014 theme with the site tokens, not an SDK stylesheet.`;
|
|
2552
|
+
}
|
|
2553
|
+
function mentionsExportName(text, name) {
|
|
2554
|
+
return new RegExp(`\\b${name}\\b`).test(text);
|
|
2485
2555
|
}
|
|
2486
2556
|
function studioCodegenContractViolations(text) {
|
|
2487
2557
|
const violations = [];
|
|
2488
2558
|
for (const name of Object.keys(STUDIO_SDK_CONTRACT.optionalReactExports)) {
|
|
2489
|
-
if (text
|
|
2559
|
+
if (mentionsExportName(text, name)) violations.push(name);
|
|
2560
|
+
}
|
|
2561
|
+
for (const name of STUDIO_SDK_CONTRACT.retiredReactExports) {
|
|
2562
|
+
if (mentionsExportName(text, name) && !violations.includes(name)) {
|
|
2563
|
+
violations.push(name);
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
for (const name of STUDIO_SDK_CONTRACT.unpublishedSearchExports) {
|
|
2567
|
+
if (mentionsExportName(text, name) && !violations.includes(name)) {
|
|
2568
|
+
violations.push(name);
|
|
2569
|
+
}
|
|
2490
2570
|
}
|
|
2491
2571
|
const pin = STUDIO_SDK_CONTRACT.minNpmVersion;
|
|
2492
2572
|
const available = reactExportsAvailableAt(pin);
|
|
@@ -2669,6 +2749,7 @@ function createGaragemClient(options = {}) {
|
|
|
2669
2749
|
LeadSubmitError,
|
|
2670
2750
|
SEARCH_CSS_RECIPE,
|
|
2671
2751
|
SEARCH_CSS_VARS,
|
|
2752
|
+
SEARCH_EMPTY_COPY,
|
|
2672
2753
|
SEARCH_SORT_RELEVANCE,
|
|
2673
2754
|
STUDIO_DEFAULT_VISIT_SCHEDULE,
|
|
2674
2755
|
STUDIO_SDK_CONTRACT,
|
|
@@ -2739,9 +2820,11 @@ function createGaragemClient(options = {}) {
|
|
|
2739
2820
|
pathLocationToFilterInput,
|
|
2740
2821
|
publicSearchHref,
|
|
2741
2822
|
queryListings,
|
|
2823
|
+
rangeDraftFromPath,
|
|
2742
2824
|
readPublicSearch,
|
|
2743
2825
|
reduceAppliedSearchQuery,
|
|
2744
2826
|
resolvePublicSiteId,
|
|
2827
|
+
searchChromeModel,
|
|
2745
2828
|
searchHrefUsesLegacyFilterQuery,
|
|
2746
2829
|
searchListings,
|
|
2747
2830
|
searchResultsHeading,
|
|
@@ -2756,6 +2839,7 @@ function createGaragemClient(options = {}) {
|
|
|
2756
2839
|
studioLeadInstruction,
|
|
2757
2840
|
studioListingDetailInstruction,
|
|
2758
2841
|
studioSdkPinInstruction,
|
|
2842
|
+
studioSearchInstruction,
|
|
2759
2843
|
studioSearchLandmarkInstruction,
|
|
2760
2844
|
studioSiteWidthCss,
|
|
2761
2845
|
submitContactLead,
|