@garagem-ai/site-sdk 0.5.1 → 0.5.3
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 +16 -25
- package/dist/index.d.mts +202 -28
- package/dist/index.d.ts +202 -28
- package/dist/index.js +41 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -42
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +2 -60
- package/dist/react.d.ts +2 -60
- package/dist/react.js +150 -862
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +122 -820
- package/dist/react.mjs.map +1 -1
- package/dist/{search-engine-4ocM0UPk.d.mts → search-engine-CkbO77G8.d.mts} +11 -181
- package/dist/{search-engine-4ocM0UPk.d.ts → search-engine-CkbO77G8.d.ts} +11 -181
- package/package.json +4 -9
- package/src/amenity-labels.ts +9 -2
- package/src/fetchers.ts +2 -1
- package/src/index.ts +1 -2
- package/src/internal/url.ts +1 -0
- package/src/listing-detail.ts +2 -1
- package/src/presentation.ts +1 -24
- package/src/react/index.ts +0 -11
- package/src/react/staged-filters-mirror.ts +38 -0
- package/src/react/types.ts +0 -30
- package/src/react/use-public-search.ts +30 -10
- package/src/search-engine.ts +3 -0
- package/src/studio-contract.ts +35 -20
- package/src/types.ts +10 -0
- package/src/react/cn.ts +0 -3
- package/src/react/listing-card.tsx +0 -98
- package/src/react/listing-detail-fields.tsx +0 -119
- package/src/react/search-chrome.tsx +0 -29
- package/src/react/search.css +0 -214
- package/src/react/styles/index.ts +0 -1
- package/src/react/styles/search-chrome-css.generated.ts +0 -5
- package/src/react/styles/search-chrome-styles.tsx +0 -31
|
@@ -95,6 +95,11 @@ interface Listing {
|
|
|
95
95
|
* details and richer property info. Returned by `getListing`.
|
|
96
96
|
*/
|
|
97
97
|
interface ListingDetail extends Listing {
|
|
98
|
+
/**
|
|
99
|
+
* Precomputed IPTU period label from tenant Campos (e.g. `IPTU/ano`,
|
|
100
|
+
* `IPTU/mês (10x)`). Render as-is; do not derive from raw period fields.
|
|
101
|
+
*/
|
|
102
|
+
propertyTaxLabel?: string;
|
|
98
103
|
/**
|
|
99
104
|
* Unit + building amenity ids (legacy merged list). Prefer
|
|
100
105
|
* `propertyFeatures` and `buildingAmenities` with `listingAmenityGroups`.
|
|
@@ -164,6 +169,11 @@ type SearchUiDictionary = {
|
|
|
164
169
|
propertyTypes: SearchUiOption[];
|
|
165
170
|
propertyFeatures: SearchUiOption[];
|
|
166
171
|
buildingAmenities: SearchUiOption[];
|
|
172
|
+
/** Present only when Campos amenity display is flat (checkbox / alphabetical). */
|
|
173
|
+
amenitySectionTitles?: {
|
|
174
|
+
unit?: string;
|
|
175
|
+
building?: string;
|
|
176
|
+
};
|
|
167
177
|
};
|
|
168
178
|
/** Geo leftovers on a default-V2 search path (`/imoveis/...`). */
|
|
169
179
|
type SearchPathLocation = {
|
|
@@ -378,186 +388,6 @@ interface RequestNextOptions {
|
|
|
378
388
|
tags?: string[];
|
|
379
389
|
}
|
|
380
390
|
|
|
381
|
-
/**
|
|
382
|
-
* Portuguese labels for listing amenity ids. Tenant search-ui dictionary
|
|
383
|
-
* wins; this map is the default-catalog fallback so generated Studio pages
|
|
384
|
-
* never print camelCase keys.
|
|
385
|
-
*/
|
|
386
|
-
declare const LISTING_AMENITY_TITLES: {
|
|
387
|
-
readonly unit: "Comodidades";
|
|
388
|
-
readonly building: "Comodidades do condomínio";
|
|
389
|
-
};
|
|
390
|
-
type AmenityLabelOption = {
|
|
391
|
-
id: string;
|
|
392
|
-
label: string;
|
|
393
|
-
};
|
|
394
|
-
type AmenityLabelDictionary = {
|
|
395
|
-
propertyFeatures?: AmenityLabelOption[];
|
|
396
|
-
buildingAmenities?: AmenityLabelOption[];
|
|
397
|
-
};
|
|
398
|
-
type ListingAmenityGroupKey = keyof typeof LISTING_AMENITY_TITLES;
|
|
399
|
-
type ListingAmenityGroup = {
|
|
400
|
-
key: ListingAmenityGroupKey;
|
|
401
|
-
title: string;
|
|
402
|
-
labels: string[];
|
|
403
|
-
};
|
|
404
|
-
type ListingAmenitySource = {
|
|
405
|
-
amenities?: string[] | null;
|
|
406
|
-
propertyFeatures?: string[] | null;
|
|
407
|
-
/** Condo amenity ids, even when `building` is null (no buildingId). */
|
|
408
|
-
buildingAmenities?: string[] | null;
|
|
409
|
-
building?: {
|
|
410
|
-
amenities?: string[] | null;
|
|
411
|
-
} | null;
|
|
412
|
-
};
|
|
413
|
-
/**
|
|
414
|
-
* Default tenant ids + canonical `has*` / `is*` keys seen on public listings.
|
|
415
|
-
* Aligned with DEFAULT_PROPERTY_FEATURES and DEFAULT_BUILDING_FEATURES from
|
|
416
|
-
* Foundation's field-definitions.ts so generated Studio pages never need a
|
|
417
|
-
* dictionary for standard amenities.
|
|
418
|
-
*/
|
|
419
|
-
declare const AMENITY_FALLBACK_LABELS: Record<string, string>;
|
|
420
|
-
declare function labelAmenities(ids: readonly string[] | null | undefined, dictionary?: AmenityLabelOption[]): string[];
|
|
421
|
-
declare function listingAmenityGroups(listing: ListingAmenitySource, dictionary?: AmenityLabelDictionary): ListingAmenityGroup[];
|
|
422
|
-
|
|
423
|
-
declare const LISTING_DESCRIPTION_CLAMP = 280;
|
|
424
|
-
/** Visible listing fact. The number / area / floor is `text` — never omit it. */
|
|
425
|
-
type ListingFact = {
|
|
426
|
-
key: string;
|
|
427
|
-
label: string;
|
|
428
|
-
text: string;
|
|
429
|
-
};
|
|
430
|
-
/** Visible listing amount. Price, condomínio and IPTU are `text`. */
|
|
431
|
-
type ListingValue = {
|
|
432
|
-
key: string;
|
|
433
|
-
label: string;
|
|
434
|
-
text: string;
|
|
435
|
-
};
|
|
436
|
-
type ListingBreadcrumbCrumb = {
|
|
437
|
-
label: string;
|
|
438
|
-
href: string;
|
|
439
|
-
};
|
|
440
|
-
type ListingLocationBlock = {
|
|
441
|
-
label: string;
|
|
442
|
-
mapsHref: string | null;
|
|
443
|
-
};
|
|
444
|
-
type ListingDescriptionPreview = {
|
|
445
|
-
text: string;
|
|
446
|
-
truncated: boolean;
|
|
447
|
-
toggleLabel: string | null;
|
|
448
|
-
};
|
|
449
|
-
type ListingMediaOverlay = {
|
|
450
|
-
key: "video" | "tour";
|
|
451
|
-
hash: "video" | "tour";
|
|
452
|
-
title: string;
|
|
453
|
-
href: string;
|
|
454
|
-
embedSrc: string;
|
|
455
|
-
};
|
|
456
|
-
type ListingDetailModel = {
|
|
457
|
-
breadcrumb: ListingBreadcrumbCrumb[];
|
|
458
|
-
values: ListingValue[];
|
|
459
|
-
facts: ListingFact[];
|
|
460
|
-
location: ListingLocationBlock | null;
|
|
461
|
-
/** Complete description string — never a sliced preview. */
|
|
462
|
-
description: string | null;
|
|
463
|
-
descriptionTruncated: boolean;
|
|
464
|
-
descriptionToggleLabel: string | null;
|
|
465
|
-
mediaOverlays: ListingMediaOverlay[];
|
|
466
|
-
};
|
|
467
|
-
declare function listingValues(listing: {
|
|
468
|
-
price?: number | null;
|
|
469
|
-
priceVisibility?: string | null;
|
|
470
|
-
property?: {
|
|
471
|
-
condoFee?: number | null;
|
|
472
|
-
propertyTax?: number | null;
|
|
473
|
-
} | null;
|
|
474
|
-
}): ListingValue[];
|
|
475
|
-
declare function listingFacts(listing: {
|
|
476
|
-
property?: {
|
|
477
|
-
totalArea?: number | null;
|
|
478
|
-
usableArea?: number | null;
|
|
479
|
-
bedrooms?: number | null;
|
|
480
|
-
suites?: number | null;
|
|
481
|
-
parkingSpaces?: number | null;
|
|
482
|
-
rooms?: number | null;
|
|
483
|
-
floor?: number | string | null;
|
|
484
|
-
} | null;
|
|
485
|
-
}): ListingFact[];
|
|
486
|
-
declare function listingMapsHref(location: ListingLocation | null | undefined): string | null;
|
|
487
|
-
declare function listingLocationBlock(listing: {
|
|
488
|
-
location?: ListingLocation | null;
|
|
489
|
-
} | null | undefined): ListingLocationBlock | null;
|
|
490
|
-
declare function listingBreadcrumb(listing: {
|
|
491
|
-
path?: string | null;
|
|
492
|
-
listingCode?: string | null;
|
|
493
|
-
id?: string | null;
|
|
494
|
-
}): ListingBreadcrumbCrumb[];
|
|
495
|
-
declare function listingDescriptionPreview(description: string | null | undefined, expanded?: boolean): ListingDescriptionPreview | null;
|
|
496
|
-
declare function listingMediaOverlays(listing: {
|
|
497
|
-
media?: ListingMedia[] | null;
|
|
498
|
-
}): ListingMediaOverlay[];
|
|
499
|
-
declare function listingDetailModel(listing: Pick<ListingDetail, "id" | "listingCode" | "path" | "price" | "priceVisibility" | "description"> & {
|
|
500
|
-
property?: ListingDetail["property"] | null;
|
|
501
|
-
location?: ListingLocation | null;
|
|
502
|
-
media?: ListingMedia[] | null;
|
|
503
|
-
}, options?: {
|
|
504
|
-
descriptionExpanded?: boolean;
|
|
505
|
-
}): ListingDetailModel;
|
|
506
|
-
|
|
507
|
-
type ListingDetailFieldsModel = {
|
|
508
|
-
facts: ListingFact[];
|
|
509
|
-
values: ListingValue[];
|
|
510
|
-
amenityGroups: ListingAmenityGroup[];
|
|
511
|
-
};
|
|
512
|
-
type ListingDetailFieldsSource = ListingAmenitySource & Pick<ListingDetail, "price" | "priceVisibility"> & {
|
|
513
|
-
property?: ListingDetail["property"] | null;
|
|
514
|
-
};
|
|
515
|
-
/**
|
|
516
|
-
* Facts, values, and amenity groups that are safe to render: every row has
|
|
517
|
-
* a real label and text. Missing condo/IPTU/empty facts never appear.
|
|
518
|
-
*/
|
|
519
|
-
declare function listingDetailFieldsModel(listing: ListingDetailFieldsSource, dictionary?: AmenityLabelDictionary): ListingDetailFieldsModel;
|
|
520
|
-
|
|
521
|
-
/** Fields every listing card must have — no JSX. */
|
|
522
|
-
type ListingCardModel = {
|
|
523
|
-
href: string;
|
|
524
|
-
title: string;
|
|
525
|
-
businessType: ListingBusinessType;
|
|
526
|
-
businessLabel: string;
|
|
527
|
-
priceVisibility: ListingPriceVisibility;
|
|
528
|
-
price: number | null;
|
|
529
|
-
priceLabel: string;
|
|
530
|
-
pricePeriod: string | null;
|
|
531
|
-
locationLabel: string;
|
|
532
|
-
propertyType: string | null;
|
|
533
|
-
coverSrc: string | null;
|
|
534
|
-
coverAlt: string;
|
|
535
|
-
bedrooms: number | null;
|
|
536
|
-
bathrooms: number | null;
|
|
537
|
-
parkingSpaces: number | null;
|
|
538
|
-
areaM2: number | null;
|
|
539
|
-
};
|
|
540
|
-
declare function listingLocationLabel(location: {
|
|
541
|
-
neighborhood?: string | null;
|
|
542
|
-
city?: string | null;
|
|
543
|
-
state?: string | null;
|
|
544
|
-
}): string;
|
|
545
|
-
declare function toListingCardModel(listing: Pick<Listing, "id" | "listingCode" | "path" | "title" | "businessType" | "price" | "priceVisibility" | "coverImage"> & {
|
|
546
|
-
property?: {
|
|
547
|
-
type?: string | null;
|
|
548
|
-
bedrooms?: number | null;
|
|
549
|
-
bathrooms?: number | null;
|
|
550
|
-
parkingSpaces?: number | null;
|
|
551
|
-
usableArea?: number | null;
|
|
552
|
-
totalArea?: number | null;
|
|
553
|
-
};
|
|
554
|
-
location?: {
|
|
555
|
-
neighborhood?: string | null;
|
|
556
|
-
city?: string | null;
|
|
557
|
-
state?: string | null;
|
|
558
|
-
};
|
|
559
|
-
}): ListingCardModel;
|
|
560
|
-
|
|
561
391
|
/** Query keys that must never encode filters (Editor/Studio path contract). */
|
|
562
392
|
declare const FORBIDDEN_SEARCH_QUERY_KEYS: readonly ["tipo", "quartos", "tipo-imovel", "banheiros", "vagas"];
|
|
563
393
|
/** Default option: omit `ordenar` (API has no relevance token). */
|
|
@@ -639,4 +469,4 @@ type SearchChromeModel = {
|
|
|
639
469
|
};
|
|
640
470
|
declare function searchChromeModel(schema: SearchUi | null, pathFilters: SearchPathFilters, locationNames?: LocationNameTables | null): SearchChromeModel;
|
|
641
471
|
|
|
642
|
-
export {
|
|
472
|
+
export { publicSearchHref as $, type AppliedSearchQuery as A, SEARCH_SORT_RELEVANCE as B, type CmsCollection as C, type SearchChromeModel as D, type SearchPathLocation as E, FORBIDDEN_SEARCH_QUERY_KEYS as F, type SearchUiFilter as G, type SearchUiOption as H, applyPathFilter as I, buildQueryListingsParams as J, canonicalizeSearchHref as K, type ListingFilters as L, clearStagedPathFilters as M, countFacetChoices as N, countOptionLabel as O, displayPathLocation as P, type QueryListingsParams as Q, type RequestNextOptions as R, type SearchListingsParams as S, TOOLBAR_PRIMARY_FILTER_IDS as T, hrefForAppliedChange as U, hrefForPathFilters as V, hrefWithExplicitPage as W, isListingDetailPath as X, paginationPages as Y, pathFilterHasOption as Z, pathFilterValue as _, type CmsEntriesResult as a, rangeDraftFromPath as a0, readPublicSearch as a1, searchChromeModel as a2, searchHrefUsesLegacyFilterQuery as a3, searchResultsHeading as a4, searchSortOptions as a5, toolbarFilterIds as a6, visibleSearchFilters as a7, type CmsEntry as b, type ListingDetail as c, type ListingsResult as d, type SearchUi as e, type SimilarListingsResult as f, type Site as g, type QueryListingsResult as h, type SearchListingsResult as i, type ListingLocation as j, type ListingMedia as k, type ListingBusinessType as l, type ListingPriceVisibility as m, type Listing as n, type SearchPathFilters as o, type SearchUiDictionary as p, type QueryListingsFilters as q, type AppliedSearchChange as r, type CmsEntryStatus as s, type CmsFieldDefinition as t, type CmsFieldType as u, type CmsSeoData as v, type ListingPropertySummary as w, type LocationNameTables as x, type QueryListingsLocation as y, SEARCH_EMPTY_COPY as z };
|
|
@@ -95,6 +95,11 @@ interface Listing {
|
|
|
95
95
|
* details and richer property info. Returned by `getListing`.
|
|
96
96
|
*/
|
|
97
97
|
interface ListingDetail extends Listing {
|
|
98
|
+
/**
|
|
99
|
+
* Precomputed IPTU period label from tenant Campos (e.g. `IPTU/ano`,
|
|
100
|
+
* `IPTU/mês (10x)`). Render as-is; do not derive from raw period fields.
|
|
101
|
+
*/
|
|
102
|
+
propertyTaxLabel?: string;
|
|
98
103
|
/**
|
|
99
104
|
* Unit + building amenity ids (legacy merged list). Prefer
|
|
100
105
|
* `propertyFeatures` and `buildingAmenities` with `listingAmenityGroups`.
|
|
@@ -164,6 +169,11 @@ type SearchUiDictionary = {
|
|
|
164
169
|
propertyTypes: SearchUiOption[];
|
|
165
170
|
propertyFeatures: SearchUiOption[];
|
|
166
171
|
buildingAmenities: SearchUiOption[];
|
|
172
|
+
/** Present only when Campos amenity display is flat (checkbox / alphabetical). */
|
|
173
|
+
amenitySectionTitles?: {
|
|
174
|
+
unit?: string;
|
|
175
|
+
building?: string;
|
|
176
|
+
};
|
|
167
177
|
};
|
|
168
178
|
/** Geo leftovers on a default-V2 search path (`/imoveis/...`). */
|
|
169
179
|
type SearchPathLocation = {
|
|
@@ -378,186 +388,6 @@ interface RequestNextOptions {
|
|
|
378
388
|
tags?: string[];
|
|
379
389
|
}
|
|
380
390
|
|
|
381
|
-
/**
|
|
382
|
-
* Portuguese labels for listing amenity ids. Tenant search-ui dictionary
|
|
383
|
-
* wins; this map is the default-catalog fallback so generated Studio pages
|
|
384
|
-
* never print camelCase keys.
|
|
385
|
-
*/
|
|
386
|
-
declare const LISTING_AMENITY_TITLES: {
|
|
387
|
-
readonly unit: "Comodidades";
|
|
388
|
-
readonly building: "Comodidades do condomínio";
|
|
389
|
-
};
|
|
390
|
-
type AmenityLabelOption = {
|
|
391
|
-
id: string;
|
|
392
|
-
label: string;
|
|
393
|
-
};
|
|
394
|
-
type AmenityLabelDictionary = {
|
|
395
|
-
propertyFeatures?: AmenityLabelOption[];
|
|
396
|
-
buildingAmenities?: AmenityLabelOption[];
|
|
397
|
-
};
|
|
398
|
-
type ListingAmenityGroupKey = keyof typeof LISTING_AMENITY_TITLES;
|
|
399
|
-
type ListingAmenityGroup = {
|
|
400
|
-
key: ListingAmenityGroupKey;
|
|
401
|
-
title: string;
|
|
402
|
-
labels: string[];
|
|
403
|
-
};
|
|
404
|
-
type ListingAmenitySource = {
|
|
405
|
-
amenities?: string[] | null;
|
|
406
|
-
propertyFeatures?: string[] | null;
|
|
407
|
-
/** Condo amenity ids, even when `building` is null (no buildingId). */
|
|
408
|
-
buildingAmenities?: string[] | null;
|
|
409
|
-
building?: {
|
|
410
|
-
amenities?: string[] | null;
|
|
411
|
-
} | null;
|
|
412
|
-
};
|
|
413
|
-
/**
|
|
414
|
-
* Default tenant ids + canonical `has*` / `is*` keys seen on public listings.
|
|
415
|
-
* Aligned with DEFAULT_PROPERTY_FEATURES and DEFAULT_BUILDING_FEATURES from
|
|
416
|
-
* Foundation's field-definitions.ts so generated Studio pages never need a
|
|
417
|
-
* dictionary for standard amenities.
|
|
418
|
-
*/
|
|
419
|
-
declare const AMENITY_FALLBACK_LABELS: Record<string, string>;
|
|
420
|
-
declare function labelAmenities(ids: readonly string[] | null | undefined, dictionary?: AmenityLabelOption[]): string[];
|
|
421
|
-
declare function listingAmenityGroups(listing: ListingAmenitySource, dictionary?: AmenityLabelDictionary): ListingAmenityGroup[];
|
|
422
|
-
|
|
423
|
-
declare const LISTING_DESCRIPTION_CLAMP = 280;
|
|
424
|
-
/** Visible listing fact. The number / area / floor is `text` — never omit it. */
|
|
425
|
-
type ListingFact = {
|
|
426
|
-
key: string;
|
|
427
|
-
label: string;
|
|
428
|
-
text: string;
|
|
429
|
-
};
|
|
430
|
-
/** Visible listing amount. Price, condomínio and IPTU are `text`. */
|
|
431
|
-
type ListingValue = {
|
|
432
|
-
key: string;
|
|
433
|
-
label: string;
|
|
434
|
-
text: string;
|
|
435
|
-
};
|
|
436
|
-
type ListingBreadcrumbCrumb = {
|
|
437
|
-
label: string;
|
|
438
|
-
href: string;
|
|
439
|
-
};
|
|
440
|
-
type ListingLocationBlock = {
|
|
441
|
-
label: string;
|
|
442
|
-
mapsHref: string | null;
|
|
443
|
-
};
|
|
444
|
-
type ListingDescriptionPreview = {
|
|
445
|
-
text: string;
|
|
446
|
-
truncated: boolean;
|
|
447
|
-
toggleLabel: string | null;
|
|
448
|
-
};
|
|
449
|
-
type ListingMediaOverlay = {
|
|
450
|
-
key: "video" | "tour";
|
|
451
|
-
hash: "video" | "tour";
|
|
452
|
-
title: string;
|
|
453
|
-
href: string;
|
|
454
|
-
embedSrc: string;
|
|
455
|
-
};
|
|
456
|
-
type ListingDetailModel = {
|
|
457
|
-
breadcrumb: ListingBreadcrumbCrumb[];
|
|
458
|
-
values: ListingValue[];
|
|
459
|
-
facts: ListingFact[];
|
|
460
|
-
location: ListingLocationBlock | null;
|
|
461
|
-
/** Complete description string — never a sliced preview. */
|
|
462
|
-
description: string | null;
|
|
463
|
-
descriptionTruncated: boolean;
|
|
464
|
-
descriptionToggleLabel: string | null;
|
|
465
|
-
mediaOverlays: ListingMediaOverlay[];
|
|
466
|
-
};
|
|
467
|
-
declare function listingValues(listing: {
|
|
468
|
-
price?: number | null;
|
|
469
|
-
priceVisibility?: string | null;
|
|
470
|
-
property?: {
|
|
471
|
-
condoFee?: number | null;
|
|
472
|
-
propertyTax?: number | null;
|
|
473
|
-
} | null;
|
|
474
|
-
}): ListingValue[];
|
|
475
|
-
declare function listingFacts(listing: {
|
|
476
|
-
property?: {
|
|
477
|
-
totalArea?: number | null;
|
|
478
|
-
usableArea?: number | null;
|
|
479
|
-
bedrooms?: number | null;
|
|
480
|
-
suites?: number | null;
|
|
481
|
-
parkingSpaces?: number | null;
|
|
482
|
-
rooms?: number | null;
|
|
483
|
-
floor?: number | string | null;
|
|
484
|
-
} | null;
|
|
485
|
-
}): ListingFact[];
|
|
486
|
-
declare function listingMapsHref(location: ListingLocation | null | undefined): string | null;
|
|
487
|
-
declare function listingLocationBlock(listing: {
|
|
488
|
-
location?: ListingLocation | null;
|
|
489
|
-
} | null | undefined): ListingLocationBlock | null;
|
|
490
|
-
declare function listingBreadcrumb(listing: {
|
|
491
|
-
path?: string | null;
|
|
492
|
-
listingCode?: string | null;
|
|
493
|
-
id?: string | null;
|
|
494
|
-
}): ListingBreadcrumbCrumb[];
|
|
495
|
-
declare function listingDescriptionPreview(description: string | null | undefined, expanded?: boolean): ListingDescriptionPreview | null;
|
|
496
|
-
declare function listingMediaOverlays(listing: {
|
|
497
|
-
media?: ListingMedia[] | null;
|
|
498
|
-
}): ListingMediaOverlay[];
|
|
499
|
-
declare function listingDetailModel(listing: Pick<ListingDetail, "id" | "listingCode" | "path" | "price" | "priceVisibility" | "description"> & {
|
|
500
|
-
property?: ListingDetail["property"] | null;
|
|
501
|
-
location?: ListingLocation | null;
|
|
502
|
-
media?: ListingMedia[] | null;
|
|
503
|
-
}, options?: {
|
|
504
|
-
descriptionExpanded?: boolean;
|
|
505
|
-
}): ListingDetailModel;
|
|
506
|
-
|
|
507
|
-
type ListingDetailFieldsModel = {
|
|
508
|
-
facts: ListingFact[];
|
|
509
|
-
values: ListingValue[];
|
|
510
|
-
amenityGroups: ListingAmenityGroup[];
|
|
511
|
-
};
|
|
512
|
-
type ListingDetailFieldsSource = ListingAmenitySource & Pick<ListingDetail, "price" | "priceVisibility"> & {
|
|
513
|
-
property?: ListingDetail["property"] | null;
|
|
514
|
-
};
|
|
515
|
-
/**
|
|
516
|
-
* Facts, values, and amenity groups that are safe to render: every row has
|
|
517
|
-
* a real label and text. Missing condo/IPTU/empty facts never appear.
|
|
518
|
-
*/
|
|
519
|
-
declare function listingDetailFieldsModel(listing: ListingDetailFieldsSource, dictionary?: AmenityLabelDictionary): ListingDetailFieldsModel;
|
|
520
|
-
|
|
521
|
-
/** Fields every listing card must have — no JSX. */
|
|
522
|
-
type ListingCardModel = {
|
|
523
|
-
href: string;
|
|
524
|
-
title: string;
|
|
525
|
-
businessType: ListingBusinessType;
|
|
526
|
-
businessLabel: string;
|
|
527
|
-
priceVisibility: ListingPriceVisibility;
|
|
528
|
-
price: number | null;
|
|
529
|
-
priceLabel: string;
|
|
530
|
-
pricePeriod: string | null;
|
|
531
|
-
locationLabel: string;
|
|
532
|
-
propertyType: string | null;
|
|
533
|
-
coverSrc: string | null;
|
|
534
|
-
coverAlt: string;
|
|
535
|
-
bedrooms: number | null;
|
|
536
|
-
bathrooms: number | null;
|
|
537
|
-
parkingSpaces: number | null;
|
|
538
|
-
areaM2: number | null;
|
|
539
|
-
};
|
|
540
|
-
declare function listingLocationLabel(location: {
|
|
541
|
-
neighborhood?: string | null;
|
|
542
|
-
city?: string | null;
|
|
543
|
-
state?: string | null;
|
|
544
|
-
}): string;
|
|
545
|
-
declare function toListingCardModel(listing: Pick<Listing, "id" | "listingCode" | "path" | "title" | "businessType" | "price" | "priceVisibility" | "coverImage"> & {
|
|
546
|
-
property?: {
|
|
547
|
-
type?: string | null;
|
|
548
|
-
bedrooms?: number | null;
|
|
549
|
-
bathrooms?: number | null;
|
|
550
|
-
parkingSpaces?: number | null;
|
|
551
|
-
usableArea?: number | null;
|
|
552
|
-
totalArea?: number | null;
|
|
553
|
-
};
|
|
554
|
-
location?: {
|
|
555
|
-
neighborhood?: string | null;
|
|
556
|
-
city?: string | null;
|
|
557
|
-
state?: string | null;
|
|
558
|
-
};
|
|
559
|
-
}): ListingCardModel;
|
|
560
|
-
|
|
561
391
|
/** Query keys that must never encode filters (Editor/Studio path contract). */
|
|
562
392
|
declare const FORBIDDEN_SEARCH_QUERY_KEYS: readonly ["tipo", "quartos", "tipo-imovel", "banheiros", "vagas"];
|
|
563
393
|
/** Default option: omit `ordenar` (API has no relevance token). */
|
|
@@ -639,4 +469,4 @@ type SearchChromeModel = {
|
|
|
639
469
|
};
|
|
640
470
|
declare function searchChromeModel(schema: SearchUi | null, pathFilters: SearchPathFilters, locationNames?: LocationNameTables | null): SearchChromeModel;
|
|
641
471
|
|
|
642
|
-
export {
|
|
472
|
+
export { publicSearchHref as $, type AppliedSearchQuery as A, SEARCH_SORT_RELEVANCE as B, type CmsCollection as C, type SearchChromeModel as D, type SearchPathLocation as E, FORBIDDEN_SEARCH_QUERY_KEYS as F, type SearchUiFilter as G, type SearchUiOption as H, applyPathFilter as I, buildQueryListingsParams as J, canonicalizeSearchHref as K, type ListingFilters as L, clearStagedPathFilters as M, countFacetChoices as N, countOptionLabel as O, displayPathLocation as P, type QueryListingsParams as Q, type RequestNextOptions as R, type SearchListingsParams as S, TOOLBAR_PRIMARY_FILTER_IDS as T, hrefForAppliedChange as U, hrefForPathFilters as V, hrefWithExplicitPage as W, isListingDetailPath as X, paginationPages as Y, pathFilterHasOption as Z, pathFilterValue as _, type CmsEntriesResult as a, rangeDraftFromPath as a0, readPublicSearch as a1, searchChromeModel as a2, searchHrefUsesLegacyFilterQuery as a3, searchResultsHeading as a4, searchSortOptions as a5, toolbarFilterIds as a6, visibleSearchFilters as a7, type CmsEntry as b, type ListingDetail as c, type ListingsResult as d, type SearchUi as e, type SimilarListingsResult as f, type Site as g, type QueryListingsResult as h, type SearchListingsResult as i, type ListingLocation as j, type ListingMedia as k, type ListingBusinessType as l, type ListingPriceVisibility as m, type Listing as n, type SearchPathFilters as o, type SearchUiDictionary as p, type QueryListingsFilters as q, type AppliedSearchChange as r, type CmsEntryStatus as s, type CmsFieldDefinition as t, type CmsFieldType as u, type CmsSeoData as v, type ListingPropertySummary as w, type LocationNameTables as x, type QueryListingsLocation as y, SEARCH_EMPTY_COPY as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@garagem-ai/site-sdk",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Typed, runtime-agnostic SDK for building custom real estate sites against the Garagem platform. Drop into any Next.js (or other JS) project to fetch listings, sites and CMS data.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
"import": "./dist/react.mjs",
|
|
19
19
|
"require": "./dist/react.js",
|
|
20
20
|
"default": "./dist/react.js"
|
|
21
|
-
}
|
|
22
|
-
"./react/search.css": "./src/react/search.css"
|
|
21
|
+
}
|
|
23
22
|
},
|
|
24
23
|
"files": [
|
|
25
24
|
"dist",
|
|
@@ -41,12 +40,10 @@
|
|
|
41
40
|
"import": "./dist/react.mjs",
|
|
42
41
|
"require": "./dist/react.js",
|
|
43
42
|
"default": "./dist/react.js"
|
|
44
|
-
}
|
|
45
|
-
"./react/search.css": "./src/react/search.css"
|
|
43
|
+
}
|
|
46
44
|
}
|
|
47
45
|
},
|
|
48
46
|
"scripts": {
|
|
49
|
-
"prebuild": "node scripts/build-search-chrome-css.mjs",
|
|
50
47
|
"build": "tsup",
|
|
51
48
|
"dev": "tsup --watch",
|
|
52
49
|
"test": "vitest run",
|
|
@@ -83,9 +80,7 @@
|
|
|
83
80
|
"optional": true
|
|
84
81
|
}
|
|
85
82
|
},
|
|
86
|
-
"sideEffects":
|
|
87
|
-
"**/*.css"
|
|
88
|
-
],
|
|
83
|
+
"sideEffects": false,
|
|
89
84
|
"keywords": [
|
|
90
85
|
"garagem",
|
|
91
86
|
"real-estate",
|
package/src/amenity-labels.ts
CHANGED
|
@@ -17,6 +17,10 @@ export type AmenityLabelOption = {
|
|
|
17
17
|
export type AmenityLabelDictionary = {
|
|
18
18
|
propertyFeatures?: AmenityLabelOption[];
|
|
19
19
|
buildingAmenities?: AmenityLabelOption[];
|
|
20
|
+
amenitySectionTitles?: {
|
|
21
|
+
unit?: string;
|
|
22
|
+
building?: string;
|
|
23
|
+
};
|
|
20
24
|
};
|
|
21
25
|
|
|
22
26
|
export type ListingAmenityGroupKey = keyof typeof LISTING_AMENITY_TITLES;
|
|
@@ -380,7 +384,8 @@ export function listingAmenityGroups(
|
|
|
380
384
|
if (unitLabels.length > 0) {
|
|
381
385
|
groups.push({
|
|
382
386
|
key: "unit",
|
|
383
|
-
title:
|
|
387
|
+
title:
|
|
388
|
+
dictionary?.amenitySectionTitles?.unit ?? LISTING_AMENITY_TITLES.unit,
|
|
384
389
|
labels: unitLabels,
|
|
385
390
|
});
|
|
386
391
|
}
|
|
@@ -392,7 +397,9 @@ export function listingAmenityGroups(
|
|
|
392
397
|
if (buildingLabels.length > 0) {
|
|
393
398
|
groups.push({
|
|
394
399
|
key: "building",
|
|
395
|
-
title:
|
|
400
|
+
title:
|
|
401
|
+
dictionary?.amenitySectionTitles?.building ??
|
|
402
|
+
LISTING_AMENITY_TITLES.building,
|
|
396
403
|
labels: buildingLabels,
|
|
397
404
|
});
|
|
398
405
|
}
|
package/src/fetchers.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { listingLookupKey } from "./listing-path";
|
|
|
19
19
|
import {
|
|
20
20
|
buildListingFiltersQuery,
|
|
21
21
|
coerceSiteId,
|
|
22
|
+
DEFAULT_RESOLVE_BASE_URL,
|
|
22
23
|
normalizeBaseUrl,
|
|
23
24
|
} from "./internal/url";
|
|
24
25
|
|
|
@@ -216,7 +217,7 @@ export async function getSite(options: GetSiteOptions): Promise<Site | null> {
|
|
|
216
217
|
);
|
|
217
218
|
}
|
|
218
219
|
|
|
219
|
-
const base = normalizeBaseUrl(baseUrl);
|
|
220
|
+
const base = normalizeBaseUrl(baseUrl ?? DEFAULT_RESOLVE_BASE_URL);
|
|
220
221
|
const params = new URLSearchParams();
|
|
221
222
|
if (siteId) params.set("siteId", siteId);
|
|
222
223
|
if (domain) params.set("domain", domain);
|
package/src/index.ts
CHANGED
|
@@ -160,8 +160,6 @@ export {
|
|
|
160
160
|
} from "./listing-card-model";
|
|
161
161
|
|
|
162
162
|
export {
|
|
163
|
-
SEARCH_CSS_RECIPE,
|
|
164
|
-
SEARCH_CSS_VARS,
|
|
165
163
|
formatAreaM2,
|
|
166
164
|
formatGroupedInteger,
|
|
167
165
|
formatListingPrice,
|
|
@@ -238,6 +236,7 @@ export {
|
|
|
238
236
|
studioLayoutInstruction,
|
|
239
237
|
studioAmenityInstruction,
|
|
240
238
|
studioLeadInstruction,
|
|
239
|
+
studioListingCardInstruction,
|
|
241
240
|
studioListingDetailInstruction,
|
|
242
241
|
studioSearchInstruction,
|
|
243
242
|
studioSearchLandmarkInstruction,
|
package/src/internal/url.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { ListingFilters } from "../types";
|
|
|
2
2
|
|
|
3
3
|
/** Default base URL — the public Garagem API. Override via `baseUrl`. */
|
|
4
4
|
export const DEFAULT_BASE_URL = "https://app.garagem.ai";
|
|
5
|
+
export const DEFAULT_RESOLVE_BASE_URL = "https://cdn.fndn.ai/site";
|
|
5
6
|
|
|
6
7
|
export function normalizeBaseUrl(baseUrl: string | undefined): string {
|
|
7
8
|
const url = baseUrl ?? DEFAULT_BASE_URL;
|
package/src/listing-detail.ts
CHANGED
|
@@ -172,6 +172,7 @@ function crumbLabel(segment: string): string {
|
|
|
172
172
|
export function listingValues(listing: {
|
|
173
173
|
price?: number | null;
|
|
174
174
|
priceVisibility?: string | null;
|
|
175
|
+
propertyTaxLabel?: string | null;
|
|
175
176
|
property?: { condoFee?: number | null; propertyTax?: number | null } | null;
|
|
176
177
|
}): ListingValue[] {
|
|
177
178
|
const values: ListingValue[] = [
|
|
@@ -196,7 +197,7 @@ export function listingValues(listing: {
|
|
|
196
197
|
if (propertyTax != null) {
|
|
197
198
|
values.push({
|
|
198
199
|
key: "propertyTax",
|
|
199
|
-
label: "IPTU",
|
|
200
|
+
label: listing.propertyTaxLabel?.trim() || "IPTU",
|
|
200
201
|
text: formatListingPrice(propertyTax),
|
|
201
202
|
});
|
|
202
203
|
}
|
package/src/presentation.ts
CHANGED
|
@@ -1,31 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Presentation helpers with no UI framework.
|
|
3
|
-
*
|
|
4
|
-
* CSS custom-property names; they must not live inside JSX.
|
|
3
|
+
* Adapters consume these formatters; they must not live inside JSX.
|
|
5
4
|
*/
|
|
6
5
|
|
|
7
|
-
export const SEARCH_CSS_VARS = {
|
|
8
|
-
cardRadius: "--garagem-listing-card-radius",
|
|
9
|
-
cardGap: "--garagem-listing-card-gap",
|
|
10
|
-
priceSize: "--garagem-listing-price-size",
|
|
11
|
-
mediaRatio: "--garagem-listing-media-ratio",
|
|
12
|
-
controlHeight: "--garagem-search-control-height",
|
|
13
|
-
iconSize: "--garagem-search-icon-size",
|
|
14
|
-
skeleton: "--garagem-skeleton",
|
|
15
|
-
} as const;
|
|
16
|
-
|
|
17
|
-
/** Paste into generated `globals.css` to override tokens. Layout lives in the chrome artifact. */
|
|
18
|
-
export const SEARCH_CSS_RECIPE = `:root {
|
|
19
|
-
${SEARCH_CSS_VARS.cardRadius}: 0.75rem;
|
|
20
|
-
${SEARCH_CSS_VARS.cardGap}: 1.5rem;
|
|
21
|
-
${SEARCH_CSS_VARS.priceSize}: 1.125rem;
|
|
22
|
-
${SEARCH_CSS_VARS.mediaRatio}: 4 / 3;
|
|
23
|
-
${SEARCH_CSS_VARS.controlHeight}: 2.75rem;
|
|
24
|
-
${SEARCH_CSS_VARS.iconSize}: 1.25rem;
|
|
25
|
-
${SEARCH_CSS_VARS.skeleton}: var(--muted, #e7e5e4);
|
|
26
|
-
}
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
6
|
export function formatListingPrice(
|
|
30
7
|
amount: number | null | undefined,
|
|
31
8
|
locale = "pt-BR",
|
package/src/react/index.ts
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
export { ListingCard } from "./listing-card";
|
|
4
|
-
export { ListingDetailFields } from "./listing-detail-fields";
|
|
5
|
-
export type {
|
|
6
|
-
ListingDetailFieldsClassNames,
|
|
7
|
-
ListingDetailFieldsProps,
|
|
8
|
-
} from "./listing-detail-fields";
|
|
9
|
-
export { SearchChromeStyles } from "./styles";
|
|
10
|
-
export { ResultsSkeleton } from "./search-chrome";
|
|
11
3
|
export { usePublicSearch } from "./use-public-search";
|
|
12
4
|
export type {
|
|
13
|
-
ListingCardClassNames,
|
|
14
|
-
ListingCardProps,
|
|
15
|
-
ListingCardSlots,
|
|
16
5
|
PublicSearchState,
|
|
17
6
|
SiteIdInput,
|
|
18
7
|
UsePublicSearchOptions,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { applyPathFilter, clearStagedPathFilters } from "../search-engine";
|
|
2
|
+
import type { SearchPathFilters } from "../types";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Mutable mirror of staged path filters.
|
|
6
|
+
*
|
|
7
|
+
* React `setState` only schedules an update, so `stageFilter` then
|
|
8
|
+
* `applyStaged` in the same click would otherwise navigate the previous
|
|
9
|
+
* closed-over `staged` value and drop the write (e.g. Área drafts).
|
|
10
|
+
* Every staged write path updates this mirror synchronously; `applyStaged`
|
|
11
|
+
* reads it.
|
|
12
|
+
*/
|
|
13
|
+
export class StagedFiltersMirror {
|
|
14
|
+
private current: SearchPathFilters;
|
|
15
|
+
|
|
16
|
+
constructor(initial: SearchPathFilters = {}) {
|
|
17
|
+
this.current = initial;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get value(): SearchPathFilters {
|
|
21
|
+
return this.current;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
replace(next: SearchPathFilters): SearchPathFilters {
|
|
25
|
+
this.current = next;
|
|
26
|
+
return this.current;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
stage(filterId: string, value: unknown): SearchPathFilters {
|
|
30
|
+
this.current = applyPathFilter(this.current, filterId, value);
|
|
31
|
+
return this.current;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
clear(keepFilterIds: readonly string[] = []): SearchPathFilters {
|
|
35
|
+
this.current = clearStagedPathFilters(this.current, keepFilterIds);
|
|
36
|
+
return this.current;
|
|
37
|
+
}
|
|
38
|
+
}
|