@bookinglab/booking-journey-api 2.10.0 → 2.11.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 +1 -0
- package/dist/index.d.cts +367 -1
- package/dist/index.d.ts +367 -1
- package/dist/index.js +171 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +166 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -423,6 +423,113 @@ var BookingLabClient = class extends ApiClient {
|
|
|
423
423
|
}
|
|
424
424
|
);
|
|
425
425
|
}
|
|
426
|
+
/**
|
|
427
|
+
* Get available days for a service within a date range
|
|
428
|
+
* @param companyId - The company ID
|
|
429
|
+
* @param serviceId - The service ID
|
|
430
|
+
* @param fromDate - Start date (YYYY-MM-DD)
|
|
431
|
+
* @param toDate - End date (YYYY-MM-DD)
|
|
432
|
+
* @param clientToken - Client token for authentication
|
|
433
|
+
* @param params - Optional query params (resource_id)
|
|
434
|
+
*/
|
|
435
|
+
async getDays(companyId, serviceId, fromDate, toDate, clientToken, params) {
|
|
436
|
+
return this.get(
|
|
437
|
+
`/company/${companyId}/service/${serviceId}/days/${fromDate}/${toDate}`,
|
|
438
|
+
{
|
|
439
|
+
headers: {
|
|
440
|
+
"clienttoken": clientToken
|
|
441
|
+
},
|
|
442
|
+
params
|
|
443
|
+
}
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Get available times for a service within a date range
|
|
448
|
+
* @param companyId - The company ID
|
|
449
|
+
* @param serviceId - The service ID
|
|
450
|
+
* @param fromDate - Start date (YYYY-MM-DD)
|
|
451
|
+
* @param toDate - End date (YYYY-MM-DD)
|
|
452
|
+
* @param clientToken - Client token for authentication
|
|
453
|
+
* @param params - Optional query params (duration, resource_id, person_id)
|
|
454
|
+
*/
|
|
455
|
+
async getTimes(companyId, serviceId, fromDate, toDate, clientToken, params) {
|
|
456
|
+
return this.get(
|
|
457
|
+
`/company/${companyId}/service/${serviceId}/times/${fromDate}/${toDate}`,
|
|
458
|
+
{
|
|
459
|
+
headers: {
|
|
460
|
+
"clienttoken": clientToken
|
|
461
|
+
},
|
|
462
|
+
params
|
|
463
|
+
}
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Create a new basket (BookingLab public)
|
|
468
|
+
* @param request - Body with company_id
|
|
469
|
+
* @param headers - Required clientToken/companyId; optional authToken/memberId
|
|
470
|
+
*/
|
|
471
|
+
async createBasket(request, headers) {
|
|
472
|
+
const reqHeaders = {
|
|
473
|
+
"clienttoken": headers.clientToken,
|
|
474
|
+
"x-company-id": String(headers.companyId)
|
|
475
|
+
};
|
|
476
|
+
if (headers.authToken) reqHeaders["authtoken"] = headers.authToken;
|
|
477
|
+
if (headers.memberId !== void 0) reqHeaders["x-member-id"] = String(headers.memberId);
|
|
478
|
+
return this.post("/basket-public", request, {
|
|
479
|
+
headers: reqHeaders
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Add a service item to a public basket (BookingLab)
|
|
484
|
+
* @param basketId - The basket ID
|
|
485
|
+
* @param request - Service item body
|
|
486
|
+
* @param headers - Required clientToken/authToken/companyId
|
|
487
|
+
*/
|
|
488
|
+
async addBasketServiceItem(basketId, request, headers) {
|
|
489
|
+
return this.post(
|
|
490
|
+
`/baskets/${basketId}/service_item-public`,
|
|
491
|
+
request,
|
|
492
|
+
{
|
|
493
|
+
headers: {
|
|
494
|
+
"clienttoken": headers.clientToken,
|
|
495
|
+
"authtoken": headers.authToken,
|
|
496
|
+
"x-company-id": String(headers.companyId)
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Checkout a public basket (BookingLab)
|
|
503
|
+
* @param basketId - The basket ID
|
|
504
|
+
* @param request - Body with company_id and client.id
|
|
505
|
+
* @param headers - Required clientToken/authToken/companyId
|
|
506
|
+
*/
|
|
507
|
+
async checkoutBasketPublic(basketId, request, headers) {
|
|
508
|
+
return this.post(
|
|
509
|
+
`/baskets/${basketId}/public-checkout`,
|
|
510
|
+
request,
|
|
511
|
+
{
|
|
512
|
+
headers: {
|
|
513
|
+
"clienttoken": headers.clientToken,
|
|
514
|
+
"authtoken": headers.authToken,
|
|
515
|
+
"x-company-id": String(headers.companyId)
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Delete a public basket (BookingLab)
|
|
522
|
+
* @param headers - Required clientToken/authToken/companyId
|
|
523
|
+
*/
|
|
524
|
+
async deleteBasketPublic(headers) {
|
|
525
|
+
return this.delete("/basket-public", {
|
|
526
|
+
headers: {
|
|
527
|
+
"clienttoken": headers.clientToken,
|
|
528
|
+
"authtoken": headers.authToken,
|
|
529
|
+
"x-company-id": String(headers.companyId)
|
|
530
|
+
}
|
|
531
|
+
});
|
|
532
|
+
}
|
|
426
533
|
};
|
|
427
534
|
function createBookingLabClient(baseUrl, authToken, appId) {
|
|
428
535
|
const client = new BookingLabClient({ baseUrl });
|
|
@@ -1217,7 +1324,65 @@ function useBookingLabQuestions(companyId, detailGroupId, clientToken, enabled =
|
|
|
1217
1324
|
enabled: enabled && !!companyId && !!detailGroupId && !!clientToken
|
|
1218
1325
|
});
|
|
1219
1326
|
}
|
|
1327
|
+
function useBookingLabDays(companyId, serviceId, fromDate, toDate, clientToken, params, enabled = true) {
|
|
1328
|
+
const client = useBookingLabClient();
|
|
1329
|
+
return useQuery({
|
|
1330
|
+
queryKey: ["bookingLabDays", companyId, serviceId, fromDate, toDate, params?.resource_id],
|
|
1331
|
+
queryFn: async () => {
|
|
1332
|
+
const response = await client.getDays(companyId, serviceId, fromDate, toDate, clientToken, params);
|
|
1333
|
+
return response.data;
|
|
1334
|
+
},
|
|
1335
|
+
enabled: enabled && !!companyId && !!serviceId && !!fromDate && !!toDate && !!clientToken
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
function useBookingLabTimes(companyId, serviceId, fromDate, toDate, clientToken, params, enabled = true) {
|
|
1339
|
+
const client = useBookingLabClient();
|
|
1340
|
+
return useQuery({
|
|
1341
|
+
queryKey: ["bookingLabTimes", companyId, serviceId, fromDate, toDate, params?.resource_ids],
|
|
1342
|
+
queryFn: async () => {
|
|
1343
|
+
const response = await client.getTimes(companyId, serviceId, fromDate, toDate, clientToken, params);
|
|
1344
|
+
return response.data;
|
|
1345
|
+
},
|
|
1346
|
+
enabled: enabled && !!companyId && !!serviceId && !!fromDate && !!toDate && !!clientToken
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
function useBookingLabCreateBasket() {
|
|
1350
|
+
const client = useBookingLabClient();
|
|
1351
|
+
return useMutation({
|
|
1352
|
+
mutationFn: async (input) => {
|
|
1353
|
+
const response = await client.createBasket(input.request, input.headers);
|
|
1354
|
+
return response.data;
|
|
1355
|
+
}
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
function useBookingLabAddBasketServiceItem() {
|
|
1359
|
+
const client = useBookingLabClient();
|
|
1360
|
+
return useMutation({
|
|
1361
|
+
mutationFn: async (input) => {
|
|
1362
|
+
const response = await client.addBasketServiceItem(input.basketId, input.request, input.headers);
|
|
1363
|
+
return response.data;
|
|
1364
|
+
}
|
|
1365
|
+
});
|
|
1366
|
+
}
|
|
1367
|
+
function useBookingLabCheckoutBasket() {
|
|
1368
|
+
const client = useBookingLabClient();
|
|
1369
|
+
return useMutation({
|
|
1370
|
+
mutationFn: async (input) => {
|
|
1371
|
+
const response = await client.checkoutBasketPublic(input.basketId, input.request, input.headers);
|
|
1372
|
+
return response.data;
|
|
1373
|
+
}
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
function useBookingLabDeleteBasket() {
|
|
1377
|
+
const client = useBookingLabClient();
|
|
1378
|
+
return useMutation({
|
|
1379
|
+
mutationFn: async (input) => {
|
|
1380
|
+
const response = await client.deleteBasketPublic(input.headers);
|
|
1381
|
+
return response.data;
|
|
1382
|
+
}
|
|
1383
|
+
});
|
|
1384
|
+
}
|
|
1220
1385
|
|
|
1221
|
-
export { ApiClient, ApiClientContext, ApiClientProvider, BookingLabClient, BookingLabContext, BookingLabProvider, JrniClient, JrniContext, JrniProvider, MemberType, createBookingLabClient, createJrniClient, useAddServiceItem, useApiClientContext, useBookingLabClient, useBookingLabCompanies, useBookingLabConfig, useBookingLabContext, useBookingLabForgotPassword, useBookingLabGetToken, useBookingLabQuestions, useBookingLabService, useBookingLabServices, useCancelBooking, useCancelMemberBooking, useCheckoutBasket, useChildCompanies, useClearBaskets, useClientDetails, useCompany, useCreateBasket, useCreateClient, useDates, useFindClientByEmail, useForgottenPassword, useGetMember, useJrniClient, useJrniContext, useListBookings, useLogin, useQuestions, useRescheduleBooking, useResetPassword, useResources, useSendCustomEmail, useServices, useTimes, useUpdateClient, useUpdateMember };
|
|
1386
|
+
export { ApiClient, ApiClientContext, ApiClientProvider, BookingLabClient, BookingLabContext, BookingLabProvider, JrniClient, JrniContext, JrniProvider, MemberType, createBookingLabClient, createJrniClient, useAddServiceItem, useApiClientContext, useBookingLabAddBasketServiceItem, useBookingLabCheckoutBasket, useBookingLabClient, useBookingLabCompanies, useBookingLabConfig, useBookingLabContext, useBookingLabCreateBasket, useBookingLabDays, useBookingLabDeleteBasket, useBookingLabForgotPassword, useBookingLabGetToken, useBookingLabQuestions, useBookingLabService, useBookingLabServices, useBookingLabTimes, useCancelBooking, useCancelMemberBooking, useCheckoutBasket, useChildCompanies, useClearBaskets, useClientDetails, useCompany, useCreateBasket, useCreateClient, useDates, useFindClientByEmail, useForgottenPassword, useGetMember, useJrniClient, useJrniContext, useListBookings, useLogin, useQuestions, useRescheduleBooking, useResetPassword, useResources, useSendCustomEmail, useServices, useTimes, useUpdateClient, useUpdateMember };
|
|
1222
1387
|
//# sourceMappingURL=index.mjs.map
|
|
1223
1388
|
//# sourceMappingURL=index.mjs.map
|