@v-office/website-sdk 2.24.1 → 2.25.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 +89 -2
- package/dist/{client-DC4LG3CP.mjs → client-0Lgv-Gb_.mjs} +83 -18
- package/dist/index.d.mts +17 -5
- package/dist/index.mjs +1 -1
- package/dist/instructions/CHANGELOG.md +1 -0
- package/dist/instructions/MIGRATION.md +1 -0
- package/dist/instructions/creation.md +5 -0
- package/dist/instructions/rentals.md +75 -0
- package/dist/instructions/versions/2.25.0/CHANGELOG.md +41 -0
- package/dist/instructions/versions/2.25.0/MIGRATION.md +64 -0
- package/dist/{to-rental-highlights-C1NF2uuE.mjs → operations-DwURbo0b.mjs} +1 -626
- package/dist/{rentals-eqFhtCdT.mjs → rentals-Dn0-kGWD.mjs} +96 -33
- package/dist/{search-CKL-8T8q.mjs → search-BLTTQAsG.mjs} +4 -3
- package/dist/to-rental-highlights-BL5m3Uen.mjs +626 -0
- package/dist/translations/v9/de-DE/core.json +3 -1
- package/dist/translations/v9/en-US/core.json +3 -1
- package/dist/{v9-data-BnYxa2Ek.mjs → v9-data-C3SWtDGs.mjs} +7 -5
- package/instructions/CHANGELOG.md +1 -0
- package/instructions/MIGRATION.md +1 -0
- package/instructions/creation.md +5 -0
- package/instructions/rentals.md +75 -0
- package/instructions/versions/2.25.0/CHANGELOG.md +41 -0
- package/instructions/versions/2.25.0/MIGRATION.md +64 -0
- package/instructions/versions/2.25.0/release.json +3 -0
- package/package.json +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
1
|
+
import { Gt as V9_FACILITY_ATTRIBUTE_KEYS } from "./client-0Lgv-Gb_.mjs";
|
|
2
|
+
import { i as VofficeUnitDataPropertyMetadata, l as parseVofficeUnitData, n as VofficeUnitDataPropertyCategoryLabelKeys, o as parseVofficeFacilityData, r as VofficeUnitDataPropertyCategoryValues, s as parseVofficeFeedbackData, t as VofficeUnitDataFieldSchemas } from "./v9-data-C3SWtDGs.mjs";
|
|
3
|
+
import { a as rentalsAllByFacilityObjectGroupsWithoutFeedbacksQuery, i as rentalIdsQuery, o as rentalsAllFeedbacksQuery, r as rentalFacilitiesForObjectGroupRelationQuery, s as rentalsAllWithoutFeedbacksQuery } from "./operations-DwURbo0b.mjs";
|
|
4
|
+
import { a as toFacilityImages, c as toLocalizedString, i as toLocation, o as toImages, r as renderVofficePropertyAttribute, s as toAddress, t as toRentalHighlights } from "./to-rental-highlights-BL5m3Uen.mjs";
|
|
4
5
|
import { CoreSDKError, makeTranslate, renderResolvedCustomAttribute, toCustomAttributeList, toResolvedCustomAttributeCategoryTranslationKey } from "@v-office/sdk-core";
|
|
5
6
|
import { Effect } from "effect";
|
|
6
7
|
//#region src/legacy-v9/parser/rentals/to-description.ts
|
|
@@ -286,45 +287,106 @@ const toTravelDate = (locale, value) => {
|
|
|
286
287
|
year: "numeric"
|
|
287
288
|
}).format(new Date(value));
|
|
288
289
|
};
|
|
289
|
-
const
|
|
290
|
+
const toText = (value) => typeof value === "string" && value.trim().length > 0 ? value : void 0;
|
|
291
|
+
const toReviewText = ({ text, textCriteria }) => {
|
|
292
|
+
if (textCriteria.length === 0) return text;
|
|
293
|
+
return [...text === void 0 ? [] : [text], ...textCriteria.map((criterion) => `${criterion.label}\n${criterion.text}`)].join("\n\n");
|
|
294
|
+
};
|
|
295
|
+
const toCategories = ({ items, criteria, locale }) => criteria.flatMap((criterion) => {
|
|
296
|
+
if (criterion.type !== "stars") return [];
|
|
297
|
+
const ratings = items.flatMap((item) => {
|
|
298
|
+
const rating = item.criterionRatings.get(criterion.v9);
|
|
299
|
+
return rating === void 0 ? [] : [rating];
|
|
300
|
+
});
|
|
301
|
+
if (ratings.length === 0) return [];
|
|
302
|
+
return [{
|
|
303
|
+
label: criterion.label[locale],
|
|
304
|
+
rating: roundRatingUp(ratings.reduce((ratingSum, rating) => ratingSum + rating, 0) / ratings.length).toString()
|
|
305
|
+
}];
|
|
306
|
+
});
|
|
307
|
+
const toReviews = ({ locale, translations, rental, options }) => Effect.gen(function* () {
|
|
290
308
|
const parsedItems = (yield* Effect.succeed(rental.voffice_feedbacks))?.flatMap((feedback) => {
|
|
291
|
-
const
|
|
292
|
-
const
|
|
293
|
-
|
|
309
|
+
const parsed = parseVofficeFeedbackData(feedback.data);
|
|
310
|
+
const { forename, city, avgRating, text, highlighted, arrival, departure, onDate, onTimestamp } = parsed.known;
|
|
311
|
+
const values = {
|
|
312
|
+
...parsed.unknown,
|
|
313
|
+
...parsed.known
|
|
314
|
+
};
|
|
315
|
+
const rating = avgRating != null && avgRating >= 1 ? roundRatingUp(avgRating) : void 0;
|
|
316
|
+
const reviewText = toReviewText({
|
|
317
|
+
text: toText(text),
|
|
318
|
+
textCriteria: options.criteria.flatMap((criterion) => {
|
|
319
|
+
if (criterion.type !== "text") return [];
|
|
320
|
+
const criterionText = toText(values[criterion.v9]);
|
|
321
|
+
return criterionText === void 0 ? [] : [{
|
|
322
|
+
label: criterion.label[locale],
|
|
323
|
+
text: criterionText
|
|
324
|
+
}];
|
|
325
|
+
})
|
|
326
|
+
});
|
|
327
|
+
if (rating === void 0 && !options.includeItemsWithoutRating) return [];
|
|
328
|
+
if (reviewText === void 0 && !options.includeItemsWithoutText) return [];
|
|
329
|
+
if (rating === void 0 && reviewText === void 0) return [];
|
|
330
|
+
const criterionRatings = new Map(options.criteria.flatMap((criterion) => {
|
|
331
|
+
const value = values[criterion.v9];
|
|
332
|
+
return criterion.type === "stars" && typeof value === "number" && value >= 1 && value <= 5 ? [[criterion.v9, value]] : [];
|
|
333
|
+
}));
|
|
294
334
|
return [{
|
|
295
|
-
rating
|
|
296
|
-
|
|
297
|
-
|
|
335
|
+
rating,
|
|
336
|
+
forename: toText(forename)?.trim(),
|
|
337
|
+
city: options.showAuthorCity ? toText(city)?.trim() : void 0,
|
|
338
|
+
text: reviewText,
|
|
298
339
|
highlighted: highlighted === true,
|
|
299
|
-
travelDate: toTravelDate(locale, arrival ?? departure ?? onDate ?? onTimestamp)
|
|
340
|
+
travelDate: toTravelDate(locale, arrival ?? departure ?? onDate ?? onTimestamp),
|
|
341
|
+
criterionRatings
|
|
300
342
|
}];
|
|
301
343
|
}) ?? [];
|
|
302
344
|
if (parsedItems.length === 0) return void 0;
|
|
303
|
-
const
|
|
304
|
-
const
|
|
345
|
+
const guest = yield* translations.translate(locale, "reviews.item.guest");
|
|
346
|
+
const authorWithCityTemplate = yield* translations.translate(locale, "reviews.item.authorWithCity");
|
|
347
|
+
const authorTemplate = yield* translations.translate(locale, "reviews.item.author");
|
|
348
|
+
const authorWithDateTemplate = yield* translations.translate(locale, "reviews.item.authorWithDate");
|
|
349
|
+
const items = parsedItems.sort((left, right) => Number(right.highlighted) - Number(left.highlighted)).flatMap(({ rating, forename, city, text, travelDate }) => {
|
|
350
|
+
const author = city === void 0 ? forename ?? guest : renderTemplate(authorWithCityTemplate, {
|
|
351
|
+
author: forename ?? guest,
|
|
352
|
+
city
|
|
353
|
+
});
|
|
354
|
+
const shared = { author: travelDate == null ? renderTemplate(authorTemplate, { author }) : renderTemplate(authorWithDateTemplate, {
|
|
355
|
+
author,
|
|
356
|
+
date: travelDate
|
|
357
|
+
}) };
|
|
358
|
+
if (rating !== void 0) return [{
|
|
359
|
+
...shared,
|
|
360
|
+
rating: rating.toString(),
|
|
361
|
+
...text === void 0 ? {} : { text }
|
|
362
|
+
}];
|
|
363
|
+
return text === void 0 ? [] : [{
|
|
364
|
+
...shared,
|
|
365
|
+
text
|
|
366
|
+
}];
|
|
367
|
+
});
|
|
368
|
+
const ratings = parsedItems.flatMap((item) => item.rating === void 0 ? [] : [item.rating]);
|
|
369
|
+
if (ratings.length === 0) return { items };
|
|
370
|
+
const summaryRating = roundRatingUp(ratings.reduce((ratingSum, rating) => ratingSum + rating, 0) / ratings.length);
|
|
305
371
|
const summaryRatingTemplate = yield* translations.translate(locale, "reviews.summary.rating");
|
|
306
372
|
const summaryCountTemplate = yield* translations.translate(locale, "reviews.summary.count");
|
|
307
373
|
const classification = toClassification(summaryRating);
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
count: renderTemplate(summaryCountTemplate, { count: parsedItems.length.toString() }),
|
|
314
|
-
classification: yield* translations.translate(locale, `reviews.summary.classification.${classification}`)
|
|
315
|
-
};
|
|
316
|
-
const authorTemplate = yield* translations.translate(locale, "reviews.item.author");
|
|
317
|
-
const authorWithDateTemplate = yield* translations.translate(locale, "reviews.item.authorWithDate");
|
|
374
|
+
const categories = toCategories({
|
|
375
|
+
items: parsedItems,
|
|
376
|
+
criteria: options.criteria,
|
|
377
|
+
locale
|
|
378
|
+
});
|
|
318
379
|
return {
|
|
319
|
-
items
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
380
|
+
items,
|
|
381
|
+
summary: {
|
|
382
|
+
rating: renderTemplate(summaryRatingTemplate, {
|
|
383
|
+
rating: summaryRating.toString(),
|
|
384
|
+
maxRating: "5"
|
|
324
385
|
}),
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
386
|
+
count: renderTemplate(summaryCountTemplate, { count: ratings.length.toString() }),
|
|
387
|
+
classification: yield* translations.translate(locale, `reviews.summary.classification.${classification}`),
|
|
388
|
+
...categories.length === 0 ? {} : { categories }
|
|
389
|
+
}
|
|
328
390
|
};
|
|
329
391
|
});
|
|
330
392
|
//#endregion
|
|
@@ -377,7 +439,7 @@ const toRooms = ({ locale, translations, roomDetails }) => Effect.gen(function*
|
|
|
377
439
|
});
|
|
378
440
|
//#endregion
|
|
379
441
|
//#region src/legacy-v9/parser/rentals/to-rental-list-item.ts
|
|
380
|
-
const toRentalRentalsOutput = ({ rental, locale, translations, imageProxyBaseUrl, rentalHighlightPrioritization, rentalPropertyHighlightPrioritization, customAttributes, v9PropertyHighlightSources }) => Effect.gen(function* () {
|
|
442
|
+
const toRentalRentalsOutput = ({ rental, locale, translations, imageProxyBaseUrl, rentalHighlightPrioritization, rentalPropertyHighlightPrioritization, customAttributes, v9PropertyHighlightSources, reviews: reviewsOptions }) => Effect.gen(function* () {
|
|
381
443
|
const data = parseVofficeUnitData(rental.data);
|
|
382
444
|
const rawRentalType = data.known.type?.trim();
|
|
383
445
|
const translatedRentalType = rawRentalType != null && rawRentalType.length > 0 ? yield* toRentalType({
|
|
@@ -415,7 +477,8 @@ const toRentalRentalsOutput = ({ rental, locale, translations, imageProxyBaseUrl
|
|
|
415
477
|
const reviews = yield* toReviews({
|
|
416
478
|
locale,
|
|
417
479
|
translations,
|
|
418
|
-
rental
|
|
480
|
+
rental,
|
|
481
|
+
options: reviewsOptions
|
|
419
482
|
});
|
|
420
483
|
const item = {
|
|
421
484
|
id: rental.voffice_id.toString(),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { a as parseQueryParameters, i as collectQueryParameters, n as makeV9CustomAttributeFilterCapabilities, o as toQueryString, r as toBasicQueryInputs, s as applyVofficeFilterDerivedBasicQueryInputs } from "./client-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { a as parseQueryParameters, i as collectQueryParameters, n as makeV9CustomAttributeFilterCapabilities, o as toQueryString, r as toBasicQueryInputs, s as applyVofficeFilterDerivedBasicQueryInputs } from "./client-0Lgv-Gb_.mjs";
|
|
2
|
+
import { l as parseVofficeUnitData } from "./v9-data-C3SWtDGs.mjs";
|
|
3
|
+
import { n as searchQuery, t as mapSearchQuery } from "./operations-DwURbo0b.mjs";
|
|
4
|
+
import { i as toLocation, n as toV9RentalHighlightKey, o as toImages, s as toAddress, t as toRentalHighlights } from "./to-rental-highlights-BL5m3Uen.mjs";
|
|
4
5
|
import { CoreSDKError, STABLE_SEARCH_INPUTS, daysBetweenLocalDates, expandCustomAttributeFilterCompositions, parseChildrenAges, parseOccupancyCount, resolveExpandedCompositions, toFormattedSearchPrice, toIsoDateFromPeriodQueryDate, toStableSearchInputBackendQueryKeys, toStableSearchInputParameterValues, toStableSearchInputQueryKeys, toUnusedFilterKeys } from "@v-office/sdk-core";
|
|
5
6
|
import { Effect } from "effect";
|
|
6
7
|
//#region src/legacy-v9/parser/search/input/search-input-error.ts
|