kaafil-react-uikit 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/LICENSE +21 -0
- package/README.md +187 -0
- package/dist/OfflineFallbackScreen-B5dfaJBN.d.ts +37 -0
- package/dist/OfflineFallbackScreen-Ctm7nBa-.d.cts +37 -0
- package/dist/SessionExpiredScreen-CytQNuak.d.cts +50 -0
- package/dist/SessionExpiredScreen-D8GHyZc3.d.ts +50 -0
- package/dist/admin/index.cjs +23779 -0
- package/dist/admin/index.cjs.map +1 -0
- package/dist/admin/index.d.cts +1157 -0
- package/dist/admin/index.d.ts +1157 -0
- package/dist/admin/index.js +23724 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/chunk-6FPAGGFL.js +6028 -0
- package/dist/chunk-6FPAGGFL.js.map +1 -0
- package/dist/chunk-ACVU55PZ.cjs +294 -0
- package/dist/chunk-ACVU55PZ.cjs.map +1 -0
- package/dist/chunk-EM7JV3D7.cjs +6051 -0
- package/dist/chunk-EM7JV3D7.cjs.map +1 -0
- package/dist/chunk-IIPQ4JNC.js +287 -0
- package/dist/chunk-IIPQ4JNC.js.map +1 -0
- package/dist/chunk-LL243STJ.cjs +2195 -0
- package/dist/chunk-LL243STJ.cjs.map +1 -0
- package/dist/chunk-PJRZCOFF.cjs +958 -0
- package/dist/chunk-PJRZCOFF.cjs.map +1 -0
- package/dist/chunk-PTQ2CJKE.cjs +40 -0
- package/dist/chunk-PTQ2CJKE.cjs.map +1 -0
- package/dist/chunk-PZKXLQSU.js +10 -0
- package/dist/chunk-PZKXLQSU.js.map +1 -0
- package/dist/chunk-QHUDOVKW.cjs +111 -0
- package/dist/chunk-QHUDOVKW.cjs.map +1 -0
- package/dist/chunk-TOBZFADB.cjs +12 -0
- package/dist/chunk-TOBZFADB.cjs.map +1 -0
- package/dist/chunk-UUGMNP27.js +936 -0
- package/dist/chunk-UUGMNP27.js.map +1 -0
- package/dist/chunk-UYJ6LIWP.js +2154 -0
- package/dist/chunk-UYJ6LIWP.js.map +1 -0
- package/dist/chunk-VHTSTUCJ.cjs +346 -0
- package/dist/chunk-VHTSTUCJ.cjs.map +1 -0
- package/dist/chunk-WUAFL77X.js +340 -0
- package/dist/chunk-WUAFL77X.js.map +1 -0
- package/dist/chunk-XI7MK4Y7.js +38 -0
- package/dist/chunk-XI7MK4Y7.js.map +1 -0
- package/dist/chunk-YDGR7JSY.js +107 -0
- package/dist/chunk-YDGR7JSY.js.map +1 -0
- package/dist/core/index.cjs +1254 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +1267 -0
- package/dist/core/index.d.ts +1267 -0
- package/dist/core/index.js +995 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index.css +1 -0
- package/dist/manager/index.cjs +13562 -0
- package/dist/manager/index.cjs.map +1 -0
- package/dist/manager/index.d.cts +1054 -0
- package/dist/manager/index.d.ts +1054 -0
- package/dist/manager/index.js +13518 -0
- package/dist/manager/index.js.map +1 -0
- package/dist/testing/index.cjs +221 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +269 -0
- package/dist/testing/index.d.ts +269 -0
- package/dist/testing/index.js +208 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/tokenStyle-CToG5oOS.d.cts +3 -0
- package/dist/tokenStyle-CToG5oOS.d.ts +3 -0
- package/dist/traveller/index.cjs +1799 -0
- package/dist/traveller/index.cjs.map +1 -0
- package/dist/traveller/index.d.cts +58 -0
- package/dist/traveller/index.d.ts +58 -0
- package/dist/traveller/index.js +1789 -0
- package/dist/traveller/index.js.map +1 -0
- package/dist/useAgencyTrip-BUYSIaC2.d.cts +454 -0
- package/dist/useAgencyTrip-BzyJB1D9.d.ts +454 -0
- package/dist/useNotifications-BZW1Z_ur.d.cts +356 -0
- package/dist/useNotifications-D262i5BQ.d.ts +356 -0
- package/dist/useVendors-DXOuZWhZ.d.cts +784 -0
- package/dist/useVendors-DXOuZWhZ.d.ts +784 -0
- package/package.json +95 -0
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { PartyDeltaRow, TravellersResource, AddPartyOptions, OutboxOp, PatchPartyOptions, RemovePartyOptions, PickupStopDeltaRow, CreatePickupStopOptions, PatchPickupStopOptions, DeletePickupStopOptions, ReorderPickupStopsOptions, AssignPickupTravellerOptions, PickupsResource, BoardPickupTravellerOptions, CorrectPickupBoardStatusOptions, ClosePickupStopOptions, ReopenPickupStopOptions, ReadManifestByPickupOptions, SeatingVehicleDeltaRow, SeatingOccupant, AssignSeatingOptions, AutoAssignSeatingOptions, SeatingResource, CreateSeatingVehicleOptions, PatchSeatingVehicleOptions, DeleteSeatingVehicleOptions, LinkSeatingManagerOptions, UnlinkSeatingManagerOptions, CloseoutResource, SaveCloseoutHandoverOptions, LockCloseoutOptions, UnlockCloseoutOptions, ExportCloseoutPackOptions, KaafilBinaryResponse, ManagerOwnTripsResponse, ManagerTodayResponse, NotificationsResource } from 'kaafil-js/client';
|
|
2
|
+
import { h as ErrorClassification, D as DomainHookResult } from './useVendors-DXOuZWhZ.cjs';
|
|
3
|
+
|
|
4
|
+
/** The live half of `PartyDeltaRow` — this hook never sends `since`, so no
|
|
5
|
+
* tombstone member is ever returned; see this file's header. */
|
|
6
|
+
type PartyRow = Exclude<PartyDeltaRow, {
|
|
7
|
+
readonly _tombstone: true;
|
|
8
|
+
}>;
|
|
9
|
+
/** One row of `travellers.listForTrip()` — the trip's manifest, the search
|
|
10
|
+
* space `PartyEditor`'s member picker filters client-side. See this file's
|
|
11
|
+
* header for why this is not a `q`-parameterised search. */
|
|
12
|
+
type PartiesTripRosterRow = Awaited<ReturnType<TravellersResource['listForTrip']>>[number];
|
|
13
|
+
type AddPartyInput = Omit<AddPartyOptions, 'tripRef' | 'idempotencyKey' | 'signal'>;
|
|
14
|
+
type PatchPartyInput = Omit<PatchPartyOptions, 'tripRef' | 'signal'>;
|
|
15
|
+
type RemovePartyInput = Omit<RemovePartyOptions, 'tripRef' | 'idempotencyKey' | 'signal'>;
|
|
16
|
+
/** The live-fetched party list — see this file's header for why this is a
|
|
17
|
+
* live read rather than a snapshot subscription. Same `loaded`/
|
|
18
|
+
* `lastFetchFailed`/`fetchedAt`/`refresh` contract `RoomingUnassignedPool`
|
|
19
|
+
* and `TrekBoardState` already establish for this shape. */
|
|
20
|
+
interface PartiesListState {
|
|
21
|
+
readonly rows: readonly PartyRow[];
|
|
22
|
+
readonly loaded: boolean;
|
|
23
|
+
readonly lastFetchFailed: boolean;
|
|
24
|
+
readonly fetchedAt: string | undefined;
|
|
25
|
+
readonly refresh: () => Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
/** The trip's traveller manifest — the member picker's search space. */
|
|
28
|
+
interface PartiesTripRosterState {
|
|
29
|
+
readonly rows: readonly PartiesTripRosterRow[];
|
|
30
|
+
readonly loaded: boolean;
|
|
31
|
+
readonly lastFetchFailed: boolean;
|
|
32
|
+
readonly fetchedAt: string | undefined;
|
|
33
|
+
readonly refresh: () => Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
interface PartiesReady {
|
|
36
|
+
readonly list: PartiesListState;
|
|
37
|
+
readonly tripRoster: PartiesTripRosterState;
|
|
38
|
+
readonly add: (input: AddPartyInput) => Promise<OutboxOp>;
|
|
39
|
+
readonly patch: (input: PatchPartyInput) => Promise<OutboxOp>;
|
|
40
|
+
readonly remove: (input: RemovePartyInput) => Promise<OutboxOp>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* `parties` has no capability triple to resolve, so this union carries no
|
|
44
|
+
* `'dark'` member (contrast `DomainHookResult`, `../types/domain.types.ts`,
|
|
45
|
+
* which every OTHER §3 domain hook returns). `'loading'` covers the window
|
|
46
|
+
* before the first `list` fetch settles; `'error'` is reserved for that
|
|
47
|
+
* first fetch failing outright (a later `refresh()` failure instead flips
|
|
48
|
+
* `list.lastFetchFailed`/`tripRoster.lastFetchFailed`, matching the "loaded
|
|
49
|
+
* once, stay usable" contract those two states already carry elsewhere in
|
|
50
|
+
* this package).
|
|
51
|
+
*/
|
|
52
|
+
type PartiesResult = {
|
|
53
|
+
readonly status: 'loading';
|
|
54
|
+
} | ({
|
|
55
|
+
readonly status: 'ready';
|
|
56
|
+
} & PartiesReady) | {
|
|
57
|
+
readonly status: 'error';
|
|
58
|
+
readonly error: ErrorClassification;
|
|
59
|
+
/** Re-runs the failed initial fetch — a composite's only retry
|
|
60
|
+
* affordance while `status` is `'error'` (there is no `list.refresh`
|
|
61
|
+
* to reach for yet, since the `'ready'` branch hasn't happened). */
|
|
62
|
+
readonly retry: () => Promise<void>;
|
|
63
|
+
};
|
|
64
|
+
declare function useParties(tripRef: string): PartiesResult;
|
|
65
|
+
|
|
66
|
+
type CreateStopInput = Omit<CreatePickupStopOptions, 'tripRef' | 'idempotencyKey' | 'signal'>;
|
|
67
|
+
type PatchStopInput = Omit<PatchPickupStopOptions, 'tripRef' | 'signal'>;
|
|
68
|
+
type RemoveStopInput = Omit<DeletePickupStopOptions, 'tripRef' | 'signal'>;
|
|
69
|
+
type ReorderStopsInput = Omit<ReorderPickupStopsOptions, 'tripRef' | 'idempotencyKey' | 'signal'>;
|
|
70
|
+
type AssignInput$1 = Omit<AssignPickupTravellerOptions, 'tripRef' | 'idempotencyKey' | 'signal'>;
|
|
71
|
+
/** Derived off the resource method, not imported — see this file's header. */
|
|
72
|
+
type ReassignInput = Omit<Parameters<PickupsResource['reassign']>[0], 'tripRef' | 'idempotencyKey' | 'signal'>;
|
|
73
|
+
type BoardInput = Omit<BoardPickupTravellerOptions, 'tripRef' | 'idempotencyKey' | 'signal'>;
|
|
74
|
+
type CorrectBoardStatusInput = Omit<CorrectPickupBoardStatusOptions, 'tripRef' | 'signal'>;
|
|
75
|
+
type CloseStopInput = Omit<ClosePickupStopOptions, 'tripRef' | 'idempotencyKey' | 'signal'>;
|
|
76
|
+
type ReopenStopInput = Omit<ReopenPickupStopOptions, 'tripRef' | 'idempotencyKey' | 'signal'>;
|
|
77
|
+
type ManifestInput = Omit<ReadManifestByPickupOptions, 'tripRef' | 'signal'>;
|
|
78
|
+
/** `Awaited<ReturnType<...>>` off the resource method — `ManifestByPickup
|
|
79
|
+
* Response`/`ReassignResponse`/`BoardResponse`/`AssignResponse`/
|
|
80
|
+
* `CloseResponse`/`ReopenResponse` are not individually re-exported by name
|
|
81
|
+
* from `kaafil-js/client`'s public surface (only the nine `*Options` input
|
|
82
|
+
* types and `PickupStopDeltaRow` are — verified), so every result type below
|
|
83
|
+
* is derived structurally off `PickupsResource`, the one type that IS
|
|
84
|
+
* exported, rather than invented or widened to `unknown`. */
|
|
85
|
+
type PickupManifestResult = Awaited<ReturnType<PickupsResource['manifestByPickup']>>;
|
|
86
|
+
type PickupReassignResult = Awaited<ReturnType<PickupsResource['reassign']>>;
|
|
87
|
+
interface PickupsReady {
|
|
88
|
+
readonly stops: readonly PickupStopDeltaRow[];
|
|
89
|
+
readonly syncedAt: string | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Re-reads the live lane after a write. A NO-OP on a field device, where
|
|
92
|
+
* the outbox drain already emits `snapshot.updated` and the cache-first
|
|
93
|
+
* read re-renders itself — calling it there costs nothing and means a
|
|
94
|
+
* composite does not have to know which lane it is on.
|
|
95
|
+
*/
|
|
96
|
+
readonly refreshLive: () => Promise<void>;
|
|
97
|
+
readonly create: (input: CreateStopInput) => Promise<OutboxOp | null>;
|
|
98
|
+
readonly patch: (input: PatchStopInput) => Promise<OutboxOp | null>;
|
|
99
|
+
readonly remove: (input: RemoveStopInput) => Promise<OutboxOp | null>;
|
|
100
|
+
readonly reorder: (input: ReorderStopsInput) => Promise<OutboxOp | null>;
|
|
101
|
+
readonly assign: (input: AssignInput$1) => Promise<OutboxOp | null>;
|
|
102
|
+
/** `pickups.reassign` — moves every live, not-yet-boarded traveller off
|
|
103
|
+
* one stop onto a sibling stop of the same kind in one call
|
|
104
|
+
* (`FRD §8`'s "delete a stop with travellers on it" flow). Not enqueued
|
|
105
|
+
* through the outbox like the other writes here — its response
|
|
106
|
+
* (`movedCount`/`skippedBoardedCount`/both rebased stops) is needed
|
|
107
|
+
* synchronously by the calling composite to render the outcome, the same
|
|
108
|
+
* `autoAssign`-shaped exception `useRooming.ts`'s header documents. */
|
|
109
|
+
readonly reassign: (input: ReassignInput) => Promise<PickupReassignResult>;
|
|
110
|
+
/** Manager-only origination — an eyewitness statement
|
|
111
|
+
* (`06-capability-and-personas.md §7`'s canonical `✏️` case). */
|
|
112
|
+
readonly board: (input: BoardInput) => Promise<OutboxOp>;
|
|
113
|
+
/** manager/apiKey/agencyAdmin correction of an existing board record —
|
|
114
|
+
* never a relaxed version of `board`, and refused
|
|
115
|
+
* `422 pickups.correctionRequiresObservation` on a still-`PENDING` row.
|
|
116
|
+
* Not `If-Match`-guarded on the wire (`pickups.ts`'s own doc comment) —
|
|
117
|
+
* no `version`/`ifMatch` on this input, unlike the other stop writes. */
|
|
118
|
+
readonly correctBoardStatus: (input: CorrectBoardStatusInput) => Promise<OutboxOp | null>;
|
|
119
|
+
readonly close: (input: CloseStopInput) => Promise<OutboxOp>;
|
|
120
|
+
readonly reopen: (input: ReopenStopInput) => Promise<OutboxOp>;
|
|
121
|
+
/** Live read, not cache-first — see this file's header. */
|
|
122
|
+
readonly manifestByPickup: (input?: ManifestInput) => Promise<PickupManifestResult>;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* PERSONALIZED mode-dark. Returns `{ status: 'dark', reason }` before any
|
|
126
|
+
* fetch when the `'pickup-points'` capability triple isn't `lit`
|
|
127
|
+
* (`06-capability-and-personas.md §3`).
|
|
128
|
+
*/
|
|
129
|
+
declare function usePickups(tripRef: string): DomainHookResult<PickupsReady>;
|
|
130
|
+
|
|
131
|
+
type AssignInput = Omit<AssignSeatingOptions, 'tripRef' | 'idempotencyKey' | 'signal'>;
|
|
132
|
+
type AutoAssignInput = Omit<AutoAssignSeatingOptions, 'tripRef' | 'idempotencyKey' | 'signal'>;
|
|
133
|
+
type CreateVehicleInput = Omit<CreateSeatingVehicleOptions, 'tripRef' | 'idempotencyKey' | 'signal'>;
|
|
134
|
+
type PatchVehicleInput = Omit<PatchSeatingVehicleOptions, 'tripRef' | 'signal'>;
|
|
135
|
+
type RemoveVehicleInput = Omit<DeleteSeatingVehicleOptions, 'tripRef' | 'signal'>;
|
|
136
|
+
type LinkManagerInput = Omit<LinkSeatingManagerOptions, 'tripRef' | 'idempotencyKey' | 'signal'>;
|
|
137
|
+
type UnlinkManagerInput = Omit<UnlinkSeatingManagerOptions, 'tripRef' | 'signal'>;
|
|
138
|
+
/**
|
|
139
|
+
* The unassigned-traveller roster — `SeatingBoardResponse.unassignedPool[]`
|
|
140
|
+
* (`kaafil-js/openapi/openapi.json`, verified). See this file's header for
|
|
141
|
+
* why it is its own live-fetch state rather than folded into `vehicles`.
|
|
142
|
+
*/
|
|
143
|
+
interface SeatingUnassignedPool {
|
|
144
|
+
readonly travellers: readonly SeatingOccupant[];
|
|
145
|
+
/** `true` once at least one `client.seating.read()` call has settled
|
|
146
|
+
* (success or failure). */
|
|
147
|
+
readonly loaded: boolean;
|
|
148
|
+
/** `true` when the MOST RECENT fetch threw — rendered differently from
|
|
149
|
+
* `travellers: [], loaded: true`; those are never the same state. */
|
|
150
|
+
readonly lastFetchFailed: boolean;
|
|
151
|
+
/** The server time (`meta.serverTime`) of the last successful fetch. */
|
|
152
|
+
readonly fetchedAt: string | undefined;
|
|
153
|
+
/** Re-runs the live read. `assign` already calls this on its own
|
|
154
|
+
* success; a composite calls it again after any other action that can
|
|
155
|
+
* move someone in or out of the pool (e.g. a vehicle delete releasing
|
|
156
|
+
* its occupants). */
|
|
157
|
+
readonly refresh: () => Promise<void>;
|
|
158
|
+
}
|
|
159
|
+
interface SeatingReady {
|
|
160
|
+
readonly vehicles: readonly SeatingVehicleDeltaRow[];
|
|
161
|
+
readonly syncedAt: string | undefined;
|
|
162
|
+
readonly unassignedPool: SeatingUnassignedPool;
|
|
163
|
+
/** Re-reads the desk lane after a write. A NO-OP on a field device, where
|
|
164
|
+
* the outbox drain emits `snapshot.updated` and the cache-first read
|
|
165
|
+
* re-renders itself — a composite need not know which lane it is on. */
|
|
166
|
+
readonly refreshLive: () => Promise<void>;
|
|
167
|
+
readonly assign: (input: AssignInput) => Promise<OutboxOp | null>;
|
|
168
|
+
readonly autoAssign: (input: AutoAssignInput) => ReturnType<SeatingResource['autoAssign']>;
|
|
169
|
+
readonly createVehicle: (input: CreateVehicleInput) => Promise<OutboxOp | null>;
|
|
170
|
+
readonly patchVehicle: (input: PatchVehicleInput) => Promise<OutboxOp | null>;
|
|
171
|
+
readonly removeVehicle: (input: RemoveVehicleInput) => Promise<OutboxOp | null>;
|
|
172
|
+
/** The one day-coverage write this hook exposes — a whole-array replace,
|
|
173
|
+
* never a per-day CRUD method. See this file's header `DECISION` for why
|
|
174
|
+
* this takes no `version` parameter. */
|
|
175
|
+
readonly patchVehicleDays: (vehicleRef: string, days: readonly number[]) => Promise<OutboxOp | null>;
|
|
176
|
+
readonly linkManager: (input: LinkManagerInput) => Promise<OutboxOp | null>;
|
|
177
|
+
readonly unlinkManager: (input: UnlinkManagerInput) => Promise<OutboxOp | null>;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* PERSONALIZED mode-dark. Returns `{ status: 'dark', reason }` before any
|
|
181
|
+
* fetch when the `'transport-seating'` capability triple isn't `lit`
|
|
182
|
+
* (`06-capability-and-personas.md §3`).
|
|
183
|
+
*/
|
|
184
|
+
declare function useSeating(tripRef: string): DomainHookResult<SeatingReady>;
|
|
185
|
+
|
|
186
|
+
type CloseoutGetResult = Awaited<ReturnType<CloseoutResource['get']>>;
|
|
187
|
+
/** The whole closing-day aggregate, verbatim off the wire
|
|
188
|
+
* (`CloseoutAggregateResponse`, `kaafil-js/src/generated/schema.d.ts`) plus
|
|
189
|
+
* the envelope's own `meta`. Indexed-access off the real SDK return type
|
|
190
|
+
* rather than restated, per this file's own convention (`useItinerary.ts`'s
|
|
191
|
+
* `ItineraryReadResult`, `useRooming.ts`'s `RoomingStayWindowRow`). */
|
|
192
|
+
type CloseoutAggregate = CloseoutGetResult;
|
|
193
|
+
/** One row of `CloseoutAggregate['blockers']` — what is still open, and
|
|
194
|
+
* which screen clears it (`actionKey`). The inventory is closed at eleven
|
|
195
|
+
* keys; a twelfth is a spec change, not a release. */
|
|
196
|
+
type CloseoutBlockerRow = CloseoutAggregate['blockers'][number];
|
|
197
|
+
type SaveCloseoutHandoverInput = Omit<SaveCloseoutHandoverOptions, 'tripRef' | 'idempotencyKey' | 'signal'>;
|
|
198
|
+
type LockCloseoutInput = Omit<LockCloseoutOptions, 'tripRef' | 'idempotencyKey' | 'signal'>;
|
|
199
|
+
type UnlockCloseoutInput = Omit<UnlockCloseoutOptions, 'tripRef' | 'idempotencyKey' | 'signal'>;
|
|
200
|
+
type ExportCloseoutPackInput = Omit<ExportCloseoutPackOptions, 'tripRef' | 'signal'>;
|
|
201
|
+
interface CloseoutReady {
|
|
202
|
+
/** `undefined` until the first `closeout.get()` has settled — never a
|
|
203
|
+
* fabricated empty aggregate (`RoomingReady.unassignedPool`'s own
|
|
204
|
+
* discipline, applied here). */
|
|
205
|
+
readonly aggregate: CloseoutAggregate | undefined;
|
|
206
|
+
/** `true` once the first `closeout.get()` has settled (success or
|
|
207
|
+
* failure) — distinguishes "never fetched yet" from "fetched, and this
|
|
208
|
+
* trip is genuinely clean" (`ItineraryReady.loaded`'s own contract). */
|
|
209
|
+
readonly loaded: boolean;
|
|
210
|
+
/** `true` when the MOST RECENT fetch threw. `loaded`/`aggregate` stay
|
|
211
|
+
* whatever they already were; only this flips (mirrors
|
|
212
|
+
* `RoomingReady.unassignedPool.lastFetchFailed`). */
|
|
213
|
+
readonly lastFetchFailed: boolean;
|
|
214
|
+
readonly syncedAt: string | undefined;
|
|
215
|
+
/** Re-runs the live read. Every write below already calls this on its own
|
|
216
|
+
* success (`recordChangedSince`'s own header note: a write's response is
|
|
217
|
+
* already the freshest possible aggregate, but `refresh()` still exists
|
|
218
|
+
* for a caller that wants to re-poll independently of a write, e.g. after
|
|
219
|
+
* a deep-linked blocker screen clears one elsewhere). */
|
|
220
|
+
readonly refresh: () => Promise<void>;
|
|
221
|
+
/** `expectedVersion` REQUIRED (`SaveCloseoutHandoverRequest`) — read it
|
|
222
|
+
* off `aggregate.handover.version`. A stale one is answered `409
|
|
223
|
+
* CONFLICT_VERSION`. Not offline-queued — see this file's header. */
|
|
224
|
+
readonly saveHandover: (input: SaveCloseoutHandoverInput) => Promise<CloseoutAggregate>;
|
|
225
|
+
/** `expectedVersion` optional — `canLock` is re-derived inside the request
|
|
226
|
+
* regardless, so a stale client-side `true` never wins. Not
|
|
227
|
+
* offline-queued — see this file's header. */
|
|
228
|
+
readonly lock: (input?: LockCloseoutInput) => Promise<CloseoutAggregate>;
|
|
229
|
+
/** `apiKeyAuth`-only on the wire — see this file's header. Calling it from
|
|
230
|
+
* any browser persona this hook serves throws `UnsatisfiableSchemeError`
|
|
231
|
+
* before any request is sent. No composite in this build calls it. */
|
|
232
|
+
readonly unlock: (input: UnlockCloseoutInput) => Promise<CloseoutAggregate>;
|
|
233
|
+
/** Returns bytes, not an envelope — see `CloseoutResource.exportPdf`'s own
|
|
234
|
+
* doc comment. No composite in this build's `closing-day` module calls
|
|
235
|
+
* this (`04-closing-day.md §ClosingDayScreen`'s own `Does NOT`). */
|
|
236
|
+
readonly exportPdf: (input?: ExportCloseoutPackInput) => Promise<KaafilBinaryResponse>;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* PERSONALIZED mode-dark. Returns `{ status: 'dark', reason }` before any
|
|
240
|
+
* fetch when the `'closing-day'` capability triple isn't `lit`
|
|
241
|
+
* (`04-closing-day.md`'s own `Gating`). `manager`/`agencyAdmin` both call
|
|
242
|
+
* this same hook — the spec's `COORDINATOR`-role read-only resolution
|
|
243
|
+
* happens on the open session server-side, never as a UIKit prop or a
|
|
244
|
+
* second hook (`useItinerary.ts`'s identical note for its own module).
|
|
245
|
+
*/
|
|
246
|
+
declare function useCloseout(tripRef: string): DomainHookResult<CloseoutReady>;
|
|
247
|
+
|
|
248
|
+
/** `useStaleness()`'s return shape (`08-core-hooks.md §2.4`). */
|
|
249
|
+
interface StalenessState {
|
|
250
|
+
readonly syncedAt: string | undefined;
|
|
251
|
+
readonly ageSeconds: number | undefined;
|
|
252
|
+
readonly isStale: boolean;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* One entry of `useConflicts()`'s `conflicts` array (`08-core-hooks.md
|
|
256
|
+
* §2.7`). `queuedValue` is the parked op's own queued body; `currentValue`
|
|
257
|
+
* is the fresh server row the reconciler already wrote back into the
|
|
258
|
+
* snapshot before parking (`kaafil-js/src/offline/reconcile.ts`, verified) —
|
|
259
|
+
* this hook reads it from there rather than the park record itself, which
|
|
260
|
+
* carries no row, only `{ status, code, userMessage }`
|
|
261
|
+
* (`kaafil-js/src/offline/outbox.ts`'s `OutboxParkReason`, verified).
|
|
262
|
+
*/
|
|
263
|
+
interface ConflictRecord {
|
|
264
|
+
readonly opId: string;
|
|
265
|
+
readonly entity: string;
|
|
266
|
+
readonly queuedValue: unknown;
|
|
267
|
+
readonly currentValue: unknown;
|
|
268
|
+
}
|
|
269
|
+
/** `useOutboxStatus()`'s return shape (`08-core-hooks.md §2.9`). */
|
|
270
|
+
interface OutboxState {
|
|
271
|
+
readonly pending: number;
|
|
272
|
+
readonly parked: number;
|
|
273
|
+
readonly lanes: readonly string[];
|
|
274
|
+
readonly isOnline: boolean;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* The six-event map `useOfflineEvent()` is typed over (`08-core-hooks.md
|
|
278
|
+
* §2.6`), verified against `kaafil-js/src/offline/events.ts`'s
|
|
279
|
+
* `OfflineEventMap` this session — exactly these six, no more, no fewer.
|
|
280
|
+
*/
|
|
281
|
+
type SyncEventKind = 'sync.drained' | 'sync.error' | 'session.expired' | 'share.expired' | 'share.revoked' | 'snapshot.updated';
|
|
282
|
+
|
|
283
|
+
interface ManagerMeLoading {
|
|
284
|
+
readonly status: 'loading';
|
|
285
|
+
}
|
|
286
|
+
interface ManagerMeError {
|
|
287
|
+
readonly status: 'error';
|
|
288
|
+
}
|
|
289
|
+
interface ManagerMeReady extends ManagerOwnTripsResponse {
|
|
290
|
+
readonly status: 'ready';
|
|
291
|
+
/** The server timestamp this read landed with (`meta.serverTime`) — never
|
|
292
|
+
* a local clock read (hard rule #6). */
|
|
293
|
+
readonly syncedAt: string;
|
|
294
|
+
}
|
|
295
|
+
type ManagerMeResult = ManagerMeLoading | ManagerMeError | ManagerMeReady;
|
|
296
|
+
/**
|
|
297
|
+
* `client.managerMe.listTrips()` behind a plain fetch-on-mount effect —
|
|
298
|
+
* this read takes no parameter (it resolves entirely off the authenticated
|
|
299
|
+
* principal, `manager-me.routes.ts`'s own header, cited), so it never
|
|
300
|
+
* re-fetches on a prop change the way `useManagerToday(tripRef)` does.
|
|
301
|
+
* A caller wanting "refresh now" re-mounts this hook's owning component.
|
|
302
|
+
*/
|
|
303
|
+
declare function useManagerMe(): ManagerMeResult;
|
|
304
|
+
|
|
305
|
+
interface ManagerTodayLoading {
|
|
306
|
+
readonly status: 'loading';
|
|
307
|
+
}
|
|
308
|
+
interface ManagerTodayError {
|
|
309
|
+
readonly status: 'error';
|
|
310
|
+
}
|
|
311
|
+
type ManagerTodayReady = ManagerTodayResponse & {
|
|
312
|
+
readonly status: 'ready';
|
|
313
|
+
/** The server timestamp this read landed with (`meta.serverTime`) —
|
|
314
|
+
* never a local clock read (hard rule #6). */
|
|
315
|
+
readonly syncedAt: string;
|
|
316
|
+
};
|
|
317
|
+
type ManagerTodayResult = ManagerTodayLoading | ManagerTodayError | ManagerTodayReady;
|
|
318
|
+
/**
|
|
319
|
+
* `client.managerToday.read({ tripRef })` behind a plain fetch-on-mount/
|
|
320
|
+
* fetch-on-`tripRef`-change effect. Re-fetches whenever `tripRef` changes;
|
|
321
|
+
* never re-fetches on an interval or a focus event of its own — a caller
|
|
322
|
+
* that wants "refresh now" re-mounts this hook's owning component or (once
|
|
323
|
+
* this hook grows one) calls a future `refresh()` return field.
|
|
324
|
+
*/
|
|
325
|
+
declare function useManagerToday(tripRef: string): ManagerTodayResult;
|
|
326
|
+
|
|
327
|
+
type NotificationListResponse = Awaited<ReturnType<NotificationsResource['list']>>;
|
|
328
|
+
type NotificationListItem = NotificationListResponse['items'][number];
|
|
329
|
+
/** The live-row half of `NotificationListItem`'s union — a tombstone never
|
|
330
|
+
* reaches a caller of this hook (see this file's own header). */
|
|
331
|
+
type ManagerNotification = Exclude<NotificationListItem, {
|
|
332
|
+
_tombstone: true;
|
|
333
|
+
}>;
|
|
334
|
+
interface NotificationsLoading {
|
|
335
|
+
readonly status: 'loading';
|
|
336
|
+
}
|
|
337
|
+
interface NotificationsError {
|
|
338
|
+
readonly status: 'error';
|
|
339
|
+
}
|
|
340
|
+
interface NotificationsReady {
|
|
341
|
+
readonly status: 'ready';
|
|
342
|
+
readonly notifications: readonly ManagerNotification[];
|
|
343
|
+
/** `notifications.filter((n) => n.readAt === null).length` — the wire
|
|
344
|
+
* carries no numeric unread field of its own (verified against
|
|
345
|
+
* `NotificationListResponse`), so this is a real derivation off real
|
|
346
|
+
* rows, never a fabricated count. */
|
|
347
|
+
readonly unreadCount: number;
|
|
348
|
+
readonly markRead: (id: string) => Promise<void>;
|
|
349
|
+
/** The server timestamp this read landed with (`meta.serverTime`) —
|
|
350
|
+
* never a local clock read (hard rule #6). */
|
|
351
|
+
readonly syncedAt: string;
|
|
352
|
+
}
|
|
353
|
+
type NotificationsResult = NotificationsLoading | NotificationsError | NotificationsReady;
|
|
354
|
+
declare function useNotifications(): NotificationsResult;
|
|
355
|
+
|
|
356
|
+
export { type ConflictRecord as C, type ManagerMeReady as M, type NotificationsReady as N, type OutboxState as O, type PartiesReady as P, type StalenessState as S, type CloseoutReady as a, type ManagerMeResult as b, type ManagerNotification as c, type ManagerTodayReady as d, type ManagerTodayResult as e, type NotificationsResult as f, type PickupsReady as g, type SeatingReady as h, type SyncEventKind as i, useManagerMe as j, useManagerToday as k, useNotifications as l, useParties as m, usePickups as n, useSeating as o, type CloseoutBlockerRow as p, type PickupManifestResult as q, type CloseoutAggregate as r, type PartiesTripRosterRow as s, useCloseout as u };
|