@bookinglab/booking-journey-api 1.0.1 → 1.2.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 +172 -11
- package/dist/index.d.mts +252 -2
- package/dist/index.d.ts +252 -2
- package/dist/index.js +269 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +257 -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,31 @@ 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.getChildCompanies(companyId, params?)` - Get child companies for a parent company
|
|
191
|
+
- `client.getResources(companyId)` - Get bookable resources for a company
|
|
192
|
+
- `client.setAuthToken(token)` - Set auth token for subsequent requests
|
|
193
|
+
|
|
194
|
+
#### `createBookingLabClient(options)`
|
|
195
|
+
|
|
196
|
+
Creates a new BookingLab client instance.
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
const client = createBookingLabClient({ baseUrl: 'https://api.bookinglab.com' });
|
|
200
|
+
client.setAuthToken('your-auth-token');
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**Methods:**
|
|
204
|
+
- `client.getBookings()` - Get all bookings
|
|
205
|
+
- `client.getBooking(id)` - Get a specific booking
|
|
206
|
+
- `client.createBooking(data)` - Create a new booking
|
|
207
|
+
- `client.updateBooking(id, data)` - Update a booking
|
|
208
|
+
- `client.cancelBooking(id)` - Cancel a booking
|
|
209
|
+
- `client.deleteBooking(id)` - Delete a booking
|
|
210
|
+
- `client.getServices()` - Get all services
|
|
211
|
+
- `client.getService(id)` - Get a specific service
|
|
212
|
+
- `client.setAuthToken(token)` - Set auth token for subsequent requests
|
|
103
213
|
|
|
104
214
|
### React Providers
|
|
105
215
|
|
|
@@ -116,14 +226,29 @@ Provides JRNI client context to React components.
|
|
|
116
226
|
</JrniProvider>
|
|
117
227
|
```
|
|
118
228
|
|
|
229
|
+
#### `BookingLabProvider`
|
|
230
|
+
|
|
231
|
+
Provides BookingLab client context to React components.
|
|
232
|
+
|
|
233
|
+
```tsx
|
|
234
|
+
<BookingLabProvider
|
|
235
|
+
baseUrl="https://api.bookinglab.com"
|
|
236
|
+
authToken="your-auth-token"
|
|
237
|
+
>
|
|
238
|
+
{children}
|
|
239
|
+
</BookingLabProvider>
|
|
240
|
+
```
|
|
241
|
+
|
|
119
242
|
#### `ApiClientProvider`
|
|
120
243
|
|
|
121
244
|
Combined provider for applications using multiple API clients.
|
|
122
245
|
|
|
123
246
|
```tsx
|
|
124
247
|
<ApiClientProvider
|
|
248
|
+
bookingLabBaseUrl="https://api.bookinglab.com"
|
|
125
249
|
jrniBaseUrl="https://api.jrni.com"
|
|
126
250
|
jrniConfig={{ appId: 'your-app-id', appKey: 'your-app-key' }}
|
|
251
|
+
authToken="your-auth-token"
|
|
127
252
|
>
|
|
128
253
|
{children}
|
|
129
254
|
</ApiClientProvider>
|
|
@@ -131,23 +256,46 @@ Combined provider for applications using multiple API clients.
|
|
|
131
256
|
|
|
132
257
|
### React Hooks
|
|
133
258
|
|
|
134
|
-
####
|
|
259
|
+
#### JRNI Hooks
|
|
135
260
|
|
|
136
|
-
Hook for user authentication
|
|
261
|
+
- `useLogin()` - Hook for user authentication
|
|
262
|
+
- `useChildCompanies(companyId, params?, enabled?)` - Get child companies
|
|
263
|
+
- `useResources(companyId, enabled?)` - Get bookable resources
|
|
264
|
+
- `useJrniClient()` - Access the JRNI client directly
|
|
137
265
|
|
|
138
266
|
```typescript
|
|
139
|
-
const
|
|
267
|
+
const loginMutation = useLogin();
|
|
268
|
+
loginMutation.mutate({ email: 'user@example.com', password: 'password' });
|
|
140
269
|
|
|
141
|
-
|
|
270
|
+
const { data: childCompanies } = useChildCompanies(37000);
|
|
271
|
+
const { data: resources } = useResources(37000);
|
|
272
|
+
|
|
273
|
+
const client = useJrniClient();
|
|
142
274
|
```
|
|
143
275
|
|
|
144
|
-
####
|
|
276
|
+
#### BookingLab Hooks
|
|
145
277
|
|
|
146
|
-
|
|
278
|
+
- `useBookings()` - Get all bookings
|
|
279
|
+
- `useBooking(id)` - Get a specific booking
|
|
280
|
+
- `useCreateBooking()` - Create a new booking
|
|
281
|
+
- `useUpdateBooking()` - Update a booking
|
|
282
|
+
- `useCancelBooking()` - Cancel a booking
|
|
283
|
+
- `useServices()` - Get all services
|
|
284
|
+
- `useService(id)` - Get a specific service
|
|
285
|
+
- `useBookingLabClient()` - Access the BookingLab client directly
|
|
147
286
|
|
|
148
287
|
```typescript
|
|
149
|
-
const
|
|
150
|
-
const
|
|
288
|
+
const { data: bookings, isLoading } = useBookings();
|
|
289
|
+
const { data: services } = useServices();
|
|
290
|
+
const createBookingMutation = useCreateBooking();
|
|
291
|
+
|
|
292
|
+
createBookingMutation.mutate({
|
|
293
|
+
userId: 'user-123',
|
|
294
|
+
serviceId: 'service-456',
|
|
295
|
+
date: '2024-01-15T10:00:00Z',
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
const client = useBookingLabClient();
|
|
151
299
|
```
|
|
152
300
|
|
|
153
301
|
## Types
|
|
@@ -156,8 +304,17 @@ The library exports comprehensive TypeScript types:
|
|
|
156
304
|
|
|
157
305
|
```typescript
|
|
158
306
|
import type {
|
|
307
|
+
// JRNI Types
|
|
159
308
|
LoginRequest,
|
|
160
309
|
LoginResponse,
|
|
310
|
+
ChildCompany,
|
|
311
|
+
ChildCompanyAddress,
|
|
312
|
+
ChildCompanySettings,
|
|
313
|
+
ChildCompaniesResponse,
|
|
314
|
+
GetChildCompaniesParams,
|
|
315
|
+
Resource,
|
|
316
|
+
ResourceLinks,
|
|
317
|
+
ResourcesResponse,
|
|
161
318
|
JrniService,
|
|
162
319
|
ServicesResponse,
|
|
163
320
|
Question,
|
|
@@ -170,6 +327,10 @@ import type {
|
|
|
170
327
|
MemberBookingsResponse,
|
|
171
328
|
AvailabilityTime,
|
|
172
329
|
AvailabilityTimesResponse,
|
|
330
|
+
// BookingLab Types
|
|
331
|
+
Booking,
|
|
332
|
+
CreateBookingRequest,
|
|
333
|
+
Service,
|
|
173
334
|
} from '@bookinglab/booking-journey-api';
|
|
174
335
|
```
|
|
175
336
|
|
package/dist/index.d.mts
CHANGED
|
@@ -25,6 +25,28 @@ interface ApiError {
|
|
|
25
25
|
code?: string;
|
|
26
26
|
details?: any;
|
|
27
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
|
+
}
|
|
28
50
|
/**
|
|
29
51
|
* JRNI Configuration
|
|
30
52
|
*/
|
|
@@ -286,6 +308,109 @@ interface UpdateMemberDetailsData {
|
|
|
286
308
|
answer_id: number;
|
|
287
309
|
}>;
|
|
288
310
|
}
|
|
311
|
+
/**
|
|
312
|
+
* Child Company Types
|
|
313
|
+
*/
|
|
314
|
+
interface ChildCompanyAddress {
|
|
315
|
+
id: number;
|
|
316
|
+
address1: string;
|
|
317
|
+
address2: string;
|
|
318
|
+
address3: string;
|
|
319
|
+
address4: string;
|
|
320
|
+
address5: string;
|
|
321
|
+
postcode: string;
|
|
322
|
+
country: string;
|
|
323
|
+
lat: number;
|
|
324
|
+
long: number;
|
|
325
|
+
map_url: string;
|
|
326
|
+
map_marker: string;
|
|
327
|
+
phone: string;
|
|
328
|
+
homephone: string;
|
|
329
|
+
pretty_workphone: string;
|
|
330
|
+
_links: Record<string, any>;
|
|
331
|
+
}
|
|
332
|
+
interface ChildCompanySettings {
|
|
333
|
+
has_services: boolean;
|
|
334
|
+
has_resources: boolean;
|
|
335
|
+
has_groups: boolean;
|
|
336
|
+
payment_tax: number;
|
|
337
|
+
currency: string;
|
|
338
|
+
requires_login: boolean;
|
|
339
|
+
has_wallets: boolean;
|
|
340
|
+
has_question_groups: boolean;
|
|
341
|
+
_links: Record<string, any>;
|
|
342
|
+
}
|
|
343
|
+
interface ChildCompany {
|
|
344
|
+
id: number;
|
|
345
|
+
name: string;
|
|
346
|
+
description: string;
|
|
347
|
+
company_type: string;
|
|
348
|
+
address_id: number;
|
|
349
|
+
website: string;
|
|
350
|
+
multi_status: string[];
|
|
351
|
+
numeric_widget_id: number;
|
|
352
|
+
currency_code: string;
|
|
353
|
+
timezone: string;
|
|
354
|
+
country_code: string;
|
|
355
|
+
live: boolean;
|
|
356
|
+
ref: string;
|
|
357
|
+
created_at: string;
|
|
358
|
+
updated_at: string;
|
|
359
|
+
children_count: number;
|
|
360
|
+
locale: string;
|
|
361
|
+
available_locales: string[];
|
|
362
|
+
membership_id: number;
|
|
363
|
+
address: ChildCompanyAddress;
|
|
364
|
+
_embedded: {
|
|
365
|
+
settings: ChildCompanySettings;
|
|
366
|
+
};
|
|
367
|
+
_links: Record<string, any>;
|
|
368
|
+
}
|
|
369
|
+
interface ChildCompaniesResponse {
|
|
370
|
+
total_entries: number;
|
|
371
|
+
_embedded: {
|
|
372
|
+
companies: ChildCompany[];
|
|
373
|
+
};
|
|
374
|
+
_links: Record<string, any>;
|
|
375
|
+
}
|
|
376
|
+
interface GetChildCompaniesParams {
|
|
377
|
+
person_id?: number;
|
|
378
|
+
Person_Id?: string;
|
|
379
|
+
service_id?: string;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Resource Types
|
|
383
|
+
*/
|
|
384
|
+
interface ResourceLinks {
|
|
385
|
+
self: {
|
|
386
|
+
href: string;
|
|
387
|
+
};
|
|
388
|
+
items: {
|
|
389
|
+
href: string;
|
|
390
|
+
};
|
|
391
|
+
images: {
|
|
392
|
+
href: string;
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
interface Resource {
|
|
396
|
+
id: number;
|
|
397
|
+
name: string;
|
|
398
|
+
type: string;
|
|
399
|
+
group_id: number;
|
|
400
|
+
deleted: boolean;
|
|
401
|
+
disabled: boolean;
|
|
402
|
+
company_id: number;
|
|
403
|
+
order: number;
|
|
404
|
+
max_book: number;
|
|
405
|
+
_links: ResourceLinks;
|
|
406
|
+
}
|
|
407
|
+
interface ResourcesResponse {
|
|
408
|
+
total_entries: number;
|
|
409
|
+
_embedded: {
|
|
410
|
+
resources: Resource[];
|
|
411
|
+
};
|
|
412
|
+
_links: Record<string, any>;
|
|
413
|
+
}
|
|
289
414
|
|
|
290
415
|
/**
|
|
291
416
|
* Core API Client
|
|
@@ -335,6 +460,50 @@ declare class ApiClient {
|
|
|
335
460
|
private normalizeError;
|
|
336
461
|
}
|
|
337
462
|
|
|
463
|
+
/**
|
|
464
|
+
* BookingLab API Client
|
|
465
|
+
* Provides methods for interacting with the BookingLab API
|
|
466
|
+
*/
|
|
467
|
+
|
|
468
|
+
declare class BookingLabClient extends ApiClient {
|
|
469
|
+
/**
|
|
470
|
+
* Get all bookings
|
|
471
|
+
*/
|
|
472
|
+
getBookings(userId?: string): Promise<ApiResponse<Booking[]>>;
|
|
473
|
+
/**
|
|
474
|
+
* Get a single booking by ID
|
|
475
|
+
*/
|
|
476
|
+
getBooking(bookingId: string): Promise<ApiResponse<Booking>>;
|
|
477
|
+
/**
|
|
478
|
+
* Create a new booking
|
|
479
|
+
*/
|
|
480
|
+
createBooking(booking: CreateBookingRequest): Promise<ApiResponse<Booking>>;
|
|
481
|
+
/**
|
|
482
|
+
* Update an existing booking
|
|
483
|
+
*/
|
|
484
|
+
updateBooking(bookingId: string, updates: Partial<Booking>): Promise<ApiResponse<Booking>>;
|
|
485
|
+
/**
|
|
486
|
+
* Cancel a booking
|
|
487
|
+
*/
|
|
488
|
+
cancelBooking(bookingId: string): Promise<ApiResponse<Booking>>;
|
|
489
|
+
/**
|
|
490
|
+
* Delete a booking
|
|
491
|
+
*/
|
|
492
|
+
deleteBooking(bookingId: string): Promise<ApiResponse<void>>;
|
|
493
|
+
/**
|
|
494
|
+
* Get all services
|
|
495
|
+
*/
|
|
496
|
+
getServices(): Promise<ApiResponse<Service[]>>;
|
|
497
|
+
/**
|
|
498
|
+
* Get a single service by ID
|
|
499
|
+
*/
|
|
500
|
+
getService(serviceId: string): Promise<ApiResponse<Service>>;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Create a new BookingLab client instance
|
|
504
|
+
*/
|
|
505
|
+
declare function createBookingLabClient(baseUrl: string, authToken?: string): BookingLabClient;
|
|
506
|
+
|
|
338
507
|
/**
|
|
339
508
|
* JRNI API Client
|
|
340
509
|
* Provides methods for interacting with the JRNI API
|
|
@@ -344,10 +513,25 @@ declare class JrniClient extends ApiClient {
|
|
|
344
513
|
private appId;
|
|
345
514
|
private appKey;
|
|
346
515
|
constructor(baseUrl: string, config: JrniConfig);
|
|
516
|
+
/**
|
|
517
|
+
* Get default headers for JRNI API requests
|
|
518
|
+
*/
|
|
519
|
+
private getDefaultHeaders;
|
|
347
520
|
/**
|
|
348
521
|
* Login to JRNI
|
|
349
522
|
*/
|
|
350
523
|
login(credentials: LoginRequest): Promise<ApiResponse<LoginResponse>>;
|
|
524
|
+
/**
|
|
525
|
+
* Get child companies for a parent company
|
|
526
|
+
* @param companyId - The parent company ID
|
|
527
|
+
* @param params - Optional query parameters (person_id, Person_Id)
|
|
528
|
+
*/
|
|
529
|
+
getChildCompanies(companyId: number, params?: GetChildCompaniesParams): Promise<ApiResponse<ChildCompaniesResponse>>;
|
|
530
|
+
/**
|
|
531
|
+
* Get resources for a company
|
|
532
|
+
* @param companyId - The company ID
|
|
533
|
+
*/
|
|
534
|
+
getResources(companyId: number): Promise<ApiResponse<ResourcesResponse>>;
|
|
351
535
|
/**
|
|
352
536
|
* Update JRNI configuration
|
|
353
537
|
*/
|
|
@@ -359,24 +543,41 @@ declare class JrniClient extends ApiClient {
|
|
|
359
543
|
declare function createJrniClient(baseUrl: string, config: JrniConfig): JrniClient;
|
|
360
544
|
|
|
361
545
|
interface ApiClientContextValue {
|
|
546
|
+
bookingLabClient: BookingLabClient | null;
|
|
362
547
|
jrniClient: JrniClient | null;
|
|
363
548
|
}
|
|
364
549
|
interface ApiClientProviderProps {
|
|
365
550
|
children: ReactNode;
|
|
551
|
+
bookingLabBaseUrl?: string;
|
|
366
552
|
jrniBaseUrl?: string;
|
|
367
553
|
jrniConfig?: JrniConfig;
|
|
554
|
+
authToken?: string;
|
|
368
555
|
queryClient?: QueryClient;
|
|
369
556
|
}
|
|
370
557
|
/**
|
|
371
558
|
* Combined provider for multiple API clients
|
|
372
559
|
* Includes QueryClientProvider for React Query hooks
|
|
373
560
|
*/
|
|
374
|
-
declare function ApiClientProvider({ children, jrniBaseUrl, jrniConfig, queryClient, }: ApiClientProviderProps): react_jsx_runtime.JSX.Element;
|
|
561
|
+
declare function ApiClientProvider({ children, bookingLabBaseUrl, jrniBaseUrl, jrniConfig, authToken, queryClient, }: ApiClientProviderProps): react_jsx_runtime.JSX.Element;
|
|
375
562
|
/**
|
|
376
563
|
* Hook to access API client context
|
|
377
564
|
*/
|
|
378
565
|
declare function useApiClientContext(): ApiClientContextValue;
|
|
379
566
|
|
|
567
|
+
interface BookingLabProviderProps {
|
|
568
|
+
children: ReactNode;
|
|
569
|
+
baseUrl: string;
|
|
570
|
+
authToken?: string;
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Provider component for BookingLab client
|
|
574
|
+
*/
|
|
575
|
+
declare function BookingLabProvider({ children, baseUrl, authToken, }: BookingLabProviderProps): react_jsx_runtime.JSX.Element;
|
|
576
|
+
/**
|
|
577
|
+
* Hook to access BookingLab client from context
|
|
578
|
+
*/
|
|
579
|
+
declare function useBookingLabContext(): BookingLabClient;
|
|
580
|
+
|
|
380
581
|
interface JrniProviderProps {
|
|
381
582
|
children: ReactNode;
|
|
382
583
|
baseUrl: string;
|
|
@@ -394,6 +595,10 @@ declare function useJrniContext(): JrniClient;
|
|
|
394
595
|
/**
|
|
395
596
|
* Hook to access API clients from context
|
|
396
597
|
*/
|
|
598
|
+
/**
|
|
599
|
+
* Hook to get BookingLab client from either ApiClientProvider or BookingLabProvider
|
|
600
|
+
*/
|
|
601
|
+
declare function useBookingLabClient(): BookingLabClient;
|
|
397
602
|
/**
|
|
398
603
|
* Hook to get JRNI client from either ApiClientProvider or JrniProvider
|
|
399
604
|
*/
|
|
@@ -403,5 +608,50 @@ declare function useJrniClient(): JrniClient;
|
|
|
403
608
|
* Hook for JRNI login
|
|
404
609
|
*/
|
|
405
610
|
declare function useLogin(): _tanstack_react_query.UseMutationResult<LoginResponse, Error, LoginRequest, unknown>;
|
|
611
|
+
/**
|
|
612
|
+
* Hook for fetching child companies
|
|
613
|
+
* @param companyId - The parent company ID
|
|
614
|
+
* @param params - Optional query parameters
|
|
615
|
+
* @param enabled - Whether the query should run
|
|
616
|
+
*/
|
|
617
|
+
declare function useChildCompanies(companyId: number, params?: GetChildCompaniesParams, enabled?: boolean): _tanstack_react_query.UseQueryResult<ChildCompaniesResponse, Error>;
|
|
618
|
+
/**
|
|
619
|
+
* Hook for fetching resources
|
|
620
|
+
* @param companyId - The company ID
|
|
621
|
+
* @param enabled - Whether the query should run
|
|
622
|
+
*/
|
|
623
|
+
declare function useResources(companyId: number, enabled?: boolean): _tanstack_react_query.UseQueryResult<ResourcesResponse, Error>;
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Hook to fetch bookings
|
|
627
|
+
*/
|
|
628
|
+
declare function useBookings(userId?: string): _tanstack_react_query.UseQueryResult<Booking[], Error>;
|
|
629
|
+
/**
|
|
630
|
+
* Hook to fetch a single booking
|
|
631
|
+
*/
|
|
632
|
+
declare function useBooking(bookingId: string): _tanstack_react_query.UseQueryResult<Booking, Error>;
|
|
633
|
+
/**
|
|
634
|
+
* Hook to create a booking
|
|
635
|
+
*/
|
|
636
|
+
declare function useCreateBooking(): _tanstack_react_query.UseMutationResult<Booking, Error, CreateBookingRequest, unknown>;
|
|
637
|
+
/**
|
|
638
|
+
* Hook to update a booking
|
|
639
|
+
*/
|
|
640
|
+
declare function useUpdateBooking(): _tanstack_react_query.UseMutationResult<Booking, Error, {
|
|
641
|
+
id: string;
|
|
642
|
+
updates: Partial<Booking>;
|
|
643
|
+
}, unknown>;
|
|
644
|
+
/**
|
|
645
|
+
* Hook to cancel a booking
|
|
646
|
+
*/
|
|
647
|
+
declare function useCancelBooking(): _tanstack_react_query.UseMutationResult<Booking, Error, string, unknown>;
|
|
648
|
+
/**
|
|
649
|
+
* Hook to fetch services
|
|
650
|
+
*/
|
|
651
|
+
declare function useServices(): _tanstack_react_query.UseQueryResult<Service[], Error>;
|
|
652
|
+
/**
|
|
653
|
+
* Hook to fetch a single service
|
|
654
|
+
*/
|
|
655
|
+
declare function useService(serviceId: string): _tanstack_react_query.UseQueryResult<Service, Error>;
|
|
406
656
|
|
|
407
|
-
export { type AddBasketItemRequest, ApiClient, type ApiClientConfig, ApiClientProvider, type ApiError, type ApiResponse, type AvailabilityTime, type AvailabilityTimesResponse, 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 ServicesResponse, type UpdateClientDetailsData, type UpdateMemberDetailsData, type Vehicle, type VehiclesResponse, createJrniClient, useApiClientContext, useJrniClient, useJrniContext, useLogin };
|
|
657
|
+
export { type AddBasketItemRequest, ApiClient, type ApiClientConfig, ApiClientProvider, type ApiError, type ApiResponse, type AvailabilityTime, type AvailabilityTimesResponse, type Booking, BookingLabClient, BookingLabProvider, type ChildCompaniesResponse, type ChildCompany, type ChildCompanyAddress, type ChildCompanySettings, type CreateBookingRequest, type GetChildCompaniesParams, 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 Resource, type ResourceLinks, type ResourcesResponse, type Service, type ServicesResponse, type UpdateClientDetailsData, type UpdateMemberDetailsData, type Vehicle, type VehiclesResponse, createBookingLabClient, createJrniClient, useApiClientContext, useBooking, useBookingLabClient, useBookingLabContext, useBookings, useCancelBooking, useChildCompanies, useCreateBooking, useJrniClient, useJrniContext, useLogin, useResources, useService, useServices, useUpdateBooking };
|