@garagem-ai/site-sdk 0.5.2 → 0.6.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 +16 -25
- package/dist/index.d.mts +296 -28
- package/dist/index.d.ts +296 -28
- package/dist/index.js +469 -53
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +458 -51
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +18 -60
- package/dist/react.d.ts +18 -60
- package/dist/react.js +265 -874
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +246 -841
- package/dist/react.mjs.map +1 -1
- package/dist/{search-engine-4ocM0UPk.d.mts → search-engine-CtnLzmwW.d.mts} +13 -181
- package/dist/{search-engine-4ocM0UPk.d.ts → search-engine-CtnLzmwW.d.ts} +13 -181
- package/package.json +11 -13
- package/src/amenity-labels.ts +9 -2
- package/src/fetchers.ts +2 -1
- package/src/index.ts +20 -2
- package/src/internal/url.ts +1 -0
- package/src/leads.ts +45 -6
- package/src/listing-card-model.ts +4 -1
- package/src/listing-detail.ts +8 -2
- package/src/phone-countries.ts +97 -0
- package/src/phone.ts +431 -0
- package/src/presentation.ts +1 -24
- package/src/react/index.ts +1 -11
- package/src/react/public-search-snapshot.ts +165 -0
- package/src/react/staged-filters-mirror.ts +38 -0
- package/src/react/types.ts +17 -30
- package/src/react/use-public-search.ts +121 -42
- package/src/search-engine.ts +3 -0
- package/src/studio-contract.ts +63 -21
- package/src/types.ts +12 -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
|
@@ -78,6 +78,8 @@ interface Listing {
|
|
|
78
78
|
description: string;
|
|
79
79
|
businessType: ListingBusinessType;
|
|
80
80
|
price: number | null;
|
|
81
|
+
/** ISO 4217 currency code. Defaults to BRL when absent on older payloads. */
|
|
82
|
+
currency?: string;
|
|
81
83
|
priceVisibility: ListingPriceVisibility;
|
|
82
84
|
status: string;
|
|
83
85
|
featured: boolean;
|
|
@@ -95,6 +97,11 @@ interface Listing {
|
|
|
95
97
|
* details and richer property info. Returned by `getListing`.
|
|
96
98
|
*/
|
|
97
99
|
interface ListingDetail extends Listing {
|
|
100
|
+
/**
|
|
101
|
+
* Precomputed IPTU period label from tenant Campos (e.g. `IPTU/ano`,
|
|
102
|
+
* `IPTU/mês (10x)`). Render as-is; do not derive from raw period fields.
|
|
103
|
+
*/
|
|
104
|
+
propertyTaxLabel?: string;
|
|
98
105
|
/**
|
|
99
106
|
* Unit + building amenity ids (legacy merged list). Prefer
|
|
100
107
|
* `propertyFeatures` and `buildingAmenities` with `listingAmenityGroups`.
|
|
@@ -164,6 +171,11 @@ type SearchUiDictionary = {
|
|
|
164
171
|
propertyTypes: SearchUiOption[];
|
|
165
172
|
propertyFeatures: SearchUiOption[];
|
|
166
173
|
buildingAmenities: SearchUiOption[];
|
|
174
|
+
/** Present only when Campos amenity display is flat (checkbox / alphabetical). */
|
|
175
|
+
amenitySectionTitles?: {
|
|
176
|
+
unit?: string;
|
|
177
|
+
building?: string;
|
|
178
|
+
};
|
|
167
179
|
};
|
|
168
180
|
/** Geo leftovers on a default-V2 search path (`/imoveis/...`). */
|
|
169
181
|
type SearchPathLocation = {
|
|
@@ -378,186 +390,6 @@ interface RequestNextOptions {
|
|
|
378
390
|
tags?: string[];
|
|
379
391
|
}
|
|
380
392
|
|
|
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
393
|
/** Query keys that must never encode filters (Editor/Studio path contract). */
|
|
562
394
|
declare const FORBIDDEN_SEARCH_QUERY_KEYS: readonly ["tipo", "quartos", "tipo-imovel", "banheiros", "vagas"];
|
|
563
395
|
/** Default option: omit `ordenar` (API has no relevance token). */
|
|
@@ -639,4 +471,4 @@ type SearchChromeModel = {
|
|
|
639
471
|
};
|
|
640
472
|
declare function searchChromeModel(schema: SearchUi | null, pathFilters: SearchPathFilters, locationNames?: LocationNameTables | null): SearchChromeModel;
|
|
641
473
|
|
|
642
|
-
export {
|
|
474
|
+
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 };
|
|
@@ -78,6 +78,8 @@ interface Listing {
|
|
|
78
78
|
description: string;
|
|
79
79
|
businessType: ListingBusinessType;
|
|
80
80
|
price: number | null;
|
|
81
|
+
/** ISO 4217 currency code. Defaults to BRL when absent on older payloads. */
|
|
82
|
+
currency?: string;
|
|
81
83
|
priceVisibility: ListingPriceVisibility;
|
|
82
84
|
status: string;
|
|
83
85
|
featured: boolean;
|
|
@@ -95,6 +97,11 @@ interface Listing {
|
|
|
95
97
|
* details and richer property info. Returned by `getListing`.
|
|
96
98
|
*/
|
|
97
99
|
interface ListingDetail extends Listing {
|
|
100
|
+
/**
|
|
101
|
+
* Precomputed IPTU period label from tenant Campos (e.g. `IPTU/ano`,
|
|
102
|
+
* `IPTU/mês (10x)`). Render as-is; do not derive from raw period fields.
|
|
103
|
+
*/
|
|
104
|
+
propertyTaxLabel?: string;
|
|
98
105
|
/**
|
|
99
106
|
* Unit + building amenity ids (legacy merged list). Prefer
|
|
100
107
|
* `propertyFeatures` and `buildingAmenities` with `listingAmenityGroups`.
|
|
@@ -164,6 +171,11 @@ type SearchUiDictionary = {
|
|
|
164
171
|
propertyTypes: SearchUiOption[];
|
|
165
172
|
propertyFeatures: SearchUiOption[];
|
|
166
173
|
buildingAmenities: SearchUiOption[];
|
|
174
|
+
/** Present only when Campos amenity display is flat (checkbox / alphabetical). */
|
|
175
|
+
amenitySectionTitles?: {
|
|
176
|
+
unit?: string;
|
|
177
|
+
building?: string;
|
|
178
|
+
};
|
|
167
179
|
};
|
|
168
180
|
/** Geo leftovers on a default-V2 search path (`/imoveis/...`). */
|
|
169
181
|
type SearchPathLocation = {
|
|
@@ -378,186 +390,6 @@ interface RequestNextOptions {
|
|
|
378
390
|
tags?: string[];
|
|
379
391
|
}
|
|
380
392
|
|
|
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
393
|
/** Query keys that must never encode filters (Editor/Studio path contract). */
|
|
562
394
|
declare const FORBIDDEN_SEARCH_QUERY_KEYS: readonly ["tipo", "quartos", "tipo-imovel", "banheiros", "vagas"];
|
|
563
395
|
/** Default option: omit `ordenar` (API has no relevance token). */
|
|
@@ -639,4 +471,4 @@ type SearchChromeModel = {
|
|
|
639
471
|
};
|
|
640
472
|
declare function searchChromeModel(schema: SearchUi | null, pathFilters: SearchPathFilters, locationNames?: LocationNameTables | null): SearchChromeModel;
|
|
641
473
|
|
|
642
|
-
export {
|
|
474
|
+
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.
|
|
3
|
+
"version": "0.6.0",
|
|
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",
|
|
@@ -55,17 +52,17 @@
|
|
|
55
52
|
"lint": "eslint ."
|
|
56
53
|
},
|
|
57
54
|
"devDependencies": {
|
|
55
|
+
"@garagem/eslint-config": "workspace:*",
|
|
58
56
|
"@garagem/search-url": "workspace:*",
|
|
59
57
|
"@types/node": "^20.10.8",
|
|
60
58
|
"@types/react": "19.1.4",
|
|
59
|
+
"eslint": "^9.0.0",
|
|
61
60
|
"next": "16.4.0-canary.15",
|
|
62
61
|
"react": "19.2.1",
|
|
63
62
|
"react-dom": "19.2.1",
|
|
64
63
|
"tsup": "^8.0.1",
|
|
65
64
|
"typescript": "^5.3.3",
|
|
66
|
-
"vitest": "^4.0.0"
|
|
67
|
-
"@garagem/eslint-config": "workspace:*",
|
|
68
|
-
"eslint": "^9.0.0"
|
|
65
|
+
"vitest": "^4.0.0"
|
|
69
66
|
},
|
|
70
67
|
"peerDependencies": {
|
|
71
68
|
"next": ">=14",
|
|
@@ -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",
|
|
@@ -93,5 +88,8 @@
|
|
|
93
88
|
"nextjs",
|
|
94
89
|
"headless",
|
|
95
90
|
"imoveis"
|
|
96
|
-
]
|
|
91
|
+
],
|
|
92
|
+
"dependencies": {
|
|
93
|
+
"libphonenumber-js": "^1.12.42"
|
|
94
|
+
}
|
|
97
95
|
}
|
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,
|
|
@@ -169,6 +167,25 @@ export {
|
|
|
169
167
|
parseGroupedInteger,
|
|
170
168
|
} from "./presentation";
|
|
171
169
|
|
|
170
|
+
export {
|
|
171
|
+
DEFAULT_PHONE_COUNTRY_CODE,
|
|
172
|
+
MAX_NATIONAL_PHONE_DIGITS,
|
|
173
|
+
PHONE_COUNTRIES,
|
|
174
|
+
collapseDuplicatedBrazilianMobileNine,
|
|
175
|
+
defaultPhoneCountry,
|
|
176
|
+
findPhoneCountry,
|
|
177
|
+
formatPhoneNational,
|
|
178
|
+
isValidPhone,
|
|
179
|
+
nationalPhoneDigits,
|
|
180
|
+
parsePhoneInput,
|
|
181
|
+
phoneCountrySearchValue,
|
|
182
|
+
remaskPhoneForCountry,
|
|
183
|
+
toE164,
|
|
184
|
+
truncateNationalPhoneDigits,
|
|
185
|
+
type ParsedPhoneInput,
|
|
186
|
+
type PhoneCountry,
|
|
187
|
+
} from "./phone";
|
|
188
|
+
|
|
172
189
|
export {
|
|
173
190
|
FORBIDDEN_SEARCH_QUERY_KEYS,
|
|
174
191
|
SEARCH_SORT_RELEVANCE,
|
|
@@ -238,6 +255,7 @@ export {
|
|
|
238
255
|
studioLayoutInstruction,
|
|
239
256
|
studioAmenityInstruction,
|
|
240
257
|
studioLeadInstruction,
|
|
258
|
+
studioListingCardInstruction,
|
|
241
259
|
studioListingDetailInstruction,
|
|
242
260
|
studioSearchInstruction,
|
|
243
261
|
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;
|