@v-office/website-sdk 2.37.1 → 3.0.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/dist/cli.mjs +3 -3
  2. package/dist/{client-D53W9Uas.mjs → client-k4Gjwp60.mjs} +735 -235
  3. package/dist/index.d.mts +97 -4
  4. package/dist/index.mjs +1 -1
  5. package/dist/instructions/CHANGELOG.md +2 -0
  6. package/dist/instructions/MIGRATION.md +2 -0
  7. package/dist/instructions/booking.md +1 -1
  8. package/dist/instructions/quote.md +23 -19
  9. package/dist/instructions/rentals.md +65 -4
  10. package/dist/instructions/search.md +2 -1
  11. package/dist/instructions/versions/2.38.0/CHANGELOG.md +123 -0
  12. package/dist/instructions/versions/2.38.0/MIGRATION.md +37 -0
  13. package/dist/instructions/versions/3.0.0/CHANGELOG.md +62 -0
  14. package/dist/instructions/versions/3.0.0/MIGRATION.md +69 -0
  15. package/dist/{operations-C1VMQYN2.mjs → operations-DMqLD3e2.mjs} +333 -1
  16. package/dist/{rentals-BxkYXAVn.mjs → rentals-BIL52z4o.mjs} +10 -14
  17. package/dist/{search-pFLiI6QI.mjs → search-Buua-PAS.mjs} +8 -4
  18. package/dist/{to-rental-highlights-BdxQPpBU.mjs → to-rental-highlights-BE6TdXYa.mjs} +23 -5
  19. package/dist/translations/shared/de-DE/insurance.json +1 -0
  20. package/dist/translations/shared/de-DE/reviews.json +5 -4
  21. package/dist/translations/shared/en-US/insurance.json +1 -0
  22. package/dist/translations/shared/en-US/reviews.json +5 -4
  23. package/dist/translations/v10/de-DE/core.json +17 -4
  24. package/dist/translations/v10/en-US/core.json +53 -40
  25. package/dist/translations/v9/de-DE/core.json +7 -7
  26. package/dist/translations/v9/de-DE/filter.json +4 -0
  27. package/dist/translations/v9/de-DE/rental-attributes.json +2 -2
  28. package/dist/translations/v9/en-US/core.json +7 -7
  29. package/dist/translations/v9/en-US/filter.json +4 -0
  30. package/dist/translations/v9/en-US/rental-attributes.json +2 -2
  31. package/instructions/CHANGELOG.md +2 -0
  32. package/instructions/MIGRATION.md +2 -0
  33. package/instructions/booking.md +1 -1
  34. package/instructions/quote.md +23 -19
  35. package/instructions/rentals.md +65 -4
  36. package/instructions/search.md +2 -1
  37. package/instructions/versions/2.38.0/CHANGELOG.md +123 -0
  38. package/instructions/versions/2.38.0/MIGRATION.md +37 -0
  39. package/instructions/versions/2.38.0/release.json +3 -0
  40. package/instructions/versions/3.0.0/CHANGELOG.md +62 -0
  41. package/instructions/versions/3.0.0/MIGRATION.md +69 -0
  42. package/instructions/versions/3.0.0/release.json +3 -0
  43. package/package.json +5 -4
@@ -56,6 +56,12 @@ Sample item:
56
56
  "headline": "Holiday apartment near the sea",
57
57
  "description": "Short localized rental description."
58
58
  },
59
+ "capacity": {
60
+ "maxGuests": 4,
61
+ "bedrooms": 2,
62
+ "bathrooms": 1,
63
+ "livingAreaSqm": 61
64
+ },
59
65
  "highlights": ["2 bedrooms", "Wi-Fi", "Parking"],
60
66
  "attributes": [
61
67
  {
@@ -72,7 +78,7 @@ Sample item:
72
78
  "items": [
73
79
  {
74
80
  "id": "form-response-1",
75
- "author": "Ada Lovelace, visited in July 2026",
81
+ "author": "Ada Lovelace, stayed in July 2026",
76
82
  "rating": "5",
77
83
  "createdAt": "2026-07-10T10:00:00.000Z",
78
84
  "text": "Great stay."
@@ -81,7 +87,7 @@ Sample item:
81
87
  "summary": {
82
88
  "rating": "4.8",
83
89
  "count": "12",
84
- "classification": "Excellent"
90
+ "classification": "Exceptional"
85
91
  }
86
92
  }
87
93
  }
@@ -89,6 +95,50 @@ Sample item:
89
95
 
90
96
  Optional fields include `scope`, `address`, `property`, `rooms`, `roomSummary`, `vicinity`, and `reviews`.
91
97
 
98
+ ### Texts in another language
99
+
100
+ When a rental or its property has no text in the requested locale, the SDK returns the German
101
+ text and lists the field in `descriptionFallbacks` (on the rental and on `property`), so a site
102
+ can mark it as German (`lang="de"`, a note):
103
+
104
+ ```json
105
+ {
106
+ "description": {
107
+ "headline": "Flat with sea view",
108
+ "description": "Ruhige Wohnung am Deich."
109
+ },
110
+ "descriptionFallbacks": { "description": "de-DE" }
111
+ }
112
+ ```
113
+
114
+ Only fields served in another language are listed; `descriptionFallbacks` is omitted when every
115
+ text is in the requested locale, and always for `de-DE`.
116
+
117
+ - v10 reads every language of a text and takes the German one when the requested one is empty.
118
+ - v9: the be-on! Hub already answers a missing translation with the German text, without saying
119
+ so. For a locale other than `de-DE`, `getRentals` and `getRentalsByIds` also ask the Hub for
120
+ the German texts and mark every field whose text is the same. This is one extra Hub query, of the texts alone, per
121
+ 128 rentals (and one facility query with `facilityObjectGroupRelationAttributeId`), only for
122
+ non-German locales.
123
+
124
+ Rental names, region names and attribute texts are not covered.
125
+
126
+ ### Capacity
127
+
128
+ `capacity` states the counts as numbers: `maxGuests`, `maxAdults`, `bedrooms`, `bathrooms`,
129
+ `rooms` and `livingAreaSqm`. Read counts from here, not from the text of `highlights` or
130
+ `roomSummary`: the numbers do not change with the locale or with `translationOverrides`. A
131
+ count the backend does not state, or states as 0, is omitted, never 0.
132
+
133
+ | Field | v10 | v9 |
134
+ | -------------------------------- | ----------------------------------------------------- | ------------------------------------- |
135
+ | `maxGuests` | room summary `maxPersons` (bed capacity) | unit `beds` (sleeping places) |
136
+ | `maxAdults` | room summary `maxAdults` (beds not for children only) | never stated |
137
+ | `bedrooms`, `bathrooms`, `rooms` | room summary | unit `bedrooms`, `bathrooms`, `rooms` |
138
+ | `livingAreaSqm` | `attributes.squareMeters` | unit `squareMeters` |
139
+
140
+ Search items carry the same `capacity`.
141
+
92
142
  ### Legacy v9 Images
93
143
 
94
144
  v9 rental `images` and facility `property.images` come from vOffice's image service
@@ -144,7 +194,8 @@ From 2.18.0, v9 static rentals populate additional fields on the existing
144
194
  `HOUSE_FAC` and `FLAT_FAC` normalize to `HOLIDAY_HOME_COMPLEX` and
145
195
  `APARTMENT_COMPLEX`. The normalized value is localized through
146
196
  `Property.propertyType.option.*`; for example, `HOLIDAY_HOME_COMPLEX` is
147
- returned as `Ferienpark` for `de-DE`. Unknown types and malformed optional data
197
+ returned as `Ferienhausanlage` for `de-DE`. From 2.38.0 v10 localizes
198
+ `property.propertyType` the same way instead of returning the enum. Unknown types and malformed optional data
148
199
  are omitted. This fills the existing property schema and does not add public
149
200
  fields.
150
201
 
@@ -355,7 +406,17 @@ type RentalReview =
355
406
 
356
407
  For v10, public answers with the same form-response ID are combined into one review item. Its `rating` is the average of the valid `STARS` answers in that response, and its `text` contains the non-empty `TEXT` answers. Missing public customer data leaves `author` undefined.
357
408
 
358
- `createdAt` is the form response's creation timestamp, not a travel date. A text-only rental can have `reviews.items` without `reviews.summary`, so check the summary independently. The localized `summary.count` describes form responses with valid ratings and does not necessarily equal `items.length`.
409
+ `createdAt` is the form response's creation timestamp, not a travel date. A text-only rental can have `reviews.items` without `reviews.summary`, so check the summary independently. The localized `summary.count` describes form responses with valid ratings and does not necessarily equal `items.length`. It reads `reviews.summary.count.one` for one rating and `reviews.summary.count` otherwise.
410
+
411
+ `summary.classification` is the rating band, translated as `reviews.summary.classification.<band>`, on both backends:
412
+
413
+ | Average | Band | de-DE | en-US |
414
+ | ------- | ----------- | ------------ | ----------- |
415
+ | ≥ 4.5 | `excellent` | Hervorragend | Exceptional |
416
+ | ≥ 4.0 | `very-good` | Sehr gut | Very good |
417
+ | ≥ 3.0 | `good` | Gut | Good |
418
+ | ≥ 2.0 | `fair` | Ordentlich | Decent |
419
+ | < 2.0 | `poor` | Ausreichend | Adequate |
359
420
 
360
421
  ### Legacy v9 Reviews
361
422
 
@@ -710,7 +710,8 @@ Sample:
710
710
  ```
711
711
 
712
712
  Search items share the rental base fields and may include `scope`, `address`,
713
- `property`, `highlights`, and `formattedTotal`. A priced item or alternative period
713
+ `capacity` (counts as numbers, see the rentals instructions), `property`, `highlights`,
714
+ and `formattedTotal`. A priced item or alternative period
714
715
  may also include `discount`. When it does, `formattedTotal` is the final price and
715
716
  `discount.formattedOriginalTotal` is the price before the applied discounts.
716
717
  Discount totals, labels, and amounts are already localized and formatted for the
@@ -0,0 +1,123 @@
1
+ # Changelog: 2.38.0
2
+
3
+ Rentals and search items state their counts as numbers, the same on v9 and v10, so a website
4
+ no longer parses them out of translated text that changes with the locale. The SDK's own texts
5
+ read correctly in English and German: counts in their plural form, rating words with one meaning
6
+ per band in both languages, a natural reviewer line, labels instead of key names, a
7
+ translated v10 property type and a translated v10 "no insurance" option. Texts missing in the
8
+ requested language come back in German and are marked as German, on both backends.
9
+
10
+ ## Added
11
+
12
+ - `capacity` on rentals (`getRentals`, `getRentalsByIds`) and on search items, on v9 and v10:
13
+
14
+ ```ts
15
+ capacity?: {
16
+ maxGuests?: number;
17
+ maxAdults?: number;
18
+ bedrooms?: number;
19
+ bathrooms?: number;
20
+ rooms?: number;
21
+ livingAreaSqm?: number;
22
+ };
23
+ ```
24
+
25
+ The values do not depend on the locale or on `translationOverrides`. A count the backend
26
+ does not state, or states as 0, is omitted, never 0; `capacity` itself is omitted when no
27
+ count is stated.
28
+ - v10: from the room summary (`maxPersons` as `maxGuests`, `maxAdults`, `bedrooms`,
29
+ `bathrooms`, `rooms`) and `attributes.squareMeters`.
30
+ - v9: from the unit's `beds` (sleeping places, as `maxGuests`), `bedrooms`, `bathrooms`,
31
+ `rooms` and `squareMeters`. v9 states no adults, so `maxAdults` is always omitted. A v9
32
+ search now also requests these five attributes.
33
+
34
+ - The type `RentalCapacity`.
35
+ - `descriptionFallbacks` on rentals and their `property` (`getRentals`, `getRentalsByIds`):
36
+ the description fields served in another language than requested, with that language
37
+ (`{ "description": "de-DE" }`), so a site can mark German texts on an English page. Omitted
38
+ when every text is in the requested locale, and always for `de-DE`.
39
+
40
+ ## Changed
41
+
42
+ - v10: a description field without a text in the requested locale takes its German text and
43
+ is listed in `descriptionFallbacks`. Before, the field was omitted, so an English rental
44
+ without English texts had no description at all.
45
+ - v9: for a locale other than `de-DE`, `getRentals` and `getRentalsByIds` also ask the be-on!
46
+ Hub for the German texts (one extra query per 128 rentals that selects only the texts, plus one facility query with
47
+ `facilityObjectGroupRelationAttributeId`) and mark the fields the Hub served in German. The
48
+ texts themselves are unchanged: the Hub already served German.
49
+ - Counts render in the plural form of their number, on both backends: "1 guest", "2 bedrooms",
50
+ "1 Gast", "4 Gäste" in `highlights` and v10 `roomSummary`, and "1 bedroom", "2 bedrooms" in
51
+ the v9 bedroom and bathroom filter options. The guest count reads as guests on both backends
52
+ (it was "Maximale Personenzahl" on v10 and "Schlafmöglichkeiten" on v9).
53
+ - The rating words (`reviews.summary.classification`) carry one meaning per band in both
54
+ languages, and both German and English change: a 4.9 rating reads "Hervorragend" /
55
+ "Exceptional". The bands themselves are unchanged (≥ 4.5, ≥ 4.0, ≥ 3.0, ≥ 2.0, below).
56
+ - The English reviewer line reads "Ada, stayed in July 2026" (was "visited on").
57
+ - One rating reads "1 review" / "1 Bewertung" (was "1 reviews" / "1 Bewertungen").
58
+ - v10 `property.propertyType` is translated ("Apartment complex", "Apartmentanlage") as on v9,
59
+ instead of the enum (`APARTMENT_COMPLEX`). Both backends read the labels from one table now:
60
+ v9 kept its own copy, which said "Appartement Komplex" and "Ferienpark".
61
+ - English attribute labels and options that showed their key name now have texts, and all
62
+ English view labels share one spelling ("Sea view", "Mountain view", "Beach view").
63
+ - `valleyViewType` has its own label ("Valley view type", "Art des Talblicks") instead of the
64
+ valley view label.
65
+ - v10 quotes: the `none` insurance option reads "Keine Versicherung" for de-DE and "No
66
+ insurance" for en-US, from the new key `insurance.notOffered.label`, in `quote`,
67
+ `selectInsurance`, `createInsurancePreContract` and `selectInsurancePayment`. It was the
68
+ English "No insurance" in every locale. A v9 quote without an insurance provider reads the
69
+ same key (its text was already localized). With offers, the `none` option stays "Ich
70
+ verzichte auf den angebotenen Reiseschutz" (`insurance.none.label`) on v9, and will on v10.
71
+ - Every changed or new text. A site that overrides one of these keys with `translationOverrides`
72
+ keeps its override; check whether you still need it:
73
+
74
+ | Key | Locale | Before | Now |
75
+ | ---------------------------------------------------------------------------------------------------------------------------- | ------------- | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
76
+ | `RoomSummary.<field>.count.one` / `.other` (new; `maxPersons`, `maxAdults`, `bedrooms`, `bathrooms`, `rooms`, `livingrooms`) | de-DE | — | Gast / Gäste, Erwachsener / Erwachsene, Schlafzimmer, Badezimmer, Zimmer, Wohnzimmer |
77
+ | same | en-US | — | guest / guests, adult / adults, bedroom / bedrooms, bathroom / bathrooms, room / rooms, living room / living rooms |
78
+ | `RentalAttributes.beds.count.one` / `.other` (v9) | de-DE | Schlafmöglichkeit / Schlafmöglichkeiten | Gast / Gäste |
79
+ | same | en-US | sleeping arrangement / sleeping arrangements | guest / guests |
80
+ | `filter.bedrooms.count.one` / `.other`, `filter.bathrooms.count.one` / `.other` (v9, new) | de-DE | — | Schlafzimmer, Badezimmer |
81
+ | same | en-US | — | bedroom / bedrooms, bathroom / bathrooms |
82
+ | `insurance.notOffered.label` (new) | de-DE / en-US | — (hard-coded "No insurance" on v10 in every locale) | Keine Versicherung / No insurance |
83
+ | `reviews.summary.classification.excellent` | de-DE | Sehr gut | Hervorragend |
84
+ | `reviews.summary.classification.very-good` | de-DE | Gut | Sehr gut |
85
+ | `reviews.summary.classification.good` | de-DE | Ansprechend | Gut |
86
+ | `reviews.summary.classification.fair` | de-DE | Mittelmäßig | Ordentlich |
87
+ | `reviews.summary.classification.poor` | de-DE | Ausreichend | Ausreichend (unchanged) |
88
+ | `reviews.summary.classification.excellent` | en-US | Excellent | Exceptional |
89
+ | `reviews.summary.classification.fair` | en-US | Fair | Decent |
90
+ | `reviews.summary.classification.poor` | en-US | Poor | Adequate |
91
+ | `reviews.summary.count.one` (new) | de-DE / en-US | — | {count} Bewertung / {count} review |
92
+ | `reviews.item.authorWithDate` | en-US | {author}, visited on {date} | {author}, stayed in {date} |
93
+ | `Property.propertyType.option.APARTMENT_COMPLEX` | de-DE | Appartement Komplex | Apartmentanlage (v9 and v10) |
94
+ | `Property.propertyType.option.HOLIDAY_HOME_COMPLEX` | de-DE | Ferienpark (v9 only) | Ferienhausanlage (v9 and v10) |
95
+ | `Property.propertyType.option.HOLIDAY_HOME_COMPLEX` | en-US | Holiday Home Complex | Holiday home complex (v9 and v10) |
96
+ | `RentalAttributes.valleyViewType.label` (new) | de-DE / en-US | — (used the valley view label) | Art des Talblicks / Valley view type |
97
+ | `RentalAttributes.lakeviewType.option.EXCEPTIONALLY_GOOD` | de-DE | außergewöhnlich gut | Außergewöhnlich gut |
98
+ | `RentalAttributes.seaviewType.option.EXCEPTIONALLY_GOOD` | de-DE | außergewöhnlich gut | Außergewöhnlich gut |
99
+ | `RentalAttributes.seaviewType.option.LIMITED` | de-DE | eingeschränkt | Eingeschränkt |
100
+ | `RentalAttributes.beachview.label` | en-US | Beachview | Beach view |
101
+ | `RentalAttributes.cityView.label` | en-US | City View | City view |
102
+ | `RentalAttributes.countrysideView.label` | en-US | Countryside View | Countryside view |
103
+ | `RentalAttributes.countrysideViewType.label` | en-US | Countryside View Type | Countryside view type |
104
+ | `RentalAttributes.gardenView.label` | en-US | Garden View | Garden view |
105
+ | `RentalAttributes.innerCourtView.label` | en-US | Inner Court View | Courtyard view |
106
+ | `RentalAttributes.mountainview.label` | en-US | Mountainview | Mountain view |
107
+ | `RentalAttributes.mountainviewType.label` | en-US | Mountainview Type | Mountain view type |
108
+ | `RentalAttributes.poolView.label` | en-US | Pool View | Pool view |
109
+ | `RentalAttributes.quietStreetView.label` | en-US | Quiet Street View | Quiet street view |
110
+ | `RentalAttributes.riverView.label` | en-US | River View | River view |
111
+ | `RentalAttributes.valleyView.label` | en-US | valleyView | Valley view |
112
+ | `RentalAttributes.lakeviewType.label` | en-US | lakeviewType | Lake view type |
113
+ | `RentalAttributes.seaviewType.label` | en-US | seaviewType | Sea view type |
114
+ | `RentalAttributes.lakeviewType.option.*`, `seaviewType.option.*` | en-US | the key | Exceptionally good, Good, Limited |
115
+ | `RentalAttributes.heatingSystem.option.*` | en-US | the key | Central heating, Electric, Gas bottle, Gas tank, Oil, Stove (`OVEN`), Solar, Air conditioning (`VIA_AC`) |
116
+ | `RentalAttributes.stoveType.option.*` | en-US | the key | Ceramic hob, Gas, Induction, 3-burner stove, 4-burner stove |
117
+ | `RentalAttributes.kitchenType.option.CLOSED` | en-US | the key | Closed |
118
+ | `RentalAttributes.dryerAccess.option.EXKLUSIVE`, `washerAccess.option.EXKLUSIVE` | en-US | the key | Exclusive use |
119
+ | `RentalAttributes.relaxationRoom.label` | en-US | relaxationRoom | Relaxation room |
120
+ | `RentalAttributes.saunaIsPrivate.label` | en-US | saunaIsPrivate | Private sauna |
121
+ | `RentalAttributes.fitnessroom.label` | en-US | fitnessroom | Fitness room |
122
+
123
+ - `highlights` and `roomSummary` still hold text; read counts from `capacity`.
@@ -0,0 +1,37 @@
1
+ # Migration: 2.37.1 to 2.38.0
2
+
3
+ No changes required.
4
+
5
+ ## 1. Upgrade
6
+
7
+ ```sh
8
+ pnpm add @v-office/website-sdk@2.38.0
9
+ ```
10
+
11
+ ## 2. Optional: read counts from `capacity`
12
+
13
+ A site that reads guests, bedrooms, bathrooms, rooms or the living area out of `highlights` or
14
+ `roomSummary` ("4 Maximale Personenzahl", "88 m²") can read `rental.capacity` and
15
+ `item.capacity` instead. Treat a missing field as "not stated" and print nothing for it.
16
+ `@v-office/website-headless` 1.4.0 reads `capacity` for its counts.
17
+
18
+ ## 3. Check texts you parse, compare or override
19
+
20
+ - A site that reads counts out of `highlights` or `roomSummary` by their wording breaks: the
21
+ guest count now reads "4 Gäste" / "4 guests". Read `capacity` instead, or upgrade
22
+ `@v-office/website-headless` to 1.4.0 in the same commit (it reads both).
23
+ - A site that compares v10 `property.propertyType` with `APARTMENT_COMPLEX` or another enum
24
+ value breaks: the field now holds the translated label, as on v9.
25
+ - German rental pages show the new rating words: a rating that read "Sehr gut" now reads
26
+ "Hervorragend", "Gut" reads "Sehr gut", and so on. A site that wants the old words sets them
27
+ with `translationOverrides` (`reviews.summary.classification.<band>`).
28
+ - An override of `RoomSummary.<field>.label` (v10) or `RentalAttributes.beds.label` (v9) no
29
+ longer changes a count line; override the `.count.one` and `.count.other` keys in the
30
+ CHANGELOG instead.
31
+
32
+ ## 4. English pages show German texts where no English exists
33
+
34
+ v10 rentals without an English text now return the German text (before: no text), and both
35
+ backends list such fields in `descriptionFallbacks`. A site that hides a section without an
36
+ English text can check `descriptionFallbacks` instead and decide per field: show the German text
37
+ marked as German (`lang="de"`), or hide it.
@@ -0,0 +1,3 @@
1
+ {
2
+ "componentsAffectedByHeadlessChange": []
3
+ }
@@ -0,0 +1,62 @@
1
+ # Changelog: 3.0.0
2
+
3
+ This release reworks ERGO travel cancellation insurance on v9. The pre-contract is now created
4
+ after the stay booking and takes the policy holder from that booking, travelers are written to the
5
+ vOffice booking, and issued policies can be read and revoked. v10 does not change, and URV
6
+ insurance is booked as before; only the `createInsurancePreContract` call changes on every v9 site.
7
+
8
+ ## Added
9
+
10
+ - `live.insurance.readPolicy({ policyNumber })` returns an ERGO policy: `status` (`active` or
11
+ `revoked`), `revokedAt`, `documentUrl`, `label`, `travelPeriod` and `insuredPersons`.
12
+ - `live.insurance.revokePolicy({ policyNumber, booking })` revokes an ERGO policy. When ERGO
13
+ refuses, the call rejects with ERGO's reason and nothing is removed from the booking. There is
14
+ no revocation deadline in the SDK; ERGO decides.
15
+ - Both methods reject on v9 accounts that do not use ERGO insurance.
16
+ - `V9QuoteCreateInsurancePreContractInput`, `V9InsuranceReadPolicyInput`,
17
+ `V9InsuranceRevokePolicyInput` and `V9InsurancePolicy` are exported.
18
+
19
+ ## Changed
20
+
21
+ - **Breaking (v9):** `live.quote.createInsurancePreContract` takes `{ quote, booking }`, where
22
+ `booking` is the result of `live.booking.book`. The `customerInformation` input is gone. The
23
+ policy holder, address, email and mobile number come from the booking's customer. The destination
24
+ country is always Germany.
25
+ - `createInsurancePreContract` writes the selected travelers to the vOffice booking when the
26
+ booking has no guests yet. A failure there does not stop the insurance.
27
+ - Calling `createInsurancePreContract` again for the same booking and plan returns the existing
28
+ pre-contract with its documents instead of creating a second one. `bookInsurance` returns the
29
+ policy number of an insurance that is already booked instead of booking twice. A stored policy
30
+ only counts when ERGO still reports it as active; a revoked one is ignored, and when ERGO cannot
31
+ be asked the call rejects instead of booking blindly. A booking that already has an active policy for another plan rejects a plan change
32
+ (in `createInsurancePreContract` and `bookInsurance`); revoke that policy first.
33
+ - `createInsurancePreContract` returns all of ERGO's pre-contract documents (product information
34
+ sheet, insurance terms, data processing notice, e-commerce customer information) in
35
+ `preContract.documents`, with labels in the quote's locale. It rejects when ERGO's documents
36
+ cannot be read, because they are the § 7 VVG information the guest has to see.
37
+ - The booked policy document of `bookInsurance` and the SEPA debit option of the quote carry labels
38
+ in the quote's locale (they used to be English).
39
+ - `readPolicy` and `revokePolicy` list the insured travelers of ERGO's answer; a revoke answer
40
+ without travelers returns an empty list.
41
+ - The pre-contract needs the booking customer's birthdate and mobile number, and a customer
42
+ country that ERGO covers (DE, AT, BE, DK, FR, IT, LU, NL, PL, CZ). Otherwise the call rejects with
43
+ a message that names what is missing.
44
+ - `selectInsurance` rejects ERGO selections in which a traveler has no `birthday`.
45
+ - ERGO plans: one card per product, the one without excess preferred; when that leaves a single
46
+ card, the variant with excess is offered as a second card. Cards are ordered without excess
47
+ first, then by premium.
48
+ - More than nine travelers get no ERGO plans, only the no-insurance option.
49
+ - When the Hub settings or the plan search of ERGO or URV fail, the quote reports insurance as not
50
+ offered instead of failing.
51
+ - ERGO refusals now reject with ERGO's own error text.
52
+ - If saving the booked policy in the Hub fails after ERGO accepted the booking,
53
+ `bookInsurance` still returns `booked` with the policy number.
54
+ - Salutations are sent to ERGO as `H` (Herr, Mr., Mr) or `D` (Frau, Mrs., Ms.), and as empty for
55
+ everything else, such as Divers or Keine Angabe. They used to be sent as `F` or as raw text.
56
+
57
+ ## Fixed
58
+
59
+ - A v9 booking with a selected ERGO plan lists the SEPA debit option in
60
+ `insurancePaymentOptions` before the pre-contract exists; it used to omit it.
61
+
62
+ - ERGO policy holders were taken from the first traveler instead of the booking customer.
@@ -0,0 +1,69 @@
1
+ # Migration: 2.38.0 to 3.0.0
2
+
3
+ Every v9 caller of `createInsurancePreContract` has to update the call, because it now takes
4
+ `{ quote, booking }` (see section 2). On accounts that use URV insurance you can drop the call
5
+ instead: it always returns `not_required` there. Only the URV booking behavior stays the same: URV
6
+ is booked inside `live.booking.book`, and `bookInsurance` resolves as not required. v10 does not
7
+ change.
8
+
9
+ ## 1. Upgrade
10
+
11
+ ```sh
12
+ pnpm add @v-office/website-sdk@3.0.0
13
+ ```
14
+
15
+ ## 2. Book the stay first on v9 with ERGO
16
+
17
+ The pre-contract needs the booking, so `live.booking.book` now comes before it. Replace
18
+
19
+ ```ts
20
+ quote = await sdk.live.quote.createInsurancePreContract({ quote, customerInformation });
21
+ const booking = await sdk.live.booking.book({ quote, contact, relativeRedirectUrl });
22
+ ```
23
+
24
+ with
25
+
26
+ ```ts
27
+ const booking = await sdk.live.booking.book({ quote, contact, relativeRedirectUrl });
28
+ quote = await sdk.live.quote.createInsurancePreContract({ quote, booking });
29
+ quote = await sdk.live.quote.selectInsurancePayment({ quote, paymentInformation });
30
+ const insurance = await sdk.live.quote.bookInsurance({ quote, booking });
31
+ ```
32
+
33
+ The booking result already lists the SEPA debit option in `booking.insurancePaymentOptions` when an
34
+ ERGO plan is selected, so offer it from there.
35
+
36
+ Pass the live `booking` object that `book` returned; do not serialize it. Show the pre-contract
37
+ documents (`quote.insurance.preContract.documents`) to the guest before `bookInsurance`.
38
+
39
+ `createInsurancePreContract` no longer asks for `customerInformation`. The booking's customer is
40
+ the policy holder, so the booking form has to collect what ERGO needs:
41
+
42
+ - `contact.birthdate` and a phone number in `contact.contactDetails.phone`, which is sent as the
43
+ mobile number. Without them the call rejects.
44
+ - A country in `contact.address.countryCode` that ERGO covers: DE, AT, BE, DK, FR, IT, LU, NL, PL
45
+ or CZ.
46
+
47
+ Every traveler in `selectInsurance` needs a `birthday`. Offer ERGO only for up to nine travelers;
48
+ with more, the quote contains only the no-insurance option.
49
+
50
+ If the guest returns after a failed attempt, call `createInsurancePreContract` again. It reuses the
51
+ existing pre-contract instead of creating another one.
52
+
53
+ ## 3. Read and revoke policies
54
+
55
+ ```ts
56
+ const policy = await sdk.live.insurance.readPolicy({ policyNumber });
57
+ const revoked = await sdk.live.insurance.revokePolicy({ policyNumber, booking });
58
+ ```
59
+
60
+ `revokePolicy` rejects with ERGO's reason when ERGO refuses, for example after the revocation
61
+ period. Both methods reject on accounts that do not use ERGO insurance, so call them only after
62
+ `bookInsurance` returned `booked`.
63
+
64
+ ## What stays the same
65
+
66
+ - v10: nothing changes.
67
+ - v9 with URV insurance: booking behavior does not change; only the `createInsurancePreContract`
68
+ call has to change or go.
69
+ - `selectInsurance`, `selectInsurancePayment` and `bookInsurance` keep their inputs and outputs.
@@ -0,0 +1,3 @@
1
+ {
2
+ "componentsAffectedByHeadlessChange": ["quote", "booking"]
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v-office/website-sdk",
3
- "version": "2.37.1",
3
+ "version": "3.0.0",
4
4
  "description": "Website-facing SDK facade backed by @v-office/sdk-core",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@graphql-typed-document-node/core": "3.2.0",
51
- "@v-office/sdk-core": "1.28.1",
51
+ "@v-office/sdk-core": "1.29.0",
52
52
  "effect": "4.0.0-rc.115",
53
53
  "graphql": "17.0.2",
54
54
  "yaml": "^2.9.0"
@@ -87,15 +87,16 @@
87
87
  "fmt": "oxfmt",
88
88
  "fmt:check": "oxfmt --check",
89
89
  "check": "pnpm run typecheck && pnpm run lint && pnpm run fmt:check",
90
- "test": "pnpm run test:cli && pnpm run test:v9:openapi && pnpm run test:v9:properties && pnpm run test:v9:rentals && pnpm run test:v9:graphql && pnpm run test:v9:availability && pnpm run test:v9:search && pnpm run test:v9:booking && pnpm run test:v9:videos && pnpm run build && node --test test/*.test.mjs",
90
+ "test": "pnpm run test:cli && pnpm run test:v9:openapi && pnpm run test:v9:properties && pnpm run test:v9:rentals && pnpm run test:v9:graphql && pnpm run test:v9:availability && pnpm run test:v9:search && pnpm run test:v9:booking && pnpm run test:v9:insurance && pnpm run test:v9:videos && pnpm run build && node --test test/*.test.mjs",
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
- "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",
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
94
  "test:v9:rentals": "node --test 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",
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",
98
98
  "test:v9:booking": "node --test src/legacy-v9/parser/booking/output/to-payment-schedules.test.ts",
99
+ "test:v9:insurance": "node --test src/legacy-v9/live/quote-insurance.test.ts",
99
100
  "test:v9:videos": "node --test src/legacy-v9/parser/videos/to-videos.test.ts",
100
101
  "playground:custom-attributes": "pnpm run build && node --env-file=.env playground/custom-attributes.ts"
101
102
  }