@v-office/website-sdk 3.4.0 → 3.4.2

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 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-BEL6ow0i.mjs";
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-RLFx7K1J.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.4.0";
20
+ var version = "3.4.2";
21
21
  //#endregion
22
22
  //#region src/cli/output.ts
23
23
  const toJson = (value) => Effect.try({
@@ -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
- * Only the empty array is reinterpreted. Everything else runs against
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) => Array.isArray(input) && input.length === 0 ? {} : 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
@@ -3773,7 +3782,7 @@ const GuestAppReservationDataResponseSchema = Schema.Struct({
3773
3782
  trackingId: Schema.optionalKey(Schema.String)
3774
3783
  });
3775
3784
  Schema.suspend(() => CheckoutPaymentDataSchema);
3776
- const LanguageMapSchema = PhpRecord(Schema.String);
3785
+ const LanguageMapSchema = PhpRecord(Schema.String, { nullAsMissing: true });
3777
3786
  const MessageFormValueSchema = Schema.NullOr(Schema.Union([
3778
3787
  Schema.String,
3779
3788
  Schema.Number,
@@ -6222,7 +6231,7 @@ const revokeV9InsurancePolicy = ({ policyNumber, booking, v1Client }) => Effect.
6222
6231
  //#region src/legacy-v9/live/quote.ts
6223
6232
  const loadQuoteRuntime = Effect.tryPromise({
6224
6233
  try: async () => {
6225
- return { toGuestQuote: (await import("./quote-Co8iWjF6.mjs")).toGuestQuote };
6234
+ return { toGuestQuote: (await import("./quote-Bbw_fcGm.mjs")).toGuestQuote };
6226
6235
  },
6227
6236
  catch: (cause) => new CoreSDKError({
6228
6237
  source: "v9",
@@ -6577,7 +6586,7 @@ const parseV9SearchCursor = (cursor) => Effect.gen(function* () {
6577
6586
  return page;
6578
6587
  });
6579
6588
  const loadV9SearchRuntime = Effect.tryPromise({
6580
- try: () => import("./search-6EvRB-i0.mjs"),
6589
+ try: () => import("./search-BNuWa0Vi.mjs"),
6581
6590
  catch: (cause) => new CoreSDKError({
6582
6591
  source: "v9",
6583
6592
  operation: "v9.search.runtime",
@@ -7499,7 +7508,7 @@ const orderRentalsById = ({ rentalIds, rentals, missing }) => {
7499
7508
  });
7500
7509
  };
7501
7510
  const loadV9RentalsRuntime = Effect.tryPromise({
7502
- try: () => import("./rentals-DVMCyGI9.mjs"),
7511
+ try: () => import("./rentals-CJKA1qK0.mjs"),
7503
7512
  catch: (cause) => new CoreSDKError({
7504
7513
  source: "v9",
7505
7514
  operation: "v9.rentals.runtime",
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-BEL6ow0i.mjs";
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-RLFx7K1J.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.4.2/CHANGELOG.md`: release notes for 3.4.2
8
+ - `versions/3.4.1/CHANGELOG.md`: release notes for 3.4.1
7
9
  - `versions/3.4.0/CHANGELOG.md`: release notes for 3.4.0
8
10
  - `versions/3.3.0/CHANGELOG.md`: release notes for 3.3.0
9
11
  - `versions/3.2.1/CHANGELOG.md`: release notes for 3.2.1
@@ -4,6 +4,8 @@
4
4
 
5
5
  Migration guides of `@v-office/website-sdk`, newest first. Apply them in order when skipping versions.
6
6
 
7
+ - `versions/3.4.2/MIGRATION.md`: Migration: 3.4.1 to 3.4.2
8
+ - `versions/3.4.1/MIGRATION.md`: Migration: 3.4.0 to 3.4.1
7
9
  - `versions/3.4.0/MIGRATION.md`: Migration: 3.3.0 to 3.4.0
8
10
  - `versions/3.3.0/MIGRATION.md`: Migration: 3.2.1 to 3.3.0
9
11
  - `versions/3.2.1/MIGRATION.md`: Migration: 3.2.0 to 3.2.1
@@ -0,0 +1,20 @@
1
+ # Changelog: 3.4.1
2
+
3
+ v9 additional services billed per day, week or month show the price the PMS bills per unit.
4
+ Totals already matched the PMS for per-day services and still do.
5
+
6
+ ## Changed
7
+
8
+ - v9: a service billed per week reads "10,00 € / Woche" (the weekly price) instead of the amount
9
+ for the whole stay without a unit. The line total after `addAdditionalService` is unchanged.
10
+ - v9: a service billed per month reads "… / Monat". Below 30 nights the PMS bills it nothing, and
11
+ `quote.additionalServices` leaves it out instead of offering it for free.
12
+
13
+ ## Fixed
14
+
15
+ - v9: a service billed per day showed its total divided by the nights, while the PMS bills it
16
+ for nights + 1 days. For 7 nights at 12,00 a day, `charge` read "13,71 … / Tag"; it now reads
17
+ "12,00 … / Tag", and the booking card sub-line "1 × 12,00 … / Tag". The line total stays 96,00.
18
+ - v9: a selected service billed per week or month went to the booking and into the ERGO
19
+ insurance value with the price of one week or month, whatever the stay. It now goes with
20
+ `price × amount × timespan`, the same total the booking card shows.
@@ -0,0 +1,9 @@
1
+ # Migration: 3.4.0 to 3.4.1
2
+
3
+ No changes required.
4
+
5
+ ## 1. Upgrade
6
+
7
+ ```sh
8
+ pnpm add @v-office/website-sdk@3.4.1
9
+ ```
@@ -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,9 @@
1
+ # Migration: 3.4.1 to 3.4.2
2
+
3
+ No changes required.
4
+
5
+ ## 1. Upgrade
6
+
7
+ ```sh
8
+ pnpm add @v-office/website-sdk@3.4.2
9
+ ```
@@ -1,36 +1,36 @@
1
1
  import { GuestQuote, GuestQuoteBookingCardDisplayOrder, addGuestQuoteAdditionalServiceSelection, formatCurrency, toNightCount } from "@v-office/sdk-core";
2
2
  import { DateTime, Effect } from "effect";
3
- //#region src/legacy-v9/parser/quote/to-additional-service-calculation.ts
4
- const toAdditionalServiceCalculation = (line) => {
5
- switch (line.calculation) {
6
- case "NIGHT": return "PER_NIGHT";
7
- case "DAY": return "PER_DAY";
8
- case "USAGE": return "PER_USAGE";
9
- case "FLAT": return "FLAT";
10
- default: return "FLAT";
11
- }
12
- };
13
- //#endregion
14
3
  //#region src/legacy-v9/parser/quote/to-charge.ts
15
4
  const toCharge = ({ serviceLine, chargeAmount, currency, locale, translations }) => Effect.gen(function* () {
16
5
  if (chargeAmount === 0) return yield* translations.translate(locale, "quote.additionalService.free");
17
6
  switch (serviceLine.calculation) {
18
7
  case "NIGHT": return `${formatCurrency(chargeAmount, locale, currency)}${yield* translations.translate(locale, "quote.additionalService.night")}`;
19
8
  case "DAY": return `${formatCurrency(chargeAmount, locale, currency)}${yield* translations.translate(locale, "quote.additionalService.day")}`;
9
+ case "WEEK": return `${formatCurrency(chargeAmount, locale, currency)}${yield* translations.translate(locale, "quote.additionalService.week")}`;
10
+ case "MONTH": return `${formatCurrency(chargeAmount, locale, currency)}${yield* translations.translate(locale, "quote.additionalService.month")}`;
20
11
  default: return formatCurrency(chargeAmount, locale, currency);
21
12
  }
22
13
  });
23
14
  //#endregion
15
+ //#region src/legacy-v9/parser/quote/to-charge-units.ts
16
+ const toChargeUnits = (line, input) => {
17
+ const nights = toNightCount(input.period);
18
+ switch (line.calculation) {
19
+ case "NIGHT": return line.timespan ?? nights;
20
+ case "DAY": return line.timespan ?? nights + 1;
21
+ case "WEEK": return line.timespan ?? nights / 7;
22
+ case "MONTH": return line.timespan ?? Math.floor(nights / 30);
23
+ default: return 1;
24
+ }
25
+ };
26
+ //#endregion
24
27
  //#region src/legacy-v9/parser/quote/to-charge-amount.ts
25
28
  const toChargeAmount = ({ input, serviceLine }) => {
26
29
  if (serviceLine.total == null) return void 0;
30
+ const units = toChargeUnits(serviceLine, input);
31
+ if (units <= 0) return void 0;
27
32
  const quantity = serviceLine.amount != null && serviceLine.amount > 0 ? serviceLine.amount : 1;
28
- switch (serviceLine.calculation) {
29
- case "NIGHT": return serviceLine.total / toNightCount(input.period) / quantity;
30
- case "DAY": return serviceLine.total / toNightCount(input.period) / quantity;
31
- case "USAGE": return serviceLine.total / quantity;
32
- default: return serviceLine.total / quantity;
33
- }
33
+ return serviceLine.total / quantity / units;
34
34
  };
35
35
  //#endregion
36
36
  //#region src/legacy-v9/parser/quote/to-service-line-label.ts
@@ -110,7 +110,7 @@ const toAdditionalServices = ({ input, guestQuoteResult, locale, translations })
110
110
  label,
111
111
  charge,
112
112
  chargeAmount,
113
- calculation: toAdditionalServiceCalculation(line),
113
+ chargeUnits: toChargeUnits(line, input),
114
114
  ...proposedQuantity === void 0 ? {} : { proposedQuantity },
115
115
  ...maxPerBooking === void 0 ? {} : { maxPerBooking },
116
116
  ...leadTimeDays === void 0 ? {} : { leadTimeDays },
@@ -123,33 +123,24 @@ const toAdditionalServices = ({ input, guestQuoteResult, locale, translations })
123
123
  //#endregion
124
124
  //#region src/legacy-v9/parser/quote/to-backend-context.ts
125
125
  const toSelectionQuantity = (selections, serviceId) => selections.find((selection) => selection.id === serviceId)?.quantity ?? 0;
126
- const toSelectedTotal = (line, amount) => {
127
- if (line.price == null) return void 0;
128
- switch (line.calculation) {
129
- case "NIGHT": return line.price * amount * (line.timespan ?? 1);
130
- case "DAY": return line.price * amount * (line.timespan ?? 1);
131
- case "PERC": return line.price * amount;
132
- case "USAGE": return line.price * amount;
133
- default: return line.price * amount;
134
- }
135
- };
136
- const withSelectedAmount = (line, selections) => {
126
+ const toSelectedTotal = (line, amount, input) => line.price == null ? void 0 : Math.round(line.price * amount * toChargeUnits(line, input));
127
+ const withSelectedAmount = (line, selections, input) => {
137
128
  const serviceId = getLineServiceId(line);
138
129
  if (serviceId === void 0) return line;
139
130
  const amount = toSelectionQuantity(selections, serviceId);
140
- const total = toSelectedTotal(line, amount);
131
+ const total = toSelectedTotal(line, amount, input);
141
132
  return {
142
133
  ...line,
143
134
  amount,
144
135
  ...total === void 0 ? {} : { total }
145
136
  };
146
137
  };
147
- const withSelectedServiceAmounts = (quote, selections) => {
138
+ const withSelectedServiceAmounts = (quote, selections, input) => {
148
139
  if (quote === void 0) return quote;
149
140
  return {
150
141
  ...quote,
151
- ...quote.optional === void 0 ? {} : { optional: quote.optional.map((line) => withSelectedAmount(line, selections)) },
152
- ...quote.onsiteOptional === void 0 ? {} : { onsiteOptional: quote.onsiteOptional.map((line) => withSelectedAmount(line, selections)) }
142
+ ...quote.optional === void 0 ? {} : { optional: quote.optional.map((line) => withSelectedAmount(line, selections, input)) },
143
+ ...quote.onsiteOptional === void 0 ? {} : { onsiteOptional: quote.onsiteOptional.map((line) => withSelectedAmount(line, selections, input)) }
153
144
  };
154
145
  };
155
146
  const toV9QuoteBackendContext = (input, guestQuoteResult) => ({
@@ -161,7 +152,7 @@ const updateV9QuoteBackendContext = (context, selections) => {
161
152
  if (context.backend !== "v9") return context;
162
153
  return {
163
154
  ...context,
164
- rawQuote: withSelectedServiceAmounts(context.rawQuote, selections)
155
+ rawQuote: withSelectedServiceAmounts(context.rawQuote, selections, context.input)
165
156
  };
166
157
  };
167
158
  //#endregion
@@ -1,4 +1,4 @@
1
- import { $t as V9_FACILITY_ATTRIBUTE_KEYS } from "./client-BEL6ow0i.mjs";
1
+ import { $t as V9_FACILITY_ATTRIBUTE_KEYS } from "./client-RLFx7K1J.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-BEL6ow0i.mjs";
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-RLFx7K1J.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";
@@ -4,6 +4,8 @@
4
4
  "quote.sections.tax": "Steuern & Abgaben",
5
5
  "quote.additionalService.day": " / Tag",
6
6
  "quote.additionalService.night": " / Nacht",
7
+ "quote.additionalService.week": " / Woche",
8
+ "quote.additionalService.month": " / Monat",
7
9
  "quote.additionalService.free": "kostenlos",
8
10
  "quote.status.unavailable.notBookable": "Nicht verfügbar",
9
11
  "quote.optionCombination.unavailable": "Diese Optionskombination ist nicht verfügbar.",
@@ -4,6 +4,8 @@
4
4
  "quote.sections.tax": "Taxes & Fees",
5
5
  "quote.additionalService.day": " / day",
6
6
  "quote.additionalService.night": " / night",
7
+ "quote.additionalService.week": " / week",
8
+ "quote.additionalService.month": " / month",
7
9
  "quote.additionalService.free": "free",
8
10
  "quote.status.unavailable.notBookable": "Not available",
9
11
  "quote.optionCombination.unavailable": "This option combination is unavailable.",
@@ -4,6 +4,8 @@
4
4
 
5
5
  Release notes of `@v-office/website-sdk`, newest first. Each version has its own directory.
6
6
 
7
+ - `versions/3.4.2/CHANGELOG.md`: release notes for 3.4.2
8
+ - `versions/3.4.1/CHANGELOG.md`: release notes for 3.4.1
7
9
  - `versions/3.4.0/CHANGELOG.md`: release notes for 3.4.0
8
10
  - `versions/3.3.0/CHANGELOG.md`: release notes for 3.3.0
9
11
  - `versions/3.2.1/CHANGELOG.md`: release notes for 3.2.1
@@ -4,6 +4,8 @@
4
4
 
5
5
  Migration guides of `@v-office/website-sdk`, newest first. Apply them in order when skipping versions.
6
6
 
7
+ - `versions/3.4.2/MIGRATION.md`: Migration: 3.4.1 to 3.4.2
8
+ - `versions/3.4.1/MIGRATION.md`: Migration: 3.4.0 to 3.4.1
7
9
  - `versions/3.4.0/MIGRATION.md`: Migration: 3.3.0 to 3.4.0
8
10
  - `versions/3.3.0/MIGRATION.md`: Migration: 3.2.1 to 3.3.0
9
11
  - `versions/3.2.1/MIGRATION.md`: Migration: 3.2.0 to 3.2.1
@@ -0,0 +1,20 @@
1
+ # Changelog: 3.4.1
2
+
3
+ v9 additional services billed per day, week or month show the price the PMS bills per unit.
4
+ Totals already matched the PMS for per-day services and still do.
5
+
6
+ ## Changed
7
+
8
+ - v9: a service billed per week reads "10,00 € / Woche" (the weekly price) instead of the amount
9
+ for the whole stay without a unit. The line total after `addAdditionalService` is unchanged.
10
+ - v9: a service billed per month reads "… / Monat". Below 30 nights the PMS bills it nothing, and
11
+ `quote.additionalServices` leaves it out instead of offering it for free.
12
+
13
+ ## Fixed
14
+
15
+ - v9: a service billed per day showed its total divided by the nights, while the PMS bills it
16
+ for nights + 1 days. For 7 nights at 12,00 a day, `charge` read "13,71 … / Tag"; it now reads
17
+ "12,00 … / Tag", and the booking card sub-line "1 × 12,00 … / Tag". The line total stays 96,00.
18
+ - v9: a selected service billed per week or month went to the booking and into the ERGO
19
+ insurance value with the price of one week or month, whatever the stay. It now goes with
20
+ `price × amount × timespan`, the same total the booking card shows.
@@ -0,0 +1,9 @@
1
+ # Migration: 3.4.0 to 3.4.1
2
+
3
+ No changes required.
4
+
5
+ ## 1. Upgrade
6
+
7
+ ```sh
8
+ pnpm add @v-office/website-sdk@3.4.1
9
+ ```
@@ -0,0 +1,3 @@
1
+ {
2
+ "componentsAffectedByHeadlessChange": []
3
+ }
@@ -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,9 @@
1
+ # Migration: 3.4.1 to 3.4.2
2
+
3
+ No changes required.
4
+
5
+ ## 1. Upgrade
6
+
7
+ ```sh
8
+ pnpm add @v-office/website-sdk@3.4.2
9
+ ```
@@ -0,0 +1,3 @@
1
+ {
2
+ "componentsAffectedByHeadlessChange": []
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v-office/website-sdk",
3
- "version": "3.4.0",
3
+ "version": "3.4.2",
4
4
  "description": "Website-facing SDK facade backed by @v-office/sdk-core",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@graphql-typed-document-node/core": "3.2.0",
51
- "@v-office/sdk-core": "1.32.0",
51
+ "@v-office/sdk-core": "1.32.1",
52
52
  "effect": "4.0.0-rc.115",
53
53
  "graphql": "17.0.2",
54
54
  "yaml": "^2.9.0"
@@ -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",