@bookinglab/booking-journey-api 2.1.0 → 2.3.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 +15 -0
- package/dist/index.d.cts +76 -1
- package/dist/index.d.ts +76 -1
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -199,6 +199,8 @@ 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
|
|
202
204
|
- `client.setAuthToken(token)` - Set auth token for subsequent requests
|
|
203
205
|
|
|
204
206
|
#### `createBookingLabClient(options)`
|
|
@@ -284,6 +286,8 @@ Combined provider for applications using multiple API clients.
|
|
|
284
286
|
- `useListBookings(companyId, memberId, params, authToken, enabled?)` - Get member bookings
|
|
285
287
|
- `useUpdateClient(companyId, clientId, authToken)` - Update a client's details
|
|
286
288
|
- `useUpdateMember(companyId, memberId, authToken)` - Update a member's details
|
|
289
|
+
- `useCompany(companyId, enabled?)` - Get a company by ID
|
|
290
|
+
- `useGetMember(companyId, memberId, authToken, enabled?)` - Get a member by ID
|
|
287
291
|
- `useJrniClient()` - Access the JRNI client directly
|
|
288
292
|
|
|
289
293
|
```typescript
|
|
@@ -363,6 +367,14 @@ updateClientMutation.mutate({
|
|
|
363
367
|
const updateMemberMutation = useUpdateMember(37001, 19, 'user-auth-token');
|
|
364
368
|
updateMemberMutation.mutate({ first_name: 'Jane', last_name: 'Smith' });
|
|
365
369
|
|
|
370
|
+
// Get a company by ID
|
|
371
|
+
const { data: company } = useCompany(37001);
|
|
372
|
+
// company = { id: 37001, name: "Sports Pitch Booking Service", currency_code: "GBP", timezone: "Europe/London", children_count: 20, ... }
|
|
373
|
+
|
|
374
|
+
// Get a member by ID (requires auth token)
|
|
375
|
+
const { data: member } = useGetMember(37001, 19, 'user-auth-token');
|
|
376
|
+
// member = { id: 19, name: "John Doe", email: "john@example.com", ... }
|
|
377
|
+
|
|
366
378
|
const client = useJrniClient();
|
|
367
379
|
```
|
|
368
380
|
|
|
@@ -455,6 +467,9 @@ import type {
|
|
|
455
467
|
UpdateMemberRequest,
|
|
456
468
|
UpdateMemberResponse,
|
|
457
469
|
MemberType,
|
|
470
|
+
CompanyResponse,
|
|
471
|
+
CompanySettings,
|
|
472
|
+
GetMemberResponse,
|
|
458
473
|
// BookingLab Types
|
|
459
474
|
Booking,
|
|
460
475
|
CreateBookingRequest,
|
package/dist/index.d.cts
CHANGED
|
@@ -894,6 +894,55 @@ interface ResetPasswordRequest {
|
|
|
894
894
|
confirm_new_password: string;
|
|
895
895
|
current_password: string;
|
|
896
896
|
}
|
|
897
|
+
/**
|
|
898
|
+
* Find Client By Email Types
|
|
899
|
+
*/
|
|
900
|
+
interface FindClientByEmailResponse {
|
|
901
|
+
title?: string;
|
|
902
|
+
type?: string;
|
|
903
|
+
detail?: string;
|
|
904
|
+
[key: string]: any;
|
|
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
|
+
}
|
|
897
946
|
|
|
898
947
|
/**
|
|
899
948
|
* Core API Client
|
|
@@ -1010,6 +1059,13 @@ declare class BookingLabClient extends ApiClient {
|
|
|
1010
1059
|
* @param clientToken - Client token for authentication
|
|
1011
1060
|
*/
|
|
1012
1061
|
resetPassword(memberId: number, companyId: number, request: ResetPasswordRequest, authToken: string, clientToken: string): Promise<ApiResponse<LoginResponse>>;
|
|
1062
|
+
/**
|
|
1063
|
+
* Find a client by email address
|
|
1064
|
+
* @param companyId - The company ID
|
|
1065
|
+
* @param email - The email address to search for
|
|
1066
|
+
* @param clientToken - Client token for authentication
|
|
1067
|
+
*/
|
|
1068
|
+
findClientByEmail(companyId: number, email: string, clientToken: string): Promise<ApiResponse<FindClientByEmailResponse>>;
|
|
1013
1069
|
}
|
|
1014
1070
|
/**
|
|
1015
1071
|
* Create a new BookingLab client instance
|
|
@@ -1128,6 +1184,11 @@ declare class JrniClient extends ApiClient {
|
|
|
1128
1184
|
* @param authToken - Auth token for authenticated requests (required)
|
|
1129
1185
|
*/
|
|
1130
1186
|
getMember(companyId: number, memberId: number, authToken: string): Promise<ApiResponse<GetMemberResponse>>;
|
|
1187
|
+
/**
|
|
1188
|
+
* Get a company by ID
|
|
1189
|
+
* @param companyId - The company ID
|
|
1190
|
+
*/
|
|
1191
|
+
getCompany(companyId: number): Promise<ApiResponse<CompanyResponse>>;
|
|
1131
1192
|
/**
|
|
1132
1193
|
* Update JRNI configuration
|
|
1133
1194
|
*/
|
|
@@ -1302,6 +1363,12 @@ declare function useUpdateMember(companyId: number, memberId: number, authToken:
|
|
|
1302
1363
|
* @param enabled - Whether the query should run
|
|
1303
1364
|
*/
|
|
1304
1365
|
declare function useGetMember(companyId: number, memberId: number, authToken: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<GetMemberResponse, Error>;
|
|
1366
|
+
/**
|
|
1367
|
+
* Hook for fetching a company by ID
|
|
1368
|
+
* @param companyId - The company ID
|
|
1369
|
+
* @param enabled - Whether the query should run
|
|
1370
|
+
*/
|
|
1371
|
+
declare function useCompany(companyId: number, enabled?: boolean): _tanstack_react_query.UseQueryResult<CompanyResponse, Error>;
|
|
1305
1372
|
|
|
1306
1373
|
/**
|
|
1307
1374
|
* Hook for fetching client details
|
|
@@ -1331,5 +1398,13 @@ declare function useCancelBooking(companyId: number, bookingId: number, clientTo
|
|
|
1331
1398
|
* @param clientToken - Client token for authentication
|
|
1332
1399
|
*/
|
|
1333
1400
|
declare function useResetPassword(memberId: number, companyId: number, authToken: string, clientToken: string): _tanstack_react_query.UseMutationResult<LoginResponse, Error, ResetPasswordRequest, unknown>;
|
|
1401
|
+
/**
|
|
1402
|
+
* Hook for finding a client by email address
|
|
1403
|
+
* @param companyId - The company ID
|
|
1404
|
+
* @param email - The email address to search for
|
|
1405
|
+
* @param clientToken - Client token for authentication
|
|
1406
|
+
* @param enabled - Whether the query should run
|
|
1407
|
+
*/
|
|
1408
|
+
declare function useFindClientByEmail(companyId: number, email: string, clientToken: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<FindClientByEmailResponse, Error>;
|
|
1334
1409
|
|
|
1335
|
-
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 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, useForgottenPassword, useGetMember, useJrniClient, useJrniContext, useListBookings, useLogin, useQuestions, useResetPassword, useResources, useServices, useTimes, useUpdateClient, useUpdateMember };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -894,6 +894,55 @@ interface ResetPasswordRequest {
|
|
|
894
894
|
confirm_new_password: string;
|
|
895
895
|
current_password: string;
|
|
896
896
|
}
|
|
897
|
+
/**
|
|
898
|
+
* Find Client By Email Types
|
|
899
|
+
*/
|
|
900
|
+
interface FindClientByEmailResponse {
|
|
901
|
+
title?: string;
|
|
902
|
+
type?: string;
|
|
903
|
+
detail?: string;
|
|
904
|
+
[key: string]: any;
|
|
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
|
+
}
|
|
897
946
|
|
|
898
947
|
/**
|
|
899
948
|
* Core API Client
|
|
@@ -1010,6 +1059,13 @@ declare class BookingLabClient extends ApiClient {
|
|
|
1010
1059
|
* @param clientToken - Client token for authentication
|
|
1011
1060
|
*/
|
|
1012
1061
|
resetPassword(memberId: number, companyId: number, request: ResetPasswordRequest, authToken: string, clientToken: string): Promise<ApiResponse<LoginResponse>>;
|
|
1062
|
+
/**
|
|
1063
|
+
* Find a client by email address
|
|
1064
|
+
* @param companyId - The company ID
|
|
1065
|
+
* @param email - The email address to search for
|
|
1066
|
+
* @param clientToken - Client token for authentication
|
|
1067
|
+
*/
|
|
1068
|
+
findClientByEmail(companyId: number, email: string, clientToken: string): Promise<ApiResponse<FindClientByEmailResponse>>;
|
|
1013
1069
|
}
|
|
1014
1070
|
/**
|
|
1015
1071
|
* Create a new BookingLab client instance
|
|
@@ -1128,6 +1184,11 @@ declare class JrniClient extends ApiClient {
|
|
|
1128
1184
|
* @param authToken - Auth token for authenticated requests (required)
|
|
1129
1185
|
*/
|
|
1130
1186
|
getMember(companyId: number, memberId: number, authToken: string): Promise<ApiResponse<GetMemberResponse>>;
|
|
1187
|
+
/**
|
|
1188
|
+
* Get a company by ID
|
|
1189
|
+
* @param companyId - The company ID
|
|
1190
|
+
*/
|
|
1191
|
+
getCompany(companyId: number): Promise<ApiResponse<CompanyResponse>>;
|
|
1131
1192
|
/**
|
|
1132
1193
|
* Update JRNI configuration
|
|
1133
1194
|
*/
|
|
@@ -1302,6 +1363,12 @@ declare function useUpdateMember(companyId: number, memberId: number, authToken:
|
|
|
1302
1363
|
* @param enabled - Whether the query should run
|
|
1303
1364
|
*/
|
|
1304
1365
|
declare function useGetMember(companyId: number, memberId: number, authToken: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<GetMemberResponse, Error>;
|
|
1366
|
+
/**
|
|
1367
|
+
* Hook for fetching a company by ID
|
|
1368
|
+
* @param companyId - The company ID
|
|
1369
|
+
* @param enabled - Whether the query should run
|
|
1370
|
+
*/
|
|
1371
|
+
declare function useCompany(companyId: number, enabled?: boolean): _tanstack_react_query.UseQueryResult<CompanyResponse, Error>;
|
|
1305
1372
|
|
|
1306
1373
|
/**
|
|
1307
1374
|
* Hook for fetching client details
|
|
@@ -1331,5 +1398,13 @@ declare function useCancelBooking(companyId: number, bookingId: number, clientTo
|
|
|
1331
1398
|
* @param clientToken - Client token for authentication
|
|
1332
1399
|
*/
|
|
1333
1400
|
declare function useResetPassword(memberId: number, companyId: number, authToken: string, clientToken: string): _tanstack_react_query.UseMutationResult<LoginResponse, Error, ResetPasswordRequest, unknown>;
|
|
1401
|
+
/**
|
|
1402
|
+
* Hook for finding a client by email address
|
|
1403
|
+
* @param companyId - The company ID
|
|
1404
|
+
* @param email - The email address to search for
|
|
1405
|
+
* @param clientToken - Client token for authentication
|
|
1406
|
+
* @param enabled - Whether the query should run
|
|
1407
|
+
*/
|
|
1408
|
+
declare function useFindClientByEmail(companyId: number, email: string, clientToken: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<FindClientByEmailResponse, Error>;
|
|
1334
1409
|
|
|
1335
|
-
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 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, useForgottenPassword, useGetMember, useJrniClient, useJrniContext, useListBookings, useLogin, useQuestions, useResetPassword, useResources, useServices, useTimes, useUpdateClient, useUpdateMember };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -278,6 +278,22 @@ var BookingLabClient = class extends ApiClient {
|
|
|
278
278
|
}
|
|
279
279
|
);
|
|
280
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* Find a client by email address
|
|
283
|
+
* @param companyId - The company ID
|
|
284
|
+
* @param email - The email address to search for
|
|
285
|
+
* @param clientToken - Client token for authentication
|
|
286
|
+
*/
|
|
287
|
+
async findClientByEmail(companyId, email, clientToken) {
|
|
288
|
+
return this.get(
|
|
289
|
+
`/company/${companyId}/client/email/${encodeURIComponent(email)}`,
|
|
290
|
+
{
|
|
291
|
+
headers: {
|
|
292
|
+
"clienttoken": clientToken
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
);
|
|
296
|
+
}
|
|
281
297
|
};
|
|
282
298
|
function createBookingLabClient(baseUrl, authToken) {
|
|
283
299
|
const client = new BookingLabClient({ baseUrl });
|
|
@@ -566,6 +582,20 @@ var JrniClient = class extends ApiClient {
|
|
|
566
582
|
}
|
|
567
583
|
);
|
|
568
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
|
+
}
|
|
569
599
|
/**
|
|
570
600
|
* Update JRNI configuration
|
|
571
601
|
*/
|
|
@@ -850,6 +880,17 @@ function useGetMember(companyId, memberId, authToken, enabled = true) {
|
|
|
850
880
|
enabled: enabled && !!companyId && !!memberId && !!authToken
|
|
851
881
|
});
|
|
852
882
|
}
|
|
883
|
+
function useCompany(companyId, enabled = true) {
|
|
884
|
+
const client = useJrniClient();
|
|
885
|
+
return reactQuery.useQuery({
|
|
886
|
+
queryKey: ["company", companyId],
|
|
887
|
+
queryFn: async () => {
|
|
888
|
+
const response = await client.getCompany(companyId);
|
|
889
|
+
return response.data;
|
|
890
|
+
},
|
|
891
|
+
enabled: enabled && !!companyId
|
|
892
|
+
});
|
|
893
|
+
}
|
|
853
894
|
function useClientDetails(companyId, clientToken, enabled = true) {
|
|
854
895
|
const client = useBookingLabClient();
|
|
855
896
|
return reactQuery.useQuery({
|
|
@@ -888,6 +929,17 @@ function useResetPassword(memberId, companyId, authToken, clientToken) {
|
|
|
888
929
|
}
|
|
889
930
|
});
|
|
890
931
|
}
|
|
932
|
+
function useFindClientByEmail(companyId, email, clientToken, enabled = true) {
|
|
933
|
+
const client = useBookingLabClient();
|
|
934
|
+
return reactQuery.useQuery({
|
|
935
|
+
queryKey: ["findClientByEmail", companyId, email],
|
|
936
|
+
queryFn: async () => {
|
|
937
|
+
const response = await client.findClientByEmail(companyId, email, clientToken);
|
|
938
|
+
return response.data;
|
|
939
|
+
},
|
|
940
|
+
enabled: enabled && !!companyId && !!email && !!clientToken
|
|
941
|
+
});
|
|
942
|
+
}
|
|
891
943
|
|
|
892
944
|
exports.ApiClient = ApiClient;
|
|
893
945
|
exports.ApiClientProvider = ApiClientProvider;
|
|
@@ -907,9 +959,11 @@ exports.useCheckoutBasket = useCheckoutBasket;
|
|
|
907
959
|
exports.useChildCompanies = useChildCompanies;
|
|
908
960
|
exports.useClearBaskets = useClearBaskets;
|
|
909
961
|
exports.useClientDetails = useClientDetails;
|
|
962
|
+
exports.useCompany = useCompany;
|
|
910
963
|
exports.useCreateBasket = useCreateBasket;
|
|
911
964
|
exports.useCreateClient = useCreateClient;
|
|
912
965
|
exports.useDates = useDates;
|
|
966
|
+
exports.useFindClientByEmail = useFindClientByEmail;
|
|
913
967
|
exports.useForgottenPassword = useForgottenPassword;
|
|
914
968
|
exports.useGetMember = useGetMember;
|
|
915
969
|
exports.useJrniClient = useJrniClient;
|