@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.js
CHANGED
|
@@ -425,6 +425,128 @@ var BookingLabClient = class extends ApiClient {
|
|
|
425
425
|
}
|
|
426
426
|
);
|
|
427
427
|
}
|
|
428
|
+
/**
|
|
429
|
+
* Get available days for a service within a date range
|
|
430
|
+
* @param companyId - The company ID
|
|
431
|
+
* @param serviceId - The service ID
|
|
432
|
+
* @param fromDate - Start date (YYYY-MM-DD)
|
|
433
|
+
* @param toDate - End date (YYYY-MM-DD)
|
|
434
|
+
* @param clientToken - Client token for authentication
|
|
435
|
+
* @param params - Optional query params (resource_id)
|
|
436
|
+
*/
|
|
437
|
+
async getDays(companyId, serviceId, fromDate, toDate, clientToken, params) {
|
|
438
|
+
return this.get(
|
|
439
|
+
`/company/${companyId}/service/${serviceId}/days/${fromDate}/${toDate}`,
|
|
440
|
+
{
|
|
441
|
+
headers: {
|
|
442
|
+
"clienttoken": clientToken
|
|
443
|
+
},
|
|
444
|
+
params
|
|
445
|
+
}
|
|
446
|
+
);
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Get available times for a service within a date range
|
|
450
|
+
* @param companyId - The company ID
|
|
451
|
+
* @param serviceId - The service ID
|
|
452
|
+
* @param fromDate - Start date (YYYY-MM-DD)
|
|
453
|
+
* @param toDate - End date (YYYY-MM-DD)
|
|
454
|
+
* @param clientToken - Client token for authentication
|
|
455
|
+
* @param params - Optional query params (duration, resource_id, person_id)
|
|
456
|
+
*/
|
|
457
|
+
async getTimes(companyId, serviceId, fromDate, toDate, clientToken, params) {
|
|
458
|
+
return this.get(
|
|
459
|
+
`/company/${companyId}/service/${serviceId}/times/${fromDate}/${toDate}`,
|
|
460
|
+
{
|
|
461
|
+
headers: {
|
|
462
|
+
"clienttoken": clientToken
|
|
463
|
+
},
|
|
464
|
+
params
|
|
465
|
+
}
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Create a new basket (BookingLab public)
|
|
470
|
+
* @param request - Body with company_id
|
|
471
|
+
* @param headers - Required clientToken/companyId; optional authToken/memberId
|
|
472
|
+
*/
|
|
473
|
+
async createBasket(request, headers) {
|
|
474
|
+
const reqHeaders = {
|
|
475
|
+
"clienttoken": headers.clientToken,
|
|
476
|
+
"x-company-id": String(headers.companyId)
|
|
477
|
+
};
|
|
478
|
+
if (headers.authToken) reqHeaders["authtoken"] = headers.authToken;
|
|
479
|
+
if (headers.memberId !== void 0) reqHeaders["x-member-id"] = String(headers.memberId);
|
|
480
|
+
return this.post("/basket-public", request, {
|
|
481
|
+
headers: reqHeaders
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Add a service item to a public basket (BookingLab)
|
|
486
|
+
* @param basketId - The basket ID
|
|
487
|
+
* @param request - Service item body
|
|
488
|
+
* @param headers - Required clientToken/authToken/companyId
|
|
489
|
+
*/
|
|
490
|
+
async addBasketServiceItem(basketId, request, headers) {
|
|
491
|
+
return this.post(
|
|
492
|
+
`/baskets/${basketId}/service_item-public`,
|
|
493
|
+
request,
|
|
494
|
+
{
|
|
495
|
+
headers: {
|
|
496
|
+
"clienttoken": headers.clientToken,
|
|
497
|
+
"authtoken": headers.authToken,
|
|
498
|
+
"x-company-id": String(headers.companyId)
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Checkout a public basket (BookingLab)
|
|
505
|
+
* @param basketId - The basket ID
|
|
506
|
+
* @param request - Body with company_id and client.id
|
|
507
|
+
* @param headers - Required clientToken/authToken/companyId
|
|
508
|
+
*/
|
|
509
|
+
async checkoutBasketPublic(basketId, request, headers) {
|
|
510
|
+
return this.post(
|
|
511
|
+
`/baskets/${basketId}/public-checkout`,
|
|
512
|
+
request,
|
|
513
|
+
{
|
|
514
|
+
headers: {
|
|
515
|
+
"clienttoken": headers.clientToken,
|
|
516
|
+
"authtoken": headers.authToken,
|
|
517
|
+
"x-company-id": String(headers.companyId)
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Delete a public basket (BookingLab)
|
|
524
|
+
* @param headers - Required clientToken/authToken/companyId
|
|
525
|
+
*/
|
|
526
|
+
async deleteBasketPublic(headers) {
|
|
527
|
+
return this.delete("/basket-public", {
|
|
528
|
+
headers: {
|
|
529
|
+
"clienttoken": headers.clientToken,
|
|
530
|
+
"authtoken": headers.authToken,
|
|
531
|
+
"x-company-id": String(headers.companyId)
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Look up UK addresses by postcode via Ordnance Survey
|
|
537
|
+
* @param postcode - UK postcode
|
|
538
|
+
* @param clientToken - Client token for authentication
|
|
539
|
+
*/
|
|
540
|
+
async getOrdnanceAddressLookup(postcode, clientToken) {
|
|
541
|
+
return this.get(
|
|
542
|
+
`/ordnance_survey/postcode/${encodeURIComponent(postcode)}`,
|
|
543
|
+
{
|
|
544
|
+
headers: {
|
|
545
|
+
"clienttoken": clientToken
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
);
|
|
549
|
+
}
|
|
428
550
|
};
|
|
429
551
|
function createBookingLabClient(baseUrl, authToken, appId) {
|
|
430
552
|
const client = new BookingLabClient({ baseUrl });
|
|
@@ -1219,6 +1341,75 @@ function useBookingLabQuestions(companyId, detailGroupId, clientToken, enabled =
|
|
|
1219
1341
|
enabled: enabled && !!companyId && !!detailGroupId && !!clientToken
|
|
1220
1342
|
});
|
|
1221
1343
|
}
|
|
1344
|
+
function useBookingLabDays(companyId, serviceId, fromDate, toDate, clientToken, params, enabled = true) {
|
|
1345
|
+
const client = useBookingLabClient();
|
|
1346
|
+
return reactQuery.useQuery({
|
|
1347
|
+
queryKey: ["bookingLabDays", companyId, serviceId, fromDate, toDate, params?.resource_id],
|
|
1348
|
+
queryFn: async () => {
|
|
1349
|
+
const response = await client.getDays(companyId, serviceId, fromDate, toDate, clientToken, params);
|
|
1350
|
+
return response.data;
|
|
1351
|
+
},
|
|
1352
|
+
enabled: enabled && !!companyId && !!serviceId && !!fromDate && !!toDate && !!clientToken
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1355
|
+
function useBookingLabTimes(companyId, serviceId, fromDate, toDate, clientToken, params, enabled = true) {
|
|
1356
|
+
const client = useBookingLabClient();
|
|
1357
|
+
return reactQuery.useQuery({
|
|
1358
|
+
queryKey: ["bookingLabTimes", companyId, serviceId, fromDate, toDate, params?.resource_ids],
|
|
1359
|
+
queryFn: async () => {
|
|
1360
|
+
const response = await client.getTimes(companyId, serviceId, fromDate, toDate, clientToken, params);
|
|
1361
|
+
return response.data;
|
|
1362
|
+
},
|
|
1363
|
+
enabled: enabled && !!companyId && !!serviceId && !!fromDate && !!toDate && !!clientToken
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
function useBookingLabCreateBasket() {
|
|
1367
|
+
const client = useBookingLabClient();
|
|
1368
|
+
return reactQuery.useMutation({
|
|
1369
|
+
mutationFn: async (input) => {
|
|
1370
|
+
const response = await client.createBasket(input.request, input.headers);
|
|
1371
|
+
return response.data;
|
|
1372
|
+
}
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
function useBookingLabAddBasketServiceItem() {
|
|
1376
|
+
const client = useBookingLabClient();
|
|
1377
|
+
return reactQuery.useMutation({
|
|
1378
|
+
mutationFn: async (input) => {
|
|
1379
|
+
const response = await client.addBasketServiceItem(input.basketId, input.request, input.headers);
|
|
1380
|
+
return response.data;
|
|
1381
|
+
}
|
|
1382
|
+
});
|
|
1383
|
+
}
|
|
1384
|
+
function useBookingLabCheckoutBasket() {
|
|
1385
|
+
const client = useBookingLabClient();
|
|
1386
|
+
return reactQuery.useMutation({
|
|
1387
|
+
mutationFn: async (input) => {
|
|
1388
|
+
const response = await client.checkoutBasketPublic(input.basketId, input.request, input.headers);
|
|
1389
|
+
return response.data;
|
|
1390
|
+
}
|
|
1391
|
+
});
|
|
1392
|
+
}
|
|
1393
|
+
function useBookingLabDeleteBasket() {
|
|
1394
|
+
const client = useBookingLabClient();
|
|
1395
|
+
return reactQuery.useMutation({
|
|
1396
|
+
mutationFn: async (input) => {
|
|
1397
|
+
const response = await client.deleteBasketPublic(input.headers);
|
|
1398
|
+
return response.data;
|
|
1399
|
+
}
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
function useOrdnanceAddressLookup(postcode, clientToken, enabled = true) {
|
|
1403
|
+
const client = useBookingLabClient();
|
|
1404
|
+
return reactQuery.useQuery({
|
|
1405
|
+
queryKey: ["ordnanceAddressLookup", postcode],
|
|
1406
|
+
queryFn: async () => {
|
|
1407
|
+
const response = await client.getOrdnanceAddressLookup(postcode, clientToken);
|
|
1408
|
+
return response.data;
|
|
1409
|
+
},
|
|
1410
|
+
enabled: enabled && !!postcode && !!clientToken
|
|
1411
|
+
});
|
|
1412
|
+
}
|
|
1222
1413
|
|
|
1223
1414
|
exports.ApiClient = ApiClient;
|
|
1224
1415
|
exports.ApiClientContext = ApiClientContext;
|
|
@@ -1234,15 +1425,21 @@ exports.createBookingLabClient = createBookingLabClient;
|
|
|
1234
1425
|
exports.createJrniClient = createJrniClient;
|
|
1235
1426
|
exports.useAddServiceItem = useAddServiceItem;
|
|
1236
1427
|
exports.useApiClientContext = useApiClientContext;
|
|
1428
|
+
exports.useBookingLabAddBasketServiceItem = useBookingLabAddBasketServiceItem;
|
|
1429
|
+
exports.useBookingLabCheckoutBasket = useBookingLabCheckoutBasket;
|
|
1237
1430
|
exports.useBookingLabClient = useBookingLabClient;
|
|
1238
1431
|
exports.useBookingLabCompanies = useBookingLabCompanies;
|
|
1239
1432
|
exports.useBookingLabConfig = useBookingLabConfig;
|
|
1240
1433
|
exports.useBookingLabContext = useBookingLabContext;
|
|
1434
|
+
exports.useBookingLabCreateBasket = useBookingLabCreateBasket;
|
|
1435
|
+
exports.useBookingLabDays = useBookingLabDays;
|
|
1436
|
+
exports.useBookingLabDeleteBasket = useBookingLabDeleteBasket;
|
|
1241
1437
|
exports.useBookingLabForgotPassword = useBookingLabForgotPassword;
|
|
1242
1438
|
exports.useBookingLabGetToken = useBookingLabGetToken;
|
|
1243
1439
|
exports.useBookingLabQuestions = useBookingLabQuestions;
|
|
1244
1440
|
exports.useBookingLabService = useBookingLabService;
|
|
1245
1441
|
exports.useBookingLabServices = useBookingLabServices;
|
|
1442
|
+
exports.useBookingLabTimes = useBookingLabTimes;
|
|
1246
1443
|
exports.useCancelBooking = useCancelBooking;
|
|
1247
1444
|
exports.useCancelMemberBooking = useCancelMemberBooking;
|
|
1248
1445
|
exports.useCheckoutBasket = useCheckoutBasket;
|
|
@@ -1260,6 +1457,7 @@ exports.useJrniClient = useJrniClient;
|
|
|
1260
1457
|
exports.useJrniContext = useJrniContext;
|
|
1261
1458
|
exports.useListBookings = useListBookings;
|
|
1262
1459
|
exports.useLogin = useLogin;
|
|
1460
|
+
exports.useOrdnanceAddressLookup = useOrdnanceAddressLookup;
|
|
1263
1461
|
exports.useQuestions = useQuestions;
|
|
1264
1462
|
exports.useRescheduleBooking = useRescheduleBooking;
|
|
1265
1463
|
exports.useResetPassword = useResetPassword;
|