@v-office/website-headless 1.1.1 → 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`,
@@ -1521,10 +1522,13 @@ flow.start();
1521
1522
 
1522
1523
  - `readCheckoutHandover(search, options?)` (`CheckoutHandoverOptions`: `defaultAdults`,
1523
1524
  `allowOption`) → `CheckoutHandover`: `stay` (`Stay` or null: the missing-stay card), `policyId` (a
1524
- seed, applied only while still offered), `kind` (`"option"` only with `allowOption`),
1525
- `paymentReturn` (`?return=1`). Reads `pets` and the legacy `petsCount`.
1526
- - `checkoutSearch({ stay, policyId, kind }, current?)` → the query string for `replaceState` after
1527
- an edit; every other parameter of `current` is kept.
1525
+ seed, applied only while still offered), `kind` (`"option"` only with `allowOption`), `services`
1526
+ (`?service=<id>:<count>`, repeatable, `<id>` alone is one: extras to add; a seed like `policyId`,
1527
+ added only as far as the quote offers them), `paymentReturn` (`?return=1`). Reads `pets` and the
1528
+ legacy `petsCount`.
1529
+ - `checkoutSearch({ stay, policyId, kind, counts? }, current?)` → the query string for `replaceState`
1530
+ after an edit; with `counts` the chosen extras replace the URL's `service` keys, without them those
1531
+ stay; every other parameter of `current` is kept.
1528
1532
  - `BookingKind`: `"booking" | "option"` (a non-binding option, SDK `kind: "OPTION"`).
1529
1533
  - `Stay`: `{ start, end, party }`, serializable.
1530
1534
 
@@ -1790,6 +1794,22 @@ build time; the result is plain data passed to islands.
1790
1794
  non-English tags first, then English tags with an explicit region; bare `"en"` is never maximized.
1791
1795
  - `CountryCode`: ISO 3166-1 alpha-2; the register is never filtered.
1792
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
+
1793
1813
  ## Legal documents
1794
1814
 
1795
1815
  Module `legal`. Build time only.
@@ -1,4 +1,4 @@
1
- import { An as LngLat, Mn as MapPoint, _a as EnhancePart, a as PlaceMarker, ba as GateMarkers, ga as ENHANCE_PARTS, jn as MapBounds, s as ClusterOptions, va as EnhanceParts, wn as SameSpotLayout, ya as GATE_MARKERS } from "../index-CPMXjfFH.mjs";
1
+ import { An as LngLat, Mn as MapPoint, _a as EnhancePart, a as PlaceMarker, ba as GateMarkers, ga as ENHANCE_PARTS, jn as MapBounds, s as ClusterOptions, va as EnhanceParts, wn as SameSpotLayout, ya as GATE_MARKERS } from "../index-Dlf8Hlzc.mjs";
2
2
  //#region src/enhance/lifecycle.d.ts
3
3
  /** Removes everything a binder added. Safe to call more than once. */
4
4
  type Dispose = () => void;
@@ -1646,6 +1646,8 @@ interface SearchParamKeys {
1646
1646
  readonly policy: "policy";
1647
1647
  /** A booking kind handed to the checkout. */
1648
1648
  readonly kind: "kind";
1649
+ /** An extra handed to the checkout, `id:count`, repeatable (the website chat puts a stay together). */
1650
+ readonly service: "service";
1649
1651
  /** The payment-return marker on the checkout page. */
1650
1652
  readonly return: "return";
1651
1653
  /** An offer label carried from a result to the rental page, repeatable. */
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as describeOutcome, $i as RentalFlag, $n as fetchRentalFlags, $r as CardSource, $t as GuestBound, A as QueryShape, Ai as SdkMode, An as LngLat, Ar as SdkConfigForInput, At as quickFilterDefs, B as toSdkQuery, Bi as RentalDistance, Bn as resultCardSource, Br as RouteParams, Bt as SEARCH_PARAMS, C as SearchState, Ci as isIsoDay, Cn as SameSpotGroup, Cr as EnvRecord, Ct as ResolvedFilters, D as createSearchStore, Di as Locale, Dn as circleOffsets, Dr as HUB_ENDPOINTS, Dt as facetOptions, E as SearchStoreOptions, Ei as Backend, En as SameSpotOptions, Er as sdkConfigFromEnv, Et as activeFilters, F as externalSearchHref, Fi as WebsiteSdk, Fn as mapPoints, Fr as CardSourceExtras, Ft as writeSelection, G as sortFromSearch, Gi as parseCounts, Gn as PreviewStrategy, Gr as CardBadge, Gt as SearchQuery, H as SORT_URL_VALUE, Hi as distanceFact, Hn as shortReviewerName, Hr as routeHref, Ht as SearchParamAliases, I as handoverQuery, Ii as resolveSdk, In as ResultLinkOptions, Ir as cardSource, It as partyPairs, J as EmptyCause, Ji as BedRun, Jn as DEFAULT_FLAG_FILTERS, Jr as CardImage, Jt as searchHref, K as sortResults, Ki as parseDistances, Kn as descriptionPreview, Kr as CardContext, Kt as WriteSearchOptions, L as queryShape, Li as ADJACENT_BELOW_M, Ln as SearchResultItem, Lr as loadRentalFacts, Lt as readParty, M as SanitizedSearch, Mi as SdkSetup, Mn as MapPoint, Mr as VofficeEndpointTable, Mt as resolveFilters, N as SdkQueryOptions, Ni as SdkSource, Nn as PinLabelOptions, Nr as VofficeEndpoints, Nt as withoutFilter, O as ExternalSearchLink, Oi as STAGES, On as distanceMeters, Or as HubEndpointTable, Ot as measureFilters, P as SdkSearchQuery, Pi as Stage, Pn as hasMapPoints, Pr as sdkConfigFor, Pt as withoutFilters, Q as SearchedParts, Qi as RentalDetail, Qn as assignSlugs, Qr as CardRating, Qt as DEFAULT_GUEST_LIMITS, R as resultsQueryFlagScript, Ri as DistanceKind, Rn as catalogueResultItem, Rr as rentalFactsMap, Rt as FlexibleStay, S as SearchScopeKind, Si as formatIsoDate, Sn as PixelOffset, Sr as createSdk, St as ResolveFiltersOptions, T as SearchStore, Ti as todayIso, Tn as SameSpotMode, Tr as SdkEnvError, Tt as WhenEmpty, U as SortKey, Ui as isAdjacent, Un as splitReviewAuthor, Ur as AlternativePeriod, Ut as SearchParamKeys, V as DEFAULT_SORT_OPTIONS, Vi as WATER_KINDS, Vn as newestReviewsFirst, Vr as RouteTemplate, Vt as SearchContract, W as SortOptionState, Wi as isSpecEcho, Wn as DescriptionPreview, Wr as BadgeRule, Wt as SearchPeriod, X as Relaxation, Xi as DescriptionContent, Xn as LoadRentalCatalogueOptions, Xr as CardModelOptions, Xt as ChildAgeRange, Y as OutcomeInput, Yi as CatalogueRental, Yn as FetchRentalFlagsOptions, Yr as CardLiveField, Yt as writeSearch, Z as SearchOutcome, Zi as RentalAddress, Zn as RentalFlagsResult, Zr as CardPill, Zt as DEFAULT_CHILD_AGE, _ as FAVORITE_LEAVE_MS, _a as EnhancePart, _i as Glyph, _n as DEFAULT_FIT, _r as fetchSearchPage, _t as FilterGroupSpec, a as PlaceMarker, aa as ReviewCriterion, ai as RentalFactsMap, an as Party, ar as AmenityPreviewItem, at as OffersWindowSpec, b as SearchActions, ba as GateMarkers, bi as IsoMonth, bn as frameFor, br as SharedSdk, bt as FilterSpec, c as DEFAULT_CLUSTER, ca as PlainTextOptions, ci as toCardModel, cn as clampParty, cr as AdaptEvent, ct as findCampaignStart, d as ResultsMapController, da as StructuredDocumentOptions, di as Range, dn as stayKeyOf, dr as adaptRental, dt as offersWindowQuery, ea as RentalImage, ei as CardStatus, en as GuestBounds, er as loadRentalCatalogue, et as CampaignChip, f as ResultsMapOptions, fa as TextMarkup, fi as matches, fn as Listener, fr as RawSearchPage, ft as ActiveFilter, g as CampaignOf, ga as ENHANCE_PARTS, gi as GLYPHS, gn as createStore, gr as WalkSummary, gt as FilterEntry, h as createResultsMapController, ha as plainText, hi as parsePriceLabel, hn as WritableStore, hr as WalkOptions, ht as FilterDef, i as MapPlace, ia as RentalRoom, ii as RentalFacts, in as GuestOptions, ir as ALWAYS_EXCLUDED_CATEGORIES, it as OfferWindow, j as ResultHandoverOptions, ji as SdkOptions, jn as MapBounds, jr as VOFFICE_ENDPOINTS, jt as readSelection, k as ExternalSearchSource, ki as SdkConfig, kn as layoutSameSpot, kr as HubEndpoints, kt as minimumSteps, l as MapResultsSource, la as RichBlock, li as CardMatch, ln as guestBounds, lr as AdaptRentalOptions, lt as findOfferWindows, m as ResultsMapSurface, ma as parseTextBlocks, mi as formatPriceLabel, mn as Unsubscribe, mr as SearchPageRequest, mt as FacetOptionsOptions, n as RentalAddressModeError, na as RentalReview, ni as PillOptions, nn as GuestKind, nr as slugify, nt as FindCampaignStartOptions, o as mergePlaces, oa as ReviewSummary, oi as StayPrice, on as QuoteOccupancy, or as AmenityPreviewOptions, ot as campaignChips, p as ResultsMapState, pa as normalizeStructuredDocument, pi as PriceCents, pn as Store, pr as SEARCH_PAGE_SIZE, pt as FacetOption, q as toSdkSort, qi as AmenityGroup, qn as descriptionSummary, qr as CardFact, qt as readSearch, r as rentalAddressLine, ra as RentalReviews, ri as RentalCardModel, rn as GuestLimits, rr as HIDDEN_ROOM_ATTRIBUTES, rt as FindOfferWindowsOptions, s as ClusterOptions, sa as RoomKind, si as StayWindow, sn as agesComplete, sr as amenityPreview, st as campaignGroup, t as RentalAddressMode, ta as RentalPropertyInfo, ti as FactKind, tn as GuestCaps, tr as rankHighlights, tt as CampaignChipsInput, u as MapViewReport, ua as RichInline, ui as CardSignal, un as occupancyOf, ur as RentalContentError, ut as offerWindowHref, v as FavoritesPort, va as EnhanceParts, vi as GlyphList, vn as DefaultFit, vr as walkSearchPages, vt as FilterMeasurement, w as SearchStatus, wi as nightsBetween, wn as SameSpotLayout, wr as SDK_ENV, wt as SdkFilterDefinition, x as SearchScope, xi as addDays, xn as idsInView, xr as shareSdk, xt as ImplicitScope, y as HistoryPort, ya as GATE_MARKERS, yi as IsoDay, yn as FitOptions, yr as loadSharedSdk, yt as FilterSelection, z as sanitizeSearch, zi as RentalCounts, zn as compareUndatedSearchOrder, zr as withRentalFacts, zt as QueryPair } from "./index-CPMXjfFH.mjs";
1
+ import { $ as describeOutcome, $i as RentalFlag, $n as fetchRentalFlags, $r as CardSource, $t as GuestBound, A as QueryShape, Ai as SdkMode, An as LngLat, Ar as SdkConfigForInput, At as quickFilterDefs, B as toSdkQuery, Bi as RentalDistance, Bn as resultCardSource, Br as RouteParams, Bt as SEARCH_PARAMS, C as SearchState, Ci as isIsoDay, Cn as SameSpotGroup, Cr as EnvRecord, Ct as ResolvedFilters, D as createSearchStore, Di as Locale, Dn as circleOffsets, Dr as HUB_ENDPOINTS, Dt as facetOptions, E as SearchStoreOptions, Ei as Backend, En as SameSpotOptions, Er as sdkConfigFromEnv, Et as activeFilters, F as externalSearchHref, Fi as WebsiteSdk, Fn as mapPoints, Fr as CardSourceExtras, Ft as writeSelection, G as sortFromSearch, Gi as parseCounts, Gn as PreviewStrategy, Gr as CardBadge, Gt as SearchQuery, H as SORT_URL_VALUE, Hi as distanceFact, Hn as shortReviewerName, Hr as routeHref, Ht as SearchParamAliases, I as handoverQuery, Ii as resolveSdk, In as ResultLinkOptions, Ir as cardSource, It as partyPairs, J as EmptyCause, Ji as BedRun, Jn as DEFAULT_FLAG_FILTERS, Jr as CardImage, Jt as searchHref, K as sortResults, Ki as parseDistances, Kn as descriptionPreview, Kr as CardContext, Kt as WriteSearchOptions, L as queryShape, Li as ADJACENT_BELOW_M, Ln as SearchResultItem, Lr as loadRentalFacts, Lt as readParty, M as SanitizedSearch, Mi as SdkSetup, Mn as MapPoint, Mr as VofficeEndpointTable, Mt as resolveFilters, N as SdkQueryOptions, Ni as SdkSource, Nn as PinLabelOptions, Nr as VofficeEndpoints, Nt as withoutFilter, O as ExternalSearchLink, Oi as STAGES, On as distanceMeters, Or as HubEndpointTable, Ot as measureFilters, P as SdkSearchQuery, Pi as Stage, Pn as hasMapPoints, Pr as sdkConfigFor, Pt as withoutFilters, Q as SearchedParts, Qi as RentalDetail, Qn as assignSlugs, Qr as CardRating, Qt as DEFAULT_GUEST_LIMITS, R as resultsQueryFlagScript, Ri as DistanceKind, Rn as catalogueResultItem, Rr as rentalFactsMap, Rt as FlexibleStay, S as SearchScopeKind, Si as formatIsoDate, Sn as PixelOffset, Sr as createSdk, St as ResolveFiltersOptions, T as SearchStore, Ti as todayIso, Tn as SameSpotMode, Tr as SdkEnvError, Tt as WhenEmpty, U as SortKey, Ui as isAdjacent, Un as splitReviewAuthor, Ur as AlternativePeriod, Ut as SearchParamKeys, V as DEFAULT_SORT_OPTIONS, Vi as WATER_KINDS, Vn as newestReviewsFirst, Vr as RouteTemplate, Vt as SearchContract, W as SortOptionState, Wi as isSpecEcho, Wn as DescriptionPreview, Wr as BadgeRule, Wt as SearchPeriod, X as Relaxation, Xi as DescriptionContent, Xn as LoadRentalCatalogueOptions, Xr as CardModelOptions, Xt as ChildAgeRange, Y as OutcomeInput, Yi as CatalogueRental, Yn as FetchRentalFlagsOptions, Yr as CardLiveField, Yt as writeSearch, Z as SearchOutcome, Zi as RentalAddress, Zn as RentalFlagsResult, Zr as CardPill, Zt as DEFAULT_CHILD_AGE, _ as FAVORITE_LEAVE_MS, _a as EnhancePart, _i as Glyph, _n as DEFAULT_FIT, _r as fetchSearchPage, _t as FilterGroupSpec, a as PlaceMarker, aa as ReviewCriterion, ai as RentalFactsMap, an as Party, ar as AmenityPreviewItem, at as OffersWindowSpec, b as SearchActions, ba as GateMarkers, bi as IsoMonth, bn as frameFor, br as SharedSdk, bt as FilterSpec, c as DEFAULT_CLUSTER, ca as PlainTextOptions, ci as toCardModel, cn as clampParty, cr as AdaptEvent, ct as findCampaignStart, d as ResultsMapController, da as StructuredDocumentOptions, di as Range, dn as stayKeyOf, dr as adaptRental, dt as offersWindowQuery, ea as RentalImage, ei as CardStatus, en as GuestBounds, er as loadRentalCatalogue, et as CampaignChip, f as ResultsMapOptions, fa as TextMarkup, fi as matches, fn as Listener, fr as RawSearchPage, ft as ActiveFilter, g as CampaignOf, ga as ENHANCE_PARTS, gi as GLYPHS, gn as createStore, gr as WalkSummary, gt as FilterEntry, h as createResultsMapController, ha as plainText, hi as parsePriceLabel, hn as WritableStore, hr as WalkOptions, ht as FilterDef, i as MapPlace, ia as RentalRoom, ii as RentalFacts, in as GuestOptions, ir as ALWAYS_EXCLUDED_CATEGORIES, it as OfferWindow, j as ResultHandoverOptions, ji as SdkOptions, jn as MapBounds, jr as VOFFICE_ENDPOINTS, jt as readSelection, k as ExternalSearchSource, ki as SdkConfig, kn as layoutSameSpot, kr as HubEndpoints, kt as minimumSteps, l as MapResultsSource, la as RichBlock, li as CardMatch, ln as guestBounds, lr as AdaptRentalOptions, lt as findOfferWindows, m as ResultsMapSurface, ma as parseTextBlocks, mi as formatPriceLabel, mn as Unsubscribe, mr as SearchPageRequest, mt as FacetOptionsOptions, n as RentalAddressModeError, na as RentalReview, ni as PillOptions, nn as GuestKind, nr as slugify, nt as FindCampaignStartOptions, o as mergePlaces, oa as ReviewSummary, oi as StayPrice, on as QuoteOccupancy, or as AmenityPreviewOptions, ot as campaignChips, p as ResultsMapState, pa as normalizeStructuredDocument, pi as PriceCents, pn as Store, pr as SEARCH_PAGE_SIZE, pt as FacetOption, q as toSdkSort, qi as AmenityGroup, qn as descriptionSummary, qr as CardFact, qt as readSearch, r as rentalAddressLine, ra as RentalReviews, ri as RentalCardModel, rn as GuestLimits, rr as HIDDEN_ROOM_ATTRIBUTES, rt as FindOfferWindowsOptions, s as ClusterOptions, sa as RoomKind, si as StayWindow, sn as agesComplete, sr as amenityPreview, st as campaignGroup, t as RentalAddressMode, ta as RentalPropertyInfo, ti as FactKind, tn as GuestCaps, tr as rankHighlights, tt as CampaignChipsInput, u as MapViewReport, ua as RichInline, ui as CardSignal, un as occupancyOf, ur as RentalContentError, ut as offerWindowHref, v as FavoritesPort, va as EnhanceParts, vi as GlyphList, vn as DefaultFit, vr as walkSearchPages, vt as FilterMeasurement, w as SearchStatus, wi as nightsBetween, wn as SameSpotLayout, wr as SDK_ENV, wt as SdkFilterDefinition, x as SearchScope, xi as addDays, xn as idsInView, xr as shareSdk, xt as ImplicitScope, y as HistoryPort, ya as GATE_MARKERS, yi as IsoDay, yn as FitOptions, yr as loadSharedSdk, yt as FilterSelection, z as sanitizeSearch, zi as RentalCounts, zn as compareUndatedSearchOrder, zr as withRentalFacts, zt as QueryPair } from "./index-Dlf8Hlzc.mjs";
2
2
  import { BookingPaymentOption, BookingPaymentScheduleKind, ContactSubmitInput, GuestQuote, GuestQuoteResult, SubmittableBookingPaymentOption } from "@v-office/website-sdk";
3
3
  import { BackendKind } from "@v-office/website-sdk/capabilities/search";
4
4
  //#region src/map/constants.d.ts
@@ -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`. */
@@ -1666,6 +1709,10 @@ interface CheckoutHandover {
1666
1709
  policyId: string | null;
1667
1710
  /** `?kind=option`, honoured only with `allowOption`; otherwise "booking". */
1668
1711
  kind: BookingKind;
1712
+ /** `?service=<id>:<count>` (repeatable; `<id>` alone is one): the extras to add, by service id. A
1713
+ * seed like `policyId`: the flow adds only what the quote offers, up to the count the PMS allows,
1714
+ * and keeps what it refuses out. Empty without any. */
1715
+ services?: Readonly<Record<string, number>> | undefined;
1669
1716
  /** `?return=1`: a payment provider sent the guest back to this page (sites that return to the
1670
1717
  * checkout itself; the package's own return page is a separate route). */
1671
1718
  paymentReturn: boolean;
@@ -1682,11 +1729,14 @@ interface CheckoutHandoverOptions {
1682
1729
  type ReadCheckoutHandover = (search: string, options?: CheckoutHandoverOptions) => CheckoutHandover;
1683
1730
  /** The query string (no leading "?") for `history.replaceState` after an edit: the stay (pets as
1684
1731
  * `pets`), an explicit policy only (never today's pre-selection, which would pin it), `kind=option`
1685
- * for an option. Every other parameter in `current` (tracking, site keys) is preserved after them. */
1732
+ * for an option, and with `counts` the chosen extras (`service=<id>:<count>`; without `counts` the
1733
+ * URL's `service` keys stay as they are). Every other parameter in `current` (tracking, site keys)
1734
+ * is preserved after them. */
1686
1735
  type CheckoutSearch = (input: {
1687
1736
  stay: Stay | null;
1688
1737
  policyId: string | null;
1689
1738
  kind: BookingKind;
1739
+ counts?: Readonly<Record<string, number>> | undefined;
1690
1740
  }, current?: string) => string;
1691
1741
  /** See {@link ReadCheckoutHandover}. */
1692
1742
  export declare const readCheckoutHandover: ReadCheckoutHandover;
@@ -2797,4 +2847,4 @@ type FetchLegalDocuments = (sdk: WebsiteSdk, locale: Locale) => Promise<LegalDoc
2797
2847
  /** See {@link FetchLegalDocuments}. */
2798
2848
  export declare const fetchLegalDocuments: FetchLegalDocuments;
2799
2849
  //#endregion
2800
- 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 = {
@@ -1469,6 +1497,7 @@ const SEARCH_PARAMS = {
1469
1497
  campaign: "campaign",
1470
1498
  policy: "policy",
1471
1499
  kind: "kind",
1500
+ service: "service",
1472
1501
  return: "return",
1473
1502
  offer: "offer"
1474
1503
  };
@@ -7136,6 +7165,83 @@ const payWithOption = (sdk, option) => sdk.live.booking.submitPaymentOption(opti
7136
7165
  /** The window CustomEvent name. Renaming it is a major. */
7137
7166
  const CHECKOUT_EVENT = "voffice:checkout";
7138
7167
  //#endregion
7168
+ //#region src/checkout/handover.ts
7169
+ const DEFAULT_ADULTS$1 = 2;
7170
+ /** The most distinct extras a URL hands over: more than any quote offers, a bound for junk links. */
7171
+ const MAX_SERVICES = 50;
7172
+ const MAX_SERVICE_ID = 100;
7173
+ /** `id:count` or `id` (one) per `service` key; unreadable entries are skipped, a repeated id adds up
7174
+ * to the cap. */
7175
+ function readServices(params) {
7176
+ const services = /* @__PURE__ */ new Map();
7177
+ for (const raw of params.getAll(SEARCH_PARAMS.service)) {
7178
+ const at = raw.lastIndexOf(":");
7179
+ const id = (at === -1 ? raw : raw.slice(0, at)).trim();
7180
+ const count = at === -1 ? 1 : Number(raw.slice(at + 1));
7181
+ if (!id || id.length > MAX_SERVICE_ID || !Number.isInteger(count) || count < 1) continue;
7182
+ if (!services.has(id) && services.size >= MAX_SERVICES) continue;
7183
+ services.set(id, Math.min(99, (services.get(id) ?? 0) + count));
7184
+ }
7185
+ return Object.fromEntries(services);
7186
+ }
7187
+ /** The keys the write-back owns; everything else in the URL is carried through untouched. */
7188
+ const OWNED_KEYS = /* @__PURE__ */ new Set([
7189
+ SEARCH_PARAMS.start,
7190
+ SEARCH_PARAMS.end,
7191
+ SEARCH_PARAMS.adults,
7192
+ SEARCH_PARAMS.children,
7193
+ SEARCH_PARAMS.childrenAges,
7194
+ SEARCH_PARAMS.babies,
7195
+ SEARCH_PARAMS.pets,
7196
+ SEARCH_PARAMS.petsCount,
7197
+ SEARCH_PARAMS.policy,
7198
+ SEARCH_PARAMS.kind
7199
+ ]);
7200
+ function readHandover(search, options) {
7201
+ const params = new URLSearchParams(search);
7202
+ const start = params.get(SEARCH_PARAMS.start);
7203
+ const end = params.get(SEARCH_PARAMS.end);
7204
+ const dated = isIsoDay(start) && isIsoDay(end) && nightsBetween(start, end) > 0;
7205
+ const party = readParty(params);
7206
+ const adults = party && party.adults > 0 ? party.adults : options.defaultAdults ?? DEFAULT_ADULTS$1;
7207
+ const withAdults = {
7208
+ ...party ?? {
7209
+ children: 0,
7210
+ childrenAges: [],
7211
+ babies: 0,
7212
+ pets: 0
7213
+ },
7214
+ adults
7215
+ };
7216
+ return {
7217
+ stay: dated ? {
7218
+ start,
7219
+ end,
7220
+ party: withAdults
7221
+ } : null,
7222
+ policyId: params.get(SEARCH_PARAMS.policy) || null,
7223
+ kind: options.allowOption === true && params.get(SEARCH_PARAMS.kind) === "option" ? "option" : "booking",
7224
+ services: readServices(params),
7225
+ paymentReturn: params.get(SEARCH_PARAMS.return) === "1"
7226
+ };
7227
+ }
7228
+ function writeHandover({ stay, policyId, kind, counts }, current) {
7229
+ const pairs = [];
7230
+ if (stay) pairs.push([SEARCH_PARAMS.start, stay.start], [SEARCH_PARAMS.end, stay.end], ...partyPairs(stay.party, SEARCH_PARAMS.pets));
7231
+ if (policyId) pairs.push([SEARCH_PARAMS.policy, policyId]);
7232
+ if (kind === "option") pairs.push([SEARCH_PARAMS.kind, "option"]);
7233
+ if (counts) {
7234
+ for (const [id, count] of Object.entries(counts)) if (count > 0) pairs.push([SEARCH_PARAMS.service, `${id}:${count}`]);
7235
+ }
7236
+ const owned = (key) => OWNED_KEYS.has(key) || counts !== void 0 && key === SEARCH_PARAMS.service;
7237
+ const carried = [...new URLSearchParams(current)].filter(([key]) => !owned(key));
7238
+ return new URLSearchParams([...pairs, ...carried].map(([key, value]) => [key, value])).toString();
7239
+ }
7240
+ /** See {@link ReadCheckoutHandover}. */
7241
+ const readCheckoutHandover = (search, options) => readHandover(search, options ?? {});
7242
+ /** See {@link CheckoutSearch}. */
7243
+ const checkoutSearch = (input, current) => writeHandover(input, current ?? "");
7244
+ //#endregion
7139
7245
  //#region src/checkout/insurance.ts
7140
7246
  /** Nothing opened, nothing confirmed. */
7141
7247
  const NO_INSURANCE_DOCS = {
@@ -7202,11 +7308,11 @@ async function run(sdk, input) {
7202
7308
  };
7203
7309
  const cleared = await clearQuoteServices(sdk, result.live);
7204
7310
  if (!cleared.ok) throw new Error("clearAdditionalServices failed: the extras baseline is unknown");
7205
- const stepped = await stepServices(sdk, cleared.quote, result.view, input.counts);
7206
- const policy = await applyPolicy(sdk, stepped.quote, input);
7207
- const reapply = insuranceIdToReapply(adaptGuestQuote(policy.quote), input.insurance);
7208
- const insured = reapply === void 0 ? null : await selectQuoteInsurance(sdk, policy.quote, reapply);
7209
- const quote = insured?.ok ? insured.quote : policy.quote;
7311
+ const policy = await applyPolicy(sdk, cleared.quote, input);
7312
+ const stepped = await stepServices(sdk, policy.quote, adaptGuestQuote(policy.quote), input.counts);
7313
+ const reapply = insuranceIdToReapply(adaptGuestQuote(stepped.quote), input.insurance);
7314
+ const insured = reapply === void 0 ? null : await selectQuoteInsurance(sdk, stepped.quote, reapply);
7315
+ const quote = insured?.ok ? insured.quote : stepped.quote;
7210
7316
  return {
7211
7317
  kind: "priced",
7212
7318
  quote,
@@ -7266,8 +7372,7 @@ const requote = (sdk, input) => run(sdk, input);
7266
7372
  //#region src/checkout/flow.ts
7267
7373
  /** Later edits coalesce (a burst of stepper clicks prices once); the first quote runs at once. */
7268
7374
  const REQUOTE_DELAY_MS = 350;
7269
- const DEFAULT_ADULTS$1 = 2;
7270
- const DEFAULT_MAX_PER_BOOKING = 99;
7375
+ const DEFAULT_ADULTS = 2;
7271
7376
  const chosenInsurance = (view) => selectedInsuranceOption(view?.insurance);
7272
7377
  /** The handed-over stay under the same party rules as the quote: clamped to the bounds and every age
7273
7378
  * outside the band unchosen (the child-ages blocker then asks for it). */
@@ -7281,7 +7386,7 @@ function handedOverStay(options, how) {
7281
7386
  };
7282
7387
  }
7283
7388
  function initialRaw(options, how) {
7284
- const { policyId } = options.handover;
7389
+ const { policyId, services } = options.handover;
7285
7390
  const stay = handedOverStay(options, how);
7286
7391
  return {
7287
7392
  phase: stay ? { kind: "loading" } : { kind: "missing-stay" },
@@ -7289,7 +7394,7 @@ function initialRaw(options, how) {
7289
7394
  live: null,
7290
7395
  view: null,
7291
7396
  quoted: null,
7292
- counts: {},
7397
+ counts: services ?? {},
7293
7398
  issue: null,
7294
7399
  chosenPolicyId: policyId,
7295
7400
  voucher: {
@@ -7311,7 +7416,7 @@ function initialRaw(options, how) {
7311
7416
  function derivationOf(options) {
7312
7417
  const { guests, caps } = options;
7313
7418
  const emptyParty = {
7314
- adults: guests?.defaultAdults ?? DEFAULT_ADULTS$1,
7419
+ adults: guests?.defaultAdults ?? DEFAULT_ADULTS,
7315
7420
  children: 0,
7316
7421
  childrenAges: [],
7317
7422
  babies: 0,
@@ -7341,7 +7446,7 @@ function derivationOf(options) {
7341
7446
  function servicesOf(raw, busy) {
7342
7447
  return (raw.view?.services ?? []).map((service) => {
7343
7448
  const count = raw.counts[service.id] ?? 0;
7344
- const max = service.maxPerBooking ?? DEFAULT_MAX_PER_BOOKING;
7449
+ const max = service.maxPerBooking ?? 99;
7345
7450
  return {
7346
7451
  ...service,
7347
7452
  count,
@@ -8088,61 +8193,6 @@ function guestForm(options) {
8088
8193
  /** See {@link CreateGuestForm}. */
8089
8194
  const createGuestForm = (options) => guestForm(options);
8090
8195
  //#endregion
8091
- //#region src/checkout/handover.ts
8092
- const DEFAULT_ADULTS = 2;
8093
- /** The keys the write-back owns; everything else in the URL is carried through untouched. */
8094
- const OWNED_KEYS = /* @__PURE__ */ new Set([
8095
- SEARCH_PARAMS.start,
8096
- SEARCH_PARAMS.end,
8097
- SEARCH_PARAMS.adults,
8098
- SEARCH_PARAMS.children,
8099
- SEARCH_PARAMS.childrenAges,
8100
- SEARCH_PARAMS.babies,
8101
- SEARCH_PARAMS.pets,
8102
- SEARCH_PARAMS.petsCount,
8103
- SEARCH_PARAMS.policy,
8104
- SEARCH_PARAMS.kind
8105
- ]);
8106
- function readHandover(search, options) {
8107
- const params = new URLSearchParams(search);
8108
- const start = params.get(SEARCH_PARAMS.start);
8109
- const end = params.get(SEARCH_PARAMS.end);
8110
- const dated = isIsoDay(start) && isIsoDay(end) && nightsBetween(start, end) > 0;
8111
- const party = readParty(params);
8112
- const adults = party && party.adults > 0 ? party.adults : options.defaultAdults ?? DEFAULT_ADULTS;
8113
- const withAdults = {
8114
- ...party ?? {
8115
- children: 0,
8116
- childrenAges: [],
8117
- babies: 0,
8118
- pets: 0
8119
- },
8120
- adults
8121
- };
8122
- return {
8123
- stay: dated ? {
8124
- start,
8125
- end,
8126
- party: withAdults
8127
- } : null,
8128
- policyId: params.get(SEARCH_PARAMS.policy) || null,
8129
- kind: options.allowOption === true && params.get(SEARCH_PARAMS.kind) === "option" ? "option" : "booking",
8130
- paymentReturn: params.get(SEARCH_PARAMS.return) === "1"
8131
- };
8132
- }
8133
- function writeHandover({ stay, policyId, kind }, current) {
8134
- const pairs = [];
8135
- if (stay) pairs.push([SEARCH_PARAMS.start, stay.start], [SEARCH_PARAMS.end, stay.end], ...partyPairs(stay.party, SEARCH_PARAMS.pets));
8136
- if (policyId) pairs.push([SEARCH_PARAMS.policy, policyId]);
8137
- if (kind === "option") pairs.push([SEARCH_PARAMS.kind, "option"]);
8138
- const carried = [...new URLSearchParams(current)].filter(([key]) => !OWNED_KEYS.has(key));
8139
- return new URLSearchParams([...pairs, ...carried].map(([key, value]) => [key, value])).toString();
8140
- }
8141
- /** See {@link ReadCheckoutHandover}. */
8142
- const readCheckoutHandover = (search, options) => readHandover(search, options ?? {});
8143
- /** See {@link CheckoutSearch}. */
8144
- const checkoutSearch = (input, current) => writeHandover(input, current ?? "");
8145
- //#endregion
8146
8196
  //#region src/checkout/structure.ts
8147
8197
  /** The legal `data-part` vocabulary. Imported components carry it; a custom checkout must keep it.
8148
8198
  * Style-only hooks are not here (components `BOOKING_PARTS`). Renaming a part is a major. */
@@ -8935,4 +8985,4 @@ function parseNodes(data) {
8935
8985
  /** See {@link FetchLegalDocuments}. */
8936
8986
  const fetchLegalDocuments = (sdk, locale) => fetchDocuments(sdk, locale);
8937
8987
  //#endregion
8938
- 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,8 @@
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
8
+ - `versions/1.2.0/CHANGELOG.md`: release notes for 1.2.0
7
9
  - `versions/1.1.1/CHANGELOG.md`: release notes for 1.1.1
8
10
  - `versions/1.1.0/CHANGELOG.md`: release notes for 1.1.0
9
11
  - `versions/1.0.0/CHANGELOG.md`: release notes for 1.0.0
@@ -4,6 +4,8 @@
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
8
+ - `versions/1.2.0/MIGRATION.md`: Migration: 1.1.1 to 1.2.0
7
9
  - `versions/1.1.1/MIGRATION.md`: Migration: 1.1.0 to 1.1.1
8
10
  - `versions/1.1.0/MIGRATION.md`: Migration: 1.0.0 to 1.1.0
9
11
  - `versions/1.0.0/MIGRATION.md`: Migration: 0.2.0 to 1.0.0
@@ -0,0 +1,24 @@
1
+ # Changelog: 1.2.0
2
+
3
+ The booking page takes the extras a link hands over. AI Studio's website chat puts a stay together
4
+ with extras (bed linen, a cot, a second dog, …) and links to the booking page with them chosen.
5
+
6
+ ## Added
7
+
8
+ - `readCheckoutHandover` reads `?service=<id>:<count>` (repeatable; `<id>` alone is one) into
9
+ `services`. The checkout flow adds them with its first quote, like the handed-over rate: only extras
10
+ the quote offers, only as many as the PMS allows. What it refuses stays out; the price on the
11
+ booking page is always the PMS's for what is selected.
12
+ - `checkoutSearch` takes `counts`, the chosen extras, and writes them as `service` keys; without
13
+ `counts` the URL's `service` keys stay as they are.
14
+
15
+ ## Changed
16
+
17
+ - Nothing for existing links: a URL without `service` keys works as before.
18
+
19
+ ## Fixed
20
+
21
+ - The checkout keeps the rate the guest chose when the extras already chosen exceed that rate's
22
+ limits. Each rate has its own extras and limits, and the checkout used to add the extras first,
23
+ so the PMS refused the rate and the price fell back to the standard rate. It now applies the rate
24
+ first and adds the extras within that rate's limits; what it refuses stays out.
@@ -0,0 +1,11 @@
1
+ # Migration: 1.1.1 to 1.2.0
2
+
3
+ No changes required. A site with the platform's `Booking` gets the extras through
4
+ `@v-office/website-components` 1.1.0, which writes the chosen extras back into the URL. A site
5
+ with its own checkout passes `counts` (the chosen extras by id) to `checkoutSearch` to do the same.
6
+
7
+ ## 1. Upgrade
8
+
9
+ ```sh
10
+ pnpm add --save-exact @v-office/website-headless@1.2.0
11
+ ```
@@ -0,0 +1,3 @@
1
+ {
2
+ "componentsAffectedByHeadlessChange": ["booking"]
3
+ }
@@ -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.1.1",
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",