@v-office/website-sdk 2.38.0 → 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.
@@ -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.38.0",
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": {
@@ -87,7 +87,7 @@
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
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",
@@ -96,6 +96,7 @@
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
  }