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

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