@v-office/website-sdk 2.0.0 → 2.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/README.md +33 -31
- package/dist/cli.mjs +6 -4
- package/dist/{client-BSUd3vuc.mjs → client-xkXV7Nf-.mjs} +32 -16
- package/dist/index.d.mts +613 -1140
- package/dist/index.mjs +3 -3
- package/dist/instructions/CHANGELOG.md +1 -0
- package/dist/instructions/MIGRATION.md +1 -0
- package/dist/instructions/README.md +14 -12
- package/dist/instructions/availability.md +9 -9
- package/dist/instructions/booking.md +33 -33
- package/dist/instructions/contact.md +34 -16
- package/dist/instructions/creation.md +48 -48
- package/dist/instructions/document-structured-json.md +100 -0
- package/dist/instructions/filter.md +5 -3
- package/dist/instructions/quote.md +72 -48
- package/dist/instructions/rentals.md +3 -3
- package/dist/instructions/search.md +36 -31
- package/dist/instructions/versions/2.0.0/MIGRATION.md +17 -17
- package/dist/instructions/versions/2.1.0/CHANGELOG.md +32 -0
- package/dist/instructions/versions/2.1.0/MIGRATION.md +89 -0
- package/dist/{quote-1uEIO44v.mjs → quote--25SMlYS.mjs} +27 -4
- package/dist/{rentals-Quwc78o2.mjs → rentals-DCKUaLnB.mjs} +1 -1
- package/dist/{search-GRQeXDvo.mjs → search-8iCC0Nel.mjs} +2 -2
- package/dist/{to-rental-highlights-FNZBR4aD.mjs → to-rental-highlights-CZYJeR1D.mjs} +12 -12
- package/dist/translations/shared/de-DE/contact.json +19 -0
- package/dist/translations/shared/de-DE/quote.json +5 -1
- package/dist/translations/shared/en-US/contact.json +19 -0
- package/dist/translations/shared/en-US/quote.json +5 -1
- package/dist/translations/v10/de-DE/mapped-search-filters.json +3 -0
- package/dist/translations/v10/en-US/mapped-search-filters.json +3 -0
- package/instructions/CHANGELOG.md +1 -0
- package/instructions/MIGRATION.md +1 -0
- package/instructions/README.md +14 -12
- package/instructions/availability.md +9 -9
- package/instructions/booking.md +33 -33
- package/instructions/contact.md +34 -16
- package/instructions/creation.md +48 -48
- package/instructions/document-structured-json.md +100 -0
- package/instructions/filter.md +5 -3
- package/instructions/quote.md +72 -48
- package/instructions/rentals.md +3 -3
- package/instructions/search.md +36 -31
- package/instructions/versions/2.0.0/MIGRATION.md +17 -17
- package/instructions/versions/2.1.0/CHANGELOG.md +32 -0
- package/instructions/versions/2.1.0/MIGRATION.md +89 -0
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as SetupResponseSchema, A as ErgoPolicyNumberRequestSchema, At as
|
|
2
|
-
import { AdditionalServiceLimitExceeded, CoreSDKError, CoreSDKError as CMSError, GuestQuoteSchema, InvalidAdditionalServiceQuantity, LocaleSchema, SearchSearchInputSchema, SearchSearchOutputSchema, UnknownAdditionalService } from "@v-office/sdk-core";
|
|
1
|
+
import { $ as SetupResponseSchema, A as ErgoPolicyNumberRequestSchema, At as selectInsurancePaymentEffect, B as QuotePricesResponseSchema, C as ErgoAddressSchema, Ct as getStartDateSelectedAvailabilityEffect, D as ErgoCreatePreContractRequestSchema, Dt as searchEffect, E as ErgoCommonFieldsSchema, Et as removeAdditionalServiceEffect, F as OnOfficeUnitSchema, G as RegionListResponseSchema, H as QuoteServiceSchema, I as PaymentScheduleItemSchema, J as ServiceBeonDataSchema, K as RoomImageSchema, L as PaymentScheduleSchema, M as ErgoTripAndCustomerRequestSchema, Mt as submitPaymentOption, N as FacilityListResponseSchema, Nt as submitPaymentOptionEffect, O as ErgoPersonSchema, Ot as selectCancellationPolicyEffect, P as OnOfficeUnitCollectionResponseSchema, Pt as defineWebsiteSDKOptions, Q as SetupDataSchema, R as QuoteLineSchema, S as DocumentTypeSchema, St as getRentalsEffect, T as ErgoBookRequestSchema, Tt as quoteEffect, U as RawObjectResponseSchema, V as QuoteSchema, W as RawVofficeObjectSchema, X as ServiceLimitSchema, Y as ServiceImageSchema, Z as ServiceListResponseSchema, _ as DocumentResourceResponseSchema, _t as bookInsuranceEffect, a as makeV0OpenApiClientFetchLive, at as UnitIdsResponseSchema, b as DocumentStatusUpdateRequestSchema, bt as getFiltersEffect, c as V1OpenApiClientError, ct as UnitOfferSchema, d as ApiEnvelopeBaseSchema, dt as V1_BASE_URL, et as TileCollectionResponseSchema, f as CalendarDaySchema, ft as V1_OPERATIONS, g as DocumentCollectionResponseSchema, gt as bookEffect, h as CustomerUnitSummarySchema, ht as addAdditionalServiceEffect, i as V0OpenApiClientError, it as TravelInsuranceBookingStoreRequestSchema, j as ErgoReadPreContractRequestSchema, jt as submitContactEffect, k as ErgoPlanSearchRequestSchema, kt as selectInsuranceEffect, l as makeV1OpenApiClientFetchLive, lt as UnitResponseSchema, m as CurrentMemberResponseSchema, mt as decodeV1OperationResponse, nt as TileTagSchema, o as makeV0OpenApiClientLive, ot as UnitListItemSchema, p as CalendarResponseSchema, pt as VideoResponseSchema, q as SearchPropertiesResponseSchema, r as V0OpenApiClient, rt as TravelInsuranceBookingSchema, s as V1OpenApiClient, st as UnitListResponseSchema, t as createWebsiteSDK, tt as TileSchema, u as makeV1OpenApiClientLive, ut as UnitServicePriceSchema, v as DocumentResourceSchema, vt as clearAdditionalServicesEffect, w as ErgoBankSchema, wt as getTermsAndPrivacyPolicyEffect, x as DocumentSummarySchema, xt as getInitialAvailabilityEffect, y as DocumentStatusSchema, yt as createInsurancePreContractEffect, z as QuotePricesPayloadSchema } from "./client-xkXV7Nf-.mjs";
|
|
2
|
+
import { AdditionalServiceLimitExceeded, CoreSDKError, CoreSDKError as CMSError, GuestQuoteSchema, InvalidAdditionalServiceQuantity, LocaleSchema, SearchSearchInputSchema, SearchSearchOutputSchema, UnknownAdditionalService, validateContactSubmitInput } from "@v-office/sdk-core";
|
|
3
3
|
//#region codegen/v9/heuristic-generation/public-api.ts
|
|
4
4
|
const customDataAttribute = (name) => name;
|
|
5
5
|
const defineDataAttributes = () => (attributes) => attributes;
|
|
@@ -13,4 +13,4 @@ const defineVofficeOfferDataAttributes = defineDataAttributes();
|
|
|
13
13
|
const defineVofficeRatingDataAttributes = defineDataAttributes();
|
|
14
14
|
const defineVofficeTotalRatingDataAttributes = defineDataAttributes();
|
|
15
15
|
//#endregion
|
|
16
|
-
export { AdditionalServiceLimitExceeded, ApiEnvelopeBaseSchema, CMSError, CalendarDaySchema, CalendarResponseSchema, CoreSDKError, CurrentMemberResponseSchema, CustomerUnitSummarySchema, DocumentCollectionResponseSchema, DocumentResourceResponseSchema, DocumentResourceSchema, DocumentStatusSchema, DocumentStatusUpdateRequestSchema, DocumentSummarySchema, DocumentTypeSchema, ErgoAddressSchema, ErgoBankSchema, ErgoBookRequestSchema, ErgoCommonFieldsSchema, ErgoCreatePreContractRequestSchema, ErgoPersonSchema, ErgoPlanSearchRequestSchema, ErgoPolicyNumberRequestSchema, ErgoReadPreContractRequestSchema, ErgoTripAndCustomerRequestSchema, FacilityListResponseSchema, GuestQuoteSchema, InvalidAdditionalServiceQuantity, LocaleSchema, OnOfficeUnitCollectionResponseSchema, OnOfficeUnitSchema, PaymentScheduleItemSchema, PaymentScheduleSchema, QuoteLineSchema, QuotePricesPayloadSchema, QuotePricesResponseSchema, QuoteSchema, QuoteServiceSchema, RawObjectResponseSchema, RawVofficeObjectSchema, RegionListResponseSchema, RoomImageSchema, SearchPropertiesResponseSchema, SearchSearchInputSchema, SearchSearchOutputSchema, ServiceBeonDataSchema, ServiceImageSchema, ServiceLimitSchema, ServiceListResponseSchema, SetupDataSchema, SetupResponseSchema, TileCollectionResponseSchema, TileSchema, TileTagSchema, TravelInsuranceBookingSchema, TravelInsuranceBookingStoreRequestSchema, UnitIdsResponseSchema, UnitListItemSchema, UnitListResponseSchema, UnitOfferSchema, UnitResponseSchema, UnitServicePriceSchema, UnknownAdditionalService, V0OpenApiClient, V0OpenApiClientError, V1OpenApiClient, V1OpenApiClientError, V1_BASE_URL, V1_OPERATIONS, VideoResponseSchema, addAdditionalServiceEffect, bookEffect, bookInsuranceEffect, clearAdditionalServicesEffect, createInsurancePreContractEffect, createWebsiteSDK, customDataAttribute, decodeV1OperationResponse, defineWebsiteSDKOptions as defineCMSSDKOptions, defineWebsiteSDKOptions, defineDataAttributes, defineVofficeFacilityDataAttributes, defineVofficeFeedbackDataAttributes, defineVofficeImageDataAttributes, defineVofficeOfferDataAttributes, defineVofficePriceDataAttributes, defineVofficeRatingDataAttributes, defineVofficeServiceDataAttributes, defineVofficeTotalRatingDataAttributes, defineVofficeUnitDataAttributes, getFiltersEffect, getInitialAvailabilityEffect, getRentalsEffect, getStartDateSelectedAvailabilityEffect, makeV0OpenApiClientFetchLive, makeV0OpenApiClientLive, makeV1OpenApiClientFetchLive, makeV1OpenApiClientLive, quoteEffect, removeAdditionalServiceEffect, searchEffect, selectCancellationPolicyEffect, selectInsuranceEffect, selectInsurancePaymentEffect, submitContactEffect, submitPaymentOption, submitPaymentOptionEffect };
|
|
16
|
+
export { AdditionalServiceLimitExceeded, ApiEnvelopeBaseSchema, CMSError, CalendarDaySchema, CalendarResponseSchema, CoreSDKError, CurrentMemberResponseSchema, CustomerUnitSummarySchema, DocumentCollectionResponseSchema, DocumentResourceResponseSchema, DocumentResourceSchema, DocumentStatusSchema, DocumentStatusUpdateRequestSchema, DocumentSummarySchema, DocumentTypeSchema, ErgoAddressSchema, ErgoBankSchema, ErgoBookRequestSchema, ErgoCommonFieldsSchema, ErgoCreatePreContractRequestSchema, ErgoPersonSchema, ErgoPlanSearchRequestSchema, ErgoPolicyNumberRequestSchema, ErgoReadPreContractRequestSchema, ErgoTripAndCustomerRequestSchema, FacilityListResponseSchema, GuestQuoteSchema, InvalidAdditionalServiceQuantity, LocaleSchema, OnOfficeUnitCollectionResponseSchema, OnOfficeUnitSchema, PaymentScheduleItemSchema, PaymentScheduleSchema, QuoteLineSchema, QuotePricesPayloadSchema, QuotePricesResponseSchema, QuoteSchema, QuoteServiceSchema, RawObjectResponseSchema, RawVofficeObjectSchema, RegionListResponseSchema, RoomImageSchema, SearchPropertiesResponseSchema, SearchSearchInputSchema, SearchSearchOutputSchema, ServiceBeonDataSchema, ServiceImageSchema, ServiceLimitSchema, ServiceListResponseSchema, SetupDataSchema, SetupResponseSchema, TileCollectionResponseSchema, TileSchema, TileTagSchema, TravelInsuranceBookingSchema, TravelInsuranceBookingStoreRequestSchema, UnitIdsResponseSchema, UnitListItemSchema, UnitListResponseSchema, UnitOfferSchema, UnitResponseSchema, UnitServicePriceSchema, UnknownAdditionalService, V0OpenApiClient, V0OpenApiClientError, V1OpenApiClient, V1OpenApiClientError, V1_BASE_URL, V1_OPERATIONS, VideoResponseSchema, addAdditionalServiceEffect, bookEffect, bookInsuranceEffect, clearAdditionalServicesEffect, createInsurancePreContractEffect, createWebsiteSDK, customDataAttribute, decodeV1OperationResponse, defineWebsiteSDKOptions as defineCMSSDKOptions, defineWebsiteSDKOptions, defineDataAttributes, defineVofficeFacilityDataAttributes, defineVofficeFeedbackDataAttributes, defineVofficeImageDataAttributes, defineVofficeOfferDataAttributes, defineVofficePriceDataAttributes, defineVofficeRatingDataAttributes, defineVofficeServiceDataAttributes, defineVofficeTotalRatingDataAttributes, defineVofficeUnitDataAttributes, getFiltersEffect, getInitialAvailabilityEffect, getRentalsEffect, getStartDateSelectedAvailabilityEffect, getTermsAndPrivacyPolicyEffect, makeV0OpenApiClientFetchLive, makeV0OpenApiClientLive, makeV1OpenApiClientFetchLive, makeV1OpenApiClientLive, quoteEffect, removeAdditionalServiceEffect, searchEffect, selectCancellationPolicyEffect, selectInsuranceEffect, selectInsurancePaymentEffect, submitContactEffect, submitPaymentOption, submitPaymentOptionEffect, validateContactSubmitInput };
|
|
@@ -4,6 +4,7 @@ This file is the versioned changelog index for the website SDK instructions.
|
|
|
4
4
|
|
|
5
5
|
## Versions
|
|
6
6
|
|
|
7
|
+
- `versions/2.1.0/CHANGELOG.md`: `@v-office/website-sdk` 2.1.0 release notes.
|
|
7
8
|
- `versions/2.0.0/CHANGELOG.md`: `@v-office/website-sdk` 2.0.0 release notes.
|
|
8
9
|
|
|
9
10
|
Keep each future release in its own version directory so consumers can see which package version introduced each change.
|
|
@@ -4,6 +4,7 @@ This file is the versioned migration index for the website SDK instructions.
|
|
|
4
4
|
|
|
5
5
|
## Available Guides
|
|
6
6
|
|
|
7
|
+
- `versions/2.1.0/MIGRATION.md`: migrate from `@v-office/website-sdk` 2.0.0 to 2.1.0.
|
|
7
8
|
- `versions/2.0.0/MIGRATION.md`: migrate from the legacy 1.x CMS-style website SDK API to `@v-office/website-sdk` 2.0.0.
|
|
8
9
|
|
|
9
10
|
Keep each future migration in its own version directory so consumers can clearly see the source and target versions for every upgrade path.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Website SDK Instructions
|
|
2
2
|
|
|
3
|
-
These instructions describe `@v-office/website-sdk` 2.
|
|
3
|
+
These instructions describe `@v-office/website-sdk` 2.1.0.
|
|
4
4
|
|
|
5
5
|
Use this directory as the consumer-facing reference for the package:
|
|
6
6
|
|
|
@@ -12,8 +12,10 @@ Use this directory as the consumer-facing reference for the package:
|
|
|
12
12
|
- `quote.md`: quote, additional services, cancellation policy, and insurance flows.
|
|
13
13
|
- `booking.md`: booking and payment option submission.
|
|
14
14
|
- `contact.md`: contact submission.
|
|
15
|
+
- `document-structured-json.md`: `sdk.static.documents.getTermsAndPrivacyPolicy` and structured document JSON rendering rules.
|
|
15
16
|
- `CHANGELOG.md`: versioned changelog index.
|
|
16
17
|
- `MIGRATION.md`: versioned migration index.
|
|
18
|
+
- `versions/2.1.0/`: 2.1.0 release notes and 2.0.0-to-2.1.0 migration guide.
|
|
17
19
|
- `versions/2.0.0/`: release-specific 2.0.0 changelog and 1.x-to-2.0.0 migration guide.
|
|
18
20
|
|
|
19
21
|
## Package
|
|
@@ -27,27 +29,27 @@ The package is ESM-only and exports the root SDK facade from `@v-office/website-
|
|
|
27
29
|
## Quick Start
|
|
28
30
|
|
|
29
31
|
```ts
|
|
30
|
-
import { createWebsiteSDK, defineWebsiteSDKOptions } from
|
|
32
|
+
import { createWebsiteSDK, defineWebsiteSDKOptions } from "@v-office/website-sdk";
|
|
31
33
|
|
|
32
34
|
const sdk = createWebsiteSDK({
|
|
33
35
|
config: {
|
|
34
|
-
backend:
|
|
35
|
-
apiEndpoint:
|
|
36
|
-
accessToken:
|
|
37
|
-
imageBaseUrl:
|
|
36
|
+
backend: "v10",
|
|
37
|
+
apiEndpoint: "https://api.example.com/graphql",
|
|
38
|
+
accessToken: "...",
|
|
39
|
+
imageBaseUrl: "https://images.example.com",
|
|
38
40
|
},
|
|
39
41
|
options: defineWebsiteSDKOptions({
|
|
40
42
|
rentalScope: {
|
|
41
|
-
propertyId:
|
|
43
|
+
propertyId: "property-1",
|
|
42
44
|
},
|
|
43
45
|
}),
|
|
44
|
-
})
|
|
46
|
+
});
|
|
45
47
|
|
|
46
48
|
try {
|
|
47
|
-
const rentals = await sdk.static.rentals.getRentals({ locale:
|
|
48
|
-
console.log(rentals)
|
|
49
|
+
const rentals = await sdk.static.rentals.getRentals({ locale: "de-DE" });
|
|
50
|
+
console.log(rentals);
|
|
49
51
|
} finally {
|
|
50
|
-
await sdk.dispose()
|
|
52
|
+
await sdk.dispose();
|
|
51
53
|
}
|
|
52
54
|
```
|
|
53
55
|
|
|
@@ -59,4 +61,4 @@ website-sdk --backend v9 filters --locale en-US
|
|
|
59
61
|
website-sdk --backend v10 search --locale de-DE --query "adults=2"
|
|
60
62
|
```
|
|
61
63
|
|
|
62
|
-
Config file examples in these docs use the 2.0.0
|
|
64
|
+
Config file examples in these docs use the flat `WebsiteSDKConfig` shape introduced in 2.0.0 and kept in 2.1.0.
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
Use the live availability API to build date-picker flows:
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
|
-
const initial = await sdk.live.availability.getInitialAvailability(input)
|
|
9
|
-
const selected = await sdk.live.availability.getStartDateSelectedAvailability(input)
|
|
8
|
+
const initial = await sdk.live.availability.getInitialAvailability(input);
|
|
9
|
+
const selected = await sdk.live.availability.getStartDateSelectedAvailability(input);
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
`getInitialAvailability` marks possible start dates. `getStartDateSelectedAvailability` marks possible end dates after a start date was selected.
|
|
@@ -17,19 +17,19 @@ Initial availability:
|
|
|
17
17
|
|
|
18
18
|
```ts
|
|
19
19
|
type InitialAvailabilityInput = {
|
|
20
|
-
locale:
|
|
21
|
-
rentalId: string
|
|
22
|
-
calculateFromDate: string
|
|
23
|
-
calculateThroughDate: string
|
|
24
|
-
}
|
|
20
|
+
locale: "de-DE" | "en-US";
|
|
21
|
+
rentalId: string;
|
|
22
|
+
calculateFromDate: string;
|
|
23
|
+
calculateThroughDate: string;
|
|
24
|
+
};
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
Start-date-selected availability:
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
30
|
type StartDateSelectedAvailabilityInput = InitialAvailabilityInput & {
|
|
31
|
-
selectedStartDate: string
|
|
32
|
-
}
|
|
31
|
+
selectedStartDate: string;
|
|
32
|
+
};
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
Sample:
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Use the live booking API to turn an available `GuestQuote` into a booking:
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
|
-
const booking = await sdk.live.booking.book(input)
|
|
8
|
+
const booking = await sdk.live.booking.book(input);
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
The `quote` must be the `GuestQuote` instance returned by `sdk.live.quote.quote(...)`, optionally updated through quote selection helpers.
|
|
@@ -14,53 +14,53 @@ The `quote` must be the `GuestQuote` instance returned by `sdk.live.quote.quote(
|
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
type BookingInput = {
|
|
17
|
-
quote: GuestQuote
|
|
17
|
+
quote: GuestQuote;
|
|
18
18
|
contact: {
|
|
19
|
-
forename: string
|
|
20
|
-
surname: string
|
|
21
|
-
title?: string
|
|
22
|
-
birthdate?: string
|
|
19
|
+
forename: string;
|
|
20
|
+
surname: string;
|
|
21
|
+
title?: string;
|
|
22
|
+
birthdate?: string;
|
|
23
23
|
address: {
|
|
24
|
-
street: string
|
|
25
|
-
housenumber?: string
|
|
26
|
-
postalcode: string
|
|
27
|
-
city: string
|
|
28
|
-
countryCode: string
|
|
29
|
-
}
|
|
30
|
-
contactDetails: { email: string; phone: string } | { email: string } | { phone: string }
|
|
31
|
-
note?: string
|
|
32
|
-
}
|
|
33
|
-
relativeRedirectUrl: string
|
|
34
|
-
}
|
|
24
|
+
street: string;
|
|
25
|
+
housenumber?: string;
|
|
26
|
+
postalcode: string;
|
|
27
|
+
city: string;
|
|
28
|
+
countryCode: string;
|
|
29
|
+
};
|
|
30
|
+
contactDetails: { email: string; phone: string } | { email: string } | { phone: string };
|
|
31
|
+
note?: string;
|
|
32
|
+
};
|
|
33
|
+
relativeRedirectUrl: string;
|
|
34
|
+
};
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
Sample:
|
|
38
38
|
|
|
39
39
|
```ts
|
|
40
|
-
const quoteResult = await sdk.live.quote.quote(quoteInput)
|
|
41
|
-
if (quoteResult.status !==
|
|
40
|
+
const quoteResult = await sdk.live.quote.quote(quoteInput);
|
|
41
|
+
if (quoteResult.status !== "available") throw new Error(quoteResult.reason);
|
|
42
42
|
|
|
43
43
|
const booking = await sdk.live.booking.book({
|
|
44
44
|
quote: quoteResult.quote,
|
|
45
45
|
contact: {
|
|
46
|
-
forename:
|
|
47
|
-
surname:
|
|
48
|
-
title:
|
|
46
|
+
forename: "Jane",
|
|
47
|
+
surname: "Doe",
|
|
48
|
+
title: "Ms",
|
|
49
49
|
address: {
|
|
50
|
-
street:
|
|
51
|
-
housenumber:
|
|
52
|
-
postalcode:
|
|
53
|
-
city:
|
|
54
|
-
countryCode:
|
|
50
|
+
street: "Main Street",
|
|
51
|
+
housenumber: "1",
|
|
52
|
+
postalcode: "12345",
|
|
53
|
+
city: "Berlin",
|
|
54
|
+
countryCode: "DE",
|
|
55
55
|
},
|
|
56
56
|
contactDetails: {
|
|
57
|
-
email:
|
|
58
|
-
phone:
|
|
57
|
+
email: "jane@example.com",
|
|
58
|
+
phone: "+49123456789",
|
|
59
59
|
},
|
|
60
|
-
note:
|
|
60
|
+
note: "Please prepare a baby bed.",
|
|
61
61
|
},
|
|
62
|
-
relativeRedirectUrl:
|
|
63
|
-
})
|
|
62
|
+
relativeRedirectUrl: "/booking/payment-return",
|
|
63
|
+
});
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
`relativeRedirectUrl` is used for online payment redirects after booking creation.
|
|
@@ -123,7 +123,7 @@ Booking requests are rate-limited to one backend request per second with a queue
|
|
|
123
123
|
|
|
124
124
|
## CLI Usage
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
The CLI includes a booking command. It creates a fresh quote from a quote input file, then books that quote with a booking contact file:
|
|
127
127
|
|
|
128
128
|
```sh
|
|
129
129
|
website-sdk --backend v10 booking book --quote-input ./quote-input.json --contact-input ./booking-contact.json --relative-redirect-url /booking/payment-return --yes
|
|
@@ -5,29 +5,31 @@
|
|
|
5
5
|
Use the live contact API to submit a contact request:
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
|
-
await sdk.live.contact.submit(input)
|
|
8
|
+
await sdk.live.contact.submit(input);
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
`v9` submits the request through the v0 `saveMessage` action.
|
|
11
|
+
`v9` submits the request through the v0 `saveMessage` action. `v10` submits the request through the `messengeremail_newContactRequest` GraphQL operation.
|
|
12
12
|
|
|
13
13
|
## Input
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
type ContactInput = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
locale?: "de-DE" | "en-US";
|
|
18
|
+
title: string;
|
|
19
|
+
professionalTitle: string;
|
|
20
|
+
forename: string;
|
|
21
|
+
surname: string;
|
|
21
22
|
address: {
|
|
22
|
-
streetAndHousenumber: string
|
|
23
|
-
postalCode: string
|
|
24
|
-
city: string
|
|
25
|
-
countryCode: string
|
|
26
|
-
}
|
|
27
|
-
email: string
|
|
28
|
-
phone
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
streetAndHousenumber: string;
|
|
24
|
+
postalCode: string;
|
|
25
|
+
city: string;
|
|
26
|
+
countryCode: string;
|
|
27
|
+
};
|
|
28
|
+
email: string;
|
|
29
|
+
phone: string;
|
|
30
|
+
subject: string;
|
|
31
|
+
message: string;
|
|
32
|
+
};
|
|
31
33
|
```
|
|
32
34
|
|
|
33
35
|
`ContactSubmitInput` is the core SDK type name. `ContactInput` remains exported as a legacy alias.
|
|
@@ -36,6 +38,7 @@ Sample:
|
|
|
36
38
|
|
|
37
39
|
```json
|
|
38
40
|
{
|
|
41
|
+
"locale": "de-DE",
|
|
39
42
|
"title": "Ms",
|
|
40
43
|
"professionalTitle": "",
|
|
41
44
|
"forename": "Jane",
|
|
@@ -48,6 +51,7 @@ Sample:
|
|
|
48
51
|
},
|
|
49
52
|
"email": "jane@example.com",
|
|
50
53
|
"phone": "+49123456789",
|
|
54
|
+
"subject": "Question about a rental",
|
|
51
55
|
"message": "I have a question about a rental."
|
|
52
56
|
}
|
|
53
57
|
```
|
|
@@ -64,7 +68,21 @@ Successful CLI output:
|
|
|
64
68
|
}
|
|
65
69
|
```
|
|
66
70
|
|
|
67
|
-
Errors are reported as `CoreSDKError`, also exported as the compatibility alias `CMSError`. The
|
|
71
|
+
Errors are reported as `CoreSDKError`, also exported as the compatibility alias `CMSError`. The current error shape uses `source` instead of the legacy `backend` field.
|
|
72
|
+
|
|
73
|
+
Contact input is validated before submitting to either backend. Validation failures reject with a `CoreSDKError` using `operation: "contact.submit.validation"`. The error `message` is translated with `input.locale` and defaults to German (`de-DE`) when no locale is provided. Field-level details are available on `error.cause.issues`:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"issues": [
|
|
78
|
+
{
|
|
79
|
+
"path": "email",
|
|
80
|
+
"code": "invalid_email",
|
|
81
|
+
"message": "Bitte geben Sie eine gültige E-Mail-Adresse ein."
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
```
|
|
68
86
|
|
|
69
87
|
## Configuration
|
|
70
88
|
|
|
@@ -5,27 +5,27 @@
|
|
|
5
5
|
Create the SDK with `createWebsiteSDK`:
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
|
-
import { createWebsiteSDK, defineWebsiteSDKOptions } from
|
|
8
|
+
import { createWebsiteSDK, defineWebsiteSDKOptions } from "@v-office/website-sdk";
|
|
9
9
|
|
|
10
10
|
const sdk = createWebsiteSDK({
|
|
11
11
|
config: {
|
|
12
|
-
backend:
|
|
13
|
-
apiEndpoint:
|
|
14
|
-
accessToken:
|
|
15
|
-
imageBaseUrl:
|
|
12
|
+
backend: "v10",
|
|
13
|
+
apiEndpoint: "https://api.example.com/graphql",
|
|
14
|
+
accessToken: "...",
|
|
15
|
+
imageBaseUrl: "https://images.example.com",
|
|
16
16
|
},
|
|
17
17
|
options: defineWebsiteSDKOptions({
|
|
18
18
|
rentalScope: {
|
|
19
|
-
propertyId:
|
|
19
|
+
propertyId: "property-1",
|
|
20
20
|
},
|
|
21
21
|
}),
|
|
22
|
-
})
|
|
22
|
+
});
|
|
23
23
|
|
|
24
24
|
try {
|
|
25
|
-
const rentals = await sdk.static.rentals.getRentals({ locale:
|
|
26
|
-
console.log(rentals)
|
|
25
|
+
const rentals = await sdk.static.rentals.getRentals({ locale: "de-DE" });
|
|
26
|
+
console.log(rentals);
|
|
27
27
|
} finally {
|
|
28
|
-
await sdk.dispose()
|
|
28
|
+
await sdk.dispose();
|
|
29
29
|
}
|
|
30
30
|
```
|
|
31
31
|
|
|
@@ -40,15 +40,15 @@ Backend config is required when creating the SDK.
|
|
|
40
40
|
```ts
|
|
41
41
|
const sdk = createWebsiteSDK({
|
|
42
42
|
config: {
|
|
43
|
-
backend:
|
|
44
|
-
graphqlUrl:
|
|
45
|
-
v1ApiBaseUrl:
|
|
46
|
-
v0ApiBaseUrl:
|
|
47
|
-
apiKey:
|
|
48
|
-
imageProxyBaseUrl:
|
|
49
|
-
rentalDataAttributes: [
|
|
43
|
+
backend: "v9",
|
|
44
|
+
graphqlUrl: "https://example.com/graphql",
|
|
45
|
+
v1ApiBaseUrl: "https://example.com/api/v1",
|
|
46
|
+
v0ApiBaseUrl: "https://example.com/api/v0",
|
|
47
|
+
apiKey: "...",
|
|
48
|
+
imageProxyBaseUrl: "https://images.example.com",
|
|
49
|
+
rentalDataAttributes: ["name", "description"],
|
|
50
50
|
},
|
|
51
|
-
})
|
|
51
|
+
});
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
`v10`:
|
|
@@ -56,12 +56,12 @@ const sdk = createWebsiteSDK({
|
|
|
56
56
|
```ts
|
|
57
57
|
const sdk = createWebsiteSDK({
|
|
58
58
|
config: {
|
|
59
|
-
backend:
|
|
60
|
-
apiEndpoint:
|
|
61
|
-
accessToken:
|
|
62
|
-
imageBaseUrl:
|
|
59
|
+
backend: "v10",
|
|
60
|
+
apiEndpoint: "https://api.example.com/graphql",
|
|
61
|
+
accessToken: "...",
|
|
62
|
+
imageBaseUrl: "https://images.example.com",
|
|
63
63
|
},
|
|
64
|
-
})
|
|
64
|
+
});
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
For v10, `backend: "v10"` is optional in TypeScript, but including it is clearer when config files are shared with the CLI.
|
|
@@ -73,25 +73,25 @@ For v10, `backend: "v10"` is optional in TypeScript, but including it is clearer
|
|
|
73
73
|
```ts
|
|
74
74
|
const options = defineWebsiteSDKOptions({
|
|
75
75
|
rentalScope: {
|
|
76
|
-
propertyId:
|
|
76
|
+
propertyId: "property-1",
|
|
77
77
|
},
|
|
78
|
-
rentalHighlightPrioritization: [
|
|
79
|
-
rentalPropertyHighlightPrioritization: [
|
|
78
|
+
rentalHighlightPrioritization: ["bedrooms", "bathrooms", "maxPersons", "wifi"],
|
|
79
|
+
rentalPropertyHighlightPrioritization: ["wifi", "parking"],
|
|
80
80
|
customAttributeFilterDefinitions: [],
|
|
81
81
|
translationOverrides: {},
|
|
82
|
-
})
|
|
82
|
+
});
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
`defineWebsiteSDKOptions` is a typed identity helper. It is useful when defining options separately because TypeScript checks the option structure without changing the runtime value. `defineCMSSDKOptions` remains exported as a compatibility alias, but new code should use `defineWebsiteSDKOptions`.
|
|
86
86
|
|
|
87
87
|
```ts
|
|
88
88
|
type WebsiteSDKOptions = {
|
|
89
|
-
translationOverrides?: TranslationOverrides
|
|
90
|
-
customAttributeFilterDefinitions?: readonly CustomAttributeFilterDefinition[]
|
|
91
|
-
rentalHighlightPrioritization?: readonly RentalHighlightPrioritizationKey[]
|
|
92
|
-
rentalPropertyHighlightPrioritization?: readonly RentalPropertyHighlightPrioritizationKey[]
|
|
93
|
-
rentalScope?: RentalScope
|
|
94
|
-
}
|
|
89
|
+
translationOverrides?: TranslationOverrides;
|
|
90
|
+
customAttributeFilterDefinitions?: readonly CustomAttributeFilterDefinition[];
|
|
91
|
+
rentalHighlightPrioritization?: readonly RentalHighlightPrioritizationKey[];
|
|
92
|
+
rentalPropertyHighlightPrioritization?: readonly RentalPropertyHighlightPrioritizationKey[];
|
|
93
|
+
rentalScope?: RentalScope;
|
|
94
|
+
};
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
Unset options are normalized by the SDK:
|
|
@@ -109,9 +109,9 @@ Use `rentalScope` to restrict all rental lists and searches created by this SDK
|
|
|
109
109
|
```ts
|
|
110
110
|
const options = defineWebsiteSDKOptions({
|
|
111
111
|
rentalScope: {
|
|
112
|
-
propertyId:
|
|
112
|
+
propertyId: "property-1",
|
|
113
113
|
},
|
|
114
|
-
})
|
|
114
|
+
});
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
`propertyId` is a unified SDK option:
|
|
@@ -130,20 +130,20 @@ Use `customAttributeFilterDefinitions` to add SDK-known filter keys for custom a
|
|
|
130
130
|
const options = defineWebsiteSDKOptions({
|
|
131
131
|
customAttributeFilterDefinitions: [
|
|
132
132
|
{
|
|
133
|
-
key:
|
|
134
|
-
source:
|
|
135
|
-
category:
|
|
133
|
+
key: "region",
|
|
134
|
+
source: "customAttribute",
|
|
135
|
+
category: "ESSENTIALS",
|
|
136
136
|
label: {
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
"de-DE": "Region",
|
|
138
|
+
"en-US": "Region",
|
|
139
139
|
},
|
|
140
|
-
type:
|
|
140
|
+
type: "option",
|
|
141
141
|
options: [
|
|
142
142
|
{
|
|
143
|
-
value:
|
|
143
|
+
value: "north",
|
|
144
144
|
label: {
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
"de-DE": "Nord",
|
|
146
|
+
"en-US": "North",
|
|
147
147
|
},
|
|
148
148
|
},
|
|
149
149
|
],
|
|
@@ -151,7 +151,7 @@ const options = defineWebsiteSDKOptions({
|
|
|
151
151
|
internal: false,
|
|
152
152
|
},
|
|
153
153
|
],
|
|
154
|
-
})
|
|
154
|
+
});
|
|
155
155
|
```
|
|
156
156
|
|
|
157
157
|
Supported filter types:
|
|
@@ -181,11 +181,11 @@ Use `translationOverrides` to override SDK translation keys:
|
|
|
181
181
|
```ts
|
|
182
182
|
const options = defineWebsiteSDKOptions({
|
|
183
183
|
translationOverrides: {
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
"de-DE": {
|
|
185
|
+
"filter.wifi.label": "WLAN",
|
|
186
186
|
},
|
|
187
187
|
},
|
|
188
|
-
})
|
|
188
|
+
});
|
|
189
189
|
```
|
|
190
190
|
|
|
191
191
|
Overrides are applied by the SDK translation service and affect labels generated by filters, rentals, search, availability, and quote output.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Structured Document JSON
|
|
2
|
+
|
|
3
|
+
## Service
|
|
4
|
+
|
|
5
|
+
Use the v10 static documents API to fetch published terms and privacy policy revisions:
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
if (sdk.backend === "v10") {
|
|
9
|
+
const documents = await sdk.static.documents.getTermsAndPrivacyPolicy({ locale: "de-DE" });
|
|
10
|
+
}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Input is `{ locale: "de-DE" | "en-US" }`. Output is `Promise<DocumentsGetTermsAndPrivacyPolicyOutput>` with optional `terms` and `privacyPolicy`, each shaped as `{ subject, data }`.
|
|
14
|
+
|
|
15
|
+
This API is v10-only, has no dedicated CLI command yet, and returns `data` as a string. When `data` contains structured document JSON, render it with the rules below.
|
|
16
|
+
|
|
17
|
+
## At A Glance
|
|
18
|
+
|
|
19
|
+
The document is a JSON array. Each item is either plain text or a structured tool object.
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
[
|
|
23
|
+
"plain text",
|
|
24
|
+
"\n",
|
|
25
|
+
{
|
|
26
|
+
"tool": "link",
|
|
27
|
+
"settings": { "href": "https://example.com" },
|
|
28
|
+
"children": [{ "tool": "bold", "children": ["Example"] }]
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Base Rules
|
|
34
|
+
|
|
35
|
+
- Root value: always an array. An empty document is `[]`.
|
|
36
|
+
- Text part: any JSON string. `"\n"` means a line break. A string may also contain embedded `\n`.
|
|
37
|
+
- Tool part: `{ "tool": string, "settings"?: object, "children"?: array }`.
|
|
38
|
+
- `tool`: required name that defines how to interpret `settings` and `children`.
|
|
39
|
+
- `settings`: optional metadata object. Omit it when unused; do not rely on `null`.
|
|
40
|
+
- `children`: optional nested document array with the same shape as the root.
|
|
41
|
+
- Unknown tools have no standard meaning. Preserve them when round-tripping; skip or fallback gracefully when rendering.
|
|
42
|
+
- Internal cursor/selection marker tools are editor state, not document content, and should not be stored.
|
|
43
|
+
|
|
44
|
+
## Tool Sets
|
|
45
|
+
|
|
46
|
+
A document may use any subset of these tools. Custom producers may add more tool names.
|
|
47
|
+
|
|
48
|
+
## Built-In Tool Reference
|
|
49
|
+
|
|
50
|
+
- `bold`, `italic`, `underline`: formatting wrappers with `children`.
|
|
51
|
+
- `color`: `settings.textColor`; optional `settings.backgroundColor`; has `children`.
|
|
52
|
+
- `leading`: `settings.leading`; values: `tight`, `snug`, `normal`, `relaxed`, `loose`; has `children`.
|
|
53
|
+
- `alignment`: `settings.alignment`; values: `left`, `center`, `right`, `justify`; has `children`.
|
|
54
|
+
- `headline`: `settings.level` from `1` to `6`; has `children`.
|
|
55
|
+
- `horizontalLine`: no settings or children.
|
|
56
|
+
- `list`: `settings.numbered`; `children` are `item` tool objects.
|
|
57
|
+
- `item`: structural list item; meaningful inside `list`; uses `children`.
|
|
58
|
+
- `table`: `settings.headRows`, `settings.headColumns`; `children` are `row` tool objects.
|
|
59
|
+
- `row`: structural table row; meaningful inside `table`; `children` are `column` tool objects.
|
|
60
|
+
- `column`: structural table cell; meaningful inside `row`; uses `children`.
|
|
61
|
+
- `link`: `settings.href`; optional `settings.embedded` with `type` and `size`; non-embedded links use `children`.
|
|
62
|
+
- `image`: `settings.url`; optional `settings.caption`, `settings.cid`.
|
|
63
|
+
- `placeholder`: `settings.domain`, `settings.field`, `settings.type`; renders as `{{domain.field}}` in reading mode.
|
|
64
|
+
- `conditional`: `settings.service`, `settings.conditions[]` with `{ "condition": string, "fields": object }`; has conditional `children`.
|
|
65
|
+
- `snippet`: `settings.service`, `settings.topLevelEntity`, `settings.snippet`, `settings.config`; optional `settings.inline`.
|
|
66
|
+
- `ai`: optional `settings.prompt`, `settings.loadingText`; optional replacement `children`; reading mode renders empty text.
|
|
67
|
+
- `quote`: optional `settings.author`, `settings.datetime`, `settings.messengerId`, `settings.html`; treat HTML as untrusted and sanitize before rendering.
|
|
68
|
+
- `knowledgeBaseReference`: `settings.key`; has `children`.
|
|
69
|
+
- `knowledgeBaseLink`: `settings.articleId`; has `children`.
|
|
70
|
+
- `alert`: `settings.type`; values: `info`, `success`, `warning`, `error`; has `children`.
|
|
71
|
+
- `code`: `settings.code`; optional `settings.block`, `settings.language`.
|
|
72
|
+
|
|
73
|
+
Link embed `type` values: `youtube`, `figmaFile`, `figmaDesign`, `figmaBoard`, `heygen`, `heygenEmbeds`, `synthesia`, `iframe`.
|
|
74
|
+
|
|
75
|
+
Link embed `size` values: `small`, `medium`, `large`.
|
|
76
|
+
|
|
77
|
+
Code `language` values: `typescript`, `javascript`, `xml`, `json`, `yaml`, `css`, `graphql`.
|
|
78
|
+
|
|
79
|
+
## Edge Cases
|
|
80
|
+
|
|
81
|
+
- Missing `children` and empty `children: []` both mean no nested content.
|
|
82
|
+
- Missing `settings` is valid only when the tool has no required settings.
|
|
83
|
+
- Some tools ignore `children` even if present, for example `image`, `code`, `quote`, `snippet`, and embedded `link`.
|
|
84
|
+
- `placeholder`, `conditional`, `snippet`, and `knowledgeBaseLink` need external application context to render fully.
|
|
85
|
+
- `conditional.children` should only be displayed when its conditions pass.
|
|
86
|
+
- `snippet` content is rendered from `settings` by an external renderer, not stored in `children`.
|
|
87
|
+
- `quote.settings.html` can contain HTML; consumers should sanitize it even if it was already sanitized by the producer.
|
|
88
|
+
- `ai` is transient editing state. Consumers that render final read-only content should treat it as empty.
|
|
89
|
+
- `cid` on `image` may reference an attached resource instead of using only `url`.
|
|
90
|
+
- Structural tools `item`, `row`, and `column` are not meaningful as top-level document blocks.
|
|
91
|
+
|
|
92
|
+
## Compact Examples
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{ "tool": "headline", "settings": { "level": 2 }, "children": ["Heading"] }
|
|
96
|
+
{ "tool": "list", "settings": { "numbered": false }, "children": [{ "tool": "item", "children": ["Item"] }] }
|
|
97
|
+
{ "tool": "image", "settings": { "url": "https://example.com/image.png", "caption": "Optional" } }
|
|
98
|
+
{ "tool": "placeholder", "settings": { "domain": "User", "field": "email", "type": "string" } }
|
|
99
|
+
{ "tool": "code", "settings": { "block": true, "language": "typescript", "code": "const value = 1" } }
|
|
100
|
+
```
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Use the static filter API to fetch localized search filter definitions:
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
|
-
const filters = await sdk.static.filter.getFilters({ locale:
|
|
8
|
+
const filters = await sdk.static.filter.getFilters({ locale: "de-DE" });
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
The service is implemented for both `v9` and `v10` backends and returns normalized filters for building search UIs.
|
|
@@ -14,8 +14,8 @@ The service is implemented for both `v9` and `v10` backends and returns normaliz
|
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
type FilterGetFiltersInput = {
|
|
17
|
-
locale:
|
|
18
|
-
}
|
|
17
|
+
locale: "de-DE" | "en-US";
|
|
18
|
+
};
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
Sample:
|
|
@@ -129,6 +129,8 @@ Optional `WebsiteSDKOptions` can add public custom filters:
|
|
|
129
129
|
|
|
130
130
|
Only custom definitions with `searchable: true` and `internal: false` are exposed by `getFilters`.
|
|
131
131
|
|
|
132
|
+
For v10, `getFilters` also exposes the mapped BooleanFilter `pets`, labeled `Dogs welcome` / `Hunde willkommen`. It maps to one pet in search occupancy; use `petsCount` when the UI needs an exact pet count instead.
|
|
133
|
+
|
|
132
134
|
## CLI Usage
|
|
133
135
|
|
|
134
136
|
Fetch filters with environment-based config:
|