@bookinglab/booking-journey-api 2.6.0 → 2.8.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 +8 -1
- package/dist/index.d.cts +41 -4
- package/dist/index.d.ts +41 -4
- package/dist/index.js +77 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +74 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -212,6 +212,7 @@ Creates a new BookingLab client instance.
|
|
|
212
212
|
```typescript
|
|
213
213
|
const client = createBookingLabClient({ baseUrl: 'https://api.bookinglab.com' });
|
|
214
214
|
client.setAuthToken('your-auth-token');
|
|
215
|
+
client.setAppId('your-app-id'); // Sets x-app-id header for resetPassword requests
|
|
215
216
|
```
|
|
216
217
|
|
|
217
218
|
**Methods:**
|
|
@@ -220,12 +221,14 @@ client.setAuthToken('your-auth-token');
|
|
|
220
221
|
- `client.createBooking(data)` - Create a new booking
|
|
221
222
|
- `client.updateBooking(id, data)` - Update a booking
|
|
222
223
|
- `client.cancelBooking(companyId, bookingId, request, clientToken)` - Cancel a booking
|
|
223
|
-
- `client.resetPassword(memberId, companyId, request, authToken, clientToken)` - Reset a member's password
|
|
224
|
+
- `client.resetPassword(memberId, companyId, request, authToken, clientToken)` - Reset a member's password (includes `x-app-id` header when set)
|
|
224
225
|
- `client.sendCustomEmail(companyId, request, clientToken)` - Send a custom email
|
|
226
|
+
- `client.forgotPassword(companyId, request, clientToken)` - Request a password reset email
|
|
225
227
|
- `client.deleteBooking(id)` - Delete a booking
|
|
226
228
|
- `client.getServices()` - Get all services
|
|
227
229
|
- `client.getService(id)` - Get a specific service
|
|
228
230
|
- `client.setAuthToken(token)` - Set auth token for subsequent requests
|
|
231
|
+
- `client.setAppId(appId)` - Set app ID for `x-app-id` header
|
|
229
232
|
|
|
230
233
|
### React Providers
|
|
231
234
|
|
|
@@ -250,6 +253,7 @@ Provides BookingLab client context to React components.
|
|
|
250
253
|
<BookingLabProvider
|
|
251
254
|
baseUrl="https://api.bookinglab.com"
|
|
252
255
|
authToken="your-auth-token"
|
|
256
|
+
appId="your-app-id"
|
|
253
257
|
>
|
|
254
258
|
{children}
|
|
255
259
|
</BookingLabProvider>
|
|
@@ -407,6 +411,7 @@ const client = useJrniClient();
|
|
|
407
411
|
- `useServices()` - Get all services
|
|
408
412
|
- `useService(id)` - Get a specific service
|
|
409
413
|
- `useSendCustomEmail(companyId, clientToken)` - Send a custom email
|
|
414
|
+
- `useBookingLabForgotPassword(companyId, clientToken)` - Request a password reset email
|
|
410
415
|
- `useBookingLabClient()` - Access the BookingLab client directly
|
|
411
416
|
|
|
412
417
|
```typescript
|
|
@@ -499,6 +504,8 @@ import type {
|
|
|
499
504
|
ResetPasswordRequest,
|
|
500
505
|
SendCustomEmailRequest,
|
|
501
506
|
SendCustomEmailResponse,
|
|
507
|
+
BookingLabForgotPasswordRequest,
|
|
508
|
+
BookingLabForgotPasswordResponse,
|
|
502
509
|
} from '@bookinglab/booking-journey-api';
|
|
503
510
|
```
|
|
504
511
|
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
3
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
4
|
import { QueryClient } from '@tanstack/react-query';
|
|
5
5
|
|
|
@@ -1065,6 +1065,15 @@ interface SendCustomEmailRequest {
|
|
|
1065
1065
|
type: string;
|
|
1066
1066
|
}
|
|
1067
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
|
+
}
|
|
1068
1077
|
|
|
1069
1078
|
/**
|
|
1070
1079
|
* Core API Client
|
|
@@ -1120,6 +1129,11 @@ declare class ApiClient {
|
|
|
1120
1129
|
*/
|
|
1121
1130
|
|
|
1122
1131
|
declare class BookingLabClient extends ApiClient {
|
|
1132
|
+
private appId;
|
|
1133
|
+
/**
|
|
1134
|
+
* Set the App ID for x-app-id header
|
|
1135
|
+
*/
|
|
1136
|
+
setAppId(appId: string): void;
|
|
1123
1137
|
/**
|
|
1124
1138
|
* Get all bookings
|
|
1125
1139
|
*/
|
|
@@ -1195,11 +1209,18 @@ declare class BookingLabClient extends ApiClient {
|
|
|
1195
1209
|
* @param clientToken - Client token for authentication
|
|
1196
1210
|
*/
|
|
1197
1211
|
sendCustomEmail(companyId: number, request: SendCustomEmailRequest, clientToken: string): Promise<ApiResponse<SendCustomEmailResponse>>;
|
|
1212
|
+
/**
|
|
1213
|
+
* Request a password reset for a client
|
|
1214
|
+
* @param companyId - The company ID
|
|
1215
|
+
* @param request - Forgot password request with email, path, and token_based_reset
|
|
1216
|
+
* @param clientToken - Client token for authentication
|
|
1217
|
+
*/
|
|
1218
|
+
forgotPassword(companyId: number, request: BookingLabForgotPasswordRequest, clientToken: string): Promise<ApiResponse<BookingLabForgotPasswordResponse>>;
|
|
1198
1219
|
}
|
|
1199
1220
|
/**
|
|
1200
1221
|
* Create a new BookingLab client instance
|
|
1201
1222
|
*/
|
|
1202
|
-
declare function createBookingLabClient(baseUrl: string, authToken?: string): BookingLabClient;
|
|
1223
|
+
declare function createBookingLabClient(baseUrl: string, authToken?: string, appId?: string): BookingLabClient;
|
|
1203
1224
|
|
|
1204
1225
|
/**
|
|
1205
1226
|
* JRNI API Client
|
|
@@ -1357,6 +1378,7 @@ interface ApiClientProviderProps {
|
|
|
1357
1378
|
authToken?: string;
|
|
1358
1379
|
queryClient?: QueryClient;
|
|
1359
1380
|
}
|
|
1381
|
+
declare const ApiClientContext: React.Context<ApiClientContextValue | undefined>;
|
|
1360
1382
|
/**
|
|
1361
1383
|
* Combined provider for multiple API clients
|
|
1362
1384
|
* Includes QueryClientProvider for React Query hooks
|
|
@@ -1367,25 +1389,34 @@ declare function ApiClientProvider({ children, bookingLabBaseUrl, jrniBaseUrl, j
|
|
|
1367
1389
|
*/
|
|
1368
1390
|
declare function useApiClientContext(): ApiClientContextValue;
|
|
1369
1391
|
|
|
1392
|
+
interface BookingLabContextValue {
|
|
1393
|
+
client: BookingLabClient;
|
|
1394
|
+
}
|
|
1370
1395
|
interface BookingLabProviderProps {
|
|
1371
1396
|
children: ReactNode;
|
|
1372
1397
|
baseUrl: string;
|
|
1373
1398
|
authToken?: string;
|
|
1399
|
+
appId?: string;
|
|
1374
1400
|
}
|
|
1401
|
+
declare const BookingLabContext: React.Context<BookingLabContextValue | undefined>;
|
|
1375
1402
|
/**
|
|
1376
1403
|
* Provider component for BookingLab client
|
|
1377
1404
|
*/
|
|
1378
|
-
declare function BookingLabProvider({ children, baseUrl, authToken, }: BookingLabProviderProps): react_jsx_runtime.JSX.Element;
|
|
1405
|
+
declare function BookingLabProvider({ children, baseUrl, authToken, appId, }: BookingLabProviderProps): react_jsx_runtime.JSX.Element;
|
|
1379
1406
|
/**
|
|
1380
1407
|
* Hook to access BookingLab client from context
|
|
1381
1408
|
*/
|
|
1382
1409
|
declare function useBookingLabContext(): BookingLabClient;
|
|
1383
1410
|
|
|
1411
|
+
interface JrniContextValue {
|
|
1412
|
+
client: JrniClient;
|
|
1413
|
+
}
|
|
1384
1414
|
interface JrniProviderProps {
|
|
1385
1415
|
children: ReactNode;
|
|
1386
1416
|
baseUrl: string;
|
|
1387
1417
|
config: JrniConfig;
|
|
1388
1418
|
}
|
|
1419
|
+
declare const JrniContext: React.Context<JrniContextValue | undefined>;
|
|
1389
1420
|
/**
|
|
1390
1421
|
* Provider component for JRNI client
|
|
1391
1422
|
*/
|
|
@@ -1575,5 +1606,11 @@ declare function useFindClientByEmail(companyId: number, email: string, clientTo
|
|
|
1575
1606
|
* @param clientToken - Client token for authentication
|
|
1576
1607
|
*/
|
|
1577
1608
|
declare function useSendCustomEmail(companyId: number, clientToken: string): _tanstack_react_query.UseMutationResult<string, Error, SendCustomEmailRequest, unknown>;
|
|
1609
|
+
/**
|
|
1610
|
+
* Hook for requesting a password reset (BookingLab)
|
|
1611
|
+
* @param companyId - The company ID
|
|
1612
|
+
* @param clientToken - Client token for authentication
|
|
1613
|
+
*/
|
|
1614
|
+
declare function useBookingLabForgotPassword(companyId: number, clientToken: string): _tanstack_react_query.UseMutationResult<BookingLabForgotPasswordResponse, Error, BookingLabForgotPasswordRequest, unknown>;
|
|
1578
1615
|
|
|
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 };
|
|
1616
|
+
export { type AddBasketItemRequest, type AddServiceItemAssets, type AddServiceItemQuestion, type AddServiceItemRequest, ApiClient, type ApiClientConfig, ApiClientContext, ApiClientProvider, type ApiError, type ApiResponse, type AvailabilityTime, type AvailabilityTimesResponse, type Booking, type BookingAnswer, BookingLabClient, BookingLabContext, 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, JrniContext, 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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
3
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
4
|
import { QueryClient } from '@tanstack/react-query';
|
|
5
5
|
|
|
@@ -1065,6 +1065,15 @@ interface SendCustomEmailRequest {
|
|
|
1065
1065
|
type: string;
|
|
1066
1066
|
}
|
|
1067
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
|
+
}
|
|
1068
1077
|
|
|
1069
1078
|
/**
|
|
1070
1079
|
* Core API Client
|
|
@@ -1120,6 +1129,11 @@ declare class ApiClient {
|
|
|
1120
1129
|
*/
|
|
1121
1130
|
|
|
1122
1131
|
declare class BookingLabClient extends ApiClient {
|
|
1132
|
+
private appId;
|
|
1133
|
+
/**
|
|
1134
|
+
* Set the App ID for x-app-id header
|
|
1135
|
+
*/
|
|
1136
|
+
setAppId(appId: string): void;
|
|
1123
1137
|
/**
|
|
1124
1138
|
* Get all bookings
|
|
1125
1139
|
*/
|
|
@@ -1195,11 +1209,18 @@ declare class BookingLabClient extends ApiClient {
|
|
|
1195
1209
|
* @param clientToken - Client token for authentication
|
|
1196
1210
|
*/
|
|
1197
1211
|
sendCustomEmail(companyId: number, request: SendCustomEmailRequest, clientToken: string): Promise<ApiResponse<SendCustomEmailResponse>>;
|
|
1212
|
+
/**
|
|
1213
|
+
* Request a password reset for a client
|
|
1214
|
+
* @param companyId - The company ID
|
|
1215
|
+
* @param request - Forgot password request with email, path, and token_based_reset
|
|
1216
|
+
* @param clientToken - Client token for authentication
|
|
1217
|
+
*/
|
|
1218
|
+
forgotPassword(companyId: number, request: BookingLabForgotPasswordRequest, clientToken: string): Promise<ApiResponse<BookingLabForgotPasswordResponse>>;
|
|
1198
1219
|
}
|
|
1199
1220
|
/**
|
|
1200
1221
|
* Create a new BookingLab client instance
|
|
1201
1222
|
*/
|
|
1202
|
-
declare function createBookingLabClient(baseUrl: string, authToken?: string): BookingLabClient;
|
|
1223
|
+
declare function createBookingLabClient(baseUrl: string, authToken?: string, appId?: string): BookingLabClient;
|
|
1203
1224
|
|
|
1204
1225
|
/**
|
|
1205
1226
|
* JRNI API Client
|
|
@@ -1357,6 +1378,7 @@ interface ApiClientProviderProps {
|
|
|
1357
1378
|
authToken?: string;
|
|
1358
1379
|
queryClient?: QueryClient;
|
|
1359
1380
|
}
|
|
1381
|
+
declare const ApiClientContext: React.Context<ApiClientContextValue | undefined>;
|
|
1360
1382
|
/**
|
|
1361
1383
|
* Combined provider for multiple API clients
|
|
1362
1384
|
* Includes QueryClientProvider for React Query hooks
|
|
@@ -1367,25 +1389,34 @@ declare function ApiClientProvider({ children, bookingLabBaseUrl, jrniBaseUrl, j
|
|
|
1367
1389
|
*/
|
|
1368
1390
|
declare function useApiClientContext(): ApiClientContextValue;
|
|
1369
1391
|
|
|
1392
|
+
interface BookingLabContextValue {
|
|
1393
|
+
client: BookingLabClient;
|
|
1394
|
+
}
|
|
1370
1395
|
interface BookingLabProviderProps {
|
|
1371
1396
|
children: ReactNode;
|
|
1372
1397
|
baseUrl: string;
|
|
1373
1398
|
authToken?: string;
|
|
1399
|
+
appId?: string;
|
|
1374
1400
|
}
|
|
1401
|
+
declare const BookingLabContext: React.Context<BookingLabContextValue | undefined>;
|
|
1375
1402
|
/**
|
|
1376
1403
|
* Provider component for BookingLab client
|
|
1377
1404
|
*/
|
|
1378
|
-
declare function BookingLabProvider({ children, baseUrl, authToken, }: BookingLabProviderProps): react_jsx_runtime.JSX.Element;
|
|
1405
|
+
declare function BookingLabProvider({ children, baseUrl, authToken, appId, }: BookingLabProviderProps): react_jsx_runtime.JSX.Element;
|
|
1379
1406
|
/**
|
|
1380
1407
|
* Hook to access BookingLab client from context
|
|
1381
1408
|
*/
|
|
1382
1409
|
declare function useBookingLabContext(): BookingLabClient;
|
|
1383
1410
|
|
|
1411
|
+
interface JrniContextValue {
|
|
1412
|
+
client: JrniClient;
|
|
1413
|
+
}
|
|
1384
1414
|
interface JrniProviderProps {
|
|
1385
1415
|
children: ReactNode;
|
|
1386
1416
|
baseUrl: string;
|
|
1387
1417
|
config: JrniConfig;
|
|
1388
1418
|
}
|
|
1419
|
+
declare const JrniContext: React.Context<JrniContextValue | undefined>;
|
|
1389
1420
|
/**
|
|
1390
1421
|
* Provider component for JRNI client
|
|
1391
1422
|
*/
|
|
@@ -1575,5 +1606,11 @@ declare function useFindClientByEmail(companyId: number, email: string, clientTo
|
|
|
1575
1606
|
* @param clientToken - Client token for authentication
|
|
1576
1607
|
*/
|
|
1577
1608
|
declare function useSendCustomEmail(companyId: number, clientToken: string): _tanstack_react_query.UseMutationResult<string, Error, SendCustomEmailRequest, unknown>;
|
|
1609
|
+
/**
|
|
1610
|
+
* Hook for requesting a password reset (BookingLab)
|
|
1611
|
+
* @param companyId - The company ID
|
|
1612
|
+
* @param clientToken - Client token for authentication
|
|
1613
|
+
*/
|
|
1614
|
+
declare function useBookingLabForgotPassword(companyId: number, clientToken: string): _tanstack_react_query.UseMutationResult<BookingLabForgotPasswordResponse, Error, BookingLabForgotPasswordRequest, unknown>;
|
|
1578
1615
|
|
|
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 };
|
|
1616
|
+
export { type AddBasketItemRequest, type AddServiceItemAssets, type AddServiceItemQuestion, type AddServiceItemRequest, ApiClient, type ApiClientConfig, ApiClientContext, ApiClientProvider, type ApiError, type ApiResponse, type AvailabilityTime, type AvailabilityTimesResponse, type Booking, type BookingAnswer, BookingLabClient, BookingLabContext, 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, JrniContext, 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
|
@@ -160,6 +160,16 @@ var MemberType = /* @__PURE__ */ ((MemberType2) => {
|
|
|
160
160
|
|
|
161
161
|
// src/booking-lab.ts
|
|
162
162
|
var BookingLabClient = class extends ApiClient {
|
|
163
|
+
constructor() {
|
|
164
|
+
super(...arguments);
|
|
165
|
+
this.appId = "";
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Set the App ID for x-app-id header
|
|
169
|
+
*/
|
|
170
|
+
setAppId(appId) {
|
|
171
|
+
this.appId = appId;
|
|
172
|
+
}
|
|
163
173
|
/**
|
|
164
174
|
* Get all bookings
|
|
165
175
|
*/
|
|
@@ -273,7 +283,8 @@ var BookingLabClient = class extends ApiClient {
|
|
|
273
283
|
"X-member-id": String(memberId),
|
|
274
284
|
"x-company-id": String(companyId),
|
|
275
285
|
"authtoken": authToken,
|
|
276
|
-
"clienttoken": clientToken
|
|
286
|
+
"clienttoken": clientToken,
|
|
287
|
+
...this.appId && { "x-app-id": this.appId }
|
|
277
288
|
}
|
|
278
289
|
}
|
|
279
290
|
);
|
|
@@ -312,12 +323,33 @@ var BookingLabClient = class extends ApiClient {
|
|
|
312
323
|
}
|
|
313
324
|
);
|
|
314
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* Request a password reset for a client
|
|
328
|
+
* @param companyId - The company ID
|
|
329
|
+
* @param request - Forgot password request with email, path, and token_based_reset
|
|
330
|
+
* @param clientToken - Client token for authentication
|
|
331
|
+
*/
|
|
332
|
+
async forgotPassword(companyId, request, clientToken) {
|
|
333
|
+
return this.post(
|
|
334
|
+
`/company/${companyId}/forgot-password`,
|
|
335
|
+
request,
|
|
336
|
+
{
|
|
337
|
+
headers: {
|
|
338
|
+
"x-company-id": String(companyId),
|
|
339
|
+
"clienttoken": clientToken
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
);
|
|
343
|
+
}
|
|
315
344
|
};
|
|
316
|
-
function createBookingLabClient(baseUrl, authToken) {
|
|
345
|
+
function createBookingLabClient(baseUrl, authToken, appId) {
|
|
317
346
|
const client = new BookingLabClient({ baseUrl });
|
|
318
347
|
if (authToken) {
|
|
319
348
|
client.setAuthToken(authToken);
|
|
320
349
|
}
|
|
350
|
+
if (appId) {
|
|
351
|
+
client.setAppId(appId);
|
|
352
|
+
}
|
|
321
353
|
return client;
|
|
322
354
|
}
|
|
323
355
|
|
|
@@ -686,8 +718,11 @@ function ApiClientProvider({
|
|
|
686
718
|
if (authToken) {
|
|
687
719
|
clientInstance.setAuthToken(authToken);
|
|
688
720
|
}
|
|
721
|
+
if (jrniConfig?.appId) {
|
|
722
|
+
clientInstance.setAppId(jrniConfig.appId);
|
|
723
|
+
}
|
|
689
724
|
return clientInstance;
|
|
690
|
-
}, [bookingLabBaseUrl, authToken]);
|
|
725
|
+
}, [bookingLabBaseUrl, authToken, jrniConfig?.appId]);
|
|
691
726
|
const jrniClient = react.useMemo(() => {
|
|
692
727
|
if (jrniBaseUrl && jrniConfig) {
|
|
693
728
|
return new JrniClient(jrniBaseUrl, jrniConfig);
|
|
@@ -714,15 +749,19 @@ var BookingLabContext = react.createContext(void 0);
|
|
|
714
749
|
function BookingLabProvider({
|
|
715
750
|
children,
|
|
716
751
|
baseUrl,
|
|
717
|
-
authToken
|
|
752
|
+
authToken,
|
|
753
|
+
appId
|
|
718
754
|
}) {
|
|
719
755
|
const client = react.useMemo(() => {
|
|
720
756
|
const clientInstance = new BookingLabClient({ baseUrl });
|
|
721
757
|
if (authToken) {
|
|
722
758
|
clientInstance.setAuthToken(authToken);
|
|
723
759
|
}
|
|
760
|
+
if (appId) {
|
|
761
|
+
clientInstance.setAppId(appId);
|
|
762
|
+
}
|
|
724
763
|
return clientInstance;
|
|
725
|
-
}, [baseUrl, authToken]);
|
|
764
|
+
}, [baseUrl, authToken, appId]);
|
|
726
765
|
const value = react.useMemo(() => ({ client }), [client]);
|
|
727
766
|
return /* @__PURE__ */ jsxRuntime.jsx(BookingLabContext.Provider, { value, children });
|
|
728
767
|
}
|
|
@@ -748,33 +787,31 @@ function useJrniContext() {
|
|
|
748
787
|
}
|
|
749
788
|
return context.client;
|
|
750
789
|
}
|
|
751
|
-
|
|
752
|
-
// src/hooks/useApiClient.ts
|
|
753
790
|
function useBookingLabClient() {
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
);
|
|
762
|
-
}
|
|
763
|
-
return context.bookingLabClient;
|
|
791
|
+
const standaloneContext = react.useContext(BookingLabContext);
|
|
792
|
+
const combinedContext = react.useContext(ApiClientContext);
|
|
793
|
+
if (standaloneContext) {
|
|
794
|
+
return standaloneContext.client;
|
|
795
|
+
}
|
|
796
|
+
if (combinedContext?.bookingLabClient) {
|
|
797
|
+
return combinedContext.bookingLabClient;
|
|
764
798
|
}
|
|
799
|
+
throw new Error(
|
|
800
|
+
"BookingLab client not configured. Wrap your app with ApiClientProvider or BookingLabProvider."
|
|
801
|
+
);
|
|
765
802
|
}
|
|
766
803
|
function useJrniClient() {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
if (!context.jrniClient) {
|
|
772
|
-
throw new Error(
|
|
773
|
-
"JRNI client not configured. Wrap your app with ApiClientProvider or JrniProvider."
|
|
774
|
-
);
|
|
775
|
-
}
|
|
776
|
-
return context.jrniClient;
|
|
804
|
+
const standaloneContext = react.useContext(JrniContext);
|
|
805
|
+
const combinedContext = react.useContext(ApiClientContext);
|
|
806
|
+
if (standaloneContext) {
|
|
807
|
+
return standaloneContext.client;
|
|
777
808
|
}
|
|
809
|
+
if (combinedContext?.jrniClient) {
|
|
810
|
+
return combinedContext.jrniClient;
|
|
811
|
+
}
|
|
812
|
+
throw new Error(
|
|
813
|
+
"JRNI client not configured. Wrap your app with ApiClientProvider or JrniProvider."
|
|
814
|
+
);
|
|
778
815
|
}
|
|
779
816
|
function useLogin() {
|
|
780
817
|
const client = useJrniClient();
|
|
@@ -1023,12 +1060,24 @@ function useSendCustomEmail(companyId, clientToken) {
|
|
|
1023
1060
|
}
|
|
1024
1061
|
});
|
|
1025
1062
|
}
|
|
1063
|
+
function useBookingLabForgotPassword(companyId, clientToken) {
|
|
1064
|
+
const client = useBookingLabClient();
|
|
1065
|
+
return reactQuery.useMutation({
|
|
1066
|
+
mutationFn: async (request) => {
|
|
1067
|
+
const response = await client.forgotPassword(companyId, request, clientToken);
|
|
1068
|
+
return response.data;
|
|
1069
|
+
}
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1026
1072
|
|
|
1027
1073
|
exports.ApiClient = ApiClient;
|
|
1074
|
+
exports.ApiClientContext = ApiClientContext;
|
|
1028
1075
|
exports.ApiClientProvider = ApiClientProvider;
|
|
1029
1076
|
exports.BookingLabClient = BookingLabClient;
|
|
1077
|
+
exports.BookingLabContext = BookingLabContext;
|
|
1030
1078
|
exports.BookingLabProvider = BookingLabProvider;
|
|
1031
1079
|
exports.JrniClient = JrniClient;
|
|
1080
|
+
exports.JrniContext = JrniContext;
|
|
1032
1081
|
exports.JrniProvider = JrniProvider;
|
|
1033
1082
|
exports.MemberType = MemberType;
|
|
1034
1083
|
exports.createBookingLabClient = createBookingLabClient;
|
|
@@ -1037,6 +1086,7 @@ exports.useAddServiceItem = useAddServiceItem;
|
|
|
1037
1086
|
exports.useApiClientContext = useApiClientContext;
|
|
1038
1087
|
exports.useBookingLabClient = useBookingLabClient;
|
|
1039
1088
|
exports.useBookingLabContext = useBookingLabContext;
|
|
1089
|
+
exports.useBookingLabForgotPassword = useBookingLabForgotPassword;
|
|
1040
1090
|
exports.useCancelBooking = useCancelBooking;
|
|
1041
1091
|
exports.useCancelMemberBooking = useCancelMemberBooking;
|
|
1042
1092
|
exports.useCheckoutBasket = useCheckoutBasket;
|