@bookinglab/booking-journey-api 2.3.0 → 2.6.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 +22 -0
- package/dist/index.d.cts +170 -1
- package/dist/index.d.ts +170 -1
- package/dist/index.js +86 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +84 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -201,6 +201,8 @@ const client = createJrniClient('https://api.jrni.com', {
|
|
|
201
201
|
- `client.updateMember(companyId, memberId, request, authToken)` - Update a member's details
|
|
202
202
|
- `client.getCompany(companyId)` - Get a company by ID
|
|
203
203
|
- `client.getMember(companyId, memberId, authToken)` - Get a member by ID
|
|
204
|
+
- `client.cancelMemberBooking(companyId, memberId, bookingId, authToken)` - Cancel a member's booking
|
|
205
|
+
- `client.rescheduleBooking(companyId, memberId, bookingId, request, authToken)` - Reschedule a member's booking
|
|
204
206
|
- `client.setAuthToken(token)` - Set auth token for subsequent requests
|
|
205
207
|
|
|
206
208
|
#### `createBookingLabClient(options)`
|
|
@@ -219,6 +221,7 @@ client.setAuthToken('your-auth-token');
|
|
|
219
221
|
- `client.updateBooking(id, data)` - Update a booking
|
|
220
222
|
- `client.cancelBooking(companyId, bookingId, request, clientToken)` - Cancel a booking
|
|
221
223
|
- `client.resetPassword(memberId, companyId, request, authToken, clientToken)` - Reset a member's password
|
|
224
|
+
- `client.sendCustomEmail(companyId, request, clientToken)` - Send a custom email
|
|
222
225
|
- `client.deleteBooking(id)` - Delete a booking
|
|
223
226
|
- `client.getServices()` - Get all services
|
|
224
227
|
- `client.getService(id)` - Get a specific service
|
|
@@ -288,6 +291,8 @@ Combined provider for applications using multiple API clients.
|
|
|
288
291
|
- `useUpdateMember(companyId, memberId, authToken)` - Update a member's details
|
|
289
292
|
- `useCompany(companyId, enabled?)` - Get a company by ID
|
|
290
293
|
- `useGetMember(companyId, memberId, authToken, enabled?)` - Get a member by ID
|
|
294
|
+
- `useCancelMemberBooking(companyId, memberId, authToken)` - Cancel a member's booking
|
|
295
|
+
- `useRescheduleBooking(companyId, memberId, authToken)` - Reschedule a member's booking
|
|
291
296
|
- `useJrniClient()` - Access the JRNI client directly
|
|
292
297
|
|
|
293
298
|
```typescript
|
|
@@ -375,6 +380,17 @@ const { data: company } = useCompany(37001);
|
|
|
375
380
|
const { data: member } = useGetMember(37001, 19, 'user-auth-token');
|
|
376
381
|
// member = { id: 19, name: "John Doe", email: "john@example.com", ... }
|
|
377
382
|
|
|
383
|
+
// Cancel a member's booking
|
|
384
|
+
const cancelMemberBookingMutation = useCancelMemberBooking(37001, 2, 'user-auth-token');
|
|
385
|
+
cancelMemberBookingMutation.mutate(29); // bookingId
|
|
386
|
+
|
|
387
|
+
// Reschedule a member's booking
|
|
388
|
+
const rescheduleMutation = useRescheduleBooking(37001, 2, 'user-auth-token');
|
|
389
|
+
rescheduleMutation.mutate({
|
|
390
|
+
bookingId: 29,
|
|
391
|
+
request: { date: '2026-03-03', time: '10:00', duration: 60, notify: true, notify_admin: true }
|
|
392
|
+
});
|
|
393
|
+
|
|
378
394
|
const client = useJrniClient();
|
|
379
395
|
```
|
|
380
396
|
|
|
@@ -390,6 +406,7 @@ const client = useJrniClient();
|
|
|
390
406
|
- `useCreateClient(companyId, clientToken?)` - Create a new client
|
|
391
407
|
- `useServices()` - Get all services
|
|
392
408
|
- `useService(id)` - Get a specific service
|
|
409
|
+
- `useSendCustomEmail(companyId, clientToken)` - Send a custom email
|
|
393
410
|
- `useBookingLabClient()` - Access the BookingLab client directly
|
|
394
411
|
|
|
395
412
|
```typescript
|
|
@@ -470,6 +487,9 @@ import type {
|
|
|
470
487
|
CompanyResponse,
|
|
471
488
|
CompanySettings,
|
|
472
489
|
GetMemberResponse,
|
|
490
|
+
CancelMemberBookingResponse,
|
|
491
|
+
RescheduleBookingRequest,
|
|
492
|
+
RescheduleBookingResponse,
|
|
473
493
|
// BookingLab Types
|
|
474
494
|
Booking,
|
|
475
495
|
CreateBookingRequest,
|
|
@@ -477,6 +497,8 @@ import type {
|
|
|
477
497
|
CancelBookingRequest,
|
|
478
498
|
CancelBookingResponse,
|
|
479
499
|
ResetPasswordRequest,
|
|
500
|
+
SendCustomEmailRequest,
|
|
501
|
+
SendCustomEmailResponse,
|
|
480
502
|
} from '@bookinglab/booking-journey-api';
|
|
481
503
|
```
|
|
482
504
|
|
package/dist/index.d.cts
CHANGED
|
@@ -943,6 +943,128 @@ interface CompanyResponse {
|
|
|
943
943
|
};
|
|
944
944
|
_links: Record<string, any>;
|
|
945
945
|
}
|
|
946
|
+
/**
|
|
947
|
+
* Cancel Member Booking Response
|
|
948
|
+
* Response from DELETE /{company_id}/members/{member_id}/bookings/{id}
|
|
949
|
+
*/
|
|
950
|
+
interface CancelMemberBookingResponse {
|
|
951
|
+
id: number;
|
|
952
|
+
full_describe: string;
|
|
953
|
+
describe: string;
|
|
954
|
+
resource_name: string;
|
|
955
|
+
datetime: string;
|
|
956
|
+
end_datetime: string;
|
|
957
|
+
duration: number;
|
|
958
|
+
on_waitlist: boolean;
|
|
959
|
+
company_id: number;
|
|
960
|
+
attended: boolean;
|
|
961
|
+
price: number;
|
|
962
|
+
paid: number;
|
|
963
|
+
quantity: number;
|
|
964
|
+
event_id: number;
|
|
965
|
+
purchase_id: number;
|
|
966
|
+
purchase_ref: string;
|
|
967
|
+
min_cancellation_time: string;
|
|
968
|
+
service_name: string;
|
|
969
|
+
service_id: number;
|
|
970
|
+
category_name: string;
|
|
971
|
+
time_zone: string;
|
|
972
|
+
status: string;
|
|
973
|
+
is_cancelled: boolean;
|
|
974
|
+
_embedded: {
|
|
975
|
+
payment_item: {
|
|
976
|
+
id: number;
|
|
977
|
+
price: number;
|
|
978
|
+
paid: number;
|
|
979
|
+
describe: string;
|
|
980
|
+
full_describe: string;
|
|
981
|
+
item_type: string;
|
|
982
|
+
_links: Record<string, any>;
|
|
983
|
+
};
|
|
984
|
+
answers: any[];
|
|
985
|
+
};
|
|
986
|
+
person_ids: number[];
|
|
987
|
+
settings: {
|
|
988
|
+
obfuscated_id: string;
|
|
989
|
+
who_updated: string;
|
|
990
|
+
cancel_reason: string | null;
|
|
991
|
+
late_cancel: number;
|
|
992
|
+
who_cancelled: string | null;
|
|
993
|
+
};
|
|
994
|
+
questions: Record<string, any>;
|
|
995
|
+
_links: Record<string, any>;
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* Reschedule Booking Request
|
|
999
|
+
* Body for PUT /{company_id}/members/{member_id}/bookings/{id}/reschedule
|
|
1000
|
+
*/
|
|
1001
|
+
interface RescheduleBookingRequest {
|
|
1002
|
+
/** New booking date in ISO-8601 format (YYYY-MM-DD) */
|
|
1003
|
+
date: string;
|
|
1004
|
+
/** New booking time in HH:mm format */
|
|
1005
|
+
time: string;
|
|
1006
|
+
/** New booking duration in minutes (defaults to current duration if not provided) */
|
|
1007
|
+
duration?: number;
|
|
1008
|
+
/** Whether to send notifications (defaults to true) */
|
|
1009
|
+
notify?: boolean;
|
|
1010
|
+
/** Whether to notify admins (defaults to true) */
|
|
1011
|
+
notify_admin?: boolean;
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* Reschedule Booking Response
|
|
1015
|
+
* Response from PUT /{company_id}/members/{member_id}/bookings/{id}/reschedule
|
|
1016
|
+
*/
|
|
1017
|
+
interface RescheduleBookingResponse {
|
|
1018
|
+
id: number;
|
|
1019
|
+
full_describe: string;
|
|
1020
|
+
describe: string;
|
|
1021
|
+
resource_name: string;
|
|
1022
|
+
datetime: string;
|
|
1023
|
+
end_datetime: string;
|
|
1024
|
+
duration: number;
|
|
1025
|
+
on_waitlist: boolean;
|
|
1026
|
+
company_id: number;
|
|
1027
|
+
attended: boolean;
|
|
1028
|
+
price: number;
|
|
1029
|
+
paid: number;
|
|
1030
|
+
quantity: number;
|
|
1031
|
+
event_id: number;
|
|
1032
|
+
purchase_id: number;
|
|
1033
|
+
purchase_ref: string;
|
|
1034
|
+
min_cancellation_time: string;
|
|
1035
|
+
service_name: string;
|
|
1036
|
+
service_id: number;
|
|
1037
|
+
category_name: string;
|
|
1038
|
+
time_zone: string;
|
|
1039
|
+
status: string;
|
|
1040
|
+
is_cancelled: boolean;
|
|
1041
|
+
_embedded: {
|
|
1042
|
+
payment_item: {
|
|
1043
|
+
id: number;
|
|
1044
|
+
price: number;
|
|
1045
|
+
paid: number;
|
|
1046
|
+
describe: string;
|
|
1047
|
+
full_describe: string;
|
|
1048
|
+
item_type: string;
|
|
1049
|
+
_links: Record<string, any>;
|
|
1050
|
+
};
|
|
1051
|
+
answers: any[];
|
|
1052
|
+
};
|
|
1053
|
+
person_ids: number[];
|
|
1054
|
+
settings: {
|
|
1055
|
+
obfuscated_id: string;
|
|
1056
|
+
};
|
|
1057
|
+
questions: Record<string, any>;
|
|
1058
|
+
_links: Record<string, any>;
|
|
1059
|
+
}
|
|
1060
|
+
interface SendCustomEmailRequest {
|
|
1061
|
+
slot: string;
|
|
1062
|
+
to: string;
|
|
1063
|
+
from: string;
|
|
1064
|
+
subject: string;
|
|
1065
|
+
type: string;
|
|
1066
|
+
}
|
|
1067
|
+
type SendCustomEmailResponse = string;
|
|
946
1068
|
|
|
947
1069
|
/**
|
|
948
1070
|
* Core API Client
|
|
@@ -1066,6 +1188,13 @@ declare class BookingLabClient extends ApiClient {
|
|
|
1066
1188
|
* @param clientToken - Client token for authentication
|
|
1067
1189
|
*/
|
|
1068
1190
|
findClientByEmail(companyId: number, email: string, clientToken: string): Promise<ApiResponse<FindClientByEmailResponse>>;
|
|
1191
|
+
/**
|
|
1192
|
+
* Send a custom email for a booking
|
|
1193
|
+
* @param companyId - The company ID
|
|
1194
|
+
* @param request - Email request data
|
|
1195
|
+
* @param clientToken - Client token for authentication
|
|
1196
|
+
*/
|
|
1197
|
+
sendCustomEmail(companyId: number, request: SendCustomEmailRequest, clientToken: string): Promise<ApiResponse<SendCustomEmailResponse>>;
|
|
1069
1198
|
}
|
|
1070
1199
|
/**
|
|
1071
1200
|
* Create a new BookingLab client instance
|
|
@@ -1189,6 +1318,23 @@ declare class JrniClient extends ApiClient {
|
|
|
1189
1318
|
* @param companyId - The company ID
|
|
1190
1319
|
*/
|
|
1191
1320
|
getCompany(companyId: number): Promise<ApiResponse<CompanyResponse>>;
|
|
1321
|
+
/**
|
|
1322
|
+
* Cancel a member's booking
|
|
1323
|
+
* @param companyId - The company ID
|
|
1324
|
+
* @param memberId - The member ID
|
|
1325
|
+
* @param bookingId - The booking ID
|
|
1326
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
1327
|
+
*/
|
|
1328
|
+
cancelMemberBooking(companyId: number, memberId: number, bookingId: number, authToken: string): Promise<ApiResponse<CancelMemberBookingResponse>>;
|
|
1329
|
+
/**
|
|
1330
|
+
* Reschedule a member's booking
|
|
1331
|
+
* @param companyId - The company ID
|
|
1332
|
+
* @param memberId - The member ID
|
|
1333
|
+
* @param bookingId - The booking ID
|
|
1334
|
+
* @param request - The reschedule request data
|
|
1335
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
1336
|
+
*/
|
|
1337
|
+
rescheduleBooking(companyId: number, memberId: number, bookingId: number, request: RescheduleBookingRequest, authToken: string): Promise<ApiResponse<RescheduleBookingResponse>>;
|
|
1192
1338
|
/**
|
|
1193
1339
|
* Update JRNI configuration
|
|
1194
1340
|
*/
|
|
@@ -1369,6 +1515,23 @@ declare function useGetMember(companyId: number, memberId: number, authToken: st
|
|
|
1369
1515
|
* @param enabled - Whether the query should run
|
|
1370
1516
|
*/
|
|
1371
1517
|
declare function useCompany(companyId: number, enabled?: boolean): _tanstack_react_query.UseQueryResult<CompanyResponse, Error>;
|
|
1518
|
+
/**
|
|
1519
|
+
* Hook for cancelling a member's booking
|
|
1520
|
+
* @param companyId - The company ID
|
|
1521
|
+
* @param memberId - The member ID
|
|
1522
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
1523
|
+
*/
|
|
1524
|
+
declare function useCancelMemberBooking(companyId: number, memberId: number, authToken: string): _tanstack_react_query.UseMutationResult<CancelMemberBookingResponse, Error, number, unknown>;
|
|
1525
|
+
/**
|
|
1526
|
+
* Hook for rescheduling a member's booking
|
|
1527
|
+
* @param companyId - The company ID
|
|
1528
|
+
* @param memberId - The member ID
|
|
1529
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
1530
|
+
*/
|
|
1531
|
+
declare function useRescheduleBooking(companyId: number, memberId: number, authToken: string): _tanstack_react_query.UseMutationResult<RescheduleBookingResponse, Error, {
|
|
1532
|
+
bookingId: number;
|
|
1533
|
+
request: RescheduleBookingRequest;
|
|
1534
|
+
}, unknown>;
|
|
1372
1535
|
|
|
1373
1536
|
/**
|
|
1374
1537
|
* Hook for fetching client details
|
|
@@ -1406,5 +1569,11 @@ declare function useResetPassword(memberId: number, companyId: number, authToken
|
|
|
1406
1569
|
* @param enabled - Whether the query should run
|
|
1407
1570
|
*/
|
|
1408
1571
|
declare function useFindClientByEmail(companyId: number, email: string, clientToken: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<FindClientByEmailResponse, Error>;
|
|
1572
|
+
/**
|
|
1573
|
+
* Hook for sending a custom email
|
|
1574
|
+
* @param companyId - The company ID
|
|
1575
|
+
* @param clientToken - Client token for authentication
|
|
1576
|
+
*/
|
|
1577
|
+
declare function useSendCustomEmail(companyId: number, clientToken: string): _tanstack_react_query.UseMutationResult<string, Error, SendCustomEmailRequest, unknown>;
|
|
1409
1578
|
|
|
1410
|
-
export { type AddBasketItemRequest, type AddServiceItemAssets, type AddServiceItemQuestion, type AddServiceItemRequest, ApiClient, type ApiClientConfig, ApiClientProvider, type ApiError, type ApiResponse, type AvailabilityTime, type AvailabilityTimesResponse, type Booking, type BookingAnswer, BookingLabClient, BookingLabProvider, type BookingPaymentItem, type BookingSettings, type CancelBookingRequest, type CancelBookingResponse, type CheckoutBasketClient, type CheckoutBasketRequest, type CheckoutBasketResponse, type ChildCompaniesResponse, type ChildCompany, type ChildCompanyAddress, type ChildCompanySettings, type ClearBasketsResponse, type ClientDetailsQuestion, type ClientDetailsResponse, type CompanyResponse, type CompanySettings, type CreateBasketRequest, type CreateBasketResponse, type CreateBookingRequest, type CreateClientRequest, type CreateClientResponse, type DateSlot, type DatesResponse, type FindClientByEmailResponse, type ForgottenPasswordRequest, type ForgottenPasswordResponse, type GetChildCompaniesParams, type GetDatesParams, type GetMemberResponse, type GetQuestionsParams, type GetTimesParams, type JrniBooking, JrniClient, type JrniConfig, JrniProvider, type JrniService, type ListBookingsParams, type ListBookingsResponse, type Location, type LocationsResponse, type LoginRequest, type LoginResponse, type MemberBooking, type MemberBookingsResponse, MemberType, type PersonImage, type PersonImagesResponse, type Question, type QuestionOption, type QuestionsResponse, type RequestOptions, type ResetPasswordRequest, type Resource, type ResourceLinks, type ResourcesResponse, type Service, type ServiceItemResponse, type ServicesResponse, type TimeSlot, type TimesResponse, type UpdateClientAnswer, type UpdateClientAnswerEntry, type UpdateClientDetailsData, type UpdateClientExtraInfo, type UpdateClientNotificationPreferences, type UpdateClientQuestionEntry, type UpdateClientRequest, type UpdateClientResponse, type UpdateMemberDetailsData, type UpdateMemberRequest, type UpdateMemberResponse, type Vehicle, type VehiclesResponse, createBookingLabClient, createJrniClient, useAddServiceItem, useApiClientContext, useBookingLabClient, useBookingLabContext, useCancelBooking, useCheckoutBasket, useChildCompanies, useClearBaskets, useClientDetails, useCompany, useCreateBasket, useCreateClient, useDates, useFindClientByEmail, useForgottenPassword, useGetMember, useJrniClient, useJrniContext, useListBookings, useLogin, useQuestions, useResetPassword, useResources, useServices, useTimes, useUpdateClient, useUpdateMember };
|
|
1579
|
+
export { type AddBasketItemRequest, type AddServiceItemAssets, type AddServiceItemQuestion, type AddServiceItemRequest, ApiClient, type ApiClientConfig, ApiClientProvider, type ApiError, type ApiResponse, type AvailabilityTime, type AvailabilityTimesResponse, type Booking, type BookingAnswer, BookingLabClient, BookingLabProvider, type BookingPaymentItem, type BookingSettings, type CancelBookingRequest, type CancelBookingResponse, type CancelMemberBookingResponse, type CheckoutBasketClient, type CheckoutBasketRequest, type CheckoutBasketResponse, type ChildCompaniesResponse, type ChildCompany, type ChildCompanyAddress, type ChildCompanySettings, type ClearBasketsResponse, type ClientDetailsQuestion, type ClientDetailsResponse, type CompanyResponse, type CompanySettings, type CreateBasketRequest, type CreateBasketResponse, type CreateBookingRequest, type CreateClientRequest, type CreateClientResponse, type DateSlot, type DatesResponse, type FindClientByEmailResponse, type ForgottenPasswordRequest, type ForgottenPasswordResponse, type GetChildCompaniesParams, type GetDatesParams, type GetMemberResponse, type GetQuestionsParams, type GetTimesParams, type JrniBooking, JrniClient, type JrniConfig, JrniProvider, type JrniService, type ListBookingsParams, type ListBookingsResponse, type Location, type LocationsResponse, type LoginRequest, type LoginResponse, type MemberBooking, type MemberBookingsResponse, MemberType, type PersonImage, type PersonImagesResponse, type Question, type QuestionOption, type QuestionsResponse, type RequestOptions, type RescheduleBookingRequest, type RescheduleBookingResponse, type ResetPasswordRequest, type Resource, type ResourceLinks, type ResourcesResponse, type SendCustomEmailRequest, type SendCustomEmailResponse, type Service, type ServiceItemResponse, type ServicesResponse, type TimeSlot, type TimesResponse, type UpdateClientAnswer, type UpdateClientAnswerEntry, type UpdateClientDetailsData, type UpdateClientExtraInfo, type UpdateClientNotificationPreferences, type UpdateClientQuestionEntry, type UpdateClientRequest, type UpdateClientResponse, type UpdateMemberDetailsData, type UpdateMemberRequest, type UpdateMemberResponse, type Vehicle, type VehiclesResponse, createBookingLabClient, createJrniClient, useAddServiceItem, useApiClientContext, useBookingLabClient, useBookingLabContext, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -943,6 +943,128 @@ interface CompanyResponse {
|
|
|
943
943
|
};
|
|
944
944
|
_links: Record<string, any>;
|
|
945
945
|
}
|
|
946
|
+
/**
|
|
947
|
+
* Cancel Member Booking Response
|
|
948
|
+
* Response from DELETE /{company_id}/members/{member_id}/bookings/{id}
|
|
949
|
+
*/
|
|
950
|
+
interface CancelMemberBookingResponse {
|
|
951
|
+
id: number;
|
|
952
|
+
full_describe: string;
|
|
953
|
+
describe: string;
|
|
954
|
+
resource_name: string;
|
|
955
|
+
datetime: string;
|
|
956
|
+
end_datetime: string;
|
|
957
|
+
duration: number;
|
|
958
|
+
on_waitlist: boolean;
|
|
959
|
+
company_id: number;
|
|
960
|
+
attended: boolean;
|
|
961
|
+
price: number;
|
|
962
|
+
paid: number;
|
|
963
|
+
quantity: number;
|
|
964
|
+
event_id: number;
|
|
965
|
+
purchase_id: number;
|
|
966
|
+
purchase_ref: string;
|
|
967
|
+
min_cancellation_time: string;
|
|
968
|
+
service_name: string;
|
|
969
|
+
service_id: number;
|
|
970
|
+
category_name: string;
|
|
971
|
+
time_zone: string;
|
|
972
|
+
status: string;
|
|
973
|
+
is_cancelled: boolean;
|
|
974
|
+
_embedded: {
|
|
975
|
+
payment_item: {
|
|
976
|
+
id: number;
|
|
977
|
+
price: number;
|
|
978
|
+
paid: number;
|
|
979
|
+
describe: string;
|
|
980
|
+
full_describe: string;
|
|
981
|
+
item_type: string;
|
|
982
|
+
_links: Record<string, any>;
|
|
983
|
+
};
|
|
984
|
+
answers: any[];
|
|
985
|
+
};
|
|
986
|
+
person_ids: number[];
|
|
987
|
+
settings: {
|
|
988
|
+
obfuscated_id: string;
|
|
989
|
+
who_updated: string;
|
|
990
|
+
cancel_reason: string | null;
|
|
991
|
+
late_cancel: number;
|
|
992
|
+
who_cancelled: string | null;
|
|
993
|
+
};
|
|
994
|
+
questions: Record<string, any>;
|
|
995
|
+
_links: Record<string, any>;
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* Reschedule Booking Request
|
|
999
|
+
* Body for PUT /{company_id}/members/{member_id}/bookings/{id}/reschedule
|
|
1000
|
+
*/
|
|
1001
|
+
interface RescheduleBookingRequest {
|
|
1002
|
+
/** New booking date in ISO-8601 format (YYYY-MM-DD) */
|
|
1003
|
+
date: string;
|
|
1004
|
+
/** New booking time in HH:mm format */
|
|
1005
|
+
time: string;
|
|
1006
|
+
/** New booking duration in minutes (defaults to current duration if not provided) */
|
|
1007
|
+
duration?: number;
|
|
1008
|
+
/** Whether to send notifications (defaults to true) */
|
|
1009
|
+
notify?: boolean;
|
|
1010
|
+
/** Whether to notify admins (defaults to true) */
|
|
1011
|
+
notify_admin?: boolean;
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* Reschedule Booking Response
|
|
1015
|
+
* Response from PUT /{company_id}/members/{member_id}/bookings/{id}/reschedule
|
|
1016
|
+
*/
|
|
1017
|
+
interface RescheduleBookingResponse {
|
|
1018
|
+
id: number;
|
|
1019
|
+
full_describe: string;
|
|
1020
|
+
describe: string;
|
|
1021
|
+
resource_name: string;
|
|
1022
|
+
datetime: string;
|
|
1023
|
+
end_datetime: string;
|
|
1024
|
+
duration: number;
|
|
1025
|
+
on_waitlist: boolean;
|
|
1026
|
+
company_id: number;
|
|
1027
|
+
attended: boolean;
|
|
1028
|
+
price: number;
|
|
1029
|
+
paid: number;
|
|
1030
|
+
quantity: number;
|
|
1031
|
+
event_id: number;
|
|
1032
|
+
purchase_id: number;
|
|
1033
|
+
purchase_ref: string;
|
|
1034
|
+
min_cancellation_time: string;
|
|
1035
|
+
service_name: string;
|
|
1036
|
+
service_id: number;
|
|
1037
|
+
category_name: string;
|
|
1038
|
+
time_zone: string;
|
|
1039
|
+
status: string;
|
|
1040
|
+
is_cancelled: boolean;
|
|
1041
|
+
_embedded: {
|
|
1042
|
+
payment_item: {
|
|
1043
|
+
id: number;
|
|
1044
|
+
price: number;
|
|
1045
|
+
paid: number;
|
|
1046
|
+
describe: string;
|
|
1047
|
+
full_describe: string;
|
|
1048
|
+
item_type: string;
|
|
1049
|
+
_links: Record<string, any>;
|
|
1050
|
+
};
|
|
1051
|
+
answers: any[];
|
|
1052
|
+
};
|
|
1053
|
+
person_ids: number[];
|
|
1054
|
+
settings: {
|
|
1055
|
+
obfuscated_id: string;
|
|
1056
|
+
};
|
|
1057
|
+
questions: Record<string, any>;
|
|
1058
|
+
_links: Record<string, any>;
|
|
1059
|
+
}
|
|
1060
|
+
interface SendCustomEmailRequest {
|
|
1061
|
+
slot: string;
|
|
1062
|
+
to: string;
|
|
1063
|
+
from: string;
|
|
1064
|
+
subject: string;
|
|
1065
|
+
type: string;
|
|
1066
|
+
}
|
|
1067
|
+
type SendCustomEmailResponse = string;
|
|
946
1068
|
|
|
947
1069
|
/**
|
|
948
1070
|
* Core API Client
|
|
@@ -1066,6 +1188,13 @@ declare class BookingLabClient extends ApiClient {
|
|
|
1066
1188
|
* @param clientToken - Client token for authentication
|
|
1067
1189
|
*/
|
|
1068
1190
|
findClientByEmail(companyId: number, email: string, clientToken: string): Promise<ApiResponse<FindClientByEmailResponse>>;
|
|
1191
|
+
/**
|
|
1192
|
+
* Send a custom email for a booking
|
|
1193
|
+
* @param companyId - The company ID
|
|
1194
|
+
* @param request - Email request data
|
|
1195
|
+
* @param clientToken - Client token for authentication
|
|
1196
|
+
*/
|
|
1197
|
+
sendCustomEmail(companyId: number, request: SendCustomEmailRequest, clientToken: string): Promise<ApiResponse<SendCustomEmailResponse>>;
|
|
1069
1198
|
}
|
|
1070
1199
|
/**
|
|
1071
1200
|
* Create a new BookingLab client instance
|
|
@@ -1189,6 +1318,23 @@ declare class JrniClient extends ApiClient {
|
|
|
1189
1318
|
* @param companyId - The company ID
|
|
1190
1319
|
*/
|
|
1191
1320
|
getCompany(companyId: number): Promise<ApiResponse<CompanyResponse>>;
|
|
1321
|
+
/**
|
|
1322
|
+
* Cancel a member's booking
|
|
1323
|
+
* @param companyId - The company ID
|
|
1324
|
+
* @param memberId - The member ID
|
|
1325
|
+
* @param bookingId - The booking ID
|
|
1326
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
1327
|
+
*/
|
|
1328
|
+
cancelMemberBooking(companyId: number, memberId: number, bookingId: number, authToken: string): Promise<ApiResponse<CancelMemberBookingResponse>>;
|
|
1329
|
+
/**
|
|
1330
|
+
* Reschedule a member's booking
|
|
1331
|
+
* @param companyId - The company ID
|
|
1332
|
+
* @param memberId - The member ID
|
|
1333
|
+
* @param bookingId - The booking ID
|
|
1334
|
+
* @param request - The reschedule request data
|
|
1335
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
1336
|
+
*/
|
|
1337
|
+
rescheduleBooking(companyId: number, memberId: number, bookingId: number, request: RescheduleBookingRequest, authToken: string): Promise<ApiResponse<RescheduleBookingResponse>>;
|
|
1192
1338
|
/**
|
|
1193
1339
|
* Update JRNI configuration
|
|
1194
1340
|
*/
|
|
@@ -1369,6 +1515,23 @@ declare function useGetMember(companyId: number, memberId: number, authToken: st
|
|
|
1369
1515
|
* @param enabled - Whether the query should run
|
|
1370
1516
|
*/
|
|
1371
1517
|
declare function useCompany(companyId: number, enabled?: boolean): _tanstack_react_query.UseQueryResult<CompanyResponse, Error>;
|
|
1518
|
+
/**
|
|
1519
|
+
* Hook for cancelling a member's booking
|
|
1520
|
+
* @param companyId - The company ID
|
|
1521
|
+
* @param memberId - The member ID
|
|
1522
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
1523
|
+
*/
|
|
1524
|
+
declare function useCancelMemberBooking(companyId: number, memberId: number, authToken: string): _tanstack_react_query.UseMutationResult<CancelMemberBookingResponse, Error, number, unknown>;
|
|
1525
|
+
/**
|
|
1526
|
+
* Hook for rescheduling a member's booking
|
|
1527
|
+
* @param companyId - The company ID
|
|
1528
|
+
* @param memberId - The member ID
|
|
1529
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
1530
|
+
*/
|
|
1531
|
+
declare function useRescheduleBooking(companyId: number, memberId: number, authToken: string): _tanstack_react_query.UseMutationResult<RescheduleBookingResponse, Error, {
|
|
1532
|
+
bookingId: number;
|
|
1533
|
+
request: RescheduleBookingRequest;
|
|
1534
|
+
}, unknown>;
|
|
1372
1535
|
|
|
1373
1536
|
/**
|
|
1374
1537
|
* Hook for fetching client details
|
|
@@ -1406,5 +1569,11 @@ declare function useResetPassword(memberId: number, companyId: number, authToken
|
|
|
1406
1569
|
* @param enabled - Whether the query should run
|
|
1407
1570
|
*/
|
|
1408
1571
|
declare function useFindClientByEmail(companyId: number, email: string, clientToken: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<FindClientByEmailResponse, Error>;
|
|
1572
|
+
/**
|
|
1573
|
+
* Hook for sending a custom email
|
|
1574
|
+
* @param companyId - The company ID
|
|
1575
|
+
* @param clientToken - Client token for authentication
|
|
1576
|
+
*/
|
|
1577
|
+
declare function useSendCustomEmail(companyId: number, clientToken: string): _tanstack_react_query.UseMutationResult<string, Error, SendCustomEmailRequest, unknown>;
|
|
1409
1578
|
|
|
1410
|
-
export { type AddBasketItemRequest, type AddServiceItemAssets, type AddServiceItemQuestion, type AddServiceItemRequest, ApiClient, type ApiClientConfig, ApiClientProvider, type ApiError, type ApiResponse, type AvailabilityTime, type AvailabilityTimesResponse, type Booking, type BookingAnswer, BookingLabClient, BookingLabProvider, type BookingPaymentItem, type BookingSettings, type CancelBookingRequest, type CancelBookingResponse, type CheckoutBasketClient, type CheckoutBasketRequest, type CheckoutBasketResponse, type ChildCompaniesResponse, type ChildCompany, type ChildCompanyAddress, type ChildCompanySettings, type ClearBasketsResponse, type ClientDetailsQuestion, type ClientDetailsResponse, type CompanyResponse, type CompanySettings, type CreateBasketRequest, type CreateBasketResponse, type CreateBookingRequest, type CreateClientRequest, type CreateClientResponse, type DateSlot, type DatesResponse, type FindClientByEmailResponse, type ForgottenPasswordRequest, type ForgottenPasswordResponse, type GetChildCompaniesParams, type GetDatesParams, type GetMemberResponse, type GetQuestionsParams, type GetTimesParams, type JrniBooking, JrniClient, type JrniConfig, JrniProvider, type JrniService, type ListBookingsParams, type ListBookingsResponse, type Location, type LocationsResponse, type LoginRequest, type LoginResponse, type MemberBooking, type MemberBookingsResponse, MemberType, type PersonImage, type PersonImagesResponse, type Question, type QuestionOption, type QuestionsResponse, type RequestOptions, type ResetPasswordRequest, type Resource, type ResourceLinks, type ResourcesResponse, type Service, type ServiceItemResponse, type ServicesResponse, type TimeSlot, type TimesResponse, type UpdateClientAnswer, type UpdateClientAnswerEntry, type UpdateClientDetailsData, type UpdateClientExtraInfo, type UpdateClientNotificationPreferences, type UpdateClientQuestionEntry, type UpdateClientRequest, type UpdateClientResponse, type UpdateMemberDetailsData, type UpdateMemberRequest, type UpdateMemberResponse, type Vehicle, type VehiclesResponse, createBookingLabClient, createJrniClient, useAddServiceItem, useApiClientContext, useBookingLabClient, useBookingLabContext, useCancelBooking, useCheckoutBasket, useChildCompanies, useClearBaskets, useClientDetails, useCompany, useCreateBasket, useCreateClient, useDates, useFindClientByEmail, useForgottenPassword, useGetMember, useJrniClient, useJrniContext, useListBookings, useLogin, useQuestions, useResetPassword, useResources, useServices, useTimes, useUpdateClient, useUpdateMember };
|
|
1579
|
+
export { type AddBasketItemRequest, type AddServiceItemAssets, type AddServiceItemQuestion, type AddServiceItemRequest, ApiClient, type ApiClientConfig, ApiClientProvider, type ApiError, type ApiResponse, type AvailabilityTime, type AvailabilityTimesResponse, type Booking, type BookingAnswer, BookingLabClient, BookingLabProvider, type BookingPaymentItem, type BookingSettings, type CancelBookingRequest, type CancelBookingResponse, type CancelMemberBookingResponse, type CheckoutBasketClient, type CheckoutBasketRequest, type CheckoutBasketResponse, type ChildCompaniesResponse, type ChildCompany, type ChildCompanyAddress, type ChildCompanySettings, type ClearBasketsResponse, type ClientDetailsQuestion, type ClientDetailsResponse, type CompanyResponse, type CompanySettings, type CreateBasketRequest, type CreateBasketResponse, type CreateBookingRequest, type CreateClientRequest, type CreateClientResponse, type DateSlot, type DatesResponse, type FindClientByEmailResponse, type ForgottenPasswordRequest, type ForgottenPasswordResponse, type GetChildCompaniesParams, type GetDatesParams, type GetMemberResponse, type GetQuestionsParams, type GetTimesParams, type JrniBooking, JrniClient, type JrniConfig, JrniProvider, type JrniService, type ListBookingsParams, type ListBookingsResponse, type Location, type LocationsResponse, type LoginRequest, type LoginResponse, type MemberBooking, type MemberBookingsResponse, MemberType, type PersonImage, type PersonImagesResponse, type Question, type QuestionOption, type QuestionsResponse, type RequestOptions, type RescheduleBookingRequest, type RescheduleBookingResponse, type ResetPasswordRequest, type Resource, type ResourceLinks, type ResourcesResponse, type SendCustomEmailRequest, type SendCustomEmailResponse, type Service, type ServiceItemResponse, type ServicesResponse, type TimeSlot, type TimesResponse, type UpdateClientAnswer, type UpdateClientAnswerEntry, type UpdateClientDetailsData, type UpdateClientExtraInfo, type UpdateClientNotificationPreferences, type UpdateClientQuestionEntry, type UpdateClientRequest, type UpdateClientResponse, type UpdateMemberDetailsData, type UpdateMemberRequest, type UpdateMemberResponse, type Vehicle, type VehiclesResponse, createBookingLabClient, createJrniClient, useAddServiceItem, useApiClientContext, useBookingLabClient, useBookingLabContext, 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 };
|
package/dist/index.js
CHANGED
|
@@ -294,6 +294,24 @@ var BookingLabClient = class extends ApiClient {
|
|
|
294
294
|
}
|
|
295
295
|
);
|
|
296
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* Send a custom email for a booking
|
|
299
|
+
* @param companyId - The company ID
|
|
300
|
+
* @param request - Email request data
|
|
301
|
+
* @param clientToken - Client token for authentication
|
|
302
|
+
*/
|
|
303
|
+
async sendCustomEmail(companyId, request, clientToken) {
|
|
304
|
+
return this.post(
|
|
305
|
+
`/company/${companyId}/email`,
|
|
306
|
+
request,
|
|
307
|
+
{
|
|
308
|
+
headers: {
|
|
309
|
+
"x-company-id": String(companyId),
|
|
310
|
+
"clienttoken": clientToken
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
);
|
|
314
|
+
}
|
|
297
315
|
};
|
|
298
316
|
function createBookingLabClient(baseUrl, authToken) {
|
|
299
317
|
const client = new BookingLabClient({ baseUrl });
|
|
@@ -596,6 +614,44 @@ var JrniClient = class extends ApiClient {
|
|
|
596
614
|
}
|
|
597
615
|
);
|
|
598
616
|
}
|
|
617
|
+
/**
|
|
618
|
+
* Cancel a member's booking
|
|
619
|
+
* @param companyId - The company ID
|
|
620
|
+
* @param memberId - The member ID
|
|
621
|
+
* @param bookingId - The booking ID
|
|
622
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
623
|
+
*/
|
|
624
|
+
async cancelMemberBooking(companyId, memberId, bookingId, authToken) {
|
|
625
|
+
return this.delete(
|
|
626
|
+
`/${companyId}/members/${memberId}/bookings/${bookingId}`,
|
|
627
|
+
{
|
|
628
|
+
headers: {
|
|
629
|
+
...this.getDefaultHeaders(),
|
|
630
|
+
"Auth-Token": authToken
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
);
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Reschedule a member's booking
|
|
637
|
+
* @param companyId - The company ID
|
|
638
|
+
* @param memberId - The member ID
|
|
639
|
+
* @param bookingId - The booking ID
|
|
640
|
+
* @param request - The reschedule request data
|
|
641
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
642
|
+
*/
|
|
643
|
+
async rescheduleBooking(companyId, memberId, bookingId, request, authToken) {
|
|
644
|
+
return this.put(
|
|
645
|
+
`/${companyId}/members/${memberId}/bookings/${bookingId}/reschedule`,
|
|
646
|
+
request,
|
|
647
|
+
{
|
|
648
|
+
headers: {
|
|
649
|
+
...this.getDefaultHeaders(),
|
|
650
|
+
"Auth-Token": authToken
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
);
|
|
654
|
+
}
|
|
599
655
|
/**
|
|
600
656
|
* Update JRNI configuration
|
|
601
657
|
*/
|
|
@@ -891,6 +947,24 @@ function useCompany(companyId, enabled = true) {
|
|
|
891
947
|
enabled: enabled && !!companyId
|
|
892
948
|
});
|
|
893
949
|
}
|
|
950
|
+
function useCancelMemberBooking(companyId, memberId, authToken) {
|
|
951
|
+
const client = useJrniClient();
|
|
952
|
+
return reactQuery.useMutation({
|
|
953
|
+
mutationFn: async (bookingId) => {
|
|
954
|
+
const response = await client.cancelMemberBooking(companyId, memberId, bookingId, authToken);
|
|
955
|
+
return response.data;
|
|
956
|
+
}
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
function useRescheduleBooking(companyId, memberId, authToken) {
|
|
960
|
+
const client = useJrniClient();
|
|
961
|
+
return reactQuery.useMutation({
|
|
962
|
+
mutationFn: async ({ bookingId, request }) => {
|
|
963
|
+
const response = await client.rescheduleBooking(companyId, memberId, bookingId, request, authToken);
|
|
964
|
+
return response.data;
|
|
965
|
+
}
|
|
966
|
+
});
|
|
967
|
+
}
|
|
894
968
|
function useClientDetails(companyId, clientToken, enabled = true) {
|
|
895
969
|
const client = useBookingLabClient();
|
|
896
970
|
return reactQuery.useQuery({
|
|
@@ -940,6 +1014,15 @@ function useFindClientByEmail(companyId, email, clientToken, enabled = true) {
|
|
|
940
1014
|
enabled: enabled && !!companyId && !!email && !!clientToken
|
|
941
1015
|
});
|
|
942
1016
|
}
|
|
1017
|
+
function useSendCustomEmail(companyId, clientToken) {
|
|
1018
|
+
const client = useBookingLabClient();
|
|
1019
|
+
return reactQuery.useMutation({
|
|
1020
|
+
mutationFn: async (request) => {
|
|
1021
|
+
const response = await client.sendCustomEmail(companyId, request, clientToken);
|
|
1022
|
+
return response.data;
|
|
1023
|
+
}
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
943
1026
|
|
|
944
1027
|
exports.ApiClient = ApiClient;
|
|
945
1028
|
exports.ApiClientProvider = ApiClientProvider;
|
|
@@ -955,6 +1038,7 @@ exports.useApiClientContext = useApiClientContext;
|
|
|
955
1038
|
exports.useBookingLabClient = useBookingLabClient;
|
|
956
1039
|
exports.useBookingLabContext = useBookingLabContext;
|
|
957
1040
|
exports.useCancelBooking = useCancelBooking;
|
|
1041
|
+
exports.useCancelMemberBooking = useCancelMemberBooking;
|
|
958
1042
|
exports.useCheckoutBasket = useCheckoutBasket;
|
|
959
1043
|
exports.useChildCompanies = useChildCompanies;
|
|
960
1044
|
exports.useClearBaskets = useClearBaskets;
|
|
@@ -971,8 +1055,10 @@ exports.useJrniContext = useJrniContext;
|
|
|
971
1055
|
exports.useListBookings = useListBookings;
|
|
972
1056
|
exports.useLogin = useLogin;
|
|
973
1057
|
exports.useQuestions = useQuestions;
|
|
1058
|
+
exports.useRescheduleBooking = useRescheduleBooking;
|
|
974
1059
|
exports.useResetPassword = useResetPassword;
|
|
975
1060
|
exports.useResources = useResources;
|
|
1061
|
+
exports.useSendCustomEmail = useSendCustomEmail;
|
|
976
1062
|
exports.useServices = useServices;
|
|
977
1063
|
exports.useTimes = useTimes;
|
|
978
1064
|
exports.useUpdateClient = useUpdateClient;
|