@composable-os/pack-bookings 0.1.0-beta.10 → 0.1.0-beta.13

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.
@@ -1,6 +1,6 @@
1
- import { type ClientHolding, type PackClient } from "@composable-os/client";
1
+ import { type ClientHolding, type PackClient, type UseMutation, type UseQuery } from "@composable-os/client";
2
2
  import type { z } from "@composable-os/sdk";
3
- import type { book, bookFor, cancel, cancelFor, classGet, classList, day, findPeople, mine, returnUse, timetable } from "../tools.ts";
3
+ import type { book, bookFor, buy, cancel, cancelClass, cancelFor, classGet, classList, day, family, findPeople, leaveWaitlist, markAll, markAttended, markNoShow, mine, move, returnUse, roster, timetable, undoAttended } from "../tools.ts";
4
4
  type Io<T extends {
5
5
  input: z.ZodType;
6
6
  output: z.ZodType;
@@ -19,12 +19,36 @@ export type BookingsOperations = {
19
19
  "x.bookings.mine": {
20
20
  kind: "query";
21
21
  } & Io<typeof mine>;
22
+ "x.bookings.family": {
23
+ kind: "query";
24
+ } & Io<typeof family>;
25
+ "me.family": {
26
+ kind: "query";
27
+ input: Record<string, never>;
28
+ output: {
29
+ self: {
30
+ personId: string;
31
+ name: string;
32
+ };
33
+ dependants: {
34
+ personId: string;
35
+ name: string;
36
+ }[];
37
+ guardians: {
38
+ personId: string;
39
+ name: string;
40
+ }[];
41
+ };
42
+ };
22
43
  "x.bookings.book": {
23
44
  kind: "mutation";
24
45
  } & Io<typeof book>;
25
46
  "x.bookings.cancel": {
26
47
  kind: "mutation";
27
48
  } & Io<typeof cancel>;
49
+ "x.bookings.leaveWaitlist": {
50
+ kind: "mutation";
51
+ } & Io<typeof leaveWaitlist>;
28
52
  "x.bookings.day": {
29
53
  kind: "query";
30
54
  } & Io<typeof day>;
@@ -43,6 +67,41 @@ export type BookingsOperations = {
43
67
  "x.bookings.findPeople": {
44
68
  kind: "query";
45
69
  } & Io<typeof findPeople>;
70
+ "x.bookings.buy": {
71
+ kind: "mutation";
72
+ } & Io<typeof buy>;
73
+ "order.checkout": {
74
+ kind: "mutation";
75
+ input: {
76
+ id: string;
77
+ token?: string;
78
+ returnUrl: string;
79
+ };
80
+ output: {
81
+ url: string;
82
+ };
83
+ };
84
+ "x.bookings.roster": {
85
+ kind: "query";
86
+ } & Io<typeof roster>;
87
+ "x.bookings.markAttended": {
88
+ kind: "mutation";
89
+ } & Io<typeof markAttended>;
90
+ "x.bookings.undoAttended": {
91
+ kind: "mutation";
92
+ } & Io<typeof undoAttended>;
93
+ "x.bookings.markNoShow": {
94
+ kind: "mutation";
95
+ } & Io<typeof markNoShow>;
96
+ "x.bookings.markAll": {
97
+ kind: "mutation";
98
+ } & Io<typeof markAll>;
99
+ "x.bookings.move": {
100
+ kind: "mutation";
101
+ } & Io<typeof move>;
102
+ "x.bookings.cancelClass": {
103
+ kind: "mutation";
104
+ } & Io<typeof cancelClass>;
46
105
  };
47
106
  type Name = keyof BookingsOperations & string;
48
107
  type In<N extends Name> = BookingsOperations[N]["input"];
@@ -51,14 +110,21 @@ export type Timetable = Out<"x.bookings.timetable">;
51
110
  export type TimetableClass = Timetable["classes"][number];
52
111
  export type MyBookings = Out<"x.bookings.mine">;
53
112
  export type MyBooking = MyBookings["bookings"][number];
113
+ export type Family = Out<"x.bookings.family">;
114
+ export type FamilyPerson = Family["people"][number];
54
115
  export type BookResult = Out<"x.bookings.book">;
55
116
  export type CancelResult = Out<"x.bookings.cancel">;
56
117
  export type DayView = Out<"x.bookings.day">;
57
118
  export type ClassListView = Out<"x.bookings.classList">;
119
+ export type RosterView = Out<"x.bookings.roster">;
120
+ export type MarkResult = Out<"x.bookings.markAttended">;
58
121
  export type BookForResult = Out<"x.bookings.bookFor">;
122
+ export type BuyResult = Out<"x.bookings.buy">;
59
123
  export type FoundPeople = Out<"x.bookings.findPeople">;
60
124
  /** The client of every operation this entry calls (ADR 0453). */
61
125
  export type BookingsClient = PackClient<BookingsOperations>;
126
+ /** Today's date (YYYY-MM-DD) in `timeZone`, by this device's clock. */
127
+ export declare function todayIn(timeZone: string): string;
62
128
  /** A class's start and end in its own zone ("Tue 3 Mar, 06:00–07:00"), for display. */
63
129
  export declare function classTime(klass: {
64
130
  startsAt: string | null;
@@ -73,30 +139,11 @@ export declare function refusalMessage(result: {
73
139
  opensAt: string | null;
74
140
  reason: string;
75
141
  }, zone: string | null, locale?: string): string;
142
+ /** An amount the host gave in the minor unit, as a buyer reads it: `25.00 AUD`. Display only. */
143
+ export declare function formatAmount(minor: number, currency: string): string;
76
144
  /** The member's live booking of a class, if any (to show Cancel instead of Book). */
77
145
  export declare function bookingFor(classId: string, bookings: readonly MyBooking[] | undefined): MyBooking | undefined;
78
- /** The app's `useQuery`, as far as these hooks use it. */
79
- export type UseQuery = <T>(options: {
80
- queryKey: readonly unknown[];
81
- queryFn: () => Promise<T>;
82
- enabled?: boolean;
83
- }) => {
84
- data: T | undefined;
85
- isPending: boolean;
86
- error: unknown;
87
- refetch?: () => unknown;
88
- };
89
- /** The app's `useMutation`, as far as these hooks use it. */
90
- export type UseMutation = <I, O>(options: {
91
- mutationKey: readonly unknown[];
92
- mutationFn: (input: I) => Promise<O>;
93
- }) => {
94
- mutate(input: I): void;
95
- mutateAsync(input: I): Promise<O>;
96
- data: O | undefined;
97
- isPending: boolean;
98
- error: unknown;
99
- };
146
+ export type { UseMutation, UseQuery } from "@composable-os/client";
100
147
  /**
101
148
  * The operations each hook calls (ADR 0453). A customer's client gets the member's hooks (the
102
149
  * timetable, book, cancel, mine), the public's only the timetable and a class, the staff client
@@ -106,14 +153,24 @@ export declare const BOOKINGS_HOOKS_CALL: {
106
153
  readonly useTimetable: readonly ["x.bookings.timetable"];
107
154
  readonly useClass: readonly ["x.bookings.classGet"];
108
155
  readonly useMyBookings: readonly ["x.bookings.mine"];
156
+ readonly useFamily: readonly ["me.family"];
109
157
  readonly useBook: readonly ["x.bookings.book"];
110
158
  readonly useCancel: readonly ["x.bookings.cancel"];
159
+ readonly useLeaveWaitlist: readonly ["x.bookings.leaveWaitlist"];
111
160
  readonly useDay: readonly ["x.bookings.day"];
112
161
  readonly useClassList: readonly ["x.bookings.classList"];
113
162
  readonly useBookFor: readonly ["x.bookings.bookFor"];
114
163
  readonly useCancelFor: readonly ["x.bookings.cancelFor"];
115
164
  readonly useReturnUse: readonly ["x.bookings.returnUse"];
116
165
  readonly useFindPeople: readonly ["x.bookings.findPeople"];
166
+ readonly useBuy: readonly ["x.bookings.buy", "order.checkout"];
167
+ readonly useRoster: readonly ["x.bookings.roster"];
168
+ readonly useMarkAttended: readonly ["x.bookings.markAttended"];
169
+ readonly useUndoAttended: readonly ["x.bookings.undoAttended"];
170
+ readonly useMarkNoShow: readonly ["x.bookings.markNoShow"];
171
+ readonly useMarkAll: readonly ["x.bookings.markAll"];
172
+ readonly useMove: readonly ["x.bookings.move"];
173
+ readonly useCancelClass: readonly ["x.bookings.cancelClass"];
117
174
  };
118
175
  /**
119
176
  * Hooks for a React or React Native app:
@@ -186,13 +243,16 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
186
243
  error: unknown;
187
244
  refetch?: () => unknown;
188
245
  };
189
- /** The signed-in member's own bookings. */
246
+ /** The signed-in member's own bookings, or (with personId) a child's linked to them. */
190
247
  useMyBookings(input?: In<"x.bookings.mine">): {
191
248
  data: {
192
249
  bookings: {
193
250
  id: string;
251
+ personId: string | null;
194
252
  state: string | null;
253
+ position: number | null;
195
254
  holderId: string | null;
255
+ dropInOrderId: string | null;
196
256
  classId: string | null;
197
257
  title: string | null;
198
258
  startsAt: string | null;
@@ -207,18 +267,50 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
207
267
  error: unknown;
208
268
  refetch?: () => unknown;
209
269
  };
210
- /** Books the member into a class; the host answers booked or why not. */
270
+ /**
271
+ * Who the member may book for: themselves and the children staff linked to them, read from
272
+ * the host's own family (`me.family`, stage 48) in the `family` tool's shape.
273
+ */
274
+ useFamily(): {
275
+ data: {
276
+ people: {
277
+ personId: string;
278
+ name: string;
279
+ self: boolean;
280
+ }[];
281
+ } | undefined;
282
+ isPending: boolean;
283
+ error: unknown;
284
+ refetch?: () => unknown;
285
+ };
286
+ /** Books the member into a class; the host answers booked, waiting (full) or why not. */
211
287
  useBook(): {
212
288
  mutate(input: {
213
289
  classId: string;
290
+ forPersonId?: string | undefined;
214
291
  holderId?: string | undefined;
292
+ waitlist?: boolean | undefined;
215
293
  }): void;
216
294
  mutateAsync(input: {
217
295
  classId: string;
296
+ forPersonId?: string | undefined;
218
297
  holderId?: string | undefined;
298
+ waitlist?: boolean | undefined;
219
299
  }): Promise<{
300
+ result: "booked";
301
+ bookingId: string;
302
+ classId: string;
303
+ holderId: string | null;
304
+ } | {
305
+ result: "waiting";
306
+ bookingId: string;
307
+ classId: string;
308
+ position: number | null;
309
+ waiting: number | null;
310
+ message: string;
311
+ } | {
220
312
  result: "refused";
221
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
313
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
222
314
  message: string;
223
315
  detail: string | null;
224
316
  opensAt: string | null;
@@ -228,15 +320,22 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
228
320
  name: string;
229
321
  reasons: string[];
230
322
  }[] | undefined;
231
- } | {
323
+ }>;
324
+ data: {
232
325
  result: "booked";
233
326
  bookingId: string;
234
327
  classId: string;
235
328
  holderId: string | null;
236
- }>;
237
- data: {
329
+ } | {
330
+ result: "waiting";
331
+ bookingId: string;
332
+ classId: string;
333
+ position: number | null;
334
+ waiting: number | null;
335
+ message: string;
336
+ } | {
238
337
  result: "refused";
239
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
338
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
240
339
  message: string;
241
340
  detail: string | null;
242
341
  opensAt: string | null;
@@ -246,14 +345,10 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
246
345
  name: string;
247
346
  reasons: string[];
248
347
  }[] | undefined;
249
- } | {
250
- result: "booked";
251
- bookingId: string;
252
- classId: string;
253
- holderId: string | null;
254
348
  } | undefined;
255
349
  isPending: boolean;
256
350
  error: unknown;
351
+ reset?: () => void;
257
352
  };
258
353
  /** Cancels a booking: first the host's preview (in time or late), then with confirm. */
259
354
  useCancel(): {
@@ -268,7 +363,7 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
268
363
  expect?: "cancelled" | "late_cancelled" | undefined;
269
364
  }): Promise<{
270
365
  result: "refused";
271
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
366
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
272
367
  message: string;
273
368
  detail: string | null;
274
369
  opensAt: string | null;
@@ -282,11 +377,12 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
282
377
  result: "cancelled" | "late_cancelled" | "preview";
283
378
  state: "cancelled" | "late_cancelled";
284
379
  late: boolean;
380
+ dropIn: boolean;
285
381
  message: string;
286
382
  }>;
287
383
  data: {
288
384
  result: "refused";
289
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
385
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
290
386
  message: string;
291
387
  detail: string | null;
292
388
  opensAt: string | null;
@@ -300,10 +396,55 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
300
396
  result: "cancelled" | "late_cancelled" | "preview";
301
397
  state: "cancelled" | "late_cancelled";
302
398
  late: boolean;
399
+ dropIn: boolean;
400
+ message: string;
401
+ } | undefined;
402
+ isPending: boolean;
403
+ error: unknown;
404
+ reset?: () => void;
405
+ };
406
+ /** Takes the member off a class's waitlist (a booking that is waiting). */
407
+ useLeaveWaitlist(): {
408
+ mutate(input: {
409
+ bookingId: string;
410
+ }): void;
411
+ mutateAsync(input: {
412
+ bookingId: string;
413
+ }): Promise<{
414
+ result: "refused";
415
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
416
+ message: string;
417
+ detail: string | null;
418
+ opensAt: string | null;
419
+ closesAt: string | null;
420
+ people?: {
421
+ id: string;
422
+ name: string;
423
+ reasons: string[];
424
+ }[] | undefined;
425
+ } | {
426
+ result: "left";
427
+ bookingId: string;
428
+ }>;
429
+ data: {
430
+ result: "refused";
431
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
303
432
  message: string;
433
+ detail: string | null;
434
+ opensAt: string | null;
435
+ closesAt: string | null;
436
+ people?: {
437
+ id: string;
438
+ name: string;
439
+ reasons: string[];
440
+ }[] | undefined;
441
+ } | {
442
+ result: "left";
443
+ bookingId: string;
304
444
  } | undefined;
305
445
  isPending: boolean;
306
446
  error: unknown;
447
+ reset?: () => void;
307
448
  };
308
449
  /** Staff: one local date's classes. */
309
450
  useDay(input: In<"x.bookings.day">): {
@@ -365,6 +506,9 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
365
506
  paidAtDesk: boolean;
366
507
  holderId: string | null;
367
508
  bookedBy: string | null;
509
+ promotedAt: string | null;
510
+ healthNote: boolean | null;
511
+ passedOver: string | null;
368
512
  }[];
369
513
  } | undefined;
370
514
  isPending: boolean;
@@ -384,6 +528,7 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
384
528
  confirmNew?: boolean | undefined;
385
529
  holderId?: string | undefined;
386
530
  paidAtDesk?: boolean | undefined;
531
+ waitlist?: boolean | undefined;
387
532
  note?: string | undefined;
388
533
  }): void;
389
534
  mutateAsync(input: {
@@ -397,10 +542,11 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
397
542
  confirmNew?: boolean | undefined;
398
543
  holderId?: string | undefined;
399
544
  paidAtDesk?: boolean | undefined;
545
+ waitlist?: boolean | undefined;
400
546
  note?: string | undefined;
401
547
  }): Promise<{
402
548
  result: "refused";
403
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
549
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
404
550
  message: string;
405
551
  detail: string | null;
406
552
  opensAt: string | null;
@@ -416,10 +562,18 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
416
562
  classId: string;
417
563
  holderId: string | null;
418
564
  personId: string;
565
+ } | {
566
+ result: "waiting";
567
+ bookingId: string;
568
+ classId: string;
569
+ position: number | null;
570
+ waiting: number | null;
571
+ message: string;
572
+ personId: string;
419
573
  }>;
420
574
  data: {
421
575
  result: "refused";
422
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
576
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
423
577
  message: string;
424
578
  detail: string | null;
425
579
  opensAt: string | null;
@@ -435,9 +589,18 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
435
589
  classId: string;
436
590
  holderId: string | null;
437
591
  personId: string;
592
+ } | {
593
+ result: "waiting";
594
+ bookingId: string;
595
+ classId: string;
596
+ position: number | null;
597
+ waiting: number | null;
598
+ message: string;
599
+ personId: string;
438
600
  } | undefined;
439
601
  isPending: boolean;
440
602
  error: unknown;
603
+ reset?: () => void;
441
604
  };
442
605
  /** Staff: cancel a booking, in time or late by the host's clock. */
443
606
  useCancelFor(): {
@@ -452,7 +615,7 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
452
615
  note?: string | undefined;
453
616
  }): Promise<{
454
617
  result: "refused";
455
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
618
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
456
619
  message: string;
457
620
  detail: string | null;
458
621
  opensAt: string | null;
@@ -469,7 +632,7 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
469
632
  }>;
470
633
  data: {
471
634
  result: "refused";
472
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
635
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
473
636
  message: string;
474
637
  detail: string | null;
475
638
  opensAt: string | null;
@@ -486,6 +649,7 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
486
649
  } | undefined;
487
650
  isPending: boolean;
488
651
  error: unknown;
652
+ reset?: () => void;
489
653
  };
490
654
  /** A person on the staff: give a booking's use back after the late point (destructive). */
491
655
  useReturnUse(): {
@@ -498,7 +662,7 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
498
662
  reason: string;
499
663
  }): Promise<{
500
664
  result: "refused";
501
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
665
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
502
666
  message: string;
503
667
  detail: string | null;
504
668
  opensAt: string | null;
@@ -515,7 +679,7 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
515
679
  }>;
516
680
  data: {
517
681
  result: "refused";
518
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
682
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
519
683
  message: string;
520
684
  detail: string | null;
521
685
  opensAt: string | null;
@@ -532,6 +696,93 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
532
696
  } | undefined;
533
697
  isPending: boolean;
534
698
  error: unknown;
699
+ reset?: () => void;
700
+ };
701
+ /**
702
+ * Pay for one class (a drop-in, web only): `start` has the host hold the place and start the
703
+ * order; `checkout` opens the provider's page for it.
704
+ */
705
+ useBuy(): {
706
+ start: {
707
+ mutate(input: {
708
+ classId: string;
709
+ forPersonId?: string | undefined;
710
+ email?: string | undefined;
711
+ agreements?: Record<string, unknown>[] | undefined;
712
+ }): void;
713
+ mutateAsync(input: {
714
+ classId: string;
715
+ forPersonId?: string | undefined;
716
+ email?: string | undefined;
717
+ agreements?: Record<string, unknown>[] | undefined;
718
+ }): Promise<{
719
+ result: "refused";
720
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
721
+ message: string;
722
+ detail: string | null;
723
+ opensAt: string | null;
724
+ closesAt: string | null;
725
+ people?: {
726
+ id: string;
727
+ name: string;
728
+ reasons: string[];
729
+ }[] | undefined;
730
+ } | {
731
+ result: "pending";
732
+ bookingId: string;
733
+ classId: string;
734
+ orderId: string;
735
+ total: number;
736
+ currency: string;
737
+ expiresAt: string | null;
738
+ token: string | null;
739
+ }>;
740
+ data: {
741
+ result: "refused";
742
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
743
+ message: string;
744
+ detail: string | null;
745
+ opensAt: string | null;
746
+ closesAt: string | null;
747
+ people?: {
748
+ id: string;
749
+ name: string;
750
+ reasons: string[];
751
+ }[] | undefined;
752
+ } | {
753
+ result: "pending";
754
+ bookingId: string;
755
+ classId: string;
756
+ orderId: string;
757
+ total: number;
758
+ currency: string;
759
+ expiresAt: string | null;
760
+ token: string | null;
761
+ } | undefined;
762
+ isPending: boolean;
763
+ error: unknown;
764
+ reset?: () => void;
765
+ };
766
+ checkout: {
767
+ mutate(input: {
768
+ id: string;
769
+ token?: string;
770
+ returnUrl: string;
771
+ }): void;
772
+ mutateAsync(input: {
773
+ id: string;
774
+ token?: string;
775
+ returnUrl: string;
776
+ }): Promise<{
777
+ url: string;
778
+ }>;
779
+ data: {
780
+ url: string;
781
+ } | undefined;
782
+ isPending: boolean;
783
+ error: unknown;
784
+ reset?: () => void;
785
+ };
535
786
  };
536
787
  /** Staff: People on file matching a name or email (at least two letters). */
537
788
  useFindPeople(input: In<"x.bookings.findPeople">): {
@@ -546,170 +797,584 @@ export declare function createBookingsHooks<C extends ClientHolding>(react: {
546
797
  error: unknown;
547
798
  refetch?: () => unknown;
548
799
  };
549
- }, {
550
- readonly useTimetable: readonly ["x.bookings.timetable"];
551
- readonly useClass: readonly ["x.bookings.classGet"];
552
- readonly useMyBookings: readonly ["x.bookings.mine"];
553
- readonly useBook: readonly ["x.bookings.book"];
554
- readonly useCancel: readonly ["x.bookings.cancel"];
555
- readonly useDay: readonly ["x.bookings.day"];
556
- readonly useClassList: readonly ["x.bookings.classList"];
557
- readonly useBookFor: readonly ["x.bookings.bookFor"];
558
- readonly useCancelFor: readonly ["x.bookings.cancelFor"];
559
- readonly useReturnUse: readonly ["x.bookings.returnUse"];
560
- readonly useFindPeople: readonly ["x.bookings.findPeople"];
561
- }, import("@composable-os/client").OperationsOf<C>>;
562
- declare function allBookingsHooks(react: {
563
- useQuery: UseQuery;
564
- useMutation: UseMutation;
565
- }, api: BookingsClient): {
566
- /** The timetable between two times (default: the next 7 days). */
567
- useTimetable(input?: In<"x.bookings.timetable">): {
800
+ /** A coach or staff: a class's list with names and marks (nothing of what anyone paid). */
801
+ useRoster(input: In<"x.bookings.roster">): {
568
802
  data: {
569
- classes: {
803
+ class: {
570
804
  id: string;
571
805
  title: string | null;
572
- classType: string | null;
573
- startsAt: string | null;
574
- endsAt: string | null;
575
- timeZone: string | null;
576
- room: {
806
+ classType: {
577
807
  id: string;
578
808
  name: string | null;
579
809
  } | null;
580
- coach: ({
581
- id: string;
582
- name: string | null;
583
- } & {
584
- photo?: string | null | undefined;
585
- }) | null;
586
- notes: string | null;
587
- places: {
588
- status: "available" | "low" | "sold_out";
589
- available?: number | null | undefined;
590
- };
591
- }[];
592
- } | undefined;
593
- isPending: boolean;
594
- error: unknown;
595
- refetch?: () => unknown;
596
- };
597
- /** One scheduled class. */
598
- useClass(input: In<"x.bookings.classGet">): {
599
- data: {
600
- class: {
601
- id: string;
602
- title: string | null;
603
- classType: string | null;
604
810
  startsAt: string | null;
605
811
  endsAt: string | null;
606
812
  timeZone: string | null;
607
- room: {
608
- id: string;
609
- name: string | null;
610
- } | null;
611
- coach: ({
612
- id: string;
613
- name: string | null;
614
- } & {
615
- photo?: string | null | undefined;
616
- }) | null;
617
- notes: string | null;
618
- places: {
619
- status: "available" | "low" | "sold_out";
620
- available?: number | null | undefined;
621
- };
813
+ coach: string | null;
814
+ room: string | null;
815
+ places: number | null;
816
+ booked: number;
817
+ held: number;
818
+ available: number | null;
819
+ state: string | null;
820
+ staffOnly: boolean;
622
821
  };
623
- } | undefined;
624
- isPending: boolean;
625
- error: unknown;
626
- refetch?: () => unknown;
627
- };
628
- /** The signed-in member's own bookings. */
629
- useMyBookings(input?: In<"x.bookings.mine">): {
630
- data: {
631
822
  bookings: {
632
823
  id: string;
824
+ person: {
825
+ id: string;
826
+ name: string | null;
827
+ } | null;
633
828
  state: string | null;
634
- holderId: string | null;
635
- classId: string | null;
636
- title: string | null;
637
- startsAt: string | null;
638
- endsAt: string | null;
639
- timeZone: string | null;
640
- classState: string | null;
641
- coach: string | null;
642
- room: string | null;
829
+ markedAt: string | null;
830
+ markedBy: string | null;
831
+ promotedAt: string | null;
832
+ healthNote: boolean | null;
643
833
  }[];
644
834
  } | undefined;
645
835
  isPending: boolean;
646
836
  error: unknown;
647
837
  refetch?: () => unknown;
648
838
  };
649
- /** Books the member into a class; the host answers booked or why not. */
650
- useBook(): {
839
+ /** A coach or staff: tick a name; the host says if someone ticked it first, and who. */
840
+ useMarkAttended(): {
651
841
  mutate(input: {
652
- classId: string;
653
- holderId?: string | undefined;
842
+ bookingId: string;
654
843
  }): void;
655
844
  mutateAsync(input: {
656
- classId: string;
657
- holderId?: string | undefined;
845
+ bookingId: string;
658
846
  }): Promise<{
659
- result: "refused";
660
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
847
+ result: "booked" | "attended" | "no_show";
848
+ bookingId: string;
661
849
  message: string;
662
- detail: string | null;
663
- opensAt: string | null;
664
- closesAt: string | null;
665
- people?: {
666
- id: string;
667
- name: string;
668
- reasons: string[];
669
- }[] | undefined;
670
850
  } | {
671
- result: "booked";
851
+ result: "already";
672
852
  bookingId: string;
673
- classId: string;
674
- holderId: string | null;
853
+ state: string | null;
854
+ markedAt: string | null;
855
+ markedBy: string | null;
856
+ message: string;
857
+ } | {
858
+ result: "refused";
859
+ reason: "not_found" | "changed" | "not_started" | "not_booked";
860
+ state: string | null;
861
+ opensAt: string | null;
862
+ message: string;
675
863
  }>;
676
864
  data: {
677
- result: "refused";
678
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
865
+ result: "booked" | "attended" | "no_show";
866
+ bookingId: string;
679
867
  message: string;
680
- detail: string | null;
681
- opensAt: string | null;
682
- closesAt: string | null;
683
- people?: {
684
- id: string;
685
- name: string;
686
- reasons: string[];
687
- }[] | undefined;
688
868
  } | {
689
- result: "booked";
869
+ result: "already";
690
870
  bookingId: string;
691
- classId: string;
692
- holderId: string | null;
871
+ state: string | null;
872
+ markedAt: string | null;
873
+ markedBy: string | null;
874
+ message: string;
875
+ } | {
876
+ result: "refused";
877
+ reason: "not_found" | "changed" | "not_started" | "not_booked";
878
+ state: string | null;
879
+ opensAt: string | null;
880
+ message: string;
693
881
  } | undefined;
694
882
  isPending: boolean;
695
883
  error: unknown;
884
+ reset?: () => void;
696
885
  };
697
- /** Cancels a booking: first the host's preview (in time or late), then with confirm. */
698
- useCancel(): {
886
+ /** A coach or staff: untick a name ticked by mistake. */
887
+ useUndoAttended(): {
699
888
  mutate(input: {
700
889
  bookingId: string;
701
- confirm?: boolean | undefined;
702
- expect?: "cancelled" | "late_cancelled" | undefined;
703
890
  }): void;
704
891
  mutateAsync(input: {
705
892
  bookingId: string;
706
- confirm?: boolean | undefined;
707
- expect?: "cancelled" | "late_cancelled" | undefined;
708
893
  }): Promise<{
709
- result: "refused";
710
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
894
+ result: "booked" | "attended" | "no_show";
895
+ bookingId: string;
711
896
  message: string;
712
- detail: string | null;
897
+ } | {
898
+ result: "already";
899
+ bookingId: string;
900
+ state: string | null;
901
+ markedAt: string | null;
902
+ markedBy: string | null;
903
+ message: string;
904
+ } | {
905
+ result: "refused";
906
+ reason: "not_found" | "changed" | "not_started" | "not_booked";
907
+ state: string | null;
908
+ opensAt: string | null;
909
+ message: string;
910
+ }>;
911
+ data: {
912
+ result: "booked" | "attended" | "no_show";
913
+ bookingId: string;
914
+ message: string;
915
+ } | {
916
+ result: "already";
917
+ bookingId: string;
918
+ state: string | null;
919
+ markedAt: string | null;
920
+ markedBy: string | null;
921
+ message: string;
922
+ } | {
923
+ result: "refused";
924
+ reason: "not_found" | "changed" | "not_started" | "not_booked";
925
+ state: string | null;
926
+ opensAt: string | null;
927
+ message: string;
928
+ } | undefined;
929
+ isPending: boolean;
930
+ error: unknown;
931
+ reset?: () => void;
932
+ };
933
+ /** A coach or staff: mark a name as not come, once the class has started. */
934
+ useMarkNoShow(): {
935
+ mutate(input: {
936
+ bookingId: string;
937
+ }): void;
938
+ mutateAsync(input: {
939
+ bookingId: string;
940
+ }): Promise<{
941
+ result: "booked" | "attended" | "no_show";
942
+ bookingId: string;
943
+ message: string;
944
+ } | {
945
+ result: "already";
946
+ bookingId: string;
947
+ state: string | null;
948
+ markedAt: string | null;
949
+ markedBy: string | null;
950
+ message: string;
951
+ } | {
952
+ result: "refused";
953
+ reason: "not_found" | "changed" | "not_started" | "not_booked";
954
+ state: string | null;
955
+ opensAt: string | null;
956
+ message: string;
957
+ }>;
958
+ data: {
959
+ result: "booked" | "attended" | "no_show";
960
+ bookingId: string;
961
+ message: string;
962
+ } | {
963
+ result: "already";
964
+ bookingId: string;
965
+ state: string | null;
966
+ markedAt: string | null;
967
+ markedBy: string | null;
968
+ message: string;
969
+ } | {
970
+ result: "refused";
971
+ reason: "not_found" | "changed" | "not_started" | "not_booked";
972
+ state: string | null;
973
+ opensAt: string | null;
974
+ message: string;
975
+ } | undefined;
976
+ isPending: boolean;
977
+ error: unknown;
978
+ reset?: () => void;
979
+ };
980
+ /** A coach or staff: tick everyone still booked on a class. */
981
+ useMarkAll(): {
982
+ mutate(input: {
983
+ classId: string;
984
+ }): void;
985
+ mutateAsync(input: {
986
+ classId: string;
987
+ }): Promise<{
988
+ result: "refused";
989
+ reason: "not_found" | "changed" | "not_started" | "not_booked";
990
+ state: string | null;
991
+ opensAt: string | null;
992
+ message: string;
993
+ } | {
994
+ result: "marked";
995
+ classId: string;
996
+ ticked: number;
997
+ already: number;
998
+ skipped: number;
999
+ }>;
1000
+ data: {
1001
+ result: "refused";
1002
+ reason: "not_found" | "changed" | "not_started" | "not_booked";
1003
+ state: string | null;
1004
+ opensAt: string | null;
1005
+ message: string;
1006
+ } | {
1007
+ result: "marked";
1008
+ classId: string;
1009
+ ticked: number;
1010
+ already: number;
1011
+ skipped: number;
1012
+ } | undefined;
1013
+ isPending: boolean;
1014
+ error: unknown;
1015
+ reset?: () => void;
1016
+ };
1017
+ /** Staff: move a booking to another class with its use (refused whole when it cannot). */
1018
+ useMove(): {
1019
+ mutate(input: {
1020
+ bookingId: string;
1021
+ toClassId: string;
1022
+ note?: string | undefined;
1023
+ }): void;
1024
+ mutateAsync(input: {
1025
+ bookingId: string;
1026
+ toClassId: string;
1027
+ note?: string | undefined;
1028
+ }): Promise<{
1029
+ result: "refused";
1030
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
1031
+ message: string;
1032
+ detail: string | null;
1033
+ opensAt: string | null;
1034
+ closesAt: string | null;
1035
+ people?: {
1036
+ id: string;
1037
+ name: string;
1038
+ reasons: string[];
1039
+ }[] | undefined;
1040
+ } | {
1041
+ result: "moved";
1042
+ fromBookingId: string;
1043
+ bookingId: string;
1044
+ classId: string;
1045
+ holderId: string | null;
1046
+ } | {
1047
+ result: "refused";
1048
+ message: string;
1049
+ detail: string | null;
1050
+ opensAt: string | null;
1051
+ closesAt: string | null;
1052
+ reason: "not_booked" | "same_class" | "started";
1053
+ people?: {
1054
+ id: string;
1055
+ name: string;
1056
+ reasons: string[];
1057
+ }[] | undefined;
1058
+ }>;
1059
+ data: {
1060
+ result: "refused";
1061
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
1062
+ message: string;
1063
+ detail: string | null;
1064
+ opensAt: string | null;
1065
+ closesAt: string | null;
1066
+ people?: {
1067
+ id: string;
1068
+ name: string;
1069
+ reasons: string[];
1070
+ }[] | undefined;
1071
+ } | {
1072
+ result: "moved";
1073
+ fromBookingId: string;
1074
+ bookingId: string;
1075
+ classId: string;
1076
+ holderId: string | null;
1077
+ } | {
1078
+ result: "refused";
1079
+ message: string;
1080
+ detail: string | null;
1081
+ opensAt: string | null;
1082
+ closesAt: string | null;
1083
+ reason: "not_booked" | "same_class" | "started";
1084
+ people?: {
1085
+ id: string;
1086
+ name: string;
1087
+ reasons: string[];
1088
+ }[] | undefined;
1089
+ } | undefined;
1090
+ isPending: boolean;
1091
+ error: unknown;
1092
+ reset?: () => void;
1093
+ };
1094
+ /** A person on the staff: cancel a class and its bookings (an AI's call waits for one). */
1095
+ useCancelClass(): {
1096
+ mutate(input: {
1097
+ classId: string;
1098
+ reason: string;
1099
+ }): void;
1100
+ mutateAsync(input: {
1101
+ classId: string;
1102
+ reason: string;
1103
+ }): Promise<{
1104
+ result: "cancelled";
1105
+ classId: string;
1106
+ bookingsCancelled: number;
1107
+ }>;
1108
+ data: {
1109
+ result: "cancelled";
1110
+ classId: string;
1111
+ bookingsCancelled: number;
1112
+ } | undefined;
1113
+ isPending: boolean;
1114
+ error: unknown;
1115
+ reset?: () => void;
1116
+ };
1117
+ }, {
1118
+ readonly useTimetable: readonly ["x.bookings.timetable"];
1119
+ readonly useClass: readonly ["x.bookings.classGet"];
1120
+ readonly useMyBookings: readonly ["x.bookings.mine"];
1121
+ readonly useFamily: readonly ["me.family"];
1122
+ readonly useBook: readonly ["x.bookings.book"];
1123
+ readonly useCancel: readonly ["x.bookings.cancel"];
1124
+ readonly useLeaveWaitlist: readonly ["x.bookings.leaveWaitlist"];
1125
+ readonly useDay: readonly ["x.bookings.day"];
1126
+ readonly useClassList: readonly ["x.bookings.classList"];
1127
+ readonly useBookFor: readonly ["x.bookings.bookFor"];
1128
+ readonly useCancelFor: readonly ["x.bookings.cancelFor"];
1129
+ readonly useReturnUse: readonly ["x.bookings.returnUse"];
1130
+ readonly useFindPeople: readonly ["x.bookings.findPeople"];
1131
+ readonly useBuy: readonly ["x.bookings.buy", "order.checkout"];
1132
+ readonly useRoster: readonly ["x.bookings.roster"];
1133
+ readonly useMarkAttended: readonly ["x.bookings.markAttended"];
1134
+ readonly useUndoAttended: readonly ["x.bookings.undoAttended"];
1135
+ readonly useMarkNoShow: readonly ["x.bookings.markNoShow"];
1136
+ readonly useMarkAll: readonly ["x.bookings.markAll"];
1137
+ readonly useMove: readonly ["x.bookings.move"];
1138
+ readonly useCancelClass: readonly ["x.bookings.cancelClass"];
1139
+ }, import("@composable-os/client").OperationsOf<C>>;
1140
+ declare function allBookingsHooks(react: {
1141
+ useQuery: UseQuery;
1142
+ useMutation: UseMutation;
1143
+ }, api: BookingsClient): {
1144
+ /** The timetable between two times (default: the next 7 days). */
1145
+ useTimetable(input?: In<"x.bookings.timetable">): {
1146
+ data: {
1147
+ classes: {
1148
+ id: string;
1149
+ title: string | null;
1150
+ classType: string | null;
1151
+ startsAt: string | null;
1152
+ endsAt: string | null;
1153
+ timeZone: string | null;
1154
+ room: {
1155
+ id: string;
1156
+ name: string | null;
1157
+ } | null;
1158
+ coach: ({
1159
+ id: string;
1160
+ name: string | null;
1161
+ } & {
1162
+ photo?: string | null | undefined;
1163
+ }) | null;
1164
+ notes: string | null;
1165
+ places: {
1166
+ status: "available" | "low" | "sold_out";
1167
+ available?: number | null | undefined;
1168
+ };
1169
+ }[];
1170
+ } | undefined;
1171
+ isPending: boolean;
1172
+ error: unknown;
1173
+ refetch?: () => unknown;
1174
+ };
1175
+ /** One scheduled class. */
1176
+ useClass(input: In<"x.bookings.classGet">): {
1177
+ data: {
1178
+ class: {
1179
+ id: string;
1180
+ title: string | null;
1181
+ classType: string | null;
1182
+ startsAt: string | null;
1183
+ endsAt: string | null;
1184
+ timeZone: string | null;
1185
+ room: {
1186
+ id: string;
1187
+ name: string | null;
1188
+ } | null;
1189
+ coach: ({
1190
+ id: string;
1191
+ name: string | null;
1192
+ } & {
1193
+ photo?: string | null | undefined;
1194
+ }) | null;
1195
+ notes: string | null;
1196
+ places: {
1197
+ status: "available" | "low" | "sold_out";
1198
+ available?: number | null | undefined;
1199
+ };
1200
+ };
1201
+ } | undefined;
1202
+ isPending: boolean;
1203
+ error: unknown;
1204
+ refetch?: () => unknown;
1205
+ };
1206
+ /** The signed-in member's own bookings, or (with personId) a child's linked to them. */
1207
+ useMyBookings(input?: In<"x.bookings.mine">): {
1208
+ data: {
1209
+ bookings: {
1210
+ id: string;
1211
+ personId: string | null;
1212
+ state: string | null;
1213
+ position: number | null;
1214
+ holderId: string | null;
1215
+ dropInOrderId: string | null;
1216
+ classId: string | null;
1217
+ title: string | null;
1218
+ startsAt: string | null;
1219
+ endsAt: string | null;
1220
+ timeZone: string | null;
1221
+ classState: string | null;
1222
+ coach: string | null;
1223
+ room: string | null;
1224
+ }[];
1225
+ } | undefined;
1226
+ isPending: boolean;
1227
+ error: unknown;
1228
+ refetch?: () => unknown;
1229
+ };
1230
+ /**
1231
+ * Who the member may book for: themselves and the children staff linked to them, read from
1232
+ * the host's own family (`me.family`, stage 48) in the `family` tool's shape.
1233
+ */
1234
+ useFamily(): {
1235
+ data: {
1236
+ people: {
1237
+ personId: string;
1238
+ name: string;
1239
+ self: boolean;
1240
+ }[];
1241
+ } | undefined;
1242
+ isPending: boolean;
1243
+ error: unknown;
1244
+ refetch?: () => unknown;
1245
+ };
1246
+ /** Books the member into a class; the host answers booked, waiting (full) or why not. */
1247
+ useBook(): {
1248
+ mutate(input: {
1249
+ classId: string;
1250
+ forPersonId?: string | undefined;
1251
+ holderId?: string | undefined;
1252
+ waitlist?: boolean | undefined;
1253
+ }): void;
1254
+ mutateAsync(input: {
1255
+ classId: string;
1256
+ forPersonId?: string | undefined;
1257
+ holderId?: string | undefined;
1258
+ waitlist?: boolean | undefined;
1259
+ }): Promise<{
1260
+ result: "booked";
1261
+ bookingId: string;
1262
+ classId: string;
1263
+ holderId: string | null;
1264
+ } | {
1265
+ result: "waiting";
1266
+ bookingId: string;
1267
+ classId: string;
1268
+ position: number | null;
1269
+ waiting: number | null;
1270
+ message: string;
1271
+ } | {
1272
+ result: "refused";
1273
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
1274
+ message: string;
1275
+ detail: string | null;
1276
+ opensAt: string | null;
1277
+ closesAt: string | null;
1278
+ people?: {
1279
+ id: string;
1280
+ name: string;
1281
+ reasons: string[];
1282
+ }[] | undefined;
1283
+ }>;
1284
+ data: {
1285
+ result: "booked";
1286
+ bookingId: string;
1287
+ classId: string;
1288
+ holderId: string | null;
1289
+ } | {
1290
+ result: "waiting";
1291
+ bookingId: string;
1292
+ classId: string;
1293
+ position: number | null;
1294
+ waiting: number | null;
1295
+ message: string;
1296
+ } | {
1297
+ result: "refused";
1298
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
1299
+ message: string;
1300
+ detail: string | null;
1301
+ opensAt: string | null;
1302
+ closesAt: string | null;
1303
+ people?: {
1304
+ id: string;
1305
+ name: string;
1306
+ reasons: string[];
1307
+ }[] | undefined;
1308
+ } | undefined;
1309
+ isPending: boolean;
1310
+ error: unknown;
1311
+ reset?: () => void;
1312
+ };
1313
+ /** Cancels a booking: first the host's preview (in time or late), then with confirm. */
1314
+ useCancel(): {
1315
+ mutate(input: {
1316
+ bookingId: string;
1317
+ confirm?: boolean | undefined;
1318
+ expect?: "cancelled" | "late_cancelled" | undefined;
1319
+ }): void;
1320
+ mutateAsync(input: {
1321
+ bookingId: string;
1322
+ confirm?: boolean | undefined;
1323
+ expect?: "cancelled" | "late_cancelled" | undefined;
1324
+ }): Promise<{
1325
+ result: "refused";
1326
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
1327
+ message: string;
1328
+ detail: string | null;
1329
+ opensAt: string | null;
1330
+ closesAt: string | null;
1331
+ people?: {
1332
+ id: string;
1333
+ name: string;
1334
+ reasons: string[];
1335
+ }[] | undefined;
1336
+ } | {
1337
+ result: "cancelled" | "late_cancelled" | "preview";
1338
+ state: "cancelled" | "late_cancelled";
1339
+ late: boolean;
1340
+ dropIn: boolean;
1341
+ message: string;
1342
+ }>;
1343
+ data: {
1344
+ result: "refused";
1345
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
1346
+ message: string;
1347
+ detail: string | null;
1348
+ opensAt: string | null;
1349
+ closesAt: string | null;
1350
+ people?: {
1351
+ id: string;
1352
+ name: string;
1353
+ reasons: string[];
1354
+ }[] | undefined;
1355
+ } | {
1356
+ result: "cancelled" | "late_cancelled" | "preview";
1357
+ state: "cancelled" | "late_cancelled";
1358
+ late: boolean;
1359
+ dropIn: boolean;
1360
+ message: string;
1361
+ } | undefined;
1362
+ isPending: boolean;
1363
+ error: unknown;
1364
+ reset?: () => void;
1365
+ };
1366
+ /** Takes the member off a class's waitlist (a booking that is waiting). */
1367
+ useLeaveWaitlist(): {
1368
+ mutate(input: {
1369
+ bookingId: string;
1370
+ }): void;
1371
+ mutateAsync(input: {
1372
+ bookingId: string;
1373
+ }): Promise<{
1374
+ result: "refused";
1375
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
1376
+ message: string;
1377
+ detail: string | null;
713
1378
  opensAt: string | null;
714
1379
  closesAt: string | null;
715
1380
  people?: {
@@ -718,14 +1383,12 @@ declare function allBookingsHooks(react: {
718
1383
  reasons: string[];
719
1384
  }[] | undefined;
720
1385
  } | {
721
- result: "cancelled" | "late_cancelled" | "preview";
722
- state: "cancelled" | "late_cancelled";
723
- late: boolean;
724
- message: string;
1386
+ result: "left";
1387
+ bookingId: string;
725
1388
  }>;
726
1389
  data: {
727
1390
  result: "refused";
728
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
1391
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
729
1392
  message: string;
730
1393
  detail: string | null;
731
1394
  opensAt: string | null;
@@ -736,13 +1399,12 @@ declare function allBookingsHooks(react: {
736
1399
  reasons: string[];
737
1400
  }[] | undefined;
738
1401
  } | {
739
- result: "cancelled" | "late_cancelled" | "preview";
740
- state: "cancelled" | "late_cancelled";
741
- late: boolean;
742
- message: string;
1402
+ result: "left";
1403
+ bookingId: string;
743
1404
  } | undefined;
744
1405
  isPending: boolean;
745
1406
  error: unknown;
1407
+ reset?: () => void;
746
1408
  };
747
1409
  /** Staff: one local date's classes. */
748
1410
  useDay(input: In<"x.bookings.day">): {
@@ -804,6 +1466,9 @@ declare function allBookingsHooks(react: {
804
1466
  paidAtDesk: boolean;
805
1467
  holderId: string | null;
806
1468
  bookedBy: string | null;
1469
+ promotedAt: string | null;
1470
+ healthNote: boolean | null;
1471
+ passedOver: string | null;
807
1472
  }[];
808
1473
  } | undefined;
809
1474
  isPending: boolean;
@@ -823,6 +1488,7 @@ declare function allBookingsHooks(react: {
823
1488
  confirmNew?: boolean | undefined;
824
1489
  holderId?: string | undefined;
825
1490
  paidAtDesk?: boolean | undefined;
1491
+ waitlist?: boolean | undefined;
826
1492
  note?: string | undefined;
827
1493
  }): void;
828
1494
  mutateAsync(input: {
@@ -836,10 +1502,11 @@ declare function allBookingsHooks(react: {
836
1502
  confirmNew?: boolean | undefined;
837
1503
  holderId?: string | undefined;
838
1504
  paidAtDesk?: boolean | undefined;
1505
+ waitlist?: boolean | undefined;
839
1506
  note?: string | undefined;
840
1507
  }): Promise<{
841
1508
  result: "refused";
842
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
1509
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
843
1510
  message: string;
844
1511
  detail: string | null;
845
1512
  opensAt: string | null;
@@ -855,10 +1522,18 @@ declare function allBookingsHooks(react: {
855
1522
  classId: string;
856
1523
  holderId: string | null;
857
1524
  personId: string;
1525
+ } | {
1526
+ result: "waiting";
1527
+ bookingId: string;
1528
+ classId: string;
1529
+ position: number | null;
1530
+ waiting: number | null;
1531
+ message: string;
1532
+ personId: string;
858
1533
  }>;
859
1534
  data: {
860
1535
  result: "refused";
861
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
1536
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
862
1537
  message: string;
863
1538
  detail: string | null;
864
1539
  opensAt: string | null;
@@ -874,9 +1549,18 @@ declare function allBookingsHooks(react: {
874
1549
  classId: string;
875
1550
  holderId: string | null;
876
1551
  personId: string;
1552
+ } | {
1553
+ result: "waiting";
1554
+ bookingId: string;
1555
+ classId: string;
1556
+ position: number | null;
1557
+ waiting: number | null;
1558
+ message: string;
1559
+ personId: string;
877
1560
  } | undefined;
878
1561
  isPending: boolean;
879
1562
  error: unknown;
1563
+ reset?: () => void;
880
1564
  };
881
1565
  /** Staff: cancel a booking, in time or late by the host's clock. */
882
1566
  useCancelFor(): {
@@ -891,7 +1575,7 @@ declare function allBookingsHooks(react: {
891
1575
  note?: string | undefined;
892
1576
  }): Promise<{
893
1577
  result: "refused";
894
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
1578
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
895
1579
  message: string;
896
1580
  detail: string | null;
897
1581
  opensAt: string | null;
@@ -908,7 +1592,7 @@ declare function allBookingsHooks(react: {
908
1592
  }>;
909
1593
  data: {
910
1594
  result: "refused";
911
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
1595
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
912
1596
  message: string;
913
1597
  detail: string | null;
914
1598
  opensAt: string | null;
@@ -925,6 +1609,7 @@ declare function allBookingsHooks(react: {
925
1609
  } | undefined;
926
1610
  isPending: boolean;
927
1611
  error: unknown;
1612
+ reset?: () => void;
928
1613
  };
929
1614
  /** A person on the staff: give a booking's use back after the late point (destructive). */
930
1615
  useReturnUse(): {
@@ -937,7 +1622,7 @@ declare function allBookingsHooks(react: {
937
1622
  reason: string;
938
1623
  }): Promise<{
939
1624
  result: "refused";
940
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
1625
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
941
1626
  message: string;
942
1627
  detail: string | null;
943
1628
  opensAt: string | null;
@@ -954,7 +1639,7 @@ declare function allBookingsHooks(react: {
954
1639
  }>;
955
1640
  data: {
956
1641
  result: "refused";
957
- reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates";
1642
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
958
1643
  message: string;
959
1644
  detail: string | null;
960
1645
  opensAt: string | null;
@@ -971,6 +1656,93 @@ declare function allBookingsHooks(react: {
971
1656
  } | undefined;
972
1657
  isPending: boolean;
973
1658
  error: unknown;
1659
+ reset?: () => void;
1660
+ };
1661
+ /**
1662
+ * Pay for one class (a drop-in, web only): `start` has the host hold the place and start the
1663
+ * order; `checkout` opens the provider's page for it.
1664
+ */
1665
+ useBuy(): {
1666
+ start: {
1667
+ mutate(input: {
1668
+ classId: string;
1669
+ forPersonId?: string | undefined;
1670
+ email?: string | undefined;
1671
+ agreements?: Record<string, unknown>[] | undefined;
1672
+ }): void;
1673
+ mutateAsync(input: {
1674
+ classId: string;
1675
+ forPersonId?: string | undefined;
1676
+ email?: string | undefined;
1677
+ agreements?: Record<string, unknown>[] | undefined;
1678
+ }): Promise<{
1679
+ result: "refused";
1680
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
1681
+ message: string;
1682
+ detail: string | null;
1683
+ opensAt: string | null;
1684
+ closesAt: string | null;
1685
+ people?: {
1686
+ id: string;
1687
+ name: string;
1688
+ reasons: string[];
1689
+ }[] | undefined;
1690
+ } | {
1691
+ result: "pending";
1692
+ bookingId: string;
1693
+ classId: string;
1694
+ orderId: string;
1695
+ total: number;
1696
+ currency: string;
1697
+ expiresAt: string | null;
1698
+ token: string | null;
1699
+ }>;
1700
+ data: {
1701
+ result: "refused";
1702
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
1703
+ message: string;
1704
+ detail: string | null;
1705
+ opensAt: string | null;
1706
+ closesAt: string | null;
1707
+ people?: {
1708
+ id: string;
1709
+ name: string;
1710
+ reasons: string[];
1711
+ }[] | undefined;
1712
+ } | {
1713
+ result: "pending";
1714
+ bookingId: string;
1715
+ classId: string;
1716
+ orderId: string;
1717
+ total: number;
1718
+ currency: string;
1719
+ expiresAt: string | null;
1720
+ token: string | null;
1721
+ } | undefined;
1722
+ isPending: boolean;
1723
+ error: unknown;
1724
+ reset?: () => void;
1725
+ };
1726
+ checkout: {
1727
+ mutate(input: {
1728
+ id: string;
1729
+ token?: string;
1730
+ returnUrl: string;
1731
+ }): void;
1732
+ mutateAsync(input: {
1733
+ id: string;
1734
+ token?: string;
1735
+ returnUrl: string;
1736
+ }): Promise<{
1737
+ url: string;
1738
+ }>;
1739
+ data: {
1740
+ url: string;
1741
+ } | undefined;
1742
+ isPending: boolean;
1743
+ error: unknown;
1744
+ reset?: () => void;
1745
+ };
974
1746
  };
975
1747
  /** Staff: People on file matching a name or email (at least two letters). */
976
1748
  useFindPeople(input: In<"x.bookings.findPeople">): {
@@ -985,7 +1757,323 @@ declare function allBookingsHooks(react: {
985
1757
  error: unknown;
986
1758
  refetch?: () => unknown;
987
1759
  };
1760
+ /** A coach or staff: a class's list with names and marks (nothing of what anyone paid). */
1761
+ useRoster(input: In<"x.bookings.roster">): {
1762
+ data: {
1763
+ class: {
1764
+ id: string;
1765
+ title: string | null;
1766
+ classType: {
1767
+ id: string;
1768
+ name: string | null;
1769
+ } | null;
1770
+ startsAt: string | null;
1771
+ endsAt: string | null;
1772
+ timeZone: string | null;
1773
+ coach: string | null;
1774
+ room: string | null;
1775
+ places: number | null;
1776
+ booked: number;
1777
+ held: number;
1778
+ available: number | null;
1779
+ state: string | null;
1780
+ staffOnly: boolean;
1781
+ };
1782
+ bookings: {
1783
+ id: string;
1784
+ person: {
1785
+ id: string;
1786
+ name: string | null;
1787
+ } | null;
1788
+ state: string | null;
1789
+ markedAt: string | null;
1790
+ markedBy: string | null;
1791
+ promotedAt: string | null;
1792
+ healthNote: boolean | null;
1793
+ }[];
1794
+ } | undefined;
1795
+ isPending: boolean;
1796
+ error: unknown;
1797
+ refetch?: () => unknown;
1798
+ };
1799
+ /** A coach or staff: tick a name; the host says if someone ticked it first, and who. */
1800
+ useMarkAttended(): {
1801
+ mutate(input: {
1802
+ bookingId: string;
1803
+ }): void;
1804
+ mutateAsync(input: {
1805
+ bookingId: string;
1806
+ }): Promise<{
1807
+ result: "booked" | "attended" | "no_show";
1808
+ bookingId: string;
1809
+ message: string;
1810
+ } | {
1811
+ result: "already";
1812
+ bookingId: string;
1813
+ state: string | null;
1814
+ markedAt: string | null;
1815
+ markedBy: string | null;
1816
+ message: string;
1817
+ } | {
1818
+ result: "refused";
1819
+ reason: "not_found" | "changed" | "not_started" | "not_booked";
1820
+ state: string | null;
1821
+ opensAt: string | null;
1822
+ message: string;
1823
+ }>;
1824
+ data: {
1825
+ result: "booked" | "attended" | "no_show";
1826
+ bookingId: string;
1827
+ message: string;
1828
+ } | {
1829
+ result: "already";
1830
+ bookingId: string;
1831
+ state: string | null;
1832
+ markedAt: string | null;
1833
+ markedBy: string | null;
1834
+ message: string;
1835
+ } | {
1836
+ result: "refused";
1837
+ reason: "not_found" | "changed" | "not_started" | "not_booked";
1838
+ state: string | null;
1839
+ opensAt: string | null;
1840
+ message: string;
1841
+ } | undefined;
1842
+ isPending: boolean;
1843
+ error: unknown;
1844
+ reset?: () => void;
1845
+ };
1846
+ /** A coach or staff: untick a name ticked by mistake. */
1847
+ useUndoAttended(): {
1848
+ mutate(input: {
1849
+ bookingId: string;
1850
+ }): void;
1851
+ mutateAsync(input: {
1852
+ bookingId: string;
1853
+ }): Promise<{
1854
+ result: "booked" | "attended" | "no_show";
1855
+ bookingId: string;
1856
+ message: string;
1857
+ } | {
1858
+ result: "already";
1859
+ bookingId: string;
1860
+ state: string | null;
1861
+ markedAt: string | null;
1862
+ markedBy: string | null;
1863
+ message: string;
1864
+ } | {
1865
+ result: "refused";
1866
+ reason: "not_found" | "changed" | "not_started" | "not_booked";
1867
+ state: string | null;
1868
+ opensAt: string | null;
1869
+ message: string;
1870
+ }>;
1871
+ data: {
1872
+ result: "booked" | "attended" | "no_show";
1873
+ bookingId: string;
1874
+ message: string;
1875
+ } | {
1876
+ result: "already";
1877
+ bookingId: string;
1878
+ state: string | null;
1879
+ markedAt: string | null;
1880
+ markedBy: string | null;
1881
+ message: string;
1882
+ } | {
1883
+ result: "refused";
1884
+ reason: "not_found" | "changed" | "not_started" | "not_booked";
1885
+ state: string | null;
1886
+ opensAt: string | null;
1887
+ message: string;
1888
+ } | undefined;
1889
+ isPending: boolean;
1890
+ error: unknown;
1891
+ reset?: () => void;
1892
+ };
1893
+ /** A coach or staff: mark a name as not come, once the class has started. */
1894
+ useMarkNoShow(): {
1895
+ mutate(input: {
1896
+ bookingId: string;
1897
+ }): void;
1898
+ mutateAsync(input: {
1899
+ bookingId: string;
1900
+ }): Promise<{
1901
+ result: "booked" | "attended" | "no_show";
1902
+ bookingId: string;
1903
+ message: string;
1904
+ } | {
1905
+ result: "already";
1906
+ bookingId: string;
1907
+ state: string | null;
1908
+ markedAt: string | null;
1909
+ markedBy: string | null;
1910
+ message: string;
1911
+ } | {
1912
+ result: "refused";
1913
+ reason: "not_found" | "changed" | "not_started" | "not_booked";
1914
+ state: string | null;
1915
+ opensAt: string | null;
1916
+ message: string;
1917
+ }>;
1918
+ data: {
1919
+ result: "booked" | "attended" | "no_show";
1920
+ bookingId: string;
1921
+ message: string;
1922
+ } | {
1923
+ result: "already";
1924
+ bookingId: string;
1925
+ state: string | null;
1926
+ markedAt: string | null;
1927
+ markedBy: string | null;
1928
+ message: string;
1929
+ } | {
1930
+ result: "refused";
1931
+ reason: "not_found" | "changed" | "not_started" | "not_booked";
1932
+ state: string | null;
1933
+ opensAt: string | null;
1934
+ message: string;
1935
+ } | undefined;
1936
+ isPending: boolean;
1937
+ error: unknown;
1938
+ reset?: () => void;
1939
+ };
1940
+ /** A coach or staff: tick everyone still booked on a class. */
1941
+ useMarkAll(): {
1942
+ mutate(input: {
1943
+ classId: string;
1944
+ }): void;
1945
+ mutateAsync(input: {
1946
+ classId: string;
1947
+ }): Promise<{
1948
+ result: "refused";
1949
+ reason: "not_found" | "changed" | "not_started" | "not_booked";
1950
+ state: string | null;
1951
+ opensAt: string | null;
1952
+ message: string;
1953
+ } | {
1954
+ result: "marked";
1955
+ classId: string;
1956
+ ticked: number;
1957
+ already: number;
1958
+ skipped: number;
1959
+ }>;
1960
+ data: {
1961
+ result: "refused";
1962
+ reason: "not_found" | "changed" | "not_started" | "not_booked";
1963
+ state: string | null;
1964
+ opensAt: string | null;
1965
+ message: string;
1966
+ } | {
1967
+ result: "marked";
1968
+ classId: string;
1969
+ ticked: number;
1970
+ already: number;
1971
+ skipped: number;
1972
+ } | undefined;
1973
+ isPending: boolean;
1974
+ error: unknown;
1975
+ reset?: () => void;
1976
+ };
1977
+ /** Staff: move a booking to another class with its use (refused whole when it cannot). */
1978
+ useMove(): {
1979
+ mutate(input: {
1980
+ bookingId: string;
1981
+ toClassId: string;
1982
+ note?: string | undefined;
1983
+ }): void;
1984
+ mutateAsync(input: {
1985
+ bookingId: string;
1986
+ toClassId: string;
1987
+ note?: string | undefined;
1988
+ }): Promise<{
1989
+ result: "refused";
1990
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
1991
+ message: string;
1992
+ detail: string | null;
1993
+ opensAt: string | null;
1994
+ closesAt: string | null;
1995
+ people?: {
1996
+ id: string;
1997
+ name: string;
1998
+ reasons: string[];
1999
+ }[] | undefined;
2000
+ } | {
2001
+ result: "moved";
2002
+ fromBookingId: string;
2003
+ bookingId: string;
2004
+ classId: string;
2005
+ holderId: string | null;
2006
+ } | {
2007
+ result: "refused";
2008
+ message: string;
2009
+ detail: string | null;
2010
+ opensAt: string | null;
2011
+ closesAt: string | null;
2012
+ reason: "not_booked" | "same_class" | "started";
2013
+ people?: {
2014
+ id: string;
2015
+ name: string;
2016
+ reasons: string[];
2017
+ }[] | undefined;
2018
+ }>;
2019
+ data: {
2020
+ result: "refused";
2021
+ reason: "not_open" | "closed" | "staff_only" | "no_use" | "already_booked" | "full" | "too_late" | "not_found" | "changed" | "not_running" | "person_exists" | "possible_duplicates" | "waitlist_closed" | "no_drop_in" | "ask_desk" | "try_later";
2022
+ message: string;
2023
+ detail: string | null;
2024
+ opensAt: string | null;
2025
+ closesAt: string | null;
2026
+ people?: {
2027
+ id: string;
2028
+ name: string;
2029
+ reasons: string[];
2030
+ }[] | undefined;
2031
+ } | {
2032
+ result: "moved";
2033
+ fromBookingId: string;
2034
+ bookingId: string;
2035
+ classId: string;
2036
+ holderId: string | null;
2037
+ } | {
2038
+ result: "refused";
2039
+ message: string;
2040
+ detail: string | null;
2041
+ opensAt: string | null;
2042
+ closesAt: string | null;
2043
+ reason: "not_booked" | "same_class" | "started";
2044
+ people?: {
2045
+ id: string;
2046
+ name: string;
2047
+ reasons: string[];
2048
+ }[] | undefined;
2049
+ } | undefined;
2050
+ isPending: boolean;
2051
+ error: unknown;
2052
+ reset?: () => void;
2053
+ };
2054
+ /** A person on the staff: cancel a class and its bookings (an AI's call waits for one). */
2055
+ useCancelClass(): {
2056
+ mutate(input: {
2057
+ classId: string;
2058
+ reason: string;
2059
+ }): void;
2060
+ mutateAsync(input: {
2061
+ classId: string;
2062
+ reason: string;
2063
+ }): Promise<{
2064
+ result: "cancelled";
2065
+ classId: string;
2066
+ bookingsCancelled: number;
2067
+ }>;
2068
+ data: {
2069
+ result: "cancelled";
2070
+ classId: string;
2071
+ bookingsCancelled: number;
2072
+ } | undefined;
2073
+ isPending: boolean;
2074
+ error: unknown;
2075
+ reset?: () => void;
2076
+ };
988
2077
  };
989
2078
  /** Every hook of this entry. A block takes the ones it calls: `Pick<BookingsHooks, "useBook">`. */
990
2079
  export type BookingsHooks = ReturnType<typeof allBookingsHooks>;
991
- export {};