@bookinglab/booking-journey-api 2.5.0 → 2.7.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 CHANGED
@@ -221,6 +221,8 @@ client.setAuthToken('your-auth-token');
221
221
  - `client.updateBooking(id, data)` - Update a booking
222
222
  - `client.cancelBooking(companyId, bookingId, request, clientToken)` - Cancel a booking
223
223
  - `client.resetPassword(memberId, companyId, request, authToken, clientToken)` - Reset a member's password
224
+ - `client.sendCustomEmail(companyId, request, clientToken)` - Send a custom email
225
+ - `client.forgotPassword(companyId, request, clientToken)` - Request a password reset email
224
226
  - `client.deleteBooking(id)` - Delete a booking
225
227
  - `client.getServices()` - Get all services
226
228
  - `client.getService(id)` - Get a specific service
@@ -405,6 +407,8 @@ const client = useJrniClient();
405
407
  - `useCreateClient(companyId, clientToken?)` - Create a new client
406
408
  - `useServices()` - Get all services
407
409
  - `useService(id)` - Get a specific service
410
+ - `useSendCustomEmail(companyId, clientToken)` - Send a custom email
411
+ - `useBookingLabForgotPassword(companyId, clientToken)` - Request a password reset email
408
412
  - `useBookingLabClient()` - Access the BookingLab client directly
409
413
 
410
414
  ```typescript
@@ -495,6 +499,10 @@ import type {
495
499
  CancelBookingRequest,
496
500
  CancelBookingResponse,
497
501
  ResetPasswordRequest,
502
+ SendCustomEmailRequest,
503
+ SendCustomEmailResponse,
504
+ BookingLabForgotPasswordRequest,
505
+ BookingLabForgotPasswordResponse,
498
506
  } from '@bookinglab/booking-journey-api';
499
507
  ```
500
508
 
package/dist/index.d.cts CHANGED
@@ -1057,6 +1057,23 @@ interface RescheduleBookingResponse {
1057
1057
  questions: Record<string, any>;
1058
1058
  _links: Record<string, any>;
1059
1059
  }
1060
+ interface SendCustomEmailRequest {
1061
+ slot: string;
1062
+ to: string;
1063
+ from: string;
1064
+ subject: string;
1065
+ type: string;
1066
+ }
1067
+ type SendCustomEmailResponse = string;
1068
+ interface BookingLabForgotPasswordRequest {
1069
+ email: string;
1070
+ path: string;
1071
+ token_based_reset: boolean;
1072
+ }
1073
+ interface BookingLabForgotPasswordResponse {
1074
+ result: string;
1075
+ message: string;
1076
+ }
1060
1077
 
1061
1078
  /**
1062
1079
  * Core API Client
@@ -1180,6 +1197,20 @@ declare class BookingLabClient extends ApiClient {
1180
1197
  * @param clientToken - Client token for authentication
1181
1198
  */
1182
1199
  findClientByEmail(companyId: number, email: string, clientToken: string): Promise<ApiResponse<FindClientByEmailResponse>>;
1200
+ /**
1201
+ * Send a custom email for a booking
1202
+ * @param companyId - The company ID
1203
+ * @param request - Email request data
1204
+ * @param clientToken - Client token for authentication
1205
+ */
1206
+ sendCustomEmail(companyId: number, request: SendCustomEmailRequest, clientToken: string): Promise<ApiResponse<SendCustomEmailResponse>>;
1207
+ /**
1208
+ * Request a password reset for a client
1209
+ * @param companyId - The company ID
1210
+ * @param request - Forgot password request with email, path, and token_based_reset
1211
+ * @param clientToken - Client token for authentication
1212
+ */
1213
+ forgotPassword(companyId: number, request: BookingLabForgotPasswordRequest, clientToken: string): Promise<ApiResponse<BookingLabForgotPasswordResponse>>;
1183
1214
  }
1184
1215
  /**
1185
1216
  * Create a new BookingLab client instance
@@ -1554,5 +1585,17 @@ declare function useResetPassword(memberId: number, companyId: number, authToken
1554
1585
  * @param enabled - Whether the query should run
1555
1586
  */
1556
1587
  declare function useFindClientByEmail(companyId: number, email: string, clientToken: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<FindClientByEmailResponse, Error>;
1588
+ /**
1589
+ * Hook for sending a custom email
1590
+ * @param companyId - The company ID
1591
+ * @param clientToken - Client token for authentication
1592
+ */
1593
+ declare function useSendCustomEmail(companyId: number, clientToken: string): _tanstack_react_query.UseMutationResult<string, Error, SendCustomEmailRequest, unknown>;
1594
+ /**
1595
+ * Hook for requesting a password reset (BookingLab)
1596
+ * @param companyId - The company ID
1597
+ * @param clientToken - Client token for authentication
1598
+ */
1599
+ declare function useBookingLabForgotPassword(companyId: number, clientToken: string): _tanstack_react_query.UseMutationResult<BookingLabForgotPasswordResponse, Error, BookingLabForgotPasswordRequest, unknown>;
1557
1600
 
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 };
1601
+ 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, type BookingLabForgotPasswordRequest, type BookingLabForgotPasswordResponse, 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, useBookingLabForgotPassword, 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
@@ -1057,6 +1057,23 @@ interface RescheduleBookingResponse {
1057
1057
  questions: Record<string, any>;
1058
1058
  _links: Record<string, any>;
1059
1059
  }
1060
+ interface SendCustomEmailRequest {
1061
+ slot: string;
1062
+ to: string;
1063
+ from: string;
1064
+ subject: string;
1065
+ type: string;
1066
+ }
1067
+ type SendCustomEmailResponse = string;
1068
+ interface BookingLabForgotPasswordRequest {
1069
+ email: string;
1070
+ path: string;
1071
+ token_based_reset: boolean;
1072
+ }
1073
+ interface BookingLabForgotPasswordResponse {
1074
+ result: string;
1075
+ message: string;
1076
+ }
1060
1077
 
1061
1078
  /**
1062
1079
  * Core API Client
@@ -1180,6 +1197,20 @@ declare class BookingLabClient extends ApiClient {
1180
1197
  * @param clientToken - Client token for authentication
1181
1198
  */
1182
1199
  findClientByEmail(companyId: number, email: string, clientToken: string): Promise<ApiResponse<FindClientByEmailResponse>>;
1200
+ /**
1201
+ * Send a custom email for a booking
1202
+ * @param companyId - The company ID
1203
+ * @param request - Email request data
1204
+ * @param clientToken - Client token for authentication
1205
+ */
1206
+ sendCustomEmail(companyId: number, request: SendCustomEmailRequest, clientToken: string): Promise<ApiResponse<SendCustomEmailResponse>>;
1207
+ /**
1208
+ * Request a password reset for a client
1209
+ * @param companyId - The company ID
1210
+ * @param request - Forgot password request with email, path, and token_based_reset
1211
+ * @param clientToken - Client token for authentication
1212
+ */
1213
+ forgotPassword(companyId: number, request: BookingLabForgotPasswordRequest, clientToken: string): Promise<ApiResponse<BookingLabForgotPasswordResponse>>;
1183
1214
  }
1184
1215
  /**
1185
1216
  * Create a new BookingLab client instance
@@ -1554,5 +1585,17 @@ declare function useResetPassword(memberId: number, companyId: number, authToken
1554
1585
  * @param enabled - Whether the query should run
1555
1586
  */
1556
1587
  declare function useFindClientByEmail(companyId: number, email: string, clientToken: string, enabled?: boolean): _tanstack_react_query.UseQueryResult<FindClientByEmailResponse, Error>;
1588
+ /**
1589
+ * Hook for sending a custom email
1590
+ * @param companyId - The company ID
1591
+ * @param clientToken - Client token for authentication
1592
+ */
1593
+ declare function useSendCustomEmail(companyId: number, clientToken: string): _tanstack_react_query.UseMutationResult<string, Error, SendCustomEmailRequest, unknown>;
1594
+ /**
1595
+ * Hook for requesting a password reset (BookingLab)
1596
+ * @param companyId - The company ID
1597
+ * @param clientToken - Client token for authentication
1598
+ */
1599
+ declare function useBookingLabForgotPassword(companyId: number, clientToken: string): _tanstack_react_query.UseMutationResult<BookingLabForgotPasswordResponse, Error, BookingLabForgotPasswordRequest, unknown>;
1557
1600
 
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 };
1601
+ 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, type BookingLabForgotPasswordRequest, type BookingLabForgotPasswordResponse, 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, useBookingLabForgotPassword, 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,42 @@ 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
+ }
315
+ /**
316
+ * Request a password reset for a client
317
+ * @param companyId - The company ID
318
+ * @param request - Forgot password request with email, path, and token_based_reset
319
+ * @param clientToken - Client token for authentication
320
+ */
321
+ async forgotPassword(companyId, request, clientToken) {
322
+ return this.post(
323
+ `/company/${companyId}/forgot-password`,
324
+ request,
325
+ {
326
+ headers: {
327
+ "x-company-id": String(companyId),
328
+ "clienttoken": clientToken
329
+ }
330
+ }
331
+ );
332
+ }
297
333
  };
298
334
  function createBookingLabClient(baseUrl, authToken) {
299
335
  const client = new BookingLabClient({ baseUrl });
@@ -996,6 +1032,24 @@ function useFindClientByEmail(companyId, email, clientToken, enabled = true) {
996
1032
  enabled: enabled && !!companyId && !!email && !!clientToken
997
1033
  });
998
1034
  }
1035
+ function useSendCustomEmail(companyId, clientToken) {
1036
+ const client = useBookingLabClient();
1037
+ return reactQuery.useMutation({
1038
+ mutationFn: async (request) => {
1039
+ const response = await client.sendCustomEmail(companyId, request, clientToken);
1040
+ return response.data;
1041
+ }
1042
+ });
1043
+ }
1044
+ function useBookingLabForgotPassword(companyId, clientToken) {
1045
+ const client = useBookingLabClient();
1046
+ return reactQuery.useMutation({
1047
+ mutationFn: async (request) => {
1048
+ const response = await client.forgotPassword(companyId, request, clientToken);
1049
+ return response.data;
1050
+ }
1051
+ });
1052
+ }
999
1053
 
1000
1054
  exports.ApiClient = ApiClient;
1001
1055
  exports.ApiClientProvider = ApiClientProvider;
@@ -1010,6 +1064,7 @@ exports.useAddServiceItem = useAddServiceItem;
1010
1064
  exports.useApiClientContext = useApiClientContext;
1011
1065
  exports.useBookingLabClient = useBookingLabClient;
1012
1066
  exports.useBookingLabContext = useBookingLabContext;
1067
+ exports.useBookingLabForgotPassword = useBookingLabForgotPassword;
1013
1068
  exports.useCancelBooking = useCancelBooking;
1014
1069
  exports.useCancelMemberBooking = useCancelMemberBooking;
1015
1070
  exports.useCheckoutBasket = useCheckoutBasket;
@@ -1031,6 +1086,7 @@ exports.useQuestions = useQuestions;
1031
1086
  exports.useRescheduleBooking = useRescheduleBooking;
1032
1087
  exports.useResetPassword = useResetPassword;
1033
1088
  exports.useResources = useResources;
1089
+ exports.useSendCustomEmail = useSendCustomEmail;
1034
1090
  exports.useServices = useServices;
1035
1091
  exports.useTimes = useTimes;
1036
1092
  exports.useUpdateClient = useUpdateClient;