@v-office/website-sdk 3.4.1 → 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-DY2AASUk.mjs → client-BKsLLOAa.mjs} +94 -56
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/instructions/CHANGELOG.md +2 -0
- package/dist/instructions/MIGRATION.md +2 -0
- package/dist/instructions/quote.md +8 -1
- package/dist/instructions/regions.md +20 -14
- package/dist/instructions/versions/3.4.2/CHANGELOG.md +12 -0
- package/dist/instructions/versions/3.4.2/MIGRATION.md +9 -0
- 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-CgNZbpAB.mjs → rentals-CWP8md5n.mjs} +1 -1
- package/dist/{search-CqFOCZ8I.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 +2 -0
- package/instructions/MIGRATION.md +2 -0
- package/instructions/quote.md +8 -1
- package/instructions/regions.md +20 -14
- package/instructions/versions/3.4.2/CHANGELOG.md +12 -0
- package/instructions/versions/3.4.2/MIGRATION.md +9 -0
- package/instructions/versions/3.4.2/release.json +3 -0
- 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 +3 -3
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";
|
|
@@ -717,18 +717,27 @@ const validateWebsiteV9Config = (config) => {
|
|
|
717
717
|
};
|
|
718
718
|
//#endregion
|
|
719
719
|
//#region codegen/v9/php-record.ts
|
|
720
|
+
const isObject = (input) => typeof input === "object" && input !== null && !Array.isArray(input);
|
|
720
721
|
/**
|
|
721
722
|
* The v9 APIs are PHP applications, and `json_encode` writes an empty
|
|
722
723
|
* associative array as `[]` rather than `{}`. Every record field can therefore
|
|
723
724
|
* arrive as an empty array. That is a valid "nothing configured" state and must
|
|
724
725
|
* not fail decoding.
|
|
725
726
|
*
|
|
726
|
-
*
|
|
727
|
+
* With `nullAsMissing`, an entry whose value is `null` is dropped before
|
|
728
|
+
* decoding: vOffice writes an untranslated language as `"en": null` as often as
|
|
729
|
+
* it leaves the key out, and both mean the same.
|
|
730
|
+
*
|
|
731
|
+
* Only these two shapes are reinterpreted. Everything else runs against
|
|
727
732
|
* `Schema.Record` unchanged, so wrong value types and non-empty arrays still
|
|
728
733
|
* fail with a regular SchemaError.
|
|
729
734
|
*/
|
|
730
|
-
const PhpRecord = (value) => Schema.Unknown.pipe(Schema.decodeTo(Schema.Record(Schema.String, value), {
|
|
731
|
-
decode: SchemaGetter.transform((input) =>
|
|
735
|
+
const PhpRecord = (value, { nullAsMissing = false } = {}) => Schema.Unknown.pipe(Schema.decodeTo(Schema.Record(Schema.String, value), {
|
|
736
|
+
decode: SchemaGetter.transform((input) => {
|
|
737
|
+
if (Array.isArray(input) && input.length === 0) return {};
|
|
738
|
+
if (nullAsMissing && isObject(input)) return Object.fromEntries(Object.entries(input).filter(([, entry]) => entry !== null));
|
|
739
|
+
return input;
|
|
740
|
+
}),
|
|
732
741
|
encode: SchemaGetter.transform((record) => record)
|
|
733
742
|
}));
|
|
734
743
|
//#endregion
|
|
@@ -1777,12 +1786,26 @@ const MAX_PETS_BY_RESTRICTION = {
|
|
|
1777
1786
|
4: 4
|
|
1778
1787
|
};
|
|
1779
1788
|
const toPositiveCount = (value) => value !== void 0 && Number.isInteger(value) && value > 0 ? value : null;
|
|
1780
|
-
const
|
|
1789
|
+
const toPetPolicy = (unit) => {
|
|
1781
1790
|
const { pets, petsRestrictions } = unit.known;
|
|
1782
|
-
if (pets === void 0) return
|
|
1783
|
-
if (pets === 0) return
|
|
1784
|
-
if (petsRestrictions === void 0) return
|
|
1785
|
-
|
|
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
|
+
}
|
|
1786
1809
|
};
|
|
1787
1810
|
const toOccupancyLimits = ({ unit }) => {
|
|
1788
1811
|
const maxPersons = toPositiveCount(unit.known.beds);
|
|
@@ -1845,7 +1868,8 @@ var core_default$1 = {
|
|
|
1845
1868
|
"insurance.ergo.preContract.documents.PRP.label": "Merkblatt zur Datenverarbeitung",
|
|
1846
1869
|
"insurance.ergo.preContract.documents.ECI.label": "Kundeninformation elektronischer Geschäftsverkehr",
|
|
1847
1870
|
"insurance.ergo.preContract.documents.other.label": "Dokument",
|
|
1848
|
-
"insurance.ergo.policy.document.label": "Versicherungsschein"
|
|
1871
|
+
"insurance.ergo.policy.document.label": "Versicherungsschein",
|
|
1872
|
+
"quote.additionalService.pet.onRequest": "Haustiere nur auf Anfrage"
|
|
1849
1873
|
};
|
|
1850
1874
|
//#endregion
|
|
1851
1875
|
//#region translations/v9/de-DE/filter.json
|
|
@@ -2597,7 +2621,8 @@ var core_default = {
|
|
|
2597
2621
|
"insurance.ergo.preContract.documents.PRP.label": "Data processing notice",
|
|
2598
2622
|
"insurance.ergo.preContract.documents.ECI.label": "E-commerce customer information",
|
|
2599
2623
|
"insurance.ergo.preContract.documents.other.label": "Document",
|
|
2600
|
-
"insurance.ergo.policy.document.label": "Insurance policy"
|
|
2624
|
+
"insurance.ergo.policy.document.label": "Insurance policy",
|
|
2625
|
+
"quote.additionalService.pet.onRequest": "Pets on request only"
|
|
2601
2626
|
};
|
|
2602
2627
|
//#endregion
|
|
2603
2628
|
//#region translations/v9/en-US/filter.json
|
|
@@ -3375,13 +3400,12 @@ const toVofficeUnitId$2 = (input) => {
|
|
|
3375
3400
|
}));
|
|
3376
3401
|
};
|
|
3377
3402
|
const RENT_NIGHT_PRICES_TTL_MILLIS = 3e5;
|
|
3378
|
-
const makeV9AvailabilityApi = ({ config, options }) => {
|
|
3403
|
+
const makeV9AvailabilityApi = ({ config, options, loadUnitDetails }) => {
|
|
3379
3404
|
const translations = makeV9TranslationService(options.translationOverrides);
|
|
3380
3405
|
const openApiClientLive = makeV1OpenApiClientFetchLive({
|
|
3381
3406
|
apiKey: config.apiKey,
|
|
3382
3407
|
...config.v1ApiBaseUrl === void 0 ? {} : { baseUrl: config.v1ApiBaseUrl }
|
|
3383
3408
|
});
|
|
3384
|
-
const unitDetailsByUnitId = /* @__PURE__ */ new Map();
|
|
3385
3409
|
const rentNightPricesByUnitId = /* @__PURE__ */ new Map();
|
|
3386
3410
|
const loadAvailability = (input) => Effect.gen(function* () {
|
|
3387
3411
|
const client = yield* V1OpenApiClient;
|
|
@@ -3396,23 +3420,6 @@ const makeV9AvailabilityApi = ({ config, options }) => {
|
|
|
3396
3420
|
cause
|
|
3397
3421
|
})))).data;
|
|
3398
3422
|
}).pipe(Effect.provide(openApiClientLive));
|
|
3399
|
-
const loadUnitDetails = (input) => Effect.gen(function* () {
|
|
3400
|
-
const client = yield* V1OpenApiClient;
|
|
3401
|
-
const unitId = yield* toVofficeUnitId$2(input);
|
|
3402
|
-
const cached = unitDetailsByUnitId.get(unitId);
|
|
3403
|
-
if (cached !== void 0) return cached;
|
|
3404
|
-
const result = yield* client.execute("getUnit", { path: { voffice_unit: unitId } }).pipe(Effect.match({
|
|
3405
|
-
onFailure: () => void 0,
|
|
3406
|
-
onSuccess: (result) => result
|
|
3407
|
-
}));
|
|
3408
|
-
if (result === void 0) return void 0;
|
|
3409
|
-
const details = {
|
|
3410
|
-
currency: firstString(result.data.data.currency),
|
|
3411
|
-
occupancyLimits: toOccupancyLimits({ unit: parseVofficeUnitData(result.data.data) })
|
|
3412
|
-
};
|
|
3413
|
-
unitDetailsByUnitId.set(unitId, details);
|
|
3414
|
-
return details;
|
|
3415
|
-
}).pipe(Effect.provide(openApiClientLive));
|
|
3416
3423
|
const loadRentNightPrices = (input) => Effect.gen(function* () {
|
|
3417
3424
|
const client = yield* V1OpenApiClient;
|
|
3418
3425
|
const unitId = yield* toVofficeUnitId$2(input);
|
|
@@ -3439,7 +3446,7 @@ const makeV9AvailabilityApi = ({ config, options }) => {
|
|
|
3439
3446
|
const now = yield* DateTime.now;
|
|
3440
3447
|
const [availability, unitDetails, rentNightPrices] = yield* Effect.all([
|
|
3441
3448
|
loadAvailability(input),
|
|
3442
|
-
|
|
3449
|
+
toVofficeUnitId$2(input).pipe(Effect.flatMap(loadUnitDetails)),
|
|
3443
3450
|
loadRentNightPrices(input)
|
|
3444
3451
|
], { concurrency: "unbounded" });
|
|
3445
3452
|
const currency = unitDetails?.currency;
|
|
@@ -3465,7 +3472,7 @@ const makeV9AvailabilityApi = ({ config, options }) => {
|
|
|
3465
3472
|
const now = yield* DateTime.now;
|
|
3466
3473
|
const [availability, unitDetails, rentNightPrices] = yield* Effect.all([
|
|
3467
3474
|
loadAvailability(input),
|
|
3468
|
-
|
|
3475
|
+
toVofficeUnitId$2(input).pipe(Effect.flatMap(loadUnitDetails)),
|
|
3469
3476
|
loadRentNightPrices(input)
|
|
3470
3477
|
], { concurrency: "unbounded" });
|
|
3471
3478
|
const currency = unitDetails?.currency;
|
|
@@ -3773,7 +3780,7 @@ const GuestAppReservationDataResponseSchema = Schema.Struct({
|
|
|
3773
3780
|
trackingId: Schema.optionalKey(Schema.String)
|
|
3774
3781
|
});
|
|
3775
3782
|
Schema.suspend(() => CheckoutPaymentDataSchema);
|
|
3776
|
-
const LanguageMapSchema = PhpRecord(Schema.String);
|
|
3783
|
+
const LanguageMapSchema = PhpRecord(Schema.String, { nullAsMissing: true });
|
|
3777
3784
|
const MessageFormValueSchema = Schema.NullOr(Schema.Union([
|
|
3778
3785
|
Schema.String,
|
|
3779
3786
|
Schema.Number,
|
|
@@ -6222,7 +6229,7 @@ const revokeV9InsurancePolicy = ({ policyNumber, booking, v1Client }) => Effect.
|
|
|
6222
6229
|
//#region src/legacy-v9/live/quote.ts
|
|
6223
6230
|
const loadQuoteRuntime = Effect.tryPromise({
|
|
6224
6231
|
try: async () => {
|
|
6225
|
-
return { toGuestQuote: (await import("./quote-
|
|
6232
|
+
return { toGuestQuote: (await import("./quote-C442GXE5.mjs")).toGuestQuote };
|
|
6226
6233
|
},
|
|
6227
6234
|
catch: (cause) => new CoreSDKError({
|
|
6228
6235
|
source: "v9",
|
|
@@ -6240,9 +6247,9 @@ const toVofficeUnitId = (input) => {
|
|
|
6240
6247
|
message: `Expected rentalId to be a vOffice unit ID, received "${input.rentalId}".`
|
|
6241
6248
|
}));
|
|
6242
6249
|
};
|
|
6243
|
-
const quote = (client, v0Client, translations, limitQuote, input, shouldAddProposedAdditionalServiceAmount) => Effect.gen(function* () {
|
|
6250
|
+
const quote = (client, v0Client, translations, limitQuote, loadUnitDetails, input, shouldAddProposedAdditionalServiceAmount) => Effect.gen(function* () {
|
|
6244
6251
|
const unitId = yield* toVofficeUnitId(input);
|
|
6245
|
-
const
|
|
6252
|
+
const quotePrices = limitQuote(client.execute("getUnitQuotePrices", {
|
|
6246
6253
|
path: { voffice_unit: unitId },
|
|
6247
6254
|
query: {
|
|
6248
6255
|
lang: localeToLanguage(input.locale),
|
|
@@ -6261,8 +6268,12 @@ const quote = (client, v0Client, translations, limitQuote, input, shouldAddPropo
|
|
|
6261
6268
|
message: "Failed to load v9 quote prices from the v1 OpenAPI client.",
|
|
6262
6269
|
cause
|
|
6263
6270
|
}))));
|
|
6271
|
+
const [result, unitDetails] = yield* Effect.all([quotePrices, loadUnitDetails(unitId)], { concurrency: "unbounded" });
|
|
6264
6272
|
const { toGuestQuote } = yield* loadQuoteRuntime;
|
|
6265
|
-
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
|
+
});
|
|
6266
6277
|
if (guestQuoteResult.status === "unavailable") return guestQuoteResult;
|
|
6267
6278
|
return {
|
|
6268
6279
|
status: "available",
|
|
@@ -6275,7 +6286,7 @@ const quote = (client, v0Client, translations, limitQuote, input, shouldAddPropo
|
|
|
6275
6286
|
})
|
|
6276
6287
|
};
|
|
6277
6288
|
});
|
|
6278
|
-
const makeV9QuoteApi = ({ config, options }) => {
|
|
6289
|
+
const makeV9QuoteApi = ({ config, options, loadUnitDetails }) => {
|
|
6279
6290
|
const translations = makeV9TranslationService(options.translationOverrides);
|
|
6280
6291
|
const limitQuote = Effect.runSync(makeMinIntervalLimiter({
|
|
6281
6292
|
...options.rateBudget,
|
|
@@ -6305,7 +6316,7 @@ const makeV9QuoteApi = ({ config, options }) => {
|
|
|
6305
6316
|
v1Client: clients.v1Client
|
|
6306
6317
|
});
|
|
6307
6318
|
return {
|
|
6308
|
-
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)),
|
|
6309
6320
|
addAdditionalService: ({ quote, id }) => withClients((clients) => withGuestQuoteInsuranceRefresh({
|
|
6310
6321
|
result: addGuestQuoteAdditionalServiceSelection({
|
|
6311
6322
|
quote,
|
|
@@ -6577,7 +6588,7 @@ const parseV9SearchCursor = (cursor) => Effect.gen(function* () {
|
|
|
6577
6588
|
return page;
|
|
6578
6589
|
});
|
|
6579
6590
|
const loadV9SearchRuntime = Effect.tryPromise({
|
|
6580
|
-
try: () => import("./search-
|
|
6591
|
+
try: () => import("./search-BnS4mWvv.mjs"),
|
|
6581
6592
|
catch: (cause) => new CoreSDKError({
|
|
6582
6593
|
source: "v9",
|
|
6583
6594
|
operation: "v9.search.runtime",
|
|
@@ -6944,6 +6955,38 @@ const makeV9SearchApi = ({ config, options }) => {
|
|
|
6944
6955
|
};
|
|
6945
6956
|
};
|
|
6946
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
|
|
6947
6990
|
//#region src/legacy-v9/voucher-code.ts
|
|
6948
6991
|
const toVoucherCode = (voucher) => {
|
|
6949
6992
|
const code = voucher?.trim();
|
|
@@ -7256,26 +7299,17 @@ const makeV9FilterApi = ({ options }) => {
|
|
|
7256
7299
|
};
|
|
7257
7300
|
//#endregion
|
|
7258
7301
|
//#region src/legacy-v9/static/regions.ts
|
|
7259
|
-
/** The region's one name, German; the English one only stands in for a missing German one. */
|
|
7260
|
-
const toName = (region) => {
|
|
7261
|
-
const names = region.name ?? {};
|
|
7262
|
-
const name = names.de?.trim() || names.en?.trim();
|
|
7263
|
-
return name ? {
|
|
7264
|
-
"de-DE": name,
|
|
7265
|
-
"en-US": name
|
|
7266
|
-
} : void 0;
|
|
7267
|
-
};
|
|
7268
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";
|
|
7269
7303
|
/** Maps the vOffice regions and the rentals' regions; throws on a region without a name. */
|
|
7270
7304
|
const toV9WebsiteRegions = ({ regions, rentalRegions }) => {
|
|
7271
7305
|
const ids = new Set(regions.map((region) => region._id));
|
|
7272
7306
|
const parentOf = (region) => region.parent !== void 0 && ids.has(region.parent) ? region.parent : null;
|
|
7273
7307
|
const named = regions.map((region) => {
|
|
7274
|
-
const
|
|
7275
|
-
if (
|
|
7308
|
+
const names = toRegionNames(region.name ?? {});
|
|
7309
|
+
if (names === void 0) throw new Error(`vOffice region ${region._id} has no name.`);
|
|
7276
7310
|
return {
|
|
7277
7311
|
region,
|
|
7278
|
-
|
|
7312
|
+
...names
|
|
7279
7313
|
};
|
|
7280
7314
|
});
|
|
7281
7315
|
const ownRentalIds = /* @__PURE__ */ new Map();
|
|
@@ -7284,12 +7318,13 @@ const toV9WebsiteRegions = ({ regions, rentalRegions }) => {
|
|
|
7284
7318
|
const hasRentals = (id) => (ownRentalIds.get(id)?.length ?? 0) > 0 || childrenOf(id).some(({ region }) => hasRentals(region._id));
|
|
7285
7319
|
const keys = new Map(named.map(({ region, name }) => [region._id, `${toSlug(name["de-DE"])}-${region._id}`]));
|
|
7286
7320
|
const keyOf = (id) => keys.get(id) ?? String(id);
|
|
7287
|
-
const visit = (parent) => childrenOf(parent).flatMap(({ region, name }) => {
|
|
7321
|
+
const visit = (parent) => childrenOf(parent).flatMap(({ region, name, names }) => {
|
|
7288
7322
|
if (!hasRentals(region._id)) return [];
|
|
7289
7323
|
return [{
|
|
7290
7324
|
id: keyOf(region._id),
|
|
7291
7325
|
parentId: parent === null ? null : keyOf(parent),
|
|
7292
7326
|
name,
|
|
7327
|
+
names,
|
|
7293
7328
|
ownRentalIds: ownRentalIds.get(region._id) ?? []
|
|
7294
7329
|
}, ...visit(region._id)];
|
|
7295
7330
|
});
|
|
@@ -7499,7 +7534,7 @@ const orderRentalsById = ({ rentalIds, rentals, missing }) => {
|
|
|
7499
7534
|
});
|
|
7500
7535
|
};
|
|
7501
7536
|
const loadV9RentalsRuntime = Effect.tryPromise({
|
|
7502
|
-
try: () => import("./rentals-
|
|
7537
|
+
try: () => import("./rentals-CWP8md5n.mjs"),
|
|
7503
7538
|
catch: (cause) => new CoreSDKError({
|
|
7504
7539
|
source: "v9",
|
|
7505
7540
|
operation: "v9.rentals.runtime",
|
|
@@ -7758,13 +7793,16 @@ function createWebsiteSDK({ config, options }) {
|
|
|
7758
7793
|
config,
|
|
7759
7794
|
options: v9Options
|
|
7760
7795
|
});
|
|
7796
|
+
const loadUnitDetails = makeV9UnitDetailsLoader({ config });
|
|
7761
7797
|
const availability = makeV9AvailabilityApi({
|
|
7762
7798
|
config,
|
|
7763
|
-
options: v9Options
|
|
7799
|
+
options: v9Options,
|
|
7800
|
+
loadUnitDetails
|
|
7764
7801
|
});
|
|
7765
7802
|
const quote = makeV9QuoteApi({
|
|
7766
7803
|
config,
|
|
7767
|
-
options: v9Options
|
|
7804
|
+
options: v9Options,
|
|
7805
|
+
loadUnitDetails
|
|
7768
7806
|
});
|
|
7769
7807
|
const booking = makeV9BookingApi({
|
|
7770
7808
|
config,
|
package/dist/index.d.mts
CHANGED
|
@@ -1017,14 +1017,14 @@ interface components$1 {
|
|
|
1017
1017
|
[key: string]: unknown;
|
|
1018
1018
|
};
|
|
1019
1019
|
/**
|
|
1020
|
-
* @description Multilanguage object keyed by ISO 639-1 language code.
|
|
1020
|
+
* @description Multilanguage object keyed by ISO 639-1 language code. vOffice writes an untranslated language as null or leaves its key out.
|
|
1021
1021
|
* @example {
|
|
1022
1022
|
* "de": "Miete",
|
|
1023
1023
|
* "en": "Rent"
|
|
1024
1024
|
* }
|
|
1025
1025
|
*/
|
|
1026
1026
|
LanguageMap: {
|
|
1027
|
-
[key: string]: string;
|
|
1027
|
+
[key: string]: string | null;
|
|
1028
1028
|
};
|
|
1029
1029
|
GeoPoint: {
|
|
1030
1030
|
/** @constant */
|
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,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.5.0/CHANGELOG.md`: release notes for 3.5.0
|
|
8
|
+
- `versions/3.4.2/CHANGELOG.md`: release notes for 3.4.2
|
|
7
9
|
- `versions/3.4.1/CHANGELOG.md`: release notes for 3.4.1
|
|
8
10
|
- `versions/3.4.0/CHANGELOG.md`: release notes for 3.4.0
|
|
9
11
|
- `versions/3.3.0/CHANGELOG.md`: release notes for 3.3.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.5.0/MIGRATION.md`: Migration: 3.4.2 to 3.5.0
|
|
8
|
+
- `versions/3.4.2/MIGRATION.md`: Migration: 3.4.1 to 3.4.2
|
|
7
9
|
- `versions/3.4.1/MIGRATION.md`: Migration: 3.4.0 to 3.4.1
|
|
8
10
|
- `versions/3.4.0/MIGRATION.md`: Migration: 3.3.0 to 3.4.0
|
|
9
11
|
- `versions/3.3.0/MIGRATION.md`: Migration: 3.2.1 to 3.3.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,12 @@
|
|
|
1
|
+
# Changelog: 3.4.2
|
|
2
|
+
|
|
3
|
+
v9 websites build again when a translation in vOffice is empty.
|
|
4
|
+
|
|
5
|
+
## Fixed
|
|
6
|
+
|
|
7
|
+
- v9: `regions.getRegions()` failed with "Failed to load the v9 region tree." as soon as one
|
|
8
|
+
region had a language without a name, sent as `"en": null`. The whole tree was lost, and every
|
|
9
|
+
page reading regions failed the build, also on a German-only site. A `null` language now
|
|
10
|
+
counts as a missing one: `{ de: "Engadin", en: null }` reads `{ de: "Engadin" }`.
|
|
11
|
+
- v9: the same applies to every other multilanguage value from the v0 API, such as a region's
|
|
12
|
+
description or an offer's name. These values never contain `null`.
|
|
@@ -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,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.5.0/CHANGELOG.md`: release notes for 3.5.0
|
|
8
|
+
- `versions/3.4.2/CHANGELOG.md`: release notes for 3.4.2
|
|
7
9
|
- `versions/3.4.1/CHANGELOG.md`: release notes for 3.4.1
|
|
8
10
|
- `versions/3.4.0/CHANGELOG.md`: release notes for 3.4.0
|
|
9
11
|
- `versions/3.3.0/CHANGELOG.md`: release notes for 3.3.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.5.0/MIGRATION.md`: Migration: 3.4.2 to 3.5.0
|
|
8
|
+
- `versions/3.4.2/MIGRATION.md`: Migration: 3.4.1 to 3.4.2
|
|
7
9
|
- `versions/3.4.1/MIGRATION.md`: Migration: 3.4.0 to 3.4.1
|
|
8
10
|
- `versions/3.4.0/MIGRATION.md`: Migration: 3.3.0 to 3.4.0
|
|
9
11
|
- `versions/3.3.0/MIGRATION.md`: Migration: 3.2.1 to 3.3.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,12 @@
|
|
|
1
|
+
# Changelog: 3.4.2
|
|
2
|
+
|
|
3
|
+
v9 websites build again when a translation in vOffice is empty.
|
|
4
|
+
|
|
5
|
+
## Fixed
|
|
6
|
+
|
|
7
|
+
- v9: `regions.getRegions()` failed with "Failed to load the v9 region tree." as soon as one
|
|
8
|
+
region had a language without a name, sent as `"en": null`. The whole tree was lost, and every
|
|
9
|
+
page reading regions failed the build, also on a German-only site. A `null` language now
|
|
10
|
+
counts as a missing one: `{ de: "Engadin", en: null }` reads `{ de: "Engadin" }`.
|
|
11
|
+
- v9: the same applies to every other multilanguage value from the v0 API, such as a region's
|
|
12
|
+
description or an offer's name. These values never contain `null`.
|
|
@@ -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"
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"check": "pnpm run typecheck && pnpm run lint && pnpm run fmt:check",
|
|
90
90
|
"test": "pnpm run test:cli && pnpm run test:v9:openapi && pnpm run test:v9:properties && pnpm run test:v9:rentals && pnpm run test:v9:graphql && pnpm run test:v9:availability && pnpm run test:v9:search && pnpm run test:v9:booking && pnpm run test:v9:insurance && pnpm run test:v9:videos && pnpm run build && node --test test/*.test.mjs",
|
|
91
91
|
"test:cli": "node --test src/cli/v9-hub-filters.test.ts",
|
|
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",
|
|
92
|
+
"test:v9:openapi": "node --test codegen/v9/php-record.test.ts src/legacy-v9/openapi/regions-response.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
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",
|