@v-office/website-sdk 1.2.1 → 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 +93 -232
- package/dist/cli.mjs +105 -84
- package/dist/client-xkXV7Nf-.mjs +5127 -0
- package/dist/index.d.mts +1444 -11259
- package/dist/index.mjs +16 -4
- package/dist/instructions/CHANGELOG.md +10 -0
- package/dist/instructions/MIGRATION.md +10 -0
- package/dist/instructions/README.md +64 -0
- package/dist/instructions/availability.md +157 -0
- package/dist/instructions/booking.md +165 -0
- package/dist/instructions/contact.md +110 -0
- package/dist/instructions/creation.md +223 -0
- package/dist/instructions/document-structured-json.md +100 -0
- package/dist/instructions/filter.md +158 -0
- package/dist/instructions/quote.md +342 -0
- package/dist/instructions/rentals.md +152 -0
- package/dist/instructions/search.md +238 -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/instructions/versions/2.1.0/CHANGELOG.md +32 -0
- package/dist/instructions/versions/2.1.0/MIGRATION.md +89 -0
- package/dist/{quote-DQGps4dy.mjs → quote--25SMlYS.mjs} +41 -19
- package/dist/{rentals-plxPVx83.mjs → rentals-DCKUaLnB.mjs} +22 -16
- package/dist/{search-BuR5apFw.mjs → search-8iCC0Nel.mjs} +40 -23
- package/dist/to-rental-highlights-CZYJeR1D.mjs +5905 -0
- 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 +10 -0
- package/instructions/MIGRATION.md +10 -0
- package/instructions/README.md +64 -0
- package/instructions/availability.md +157 -0
- package/instructions/booking.md +165 -0
- package/instructions/contact.md +110 -0
- package/instructions/creation.md +223 -0
- package/instructions/document-structured-json.md +100 -0
- package/instructions/filter.md +158 -0
- package/instructions/quote.md +342 -0
- package/instructions/rentals.md +152 -0
- package/instructions/search.md +238 -0
- package/instructions/versions/2.0.0/CHANGELOG.md +69 -0
- package/instructions/versions/2.0.0/MIGRATION.md +223 -0
- package/instructions/versions/2.1.0/CHANGELOG.md +32 -0
- package/instructions/versions/2.1.0/MIGRATION.md +89 -0
- package/package.json +42 -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,223 @@
|
|
|
1
|
+
# Creation
|
|
2
|
+
|
|
3
|
+
## Service
|
|
4
|
+
|
|
5
|
+
Create the SDK with `createWebsiteSDK`:
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { createWebsiteSDK, defineWebsiteSDKOptions } from "@v-office/website-sdk";
|
|
9
|
+
|
|
10
|
+
const sdk = createWebsiteSDK({
|
|
11
|
+
config: {
|
|
12
|
+
backend: "v10",
|
|
13
|
+
apiEndpoint: "https://api.example.com/graphql",
|
|
14
|
+
accessToken: "...",
|
|
15
|
+
imageBaseUrl: "https://images.example.com",
|
|
16
|
+
},
|
|
17
|
+
options: defineWebsiteSDKOptions({
|
|
18
|
+
rentalScope: {
|
|
19
|
+
propertyId: "property-1",
|
|
20
|
+
},
|
|
21
|
+
}),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
const rentals = await sdk.static.rentals.getRentals({ locale: "de-DE" });
|
|
26
|
+
console.log(rentals);
|
|
27
|
+
} finally {
|
|
28
|
+
await sdk.dispose();
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`createWebsiteSDK` returns the public `WebsiteSDK` facade with `static`, `live`, and `dispose` APIs. Call `dispose()` when the SDK instance is no longer needed. For v9, `dispose()` currently resolves without tearing down shared runtime state because the v9 facade does not hold one.
|
|
33
|
+
|
|
34
|
+
## Configuration
|
|
35
|
+
|
|
36
|
+
Backend config is required when creating the SDK.
|
|
37
|
+
|
|
38
|
+
`v9`:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
const sdk = createWebsiteSDK({
|
|
42
|
+
config: {
|
|
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
|
+
},
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`v10`:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
const sdk = createWebsiteSDK({
|
|
58
|
+
config: {
|
|
59
|
+
backend: "v10",
|
|
60
|
+
apiEndpoint: "https://api.example.com/graphql",
|
|
61
|
+
accessToken: "...",
|
|
62
|
+
imageBaseUrl: "https://images.example.com",
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
For v10, `backend: "v10"` is optional in TypeScript, but including it is clearer when config files are shared with the CLI.
|
|
68
|
+
|
|
69
|
+
## WebsiteSDKOptions
|
|
70
|
+
|
|
71
|
+
`options` is optional and is passed separately from backend config:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
const options = defineWebsiteSDKOptions({
|
|
75
|
+
rentalScope: {
|
|
76
|
+
propertyId: "property-1",
|
|
77
|
+
},
|
|
78
|
+
rentalHighlightPrioritization: ["bedrooms", "bathrooms", "maxPersons", "wifi"],
|
|
79
|
+
rentalPropertyHighlightPrioritization: ["wifi", "parking"],
|
|
80
|
+
customAttributeFilterDefinitions: [],
|
|
81
|
+
translationOverrides: {},
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
|
|
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
|
+
|
|
87
|
+
```ts
|
|
88
|
+
type WebsiteSDKOptions = {
|
|
89
|
+
translationOverrides?: TranslationOverrides;
|
|
90
|
+
customAttributeFilterDefinitions?: readonly CustomAttributeFilterDefinition[];
|
|
91
|
+
rentalHighlightPrioritization?: readonly RentalHighlightPrioritizationKey[];
|
|
92
|
+
rentalPropertyHighlightPrioritization?: readonly RentalPropertyHighlightPrioritizationKey[];
|
|
93
|
+
rentalScope?: RentalScope;
|
|
94
|
+
};
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Unset options are normalized by the SDK:
|
|
98
|
+
|
|
99
|
+
- `customAttributeFilterDefinitions` defaults to `[]`.
|
|
100
|
+
- `rentalHighlightPrioritization` defaults to the SDK default rental highlight order.
|
|
101
|
+
- `rentalPropertyHighlightPrioritization` defaults to the SDK default property highlight order.
|
|
102
|
+
- `rentalScope` defaults to `{}`.
|
|
103
|
+
- `translationOverrides` is omitted unless provided.
|
|
104
|
+
|
|
105
|
+
## Rental Scope
|
|
106
|
+
|
|
107
|
+
Use `rentalScope` to restrict all rental lists and searches created by this SDK instance:
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
const options = defineWebsiteSDKOptions({
|
|
111
|
+
rentalScope: {
|
|
112
|
+
propertyId: "property-1",
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
`propertyId` is a unified SDK option:
|
|
118
|
+
|
|
119
|
+
- `v9` static rentals are filtered by `voffice_facility_id`.
|
|
120
|
+
- `v9` live search maps it to the generated `VofficeFilter.falicityid` field.
|
|
121
|
+
- `v10` static rentals and live search map it to the generated `rentals_RentalSummaryFilter.propertyId` field.
|
|
122
|
+
|
|
123
|
+
The scope is always applied internally and is not returned by `static.filter.getFilters(...)`. Use it for website-level or tenant-level constraints.
|
|
124
|
+
|
|
125
|
+
## Custom Attribute Filter Definitions
|
|
126
|
+
|
|
127
|
+
Use `customAttributeFilterDefinitions` to add SDK-known filter keys for custom attributes, v9 backend filters, or composed filters:
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
const options = defineWebsiteSDKOptions({
|
|
131
|
+
customAttributeFilterDefinitions: [
|
|
132
|
+
{
|
|
133
|
+
key: "region",
|
|
134
|
+
source: "customAttribute",
|
|
135
|
+
category: "ESSENTIALS",
|
|
136
|
+
label: {
|
|
137
|
+
"de-DE": "Region",
|
|
138
|
+
"en-US": "Region",
|
|
139
|
+
},
|
|
140
|
+
type: "option",
|
|
141
|
+
options: [
|
|
142
|
+
{
|
|
143
|
+
value: "north",
|
|
144
|
+
label: {
|
|
145
|
+
"de-DE": "Nord",
|
|
146
|
+
"en-US": "North",
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
searchable: true,
|
|
151
|
+
internal: false,
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
});
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Supported filter types:
|
|
158
|
+
|
|
159
|
+
- `boolean`: accepts enabled query values such as `?key`, `?key=true`, or `?key=1`.
|
|
160
|
+
- `int`: accepts integer query values and can expose optional `numericBounds` for UI controls.
|
|
161
|
+
- `option`: accepts one of the configured `options` values and exposes those options through `getFilters`.
|
|
162
|
+
- `string`: accepts any non-empty query value as an exact raw value.
|
|
163
|
+
- `complex`: composition-only type that expands one boolean query-string filter into other configured filters.
|
|
164
|
+
|
|
165
|
+
Supported sources:
|
|
166
|
+
|
|
167
|
+
- `customAttribute`: backed by custom attributes.
|
|
168
|
+
- `backendFilter`: backed by backend-defined search filter keys, mainly for v9 hub filters.
|
|
169
|
+
- `composition`: expands one boolean query-string filter into other configured filters.
|
|
170
|
+
|
|
171
|
+
Visibility:
|
|
172
|
+
|
|
173
|
+
- `internal: false` exposes searchable filters through `static.filter.getFilters(...)`.
|
|
174
|
+
- `internal: true` keeps filters usable by search and compositions but hides them from `getFilters`.
|
|
175
|
+
- `searchable: false` keeps custom attributes as display metadata only.
|
|
176
|
+
|
|
177
|
+
## Translation Overrides
|
|
178
|
+
|
|
179
|
+
Use `translationOverrides` to override SDK translation keys:
|
|
180
|
+
|
|
181
|
+
```ts
|
|
182
|
+
const options = defineWebsiteSDKOptions({
|
|
183
|
+
translationOverrides: {
|
|
184
|
+
"de-DE": {
|
|
185
|
+
"filter.wifi.label": "WLAN",
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Overrides are applied by the SDK translation service and affect labels generated by filters, rentals, search, availability, and quote output.
|
|
192
|
+
|
|
193
|
+
## CLI Usage
|
|
194
|
+
|
|
195
|
+
The CLI reads flat `WebsiteSDKConfig` JSON files and separate `WebsiteSDKOptions` JSON files:
|
|
196
|
+
|
|
197
|
+
```sh
|
|
198
|
+
website-sdk --backend v10 --config ./website-sdk-config.json --options ./website-sdk-options.json rentals --locale de-DE
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Example `website-sdk-config.v10.json`:
|
|
202
|
+
|
|
203
|
+
```json
|
|
204
|
+
{
|
|
205
|
+
"backend": "v10",
|
|
206
|
+
"apiEndpoint": "https://api.example.com/graphql",
|
|
207
|
+
"accessToken": "...",
|
|
208
|
+
"imageBaseUrl": "https://images.example.com"
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Example `website-sdk-options.json`:
|
|
213
|
+
|
|
214
|
+
```json
|
|
215
|
+
{
|
|
216
|
+
"rentalScope": {
|
|
217
|
+
"propertyId": "property-1"
|
|
218
|
+
},
|
|
219
|
+
"rentalHighlightPrioritization": ["bedrooms", "bathrooms", "maxPersons", "wifi"],
|
|
220
|
+
"customAttributeFilterDefinitions": [],
|
|
221
|
+
"translationOverrides": {}
|
|
222
|
+
}
|
|
223
|
+
```
|
|
@@ -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
|
+
```
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Filter
|
|
2
|
+
|
|
3
|
+
## Service
|
|
4
|
+
|
|
5
|
+
Use the static filter API to fetch localized search filter definitions:
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
const filters = await sdk.static.filter.getFilters({ locale: "de-DE" });
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The service is implemented for both `v9` and `v10` backends and returns normalized filters for building search UIs.
|
|
12
|
+
|
|
13
|
+
## Input
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type FilterGetFiltersInput = {
|
|
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<FilterGetFiltersOutput>`, an array of filter definitions.
|
|
32
|
+
|
|
33
|
+
Sample:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
[
|
|
37
|
+
{
|
|
38
|
+
"searchParameterQueryKey": "wifi",
|
|
39
|
+
"label": "WiFi",
|
|
40
|
+
"category": "ESSENTIALS",
|
|
41
|
+
"type": "BooleanFilter"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"searchParameterQueryKey": "bedrooms",
|
|
45
|
+
"label": "Bedrooms",
|
|
46
|
+
"category": "ROOMS",
|
|
47
|
+
"type": "IntFilter",
|
|
48
|
+
"numericBounds": {
|
|
49
|
+
"min": 1,
|
|
50
|
+
"max": 8
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"searchParameterQueryKey": "region",
|
|
55
|
+
"label": "Region",
|
|
56
|
+
"category": "LOCATION",
|
|
57
|
+
"type": "OptionFilter",
|
|
58
|
+
"options": [
|
|
59
|
+
{
|
|
60
|
+
"value": "north",
|
|
61
|
+
"label": "North"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Filter variants:
|
|
69
|
+
|
|
70
|
+
- `BooleanFilter`: on/off query parameter.
|
|
71
|
+
- `IntFilter`: numeric query parameter, optionally with `numericBounds`.
|
|
72
|
+
- `OptionFilter`: query parameter with localized selectable `options`.
|
|
73
|
+
|
|
74
|
+
## Configuration
|
|
75
|
+
|
|
76
|
+
`v9` config:
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"backend": "v9",
|
|
81
|
+
"graphqlUrl": "https://example.com/graphql",
|
|
82
|
+
"v1ApiBaseUrl": "https://example.com/api/v1",
|
|
83
|
+
"apiKey": "...",
|
|
84
|
+
"imageProxyBaseUrl": "https://images.example.com"
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`v10` config:
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"backend": "v10",
|
|
93
|
+
"apiEndpoint": "https://api.example.com/graphql",
|
|
94
|
+
"accessToken": "...",
|
|
95
|
+
"imageBaseUrl": "https://images.example.com"
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Optional `WebsiteSDKOptions` can add public custom filters:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"customAttributeFilterDefinitions": [
|
|
104
|
+
{
|
|
105
|
+
"key": "region",
|
|
106
|
+
"source": "customAttribute",
|
|
107
|
+
"category": "ESSENTIALS",
|
|
108
|
+
"label": {
|
|
109
|
+
"de-DE": "Region",
|
|
110
|
+
"en-US": "Region"
|
|
111
|
+
},
|
|
112
|
+
"type": "option",
|
|
113
|
+
"options": [
|
|
114
|
+
{
|
|
115
|
+
"value": "north",
|
|
116
|
+
"label": {
|
|
117
|
+
"de-DE": "Norden",
|
|
118
|
+
"en-US": "North"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"searchable": true,
|
|
123
|
+
"internal": false
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"translationOverrides": {}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Only custom definitions with `searchable: true` and `internal: false` are exposed by `getFilters`.
|
|
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
|
+
|
|
134
|
+
## CLI Usage
|
|
135
|
+
|
|
136
|
+
Fetch filters with environment-based config:
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
website-sdk --backend v9 filters --locale en-US
|
|
140
|
+
website-sdk --backend v10 filters --locale de-DE
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Use files instead of environment variables:
|
|
144
|
+
|
|
145
|
+
```sh
|
|
146
|
+
website-sdk --backend v10 --config ./website-sdk-config.json --options ./website-sdk-options.json filters --locale de-DE
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Output defaults to JSON. Use `--output pretty` for inspected terminal output:
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
website-sdk --backend v10 filters --locale de-DE --output pretty
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Environment variables:
|
|
156
|
+
|
|
157
|
+
- `v9`: `HUB_GRAPHQL_URL`, `HUB_V1_API_BASE_URL`, optional `HUB_V0_API_BASE_URL`, `HUB_API_KEY`, `IMAGE_PROXY_BASE_URL`.
|
|
158
|
+
- `v10`: `VOFFICE_API_ENDPOINT`, `VOFFICE_LOCAL_DEV_ACCESS_TOKEN`, `VOFFICE_IMAGE_BASE_URL`.
|