@bookinglab/booking-journey-api 2.10.0 → 2.12.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 +448 -1
- package/dist/index.d.ts +448 -1
- package/dist/index.js +198 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +192 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -423,6 +423,128 @@ 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
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Look up UK addresses by postcode via Ordnance Survey
|
|
535
|
+
* @param postcode - UK postcode
|
|
536
|
+
* @param clientToken - Client token for authentication
|
|
537
|
+
*/
|
|
538
|
+
async getOrdnanceAddressLookup(postcode, clientToken) {
|
|
539
|
+
return this.get(
|
|
540
|
+
`/ordnance_survey/postcode/${encodeURIComponent(postcode)}`,
|
|
541
|
+
{
|
|
542
|
+
headers: {
|
|
543
|
+
"clienttoken": clientToken
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
);
|
|
547
|
+
}
|
|
426
548
|
};
|
|
427
549
|
function createBookingLabClient(baseUrl, authToken, appId) {
|
|
428
550
|
const client = new BookingLabClient({ baseUrl });
|
|
@@ -1217,7 +1339,76 @@ function useBookingLabQuestions(companyId, detailGroupId, clientToken, enabled =
|
|
|
1217
1339
|
enabled: enabled && !!companyId && !!detailGroupId && !!clientToken
|
|
1218
1340
|
});
|
|
1219
1341
|
}
|
|
1342
|
+
function useBookingLabDays(companyId, serviceId, fromDate, toDate, clientToken, params, enabled = true) {
|
|
1343
|
+
const client = useBookingLabClient();
|
|
1344
|
+
return useQuery({
|
|
1345
|
+
queryKey: ["bookingLabDays", companyId, serviceId, fromDate, toDate, params?.resource_id],
|
|
1346
|
+
queryFn: async () => {
|
|
1347
|
+
const response = await client.getDays(companyId, serviceId, fromDate, toDate, clientToken, params);
|
|
1348
|
+
return response.data;
|
|
1349
|
+
},
|
|
1350
|
+
enabled: enabled && !!companyId && !!serviceId && !!fromDate && !!toDate && !!clientToken
|
|
1351
|
+
});
|
|
1352
|
+
}
|
|
1353
|
+
function useBookingLabTimes(companyId, serviceId, fromDate, toDate, clientToken, params, enabled = true) {
|
|
1354
|
+
const client = useBookingLabClient();
|
|
1355
|
+
return useQuery({
|
|
1356
|
+
queryKey: ["bookingLabTimes", companyId, serviceId, fromDate, toDate, params?.resource_ids],
|
|
1357
|
+
queryFn: async () => {
|
|
1358
|
+
const response = await client.getTimes(companyId, serviceId, fromDate, toDate, clientToken, params);
|
|
1359
|
+
return response.data;
|
|
1360
|
+
},
|
|
1361
|
+
enabled: enabled && !!companyId && !!serviceId && !!fromDate && !!toDate && !!clientToken
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1364
|
+
function useBookingLabCreateBasket() {
|
|
1365
|
+
const client = useBookingLabClient();
|
|
1366
|
+
return useMutation({
|
|
1367
|
+
mutationFn: async (input) => {
|
|
1368
|
+
const response = await client.createBasket(input.request, input.headers);
|
|
1369
|
+
return response.data;
|
|
1370
|
+
}
|
|
1371
|
+
});
|
|
1372
|
+
}
|
|
1373
|
+
function useBookingLabAddBasketServiceItem() {
|
|
1374
|
+
const client = useBookingLabClient();
|
|
1375
|
+
return useMutation({
|
|
1376
|
+
mutationFn: async (input) => {
|
|
1377
|
+
const response = await client.addBasketServiceItem(input.basketId, input.request, input.headers);
|
|
1378
|
+
return response.data;
|
|
1379
|
+
}
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1382
|
+
function useBookingLabCheckoutBasket() {
|
|
1383
|
+
const client = useBookingLabClient();
|
|
1384
|
+
return useMutation({
|
|
1385
|
+
mutationFn: async (input) => {
|
|
1386
|
+
const response = await client.checkoutBasketPublic(input.basketId, input.request, input.headers);
|
|
1387
|
+
return response.data;
|
|
1388
|
+
}
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
function useBookingLabDeleteBasket() {
|
|
1392
|
+
const client = useBookingLabClient();
|
|
1393
|
+
return useMutation({
|
|
1394
|
+
mutationFn: async (input) => {
|
|
1395
|
+
const response = await client.deleteBasketPublic(input.headers);
|
|
1396
|
+
return response.data;
|
|
1397
|
+
}
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
function useOrdnanceAddressLookup(postcode, clientToken, enabled = true) {
|
|
1401
|
+
const client = useBookingLabClient();
|
|
1402
|
+
return useQuery({
|
|
1403
|
+
queryKey: ["ordnanceAddressLookup", postcode],
|
|
1404
|
+
queryFn: async () => {
|
|
1405
|
+
const response = await client.getOrdnanceAddressLookup(postcode, clientToken);
|
|
1406
|
+
return response.data;
|
|
1407
|
+
},
|
|
1408
|
+
enabled: enabled && !!postcode && !!clientToken
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1220
1411
|
|
|
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 };
|
|
1412
|
+
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, useOrdnanceAddressLookup, useQuestions, useRescheduleBooking, useResetPassword, useResources, useSendCustomEmail, useServices, useTimes, useUpdateClient, useUpdateMember };
|
|
1222
1413
|
//# sourceMappingURL=index.mjs.map
|
|
1223
1414
|
//# sourceMappingURL=index.mjs.map
|