@garagem-ai/site-sdk 0.5.3 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +106 -12
- package/dist/index.d.ts +106 -12
- package/dist/index.js +440 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +430 -20
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +18 -2
- package/dist/react.d.ts +18 -2
- package/dist/react.js +134 -31
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +135 -32
- package/dist/react.mjs.map +1 -1
- package/dist/{search-engine-CkbO77G8.d.mts → search-engine-CtnLzmwW.d.mts} +2 -0
- package/dist/{search-engine-CkbO77G8.d.ts → search-engine-CtnLzmwW.d.ts} +2 -0
- package/package.json +8 -5
- package/src/index.ts +19 -0
- package/src/leads.ts +45 -6
- package/src/listing-card-model.ts +4 -1
- package/src/listing-detail.ts +6 -1
- package/src/phone-countries.ts +97 -0
- package/src/phone.ts +431 -0
- package/src/react/index.ts +1 -0
- package/src/react/public-search-snapshot.ts +165 -0
- package/src/react/types.ts +17 -0
- package/src/react/use-public-search.ts +91 -32
- package/src/studio-contract.ts +40 -12
- package/src/types.ts +2 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RequestNextOptions, L as ListingFilters, Q as QueryListingsParams, S as SearchListingsParams, C as CmsCollection, a as CmsEntriesResult, b as CmsEntry, c as ListingDetail, d as ListingsResult, e as SearchUi, f as SimilarListingsResult, g as Site, h as QueryListingsResult, i as SearchListingsResult, j as ListingLocation, k as ListingMedia, l as ListingBusinessType, m as ListingPriceVisibility, n as Listing, o as SearchPathFilters, p as SearchUiDictionary, q as QueryListingsFilters, A as AppliedSearchQuery, r as AppliedSearchChange } from './search-engine-
|
|
2
|
-
export { s as CmsEntryStatus, t as CmsFieldDefinition, u as CmsFieldType, v as CmsSeoData, F as FORBIDDEN_SEARCH_QUERY_KEYS, w as ListingPropertySummary, x as LocationNameTables, y as QueryListingsLocation, z as SEARCH_EMPTY_COPY, B as SEARCH_SORT_RELEVANCE, D as SearchChromeModel, E as SearchPathLocation, G as SearchUiFilter, H as SearchUiOption, T as TOOLBAR_PRIMARY_FILTER_IDS, I as applyPathFilter, J as buildQueryListingsParams, K as canonicalizeSearchHref, M as clearStagedPathFilters, N as countFacetChoices, O as countOptionLabel, P as displayPathLocation, U as hrefForAppliedChange, V as hrefForPathFilters, W as hrefWithExplicitPage, X as isListingDetailPath, Y as paginationPages, Z as pathFilterHasOption, _ as pathFilterValue, $ as publicSearchHref, a0 as rangeDraftFromPath, a1 as readPublicSearch, a2 as searchChromeModel, a3 as searchHrefUsesLegacyFilterQuery, a4 as searchResultsHeading, a5 as searchSortOptions, a6 as toolbarFilterIds, a7 as visibleSearchFilters } from './search-engine-
|
|
1
|
+
import { R as RequestNextOptions, L as ListingFilters, Q as QueryListingsParams, S as SearchListingsParams, C as CmsCollection, a as CmsEntriesResult, b as CmsEntry, c as ListingDetail, d as ListingsResult, e as SearchUi, f as SimilarListingsResult, g as Site, h as QueryListingsResult, i as SearchListingsResult, j as ListingLocation, k as ListingMedia, l as ListingBusinessType, m as ListingPriceVisibility, n as Listing, o as SearchPathFilters, p as SearchUiDictionary, q as QueryListingsFilters, A as AppliedSearchQuery, r as AppliedSearchChange } from './search-engine-CtnLzmwW.mjs';
|
|
2
|
+
export { s as CmsEntryStatus, t as CmsFieldDefinition, u as CmsFieldType, v as CmsSeoData, F as FORBIDDEN_SEARCH_QUERY_KEYS, w as ListingPropertySummary, x as LocationNameTables, y as QueryListingsLocation, z as SEARCH_EMPTY_COPY, B as SEARCH_SORT_RELEVANCE, D as SearchChromeModel, E as SearchPathLocation, G as SearchUiFilter, H as SearchUiOption, T as TOOLBAR_PRIMARY_FILTER_IDS, I as applyPathFilter, J as buildQueryListingsParams, K as canonicalizeSearchHref, M as clearStagedPathFilters, N as countFacetChoices, O as countOptionLabel, P as displayPathLocation, U as hrefForAppliedChange, V as hrefForPathFilters, W as hrefWithExplicitPage, X as isListingDetailPath, Y as paginationPages, Z as pathFilterHasOption, _ as pathFilterValue, $ as publicSearchHref, a0 as rangeDraftFromPath, a1 as readPublicSearch, a2 as searchChromeModel, a3 as searchHrefUsesLegacyFilterQuery, a4 as searchResultsHeading, a5 as searchSortOptions, a6 as toolbarFilterIds, a7 as visibleSearchFilters } from './search-engine-CtnLzmwW.mjs';
|
|
3
3
|
|
|
4
4
|
/** Custom fetch implementation. Defaults to the global `fetch`. */
|
|
5
5
|
type FetchLike = typeof fetch;
|
|
@@ -226,6 +226,13 @@ type LeadSubmitBase = LeadContact & {
|
|
|
226
226
|
baseUrl?: string;
|
|
227
227
|
fetch?: FetchLike;
|
|
228
228
|
listingId: string;
|
|
229
|
+
/**
|
|
230
|
+
* Active listing modality (`sale` | `rental` | `rent`). Always pass
|
|
231
|
+
* `listing.businessType`, sale included; the server only fills a missing
|
|
232
|
+
* value from the catalog as a safety net.
|
|
233
|
+
*/
|
|
234
|
+
listingType?: string;
|
|
235
|
+
businessType?: string;
|
|
229
236
|
visitorId?: string;
|
|
230
237
|
brokerRef?: string;
|
|
231
238
|
referrer?: string;
|
|
@@ -358,6 +365,7 @@ type ListingDetailModel = {
|
|
|
358
365
|
};
|
|
359
366
|
declare function listingValues(listing: {
|
|
360
367
|
price?: number | null;
|
|
368
|
+
currency?: string | null;
|
|
361
369
|
priceVisibility?: string | null;
|
|
362
370
|
propertyTaxLabel?: string | null;
|
|
363
371
|
property?: {
|
|
@@ -435,7 +443,7 @@ declare function listingLocationLabel(location: {
|
|
|
435
443
|
city?: string | null;
|
|
436
444
|
state?: string | null;
|
|
437
445
|
}): string;
|
|
438
|
-
declare function toListingCardModel(listing: Pick<Listing, "id" | "listingCode" | "path" | "title" | "businessType" | "price" | "priceVisibility" | "coverImage"> & {
|
|
446
|
+
declare function toListingCardModel(listing: Pick<Listing, "id" | "listingCode" | "path" | "title" | "businessType" | "price" | "currency" | "priceVisibility" | "coverImage"> & {
|
|
439
447
|
property?: {
|
|
440
448
|
type?: string | null;
|
|
441
449
|
bedrooms?: number | null;
|
|
@@ -463,6 +471,79 @@ declare function parseGroupedInteger(value: unknown): number | undefined;
|
|
|
463
471
|
declare function formatAreaM2(area: number | null | undefined): string | null;
|
|
464
472
|
declare function listingBusinessLabel(businessType: string | undefined): string;
|
|
465
473
|
|
|
474
|
+
/**
|
|
475
|
+
* Countries for Studio phone pickers (labels pt-BR).
|
|
476
|
+
* Same catalog shape as `@garagem/ui` PhoneInput — generated sites compose
|
|
477
|
+
* the UI; this list is headless data only.
|
|
478
|
+
*/
|
|
479
|
+
interface PhoneCountry {
|
|
480
|
+
code: string;
|
|
481
|
+
name: string;
|
|
482
|
+
dialCode: string;
|
|
483
|
+
flag: string;
|
|
484
|
+
}
|
|
485
|
+
declare const DEFAULT_PHONE_COUNTRY_CODE = "BR";
|
|
486
|
+
declare const PHONE_COUNTRIES: PhoneCountry[];
|
|
487
|
+
/** cmdk / filter value: name, ISO, DDI, and +DDI so "59" / "+598" both match. */
|
|
488
|
+
declare function phoneCountrySearchValue(country: PhoneCountry): string;
|
|
489
|
+
declare function findPhoneCountry(code: string | null | undefined): PhoneCountry | undefined;
|
|
490
|
+
declare function defaultPhoneCountry(): PhoneCountry;
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Headless phone mask / E.164 helpers for Studio-generated lead forms.
|
|
494
|
+
* UI (country picker, input) stays in the app — same contract as CRM
|
|
495
|
+
* `@garagem/ui` PhoneInput without shipping markup.
|
|
496
|
+
*/
|
|
497
|
+
|
|
498
|
+
/** ITU-T E.164 national number upper bound. */
|
|
499
|
+
declare const MAX_NATIONAL_PHONE_DIGITS = 15;
|
|
500
|
+
declare function nationalPhoneDigits(value: string | null | undefined): string;
|
|
501
|
+
declare function truncateNationalPhoneDigits(digits: string, max?: number): string;
|
|
502
|
+
/**
|
|
503
|
+
* Collapse DDD + extra `9` + 9-digit BR mobile (12 national digits).
|
|
504
|
+
* Matches CRM `collapseDuplicatedBrazilianMobileNine` for common typos.
|
|
505
|
+
*/
|
|
506
|
+
declare function collapseDuplicatedBrazilianMobileNine(digits: string): string;
|
|
507
|
+
/**
|
|
508
|
+
* National display mask for the selected country (`(11) 96690-6900` for BR).
|
|
509
|
+
* Pass national digits or a messy draft; non-digits are stripped.
|
|
510
|
+
*/
|
|
511
|
+
declare function formatPhoneNational(value: string | null | undefined, countryCode?: string): string;
|
|
512
|
+
type ParsedPhoneInput = {
|
|
513
|
+
ddi: string | null;
|
|
514
|
+
national: string;
|
|
515
|
+
countryCode: string | null;
|
|
516
|
+
};
|
|
517
|
+
/**
|
|
518
|
+
* Split E.164 / `+DDI…` paste vs national draft. Without `+`, `ddi` is null
|
|
519
|
+
* and `national` is all digits (country comes from the picker).
|
|
520
|
+
*/
|
|
521
|
+
declare function parsePhoneInput(input: string | null | undefined): ParsedPhoneInput;
|
|
522
|
+
/**
|
|
523
|
+
* Canonical submit value: `+5511966906900`. Empty draft → `""`.
|
|
524
|
+
* Callers that need a guaranteed-valid number should also run `isValidPhone`.
|
|
525
|
+
*/
|
|
526
|
+
declare function toE164(value: string | null | undefined, countryCode?: string): string;
|
|
527
|
+
/**
|
|
528
|
+
* Validate national digits or E.164 for the selected country (CRM-aligned).
|
|
529
|
+
*/
|
|
530
|
+
declare function isValidPhone(value: string | null | undefined, countryCode?: string): boolean;
|
|
531
|
+
/**
|
|
532
|
+
* Re-mask national digits after the visitor changes country (PhoneInput flow).
|
|
533
|
+
*
|
|
534
|
+
* Lossless on purpose, like CRM PhoneInput `handleCountryChange`: the digits
|
|
535
|
+
* already in the field are kept as-is (truncated to E.164 length), only the
|
|
536
|
+
* mask and the dial code change. The accidental dial-prefix strip and the
|
|
537
|
+
* Brazilian extra-9 collapse are for freshly typed/pasted input — running
|
|
538
|
+
* them here against the destination country eats legitimate digits (NANP
|
|
539
|
+
* dial `1` would take the first digit of a BR `11…` national on a toggle).
|
|
540
|
+
*/
|
|
541
|
+
declare function remaskPhoneForCountry(nationalOrDraft: string | null | undefined, countryCode: string): {
|
|
542
|
+
display: string;
|
|
543
|
+
e164: string;
|
|
544
|
+
country: PhoneCountry;
|
|
545
|
+
};
|
|
546
|
+
|
|
466
547
|
declare function composeSearchPublicPath(filters: SearchPathFilters, dictionary?: SearchUiDictionary): string;
|
|
467
548
|
declare function parseSearchPublicPath(pathname: string, dictionary?: SearchUiDictionary): SearchPathFilters | null;
|
|
468
549
|
/**
|
|
@@ -523,11 +604,13 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
523
604
|
* Exact pin for generated Studio sites. Must match a tarball already on
|
|
524
605
|
* npm — v0 installs this version. After a later changeset publishes, bump
|
|
525
606
|
* this and move that release's names from `optionalReactExports` /
|
|
526
|
-
* `unpublishedSearchExports` into the
|
|
527
|
-
* until that tarball is on npm.
|
|
528
|
-
*
|
|
607
|
+
* `unpublishedSearchExports` / `unpublishedPhoneExports` into the
|
|
608
|
+
* prompt-safe lists. Do not bump here until that tarball is on npm.
|
|
609
|
+
* Phone mask helpers shipped in 0.6.0. Search filter helpers
|
|
610
|
+
* (`visibleSearchFilters` / `toolbarFilterIds`) shipped in 0.4.12 and
|
|
611
|
+
* remain on this pin.
|
|
529
612
|
*/
|
|
530
|
-
readonly minNpmVersion: "0.
|
|
613
|
+
readonly minNpmVersion: "0.6.0";
|
|
531
614
|
/** Historical: older tarballs inject card CSS when those components mount. */
|
|
532
615
|
readonly selfInjectSince: "0.4.2";
|
|
533
616
|
readonly chromeStrategy: "app-owned";
|
|
@@ -553,12 +636,23 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
553
636
|
readonly listingDetailExports: readonly ["listingDetailModel", "getSimilarListings"];
|
|
554
637
|
/** Main-package card helpers — markup stays in the generated app. */
|
|
555
638
|
readonly listingCardExports: readonly ["toListingCardModel", "listingPublicPath", "formatAreaM2", "listingBusinessLabel", "formatListingPrice"];
|
|
639
|
+
/**
|
|
640
|
+
* Prompt-safe phone helpers on `minNpmVersion` (published in 0.6.0).
|
|
641
|
+
*/
|
|
642
|
+
readonly phoneExports: readonly ["PHONE_COUNTRIES", "formatPhoneNational", "toE164", "isValidPhone", "parsePhoneInput", "phoneCountrySearchValue", "findPhoneCountry", "remaskPhoneForCountry"];
|
|
643
|
+
/**
|
|
644
|
+
* Headless phone helpers in git but not on `minNpmVersion`. Prompts,
|
|
645
|
+
* completeness, and repair text must not mention these until the pin
|
|
646
|
+
* bumps — v0 installs the pin and the ESM loader throws on missing
|
|
647
|
+
* named exports.
|
|
648
|
+
*/
|
|
649
|
+
readonly unpublishedPhoneExports: readonly [];
|
|
556
650
|
readonly amenityExports: readonly ["listingAmenityGroups"];
|
|
557
651
|
/**
|
|
558
|
-
* Names already on the pinned npm tarball (`minNpmVersion`
|
|
559
|
-
*
|
|
560
|
-
* `
|
|
561
|
-
*
|
|
652
|
+
* Names already on the pinned npm tarball (`minNpmVersion`) — safe for
|
|
653
|
+
* Studio prompts and completeness. Includes `visibleSearchFilters` +
|
|
654
|
+
* `toolbarFilterIds` (shipped in 0.4.12). Do not confuse with
|
|
655
|
+
* `unpublishedSearchExports` (`searchChromeModel`, …).
|
|
562
656
|
*/
|
|
563
657
|
readonly searchExports: readonly ["searchResultsHeading", "searchSortOptions", "visibleSearchFilters", "toolbarFilterIds", "paginationPages", "hrefWithExplicitPage"];
|
|
564
658
|
/**
|
|
@@ -715,4 +809,4 @@ interface GaragemClient {
|
|
|
715
809
|
*/
|
|
716
810
|
declare function createGaragemClient(options?: CreateGaragemClientOptions): GaragemClient;
|
|
717
811
|
|
|
718
|
-
export { AMENITY_FALLBACK_LABELS, type AmenityLabelDictionary, type AmenityLabelOption, AppliedSearchChange, AppliedSearchQuery, CmsCollection, CmsEntriesResult, CmsEntry, type ContactLeadInput, type CreateGaragemClientOptions, type FetchLike, type GaragemClient, GaragemSdkError, type GetCmsCollectionOptions, type GetCmsCollectionsOptions, type GetCmsEntriesOptions, type GetCmsEntryOptions, type GetLeadUiOptions, type GetListingOptions, type GetListingsOptions, type GetSearchUiOptions, type GetSimilarListingsOptions, type GetSiteOptions, 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, ListingBusinessType, type ListingCardModel, type ListingDescriptionPreview, ListingDetail, type ListingDetailFieldsModel, type ListingDetailFieldsSource, type ListingDetailModel, type ListingFact, ListingFilters, ListingLocation, type ListingLocationBlock, ListingMedia, type ListingMediaOverlay, ListingPriceVisibility, type ListingValue, ListingsResult, type LocationFilterInput, QueryListingsFilters, type QueryListingsOptions, QueryListingsParams, QueryListingsResult, RequestNextOptions, type ResolvePublicSiteIdOptions, STUDIO_DEFAULT_VISIT_SCHEDULE, STUDIO_SDK_CONTRACT, STUDIO_SDK_PACKAGE, STUDIO_SITE_LAYOUT, type SearchListingsOptions, SearchListingsParams, SearchListingsResult, SearchPathFilters, SearchUi, SearchUiDictionary, SimilarListingsResult, Site, type StudioSdkContract, VISIT_TIME_ZONE, type VisitHours, type VisitLeadInput, type VisitSchedule, type VisitScheduleConfig, coerceNpmVersion, compareSemver, composeSearchPublicHref, composeSearchPublicPath, createGaragemClient, expandVisitSchedule, expandVisitTimeSlots, formatAreaM2, formatGroupedInteger, formatListingPrice, getCmsCollection, getCmsCollections, getCmsEntries, getCmsEntry, getLeadUi, getListing, getListings, getSearchUi, getSimilarListings, getSite, hasShowcaseLeadsPostUrl, isStudioPreviewHost, isVisitSlotAllowed, labelAmenities, listingAmenityGroups, listingBreadcrumb, listingBusinessLabel, listingDescriptionPreview, listingDetailFieldsModel, listingDetailModel, listingFacts, listingLocationBlock, listingLocationLabel, listingLookupKey, listingMapsHref, listingMediaOverlays, listingPublicPath, listingValues, mergeAppliedSearchQueryIntoSearch, normalizeVisitDate, normalizeVisitTime, parseAppliedSearchQuery, parseGroupedInteger, parseReactSdkNamedImports, parseSearchPublicPath, pathFiltersToQueryFilters, pathLocationToFilterInput, queryListings, reduceAppliedSearchQuery, resolvePublicSiteId, searchListings, serializeAppliedSearchQuery, slotsForDate, studioAmenityInstruction, studioChromeInstruction, studioCodegenContractViolations, studioDefaultLeadUi, studioLayoutInstruction, studioLeadInstruction, studioListingCardInstruction, studioListingDetailInstruction, studioSdkPinInstruction, studioSearchInstruction, studioSearchLandmarkInstruction, studioSiteWidthCss, submitContactLead, submitVisitLead, toListingCardModel, unavailableReactImports };
|
|
812
|
+
export { AMENITY_FALLBACK_LABELS, type AmenityLabelDictionary, type AmenityLabelOption, AppliedSearchChange, AppliedSearchQuery, CmsCollection, CmsEntriesResult, CmsEntry, type ContactLeadInput, type CreateGaragemClientOptions, DEFAULT_PHONE_COUNTRY_CODE, type FetchLike, type GaragemClient, GaragemSdkError, type GetCmsCollectionOptions, type GetCmsCollectionsOptions, type GetCmsEntriesOptions, type GetCmsEntryOptions, type GetLeadUiOptions, type GetListingOptions, type GetListingsOptions, type GetSearchUiOptions, type GetSimilarListingsOptions, type GetSiteOptions, 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, ListingBusinessType, type ListingCardModel, type ListingDescriptionPreview, ListingDetail, type ListingDetailFieldsModel, type ListingDetailFieldsSource, type ListingDetailModel, type ListingFact, ListingFilters, ListingLocation, type ListingLocationBlock, ListingMedia, type ListingMediaOverlay, ListingPriceVisibility, type ListingValue, ListingsResult, type LocationFilterInput, MAX_NATIONAL_PHONE_DIGITS, PHONE_COUNTRIES, type ParsedPhoneInput, type PhoneCountry, QueryListingsFilters, type QueryListingsOptions, QueryListingsParams, QueryListingsResult, RequestNextOptions, type ResolvePublicSiteIdOptions, STUDIO_DEFAULT_VISIT_SCHEDULE, STUDIO_SDK_CONTRACT, STUDIO_SDK_PACKAGE, STUDIO_SITE_LAYOUT, type SearchListingsOptions, SearchListingsParams, SearchListingsResult, SearchPathFilters, SearchUi, SearchUiDictionary, SimilarListingsResult, Site, type StudioSdkContract, VISIT_TIME_ZONE, type VisitHours, type VisitLeadInput, type VisitSchedule, type VisitScheduleConfig, coerceNpmVersion, collapseDuplicatedBrazilianMobileNine, compareSemver, composeSearchPublicHref, composeSearchPublicPath, createGaragemClient, defaultPhoneCountry, expandVisitSchedule, expandVisitTimeSlots, findPhoneCountry, formatAreaM2, formatGroupedInteger, formatListingPrice, formatPhoneNational, getCmsCollection, getCmsCollections, getCmsEntries, getCmsEntry, getLeadUi, getListing, getListings, getSearchUi, getSimilarListings, getSite, hasShowcaseLeadsPostUrl, isStudioPreviewHost, isValidPhone, isVisitSlotAllowed, labelAmenities, listingAmenityGroups, listingBreadcrumb, listingBusinessLabel, listingDescriptionPreview, listingDetailFieldsModel, listingDetailModel, listingFacts, listingLocationBlock, listingLocationLabel, listingLookupKey, listingMapsHref, listingMediaOverlays, listingPublicPath, listingValues, mergeAppliedSearchQueryIntoSearch, nationalPhoneDigits, normalizeVisitDate, normalizeVisitTime, parseAppliedSearchQuery, parseGroupedInteger, parsePhoneInput, parseReactSdkNamedImports, parseSearchPublicPath, pathFiltersToQueryFilters, pathLocationToFilterInput, phoneCountrySearchValue, queryListings, reduceAppliedSearchQuery, remaskPhoneForCountry, resolvePublicSiteId, searchListings, serializeAppliedSearchQuery, slotsForDate, studioAmenityInstruction, studioChromeInstruction, studioCodegenContractViolations, studioDefaultLeadUi, studioLayoutInstruction, studioLeadInstruction, studioListingCardInstruction, studioListingDetailInstruction, studioSdkPinInstruction, studioSearchInstruction, studioSearchLandmarkInstruction, studioSiteWidthCss, submitContactLead, submitVisitLead, toE164, toListingCardModel, truncateNationalPhoneDigits, unavailableReactImports };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RequestNextOptions, L as ListingFilters, Q as QueryListingsParams, S as SearchListingsParams, C as CmsCollection, a as CmsEntriesResult, b as CmsEntry, c as ListingDetail, d as ListingsResult, e as SearchUi, f as SimilarListingsResult, g as Site, h as QueryListingsResult, i as SearchListingsResult, j as ListingLocation, k as ListingMedia, l as ListingBusinessType, m as ListingPriceVisibility, n as Listing, o as SearchPathFilters, p as SearchUiDictionary, q as QueryListingsFilters, A as AppliedSearchQuery, r as AppliedSearchChange } from './search-engine-
|
|
2
|
-
export { s as CmsEntryStatus, t as CmsFieldDefinition, u as CmsFieldType, v as CmsSeoData, F as FORBIDDEN_SEARCH_QUERY_KEYS, w as ListingPropertySummary, x as LocationNameTables, y as QueryListingsLocation, z as SEARCH_EMPTY_COPY, B as SEARCH_SORT_RELEVANCE, D as SearchChromeModel, E as SearchPathLocation, G as SearchUiFilter, H as SearchUiOption, T as TOOLBAR_PRIMARY_FILTER_IDS, I as applyPathFilter, J as buildQueryListingsParams, K as canonicalizeSearchHref, M as clearStagedPathFilters, N as countFacetChoices, O as countOptionLabel, P as displayPathLocation, U as hrefForAppliedChange, V as hrefForPathFilters, W as hrefWithExplicitPage, X as isListingDetailPath, Y as paginationPages, Z as pathFilterHasOption, _ as pathFilterValue, $ as publicSearchHref, a0 as rangeDraftFromPath, a1 as readPublicSearch, a2 as searchChromeModel, a3 as searchHrefUsesLegacyFilterQuery, a4 as searchResultsHeading, a5 as searchSortOptions, a6 as toolbarFilterIds, a7 as visibleSearchFilters } from './search-engine-
|
|
1
|
+
import { R as RequestNextOptions, L as ListingFilters, Q as QueryListingsParams, S as SearchListingsParams, C as CmsCollection, a as CmsEntriesResult, b as CmsEntry, c as ListingDetail, d as ListingsResult, e as SearchUi, f as SimilarListingsResult, g as Site, h as QueryListingsResult, i as SearchListingsResult, j as ListingLocation, k as ListingMedia, l as ListingBusinessType, m as ListingPriceVisibility, n as Listing, o as SearchPathFilters, p as SearchUiDictionary, q as QueryListingsFilters, A as AppliedSearchQuery, r as AppliedSearchChange } from './search-engine-CtnLzmwW.js';
|
|
2
|
+
export { s as CmsEntryStatus, t as CmsFieldDefinition, u as CmsFieldType, v as CmsSeoData, F as FORBIDDEN_SEARCH_QUERY_KEYS, w as ListingPropertySummary, x as LocationNameTables, y as QueryListingsLocation, z as SEARCH_EMPTY_COPY, B as SEARCH_SORT_RELEVANCE, D as SearchChromeModel, E as SearchPathLocation, G as SearchUiFilter, H as SearchUiOption, T as TOOLBAR_PRIMARY_FILTER_IDS, I as applyPathFilter, J as buildQueryListingsParams, K as canonicalizeSearchHref, M as clearStagedPathFilters, N as countFacetChoices, O as countOptionLabel, P as displayPathLocation, U as hrefForAppliedChange, V as hrefForPathFilters, W as hrefWithExplicitPage, X as isListingDetailPath, Y as paginationPages, Z as pathFilterHasOption, _ as pathFilterValue, $ as publicSearchHref, a0 as rangeDraftFromPath, a1 as readPublicSearch, a2 as searchChromeModel, a3 as searchHrefUsesLegacyFilterQuery, a4 as searchResultsHeading, a5 as searchSortOptions, a6 as toolbarFilterIds, a7 as visibleSearchFilters } from './search-engine-CtnLzmwW.js';
|
|
3
3
|
|
|
4
4
|
/** Custom fetch implementation. Defaults to the global `fetch`. */
|
|
5
5
|
type FetchLike = typeof fetch;
|
|
@@ -226,6 +226,13 @@ type LeadSubmitBase = LeadContact & {
|
|
|
226
226
|
baseUrl?: string;
|
|
227
227
|
fetch?: FetchLike;
|
|
228
228
|
listingId: string;
|
|
229
|
+
/**
|
|
230
|
+
* Active listing modality (`sale` | `rental` | `rent`). Always pass
|
|
231
|
+
* `listing.businessType`, sale included; the server only fills a missing
|
|
232
|
+
* value from the catalog as a safety net.
|
|
233
|
+
*/
|
|
234
|
+
listingType?: string;
|
|
235
|
+
businessType?: string;
|
|
229
236
|
visitorId?: string;
|
|
230
237
|
brokerRef?: string;
|
|
231
238
|
referrer?: string;
|
|
@@ -358,6 +365,7 @@ type ListingDetailModel = {
|
|
|
358
365
|
};
|
|
359
366
|
declare function listingValues(listing: {
|
|
360
367
|
price?: number | null;
|
|
368
|
+
currency?: string | null;
|
|
361
369
|
priceVisibility?: string | null;
|
|
362
370
|
propertyTaxLabel?: string | null;
|
|
363
371
|
property?: {
|
|
@@ -435,7 +443,7 @@ declare function listingLocationLabel(location: {
|
|
|
435
443
|
city?: string | null;
|
|
436
444
|
state?: string | null;
|
|
437
445
|
}): string;
|
|
438
|
-
declare function toListingCardModel(listing: Pick<Listing, "id" | "listingCode" | "path" | "title" | "businessType" | "price" | "priceVisibility" | "coverImage"> & {
|
|
446
|
+
declare function toListingCardModel(listing: Pick<Listing, "id" | "listingCode" | "path" | "title" | "businessType" | "price" | "currency" | "priceVisibility" | "coverImage"> & {
|
|
439
447
|
property?: {
|
|
440
448
|
type?: string | null;
|
|
441
449
|
bedrooms?: number | null;
|
|
@@ -463,6 +471,79 @@ declare function parseGroupedInteger(value: unknown): number | undefined;
|
|
|
463
471
|
declare function formatAreaM2(area: number | null | undefined): string | null;
|
|
464
472
|
declare function listingBusinessLabel(businessType: string | undefined): string;
|
|
465
473
|
|
|
474
|
+
/**
|
|
475
|
+
* Countries for Studio phone pickers (labels pt-BR).
|
|
476
|
+
* Same catalog shape as `@garagem/ui` PhoneInput — generated sites compose
|
|
477
|
+
* the UI; this list is headless data only.
|
|
478
|
+
*/
|
|
479
|
+
interface PhoneCountry {
|
|
480
|
+
code: string;
|
|
481
|
+
name: string;
|
|
482
|
+
dialCode: string;
|
|
483
|
+
flag: string;
|
|
484
|
+
}
|
|
485
|
+
declare const DEFAULT_PHONE_COUNTRY_CODE = "BR";
|
|
486
|
+
declare const PHONE_COUNTRIES: PhoneCountry[];
|
|
487
|
+
/** cmdk / filter value: name, ISO, DDI, and +DDI so "59" / "+598" both match. */
|
|
488
|
+
declare function phoneCountrySearchValue(country: PhoneCountry): string;
|
|
489
|
+
declare function findPhoneCountry(code: string | null | undefined): PhoneCountry | undefined;
|
|
490
|
+
declare function defaultPhoneCountry(): PhoneCountry;
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Headless phone mask / E.164 helpers for Studio-generated lead forms.
|
|
494
|
+
* UI (country picker, input) stays in the app — same contract as CRM
|
|
495
|
+
* `@garagem/ui` PhoneInput without shipping markup.
|
|
496
|
+
*/
|
|
497
|
+
|
|
498
|
+
/** ITU-T E.164 national number upper bound. */
|
|
499
|
+
declare const MAX_NATIONAL_PHONE_DIGITS = 15;
|
|
500
|
+
declare function nationalPhoneDigits(value: string | null | undefined): string;
|
|
501
|
+
declare function truncateNationalPhoneDigits(digits: string, max?: number): string;
|
|
502
|
+
/**
|
|
503
|
+
* Collapse DDD + extra `9` + 9-digit BR mobile (12 national digits).
|
|
504
|
+
* Matches CRM `collapseDuplicatedBrazilianMobileNine` for common typos.
|
|
505
|
+
*/
|
|
506
|
+
declare function collapseDuplicatedBrazilianMobileNine(digits: string): string;
|
|
507
|
+
/**
|
|
508
|
+
* National display mask for the selected country (`(11) 96690-6900` for BR).
|
|
509
|
+
* Pass national digits or a messy draft; non-digits are stripped.
|
|
510
|
+
*/
|
|
511
|
+
declare function formatPhoneNational(value: string | null | undefined, countryCode?: string): string;
|
|
512
|
+
type ParsedPhoneInput = {
|
|
513
|
+
ddi: string | null;
|
|
514
|
+
national: string;
|
|
515
|
+
countryCode: string | null;
|
|
516
|
+
};
|
|
517
|
+
/**
|
|
518
|
+
* Split E.164 / `+DDI…` paste vs national draft. Without `+`, `ddi` is null
|
|
519
|
+
* and `national` is all digits (country comes from the picker).
|
|
520
|
+
*/
|
|
521
|
+
declare function parsePhoneInput(input: string | null | undefined): ParsedPhoneInput;
|
|
522
|
+
/**
|
|
523
|
+
* Canonical submit value: `+5511966906900`. Empty draft → `""`.
|
|
524
|
+
* Callers that need a guaranteed-valid number should also run `isValidPhone`.
|
|
525
|
+
*/
|
|
526
|
+
declare function toE164(value: string | null | undefined, countryCode?: string): string;
|
|
527
|
+
/**
|
|
528
|
+
* Validate national digits or E.164 for the selected country (CRM-aligned).
|
|
529
|
+
*/
|
|
530
|
+
declare function isValidPhone(value: string | null | undefined, countryCode?: string): boolean;
|
|
531
|
+
/**
|
|
532
|
+
* Re-mask national digits after the visitor changes country (PhoneInput flow).
|
|
533
|
+
*
|
|
534
|
+
* Lossless on purpose, like CRM PhoneInput `handleCountryChange`: the digits
|
|
535
|
+
* already in the field are kept as-is (truncated to E.164 length), only the
|
|
536
|
+
* mask and the dial code change. The accidental dial-prefix strip and the
|
|
537
|
+
* Brazilian extra-9 collapse are for freshly typed/pasted input — running
|
|
538
|
+
* them here against the destination country eats legitimate digits (NANP
|
|
539
|
+
* dial `1` would take the first digit of a BR `11…` national on a toggle).
|
|
540
|
+
*/
|
|
541
|
+
declare function remaskPhoneForCountry(nationalOrDraft: string | null | undefined, countryCode: string): {
|
|
542
|
+
display: string;
|
|
543
|
+
e164: string;
|
|
544
|
+
country: PhoneCountry;
|
|
545
|
+
};
|
|
546
|
+
|
|
466
547
|
declare function composeSearchPublicPath(filters: SearchPathFilters, dictionary?: SearchUiDictionary): string;
|
|
467
548
|
declare function parseSearchPublicPath(pathname: string, dictionary?: SearchUiDictionary): SearchPathFilters | null;
|
|
468
549
|
/**
|
|
@@ -523,11 +604,13 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
523
604
|
* Exact pin for generated Studio sites. Must match a tarball already on
|
|
524
605
|
* npm — v0 installs this version. After a later changeset publishes, bump
|
|
525
606
|
* this and move that release's names from `optionalReactExports` /
|
|
526
|
-
* `unpublishedSearchExports` into the
|
|
527
|
-
* until that tarball is on npm.
|
|
528
|
-
*
|
|
607
|
+
* `unpublishedSearchExports` / `unpublishedPhoneExports` into the
|
|
608
|
+
* prompt-safe lists. Do not bump here until that tarball is on npm.
|
|
609
|
+
* Phone mask helpers shipped in 0.6.0. Search filter helpers
|
|
610
|
+
* (`visibleSearchFilters` / `toolbarFilterIds`) shipped in 0.4.12 and
|
|
611
|
+
* remain on this pin.
|
|
529
612
|
*/
|
|
530
|
-
readonly minNpmVersion: "0.
|
|
613
|
+
readonly minNpmVersion: "0.6.0";
|
|
531
614
|
/** Historical: older tarballs inject card CSS when those components mount. */
|
|
532
615
|
readonly selfInjectSince: "0.4.2";
|
|
533
616
|
readonly chromeStrategy: "app-owned";
|
|
@@ -553,12 +636,23 @@ declare const STUDIO_SDK_CONTRACT: {
|
|
|
553
636
|
readonly listingDetailExports: readonly ["listingDetailModel", "getSimilarListings"];
|
|
554
637
|
/** Main-package card helpers — markup stays in the generated app. */
|
|
555
638
|
readonly listingCardExports: readonly ["toListingCardModel", "listingPublicPath", "formatAreaM2", "listingBusinessLabel", "formatListingPrice"];
|
|
639
|
+
/**
|
|
640
|
+
* Prompt-safe phone helpers on `minNpmVersion` (published in 0.6.0).
|
|
641
|
+
*/
|
|
642
|
+
readonly phoneExports: readonly ["PHONE_COUNTRIES", "formatPhoneNational", "toE164", "isValidPhone", "parsePhoneInput", "phoneCountrySearchValue", "findPhoneCountry", "remaskPhoneForCountry"];
|
|
643
|
+
/**
|
|
644
|
+
* Headless phone helpers in git but not on `minNpmVersion`. Prompts,
|
|
645
|
+
* completeness, and repair text must not mention these until the pin
|
|
646
|
+
* bumps — v0 installs the pin and the ESM loader throws on missing
|
|
647
|
+
* named exports.
|
|
648
|
+
*/
|
|
649
|
+
readonly unpublishedPhoneExports: readonly [];
|
|
556
650
|
readonly amenityExports: readonly ["listingAmenityGroups"];
|
|
557
651
|
/**
|
|
558
|
-
* Names already on the pinned npm tarball (`minNpmVersion`
|
|
559
|
-
*
|
|
560
|
-
* `
|
|
561
|
-
*
|
|
652
|
+
* Names already on the pinned npm tarball (`minNpmVersion`) — safe for
|
|
653
|
+
* Studio prompts and completeness. Includes `visibleSearchFilters` +
|
|
654
|
+
* `toolbarFilterIds` (shipped in 0.4.12). Do not confuse with
|
|
655
|
+
* `unpublishedSearchExports` (`searchChromeModel`, …).
|
|
562
656
|
*/
|
|
563
657
|
readonly searchExports: readonly ["searchResultsHeading", "searchSortOptions", "visibleSearchFilters", "toolbarFilterIds", "paginationPages", "hrefWithExplicitPage"];
|
|
564
658
|
/**
|
|
@@ -715,4 +809,4 @@ interface GaragemClient {
|
|
|
715
809
|
*/
|
|
716
810
|
declare function createGaragemClient(options?: CreateGaragemClientOptions): GaragemClient;
|
|
717
811
|
|
|
718
|
-
export { AMENITY_FALLBACK_LABELS, type AmenityLabelDictionary, type AmenityLabelOption, AppliedSearchChange, AppliedSearchQuery, CmsCollection, CmsEntriesResult, CmsEntry, type ContactLeadInput, type CreateGaragemClientOptions, type FetchLike, type GaragemClient, GaragemSdkError, type GetCmsCollectionOptions, type GetCmsCollectionsOptions, type GetCmsEntriesOptions, type GetCmsEntryOptions, type GetLeadUiOptions, type GetListingOptions, type GetListingsOptions, type GetSearchUiOptions, type GetSimilarListingsOptions, type GetSiteOptions, 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, ListingBusinessType, type ListingCardModel, type ListingDescriptionPreview, ListingDetail, type ListingDetailFieldsModel, type ListingDetailFieldsSource, type ListingDetailModel, type ListingFact, ListingFilters, ListingLocation, type ListingLocationBlock, ListingMedia, type ListingMediaOverlay, ListingPriceVisibility, type ListingValue, ListingsResult, type LocationFilterInput, QueryListingsFilters, type QueryListingsOptions, QueryListingsParams, QueryListingsResult, RequestNextOptions, type ResolvePublicSiteIdOptions, STUDIO_DEFAULT_VISIT_SCHEDULE, STUDIO_SDK_CONTRACT, STUDIO_SDK_PACKAGE, STUDIO_SITE_LAYOUT, type SearchListingsOptions, SearchListingsParams, SearchListingsResult, SearchPathFilters, SearchUi, SearchUiDictionary, SimilarListingsResult, Site, type StudioSdkContract, VISIT_TIME_ZONE, type VisitHours, type VisitLeadInput, type VisitSchedule, type VisitScheduleConfig, coerceNpmVersion, compareSemver, composeSearchPublicHref, composeSearchPublicPath, createGaragemClient, expandVisitSchedule, expandVisitTimeSlots, formatAreaM2, formatGroupedInteger, formatListingPrice, getCmsCollection, getCmsCollections, getCmsEntries, getCmsEntry, getLeadUi, getListing, getListings, getSearchUi, getSimilarListings, getSite, hasShowcaseLeadsPostUrl, isStudioPreviewHost, isVisitSlotAllowed, labelAmenities, listingAmenityGroups, listingBreadcrumb, listingBusinessLabel, listingDescriptionPreview, listingDetailFieldsModel, listingDetailModel, listingFacts, listingLocationBlock, listingLocationLabel, listingLookupKey, listingMapsHref, listingMediaOverlays, listingPublicPath, listingValues, mergeAppliedSearchQueryIntoSearch, normalizeVisitDate, normalizeVisitTime, parseAppliedSearchQuery, parseGroupedInteger, parseReactSdkNamedImports, parseSearchPublicPath, pathFiltersToQueryFilters, pathLocationToFilterInput, queryListings, reduceAppliedSearchQuery, resolvePublicSiteId, searchListings, serializeAppliedSearchQuery, slotsForDate, studioAmenityInstruction, studioChromeInstruction, studioCodegenContractViolations, studioDefaultLeadUi, studioLayoutInstruction, studioLeadInstruction, studioListingCardInstruction, studioListingDetailInstruction, studioSdkPinInstruction, studioSearchInstruction, studioSearchLandmarkInstruction, studioSiteWidthCss, submitContactLead, submitVisitLead, toListingCardModel, unavailableReactImports };
|
|
812
|
+
export { AMENITY_FALLBACK_LABELS, type AmenityLabelDictionary, type AmenityLabelOption, AppliedSearchChange, AppliedSearchQuery, CmsCollection, CmsEntriesResult, CmsEntry, type ContactLeadInput, type CreateGaragemClientOptions, DEFAULT_PHONE_COUNTRY_CODE, type FetchLike, type GaragemClient, GaragemSdkError, type GetCmsCollectionOptions, type GetCmsCollectionsOptions, type GetCmsEntriesOptions, type GetCmsEntryOptions, type GetLeadUiOptions, type GetListingOptions, type GetListingsOptions, type GetSearchUiOptions, type GetSimilarListingsOptions, type GetSiteOptions, 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, ListingBusinessType, type ListingCardModel, type ListingDescriptionPreview, ListingDetail, type ListingDetailFieldsModel, type ListingDetailFieldsSource, type ListingDetailModel, type ListingFact, ListingFilters, ListingLocation, type ListingLocationBlock, ListingMedia, type ListingMediaOverlay, ListingPriceVisibility, type ListingValue, ListingsResult, type LocationFilterInput, MAX_NATIONAL_PHONE_DIGITS, PHONE_COUNTRIES, type ParsedPhoneInput, type PhoneCountry, QueryListingsFilters, type QueryListingsOptions, QueryListingsParams, QueryListingsResult, RequestNextOptions, type ResolvePublicSiteIdOptions, STUDIO_DEFAULT_VISIT_SCHEDULE, STUDIO_SDK_CONTRACT, STUDIO_SDK_PACKAGE, STUDIO_SITE_LAYOUT, type SearchListingsOptions, SearchListingsParams, SearchListingsResult, SearchPathFilters, SearchUi, SearchUiDictionary, SimilarListingsResult, Site, type StudioSdkContract, VISIT_TIME_ZONE, type VisitHours, type VisitLeadInput, type VisitSchedule, type VisitScheduleConfig, coerceNpmVersion, collapseDuplicatedBrazilianMobileNine, compareSemver, composeSearchPublicHref, composeSearchPublicPath, createGaragemClient, defaultPhoneCountry, expandVisitSchedule, expandVisitTimeSlots, findPhoneCountry, formatAreaM2, formatGroupedInteger, formatListingPrice, formatPhoneNational, getCmsCollection, getCmsCollections, getCmsEntries, getCmsEntry, getLeadUi, getListing, getListings, getSearchUi, getSimilarListings, getSite, hasShowcaseLeadsPostUrl, isStudioPreviewHost, isValidPhone, isVisitSlotAllowed, labelAmenities, listingAmenityGroups, listingBreadcrumb, listingBusinessLabel, listingDescriptionPreview, listingDetailFieldsModel, listingDetailModel, listingFacts, listingLocationBlock, listingLocationLabel, listingLookupKey, listingMapsHref, listingMediaOverlays, listingPublicPath, listingValues, mergeAppliedSearchQueryIntoSearch, nationalPhoneDigits, normalizeVisitDate, normalizeVisitTime, parseAppliedSearchQuery, parseGroupedInteger, parsePhoneInput, parseReactSdkNamedImports, parseSearchPublicPath, pathFiltersToQueryFilters, pathLocationToFilterInput, phoneCountrySearchValue, queryListings, reduceAppliedSearchQuery, remaskPhoneForCountry, resolvePublicSiteId, searchListings, serializeAppliedSearchQuery, slotsForDate, studioAmenityInstruction, studioChromeInstruction, studioCodegenContractViolations, studioDefaultLeadUi, studioLayoutInstruction, studioLeadInstruction, studioListingCardInstruction, studioListingDetailInstruction, studioSdkPinInstruction, studioSearchInstruction, studioSearchLandmarkInstruction, studioSiteWidthCss, submitContactLead, submitVisitLead, toE164, toListingCardModel, truncateNationalPhoneDigits, unavailableReactImports };
|