@wix/auto_sdk_bookings_availability-time-slots 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 (111) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +18 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/index.typings.d.ts +1 -0
  5. package/build/cjs/index.typings.js +18 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/meta.d.ts +1 -0
  8. package/build/cjs/meta.js +18 -0
  9. package/build/cjs/meta.js.map +1 -0
  10. package/build/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.context.d.ts +6 -0
  11. package/build/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.context.js +10 -0
  12. package/build/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.context.js.map +1 -0
  13. package/build/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.http.d.ts +112 -0
  14. package/build/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.http.js +262 -0
  15. package/build/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.http.js.map +1 -0
  16. package/build/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.meta.d.ts +14 -0
  17. package/build/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.meta.js +66 -0
  18. package/build/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.meta.js.map +1 -0
  19. package/build/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.public.d.ts +139 -0
  20. package/build/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.public.js +20 -0
  21. package/build/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.public.js.map +1 -0
  22. package/build/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.types.d.ts +790 -0
  23. package/build/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.types.js +14 -0
  24. package/build/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.types.js.map +1 -0
  25. package/build/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.universal.d.ts +1107 -0
  26. package/build/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.universal.js +301 -0
  27. package/build/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.universal.js.map +1 -0
  28. package/build/es/index.d.ts +1 -0
  29. package/build/es/index.js +2 -0
  30. package/build/es/index.js.map +1 -0
  31. package/build/es/index.typings.d.ts +1 -0
  32. package/build/es/index.typings.js +2 -0
  33. package/build/es/index.typings.js.map +1 -0
  34. package/build/es/meta.d.ts +1 -0
  35. package/build/es/meta.js +2 -0
  36. package/build/es/meta.js.map +1 -0
  37. package/build/es/package.json +3 -0
  38. package/build/es/src/bookings-availability-v2-time-slot-availability-time-slots.context.d.ts +6 -0
  39. package/build/es/src/bookings-availability-v2-time-slot-availability-time-slots.context.js +6 -0
  40. package/build/es/src/bookings-availability-v2-time-slot-availability-time-slots.context.js.map +1 -0
  41. package/build/es/src/bookings-availability-v2-time-slot-availability-time-slots.http.d.ts +112 -0
  42. package/build/es/src/bookings-availability-v2-time-slot-availability-time-slots.http.js +257 -0
  43. package/build/es/src/bookings-availability-v2-time-slot-availability-time-slots.http.js.map +1 -0
  44. package/build/es/src/bookings-availability-v2-time-slot-availability-time-slots.meta.d.ts +14 -0
  45. package/build/es/src/bookings-availability-v2-time-slot-availability-time-slots.meta.js +38 -0
  46. package/build/es/src/bookings-availability-v2-time-slot-availability-time-slots.meta.js.map +1 -0
  47. package/build/es/src/bookings-availability-v2-time-slot-availability-time-slots.public.d.ts +139 -0
  48. package/build/es/src/bookings-availability-v2-time-slot-availability-time-slots.public.js +14 -0
  49. package/build/es/src/bookings-availability-v2-time-slot-availability-time-slots.public.js.map +1 -0
  50. package/build/es/src/bookings-availability-v2-time-slot-availability-time-slots.types.d.ts +790 -0
  51. package/build/es/src/bookings-availability-v2-time-slot-availability-time-slots.types.js +11 -0
  52. package/build/es/src/bookings-availability-v2-time-slot-availability-time-slots.types.js.map +1 -0
  53. package/build/es/src/bookings-availability-v2-time-slot-availability-time-slots.universal.d.ts +1107 -0
  54. package/build/es/src/bookings-availability-v2-time-slot-availability-time-slots.universal.js +273 -0
  55. package/build/es/src/bookings-availability-v2-time-slot-availability-time-slots.universal.js.map +1 -0
  56. package/build/internal/cjs/index.d.ts +1 -0
  57. package/build/internal/cjs/index.js +18 -0
  58. package/build/internal/cjs/index.js.map +1 -0
  59. package/build/internal/cjs/index.typings.d.ts +1 -0
  60. package/build/internal/cjs/index.typings.js +18 -0
  61. package/build/internal/cjs/index.typings.js.map +1 -0
  62. package/build/internal/cjs/meta.d.ts +1 -0
  63. package/build/internal/cjs/meta.js +18 -0
  64. package/build/internal/cjs/meta.js.map +1 -0
  65. package/build/internal/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.context.d.ts +6 -0
  66. package/build/internal/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.context.js +10 -0
  67. package/build/internal/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.context.js.map +1 -0
  68. package/build/internal/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.http.d.ts +112 -0
  69. package/build/internal/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.http.js +262 -0
  70. package/build/internal/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.http.js.map +1 -0
  71. package/build/internal/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.meta.d.ts +14 -0
  72. package/build/internal/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.meta.js +66 -0
  73. package/build/internal/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.meta.js.map +1 -0
  74. package/build/internal/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.public.d.ts +139 -0
  75. package/build/internal/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.public.js +20 -0
  76. package/build/internal/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.public.js.map +1 -0
  77. package/build/internal/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.types.d.ts +790 -0
  78. package/build/internal/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.types.js +14 -0
  79. package/build/internal/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.types.js.map +1 -0
  80. package/build/internal/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.universal.d.ts +1107 -0
  81. package/build/internal/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.universal.js +301 -0
  82. package/build/internal/cjs/src/bookings-availability-v2-time-slot-availability-time-slots.universal.js.map +1 -0
  83. package/build/internal/es/index.d.ts +1 -0
  84. package/build/internal/es/index.js +2 -0
  85. package/build/internal/es/index.js.map +1 -0
  86. package/build/internal/es/index.typings.d.ts +1 -0
  87. package/build/internal/es/index.typings.js +2 -0
  88. package/build/internal/es/index.typings.js.map +1 -0
  89. package/build/internal/es/meta.d.ts +1 -0
  90. package/build/internal/es/meta.js +2 -0
  91. package/build/internal/es/meta.js.map +1 -0
  92. package/build/internal/es/src/bookings-availability-v2-time-slot-availability-time-slots.context.d.ts +6 -0
  93. package/build/internal/es/src/bookings-availability-v2-time-slot-availability-time-slots.context.js +6 -0
  94. package/build/internal/es/src/bookings-availability-v2-time-slot-availability-time-slots.context.js.map +1 -0
  95. package/build/internal/es/src/bookings-availability-v2-time-slot-availability-time-slots.http.d.ts +112 -0
  96. package/build/internal/es/src/bookings-availability-v2-time-slot-availability-time-slots.http.js +257 -0
  97. package/build/internal/es/src/bookings-availability-v2-time-slot-availability-time-slots.http.js.map +1 -0
  98. package/build/internal/es/src/bookings-availability-v2-time-slot-availability-time-slots.meta.d.ts +14 -0
  99. package/build/internal/es/src/bookings-availability-v2-time-slot-availability-time-slots.meta.js +38 -0
  100. package/build/internal/es/src/bookings-availability-v2-time-slot-availability-time-slots.meta.js.map +1 -0
  101. package/build/internal/es/src/bookings-availability-v2-time-slot-availability-time-slots.public.d.ts +139 -0
  102. package/build/internal/es/src/bookings-availability-v2-time-slot-availability-time-slots.public.js +14 -0
  103. package/build/internal/es/src/bookings-availability-v2-time-slot-availability-time-slots.public.js.map +1 -0
  104. package/build/internal/es/src/bookings-availability-v2-time-slot-availability-time-slots.types.d.ts +790 -0
  105. package/build/internal/es/src/bookings-availability-v2-time-slot-availability-time-slots.types.js +11 -0
  106. package/build/internal/es/src/bookings-availability-v2-time-slot-availability-time-slots.types.js.map +1 -0
  107. package/build/internal/es/src/bookings-availability-v2-time-slot-availability-time-slots.universal.d.ts +1107 -0
  108. package/build/internal/es/src/bookings-availability-v2-time-slot-availability-time-slots.universal.js +273 -0
  109. package/build/internal/es/src/bookings-availability-v2-time-slot-availability-time-slots.universal.js.map +1 -0
  110. package/meta/package.json +3 -0
  111. package/package.json +52 -0
@@ -0,0 +1,301 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.getAvailabilityTimeSlot = exports.listAvailabilityTimeSlots = exports.LocationType = void 0;
27
+ const transform_error_1 = require("@wix/sdk-runtime/transform-error");
28
+ const rename_all_nested_keys_1 = require("@wix/sdk-runtime/rename-all-nested-keys");
29
+ const ambassadorWixBookingsAvailabilityV2TimeSlot = __importStar(require("./bookings-availability-v2-time-slot-availability-time-slots.http.js"));
30
+ var LocationType;
31
+ (function (LocationType) {
32
+ LocationType["UNKNOWN_LOCATION_TYPE"] = "UNKNOWN_LOCATION_TYPE";
33
+ /** A business location, either the default business address, or locations defined for the business by the Business Info. */
34
+ LocationType["BUSINESS"] = "BUSINESS";
35
+ /** The location is unique to this service and isn't defined as one of the business locations. */
36
+ LocationType["CUSTOM"] = "CUSTOM";
37
+ /** The location can be determined by the customer and is not set up beforehand. */
38
+ LocationType["CUSTOMER"] = "CUSTOMER";
39
+ })(LocationType || (exports.LocationType = LocationType = {}));
40
+ /**
41
+ * Retrieves a list of `TimeSlot`s that match the provided filters.
42
+ *
43
+ * <blockquote class="important">
44
+ * <p><strong>Important:</strong>
45
+ * Currently supported only for services of type <code class="grey-background">APPOINTMENT</code>.</p>
46
+ * </blockquote>
47
+ *
48
+ * The request body __must__ include either:
49
+ * + All of the following filters: `serviceId`, `fromLocalDate`, `toLocalDate`, and `timeZone`.
50
+ * You may add additional filters as you wish.
51
+ * + A `cursorPaging` with a valid `cursor` from previous response.
52
+ *
53
+ *
54
+ * Each [TimeSlot](https://bo.wix.com/wix-docs/rest/all-apis/wix-service-availability/availability-time-slots/time-slot-object) in response
55
+ * represents the availability of the service in a specific location,
56
+ * and has a `localStartDate` within the range of the provided `fromLocalDate` and `toLocalDate` exclusive.
57
+ * The `localEndDate` of a `TimeSlot` is calculated as the sum of the `TimeSlot`'s `localStartDate` and the duration of the service.
58
+ *
59
+ * By default,
60
+ * the response contains at most 1000 results.
61
+ * If there are more than 1000 results, we return a `cursorPagingMetadata` with
62
+ * a cursor for the next page of results, regardless of whether a `cursorPaging`
63
+ * was provided in request.
64
+ *
65
+ * ### AvailableResources in response
66
+ * The `TimeSlot`'s `AvailableResources` contains information about the resources that are available to provide the service
67
+ * within the time slot. Each `AvailableResources` contains information about available resources of the same type.
68
+ *
69
+ * <blockquote class="important">
70
+ * <p><strong>Important:</strong><br/>
71
+ * By default,
72
+ * if you don't specify <code class="grey-background">includeResourceTypeIds</code>
73
+ * or <code class="grey-background">resourceIds</code> filters in request,
74
+ * we return TimeSlots with an empty <code class="grey-background">AvailableResources</code>.
75
+ * <br/><strong>Note:</strong><br/> Not specifying resources filters can be handy in case you want to avoid large response in flows that only
76
+ * interested of whether the time slots are available. [Finding the next available slot within the next 3 months](https://bo.wix.com/wix-docs/rest/all-apis/service-availability/availability-time-slots/sample-flows?localViewerId=inbari#all-apis_service-availability_availability-time-slots_sample-flows_find-the-first-date-within-the-next-3-months-that-the-selected-service-is-available-for)
77
+ * is an example for such flow.
78
+ * </p>
79
+ * </blockquote>
80
+ *
81
+ * If you wish to get a list of available resources for each `TimeSlot` you should either:
82
+ * + provide `resourceIds` in request.
83
+ * + provide `includeResourceTypeIds` in request.
84
+ *
85
+ * __Notes:__
86
+ * + In both cases the returned TimeSlots contains __up__ to 10 `AvailableResources` that match the provided filters.
87
+ * Each `AvailableResources` contains __up__ to 10 available `resources` of the same type that match the provided filters.
88
+ * + If an `AvailableResources` has more available resources which are not listed within it,
89
+ * we return `AvailableResources`.`hasMoreAvailableResources` as true.
90
+ * > __Note:__
91
+ * > If you wish to get the full available resources list for a specific `TimeSlot`,
92
+ * > you should call [GetAvailabilityTimeSlot](https://bo.wix.com/wix-docs/rest/all-apis/wix-service-availability/service-availability-time-slots/get-availability-time-slot).
93
+ *
94
+ *
95
+ * ### Availability VS Bookability
96
+ * An `available` time slot is not necessarily `bookable`.
97
+ * The `bookable` field of a `TimeSlot` indicates whether a customer can book the service within the given time slot,
98
+ * at a specific period of time.
99
+ * Read more about [Availability VS Bookability](https://bo.wix.com/wix-docs/rest/all-apis/wix-service-availability/service-availability-time-slots/introduction#all-apis_wix-service-availability_service-availability-time-slots_introduction_availability-vs-bookability).
100
+ *
101
+ * By default,
102
+ * + The response does not contains `unavailable` TimeSlots.
103
+ * For example,
104
+ * if there are no available resources to provide the service from `2024-01-30T14:30:00` to `2024-01-30T15:30:00`,
105
+ * we don't return TimeSlots with `localStartDate` within this range.
106
+ * + The response contains both `bookable` and `un-bookable` TimeSlots.
107
+ * For example,
108
+ * if the service has a booking policy which enforces booking the service up to 10 minutes before the session starts,
109
+ * we return TimeSlots with the violating `localStartDate` with `bookable` as false.
110
+ * If you wish to list only available __bookable__ TimeSlots you should pass `bookable` filter as true.
111
+ *
112
+ * <blockquote class="important">
113
+ * <p><strong>Important:</strong>
114
+ * Because of DST, there are edge cases where certain times either do not exist or exist twice for a local time zone.
115
+ * Read more about <a href="https://bo.wix.com/wix-docs/rest/all-apis/service-availability/availability-time-slots/introduction?localViewerId=inbari#all-apis_service-availability_availability-time-slots_introduction_daylight-saving-time-dst-handling">DST Handling</a></p>
116
+ * </blockquote>
117
+ *
118
+ *
119
+ * ### ListAvailabilityTimeSlots runs with the following defaults
120
+ * + `localStartDate` is sorted in `ASC` order
121
+ * + `cursorPaging`.`limit` is `1000`
122
+ * @public
123
+ * @documentationMaturity preview
124
+ * @permissionId BOOKINGS.AVAILABILITY_READ_TIME_SLOTS
125
+ * @permissionScope Read Bookings - Public Data
126
+ * @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
127
+ * @permissionScope Manage Bookings Services and Settings
128
+ * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
129
+ * @permissionScope Read Bookings - Including Participants
130
+ * @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
131
+ * @permissionScope Read Bookings - all read permissions
132
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
133
+ * @permissionScope Read Bookings Calendar Availability
134
+ * @permissionScopeId SCOPE.DC-BOOKINGS.READ-CALENDAR
135
+ * @permissionScope Manage Bookings - all permissions
136
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
137
+ * @applicableIdentity APP
138
+ * @applicableIdentity MEMBER
139
+ * @applicableIdentity VISITOR
140
+ * @fqn com.wixpress.bookings.availability.v2.AvailabilityTimeSlots.ListAvailabilityTimeSlots
141
+ */
142
+ async function listAvailabilityTimeSlots(options) {
143
+ // @ts-ignore
144
+ const { httpClient, sideEffects } = arguments[1];
145
+ const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
146
+ serviceId: options?.serviceId,
147
+ fromLocalDate: options?.fromLocalDate,
148
+ toLocalDate: options?.toLocalDate,
149
+ timeZone: options?.timeZone,
150
+ locations: options?.locations,
151
+ resourceIds: options?.resourceIds,
152
+ includeResourceTypeIds: options?.includeResourceTypeIds,
153
+ bookable: options?.bookable,
154
+ bookingPolicyViolations: options?.bookingPolicyViolations,
155
+ timeSlotsPerDay: options?.timeSlotsPerDay,
156
+ cursorPaging: options?.cursorPaging,
157
+ resourceTypes: options?.resourceTypes,
158
+ });
159
+ const reqOpts = ambassadorWixBookingsAvailabilityV2TimeSlot.listAvailabilityTimeSlots(payload);
160
+ sideEffects?.onSiteCall?.();
161
+ try {
162
+ const result = await httpClient.request(reqOpts);
163
+ sideEffects?.onSuccess?.(result);
164
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
165
+ }
166
+ catch (err) {
167
+ const transformedError = (0, transform_error_1.transformError)(err, {
168
+ spreadPathsToArguments: {},
169
+ explicitPathsToArguments: {
170
+ serviceId: '$[0].serviceId',
171
+ fromLocalDate: '$[0].fromLocalDate',
172
+ toLocalDate: '$[0].toLocalDate',
173
+ timeZone: '$[0].timeZone',
174
+ locations: '$[0].locations',
175
+ resourceIds: '$[0].resourceIds',
176
+ includeResourceTypeIds: '$[0].includeResourceTypeIds',
177
+ bookable: '$[0].bookable',
178
+ bookingPolicyViolations: '$[0].bookingPolicyViolations',
179
+ timeSlotsPerDay: '$[0].timeSlotsPerDay',
180
+ cursorPaging: '$[0].cursorPaging',
181
+ resourceTypes: '$[0].resourceTypes',
182
+ },
183
+ singleArgumentUnchanged: false,
184
+ }, ['options']);
185
+ sideEffects?.onError?.(err);
186
+ throw transformedError;
187
+ }
188
+ }
189
+ exports.listAvailabilityTimeSlots = listAvailabilityTimeSlots;
190
+ /**
191
+ * Retrieves an available `TimeSlot` that match the provided filters.
192
+ *
193
+ * Throws `SlotNotFound` if there is no such available time slot.
194
+ *
195
+ * <blockquote class="important">
196
+ * <p><strong>Important:</strong><br/>
197
+ * Currently supported only for services of type <code class="grey-background">APPOINTMENT</code>.</p>
198
+ * </blockquote>
199
+ *
200
+ * By default,
201
+ * if you don't provide `includeResourceTypeIds` or `resourceIds` in request,
202
+ * we return all `AvailableResources` with all `AvailableResources`.`resources` which are available to provide
203
+ * the service within the time slot.
204
+ *
205
+ * If you specify `includeResourceTypeIds` or `resourceIds` in request,
206
+ * the returned `TimeSlot` will contain only `AvailableResources` with at least one available resource
207
+ * which match the given resources filters,
208
+ * each contains all available resources out of those requested.
209
+ *
210
+ *
211
+ * <blockquote class="tip">
212
+ * <p><strong>Tip:</strong><br/>
213
+ * Use this API in order to get the availability of a specific <code class="grey-background">TimeSlot</code> out of those returned from <code class="grey-background">ListAvailabilityTimeSlots</code> API.</p>
214
+ * </blockquote>
215
+ * @param serviceId - Service ID of the time slot.
216
+ * Currently supported only for services of type `APPOINTMENT`.
217
+ * @param localStartDate - Local start date of the time slot, in ISO-8601 format.
218
+ * For example, "2024-01-30T13:30:00".
219
+ * @param localEndDate - Local end date of the time slot, in ISO-8601 format.
220
+ * For example, "2024-01-30T14:30:00".
221
+ * @param timeZone - Time zone, in IANA time zone format.
222
+ * @param location - The location of the time slot.
223
+ *
224
+ * You must provide a specific `locationType`.
225
+ * If locationType is `BUSINESS`, you __must__ also provide a `locationId`.
226
+ *
227
+ * <blockquote class="warning">
228
+ * <p>Supports filtering by location type, or by location ID.
229
+ * Other fields like <code class="grey-background">name</code> are ignored.</p>
230
+ * </blockquote>
231
+ * @public
232
+ * @documentationMaturity preview
233
+ * @requiredField localEndDate
234
+ * @requiredField localStartDate
235
+ * @requiredField location
236
+ * @requiredField serviceId
237
+ * @requiredField timeZone
238
+ * @permissionId BOOKINGS.AVAILABILITY_READ_TIME_SLOTS
239
+ * @permissionScope Read Bookings - Public Data
240
+ * @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
241
+ * @permissionScope Manage Bookings Services and Settings
242
+ * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
243
+ * @permissionScope Read Bookings - Including Participants
244
+ * @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
245
+ * @permissionScope Read Bookings - all read permissions
246
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
247
+ * @permissionScope Read Bookings Calendar Availability
248
+ * @permissionScopeId SCOPE.DC-BOOKINGS.READ-CALENDAR
249
+ * @permissionScope Manage Bookings - all permissions
250
+ * @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
251
+ * @applicableIdentity APP
252
+ * @applicableIdentity MEMBER
253
+ * @applicableIdentity VISITOR
254
+ * @fqn com.wixpress.bookings.availability.v2.AvailabilityTimeSlots.GetAvailabilityTimeSlot
255
+ */
256
+ async function getAvailabilityTimeSlot(serviceId, localStartDate, localEndDate, timeZone, location, options) {
257
+ // @ts-ignore
258
+ const { httpClient, sideEffects } = arguments[6];
259
+ const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
260
+ serviceId: serviceId,
261
+ localStartDate: localStartDate,
262
+ localEndDate: localEndDate,
263
+ timeZone: timeZone,
264
+ location: location,
265
+ resourceIds: options?.resourceIds,
266
+ includeResourceTypeIds: options?.includeResourceTypeIds,
267
+ });
268
+ const reqOpts = ambassadorWixBookingsAvailabilityV2TimeSlot.getAvailabilityTimeSlot(payload);
269
+ sideEffects?.onSiteCall?.();
270
+ try {
271
+ const result = await httpClient.request(reqOpts);
272
+ sideEffects?.onSuccess?.(result);
273
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
274
+ }
275
+ catch (err) {
276
+ const transformedError = (0, transform_error_1.transformError)(err, {
277
+ spreadPathsToArguments: {},
278
+ explicitPathsToArguments: {
279
+ serviceId: '$[0]',
280
+ localStartDate: '$[1]',
281
+ localEndDate: '$[2]',
282
+ timeZone: '$[3]',
283
+ location: '$[4]',
284
+ resourceIds: '$[5].resourceIds',
285
+ includeResourceTypeIds: '$[5].includeResourceTypeIds',
286
+ },
287
+ singleArgumentUnchanged: false,
288
+ }, [
289
+ 'serviceId',
290
+ 'localStartDate',
291
+ 'localEndDate',
292
+ 'timeZone',
293
+ 'location',
294
+ 'options',
295
+ ]);
296
+ sideEffects?.onError?.(err);
297
+ throw transformedError;
298
+ }
299
+ }
300
+ exports.getAvailabilityTimeSlot = getAvailabilityTimeSlot;
301
+ //# sourceMappingURL=bookings-availability-v2-time-slot-availability-time-slots.universal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bookings-availability-v2-time-slot-availability-time-slots.universal.js","sourceRoot":"","sources":["../../../../src/bookings-availability-v2-time-slot-availability-time-slots.universal.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAuF;AACvF,oFAGiD;AAEjD,kJAAoI;AA4FpI,IAAY,YAQX;AARD,WAAY,YAAY;IACtB,+DAA+C,CAAA;IAC/C,4HAA4H;IAC5H,qCAAqB,CAAA;IACrB,iGAAiG;IACjG,iCAAiB,CAAA;IACjB,mFAAmF;IACnF,qCAAqB,CAAA;AACvB,CAAC,EARW,YAAY,4BAAZ,YAAY,QAQvB;AAwtBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqGG;AACI,KAAK,UAAU,yBAAyB,CAC7C,OAA0C;IAK1C,aAAa;IACb,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,G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CAAC;QAClB,MAAM,gBAAgB,GAAG,IAAA,gCAAiB,EACxC,GAAG,EACH;YACE,sBAAsB,EAAE,EAAE;YAC1B,wBAAwB,EAAE;gBACxB,SAAS,EAAE,MAAM;gBACjB,cAAc,EAAE,MAAM;gBACtB,YAAY,EAAE,MAAM;gBACpB,QAAQ,EAAE,MAAM;gBAChB,QAAQ,EAAE,MAAM;gBAChB,WAAW,EAAE,kBAAkB;gBAC/B,sBAAsB,EAAE,6BAA6B;aACtD;YACD,uBAAuB,EAAE,KAAK;SAC/B,EACD;YACE,WAAW;YACX,gBAAgB;YAChB,cAAc;YACd,UAAU;YACV,UAAU;YACV,SAAS;SACV,CACF,CAAC;QACF,WAAW,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;QAE5B,MAAM,gBAAgB,CAAC;IACzB,CAAC;AACH,CAAC;AAnED,0DAmEC"}
@@ -0,0 +1 @@
1
+ export * from './src/bookings-availability-v2-time-slot-availability-time-slots.context.js';
@@ -0,0 +1,2 @@
1
+ export * from './src/bookings-availability-v2-time-slot-availability-time-slots.context.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../index.ts"],"names":[],"mappings":"AAAA,cAAc,6EAA6E,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './src/bookings-availability-v2-time-slot-availability-time-slots.universal.js';
@@ -0,0 +1,2 @@
1
+ export * from './src/bookings-availability-v2-time-slot-availability-time-slots.universal.js';
2
+ //# sourceMappingURL=index.typings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.typings.js","sourceRoot":"","sources":["../../../index.typings.ts"],"names":[],"mappings":"AAAA,cAAc,+EAA+E,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './src/bookings-availability-v2-time-slot-availability-time-slots.meta.js';
@@ -0,0 +1,2 @@
1
+ export * from './src/bookings-availability-v2-time-slot-availability-time-slots.meta.js';
2
+ //# sourceMappingURL=meta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../meta.ts"],"names":[],"mappings":"AAAA,cAAc,0EAA0E,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { listAvailabilityTimeSlots as publicListAvailabilityTimeSlots, getAvailabilityTimeSlot as publicGetAvailabilityTimeSlot } from './bookings-availability-v2-time-slot-availability-time-slots.public.js';
2
+ import { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
3
+ export declare const listAvailabilityTimeSlots: MaybeContext<BuildRESTFunction<typeof publicListAvailabilityTimeSlots> & typeof publicListAvailabilityTimeSlots>;
4
+ export declare const getAvailabilityTimeSlot: MaybeContext<BuildRESTFunction<typeof publicGetAvailabilityTimeSlot> & typeof publicGetAvailabilityTimeSlot>;
5
+ export { LocationType } from './bookings-availability-v2-time-slot-availability-time-slots.universal.js';
6
+ export { TimeSlot, Location, EventInfo, WaitingList, BookingPolicyViolations, AvailableResources, Resource, NestedTimeSlot, CalculateEventBasedAvailabilityRequest, CommonCursorPaging, CalculateEventBasedAvailabilityResponse, CommonCursorPagingMetadata, CommonCursors, ListEventTimeSlotsRequest, ListEventTimeSlotsResponse, ListMultiServiceAvailabilityTimeSlotsRequest, Service, V2CustomerChoices, CursorPaging, ListMultiServiceAvailabilityTimeSlotsResponse, CursorPagingMetadata, Cursors, GetMultiServiceAvailabilityTimeSlotRequest, GetMultiServiceAvailabilityTimeSlotResponse, ListAvailabilityTimeSlotsRequest, CustomerChoices, ResourceType, ListAvailabilityTimeSlotsResponse, GetAvailabilityTimeSlotRequest, GetAvailabilityTimeSlotResponse, ListAvailabilityTimeSlotsResponseNonNullableFields, GetAvailabilityTimeSlotResponseNonNullableFields, ListAvailabilityTimeSlotsOptions, GetAvailabilityTimeSlotOptions, } from './bookings-availability-v2-time-slot-availability-time-slots.universal.js';
@@ -0,0 +1,6 @@
1
+ import { listAvailabilityTimeSlots as publicListAvailabilityTimeSlots, getAvailabilityTimeSlot as publicGetAvailabilityTimeSlot, } from './bookings-availability-v2-time-slot-availability-time-slots.public.js';
2
+ import { createRESTModule } from '@wix/sdk-runtime/rest-modules';
3
+ export const listAvailabilityTimeSlots = /*#__PURE__*/ createRESTModule(publicListAvailabilityTimeSlots);
4
+ export const getAvailabilityTimeSlot = /*#__PURE__*/ createRESTModule(publicGetAvailabilityTimeSlot);
5
+ export { LocationType } from './bookings-availability-v2-time-slot-availability-time-slots.universal.js';
6
+ //# sourceMappingURL=bookings-availability-v2-time-slot-availability-time-slots.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bookings-availability-v2-time-slot-availability-time-slots.context.js","sourceRoot":"","sources":["../../../../src/bookings-availability-v2-time-slot-availability-time-slots.context.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,IAAI,+BAA+B,EAC5D,uBAAuB,IAAI,6BAA6B,GACzD,MAAM,wEAAwE,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,MAAM,CAAC,MAAM,yBAAyB,GAGlC,aAAa,CAAC,gBAAgB,CAAC,+BAA+B,CAAC,CAAC;AACpE,MAAM,CAAC,MAAM,uBAAuB,GAGhC,aAAa,CAAC,gBAAgB,CAAC,6BAA6B,CAAC,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,MAAM,2EAA2E,CAAC"}
@@ -0,0 +1,112 @@
1
+ import { RequestOptionsFactory } from '@wix/sdk-types';
2
+ /**
3
+ * Retrieves a list of `TimeSlot`s that match the provided filters.
4
+ *
5
+ * <blockquote class="important">
6
+ * <p><strong>Important:</strong>
7
+ * Currently supported only for services of type <code class="grey-background">APPOINTMENT</code>.</p>
8
+ * </blockquote>
9
+ *
10
+ * The request body __must__ include either:
11
+ * + All of the following filters: `serviceId`, `fromLocalDate`, `toLocalDate`, and `timeZone`.
12
+ * You may add additional filters as you wish.
13
+ * + A `cursorPaging` with a valid `cursor` from previous response.
14
+ *
15
+ *
16
+ * Each [TimeSlot](https://bo.wix.com/wix-docs/rest/all-apis/wix-service-availability/availability-time-slots/time-slot-object) in response
17
+ * represents the availability of the service in a specific location,
18
+ * and has a `localStartDate` within the range of the provided `fromLocalDate` and `toLocalDate` exclusive.
19
+ * The `localEndDate` of a `TimeSlot` is calculated as the sum of the `TimeSlot`'s `localStartDate` and the duration of the service.
20
+ *
21
+ * By default,
22
+ * the response contains at most 1000 results.
23
+ * If there are more than 1000 results, we return a `cursorPagingMetadata` with
24
+ * a cursor for the next page of results, regardless of whether a `cursorPaging`
25
+ * was provided in request.
26
+ *
27
+ * ### AvailableResources in response
28
+ * The `TimeSlot`'s `AvailableResources` contains information about the resources that are available to provide the service
29
+ * within the time slot. Each `AvailableResources` contains information about available resources of the same type.
30
+ *
31
+ * <blockquote class="important">
32
+ * <p><strong>Important:</strong><br/>
33
+ * By default,
34
+ * if you don't specify <code class="grey-background">includeResourceTypeIds</code>
35
+ * or <code class="grey-background">resourceIds</code> filters in request,
36
+ * we return TimeSlots with an empty <code class="grey-background">AvailableResources</code>.
37
+ * <br/><strong>Note:</strong><br/> Not specifying resources filters can be handy in case you want to avoid large response in flows that only
38
+ * interested of whether the time slots are available. [Finding the next available slot within the next 3 months](https://bo.wix.com/wix-docs/rest/all-apis/service-availability/availability-time-slots/sample-flows?localViewerId=inbari#all-apis_service-availability_availability-time-slots_sample-flows_find-the-first-date-within-the-next-3-months-that-the-selected-service-is-available-for)
39
+ * is an example for such flow.
40
+ * </p>
41
+ * </blockquote>
42
+ *
43
+ * If you wish to get a list of available resources for each `TimeSlot` you should either:
44
+ * + provide `resourceIds` in request.
45
+ * + provide `includeResourceTypeIds` in request.
46
+ *
47
+ * __Notes:__
48
+ * + In both cases the returned TimeSlots contains __up__ to 10 `AvailableResources` that match the provided filters.
49
+ * Each `AvailableResources` contains __up__ to 10 available `resources` of the same type that match the provided filters.
50
+ * + If an `AvailableResources` has more available resources which are not listed within it,
51
+ * we return `AvailableResources`.`hasMoreAvailableResources` as true.
52
+ * > __Note:__
53
+ * > If you wish to get the full available resources list for a specific `TimeSlot`,
54
+ * > you should call [GetAvailabilityTimeSlot](https://bo.wix.com/wix-docs/rest/all-apis/wix-service-availability/service-availability-time-slots/get-availability-time-slot).
55
+ *
56
+ *
57
+ * ### Availability VS Bookability
58
+ * An `available` time slot is not necessarily `bookable`.
59
+ * The `bookable` field of a `TimeSlot` indicates whether a customer can book the service within the given time slot,
60
+ * at a specific period of time.
61
+ * Read more about [Availability VS Bookability](https://bo.wix.com/wix-docs/rest/all-apis/wix-service-availability/service-availability-time-slots/introduction#all-apis_wix-service-availability_service-availability-time-slots_introduction_availability-vs-bookability).
62
+ *
63
+ * By default,
64
+ * + The response does not contains `unavailable` TimeSlots.
65
+ * For example,
66
+ * if there are no available resources to provide the service from `2024-01-30T14:30:00` to `2024-01-30T15:30:00`,
67
+ * we don't return TimeSlots with `localStartDate` within this range.
68
+ * + The response contains both `bookable` and `un-bookable` TimeSlots.
69
+ * For example,
70
+ * if the service has a booking policy which enforces booking the service up to 10 minutes before the session starts,
71
+ * we return TimeSlots with the violating `localStartDate` with `bookable` as false.
72
+ * If you wish to list only available __bookable__ TimeSlots you should pass `bookable` filter as true.
73
+ *
74
+ * <blockquote class="important">
75
+ * <p><strong>Important:</strong>
76
+ * Because of DST, there are edge cases where certain times either do not exist or exist twice for a local time zone.
77
+ * Read more about <a href="https://bo.wix.com/wix-docs/rest/all-apis/service-availability/availability-time-slots/introduction?localViewerId=inbari#all-apis_service-availability_availability-time-slots_introduction_daylight-saving-time-dst-handling">DST Handling</a></p>
78
+ * </blockquote>
79
+ *
80
+ *
81
+ * ### ListAvailabilityTimeSlots runs with the following defaults
82
+ * + `localStartDate` is sorted in `ASC` order
83
+ * + `cursorPaging`.`limit` is `1000`
84
+ */
85
+ export declare function listAvailabilityTimeSlots(payload: object): RequestOptionsFactory<any>;
86
+ /**
87
+ * Retrieves an available `TimeSlot` that match the provided filters.
88
+ *
89
+ * Throws `SlotNotFound` if there is no such available time slot.
90
+ *
91
+ * <blockquote class="important">
92
+ * <p><strong>Important:</strong><br/>
93
+ * Currently supported only for services of type <code class="grey-background">APPOINTMENT</code>.</p>
94
+ * </blockquote>
95
+ *
96
+ * By default,
97
+ * if you don't provide `includeResourceTypeIds` or `resourceIds` in request,
98
+ * we return all `AvailableResources` with all `AvailableResources`.`resources` which are available to provide
99
+ * the service within the time slot.
100
+ *
101
+ * If you specify `includeResourceTypeIds` or `resourceIds` in request,
102
+ * the returned `TimeSlot` will contain only `AvailableResources` with at least one available resource
103
+ * which match the given resources filters,
104
+ * each contains all available resources out of those requested.
105
+ *
106
+ *
107
+ * <blockquote class="tip">
108
+ * <p><strong>Tip:</strong><br/>
109
+ * Use this API in order to get the availability of a specific <code class="grey-background">TimeSlot</code> out of those returned from <code class="grey-background">ListAvailabilityTimeSlots</code> API.</p>
110
+ * </blockquote>
111
+ */
112
+ export declare function getAvailabilityTimeSlot(payload: object): RequestOptionsFactory<any>;