@v-office/website-sdk 2.25.0 → 2.27.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 CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { Ht as defineWebsiteSDKOptions, Wt as defineV9PropertyHighlightSourcesFromUnknown, c as makeV9GraphQLClient, d as makeV0OpenApiClientFetchLive, l as V0OpenApiClient, t as createWebsiteSDK } from "./client-0Lgv-Gb_.mjs";
2
+ import { Ht as defineWebsiteSDKOptions, Wt as defineV9PropertyHighlightSourcesFromUnknown, c as makeV9GraphQLClient, d as makeV0OpenApiClientFetchLive, l as V0OpenApiClient, t as createWebsiteSDK } from "./client-DB3QXXOo.mjs";
3
3
  import { c as parseVofficeRatingData } from "./v9-data-C3SWtDGs.mjs";
4
4
  import { s as rentalsAllWithoutFeedbacksQuery } from "./operations-DwURbo0b.mjs";
5
5
  import { SearchSearchSortSchema, defineCustomAttributesFromUnknown } from "@v-office/sdk-core";
@@ -18,7 +18,7 @@ var CLICheckFailed = class extends Error {
18
18
  const toCLIError = (message, cause) => cause instanceof Error ? new CLICheckFailed(`${message}: ${cause.message}`, { cause }) : new CLICheckFailed(message, { cause });
19
19
  //#endregion
20
20
  //#region package.json
21
- var version = "2.25.0";
21
+ var version = "2.27.0";
22
22
  //#endregion
23
23
  //#region src/cli/output.ts
24
24
  const toJson = (value) => Effect.try({
@@ -352,13 +352,80 @@ const defineWebsiteSDKOptions = (options) => options;
352
352
  *
353
353
  * A registered symbol on `globalThis`, not module state: a build loads the SDK more than once
354
354
  * (the content loaders and the prerendered pages run separately bundled copies), and every copy
355
- * must land in the one record. No imports, so it is as safe in a browser bundle as in Node.
355
+ * must land in the one record. No runtime imports, so it is as safe in a browser bundle as in Node.
356
356
  */
357
357
  const CONSTRUCTED_BACKENDS_KEY = Symbol.for("@v-office/website-sdk/backends");
358
358
  const recordConstructedBackend = (backend) => {
359
359
  const record = globalThis;
360
360
  (record[CONSTRUCTED_BACKENDS_KEY] ??= /* @__PURE__ */ new Set()).add(backend);
361
361
  };
362
+ /**
363
+ * Every distinct config and options this process has constructed a website SDK with, as JSON of
364
+ * the top-level fields `createWebsiteSDK` reads (their values as passed), recorded like the backends and read by
365
+ * `@v-office/site-manifest` (`websiteSdks`). The platform learns from it the public token and the
366
+ * options the site really uses, whatever its own code looks like. A set of JSON strings: a build
367
+ * constructs the SDK once per content loader and page, and identical constructions are one entry,
368
+ * whatever the order of their keys (two entries would read as two different SDKs); the JSON is
369
+ * what the SDK was told at that moment. Created when the SDK is loaded, so an empty set is a build
370
+ * that loaded it and constructed none, and no set at all is a build without this SDK (or one too
371
+ * old to keep the record). A construction that is not JSON adds `UNRECORDABLE_SDK` instead: the
372
+ * record then no longer names every SDK the build constructed, and the manifest leaves it out
373
+ * rather than report part of it.
374
+ */
375
+ const CONSTRUCTED_SDKS_KEY = Symbol.for("@v-office/website-sdk/sdks");
376
+ globalThis[CONSTRUCTED_SDKS_KEY] ??= /* @__PURE__ */ new Set();
377
+ /** Not JSON of an object, so it can stand for no construction; site-manifest reads the same text. */
378
+ const UNRECORDABLE_SDK = "unrecordable";
379
+ /** The top-level fields `createWebsiteSDK` reads, the only ones recorded: a property it ignores (a
380
+ * spread settings object, the build's environment) never reaches the manifest or the platform.
381
+ * Their values are recorded as passed: they are what the SDK received, and projecting each
382
+ * option's nested shape here would repeat the SDK's types at runtime. Checked against those
383
+ * types, so a new field does not compile until it is listed here. */
384
+ const V10_CONFIG_FIELDS = {
385
+ backend: true,
386
+ apiEndpoint: true,
387
+ searchEndpoint: true,
388
+ accessToken: true,
389
+ imageBaseUrl: true
390
+ };
391
+ const V9_CONFIG_FIELDS = {
392
+ backend: true,
393
+ graphqlUrl: true,
394
+ apiKey: true,
395
+ imageProxyBaseUrl: true,
396
+ v0ApiBaseUrl: true,
397
+ v1ApiBaseUrl: true,
398
+ rentalDataAttributes: true,
399
+ facilityObjectGroupRelationAttributeId: true
400
+ };
401
+ const OPTION_FIELDS = {
402
+ translationOverrides: true,
403
+ customAttributes: true,
404
+ v9PropertyHighlightSources: true,
405
+ v9Reviews: true,
406
+ customAttributeFilterDefinitions: true,
407
+ rentalHighlightPrioritization: true,
408
+ rentalPropertyHighlightPrioritization: true,
409
+ rentalScope: true,
410
+ shouldAddProposedAdditionalServiceAmount: true,
411
+ searchAllRentalsAtOnce: true
412
+ };
413
+ const declared = (value, fields) => Object.fromEntries(Object.entries(value).filter(([key]) => Object.hasOwn(fields, key)));
414
+ /** Writes each object's keys sorted; arrays keep their order, which can mean something. */
415
+ const sortedKeys = (_key, value) => value !== null && typeof value === "object" && !Array.isArray(value) ? Object.fromEntries(Object.entries(value).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) : value;
416
+ const recordConstructedSdk = (config, options) => {
417
+ let json;
418
+ try {
419
+ json = JSON.stringify({
420
+ config: declared(config, config.backend === "v9" ? V9_CONFIG_FIELDS : V10_CONFIG_FIELDS),
421
+ options: declared(options ?? {}, OPTION_FIELDS)
422
+ }, sortedKeys);
423
+ } catch {
424
+ json = UNRECORDABLE_SDK;
425
+ }
426
+ const record = globalThis;
427
+ (record[CONSTRUCTED_SDKS_KEY] ??= /* @__PURE__ */ new Set()).add(json);
428
+ };
362
429
  //#endregion
363
430
  //#region src/payment/browser.ts
364
431
  const getBrowser = () => Effect.gen(function* () {
@@ -533,7 +600,7 @@ const getTermsAndPrivacyPolicyEffect = (input) => Effect.gen(function* () {
533
600
  const getBankTransferDetailsEffect = () => Effect.gen(function* () {
534
601
  const service = yield* BookingService;
535
602
  if (service.getBankTransferDetails === void 0) return yield* Effect.fail(new CoreSDKError({
536
- source: "v10",
603
+ source: "core",
537
604
  operation: "booking.getBankTransferDetails",
538
605
  message: "BookingService.getBankTransferDetails is not provided by the core runtime."
539
606
  }));
@@ -545,7 +612,7 @@ const searchEffect = (input) => Effect.gen(function* () {
545
612
  const mapSearchEffect = (input) => Effect.gen(function* () {
546
613
  const service = yield* SearchService;
547
614
  if (service.mapSearch === void 0) return yield* Effect.fail(new CoreSDKError({
548
- source: "v10",
615
+ source: "core",
549
616
  operation: "search.mapSearch",
550
617
  message: "SearchService.mapSearch is not provided by the core runtime."
551
618
  }));
@@ -3121,7 +3188,7 @@ const toVofficeUnitId$2 = (input) => {
3121
3188
  const unitId = Number(input.rentalId);
3122
3189
  if (Number.isInteger(unitId)) return Effect.succeed(unitId);
3123
3190
  return Effect.fail(new CoreSDKError({
3124
- source: "v10",
3191
+ source: "v9",
3125
3192
  operation: "v9.availability",
3126
3193
  message: `Expected rentalId to be a vOffice unit ID, received "${input.rentalId}".`
3127
3194
  }));
@@ -3140,7 +3207,7 @@ const makeV9AvailabilityApi = ({ config, options }) => {
3140
3207
  path: { voffice_unit: unitId },
3141
3208
  query: { lang: localeToLanguage(input.locale) }
3142
3209
  }).pipe(Effect.mapError((cause) => new CoreSDKError({
3143
- source: "v10",
3210
+ source: "v9",
3144
3211
  operation: "v9.availability",
3145
3212
  message: "Failed to load v9 availability from the v1 OpenAPI client.",
3146
3213
  cause
@@ -4469,14 +4536,14 @@ const toV9BookingServiceLines = (quote) => {
4469
4536
  const toVofficeUnitId$1 = (input) => {
4470
4537
  const context = getGuestQuoteBackendContext(input.quote);
4471
4538
  if (context?.backend !== "v9") return Effect.fail(new CoreSDKError({
4472
- source: "v10",
4539
+ source: "v9",
4473
4540
  operation: "v9.booking",
4474
4541
  message: "Expected a v9 quote for v9 booking."
4475
4542
  }));
4476
4543
  const unitId = Number(context.input.rentalId);
4477
4544
  if (Number.isInteger(unitId)) return Effect.succeed(unitId);
4478
4545
  return Effect.fail(new CoreSDKError({
4479
- source: "v10",
4546
+ source: "v9",
4480
4547
  operation: "v9.booking",
4481
4548
  message: `Expected rentalId to be a vOffice unit ID, received "${context.input.rentalId}".`
4482
4549
  }));
@@ -4497,7 +4564,7 @@ const toBookingInput = ({ input }) => Effect.gen(function* () {
4497
4564
  const context = getGuestQuoteBackendContext(input.quote);
4498
4565
  const unitId = yield* toVofficeUnitId$1(input);
4499
4566
  if (context?.backend !== "v9") return yield* Effect.fail(new CoreSDKError({
4500
- source: "v10",
4567
+ source: "v9",
4501
4568
  operation: "v9.booking",
4502
4569
  message: "Expected a v9 quote for v9 booking."
4503
4570
  }));
@@ -4809,7 +4876,7 @@ const toStripeReturnUrls = ({ redirectUrl }) => Effect.try({
4809
4876
  };
4810
4877
  },
4811
4878
  catch: (cause) => new CoreSDKError({
4812
- source: "v10",
4879
+ source: "v9",
4813
4880
  operation: "v9.booking",
4814
4881
  message: "v9 Stripe payment URLs require an absolute relativeRedirectUrl or a browser window origin so rootUrl, successUrlBase, and cancelUrlBase can be created.",
4815
4882
  cause
@@ -4819,7 +4886,7 @@ const toStripePaymentInput = ({ bookResponse, input, paymentScheduleOption, stri
4819
4886
  const reservationId = bookResponse.reservation?.id;
4820
4887
  const reservationNumber = bookResponse.reservation?.nr;
4821
4888
  if (reservationId === void 0 || reservationNumber === void 0 || stripePaymentMethod.id === void 0) return yield* Effect.fail(new CoreSDKError({
4822
- source: "v10",
4889
+ source: "v9",
4823
4890
  operation: "v9.booking",
4824
4891
  message: "vOffice booking response did not contain enough data to initialize Stripe payment."
4825
4892
  }));
@@ -4856,20 +4923,20 @@ const book = ({ client, input, translations }) => Effect.gen(function* () {
4856
4923
  data: JSON.stringify(bookingInput),
4857
4924
  lang: language
4858
4925
  } }).pipe(Effect.mapError((cause) => new CoreSDKError({
4859
- source: "v10",
4926
+ source: "v9",
4860
4927
  operation: "v9.booking",
4861
4928
  message: "Failed to create v9 booking through the v0 OpenAPI client.",
4862
4929
  cause
4863
4930
  })));
4864
4931
  const bookResponse = result.raw;
4865
4932
  if (bookResponse.ok === false) return yield* Effect.fail(new CoreSDKError({
4866
- source: "v10",
4933
+ source: "v9",
4867
4934
  operation: "v9.booking",
4868
4935
  message: "vOffice rejected the v9 booking request.",
4869
4936
  cause: result.raw
4870
4937
  }));
4871
4938
  if (bookResponse.reservation?.id === void 0 || bookResponse.reservation.nr === void 0) return yield* Effect.fail(new CoreSDKError({
4872
- source: "v10",
4939
+ source: "v9",
4873
4940
  operation: "v9.booking",
4874
4941
  message: "vOffice booking response did not contain a reservation id and number.",
4875
4942
  cause: result.raw
@@ -4887,7 +4954,7 @@ const book = ({ client, input, translations }) => Effect.gen(function* () {
4887
4954
  if (!paymentScheduleOption.payableNow) return { paymentScheduleOption };
4888
4955
  if (stripePaymentMethod === void 0) return { paymentScheduleOption };
4889
4956
  if (stripePaymentKey === void 0) return yield* Effect.fail(new CoreSDKError({
4890
- source: "v10",
4957
+ source: "v9",
4891
4958
  operation: "v9.booking",
4892
4959
  message: "vOffice booking response did not contain a guest token for v9 Stripe payment initialization."
4893
4960
  }));
@@ -4905,14 +4972,14 @@ const book = ({ client, input, translations }) => Effect.gen(function* () {
4905
4972
  lang: language
4906
4973
  }
4907
4974
  }).pipe(Effect.mapError((cause) => new CoreSDKError({
4908
- source: "v10",
4975
+ source: "v9",
4909
4976
  operation: "v9.booking",
4910
4977
  message: "Failed to initialize v9 Stripe payment.",
4911
4978
  cause
4912
4979
  })));
4913
4980
  const stripeResponse = stripeResult.raw;
4914
4981
  if (stripeResponse.ok === false) return yield* Effect.fail(new CoreSDKError({
4915
- source: "v10",
4982
+ source: "v9",
4916
4983
  operation: "v9.booking",
4917
4984
  message: "vOffice rejected the v9 Stripe payment initialization.",
4918
4985
  cause: stripeResult.raw
@@ -4955,7 +5022,7 @@ const makeV9BookingApi = ({ config, options }) => {
4955
5022
  interval: "1 second",
4956
5023
  maxQueueSize: 5,
4957
5024
  onQueueFull: (maxQueueSize) => new CoreSDKError({
4958
- source: "v10",
5025
+ source: "v9",
4959
5026
  operation: "v9.booking",
4960
5027
  message: `v9 booking rate limit queue is full (${maxQueueSize} total request(s)).`
4961
5028
  })
@@ -5027,13 +5094,13 @@ const submit = ({ client, input }) => Effect.gen(function* () {
5027
5094
  data: JSON.stringify(contactInput),
5028
5095
  lang: localeToLanguage(input.locale ?? "de-DE")
5029
5096
  } }).pipe(Effect.mapError((cause) => new CoreSDKError({
5030
- source: "v10",
5097
+ source: "v9",
5031
5098
  operation: "v9.contact",
5032
5099
  message: "Failed to submit v9 contact request through the v0 OpenAPI client.",
5033
5100
  cause
5034
5101
  })));
5035
5102
  if (result.raw.ok === false) return yield* Effect.fail(new CoreSDKError({
5036
- source: "v10",
5103
+ source: "v9",
5037
5104
  operation: "v9.contact",
5038
5105
  message: "vOffice rejected the v9 contact request.",
5039
5106
  cause: result.raw
@@ -5048,7 +5115,7 @@ const makeV9ContactApi = ({ config, options }) => {
5048
5115
  interval: "1 second",
5049
5116
  maxQueueSize: 5,
5050
5117
  onQueueFull: (maxQueueSize) => new CoreSDKError({
5051
- source: "v10",
5118
+ source: "v9",
5052
5119
  operation: "v9.contact",
5053
5120
  message: `v9 contact rate limit queue is full (${maxQueueSize} total request(s)).`
5054
5121
  })
@@ -5171,13 +5238,13 @@ const selectedInsuranceOption = (quote) => {
5171
5238
  //#endregion
5172
5239
  //#region src/legacy-v9/live/quote-insurance.ts
5173
5240
  const toInsuranceError = (message) => (cause) => new CoreSDKError({
5174
- source: "v10",
5241
+ source: "v9",
5175
5242
  operation: "v9.insurance",
5176
5243
  message,
5177
5244
  cause
5178
5245
  });
5179
5246
  const failInsurance = (message) => Effect.fail(new CoreSDKError({
5180
- source: "v10",
5247
+ source: "v9",
5181
5248
  operation: "v9.insurance",
5182
5249
  message
5183
5250
  }));
@@ -5380,7 +5447,7 @@ const createV9InsurancePreContract = ({ quote, customerInformation, v1Client })
5380
5447
  const result = yield* v1Client.execute("createErgoPreContract", { body }).pipe(Effect.mapError(toInsuranceError("Failed to create ERGO pre-contract information.")));
5381
5448
  const preContract = toInsurancePreContractOutput(result.raw);
5382
5449
  if (preContract.kind !== "created") return yield* Effect.fail(new CoreSDKError({
5383
- source: "v10",
5450
+ source: "v9",
5384
5451
  operation: "v9.insurance",
5385
5452
  message: "ERGO pre-contract response did not contain a pre-contract ID.",
5386
5453
  cause: result.raw
@@ -5425,7 +5492,7 @@ const bookV9Insurance = ({ quote, bookingNumber, guestToken, v1Client }) => Effe
5425
5492
  const result = yield* v1Client.execute("bookErgoTravelCancellationInsurance", { body }).pipe(Effect.mapError(toInsuranceError("Failed to book ERGO insurance.")));
5426
5493
  const bookingOutput = toInsuranceBookingOutput(result.raw);
5427
5494
  if (bookingOutput.kind !== "booked") return yield* Effect.fail(new CoreSDKError({
5428
- source: "v10",
5495
+ source: "v9",
5429
5496
  operation: "v9.insurance",
5430
5497
  message: "ERGO insurance booking response did not contain a policy number.",
5431
5498
  cause: result.raw
@@ -5447,7 +5514,7 @@ const loadQuoteRuntime = Effect.tryPromise({
5447
5514
  return { toGuestQuote: (await import("./quote-cjFdLn0m.mjs")).toGuestQuote };
5448
5515
  },
5449
5516
  catch: (cause) => new CoreSDKError({
5450
- source: "v10",
5517
+ source: "v9",
5451
5518
  operation: "v9.quote",
5452
5519
  message: "Failed to load v9 quote runtime.",
5453
5520
  cause
@@ -5457,7 +5524,7 @@ const toVofficeUnitId = (input) => {
5457
5524
  const unitId = Number(input.rentalId);
5458
5525
  if (Number.isInteger(unitId)) return Effect.succeed(unitId);
5459
5526
  return Effect.fail(new CoreSDKError({
5460
- source: "v10",
5527
+ source: "v9",
5461
5528
  operation: "v9.quote",
5462
5529
  message: `Expected rentalId to be a vOffice unit ID, received "${input.rentalId}".`
5463
5530
  }));
@@ -5478,7 +5545,7 @@ const quote = (client, v0Client, translations, limitQuote, input, shouldAddPropo
5478
5545
  ...input.voucher === void 0 ? {} : { voucherCode: input.voucher }
5479
5546
  }
5480
5547
  }).pipe(Effect.mapError((cause) => new CoreSDKError({
5481
- source: "v10",
5548
+ source: "v9",
5482
5549
  operation: "v9.quote",
5483
5550
  message: "Failed to load v9 quote prices from the v1 OpenAPI client.",
5484
5551
  cause
@@ -5503,7 +5570,7 @@ const makeV9QuoteApi = ({ config, options }) => {
5503
5570
  interval: "1 second",
5504
5571
  maxQueueSize: 5,
5505
5572
  onQueueFull: (maxQueueSize) => new CoreSDKError({
5506
- source: "v10",
5573
+ source: "v9",
5507
5574
  operation: "v9.quote",
5508
5575
  message: `v9 quote rate limit queue is full (${maxQueueSize} total request(s)).`
5509
5576
  })
@@ -5684,20 +5751,20 @@ const makeV9GraphQLClient = (config) => ({ execute: (document, variables) => Eff
5684
5751
  return body;
5685
5752
  },
5686
5753
  catch: (cause) => new CoreSDKError({
5687
- source: "v10",
5754
+ source: "v9",
5688
5755
  operation: "v9.graphql.transport",
5689
5756
  message: "v9 GraphQL transport request failed.",
5690
5757
  cause
5691
5758
  })
5692
5759
  }).pipe(Effect.flatMap((body) => {
5693
5760
  if (body.errors?.length) return Effect.fail(new CoreSDKError({
5694
- source: "v10",
5761
+ source: "v9",
5695
5762
  operation: "v9.graphql.decode",
5696
5763
  message: "v9 GraphQL response contained errors.",
5697
5764
  cause: body.errors
5698
5765
  }));
5699
5766
  if (body.data === void 0) return Effect.fail(new CoreSDKError({
5700
- source: "v10",
5767
+ source: "v9",
5701
5768
  operation: "v9.graphql.decode",
5702
5769
  message: "v9 GraphQL response did not include data."
5703
5770
  }));
@@ -5733,7 +5800,7 @@ const toV9PropertyScope = (scope) => {
5733
5800
  const validateV9RentalScope = (scope) => {
5734
5801
  if (toV9PropertyScope(scope).kind !== "invalid") return;
5735
5802
  throw new CoreSDKError({
5736
- source: "v10",
5803
+ source: "v9",
5737
5804
  operation: "v9.config",
5738
5805
  message: `Expected rentalScope.propertyId to be a vOffice property ID, received "${scope.propertyId}".`
5739
5806
  });
@@ -5770,39 +5837,41 @@ const V9_SEARCH_CURSOR_PREFIX = "page:";
5770
5837
  */
5771
5838
  const ALL_RENTALS_PAGE_SIZE = 10;
5772
5839
  const ALL_RENTALS_CONCURRENCY = 8;
5840
+ /** The hub silently leaves every rental after the 128th of a request unpriced. */
5841
+ const MAX_PRICED_PAGE_SIZE = 128;
5773
5842
  /** A map search prices nothing; the hub answers 1000 matches in one request. */
5774
5843
  const MAP_SEARCH_PAGE_SIZE = 1e3;
5775
5844
  const toV9SearchCursor = (page) => `${V9_SEARCH_CURSOR_PREFIX}${page}`;
5776
5845
  const parseV9SearchCursor = (cursor) => Effect.gen(function* () {
5777
5846
  if (!cursor.startsWith(V9_SEARCH_CURSOR_PREFIX)) return yield* Effect.fail(new CoreSDKError({
5778
- source: "v10",
5847
+ source: "v9",
5779
5848
  operation: "v9.search",
5780
5849
  message: "Invalid v9 search cursor."
5781
5850
  }));
5782
5851
  const page = Number(cursor.slice(5));
5783
5852
  if (!Number.isInteger(page) || page < 1) return yield* Effect.fail(new CoreSDKError({
5784
- source: "v10",
5853
+ source: "v9",
5785
5854
  operation: "v9.search",
5786
5855
  message: "Invalid v9 search cursor."
5787
5856
  }));
5788
5857
  return page;
5789
5858
  });
5790
5859
  const loadV9SearchRuntime = Effect.tryPromise({
5791
- try: () => import("./search-BLTTQAsG.mjs"),
5860
+ try: () => import("./search-CZSFERmD.mjs"),
5792
5861
  catch: (cause) => new CoreSDKError({
5793
- source: "v10",
5862
+ source: "v9",
5794
5863
  operation: "v9.search.runtime",
5795
5864
  message: "Failed to load v9 live search runtime.",
5796
5865
  cause
5797
5866
  })
5798
5867
  });
5799
5868
  const failSearch = ({ operation, message }) => Effect.runPromise(Effect.fail(new CoreSDKError({
5800
- source: "v10",
5869
+ source: "v9",
5801
5870
  operation,
5802
5871
  message
5803
5872
  })));
5804
5873
  const tooManyRentals = (totalCount) => new CoreSDKError({
5805
- source: "v10",
5874
+ source: "v9",
5806
5875
  operation: "search.allRentalsAtOnce",
5807
5876
  message: `The search matches ${totalCount} rentals; searchAllRentalsAtOnce supports at most ${SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS}. Use paged search and mapSearch instead.`
5808
5877
  });
@@ -5815,6 +5884,19 @@ const uniqueById = (entries, toId) => {
5815
5884
  return true;
5816
5885
  });
5817
5886
  };
5887
+ const splitEntries = (entries) => ({
5888
+ items: entries.flatMap((entry) => entry.type === "item" ? [entry.item] : []),
5889
+ alternatives: entries.flatMap((entry) => entry.type === "alternative" ? [entry.alternative] : [])
5890
+ });
5891
+ const toUniqueResults = (entries) => {
5892
+ const split = splitEntries(entries);
5893
+ const items = uniqueById(split.items, (item) => item.id);
5894
+ const itemIds = new Set(items.map((item) => item.id));
5895
+ return {
5896
+ items,
5897
+ alternatives: uniqueById(split.alternatives, (alternative) => alternative.item.id).filter((alternative) => !itemIds.has(alternative.item.id))
5898
+ };
5899
+ };
5818
5900
  const makeV9SearchApi = ({ config, options }) => {
5819
5901
  const graphql = makeV9GraphQLClient(config);
5820
5902
  const translations = makeV9TranslationService(options.translationOverrides);
@@ -5823,7 +5905,7 @@ const makeV9SearchApi = ({ config, options }) => {
5823
5905
  interval: "1 second",
5824
5906
  maxQueueSize: 5,
5825
5907
  onQueueFull: (maxQueueSize) => new CoreSDKError({
5826
- source: "v10",
5908
+ source: "v9",
5827
5909
  operation: "v9.search",
5828
5910
  message: `v9 search rate limit queue is full (${maxQueueSize} total request(s)).`
5829
5911
  })
@@ -5902,11 +5984,49 @@ const makeV9SearchApi = ({ config, options }) => {
5902
5984
  };
5903
5985
  })));
5904
5986
  return {
5905
- items: entries.flatMap((entry) => entry.type === "item" ? [entry.item] : []),
5906
- alternatives: entries.flatMap((entry) => entry.type === "alternative" ? [entry.alternative] : []),
5987
+ ...splitEntries(entries),
5988
+ entries,
5907
5989
  paginatorInfo: data.search.paginatorInfo
5908
5990
  };
5909
5991
  });
5992
+ const countMatches = ({ input, runtime, scopedQueryInput }) => graphql.execute(runtime.mapSearchQuery, {
5993
+ first: 1,
5994
+ page: 1,
5995
+ language: localeToLanguage(input.locale),
5996
+ ...scopedQueryInput
5997
+ }).pipe(Effect.map((data) => data.search.paginatorInfo.total));
5998
+ const searchPricedWindow = ({ input, runtime, scopedQueryInput, page, limit }) => Effect.gen(function* () {
5999
+ const fetchWindow = Effect.gen(function* () {
6000
+ const totalCount = yield* countMatches({
6001
+ input,
6002
+ runtime,
6003
+ scopedQueryInput
6004
+ });
6005
+ const start = (page - 1) * limit;
6006
+ const end = Math.min(start + limit, totalCount);
6007
+ const firstBackendPage = Math.floor(start / MAX_PRICED_PAGE_SIZE) + 1;
6008
+ const lastBackendPage = Math.ceil(end / MAX_PRICED_PAGE_SIZE);
6009
+ const pages = yield* Effect.all(Array.from({ length: Math.max(0, lastBackendPage - firstBackendPage + 1) }, (_, index) => searchPage({
6010
+ input,
6011
+ runtime,
6012
+ scopedQueryInput,
6013
+ page: firstBackendPage + index,
6014
+ first: MAX_PRICED_PAGE_SIZE
6015
+ })), { concurrency: ALL_RENTALS_CONCURRENCY });
6016
+ const offset = start - (firstBackendPage - 1) * MAX_PRICED_PAGE_SIZE;
6017
+ const entries = pages.flatMap((backendPage) => backendPage.entries).slice(offset, offset + limit);
6018
+ const { items, alternatives } = toUniqueResults(entries);
6019
+ return {
6020
+ items,
6021
+ alternatives,
6022
+ hasNextPage: start + limit < totalCount,
6023
+ totalCount,
6024
+ isConsistent: pages.every((backendPage) => backendPage.paginatorInfo.total === totalCount) && items.length + alternatives.length === Math.max(0, end - start)
6025
+ };
6026
+ });
6027
+ const window = yield* fetchWindow;
6028
+ return window.isConsistent ? window : yield* fetchWindow;
6029
+ });
5910
6030
  const searchOnePage = (input) => Effect.runPromise(limitSearch(Effect.gen(function* () {
5911
6031
  const { runtime, appliedFilters, unusedFilterKeys, scopedQueryInput } = yield* toScopedQuery(input);
5912
6032
  if (scopedQueryInput === void 0) return {
@@ -5919,12 +6039,33 @@ const makeV9SearchApi = ({ config, options }) => {
5919
6039
  }
5920
6040
  };
5921
6041
  const page = input.cursor === void 0 ? 1 : yield* parseV9SearchCursor(input.cursor);
6042
+ const limit = input.limit ?? DEFAULT_SEARCH_LIMIT;
6043
+ if (limit > MAX_PRICED_PAGE_SIZE) {
6044
+ const { items, alternatives, hasNextPage, totalCount } = yield* searchPricedWindow({
6045
+ input,
6046
+ runtime,
6047
+ scopedQueryInput,
6048
+ page,
6049
+ limit
6050
+ });
6051
+ return {
6052
+ items,
6053
+ ...alternatives.length > 0 ? { alternatives } : {},
6054
+ appliedFilters,
6055
+ unusedFilterKeys,
6056
+ pageInfo: {
6057
+ hasNextPage,
6058
+ ...hasNextPage ? { nextCursor: toV9SearchCursor(page + 1) } : {},
6059
+ totalCount
6060
+ }
6061
+ };
6062
+ }
5922
6063
  const { items, alternatives, paginatorInfo } = yield* searchPage({
5923
6064
  input,
5924
6065
  runtime,
5925
6066
  scopedQueryInput,
5926
6067
  page,
5927
- first: input.limit ?? DEFAULT_SEARCH_LIMIT
6068
+ first: limit
5928
6069
  });
5929
6070
  return {
5930
6071
  items,
@@ -5952,12 +6093,11 @@ const makeV9SearchApi = ({ config, options }) => {
5952
6093
  totalCount: 0
5953
6094
  }
5954
6095
  };
5955
- const totalCount = (yield* graphql.execute(runtime.mapSearchQuery, {
5956
- first: 1,
5957
- page: 1,
5958
- language: localeToLanguage(input.locale),
5959
- ...scopedQueryInput
5960
- })).search.paginatorInfo.total;
6096
+ const totalCount = yield* countMatches({
6097
+ input,
6098
+ runtime,
6099
+ scopedQueryInput
6100
+ });
5961
6101
  if (totalCount > SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS) return yield* Effect.fail(tooManyRentals(totalCount));
5962
6102
  const pages = yield* Effect.all(Array.from({ length: Math.ceil(totalCount / ALL_RENTALS_PAGE_SIZE) }, (_, index) => searchPage({
5963
6103
  input,
@@ -5966,9 +6106,7 @@ const makeV9SearchApi = ({ config, options }) => {
5966
6106
  page: index + 1,
5967
6107
  first: ALL_RENTALS_PAGE_SIZE
5968
6108
  })), { concurrency: ALL_RENTALS_CONCURRENCY });
5969
- const items = uniqueById(pages.flatMap((page) => page.items), (item) => item.id);
5970
- const itemIds = new Set(items.map((item) => item.id));
5971
- const alternatives = uniqueById(pages.flatMap((page) => page.alternatives), (alternative) => alternative.item.id).filter((alternative) => !itemIds.has(alternative.item.id));
6109
+ const { items, alternatives } = toUniqueResults(pages.flatMap((page) => page.entries));
5972
6110
  const toOutput = (result) => ({
5973
6111
  items: result.items,
5974
6112
  ...result.alternatives.length > 0 ? { alternatives: result.alternatives } : {},
@@ -6037,9 +6175,39 @@ const makeV9SearchApi = ({ config, options }) => {
6037
6175
  unusedFilterKeys
6038
6176
  };
6039
6177
  })));
6178
+ async function* searchPages(input) {
6179
+ if (options.searchAllRentalsAtOnce) return await failSearch({
6180
+ operation: "search.searchPages",
6181
+ message: "searchPages is not available with searchAllRentalsAtOnce; search already returns every result."
6182
+ });
6183
+ const { cursor: _cursor, limit: _limit, ...searchInput } = input;
6184
+ const seenIds = /* @__PURE__ */ new Set();
6185
+ let cursor;
6186
+ for (let pageCount = 1;; pageCount++) {
6187
+ const { alternatives: pageAlternatives = [], ...output } = await searchOnePage({
6188
+ ...searchInput,
6189
+ limit: MAX_PRICED_PAGE_SIZE,
6190
+ ...cursor === void 0 ? {} : { cursor }
6191
+ });
6192
+ const items = output.items.filter((item) => !seenIds.has(item.id));
6193
+ const alternatives = pageAlternatives.filter((alternative) => !seenIds.has(alternative.item.id));
6194
+ if (pageCount > 1 && items.length + alternatives.length === 0) return;
6195
+ for (const item of items) seenIds.add(item.id);
6196
+ for (const alternative of alternatives) seenIds.add(alternative.item.id);
6197
+ yield {
6198
+ ...output,
6199
+ items,
6200
+ ...alternatives.length > 0 ? { alternatives } : {}
6201
+ };
6202
+ const { hasNextPage, nextCursor, totalCount } = output.pageInfo;
6203
+ if (!hasNextPage || nextCursor === void 0 || nextCursor === cursor || pageCount >= Math.ceil(totalCount / MAX_PRICED_PAGE_SIZE)) return;
6204
+ cursor = nextCursor;
6205
+ }
6206
+ }
6040
6207
  return {
6041
6208
  search: (input) => options.searchAllRentalsAtOnce ? searchAllRentals(input) : searchOnePage(input),
6042
- mapSearch
6209
+ mapSearch,
6210
+ searchPages
6043
6211
  };
6044
6212
  };
6045
6213
  //#endregion
@@ -6336,9 +6504,9 @@ const orderRentalsById = ({ rentalIds, rentals }) => {
6336
6504
  });
6337
6505
  };
6338
6506
  const loadV9RentalsRuntime = Effect.tryPromise({
6339
- try: () => import("./rentals-Dn0-kGWD.mjs"),
6507
+ try: () => import("./rentals-DG0ofi7C.mjs"),
6340
6508
  catch: (cause) => new CoreSDKError({
6341
- source: "v10",
6509
+ source: "v9",
6342
6510
  operation: "v9.rentals.runtime",
6343
6511
  message: "Failed to load v9 rentals runtime.",
6344
6512
  cause
@@ -6480,6 +6648,7 @@ function createWebsiteSDK({ config, options }) {
6480
6648
  options: v9Options
6481
6649
  });
6482
6650
  recordConstructedBackend("v9");
6651
+ recordConstructedSdk(config, options);
6483
6652
  return {
6484
6653
  backend: "v9",
6485
6654
  static: {
@@ -6490,7 +6659,8 @@ function createWebsiteSDK({ config, options }) {
6490
6659
  contact: { submit: contact.submit },
6491
6660
  search: {
6492
6661
  search: search.search,
6493
- mapSearch: search.mapSearch
6662
+ mapSearch: search.mapSearch,
6663
+ searchPages: search.searchPages
6494
6664
  },
6495
6665
  availability: {
6496
6666
  getInitialAvailability: availability.getInitialAvailability,
@@ -6556,6 +6726,7 @@ function createWebsiteSDK({ config, options }) {
6556
6726
  dispose: () => runtime.dispose()
6557
6727
  };
6558
6728
  recordConstructedBackend("v10");
6729
+ recordConstructedSdk(config, options);
6559
6730
  return sdk;
6560
6731
  }
6561
6732
  //#endregion
package/dist/index.d.mts CHANGED
@@ -97,6 +97,10 @@ type V9SearchSearchInput = Omit<SearchSearchInput$1, "rentalIdsIn" | "voucher" |
97
97
  readonly voucher?: never;
98
98
  readonly sort?: V9SearchSearchSort;
99
99
  };
100
+ type V9SearchPagesInput = Omit<V9SearchSearchInput, "cursor" | "limit"> & {
101
+ readonly cursor?: never;
102
+ readonly limit?: never;
103
+ };
100
104
  /** `search` input with `searchAllRentalsAtOnce: true`: one call returns every result, so there are no pages. */
101
105
  type V9SearchAllRentalsAtOnceInput = Omit<V9SearchSearchInput, "cursor" | "limit"> & {
102
106
  readonly cursor?: never;
@@ -179,6 +183,7 @@ type WebsiteSDKV9Live = Omit<WebsiteSDKSharedLive, "search"> & {
179
183
  readonly search: {
180
184
  readonly search: (input: V9SearchSearchInput) => Promise<V9SearchSearchOutput>;
181
185
  readonly mapSearch: WebsiteSDKSharedLive["search"]["mapSearch"];
186
+ readonly searchPages: (input: V9SearchPagesInput) => AsyncIterable<V9SearchSearchOutput>;
182
187
  };
183
188
  };
184
189
  /** `live` of a v9 SDK created with `searchAllRentalsAtOnce: true`. */
@@ -7612,4 +7617,4 @@ export type RentalRentalsOutput = RentalGetRentalsOutput$1[number];
7612
7617
  export type RentalSearchInput = SearchSearchInput$1;
7613
7618
  export type RentalSearchOutput = SearchSearchOutput$1;
7614
7619
  //#endregion
7615
- export { AdditionalServiceLimitExceeded, type AvailabilityGetInitialAvailabilityInput, type AvailabilityGetInitialAvailabilityOutput, type AvailabilityGetStartDateSelectedAvailabilityInput, type AvailabilityGetStartDateSelectedAvailabilityOutput, type BackendKind, type BookingBankTransferDetails, type BookingBookInput, type BookingBookOutput, type BookingPayment, type BookingPaymentAlternative, type BookingPaymentOption, type BookingPaymentScheduleItem, type BookingPaymentScheduleKind, type BookingPaymentScheduleLine, CMSError, type ContactSubmitInput, type ContactSubmitOutput, type ContactSubmitValidationIssue, type ContactSubmitValidationIssueCode, CoreSDKError, type CustomAttributeCatalog, type CustomAttributeCatalogDefinitionInput, type CustomAttributeCatalogInput, CustomAttributeCatalogSchema, type CustomAttributeCategoryKey, type CustomAttributeFilterCategoryKey, type CustomAttributeFilterDefinition, type CustomAttributeFilterExpression, type CustomAttributeFilterLabel, type CustomAttributeFilterNumericBounds, type CustomAttributeFilterOption, type CustomAttributeOverridesInput, type CustomAttributeRegistry, type CustomAttributeRegistrySnapshot, type CustomAttributeSelection, type CustomDataAttribute, type DataAttribute, type DocumentsGetTermsAndPrivacyPolicyInput, type DocumentsGetTermsAndPrivacyPolicyOutput, type FilterGetFiltersInput, type FilterGetFiltersOutput, type GeoLocation, type GuestQuote, type GuestQuoteInput, type GuestQuoteInsurance, type GuestQuoteResult, GuestQuoteSchema, type GuestQuoteSelectionResult, type GuestQuoteVoucher, type ImageData, type InsuranceBookingOutput, type InsuranceCustomerInformationInput, type InsurancePaymentInformationInput, type InsurancePaymentOptionOutput, type InsurancePreContractOutput, InvalidAdditionalServiceQuantity, type KnownVofficeFacilityData, type KnownVofficeFacilityDataAttribute, type KnownVofficeFeedbackData, type KnownVofficeFeedbackDataAttribute, type KnownVofficeImageData, type KnownVofficeImageDataAttribute, type KnownVofficeOfferData, type KnownVofficeOfferDataAttribute, type KnownVofficePriceData, type KnownVofficePriceDataAttribute, type KnownVofficeRatingData, type KnownVofficeRatingDataAttribute, type KnownVofficeServiceData, type KnownVofficeServiceDataAttribute, type KnownVofficeTotalRatingData, type KnownVofficeTotalRatingDataAttribute, type KnownVofficeUnitData, type KnownVofficeUnitDataAttribute, type Locale, LocaleSchema, type ParsedJsonData, type ParsedVofficeFacilityData, type ParsedVofficeFeedbackData, type ParsedVofficeImageData, type ParsedVofficeOfferData, type ParsedVofficePriceData, type ParsedVofficeRatingData, type ParsedVofficeServiceData, type ParsedVofficeTotalRatingData, type ParsedVofficeUnitData, type QuoteQuoteInput, type QuoteQuoteOutput, type RentalGetRentalsInput, type RentalGetRentalsOutput, type RentalHighlightPrioritizationKey, type RentalPropertyHighlightPrioritizationKey, type ResolvedCustomAttribute, type ResolvedV9PropertyHighlightSource, SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS, type SearchAllRentalsAtOnceInput, type SearchMapSearchInput, SearchMapSearchInputSchema, type SearchMapSearchOutput, type SearchMapSearchOutputItem, SearchMapSearchOutputSchema, type SearchSearchFieldOrderBy, SearchSearchFieldOrderBySchema, type SearchSearchFieldSort, SearchSearchFieldSortSchema, type SearchSearchInput, SearchSearchInputSchema, type SearchSearchOutput, SearchSearchOutputSchema, type SearchSearchPriceSort, SearchSearchPriceSortSchema, type SearchSearchRandomSort, SearchSearchRandomSortSchema, type SearchSearchRatingSort, SearchSearchRatingSortSchema, type SearchSearchSort, SearchSearchSortSchema, type SearchSortDirection, SearchSortDirectionSchema, type SelectableInsuranceOptionOutput, type SelectedInsuranceInformationInput, type SubmittableBookingPaymentOption, type TranslationOverrides, UnknownAdditionalService, type V0OpenApiClientOptions, type V0OpenApiOperationId, type V0OpenApiOperationRequest, type V0OpenApiOperationResponse, type V1OpenApiClientOptions, type components as V1OpenApiComponents, type V1OpenApiOperationId, type V1OpenApiOperationRequest, type V1OpenApiOperationResponse, type operations as V1OpenApiOperations, type paths as V1OpenApiPaths, type V9OnlyCustomAttributeInput, type V9PropertyHighlightDataAttribute, type V9PropertyHighlightSourceInput, type V9PropertyHighlightSourceRegistry, type V9PropertyHighlightSourcesInput, type V9ReviewCriterion, type V9ReviewCriterionDataAttribute, type V9ReviewsOptions, type V9SearchAllRentalsAtOnceInput, type V9SearchSearchInput, type V9SearchSearchOutput, type V9SearchSearchOutputItem, type V9SearchSearchSort, type VofficeFacilityDataAttribute, type VofficeFacilityDataAttributes, type VofficeFeedbackDataAttribute, type VofficeFeedbackDataAttributes, type VofficeImageDataAttribute, type VofficeImageDataAttributes, type VofficeOfferDataAttribute, type VofficeOfferDataAttributes, type VofficePriceDataAttribute, type VofficePriceDataAttributes, type VofficeRatingDataAttribute, type VofficeRatingDataAttributes, type VofficeServiceDataAttribute, type VofficeServiceDataAttributes, type VofficeTotalRatingDataAttribute, type VofficeTotalRatingDataAttributes, type VofficeUnitDataAttribute, type VofficeUnitDataAttributes, type WebsiteSDK, type WebsiteSDKAllRentalsAtOnce, type WebsiteSDKConfig, type WebsiteSDKOptions, type WebsiteSDKSharedLive, type WebsiteSDKSharedStatic, type WebsiteSDKV10, type WebsiteSDKV10AllRentalsAtOnce, type WebsiteSDKV10AllRentalsAtOnceLive, type WebsiteSDKV10Live, type WebsiteSDKV10Static, type WebsiteSDKV9, type WebsiteSDKV9AllRentalsAtOnce, type WebsiteSDKV9AllRentalsAtOnceLive, type WebsiteSDKV9Live, defineWebsiteSDKOptions as defineCMSSDKOptions, defineCustomAttributes, defineCustomAttributesFromUnknown, fetchCustomAttributeCatalog, parseCustomAttributeCatalog, validateContactSubmitInput };
7620
+ export { AdditionalServiceLimitExceeded, type AvailabilityGetInitialAvailabilityInput, type AvailabilityGetInitialAvailabilityOutput, type AvailabilityGetStartDateSelectedAvailabilityInput, type AvailabilityGetStartDateSelectedAvailabilityOutput, type BackendKind, type BookingBankTransferDetails, type BookingBookInput, type BookingBookOutput, type BookingPayment, type BookingPaymentAlternative, type BookingPaymentOption, type BookingPaymentScheduleItem, type BookingPaymentScheduleKind, type BookingPaymentScheduleLine, CMSError, type ContactSubmitInput, type ContactSubmitOutput, type ContactSubmitValidationIssue, type ContactSubmitValidationIssueCode, CoreSDKError, type CustomAttributeCatalog, type CustomAttributeCatalogDefinitionInput, type CustomAttributeCatalogInput, CustomAttributeCatalogSchema, type CustomAttributeCategoryKey, type CustomAttributeFilterCategoryKey, type CustomAttributeFilterDefinition, type CustomAttributeFilterExpression, type CustomAttributeFilterLabel, type CustomAttributeFilterNumericBounds, type CustomAttributeFilterOption, type CustomAttributeOverridesInput, type CustomAttributeRegistry, type CustomAttributeRegistrySnapshot, type CustomAttributeSelection, type CustomDataAttribute, type DataAttribute, type DocumentsGetTermsAndPrivacyPolicyInput, type DocumentsGetTermsAndPrivacyPolicyOutput, type FilterGetFiltersInput, type FilterGetFiltersOutput, type GeoLocation, type GuestQuote, type GuestQuoteInput, type GuestQuoteInsurance, type GuestQuoteResult, GuestQuoteSchema, type GuestQuoteSelectionResult, type GuestQuoteVoucher, type ImageData, type InsuranceBookingOutput, type InsuranceCustomerInformationInput, type InsurancePaymentInformationInput, type InsurancePaymentOptionOutput, type InsurancePreContractOutput, InvalidAdditionalServiceQuantity, type KnownVofficeFacilityData, type KnownVofficeFacilityDataAttribute, type KnownVofficeFeedbackData, type KnownVofficeFeedbackDataAttribute, type KnownVofficeImageData, type KnownVofficeImageDataAttribute, type KnownVofficeOfferData, type KnownVofficeOfferDataAttribute, type KnownVofficePriceData, type KnownVofficePriceDataAttribute, type KnownVofficeRatingData, type KnownVofficeRatingDataAttribute, type KnownVofficeServiceData, type KnownVofficeServiceDataAttribute, type KnownVofficeTotalRatingData, type KnownVofficeTotalRatingDataAttribute, type KnownVofficeUnitData, type KnownVofficeUnitDataAttribute, type Locale, LocaleSchema, type ParsedJsonData, type ParsedVofficeFacilityData, type ParsedVofficeFeedbackData, type ParsedVofficeImageData, type ParsedVofficeOfferData, type ParsedVofficePriceData, type ParsedVofficeRatingData, type ParsedVofficeServiceData, type ParsedVofficeTotalRatingData, type ParsedVofficeUnitData, type QuoteQuoteInput, type QuoteQuoteOutput, type RentalGetRentalsInput, type RentalGetRentalsOutput, type RentalHighlightPrioritizationKey, type RentalPropertyHighlightPrioritizationKey, type ResolvedCustomAttribute, type ResolvedV9PropertyHighlightSource, SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS, type SearchAllRentalsAtOnceInput, type SearchMapSearchInput, SearchMapSearchInputSchema, type SearchMapSearchOutput, type SearchMapSearchOutputItem, SearchMapSearchOutputSchema, type SearchSearchFieldOrderBy, SearchSearchFieldOrderBySchema, type SearchSearchFieldSort, SearchSearchFieldSortSchema, type SearchSearchInput, SearchSearchInputSchema, type SearchSearchOutput, SearchSearchOutputSchema, type SearchSearchPriceSort, SearchSearchPriceSortSchema, type SearchSearchRandomSort, SearchSearchRandomSortSchema, type SearchSearchRatingSort, SearchSearchRatingSortSchema, type SearchSearchSort, SearchSearchSortSchema, type SearchSortDirection, SearchSortDirectionSchema, type SelectableInsuranceOptionOutput, type SelectedInsuranceInformationInput, type SubmittableBookingPaymentOption, type TranslationOverrides, UnknownAdditionalService, type V0OpenApiClientOptions, type V0OpenApiOperationId, type V0OpenApiOperationRequest, type V0OpenApiOperationResponse, type V1OpenApiClientOptions, type components as V1OpenApiComponents, type V1OpenApiOperationId, type V1OpenApiOperationRequest, type V1OpenApiOperationResponse, type operations as V1OpenApiOperations, type paths as V1OpenApiPaths, type V9OnlyCustomAttributeInput, type V9PropertyHighlightDataAttribute, type V9PropertyHighlightSourceInput, type V9PropertyHighlightSourceRegistry, type V9PropertyHighlightSourcesInput, type V9ReviewCriterion, type V9ReviewCriterionDataAttribute, type V9ReviewsOptions, type V9SearchAllRentalsAtOnceInput, type V9SearchPagesInput, type V9SearchSearchInput, type V9SearchSearchOutput, type V9SearchSearchOutputItem, type V9SearchSearchSort, type VofficeFacilityDataAttribute, type VofficeFacilityDataAttributes, type VofficeFeedbackDataAttribute, type VofficeFeedbackDataAttributes, type VofficeImageDataAttribute, type VofficeImageDataAttributes, type VofficeOfferDataAttribute, type VofficeOfferDataAttributes, type VofficePriceDataAttribute, type VofficePriceDataAttributes, type VofficeRatingDataAttribute, type VofficeRatingDataAttributes, type VofficeServiceDataAttribute, type VofficeServiceDataAttributes, type VofficeTotalRatingDataAttribute, type VofficeTotalRatingDataAttributes, type VofficeUnitDataAttribute, type VofficeUnitDataAttributes, type WebsiteSDK, type WebsiteSDKAllRentalsAtOnce, type WebsiteSDKConfig, type WebsiteSDKOptions, type WebsiteSDKSharedLive, type WebsiteSDKSharedStatic, type WebsiteSDKV10, type WebsiteSDKV10AllRentalsAtOnce, type WebsiteSDKV10AllRentalsAtOnceLive, type WebsiteSDKV10Live, type WebsiteSDKV10Static, type WebsiteSDKV9, type WebsiteSDKV9AllRentalsAtOnce, type WebsiteSDKV9AllRentalsAtOnceLive, type WebsiteSDKV9Live, defineWebsiteSDKOptions as defineCMSSDKOptions, defineCustomAttributes, defineCustomAttributesFromUnknown, fetchCustomAttributeCatalog, parseCustomAttributeCatalog, validateContactSubmitInput };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as SearchPropertiesResponseSchema, A as ErgoBankSchema, At as getStartDateSelectedAvailabilityEffect, B as OnOfficeUnitCollectionResponseSchema, Bt as submitPaymentOption, C as DocumentResourceResponseSchema, Ct as bookInsuranceEffect, D as DocumentSummarySchema, Dt as getFiltersEffect, E as DocumentStatusUpdateRequestSchema, Et as getBankTransferDetailsEffect, F as ErgoPlanSearchRequestSchema, Ft as searchEffect, G as QuotePricesPayloadSchema, H as PaymentScheduleItemSchema, Ht as defineWebsiteSDKOptions, I as ErgoPolicyNumberRequestSchema, It as selectCancellationPolicyEffect, J as QuoteServiceSchema, K as QuotePricesResponseSchema, L as ErgoReadPreContractRequestSchema, Lt as selectInsuranceEffect, M as ErgoCommonFieldsSchema, Mt as mapSearchEffect, N as ErgoCreatePreContractRequestSchema, Nt as quoteEffect, O as DocumentTypeSchema, Ot as getInitialAvailabilityEffect, P as ErgoPersonSchema, Pt as removeAdditionalServiceEffect, Q as RoomImageSchema, R as ErgoTripAndCustomerRequestSchema, Rt as selectInsurancePaymentEffect, S as DocumentCollectionResponseSchema, St as bookEffect, T as DocumentStatusSchema, Tt as createInsurancePreContractEffect, U as PaymentScheduleSchema, Ut as defineV9PropertyHighlightSources, V as OnOfficeUnitSchema, Vt as submitPaymentOptionEffect, W as QuoteLineSchema, Wt as defineV9PropertyHighlightSourcesFromUnknown, X as RawVofficeObjectSchema, Y as RawObjectResponseSchema, Z as RegionListResponseSchema, _ as ApiEnvelopeBaseSchema, _t as V1_BASE_URL, at as SetupResponseSchema, b as CurrentMemberResponseSchema, bt as decodeV1OperationResponse, ct as TileTagSchema, d as makeV0OpenApiClientFetchLive, dt as UnitIdsResponseSchema, et as ServiceBeonDataSchema, f as makeV0OpenApiClientLive, ft as UnitListItemSchema, g as makeV1OpenApiClientLive, gt as UnitServicePriceSchema, h as makeV1OpenApiClientFetchLive, ht as UnitResponseSchema, it as SetupDataSchema, j as ErgoBookRequestSchema, jt as getTermsAndPrivacyPolicyEffect, k as ErgoAddressSchema, kt as getRentalsEffect, l as V0OpenApiClient, lt as TravelInsuranceBookingSchema, m as V1OpenApiClientError, mt as UnitOfferSchema, nt as ServiceLimitSchema, ot as TileCollectionResponseSchema, p as V1OpenApiClient, pt as UnitListResponseSchema, q as QuoteSchema, rt as ServiceListResponseSchema, st as TileSchema, t as createWebsiteSDK, tt as ServiceImageSchema, u as V0OpenApiClientError, ut as TravelInsuranceBookingStoreRequestSchema, v as CalendarDaySchema, vt as V1_OPERATIONS, w as DocumentResourceSchema, wt as clearAdditionalServicesEffect, x as CustomerUnitSummarySchema, xt as addAdditionalServiceEffect, y as CalendarResponseSchema, yt as VideoResponseSchema, z as FacilityListResponseSchema, zt as submitContactEffect } from "./client-0Lgv-Gb_.mjs";
1
+ import { $ as SearchPropertiesResponseSchema, A as ErgoBankSchema, At as getStartDateSelectedAvailabilityEffect, B as OnOfficeUnitCollectionResponseSchema, Bt as submitPaymentOption, C as DocumentResourceResponseSchema, Ct as bookInsuranceEffect, D as DocumentSummarySchema, Dt as getFiltersEffect, E as DocumentStatusUpdateRequestSchema, Et as getBankTransferDetailsEffect, F as ErgoPlanSearchRequestSchema, Ft as searchEffect, G as QuotePricesPayloadSchema, H as PaymentScheduleItemSchema, Ht as defineWebsiteSDKOptions, I as ErgoPolicyNumberRequestSchema, It as selectCancellationPolicyEffect, J as QuoteServiceSchema, K as QuotePricesResponseSchema, L as ErgoReadPreContractRequestSchema, Lt as selectInsuranceEffect, M as ErgoCommonFieldsSchema, Mt as mapSearchEffect, N as ErgoCreatePreContractRequestSchema, Nt as quoteEffect, O as DocumentTypeSchema, Ot as getInitialAvailabilityEffect, P as ErgoPersonSchema, Pt as removeAdditionalServiceEffect, Q as RoomImageSchema, R as ErgoTripAndCustomerRequestSchema, Rt as selectInsurancePaymentEffect, S as DocumentCollectionResponseSchema, St as bookEffect, T as DocumentStatusSchema, Tt as createInsurancePreContractEffect, U as PaymentScheduleSchema, Ut as defineV9PropertyHighlightSources, V as OnOfficeUnitSchema, Vt as submitPaymentOptionEffect, W as QuoteLineSchema, Wt as defineV9PropertyHighlightSourcesFromUnknown, X as RawVofficeObjectSchema, Y as RawObjectResponseSchema, Z as RegionListResponseSchema, _ as ApiEnvelopeBaseSchema, _t as V1_BASE_URL, at as SetupResponseSchema, b as CurrentMemberResponseSchema, bt as decodeV1OperationResponse, ct as TileTagSchema, d as makeV0OpenApiClientFetchLive, dt as UnitIdsResponseSchema, et as ServiceBeonDataSchema, f as makeV0OpenApiClientLive, ft as UnitListItemSchema, g as makeV1OpenApiClientLive, gt as UnitServicePriceSchema, h as makeV1OpenApiClientFetchLive, ht as UnitResponseSchema, it as SetupDataSchema, j as ErgoBookRequestSchema, jt as getTermsAndPrivacyPolicyEffect, k as ErgoAddressSchema, kt as getRentalsEffect, l as V0OpenApiClient, lt as TravelInsuranceBookingSchema, m as V1OpenApiClientError, mt as UnitOfferSchema, nt as ServiceLimitSchema, ot as TileCollectionResponseSchema, p as V1OpenApiClient, pt as UnitListResponseSchema, q as QuoteSchema, rt as ServiceListResponseSchema, st as TileSchema, t as createWebsiteSDK, tt as ServiceImageSchema, u as V0OpenApiClientError, ut as TravelInsuranceBookingStoreRequestSchema, v as CalendarDaySchema, vt as V1_OPERATIONS, w as DocumentResourceSchema, wt as clearAdditionalServicesEffect, x as CustomerUnitSummarySchema, xt as addAdditionalServiceEffect, y as CalendarResponseSchema, yt as VideoResponseSchema, z as FacilityListResponseSchema, zt as submitContactEffect } from "./client-DB3QXXOo.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/2.27.0/CHANGELOG.md`: release notes for 2.27.0
8
+ - `versions/2.26.0/CHANGELOG.md`: release notes for 2.26.0
7
9
  - `versions/2.25.0/CHANGELOG.md`: release notes for 2.25.0
8
10
  - `versions/2.24.1/CHANGELOG.md`: release notes for 2.24.1
9
11
  - `versions/2.24.0/CHANGELOG.md`: release notes for 2.24.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/2.27.0/MIGRATION.md`: Migration: 2.26.0 to 2.27.0
8
+ - `versions/2.26.0/MIGRATION.md`: Migration: 2.25.0 to 2.26.0
7
9
  - `versions/2.25.0/MIGRATION.md`: Migration: 2.24.1 to 2.25.0
8
10
  - `versions/2.24.1/MIGRATION.md`: Migration: 2.24.0 to 2.24.1
9
11
  - `versions/2.24.0/MIGRATION.md`: Migration: 2.23.0 to 2.24.0
@@ -10,7 +10,7 @@ Use this directory as the consumer-facing reference for the package:
10
10
  - `rentals.md`: `sdk.static.rentals.getRentals`.
11
11
  - `filter.md`: `sdk.static.filter.getFilters`.
12
12
  - `custom-attributes.md`: custom attribute catalog, configuration, per-backend behaviour, and the v9-to-v10 move.
13
- - `search.md`: `sdk.live.search.search`.
13
+ - `search.md`: `sdk.live.search.search` and, on v9, `sdk.live.search.searchPages`.
14
14
  - `availability.md`: date-picker availability flows.
15
15
  - `quote.md`: quote booking-card modifiers, additional services, cancellation policy, and insurance flows.
16
16
  - `booking.md`: booking, payment option submission, and
@@ -207,7 +207,49 @@ Use `rentalIdsIn` to restrict results to specific rental IDs. This option is cur
207
207
  Use `voucher` to price v10 search results with a voucher code. This option is currently supported by `v10` only.
208
208
  For v10, `pets` is a mapped BooleanFilter exposed by `getFilters` and maps to one pet; use `petsCount` for an exact count and do not send both keys in one query.
209
209
 
210
- `limit` defaults to `20`. Treat `cursor` as opaque and pass back `pageInfo.nextCursor` unchanged.
210
+ `limit` defaults to `20`. Treat `cursor` as opaque and pass back `pageInfo.nextCursor` unchanged,
211
+ with the same `limit` as the call that returned it: the cursor points into pages of that size.
212
+
213
+ ### v9: at most 128 priced results per request
214
+
215
+ The v9 hub prices at most the first 128 results of one request. It answers a larger
216
+ `limit` without an error, but every result past position 128 comes back without
217
+ `formattedTotal` and without `discount`. The SDK handles this for you:
218
+
219
+ - `limit` up to 128: one request, as before.
220
+ - `limit` above 128: the SDK splits the call into hub requests of 128 each, up to
221
+ eight of them in parallel. The promise resolves once every request has answered,
222
+ with all results merged and priced. `search({ limit: 1500 })` is one unpriced
223
+ count request plus up to 13 priced requests of 128 (12 for the first page; later
224
+ pages start mid-way into a hub page) and returns up to 1,500 priced results. If a
225
+ booking shifts the results while the requests run, the SDK fetches the call once
226
+ more. `pageInfo` and `nextCursor` behave as for any other `limit`. For the search
227
+ rate limit the whole call counts as one request.
228
+
229
+ To show the first results while the rest still loads, use `searchPages` (v9 only). It
230
+ yields the search page by page, 128 priced results per page, and ends after the last
231
+ page:
232
+
233
+ ```ts
234
+ for await (const page of sdk.live.search.searchPages({ locale: "de-DE", query })) {
235
+ renderCards(page.items, page.alternatives);
236
+ }
237
+ ```
238
+
239
+ - An SDK whose config can be v9 or v10 has `searchPages` only after
240
+ `if (sdk.backend === "v9")`.
241
+ - The input is the `search` input without `cursor` and `limit`; the SDK pages itself.
242
+ - Every page is one `search` call and counts as one request for the rate limit, so
243
+ the SDK starts at most one page per second.
244
+ - A rental appears on one page only, even when a booking moves it between two pages.
245
+ - Each page carries its own `pageInfo`; `pageInfo.totalCount` is the total over all
246
+ pages.
247
+ - Not available with `searchAllRentalsAtOnce: true`; the loop then rejects with a
248
+ `CoreSDKError` whose `operation` is `search.searchPages`.
249
+
250
+ Use `search` with a large `limit` when the page needs every result before it renders
251
+ (a sorted list, a map with prices). Use `searchPages` when the first cards should
252
+ appear before the last page is priced.
211
253
 
212
254
  ## Sorting
213
255
 
@@ -486,7 +528,8 @@ if (map.totalCount <= SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS) {
486
528
  }
487
529
  ```
488
530
 
489
- In this mode a `search` call is one backend request, whatever its `limit`.
531
+ In this mode a `search` call is one backend request, whatever its `limit`, except on
532
+ v9 above a `limit` of 128 (see [v9: at most 128 priced results per request](#v9-at-most-128-priced-results-per-request)).
490
533
 
491
534
  ### How each backend does it
492
535
 
@@ -497,7 +540,9 @@ In this mode a `search` call is one backend request, whatever its `limit`.
497
540
  requested. When a booking between the requests moves rentals across page
498
541
  boundaries, the pages disagree with the count; the SDK then asks for all results in
499
542
  one request, a consistent snapshot, instead of returning a set with a gap. `mapSearch` selects no prices and loads up to 1,000 matches per request,
500
- as many requests as the matches need.
543
+ as many requests as the matches need. A paged `search` above a `limit` of 128 counts
544
+ the matches without prices first, then fetches the window as requests of 128, at
545
+ most eight at a time.
501
546
  - v10 answers the whole result set in one request. `searchAllRentalsAtOnce` asks for
502
547
  101 results and refuses the search when the response total is above 100.
503
548
  `mapSearch` is one request without prices that returns only the location, for up
@@ -0,0 +1,33 @@
1
+ # Changelog: 2.26.0
2
+
3
+ A v9 search with a `limit` above 128 now returns every result with its price. The v9 hub
4
+ prices at most the first 128 results of one request and returns the rest without a price and
5
+ without an error, so a search with `limit: 1000` showed prices and discounts for 128 rentals
6
+ only.
7
+
8
+ ## Added
9
+
10
+ - `sdk.live.search.searchPages(input)` on v9: an `AsyncIterable` that yields the search page
11
+ by page, 128 priced results per page, so a list can show the first cards while the next
12
+ page loads. The input is the `search` input without `cursor` and `limit`. A rental appears
13
+ on one page only. Every page counts as one request for the search rate limit. Not available
14
+ with `searchAllRentalsAtOnce: true`; the loop then rejects with the `operation`
15
+ `search.searchPages`.
16
+ - Type `V9SearchPagesInput`.
17
+
18
+ ## Fixed
19
+
20
+ - v9 `sdk.live.search.search` with a `limit` above 128 prices every result. The SDK fetches
21
+ the results as hub requests of 128, up to eight in parallel, and returns them merged, each
22
+ rental once. If a booking shifts the results while the requests run, the SDK fetches the
23
+ call once more. `pageInfo` and `nextCursor` behave as for any other `limit`: the cursor
24
+ continues with the same `limit`. The call counts as one request for the search rate limit.
25
+ - Errors from the v9 backend code report `source: "v9"`: every error from the hub and the v9
26
+ errors of search, rentals, quote, booking, availability, contact and config. Most of them
27
+ reported `source: "v10"`. Errors from code both backends share, such as payment
28
+ submission, keep `source: "core"`. The two errors for a service the SDK runtime does not
29
+ provide, with the `operation` `booking.getBankTransferDetails` or `search.mapSearch`, now
30
+ report `source: "core"` as well.
31
+
32
+ A v9 search with a `limit` up to 128 is unchanged: one request, the same cursor. Search on v10
33
+ is unchanged.
@@ -0,0 +1,31 @@
1
+ # Migration: 2.25.0 to 2.26.0
2
+
3
+ ## 1. Upgrade
4
+
5
+ ```sh
6
+ pnpm add @v-office/website-sdk@2.26.0
7
+ ```
8
+
9
+ No changes are required, except for code that checks `error.source` on a v9 site (below).
10
+ On a v9 site, a search with a `limit` above 128 now returns prices and discounts for every
11
+ result instead of the first 128. A site that worked around this by paging with a `limit` of
12
+ 128 or less can keep doing so.
13
+
14
+ Errors from the v9 backend code, such as every error from the hub, now report `source: "v9"`
15
+ instead of `"v10"`. Code that recognizes them by `error.source === "v10"` checks `"v9"`
16
+ instead. Errors from code both backends share, such as payment submission, still report
17
+ `source: "core"`; leave checks for `"core"` as they are.
18
+
19
+ ## 2. Optional: show the first results sooner on a v9 site
20
+
21
+ A search with a large `limit` answers once every result is priced. To render the first cards
22
+ earlier, loop over `searchPages` instead:
23
+
24
+ ```ts
25
+ for await (const page of sdk.live.search.searchPages({ locale: "de-DE", query })) {
26
+ renderCards(page.items, page.alternatives);
27
+ }
28
+ ```
29
+
30
+ Keep `search` with a large `limit` where the page needs every result before it renders, for
31
+ example a list sorted on the client or a map with prices.
@@ -0,0 +1,26 @@
1
+ # Changelog: 2.27.0
2
+
3
+ The platform needs the token and the options a website really uses its SDK with, to keep the
4
+ website's public token current and to use the SDK on the site's behalf the same way. Like the
5
+ backend since 2.24.0, it reads them from the one place where they are final: what
6
+ `createWebsiteSDK` was constructed with. This release records them for the build's site manifest
7
+ (`@v-office/site-manifest` 0.2.0).
8
+
9
+ ## Added
10
+
11
+ - `createWebsiteSDK` records the `config` and `options` of every SDK it constructs, once the
12
+ config was accepted, as JSON in a set under
13
+ `globalThis[Symbol.for("@v-office/website-sdk/sdks")]`. Only the top-level config and
14
+ option fields the SDK reads are recorded, their values as passed: a property it ignores (a
15
+ spread settings object, environment variables) is left out and never reaches the manifest. Identical constructions are one entry,
16
+ whatever the order of their keys: the JSON lists each object's keys sorted, arrays as given.
17
+ The set exists as soon as the SDK is loaded, so an empty set means none was constructed.
18
+ `@v-office/site-manifest` writes it to `dist/site-manifest.json` as `websiteSdks`. A config the
19
+ SDK refuses records nothing. A construction whose fields are not JSON (a cycle or a BigInt in a
20
+ field the SDK reads) does not fail the SDK and records `"unrecordable"`
21
+ instead, so the manifest does not report the others as if they were all.
22
+
23
+ ## Changed
24
+
25
+ - Nothing else. The record has no effect on what the SDK does, needs no import and is safe in a
26
+ browser bundle. It holds the public token the config already carries into the bundle.
@@ -0,0 +1,10 @@
1
+ # Migration: 2.26.0 to 2.27.0
2
+
3
+ ## 1. Upgrade
4
+
5
+ ```sh
6
+ pnpm add @v-office/website-sdk@2.27.0
7
+ ```
8
+
9
+ No changes are required. To have the token and options reported, the site also needs
10
+ `@v-office/site-manifest` 0.2.0 or later.
@@ -1,4 +1,4 @@
1
- import { Gt as V9_FACILITY_ATTRIBUTE_KEYS } from "./client-0Lgv-Gb_.mjs";
1
+ import { Gt as V9_FACILITY_ATTRIBUTE_KEYS } from "./client-DB3QXXOo.mjs";
2
2
  import { i as VofficeUnitDataPropertyMetadata, l as parseVofficeUnitData, n as VofficeUnitDataPropertyCategoryLabelKeys, o as parseVofficeFacilityData, r as VofficeUnitDataPropertyCategoryValues, s as parseVofficeFeedbackData, t as VofficeUnitDataFieldSchemas } from "./v9-data-C3SWtDGs.mjs";
3
3
  import { a as rentalsAllByFacilityObjectGroupsWithoutFeedbacksQuery, i as rentalIdsQuery, o as rentalsAllFeedbacksQuery, r as rentalFacilitiesForObjectGroupRelationQuery, s as rentalsAllWithoutFeedbacksQuery } from "./operations-DwURbo0b.mjs";
4
4
  import { a as toFacilityImages, c as toLocalizedString, i as toLocation, o as toImages, r as renderVofficePropertyAttribute, s as toAddress, t as toRentalHighlights } from "./to-rental-highlights-BL5m3Uen.mjs";
@@ -1,4 +1,4 @@
1
- import { a as parseQueryParameters, i as collectQueryParameters, n as makeV9CustomAttributeFilterCapabilities, o as toQueryString, r as toBasicQueryInputs, s as applyVofficeFilterDerivedBasicQueryInputs } from "./client-0Lgv-Gb_.mjs";
1
+ import { a as parseQueryParameters, i as collectQueryParameters, n as makeV9CustomAttributeFilterCapabilities, o as toQueryString, r as toBasicQueryInputs, s as applyVofficeFilterDerivedBasicQueryInputs } from "./client-DB3QXXOo.mjs";
2
2
  import { l as parseVofficeUnitData } from "./v9-data-C3SWtDGs.mjs";
3
3
  import { n as searchQuery, t as mapSearchQuery } from "./operations-DwURbo0b.mjs";
4
4
  import { i as toLocation, n as toV9RentalHighlightKey, o as toImages, s as toAddress, t as toRentalHighlights } from "./to-rental-highlights-BL5m3Uen.mjs";
@@ -6,7 +6,7 @@ import { CoreSDKError, STABLE_SEARCH_INPUTS, daysBetweenLocalDates, expandCustom
6
6
  import { Effect } from "effect";
7
7
  //#region src/legacy-v9/parser/search/input/search-input-error.ts
8
8
  const failInvalidV9SearchInput = (message) => Effect.fail(new CoreSDKError({
9
- source: "v10",
9
+ source: "v9",
10
10
  operation: "v9.search",
11
11
  message
12
12
  }));
@@ -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/2.27.0/CHANGELOG.md`: release notes for 2.27.0
8
+ - `versions/2.26.0/CHANGELOG.md`: release notes for 2.26.0
7
9
  - `versions/2.25.0/CHANGELOG.md`: release notes for 2.25.0
8
10
  - `versions/2.24.1/CHANGELOG.md`: release notes for 2.24.1
9
11
  - `versions/2.24.0/CHANGELOG.md`: release notes for 2.24.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/2.27.0/MIGRATION.md`: Migration: 2.26.0 to 2.27.0
8
+ - `versions/2.26.0/MIGRATION.md`: Migration: 2.25.0 to 2.26.0
7
9
  - `versions/2.25.0/MIGRATION.md`: Migration: 2.24.1 to 2.25.0
8
10
  - `versions/2.24.1/MIGRATION.md`: Migration: 2.24.0 to 2.24.1
9
11
  - `versions/2.24.0/MIGRATION.md`: Migration: 2.23.0 to 2.24.0
@@ -10,7 +10,7 @@ Use this directory as the consumer-facing reference for the package:
10
10
  - `rentals.md`: `sdk.static.rentals.getRentals`.
11
11
  - `filter.md`: `sdk.static.filter.getFilters`.
12
12
  - `custom-attributes.md`: custom attribute catalog, configuration, per-backend behaviour, and the v9-to-v10 move.
13
- - `search.md`: `sdk.live.search.search`.
13
+ - `search.md`: `sdk.live.search.search` and, on v9, `sdk.live.search.searchPages`.
14
14
  - `availability.md`: date-picker availability flows.
15
15
  - `quote.md`: quote booking-card modifiers, additional services, cancellation policy, and insurance flows.
16
16
  - `booking.md`: booking, payment option submission, and
@@ -207,7 +207,49 @@ Use `rentalIdsIn` to restrict results to specific rental IDs. This option is cur
207
207
  Use `voucher` to price v10 search results with a voucher code. This option is currently supported by `v10` only.
208
208
  For v10, `pets` is a mapped BooleanFilter exposed by `getFilters` and maps to one pet; use `petsCount` for an exact count and do not send both keys in one query.
209
209
 
210
- `limit` defaults to `20`. Treat `cursor` as opaque and pass back `pageInfo.nextCursor` unchanged.
210
+ `limit` defaults to `20`. Treat `cursor` as opaque and pass back `pageInfo.nextCursor` unchanged,
211
+ with the same `limit` as the call that returned it: the cursor points into pages of that size.
212
+
213
+ ### v9: at most 128 priced results per request
214
+
215
+ The v9 hub prices at most the first 128 results of one request. It answers a larger
216
+ `limit` without an error, but every result past position 128 comes back without
217
+ `formattedTotal` and without `discount`. The SDK handles this for you:
218
+
219
+ - `limit` up to 128: one request, as before.
220
+ - `limit` above 128: the SDK splits the call into hub requests of 128 each, up to
221
+ eight of them in parallel. The promise resolves once every request has answered,
222
+ with all results merged and priced. `search({ limit: 1500 })` is one unpriced
223
+ count request plus up to 13 priced requests of 128 (12 for the first page; later
224
+ pages start mid-way into a hub page) and returns up to 1,500 priced results. If a
225
+ booking shifts the results while the requests run, the SDK fetches the call once
226
+ more. `pageInfo` and `nextCursor` behave as for any other `limit`. For the search
227
+ rate limit the whole call counts as one request.
228
+
229
+ To show the first results while the rest still loads, use `searchPages` (v9 only). It
230
+ yields the search page by page, 128 priced results per page, and ends after the last
231
+ page:
232
+
233
+ ```ts
234
+ for await (const page of sdk.live.search.searchPages({ locale: "de-DE", query })) {
235
+ renderCards(page.items, page.alternatives);
236
+ }
237
+ ```
238
+
239
+ - An SDK whose config can be v9 or v10 has `searchPages` only after
240
+ `if (sdk.backend === "v9")`.
241
+ - The input is the `search` input without `cursor` and `limit`; the SDK pages itself.
242
+ - Every page is one `search` call and counts as one request for the rate limit, so
243
+ the SDK starts at most one page per second.
244
+ - A rental appears on one page only, even when a booking moves it between two pages.
245
+ - Each page carries its own `pageInfo`; `pageInfo.totalCount` is the total over all
246
+ pages.
247
+ - Not available with `searchAllRentalsAtOnce: true`; the loop then rejects with a
248
+ `CoreSDKError` whose `operation` is `search.searchPages`.
249
+
250
+ Use `search` with a large `limit` when the page needs every result before it renders
251
+ (a sorted list, a map with prices). Use `searchPages` when the first cards should
252
+ appear before the last page is priced.
211
253
 
212
254
  ## Sorting
213
255
 
@@ -486,7 +528,8 @@ if (map.totalCount <= SEARCH_ALL_RENTALS_AT_ONCE_MAX_RESULTS) {
486
528
  }
487
529
  ```
488
530
 
489
- In this mode a `search` call is one backend request, whatever its `limit`.
531
+ In this mode a `search` call is one backend request, whatever its `limit`, except on
532
+ v9 above a `limit` of 128 (see [v9: at most 128 priced results per request](#v9-at-most-128-priced-results-per-request)).
490
533
 
491
534
  ### How each backend does it
492
535
 
@@ -497,7 +540,9 @@ In this mode a `search` call is one backend request, whatever its `limit`.
497
540
  requested. When a booking between the requests moves rentals across page
498
541
  boundaries, the pages disagree with the count; the SDK then asks for all results in
499
542
  one request, a consistent snapshot, instead of returning a set with a gap. `mapSearch` selects no prices and loads up to 1,000 matches per request,
500
- as many requests as the matches need.
543
+ as many requests as the matches need. A paged `search` above a `limit` of 128 counts
544
+ the matches without prices first, then fetches the window as requests of 128, at
545
+ most eight at a time.
501
546
  - v10 answers the whole result set in one request. `searchAllRentalsAtOnce` asks for
502
547
  101 results and refuses the search when the response total is above 100.
503
548
  `mapSearch` is one request without prices that returns only the location, for up
@@ -0,0 +1,33 @@
1
+ # Changelog: 2.26.0
2
+
3
+ A v9 search with a `limit` above 128 now returns every result with its price. The v9 hub
4
+ prices at most the first 128 results of one request and returns the rest without a price and
5
+ without an error, so a search with `limit: 1000` showed prices and discounts for 128 rentals
6
+ only.
7
+
8
+ ## Added
9
+
10
+ - `sdk.live.search.searchPages(input)` on v9: an `AsyncIterable` that yields the search page
11
+ by page, 128 priced results per page, so a list can show the first cards while the next
12
+ page loads. The input is the `search` input without `cursor` and `limit`. A rental appears
13
+ on one page only. Every page counts as one request for the search rate limit. Not available
14
+ with `searchAllRentalsAtOnce: true`; the loop then rejects with the `operation`
15
+ `search.searchPages`.
16
+ - Type `V9SearchPagesInput`.
17
+
18
+ ## Fixed
19
+
20
+ - v9 `sdk.live.search.search` with a `limit` above 128 prices every result. The SDK fetches
21
+ the results as hub requests of 128, up to eight in parallel, and returns them merged, each
22
+ rental once. If a booking shifts the results while the requests run, the SDK fetches the
23
+ call once more. `pageInfo` and `nextCursor` behave as for any other `limit`: the cursor
24
+ continues with the same `limit`. The call counts as one request for the search rate limit.
25
+ - Errors from the v9 backend code report `source: "v9"`: every error from the hub and the v9
26
+ errors of search, rentals, quote, booking, availability, contact and config. Most of them
27
+ reported `source: "v10"`. Errors from code both backends share, such as payment
28
+ submission, keep `source: "core"`. The two errors for a service the SDK runtime does not
29
+ provide, with the `operation` `booking.getBankTransferDetails` or `search.mapSearch`, now
30
+ report `source: "core"` as well.
31
+
32
+ A v9 search with a `limit` up to 128 is unchanged: one request, the same cursor. Search on v10
33
+ is unchanged.
@@ -0,0 +1,31 @@
1
+ # Migration: 2.25.0 to 2.26.0
2
+
3
+ ## 1. Upgrade
4
+
5
+ ```sh
6
+ pnpm add @v-office/website-sdk@2.26.0
7
+ ```
8
+
9
+ No changes are required, except for code that checks `error.source` on a v9 site (below).
10
+ On a v9 site, a search with a `limit` above 128 now returns prices and discounts for every
11
+ result instead of the first 128. A site that worked around this by paging with a `limit` of
12
+ 128 or less can keep doing so.
13
+
14
+ Errors from the v9 backend code, such as every error from the hub, now report `source: "v9"`
15
+ instead of `"v10"`. Code that recognizes them by `error.source === "v10"` checks `"v9"`
16
+ instead. Errors from code both backends share, such as payment submission, still report
17
+ `source: "core"`; leave checks for `"core"` as they are.
18
+
19
+ ## 2. Optional: show the first results sooner on a v9 site
20
+
21
+ A search with a large `limit` answers once every result is priced. To render the first cards
22
+ earlier, loop over `searchPages` instead:
23
+
24
+ ```ts
25
+ for await (const page of sdk.live.search.searchPages({ locale: "de-DE", query })) {
26
+ renderCards(page.items, page.alternatives);
27
+ }
28
+ ```
29
+
30
+ Keep `search` with a large `limit` where the page needs every result before it renders, for
31
+ example a list sorted on the client or a map with prices.
@@ -0,0 +1,3 @@
1
+ {
2
+ "componentsAffectedByHeadlessChange": []
3
+ }
@@ -0,0 +1,26 @@
1
+ # Changelog: 2.27.0
2
+
3
+ The platform needs the token and the options a website really uses its SDK with, to keep the
4
+ website's public token current and to use the SDK on the site's behalf the same way. Like the
5
+ backend since 2.24.0, it reads them from the one place where they are final: what
6
+ `createWebsiteSDK` was constructed with. This release records them for the build's site manifest
7
+ (`@v-office/site-manifest` 0.2.0).
8
+
9
+ ## Added
10
+
11
+ - `createWebsiteSDK` records the `config` and `options` of every SDK it constructs, once the
12
+ config was accepted, as JSON in a set under
13
+ `globalThis[Symbol.for("@v-office/website-sdk/sdks")]`. Only the top-level config and
14
+ option fields the SDK reads are recorded, their values as passed: a property it ignores (a
15
+ spread settings object, environment variables) is left out and never reaches the manifest. Identical constructions are one entry,
16
+ whatever the order of their keys: the JSON lists each object's keys sorted, arrays as given.
17
+ The set exists as soon as the SDK is loaded, so an empty set means none was constructed.
18
+ `@v-office/site-manifest` writes it to `dist/site-manifest.json` as `websiteSdks`. A config the
19
+ SDK refuses records nothing. A construction whose fields are not JSON (a cycle or a BigInt in a
20
+ field the SDK reads) does not fail the SDK and records `"unrecordable"`
21
+ instead, so the manifest does not report the others as if they were all.
22
+
23
+ ## Changed
24
+
25
+ - Nothing else. The record has no effect on what the SDK does, needs no import and is safe in a
26
+ browser bundle. It holds the public token the config already carries into the bundle.
@@ -0,0 +1,10 @@
1
+ # Migration: 2.26.0 to 2.27.0
2
+
3
+ ## 1. Upgrade
4
+
5
+ ```sh
6
+ pnpm add @v-office/website-sdk@2.27.0
7
+ ```
8
+
9
+ No changes are required. To have the token and options reported, the site also needs
10
+ `@v-office/site-manifest` 0.2.0 or later.
@@ -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": "2.25.0",
3
+ "version": "2.27.0",
4
4
  "description": "Website-facing SDK facade backed by @v-office/sdk-core",
5
5
  "bin": {
6
6
  "website-sdk": "./dist/cli.mjs"