@v-office/website-sdk 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { n as defineCMSSDKOptions, t as createCMSSDKFromParsedConfig } from "./client-DYP0Y59i.mjs";
2
+ import { n as defineCMSSDKOptions, t as createCMSSDKFromParsedConfig } from "./client-DeEUMMOh.mjs";
3
3
  import { Console, Effect, FileSystem, Layer, Option, Path, Stdio, Terminal } from "effect";
4
4
  import { Command, Flag } from "effect/unstable/cli";
5
5
  import { inspect } from "node:util";
@@ -19373,7 +19373,7 @@ const bookV9Insurance = ({ quote, bookingNumber, guestToken, v1Client }) => Effe
19373
19373
  //#region src/adapters/v9/live/quote.ts
19374
19374
  const loadQuoteRuntime$1 = Effect.tryPromise({
19375
19375
  try: async () => {
19376
- return { toGuestQuote: (await import("./quote-Bo-gBDkQ.mjs")).toGuestQuote };
19376
+ return { toGuestQuote: (await import("./quote-DQGps4dy.mjs")).toGuestQuote };
19377
19377
  },
19378
19378
  catch: (cause) => new CMSError({
19379
19379
  backend: "v9",
@@ -23133,7 +23133,7 @@ const parseV9SearchCursor = (cursor) => Effect.gen(function* () {
23133
23133
  });
23134
23134
  const loadLiveSearchRuntime$1 = Effect.tryPromise({
23135
23135
  try: async () => {
23136
- const [operations, parser] = await Promise.all([import("./operations-Bxhb0jmN.mjs"), import("./search-BofxXqF0.mjs")]);
23136
+ const [operations, parser] = await Promise.all([import("./operations-DcU1qt7g.mjs"), import("./search-BuR5apFw.mjs")]);
23137
23137
  return {
23138
23138
  searchQuery: operations.searchQuery,
23139
23139
  toQueryInput: parser.toQueryInput,
@@ -23188,6 +23188,7 @@ const makeV9LiveSearchLive = (config, options) => Layer.effect(LiveSearchService
23188
23188
  const isExactPeriodMatch = alternatives === null;
23189
23189
  const item = yield* toSearchOutputItem({
23190
23190
  locale: input.locale,
23191
+ imageProxyBaseUrl: config.imageProxyBaseUrl,
23191
23192
  rentalHighlightPrioritization,
23192
23193
  customAttributeFilterDefinitions: customAttributeDefinitions,
23193
23194
  rental,
@@ -23534,7 +23535,7 @@ const DEFAULT_RENTAL_FEEDBACK_DATA_ATTRIBUTES = [
23534
23535
  ];
23535
23536
  const loadStaticRentalsRuntime$1 = Effect.tryPromise({
23536
23537
  try: async () => {
23537
- const [operations, parser] = await Promise.all([import("./operations-Bxhb0jmN.mjs"), import("./rentals-Ba6ZO6bX.mjs")]);
23538
+ const [operations, parser] = await Promise.all([import("./operations-DcU1qt7g.mjs"), import("./rentals-plxPVx83.mjs")]);
23538
23539
  return {
23539
23540
  rentalsAllQuery: operations.rentalsAllQuery,
23540
23541
  toRentalRentalsOutput: parser.toRentalRentalsOutput
@@ -24056,7 +24057,7 @@ const V10LiveContactLive = Layer.effect(LiveContactService, Effect.gen(function*
24056
24057
  //#region src/adapters/v10/live/quote.ts
24057
24058
  const loadQuoteRuntime = Effect.tryPromise({
24058
24059
  try: async () => {
24059
- const [operations, parser] = await Promise.all([import("./operations-B4IgNB3E.mjs"), import("./quote-BKcAIFuH.mjs")]);
24060
+ const [operations, parser] = await Promise.all([import("./operations-B4IgNB3E.mjs"), import("./quote-BVx3TAHE.mjs")]);
24060
24061
  return {
24061
24062
  bookingsGuestQuoteQuery: operations.bookingsGuestQuoteQuery,
24062
24063
  bookingsMultiRateContextQuery: operations.bookingsMultiRateContextQuery,
@@ -33046,7 +33047,7 @@ const makeV10StaticFilterLive = ({ options }) => Layer.effect(StaticFilterServic
33046
33047
  const ONLINE_RENTALS_FILTER = { status: { _eq: "ONLINE" } };
33047
33048
  const loadStaticRentalsRuntime = Effect.tryPromise({
33048
33049
  try: async () => {
33049
- const [operations, parser] = await Promise.all([import("./operations-B4IgNB3E.mjs"), import("./rentals-DBTPlC6X.mjs")]);
33050
+ const [operations, parser] = await Promise.all([import("./operations-B4IgNB3E.mjs"), import("./rentals-H3RYtMqT.mjs")]);
33050
33051
  return {
33051
33052
  customAttributesListCustomAttributesQuery: operations.customAttributesListCustomAttributesQuery,
33052
33053
  rentalsListRentalSummaryQuery: operations.rentalsListRentalSummaryQuery,
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as DocumentResourceSchema, $t as toStableSearchInputParameterValues, At as ServiceImageSchema, B as makeV0OpenApiClientFetchLive, Bt as UnitIdsResponseSchema, Ct as QuoteServiceSchema, Dt as RoomImageSchema, Et as RegionListResponseSchema, Ft as TileCollectionResponseSchema, G as makeV1OpenApiClientLive, Gt as UnitServicePriceSchema, H as V1OpenApiClient, Ht as UnitListResponseSchema, It as TileSchema, J as CalendarResponseSchema, Jt as VideoResponseSchema, K as ApiEnvelopeBaseSchema, Kt as V1_BASE_URL, Lt as TileTagSchema, Mt as ServiceListResponseSchema, Nt as SetupDataSchema, Ot as SearchPropertiesResponseSchema, Pt as SetupResponseSchema, Q as DocumentResourceResponseSchema, R as V0OpenApiClient, Rt as TravelInsuranceBookingSchema, St as QuoteSchema, Tt as RawVofficeObjectSchema, U as V1OpenApiClientError, Ut as UnitOfferSchema, V as makeV0OpenApiClientLive, Vt as UnitListItemSchema, W as makeV1OpenApiClientFetchLive, Wt as UnitResponseSchema, X as CustomerUnitSummarySchema, Y as CurrentMemberResponseSchema, Yt as decodeV1OperationResponse, Z as DocumentCollectionResponseSchema, Zt as defineStableSearchInputGroup, _t as PaymentScheduleItemSchema, a as defineVofficeFacilityDataAttributes, at as ErgoBankSchema, bt as QuotePricesPayloadSchema, c as defineVofficeOfferDataAttributes, ct as ErgoCreatePreContractRequestSchema, d as defineVofficeServiceDataAttributes, dt as ErgoPolicyNumberRequestSchema, en as toStableSearchInputQueryKeys, et as DocumentStatusSchema, f as defineVofficeTotalRatingDataAttributes, ft as ErgoReadPreContractRequestSchema, gt as OnOfficeUnitSchema, ht as OnOfficeUnitCollectionResponseSchema, i as defineDataAttributes, it as ErgoAddressSchema, jt as ServiceLimitSchema, kt as ServiceBeonDataSchema, l as defineVofficePriceDataAttributes, lt as ErgoPersonSchema, mt as FacilityListResponseSchema, n as defineCMSSDKOptions, nt as DocumentSummarySchema, o as defineVofficeFeedbackDataAttributes, ot as ErgoBookRequestSchema, p as defineVofficeUnitDataAttributes, pt as ErgoTripAndCustomerRequestSchema, q as CalendarDaySchema, qt as V1_OPERATIONS, r as customDataAttribute, rt as DocumentTypeSchema, s as defineVofficeImageDataAttributes, st as ErgoCommonFieldsSchema, t as createCMSSDKFromParsedConfig, tt as DocumentStatusUpdateRequestSchema, u as defineVofficeRatingDataAttributes, ut as ErgoPlanSearchRequestSchema, vt as PaymentScheduleSchema, wt as RawObjectResponseSchema, xt as QuotePricesResponseSchema, yt as QuoteLineSchema, z as V0OpenApiClientError, zt as TravelInsuranceBookingStoreRequestSchema } from "./client-DYP0Y59i.mjs";
1
+ import { $ as DocumentResourceSchema, $t as toStableSearchInputParameterValues, At as ServiceImageSchema, B as makeV0OpenApiClientFetchLive, Bt as UnitIdsResponseSchema, Ct as QuoteServiceSchema, Dt as RoomImageSchema, Et as RegionListResponseSchema, Ft as TileCollectionResponseSchema, G as makeV1OpenApiClientLive, Gt as UnitServicePriceSchema, H as V1OpenApiClient, Ht as UnitListResponseSchema, It as TileSchema, J as CalendarResponseSchema, Jt as VideoResponseSchema, K as ApiEnvelopeBaseSchema, Kt as V1_BASE_URL, Lt as TileTagSchema, Mt as ServiceListResponseSchema, Nt as SetupDataSchema, Ot as SearchPropertiesResponseSchema, Pt as SetupResponseSchema, Q as DocumentResourceResponseSchema, R as V0OpenApiClient, Rt as TravelInsuranceBookingSchema, St as QuoteSchema, Tt as RawVofficeObjectSchema, U as V1OpenApiClientError, Ut as UnitOfferSchema, V as makeV0OpenApiClientLive, Vt as UnitListItemSchema, W as makeV1OpenApiClientFetchLive, Wt as UnitResponseSchema, X as CustomerUnitSummarySchema, Y as CurrentMemberResponseSchema, Yt as decodeV1OperationResponse, Z as DocumentCollectionResponseSchema, Zt as defineStableSearchInputGroup, _t as PaymentScheduleItemSchema, a as defineVofficeFacilityDataAttributes, at as ErgoBankSchema, bt as QuotePricesPayloadSchema, c as defineVofficeOfferDataAttributes, ct as ErgoCreatePreContractRequestSchema, d as defineVofficeServiceDataAttributes, dt as ErgoPolicyNumberRequestSchema, en as toStableSearchInputQueryKeys, et as DocumentStatusSchema, f as defineVofficeTotalRatingDataAttributes, ft as ErgoReadPreContractRequestSchema, gt as OnOfficeUnitSchema, ht as OnOfficeUnitCollectionResponseSchema, i as defineDataAttributes, it as ErgoAddressSchema, jt as ServiceLimitSchema, kt as ServiceBeonDataSchema, l as defineVofficePriceDataAttributes, lt as ErgoPersonSchema, mt as FacilityListResponseSchema, n as defineCMSSDKOptions, nt as DocumentSummarySchema, o as defineVofficeFeedbackDataAttributes, ot as ErgoBookRequestSchema, p as defineVofficeUnitDataAttributes, pt as ErgoTripAndCustomerRequestSchema, q as CalendarDaySchema, qt as V1_OPERATIONS, r as customDataAttribute, rt as DocumentTypeSchema, s as defineVofficeImageDataAttributes, st as ErgoCommonFieldsSchema, t as createCMSSDKFromParsedConfig, tt as DocumentStatusUpdateRequestSchema, u as defineVofficeRatingDataAttributes, ut as ErgoPlanSearchRequestSchema, vt as PaymentScheduleSchema, wt as RawObjectResponseSchema, xt as QuotePricesResponseSchema, yt as QuoteLineSchema, z as V0OpenApiClientError, zt as TravelInsuranceBookingStoreRequestSchema } from "./client-DeEUMMOh.mjs";
2
2
  import { t as CMSError } from "./errors-2cuUGSvi.mjs";
3
3
  import { D as UnknownAdditionalService, E as InvalidAdditionalServiceQuantity, w as AdditionalServiceLimitExceeded } from "./quote-CRjV_lf-.mjs";
4
4
  export { AdditionalServiceLimitExceeded, ApiEnvelopeBaseSchema, CMSError, CalendarDaySchema, CalendarResponseSchema, CurrentMemberResponseSchema, CustomerUnitSummarySchema, DocumentCollectionResponseSchema, DocumentResourceResponseSchema, DocumentResourceSchema, DocumentStatusSchema, DocumentStatusUpdateRequestSchema, DocumentSummarySchema, DocumentTypeSchema, ErgoAddressSchema, ErgoBankSchema, ErgoBookRequestSchema, ErgoCommonFieldsSchema, ErgoCreatePreContractRequestSchema, ErgoPersonSchema, ErgoPlanSearchRequestSchema, ErgoPolicyNumberRequestSchema, ErgoReadPreContractRequestSchema, ErgoTripAndCustomerRequestSchema, FacilityListResponseSchema, InvalidAdditionalServiceQuantity, OnOfficeUnitCollectionResponseSchema, OnOfficeUnitSchema, PaymentScheduleItemSchema, PaymentScheduleSchema, QuoteLineSchema, QuotePricesPayloadSchema, QuotePricesResponseSchema, QuoteSchema, QuoteServiceSchema, RawObjectResponseSchema, RawVofficeObjectSchema, RegionListResponseSchema, RoomImageSchema, SearchPropertiesResponseSchema, ServiceBeonDataSchema, ServiceImageSchema, ServiceLimitSchema, ServiceListResponseSchema, SetupDataSchema, SetupResponseSchema, TileCollectionResponseSchema, TileSchema, TileTagSchema, TravelInsuranceBookingSchema, TravelInsuranceBookingStoreRequestSchema, UnitIdsResponseSchema, UnitListItemSchema, UnitListResponseSchema, UnitOfferSchema, UnitResponseSchema, UnitServicePriceSchema, UnknownAdditionalService, V0OpenApiClient, V0OpenApiClientError, V1OpenApiClient, V1OpenApiClientError, V1_BASE_URL, V1_OPERATIONS, VideoResponseSchema, createCMSSDKFromParsedConfig, customDataAttribute, decodeV1OperationResponse, defineCMSSDKOptions, defineDataAttributes, defineStableSearchInputGroup, defineVofficeFacilityDataAttributes, defineVofficeFeedbackDataAttributes, defineVofficeImageDataAttributes, defineVofficeOfferDataAttributes, defineVofficePriceDataAttributes, defineVofficeRatingDataAttributes, defineVofficeServiceDataAttributes, defineVofficeTotalRatingDataAttributes, defineVofficeUnitDataAttributes, makeV0OpenApiClientFetchLive, makeV0OpenApiClientLive, makeV1OpenApiClientFetchLive, makeV1OpenApiClientLive, toStableSearchInputParameterValues, toStableSearchInputQueryKeys };
@@ -505,7 +505,7 @@ const documents = {
505
505
  }
506
506
  }]
507
507
  },
508
- "\n query CMSSDK_Search(\n $first: Int!\n $page: Int\n $language: String\n $vofficeData: VofficeData\n $basicQueryInputs: [BasicQueryInput!]\n $dataAttributes: [String!]! = []\n ) {\n search(\n first: $first\n page: $page\n language: $language\n voffice: $vofficeData\n data: $basicQueryInputs\n ) {\n paginatorInfo {\n hasMorePages\n currentPage\n }\n data {\n voffice_id\n voffice_images {\n path\n title\n }\n additional_voffice_data {\n alternatives {\n fromdate\n tilldate\n calc {\n total\n rent\n summary\n oTotal\n oRent\n oSummary\n discountName\n }\n }\n calc {\n total\n rent\n summary\n oTotal\n oRent\n oSummary\n discountName\n }\n }\n data(attributes: $dataAttributes)\n }\n }\n }\n": {
508
+ "\n query CMSSDK_Search(\n $first: Int!\n $page: Int\n $language: String\n $vofficeData: VofficeData\n $basicQueryInputs: [BasicQueryInput!]\n $dataAttributes: [String!]! = []\n ) {\n search(\n first: $first\n page: $page\n language: $language\n voffice: $vofficeData\n data: $basicQueryInputs\n ) {\n paginatorInfo {\n hasMorePages\n currentPage\n }\n data {\n voffice_id\n voffice_images {\n id\n path\n title\n description\n }\n voffice_room_images {\n id\n path\n name\n title\n description\n }\n additional_voffice_data {\n alternatives {\n fromdate\n tilldate\n calc {\n total\n rent\n summary\n oTotal\n oRent\n oSummary\n discountName\n }\n }\n calc {\n total\n rent\n summary\n oTotal\n oRent\n oSummary\n discountName\n }\n }\n data(attributes: $dataAttributes)\n }\n }\n }\n": {
509
509
  kind: "Document",
510
510
  definitions: [{
511
511
  kind: "OperationDefinition",
@@ -768,19 +768,83 @@ const documents = {
768
768
  },
769
769
  selectionSet: {
770
770
  kind: "SelectionSet",
771
- selections: [{
772
- kind: "Field",
773
- name: {
774
- kind: "Name",
775
- value: "path"
771
+ selections: [
772
+ {
773
+ kind: "Field",
774
+ name: {
775
+ kind: "Name",
776
+ value: "id"
777
+ }
778
+ },
779
+ {
780
+ kind: "Field",
781
+ name: {
782
+ kind: "Name",
783
+ value: "path"
784
+ }
785
+ },
786
+ {
787
+ kind: "Field",
788
+ name: {
789
+ kind: "Name",
790
+ value: "title"
791
+ }
792
+ },
793
+ {
794
+ kind: "Field",
795
+ name: {
796
+ kind: "Name",
797
+ value: "description"
798
+ }
776
799
  }
777
- }, {
778
- kind: "Field",
779
- name: {
780
- kind: "Name",
781
- value: "title"
800
+ ]
801
+ }
802
+ },
803
+ {
804
+ kind: "Field",
805
+ name: {
806
+ kind: "Name",
807
+ value: "voffice_room_images"
808
+ },
809
+ selectionSet: {
810
+ kind: "SelectionSet",
811
+ selections: [
812
+ {
813
+ kind: "Field",
814
+ name: {
815
+ kind: "Name",
816
+ value: "id"
817
+ }
818
+ },
819
+ {
820
+ kind: "Field",
821
+ name: {
822
+ kind: "Name",
823
+ value: "path"
824
+ }
825
+ },
826
+ {
827
+ kind: "Field",
828
+ name: {
829
+ kind: "Name",
830
+ value: "name"
831
+ }
832
+ },
833
+ {
834
+ kind: "Field",
835
+ name: {
836
+ kind: "Name",
837
+ value: "title"
838
+ }
839
+ },
840
+ {
841
+ kind: "Field",
842
+ name: {
843
+ kind: "Name",
844
+ value: "description"
845
+ }
782
846
  }
783
- }]
847
+ ]
784
848
  }
785
849
  },
786
850
  {
@@ -1049,8 +1113,17 @@ const searchQuery = graphql(`
1049
1113
  data {
1050
1114
  voffice_id
1051
1115
  voffice_images {
1116
+ id
1117
+ path
1118
+ title
1119
+ description
1120
+ }
1121
+ voffice_room_images {
1122
+ id
1052
1123
  path
1124
+ name
1053
1125
  title
1126
+ description
1054
1127
  }
1055
1128
  additional_voffice_data {
1056
1129
  alternatives {
@@ -1,4 +1,4 @@
1
- import "./client-DYP0Y59i.mjs";
1
+ import "./client-DeEUMMOh.mjs";
2
2
  import "./errors-2cuUGSvi.mjs";
3
3
  import { b as localeToLanguage, d as formatCurrency, g as toNightCount, n as addGuestQuoteAdditionalServiceSelection, t as GuestQuote } from "./quote-CRjV_lf-.mjs";
4
4
  import { DateTime, Effect } from "effect";
@@ -1,4 +1,4 @@
1
- import "./client-DYP0Y59i.mjs";
1
+ import "./client-DeEUMMOh.mjs";
2
2
  import { d as formatCurrency, g as toNightCount, n as addGuestQuoteAdditionalServiceSelection, t as GuestQuote } from "./quote-CRjV_lf-.mjs";
3
3
  import { DateTime, Effect } from "effect";
4
4
  //#region src/adapters/v9/parser/quote/to-additional-service-calculation.ts
@@ -1,4 +1,4 @@
1
- import { S as toAddress, _ as GENERATED_RENTAL_METADATA_CATALOG, b as toLocation, g as toRentalHighlights, h as toRentalType, m as toScope, v as toProperty, x as toImages, y as toDescription } from "./client-DYP0Y59i.mjs";
1
+ import { S as toAddress, _ as GENERATED_RENTAL_METADATA_CATALOG, b as toLocation, g as toRentalHighlights, h as toRentalType, m as toScope, v as toProperty, x as toImages, y as toDescription } from "./client-DeEUMMOh.mjs";
2
2
  import "./errors-2cuUGSvi.mjs";
3
3
  import { b as localeToLanguage, y as makeTranslate } from "./quote-CRjV_lf-.mjs";
4
4
  import { t as renderCustomAttributeHighlight } from "./custom-attribute-D5Kb1YHA.mjs";
@@ -1,8 +1,8 @@
1
- import { F as parseVofficeFacilityData, I as parseVofficeFeedbackData, L as parseVofficeUnitData, M as VofficeUnitDataPropertyCategoryLabelKeys, N as VofficeUnitDataPropertyCategoryValues, P as VofficeUnitDataPropertyMetadata } from "./client-DYP0Y59i.mjs";
1
+ import { F as parseVofficeFacilityData, I as parseVofficeFeedbackData, L as parseVofficeUnitData, M as VofficeUnitDataPropertyCategoryLabelKeys, N as VofficeUnitDataPropertyCategoryValues, P as VofficeUnitDataPropertyMetadata } from "./client-DeEUMMOh.mjs";
2
2
  import "./errors-2cuUGSvi.mjs";
3
3
  import { b as localeToLanguage, y as makeTranslate } from "./quote-CRjV_lf-.mjs";
4
4
  import { i as renderLabeledAttributeValue, t as renderCustomAttributeHighlight } from "./custom-attribute-D5Kb1YHA.mjs";
5
- import { n as toAddress, r as toLocalizedString, t as toRentalHighlights } from "./to-rental-highlights-BShYK50C.mjs";
5
+ import { i as toLocalizedString, n as toImages, r as toAddress, t as toRentalHighlights } from "./to-rental-highlights-CAATPqan.mjs";
6
6
  import { Effect } from "effect";
7
7
  //#region src/adapters/v9/parser/rentals/to-description.ts
8
8
  const toDescription = (data, locale) => {
@@ -26,128 +26,6 @@ const toDescription = (data, locale) => {
26
26
  return description;
27
27
  };
28
28
  //#endregion
29
- //#region src/adapters/v9/parser/rentals/to-image.ts
30
- const IMAGE_ASPECT_RATIO = 3 / 2;
31
- const IMAGE_SRCSET_WIDTHS = [
32
- 320,
33
- 480,
34
- 640,
35
- 960,
36
- 1280,
37
- 1920,
38
- 2560
39
- ];
40
- const IMAGE_DEFAULT_WIDTH = 960;
41
- const buildImageUrl = (imageProxyBaseUrl, path, width) => {
42
- const base = imageProxyBaseUrl.replace(/\/$/, "");
43
- const normalizedPath = path.replace(/^\/+/, "");
44
- return `${base}/_/rs:fill:${width}:${Math.round(width / IMAGE_ASPECT_RATIO)}:0/plain/${normalizedPath}`;
45
- };
46
- const buildSrcset = (imageProxyBaseUrl, path) => IMAGE_SRCSET_WIDTHS.map((width) => `${buildImageUrl(imageProxyBaseUrl, path, width)} ${width}w`).join(", ");
47
- const isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
48
- const toDataImageId = (dataImage) => dataImage?.id?.toString();
49
- const getImagePath = (entry) => entry.image?.path ?? entry.normalizedPath;
50
- const getFileName = (path) => path?.split("/").at(-1);
51
- const getDirectoryName = (path) => {
52
- const lastSlashIndex = path.lastIndexOf("/");
53
- return lastSlashIndex === -1 ? void 0 : path.slice(0, lastSlashIndex);
54
- };
55
- const stripDataImageFilePrefix = (fileName) => fileName.replace(/^mf(?=\d)/i, "");
56
- const getDataImageFileName = (dataImage) => {
57
- const name = dataImage.name != null ? stripDataImageFilePrefix(dataImage.name) : void 0;
58
- if (name != null) return name;
59
- return dataImage.id != null ? `${dataImage.id}.jpg` : void 0;
60
- };
61
- const normalizeDataImagePath = (dataImage, vofficeImages) => {
62
- const fileName = getDataImageFileName(dataImage);
63
- if (fileName == null) return void 0;
64
- const matchingPath = vofficeImages.find((image) => getFileName(image.path ?? void 0) === fileName)?.path;
65
- if (matchingPath != null) return matchingPath;
66
- const directoryName = vofficeImages.map((image) => image.path != null ? getDirectoryName(image.path) : void 0).find((path) => path != null);
67
- return directoryName != null ? `${directoryName}/${fileName}` : void 0;
68
- };
69
- const pathMatchesName = (path, name) => path != null && name != null && (path === name || path.endsWith(`/${name}`));
70
- const entriesShareId = (left, right) => {
71
- const leftIds = [left.image?.id, toDataImageId(left.dataImage)].filter(isNonEmptyString);
72
- const rightIds = [right.image?.id, toDataImageId(right.dataImage)].filter(isNonEmptyString);
73
- return leftIds.some((leftId) => rightIds.includes(leftId));
74
- };
75
- const entriesSharePathOrName = (left, right) => {
76
- const leftPath = getImagePath(left);
77
- const rightPath = getImagePath(right);
78
- const leftName = left.dataImage != null ? getDataImageFileName(left.dataImage) : getFileName(left.image?.path ?? void 0);
79
- const rightName = right.dataImage != null ? getDataImageFileName(right.dataImage) : getFileName(right.image?.path ?? void 0);
80
- return leftPath != null && rightPath != null && leftPath === rightPath || pathMatchesName(leftPath, rightName) || pathMatchesName(rightPath, leftName);
81
- };
82
- const entriesMatch = (left, right) => entriesShareId(left, right) || entriesSharePathOrName(left, right);
83
- const mergeEntry = (existing, next) => {
84
- const image = existing.image ?? next.image;
85
- const dataImage = existing.dataImage ?? next.dataImage;
86
- const normalizedPath = existing.normalizedPath ?? next.normalizedPath;
87
- const entry = { source: existing.source };
88
- if (image != null) entry.image = image;
89
- if (dataImage != null) entry.dataImage = dataImage;
90
- if (normalizedPath != null) entry.normalizedPath = normalizedPath;
91
- return entry;
92
- };
93
- const mergeImageEntries = (entries) => {
94
- const merged = [];
95
- for (const entry of entries) {
96
- const index = merged.findIndex((existing) => entriesMatch(existing, entry));
97
- if (index === -1) {
98
- merged.push(entry);
99
- continue;
100
- }
101
- merged[index] = mergeEntry(merged[index], entry);
102
- }
103
- return merged;
104
- };
105
- const getImageEntries = (rental, data) => {
106
- const vofficeImages = rental.voffice_images ?? [];
107
- return [
108
- ...vofficeImages.map((image) => ({
109
- source: "voffice_images",
110
- image
111
- })),
112
- ...(rental.voffice_room_images ?? []).map((image) => ({
113
- source: "voffice_room_images",
114
- image
115
- })),
116
- ...(data.known.images ?? []).flatMap((dataImage) => {
117
- const normalizedPath = normalizeDataImagePath(dataImage, vofficeImages);
118
- if (normalizedPath == null) return [];
119
- return [{
120
- source: "data_images",
121
- dataImage,
122
- normalizedPath
123
- }];
124
- })
125
- ];
126
- };
127
- const toImage = (imageProxyBaseUrl, entry, locale) => {
128
- const path = getImagePath(entry);
129
- const src = path != null ? buildImageUrl(imageProxyBaseUrl, path, IMAGE_DEFAULT_WIDTH) : "";
130
- const srcset = path != null ? buildSrcset(imageProxyBaseUrl, path) : "";
131
- const title = toLocalizedString(entry.dataImage?.titles, locale) ?? entry.image?.title;
132
- const alt = title ?? entry.image?.description ?? "";
133
- const metadata = { source: entry.source };
134
- if (entry.dataImage != null) metadata.dataImage = entry.dataImage;
135
- const image = {
136
- idOrPath: path ?? toDataImageId(entry.dataImage) ?? entry.dataImage?.name ?? "",
137
- src,
138
- srcset,
139
- alt,
140
- metadata
141
- };
142
- if (title != null) image.title = title;
143
- if (entry.dataImage?.tag != null) image.category = entry.dataImage.tag;
144
- return image;
145
- };
146
- const toImages = (imageProxyBaseUrl, rental, locale, data) => {
147
- if (rental.voffice_images == null || rental.voffice_images.length === 0) return [];
148
- return mergeImageEntries(getImageEntries(rental, data)).map((entry) => toImage(imageProxyBaseUrl, entry, locale));
149
- };
150
- //#endregion
151
29
  //#region src/adapters/v9/parser/rentals/to-location.ts
152
30
  const toLocation = (location) => {
153
31
  if (location == null) return void 0;
@@ -1,7 +1,7 @@
1
- import { $t as toStableSearchInputParameterValues, A as toUnusedFilterKeys, C as parseChildrenAges, D as parseQueryParameters, E as collectQueryParameters, L as parseVofficeUnitData, O as expandCustomAttributeFilterCompositions, Qt as toStableSearchInputBackendQueryKeys, T as toQueryString, Xt as STABLE_SEARCH_INPUTS, en as toStableSearchInputQueryKeys, j as stable_filters_default, k as toCustomAttributeFilterLabel, w as parseOccupancyCount } from "./client-DYP0Y59i.mjs";
1
+ import { $t as toStableSearchInputParameterValues, A as toUnusedFilterKeys, C as parseChildrenAges, D as parseQueryParameters, E as collectQueryParameters, L as parseVofficeUnitData, O as expandCustomAttributeFilterCompositions, Qt as toStableSearchInputBackendQueryKeys, T as toQueryString, Xt as STABLE_SEARCH_INPUTS, en as toStableSearchInputQueryKeys, j as stable_filters_default, k as toCustomAttributeFilterLabel, w as parseOccupancyCount } from "./client-DeEUMMOh.mjs";
2
2
  import { t as CMSError } from "./errors-2cuUGSvi.mjs";
3
3
  import { C as daysBetweenLocalDates, _ as toFormattedSearchPrice, x as toIsoDateFromPeriodQueryDate } from "./quote-CRjV_lf-.mjs";
4
- import { n as toAddress, t as toRentalHighlights } from "./to-rental-highlights-BShYK50C.mjs";
4
+ import { n as toImages, r as toAddress, t as toRentalHighlights } from "./to-rental-highlights-CAATPqan.mjs";
5
5
  import { Effect } from "effect";
6
6
  //#region src/adapters/v9/parser/search/input/filter/apply-voffice-filter-derived-basic-query-inputs.ts
7
7
  const hasBasicQueryInput = ({ basicQueryInputs, key }) => basicQueryInputs.some((input) => input.key === key);
@@ -337,7 +337,7 @@ const toFormattedPrice = ({ locale, calc }) => {
337
337
  };
338
338
  //#endregion
339
339
  //#region src/adapters/v9/parser/search/to-search-output-item.ts
340
- const toSearchOutputItem = ({ locale, rentalHighlightPrioritization, customAttributeFilterDefinitions, rental, translations, includeFormattedTotal }) => Effect.gen(function* () {
340
+ const toSearchOutputItem = ({ locale, imageProxyBaseUrl, rentalHighlightPrioritization, customAttributeFilterDefinitions, rental, translations, includeFormattedTotal }) => Effect.gen(function* () {
341
341
  const data = parseVofficeUnitData(rental.data);
342
342
  const item = {
343
343
  id: rental.voffice_id.toString(),
@@ -346,6 +346,8 @@ const toSearchOutputItem = ({ locale, rentalHighlightPrioritization, customAttri
346
346
  };
347
347
  const address = toAddress(data, locale);
348
348
  if (Object.keys(address).length > 0) item.address = address;
349
+ const images = toImages(imageProxyBaseUrl, rental, locale, data);
350
+ if (images.length > 0) item.images = images;
349
351
  const highlights = yield* toRentalHighlights({
350
352
  locale,
351
353
  translations,
@@ -1,13 +1,13 @@
1
- import { P as VofficeUnitDataPropertyMetadata } from "./client-DYP0Y59i.mjs";
1
+ import { P as VofficeUnitDataPropertyMetadata } from "./client-DeEUMMOh.mjs";
2
2
  import "./errors-2cuUGSvi.mjs";
3
3
  import { b as localeToLanguage, v as toCountry, y as makeTranslate } from "./quote-CRjV_lf-.mjs";
4
4
  import { i as renderLabeledAttributeValue, t as renderCustomAttributeHighlight } from "./custom-attribute-D5Kb1YHA.mjs";
5
5
  import { Effect } from "effect";
6
6
  //#region src/adapters/v9/parser/rentals/to-localized-string.ts
7
- const isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
7
+ const isNonEmptyString$1 = (value) => typeof value === "string" && value.length > 0;
8
8
  const isRecord = (value) => typeof value === "object" && value !== null;
9
9
  const toLocalizedString = (value, locale) => {
10
- if (isNonEmptyString(value)) return value;
10
+ if (isNonEmptyString$1(value)) return value;
11
11
  if (!isRecord(value)) return void 0;
12
12
  const preferredKeys = [
13
13
  locale,
@@ -16,9 +16,9 @@ const toLocalizedString = (value, locale) => {
16
16
  ];
17
17
  for (const key of preferredKeys) {
18
18
  const localizedValue = value[key];
19
- if (isNonEmptyString(localizedValue)) return localizedValue;
19
+ if (isNonEmptyString$1(localizedValue)) return localizedValue;
20
20
  }
21
- return Object.values(value).find(isNonEmptyString);
21
+ return Object.values(value).find(isNonEmptyString$1);
22
22
  };
23
23
  //#endregion
24
24
  //#region src/adapters/v9/parser/rentals/to-address.ts
@@ -38,6 +38,128 @@ const toAddress = (data, locale) => {
38
38
  return address;
39
39
  };
40
40
  //#endregion
41
+ //#region src/adapters/v9/parser/rentals/to-image.ts
42
+ const IMAGE_ASPECT_RATIO = 3 / 2;
43
+ const IMAGE_SRCSET_WIDTHS = [
44
+ 320,
45
+ 480,
46
+ 640,
47
+ 960,
48
+ 1280,
49
+ 1920,
50
+ 2560
51
+ ];
52
+ const IMAGE_DEFAULT_WIDTH = 960;
53
+ const buildImageUrl = (imageProxyBaseUrl, path, width) => {
54
+ const base = imageProxyBaseUrl.replace(/\/$/, "");
55
+ const normalizedPath = path.replace(/^\/+/, "");
56
+ return `${base}/_/rs:fill:${width}:${Math.round(width / IMAGE_ASPECT_RATIO)}:0/plain/${normalizedPath}`;
57
+ };
58
+ const buildSrcset = (imageProxyBaseUrl, path) => IMAGE_SRCSET_WIDTHS.map((width) => `${buildImageUrl(imageProxyBaseUrl, path, width)} ${width}w`).join(", ");
59
+ const isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
60
+ const toDataImageId = (dataImage) => dataImage?.id?.toString();
61
+ const getImagePath = (entry) => entry.image?.path ?? entry.normalizedPath;
62
+ const getFileName = (path) => path?.split("/").at(-1);
63
+ const getDirectoryName = (path) => {
64
+ const lastSlashIndex = path.lastIndexOf("/");
65
+ return lastSlashIndex === -1 ? void 0 : path.slice(0, lastSlashIndex);
66
+ };
67
+ const stripDataImageFilePrefix = (fileName) => fileName.replace(/^mf(?=\d)/i, "");
68
+ const getDataImageFileName = (dataImage) => {
69
+ const name = dataImage.name != null ? stripDataImageFilePrefix(dataImage.name) : void 0;
70
+ if (name != null) return name;
71
+ return dataImage.id != null ? `${dataImage.id}.jpg` : void 0;
72
+ };
73
+ const normalizeDataImagePath = (dataImage, vofficeImages) => {
74
+ const fileName = getDataImageFileName(dataImage);
75
+ if (fileName == null) return void 0;
76
+ const matchingPath = vofficeImages.find((image) => getFileName(image.path ?? void 0) === fileName)?.path;
77
+ if (matchingPath != null) return matchingPath;
78
+ const directoryName = vofficeImages.map((image) => image.path != null ? getDirectoryName(image.path) : void 0).find((path) => path != null);
79
+ return directoryName != null ? `${directoryName}/${fileName}` : void 0;
80
+ };
81
+ const pathMatchesName = (path, name) => path != null && name != null && (path === name || path.endsWith(`/${name}`));
82
+ const entriesShareId = (left, right) => {
83
+ const leftIds = [left.image?.id, toDataImageId(left.dataImage)].filter(isNonEmptyString);
84
+ const rightIds = [right.image?.id, toDataImageId(right.dataImage)].filter(isNonEmptyString);
85
+ return leftIds.some((leftId) => rightIds.includes(leftId));
86
+ };
87
+ const entriesSharePathOrName = (left, right) => {
88
+ const leftPath = getImagePath(left);
89
+ const rightPath = getImagePath(right);
90
+ const leftName = left.dataImage != null ? getDataImageFileName(left.dataImage) : getFileName(left.image?.path ?? void 0);
91
+ const rightName = right.dataImage != null ? getDataImageFileName(right.dataImage) : getFileName(right.image?.path ?? void 0);
92
+ return leftPath != null && rightPath != null && leftPath === rightPath || pathMatchesName(leftPath, rightName) || pathMatchesName(rightPath, leftName);
93
+ };
94
+ const entriesMatch = (left, right) => entriesShareId(left, right) || entriesSharePathOrName(left, right);
95
+ const mergeEntry = (existing, next) => {
96
+ const image = existing.image ?? next.image;
97
+ const dataImage = existing.dataImage ?? next.dataImage;
98
+ const normalizedPath = existing.normalizedPath ?? next.normalizedPath;
99
+ const entry = { source: existing.source };
100
+ if (image != null) entry.image = image;
101
+ if (dataImage != null) entry.dataImage = dataImage;
102
+ if (normalizedPath != null) entry.normalizedPath = normalizedPath;
103
+ return entry;
104
+ };
105
+ const mergeImageEntries = (entries) => {
106
+ const merged = [];
107
+ for (const entry of entries) {
108
+ const index = merged.findIndex((existing) => entriesMatch(existing, entry));
109
+ if (index === -1) {
110
+ merged.push(entry);
111
+ continue;
112
+ }
113
+ merged[index] = mergeEntry(merged[index], entry);
114
+ }
115
+ return merged;
116
+ };
117
+ const getImageEntries = (rental, data) => {
118
+ const vofficeImages = rental.voffice_images ?? [];
119
+ return [
120
+ ...vofficeImages.map((image) => ({
121
+ source: "voffice_images",
122
+ image
123
+ })),
124
+ ...(rental.voffice_room_images ?? []).map((image) => ({
125
+ source: "voffice_room_images",
126
+ image
127
+ })),
128
+ ...(data.known.images ?? []).flatMap((dataImage) => {
129
+ const normalizedPath = normalizeDataImagePath(dataImage, vofficeImages);
130
+ if (normalizedPath == null) return [];
131
+ return [{
132
+ source: "data_images",
133
+ dataImage,
134
+ normalizedPath
135
+ }];
136
+ })
137
+ ];
138
+ };
139
+ const toImage = (imageProxyBaseUrl, entry, locale) => {
140
+ const path = getImagePath(entry);
141
+ const src = path != null ? buildImageUrl(imageProxyBaseUrl, path, IMAGE_DEFAULT_WIDTH) : "";
142
+ const srcset = path != null ? buildSrcset(imageProxyBaseUrl, path) : "";
143
+ const title = toLocalizedString(entry.dataImage?.titles, locale) ?? entry.image?.title;
144
+ const alt = title ?? entry.image?.description ?? "";
145
+ const metadata = { source: entry.source };
146
+ if (entry.dataImage != null) metadata.dataImage = entry.dataImage;
147
+ const image = {
148
+ idOrPath: path ?? toDataImageId(entry.dataImage) ?? entry.dataImage?.name ?? "",
149
+ src,
150
+ srcset,
151
+ alt,
152
+ metadata
153
+ };
154
+ if (title != null) image.title = title;
155
+ if (entry.dataImage?.tag != null) image.category = entry.dataImage.tag;
156
+ return image;
157
+ };
158
+ const toImages = (imageProxyBaseUrl, rental, locale, data) => {
159
+ if (rental.voffice_images == null || rental.voffice_images.length === 0) return [];
160
+ return mergeImageEntries(getImageEntries(rental, data)).map((entry) => toImage(imageProxyBaseUrl, entry, locale));
161
+ };
162
+ //#endregion
41
163
  //#region scripts/v9/heuristic-generation/rental-highlight-key-map.ts
42
164
  const V9_RENTAL_HIGHLIGHT_KEYS = new Set(Object.keys(VofficeUnitDataPropertyMetadata));
43
165
  const V9_RENTAL_HIGHLIGHT_KEY_LOOKUP = {
@@ -399,4 +521,4 @@ const toRentalHighlights = ({ locale, translations, highlightPrioritization, cus
399
521
  return highlights;
400
522
  });
401
523
  //#endregion
402
- export { toAddress as n, toLocalizedString as r, toRentalHighlights as t };
524
+ export { toLocalizedString as i, toImages as n, toAddress as r, toRentalHighlights as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v-office/website-sdk",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "SDK for the connection to PMS from the website",
5
5
  "bin": {
6
6
  "website-sdk": "./dist/cli.mjs"