@wix/bookings 1.0.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/build/cjs/index.d.ts +1 -0
- package/build/cjs/index.js +24 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/src/bookings-availability-v1-slot-availability.http.d.ts +51 -0
- package/build/cjs/src/bookings-availability-v1-slot-availability.http.js +160 -0
- package/build/cjs/src/bookings-availability-v1-slot-availability.http.js.map +1 -0
- package/build/cjs/src/bookings-availability-v1-slot-availability.public.d.ts +5 -0
- package/build/cjs/src/bookings-availability-v1-slot-availability.public.js +14 -0
- package/build/cjs/src/bookings-availability-v1-slot-availability.public.js.map +1 -0
- package/build/cjs/src/bookings-availability-v1-slot-availability.types.d.ts +260 -0
- package/build/cjs/src/bookings-availability-v1-slot-availability.types.js +16 -0
- package/build/cjs/src/bookings-availability-v1-slot-availability.types.js.map +1 -0
- package/build/cjs/src/bookings-availability-v1-slot-availability.universal.d.ts +341 -0
- package/build/cjs/src/bookings-availability-v1-slot-availability.universal.js +165 -0
- package/build/cjs/src/bookings-availability-v1-slot-availability.universal.js.map +1 -0
- package/build/es/index.d.ts +1 -0
- package/build/es/index.js +2 -0
- package/build/es/index.js.map +1 -0
- package/build/es/src/bookings-availability-v1-slot-availability.http.d.ts +51 -0
- package/build/es/src/bookings-availability-v1-slot-availability.http.js +156 -0
- package/build/es/src/bookings-availability-v1-slot-availability.http.js.map +1 -0
- package/build/es/src/bookings-availability-v1-slot-availability.public.d.ts +5 -0
- package/build/es/src/bookings-availability-v1-slot-availability.public.js +8 -0
- package/build/es/src/bookings-availability-v1-slot-availability.public.js.map +1 -0
- package/build/es/src/bookings-availability-v1-slot-availability.types.d.ts +260 -0
- package/build/es/src/bookings-availability-v1-slot-availability.types.js +13 -0
- package/build/es/src/bookings-availability-v1-slot-availability.types.js.map +1 -0
- package/build/es/src/bookings-availability-v1-slot-availability.universal.d.ts +341 -0
- package/build/es/src/bookings-availability-v1-slot-availability.universal.js +142 -0
- package/build/es/src/bookings-availability-v1-slot-availability.universal.js.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { serializer } from '@wix/metro-runtime/ambassador';
|
|
2
|
+
import { resolveUrl } from '@wix/metro-runtime';
|
|
3
|
+
const _queryAvailabilityRequest = {};
|
|
4
|
+
const _queryAvailabilityResponse = {};
|
|
5
|
+
function resolveComWixpressBookingsAvailabilityAvailabilityCalendarUrl(opts) {
|
|
6
|
+
const domainToMappings = {
|
|
7
|
+
'api._api_base_domain_': [
|
|
8
|
+
{
|
|
9
|
+
srcPath: '/availability-calendar',
|
|
10
|
+
destPath: '',
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
_: [
|
|
14
|
+
{
|
|
15
|
+
srcPath: '/_api/availability-calendar/v1/availability/query',
|
|
16
|
+
destPath: '/v1/availability/query',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
srcPath: '/_api/availability-calendar/v2/availability/schedule',
|
|
20
|
+
destPath: '/v2/availability/schedule',
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
'*.dev.wix-code.com': [
|
|
24
|
+
{
|
|
25
|
+
srcPath: '/_api/availability-calendar/v1/availability/query',
|
|
26
|
+
destPath: '/v1/availability/query',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
'editor._base_domain_': [
|
|
30
|
+
{
|
|
31
|
+
srcPath: '/_api/availability-calendar/v1/availability/query',
|
|
32
|
+
destPath: '/v1/availability/query',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
'blocks._base_domain_': [
|
|
36
|
+
{
|
|
37
|
+
srcPath: '/_api/availability-calendar/v1/availability/query',
|
|
38
|
+
destPath: '/v1/availability/query',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
'create.editorx': [
|
|
42
|
+
{
|
|
43
|
+
srcPath: '/_api/availability-calendar/v1/availability/query',
|
|
44
|
+
destPath: '/v1/availability/query',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
'editor.wixapps.net': [
|
|
48
|
+
{
|
|
49
|
+
srcPath: '/_api/availability-calendar/v1/availability/query',
|
|
50
|
+
destPath: '/v1/availability/query',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
'editor-flow.wixapps.net': [
|
|
54
|
+
{
|
|
55
|
+
srcPath: '/_api/availability-calendar/v1/availability/query',
|
|
56
|
+
destPath: '/v1/availability/query',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
'www.wixapis.com': [
|
|
60
|
+
{
|
|
61
|
+
srcPath: '/availability-calendar/v1/availability/query',
|
|
62
|
+
destPath: '/v1/availability/query',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
srcPath: '/bookings/availability-calendar/v1/availability/query',
|
|
66
|
+
destPath: '/v1/availability/query',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
srcPath: '/bookings/v1/availability/query',
|
|
70
|
+
destPath: '/v1/availability/query',
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
'manage._base_domain_': [
|
|
74
|
+
{
|
|
75
|
+
srcPath: '/_api/availability-calendar/v1/availability/query',
|
|
76
|
+
destPath: '/v1/availability/query',
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
'www._base_domain_': [
|
|
80
|
+
{
|
|
81
|
+
srcPath: '/_api/availability-calendar/v1/availability/query',
|
|
82
|
+
destPath: '/v1/availability/query',
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
};
|
|
86
|
+
return resolveUrl(Object.assign(opts, { domainToMappings }));
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Retrieves the availability for sessions
|
|
90
|
+
* that match the provided query criteria (paging, filtering, and sorting).
|
|
91
|
+
*
|
|
92
|
+
*
|
|
93
|
+
* The Calendar Availability APIs calculate the availability of sessions for
|
|
94
|
+
* appointments and classes, but not
|
|
95
|
+
* for courses.
|
|
96
|
+
*
|
|
97
|
+
* The entire list of slots is returned in case you want to display both
|
|
98
|
+
* available and non-available slots in the calendar for your customers.
|
|
99
|
+
* Using the `bookable` property, you can limit the display to available
|
|
100
|
+
* slots only.
|
|
101
|
+
*
|
|
102
|
+
* When querying, you must enter a start date and an end date. This avoids very large
|
|
103
|
+
* results that can impact performance.
|
|
104
|
+
*
|
|
105
|
+
* #### Calculating availability
|
|
106
|
+
*
|
|
107
|
+
* The availability is determined
|
|
108
|
+
* by checking:
|
|
109
|
+
* + **The sessions' open slots**. A slot is considered open if the session's
|
|
110
|
+
* capacity is greater than number of participants.
|
|
111
|
+
* + **Booking policies**. Policies that affect whether a slot is considered
|
|
112
|
+
* available include `tooEarlyToBook`, `tooLateToBook`, and `bookOnlineDisabled`.
|
|
113
|
+
*
|
|
114
|
+
* Locked sessions do not impact session availability and `bookable` can
|
|
115
|
+
* be `true` even if `locked` is `true`. For example, if a session has a waitlist and a
|
|
116
|
+
* place frees up, the slot is offered to the customers on the waitlist, one by one. The
|
|
117
|
+
* sesssion remains locked because there is still a waitlist, but for a period of time
|
|
118
|
+
* there is availability, until a customer on the waitlist takes the slot. Locking
|
|
119
|
+
* prevents customers who are not yet on the waitlist from grabbing the slot.
|
|
120
|
+
*
|
|
121
|
+
* #### Handling Daylight Savings Time (DST) for local time zones
|
|
122
|
+
*
|
|
123
|
+
* Because of DST, there are cases where certain times either do not exist
|
|
124
|
+
* or exist twice for a local time zone.
|
|
125
|
+
* For example, the tine `00:05` on September 5th 2021 might not exist in Santiago, Chile,
|
|
126
|
+
* because at `00:00` the clock moved
|
|
127
|
+
* 1 hour forward to `01:00`.
|
|
128
|
+
*
|
|
129
|
+
* In this case, the Availability APIs take this
|
|
130
|
+
* into account and mediate the time gaps automatically. The non-existant local time is
|
|
131
|
+
* automtically moved forward 1 hour to match local DST. Local times that exist do not change.
|
|
132
|
+
* So if the `Query Availability` endpoint is called with a `startDate` of `2021-09-05T00:00:01.000`
|
|
133
|
+
* and an `endDate` of `2021-09-06T00:00:02.000`, `2021-09-05T01:00:01.000` is used in the query
|
|
134
|
+
* instead. The start time shifts one hour forward and the end time remains the same.
|
|
135
|
+
*/
|
|
136
|
+
export function queryAvailability(payload) {
|
|
137
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_queryAvailabilityRequest, {});
|
|
138
|
+
const { fromJSON: fromRes } = serializer(_queryAvailabilityResponse, {});
|
|
139
|
+
function __queryAvailability({ host }) {
|
|
140
|
+
const serializedData = toReq(payload);
|
|
141
|
+
const metadata = {
|
|
142
|
+
method: 'POST',
|
|
143
|
+
url: resolveComWixpressBookingsAvailabilityAvailabilityCalendarUrl({
|
|
144
|
+
protoPath: '/v1/availability/query',
|
|
145
|
+
data: serializedData,
|
|
146
|
+
host,
|
|
147
|
+
}),
|
|
148
|
+
data: serializedData,
|
|
149
|
+
transformResponse: fromRes,
|
|
150
|
+
};
|
|
151
|
+
return metadata;
|
|
152
|
+
}
|
|
153
|
+
__queryAvailability.fromReq = fromReq;
|
|
154
|
+
return __queryAvailability;
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=bookings-availability-v1-slot-availability.http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookings-availability-v1-slot-availability.http.js","sourceRoot":"","sources":["../../../src/bookings-availability-v1-slot-availability.http.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { HttpClient } from '@wix/sdk-types';
|
|
2
|
+
import { QueryAvailabilityOptions, QueryV2 } from './bookings-availability-v1-slot-availability.universal';
|
|
3
|
+
export declare function queryAvailability(httpClient: HttpClient): (query: QueryV2, options?: QueryAvailabilityOptions | undefined) => Promise<import("./bookings-availability-v1-slot-availability.universal").QueryAvailabilityResponse>;
|
|
4
|
+
export { LocationType, SortOrder, } from './bookings-availability-v1-slot-availability.universal';
|
|
5
|
+
export { SlotAvailability, Slot, SlotResource, Location, WaitingList, BookingPolicyViolations, QueryAvailabilityRequest, QueryV2, QueryV2PagingMethodOneOf, Sorting, CursorPaging, QueryAvailabilityResponse, PagingMetadataV2, Cursors, GetSlotAvailabilityRequest, GetSlotAvailabilityResponse, BookingPolicySettings, GetScheduleAvailabilityRequest, GetScheduleAvailabilityResponse, ScheduleAvailability, QueryAvailabilityOptions, } from './bookings-availability-v1-slot-availability.universal';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { queryAvailability as universalQueryAvailability, } from './bookings-availability-v1-slot-availability.universal';
|
|
2
|
+
export function queryAvailability(httpClient) {
|
|
3
|
+
return (query, options) => universalQueryAvailability(query, options,
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
{ httpClient });
|
|
6
|
+
}
|
|
7
|
+
export { LocationType, SortOrder, } from './bookings-availability-v1-slot-availability.universal';
|
|
8
|
+
//# sourceMappingURL=bookings-availability-v1-slot-availability.public.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookings-availability-v1-slot-availability.public.js","sourceRoot":"","sources":["../../../src/bookings-availability-v1-slot-availability.public.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,IAAI,0BAA0B,GAGhD,MAAM,wDAAwD,CAAC;AAEhE,MAAM,UAAU,iBAAiB,CAAC,UAAsB;IACtD,OAAO,CAAC,KAAc,EAAE,OAAkC,EAAE,EAAE,CAC5D,0BAA0B,CACxB,KAAK,EACL,OAAO;IACP,aAAa;IACb,EAAE,UAAU,EAAE,CACf,CAAC;AACN,CAAC;AAED,OAAO,EACL,YAAY,EACZ,SAAS,GACV,MAAM,wDAAwD,CAAC"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
export interface SlotAvailability {
|
|
2
|
+
/**
|
|
3
|
+
* The slot for the corresponding session, when the session is either a single session
|
|
4
|
+
* or a specific session generated from a recurring session.
|
|
5
|
+
*/
|
|
6
|
+
slot?: Slot;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the slot is bookable. Bookability is determined by checking a
|
|
9
|
+
* session's open slots and booking policies. Locks are not taken into
|
|
10
|
+
* account.
|
|
11
|
+
*/
|
|
12
|
+
bookable?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Total number of spots for this slot.
|
|
15
|
+
* For example, if a session has a total of 10 spots and 3 spots are booked,
|
|
16
|
+
* `spotsTotal` is 10 and `openSpots` is 7.
|
|
17
|
+
*/
|
|
18
|
+
totalSpots?: number | null;
|
|
19
|
+
/** Number of open spots for this slot. */
|
|
20
|
+
openSpots?: number | null;
|
|
21
|
+
/** An object describing the slot's waitlist and its occupancy. */
|
|
22
|
+
waitingList?: WaitingList;
|
|
23
|
+
/** Booking policy violations for the slot. */
|
|
24
|
+
bookingPolicyViolations?: BookingPolicyViolations;
|
|
25
|
+
/**
|
|
26
|
+
* Indicates whether the slot is locked because a waitlist exists.
|
|
27
|
+
* When a slot frees up, the slot is offered to the next customer on the waitlist. Read-only.
|
|
28
|
+
*/
|
|
29
|
+
locked?: boolean | null;
|
|
30
|
+
}
|
|
31
|
+
export interface Slot {
|
|
32
|
+
/**
|
|
33
|
+
* ID for the slot's corresponding session, when the session is either a single session
|
|
34
|
+
* or a specific session generated from a recurring session.
|
|
35
|
+
*/
|
|
36
|
+
sessionId?: string | null;
|
|
37
|
+
/** Service ID. */
|
|
38
|
+
serviceId?: string;
|
|
39
|
+
/** Schedule ID. */
|
|
40
|
+
scheduleId?: string;
|
|
41
|
+
/**
|
|
42
|
+
* The start time of this slot in [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
|
|
43
|
+
* format.
|
|
44
|
+
*
|
|
45
|
+
* If `timezone` is specified,
|
|
46
|
+
* dates are based on the local date/time. This means that the timezone offset
|
|
47
|
+
* in the `start_date` is ignored.
|
|
48
|
+
*/
|
|
49
|
+
startDate?: string | null;
|
|
50
|
+
/**
|
|
51
|
+
* The end time of this slot in
|
|
52
|
+
* [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339) format.
|
|
53
|
+
*
|
|
54
|
+
* If `timezone` is specified,
|
|
55
|
+
* dates are based on the local date/time. This means that the timezone offset
|
|
56
|
+
* in the `end_date` is ignored.
|
|
57
|
+
*/
|
|
58
|
+
endDate?: string | null;
|
|
59
|
+
/**
|
|
60
|
+
* The timezone for which slot availability is to be calculated.
|
|
61
|
+
*
|
|
62
|
+
* Learn more about [handling Daylight Savings Time (DST) for local time zones](https://dev.wix.com/api/rest/wix-bookings/availability-calendar/query-availability#wix-bookings_availability-calendar_query-availability_handling-daylight-savings-time-dst-for-local-time-zones)
|
|
63
|
+
* when calculating availability.
|
|
64
|
+
*/
|
|
65
|
+
timezone?: string | null;
|
|
66
|
+
/**
|
|
67
|
+
* The resource required for this slot. Currently, the only supported resource
|
|
68
|
+
* is the relevant staff member for the slot.
|
|
69
|
+
*/
|
|
70
|
+
resource?: SlotResource;
|
|
71
|
+
/** Geographic location of the slot. */
|
|
72
|
+
location?: Location;
|
|
73
|
+
}
|
|
74
|
+
export interface SlotResource {
|
|
75
|
+
/**
|
|
76
|
+
* Resource ID.
|
|
77
|
+
* @readonly
|
|
78
|
+
*/
|
|
79
|
+
id?: string | null;
|
|
80
|
+
/** Resource name. Read only. */
|
|
81
|
+
name?: string | null;
|
|
82
|
+
}
|
|
83
|
+
export interface Location {
|
|
84
|
+
/**
|
|
85
|
+
* Business location ID. Available only for locations that are business locations,
|
|
86
|
+
* meaning the `location_type` is `"OWNER_BUSINESS"`.
|
|
87
|
+
*/
|
|
88
|
+
id?: string | null;
|
|
89
|
+
/** Location name. */
|
|
90
|
+
name?: string | null;
|
|
91
|
+
/** The full address of this location. */
|
|
92
|
+
formattedAddress?: string | null;
|
|
93
|
+
/**
|
|
94
|
+
* Location type.
|
|
95
|
+
*
|
|
96
|
+
* - `"OWNER_BUSINESS"`: The business address, as set in the site’s general settings.
|
|
97
|
+
* - `"OWNER_CUSTOM"`: The address as set when creating the service.
|
|
98
|
+
* - `"CUSTOM"`: The address as set for the individual session.
|
|
99
|
+
*/
|
|
100
|
+
locationType?: LocationType;
|
|
101
|
+
}
|
|
102
|
+
export declare enum LocationType {
|
|
103
|
+
UNDEFINED = "UNDEFINED",
|
|
104
|
+
OWNER_BUSINESS = "OWNER_BUSINESS",
|
|
105
|
+
OWNER_CUSTOM = "OWNER_CUSTOM",
|
|
106
|
+
CUSTOM = "CUSTOM"
|
|
107
|
+
}
|
|
108
|
+
export interface WaitingList {
|
|
109
|
+
/**
|
|
110
|
+
* Total number of spots and open spots for this waitlist.
|
|
111
|
+
* For example, a Yoga class with 10 waitlist spots and 3 registered
|
|
112
|
+
* on the waitlist has 10 `total_spots` and 7 `open_spots`.
|
|
113
|
+
*/
|
|
114
|
+
totalSpots?: number | null;
|
|
115
|
+
/** Number of open spots for this waitlist. */
|
|
116
|
+
openSpots?: number | null;
|
|
117
|
+
}
|
|
118
|
+
export interface BookingPolicyViolations {
|
|
119
|
+
/** Bookings policy violation. Too early to book this slot. */
|
|
120
|
+
tooEarlyToBook?: boolean | null;
|
|
121
|
+
/** Bookings policy violation. Too late to book this slot. */
|
|
122
|
+
tooLateToBook?: boolean | null;
|
|
123
|
+
/** Bookings policy violation. Online booking is disabled for this slot. */
|
|
124
|
+
bookOnlineDisabled?: boolean | null;
|
|
125
|
+
}
|
|
126
|
+
export interface QueryAvailabilityRequest {
|
|
127
|
+
/** Query options. */
|
|
128
|
+
query: QueryV2;
|
|
129
|
+
/**
|
|
130
|
+
* The timezone for which session availability is to be calculated. If specified,
|
|
131
|
+
* dates are based on the local date/time, meaning that the timezone offset
|
|
132
|
+
* in the date's format is ignored.
|
|
133
|
+
*
|
|
134
|
+
* Learn more about [handling Daylight Savings Time (DST) for local time zones](https://dev.wix.com/api/rest/wix-bookings/availability-calendar/query-availability#wix-bookings_availability-calendar_query-availability_handling-daylight-savings-time-dst-for-local-time-zones)
|
|
135
|
+
* when calculating availability.
|
|
136
|
+
*/
|
|
137
|
+
timezone?: string | null;
|
|
138
|
+
/**
|
|
139
|
+
* Maximum number of slots to load for each date. For example, if `slots_per_day` is set to `3`,
|
|
140
|
+
* at most 3 available slots are returned for each day in the date range specified in the query's
|
|
141
|
+
* `filter`.
|
|
142
|
+
*
|
|
143
|
+
* When a day has both bookable and non-bookable slots, bookable slots are returned first.
|
|
144
|
+
* Non-bookable slots are returned according to the specified filters, after all
|
|
145
|
+
* bookable slots are already included.
|
|
146
|
+
*/
|
|
147
|
+
slotsPerDay?: number | null;
|
|
148
|
+
}
|
|
149
|
+
export interface QueryV2 extends QueryV2PagingMethodOneOf {
|
|
150
|
+
/**
|
|
151
|
+
* Filter object. For a list of
|
|
152
|
+
* fields you can filter by, see [Calendar Availability: Supported Fields, Filters, and Sorting](https://dev.wix.com/api/rest/wix-bookings/availability-calendar/supported-fields,-filters,-and-sorting).
|
|
153
|
+
* You must include the `startDate` and `endDate` in the filter. This avoids large results that can impact performance.
|
|
154
|
+
*/
|
|
155
|
+
filter?: Record<string, any> | null;
|
|
156
|
+
/**
|
|
157
|
+
* Sort options.
|
|
158
|
+
* Currently, only sorting by `startDate` is supported. For details
|
|
159
|
+
* on sorting, see [Calendar Availability: Supported Fields, Filters and Sorting](https://dev.wix.com/api/rest/wix-bookings/availability-calendar/supported-fields,-filters,-and-sorting).
|
|
160
|
+
*/
|
|
161
|
+
sort?: Sorting[];
|
|
162
|
+
/** List of projected fields to return. All fields are supported. */
|
|
163
|
+
fields?: string[];
|
|
164
|
+
/** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
|
|
165
|
+
cursorPaging?: CursorPaging;
|
|
166
|
+
}
|
|
167
|
+
/** @oneof */
|
|
168
|
+
export interface QueryV2PagingMethodOneOf {
|
|
169
|
+
/** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
|
|
170
|
+
cursorPaging?: CursorPaging;
|
|
171
|
+
}
|
|
172
|
+
export interface Sorting {
|
|
173
|
+
/** Name of the field to sort by. */
|
|
174
|
+
fieldName?: string;
|
|
175
|
+
/** Sort order. */
|
|
176
|
+
order?: SortOrder;
|
|
177
|
+
}
|
|
178
|
+
export declare enum SortOrder {
|
|
179
|
+
ASC = "ASC",
|
|
180
|
+
DESC = "DESC"
|
|
181
|
+
}
|
|
182
|
+
export interface CursorPaging {
|
|
183
|
+
/** Number of items to load. */
|
|
184
|
+
limit?: number | null;
|
|
185
|
+
/**
|
|
186
|
+
* Pointer to the next or previous page in the list of results.
|
|
187
|
+
*
|
|
188
|
+
* You can get the relevant cursor token
|
|
189
|
+
* from the `pagingMetadata` object in the previous call's response.
|
|
190
|
+
* Not relevant for the first request.
|
|
191
|
+
*/
|
|
192
|
+
cursor?: string | null;
|
|
193
|
+
}
|
|
194
|
+
export interface QueryAvailabilityResponse {
|
|
195
|
+
/** List of slots that potentially can be booked. */
|
|
196
|
+
availabilityEntries?: SlotAvailability[];
|
|
197
|
+
/** Details on the paged set of returned results. */
|
|
198
|
+
pagingMetadata?: PagingMetadataV2;
|
|
199
|
+
}
|
|
200
|
+
export interface PagingMetadataV2 {
|
|
201
|
+
/** Number of items returned in the response. */
|
|
202
|
+
count?: number | null;
|
|
203
|
+
/** Offset that was requested. */
|
|
204
|
+
offset?: number | null;
|
|
205
|
+
/** Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. */
|
|
206
|
+
total?: number | null;
|
|
207
|
+
/** Flag that indicates the server failed to calculate the `total` field. */
|
|
208
|
+
tooManyToCount?: boolean | null;
|
|
209
|
+
/** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */
|
|
210
|
+
cursors?: Cursors;
|
|
211
|
+
}
|
|
212
|
+
export interface Cursors {
|
|
213
|
+
/** Cursor pointing to next page in the list of results. */
|
|
214
|
+
next?: string | null;
|
|
215
|
+
/** Cursor pointing to previous page in the list of results. */
|
|
216
|
+
prev?: string | null;
|
|
217
|
+
}
|
|
218
|
+
export interface GetSlotAvailabilityRequest {
|
|
219
|
+
/** The slot for which the availability is checked. */
|
|
220
|
+
slot?: Slot;
|
|
221
|
+
/**
|
|
222
|
+
* The timezone for which slot availability is to be calculated. If specified,
|
|
223
|
+
* dates are based on the local date/time, meaning that the timezone offset
|
|
224
|
+
* in the date's format is ignored.
|
|
225
|
+
*
|
|
226
|
+
* Learn more about [handling Daylight Savings Time (DST) for local time zones](https://dev.wix.com/api/rest/wix-bookings/availability-calendar/query-availability#wix-bookings_availability-calendar_query-availability_handling-daylight-savings-time-dst-for-local-time-zones)
|
|
227
|
+
* when calculating availability.
|
|
228
|
+
*/
|
|
229
|
+
timezone?: string | null;
|
|
230
|
+
}
|
|
231
|
+
export interface GetSlotAvailabilityResponse {
|
|
232
|
+
availability?: SlotAvailability;
|
|
233
|
+
bookingPolicySettings?: BookingPolicySettings;
|
|
234
|
+
}
|
|
235
|
+
export interface BookingPolicySettings {
|
|
236
|
+
/**
|
|
237
|
+
* The policy defining the maximum number of participants that can
|
|
238
|
+
* be booked for a slot or a schedule.
|
|
239
|
+
*/
|
|
240
|
+
maxParticipantsPerBooking?: number | null;
|
|
241
|
+
}
|
|
242
|
+
export interface GetScheduleAvailabilityRequest {
|
|
243
|
+
/** The schedule ID for which availability is being checked. */
|
|
244
|
+
scheduleId?: string;
|
|
245
|
+
}
|
|
246
|
+
export interface GetScheduleAvailabilityResponse {
|
|
247
|
+
availability?: ScheduleAvailability;
|
|
248
|
+
bookingPolicySettings?: BookingPolicySettings;
|
|
249
|
+
}
|
|
250
|
+
export interface ScheduleAvailability {
|
|
251
|
+
/**
|
|
252
|
+
* The total number of spots defined for the schedule, including
|
|
253
|
+
* both open and non-available spots.
|
|
254
|
+
*/
|
|
255
|
+
totalSpots?: number | null;
|
|
256
|
+
/** The number of open spots defined for the schedule. */
|
|
257
|
+
openSpots?: number | null;
|
|
258
|
+
/** Booking policy violations for the schedule. */
|
|
259
|
+
bookingPolicyViolations?: BookingPolicyViolations;
|
|
260
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export var LocationType;
|
|
2
|
+
(function (LocationType) {
|
|
3
|
+
LocationType["UNDEFINED"] = "UNDEFINED";
|
|
4
|
+
LocationType["OWNER_BUSINESS"] = "OWNER_BUSINESS";
|
|
5
|
+
LocationType["OWNER_CUSTOM"] = "OWNER_CUSTOM";
|
|
6
|
+
LocationType["CUSTOM"] = "CUSTOM";
|
|
7
|
+
})(LocationType || (LocationType = {}));
|
|
8
|
+
export var SortOrder;
|
|
9
|
+
(function (SortOrder) {
|
|
10
|
+
SortOrder["ASC"] = "ASC";
|
|
11
|
+
SortOrder["DESC"] = "DESC";
|
|
12
|
+
})(SortOrder || (SortOrder = {}));
|
|
13
|
+
//# sourceMappingURL=bookings-availability-v1-slot-availability.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookings-availability-v1-slot-availability.types.js","sourceRoot":"","sources":["../../../src/bookings-availability-v1-slot-availability.types.ts"],"names":[],"mappings":"AAyGA,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uCAAuB,CAAA;IACvB,iDAAiC,CAAA;IACjC,6CAA6B,CAAA;IAC7B,iCAAiB,CAAA;AACnB,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AA8ED,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB"}
|