@garagem-ai/site-sdk 0.4.13 → 0.5.0
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 +20 -32
- package/dist/index.d.mts +20 -17
- package/dist/index.d.ts +20 -17
- package/dist/index.js +91 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +87 -18
- 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 +57 -20
- 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,45 @@ 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
286
|
`listingAmenityGroups`. The search H1 is SEO
|
|
299
287
|
stable: hit count is a sibling `<span>`, not inside `<h1>`. Presentation
|
|
300
288
|
tokens stay framework-free on the main entry so other adapters can reuse
|
|
301
289
|
them.
|
|
302
290
|
|
|
303
|
-
Hand-written Next apps that prefer a layout tag
|
|
304
|
-
|
|
305
|
-
|
|
291
|
+
Hand-written Next apps that prefer a layout tag can import
|
|
292
|
+
`SearchChromeStyles` after it ships on npm; until then it is not part of
|
|
293
|
+
the Studio pin.
|
|
306
294
|
|
|
307
295
|
## What's NOT in this release
|
|
308
296
|
|
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,16 +343,6 @@ 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";
|
|
@@ -360,13 +350,13 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
360
350
|
* Exact pin for generated Studio sites. Must match a tarball already on
|
|
361
351
|
* npm — v0 installs this version. After the 0.4.13 changeset publishes,
|
|
362
352
|
* bump this and move that release's names from `optionalReactExports`
|
|
363
|
-
* into `reactExports`.
|
|
353
|
+
* into `reactExports`. Do not bump here until a headless tarball is on npm.
|
|
364
354
|
*/
|
|
365
355
|
readonly minNpmVersion: "0.4.12";
|
|
366
|
-
/** First release where ListingCard and ResultsSkeleton inject
|
|
356
|
+
/** First release where ListingCard and ResultsSkeleton inject card CSS. */
|
|
367
357
|
readonly selfInjectSince: "0.4.2";
|
|
368
358
|
readonly chromeStrategy: "self-inject";
|
|
369
|
-
readonly reactExports: readonly ["
|
|
359
|
+
readonly reactExports: readonly ["usePublicSearch", "ListingCard", "ResultsSkeleton"];
|
|
370
360
|
/**
|
|
371
361
|
* Names that exist in git / the unpublished patch. Completeness treats an
|
|
372
362
|
* import as `sdk-export-mismatch` when the generated pin is older than
|
|
@@ -375,15 +365,27 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
375
365
|
* throws FatalRendererError.
|
|
376
366
|
*/
|
|
377
367
|
readonly optionalReactExports: {
|
|
378
|
-
readonly SearchPageFallback: "0.4.1";
|
|
379
368
|
readonly SearchChromeStyles: "0.4.1";
|
|
380
369
|
readonly ListingDetailFields: "0.4.13";
|
|
381
370
|
};
|
|
371
|
+
/**
|
|
372
|
+
* Former `/react` chrome. Completeness flags imports as mismatch (not in
|
|
373
|
+
* `reactExports`). Prompts must not mention these names at all — v0 copies
|
|
374
|
+
* identifiers even inside “never import”.
|
|
375
|
+
*/
|
|
376
|
+
readonly retiredReactExports: readonly ["SearchPage", "SearchQueryForm", "SearchSortSelect", "FilterPanel", "SearchPagination", "SearchPageFallback"];
|
|
382
377
|
readonly forbiddenImports: readonly ["@garagem-ai/site-sdk/react/search.css"];
|
|
383
378
|
readonly leadStrategy: "visit-default";
|
|
384
379
|
readonly leadExports: readonly ["getLeadUi", "submitVisitLead", "submitContactLead", "slotsForDate", "expandVisitSchedule", "expandVisitTimeSlots", "isVisitSlotAllowed", "STUDIO_DEFAULT_VISIT_SCHEDULE"];
|
|
385
380
|
readonly listingDetailExports: readonly ["listingDetailModel", "getSimilarListings"];
|
|
386
381
|
readonly amenityExports: readonly ["listingAmenityGroups"];
|
|
382
|
+
/** Names on the pinned tarball — safe to put in Studio prompts. */
|
|
383
|
+
readonly searchExports: readonly ["searchResultsHeading", "searchSortOptions", "paginationPages", "hrefWithExplicitPage"];
|
|
384
|
+
/**
|
|
385
|
+
* Main-package helpers in git but not on `minNpmVersion`. Prompts must
|
|
386
|
+
* not mention these until the pin bumps and they move into `searchExports`.
|
|
387
|
+
*/
|
|
388
|
+
readonly unpublishedSearchExports: readonly ["searchChromeModel", "rangeDraftFromPath"];
|
|
387
389
|
};
|
|
388
390
|
type StudioSdkContract = typeof STUDIO_SDK_CONTRACT;
|
|
389
391
|
/**
|
|
@@ -414,6 +416,7 @@ declare function studioSdkPinInstruction(): string;
|
|
|
414
416
|
declare function studioLeadInstruction(): string;
|
|
415
417
|
declare function studioListingDetailInstruction(): string;
|
|
416
418
|
declare function studioAmenityInstruction(): string;
|
|
419
|
+
declare function studioSearchInstruction(): string;
|
|
417
420
|
declare function studioChromeInstruction(): string;
|
|
418
421
|
/**
|
|
419
422
|
* Tokens that must not appear in Studio codegen (prompts, recipes, repair).
|
|
@@ -529,4 +532,4 @@ interface GaragemClient {
|
|
|
529
532
|
*/
|
|
530
533
|
declare function createGaragemClient(options?: CreateGaragemClientOptions): GaragemClient;
|
|
531
534
|
|
|
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 };
|
|
535
|
+
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,16 +343,6 @@ 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";
|
|
@@ -360,13 +350,13 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
360
350
|
* Exact pin for generated Studio sites. Must match a tarball already on
|
|
361
351
|
* npm — v0 installs this version. After the 0.4.13 changeset publishes,
|
|
362
352
|
* bump this and move that release's names from `optionalReactExports`
|
|
363
|
-
* into `reactExports`.
|
|
353
|
+
* into `reactExports`. Do not bump here until a headless tarball is on npm.
|
|
364
354
|
*/
|
|
365
355
|
readonly minNpmVersion: "0.4.12";
|
|
366
|
-
/** First release where ListingCard and ResultsSkeleton inject
|
|
356
|
+
/** First release where ListingCard and ResultsSkeleton inject card CSS. */
|
|
367
357
|
readonly selfInjectSince: "0.4.2";
|
|
368
358
|
readonly chromeStrategy: "self-inject";
|
|
369
|
-
readonly reactExports: readonly ["
|
|
359
|
+
readonly reactExports: readonly ["usePublicSearch", "ListingCard", "ResultsSkeleton"];
|
|
370
360
|
/**
|
|
371
361
|
* Names that exist in git / the unpublished patch. Completeness treats an
|
|
372
362
|
* import as `sdk-export-mismatch` when the generated pin is older than
|
|
@@ -375,15 +365,27 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
375
365
|
* throws FatalRendererError.
|
|
376
366
|
*/
|
|
377
367
|
readonly optionalReactExports: {
|
|
378
|
-
readonly SearchPageFallback: "0.4.1";
|
|
379
368
|
readonly SearchChromeStyles: "0.4.1";
|
|
380
369
|
readonly ListingDetailFields: "0.4.13";
|
|
381
370
|
};
|
|
371
|
+
/**
|
|
372
|
+
* Former `/react` chrome. Completeness flags imports as mismatch (not in
|
|
373
|
+
* `reactExports`). Prompts must not mention these names at all — v0 copies
|
|
374
|
+
* identifiers even inside “never import”.
|
|
375
|
+
*/
|
|
376
|
+
readonly retiredReactExports: readonly ["SearchPage", "SearchQueryForm", "SearchSortSelect", "FilterPanel", "SearchPagination", "SearchPageFallback"];
|
|
382
377
|
readonly forbiddenImports: readonly ["@garagem-ai/site-sdk/react/search.css"];
|
|
383
378
|
readonly leadStrategy: "visit-default";
|
|
384
379
|
readonly leadExports: readonly ["getLeadUi", "submitVisitLead", "submitContactLead", "slotsForDate", "expandVisitSchedule", "expandVisitTimeSlots", "isVisitSlotAllowed", "STUDIO_DEFAULT_VISIT_SCHEDULE"];
|
|
385
380
|
readonly listingDetailExports: readonly ["listingDetailModel", "getSimilarListings"];
|
|
386
381
|
readonly amenityExports: readonly ["listingAmenityGroups"];
|
|
382
|
+
/** Names on the pinned tarball — safe to put in Studio prompts. */
|
|
383
|
+
readonly searchExports: readonly ["searchResultsHeading", "searchSortOptions", "paginationPages", "hrefWithExplicitPage"];
|
|
384
|
+
/**
|
|
385
|
+
* Main-package helpers in git but not on `minNpmVersion`. Prompts must
|
|
386
|
+
* not mention these until the pin bumps and they move into `searchExports`.
|
|
387
|
+
*/
|
|
388
|
+
readonly unpublishedSearchExports: readonly ["searchChromeModel", "rangeDraftFromPath"];
|
|
387
389
|
};
|
|
388
390
|
type StudioSdkContract = typeof STUDIO_SDK_CONTRACT;
|
|
389
391
|
/**
|
|
@@ -414,6 +416,7 @@ declare function studioSdkPinInstruction(): string;
|
|
|
414
416
|
declare function studioLeadInstruction(): string;
|
|
415
417
|
declare function studioListingDetailInstruction(): string;
|
|
416
418
|
declare function studioAmenityInstruction(): string;
|
|
419
|
+
declare function studioSearchInstruction(): string;
|
|
417
420
|
declare function studioChromeInstruction(): string;
|
|
418
421
|
/**
|
|
419
422
|
* Tokens that must not appear in Studio codegen (prompts, recipes, repair).
|
|
@@ -529,4 +532,4 @@ interface GaragemClient {
|
|
|
529
532
|
*/
|
|
530
533
|
declare function createGaragemClient(options?: CreateGaragemClientOptions): GaragemClient;
|
|
531
534
|
|
|
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 };
|
|
535
|
+
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;
|
|
@@ -2338,18 +2371,13 @@ var STUDIO_SDK_CONTRACT = {
|
|
|
2338
2371
|
* Exact pin for generated Studio sites. Must match a tarball already on
|
|
2339
2372
|
* npm — v0 installs this version. After the 0.4.13 changeset publishes,
|
|
2340
2373
|
* bump this and move that release's names from `optionalReactExports`
|
|
2341
|
-
* into `reactExports`.
|
|
2374
|
+
* into `reactExports`. Do not bump here until a headless tarball is on npm.
|
|
2342
2375
|
*/
|
|
2343
2376
|
minNpmVersion: "0.4.12",
|
|
2344
|
-
/** First release where ListingCard and ResultsSkeleton inject
|
|
2377
|
+
/** First release where ListingCard and ResultsSkeleton inject card CSS. */
|
|
2345
2378
|
selfInjectSince: "0.4.2",
|
|
2346
2379
|
chromeStrategy: "self-inject",
|
|
2347
|
-
reactExports: [
|
|
2348
|
-
"SearchPage",
|
|
2349
|
-
"ListingCard",
|
|
2350
|
-
"usePublicSearch",
|
|
2351
|
-
"ResultsSkeleton"
|
|
2352
|
-
],
|
|
2380
|
+
reactExports: ["usePublicSearch", "ListingCard", "ResultsSkeleton"],
|
|
2353
2381
|
/**
|
|
2354
2382
|
* Names that exist in git / the unpublished patch. Completeness treats an
|
|
2355
2383
|
* import as `sdk-export-mismatch` when the generated pin is older than
|
|
@@ -2358,10 +2386,22 @@ var STUDIO_SDK_CONTRACT = {
|
|
|
2358
2386
|
* throws FatalRendererError.
|
|
2359
2387
|
*/
|
|
2360
2388
|
optionalReactExports: {
|
|
2361
|
-
SearchPageFallback: "0.4.1",
|
|
2362
2389
|
SearchChromeStyles: "0.4.1",
|
|
2363
2390
|
ListingDetailFields: "0.4.13"
|
|
2364
2391
|
},
|
|
2392
|
+
/**
|
|
2393
|
+
* Former `/react` chrome. Completeness flags imports as mismatch (not in
|
|
2394
|
+
* `reactExports`). Prompts must not mention these names at all — v0 copies
|
|
2395
|
+
* identifiers even inside “never import”.
|
|
2396
|
+
*/
|
|
2397
|
+
retiredReactExports: [
|
|
2398
|
+
"SearchPage",
|
|
2399
|
+
"SearchQueryForm",
|
|
2400
|
+
"SearchSortSelect",
|
|
2401
|
+
"FilterPanel",
|
|
2402
|
+
"SearchPagination",
|
|
2403
|
+
"SearchPageFallback"
|
|
2404
|
+
],
|
|
2365
2405
|
forbiddenImports: ["@garagem-ai/site-sdk/react/search.css"],
|
|
2366
2406
|
leadStrategy: "visit-default",
|
|
2367
2407
|
leadExports: [
|
|
@@ -2375,7 +2415,22 @@ var STUDIO_SDK_CONTRACT = {
|
|
|
2375
2415
|
"STUDIO_DEFAULT_VISIT_SCHEDULE"
|
|
2376
2416
|
],
|
|
2377
2417
|
listingDetailExports: ["listingDetailModel", "getSimilarListings"],
|
|
2378
|
-
amenityExports: ["listingAmenityGroups"]
|
|
2418
|
+
amenityExports: ["listingAmenityGroups"],
|
|
2419
|
+
/** Names on the pinned tarball — safe to put in Studio prompts. */
|
|
2420
|
+
searchExports: [
|
|
2421
|
+
"searchResultsHeading",
|
|
2422
|
+
"searchSortOptions",
|
|
2423
|
+
"paginationPages",
|
|
2424
|
+
"hrefWithExplicitPage"
|
|
2425
|
+
],
|
|
2426
|
+
/**
|
|
2427
|
+
* Main-package helpers in git but not on `minNpmVersion`. Prompts must
|
|
2428
|
+
* not mention these until the pin bumps and they move into `searchExports`.
|
|
2429
|
+
*/
|
|
2430
|
+
unpublishedSearchExports: [
|
|
2431
|
+
"searchChromeModel",
|
|
2432
|
+
"rangeDraftFromPath"
|
|
2433
|
+
]
|
|
2379
2434
|
};
|
|
2380
2435
|
var STUDIO_SITE_LAYOUT = {
|
|
2381
2436
|
maxWidthRem: "80rem",
|
|
@@ -2404,7 +2459,7 @@ ${studioSiteWidthCss()}
|
|
|
2404
2459
|
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
2460
|
}
|
|
2406
2461
|
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}\`.
|
|
2462
|
+
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: count in a sibling \`<span data-slot="search-heading-count">\`, title in \`<h1 data-slot="search-heading-title">\` \u2014 never put the count inside the H1. \`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
2463
|
}
|
|
2409
2464
|
var REACT_SDK_NAMED_IMPORT_RE = /(?:^|[\n;])\s*import\s+(?!type\b)(?:type\s+)?\{([^}]+)\}\s+from\s+['"]@garagem-ai\/site-sdk\/react['"]/g;
|
|
2410
2465
|
var SHOWCASE_LEADS_POST_URL_RE = /\/api\/sites\/[^\s"']*\/leads(?!\/ui)/;
|
|
@@ -2474,19 +2529,33 @@ function studioListingDetailInstruction() {
|
|
|
2474
2529
|
return `Listing detail: import ${names} from \`${STUDIO_SDK_PACKAGE}\` and \`ListingCard\` from \`${STUDIO_SDK_PACKAGE}/react\`. Render \`listingDetailModel\` leaves: \`model.facts[].label\` / \`.text\`, \`model.values[].label\` / \`.text\`, \`model.location.label\` / \`model.location.mapsHref\`, breadcrumb \`.href\` (search prefixes of \`listing.path\`). \`model.description\` is the complete string \u2014 do not slice. Never interpolate \`model.location\`, \`model.facts\`, \`model.values\`, \`model.breadcrumb\`, or \`model.mediaOverlays\` as a React child. Video/tour: \`model.mediaOverlays\` as hash links (\`#video\` / \`#tour\`) and a fullscreen overlay that closes with browser back; omit when empty. Similar listings: \`getSimilarListings({ siteId, listingId, baseUrl })\` + \`ListingCard\`; hide the section when empty. Do not invent a local recommendation loop.`;
|
|
2475
2530
|
}
|
|
2476
2531
|
function studioAmenityInstruction() {
|
|
2477
|
-
return `Listing amenities: Portuguese labels from \`listingAmenityGroups(listing)\` (optional dictionary from \`getSearchUi()\`). Titles: \`Comodidades\` / \`Comodidades do condom\xEDnio\`. Never print amenity ids, never invent a local label map, and never title a section "Comodidades da unidade".`;
|
|
2532
|
+
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".`;
|
|
2533
|
+
}
|
|
2534
|
+
function studioSearchInstruction() {
|
|
2535
|
+
const reactNames = STUDIO_SDK_CONTRACT.reactExports.join(", ");
|
|
2536
|
+
const libNames = STUDIO_SDK_CONTRACT.searchExports.join(", ");
|
|
2537
|
+
return `Search: import ${reactNames} from \`${STUDIO_SDK_PACKAGE}/react\`. From \`${STUDIO_SDK_PACKAGE}\` import ${libNames}. Call \`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. Title from \`searchResultsHeading\`; sort \`.id\` / \`.label\` from \`searchSortOptions\`. 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)}`;
|
|
2478
2538
|
}
|
|
2479
2539
|
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\`.`;
|
|
2540
|
+
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.`;
|
|
2541
|
+
}
|
|
2542
|
+
function mentionsExportName(text, name) {
|
|
2543
|
+
return new RegExp(`\\b${name}\\b`).test(text);
|
|
2485
2544
|
}
|
|
2486
2545
|
function studioCodegenContractViolations(text) {
|
|
2487
2546
|
const violations = [];
|
|
2488
2547
|
for (const name of Object.keys(STUDIO_SDK_CONTRACT.optionalReactExports)) {
|
|
2489
|
-
if (text
|
|
2548
|
+
if (mentionsExportName(text, name)) violations.push(name);
|
|
2549
|
+
}
|
|
2550
|
+
for (const name of STUDIO_SDK_CONTRACT.retiredReactExports) {
|
|
2551
|
+
if (mentionsExportName(text, name) && !violations.includes(name)) {
|
|
2552
|
+
violations.push(name);
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2555
|
+
for (const name of STUDIO_SDK_CONTRACT.unpublishedSearchExports) {
|
|
2556
|
+
if (mentionsExportName(text, name) && !violations.includes(name)) {
|
|
2557
|
+
violations.push(name);
|
|
2558
|
+
}
|
|
2490
2559
|
}
|
|
2491
2560
|
const pin = STUDIO_SDK_CONTRACT.minNpmVersion;
|
|
2492
2561
|
const available = reactExportsAvailableAt(pin);
|
|
@@ -2669,6 +2738,7 @@ function createGaragemClient(options = {}) {
|
|
|
2669
2738
|
LeadSubmitError,
|
|
2670
2739
|
SEARCH_CSS_RECIPE,
|
|
2671
2740
|
SEARCH_CSS_VARS,
|
|
2741
|
+
SEARCH_EMPTY_COPY,
|
|
2672
2742
|
SEARCH_SORT_RELEVANCE,
|
|
2673
2743
|
STUDIO_DEFAULT_VISIT_SCHEDULE,
|
|
2674
2744
|
STUDIO_SDK_CONTRACT,
|
|
@@ -2739,9 +2809,11 @@ function createGaragemClient(options = {}) {
|
|
|
2739
2809
|
pathLocationToFilterInput,
|
|
2740
2810
|
publicSearchHref,
|
|
2741
2811
|
queryListings,
|
|
2812
|
+
rangeDraftFromPath,
|
|
2742
2813
|
readPublicSearch,
|
|
2743
2814
|
reduceAppliedSearchQuery,
|
|
2744
2815
|
resolvePublicSiteId,
|
|
2816
|
+
searchChromeModel,
|
|
2745
2817
|
searchHrefUsesLegacyFilterQuery,
|
|
2746
2818
|
searchListings,
|
|
2747
2819
|
searchResultsHeading,
|
|
@@ -2756,6 +2828,7 @@ function createGaragemClient(options = {}) {
|
|
|
2756
2828
|
studioLeadInstruction,
|
|
2757
2829
|
studioListingDetailInstruction,
|
|
2758
2830
|
studioSdkPinInstruction,
|
|
2831
|
+
studioSearchInstruction,
|
|
2759
2832
|
studioSearchLandmarkInstruction,
|
|
2760
2833
|
studioSiteWidthCss,
|
|
2761
2834
|
submitContactLead,
|