@v-office/website-sdk 1.2.1 → 2.1.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 (58) hide show
  1. package/README.md +93 -232
  2. package/dist/cli.mjs +105 -84
  3. package/dist/client-xkXV7Nf-.mjs +5127 -0
  4. package/dist/index.d.mts +1444 -11259
  5. package/dist/index.mjs +16 -4
  6. package/dist/instructions/CHANGELOG.md +10 -0
  7. package/dist/instructions/MIGRATION.md +10 -0
  8. package/dist/instructions/README.md +64 -0
  9. package/dist/instructions/availability.md +157 -0
  10. package/dist/instructions/booking.md +165 -0
  11. package/dist/instructions/contact.md +110 -0
  12. package/dist/instructions/creation.md +223 -0
  13. package/dist/instructions/document-structured-json.md +100 -0
  14. package/dist/instructions/filter.md +158 -0
  15. package/dist/instructions/quote.md +342 -0
  16. package/dist/instructions/rentals.md +152 -0
  17. package/dist/instructions/search.md +238 -0
  18. package/dist/instructions/versions/2.0.0/CHANGELOG.md +69 -0
  19. package/dist/instructions/versions/2.0.0/MIGRATION.md +223 -0
  20. package/dist/instructions/versions/2.1.0/CHANGELOG.md +32 -0
  21. package/dist/instructions/versions/2.1.0/MIGRATION.md +89 -0
  22. package/dist/{quote-DQGps4dy.mjs → quote--25SMlYS.mjs} +41 -19
  23. package/dist/{rentals-plxPVx83.mjs → rentals-DCKUaLnB.mjs} +22 -16
  24. package/dist/{search-BuR5apFw.mjs → search-8iCC0Nel.mjs} +40 -23
  25. package/dist/to-rental-highlights-CZYJeR1D.mjs +5905 -0
  26. package/dist/translations/shared/de-DE/contact.json +19 -0
  27. package/dist/translations/shared/de-DE/quote.json +5 -1
  28. package/dist/translations/shared/en-US/contact.json +19 -0
  29. package/dist/translations/shared/en-US/quote.json +5 -1
  30. package/dist/translations/v10/de-DE/mapped-search-filters.json +3 -0
  31. package/dist/translations/v10/en-US/mapped-search-filters.json +3 -0
  32. package/instructions/CHANGELOG.md +10 -0
  33. package/instructions/MIGRATION.md +10 -0
  34. package/instructions/README.md +64 -0
  35. package/instructions/availability.md +157 -0
  36. package/instructions/booking.md +165 -0
  37. package/instructions/contact.md +110 -0
  38. package/instructions/creation.md +223 -0
  39. package/instructions/document-structured-json.md +100 -0
  40. package/instructions/filter.md +158 -0
  41. package/instructions/quote.md +342 -0
  42. package/instructions/rentals.md +152 -0
  43. package/instructions/search.md +238 -0
  44. package/instructions/versions/2.0.0/CHANGELOG.md +69 -0
  45. package/instructions/versions/2.0.0/MIGRATION.md +223 -0
  46. package/instructions/versions/2.1.0/CHANGELOG.md +32 -0
  47. package/instructions/versions/2.1.0/MIGRATION.md +89 -0
  48. package/package.json +42 -56
  49. package/dist/client-DeEUMMOh.mjs +0 -33237
  50. package/dist/custom-attribute-D5Kb1YHA.mjs +0 -54
  51. package/dist/errors-2cuUGSvi.mjs +0 -5
  52. package/dist/operations-B4IgNB3E.mjs +0 -12618
  53. package/dist/operations-DcU1qt7g.mjs +0 -1158
  54. package/dist/quote-BVx3TAHE.mjs +0 -513
  55. package/dist/quote-CRjV_lf-.mjs +0 -609
  56. package/dist/rentals-H3RYtMqT.mjs +0 -323
  57. package/dist/search-filter-metadata-DZP0-Udc.mjs +0 -4294
  58. package/dist/to-rental-highlights-CAATPqan.mjs +0 -524
@@ -0,0 +1,342 @@
1
+ # Quote
2
+
3
+ ## Service
4
+
5
+ Use the live quote API to price a stay and get selectable booking options:
6
+
7
+ ```ts
8
+ const result = await sdk.live.quote.quote(input);
9
+ ```
10
+
11
+ If the quote is available, the returned `GuestQuote` can be updated through selection helpers:
12
+
13
+ ```ts
14
+ const withService = await sdk.live.quote.addAdditionalService({ quote, id: "linen" });
15
+ const withPolicy = await sdk.live.quote.selectCancellationPolicy({ quote, id: "alternative" });
16
+ ```
17
+
18
+ ## Input
19
+
20
+ ```ts
21
+ type QuoteQuoteInput = {
22
+ locale: "de-DE" | "en-US";
23
+ rentalId: string;
24
+ period: {
25
+ start: string;
26
+ end: string;
27
+ };
28
+ occupancy: {
29
+ adults: number;
30
+ children: number;
31
+ childrenAges?: number[];
32
+ babies: number;
33
+ pets: number;
34
+ };
35
+ destinationCountryCode?: string;
36
+ voucher?: string;
37
+ };
38
+ ```
39
+
40
+ `GuestQuoteInput` remains available as a legacy alias.
41
+
42
+ Sample:
43
+
44
+ ```json
45
+ {
46
+ "locale": "de-DE",
47
+ "rentalId": "123",
48
+ "period": {
49
+ "start": "2026-07-01",
50
+ "end": "2026-07-08"
51
+ },
52
+ "occupancy": {
53
+ "adults": 2,
54
+ "children": 1,
55
+ "childrenAges": [8],
56
+ "babies": 0,
57
+ "pets": 1
58
+ },
59
+ "destinationCountryCode": "DE",
60
+ "voucher": "SUMMER26"
61
+ }
62
+ ```
63
+
64
+ Dates are local dates formatted as `YYYY-MM-DD`. For `v9`, `rentalId` must be a numeric vOffice unit id.
65
+ Both backends accept `voucher` on quote and booking flows. `v10` can expose voucher discounts as booking-card modifiers when the backend returns voucher modifiers; `v9` reflects voucher effects in the quoted totals but does not expose a separate voucher modifier line.
66
+
67
+ ## Output
68
+
69
+ Returns `Promise<GuestQuoteResult>`.
70
+
71
+ Available sample:
72
+
73
+ ```json
74
+ {
75
+ "status": "available",
76
+ "quote": {
77
+ "bookingCardInformation": {
78
+ "sections": [
79
+ {
80
+ "lines": [
81
+ {
82
+ "item": {
83
+ "position": "Rent",
84
+ "appliedCharge": "1,200.00 EUR"
85
+ }
86
+ }
87
+ ]
88
+ }
89
+ ],
90
+ "total": "1,200.00 EUR"
91
+ },
92
+ "voucher": {
93
+ "code": "SUMMER26",
94
+ "status": "applied",
95
+ "message": "The voucher code was applied."
96
+ },
97
+ "additionalServices": [
98
+ {
99
+ "id": "linen",
100
+ "label": "Bed linen",
101
+ "charge": "25.00 EUR",
102
+ "maxPerBooking": 1
103
+ }
104
+ ],
105
+ "cancellationPolicies": [
106
+ {
107
+ "id": "default",
108
+ "label": "Default cancellation policy",
109
+ "selected": true
110
+ }
111
+ ],
112
+ "insurance": {
113
+ "options": [
114
+ {
115
+ "kind": "none",
116
+ "label": "No insurance"
117
+ }
118
+ ],
119
+ "selected": {
120
+ "kind": "none"
121
+ },
122
+ "preContract": {
123
+ "kind": "none_selected"
124
+ },
125
+ "paymentOptions": []
126
+ }
127
+ }
128
+ }
129
+ ```
130
+
131
+ Unavailable sample:
132
+
133
+ ```json
134
+ {
135
+ "status": "unavailable",
136
+ "reason": "Rental is not available for the selected period."
137
+ }
138
+ ```
139
+
140
+ Selection methods return `{ ok: true, quote }` or `{ ok: false, error }`. Possible selection errors include unknown additional service, additional service limit exceeded, unknown cancellation policy, unavailable cancellation policy quote, and unavailable quote combination.
141
+
142
+ ## Vouchers
143
+
144
+ When `voucher` is provided in the quote input, an available quote may include `quote.voucher`:
145
+
146
+ ```json
147
+ {
148
+ "code": "SUMMER26",
149
+ "status": "applied",
150
+ "message": "The voucher code was applied."
151
+ }
152
+ ```
153
+
154
+ `status` is `"applied"`, `"not_applied"`, or `"unknown"`. `v10` reports `"applied"` when the backend returns a non-zero voucher modifier and `"not_applied"` when no voucher modifier is returned for the requested voucher. `v9` returns `"unknown"` for available voucher quotes because the legacy response does not provide a reliable voucher modifier signal.
155
+
156
+ Voucher modifiers can appear in `bookingCardInformation.sections`. Sections are returned in display order.
157
+
158
+ ## Additional Services
159
+
160
+ Additional services are exposed on an available quote as `quote.additionalServices`.
161
+
162
+ ```json
163
+ {
164
+ "id": "linen",
165
+ "label": "Bed linen",
166
+ "charge": "25.00 EUR",
167
+ "available": true,
168
+ "maxPerBooking": 1,
169
+ "description": "Bed linen package"
170
+ }
171
+ ```
172
+
173
+ Use the service `id` to add or remove a service selection:
174
+
175
+ ```ts
176
+ const added = await sdk.live.quote.addAdditionalService({ quote, id: "linen" });
177
+ if (added.ok) quote = added.quote;
178
+
179
+ const removed = await sdk.live.quote.removeAdditionalService({ quote, id: "linen" });
180
+ if (removed.ok) quote = removed.quote;
181
+
182
+ const cleared = await sdk.live.quote.clearAdditionalServices({ quote });
183
+ if (cleared.ok) quote = cleared.quote;
184
+ ```
185
+
186
+ Each successful change returns a new quote with recalculated `bookingCardInformation.total`. v10 can mark unavailable service/policy combinations with `available: false` and `unavailableReason`; disable those options in the UI. Handle `{ ok: false, error }` for unknown service ids, quantity limits, or `UnavailableQuoteCombination`.
187
+
188
+ ## Cancellation Policies
189
+
190
+ Cancellation policies are exposed on `quote.cancellationPolicies` when the backend offers selectable policies.
191
+
192
+ ```json
193
+ {
194
+ "id": "alternative",
195
+ "label": "Flexible cancellation",
196
+ "selected": false,
197
+ "available": true,
198
+ "markUpPercentage": "10%",
199
+ "processingFee": "25.00 EUR",
200
+ "rules": [
201
+ {
202
+ "daysBeforeArrival": 14,
203
+ "refundPercentage": "80%"
204
+ }
205
+ ]
206
+ }
207
+ ```
208
+
209
+ Select a policy by id:
210
+
211
+ ```ts
212
+ const selected = await sdk.live.quote.selectCancellationPolicy({
213
+ quote,
214
+ id: "alternative",
215
+ });
216
+
217
+ if (selected.ok) quote = selected.quote;
218
+ ```
219
+
220
+ The selected policy is marked with `selected: true`, and the booking card total is recalculated if the policy changes the price. Handle selection errors for unknown or unavailable policy ids.
221
+
222
+ ## Insurance
223
+
224
+ Insurance information is exposed on `quote.insurance` when available. The `options` array contains either a `none` option or selectable insurance products.
225
+
226
+ ```json
227
+ {
228
+ "options": [
229
+ {
230
+ "kind": "insurance",
231
+ "id": "ergo",
232
+ "formattedPrice": "49.00 EUR",
233
+ "label": "Travel cancellation insurance",
234
+ "requiredInformation": {
235
+ "kind": "travelers"
236
+ }
237
+ }
238
+ ],
239
+ "selected": {
240
+ "kind": "none"
241
+ },
242
+ "preContract": {
243
+ "kind": "none_selected"
244
+ },
245
+ "paymentOptions": []
246
+ }
247
+ ```
248
+
249
+ Use `selectInsurance` to choose no insurance or a product:
250
+
251
+ ```ts
252
+ quote = await sdk.live.quote.selectInsurance({
253
+ quote,
254
+ selection: {
255
+ kind: "insurance",
256
+ id: "ergo",
257
+ travelers: [
258
+ {
259
+ salutation: "Ms",
260
+ forename: "Jane",
261
+ surname: "Doe",
262
+ birthday: "1990-01-01",
263
+ },
264
+ ],
265
+ },
266
+ });
267
+ ```
268
+
269
+ For insurance products that require a pre-contract, provide customer information:
270
+
271
+ ```ts
272
+ quote = await sdk.live.quote.createInsurancePreContract({
273
+ quote,
274
+ customerInformation: {
275
+ destinationCountryCode: "DE",
276
+ address: {
277
+ street: "Main Street",
278
+ housenumber: "1",
279
+ postalcode: "12345",
280
+ city: "Berlin",
281
+ countryCode: "DE",
282
+ },
283
+ email: "jane@example.com",
284
+ mobile: "+49123456789",
285
+ },
286
+ });
287
+ ```
288
+
289
+ Select an insurance payment method before booking insurance:
290
+
291
+ ```ts
292
+ quote = await sdk.live.quote.selectInsurancePayment({
293
+ quote,
294
+ paymentInformation: {
295
+ kind: "sepa_debit",
296
+ iban: "DE02120300000000202051",
297
+ },
298
+ });
299
+ ```
300
+
301
+ After the rental booking is created, complete insurance booking with the booking number and guest token:
302
+
303
+ ```ts
304
+ const insuranceBooking = await sdk.live.quote.bookInsurance({
305
+ quote,
306
+ bookingNumber: booking.bookingNumber,
307
+ guestToken: booking.guestToken,
308
+ });
309
+ ```
310
+
311
+ `v9` supports real insurance option refresh, pre-contract, payment selection, and booking. `v10` currently returns a no-insurance placeholder and insurance actions resolve as not required.
312
+
313
+ ## Configuration
314
+
315
+ Quote requests are rate-limited to one backend request per second with a queue size of five. `v9` supports insurance option refresh and insurance actions; `v10` currently returns a no-insurance placeholder and insurance actions resolve as not required.
316
+
317
+ ## CLI Usage
318
+
319
+ Create `quote-input.json` with a `QuoteQuoteInput` object, then run:
320
+
321
+ ```sh
322
+ website-sdk --backend v10 quote --input ./quote-input.json
323
+ ```
324
+
325
+ Use files instead of environment variables:
326
+
327
+ ```sh
328
+ website-sdk --backend v9 --config ./website-sdk-config.json quote --input ./quote-input.json
329
+ ```
330
+
331
+ Output defaults to JSON. Use `--output pretty` for inspected terminal output:
332
+
333
+ ```sh
334
+ website-sdk --backend v10 quote --input ./quote-input.json --output pretty
335
+ ```
336
+
337
+ The CLI only creates the initial quote. Additional service, cancellation policy, and insurance selections are SDK-only operations.
338
+
339
+ Environment variables:
340
+
341
+ - `v9`: `HUB_GRAPHQL_URL`, `HUB_V1_API_BASE_URL`, optional `HUB_V0_API_BASE_URL`, `HUB_API_KEY`, `IMAGE_PROXY_BASE_URL`.
342
+ - `v10`: `VOFFICE_API_ENDPOINT`, `VOFFICE_LOCAL_DEV_ACCESS_TOKEN`, `VOFFICE_IMAGE_BASE_URL`.
@@ -0,0 +1,152 @@
1
+ # Rentals
2
+
3
+ ## Service
4
+
5
+ Use the static rentals API to fetch localized rental summaries:
6
+
7
+ ```ts
8
+ const rentals = await sdk.static.rentals.getRentals({ locale: "de-DE" });
9
+ ```
10
+
11
+ The service is implemented for both `v9` and `v10` backends and returns one normalized item per rental.
12
+
13
+ ## Input
14
+
15
+ ```ts
16
+ type RentalRentalsInput = {
17
+ locale: "de-DE" | "en-US";
18
+ };
19
+ ```
20
+
21
+ Sample:
22
+
23
+ ```json
24
+ {
25
+ "locale": "de-DE"
26
+ }
27
+ ```
28
+
29
+ ## Output
30
+
31
+ Returns `Promise<RentalGetRentalsOutput>`. The package also exports the legacy alias `RentalRentalsOutput` for a single rental item.
32
+
33
+ Sample item:
34
+
35
+ ```json
36
+ {
37
+ "id": "123",
38
+ "nameOrLabel": "Apartment Meerblick",
39
+ "timeZone": "Europe/Berlin",
40
+ "rentalType": "Apartment",
41
+ "location": {
42
+ "latitude": 54.123,
43
+ "longitude": 8.456
44
+ },
45
+ "images": [
46
+ {
47
+ "idOrPath": "image-1",
48
+ "src": "https://images.example.com/image-1.jpg",
49
+ "srcset": "https://images.example.com/image-1.jpg 1x",
50
+ "alt": "Apartment Meerblick"
51
+ }
52
+ ],
53
+ "description": {
54
+ "headline": "Holiday apartment near the sea",
55
+ "description": "Short localized rental description."
56
+ },
57
+ "highlights": ["2 bedrooms", "WiFi", "Parking"],
58
+ "attributes": [
59
+ {
60
+ "label": "Amenities",
61
+ "subCategories": [
62
+ {
63
+ "label": "Kitchen",
64
+ "items": ["Dishwasher", "Oven"]
65
+ }
66
+ ]
67
+ }
68
+ ],
69
+ "reviews": {
70
+ "items": [
71
+ {
72
+ "rating": "5",
73
+ "author": "Jane",
74
+ "text": "Great stay."
75
+ }
76
+ ],
77
+ "summary": {
78
+ "rating": "4.8",
79
+ "count": "12",
80
+ "classification": "Excellent"
81
+ }
82
+ }
83
+ }
84
+ ```
85
+
86
+ Optional fields include `scope`, `address`, `property`, `rooms`, `roomSummary`, `vicinity`, and `reviews`.
87
+
88
+ ## Configuration
89
+
90
+ `v9` config:
91
+
92
+ ```json
93
+ {
94
+ "backend": "v9",
95
+ "graphqlUrl": "https://example.com/graphql",
96
+ "v1ApiBaseUrl": "https://example.com/api/v1",
97
+ "v0ApiBaseUrl": "https://example.com/api/v0",
98
+ "apiKey": "...",
99
+ "imageProxyBaseUrl": "https://images.example.com",
100
+ "rentalDataAttributes": ["name", "description"]
101
+ }
102
+ ```
103
+
104
+ `v10` config:
105
+
106
+ ```json
107
+ {
108
+ "backend": "v10",
109
+ "apiEndpoint": "https://api.example.com/graphql",
110
+ "accessToken": "...",
111
+ "imageBaseUrl": "https://images.example.com"
112
+ }
113
+ ```
114
+
115
+ Optional `WebsiteSDKOptions`:
116
+
117
+ ```json
118
+ {
119
+ "rentalHighlightPrioritization": ["bedrooms", "bathrooms", "maxPersons", "wifi"],
120
+ "rentalPropertyHighlightPrioritization": ["wifi", "parking"],
121
+ "customAttributeFilterDefinitions": [],
122
+ "translationOverrides": {}
123
+ }
124
+ ```
125
+
126
+ `rentalHighlightPrioritization` controls the order of rental `highlights`. `rentalPropertyHighlightPrioritization` controls property highlights for v10 property data. Custom attribute definitions can add custom values to rental output. Translation overrides affect localized labels.
127
+
128
+ ## CLI Usage
129
+
130
+ Fetch rentals with environment-based config:
131
+
132
+ ```sh
133
+ website-sdk --backend v9 rentals --locale en-US
134
+ website-sdk --backend v10 rentals --locale de-DE
135
+ ```
136
+
137
+ Use files instead of environment variables:
138
+
139
+ ```sh
140
+ website-sdk --backend v10 --config ./website-sdk-config.json --options ./website-sdk-options.json rentals --locale de-DE
141
+ ```
142
+
143
+ Output defaults to JSON. Use `--output pretty` for inspected terminal output:
144
+
145
+ ```sh
146
+ website-sdk --backend v10 rentals --locale de-DE --output pretty
147
+ ```
148
+
149
+ Environment variables:
150
+
151
+ - `v9`: `HUB_GRAPHQL_URL`, `HUB_V1_API_BASE_URL`, optional `HUB_V0_API_BASE_URL`, `HUB_API_KEY`, `IMAGE_PROXY_BASE_URL`.
152
+ - `v10`: `VOFFICE_API_ENDPOINT`, `VOFFICE_LOCAL_DEV_ACCESS_TOKEN`, `VOFFICE_IMAGE_BASE_URL`.