@v-office/website-sdk 2.11.0 → 2.12.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 +6 -1
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/{client-DYAHnU5F.mjs → client-Bmxh2SAu.mjs} +54 -30
- package/dist/index.d.mts +566 -288
- package/dist/index.mjs +1 -1
- package/dist/instructions/CHANGELOG.md +1 -0
- package/dist/instructions/MIGRATION.md +1 -0
- package/dist/instructions/README.md +6 -3
- package/dist/instructions/quote.md +95 -3
- package/dist/instructions/search.md +77 -12
- package/dist/instructions/versions/2.12.0/CHANGELOG.md +56 -0
- package/dist/instructions/versions/2.12.0/MIGRATION.md +194 -0
- package/dist/instructions/versions/2.5.0/MIGRATION.md +3 -0
- package/dist/{quote-Cs6jGoRS.mjs → quote-Qy_affum.mjs} +4 -4
- package/dist/{rentals-CFod9H4m.mjs → rentals-BG1diZoo.mjs} +7 -4
- package/dist/{search-QlZrI7ue.mjs → search-BlL8vSPY.mjs} +39 -19
- package/dist/{to-rental-highlights-B6a_fi0j.mjs → to-rental-highlights-BVikT4Iz.mjs} +4 -2
- package/instructions/CHANGELOG.md +1 -0
- package/instructions/MIGRATION.md +1 -0
- package/instructions/README.md +6 -3
- package/instructions/quote.md +95 -3
- package/instructions/search.md +77 -12
- package/instructions/versions/2.12.0/CHANGELOG.md +56 -0
- package/instructions/versions/2.12.0/MIGRATION.md +194 -0
- package/instructions/versions/2.5.0/MIGRATION.md +3 -0
- package/package.json +15 -13
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Migration: 2.11.0 to 2.12.0
|
|
2
|
+
|
|
3
|
+
2.12.0 adds optional discount information to priced legacy v9 search results,
|
|
4
|
+
normalizes empty quote booking-card lines across v9 and v10, and completes v10
|
|
5
|
+
card-level pre-modifier totals across all modifier presentation paths. It also
|
|
6
|
+
rejects unsupported v9 flexible-period searches before transport and restores
|
|
7
|
+
empty-query inventory browsing on v9. Existing supported calls remain valid
|
|
8
|
+
without changes.
|
|
9
|
+
|
|
10
|
+
## 1. Reuse the Shared Discount Output
|
|
11
|
+
|
|
12
|
+
Legacy v9 now uses the same optional shape introduced for v10 in 2.11.0:
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
type SearchDiscount = {
|
|
16
|
+
readonly formattedOriginalTotal: string;
|
|
17
|
+
readonly applied: readonly {
|
|
18
|
+
readonly label: string;
|
|
19
|
+
readonly formattedAmount: string;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
For exact-period results, read `discount` from the item:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
result.items[0]?.discount;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
For nearby suggestions, read it from the individual alternative period:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
result.alternatives?.[0]?.alternativePeriods[0]?.discount;
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 2. Understand the Legacy v9 Mapping
|
|
37
|
+
|
|
38
|
+
For priced v9 results:
|
|
39
|
+
|
|
40
|
+
- `calc.total` remains the final `formattedTotal`.
|
|
41
|
+
- `discount` is present only when `calc.oTotal` is greater than `calc.total`.
|
|
42
|
+
- `discount.formattedOriginalTotal` is formatted from `calc.oTotal`.
|
|
43
|
+
- A non-empty `calc.discountName` becomes the label of the single applied entry.
|
|
44
|
+
- The applied amount is the formatted negative difference
|
|
45
|
+
`calc.total - calc.oTotal`.
|
|
46
|
+
- If the backend supplies no usable discount name, `applied` is empty while the
|
|
47
|
+
formatted original total remains available.
|
|
48
|
+
|
|
49
|
+
The SDK omits `discount` when there is no final total or when the original total is
|
|
50
|
+
not greater than the final total.
|
|
51
|
+
|
|
52
|
+
## 3. Account for Backend Detail Differences
|
|
53
|
+
|
|
54
|
+
v9 exposes one aggregated discount name and therefore returns at most one
|
|
55
|
+
`discount.applied` entry. v10 search can expose multiple `discount.applied`
|
|
56
|
+
entries. Consumers should render the array without assuming a fixed length.
|
|
57
|
+
|
|
58
|
+
Both backends return presentation-ready localized strings. Backend numeric amounts
|
|
59
|
+
and internal modifier keys are not part of the public output.
|
|
60
|
+
|
|
61
|
+
## 4. Account for Booking-Card Cleanup
|
|
62
|
+
|
|
63
|
+
Quote booking cards on both backends now omit numeric zero-value lines without
|
|
64
|
+
subitems from the `other` section, matching the existing handling of included and
|
|
65
|
+
tax sections.
|
|
66
|
+
|
|
67
|
+
- A zero-only `other` section is omitted.
|
|
68
|
+
- A mixed `other` section retains its non-zero lines unchanged.
|
|
69
|
+
- Lines with subitems remain available because they still carry descriptive
|
|
70
|
+
content.
|
|
71
|
+
|
|
72
|
+
No required booking-card property was added and the public schema remains
|
|
73
|
+
source-compatible. Runtime output can contain fewer empty rows. Sites that used a
|
|
74
|
+
zero-value row to represent a declined service should use explicit selection or
|
|
75
|
+
service state instead of inferring that state from the price breakdown.
|
|
76
|
+
|
|
77
|
+
## 5. Render v10 Quote Modifiers
|
|
78
|
+
|
|
79
|
+
On v10, an item at `bookingCardInformation.sections[].lines[].item` can include:
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
{
|
|
83
|
+
modifiers?: readonly {
|
|
84
|
+
label: string;
|
|
85
|
+
amount: string;
|
|
86
|
+
}[];
|
|
87
|
+
totalBeforeModifiers?: string;
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The card can also include `bookingCardInformation.totalBeforeModifiers`.
|
|
92
|
+
`appliedCharge` and `total` are the final amounts after modifiers. The
|
|
93
|
+
corresponding `totalBeforeModifiers` is the formatted amount before modifiers and
|
|
94
|
+
is omitted when there is no non-zero net modifier effect. `modifiers` is omitted
|
|
95
|
+
when the item has none; entries with the same localized label are grouped and
|
|
96
|
+
their amounts are summed before formatting.
|
|
97
|
+
|
|
98
|
+
Included, tax, and other lines attach their adjustments to `item.modifiers`.
|
|
99
|
+
Negative modifiers from backend lines that do not map to those sections may
|
|
100
|
+
instead appear as dedicated booking-card lines. In 2.12.0, card-level
|
|
101
|
+
`totalBeforeModifiers` accounts for both forms. v9 quote cards omit these fields.
|
|
102
|
+
|
|
103
|
+
Example for `de-DE`:
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"bookingCardInformation": {
|
|
108
|
+
"sections": [
|
|
109
|
+
{
|
|
110
|
+
"lines": [
|
|
111
|
+
{
|
|
112
|
+
"item": {
|
|
113
|
+
"position": "Inklusivpreis",
|
|
114
|
+
"appliedCharge": "1.554,00 €",
|
|
115
|
+
"modifiers": [
|
|
116
|
+
{
|
|
117
|
+
"label": "Frühbucher/Last-Minute",
|
|
118
|
+
"amount": "-140,00 €"
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
"totalBeforeModifiers": "1.694,00 €"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
"total": "1.596,70 €",
|
|
128
|
+
"totalBeforeModifiers": "1.736,70 €"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Do not assume a voucher appears as its own section line. Use
|
|
134
|
+
`quote.voucher.status` for voucher application status and the booking-card fields
|
|
135
|
+
for price presentation. To keep price arithmetic visible, render the pre-modifier
|
|
136
|
+
amount, modifier rows, and final amount separately. Whether to display or strike
|
|
137
|
+
through a reference price remains the consuming site's product and legal
|
|
138
|
+
decision.
|
|
139
|
+
|
|
140
|
+
## 6. Keep Flexible Search Disabled on v9
|
|
141
|
+
|
|
142
|
+
No configuration or supported request migration is required. Legacy v9 now rejects
|
|
143
|
+
the unsupported flexible-period keys `month`, `dates`, `nights`, and `weekend`
|
|
144
|
+
before transport instead of silently returning an unpriced item list. Keep
|
|
145
|
+
flexible search unavailable on v9 sites and use fixed `start`/`end` period
|
|
146
|
+
queries. v10 flexible search is unchanged.
|
|
147
|
+
|
|
148
|
+
The rejection is a `CoreSDKError` with operation `v9.search` and occurs before a
|
|
149
|
+
GraphQL request is sent. The public `SearchSearchInput` type remains unchanged
|
|
150
|
+
because its `query` field is an opaque query string.
|
|
151
|
+
|
|
152
|
+
This release enriches v9 search output when its existing response contains
|
|
153
|
+
sufficient discount data, removes empty quote breakdown rows from both backends,
|
|
154
|
+
and can return the existing optional card-level `totalBeforeModifiers` in
|
|
155
|
+
additional v10 cases.
|
|
156
|
+
|
|
157
|
+
## 7. Remove Dummy Occupancy from Empty v9 Searches
|
|
158
|
+
|
|
159
|
+
Legacy v9 now sends an empty backend-filter set as GraphQL `data: null` instead of
|
|
160
|
+
`data: []`. An empty query can therefore browse the first page of searchable
|
|
161
|
+
inventory under the configured rental scope:
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
await sdk.live.search.search({
|
|
165
|
+
locale: "de-DE",
|
|
166
|
+
query: "",
|
|
167
|
+
});
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Remove workarounds that inject `adults=1` only to make an empty query return
|
|
171
|
+
results. Real occupancy, period, and non-empty backend filters keep their existing
|
|
172
|
+
mapping. Pagination and `limit` still apply, and an undated result does not assert
|
|
173
|
+
availability for a particular stay.
|
|
174
|
+
|
|
175
|
+
## Recommended Verification
|
|
176
|
+
|
|
177
|
+
1. Run a priced v9 exact-period search where the original total exceeds the final
|
|
178
|
+
total and verify the formatted values and label.
|
|
179
|
+
2. Verify discounted v9 alternative periods independently.
|
|
180
|
+
3. Run a v9 search without a discount and confirm existing rendering is unchanged.
|
|
181
|
+
4. Verify a missing v9 discount name produces an empty `applied` array.
|
|
182
|
+
5. Verify v9 rejects `month`, `dates`, `nights`, and `weekend` before transport.
|
|
183
|
+
6. Run an empty v9 query and confirm it returns searchable inventory without a
|
|
184
|
+
dummy occupancy value.
|
|
185
|
+
7. Recheck a discounted v10 search and confirm its existing multi-entry behavior
|
|
186
|
+
remains unchanged.
|
|
187
|
+
8. Quote a v9 and v10 rental with a zero-value `other` service and confirm the
|
|
188
|
+
empty section is absent.
|
|
189
|
+
9. Confirm a mixed `other` section retains only its non-zero lines.
|
|
190
|
+
10. Quote a discounted v10 rental and render `item.modifiers`, item-level
|
|
191
|
+
`totalBeforeModifiers`, and card-level `totalBeforeModifiers`.
|
|
192
|
+
11. Confirm a v9 quote continues to omit the modifier fields.
|
|
193
|
+
12. Verify a v10 modifier rendered as a dedicated line still contributes to the
|
|
194
|
+
card-level `totalBeforeModifiers`.
|
|
@@ -124,6 +124,9 @@ The public output type is unchanged, but v10 search cards now reflect the REST p
|
|
|
124
124
|
Starting with 2.11.0, priced v10 items and alternative periods may also include
|
|
125
125
|
optional localized `discount` details. See `../../search.md`.
|
|
126
126
|
|
|
127
|
+
Starting with 2.12.0, legacy v9 maps the same optional shape from its aggregated
|
|
128
|
+
original total and discount name when the original total exceeds the final total.
|
|
129
|
+
|
|
127
130
|
## Backend Behavior
|
|
128
131
|
|
|
129
132
|
- Fixed-period and flexible searches are priced by the REST backend; occupancy is required for priced searches.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-office/website-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.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,21 +41,23 @@
|
|
|
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.12.0",
|
|
45
45
|
"effect": "4.0.0-beta.85",
|
|
46
|
-
"graphql": "
|
|
46
|
+
"graphql": "17.0.2",
|
|
47
47
|
"yaml": "^2.9.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@effect/
|
|
51
|
-
"@graphql-codegen/cli": "7.
|
|
52
|
-
"@graphql-codegen/client-preset": "6.
|
|
53
|
-
"@types/node": "26.
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
|
|
50
|
+
"@effect/tsgo": "0.31.0",
|
|
51
|
+
"@graphql-codegen/cli": "7.2.0",
|
|
52
|
+
"@graphql-codegen/client-preset": "6.1.1",
|
|
53
|
+
"@types/node": "26.1.2",
|
|
54
|
+
"oxfmt": "0.62.0",
|
|
55
|
+
"oxlint": "1.77.0",
|
|
56
|
+
"tsdown": "0.22.14",
|
|
57
|
+
"typescript": "7.0.2"
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": "^22.0.0 || ^24.0.0 || ^25.0.0 || >=26.0.0"
|
|
59
61
|
},
|
|
60
62
|
"scripts": {
|
|
61
63
|
"p": "pnpm run playground:json",
|
|
@@ -72,7 +74,7 @@
|
|
|
72
74
|
"lint:fix": "oxlint --fix .",
|
|
73
75
|
"fmt": "oxfmt",
|
|
74
76
|
"fmt:check": "oxfmt --check",
|
|
75
|
-
"check": "pnpm run typecheck && pnpm run lint",
|
|
77
|
+
"check": "pnpm run typecheck && pnpm run lint && pnpm run fmt:check",
|
|
76
78
|
"test": "pnpm run build && node --test test/*.test.mjs",
|
|
77
79
|
"playground:custom-attributes": "pnpm run build && node --env-file=.env playground/custom-attributes.ts"
|
|
78
80
|
}
|