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,454 @@
|
|
|
1
|
+
import { KaafilClient, AgencyManagersResource, TravellersResource, AgencyManagerFilters, TravellerDirectoryFilters, TripManagersResource, PartyKind, TripPartiesResource, AgencyTripsResource, AgencyTripFilters, AgencyTripSegmentCounts, TripManifestFilters, TripManifestFacets, CollectionsResource, ListEligibleCollectionsOptions, RecordCollectionOptions, OutboxOp, VoidCollectionOptions } from 'kaafil-js/client';
|
|
2
|
+
import { H as CreateAgencyChecklistTemplateInput, P as PatchAgencyChecklistTemplateInput, J as RemoveAgencyChecklistTemplateInput, K as PublishAgencyChecklistTemplateInput, D as DomainHookResult } from './useVendors-DXOuZWhZ.js';
|
|
3
|
+
|
|
4
|
+
type BoundAgencySettings = KaafilClient['agencies']['settings'];
|
|
5
|
+
/** `AgencySettingsResponse` — never imported by name, derived off the one
|
|
6
|
+
* exported anchor (`useAgencyJourneyTriggers.ts`'s own convention). */
|
|
7
|
+
type AgencySettingsDocument = Awaited<ReturnType<BoundAgencySettings['get']>>;
|
|
8
|
+
type PatchAgencySettingsInput = Omit<Parameters<BoundAgencySettings['patch']>[0], 'signal'>;
|
|
9
|
+
interface AgencySettingsReady {
|
|
10
|
+
readonly document: AgencySettingsDocument | undefined;
|
|
11
|
+
readonly loaded: boolean;
|
|
12
|
+
readonly lastFetchFailed: boolean;
|
|
13
|
+
readonly refresh: () => Promise<void>;
|
|
14
|
+
readonly patchSettings: (input: PatchAgencySettingsInput) => Promise<AgencySettingsDocument>;
|
|
15
|
+
}
|
|
16
|
+
declare function useAgencySettings(): AgencySettingsReady;
|
|
17
|
+
|
|
18
|
+
type BoundAgencyChecklistTemplates = KaafilClient['checklists']['agencyTemplates'];
|
|
19
|
+
/** `ChecklistTemplateSectionResponse` (`kaafil-js/src/generated
|
|
20
|
+
* /schema.d.ts`) — never imported by name, the same "derive off the one
|
|
21
|
+
* exported anchor" discipline `useChecklists.ts` itself documents for this
|
|
22
|
+
* exact resource. */
|
|
23
|
+
type ChecklistTemplateRow = Awaited<ReturnType<BoundAgencyChecklistTemplates['list']>>['templates'][number];
|
|
24
|
+
type ChecklistTemplateItemRow = ChecklistTemplateRow['items'][number];
|
|
25
|
+
interface AgencyChecklistTemplatesReady {
|
|
26
|
+
readonly templates: readonly ChecklistTemplateRow[];
|
|
27
|
+
/** `true` once at least one `list()` call has settled (success or
|
|
28
|
+
* failure) — same `loaded` contract every other agency-wide list hook
|
|
29
|
+
* this package ships already uses. */
|
|
30
|
+
readonly loaded: boolean;
|
|
31
|
+
/** `true` when the MOST RECENT fetch threw. */
|
|
32
|
+
readonly lastFetchFailed: boolean;
|
|
33
|
+
readonly refresh: () => Promise<void>;
|
|
34
|
+
readonly createTemplate: (input: CreateAgencyChecklistTemplateInput) => Promise<ChecklistTemplateRow>;
|
|
35
|
+
readonly patchTemplate: (input: PatchAgencyChecklistTemplateInput) => Promise<ChecklistTemplateRow>;
|
|
36
|
+
readonly removeTemplate: (input: RemoveAgencyChecklistTemplateInput) => Promise<void>;
|
|
37
|
+
readonly publishTemplate: (input: PublishAgencyChecklistTemplateInput) => Promise<ChecklistTemplateRow>;
|
|
38
|
+
}
|
|
39
|
+
declare function useAgencyChecklistTemplates(): AgencyChecklistTemplatesReady;
|
|
40
|
+
|
|
41
|
+
type BoundForms = KaafilClient['forms'];
|
|
42
|
+
/** `FormListResponse.items[]` — the agency's whole catalog (metadata only,
|
|
43
|
+
* no sections/fields). */
|
|
44
|
+
type FormRow = Awaited<ReturnType<BoundForms['list']>>['items'][number];
|
|
45
|
+
/** `FormDetailResponse` — one form's full definition: metadata + sections +
|
|
46
|
+
* fields. `FormBuilder`'s own read. */
|
|
47
|
+
type FormDetailRow = Awaited<ReturnType<BoundForms['get']>>;
|
|
48
|
+
/** The patch-transition family's own return shape (`FormDefinitionResponse`
|
|
49
|
+
* — metadata only, no `sections`/`fields`) — `patch`/`archive`/`unarchive`/
|
|
50
|
+
* `publish`/`close`/`reopen`/`clone` all answer this, distinct from
|
|
51
|
+
* `FormDetailRow`, which only `get`/`create` return. */
|
|
52
|
+
type FormSummaryRow = Awaited<ReturnType<BoundForms['patch']>>;
|
|
53
|
+
type FormSectionRow = FormDetailRow['sections'][number];
|
|
54
|
+
type FormFieldRow = FormDetailRow['fields'][number];
|
|
55
|
+
/** `GET /api/v1/forms/bindings` row — the closed profile/CRM-key catalog a
|
|
56
|
+
* field's `binding` may target. */
|
|
57
|
+
type BindingRow = Awaited<ReturnType<BoundForms['bindings']['list']>>['items'][number];
|
|
58
|
+
type CreateFormInput = Omit<Parameters<BoundForms['create']>[0], 'idempotencyKey' | 'signal'>;
|
|
59
|
+
type PatchFormInput = Omit<Parameters<BoundForms['patch']>[0], 'signal'>;
|
|
60
|
+
type DeleteFormInput = Omit<Parameters<BoundForms['delete']>[0], 'signal'>;
|
|
61
|
+
type CloneFormInput = Omit<Parameters<BoundForms['clone']>[0], 'idempotencyKey' | 'signal'>;
|
|
62
|
+
type ReorderFormInput = Omit<Parameters<BoundForms['reorder']>[0], 'signal'>;
|
|
63
|
+
type CreateFormSectionInput = Omit<Parameters<BoundForms['sections']['create']>[0], 'signal'>;
|
|
64
|
+
type PatchFormSectionInput = Omit<Parameters<BoundForms['sections']['patch']>[0], 'signal'>;
|
|
65
|
+
type DeleteFormSectionInput = Omit<Parameters<BoundForms['sections']['delete']>[0], 'signal'>;
|
|
66
|
+
type CreateFormFieldInput = Omit<Parameters<BoundForms['fields']['create']>[0], 'signal'>;
|
|
67
|
+
type PatchFormFieldInput = Omit<Parameters<BoundForms['fields']['patch']>[0], 'signal'>;
|
|
68
|
+
type DeleteFormFieldInput = Omit<Parameters<BoundForms['fields']['delete']>[0], 'signal'>;
|
|
69
|
+
interface AgencyFormsReady {
|
|
70
|
+
readonly forms: readonly FormRow[];
|
|
71
|
+
/** `true` once at least one `list()` call has settled (success or
|
|
72
|
+
* failure). */
|
|
73
|
+
readonly loaded: boolean;
|
|
74
|
+
/** `true` when the MOST RECENT fetch threw. */
|
|
75
|
+
readonly lastFetchFailed: boolean;
|
|
76
|
+
readonly refresh: () => Promise<void>;
|
|
77
|
+
readonly createForm: (input: CreateFormInput) => Promise<FormDetailRow>;
|
|
78
|
+
/** Live read of one form's full definition — `FormBuilder`'s own load. */
|
|
79
|
+
readonly getForm: (formId: string) => Promise<FormDetailRow>;
|
|
80
|
+
readonly patchForm: (input: PatchFormInput) => Promise<FormSummaryRow>;
|
|
81
|
+
/** See this file's header — real, but UI-gated to `DRAFT` as a safety
|
|
82
|
+
* convention, not a wire restriction. */
|
|
83
|
+
readonly deleteForm: (input: DeleteFormInput) => Promise<void>;
|
|
84
|
+
readonly archiveForm: (formId: string) => Promise<FormSummaryRow>;
|
|
85
|
+
readonly unarchiveForm: (formId: string) => Promise<FormSummaryRow>;
|
|
86
|
+
readonly publishForm: (formId: string) => Promise<FormSummaryRow>;
|
|
87
|
+
readonly closeForm: (formId: string) => Promise<FormSummaryRow>;
|
|
88
|
+
readonly reopenForm: (formId: string) => Promise<FormSummaryRow>;
|
|
89
|
+
readonly cloneForm: (input: CloneFormInput) => Promise<FormSummaryRow>;
|
|
90
|
+
/** One idempotent transaction over every section's and field's
|
|
91
|
+
* `sortOrder` — never one call per row. */
|
|
92
|
+
readonly reorderForm: (input: ReorderFormInput) => Promise<void>;
|
|
93
|
+
readonly createSection: (input: CreateFormSectionInput) => Promise<FormSectionRow>;
|
|
94
|
+
readonly patchSection: (input: PatchFormSectionInput) => Promise<FormSectionRow>;
|
|
95
|
+
readonly deleteSection: (input: DeleteFormSectionInput) => Promise<void>;
|
|
96
|
+
readonly createField: (input: CreateFormFieldInput) => Promise<FormFieldRow>;
|
|
97
|
+
readonly patchField: (input: PatchFormFieldInput) => Promise<FormFieldRow>;
|
|
98
|
+
readonly deleteField: (input: DeleteFormFieldInput) => Promise<void>;
|
|
99
|
+
readonly listBindings: () => Promise<readonly BindingRow[]>;
|
|
100
|
+
}
|
|
101
|
+
declare function useAgencyForms(): AgencyFormsReady;
|
|
102
|
+
|
|
103
|
+
interface PaginatedListFetchResult<TRow> {
|
|
104
|
+
readonly rows: readonly TRow[];
|
|
105
|
+
readonly nextCursor: string | undefined;
|
|
106
|
+
}
|
|
107
|
+
type PaginatedListFetch<TRow> = (cursor: string | undefined) => Promise<PaginatedListFetchResult<TRow>>;
|
|
108
|
+
interface PaginatedListOptions {
|
|
109
|
+
readonly pageSize?: number;
|
|
110
|
+
}
|
|
111
|
+
interface PaginatedListResult<TRow> {
|
|
112
|
+
readonly rows: readonly TRow[];
|
|
113
|
+
readonly hasNext: boolean;
|
|
114
|
+
readonly hasPrev: boolean;
|
|
115
|
+
readonly loadNext: () => Promise<void>;
|
|
116
|
+
readonly loadPrev: () => Promise<void>;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* `pageSize` (`08-core-hooks.md §4`'s `options?.pageSize`) is accepted for
|
|
120
|
+
* call-site parity with the documented signature; whether the SUPPLIED
|
|
121
|
+
* `fetch` function actually honours it as a page-size hint is up to the
|
|
122
|
+
* caller — this hook is domain-agnostic plumbing over `fetch`, never a
|
|
123
|
+
* binding to one resource group, and has no wire-level knowledge of any one
|
|
124
|
+
* endpoint's own page-size parameter name.
|
|
125
|
+
*/
|
|
126
|
+
declare function usePaginatedList<TRow>(fetch: PaginatedListFetch<TRow>, options?: PaginatedListOptions): PaginatedListResult<TRow>;
|
|
127
|
+
|
|
128
|
+
type ManagerListRowResponse = Awaited<ReturnType<AgencyManagersResource['listPage']>>[number];
|
|
129
|
+
type TravellerDirectoryItemResponse = Awaited<ReturnType<TravellersResource['listForAgencyPage']>>[number];
|
|
130
|
+
type TripManagerRowResponse = Awaited<ReturnType<TripManagersResource['patch']>>;
|
|
131
|
+
type TripManifestItemResponse = Awaited<ReturnType<TravellersResource['listForTrip']>>[number];
|
|
132
|
+
interface PromoteManagerInput {
|
|
133
|
+
readonly tripRef: string;
|
|
134
|
+
readonly managerRef: string;
|
|
135
|
+
/** The row's own `version` — `If-Match`, required (`trips.managers.patch`'s
|
|
136
|
+
* own doc comment: a missing or stale one are the same `409`). */
|
|
137
|
+
readonly version: number;
|
|
138
|
+
readonly role?: 'MANAGER' | 'COORDINATOR';
|
|
139
|
+
readonly isLead?: boolean;
|
|
140
|
+
}
|
|
141
|
+
/** Put an existing agency manager onto a trip.
|
|
142
|
+
*
|
|
143
|
+
* NO `sourceUpdatedAt`. The wire's `assignManager` takes one — it is a CRM's
|
|
144
|
+
* own last-changed instant, used to order concurrent writes last-writer-wins
|
|
145
|
+
* — and this pass made it OPTIONAL precisely so a desk need not send one. A
|
|
146
|
+
* desk has no such instant, and minting `new Date()` here would be a local
|
|
147
|
+
* clock deciding a conflict, which is the thing hard rule #6 keeps out of
|
|
148
|
+
* `/core`. Omitted, the server stamps the write itself. */
|
|
149
|
+
interface AssignManagerInput {
|
|
150
|
+
readonly tripRef: string;
|
|
151
|
+
/** Kaafil's id for the manager, or your own external ref — either
|
|
152
|
+
* resolves. Comes from `agencyManagers`, which this hook already lists. */
|
|
153
|
+
readonly managerRef: string;
|
|
154
|
+
readonly role?: 'MANAGER' | 'COORDINATOR';
|
|
155
|
+
/** `true` demotes whatever manager currently leads the trip, in the same
|
|
156
|
+
* transaction — at most one lead per trip, the server's rule. */
|
|
157
|
+
readonly isLead?: boolean;
|
|
158
|
+
}
|
|
159
|
+
interface UnassignManagerInput {
|
|
160
|
+
readonly tripRef: string;
|
|
161
|
+
readonly managerRef: string;
|
|
162
|
+
}
|
|
163
|
+
interface AddTravellerInput {
|
|
164
|
+
readonly tripRef: string;
|
|
165
|
+
/** Client-minted — this trip-manifest write (`pushManifest`) has no
|
|
166
|
+
* "omit to auto-mint" behaviour of its own, unlike the agency-directory
|
|
167
|
+
* `createAgencyTraveller` below. */
|
|
168
|
+
readonly externalTravellerId: string;
|
|
169
|
+
readonly fullName: string;
|
|
170
|
+
readonly phone?: string;
|
|
171
|
+
}
|
|
172
|
+
interface CreateAgencyTravellerInput {
|
|
173
|
+
readonly fullName: string;
|
|
174
|
+
readonly phone?: string;
|
|
175
|
+
readonly email?: string;
|
|
176
|
+
readonly locale?: string;
|
|
177
|
+
/** Omit to let the server mint `externalId: null` — real server-side
|
|
178
|
+
* behaviour (`GAP-008`, confirmed against the live `kaafil-engine`
|
|
179
|
+
* route), never a client-side id workaround. Supplying one that already
|
|
180
|
+
* resolves within this agency returns the existing row rather than
|
|
181
|
+
* erroring. */
|
|
182
|
+
readonly externalTravellerId?: string;
|
|
183
|
+
}
|
|
184
|
+
interface RemoveFromManifestInput {
|
|
185
|
+
readonly tripRef: string;
|
|
186
|
+
/** Kaafil's id for the traveller, or your own external id — either resolves. */
|
|
187
|
+
readonly travellerRef: string;
|
|
188
|
+
}
|
|
189
|
+
type PartyWriteResponse = Awaited<ReturnType<TripPartiesResource['patch']>>;
|
|
190
|
+
interface CreatePartyInput {
|
|
191
|
+
readonly tripRef: string;
|
|
192
|
+
readonly kind: PartyKind;
|
|
193
|
+
/** OPTIONAL, and deliberately not nullable — unlike `PatchPartyInput.label`.
|
|
194
|
+
* The wire lets a create omit a label but not send an explicit null, and it
|
|
195
|
+
* lets a patch CLEAR one; those are different operations and this pair
|
|
196
|
+
* mirrors the contract rather than flattening both to `string | null`. */
|
|
197
|
+
readonly label?: string;
|
|
198
|
+
/** Traveller refs — Kaafil ids or your own external ids. Creating a party
|
|
199
|
+
* PINS it (FRD §4.10.5): it stops being re-derived from shared contact
|
|
200
|
+
* details on the next manifest push. */
|
|
201
|
+
readonly travellerRefs: readonly string[];
|
|
202
|
+
}
|
|
203
|
+
interface PatchPartyInput {
|
|
204
|
+
readonly tripRef: string;
|
|
205
|
+
readonly partyId: string;
|
|
206
|
+
/** The PARTY row's version, from `trips.parties.list` or a manifest row's
|
|
207
|
+
* denormalised party. A stale one answers `409 CONFLICT_VERSION`, which the
|
|
208
|
+
* caller surfaces rather than retries blind. */
|
|
209
|
+
readonly version: number;
|
|
210
|
+
readonly kind?: PartyKind;
|
|
211
|
+
/** `null` CLEARS the label; omitting the key leaves it alone. */
|
|
212
|
+
readonly label?: string | null;
|
|
213
|
+
readonly travellerRefs?: readonly string[];
|
|
214
|
+
}
|
|
215
|
+
interface DeletePartyInput {
|
|
216
|
+
readonly tripRef: string;
|
|
217
|
+
readonly partyId: string;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* ── WHY A SECOND NOTE WRITE EXISTS, AND WHY IT IS NOT A DUPLICATE ──────────
|
|
221
|
+
*
|
|
222
|
+
* `useTravellerProfile().addNote` already wraps `travellers.addNote`. It
|
|
223
|
+
* enqueues through `useOfflineMutation`, which is right for the field — a
|
|
224
|
+
* manager writes a note standing in a car park — and which THROWS ("this
|
|
225
|
+
* write has nowhere to enqueue to yet") when no `OfflineShell` is mounted. A
|
|
226
|
+
* desk console mounts none, so that door is closed to this family.
|
|
227
|
+
*
|
|
228
|
+
* This is the same operation through the office door: awaited directly,
|
|
229
|
+
* classified on failure, retried by the caller. Exactly the split
|
|
230
|
+
* `promoteManager` and the party writes above already make, and the reason
|
|
231
|
+
* this file's "WRITES ARE DIRECT" section exists. The READ half is NOT
|
|
232
|
+
* duplicated — an admin surface uses `useTravellerProfile`'s own live
|
|
233
|
+
* `getDetail` read unchanged.
|
|
234
|
+
*
|
|
235
|
+
* Named `DirectNoteInput` rather than `AddTravellerNoteInput` so the two
|
|
236
|
+
* doors are distinguishable at a glance in the barrel.
|
|
237
|
+
*/
|
|
238
|
+
interface DirectNoteInput {
|
|
239
|
+
readonly tripRef: string;
|
|
240
|
+
readonly travellerRef: string;
|
|
241
|
+
readonly body: string;
|
|
242
|
+
}
|
|
243
|
+
interface DirectoriesReady {
|
|
244
|
+
/** One page-fetcher factory per instance of `ManagerDirectoryTable` — a
|
|
245
|
+
* fresh `usePaginatedList()` binding per distinct `filters` value (a
|
|
246
|
+
* caller remounts on a filter change, the same "reset paging on scope
|
|
247
|
+
* change" idiom `trip-manifest-panel.tsx`'s own `useEffect` documents). */
|
|
248
|
+
readonly makeManagersFetch: (filters: AgencyManagerFilters) => PaginatedListFetch<ManagerListRowResponse>;
|
|
249
|
+
/** Same shape, for `TravellerSearchBox` — `filters.q` is REQUIRED
|
|
250
|
+
* upstream (`TravellerDirectoryFilters`'s own type), so a caller must
|
|
251
|
+
* never invoke the returned fetch while `q` is under the 2-character
|
|
252
|
+
* floor (`travellers.listForAgency`'s own doc comment: a guaranteed `422`
|
|
253
|
+
* otherwise). */
|
|
254
|
+
readonly makeTravellersFetch: (filters: TravellerDirectoryFilters) => PaginatedListFetch<TravellerDirectoryItemResponse>;
|
|
255
|
+
/** `travellers.listForTrip` — the bounded, non-paginated manifest read
|
|
256
|
+
* `TripTravellerManifestTable` would use if it were not, per its own
|
|
257
|
+
* Offline note, a cache-first `useSnapshotList()` read instead; kept here
|
|
258
|
+
* for a caller that genuinely wants a live one-shot manifest fetch. */
|
|
259
|
+
readonly listTripManifest: (tripRef: string) => Promise<readonly TripManifestItemResponse[]>;
|
|
260
|
+
/** `trips.managers.patch` — role change and/or lead promotion/demotion.
|
|
261
|
+
* Throws `DirectoriesWriteError` on failure; see this file's header for
|
|
262
|
+
* why this is a direct call, not an outbox enqueue. */
|
|
263
|
+
readonly promoteManager: (input: PromoteManagerInput) => Promise<TripManagerRowResponse>;
|
|
264
|
+
/** `trips.managers.assign` — puts an existing agency manager on the trip.
|
|
265
|
+
* Both this and `unassignManager` were `apiKey`-only until this pass
|
|
266
|
+
* widened them, which is why the roster card had a promote control and no
|
|
267
|
+
* way to add anyone. Same direct-call posture as `promoteManager`. */
|
|
268
|
+
readonly assignManager: (input: AssignManagerInput) => Promise<void>;
|
|
269
|
+
/** `trips.managers.unassign` — a SOFT unlink, not a delete: the manager
|
|
270
|
+
* stays in the agency directory and can be re-assigned, which is why this
|
|
271
|
+
* needs no confirm-with-consequences dialog. */
|
|
272
|
+
readonly unassignManager: (input: UnassignManagerInput) => Promise<void>;
|
|
273
|
+
/** `trips.travellers.pushManifest`, single-traveller — resolves to the
|
|
274
|
+
* echoed `externalTravellerId` on `verdict: 'applied'`, matching
|
|
275
|
+
* `AddTravellerControl.onAdded`'s own contract. Throws
|
|
276
|
+
* `DirectoriesWriteError` (including a synthesized one for
|
|
277
|
+
* `verdict !== 'applied'`, which the wire never surfaces as an HTTP
|
|
278
|
+
* failure) otherwise. */
|
|
279
|
+
readonly addTraveller: (input: AddTravellerInput) => Promise<string>;
|
|
280
|
+
/**
|
|
281
|
+
* `trips.travellers.remove` — soft-removes a traveller's LINK to this trip.
|
|
282
|
+
* The traveller stays in the agency directory; only their place on this
|
|
283
|
+
* manifest goes.
|
|
284
|
+
*/
|
|
285
|
+
readonly removeFromManifest: (input: RemoveFromManifestInput) => Promise<void>;
|
|
286
|
+
/** `trips.parties.add` — a PINNED party (the manager override, FRD §4.10.5). */
|
|
287
|
+
readonly createParty: (input: CreatePartyInput) => Promise<PartyWriteResponse>;
|
|
288
|
+
/** `trips.parties.patch` — kind, label and/or membership. Also pins the party. */
|
|
289
|
+
readonly patchParty: (input: PatchPartyInput) => Promise<PartyWriteResponse>;
|
|
290
|
+
/** `trips.parties.remove` — retires a party. Its members become solo, which
|
|
291
|
+
* is the ABSENCE of a party rather than a party of one. */
|
|
292
|
+
readonly deleteParty: (input: DeletePartyInput) => Promise<void>;
|
|
293
|
+
/** `travellers.addNote` — appends to this traveller's note thread on this trip. */
|
|
294
|
+
readonly addTravellerNote: (input: DirectNoteInput) => Promise<void>;
|
|
295
|
+
/** `travellers.create` — the real, non-workaround agency-directory create
|
|
296
|
+
* (`GAP-008`, closed). Never trip-attached; a caller that needs "add this
|
|
297
|
+
* traveller to THIS trip's manifest" still wants `addTraveller` above.
|
|
298
|
+
* Throws `DirectoriesWriteError` on failure. */
|
|
299
|
+
readonly createAgencyTraveller: (input: CreateAgencyTravellerInput) => Promise<TravellerDirectoryItemResponse>;
|
|
300
|
+
}
|
|
301
|
+
declare function useDirectories(agencyRef?: string): DirectoriesReady;
|
|
302
|
+
|
|
303
|
+
type BoundJourneyTriggers = KaafilClient['journey']['triggers'];
|
|
304
|
+
/** `JourneyTriggerResponse` — one row of `GET /agencies/{ref}/journey-triggers`. */
|
|
305
|
+
type JourneyTriggerRow = Awaited<ReturnType<BoundJourneyTriggers['list']>>[number];
|
|
306
|
+
type PatchJourneyTriggerInput = Omit<Parameters<BoundJourneyTriggers['patch']>[0], 'idempotencyKey' | 'signal'>;
|
|
307
|
+
interface AgencyJourneyTriggersReady {
|
|
308
|
+
readonly triggers: readonly JourneyTriggerRow[];
|
|
309
|
+
/** `true` once at least one `list()` call has settled (success or failure). */
|
|
310
|
+
readonly loaded: boolean;
|
|
311
|
+
/** `true` when the MOST RECENT fetch threw. */
|
|
312
|
+
readonly lastFetchFailed: boolean;
|
|
313
|
+
readonly refresh: () => Promise<void>;
|
|
314
|
+
readonly patchTrigger: (input: PatchJourneyTriggerInput) => Promise<JourneyTriggerRow>;
|
|
315
|
+
}
|
|
316
|
+
declare function useAgencyJourneyTriggers(): AgencyJourneyTriggersReady;
|
|
317
|
+
|
|
318
|
+
type AgencyTripRow = Awaited<ReturnType<AgencyTripsResource['listPage']>>[number];
|
|
319
|
+
interface AgencyTripsResult {
|
|
320
|
+
/**
|
|
321
|
+
* One `PaginatedListFetch` per filter set, for the caller's own
|
|
322
|
+
* `usePaginatedList()`. Remount (or re-key) the consumer when `filters`
|
|
323
|
+
* changes — `usePaginatedList`'s own contract fetches page 0 exactly once
|
|
324
|
+
* per mount.
|
|
325
|
+
*/
|
|
326
|
+
readonly makeTripsFetch: (filters: AgencyTripFilters) => PaginatedListFetch<AgencyTripRow>;
|
|
327
|
+
/**
|
|
328
|
+
* Per-bucket counts over the WHOLE agency, for the list's filter chips —
|
|
329
|
+
* `undefined` until the first page lands.
|
|
330
|
+
*
|
|
331
|
+
* These arrive on the envelope's `facets` key rather than in the page
|
|
332
|
+
* body, because they are computed over the whole filtered set rather than
|
|
333
|
+
* the page. `PaginatedListFetchResult` has no slot for them and must not
|
|
334
|
+
* grow one: that type is shared, domain-agnostic plumbing (its own header
|
|
335
|
+
* insists on it), and a `facets` field there would mean nothing for the
|
|
336
|
+
* four other lists that use it. So this hook keeps them itself, written
|
|
337
|
+
* as each page resolves.
|
|
338
|
+
*/
|
|
339
|
+
readonly segmentCounts: AgencyTripSegmentCounts | undefined;
|
|
340
|
+
}
|
|
341
|
+
declare function useAgencyTrips(): AgencyTripsResult;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Returns the single `KaafilClient` instance `SessionShell` opened via
|
|
345
|
+
* `session.open`/`admin.open`/`share.open`. Throws outside the provider
|
|
346
|
+
* tree — see `08-core-hooks.md §1.1`.
|
|
347
|
+
*/
|
|
348
|
+
declare function useKaafilClient(): KaafilClient;
|
|
349
|
+
|
|
350
|
+
type BoundManifestResource = ReturnType<typeof useKaafilClient>['agencies']['trips']['manifest'];
|
|
351
|
+
type TripManifestRow = Awaited<ReturnType<BoundManifestResource['listPage']>>[number];
|
|
352
|
+
interface AgencyTripManifestResult {
|
|
353
|
+
/**
|
|
354
|
+
* One `PaginatedListFetch` per filter set, for the caller's own
|
|
355
|
+
* `usePaginatedList()`. Remount (or re-key) the consumer when `filters`
|
|
356
|
+
* changes — `usePaginatedList`'s own contract fetches page 0 exactly once
|
|
357
|
+
* per mount.
|
|
358
|
+
*
|
|
359
|
+
* `pageSize` lets the grouped and flat modes ask for different pages off
|
|
360
|
+
* the same hook without a second door.
|
|
361
|
+
*/
|
|
362
|
+
readonly makeManifestFetch: (filters: TripManifestFilters, pageSize?: number) => PaginatedListFetch<TripManifestRow>;
|
|
363
|
+
/**
|
|
364
|
+
* Whole-set aggregates for the tiles above the table — `undefined` until
|
|
365
|
+
* the first page lands.
|
|
366
|
+
*
|
|
367
|
+
* These describe the CURRENT FILTERED SET (unlike `useAgencyTrips`'
|
|
368
|
+
* `segmentCounts`, which spans the whole agency): a head-count above a
|
|
369
|
+
* filtered table has to describe that table. They arrive on the envelope's
|
|
370
|
+
* `facets` key for the same reason those do — `PaginatedListFetchResult` is
|
|
371
|
+
* shared, domain-agnostic plumbing and must not grow a `facets` slot that
|
|
372
|
+
* would mean nothing for the five other lists using it.
|
|
373
|
+
*/
|
|
374
|
+
readonly facets: TripManifestFacets | undefined;
|
|
375
|
+
/** The page size a grouped read should pass — see `GROUPED_PAGE_LIMIT`. */
|
|
376
|
+
readonly groupedPageSize: number;
|
|
377
|
+
}
|
|
378
|
+
declare function useAgencyTripManifest(tripRef: string): AgencyTripManifestResult;
|
|
379
|
+
|
|
380
|
+
type CollectionDeltaRow = Awaited<ReturnType<CollectionsResource['list']>>[number];
|
|
381
|
+
type EligibleRow = Awaited<ReturnType<CollectionsResource['eligible']>>[number];
|
|
382
|
+
type EligibleCollectionsStatus = NonNullable<ListEligibleCollectionsOptions['status']>;
|
|
383
|
+
|
|
384
|
+
type RecordCollectionInput = Omit<RecordCollectionOptions, 'tripRef' | 'idempotencyKey' | 'signal'>;
|
|
385
|
+
type VoidCollectionInput = Omit<VoidCollectionOptions, 'tripRef' | 'signal'>;
|
|
386
|
+
/**
|
|
387
|
+
* The eligible-balance roster — `collections.eligible()`, ranked "who owes
|
|
388
|
+
* money," the manager family's own p90 read (`families/manager/
|
|
389
|
+
* 01-collections.md`'s own header prose). Its own live-fetch state,
|
|
390
|
+
* deliberately not a `SnapshotList` — see this file's header comment.
|
|
391
|
+
*/
|
|
392
|
+
interface CollectionsEligiblePool {
|
|
393
|
+
readonly rows: readonly EligibleRow[];
|
|
394
|
+
/** The `status` this pool's current `rows` were fetched with. */
|
|
395
|
+
readonly status: EligibleCollectionsStatus;
|
|
396
|
+
/** `true` once at least one `client.collections.eligible()` call has
|
|
397
|
+
* settled (success or failure) for the CURRENT `status` — distinguishes
|
|
398
|
+
* "never fetched yet" from "fetched and genuinely empty" (everyone
|
|
399
|
+
* settled, or nobody has a `Balance` row at all). */
|
|
400
|
+
readonly loaded: boolean;
|
|
401
|
+
/** `true` when the MOST RECENT fetch threw — rendered distinctly from
|
|
402
|
+
* `rows: [], loaded: true`, never collapsed into the same empty state. */
|
|
403
|
+
readonly lastFetchFailed: boolean;
|
|
404
|
+
/** The server time (`meta.serverTime`) of the last successful fetch. */
|
|
405
|
+
readonly fetchedAt: string | undefined;
|
|
406
|
+
/** Re-runs the live read. Passing a `status` switches the pool's own
|
|
407
|
+
* filter and refetches under it; omitting it re-runs the CURRENT
|
|
408
|
+
* `status`. `record()` already calls this on its own success (a payment
|
|
409
|
+
* can move a traveller from `'due'` to `'settled'`) — a composite calls
|
|
410
|
+
* it again after any other action that changes who is eligible. */
|
|
411
|
+
readonly refresh: (status?: EligibleCollectionsStatus) => Promise<void>;
|
|
412
|
+
}
|
|
413
|
+
interface CollectionsReady {
|
|
414
|
+
/** Recorded collections, cache-first — `collections.list()`'s own delta
|
|
415
|
+
* feed. Includes tombstones for a row's own soft-void is NOT a tombstone
|
|
416
|
+
* (`void()` corrects a live row in place, `CollectionResponse.voidedAt`
|
|
417
|
+
* flips, the row is never removed) — a tombstone here means the
|
|
418
|
+
* collection itself was deleted at the source, which this API surface
|
|
419
|
+
* has no path to cause; the branch exists only because
|
|
420
|
+
* `CollectionDeltaResponse`'s own generated union carries one. */
|
|
421
|
+
readonly collections: readonly CollectionDeltaRow[];
|
|
422
|
+
readonly syncedAt: string | undefined;
|
|
423
|
+
/** Re-reads the desk lane after a write. A NO-OP on a field device, where
|
|
424
|
+
* the outbox drain emits `snapshot.updated` and the cache-first read
|
|
425
|
+
* re-renders itself — a composite need not know which lane it is on. */
|
|
426
|
+
readonly refreshLive: () => Promise<void>;
|
|
427
|
+
readonly eligible: CollectionsEligiblePool;
|
|
428
|
+
/** Records one customer payment. The overpay guard is server-authoritative
|
|
429
|
+
* (`collections.ts`'s own header comment) — this method does not
|
|
430
|
+
* pre-validate `amountMinor` against anything; a `422
|
|
431
|
+
* BUSINESS_RULE_VIOLATION` surfaces through the outbox op's own
|
|
432
|
+
* `parkReason`, same as any other refused write. */
|
|
433
|
+
readonly record: (input: RecordCollectionInput) => Promise<OutboxOp | null>;
|
|
434
|
+
/** Voids a collection — a correction, never an edit or hard delete.
|
|
435
|
+
* `version` is required (mirrors `VoidCollectionOptions`, which makes a
|
|
436
|
+
* missing `If-Match` impossible to construct, not merely discouraged). */
|
|
437
|
+
readonly void: (input: VoidCollectionInput) => Promise<OutboxOp | null>;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* PERSONALIZED mode-dark. Returns `{ status: 'dark', reason }` before any
|
|
441
|
+
* fetch when the `'collections'` capability triple isn't `lit`
|
|
442
|
+
* (`06-capability-and-personas.md §3`).
|
|
443
|
+
*/
|
|
444
|
+
declare function useCollections(tripRef: string): DomainHookResult<CollectionsReady>;
|
|
445
|
+
|
|
446
|
+
type AgencyTripRead = Awaited<ReturnType<AgencyTripsResource['get']>>;
|
|
447
|
+
interface AgencyTripResult {
|
|
448
|
+
readonly read: AgencyTripRead | undefined;
|
|
449
|
+
readonly readFailed: boolean;
|
|
450
|
+
readonly refresh: () => Promise<void>;
|
|
451
|
+
}
|
|
452
|
+
declare function useAgencyTrip(tripRef: string): AgencyTripResult;
|
|
453
|
+
|
|
454
|
+
export { type AgencyTripRow as A, type BindingRow as B, type ChecklistTemplateRow as C, type DeleteFormFieldInput as D, type PaginatedListResult as E, type FormDetailRow as F, type PatchAgencySettingsInput as G, type PatchFormFieldInput as H, type PatchFormInput as I, type JourneyTriggerRow as J, type PatchFormSectionInput as K, type PatchJourneyTriggerInput as L, type ManagerListRowResponse as M, useAgencyChecklistTemplates as N, useAgencyForms as O, type PaginatedListFetch as P, useAgencyJourneyTriggers as Q, type ReorderFormInput as R, useAgencySettings as S, type TravellerDirectoryItemResponse as T, useAgencyTrip as U, useAgencyTripManifest as V, useAgencyTrips as W, useCollections as X, useDirectories as Y, useKaafilClient as Z, usePaginatedList as _, type ChecklistTemplateItemRow as a, type FormFieldRow as b, type FormRow as c, type TripManifestRow as d, type CollectionDeltaRow as e, type AgencyTripRead as f, type AgencySettingsDocument as g, type FormSectionRow as h, type AgencyChecklistTemplatesReady as i, type AgencyFormsReady as j, type AgencyJourneyTriggersReady as k, type AgencySettingsReady as l, type AgencyTripManifestResult as m, type AgencyTripResult as n, type AgencyTripsResult as o, type CloneFormInput as p, type CollectionsReady as q, type CreateFormFieldInput as r, type CreateFormInput as s, type CreateFormSectionInput as t, type DeleteFormInput as u, type DeleteFormSectionInput as v, type DirectoriesReady as w, type FormSummaryRow as x, type PaginatedListFetchResult as y, type PaginatedListOptions as z };
|