@v-office/website-sdk 3.0.0 → 3.1.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 +3 -3
- package/dist/{client-k4Gjwp60.mjs → client-C6r06QHZ.mjs} +31 -5
- package/dist/index.d.mts +82 -2
- package/dist/index.mjs +1 -1
- package/dist/instructions/CHANGELOG.md +1 -0
- package/dist/instructions/MIGRATION.md +1 -0
- package/dist/instructions/quote.md +17 -0
- package/dist/instructions/rentals.md +46 -6
- package/dist/instructions/search.md +25 -6
- package/dist/instructions/versions/3.1.0/CHANGELOG.md +47 -0
- package/dist/instructions/versions/3.1.0/MIGRATION.md +32 -0
- package/dist/{operations-DMqLD3e2.mjs → operations-Bc3WxjV8.mjs} +79 -3
- package/dist/{rentals-BIL52z4o.mjs → rentals-BP7dfcfg.mjs} +88 -25
- package/dist/{search-Buua-PAS.mjs → search-BvgpkUPo.mjs} +22 -11
- package/dist/{to-rental-highlights-BE6TdXYa.mjs → to-rental-highlights-9AbqVIso.mjs} +68 -32
- package/instructions/CHANGELOG.md +1 -0
- package/instructions/MIGRATION.md +1 -0
- package/instructions/quote.md +17 -0
- package/instructions/rentals.md +46 -6
- package/instructions/search.md +25 -6
- package/instructions/versions/3.1.0/CHANGELOG.md +47 -0
- package/instructions/versions/3.1.0/MIGRATION.md +32 -0
- package/instructions/versions/3.1.0/release.json +3 -0
- package/package.json +3 -3
package/instructions/rentals.md
CHANGED
|
@@ -114,14 +114,54 @@ can mark it as German (`lang="de"`, a note):
|
|
|
114
114
|
Only fields served in another language are listed; `descriptionFallbacks` is omitted when every
|
|
115
115
|
text is in the requested locale, and always for `de-DE`.
|
|
116
116
|
|
|
117
|
+
Images and rooms say the same with one field each: `altFallback` on an image (its `alt` and
|
|
118
|
+
`title` are in that language) and `descriptionFallback` on a room (v10; v9 rooms have no
|
|
119
|
+
description). Both are omitted when the text is in the requested locale.
|
|
120
|
+
|
|
117
121
|
- v10 reads every language of a text and takes the German one when the requested one is empty.
|
|
118
|
-
- v9:
|
|
119
|
-
so
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
- v9: per-language image titles are marked as they are read. The be-on! Hub answers every other
|
|
123
|
+
missing translation with the German text, without saying so: for a locale other than `de-DE`,
|
|
124
|
+
`getRentals` and `getRentalsByIds` also ask the Hub for the German descriptions and image
|
|
125
|
+
captions, and mark every one that is the same. This is one extra Hub query, of the texts alone,
|
|
126
|
+
per 128 rentals (and one facility query with `facilityObjectGroupRelationAttributeId`), only
|
|
127
|
+
for non-German locales.
|
|
128
|
+
|
|
129
|
+
Rental names, region names and attribute texts are not covered. Neither are review category
|
|
130
|
+
names: on v10 they are the questions of the agency's feedback form (`summary.categories[].label`),
|
|
131
|
+
one text per question; on v9 they come from the site's `v9Reviews.criteria` labels. See
|
|
132
|
+
`quote.md` for the quote's texts.
|
|
133
|
+
|
|
134
|
+
### Facts: items with keys
|
|
135
|
+
|
|
136
|
+
Every list of rendered items also states what each item is, the same in every locale:
|
|
137
|
+
|
|
138
|
+
| Items (text) | Facts (key and value) |
|
|
139
|
+
| ------------------------------------ | ------------------------------------------------------------------ |
|
|
140
|
+
| `attributes[].subCategories[].items` | `attributes[].subCategories[].facts` |
|
|
141
|
+
| `vicinity[].items` | `vicinity[].facts` |
|
|
142
|
+
| `highlights` | `highlightFacts` (rentals, their `property`, search items) |
|
|
143
|
+
| `rooms[].attributes` | `rooms[].attributeFacts`; the room type's key is `rooms[].typeKey` |
|
|
144
|
+
|
|
145
|
+
`facts[i]` is `items[i]`: same order, same length.
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
type RentalFact = {
|
|
149
|
+
readonly key: string; // "beachdistance", "wifi", "seaviewType", a custom attribute's key
|
|
150
|
+
readonly text: string; // the item as rendered: "Distance to beach: 300m"
|
|
151
|
+
readonly value?: boolean | number | string; // true, 300, "GOOD"
|
|
152
|
+
};
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
- `key` is the backend's attribute key. v9 states v10's key where v10 has the attribute
|
|
156
|
+
(`loc_lake` becomes `locLake`), so one curated list works on both backends; a v9 attribute
|
|
157
|
+
several v10 attributes share keeps its v9 key (`beds`, `toiletries`).
|
|
158
|
+
- `value` is the raw value: `true` for a feature (v9 sends `1`, the SDK states `true`), a
|
|
159
|
+
number for a count, a distance in meters or an area in m², an option's key on v10 (`GOOD`),
|
|
160
|
+
its index on v9. A free text has no `value`, `text` carries it: a localized text, a v9 text attribute
|
|
161
|
+
and a custom attribute of type `string` change with the locale.
|
|
123
162
|
|
|
124
|
-
|
|
163
|
+
Curate, filter and pick icons by `key`; read distances and counts from `value`. Never match
|
|
164
|
+
`text` or `items`: they change with the locale and with `translationOverrides`.
|
|
125
165
|
|
|
126
166
|
### Capacity
|
|
127
167
|
|
package/instructions/search.md
CHANGED
|
@@ -621,15 +621,26 @@ Returns `Promise<RentalSearchOutput>`.
|
|
|
621
621
|
Priced items and alternative periods share this optional discount shape:
|
|
622
622
|
|
|
623
623
|
```ts
|
|
624
|
+
type SearchMoney = {
|
|
625
|
+
readonly amount: number; // minor unit of the currency: 103339 = €1,033.39
|
|
626
|
+
readonly currency: string;
|
|
627
|
+
};
|
|
628
|
+
|
|
624
629
|
type SearchDiscount = {
|
|
625
630
|
readonly formattedOriginalTotal: string;
|
|
631
|
+
readonly originalTotal?: SearchMoney;
|
|
626
632
|
readonly applied: readonly {
|
|
627
633
|
readonly label: string;
|
|
628
634
|
readonly formattedAmount: string;
|
|
635
|
+
readonly type?: string; // v10 only: EARLY_BIRD, LAST_MINUTE, …
|
|
629
636
|
}[];
|
|
630
637
|
};
|
|
631
638
|
```
|
|
632
639
|
|
|
640
|
+
Next to `formattedTotal`, a priced item or alternative period carries `total` as a
|
|
641
|
+
`SearchMoney`. Compare and calculate with the numbers, never by parsing the formatted
|
|
642
|
+
strings: their separators change with the locale ("1.033,39 €", "€1,033.39").
|
|
643
|
+
|
|
633
644
|
Sample:
|
|
634
645
|
|
|
635
646
|
```json
|
|
@@ -654,12 +665,15 @@ Sample:
|
|
|
654
665
|
],
|
|
655
666
|
"highlights": ["2 bedrooms", "WiFi", "Parking"],
|
|
656
667
|
"formattedTotal": "1.111,00 €",
|
|
668
|
+
"total": { "amount": 111100, "currency": "EUR" },
|
|
657
669
|
"discount": {
|
|
658
670
|
"formattedOriginalTotal": "1.234,00 €",
|
|
671
|
+
"originalTotal": { "amount": 123400, "currency": "EUR" },
|
|
659
672
|
"applied": [
|
|
660
673
|
{
|
|
661
674
|
"label": "Frühbucher-Rabatt",
|
|
662
|
-
"formattedAmount": "-123,00 €"
|
|
675
|
+
"formattedAmount": "-123,00 €",
|
|
676
|
+
"type": "EARLY_BIRD"
|
|
663
677
|
}
|
|
664
678
|
]
|
|
665
679
|
}
|
|
@@ -710,12 +724,17 @@ Sample:
|
|
|
710
724
|
```
|
|
711
725
|
|
|
712
726
|
Search items share the rental base fields and may include `scope`, `address`,
|
|
713
|
-
`capacity` (counts as numbers, see the rentals instructions), `property`, `highlights
|
|
727
|
+
`capacity` (counts as numbers, see the rentals instructions), `property`, `highlights`
|
|
728
|
+
with `highlightFacts` (their keys and values, see "Facts" in the rentals instructions),
|
|
714
729
|
and `formattedTotal`. A priced item or alternative period
|
|
715
730
|
may also include `discount`. When it does, `formattedTotal` is the final price and
|
|
716
731
|
`discount.formattedOriginalTotal` is the price before the applied discounts.
|
|
717
|
-
Discount totals, labels, and amounts are
|
|
718
|
-
|
|
732
|
+
Discount totals, labels, and amounts are localized and formatted for the requested
|
|
733
|
+
locale; `total` and `discount.originalTotal` state the same totals as numbers. On v10,
|
|
734
|
+
each applied discount also states its `type`, which stays the same in every locale while
|
|
735
|
+
its `label` is translated: filter or group campaigns by `type`, not by `label`. v9 states
|
|
736
|
+
no type; its discount `label` is the name entered in the PMS, as the be-on! Hub sends it, in
|
|
737
|
+
the PMS's language (German unless the agency entered English).
|
|
719
738
|
`applied` may be empty when the backend supplies an original total without
|
|
720
739
|
individual modifier lines. Exact-period results are returned in `items`;
|
|
721
740
|
alternative-period suggestions are returned in root-level `alternatives`.
|
|
@@ -895,9 +914,9 @@ shape:
|
|
|
895
914
|
- Empty basic-filter sets are sent as GraphQL `data: null`, allowing an empty
|
|
896
915
|
query to browse the scoped searchable inventory without a dummy occupancy
|
|
897
916
|
value.
|
|
898
|
-
- `calc.total` becomes `formattedTotal
|
|
917
|
+
- `calc.total` becomes `formattedTotal` and `total` (in EUR).
|
|
899
918
|
- `discount` is included only when `calc.oTotal` is greater than `calc.total`.
|
|
900
|
-
- `calc.oTotal` becomes `discount.formattedOriginalTotal`.
|
|
919
|
+
- `calc.oTotal` becomes `discount.formattedOriginalTotal` and `discount.originalTotal`.
|
|
901
920
|
- A non-empty `calc.discountName` becomes the label of the single `applied` entry.
|
|
902
921
|
- The applied amount is the formatted negative difference
|
|
903
922
|
`calc.total - calc.oTotal`.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Changelog: 3.1.0
|
|
2
|
+
|
|
3
|
+
What an English site needed from the SDK to stop reading German words: amenities, distances,
|
|
4
|
+
highlights and room features state their keys and values (facts), search prices come as numbers,
|
|
5
|
+
and v10 discounts state their type. Image alt texts and room descriptions missing in the
|
|
6
|
+
requested language come back in German and are marked, like descriptions since 2.38.0, and the
|
|
7
|
+
SDK translates the v10 system cancellation policies and the be-on! Hub's no-name placeholder.
|
|
8
|
+
|
|
9
|
+
## Added
|
|
10
|
+
|
|
11
|
+
- `total` on priced search items and alternative periods, and `originalTotal` on their
|
|
12
|
+
`discount`, on v9 and v10: `{ amount, currency }`, with `amount` in the currency's minor unit
|
|
13
|
+
(`103339` = €1,033.39). They state the same totals as `formattedTotal` and
|
|
14
|
+
`discount.formattedOriginalTotal`. v9 states them in EUR, as it formats them.
|
|
15
|
+
- v10: `type` on each `discount.applied` entry (`EARLY_BIRD`, `LAST_MINUTE`, …). It is the same
|
|
16
|
+
in every locale while `label` is translated ("Frühbucher-Rabatt", "Early booking discount").
|
|
17
|
+
v9 states no type: its `label` is the discount name entered in the PMS.
|
|
18
|
+
- The type `SearchMoney`.
|
|
19
|
+
- `altFallback` on images and `descriptionFallback` on rooms: the language their text is in when
|
|
20
|
+
it is not the requested one (`"de-DE"`), omitted otherwise. Mark the text as German
|
|
21
|
+
(`lang="de"`) when it is set.
|
|
22
|
+
- Facts: every rendered list states its items with their keys and values, the same in every
|
|
23
|
+
locale: `facts` next to `items` in attribute subcategories and vicinity groups,
|
|
24
|
+
`highlightFacts` next to `highlights` (rentals, their property, search items), and
|
|
25
|
+
`attributeFacts` and `typeKey` on rooms. A fact is `{ key, text, value? }`: the attribute key,
|
|
26
|
+
the rendered item, and the raw value (`true`, a count, meters, m², an option key). `facts[i]` is
|
|
27
|
+
`items[i]`. The type `RentalFact`.
|
|
28
|
+
v9 states v10's key where v10 has the attribute (`loc_lake` → `locLake`) and features as
|
|
29
|
+
`true`, so a site curates one list for both backends. See "Facts" in `rentals.md`.
|
|
30
|
+
|
|
31
|
+
## Changed
|
|
32
|
+
|
|
33
|
+
- v10: a system cancellation policy (`SYSTEM_FIRM_14`, `SYSTEM_STRICT_30`, `SYSTEM_STRICT_60`)
|
|
34
|
+
is labelled by the SDK's translation of its type ("Strict (30 days)" on English pages); the
|
|
35
|
+
PMS sent its German name ("Streng (30 Tage)") in every locale. Custom and alternative policies
|
|
36
|
+
keep the agency's label.
|
|
37
|
+
- v9: the be-on! Hub's placeholder for a reviewer without a name ("Gastname nicht genannt") is
|
|
38
|
+
read as no name and becomes `reviews.item.guest` ("Guest" / "Gast").
|
|
39
|
+
- The instructions list the texts that stay in the PMS's language because an agency enters them
|
|
40
|
+
there (`quote.md`, "Texts in the PMS's language").
|
|
41
|
+
- v10: an image (rental, property and search) or a room without a text in the requested locale
|
|
42
|
+
takes its German text and is marked. Before, the text was omitted: English pages had no alt
|
|
43
|
+
text on most images (dev-28: 937 of 951) and no room descriptions.
|
|
44
|
+
- v9: an image title kept per language in the PMS falls back to German and is marked. A caption
|
|
45
|
+
the be-on! Hub sends as plain text is compared with the German one in the same extra query
|
|
46
|
+
`getRentals` already makes for descriptions on non-German pages, which now also reads image
|
|
47
|
+
captions. German pages are unchanged and make no extra query.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Migration: 3.0.0 to 3.1.0
|
|
2
|
+
|
|
3
|
+
No changes required.
|
|
4
|
+
|
|
5
|
+
## 1. Upgrade
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm add @v-office/website-sdk@3.1.0
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 2. Optional: stop parsing prices and discount names
|
|
12
|
+
|
|
13
|
+
- A site that reads a number out of `formattedTotal` or `discount.formattedOriginalTotal`
|
|
14
|
+
(for a strikethrough, a saving or a sort) can read `total.amount` and
|
|
15
|
+
`discount.originalTotal.amount` instead. The formatted strings use the locale's separators
|
|
16
|
+
("1.033,39 €", "€1,033.39"), so parsing them breaks between languages.
|
|
17
|
+
- A v10 site that filters or groups campaigns by `discount.applied[].label` can use
|
|
18
|
+
`discount.applied[].type`: the label is translated, the type is not.
|
|
19
|
+
|
|
20
|
+
## 3. English pages: German alt texts and room descriptions
|
|
21
|
+
|
|
22
|
+
An English page now gets the German alt text of an image and the German description of a room
|
|
23
|
+
where no English exists (v10: before, none). Mark them as German where `altFallback` or
|
|
24
|
+
`descriptionFallback` is set, for example `<img lang="de" …>`.
|
|
25
|
+
|
|
26
|
+
## 4. Optional: curate by key, not by text
|
|
27
|
+
|
|
28
|
+
A site that recognizes amenities, distances, highlights or room features by their text
|
|
29
|
+
(„Entfernung zum Strand", „WLAN") loses them on an English page. Read the facts instead:
|
|
30
|
+
`facts` in attribute subcategories and vicinity groups, `highlightFacts`, and `attributeFacts` /
|
|
31
|
+
`typeKey` on rooms. Match on `key`, read numbers from `value` (distances in meters), and show
|
|
32
|
+
`text`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-office/website-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Website-facing SDK facade backed by @v-office/sdk-core",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@graphql-typed-document-node/core": "3.2.0",
|
|
51
|
-
"@v-office/sdk-core": "1.
|
|
51
|
+
"@v-office/sdk-core": "1.30.0",
|
|
52
52
|
"effect": "4.0.0-rc.115",
|
|
53
53
|
"graphql": "17.0.2",
|
|
54
54
|
"yaml": "^2.9.0"
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"test:cli": "node --test src/cli/v9-hub-filters.test.ts",
|
|
92
92
|
"test:v9:openapi": "node --test codegen/v9/php-record.test.ts src/legacy-v9/openapi/setup-response.test.ts src/legacy-v9/openapi/quote-response.test.ts",
|
|
93
93
|
"test:v9:properties": "node --test codegen/v9/heuristic-generation/generate/property.test.ts src/legacy-v9/property-highlight-sources.test.ts src/legacy-v9/parser/rentals/render-property-attribute.test.ts src/legacy-v9/parser/rentals/to-property.test.ts src/legacy-v9/parser/rentals/to-rooms.test.ts src/legacy-v9/parser/rentals/to-capacity.test.ts",
|
|
94
|
-
"test:v9:rentals": "node --test src/legacy-v9/static/associate-rentals-with-facilities-by-object-groups.test.ts src/legacy-v9/parser/rentals/to-reviews.test.ts src/legacy-v9/parser/rentals/to-image.test.ts",
|
|
94
|
+
"test:v9:rentals": "node --test src/legacy-v9/static/description-fallbacks.test.ts src/legacy-v9/static/associate-rentals-with-facilities-by-object-groups.test.ts src/legacy-v9/parser/rentals/to-reviews.test.ts src/legacy-v9/parser/rentals/to-image.test.ts",
|
|
95
95
|
"test:v9:graphql": "node --test src/legacy-v9/graphql/client.test.ts",
|
|
96
96
|
"test:v9:availability": "node --test src/legacy-v9/parser/availability/to-availability-restrictions-by-date.test.ts src/legacy-v9/parser/availability/to-initial-availability-calendar-days.test.ts src/legacy-v9/parser/availability/to-occupancy-limits.test.ts src/legacy-v9/parser/availability/to-rent-night-prices.test.ts src/legacy-v9/parser/availability/to-start-date-selected-calendar-days.test.ts src/legacy-v9/parser/blocked-ranges/collect-v9-blocked-ranges.test.ts src/legacy-v9/parser/blocked-ranges/to-rental-blocked-ranges.test.ts",
|
|
97
97
|
"test:v9:search": "node --test src/legacy-v9/parser/search/resolve-exact-match.test.ts src/legacy-v9/rental-scope.test.ts",
|