@v-office/website-sdk 3.4.2 → 3.5.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 +2 -2
- package/dist/{client-RLFx7K1J.mjs → client-BKsLLOAa.mjs} +81 -52
- 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 +8 -1
- package/dist/instructions/regions.md +20 -14
- package/dist/instructions/versions/3.5.0/CHANGELOG.md +41 -0
- package/dist/instructions/versions/3.5.0/MIGRATION.md +29 -0
- package/dist/{quote-Bbw_fcGm.mjs → quote-C442GXE5.mjs} +49 -5
- package/dist/{rentals-CJKA1qK0.mjs → rentals-CWP8md5n.mjs} +1 -1
- package/dist/{search-BNuWa0Vi.mjs → search-BnS4mWvv.mjs} +1 -1
- package/dist/translations/shared/de-DE/quote.json +1 -0
- package/dist/translations/shared/en-US/quote.json +1 -0
- package/dist/translations/v9/de-DE/core.json +2 -1
- package/dist/translations/v9/en-US/core.json +2 -1
- package/instructions/CHANGELOG.md +1 -0
- package/instructions/MIGRATION.md +1 -0
- package/instructions/quote.md +8 -1
- package/instructions/regions.md +20 -14
- package/instructions/versions/3.5.0/CHANGELOG.md +41 -0
- package/instructions/versions/3.5.0/MIGRATION.md +29 -0
- package/instructions/versions/3.5.0/release.json +3 -0
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Qt as defineV9PropertyHighlightSourcesFromUnknown, Xt as defineWebsiteSDKOptions, _ as rental_attributes_default$1, an as V9_HUB_OFFER_FILTER_KEY, cn as V9_HUB_UNIT_TYPE_FILTER_KEY, en as V9_HUB_FACILITY_SCOPE_FILTER_KEY, f as makeV9GraphQLClient, h as makeV0OpenApiClientFetchLive, i as toV9SdkOwnedHubFilterKeys, in as V9_HUB_OFFERS_FILTER_KEY, ln as V9_SDK_OWNED_HUB_FILTER_KEYS, n as checkV9HubFilters, nn as V9_HUB_OBJECT_GROUP_FILTER_KEY, on as V9_HUB_REGION_FILTER_KEY, p as V0OpenApiClient, r as toV9RequiredHubFilterKeys, rn as V9_HUB_OBJECT_GROUP_SCOPE_FILTER_KEY, sn as V9_HUB_RENTAL_IDS_FILTER_KEY, t as createWebsiteSDK, tn as V9_HUB_FACILITY_SEARCH_FILTER_KEY, un as stable_filters_default, v as rental_attributes_default } from "./client-
|
|
2
|
+
import { Qt as defineV9PropertyHighlightSourcesFromUnknown, Xt as defineWebsiteSDKOptions, _ as rental_attributes_default$1, an as V9_HUB_OFFER_FILTER_KEY, cn as V9_HUB_UNIT_TYPE_FILTER_KEY, en as V9_HUB_FACILITY_SCOPE_FILTER_KEY, f as makeV9GraphQLClient, h as makeV0OpenApiClientFetchLive, i as toV9SdkOwnedHubFilterKeys, in as V9_HUB_OFFERS_FILTER_KEY, ln as V9_SDK_OWNED_HUB_FILTER_KEYS, n as checkV9HubFilters, nn as V9_HUB_OBJECT_GROUP_FILTER_KEY, on as V9_HUB_REGION_FILTER_KEY, p as V0OpenApiClient, r as toV9RequiredHubFilterKeys, rn as V9_HUB_OBJECT_GROUP_SCOPE_FILTER_KEY, sn as V9_HUB_RENTAL_IDS_FILTER_KEY, t as createWebsiteSDK, tn as V9_HUB_FACILITY_SEARCH_FILTER_KEY, un as stable_filters_default, v as rental_attributes_default } from "./client-BKsLLOAa.mjs";
|
|
3
3
|
import { a as hubFiltersQuery, b as parseJsonData, o as hubRentalDataQuery, p as rentalsAllWithoutFeedbacksQuery, v as VofficeUnitDataPropertyMetadata, w as parseVofficeRatingData } from "./operations-DY2e_2Hd.mjs";
|
|
4
4
|
import { STABLE_SEARCH_INPUTS, SearchSearchSortSchema, defineCustomAttributesFromUnknown, toStableSearchInputQueryKeys } from "@v-office/sdk-core";
|
|
5
5
|
import { ByteSize, Console, Effect, FileSystem, Layer, Option, Path, Schema, Stdio, Terminal } from "effect";
|
|
@@ -17,7 +17,7 @@ var CLICheckFailed = class extends Error {
|
|
|
17
17
|
const toCLIError = (message, cause) => cause instanceof Error ? new CLICheckFailed(`${message}: ${cause.message}`, { cause }) : new CLICheckFailed(message, { cause });
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region package.json
|
|
20
|
-
var version = "3.
|
|
20
|
+
var version = "3.5.0";
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/cli/output.ts
|
|
23
23
|
const toJson = (value) => Effect.try({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { T as parseVofficeUnitData, b as parseJsonData, l as rentalRegionsQuery, m as RegionSchema$1, t as voucherValidityQuery, y as customDataAttribute } from "./operations-DY2e_2Hd.mjs";
|
|
2
|
-
import { AvailabilityService, BookingBookOutput, BookingService, ContactService, CoreSDKError, DEFAULT_RENTAL_HIGHLIGHT_PRIORITIZATION, DEFAULT_RENTAL_PROPERTY_HIGHLIGHT_PRIORITIZATION, DocumentsService, EMPTY_CUSTOM_ATTRIBUTE_REGISTRY, FilterService, QuoteService, RegionsService, RentalService, SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS, SearchService, TranslationService, addGuestQuoteAdditionalServiceSelection, asArray, asRecord, assertNoNestedCustomAttributeFilterCompositions, assertNoReservedQueryKeys, assertUniqueCustomFilterQueryKeys, assertUniqueFilterQueryKeys, buildWebsiteRegions, clearGuestQuoteAdditionalServiceSelections, collectQueryParameters, createCoreRuntime, daysBetweenLocalDates, expandCustomAttributeFilterCompositions, firstNumber, firstString, formatCurrency, formatLocalDate, getBookingBookGuestToken, getGuestQuoteBackendContext, getGuestQuoteInput, isDisplayableCustomAttribute, localeToLanguage, makeMinIntervalLimiter, makeTranslationLive, normalizeV10RateBudget, parseQueryParameters, refreshGuestQuoteInsurancePassthrough, removeGuestQuoteAdditionalServiceSelection, selectGuestQuoteCancellationPolicySelection, toCountLabelKey, toCustomAttributeFilterLabel, toCustomAttributeFilterOutputItem, toCustomAttributeList, toInitialAvailabilityCalendarDays, toIsoDateFromPeriodQueryDate, toNoInsuranceOption, toNotOfferedInsurance, toQueryString, toResolvedCustomAttributeCategoryTranslationKey, toStartDateSelectedCalendarDays, validateContactSubmitInput, withGuestQuoteInsurance, withGuestQuoteInsuranceRefresh } from "@v-office/sdk-core";
|
|
2
|
+
import { AvailabilityService, BookingBookOutput, BookingService, ContactService, CoreSDKError, DEFAULT_RENTAL_HIGHLIGHT_PRIORITIZATION, DEFAULT_RENTAL_PROPERTY_HIGHLIGHT_PRIORITIZATION, DocumentsService, EMPTY_CUSTOM_ATTRIBUTE_REGISTRY, FilterService, QuoteService, RegionsService, RentalService, SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS, SearchService, TranslationService, addGuestQuoteAdditionalServiceSelection, asArray, asRecord, assertNoNestedCustomAttributeFilterCompositions, assertNoReservedQueryKeys, assertUniqueCustomFilterQueryKeys, assertUniqueFilterQueryKeys, buildWebsiteRegions, clearGuestQuoteAdditionalServiceSelections, collectQueryParameters, createCoreRuntime, daysBetweenLocalDates, expandCustomAttributeFilterCompositions, firstNumber, firstString, formatCurrency, formatLocalDate, getBookingBookGuestToken, getGuestQuoteBackendContext, getGuestQuoteInput, isDisplayableCustomAttribute, localeToLanguage, makeMinIntervalLimiter, makeTranslationLive, normalizeV10RateBudget, parseQueryParameters, refreshGuestQuoteInsurancePassthrough, removeGuestQuoteAdditionalServiceSelection, selectGuestQuoteCancellationPolicySelection, toCountLabelKey, toCustomAttributeFilterLabel, toCustomAttributeFilterOutputItem, toCustomAttributeList, toInitialAvailabilityCalendarDays, toIsoDateFromPeriodQueryDate, toNoInsuranceOption, toNotOfferedInsurance, toQueryString, toRegionNames, toResolvedCustomAttributeCategoryTranslationKey, toStartDateSelectedCalendarDays, validateContactSubmitInput, withGuestQuoteInsurance, withGuestQuoteInsuranceRefresh } from "@v-office/sdk-core";
|
|
3
3
|
import { Clock, Context, Data, DateTime, Duration, Effect, Layer, Schema, SchemaGetter } from "effect";
|
|
4
4
|
import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/unstable/http";
|
|
5
5
|
import { Kind, print, visit } from "graphql";
|
|
@@ -1786,12 +1786,26 @@ const MAX_PETS_BY_RESTRICTION = {
|
|
|
1786
1786
|
4: 4
|
|
1787
1787
|
};
|
|
1788
1788
|
const toPositiveCount = (value) => value !== void 0 && Number.isInteger(value) && value > 0 ? value : null;
|
|
1789
|
-
const
|
|
1789
|
+
const toPetPolicy = (unit) => {
|
|
1790
1790
|
const { pets, petsRestrictions } = unit.known;
|
|
1791
|
-
if (pets === void 0) return
|
|
1792
|
-
if (pets === 0) return
|
|
1793
|
-
if (petsRestrictions === void 0) return
|
|
1794
|
-
|
|
1791
|
+
if (pets === void 0) return { kind: "unrestricted" };
|
|
1792
|
+
if (pets === 0) return { kind: "none" };
|
|
1793
|
+
if (petsRestrictions === void 0) return { kind: "unrestricted" };
|
|
1794
|
+
const maxPets = MAX_PETS_BY_RESTRICTION[petsRestrictions];
|
|
1795
|
+
if (maxPets === void 0) return { kind: "unrestricted" };
|
|
1796
|
+
return maxPets === 0 ? { kind: "onRequest" } : {
|
|
1797
|
+
kind: "limited",
|
|
1798
|
+
maxPets
|
|
1799
|
+
};
|
|
1800
|
+
};
|
|
1801
|
+
const toMaxPets = (unit) => {
|
|
1802
|
+
const policy = toPetPolicy(unit);
|
|
1803
|
+
switch (policy.kind) {
|
|
1804
|
+
case "none":
|
|
1805
|
+
case "onRequest": return 0;
|
|
1806
|
+
case "limited": return policy.maxPets;
|
|
1807
|
+
case "unrestricted": return null;
|
|
1808
|
+
}
|
|
1795
1809
|
};
|
|
1796
1810
|
const toOccupancyLimits = ({ unit }) => {
|
|
1797
1811
|
const maxPersons = toPositiveCount(unit.known.beds);
|
|
@@ -1854,7 +1868,8 @@ var core_default$1 = {
|
|
|
1854
1868
|
"insurance.ergo.preContract.documents.PRP.label": "Merkblatt zur Datenverarbeitung",
|
|
1855
1869
|
"insurance.ergo.preContract.documents.ECI.label": "Kundeninformation elektronischer Geschäftsverkehr",
|
|
1856
1870
|
"insurance.ergo.preContract.documents.other.label": "Dokument",
|
|
1857
|
-
"insurance.ergo.policy.document.label": "Versicherungsschein"
|
|
1871
|
+
"insurance.ergo.policy.document.label": "Versicherungsschein",
|
|
1872
|
+
"quote.additionalService.pet.onRequest": "Haustiere nur auf Anfrage"
|
|
1858
1873
|
};
|
|
1859
1874
|
//#endregion
|
|
1860
1875
|
//#region translations/v9/de-DE/filter.json
|
|
@@ -2606,7 +2621,8 @@ var core_default = {
|
|
|
2606
2621
|
"insurance.ergo.preContract.documents.PRP.label": "Data processing notice",
|
|
2607
2622
|
"insurance.ergo.preContract.documents.ECI.label": "E-commerce customer information",
|
|
2608
2623
|
"insurance.ergo.preContract.documents.other.label": "Document",
|
|
2609
|
-
"insurance.ergo.policy.document.label": "Insurance policy"
|
|
2624
|
+
"insurance.ergo.policy.document.label": "Insurance policy",
|
|
2625
|
+
"quote.additionalService.pet.onRequest": "Pets on request only"
|
|
2610
2626
|
};
|
|
2611
2627
|
//#endregion
|
|
2612
2628
|
//#region translations/v9/en-US/filter.json
|
|
@@ -3384,13 +3400,12 @@ const toVofficeUnitId$2 = (input) => {
|
|
|
3384
3400
|
}));
|
|
3385
3401
|
};
|
|
3386
3402
|
const RENT_NIGHT_PRICES_TTL_MILLIS = 3e5;
|
|
3387
|
-
const makeV9AvailabilityApi = ({ config, options }) => {
|
|
3403
|
+
const makeV9AvailabilityApi = ({ config, options, loadUnitDetails }) => {
|
|
3388
3404
|
const translations = makeV9TranslationService(options.translationOverrides);
|
|
3389
3405
|
const openApiClientLive = makeV1OpenApiClientFetchLive({
|
|
3390
3406
|
apiKey: config.apiKey,
|
|
3391
3407
|
...config.v1ApiBaseUrl === void 0 ? {} : { baseUrl: config.v1ApiBaseUrl }
|
|
3392
3408
|
});
|
|
3393
|
-
const unitDetailsByUnitId = /* @__PURE__ */ new Map();
|
|
3394
3409
|
const rentNightPricesByUnitId = /* @__PURE__ */ new Map();
|
|
3395
3410
|
const loadAvailability = (input) => Effect.gen(function* () {
|
|
3396
3411
|
const client = yield* V1OpenApiClient;
|
|
@@ -3405,23 +3420,6 @@ const makeV9AvailabilityApi = ({ config, options }) => {
|
|
|
3405
3420
|
cause
|
|
3406
3421
|
})))).data;
|
|
3407
3422
|
}).pipe(Effect.provide(openApiClientLive));
|
|
3408
|
-
const loadUnitDetails = (input) => Effect.gen(function* () {
|
|
3409
|
-
const client = yield* V1OpenApiClient;
|
|
3410
|
-
const unitId = yield* toVofficeUnitId$2(input);
|
|
3411
|
-
const cached = unitDetailsByUnitId.get(unitId);
|
|
3412
|
-
if (cached !== void 0) return cached;
|
|
3413
|
-
const result = yield* client.execute("getUnit", { path: { voffice_unit: unitId } }).pipe(Effect.match({
|
|
3414
|
-
onFailure: () => void 0,
|
|
3415
|
-
onSuccess: (result) => result
|
|
3416
|
-
}));
|
|
3417
|
-
if (result === void 0) return void 0;
|
|
3418
|
-
const details = {
|
|
3419
|
-
currency: firstString(result.data.data.currency),
|
|
3420
|
-
occupancyLimits: toOccupancyLimits({ unit: parseVofficeUnitData(result.data.data) })
|
|
3421
|
-
};
|
|
3422
|
-
unitDetailsByUnitId.set(unitId, details);
|
|
3423
|
-
return details;
|
|
3424
|
-
}).pipe(Effect.provide(openApiClientLive));
|
|
3425
3423
|
const loadRentNightPrices = (input) => Effect.gen(function* () {
|
|
3426
3424
|
const client = yield* V1OpenApiClient;
|
|
3427
3425
|
const unitId = yield* toVofficeUnitId$2(input);
|
|
@@ -3448,7 +3446,7 @@ const makeV9AvailabilityApi = ({ config, options }) => {
|
|
|
3448
3446
|
const now = yield* DateTime.now;
|
|
3449
3447
|
const [availability, unitDetails, rentNightPrices] = yield* Effect.all([
|
|
3450
3448
|
loadAvailability(input),
|
|
3451
|
-
|
|
3449
|
+
toVofficeUnitId$2(input).pipe(Effect.flatMap(loadUnitDetails)),
|
|
3452
3450
|
loadRentNightPrices(input)
|
|
3453
3451
|
], { concurrency: "unbounded" });
|
|
3454
3452
|
const currency = unitDetails?.currency;
|
|
@@ -3474,7 +3472,7 @@ const makeV9AvailabilityApi = ({ config, options }) => {
|
|
|
3474
3472
|
const now = yield* DateTime.now;
|
|
3475
3473
|
const [availability, unitDetails, rentNightPrices] = yield* Effect.all([
|
|
3476
3474
|
loadAvailability(input),
|
|
3477
|
-
|
|
3475
|
+
toVofficeUnitId$2(input).pipe(Effect.flatMap(loadUnitDetails)),
|
|
3478
3476
|
loadRentNightPrices(input)
|
|
3479
3477
|
], { concurrency: "unbounded" });
|
|
3480
3478
|
const currency = unitDetails?.currency;
|
|
@@ -6231,7 +6229,7 @@ const revokeV9InsurancePolicy = ({ policyNumber, booking, v1Client }) => Effect.
|
|
|
6231
6229
|
//#region src/legacy-v9/live/quote.ts
|
|
6232
6230
|
const loadQuoteRuntime = Effect.tryPromise({
|
|
6233
6231
|
try: async () => {
|
|
6234
|
-
return { toGuestQuote: (await import("./quote-
|
|
6232
|
+
return { toGuestQuote: (await import("./quote-C442GXE5.mjs")).toGuestQuote };
|
|
6235
6233
|
},
|
|
6236
6234
|
catch: (cause) => new CoreSDKError({
|
|
6237
6235
|
source: "v9",
|
|
@@ -6249,9 +6247,9 @@ const toVofficeUnitId = (input) => {
|
|
|
6249
6247
|
message: `Expected rentalId to be a vOffice unit ID, received "${input.rentalId}".`
|
|
6250
6248
|
}));
|
|
6251
6249
|
};
|
|
6252
|
-
const quote = (client, v0Client, translations, limitQuote, input, shouldAddProposedAdditionalServiceAmount) => Effect.gen(function* () {
|
|
6250
|
+
const quote = (client, v0Client, translations, limitQuote, loadUnitDetails, input, shouldAddProposedAdditionalServiceAmount) => Effect.gen(function* () {
|
|
6253
6251
|
const unitId = yield* toVofficeUnitId(input);
|
|
6254
|
-
const
|
|
6252
|
+
const quotePrices = limitQuote(client.execute("getUnitQuotePrices", {
|
|
6255
6253
|
path: { voffice_unit: unitId },
|
|
6256
6254
|
query: {
|
|
6257
6255
|
lang: localeToLanguage(input.locale),
|
|
@@ -6270,8 +6268,12 @@ const quote = (client, v0Client, translations, limitQuote, input, shouldAddPropo
|
|
|
6270
6268
|
message: "Failed to load v9 quote prices from the v1 OpenAPI client.",
|
|
6271
6269
|
cause
|
|
6272
6270
|
}))));
|
|
6271
|
+
const [result, unitDetails] = yield* Effect.all([quotePrices, loadUnitDetails(unitId)], { concurrency: "unbounded" });
|
|
6273
6272
|
const { toGuestQuote } = yield* loadQuoteRuntime;
|
|
6274
|
-
const guestQuoteResult = yield* toGuestQuote(input, result.raw?.data.quote ?? result.data.data.quote, input.locale, translations, {
|
|
6273
|
+
const guestQuoteResult = yield* toGuestQuote(input, result.raw?.data.quote ?? result.data.data.quote, input.locale, translations, {
|
|
6274
|
+
shouldAddProposedAdditionalServiceAmount,
|
|
6275
|
+
...unitDetails === void 0 ? {} : { petPolicy: unitDetails.petPolicy }
|
|
6276
|
+
});
|
|
6275
6277
|
if (guestQuoteResult.status === "unavailable") return guestQuoteResult;
|
|
6276
6278
|
return {
|
|
6277
6279
|
status: "available",
|
|
@@ -6284,7 +6286,7 @@ const quote = (client, v0Client, translations, limitQuote, input, shouldAddPropo
|
|
|
6284
6286
|
})
|
|
6285
6287
|
};
|
|
6286
6288
|
});
|
|
6287
|
-
const makeV9QuoteApi = ({ config, options }) => {
|
|
6289
|
+
const makeV9QuoteApi = ({ config, options, loadUnitDetails }) => {
|
|
6288
6290
|
const translations = makeV9TranslationService(options.translationOverrides);
|
|
6289
6291
|
const limitQuote = Effect.runSync(makeMinIntervalLimiter({
|
|
6290
6292
|
...options.rateBudget,
|
|
@@ -6314,7 +6316,7 @@ const makeV9QuoteApi = ({ config, options }) => {
|
|
|
6314
6316
|
v1Client: clients.v1Client
|
|
6315
6317
|
});
|
|
6316
6318
|
return {
|
|
6317
|
-
quote: (input) => withClients(({ v0Client, v1Client }) => quote(v1Client, v0Client, translations, limitQuote, input, options.shouldAddProposedAdditionalServiceAmount)),
|
|
6319
|
+
quote: (input) => withClients(({ v0Client, v1Client }) => quote(v1Client, v0Client, translations, limitQuote, loadUnitDetails, input, options.shouldAddProposedAdditionalServiceAmount)),
|
|
6318
6320
|
addAdditionalService: ({ quote, id }) => withClients((clients) => withGuestQuoteInsuranceRefresh({
|
|
6319
6321
|
result: addGuestQuoteAdditionalServiceSelection({
|
|
6320
6322
|
quote,
|
|
@@ -6586,7 +6588,7 @@ const parseV9SearchCursor = (cursor) => Effect.gen(function* () {
|
|
|
6586
6588
|
return page;
|
|
6587
6589
|
});
|
|
6588
6590
|
const loadV9SearchRuntime = Effect.tryPromise({
|
|
6589
|
-
try: () => import("./search-
|
|
6591
|
+
try: () => import("./search-BnS4mWvv.mjs"),
|
|
6590
6592
|
catch: (cause) => new CoreSDKError({
|
|
6591
6593
|
source: "v9",
|
|
6592
6594
|
operation: "v9.search.runtime",
|
|
@@ -6953,6 +6955,38 @@ const makeV9SearchApi = ({ config, options }) => {
|
|
|
6953
6955
|
};
|
|
6954
6956
|
};
|
|
6955
6957
|
//#endregion
|
|
6958
|
+
//#region src/legacy-v9/live/unit-details.ts
|
|
6959
|
+
const makeV9UnitDetailsLoader = ({ config }) => {
|
|
6960
|
+
const openApiClientLive = makeV1OpenApiClientFetchLive({
|
|
6961
|
+
apiKey: config.apiKey,
|
|
6962
|
+
...config.v1ApiBaseUrl === void 0 ? {} : { baseUrl: config.v1ApiBaseUrl }
|
|
6963
|
+
});
|
|
6964
|
+
const unitDetailsByUnitId = /* @__PURE__ */ new Map();
|
|
6965
|
+
const loadUnitDetails = (unitId) => Effect.gen(function* () {
|
|
6966
|
+
const result = yield* (yield* V1OpenApiClient).execute("getUnit", { path: { voffice_unit: unitId } }).pipe(Effect.match({
|
|
6967
|
+
onFailure: () => void 0,
|
|
6968
|
+
onSuccess: (result) => result
|
|
6969
|
+
}));
|
|
6970
|
+
if (result === void 0) return void 0;
|
|
6971
|
+
const unit = parseVofficeUnitData(result.data.data);
|
|
6972
|
+
return {
|
|
6973
|
+
currency: firstString(result.data.data.currency),
|
|
6974
|
+
occupancyLimits: toOccupancyLimits({ unit }),
|
|
6975
|
+
petPolicy: toPetPolicy(unit)
|
|
6976
|
+
};
|
|
6977
|
+
}).pipe(Effect.provide(openApiClientLive));
|
|
6978
|
+
return (unitId) => Effect.promise(() => {
|
|
6979
|
+
const cached = unitDetailsByUnitId.get(unitId);
|
|
6980
|
+
if (cached !== void 0) return cached;
|
|
6981
|
+
const loading = Effect.runPromise(loadUnitDetails(unitId)).catch(() => void 0).then((details) => {
|
|
6982
|
+
if (details === void 0) unitDetailsByUnitId.delete(unitId);
|
|
6983
|
+
return details;
|
|
6984
|
+
});
|
|
6985
|
+
unitDetailsByUnitId.set(unitId, loading);
|
|
6986
|
+
return loading;
|
|
6987
|
+
});
|
|
6988
|
+
};
|
|
6989
|
+
//#endregion
|
|
6956
6990
|
//#region src/legacy-v9/voucher-code.ts
|
|
6957
6991
|
const toVoucherCode = (voucher) => {
|
|
6958
6992
|
const code = voucher?.trim();
|
|
@@ -7265,26 +7299,17 @@ const makeV9FilterApi = ({ options }) => {
|
|
|
7265
7299
|
};
|
|
7266
7300
|
//#endregion
|
|
7267
7301
|
//#region src/legacy-v9/static/regions.ts
|
|
7268
|
-
/** The region's one name, German; the English one only stands in for a missing German one. */
|
|
7269
|
-
const toName = (region) => {
|
|
7270
|
-
const names = region.name ?? {};
|
|
7271
|
-
const name = names.de?.trim() || names.en?.trim();
|
|
7272
|
-
return name ? {
|
|
7273
|
-
"de-DE": name,
|
|
7274
|
-
"en-US": name
|
|
7275
|
-
} : void 0;
|
|
7276
|
-
};
|
|
7277
7302
|
const toSlug = (name) => name.toLowerCase().replace(/ä/g, "ae").replace(/ö/g, "oe").replace(/ü/g, "ue").replace(/ß/g, "ss").normalize("NFKD").replace(/[̀-ͯ]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "region";
|
|
7278
7303
|
/** Maps the vOffice regions and the rentals' regions; throws on a region without a name. */
|
|
7279
7304
|
const toV9WebsiteRegions = ({ regions, rentalRegions }) => {
|
|
7280
7305
|
const ids = new Set(regions.map((region) => region._id));
|
|
7281
7306
|
const parentOf = (region) => region.parent !== void 0 && ids.has(region.parent) ? region.parent : null;
|
|
7282
7307
|
const named = regions.map((region) => {
|
|
7283
|
-
const
|
|
7284
|
-
if (
|
|
7308
|
+
const names = toRegionNames(region.name ?? {});
|
|
7309
|
+
if (names === void 0) throw new Error(`vOffice region ${region._id} has no name.`);
|
|
7285
7310
|
return {
|
|
7286
7311
|
region,
|
|
7287
|
-
|
|
7312
|
+
...names
|
|
7288
7313
|
};
|
|
7289
7314
|
});
|
|
7290
7315
|
const ownRentalIds = /* @__PURE__ */ new Map();
|
|
@@ -7293,12 +7318,13 @@ const toV9WebsiteRegions = ({ regions, rentalRegions }) => {
|
|
|
7293
7318
|
const hasRentals = (id) => (ownRentalIds.get(id)?.length ?? 0) > 0 || childrenOf(id).some(({ region }) => hasRentals(region._id));
|
|
7294
7319
|
const keys = new Map(named.map(({ region, name }) => [region._id, `${toSlug(name["de-DE"])}-${region._id}`]));
|
|
7295
7320
|
const keyOf = (id) => keys.get(id) ?? String(id);
|
|
7296
|
-
const visit = (parent) => childrenOf(parent).flatMap(({ region, name }) => {
|
|
7321
|
+
const visit = (parent) => childrenOf(parent).flatMap(({ region, name, names }) => {
|
|
7297
7322
|
if (!hasRentals(region._id)) return [];
|
|
7298
7323
|
return [{
|
|
7299
7324
|
id: keyOf(region._id),
|
|
7300
7325
|
parentId: parent === null ? null : keyOf(parent),
|
|
7301
7326
|
name,
|
|
7327
|
+
names,
|
|
7302
7328
|
ownRentalIds: ownRentalIds.get(region._id) ?? []
|
|
7303
7329
|
}, ...visit(region._id)];
|
|
7304
7330
|
});
|
|
@@ -7508,7 +7534,7 @@ const orderRentalsById = ({ rentalIds, rentals, missing }) => {
|
|
|
7508
7534
|
});
|
|
7509
7535
|
};
|
|
7510
7536
|
const loadV9RentalsRuntime = Effect.tryPromise({
|
|
7511
|
-
try: () => import("./rentals-
|
|
7537
|
+
try: () => import("./rentals-CWP8md5n.mjs"),
|
|
7512
7538
|
catch: (cause) => new CoreSDKError({
|
|
7513
7539
|
source: "v9",
|
|
7514
7540
|
operation: "v9.rentals.runtime",
|
|
@@ -7767,13 +7793,16 @@ function createWebsiteSDK({ config, options }) {
|
|
|
7767
7793
|
config,
|
|
7768
7794
|
options: v9Options
|
|
7769
7795
|
});
|
|
7796
|
+
const loadUnitDetails = makeV9UnitDetailsLoader({ config });
|
|
7770
7797
|
const availability = makeV9AvailabilityApi({
|
|
7771
7798
|
config,
|
|
7772
|
-
options: v9Options
|
|
7799
|
+
options: v9Options,
|
|
7800
|
+
loadUnitDetails
|
|
7773
7801
|
});
|
|
7774
7802
|
const quote = makeV9QuoteApi({
|
|
7775
7803
|
config,
|
|
7776
|
-
options: v9Options
|
|
7804
|
+
options: v9Options,
|
|
7805
|
+
loadUnitDetails
|
|
7777
7806
|
});
|
|
7778
7807
|
const booking = makeV9BookingApi({
|
|
7779
7808
|
config,
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as QuotePricesPayloadSchema, A as DocumentResourceSchema, At as bookEffect, B as ErgoCommonFieldsSchema, Bt as mapSearchEffect, C as ApiEnvelopeBaseSchema, Ct as UnitServicePriceSchema, D as CustomerUnitSummarySchema, Dt as VideoResponseSchema, E as CurrentMemberResponseSchema, Et as VideoListResponseSchema, F as ErgoAddressSchema, Ft as getFiltersEffect, G as ErgoTripAndCustomerRequestSchema, Gt as selectInsuranceEffect, H as ErgoPersonSchema, Ht as removeAdditionalServiceEffect, I as ErgoBankSchema, It as getInitialAvailabilityEffect, J as OnOfficeUnitCollectionResponseSchema, Jt as submitPaymentOption, K as FacilityListResponseSchema, Kt as selectInsurancePaymentEffect, L as ErgoBookRequestSchema, Lt as getRentalsEffect, M as DocumentStatusUpdateRequestSchema, Mt as clearAdditionalServicesEffect, N as DocumentSummarySchema, Nt as createInsurancePreContractEffect, O as DocumentCollectionResponseSchema, Ot as decodeV1OperationResponse, P as DocumentTypeSchema, Pt as getBankTransferDetailsEffect, Q as QuoteLineSchema, Qt as defineV9PropertyHighlightSourcesFromUnknown, R as ErgoBookingIdentityRequestSchema, Rt as getStartDateSelectedAvailabilityEffect, S as makeV1OpenApiClientLive, St as UnitResponseSchema, T as CalendarResponseSchema, Tt as V1_OPERATIONS, U as ErgoPlanSearchRequestSchema, Ut as searchEffect, V as ErgoCreatePreContractRequestSchema, Vt as quoteEffect, W as ErgoReadPreContractRequestSchema, Wt as selectCancellationPolicyEffect, X as PaymentScheduleItemSchema, Xt as defineWebsiteSDKOptions, Y as OnOfficeUnitSchema, Yt as submitPaymentOptionEffect, Z as PaymentScheduleSchema, Zt as defineV9PropertyHighlightSources, _t as TravelInsuranceBookingSchema, at as RegionListResponseSchema, b as V1OpenApiClientError, bt as UnitListResponseSchema, ct as ServiceBeonDataSchema, dt as ServiceListResponseSchema, et as QuotePricesResponseSchema, ft as SetupDataSchema, g as makeV0OpenApiClientLive, gt as TileTagSchema, h as makeV0OpenApiClientFetchLive, ht as TileSchema, it as RawVofficeObjectSchema, j as DocumentStatusSchema, jt as bookInsuranceEffect, k as DocumentResourceResponseSchema, kt as addAdditionalServiceEffect, lt as ServiceImageSchema, m as V0OpenApiClientError, mt as TileCollectionResponseSchema, nt as QuoteServiceSchema, ot as RoomImageSchema, p as V0OpenApiClient, pt as SetupResponseSchema, q as HubErrorSchema, qt as submitContactEffect, rt as RawObjectResponseSchema, st as SearchPropertiesResponseSchema, t as createWebsiteSDK, tt as QuoteSchema, ut as ServiceLimitSchema, vt as UnitIdsResponseSchema, w as CalendarDaySchema, wt as V1_BASE_URL, x as makeV1OpenApiClientFetchLive, xt as UnitOfferSchema, y as V1OpenApiClient, yt as UnitListItemSchema, z as ErgoBookingIdentitySchema, zt as getTermsAndPrivacyPolicyEffect } from "./client-
|
|
1
|
+
import { $ as QuotePricesPayloadSchema, A as DocumentResourceSchema, At as bookEffect, B as ErgoCommonFieldsSchema, Bt as mapSearchEffect, C as ApiEnvelopeBaseSchema, Ct as UnitServicePriceSchema, D as CustomerUnitSummarySchema, Dt as VideoResponseSchema, E as CurrentMemberResponseSchema, Et as VideoListResponseSchema, F as ErgoAddressSchema, Ft as getFiltersEffect, G as ErgoTripAndCustomerRequestSchema, Gt as selectInsuranceEffect, H as ErgoPersonSchema, Ht as removeAdditionalServiceEffect, I as ErgoBankSchema, It as getInitialAvailabilityEffect, J as OnOfficeUnitCollectionResponseSchema, Jt as submitPaymentOption, K as FacilityListResponseSchema, Kt as selectInsurancePaymentEffect, L as ErgoBookRequestSchema, Lt as getRentalsEffect, M as DocumentStatusUpdateRequestSchema, Mt as clearAdditionalServicesEffect, N as DocumentSummarySchema, Nt as createInsurancePreContractEffect, O as DocumentCollectionResponseSchema, Ot as decodeV1OperationResponse, P as DocumentTypeSchema, Pt as getBankTransferDetailsEffect, Q as QuoteLineSchema, Qt as defineV9PropertyHighlightSourcesFromUnknown, R as ErgoBookingIdentityRequestSchema, Rt as getStartDateSelectedAvailabilityEffect, S as makeV1OpenApiClientLive, St as UnitResponseSchema, T as CalendarResponseSchema, Tt as V1_OPERATIONS, U as ErgoPlanSearchRequestSchema, Ut as searchEffect, V as ErgoCreatePreContractRequestSchema, Vt as quoteEffect, W as ErgoReadPreContractRequestSchema, Wt as selectCancellationPolicyEffect, X as PaymentScheduleItemSchema, Xt as defineWebsiteSDKOptions, Y as OnOfficeUnitSchema, Yt as submitPaymentOptionEffect, Z as PaymentScheduleSchema, Zt as defineV9PropertyHighlightSources, _t as TravelInsuranceBookingSchema, at as RegionListResponseSchema, b as V1OpenApiClientError, bt as UnitListResponseSchema, ct as ServiceBeonDataSchema, dt as ServiceListResponseSchema, et as QuotePricesResponseSchema, ft as SetupDataSchema, g as makeV0OpenApiClientLive, gt as TileTagSchema, h as makeV0OpenApiClientFetchLive, ht as TileSchema, it as RawVofficeObjectSchema, j as DocumentStatusSchema, jt as bookInsuranceEffect, k as DocumentResourceResponseSchema, kt as addAdditionalServiceEffect, lt as ServiceImageSchema, m as V0OpenApiClientError, mt as TileCollectionResponseSchema, nt as QuoteServiceSchema, ot as RoomImageSchema, p as V0OpenApiClient, pt as SetupResponseSchema, q as HubErrorSchema, qt as submitContactEffect, rt as RawObjectResponseSchema, st as SearchPropertiesResponseSchema, t as createWebsiteSDK, tt as QuoteSchema, ut as ServiceLimitSchema, vt as UnitIdsResponseSchema, w as CalendarDaySchema, wt as V1_BASE_URL, x as makeV1OpenApiClientFetchLive, xt as UnitOfferSchema, y as V1OpenApiClient, yt as UnitListItemSchema, z as ErgoBookingIdentitySchema, zt as getTermsAndPrivacyPolicyEffect } from "./client-BKsLLOAa.mjs";
|
|
2
2
|
import { AdditionalServiceLimitExceeded, CoreSDKError, CoreSDKError as CMSError, CustomAttributeCatalogSchema, GuestQuoteSchema, InvalidAdditionalServiceQuantity, LocaleSchema, SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS, SearchMapSearchInputSchema, SearchMapSearchOutputSchema, SearchSearchFieldOrderBySchema, SearchSearchFieldSortSchema, SearchSearchInputSchema, SearchSearchOutputSchema, SearchSearchPriceSortSchema, SearchSearchRandomSortSchema, SearchSearchRatingSortSchema, SearchSearchSortSchema, SearchSortDirectionSchema, UnknownAdditionalService, defineCustomAttributes, defineCustomAttributesFromUnknown, fetchCustomAttributeCatalog, parseCustomAttributeCatalog, validateContactSubmitInput } from "@v-office/sdk-core";
|
|
3
3
|
//#region codegen/v9/heuristic-generation/public-api.ts
|
|
4
4
|
const customDataAttribute = (name) => name;
|
|
@@ -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.5.0/CHANGELOG.md`: release notes for 3.5.0
|
|
7
8
|
- `versions/3.4.2/CHANGELOG.md`: release notes for 3.4.2
|
|
8
9
|
- `versions/3.4.1/CHANGELOG.md`: release notes for 3.4.1
|
|
9
10
|
- `versions/3.4.0/CHANGELOG.md`: release notes for 3.4.0
|
|
@@ -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.5.0/MIGRATION.md`: Migration: 3.4.2 to 3.5.0
|
|
7
8
|
- `versions/3.4.2/MIGRATION.md`: Migration: 3.4.1 to 3.4.2
|
|
8
9
|
- `versions/3.4.1/MIGRATION.md`: Migration: 3.4.0 to 3.4.1
|
|
9
10
|
- `versions/3.4.0/MIGRATION.md`: Migration: 3.3.0 to 3.4.0
|
|
@@ -335,7 +335,14 @@ const cleared = await sdk.live.quote.clearAdditionalServices({ quote });
|
|
|
335
335
|
if (cleared.ok) quote = cleared.quote;
|
|
336
336
|
```
|
|
337
337
|
|
|
338
|
-
Each successful change returns a new quote with recalculated `bookingCardInformation.total`.
|
|
338
|
+
Each successful change returns a new quote with recalculated `bookingCardInformation.total`. A service can be marked `available: false` with `unavailableReason` (v10 for unavailable service/policy combinations, v9 for pets on request); disable those options in the UI and show the reason. Handle `{ ok: false, error }` for unknown service ids, unavailable services, quantity limits, or `UnavailableQuoteCombination`.
|
|
339
|
+
|
|
340
|
+
### Pet services
|
|
341
|
+
|
|
342
|
+
A service of the PMS service type pet carries `kind: "pet"`. Use it to group or label pet services; never detect them by their name. From 3.5.0 a pet service follows the rental's pet rule:
|
|
343
|
+
|
|
344
|
+
- `v9`: a rental that takes no pets does not offer its pet service. A rental that takes pets only on request offers it with `available: false` and `unavailableReason` ("Haustiere nur auf Anfrage", translation key `quote.additionalService.pet.onRequest`), and `addAdditionalService` refuses it. A rental that takes at most n pets caps the service's `maxPerBooking` at n. A rental that states no pet rule is unchanged.
|
|
345
|
+
- `v10`: the pet service is a mandatory line priced from `occupancy.pets`, not an extra the guest adds. When `occupancy.pets` exceeds the pet service's limit per booking, the quote is unavailable with code `NotBookable` and a reason such as "Erlaubte Haustiere: höchstens 1" (translation key `quote.status.unavailable.tooManyPets`). A rental that takes no pets stays unavailable as before.
|
|
339
346
|
|
|
340
347
|
From 2.16.1, v10 resolves the multi-rate from rent rates only. Additional services are priced on top of the resolved multi-rate and no longer make it unresolvable, so they are no longer reported unavailable for that reason.
|
|
341
348
|
|
|
@@ -4,14 +4,14 @@ Regions group a site's rentals into a tree, for example Nordsee → Dornum → D
|
|
|
4
4
|
`sdk.static.regions.getRegions` returns the tree in the same shape on both backends, so
|
|
5
5
|
region pages and the search's region field are the same code on v10 and v9.
|
|
6
6
|
|
|
7
|
-
| | v10 | v9
|
|
8
|
-
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
9
|
-
| Source | the websites service: editors arrange regions in the CMS (Websites → "Regionen"), and a website can have its own tree instead of the workspace's default | vOffice's region hierarchy, through the be-on! Hub
|
|
10
|
-
| Regions per rental | several | one; it also counts for every region above it
|
|
11
|
-
| Names |
|
|
12
|
-
| Region ids | created once by the websites service from the German name; never change | German name and vOffice id; change on a rename
|
|
13
|
-
| Order | the editors' order | siblings by German name
|
|
14
|
-
| Regions returned | every region in the tree | only regions holding a rental of the be-on key
|
|
7
|
+
| | v10 | v9 |
|
|
8
|
+
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
9
|
+
| Source | the websites service: editors arrange regions in the CMS (Websites → "Regionen"), and a website can have its own tree instead of the workspace's default | vOffice's region hierarchy, through the be-on! Hub |
|
|
10
|
+
| Regions per rental | several | one; it also counts for every region above it |
|
|
11
|
+
| Names | German and English, English falls back to German; every language in `names` | German and English, each falls back to the other; German, English, French and Italian in `names` |
|
|
12
|
+
| Region ids | created once by the websites service from the German name; never change | German name and vOffice id; change on a rename |
|
|
13
|
+
| Order | the editors' order | siblings by German name |
|
|
14
|
+
| Regions returned | every region in the tree | only regions holding a rental of the be-on key |
|
|
15
15
|
|
|
16
16
|
Regions are not a custom attribute. Do not read a "Region" custom attribute, and do not
|
|
17
17
|
select one in `defineCustomAttributes`: the tree replaces both.
|
|
@@ -49,7 +49,8 @@ type WebsiteRegion = {
|
|
|
49
49
|
id: string; // "dornum": the region's URL and `?region=` value
|
|
50
50
|
parentId: string | null; // null: top level
|
|
51
51
|
depth: number; // 0: top level
|
|
52
|
-
name: { "de-DE": string; "en-US": string }; //
|
|
52
|
+
name: { "de-DE": string; "en-US": string }; // English falls back to German
|
|
53
|
+
names: Record<string, string>; // { de: "Schweiz", fr: "Suisse" }: every language with a name
|
|
53
54
|
ownRentalIds: readonly string[];
|
|
54
55
|
rentalIds: readonly string[];
|
|
55
56
|
};
|
|
@@ -62,11 +63,16 @@ type WebsiteRegion = {
|
|
|
62
63
|
- v10: the websites service creates it once from the German name. Renaming or moving the
|
|
63
64
|
region, and giving the website its own tree, keep it; editors cannot change it. Only
|
|
64
65
|
deleting the region ends it.
|
|
65
|
-
- v9: vOffice's German name and its vOffice id, for example `usedom-12`.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
- v9: vOffice's German name and its vOffice id, for example `usedom-12`. A region without
|
|
67
|
+
a German name takes the name `name["de-DE"]` falls back to, and siblings sort by it too.
|
|
68
|
+
Renaming the region in vOffice changes it; no other region's change does.
|
|
69
|
+
- `name` holds a name under every locale, so `name[locale]` always works. `en-US` is the
|
|
70
|
+
English name, or the German one where the region has none. Sort and build ids from
|
|
71
|
+
`id`, never from `name`.
|
|
72
|
+
- `names` holds the region's names by ISO 639-1 language as the PMS keeps them, for
|
|
73
|
+
example French and Italian on v9. It has only languages with a name: fall back yourself,
|
|
74
|
+
`region.names.fr ?? region.name["de-DE"]`. Regions have no description: write a region page's text in the
|
|
75
|
+
site.
|
|
70
76
|
- `ownRentalIds` are the rentals in the region itself. `rentalIds` adds every subregion's
|
|
71
77
|
rentals, each rental once. A region page lists `rentalIds`: "Nordsee" shows Dornum's
|
|
72
78
|
and Dornumersiel's rentals too.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Changelog: 3.5.0
|
|
2
|
+
|
|
3
|
+
A pet service in the quote follows the rental's pet rule, so a guest can no longer add a dog
|
|
4
|
+
where the rental takes dogs only on request. Regions show their English name on English pages
|
|
5
|
+
and carry their names in every language the PMS keeps, on v10 and v9. Includes
|
|
6
|
+
`@v-office/sdk-core` 1.33.0.
|
|
7
|
+
|
|
8
|
+
## Added
|
|
9
|
+
|
|
10
|
+
- `kind: "pet"` on an additional service of the PMS service type pet. Use it to group or label
|
|
11
|
+
pet services instead of matching their name.
|
|
12
|
+
- `region.names`: the region's names by ISO 639-1 language, only languages with a name. On
|
|
13
|
+
v9 that is German, English, French and Italian as vOffice keeps them:
|
|
14
|
+
`region.names.fr ?? region.name["de-DE"]` for a French page.
|
|
15
|
+
|
|
16
|
+
## Changed
|
|
17
|
+
|
|
18
|
+
- v9: a quote also loads the unit's details, once per unit and client, shared with
|
|
19
|
+
availability. Availability and quote requested together make one request.
|
|
20
|
+
- `regions.getRegions()` fills `name["en-US"]` with the region's English name, and with the
|
|
21
|
+
German one where there is none. `name["de-DE"]` stays German. The region's `id`, its URL
|
|
22
|
+
and `?region=` value, and the order of the tree are unchanged.
|
|
23
|
+
- v9: a region without a German name takes its English name, then any other language's, for
|
|
24
|
+
`de-DE`, its `id` and its place among its siblings. Before, only English stood in, and a
|
|
25
|
+
region named only in French or Italian failed `getRegions()`. Regions that loaded before
|
|
26
|
+
keep their `id`.
|
|
27
|
+
|
|
28
|
+
## Fixed
|
|
29
|
+
|
|
30
|
+
- v9: a pet service was offered in `quote.additionalServices` and could be added even where the
|
|
31
|
+
rental takes no pets or takes them only on request. The guest picker already refused pets
|
|
32
|
+
there (`maxPets: 0`). Now:
|
|
33
|
+
- no pets: the pet service is not offered.
|
|
34
|
+
- pets on request: the pet service has `available: false` and `unavailableReason`
|
|
35
|
+
"Haustiere nur auf Anfrage" ("Pets on request only", translation key
|
|
36
|
+
`quote.additionalService.pet.onRequest`); `addAdditionalService` returns `ok: false`.
|
|
37
|
+
- at most n pets: the pet service's `maxPerBooking` is at most n.
|
|
38
|
+
- no pet rule stated, or the unit could not be loaded: unchanged.
|
|
39
|
+
- v10: a quote for more pets than the pet service allows per booking is unavailable with code
|
|
40
|
+
`NotBookable` and the reason "Erlaubte Haustiere: höchstens 1" (translation key
|
|
41
|
+
`quote.status.unavailable.tooManyPets`).
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Migration: 3.4.2 to 3.5.0
|
|
2
|
+
|
|
3
|
+
No code changes required for the quote. Check that the quote and checkout extras render a
|
|
4
|
+
service with `available: false` as disabled and show its `unavailableReason`; v9 quotes now
|
|
5
|
+
send it for pet services where the rental takes pets only on request. Group or label pet
|
|
6
|
+
services by `kind === "pet"`, never by their name.
|
|
7
|
+
|
|
8
|
+
A site that renders `region.name[locale]` shows English region names on English pages after
|
|
9
|
+
the upgrade. A site that needs the German name in every locale reads `region.name["de-DE"]`.
|
|
10
|
+
|
|
11
|
+
Code that builds a `WebsiteRegion` by hand, such as a test fixture, adds the new `names` field:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
const region: WebsiteRegion = {
|
|
15
|
+
id: "engadin-8649",
|
|
16
|
+
parentId: null,
|
|
17
|
+
depth: 0,
|
|
18
|
+
name: { "de-DE": "Engadin", "en-US": "Engadin" },
|
|
19
|
+
names: { de: "Engadin" },
|
|
20
|
+
ownRentalIds: [],
|
|
21
|
+
rentalIds: [],
|
|
22
|
+
};
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 1. Upgrade
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
pnpm add @v-office/website-sdk@3.5.0
|
|
29
|
+
```
|
|
@@ -69,13 +69,16 @@ const toImages = (line) => {
|
|
|
69
69
|
};
|
|
70
70
|
const toPositiveQuantity = (value) => value == null || value <= 0 ? void 0 : value;
|
|
71
71
|
const toNonNegativeQuantity = (value) => value == null || value < 0 ? void 0 : value;
|
|
72
|
-
const
|
|
72
|
+
const toPetMaxPerBooking = ({ maxPerBooking, petPolicy }) => petPolicy?.kind === "limited" ? Math.min(maxPerBooking ?? petPolicy.maxPets, petPolicy.maxPets) : maxPerBooking;
|
|
73
|
+
const toAdditionalServices = ({ input, guestQuoteResult, locale, translations, petPolicy }) => Effect.gen(function* () {
|
|
73
74
|
const additionalServices = [];
|
|
74
75
|
const currency = guestQuoteResult?.currency ?? "EUR";
|
|
75
76
|
const today = yield* DateTime.now;
|
|
76
77
|
for (const line of [...guestQuoteResult?.optional ?? [], ...guestQuoteResult?.onsiteOptional ?? []]) {
|
|
77
78
|
const id = getLineServiceId(line);
|
|
78
79
|
if (id === void 0) continue;
|
|
80
|
+
const isPet = line.service?.type === "PET";
|
|
81
|
+
if (isPet && petPolicy?.kind === "none") continue;
|
|
79
82
|
const limit = guestQuoteResult?.serviceLimits?.[id];
|
|
80
83
|
const leadTimeDays = limit?.minDaysBeforeArrival ?? void 0;
|
|
81
84
|
if (!hasEnoughLeadTime({
|
|
@@ -100,15 +103,25 @@ const toAdditionalServices = ({ input, guestQuoteResult, locale, translations })
|
|
|
100
103
|
locale,
|
|
101
104
|
translations
|
|
102
105
|
});
|
|
103
|
-
const
|
|
106
|
+
const serviceMaxPerBooking = toPositiveQuantity(limit?.maxPerBooking);
|
|
107
|
+
const maxPerBooking = isPet ? toPetMaxPerBooking({
|
|
108
|
+
maxPerBooking: serviceMaxPerBooking,
|
|
109
|
+
petPolicy
|
|
110
|
+
}) : serviceMaxPerBooking;
|
|
111
|
+
const isOnRequest = isPet && petPolicy?.kind === "onRequest";
|
|
104
112
|
const lineAmount = toNonNegativeQuantity(line.amount);
|
|
105
|
-
const proposedQuantity = lineAmount === void 0 ? void 0 : Math.min(lineAmount, maxPerBooking ?? lineAmount);
|
|
113
|
+
const proposedQuantity = lineAmount === void 0 || isOnRequest ? void 0 : Math.min(lineAmount, maxPerBooking ?? lineAmount);
|
|
106
114
|
const description = toDescription(line);
|
|
107
115
|
const images = toImages(line);
|
|
108
116
|
additionalServices.push({
|
|
109
117
|
id,
|
|
110
118
|
label,
|
|
111
119
|
charge,
|
|
120
|
+
...isPet ? { kind: "pet" } : {},
|
|
121
|
+
...isOnRequest ? {
|
|
122
|
+
available: false,
|
|
123
|
+
unavailableReason: yield* translations.translate(locale, "quote.additionalService.pet.onRequest", "Pets on request only")
|
|
124
|
+
} : {},
|
|
112
125
|
chargeAmount,
|
|
113
126
|
chargeUnits: toChargeUnits(line, input),
|
|
114
127
|
...proposedQuantity === void 0 ? {} : { proposedQuantity },
|
|
@@ -143,6 +156,32 @@ const withSelectedServiceAmounts = (quote, selections, input) => {
|
|
|
143
156
|
...quote.onsiteOptional === void 0 ? {} : { onsiteOptional: quote.onsiteOptional.map((line) => withSelectedAmount(line, selections, input)) }
|
|
144
157
|
};
|
|
145
158
|
};
|
|
159
|
+
const toMaxPetAmount = (petPolicy) => {
|
|
160
|
+
switch (petPolicy?.kind) {
|
|
161
|
+
case "none":
|
|
162
|
+
case "onRequest": return 0;
|
|
163
|
+
case "limited": return petPolicy.maxPets;
|
|
164
|
+
default: return;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const withPetPolicyAmounts = ({ quote, petPolicy, input }) => {
|
|
168
|
+
const maxAmount = toMaxPetAmount(petPolicy);
|
|
169
|
+
if (quote === void 0 || maxAmount === void 0) return quote;
|
|
170
|
+
const withMaxPetAmount = (line) => {
|
|
171
|
+
if (line.service?.type !== "PET" || (line.amount ?? 0) <= maxAmount) return line;
|
|
172
|
+
const total = toSelectedTotal(line, maxAmount, input) ?? (line.total == null ? void 0 : Math.round(line.total * maxAmount / (line.amount ?? maxAmount)));
|
|
173
|
+
return {
|
|
174
|
+
...line,
|
|
175
|
+
amount: maxAmount,
|
|
176
|
+
...total === void 0 ? {} : { total }
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
return {
|
|
180
|
+
...quote,
|
|
181
|
+
...quote.optional === void 0 ? {} : { optional: quote.optional.map(withMaxPetAmount) },
|
|
182
|
+
...quote.onsiteOptional === void 0 ? {} : { onsiteOptional: quote.onsiteOptional.map(withMaxPetAmount) }
|
|
183
|
+
};
|
|
184
|
+
};
|
|
146
185
|
const toV9QuoteBackendContext = (input, guestQuoteResult) => ({
|
|
147
186
|
backend: "v9",
|
|
148
187
|
input,
|
|
@@ -292,7 +331,8 @@ const toGuestQuote = (input, guestQuoteResult, locale, translations, options) =>
|
|
|
292
331
|
input,
|
|
293
332
|
guestQuoteResult,
|
|
294
333
|
locale,
|
|
295
|
-
translations
|
|
334
|
+
translations,
|
|
335
|
+
...options?.petPolicy === void 0 ? {} : { petPolicy: options.petPolicy }
|
|
296
336
|
});
|
|
297
337
|
const baseTotal = toBaseTotal(guestQuoteResult);
|
|
298
338
|
const currency = guestQuoteResult?.currency ?? "EUR";
|
|
@@ -311,7 +351,11 @@ const toGuestQuote = (input, guestQuoteResult, locale, translations, options) =>
|
|
|
311
351
|
currency,
|
|
312
352
|
additionalServices,
|
|
313
353
|
...voucher === void 0 ? {} : { voucher },
|
|
314
|
-
backendContext: toV9QuoteBackendContext(input,
|
|
354
|
+
backendContext: toV9QuoteBackendContext(input, withPetPolicyAmounts({
|
|
355
|
+
quote: guestQuoteResult,
|
|
356
|
+
petPolicy: options?.petPolicy,
|
|
357
|
+
input
|
|
358
|
+
})),
|
|
315
359
|
updateBackendContext: updateV9QuoteBackendContext
|
|
316
360
|
});
|
|
317
361
|
if (options?.shouldAddProposedAdditionalServiceAmount === true) for (const additionalService of additionalServices) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as V9_FACILITY_ATTRIBUTE_KEYS } from "./client-
|
|
1
|
+
import { $t as V9_FACILITY_ATTRIBUTE_KEYS } from "./client-BKsLLOAa.mjs";
|
|
2
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
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";
|
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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-BKsLLOAa.mjs";
|
|
2
2
|
import { T as parseVofficeUnitData, n as mapSearchQuery, r as searchQuery } from "./operations-DY2e_2Hd.mjs";
|
|
3
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";
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"quote.additionalService.month": " / Monat",
|
|
9
9
|
"quote.additionalService.free": "kostenlos",
|
|
10
10
|
"quote.status.unavailable.notBookable": "Nicht verfügbar",
|
|
11
|
+
"quote.status.unavailable.tooManyPets": "Erlaubte Haustiere: höchstens {count}",
|
|
11
12
|
"quote.optionCombination.unavailable": "Diese Optionskombination ist nicht verfügbar.",
|
|
12
13
|
"quote.voucher.applied": "Der Rabattcode wurde angewendet.",
|
|
13
14
|
"quote.voucher.notApplied": "Der Rabattcode konnte nicht angewendet werden.",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"quote.additionalService.month": " / month",
|
|
9
9
|
"quote.additionalService.free": "free",
|
|
10
10
|
"quote.status.unavailable.notBookable": "Not available",
|
|
11
|
+
"quote.status.unavailable.tooManyPets": "Pets allowed: at most {count}",
|
|
11
12
|
"quote.optionCombination.unavailable": "This option combination is unavailable.",
|
|
12
13
|
"quote.voucher.applied": "The voucher code was applied.",
|
|
13
14
|
"quote.voucher.notApplied": "The voucher code could not be applied.",
|
|
@@ -15,5 +15,6 @@
|
|
|
15
15
|
"insurance.ergo.preContract.documents.PRP.label": "Merkblatt zur Datenverarbeitung",
|
|
16
16
|
"insurance.ergo.preContract.documents.ECI.label": "Kundeninformation elektronischer Geschäftsverkehr",
|
|
17
17
|
"insurance.ergo.preContract.documents.other.label": "Dokument",
|
|
18
|
-
"insurance.ergo.policy.document.label": "Versicherungsschein"
|
|
18
|
+
"insurance.ergo.policy.document.label": "Versicherungsschein",
|
|
19
|
+
"quote.additionalService.pet.onRequest": "Haustiere nur auf Anfrage"
|
|
19
20
|
}
|
|
@@ -15,5 +15,6 @@
|
|
|
15
15
|
"insurance.ergo.preContract.documents.PRP.label": "Data processing notice",
|
|
16
16
|
"insurance.ergo.preContract.documents.ECI.label": "E-commerce customer information",
|
|
17
17
|
"insurance.ergo.preContract.documents.other.label": "Document",
|
|
18
|
-
"insurance.ergo.policy.document.label": "Insurance policy"
|
|
18
|
+
"insurance.ergo.policy.document.label": "Insurance policy",
|
|
19
|
+
"quote.additionalService.pet.onRequest": "Pets on request only"
|
|
19
20
|
}
|
|
@@ -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.5.0/CHANGELOG.md`: release notes for 3.5.0
|
|
7
8
|
- `versions/3.4.2/CHANGELOG.md`: release notes for 3.4.2
|
|
8
9
|
- `versions/3.4.1/CHANGELOG.md`: release notes for 3.4.1
|
|
9
10
|
- `versions/3.4.0/CHANGELOG.md`: release notes for 3.4.0
|
|
@@ -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.5.0/MIGRATION.md`: Migration: 3.4.2 to 3.5.0
|
|
7
8
|
- `versions/3.4.2/MIGRATION.md`: Migration: 3.4.1 to 3.4.2
|
|
8
9
|
- `versions/3.4.1/MIGRATION.md`: Migration: 3.4.0 to 3.4.1
|
|
9
10
|
- `versions/3.4.0/MIGRATION.md`: Migration: 3.3.0 to 3.4.0
|
package/instructions/quote.md
CHANGED
|
@@ -335,7 +335,14 @@ const cleared = await sdk.live.quote.clearAdditionalServices({ quote });
|
|
|
335
335
|
if (cleared.ok) quote = cleared.quote;
|
|
336
336
|
```
|
|
337
337
|
|
|
338
|
-
Each successful change returns a new quote with recalculated `bookingCardInformation.total`.
|
|
338
|
+
Each successful change returns a new quote with recalculated `bookingCardInformation.total`. A service can be marked `available: false` with `unavailableReason` (v10 for unavailable service/policy combinations, v9 for pets on request); disable those options in the UI and show the reason. Handle `{ ok: false, error }` for unknown service ids, unavailable services, quantity limits, or `UnavailableQuoteCombination`.
|
|
339
|
+
|
|
340
|
+
### Pet services
|
|
341
|
+
|
|
342
|
+
A service of the PMS service type pet carries `kind: "pet"`. Use it to group or label pet services; never detect them by their name. From 3.5.0 a pet service follows the rental's pet rule:
|
|
343
|
+
|
|
344
|
+
- `v9`: a rental that takes no pets does not offer its pet service. A rental that takes pets only on request offers it with `available: false` and `unavailableReason` ("Haustiere nur auf Anfrage", translation key `quote.additionalService.pet.onRequest`), and `addAdditionalService` refuses it. A rental that takes at most n pets caps the service's `maxPerBooking` at n. A rental that states no pet rule is unchanged.
|
|
345
|
+
- `v10`: the pet service is a mandatory line priced from `occupancy.pets`, not an extra the guest adds. When `occupancy.pets` exceeds the pet service's limit per booking, the quote is unavailable with code `NotBookable` and a reason such as "Erlaubte Haustiere: höchstens 1" (translation key `quote.status.unavailable.tooManyPets`). A rental that takes no pets stays unavailable as before.
|
|
339
346
|
|
|
340
347
|
From 2.16.1, v10 resolves the multi-rate from rent rates only. Additional services are priced on top of the resolved multi-rate and no longer make it unresolvable, so they are no longer reported unavailable for that reason.
|
|
341
348
|
|
package/instructions/regions.md
CHANGED
|
@@ -4,14 +4,14 @@ Regions group a site's rentals into a tree, for example Nordsee → Dornum → D
|
|
|
4
4
|
`sdk.static.regions.getRegions` returns the tree in the same shape on both backends, so
|
|
5
5
|
region pages and the search's region field are the same code on v10 and v9.
|
|
6
6
|
|
|
7
|
-
| | v10 | v9
|
|
8
|
-
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
9
|
-
| Source | the websites service: editors arrange regions in the CMS (Websites → "Regionen"), and a website can have its own tree instead of the workspace's default | vOffice's region hierarchy, through the be-on! Hub
|
|
10
|
-
| Regions per rental | several | one; it also counts for every region above it
|
|
11
|
-
| Names |
|
|
12
|
-
| Region ids | created once by the websites service from the German name; never change | German name and vOffice id; change on a rename
|
|
13
|
-
| Order | the editors' order | siblings by German name
|
|
14
|
-
| Regions returned | every region in the tree | only regions holding a rental of the be-on key
|
|
7
|
+
| | v10 | v9 |
|
|
8
|
+
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
9
|
+
| Source | the websites service: editors arrange regions in the CMS (Websites → "Regionen"), and a website can have its own tree instead of the workspace's default | vOffice's region hierarchy, through the be-on! Hub |
|
|
10
|
+
| Regions per rental | several | one; it also counts for every region above it |
|
|
11
|
+
| Names | German and English, English falls back to German; every language in `names` | German and English, each falls back to the other; German, English, French and Italian in `names` |
|
|
12
|
+
| Region ids | created once by the websites service from the German name; never change | German name and vOffice id; change on a rename |
|
|
13
|
+
| Order | the editors' order | siblings by German name |
|
|
14
|
+
| Regions returned | every region in the tree | only regions holding a rental of the be-on key |
|
|
15
15
|
|
|
16
16
|
Regions are not a custom attribute. Do not read a "Region" custom attribute, and do not
|
|
17
17
|
select one in `defineCustomAttributes`: the tree replaces both.
|
|
@@ -49,7 +49,8 @@ type WebsiteRegion = {
|
|
|
49
49
|
id: string; // "dornum": the region's URL and `?region=` value
|
|
50
50
|
parentId: string | null; // null: top level
|
|
51
51
|
depth: number; // 0: top level
|
|
52
|
-
name: { "de-DE": string; "en-US": string }; //
|
|
52
|
+
name: { "de-DE": string; "en-US": string }; // English falls back to German
|
|
53
|
+
names: Record<string, string>; // { de: "Schweiz", fr: "Suisse" }: every language with a name
|
|
53
54
|
ownRentalIds: readonly string[];
|
|
54
55
|
rentalIds: readonly string[];
|
|
55
56
|
};
|
|
@@ -62,11 +63,16 @@ type WebsiteRegion = {
|
|
|
62
63
|
- v10: the websites service creates it once from the German name. Renaming or moving the
|
|
63
64
|
region, and giving the website its own tree, keep it; editors cannot change it. Only
|
|
64
65
|
deleting the region ends it.
|
|
65
|
-
- v9: vOffice's German name and its vOffice id, for example `usedom-12`.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
- v9: vOffice's German name and its vOffice id, for example `usedom-12`. A region without
|
|
67
|
+
a German name takes the name `name["de-DE"]` falls back to, and siblings sort by it too.
|
|
68
|
+
Renaming the region in vOffice changes it; no other region's change does.
|
|
69
|
+
- `name` holds a name under every locale, so `name[locale]` always works. `en-US` is the
|
|
70
|
+
English name, or the German one where the region has none. Sort and build ids from
|
|
71
|
+
`id`, never from `name`.
|
|
72
|
+
- `names` holds the region's names by ISO 639-1 language as the PMS keeps them, for
|
|
73
|
+
example French and Italian on v9. It has only languages with a name: fall back yourself,
|
|
74
|
+
`region.names.fr ?? region.name["de-DE"]`. Regions have no description: write a region page's text in the
|
|
75
|
+
site.
|
|
70
76
|
- `ownRentalIds` are the rentals in the region itself. `rentalIds` adds every subregion's
|
|
71
77
|
rentals, each rental once. A region page lists `rentalIds`: "Nordsee" shows Dornum's
|
|
72
78
|
and Dornumersiel's rentals too.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Changelog: 3.5.0
|
|
2
|
+
|
|
3
|
+
A pet service in the quote follows the rental's pet rule, so a guest can no longer add a dog
|
|
4
|
+
where the rental takes dogs only on request. Regions show their English name on English pages
|
|
5
|
+
and carry their names in every language the PMS keeps, on v10 and v9. Includes
|
|
6
|
+
`@v-office/sdk-core` 1.33.0.
|
|
7
|
+
|
|
8
|
+
## Added
|
|
9
|
+
|
|
10
|
+
- `kind: "pet"` on an additional service of the PMS service type pet. Use it to group or label
|
|
11
|
+
pet services instead of matching their name.
|
|
12
|
+
- `region.names`: the region's names by ISO 639-1 language, only languages with a name. On
|
|
13
|
+
v9 that is German, English, French and Italian as vOffice keeps them:
|
|
14
|
+
`region.names.fr ?? region.name["de-DE"]` for a French page.
|
|
15
|
+
|
|
16
|
+
## Changed
|
|
17
|
+
|
|
18
|
+
- v9: a quote also loads the unit's details, once per unit and client, shared with
|
|
19
|
+
availability. Availability and quote requested together make one request.
|
|
20
|
+
- `regions.getRegions()` fills `name["en-US"]` with the region's English name, and with the
|
|
21
|
+
German one where there is none. `name["de-DE"]` stays German. The region's `id`, its URL
|
|
22
|
+
and `?region=` value, and the order of the tree are unchanged.
|
|
23
|
+
- v9: a region without a German name takes its English name, then any other language's, for
|
|
24
|
+
`de-DE`, its `id` and its place among its siblings. Before, only English stood in, and a
|
|
25
|
+
region named only in French or Italian failed `getRegions()`. Regions that loaded before
|
|
26
|
+
keep their `id`.
|
|
27
|
+
|
|
28
|
+
## Fixed
|
|
29
|
+
|
|
30
|
+
- v9: a pet service was offered in `quote.additionalServices` and could be added even where the
|
|
31
|
+
rental takes no pets or takes them only on request. The guest picker already refused pets
|
|
32
|
+
there (`maxPets: 0`). Now:
|
|
33
|
+
- no pets: the pet service is not offered.
|
|
34
|
+
- pets on request: the pet service has `available: false` and `unavailableReason`
|
|
35
|
+
"Haustiere nur auf Anfrage" ("Pets on request only", translation key
|
|
36
|
+
`quote.additionalService.pet.onRequest`); `addAdditionalService` returns `ok: false`.
|
|
37
|
+
- at most n pets: the pet service's `maxPerBooking` is at most n.
|
|
38
|
+
- no pet rule stated, or the unit could not be loaded: unchanged.
|
|
39
|
+
- v10: a quote for more pets than the pet service allows per booking is unavailable with code
|
|
40
|
+
`NotBookable` and the reason "Erlaubte Haustiere: höchstens 1" (translation key
|
|
41
|
+
`quote.status.unavailable.tooManyPets`).
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Migration: 3.4.2 to 3.5.0
|
|
2
|
+
|
|
3
|
+
No code changes required for the quote. Check that the quote and checkout extras render a
|
|
4
|
+
service with `available: false` as disabled and show its `unavailableReason`; v9 quotes now
|
|
5
|
+
send it for pet services where the rental takes pets only on request. Group or label pet
|
|
6
|
+
services by `kind === "pet"`, never by their name.
|
|
7
|
+
|
|
8
|
+
A site that renders `region.name[locale]` shows English region names on English pages after
|
|
9
|
+
the upgrade. A site that needs the German name in every locale reads `region.name["de-DE"]`.
|
|
10
|
+
|
|
11
|
+
Code that builds a `WebsiteRegion` by hand, such as a test fixture, adds the new `names` field:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
const region: WebsiteRegion = {
|
|
15
|
+
id: "engadin-8649",
|
|
16
|
+
parentId: null,
|
|
17
|
+
depth: 0,
|
|
18
|
+
name: { "de-DE": "Engadin", "en-US": "Engadin" },
|
|
19
|
+
names: { de: "Engadin" },
|
|
20
|
+
ownRentalIds: [],
|
|
21
|
+
rentalIds: [],
|
|
22
|
+
};
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 1. Upgrade
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
pnpm add @v-office/website-sdk@3.5.0
|
|
29
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-office/website-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
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.
|
|
51
|
+
"@v-office/sdk-core": "1.33.0",
|
|
52
52
|
"effect": "4.0.0-rc.115",
|
|
53
53
|
"graphql": "17.0.2",
|
|
54
54
|
"yaml": "^2.9.0"
|