@composable-os/pack-rostering 0.0.0-stage → 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.
Files changed (51) hide show
  1. package/LICENSE +109 -0
  2. package/dist/blocks/rostering-away/away-list.d.ts +8 -0
  3. package/dist/blocks/rostering-away/away-list.js +101 -0
  4. package/dist/blocks/rostering-checklist/checklist.d.ts +9 -0
  5. package/dist/blocks/rostering-checklist/checklist.js +132 -0
  6. package/dist/blocks/rostering-checklist/my-shifts-with-checklist.d.ts +11 -0
  7. package/dist/blocks/rostering-checklist/my-shifts-with-checklist.js +6 -0
  8. package/dist/blocks/rostering-checklists/checklists.d.ts +11 -0
  9. package/dist/blocks/rostering-checklists/checklists.js +76 -0
  10. package/dist/blocks/rostering-my-availability/my-availability.d.ts +7 -0
  11. package/dist/blocks/rostering-my-availability/my-availability.js +143 -0
  12. package/dist/blocks/rostering-my-calendar/my-calendar.d.ts +6 -0
  13. package/dist/blocks/rostering-my-calendar/my-calendar.js +92 -0
  14. package/dist/blocks/rostering-my-shifts/my-hours.d.ts +6 -0
  15. package/dist/blocks/rostering-my-shifts/my-hours.js +63 -0
  16. package/dist/blocks/rostering-my-shifts/my-shifts.d.ts +17 -0
  17. package/dist/blocks/rostering-my-shifts/my-shifts.js +53 -0
  18. package/dist/blocks/rostering-native-checklist/checklist-screen.d.ts +8 -0
  19. package/dist/blocks/rostering-native-checklist/checklist-screen.js +110 -0
  20. package/dist/blocks/rostering-native-my-availability/my-availability-screen.d.ts +7 -0
  21. package/dist/blocks/rostering-native-my-availability/my-availability-screen.js +110 -0
  22. package/dist/blocks/rostering-native-my-calendar/my-calendar-screen.d.ts +10 -0
  23. package/dist/blocks/rostering-native-my-calendar/my-calendar-screen.js +72 -0
  24. package/dist/blocks/rostering-native-my-shifts/my-hours-screen.d.ts +6 -0
  25. package/dist/blocks/rostering-native-my-shifts/my-hours-screen.js +60 -0
  26. package/dist/blocks/rostering-native-my-shifts/my-shifts-screen.d.ts +12 -0
  27. package/dist/blocks/rostering-native-my-shifts/my-shifts-screen.js +56 -0
  28. package/dist/blocks/rostering-native-offers/offers-screen.d.ts +7 -0
  29. package/dist/blocks/rostering-native-offers/offers-screen.js +56 -0
  30. package/dist/blocks/rostering-native-roster/roster-screen.d.ts +7 -0
  31. package/dist/blocks/rostering-native-roster/roster-screen.js +31 -0
  32. package/dist/blocks/rostering-offers/offers.d.ts +7 -0
  33. package/dist/blocks/rostering-offers/offers.js +52 -0
  34. package/dist/blocks/rostering-patterns/patterns.d.ts +7 -0
  35. package/dist/blocks/rostering-patterns/patterns.js +58 -0
  36. package/dist/blocks/rostering-pay/pay.d.ts +7 -0
  37. package/dist/blocks/rostering-pay/pay.js +160 -0
  38. package/dist/blocks/rostering-qualifications/qualifications.d.ts +6 -0
  39. package/dist/blocks/rostering-qualifications/qualifications.js +48 -0
  40. package/dist/blocks/rostering-week/assign.d.ts +12 -0
  41. package/dist/blocks/rostering-week/assign.js +99 -0
  42. package/dist/blocks/rostering-week/week.d.ts +13 -0
  43. package/dist/blocks/rostering-week/week.js +82 -0
  44. package/dist/client/index.d.ts +3113 -0
  45. package/dist/client/index.js +654 -0
  46. package/dist/index.d.ts +1594 -0
  47. package/dist/index.js +541 -0
  48. package/dist/tools.d.ts +1094 -0
  49. package/dist/tools.js +1047 -0
  50. package/package.json +36 -4
  51. package/README.md +0 -3
@@ -0,0 +1,3113 @@
1
+ import { type ClientHolding, forgetAfter, type PackClient, type UseMutation, type UseQuery } from "@composable-os/client";
2
+ import type { z } from "@composable-os/sdk";
3
+ import type { assign, away, awayFor, awayList, back, candidates, check, checklist, checklistCorrect, checklistDone, checklistRuns, exportPeriod, feed, feedRevoke, feedRotate, follow, lock, markNotWorked, me, mine, myAway, myPay, myPayPeriods, offer, offers, patterns, payBases, payBasis, people, periods, periodTotals, planCheck, qualifications, qualify, reopen, setPattern, take, tick, uncovered, week, withdraw } from "../tools.ts";
4
+ export { forgetAfter };
5
+ type Io<T extends {
6
+ input: z.ZodType;
7
+ output: z.ZodType;
8
+ }> = {
9
+ input: z.input<T["input"]>;
10
+ output: z.output<T["output"]>;
11
+ };
12
+ /** The operations this entry calls, as the generated client types them. */
13
+ export type RosteringOperations = {
14
+ "x.rostering.me": {
15
+ kind: "query";
16
+ } & Io<typeof me>;
17
+ "x.rostering.week": {
18
+ kind: "query";
19
+ } & Io<typeof week>;
20
+ "x.rostering.mine": {
21
+ kind: "query";
22
+ } & Io<typeof mine>;
23
+ "x.rostering.offers": {
24
+ kind: "query";
25
+ } & Io<typeof offers>;
26
+ "x.rostering.offer": {
27
+ kind: "mutation";
28
+ } & Io<typeof offer>;
29
+ "x.rostering.withdraw": {
30
+ kind: "mutation";
31
+ } & Io<typeof withdraw>;
32
+ "x.rostering.take": {
33
+ kind: "mutation";
34
+ } & Io<typeof take>;
35
+ "x.rostering.away": {
36
+ kind: "mutation";
37
+ } & Io<typeof away>;
38
+ "x.rostering.back": {
39
+ kind: "mutation";
40
+ } & Io<typeof back>;
41
+ "x.rostering.myAway": {
42
+ kind: "query";
43
+ } & Io<typeof myAway>;
44
+ "x.rostering.myPayPeriods": {
45
+ kind: "query";
46
+ } & Io<typeof myPayPeriods>;
47
+ "x.rostering.myPay": {
48
+ kind: "query";
49
+ } & Io<typeof myPay>;
50
+ "x.rostering.assign": {
51
+ kind: "mutation";
52
+ } & Io<typeof assign>;
53
+ "x.rostering.check": {
54
+ kind: "query";
55
+ } & Io<typeof check>;
56
+ "x.rostering.candidates": {
57
+ kind: "query";
58
+ } & Io<typeof candidates>;
59
+ "x.rostering.follow": {
60
+ kind: "mutation";
61
+ } & Io<typeof follow>;
62
+ "x.rostering.people": {
63
+ kind: "query";
64
+ } & Io<typeof people>;
65
+ "x.rostering.patterns": {
66
+ kind: "query";
67
+ } & Io<typeof patterns>;
68
+ "x.rostering.setPattern": {
69
+ kind: "mutation";
70
+ } & Io<typeof setPattern>;
71
+ "x.rostering.planCheck": {
72
+ kind: "query";
73
+ } & Io<typeof planCheck>;
74
+ "x.rostering.qualify": {
75
+ kind: "mutation";
76
+ } & Io<typeof qualify>;
77
+ "x.rostering.qualifications": {
78
+ kind: "query";
79
+ } & Io<typeof qualifications>;
80
+ "x.rostering.awayFor": {
81
+ kind: "mutation";
82
+ } & Io<typeof awayFor>;
83
+ "x.rostering.awayList": {
84
+ kind: "query";
85
+ } & Io<typeof awayList>;
86
+ "x.rostering.uncovered": {
87
+ kind: "query";
88
+ } & Io<typeof uncovered>;
89
+ "x.rostering.markNotWorked": {
90
+ kind: "mutation";
91
+ } & Io<typeof markNotWorked>;
92
+ "x.rostering.payBasis": {
93
+ kind: "mutation";
94
+ } & Io<typeof payBasis>;
95
+ "x.rostering.payBases": {
96
+ kind: "query";
97
+ } & Io<typeof payBases>;
98
+ "x.rostering.periods": {
99
+ kind: "query";
100
+ } & Io<typeof periods>;
101
+ "x.rostering.periodTotals": {
102
+ kind: "query";
103
+ } & Io<typeof periodTotals>;
104
+ "x.rostering.lock": {
105
+ kind: "mutation";
106
+ } & Io<typeof lock>;
107
+ "x.rostering.reopen": {
108
+ kind: "mutation";
109
+ } & Io<typeof reopen>;
110
+ "x.rostering.export": {
111
+ kind: "query";
112
+ } & Io<typeof exportPeriod>;
113
+ "x.rostering.feed": {
114
+ kind: "query";
115
+ } & Io<typeof feed>;
116
+ "x.rostering.feedRotate": {
117
+ kind: "mutation";
118
+ } & Io<typeof feedRotate>;
119
+ "x.rostering.feedRevoke": {
120
+ kind: "mutation";
121
+ } & Io<typeof feedRevoke>;
122
+ "x.rostering.checklist": {
123
+ kind: "query";
124
+ } & Io<typeof checklist>;
125
+ "x.rostering.tick": {
126
+ kind: "mutation";
127
+ } & Io<typeof tick>;
128
+ "x.rostering.checklistDone": {
129
+ kind: "mutation";
130
+ } & Io<typeof checklistDone>;
131
+ "x.rostering.checklistRuns": {
132
+ kind: "query";
133
+ } & Io<typeof checklistRuns>;
134
+ "x.rostering.checklistCorrect": {
135
+ kind: "mutation";
136
+ } & Io<typeof checklistCorrect>;
137
+ };
138
+ type Name = keyof RosteringOperations & string;
139
+ type In<N extends Name> = RosteringOperations[N]["input"];
140
+ type Out<N extends Name> = RosteringOperations[N]["output"];
141
+ export type Me = Out<"x.rostering.me">;
142
+ export type Roster = Out<"x.rostering.week">;
143
+ export type RosterShift = Roster["shifts"][number];
144
+ export type RosterDay = Roster["days"][number];
145
+ export type StaffWarning = NonNullable<RosterShift["warnings"]>[number];
146
+ export type Offers = Out<"x.rostering.offers">;
147
+ export type OpenOffer = Offers["open"][number];
148
+ export type MyOffer = Offers["mine"][number];
149
+ export type AwayItem = Out<"x.rostering.myAway">["items"][number];
150
+ export type AwayInput = In<"x.rostering.away">;
151
+ export type AwayAnswer = Out<"x.rostering.away">;
152
+ export type Candidates = Out<"x.rostering.candidates">;
153
+ export type Candidate = Candidates["people"][number];
154
+ export type People = Out<"x.rostering.people">;
155
+ export type Kind = People["kinds"][number];
156
+ export type Qualification = Out<"x.rostering.qualifications">["items"][number];
157
+ export type Pattern = Out<"x.rostering.patterns">["patterns"][number];
158
+ export type PayBases = Out<"x.rostering.payBases">;
159
+ export type PayBasisValue = In<"x.rostering.payBasis">["basis"];
160
+ export type Periods = Out<"x.rostering.periods">;
161
+ export type Period = Periods["periods"][number];
162
+ export type PeriodTotals = Out<"x.rostering.periodTotals">;
163
+ export type PayExport = Out<"x.rostering.export">;
164
+ export type MyPayPeriods = Out<"x.rostering.myPayPeriods">;
165
+ export type MyPayPeriod = MyPayPeriods["periods"][number];
166
+ export type MyPay = Out<"x.rostering.myPay">;
167
+ export type MyPayLine = MyPay["lines"][number];
168
+ export type MyPayTotal = MyPay["totals"][number];
169
+ export type PlanCheck = Out<"x.rostering.planCheck">;
170
+ export type FeedState = Out<"x.rostering.feed">;
171
+ export type ShiftChecklist = Out<"x.rostering.checklist">;
172
+ export type ChecklistRun = NonNullable<ShiftChecklist["run"]>;
173
+ export type ChecklistStep = ChecklistRun["steps"][number];
174
+ export type ChecklistTick = NonNullable<ChecklistStep["tick"]>;
175
+ export type ChecklistTickInput = In<"x.rostering.tick">;
176
+ export type ChecklistRuns = Out<"x.rostering.checklistRuns">;
177
+ export type ChecklistRunSummary = ChecklistRuns["runs"][number];
178
+ export type ChecklistState = NonNullable<NonNullable<RosterShift["checklist"]>["state"]>;
179
+ /** The client of every operation this entry calls (ADR 0453). */
180
+ export type RosteringClient = PackClient<RosteringOperations>;
181
+ /** The days of a regular week, Monday first, as the host names them and as a person reads them. */
182
+ export declare const WEEKDAYS: readonly [readonly ["mon", "Monday"], readonly ["tue", "Tuesday"], readonly ["wed", "Wednesday"], readonly ["thu", "Thursday"], readonly ["fri", "Friday"], readonly ["sat", "Saturday"], readonly ["sun", "Sunday"]];
183
+ export type Weekday = (typeof WEEKDAYS)[number][0];
184
+ /** A `YYYY-MM-DD` date `days` later (or earlier): calendar dates only, no time of day or zone. */
185
+ export declare function addDays(date: string, days: number): string;
186
+ /** The Monday on or before a `YYYY-MM-DD` date (the week a date is in). */
187
+ export declare function weekOf(date: string): string;
188
+ /** A `YYYY-MM-DD` date as a person reads it ("Tue 3 Mar"). The date as given, in no zone. */
189
+ export declare function dayLabel(date: string, locale?: string, long?: boolean): string;
190
+ /** An instant's time of day in a zone ("06:00"). */
191
+ export declare function timeIn(iso: string, zone: string, locale?: string): string;
192
+ /** An instant's local date in a zone (`YYYY-MM-DD`). */
193
+ export declare function dateIn(iso: string, zone: string): string;
194
+ /**
195
+ * A shift's times as a person reads them, in the shift's own zone (or the roster's): "06:00–07:00",
196
+ * with the date first when asked ("Tue 3 Mar, 06:00–07:00"), and the end's date when it ends on
197
+ * another day (across midnight).
198
+ */
199
+ export declare function shiftTime(shift: {
200
+ startsAt: string | null;
201
+ endsAt: string | null;
202
+ zone?: string | null;
203
+ }, zone: string, options?: {
204
+ withDate?: boolean;
205
+ locale?: string;
206
+ }): string;
207
+ /** Who is on a shift, as the roster shows it. */
208
+ export declare function personOn(shift: RosterShift): string;
209
+ /**
210
+ * A shift's accessible name: what it is, when, where and who is on it, in one line a screen
211
+ * reader says ("Close-down clean, Tue 3 Mar, 18:00–19:00, Main floor, Sam (you)").
212
+ */
213
+ export declare function shiftName(shift: RosterShift, zone: string, locale?: string): string;
214
+ /**
215
+ * The roster's shifts by local date, in the order the host's `days` lists them (every date of the
216
+ * range, empty ones too). Each shift is put on its start's date in the roster's zone.
217
+ */
218
+ export declare function shiftsByDay(roster: Pick<Roster, "days" | "shifts" | "zone">): {
219
+ day: RosterDay;
220
+ shifts: RosterShift[];
221
+ }[];
222
+ /** What a day's length says when the clocks change that day (the host's hours), or null. */
223
+ export declare function clockChange(day: RosterDay): string | null;
224
+ /** A warning's short words for a badge. */
225
+ export declare function warningLabel(code: StaffWarning["code"]): string;
226
+ /** A time off as a person reads it, in its own zone. */
227
+ export declare function awayWhen(item: AwayItem, locale?: string): string;
228
+ /** A time off's kind as a person reads it. */
229
+ export declare function awayKind(kind: AwayItem["kind"]): string;
230
+ /** A pattern's regular week as a person reads it ("Mon, Wed 06:00, 60 minutes"). */
231
+ export declare function patternWhen(p: Pattern): string;
232
+ /**
233
+ * A calendar feed's address, from the host's origin (`https://admin.example.com`) and the path the
234
+ * host gave once (`feedRotate`): the https address to copy into a calendar app, and the webcal one
235
+ * that opens a phone's calendar to subscribe. Never kept: the screen shows it and forgets it.
236
+ */
237
+ export declare function feedAddresses(hostUrl: string, path: string): {
238
+ https: string;
239
+ webcal: string;
240
+ };
241
+ /** How a shift's checklist is going, as a person reads it. */
242
+ export declare function checklistStateLabel(state: ChecklistState | ChecklistRun["state"]): string;
243
+ /** A step's tick as every screen shows it: what was ticked, by whom and for whom. */
244
+ export declare function tickLabel(tick: ChecklistTick): string;
245
+ /** One of your pay periods' state as a person reads it. */
246
+ export declare function payPeriodState(p: MyPayPeriod): string;
247
+ /** A pay basis as a person reads it. */
248
+ export declare function basisLabel(basis: string): string;
249
+ /** A rule the host's refusal names, each with its own designed state. */
250
+ declare const HOST_RULES: readonly ["double_booked", "nobody_qualified", "not_qualified", "no_profile", "offer_stale", "offer_taken", "offer_closed", "offer_open", "offer_cutoff", "own_offer", "offered_to_someone_else", "unavailable_confirm", "shift_not_live", "shift_not_started", "not_yours", "rostering", "pay_period_locked", "pay_period_held", "pay_period_unset", "pay_period_open", "pay_period_not_locked", "pay_period_too_large", "roster_changed", "recurring_not_generated", "recurring_moved", "recurring_past", "deactivate_confirm", "checklist_window", "checklist_closed", "checklist_not_live", "checklist_nobody", "checklist_not_yours", "checklist_not_your_tick", "checklist_nothing_to_clear", "checklist_too_many_ticks", "checklist_for_why", "checklist_note_needed", "checklist_why", "checklist_incomplete", "checklist_open", "human_only"];
251
+ /**
252
+ * Every refusal the roster's tools can give a screen, each with its own designed state. `kind`
253
+ * says which state to show; `message` is the host's own words (they name the other shift, who
254
+ * took an offer, the dates a pattern would clash on).
255
+ */
256
+ export type RosterRefusalKind = (typeof HOST_RULES)[number] | "forbidden" | "address_lost" | "not_found" | "invalid" | "network" | "other";
257
+ export interface RosterRefusal {
258
+ kind: RosterRefusalKind;
259
+ /** The host's words, or ours for a network failure or a refusal with none. */
260
+ message: string;
261
+ /** Who took an offer (`offer_taken`), as the host named them in `message`. */
262
+ takenBy?: string | null;
263
+ /** The dates a pattern change would clash on (`double_booked` of a pattern). */
264
+ dates?: string[];
265
+ /** The other shift (`double_booked`). */
266
+ other?: {
267
+ title: string;
268
+ startsAt: string;
269
+ endsAt: string;
270
+ } | null;
271
+ }
272
+ /** What the host's refusal of a roster call was, for the screen's designed state. */
273
+ export declare function rosterRefusal(error: unknown): RosterRefusal;
274
+ /** The roster's own copy for a refusal kind that asks the person to do something next. */
275
+ export declare function refusalNext(kind: RosterRefusalKind, rosters: boolean): string | null;
276
+ export type { UseMutation, UseQuery } from "@composable-os/client";
277
+ /**
278
+ * The operations each hook calls (ADR 0453). A `rostering.team` role's client gets the team's
279
+ * hooks; a coach's role client with the grant `rostering:roster` the same; the staff client all
280
+ * of them (the host still refuses what the account does not hold).
281
+ */
282
+ export declare const ROSTERING_HOOKS_CALL: {
283
+ readonly useMe: readonly ["x.rostering.me"];
284
+ readonly useWeek: readonly ["x.rostering.week"];
285
+ readonly useMine: readonly ["x.rostering.mine"];
286
+ readonly useOffers: readonly ["x.rostering.offers"];
287
+ readonly useOffer: readonly ["x.rostering.offer"];
288
+ readonly useWithdraw: readonly ["x.rostering.withdraw"];
289
+ readonly useTake: readonly ["x.rostering.take"];
290
+ readonly useAway: readonly ["x.rostering.away"];
291
+ readonly useBack: readonly ["x.rostering.back"];
292
+ readonly useMyAway: readonly ["x.rostering.myAway"];
293
+ readonly useMyPayPeriods: readonly ["x.rostering.myPayPeriods"];
294
+ readonly useMyPay: readonly ["x.rostering.myPay"];
295
+ readonly useAssign: readonly ["x.rostering.assign"];
296
+ readonly useCheck: readonly ["x.rostering.check"];
297
+ readonly useCandidates: readonly ["x.rostering.candidates"];
298
+ readonly useFollow: readonly ["x.rostering.follow"];
299
+ readonly usePeople: readonly ["x.rostering.people"];
300
+ readonly usePatterns: readonly ["x.rostering.patterns"];
301
+ readonly useSetPattern: readonly ["x.rostering.setPattern"];
302
+ readonly useQualify: readonly ["x.rostering.qualify"];
303
+ readonly useQualifications: readonly ["x.rostering.qualifications"];
304
+ readonly useAwayFor: readonly ["x.rostering.awayFor"];
305
+ readonly useAwayList: readonly ["x.rostering.awayList"];
306
+ readonly useUncovered: readonly ["x.rostering.uncovered"];
307
+ readonly useMarkNotWorked: readonly ["x.rostering.markNotWorked"];
308
+ readonly usePayBases: readonly ["x.rostering.payBases"];
309
+ readonly usePayBasis: readonly ["x.rostering.payBasis"];
310
+ readonly usePeriods: readonly ["x.rostering.periods"];
311
+ readonly usePeriodTotals: readonly ["x.rostering.periodTotals"];
312
+ readonly useLock: readonly ["x.rostering.lock"];
313
+ readonly useReopen: readonly ["x.rostering.reopen"];
314
+ readonly useExport: readonly ["x.rostering.export"];
315
+ readonly useFeed: readonly ["x.rostering.feed"];
316
+ readonly useFeedRotate: readonly ["x.rostering.feedRotate"];
317
+ readonly useFeedRevoke: readonly ["x.rostering.feedRevoke"];
318
+ readonly useChecklist: readonly ["x.rostering.checklist"];
319
+ readonly useTick: readonly ["x.rostering.tick"];
320
+ readonly useChecklistDone: readonly ["x.rostering.checklistDone"];
321
+ readonly useChecklistRuns: readonly ["x.rostering.checklistRuns"];
322
+ readonly useChecklistCorrect: readonly ["x.rostering.checklistCorrect"];
323
+ };
324
+ /**
325
+ * Hooks for a React or React Native app:
326
+ * `const rostering = createRosteringHooks({ useQuery, useMutation }, api)`. `api` is the client the
327
+ * screen's user holds: a role client (`roles/rostering.team.ts`, or `roles/bookings.coach.ts`
328
+ * generated with the grant `rostering:roster`) or the staff client. The hooks it cannot back are
329
+ * not there.
330
+ */
331
+ export declare function createRosteringHooks<C extends ClientHolding>(react: {
332
+ useQuery: UseQuery;
333
+ useMutation: UseMutation;
334
+ }, client: C): import("@composable-os/client").HooksFor<{
335
+ /** Who is reading and what the host lets them do (rosters, pays), the zone and today there. */
336
+ useMe(): {
337
+ data: {
338
+ account: string;
339
+ name: string;
340
+ rosters: boolean;
341
+ pays: boolean;
342
+ zone: string;
343
+ today: string;
344
+ cutoffMinutes: number;
345
+ uncoveredDays: number;
346
+ } | undefined;
347
+ isPending: boolean;
348
+ error: unknown;
349
+ refetch?: () => unknown;
350
+ };
351
+ /** The roster from..to (local dates); a rosterer's answer carries each shift's warnings. */
352
+ useWeek(input: In<"x.rostering.week">, enabled?: boolean): {
353
+ data: {
354
+ shifts: {
355
+ object: string;
356
+ id: string;
357
+ title: string;
358
+ kind: {
359
+ object: string;
360
+ id: string;
361
+ name: string;
362
+ } | null;
363
+ startsAt: string;
364
+ endsAt: string | null;
365
+ zone: string | null;
366
+ place: string | null;
367
+ uncovered: boolean;
368
+ noAccount: boolean;
369
+ account: string | null;
370
+ name: string | null;
371
+ mine: boolean;
372
+ offer: {
373
+ id: string;
374
+ to: string | null;
375
+ from: string | null;
376
+ } | null;
377
+ warnings: {
378
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
379
+ object: string;
380
+ id: string;
381
+ account: string | null;
382
+ message: string;
383
+ }[] | null;
384
+ checklist: {
385
+ name: string;
386
+ state: "not_started" | "in_progress" | "done" | "missed" | "cancelled" | null;
387
+ } | null;
388
+ }[];
389
+ zone: string;
390
+ days: {
391
+ date: string;
392
+ hours: number;
393
+ }[];
394
+ truncated: boolean;
395
+ } | undefined;
396
+ isPending: boolean;
397
+ error: unknown;
398
+ refetch?: () => unknown;
399
+ };
400
+ /** My own shifts from..to. */
401
+ useMine(input: In<"x.rostering.mine">, enabled?: boolean): {
402
+ data: {
403
+ shifts: {
404
+ object: string;
405
+ id: string;
406
+ title: string;
407
+ kind: {
408
+ object: string;
409
+ id: string;
410
+ name: string;
411
+ } | null;
412
+ startsAt: string;
413
+ endsAt: string | null;
414
+ zone: string | null;
415
+ place: string | null;
416
+ uncovered: boolean;
417
+ noAccount: boolean;
418
+ account: string | null;
419
+ name: string | null;
420
+ mine: boolean;
421
+ offer: {
422
+ id: string;
423
+ to: string | null;
424
+ from: string | null;
425
+ } | null;
426
+ warnings: {
427
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
428
+ object: string;
429
+ id: string;
430
+ account: string | null;
431
+ message: string;
432
+ }[] | null;
433
+ checklist: {
434
+ name: string;
435
+ state: "not_started" | "in_progress" | "done" | "missed" | "cancelled" | null;
436
+ } | null;
437
+ }[];
438
+ zone: string;
439
+ days: {
440
+ date: string;
441
+ hours: number;
442
+ }[];
443
+ truncated: boolean;
444
+ } | undefined;
445
+ isPending: boolean;
446
+ error: unknown;
447
+ refetch?: () => unknown;
448
+ };
449
+ /** Offers I could take now, and my own open offers. */
450
+ useOffers(): {
451
+ data: {
452
+ open: {
453
+ id: string;
454
+ shift: {
455
+ object: string;
456
+ id: string;
457
+ title: string;
458
+ startsAt: string | null;
459
+ endsAt: string | null;
460
+ };
461
+ from: string | null;
462
+ fromName: string | null;
463
+ to: string | null;
464
+ state: "cancelled" | "open" | "taken" | "withdrawn" | "lapsed";
465
+ madeAt: string;
466
+ takenBy: string | null;
467
+ takenAt: string | null;
468
+ closesAt: string | null;
469
+ unavailable: boolean;
470
+ }[];
471
+ mine: {
472
+ id: string;
473
+ shift: {
474
+ object: string;
475
+ id: string;
476
+ title: string;
477
+ startsAt: string | null;
478
+ endsAt: string | null;
479
+ };
480
+ from: string | null;
481
+ fromName: string | null;
482
+ to: string | null;
483
+ state: "cancelled" | "open" | "taken" | "withdrawn" | "lapsed";
484
+ madeAt: string;
485
+ takenBy: string | null;
486
+ takenAt: string | null;
487
+ closesAt: string | null;
488
+ }[];
489
+ } | undefined;
490
+ isPending: boolean;
491
+ error: unknown;
492
+ refetch?: () => unknown;
493
+ };
494
+ /** Offer a shift (a person's own act). */
495
+ useOffer(): {
496
+ mutate(input: {
497
+ object: string;
498
+ id: string;
499
+ to?: string | undefined;
500
+ }): void;
501
+ mutateAsync(input: {
502
+ object: string;
503
+ id: string;
504
+ to?: string | undefined;
505
+ }): Promise<{
506
+ offer: {
507
+ id: string;
508
+ shift: {
509
+ object: string;
510
+ id: string;
511
+ title: string;
512
+ startsAt: string | null;
513
+ endsAt: string | null;
514
+ };
515
+ from: string | null;
516
+ fromName: string | null;
517
+ to: string | null;
518
+ state: "cancelled" | "open" | "taken" | "withdrawn" | "lapsed";
519
+ madeAt: string;
520
+ takenBy: string | null;
521
+ takenAt: string | null;
522
+ closesAt: string | null;
523
+ };
524
+ told: number | null;
525
+ }>;
526
+ data: {
527
+ offer: {
528
+ id: string;
529
+ shift: {
530
+ object: string;
531
+ id: string;
532
+ title: string;
533
+ startsAt: string | null;
534
+ endsAt: string | null;
535
+ };
536
+ from: string | null;
537
+ fromName: string | null;
538
+ to: string | null;
539
+ state: "cancelled" | "open" | "taken" | "withdrawn" | "lapsed";
540
+ madeAt: string;
541
+ takenBy: string | null;
542
+ takenAt: string | null;
543
+ closesAt: string | null;
544
+ };
545
+ told: number | null;
546
+ } | undefined;
547
+ isPending: boolean;
548
+ error: unknown;
549
+ reset?: () => void;
550
+ };
551
+ /** Withdraw an open offer. */
552
+ useWithdraw(): {
553
+ mutate(input: {
554
+ offer: string;
555
+ }): void;
556
+ mutateAsync(input: {
557
+ offer: string;
558
+ }): Promise<{
559
+ offer: {
560
+ id: string;
561
+ shift: {
562
+ object: string;
563
+ id: string;
564
+ title: string;
565
+ startsAt: string | null;
566
+ endsAt: string | null;
567
+ };
568
+ from: string | null;
569
+ fromName: string | null;
570
+ to: string | null;
571
+ state: "cancelled" | "open" | "taken" | "withdrawn" | "lapsed";
572
+ madeAt: string;
573
+ takenBy: string | null;
574
+ takenAt: string | null;
575
+ closesAt: string | null;
576
+ };
577
+ }>;
578
+ data: {
579
+ offer: {
580
+ id: string;
581
+ shift: {
582
+ object: string;
583
+ id: string;
584
+ title: string;
585
+ startsAt: string | null;
586
+ endsAt: string | null;
587
+ };
588
+ from: string | null;
589
+ fromName: string | null;
590
+ to: string | null;
591
+ state: "cancelled" | "open" | "taken" | "withdrawn" | "lapsed";
592
+ madeAt: string;
593
+ takenBy: string | null;
594
+ takenAt: string | null;
595
+ closesAt: string | null;
596
+ };
597
+ } | undefined;
598
+ isPending: boolean;
599
+ error: unknown;
600
+ reset?: () => void;
601
+ };
602
+ /** Take an offered shift; the host may ask to confirm when I said I am away then. */
603
+ useTake(): {
604
+ mutate(input: {
605
+ offer: string;
606
+ confirmUnavailable?: boolean | undefined;
607
+ }): void;
608
+ mutateAsync(input: {
609
+ offer: string;
610
+ confirmUnavailable?: boolean | undefined;
611
+ }): Promise<{
612
+ offer: string;
613
+ shift: {
614
+ object: string;
615
+ id: string;
616
+ title: string;
617
+ startsAt: string | null;
618
+ endsAt: string | null;
619
+ };
620
+ warnings: {
621
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
622
+ object: string;
623
+ id: string;
624
+ account: string | null;
625
+ message: string;
626
+ }[];
627
+ }>;
628
+ data: {
629
+ offer: string;
630
+ shift: {
631
+ object: string;
632
+ id: string;
633
+ title: string;
634
+ startsAt: string | null;
635
+ endsAt: string | null;
636
+ };
637
+ warnings: {
638
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
639
+ object: string;
640
+ id: string;
641
+ account: string | null;
642
+ message: string;
643
+ }[];
644
+ } | undefined;
645
+ isPending: boolean;
646
+ error: unknown;
647
+ reset?: () => void;
648
+ };
649
+ /**
650
+ * Say when I cannot work. What I write about it (the note) is not kept once the call is
651
+ * over: call it through `forgetAfter`.
652
+ */
653
+ useAway(): {
654
+ mutate(input: {
655
+ kind: "leave" | "other" | "regular";
656
+ note?: string | undefined;
657
+ startsAt?: string | undefined;
658
+ endsAt?: string | undefined;
659
+ weekdays?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
660
+ startTime?: string | undefined;
661
+ endTime?: string | undefined;
662
+ fromDate?: string | undefined;
663
+ untilDate?: string | undefined;
664
+ zone?: string | undefined;
665
+ }): void;
666
+ mutateAsync(input: {
667
+ kind: "leave" | "other" | "regular";
668
+ note?: string | undefined;
669
+ startsAt?: string | undefined;
670
+ endsAt?: string | undefined;
671
+ weekdays?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
672
+ startTime?: string | undefined;
673
+ endTime?: string | undefined;
674
+ fromDate?: string | undefined;
675
+ untilDate?: string | undefined;
676
+ zone?: string | undefined;
677
+ }): Promise<{
678
+ id: string;
679
+ shifts: {
680
+ object: string;
681
+ id: string;
682
+ title: string;
683
+ startsAt: string | null;
684
+ endsAt: string | null;
685
+ }[];
686
+ count: number;
687
+ }>;
688
+ data: {
689
+ id: string;
690
+ shifts: {
691
+ object: string;
692
+ id: string;
693
+ title: string;
694
+ startsAt: string | null;
695
+ endsAt: string | null;
696
+ }[];
697
+ count: number;
698
+ } | undefined;
699
+ isPending: boolean;
700
+ error: unknown;
701
+ reset?: () => void;
702
+ };
703
+ /** Remove a time off. */
704
+ useBack(): {
705
+ mutate(input: {
706
+ id: string;
707
+ }): void;
708
+ mutateAsync(input: {
709
+ id: string;
710
+ }): Promise<{
711
+ id: string;
712
+ }>;
713
+ data: {
714
+ id: string;
715
+ } | undefined;
716
+ isPending: boolean;
717
+ error: unknown;
718
+ reset?: () => void;
719
+ };
720
+ /** My time off, with my notes: kept no longer than it is on screen. */
721
+ useMyAway(input?: In<"x.rostering.myAway">): {
722
+ data: {
723
+ items: {
724
+ id: string;
725
+ account: string;
726
+ name: string;
727
+ kind: "leave" | "other" | "regular";
728
+ note: string | null;
729
+ startsAt: string | null;
730
+ endsAt: string | null;
731
+ weekdays: string[];
732
+ startTime: string | null;
733
+ endTime: string | null;
734
+ fromDate: string | null;
735
+ untilDate: string | null;
736
+ zone: string;
737
+ }[];
738
+ } | undefined;
739
+ isPending: boolean;
740
+ error: unknown;
741
+ refetch?: () => unknown;
742
+ };
743
+ /** The pay periods I can see my own hours for: dates and state only. */
744
+ useMyPayPeriods(enabled?: boolean): {
745
+ data: {
746
+ set: boolean;
747
+ periods: {
748
+ start: string;
749
+ end: string;
750
+ zone: string;
751
+ state: "open" | "locked";
752
+ ended: boolean;
753
+ version: number | null;
754
+ }[];
755
+ } | undefined;
756
+ isPending: boolean;
757
+ error: unknown;
758
+ refetch?: () => unknown;
759
+ };
760
+ /**
761
+ * My own hours for one pay period: pay figures, kept no longer than they are on screen. The
762
+ * query's key holds the period's first date only, never a figure.
763
+ */
764
+ useMyPay(input: In<"x.rostering.myPay"> | null): {
765
+ data: {
766
+ period: {
767
+ start: string;
768
+ end: string;
769
+ zone: string;
770
+ ended: boolean;
771
+ locked: boolean;
772
+ preview: boolean;
773
+ version: number | null;
774
+ };
775
+ counted: boolean;
776
+ basis: "by_time" | "by_class" | "not_counted";
777
+ totals: {
778
+ basis: "by_time" | "by_class";
779
+ kind: {
780
+ object: string;
781
+ id: string;
782
+ } | null;
783
+ kindName: string;
784
+ shifts: number;
785
+ minutes: number;
786
+ hours: string;
787
+ notWorked: number;
788
+ flagged: number;
789
+ }[];
790
+ lines: {
791
+ object: string;
792
+ id: string;
793
+ title: string;
794
+ kindName: string;
795
+ basis: "by_time" | "by_class";
796
+ place: string | null;
797
+ localDate: string;
798
+ localStart: string;
799
+ localEnd: string;
800
+ shiftMinutes: number;
801
+ beforeMinutes: number;
802
+ afterMinutes: number;
803
+ countedMinutes: number;
804
+ notWorked: boolean;
805
+ listTaken: boolean | null;
806
+ flagged: boolean;
807
+ clockChange: string | null;
808
+ }[];
809
+ minutes: number | null;
810
+ hours: string | null;
811
+ } | undefined;
812
+ isPending: boolean;
813
+ error: unknown;
814
+ refetch?: () => unknown;
815
+ };
816
+ /** A rosterer: put someone (or nobody) on a shift. */
817
+ useAssign(): {
818
+ mutate(input: {
819
+ account: string | null;
820
+ object: string;
821
+ id: string;
822
+ }): void;
823
+ mutateAsync(input: {
824
+ account: string | null;
825
+ object: string;
826
+ id: string;
827
+ }): Promise<{
828
+ shift: {
829
+ object: string;
830
+ id: string;
831
+ title: string;
832
+ startsAt: string | null;
833
+ endsAt: string | null;
834
+ };
835
+ warnings: {
836
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
837
+ object: string;
838
+ id: string;
839
+ account: string | null;
840
+ message: string;
841
+ }[];
842
+ }>;
843
+ data: {
844
+ shift: {
845
+ object: string;
846
+ id: string;
847
+ title: string;
848
+ startsAt: string | null;
849
+ endsAt: string | null;
850
+ };
851
+ warnings: {
852
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
853
+ object: string;
854
+ id: string;
855
+ account: string | null;
856
+ message: string;
857
+ }[];
858
+ } | undefined;
859
+ isPending: boolean;
860
+ error: unknown;
861
+ reset?: () => void;
862
+ };
863
+ /** A rosterer: what putting someone on a shift would be made with. */
864
+ useCheck(input: In<"x.rostering.check"> | null): {
865
+ data: {
866
+ warnings: {
867
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
868
+ object: string;
869
+ id: string;
870
+ account: string | null;
871
+ message: string;
872
+ }[];
873
+ clash: {
874
+ object: string;
875
+ id: string;
876
+ title: string;
877
+ startsAt: string;
878
+ endsAt: string;
879
+ } | null;
880
+ } | undefined;
881
+ isPending: boolean;
882
+ error: unknown;
883
+ refetch?: () => unknown;
884
+ };
885
+ /** A rosterer: who could be put on a shift, eligible first, with the pattern's person. */
886
+ useCandidates(input: In<"x.rostering.candidates"> | null): {
887
+ data: {
888
+ current: {
889
+ account: string | null;
890
+ name: string | null;
891
+ };
892
+ pattern: {
893
+ account: string | null;
894
+ name: string | null;
895
+ own: boolean;
896
+ } | null;
897
+ people: {
898
+ account: string;
899
+ name: string;
900
+ eligible: boolean;
901
+ noProfile: boolean;
902
+ warnings: {
903
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
904
+ object: string;
905
+ id: string;
906
+ account: string | null;
907
+ message: string;
908
+ }[];
909
+ clash: {
910
+ object: string;
911
+ id: string;
912
+ title: string;
913
+ startsAt: string;
914
+ endsAt: string;
915
+ } | null;
916
+ }[];
917
+ truncated: boolean;
918
+ } | undefined;
919
+ isPending: boolean;
920
+ error: unknown;
921
+ refetch?: () => unknown;
922
+ };
923
+ /** A rosterer: a shift back to its pattern's person. */
924
+ useFollow(): {
925
+ mutate(input: {
926
+ object: string;
927
+ id: string;
928
+ }): void;
929
+ mutateAsync(input: {
930
+ object: string;
931
+ id: string;
932
+ }): Promise<{
933
+ object: string;
934
+ id: string;
935
+ warnings: {
936
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
937
+ object: string;
938
+ id: string;
939
+ account: string | null;
940
+ message: string;
941
+ }[];
942
+ }>;
943
+ data: {
944
+ object: string;
945
+ id: string;
946
+ warnings: {
947
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
948
+ object: string;
949
+ id: string;
950
+ account: string | null;
951
+ message: string;
952
+ }[];
953
+ } | undefined;
954
+ isPending: boolean;
955
+ error: unknown;
956
+ reset?: () => void;
957
+ };
958
+ /** A rosterer: the staff and the kinds of work. */
959
+ usePeople(enabled?: boolean): {
960
+ data: {
961
+ people: {
962
+ account: string;
963
+ name: string;
964
+ }[];
965
+ kinds: {
966
+ object: string;
967
+ objectLabel: string;
968
+ id: string;
969
+ name: string;
970
+ }[];
971
+ truncated: boolean;
972
+ } | undefined;
973
+ isPending: boolean;
974
+ error: unknown;
975
+ refetch?: () => unknown;
976
+ };
977
+ /** A rosterer: the regular week. */
978
+ usePatterns(enabled?: boolean): {
979
+ data: {
980
+ patterns: {
981
+ object: string;
982
+ id: string;
983
+ title: string;
984
+ objectLabel: string;
985
+ kind: {
986
+ object: string;
987
+ id: string;
988
+ name: string;
989
+ } | null;
990
+ weekdays: string[];
991
+ time: string | null;
992
+ length: number | null;
993
+ firstDate: string | null;
994
+ lastDate: string | null;
995
+ zone: string;
996
+ account: string | null;
997
+ name: string | null;
998
+ noAccount: boolean;
999
+ }[];
1000
+ truncated: boolean;
1001
+ } | undefined;
1002
+ isPending: boolean;
1003
+ error: unknown;
1004
+ refetch?: () => unknown;
1005
+ };
1006
+ /** A rosterer: a pattern's person from a date. */
1007
+ useSetPattern(): {
1008
+ mutate(input: {
1009
+ object: string;
1010
+ id: string;
1011
+ account: string | null;
1012
+ from?: string | undefined;
1013
+ }): void;
1014
+ mutateAsync(input: {
1015
+ object: string;
1016
+ id: string;
1017
+ account: string | null;
1018
+ from?: string | undefined;
1019
+ }): Promise<{
1020
+ object: string;
1021
+ id: string;
1022
+ account: string | null;
1023
+ from: string;
1024
+ }>;
1025
+ data: {
1026
+ object: string;
1027
+ id: string;
1028
+ account: string | null;
1029
+ from: string;
1030
+ } | undefined;
1031
+ isPending: boolean;
1032
+ error: unknown;
1033
+ reset?: () => void;
1034
+ };
1035
+ /** A rosterer: say whether someone may do a kind of work. */
1036
+ useQualify(): {
1037
+ mutate(input: {
1038
+ account: string;
1039
+ kind: {
1040
+ object: string;
1041
+ id: string;
1042
+ };
1043
+ qualified?: boolean | undefined;
1044
+ }): void;
1045
+ mutateAsync(input: {
1046
+ account: string;
1047
+ kind: {
1048
+ object: string;
1049
+ id: string;
1050
+ };
1051
+ qualified?: boolean | undefined;
1052
+ }): Promise<{
1053
+ account: string;
1054
+ kind: {
1055
+ object: string;
1056
+ id: string;
1057
+ };
1058
+ qualified: boolean;
1059
+ changed: boolean;
1060
+ }>;
1061
+ data: {
1062
+ account: string;
1063
+ kind: {
1064
+ object: string;
1065
+ id: string;
1066
+ };
1067
+ qualified: boolean;
1068
+ changed: boolean;
1069
+ } | undefined;
1070
+ isPending: boolean;
1071
+ error: unknown;
1072
+ reset?: () => void;
1073
+ };
1074
+ /** A rosterer: who may do which kind of work. */
1075
+ useQualifications(input?: In<"x.rostering.qualifications">, enabled?: boolean): {
1076
+ data: {
1077
+ items: {
1078
+ account: string;
1079
+ name: string;
1080
+ kind: {
1081
+ object: string;
1082
+ id: string;
1083
+ name: string;
1084
+ };
1085
+ setBy: string;
1086
+ setAt: string;
1087
+ }[];
1088
+ } | undefined;
1089
+ isPending: boolean;
1090
+ error: unknown;
1091
+ refetch?: () => unknown;
1092
+ };
1093
+ /** A rosterer: say someone else is away. The note is forgotten once the call is over. */
1094
+ useAwayFor(): {
1095
+ mutate(input: {
1096
+ kind: "leave" | "other" | "regular";
1097
+ account: string;
1098
+ note?: string | undefined;
1099
+ startsAt?: string | undefined;
1100
+ endsAt?: string | undefined;
1101
+ weekdays?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
1102
+ startTime?: string | undefined;
1103
+ endTime?: string | undefined;
1104
+ fromDate?: string | undefined;
1105
+ untilDate?: string | undefined;
1106
+ zone?: string | undefined;
1107
+ }): void;
1108
+ mutateAsync(input: {
1109
+ kind: "leave" | "other" | "regular";
1110
+ account: string;
1111
+ note?: string | undefined;
1112
+ startsAt?: string | undefined;
1113
+ endsAt?: string | undefined;
1114
+ weekdays?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
1115
+ startTime?: string | undefined;
1116
+ endTime?: string | undefined;
1117
+ fromDate?: string | undefined;
1118
+ untilDate?: string | undefined;
1119
+ zone?: string | undefined;
1120
+ }): Promise<{
1121
+ id: string;
1122
+ shifts: {
1123
+ object: string;
1124
+ id: string;
1125
+ title: string;
1126
+ startsAt: string | null;
1127
+ endsAt: string | null;
1128
+ }[];
1129
+ count: number;
1130
+ }>;
1131
+ data: {
1132
+ id: string;
1133
+ shifts: {
1134
+ object: string;
1135
+ id: string;
1136
+ title: string;
1137
+ startsAt: string | null;
1138
+ endsAt: string | null;
1139
+ }[];
1140
+ count: number;
1141
+ } | undefined;
1142
+ isPending: boolean;
1143
+ error: unknown;
1144
+ reset?: () => void;
1145
+ };
1146
+ /** A rosterer: everyone's time off, with notes, kept no longer than it is on screen. */
1147
+ useAwayList(input: In<"x.rostering.awayList">, enabled?: boolean): {
1148
+ data: {
1149
+ items: {
1150
+ id: string;
1151
+ account: string;
1152
+ name: string;
1153
+ kind: "leave" | "other" | "regular";
1154
+ note: string | null;
1155
+ startsAt: string | null;
1156
+ endsAt: string | null;
1157
+ weekdays: string[];
1158
+ startTime: string | null;
1159
+ endTime: string | null;
1160
+ fromDate: string | null;
1161
+ untilDate: string | null;
1162
+ zone: string;
1163
+ }[];
1164
+ } | undefined;
1165
+ isPending: boolean;
1166
+ error: unknown;
1167
+ refetch?: () => unknown;
1168
+ };
1169
+ /** A rosterer: shifts with nobody on them. */
1170
+ useUncovered(input?: In<"x.rostering.uncovered">, enabled?: boolean): {
1171
+ data: {
1172
+ items: {
1173
+ object: string;
1174
+ id: string;
1175
+ title: string;
1176
+ startsAt: string | null;
1177
+ endsAt: string | null;
1178
+ offered: boolean;
1179
+ }[];
1180
+ } | undefined;
1181
+ isPending: boolean;
1182
+ error: unknown;
1183
+ refetch?: () => unknown;
1184
+ };
1185
+ /** A rosterer: mark a started shift not worked, with why (forgotten once the call is over). */
1186
+ useMarkNotWorked(): {
1187
+ mutate(input: {
1188
+ object: string;
1189
+ id: string;
1190
+ notWorked?: boolean | undefined;
1191
+ reason?: string | undefined;
1192
+ }): void;
1193
+ mutateAsync(input: {
1194
+ object: string;
1195
+ id: string;
1196
+ notWorked?: boolean | undefined;
1197
+ reason?: string | undefined;
1198
+ }): Promise<{
1199
+ object: string;
1200
+ id: string;
1201
+ notWorked: boolean;
1202
+ changed: boolean;
1203
+ }>;
1204
+ data: {
1205
+ object: string;
1206
+ id: string;
1207
+ notWorked: boolean;
1208
+ changed: boolean;
1209
+ } | undefined;
1210
+ isPending: boolean;
1211
+ error: unknown;
1212
+ reset?: () => void;
1213
+ };
1214
+ /** Pay: who is counted and how (kept no longer than it is on screen). */
1215
+ usePayBases(input: In<"x.rostering.payBases">, enabled?: boolean): {
1216
+ data: {
1217
+ today: string;
1218
+ items: {
1219
+ account: string;
1220
+ name: string;
1221
+ basis: "by_time" | "by_class" | "not_counted";
1222
+ history: {
1223
+ from: string;
1224
+ basis: "by_time" | "by_class" | "not_counted";
1225
+ setBy: string;
1226
+ setAt: string;
1227
+ }[];
1228
+ }[];
1229
+ truncated: boolean;
1230
+ } | undefined;
1231
+ isPending: boolean;
1232
+ error: unknown;
1233
+ refetch?: () => unknown;
1234
+ };
1235
+ /** Pay: say how someone is counted from a date. */
1236
+ usePayBasis(): {
1237
+ mutate(input: {
1238
+ account: string;
1239
+ basis: "by_time" | "by_class" | "not_counted";
1240
+ from?: string | undefined;
1241
+ }): void;
1242
+ mutateAsync(input: {
1243
+ account: string;
1244
+ basis: "by_time" | "by_class" | "not_counted";
1245
+ from?: string | undefined;
1246
+ }): Promise<{
1247
+ account: string;
1248
+ from: string;
1249
+ changed: boolean;
1250
+ }>;
1251
+ data: {
1252
+ account: string;
1253
+ from: string;
1254
+ changed: boolean;
1255
+ } | undefined;
1256
+ isPending: boolean;
1257
+ error: unknown;
1258
+ reset?: () => void;
1259
+ };
1260
+ /** Pay: the periods. */
1261
+ usePeriods(input?: In<"x.rostering.periods">, enabled?: boolean): {
1262
+ data: {
1263
+ setting: {
1264
+ period: "weekly" | "fortnightly" | "monthly";
1265
+ start: string | null;
1266
+ day: number;
1267
+ zone: string;
1268
+ };
1269
+ set: boolean;
1270
+ periods: {
1271
+ start: string;
1272
+ end: string;
1273
+ zone: string;
1274
+ state: "open" | "locked";
1275
+ ended: boolean;
1276
+ versions: {
1277
+ id: string;
1278
+ version: number;
1279
+ state: "locked" | "reopened";
1280
+ lockedBy: string;
1281
+ lockedByName: string;
1282
+ lockedAt: string;
1283
+ reopenedBy: string | null;
1284
+ reopenedAt: string | null;
1285
+ reopenReason: string | null;
1286
+ }[];
1287
+ }[];
1288
+ } | undefined;
1289
+ isPending: boolean;
1290
+ error: unknown;
1291
+ refetch?: () => unknown;
1292
+ };
1293
+ /** Pay: one period's totals and lines (kept no longer than they are on screen). */
1294
+ usePeriodTotals(input: In<"x.rostering.periodTotals"> | null): {
1295
+ data: {
1296
+ period: {
1297
+ start: string;
1298
+ end: string;
1299
+ zone: string;
1300
+ locked: boolean;
1301
+ preview: boolean;
1302
+ version: {
1303
+ id: string;
1304
+ version: number;
1305
+ state: "locked" | "reopened";
1306
+ lockedBy: string;
1307
+ lockedByName: string;
1308
+ lockedAt: string;
1309
+ reopenedBy: string | null;
1310
+ reopenedAt: string | null;
1311
+ reopenReason: string | null;
1312
+ } | null;
1313
+ };
1314
+ totals: {
1315
+ account: string;
1316
+ name: string;
1317
+ email: string;
1318
+ basis: "by_time" | "by_class";
1319
+ kind: {
1320
+ object: string;
1321
+ id: string;
1322
+ } | null;
1323
+ kindName: string;
1324
+ shifts: number;
1325
+ minutes: number;
1326
+ hours: string;
1327
+ notWorked: number;
1328
+ flagged: number;
1329
+ }[];
1330
+ lines: {
1331
+ account: string;
1332
+ name: string;
1333
+ email: string;
1334
+ basis: "by_time" | "by_class";
1335
+ object: string;
1336
+ id: string;
1337
+ kind: {
1338
+ object: string;
1339
+ id: string;
1340
+ } | null;
1341
+ kindName: string;
1342
+ title: string;
1343
+ place: string | null;
1344
+ localDate: string;
1345
+ localStart: string;
1346
+ localEnd: string;
1347
+ shiftMinutes: number;
1348
+ beforeMinutes: number;
1349
+ afterMinutes: number;
1350
+ countedMinutes: number;
1351
+ counted: boolean;
1352
+ notWorkedReason: string | null;
1353
+ listTaken: boolean | null;
1354
+ markedBy: string | null;
1355
+ flagged: boolean;
1356
+ }[];
1357
+ minutes: number;
1358
+ hours: string;
1359
+ } | undefined;
1360
+ isPending: boolean;
1361
+ error: unknown;
1362
+ refetch?: () => unknown;
1363
+ };
1364
+ /** Pay: lock a period that has ended. */
1365
+ useLock(): {
1366
+ mutate(input: {
1367
+ start: string;
1368
+ }): void;
1369
+ mutateAsync(input: {
1370
+ start: string;
1371
+ }): Promise<{
1372
+ id: string;
1373
+ start: string;
1374
+ end: string;
1375
+ version: number;
1376
+ }>;
1377
+ data: {
1378
+ id: string;
1379
+ start: string;
1380
+ end: string;
1381
+ version: number;
1382
+ } | undefined;
1383
+ isPending: boolean;
1384
+ error: unknown;
1385
+ reset?: () => void;
1386
+ };
1387
+ /** Pay: reopen a locked period with why (forgotten once the call is over). */
1388
+ useReopen(): {
1389
+ mutate(input: {
1390
+ start: string;
1391
+ reason: string;
1392
+ }): void;
1393
+ mutateAsync(input: {
1394
+ start: string;
1395
+ reason: string;
1396
+ }): Promise<{
1397
+ id: string;
1398
+ start: string;
1399
+ version: number;
1400
+ }>;
1401
+ data: {
1402
+ id: string;
1403
+ start: string;
1404
+ version: number;
1405
+ } | undefined;
1406
+ isPending: boolean;
1407
+ error: unknown;
1408
+ reset?: () => void;
1409
+ };
1410
+ /**
1411
+ * Pay: a period's CSV for payroll, fetched when asked and never cached: the screen hands it
1412
+ * to the person (a download, a share sheet) and keeps nothing.
1413
+ */
1414
+ useExport(): {
1415
+ mutate(input: {
1416
+ start: string;
1417
+ version?: number | undefined;
1418
+ }): void;
1419
+ mutateAsync(input: {
1420
+ start: string;
1421
+ version?: number | undefined;
1422
+ }): Promise<{
1423
+ filename: string;
1424
+ contentType: "text/csv";
1425
+ csv: string;
1426
+ locked: boolean;
1427
+ version: number | null;
1428
+ }>;
1429
+ data: {
1430
+ filename: string;
1431
+ contentType: "text/csv";
1432
+ csv: string;
1433
+ locked: boolean;
1434
+ version: number | null;
1435
+ } | undefined;
1436
+ isPending: boolean;
1437
+ error: unknown;
1438
+ reset?: () => void;
1439
+ };
1440
+ /** Whether I have a calendar feed (never its address). */
1441
+ useFeed(): {
1442
+ data: {
1443
+ active: boolean;
1444
+ createdAt: string | null;
1445
+ } | undefined;
1446
+ isPending: boolean;
1447
+ error: unknown;
1448
+ refetch?: () => unknown;
1449
+ };
1450
+ /**
1451
+ * A new calendar address (any old one stops working): shown once, as https and webcal on the
1452
+ * host this client talks to (its `baseUrl`), never on an address the page was given. Call it
1453
+ * through `forgetAfter`, keep the address only on screen, and forget it on leaving.
1454
+ */
1455
+ useFeedRotate(): {
1456
+ mutate(input: Record<string, never>): void;
1457
+ mutateAsync(input: Record<string, never>): Promise<{
1458
+ createdAt: string;
1459
+ https: string;
1460
+ webcal: string;
1461
+ }>;
1462
+ data: {
1463
+ createdAt: string;
1464
+ https: string;
1465
+ webcal: string;
1466
+ } | undefined;
1467
+ isPending: boolean;
1468
+ error: unknown;
1469
+ reset?: () => void;
1470
+ };
1471
+ /** Turn my calendar feed off. */
1472
+ useFeedRevoke(): {
1473
+ mutate(input: {
1474
+ account?: string | undefined;
1475
+ }): void;
1476
+ mutateAsync(input: {
1477
+ account?: string | undefined;
1478
+ }): Promise<{
1479
+ account: string;
1480
+ revoked: boolean;
1481
+ }>;
1482
+ data: {
1483
+ account: string;
1484
+ revoked: boolean;
1485
+ } | undefined;
1486
+ isPending: boolean;
1487
+ error: unknown;
1488
+ reset?: () => void;
1489
+ };
1490
+ /**
1491
+ * A shift's checklist, its ticks and notes: its person's and whoever rosters' only, kept no
1492
+ * longer than it is on screen.
1493
+ */
1494
+ useChecklist(input: In<"x.rostering.checklist"> | null): {
1495
+ data: {
1496
+ template: {
1497
+ id: string;
1498
+ name: string;
1499
+ } | null;
1500
+ run: {
1501
+ id: string;
1502
+ object: string;
1503
+ record: string;
1504
+ template: {
1505
+ id: string;
1506
+ name: string;
1507
+ version: number;
1508
+ };
1509
+ state: "done" | "missed" | "cancelled" | "open";
1510
+ account: string | null;
1511
+ name: string | null;
1512
+ opens: string;
1513
+ closes: string;
1514
+ tickUntil: string;
1515
+ madeAt: string;
1516
+ closedAt: string | null;
1517
+ closedBy: string | null;
1518
+ closedByName: string | null;
1519
+ closedWhy: string | null;
1520
+ steps: {
1521
+ position: number;
1522
+ text: string;
1523
+ required: boolean;
1524
+ asksNote: boolean;
1525
+ tick: {
1526
+ id: string;
1527
+ state: "done" | "not_done" | "cleared";
1528
+ done: boolean;
1529
+ why: string | null;
1530
+ note: string | null;
1531
+ onBehalfWhy: string | null;
1532
+ withheld: boolean;
1533
+ by: string;
1534
+ byName: string;
1535
+ for: string;
1536
+ forName: string;
1537
+ onBehalf: boolean;
1538
+ at: string;
1539
+ label: string;
1540
+ } | null;
1541
+ history: {
1542
+ id: string;
1543
+ state: "done" | "not_done" | "cleared";
1544
+ done: boolean;
1545
+ why: string | null;
1546
+ note: string | null;
1547
+ onBehalfWhy: string | null;
1548
+ withheld: boolean;
1549
+ by: string;
1550
+ byName: string;
1551
+ for: string;
1552
+ forName: string;
1553
+ onBehalf: boolean;
1554
+ at: string;
1555
+ label: string;
1556
+ }[];
1557
+ historyTruncated: boolean;
1558
+ missed: boolean;
1559
+ }[];
1560
+ corrections: {
1561
+ id: string;
1562
+ text: string;
1563
+ by: string;
1564
+ byName: string;
1565
+ at: string;
1566
+ }[];
1567
+ } | null;
1568
+ preview: {
1569
+ text: string;
1570
+ required: boolean;
1571
+ asksNote: boolean;
1572
+ }[] | null;
1573
+ opens: string | null;
1574
+ closes: string | null;
1575
+ tickUntil: string | null;
1576
+ canTick: boolean;
1577
+ onBehalf: boolean;
1578
+ forName: string | null;
1579
+ you: string;
1580
+ youRoster: boolean;
1581
+ } | undefined;
1582
+ isPending: boolean;
1583
+ error: unknown;
1584
+ refetch?: () => unknown;
1585
+ };
1586
+ /**
1587
+ * Tick a step (a person's own act). What is written on it is forgotten once the call is over:
1588
+ * call it through `forgetAfter`.
1589
+ */
1590
+ useTick(): {
1591
+ mutate(input: {
1592
+ step: number;
1593
+ state: "done" | "not_done" | "clear";
1594
+ object: string;
1595
+ id: string;
1596
+ note?: string | undefined;
1597
+ why?: string | undefined;
1598
+ forWhy?: string | undefined;
1599
+ }): void;
1600
+ mutateAsync(input: {
1601
+ step: number;
1602
+ state: "done" | "not_done" | "clear";
1603
+ object: string;
1604
+ id: string;
1605
+ note?: string | undefined;
1606
+ why?: string | undefined;
1607
+ forWhy?: string | undefined;
1608
+ }): Promise<{
1609
+ run: string;
1610
+ step: number;
1611
+ state: "done" | "not_done" | "clear";
1612
+ ticked: number;
1613
+ of: number;
1614
+ }>;
1615
+ data: {
1616
+ run: string;
1617
+ step: number;
1618
+ state: "done" | "not_done" | "clear";
1619
+ ticked: number;
1620
+ of: number;
1621
+ } | undefined;
1622
+ isPending: boolean;
1623
+ error: unknown;
1624
+ reset?: () => void;
1625
+ };
1626
+ /** Mark a checklist done: final. Why, for someone else's, is forgotten once the call is over. */
1627
+ useChecklistDone(): {
1628
+ mutate(input: {
1629
+ object: string;
1630
+ id: string;
1631
+ forWhy?: string | undefined;
1632
+ }): void;
1633
+ mutateAsync(input: {
1634
+ object: string;
1635
+ id: string;
1636
+ forWhy?: string | undefined;
1637
+ }): Promise<{
1638
+ run: string;
1639
+ state: "done";
1640
+ }>;
1641
+ data: {
1642
+ run: string;
1643
+ state: "done";
1644
+ } | undefined;
1645
+ isPending: boolean;
1646
+ error: unknown;
1647
+ reset?: () => void;
1648
+ };
1649
+ /** A rosterer: how checklists went, by checklist and date (on screen only). */
1650
+ useChecklistRuns(input: In<"x.rostering.checklistRuns"> | null): {
1651
+ data: {
1652
+ zone: string;
1653
+ runs: {
1654
+ id: string;
1655
+ object: string;
1656
+ record: string;
1657
+ title: string;
1658
+ template: {
1659
+ id: string;
1660
+ name: string;
1661
+ };
1662
+ state: "done" | "missed" | "cancelled" | "open";
1663
+ account: string | null;
1664
+ name: string | null;
1665
+ opens: string;
1666
+ closes: string;
1667
+ steps: number;
1668
+ ticked: number;
1669
+ onBehalf: number;
1670
+ missed: string[];
1671
+ corrections: number;
1672
+ }[];
1673
+ truncated: boolean;
1674
+ } | undefined;
1675
+ isPending: boolean;
1676
+ error: unknown;
1677
+ refetch?: () => unknown;
1678
+ };
1679
+ /** A rosterer: a correction beside a closed checklist (forgotten once the call is over). */
1680
+ useChecklistCorrect(): {
1681
+ mutate(input: {
1682
+ run: string;
1683
+ text: string;
1684
+ }): void;
1685
+ mutateAsync(input: {
1686
+ run: string;
1687
+ text: string;
1688
+ }): Promise<{
1689
+ id: string;
1690
+ run: string;
1691
+ }>;
1692
+ data: {
1693
+ id: string;
1694
+ run: string;
1695
+ } | undefined;
1696
+ isPending: boolean;
1697
+ error: unknown;
1698
+ reset?: () => void;
1699
+ };
1700
+ }, {
1701
+ readonly useMe: readonly ["x.rostering.me"];
1702
+ readonly useWeek: readonly ["x.rostering.week"];
1703
+ readonly useMine: readonly ["x.rostering.mine"];
1704
+ readonly useOffers: readonly ["x.rostering.offers"];
1705
+ readonly useOffer: readonly ["x.rostering.offer"];
1706
+ readonly useWithdraw: readonly ["x.rostering.withdraw"];
1707
+ readonly useTake: readonly ["x.rostering.take"];
1708
+ readonly useAway: readonly ["x.rostering.away"];
1709
+ readonly useBack: readonly ["x.rostering.back"];
1710
+ readonly useMyAway: readonly ["x.rostering.myAway"];
1711
+ readonly useMyPayPeriods: readonly ["x.rostering.myPayPeriods"];
1712
+ readonly useMyPay: readonly ["x.rostering.myPay"];
1713
+ readonly useAssign: readonly ["x.rostering.assign"];
1714
+ readonly useCheck: readonly ["x.rostering.check"];
1715
+ readonly useCandidates: readonly ["x.rostering.candidates"];
1716
+ readonly useFollow: readonly ["x.rostering.follow"];
1717
+ readonly usePeople: readonly ["x.rostering.people"];
1718
+ readonly usePatterns: readonly ["x.rostering.patterns"];
1719
+ readonly useSetPattern: readonly ["x.rostering.setPattern"];
1720
+ readonly useQualify: readonly ["x.rostering.qualify"];
1721
+ readonly useQualifications: readonly ["x.rostering.qualifications"];
1722
+ readonly useAwayFor: readonly ["x.rostering.awayFor"];
1723
+ readonly useAwayList: readonly ["x.rostering.awayList"];
1724
+ readonly useUncovered: readonly ["x.rostering.uncovered"];
1725
+ readonly useMarkNotWorked: readonly ["x.rostering.markNotWorked"];
1726
+ readonly usePayBases: readonly ["x.rostering.payBases"];
1727
+ readonly usePayBasis: readonly ["x.rostering.payBasis"];
1728
+ readonly usePeriods: readonly ["x.rostering.periods"];
1729
+ readonly usePeriodTotals: readonly ["x.rostering.periodTotals"];
1730
+ readonly useLock: readonly ["x.rostering.lock"];
1731
+ readonly useReopen: readonly ["x.rostering.reopen"];
1732
+ readonly useExport: readonly ["x.rostering.export"];
1733
+ readonly useFeed: readonly ["x.rostering.feed"];
1734
+ readonly useFeedRotate: readonly ["x.rostering.feedRotate"];
1735
+ readonly useFeedRevoke: readonly ["x.rostering.feedRevoke"];
1736
+ readonly useChecklist: readonly ["x.rostering.checklist"];
1737
+ readonly useTick: readonly ["x.rostering.tick"];
1738
+ readonly useChecklistDone: readonly ["x.rostering.checklistDone"];
1739
+ readonly useChecklistRuns: readonly ["x.rostering.checklistRuns"];
1740
+ readonly useChecklistCorrect: readonly ["x.rostering.checklistCorrect"];
1741
+ }, import("@composable-os/client").OperationsOf<C>>;
1742
+ declare function allRosteringHooks(react: {
1743
+ useQuery: UseQuery;
1744
+ useMutation: UseMutation;
1745
+ }, api: RosteringClient): {
1746
+ /** Who is reading and what the host lets them do (rosters, pays), the zone and today there. */
1747
+ useMe(): {
1748
+ data: {
1749
+ account: string;
1750
+ name: string;
1751
+ rosters: boolean;
1752
+ pays: boolean;
1753
+ zone: string;
1754
+ today: string;
1755
+ cutoffMinutes: number;
1756
+ uncoveredDays: number;
1757
+ } | undefined;
1758
+ isPending: boolean;
1759
+ error: unknown;
1760
+ refetch?: () => unknown;
1761
+ };
1762
+ /** The roster from..to (local dates); a rosterer's answer carries each shift's warnings. */
1763
+ useWeek(input: In<"x.rostering.week">, enabled?: boolean): {
1764
+ data: {
1765
+ shifts: {
1766
+ object: string;
1767
+ id: string;
1768
+ title: string;
1769
+ kind: {
1770
+ object: string;
1771
+ id: string;
1772
+ name: string;
1773
+ } | null;
1774
+ startsAt: string;
1775
+ endsAt: string | null;
1776
+ zone: string | null;
1777
+ place: string | null;
1778
+ uncovered: boolean;
1779
+ noAccount: boolean;
1780
+ account: string | null;
1781
+ name: string | null;
1782
+ mine: boolean;
1783
+ offer: {
1784
+ id: string;
1785
+ to: string | null;
1786
+ from: string | null;
1787
+ } | null;
1788
+ warnings: {
1789
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
1790
+ object: string;
1791
+ id: string;
1792
+ account: string | null;
1793
+ message: string;
1794
+ }[] | null;
1795
+ checklist: {
1796
+ name: string;
1797
+ state: "not_started" | "in_progress" | "done" | "missed" | "cancelled" | null;
1798
+ } | null;
1799
+ }[];
1800
+ zone: string;
1801
+ days: {
1802
+ date: string;
1803
+ hours: number;
1804
+ }[];
1805
+ truncated: boolean;
1806
+ } | undefined;
1807
+ isPending: boolean;
1808
+ error: unknown;
1809
+ refetch?: () => unknown;
1810
+ };
1811
+ /** My own shifts from..to. */
1812
+ useMine(input: In<"x.rostering.mine">, enabled?: boolean): {
1813
+ data: {
1814
+ shifts: {
1815
+ object: string;
1816
+ id: string;
1817
+ title: string;
1818
+ kind: {
1819
+ object: string;
1820
+ id: string;
1821
+ name: string;
1822
+ } | null;
1823
+ startsAt: string;
1824
+ endsAt: string | null;
1825
+ zone: string | null;
1826
+ place: string | null;
1827
+ uncovered: boolean;
1828
+ noAccount: boolean;
1829
+ account: string | null;
1830
+ name: string | null;
1831
+ mine: boolean;
1832
+ offer: {
1833
+ id: string;
1834
+ to: string | null;
1835
+ from: string | null;
1836
+ } | null;
1837
+ warnings: {
1838
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
1839
+ object: string;
1840
+ id: string;
1841
+ account: string | null;
1842
+ message: string;
1843
+ }[] | null;
1844
+ checklist: {
1845
+ name: string;
1846
+ state: "not_started" | "in_progress" | "done" | "missed" | "cancelled" | null;
1847
+ } | null;
1848
+ }[];
1849
+ zone: string;
1850
+ days: {
1851
+ date: string;
1852
+ hours: number;
1853
+ }[];
1854
+ truncated: boolean;
1855
+ } | undefined;
1856
+ isPending: boolean;
1857
+ error: unknown;
1858
+ refetch?: () => unknown;
1859
+ };
1860
+ /** Offers I could take now, and my own open offers. */
1861
+ useOffers(): {
1862
+ data: {
1863
+ open: {
1864
+ id: string;
1865
+ shift: {
1866
+ object: string;
1867
+ id: string;
1868
+ title: string;
1869
+ startsAt: string | null;
1870
+ endsAt: string | null;
1871
+ };
1872
+ from: string | null;
1873
+ fromName: string | null;
1874
+ to: string | null;
1875
+ state: "cancelled" | "open" | "taken" | "withdrawn" | "lapsed";
1876
+ madeAt: string;
1877
+ takenBy: string | null;
1878
+ takenAt: string | null;
1879
+ closesAt: string | null;
1880
+ unavailable: boolean;
1881
+ }[];
1882
+ mine: {
1883
+ id: string;
1884
+ shift: {
1885
+ object: string;
1886
+ id: string;
1887
+ title: string;
1888
+ startsAt: string | null;
1889
+ endsAt: string | null;
1890
+ };
1891
+ from: string | null;
1892
+ fromName: string | null;
1893
+ to: string | null;
1894
+ state: "cancelled" | "open" | "taken" | "withdrawn" | "lapsed";
1895
+ madeAt: string;
1896
+ takenBy: string | null;
1897
+ takenAt: string | null;
1898
+ closesAt: string | null;
1899
+ }[];
1900
+ } | undefined;
1901
+ isPending: boolean;
1902
+ error: unknown;
1903
+ refetch?: () => unknown;
1904
+ };
1905
+ /** Offer a shift (a person's own act). */
1906
+ useOffer(): {
1907
+ mutate(input: {
1908
+ object: string;
1909
+ id: string;
1910
+ to?: string | undefined;
1911
+ }): void;
1912
+ mutateAsync(input: {
1913
+ object: string;
1914
+ id: string;
1915
+ to?: string | undefined;
1916
+ }): Promise<{
1917
+ offer: {
1918
+ id: string;
1919
+ shift: {
1920
+ object: string;
1921
+ id: string;
1922
+ title: string;
1923
+ startsAt: string | null;
1924
+ endsAt: string | null;
1925
+ };
1926
+ from: string | null;
1927
+ fromName: string | null;
1928
+ to: string | null;
1929
+ state: "cancelled" | "open" | "taken" | "withdrawn" | "lapsed";
1930
+ madeAt: string;
1931
+ takenBy: string | null;
1932
+ takenAt: string | null;
1933
+ closesAt: string | null;
1934
+ };
1935
+ told: number | null;
1936
+ }>;
1937
+ data: {
1938
+ offer: {
1939
+ id: string;
1940
+ shift: {
1941
+ object: string;
1942
+ id: string;
1943
+ title: string;
1944
+ startsAt: string | null;
1945
+ endsAt: string | null;
1946
+ };
1947
+ from: string | null;
1948
+ fromName: string | null;
1949
+ to: string | null;
1950
+ state: "cancelled" | "open" | "taken" | "withdrawn" | "lapsed";
1951
+ madeAt: string;
1952
+ takenBy: string | null;
1953
+ takenAt: string | null;
1954
+ closesAt: string | null;
1955
+ };
1956
+ told: number | null;
1957
+ } | undefined;
1958
+ isPending: boolean;
1959
+ error: unknown;
1960
+ reset?: () => void;
1961
+ };
1962
+ /** Withdraw an open offer. */
1963
+ useWithdraw(): {
1964
+ mutate(input: {
1965
+ offer: string;
1966
+ }): void;
1967
+ mutateAsync(input: {
1968
+ offer: string;
1969
+ }): Promise<{
1970
+ offer: {
1971
+ id: string;
1972
+ shift: {
1973
+ object: string;
1974
+ id: string;
1975
+ title: string;
1976
+ startsAt: string | null;
1977
+ endsAt: string | null;
1978
+ };
1979
+ from: string | null;
1980
+ fromName: string | null;
1981
+ to: string | null;
1982
+ state: "cancelled" | "open" | "taken" | "withdrawn" | "lapsed";
1983
+ madeAt: string;
1984
+ takenBy: string | null;
1985
+ takenAt: string | null;
1986
+ closesAt: string | null;
1987
+ };
1988
+ }>;
1989
+ data: {
1990
+ offer: {
1991
+ id: string;
1992
+ shift: {
1993
+ object: string;
1994
+ id: string;
1995
+ title: string;
1996
+ startsAt: string | null;
1997
+ endsAt: string | null;
1998
+ };
1999
+ from: string | null;
2000
+ fromName: string | null;
2001
+ to: string | null;
2002
+ state: "cancelled" | "open" | "taken" | "withdrawn" | "lapsed";
2003
+ madeAt: string;
2004
+ takenBy: string | null;
2005
+ takenAt: string | null;
2006
+ closesAt: string | null;
2007
+ };
2008
+ } | undefined;
2009
+ isPending: boolean;
2010
+ error: unknown;
2011
+ reset?: () => void;
2012
+ };
2013
+ /** Take an offered shift; the host may ask to confirm when I said I am away then. */
2014
+ useTake(): {
2015
+ mutate(input: {
2016
+ offer: string;
2017
+ confirmUnavailable?: boolean | undefined;
2018
+ }): void;
2019
+ mutateAsync(input: {
2020
+ offer: string;
2021
+ confirmUnavailable?: boolean | undefined;
2022
+ }): Promise<{
2023
+ offer: string;
2024
+ shift: {
2025
+ object: string;
2026
+ id: string;
2027
+ title: string;
2028
+ startsAt: string | null;
2029
+ endsAt: string | null;
2030
+ };
2031
+ warnings: {
2032
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
2033
+ object: string;
2034
+ id: string;
2035
+ account: string | null;
2036
+ message: string;
2037
+ }[];
2038
+ }>;
2039
+ data: {
2040
+ offer: string;
2041
+ shift: {
2042
+ object: string;
2043
+ id: string;
2044
+ title: string;
2045
+ startsAt: string | null;
2046
+ endsAt: string | null;
2047
+ };
2048
+ warnings: {
2049
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
2050
+ object: string;
2051
+ id: string;
2052
+ account: string | null;
2053
+ message: string;
2054
+ }[];
2055
+ } | undefined;
2056
+ isPending: boolean;
2057
+ error: unknown;
2058
+ reset?: () => void;
2059
+ };
2060
+ /**
2061
+ * Say when I cannot work. What I write about it (the note) is not kept once the call is
2062
+ * over: call it through `forgetAfter`.
2063
+ */
2064
+ useAway(): {
2065
+ mutate(input: {
2066
+ kind: "leave" | "other" | "regular";
2067
+ note?: string | undefined;
2068
+ startsAt?: string | undefined;
2069
+ endsAt?: string | undefined;
2070
+ weekdays?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
2071
+ startTime?: string | undefined;
2072
+ endTime?: string | undefined;
2073
+ fromDate?: string | undefined;
2074
+ untilDate?: string | undefined;
2075
+ zone?: string | undefined;
2076
+ }): void;
2077
+ mutateAsync(input: {
2078
+ kind: "leave" | "other" | "regular";
2079
+ note?: string | undefined;
2080
+ startsAt?: string | undefined;
2081
+ endsAt?: string | undefined;
2082
+ weekdays?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
2083
+ startTime?: string | undefined;
2084
+ endTime?: string | undefined;
2085
+ fromDate?: string | undefined;
2086
+ untilDate?: string | undefined;
2087
+ zone?: string | undefined;
2088
+ }): Promise<{
2089
+ id: string;
2090
+ shifts: {
2091
+ object: string;
2092
+ id: string;
2093
+ title: string;
2094
+ startsAt: string | null;
2095
+ endsAt: string | null;
2096
+ }[];
2097
+ count: number;
2098
+ }>;
2099
+ data: {
2100
+ id: string;
2101
+ shifts: {
2102
+ object: string;
2103
+ id: string;
2104
+ title: string;
2105
+ startsAt: string | null;
2106
+ endsAt: string | null;
2107
+ }[];
2108
+ count: number;
2109
+ } | undefined;
2110
+ isPending: boolean;
2111
+ error: unknown;
2112
+ reset?: () => void;
2113
+ };
2114
+ /** Remove a time off. */
2115
+ useBack(): {
2116
+ mutate(input: {
2117
+ id: string;
2118
+ }): void;
2119
+ mutateAsync(input: {
2120
+ id: string;
2121
+ }): Promise<{
2122
+ id: string;
2123
+ }>;
2124
+ data: {
2125
+ id: string;
2126
+ } | undefined;
2127
+ isPending: boolean;
2128
+ error: unknown;
2129
+ reset?: () => void;
2130
+ };
2131
+ /** My time off, with my notes: kept no longer than it is on screen. */
2132
+ useMyAway(input?: In<"x.rostering.myAway">): {
2133
+ data: {
2134
+ items: {
2135
+ id: string;
2136
+ account: string;
2137
+ name: string;
2138
+ kind: "leave" | "other" | "regular";
2139
+ note: string | null;
2140
+ startsAt: string | null;
2141
+ endsAt: string | null;
2142
+ weekdays: string[];
2143
+ startTime: string | null;
2144
+ endTime: string | null;
2145
+ fromDate: string | null;
2146
+ untilDate: string | null;
2147
+ zone: string;
2148
+ }[];
2149
+ } | undefined;
2150
+ isPending: boolean;
2151
+ error: unknown;
2152
+ refetch?: () => unknown;
2153
+ };
2154
+ /** The pay periods I can see my own hours for: dates and state only. */
2155
+ useMyPayPeriods(enabled?: boolean): {
2156
+ data: {
2157
+ set: boolean;
2158
+ periods: {
2159
+ start: string;
2160
+ end: string;
2161
+ zone: string;
2162
+ state: "open" | "locked";
2163
+ ended: boolean;
2164
+ version: number | null;
2165
+ }[];
2166
+ } | undefined;
2167
+ isPending: boolean;
2168
+ error: unknown;
2169
+ refetch?: () => unknown;
2170
+ };
2171
+ /**
2172
+ * My own hours for one pay period: pay figures, kept no longer than they are on screen. The
2173
+ * query's key holds the period's first date only, never a figure.
2174
+ */
2175
+ useMyPay(input: In<"x.rostering.myPay"> | null): {
2176
+ data: {
2177
+ period: {
2178
+ start: string;
2179
+ end: string;
2180
+ zone: string;
2181
+ ended: boolean;
2182
+ locked: boolean;
2183
+ preview: boolean;
2184
+ version: number | null;
2185
+ };
2186
+ counted: boolean;
2187
+ basis: "by_time" | "by_class" | "not_counted";
2188
+ totals: {
2189
+ basis: "by_time" | "by_class";
2190
+ kind: {
2191
+ object: string;
2192
+ id: string;
2193
+ } | null;
2194
+ kindName: string;
2195
+ shifts: number;
2196
+ minutes: number;
2197
+ hours: string;
2198
+ notWorked: number;
2199
+ flagged: number;
2200
+ }[];
2201
+ lines: {
2202
+ object: string;
2203
+ id: string;
2204
+ title: string;
2205
+ kindName: string;
2206
+ basis: "by_time" | "by_class";
2207
+ place: string | null;
2208
+ localDate: string;
2209
+ localStart: string;
2210
+ localEnd: string;
2211
+ shiftMinutes: number;
2212
+ beforeMinutes: number;
2213
+ afterMinutes: number;
2214
+ countedMinutes: number;
2215
+ notWorked: boolean;
2216
+ listTaken: boolean | null;
2217
+ flagged: boolean;
2218
+ clockChange: string | null;
2219
+ }[];
2220
+ minutes: number | null;
2221
+ hours: string | null;
2222
+ } | undefined;
2223
+ isPending: boolean;
2224
+ error: unknown;
2225
+ refetch?: () => unknown;
2226
+ };
2227
+ /** A rosterer: put someone (or nobody) on a shift. */
2228
+ useAssign(): {
2229
+ mutate(input: {
2230
+ account: string | null;
2231
+ object: string;
2232
+ id: string;
2233
+ }): void;
2234
+ mutateAsync(input: {
2235
+ account: string | null;
2236
+ object: string;
2237
+ id: string;
2238
+ }): Promise<{
2239
+ shift: {
2240
+ object: string;
2241
+ id: string;
2242
+ title: string;
2243
+ startsAt: string | null;
2244
+ endsAt: string | null;
2245
+ };
2246
+ warnings: {
2247
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
2248
+ object: string;
2249
+ id: string;
2250
+ account: string | null;
2251
+ message: string;
2252
+ }[];
2253
+ }>;
2254
+ data: {
2255
+ shift: {
2256
+ object: string;
2257
+ id: string;
2258
+ title: string;
2259
+ startsAt: string | null;
2260
+ endsAt: string | null;
2261
+ };
2262
+ warnings: {
2263
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
2264
+ object: string;
2265
+ id: string;
2266
+ account: string | null;
2267
+ message: string;
2268
+ }[];
2269
+ } | undefined;
2270
+ isPending: boolean;
2271
+ error: unknown;
2272
+ reset?: () => void;
2273
+ };
2274
+ /** A rosterer: what putting someone on a shift would be made with. */
2275
+ useCheck(input: In<"x.rostering.check"> | null): {
2276
+ data: {
2277
+ warnings: {
2278
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
2279
+ object: string;
2280
+ id: string;
2281
+ account: string | null;
2282
+ message: string;
2283
+ }[];
2284
+ clash: {
2285
+ object: string;
2286
+ id: string;
2287
+ title: string;
2288
+ startsAt: string;
2289
+ endsAt: string;
2290
+ } | null;
2291
+ } | undefined;
2292
+ isPending: boolean;
2293
+ error: unknown;
2294
+ refetch?: () => unknown;
2295
+ };
2296
+ /** A rosterer: who could be put on a shift, eligible first, with the pattern's person. */
2297
+ useCandidates(input: In<"x.rostering.candidates"> | null): {
2298
+ data: {
2299
+ current: {
2300
+ account: string | null;
2301
+ name: string | null;
2302
+ };
2303
+ pattern: {
2304
+ account: string | null;
2305
+ name: string | null;
2306
+ own: boolean;
2307
+ } | null;
2308
+ people: {
2309
+ account: string;
2310
+ name: string;
2311
+ eligible: boolean;
2312
+ noProfile: boolean;
2313
+ warnings: {
2314
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
2315
+ object: string;
2316
+ id: string;
2317
+ account: string | null;
2318
+ message: string;
2319
+ }[];
2320
+ clash: {
2321
+ object: string;
2322
+ id: string;
2323
+ title: string;
2324
+ startsAt: string;
2325
+ endsAt: string;
2326
+ } | null;
2327
+ }[];
2328
+ truncated: boolean;
2329
+ } | undefined;
2330
+ isPending: boolean;
2331
+ error: unknown;
2332
+ refetch?: () => unknown;
2333
+ };
2334
+ /** A rosterer: a shift back to its pattern's person. */
2335
+ useFollow(): {
2336
+ mutate(input: {
2337
+ object: string;
2338
+ id: string;
2339
+ }): void;
2340
+ mutateAsync(input: {
2341
+ object: string;
2342
+ id: string;
2343
+ }): Promise<{
2344
+ object: string;
2345
+ id: string;
2346
+ warnings: {
2347
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
2348
+ object: string;
2349
+ id: string;
2350
+ account: string | null;
2351
+ message: string;
2352
+ }[];
2353
+ }>;
2354
+ data: {
2355
+ object: string;
2356
+ id: string;
2357
+ warnings: {
2358
+ code: "uncovered" | "unavailable" | "not_qualified" | "outside_hours" | "client_busy";
2359
+ object: string;
2360
+ id: string;
2361
+ account: string | null;
2362
+ message: string;
2363
+ }[];
2364
+ } | undefined;
2365
+ isPending: boolean;
2366
+ error: unknown;
2367
+ reset?: () => void;
2368
+ };
2369
+ /** A rosterer: the staff and the kinds of work. */
2370
+ usePeople(enabled?: boolean): {
2371
+ data: {
2372
+ people: {
2373
+ account: string;
2374
+ name: string;
2375
+ }[];
2376
+ kinds: {
2377
+ object: string;
2378
+ objectLabel: string;
2379
+ id: string;
2380
+ name: string;
2381
+ }[];
2382
+ truncated: boolean;
2383
+ } | undefined;
2384
+ isPending: boolean;
2385
+ error: unknown;
2386
+ refetch?: () => unknown;
2387
+ };
2388
+ /** A rosterer: the regular week. */
2389
+ usePatterns(enabled?: boolean): {
2390
+ data: {
2391
+ patterns: {
2392
+ object: string;
2393
+ id: string;
2394
+ title: string;
2395
+ objectLabel: string;
2396
+ kind: {
2397
+ object: string;
2398
+ id: string;
2399
+ name: string;
2400
+ } | null;
2401
+ weekdays: string[];
2402
+ time: string | null;
2403
+ length: number | null;
2404
+ firstDate: string | null;
2405
+ lastDate: string | null;
2406
+ zone: string;
2407
+ account: string | null;
2408
+ name: string | null;
2409
+ noAccount: boolean;
2410
+ }[];
2411
+ truncated: boolean;
2412
+ } | undefined;
2413
+ isPending: boolean;
2414
+ error: unknown;
2415
+ refetch?: () => unknown;
2416
+ };
2417
+ /** A rosterer: a pattern's person from a date. */
2418
+ useSetPattern(): {
2419
+ mutate(input: {
2420
+ object: string;
2421
+ id: string;
2422
+ account: string | null;
2423
+ from?: string | undefined;
2424
+ }): void;
2425
+ mutateAsync(input: {
2426
+ object: string;
2427
+ id: string;
2428
+ account: string | null;
2429
+ from?: string | undefined;
2430
+ }): Promise<{
2431
+ object: string;
2432
+ id: string;
2433
+ account: string | null;
2434
+ from: string;
2435
+ }>;
2436
+ data: {
2437
+ object: string;
2438
+ id: string;
2439
+ account: string | null;
2440
+ from: string;
2441
+ } | undefined;
2442
+ isPending: boolean;
2443
+ error: unknown;
2444
+ reset?: () => void;
2445
+ };
2446
+ /** A rosterer: say whether someone may do a kind of work. */
2447
+ useQualify(): {
2448
+ mutate(input: {
2449
+ account: string;
2450
+ kind: {
2451
+ object: string;
2452
+ id: string;
2453
+ };
2454
+ qualified?: boolean | undefined;
2455
+ }): void;
2456
+ mutateAsync(input: {
2457
+ account: string;
2458
+ kind: {
2459
+ object: string;
2460
+ id: string;
2461
+ };
2462
+ qualified?: boolean | undefined;
2463
+ }): Promise<{
2464
+ account: string;
2465
+ kind: {
2466
+ object: string;
2467
+ id: string;
2468
+ };
2469
+ qualified: boolean;
2470
+ changed: boolean;
2471
+ }>;
2472
+ data: {
2473
+ account: string;
2474
+ kind: {
2475
+ object: string;
2476
+ id: string;
2477
+ };
2478
+ qualified: boolean;
2479
+ changed: boolean;
2480
+ } | undefined;
2481
+ isPending: boolean;
2482
+ error: unknown;
2483
+ reset?: () => void;
2484
+ };
2485
+ /** A rosterer: who may do which kind of work. */
2486
+ useQualifications(input?: In<"x.rostering.qualifications">, enabled?: boolean): {
2487
+ data: {
2488
+ items: {
2489
+ account: string;
2490
+ name: string;
2491
+ kind: {
2492
+ object: string;
2493
+ id: string;
2494
+ name: string;
2495
+ };
2496
+ setBy: string;
2497
+ setAt: string;
2498
+ }[];
2499
+ } | undefined;
2500
+ isPending: boolean;
2501
+ error: unknown;
2502
+ refetch?: () => unknown;
2503
+ };
2504
+ /** A rosterer: say someone else is away. The note is forgotten once the call is over. */
2505
+ useAwayFor(): {
2506
+ mutate(input: {
2507
+ kind: "leave" | "other" | "regular";
2508
+ account: string;
2509
+ note?: string | undefined;
2510
+ startsAt?: string | undefined;
2511
+ endsAt?: string | undefined;
2512
+ weekdays?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
2513
+ startTime?: string | undefined;
2514
+ endTime?: string | undefined;
2515
+ fromDate?: string | undefined;
2516
+ untilDate?: string | undefined;
2517
+ zone?: string | undefined;
2518
+ }): void;
2519
+ mutateAsync(input: {
2520
+ kind: "leave" | "other" | "regular";
2521
+ account: string;
2522
+ note?: string | undefined;
2523
+ startsAt?: string | undefined;
2524
+ endsAt?: string | undefined;
2525
+ weekdays?: ("mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun")[] | undefined;
2526
+ startTime?: string | undefined;
2527
+ endTime?: string | undefined;
2528
+ fromDate?: string | undefined;
2529
+ untilDate?: string | undefined;
2530
+ zone?: string | undefined;
2531
+ }): Promise<{
2532
+ id: string;
2533
+ shifts: {
2534
+ object: string;
2535
+ id: string;
2536
+ title: string;
2537
+ startsAt: string | null;
2538
+ endsAt: string | null;
2539
+ }[];
2540
+ count: number;
2541
+ }>;
2542
+ data: {
2543
+ id: string;
2544
+ shifts: {
2545
+ object: string;
2546
+ id: string;
2547
+ title: string;
2548
+ startsAt: string | null;
2549
+ endsAt: string | null;
2550
+ }[];
2551
+ count: number;
2552
+ } | undefined;
2553
+ isPending: boolean;
2554
+ error: unknown;
2555
+ reset?: () => void;
2556
+ };
2557
+ /** A rosterer: everyone's time off, with notes, kept no longer than it is on screen. */
2558
+ useAwayList(input: In<"x.rostering.awayList">, enabled?: boolean): {
2559
+ data: {
2560
+ items: {
2561
+ id: string;
2562
+ account: string;
2563
+ name: string;
2564
+ kind: "leave" | "other" | "regular";
2565
+ note: string | null;
2566
+ startsAt: string | null;
2567
+ endsAt: string | null;
2568
+ weekdays: string[];
2569
+ startTime: string | null;
2570
+ endTime: string | null;
2571
+ fromDate: string | null;
2572
+ untilDate: string | null;
2573
+ zone: string;
2574
+ }[];
2575
+ } | undefined;
2576
+ isPending: boolean;
2577
+ error: unknown;
2578
+ refetch?: () => unknown;
2579
+ };
2580
+ /** A rosterer: shifts with nobody on them. */
2581
+ useUncovered(input?: In<"x.rostering.uncovered">, enabled?: boolean): {
2582
+ data: {
2583
+ items: {
2584
+ object: string;
2585
+ id: string;
2586
+ title: string;
2587
+ startsAt: string | null;
2588
+ endsAt: string | null;
2589
+ offered: boolean;
2590
+ }[];
2591
+ } | undefined;
2592
+ isPending: boolean;
2593
+ error: unknown;
2594
+ refetch?: () => unknown;
2595
+ };
2596
+ /** A rosterer: mark a started shift not worked, with why (forgotten once the call is over). */
2597
+ useMarkNotWorked(): {
2598
+ mutate(input: {
2599
+ object: string;
2600
+ id: string;
2601
+ notWorked?: boolean | undefined;
2602
+ reason?: string | undefined;
2603
+ }): void;
2604
+ mutateAsync(input: {
2605
+ object: string;
2606
+ id: string;
2607
+ notWorked?: boolean | undefined;
2608
+ reason?: string | undefined;
2609
+ }): Promise<{
2610
+ object: string;
2611
+ id: string;
2612
+ notWorked: boolean;
2613
+ changed: boolean;
2614
+ }>;
2615
+ data: {
2616
+ object: string;
2617
+ id: string;
2618
+ notWorked: boolean;
2619
+ changed: boolean;
2620
+ } | undefined;
2621
+ isPending: boolean;
2622
+ error: unknown;
2623
+ reset?: () => void;
2624
+ };
2625
+ /** Pay: who is counted and how (kept no longer than it is on screen). */
2626
+ usePayBases(input: In<"x.rostering.payBases">, enabled?: boolean): {
2627
+ data: {
2628
+ today: string;
2629
+ items: {
2630
+ account: string;
2631
+ name: string;
2632
+ basis: "by_time" | "by_class" | "not_counted";
2633
+ history: {
2634
+ from: string;
2635
+ basis: "by_time" | "by_class" | "not_counted";
2636
+ setBy: string;
2637
+ setAt: string;
2638
+ }[];
2639
+ }[];
2640
+ truncated: boolean;
2641
+ } | undefined;
2642
+ isPending: boolean;
2643
+ error: unknown;
2644
+ refetch?: () => unknown;
2645
+ };
2646
+ /** Pay: say how someone is counted from a date. */
2647
+ usePayBasis(): {
2648
+ mutate(input: {
2649
+ account: string;
2650
+ basis: "by_time" | "by_class" | "not_counted";
2651
+ from?: string | undefined;
2652
+ }): void;
2653
+ mutateAsync(input: {
2654
+ account: string;
2655
+ basis: "by_time" | "by_class" | "not_counted";
2656
+ from?: string | undefined;
2657
+ }): Promise<{
2658
+ account: string;
2659
+ from: string;
2660
+ changed: boolean;
2661
+ }>;
2662
+ data: {
2663
+ account: string;
2664
+ from: string;
2665
+ changed: boolean;
2666
+ } | undefined;
2667
+ isPending: boolean;
2668
+ error: unknown;
2669
+ reset?: () => void;
2670
+ };
2671
+ /** Pay: the periods. */
2672
+ usePeriods(input?: In<"x.rostering.periods">, enabled?: boolean): {
2673
+ data: {
2674
+ setting: {
2675
+ period: "weekly" | "fortnightly" | "monthly";
2676
+ start: string | null;
2677
+ day: number;
2678
+ zone: string;
2679
+ };
2680
+ set: boolean;
2681
+ periods: {
2682
+ start: string;
2683
+ end: string;
2684
+ zone: string;
2685
+ state: "open" | "locked";
2686
+ ended: boolean;
2687
+ versions: {
2688
+ id: string;
2689
+ version: number;
2690
+ state: "locked" | "reopened";
2691
+ lockedBy: string;
2692
+ lockedByName: string;
2693
+ lockedAt: string;
2694
+ reopenedBy: string | null;
2695
+ reopenedAt: string | null;
2696
+ reopenReason: string | null;
2697
+ }[];
2698
+ }[];
2699
+ } | undefined;
2700
+ isPending: boolean;
2701
+ error: unknown;
2702
+ refetch?: () => unknown;
2703
+ };
2704
+ /** Pay: one period's totals and lines (kept no longer than they are on screen). */
2705
+ usePeriodTotals(input: In<"x.rostering.periodTotals"> | null): {
2706
+ data: {
2707
+ period: {
2708
+ start: string;
2709
+ end: string;
2710
+ zone: string;
2711
+ locked: boolean;
2712
+ preview: boolean;
2713
+ version: {
2714
+ id: string;
2715
+ version: number;
2716
+ state: "locked" | "reopened";
2717
+ lockedBy: string;
2718
+ lockedByName: string;
2719
+ lockedAt: string;
2720
+ reopenedBy: string | null;
2721
+ reopenedAt: string | null;
2722
+ reopenReason: string | null;
2723
+ } | null;
2724
+ };
2725
+ totals: {
2726
+ account: string;
2727
+ name: string;
2728
+ email: string;
2729
+ basis: "by_time" | "by_class";
2730
+ kind: {
2731
+ object: string;
2732
+ id: string;
2733
+ } | null;
2734
+ kindName: string;
2735
+ shifts: number;
2736
+ minutes: number;
2737
+ hours: string;
2738
+ notWorked: number;
2739
+ flagged: number;
2740
+ }[];
2741
+ lines: {
2742
+ account: string;
2743
+ name: string;
2744
+ email: string;
2745
+ basis: "by_time" | "by_class";
2746
+ object: string;
2747
+ id: string;
2748
+ kind: {
2749
+ object: string;
2750
+ id: string;
2751
+ } | null;
2752
+ kindName: string;
2753
+ title: string;
2754
+ place: string | null;
2755
+ localDate: string;
2756
+ localStart: string;
2757
+ localEnd: string;
2758
+ shiftMinutes: number;
2759
+ beforeMinutes: number;
2760
+ afterMinutes: number;
2761
+ countedMinutes: number;
2762
+ counted: boolean;
2763
+ notWorkedReason: string | null;
2764
+ listTaken: boolean | null;
2765
+ markedBy: string | null;
2766
+ flagged: boolean;
2767
+ }[];
2768
+ minutes: number;
2769
+ hours: string;
2770
+ } | undefined;
2771
+ isPending: boolean;
2772
+ error: unknown;
2773
+ refetch?: () => unknown;
2774
+ };
2775
+ /** Pay: lock a period that has ended. */
2776
+ useLock(): {
2777
+ mutate(input: {
2778
+ start: string;
2779
+ }): void;
2780
+ mutateAsync(input: {
2781
+ start: string;
2782
+ }): Promise<{
2783
+ id: string;
2784
+ start: string;
2785
+ end: string;
2786
+ version: number;
2787
+ }>;
2788
+ data: {
2789
+ id: string;
2790
+ start: string;
2791
+ end: string;
2792
+ version: number;
2793
+ } | undefined;
2794
+ isPending: boolean;
2795
+ error: unknown;
2796
+ reset?: () => void;
2797
+ };
2798
+ /** Pay: reopen a locked period with why (forgotten once the call is over). */
2799
+ useReopen(): {
2800
+ mutate(input: {
2801
+ start: string;
2802
+ reason: string;
2803
+ }): void;
2804
+ mutateAsync(input: {
2805
+ start: string;
2806
+ reason: string;
2807
+ }): Promise<{
2808
+ id: string;
2809
+ start: string;
2810
+ version: number;
2811
+ }>;
2812
+ data: {
2813
+ id: string;
2814
+ start: string;
2815
+ version: number;
2816
+ } | undefined;
2817
+ isPending: boolean;
2818
+ error: unknown;
2819
+ reset?: () => void;
2820
+ };
2821
+ /**
2822
+ * Pay: a period's CSV for payroll, fetched when asked and never cached: the screen hands it
2823
+ * to the person (a download, a share sheet) and keeps nothing.
2824
+ */
2825
+ useExport(): {
2826
+ mutate(input: {
2827
+ start: string;
2828
+ version?: number | undefined;
2829
+ }): void;
2830
+ mutateAsync(input: {
2831
+ start: string;
2832
+ version?: number | undefined;
2833
+ }): Promise<{
2834
+ filename: string;
2835
+ contentType: "text/csv";
2836
+ csv: string;
2837
+ locked: boolean;
2838
+ version: number | null;
2839
+ }>;
2840
+ data: {
2841
+ filename: string;
2842
+ contentType: "text/csv";
2843
+ csv: string;
2844
+ locked: boolean;
2845
+ version: number | null;
2846
+ } | undefined;
2847
+ isPending: boolean;
2848
+ error: unknown;
2849
+ reset?: () => void;
2850
+ };
2851
+ /** Whether I have a calendar feed (never its address). */
2852
+ useFeed(): {
2853
+ data: {
2854
+ active: boolean;
2855
+ createdAt: string | null;
2856
+ } | undefined;
2857
+ isPending: boolean;
2858
+ error: unknown;
2859
+ refetch?: () => unknown;
2860
+ };
2861
+ /**
2862
+ * A new calendar address (any old one stops working): shown once, as https and webcal on the
2863
+ * host this client talks to (its `baseUrl`), never on an address the page was given. Call it
2864
+ * through `forgetAfter`, keep the address only on screen, and forget it on leaving.
2865
+ */
2866
+ useFeedRotate(): {
2867
+ mutate(input: Record<string, never>): void;
2868
+ mutateAsync(input: Record<string, never>): Promise<{
2869
+ createdAt: string;
2870
+ https: string;
2871
+ webcal: string;
2872
+ }>;
2873
+ data: {
2874
+ createdAt: string;
2875
+ https: string;
2876
+ webcal: string;
2877
+ } | undefined;
2878
+ isPending: boolean;
2879
+ error: unknown;
2880
+ reset?: () => void;
2881
+ };
2882
+ /** Turn my calendar feed off. */
2883
+ useFeedRevoke(): {
2884
+ mutate(input: {
2885
+ account?: string | undefined;
2886
+ }): void;
2887
+ mutateAsync(input: {
2888
+ account?: string | undefined;
2889
+ }): Promise<{
2890
+ account: string;
2891
+ revoked: boolean;
2892
+ }>;
2893
+ data: {
2894
+ account: string;
2895
+ revoked: boolean;
2896
+ } | undefined;
2897
+ isPending: boolean;
2898
+ error: unknown;
2899
+ reset?: () => void;
2900
+ };
2901
+ /**
2902
+ * A shift's checklist, its ticks and notes: its person's and whoever rosters' only, kept no
2903
+ * longer than it is on screen.
2904
+ */
2905
+ useChecklist(input: In<"x.rostering.checklist"> | null): {
2906
+ data: {
2907
+ template: {
2908
+ id: string;
2909
+ name: string;
2910
+ } | null;
2911
+ run: {
2912
+ id: string;
2913
+ object: string;
2914
+ record: string;
2915
+ template: {
2916
+ id: string;
2917
+ name: string;
2918
+ version: number;
2919
+ };
2920
+ state: "done" | "missed" | "cancelled" | "open";
2921
+ account: string | null;
2922
+ name: string | null;
2923
+ opens: string;
2924
+ closes: string;
2925
+ tickUntil: string;
2926
+ madeAt: string;
2927
+ closedAt: string | null;
2928
+ closedBy: string | null;
2929
+ closedByName: string | null;
2930
+ closedWhy: string | null;
2931
+ steps: {
2932
+ position: number;
2933
+ text: string;
2934
+ required: boolean;
2935
+ asksNote: boolean;
2936
+ tick: {
2937
+ id: string;
2938
+ state: "done" | "not_done" | "cleared";
2939
+ done: boolean;
2940
+ why: string | null;
2941
+ note: string | null;
2942
+ onBehalfWhy: string | null;
2943
+ withheld: boolean;
2944
+ by: string;
2945
+ byName: string;
2946
+ for: string;
2947
+ forName: string;
2948
+ onBehalf: boolean;
2949
+ at: string;
2950
+ label: string;
2951
+ } | null;
2952
+ history: {
2953
+ id: string;
2954
+ state: "done" | "not_done" | "cleared";
2955
+ done: boolean;
2956
+ why: string | null;
2957
+ note: string | null;
2958
+ onBehalfWhy: string | null;
2959
+ withheld: boolean;
2960
+ by: string;
2961
+ byName: string;
2962
+ for: string;
2963
+ forName: string;
2964
+ onBehalf: boolean;
2965
+ at: string;
2966
+ label: string;
2967
+ }[];
2968
+ historyTruncated: boolean;
2969
+ missed: boolean;
2970
+ }[];
2971
+ corrections: {
2972
+ id: string;
2973
+ text: string;
2974
+ by: string;
2975
+ byName: string;
2976
+ at: string;
2977
+ }[];
2978
+ } | null;
2979
+ preview: {
2980
+ text: string;
2981
+ required: boolean;
2982
+ asksNote: boolean;
2983
+ }[] | null;
2984
+ opens: string | null;
2985
+ closes: string | null;
2986
+ tickUntil: string | null;
2987
+ canTick: boolean;
2988
+ onBehalf: boolean;
2989
+ forName: string | null;
2990
+ you: string;
2991
+ youRoster: boolean;
2992
+ } | undefined;
2993
+ isPending: boolean;
2994
+ error: unknown;
2995
+ refetch?: () => unknown;
2996
+ };
2997
+ /**
2998
+ * Tick a step (a person's own act). What is written on it is forgotten once the call is over:
2999
+ * call it through `forgetAfter`.
3000
+ */
3001
+ useTick(): {
3002
+ mutate(input: {
3003
+ step: number;
3004
+ state: "done" | "not_done" | "clear";
3005
+ object: string;
3006
+ id: string;
3007
+ note?: string | undefined;
3008
+ why?: string | undefined;
3009
+ forWhy?: string | undefined;
3010
+ }): void;
3011
+ mutateAsync(input: {
3012
+ step: number;
3013
+ state: "done" | "not_done" | "clear";
3014
+ object: string;
3015
+ id: string;
3016
+ note?: string | undefined;
3017
+ why?: string | undefined;
3018
+ forWhy?: string | undefined;
3019
+ }): Promise<{
3020
+ run: string;
3021
+ step: number;
3022
+ state: "done" | "not_done" | "clear";
3023
+ ticked: number;
3024
+ of: number;
3025
+ }>;
3026
+ data: {
3027
+ run: string;
3028
+ step: number;
3029
+ state: "done" | "not_done" | "clear";
3030
+ ticked: number;
3031
+ of: number;
3032
+ } | undefined;
3033
+ isPending: boolean;
3034
+ error: unknown;
3035
+ reset?: () => void;
3036
+ };
3037
+ /** Mark a checklist done: final. Why, for someone else's, is forgotten once the call is over. */
3038
+ useChecklistDone(): {
3039
+ mutate(input: {
3040
+ object: string;
3041
+ id: string;
3042
+ forWhy?: string | undefined;
3043
+ }): void;
3044
+ mutateAsync(input: {
3045
+ object: string;
3046
+ id: string;
3047
+ forWhy?: string | undefined;
3048
+ }): Promise<{
3049
+ run: string;
3050
+ state: "done";
3051
+ }>;
3052
+ data: {
3053
+ run: string;
3054
+ state: "done";
3055
+ } | undefined;
3056
+ isPending: boolean;
3057
+ error: unknown;
3058
+ reset?: () => void;
3059
+ };
3060
+ /** A rosterer: how checklists went, by checklist and date (on screen only). */
3061
+ useChecklistRuns(input: In<"x.rostering.checklistRuns"> | null): {
3062
+ data: {
3063
+ zone: string;
3064
+ runs: {
3065
+ id: string;
3066
+ object: string;
3067
+ record: string;
3068
+ title: string;
3069
+ template: {
3070
+ id: string;
3071
+ name: string;
3072
+ };
3073
+ state: "done" | "missed" | "cancelled" | "open";
3074
+ account: string | null;
3075
+ name: string | null;
3076
+ opens: string;
3077
+ closes: string;
3078
+ steps: number;
3079
+ ticked: number;
3080
+ onBehalf: number;
3081
+ missed: string[];
3082
+ corrections: number;
3083
+ }[];
3084
+ truncated: boolean;
3085
+ } | undefined;
3086
+ isPending: boolean;
3087
+ error: unknown;
3088
+ refetch?: () => unknown;
3089
+ };
3090
+ /** A rosterer: a correction beside a closed checklist (forgotten once the call is over). */
3091
+ useChecklistCorrect(): {
3092
+ mutate(input: {
3093
+ run: string;
3094
+ text: string;
3095
+ }): void;
3096
+ mutateAsync(input: {
3097
+ run: string;
3098
+ text: string;
3099
+ }): Promise<{
3100
+ id: string;
3101
+ run: string;
3102
+ }>;
3103
+ data: {
3104
+ id: string;
3105
+ run: string;
3106
+ } | undefined;
3107
+ isPending: boolean;
3108
+ error: unknown;
3109
+ reset?: () => void;
3110
+ };
3111
+ };
3112
+ /** Every hook of this entry. A block takes the ones it calls: `Pick<RosteringHooks, "useWeek">`. */
3113
+ export type RosteringHooks = ReturnType<typeof allRosteringHooks>;