@v-office/website-headless 1.2.0 → 1.3.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 CHANGED
@@ -39,6 +39,7 @@ favourites namespace, the backend) have no default at all.
39
39
  - [Checkout flow](#checkout-flow)
40
40
  - [Contact form](#contact-form)
41
41
  - [Countries](#countries)
42
+ - [Regions](#regions)
42
43
  - [Legal documents](#legal-documents)
43
44
  - [Favourites](#favourites)
44
45
  - [Shared helpers](#shared-helpers)
@@ -223,8 +224,8 @@ Everything in `.` runs in both places, but some calls belong to one of them:
223
224
 
224
225
  - **Build time** (they spend rate-limited requests or need full ICU): `loadRentalCatalogue`,
225
226
  `fetchRentalFlags`, `resolveSearchGroups`, `measureFilters`, `findOfferWindows`,
226
- `findCampaignStart`, `fetchLegalDocuments`, `countryOptions`, `rentalIndexEntries`, `cardSource`,
227
- `rentalFactsMap`, `buildShowcaseGroups`, `resolveFilters`. Their results are plain JSON and are
227
+ `findCampaignStart`, `fetchLegalDocuments`, `countryOptions`, `regionOptions`, `regionsByRental`,
228
+ `rentalIndexEntries`, `cardSource`, `rentalFactsMap`, `buildShowcaseGroups`, `resolveFilters`. Their results are plain JSON and are
228
229
  passed to islands as props.
229
230
  - **Browser**: the stores (`createSearchForm`, `createSearchStore`, `createQuoteFlow`,
230
231
  `createCheckoutFlow`, `createContactForm`, `createFavorites`), `loadRentalIndex`,
@@ -1793,6 +1794,22 @@ build time; the result is plain data passed to islands.
1793
1794
  non-English tags first, then English tags with an explicit region; bare `"en"` is never maximized.
1794
1795
  - `CountryCode`: ISO 3166-1 alpha-2; the register is never filtered.
1795
1796
 
1797
+ ## Regions
1798
+
1799
+ Module `regions`. The region tree (`sdk.static.regions.getRegions` of `@v-office/website-sdk`, v10 and v9,
1800
+ one read per build) as the search's region data. A region's value is its id; it holds its subregions' rentals, so
1801
+ `?region=<id>` finds them too. Build time; the results are plain data passed to islands.
1802
+
1803
+ - `regionOptions(tree, { locale, rentalIds })` → `RegionChoice[]` (`value` = id, `label` = name,
1804
+ `count` = the site's rentals with the subregions', `group` = a subregion's top-level region name):
1805
+ every region with one of the site's rentals (`rentalIds`, the ids of the rentals the site reads,
1806
+ since the tree ignores `rentalScope`), in the tree's order. Pass them as they are as the `regions` prop of `SearchBar` from
1807
+ `@v-office/website-components`, and as the `options` of a curated hidden `region` facet, which words
1808
+ a `?region=` chip with the name instead of the id.
1809
+ `createSearchForm` takes the `value`s.
1810
+ - `regionsByRental(tree)` → rental id → the ids of every region holding it, ancestors included: the
1811
+ `regions` of `cardSource` extras, so `rentalFactsMap` carries them to the browser filter.
1812
+
1796
1813
  ## Legal documents
1797
1814
 
1798
1815
  Module `legal`. Build time only.
package/dist/index.d.mts CHANGED
@@ -194,6 +194,49 @@ export declare const dialCode: DialCode;
194
194
  /** See {@link DetectCountry}. */
195
195
  export declare const detectCountry: DetectCountry;
196
196
  //#endregion
197
+ //#region src/regions/regions.d.ts
198
+ /** The minimal shape read off `sdk.static.regions.getRegions`; its result passes as it is. */
199
+ interface RegionTree {
200
+ /** Depth first: every region before its subregions. */
201
+ readonly regions: readonly {
202
+ readonly id: string;
203
+ /** `null` on a top-level region. */
204
+ readonly parentId: string | null;
205
+ readonly name: Readonly<Record<Locale, string>>;
206
+ /** The region's rentals and its subregions'. */
207
+ readonly rentalIds: readonly string[];
208
+ }[];
209
+ }
210
+ /** One region choice: a search bar `RegionOption` and a curated `region` facet's `FacetOption`. */
211
+ interface RegionChoice {
212
+ /** The region id, the `?region=` value. */
213
+ readonly value: string;
214
+ /** The region's name in the locale. */
215
+ readonly label: string;
216
+ /** The site's rentals in the region and its subregions. */
217
+ readonly count: number;
218
+ /** A subregion's top-level region name; a top-level region has none. */
219
+ readonly group?: string;
220
+ }
221
+ /** What `regionOptions` reads. */
222
+ interface RegionOptionsInput {
223
+ /** The label language. */
224
+ readonly locale: Locale;
225
+ /** The ids of the site's rentals. The tree ignores the SDK's `rentalScope`, so a region
226
+ * counts only these, and a region without any of them is not offered. */
227
+ readonly rentalIds: readonly string[];
228
+ }
229
+ /** Every region with at least one of the site's rentals, in the tree's order (a region before its
230
+ * subregions). */
231
+ type RegionOptions = (tree: RegionTree, input: RegionOptionsInput) => RegionChoice[];
232
+ /** Rental id → the ids of every region holding it, its regions' ancestors included: the
233
+ * `RentalFacts.regions` / `CardSource.regions` the browser matches `?region=` against. */
234
+ type RegionsByRental = (tree: RegionTree) => Record<string, readonly string[]>;
235
+ /** See {@link RegionOptions}. */
236
+ export declare const regionOptions: RegionOptions;
237
+ /** See {@link RegionsByRental}. */
238
+ export declare const regionsByRental: RegionsByRental;
239
+ //#endregion
197
240
  //#region src/favorites/favorites.d.ts
198
241
  /** The window event every site script listens to (`detail: FavoritesChange`); kept verbatim. The
199
242
  * `./enhance` binder dispatches it from `onChange`. */
@@ -2804,4 +2847,4 @@ type FetchLegalDocuments = (sdk: WebsiteSdk, locale: Locale) => Promise<LegalDoc
2804
2847
  /** See {@link FetchLegalDocuments}. */
2805
2848
  export declare const fetchLegalDocuments: FetchLegalDocuments;
2806
2849
  //#endregion
2807
- export { ADJACENT_BELOW_M, ALWAYS_EXCLUDED_CATEGORIES, type ActiveFilter, type AdaptEvent, type AdaptRentalOptions, type AlternativePeriod, type AmenityGroup, type AmenityPreviewItem, type AmenityPreviewOptions, type AvailabilityWindowInput, type Backend, type BadgeRule, type BedRun, type BookableFrom, type BookingConfirmation, type BookingContact, type BookingKind, type BookingSnapshot, type BuiltInFieldSpec, type BuiltInPolicyLabels, type CampaignChip, type CampaignChipsInput, type CampaignLabelSource, type CampaignOf, type CardBadge, type CardContext, type CardFact, type CardImage, type CardLiveField, type CardMatch, type CardModelOptions, type CardPill, type CardRating, type CardSignal, type CardSource, type CardSourceExtras, type CardStatus, type CatalogueRental, type CheckedCopy, type CheckoutActions, type CheckoutBlocker, type CheckoutContext, type CheckoutEventDetail, type CheckoutFlow, type CheckoutFlowOptions, type CheckoutHandover, type CheckoutHandoverOptions, type CheckoutInsuranceState, type CheckoutIssue, type CheckoutMessages, type CheckoutPart, type CheckoutPhase, type CheckoutPolicyState, type CheckoutRequirement, type CheckoutService, type CheckoutState, type CheckoutStructure, type CheckoutVoucherState, type ChildAgeRange, type ClusterOptions, type ContactControl, type ContactEventDetail, type ContactFieldName, type ContactFieldSpec, type ContactForm, type ContactFormActions, type ContactFormMessages, type ContactFormOptions, type ContactFormState, type ContactLink, type ContactPhase, type ContactSubmitOutcome, type ContactValue, type ContactValues, type CountryCode, type CountryGroups, type CountryOption, type CountryOptionsInput, DEFAULT_CHILD_AGE, DEFAULT_CLUSTER, DEFAULT_FIT, DEFAULT_FLAG_FILTERS, DEFAULT_GUEST_LIMITS, DEFAULT_SORT_OPTIONS, type DateControls, type DateMode, type DateSearch, type DateSearchOptions, type DateSearchState, type DayKind, type DayPrices, type DayState, type DefaultFit, type DescriptionContent, type DescriptionPreview, type DistanceKind, ENHANCE_PARTS, type EmptyCause, type EndAvailability, type EndAvailabilityInput, type EnhancePart, type EnhanceParts, type EnvRecord, type ExternalSearchLink, type ExternalSearchSource, type ExtraFieldSpec, FAVORITE_LEAVE_MS, type FacetOption, type FacetOptionsOptions, type FactKind, type Favorites, type FavoritesChange, type FavoritesOptions, type FavoritesPort, type FavoritesState, type FetchRentalFlagsOptions, type FieldWidth, type FilterDef, type FilterEntry, type FilterGroupSpec, type FilterMeasurement, type FilterSelection, type FilterSpec, type FindCampaignStartOptions, type FindOfferWindowsOptions, type FitOptions, type FlexibleStay, GATE_MARKERS, GLYPHS, type GateMarkers, type Glyph, type GlyphList, type GuestBound, type GuestBounds, type GuestCaps, type GuestForm, type GuestFormField, type GuestFormOptions, type GuestFormState, type GuestKind, type GuestLimits, type GuestOptions, type GuestSearch, type GuestSearchOptions, type GuestSearchState, HIDDEN_ROOM_ATTRIBUTES, HUB_ENDPOINTS, type HistoryPort, type HubEndpointTable, type HubEndpoints, type ImplicitScope, type InitialAvailability, type InsuranceDocsState, type InsurancePaymentLink, type IsoDay, type IsoMonth, type LegalDocument, type LegalDocuments, type Listener, type LiveSearchOptions, type LngLat, type LoadRentalCatalogueOptions, type Locale, type MapBounds, type MapPlace, type MapPoint, type MapResultsSource, type MapViewReport, type OfferWindow, type OffersWindowSpec, type OptionalGuestField, type OutcomeInput, type Party, type PaymentLine, type PaymentReturn, type PaymentScheduleView, type PeriodLabel, type PeriodValue, type PillOptions, type PinLabelOptions, type PixelOffset, type PlaceMarker, type PlainTextOptions, type PolicyBranch, type PolicyBranchOptions, type PolicyChoiceMode, type PolicyOffer, type PolicyOfferInput, type PolicyOption, type PolicyStance, type PolicyTerms, type PolicyTermsOptions, type PolicyTitle, type PreviewStrategy, type PriceCents, type PriceLine, type PriceView, type QueryPair, type QueryShape, type QuoteAddonService, type QuoteCancellationPolicy, type QuoteCta, type QuoteEventDetail, type QuoteFlow, type QuoteFlowOptions, type QuoteFlowSettings, type QuoteFlowState, type QuoteHandover, type QuoteInsurance, type QuoteInsuranceOption, type QuoteOccupancy, type QuoteOutcome, type QuotePolicyRule, type QuoteRequest, type QuoteResult, type QuoteSelectionResult, type QuoteUnavailableCode, type QuoteView, type QuoteVoucher, type Range, type RawSearchPage, type RelatedOptions, type Relaxation, type RentalAddress, type RentalAddressMode, RentalAddressModeError, type RentalCardModel, RentalContentError, type RentalCounts, type RentalDetail, type RentalDistance, type RentalFacts, type RentalFactsMap, type RentalFlag, type RentalFlagsResult, type RentalImage, type RentalIndexEntry, type RentalMatch, type RentalMatchOptions, type RentalPropertyInfo, type RentalReview, type RentalReviews, type RentalRoom, type ResolveFiltersOptions, type ResolvedContactField, type ResolvedContactItem, type ResolvedFilters, type ResolvedSearchGroup, type ResultHandoverOptions, type ResultLinkOptions, type ResultsMapController, type ResultsMapOptions, type ResultsMapState, type ResultsMapSurface, type ReviewCriterion, type ReviewSummary, type RichBlock, type RichInline, type RoomKind, type RotationOptions, type RouteParams, type RouteTemplate, type RoutedContactIssues, SDK_ENV, SEARCH_PAGE_SIZE, SEARCH_PARAMS, SORT_URL_VALUE, STAGES, type Salutation, type SameSpotGroup, type SameSpotLayout, type SameSpotMode, type SameSpotOptions, type SanitizedSearch, type SdkConfig, type SdkConfigForInput, SdkEnvError, type SdkFilterDefinition, type SdkMode, type SdkOptions, type SdkQueryOptions, type SdkSearchQuery, type SdkSetup, type SdkSource, type SearchActions, type SearchContract, type SearchField, type SearchForm, type SearchFormIssue, type SearchFormOptions, type SearchFormState, type SearchGroupSpec, type SearchOutcome, type SearchPage, type SearchPageRequest, type SearchParamAliases, type SearchParamKeys, type SearchPeriod, type SearchQuery, type SearchResultItem, type SearchScope, type SearchScopeKind, type SearchState, type SearchStatus, type SearchStore, type SearchStoreClaim, type SearchStoreOptions, type SearchedParts, type SelectOption, type Selection, type SelectionSpec, type ShareLocation, type ShareUrlOptions, type SharedSdk, type ShowcaseGroup, type ShowcaseGroupSpec, type ShowcaseOrder, type SnapshotImage, type SortKey, type SortOptionState, type Stage, type Stay, type StayPicker, type StayPickerOptions, type StayPickerState, type StayPrice, type StayWindow, type StorageLike, type Store, type StructureRequirement, type StructureViolation, type StructuredDocumentOptions, type SubmitBookingOptions, type SubmitWording, type Template, type TextMarkup, type TokensOf, type Unsubscribe, VOFFICE_ENDPOINTS, type ValidationMessages, type ValueConstraints, type VofficeEndpointTable, type VofficeEndpoints, WATER_KINDS, type WalkOptions, type WalkSummary, type WebsiteSdk, type WhenEmpty, type WhenUnavailable, type WritableStore, type WriteSearchOptions, activeFilters, adaptRental, addDays, agesComplete, amenityPreview, assignSlugs, campaignChips, campaignGroup, cardSource, catalogueResultItem, circleOffsets, clampParty, compareUndatedSearchOrder, createResultsMapController, createSdk, createSearchStore, createStore, describeOutcome, descriptionPreview, descriptionSummary, distanceFact, distanceMeters, externalSearchHref, facetOptions, fetchRentalFlags, fetchSearchPage, findCampaignStart, findOfferWindows, formatIsoDate, formatPriceLabel, frameFor, guestBounds, handoverQuery, hasMapPoints, idsInView, isAdjacent, isIsoDay, isSpecEcho, layoutSameSpot, loadRentalCatalogue, loadRentalFacts, loadSharedSdk, mapPoints, matches, measureFilters, mergePlaces, minimumSteps, newestReviewsFirst, nightsBetween, normalizeStructuredDocument, occupancyOf, offerWindowHref, offersWindowQuery, parseCounts, parseDistances, parsePriceLabel, parseTextBlocks, partyPairs, plainText, queryShape, quickFilterDefs, rankHighlights, readParty, readSearch, readSelection, rentalAddressLine, rentalFactsMap, resolveFilters, resolveSdk, resultCardSource, resultsQueryFlagScript, routeHref, sanitizeSearch, sdkConfigFor, sdkConfigFromEnv, searchHref, shareSdk, shortReviewerName, slugify, sortFromSearch, sortResults, splitReviewAuthor, stayKeyOf, toCardModel, toSdkQuery, toSdkSort, todayIso, walkSearchPages, withRentalFacts, withoutFilter, withoutFilters, writeSearch, writeSelection };
2850
+ export { ADJACENT_BELOW_M, ALWAYS_EXCLUDED_CATEGORIES, type ActiveFilter, type AdaptEvent, type AdaptRentalOptions, type AlternativePeriod, type AmenityGroup, type AmenityPreviewItem, type AmenityPreviewOptions, type AvailabilityWindowInput, type Backend, type BadgeRule, type BedRun, type BookableFrom, type BookingConfirmation, type BookingContact, type BookingKind, type BookingSnapshot, type BuiltInFieldSpec, type BuiltInPolicyLabels, type CampaignChip, type CampaignChipsInput, type CampaignLabelSource, type CampaignOf, type CardBadge, type CardContext, type CardFact, type CardImage, type CardLiveField, type CardMatch, type CardModelOptions, type CardPill, type CardRating, type CardSignal, type CardSource, type CardSourceExtras, type CardStatus, type CatalogueRental, type CheckedCopy, type CheckoutActions, type CheckoutBlocker, type CheckoutContext, type CheckoutEventDetail, type CheckoutFlow, type CheckoutFlowOptions, type CheckoutHandover, type CheckoutHandoverOptions, type CheckoutInsuranceState, type CheckoutIssue, type CheckoutMessages, type CheckoutPart, type CheckoutPhase, type CheckoutPolicyState, type CheckoutRequirement, type CheckoutService, type CheckoutState, type CheckoutStructure, type CheckoutVoucherState, type ChildAgeRange, type ClusterOptions, type ContactControl, type ContactEventDetail, type ContactFieldName, type ContactFieldSpec, type ContactForm, type ContactFormActions, type ContactFormMessages, type ContactFormOptions, type ContactFormState, type ContactLink, type ContactPhase, type ContactSubmitOutcome, type ContactValue, type ContactValues, type CountryCode, type CountryGroups, type CountryOption, type CountryOptionsInput, DEFAULT_CHILD_AGE, DEFAULT_CLUSTER, DEFAULT_FIT, DEFAULT_FLAG_FILTERS, DEFAULT_GUEST_LIMITS, DEFAULT_SORT_OPTIONS, type DateControls, type DateMode, type DateSearch, type DateSearchOptions, type DateSearchState, type DayKind, type DayPrices, type DayState, type DefaultFit, type DescriptionContent, type DescriptionPreview, type DistanceKind, ENHANCE_PARTS, type EmptyCause, type EndAvailability, type EndAvailabilityInput, type EnhancePart, type EnhanceParts, type EnvRecord, type ExternalSearchLink, type ExternalSearchSource, type ExtraFieldSpec, FAVORITE_LEAVE_MS, type FacetOption, type FacetOptionsOptions, type FactKind, type Favorites, type FavoritesChange, type FavoritesOptions, type FavoritesPort, type FavoritesState, type FetchRentalFlagsOptions, type FieldWidth, type FilterDef, type FilterEntry, type FilterGroupSpec, type FilterMeasurement, type FilterSelection, type FilterSpec, type FindCampaignStartOptions, type FindOfferWindowsOptions, type FitOptions, type FlexibleStay, GATE_MARKERS, GLYPHS, type GateMarkers, type Glyph, type GlyphList, type GuestBound, type GuestBounds, type GuestCaps, type GuestForm, type GuestFormField, type GuestFormOptions, type GuestFormState, type GuestKind, type GuestLimits, type GuestOptions, type GuestSearch, type GuestSearchOptions, type GuestSearchState, HIDDEN_ROOM_ATTRIBUTES, HUB_ENDPOINTS, type HistoryPort, type HubEndpointTable, type HubEndpoints, type ImplicitScope, type InitialAvailability, type InsuranceDocsState, type InsurancePaymentLink, type IsoDay, type IsoMonth, type LegalDocument, type LegalDocuments, type Listener, type LiveSearchOptions, type LngLat, type LoadRentalCatalogueOptions, type Locale, type MapBounds, type MapPlace, type MapPoint, type MapResultsSource, type MapViewReport, type OfferWindow, type OffersWindowSpec, type OptionalGuestField, type OutcomeInput, type Party, type PaymentLine, type PaymentReturn, type PaymentScheduleView, type PeriodLabel, type PeriodValue, type PillOptions, type PinLabelOptions, type PixelOffset, type PlaceMarker, type PlainTextOptions, type PolicyBranch, type PolicyBranchOptions, type PolicyChoiceMode, type PolicyOffer, type PolicyOfferInput, type PolicyOption, type PolicyStance, type PolicyTerms, type PolicyTermsOptions, type PolicyTitle, type PreviewStrategy, type PriceCents, type PriceLine, type PriceView, type QueryPair, type QueryShape, type QuoteAddonService, type QuoteCancellationPolicy, type QuoteCta, type QuoteEventDetail, type QuoteFlow, type QuoteFlowOptions, type QuoteFlowSettings, type QuoteFlowState, type QuoteHandover, type QuoteInsurance, type QuoteInsuranceOption, type QuoteOccupancy, type QuoteOutcome, type QuotePolicyRule, type QuoteRequest, type QuoteResult, type QuoteSelectionResult, type QuoteUnavailableCode, type QuoteView, type QuoteVoucher, type Range, type RawSearchPage, type RegionChoice, type RegionOptionsInput, type RegionTree, type RelatedOptions, type Relaxation, type RentalAddress, type RentalAddressMode, RentalAddressModeError, type RentalCardModel, RentalContentError, type RentalCounts, type RentalDetail, type RentalDistance, type RentalFacts, type RentalFactsMap, type RentalFlag, type RentalFlagsResult, type RentalImage, type RentalIndexEntry, type RentalMatch, type RentalMatchOptions, type RentalPropertyInfo, type RentalReview, type RentalReviews, type RentalRoom, type ResolveFiltersOptions, type ResolvedContactField, type ResolvedContactItem, type ResolvedFilters, type ResolvedSearchGroup, type ResultHandoverOptions, type ResultLinkOptions, type ResultsMapController, type ResultsMapOptions, type ResultsMapState, type ResultsMapSurface, type ReviewCriterion, type ReviewSummary, type RichBlock, type RichInline, type RoomKind, type RotationOptions, type RouteParams, type RouteTemplate, type RoutedContactIssues, SDK_ENV, SEARCH_PAGE_SIZE, SEARCH_PARAMS, SORT_URL_VALUE, STAGES, type Salutation, type SameSpotGroup, type SameSpotLayout, type SameSpotMode, type SameSpotOptions, type SanitizedSearch, type SdkConfig, type SdkConfigForInput, SdkEnvError, type SdkFilterDefinition, type SdkMode, type SdkOptions, type SdkQueryOptions, type SdkSearchQuery, type SdkSetup, type SdkSource, type SearchActions, type SearchContract, type SearchField, type SearchForm, type SearchFormIssue, type SearchFormOptions, type SearchFormState, type SearchGroupSpec, type SearchOutcome, type SearchPage, type SearchPageRequest, type SearchParamAliases, type SearchParamKeys, type SearchPeriod, type SearchQuery, type SearchResultItem, type SearchScope, type SearchScopeKind, type SearchState, type SearchStatus, type SearchStore, type SearchStoreClaim, type SearchStoreOptions, type SearchedParts, type SelectOption, type Selection, type SelectionSpec, type ShareLocation, type ShareUrlOptions, type SharedSdk, type ShowcaseGroup, type ShowcaseGroupSpec, type ShowcaseOrder, type SnapshotImage, type SortKey, type SortOptionState, type Stage, type Stay, type StayPicker, type StayPickerOptions, type StayPickerState, type StayPrice, type StayWindow, type StorageLike, type Store, type StructureRequirement, type StructureViolation, type StructuredDocumentOptions, type SubmitBookingOptions, type SubmitWording, type Template, type TextMarkup, type TokensOf, type Unsubscribe, VOFFICE_ENDPOINTS, type ValidationMessages, type ValueConstraints, type VofficeEndpointTable, type VofficeEndpoints, WATER_KINDS, type WalkOptions, type WalkSummary, type WebsiteSdk, type WhenEmpty, type WhenUnavailable, type WritableStore, type WriteSearchOptions, activeFilters, adaptRental, addDays, agesComplete, amenityPreview, assignSlugs, campaignChips, campaignGroup, cardSource, catalogueResultItem, circleOffsets, clampParty, compareUndatedSearchOrder, createResultsMapController, createSdk, createSearchStore, createStore, describeOutcome, descriptionPreview, descriptionSummary, distanceFact, distanceMeters, externalSearchHref, facetOptions, fetchRentalFlags, fetchSearchPage, findCampaignStart, findOfferWindows, formatIsoDate, formatPriceLabel, frameFor, guestBounds, handoverQuery, hasMapPoints, idsInView, isAdjacent, isIsoDay, isSpecEcho, layoutSameSpot, loadRentalCatalogue, loadRentalFacts, loadSharedSdk, mapPoints, matches, measureFilters, mergePlaces, minimumSteps, newestReviewsFirst, nightsBetween, normalizeStructuredDocument, occupancyOf, offerWindowHref, offersWindowQuery, parseCounts, parseDistances, parsePriceLabel, parseTextBlocks, partyPairs, plainText, queryShape, quickFilterDefs, rankHighlights, readParty, readSearch, readSelection, rentalAddressLine, rentalFactsMap, resolveFilters, resolveSdk, resultCardSource, resultsQueryFlagScript, routeHref, sanitizeSearch, sdkConfigFor, sdkConfigFromEnv, searchHref, shareSdk, shortReviewerName, slugify, sortFromSearch, sortResults, splitReviewAuthor, stayKeyOf, toCardModel, toSdkQuery, toSdkSort, todayIso, walkSearchPages, withRentalFacts, withoutFilter, withoutFilters, writeSearch, writeSelection };
package/dist/index.mjs CHANGED
@@ -986,6 +986,34 @@ const detectCountry = function detectCountry(countries, languages, fallback = "D
986
986
  return fallback;
987
987
  };
988
988
  //#endregion
989
+ //#region src/regions/regions.ts
990
+ /** See {@link RegionOptions}. */
991
+ const regionOptions = function regionOptions(tree, { locale, rentalIds }) {
992
+ const siteRentals = new Set(rentalIds);
993
+ const topLevelName = /* @__PURE__ */ new Map();
994
+ const choices = [];
995
+ for (const region of tree.regions) {
996
+ const name = region.name[locale];
997
+ const group = region.parentId === null ? void 0 : topLevelName.get(region.parentId);
998
+ topLevelName.set(region.id, group ?? name);
999
+ const count = region.rentalIds.filter((id) => siteRentals.has(id)).length;
1000
+ if (count === 0) continue;
1001
+ choices.push({
1002
+ value: region.id,
1003
+ label: name,
1004
+ count,
1005
+ ...group === void 0 ? {} : { group }
1006
+ });
1007
+ }
1008
+ return choices;
1009
+ };
1010
+ /** See {@link RegionsByRental}. */
1011
+ const regionsByRental = function regionsByRental(tree) {
1012
+ const byRental = {};
1013
+ for (const region of tree.regions) for (const rentalId of region.rentalIds) (byRental[rentalId] ??= []).push(region.id);
1014
+ return byRental;
1015
+ };
1016
+ //#endregion
989
1017
  //#region src/guests/party.ts
990
1018
  /** The kit limits every site ran on; a site overrides single keys. */
991
1019
  const DEFAULT_GUEST_LIMITS = {
@@ -8957,4 +8985,4 @@ function parseNodes(data) {
8957
8985
  /** See {@link FetchLegalDocuments}. */
8958
8986
  const fetchLegalDocuments = (sdk, locale) => fetchDocuments(sdk, locale);
8959
8987
  //#endregion
8960
- export { ADJACENT_BELOW_M, ALWAYS_EXCLUDED_CATEGORIES, BOOKING_KIND_ATTRIBUTE, BOOKING_SNAPSHOT_KEY, BUILT_IN_POLICY_LABELS, CAMPAIGN_PARAM, CHECKOUT_CONTEXT_KEY, CHECKOUT_EVENT, CHECKOUT_PARTS, CHECKOUT_STRUCTURE, CONTACT_ENDPOINT_REQUIRED, CONTACT_EVENT, CONTACT_LIMITS, DEFAULT_CHILD_AGE, DEFAULT_CLUSTER, DEFAULT_CONTACT_FIELDS, DEFAULT_FEATURED_COUNTRIES, DEFAULT_FIT, DEFAULT_FLAG_FILTERS, DEFAULT_GUEST_LIMITS, DEFAULT_MAP_STYLE_URL, DEFAULT_SORT_OPTIONS, ENHANCE_PARTS, FAVORITES_EVENT, FAVORITE_LEAVE_MS, GATE_MARKERS, GLYPHS, HIDDEN_ROOM_ATTRIBUTES, HUB_ENDPOINTS, MULTI_RATE_CODES, NO_INSURANCE_DOCS, POLICY_DEADLINE_HAS_TIME, QUOTE_EVENT, QUOTE_PARAM_KEYS, RELOAD_FLASH_MS, RentalAddressModeError, RentalContentError, SALUTATION_WIRE_VALUES, SAME_SPOT_METERS, SDK_ENV, SEARCH_PAGE_SIZE, SEARCH_PARAMS, SORT_URL_VALUE, STAGES, SUBMIT_WORDING, SdkEnvError, TRACKING_PARAM_PATTERN, VOFFICE_ENDPOINTS, WATER_KINDS, WINDOW_PARAM_KEYS, acquireFavorites, acquireQuoteFlow, acquireSearchStore, activeFilters, adaptGuestQuote, adaptRental, addDays, addQuoteService, agesComplete, amenityPreview, assertCheckoutStructure, assignSlugs, browserStorage, buildContactInput, buildShowcaseGroups, campaignChips, campaignGroup, cardSource, catalogueResultItem, checkoutHref, checkoutSearch, circleOffsets, clampParty, clearQuoteServices, compareUndatedSearchOrder, connectSearchStore, contactSpecProblems, countryOptions, createCheckoutFlow, createContactForm, createDateSearch, createFavorites, createGuestForm, createGuestSearch, createQuoteFlow, createResultsMapController, createSdk, createSearchForm, createSearchStore, createStayPicker, createStore, dayPriceLabel, defineCopy, describeOutcome, describePeriod, describePolicyOffer, describeSdkError, descriptionPreview, descriptionSummary, detectCountry, dialCode, distanceFact, distanceMeters, emailError, externalSearchHref, facetOptions, favoritesStorageKey, fetchEndAvailability, fetchInitialAvailability, fetchLegalDocuments, fetchQuote, fetchRentalFlags, fetchSearchPage, fillTemplate, findCampaignStart, findOfferWindows, floorplanUrl, foldSearchText, formatIsoDate, formatPriceLabel, formatStayRange, frameFor, freeCancellationUntil, guestBounds, handoverQuery, hasMapPoints, idsInView, insuranceDocsPending, insuranceIdToReapply, insuranceProductKey, isAdjacent, isBuiltInPolicy, isIsoDay, isRateConfigurationFault, isSpecEcho, isSubmittableOption, isTrackingParam, layoutSameSpot, loadRentalCatalogue, loadRentalFacts, loadRentalIndex, loadSharedSdk, logSdkFailure, mapPoints, matchRentals, matches, measureFilters, mergePlaces, minimumSteps, newestReviewsFirst, nightsBetween, normalizePhone, normalizeStructuredDocument, occupancyOf, offerWindowHref, offeredPolicies, offersWindowQuery, parseCounts, parseDistances, parsePriceLabel, parseTextBlocks, partyPairs, payWithOption, phoneError, plainText, policyStance, policyTerms, policyTitle, postalcodeError, prefillFromParams, pricePolicyBranches, queryShape, quickFilterDefs, rankHighlights, readCheckoutHandover, readParty, readPaymentReturn, readQuoteHandover, readSearch, readSelection, removeQuoteService, rentalAddressLine, rentalFactsMap, rentalIndexEntries, resolveContactFields, resolveFilters, resolveSdk, resolveSearchGroups, resultCardSource, resultsQueryFlagScript, rotationWindow, routeContactIssues, routeHref, runLiveSearch, sanitizeSearch, saveCheckoutContext, sdkConfigFor, sdkConfigFromEnv, searchHref, seededShuffle, selectQuoteInsurance, selectQuotePolicy, selectRelated, selectRentals, selectableInsuranceOptions, selectedInsuranceOption, shareSdk, shareUrl, shortReviewerName, shownInsuranceResources, slugify, sortFromSearch, sortResults, splitReviewAuthor, stabilizeCardOrder, stayKeyOf, stayQuery, streetWarning, submitBooking, toCardModel, toSdkQuery, toSdkSort, todayIso, validateContactValues, walkSearchPages, webpSrcset, webpUrl, withRentalFacts, withoutFilter, withoutFilters, withoutTracking, writeQuoteParams, writeSearch, writeSelection };
8988
+ export { ADJACENT_BELOW_M, ALWAYS_EXCLUDED_CATEGORIES, BOOKING_KIND_ATTRIBUTE, BOOKING_SNAPSHOT_KEY, BUILT_IN_POLICY_LABELS, CAMPAIGN_PARAM, CHECKOUT_CONTEXT_KEY, CHECKOUT_EVENT, CHECKOUT_PARTS, CHECKOUT_STRUCTURE, CONTACT_ENDPOINT_REQUIRED, CONTACT_EVENT, CONTACT_LIMITS, DEFAULT_CHILD_AGE, DEFAULT_CLUSTER, DEFAULT_CONTACT_FIELDS, DEFAULT_FEATURED_COUNTRIES, DEFAULT_FIT, DEFAULT_FLAG_FILTERS, DEFAULT_GUEST_LIMITS, DEFAULT_MAP_STYLE_URL, DEFAULT_SORT_OPTIONS, ENHANCE_PARTS, FAVORITES_EVENT, FAVORITE_LEAVE_MS, GATE_MARKERS, GLYPHS, HIDDEN_ROOM_ATTRIBUTES, HUB_ENDPOINTS, MULTI_RATE_CODES, NO_INSURANCE_DOCS, POLICY_DEADLINE_HAS_TIME, QUOTE_EVENT, QUOTE_PARAM_KEYS, RELOAD_FLASH_MS, RentalAddressModeError, RentalContentError, SALUTATION_WIRE_VALUES, SAME_SPOT_METERS, SDK_ENV, SEARCH_PAGE_SIZE, SEARCH_PARAMS, SORT_URL_VALUE, STAGES, SUBMIT_WORDING, SdkEnvError, TRACKING_PARAM_PATTERN, VOFFICE_ENDPOINTS, WATER_KINDS, WINDOW_PARAM_KEYS, acquireFavorites, acquireQuoteFlow, acquireSearchStore, activeFilters, adaptGuestQuote, adaptRental, addDays, addQuoteService, agesComplete, amenityPreview, assertCheckoutStructure, assignSlugs, browserStorage, buildContactInput, buildShowcaseGroups, campaignChips, campaignGroup, cardSource, catalogueResultItem, checkoutHref, checkoutSearch, circleOffsets, clampParty, clearQuoteServices, compareUndatedSearchOrder, connectSearchStore, contactSpecProblems, countryOptions, createCheckoutFlow, createContactForm, createDateSearch, createFavorites, createGuestForm, createGuestSearch, createQuoteFlow, createResultsMapController, createSdk, createSearchForm, createSearchStore, createStayPicker, createStore, dayPriceLabel, defineCopy, describeOutcome, describePeriod, describePolicyOffer, describeSdkError, descriptionPreview, descriptionSummary, detectCountry, dialCode, distanceFact, distanceMeters, emailError, externalSearchHref, facetOptions, favoritesStorageKey, fetchEndAvailability, fetchInitialAvailability, fetchLegalDocuments, fetchQuote, fetchRentalFlags, fetchSearchPage, fillTemplate, findCampaignStart, findOfferWindows, floorplanUrl, foldSearchText, formatIsoDate, formatPriceLabel, formatStayRange, frameFor, freeCancellationUntil, guestBounds, handoverQuery, hasMapPoints, idsInView, insuranceDocsPending, insuranceIdToReapply, insuranceProductKey, isAdjacent, isBuiltInPolicy, isIsoDay, isRateConfigurationFault, isSpecEcho, isSubmittableOption, isTrackingParam, layoutSameSpot, loadRentalCatalogue, loadRentalFacts, loadRentalIndex, loadSharedSdk, logSdkFailure, mapPoints, matchRentals, matches, measureFilters, mergePlaces, minimumSteps, newestReviewsFirst, nightsBetween, normalizePhone, normalizeStructuredDocument, occupancyOf, offerWindowHref, offeredPolicies, offersWindowQuery, parseCounts, parseDistances, parsePriceLabel, parseTextBlocks, partyPairs, payWithOption, phoneError, plainText, policyStance, policyTerms, policyTitle, postalcodeError, prefillFromParams, pricePolicyBranches, queryShape, quickFilterDefs, rankHighlights, readCheckoutHandover, readParty, readPaymentReturn, readQuoteHandover, readSearch, readSelection, regionOptions, regionsByRental, removeQuoteService, rentalAddressLine, rentalFactsMap, rentalIndexEntries, resolveContactFields, resolveFilters, resolveSdk, resolveSearchGroups, resultCardSource, resultsQueryFlagScript, rotationWindow, routeContactIssues, routeHref, runLiveSearch, sanitizeSearch, saveCheckoutContext, sdkConfigFor, sdkConfigFromEnv, searchHref, seededShuffle, selectQuoteInsurance, selectQuotePolicy, selectRelated, selectRentals, selectableInsuranceOptions, selectedInsuranceOption, shareSdk, shareUrl, shortReviewerName, shownInsuranceResources, slugify, sortFromSearch, sortResults, splitReviewAuthor, stabilizeCardOrder, stayKeyOf, stayQuery, streetWarning, submitBooking, toCardModel, toSdkQuery, toSdkSort, todayIso, validateContactValues, walkSearchPages, webpSrcset, webpUrl, withRentalFacts, withoutFilter, withoutFilters, withoutTracking, writeQuoteParams, writeSearch, writeSelection };
@@ -4,6 +4,7 @@
4
4
 
5
5
  Release notes of `@v-office/website-headless`, newest first. Each version has its own directory.
6
6
 
7
+ - `versions/1.3.0/CHANGELOG.md`: release notes for 1.3.0
7
8
  - `versions/1.2.0/CHANGELOG.md`: release notes for 1.2.0
8
9
  - `versions/1.1.1/CHANGELOG.md`: release notes for 1.1.1
9
10
  - `versions/1.1.0/CHANGELOG.md`: release notes for 1.1.0
@@ -4,6 +4,7 @@
4
4
 
5
5
  Migration guides of `@v-office/website-headless`, newest first. Apply them in order when skipping versions.
6
6
 
7
+ - `versions/1.3.0/MIGRATION.md`: Migration: 1.2.0 to 1.3.0
7
8
  - `versions/1.2.0/MIGRATION.md`: Migration: 1.1.1 to 1.2.0
8
9
  - `versions/1.1.1/MIGRATION.md`: Migration: 1.1.0 to 1.1.1
9
10
  - `versions/1.1.0/MIGRATION.md`: Migration: 1.0.0 to 1.1.0
@@ -0,0 +1,21 @@
1
+ # Changelog: 1.3.0
2
+
3
+ The search's region field and `?region=` scope can come from the website's region tree
4
+ (`sdk.static.regions.getRegions` of `@v-office/website-sdk` 2.37.1 or later, v10 and v9).
5
+ These helpers were described for 1.2.0, but 1.2.0 was published without them.
6
+
7
+ ## Added
8
+
9
+ - `regionOptions(tree, { locale, rentalIds })` returns every region holding one of the site's
10
+ rentals as a `RegionChoice` (`value` = the region's id, its key such as `dornum`; `label` =
11
+ its name; `count` of the site's rentals; `group` = the top-level region's name for a
12
+ subregion), in the tree's order. `rentalIds` are the ids of the rentals the site reads: the
13
+ tree ignores the SDK's `rentalScope`. Pass them as the `regions` prop of `SearchBar` from
14
+ `@v-office/website-components`, and as the options of a curated hidden `region` facet.
15
+ - `regionsByRental(tree)` maps each rental id to every region holding it, ancestors included,
16
+ for the `regions` of `cardSource`. `?region=<id>` then also finds the subregions' rentals.
17
+ - The types `RegionChoice`, `RegionOptionsInput` and `RegionTree`.
18
+
19
+ ## Changed
20
+
21
+ - Nothing for existing code. Without a region tree, regions work as before.
@@ -0,0 +1,10 @@
1
+ # Migration: 1.2.0 to 1.3.0
2
+
3
+ No changes required. To take a site's regions from the region tree, see
4
+ `@v-office/website-sdk`'s `regions.md` (website-sdk 2.37.1 or later).
5
+
6
+ ## 1. Upgrade
7
+
8
+ ```sh
9
+ pnpm add --save-exact @v-office/website-headless@1.3.0
10
+ ```
@@ -0,0 +1,3 @@
1
+ {
2
+ "componentsAffectedByHeadlessChange": []
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v-office/website-headless",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Framework-free behaviour layer for v-office websites, never UI: stores, pure rules and SDK runners for the search bar, results, map, showcase, quote, checkout and contact form, the rental and card models, and progressive-enhancement engines for server-rendered markup (./enhance)",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "26.5.1",
29
- "@v-office/website-sdk": "2.34.0",
29
+ "@v-office/website-sdk": "2.37.1",
30
30
  "effect": "4.0.0-rc.115",
31
31
  "jsdom": "^30.0.1",
32
32
  "oxfmt": "0.67.0",