@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.
- package/README.md +91 -232
- package/dist/cli.mjs +102 -83
- package/dist/client-BSUd3vuc.mjs +5111 -0
- package/dist/index.d.mts +2463 -11751
- package/dist/index.mjs +16 -4
- package/dist/instructions/CHANGELOG.md +9 -0
- package/dist/instructions/MIGRATION.md +9 -0
- package/dist/instructions/README.md +62 -0
- package/dist/instructions/availability.md +157 -0
- package/dist/instructions/booking.md +165 -0
- package/dist/instructions/contact.md +92 -0
- package/dist/instructions/creation.md +223 -0
- package/dist/instructions/filter.md +156 -0
- package/dist/instructions/quote.md +318 -0
- package/dist/instructions/rentals.md +152 -0
- package/dist/instructions/search.md +233 -0
- package/dist/instructions/versions/2.0.0/CHANGELOG.md +69 -0
- package/dist/instructions/versions/2.0.0/MIGRATION.md +223 -0
- package/dist/{quote-DQGps4dy.mjs → quote-1uEIO44v.mjs} +15 -16
- package/dist/{rentals-plxPVx83.mjs → rentals-Quwc78o2.mjs} +22 -16
- package/dist/{search-BuR5apFw.mjs → search-GRQeXDvo.mjs} +40 -23
- package/dist/to-rental-highlights-FNZBR4aD.mjs +5905 -0
- package/instructions/CHANGELOG.md +9 -0
- package/instructions/MIGRATION.md +9 -0
- package/instructions/README.md +62 -0
- package/instructions/availability.md +157 -0
- package/instructions/booking.md +165 -0
- package/instructions/contact.md +92 -0
- package/instructions/creation.md +223 -0
- package/instructions/filter.md +156 -0
- package/instructions/quote.md +318 -0
- package/instructions/rentals.md +152 -0
- package/instructions/search.md +233 -0
- package/instructions/versions/2.0.0/CHANGELOG.md +69 -0
- package/instructions/versions/2.0.0/MIGRATION.md +223 -0
- package/package.json +41 -56
- package/dist/client-DeEUMMOh.mjs +0 -33237
- package/dist/custom-attribute-D5Kb1YHA.mjs +0 -54
- package/dist/errors-2cuUGSvi.mjs +0 -5
- package/dist/operations-B4IgNB3E.mjs +0 -12618
- package/dist/operations-DcU1qt7g.mjs +0 -1158
- package/dist/quote-BVx3TAHE.mjs +0 -513
- package/dist/quote-CRjV_lf-.mjs +0 -609
- package/dist/rentals-H3RYtMqT.mjs +0 -323
- package/dist/search-filter-metadata-DZP0-Udc.mjs +0 -4294
- package/dist/to-rental-highlights-CAATPqan.mjs +0 -524
|
@@ -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`.
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# Search
|
|
2
|
+
|
|
3
|
+
## Service
|
|
4
|
+
|
|
5
|
+
Use the live search API to search rentals with a URL query-string style input:
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
const result = await sdk.live.search.search({
|
|
9
|
+
locale: 'de-DE',
|
|
10
|
+
query: 'start=01-07-2026&end=08-07-2026&adults=2&wifi=true',
|
|
11
|
+
})
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The service is implemented for both `v9` and `v10` backends and returns normalized rental result items. Filtering by `rentalIdsIn` is currently implemented for `v10` only.
|
|
15
|
+
|
|
16
|
+
## Input
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
type RentalSearchInput = {
|
|
20
|
+
locale: 'de-DE' | 'en-US'
|
|
21
|
+
query: string
|
|
22
|
+
rentalIdsIn?: readonly string[]
|
|
23
|
+
limit?: number
|
|
24
|
+
cursor?: string
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Sample:
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"locale": "de-DE",
|
|
33
|
+
"query": "start=01-07-2026&end=08-07-2026&adults=2&children=1&wifi=true",
|
|
34
|
+
"rentalIdsIn": ["123", "456"],
|
|
35
|
+
"limit": 20
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Common stable query keys:
|
|
40
|
+
|
|
41
|
+
- Period: `start`, `end`, `from`, `till`, `minNights`, `maxNights`; date values support `DD-MM-YYYY` and `YYYY-MM-DD`; `v10` also supports `month`, `dates`, `nights`, and `weekend`.
|
|
42
|
+
- Occupancy: `adults`, `children`, `childrenAges`, `babies`, `pets`, `petsCount`.
|
|
43
|
+
- Filters: use `searchParameterQueryKey` values from `sdk.static.filter.getFilters(...)`.
|
|
44
|
+
|
|
45
|
+
## Query Structure
|
|
46
|
+
|
|
47
|
+
The `query` field is a URL query-string style value without a leading `?`.
|
|
48
|
+
|
|
49
|
+
Use `&` to combine period, occupancy, and filter parameters:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
'start=20-06-2026&end=27-06-2026&adults=2&wifi'
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Period Queries
|
|
56
|
+
|
|
57
|
+
Use one supported period structure per query.
|
|
58
|
+
|
|
59
|
+
Exact period search:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
'start=20-06-2026&end=27-06-2026'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Flexible search by month:
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
'month=06-2026&nights=7'
|
|
69
|
+
'month=06-2026&month=07-2026&nights=7'
|
|
70
|
+
'month=06-2026&weekend'
|
|
71
|
+
'month=06-2026&month=07-2026&weekend'
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Flexible search by exact date tuples:
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
'dates=20-06-2026,22-06-2026&nights=2'
|
|
78
|
+
'dates=20-06-2026,22-06-2026&dates=04-07-2026,11-07-2026&nights=2'
|
|
79
|
+
'dates=20-06-2026,22-06-2026&weekend'
|
|
80
|
+
'dates=20-06-2026,22-06-2026&dates=04-07-2026,11-07-2026&weekend'
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Occupancy And Filters
|
|
84
|
+
|
|
85
|
+
Append occupancy and filter parameters with `&`:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
'start=20-06-2026&end=27-06-2026&adults=2'
|
|
89
|
+
'start=20-06-2026&end=27-06-2026&adults=2&childrenAges=5%2C13&babies=1&pets=1'
|
|
90
|
+
'start=20-06-2026&end=27-06-2026&adults=2&wifi'
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Boolean filters can be provided as presence-only flags when supported:
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
'wifi'
|
|
97
|
+
'wifi&bbq=true'
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Invalid Combinations
|
|
101
|
+
|
|
102
|
+
Do not mix exact period search with flexible period options:
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
'start=20-06-2026&end=27-06-2026&nights=7'
|
|
106
|
+
'start=20-06-2026&end=27-06-2026&weekend'
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Do not mix `month` and `dates` in the same flexible query:
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
'month=06-2026&dates=20-06-2026,22-06-2026&nights=2'
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Flexible queries require either `nights` or `weekend`, but not both:
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
'month=06-2026'
|
|
119
|
+
'dates=20-06-2026,22-06-2026'
|
|
120
|
+
'month=06-2026&nights=7&weekend'
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Dates should use `DD-MM-YYYY`; months should use `MM-YYYY`.
|
|
124
|
+
|
|
125
|
+
Use `rentalIdsIn` to restrict results to specific rental IDs. This option is currently supported by `v10` only.
|
|
126
|
+
|
|
127
|
+
`limit` defaults to `20`. Treat `cursor` as opaque and pass back `pageInfo.nextCursor` unchanged.
|
|
128
|
+
|
|
129
|
+
## Output
|
|
130
|
+
|
|
131
|
+
Returns `Promise<RentalSearchOutput>`.
|
|
132
|
+
|
|
133
|
+
Sample:
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"items": [
|
|
138
|
+
{
|
|
139
|
+
"id": "123",
|
|
140
|
+
"nameOrLabel": "Apartment Meerblick",
|
|
141
|
+
"timeZone": "Europe/Berlin",
|
|
142
|
+
"rentalType": "Apartment",
|
|
143
|
+
"location": {
|
|
144
|
+
"latitude": 54.123,
|
|
145
|
+
"longitude": 8.456
|
|
146
|
+
},
|
|
147
|
+
"images": [
|
|
148
|
+
{
|
|
149
|
+
"idOrPath": "image-1",
|
|
150
|
+
"src": "https://images.example.com/image-1.jpg",
|
|
151
|
+
"srcset": "https://images.example.com/image-1.jpg 1x",
|
|
152
|
+
"alt": "Apartment Meerblick"
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
"highlights": ["2 bedrooms", "WiFi", "Parking"],
|
|
156
|
+
"formattedTotal": "1.234,00 €"
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
"alternatives": [
|
|
160
|
+
{
|
|
161
|
+
"item": {
|
|
162
|
+
"id": "456",
|
|
163
|
+
"nameOrLabel": "Apartment Düne",
|
|
164
|
+
"timeZone": "Europe/Berlin"
|
|
165
|
+
},
|
|
166
|
+
"alternativePeriods": [
|
|
167
|
+
{
|
|
168
|
+
"start": "2026-07-10",
|
|
169
|
+
"end": "2026-07-17",
|
|
170
|
+
"formattedTotal": "1.456,00 €"
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
],
|
|
175
|
+
"appliedFilters": [
|
|
176
|
+
{
|
|
177
|
+
"key": "wifi",
|
|
178
|
+
"label": "WiFi"
|
|
179
|
+
}
|
|
180
|
+
],
|
|
181
|
+
"unusedFilterKeys": [],
|
|
182
|
+
"pageInfo": {
|
|
183
|
+
"hasNextPage": true,
|
|
184
|
+
"nextCursor": "20"
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Search items share the rental base fields and may include `scope`, `address`, `property`, `highlights`, and `formattedTotal`. Exact-period results are returned in `items`; alternative-period suggestions are returned in root-level `alternatives`.
|
|
190
|
+
|
|
191
|
+
## Configuration
|
|
192
|
+
|
|
193
|
+
Use flat `WebsiteSDKConfig` files and optional `WebsiteSDKOptions`.
|
|
194
|
+
|
|
195
|
+
Custom filter definitions can extend accepted search query keys. Search requests are rate-limited to one backend request per second with a queue size of five.
|
|
196
|
+
|
|
197
|
+
## CLI Usage
|
|
198
|
+
|
|
199
|
+
Run a search with environment-based config:
|
|
200
|
+
|
|
201
|
+
```sh
|
|
202
|
+
website-sdk --backend v10 search --locale de-DE --query "start=01-07-2026&end=08-07-2026&adults=2"
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Paginate with `--limit` and `--cursor`:
|
|
206
|
+
|
|
207
|
+
```sh
|
|
208
|
+
website-sdk --backend v10 search --locale de-DE --query "adults=2" --limit 10
|
|
209
|
+
website-sdk --backend v10 search --locale de-DE --query "adults=2" --limit 10 --cursor "10"
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Restrict results to specific rental IDs with `--rental-ids-in` (`v10` only):
|
|
213
|
+
|
|
214
|
+
```sh
|
|
215
|
+
website-sdk --backend v10 search --locale de-DE --query "adults=2" --rental-ids-in "123,456"
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Use files instead of environment variables:
|
|
219
|
+
|
|
220
|
+
```sh
|
|
221
|
+
website-sdk --backend v10 --config ./website-sdk-config.json --options ./website-sdk-options.json search --locale de-DE --query "adults=2"
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Output defaults to JSON. Use `--output pretty` for inspected terminal output:
|
|
225
|
+
|
|
226
|
+
```sh
|
|
227
|
+
website-sdk --backend v10 search --locale de-DE --query "adults=2" --output pretty
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Environment variables:
|
|
231
|
+
|
|
232
|
+
- `v9`: `HUB_GRAPHQL_URL`, `HUB_V1_API_BASE_URL`, optional `HUB_V0_API_BASE_URL`, `HUB_API_KEY`, `IMAGE_PROXY_BASE_URL`.
|
|
233
|
+
- `v10`: `VOFFICE_API_ENDPOINT`, `VOFFICE_LOCAL_DEV_ACCESS_TOKEN`, `VOFFICE_IMAGE_BASE_URL`.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Changelog: 2.0.0
|
|
2
|
+
|
|
3
|
+
Release date: 2026-06-24
|
|
4
|
+
|
|
5
|
+
This release moves the website SDK to the `@v-office/website-sdk` 2.0.0 facade backed by `@v-office/sdk-core`.
|
|
6
|
+
|
|
7
|
+
## From
|
|
8
|
+
|
|
9
|
+
- Legacy CMS-style website SDK API.
|
|
10
|
+
- Main construction API: `createCMSSDKFromParsedConfig(config)`.
|
|
11
|
+
- Nested backend config shape: `{ backend, v9: {...}, options }` or `{ backend, v10: {...}, options }`.
|
|
12
|
+
|
|
13
|
+
## To
|
|
14
|
+
|
|
15
|
+
- `@v-office/website-sdk` 2.0.0.
|
|
16
|
+
- Main construction API: `createWebsiteSDK({ config, options })`.
|
|
17
|
+
- Flat backend config shape: `WebsiteSDKConfig`.
|
|
18
|
+
- Separate options shape: `WebsiteSDKOptions`.
|
|
19
|
+
|
|
20
|
+
## Breaking Changes
|
|
21
|
+
|
|
22
|
+
- Replaced `createCMSSDKFromParsedConfig(config)` with `createWebsiteSDK({ config, options })`.
|
|
23
|
+
- Changed SDK config from nested `ParsedCMSConfig` objects to flat `WebsiteSDKConfig` objects.
|
|
24
|
+
- Moved SDK options out of config objects and into the separate `options` argument.
|
|
25
|
+
- Renamed the primary public SDK type from `CMSSDK` to `WebsiteSDK`.
|
|
26
|
+
- Renamed the primary public options type from `CMSOptions` to `WebsiteSDKOptions`.
|
|
27
|
+
- Renamed the primary config type from `ParsedCMSConfig` to `WebsiteSDKConfig`.
|
|
28
|
+
- Changed the SDK error model from the legacy `CMSError` shape with `backend` to the core SDK error shape with `source`.
|
|
29
|
+
- Changed CLI config files to use the same flat `WebsiteSDKConfig` shape.
|
|
30
|
+
- Removed legacy stable-search helper exports from the root package API.
|
|
31
|
+
- Removed legacy CMS construction and config type exports from the root package API.
|
|
32
|
+
|
|
33
|
+
## Added
|
|
34
|
+
|
|
35
|
+
- Added the `createWebsiteSDK` facade backed by `@v-office/sdk-core`.
|
|
36
|
+
- Added `defineWebsiteSDKOptions`.
|
|
37
|
+
- Added `WebsiteSDK`, `WebsiteSDKConfig`, and `WebsiteSDKOptions` public types.
|
|
38
|
+
- Added top-level Effect helper exports for SDK operations.
|
|
39
|
+
- Added top-level `submitPaymentOption` and `submitPaymentOptionEffect` exports.
|
|
40
|
+
- Added public schemas from `@v-office/sdk-core`, including `GuestQuoteSchema`, `LocaleSchema`, `SearchSearchInputSchema`, and `SearchSearchOutputSchema`.
|
|
41
|
+
- Added `rentalPropertyHighlightPrioritization` to `WebsiteSDKOptions`.
|
|
42
|
+
- Added adapted instruction docs under `instructions/`.
|
|
43
|
+
- Added version-specific release and migration docs under `instructions/versions/2.0.0/`.
|
|
44
|
+
- Added an explicit package `types` entry for `./dist/index.d.mts`.
|
|
45
|
+
|
|
46
|
+
## Preserved
|
|
47
|
+
|
|
48
|
+
- Preserved the main SDK method tree:
|
|
49
|
+
- `sdk.static.rentals.getRentals`
|
|
50
|
+
- `sdk.static.filter.getFilters`
|
|
51
|
+
- `sdk.live.search.search`
|
|
52
|
+
- `sdk.live.availability.getInitialAvailability`
|
|
53
|
+
- `sdk.live.availability.getStartDateSelectedAvailability`
|
|
54
|
+
- `sdk.live.quote.*`
|
|
55
|
+
- `sdk.live.booking.book`
|
|
56
|
+
- `sdk.live.booking.submitPaymentOption`
|
|
57
|
+
- `sdk.live.contact.submit`
|
|
58
|
+
- `sdk.dispose`
|
|
59
|
+
- Preserved `defineCMSSDKOptions` as an alias for `defineWebsiteSDKOptions`.
|
|
60
|
+
- Preserved common legacy domain type aliases such as `BookingInput`, `BookingOutput`, `ContactInput`, `RentalRentalsInput`, `RentalRentalsOutput`, `RentalSearchInput`, and `RentalSearchOutput`.
|
|
61
|
+
- Preserved v9 OpenAPI client exports.
|
|
62
|
+
- Preserved v9 heuristic and v1 public API exports.
|
|
63
|
+
- Preserved CLI environment variable names.
|
|
64
|
+
|
|
65
|
+
## Release Notes
|
|
66
|
+
|
|
67
|
+
- This is a major release for consumers migrating from the legacy website SDK API.
|
|
68
|
+
- `@v-office/sdk-core` is now a runtime dependency. Ensure it is published or otherwise resolvable before publishing this package to a public registry.
|
|
69
|
+
- The package remains ESM-only.
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# Migration: Legacy 1.x API to 2.0.0
|
|
2
|
+
|
|
3
|
+
This guide covers the consumer-facing migration from the legacy CMS-style website SDK API to `@v-office/website-sdk` 2.0.0.
|
|
4
|
+
|
|
5
|
+
## Source Version
|
|
6
|
+
|
|
7
|
+
Legacy 1.x-style API:
|
|
8
|
+
|
|
9
|
+
- `createCMSSDKFromParsedConfig`
|
|
10
|
+
- `CMSSDK`
|
|
11
|
+
- `CMSOptions`
|
|
12
|
+
- `ParsedCMSConfig`
|
|
13
|
+
- Nested `v9` / `v10` backend config objects
|
|
14
|
+
|
|
15
|
+
## Target Version
|
|
16
|
+
|
|
17
|
+
`@v-office/website-sdk` 2.0.0:
|
|
18
|
+
|
|
19
|
+
- `createWebsiteSDK`
|
|
20
|
+
- `WebsiteSDK`
|
|
21
|
+
- `WebsiteSDKOptions`
|
|
22
|
+
- `WebsiteSDKConfig`
|
|
23
|
+
- Flat backend config object plus separate options
|
|
24
|
+
|
|
25
|
+
## Package Import
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { createWebsiteSDK, defineWebsiteSDKOptions } from '@v-office/website-sdk'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The new package still exports `defineCMSSDKOptions` as an alias for `defineWebsiteSDKOptions`, but new code should use the Website naming.
|
|
32
|
+
|
|
33
|
+
## SDK Creation
|
|
34
|
+
|
|
35
|
+
Before:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { createCMSSDKFromParsedConfig, defineCMSSDKOptions } from '@v-office/website-sdk'
|
|
39
|
+
|
|
40
|
+
const sdk = createCMSSDKFromParsedConfig({
|
|
41
|
+
backend: 'v10',
|
|
42
|
+
v10: {
|
|
43
|
+
apiEndpoint: 'https://api.example.com/graphql',
|
|
44
|
+
accessToken: '...',
|
|
45
|
+
imageBaseUrl: 'https://images.example.com',
|
|
46
|
+
},
|
|
47
|
+
options: defineCMSSDKOptions({
|
|
48
|
+
rentalScope: {
|
|
49
|
+
propertyId: 'property-1',
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
})
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
After:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { createWebsiteSDK, defineWebsiteSDKOptions } from '@v-office/website-sdk'
|
|
59
|
+
|
|
60
|
+
const sdk = createWebsiteSDK({
|
|
61
|
+
config: {
|
|
62
|
+
backend: 'v10',
|
|
63
|
+
apiEndpoint: 'https://api.example.com/graphql',
|
|
64
|
+
accessToken: '...',
|
|
65
|
+
imageBaseUrl: 'https://images.example.com',
|
|
66
|
+
},
|
|
67
|
+
options: defineWebsiteSDKOptions({
|
|
68
|
+
rentalScope: {
|
|
69
|
+
propertyId: 'property-1',
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
})
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Config Shape
|
|
76
|
+
|
|
77
|
+
Before:
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
{
|
|
81
|
+
backend: "v9",
|
|
82
|
+
v9: {
|
|
83
|
+
graphqlUrl: "...",
|
|
84
|
+
v1ApiBaseUrl: "...",
|
|
85
|
+
apiKey: "...",
|
|
86
|
+
imageProxyBaseUrl: "..."
|
|
87
|
+
},
|
|
88
|
+
options: {...}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
After:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
createWebsiteSDK({
|
|
96
|
+
config: {
|
|
97
|
+
backend: "v9",
|
|
98
|
+
graphqlUrl: "...",
|
|
99
|
+
v1ApiBaseUrl: "...",
|
|
100
|
+
apiKey: "...",
|
|
101
|
+
imageProxyBaseUrl: "..."
|
|
102
|
+
},
|
|
103
|
+
options: {...}
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
For v10, `backend: "v10"` is optional in TypeScript, but config files should include it when they are also used by the CLI.
|
|
108
|
+
|
|
109
|
+
## Type Name Changes
|
|
110
|
+
|
|
111
|
+
| Legacy | 2.0.0 |
|
|
112
|
+
| ------------------------------ | ------------------------- |
|
|
113
|
+
| `CMSSDK` | `WebsiteSDK` |
|
|
114
|
+
| `CMSOptions` | `WebsiteSDKOptions` |
|
|
115
|
+
| `ParsedCMSConfig` | `WebsiteSDKConfig` |
|
|
116
|
+
| `createCMSSDKFromParsedConfig` | `createWebsiteSDK` |
|
|
117
|
+
| `defineCMSSDKOptions` | `defineWebsiteSDKOptions` |
|
|
118
|
+
|
|
119
|
+
Several legacy domain aliases remain exported, including `BookingInput`, `BookingOutput`, `ContactInput`, `RentalRentalsInput`, `RentalRentalsOutput`, `RentalSearchInput`, and `RentalSearchOutput`.
|
|
120
|
+
|
|
121
|
+
## Error Handling
|
|
122
|
+
|
|
123
|
+
Legacy errors exposed `CMSError` with a `backend` field:
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
if (error instanceof CMSError && error.backend === 'v9') {
|
|
127
|
+
// legacy handling
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
2.0.0 aliases `CMSError` to `CoreSDKError` from `@v-office/sdk-core`. The error shape uses `source` instead of `backend`:
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
if (error instanceof CoreSDKError) {
|
|
135
|
+
console.error(error.source, error.operation, error.message)
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Audit any code that checks:
|
|
140
|
+
|
|
141
|
+
- `error._tag`
|
|
142
|
+
- `error.backend`
|
|
143
|
+
- `error instanceof CMSError`
|
|
144
|
+
- serialized SDK error payloads
|
|
145
|
+
|
|
146
|
+
## CLI Migration
|
|
147
|
+
|
|
148
|
+
Before:
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"backend": "v10",
|
|
153
|
+
"v10": {
|
|
154
|
+
"apiEndpoint": "https://api.example.com/graphql",
|
|
155
|
+
"accessToken": "...",
|
|
156
|
+
"imageBaseUrl": "https://images.example.com"
|
|
157
|
+
},
|
|
158
|
+
"options": {
|
|
159
|
+
"rentalScope": {
|
|
160
|
+
"propertyId": "property-1"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
After:
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"backend": "v10",
|
|
171
|
+
"apiEndpoint": "https://api.example.com/graphql",
|
|
172
|
+
"accessToken": "...",
|
|
173
|
+
"imageBaseUrl": "https://images.example.com"
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Move options into a separate file:
|
|
178
|
+
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"rentalScope": {
|
|
182
|
+
"propertyId": "property-1"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Then run:
|
|
188
|
+
|
|
189
|
+
```sh
|
|
190
|
+
website-sdk --backend v10 --config ./website-sdk-config.json --options ./website-sdk-options.json rentals --locale de-DE
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Environment variable names are unchanged.
|
|
194
|
+
|
|
195
|
+
## Removed or Changed Exports
|
|
196
|
+
|
|
197
|
+
The following legacy exports are not part of the 2.0.0 root API:
|
|
198
|
+
|
|
199
|
+
- `createCMSSDKFromParsedConfig`
|
|
200
|
+
- `CMSSDK`
|
|
201
|
+
- `CMSOptions`
|
|
202
|
+
- `ParsedCMSConfig`
|
|
203
|
+
- `V9CMSConfig`
|
|
204
|
+
- `V10CMSConfig`
|
|
205
|
+
- `defineStableSearchInputGroup`
|
|
206
|
+
- `toStableSearchInputParameterValues`
|
|
207
|
+
- `toStableSearchInputQueryKeys`
|
|
208
|
+
- `StableSearchInputGroup`
|
|
209
|
+
- `GuestQuoteSelectionError`
|
|
210
|
+
- v0 public schema helpers such as `V0OpenApiComponents`
|
|
211
|
+
|
|
212
|
+
If a consuming app depends on any of these, migrate to the new names or keep a small local compatibility wrapper during the app migration.
|
|
213
|
+
|
|
214
|
+
## Recommended Migration Steps
|
|
215
|
+
|
|
216
|
+
1. Update imports to `@v-office/website-sdk`.
|
|
217
|
+
2. Replace `createCMSSDKFromParsedConfig` calls with `createWebsiteSDK`.
|
|
218
|
+
3. Convert nested backend config objects to flat `WebsiteSDKConfig` objects.
|
|
219
|
+
4. Move embedded config `options` to the `options` argument.
|
|
220
|
+
5. Rename explicit `CMS*` types to `Website*` types.
|
|
221
|
+
6. Audit error handling.
|
|
222
|
+
7. Update CLI config files and scripts.
|
|
223
|
+
8. Run the consuming app's typecheck and a focused smoke test for rentals, search, quote, booking, and contact flows.
|