@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.
Files changed (31) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +24 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/src/bookings-availability-v1-slot-availability.http.d.ts +51 -0
  5. package/build/cjs/src/bookings-availability-v1-slot-availability.http.js +160 -0
  6. package/build/cjs/src/bookings-availability-v1-slot-availability.http.js.map +1 -0
  7. package/build/cjs/src/bookings-availability-v1-slot-availability.public.d.ts +5 -0
  8. package/build/cjs/src/bookings-availability-v1-slot-availability.public.js +14 -0
  9. package/build/cjs/src/bookings-availability-v1-slot-availability.public.js.map +1 -0
  10. package/build/cjs/src/bookings-availability-v1-slot-availability.types.d.ts +260 -0
  11. package/build/cjs/src/bookings-availability-v1-slot-availability.types.js +16 -0
  12. package/build/cjs/src/bookings-availability-v1-slot-availability.types.js.map +1 -0
  13. package/build/cjs/src/bookings-availability-v1-slot-availability.universal.d.ts +341 -0
  14. package/build/cjs/src/bookings-availability-v1-slot-availability.universal.js +165 -0
  15. package/build/cjs/src/bookings-availability-v1-slot-availability.universal.js.map +1 -0
  16. package/build/es/index.d.ts +1 -0
  17. package/build/es/index.js +2 -0
  18. package/build/es/index.js.map +1 -0
  19. package/build/es/src/bookings-availability-v1-slot-availability.http.d.ts +51 -0
  20. package/build/es/src/bookings-availability-v1-slot-availability.http.js +156 -0
  21. package/build/es/src/bookings-availability-v1-slot-availability.http.js.map +1 -0
  22. package/build/es/src/bookings-availability-v1-slot-availability.public.d.ts +5 -0
  23. package/build/es/src/bookings-availability-v1-slot-availability.public.js +8 -0
  24. package/build/es/src/bookings-availability-v1-slot-availability.public.js.map +1 -0
  25. package/build/es/src/bookings-availability-v1-slot-availability.types.d.ts +260 -0
  26. package/build/es/src/bookings-availability-v1-slot-availability.types.js +13 -0
  27. package/build/es/src/bookings-availability-v1-slot-availability.types.js.map +1 -0
  28. package/build/es/src/bookings-availability-v1-slot-availability.universal.d.ts +341 -0
  29. package/build/es/src/bookings-availability-v1-slot-availability.universal.js +142 -0
  30. package/build/es/src/bookings-availability-v1-slot-availability.universal.js.map +1 -0
  31. package/package.json +37 -0
@@ -0,0 +1 @@
1
+ export * as availabilityCalendar from './src/bookings-availability-v1-slot-availability.public';
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.availabilityCalendar = void 0;
23
+ exports.availabilityCalendar = __importStar(require("./src/bookings-availability-v1-slot-availability.public"));
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,gHAAgG"}
@@ -0,0 +1,51 @@
1
+ import { RequestOptionsFactory } from '@wix/sdk-types';
2
+ import { QueryAvailabilityRequest, QueryAvailabilityResponse } from './bookings-availability-v1-slot-availability.types';
3
+ /**
4
+ * Retrieves the availability for sessions
5
+ * that match the provided query criteria (paging, filtering, and sorting).
6
+ *
7
+ *
8
+ * The Calendar Availability APIs calculate the availability of sessions for
9
+ * appointments and classes, but not
10
+ * for courses.
11
+ *
12
+ * The entire list of slots is returned in case you want to display both
13
+ * available and non-available slots in the calendar for your customers.
14
+ * Using the `bookable` property, you can limit the display to available
15
+ * slots only.
16
+ *
17
+ * When querying, you must enter a start date and an end date. This avoids very large
18
+ * results that can impact performance.
19
+ *
20
+ * #### Calculating availability
21
+ *
22
+ * The availability is determined
23
+ * by checking:
24
+ * + **The sessions' open slots**. A slot is considered open if the session's
25
+ * capacity is greater than number of participants.
26
+ * + **Booking policies**. Policies that affect whether a slot is considered
27
+ * available include `tooEarlyToBook`, `tooLateToBook`, and `bookOnlineDisabled`.
28
+ *
29
+ * Locked sessions do not impact session availability and `bookable` can
30
+ * be `true` even if `locked` is `true`. For example, if a session has a waitlist and a
31
+ * place frees up, the slot is offered to the customers on the waitlist, one by one. The
32
+ * sesssion remains locked because there is still a waitlist, but for a period of time
33
+ * there is availability, until a customer on the waitlist takes the slot. Locking
34
+ * prevents customers who are not yet on the waitlist from grabbing the slot.
35
+ *
36
+ * #### Handling Daylight Savings Time (DST) for local time zones
37
+ *
38
+ * Because of DST, there are cases where certain times either do not exist
39
+ * or exist twice for a local time zone.
40
+ * For example, the tine `00:05` on September 5th 2021 might not exist in Santiago, Chile,
41
+ * because at `00:00` the clock moved
42
+ * 1 hour forward to `01:00`.
43
+ *
44
+ * In this case, the Availability APIs take this
45
+ * into account and mediate the time gaps automatically. The non-existant local time is
46
+ * automtically moved forward 1 hour to match local DST. Local times that exist do not change.
47
+ * So if the `Query Availability` endpoint is called with a `startDate` of `2021-09-05T00:00:01.000`
48
+ * and an `endDate` of `2021-09-06T00:00:02.000`, `2021-09-05T01:00:01.000` is used in the query
49
+ * instead. The start time shifts one hour forward and the end time remains the same.
50
+ */
51
+ export declare function queryAvailability(payload: QueryAvailabilityRequest): RequestOptionsFactory<QueryAvailabilityResponse>;
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.queryAvailability = void 0;
4
+ const ambassador_1 = require("@wix/metro-runtime/ambassador");
5
+ const metro_runtime_1 = require("@wix/metro-runtime");
6
+ const _queryAvailabilityRequest = {};
7
+ const _queryAvailabilityResponse = {};
8
+ function resolveComWixpressBookingsAvailabilityAvailabilityCalendarUrl(opts) {
9
+ const domainToMappings = {
10
+ 'api._api_base_domain_': [
11
+ {
12
+ srcPath: '/availability-calendar',
13
+ destPath: '',
14
+ },
15
+ ],
16
+ _: [
17
+ {
18
+ srcPath: '/_api/availability-calendar/v1/availability/query',
19
+ destPath: '/v1/availability/query',
20
+ },
21
+ {
22
+ srcPath: '/_api/availability-calendar/v2/availability/schedule',
23
+ destPath: '/v2/availability/schedule',
24
+ },
25
+ ],
26
+ '*.dev.wix-code.com': [
27
+ {
28
+ srcPath: '/_api/availability-calendar/v1/availability/query',
29
+ destPath: '/v1/availability/query',
30
+ },
31
+ ],
32
+ 'editor._base_domain_': [
33
+ {
34
+ srcPath: '/_api/availability-calendar/v1/availability/query',
35
+ destPath: '/v1/availability/query',
36
+ },
37
+ ],
38
+ 'blocks._base_domain_': [
39
+ {
40
+ srcPath: '/_api/availability-calendar/v1/availability/query',
41
+ destPath: '/v1/availability/query',
42
+ },
43
+ ],
44
+ 'create.editorx': [
45
+ {
46
+ srcPath: '/_api/availability-calendar/v1/availability/query',
47
+ destPath: '/v1/availability/query',
48
+ },
49
+ ],
50
+ 'editor.wixapps.net': [
51
+ {
52
+ srcPath: '/_api/availability-calendar/v1/availability/query',
53
+ destPath: '/v1/availability/query',
54
+ },
55
+ ],
56
+ 'editor-flow.wixapps.net': [
57
+ {
58
+ srcPath: '/_api/availability-calendar/v1/availability/query',
59
+ destPath: '/v1/availability/query',
60
+ },
61
+ ],
62
+ 'www.wixapis.com': [
63
+ {
64
+ srcPath: '/availability-calendar/v1/availability/query',
65
+ destPath: '/v1/availability/query',
66
+ },
67
+ {
68
+ srcPath: '/bookings/availability-calendar/v1/availability/query',
69
+ destPath: '/v1/availability/query',
70
+ },
71
+ {
72
+ srcPath: '/bookings/v1/availability/query',
73
+ destPath: '/v1/availability/query',
74
+ },
75
+ ],
76
+ 'manage._base_domain_': [
77
+ {
78
+ srcPath: '/_api/availability-calendar/v1/availability/query',
79
+ destPath: '/v1/availability/query',
80
+ },
81
+ ],
82
+ 'www._base_domain_': [
83
+ {
84
+ srcPath: '/_api/availability-calendar/v1/availability/query',
85
+ destPath: '/v1/availability/query',
86
+ },
87
+ ],
88
+ };
89
+ return metro_runtime_1.resolveUrl(Object.assign(opts, { domainToMappings }));
90
+ }
91
+ /**
92
+ * Retrieves the availability for sessions
93
+ * that match the provided query criteria (paging, filtering, and sorting).
94
+ *
95
+ *
96
+ * The Calendar Availability APIs calculate the availability of sessions for
97
+ * appointments and classes, but not
98
+ * for courses.
99
+ *
100
+ * The entire list of slots is returned in case you want to display both
101
+ * available and non-available slots in the calendar for your customers.
102
+ * Using the `bookable` property, you can limit the display to available
103
+ * slots only.
104
+ *
105
+ * When querying, you must enter a start date and an end date. This avoids very large
106
+ * results that can impact performance.
107
+ *
108
+ * #### Calculating availability
109
+ *
110
+ * The availability is determined
111
+ * by checking:
112
+ * + **The sessions' open slots**. A slot is considered open if the session's
113
+ * capacity is greater than number of participants.
114
+ * + **Booking policies**. Policies that affect whether a slot is considered
115
+ * available include `tooEarlyToBook`, `tooLateToBook`, and `bookOnlineDisabled`.
116
+ *
117
+ * Locked sessions do not impact session availability and `bookable` can
118
+ * be `true` even if `locked` is `true`. For example, if a session has a waitlist and a
119
+ * place frees up, the slot is offered to the customers on the waitlist, one by one. The
120
+ * sesssion remains locked because there is still a waitlist, but for a period of time
121
+ * there is availability, until a customer on the waitlist takes the slot. Locking
122
+ * prevents customers who are not yet on the waitlist from grabbing the slot.
123
+ *
124
+ * #### Handling Daylight Savings Time (DST) for local time zones
125
+ *
126
+ * Because of DST, there are cases where certain times either do not exist
127
+ * or exist twice for a local time zone.
128
+ * For example, the tine `00:05` on September 5th 2021 might not exist in Santiago, Chile,
129
+ * because at `00:00` the clock moved
130
+ * 1 hour forward to `01:00`.
131
+ *
132
+ * In this case, the Availability APIs take this
133
+ * into account and mediate the time gaps automatically. The non-existant local time is
134
+ * automtically moved forward 1 hour to match local DST. Local times that exist do not change.
135
+ * So if the `Query Availability` endpoint is called with a `startDate` of `2021-09-05T00:00:01.000`
136
+ * and an `endDate` of `2021-09-06T00:00:02.000`, `2021-09-05T01:00:01.000` is used in the query
137
+ * instead. The start time shifts one hour forward and the end time remains the same.
138
+ */
139
+ function queryAvailability(payload) {
140
+ const { toJSON: toReq, fromJSON: fromReq } = ambassador_1.serializer(_queryAvailabilityRequest, {});
141
+ const { fromJSON: fromRes } = ambassador_1.serializer(_queryAvailabilityResponse, {});
142
+ function __queryAvailability({ host }) {
143
+ const serializedData = toReq(payload);
144
+ const metadata = {
145
+ method: 'POST',
146
+ url: resolveComWixpressBookingsAvailabilityAvailabilityCalendarUrl({
147
+ protoPath: '/v1/availability/query',
148
+ data: serializedData,
149
+ host,
150
+ }),
151
+ data: serializedData,
152
+ transformResponse: fromRes,
153
+ };
154
+ return metadata;
155
+ }
156
+ __queryAvailability.fromReq = fromReq;
157
+ return __queryAvailability;
158
+ }
159
+ exports.queryAvailability = queryAvailability;
160
+ //# 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":";;;AAAA,8DAA2D;AAC3D,sDAAgD;AAQhD,MAAM,yBAAyB,GAAG,EAAE,CAAC;AACrC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAEtC,SAAS,6DAA6D,CACpE,IAA8C;IAE9C,MAAM,gBAAgB,GAAG;QACvB,uBAAuB,EAAE;YACvB;gBACE,OAAO,EAAE,wBAAwB;gBACjC,QAAQ,EAAE,EAAE;aACb;SACF;QACD,CAAC,EAAE;YACD;gBACE,OAAO,EAAE,mDAAmD;gBAC5D,QAAQ,EAAE,wBAAwB;aACnC;YACD;gBACE,OAAO,EAAE,sDAAsD;gBAC/D,QAAQ,EAAE,2BAA2B;aACtC;SACF;QACD,oBAAoB,EAAE;YACpB;gBACE,OAAO,EAAE,mDAAmD;gBAC5D,QAAQ,EAAE,wBAAwB;aACnC;SACF;QACD,sBAAsB,EAAE;YACtB;gBACE,OAAO,EAAE,mDAAmD;gBAC5D,QAAQ,EAAE,wBAAwB;aACnC;SACF;QACD,sBAAsB,EAAE;YACtB;gBACE,OAAO,EAAE,mDAAmD;gBAC5D,QAAQ,EAAE,wBAAwB;aACnC;SACF;QACD,gBAAgB,EAAE;YAChB;gBACE,OAAO,EAAE,mDAAmD;gBAC5D,QAAQ,EAAE,wBAAwB;aACnC;SACF;QACD,oBAAoB,EAAE;YACpB;gBACE,OAAO,EAAE,mDAAmD;gBAC5D,QAAQ,EAAE,wBAAwB;aACnC;SACF;QACD,yBAAyB,EAAE;YACzB;gBACE,OAAO,EAAE,mDAAmD;gBAC5D,QAAQ,EAAE,wBAAwB;aACnC;SACF;QACD,iBAAiB,EAAE;YACjB;gBACE,OAAO,EAAE,8CAA8C;gBACvD,QAAQ,EAAE,wBAAwB;aACnC;YACD;gBACE,OAAO,EAAE,uDAAuD;gBAChE,QAAQ,EAAE,wBAAwB;aACnC;YACD;gBACE,OAAO,EAAE,iCAAiC;gBAC1C,QAAQ,EAAE,wBAAwB;aACnC;SACF;QACD,sBAAsB,EAAE;YACtB;gBACE,OAAO,EAAE,mDAAmD;gBAC5D,QAAQ,EAAE,wBAAwB;aACnC;SACF;QACD,mBAAmB,EAAE;YACnB;gBACE,OAAO,EAAE,mDAAmD;gBAC5D,QAAQ,EAAE,wBAAwB;aACnC;SACF;KACF,CAAC;IAEF,OAAO,0BAAU,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,SAAgB,iBAAiB,CAC/B,OAAiC;IAEjC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,uBAAU,CACrD,yBAAyB,EACzB,EAAE,CACH,CAAC;IACF,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,uBAAU,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC;IAEzE,SAAS,mBAAmB,CAAC,EAAE,IAAI,EAAO;QACxC,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAG;YACf,MAAM,EAAE,MAAa;YACrB,GAAG,EAAE,6DAA6D,CAAC;gBACjE,SAAS,EAAE,wBAAwB;gBACnC,IAAI,EAAE,cAAc;gBACpB,IAAI;aACL,CAAC;YACF,IAAI,EAAE,cAAc;YACpB,iBAAiB,EAAE,OAAO;SAC3B,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,mBAAmB,CAAC,OAAO,GAAG,OAAO,CAAC;IAEtC,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AA5BD,8CA4BC"}
@@ -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,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SortOrder = exports.LocationType = exports.queryAvailability = void 0;
4
+ const bookings_availability_v1_slot_availability_universal_1 = require("./bookings-availability-v1-slot-availability.universal");
5
+ function queryAvailability(httpClient) {
6
+ return (query, options) => bookings_availability_v1_slot_availability_universal_1.queryAvailability(query, options,
7
+ // @ts-ignore
8
+ { httpClient });
9
+ }
10
+ exports.queryAvailability = queryAvailability;
11
+ var bookings_availability_v1_slot_availability_universal_2 = require("./bookings-availability-v1-slot-availability.universal");
12
+ Object.defineProperty(exports, "LocationType", { enumerable: true, get: function () { return bookings_availability_v1_slot_availability_universal_2.LocationType; } });
13
+ Object.defineProperty(exports, "SortOrder", { enumerable: true, get: function () { return bookings_availability_v1_slot_availability_universal_2.SortOrder; } });
14
+ //# 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,iIAIgE;AAEhE,SAAgB,iBAAiB,CAAC,UAAsB;IACtD,OAAO,CAAC,KAAc,EAAE,OAAkC,EAAE,EAAE,CAC5D,wEAA0B,CACxB,KAAK,EACL,OAAO;IACP,aAAa;IACb,EAAE,UAAU,EAAE,CACf,CAAC;AACN,CAAC;AARD,8CAQC;AAED,+HAGgE;AAF9D,oJAAA,YAAY,OAAA;AACZ,iJAAA,SAAS,OAAA"}
@@ -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,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SortOrder = exports.LocationType = void 0;
4
+ var LocationType;
5
+ (function (LocationType) {
6
+ LocationType["UNDEFINED"] = "UNDEFINED";
7
+ LocationType["OWNER_BUSINESS"] = "OWNER_BUSINESS";
8
+ LocationType["OWNER_CUSTOM"] = "OWNER_CUSTOM";
9
+ LocationType["CUSTOM"] = "CUSTOM";
10
+ })(LocationType = exports.LocationType || (exports.LocationType = {}));
11
+ var SortOrder;
12
+ (function (SortOrder) {
13
+ SortOrder["ASC"] = "ASC";
14
+ SortOrder["DESC"] = "DESC";
15
+ })(SortOrder = exports.SortOrder || (exports.SortOrder = {}));
16
+ //# 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,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uCAAuB,CAAA;IACvB,iDAAiC,CAAA;IACjC,6CAA6B,CAAA;IAC7B,iCAAiB,CAAA;AACnB,CAAC,EALW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAKvB;AA8ED,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB"}