@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
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import { d as formatCurrency, g as toNightCount, n as addGuestQuoteAdditionalServiceSelection, t as GuestQuote } from "./quote-CRjV_lf-.mjs";
|
|
1
|
+
import { GuestQuote, GuestQuoteBookingCardDisplayOrder, addGuestQuoteAdditionalServiceSelection, formatCurrency, toNightCount } from "@v-office/sdk-core";
|
|
3
2
|
import { DateTime, Effect } from "effect";
|
|
4
|
-
//#region src/
|
|
3
|
+
//#region src/legacy-v9/parser/quote/to-additional-service-calculation.ts
|
|
5
4
|
const toAdditionalServiceCalculation = (line) => {
|
|
6
5
|
switch (line.calculation) {
|
|
7
6
|
case "NIGHT": return "PER_NIGHT";
|
|
@@ -12,7 +11,7 @@ const toAdditionalServiceCalculation = (line) => {
|
|
|
12
11
|
}
|
|
13
12
|
};
|
|
14
13
|
//#endregion
|
|
15
|
-
//#region src/
|
|
14
|
+
//#region src/legacy-v9/parser/quote/to-charge.ts
|
|
16
15
|
const toCharge = ({ serviceLine, chargeAmount, currency, locale, translations }) => Effect.gen(function* () {
|
|
17
16
|
switch (serviceLine.calculation) {
|
|
18
17
|
case "NIGHT": return `${formatCurrency(chargeAmount, locale, currency)}${yield* translations.translate(locale, "quote.additionalService.night")}`;
|
|
@@ -21,26 +20,26 @@ const toCharge = ({ serviceLine, chargeAmount, currency, locale, translations })
|
|
|
21
20
|
}
|
|
22
21
|
});
|
|
23
22
|
//#endregion
|
|
24
|
-
//#region src/
|
|
23
|
+
//#region src/legacy-v9/parser/quote/to-charge-amount.ts
|
|
25
24
|
const toChargeAmount = ({ input, serviceLine }) => {
|
|
26
25
|
const amount = serviceLine.amount ?? 1;
|
|
27
26
|
if (amount <= 0 || serviceLine.total == null) return void 0;
|
|
28
27
|
switch (serviceLine.calculation) {
|
|
29
|
-
case "NIGHT": return serviceLine.total / toNightCount(input) / amount;
|
|
30
|
-
case "DAY": return serviceLine.total / toNightCount(input) / amount;
|
|
28
|
+
case "NIGHT": return serviceLine.total / toNightCount(input.period) / amount;
|
|
29
|
+
case "DAY": return serviceLine.total / toNightCount(input.period) / amount;
|
|
31
30
|
case "USAGE": return serviceLine.total / amount;
|
|
32
31
|
default: return serviceLine.total / amount;
|
|
33
32
|
}
|
|
34
33
|
};
|
|
35
34
|
//#endregion
|
|
36
|
-
//#region src/
|
|
35
|
+
//#region src/legacy-v9/parser/quote/to-service-line-label.ts
|
|
37
36
|
const toServiceLineLabel = ({ serviceLine, locale, translations }) => Effect.gen(function* () {
|
|
38
37
|
if (serviceLine.service?.name != null && serviceLine.service.name.trim().length > 0) return serviceLine.service.name;
|
|
39
38
|
if (serviceLine.service?.type != null && serviceLine.service.type.trim().length > 0) return yield* translations.translate(locale, `Service.type.${serviceLine.service.type}`);
|
|
40
39
|
return yield* translations.translate(locale, "Service.type.OTHER");
|
|
41
40
|
});
|
|
42
41
|
//#endregion
|
|
43
|
-
//#region src/
|
|
42
|
+
//#region src/legacy-v9/parser/quote/utils.ts
|
|
44
43
|
const hasEnoughLeadTime = ({ bookingStart, leadTimeDays, today }) => {
|
|
45
44
|
if (leadTimeDays == null) return true;
|
|
46
45
|
const start = DateTime.removeTime(DateTime.makeUnsafe(bookingStart));
|
|
@@ -51,7 +50,7 @@ const getLineServiceId = (line) => line.service?.id == null ? void 0 : String(li
|
|
|
51
50
|
const isTaxLine = (line) => line.service?.type === "VTAX" || line.service?.type === "TAXES";
|
|
52
51
|
const getTotal = (line) => line.total ?? 0;
|
|
53
52
|
//#endregion
|
|
54
|
-
//#region src/
|
|
53
|
+
//#region src/legacy-v9/parser/quote/to-additional-services.ts
|
|
55
54
|
const toDescription = (line) => {
|
|
56
55
|
if (Array.isArray(line.beon_data)) return void 0;
|
|
57
56
|
return line.beon_data?.description;
|
|
@@ -120,7 +119,7 @@ const toAdditionalServices = ({ input, guestQuoteResult, locale, translations })
|
|
|
120
119
|
return additionalServices;
|
|
121
120
|
});
|
|
122
121
|
//#endregion
|
|
123
|
-
//#region src/
|
|
122
|
+
//#region src/legacy-v9/parser/quote/to-backend-context.ts
|
|
124
123
|
const toSelectionQuantity = (selections, serviceId) => selections.find((selection) => selection.id === serviceId)?.quantity ?? 0;
|
|
125
124
|
const toSelectedTotal = (line, amount) => {
|
|
126
125
|
if (line.price == null) return void 0;
|
|
@@ -164,7 +163,7 @@ const updateV9QuoteBackendContext = (context, selections) => {
|
|
|
164
163
|
};
|
|
165
164
|
};
|
|
166
165
|
//#endregion
|
|
167
|
-
//#region src/
|
|
166
|
+
//#region src/legacy-v9/parser/quote/to-sections-included.ts
|
|
168
167
|
const isIncludedSubItem = (line) => line.service?.type === "RENT" || line.service?.summary === "SHOW";
|
|
169
168
|
const toSectionsIncluded = ({ input: _input, guestQuoteResult, locale, translations }) => Effect.gen(function* () {
|
|
170
169
|
const subItems = [];
|
|
@@ -193,7 +192,7 @@ const toSectionsIncluded = ({ input: _input, guestQuoteResult, locale, translati
|
|
|
193
192
|
};
|
|
194
193
|
});
|
|
195
194
|
//#endregion
|
|
196
|
-
//#region src/
|
|
195
|
+
//#region src/legacy-v9/parser/quote/to-sections-other.ts
|
|
197
196
|
const isOther = (line) => line.service?.type !== "RENT" && !isTaxLine(line) && line.service?.summary !== "ADD_NO_SHOW";
|
|
198
197
|
const toSectionsOther = ({ input: _input, guestQuoteResult, locale, translations }) => Effect.gen(function* () {
|
|
199
198
|
const lines = [];
|
|
@@ -212,7 +211,7 @@ const toSectionsOther = ({ input: _input, guestQuoteResult, locale, translations
|
|
|
212
211
|
return lines;
|
|
213
212
|
});
|
|
214
213
|
//#endregion
|
|
215
|
-
//#region src/
|
|
214
|
+
//#region src/legacy-v9/parser/quote/to-sections-tax.ts
|
|
216
215
|
const toSectionsTax = ({ input: _input, guestQuoteResult, locale, translations }) => Effect.gen(function* () {
|
|
217
216
|
let total = 0;
|
|
218
217
|
for (const line of guestQuoteResult?.mandatory ?? []) if (isTaxLine(line)) total += getTotal(line);
|
|
@@ -222,7 +221,7 @@ const toSectionsTax = ({ input: _input, guestQuoteResult, locale, translations }
|
|
|
222
221
|
} };
|
|
223
222
|
});
|
|
224
223
|
//#endregion
|
|
225
|
-
//#region src/
|
|
224
|
+
//#region src/legacy-v9/parser/quote/to-sections.ts
|
|
226
225
|
const hasSectionLineContent = (line) => line.item.appliedCharge !== 0 || (line.subItems?.length ?? 0) > 0;
|
|
227
226
|
const toSections = ({ input, guestQuoteResult, locale, translations }) => Effect.gen(function* () {
|
|
228
227
|
const sections = [];
|
|
@@ -244,13 +243,22 @@ const toSections = ({ input, guestQuoteResult, locale, translations }) => Effect
|
|
|
244
243
|
locale,
|
|
245
244
|
translations
|
|
246
245
|
});
|
|
247
|
-
if (hasSectionLineContent(sectionsIncluded)) sections.push({
|
|
248
|
-
|
|
249
|
-
|
|
246
|
+
if (hasSectionLineContent(sectionsIncluded)) sections.push({
|
|
247
|
+
lines: [sectionsIncluded],
|
|
248
|
+
displayOrder: GuestQuoteBookingCardDisplayOrder.inclusive
|
|
249
|
+
});
|
|
250
|
+
if (hasSectionLineContent(sectionsTax)) sections.push({
|
|
251
|
+
lines: [sectionsTax],
|
|
252
|
+
displayOrder: GuestQuoteBookingCardDisplayOrder.tax
|
|
253
|
+
});
|
|
254
|
+
if (sectionsOther.length > 0) sections.push({
|
|
255
|
+
lines: sectionsOther,
|
|
256
|
+
displayOrder: GuestQuoteBookingCardDisplayOrder.other
|
|
257
|
+
});
|
|
250
258
|
return sections;
|
|
251
259
|
});
|
|
252
260
|
//#endregion
|
|
253
|
-
//#region src/
|
|
261
|
+
//#region src/legacy-v9/parser/quote/to-guest-quote.ts
|
|
254
262
|
const toBaseTotal = (guestQuoteResult) => {
|
|
255
263
|
const paymentScheduleTotal = guestQuoteResult?.paymentSchedule?.total?.amount;
|
|
256
264
|
if (paymentScheduleTotal != null) return paymentScheduleTotal;
|
|
@@ -262,6 +270,14 @@ const toErrorReason = (guestQuoteResult) => {
|
|
|
262
270
|
const messages = (Array.isArray(errors) ? errors : [errors]).flatMap((error) => Object.values(error).filter((value) => typeof value === "string" && value.trim().length > 0));
|
|
263
271
|
return messages.length === 0 ? void 0 : messages.join(" ");
|
|
264
272
|
};
|
|
273
|
+
const toVoucher = ({ input, locale, translations }) => Effect.gen(function* () {
|
|
274
|
+
if (input.voucher === void 0) return void 0;
|
|
275
|
+
return {
|
|
276
|
+
code: input.voucher,
|
|
277
|
+
status: "unknown",
|
|
278
|
+
message: yield* translations.translate(locale, "quote.voucher.unknown", "The backend did not confirm whether the voucher code was applied.")
|
|
279
|
+
};
|
|
280
|
+
});
|
|
265
281
|
const toGuestQuote = (input, guestQuoteResult, locale, translations) => Effect.gen(function* () {
|
|
266
282
|
const errorReason = toErrorReason(guestQuoteResult);
|
|
267
283
|
if (errorReason !== void 0) return {
|
|
@@ -282,6 +298,11 @@ const toGuestQuote = (input, guestQuoteResult, locale, translations) => Effect.g
|
|
|
282
298
|
});
|
|
283
299
|
const baseTotal = toBaseTotal(guestQuoteResult);
|
|
284
300
|
const currency = guestQuoteResult?.currency ?? "EUR";
|
|
301
|
+
const voucher = yield* toVoucher({
|
|
302
|
+
input,
|
|
303
|
+
locale,
|
|
304
|
+
translations
|
|
305
|
+
});
|
|
285
306
|
let guestQuote = new GuestQuote({
|
|
286
307
|
input,
|
|
287
308
|
bookingCardInformation: {
|
|
@@ -291,6 +312,7 @@ const toGuestQuote = (input, guestQuoteResult, locale, translations) => Effect.g
|
|
|
291
312
|
baseTotal,
|
|
292
313
|
currency,
|
|
293
314
|
additionalServices,
|
|
315
|
+
...voucher === void 0 ? {} : { voucher },
|
|
294
316
|
backendContext: toV9QuoteBackendContext(input, guestQuoteResult),
|
|
295
317
|
updateBackendContext: updateV9QuoteBackendContext
|
|
296
318
|
});
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
3
|
-
import { b as localeToLanguage, y as makeTranslate } from "./quote-CRjV_lf-.mjs";
|
|
4
|
-
import { i as renderLabeledAttributeValue, t as renderCustomAttributeHighlight } from "./custom-attribute-D5Kb1YHA.mjs";
|
|
5
|
-
import { i as toLocalizedString, n as toImages, r as toAddress, t as toRentalHighlights } from "./to-rental-highlights-CAATPqan.mjs";
|
|
1
|
+
import { c as VofficeUnitDataFieldSchemas, d as VofficeUnitDataPropertyMetadata, f as parseVofficeFacilityData, i as toLocalizedString, l as VofficeUnitDataPropertyCategoryLabelKeys, m as parseVofficeUnitData, n as toImages, o as rentalsAllFeedbacksQuery, p as parseVofficeFeedbackData, r as toAddress, s as rentalsAllWithoutFeedbacksQuery, t as toRentalHighlights, u as VofficeUnitDataPropertyCategoryValues } from "./to-rental-highlights-CZYJeR1D.mjs";
|
|
2
|
+
import { makeTranslate, renderCustomAttributeHighlight, renderLabeledAttributeValue } from "@v-office/sdk-core";
|
|
6
3
|
import { Effect } from "effect";
|
|
7
|
-
//#region src/
|
|
4
|
+
//#region src/legacy-v9/parser/rentals/to-description.ts
|
|
8
5
|
const toDescription = (data, locale) => {
|
|
9
6
|
const description = {};
|
|
10
7
|
const intro = toLocalizedString(data.known.intro, locale);
|
|
@@ -26,7 +23,7 @@ const toDescription = (data, locale) => {
|
|
|
26
23
|
return description;
|
|
27
24
|
};
|
|
28
25
|
//#endregion
|
|
29
|
-
//#region src/
|
|
26
|
+
//#region src/legacy-v9/parser/rentals/to-location.ts
|
|
30
27
|
const toLocation = (location) => {
|
|
31
28
|
if (location == null) return void 0;
|
|
32
29
|
const [longitude, latitude] = location.coordinates;
|
|
@@ -36,7 +33,7 @@ const toLocation = (location) => {
|
|
|
36
33
|
};
|
|
37
34
|
};
|
|
38
35
|
//#endregion
|
|
39
|
-
//#region src/
|
|
36
|
+
//#region src/legacy-v9/parser/rentals/to-property.ts
|
|
40
37
|
const toProperty = (facility, locale) => {
|
|
41
38
|
const data = parseVofficeFacilityData(facility.data);
|
|
42
39
|
const name = toLocalizedString(data.known.name, locale);
|
|
@@ -49,7 +46,7 @@ const toProperty = (facility, locale) => {
|
|
|
49
46
|
return property;
|
|
50
47
|
};
|
|
51
48
|
//#endregion
|
|
52
|
-
//#region src/
|
|
49
|
+
//#region src/legacy-v9/parser/rentals/to-rental-attributes.ts
|
|
53
50
|
const GENERAL_CATEGORY$1 = {
|
|
54
51
|
key: "GENERAL",
|
|
55
52
|
labelKey: VofficeUnitDataPropertyCategoryLabelKeys.GENERAL
|
|
@@ -62,6 +59,7 @@ const PROPERTY_METADATA_ENTRIES = Object.entries(VofficeUnitDataPropertyMetadata
|
|
|
62
59
|
})).filter(({ metadata }) => metadata.category.key !== "LOCATION").sort((left, right) => {
|
|
63
60
|
return (CATEGORY_ORDER.get(left.metadata.category.key) ?? Number.MAX_SAFE_INTEGER) - (CATEGORY_ORDER.get(right.metadata.category.key) ?? Number.MAX_SAFE_INTEGER) || left.index - right.index;
|
|
64
61
|
});
|
|
62
|
+
const canRenderLabeledAttributeValue$1 = (value) => value !== false && value !== 0 && value !== "false" && value !== "0" && value != null && value !== "";
|
|
65
63
|
const toRentalAttributes = ({ locale, translations, attributes, customAttributeFilterDefinitions }) => Effect.gen(function* () {
|
|
66
64
|
const result = [];
|
|
67
65
|
const categoriesByKey = /* @__PURE__ */ new Map();
|
|
@@ -90,11 +88,13 @@ const toRentalAttributes = ({ locale, translations, attributes, customAttributeF
|
|
|
90
88
|
return subCategory;
|
|
91
89
|
});
|
|
92
90
|
for (const { key, metadata } of PROPERTY_METADATA_ENTRIES) {
|
|
91
|
+
const value = knownAttributes[key];
|
|
92
|
+
if (!canRenderLabeledAttributeValue$1(value)) continue;
|
|
93
93
|
const attribute = renderLabeledAttributeValue({
|
|
94
94
|
key,
|
|
95
95
|
label: yield* translate(metadata.labelKey, key),
|
|
96
96
|
locale,
|
|
97
|
-
value
|
|
97
|
+
value
|
|
98
98
|
});
|
|
99
99
|
if (attribute == null) continue;
|
|
100
100
|
const categoryMetadata = metadata.category ?? GENERAL_CATEGORY$1;
|
|
@@ -133,10 +133,10 @@ const toRentalAttributes = ({ locale, translations, attributes, customAttributeF
|
|
|
133
133
|
return result;
|
|
134
134
|
});
|
|
135
135
|
//#endregion
|
|
136
|
-
//#region src/
|
|
136
|
+
//#region src/legacy-v9/parser/rentals/to-rental-type.ts
|
|
137
137
|
const toRentalType = ({ translations, locale, rentalType }) => makeTranslate(translations, locale)(`Rental.rentalType.option.${rentalType}`, rentalType);
|
|
138
138
|
//#endregion
|
|
139
|
-
//#region src/
|
|
139
|
+
//#region src/legacy-v9/parser/rentals/to-rental-vicinity.ts
|
|
140
140
|
const GENERAL_CATEGORY = {
|
|
141
141
|
key: "GENERAL",
|
|
142
142
|
labelKey: VofficeUnitDataPropertyCategoryLabelKeys.GENERAL
|
|
@@ -146,16 +146,19 @@ const LOCATION_METADATA_ENTRIES = Object.entries(VofficeUnitDataPropertyMetadata
|
|
|
146
146
|
metadata,
|
|
147
147
|
index
|
|
148
148
|
})).filter(({ metadata }) => metadata.category.key === "LOCATION").sort((left, right) => left.index - right.index);
|
|
149
|
+
const canRenderLabeledAttributeValue = (value) => value !== false && value !== 0 && value !== "false" && value !== "0" && value != null && value !== "";
|
|
149
150
|
const toRentalVicinity = ({ locale, translations, attributes }) => Effect.gen(function* () {
|
|
150
151
|
const items = [];
|
|
151
152
|
const knownAttributes = attributes.known;
|
|
152
153
|
const translate = makeTranslate(translations, locale);
|
|
153
154
|
for (const { key, metadata } of LOCATION_METADATA_ENTRIES) {
|
|
155
|
+
const value = knownAttributes[key];
|
|
156
|
+
if (!canRenderLabeledAttributeValue(value)) continue;
|
|
154
157
|
const item = renderLabeledAttributeValue({
|
|
155
158
|
key,
|
|
156
159
|
label: yield* translate(metadata.labelKey, key),
|
|
157
160
|
locale,
|
|
158
|
-
value
|
|
161
|
+
value
|
|
159
162
|
});
|
|
160
163
|
if (item != null) items.push(item);
|
|
161
164
|
}
|
|
@@ -166,7 +169,7 @@ const toRentalVicinity = ({ locale, translations, attributes }) => Effect.gen(fu
|
|
|
166
169
|
}];
|
|
167
170
|
});
|
|
168
171
|
//#endregion
|
|
169
|
-
//#region src/
|
|
172
|
+
//#region src/legacy-v9/parser/rentals/to-reviews.ts
|
|
170
173
|
const toClassification = (rating) => {
|
|
171
174
|
if (rating >= 4.5) return "excellent";
|
|
172
175
|
if (rating >= 4) return "very-good";
|
|
@@ -224,7 +227,7 @@ const toReviews = ({ locale, translations, rental }) => Effect.gen(function* ()
|
|
|
224
227
|
};
|
|
225
228
|
});
|
|
226
229
|
//#endregion
|
|
227
|
-
//#region src/
|
|
230
|
+
//#region src/legacy-v9/parser/rentals/to-rental-list-item.ts
|
|
228
231
|
const toRentalRentalsOutput = ({ rental, locale, translations, imageProxyBaseUrl, rentalHighlightPrioritization, customAttributeFilterDefinitions }) => Effect.gen(function* () {
|
|
229
232
|
const data = parseVofficeUnitData(rental.data);
|
|
230
233
|
const rawRentalType = data.known.type?.trim();
|
|
@@ -278,4 +281,7 @@ const toRentalRentalsOutput = ({ rental, locale, translations, imageProxyBaseUrl
|
|
|
278
281
|
return item;
|
|
279
282
|
});
|
|
280
283
|
//#endregion
|
|
281
|
-
|
|
284
|
+
//#region src/legacy-v9/runtime/rentals.ts
|
|
285
|
+
const defaultRentalDataAttributes = Object.keys(VofficeUnitDataFieldSchemas);
|
|
286
|
+
//#endregion
|
|
287
|
+
export { defaultRentalDataAttributes, rentalsAllFeedbacksQuery, rentalsAllWithoutFeedbacksQuery, toRentalRentalsOutput };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
import { n as toImages, r as toAddress, t as toRentalHighlights } from "./to-rental-highlights-CAATPqan.mjs";
|
|
1
|
+
import { n as stable_filters_default } from "./client-xkXV7Nf-.mjs";
|
|
2
|
+
import { a as searchQuery, c as VofficeUnitDataFieldSchemas, m as parseVofficeUnitData, n as toImages, r as toAddress, t as toRentalHighlights } from "./to-rental-highlights-CZYJeR1D.mjs";
|
|
3
|
+
import { CoreSDKError, STABLE_SEARCH_INPUTS, collectQueryParameters, daysBetweenLocalDates, expandCustomAttributeFilterCompositions, parseChildrenAges, parseOccupancyCount, parseQueryParameters, toCustomAttributeFilterLabel, toFormattedSearchPrice, toIsoDateFromPeriodQueryDate, toQueryString, toStableSearchInputBackendQueryKeys, toStableSearchInputParameterValues, toStableSearchInputQueryKeys, toUnusedFilterKeys } from "@v-office/sdk-core";
|
|
5
4
|
import { Effect } from "effect";
|
|
6
|
-
//#region src/
|
|
5
|
+
//#region src/legacy-v9/parser/search/input/filter/apply-voffice-filter-derived-basic-query-inputs.ts
|
|
7
6
|
const hasBasicQueryInput = ({ basicQueryInputs, key }) => basicQueryInputs.some((input) => input.key === key);
|
|
8
7
|
const derivedBooleanFilters = [{
|
|
9
8
|
key: "pets",
|
|
@@ -32,10 +31,10 @@ const applyVofficeFilterDerivedBasicQueryInputs = ({ appliedFilters, basicQueryI
|
|
|
32
31
|
};
|
|
33
32
|
});
|
|
34
33
|
//#endregion
|
|
35
|
-
//#region src/
|
|
34
|
+
//#region src/legacy-v9/parser/search/input/filter/filter-query-keys.ts
|
|
36
35
|
const FILTER_QUERY_KEYS = new Set(Object.keys(stable_filters_default));
|
|
37
36
|
//#endregion
|
|
38
|
-
//#region src/
|
|
37
|
+
//#region src/legacy-v9/parser/search/input/filter/to-basic-query-inputs.ts
|
|
39
38
|
const isEnabledBooleanFilter = (value) => {
|
|
40
39
|
const normalizedValue = value.toLowerCase();
|
|
41
40
|
return normalizedValue === "" || normalizedValue === "true" || normalizedValue === "1";
|
|
@@ -129,10 +128,10 @@ const toBasicQueryInputs = ({ query, customAttributeFilterDefinitions, locale, t
|
|
|
129
128
|
};
|
|
130
129
|
};
|
|
131
130
|
//#endregion
|
|
132
|
-
//#region src/
|
|
131
|
+
//#region src/legacy-v9/parser/search/input/occupancy/occupancy-query-keys.ts
|
|
133
132
|
const OCCUPANCY_QUERY_KEYS = toStableSearchInputQueryKeys(STABLE_SEARCH_INPUTS.occupancy);
|
|
134
133
|
//#endregion
|
|
135
|
-
//#region src/
|
|
134
|
+
//#region src/legacy-v9/parser/search/input/occupancy/collect-occupancy-query-parameters.ts
|
|
136
135
|
const hasOccupancyInput = (query) => parseQueryParameters(query).some(([key]) => OCCUPANCY_QUERY_KEYS.has(key));
|
|
137
136
|
const collectOccupancyQueryParameters = ({ query }) => {
|
|
138
137
|
const { matchingParameters, remainingParameters } = collectQueryParameters({
|
|
@@ -145,7 +144,7 @@ const collectOccupancyQueryParameters = ({ query }) => {
|
|
|
145
144
|
};
|
|
146
145
|
};
|
|
147
146
|
//#endregion
|
|
148
|
-
//#region src/
|
|
147
|
+
//#region src/legacy-v9/parser/search/input/occupancy/to-occupancy-input.ts
|
|
149
148
|
const parseStableOccupancyCount = ({ key, occupancyParameters }) => Effect.gen(function* () {
|
|
150
149
|
const values = toStableSearchInputParameterValues({
|
|
151
150
|
key,
|
|
@@ -185,20 +184,20 @@ const toOccupancyInput = ({ query }) => Effect.gen(function* () {
|
|
|
185
184
|
};
|
|
186
185
|
});
|
|
187
186
|
//#endregion
|
|
188
|
-
//#region src/
|
|
189
|
-
const failInvalidV9SearchInput = (message) => Effect.fail(new
|
|
190
|
-
|
|
191
|
-
operation: "search",
|
|
187
|
+
//#region src/legacy-v9/parser/search/input/search-input-error.ts
|
|
188
|
+
const failInvalidV9SearchInput = (message) => Effect.fail(new CoreSDKError({
|
|
189
|
+
source: "v10",
|
|
190
|
+
operation: "v9.search",
|
|
192
191
|
message
|
|
193
192
|
}));
|
|
194
193
|
//#endregion
|
|
195
|
-
//#region src/
|
|
194
|
+
//#region src/legacy-v9/parser/search/input/period/period-query-keys.ts
|
|
196
195
|
const PERIOD_QUERY_KEYS = toStableSearchInputBackendQueryKeys({
|
|
197
196
|
backend: "v9",
|
|
198
197
|
group: STABLE_SEARCH_INPUTS.period
|
|
199
198
|
});
|
|
200
199
|
//#endregion
|
|
201
|
-
//#region src/
|
|
200
|
+
//#region src/legacy-v9/parser/search/input/period/collect-period-query-parameters.ts
|
|
202
201
|
const hasPeriodInput = (query) => parseQueryParameters(query).some(([key]) => PERIOD_QUERY_KEYS.has(key));
|
|
203
202
|
const collectPeriodQueryParameters = ({ query }) => {
|
|
204
203
|
const { matchingParameters, remainingParameters } = collectQueryParameters({
|
|
@@ -211,7 +210,7 @@ const collectPeriodQueryParameters = ({ query }) => {
|
|
|
211
210
|
};
|
|
212
211
|
};
|
|
213
212
|
//#endregion
|
|
214
|
-
//#region src/
|
|
213
|
+
//#region src/legacy-v9/parser/search/input/period/to-period-input.ts
|
|
215
214
|
const parseScalarParameter = ({ key, values }) => {
|
|
216
215
|
if (values.length > 1) return failInvalidV9SearchInput(`Expected at most one "${key}" query parameter.`);
|
|
217
216
|
return Effect.succeed(values[0]);
|
|
@@ -284,7 +283,7 @@ const toPeriodInput = ({ query }) => Effect.gen(function* () {
|
|
|
284
283
|
};
|
|
285
284
|
});
|
|
286
285
|
//#endregion
|
|
287
|
-
//#region src/
|
|
286
|
+
//#region src/legacy-v9/parser/search/input/to-query-input.ts
|
|
288
287
|
const toQueryInput = ({ query, customAttributeFilterDefinitions, locale, translations }) => Effect.gen(function* () {
|
|
289
288
|
const compositionResult = expandCustomAttributeFilterCompositions({
|
|
290
289
|
customAttributeFilterDefinitions,
|
|
@@ -325,18 +324,18 @@ const toQueryInput = ({ query, customAttributeFilterDefinitions, locale, transla
|
|
|
325
324
|
};
|
|
326
325
|
});
|
|
327
326
|
//#endregion
|
|
328
|
-
//#region src/
|
|
329
|
-
const DEFAULT_V9_SEARCH_CURRENCY = "EUR";
|
|
327
|
+
//#region src/legacy-v9/parser/search/output/to-formatted-price.ts
|
|
328
|
+
const DEFAULT_V9_SEARCH_CURRENCY$1 = "EUR";
|
|
330
329
|
const toFormattedPrice = ({ locale, calc }) => {
|
|
331
330
|
if (calc?.total == null) return Effect.succeed(null);
|
|
332
331
|
return Effect.succeed(toFormattedSearchPrice({
|
|
333
332
|
amount: calc.total,
|
|
334
|
-
currency: DEFAULT_V9_SEARCH_CURRENCY,
|
|
333
|
+
currency: DEFAULT_V9_SEARCH_CURRENCY$1,
|
|
335
334
|
locale
|
|
336
335
|
}));
|
|
337
336
|
};
|
|
338
337
|
//#endregion
|
|
339
|
-
//#region src/
|
|
338
|
+
//#region src/legacy-v9/parser/search/to-search-output-item.ts
|
|
340
339
|
const toSearchOutputItem = ({ locale, imageProxyBaseUrl, rentalHighlightPrioritization, customAttributeFilterDefinitions, rental, translations, includeFormattedTotal }) => Effect.gen(function* () {
|
|
341
340
|
const data = parseVofficeUnitData(rental.data);
|
|
342
341
|
const item = {
|
|
@@ -364,4 +363,22 @@ const toSearchOutputItem = ({ locale, imageProxyBaseUrl, rentalHighlightPrioriti
|
|
|
364
363
|
return item;
|
|
365
364
|
});
|
|
366
365
|
//#endregion
|
|
367
|
-
|
|
366
|
+
//#region src/legacy-v9/parser/search/output/to-alternative-periods.ts
|
|
367
|
+
const DEFAULT_V9_SEARCH_CURRENCY = "EUR";
|
|
368
|
+
const toAlternativePeriods = ({ locale, alternatives }) => Effect.succeed((alternatives ?? []).flatMap((alternative) => {
|
|
369
|
+
if (alternative.fromdate == null || alternative.tilldate == null) return [];
|
|
370
|
+
return [{
|
|
371
|
+
start: alternative.fromdate,
|
|
372
|
+
end: alternative.tilldate,
|
|
373
|
+
...alternative.calc?.total == null ? {} : { formattedTotal: toFormattedSearchPrice({
|
|
374
|
+
amount: alternative.calc.total,
|
|
375
|
+
currency: DEFAULT_V9_SEARCH_CURRENCY,
|
|
376
|
+
locale
|
|
377
|
+
}) }
|
|
378
|
+
}];
|
|
379
|
+
}));
|
|
380
|
+
//#endregion
|
|
381
|
+
//#region src/legacy-v9/runtime/search.ts
|
|
382
|
+
const defaultSearchDataAttributes = Object.keys(VofficeUnitDataFieldSchemas);
|
|
383
|
+
//#endregion
|
|
384
|
+
export { defaultSearchDataAttributes, searchQuery, toAlternativePeriods, toQueryInput, toSearchOutputItem };
|