@v-office/website-sdk 1.2.1 → 2.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 (46) hide show
  1. package/README.md +91 -232
  2. package/dist/cli.mjs +102 -83
  3. package/dist/client-BSUd3vuc.mjs +5111 -0
  4. package/dist/index.d.mts +2463 -11751
  5. package/dist/index.mjs +16 -4
  6. package/dist/instructions/CHANGELOG.md +9 -0
  7. package/dist/instructions/MIGRATION.md +9 -0
  8. package/dist/instructions/README.md +62 -0
  9. package/dist/instructions/availability.md +157 -0
  10. package/dist/instructions/booking.md +165 -0
  11. package/dist/instructions/contact.md +92 -0
  12. package/dist/instructions/creation.md +223 -0
  13. package/dist/instructions/filter.md +156 -0
  14. package/dist/instructions/quote.md +318 -0
  15. package/dist/instructions/rentals.md +152 -0
  16. package/dist/instructions/search.md +233 -0
  17. package/dist/instructions/versions/2.0.0/CHANGELOG.md +69 -0
  18. package/dist/instructions/versions/2.0.0/MIGRATION.md +223 -0
  19. package/dist/{quote-DQGps4dy.mjs → quote-1uEIO44v.mjs} +15 -16
  20. package/dist/{rentals-plxPVx83.mjs → rentals-Quwc78o2.mjs} +22 -16
  21. package/dist/{search-BuR5apFw.mjs → search-GRQeXDvo.mjs} +40 -23
  22. package/dist/to-rental-highlights-FNZBR4aD.mjs +5905 -0
  23. package/instructions/CHANGELOG.md +9 -0
  24. package/instructions/MIGRATION.md +9 -0
  25. package/instructions/README.md +62 -0
  26. package/instructions/availability.md +157 -0
  27. package/instructions/booking.md +165 -0
  28. package/instructions/contact.md +92 -0
  29. package/instructions/creation.md +223 -0
  30. package/instructions/filter.md +156 -0
  31. package/instructions/quote.md +318 -0
  32. package/instructions/rentals.md +152 -0
  33. package/instructions/search.md +233 -0
  34. package/instructions/versions/2.0.0/CHANGELOG.md +69 -0
  35. package/instructions/versions/2.0.0/MIGRATION.md +223 -0
  36. package/package.json +41 -56
  37. package/dist/client-DeEUMMOh.mjs +0 -33237
  38. package/dist/custom-attribute-D5Kb1YHA.mjs +0 -54
  39. package/dist/errors-2cuUGSvi.mjs +0 -5
  40. package/dist/operations-B4IgNB3E.mjs +0 -12618
  41. package/dist/operations-DcU1qt7g.mjs +0 -1158
  42. package/dist/quote-BVx3TAHE.mjs +0 -513
  43. package/dist/quote-CRjV_lf-.mjs +0 -609
  44. package/dist/rentals-H3RYtMqT.mjs +0 -323
  45. package/dist/search-filter-metadata-DZP0-Udc.mjs +0 -4294
  46. package/dist/to-rental-highlights-CAATPqan.mjs +0 -524
package/README.md CHANGED
@@ -1,269 +1,128 @@
1
- # tsdown-starter
1
+ # @v-office/website-sdk
2
2
 
3
- A starter for creating a TypeScript package.
3
+ Website-facing SDK facade for vOffice backends.
4
4
 
5
- ## Development
5
+ Version 2.0.0 is the replacement line for the legacy website SDK implementation. It keeps the high-level SDK method tree stable while moving shared domain contracts and v10 runtime behavior into `@v-office/sdk-core`.
6
6
 
7
- - Install dependencies:
7
+ ## Install
8
8
 
9
- ```bash
10
- pnpm install
9
+ ```sh
10
+ pnpm add @v-office/website-sdk
11
11
  ```
12
12
 
13
- - Run the unit tests:
13
+ The package is ESM-only and exposes:
14
14
 
15
- ```bash
16
- pnpm run test
17
- ```
18
-
19
- - Build the library:
20
-
21
- ```bash
22
- pnpm run build
23
- ```
24
-
25
- - Playground
26
-
27
- ```bash
28
- pnpm run playground
29
- ```
30
-
31
- ## CLI
15
+ - `@v-office/website-sdk`
16
+ - `@v-office/website-sdk/cli`
17
+ - `@v-office/website-sdk/package.json`
32
18
 
33
- The CLI exposes common SDK operations without editing `playground.ts` for each
34
- manual test. In local development, use `pnpm cli -- ...`; when installed as a
35
- package binary, use `cms-sdk ...`.
19
+ ## Create a SDK
36
20
 
37
- The CLI reads the same environment variables as `playground.ts`. For v9:
38
-
39
- ```bash
40
- HUB_GRAPHQL_URL
41
- HUB_V1_API_BASE_URL
42
- HUB_V0_API_BASE_URL
43
- HUB_API_KEY
44
- IMAGE_PROXY_BASE_URL
45
- ```
46
-
47
- For v10:
48
-
49
- ```bash
50
- VOFFICE_API_ENDPOINT
51
- VOFFICE_LOCAL_DEV_ACCESS_TOKEN
52
- VOFFICE_IMAGE_BASE_URL
53
- ```
54
-
55
- You can inspect the required environment variables and resolved config:
56
-
57
- ```bash
58
- pnpm cli --backend v9 config env
59
- pnpm cli --backend v10 config show --output pretty
60
- ```
21
+ ```ts
22
+ import { createWebsiteSDK, defineWebsiteSDKOptions } from '@v-office/website-sdk'
61
23
 
62
- You can also pass a complete parsed config or shared SDK options file:
63
-
64
- ```bash
65
- pnpm cli --backend v9 --config ./cms-config.v9.json config show
66
- pnpm cli --backend v10 --options ./cms-options.json filters --locale de-DE
67
- ```
68
-
69
- ### Static Services
70
-
71
- Fetch rentals:
72
-
73
- ```bash
74
- pnpm cli --backend v9 rentals --locale de-DE
75
- pnpm cli --backend v10 rentals --locale de-DE
76
- ```
77
-
78
- Fetch filters:
79
-
80
- ```bash
81
- pnpm cli --backend v9 filters --locale de-DE
82
- pnpm cli --backend v10 filters --locale de-DE
83
- ```
84
-
85
- ### Search Service
86
-
87
- Run the same query shape used in `playground.ts`:
88
-
89
- ```bash
90
- pnpm cli --backend v9 search \
91
- --locale de-DE \
92
- --limit 2 \
93
- --query "start=20-06-2026&end=27-06-2026&adults=2&childrenAges=5%2C13&babies=1&pets=1&wifi&bedrooms=6&bbq=true&youthgroups=on_request&beachdistance=200&scope=entire_home%2Cprivate_room&reet&complexFilter"
94
- ```
95
-
96
- Use the returned `pageInfo.nextCursor` for the next page:
97
-
98
- ```bash
99
- pnpm cli --backend v10 search \
100
- --locale de-DE \
101
- --limit 2 \
102
- --cursor "<nextCursor>" \
103
- --query "start=20-06-2026&end=27-06-2026&adults=2&childrenAges=5%2C13&babies=1&pets=1"
104
- ```
105
-
106
- ### Availability Service
107
-
108
- Fetch the initial availability calendar:
109
-
110
- ```bash
111
- pnpm cli --backend v9 availability initial \
112
- --locale de-DE \
113
- --rental-id 134990 \
114
- --calculate-from-date 2026-05-01 \
115
- --calculate-through-date 2026-08-31
116
- ```
117
-
118
- Fetch availability after selecting a start date:
119
-
120
- ```bash
121
- pnpm cli --backend v9 availability start-date-selected \
122
- --locale de-DE \
123
- --rental-id 134990 \
124
- --selected-start-date 2026-06-17 \
125
- --calculate-from-date 2026-05-01 \
126
- --calculate-through-date 2026-08-31
127
- ```
128
-
129
- The v10 playground rental can be used in the same commands:
130
-
131
- ```bash
132
- pnpm cli --backend v10 availability initial \
133
- --locale de-DE \
134
- --rental-id GMB2KczZnEXkdcF2LscQFX \
135
- --calculate-from-date 2026-07-08 \
136
- --calculate-through-date 2026-07-11
137
- ```
138
-
139
- ### Quote Service
140
-
141
- Create a JSON fixture for a quote input, for example:
142
-
143
- ```json
144
- {
145
- "locale": "de-DE",
146
- "rentalId": "159521",
147
- "period": {
148
- "start": "2026-07-08",
149
- "end": "2026-07-11"
150
- },
151
- "occupancy": {
152
- "adults": 1,
153
- "children": 0,
154
- "babies": 0,
155
- "pets": 0
24
+ const sdk = createWebsiteSDK({
25
+ config: {
26
+ backend: 'v10',
27
+ apiEndpoint: 'https://api.example.com/graphql',
28
+ accessToken: '...',
29
+ imageBaseUrl: 'https://images.example.com',
156
30
  },
157
- "destinationCountryCode": "DE"
31
+ options: defineWebsiteSDKOptions({
32
+ rentalScope: {
33
+ propertyId: 'property-1',
34
+ },
35
+ }),
36
+ })
37
+
38
+ try {
39
+ const rentals = await sdk.static.rentals.getRentals({ locale: 'de-DE' })
40
+ console.log(rentals)
41
+ } finally {
42
+ await sdk.dispose()
158
43
  }
159
44
  ```
160
45
 
161
- Then run:
162
-
163
- ```bash
164
- pnpm cli --backend v9 quote --input ./quote-input.v9.json
165
- ```
166
-
167
- For the v10 playground rental with the voucher:
46
+ For v9:
168
47
 
169
- ```json
170
- {
171
- "locale": "de-DE",
172
- "rentalId": "GMB2KczZnEXkdcF2LscQFX",
173
- "period": {
174
- "start": "2026-07-08",
175
- "end": "2026-07-11"
176
- },
177
- "occupancy": {
178
- "adults": 1,
179
- "children": 0,
180
- "babies": 0,
181
- "pets": 0
48
+ ```ts
49
+ const sdk = createWebsiteSDK({
50
+ config: {
51
+ backend: 'v9',
52
+ graphqlUrl: 'https://example.com/graphql',
53
+ apiKey: '...',
54
+ imageProxyBaseUrl: 'https://images.example.com',
55
+ v1ApiBaseUrl: 'https://example.com/api/v1',
56
+ v0ApiBaseUrl: 'https://example.com/api/v0',
182
57
  },
183
- "destinationCountryCode": "DE",
184
- "voucher": "OFFER11"
185
- }
186
- ```
187
-
188
- ```bash
189
- pnpm cli --backend v10 quote --input ./quote-input.v10.json
58
+ })
190
59
  ```
191
60
 
192
- ### Contact Service
61
+ ## SDK Surface
193
62
 
194
- Contact submission is guarded by `--yes` because it sends data to the backend.
195
- Create a JSON fixture like the playground input:
63
+ The facade exposes Promise-based static and live APIs:
196
64
 
197
- ```json
198
- {
199
- "title": "Herr",
200
- "professionalTitle": "Dr.",
201
- "forename": "Max",
202
- "surname": "Mustermann",
203
- "address": {
204
- "streetAndHousenumber": "Musterstraße 42",
205
- "postalCode": "11111",
206
- "city": "Musterstadt",
207
- "countryCode": "DE"
208
- },
209
- "email": "max.mustermann@muster.de",
210
- "phone": "+49123456789",
211
- "message": "Muster-Hinweis\nMuster"
212
- }
213
- ```
65
+ ```ts
66
+ sdk.static.rentals.getRentals(input)
67
+ sdk.static.filter.getFilters(input)
214
68
 
215
- Then submit it explicitly:
69
+ sdk.live.search.search(input)
70
+ sdk.live.availability.getInitialAvailability(input)
71
+ sdk.live.availability.getStartDateSelectedAvailability(input)
72
+ sdk.live.quote.quote(input)
73
+ sdk.live.booking.book(input)
74
+ sdk.live.contact.submit(input)
216
75
 
217
- ```bash
218
- pnpm cli --backend v9 contact submit --input ./contact-input.json --yes
76
+ await sdk.dispose()
219
77
  ```
220
78
 
221
- ### Booking Service
79
+ Quote mutation helpers are available under `sdk.live.quote`:
222
80
 
223
- Booking and quote-selection flows still need code for now because they operate
224
- on a live `GuestQuote` class instance returned by the quote service. Keep using
225
- `playground.ts` for booking, additional service selection, cancellation policy
226
- selection, insurance selection, insurance pre-contracts, insurance payment
227
- selection, and insurance booking until those flows have a stable JSON
228
- serialization contract.
81
+ - `addAdditionalService`
82
+ - `removeAdditionalService`
83
+ - `clearAdditionalServices`
84
+ - `selectCancellationPolicy`
85
+ - `selectInsurance`
86
+ - `createInsurancePreContract`
87
+ - `selectInsurancePayment`
88
+ - `bookInsurance`
229
89
 
230
- ## TODO
231
-
232
- ### My-Stuff
233
-
234
- - Payment (needs to be tested)
235
-
236
- - Zahlung vor Ort (v9)
237
-
238
- - Insurances
239
-
240
- - Contact-Form (v10 -> Ticket)
241
- - Contact-Form (v9 -> sendMessage)
90
+ ## CLI
242
91
 
243
- - Auto-Regions (v10)
92
+ ```sh
93
+ website-sdk --backend v10 rentals --locale de-DE
94
+ website-sdk --backend v9 filters --locale en-US
95
+ website-sdk --backend v10 search --locale de-DE --query "adults=2"
96
+ ```
244
97
 
245
- ### Waiting
98
+ The CLI can read config from environment variables or from JSON files:
246
99
 
247
- ## v9
100
+ ```sh
101
+ website-sdk --backend v10 --config ./website-sdk-config.json --options ./website-sdk-options.json rentals --locale de-DE
102
+ ```
248
103
 
249
- - Alternatives
250
- - Filter für getRentals
251
- - Always applied Filter für search
104
+ For v10, environment configuration uses:
252
105
 
253
- ### Custom Attributes
106
+ - `VOFFICE_API_ENDPOINT`
107
+ - `VOFFICE_LOCAL_DEV_ACCESS_TOKEN`
108
+ - `VOFFICE_IMAGE_BASE_URL`
254
109
 
255
- - Suche mit Filter nach Custom-Attribute (boolean)
256
- - v10 nicht implementiert - wird bald
257
- - v9 müsste über Hub Filter-Schema gemacht werden
258
- - unified surface
110
+ For v9, environment configuration uses:
259
111
 
260
- ### Optional
112
+ - `HUB_GRAPHQL_URL`
113
+ - `HUB_V1_API_BASE_URL`
114
+ - `HUB_API_KEY`
115
+ - `IMAGE_PROXY_BASE_URL`
116
+ - `HUB_V0_API_BASE_URL` optional
261
117
 
262
- #### Filter-Counts
118
+ ## Migration From Legacy
263
119
 
264
- - In v10 müsste man ganze Suche triggern - nicht gut
265
- - In v9 müsste über Hub Filter-Schema gemacht werden
120
+ This is a breaking release for consumers migrating from the legacy SDK API. The largest changes are:
266
121
 
267
- ### getRentals
122
+ - `createCMSSDKFromParsedConfig(...)` was replaced by `createWebsiteSDK({ config, options })`.
123
+ - Config moved from nested `{ backend, v9: {...} }` / `{ backend, v10: {...} }` objects to flat `WebsiteSDKConfig` objects.
124
+ - Public type names moved from CMS naming to Website naming.
125
+ - The error model now comes from `@v-office/sdk-core`.
126
+ - CLI config JSON uses the new flat config shape.
268
127
 
269
- - highlightsPrioritization does not correctly work with e.g. maxPersons
128
+ See `instructions/` for the full consumer documentation. Version-specific release notes and migration details live under `instructions/versions/2.0.0/`, with indexes at `instructions/CHANGELOG.md` and `instructions/MIGRATION.md`.