@bookinglab/booking-journey-api 2.7.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 +4 -1
- package/dist/index.d.cts +19 -4
- package/dist/index.d.ts +19 -4
- package/dist/index.js +49 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -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,13 +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
|
|
225
226
|
- `client.forgotPassword(companyId, request, clientToken)` - Request a password reset email
|
|
226
227
|
- `client.deleteBooking(id)` - Delete a booking
|
|
227
228
|
- `client.getServices()` - Get all services
|
|
228
229
|
- `client.getService(id)` - Get a specific service
|
|
229
230
|
- `client.setAuthToken(token)` - Set auth token for subsequent requests
|
|
231
|
+
- `client.setAppId(appId)` - Set app ID for `x-app-id` header
|
|
230
232
|
|
|
231
233
|
### React Providers
|
|
232
234
|
|
|
@@ -251,6 +253,7 @@ Provides BookingLab client context to React components.
|
|
|
251
253
|
<BookingLabProvider
|
|
252
254
|
baseUrl="https://api.bookinglab.com"
|
|
253
255
|
authToken="your-auth-token"
|
|
256
|
+
appId="your-app-id"
|
|
254
257
|
>
|
|
255
258
|
{children}
|
|
256
259
|
</BookingLabProvider>
|
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
|
|
|
@@ -1129,6 +1129,11 @@ declare class ApiClient {
|
|
|
1129
1129
|
*/
|
|
1130
1130
|
|
|
1131
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;
|
|
1132
1137
|
/**
|
|
1133
1138
|
* Get all bookings
|
|
1134
1139
|
*/
|
|
@@ -1215,7 +1220,7 @@ declare class BookingLabClient extends ApiClient {
|
|
|
1215
1220
|
/**
|
|
1216
1221
|
* Create a new BookingLab client instance
|
|
1217
1222
|
*/
|
|
1218
|
-
declare function createBookingLabClient(baseUrl: string, authToken?: string): BookingLabClient;
|
|
1223
|
+
declare function createBookingLabClient(baseUrl: string, authToken?: string, appId?: string): BookingLabClient;
|
|
1219
1224
|
|
|
1220
1225
|
/**
|
|
1221
1226
|
* JRNI API Client
|
|
@@ -1373,6 +1378,7 @@ interface ApiClientProviderProps {
|
|
|
1373
1378
|
authToken?: string;
|
|
1374
1379
|
queryClient?: QueryClient;
|
|
1375
1380
|
}
|
|
1381
|
+
declare const ApiClientContext: React.Context<ApiClientContextValue | undefined>;
|
|
1376
1382
|
/**
|
|
1377
1383
|
* Combined provider for multiple API clients
|
|
1378
1384
|
* Includes QueryClientProvider for React Query hooks
|
|
@@ -1383,25 +1389,34 @@ declare function ApiClientProvider({ children, bookingLabBaseUrl, jrniBaseUrl, j
|
|
|
1383
1389
|
*/
|
|
1384
1390
|
declare function useApiClientContext(): ApiClientContextValue;
|
|
1385
1391
|
|
|
1392
|
+
interface BookingLabContextValue {
|
|
1393
|
+
client: BookingLabClient;
|
|
1394
|
+
}
|
|
1386
1395
|
interface BookingLabProviderProps {
|
|
1387
1396
|
children: ReactNode;
|
|
1388
1397
|
baseUrl: string;
|
|
1389
1398
|
authToken?: string;
|
|
1399
|
+
appId?: string;
|
|
1390
1400
|
}
|
|
1401
|
+
declare const BookingLabContext: React.Context<BookingLabContextValue | undefined>;
|
|
1391
1402
|
/**
|
|
1392
1403
|
* Provider component for BookingLab client
|
|
1393
1404
|
*/
|
|
1394
|
-
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;
|
|
1395
1406
|
/**
|
|
1396
1407
|
* Hook to access BookingLab client from context
|
|
1397
1408
|
*/
|
|
1398
1409
|
declare function useBookingLabContext(): BookingLabClient;
|
|
1399
1410
|
|
|
1411
|
+
interface JrniContextValue {
|
|
1412
|
+
client: JrniClient;
|
|
1413
|
+
}
|
|
1400
1414
|
interface JrniProviderProps {
|
|
1401
1415
|
children: ReactNode;
|
|
1402
1416
|
baseUrl: string;
|
|
1403
1417
|
config: JrniConfig;
|
|
1404
1418
|
}
|
|
1419
|
+
declare const JrniContext: React.Context<JrniContextValue | undefined>;
|
|
1405
1420
|
/**
|
|
1406
1421
|
* Provider component for JRNI client
|
|
1407
1422
|
*/
|
|
@@ -1598,4 +1613,4 @@ declare function useSendCustomEmail(companyId: number, clientToken: string): _ta
|
|
|
1598
1613
|
*/
|
|
1599
1614
|
declare function useBookingLabForgotPassword(companyId: number, clientToken: string): _tanstack_react_query.UseMutationResult<BookingLabForgotPasswordResponse, Error, BookingLabForgotPasswordRequest, unknown>;
|
|
1600
1615
|
|
|
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 };
|
|
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
|
|
|
@@ -1129,6 +1129,11 @@ declare class ApiClient {
|
|
|
1129
1129
|
*/
|
|
1130
1130
|
|
|
1131
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;
|
|
1132
1137
|
/**
|
|
1133
1138
|
* Get all bookings
|
|
1134
1139
|
*/
|
|
@@ -1215,7 +1220,7 @@ declare class BookingLabClient extends ApiClient {
|
|
|
1215
1220
|
/**
|
|
1216
1221
|
* Create a new BookingLab client instance
|
|
1217
1222
|
*/
|
|
1218
|
-
declare function createBookingLabClient(baseUrl: string, authToken?: string): BookingLabClient;
|
|
1223
|
+
declare function createBookingLabClient(baseUrl: string, authToken?: string, appId?: string): BookingLabClient;
|
|
1219
1224
|
|
|
1220
1225
|
/**
|
|
1221
1226
|
* JRNI API Client
|
|
@@ -1373,6 +1378,7 @@ interface ApiClientProviderProps {
|
|
|
1373
1378
|
authToken?: string;
|
|
1374
1379
|
queryClient?: QueryClient;
|
|
1375
1380
|
}
|
|
1381
|
+
declare const ApiClientContext: React.Context<ApiClientContextValue | undefined>;
|
|
1376
1382
|
/**
|
|
1377
1383
|
* Combined provider for multiple API clients
|
|
1378
1384
|
* Includes QueryClientProvider for React Query hooks
|
|
@@ -1383,25 +1389,34 @@ declare function ApiClientProvider({ children, bookingLabBaseUrl, jrniBaseUrl, j
|
|
|
1383
1389
|
*/
|
|
1384
1390
|
declare function useApiClientContext(): ApiClientContextValue;
|
|
1385
1391
|
|
|
1392
|
+
interface BookingLabContextValue {
|
|
1393
|
+
client: BookingLabClient;
|
|
1394
|
+
}
|
|
1386
1395
|
interface BookingLabProviderProps {
|
|
1387
1396
|
children: ReactNode;
|
|
1388
1397
|
baseUrl: string;
|
|
1389
1398
|
authToken?: string;
|
|
1399
|
+
appId?: string;
|
|
1390
1400
|
}
|
|
1401
|
+
declare const BookingLabContext: React.Context<BookingLabContextValue | undefined>;
|
|
1391
1402
|
/**
|
|
1392
1403
|
* Provider component for BookingLab client
|
|
1393
1404
|
*/
|
|
1394
|
-
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;
|
|
1395
1406
|
/**
|
|
1396
1407
|
* Hook to access BookingLab client from context
|
|
1397
1408
|
*/
|
|
1398
1409
|
declare function useBookingLabContext(): BookingLabClient;
|
|
1399
1410
|
|
|
1411
|
+
interface JrniContextValue {
|
|
1412
|
+
client: JrniClient;
|
|
1413
|
+
}
|
|
1400
1414
|
interface JrniProviderProps {
|
|
1401
1415
|
children: ReactNode;
|
|
1402
1416
|
baseUrl: string;
|
|
1403
1417
|
config: JrniConfig;
|
|
1404
1418
|
}
|
|
1419
|
+
declare const JrniContext: React.Context<JrniContextValue | undefined>;
|
|
1405
1420
|
/**
|
|
1406
1421
|
* Provider component for JRNI client
|
|
1407
1422
|
*/
|
|
@@ -1598,4 +1613,4 @@ declare function useSendCustomEmail(companyId: number, clientToken: string): _ta
|
|
|
1598
1613
|
*/
|
|
1599
1614
|
declare function useBookingLabForgotPassword(companyId: number, clientToken: string): _tanstack_react_query.UseMutationResult<BookingLabForgotPasswordResponse, Error, BookingLabForgotPasswordRequest, unknown>;
|
|
1600
1615
|
|
|
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 };
|
|
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
|
);
|
|
@@ -331,11 +342,14 @@ var BookingLabClient = class extends ApiClient {
|
|
|
331
342
|
);
|
|
332
343
|
}
|
|
333
344
|
};
|
|
334
|
-
function createBookingLabClient(baseUrl, authToken) {
|
|
345
|
+
function createBookingLabClient(baseUrl, authToken, appId) {
|
|
335
346
|
const client = new BookingLabClient({ baseUrl });
|
|
336
347
|
if (authToken) {
|
|
337
348
|
client.setAuthToken(authToken);
|
|
338
349
|
}
|
|
350
|
+
if (appId) {
|
|
351
|
+
client.setAppId(appId);
|
|
352
|
+
}
|
|
339
353
|
return client;
|
|
340
354
|
}
|
|
341
355
|
|
|
@@ -704,8 +718,11 @@ function ApiClientProvider({
|
|
|
704
718
|
if (authToken) {
|
|
705
719
|
clientInstance.setAuthToken(authToken);
|
|
706
720
|
}
|
|
721
|
+
if (jrniConfig?.appId) {
|
|
722
|
+
clientInstance.setAppId(jrniConfig.appId);
|
|
723
|
+
}
|
|
707
724
|
return clientInstance;
|
|
708
|
-
}, [bookingLabBaseUrl, authToken]);
|
|
725
|
+
}, [bookingLabBaseUrl, authToken, jrniConfig?.appId]);
|
|
709
726
|
const jrniClient = react.useMemo(() => {
|
|
710
727
|
if (jrniBaseUrl && jrniConfig) {
|
|
711
728
|
return new JrniClient(jrniBaseUrl, jrniConfig);
|
|
@@ -732,15 +749,19 @@ var BookingLabContext = react.createContext(void 0);
|
|
|
732
749
|
function BookingLabProvider({
|
|
733
750
|
children,
|
|
734
751
|
baseUrl,
|
|
735
|
-
authToken
|
|
752
|
+
authToken,
|
|
753
|
+
appId
|
|
736
754
|
}) {
|
|
737
755
|
const client = react.useMemo(() => {
|
|
738
756
|
const clientInstance = new BookingLabClient({ baseUrl });
|
|
739
757
|
if (authToken) {
|
|
740
758
|
clientInstance.setAuthToken(authToken);
|
|
741
759
|
}
|
|
760
|
+
if (appId) {
|
|
761
|
+
clientInstance.setAppId(appId);
|
|
762
|
+
}
|
|
742
763
|
return clientInstance;
|
|
743
|
-
}, [baseUrl, authToken]);
|
|
764
|
+
}, [baseUrl, authToken, appId]);
|
|
744
765
|
const value = react.useMemo(() => ({ client }), [client]);
|
|
745
766
|
return /* @__PURE__ */ jsxRuntime.jsx(BookingLabContext.Provider, { value, children });
|
|
746
767
|
}
|
|
@@ -766,33 +787,31 @@ function useJrniContext() {
|
|
|
766
787
|
}
|
|
767
788
|
return context.client;
|
|
768
789
|
}
|
|
769
|
-
|
|
770
|
-
// src/hooks/useApiClient.ts
|
|
771
790
|
function useBookingLabClient() {
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
);
|
|
780
|
-
}
|
|
781
|
-
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;
|
|
782
798
|
}
|
|
799
|
+
throw new Error(
|
|
800
|
+
"BookingLab client not configured. Wrap your app with ApiClientProvider or BookingLabProvider."
|
|
801
|
+
);
|
|
783
802
|
}
|
|
784
803
|
function useJrniClient() {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
if (!context.jrniClient) {
|
|
790
|
-
throw new Error(
|
|
791
|
-
"JRNI client not configured. Wrap your app with ApiClientProvider or JrniProvider."
|
|
792
|
-
);
|
|
793
|
-
}
|
|
794
|
-
return context.jrniClient;
|
|
804
|
+
const standaloneContext = react.useContext(JrniContext);
|
|
805
|
+
const combinedContext = react.useContext(ApiClientContext);
|
|
806
|
+
if (standaloneContext) {
|
|
807
|
+
return standaloneContext.client;
|
|
795
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
|
+
);
|
|
796
815
|
}
|
|
797
816
|
function useLogin() {
|
|
798
817
|
const client = useJrniClient();
|
|
@@ -1052,10 +1071,13 @@ function useBookingLabForgotPassword(companyId, clientToken) {
|
|
|
1052
1071
|
}
|
|
1053
1072
|
|
|
1054
1073
|
exports.ApiClient = ApiClient;
|
|
1074
|
+
exports.ApiClientContext = ApiClientContext;
|
|
1055
1075
|
exports.ApiClientProvider = ApiClientProvider;
|
|
1056
1076
|
exports.BookingLabClient = BookingLabClient;
|
|
1077
|
+
exports.BookingLabContext = BookingLabContext;
|
|
1057
1078
|
exports.BookingLabProvider = BookingLabProvider;
|
|
1058
1079
|
exports.JrniClient = JrniClient;
|
|
1080
|
+
exports.JrniContext = JrniContext;
|
|
1059
1081
|
exports.JrniProvider = JrniProvider;
|
|
1060
1082
|
exports.MemberType = MemberType;
|
|
1061
1083
|
exports.createBookingLabClient = createBookingLabClient;
|