@v-office/website-sdk 2.28.1 → 2.29.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.
Files changed (36) hide show
  1. package/README.md +8 -0
  2. package/dist/cli.mjs +420 -12
  3. package/dist/{client-EtS0Qm3i.mjs → client-B8cF8Ra1.mjs} +285 -45
  4. package/dist/index.d.mts +36 -4
  5. package/dist/index.mjs +1 -1
  6. package/dist/instructions/CHANGELOG.md +1 -0
  7. package/dist/instructions/MIGRATION.md +1 -0
  8. package/dist/instructions/README.md +3 -2
  9. package/dist/instructions/creation.md +35 -4
  10. package/dist/instructions/custom-attributes.md +2 -2
  11. package/dist/instructions/filter.md +5 -3
  12. package/dist/instructions/quote.md +1 -1
  13. package/dist/instructions/rentals.md +36 -0
  14. package/dist/instructions/search.md +214 -6
  15. package/dist/instructions/versions/2.29.0/CHANGELOG.md +62 -0
  16. package/dist/instructions/versions/2.29.0/MIGRATION.md +97 -0
  17. package/dist/{v9-data-C3SWtDGs.mjs → operations-CfjJjdrw.mjs} +3122 -1
  18. package/dist/{rentals-B4g91vwW.mjs → rentals-DvYUm25t.mjs} +4 -5
  19. package/dist/{search-B-lvOmXL.mjs → search-BkrzAC9w.mjs} +6 -5
  20. package/dist/{to-rental-highlights-BL5m3Uen.mjs → to-rental-highlights-D7oepO6s.mjs} +1 -1
  21. package/dist/translations/v9/de-DE/core.json +8 -1
  22. package/dist/translations/v9/en-US/core.json +8 -1
  23. package/instructions/CHANGELOG.md +1 -0
  24. package/instructions/MIGRATION.md +1 -0
  25. package/instructions/README.md +3 -2
  26. package/instructions/creation.md +35 -4
  27. package/instructions/custom-attributes.md +2 -2
  28. package/instructions/filter.md +5 -3
  29. package/instructions/quote.md +1 -1
  30. package/instructions/rentals.md +36 -0
  31. package/instructions/search.md +214 -6
  32. package/instructions/versions/2.29.0/CHANGELOG.md +62 -0
  33. package/instructions/versions/2.29.0/MIGRATION.md +97 -0
  34. package/instructions/versions/2.29.0/release.json +3 -0
  35. package/package.json +5 -3
  36. package/dist/operations-DwURbo0b.mjs +0 -2850
@@ -0,0 +1,62 @@
1
+ # Changelog: 2.29.0
2
+
3
+ On v9, the search can filter by object group, facility and special offer, a rental scope can
4
+ name an object group, and the SDK gets a favourites list and voucher support. A v9 site with a
5
+ rental scope needs one setup step before its next build; see `MIGRATION.md`.
6
+
7
+ ## Added
8
+
9
+ - v9 filters beyond the built-in ones: a `backendFilter` definition works once the be-on! Hub
10
+ has a matching entry for the site's be-on key. The fixed keys are `objectGroup` (vOffice
11
+ object group ID), `facility_search` (vOffice facility ID, not `rental.property.id`), `offers`
12
+ (any special offer) and `offer` (one offer ID). The SDK cannot create a Hub entry, a be-on!
13
+ developer adds it. Without the entry the filter does not filter, and a search with only
14
+ that filter and no period or guests returns no rentals.
15
+ - CLI `website-sdk hub-filters request` writes a Markdown file for a be-on! developer with the
16
+ Hub entries a site needs, and prints the matching `backendFilter` definitions. Flags:
17
+ `--object-group`, `--facility`, `--offers`, `--offer`, `--unit`, `--out`. A rental scope or
18
+ `rentalIdsSearch` adds its key. With environment configuration, the CLI reads the two v9
19
+ settings from the new optional `HUB_RENTAL_SCOPE_PROPERTY_KIND` and `HUB_RENTAL_IDS_SEARCH`.
20
+ - CLI `website-sdk hub-filters check` reports which required Hub entries are missing and exits
21
+ non-zero when one is.
22
+ - v9 config `rentalScopePropertyKind: "facility" | "objectGroup"`, default `"facility"`. With
23
+ `"objectGroup"`, `rentalScope.propertyId` is an object group ID: `getRentals` keeps its
24
+ members and the search filters by it. `rental.property` stays a facility.
25
+ - v9 `sdk.live.rentals.getRentalsByIds({ locale, rentalIds })` loads the rentals with the
26
+ given IDs, for a favourites page. It returns the same items as `getRentals`, in the order
27
+ of `rentalIds`, without duplicates. An ID that is unknown, not numeric or outside the rental
28
+ scope is left out without an error. It needs no Hub entry.
29
+ - v9 config `rentalIdsSearch: true` (default `false`) lets the v9 search take `rentalIdsIn`,
30
+ for favourites that combine with other search filters. It needs a Hub entry. An empty
31
+ `rentalIdsIn` array does not restrict the search.
32
+ - v9 search takes `voucher` and prices the results with that code. It does not narrow the
33
+ results. `mapSearch` takes no voucher.
34
+ - v9 `sdk.live.voucher.validate({ code, start?, end?, locale })` returns
35
+ `{ valid, reason, label }`. `reason` is `valid`, `not_yet_valid`, `expired`, `unknown`,
36
+ `stay_too_short`, `outside_booking_window` or `rate_limited`; `label` is a sentence in the
37
+ `locale`. The Hub allows 10 checks per minute and 60 per hour.
38
+ - CLI commands `rentals-by-ids` and `voucher validate` for v9, and `search --voucher` and
39
+ `search --rental-ids-in` on v9.
40
+
41
+ ## Changed
42
+
43
+ - A v9 search now applies the rental scope. Before, a facility scope made a search with a period
44
+ or guests fail, and any other search returned all rentals. The scope works with and without a
45
+ period and combines with other filters.
46
+ - `getRentals` on v9 fails the build when a rental scope is set and the Hub lacks the entry the
47
+ scope needs, or when `rentalIdsSearch` is on and the Hub lacks the `voffice_id` entry. The
48
+ error names the missing key. A previously working facility scope hits this until the Hub
49
+ entry exists. A facility scope next to `facilityObjectGroupRelationAttributeId` also fails
50
+ the build; see `MIGRATION.md`.
51
+ - A v9 search with `rentalIdsIn` throws unless `rentalIdsSearch` is `true`. Before, v9 rejected
52
+ the option in its type.
53
+ - Creating a v9 SDK throws when a `backendFilter` uses the key `voffice_id`, `facility_scope`
54
+ or `objectGroup_scope`. The SDK sets these itself.
55
+ - v9 `rentalScope.propertyId` must be a positive decimal integer up to 2147483647. Values such
56
+ as `"1e2"`, `"0x10"`, `"-5"` or `"0"` used to be read as numbers and now make the SDK throw at
57
+ creation, like any other invalid scope.
58
+ - An `int` `backendFilter` on v9 takes decimal digits up to 2147483647, such as an `offer` ID.
59
+ Values such as `"1e2"`, `"0x10"`, `"2.0"` or `"2147483648"` used to be read as numbers; now
60
+ the search leaves the filter out, as with any other invalid value.
61
+
62
+ v10 is unchanged.
@@ -0,0 +1,97 @@
1
+ # Migration: 2.28.1 to 2.29.0
2
+
3
+ ## 1. Upgrade
4
+
5
+ ```sh
6
+ pnpm add @v-office/website-sdk@2.29.0
7
+ ```
8
+
9
+ v10 sites need no changes. A v9 site without a rental scope needs none either, unless it hits
10
+ step 3. A v9 site with a rental scope must do step 2 before its next build.
11
+
12
+ ## 2. v9 with a rental scope: add the Hub entry
13
+
14
+ The search now sends the scope to the be-on! Hub as a filter, so the Hub needs an entry for it:
15
+ `facility_scope` for a facility scope, `objectGroup_scope` for an object group scope. Until the
16
+ entry exists, `getRentals` fails the build and names the missing key. The check protects the
17
+ site: without the entry, the search would not respect the scope.
18
+
19
+ 1. Put the `rentalScope` into an options file. If you set `rentalScopePropertyKind`, pass
20
+ it to the CLI too: in a `--config` file, or as `HUB_RENTAL_SCOPE_PROPERTY_KIND` next to the
21
+ other `HUB_*` variables.
22
+ 2. Write the request:
23
+
24
+ ```sh
25
+ website-sdk --backend v9 --config ./website-sdk-config.json --options ./website-sdk-options.json hub-filters request
26
+ ```
27
+
28
+ 3. Hand the written `hub-filter-request.md` to a be-on! developer.
29
+ 4. After they saved the entries, confirm them. The command exits non-zero while one is missing:
30
+
31
+ ```sh
32
+ website-sdk --backend v9 --config ./website-sdk-config.json --options ./website-sdk-options.json hub-filters check
33
+ ```
34
+
35
+ A site with a facility scope that also sets `facilityObjectGroupRelationAttributeId` fails the
36
+ build: its listings would use the facilities derived from object groups, its search the facility
37
+ stored on each rental. If the facilities are maintained on the rentals in vOffice, remove
38
+ `facilityObjectGroupRelationAttributeId`. Otherwise set `rentalScopePropertyKind: "objectGroup"`,
39
+ put the object group ID into `rentalScope.propertyId`, and request `objectGroup_scope` instead of
40
+ `facility_scope`.
41
+
42
+ ## 3. Check your configuration
43
+
44
+ The SDK now refuses to start in two cases that 2.28.1 accepted:
45
+
46
+ - `rentalScope.propertyId` must be a positive decimal integer up to 2147483647, such as
47
+ `"20748"`. Values like `"1e2"`, `"0x10"`, `"-5"`, `"0"` or `"7.0"` used to be read as numbers;
48
+ write the plain ID instead.
49
+ - A `backendFilter` in `customAttributeFilterDefinitions` cannot use the key `voffice_id`,
50
+ `facility_scope` or `objectGroup_scope`. If the definition is yours, rename it. A renamed
51
+ key needs its own Hub entry to filter anything.
52
+
53
+ ## 4. Optional: filters by object group, facility or special offer
54
+
55
+ Ask for the Hub entries, then add the printed definitions to `customAttributeFilterDefinitions`:
56
+
57
+ ```sh
58
+ website-sdk --backend v9 --config ./website-sdk-config.json hub-filters request --object-group --offers
59
+ ```
60
+
61
+ Without a Hub entry a filter does nothing: alone and without a period it returns no rentals,
62
+ with a period it returns every available rental, and next to another filter it is ignored. See
63
+ `search.md`, "v9: Hub Filters", for the keys and their values.
64
+
65
+ ## 5. Optional: a favourites page
66
+
67
+ Load the saved rentals directly. No Hub entry is needed:
68
+
69
+ ```ts
70
+ if (sdk.backend === "v9") {
71
+ const rentalIds: string[] = JSON.parse(localStorage.getItem("favoredRentalIDs") ?? "[]");
72
+ const rentals = await sdk.live.rentals.getRentalsByIds({ locale: "de-DE", rentalIds });
73
+ }
74
+ ```
75
+
76
+ To also combine favourites with the search filters, set `rentalIdsSearch: true` in the v9 config,
77
+ request the entry with `hub-filters request --unit`, and pass `rentalIdsIn` to the search. Do not
78
+ search with an empty favourites list: an empty `rentalIdsIn` returns all results. The site AI
79
+ should offer this to the user once and ask whether they want it. See `search.md`.
80
+
81
+ ## 6. Optional: vouchers
82
+
83
+ `voucher` now prices a v9 search. To tell a visitor whether a code is usable before the quote:
84
+
85
+ ```ts
86
+ if (sdk.backend === "v9") {
87
+ const { valid, label } = await sdk.live.voucher.validate({
88
+ locale: "de-DE",
89
+ code: "SUMMER26",
90
+ start: "01-08-2026",
91
+ end: "08-08-2026",
92
+ });
93
+ }
94
+ ```
95
+
96
+ Check when the visitor submits the code. The Hub limits checks to 10 per minute and 60 per hour;
97
+ on `rate_limited`, show the label and do not retry right away.