@v-office/website-sdk 3.3.0 → 3.4.1
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-BlQ5phsZ.mjs → client-DY2AASUk.mjs} +123 -120
- package/dist/index.d.mts +209 -166
- package/dist/index.mjs +2 -2
- package/dist/instructions/CHANGELOG.md +2 -0
- package/dist/instructions/MIGRATION.md +2 -0
- package/dist/instructions/quote.md +2 -2
- package/dist/instructions/rentals.md +41 -0
- package/dist/instructions/search.md +2 -1
- package/dist/instructions/versions/3.4.0/CHANGELOG.md +39 -0
- package/dist/instructions/versions/3.4.0/MIGRATION.md +44 -0
- package/dist/instructions/versions/3.4.1/CHANGELOG.md +20 -0
- package/dist/instructions/versions/3.4.1/MIGRATION.md +9 -0
- package/dist/{operations-Db2hRCLQ.mjs → operations-DY2e_2Hd.mjs} +235 -5
- package/dist/{quote-Co8iWjF6.mjs → quote-Bbw_fcGm.mjs} +25 -34
- package/dist/{rentals-z97dUqwO.mjs → rentals-CgNZbpAB.mjs} +45 -4
- package/dist/{search-C4j2QSpv.mjs → search-CqFOCZ8I.mjs} +3 -3
- package/dist/{to-rental-highlights-BFLLKF6M.mjs → to-rental-highlights-DptWc7-q.mjs} +1 -1
- package/dist/translations/shared/de-DE/quote.json +2 -0
- package/dist/translations/shared/en-US/quote.json +2 -0
- package/instructions/CHANGELOG.md +2 -0
- package/instructions/MIGRATION.md +2 -0
- package/instructions/quote.md +2 -2
- package/instructions/rentals.md +41 -0
- package/instructions/search.md +2 -1
- package/instructions/versions/3.4.0/CHANGELOG.md +39 -0
- package/instructions/versions/3.4.0/MIGRATION.md +44 -0
- package/instructions/versions/3.4.0/release.json +3 -0
- package/instructions/versions/3.4.1/CHANGELOG.md +20 -0
- package/instructions/versions/3.4.1/MIGRATION.md +9 -0
- package/instructions/versions/3.4.1/release.json +3 -0
- package/package.json +3 -3
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { GuestQuote, GuestQuoteBookingCardDisplayOrder, addGuestQuoteAdditionalServiceSelection, formatCurrency, toNightCount } from "@v-office/sdk-core";
|
|
2
2
|
import { DateTime, Effect } from "effect";
|
|
3
|
-
//#region src/legacy-v9/parser/quote/to-additional-service-calculation.ts
|
|
4
|
-
const toAdditionalServiceCalculation = (line) => {
|
|
5
|
-
switch (line.calculation) {
|
|
6
|
-
case "NIGHT": return "PER_NIGHT";
|
|
7
|
-
case "DAY": return "PER_DAY";
|
|
8
|
-
case "USAGE": return "PER_USAGE";
|
|
9
|
-
case "FLAT": return "FLAT";
|
|
10
|
-
default: return "FLAT";
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
//#endregion
|
|
14
3
|
//#region src/legacy-v9/parser/quote/to-charge.ts
|
|
15
4
|
const toCharge = ({ serviceLine, chargeAmount, currency, locale, translations }) => Effect.gen(function* () {
|
|
16
5
|
if (chargeAmount === 0) return yield* translations.translate(locale, "quote.additionalService.free");
|
|
17
6
|
switch (serviceLine.calculation) {
|
|
18
7
|
case "NIGHT": return `${formatCurrency(chargeAmount, locale, currency)}${yield* translations.translate(locale, "quote.additionalService.night")}`;
|
|
19
8
|
case "DAY": return `${formatCurrency(chargeAmount, locale, currency)}${yield* translations.translate(locale, "quote.additionalService.day")}`;
|
|
9
|
+
case "WEEK": return `${formatCurrency(chargeAmount, locale, currency)}${yield* translations.translate(locale, "quote.additionalService.week")}`;
|
|
10
|
+
case "MONTH": return `${formatCurrency(chargeAmount, locale, currency)}${yield* translations.translate(locale, "quote.additionalService.month")}`;
|
|
20
11
|
default: return formatCurrency(chargeAmount, locale, currency);
|
|
21
12
|
}
|
|
22
13
|
});
|
|
23
14
|
//#endregion
|
|
15
|
+
//#region src/legacy-v9/parser/quote/to-charge-units.ts
|
|
16
|
+
const toChargeUnits = (line, input) => {
|
|
17
|
+
const nights = toNightCount(input.period);
|
|
18
|
+
switch (line.calculation) {
|
|
19
|
+
case "NIGHT": return line.timespan ?? nights;
|
|
20
|
+
case "DAY": return line.timespan ?? nights + 1;
|
|
21
|
+
case "WEEK": return line.timespan ?? nights / 7;
|
|
22
|
+
case "MONTH": return line.timespan ?? Math.floor(nights / 30);
|
|
23
|
+
default: return 1;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
24
27
|
//#region src/legacy-v9/parser/quote/to-charge-amount.ts
|
|
25
28
|
const toChargeAmount = ({ input, serviceLine }) => {
|
|
26
29
|
if (serviceLine.total == null) return void 0;
|
|
30
|
+
const units = toChargeUnits(serviceLine, input);
|
|
31
|
+
if (units <= 0) return void 0;
|
|
27
32
|
const quantity = serviceLine.amount != null && serviceLine.amount > 0 ? serviceLine.amount : 1;
|
|
28
|
-
|
|
29
|
-
case "NIGHT": return serviceLine.total / toNightCount(input.period) / quantity;
|
|
30
|
-
case "DAY": return serviceLine.total / toNightCount(input.period) / quantity;
|
|
31
|
-
case "USAGE": return serviceLine.total / quantity;
|
|
32
|
-
default: return serviceLine.total / quantity;
|
|
33
|
-
}
|
|
33
|
+
return serviceLine.total / quantity / units;
|
|
34
34
|
};
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region src/legacy-v9/parser/quote/to-service-line-label.ts
|
|
@@ -110,7 +110,7 @@ const toAdditionalServices = ({ input, guestQuoteResult, locale, translations })
|
|
|
110
110
|
label,
|
|
111
111
|
charge,
|
|
112
112
|
chargeAmount,
|
|
113
|
-
|
|
113
|
+
chargeUnits: toChargeUnits(line, input),
|
|
114
114
|
...proposedQuantity === void 0 ? {} : { proposedQuantity },
|
|
115
115
|
...maxPerBooking === void 0 ? {} : { maxPerBooking },
|
|
116
116
|
...leadTimeDays === void 0 ? {} : { leadTimeDays },
|
|
@@ -123,33 +123,24 @@ const toAdditionalServices = ({ input, guestQuoteResult, locale, translations })
|
|
|
123
123
|
//#endregion
|
|
124
124
|
//#region src/legacy-v9/parser/quote/to-backend-context.ts
|
|
125
125
|
const toSelectionQuantity = (selections, serviceId) => selections.find((selection) => selection.id === serviceId)?.quantity ?? 0;
|
|
126
|
-
const toSelectedTotal = (line, amount) =>
|
|
127
|
-
|
|
128
|
-
switch (line.calculation) {
|
|
129
|
-
case "NIGHT": return line.price * amount * (line.timespan ?? 1);
|
|
130
|
-
case "DAY": return line.price * amount * (line.timespan ?? 1);
|
|
131
|
-
case "PERC": return line.price * amount;
|
|
132
|
-
case "USAGE": return line.price * amount;
|
|
133
|
-
default: return line.price * amount;
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
const withSelectedAmount = (line, selections) => {
|
|
126
|
+
const toSelectedTotal = (line, amount, input) => line.price == null ? void 0 : Math.round(line.price * amount * toChargeUnits(line, input));
|
|
127
|
+
const withSelectedAmount = (line, selections, input) => {
|
|
137
128
|
const serviceId = getLineServiceId(line);
|
|
138
129
|
if (serviceId === void 0) return line;
|
|
139
130
|
const amount = toSelectionQuantity(selections, serviceId);
|
|
140
|
-
const total = toSelectedTotal(line, amount);
|
|
131
|
+
const total = toSelectedTotal(line, amount, input);
|
|
141
132
|
return {
|
|
142
133
|
...line,
|
|
143
134
|
amount,
|
|
144
135
|
...total === void 0 ? {} : { total }
|
|
145
136
|
};
|
|
146
137
|
};
|
|
147
|
-
const withSelectedServiceAmounts = (quote, selections) => {
|
|
138
|
+
const withSelectedServiceAmounts = (quote, selections, input) => {
|
|
148
139
|
if (quote === void 0) return quote;
|
|
149
140
|
return {
|
|
150
141
|
...quote,
|
|
151
|
-
...quote.optional === void 0 ? {} : { optional: quote.optional.map((line) => withSelectedAmount(line, selections)) },
|
|
152
|
-
...quote.onsiteOptional === void 0 ? {} : { onsiteOptional: quote.onsiteOptional.map((line) => withSelectedAmount(line, selections)) }
|
|
142
|
+
...quote.optional === void 0 ? {} : { optional: quote.optional.map((line) => withSelectedAmount(line, selections, input)) },
|
|
143
|
+
...quote.onsiteOptional === void 0 ? {} : { onsiteOptional: quote.onsiteOptional.map((line) => withSelectedAmount(line, selections, input)) }
|
|
153
144
|
};
|
|
154
145
|
};
|
|
155
146
|
const toV9QuoteBackendContext = (input, guestQuoteResult) => ({
|
|
@@ -161,7 +152,7 @@ const updateV9QuoteBackendContext = (context, selections) => {
|
|
|
161
152
|
if (context.backend !== "v9") return context;
|
|
162
153
|
return {
|
|
163
154
|
...context,
|
|
164
|
-
rawQuote: withSelectedServiceAmounts(context.rawQuote, selections)
|
|
155
|
+
rawQuote: withSelectedServiceAmounts(context.rawQuote, selections, context.input)
|
|
165
156
|
};
|
|
166
157
|
};
|
|
167
158
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
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,
|
|
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-
|
|
1
|
+
import { $t as V9_FACILITY_ATTRIBUTE_KEYS } from "./client-DY2AASUk.mjs";
|
|
2
|
+
import { C as parseVofficeOfferData, S as parseVofficeFeedbackData, T as parseVofficeUnitData, _ 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, x as parseVofficeFacilityData } from "./operations-DY2e_2Hd.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-DptWc7-q.mjs";
|
|
4
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
|
|
@@ -586,6 +586,47 @@ const toRentalRentalsOutput = ({ rental, locale, translations, imageProxyBaseUrl
|
|
|
586
586
|
return item;
|
|
587
587
|
});
|
|
588
588
|
//#endregion
|
|
589
|
+
//#region src/legacy-v9/parser/rentals/to-rental-offers.ts
|
|
590
|
+
const HUNDREDTHS = 100;
|
|
591
|
+
const toDiscount = ({ discountType, value, minStay }) => {
|
|
592
|
+
if (value == null) return void 0;
|
|
593
|
+
switch (discountType) {
|
|
594
|
+
case "PERCENT": return {
|
|
595
|
+
type: "percent",
|
|
596
|
+
percent: value / HUNDREDTHS
|
|
597
|
+
};
|
|
598
|
+
case "FLAT": return {
|
|
599
|
+
type: "amount",
|
|
600
|
+
amount: {
|
|
601
|
+
amount: value,
|
|
602
|
+
currency: "EUR"
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
case "XY": return minStay == null ? void 0 : {
|
|
606
|
+
type: "stayPay",
|
|
607
|
+
stayNights: minStay,
|
|
608
|
+
payNights: value / HUNDREDTHS
|
|
609
|
+
};
|
|
610
|
+
default: return;
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
const isPublic = ({ known, unknown }) => known.visible4interfaces === true && known.voucherCode == null && !("voucherCode" in unknown);
|
|
614
|
+
const toRentalOffers = (offers) => (offers ?? []).flatMap((offer) => {
|
|
615
|
+
const data = parseVofficeOfferData(offer.data);
|
|
616
|
+
const { name, minStay, timeSpan, fromdate, tilldate } = data.known;
|
|
617
|
+
const discount = toDiscount(data.known);
|
|
618
|
+
if (!isPublic(data) || name == null || discount === void 0) return [];
|
|
619
|
+
return [{
|
|
620
|
+
id: String(offer.voffice_offer_id),
|
|
621
|
+
name,
|
|
622
|
+
discount,
|
|
623
|
+
...minStay == null ? {} : { minNights: minStay },
|
|
624
|
+
...timeSpan == null ? {} : { arrivalWithinDays: timeSpan },
|
|
625
|
+
...fromdate == null ? {} : { validFrom: fromdate },
|
|
626
|
+
...tilldate == null ? {} : { validUntil: tilldate }
|
|
627
|
+
}];
|
|
628
|
+
});
|
|
629
|
+
//#endregion
|
|
589
630
|
//#region src/legacy-v9/static/associate-rentals-with-facilities-by-object-groups.ts
|
|
590
631
|
const operation = "v9.rentals.facility-object-group-relation";
|
|
591
632
|
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -666,4 +707,4 @@ const associateRentalsWithFacilitiesByObjectGroups = ({ attributeId, facilities,
|
|
|
666
707
|
//#region src/legacy-v9/runtime/rentals.ts
|
|
667
708
|
const defaultRentalDataAttributes = Object.keys(VofficeUnitDataFieldSchemas);
|
|
668
709
|
//#endregion
|
|
669
|
-
export { associateRentalsWithFacilitiesByObjectGroups, defaultRentalDataAttributes, facilityTextsQuery, hubFiltersQuery, parseVofficeFacilityData, parseVofficeUnitData, rentalFacilitiesForObjectGroupRelationQuery, rentalIdsQuery, rentalTextsQuery, rentalsAllByFacilityObjectGroupsWithoutFeedbacksQuery, rentalsAllFeedbacksQuery, rentalsAllWithoutFeedbacksQuery, toRentalRentalsOutput };
|
|
710
|
+
export { associateRentalsWithFacilitiesByObjectGroups, defaultRentalDataAttributes, facilityTextsQuery, hubFiltersQuery, parseVofficeFacilityData, parseVofficeUnitData, rentalFacilitiesForObjectGroupRelationQuery, rentalIdsQuery, rentalTextsQuery, rentalsAllByFacilityObjectGroupsWithoutFeedbacksQuery, rentalsAllFeedbacksQuery, rentalsAllWithoutFeedbacksQuery, toRentalOffers, toRentalRentalsOutput };
|
|
@@ -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 {
|
|
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-
|
|
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-DY2AASUk.mjs";
|
|
2
|
+
import { T as parseVofficeUnitData, n as mapSearchQuery, r as searchQuery } from "./operations-DY2e_2Hd.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-DptWc7-q.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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as VofficeUnitDataPropertyMetadata } from "./operations-
|
|
1
|
+
import { v as VofficeUnitDataPropertyMetadata } from "./operations-DY2e_2Hd.mjs";
|
|
2
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
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
"quote.sections.tax": "Steuern & Abgaben",
|
|
5
5
|
"quote.additionalService.day": " / Tag",
|
|
6
6
|
"quote.additionalService.night": " / Nacht",
|
|
7
|
+
"quote.additionalService.week": " / Woche",
|
|
8
|
+
"quote.additionalService.month": " / Monat",
|
|
7
9
|
"quote.additionalService.free": "kostenlos",
|
|
8
10
|
"quote.status.unavailable.notBookable": "Nicht verfügbar",
|
|
9
11
|
"quote.optionCombination.unavailable": "Diese Optionskombination ist nicht verfügbar.",
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
"quote.sections.tax": "Taxes & Fees",
|
|
5
5
|
"quote.additionalService.day": " / day",
|
|
6
6
|
"quote.additionalService.night": " / night",
|
|
7
|
+
"quote.additionalService.week": " / week",
|
|
8
|
+
"quote.additionalService.month": " / month",
|
|
7
9
|
"quote.additionalService.free": "free",
|
|
8
10
|
"quote.status.unavailable.notBookable": "Not available",
|
|
9
11
|
"quote.optionCombination.unavailable": "This option combination is unavailable.",
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
Release notes of `@v-office/website-sdk`, newest first. Each version has its own directory.
|
|
6
6
|
|
|
7
|
+
- `versions/3.4.1/CHANGELOG.md`: release notes for 3.4.1
|
|
8
|
+
- `versions/3.4.0/CHANGELOG.md`: release notes for 3.4.0
|
|
7
9
|
- `versions/3.3.0/CHANGELOG.md`: release notes for 3.3.0
|
|
8
10
|
- `versions/3.2.1/CHANGELOG.md`: release notes for 3.2.1
|
|
9
11
|
- `versions/3.2.0/CHANGELOG.md`: release notes for 3.2.0
|
|
@@ -4,6 +4,8 @@
|
|
|
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.4.1/MIGRATION.md`: Migration: 3.4.0 to 3.4.1
|
|
8
|
+
- `versions/3.4.0/MIGRATION.md`: Migration: 3.3.0 to 3.4.0
|
|
7
9
|
- `versions/3.3.0/MIGRATION.md`: Migration: 3.2.1 to 3.3.0
|
|
8
10
|
- `versions/3.2.1/MIGRATION.md`: Migration: 3.2.0 to 3.2.1
|
|
9
11
|
- `versions/3.2.0/MIGRATION.md`: Migration: 3.1.1 to 3.2.0
|
package/instructions/quote.md
CHANGED
|
@@ -478,10 +478,10 @@ const insuranceBooking = await sdk.live.quote.bookInsurance({
|
|
|
478
478
|
This is a breaking change in 2.13.0. The former public `guestToken` input is no
|
|
479
479
|
longer used; see `versions/2.13.0/MIGRATION.md`.
|
|
480
480
|
|
|
481
|
-
`v9` supports real insurance option refresh, pre-contract, payment selection, and booking. With ERGO,
|
|
481
|
+
`v9` supports real insurance option refresh, pre-contract, payment selection, and booking. With ERGO, the booking's active policy can be read and revoked (rejects on other accounts). Both need the booking and reject when it has no active policy with that number; revoking rejects with ERGO's reason when ERGO refuses:
|
|
482
482
|
|
|
483
483
|
```ts
|
|
484
|
-
const policy = await sdk.live.insurance.readPolicy({ policyNumber });
|
|
484
|
+
const policy = await sdk.live.insurance.readPolicy({ policyNumber, booking });
|
|
485
485
|
const revoked = await sdk.live.insurance.revokePolicy({ policyNumber, booking });
|
|
486
486
|
```
|
|
487
487
|
|
package/instructions/rentals.md
CHANGED
|
@@ -578,6 +578,47 @@ A feedback with neither rating nor text is never an item. `summary.rating` and
|
|
|
578
578
|
covers the included items. When no included item has a rating, `reviews` has
|
|
579
579
|
`items` and no `summary`. A text answer to a `text` criterion counts as text.
|
|
580
580
|
|
|
581
|
+
### Legacy v9 Special Offers
|
|
582
|
+
|
|
583
|
+
On v9, every item of `getRentals` and `getRentalsByIds` has `offers`: the special offers
|
|
584
|
+
vOffice links to the rental, without a period. Use them for an "Angebot" badge on a rental
|
|
585
|
+
page, an offers overview, or a campaign page. A rental without offers has `offers: []`;
|
|
586
|
+
that is the normal case, so hide the offer UI then instead of showing an empty state.
|
|
587
|
+
|
|
588
|
+
```ts
|
|
589
|
+
type V9RentalOffer = {
|
|
590
|
+
id: string; // vOffice offer ID
|
|
591
|
+
name: string; // in the requested locale where vOffice has a translation
|
|
592
|
+
discount:
|
|
593
|
+
| { type: "percent"; percent: number } // 15 = 15 %
|
|
594
|
+
| { type: "amount"; amount: { amount: number; currency: string } } // minor unit, 2000 = 20,00 €
|
|
595
|
+
| { type: "stayPay"; stayNights: number; payNights: number }; // stay 7, pay 5
|
|
596
|
+
minNights?: number;
|
|
597
|
+
arrivalWithinDays?: number; // last minute: arrival at most this many days away
|
|
598
|
+
validFrom?: string; // YYYY-MM-DD, the arrival is not before this day
|
|
599
|
+
validUntil?: string; // YYYY-MM-DD, the departure is not after this day
|
|
600
|
+
};
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
- `id` is the value the `offer` search filter takes
|
|
604
|
+
([Special Offers](search.md#special-offers)), so a campaign page can link to a search
|
|
605
|
+
for its rentals. It is the Hub's `voffice_offer_id`. The Hub's `data(attributes: ["id"])`
|
|
606
|
+
is its own row ID and filters nothing, and the dates are `fromdate`/`tilldate`
|
|
607
|
+
(`validfrom`, `from_date` and similar spellings return `null`). Read `offers` instead of
|
|
608
|
+
querying the Hub.
|
|
609
|
+
- The SDK leaves out offers vOffice does not show to websites and offers redeemed with a
|
|
610
|
+
voucher code. The code never reaches the page.
|
|
611
|
+
- Offers come from the be-on! Hub's last import of the vOffice data, like the rest of
|
|
612
|
+
the rental. An offer can be linked and still apply to no stay in a given period: only a
|
|
613
|
+
search with dates says what it costs. Do not render "12 rentals on offer" as a property
|
|
614
|
+
of the campaign; it holds for one period only.
|
|
615
|
+
- `validFrom` and `validUntil` are the vOffice dates as stored. Hide an offer whose
|
|
616
|
+
`validUntil` has passed in the browser, not only at build time, since a static page can
|
|
617
|
+
outlive it.
|
|
618
|
+
- Many rentals share the same offer. For an overview page, group by `id`.
|
|
619
|
+
|
|
620
|
+
v10 rentals have no `offers`.
|
|
621
|
+
|
|
581
622
|
## Legacy v9 Rentals By ID
|
|
582
623
|
|
|
583
624
|
`sdk.live.rentals.getRentalsByIds` loads the rentals with the given IDs, for example the
|
package/instructions/search.md
CHANGED
|
@@ -398,7 +398,8 @@ the `p_` number. Confirm the field with the user before you offer the filter.
|
|
|
398
398
|
page about one campaign, for example an early-booking deal. It checks neither whether
|
|
399
399
|
the offer is shown to websites nor whether it applies to the requested period, so a
|
|
400
400
|
rental can match after its offer has ended. When the question is "which rentals have
|
|
401
|
-
a deal right now", use `offers`. Request `--offer`.
|
|
401
|
+
a deal right now", use `offers`. Request `--offer`. The offer ID is the `id` of a
|
|
402
|
+
rental's `offers` entry ([Legacy v9 Special Offers](rentals.md#legacy-v9-special-offers)).
|
|
402
403
|
|
|
403
404
|
`offers` is a `boolean` definition and `offer` an `int` definition with the offer ID:
|
|
404
405
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Changelog: 3.4.0
|
|
2
|
+
|
|
3
|
+
ERGO insurance on v9 works again. The be-on! Hub now gives ERGO policies only to a guest who
|
|
4
|
+
proves the booking, and it refused every ERGO call of 3.3.0 and earlier, from the pre-contract
|
|
5
|
+
on. The SDK now sends the booking's guest token, reservation number and booking ID with every
|
|
6
|
+
ERGO call. A v9 site can also show a rental's special offers without a period: an "Angebot"
|
|
7
|
+
badge on the rental page, an offers overview or a campaign page.
|
|
8
|
+
|
|
9
|
+
## Added
|
|
10
|
+
|
|
11
|
+
- v9: `offers` on every item of `sdk.static.rentals.getRentals` and
|
|
12
|
+
`sdk.live.rentals.getRentalsByIds`, `[]` when the rental has none. Each offer has `id` (the
|
|
13
|
+
vOffice offer ID, the value the `offer` search filter takes), `name`, `discount` (`percent`,
|
|
14
|
+
`amount` or `stayPay`), and when vOffice states them `minNights`, `arrivalWithinDays`,
|
|
15
|
+
`validFrom` and `validUntil`. Offers that vOffice does not show to websites and offers redeemed
|
|
16
|
+
with a voucher code are left out.
|
|
17
|
+
- Types `V9RentalOffer`, `V9RentalOfferDiscount`, `V9RentalGetRentalsOutput` and
|
|
18
|
+
`V9RentalGetRentalsOutputItem`.
|
|
19
|
+
- `rentals.md` ("Legacy v9 Special Offers"): the offer fields, the empty case, and what a page
|
|
20
|
+
must not conclude from them.
|
|
21
|
+
|
|
22
|
+
## Changed
|
|
23
|
+
|
|
24
|
+
- `live.insurance.readPolicy` takes the booking: `readPolicy({ policyNumber, booking })`, the same
|
|
25
|
+
input as `revokePolicy`. It returns the booking's active policy and rejects when the booking has
|
|
26
|
+
no active policy or holds a different one. A revoked policy can no longer be read.
|
|
27
|
+
- `revokePolicy` checks that the booking's active policy has the given number before it asks ERGO
|
|
28
|
+
to revoke it. When it has another number or there is none, it rejects and nothing is revoked.
|
|
29
|
+
- ERGO errors from the Hub (booking not confirmed, no active policy, a policy already active,
|
|
30
|
+
vOffice unreachable) reject with the Hub's message.
|
|
31
|
+
- v9: `KnownVofficeOfferData` (`VofficeOfferDataFieldSchemas`) declares the fields the be-on! Hub
|
|
32
|
+
returns: `name`, `description`, `type`, `discountType`, `value`, `minStay`, `timeSpan`,
|
|
33
|
+
`voucherCode`, `fromdate`, `tilldate` and `visible4interfaces`. `discount` is gone; the Hub
|
|
34
|
+
never returned it. `description` is nullable.
|
|
35
|
+
|
|
36
|
+
## Fixed
|
|
37
|
+
|
|
38
|
+
- v9 ERGO: `createInsurancePreContract`, `bookInsurance`, `readPolicy` and `revokePolicy` were
|
|
39
|
+
refused by the Hub (HTTP 422).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Migration: 3.3.0 to 3.4.0
|
|
2
|
+
|
|
3
|
+
Only a v9 site that calls `live.insurance.readPolicy` has to change. Everything else works without
|
|
4
|
+
changes.
|
|
5
|
+
|
|
6
|
+
## 1. Upgrade
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
pnpm add @v-office/website-sdk@3.4.0
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## 2. Pass the booking to `readPolicy`
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
// Before
|
|
16
|
+
const policy = await sdk.live.insurance.readPolicy({ policyNumber });
|
|
17
|
+
|
|
18
|
+
// After
|
|
19
|
+
const policy = await sdk.live.insurance.readPolicy({ policyNumber, booking });
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`booking` is the result of `live.booking.book`, as for `revokePolicy`. `readPolicy` now returns
|
|
23
|
+
only the booking's active policy; after `revokePolicy` it rejects instead of returning the revoked
|
|
24
|
+
policy, so keep the policy that `revokePolicy` returned when the page needs to show it.
|
|
25
|
+
|
|
26
|
+
## 3. Optional: show special offers on v9
|
|
27
|
+
|
|
28
|
+
Read a rental's `offers` and show them as described in `rentals.md`, "Legacy v9 Special Offers".
|
|
29
|
+
Hide the offer UI when `offers` is empty, which is the normal case.
|
|
30
|
+
|
|
31
|
+
A site that queried the be-on! Hub directly for offers (GraphQL `voffice_offers` or v1
|
|
32
|
+
`/Units/{id}/offers`) can switch to `offers`. The SDK already leaves out offers with a voucher
|
|
33
|
+
code, so the page cannot leak one.
|
|
34
|
+
|
|
35
|
+
## 4. Only if you used `defineVofficeOfferDataAttributes`
|
|
36
|
+
|
|
37
|
+
The known attribute `discount` is gone. Use `discountType` and `value`, or read `offers`.
|
|
38
|
+
|
|
39
|
+
## What stays the same
|
|
40
|
+
|
|
41
|
+
- v10: nothing changes.
|
|
42
|
+
- v9 with URV insurance: nothing changes.
|
|
43
|
+
- `createInsurancePreContract`, `selectInsurancePayment`, `bookInsurance` and `revokePolicy` keep
|
|
44
|
+
their inputs and outputs.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog: 3.4.1
|
|
2
|
+
|
|
3
|
+
v9 additional services billed per day, week or month show the price the PMS bills per unit.
|
|
4
|
+
Totals already matched the PMS for per-day services and still do.
|
|
5
|
+
|
|
6
|
+
## Changed
|
|
7
|
+
|
|
8
|
+
- v9: a service billed per week reads "10,00 € / Woche" (the weekly price) instead of the amount
|
|
9
|
+
for the whole stay without a unit. The line total after `addAdditionalService` is unchanged.
|
|
10
|
+
- v9: a service billed per month reads "… / Monat". Below 30 nights the PMS bills it nothing, and
|
|
11
|
+
`quote.additionalServices` leaves it out instead of offering it for free.
|
|
12
|
+
|
|
13
|
+
## Fixed
|
|
14
|
+
|
|
15
|
+
- v9: a service billed per day showed its total divided by the nights, while the PMS bills it
|
|
16
|
+
for nights + 1 days. For 7 nights at 12,00 a day, `charge` read "13,71 … / Tag"; it now reads
|
|
17
|
+
"12,00 … / Tag", and the booking card sub-line "1 × 12,00 … / Tag". The line total stays 96,00.
|
|
18
|
+
- v9: a selected service billed per week or month went to the booking and into the ERGO
|
|
19
|
+
insurance value with the price of one week or month, whatever the stay. It now goes with
|
|
20
|
+
`price × amount × timespan`, the same total the booking card shows.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-office/website-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"description": "Website-facing SDK facade backed by @v-office/sdk-core",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@graphql-typed-document-node/core": "3.2.0",
|
|
51
|
-
"@v-office/sdk-core": "1.32.
|
|
51
|
+
"@v-office/sdk-core": "1.32.1",
|
|
52
52
|
"effect": "4.0.0-rc.115",
|
|
53
53
|
"graphql": "17.0.2",
|
|
54
54
|
"yaml": "^2.9.0"
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"test:cli": "node --test src/cli/v9-hub-filters.test.ts",
|
|
92
92
|
"test:v9:openapi": "node --test codegen/v9/php-record.test.ts src/legacy-v9/openapi/setup-response.test.ts src/legacy-v9/openapi/quote-response.test.ts",
|
|
93
93
|
"test:v9:properties": "node --test codegen/v9/heuristic-generation/generate/property.test.ts src/legacy-v9/property-highlight-sources.test.ts src/legacy-v9/parser/rentals/render-property-attribute.test.ts src/legacy-v9/parser/rentals/to-property.test.ts src/legacy-v9/parser/rentals/to-rooms.test.ts src/legacy-v9/parser/rentals/to-capacity.test.ts",
|
|
94
|
-
"test:v9:rentals": "node --test src/legacy-v9/static/description-fallbacks.test.ts src/legacy-v9/static/associate-rentals-with-facilities-by-object-groups.test.ts src/legacy-v9/parser/rentals/to-reviews.test.ts src/legacy-v9/parser/rentals/to-image.test.ts src/legacy-v9/parser/rentals/to-links.test.ts",
|
|
94
|
+
"test:v9:rentals": "node --test src/legacy-v9/static/description-fallbacks.test.ts src/legacy-v9/static/associate-rentals-with-facilities-by-object-groups.test.ts src/legacy-v9/parser/rentals/to-reviews.test.ts src/legacy-v9/parser/rentals/to-image.test.ts src/legacy-v9/parser/rentals/to-links.test.ts src/legacy-v9/parser/rentals/to-rental-offers.test.ts",
|
|
95
95
|
"test:v9:graphql": "node --test src/legacy-v9/graphql/client.test.ts",
|
|
96
96
|
"test:v9:availability": "node --test src/legacy-v9/parser/availability/to-availability-restrictions-by-date.test.ts src/legacy-v9/parser/availability/to-initial-availability-calendar-days.test.ts src/legacy-v9/parser/availability/to-occupancy-limits.test.ts src/legacy-v9/parser/availability/to-rent-night-prices.test.ts src/legacy-v9/parser/availability/to-start-date-selected-calendar-days.test.ts src/legacy-v9/parser/blocked-ranges/collect-v9-blocked-ranges.test.ts src/legacy-v9/parser/blocked-ranges/to-rental-blocked-ranges.test.ts",
|
|
97
97
|
"test:v9:search": "node --test src/legacy-v9/parser/search/resolve-exact-match.test.ts src/legacy-v9/rental-scope.test.ts",
|