@v-office/website-sdk 2.0.0 → 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.
- package/README.md +33 -31
- package/dist/cli.mjs +6 -4
- package/dist/{client-BSUd3vuc.mjs → client-xkXV7Nf-.mjs} +32 -16
- package/dist/index.d.mts +613 -1140
- package/dist/index.mjs +3 -3
- package/dist/instructions/CHANGELOG.md +1 -0
- package/dist/instructions/MIGRATION.md +1 -0
- package/dist/instructions/README.md +14 -12
- package/dist/instructions/availability.md +9 -9
- package/dist/instructions/booking.md +33 -33
- package/dist/instructions/contact.md +34 -16
- package/dist/instructions/creation.md +48 -48
- package/dist/instructions/document-structured-json.md +100 -0
- package/dist/instructions/filter.md +5 -3
- package/dist/instructions/quote.md +72 -48
- package/dist/instructions/rentals.md +3 -3
- package/dist/instructions/search.md +36 -31
- package/dist/instructions/versions/2.0.0/MIGRATION.md +17 -17
- package/dist/instructions/versions/2.1.0/CHANGELOG.md +32 -0
- package/dist/instructions/versions/2.1.0/MIGRATION.md +89 -0
- package/dist/{quote-1uEIO44v.mjs → quote--25SMlYS.mjs} +27 -4
- package/dist/{rentals-Quwc78o2.mjs → rentals-DCKUaLnB.mjs} +1 -1
- package/dist/{search-GRQeXDvo.mjs → search-8iCC0Nel.mjs} +2 -2
- package/dist/{to-rental-highlights-FNZBR4aD.mjs → to-rental-highlights-CZYJeR1D.mjs} +12 -12
- package/dist/translations/shared/de-DE/contact.json +19 -0
- package/dist/translations/shared/de-DE/quote.json +5 -1
- package/dist/translations/shared/en-US/contact.json +19 -0
- package/dist/translations/shared/en-US/quote.json +5 -1
- package/dist/translations/v10/de-DE/mapped-search-filters.json +3 -0
- package/dist/translations/v10/en-US/mapped-search-filters.json +3 -0
- package/instructions/CHANGELOG.md +1 -0
- package/instructions/MIGRATION.md +1 -0
- package/instructions/README.md +14 -12
- package/instructions/availability.md +9 -9
- package/instructions/booking.md +33 -33
- package/instructions/contact.md +34 -16
- package/instructions/creation.md +48 -48
- package/instructions/document-structured-json.md +100 -0
- package/instructions/filter.md +5 -3
- package/instructions/quote.md +72 -48
- package/instructions/rentals.md +3 -3
- package/instructions/search.md +36 -31
- package/instructions/versions/2.0.0/MIGRATION.md +17 -17
- package/instructions/versions/2.1.0/CHANGELOG.md +32 -0
- package/instructions/versions/2.1.0/MIGRATION.md +89 -0
- package/package.json +4 -3
package/instructions/creation.md
CHANGED
|
@@ -5,27 +5,27 @@
|
|
|
5
5
|
Create the SDK with `createWebsiteSDK`:
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
|
-
import { createWebsiteSDK, defineWebsiteSDKOptions } from
|
|
8
|
+
import { createWebsiteSDK, defineWebsiteSDKOptions } from "@v-office/website-sdk";
|
|
9
9
|
|
|
10
10
|
const sdk = createWebsiteSDK({
|
|
11
11
|
config: {
|
|
12
|
-
backend:
|
|
13
|
-
apiEndpoint:
|
|
14
|
-
accessToken:
|
|
15
|
-
imageBaseUrl:
|
|
12
|
+
backend: "v10",
|
|
13
|
+
apiEndpoint: "https://api.example.com/graphql",
|
|
14
|
+
accessToken: "...",
|
|
15
|
+
imageBaseUrl: "https://images.example.com",
|
|
16
16
|
},
|
|
17
17
|
options: defineWebsiteSDKOptions({
|
|
18
18
|
rentalScope: {
|
|
19
|
-
propertyId:
|
|
19
|
+
propertyId: "property-1",
|
|
20
20
|
},
|
|
21
21
|
}),
|
|
22
|
-
})
|
|
22
|
+
});
|
|
23
23
|
|
|
24
24
|
try {
|
|
25
|
-
const rentals = await sdk.static.rentals.getRentals({ locale:
|
|
26
|
-
console.log(rentals)
|
|
25
|
+
const rentals = await sdk.static.rentals.getRentals({ locale: "de-DE" });
|
|
26
|
+
console.log(rentals);
|
|
27
27
|
} finally {
|
|
28
|
-
await sdk.dispose()
|
|
28
|
+
await sdk.dispose();
|
|
29
29
|
}
|
|
30
30
|
```
|
|
31
31
|
|
|
@@ -40,15 +40,15 @@ Backend config is required when creating the SDK.
|
|
|
40
40
|
```ts
|
|
41
41
|
const sdk = createWebsiteSDK({
|
|
42
42
|
config: {
|
|
43
|
-
backend:
|
|
44
|
-
graphqlUrl:
|
|
45
|
-
v1ApiBaseUrl:
|
|
46
|
-
v0ApiBaseUrl:
|
|
47
|
-
apiKey:
|
|
48
|
-
imageProxyBaseUrl:
|
|
49
|
-
rentalDataAttributes: [
|
|
43
|
+
backend: "v9",
|
|
44
|
+
graphqlUrl: "https://example.com/graphql",
|
|
45
|
+
v1ApiBaseUrl: "https://example.com/api/v1",
|
|
46
|
+
v0ApiBaseUrl: "https://example.com/api/v0",
|
|
47
|
+
apiKey: "...",
|
|
48
|
+
imageProxyBaseUrl: "https://images.example.com",
|
|
49
|
+
rentalDataAttributes: ["name", "description"],
|
|
50
50
|
},
|
|
51
|
-
})
|
|
51
|
+
});
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
`v10`:
|
|
@@ -56,12 +56,12 @@ const sdk = createWebsiteSDK({
|
|
|
56
56
|
```ts
|
|
57
57
|
const sdk = createWebsiteSDK({
|
|
58
58
|
config: {
|
|
59
|
-
backend:
|
|
60
|
-
apiEndpoint:
|
|
61
|
-
accessToken:
|
|
62
|
-
imageBaseUrl:
|
|
59
|
+
backend: "v10",
|
|
60
|
+
apiEndpoint: "https://api.example.com/graphql",
|
|
61
|
+
accessToken: "...",
|
|
62
|
+
imageBaseUrl: "https://images.example.com",
|
|
63
63
|
},
|
|
64
|
-
})
|
|
64
|
+
});
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
For v10, `backend: "v10"` is optional in TypeScript, but including it is clearer when config files are shared with the CLI.
|
|
@@ -73,25 +73,25 @@ For v10, `backend: "v10"` is optional in TypeScript, but including it is clearer
|
|
|
73
73
|
```ts
|
|
74
74
|
const options = defineWebsiteSDKOptions({
|
|
75
75
|
rentalScope: {
|
|
76
|
-
propertyId:
|
|
76
|
+
propertyId: "property-1",
|
|
77
77
|
},
|
|
78
|
-
rentalHighlightPrioritization: [
|
|
79
|
-
rentalPropertyHighlightPrioritization: [
|
|
78
|
+
rentalHighlightPrioritization: ["bedrooms", "bathrooms", "maxPersons", "wifi"],
|
|
79
|
+
rentalPropertyHighlightPrioritization: ["wifi", "parking"],
|
|
80
80
|
customAttributeFilterDefinitions: [],
|
|
81
81
|
translationOverrides: {},
|
|
82
|
-
})
|
|
82
|
+
});
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
`defineWebsiteSDKOptions` is a typed identity helper. It is useful when defining options separately because TypeScript checks the option structure without changing the runtime value. `defineCMSSDKOptions` remains exported as a compatibility alias, but new code should use `defineWebsiteSDKOptions`.
|
|
86
86
|
|
|
87
87
|
```ts
|
|
88
88
|
type WebsiteSDKOptions = {
|
|
89
|
-
translationOverrides?: TranslationOverrides
|
|
90
|
-
customAttributeFilterDefinitions?: readonly CustomAttributeFilterDefinition[]
|
|
91
|
-
rentalHighlightPrioritization?: readonly RentalHighlightPrioritizationKey[]
|
|
92
|
-
rentalPropertyHighlightPrioritization?: readonly RentalPropertyHighlightPrioritizationKey[]
|
|
93
|
-
rentalScope?: RentalScope
|
|
94
|
-
}
|
|
89
|
+
translationOverrides?: TranslationOverrides;
|
|
90
|
+
customAttributeFilterDefinitions?: readonly CustomAttributeFilterDefinition[];
|
|
91
|
+
rentalHighlightPrioritization?: readonly RentalHighlightPrioritizationKey[];
|
|
92
|
+
rentalPropertyHighlightPrioritization?: readonly RentalPropertyHighlightPrioritizationKey[];
|
|
93
|
+
rentalScope?: RentalScope;
|
|
94
|
+
};
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
Unset options are normalized by the SDK:
|
|
@@ -109,9 +109,9 @@ Use `rentalScope` to restrict all rental lists and searches created by this SDK
|
|
|
109
109
|
```ts
|
|
110
110
|
const options = defineWebsiteSDKOptions({
|
|
111
111
|
rentalScope: {
|
|
112
|
-
propertyId:
|
|
112
|
+
propertyId: "property-1",
|
|
113
113
|
},
|
|
114
|
-
})
|
|
114
|
+
});
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
`propertyId` is a unified SDK option:
|
|
@@ -130,20 +130,20 @@ Use `customAttributeFilterDefinitions` to add SDK-known filter keys for custom a
|
|
|
130
130
|
const options = defineWebsiteSDKOptions({
|
|
131
131
|
customAttributeFilterDefinitions: [
|
|
132
132
|
{
|
|
133
|
-
key:
|
|
134
|
-
source:
|
|
135
|
-
category:
|
|
133
|
+
key: "region",
|
|
134
|
+
source: "customAttribute",
|
|
135
|
+
category: "ESSENTIALS",
|
|
136
136
|
label: {
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
"de-DE": "Region",
|
|
138
|
+
"en-US": "Region",
|
|
139
139
|
},
|
|
140
|
-
type:
|
|
140
|
+
type: "option",
|
|
141
141
|
options: [
|
|
142
142
|
{
|
|
143
|
-
value:
|
|
143
|
+
value: "north",
|
|
144
144
|
label: {
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
"de-DE": "Nord",
|
|
146
|
+
"en-US": "North",
|
|
147
147
|
},
|
|
148
148
|
},
|
|
149
149
|
],
|
|
@@ -151,7 +151,7 @@ const options = defineWebsiteSDKOptions({
|
|
|
151
151
|
internal: false,
|
|
152
152
|
},
|
|
153
153
|
],
|
|
154
|
-
})
|
|
154
|
+
});
|
|
155
155
|
```
|
|
156
156
|
|
|
157
157
|
Supported filter types:
|
|
@@ -181,11 +181,11 @@ Use `translationOverrides` to override SDK translation keys:
|
|
|
181
181
|
```ts
|
|
182
182
|
const options = defineWebsiteSDKOptions({
|
|
183
183
|
translationOverrides: {
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
"de-DE": {
|
|
185
|
+
"filter.wifi.label": "WLAN",
|
|
186
186
|
},
|
|
187
187
|
},
|
|
188
|
-
})
|
|
188
|
+
});
|
|
189
189
|
```
|
|
190
190
|
|
|
191
191
|
Overrides are applied by the SDK translation service and affect labels generated by filters, rentals, search, availability, and quote output.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Structured Document JSON
|
|
2
|
+
|
|
3
|
+
## Service
|
|
4
|
+
|
|
5
|
+
Use the v10 static documents API to fetch published terms and privacy policy revisions:
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
if (sdk.backend === "v10") {
|
|
9
|
+
const documents = await sdk.static.documents.getTermsAndPrivacyPolicy({ locale: "de-DE" });
|
|
10
|
+
}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Input is `{ locale: "de-DE" | "en-US" }`. Output is `Promise<DocumentsGetTermsAndPrivacyPolicyOutput>` with optional `terms` and `privacyPolicy`, each shaped as `{ subject, data }`.
|
|
14
|
+
|
|
15
|
+
This API is v10-only, has no dedicated CLI command yet, and returns `data` as a string. When `data` contains structured document JSON, render it with the rules below.
|
|
16
|
+
|
|
17
|
+
## At A Glance
|
|
18
|
+
|
|
19
|
+
The document is a JSON array. Each item is either plain text or a structured tool object.
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
[
|
|
23
|
+
"plain text",
|
|
24
|
+
"\n",
|
|
25
|
+
{
|
|
26
|
+
"tool": "link",
|
|
27
|
+
"settings": { "href": "https://example.com" },
|
|
28
|
+
"children": [{ "tool": "bold", "children": ["Example"] }]
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Base Rules
|
|
34
|
+
|
|
35
|
+
- Root value: always an array. An empty document is `[]`.
|
|
36
|
+
- Text part: any JSON string. `"\n"` means a line break. A string may also contain embedded `\n`.
|
|
37
|
+
- Tool part: `{ "tool": string, "settings"?: object, "children"?: array }`.
|
|
38
|
+
- `tool`: required name that defines how to interpret `settings` and `children`.
|
|
39
|
+
- `settings`: optional metadata object. Omit it when unused; do not rely on `null`.
|
|
40
|
+
- `children`: optional nested document array with the same shape as the root.
|
|
41
|
+
- Unknown tools have no standard meaning. Preserve them when round-tripping; skip or fallback gracefully when rendering.
|
|
42
|
+
- Internal cursor/selection marker tools are editor state, not document content, and should not be stored.
|
|
43
|
+
|
|
44
|
+
## Tool Sets
|
|
45
|
+
|
|
46
|
+
A document may use any subset of these tools. Custom producers may add more tool names.
|
|
47
|
+
|
|
48
|
+
## Built-In Tool Reference
|
|
49
|
+
|
|
50
|
+
- `bold`, `italic`, `underline`: formatting wrappers with `children`.
|
|
51
|
+
- `color`: `settings.textColor`; optional `settings.backgroundColor`; has `children`.
|
|
52
|
+
- `leading`: `settings.leading`; values: `tight`, `snug`, `normal`, `relaxed`, `loose`; has `children`.
|
|
53
|
+
- `alignment`: `settings.alignment`; values: `left`, `center`, `right`, `justify`; has `children`.
|
|
54
|
+
- `headline`: `settings.level` from `1` to `6`; has `children`.
|
|
55
|
+
- `horizontalLine`: no settings or children.
|
|
56
|
+
- `list`: `settings.numbered`; `children` are `item` tool objects.
|
|
57
|
+
- `item`: structural list item; meaningful inside `list`; uses `children`.
|
|
58
|
+
- `table`: `settings.headRows`, `settings.headColumns`; `children` are `row` tool objects.
|
|
59
|
+
- `row`: structural table row; meaningful inside `table`; `children` are `column` tool objects.
|
|
60
|
+
- `column`: structural table cell; meaningful inside `row`; uses `children`.
|
|
61
|
+
- `link`: `settings.href`; optional `settings.embedded` with `type` and `size`; non-embedded links use `children`.
|
|
62
|
+
- `image`: `settings.url`; optional `settings.caption`, `settings.cid`.
|
|
63
|
+
- `placeholder`: `settings.domain`, `settings.field`, `settings.type`; renders as `{{domain.field}}` in reading mode.
|
|
64
|
+
- `conditional`: `settings.service`, `settings.conditions[]` with `{ "condition": string, "fields": object }`; has conditional `children`.
|
|
65
|
+
- `snippet`: `settings.service`, `settings.topLevelEntity`, `settings.snippet`, `settings.config`; optional `settings.inline`.
|
|
66
|
+
- `ai`: optional `settings.prompt`, `settings.loadingText`; optional replacement `children`; reading mode renders empty text.
|
|
67
|
+
- `quote`: optional `settings.author`, `settings.datetime`, `settings.messengerId`, `settings.html`; treat HTML as untrusted and sanitize before rendering.
|
|
68
|
+
- `knowledgeBaseReference`: `settings.key`; has `children`.
|
|
69
|
+
- `knowledgeBaseLink`: `settings.articleId`; has `children`.
|
|
70
|
+
- `alert`: `settings.type`; values: `info`, `success`, `warning`, `error`; has `children`.
|
|
71
|
+
- `code`: `settings.code`; optional `settings.block`, `settings.language`.
|
|
72
|
+
|
|
73
|
+
Link embed `type` values: `youtube`, `figmaFile`, `figmaDesign`, `figmaBoard`, `heygen`, `heygenEmbeds`, `synthesia`, `iframe`.
|
|
74
|
+
|
|
75
|
+
Link embed `size` values: `small`, `medium`, `large`.
|
|
76
|
+
|
|
77
|
+
Code `language` values: `typescript`, `javascript`, `xml`, `json`, `yaml`, `css`, `graphql`.
|
|
78
|
+
|
|
79
|
+
## Edge Cases
|
|
80
|
+
|
|
81
|
+
- Missing `children` and empty `children: []` both mean no nested content.
|
|
82
|
+
- Missing `settings` is valid only when the tool has no required settings.
|
|
83
|
+
- Some tools ignore `children` even if present, for example `image`, `code`, `quote`, `snippet`, and embedded `link`.
|
|
84
|
+
- `placeholder`, `conditional`, `snippet`, and `knowledgeBaseLink` need external application context to render fully.
|
|
85
|
+
- `conditional.children` should only be displayed when its conditions pass.
|
|
86
|
+
- `snippet` content is rendered from `settings` by an external renderer, not stored in `children`.
|
|
87
|
+
- `quote.settings.html` can contain HTML; consumers should sanitize it even if it was already sanitized by the producer.
|
|
88
|
+
- `ai` is transient editing state. Consumers that render final read-only content should treat it as empty.
|
|
89
|
+
- `cid` on `image` may reference an attached resource instead of using only `url`.
|
|
90
|
+
- Structural tools `item`, `row`, and `column` are not meaningful as top-level document blocks.
|
|
91
|
+
|
|
92
|
+
## Compact Examples
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{ "tool": "headline", "settings": { "level": 2 }, "children": ["Heading"] }
|
|
96
|
+
{ "tool": "list", "settings": { "numbered": false }, "children": [{ "tool": "item", "children": ["Item"] }] }
|
|
97
|
+
{ "tool": "image", "settings": { "url": "https://example.com/image.png", "caption": "Optional" } }
|
|
98
|
+
{ "tool": "placeholder", "settings": { "domain": "User", "field": "email", "type": "string" } }
|
|
99
|
+
{ "tool": "code", "settings": { "block": true, "language": "typescript", "code": "const value = 1" } }
|
|
100
|
+
```
|
package/instructions/filter.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Use the static filter API to fetch localized search filter definitions:
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
|
-
const filters = await sdk.static.filter.getFilters({ locale:
|
|
8
|
+
const filters = await sdk.static.filter.getFilters({ locale: "de-DE" });
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
The service is implemented for both `v9` and `v10` backends and returns normalized filters for building search UIs.
|
|
@@ -14,8 +14,8 @@ The service is implemented for both `v9` and `v10` backends and returns normaliz
|
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
type FilterGetFiltersInput = {
|
|
17
|
-
locale:
|
|
18
|
-
}
|
|
17
|
+
locale: "de-DE" | "en-US";
|
|
18
|
+
};
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
Sample:
|
|
@@ -129,6 +129,8 @@ Optional `WebsiteSDKOptions` can add public custom filters:
|
|
|
129
129
|
|
|
130
130
|
Only custom definitions with `searchable: true` and `internal: false` are exposed by `getFilters`.
|
|
131
131
|
|
|
132
|
+
For v10, `getFilters` also exposes the mapped BooleanFilter `pets`, labeled `Dogs welcome` / `Hunde willkommen`. It maps to one pet in search occupancy; use `petsCount` when the UI needs an exact pet count instead.
|
|
133
|
+
|
|
132
134
|
## CLI Usage
|
|
133
135
|
|
|
134
136
|
Fetch filters with environment-based config:
|
package/instructions/quote.md
CHANGED
|
@@ -5,36 +5,36 @@
|
|
|
5
5
|
Use the live quote API to price a stay and get selectable booking options:
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
|
-
const result = await sdk.live.quote.quote(input)
|
|
8
|
+
const result = await sdk.live.quote.quote(input);
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
If the quote is available, the returned `GuestQuote` can be updated through selection helpers:
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
|
-
const withService = await sdk.live.quote.addAdditionalService({ quote, id:
|
|
15
|
-
const withPolicy = await sdk.live.quote.selectCancellationPolicy({ quote, id:
|
|
14
|
+
const withService = await sdk.live.quote.addAdditionalService({ quote, id: "linen" });
|
|
15
|
+
const withPolicy = await sdk.live.quote.selectCancellationPolicy({ quote, id: "alternative" });
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Input
|
|
19
19
|
|
|
20
20
|
```ts
|
|
21
21
|
type QuoteQuoteInput = {
|
|
22
|
-
locale:
|
|
23
|
-
rentalId: string
|
|
22
|
+
locale: "de-DE" | "en-US";
|
|
23
|
+
rentalId: string;
|
|
24
24
|
period: {
|
|
25
|
-
start: string
|
|
26
|
-
end: string
|
|
27
|
-
}
|
|
25
|
+
start: string;
|
|
26
|
+
end: string;
|
|
27
|
+
};
|
|
28
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
|
-
}
|
|
29
|
+
adults: number;
|
|
30
|
+
children: number;
|
|
31
|
+
childrenAges?: number[];
|
|
32
|
+
babies: number;
|
|
33
|
+
pets: number;
|
|
34
|
+
};
|
|
35
|
+
destinationCountryCode?: string;
|
|
36
|
+
voucher?: string;
|
|
37
|
+
};
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
`GuestQuoteInput` remains available as a legacy alias.
|
|
@@ -62,6 +62,7 @@ Sample:
|
|
|
62
62
|
```
|
|
63
63
|
|
|
64
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.
|
|
65
66
|
|
|
66
67
|
## Output
|
|
67
68
|
|
|
@@ -88,6 +89,11 @@ Available sample:
|
|
|
88
89
|
],
|
|
89
90
|
"total": "1,200.00 EUR"
|
|
90
91
|
},
|
|
92
|
+
"voucher": {
|
|
93
|
+
"code": "SUMMER26",
|
|
94
|
+
"status": "applied",
|
|
95
|
+
"message": "The voucher code was applied."
|
|
96
|
+
},
|
|
91
97
|
"additionalServices": [
|
|
92
98
|
{
|
|
93
99
|
"id": "linen",
|
|
@@ -131,7 +137,23 @@ Unavailable sample:
|
|
|
131
137
|
}
|
|
132
138
|
```
|
|
133
139
|
|
|
134
|
-
Selection methods return `{ ok: true, quote }` or `{ ok: false, error }`. Possible selection errors include unknown additional service, additional service limit exceeded, unknown cancellation policy,
|
|
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.
|
|
135
157
|
|
|
136
158
|
## Additional Services
|
|
137
159
|
|
|
@@ -142,6 +164,7 @@ Additional services are exposed on an available quote as `quote.additionalServic
|
|
|
142
164
|
"id": "linen",
|
|
143
165
|
"label": "Bed linen",
|
|
144
166
|
"charge": "25.00 EUR",
|
|
167
|
+
"available": true,
|
|
145
168
|
"maxPerBooking": 1,
|
|
146
169
|
"description": "Bed linen package"
|
|
147
170
|
}
|
|
@@ -150,17 +173,17 @@ Additional services are exposed on an available quote as `quote.additionalServic
|
|
|
150
173
|
Use the service `id` to add or remove a service selection:
|
|
151
174
|
|
|
152
175
|
```ts
|
|
153
|
-
const added = await sdk.live.quote.addAdditionalService({ quote, id:
|
|
154
|
-
if (added.ok) quote = added.quote
|
|
176
|
+
const added = await sdk.live.quote.addAdditionalService({ quote, id: "linen" });
|
|
177
|
+
if (added.ok) quote = added.quote;
|
|
155
178
|
|
|
156
|
-
const removed = await sdk.live.quote.removeAdditionalService({ quote, id:
|
|
157
|
-
if (removed.ok) quote = removed.quote
|
|
179
|
+
const removed = await sdk.live.quote.removeAdditionalService({ quote, id: "linen" });
|
|
180
|
+
if (removed.ok) quote = removed.quote;
|
|
158
181
|
|
|
159
|
-
const cleared = await sdk.live.quote.clearAdditionalServices({ quote })
|
|
160
|
-
if (cleared.ok) quote = cleared.quote
|
|
182
|
+
const cleared = await sdk.live.quote.clearAdditionalServices({ quote });
|
|
183
|
+
if (cleared.ok) quote = cleared.quote;
|
|
161
184
|
```
|
|
162
185
|
|
|
163
|
-
Each successful change returns a new quote with recalculated `bookingCardInformation.total`. Handle `{ ok: false, error }` for unknown service ids
|
|
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`.
|
|
164
187
|
|
|
165
188
|
## Cancellation Policies
|
|
166
189
|
|
|
@@ -171,6 +194,7 @@ Cancellation policies are exposed on `quote.cancellationPolicies` when the backe
|
|
|
171
194
|
"id": "alternative",
|
|
172
195
|
"label": "Flexible cancellation",
|
|
173
196
|
"selected": false,
|
|
197
|
+
"available": true,
|
|
174
198
|
"markUpPercentage": "10%",
|
|
175
199
|
"processingFee": "25.00 EUR",
|
|
176
200
|
"rules": [
|
|
@@ -187,10 +211,10 @@ Select a policy by id:
|
|
|
187
211
|
```ts
|
|
188
212
|
const selected = await sdk.live.quote.selectCancellationPolicy({
|
|
189
213
|
quote,
|
|
190
|
-
id:
|
|
191
|
-
})
|
|
214
|
+
id: "alternative",
|
|
215
|
+
});
|
|
192
216
|
|
|
193
|
-
if (selected.ok) quote = selected.quote
|
|
217
|
+
if (selected.ok) quote = selected.quote;
|
|
194
218
|
```
|
|
195
219
|
|
|
196
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.
|
|
@@ -228,18 +252,18 @@ Use `selectInsurance` to choose no insurance or a product:
|
|
|
228
252
|
quote = await sdk.live.quote.selectInsurance({
|
|
229
253
|
quote,
|
|
230
254
|
selection: {
|
|
231
|
-
kind:
|
|
232
|
-
id:
|
|
255
|
+
kind: "insurance",
|
|
256
|
+
id: "ergo",
|
|
233
257
|
travelers: [
|
|
234
258
|
{
|
|
235
|
-
salutation:
|
|
236
|
-
forename:
|
|
237
|
-
surname:
|
|
238
|
-
birthday:
|
|
259
|
+
salutation: "Ms",
|
|
260
|
+
forename: "Jane",
|
|
261
|
+
surname: "Doe",
|
|
262
|
+
birthday: "1990-01-01",
|
|
239
263
|
},
|
|
240
264
|
],
|
|
241
265
|
},
|
|
242
|
-
})
|
|
266
|
+
});
|
|
243
267
|
```
|
|
244
268
|
|
|
245
269
|
For insurance products that require a pre-contract, provide customer information:
|
|
@@ -248,18 +272,18 @@ For insurance products that require a pre-contract, provide customer information
|
|
|
248
272
|
quote = await sdk.live.quote.createInsurancePreContract({
|
|
249
273
|
quote,
|
|
250
274
|
customerInformation: {
|
|
251
|
-
destinationCountryCode:
|
|
275
|
+
destinationCountryCode: "DE",
|
|
252
276
|
address: {
|
|
253
|
-
street:
|
|
254
|
-
housenumber:
|
|
255
|
-
postalcode:
|
|
256
|
-
city:
|
|
257
|
-
countryCode:
|
|
277
|
+
street: "Main Street",
|
|
278
|
+
housenumber: "1",
|
|
279
|
+
postalcode: "12345",
|
|
280
|
+
city: "Berlin",
|
|
281
|
+
countryCode: "DE",
|
|
258
282
|
},
|
|
259
|
-
email:
|
|
260
|
-
mobile:
|
|
283
|
+
email: "jane@example.com",
|
|
284
|
+
mobile: "+49123456789",
|
|
261
285
|
},
|
|
262
|
-
})
|
|
286
|
+
});
|
|
263
287
|
```
|
|
264
288
|
|
|
265
289
|
Select an insurance payment method before booking insurance:
|
|
@@ -268,10 +292,10 @@ Select an insurance payment method before booking insurance:
|
|
|
268
292
|
quote = await sdk.live.quote.selectInsurancePayment({
|
|
269
293
|
quote,
|
|
270
294
|
paymentInformation: {
|
|
271
|
-
kind:
|
|
272
|
-
iban:
|
|
295
|
+
kind: "sepa_debit",
|
|
296
|
+
iban: "DE02120300000000202051",
|
|
273
297
|
},
|
|
274
|
-
})
|
|
298
|
+
});
|
|
275
299
|
```
|
|
276
300
|
|
|
277
301
|
After the rental booking is created, complete insurance booking with the booking number and guest token:
|
|
@@ -281,7 +305,7 @@ const insuranceBooking = await sdk.live.quote.bookInsurance({
|
|
|
281
305
|
quote,
|
|
282
306
|
bookingNumber: booking.bookingNumber,
|
|
283
307
|
guestToken: booking.guestToken,
|
|
284
|
-
})
|
|
308
|
+
});
|
|
285
309
|
```
|
|
286
310
|
|
|
287
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.
|
package/instructions/rentals.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Use the static rentals API to fetch localized rental summaries:
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
|
-
const rentals = await sdk.static.rentals.getRentals({ locale:
|
|
8
|
+
const rentals = await sdk.static.rentals.getRentals({ locale: "de-DE" });
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
The service is implemented for both `v9` and `v10` backends and returns one normalized item per rental.
|
|
@@ -14,8 +14,8 @@ The service is implemented for both `v9` and `v10` backends and returns one norm
|
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
type RentalRentalsInput = {
|
|
17
|
-
locale:
|
|
18
|
-
}
|
|
17
|
+
locale: "de-DE" | "en-US";
|
|
18
|
+
};
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
Sample:
|