@lifestreamdynamics/vault-sdk 1.2.0 → 2.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/README.md +245 -13
- package/dist/client.d.ts +30 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +44 -1
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +14 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/resources/booking.d.ts +406 -0
- package/dist/resources/booking.d.ts.map +1 -0
- package/dist/resources/booking.js +430 -0
- package/dist/resources/booking.js.map +1 -0
- package/dist/resources/calendar.d.ts +294 -2
- package/dist/resources/calendar.d.ts.map +1 -1
- package/dist/resources/calendar.js +363 -4
- package/dist/resources/calendar.js.map +1 -1
- package/dist/resources/collaboration.d.ts +33 -0
- package/dist/resources/collaboration.d.ts.map +1 -0
- package/dist/resources/collaboration.js +40 -0
- package/dist/resources/collaboration.js.map +1 -0
- package/dist/resources/documents.d.ts +28 -0
- package/dist/resources/documents.d.ts.map +1 -1
- package/dist/resources/documents.js +59 -0
- package/dist/resources/documents.js.map +1 -1
- package/dist/resources/plugins.d.ts +101 -0
- package/dist/resources/plugins.d.ts.map +1 -0
- package/dist/resources/plugins.js +127 -0
- package/dist/resources/plugins.js.map +1 -0
- package/dist/resources/saml.d.ts +142 -0
- package/dist/resources/saml.d.ts.map +1 -0
- package/dist/resources/saml.js +138 -0
- package/dist/resources/saml.js.map +1 -0
- package/dist/resources/scim.d.ts +211 -0
- package/dist/resources/scim.d.ts.map +1 -0
- package/dist/resources/scim.js +131 -0
- package/dist/resources/scim.js.map +1 -0
- package/dist/resources/search.d.ts +13 -0
- package/dist/resources/search.d.ts.map +1 -1
- package/dist/resources/search.js +19 -0
- package/dist/resources/search.js.map +1 -1
- package/dist/resources/team-booking-groups.d.ts +149 -0
- package/dist/resources/team-booking-groups.d.ts.map +1 -0
- package/dist/resources/team-booking-groups.js +175 -0
- package/dist/resources/team-booking-groups.js.map +1 -0
- package/dist/resources/teams.d.ts +10 -1
- package/dist/resources/teams.d.ts.map +1 -1
- package/dist/resources/teams.js +53 -6
- package/dist/resources/teams.js.map +1 -1
- package/dist/resources/user.d.ts +16 -0
- package/dist/resources/user.d.ts.map +1 -1
- package/dist/resources/user.js +31 -0
- package/dist/resources/user.js.map +1 -1
- package/dist/resources/vaults.d.ts +9 -0
- package/dist/resources/vaults.d.ts.map +1 -1
- package/dist/resources/vaults.js +14 -0
- package/dist/resources/vaults.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
import { handleError } from '../handle-error.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resource for booking slots and guest booking management.
|
|
4
|
+
*
|
|
5
|
+
* Provides methods to manage event slots (bookable time windows) and
|
|
6
|
+
* their associated bookings (guest reservations) within a vault.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // List all booking slots for a vault
|
|
11
|
+
* const slots = await client.booking.listSlots('vault-id');
|
|
12
|
+
*
|
|
13
|
+
* // Check availability for a specific slot
|
|
14
|
+
* const availability = await client.booking.getAvailability(
|
|
15
|
+
* 'vault-id',
|
|
16
|
+
* 'slot-id',
|
|
17
|
+
* '2026-03-15',
|
|
18
|
+
* );
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export class BookingResource {
|
|
22
|
+
http;
|
|
23
|
+
constructor(http) {
|
|
24
|
+
this.http = http;
|
|
25
|
+
}
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
// Slot management
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
/**
|
|
30
|
+
* List all event slots for a vault.
|
|
31
|
+
*
|
|
32
|
+
* @param vaultId - Vault ID
|
|
33
|
+
* @returns Array of event slots
|
|
34
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
35
|
+
* @throws {AuthorizationError} If the user does not have access to the vault
|
|
36
|
+
* @throws {NotFoundError} If the vault does not exist
|
|
37
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
38
|
+
*/
|
|
39
|
+
async listSlots(vaultId) {
|
|
40
|
+
try {
|
|
41
|
+
const data = await this.http.get(`vaults/${vaultId}/calendar/slots`).json();
|
|
42
|
+
return data.slots;
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
throw await handleError(error, 'Event Slots', vaultId);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Create a new bookable event slot.
|
|
50
|
+
*
|
|
51
|
+
* @param vaultId - Vault ID
|
|
52
|
+
* @param data - Slot configuration
|
|
53
|
+
* @returns The created slot
|
|
54
|
+
* @throws {ValidationError} If the slot data is invalid
|
|
55
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
56
|
+
* @throws {AuthorizationError} If the user does not have access to the vault
|
|
57
|
+
* @throws {NotFoundError} If the vault does not exist
|
|
58
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
59
|
+
*/
|
|
60
|
+
async createSlot(vaultId, data) {
|
|
61
|
+
try {
|
|
62
|
+
return await this.http.post(`vaults/${vaultId}/calendar/slots`, { json: data }).json();
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
throw await handleError(error, 'Create Slot', data.title);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Update an existing event slot.
|
|
70
|
+
*
|
|
71
|
+
* @param vaultId - Vault ID
|
|
72
|
+
* @param slotId - Slot ID
|
|
73
|
+
* @param data - Partial slot data to update
|
|
74
|
+
* @returns The updated slot
|
|
75
|
+
* @throws {ValidationError} If the update data is invalid
|
|
76
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
77
|
+
* @throws {AuthorizationError} If the user does not have access to the vault or slot
|
|
78
|
+
* @throws {NotFoundError} If the vault or slot does not exist
|
|
79
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
80
|
+
*/
|
|
81
|
+
async updateSlot(vaultId, slotId, data) {
|
|
82
|
+
try {
|
|
83
|
+
return await this.http.put(`vaults/${vaultId}/calendar/slots/${slotId}`, { json: data }).json();
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
throw await handleError(error, 'Update Slot', slotId);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Delete an event slot.
|
|
91
|
+
*
|
|
92
|
+
* @param vaultId - Vault ID
|
|
93
|
+
* @param slotId - Slot ID
|
|
94
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
95
|
+
* @throws {AuthorizationError} If the user does not have access to the vault or slot
|
|
96
|
+
* @throws {NotFoundError} If the vault or slot does not exist
|
|
97
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
98
|
+
*/
|
|
99
|
+
async deleteSlot(vaultId, slotId) {
|
|
100
|
+
try {
|
|
101
|
+
await this.http.delete(`vaults/${vaultId}/calendar/slots/${slotId}`);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
throw await handleError(error, 'Delete Slot', slotId);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get available time windows for a slot on a given date.
|
|
109
|
+
*
|
|
110
|
+
* @param vaultId - Vault ID
|
|
111
|
+
* @param slotId - Slot ID
|
|
112
|
+
* @param date - Date to check availability for (YYYY-MM-DD)
|
|
113
|
+
* @returns Availability information including open time windows
|
|
114
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
115
|
+
* @throws {AuthorizationError} If the user does not have access to the vault
|
|
116
|
+
* @throws {NotFoundError} If the vault or slot does not exist
|
|
117
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
118
|
+
*/
|
|
119
|
+
async getAvailability(vaultId, slotId, date) {
|
|
120
|
+
try {
|
|
121
|
+
return await this.http
|
|
122
|
+
.get(`vaults/${vaultId}/calendar/slots/${slotId}/availability`, { searchParams: { date } })
|
|
123
|
+
.json();
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
throw await handleError(error, 'Slot Availability', slotId);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// ---------------------------------------------------------------------------
|
|
130
|
+
// Booking management
|
|
131
|
+
// ---------------------------------------------------------------------------
|
|
132
|
+
/**
|
|
133
|
+
* List bookings for a vault, with optional filters.
|
|
134
|
+
*
|
|
135
|
+
* @param vaultId - Vault ID
|
|
136
|
+
* @param filters - Optional filter parameters
|
|
137
|
+
* @param filters.status - Filter by booking status
|
|
138
|
+
* @param filters.slotId - Filter by slot ID
|
|
139
|
+
* @param filters.startAfter - Filter bookings starting on or after this date (YYYY-MM-DD)
|
|
140
|
+
* @param filters.startBefore - Filter bookings starting on or before this date (YYYY-MM-DD)
|
|
141
|
+
* @returns Array of bookings
|
|
142
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
143
|
+
* @throws {AuthorizationError} If the user does not have access to the vault
|
|
144
|
+
* @throws {NotFoundError} If the vault does not exist
|
|
145
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
146
|
+
*/
|
|
147
|
+
async listBookings(vaultId, filters) {
|
|
148
|
+
try {
|
|
149
|
+
const searchParams = {};
|
|
150
|
+
if (filters?.status)
|
|
151
|
+
searchParams.status = filters.status;
|
|
152
|
+
if (filters?.slotId)
|
|
153
|
+
searchParams.slotId = filters.slotId;
|
|
154
|
+
if (filters?.startAfter)
|
|
155
|
+
searchParams.startAfter = filters.startAfter;
|
|
156
|
+
if (filters?.startBefore)
|
|
157
|
+
searchParams.startBefore = filters.startBefore;
|
|
158
|
+
return await this.http.get(`vaults/${vaultId}/calendar/bookings`, { searchParams }).json();
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
throw await handleError(error, 'Bookings', vaultId);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Get a single booking by ID.
|
|
166
|
+
*
|
|
167
|
+
* @param vaultId - Vault ID
|
|
168
|
+
* @param bookingId - Booking ID
|
|
169
|
+
* @returns The booking record
|
|
170
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
171
|
+
* @throws {AuthorizationError} If the user does not have access to the vault or booking
|
|
172
|
+
* @throws {NotFoundError} If the vault or booking does not exist
|
|
173
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
174
|
+
*/
|
|
175
|
+
async getBooking(vaultId, bookingId) {
|
|
176
|
+
try {
|
|
177
|
+
return await this.http.get(`vaults/${vaultId}/calendar/bookings/${bookingId}`).json();
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
throw await handleError(error, 'Booking', bookingId);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Update the status of a booking (confirm, cancel, mark no-show, etc.).
|
|
185
|
+
*
|
|
186
|
+
* @param vaultId - Vault ID
|
|
187
|
+
* @param bookingId - Booking ID
|
|
188
|
+
* @param status - New status for the booking
|
|
189
|
+
* @returns The updated booking
|
|
190
|
+
* @throws {ValidationError} If the status transition is not allowed
|
|
191
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
192
|
+
* @throws {AuthorizationError} If the user does not have access to the vault or booking
|
|
193
|
+
* @throws {NotFoundError} If the vault or booking does not exist
|
|
194
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
195
|
+
*/
|
|
196
|
+
async updateBookingStatus(vaultId, bookingId, status) {
|
|
197
|
+
try {
|
|
198
|
+
return await this.http
|
|
199
|
+
.patch(`vaults/${vaultId}/calendar/bookings/${bookingId}/status`, { json: { status } })
|
|
200
|
+
.json();
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
throw await handleError(error, 'Update Booking Status', bookingId);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// ---------------------------------------------------------------------------
|
|
207
|
+
// Event template management
|
|
208
|
+
// ---------------------------------------------------------------------------
|
|
209
|
+
/**
|
|
210
|
+
* List all event templates for a vault.
|
|
211
|
+
*
|
|
212
|
+
* @param vaultId - Vault ID
|
|
213
|
+
* @returns Array of event templates
|
|
214
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
215
|
+
* @throws {AuthorizationError} If the user does not have access to the vault
|
|
216
|
+
* @throws {NotFoundError} If the vault does not exist
|
|
217
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
218
|
+
*/
|
|
219
|
+
async listTemplates(vaultId) {
|
|
220
|
+
try {
|
|
221
|
+
const data = await this.http
|
|
222
|
+
.get(`vaults/${vaultId}/calendar/templates`)
|
|
223
|
+
.json();
|
|
224
|
+
return data.templates;
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
throw await handleError(error, 'Templates', vaultId);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Create a new event template.
|
|
232
|
+
*
|
|
233
|
+
* @param vaultId - Vault ID
|
|
234
|
+
* @param data - Template configuration
|
|
235
|
+
* @returns The created template
|
|
236
|
+
* @throws {ValidationError} If the template data is invalid
|
|
237
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
238
|
+
* @throws {AuthorizationError} If the user does not have access to the vault
|
|
239
|
+
* @throws {NotFoundError} If the vault does not exist
|
|
240
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
241
|
+
*/
|
|
242
|
+
async createTemplate(vaultId, data) {
|
|
243
|
+
try {
|
|
244
|
+
return await this.http
|
|
245
|
+
.post(`vaults/${vaultId}/calendar/templates`, { json: data })
|
|
246
|
+
.json();
|
|
247
|
+
}
|
|
248
|
+
catch (error) {
|
|
249
|
+
throw await handleError(error, 'Create Template', data.name);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Update an existing event template.
|
|
254
|
+
*
|
|
255
|
+
* @param vaultId - Vault ID
|
|
256
|
+
* @param templateId - Template ID
|
|
257
|
+
* @param data - Partial template data to update
|
|
258
|
+
* @returns The updated template
|
|
259
|
+
* @throws {ValidationError} If the update data is invalid
|
|
260
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
261
|
+
* @throws {AuthorizationError} If the user does not have access to the vault or template
|
|
262
|
+
* @throws {NotFoundError} If the vault or template does not exist
|
|
263
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
264
|
+
*/
|
|
265
|
+
async updateTemplate(vaultId, templateId, data) {
|
|
266
|
+
try {
|
|
267
|
+
return await this.http
|
|
268
|
+
.put(`vaults/${vaultId}/calendar/templates/${templateId}`, { json: data })
|
|
269
|
+
.json();
|
|
270
|
+
}
|
|
271
|
+
catch (error) {
|
|
272
|
+
throw await handleError(error, 'Update Template', templateId);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Delete an event template.
|
|
277
|
+
*
|
|
278
|
+
* @param vaultId - Vault ID
|
|
279
|
+
* @param templateId - Template ID
|
|
280
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
281
|
+
* @throws {AuthorizationError} If the user does not have access to the vault or template
|
|
282
|
+
* @throws {NotFoundError} If the vault or template does not exist
|
|
283
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
284
|
+
*/
|
|
285
|
+
async deleteTemplate(vaultId, templateId) {
|
|
286
|
+
try {
|
|
287
|
+
await this.http.delete(`vaults/${vaultId}/calendar/templates/${templateId}`);
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
throw await handleError(error, 'Delete Template', templateId);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
// ---------------------------------------------------------------------------
|
|
294
|
+
// Waitlist management (Business tier)
|
|
295
|
+
// ---------------------------------------------------------------------------
|
|
296
|
+
/**
|
|
297
|
+
* Get the waitlist for a booking slot.
|
|
298
|
+
*
|
|
299
|
+
* @param vaultId - Vault ID
|
|
300
|
+
* @param slotId - Event slot ID
|
|
301
|
+
* @param params - Optional filters (startAt, status)
|
|
302
|
+
* @returns Waitlist entries and total count
|
|
303
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
304
|
+
* @throws {AuthorizationError} If the user does not have access to the vault
|
|
305
|
+
* @throws {NotFoundError} If the vault or slot does not exist
|
|
306
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
307
|
+
*/
|
|
308
|
+
async getWaitlist(vaultId, slotId, params) {
|
|
309
|
+
try {
|
|
310
|
+
const searchParams = {};
|
|
311
|
+
if (params?.startAt)
|
|
312
|
+
searchParams.startAt = params.startAt;
|
|
313
|
+
if (params?.status)
|
|
314
|
+
searchParams.status = params.status;
|
|
315
|
+
return await this.http
|
|
316
|
+
.get(`vaults/${vaultId}/calendar/slots/${slotId}/waitlist`, { searchParams })
|
|
317
|
+
.json();
|
|
318
|
+
}
|
|
319
|
+
catch (error) {
|
|
320
|
+
throw await handleError(error, 'Waitlist', slotId);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Join the waitlist for a public booking slot (no auth required).
|
|
325
|
+
*
|
|
326
|
+
* @param profileSlug - Host profile slug
|
|
327
|
+
* @param vaultSlug - Vault slug
|
|
328
|
+
* @param slotId - Event slot ID
|
|
329
|
+
* @param data - Guest details and desired start time
|
|
330
|
+
* @returns Position in waitlist and leave token
|
|
331
|
+
* @throws {NotFoundError} If the published vault or slot does not exist
|
|
332
|
+
* @throws {ValidationError} If the guest details are invalid
|
|
333
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
334
|
+
*/
|
|
335
|
+
async joinWaitlist(profileSlug, vaultSlug, slotId, data) {
|
|
336
|
+
try {
|
|
337
|
+
return await this.http
|
|
338
|
+
.post(`public/vaults/${profileSlug}/${vaultSlug}/booking-slots/${slotId}/waitlist`, { json: data })
|
|
339
|
+
.json();
|
|
340
|
+
}
|
|
341
|
+
catch (error) {
|
|
342
|
+
throw await handleError(error, 'Join Waitlist', slotId);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Leave the waitlist using a leave token (GDPR right to withdraw).
|
|
347
|
+
*
|
|
348
|
+
* @param leaveToken - The 64-char hex leave token from the join response
|
|
349
|
+
* @returns Confirmation message
|
|
350
|
+
* @throws {NotFoundError} If the leave token is invalid
|
|
351
|
+
* @throws {ValidationError} If the entry is already expired or left
|
|
352
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
353
|
+
*/
|
|
354
|
+
async leaveWaitlist(leaveToken) {
|
|
355
|
+
try {
|
|
356
|
+
return await this.http
|
|
357
|
+
.delete(`public/bookings/waitlist/${leaveToken}`)
|
|
358
|
+
.json();
|
|
359
|
+
}
|
|
360
|
+
catch (error) {
|
|
361
|
+
throw await handleError(error, 'Leave Waitlist', leaveToken);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
// ---------------------------------------------------------------------------
|
|
365
|
+
// Guest self-service reschedule
|
|
366
|
+
// ---------------------------------------------------------------------------
|
|
367
|
+
/**
|
|
368
|
+
* Reschedule a booking using a guest reschedule token.
|
|
369
|
+
*
|
|
370
|
+
* Cancels the existing booking and creates a new one at the specified time.
|
|
371
|
+
* The reschedule token is included in the guest's original confirmation email
|
|
372
|
+
* link at `/reschedule/:token`.
|
|
373
|
+
*
|
|
374
|
+
* @param token - The reschedule token from the guest's email link (64-char hex)
|
|
375
|
+
* @param newStartAt - The new start time in ISO 8601 format
|
|
376
|
+
* @returns Confirmation of the rescheduled booking
|
|
377
|
+
* @throws {NotFoundError} If the token is invalid or booking is not found
|
|
378
|
+
* @throws {ValidationError} If the new time is invalid or outside the notice window
|
|
379
|
+
* @throws {ConflictError} If the new time slot is no longer available
|
|
380
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
381
|
+
*/
|
|
382
|
+
async rescheduleBooking(token, newStartAt) {
|
|
383
|
+
try {
|
|
384
|
+
return await this.http
|
|
385
|
+
.post(`public/bookings/reschedule/${token}`, { json: { newStartAt } })
|
|
386
|
+
.json();
|
|
387
|
+
}
|
|
388
|
+
catch (error) {
|
|
389
|
+
throw await handleError(error, 'Reschedule Booking', token);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
// ---------------------------------------------------------------------------
|
|
393
|
+
// Booking analytics (Business tier)
|
|
394
|
+
// ---------------------------------------------------------------------------
|
|
395
|
+
/**
|
|
396
|
+
* Get booking analytics for a vault.
|
|
397
|
+
*
|
|
398
|
+
* @param vaultId - Vault ID
|
|
399
|
+
* @param filters - Optional analytics filters
|
|
400
|
+
* @param filters.view - Analytics view type: 'volume', 'funnel', or 'peak-times' (default: 'volume')
|
|
401
|
+
* @param filters.from - Start date (YYYY-MM-DD, default: 30 days ago)
|
|
402
|
+
* @param filters.to - End date (YYYY-MM-DD, default: today)
|
|
403
|
+
* @param filters.slotId - Filter by event slot ID
|
|
404
|
+
* @returns Booking analytics data
|
|
405
|
+
* @throws {AuthenticationError} If the request is not authenticated
|
|
406
|
+
* @throws {AuthorizationError} If the user does not have access or insufficient subscription tier
|
|
407
|
+
* @throws {NotFoundError} If the vault does not exist
|
|
408
|
+
* @throws {NetworkError} If the request fails due to network issues
|
|
409
|
+
*/
|
|
410
|
+
async getBookingAnalytics(vaultId, filters) {
|
|
411
|
+
try {
|
|
412
|
+
const searchParams = {};
|
|
413
|
+
if (filters?.view)
|
|
414
|
+
searchParams.view = filters.view;
|
|
415
|
+
if (filters?.from)
|
|
416
|
+
searchParams.from = filters.from;
|
|
417
|
+
if (filters?.to)
|
|
418
|
+
searchParams.to = filters.to;
|
|
419
|
+
if (filters?.slotId)
|
|
420
|
+
searchParams.slotId = filters.slotId;
|
|
421
|
+
return await this.http
|
|
422
|
+
.get(`vaults/${vaultId}/calendar/analytics`, { searchParams })
|
|
423
|
+
.json();
|
|
424
|
+
}
|
|
425
|
+
catch (error) {
|
|
426
|
+
throw await handleError(error, 'Booking Analytics', vaultId);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
//# sourceMappingURL=booking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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