@v-office/website-sdk 3.0.0 → 3.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/dist/cli.mjs +3 -3
- package/dist/{client-k4Gjwp60.mjs → client-C6r06QHZ.mjs} +31 -5
- package/dist/index.d.mts +82 -2
- package/dist/index.mjs +1 -1
- package/dist/instructions/CHANGELOG.md +1 -0
- package/dist/instructions/MIGRATION.md +1 -0
- package/dist/instructions/quote.md +17 -0
- package/dist/instructions/rentals.md +46 -6
- package/dist/instructions/search.md +25 -6
- package/dist/instructions/versions/3.1.0/CHANGELOG.md +47 -0
- package/dist/instructions/versions/3.1.0/MIGRATION.md +32 -0
- package/dist/{operations-DMqLD3e2.mjs → operations-Bc3WxjV8.mjs} +79 -3
- package/dist/{rentals-BIL52z4o.mjs → rentals-BP7dfcfg.mjs} +88 -25
- package/dist/{search-Buua-PAS.mjs → search-BvgpkUPo.mjs} +22 -11
- package/dist/{to-rental-highlights-BE6TdXYa.mjs → to-rental-highlights-9AbqVIso.mjs} +68 -32
- package/instructions/CHANGELOG.md +1 -0
- package/instructions/MIGRATION.md +1 -0
- package/instructions/quote.md +17 -0
- package/instructions/rentals.md +46 -6
- package/instructions/search.md +25 -6
- package/instructions/versions/3.1.0/CHANGELOG.md +47 -0
- package/instructions/versions/3.1.0/MIGRATION.md +32 -0
- package/instructions/versions/3.1.0/release.json +3 -0
- package/package.json +3 -3
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Migration: 3.0.0 to 3.1.0
|
|
2
|
+
|
|
3
|
+
No changes required.
|
|
4
|
+
|
|
5
|
+
## 1. Upgrade
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm add @v-office/website-sdk@3.1.0
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 2. Optional: stop parsing prices and discount names
|
|
12
|
+
|
|
13
|
+
- A site that reads a number out of `formattedTotal` or `discount.formattedOriginalTotal`
|
|
14
|
+
(for a strikethrough, a saving or a sort) can read `total.amount` and
|
|
15
|
+
`discount.originalTotal.amount` instead. The formatted strings use the locale's separators
|
|
16
|
+
("1.033,39 €", "€1,033.39"), so parsing them breaks between languages.
|
|
17
|
+
- A v10 site that filters or groups campaigns by `discount.applied[].label` can use
|
|
18
|
+
`discount.applied[].type`: the label is translated, the type is not.
|
|
19
|
+
|
|
20
|
+
## 3. English pages: German alt texts and room descriptions
|
|
21
|
+
|
|
22
|
+
An English page now gets the German alt text of an image and the German description of a room
|
|
23
|
+
where no English exists (v10: before, none). Mark them as German where `altFallback` or
|
|
24
|
+
`descriptionFallback` is set, for example `<img lang="de" …>`.
|
|
25
|
+
|
|
26
|
+
## 4. Optional: curate by key, not by text
|
|
27
|
+
|
|
28
|
+
A site that recognizes amenities, distances, highlights or room features by their text
|
|
29
|
+
(„Entfernung zum Strand", „WLAN") loses them on an English page. Read the facts instead:
|
|
30
|
+
`facts` in attribute subcategories and vicinity groups, `highlightFacts`, and `attributeFacts` /
|
|
31
|
+
`typeKey` on rooms. Match on `key`, read numbers from `value` (distances in meters), and show
|
|
32
|
+
`text`.
|
|
@@ -6799,7 +6799,7 @@ const documents = {
|
|
|
6799
6799
|
}
|
|
6800
6800
|
}]
|
|
6801
6801
|
},
|
|
6802
|
-
"\n query CoreSDK_RentalTexts(\n $language: String\n $voffice_ids: [Int!]\n $textAttributes: [String!]! = []\n ) {\n all(language: $language, voffice_ids: $voffice_ids) {\n voffice_id\n data(attributes: $textAttributes)\n voffice_facility {\n id\n data(attributes: $textAttributes)\n }\n }\n }\n": {
|
|
6802
|
+
"\n query CoreSDK_RentalTexts(\n $language: String\n $voffice_ids: [Int!]\n $textAttributes: [String!]! = []\n ) {\n all(language: $language, voffice_ids: $voffice_ids) {\n voffice_id\n data(attributes: $textAttributes)\n voffice_facility {\n id\n data(attributes: $textAttributes)\n }\n voffice_images {\n path\n title\n description\n }\n voffice_room_images {\n path\n title\n description\n }\n }\n }\n": {
|
|
6803
6803
|
kind: "Document",
|
|
6804
6804
|
definitions: [{
|
|
6805
6805
|
kind: "OperationDefinition",
|
|
@@ -6982,6 +6982,72 @@ const documents = {
|
|
|
6982
6982
|
}]
|
|
6983
6983
|
}]
|
|
6984
6984
|
}
|
|
6985
|
+
},
|
|
6986
|
+
{
|
|
6987
|
+
kind: "Field",
|
|
6988
|
+
name: {
|
|
6989
|
+
kind: "Name",
|
|
6990
|
+
value: "voffice_images"
|
|
6991
|
+
},
|
|
6992
|
+
selectionSet: {
|
|
6993
|
+
kind: "SelectionSet",
|
|
6994
|
+
selections: [
|
|
6995
|
+
{
|
|
6996
|
+
kind: "Field",
|
|
6997
|
+
name: {
|
|
6998
|
+
kind: "Name",
|
|
6999
|
+
value: "path"
|
|
7000
|
+
}
|
|
7001
|
+
},
|
|
7002
|
+
{
|
|
7003
|
+
kind: "Field",
|
|
7004
|
+
name: {
|
|
7005
|
+
kind: "Name",
|
|
7006
|
+
value: "title"
|
|
7007
|
+
}
|
|
7008
|
+
},
|
|
7009
|
+
{
|
|
7010
|
+
kind: "Field",
|
|
7011
|
+
name: {
|
|
7012
|
+
kind: "Name",
|
|
7013
|
+
value: "description"
|
|
7014
|
+
}
|
|
7015
|
+
}
|
|
7016
|
+
]
|
|
7017
|
+
}
|
|
7018
|
+
},
|
|
7019
|
+
{
|
|
7020
|
+
kind: "Field",
|
|
7021
|
+
name: {
|
|
7022
|
+
kind: "Name",
|
|
7023
|
+
value: "voffice_room_images"
|
|
7024
|
+
},
|
|
7025
|
+
selectionSet: {
|
|
7026
|
+
kind: "SelectionSet",
|
|
7027
|
+
selections: [
|
|
7028
|
+
{
|
|
7029
|
+
kind: "Field",
|
|
7030
|
+
name: {
|
|
7031
|
+
kind: "Name",
|
|
7032
|
+
value: "path"
|
|
7033
|
+
}
|
|
7034
|
+
},
|
|
7035
|
+
{
|
|
7036
|
+
kind: "Field",
|
|
7037
|
+
name: {
|
|
7038
|
+
kind: "Name",
|
|
7039
|
+
value: "title"
|
|
7040
|
+
}
|
|
7041
|
+
},
|
|
7042
|
+
{
|
|
7043
|
+
kind: "Field",
|
|
7044
|
+
name: {
|
|
7045
|
+
kind: "Name",
|
|
7046
|
+
value: "description"
|
|
7047
|
+
}
|
|
7048
|
+
}
|
|
7049
|
+
]
|
|
7050
|
+
}
|
|
6985
7051
|
}
|
|
6986
7052
|
]
|
|
6987
7053
|
}
|
|
@@ -8364,8 +8430,8 @@ graphql(`
|
|
|
8364
8430
|
}
|
|
8365
8431
|
}
|
|
8366
8432
|
`);
|
|
8367
|
-
/** Only the texts of rentals and their facility, in one language: what the
|
|
8368
|
-
* fallback
|
|
8433
|
+
/** Only the texts of rentals, their images and their facility, in one language: what the
|
|
8434
|
+
* fallback markers compare against, and nothing else. */
|
|
8369
8435
|
const rentalTextsQuery = graphql(`
|
|
8370
8436
|
query CoreSDK_RentalTexts(
|
|
8371
8437
|
$language: String
|
|
@@ -8379,6 +8445,16 @@ const rentalTextsQuery = graphql(`
|
|
|
8379
8445
|
id
|
|
8380
8446
|
data(attributes: $textAttributes)
|
|
8381
8447
|
}
|
|
8448
|
+
voffice_images {
|
|
8449
|
+
path
|
|
8450
|
+
title
|
|
8451
|
+
description
|
|
8452
|
+
}
|
|
8453
|
+
voffice_room_images {
|
|
8454
|
+
path
|
|
8455
|
+
title
|
|
8456
|
+
description
|
|
8457
|
+
}
|
|
8382
8458
|
}
|
|
8383
8459
|
}
|
|
8384
8460
|
`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Qt as V9_FACILITY_ATTRIBUTE_KEYS } from "./client-
|
|
2
|
-
import { S as parseVofficeFeedbackData, _ as VofficeUnitDataPropertyCategoryValues, a as hubFiltersQuery, c as rentalIdsQuery, d as rentalsAllByFacilityObjectGroupsWithoutFeedbacksQuery, f as rentalsAllFeedbacksQuery, g as VofficeUnitDataPropertyCategoryLabelKeys, h as VofficeUnitDataFieldSchemas, i as facilityTextsQuery, p as rentalsAllWithoutFeedbacksQuery, s as rentalFacilitiesForObjectGroupRelationQuery, u as rentalTextsQuery, v as VofficeUnitDataPropertyMetadata, w as parseVofficeUnitData, x as parseVofficeFacilityData } from "./operations-
|
|
3
|
-
import { a as
|
|
4
|
-
import { CoreSDKError, makeTranslate, renderResolvedCustomAttribute, toCustomAttributeList, toResolvedCustomAttributeCategoryTranslationKey, toReviewClassification } from "@v-office/sdk-core";
|
|
1
|
+
import { Qt as V9_FACILITY_ATTRIBUTE_KEYS } from "./client-C6r06QHZ.mjs";
|
|
2
|
+
import { S as parseVofficeFeedbackData, _ as VofficeUnitDataPropertyCategoryValues, a as hubFiltersQuery, c as rentalIdsQuery, d as rentalsAllByFacilityObjectGroupsWithoutFeedbacksQuery, f as rentalsAllFeedbacksQuery, g as VofficeUnitDataPropertyCategoryLabelKeys, h as VofficeUnitDataFieldSchemas, i as facilityTextsQuery, p as rentalsAllWithoutFeedbacksQuery, s as rentalFacilitiesForObjectGroupRelationQuery, u as rentalTextsQuery, v as VofficeUnitDataPropertyMetadata, w as parseVofficeUnitData, x as parseVofficeFacilityData } from "./operations-Bc3WxjV8.mjs";
|
|
3
|
+
import { a as toLocation, d as toLocalizedString, l as toCapacity, n as renderVofficePropertyAttribute, o as toFacilityImages, r as toV9Fact, s as toImages, t as toRentalHighlights, u as toAddress } from "./to-rental-highlights-9AbqVIso.mjs";
|
|
4
|
+
import { CoreSDKError, makeTranslate, pushFact, renderResolvedCustomAttribute, toCustomAttributeFact, toCustomAttributeList, toFact, toResolvedCustomAttributeCategoryTranslationKey, toReviewClassification } from "@v-office/sdk-core";
|
|
5
5
|
import { Effect } from "effect";
|
|
6
6
|
//#region src/legacy-v9/parser/rentals/to-description.ts
|
|
7
7
|
const toDescription = (data, locale) => {
|
|
@@ -27,25 +27,35 @@ const toDescription = (data, locale) => {
|
|
|
27
27
|
//#endregion
|
|
28
28
|
//#region src/legacy-v9/parser/rentals/to-property-attributes.ts
|
|
29
29
|
const toPropertyAttributes = ({ attributes, locale, translations }) => Effect.gen(function* () {
|
|
30
|
-
const
|
|
30
|
+
const group = {
|
|
31
|
+
items: [],
|
|
32
|
+
facts: []
|
|
33
|
+
};
|
|
31
34
|
const translate = makeTranslate(translations, locale);
|
|
32
35
|
for (const key of V9_FACILITY_ATTRIBUTE_KEYS) {
|
|
36
|
+
const value = attributes.known[key];
|
|
33
37
|
const item = yield* renderVofficePropertyAttribute({
|
|
34
38
|
key,
|
|
35
39
|
metadata: VofficeUnitDataPropertyMetadata[key],
|
|
36
40
|
locale,
|
|
37
41
|
translate,
|
|
38
|
-
value
|
|
42
|
+
value
|
|
39
43
|
});
|
|
40
|
-
if (item != null)
|
|
44
|
+
if (item != null) pushFact(group, toV9Fact({
|
|
45
|
+
key,
|
|
46
|
+
metadata: VofficeUnitDataPropertyMetadata[key],
|
|
47
|
+
text: item,
|
|
48
|
+
value
|
|
49
|
+
}));
|
|
41
50
|
}
|
|
42
|
-
if (items.length === 0) return [];
|
|
51
|
+
if (group.items.length === 0) return [];
|
|
43
52
|
const label = yield* translate(VofficeUnitDataPropertyCategoryLabelKeys.GENERAL, "GENERAL");
|
|
44
53
|
return [{
|
|
45
54
|
label,
|
|
46
55
|
subCategories: [{
|
|
47
56
|
label,
|
|
48
|
-
items
|
|
57
|
+
items: group.items,
|
|
58
|
+
facts: group.facts
|
|
49
59
|
}]
|
|
50
60
|
}];
|
|
51
61
|
});
|
|
@@ -78,7 +88,12 @@ const toPropertyHighlights = ({ attributes, highlightPrioritization, highlightSo
|
|
|
78
88
|
});
|
|
79
89
|
if (highlight != null && !seenHighlights.has(highlight)) {
|
|
80
90
|
seenHighlights.add(highlight);
|
|
81
|
-
highlights.push(
|
|
91
|
+
highlights.push(toV9Fact({
|
|
92
|
+
key,
|
|
93
|
+
metadata: VofficeUnitDataPropertyMetadata[key],
|
|
94
|
+
text: highlight,
|
|
95
|
+
value: attributes.known[key]
|
|
96
|
+
}));
|
|
82
97
|
}
|
|
83
98
|
continue;
|
|
84
99
|
}
|
|
@@ -87,7 +102,11 @@ const toPropertyHighlights = ({ attributes, highlightPrioritization, highlightSo
|
|
|
87
102
|
for (const highlight of toLineList(attributes.unknown[source.v9], locale)) {
|
|
88
103
|
if (seenHighlights.has(highlight)) continue;
|
|
89
104
|
seenHighlights.add(highlight);
|
|
90
|
-
highlights.push(
|
|
105
|
+
highlights.push(toFact({
|
|
106
|
+
key,
|
|
107
|
+
text: highlight,
|
|
108
|
+
value: void 0
|
|
109
|
+
}));
|
|
91
110
|
}
|
|
92
111
|
}
|
|
93
112
|
return highlights;
|
|
@@ -144,7 +163,10 @@ const toProperty = ({ facility, highlightPrioritization, highlightSources, local
|
|
|
144
163
|
if (Object.keys(description).length > 0) property.description = description;
|
|
145
164
|
if (images.length > 0) property.images = images;
|
|
146
165
|
if (attributes.length > 0) property.attributes = attributes;
|
|
147
|
-
if (highlights.length > 0)
|
|
166
|
+
if (highlights.length > 0) {
|
|
167
|
+
property.highlights = highlights.map((fact) => fact.text);
|
|
168
|
+
property.highlightFacts = highlights;
|
|
169
|
+
}
|
|
148
170
|
return property;
|
|
149
171
|
});
|
|
150
172
|
//#endregion
|
|
@@ -218,18 +240,29 @@ const toRentalAttributes = ({ locale, translations, attributes, customAttributes
|
|
|
218
240
|
subCategoriesByKey.set(categoryMetadata.key, subCategory);
|
|
219
241
|
category.subCategories.push(subCategory);
|
|
220
242
|
}
|
|
221
|
-
subCategory
|
|
243
|
+
pushFact(subCategory, toV9Fact({
|
|
244
|
+
key,
|
|
245
|
+
metadata,
|
|
246
|
+
text: attribute,
|
|
247
|
+
value
|
|
248
|
+
}));
|
|
222
249
|
}
|
|
223
250
|
for (const attribute of toCustomAttributeList(customAttributes)) {
|
|
224
251
|
const binding = attribute.v9;
|
|
225
252
|
if (binding === void 0) continue;
|
|
253
|
+
const value = knownAttributes[binding] ?? attributes.unknown[binding];
|
|
226
254
|
const rendered = renderResolvedCustomAttribute({
|
|
227
255
|
attribute,
|
|
228
256
|
locale,
|
|
229
|
-
value
|
|
257
|
+
value
|
|
230
258
|
});
|
|
231
259
|
if (rendered == null) continue;
|
|
232
|
-
|
|
260
|
+
const subCategory = yield* getCustomAttributeSubCategory(attribute.category);
|
|
261
|
+
pushFact(subCategory, toCustomAttributeFact({
|
|
262
|
+
attribute,
|
|
263
|
+
text: rendered,
|
|
264
|
+
value
|
|
265
|
+
}));
|
|
233
266
|
}
|
|
234
267
|
return result;
|
|
235
268
|
});
|
|
@@ -248,7 +281,10 @@ const LOCATION_METADATA_ENTRIES = Object.entries(VofficeUnitDataPropertyMetadata
|
|
|
248
281
|
index
|
|
249
282
|
})).filter(({ metadata }) => metadata.category.key === "LOCATION").sort((left, right) => left.index - right.index);
|
|
250
283
|
const toRentalVicinity = ({ locale, translations, attributes }) => Effect.gen(function* () {
|
|
251
|
-
const
|
|
284
|
+
const group = {
|
|
285
|
+
items: [],
|
|
286
|
+
facts: []
|
|
287
|
+
};
|
|
252
288
|
const knownAttributes = attributes.known;
|
|
253
289
|
const translate = makeTranslate(translations, locale);
|
|
254
290
|
for (const { key, metadata } of LOCATION_METADATA_ENTRIES) {
|
|
@@ -260,12 +296,18 @@ const toRentalVicinity = ({ locale, translations, attributes }) => Effect.gen(fu
|
|
|
260
296
|
translate,
|
|
261
297
|
value
|
|
262
298
|
});
|
|
263
|
-
if (item != null)
|
|
299
|
+
if (item != null) pushFact(group, toV9Fact({
|
|
300
|
+
key,
|
|
301
|
+
metadata,
|
|
302
|
+
text: item,
|
|
303
|
+
value
|
|
304
|
+
}));
|
|
264
305
|
}
|
|
265
|
-
if (items.length === 0) return [];
|
|
306
|
+
if (group.items.length === 0) return [];
|
|
266
307
|
return [{
|
|
267
308
|
label: yield* translate(GENERAL_CATEGORY.labelKey, GENERAL_CATEGORY.key),
|
|
268
|
-
items
|
|
309
|
+
items: group.items,
|
|
310
|
+
facts: group.facts
|
|
269
311
|
}];
|
|
270
312
|
});
|
|
271
313
|
//#endregion
|
|
@@ -280,6 +322,13 @@ const toTravelDate = (locale, value) => {
|
|
|
280
322
|
}).format(new Date(value));
|
|
281
323
|
};
|
|
282
324
|
const toText = (value) => typeof value === "string" && value.trim().length > 0 ? value : void 0;
|
|
325
|
+
/** The be-on! Hub's placeholder for a guest who gave no name: German on every page, so it is
|
|
326
|
+
* read as no name and becomes `reviews.item.guest` in the page's language. */
|
|
327
|
+
const HUB_NO_NAME_PLACEHOLDER = "gastname nicht genannt";
|
|
328
|
+
const toForename = (value) => {
|
|
329
|
+
const forename = toText(value)?.trim();
|
|
330
|
+
return forename === void 0 || forename.toLowerCase() === HUB_NO_NAME_PLACEHOLDER ? void 0 : forename;
|
|
331
|
+
};
|
|
283
332
|
const toReviewText = ({ text, textCriteria }) => {
|
|
284
333
|
if (textCriteria.length === 0) return text;
|
|
285
334
|
return [...text === void 0 ? [] : [text], ...textCriteria.map((criterion) => `${criterion.label}\n${criterion.text}`)].join("\n\n");
|
|
@@ -325,7 +374,7 @@ const toReviews = ({ locale, translations, rental, options }) => Effect.gen(func
|
|
|
325
374
|
}));
|
|
326
375
|
return [{
|
|
327
376
|
rating,
|
|
328
|
-
forename:
|
|
377
|
+
forename: toForename(forename),
|
|
329
378
|
city: options.showAuthorCity ? toText(city)?.trim() : void 0,
|
|
330
379
|
text: reviewText,
|
|
331
380
|
highlighted: highlighted === true,
|
|
@@ -408,8 +457,15 @@ const toRooms = ({ locale, translations, roomDetails }) => Effect.gen(function*
|
|
|
408
457
|
if (!isRecord$1(room)) continue;
|
|
409
458
|
const roomType = nonEmptyString(room.type);
|
|
410
459
|
if (roomType == null) continue;
|
|
411
|
-
const attributes =
|
|
412
|
-
|
|
460
|
+
const attributes = {
|
|
461
|
+
items: [],
|
|
462
|
+
facts: []
|
|
463
|
+
};
|
|
464
|
+
for (const [key, labelKey] of Object.entries(ROOM_ATTRIBUTE_LABEL_KEYS)) if (room[key] === true) pushFact(attributes, toFact({
|
|
465
|
+
key,
|
|
466
|
+
text: yield* translate(labelKey, key),
|
|
467
|
+
value: true
|
|
468
|
+
}));
|
|
413
469
|
const beds = [];
|
|
414
470
|
for (const bed of Array.isArray(room.beds) ? room.beds : []) {
|
|
415
471
|
if (!isRecord$1(bed)) continue;
|
|
@@ -423,8 +479,14 @@ const toRooms = ({ locale, translations, roomDetails }) => Effect.gen(function*
|
|
|
423
479
|
if (bedAttributes.length > 0) bedValue.attributes = bedAttributes;
|
|
424
480
|
for (let index = 0; index < positiveInteger(bed.amount); index++) beds.push(bedValue);
|
|
425
481
|
}
|
|
426
|
-
const roomValue = {
|
|
427
|
-
|
|
482
|
+
const roomValue = {
|
|
483
|
+
type: yield* translate(`${ROOM_TYPE_KEY_PREFIX}.${roomType}`, roomType),
|
|
484
|
+
typeKey: roomType
|
|
485
|
+
};
|
|
486
|
+
if (attributes.items.length > 0) {
|
|
487
|
+
roomValue.attributes = attributes.items;
|
|
488
|
+
roomValue.attributeFacts = attributes.facts;
|
|
489
|
+
}
|
|
428
490
|
if (beds.length > 0) roomValue.beds = beds;
|
|
429
491
|
result.push(roomValue);
|
|
430
492
|
}
|
|
@@ -487,7 +549,8 @@ const toRentalRentalsOutput = ({ rental, locale, translations, imageProxyBaseUrl
|
|
|
487
549
|
if (images.length > 0) item.images = images;
|
|
488
550
|
if (attributes != null) item.attributes = attributes;
|
|
489
551
|
if (vicinity != null) item.vicinity = vicinity;
|
|
490
|
-
|
|
552
|
+
item.highlights = highlights.map((fact) => fact.text);
|
|
553
|
+
item.highlightFacts = highlights;
|
|
491
554
|
if (rooms.length > 0) item.rooms = rooms;
|
|
492
555
|
if (rental.voffice_facility != null) item.property = yield* toProperty({
|
|
493
556
|
facility: rental.voffice_facility,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as makeV9CustomAttributeFilterCapabilities, c as parseQueryParameters, d as toVoucherCode, l as toQueryString, o as toBasicQueryInputs, s as collectQueryParameters, u as applyVofficeFilterDerivedBasicQueryInputs } from "./client-
|
|
2
|
-
import { n as mapSearchQuery, r as searchQuery, w as parseVofficeUnitData } from "./operations-
|
|
3
|
-
import {
|
|
1
|
+
import { a as makeV9CustomAttributeFilterCapabilities, c as parseQueryParameters, d as toVoucherCode, l as toQueryString, o as toBasicQueryInputs, s as collectQueryParameters, u as applyVofficeFilterDerivedBasicQueryInputs } from "./client-C6r06QHZ.mjs";
|
|
2
|
+
import { n as mapSearchQuery, r as searchQuery, w as parseVofficeUnitData } from "./operations-Bc3WxjV8.mjs";
|
|
3
|
+
import { a as toLocation, c as CAPACITY_DATA_ATTRIBUTES, i as toV9RentalHighlightKey, l as toCapacity, s as toImages, t as toRentalHighlights, u as toAddress } from "./to-rental-highlights-9AbqVIso.mjs";
|
|
4
4
|
import { CoreSDKError, STABLE_SEARCH_INPUTS, daysBetweenLocalDates, expandCustomAttributeFilterCompositions, parseChildrenAges, parseOccupancyCount, resolveExpandedCompositions, toFormattedSearchPrice, toIsoDateFromPeriodQueryDate, toStableSearchInputBackendQueryKeys, toStableSearchInputParameterValues, toStableSearchInputQueryKeys, toUnusedFilterKeys } from "@v-office/sdk-core";
|
|
5
5
|
import { Effect } from "effect";
|
|
6
6
|
//#region src/legacy-v9/parser/search/input/search-input-error.ts
|
|
@@ -256,21 +256,31 @@ const resolveExactMatch = (additionalData) => {
|
|
|
256
256
|
const DEFAULT_V9_SEARCH_CURRENCY = "EUR";
|
|
257
257
|
const toSearchPriceFields = ({ locale, calc }) => {
|
|
258
258
|
if (calc?.total == null) return {};
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
259
|
+
const totalFields = {
|
|
260
|
+
formattedTotal: toFormattedSearchPrice({
|
|
261
|
+
amount: calc.total,
|
|
262
|
+
currency: DEFAULT_V9_SEARCH_CURRENCY,
|
|
263
|
+
locale
|
|
264
|
+
}),
|
|
265
|
+
total: {
|
|
266
|
+
amount: calc.total,
|
|
267
|
+
currency: DEFAULT_V9_SEARCH_CURRENCY
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
if (calc.oTotal == null || calc.oTotal <= calc.total) return totalFields;
|
|
265
271
|
const label = calc.discountName?.trim();
|
|
266
272
|
return {
|
|
267
|
-
|
|
273
|
+
...totalFields,
|
|
268
274
|
discount: {
|
|
269
275
|
formattedOriginalTotal: toFormattedSearchPrice({
|
|
270
276
|
amount: calc.oTotal,
|
|
271
277
|
currency: DEFAULT_V9_SEARCH_CURRENCY,
|
|
272
278
|
locale
|
|
273
279
|
}),
|
|
280
|
+
originalTotal: {
|
|
281
|
+
amount: calc.oTotal,
|
|
282
|
+
currency: DEFAULT_V9_SEARCH_CURRENCY
|
|
283
|
+
},
|
|
274
284
|
applied: label == null || label.length === 0 ? [] : [{
|
|
275
285
|
label,
|
|
276
286
|
formattedAmount: toFormattedSearchPrice({
|
|
@@ -304,7 +314,8 @@ const toSearchOutputItem = ({ locale, imageProxyBaseUrl, rentalHighlightPrioriti
|
|
|
304
314
|
customAttributes,
|
|
305
315
|
attributes: data
|
|
306
316
|
});
|
|
307
|
-
|
|
317
|
+
item.highlights = highlights.map((fact) => fact.text);
|
|
318
|
+
item.highlightFacts = highlights;
|
|
308
319
|
if (exactMatchCalc != null) Object.assign(item, toSearchPriceFields({
|
|
309
320
|
locale,
|
|
310
321
|
calc: exactMatchCalc
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { v as VofficeUnitDataPropertyMetadata } from "./operations-
|
|
2
|
-
import { localeToLanguage, makeTranslate, renderLabeledAttributeValue, renderResolvedCustomAttribute, toCountLabelKey, toCountry, toRentalCapacity } from "@v-office/sdk-core";
|
|
1
|
+
import { v as VofficeUnitDataPropertyMetadata } from "./operations-Bc3WxjV8.mjs";
|
|
2
|
+
import { localeToLanguage, makeTranslate, renderLabeledAttributeValue, renderResolvedCustomAttribute, toCountLabelKey, toCountry, toCustomAttributeFact, toFact, toLocalizedText, toRentalCapacity } from "@v-office/sdk-core";
|
|
3
3
|
import { Effect } from "effect";
|
|
4
4
|
//#region src/legacy-v9/parser/rentals/to-localized-string.ts
|
|
5
5
|
const isNonEmptyString$1 = (value) => typeof value === "string" && value.length > 0;
|
|
@@ -259,7 +259,8 @@ const toImage = (imageProxyBaseUrl, entry, locale) => {
|
|
|
259
259
|
const imageId = getVofficeDynamicImageId(entry);
|
|
260
260
|
const src = imageId != null ? buildVofficeDynamicImageUrl(imageId, VOFFICE_DYNAMIC_IMAGE_XL) : path != null ? buildImageUrl(imageProxyBaseUrl, path, IMAGE_DEFAULT_WIDTH) : "";
|
|
261
261
|
const srcset = imageId != null ? buildVofficeDynamicImageSrcset(imageId, entry.dataImage) : path != null ? buildSrcset(imageProxyBaseUrl, path) : "";
|
|
262
|
-
const
|
|
262
|
+
const recordTitle = toLocalizedText(entry.dataImage?.titles, locale);
|
|
263
|
+
const title = recordTitle?.text ?? toLocalizedString(entry.dataImage?.titles, locale) ?? entry.image?.title;
|
|
263
264
|
const alt = title ?? entry.image?.description ?? "";
|
|
264
265
|
const metadata = { source: entry.source };
|
|
265
266
|
if (entry.dataImage != null) metadata.dataImage = entry.dataImage;
|
|
@@ -271,6 +272,7 @@ const toImage = (imageProxyBaseUrl, entry, locale) => {
|
|
|
271
272
|
metadata
|
|
272
273
|
};
|
|
273
274
|
if (title != null) image.title = title;
|
|
275
|
+
if (recordTitle?.fallback !== void 0) image.altFallback = recordTitle.fallback;
|
|
274
276
|
if (entry.dataImage?.tag != null) image.category = entry.dataImage.tag;
|
|
275
277
|
return image;
|
|
276
278
|
};
|
|
@@ -279,7 +281,8 @@ const toImages = (imageProxyBaseUrl, rental, locale, data) => {
|
|
|
279
281
|
};
|
|
280
282
|
const toFacilityImages = (images, locale) => images.flatMap((image) => {
|
|
281
283
|
if (image.id == null) return [];
|
|
282
|
-
const
|
|
284
|
+
const recordTitle = toLocalizedText(image.titles, locale);
|
|
285
|
+
const title = recordTitle?.text ?? toLocalizedString(image.titles, locale);
|
|
283
286
|
const item = {
|
|
284
287
|
idOrPath: image.id.toString(),
|
|
285
288
|
src: buildVofficeDynamicImageUrl(image.id, VOFFICE_DYNAMIC_IMAGE_XL),
|
|
@@ -293,6 +296,7 @@ const toFacilityImages = (images, locale) => images.flatMap((image) => {
|
|
|
293
296
|
item.alt = title;
|
|
294
297
|
item.title = title;
|
|
295
298
|
}
|
|
299
|
+
if (recordTitle?.fallback !== void 0) item.altFallback = recordTitle.fallback;
|
|
296
300
|
if (image.tag != null) item.category = image.tag;
|
|
297
301
|
return [item];
|
|
298
302
|
});
|
|
@@ -307,33 +311,9 @@ const toLocation = (location) => {
|
|
|
307
311
|
};
|
|
308
312
|
};
|
|
309
313
|
//#endregion
|
|
310
|
-
//#region src/legacy-v9/parser/rentals/render-property-attribute.ts
|
|
311
|
-
const renderVofficePropertyAttribute = ({ key, metadata, locale, translate, value }) => Effect.gen(function* () {
|
|
312
|
-
if (metadata.sourceType === "OPT") {
|
|
313
|
-
if (typeof value !== "number" || !Number.isInteger(value)) return void 0;
|
|
314
|
-
const option = metadata.options?.find((candidate) => candidate.value === value);
|
|
315
|
-
if (option === void 0) return void 0;
|
|
316
|
-
return `${yield* translate(metadata.labelKey, key)}: ${yield* translate(option.labelKey, option.sourceLabel)}`;
|
|
317
|
-
}
|
|
318
|
-
if (value === false || value === 0 || value === "false" || value === "0" || value == null || value === "") return;
|
|
319
|
-
const label = yield* translate(metadata.labelKey, key);
|
|
320
|
-
if (metadata.sourceType === "INT" && typeof value === "number") {
|
|
321
|
-
if (value === 0) return void 0;
|
|
322
|
-
if (key.endsWith("distance")) return `${label}: ${value}m`;
|
|
323
|
-
if (key === "squareMeters") return `${value} m²`;
|
|
324
|
-
return `${value} ${yield* translate(toCountLabelKey(metadata.labelKey, value), label)}`;
|
|
325
|
-
}
|
|
326
|
-
return renderLabeledAttributeValue({
|
|
327
|
-
key,
|
|
328
|
-
label,
|
|
329
|
-
locale,
|
|
330
|
-
value
|
|
331
|
-
});
|
|
332
|
-
});
|
|
333
|
-
//#endregion
|
|
334
314
|
//#region codegen/v9/heuristic-generation/rental-highlight-key-map.ts
|
|
335
315
|
const V9_RENTAL_HIGHLIGHT_KEYS = new Set(Object.keys(VofficeUnitDataPropertyMetadata));
|
|
336
|
-
const
|
|
316
|
+
const V9_RENTAL_HIGHLIGHT_KEY_BY_V10_KEY = {
|
|
337
317
|
ac: "ac",
|
|
338
318
|
acCoverage: "acCoverage",
|
|
339
319
|
accessToPrivateBeach: "privateBeach",
|
|
@@ -653,10 +633,57 @@ const V9_RENTAL_HIGHLIGHT_KEY_LOOKUP = {
|
|
|
653
633
|
youthgroups: "youthgroups",
|
|
654
634
|
zoo: "zoo"
|
|
655
635
|
};
|
|
636
|
+
const V9_RENTAL_HIGHLIGHT_KEY_LOOKUP = V9_RENTAL_HIGHLIGHT_KEY_BY_V10_KEY;
|
|
656
637
|
const toV9RentalHighlightKey = (key) => {
|
|
657
638
|
const mappedKey = V9_RENTAL_HIGHLIGHT_KEY_LOOKUP[key] ?? key;
|
|
658
639
|
return V9_RENTAL_HIGHLIGHT_KEYS.has(mappedKey) ? mappedKey : void 0;
|
|
659
640
|
};
|
|
641
|
+
const V10_KEYS = new Set(Object.keys(V9_RENTAL_HIGHLIGHT_KEY_BY_V10_KEY));
|
|
642
|
+
/** v9 keys exactly one v10 key maps to. A v9 key several v10 keys share has no single v10 name. */
|
|
643
|
+
const V10_KEY_BY_V9_KEY = (() => {
|
|
644
|
+
const v10KeysByV9Key = /* @__PURE__ */ new Map();
|
|
645
|
+
for (const [v10Key, v9Key] of Object.entries(V9_RENTAL_HIGHLIGHT_KEY_BY_V10_KEY)) v10KeysByV9Key.set(v9Key, [...v10KeysByV9Key.get(v9Key) ?? [], v10Key]);
|
|
646
|
+
return new Map([...v10KeysByV9Key].flatMap(([v9Key, v10Keys]) => v10Keys.length === 1 && v10Keys[0] !== void 0 ? [[v9Key, v10Keys[0]]] : []));
|
|
647
|
+
})();
|
|
648
|
+
/**
|
|
649
|
+
* The key a v9 fact states: the v10 name where v10 has the attribute (`loc_lake` → `locLake`),
|
|
650
|
+
* so a site curates one list for both backends; otherwise the v9 key as the hub names it.
|
|
651
|
+
*/
|
|
652
|
+
const toV10FactKey = (v9Key) => V10_KEYS.has(v9Key) ? v9Key : V10_KEY_BY_V9_KEY.get(v9Key) ?? v9Key;
|
|
653
|
+
//#endregion
|
|
654
|
+
//#region src/legacy-v9/parser/rentals/render-property-attribute.ts
|
|
655
|
+
const renderVofficePropertyAttribute = ({ key, metadata, locale, translate, value }) => Effect.gen(function* () {
|
|
656
|
+
if (metadata.sourceType === "OPT") {
|
|
657
|
+
if (typeof value !== "number" || !Number.isInteger(value)) return void 0;
|
|
658
|
+
const option = metadata.options?.find((candidate) => candidate.value === value);
|
|
659
|
+
if (option === void 0) return void 0;
|
|
660
|
+
return `${yield* translate(metadata.labelKey, key)}: ${yield* translate(option.labelKey, option.sourceLabel)}`;
|
|
661
|
+
}
|
|
662
|
+
if (value === false || value === 0 || value === "false" || value === "0" || value == null || value === "") return;
|
|
663
|
+
const label = yield* translate(metadata.labelKey, key);
|
|
664
|
+
if (metadata.sourceType === "INT" && typeof value === "number") {
|
|
665
|
+
if (value === 0) return void 0;
|
|
666
|
+
if (key.endsWith("distance")) return `${label}: ${value}m`;
|
|
667
|
+
if (key === "squareMeters") return `${value} m²`;
|
|
668
|
+
return `${value} ${yield* translate(toCountLabelKey(metadata.labelKey, value), label)}`;
|
|
669
|
+
}
|
|
670
|
+
return renderLabeledAttributeValue({
|
|
671
|
+
key,
|
|
672
|
+
label,
|
|
673
|
+
locale,
|
|
674
|
+
value
|
|
675
|
+
});
|
|
676
|
+
});
|
|
677
|
+
/**
|
|
678
|
+
* The fact of a rendered v9 attribute: its key in v10 naming where v10 has the attribute, and
|
|
679
|
+
* its value as v10 states it — the hub sends a feature as `1`, v10 as `true`. A free text has
|
|
680
|
+
* no value: the hub sends it in the requested language, and `text` carries it.
|
|
681
|
+
*/
|
|
682
|
+
const toV9Fact = ({ key, metadata, text, value }) => toFact({
|
|
683
|
+
key: toV10FactKey(key),
|
|
684
|
+
text,
|
|
685
|
+
value: metadata.sourceType === "BOOL" ? true : metadata.sourceType === "TEXT" ? void 0 : value
|
|
686
|
+
});
|
|
660
687
|
//#endregion
|
|
661
688
|
//#region src/legacy-v9/parser/rentals/to-rental-highlights.ts
|
|
662
689
|
const RENTAL_VIEW_HIGHLIGHT_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -696,7 +723,11 @@ const toRentalHighlights = ({ locale, translations, highlightPrioritization, cus
|
|
|
696
723
|
value
|
|
697
724
|
});
|
|
698
725
|
if (highlight != null) {
|
|
699
|
-
highlights.push(
|
|
726
|
+
highlights.push(toCustomAttributeFact({
|
|
727
|
+
attribute,
|
|
728
|
+
text: highlight,
|
|
729
|
+
value
|
|
730
|
+
}));
|
|
700
731
|
if (isViewHighlight) hasViewHighlight = true;
|
|
701
732
|
}
|
|
702
733
|
continue;
|
|
@@ -712,11 +743,16 @@ const toRentalHighlights = ({ locale, translations, highlightPrioritization, cus
|
|
|
712
743
|
value: knownAttributes[v9Key]
|
|
713
744
|
});
|
|
714
745
|
if (highlight != null) {
|
|
715
|
-
highlights.push(
|
|
746
|
+
highlights.push(toV9Fact({
|
|
747
|
+
key: v9Key,
|
|
748
|
+
metadata,
|
|
749
|
+
text: highlight,
|
|
750
|
+
value: knownAttributes[v9Key]
|
|
751
|
+
}));
|
|
716
752
|
if (isViewHighlight) hasViewHighlight = true;
|
|
717
753
|
}
|
|
718
754
|
}
|
|
719
755
|
return highlights;
|
|
720
756
|
});
|
|
721
757
|
//#endregion
|
|
722
|
-
export {
|
|
758
|
+
export { toLocation as a, CAPACITY_DATA_ATTRIBUTES as c, toLocalizedString as d, toV9RentalHighlightKey as i, toCapacity as l, renderVofficePropertyAttribute as n, toFacilityImages as o, toV9Fact as r, toImages as s, toRentalHighlights as t, toAddress as u };
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Release notes of `@v-office/website-sdk`, newest first. Each version has its own directory.
|
|
6
6
|
|
|
7
|
+
- `versions/3.1.0/CHANGELOG.md`: release notes for 3.1.0
|
|
7
8
|
- `versions/3.0.0/CHANGELOG.md`: release notes for 3.0.0
|
|
8
9
|
- `versions/2.38.0/CHANGELOG.md`: release notes for 2.38.0
|
|
9
10
|
- `versions/2.37.1/CHANGELOG.md`: release notes for 2.37.1
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Migration guides of `@v-office/website-sdk`, newest first. Apply them in order when skipping versions.
|
|
6
6
|
|
|
7
|
+
- `versions/3.1.0/MIGRATION.md`: Migration: 3.0.0 to 3.1.0
|
|
7
8
|
- `versions/3.0.0/MIGRATION.md`: Migration: 2.38.0 to 3.0.0
|
|
8
9
|
- `versions/2.38.0/MIGRATION.md`: Migration: 2.37.1 to 2.38.0
|
|
9
10
|
- `versions/2.37.1/MIGRATION.md`: Migration: 2.37.0 to 2.37.1
|
package/instructions/quote.md
CHANGED
|
@@ -368,6 +368,23 @@ if (selected.ok) quote = selected.quote;
|
|
|
368
368
|
|
|
369
369
|
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.
|
|
370
370
|
|
|
371
|
+
On v10 the label of a system policy (Balanced 14 days, Strict 30 days, Very strict 60 days) is
|
|
372
|
+
translated by the SDK. The label of a custom or alternative policy is the agency's own text and
|
|
373
|
+
stays as entered in the PMS, in whatever language that is.
|
|
374
|
+
|
|
375
|
+
## Texts in the PMS's language
|
|
376
|
+
|
|
377
|
+
The SDK translates its own texts. Texts an agency enters in the PMS come back as entered, and
|
|
378
|
+
the SDK cannot tell their language: the backend states one text, not one per language. On an
|
|
379
|
+
English page they are German unless the agency entered English:
|
|
380
|
+
|
|
381
|
+
- v10: custom and alternative cancellation policy names (`cancellationPolicies[].label`).
|
|
382
|
+
- v9: fee, service and insurance names in the booking card and the additional services, as the
|
|
383
|
+
be-on! Hub sends them for the requested language.
|
|
384
|
+
|
|
385
|
+
To show them in English, enter English names in the PMS. A site that must not show German can
|
|
386
|
+
replace them with its own text by `id`.
|
|
387
|
+
|
|
371
388
|
## Insurance
|
|
372
389
|
|
|
373
390
|
Insurance information is exposed on `quote.insurance` when available. The `options` array contains either a `none` option or selectable insurance products.
|