@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.
@@ -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.
@@ -0,0 +1,3 @@
1
+ {
2
+ "componentsAffectedByHeadlessChange": []
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v-office/website-sdk",
3
- "version": "3.3.0",
3
+ "version": "3.4.0",
4
4
  "description": "Website-facing SDK facade backed by @v-office/sdk-core",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -91,7 +91,7 @@
91
91
  "test:cli": "node --test src/cli/v9-hub-filters.test.ts",
92
92
  "test:v9:openapi": "node --test codegen/v9/php-record.test.ts src/legacy-v9/openapi/setup-response.test.ts src/legacy-v9/openapi/quote-response.test.ts",
93
93
  "test:v9:properties": "node --test codegen/v9/heuristic-generation/generate/property.test.ts src/legacy-v9/property-highlight-sources.test.ts src/legacy-v9/parser/rentals/render-property-attribute.test.ts src/legacy-v9/parser/rentals/to-property.test.ts src/legacy-v9/parser/rentals/to-rooms.test.ts src/legacy-v9/parser/rentals/to-capacity.test.ts",
94
- "test:v9:rentals": "node --test src/legacy-v9/static/description-fallbacks.test.ts src/legacy-v9/static/associate-rentals-with-facilities-by-object-groups.test.ts src/legacy-v9/parser/rentals/to-reviews.test.ts src/legacy-v9/parser/rentals/to-image.test.ts src/legacy-v9/parser/rentals/to-links.test.ts",
94
+ "test:v9:rentals": "node --test src/legacy-v9/static/description-fallbacks.test.ts src/legacy-v9/static/associate-rentals-with-facilities-by-object-groups.test.ts src/legacy-v9/parser/rentals/to-reviews.test.ts src/legacy-v9/parser/rentals/to-image.test.ts src/legacy-v9/parser/rentals/to-links.test.ts src/legacy-v9/parser/rentals/to-rental-offers.test.ts",
95
95
  "test:v9:graphql": "node --test src/legacy-v9/graphql/client.test.ts",
96
96
  "test:v9:availability": "node --test src/legacy-v9/parser/availability/to-availability-restrictions-by-date.test.ts src/legacy-v9/parser/availability/to-initial-availability-calendar-days.test.ts src/legacy-v9/parser/availability/to-occupancy-limits.test.ts src/legacy-v9/parser/availability/to-rent-night-prices.test.ts src/legacy-v9/parser/availability/to-start-date-selected-calendar-days.test.ts src/legacy-v9/parser/blocked-ranges/collect-v9-blocked-ranges.test.ts src/legacy-v9/parser/blocked-ranges/to-rental-blocked-ranges.test.ts",
97
97
  "test:v9:search": "node --test src/legacy-v9/parser/search/resolve-exact-match.test.ts src/legacy-v9/rental-scope.test.ts",