@v-office/website-sdk 2.3.2 → 2.4.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/dist/cli.mjs +1 -1
- package/dist/index.d.mts +13 -3
- package/dist/instructions/CHANGELOG.md +1 -0
- package/dist/instructions/MIGRATION.md +2 -0
- package/dist/instructions/README.md +4 -2
- package/dist/instructions/rentals.md +36 -1
- package/dist/instructions/versions/2.4.0/CHANGELOG.md +28 -0
- package/dist/instructions/versions/2.4.0/MIGRATION.md +109 -0
- package/instructions/CHANGELOG.md +1 -0
- package/instructions/MIGRATION.md +2 -0
- package/instructions/README.md +4 -2
- package/instructions/rentals.md +36 -1
- package/instructions/versions/2.4.0/CHANGELOG.md +28 -0
- package/instructions/versions/2.4.0/MIGRATION.md +109 -0
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -15,7 +15,7 @@ var CLICheckFailed = class extends Error {
|
|
|
15
15
|
const toCLIError = (message, cause) => cause instanceof Error ? new CLICheckFailed(`${message}: ${cause.message}`, { cause }) : new CLICheckFailed(message, { cause });
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region package.json
|
|
18
|
-
var version = "2.
|
|
18
|
+
var version = "2.4.0";
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/cli/output.ts
|
|
21
21
|
const toJson = (value) => Effect.try({
|
package/dist/index.d.mts
CHANGED
|
@@ -221,11 +221,21 @@ declare const getRentalsEffect: (input: RentalGetRentalsInput$1) => Effect.Effec
|
|
|
221
221
|
}[];
|
|
222
222
|
readonly highlights?: readonly string[];
|
|
223
223
|
readonly reviews?: {
|
|
224
|
-
readonly items: readonly {
|
|
224
|
+
readonly items: readonly ({
|
|
225
|
+
readonly id?: string;
|
|
226
|
+
readonly author?: string;
|
|
227
|
+
readonly label?: string;
|
|
228
|
+
readonly createdAt?: string;
|
|
225
229
|
readonly rating: string;
|
|
226
|
-
readonly
|
|
230
|
+
readonly text?: string;
|
|
231
|
+
} | {
|
|
232
|
+
readonly id?: string;
|
|
233
|
+
readonly author?: string;
|
|
234
|
+
readonly label?: string;
|
|
235
|
+
readonly createdAt?: string;
|
|
236
|
+
readonly rating?: string;
|
|
227
237
|
readonly text: string;
|
|
228
|
-
}[];
|
|
238
|
+
})[];
|
|
229
239
|
readonly summary?: {
|
|
230
240
|
readonly rating: string;
|
|
231
241
|
readonly count: string;
|
|
@@ -4,6 +4,7 @@ This file is the versioned changelog index for the website SDK instructions.
|
|
|
4
4
|
|
|
5
5
|
## Versions
|
|
6
6
|
|
|
7
|
+
- `versions/2.4.0/CHANGELOG.md`: `@v-office/website-sdk` 2.4.0 release notes.
|
|
7
8
|
- `versions/2.3.0/CHANGELOG.md`: `@v-office/website-sdk` 2.3.0 release notes.
|
|
8
9
|
- `versions/2.1.0/CHANGELOG.md`: `@v-office/website-sdk` 2.1.0 release notes.
|
|
9
10
|
- `versions/2.0.0/CHANGELOG.md`: `@v-office/website-sdk` 2.0.0 release notes.
|
|
@@ -4,6 +4,8 @@ This file is the versioned migration index for the website SDK instructions.
|
|
|
4
4
|
|
|
5
5
|
## Available Guides
|
|
6
6
|
|
|
7
|
+
- `versions/2.4.0/MIGRATION.md`: migrate from `@v-office/website-sdk` 2.3.x to 2.4.0.
|
|
8
|
+
- `versions/2.3.0/MIGRATION.md`: migrate from `@v-office/website-sdk` 2.1.0 to 2.3.0.
|
|
7
9
|
- `versions/2.1.0/MIGRATION.md`: migrate from `@v-office/website-sdk` 2.0.0 to 2.1.0.
|
|
8
10
|
- `versions/2.0.0/MIGRATION.md`: migrate from the legacy 1.x CMS-style website SDK API to `@v-office/website-sdk` 2.0.0.
|
|
9
11
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Website SDK Instructions
|
|
2
2
|
|
|
3
|
-
These instructions describe `@v-office/website-sdk` 2.
|
|
3
|
+
These instructions describe `@v-office/website-sdk` 2.4.0.
|
|
4
4
|
|
|
5
5
|
Use this directory as the consumer-facing reference for the package:
|
|
6
6
|
|
|
@@ -15,6 +15,8 @@ Use this directory as the consumer-facing reference for the package:
|
|
|
15
15
|
- `document-structured-json.md`: `sdk.static.documents.getTermsAndPrivacyPolicy` and structured document JSON rendering rules.
|
|
16
16
|
- `CHANGELOG.md`: versioned changelog index.
|
|
17
17
|
- `MIGRATION.md`: versioned migration index.
|
|
18
|
+
- `versions/2.4.0/`: 2.4.0 release notes and 2.3.x-to-2.4.0 migration guide.
|
|
19
|
+
- `versions/2.3.0/`: 2.3.0 release notes and 2.1.0-to-2.3.0 migration guide.
|
|
18
20
|
- `versions/2.1.0/`: 2.1.0 release notes and 2.0.0-to-2.1.0 migration guide.
|
|
19
21
|
- `versions/2.0.0/`: release-specific 2.0.0 changelog and 1.x-to-2.0.0 migration guide.
|
|
20
22
|
|
|
@@ -61,4 +63,4 @@ website-sdk --backend v9 filters --locale en-US
|
|
|
61
63
|
website-sdk --backend v10 search --locale de-DE --query "adults=2"
|
|
62
64
|
```
|
|
63
65
|
|
|
64
|
-
Config file examples in these docs use the flat `WebsiteSDKConfig` shape introduced in 2.0.0 and kept in 2.
|
|
66
|
+
Config file examples in these docs use the flat `WebsiteSDKConfig` shape introduced in 2.0.0 and kept in 2.4.0.
|
|
@@ -69,8 +69,15 @@ Sample item:
|
|
|
69
69
|
"reviews": {
|
|
70
70
|
"items": [
|
|
71
71
|
{
|
|
72
|
+
"id": "rating-answer-1",
|
|
72
73
|
"rating": "5",
|
|
73
|
-
"
|
|
74
|
+
"label": "Overall satisfaction",
|
|
75
|
+
"createdAt": "2026-07-10T10:00:00.000Z"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": "text-answer-1",
|
|
79
|
+
"label": "Personal feedback",
|
|
80
|
+
"createdAt": "2026-07-10T10:00:01.000Z",
|
|
74
81
|
"text": "Great stay."
|
|
75
82
|
}
|
|
76
83
|
],
|
|
@@ -85,6 +92,34 @@ Sample item:
|
|
|
85
92
|
|
|
86
93
|
Optional fields include `scope`, `address`, `property`, `rooms`, `roomSummary`, `vicinity`, and `reviews`.
|
|
87
94
|
|
|
95
|
+
### Review Items
|
|
96
|
+
|
|
97
|
+
Each review item contains at least `rating` or `text`. `id`, `author`, `label`, and `createdAt` are optional:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
type RentalReview =
|
|
101
|
+
| {
|
|
102
|
+
id?: string;
|
|
103
|
+
author?: string;
|
|
104
|
+
label?: string;
|
|
105
|
+
createdAt?: string;
|
|
106
|
+
rating: string;
|
|
107
|
+
text?: string;
|
|
108
|
+
}
|
|
109
|
+
| {
|
|
110
|
+
id?: string;
|
|
111
|
+
author?: string;
|
|
112
|
+
label?: string;
|
|
113
|
+
createdAt?: string;
|
|
114
|
+
rating?: string;
|
|
115
|
+
text: string;
|
|
116
|
+
};
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
For v10, public `STARS` and `TEXT` answers may be returned as separate items because the backend does not always expose a reliable relationship between them. Do not assign a rating-only item to a text-only item. Missing public customer data leaves `author` undefined.
|
|
120
|
+
|
|
121
|
+
`createdAt` is the feedback answer'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 aggregated rating answers and does not necessarily equal `items.length`.
|
|
122
|
+
|
|
88
123
|
## Configuration
|
|
89
124
|
|
|
90
125
|
`v9` config:
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Changelog: 2.4.0
|
|
2
|
+
|
|
3
|
+
Release date: 2026-07-15
|
|
4
|
+
|
|
5
|
+
This release makes all usable v10 public rental feedback available without incorrectly associating independently returned ratings and comments.
|
|
6
|
+
|
|
7
|
+
## Added
|
|
8
|
+
|
|
9
|
+
- Added optional `id`, `label`, and `createdAt` fields to rental review items.
|
|
10
|
+
- Added v10 rating-only review items for public `STARS` answers.
|
|
11
|
+
- Added v10 text-only review items for public `TEXT` answers.
|
|
12
|
+
- Added support for returning `reviews` with `items` but without `summary` when a rental only has public text feedback.
|
|
13
|
+
|
|
14
|
+
## Changed
|
|
15
|
+
|
|
16
|
+
- Rental review items now require at least one of `rating` or `text`; neither field is universally required.
|
|
17
|
+
- Rental review `author` is now optional because the v10 public feedback API may omit customer information.
|
|
18
|
+
- v10 public feedback answers are returned independently instead of being joined without a reliable submission identifier.
|
|
19
|
+
- Existing review summaries and category ratings continue to aggregate valid public `STARS` answers.
|
|
20
|
+
|
|
21
|
+
## Migration Impact
|
|
22
|
+
|
|
23
|
+
- Check `item.rating`, `item.text`, and `item.author` before rendering them.
|
|
24
|
+
- Treat `item.createdAt` as the feedback-answer creation time, not the guest's travel date.
|
|
25
|
+
- Use `item.label` to identify the feedback question or rating category when present.
|
|
26
|
+
- Do not assume `reviews.summary` exists whenever `reviews` exists.
|
|
27
|
+
- Do not assume `reviews.items.length` matches the localized `reviews.summary.count`; items represent public answers while the summary represents aggregate ratings.
|
|
28
|
+
- No SDK construction or configuration changes are required.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Migration: 2.3.x to 2.4.0
|
|
2
|
+
|
|
3
|
+
This guide covers upgrading `@v-office/website-sdk` from 2.3.x to 2.4.0.
|
|
4
|
+
|
|
5
|
+
2.4.0 keeps `createWebsiteSDK({ config, options })`, the flat `WebsiteSDKConfig`, and the existing `sdk.static.rentals.getRentals({ locale })` call. The migration affects rental review rendering.
|
|
6
|
+
|
|
7
|
+
## Rental Review Items
|
|
8
|
+
|
|
9
|
+
The v10 public feedback API can return ratings and comments as independent answers without a reliable shared submission identifier. The SDK now exposes each usable answer without assigning a comment to an unrelated rating.
|
|
10
|
+
|
|
11
|
+
Review items therefore support these shapes:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
type RentalReview =
|
|
15
|
+
| {
|
|
16
|
+
id?: string;
|
|
17
|
+
author?: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
createdAt?: string;
|
|
20
|
+
rating: string;
|
|
21
|
+
text?: string;
|
|
22
|
+
}
|
|
23
|
+
| {
|
|
24
|
+
id?: string;
|
|
25
|
+
author?: string;
|
|
26
|
+
label?: string;
|
|
27
|
+
createdAt?: string;
|
|
28
|
+
rating?: string;
|
|
29
|
+
text: string;
|
|
30
|
+
};
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Every item contains at least `rating` or `text`. Complete items containing both fields remain valid.
|
|
34
|
+
|
|
35
|
+
### Rendering
|
|
36
|
+
|
|
37
|
+
Check every optional field independently:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
for (const rental of await sdk.static.rentals.getRentals({ locale: "de-DE" })) {
|
|
41
|
+
for (const item of rental.reviews?.items ?? []) {
|
|
42
|
+
if (item.label !== undefined) {
|
|
43
|
+
renderReviewLabel(item.label);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (item.rating !== undefined) {
|
|
47
|
+
renderReviewRating(item.rating);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (item.text !== undefined) {
|
|
51
|
+
renderReviewText(item.text);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
renderReviewAuthor(item.author ?? "Anonymous");
|
|
55
|
+
|
|
56
|
+
if (item.createdAt !== undefined) {
|
|
57
|
+
renderFeedbackCreatedAt(item.createdAt);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`createdAt` is the public feedback answer's creation timestamp. It is not the guest's arrival or travel date.
|
|
64
|
+
|
|
65
|
+
### Summary
|
|
66
|
+
|
|
67
|
+
A rental with text-only public feedback can now return:
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
const rental = {
|
|
71
|
+
reviews: {
|
|
72
|
+
items: [
|
|
73
|
+
{
|
|
74
|
+
id: "answer-id",
|
|
75
|
+
label: "Personal feedback",
|
|
76
|
+
createdAt: "2026-07-10T10:00:00.000Z",
|
|
77
|
+
text: "A quiet stay.",
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Continue to guard the summary independently:
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
if (rental.reviews?.summary !== undefined) {
|
|
88
|
+
renderReviewSummary(rental.reviews.summary);
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Do not use `reviews.items.length` as the review-summary count. Items represent independently available public answers, while `summary` aggregates valid public rating answers and exposes a localized `count` string.
|
|
93
|
+
|
|
94
|
+
## Backend Behavior
|
|
95
|
+
|
|
96
|
+
- v10 returns rating-only and text-only items when those answers are public.
|
|
97
|
+
- Missing public customer data leaves `author` undefined; choose any anonymous label in the application.
|
|
98
|
+
- The SDK does not copy aggregate ratings onto text-only items.
|
|
99
|
+
- Existing v9 review items continue to contain `rating`, `author`, and `text`, but consumers see the shared weakened TypeScript type.
|
|
100
|
+
- Rentals without any usable public rating or text answers continue to omit `reviews`.
|
|
101
|
+
|
|
102
|
+
## Recommended Steps
|
|
103
|
+
|
|
104
|
+
1. Upgrade to `@v-office/website-sdk` 2.4.0.
|
|
105
|
+
2. Add presence checks for review `rating`, `text`, and `author`.
|
|
106
|
+
3. Guard `reviews.summary` independently from `reviews`.
|
|
107
|
+
4. Render `label` and `createdAt` where useful.
|
|
108
|
+
5. Avoid pairing separate rating-only and text-only items in application code.
|
|
109
|
+
6. Smoke-test rentals with rating-only, text-only, complete, and absent review data.
|
|
@@ -4,6 +4,7 @@ This file is the versioned changelog index for the website SDK instructions.
|
|
|
4
4
|
|
|
5
5
|
## Versions
|
|
6
6
|
|
|
7
|
+
- `versions/2.4.0/CHANGELOG.md`: `@v-office/website-sdk` 2.4.0 release notes.
|
|
7
8
|
- `versions/2.3.0/CHANGELOG.md`: `@v-office/website-sdk` 2.3.0 release notes.
|
|
8
9
|
- `versions/2.1.0/CHANGELOG.md`: `@v-office/website-sdk` 2.1.0 release notes.
|
|
9
10
|
- `versions/2.0.0/CHANGELOG.md`: `@v-office/website-sdk` 2.0.0 release notes.
|
|
@@ -4,6 +4,8 @@ This file is the versioned migration index for the website SDK instructions.
|
|
|
4
4
|
|
|
5
5
|
## Available Guides
|
|
6
6
|
|
|
7
|
+
- `versions/2.4.0/MIGRATION.md`: migrate from `@v-office/website-sdk` 2.3.x to 2.4.0.
|
|
8
|
+
- `versions/2.3.0/MIGRATION.md`: migrate from `@v-office/website-sdk` 2.1.0 to 2.3.0.
|
|
7
9
|
- `versions/2.1.0/MIGRATION.md`: migrate from `@v-office/website-sdk` 2.0.0 to 2.1.0.
|
|
8
10
|
- `versions/2.0.0/MIGRATION.md`: migrate from the legacy 1.x CMS-style website SDK API to `@v-office/website-sdk` 2.0.0.
|
|
9
11
|
|
package/instructions/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Website SDK Instructions
|
|
2
2
|
|
|
3
|
-
These instructions describe `@v-office/website-sdk` 2.
|
|
3
|
+
These instructions describe `@v-office/website-sdk` 2.4.0.
|
|
4
4
|
|
|
5
5
|
Use this directory as the consumer-facing reference for the package:
|
|
6
6
|
|
|
@@ -15,6 +15,8 @@ Use this directory as the consumer-facing reference for the package:
|
|
|
15
15
|
- `document-structured-json.md`: `sdk.static.documents.getTermsAndPrivacyPolicy` and structured document JSON rendering rules.
|
|
16
16
|
- `CHANGELOG.md`: versioned changelog index.
|
|
17
17
|
- `MIGRATION.md`: versioned migration index.
|
|
18
|
+
- `versions/2.4.0/`: 2.4.0 release notes and 2.3.x-to-2.4.0 migration guide.
|
|
19
|
+
- `versions/2.3.0/`: 2.3.0 release notes and 2.1.0-to-2.3.0 migration guide.
|
|
18
20
|
- `versions/2.1.0/`: 2.1.0 release notes and 2.0.0-to-2.1.0 migration guide.
|
|
19
21
|
- `versions/2.0.0/`: release-specific 2.0.0 changelog and 1.x-to-2.0.0 migration guide.
|
|
20
22
|
|
|
@@ -61,4 +63,4 @@ website-sdk --backend v9 filters --locale en-US
|
|
|
61
63
|
website-sdk --backend v10 search --locale de-DE --query "adults=2"
|
|
62
64
|
```
|
|
63
65
|
|
|
64
|
-
Config file examples in these docs use the flat `WebsiteSDKConfig` shape introduced in 2.0.0 and kept in 2.
|
|
66
|
+
Config file examples in these docs use the flat `WebsiteSDKConfig` shape introduced in 2.0.0 and kept in 2.4.0.
|
package/instructions/rentals.md
CHANGED
|
@@ -69,8 +69,15 @@ Sample item:
|
|
|
69
69
|
"reviews": {
|
|
70
70
|
"items": [
|
|
71
71
|
{
|
|
72
|
+
"id": "rating-answer-1",
|
|
72
73
|
"rating": "5",
|
|
73
|
-
"
|
|
74
|
+
"label": "Overall satisfaction",
|
|
75
|
+
"createdAt": "2026-07-10T10:00:00.000Z"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": "text-answer-1",
|
|
79
|
+
"label": "Personal feedback",
|
|
80
|
+
"createdAt": "2026-07-10T10:00:01.000Z",
|
|
74
81
|
"text": "Great stay."
|
|
75
82
|
}
|
|
76
83
|
],
|
|
@@ -85,6 +92,34 @@ Sample item:
|
|
|
85
92
|
|
|
86
93
|
Optional fields include `scope`, `address`, `property`, `rooms`, `roomSummary`, `vicinity`, and `reviews`.
|
|
87
94
|
|
|
95
|
+
### Review Items
|
|
96
|
+
|
|
97
|
+
Each review item contains at least `rating` or `text`. `id`, `author`, `label`, and `createdAt` are optional:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
type RentalReview =
|
|
101
|
+
| {
|
|
102
|
+
id?: string;
|
|
103
|
+
author?: string;
|
|
104
|
+
label?: string;
|
|
105
|
+
createdAt?: string;
|
|
106
|
+
rating: string;
|
|
107
|
+
text?: string;
|
|
108
|
+
}
|
|
109
|
+
| {
|
|
110
|
+
id?: string;
|
|
111
|
+
author?: string;
|
|
112
|
+
label?: string;
|
|
113
|
+
createdAt?: string;
|
|
114
|
+
rating?: string;
|
|
115
|
+
text: string;
|
|
116
|
+
};
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
For v10, public `STARS` and `TEXT` answers may be returned as separate items because the backend does not always expose a reliable relationship between them. Do not assign a rating-only item to a text-only item. Missing public customer data leaves `author` undefined.
|
|
120
|
+
|
|
121
|
+
`createdAt` is the feedback answer'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 aggregated rating answers and does not necessarily equal `items.length`.
|
|
122
|
+
|
|
88
123
|
## Configuration
|
|
89
124
|
|
|
90
125
|
`v9` config:
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Changelog: 2.4.0
|
|
2
|
+
|
|
3
|
+
Release date: 2026-07-15
|
|
4
|
+
|
|
5
|
+
This release makes all usable v10 public rental feedback available without incorrectly associating independently returned ratings and comments.
|
|
6
|
+
|
|
7
|
+
## Added
|
|
8
|
+
|
|
9
|
+
- Added optional `id`, `label`, and `createdAt` fields to rental review items.
|
|
10
|
+
- Added v10 rating-only review items for public `STARS` answers.
|
|
11
|
+
- Added v10 text-only review items for public `TEXT` answers.
|
|
12
|
+
- Added support for returning `reviews` with `items` but without `summary` when a rental only has public text feedback.
|
|
13
|
+
|
|
14
|
+
## Changed
|
|
15
|
+
|
|
16
|
+
- Rental review items now require at least one of `rating` or `text`; neither field is universally required.
|
|
17
|
+
- Rental review `author` is now optional because the v10 public feedback API may omit customer information.
|
|
18
|
+
- v10 public feedback answers are returned independently instead of being joined without a reliable submission identifier.
|
|
19
|
+
- Existing review summaries and category ratings continue to aggregate valid public `STARS` answers.
|
|
20
|
+
|
|
21
|
+
## Migration Impact
|
|
22
|
+
|
|
23
|
+
- Check `item.rating`, `item.text`, and `item.author` before rendering them.
|
|
24
|
+
- Treat `item.createdAt` as the feedback-answer creation time, not the guest's travel date.
|
|
25
|
+
- Use `item.label` to identify the feedback question or rating category when present.
|
|
26
|
+
- Do not assume `reviews.summary` exists whenever `reviews` exists.
|
|
27
|
+
- Do not assume `reviews.items.length` matches the localized `reviews.summary.count`; items represent public answers while the summary represents aggregate ratings.
|
|
28
|
+
- No SDK construction or configuration changes are required.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Migration: 2.3.x to 2.4.0
|
|
2
|
+
|
|
3
|
+
This guide covers upgrading `@v-office/website-sdk` from 2.3.x to 2.4.0.
|
|
4
|
+
|
|
5
|
+
2.4.0 keeps `createWebsiteSDK({ config, options })`, the flat `WebsiteSDKConfig`, and the existing `sdk.static.rentals.getRentals({ locale })` call. The migration affects rental review rendering.
|
|
6
|
+
|
|
7
|
+
## Rental Review Items
|
|
8
|
+
|
|
9
|
+
The v10 public feedback API can return ratings and comments as independent answers without a reliable shared submission identifier. The SDK now exposes each usable answer without assigning a comment to an unrelated rating.
|
|
10
|
+
|
|
11
|
+
Review items therefore support these shapes:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
type RentalReview =
|
|
15
|
+
| {
|
|
16
|
+
id?: string;
|
|
17
|
+
author?: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
createdAt?: string;
|
|
20
|
+
rating: string;
|
|
21
|
+
text?: string;
|
|
22
|
+
}
|
|
23
|
+
| {
|
|
24
|
+
id?: string;
|
|
25
|
+
author?: string;
|
|
26
|
+
label?: string;
|
|
27
|
+
createdAt?: string;
|
|
28
|
+
rating?: string;
|
|
29
|
+
text: string;
|
|
30
|
+
};
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Every item contains at least `rating` or `text`. Complete items containing both fields remain valid.
|
|
34
|
+
|
|
35
|
+
### Rendering
|
|
36
|
+
|
|
37
|
+
Check every optional field independently:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
for (const rental of await sdk.static.rentals.getRentals({ locale: "de-DE" })) {
|
|
41
|
+
for (const item of rental.reviews?.items ?? []) {
|
|
42
|
+
if (item.label !== undefined) {
|
|
43
|
+
renderReviewLabel(item.label);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (item.rating !== undefined) {
|
|
47
|
+
renderReviewRating(item.rating);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (item.text !== undefined) {
|
|
51
|
+
renderReviewText(item.text);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
renderReviewAuthor(item.author ?? "Anonymous");
|
|
55
|
+
|
|
56
|
+
if (item.createdAt !== undefined) {
|
|
57
|
+
renderFeedbackCreatedAt(item.createdAt);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`createdAt` is the public feedback answer's creation timestamp. It is not the guest's arrival or travel date.
|
|
64
|
+
|
|
65
|
+
### Summary
|
|
66
|
+
|
|
67
|
+
A rental with text-only public feedback can now return:
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
const rental = {
|
|
71
|
+
reviews: {
|
|
72
|
+
items: [
|
|
73
|
+
{
|
|
74
|
+
id: "answer-id",
|
|
75
|
+
label: "Personal feedback",
|
|
76
|
+
createdAt: "2026-07-10T10:00:00.000Z",
|
|
77
|
+
text: "A quiet stay.",
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Continue to guard the summary independently:
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
if (rental.reviews?.summary !== undefined) {
|
|
88
|
+
renderReviewSummary(rental.reviews.summary);
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Do not use `reviews.items.length` as the review-summary count. Items represent independently available public answers, while `summary` aggregates valid public rating answers and exposes a localized `count` string.
|
|
93
|
+
|
|
94
|
+
## Backend Behavior
|
|
95
|
+
|
|
96
|
+
- v10 returns rating-only and text-only items when those answers are public.
|
|
97
|
+
- Missing public customer data leaves `author` undefined; choose any anonymous label in the application.
|
|
98
|
+
- The SDK does not copy aggregate ratings onto text-only items.
|
|
99
|
+
- Existing v9 review items continue to contain `rating`, `author`, and `text`, but consumers see the shared weakened TypeScript type.
|
|
100
|
+
- Rentals without any usable public rating or text answers continue to omit `reviews`.
|
|
101
|
+
|
|
102
|
+
## Recommended Steps
|
|
103
|
+
|
|
104
|
+
1. Upgrade to `@v-office/website-sdk` 2.4.0.
|
|
105
|
+
2. Add presence checks for review `rating`, `text`, and `author`.
|
|
106
|
+
3. Guard `reviews.summary` independently from `reviews`.
|
|
107
|
+
4. Render `label` and `createdAt` where useful.
|
|
108
|
+
5. Avoid pairing separate rating-only and text-only items in application code.
|
|
109
|
+
6. Smoke-test rentals with rating-only, text-only, complete, and absent review data.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-office/website-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Website-facing SDK facade backed by @v-office/sdk-core",
|
|
5
5
|
"bin": {
|
|
6
6
|
"website-sdk": "./dist/cli.mjs"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@graphql-typed-document-node/core": "3.2.0",
|
|
44
|
-
"@v-office/sdk-core": "^1.
|
|
44
|
+
"@v-office/sdk-core": "^1.5.0",
|
|
45
45
|
"effect": "4.0.0-beta.85",
|
|
46
46
|
"graphql": "16.14.2",
|
|
47
47
|
"yaml": "^2.9.0"
|