@savvycal/appointments-react-query 0.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/LICENSE +21 -0
- package/README.md +217 -0
- package/dist/index.cjs +963 -0
- package/dist/index.d.cts +9563 -0
- package/dist/index.d.ts +9563 -0
- package/dist/index.js +867 -0
- package/package.json +60 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,867 @@
|
|
|
1
|
+
// ../../node_modules/.pnpm/openapi-react-query@0.5.1_@tanstack+react-query@5.90.11_react@19.2.0__openapi-fetch@0.15.0/node_modules/openapi-react-query/dist/index.mjs
|
|
2
|
+
import { useMutation, useSuspenseQuery, useQuery, useInfiniteQuery } from "@tanstack/react-query";
|
|
3
|
+
function createClient(client) {
|
|
4
|
+
const queryFn = async ({
|
|
5
|
+
queryKey: [method, path, init],
|
|
6
|
+
signal
|
|
7
|
+
}) => {
|
|
8
|
+
const mth = method.toUpperCase();
|
|
9
|
+
const fn = client[mth];
|
|
10
|
+
const { data, error, response } = await fn(path, { signal, ...init });
|
|
11
|
+
if (error) {
|
|
12
|
+
throw error;
|
|
13
|
+
}
|
|
14
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
15
|
+
return data ?? null;
|
|
16
|
+
}
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
const queryOptions = (method, path, ...[init, options]) => ({
|
|
20
|
+
queryKey: init === void 0 ? [method, path] : [method, path, init],
|
|
21
|
+
queryFn,
|
|
22
|
+
...options
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
queryOptions,
|
|
26
|
+
useQuery: (method, path, ...[init, options, queryClient]) => useQuery(queryOptions(method, path, init, options), queryClient),
|
|
27
|
+
useSuspenseQuery: (method, path, ...[init, options, queryClient]) => useSuspenseQuery(queryOptions(method, path, init, options), queryClient),
|
|
28
|
+
useInfiniteQuery: (method, path, init, options, queryClient) => {
|
|
29
|
+
const { pageParamName = "cursor", ...restOptions } = options;
|
|
30
|
+
const { queryKey } = queryOptions(method, path, init);
|
|
31
|
+
return useInfiniteQuery(
|
|
32
|
+
{
|
|
33
|
+
queryKey,
|
|
34
|
+
queryFn: async ({ queryKey: [method2, path2, init2], pageParam = 0, signal }) => {
|
|
35
|
+
const mth = method2.toUpperCase();
|
|
36
|
+
const fn = client[mth];
|
|
37
|
+
const mergedInit = {
|
|
38
|
+
...init2,
|
|
39
|
+
signal,
|
|
40
|
+
params: {
|
|
41
|
+
...init2?.params || {},
|
|
42
|
+
query: {
|
|
43
|
+
...init2?.params?.query,
|
|
44
|
+
[pageParamName]: pageParam
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const { data, error } = await fn(path2, mergedInit);
|
|
49
|
+
if (error) {
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
return data;
|
|
53
|
+
},
|
|
54
|
+
...restOptions
|
|
55
|
+
},
|
|
56
|
+
queryClient
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
useMutation: (method, path, options, queryClient) => useMutation(
|
|
60
|
+
{
|
|
61
|
+
mutationKey: [method, path],
|
|
62
|
+
mutationFn: async (init) => {
|
|
63
|
+
const mth = method.toUpperCase();
|
|
64
|
+
const fn = client[mth];
|
|
65
|
+
const { data, error } = await fn(path, init);
|
|
66
|
+
if (error) {
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
return data;
|
|
70
|
+
},
|
|
71
|
+
...options
|
|
72
|
+
},
|
|
73
|
+
queryClient
|
|
74
|
+
)
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// src/client.ts
|
|
79
|
+
var createQueryClient = (fetchClient) => {
|
|
80
|
+
return createClient(fetchClient);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// src/provider.tsx
|
|
84
|
+
import {
|
|
85
|
+
createFetchClient
|
|
86
|
+
} from "@savvycal/appointments-core";
|
|
87
|
+
import React, { createContext, useContext, useMemo } from "react";
|
|
88
|
+
var SavvyCalContext = createContext(
|
|
89
|
+
void 0
|
|
90
|
+
);
|
|
91
|
+
SavvyCalContext.displayName = "SavvyCalContext";
|
|
92
|
+
var SavvyCalProvider = ({
|
|
93
|
+
children,
|
|
94
|
+
...clientOptions
|
|
95
|
+
}) => {
|
|
96
|
+
const fetchClient = useMemo(
|
|
97
|
+
() => createFetchClient(clientOptions),
|
|
98
|
+
[clientOptions]
|
|
99
|
+
);
|
|
100
|
+
const queryClient = useMemo(
|
|
101
|
+
() => createQueryClient(fetchClient),
|
|
102
|
+
[fetchClient]
|
|
103
|
+
);
|
|
104
|
+
return /* @__PURE__ */ React.createElement(SavvyCalContext.Provider, { value: { fetchClient, queryClient } }, children);
|
|
105
|
+
};
|
|
106
|
+
SavvyCalProvider.displayName = "SavvyCalProvider";
|
|
107
|
+
var useSavvyCalQueryClient = (overrideClient) => {
|
|
108
|
+
const context = useContext(SavvyCalContext);
|
|
109
|
+
if (context === void 0 && !overrideClient) {
|
|
110
|
+
throw new Error(
|
|
111
|
+
"useSavvyCalQueryClient must be used within a SavvyCalProvider"
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
return overrideClient || context.queryClient;
|
|
115
|
+
};
|
|
116
|
+
var useSavvyCalFetchClient = (overrideClient) => {
|
|
117
|
+
const context = useContext(SavvyCalContext);
|
|
118
|
+
if (context === void 0 && !overrideClient) {
|
|
119
|
+
throw new Error(
|
|
120
|
+
"useSavvyCalFetchClient must be used within a SavvyCalProvider"
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
return overrideClient || context.fetchClient;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// src/mutation-hooks/use-cancel-appointment.ts
|
|
127
|
+
var useCancelAppointment = (options) => {
|
|
128
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
129
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
130
|
+
return client.useMutation(
|
|
131
|
+
"post",
|
|
132
|
+
"/v1/appointments/{appointment_id}/cancel",
|
|
133
|
+
mutationOptions
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// src/mutation-hooks/use-cancel-public-appointment.ts
|
|
138
|
+
var useCancelPublicAppointment = (options) => {
|
|
139
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
140
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
141
|
+
return client.useMutation(
|
|
142
|
+
"post",
|
|
143
|
+
"/v1/public/appointments/{appointment_id}/cancel",
|
|
144
|
+
mutationOptions
|
|
145
|
+
);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// src/mutation-hooks/use-confirm-appointment.ts
|
|
149
|
+
var useConfirmAppointment = (options) => {
|
|
150
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
151
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
152
|
+
return client.useMutation(
|
|
153
|
+
"post",
|
|
154
|
+
"/v1/appointments/{appointment_id}/confirm",
|
|
155
|
+
mutationOptions
|
|
156
|
+
);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// src/mutation-hooks/use-create-account.ts
|
|
160
|
+
var useCreateAccount = (options) => {
|
|
161
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
162
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
163
|
+
return client.useMutation("post", "/v1/accounts", mutationOptions);
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// src/mutation-hooks/use-create-account-user.ts
|
|
167
|
+
var useCreateAccountUser = (options) => {
|
|
168
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
169
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
170
|
+
return client.useMutation("post", "/v1/users", mutationOptions);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// src/mutation-hooks/use-create-appointment.ts
|
|
174
|
+
var useCreateAppointment = (options) => {
|
|
175
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
176
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
177
|
+
return client.useMutation("post", "/v1/appointments", mutationOptions);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// src/mutation-hooks/use-create-block.ts
|
|
181
|
+
var useCreateBlock = (options) => {
|
|
182
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
183
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
184
|
+
return client.useMutation("post", "/v1/blocks", mutationOptions);
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// src/mutation-hooks/use-create-cancellation-reason.ts
|
|
188
|
+
var useCreateCancellationReason = (options) => {
|
|
189
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
190
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
191
|
+
return client.useMutation(
|
|
192
|
+
"post",
|
|
193
|
+
"/v1/cancellation_reasons",
|
|
194
|
+
mutationOptions
|
|
195
|
+
);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
// src/mutation-hooks/use-create-client.ts
|
|
199
|
+
var useCreateClient = (options) => {
|
|
200
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
201
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
202
|
+
return client.useMutation("post", "/v1/clients", mutationOptions);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
// src/mutation-hooks/use-create-dashboard-session.ts
|
|
206
|
+
var useCreateDashboardSession = (options) => {
|
|
207
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
208
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
209
|
+
return client.useMutation("post", "/v1/dashboard_sessions", mutationOptions);
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
// src/mutation-hooks/use-create-provider.ts
|
|
213
|
+
var useCreateProvider = (options) => {
|
|
214
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
215
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
216
|
+
return client.useMutation("post", "/v1/providers", mutationOptions);
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
// src/mutation-hooks/use-create-provider-schedule.ts
|
|
220
|
+
var useCreateProviderSchedule = (options) => {
|
|
221
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
222
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
223
|
+
return client.useMutation(
|
|
224
|
+
"post",
|
|
225
|
+
"/v1/providers/{provider_id}/schedules",
|
|
226
|
+
mutationOptions
|
|
227
|
+
);
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
// src/mutation-hooks/use-create-public-appointment.ts
|
|
231
|
+
var useCreatePublicAppointment = (options) => {
|
|
232
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
233
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
234
|
+
return client.useMutation("post", "/v1/public/appointments", mutationOptions);
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
// src/mutation-hooks/use-create-service.ts
|
|
238
|
+
var useCreateService = (options) => {
|
|
239
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
240
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
241
|
+
return client.useMutation("post", "/v1/services", mutationOptions);
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
// src/mutation-hooks/use-create-service-provider.ts
|
|
245
|
+
var useCreateServiceProvider = (options) => {
|
|
246
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
247
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
248
|
+
return client.useMutation(
|
|
249
|
+
"post",
|
|
250
|
+
"/v1/services/{service_id}/providers",
|
|
251
|
+
mutationOptions
|
|
252
|
+
);
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
// src/mutation-hooks/use-deactivate-provider.ts
|
|
256
|
+
var useDeactivateProvider = (options) => {
|
|
257
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
258
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
259
|
+
return client.useMutation(
|
|
260
|
+
"delete",
|
|
261
|
+
"/v1/providers/{provider_id}",
|
|
262
|
+
mutationOptions
|
|
263
|
+
);
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// src/mutation-hooks/use-delete-block.ts
|
|
267
|
+
var useDeleteBlock = (options) => {
|
|
268
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
269
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
270
|
+
return client.useMutation("delete", "/v1/blocks/{block_id}", mutationOptions);
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
// src/mutation-hooks/use-delete-cancellation-reason.ts
|
|
274
|
+
var useDeleteCancellationReason = (options) => {
|
|
275
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
276
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
277
|
+
return client.useMutation(
|
|
278
|
+
"delete",
|
|
279
|
+
"/v1/cancellation_reasons/{cancellation_reason_id}",
|
|
280
|
+
mutationOptions
|
|
281
|
+
);
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
// src/mutation-hooks/use-delete-client.ts
|
|
285
|
+
var useDeleteClient = (options) => {
|
|
286
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
287
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
288
|
+
return client.useMutation(
|
|
289
|
+
"delete",
|
|
290
|
+
"/v1/clients/{client_id}",
|
|
291
|
+
mutationOptions
|
|
292
|
+
);
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
// src/mutation-hooks/use-delete-provider-schedule.ts
|
|
296
|
+
var useDeleteProviderSchedule = (options) => {
|
|
297
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
298
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
299
|
+
return client.useMutation(
|
|
300
|
+
"delete",
|
|
301
|
+
"/v1/provider_schedules/{provider_schedule_id}",
|
|
302
|
+
mutationOptions
|
|
303
|
+
);
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
// src/mutation-hooks/use-delete-service.ts
|
|
307
|
+
var useDeleteService = (options) => {
|
|
308
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
309
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
310
|
+
return client.useMutation(
|
|
311
|
+
"delete",
|
|
312
|
+
"/v1/services/{service_id}",
|
|
313
|
+
mutationOptions
|
|
314
|
+
);
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
// src/mutation-hooks/use-delete-service-provider.ts
|
|
318
|
+
var useDeleteServiceProvider = (options) => {
|
|
319
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
320
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
321
|
+
return client.useMutation(
|
|
322
|
+
"delete",
|
|
323
|
+
"/v1/service_providers/{service_provider_id}",
|
|
324
|
+
mutationOptions
|
|
325
|
+
);
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
// src/mutation-hooks/use-reschedule-appointment.ts
|
|
329
|
+
var useRescheduleAppointment = (options) => {
|
|
330
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
331
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
332
|
+
return client.useMutation(
|
|
333
|
+
"post",
|
|
334
|
+
"/v1/appointments/{appointment_id}/reschedule",
|
|
335
|
+
mutationOptions
|
|
336
|
+
);
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
// src/mutation-hooks/use-reschedule-public-appointment.ts
|
|
340
|
+
var useReschedulePublicAppointment = (options) => {
|
|
341
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
342
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
343
|
+
return client.useMutation(
|
|
344
|
+
"post",
|
|
345
|
+
"/v1/public/appointments/{appointment_id}/reschedule",
|
|
346
|
+
mutationOptions
|
|
347
|
+
);
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
// src/mutation-hooks/use-update-account.ts
|
|
351
|
+
var useUpdateAccount = (options) => {
|
|
352
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
353
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
354
|
+
return client.useMutation(
|
|
355
|
+
"patch",
|
|
356
|
+
"/v1/accounts/{account_id}",
|
|
357
|
+
mutationOptions
|
|
358
|
+
);
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
// src/mutation-hooks/use-update-block.ts
|
|
362
|
+
var useUpdateBlock = (options) => {
|
|
363
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
364
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
365
|
+
return client.useMutation("patch", "/v1/blocks/{block_id}", mutationOptions);
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
// src/mutation-hooks/use-update-cancellation-reason.ts
|
|
369
|
+
var useUpdateCancellationReason = (options) => {
|
|
370
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
371
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
372
|
+
return client.useMutation(
|
|
373
|
+
"patch",
|
|
374
|
+
"/v1/cancellation_reasons/{cancellation_reason_id}",
|
|
375
|
+
mutationOptions
|
|
376
|
+
);
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
// src/mutation-hooks/use-update-client.ts
|
|
380
|
+
var useUpdateClient = (options) => {
|
|
381
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
382
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
383
|
+
return client.useMutation(
|
|
384
|
+
"patch",
|
|
385
|
+
"/v1/clients/{client_id}",
|
|
386
|
+
mutationOptions
|
|
387
|
+
);
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
// src/mutation-hooks/use-update-provider.ts
|
|
391
|
+
var useUpdateProvider = (options) => {
|
|
392
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
393
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
394
|
+
return client.useMutation(
|
|
395
|
+
"patch",
|
|
396
|
+
"/v1/providers/{provider_id}",
|
|
397
|
+
mutationOptions
|
|
398
|
+
);
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
// src/mutation-hooks/use-update-provider-schedule.ts
|
|
402
|
+
var useUpdateProviderSchedule = (options) => {
|
|
403
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
404
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
405
|
+
return client.useMutation(
|
|
406
|
+
"patch",
|
|
407
|
+
"/v1/provider_schedules/{provider_schedule_id}",
|
|
408
|
+
mutationOptions
|
|
409
|
+
);
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
// src/mutation-hooks/use-update-service.ts
|
|
413
|
+
var useUpdateService = (options) => {
|
|
414
|
+
const { client: overrideClient, ...mutationOptions } = options ?? {};
|
|
415
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
416
|
+
return client.useMutation(
|
|
417
|
+
"patch",
|
|
418
|
+
"/v1/services/{service_id}",
|
|
419
|
+
mutationOptions
|
|
420
|
+
);
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
// src/query-hooks/use-account-by-id.ts
|
|
424
|
+
var useAccountById = (account_id, options) => {
|
|
425
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
426
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
427
|
+
return client.useQuery(
|
|
428
|
+
"get",
|
|
429
|
+
"/v1/accounts/{account_id}",
|
|
430
|
+
{
|
|
431
|
+
params: {
|
|
432
|
+
path: { account_id }
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
queryOptions
|
|
436
|
+
);
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
// src/query-hooks/use-account-users.ts
|
|
440
|
+
var useAccountUsers = (options) => {
|
|
441
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
442
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
443
|
+
return client.useQuery("get", "/v1/users", {}, queryOptions);
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
// src/query-hooks/use-accounts.ts
|
|
447
|
+
var useAccounts = (queryParams, options) => {
|
|
448
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
449
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
450
|
+
return client.useQuery(
|
|
451
|
+
"get",
|
|
452
|
+
"/v1/accounts",
|
|
453
|
+
{
|
|
454
|
+
params: {
|
|
455
|
+
query: queryParams
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
queryOptions
|
|
459
|
+
);
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
// src/query-hooks/use-appointment.ts
|
|
463
|
+
var useAppointment = (appointment_id, queryParams, options) => {
|
|
464
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
465
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
466
|
+
return client.useQuery(
|
|
467
|
+
"get",
|
|
468
|
+
"/v1/appointments/{appointment_id}",
|
|
469
|
+
{
|
|
470
|
+
params: {
|
|
471
|
+
path: { appointment_id },
|
|
472
|
+
query: queryParams
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
queryOptions
|
|
476
|
+
);
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
// src/query-hooks/use-appointments.ts
|
|
480
|
+
var useAppointments = (queryParams, options) => {
|
|
481
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
482
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
483
|
+
return client.useQuery(
|
|
484
|
+
"get",
|
|
485
|
+
"/v1/appointments",
|
|
486
|
+
{
|
|
487
|
+
params: {
|
|
488
|
+
query: queryParams
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
queryOptions
|
|
492
|
+
);
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
// src/query-hooks/use-block.ts
|
|
496
|
+
var useBlock = (block_id, options) => {
|
|
497
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
498
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
499
|
+
return client.useQuery(
|
|
500
|
+
"get",
|
|
501
|
+
"/v1/blocks/{block_id}",
|
|
502
|
+
{
|
|
503
|
+
params: {
|
|
504
|
+
path: { block_id }
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
queryOptions
|
|
508
|
+
);
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
// src/query-hooks/use-blocks.ts
|
|
512
|
+
var useBlocks = (queryParams, options) => {
|
|
513
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
514
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
515
|
+
return client.useQuery(
|
|
516
|
+
"get",
|
|
517
|
+
"/v1/blocks",
|
|
518
|
+
{
|
|
519
|
+
params: {
|
|
520
|
+
query: queryParams
|
|
521
|
+
}
|
|
522
|
+
},
|
|
523
|
+
queryOptions
|
|
524
|
+
);
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
// src/query-hooks/use-cancellation-reason.ts
|
|
528
|
+
var useCancellationReason = (cancellation_reason_id, options) => {
|
|
529
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
530
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
531
|
+
return client.useQuery(
|
|
532
|
+
"get",
|
|
533
|
+
"/v1/cancellation_reasons/{cancellation_reason_id}",
|
|
534
|
+
{
|
|
535
|
+
params: {
|
|
536
|
+
path: { cancellation_reason_id }
|
|
537
|
+
}
|
|
538
|
+
},
|
|
539
|
+
queryOptions
|
|
540
|
+
);
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
// src/query-hooks/use-cancellation-reasons.ts
|
|
544
|
+
var useCancellationReasons = (options) => {
|
|
545
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
546
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
547
|
+
return client.useQuery("get", "/v1/cancellation_reasons", {}, queryOptions);
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
// src/query-hooks/use-client.ts
|
|
551
|
+
var useClient = (client_id, options) => {
|
|
552
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
553
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
554
|
+
return client.useQuery(
|
|
555
|
+
"get",
|
|
556
|
+
"/v1/clients/{client_id}",
|
|
557
|
+
{
|
|
558
|
+
params: {
|
|
559
|
+
path: { client_id }
|
|
560
|
+
}
|
|
561
|
+
},
|
|
562
|
+
queryOptions
|
|
563
|
+
);
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
// src/query-hooks/use-clients.ts
|
|
567
|
+
var useClients = (queryParams, options) => {
|
|
568
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
569
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
570
|
+
return client.useQuery(
|
|
571
|
+
"get",
|
|
572
|
+
"/v1/clients",
|
|
573
|
+
{
|
|
574
|
+
params: {
|
|
575
|
+
query: queryParams
|
|
576
|
+
}
|
|
577
|
+
},
|
|
578
|
+
queryOptions
|
|
579
|
+
);
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
// src/query-hooks/use-current-account.ts
|
|
583
|
+
var useCurrentAccount = (options) => {
|
|
584
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
585
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
586
|
+
return client.useQuery("get", "/v1/account", {}, queryOptions);
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
// src/query-hooks/use-current-account-user.ts
|
|
590
|
+
var useCurrentAccountUser = (options) => {
|
|
591
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
592
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
593
|
+
return client.useQuery("get", "/v1/user", {}, queryOptions);
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
// src/query-hooks/use-current-platform.ts
|
|
597
|
+
var useCurrentPlatform = (options) => {
|
|
598
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
599
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
600
|
+
return client.useQuery("get", "/v1/platform", {}, queryOptions);
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
// src/query-hooks/use-earliest-public-service-slot.ts
|
|
604
|
+
var useEarliestPublicServiceSlot = (service_id, queryParams, options) => {
|
|
605
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
606
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
607
|
+
return client.useQuery(
|
|
608
|
+
"get",
|
|
609
|
+
"/v1/public/services/{service_id}/earliest_slot",
|
|
610
|
+
{
|
|
611
|
+
params: {
|
|
612
|
+
path: { service_id },
|
|
613
|
+
query: queryParams
|
|
614
|
+
}
|
|
615
|
+
},
|
|
616
|
+
queryOptions
|
|
617
|
+
);
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
// src/query-hooks/use-provider.ts
|
|
621
|
+
var useProvider = (provider_id, options) => {
|
|
622
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
623
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
624
|
+
return client.useQuery(
|
|
625
|
+
"get",
|
|
626
|
+
"/v1/providers/{provider_id}",
|
|
627
|
+
{
|
|
628
|
+
params: {
|
|
629
|
+
path: { provider_id }
|
|
630
|
+
}
|
|
631
|
+
},
|
|
632
|
+
queryOptions
|
|
633
|
+
);
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
// src/query-hooks/use-provider-schedule.ts
|
|
637
|
+
var useProviderSchedule = (provider_schedule_id, options) => {
|
|
638
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
639
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
640
|
+
return client.useQuery(
|
|
641
|
+
"get",
|
|
642
|
+
"/v1/provider_schedules/{provider_schedule_id}",
|
|
643
|
+
{
|
|
644
|
+
params: {
|
|
645
|
+
path: { provider_schedule_id }
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
queryOptions
|
|
649
|
+
);
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
// src/query-hooks/use-provider-schedules.ts
|
|
653
|
+
var useProviderSchedules = (queryParams, options) => {
|
|
654
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
655
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
656
|
+
return client.useQuery(
|
|
657
|
+
"get",
|
|
658
|
+
"/v1/provider_schedules",
|
|
659
|
+
{
|
|
660
|
+
params: {
|
|
661
|
+
query: queryParams
|
|
662
|
+
}
|
|
663
|
+
},
|
|
664
|
+
queryOptions
|
|
665
|
+
);
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
// src/query-hooks/use-providers.ts
|
|
669
|
+
var useProviders = (queryParams, options) => {
|
|
670
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
671
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
672
|
+
return client.useQuery(
|
|
673
|
+
"get",
|
|
674
|
+
"/v1/providers",
|
|
675
|
+
{
|
|
676
|
+
params: {
|
|
677
|
+
query: queryParams
|
|
678
|
+
}
|
|
679
|
+
},
|
|
680
|
+
queryOptions
|
|
681
|
+
);
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
// src/query-hooks/use-public-appointment.ts
|
|
685
|
+
var usePublicAppointment = (appointment_id, options) => {
|
|
686
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
687
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
688
|
+
return client.useQuery(
|
|
689
|
+
"get",
|
|
690
|
+
"/v1/public/appointments/{appointment_id}",
|
|
691
|
+
{
|
|
692
|
+
params: {
|
|
693
|
+
path: { appointment_id }
|
|
694
|
+
}
|
|
695
|
+
},
|
|
696
|
+
queryOptions
|
|
697
|
+
);
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
// src/query-hooks/use-public-cancellation-reasons.ts
|
|
701
|
+
var usePublicCancellationReasons = (appointment_id, options) => {
|
|
702
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
703
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
704
|
+
return client.useQuery(
|
|
705
|
+
"get",
|
|
706
|
+
"/v1/public/appointments/{appointment_id}/cancellation_reasons",
|
|
707
|
+
{
|
|
708
|
+
params: {
|
|
709
|
+
path: { appointment_id }
|
|
710
|
+
}
|
|
711
|
+
},
|
|
712
|
+
queryOptions
|
|
713
|
+
);
|
|
714
|
+
};
|
|
715
|
+
|
|
716
|
+
// src/query-hooks/use-public-service-slots.ts
|
|
717
|
+
var usePublicServiceSlots = (service_id, queryParams, options) => {
|
|
718
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
719
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
720
|
+
return client.useQuery(
|
|
721
|
+
"get",
|
|
722
|
+
"/v1/public/services/{service_id}/slots",
|
|
723
|
+
{
|
|
724
|
+
params: {
|
|
725
|
+
path: { service_id },
|
|
726
|
+
query: queryParams
|
|
727
|
+
}
|
|
728
|
+
},
|
|
729
|
+
queryOptions
|
|
730
|
+
);
|
|
731
|
+
};
|
|
732
|
+
|
|
733
|
+
// src/query-hooks/use-roles.ts
|
|
734
|
+
var useRoles = (options) => {
|
|
735
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
736
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
737
|
+
return client.useQuery("get", "/v1/roles", {}, queryOptions);
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
// src/query-hooks/use-service.ts
|
|
741
|
+
var useService = (service_id, options) => {
|
|
742
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
743
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
744
|
+
return client.useQuery(
|
|
745
|
+
"get",
|
|
746
|
+
"/v1/services/{service_id}",
|
|
747
|
+
{
|
|
748
|
+
params: {
|
|
749
|
+
path: { service_id }
|
|
750
|
+
}
|
|
751
|
+
},
|
|
752
|
+
queryOptions
|
|
753
|
+
);
|
|
754
|
+
};
|
|
755
|
+
|
|
756
|
+
// src/query-hooks/use-service-providers.ts
|
|
757
|
+
var useServiceProviders = (service_id, options) => {
|
|
758
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
759
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
760
|
+
return client.useQuery(
|
|
761
|
+
"get",
|
|
762
|
+
"/v1/services/{service_id}/providers",
|
|
763
|
+
{
|
|
764
|
+
params: {
|
|
765
|
+
path: { service_id }
|
|
766
|
+
}
|
|
767
|
+
},
|
|
768
|
+
queryOptions
|
|
769
|
+
);
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
// src/query-hooks/use-service-slots.ts
|
|
773
|
+
var useServiceSlots = (service_id, queryParams, options) => {
|
|
774
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
775
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
776
|
+
return client.useQuery(
|
|
777
|
+
"get",
|
|
778
|
+
"/v1/services/{service_id}/slots",
|
|
779
|
+
{
|
|
780
|
+
params: {
|
|
781
|
+
path: { service_id },
|
|
782
|
+
query: queryParams
|
|
783
|
+
}
|
|
784
|
+
},
|
|
785
|
+
queryOptions
|
|
786
|
+
);
|
|
787
|
+
};
|
|
788
|
+
|
|
789
|
+
// src/query-hooks/use-services.ts
|
|
790
|
+
var useServices = (queryParams, options) => {
|
|
791
|
+
const { client: overrideClient, ...queryOptions } = options ?? {};
|
|
792
|
+
const client = useSavvyCalQueryClient(overrideClient);
|
|
793
|
+
return client.useQuery(
|
|
794
|
+
"get",
|
|
795
|
+
"/v1/services",
|
|
796
|
+
{
|
|
797
|
+
params: {
|
|
798
|
+
query: queryParams
|
|
799
|
+
}
|
|
800
|
+
},
|
|
801
|
+
queryOptions
|
|
802
|
+
);
|
|
803
|
+
};
|
|
804
|
+
export {
|
|
805
|
+
SavvyCalProvider,
|
|
806
|
+
createQueryClient,
|
|
807
|
+
useAccountById,
|
|
808
|
+
useAccountUsers,
|
|
809
|
+
useAccounts,
|
|
810
|
+
useAppointment,
|
|
811
|
+
useAppointments,
|
|
812
|
+
useBlock,
|
|
813
|
+
useBlocks,
|
|
814
|
+
useCancelAppointment,
|
|
815
|
+
useCancelPublicAppointment,
|
|
816
|
+
useCancellationReason,
|
|
817
|
+
useCancellationReasons,
|
|
818
|
+
useClient,
|
|
819
|
+
useClients,
|
|
820
|
+
useConfirmAppointment,
|
|
821
|
+
useCreateAccount,
|
|
822
|
+
useCreateAccountUser,
|
|
823
|
+
useCreateAppointment,
|
|
824
|
+
useCreateBlock,
|
|
825
|
+
useCreateCancellationReason,
|
|
826
|
+
useCreateClient,
|
|
827
|
+
useCreateDashboardSession,
|
|
828
|
+
useCreateProvider,
|
|
829
|
+
useCreateProviderSchedule,
|
|
830
|
+
useCreatePublicAppointment,
|
|
831
|
+
useCreateService,
|
|
832
|
+
useCreateServiceProvider,
|
|
833
|
+
useCurrentAccount,
|
|
834
|
+
useCurrentAccountUser,
|
|
835
|
+
useCurrentPlatform,
|
|
836
|
+
useDeactivateProvider,
|
|
837
|
+
useDeleteBlock,
|
|
838
|
+
useDeleteCancellationReason,
|
|
839
|
+
useDeleteClient,
|
|
840
|
+
useDeleteProviderSchedule,
|
|
841
|
+
useDeleteService,
|
|
842
|
+
useDeleteServiceProvider,
|
|
843
|
+
useEarliestPublicServiceSlot,
|
|
844
|
+
useProvider,
|
|
845
|
+
useProviderSchedule,
|
|
846
|
+
useProviderSchedules,
|
|
847
|
+
useProviders,
|
|
848
|
+
usePublicAppointment,
|
|
849
|
+
usePublicCancellationReasons,
|
|
850
|
+
usePublicServiceSlots,
|
|
851
|
+
useRescheduleAppointment,
|
|
852
|
+
useReschedulePublicAppointment,
|
|
853
|
+
useRoles,
|
|
854
|
+
useSavvyCalFetchClient,
|
|
855
|
+
useSavvyCalQueryClient,
|
|
856
|
+
useService,
|
|
857
|
+
useServiceProviders,
|
|
858
|
+
useServiceSlots,
|
|
859
|
+
useServices,
|
|
860
|
+
useUpdateAccount,
|
|
861
|
+
useUpdateBlock,
|
|
862
|
+
useUpdateCancellationReason,
|
|
863
|
+
useUpdateClient,
|
|
864
|
+
useUpdateProvider,
|
|
865
|
+
useUpdateProviderSchedule,
|
|
866
|
+
useUpdateService
|
|
867
|
+
};
|