@bookinglab/booking-journey-api 2.8.0 → 2.10.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 +2 -0
- package/dist/index.d.cts +231 -1
- package/dist/index.d.ts +231 -1
- package/dist/index.js +156 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +151 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -341,6 +341,90 @@ var BookingLabClient = class extends ApiClient {
|
|
|
341
341
|
}
|
|
342
342
|
);
|
|
343
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* Get company configuration
|
|
346
|
+
* @param request - Config request with client and company
|
|
347
|
+
* @param clientToken - Client token for authentication
|
|
348
|
+
*/
|
|
349
|
+
async getConfig(request, clientToken) {
|
|
350
|
+
return this.post("/config", request, {
|
|
351
|
+
headers: {
|
|
352
|
+
"clienttoken": clientToken
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Get a token for a client/company
|
|
358
|
+
* @param request - Token request with client and company
|
|
359
|
+
* @param clientToken - Client token for authentication
|
|
360
|
+
*/
|
|
361
|
+
async getToken(request, clientToken) {
|
|
362
|
+
return this.post("/token", request, {
|
|
363
|
+
headers: {
|
|
364
|
+
"clienttoken": clientToken
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Get services for a company
|
|
370
|
+
* @param companyId - The company ID
|
|
371
|
+
* @param clientToken - Client token for authentication
|
|
372
|
+
*/
|
|
373
|
+
async getCompanyServices(companyId, clientToken) {
|
|
374
|
+
return this.get(
|
|
375
|
+
`/company/${companyId}/services`,
|
|
376
|
+
{
|
|
377
|
+
headers: {
|
|
378
|
+
"clienttoken": clientToken
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Get a single service by ID for a company
|
|
385
|
+
* @param companyId - The company ID
|
|
386
|
+
* @param serviceId - The service ID
|
|
387
|
+
* @param clientToken - Client token for authentication
|
|
388
|
+
*/
|
|
389
|
+
async getCompanyService(companyId, serviceId, clientToken) {
|
|
390
|
+
return this.get(
|
|
391
|
+
`/company/${companyId}/service/${serviceId}`,
|
|
392
|
+
{
|
|
393
|
+
headers: {
|
|
394
|
+
"clienttoken": clientToken
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Get all companies
|
|
401
|
+
* @param clientToken - Client token for authentication
|
|
402
|
+
* @param params - Optional query params (service_id, person_id)
|
|
403
|
+
*/
|
|
404
|
+
async getCompanies(clientToken, params) {
|
|
405
|
+
return this.get("/companies", {
|
|
406
|
+
headers: {
|
|
407
|
+
"clienttoken": clientToken
|
|
408
|
+
},
|
|
409
|
+
params
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Get questions for a company by detail group ID
|
|
414
|
+
* @param companyId - The company ID
|
|
415
|
+
* @param detailGroupId - The detail group ID
|
|
416
|
+
* @param clientToken - Client token for authentication
|
|
417
|
+
*/
|
|
418
|
+
async getCompanyQuestions(companyId, detailGroupId, clientToken) {
|
|
419
|
+
return this.get(
|
|
420
|
+
`/company/${companyId}/questions/${detailGroupId}`,
|
|
421
|
+
{
|
|
422
|
+
headers: {
|
|
423
|
+
"clienttoken": clientToken
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
);
|
|
427
|
+
}
|
|
344
428
|
};
|
|
345
429
|
function createBookingLabClient(baseUrl, authToken, appId) {
|
|
346
430
|
const client = new BookingLabClient({ baseUrl });
|
|
@@ -1069,6 +1153,72 @@ function useBookingLabForgotPassword(companyId, clientToken) {
|
|
|
1069
1153
|
}
|
|
1070
1154
|
});
|
|
1071
1155
|
}
|
|
1156
|
+
function useBookingLabConfig(request, clientToken, enabled = true) {
|
|
1157
|
+
const client = useBookingLabClient();
|
|
1158
|
+
return reactQuery.useQuery({
|
|
1159
|
+
queryKey: ["bookingLabConfig", request.client, request.company],
|
|
1160
|
+
queryFn: async () => {
|
|
1161
|
+
const response = await client.getConfig(request, clientToken);
|
|
1162
|
+
return response.data;
|
|
1163
|
+
},
|
|
1164
|
+
enabled: enabled && !!request.client && !!request.company && !!clientToken
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
function useBookingLabGetToken(request, clientToken, enabled = true) {
|
|
1168
|
+
const client = useBookingLabClient();
|
|
1169
|
+
return reactQuery.useQuery({
|
|
1170
|
+
queryKey: ["bookingLabGetToken", request.client, request.company],
|
|
1171
|
+
queryFn: async () => {
|
|
1172
|
+
const response = await client.getToken(request, clientToken);
|
|
1173
|
+
return response.data;
|
|
1174
|
+
},
|
|
1175
|
+
enabled: enabled && !!request.client && !!request.company && !!clientToken
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
function useBookingLabServices(companyId, clientToken, enabled = true) {
|
|
1179
|
+
const client = useBookingLabClient();
|
|
1180
|
+
return reactQuery.useQuery({
|
|
1181
|
+
queryKey: ["bookingLabServices", companyId],
|
|
1182
|
+
queryFn: async () => {
|
|
1183
|
+
const response = await client.getCompanyServices(companyId, clientToken);
|
|
1184
|
+
return response.data;
|
|
1185
|
+
},
|
|
1186
|
+
enabled: enabled && !!companyId && !!clientToken
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
function useBookingLabService(companyId, serviceId, clientToken, enabled = true) {
|
|
1190
|
+
const client = useBookingLabClient();
|
|
1191
|
+
return reactQuery.useQuery({
|
|
1192
|
+
queryKey: ["bookingLabService", companyId, serviceId],
|
|
1193
|
+
queryFn: async () => {
|
|
1194
|
+
const response = await client.getCompanyService(companyId, serviceId, clientToken);
|
|
1195
|
+
return response.data;
|
|
1196
|
+
},
|
|
1197
|
+
enabled: enabled && !!companyId && !!serviceId && !!clientToken
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
function useBookingLabCompanies(clientToken, params, enabled = true) {
|
|
1201
|
+
const client = useBookingLabClient();
|
|
1202
|
+
return reactQuery.useQuery({
|
|
1203
|
+
queryKey: ["bookingLabCompanies", params?.service_id, params?.person_id],
|
|
1204
|
+
queryFn: async () => {
|
|
1205
|
+
const response = await client.getCompanies(clientToken, params);
|
|
1206
|
+
return response.data;
|
|
1207
|
+
},
|
|
1208
|
+
enabled: enabled && !!clientToken
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1211
|
+
function useBookingLabQuestions(companyId, detailGroupId, clientToken, enabled = true) {
|
|
1212
|
+
const client = useBookingLabClient();
|
|
1213
|
+
return reactQuery.useQuery({
|
|
1214
|
+
queryKey: ["bookingLabQuestions", companyId, detailGroupId],
|
|
1215
|
+
queryFn: async () => {
|
|
1216
|
+
const response = await client.getCompanyQuestions(companyId, detailGroupId, clientToken);
|
|
1217
|
+
return response.data;
|
|
1218
|
+
},
|
|
1219
|
+
enabled: enabled && !!companyId && !!detailGroupId && !!clientToken
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1072
1222
|
|
|
1073
1223
|
exports.ApiClient = ApiClient;
|
|
1074
1224
|
exports.ApiClientContext = ApiClientContext;
|
|
@@ -1085,8 +1235,14 @@ exports.createJrniClient = createJrniClient;
|
|
|
1085
1235
|
exports.useAddServiceItem = useAddServiceItem;
|
|
1086
1236
|
exports.useApiClientContext = useApiClientContext;
|
|
1087
1237
|
exports.useBookingLabClient = useBookingLabClient;
|
|
1238
|
+
exports.useBookingLabCompanies = useBookingLabCompanies;
|
|
1239
|
+
exports.useBookingLabConfig = useBookingLabConfig;
|
|
1088
1240
|
exports.useBookingLabContext = useBookingLabContext;
|
|
1089
1241
|
exports.useBookingLabForgotPassword = useBookingLabForgotPassword;
|
|
1242
|
+
exports.useBookingLabGetToken = useBookingLabGetToken;
|
|
1243
|
+
exports.useBookingLabQuestions = useBookingLabQuestions;
|
|
1244
|
+
exports.useBookingLabService = useBookingLabService;
|
|
1245
|
+
exports.useBookingLabServices = useBookingLabServices;
|
|
1090
1246
|
exports.useCancelBooking = useCancelBooking;
|
|
1091
1247
|
exports.useCancelMemberBooking = useCancelMemberBooking;
|
|
1092
1248
|
exports.useCheckoutBasket = useCheckoutBasket;
|