@garagem-ai/site-sdk 0.11.1 → 0.12.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 +1 -0
- package/dist/index.d.mts +162 -2
- package/dist/index.d.ts +162 -2
- package/dist/index.js +72 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +69 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +14 -0
- package/src/share.ts +114 -0
- package/src/studio-contract.ts +34 -0
- package/src/types-share.ts +122 -0
package/README.md
CHANGED
|
@@ -67,6 +67,7 @@ raw escape hatch when you need full control.
|
|
|
67
67
|
| `getCmsEntries({ siteId, collection, limit?, offset? })` | Published CMS entries only |
|
|
68
68
|
| `getCmsEntry({ siteId, collection, slug })` | One published CMS entry |
|
|
69
69
|
| `getSearchUi({ siteId, next? })` | Tenant search schema (filters, slugs) |
|
|
70
|
+
| `getShareLink({ token, password?, next? })` | Resolve a `/p/{token}` share link. Returns `{ ok: false, reason }` (not a throw) for `not_found` / `inactive` / `expired` / `password_required` / `password_invalid` so you can render a password form or an unavailable state. |
|
|
70
71
|
| `getLeadUi({ siteId, next? })` | Visit-default lead dialog schema (weekday hours, Sat/Sun flags) |
|
|
71
72
|
| `submitVisitLead({ siteId, listingId, … })` | POST a visit lead (`listing.id` UUID; civil `visitDate` or `Date`/ISO instant normalized in the schedule timezone) |
|
|
72
73
|
| `submitContactLead({ siteId, listingId, … })` | POST a contact lead (no date/time) |
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,151 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as ListingDetail, F as FetchLike, R as RequestNextOptions, a as ListingLocation, b as ListingMedia, S as SearchPathFilters, c as SearchUiDictionary, Q as QueryListingsFilters, A as AppliedSearchQuery, d as AppliedSearchChange, e as ListingFilters, f as ListingsResult, g as Site, h as SearchListingsParams, i as SearchListingsResult, j as SearchUi, k as QueryListingsParams, l as QueryListingsResult, m as SimilarListingsResult, C as CmsCollection, n as CmsEntriesResult, o as CmsEntry, B as BoundaryCity, p as BoundaryLayerOptions, M as MapsCoordinates, T as TravelTimeCacheOptions, q as TravelTimeCache, r as MapsFetchOptions, s as BoundaryLayer, t as ListingWithLocation, u as StaticMapOptions, v as StreetViewAvailabilityOptions, w as StreetViewAvailability, x as StreetViewOptions, N as NeighborhoodBoundaryOptions, y as NeighborhoodBoundary, z as TravelDestination, D as TravelMode, E as TravelTimeOptions, G as TravelTime, H as TravelTimesOptions, I as TravelTimeElement, J as Listing, P as PhotoSearchParams, K as PhotoSearchResult, O as PhotoSearchItem, U as ListingWithMatchedPhoto, V as MatchedListingPhoto } from './types-photo-search-Bmf1f1-Y.mjs';
|
|
2
2
|
export { W as BoundaryFeature, X as BoundaryFeatureCollection, Y as BoundaryGeometry, Z as BoundaryLayerUrlKind, _ as BoundarySourceLayer, $ as CmsEntryStatus, a0 as CmsFieldDefinition, a1 as CmsFieldType, a2 as CmsSeoData, a3 as FORBIDDEN_SEARCH_QUERY_KEYS, a4 as GaragemSdkError, a5 as GetCmsCollectionOptions, a6 as GetCmsCollectionsOptions, a7 as GetCmsEntriesOptions, a8 as GetCmsEntryOptions, a9 as GetListingOptions, aa as GetListingsOptions, ab as GetSearchUiOptions, ac as GetSimilarListingsOptions, ad as GetSiteOptions, ae as ListingBusinessType, af as ListingCardModel, ag as ListingPriceVisibility, ah as ListingPropertySummary, ai as LocationNameTables, aj as MAP_POLYGON_MAX_VERTICES, ak as MAP_SEARCH_DEFAULT_PAGE_SIZE, al as MAP_SEARCH_MAX_PAGE_SIZE, am as MAP_VIEWPORT_DEBOUNCE_MS, an as MapBounds, ao as MapBoundsSearchOptions, ap as MapBucket, aq as MapPin, ar as MapPinCluster, as as MapPolygon, at as MapPolygonSearchOptions, au as MapSearchResult, av as MapsBaseOptions, aw as QueryListingsLocation, ax as QueryListingsOptions, ay as SEARCH_EMPTY_COPY, az as SEARCH_SORT_RELEVANCE, aA as SearchChromeModel, aB as SearchListingsOptions, aC as SearchPathLocation, aD as SearchUiFilter, aE as SearchUiOption, aF as StaticMapStyle, aG as TOOLBAR_PRIMARY_FILTER_IDS, aH as applyPathFilter, aI as buildQueryListingsParams, aJ as canonicalizeSearchHref, aK as capMapPage, aL as capMapPageSize, aM as clearStagedPathFilters, aN as clusterBuckets, aO as clusterPins, aP as countFacetChoices, aQ as countOptionLabel, aR as displayPathLocation, aS as getCmsCollection, aT as getCmsCollections, aU as getCmsEntries, aV as getCmsEntry, aW as getListing, aX as getListings, aY as getSearchUi, aZ as getSimilarListings, a_ as getSite, a$ as hrefForAppliedChange, b0 as hrefForPathFilters, b1 as hrefWithExplicitPage, b2 as isListingDetailPath, b3 as isMapBounds, b4 as isMapPolygon, b5 as listingLocationLabel, b6 as mapClusterCellDegrees, b7 as mapSearchPins, b8 as paginationPages, b9 as pathFilterHasOption, ba as pathFilterValue, bb as publicSearchHref, bc as queryListings, bd as rangeDraftFromPath, be as readPublicSearch, bf as searchChromeModel, bg as searchHrefUsesLegacyFilterQuery, bh as searchListings, bi as searchListingsInBounds, bj as searchListingsInPolygon, bk as searchResultsHeading, bl as searchSortOptions, bm as toListingCardModel, bn as toolbarFilterIds, bo as visibleSearchFilters } from './types-photo-search-Bmf1f1-Y.mjs';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Types for the public Share Link API (`GET`/`POST /api/sites/share/{token}`).
|
|
6
|
+
*
|
|
7
|
+
* This mirrors `resolveShareToken()` in Foundation
|
|
8
|
+
* (`apps/foundation/os/domain/sites/public/share-token.ts`) — treat it as a
|
|
9
|
+
* public contract (additive changes only), but note it is **today's raw
|
|
10
|
+
* shape**, not the friendly `Listing`/`ListingDetail` contract `getListing`
|
|
11
|
+
* returns. Field-visibility masking (price/address/agent redaction per the
|
|
12
|
+
* tenant's sharing config) is already applied server-side before you see
|
|
13
|
+
* this payload — do not try to "fix" a hidden price or address.
|
|
14
|
+
*
|
|
15
|
+
* For `entityType === "listing"`, `listing` is the same shape `getListing`
|
|
16
|
+
* returns. Render that. `entity` stays the raw Foundation payload.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** Entity kinds a share token can point at. Only `"listing"` is typed in
|
|
20
|
+
* detail today; the rest pass through as raw records pending follow-up
|
|
21
|
+
* work. */
|
|
22
|
+
type ShareEntityType = "listing" | "shortlist" | "seller_report" | "visit_itinerary" | "pricing_tool" | "visit_survey" | "form" | (string & {});
|
|
23
|
+
/** Why `getShareLink` failed. Maps 1:1 to `resolveShareToken`'s reasons. */
|
|
24
|
+
type ShareLinkErrorReason = "not_found" | "inactive" | "expired" | "password_required" | "password_invalid" | (string & {});
|
|
25
|
+
/** Raw listing + property fields for a `listing`-type share token.
|
|
26
|
+
* Foundation-internal column names — distinct from the public `Listing`
|
|
27
|
+
* type's field names (e.g. `parkingSpots` here vs. `parkingSpaces` there).
|
|
28
|
+
* See the module doc: a normalized, `ListingDetail`-shaped field is
|
|
29
|
+
* planned as an additive follow-up. */
|
|
30
|
+
interface ShareListingEntity {
|
|
31
|
+
listing: {
|
|
32
|
+
id: string;
|
|
33
|
+
title: string;
|
|
34
|
+
description: string | null;
|
|
35
|
+
price: number | null;
|
|
36
|
+
currency: string | null;
|
|
37
|
+
priceVisibility: string | null;
|
|
38
|
+
listingType: string | null;
|
|
39
|
+
listingCode: string | null;
|
|
40
|
+
stage: string | null;
|
|
41
|
+
status: string | null;
|
|
42
|
+
visibility: string | null;
|
|
43
|
+
createdAt: string | null;
|
|
44
|
+
publishedAt: string | null;
|
|
45
|
+
propertyId: string | null;
|
|
46
|
+
isPrimaryMarket: boolean | null;
|
|
47
|
+
typologyId: string | null;
|
|
48
|
+
};
|
|
49
|
+
property: Record<string, unknown> | null;
|
|
50
|
+
media: Array<{
|
|
51
|
+
id: string;
|
|
52
|
+
src: string;
|
|
53
|
+
alt?: string;
|
|
54
|
+
type: "image" | "video" | "tour";
|
|
55
|
+
category?: string;
|
|
56
|
+
order?: number;
|
|
57
|
+
isPrimary?: boolean;
|
|
58
|
+
entityType?: string;
|
|
59
|
+
}>;
|
|
60
|
+
[key: string]: unknown;
|
|
61
|
+
}
|
|
62
|
+
/** Share-token metadata echoed back on a successful resolve. */
|
|
63
|
+
interface ShareLinkToken {
|
|
64
|
+
entityType: ShareEntityType;
|
|
65
|
+
entityId: string;
|
|
66
|
+
[key: string]: unknown;
|
|
67
|
+
}
|
|
68
|
+
/** Successful `getShareLink` result. */
|
|
69
|
+
interface ShareLinkSuccess {
|
|
70
|
+
ok: true;
|
|
71
|
+
/** `entity` is typed for `entityType === "listing"`; narrow with a type
|
|
72
|
+
* guard (`result.token.entityType === "listing"`) before reading
|
|
73
|
+
* listing-specific fields on other entity types. */
|
|
74
|
+
token: ShareLinkToken;
|
|
75
|
+
entity: ShareListingEntity | Record<string, unknown>;
|
|
76
|
+
branding?: Record<string, unknown>;
|
|
77
|
+
agentInfo?: Record<string, unknown>;
|
|
78
|
+
tenantConfig?: Record<string, unknown>;
|
|
79
|
+
site?: Record<string, unknown>;
|
|
80
|
+
shareDisplayConfig?: Record<string, unknown>;
|
|
81
|
+
requestConfig?: Record<string, unknown>;
|
|
82
|
+
offerForm?: Record<string, unknown>;
|
|
83
|
+
tenantId: string;
|
|
84
|
+
/**
|
|
85
|
+
* Present for `entityType === "listing"` once Foundation attaches the
|
|
86
|
+
* public `getListing` shape. Render this with the same listing-detail
|
|
87
|
+
* module as `/imoveis`. Absent on older payloads and on other entity types.
|
|
88
|
+
*/
|
|
89
|
+
listing?: ListingDetail;
|
|
90
|
+
}
|
|
91
|
+
/** Failed `getShareLink` result. Branch UI on `reason`, not just `status`.
|
|
92
|
+
* `listingCode` / `site` are present on some errors (e.g. `password_required`
|
|
93
|
+
* for a listing share) so a password gate can still show which listing it's
|
|
94
|
+
* for. */
|
|
95
|
+
interface ShareLinkError {
|
|
96
|
+
ok: false;
|
|
97
|
+
status: number;
|
|
98
|
+
reason: ShareLinkErrorReason | null;
|
|
99
|
+
message: string;
|
|
100
|
+
listingCode?: string;
|
|
101
|
+
site?: Record<string, unknown>;
|
|
102
|
+
}
|
|
103
|
+
type ShareLinkResult = ShareLinkSuccess | ShareLinkError;
|
|
104
|
+
|
|
105
|
+
interface GetShareLinkOptions {
|
|
106
|
+
/** The `{token}` from a `/p/{token}` (or `/s`, `/i`, `/r`, `/c`) URL. */
|
|
107
|
+
token: string;
|
|
108
|
+
/** Password for a password-protected share. Sends a POST when present,
|
|
109
|
+
* a GET otherwise — matches the Foundation route's contract. */
|
|
110
|
+
password?: string;
|
|
111
|
+
/** Garagem API base URL. Defaults to `https://app.garagem.ai`. */
|
|
112
|
+
baseUrl?: string;
|
|
113
|
+
/** Override the fetch implementation (testing, edge runtimes, retries). */
|
|
114
|
+
fetch?: FetchLike;
|
|
115
|
+
/** Next.js App Router caching hints. Ignored on runtimes that don't
|
|
116
|
+
* understand them. Share links are per-visitor and often
|
|
117
|
+
* password/expiry-gated — avoid caching this call in production unless
|
|
118
|
+
* you know the token is long-lived and public. */
|
|
119
|
+
next?: RequestNextOptions;
|
|
120
|
+
/**
|
|
121
|
+
* Site publishable key (`pk_live_…`) from Configurações → Sites → API
|
|
122
|
+
* pública. Not a secret. Omit it and the request stays anonymous.
|
|
123
|
+
*/
|
|
124
|
+
publishableKey?: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Resolve a share-link token (`/p/{token}` and friends) against Foundation's
|
|
128
|
+
* public share-link API.
|
|
129
|
+
*
|
|
130
|
+
* Unlike {@link import("./fetchers").getListing}, this does **not** throw on
|
|
131
|
+
* a 401/403/404/410 — those are expected, UI-relevant outcomes for a share
|
|
132
|
+
* page (password gate, expired link, not found), returned as
|
|
133
|
+
* `{ ok: false, reason, ... }` so the caller can branch instead of catching.
|
|
134
|
+
* Genuine transport/5xx failures still throw {@link GaragemSdkError}.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* const result = await getShareLink({ token });
|
|
138
|
+
* if (!result.ok && result.reason === "password_required") {
|
|
139
|
+
* // render a password form, then retry with `password`
|
|
140
|
+
* }
|
|
141
|
+
* if (!result.ok) {
|
|
142
|
+
* // "not_found" | "inactive" | "expired" | other -> not-available state
|
|
143
|
+
* }
|
|
144
|
+
* // result.ok === true: result.entity (today's raw shape — see
|
|
145
|
+
* // types-share.ts doc for the planned normalized `listing` field)
|
|
146
|
+
*/
|
|
147
|
+
declare function getShareLink(options: GetShareLinkOptions): Promise<ShareLinkResult>;
|
|
148
|
+
|
|
4
149
|
/**
|
|
5
150
|
* Visit-lead schedule: hours in, slots out. Pure — no fetch, no React.
|
|
6
151
|
* Calendar dates are civil dates in `timeZone` (America/Sao_Paulo), never
|
|
@@ -650,10 +795,25 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
650
795
|
*/
|
|
651
796
|
readonly sellerLeadExports: readonly ["submitSellerLead", "uploadSellerLeadPhoto", "sellerAddressErrors", "sellerPhotoSchedule", "isValidEmail", "isValidName"];
|
|
652
797
|
readonly sellerLeadSince: "0.10.0";
|
|
798
|
+
/**
|
|
799
|
+
* Share-link page (`/p/[token]`). Prompt-safe only once `minNpmVersion`
|
|
800
|
+
* reaches `shareLinkSince`. Below it `studioShareLinkInstruction` prints
|
|
801
|
+
* nothing and `studioCodegenContractViolations` flags `getShareLink` —
|
|
802
|
+
* v0 installs the pin and copies any identifier it sees.
|
|
803
|
+
*/
|
|
804
|
+
readonly shareExports: readonly ["getShareLink"];
|
|
805
|
+
readonly shareLinkSince: "0.12.0";
|
|
653
806
|
};
|
|
654
807
|
type StudioSdkContract = typeof STUDIO_SDK_CONTRACT;
|
|
655
808
|
/** Whether the pinned tarball carries the seller-lead surface. */
|
|
656
809
|
declare function isSellerLeadOnPin(pin?: string): boolean;
|
|
810
|
+
/** Whether the pinned tarball exports `getShareLink`. */
|
|
811
|
+
declare function isShareLinkOnPin(pin?: string): boolean;
|
|
812
|
+
/**
|
|
813
|
+
* Native `/p/[token]` page. Empty below `shareLinkSince`, so the current
|
|
814
|
+
* Studio prompt does not mention `getShareLink`.
|
|
815
|
+
*/
|
|
816
|
+
declare function studioShareLinkInstruction(pin?: string): string;
|
|
657
817
|
/**
|
|
658
818
|
* Fixed SDK half of the property-registration page. The configured fields
|
|
659
819
|
* and photo options come from the Studio onboarding block. Empty below
|
|
@@ -1367,4 +1527,4 @@ declare function resolveMatchedCoverPhoto(photo: MatchedListingPhoto | null | un
|
|
|
1367
1527
|
*/
|
|
1368
1528
|
declare function applyMatchedPhotoCover<T extends Listing>(cards: ReadonlyArray<T>, photoResults: PhotoSearchResult | ReadonlyArray<PhotoSearchItem> | null | undefined, options?: ApplyMatchedPhotoCoverOptions): Array<T & ListingWithMatchedPhoto>;
|
|
1369
1529
|
|
|
1370
|
-
export { AMENITY_FALLBACK_LABELS, type AmenityLabelDictionary, type AmenityLabelOption, AppliedSearchChange, AppliedSearchQuery, type ApplyMatchedPhotoCoverOptions, BoundaryCity, BoundaryLayer, BoundaryLayerOptions, CmsCollection, CmsEntriesResult, CmsEntry, type ContactLeadInput, type CreateGaragemClientOptions, DEFAULT_MAPS_BASE_URL, DEFAULT_PHONE_COUNTRY_CODE, FetchLike, type GaragemClient, type GetLeadUiOptions, type GetListingMarketPositionOptions, type GetNeighborhoodSummaryOptions, type GetSimilarByPhotoOptions, type HHmm, LISTING_AMENITY_TITLES, LISTING_DESCRIPTION_CLAMP, type LeadContact, type LeadField, type LeadFieldId, LeadSubmitError, type LeadSubmitErrorCode, type LeadSubmitResult, type LeadUi, Listing, type ListingAmenityGroup, type ListingAmenityGroupKey, type ListingAmenitySource, type ListingBreadcrumbCrumb, type ListingDescriptionPreview, ListingDetail, type ListingDetailFieldsModel, type ListingDetailFieldsSource, type ListingDetailModel, type ListingFact, ListingFilters, ListingLocation, type ListingLocationBlock, type ListingMarketPosition, ListingMedia, type ListingMediaOverlay, type ListingPhotoGroup, type ListingValue, type ListingVisualHighlightsOptions, ListingWithLocation, ListingWithMatchedPhoto, ListingsResult, type LocationFilterInput, MAPS_MAX_IMAGE_EDGE, MAPS_SITE_HEADER, MATCHED_PHOTO_COVER_MAX_DISTANCE, MAX_NATIONAL_PHONE_DIGITS, MapsCoordinates, MapsFetchOptions, type MarketListingType, type MarketPriceBand, type MarketPropertyType, type MarketUnavailableReason, MatchedListingPhoto, NeighborhoodBoundary, NeighborhoodBoundaryOptions, type NeighborhoodSummary, type NeighborhoodSummaryQuery, PHONE_COUNTRIES, PHOTO_GROUP_OTHER_KEY, PHOTO_GROUP_OTHER_LABEL, PHOTO_SEARCH_MIN_QUERY_LENGTH, type ParsedPhoneInput, type PhoneCountry, PhotoSearchItem, PhotoSearchParams, PhotoSearchResult, type PriceEstimate, type PriceEstimateConfidence, type PriceEstimateInput, QueryListingsFilters, QueryListingsParams, QueryListingsResult, RequestNextOptions, type RequestPriceEstimateOptions, type ResolvePublicSiteIdOptions, SELLER_LEAD_PHOTO_MAX_BYTES, SELLER_LEAD_PHOTO_MAX_COUNT, SELLER_LEAD_PHOTO_TYPES, STUDIO_DEFAULT_PHOTO_SCHEDULE_CONFIG, STUDIO_DEFAULT_VISIT_SCHEDULE, STUDIO_SDK_CONTRACT, STUDIO_SDK_PACKAGE, STUDIO_SITE_LAYOUT, type SearchListingPhotosOptions, SearchListingsParams, SearchListingsResult, SearchPathFilters, SearchUi, SearchUiDictionary, type SellerAddressErrors, type SellerAddressField, type SellerBusinessType, type SellerLeadAddress, type SellerLeadInput, type SellerLeadProperty, type SellerPhotoScheduleConfig, type SimilarByPhotoItem, type SimilarByPhotoResult, SimilarListingsResult, type SimilarPhotoMatch, Site, StaticMapOptions, StreetViewAvailability, StreetViewAvailabilityOptions, StreetViewOptions, type StudioSdkContract, TravelDestination, TravelMode, TravelTime, TravelTimeCache, TravelTimeCacheOptions, TravelTimeElement, TravelTimeOptions, TravelTimesOptions, type UploadSellerLeadPhotoInput, VISIT_TIME_ZONE, type VisitHours, type VisitLeadInput, type VisitSchedule, type VisitScheduleConfig, applyMatchedPhotoCover, boundaryCitySlug, boundaryLayerId, boundaryLayerUrl, clearTravelTimeCache, coarsenCoordinates, coerceNpmVersion, collapseDuplicatedBrazilianMobileNine, compareSemver, composeSearchPublicHref, composeSearchPublicPath, coordinateDecimals, createClient, createGaragemClient, createTravelTimeCache, defaultPhoneCountry, expandVisitSchedule, expandVisitTimeSlots, findPhoneCountry, formatAreaM2, formatGroupedInteger, formatListingPrice, formatPhoneNational, getBoundaryLayer, getLeadUi, getListingMarketPosition, getNeighborhoodSummary, getSimilarByPhoto, hasShowcaseLeadsPostUrl, isPhotoSearchOnPin, isSellerLeadOnPin, isStudioPreviewHost, isValidEmail, isValidName, isValidPhone, isVisitSlotAllowed, labelAmenities, listingAmenityGroups, listingBreadcrumb, listingBusinessLabel, listingCoordinates, listingDescriptionPreview, listingDetailFieldsModel, listingDetailModel, listingFacts, listingLocationBlock, listingLookupKey, listingMapsHref, listingMediaOverlays, listingPhotoGroups, listingPublicPath, listingStaticMapUrl, listingStreetViewAvailable, listingStreetViewMetadataUrl, listingStreetViewUrl, listingValues, listingVisualHighlights, mapsExportsPublished, marketExportsAvailableAt, marketPositionLabel, maxZoomForCoordinates, mergeAppliedSearchQueryIntoSearch, nationalPhoneDigits, neighborhoodBoundaryLayer, neighborhoodBoundaryUrl, normalizeMapsBaseUrl, normalizeVisitDate, normalizeVisitTime, parseAppliedSearchQuery, parseGroupedInteger, parsePhoneInput, parseReactSdkNamedImports, parseSearchPublicPath, pathFiltersToQueryFilters, pathLocationToFilterInput, phoneCountrySearchValue, photoRoomLabel, photoSearchUrl, priceBandLabel, reduceAppliedSearchQuery, remaskPhoneForCountry, requestPriceEstimate, resolveMatchedCoverPhoto, resolvePublicSiteId, resolveTravelDestination, searchListingPhotos, sellerAddressErrors, sellerPhotoSchedule, serializeAppliedSearchQuery, slotsForDate, studioAmenityInstruction, studioChromeInstruction, studioCodegenContractViolations, studioDefaultLeadUi, studioLayoutInstruction, studioLeadInstruction, studioListingCardInstruction, studioListingDetailInstruction, studioMapSearchInstruction, studioMapsInstruction, studioMarketInstruction, studioPhotoInstruction, studioPhotoInstructionFor, studioPhotoSearchInstruction, studioPublishableKeyInstruction, studioSdkPinInstruction, studioSearchInstruction, studioSearchLandmarkInstruction, studioSellerLeadSdkInstruction, studioSiteWidthCss, submitContactLead, submitSellerLead, submitVisitLead, toE164, travelTimeCacheKey, travelTimeFromListing, travelTimesFromListing, truncateNationalPhoneDigits, unavailableReactImports, uploadSellerLeadPhoto };
|
|
1530
|
+
export { AMENITY_FALLBACK_LABELS, type AmenityLabelDictionary, type AmenityLabelOption, AppliedSearchChange, AppliedSearchQuery, type ApplyMatchedPhotoCoverOptions, BoundaryCity, BoundaryLayer, BoundaryLayerOptions, CmsCollection, CmsEntriesResult, CmsEntry, type ContactLeadInput, type CreateGaragemClientOptions, DEFAULT_MAPS_BASE_URL, DEFAULT_PHONE_COUNTRY_CODE, FetchLike, type GaragemClient, type GetLeadUiOptions, type GetListingMarketPositionOptions, type GetNeighborhoodSummaryOptions, type GetShareLinkOptions, type GetSimilarByPhotoOptions, type HHmm, LISTING_AMENITY_TITLES, LISTING_DESCRIPTION_CLAMP, type LeadContact, type LeadField, type LeadFieldId, LeadSubmitError, type LeadSubmitErrorCode, type LeadSubmitResult, type LeadUi, Listing, type ListingAmenityGroup, type ListingAmenityGroupKey, type ListingAmenitySource, type ListingBreadcrumbCrumb, type ListingDescriptionPreview, ListingDetail, type ListingDetailFieldsModel, type ListingDetailFieldsSource, type ListingDetailModel, type ListingFact, ListingFilters, ListingLocation, type ListingLocationBlock, type ListingMarketPosition, ListingMedia, type ListingMediaOverlay, type ListingPhotoGroup, type ListingValue, type ListingVisualHighlightsOptions, ListingWithLocation, ListingWithMatchedPhoto, ListingsResult, type LocationFilterInput, MAPS_MAX_IMAGE_EDGE, MAPS_SITE_HEADER, MATCHED_PHOTO_COVER_MAX_DISTANCE, MAX_NATIONAL_PHONE_DIGITS, MapsCoordinates, MapsFetchOptions, type MarketListingType, type MarketPriceBand, type MarketPropertyType, type MarketUnavailableReason, MatchedListingPhoto, NeighborhoodBoundary, NeighborhoodBoundaryOptions, type NeighborhoodSummary, type NeighborhoodSummaryQuery, PHONE_COUNTRIES, PHOTO_GROUP_OTHER_KEY, PHOTO_GROUP_OTHER_LABEL, PHOTO_SEARCH_MIN_QUERY_LENGTH, type ParsedPhoneInput, type PhoneCountry, PhotoSearchItem, PhotoSearchParams, PhotoSearchResult, type PriceEstimate, type PriceEstimateConfidence, type PriceEstimateInput, QueryListingsFilters, QueryListingsParams, QueryListingsResult, RequestNextOptions, type RequestPriceEstimateOptions, type ResolvePublicSiteIdOptions, SELLER_LEAD_PHOTO_MAX_BYTES, SELLER_LEAD_PHOTO_MAX_COUNT, SELLER_LEAD_PHOTO_TYPES, STUDIO_DEFAULT_PHOTO_SCHEDULE_CONFIG, STUDIO_DEFAULT_VISIT_SCHEDULE, STUDIO_SDK_CONTRACT, STUDIO_SDK_PACKAGE, STUDIO_SITE_LAYOUT, type SearchListingPhotosOptions, SearchListingsParams, SearchListingsResult, SearchPathFilters, SearchUi, SearchUiDictionary, type SellerAddressErrors, type SellerAddressField, type SellerBusinessType, type SellerLeadAddress, type SellerLeadInput, type SellerLeadProperty, type SellerPhotoScheduleConfig, type ShareEntityType, type ShareLinkError, type ShareLinkErrorReason, type ShareLinkResult, type ShareLinkSuccess, type ShareLinkToken, type ShareListingEntity, type SimilarByPhotoItem, type SimilarByPhotoResult, SimilarListingsResult, type SimilarPhotoMatch, Site, StaticMapOptions, StreetViewAvailability, StreetViewAvailabilityOptions, StreetViewOptions, type StudioSdkContract, TravelDestination, TravelMode, TravelTime, TravelTimeCache, TravelTimeCacheOptions, TravelTimeElement, TravelTimeOptions, TravelTimesOptions, type UploadSellerLeadPhotoInput, VISIT_TIME_ZONE, type VisitHours, type VisitLeadInput, type VisitSchedule, type VisitScheduleConfig, applyMatchedPhotoCover, boundaryCitySlug, boundaryLayerId, boundaryLayerUrl, clearTravelTimeCache, coarsenCoordinates, coerceNpmVersion, collapseDuplicatedBrazilianMobileNine, compareSemver, composeSearchPublicHref, composeSearchPublicPath, coordinateDecimals, createClient, createGaragemClient, createTravelTimeCache, defaultPhoneCountry, expandVisitSchedule, expandVisitTimeSlots, findPhoneCountry, formatAreaM2, formatGroupedInteger, formatListingPrice, formatPhoneNational, getBoundaryLayer, getLeadUi, getListingMarketPosition, getNeighborhoodSummary, getShareLink, getSimilarByPhoto, hasShowcaseLeadsPostUrl, isPhotoSearchOnPin, isSellerLeadOnPin, isShareLinkOnPin, isStudioPreviewHost, isValidEmail, isValidName, isValidPhone, isVisitSlotAllowed, labelAmenities, listingAmenityGroups, listingBreadcrumb, listingBusinessLabel, listingCoordinates, listingDescriptionPreview, listingDetailFieldsModel, listingDetailModel, listingFacts, listingLocationBlock, listingLookupKey, listingMapsHref, listingMediaOverlays, listingPhotoGroups, listingPublicPath, listingStaticMapUrl, listingStreetViewAvailable, listingStreetViewMetadataUrl, listingStreetViewUrl, listingValues, listingVisualHighlights, mapsExportsPublished, marketExportsAvailableAt, marketPositionLabel, maxZoomForCoordinates, mergeAppliedSearchQueryIntoSearch, nationalPhoneDigits, neighborhoodBoundaryLayer, neighborhoodBoundaryUrl, normalizeMapsBaseUrl, normalizeVisitDate, normalizeVisitTime, parseAppliedSearchQuery, parseGroupedInteger, parsePhoneInput, parseReactSdkNamedImports, parseSearchPublicPath, pathFiltersToQueryFilters, pathLocationToFilterInput, phoneCountrySearchValue, photoRoomLabel, photoSearchUrl, priceBandLabel, reduceAppliedSearchQuery, remaskPhoneForCountry, requestPriceEstimate, resolveMatchedCoverPhoto, resolvePublicSiteId, resolveTravelDestination, searchListingPhotos, sellerAddressErrors, sellerPhotoSchedule, serializeAppliedSearchQuery, slotsForDate, studioAmenityInstruction, studioChromeInstruction, studioCodegenContractViolations, studioDefaultLeadUi, studioLayoutInstruction, studioLeadInstruction, studioListingCardInstruction, studioListingDetailInstruction, studioMapSearchInstruction, studioMapsInstruction, studioMarketInstruction, studioPhotoInstruction, studioPhotoInstructionFor, studioPhotoSearchInstruction, studioPublishableKeyInstruction, studioSdkPinInstruction, studioSearchInstruction, studioSearchLandmarkInstruction, studioSellerLeadSdkInstruction, studioShareLinkInstruction, studioSiteWidthCss, submitContactLead, submitSellerLead, submitVisitLead, toE164, travelTimeCacheKey, travelTimeFromListing, travelTimesFromListing, truncateNationalPhoneDigits, unavailableReactImports, uploadSellerLeadPhoto };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,151 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as ListingDetail, F as FetchLike, R as RequestNextOptions, a as ListingLocation, b as ListingMedia, S as SearchPathFilters, c as SearchUiDictionary, Q as QueryListingsFilters, A as AppliedSearchQuery, d as AppliedSearchChange, e as ListingFilters, f as ListingsResult, g as Site, h as SearchListingsParams, i as SearchListingsResult, j as SearchUi, k as QueryListingsParams, l as QueryListingsResult, m as SimilarListingsResult, C as CmsCollection, n as CmsEntriesResult, o as CmsEntry, B as BoundaryCity, p as BoundaryLayerOptions, M as MapsCoordinates, T as TravelTimeCacheOptions, q as TravelTimeCache, r as MapsFetchOptions, s as BoundaryLayer, t as ListingWithLocation, u as StaticMapOptions, v as StreetViewAvailabilityOptions, w as StreetViewAvailability, x as StreetViewOptions, N as NeighborhoodBoundaryOptions, y as NeighborhoodBoundary, z as TravelDestination, D as TravelMode, E as TravelTimeOptions, G as TravelTime, H as TravelTimesOptions, I as TravelTimeElement, J as Listing, P as PhotoSearchParams, K as PhotoSearchResult, O as PhotoSearchItem, U as ListingWithMatchedPhoto, V as MatchedListingPhoto } from './types-photo-search-Bmf1f1-Y.js';
|
|
2
2
|
export { W as BoundaryFeature, X as BoundaryFeatureCollection, Y as BoundaryGeometry, Z as BoundaryLayerUrlKind, _ as BoundarySourceLayer, $ as CmsEntryStatus, a0 as CmsFieldDefinition, a1 as CmsFieldType, a2 as CmsSeoData, a3 as FORBIDDEN_SEARCH_QUERY_KEYS, a4 as GaragemSdkError, a5 as GetCmsCollectionOptions, a6 as GetCmsCollectionsOptions, a7 as GetCmsEntriesOptions, a8 as GetCmsEntryOptions, a9 as GetListingOptions, aa as GetListingsOptions, ab as GetSearchUiOptions, ac as GetSimilarListingsOptions, ad as GetSiteOptions, ae as ListingBusinessType, af as ListingCardModel, ag as ListingPriceVisibility, ah as ListingPropertySummary, ai as LocationNameTables, aj as MAP_POLYGON_MAX_VERTICES, ak as MAP_SEARCH_DEFAULT_PAGE_SIZE, al as MAP_SEARCH_MAX_PAGE_SIZE, am as MAP_VIEWPORT_DEBOUNCE_MS, an as MapBounds, ao as MapBoundsSearchOptions, ap as MapBucket, aq as MapPin, ar as MapPinCluster, as as MapPolygon, at as MapPolygonSearchOptions, au as MapSearchResult, av as MapsBaseOptions, aw as QueryListingsLocation, ax as QueryListingsOptions, ay as SEARCH_EMPTY_COPY, az as SEARCH_SORT_RELEVANCE, aA as SearchChromeModel, aB as SearchListingsOptions, aC as SearchPathLocation, aD as SearchUiFilter, aE as SearchUiOption, aF as StaticMapStyle, aG as TOOLBAR_PRIMARY_FILTER_IDS, aH as applyPathFilter, aI as buildQueryListingsParams, aJ as canonicalizeSearchHref, aK as capMapPage, aL as capMapPageSize, aM as clearStagedPathFilters, aN as clusterBuckets, aO as clusterPins, aP as countFacetChoices, aQ as countOptionLabel, aR as displayPathLocation, aS as getCmsCollection, aT as getCmsCollections, aU as getCmsEntries, aV as getCmsEntry, aW as getListing, aX as getListings, aY as getSearchUi, aZ as getSimilarListings, a_ as getSite, a$ as hrefForAppliedChange, b0 as hrefForPathFilters, b1 as hrefWithExplicitPage, b2 as isListingDetailPath, b3 as isMapBounds, b4 as isMapPolygon, b5 as listingLocationLabel, b6 as mapClusterCellDegrees, b7 as mapSearchPins, b8 as paginationPages, b9 as pathFilterHasOption, ba as pathFilterValue, bb as publicSearchHref, bc as queryListings, bd as rangeDraftFromPath, be as readPublicSearch, bf as searchChromeModel, bg as searchHrefUsesLegacyFilterQuery, bh as searchListings, bi as searchListingsInBounds, bj as searchListingsInPolygon, bk as searchResultsHeading, bl as searchSortOptions, bm as toListingCardModel, bn as toolbarFilterIds, bo as visibleSearchFilters } from './types-photo-search-Bmf1f1-Y.js';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Types for the public Share Link API (`GET`/`POST /api/sites/share/{token}`).
|
|
6
|
+
*
|
|
7
|
+
* This mirrors `resolveShareToken()` in Foundation
|
|
8
|
+
* (`apps/foundation/os/domain/sites/public/share-token.ts`) — treat it as a
|
|
9
|
+
* public contract (additive changes only), but note it is **today's raw
|
|
10
|
+
* shape**, not the friendly `Listing`/`ListingDetail` contract `getListing`
|
|
11
|
+
* returns. Field-visibility masking (price/address/agent redaction per the
|
|
12
|
+
* tenant's sharing config) is already applied server-side before you see
|
|
13
|
+
* this payload — do not try to "fix" a hidden price or address.
|
|
14
|
+
*
|
|
15
|
+
* For `entityType === "listing"`, `listing` is the same shape `getListing`
|
|
16
|
+
* returns. Render that. `entity` stays the raw Foundation payload.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** Entity kinds a share token can point at. Only `"listing"` is typed in
|
|
20
|
+
* detail today; the rest pass through as raw records pending follow-up
|
|
21
|
+
* work. */
|
|
22
|
+
type ShareEntityType = "listing" | "shortlist" | "seller_report" | "visit_itinerary" | "pricing_tool" | "visit_survey" | "form" | (string & {});
|
|
23
|
+
/** Why `getShareLink` failed. Maps 1:1 to `resolveShareToken`'s reasons. */
|
|
24
|
+
type ShareLinkErrorReason = "not_found" | "inactive" | "expired" | "password_required" | "password_invalid" | (string & {});
|
|
25
|
+
/** Raw listing + property fields for a `listing`-type share token.
|
|
26
|
+
* Foundation-internal column names — distinct from the public `Listing`
|
|
27
|
+
* type's field names (e.g. `parkingSpots` here vs. `parkingSpaces` there).
|
|
28
|
+
* See the module doc: a normalized, `ListingDetail`-shaped field is
|
|
29
|
+
* planned as an additive follow-up. */
|
|
30
|
+
interface ShareListingEntity {
|
|
31
|
+
listing: {
|
|
32
|
+
id: string;
|
|
33
|
+
title: string;
|
|
34
|
+
description: string | null;
|
|
35
|
+
price: number | null;
|
|
36
|
+
currency: string | null;
|
|
37
|
+
priceVisibility: string | null;
|
|
38
|
+
listingType: string | null;
|
|
39
|
+
listingCode: string | null;
|
|
40
|
+
stage: string | null;
|
|
41
|
+
status: string | null;
|
|
42
|
+
visibility: string | null;
|
|
43
|
+
createdAt: string | null;
|
|
44
|
+
publishedAt: string | null;
|
|
45
|
+
propertyId: string | null;
|
|
46
|
+
isPrimaryMarket: boolean | null;
|
|
47
|
+
typologyId: string | null;
|
|
48
|
+
};
|
|
49
|
+
property: Record<string, unknown> | null;
|
|
50
|
+
media: Array<{
|
|
51
|
+
id: string;
|
|
52
|
+
src: string;
|
|
53
|
+
alt?: string;
|
|
54
|
+
type: "image" | "video" | "tour";
|
|
55
|
+
category?: string;
|
|
56
|
+
order?: number;
|
|
57
|
+
isPrimary?: boolean;
|
|
58
|
+
entityType?: string;
|
|
59
|
+
}>;
|
|
60
|
+
[key: string]: unknown;
|
|
61
|
+
}
|
|
62
|
+
/** Share-token metadata echoed back on a successful resolve. */
|
|
63
|
+
interface ShareLinkToken {
|
|
64
|
+
entityType: ShareEntityType;
|
|
65
|
+
entityId: string;
|
|
66
|
+
[key: string]: unknown;
|
|
67
|
+
}
|
|
68
|
+
/** Successful `getShareLink` result. */
|
|
69
|
+
interface ShareLinkSuccess {
|
|
70
|
+
ok: true;
|
|
71
|
+
/** `entity` is typed for `entityType === "listing"`; narrow with a type
|
|
72
|
+
* guard (`result.token.entityType === "listing"`) before reading
|
|
73
|
+
* listing-specific fields on other entity types. */
|
|
74
|
+
token: ShareLinkToken;
|
|
75
|
+
entity: ShareListingEntity | Record<string, unknown>;
|
|
76
|
+
branding?: Record<string, unknown>;
|
|
77
|
+
agentInfo?: Record<string, unknown>;
|
|
78
|
+
tenantConfig?: Record<string, unknown>;
|
|
79
|
+
site?: Record<string, unknown>;
|
|
80
|
+
shareDisplayConfig?: Record<string, unknown>;
|
|
81
|
+
requestConfig?: Record<string, unknown>;
|
|
82
|
+
offerForm?: Record<string, unknown>;
|
|
83
|
+
tenantId: string;
|
|
84
|
+
/**
|
|
85
|
+
* Present for `entityType === "listing"` once Foundation attaches the
|
|
86
|
+
* public `getListing` shape. Render this with the same listing-detail
|
|
87
|
+
* module as `/imoveis`. Absent on older payloads and on other entity types.
|
|
88
|
+
*/
|
|
89
|
+
listing?: ListingDetail;
|
|
90
|
+
}
|
|
91
|
+
/** Failed `getShareLink` result. Branch UI on `reason`, not just `status`.
|
|
92
|
+
* `listingCode` / `site` are present on some errors (e.g. `password_required`
|
|
93
|
+
* for a listing share) so a password gate can still show which listing it's
|
|
94
|
+
* for. */
|
|
95
|
+
interface ShareLinkError {
|
|
96
|
+
ok: false;
|
|
97
|
+
status: number;
|
|
98
|
+
reason: ShareLinkErrorReason | null;
|
|
99
|
+
message: string;
|
|
100
|
+
listingCode?: string;
|
|
101
|
+
site?: Record<string, unknown>;
|
|
102
|
+
}
|
|
103
|
+
type ShareLinkResult = ShareLinkSuccess | ShareLinkError;
|
|
104
|
+
|
|
105
|
+
interface GetShareLinkOptions {
|
|
106
|
+
/** The `{token}` from a `/p/{token}` (or `/s`, `/i`, `/r`, `/c`) URL. */
|
|
107
|
+
token: string;
|
|
108
|
+
/** Password for a password-protected share. Sends a POST when present,
|
|
109
|
+
* a GET otherwise — matches the Foundation route's contract. */
|
|
110
|
+
password?: string;
|
|
111
|
+
/** Garagem API base URL. Defaults to `https://app.garagem.ai`. */
|
|
112
|
+
baseUrl?: string;
|
|
113
|
+
/** Override the fetch implementation (testing, edge runtimes, retries). */
|
|
114
|
+
fetch?: FetchLike;
|
|
115
|
+
/** Next.js App Router caching hints. Ignored on runtimes that don't
|
|
116
|
+
* understand them. Share links are per-visitor and often
|
|
117
|
+
* password/expiry-gated — avoid caching this call in production unless
|
|
118
|
+
* you know the token is long-lived and public. */
|
|
119
|
+
next?: RequestNextOptions;
|
|
120
|
+
/**
|
|
121
|
+
* Site publishable key (`pk_live_…`) from Configurações → Sites → API
|
|
122
|
+
* pública. Not a secret. Omit it and the request stays anonymous.
|
|
123
|
+
*/
|
|
124
|
+
publishableKey?: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Resolve a share-link token (`/p/{token}` and friends) against Foundation's
|
|
128
|
+
* public share-link API.
|
|
129
|
+
*
|
|
130
|
+
* Unlike {@link import("./fetchers").getListing}, this does **not** throw on
|
|
131
|
+
* a 401/403/404/410 — those are expected, UI-relevant outcomes for a share
|
|
132
|
+
* page (password gate, expired link, not found), returned as
|
|
133
|
+
* `{ ok: false, reason, ... }` so the caller can branch instead of catching.
|
|
134
|
+
* Genuine transport/5xx failures still throw {@link GaragemSdkError}.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* const result = await getShareLink({ token });
|
|
138
|
+
* if (!result.ok && result.reason === "password_required") {
|
|
139
|
+
* // render a password form, then retry with `password`
|
|
140
|
+
* }
|
|
141
|
+
* if (!result.ok) {
|
|
142
|
+
* // "not_found" | "inactive" | "expired" | other -> not-available state
|
|
143
|
+
* }
|
|
144
|
+
* // result.ok === true: result.entity (today's raw shape — see
|
|
145
|
+
* // types-share.ts doc for the planned normalized `listing` field)
|
|
146
|
+
*/
|
|
147
|
+
declare function getShareLink(options: GetShareLinkOptions): Promise<ShareLinkResult>;
|
|
148
|
+
|
|
4
149
|
/**
|
|
5
150
|
* Visit-lead schedule: hours in, slots out. Pure — no fetch, no React.
|
|
6
151
|
* Calendar dates are civil dates in `timeZone` (America/Sao_Paulo), never
|
|
@@ -650,10 +795,25 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
650
795
|
*/
|
|
651
796
|
readonly sellerLeadExports: readonly ["submitSellerLead", "uploadSellerLeadPhoto", "sellerAddressErrors", "sellerPhotoSchedule", "isValidEmail", "isValidName"];
|
|
652
797
|
readonly sellerLeadSince: "0.10.0";
|
|
798
|
+
/**
|
|
799
|
+
* Share-link page (`/p/[token]`). Prompt-safe only once `minNpmVersion`
|
|
800
|
+
* reaches `shareLinkSince`. Below it `studioShareLinkInstruction` prints
|
|
801
|
+
* nothing and `studioCodegenContractViolations` flags `getShareLink` —
|
|
802
|
+
* v0 installs the pin and copies any identifier it sees.
|
|
803
|
+
*/
|
|
804
|
+
readonly shareExports: readonly ["getShareLink"];
|
|
805
|
+
readonly shareLinkSince: "0.12.0";
|
|
653
806
|
};
|
|
654
807
|
type StudioSdkContract = typeof STUDIO_SDK_CONTRACT;
|
|
655
808
|
/** Whether the pinned tarball carries the seller-lead surface. */
|
|
656
809
|
declare function isSellerLeadOnPin(pin?: string): boolean;
|
|
810
|
+
/** Whether the pinned tarball exports `getShareLink`. */
|
|
811
|
+
declare function isShareLinkOnPin(pin?: string): boolean;
|
|
812
|
+
/**
|
|
813
|
+
* Native `/p/[token]` page. Empty below `shareLinkSince`, so the current
|
|
814
|
+
* Studio prompt does not mention `getShareLink`.
|
|
815
|
+
*/
|
|
816
|
+
declare function studioShareLinkInstruction(pin?: string): string;
|
|
657
817
|
/**
|
|
658
818
|
* Fixed SDK half of the property-registration page. The configured fields
|
|
659
819
|
* and photo options come from the Studio onboarding block. Empty below
|
|
@@ -1367,4 +1527,4 @@ declare function resolveMatchedCoverPhoto(photo: MatchedListingPhoto | null | un
|
|
|
1367
1527
|
*/
|
|
1368
1528
|
declare function applyMatchedPhotoCover<T extends Listing>(cards: ReadonlyArray<T>, photoResults: PhotoSearchResult | ReadonlyArray<PhotoSearchItem> | null | undefined, options?: ApplyMatchedPhotoCoverOptions): Array<T & ListingWithMatchedPhoto>;
|
|
1369
1529
|
|
|
1370
|
-
export { AMENITY_FALLBACK_LABELS, type AmenityLabelDictionary, type AmenityLabelOption, AppliedSearchChange, AppliedSearchQuery, type ApplyMatchedPhotoCoverOptions, BoundaryCity, BoundaryLayer, BoundaryLayerOptions, CmsCollection, CmsEntriesResult, CmsEntry, type ContactLeadInput, type CreateGaragemClientOptions, DEFAULT_MAPS_BASE_URL, DEFAULT_PHONE_COUNTRY_CODE, FetchLike, type GaragemClient, type GetLeadUiOptions, type GetListingMarketPositionOptions, type GetNeighborhoodSummaryOptions, type GetSimilarByPhotoOptions, type HHmm, LISTING_AMENITY_TITLES, LISTING_DESCRIPTION_CLAMP, type LeadContact, type LeadField, type LeadFieldId, LeadSubmitError, type LeadSubmitErrorCode, type LeadSubmitResult, type LeadUi, Listing, type ListingAmenityGroup, type ListingAmenityGroupKey, type ListingAmenitySource, type ListingBreadcrumbCrumb, type ListingDescriptionPreview, ListingDetail, type ListingDetailFieldsModel, type ListingDetailFieldsSource, type ListingDetailModel, type ListingFact, ListingFilters, ListingLocation, type ListingLocationBlock, type ListingMarketPosition, ListingMedia, type ListingMediaOverlay, type ListingPhotoGroup, type ListingValue, type ListingVisualHighlightsOptions, ListingWithLocation, ListingWithMatchedPhoto, ListingsResult, type LocationFilterInput, MAPS_MAX_IMAGE_EDGE, MAPS_SITE_HEADER, MATCHED_PHOTO_COVER_MAX_DISTANCE, MAX_NATIONAL_PHONE_DIGITS, MapsCoordinates, MapsFetchOptions, type MarketListingType, type MarketPriceBand, type MarketPropertyType, type MarketUnavailableReason, MatchedListingPhoto, NeighborhoodBoundary, NeighborhoodBoundaryOptions, type NeighborhoodSummary, type NeighborhoodSummaryQuery, PHONE_COUNTRIES, PHOTO_GROUP_OTHER_KEY, PHOTO_GROUP_OTHER_LABEL, PHOTO_SEARCH_MIN_QUERY_LENGTH, type ParsedPhoneInput, type PhoneCountry, PhotoSearchItem, PhotoSearchParams, PhotoSearchResult, type PriceEstimate, type PriceEstimateConfidence, type PriceEstimateInput, QueryListingsFilters, QueryListingsParams, QueryListingsResult, RequestNextOptions, type RequestPriceEstimateOptions, type ResolvePublicSiteIdOptions, SELLER_LEAD_PHOTO_MAX_BYTES, SELLER_LEAD_PHOTO_MAX_COUNT, SELLER_LEAD_PHOTO_TYPES, STUDIO_DEFAULT_PHOTO_SCHEDULE_CONFIG, STUDIO_DEFAULT_VISIT_SCHEDULE, STUDIO_SDK_CONTRACT, STUDIO_SDK_PACKAGE, STUDIO_SITE_LAYOUT, type SearchListingPhotosOptions, SearchListingsParams, SearchListingsResult, SearchPathFilters, SearchUi, SearchUiDictionary, type SellerAddressErrors, type SellerAddressField, type SellerBusinessType, type SellerLeadAddress, type SellerLeadInput, type SellerLeadProperty, type SellerPhotoScheduleConfig, type SimilarByPhotoItem, type SimilarByPhotoResult, SimilarListingsResult, type SimilarPhotoMatch, Site, StaticMapOptions, StreetViewAvailability, StreetViewAvailabilityOptions, StreetViewOptions, type StudioSdkContract, TravelDestination, TravelMode, TravelTime, TravelTimeCache, TravelTimeCacheOptions, TravelTimeElement, TravelTimeOptions, TravelTimesOptions, type UploadSellerLeadPhotoInput, VISIT_TIME_ZONE, type VisitHours, type VisitLeadInput, type VisitSchedule, type VisitScheduleConfig, applyMatchedPhotoCover, boundaryCitySlug, boundaryLayerId, boundaryLayerUrl, clearTravelTimeCache, coarsenCoordinates, coerceNpmVersion, collapseDuplicatedBrazilianMobileNine, compareSemver, composeSearchPublicHref, composeSearchPublicPath, coordinateDecimals, createClient, createGaragemClient, createTravelTimeCache, defaultPhoneCountry, expandVisitSchedule, expandVisitTimeSlots, findPhoneCountry, formatAreaM2, formatGroupedInteger, formatListingPrice, formatPhoneNational, getBoundaryLayer, getLeadUi, getListingMarketPosition, getNeighborhoodSummary, getSimilarByPhoto, hasShowcaseLeadsPostUrl, isPhotoSearchOnPin, isSellerLeadOnPin, isStudioPreviewHost, isValidEmail, isValidName, isValidPhone, isVisitSlotAllowed, labelAmenities, listingAmenityGroups, listingBreadcrumb, listingBusinessLabel, listingCoordinates, listingDescriptionPreview, listingDetailFieldsModel, listingDetailModel, listingFacts, listingLocationBlock, listingLookupKey, listingMapsHref, listingMediaOverlays, listingPhotoGroups, listingPublicPath, listingStaticMapUrl, listingStreetViewAvailable, listingStreetViewMetadataUrl, listingStreetViewUrl, listingValues, listingVisualHighlights, mapsExportsPublished, marketExportsAvailableAt, marketPositionLabel, maxZoomForCoordinates, mergeAppliedSearchQueryIntoSearch, nationalPhoneDigits, neighborhoodBoundaryLayer, neighborhoodBoundaryUrl, normalizeMapsBaseUrl, normalizeVisitDate, normalizeVisitTime, parseAppliedSearchQuery, parseGroupedInteger, parsePhoneInput, parseReactSdkNamedImports, parseSearchPublicPath, pathFiltersToQueryFilters, pathLocationToFilterInput, phoneCountrySearchValue, photoRoomLabel, photoSearchUrl, priceBandLabel, reduceAppliedSearchQuery, remaskPhoneForCountry, requestPriceEstimate, resolveMatchedCoverPhoto, resolvePublicSiteId, resolveTravelDestination, searchListingPhotos, sellerAddressErrors, sellerPhotoSchedule, serializeAppliedSearchQuery, slotsForDate, studioAmenityInstruction, studioChromeInstruction, studioCodegenContractViolations, studioDefaultLeadUi, studioLayoutInstruction, studioLeadInstruction, studioListingCardInstruction, studioListingDetailInstruction, studioMapSearchInstruction, studioMapsInstruction, studioMarketInstruction, studioPhotoInstruction, studioPhotoInstructionFor, studioPhotoSearchInstruction, studioPublishableKeyInstruction, studioSdkPinInstruction, studioSearchInstruction, studioSearchLandmarkInstruction, studioSellerLeadSdkInstruction, studioSiteWidthCss, submitContactLead, submitSellerLead, submitVisitLead, toE164, travelTimeCacheKey, travelTimeFromListing, travelTimesFromListing, truncateNationalPhoneDigits, unavailableReactImports, uploadSellerLeadPhoto };
|
|
1530
|
+
export { AMENITY_FALLBACK_LABELS, type AmenityLabelDictionary, type AmenityLabelOption, AppliedSearchChange, AppliedSearchQuery, type ApplyMatchedPhotoCoverOptions, BoundaryCity, BoundaryLayer, BoundaryLayerOptions, CmsCollection, CmsEntriesResult, CmsEntry, type ContactLeadInput, type CreateGaragemClientOptions, DEFAULT_MAPS_BASE_URL, DEFAULT_PHONE_COUNTRY_CODE, FetchLike, type GaragemClient, type GetLeadUiOptions, type GetListingMarketPositionOptions, type GetNeighborhoodSummaryOptions, type GetShareLinkOptions, type GetSimilarByPhotoOptions, type HHmm, LISTING_AMENITY_TITLES, LISTING_DESCRIPTION_CLAMP, type LeadContact, type LeadField, type LeadFieldId, LeadSubmitError, type LeadSubmitErrorCode, type LeadSubmitResult, type LeadUi, Listing, type ListingAmenityGroup, type ListingAmenityGroupKey, type ListingAmenitySource, type ListingBreadcrumbCrumb, type ListingDescriptionPreview, ListingDetail, type ListingDetailFieldsModel, type ListingDetailFieldsSource, type ListingDetailModel, type ListingFact, ListingFilters, ListingLocation, type ListingLocationBlock, type ListingMarketPosition, ListingMedia, type ListingMediaOverlay, type ListingPhotoGroup, type ListingValue, type ListingVisualHighlightsOptions, ListingWithLocation, ListingWithMatchedPhoto, ListingsResult, type LocationFilterInput, MAPS_MAX_IMAGE_EDGE, MAPS_SITE_HEADER, MATCHED_PHOTO_COVER_MAX_DISTANCE, MAX_NATIONAL_PHONE_DIGITS, MapsCoordinates, MapsFetchOptions, type MarketListingType, type MarketPriceBand, type MarketPropertyType, type MarketUnavailableReason, MatchedListingPhoto, NeighborhoodBoundary, NeighborhoodBoundaryOptions, type NeighborhoodSummary, type NeighborhoodSummaryQuery, PHONE_COUNTRIES, PHOTO_GROUP_OTHER_KEY, PHOTO_GROUP_OTHER_LABEL, PHOTO_SEARCH_MIN_QUERY_LENGTH, type ParsedPhoneInput, type PhoneCountry, PhotoSearchItem, PhotoSearchParams, PhotoSearchResult, type PriceEstimate, type PriceEstimateConfidence, type PriceEstimateInput, QueryListingsFilters, QueryListingsParams, QueryListingsResult, RequestNextOptions, type RequestPriceEstimateOptions, type ResolvePublicSiteIdOptions, SELLER_LEAD_PHOTO_MAX_BYTES, SELLER_LEAD_PHOTO_MAX_COUNT, SELLER_LEAD_PHOTO_TYPES, STUDIO_DEFAULT_PHOTO_SCHEDULE_CONFIG, STUDIO_DEFAULT_VISIT_SCHEDULE, STUDIO_SDK_CONTRACT, STUDIO_SDK_PACKAGE, STUDIO_SITE_LAYOUT, type SearchListingPhotosOptions, SearchListingsParams, SearchListingsResult, SearchPathFilters, SearchUi, SearchUiDictionary, type SellerAddressErrors, type SellerAddressField, type SellerBusinessType, type SellerLeadAddress, type SellerLeadInput, type SellerLeadProperty, type SellerPhotoScheduleConfig, type ShareEntityType, type ShareLinkError, type ShareLinkErrorReason, type ShareLinkResult, type ShareLinkSuccess, type ShareLinkToken, type ShareListingEntity, type SimilarByPhotoItem, type SimilarByPhotoResult, SimilarListingsResult, type SimilarPhotoMatch, Site, StaticMapOptions, StreetViewAvailability, StreetViewAvailabilityOptions, StreetViewOptions, type StudioSdkContract, TravelDestination, TravelMode, TravelTime, TravelTimeCache, TravelTimeCacheOptions, TravelTimeElement, TravelTimeOptions, TravelTimesOptions, type UploadSellerLeadPhotoInput, VISIT_TIME_ZONE, type VisitHours, type VisitLeadInput, type VisitSchedule, type VisitScheduleConfig, applyMatchedPhotoCover, boundaryCitySlug, boundaryLayerId, boundaryLayerUrl, clearTravelTimeCache, coarsenCoordinates, coerceNpmVersion, collapseDuplicatedBrazilianMobileNine, compareSemver, composeSearchPublicHref, composeSearchPublicPath, coordinateDecimals, createClient, createGaragemClient, createTravelTimeCache, defaultPhoneCountry, expandVisitSchedule, expandVisitTimeSlots, findPhoneCountry, formatAreaM2, formatGroupedInteger, formatListingPrice, formatPhoneNational, getBoundaryLayer, getLeadUi, getListingMarketPosition, getNeighborhoodSummary, getShareLink, getSimilarByPhoto, hasShowcaseLeadsPostUrl, isPhotoSearchOnPin, isSellerLeadOnPin, isShareLinkOnPin, isStudioPreviewHost, isValidEmail, isValidName, isValidPhone, isVisitSlotAllowed, labelAmenities, listingAmenityGroups, listingBreadcrumb, listingBusinessLabel, listingCoordinates, listingDescriptionPreview, listingDetailFieldsModel, listingDetailModel, listingFacts, listingLocationBlock, listingLookupKey, listingMapsHref, listingMediaOverlays, listingPhotoGroups, listingPublicPath, listingStaticMapUrl, listingStreetViewAvailable, listingStreetViewMetadataUrl, listingStreetViewUrl, listingValues, listingVisualHighlights, mapsExportsPublished, marketExportsAvailableAt, marketPositionLabel, maxZoomForCoordinates, mergeAppliedSearchQueryIntoSearch, nationalPhoneDigits, neighborhoodBoundaryLayer, neighborhoodBoundaryUrl, normalizeMapsBaseUrl, normalizeVisitDate, normalizeVisitTime, parseAppliedSearchQuery, parseGroupedInteger, parsePhoneInput, parseReactSdkNamedImports, parseSearchPublicPath, pathFiltersToQueryFilters, pathLocationToFilterInput, phoneCountrySearchValue, photoRoomLabel, photoSearchUrl, priceBandLabel, reduceAppliedSearchQuery, remaskPhoneForCountry, requestPriceEstimate, resolveMatchedCoverPhoto, resolvePublicSiteId, resolveTravelDestination, searchListingPhotos, sellerAddressErrors, sellerPhotoSchedule, serializeAppliedSearchQuery, slotsForDate, studioAmenityInstruction, studioChromeInstruction, studioCodegenContractViolations, studioDefaultLeadUi, studioLayoutInstruction, studioLeadInstruction, studioListingCardInstruction, studioListingDetailInstruction, studioMapSearchInstruction, studioMapsInstruction, studioMarketInstruction, studioPhotoInstruction, studioPhotoInstructionFor, studioPhotoSearchInstruction, studioPublishableKeyInstruction, studioSdkPinInstruction, studioSearchInstruction, studioSearchLandmarkInstruction, studioSellerLeadSdkInstruction, studioShareLinkInstruction, studioSiteWidthCss, submitContactLead, submitSellerLead, submitVisitLead, toE164, travelTimeCacheKey, travelTimeFromListing, travelTimesFromListing, truncateNationalPhoneDigits, unavailableReactImports, uploadSellerLeadPhoto };
|
package/dist/index.js
CHANGED
|
@@ -97,6 +97,7 @@ __export(src_exports, {
|
|
|
97
97
|
getListings: () => getListings,
|
|
98
98
|
getNeighborhoodSummary: () => getNeighborhoodSummary,
|
|
99
99
|
getSearchUi: () => getSearchUi,
|
|
100
|
+
getShareLink: () => getShareLink,
|
|
100
101
|
getSimilarByPhoto: () => getSimilarByPhoto,
|
|
101
102
|
getSimilarListings: () => getSimilarListings,
|
|
102
103
|
getSite: () => getSite,
|
|
@@ -109,6 +110,7 @@ __export(src_exports, {
|
|
|
109
110
|
isMapPolygon: () => isMapPolygon,
|
|
110
111
|
isPhotoSearchOnPin: () => isPhotoSearchOnPin,
|
|
111
112
|
isSellerLeadOnPin: () => isSellerLeadOnPin,
|
|
113
|
+
isShareLinkOnPin: () => isShareLinkOnPin,
|
|
112
114
|
isStudioPreviewHost: () => isStudioPreviewHost,
|
|
113
115
|
isValidEmail: () => isValidEmail,
|
|
114
116
|
isValidName: () => isValidName,
|
|
@@ -204,6 +206,7 @@ __export(src_exports, {
|
|
|
204
206
|
studioSearchInstruction: () => studioSearchInstruction,
|
|
205
207
|
studioSearchLandmarkInstruction: () => studioSearchLandmarkInstruction,
|
|
206
208
|
studioSellerLeadSdkInstruction: () => studioSellerLeadSdkInstruction,
|
|
209
|
+
studioShareLinkInstruction: () => studioShareLinkInstruction,
|
|
207
210
|
studioSiteWidthCss: () => studioSiteWidthCss,
|
|
208
211
|
submitContactLead: () => submitContactLead,
|
|
209
212
|
submitSellerLead: () => submitSellerLead,
|
|
@@ -660,6 +663,48 @@ async function getCmsEntry(options) {
|
|
|
660
663
|
return data;
|
|
661
664
|
}
|
|
662
665
|
|
|
666
|
+
// src/share.ts
|
|
667
|
+
async function getShareLink(options) {
|
|
668
|
+
const { token, password, baseUrl, fetch: fetchImpl, next } = options;
|
|
669
|
+
if (!token || !token.trim()) {
|
|
670
|
+
throw new TypeError("getShareLink: `token` is required");
|
|
671
|
+
}
|
|
672
|
+
const base = normalizeBaseUrl(baseUrl);
|
|
673
|
+
const url = `${base}/api/sites/share/${encodeURIComponent(token)}`;
|
|
674
|
+
const doFetch = fetchImpl ?? fetch;
|
|
675
|
+
const baseInit = password ? {
|
|
676
|
+
method: "POST",
|
|
677
|
+
headers: {
|
|
678
|
+
Accept: "application/json",
|
|
679
|
+
"Content-Type": "application/json"
|
|
680
|
+
},
|
|
681
|
+
body: JSON.stringify({ password }),
|
|
682
|
+
next
|
|
683
|
+
} : { method: "GET", headers: { Accept: "application/json" }, next };
|
|
684
|
+
const init = withPublishableKeyHeader(baseInit, options.publishableKey);
|
|
685
|
+
const response = await doFetch(url, init);
|
|
686
|
+
if (response.ok) {
|
|
687
|
+
return { ok: true, ...await response.json() };
|
|
688
|
+
}
|
|
689
|
+
const EXPECTED_STATUSES = /* @__PURE__ */ new Set([400, 401, 403, 404, 410]);
|
|
690
|
+
if (EXPECTED_STATUSES.has(response.status)) {
|
|
691
|
+
const body = await response.json().catch(() => ({}));
|
|
692
|
+
return {
|
|
693
|
+
ok: false,
|
|
694
|
+
status: response.status,
|
|
695
|
+
reason: body.reason ?? null,
|
|
696
|
+
message: body.error ?? "Share link unavailable",
|
|
697
|
+
...body.listingCode ? { listingCode: body.listingCode } : {},
|
|
698
|
+
...body.site ? { site: body.site } : {}
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
const text2 = await response.text().catch(() => "");
|
|
702
|
+
throw new GaragemSdkError(
|
|
703
|
+
`Garagem SDK: request failed (${response.status} ${response.statusText}) for ${url}${text2 ? ` \u2014 ${text2.slice(0, 200)}` : ""}`,
|
|
704
|
+
{ status: response.status, url }
|
|
705
|
+
);
|
|
706
|
+
}
|
|
707
|
+
|
|
663
708
|
// src/schedule.ts
|
|
664
709
|
var VISIT_TIME_ZONE = "America/Sao_Paulo";
|
|
665
710
|
var HHMM_RE = /^([01]\d|2[0-3]):([0-5]\d)$/;
|
|
@@ -3464,11 +3509,27 @@ var STUDIO_SDK_CONTRACT = {
|
|
|
3464
3509
|
"isValidEmail",
|
|
3465
3510
|
"isValidName"
|
|
3466
3511
|
],
|
|
3467
|
-
sellerLeadSince: "0.10.0"
|
|
3512
|
+
sellerLeadSince: "0.10.0",
|
|
3513
|
+
/**
|
|
3514
|
+
* Share-link page (`/p/[token]`). Prompt-safe only once `minNpmVersion`
|
|
3515
|
+
* reaches `shareLinkSince`. Below it `studioShareLinkInstruction` prints
|
|
3516
|
+
* nothing and `studioCodegenContractViolations` flags `getShareLink` —
|
|
3517
|
+
* v0 installs the pin and copies any identifier it sees.
|
|
3518
|
+
*/
|
|
3519
|
+
shareExports: ["getShareLink"],
|
|
3520
|
+
shareLinkSince: "0.12.0"
|
|
3468
3521
|
};
|
|
3469
3522
|
function isSellerLeadOnPin(pin = STUDIO_SDK_CONTRACT.minNpmVersion) {
|
|
3470
3523
|
return compareSemver(pin, STUDIO_SDK_CONTRACT.sellerLeadSince) >= 0;
|
|
3471
3524
|
}
|
|
3525
|
+
function isShareLinkOnPin(pin = STUDIO_SDK_CONTRACT.minNpmVersion) {
|
|
3526
|
+
return compareSemver(pin, STUDIO_SDK_CONTRACT.shareLinkSince) >= 0;
|
|
3527
|
+
}
|
|
3528
|
+
function studioShareLinkInstruction(pin = STUDIO_SDK_CONTRACT.minNpmVersion) {
|
|
3529
|
+
if (!isShareLinkOnPin(pin)) return "";
|
|
3530
|
+
const name = STUDIO_SDK_CONTRACT.shareExports[0];
|
|
3531
|
+
return `Share links (\`/p/[token]\`): add a server page \`app/p/[token]/page.tsx\`. Read \`token\` from the route params and \`const result = await ${name}({ token, baseUrl: GARAGEM_API_BASE })\`. When \`result.ok\` is false and \`result.reason\` is \`password_required\` or \`password_invalid\`, render a password form and submit \`getShareLink({ token, password, baseUrl: GARAGEM_API_BASE })\`. For \`not_found\`, \`inactive\`, or \`expired\`, say the link is no longer available \u2014 do not render a generic framework 404. When \`result.ok\` and \`result.listing\` is set, render that listing with the same listing-detail module \`/imoveis\` already uses (\`listingDetailModel\` and the site gallery). Do not invent a second listing layout and do not proxy the page to another host.`;
|
|
3532
|
+
}
|
|
3472
3533
|
function studioSellerLeadSdkInstruction(pin = STUDIO_SDK_CONTRACT.minNpmVersion) {
|
|
3473
3534
|
if (!isSellerLeadOnPin(pin)) return "";
|
|
3474
3535
|
const names = STUDIO_SDK_CONTRACT.sellerLeadExports.join(", ");
|
|
@@ -3714,6 +3775,13 @@ function studioCodegenContractViolations(text2) {
|
|
|
3714
3775
|
}
|
|
3715
3776
|
}
|
|
3716
3777
|
}
|
|
3778
|
+
if (!isShareLinkOnPin()) {
|
|
3779
|
+
for (const name of STUDIO_SDK_CONTRACT.shareExports) {
|
|
3780
|
+
if (mentionsExportName(text2, name) && !violations.includes(name)) {
|
|
3781
|
+
violations.push(name);
|
|
3782
|
+
}
|
|
3783
|
+
}
|
|
3784
|
+
}
|
|
3717
3785
|
const pin = STUDIO_SDK_CONTRACT.minNpmVersion;
|
|
3718
3786
|
if (!marketExportsAvailableAt(pin)) {
|
|
3719
3787
|
for (const name of STUDIO_SDK_CONTRACT.marketExports) {
|
|
@@ -5126,6 +5194,7 @@ function applyMatchedPhotoCover(cards, photoResults, options = {}) {
|
|
|
5126
5194
|
getListings,
|
|
5127
5195
|
getNeighborhoodSummary,
|
|
5128
5196
|
getSearchUi,
|
|
5197
|
+
getShareLink,
|
|
5129
5198
|
getSimilarByPhoto,
|
|
5130
5199
|
getSimilarListings,
|
|
5131
5200
|
getSite,
|
|
@@ -5138,6 +5207,7 @@ function applyMatchedPhotoCover(cards, photoResults, options = {}) {
|
|
|
5138
5207
|
isMapPolygon,
|
|
5139
5208
|
isPhotoSearchOnPin,
|
|
5140
5209
|
isSellerLeadOnPin,
|
|
5210
|
+
isShareLinkOnPin,
|
|
5141
5211
|
isStudioPreviewHost,
|
|
5142
5212
|
isValidEmail,
|
|
5143
5213
|
isValidName,
|
|
@@ -5233,6 +5303,7 @@ function applyMatchedPhotoCover(cards, photoResults, options = {}) {
|
|
|
5233
5303
|
studioSearchInstruction,
|
|
5234
5304
|
studioSearchLandmarkInstruction,
|
|
5235
5305
|
studioSellerLeadSdkInstruction,
|
|
5306
|
+
studioShareLinkInstruction,
|
|
5236
5307
|
studioSiteWidthCss,
|
|
5237
5308
|
submitContactLead,
|
|
5238
5309
|
submitSellerLead,
|