@v-office/website-sdk 2.28.1 → 2.30.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.
Files changed (43) hide show
  1. package/README.md +8 -0
  2. package/dist/cli.mjs +406 -12
  3. package/dist/{client-EtS0Qm3i.mjs → client-CKVwzIQ4.mjs} +381 -53
  4. package/dist/index.d.mts +45 -6
  5. package/dist/index.mjs +1 -1
  6. package/dist/instructions/CHANGELOG.md +2 -0
  7. package/dist/instructions/MIGRATION.md +2 -0
  8. package/dist/instructions/README.md +3 -2
  9. package/dist/instructions/availability.md +22 -2
  10. package/dist/instructions/creation.md +35 -4
  11. package/dist/instructions/custom-attributes.md +2 -2
  12. package/dist/instructions/filter.md +5 -3
  13. package/dist/instructions/quote.md +1 -1
  14. package/dist/instructions/rentals.md +36 -0
  15. package/dist/instructions/search.md +220 -6
  16. package/dist/instructions/versions/2.29.0/CHANGELOG.md +62 -0
  17. package/dist/instructions/versions/2.29.0/MIGRATION.md +97 -0
  18. package/dist/instructions/versions/2.30.0/CHANGELOG.md +40 -0
  19. package/dist/instructions/versions/2.30.0/MIGRATION.md +30 -0
  20. package/dist/{v9-data-C3SWtDGs.mjs → operations-CfjJjdrw.mjs} +3122 -1
  21. package/dist/{rentals-B4g91vwW.mjs → rentals-cmqp5dTw.mjs} +4 -5
  22. package/dist/{search-B-lvOmXL.mjs → search-DPsBki_9.mjs} +6 -5
  23. package/dist/{to-rental-highlights-BL5m3Uen.mjs → to-rental-highlights-D7oepO6s.mjs} +1 -1
  24. package/dist/translations/v9/de-DE/core.json +8 -1
  25. package/dist/translations/v9/en-US/core.json +8 -1
  26. package/instructions/CHANGELOG.md +2 -0
  27. package/instructions/MIGRATION.md +2 -0
  28. package/instructions/README.md +3 -2
  29. package/instructions/availability.md +22 -2
  30. package/instructions/creation.md +35 -4
  31. package/instructions/custom-attributes.md +2 -2
  32. package/instructions/filter.md +5 -3
  33. package/instructions/quote.md +1 -1
  34. package/instructions/rentals.md +36 -0
  35. package/instructions/search.md +220 -6
  36. package/instructions/versions/2.29.0/CHANGELOG.md +62 -0
  37. package/instructions/versions/2.29.0/MIGRATION.md +97 -0
  38. package/instructions/versions/2.29.0/release.json +3 -0
  39. package/instructions/versions/2.30.0/CHANGELOG.md +40 -0
  40. package/instructions/versions/2.30.0/MIGRATION.md +30 -0
  41. package/instructions/versions/2.30.0/release.json +3 -0
  42. package/package.json +6 -4
  43. package/dist/operations-DwURbo0b.mjs +0 -2850
@@ -1,6 +1,6 @@
1
- import { a as customDataAttribute, l as parseVofficeUnitData } from "./v9-data-C3SWtDGs.mjs";
2
- import { AvailabilityService, BookingBookOutput, BookingService, ContactService, CoreSDKError, DEFAULT_RENTAL_HIGHLIGHT_PRIORITIZATION, DEFAULT_RENTAL_PROPERTY_HIGHLIGHT_PRIORITIZATION, DocumentsService, EMPTY_CUSTOM_ATTRIBUTE_REGISTRY, FilterService, QuoteService, RentalService, SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS, SearchService, TranslationService, addGuestQuoteAdditionalServiceSelection, asArray, asRecord, assertNoNestedCustomAttributeFilterCompositions, assertNoReservedQueryKeys, assertUniqueCustomFilterQueryKeys, assertUniqueFilterQueryKeys, clearGuestQuoteAdditionalServiceSelections, collectQueryParameters, createCoreRuntime, expandCustomAttributeFilterCompositions, firstNumber, firstString, formatCurrency, formatLocalDate, getBookingBookGuestToken, getGuestQuoteBackendContext, getGuestQuoteInput, isDisplayableCustomAttribute, localeToLanguage, makeMinIntervalLimiter, makeTranslationLive, parseQueryParameters, refreshGuestQuoteInsurancePassthrough, removeGuestQuoteAdditionalServiceSelection, selectGuestQuoteCancellationPolicySelection, toCustomAttributeFilterLabel, toCustomAttributeFilterOutputItem, toCustomAttributeList, toInitialAvailabilityCalendarDays, toQueryString, toResolvedCustomAttributeCategoryTranslationKey, toStartDateSelectedCalendarDays, validateContactSubmitInput, withGuestQuoteInsurance, withGuestQuoteInsuranceRefresh } from "@v-office/sdk-core";
3
- import { Context, Data, DateTime, Effect, Layer, Schema, SchemaGetter } from "effect";
1
+ import { m as customDataAttribute, t as voucherValidityQuery, v as parseVofficeUnitData } from "./operations-CfjJjdrw.mjs";
2
+ import { AvailabilityService, BookingBookOutput, BookingService, ContactService, CoreSDKError, DEFAULT_RENTAL_HIGHLIGHT_PRIORITIZATION, DEFAULT_RENTAL_PROPERTY_HIGHLIGHT_PRIORITIZATION, DocumentsService, EMPTY_CUSTOM_ATTRIBUTE_REGISTRY, FilterService, QuoteService, RentalService, SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS, SearchService, TranslationService, addGuestQuoteAdditionalServiceSelection, asArray, asRecord, assertNoNestedCustomAttributeFilterCompositions, assertNoReservedQueryKeys, assertUniqueCustomFilterQueryKeys, assertUniqueFilterQueryKeys, clearGuestQuoteAdditionalServiceSelections, collectQueryParameters, createCoreRuntime, daysBetweenLocalDates, expandCustomAttributeFilterCompositions, firstNumber, firstString, formatCurrency, formatLocalDate, getBookingBookGuestToken, getGuestQuoteBackendContext, getGuestQuoteInput, isDisplayableCustomAttribute, localeToLanguage, makeMinIntervalLimiter, makeTranslationLive, parseQueryParameters, refreshGuestQuoteInsurancePassthrough, removeGuestQuoteAdditionalServiceSelection, selectGuestQuoteCancellationPolicySelection, toCustomAttributeFilterLabel, toCustomAttributeFilterOutputItem, toCustomAttributeList, toInitialAvailabilityCalendarDays, toIsoDateFromPeriodQueryDate, toQueryString, toResolvedCustomAttributeCategoryTranslationKey, toStartDateSelectedCalendarDays, validateContactSubmitInput, withGuestQuoteInsurance, withGuestQuoteInsuranceRefresh } from "@v-office/sdk-core";
3
+ import { Clock, Context, Data, DateTime, Duration, Effect, Layer, Schema, SchemaGetter } from "effect";
4
4
  import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/unstable/http";
5
5
  import { Kind, print, visit } from "graphql";
6
6
  //#region codegen/v9/graphql-codegen/stable-filters.json
@@ -162,6 +162,20 @@ var stable_filters_default = {
162
162
  }
163
163
  };
164
164
  //#endregion
165
+ //#region src/legacy-v9/hub-filter-keys.ts
166
+ const V9_HUB_RENTAL_IDS_FILTER_KEY = "voffice_id";
167
+ const V9_HUB_FACILITY_SCOPE_FILTER_KEY = "facility_scope";
168
+ const V9_HUB_OBJECT_GROUP_SCOPE_FILTER_KEY = "objectGroup_scope";
169
+ const V9_HUB_OBJECT_GROUP_FILTER_KEY = "objectGroup";
170
+ const V9_HUB_FACILITY_SEARCH_FILTER_KEY = "facility_search";
171
+ const V9_HUB_OFFERS_FILTER_KEY = "offers";
172
+ const V9_HUB_OFFER_FILTER_KEY = "offer";
173
+ const V9_SDK_OWNED_HUB_FILTER_KEYS = /* @__PURE__ */ new Set([
174
+ V9_HUB_RENTAL_IDS_FILTER_KEY,
175
+ V9_HUB_FACILITY_SCOPE_FILTER_KEY,
176
+ V9_HUB_OBJECT_GROUP_SCOPE_FILTER_KEY
177
+ ]);
178
+ //#endregion
165
179
  //#region src/legacy-v9/facility-attribute-keys.ts
166
180
  const V9_FACILITY_ATTRIBUTE_KEYS = [
167
181
  "allergic",
@@ -328,6 +342,12 @@ const toV9Options = (options) => {
328
342
  operation: "options.normalize",
329
343
  message: `${collisions.join(", ")} ${collisions.length === 1 ? "is" : "are"} already owned by a v9 built-in search filter. Rename the configured custom filter.`
330
344
  });
345
+ const sdkOwnedKeys = [...new Set(options.customAttributeFilterDefinitions.filter((definition) => definition.source === "backendFilter").map((definition) => definition.key).filter((key) => V9_SDK_OWNED_HUB_FILTER_KEYS.has(key)))];
346
+ if (sdkOwnedKeys.length > 0) throw new CoreSDKError({
347
+ source: "v9",
348
+ operation: "options.normalize",
349
+ message: `${sdkOwnedKeys.join(", ")} ${sdkOwnedKeys.length === 1 ? "is" : "are"} set by the SDK and cannot be a backendFilter key. Rename the configured custom filter.`
350
+ });
331
351
  return {
332
352
  ...options.translationOverrides === void 0 ? {} : { translationOverrides: options.translationOverrides },
333
353
  customAttributes: options.customAttributes,
@@ -396,7 +416,9 @@ const V9_CONFIG_FIELDS = {
396
416
  v0ApiBaseUrl: true,
397
417
  v1ApiBaseUrl: true,
398
418
  rentalDataAttributes: true,
399
- facilityObjectGroupRelationAttributeId: true
419
+ facilityObjectGroupRelationAttributeId: true,
420
+ rentalScopePropertyKind: true,
421
+ rentalIdsSearch: true
400
422
  };
401
423
  const OPTION_FIELDS = {
402
424
  translationOverrides: true,
@@ -659,7 +681,20 @@ const submitContactEffect = (input) => Effect.gen(function* () {
659
681
  });
660
682
  //#endregion
661
683
  //#region src/legacy-v9/config.ts
684
+ const toV9RentalScopePropertyKind = (config) => config.rentalScopePropertyKind ?? "facility";
662
685
  const validateWebsiteV9Config = (config) => {
686
+ const propertyKind = config.rentalScopePropertyKind;
687
+ if (propertyKind !== void 0 && propertyKind !== "facility" && propertyKind !== "objectGroup") throw new CoreSDKError({
688
+ source: "v9",
689
+ operation: "v9.config",
690
+ message: `Expected rentalScopePropertyKind to be "facility" or "objectGroup", received "${String(propertyKind)}".`
691
+ });
692
+ const rentalIdsSearch = config.rentalIdsSearch;
693
+ if (rentalIdsSearch !== void 0 && typeof rentalIdsSearch !== "boolean") throw new CoreSDKError({
694
+ source: "v9",
695
+ operation: "v9.config",
696
+ message: `Expected rentalIdsSearch to be a boolean, received "${String(rentalIdsSearch)}".`
697
+ });
663
698
  const attributeId = config.facilityObjectGroupRelationAttributeId;
664
699
  if (attributeId === void 0) return;
665
700
  if (Number.isSafeInteger(attributeId) && attributeId > 0) return;
@@ -1653,11 +1688,34 @@ const toFirstCalculationDate = ({ availability, now }) => {
1653
1688
  return [Object.keys(availability.caldata_beon).toSorted()[0], today].filter((date) => date != null).toSorted().at(-1);
1654
1689
  };
1655
1690
  //#endregion
1691
+ //#region src/legacy-v9/parser/availability/to-rent-night-prices.ts
1692
+ const toRentNightPrices = (servicePrices) => servicePrices.flatMap((row) => row.type === "RENT" && row.calculation === "NIGHT" && typeof row.price === "number" && typeof row.from_date === "string" && typeof row.till_date === "string" ? [{
1693
+ fromDate: row.from_date,
1694
+ tillDate: row.till_date,
1695
+ minNights: row.night_range_min ?? 1,
1696
+ maxNights: row.night_range_max ?? Number.POSITIVE_INFINITY,
1697
+ price: row.price
1698
+ }] : []);
1699
+ const toRentNightPrice = ({ rentNightPrices, night, nights }) => {
1700
+ let price;
1701
+ for (const row of rentNightPrices) {
1702
+ if (night < row.fromDate || night >= row.tillDate) continue;
1703
+ if (nights < row.minNights || nights > row.maxNights) continue;
1704
+ price = Math.max(price ?? row.price, row.price);
1705
+ }
1706
+ return price;
1707
+ };
1708
+ //#endregion
1656
1709
  //#region src/legacy-v9/parser/availability/to-initial-availability-calendar-days.ts
1657
- const applyV9CalendarPrices = ({ availability, calendarDays, locale, currency }) => {
1710
+ const applyV9CalendarPrices = ({ availability, calendarDays, locale, currency, rentNightPrices = [] }) => {
1658
1711
  const result = { ...calendarDays };
1659
1712
  for (const [date, day] of Object.entries(calendarDays)) {
1660
- const price = availability.caldata_beon[date]?.price;
1713
+ const calendarDay = availability.caldata_beon[date];
1714
+ const price = calendarDay === void 0 ? void 0 : toRentNightPrice({
1715
+ rentNightPrices,
1716
+ night: date,
1717
+ nights: calendarDay.minStay
1718
+ }) ?? calendarDay.price;
1661
1719
  if (day.isAvailableDate && typeof price === "number") result[date] = {
1662
1720
  ...day,
1663
1721
  formattedPrice: formatCurrency(price, locale, currency ?? "EUR")
@@ -1665,11 +1723,12 @@ const applyV9CalendarPrices = ({ availability, calendarDays, locale, currency })
1665
1723
  }
1666
1724
  return result;
1667
1725
  };
1668
- const toInitialAvailabilityCalendarDays$1 = ({ availability, currency, ...input }) => toInitialAvailabilityCalendarDays(input).pipe(Effect.map((calendarDays) => applyV9CalendarPrices({
1726
+ const toInitialAvailabilityCalendarDays$1 = ({ availability, currency, rentNightPrices, ...input }) => toInitialAvailabilityCalendarDays(input).pipe(Effect.map((calendarDays) => applyV9CalendarPrices({
1669
1727
  availability,
1670
1728
  calendarDays,
1671
1729
  locale: input.input.locale,
1672
- ...currency === void 0 ? {} : { currency }
1730
+ ...currency === void 0 ? {} : { currency },
1731
+ ...rentNightPrices === void 0 ? {} : { rentNightPrices }
1673
1732
  })));
1674
1733
  //#endregion
1675
1734
  //#region src/legacy-v9/parser/availability/to-occupancy-limits.ts
@@ -1707,6 +1766,29 @@ const toOccupancyLimits = ({ unit }) => {
1707
1766
  };
1708
1767
  };
1709
1768
  //#endregion
1769
+ //#region src/legacy-v9/parser/availability/to-start-date-selected-calendar-days.ts
1770
+ const toNightBefore = (date) => DateTime.formatIsoDateUtc(DateTime.subtract(DateTime.makeUnsafe(date), { days: 1 }));
1771
+ const applyV9EndDatePrices = ({ availability, calendarDays, selectedStartDate, locale, currency, rentNightPrices = [] }) => {
1772
+ const result = {};
1773
+ for (const [date, day] of Object.entries(calendarDays)) {
1774
+ const endDate = date;
1775
+ const lastNight = toNightBefore(date);
1776
+ const price = day.canBeEndDate ? toRentNightPrice({
1777
+ rentNightPrices,
1778
+ night: lastNight,
1779
+ nights: daysBetweenLocalDates({
1780
+ start: selectedStartDate,
1781
+ end: endDate
1782
+ })
1783
+ }) ?? availability.caldata_beon[lastNight]?.price : void 0;
1784
+ result[endDate] = {
1785
+ ...day,
1786
+ formattedPrice: typeof price === "number" ? formatCurrency(price, locale, currency ?? "EUR") : null
1787
+ };
1788
+ }
1789
+ return result;
1790
+ };
1791
+ //#endregion
1710
1792
  //#region translations/v9/de-DE/core.json
1711
1793
  var core_default$1 = {
1712
1794
  "Rental.rentalType.option.HOUSE": "Haus",
@@ -1718,7 +1800,14 @@ var core_default$1 = {
1718
1800
  "Property.propertyType.option.HOSTEL": "Hostel",
1719
1801
  "Property.propertyType.option.HOTEL": "Hotel",
1720
1802
  "reviews.item.guest": "Gast",
1721
- "reviews.item.authorWithCity": "{author} aus {city}"
1803
+ "reviews.item.authorWithCity": "{author} aus {city}",
1804
+ "voucher.validate.reason.valid": "Der Gutscheincode ist gültig.",
1805
+ "voucher.validate.reason.not_yet_valid": "Der Gutscheincode ist noch nicht gültig.",
1806
+ "voucher.validate.reason.expired": "Der Gutscheincode ist abgelaufen.",
1807
+ "voucher.validate.reason.unknown": "Dieser Gutscheincode ist unbekannt.",
1808
+ "voucher.validate.reason.stay_too_short": "Der Aufenthalt ist für diesen Gutscheincode zu kurz.",
1809
+ "voucher.validate.reason.outside_booking_window": "Der gewählte Anreisetag liegt außerhalb des Buchungszeitraums dieses Gutscheincodes.",
1810
+ "voucher.validate.reason.rate_limited": "Zu viele Versuche. Bitte versuchen Sie es später erneut."
1722
1811
  };
1723
1812
  //#endregion
1724
1813
  //#region translations/v9/de-DE/filter.json
@@ -2459,7 +2548,14 @@ var core_default = {
2459
2548
  "Property.propertyType.option.HOSTEL": "Hostel",
2460
2549
  "Property.propertyType.option.HOTEL": "Hotel",
2461
2550
  "reviews.item.guest": "Guest",
2462
- "reviews.item.authorWithCity": "{author} from {city}"
2551
+ "reviews.item.authorWithCity": "{author} from {city}",
2552
+ "voucher.validate.reason.valid": "The voucher code is valid.",
2553
+ "voucher.validate.reason.not_yet_valid": "The voucher code is not valid yet.",
2554
+ "voucher.validate.reason.expired": "The voucher code has expired.",
2555
+ "voucher.validate.reason.unknown": "This voucher code is unknown.",
2556
+ "voucher.validate.reason.stay_too_short": "The stay is too short for this voucher code.",
2557
+ "voucher.validate.reason.outside_booking_window": "The selected arrival date is outside this voucher code's booking window.",
2558
+ "voucher.validate.reason.rate_limited": "Too many attempts. Please try again later."
2463
2559
  };
2464
2560
  //#endregion
2465
2561
  //#region translations/v9/en-US/filter.json
@@ -3232,6 +3328,7 @@ const toVofficeUnitId$2 = (input) => {
3232
3328
  message: `Expected rentalId to be a vOffice unit ID, received "${input.rentalId}".`
3233
3329
  }));
3234
3330
  };
3331
+ const RENT_NIGHT_PRICES_TTL_MILLIS = 3e5;
3235
3332
  const makeV9AvailabilityApi = ({ config, options }) => {
3236
3333
  const translations = makeV9TranslationService(options.translationOverrides);
3237
3334
  const openApiClientLive = makeV1OpenApiClientFetchLive({
@@ -3239,6 +3336,7 @@ const makeV9AvailabilityApi = ({ config, options }) => {
3239
3336
  ...config.v1ApiBaseUrl === void 0 ? {} : { baseUrl: config.v1ApiBaseUrl }
3240
3337
  });
3241
3338
  const unitDetailsByUnitId = /* @__PURE__ */ new Map();
3339
+ const rentNightPricesByUnitId = /* @__PURE__ */ new Map();
3242
3340
  const loadAvailability = (input) => Effect.gen(function* () {
3243
3341
  const client = yield* V1OpenApiClient;
3244
3342
  const unitId = yield* toVofficeUnitId$2(input);
@@ -3269,10 +3367,35 @@ const makeV9AvailabilityApi = ({ config, options }) => {
3269
3367
  unitDetailsByUnitId.set(unitId, details);
3270
3368
  return details;
3271
3369
  }).pipe(Effect.provide(openApiClientLive));
3370
+ const loadRentNightPrices = (input) => Effect.gen(function* () {
3371
+ const client = yield* V1OpenApiClient;
3372
+ const unitId = yield* toVofficeUnitId$2(input);
3373
+ const now = yield* Clock.currentTimeMillis;
3374
+ const cached = rentNightPricesByUnitId.get(unitId);
3375
+ if (cached !== void 0 && now - cached.loadedAt < RENT_NIGHT_PRICES_TTL_MILLIS) return cached.rentNightPrices;
3376
+ const result = yield* client.execute("listUnitServicePrices", {
3377
+ path: { voffice_unit: unitId },
3378
+ query: { language: localeToLanguage(input.locale) }
3379
+ }).pipe(Effect.match({
3380
+ onFailure: () => void 0,
3381
+ onSuccess: (result) => result
3382
+ }));
3383
+ if (result === void 0) return void 0;
3384
+ const rentNightPrices = toRentNightPrices(result.data);
3385
+ rentNightPricesByUnitId.set(unitId, {
3386
+ rentNightPrices,
3387
+ loadedAt: now
3388
+ });
3389
+ return rentNightPrices;
3390
+ }).pipe(Effect.provide(openApiClientLive));
3272
3391
  return {
3273
3392
  getInitialAvailability: (input) => Effect.runPromise(Effect.gen(function* () {
3274
3393
  const now = yield* DateTime.now;
3275
- const [availability, unitDetails] = yield* Effect.all([loadAvailability(input), loadUnitDetails(input)]);
3394
+ const [availability, unitDetails, rentNightPrices] = yield* Effect.all([
3395
+ loadAvailability(input),
3396
+ loadUnitDetails(input),
3397
+ loadRentNightPrices(input)
3398
+ ], { concurrency: "unbounded" });
3276
3399
  const currency = unitDetails?.currency;
3277
3400
  const firstCalculationDate = toFirstCalculationDate({
3278
3401
  availability,
@@ -3286,24 +3409,38 @@ const makeV9AvailabilityApi = ({ config, options }) => {
3286
3409
  firstCalculationDate,
3287
3410
  availabilityRestrictionsByDate,
3288
3411
  translations,
3289
- ...currency === void 0 ? {} : { currency }
3412
+ ...currency === void 0 ? {} : { currency },
3413
+ ...rentNightPrices === void 0 ? {} : { rentNightPrices }
3290
3414
  }),
3291
3415
  ...unitDetails?.occupancyLimits ?? NO_OCCUPANCY_LIMITS
3292
3416
  };
3293
3417
  })),
3294
3418
  getStartDateSelectedAvailability: (input) => Effect.runPromise(Effect.gen(function* () {
3295
3419
  const now = yield* DateTime.now;
3296
- const availability = yield* loadAvailability(input);
3420
+ const [availability, unitDetails, rentNightPrices] = yield* Effect.all([
3421
+ loadAvailability(input),
3422
+ loadUnitDetails(input),
3423
+ loadRentNightPrices(input)
3424
+ ], { concurrency: "unbounded" });
3425
+ const currency = unitDetails?.currency;
3297
3426
  const firstCalculationDate = toFirstCalculationDate({
3298
3427
  availability,
3299
3428
  now
3300
3429
  });
3301
3430
  const availabilityRestrictionsByDate = toAvailabilityRestrictionsByDate({ availability });
3302
- return { calendarDays: yield* toStartDateSelectedCalendarDays({
3431
+ const calendarDays = yield* toStartDateSelectedCalendarDays({
3303
3432
  input,
3304
3433
  firstCalculationDate,
3305
3434
  availabilityRestrictionsByDate,
3306
3435
  translations
3436
+ });
3437
+ return { calendarDays: applyV9EndDatePrices({
3438
+ availability,
3439
+ calendarDays,
3440
+ selectedStartDate: input.selectedStartDate,
3441
+ locale: input.locale,
3442
+ ...currency === void 0 ? {} : { currency },
3443
+ ...rentNightPrices === void 0 ? {} : { rentNightPrices }
3307
3444
  }) };
3308
3445
  }))
3309
3446
  };
@@ -5828,44 +5965,77 @@ const makeV9GraphQLClient = (config) => ({ execute: (document, variables) => Eff
5828
5965
  */
5829
5966
  const toCustomAttributeRentalDataAttributes = (customAttributes) => toCustomAttributeList(customAttributes).flatMap((attribute) => attribute.v9 !== void 0 && isDisplayableCustomAttribute(attribute) ? [attribute.v9] : []);
5830
5967
  //#endregion
5968
+ //#region src/legacy-v9/parser/search/input/shared/to-positive-id.ts
5969
+ const MAX_GRAPHQL_INT = 2147483647;
5970
+ const toNonNegativeInt = (value) => {
5971
+ if (!/^\d+$/.test(value)) return;
5972
+ const number = Number(value);
5973
+ return number <= MAX_GRAPHQL_INT ? number : void 0;
5974
+ };
5975
+ const toPositiveId = (value) => {
5976
+ const id = toNonNegativeInt(value);
5977
+ return id !== void 0 && id > 0 ? id : void 0;
5978
+ };
5979
+ //#endregion
5980
+ //#region src/legacy-v9/rental-ids.ts
5981
+ const toV9RentalIds = (rentalIds) => Array.isArray(rentalIds) ? [...new Set(rentalIds.flatMap((rentalId) => typeof rentalId === "string" ? toPositiveId(rentalId.trim()) ?? [] : []))] : [];
5982
+ const applyV9RentalIdsToSearchQueryInput = ({ input, rentalIdsIn, rentalIdsSearch }) => Effect.gen(function* () {
5983
+ if (rentalIdsIn === void 0) return input;
5984
+ if (!rentalIdsSearch) return yield* Effect.fail(new CoreSDKError({
5985
+ source: "v9",
5986
+ operation: "v9.search",
5987
+ message: `rentalIdsIn needs rentalIdsSearch: true in the v9 config and a "${V9_HUB_RENTAL_IDS_FILTER_KEY}" filter in the be-on! Hub. Run \`website-sdk hub-filters request --unit\` and add its entry in the be-on! Hub.`
5988
+ }));
5989
+ if (Array.isArray(rentalIdsIn) && rentalIdsIn.length === 0) return input;
5990
+ const rentalIds = toV9RentalIds(rentalIdsIn);
5991
+ if (rentalIds.length === 0) return void 0;
5992
+ return {
5993
+ ...input,
5994
+ basicQueryInputs: [...[input.basicQueryInputs ?? []].flat(), {
5995
+ key: V9_HUB_RENTAL_IDS_FILTER_KEY,
5996
+ value: rentalIds
5997
+ }]
5998
+ };
5999
+ });
6000
+ //#endregion
5831
6001
  //#region src/legacy-v9/rental-scope.ts
5832
6002
  const toV9PropertyScope = (scope) => {
5833
6003
  if (scope.propertyId == null) return { kind: "absent" };
5834
- const configuredPropertyId = scope.propertyId.trim();
5835
- if (configuredPropertyId.length === 0) return { kind: "invalid" };
5836
- const propertyId = Number(configuredPropertyId);
5837
- return Number.isInteger(propertyId) ? {
6004
+ const propertyId = toPositiveId(scope.propertyId.trim());
6005
+ return propertyId === void 0 ? { kind: "invalid" } : {
5838
6006
  kind: "valid",
5839
6007
  propertyId
5840
- } : { kind: "invalid" };
6008
+ };
5841
6009
  };
5842
6010
  const validateV9RentalScope = (scope) => {
5843
6011
  if (toV9PropertyScope(scope).kind !== "invalid") return;
5844
6012
  throw new CoreSDKError({
5845
6013
  source: "v9",
5846
6014
  operation: "v9.config",
5847
- message: `Expected rentalScope.propertyId to be a vOffice property ID, received "${scope.propertyId}".`
6015
+ message: `Expected rentalScope.propertyId to be a positive integer ID: a facility ID as in rental.property.id, or an object group ID with rentalScopePropertyKind "objectGroup", received "${scope.propertyId}".`
5848
6016
  });
5849
6017
  };
5850
- const filterV9RentalsByScope = (rentals, scope) => {
6018
+ const toHubFilterKey = (propertyKind) => propertyKind === "objectGroup" ? V9_HUB_OBJECT_GROUP_SCOPE_FILTER_KEY : V9_HUB_FACILITY_SCOPE_FILTER_KEY;
6019
+ const toV9RentalScopeHubFilterKey = ({ scope, propertyKind }) => {
6020
+ if (toV9PropertyScope(scope).kind === "absent") return void 0;
6021
+ return toHubFilterKey(propertyKind);
6022
+ };
6023
+ const filterV9RentalsByScope = ({ rentals, scope, propertyKind }) => {
5851
6024
  const propertyScope = toV9PropertyScope(scope);
5852
6025
  if (propertyScope.kind === "absent") return rentals;
5853
6026
  if (propertyScope.kind === "invalid") return [];
5854
- return rentals.filter((rental) => rental.voffice_facility_id === propertyScope.propertyId);
6027
+ return rentals.filter((rental) => propertyKind === "objectGroup" ? (rental.voffice_groups ?? []).some((group) => group.voffice_group_id === propertyScope.propertyId) : rental.voffice_facility_id === propertyScope.propertyId);
5855
6028
  };
5856
- const applyV9RentalScopeToSearchQueryInput = (input, scope) => {
6029
+ const applyV9RentalScopeToSearchQueryInput = ({ input, scope, propertyKind }) => {
5857
6030
  const propertyScope = toV9PropertyScope(scope);
5858
6031
  if (propertyScope.kind === "absent") return input;
5859
6032
  if (propertyScope.kind === "invalid") return void 0;
5860
6033
  return {
5861
6034
  ...input,
5862
- vofficeData: {
5863
- ...input.vofficeData,
5864
- filter: {
5865
- ...input.vofficeData?.filter,
5866
- falicityid: propertyScope.propertyId
5867
- }
5868
- }
6035
+ basicQueryInputs: [...[input.basicQueryInputs ?? []].flat(), {
6036
+ key: toHubFilterKey(propertyKind),
6037
+ value: propertyScope.propertyId
6038
+ }]
5869
6039
  };
5870
6040
  };
5871
6041
  //#endregion
@@ -5899,7 +6069,7 @@ const parseV9SearchCursor = (cursor) => Effect.gen(function* () {
5899
6069
  return page;
5900
6070
  });
5901
6071
  const loadV9SearchRuntime = Effect.tryPromise({
5902
- try: () => import("./search-B-lvOmXL.mjs"),
6072
+ try: () => import("./search-DPsBki_9.mjs"),
5903
6073
  catch: (cause) => new CoreSDKError({
5904
6074
  source: "v9",
5905
6075
  operation: "v9.search.runtime",
@@ -5942,6 +6112,7 @@ const toUniqueResults = (entries) => {
5942
6112
  const makeV9SearchApi = ({ config, options }) => {
5943
6113
  const graphql = makeV9GraphQLClient(config);
5944
6114
  const translations = makeV9TranslationService(options.translationOverrides);
6115
+ const propertyKind = toV9RentalScopePropertyKind(config);
5945
6116
  const customAttributeDataAttributes = toCustomAttributeRentalDataAttributes(options.customAttributes);
5946
6117
  const limitSearch = Effect.runSync(makeMinIntervalLimiter({
5947
6118
  interval: "1 second",
@@ -5959,13 +6130,23 @@ const makeV9SearchApi = ({ config, options }) => {
5959
6130
  translations,
5960
6131
  customAttributeFilterDefinitions: options.customAttributeFilterDefinitions,
5961
6132
  query: input.query,
5962
- sort: input.sort
6133
+ sort: input.sort,
6134
+ voucher: input.voucher
6135
+ });
6136
+ const scopedInput = applyV9RentalScopeToSearchQueryInput({
6137
+ input: queryInput,
6138
+ scope: options.rentalScope,
6139
+ propertyKind
5963
6140
  });
5964
6141
  return {
5965
6142
  runtime,
5966
6143
  appliedFilters,
5967
6144
  unusedFilterKeys,
5968
- scopedQueryInput: applyV9RentalScopeToSearchQueryInput(queryInput, options.rentalScope)
6145
+ scopedQueryInput: scopedInput === void 0 ? void 0 : yield* applyV9RentalIdsToSearchQueryInput({
6146
+ input: scopedInput,
6147
+ rentalIdsIn: input.rentalIdsIn,
6148
+ rentalIdsSearch: config.rentalIdsSearch === true
6149
+ })
5969
6150
  };
5970
6151
  });
5971
6152
  const searchPage = ({ input, runtime, scopedQueryInput, page, first }) => Effect.gen(function* () {
@@ -6182,7 +6363,10 @@ const makeV9SearchApi = ({ config, options }) => {
6182
6363
  operation: "search.mapSearch",
6183
6364
  message: "mapSearch is not available with searchAllRentalsAtOnce; search already returns every result."
6184
6365
  }) : Effect.runPromise(limitSearch(Effect.gen(function* () {
6185
- const { runtime, appliedFilters, unusedFilterKeys, scopedQueryInput } = yield* toScopedQuery(input);
6366
+ const { runtime, appliedFilters, unusedFilterKeys, scopedQueryInput } = yield* toScopedQuery({
6367
+ locale: input.locale,
6368
+ query: input.query
6369
+ });
6186
6370
  if (scopedQueryInput === void 0) return {
6187
6371
  items: [],
6188
6372
  totalCount: 0,
@@ -6253,6 +6437,68 @@ const makeV9SearchApi = ({ config, options }) => {
6253
6437
  };
6254
6438
  };
6255
6439
  //#endregion
6440
+ //#region src/legacy-v9/voucher-code.ts
6441
+ const toVoucherCode = (voucher) => {
6442
+ const code = voucher?.trim();
6443
+ return code === void 0 || code === "" ? void 0 : code;
6444
+ };
6445
+ //#endregion
6446
+ //#region src/legacy-v9/live/voucher.ts
6447
+ const OPERATION = "v9.voucher.validate";
6448
+ const REASONS = {
6449
+ VALID: "valid",
6450
+ NOT_YET_VALID: "not_yet_valid",
6451
+ EXPIRED: "expired",
6452
+ UNKNOWN: "unknown",
6453
+ STAY_TOO_SHORT: "stay_too_short",
6454
+ OUTSIDE_BOOKING_WINDOW: "outside_booking_window",
6455
+ RATE_LIMITED: "rate_limited"
6456
+ };
6457
+ const failInvalidInput = (message) => Effect.fail(new CoreSDKError({
6458
+ source: "v9",
6459
+ operation: OPERATION,
6460
+ message
6461
+ }));
6462
+ const toIsoDate = ({ name, value }) => Effect.gen(function* () {
6463
+ if (value === void 0) return void 0;
6464
+ const isoDate = toIsoDateFromPeriodQueryDate(value);
6465
+ if (isoDate === void 0) return yield* failInvalidInput(`Expected "${name}" to use DD-MM-YYYY or YYYY-MM-DD dates.`);
6466
+ return isoDate;
6467
+ });
6468
+ const makeV9VoucherApi = ({ config, options }) => {
6469
+ const graphql = makeV9GraphQLClient(config);
6470
+ const translations = makeV9TranslationService(options.translationOverrides);
6471
+ const validate = ({ code, start, end, locale }) => Effect.gen(function* () {
6472
+ const voucherCode = toVoucherCode(code);
6473
+ if (voucherCode === void 0) return yield* failInvalidInput("Expected \"code\" to be a non-empty voucher code.");
6474
+ const fromdate = yield* toIsoDate({
6475
+ name: "start",
6476
+ value: start
6477
+ });
6478
+ const tilldate = yield* toIsoDate({
6479
+ name: "end",
6480
+ value: end
6481
+ });
6482
+ if (fromdate !== void 0 && tilldate !== void 0 && daysBetweenLocalDates({
6483
+ start: fromdate,
6484
+ end: tilldate
6485
+ }) <= 0) return yield* failInvalidInput("Expected \"end\" to be after \"start\".");
6486
+ const { voucherValidity } = yield* graphql.execute(voucherValidityQuery, {
6487
+ code: voucherCode,
6488
+ ...fromdate === void 0 ? {} : { fromdate },
6489
+ ...tilldate === void 0 ? {} : { tilldate }
6490
+ });
6491
+ const reason = REASONS[voucherValidity.reason] ?? "unknown";
6492
+ const label = yield* translations.translate(locale, `voucher.validate.reason.${reason}`);
6493
+ return {
6494
+ valid: voucherValidity.valid,
6495
+ reason,
6496
+ label
6497
+ };
6498
+ });
6499
+ return { validate: (input) => Effect.runPromise(validate(input)) };
6500
+ };
6501
+ //#endregion
6256
6502
  //#region src/legacy-v9/parser/filter/to-options.ts
6257
6503
  const toOptions = ({ stableFilter, label }) => {
6258
6504
  if (stableFilter.type === "InputFilter" && stableFilter.group === "rooms" && stableFilter.display_type === "number") return Array.from({ length: 10 }, (_, index) => {
@@ -6355,11 +6601,11 @@ const toCustomBackendFilterInput = ({ queryKey, value, filter }) => {
6355
6601
  value: true
6356
6602
  } : void 0;
6357
6603
  case "int": {
6358
- const numberValue = Number(value);
6359
- return Number.isInteger(numberValue) && numberValue >= 0 ? {
6604
+ const numberValue = toNonNegativeInt(value);
6605
+ return numberValue === void 0 ? void 0 : {
6360
6606
  key: queryKey,
6361
6607
  value: numberValue
6362
- } : void 0;
6608
+ };
6363
6609
  }
6364
6610
  case "string": return value.length > 0 ? {
6365
6611
  key: queryKey,
@@ -6498,6 +6744,26 @@ const makeV9FilterApi = ({ options }) => {
6498
6744
  })) };
6499
6745
  };
6500
6746
  //#endregion
6747
+ //#region src/legacy-v9/hub-filter-requirements.ts
6748
+ const toV9SdkOwnedHubFilterKeys = ({ config, rentalScope }) => {
6749
+ const scopeKey = toV9RentalScopeHubFilterKey({
6750
+ scope: rentalScope ?? {},
6751
+ propertyKind: toV9RentalScopePropertyKind(config)
6752
+ });
6753
+ return [...scopeKey === void 0 ? [] : [scopeKey], ...config.rentalIdsSearch === true ? [V9_HUB_RENTAL_IDS_FILTER_KEY] : []];
6754
+ };
6755
+ const toV9RequiredHubFilterKeys = ({ config, rentalScope, customAttributeFilterDefinitions }) => [.../* @__PURE__ */ new Set([...customAttributeFilterDefinitions.flatMap((definition) => definition.source === "backendFilter" && definition.searchable ? [definition.key] : []), ...toV9SdkOwnedHubFilterKeys({
6756
+ config,
6757
+ rentalScope
6758
+ })])];
6759
+ const checkV9HubFilters = ({ required, hubFilters }) => {
6760
+ const hubKeys = new Set(hubFilters.map(({ key }) => key));
6761
+ return {
6762
+ present: required.filter((key) => hubKeys.has(key)),
6763
+ missing: required.filter((key) => !hubKeys.has(key))
6764
+ };
6765
+ };
6766
+ //#endregion
6501
6767
  //#region src/legacy-v9/static/rentals.ts
6502
6768
  const DEFAULT_RENTAL_FACILITY_DATA_ATTRIBUTES = [
6503
6769
  "address",
@@ -6521,6 +6787,11 @@ const DEFAULT_RENTAL_FACILITY_DATA_ATTRIBUTES = [
6521
6787
  ];
6522
6788
  const DEFAULT_RENTAL_RATING_DATA_ATTRIBUTES = [];
6523
6789
  const RENTAL_BATCH_SIZE = 128;
6790
+ const HUB_FILTER_PURPOSES = {
6791
+ [V9_HUB_FACILITY_SCOPE_FILTER_KEY]: "searches cannot be limited to rentalScope",
6792
+ [V9_HUB_OBJECT_GROUP_SCOPE_FILTER_KEY]: "searches cannot be limited to rentalScope",
6793
+ [V9_HUB_RENTAL_IDS_FILTER_KEY]: "searches cannot use rentalIdsIn"
6794
+ };
6524
6795
  const DEFAULT_RENTAL_FEEDBACK_DATA_ATTRIBUTES = [
6525
6796
  "id",
6526
6797
  "arrival",
@@ -6533,11 +6804,12 @@ const DEFAULT_RENTAL_FEEDBACK_DATA_ATTRIBUTES = [
6533
6804
  "text",
6534
6805
  "avgRating"
6535
6806
  ];
6536
- const orderRentalsById = ({ rentalIds, rentals }) => {
6807
+ const orderRentalsById = ({ rentalIds, rentals, missing }) => {
6537
6808
  const rentalsById = new Map(rentals.map((rental) => [rental.voffice_id, rental]));
6538
- return rentalIds.map((rentalId) => {
6809
+ return rentalIds.flatMap((rentalId) => {
6539
6810
  const rental = rentalsById.get(rentalId);
6540
- if (rental != null) return rental;
6811
+ if (rental != null) return [rental];
6812
+ if (missing === "drop") return [];
6541
6813
  throw new CoreSDKError({
6542
6814
  source: "v9",
6543
6815
  operation: "v9.rentals.batch",
@@ -6546,7 +6818,7 @@ const orderRentalsById = ({ rentalIds, rentals }) => {
6546
6818
  });
6547
6819
  };
6548
6820
  const loadV9RentalsRuntime = Effect.tryPromise({
6549
- try: () => import("./rentals-B4g91vwW.mjs"),
6821
+ try: () => import("./rentals-cmqp5dTw.mjs"),
6550
6822
  catch: (cause) => new CoreSDKError({
6551
6823
  source: "v9",
6552
6824
  operation: "v9.rentals.runtime",
@@ -6557,9 +6829,10 @@ const loadV9RentalsRuntime = Effect.tryPromise({
6557
6829
  const makeV9RentalsApi = ({ config, options }) => {
6558
6830
  const graphql = makeV9GraphQLClient(config);
6559
6831
  const translations = makeV9TranslationService(options.translationOverrides);
6560
- return { getRentals: (input) => Effect.runPromise(Effect.gen(function* () {
6561
- const { associateRentalsWithFacilitiesByObjectGroups, defaultRentalDataAttributes, rentalFacilitiesForObjectGroupRelationQuery, rentalIdsQuery, rentalsAllByFacilityObjectGroupsWithoutFeedbacksQuery, rentalsAllFeedbacksQuery, rentalsAllWithoutFeedbacksQuery, toRentalRentalsOutput } = yield* loadV9RentalsRuntime;
6562
- const language = localeToLanguage(input.locale);
6832
+ const propertyKind = toV9RentalScopePropertyKind(config);
6833
+ const loadRentals = ({ locale, rentalIds, missing }) => Effect.gen(function* () {
6834
+ const { associateRentalsWithFacilitiesByObjectGroups, defaultRentalDataAttributes, rentalFacilitiesForObjectGroupRelationQuery, rentalsAllByFacilityObjectGroupsWithoutFeedbacksQuery, rentalsAllFeedbacksQuery, rentalsAllWithoutFeedbacksQuery, toRentalRentalsOutput } = yield* loadV9RentalsRuntime;
6835
+ const language = localeToLanguage(locale);
6563
6836
  const rentalDataAttributes = [
6564
6837
  ...defaultRentalDataAttributes,
6565
6838
  ...config.rentalDataAttributes ?? [],
@@ -6575,8 +6848,6 @@ const makeV9RentalsApi = ({ config, options }) => {
6575
6848
  ...options.v9Reviews.criteria.map((criterion) => customDataAttribute(criterion.v9))
6576
6849
  ];
6577
6850
  const relationAttributeId = config.facilityObjectGroupRelationAttributeId;
6578
- const rentalIds = (yield* graphql.execute(rentalIdsQuery, {})).all.map((rental) => rental.voffice_id);
6579
- if (rentalIds.length === 0) return [];
6580
6851
  const directRentals = [];
6581
6852
  const objectGroupRentals = [];
6582
6853
  for (let offset = 0; offset < rentalIds.length; offset += RENTAL_BATCH_SIZE) {
@@ -6600,9 +6871,11 @@ const makeV9RentalsApi = ({ config, options }) => {
6600
6871
  objectGroupRentals.push(...rentalsData.all);
6601
6872
  }
6602
6873
  }
6874
+ if (missing === "drop" && directRentals.length + objectGroupRentals.length === 0) return [];
6603
6875
  const rentalsWithoutFeedbacks = relationAttributeId === void 0 ? orderRentalsById({
6604
6876
  rentalIds,
6605
- rentals: directRentals
6877
+ rentals: directRentals,
6878
+ missing
6606
6879
  }) : yield* Effect.gen(function* () {
6607
6880
  const facilitiesData = yield* graphql.execute(rentalFacilitiesForObjectGroupRelationQuery, {
6608
6881
  language,
@@ -6610,7 +6883,8 @@ const makeV9RentalsApi = ({ config, options }) => {
6610
6883
  });
6611
6884
  const orderedRentals = orderRentalsById({
6612
6885
  rentalIds,
6613
- rentals: objectGroupRentals
6886
+ rentals: objectGroupRentals,
6887
+ missing
6614
6888
  });
6615
6889
  return yield* Effect.try({
6616
6890
  try: () => associateRentalsWithFacilitiesByObjectGroups({
@@ -6626,7 +6900,11 @@ const makeV9RentalsApi = ({ config, options }) => {
6626
6900
  })
6627
6901
  });
6628
6902
  });
6629
- const scopedRentalsWithoutFeedbacks = filterV9RentalsByScope(rentalsWithoutFeedbacks, options.rentalScope);
6903
+ const scopedRentalsWithoutFeedbacks = filterV9RentalsByScope({
6904
+ rentals: rentalsWithoutFeedbacks,
6905
+ scope: options.rentalScope,
6906
+ propertyKind
6907
+ });
6630
6908
  if (scopedRentalsWithoutFeedbacks.length === 0) return [];
6631
6909
  const feedbackRentals = [];
6632
6910
  for (let offset = 0; offset < scopedRentalsWithoutFeedbacks.length; offset += RENTAL_BATCH_SIZE) {
@@ -6645,7 +6923,7 @@ const makeV9RentalsApi = ({ config, options }) => {
6645
6923
  }));
6646
6924
  return yield* Effect.all(scopedRentals.map((rental) => toRentalRentalsOutput({
6647
6925
  rental,
6648
- locale: input.locale,
6926
+ locale,
6649
6927
  translations,
6650
6928
  imageProxyBaseUrl: config.imageProxyBaseUrl,
6651
6929
  rentalHighlightPrioritization: [...options.rentalHighlightPrioritization],
@@ -6654,7 +6932,51 @@ const makeV9RentalsApi = ({ config, options }) => {
6654
6932
  v9PropertyHighlightSources: options.v9PropertyHighlightSources,
6655
6933
  reviews: options.v9Reviews
6656
6934
  })));
6657
- })) };
6935
+ });
6936
+ const requiredHubFilterKeys = toV9SdkOwnedHubFilterKeys({
6937
+ config,
6938
+ rentalScope: options.rentalScope
6939
+ });
6940
+ const checkHubFilters = Effect.gen(function* () {
6941
+ if (config.facilityObjectGroupRelationAttributeId !== void 0 && requiredHubFilterKeys.includes("facility_scope")) return yield* Effect.fail(new CoreSDKError({
6942
+ source: "v9",
6943
+ operation: "v9.rentals.hub-filters",
6944
+ message: "A facility rentalScope cannot be combined with facilityObjectGroupRelationAttributeId: listings would use the facilities derived from object groups, while the search uses the facility stored on each rental. If the facilities are maintained on the rentals in vOffice, remove facilityObjectGroupRelationAttributeId. Otherwise set rentalScopePropertyKind: \"objectGroup\" and use the object group ID as rentalScope.propertyId."
6945
+ }));
6946
+ const { hubFiltersQuery } = yield* loadV9RentalsRuntime;
6947
+ const hubFilters = yield* graphql.execute(hubFiltersQuery, { language: "de" });
6948
+ const { missing: missingHubFilterKeys } = checkV9HubFilters({
6949
+ required: requiredHubFilterKeys,
6950
+ hubFilters: hubFilters.filter
6951
+ });
6952
+ if (missingHubFilterKeys.length > 0) return yield* Effect.fail(new CoreSDKError({
6953
+ source: "v9",
6954
+ operation: "v9.rentals.hub-filters",
6955
+ message: "The be-on! Hub lacks filters for this API key: " + missingHubFilterKeys.map((key) => `"${key}" (${HUB_FILTER_PURPOSES[key]})`).join(", ") + ". Run `website-sdk hub-filters request` and add its entries in the be-on! Hub."
6956
+ }));
6957
+ });
6958
+ const [checkHubFiltersOnce, invalidateHubFiltersCheck] = Effect.runSync(Effect.cachedInvalidateWithTTL(checkHubFilters, Duration.infinity));
6959
+ return {
6960
+ getRentals: (input) => Effect.runPromise(Effect.gen(function* () {
6961
+ const { rentalIdsQuery } = yield* loadV9RentalsRuntime;
6962
+ if (requiredHubFilterKeys.length > 0) yield* checkHubFiltersOnce.pipe(Effect.tapError(() => invalidateHubFiltersCheck));
6963
+ const rentalIds = (yield* graphql.execute(rentalIdsQuery, {})).all.map((rental) => rental.voffice_id);
6964
+ if (rentalIds.length === 0) return [];
6965
+ return yield* loadRentals({
6966
+ locale: input.locale,
6967
+ rentalIds,
6968
+ missing: "fail"
6969
+ });
6970
+ })),
6971
+ getRentalsByIds: (input) => Effect.runPromise(Effect.suspend(() => {
6972
+ const voffice_ids = toV9RentalIds(input.rentalIds);
6973
+ return voffice_ids.length === 0 ? Effect.succeed([]) : loadRentals({
6974
+ locale: input.locale,
6975
+ rentalIds: voffice_ids,
6976
+ missing: "drop"
6977
+ });
6978
+ }))
6979
+ };
6658
6980
  };
6659
6981
  //#endregion
6660
6982
  //#region src/client.ts
@@ -6689,12 +7011,16 @@ function createWebsiteSDK({ config, options }) {
6689
7011
  config,
6690
7012
  options: v9Options
6691
7013
  });
7014
+ const voucher = makeV9VoucherApi({
7015
+ config,
7016
+ options: v9Options
7017
+ });
6692
7018
  recordConstructedBackend("v9");
6693
7019
  recordConstructedSdk(config, options);
6694
7020
  return {
6695
7021
  backend: "v9",
6696
7022
  static: {
6697
- rentals,
7023
+ rentals: { getRentals: rentals.getRentals },
6698
7024
  filter: { getFilters: filter.getFilters }
6699
7025
  },
6700
7026
  live: {
@@ -6704,6 +7030,8 @@ function createWebsiteSDK({ config, options }) {
6704
7030
  mapSearch: search.mapSearch,
6705
7031
  searchPages: search.searchPages
6706
7032
  },
7033
+ voucher: { validate: voucher.validate },
7034
+ rentals: { getRentalsByIds: rentals.getRentalsByIds },
6707
7035
  availability: {
6708
7036
  getInitialAvailability: availability.getInitialAvailability,
6709
7037
  getStartDateSelectedAvailability: availability.getStartDateSelectedAvailability
@@ -6772,4 +7100,4 @@ function createWebsiteSDK({ config, options }) {
6772
7100
  return sdk;
6773
7101
  }
6774
7102
  //#endregion
6775
- export { SearchPropertiesResponseSchema as $, ErgoBankSchema as A, getStartDateSelectedAvailabilityEffect as At, OnOfficeUnitCollectionResponseSchema as B, submitPaymentOption as Bt, DocumentResourceResponseSchema as C, bookInsuranceEffect as Ct, DocumentSummarySchema as D, getFiltersEffect as Dt, DocumentStatusUpdateRequestSchema as E, getBankTransferDetailsEffect as Et, ErgoPlanSearchRequestSchema as F, searchEffect as Ft, QuotePricesPayloadSchema as G, V9_FACILITY_ATTRIBUTE_KEYS as Gt, PaymentScheduleItemSchema as H, defineWebsiteSDKOptions as Ht, ErgoPolicyNumberRequestSchema as I, selectCancellationPolicyEffect as It, QuoteServiceSchema as J, QuotePricesResponseSchema$1 as K, ErgoReadPreContractRequestSchema as L, selectInsuranceEffect as Lt, ErgoCommonFieldsSchema as M, mapSearchEffect as Mt, ErgoCreatePreContractRequestSchema as N, quoteEffect as Nt, DocumentTypeSchema as O, getInitialAvailabilityEffect as Ot, ErgoPersonSchema as P, removeAdditionalServiceEffect as Pt, RoomImageSchema as Q, ErgoTripAndCustomerRequestSchema as R, selectInsurancePaymentEffect as Rt, DocumentCollectionResponseSchema as S, bookEffect as St, DocumentStatusSchema as T, createInsurancePreContractEffect as Tt, PaymentScheduleSchema$1 as U, defineV9PropertyHighlightSources as Ut, OnOfficeUnitSchema as V, submitPaymentOptionEffect as Vt, QuoteLineSchema$1 as W, defineV9PropertyHighlightSourcesFromUnknown as Wt, RawVofficeObjectSchema as X, RawObjectResponseSchema as Y, RegionListResponseSchema as Z, ApiEnvelopeBaseSchema as _, V1_BASE_URL as _t, parseQueryParameters as a, SetupResponseSchema as at, CurrentMemberResponseSchema as b, decodeV1OperationResponse as bt, makeV9GraphQLClient as c, TileTagSchema as ct, makeV0OpenApiClientFetchLive as d, UnitIdsResponseSchema as dt, ServiceBeonDataSchema as et, makeV0OpenApiClientLive as f, UnitListItemSchema as ft, makeV1OpenApiClientLive as g, UnitServicePriceSchema as gt, makeV1OpenApiClientFetchLive as h, UnitResponseSchema as ht, collectQueryParameters as i, SetupDataSchema as it, ErgoBookRequestSchema as j, getTermsAndPrivacyPolicyEffect as jt, ErgoAddressSchema as k, getRentalsEffect as kt, V0OpenApiClient as l, TravelInsuranceBookingSchema as lt, V1OpenApiClientError as m, UnitOfferSchema as mt, makeV9CustomAttributeFilterCapabilities as n, ServiceLimitSchema as nt, toQueryString as o, TileCollectionResponseSchema as ot, V1OpenApiClient as p, UnitListResponseSchema as pt, QuoteSchema as q, toBasicQueryInputs as r, ServiceListResponseSchema as rt, applyVofficeFilterDerivedBasicQueryInputs as s, TileSchema as st, createWebsiteSDK as t, ServiceImageSchema as tt, V0OpenApiClientError as u, TravelInsuranceBookingStoreRequestSchema as ut, CalendarDaySchema as v, V1_OPERATIONS as vt, DocumentResourceSchema as w, clearAdditionalServicesEffect as wt, CustomerUnitSummarySchema as x, addAdditionalServiceEffect as xt, CalendarResponseSchema$1 as y, VideoResponseSchema as yt, FacilityListResponseSchema as z, submitContactEffect as zt };
7103
+ export { RawObjectResponseSchema as $, V9_HUB_OBJECT_GROUP_SCOPE_FILTER_KEY as $t, DocumentStatusUpdateRequestSchema as A, getBankTransferDetailsEffect as At, ErgoPolicyNumberRequestSchema as B, selectCancellationPolicyEffect as Bt, CalendarResponseSchema$1 as C, VideoResponseSchema as Ct, DocumentResourceResponseSchema as D, bookInsuranceEffect as Dt, DocumentCollectionResponseSchema as E, bookEffect as Et, ErgoBookRequestSchema as F, getTermsAndPrivacyPolicyEffect as Ft, OnOfficeUnitSchema as G, submitPaymentOptionEffect as Gt, ErgoTripAndCustomerRequestSchema as H, selectInsurancePaymentEffect as Ht, ErgoCommonFieldsSchema as I, mapSearchEffect as It, QuoteLineSchema$1 as J, defineV9PropertyHighlightSourcesFromUnknown as Jt, PaymentScheduleItemSchema as K, defineWebsiteSDKOptions as Kt, ErgoCreatePreContractRequestSchema as L, quoteEffect as Lt, DocumentTypeSchema as M, getInitialAvailabilityEffect as Mt, ErgoAddressSchema as N, getRentalsEffect as Nt, DocumentResourceSchema as O, clearAdditionalServicesEffect as Ot, ErgoBankSchema as P, getStartDateSelectedAvailabilityEffect as Pt, QuoteServiceSchema as Q, V9_HUB_OBJECT_GROUP_FILTER_KEY as Qt, ErgoPersonSchema as R, removeAdditionalServiceEffect as Rt, CalendarDaySchema as S, V1_OPERATIONS as St, CustomerUnitSummarySchema as T, addAdditionalServiceEffect as Tt, FacilityListResponseSchema as U, submitContactEffect as Ut, ErgoReadPreContractRequestSchema as V, selectInsuranceEffect as Vt, OnOfficeUnitCollectionResponseSchema as W, submitPaymentOption as Wt, QuotePricesResponseSchema$1 as X, V9_HUB_FACILITY_SCOPE_FILTER_KEY as Xt, QuotePricesPayloadSchema as Y, V9_FACILITY_ATTRIBUTE_KEYS as Yt, QuoteSchema as Z, V9_HUB_FACILITY_SEARCH_FILTER_KEY as Zt, V1OpenApiClient as _, UnitListResponseSchema as _t, makeV9CustomAttributeFilterCapabilities as a, ServiceImageSchema as at, makeV1OpenApiClientLive as b, UnitServicePriceSchema as bt, parseQueryParameters as c, SetupDataSchema as ct, toVoucherCode as d, TileSchema as dt, V9_HUB_OFFERS_FILTER_KEY as en, RawVofficeObjectSchema as et, makeV9GraphQLClient as f, TileTagSchema as ft, makeV0OpenApiClientLive as g, UnitListItemSchema as gt, makeV0OpenApiClientFetchLive as h, UnitIdsResponseSchema as ht, toV9SdkOwnedHubFilterKeys as i, ServiceBeonDataSchema as it, DocumentSummarySchema as j, getFiltersEffect as jt, DocumentStatusSchema as k, createInsurancePreContractEffect as kt, toQueryString as l, SetupResponseSchema as lt, V0OpenApiClientError as m, TravelInsuranceBookingStoreRequestSchema as mt, checkV9HubFilters as n, V9_HUB_RENTAL_IDS_FILTER_KEY as nn, RoomImageSchema as nt, toBasicQueryInputs as o, ServiceLimitSchema as ot, V0OpenApiClient as p, TravelInsuranceBookingSchema as pt, PaymentScheduleSchema$1 as q, defineV9PropertyHighlightSources as qt, toV9RequiredHubFilterKeys as r, V9_SDK_OWNED_HUB_FILTER_KEYS as rn, SearchPropertiesResponseSchema as rt, collectQueryParameters as s, ServiceListResponseSchema as st, createWebsiteSDK as t, V9_HUB_OFFER_FILTER_KEY as tn, RegionListResponseSchema as tt, applyVofficeFilterDerivedBasicQueryInputs as u, TileCollectionResponseSchema as ut, V1OpenApiClientError as v, UnitOfferSchema as vt, CurrentMemberResponseSchema as w, decodeV1OperationResponse as wt, ApiEnvelopeBaseSchema as x, V1_BASE_URL as xt, makeV1OpenApiClientFetchLive as y, UnitResponseSchema as yt, ErgoPlanSearchRequestSchema as z, searchEffect as zt };