@bookinglab/booking-journey-api 2.2.0 → 2.5.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 +33 -0
- package/dist/index.d.cts +200 -1
- package/dist/index.d.ts +200 -1
- package/dist/index.js +84 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +82 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -199,6 +199,10 @@ const client = createJrniClient('https://api.jrni.com', {
|
|
|
199
199
|
- `client.getDates(companyId, params)` - Get available booking dates for a service
|
|
200
200
|
- `client.updateClient(companyId, clientId, request, authToken)` - Update a client's details
|
|
201
201
|
- `client.updateMember(companyId, memberId, request, authToken)` - Update a member's details
|
|
202
|
+
- `client.getCompany(companyId)` - Get a company by ID
|
|
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
|
|
202
206
|
- `client.setAuthToken(token)` - Set auth token for subsequent requests
|
|
203
207
|
|
|
204
208
|
#### `createBookingLabClient(options)`
|
|
@@ -284,6 +288,10 @@ Combined provider for applications using multiple API clients.
|
|
|
284
288
|
- `useListBookings(companyId, memberId, params, authToken, enabled?)` - Get member bookings
|
|
285
289
|
- `useUpdateClient(companyId, clientId, authToken)` - Update a client's details
|
|
286
290
|
- `useUpdateMember(companyId, memberId, authToken)` - Update a member's details
|
|
291
|
+
- `useCompany(companyId, enabled?)` - Get a company by ID
|
|
292
|
+
- `useGetMember(companyId, memberId, authToken, enabled?)` - Get a member by ID
|
|
293
|
+
- `useCancelMemberBooking(companyId, memberId, authToken)` - Cancel a member's booking
|
|
294
|
+
- `useRescheduleBooking(companyId, memberId, authToken)` - Reschedule a member's booking
|
|
287
295
|
- `useJrniClient()` - Access the JRNI client directly
|
|
288
296
|
|
|
289
297
|
```typescript
|
|
@@ -363,6 +371,25 @@ updateClientMutation.mutate({
|
|
|
363
371
|
const updateMemberMutation = useUpdateMember(37001, 19, 'user-auth-token');
|
|
364
372
|
updateMemberMutation.mutate({ first_name: 'Jane', last_name: 'Smith' });
|
|
365
373
|
|
|
374
|
+
// Get a company by ID
|
|
375
|
+
const { data: company } = useCompany(37001);
|
|
376
|
+
// company = { id: 37001, name: "Sports Pitch Booking Service", currency_code: "GBP", timezone: "Europe/London", children_count: 20, ... }
|
|
377
|
+
|
|
378
|
+
// Get a member by ID (requires auth token)
|
|
379
|
+
const { data: member } = useGetMember(37001, 19, 'user-auth-token');
|
|
380
|
+
// member = { id: 19, name: "John Doe", email: "john@example.com", ... }
|
|
381
|
+
|
|
382
|
+
// Cancel a member's booking
|
|
383
|
+
const cancelMemberBookingMutation = useCancelMemberBooking(37001, 2, 'user-auth-token');
|
|
384
|
+
cancelMemberBookingMutation.mutate(29); // bookingId
|
|
385
|
+
|
|
386
|
+
// Reschedule a member's booking
|
|
387
|
+
const rescheduleMutation = useRescheduleBooking(37001, 2, 'user-auth-token');
|
|
388
|
+
rescheduleMutation.mutate({
|
|
389
|
+
bookingId: 29,
|
|
390
|
+
request: { date: '2026-03-03', time: '10:00', duration: 60, notify: true, notify_admin: true }
|
|
391
|
+
});
|
|
392
|
+
|
|
366
393
|
const client = useJrniClient();
|
|
367
394
|
```
|
|
368
395
|
|
|
@@ -455,6 +482,12 @@ import type {
|
|
|
455
482
|
UpdateMemberRequest,
|
|
456
483
|
UpdateMemberResponse,
|
|
457
484
|
MemberType,
|
|
485
|
+
CompanyResponse,
|
|
486
|
+
CompanySettings,
|
|
487
|
+
GetMemberResponse,
|
|
488
|
+
CancelMemberBookingResponse,
|
|
489
|
+
RescheduleBookingRequest,
|
|
490
|
+
RescheduleBookingResponse,
|
|
458
491
|
// BookingLab Types
|
|
459
492
|
Booking,
|
|
460
493
|
CreateBookingRequest,
|
package/dist/index.d.cts
CHANGED
|
@@ -903,6 +903,160 @@ interface FindClientByEmailResponse {
|
|
|
903
903
|
detail?: string;
|
|
904
904
|
[key: string]: any;
|
|
905
905
|
}
|
|
906
|
+
/**
|
|
907
|
+
* Company Response Types
|
|
908
|
+
*/
|
|
909
|
+
interface CompanySettings {
|
|
910
|
+
has_services: boolean;
|
|
911
|
+
has_resources: boolean;
|
|
912
|
+
has_groups: boolean;
|
|
913
|
+
payment_tax: number;
|
|
914
|
+
currency: string;
|
|
915
|
+
requires_login: boolean;
|
|
916
|
+
has_wallets: boolean;
|
|
917
|
+
has_question_groups: boolean;
|
|
918
|
+
_links: Record<string, any>;
|
|
919
|
+
}
|
|
920
|
+
interface CompanyResponse {
|
|
921
|
+
id: number;
|
|
922
|
+
name: string;
|
|
923
|
+
description: string;
|
|
924
|
+
company_type: string;
|
|
925
|
+
extra: Record<string, any>;
|
|
926
|
+
address_id: number;
|
|
927
|
+
website: string;
|
|
928
|
+
multi_status: string[];
|
|
929
|
+
numeric_widget_id: number;
|
|
930
|
+
currency_code: string;
|
|
931
|
+
timezone: string;
|
|
932
|
+
country_code: string;
|
|
933
|
+
live: boolean;
|
|
934
|
+
ref: string;
|
|
935
|
+
created_at: string;
|
|
936
|
+
updated_at: string;
|
|
937
|
+
children_count: number;
|
|
938
|
+
locale: string;
|
|
939
|
+
available_locales: string[];
|
|
940
|
+
membership_id: number;
|
|
941
|
+
_embedded: {
|
|
942
|
+
settings: CompanySettings;
|
|
943
|
+
};
|
|
944
|
+
_links: Record<string, any>;
|
|
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
|
+
}
|
|
906
1060
|
|
|
907
1061
|
/**
|
|
908
1062
|
* Core API Client
|
|
@@ -1144,6 +1298,28 @@ declare class JrniClient extends ApiClient {
|
|
|
1144
1298
|
* @param authToken - Auth token for authenticated requests (required)
|
|
1145
1299
|
*/
|
|
1146
1300
|
getMember(companyId: number, memberId: number, authToken: string): Promise<ApiResponse<GetMemberResponse>>;
|
|
1301
|
+
/**
|
|
1302
|
+
* Get a company by ID
|
|
1303
|
+
* @param companyId - The company ID
|
|
1304
|
+
*/
|
|
1305
|
+
getCompany(companyId: number): Promise<ApiResponse<CompanyResponse>>;
|
|
1306
|
+
/**
|
|
1307
|
+
* Cancel a member's booking
|
|
1308
|
+
* @param companyId - The company ID
|
|
1309
|
+
* @param memberId - The member ID
|
|
1310
|
+
* @param bookingId - The booking ID
|
|
1311
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
1312
|
+
*/
|
|
1313
|
+
cancelMemberBooking(companyId: number, memberId: number, bookingId: number, authToken: string): Promise<ApiResponse<CancelMemberBookingResponse>>;
|
|
1314
|
+
/**
|
|
1315
|
+
* Reschedule a member's booking
|
|
1316
|
+
* @param companyId - The company ID
|
|
1317
|
+
* @param memberId - The member ID
|
|
1318
|
+
* @param bookingId - The booking ID
|
|
1319
|
+
* @param request - The reschedule request data
|
|
1320
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
1321
|
+
*/
|
|
1322
|
+
rescheduleBooking(companyId: number, memberId: number, bookingId: number, request: RescheduleBookingRequest, authToken: string): Promise<ApiResponse<RescheduleBookingResponse>>;
|
|
1147
1323
|
/**
|
|
1148
1324
|
* Update JRNI configuration
|
|
1149
1325
|
*/
|
|
@@ -1318,6 +1494,29 @@ declare function useUpdateMember(companyId: number, memberId: number, authToken:
|
|
|
1318
1494
|
* @param enabled - Whether the query should run
|
|
1319
1495
|
*/
|
|
1320
1496
|
declare function useGetMember(companyId: number, memberId: number, authToken: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<GetMemberResponse, Error>;
|
|
1497
|
+
/**
|
|
1498
|
+
* Hook for fetching a company by ID
|
|
1499
|
+
* @param companyId - The company ID
|
|
1500
|
+
* @param enabled - Whether the query should run
|
|
1501
|
+
*/
|
|
1502
|
+
declare function useCompany(companyId: number, enabled?: boolean): _tanstack_react_query.UseQueryResult<CompanyResponse, Error>;
|
|
1503
|
+
/**
|
|
1504
|
+
* Hook for cancelling a member's booking
|
|
1505
|
+
* @param companyId - The company ID
|
|
1506
|
+
* @param memberId - The member ID
|
|
1507
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
1508
|
+
*/
|
|
1509
|
+
declare function useCancelMemberBooking(companyId: number, memberId: number, authToken: string): _tanstack_react_query.UseMutationResult<CancelMemberBookingResponse, Error, number, unknown>;
|
|
1510
|
+
/**
|
|
1511
|
+
* Hook for rescheduling a member's booking
|
|
1512
|
+
* @param companyId - The company ID
|
|
1513
|
+
* @param memberId - The member ID
|
|
1514
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
1515
|
+
*/
|
|
1516
|
+
declare function useRescheduleBooking(companyId: number, memberId: number, authToken: string): _tanstack_react_query.UseMutationResult<RescheduleBookingResponse, Error, {
|
|
1517
|
+
bookingId: number;
|
|
1518
|
+
request: RescheduleBookingRequest;
|
|
1519
|
+
}, unknown>;
|
|
1321
1520
|
|
|
1322
1521
|
/**
|
|
1323
1522
|
* Hook for fetching client details
|
|
@@ -1356,4 +1555,4 @@ declare function useResetPassword(memberId: number, companyId: number, authToken
|
|
|
1356
1555
|
*/
|
|
1357
1556
|
declare function useFindClientByEmail(companyId: number, email: string, clientToken: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<FindClientByEmailResponse, Error>;
|
|
1358
1557
|
|
|
1359
|
-
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 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, useCreateBasket, useCreateClient, useDates, useFindClientByEmail, useForgottenPassword, useGetMember, useJrniClient, useJrniContext, useListBookings, useLogin, useQuestions, useResetPassword, useResources, useServices, useTimes, useUpdateClient, useUpdateMember };
|
|
1558
|
+
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 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, useServices, useTimes, useUpdateClient, useUpdateMember };
|
package/dist/index.d.ts
CHANGED
|
@@ -903,6 +903,160 @@ interface FindClientByEmailResponse {
|
|
|
903
903
|
detail?: string;
|
|
904
904
|
[key: string]: any;
|
|
905
905
|
}
|
|
906
|
+
/**
|
|
907
|
+
* Company Response Types
|
|
908
|
+
*/
|
|
909
|
+
interface CompanySettings {
|
|
910
|
+
has_services: boolean;
|
|
911
|
+
has_resources: boolean;
|
|
912
|
+
has_groups: boolean;
|
|
913
|
+
payment_tax: number;
|
|
914
|
+
currency: string;
|
|
915
|
+
requires_login: boolean;
|
|
916
|
+
has_wallets: boolean;
|
|
917
|
+
has_question_groups: boolean;
|
|
918
|
+
_links: Record<string, any>;
|
|
919
|
+
}
|
|
920
|
+
interface CompanyResponse {
|
|
921
|
+
id: number;
|
|
922
|
+
name: string;
|
|
923
|
+
description: string;
|
|
924
|
+
company_type: string;
|
|
925
|
+
extra: Record<string, any>;
|
|
926
|
+
address_id: number;
|
|
927
|
+
website: string;
|
|
928
|
+
multi_status: string[];
|
|
929
|
+
numeric_widget_id: number;
|
|
930
|
+
currency_code: string;
|
|
931
|
+
timezone: string;
|
|
932
|
+
country_code: string;
|
|
933
|
+
live: boolean;
|
|
934
|
+
ref: string;
|
|
935
|
+
created_at: string;
|
|
936
|
+
updated_at: string;
|
|
937
|
+
children_count: number;
|
|
938
|
+
locale: string;
|
|
939
|
+
available_locales: string[];
|
|
940
|
+
membership_id: number;
|
|
941
|
+
_embedded: {
|
|
942
|
+
settings: CompanySettings;
|
|
943
|
+
};
|
|
944
|
+
_links: Record<string, any>;
|
|
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
|
+
}
|
|
906
1060
|
|
|
907
1061
|
/**
|
|
908
1062
|
* Core API Client
|
|
@@ -1144,6 +1298,28 @@ declare class JrniClient extends ApiClient {
|
|
|
1144
1298
|
* @param authToken - Auth token for authenticated requests (required)
|
|
1145
1299
|
*/
|
|
1146
1300
|
getMember(companyId: number, memberId: number, authToken: string): Promise<ApiResponse<GetMemberResponse>>;
|
|
1301
|
+
/**
|
|
1302
|
+
* Get a company by ID
|
|
1303
|
+
* @param companyId - The company ID
|
|
1304
|
+
*/
|
|
1305
|
+
getCompany(companyId: number): Promise<ApiResponse<CompanyResponse>>;
|
|
1306
|
+
/**
|
|
1307
|
+
* Cancel a member's booking
|
|
1308
|
+
* @param companyId - The company ID
|
|
1309
|
+
* @param memberId - The member ID
|
|
1310
|
+
* @param bookingId - The booking ID
|
|
1311
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
1312
|
+
*/
|
|
1313
|
+
cancelMemberBooking(companyId: number, memberId: number, bookingId: number, authToken: string): Promise<ApiResponse<CancelMemberBookingResponse>>;
|
|
1314
|
+
/**
|
|
1315
|
+
* Reschedule a member's booking
|
|
1316
|
+
* @param companyId - The company ID
|
|
1317
|
+
* @param memberId - The member ID
|
|
1318
|
+
* @param bookingId - The booking ID
|
|
1319
|
+
* @param request - The reschedule request data
|
|
1320
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
1321
|
+
*/
|
|
1322
|
+
rescheduleBooking(companyId: number, memberId: number, bookingId: number, request: RescheduleBookingRequest, authToken: string): Promise<ApiResponse<RescheduleBookingResponse>>;
|
|
1147
1323
|
/**
|
|
1148
1324
|
* Update JRNI configuration
|
|
1149
1325
|
*/
|
|
@@ -1318,6 +1494,29 @@ declare function useUpdateMember(companyId: number, memberId: number, authToken:
|
|
|
1318
1494
|
* @param enabled - Whether the query should run
|
|
1319
1495
|
*/
|
|
1320
1496
|
declare function useGetMember(companyId: number, memberId: number, authToken: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<GetMemberResponse, Error>;
|
|
1497
|
+
/**
|
|
1498
|
+
* Hook for fetching a company by ID
|
|
1499
|
+
* @param companyId - The company ID
|
|
1500
|
+
* @param enabled - Whether the query should run
|
|
1501
|
+
*/
|
|
1502
|
+
declare function useCompany(companyId: number, enabled?: boolean): _tanstack_react_query.UseQueryResult<CompanyResponse, Error>;
|
|
1503
|
+
/**
|
|
1504
|
+
* Hook for cancelling a member's booking
|
|
1505
|
+
* @param companyId - The company ID
|
|
1506
|
+
* @param memberId - The member ID
|
|
1507
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
1508
|
+
*/
|
|
1509
|
+
declare function useCancelMemberBooking(companyId: number, memberId: number, authToken: string): _tanstack_react_query.UseMutationResult<CancelMemberBookingResponse, Error, number, unknown>;
|
|
1510
|
+
/**
|
|
1511
|
+
* Hook for rescheduling a member's booking
|
|
1512
|
+
* @param companyId - The company ID
|
|
1513
|
+
* @param memberId - The member ID
|
|
1514
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
1515
|
+
*/
|
|
1516
|
+
declare function useRescheduleBooking(companyId: number, memberId: number, authToken: string): _tanstack_react_query.UseMutationResult<RescheduleBookingResponse, Error, {
|
|
1517
|
+
bookingId: number;
|
|
1518
|
+
request: RescheduleBookingRequest;
|
|
1519
|
+
}, unknown>;
|
|
1321
1520
|
|
|
1322
1521
|
/**
|
|
1323
1522
|
* Hook for fetching client details
|
|
@@ -1356,4 +1555,4 @@ declare function useResetPassword(memberId: number, companyId: number, authToken
|
|
|
1356
1555
|
*/
|
|
1357
1556
|
declare function useFindClientByEmail(companyId: number, email: string, clientToken: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<FindClientByEmailResponse, Error>;
|
|
1358
1557
|
|
|
1359
|
-
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 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, useCreateBasket, useCreateClient, useDates, useFindClientByEmail, useForgottenPassword, useGetMember, useJrniClient, useJrniContext, useListBookings, useLogin, useQuestions, useResetPassword, useResources, useServices, useTimes, useUpdateClient, useUpdateMember };
|
|
1558
|
+
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 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, useServices, useTimes, useUpdateClient, useUpdateMember };
|
package/dist/index.js
CHANGED
|
@@ -582,6 +582,58 @@ var JrniClient = class extends ApiClient {
|
|
|
582
582
|
}
|
|
583
583
|
);
|
|
584
584
|
}
|
|
585
|
+
/**
|
|
586
|
+
* Get a company by ID
|
|
587
|
+
* @param companyId - The company ID
|
|
588
|
+
*/
|
|
589
|
+
async getCompany(companyId) {
|
|
590
|
+
return this.get(
|
|
591
|
+
`/company/${companyId}`,
|
|
592
|
+
{
|
|
593
|
+
headers: {
|
|
594
|
+
...this.getDefaultHeaders()
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Cancel a member's booking
|
|
601
|
+
* @param companyId - The company ID
|
|
602
|
+
* @param memberId - The member ID
|
|
603
|
+
* @param bookingId - The booking ID
|
|
604
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
605
|
+
*/
|
|
606
|
+
async cancelMemberBooking(companyId, memberId, bookingId, authToken) {
|
|
607
|
+
return this.delete(
|
|
608
|
+
`/${companyId}/members/${memberId}/bookings/${bookingId}`,
|
|
609
|
+
{
|
|
610
|
+
headers: {
|
|
611
|
+
...this.getDefaultHeaders(),
|
|
612
|
+
"Auth-Token": authToken
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
);
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Reschedule a member's booking
|
|
619
|
+
* @param companyId - The company ID
|
|
620
|
+
* @param memberId - The member ID
|
|
621
|
+
* @param bookingId - The booking ID
|
|
622
|
+
* @param request - The reschedule request data
|
|
623
|
+
* @param authToken - Auth token for authenticated requests (required)
|
|
624
|
+
*/
|
|
625
|
+
async rescheduleBooking(companyId, memberId, bookingId, request, authToken) {
|
|
626
|
+
return this.put(
|
|
627
|
+
`/${companyId}/members/${memberId}/bookings/${bookingId}/reschedule`,
|
|
628
|
+
request,
|
|
629
|
+
{
|
|
630
|
+
headers: {
|
|
631
|
+
...this.getDefaultHeaders(),
|
|
632
|
+
"Auth-Token": authToken
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
);
|
|
636
|
+
}
|
|
585
637
|
/**
|
|
586
638
|
* Update JRNI configuration
|
|
587
639
|
*/
|
|
@@ -866,6 +918,35 @@ function useGetMember(companyId, memberId, authToken, enabled = true) {
|
|
|
866
918
|
enabled: enabled && !!companyId && !!memberId && !!authToken
|
|
867
919
|
});
|
|
868
920
|
}
|
|
921
|
+
function useCompany(companyId, enabled = true) {
|
|
922
|
+
const client = useJrniClient();
|
|
923
|
+
return reactQuery.useQuery({
|
|
924
|
+
queryKey: ["company", companyId],
|
|
925
|
+
queryFn: async () => {
|
|
926
|
+
const response = await client.getCompany(companyId);
|
|
927
|
+
return response.data;
|
|
928
|
+
},
|
|
929
|
+
enabled: enabled && !!companyId
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
function useCancelMemberBooking(companyId, memberId, authToken) {
|
|
933
|
+
const client = useJrniClient();
|
|
934
|
+
return reactQuery.useMutation({
|
|
935
|
+
mutationFn: async (bookingId) => {
|
|
936
|
+
const response = await client.cancelMemberBooking(companyId, memberId, bookingId, authToken);
|
|
937
|
+
return response.data;
|
|
938
|
+
}
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
function useRescheduleBooking(companyId, memberId, authToken) {
|
|
942
|
+
const client = useJrniClient();
|
|
943
|
+
return reactQuery.useMutation({
|
|
944
|
+
mutationFn: async ({ bookingId, request }) => {
|
|
945
|
+
const response = await client.rescheduleBooking(companyId, memberId, bookingId, request, authToken);
|
|
946
|
+
return response.data;
|
|
947
|
+
}
|
|
948
|
+
});
|
|
949
|
+
}
|
|
869
950
|
function useClientDetails(companyId, clientToken, enabled = true) {
|
|
870
951
|
const client = useBookingLabClient();
|
|
871
952
|
return reactQuery.useQuery({
|
|
@@ -930,10 +1011,12 @@ exports.useApiClientContext = useApiClientContext;
|
|
|
930
1011
|
exports.useBookingLabClient = useBookingLabClient;
|
|
931
1012
|
exports.useBookingLabContext = useBookingLabContext;
|
|
932
1013
|
exports.useCancelBooking = useCancelBooking;
|
|
1014
|
+
exports.useCancelMemberBooking = useCancelMemberBooking;
|
|
933
1015
|
exports.useCheckoutBasket = useCheckoutBasket;
|
|
934
1016
|
exports.useChildCompanies = useChildCompanies;
|
|
935
1017
|
exports.useClearBaskets = useClearBaskets;
|
|
936
1018
|
exports.useClientDetails = useClientDetails;
|
|
1019
|
+
exports.useCompany = useCompany;
|
|
937
1020
|
exports.useCreateBasket = useCreateBasket;
|
|
938
1021
|
exports.useCreateClient = useCreateClient;
|
|
939
1022
|
exports.useDates = useDates;
|
|
@@ -945,6 +1028,7 @@ exports.useJrniContext = useJrniContext;
|
|
|
945
1028
|
exports.useListBookings = useListBookings;
|
|
946
1029
|
exports.useLogin = useLogin;
|
|
947
1030
|
exports.useQuestions = useQuestions;
|
|
1031
|
+
exports.useRescheduleBooking = useRescheduleBooking;
|
|
948
1032
|
exports.useResetPassword = useResetPassword;
|
|
949
1033
|
exports.useResources = useResources;
|
|
950
1034
|
exports.useServices = useServices;
|