@bookinglab/booking-journey-api 1.0.0 → 1.1.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 +157 -11
- package/dist/index.d.mts +124 -2
- package/dist/index.d.ts +124 -2
- package/dist/index.js +216 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +205 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,6 +26,8 @@ npm install @tanstack/react-query
|
|
|
26
26
|
|
|
27
27
|
### Vanilla JavaScript/TypeScript
|
|
28
28
|
|
|
29
|
+
#### JRNI API
|
|
30
|
+
|
|
29
31
|
```typescript
|
|
30
32
|
import { createJrniClient } from '@bookinglab/booking-journey-api';
|
|
31
33
|
|
|
@@ -43,8 +45,32 @@ const response = await client.login({
|
|
|
43
45
|
console.log(response.data.auth_token);
|
|
44
46
|
```
|
|
45
47
|
|
|
48
|
+
#### BookingLab API
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import { createBookingLabClient } from '@bookinglab/booking-journey-api';
|
|
52
|
+
|
|
53
|
+
const client = createBookingLabClient({ baseUrl: 'https://api.bookinglab.com' });
|
|
54
|
+
client.setAuthToken('your-auth-token');
|
|
55
|
+
|
|
56
|
+
// Get bookings
|
|
57
|
+
const bookings = await client.getBookings();
|
|
58
|
+
|
|
59
|
+
// Get services
|
|
60
|
+
const services = await client.getServices();
|
|
61
|
+
|
|
62
|
+
// Create a booking
|
|
63
|
+
const newBooking = await client.createBooking({
|
|
64
|
+
userId: 'user-123',
|
|
65
|
+
serviceId: 'service-456',
|
|
66
|
+
date: '2024-01-15T10:00:00Z',
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
46
70
|
### React Applications
|
|
47
71
|
|
|
72
|
+
#### Single Provider (JRNI Only)
|
|
73
|
+
|
|
48
74
|
```tsx
|
|
49
75
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
50
76
|
import { JrniProvider, useLogin } from '@bookinglab/booking-journey-api';
|
|
@@ -82,9 +108,71 @@ function LoginForm() {
|
|
|
82
108
|
}
|
|
83
109
|
```
|
|
84
110
|
|
|
111
|
+
#### Single Provider (BookingLab Only)
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
115
|
+
import { BookingLabProvider, useBookings, useServices } from '@bookinglab/booking-journey-api';
|
|
116
|
+
|
|
117
|
+
const queryClient = new QueryClient();
|
|
118
|
+
|
|
119
|
+
function App() {
|
|
120
|
+
return (
|
|
121
|
+
<QueryClientProvider client={queryClient}>
|
|
122
|
+
<BookingLabProvider
|
|
123
|
+
baseUrl="https://api.bookinglab.com"
|
|
124
|
+
authToken="your-auth-token"
|
|
125
|
+
>
|
|
126
|
+
<Dashboard />
|
|
127
|
+
</BookingLabProvider>
|
|
128
|
+
</QueryClientProvider>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function Dashboard() {
|
|
133
|
+
const { data: bookings, isLoading } = useBookings();
|
|
134
|
+
const { data: services } = useServices();
|
|
135
|
+
|
|
136
|
+
if (isLoading) return <div>Loading...</div>;
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<div>
|
|
140
|
+
<h2>Bookings: {bookings?.length}</h2>
|
|
141
|
+
<h2>Services: {services?.length}</h2>
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
#### Combined Provider (Both APIs)
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
import { ApiClientProvider, useJrniClient, useBookingLabClient } from '@bookinglab/booking-journey-api';
|
|
151
|
+
|
|
152
|
+
function App() {
|
|
153
|
+
return (
|
|
154
|
+
<ApiClientProvider
|
|
155
|
+
bookingLabBaseUrl="https://api.bookinglab.com"
|
|
156
|
+
jrniBaseUrl="https://api.jrni.com"
|
|
157
|
+
jrniConfig={{ appId: 'your-app-id', appKey: 'your-app-key' }}
|
|
158
|
+
authToken="your-auth-token"
|
|
159
|
+
>
|
|
160
|
+
<YourApp />
|
|
161
|
+
</ApiClientProvider>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function YourApp() {
|
|
166
|
+
const jrniClient = useJrniClient();
|
|
167
|
+
const bookingLabClient = useBookingLabClient();
|
|
168
|
+
|
|
169
|
+
// Use both clients as needed
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
85
173
|
## API Reference
|
|
86
174
|
|
|
87
|
-
### Core
|
|
175
|
+
### Core Clients
|
|
88
176
|
|
|
89
177
|
#### `createJrniClient(baseUrl, config)`
|
|
90
178
|
|
|
@@ -97,9 +185,29 @@ const client = createJrniClient('https://api.jrni.com', {
|
|
|
97
185
|
});
|
|
98
186
|
```
|
|
99
187
|
|
|
100
|
-
|
|
101
|
-
|
|
188
|
+
**Methods:**
|
|
102
189
|
- `client.login(credentials)` - Authenticate a user
|
|
190
|
+
- `client.setAuthToken(token)` - Set auth token for subsequent requests
|
|
191
|
+
|
|
192
|
+
#### `createBookingLabClient(options)`
|
|
193
|
+
|
|
194
|
+
Creates a new BookingLab client instance.
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
const client = createBookingLabClient({ baseUrl: 'https://api.bookinglab.com' });
|
|
198
|
+
client.setAuthToken('your-auth-token');
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Methods:**
|
|
202
|
+
- `client.getBookings()` - Get all bookings
|
|
203
|
+
- `client.getBooking(id)` - Get a specific booking
|
|
204
|
+
- `client.createBooking(data)` - Create a new booking
|
|
205
|
+
- `client.updateBooking(id, data)` - Update a booking
|
|
206
|
+
- `client.cancelBooking(id)` - Cancel a booking
|
|
207
|
+
- `client.deleteBooking(id)` - Delete a booking
|
|
208
|
+
- `client.getServices()` - Get all services
|
|
209
|
+
- `client.getService(id)` - Get a specific service
|
|
210
|
+
- `client.setAuthToken(token)` - Set auth token for subsequent requests
|
|
103
211
|
|
|
104
212
|
### React Providers
|
|
105
213
|
|
|
@@ -116,14 +224,29 @@ Provides JRNI client context to React components.
|
|
|
116
224
|
</JrniProvider>
|
|
117
225
|
```
|
|
118
226
|
|
|
227
|
+
#### `BookingLabProvider`
|
|
228
|
+
|
|
229
|
+
Provides BookingLab client context to React components.
|
|
230
|
+
|
|
231
|
+
```tsx
|
|
232
|
+
<BookingLabProvider
|
|
233
|
+
baseUrl="https://api.bookinglab.com"
|
|
234
|
+
authToken="your-auth-token"
|
|
235
|
+
>
|
|
236
|
+
{children}
|
|
237
|
+
</BookingLabProvider>
|
|
238
|
+
```
|
|
239
|
+
|
|
119
240
|
#### `ApiClientProvider`
|
|
120
241
|
|
|
121
242
|
Combined provider for applications using multiple API clients.
|
|
122
243
|
|
|
123
244
|
```tsx
|
|
124
245
|
<ApiClientProvider
|
|
246
|
+
bookingLabBaseUrl="https://api.bookinglab.com"
|
|
125
247
|
jrniBaseUrl="https://api.jrni.com"
|
|
126
248
|
jrniConfig={{ appId: 'your-app-id', appKey: 'your-app-key' }}
|
|
249
|
+
authToken="your-auth-token"
|
|
127
250
|
>
|
|
128
251
|
{children}
|
|
129
252
|
</ApiClientProvider>
|
|
@@ -131,23 +254,41 @@ Combined provider for applications using multiple API clients.
|
|
|
131
254
|
|
|
132
255
|
### React Hooks
|
|
133
256
|
|
|
134
|
-
####
|
|
257
|
+
#### JRNI Hooks
|
|
135
258
|
|
|
136
|
-
Hook for user authentication
|
|
259
|
+
- `useLogin()` - Hook for user authentication
|
|
260
|
+
- `useJrniClient()` - Access the JRNI client directly
|
|
137
261
|
|
|
138
262
|
```typescript
|
|
139
|
-
const
|
|
263
|
+
const loginMutation = useLogin();
|
|
264
|
+
loginMutation.mutate({ email: 'user@example.com', password: 'password' });
|
|
140
265
|
|
|
141
|
-
|
|
266
|
+
const client = useJrniClient();
|
|
142
267
|
```
|
|
143
268
|
|
|
144
|
-
####
|
|
269
|
+
#### BookingLab Hooks
|
|
145
270
|
|
|
146
|
-
|
|
271
|
+
- `useBookings()` - Get all bookings
|
|
272
|
+
- `useBooking(id)` - Get a specific booking
|
|
273
|
+
- `useCreateBooking()` - Create a new booking
|
|
274
|
+
- `useUpdateBooking()` - Update a booking
|
|
275
|
+
- `useCancelBooking()` - Cancel a booking
|
|
276
|
+
- `useServices()` - Get all services
|
|
277
|
+
- `useService(id)` - Get a specific service
|
|
278
|
+
- `useBookingLabClient()` - Access the BookingLab client directly
|
|
147
279
|
|
|
148
280
|
```typescript
|
|
149
|
-
const
|
|
150
|
-
const
|
|
281
|
+
const { data: bookings, isLoading } = useBookings();
|
|
282
|
+
const { data: services } = useServices();
|
|
283
|
+
const createBookingMutation = useCreateBooking();
|
|
284
|
+
|
|
285
|
+
createBookingMutation.mutate({
|
|
286
|
+
userId: 'user-123',
|
|
287
|
+
serviceId: 'service-456',
|
|
288
|
+
date: '2024-01-15T10:00:00Z',
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
const client = useBookingLabClient();
|
|
151
292
|
```
|
|
152
293
|
|
|
153
294
|
## Types
|
|
@@ -156,6 +297,7 @@ The library exports comprehensive TypeScript types:
|
|
|
156
297
|
|
|
157
298
|
```typescript
|
|
158
299
|
import type {
|
|
300
|
+
// JRNI Types
|
|
159
301
|
LoginRequest,
|
|
160
302
|
LoginResponse,
|
|
161
303
|
JrniService,
|
|
@@ -170,6 +312,10 @@ import type {
|
|
|
170
312
|
MemberBookingsResponse,
|
|
171
313
|
AvailabilityTime,
|
|
172
314
|
AvailabilityTimesResponse,
|
|
315
|
+
// BookingLab Types
|
|
316
|
+
Booking,
|
|
317
|
+
CreateBookingRequest,
|
|
318
|
+
Service,
|
|
173
319
|
} from '@bookinglab/booking-journey-api';
|
|
174
320
|
```
|
|
175
321
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Core API Client Types
|
|
@@ -24,6 +25,28 @@ interface ApiError {
|
|
|
24
25
|
code?: string;
|
|
25
26
|
details?: any;
|
|
26
27
|
}
|
|
28
|
+
interface Booking {
|
|
29
|
+
id: string;
|
|
30
|
+
userId: string;
|
|
31
|
+
serviceId: string;
|
|
32
|
+
date: string;
|
|
33
|
+
status: 'pending' | 'confirmed' | 'cancelled';
|
|
34
|
+
createdAt: string;
|
|
35
|
+
updatedAt: string;
|
|
36
|
+
}
|
|
37
|
+
interface CreateBookingRequest {
|
|
38
|
+
userId: string;
|
|
39
|
+
serviceId: string;
|
|
40
|
+
date: string;
|
|
41
|
+
notes?: string;
|
|
42
|
+
}
|
|
43
|
+
interface Service {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
description: string;
|
|
47
|
+
duration: number;
|
|
48
|
+
price: number;
|
|
49
|
+
}
|
|
27
50
|
/**
|
|
28
51
|
* JRNI Configuration
|
|
29
52
|
*/
|
|
@@ -334,6 +357,50 @@ declare class ApiClient {
|
|
|
334
357
|
private normalizeError;
|
|
335
358
|
}
|
|
336
359
|
|
|
360
|
+
/**
|
|
361
|
+
* BookingLab API Client
|
|
362
|
+
* Provides methods for interacting with the BookingLab API
|
|
363
|
+
*/
|
|
364
|
+
|
|
365
|
+
declare class BookingLabClient extends ApiClient {
|
|
366
|
+
/**
|
|
367
|
+
* Get all bookings
|
|
368
|
+
*/
|
|
369
|
+
getBookings(userId?: string): Promise<ApiResponse<Booking[]>>;
|
|
370
|
+
/**
|
|
371
|
+
* Get a single booking by ID
|
|
372
|
+
*/
|
|
373
|
+
getBooking(bookingId: string): Promise<ApiResponse<Booking>>;
|
|
374
|
+
/**
|
|
375
|
+
* Create a new booking
|
|
376
|
+
*/
|
|
377
|
+
createBooking(booking: CreateBookingRequest): Promise<ApiResponse<Booking>>;
|
|
378
|
+
/**
|
|
379
|
+
* Update an existing booking
|
|
380
|
+
*/
|
|
381
|
+
updateBooking(bookingId: string, updates: Partial<Booking>): Promise<ApiResponse<Booking>>;
|
|
382
|
+
/**
|
|
383
|
+
* Cancel a booking
|
|
384
|
+
*/
|
|
385
|
+
cancelBooking(bookingId: string): Promise<ApiResponse<Booking>>;
|
|
386
|
+
/**
|
|
387
|
+
* Delete a booking
|
|
388
|
+
*/
|
|
389
|
+
deleteBooking(bookingId: string): Promise<ApiResponse<void>>;
|
|
390
|
+
/**
|
|
391
|
+
* Get all services
|
|
392
|
+
*/
|
|
393
|
+
getServices(): Promise<ApiResponse<Service[]>>;
|
|
394
|
+
/**
|
|
395
|
+
* Get a single service by ID
|
|
396
|
+
*/
|
|
397
|
+
getService(serviceId: string): Promise<ApiResponse<Service>>;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Create a new BookingLab client instance
|
|
401
|
+
*/
|
|
402
|
+
declare function createBookingLabClient(baseUrl: string, authToken?: string): BookingLabClient;
|
|
403
|
+
|
|
337
404
|
/**
|
|
338
405
|
* JRNI API Client
|
|
339
406
|
* Provides methods for interacting with the JRNI API
|
|
@@ -358,22 +425,41 @@ declare class JrniClient extends ApiClient {
|
|
|
358
425
|
declare function createJrniClient(baseUrl: string, config: JrniConfig): JrniClient;
|
|
359
426
|
|
|
360
427
|
interface ApiClientContextValue {
|
|
428
|
+
bookingLabClient: BookingLabClient | null;
|
|
361
429
|
jrniClient: JrniClient | null;
|
|
362
430
|
}
|
|
363
431
|
interface ApiClientProviderProps {
|
|
364
432
|
children: ReactNode;
|
|
433
|
+
bookingLabBaseUrl?: string;
|
|
365
434
|
jrniBaseUrl?: string;
|
|
366
435
|
jrniConfig?: JrniConfig;
|
|
436
|
+
authToken?: string;
|
|
437
|
+
queryClient?: QueryClient;
|
|
367
438
|
}
|
|
368
439
|
/**
|
|
369
440
|
* Combined provider for multiple API clients
|
|
441
|
+
* Includes QueryClientProvider for React Query hooks
|
|
370
442
|
*/
|
|
371
|
-
declare function ApiClientProvider({ children, jrniBaseUrl, jrniConfig, }: ApiClientProviderProps): react_jsx_runtime.JSX.Element;
|
|
443
|
+
declare function ApiClientProvider({ children, bookingLabBaseUrl, jrniBaseUrl, jrniConfig, authToken, queryClient, }: ApiClientProviderProps): react_jsx_runtime.JSX.Element;
|
|
372
444
|
/**
|
|
373
445
|
* Hook to access API client context
|
|
374
446
|
*/
|
|
375
447
|
declare function useApiClientContext(): ApiClientContextValue;
|
|
376
448
|
|
|
449
|
+
interface BookingLabProviderProps {
|
|
450
|
+
children: ReactNode;
|
|
451
|
+
baseUrl: string;
|
|
452
|
+
authToken?: string;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Provider component for BookingLab client
|
|
456
|
+
*/
|
|
457
|
+
declare function BookingLabProvider({ children, baseUrl, authToken, }: BookingLabProviderProps): react_jsx_runtime.JSX.Element;
|
|
458
|
+
/**
|
|
459
|
+
* Hook to access BookingLab client from context
|
|
460
|
+
*/
|
|
461
|
+
declare function useBookingLabContext(): BookingLabClient;
|
|
462
|
+
|
|
377
463
|
interface JrniProviderProps {
|
|
378
464
|
children: ReactNode;
|
|
379
465
|
baseUrl: string;
|
|
@@ -391,6 +477,10 @@ declare function useJrniContext(): JrniClient;
|
|
|
391
477
|
/**
|
|
392
478
|
* Hook to access API clients from context
|
|
393
479
|
*/
|
|
480
|
+
/**
|
|
481
|
+
* Hook to get BookingLab client from either ApiClientProvider or BookingLabProvider
|
|
482
|
+
*/
|
|
483
|
+
declare function useBookingLabClient(): BookingLabClient;
|
|
394
484
|
/**
|
|
395
485
|
* Hook to get JRNI client from either ApiClientProvider or JrniProvider
|
|
396
486
|
*/
|
|
@@ -401,4 +491,36 @@ declare function useJrniClient(): JrniClient;
|
|
|
401
491
|
*/
|
|
402
492
|
declare function useLogin(): _tanstack_react_query.UseMutationResult<LoginResponse, Error, LoginRequest, unknown>;
|
|
403
493
|
|
|
404
|
-
|
|
494
|
+
/**
|
|
495
|
+
* Hook to fetch bookings
|
|
496
|
+
*/
|
|
497
|
+
declare function useBookings(userId?: string): _tanstack_react_query.UseQueryResult<Booking[], Error>;
|
|
498
|
+
/**
|
|
499
|
+
* Hook to fetch a single booking
|
|
500
|
+
*/
|
|
501
|
+
declare function useBooking(bookingId: string): _tanstack_react_query.UseQueryResult<Booking, Error>;
|
|
502
|
+
/**
|
|
503
|
+
* Hook to create a booking
|
|
504
|
+
*/
|
|
505
|
+
declare function useCreateBooking(): _tanstack_react_query.UseMutationResult<Booking, Error, CreateBookingRequest, unknown>;
|
|
506
|
+
/**
|
|
507
|
+
* Hook to update a booking
|
|
508
|
+
*/
|
|
509
|
+
declare function useUpdateBooking(): _tanstack_react_query.UseMutationResult<Booking, Error, {
|
|
510
|
+
id: string;
|
|
511
|
+
updates: Partial<Booking>;
|
|
512
|
+
}, unknown>;
|
|
513
|
+
/**
|
|
514
|
+
* Hook to cancel a booking
|
|
515
|
+
*/
|
|
516
|
+
declare function useCancelBooking(): _tanstack_react_query.UseMutationResult<Booking, Error, string, unknown>;
|
|
517
|
+
/**
|
|
518
|
+
* Hook to fetch services
|
|
519
|
+
*/
|
|
520
|
+
declare function useServices(): _tanstack_react_query.UseQueryResult<Service[], Error>;
|
|
521
|
+
/**
|
|
522
|
+
* Hook to fetch a single service
|
|
523
|
+
*/
|
|
524
|
+
declare function useService(serviceId: string): _tanstack_react_query.UseQueryResult<Service, Error>;
|
|
525
|
+
|
|
526
|
+
export { type AddBasketItemRequest, ApiClient, type ApiClientConfig, ApiClientProvider, type ApiError, type ApiResponse, type AvailabilityTime, type AvailabilityTimesResponse, type Booking, BookingLabClient, BookingLabProvider, type CreateBookingRequest, type JrniBooking, JrniClient, type JrniConfig, JrniProvider, type JrniService, type Location, type LocationsResponse, type LoginRequest, type LoginResponse, type MemberBookingsResponse, type PersonImage, type PersonImagesResponse, type Question, type QuestionOption, type QuestionsResponse, type RequestOptions, type Service, type ServicesResponse, type UpdateClientDetailsData, type UpdateMemberDetailsData, type Vehicle, type VehiclesResponse, createBookingLabClient, createJrniClient, useApiClientContext, useBooking, useBookingLabClient, useBookingLabContext, useBookings, useCancelBooking, useCreateBooking, useJrniClient, useJrniContext, useLogin, useService, useServices, useUpdateBooking };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Core API Client Types
|
|
@@ -24,6 +25,28 @@ interface ApiError {
|
|
|
24
25
|
code?: string;
|
|
25
26
|
details?: any;
|
|
26
27
|
}
|
|
28
|
+
interface Booking {
|
|
29
|
+
id: string;
|
|
30
|
+
userId: string;
|
|
31
|
+
serviceId: string;
|
|
32
|
+
date: string;
|
|
33
|
+
status: 'pending' | 'confirmed' | 'cancelled';
|
|
34
|
+
createdAt: string;
|
|
35
|
+
updatedAt: string;
|
|
36
|
+
}
|
|
37
|
+
interface CreateBookingRequest {
|
|
38
|
+
userId: string;
|
|
39
|
+
serviceId: string;
|
|
40
|
+
date: string;
|
|
41
|
+
notes?: string;
|
|
42
|
+
}
|
|
43
|
+
interface Service {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
description: string;
|
|
47
|
+
duration: number;
|
|
48
|
+
price: number;
|
|
49
|
+
}
|
|
27
50
|
/**
|
|
28
51
|
* JRNI Configuration
|
|
29
52
|
*/
|
|
@@ -334,6 +357,50 @@ declare class ApiClient {
|
|
|
334
357
|
private normalizeError;
|
|
335
358
|
}
|
|
336
359
|
|
|
360
|
+
/**
|
|
361
|
+
* BookingLab API Client
|
|
362
|
+
* Provides methods for interacting with the BookingLab API
|
|
363
|
+
*/
|
|
364
|
+
|
|
365
|
+
declare class BookingLabClient extends ApiClient {
|
|
366
|
+
/**
|
|
367
|
+
* Get all bookings
|
|
368
|
+
*/
|
|
369
|
+
getBookings(userId?: string): Promise<ApiResponse<Booking[]>>;
|
|
370
|
+
/**
|
|
371
|
+
* Get a single booking by ID
|
|
372
|
+
*/
|
|
373
|
+
getBooking(bookingId: string): Promise<ApiResponse<Booking>>;
|
|
374
|
+
/**
|
|
375
|
+
* Create a new booking
|
|
376
|
+
*/
|
|
377
|
+
createBooking(booking: CreateBookingRequest): Promise<ApiResponse<Booking>>;
|
|
378
|
+
/**
|
|
379
|
+
* Update an existing booking
|
|
380
|
+
*/
|
|
381
|
+
updateBooking(bookingId: string, updates: Partial<Booking>): Promise<ApiResponse<Booking>>;
|
|
382
|
+
/**
|
|
383
|
+
* Cancel a booking
|
|
384
|
+
*/
|
|
385
|
+
cancelBooking(bookingId: string): Promise<ApiResponse<Booking>>;
|
|
386
|
+
/**
|
|
387
|
+
* Delete a booking
|
|
388
|
+
*/
|
|
389
|
+
deleteBooking(bookingId: string): Promise<ApiResponse<void>>;
|
|
390
|
+
/**
|
|
391
|
+
* Get all services
|
|
392
|
+
*/
|
|
393
|
+
getServices(): Promise<ApiResponse<Service[]>>;
|
|
394
|
+
/**
|
|
395
|
+
* Get a single service by ID
|
|
396
|
+
*/
|
|
397
|
+
getService(serviceId: string): Promise<ApiResponse<Service>>;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Create a new BookingLab client instance
|
|
401
|
+
*/
|
|
402
|
+
declare function createBookingLabClient(baseUrl: string, authToken?: string): BookingLabClient;
|
|
403
|
+
|
|
337
404
|
/**
|
|
338
405
|
* JRNI API Client
|
|
339
406
|
* Provides methods for interacting with the JRNI API
|
|
@@ -358,22 +425,41 @@ declare class JrniClient extends ApiClient {
|
|
|
358
425
|
declare function createJrniClient(baseUrl: string, config: JrniConfig): JrniClient;
|
|
359
426
|
|
|
360
427
|
interface ApiClientContextValue {
|
|
428
|
+
bookingLabClient: BookingLabClient | null;
|
|
361
429
|
jrniClient: JrniClient | null;
|
|
362
430
|
}
|
|
363
431
|
interface ApiClientProviderProps {
|
|
364
432
|
children: ReactNode;
|
|
433
|
+
bookingLabBaseUrl?: string;
|
|
365
434
|
jrniBaseUrl?: string;
|
|
366
435
|
jrniConfig?: JrniConfig;
|
|
436
|
+
authToken?: string;
|
|
437
|
+
queryClient?: QueryClient;
|
|
367
438
|
}
|
|
368
439
|
/**
|
|
369
440
|
* Combined provider for multiple API clients
|
|
441
|
+
* Includes QueryClientProvider for React Query hooks
|
|
370
442
|
*/
|
|
371
|
-
declare function ApiClientProvider({ children, jrniBaseUrl, jrniConfig, }: ApiClientProviderProps): react_jsx_runtime.JSX.Element;
|
|
443
|
+
declare function ApiClientProvider({ children, bookingLabBaseUrl, jrniBaseUrl, jrniConfig, authToken, queryClient, }: ApiClientProviderProps): react_jsx_runtime.JSX.Element;
|
|
372
444
|
/**
|
|
373
445
|
* Hook to access API client context
|
|
374
446
|
*/
|
|
375
447
|
declare function useApiClientContext(): ApiClientContextValue;
|
|
376
448
|
|
|
449
|
+
interface BookingLabProviderProps {
|
|
450
|
+
children: ReactNode;
|
|
451
|
+
baseUrl: string;
|
|
452
|
+
authToken?: string;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Provider component for BookingLab client
|
|
456
|
+
*/
|
|
457
|
+
declare function BookingLabProvider({ children, baseUrl, authToken, }: BookingLabProviderProps): react_jsx_runtime.JSX.Element;
|
|
458
|
+
/**
|
|
459
|
+
* Hook to access BookingLab client from context
|
|
460
|
+
*/
|
|
461
|
+
declare function useBookingLabContext(): BookingLabClient;
|
|
462
|
+
|
|
377
463
|
interface JrniProviderProps {
|
|
378
464
|
children: ReactNode;
|
|
379
465
|
baseUrl: string;
|
|
@@ -391,6 +477,10 @@ declare function useJrniContext(): JrniClient;
|
|
|
391
477
|
/**
|
|
392
478
|
* Hook to access API clients from context
|
|
393
479
|
*/
|
|
480
|
+
/**
|
|
481
|
+
* Hook to get BookingLab client from either ApiClientProvider or BookingLabProvider
|
|
482
|
+
*/
|
|
483
|
+
declare function useBookingLabClient(): BookingLabClient;
|
|
394
484
|
/**
|
|
395
485
|
* Hook to get JRNI client from either ApiClientProvider or JrniProvider
|
|
396
486
|
*/
|
|
@@ -401,4 +491,36 @@ declare function useJrniClient(): JrniClient;
|
|
|
401
491
|
*/
|
|
402
492
|
declare function useLogin(): _tanstack_react_query.UseMutationResult<LoginResponse, Error, LoginRequest, unknown>;
|
|
403
493
|
|
|
404
|
-
|
|
494
|
+
/**
|
|
495
|
+
* Hook to fetch bookings
|
|
496
|
+
*/
|
|
497
|
+
declare function useBookings(userId?: string): _tanstack_react_query.UseQueryResult<Booking[], Error>;
|
|
498
|
+
/**
|
|
499
|
+
* Hook to fetch a single booking
|
|
500
|
+
*/
|
|
501
|
+
declare function useBooking(bookingId: string): _tanstack_react_query.UseQueryResult<Booking, Error>;
|
|
502
|
+
/**
|
|
503
|
+
* Hook to create a booking
|
|
504
|
+
*/
|
|
505
|
+
declare function useCreateBooking(): _tanstack_react_query.UseMutationResult<Booking, Error, CreateBookingRequest, unknown>;
|
|
506
|
+
/**
|
|
507
|
+
* Hook to update a booking
|
|
508
|
+
*/
|
|
509
|
+
declare function useUpdateBooking(): _tanstack_react_query.UseMutationResult<Booking, Error, {
|
|
510
|
+
id: string;
|
|
511
|
+
updates: Partial<Booking>;
|
|
512
|
+
}, unknown>;
|
|
513
|
+
/**
|
|
514
|
+
* Hook to cancel a booking
|
|
515
|
+
*/
|
|
516
|
+
declare function useCancelBooking(): _tanstack_react_query.UseMutationResult<Booking, Error, string, unknown>;
|
|
517
|
+
/**
|
|
518
|
+
* Hook to fetch services
|
|
519
|
+
*/
|
|
520
|
+
declare function useServices(): _tanstack_react_query.UseQueryResult<Service[], Error>;
|
|
521
|
+
/**
|
|
522
|
+
* Hook to fetch a single service
|
|
523
|
+
*/
|
|
524
|
+
declare function useService(serviceId: string): _tanstack_react_query.UseQueryResult<Service, Error>;
|
|
525
|
+
|
|
526
|
+
export { type AddBasketItemRequest, ApiClient, type ApiClientConfig, ApiClientProvider, type ApiError, type ApiResponse, type AvailabilityTime, type AvailabilityTimesResponse, type Booking, BookingLabClient, BookingLabProvider, type CreateBookingRequest, type JrniBooking, JrniClient, type JrniConfig, JrniProvider, type JrniService, type Location, type LocationsResponse, type LoginRequest, type LoginResponse, type MemberBookingsResponse, type PersonImage, type PersonImagesResponse, type Question, type QuestionOption, type QuestionsResponse, type RequestOptions, type Service, type ServicesResponse, type UpdateClientDetailsData, type UpdateMemberDetailsData, type Vehicle, type VehiclesResponse, createBookingLabClient, createJrniClient, useApiClientContext, useBooking, useBookingLabClient, useBookingLabContext, useBookings, useCancelBooking, useCreateBooking, useJrniClient, useJrniContext, useLogin, useService, useServices, useUpdateBooking };
|