@garagem-ai/site-sdk 0.5.0 → 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/dist/index.mjs CHANGED
@@ -2237,9 +2237,11 @@ var STUDIO_SDK_CONTRACT = {
2237
2237
  package: STUDIO_SDK_PACKAGE,
2238
2238
  /**
2239
2239
  * Exact pin for generated Studio sites. Must match a tarball already on
2240
- * npm — v0 installs this version. After the 0.4.13 changeset publishes,
2241
- * bump this and move that release's names from `optionalReactExports`
2242
- * into `reactExports`. Do not bump here until a headless tarball is on npm.
2240
+ * npm — v0 installs this version. After a later changeset publishes, bump
2241
+ * this and move that release's names from `optionalReactExports` /
2242
+ * `unpublishedSearchExports` into the prompt-safe lists. Do not bump here
2243
+ * until that tarball is on npm. Headless SearchPage already shipped in
2244
+ * 0.4.12 (`visibleSearchFilters` / `toolbarFilterIds` are on that pin).
2243
2245
  */
2244
2246
  minNpmVersion: "0.4.12",
2245
2247
  /** First release where ListingCard and ResultsSkeleton inject card CSS. */
@@ -2284,16 +2286,25 @@ var STUDIO_SDK_CONTRACT = {
2284
2286
  ],
2285
2287
  listingDetailExports: ["listingDetailModel", "getSimilarListings"],
2286
2288
  amenityExports: ["listingAmenityGroups"],
2287
- /** Names on the pinned tarball — safe to put in Studio prompts. */
2289
+ /**
2290
+ * Names already on the pinned npm tarball (`minNpmVersion` / 0.4.12) —
2291
+ * safe for Studio prompts and completeness. Includes
2292
+ * `visibleSearchFilters` + `toolbarFilterIds` (shipped in 0.4.12). Do not
2293
+ * confuse with `unpublishedSearchExports` (`searchChromeModel`, …).
2294
+ */
2288
2295
  searchExports: [
2289
2296
  "searchResultsHeading",
2290
2297
  "searchSortOptions",
2298
+ "visibleSearchFilters",
2299
+ "toolbarFilterIds",
2291
2300
  "paginationPages",
2292
2301
  "hrefWithExplicitPage"
2293
2302
  ],
2294
2303
  /**
2295
- * Main-package helpers in git but not on `minNpmVersion`. Prompts must
2296
- * not mention these until the pin bumps and they move into `searchExports`.
2304
+ * Main-package helpers in git / newer tarballs but not required on
2305
+ * `minNpmVersion`. Prompts must not mention these until the pin bumps and
2306
+ * they move into `searchExports`. Independent of the 0.4.12 filter helpers
2307
+ * already listed in `searchExports`.
2297
2308
  */
2298
2309
  unpublishedSearchExports: [
2299
2310
  "searchChromeModel",
@@ -2327,7 +2338,7 @@ ${studioSiteWidthCss()}
2327
2338
  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.`;
2328
2339
  }
2329
2340
  function studioSearchLandmarkInstruction() {
2330
- 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.`;
2341
+ 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.`;
2331
2342
  }
2332
2343
  var REACT_SDK_NAMED_IMPORT_RE = /(?:^|[\n;])\s*import\s+(?!type\b)(?:type\s+)?\{([^}]+)\}\s+from\s+['"]@garagem-ai\/site-sdk\/react['"]/g;
2333
2344
  var SHOWCASE_LEADS_POST_URL_RE = /\/api\/sites\/[^\s"']*\/leads(?!\/ui)/;
@@ -2402,7 +2413,7 @@ function studioAmenityInstruction() {
2402
2413
  function studioSearchInstruction() {
2403
2414
  const reactNames = STUDIO_SDK_CONTRACT.reactExports.join(", ");
2404
2415
  const libNames = STUDIO_SDK_CONTRACT.searchExports.join(", ");
2405
- 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)}`;
2416
+ 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)}`;
2406
2417
  }
2407
2418
  function studioChromeInstruction() {
2408
2419
  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.`;