@v-office/website-sdk 3.3.0 → 3.4.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/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as QuoteSchema, A as DocumentResourceSchema, At as bookInsuranceEffect, B as ErgoPersonSchema, Bt as quoteEffect, C as ApiEnvelopeBaseSchema, Ct as V1_BASE_URL, D as CustomerUnitSummarySchema, Dt as decodeV1OperationResponse, E as CurrentMemberResponseSchema, Et as VideoResponseSchema, F as ErgoAddressSchema, Ft as getInitialAvailabilityEffect, G as FacilityListResponseSchema, Gt as selectInsurancePaymentEffect, H as ErgoPolicyNumberRequestSchema, Ht as searchEffect, I as ErgoBankSchema, It as getRentalsEffect, J as PaymentScheduleItemSchema, Jt as submitPaymentOptionEffect, K as OnOfficeUnitCollectionResponseSchema, Kt as submitContactEffect, L as ErgoBookRequestSchema, Lt as getStartDateSelectedAvailabilityEffect, M as DocumentStatusUpdateRequestSchema, Mt as createInsurancePreContractEffect, N as DocumentSummarySchema, Nt as getBankTransferDetailsEffect, O as DocumentCollectionResponseSchema, Ot as addAdditionalServiceEffect, P as DocumentTypeSchema, Pt as getFiltersEffect, Q as QuotePricesResponseSchema, R as ErgoCommonFieldsSchema, Rt as getTermsAndPrivacyPolicyEffect, S as makeV1OpenApiClientLive, St as UnitServicePriceSchema, T as CalendarResponseSchema, Tt as VideoListResponseSchema, U as ErgoReadPreContractRequestSchema, Ut as selectCancellationPolicyEffect, V as ErgoPlanSearchRequestSchema, Vt as removeAdditionalServiceEffect, W as ErgoTripAndCustomerRequestSchema, Wt as selectInsuranceEffect, X as QuoteLineSchema, Xt as defineV9PropertyHighlightSources, Y as PaymentScheduleSchema, Yt as defineWebsiteSDKOptions, Z as QuotePricesPayloadSchema, Zt as defineV9PropertyHighlightSourcesFromUnknown, _t as UnitIdsResponseSchema, at as SearchPropertiesResponseSchema, b as V1OpenApiClientError, bt as UnitOfferSchema, ct as ServiceLimitSchema, dt as SetupResponseSchema, et as QuoteServiceSchema, ft as TileCollectionResponseSchema, g as makeV0OpenApiClientLive, gt as TravelInsuranceBookingStoreRequestSchema, h as makeV0OpenApiClientFetchLive, ht as TravelInsuranceBookingSchema, it as RoomImageSchema, j as DocumentStatusSchema, jt as clearAdditionalServicesEffect, k as DocumentResourceResponseSchema, kt as bookEffect, lt as ServiceListResponseSchema, m as V0OpenApiClientError, mt as TileTagSchema, nt as RawVofficeObjectSchema, ot as ServiceBeonDataSchema, p as V0OpenApiClient, pt as TileSchema, q as OnOfficeUnitSchema, qt as submitPaymentOption, rt as RegionListResponseSchema, st as ServiceImageSchema, t as createWebsiteSDK, tt as RawObjectResponseSchema, ut as SetupDataSchema, vt as UnitListItemSchema, w as CalendarDaySchema, wt as V1_OPERATIONS, x as makeV1OpenApiClientFetchLive, xt as UnitResponseSchema, y as V1OpenApiClient, yt as UnitListResponseSchema, z as ErgoCreatePreContractRequestSchema, zt as mapSearchEffect } from "./client-BlQ5phsZ.mjs";
1
+ import { $ as QuotePricesPayloadSchema, A as DocumentResourceSchema, At as bookEffect, B as ErgoCommonFieldsSchema, Bt as mapSearchEffect, C as ApiEnvelopeBaseSchema, Ct as UnitServicePriceSchema, D as CustomerUnitSummarySchema, Dt as VideoResponseSchema, E as CurrentMemberResponseSchema, Et as VideoListResponseSchema, F as ErgoAddressSchema, Ft as getFiltersEffect, G as ErgoTripAndCustomerRequestSchema, Gt as selectInsuranceEffect, H as ErgoPersonSchema, Ht as removeAdditionalServiceEffect, I as ErgoBankSchema, It as getInitialAvailabilityEffect, J as OnOfficeUnitCollectionResponseSchema, Jt as submitPaymentOption, K as FacilityListResponseSchema, Kt as selectInsurancePaymentEffect, L as ErgoBookRequestSchema, Lt as getRentalsEffect, M as DocumentStatusUpdateRequestSchema, Mt as clearAdditionalServicesEffect, N as DocumentSummarySchema, Nt as createInsurancePreContractEffect, O as DocumentCollectionResponseSchema, Ot as decodeV1OperationResponse, P as DocumentTypeSchema, Pt as getBankTransferDetailsEffect, Q as QuoteLineSchema, Qt as defineV9PropertyHighlightSourcesFromUnknown, R as ErgoBookingIdentityRequestSchema, Rt as getStartDateSelectedAvailabilityEffect, S as makeV1OpenApiClientLive, St as UnitResponseSchema, T as CalendarResponseSchema, Tt as V1_OPERATIONS, U as ErgoPlanSearchRequestSchema, Ut as searchEffect, V as ErgoCreatePreContractRequestSchema, Vt as quoteEffect, W as ErgoReadPreContractRequestSchema, Wt as selectCancellationPolicyEffect, X as PaymentScheduleItemSchema, Xt as defineWebsiteSDKOptions, Y as OnOfficeUnitSchema, Yt as submitPaymentOptionEffect, Z as PaymentScheduleSchema, Zt as defineV9PropertyHighlightSources, _t as TravelInsuranceBookingSchema, at as RegionListResponseSchema, b as V1OpenApiClientError, bt as UnitListResponseSchema, ct as ServiceBeonDataSchema, dt as ServiceListResponseSchema, et as QuotePricesResponseSchema, ft as SetupDataSchema, g as makeV0OpenApiClientLive, gt as TileTagSchema, h as makeV0OpenApiClientFetchLive, ht as TileSchema, it as RawVofficeObjectSchema, j as DocumentStatusSchema, jt as bookInsuranceEffect, k as DocumentResourceResponseSchema, kt as addAdditionalServiceEffect, lt as ServiceImageSchema, m as V0OpenApiClientError, mt as TileCollectionResponseSchema, nt as QuoteServiceSchema, ot as RoomImageSchema, p as V0OpenApiClient, pt as SetupResponseSchema, q as HubErrorSchema, qt as submitContactEffect, rt as RawObjectResponseSchema, st as SearchPropertiesResponseSchema, t as createWebsiteSDK, tt as QuoteSchema, ut as ServiceLimitSchema, vt as UnitIdsResponseSchema, w as CalendarDaySchema, wt as V1_BASE_URL, x as makeV1OpenApiClientFetchLive, xt as UnitOfferSchema, y as V1OpenApiClient, yt as UnitListItemSchema, z as ErgoBookingIdentitySchema, zt as getTermsAndPrivacyPolicyEffect } from "./client-BEL6ow0i.mjs";
2
2
  import { AdditionalServiceLimitExceeded, CoreSDKError, CoreSDKError as CMSError, CustomAttributeCatalogSchema, GuestQuoteSchema, InvalidAdditionalServiceQuantity, LocaleSchema, SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS, SearchMapSearchInputSchema, SearchMapSearchOutputSchema, SearchSearchFieldOrderBySchema, SearchSearchFieldSortSchema, SearchSearchInputSchema, SearchSearchOutputSchema, SearchSearchPriceSortSchema, SearchSearchRandomSortSchema, SearchSearchRatingSortSchema, SearchSearchSortSchema, SearchSortDirectionSchema, UnknownAdditionalService, defineCustomAttributes, defineCustomAttributesFromUnknown, fetchCustomAttributeCatalog, parseCustomAttributeCatalog, validateContactSubmitInput } from "@v-office/sdk-core";
3
3
  //#region codegen/v9/heuristic-generation/public-api.ts
4
4
  const customDataAttribute = (name) => name;
@@ -13,4 +13,4 @@ const defineVofficeOfferDataAttributes = defineDataAttributes();
13
13
  const defineVofficeRatingDataAttributes = defineDataAttributes();
14
14
  const defineVofficeTotalRatingDataAttributes = defineDataAttributes();
15
15
  //#endregion
16
- export { AdditionalServiceLimitExceeded, ApiEnvelopeBaseSchema, CMSError, CalendarDaySchema, CalendarResponseSchema, CoreSDKError, CurrentMemberResponseSchema, CustomAttributeCatalogSchema, CustomerUnitSummarySchema, DocumentCollectionResponseSchema, DocumentResourceResponseSchema, DocumentResourceSchema, DocumentStatusSchema, DocumentStatusUpdateRequestSchema, DocumentSummarySchema, DocumentTypeSchema, ErgoAddressSchema, ErgoBankSchema, ErgoBookRequestSchema, ErgoCommonFieldsSchema, ErgoCreatePreContractRequestSchema, ErgoPersonSchema, ErgoPlanSearchRequestSchema, ErgoPolicyNumberRequestSchema, ErgoReadPreContractRequestSchema, ErgoTripAndCustomerRequestSchema, FacilityListResponseSchema, GuestQuoteSchema, InvalidAdditionalServiceQuantity, LocaleSchema, OnOfficeUnitCollectionResponseSchema, OnOfficeUnitSchema, PaymentScheduleItemSchema, PaymentScheduleSchema, QuoteLineSchema, QuotePricesPayloadSchema, QuotePricesResponseSchema, QuoteSchema, QuoteServiceSchema, RawObjectResponseSchema, RawVofficeObjectSchema, RegionListResponseSchema, RoomImageSchema, SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS, SearchMapSearchInputSchema, SearchMapSearchOutputSchema, SearchPropertiesResponseSchema, SearchSearchFieldOrderBySchema, SearchSearchFieldSortSchema, SearchSearchInputSchema, SearchSearchOutputSchema, SearchSearchPriceSortSchema, SearchSearchRandomSortSchema, SearchSearchRatingSortSchema, SearchSearchSortSchema, SearchSortDirectionSchema, ServiceBeonDataSchema, ServiceImageSchema, ServiceLimitSchema, ServiceListResponseSchema, SetupDataSchema, SetupResponseSchema, TileCollectionResponseSchema, TileSchema, TileTagSchema, TravelInsuranceBookingSchema, TravelInsuranceBookingStoreRequestSchema, UnitIdsResponseSchema, UnitListItemSchema, UnitListResponseSchema, UnitOfferSchema, UnitResponseSchema, UnitServicePriceSchema, UnknownAdditionalService, V0OpenApiClient, V0OpenApiClientError, V1OpenApiClient, V1OpenApiClientError, V1_BASE_URL, V1_OPERATIONS, VideoListResponseSchema, VideoResponseSchema, addAdditionalServiceEffect, bookEffect, bookInsuranceEffect, clearAdditionalServicesEffect, createInsurancePreContractEffect, createWebsiteSDK, customDataAttribute, decodeV1OperationResponse, defineWebsiteSDKOptions as defineCMSSDKOptions, defineWebsiteSDKOptions, defineCustomAttributes, defineCustomAttributesFromUnknown, defineDataAttributes, defineV9PropertyHighlightSources, defineV9PropertyHighlightSourcesFromUnknown, defineVofficeFacilityDataAttributes, defineVofficeFeedbackDataAttributes, defineVofficeImageDataAttributes, defineVofficeOfferDataAttributes, defineVofficePriceDataAttributes, defineVofficeRatingDataAttributes, defineVofficeServiceDataAttributes, defineVofficeTotalRatingDataAttributes, defineVofficeUnitDataAttributes, fetchCustomAttributeCatalog, getBankTransferDetailsEffect, getFiltersEffect, getInitialAvailabilityEffect, getRentalsEffect, getStartDateSelectedAvailabilityEffect, getTermsAndPrivacyPolicyEffect, makeV0OpenApiClientFetchLive, makeV0OpenApiClientLive, makeV1OpenApiClientFetchLive, makeV1OpenApiClientLive, mapSearchEffect, parseCustomAttributeCatalog, quoteEffect, removeAdditionalServiceEffect, searchEffect, selectCancellationPolicyEffect, selectInsuranceEffect, selectInsurancePaymentEffect, submitContactEffect, submitPaymentOption, submitPaymentOptionEffect, validateContactSubmitInput };
16
+ export { AdditionalServiceLimitExceeded, ApiEnvelopeBaseSchema, CMSError, CalendarDaySchema, CalendarResponseSchema, CoreSDKError, CurrentMemberResponseSchema, CustomAttributeCatalogSchema, CustomerUnitSummarySchema, DocumentCollectionResponseSchema, DocumentResourceResponseSchema, DocumentResourceSchema, DocumentStatusSchema, DocumentStatusUpdateRequestSchema, DocumentSummarySchema, DocumentTypeSchema, ErgoAddressSchema, ErgoBankSchema, ErgoBookRequestSchema, ErgoBookingIdentityRequestSchema, ErgoBookingIdentitySchema, ErgoCommonFieldsSchema, ErgoCreatePreContractRequestSchema, ErgoPersonSchema, ErgoPlanSearchRequestSchema, ErgoReadPreContractRequestSchema, ErgoTripAndCustomerRequestSchema, FacilityListResponseSchema, GuestQuoteSchema, HubErrorSchema, InvalidAdditionalServiceQuantity, LocaleSchema, OnOfficeUnitCollectionResponseSchema, OnOfficeUnitSchema, PaymentScheduleItemSchema, PaymentScheduleSchema, QuoteLineSchema, QuotePricesPayloadSchema, QuotePricesResponseSchema, QuoteSchema, QuoteServiceSchema, RawObjectResponseSchema, RawVofficeObjectSchema, RegionListResponseSchema, RoomImageSchema, SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS, SearchMapSearchInputSchema, SearchMapSearchOutputSchema, SearchPropertiesResponseSchema, SearchSearchFieldOrderBySchema, SearchSearchFieldSortSchema, SearchSearchInputSchema, SearchSearchOutputSchema, SearchSearchPriceSortSchema, SearchSearchRandomSortSchema, SearchSearchRatingSortSchema, SearchSearchSortSchema, SearchSortDirectionSchema, ServiceBeonDataSchema, ServiceImageSchema, ServiceLimitSchema, ServiceListResponseSchema, SetupDataSchema, SetupResponseSchema, TileCollectionResponseSchema, TileSchema, TileTagSchema, TravelInsuranceBookingSchema, UnitIdsResponseSchema, UnitListItemSchema, UnitListResponseSchema, UnitOfferSchema, UnitResponseSchema, UnitServicePriceSchema, UnknownAdditionalService, V0OpenApiClient, V0OpenApiClientError, V1OpenApiClient, V1OpenApiClientError, V1_BASE_URL, V1_OPERATIONS, VideoListResponseSchema, VideoResponseSchema, addAdditionalServiceEffect, bookEffect, bookInsuranceEffect, clearAdditionalServicesEffect, createInsurancePreContractEffect, createWebsiteSDK, customDataAttribute, decodeV1OperationResponse, defineWebsiteSDKOptions as defineCMSSDKOptions, defineWebsiteSDKOptions, defineCustomAttributes, defineCustomAttributesFromUnknown, defineDataAttributes, defineV9PropertyHighlightSources, defineV9PropertyHighlightSourcesFromUnknown, defineVofficeFacilityDataAttributes, defineVofficeFeedbackDataAttributes, defineVofficeImageDataAttributes, defineVofficeOfferDataAttributes, defineVofficePriceDataAttributes, defineVofficeRatingDataAttributes, defineVofficeServiceDataAttributes, defineVofficeTotalRatingDataAttributes, defineVofficeUnitDataAttributes, fetchCustomAttributeCatalog, getBankTransferDetailsEffect, getFiltersEffect, getInitialAvailabilityEffect, getRentalsEffect, getStartDateSelectedAvailabilityEffect, getTermsAndPrivacyPolicyEffect, makeV0OpenApiClientFetchLive, makeV0OpenApiClientLive, makeV1OpenApiClientFetchLive, makeV1OpenApiClientLive, mapSearchEffect, parseCustomAttributeCatalog, quoteEffect, removeAdditionalServiceEffect, searchEffect, selectCancellationPolicyEffect, selectInsuranceEffect, selectInsurancePaymentEffect, submitContactEffect, submitPaymentOption, submitPaymentOptionEffect, validateContactSubmitInput };
@@ -4,6 +4,7 @@
4
4
 
5
5
  Release notes of `@v-office/website-sdk`, newest first. Each version has its own directory.
6
6
 
7
+ - `versions/3.4.0/CHANGELOG.md`: release notes for 3.4.0
7
8
  - `versions/3.3.0/CHANGELOG.md`: release notes for 3.3.0
8
9
  - `versions/3.2.1/CHANGELOG.md`: release notes for 3.2.1
9
10
  - `versions/3.2.0/CHANGELOG.md`: release notes for 3.2.0
@@ -4,6 +4,7 @@
4
4
 
5
5
  Migration guides of `@v-office/website-sdk`, newest first. Apply them in order when skipping versions.
6
6
 
7
+ - `versions/3.4.0/MIGRATION.md`: Migration: 3.3.0 to 3.4.0
7
8
  - `versions/3.3.0/MIGRATION.md`: Migration: 3.2.1 to 3.3.0
8
9
  - `versions/3.2.1/MIGRATION.md`: Migration: 3.2.0 to 3.2.1
9
10
  - `versions/3.2.0/MIGRATION.md`: Migration: 3.1.1 to 3.2.0
@@ -478,10 +478,10 @@ const insuranceBooking = await sdk.live.quote.bookInsurance({
478
478
  This is a breaking change in 2.13.0. The former public `guestToken` input is no
479
479
  longer used; see `versions/2.13.0/MIGRATION.md`.
480
480
 
481
- `v9` supports real insurance option refresh, pre-contract, payment selection, and booking. With ERGO, issued policies can be read and revoked (rejects on other accounts); revoking rejects with ERGO's reason when ERGO refuses:
481
+ `v9` supports real insurance option refresh, pre-contract, payment selection, and booking. With ERGO, the booking's active policy can be read and revoked (rejects on other accounts). Both need the booking and reject when it has no active policy with that number; revoking rejects with ERGO's reason when ERGO refuses:
482
482
 
483
483
  ```ts
484
- const policy = await sdk.live.insurance.readPolicy({ policyNumber });
484
+ const policy = await sdk.live.insurance.readPolicy({ policyNumber, booking });
485
485
  const revoked = await sdk.live.insurance.revokePolicy({ policyNumber, booking });
486
486
  ```
487
487
 
@@ -578,6 +578,47 @@ A feedback with neither rating nor text is never an item. `summary.rating` and
578
578
  covers the included items. When no included item has a rating, `reviews` has
579
579
  `items` and no `summary`. A text answer to a `text` criterion counts as text.
580
580
 
581
+ ### Legacy v9 Special Offers
582
+
583
+ On v9, every item of `getRentals` and `getRentalsByIds` has `offers`: the special offers
584
+ vOffice links to the rental, without a period. Use them for an "Angebot" badge on a rental
585
+ page, an offers overview, or a campaign page. A rental without offers has `offers: []`;
586
+ that is the normal case, so hide the offer UI then instead of showing an empty state.
587
+
588
+ ```ts
589
+ type V9RentalOffer = {
590
+ id: string; // vOffice offer ID
591
+ name: string; // in the requested locale where vOffice has a translation
592
+ discount:
593
+ | { type: "percent"; percent: number } // 15 = 15 %
594
+ | { type: "amount"; amount: { amount: number; currency: string } } // minor unit, 2000 = 20,00 €
595
+ | { type: "stayPay"; stayNights: number; payNights: number }; // stay 7, pay 5
596
+ minNights?: number;
597
+ arrivalWithinDays?: number; // last minute: arrival at most this many days away
598
+ validFrom?: string; // YYYY-MM-DD, the arrival is not before this day
599
+ validUntil?: string; // YYYY-MM-DD, the departure is not after this day
600
+ };
601
+ ```
602
+
603
+ - `id` is the value the `offer` search filter takes
604
+ ([Special Offers](search.md#special-offers)), so a campaign page can link to a search
605
+ for its rentals. It is the Hub's `voffice_offer_id`. The Hub's `data(attributes: ["id"])`
606
+ is its own row ID and filters nothing, and the dates are `fromdate`/`tilldate`
607
+ (`validfrom`, `from_date` and similar spellings return `null`). Read `offers` instead of
608
+ querying the Hub.
609
+ - The SDK leaves out offers vOffice does not show to websites and offers redeemed with a
610
+ voucher code. The code never reaches the page.
611
+ - Offers come from the be-on! Hub's last import of the vOffice data, like the rest of
612
+ the rental. An offer can be linked and still apply to no stay in a given period: only a
613
+ search with dates says what it costs. Do not render "12 rentals on offer" as a property
614
+ of the campaign; it holds for one period only.
615
+ - `validFrom` and `validUntil` are the vOffice dates as stored. Hide an offer whose
616
+ `validUntil` has passed in the browser, not only at build time, since a static page can
617
+ outlive it.
618
+ - Many rentals share the same offer. For an overview page, group by `id`.
619
+
620
+ v10 rentals have no `offers`.
621
+
581
622
  ## Legacy v9 Rentals By ID
582
623
 
583
624
  `sdk.live.rentals.getRentalsByIds` loads the rentals with the given IDs, for example the
@@ -398,7 +398,8 @@ the `p_` number. Confirm the field with the user before you offer the filter.
398
398
  page about one campaign, for example an early-booking deal. It checks neither whether
399
399
  the offer is shown to websites nor whether it applies to the requested period, so a
400
400
  rental can match after its offer has ended. When the question is "which rentals have
401
- a deal right now", use `offers`. Request `--offer`.
401
+ a deal right now", use `offers`. Request `--offer`. The offer ID is the `id` of a
402
+ rental's `offers` entry ([Legacy v9 Special Offers](rentals.md#legacy-v9-special-offers)).
402
403
 
403
404
  `offers` is a `boolean` definition and `offer` an `int` definition with the offer ID:
404
405
 
@@ -0,0 +1,39 @@
1
+ # Changelog: 3.4.0
2
+
3
+ ERGO insurance on v9 works again. The be-on! Hub now gives ERGO policies only to a guest who
4
+ proves the booking, and it refused every ERGO call of 3.3.0 and earlier, from the pre-contract
5
+ on. The SDK now sends the booking's guest token, reservation number and booking ID with every
6
+ ERGO call. A v9 site can also show a rental's special offers without a period: an "Angebot"
7
+ badge on the rental page, an offers overview or a campaign page.
8
+
9
+ ## Added
10
+
11
+ - v9: `offers` on every item of `sdk.static.rentals.getRentals` and
12
+ `sdk.live.rentals.getRentalsByIds`, `[]` when the rental has none. Each offer has `id` (the
13
+ vOffice offer ID, the value the `offer` search filter takes), `name`, `discount` (`percent`,
14
+ `amount` or `stayPay`), and when vOffice states them `minNights`, `arrivalWithinDays`,
15
+ `validFrom` and `validUntil`. Offers that vOffice does not show to websites and offers redeemed
16
+ with a voucher code are left out.
17
+ - Types `V9RentalOffer`, `V9RentalOfferDiscount`, `V9RentalGetRentalsOutput` and
18
+ `V9RentalGetRentalsOutputItem`.
19
+ - `rentals.md` ("Legacy v9 Special Offers"): the offer fields, the empty case, and what a page
20
+ must not conclude from them.
21
+
22
+ ## Changed
23
+
24
+ - `live.insurance.readPolicy` takes the booking: `readPolicy({ policyNumber, booking })`, the same
25
+ input as `revokePolicy`. It returns the booking's active policy and rejects when the booking has
26
+ no active policy or holds a different one. A revoked policy can no longer be read.
27
+ - `revokePolicy` checks that the booking's active policy has the given number before it asks ERGO
28
+ to revoke it. When it has another number or there is none, it rejects and nothing is revoked.
29
+ - ERGO errors from the Hub (booking not confirmed, no active policy, a policy already active,
30
+ vOffice unreachable) reject with the Hub's message.
31
+ - v9: `KnownVofficeOfferData` (`VofficeOfferDataFieldSchemas`) declares the fields the be-on! Hub
32
+ returns: `name`, `description`, `type`, `discountType`, `value`, `minStay`, `timeSpan`,
33
+ `voucherCode`, `fromdate`, `tilldate` and `visible4interfaces`. `discount` is gone; the Hub
34
+ never returned it. `description` is nullable.
35
+
36
+ ## Fixed
37
+
38
+ - v9 ERGO: `createInsurancePreContract`, `bookInsurance`, `readPolicy` and `revokePolicy` were
39
+ refused by the Hub (HTTP 422).
@@ -0,0 +1,44 @@
1
+ # Migration: 3.3.0 to 3.4.0
2
+
3
+ Only a v9 site that calls `live.insurance.readPolicy` has to change. Everything else works without
4
+ changes.
5
+
6
+ ## 1. Upgrade
7
+
8
+ ```sh
9
+ pnpm add @v-office/website-sdk@3.4.0
10
+ ```
11
+
12
+ ## 2. Pass the booking to `readPolicy`
13
+
14
+ ```ts
15
+ // Before
16
+ const policy = await sdk.live.insurance.readPolicy({ policyNumber });
17
+
18
+ // After
19
+ const policy = await sdk.live.insurance.readPolicy({ policyNumber, booking });
20
+ ```
21
+
22
+ `booking` is the result of `live.booking.book`, as for `revokePolicy`. `readPolicy` now returns
23
+ only the booking's active policy; after `revokePolicy` it rejects instead of returning the revoked
24
+ policy, so keep the policy that `revokePolicy` returned when the page needs to show it.
25
+
26
+ ## 3. Optional: show special offers on v9
27
+
28
+ Read a rental's `offers` and show them as described in `rentals.md`, "Legacy v9 Special Offers".
29
+ Hide the offer UI when `offers` is empty, which is the normal case.
30
+
31
+ A site that queried the be-on! Hub directly for offers (GraphQL `voffice_offers` or v1
32
+ `/Units/{id}/offers`) can switch to `offers`. The SDK already leaves out offers with a voucher
33
+ code, so the page cannot leak one.
34
+
35
+ ## 4. Only if you used `defineVofficeOfferDataAttributes`
36
+
37
+ The known attribute `discount` is gone. Use `discountType` and `value`, or read `offers`.
38
+
39
+ ## What stays the same
40
+
41
+ - v10: nothing changes.
42
+ - v9 with URV insurance: nothing changes.
43
+ - `createInsurancePreContract`, `selectInsurancePayment`, `bookInsurance` and `revokePolicy` keep
44
+ their inputs and outputs.
@@ -4890,7 +4890,21 @@ const VofficeFeedbackDataFieldSchemas = {
4890
4890
  avgRating: Schema.Number
4891
4891
  };
4892
4892
  const parseVofficeFeedbackData = (input) => parseJsonData(VofficeFeedbackDataFieldSchemas, input);
4893
- Schema.String, Schema.String, Schema.Number;
4893
+ /** Known structure of VofficeOffer.data attributes. */
4894
+ const VofficeOfferDataFieldSchemas = {
4895
+ name: Schema.String,
4896
+ description: Schema.NullOr(Schema.String),
4897
+ type: Schema.NullOr(Schema.String),
4898
+ discountType: Schema.String,
4899
+ value: Schema.Number,
4900
+ minStay: Schema.NullOr(Schema.Number),
4901
+ timeSpan: Schema.NullOr(Schema.Number),
4902
+ voucherCode: Schema.NullOr(Schema.String),
4903
+ fromdate: Schema.NullOr(Schema.String),
4904
+ tilldate: Schema.NullOr(Schema.String),
4905
+ visible4interfaces: Schema.Boolean
4906
+ };
4907
+ const parseVofficeOfferData = (input) => parseJsonData(VofficeOfferDataFieldSchemas, input);
4894
4908
  /** Known structure of VofficeRating.data attributes. */
4895
4909
  const VofficeRatingDataFieldSchemas = {
4896
4910
  fb_avg: Schema.Number,
@@ -5159,7 +5173,7 @@ const documents = {
5159
5173
  }
5160
5174
  }]
5161
5175
  },
5162
- "\n query CoreSDK_RentalsAllWithoutFeedbacks(\n $language: String\n $voffice_ids: [Int!]\n $rentalDataAttributes: [String!]! = []\n $rentalFacilityDataAttributes: [String!]! = []\n $rentalRatingDataAttributes: [String!]! = []\n ) {\n all(language: $language, voffice_ids: $voffice_ids) {\n id\n voffice_id\n voffice_facility_id\n name\n publish\n data(attributes: $rentalDataAttributes)\n additional_voffice_data {\n beds\n }\n voffice_groups {\n voffice_group_id\n }\n voffice_facility {\n id\n voffice_id\n name\n publish\n data(attributes: $rentalFacilityDataAttributes)\n }\n voffice_images {\n id\n path\n title\n description\n }\n voffice_room_images {\n id\n path\n name\n title\n description\n }\n voffice_rating {\n id\n data(attributes: $rentalRatingDataAttributes)\n }\n }\n }\n": {
5176
+ "\n query CoreSDK_RentalsAllWithoutFeedbacks(\n $language: String\n $voffice_ids: [Int!]\n $rentalDataAttributes: [String!]! = []\n $rentalFacilityDataAttributes: [String!]! = []\n $rentalRatingDataAttributes: [String!]! = []\n $rentalOfferDataAttributes: [String!]! = []\n ) {\n all(language: $language, voffice_ids: $voffice_ids) {\n id\n voffice_id\n voffice_facility_id\n name\n publish\n data(attributes: $rentalDataAttributes)\n additional_voffice_data {\n beds\n }\n voffice_groups {\n voffice_group_id\n }\n voffice_facility {\n id\n voffice_id\n name\n publish\n data(attributes: $rentalFacilityDataAttributes)\n }\n voffice_images {\n id\n path\n title\n description\n }\n voffice_room_images {\n id\n path\n name\n title\n description\n }\n voffice_rating {\n id\n data(attributes: $rentalRatingDataAttributes)\n }\n voffice_offers {\n voffice_offer_id\n data(attributes: $rentalOfferDataAttributes)\n }\n }\n }\n": {
5163
5177
  kind: "Document",
5164
5178
  definitions: [{
5165
5179
  kind: "OperationDefinition",
@@ -5298,6 +5312,36 @@ const documents = {
5298
5312
  kind: "ListValue",
5299
5313
  values: []
5300
5314
  }
5315
+ },
5316
+ {
5317
+ kind: "VariableDefinition",
5318
+ variable: {
5319
+ kind: "Variable",
5320
+ name: {
5321
+ kind: "Name",
5322
+ value: "rentalOfferDataAttributes"
5323
+ }
5324
+ },
5325
+ type: {
5326
+ kind: "NonNullType",
5327
+ type: {
5328
+ kind: "ListType",
5329
+ type: {
5330
+ kind: "NonNullType",
5331
+ type: {
5332
+ kind: "NamedType",
5333
+ name: {
5334
+ kind: "Name",
5335
+ value: "String"
5336
+ }
5337
+ }
5338
+ }
5339
+ }
5340
+ },
5341
+ defaultValue: {
5342
+ kind: "ListValue",
5343
+ values: []
5344
+ }
5301
5345
  }
5302
5346
  ],
5303
5347
  selectionSet: {
@@ -5612,6 +5656,43 @@ const documents = {
5612
5656
  }]
5613
5657
  }]
5614
5658
  }
5659
+ },
5660
+ {
5661
+ kind: "Field",
5662
+ name: {
5663
+ kind: "Name",
5664
+ value: "voffice_offers"
5665
+ },
5666
+ selectionSet: {
5667
+ kind: "SelectionSet",
5668
+ selections: [{
5669
+ kind: "Field",
5670
+ name: {
5671
+ kind: "Name",
5672
+ value: "voffice_offer_id"
5673
+ }
5674
+ }, {
5675
+ kind: "Field",
5676
+ name: {
5677
+ kind: "Name",
5678
+ value: "data"
5679
+ },
5680
+ arguments: [{
5681
+ kind: "Argument",
5682
+ name: {
5683
+ kind: "Name",
5684
+ value: "attributes"
5685
+ },
5686
+ value: {
5687
+ kind: "Variable",
5688
+ name: {
5689
+ kind: "Name",
5690
+ value: "rentalOfferDataAttributes"
5691
+ }
5692
+ }
5693
+ }]
5694
+ }]
5695
+ }
5615
5696
  }
5616
5697
  ]
5617
5698
  }
@@ -5619,7 +5700,7 @@ const documents = {
5619
5700
  }
5620
5701
  }]
5621
5702
  },
5622
- "\n query CoreSDK_RentalsAllByFacilityObjectGroupsWithoutFeedbacks(\n $language: String\n $voffice_ids: [Int!]\n $rentalDataAttributes: [String!]! = []\n $rentalRatingDataAttributes: [String!]! = []\n ) {\n all(language: $language, voffice_ids: $voffice_ids) {\n id\n voffice_id\n voffice_facility_id\n name\n publish\n data(attributes: $rentalDataAttributes)\n additional_voffice_data {\n beds\n }\n voffice_groups {\n voffice_group_id\n }\n voffice_images {\n id\n path\n title\n description\n }\n voffice_room_images {\n id\n path\n name\n title\n description\n }\n voffice_rating {\n id\n data(attributes: $rentalRatingDataAttributes)\n }\n }\n }\n": {
5703
+ "\n query CoreSDK_RentalsAllByFacilityObjectGroupsWithoutFeedbacks(\n $language: String\n $voffice_ids: [Int!]\n $rentalDataAttributes: [String!]! = []\n $rentalRatingDataAttributes: [String!]! = []\n $rentalOfferDataAttributes: [String!]! = []\n ) {\n all(language: $language, voffice_ids: $voffice_ids) {\n id\n voffice_id\n voffice_facility_id\n name\n publish\n data(attributes: $rentalDataAttributes)\n additional_voffice_data {\n beds\n }\n voffice_groups {\n voffice_group_id\n }\n voffice_images {\n id\n path\n title\n description\n }\n voffice_room_images {\n id\n path\n name\n title\n description\n }\n voffice_rating {\n id\n data(attributes: $rentalRatingDataAttributes)\n }\n voffice_offers {\n voffice_offer_id\n data(attributes: $rentalOfferDataAttributes)\n }\n }\n }\n": {
5623
5704
  kind: "Document",
5624
5705
  definitions: [{
5625
5706
  kind: "OperationDefinition",
@@ -5728,6 +5809,36 @@ const documents = {
5728
5809
  kind: "ListValue",
5729
5810
  values: []
5730
5811
  }
5812
+ },
5813
+ {
5814
+ kind: "VariableDefinition",
5815
+ variable: {
5816
+ kind: "Variable",
5817
+ name: {
5818
+ kind: "Name",
5819
+ value: "rentalOfferDataAttributes"
5820
+ }
5821
+ },
5822
+ type: {
5823
+ kind: "NonNullType",
5824
+ type: {
5825
+ kind: "ListType",
5826
+ type: {
5827
+ kind: "NonNullType",
5828
+ type: {
5829
+ kind: "NamedType",
5830
+ name: {
5831
+ kind: "Name",
5832
+ value: "String"
5833
+ }
5834
+ }
5835
+ }
5836
+ }
5837
+ },
5838
+ defaultValue: {
5839
+ kind: "ListValue",
5840
+ values: []
5841
+ }
5731
5842
  }
5732
5843
  ],
5733
5844
  selectionSet: {
@@ -5981,6 +6092,43 @@ const documents = {
5981
6092
  }]
5982
6093
  }]
5983
6094
  }
6095
+ },
6096
+ {
6097
+ kind: "Field",
6098
+ name: {
6099
+ kind: "Name",
6100
+ value: "voffice_offers"
6101
+ },
6102
+ selectionSet: {
6103
+ kind: "SelectionSet",
6104
+ selections: [{
6105
+ kind: "Field",
6106
+ name: {
6107
+ kind: "Name",
6108
+ value: "voffice_offer_id"
6109
+ }
6110
+ }, {
6111
+ kind: "Field",
6112
+ name: {
6113
+ kind: "Name",
6114
+ value: "data"
6115
+ },
6116
+ arguments: [{
6117
+ kind: "Argument",
6118
+ name: {
6119
+ kind: "Name",
6120
+ value: "attributes"
6121
+ },
6122
+ value: {
6123
+ kind: "Variable",
6124
+ name: {
6125
+ kind: "Name",
6126
+ value: "rentalOfferDataAttributes"
6127
+ }
6128
+ }
6129
+ }]
6130
+ }]
6131
+ }
5984
6132
  }
5985
6133
  ]
5986
6134
  }
@@ -6287,7 +6435,7 @@ const documents = {
6287
6435
  }
6288
6436
  }]
6289
6437
  },
6290
- "\n query CoreSDK_RentalsAll(\n $language: String\n $voffice_ids: [Int!]\n $rentalDataAttributes: [String!]! = []\n $rentalFacilityDataAttributes: [String!]! = []\n $rentalRatingDataAttributes: [String!]! = []\n $rentalFeedbackDataAttributes: [String!]! = []\n ) {\n all(language: $language, voffice_ids: $voffice_ids) {\n id\n voffice_id\n voffice_facility_id\n name\n publish\n data(attributes: $rentalDataAttributes)\n additional_voffice_data {\n beds\n }\n voffice_facility {\n id\n voffice_id\n name\n publish\n data(attributes: $rentalFacilityDataAttributes)\n }\n voffice_images {\n id\n path\n title\n description\n }\n voffice_room_images {\n id\n path\n name\n title\n description\n }\n voffice_rating {\n id\n data(attributes: $rentalRatingDataAttributes)\n }\n voffice_feedbacks {\n data(attributes: $rentalFeedbackDataAttributes)\n }\n }\n }\n": {
6438
+ "\n query CoreSDK_RentalsAll(\n $language: String\n $voffice_ids: [Int!]\n $rentalDataAttributes: [String!]! = []\n $rentalFacilityDataAttributes: [String!]! = []\n $rentalRatingDataAttributes: [String!]! = []\n $rentalFeedbackDataAttributes: [String!]! = []\n $rentalOfferDataAttributes: [String!]! = []\n ) {\n all(language: $language, voffice_ids: $voffice_ids) {\n id\n voffice_id\n voffice_facility_id\n name\n publish\n data(attributes: $rentalDataAttributes)\n additional_voffice_data {\n beds\n }\n voffice_facility {\n id\n voffice_id\n name\n publish\n data(attributes: $rentalFacilityDataAttributes)\n }\n voffice_images {\n id\n path\n title\n description\n }\n voffice_room_images {\n id\n path\n name\n title\n description\n }\n voffice_rating {\n id\n data(attributes: $rentalRatingDataAttributes)\n }\n voffice_feedbacks {\n data(attributes: $rentalFeedbackDataAttributes)\n }\n voffice_offers {\n voffice_offer_id\n data(attributes: $rentalOfferDataAttributes)\n }\n }\n }\n": {
6291
6439
  kind: "Document",
6292
6440
  definitions: [{
6293
6441
  kind: "OperationDefinition",
@@ -6456,6 +6604,36 @@ const documents = {
6456
6604
  kind: "ListValue",
6457
6605
  values: []
6458
6606
  }
6607
+ },
6608
+ {
6609
+ kind: "VariableDefinition",
6610
+ variable: {
6611
+ kind: "Variable",
6612
+ name: {
6613
+ kind: "Name",
6614
+ value: "rentalOfferDataAttributes"
6615
+ }
6616
+ },
6617
+ type: {
6618
+ kind: "NonNullType",
6619
+ type: {
6620
+ kind: "ListType",
6621
+ type: {
6622
+ kind: "NonNullType",
6623
+ type: {
6624
+ kind: "NamedType",
6625
+ name: {
6626
+ kind: "Name",
6627
+ value: "String"
6628
+ }
6629
+ }
6630
+ }
6631
+ }
6632
+ },
6633
+ defaultValue: {
6634
+ kind: "ListValue",
6635
+ values: []
6636
+ }
6459
6637
  }
6460
6638
  ],
6461
6639
  selectionSet: {
@@ -6784,6 +6962,43 @@ const documents = {
6784
6962
  }]
6785
6963
  }]
6786
6964
  }
6965
+ },
6966
+ {
6967
+ kind: "Field",
6968
+ name: {
6969
+ kind: "Name",
6970
+ value: "voffice_offers"
6971
+ },
6972
+ selectionSet: {
6973
+ kind: "SelectionSet",
6974
+ selections: [{
6975
+ kind: "Field",
6976
+ name: {
6977
+ kind: "Name",
6978
+ value: "voffice_offer_id"
6979
+ }
6980
+ }, {
6981
+ kind: "Field",
6982
+ name: {
6983
+ kind: "Name",
6984
+ value: "data"
6985
+ },
6986
+ arguments: [{
6987
+ kind: "Argument",
6988
+ name: {
6989
+ kind: "Name",
6990
+ value: "attributes"
6991
+ },
6992
+ value: {
6993
+ kind: "Variable",
6994
+ name: {
6995
+ kind: "Name",
6996
+ value: "rentalOfferDataAttributes"
6997
+ }
6998
+ }
6999
+ }]
7000
+ }]
7001
+ }
6787
7002
  }
6788
7003
  ]
6789
7004
  }
@@ -8264,6 +8479,7 @@ const rentalsAllWithoutFeedbacksQuery = graphql(`
8264
8479
  $rentalDataAttributes: [String!]! = []
8265
8480
  $rentalFacilityDataAttributes: [String!]! = []
8266
8481
  $rentalRatingDataAttributes: [String!]! = []
8482
+ $rentalOfferDataAttributes: [String!]! = []
8267
8483
  ) {
8268
8484
  all(language: $language, voffice_ids: $voffice_ids) {
8269
8485
  id
@@ -8302,6 +8518,10 @@ const rentalsAllWithoutFeedbacksQuery = graphql(`
8302
8518
  id
8303
8519
  data(attributes: $rentalRatingDataAttributes)
8304
8520
  }
8521
+ voffice_offers {
8522
+ voffice_offer_id
8523
+ data(attributes: $rentalOfferDataAttributes)
8524
+ }
8305
8525
  }
8306
8526
  }
8307
8527
  `);
@@ -8311,6 +8531,7 @@ const rentalsAllByFacilityObjectGroupsWithoutFeedbacksQuery = graphql(`
8311
8531
  $voffice_ids: [Int!]
8312
8532
  $rentalDataAttributes: [String!]! = []
8313
8533
  $rentalRatingDataAttributes: [String!]! = []
8534
+ $rentalOfferDataAttributes: [String!]! = []
8314
8535
  ) {
8315
8536
  all(language: $language, voffice_ids: $voffice_ids) {
8316
8537
  id
@@ -8342,6 +8563,10 @@ const rentalsAllByFacilityObjectGroupsWithoutFeedbacksQuery = graphql(`
8342
8563
  id
8343
8564
  data(attributes: $rentalRatingDataAttributes)
8344
8565
  }
8566
+ voffice_offers {
8567
+ voffice_offer_id
8568
+ data(attributes: $rentalOfferDataAttributes)
8569
+ }
8345
8570
  }
8346
8571
  }
8347
8572
  `);
@@ -8381,6 +8606,7 @@ graphql(`
8381
8606
  $rentalFacilityDataAttributes: [String!]! = []
8382
8607
  $rentalRatingDataAttributes: [String!]! = []
8383
8608
  $rentalFeedbackDataAttributes: [String!]! = []
8609
+ $rentalOfferDataAttributes: [String!]! = []
8384
8610
  ) {
8385
8611
  all(language: $language, voffice_ids: $voffice_ids) {
8386
8612
  id
@@ -8419,6 +8645,10 @@ graphql(`
8419
8645
  voffice_feedbacks {
8420
8646
  data(attributes: $rentalFeedbackDataAttributes)
8421
8647
  }
8648
+ voffice_offers {
8649
+ voffice_offer_id
8650
+ data(attributes: $rentalOfferDataAttributes)
8651
+ }
8422
8652
  }
8423
8653
  }
8424
8654
  `);
@@ -8578,4 +8808,4 @@ const voucherValidityQuery = graphql(`
8578
8808
  }
8579
8809
  `);
8580
8810
  //#endregion
8581
- export { parseVofficeRatingData as C, parseVofficeFeedbackData as S, VofficeUnitDataPropertyCategoryValues as _, hubFiltersQuery as a, parseJsonData as b, rentalIdsQuery as c, rentalsAllByFacilityObjectGroupsWithoutFeedbacksQuery as d, rentalsAllFeedbacksQuery as f, VofficeUnitDataPropertyCategoryLabelKeys as g, VofficeUnitDataFieldSchemas as h, facilityTextsQuery as i, rentalRegionsQuery as l, RegionSchema as m, mapSearchQuery as n, hubRentalDataQuery as o, rentalsAllWithoutFeedbacksQuery as p, searchQuery as r, rentalFacilitiesForObjectGroupRelationQuery as s, voucherValidityQuery as t, rentalTextsQuery as u, VofficeUnitDataPropertyMetadata as v, parseVofficeUnitData as w, parseVofficeFacilityData as x, customDataAttribute as y };
8811
+ export { parseVofficeOfferData as C, parseVofficeFeedbackData as S, parseVofficeUnitData as T, VofficeUnitDataPropertyCategoryValues as _, hubFiltersQuery as a, parseJsonData as b, rentalIdsQuery as c, rentalsAllByFacilityObjectGroupsWithoutFeedbacksQuery as d, rentalsAllFeedbacksQuery as f, VofficeUnitDataPropertyCategoryLabelKeys as g, VofficeUnitDataFieldSchemas as h, facilityTextsQuery as i, rentalRegionsQuery as l, RegionSchema as m, mapSearchQuery as n, hubRentalDataQuery as o, rentalsAllWithoutFeedbacksQuery as p, searchQuery as r, rentalFacilitiesForObjectGroupRelationQuery as s, voucherValidityQuery as t, rentalTextsQuery as u, VofficeUnitDataPropertyMetadata as v, parseVofficeRatingData as w, parseVofficeFacilityData as x, customDataAttribute as y };
@@ -1,6 +1,6 @@
1
- import { Qt as V9_FACILITY_ATTRIBUTE_KEYS } from "./client-BlQ5phsZ.mjs";
2
- import { S as parseVofficeFeedbackData, _ as VofficeUnitDataPropertyCategoryValues, a as hubFiltersQuery, c as rentalIdsQuery, d as rentalsAllByFacilityObjectGroupsWithoutFeedbacksQuery, f as rentalsAllFeedbacksQuery, g as VofficeUnitDataPropertyCategoryLabelKeys, h as VofficeUnitDataFieldSchemas, i as facilityTextsQuery, p as rentalsAllWithoutFeedbacksQuery, s as rentalFacilitiesForObjectGroupRelationQuery, u as rentalTextsQuery, v as VofficeUnitDataPropertyMetadata, w as parseVofficeUnitData, x as parseVofficeFacilityData } from "./operations-Db2hRCLQ.mjs";
3
- import { a as toLocation, d as toLocalizedString, l as toCapacity, n as renderVofficePropertyAttribute, o as toFacilityImages, r as toV9Fact, s as toImages, t as toRentalHighlights, u as toAddress } from "./to-rental-highlights-BFLLKF6M.mjs";
1
+ import { $t as V9_FACILITY_ATTRIBUTE_KEYS } from "./client-BEL6ow0i.mjs";
2
+ import { C as parseVofficeOfferData, S as parseVofficeFeedbackData, T as parseVofficeUnitData, _ as VofficeUnitDataPropertyCategoryValues, a as hubFiltersQuery, c as rentalIdsQuery, d as rentalsAllByFacilityObjectGroupsWithoutFeedbacksQuery, f as rentalsAllFeedbacksQuery, g as VofficeUnitDataPropertyCategoryLabelKeys, h as VofficeUnitDataFieldSchemas, i as facilityTextsQuery, p as rentalsAllWithoutFeedbacksQuery, s as rentalFacilitiesForObjectGroupRelationQuery, u as rentalTextsQuery, v as VofficeUnitDataPropertyMetadata, x as parseVofficeFacilityData } from "./operations-DY2e_2Hd.mjs";
3
+ import { a as toLocation, d as toLocalizedString, l as toCapacity, n as renderVofficePropertyAttribute, o as toFacilityImages, r as toV9Fact, s as toImages, t as toRentalHighlights, u as toAddress } from "./to-rental-highlights-DptWc7-q.mjs";
4
4
  import { CoreSDKError, makeTranslate, pushFact, renderResolvedCustomAttribute, toCustomAttributeFact, toCustomAttributeList, toFact, toResolvedCustomAttributeCategoryTranslationKey, toReviewClassification } from "@v-office/sdk-core";
5
5
  import { Effect } from "effect";
6
6
  //#region src/legacy-v9/parser/rentals/to-description.ts
@@ -586,6 +586,47 @@ const toRentalRentalsOutput = ({ rental, locale, translations, imageProxyBaseUrl
586
586
  return item;
587
587
  });
588
588
  //#endregion
589
+ //#region src/legacy-v9/parser/rentals/to-rental-offers.ts
590
+ const HUNDREDTHS = 100;
591
+ const toDiscount = ({ discountType, value, minStay }) => {
592
+ if (value == null) return void 0;
593
+ switch (discountType) {
594
+ case "PERCENT": return {
595
+ type: "percent",
596
+ percent: value / HUNDREDTHS
597
+ };
598
+ case "FLAT": return {
599
+ type: "amount",
600
+ amount: {
601
+ amount: value,
602
+ currency: "EUR"
603
+ }
604
+ };
605
+ case "XY": return minStay == null ? void 0 : {
606
+ type: "stayPay",
607
+ stayNights: minStay,
608
+ payNights: value / HUNDREDTHS
609
+ };
610
+ default: return;
611
+ }
612
+ };
613
+ const isPublic = ({ known, unknown }) => known.visible4interfaces === true && known.voucherCode == null && !("voucherCode" in unknown);
614
+ const toRentalOffers = (offers) => (offers ?? []).flatMap((offer) => {
615
+ const data = parseVofficeOfferData(offer.data);
616
+ const { name, minStay, timeSpan, fromdate, tilldate } = data.known;
617
+ const discount = toDiscount(data.known);
618
+ if (!isPublic(data) || name == null || discount === void 0) return [];
619
+ return [{
620
+ id: String(offer.voffice_offer_id),
621
+ name,
622
+ discount,
623
+ ...minStay == null ? {} : { minNights: minStay },
624
+ ...timeSpan == null ? {} : { arrivalWithinDays: timeSpan },
625
+ ...fromdate == null ? {} : { validFrom: fromdate },
626
+ ...tilldate == null ? {} : { validUntil: tilldate }
627
+ }];
628
+ });
629
+ //#endregion
589
630
  //#region src/legacy-v9/static/associate-rentals-with-facilities-by-object-groups.ts
590
631
  const operation = "v9.rentals.facility-object-group-relation";
591
632
  const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
@@ -666,4 +707,4 @@ const associateRentalsWithFacilitiesByObjectGroups = ({ attributeId, facilities,
666
707
  //#region src/legacy-v9/runtime/rentals.ts
667
708
  const defaultRentalDataAttributes = Object.keys(VofficeUnitDataFieldSchemas);
668
709
  //#endregion
669
- export { associateRentalsWithFacilitiesByObjectGroups, defaultRentalDataAttributes, facilityTextsQuery, hubFiltersQuery, parseVofficeFacilityData, parseVofficeUnitData, rentalFacilitiesForObjectGroupRelationQuery, rentalIdsQuery, rentalTextsQuery, rentalsAllByFacilityObjectGroupsWithoutFeedbacksQuery, rentalsAllFeedbacksQuery, rentalsAllWithoutFeedbacksQuery, toRentalRentalsOutput };
710
+ export { associateRentalsWithFacilitiesByObjectGroups, defaultRentalDataAttributes, facilityTextsQuery, hubFiltersQuery, parseVofficeFacilityData, parseVofficeUnitData, rentalFacilitiesForObjectGroupRelationQuery, rentalIdsQuery, rentalTextsQuery, rentalsAllByFacilityObjectGroupsWithoutFeedbacksQuery, rentalsAllFeedbacksQuery, rentalsAllWithoutFeedbacksQuery, toRentalOffers, toRentalRentalsOutput };
@@ -1,6 +1,6 @@
1
- import { a as makeV9CustomAttributeFilterCapabilities, c as parseQueryParameters, d as toVoucherCode, l as toQueryString, o as toBasicQueryInputs, s as collectQueryParameters, u as applyVofficeFilterDerivedBasicQueryInputs } from "./client-BlQ5phsZ.mjs";
2
- import { n as mapSearchQuery, r as searchQuery, w as parseVofficeUnitData } from "./operations-Db2hRCLQ.mjs";
3
- import { a as toLocation, c as CAPACITY_DATA_ATTRIBUTES, i as toV9RentalHighlightKey, l as toCapacity, s as toImages, t as toRentalHighlights, u as toAddress } from "./to-rental-highlights-BFLLKF6M.mjs";
1
+ import { a as makeV9CustomAttributeFilterCapabilities, c as parseQueryParameters, d as toVoucherCode, l as toQueryString, o as toBasicQueryInputs, s as collectQueryParameters, u as applyVofficeFilterDerivedBasicQueryInputs } from "./client-BEL6ow0i.mjs";
2
+ import { T as parseVofficeUnitData, n as mapSearchQuery, r as searchQuery } from "./operations-DY2e_2Hd.mjs";
3
+ import { a as toLocation, c as CAPACITY_DATA_ATTRIBUTES, i as toV9RentalHighlightKey, l as toCapacity, s as toImages, t as toRentalHighlights, u as toAddress } from "./to-rental-highlights-DptWc7-q.mjs";
4
4
  import { CoreSDKError, STABLE_SEARCH_INPUTS, daysBetweenLocalDates, expandCustomAttributeFilterCompositions, parseChildrenAges, parseOccupancyCount, resolveExpandedCompositions, toFormattedSearchPrice, toIsoDateFromPeriodQueryDate, toStableSearchInputBackendQueryKeys, toStableSearchInputParameterValues, toStableSearchInputQueryKeys, toUnusedFilterKeys } from "@v-office/sdk-core";
5
5
  import { Effect } from "effect";
6
6
  //#region src/legacy-v9/parser/search/input/search-input-error.ts
@@ -1,4 +1,4 @@
1
- import { v as VofficeUnitDataPropertyMetadata } from "./operations-Db2hRCLQ.mjs";
1
+ import { v as VofficeUnitDataPropertyMetadata } from "./operations-DY2e_2Hd.mjs";
2
2
  import { localeToLanguage, makeTranslate, renderLabeledAttributeValue, renderResolvedCustomAttribute, toCountLabelKey, toCountry, toCustomAttributeFact, toFact, toLocalizedText, toRentalCapacity } from "@v-office/sdk-core";
3
3
  import { Effect } from "effect";
4
4
  //#region src/legacy-v9/parser/rentals/to-localized-string.ts