@garagem-ai/site-sdk 0.4.11 → 0.4.12

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 CHANGED
@@ -69,7 +69,7 @@ raw escape hatch when you need full control.
69
69
  | `submitVisitLead({ siteId, listingId, … })` | POST a visit lead (`listing.id` UUID; civil `visitDate` or `Date`/ISO instant normalized in the schedule timezone) |
70
70
  | `submitContactLead({ siteId, listingId, … })` | POST a contact lead (no date/time) |
71
71
  | `slotsForDate` / `normalizeVisitDate` / `expandVisitSchedule` | Pure schedule helpers (`America/Sao_Paulo`, default Mon–Fri 06:00–22:00) |
72
- | `listingDetailModel(listing)` | Listing-detail blocks: breadcrumb, values (price / condo / IPTU), facts (skip empty zeros), location + Maps href, description clamp, video/tour overlays. |
72
+ | `listingDetailModel(listing)` | Listing-detail blocks: breadcrumb, values (price / condo / IPTU), facts (skip empty zeros), location + Maps href, `description` string + toggle label, video/tour overlays. |
73
73
  | `listingAmenityGroups(listing, dictionary?)` | Unit / building amenity labels (`Comodidades`, `Comodidades do condomínio`). Reads `propertyFeatures` + `buildingAmenities` (works when `building` is null). Tenant `getSearchUi().dictionary` first, then the SDK fallback; unlabeled ids are dropped. |
74
74
  | `resolvePublicSiteId({ host?, fallback? })` | Preview uses `fallback` (`GARAGEM_SITE_ID`); live hosts resolve via `getSite({ domain })` |
75
75
 
package/dist/index.d.mts CHANGED
@@ -382,7 +382,10 @@ declare function listingDetailModel(listing: Pick<ListingDetail, "id" | "listing
382
382
  values: ListingValue[];
383
383
  facts: ListingFact[];
384
384
  location: ListingLocationBlock | null;
385
- description: ListingDescriptionPreview | null;
385
+ /** Clamped (or full) copy — a string so JSX `{model.description}` is safe. */
386
+ description: string | null;
387
+ descriptionTruncated: boolean;
388
+ descriptionToggleLabel: string | null;
386
389
  mediaOverlays: ListingMediaOverlay[];
387
390
  };
388
391
 
@@ -479,11 +482,10 @@ declare const STUDIO_SDK_CONTRACT: {
479
482
  /**
480
483
  * Exact pin for generated Studio sites. Must be ≥ `selfInjectSince` so
481
484
  * prompts that skip the layout chrome tag match the tarball v0 installs.
482
- * 0.4.9 adds listingDetailModel (values, facts, location, breadcrumb,
483
- * description clamp, video/tour), getSimilarListings, and
484
- * listingAmenityGroups so listing detail never prints amenity ids.
485
+ * 0.4.12 flattens listingDetailModel.description to a string (plus
486
+ * descriptionToggleLabel) so JSX cannot render the clamp object.
485
487
  */
486
- readonly minNpmVersion: "0.4.9";
488
+ readonly minNpmVersion: "0.4.12";
487
489
  /** First release where ListingCard and ResultsSkeleton inject the sheet. */
488
490
  readonly selfInjectSince: "0.4.2";
489
491
  readonly chromeStrategy: "self-inject";
package/dist/index.d.ts CHANGED
@@ -382,7 +382,10 @@ declare function listingDetailModel(listing: Pick<ListingDetail, "id" | "listing
382
382
  values: ListingValue[];
383
383
  facts: ListingFact[];
384
384
  location: ListingLocationBlock | null;
385
- description: ListingDescriptionPreview | null;
385
+ /** Clamped (or full) copy — a string so JSX `{model.description}` is safe. */
386
+ description: string | null;
387
+ descriptionTruncated: boolean;
388
+ descriptionToggleLabel: string | null;
386
389
  mediaOverlays: ListingMediaOverlay[];
387
390
  };
388
391
 
@@ -479,11 +482,10 @@ declare const STUDIO_SDK_CONTRACT: {
479
482
  /**
480
483
  * Exact pin for generated Studio sites. Must be ≥ `selfInjectSince` so
481
484
  * prompts that skip the layout chrome tag match the tarball v0 installs.
482
- * 0.4.9 adds listingDetailModel (values, facts, location, breadcrumb,
483
- * description clamp, video/tour), getSimilarListings, and
484
- * listingAmenityGroups so listing detail never prints amenity ids.
485
+ * 0.4.12 flattens listingDetailModel.description to a string (plus
486
+ * descriptionToggleLabel) so JSX cannot render the clamp object.
485
487
  */
486
- readonly minNpmVersion: "0.4.9";
488
+ readonly minNpmVersion: "0.4.12";
487
489
  /** First release where ListingCard and ResultsSkeleton inject the sheet. */
488
490
  readonly selfInjectSince: "0.4.2";
489
491
  readonly chromeStrategy: "self-inject";
package/dist/index.js CHANGED
@@ -2288,15 +2288,19 @@ function listingMediaOverlays(listing) {
2288
2288
  return overlays;
2289
2289
  }
2290
2290
  function listingDetailModel(listing, options) {
2291
+ const descriptionPreview = listingDescriptionPreview(
2292
+ listing.description,
2293
+ options?.descriptionExpanded === true
2294
+ );
2291
2295
  return {
2292
2296
  breadcrumb: listingBreadcrumb(listing),
2293
2297
  values: listingValues(listing),
2294
2298
  facts: listingFacts(listing),
2295
2299
  location: listingLocationBlock(listing),
2296
- description: listingDescriptionPreview(
2297
- listing.description,
2298
- options?.descriptionExpanded === true
2299
- ),
2300
+ /** Clamped (or full) copy — a string so JSX `{model.description}` is safe. */
2301
+ description: descriptionPreview?.text ?? null,
2302
+ descriptionTruncated: descriptionPreview?.truncated === true,
2303
+ descriptionToggleLabel: descriptionPreview?.toggleLabel ?? null,
2300
2304
  mediaOverlays: listingMediaOverlays(listing)
2301
2305
  };
2302
2306
  }
@@ -2308,11 +2312,10 @@ var STUDIO_SDK_CONTRACT = {
2308
2312
  /**
2309
2313
  * Exact pin for generated Studio sites. Must be ≥ `selfInjectSince` so
2310
2314
  * prompts that skip the layout chrome tag match the tarball v0 installs.
2311
- * 0.4.9 adds listingDetailModel (values, facts, location, breadcrumb,
2312
- * description clamp, video/tour), getSimilarListings, and
2313
- * listingAmenityGroups so listing detail never prints amenity ids.
2315
+ * 0.4.12 flattens listingDetailModel.description to a string (plus
2316
+ * descriptionToggleLabel) so JSX cannot render the clamp object.
2314
2317
  */
2315
- minNpmVersion: "0.4.9",
2318
+ minNpmVersion: "0.4.12",
2316
2319
  /** First release where ListingCard and ResultsSkeleton inject the sheet. */
2317
2320
  selfInjectSince: "0.4.2",
2318
2321
  chromeStrategy: "self-inject",
@@ -2442,7 +2445,7 @@ function studioLeadInstruction() {
2442
2445
  }
2443
2446
  function studioListingDetailInstruction() {
2444
2447
  const names = STUDIO_SDK_CONTRACT.listingDetailExports.join(", ");
2445
- return `Listing detail blocks: import ${names} from \`${STUDIO_SDK_PACKAGE}\` and \`ListingCard\` from \`${STUDIO_SDK_PACKAGE}/react\`. Render \`listingDetailModel(listing)\` for breadcrumb (hrefs are search prefixes of \`listing.path\`, never invented paths), values (price / sob consulta, condo, IPTU), facts (omit empty zeros; bedrooms \u2260 salas), location plus a discreet Google Maps \`<a target="_blank" rel="noopener noreferrer">\`, and description with the helper clamp + toggle (keep the full text; do not drop the remainder). 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 the list is empty. Do not invent a local recommendation loop.`;
2448
+ return `Listing detail blocks: import ${names} from \`${STUDIO_SDK_PACKAGE}\` and \`ListingCard\` from \`${STUDIO_SDK_PACKAGE}/react\`. Render \`listingDetailModel(listing)\` for breadcrumb (hrefs are search prefixes of \`listing.path\`, never invented paths), values (price / sob consulta, condo, IPTU), facts (omit empty zeros; bedrooms \u2260 salas), location plus a discreet Google Maps \`<a target="_blank" rel="noopener noreferrer">\`, and description as the string \`model.description\` plus \`model.descriptionToggleLabel\` (keep the full text; do not drop the remainder). Map facts/values/breadcrumb items to \`.label\` / \`.text\` / \`.href\`; use \`model.location.label\` and \`model.location.mapsHref\`. Never interpolate \`model.location\`, \`model.facts\`, \`model.values\`, \`model.breadcrumb\`, \`model.mediaOverlays\`, or amenity groups 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 the list is empty. Do not invent a local recommendation loop.`;
2446
2449
  }
2447
2450
  function studioAmenityInstruction() {
2448
2451
  const names = STUDIO_SDK_CONTRACT.amenityExports.join(", ");