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.
Files changed (79) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/LICENSE +21 -0
  3. package/README.md +187 -0
  4. package/dist/OfflineFallbackScreen-B5dfaJBN.d.ts +37 -0
  5. package/dist/OfflineFallbackScreen-Ctm7nBa-.d.cts +37 -0
  6. package/dist/SessionExpiredScreen-CytQNuak.d.cts +50 -0
  7. package/dist/SessionExpiredScreen-D8GHyZc3.d.ts +50 -0
  8. package/dist/admin/index.cjs +23779 -0
  9. package/dist/admin/index.cjs.map +1 -0
  10. package/dist/admin/index.d.cts +1157 -0
  11. package/dist/admin/index.d.ts +1157 -0
  12. package/dist/admin/index.js +23724 -0
  13. package/dist/admin/index.js.map +1 -0
  14. package/dist/chunk-6FPAGGFL.js +6028 -0
  15. package/dist/chunk-6FPAGGFL.js.map +1 -0
  16. package/dist/chunk-ACVU55PZ.cjs +294 -0
  17. package/dist/chunk-ACVU55PZ.cjs.map +1 -0
  18. package/dist/chunk-EM7JV3D7.cjs +6051 -0
  19. package/dist/chunk-EM7JV3D7.cjs.map +1 -0
  20. package/dist/chunk-IIPQ4JNC.js +287 -0
  21. package/dist/chunk-IIPQ4JNC.js.map +1 -0
  22. package/dist/chunk-LL243STJ.cjs +2195 -0
  23. package/dist/chunk-LL243STJ.cjs.map +1 -0
  24. package/dist/chunk-PJRZCOFF.cjs +958 -0
  25. package/dist/chunk-PJRZCOFF.cjs.map +1 -0
  26. package/dist/chunk-PTQ2CJKE.cjs +40 -0
  27. package/dist/chunk-PTQ2CJKE.cjs.map +1 -0
  28. package/dist/chunk-PZKXLQSU.js +10 -0
  29. package/dist/chunk-PZKXLQSU.js.map +1 -0
  30. package/dist/chunk-QHUDOVKW.cjs +111 -0
  31. package/dist/chunk-QHUDOVKW.cjs.map +1 -0
  32. package/dist/chunk-TOBZFADB.cjs +12 -0
  33. package/dist/chunk-TOBZFADB.cjs.map +1 -0
  34. package/dist/chunk-UUGMNP27.js +936 -0
  35. package/dist/chunk-UUGMNP27.js.map +1 -0
  36. package/dist/chunk-UYJ6LIWP.js +2154 -0
  37. package/dist/chunk-UYJ6LIWP.js.map +1 -0
  38. package/dist/chunk-VHTSTUCJ.cjs +346 -0
  39. package/dist/chunk-VHTSTUCJ.cjs.map +1 -0
  40. package/dist/chunk-WUAFL77X.js +340 -0
  41. package/dist/chunk-WUAFL77X.js.map +1 -0
  42. package/dist/chunk-XI7MK4Y7.js +38 -0
  43. package/dist/chunk-XI7MK4Y7.js.map +1 -0
  44. package/dist/chunk-YDGR7JSY.js +107 -0
  45. package/dist/chunk-YDGR7JSY.js.map +1 -0
  46. package/dist/core/index.cjs +1254 -0
  47. package/dist/core/index.cjs.map +1 -0
  48. package/dist/core/index.d.cts +1267 -0
  49. package/dist/core/index.d.ts +1267 -0
  50. package/dist/core/index.js +995 -0
  51. package/dist/core/index.js.map +1 -0
  52. package/dist/index.css +1 -0
  53. package/dist/manager/index.cjs +13562 -0
  54. package/dist/manager/index.cjs.map +1 -0
  55. package/dist/manager/index.d.cts +1054 -0
  56. package/dist/manager/index.d.ts +1054 -0
  57. package/dist/manager/index.js +13518 -0
  58. package/dist/manager/index.js.map +1 -0
  59. package/dist/testing/index.cjs +221 -0
  60. package/dist/testing/index.cjs.map +1 -0
  61. package/dist/testing/index.d.cts +269 -0
  62. package/dist/testing/index.d.ts +269 -0
  63. package/dist/testing/index.js +208 -0
  64. package/dist/testing/index.js.map +1 -0
  65. package/dist/tokenStyle-CToG5oOS.d.cts +3 -0
  66. package/dist/tokenStyle-CToG5oOS.d.ts +3 -0
  67. package/dist/traveller/index.cjs +1799 -0
  68. package/dist/traveller/index.cjs.map +1 -0
  69. package/dist/traveller/index.d.cts +58 -0
  70. package/dist/traveller/index.d.ts +58 -0
  71. package/dist/traveller/index.js +1789 -0
  72. package/dist/traveller/index.js.map +1 -0
  73. package/dist/useAgencyTrip-BUYSIaC2.d.cts +454 -0
  74. package/dist/useAgencyTrip-BzyJB1D9.d.ts +454 -0
  75. package/dist/useNotifications-BZW1Z_ur.d.cts +356 -0
  76. package/dist/useNotifications-D262i5BQ.d.ts +356 -0
  77. package/dist/useVendors-DXOuZWhZ.d.cts +784 -0
  78. package/dist/useVendors-DXOuZWhZ.d.ts +784 -0
  79. package/package.json +95 -0
@@ -0,0 +1,2195 @@
1
+ 'use strict';
2
+
3
+ var chunkEM7JV3D7_cjs = require('./chunk-EM7JV3D7.cjs');
4
+ var client = require('kaafil-js/client');
5
+ var react = require('react');
6
+
7
+ // src/core/errors/catalog.ts
8
+ var ERROR_HANDLING_PATH = {
9
+ // re-auth
10
+ UNAUTHENTICATED: "re-auth",
11
+ // retryable (TRANSIENT, `06-offline-first.md §7`)
12
+ RATE_LIMITED: "retryable",
13
+ INTERNAL_ERROR: "retryable",
14
+ TENANT_SCOPE_MISSING: "retryable",
15
+ // parked (the closed never-retried set, `07-offline-and-sync.md §10`)
16
+ PLAN_FEATURE_DISABLED: "parked",
17
+ FILE_PURGED: "parked",
18
+ LOCKED: "parked",
19
+ // surface-to-user (everything else in the 24-code catalog)
20
+ VALIDATION_ERROR: "surface-to-user",
21
+ RESOURCE_NOT_FOUND: "surface-to-user",
22
+ CONFLICT_VERSION: "surface-to-user",
23
+ STOP_HAS_PENDING: "surface-to-user",
24
+ RESPONSE_CLOSED: "surface-to-user",
25
+ BUSINESS_RULE_VIOLATION: "surface-to-user",
26
+ OUT_OF_TRIP_WINDOW: "surface-to-user",
27
+ UPLOAD_MISMATCH: "surface-to-user",
28
+ FILE_ORPHANED: "surface-to-user",
29
+ CAPABILITY_UNAVAILABLE: "surface-to-user",
30
+ READ_ONLY_ROLE: "surface-to-user",
31
+ SUBJECT_REQUIRED: "surface-to-user",
32
+ IDEMPOTENCY_KEY_REUSED: "surface-to-user",
33
+ SECRET_NOT_REPLAYABLE: "surface-to-user",
34
+ NOT_IMPLEMENTED: "surface-to-user",
35
+ SHARE_TOKEN_EXPIRED: "surface-to-user",
36
+ SHARE_TOKEN_REVOKED: "surface-to-user"
37
+ };
38
+ function pathForStatusOnly(status) {
39
+ if (status === void 0 || status === null) {
40
+ return "retryable";
41
+ }
42
+ if (status === 401) {
43
+ return "re-auth";
44
+ }
45
+ if (status === 429 || status >= 500) {
46
+ return "retryable";
47
+ }
48
+ if (status === 402 || status === 410 || status === 423) {
49
+ return "parked";
50
+ }
51
+ return "surface-to-user";
52
+ }
53
+ function classifyError(error) {
54
+ if (error instanceof client.UnsatisfiableSchemeError) {
55
+ return {
56
+ path: "parked",
57
+ code: void 0,
58
+ status: void 0,
59
+ unsatisfiableScheme: true,
60
+ cause: error
61
+ };
62
+ }
63
+ if (client.isKaafilError(error)) {
64
+ const catalogPath = error.code !== void 0 ? ERROR_HANDLING_PATH[error.code] : void 0;
65
+ const path = catalogPath ?? pathForStatusOnly(error.status);
66
+ return {
67
+ path,
68
+ code: error.code,
69
+ status: error.status,
70
+ unsatisfiableScheme: false,
71
+ cause: error
72
+ };
73
+ }
74
+ return {
75
+ path: "surface-to-user",
76
+ code: void 0,
77
+ status: void 0,
78
+ unsatisfiableScheme: false,
79
+ cause: error
80
+ };
81
+ }
82
+
83
+ // src/core/internal/ensureTripPulled.ts
84
+ var pulledTrips = /* @__PURE__ */ new WeakMap();
85
+ function ensureTripPulled(engine, tripRef) {
86
+ let seen = pulledTrips.get(engine);
87
+ if (seen === void 0) {
88
+ seen = /* @__PURE__ */ new Set();
89
+ pulledTrips.set(engine, seen);
90
+ }
91
+ if (seen.has(tripRef)) {
92
+ return;
93
+ }
94
+ seen.add(tripRef);
95
+ void engine.pull.pullTrip({ tripRef }).catch(() => {
96
+ seen?.delete(tripRef);
97
+ });
98
+ }
99
+
100
+ // src/core/hooks/useSnapshotList.ts
101
+ function useSnapshotList(tripRef, listName, options) {
102
+ const engine = react.useContext(chunkEM7JV3D7_cjs.OfflineEngineContext);
103
+ const client = react.useContext(chunkEM7JV3D7_cjs.KaafilClientContext);
104
+ const [rows, setRows] = react.useState(
105
+ () => engine === null ? [] : engine.snapshot.list(tripRef, listName)
106
+ );
107
+ const [liveRows, setLiveRows] = react.useState(void 0);
108
+ const [liveSyncedAt, setLiveSyncedAt] = react.useState(void 0);
109
+ const liveRef = react.useRef(options?.live);
110
+ liveRef.current = options?.live;
111
+ const hasLive = options?.live !== void 0;
112
+ const readLive = react.useCallback(async () => {
113
+ const live = liveRef.current;
114
+ if (engine !== null || live === void 0 || client === null) {
115
+ return;
116
+ }
117
+ try {
118
+ const result = await live(client, tripRef);
119
+ setLiveRows(result.rows);
120
+ setLiveSyncedAt(result.syncedAt);
121
+ } catch {
122
+ }
123
+ }, [engine, client, tripRef, hasLive]);
124
+ react.useEffect(() => {
125
+ void readLive();
126
+ }, [readLive]);
127
+ react.useEffect(() => {
128
+ if (engine === null) {
129
+ setRows([]);
130
+ return;
131
+ }
132
+ ensureTripPulled(engine, tripRef);
133
+ setRows(engine.snapshot.list(tripRef, listName));
134
+ const unsubscribe = engine.events.on("snapshot.updated", (event) => {
135
+ if (event.tripRef === tripRef && event.lists.includes(listName)) {
136
+ setRows(engine.snapshot.list(tripRef, listName));
137
+ }
138
+ });
139
+ return unsubscribe;
140
+ }, [engine, tripRef, listName]);
141
+ if (engine === null) {
142
+ return {
143
+ rows: liveRows ?? rows,
144
+ syncedAt: liveSyncedAt,
145
+ refreshLive: readLive
146
+ };
147
+ }
148
+ let syncedAt;
149
+ for (const row of rows) {
150
+ const stamp = engine.snapshot.syncedAt(tripRef, listName, row.id);
151
+ if (stamp !== void 0 && (syncedAt === void 0 || stamp > syncedAt)) {
152
+ syncedAt = stamp;
153
+ }
154
+ }
155
+ if (syncedAt === void 0 && rows.length === 0) {
156
+ syncedAt = engine.snapshot.cursor(tripRef, listName);
157
+ }
158
+ return { rows, syncedAt, refreshLive: readLive };
159
+ }
160
+
161
+ // src/core/internal/createDomainHook.ts
162
+ function createDomainHook(moduleKey, build) {
163
+ return function useDomainHook(tripRef) {
164
+ const { rows, loaded } = chunkEM7JV3D7_cjs.useCapabilityRows(tripRef);
165
+ const ready = build(tripRef);
166
+ if (!loaded) {
167
+ return { status: "loading" };
168
+ }
169
+ const row = rows.find((candidate) => candidate.capability === moduleKey);
170
+ const triple = row === void 0 ? chunkEM7JV3D7_cjs.UNKNOWN_CAPABILITY_TRIPLE : chunkEM7JV3D7_cjs.deriveCapabilityTriple(row);
171
+ if (triple.status !== "lit") {
172
+ const reason = chunkEM7JV3D7_cjs.darkReasonFor(triple);
173
+ return { status: "dark", reason };
174
+ }
175
+ return { status: "ready", ...ready };
176
+ };
177
+ }
178
+
179
+ // src/core/hooks/useChecklists.ts
180
+ var useChecklistsInternal = createDomainHook("checklists", (tripRef) => {
181
+ const client$1 = chunkEM7JV3D7_cjs.useKaafilClient();
182
+ const engine = react.useContext(chunkEM7JV3D7_cjs.OfflineEngineContext);
183
+ const { rows: snapshotItems, syncedAt } = useSnapshotList(
184
+ tripRef,
185
+ "checklist"
186
+ );
187
+ const [aggregate, setAggregate] = react.useState({
188
+ title: void 0,
189
+ subtitle: void 0,
190
+ progress: void 0,
191
+ hasOpenMandatoryByPhase: void 0,
192
+ sections: [],
193
+ items: [],
194
+ availableTemplates: [],
195
+ loaded: false,
196
+ lastFetchFailed: false,
197
+ fetchedAt: void 0
198
+ });
199
+ const refreshAggregate = react.useCallback(async () => {
200
+ try {
201
+ const response = await client$1.checklists.read({ tripRef });
202
+ setAggregate({
203
+ title: response.title,
204
+ subtitle: response.subtitle,
205
+ progress: response.progress,
206
+ hasOpenMandatoryByPhase: response.hasOpenMandatoryByPhase,
207
+ sections: response.sections,
208
+ items: response.items,
209
+ availableTemplates: response.availableTemplates,
210
+ loaded: true,
211
+ lastFetchFailed: false,
212
+ fetchedAt: response.meta.serverTime
213
+ });
214
+ } catch {
215
+ setAggregate((previous) => ({ ...previous, lastFetchFailed: true }));
216
+ }
217
+ }, [client$1, tripRef]);
218
+ react.useEffect(() => {
219
+ void refreshAggregate();
220
+ }, [refreshAggregate]);
221
+ const refreshAggregateAfterDrain = react.useCallback(() => {
222
+ if (engine === null) {
223
+ return;
224
+ }
225
+ const unsubscribe = engine.events.on("sync.drained", () => {
226
+ unsubscribe();
227
+ void refreshAggregate();
228
+ });
229
+ }, [engine, refreshAggregate]);
230
+ const addItemMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
231
+ tripRef,
232
+ enqueue: (engine2, input) => engine2.enqueue({
233
+ tripRef,
234
+ method: client.SyncOpMethod.Post,
235
+ path: `/api/v1/trips/${tripRef}/checklist/items`,
236
+ operationId: "addChecklistItem",
237
+ body: input
238
+ }),
239
+ // ── THE DESK LANE ─────────────────────────────────────────────────
240
+ // All five checklist writes take the admin triple, and a desk console
241
+ // mounts no `OfflineShell` — without this the write has no transport
242
+ // at all and every attempt fails as an unclassified error.
243
+ // `idempotencyKey` is OPTIONAL on these SDK options, so no lane here
244
+ // mints one (hard rule #4); `linkExpenseReceipt`, whose key is
245
+ // required, is the one write in this package that CANNOT have a desk
246
+ // lane for exactly that reason.
247
+ direct: (liveClient, input) => liveClient.checklists.items.add({ tripRef, ...input })
248
+ });
249
+ const patchItemMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
250
+ tripRef,
251
+ enqueue: (engine2, input) => {
252
+ const { itemId, version, ...body } = input;
253
+ return engine2.enqueue({
254
+ tripRef,
255
+ method: client.SyncOpMethod.Patch,
256
+ path: `/api/v1/trips/${tripRef}/checklist/items/${itemId}`,
257
+ operationId: "patchChecklistItem",
258
+ body,
259
+ ifMatch: version
260
+ });
261
+ },
262
+ direct: (liveClient, input) => liveClient.checklists.items.patch({ tripRef, ...input })
263
+ });
264
+ const removeItemMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
265
+ tripRef,
266
+ enqueue: (engine2, input) => {
267
+ const { itemId, version } = input;
268
+ return engine2.enqueue({
269
+ tripRef,
270
+ method: client.SyncOpMethod.Delete,
271
+ path: `/api/v1/trips/${tripRef}/checklist/items/${itemId}`,
272
+ operationId: "deleteChecklistItem",
273
+ ifMatch: version
274
+ });
275
+ },
276
+ direct: (liveClient, input) => liveClient.checklists.items.remove({ tripRef, ...input })
277
+ });
278
+ const toggleItemMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
279
+ tripRef,
280
+ enqueue: (engine2, input) => {
281
+ const { itemId, ...body } = input;
282
+ return engine2.enqueue({
283
+ tripRef,
284
+ method: client.SyncOpMethod.Post,
285
+ path: `/api/v1/trips/${tripRef}/checklist/items/${itemId}/toggle`,
286
+ // `expectedStatus`, not `version`/`ifMatch` — this file's header,
287
+ // quirk 1.
288
+ operationId: "toggleChecklistItem",
289
+ body
290
+ });
291
+ },
292
+ direct: (liveClient, input) => liveClient.checklists.items.toggle({ tripRef, ...input })
293
+ });
294
+ const pullTemplateMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
295
+ tripRef,
296
+ enqueue: (engine2, input) => engine2.enqueue({
297
+ tripRef,
298
+ method: client.SyncOpMethod.Post,
299
+ path: `/api/v1/trips/${tripRef}/checklist/templates/pull`,
300
+ operationId: "pullChecklistTemplate",
301
+ body: input
302
+ }),
303
+ direct: (liveClient, input) => liveClient.checklists.templates.pull({ tripRef, ...input })
304
+ });
305
+ const addItemMutate = addItemMutation.mutate;
306
+ const addItem = react.useCallback(
307
+ async (input) => {
308
+ const op = await addItemMutate(input);
309
+ void refreshAggregate();
310
+ refreshAggregateAfterDrain();
311
+ return op;
312
+ },
313
+ [addItemMutate, refreshAggregate, refreshAggregateAfterDrain]
314
+ );
315
+ const patchItemMutate = patchItemMutation.mutate;
316
+ const patchItem = react.useCallback(
317
+ async (input) => {
318
+ const op = await patchItemMutate(input);
319
+ void refreshAggregate();
320
+ refreshAggregateAfterDrain();
321
+ return op;
322
+ },
323
+ [patchItemMutate, refreshAggregate, refreshAggregateAfterDrain]
324
+ );
325
+ const removeItemMutate = removeItemMutation.mutate;
326
+ const removeItem = react.useCallback(
327
+ async (input) => {
328
+ const op = await removeItemMutate(input);
329
+ void refreshAggregate();
330
+ refreshAggregateAfterDrain();
331
+ return op;
332
+ },
333
+ [removeItemMutate, refreshAggregate, refreshAggregateAfterDrain]
334
+ );
335
+ const toggleItemMutate = toggleItemMutation.mutate;
336
+ const toggleItem = react.useCallback(
337
+ async (input) => {
338
+ const op = await toggleItemMutate(input);
339
+ void refreshAggregate();
340
+ refreshAggregateAfterDrain();
341
+ return op;
342
+ },
343
+ [toggleItemMutate, refreshAggregate, refreshAggregateAfterDrain]
344
+ );
345
+ const pullTemplateMutate = pullTemplateMutation.mutate;
346
+ const pullTemplate = react.useCallback(
347
+ async (input) => {
348
+ const op = await pullTemplateMutate(input);
349
+ void refreshAggregate();
350
+ refreshAggregateAfterDrain();
351
+ return op;
352
+ },
353
+ [pullTemplateMutate, refreshAggregate, refreshAggregateAfterDrain]
354
+ );
355
+ const listTemplates = react.useCallback(
356
+ (input) => client$1.checklists.templates.list({ tripRef, ...input }),
357
+ [client$1, tripRef]
358
+ );
359
+ const listAgencyTemplates = react.useCallback(
360
+ (input) => client$1.checklists.agencyTemplates.list(input),
361
+ [client$1]
362
+ );
363
+ const createAgencyTemplate = react.useCallback(
364
+ (input) => client$1.checklists.agencyTemplates.create(input),
365
+ [client$1]
366
+ );
367
+ const patchAgencyTemplate = react.useCallback(
368
+ (input) => client$1.checklists.agencyTemplates.patch(input),
369
+ [client$1]
370
+ );
371
+ const removeAgencyTemplate = react.useCallback(
372
+ (input) => client$1.checklists.agencyTemplates.remove(input),
373
+ [client$1]
374
+ );
375
+ const publishAgencyTemplate = react.useCallback(
376
+ (input) => client$1.checklists.agencyTemplates.publish(input),
377
+ [client$1]
378
+ );
379
+ const items = syncedAt === void 0 ? aggregate.items : snapshotItems;
380
+ return {
381
+ items,
382
+ syncedAt,
383
+ aggregate: { ...aggregate, refresh: refreshAggregate },
384
+ addItem,
385
+ patchItem,
386
+ removeItem,
387
+ toggleItem,
388
+ listTemplates,
389
+ pullTemplate,
390
+ listAgencyTemplates,
391
+ createAgencyTemplate,
392
+ patchAgencyTemplate,
393
+ removeAgencyTemplate,
394
+ publishAgencyTemplate
395
+ };
396
+ });
397
+ function useChecklists(tripRef) {
398
+ return useChecklistsInternal(tripRef);
399
+ }
400
+ var useCloseoutInternal = createDomainHook("closing-day", (tripRef) => {
401
+ const client = chunkEM7JV3D7_cjs.useKaafilClient();
402
+ const [aggregate, setAggregate] = react.useState(void 0);
403
+ const [loaded, setLoaded] = react.useState(false);
404
+ const [lastFetchFailed, setLastFetchFailed] = react.useState(false);
405
+ const [syncedAt, setSyncedAt] = react.useState(void 0);
406
+ const refresh = react.useCallback(async () => {
407
+ try {
408
+ const response = await client.closeout.get({ tripRef });
409
+ setAggregate(response);
410
+ setLoaded(true);
411
+ setLastFetchFailed(false);
412
+ setSyncedAt(response.meta.serverTime);
413
+ } catch {
414
+ setLastFetchFailed(true);
415
+ }
416
+ }, [client, tripRef]);
417
+ react.useEffect(() => {
418
+ void refresh();
419
+ }, [refresh]);
420
+ const saveHandover = react.useCallback(
421
+ async (input) => {
422
+ const response = await client.closeout.saveHandover({ tripRef, ...input });
423
+ setAggregate(response);
424
+ setLoaded(true);
425
+ setLastFetchFailed(false);
426
+ setSyncedAt(response.meta.serverTime);
427
+ return response;
428
+ },
429
+ [client, tripRef]
430
+ );
431
+ const lock = react.useCallback(
432
+ async (input = {}) => {
433
+ const response = await client.closeout.lock({ tripRef, ...input });
434
+ setAggregate(response);
435
+ setLoaded(true);
436
+ setLastFetchFailed(false);
437
+ setSyncedAt(response.meta.serverTime);
438
+ return response;
439
+ },
440
+ [client, tripRef]
441
+ );
442
+ const unlock = react.useCallback(
443
+ async (input) => {
444
+ const response = await client.closeout.unlock({ tripRef, ...input });
445
+ setAggregate(response);
446
+ setLoaded(true);
447
+ setLastFetchFailed(false);
448
+ setSyncedAt(response.meta.serverTime);
449
+ return response;
450
+ },
451
+ [client, tripRef]
452
+ );
453
+ const exportPdf = react.useCallback(
454
+ (input = {}) => client.closeout.exportPdf({ tripRef, ...input }),
455
+ [client, tripRef]
456
+ );
457
+ return {
458
+ aggregate,
459
+ loaded,
460
+ lastFetchFailed,
461
+ syncedAt,
462
+ refresh,
463
+ saveHandover,
464
+ lock,
465
+ unlock,
466
+ exportPdf
467
+ };
468
+ });
469
+ function useCloseout(tripRef) {
470
+ return useCloseoutInternal(tripRef);
471
+ }
472
+ var useCollectionsInternal = createDomainHook("collections", (tripRef) => {
473
+ const client$1 = chunkEM7JV3D7_cjs.useKaafilClient();
474
+ const {
475
+ rows: collections,
476
+ syncedAt,
477
+ refreshLive
478
+ } = useSnapshotList(tripRef, "collections", {
479
+ live: async (liveClient, ref) => {
480
+ const response = await liveClient.collections.list({ tripRef: ref });
481
+ return { rows: response, syncedAt: response.meta.serverTime };
482
+ }
483
+ });
484
+ const [eligibleStatus, setEligibleStatus] = react.useState("due");
485
+ const [eligibleRows, setEligibleRows] = react.useState([]);
486
+ const [eligibleLoaded, setEligibleLoaded] = react.useState(false);
487
+ const [eligibleFetchFailed, setEligibleFetchFailed] = react.useState(false);
488
+ const [eligibleFetchedAt, setEligibleFetchedAt] = react.useState(void 0);
489
+ const refreshEligible = react.useCallback(
490
+ async (status) => {
491
+ const nextStatus = status ?? eligibleStatus;
492
+ if (status !== void 0 && status !== eligibleStatus) {
493
+ setEligibleStatus(status);
494
+ }
495
+ try {
496
+ const response = await client$1.collections.eligible({ tripRef, status: nextStatus });
497
+ setEligibleRows(response);
498
+ setEligibleLoaded(true);
499
+ setEligibleFetchFailed(false);
500
+ setEligibleFetchedAt(response.meta.serverTime);
501
+ } catch {
502
+ setEligibleFetchFailed(true);
503
+ }
504
+ },
505
+ [client$1, tripRef, eligibleStatus]
506
+ );
507
+ react.useEffect(() => {
508
+ void refreshEligible(eligibleStatus);
509
+ }, [refreshEligible, eligibleStatus]);
510
+ const recordMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
511
+ tripRef,
512
+ enqueue: (engine, input) => engine.enqueue({
513
+ tripRef,
514
+ method: client.SyncOpMethod.Post,
515
+ path: `/api/v1/trips/${tripRef}/collections`,
516
+ // `OperationId` is not exported from `kaafil-js/client`'s public
517
+ // surface (the same gap `useRooming()`'s own comment names) —
518
+ // hardcoded literal, verified against
519
+ // `kaafil-js/src/generated/security.ts` this session.
520
+ operationId: "recordCollection",
521
+ body: input
522
+ }),
523
+ // The desk lane. `recordCollection` takes the admin triple, and a desk
524
+ // console mounts no `OfflineShell` — without this the write has no
525
+ // transport at all and every attempt fails as an unclassified error.
526
+ direct: (liveClient, input) => liveClient.collections.record({ tripRef, ...input })
527
+ });
528
+ const recordMutate = recordMutation.mutate;
529
+ const record = react.useCallback(
530
+ async (input) => {
531
+ const op = await recordMutate(input);
532
+ void refreshEligible();
533
+ return op;
534
+ },
535
+ [recordMutate, refreshEligible]
536
+ );
537
+ const voidMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
538
+ tripRef,
539
+ enqueue: (engine, input) => {
540
+ const { collectionId, version, ...body } = input;
541
+ return engine.enqueue({
542
+ tripRef,
543
+ method: client.SyncOpMethod.Delete,
544
+ path: `/api/v1/trips/${tripRef}/collections/${collectionId}/void`,
545
+ operationId: "voidCollection",
546
+ body,
547
+ ifMatch: version
548
+ });
549
+ },
550
+ direct: (liveClient, input) => liveClient.collections.void({ tripRef, ...input })
551
+ });
552
+ const voidMutate = voidMutation.mutate;
553
+ const voidCollection = react.useCallback(
554
+ async (input) => {
555
+ const op = await voidMutate(input);
556
+ void refreshEligible();
557
+ return op;
558
+ },
559
+ [voidMutate, refreshEligible]
560
+ );
561
+ return {
562
+ collections,
563
+ syncedAt,
564
+ refreshLive,
565
+ eligible: {
566
+ rows: eligibleRows,
567
+ status: eligibleStatus,
568
+ loaded: eligibleLoaded,
569
+ lastFetchFailed: eligibleFetchFailed,
570
+ fetchedAt: eligibleFetchedAt,
571
+ refresh: refreshEligible
572
+ },
573
+ record,
574
+ void: voidCollection
575
+ };
576
+ });
577
+ function useCollections(tripRef) {
578
+ return useCollectionsInternal(tripRef);
579
+ }
580
+ var useExpensesInternal = createDomainHook("expenses", (tripRef) => {
581
+ const client$1 = chunkEM7JV3D7_cjs.useKaafilClient();
582
+ const {
583
+ rows: expenses,
584
+ syncedAt,
585
+ refreshLive
586
+ } = useSnapshotList(tripRef, "expenses", {
587
+ live: async (liveClient, ref) => {
588
+ const response = await liveClient.expenses.list({ tripRef: ref });
589
+ return { rows: response.items, syncedAt: response.meta.serverTime };
590
+ }
591
+ });
592
+ const [spendTotalMinor, setSpendTotalMinor] = react.useState(void 0);
593
+ const [categoryTotals, setCategoryTotals] = react.useState(void 0);
594
+ const [totalsLoaded, setTotalsLoaded] = react.useState(false);
595
+ const [totalsFailed, setTotalsFailed] = react.useState(false);
596
+ const refreshTotals = react.useCallback(async () => {
597
+ try {
598
+ const response = await client$1.expenses.list({ tripRef });
599
+ setSpendTotalMinor(response.spendTotalMinor);
600
+ setCategoryTotals(response.categoryTotals);
601
+ setTotalsLoaded(true);
602
+ setTotalsFailed(false);
603
+ } catch {
604
+ setTotalsFailed(true);
605
+ }
606
+ }, [client$1, tripRef]);
607
+ react.useEffect(() => {
608
+ void refreshTotals();
609
+ }, [refreshTotals]);
610
+ const logMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
611
+ tripRef,
612
+ enqueue: (engine, input) => engine.enqueue({
613
+ tripRef,
614
+ method: client.SyncOpMethod.Post,
615
+ path: `/api/v1/trips/${tripRef}/expenses`,
616
+ // Hardcoded literal, not imported: `OperationId` is not exported
617
+ // from `kaafil-js/client`'s public surface (verified — same gap
618
+ // `useRooming.ts` documents). Value verified against
619
+ // `kaafil-js/src/generated/security.ts` this session.
620
+ operationId: "logExpense",
621
+ body: input
622
+ }),
623
+ // The desk lane. `log`, `linkReceipt` and `void` each additionally
624
+ // accept an agency-admin session (the SDK's own header says so), and a
625
+ // desk console mounts no `OfflineShell` — without these the writes have
626
+ // no transport at all. `submitClaim`/`withdrawClaim` deliberately get
627
+ // NONE: those are `['manager', 'apiKey']`, a manager claiming their own
628
+ // reimbursement, and an admin has no business standing in for them.
629
+ direct: (liveClient, input) => liveClient.expenses.log({ tripRef, ...input })
630
+ });
631
+ const linkReceiptMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
632
+ tripRef,
633
+ enqueue: (engine, input) => {
634
+ const { expenseId, ...body } = input;
635
+ return engine.enqueue({
636
+ tripRef,
637
+ method: client.SyncOpMethod.Patch,
638
+ path: `/api/v1/trips/${tripRef}/expenses/${expenseId}/receipt`,
639
+ operationId: "linkExpenseReceipt",
640
+ body
641
+ });
642
+ }
643
+ // NO DESK LANE, AND IT CANNOT HAVE ONE. `LinkExpenseReceiptOptions`
644
+ // declares `idempotencyKey` as REQUIRED — the route "addresses no
645
+ // client-held version", so the key is its only replay guard — and hard
646
+ // rule #4 forbids any hook here from minting one or accepting one in its
647
+ // signature. The outbox path is unaffected: `OfflineEngine.enqueue()`
648
+ // mints the key itself, which is exactly the arrangement rule #4 exists
649
+ // to preserve. So this write is FIELD-ONLY in practice, and a desk
650
+ // surface must not offer it rather than offering a control that throws.
651
+ // Widening it would mean either breaking rule #4 or making the key
652
+ // optional on the wire, neither of which belongs in a UIKit pass.
653
+ });
654
+ const voidMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
655
+ tripRef,
656
+ enqueue: (engine, input) => {
657
+ const { expenseId, version, ...body } = input;
658
+ return engine.enqueue({
659
+ tripRef,
660
+ method: client.SyncOpMethod.Delete,
661
+ path: `/api/v1/trips/${tripRef}/expenses/${expenseId}/void`,
662
+ operationId: "voidExpense",
663
+ body,
664
+ ifMatch: version
665
+ });
666
+ },
667
+ direct: (liveClient, input) => liveClient.expenses.void({ tripRef, ...input })
668
+ });
669
+ const submitClaimMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
670
+ tripRef,
671
+ enqueue: (engine, input) => {
672
+ const { expenseId } = input;
673
+ return engine.enqueue({
674
+ tripRef,
675
+ method: client.SyncOpMethod.Post,
676
+ path: `/api/v1/trips/${tripRef}/expenses/${expenseId}/claim`,
677
+ operationId: "submitExpenseClaim",
678
+ body: {}
679
+ });
680
+ }
681
+ });
682
+ const withdrawClaimMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
683
+ tripRef,
684
+ enqueue: (engine, input) => {
685
+ const { expenseId, version } = input;
686
+ return engine.enqueue({
687
+ tripRef,
688
+ method: client.SyncOpMethod.Delete,
689
+ path: `/api/v1/trips/${tripRef}/expenses/${expenseId}/claim/withdraw`,
690
+ operationId: "withdrawExpenseClaim",
691
+ body: {},
692
+ ifMatch: version
693
+ });
694
+ }
695
+ });
696
+ const read = react.useCallback(
697
+ (expenseId) => client$1.expenses.read({ tripRef, expenseId }),
698
+ [client$1, tripRef]
699
+ );
700
+ return {
701
+ expenses,
702
+ syncedAt,
703
+ refreshLive,
704
+ totals: {
705
+ spendTotalMinor,
706
+ categoryTotals,
707
+ loaded: totalsLoaded,
708
+ lastFetchFailed: totalsFailed,
709
+ refresh: refreshTotals
710
+ },
711
+ read,
712
+ log: logMutation.mutate,
713
+ linkReceipt: linkReceiptMutation.mutate,
714
+ void: voidMutation.mutate,
715
+ submitClaim: submitClaimMutation.mutate,
716
+ withdrawClaim: withdrawClaimMutation.mutate
717
+ };
718
+ });
719
+ function useExpenses(tripRef) {
720
+ return useExpensesInternal(tripRef);
721
+ }
722
+ var DEFAULT_MAX_ATTEMPTS = 3;
723
+ function useFiles(context) {
724
+ const client = chunkEM7JV3D7_cjs.useKaafilClient();
725
+ const { tripRef } = context;
726
+ const request = react.useCallback(
727
+ (input) => client.files.request({ ...input, tripRef }),
728
+ [client, tripRef]
729
+ );
730
+ const confirm = react.useCallback((input) => client.files.confirm(input), [client]);
731
+ const meta = react.useCallback((fileId) => client.files.meta({ fileId }), [client]);
732
+ const url = react.useCallback((fileId) => client.files.url({ fileId }), [client]);
733
+ const list = react.useCallback(
734
+ async (query) => (await client.files.list({ ...query, tripRef })).items,
735
+ [client, tripRef]
736
+ );
737
+ const managerView = react.useCallback(
738
+ (fileId) => client.files.managerView({ fileId }),
739
+ [client]
740
+ );
741
+ const upload = react.useCallback(
742
+ async ({
743
+ file,
744
+ purpose,
745
+ title,
746
+ travellerRef,
747
+ maxAttempts = DEFAULT_MAX_ATTEMPTS,
748
+ signal
749
+ }) => {
750
+ let lastError;
751
+ for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
752
+ const created = await client.files.request({
753
+ tripRef,
754
+ purpose,
755
+ contentType: file.type,
756
+ sizeBytes: file.size,
757
+ // Conditional spreads, not `title: title` — the engine rejects a
758
+ // present-but-undefined key on the wrong purpose the same way it
759
+ // rejects a real one, and "absent" is the only thing that means
760
+ // "no title"/"the whole trip".
761
+ ...title !== void 0 ? { title } : {},
762
+ ...travellerRef !== void 0 ? { travellerRef } : {},
763
+ ...signal !== void 0 ? { signal } : {}
764
+ });
765
+ try {
766
+ const put = await fetch(created.uploadUrl, {
767
+ method: "PUT",
768
+ headers: { "Content-Type": file.type },
769
+ body: file,
770
+ ...signal !== void 0 ? { signal } : {}
771
+ });
772
+ if (!put.ok) {
773
+ lastError = new Error(`Upload PUT failed with status ${put.status}`);
774
+ continue;
775
+ }
776
+ } catch (putError) {
777
+ lastError = putError;
778
+ continue;
779
+ }
780
+ try {
781
+ return await client.files.confirm({
782
+ fileId: created.fileId,
783
+ ...signal !== void 0 ? { signal } : {}
784
+ });
785
+ } catch (confirmError) {
786
+ lastError = confirmError;
787
+ }
788
+ }
789
+ throw lastError instanceof Error ? lastError : new Error("File upload did not confirm after retrying.");
790
+ },
791
+ [client, tripRef]
792
+ );
793
+ return { request, confirm, meta, url, list, managerView, upload };
794
+ }
795
+ var useFloatInternal = createDomainHook("float", (tripRef) => {
796
+ const client$1 = chunkEM7JV3D7_cjs.useKaafilClient();
797
+ const { rows: movements, syncedAt } = useSnapshotList(tripRef, "float");
798
+ const [summaryRows, setSummaryRows] = react.useState([]);
799
+ const [summaryLoaded, setSummaryLoaded] = react.useState(false);
800
+ const [summaryFetchFailed, setSummaryFetchFailed] = react.useState(false);
801
+ const [summaryFetchedAt, setSummaryFetchedAt] = react.useState(void 0);
802
+ const refreshSummary = react.useCallback(async () => {
803
+ try {
804
+ const response = await client$1.float.readSummary({ tripRef });
805
+ setSummaryRows(response.data);
806
+ setSummaryLoaded(true);
807
+ setSummaryFetchFailed(false);
808
+ setSummaryFetchedAt(response.meta.serverTime);
809
+ } catch {
810
+ setSummaryFetchFailed(true);
811
+ }
812
+ }, [client$1, tripRef]);
813
+ react.useEffect(() => {
814
+ void refreshSummary();
815
+ }, [refreshSummary]);
816
+ const issueMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
817
+ tripRef,
818
+ enqueue: (engine, input) => engine.enqueue({
819
+ tripRef,
820
+ method: client.SyncOpMethod.Post,
821
+ path: `/api/v1/trips/${tripRef}/float/issue`,
822
+ // `OperationId` is not exported from `kaafil-js/client`'s public
823
+ // surface (verified, same gap `useRooming.ts` documents for its own
824
+ // literal operationId casts).
825
+ operationId: "issueFloat",
826
+ body: input
827
+ }),
828
+ // The desk lane. All three float writes take the admin triple — `return`
829
+ // included, contrary to what this file used to claim — and a desk
830
+ // console mounts no `OfflineShell`, so without these the writes have no
831
+ // transport at all.
832
+ direct: (liveClient, input) => liveClient.float.issue({ tripRef, ...input })
833
+ });
834
+ const returnMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
835
+ tripRef,
836
+ enqueue: (engine, input) => engine.enqueue({
837
+ tripRef,
838
+ method: client.SyncOpMethod.Post,
839
+ path: `/api/v1/trips/${tripRef}/float/return`,
840
+ operationId: "returnFloat",
841
+ body: input
842
+ }),
843
+ direct: (liveClient, input) => liveClient.float.return({ tripRef, ...input })
844
+ });
845
+ const adjustMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
846
+ tripRef,
847
+ enqueue: (engine, input) => engine.enqueue({
848
+ tripRef,
849
+ method: client.SyncOpMethod.Post,
850
+ path: `/api/v1/trips/${tripRef}/float/adjust`,
851
+ operationId: "adjustFloat",
852
+ body: input
853
+ }),
854
+ direct: (liveClient, input) => liveClient.float.adjust({ tripRef, ...input })
855
+ });
856
+ const issueMutate = issueMutation.mutate;
857
+ const issue = react.useCallback(
858
+ async (input) => {
859
+ const op = await issueMutate(input);
860
+ void refreshSummary();
861
+ return op;
862
+ },
863
+ [issueMutate, refreshSummary]
864
+ );
865
+ const returnMutate = returnMutation.mutate;
866
+ const returnFloat = react.useCallback(
867
+ async (input) => {
868
+ const op = await returnMutate(input);
869
+ void refreshSummary();
870
+ return op;
871
+ },
872
+ [returnMutate, refreshSummary]
873
+ );
874
+ const adjustMutate = adjustMutation.mutate;
875
+ const adjust = react.useCallback(
876
+ async (input) => {
877
+ const op = await adjustMutate(input);
878
+ void refreshSummary();
879
+ return op;
880
+ },
881
+ [adjustMutate, refreshSummary]
882
+ );
883
+ const readLedger = react.useCallback(
884
+ (managerId) => client$1.float.readLedger({ tripRef, managerId }),
885
+ [client$1, tripRef]
886
+ );
887
+ return {
888
+ movements,
889
+ syncedAt,
890
+ readLedger,
891
+ summary: {
892
+ rows: summaryRows,
893
+ loaded: summaryLoaded,
894
+ lastFetchFailed: summaryFetchFailed,
895
+ fetchedAt: summaryFetchedAt,
896
+ refresh: refreshSummary
897
+ },
898
+ issue,
899
+ return: returnFloat,
900
+ adjust
901
+ };
902
+ });
903
+ function useFloat(tripRef) {
904
+ return useFloatInternal(tripRef);
905
+ }
906
+ var FORM_FIELD_KIND_SINGLE_BOOLEAN = "CHECKBOX";
907
+ var useFormsInternal = createDomainHook("forms", (tripRef) => {
908
+ const client$1 = chunkEM7JV3D7_cjs.useKaafilClient();
909
+ const engine = react.useContext(chunkEM7JV3D7_cjs.OfflineEngineContext);
910
+ const [forms, setForms] = react.useState([]);
911
+ const [syncedAt, setSyncedAt] = react.useState(void 0);
912
+ const refreshForms = react.useCallback(async () => {
913
+ try {
914
+ const response = await client$1.forms.trip.list({ tripRef });
915
+ setForms(response.items);
916
+ setSyncedAt(response.meta.serverTime);
917
+ } catch {
918
+ }
919
+ }, [client$1, tripRef]);
920
+ react.useEffect(() => {
921
+ void refreshForms();
922
+ }, [refreshForms]);
923
+ const refreshFormsAfterDrain = react.useCallback(() => {
924
+ if (engine === null) {
925
+ return;
926
+ }
927
+ const unsubscribe = engine.events.on("sync.drained", () => {
928
+ unsubscribe();
929
+ void refreshForms();
930
+ });
931
+ }, [engine, refreshForms]);
932
+ const getDefinition = react.useCallback(
933
+ async (formId) => client$1.forms.get({ formId }),
934
+ [client$1]
935
+ );
936
+ const getResponse = react.useCallback(
937
+ async (formId, responseId) => client$1.forms.responses.get({ formId, responseId }),
938
+ [client$1]
939
+ );
940
+ const travellerResponses = react.useCallback(
941
+ async (travellerRef) => {
942
+ const response = await client$1.forms.trip.travellerResponses.list({ tripRef, travellerRef });
943
+ return response.items;
944
+ },
945
+ [client$1, tripRef]
946
+ );
947
+ const formResponses = react.useCallback(
948
+ async (formId) => {
949
+ const response = await client$1.forms.trip.responses.list({ tripRef, formId });
950
+ return response.items;
951
+ },
952
+ [client$1, tripRef]
953
+ );
954
+ const submitMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
955
+ tripRef,
956
+ enqueue: (engine2, input) => {
957
+ const { formId, ...body } = input;
958
+ return engine2.enqueue({
959
+ tripRef,
960
+ method: client.SyncOpMethod.Post,
961
+ path: `/api/v1/trips/${tripRef}/forms/${formId}/responses`,
962
+ // Hardcoded literal, not imported: `OperationId` is not exported
963
+ // from `kaafil-js/client`'s public surface (same reasoning
964
+ // `useRooming.ts` documents). Verified against
965
+ // `kaafil-js/src/generated/security.ts` this session:
966
+ // `OperationId.ManagerCreateFormResponse === 'managerCreateFormResponse'`.
967
+ operationId: "managerCreateFormResponse",
968
+ body
969
+ });
970
+ },
971
+ // THE DESK LANE. On-behalf capture is exactly what an office does when
972
+ // a traveller phones in an answer, and a desk console mounts no
973
+ // `OfflineShell` — without this the write has no transport at all.
974
+ // `idempotencyKey` is OPTIONAL on `ManagerCreateFormResponseOptions`,
975
+ // so nothing here mints one (hard rule #4).
976
+ direct: (liveClient, input) => {
977
+ const { formId, ...body } = input;
978
+ return liveClient.forms.trip.responses.create({ tripRef, formId, ...body });
979
+ }
980
+ });
981
+ const submitMutate = submitMutation.mutate;
982
+ const submitResponse = react.useCallback(
983
+ async (input) => {
984
+ const op = await submitMutate(input);
985
+ void refreshForms();
986
+ refreshFormsAfterDrain();
987
+ return op;
988
+ },
989
+ [submitMutate, refreshForms, refreshFormsAfterDrain]
990
+ );
991
+ const completion = react.useCallback(async () => {
992
+ const response = await client$1.forms.trip.completion({ tripRef });
993
+ return response.items;
994
+ }, [client$1, tripRef]);
995
+ const dispatch = react.useCallback(
996
+ async (input) => {
997
+ const { formId, ...body } = input;
998
+ await client$1.forms.trip.dispatch({ tripRef, formId, ...body });
999
+ void refreshForms();
1000
+ },
1001
+ [client$1, tripRef, refreshForms]
1002
+ );
1003
+ const exportResponses = react.useCallback(
1004
+ (input) => client$1.forms.responses.export(input),
1005
+ [client$1]
1006
+ );
1007
+ const consentReceipt = react.useCallback(
1008
+ (input) => client$1.forms.responses.consentReceipt(input),
1009
+ [client$1]
1010
+ );
1011
+ const listAgencyForms = react.useCallback(async () => {
1012
+ const response = await client$1.forms.list({});
1013
+ return response.items;
1014
+ }, [client$1]);
1015
+ const createForm = react.useCallback(
1016
+ async (input) => client$1.forms.create(input),
1017
+ [client$1]
1018
+ );
1019
+ const patchForm = react.useCallback(
1020
+ async (input) => client$1.forms.patch(input),
1021
+ [client$1]
1022
+ );
1023
+ const publishForm = react.useCallback(
1024
+ async (formId) => client$1.forms.publish({ formId }),
1025
+ [client$1]
1026
+ );
1027
+ const closeForm = react.useCallback(
1028
+ async (formId) => client$1.forms.close({ formId }),
1029
+ [client$1]
1030
+ );
1031
+ const reopenForm = react.useCallback(
1032
+ async (formId) => client$1.forms.reopen({ formId }),
1033
+ [client$1]
1034
+ );
1035
+ const archiveForm = react.useCallback(
1036
+ async (formId) => client$1.forms.archive({ formId }),
1037
+ [client$1]
1038
+ );
1039
+ const unarchiveForm = react.useCallback(
1040
+ async (formId) => client$1.forms.unarchive({ formId }),
1041
+ [client$1]
1042
+ );
1043
+ const cloneForm = react.useCallback(
1044
+ async (input) => client$1.forms.clone(input),
1045
+ [client$1]
1046
+ );
1047
+ const reorderForm = react.useCallback(
1048
+ async (input) => {
1049
+ await client$1.forms.reorder(input);
1050
+ },
1051
+ [client$1]
1052
+ );
1053
+ const createSection = react.useCallback(
1054
+ async (input) => client$1.forms.sections.create(input),
1055
+ [client$1]
1056
+ );
1057
+ const patchSection = react.useCallback(
1058
+ async (input) => client$1.forms.sections.patch(input),
1059
+ [client$1]
1060
+ );
1061
+ const deleteSection = react.useCallback(
1062
+ async (input) => {
1063
+ await client$1.forms.sections.delete(input);
1064
+ },
1065
+ [client$1]
1066
+ );
1067
+ const createField = react.useCallback(
1068
+ async (input) => client$1.forms.fields.create(input),
1069
+ [client$1]
1070
+ );
1071
+ const patchField = react.useCallback(
1072
+ async (input) => client$1.forms.fields.patch(input),
1073
+ [client$1]
1074
+ );
1075
+ const deleteField = react.useCallback(
1076
+ async (input) => {
1077
+ await client$1.forms.fields.delete(input);
1078
+ },
1079
+ [client$1]
1080
+ );
1081
+ const listBindings = react.useCallback(async () => {
1082
+ const response = await client$1.forms.bindings.list();
1083
+ return response.items;
1084
+ }, [client$1]);
1085
+ return {
1086
+ forms,
1087
+ syncedAt,
1088
+ getDefinition,
1089
+ getResponse,
1090
+ travellerResponses,
1091
+ formResponses,
1092
+ submitResponse,
1093
+ refresh: refreshForms,
1094
+ completion,
1095
+ dispatch,
1096
+ exportResponses,
1097
+ consentReceipt,
1098
+ listAgencyForms,
1099
+ createForm,
1100
+ patchForm,
1101
+ publishForm,
1102
+ closeForm,
1103
+ reopenForm,
1104
+ archiveForm,
1105
+ unarchiveForm,
1106
+ cloneForm,
1107
+ reorderForm,
1108
+ createSection,
1109
+ patchSection,
1110
+ deleteSection,
1111
+ createField,
1112
+ patchField,
1113
+ deleteField,
1114
+ listBindings
1115
+ };
1116
+ });
1117
+ function useForms(tripRef) {
1118
+ return useFormsInternal(tripRef);
1119
+ }
1120
+ function isLiveItineraryItem(row) {
1121
+ return !("_tombstone" in row);
1122
+ }
1123
+ function useItinerary(tripRef) {
1124
+ const client$1 = chunkEM7JV3D7_cjs.useKaafilClient();
1125
+ const [trip, setTrip] = react.useState(void 0);
1126
+ const [initialDayIso, setInitialDayIso] = react.useState(void 0);
1127
+ const [canAddItems, setCanAddItems] = react.useState(false);
1128
+ const [canAddItemsReason, setCanAddItemsReason] = react.useState(null);
1129
+ const [days, setDays] = react.useState([]);
1130
+ const [items, setItems] = react.useState([]);
1131
+ const [loaded, setLoaded] = react.useState(false);
1132
+ const [lastFetchFailed, setLastFetchFailed] = react.useState(false);
1133
+ const [syncedAt, setSyncedAt] = react.useState(void 0);
1134
+ const refresh = react.useCallback(async () => {
1135
+ try {
1136
+ const response = await client$1.itinerary.read({ tripRef });
1137
+ setTrip(response.trip);
1138
+ setInitialDayIso(response.initialDayIso);
1139
+ setCanAddItems(response.canAddItems);
1140
+ setCanAddItemsReason(response.canAddItemsReason);
1141
+ setDays(response.days);
1142
+ setItems(response.items.filter(isLiveItineraryItem));
1143
+ setLoaded(true);
1144
+ setLastFetchFailed(false);
1145
+ setSyncedAt(response.meta.serverTime);
1146
+ } catch {
1147
+ setLastFetchFailed(true);
1148
+ }
1149
+ }, [client$1, tripRef]);
1150
+ react.useEffect(() => {
1151
+ void refresh();
1152
+ }, [refresh]);
1153
+ const [changeLog, setChangeLog] = react.useState([]);
1154
+ const [changeLogLoaded, setChangeLogLoaded] = react.useState(false);
1155
+ const [changeLogFetchFailed, setChangeLogFetchFailed] = react.useState(false);
1156
+ const loadChangeLog = react.useCallback(
1157
+ async (input) => {
1158
+ try {
1159
+ const response = await client$1.itinerary.changeLog.list({ tripRef, ...input });
1160
+ setChangeLog(response);
1161
+ setChangeLogLoaded(true);
1162
+ setChangeLogFetchFailed(false);
1163
+ } catch {
1164
+ setChangeLogFetchFailed(true);
1165
+ }
1166
+ },
1167
+ [client$1, tripRef]
1168
+ );
1169
+ const patchDayMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1170
+ tripRef,
1171
+ enqueue: (engine, input) => {
1172
+ const { dayIndex, version, ...body } = input;
1173
+ return engine.enqueue({
1174
+ tripRef,
1175
+ method: client.SyncOpMethod.Patch,
1176
+ path: `/api/v1/trips/${tripRef}/itinerary/days/${dayIndex}`,
1177
+ operationId: "patchItineraryDay",
1178
+ body,
1179
+ ifMatch: version
1180
+ });
1181
+ },
1182
+ direct: (client2, input) => client2.itinerary.days.patch({ tripRef, ...input })
1183
+ });
1184
+ const patchDayMutate = patchDayMutation.mutate;
1185
+ const patchDay = react.useCallback(
1186
+ async (input) => {
1187
+ const op = await patchDayMutate(input);
1188
+ void refresh();
1189
+ return op;
1190
+ },
1191
+ [patchDayMutate, refresh]
1192
+ );
1193
+ const addItemMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1194
+ tripRef,
1195
+ enqueue: (engine, input) => engine.enqueue({
1196
+ tripRef,
1197
+ method: client.SyncOpMethod.Post,
1198
+ path: `/api/v1/trips/${tripRef}/itinerary/items`,
1199
+ operationId: "addItineraryItem",
1200
+ body: input
1201
+ }),
1202
+ direct: (client2, input) => client2.itinerary.items.add({ tripRef, ...input })
1203
+ });
1204
+ const addItemMutate = addItemMutation.mutate;
1205
+ const addItem = react.useCallback(
1206
+ async (input) => {
1207
+ const op = await addItemMutate(input);
1208
+ void refresh();
1209
+ return op;
1210
+ },
1211
+ [addItemMutate, refresh]
1212
+ );
1213
+ const patchItemMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1214
+ tripRef,
1215
+ enqueue: (engine, input) => {
1216
+ const { itemId, version, ...body } = input;
1217
+ return engine.enqueue({
1218
+ tripRef,
1219
+ method: client.SyncOpMethod.Patch,
1220
+ path: `/api/v1/trips/${tripRef}/itinerary/items/${itemId}`,
1221
+ operationId: "patchItineraryItem",
1222
+ body,
1223
+ ifMatch: version
1224
+ });
1225
+ },
1226
+ direct: (client2, input) => client2.itinerary.items.patch({ tripRef, ...input })
1227
+ });
1228
+ const patchItemMutate = patchItemMutation.mutate;
1229
+ const patchItem = react.useCallback(
1230
+ async (input) => {
1231
+ const op = await patchItemMutate(input);
1232
+ void refresh();
1233
+ return op;
1234
+ },
1235
+ [patchItemMutate, refresh]
1236
+ );
1237
+ const removeItemMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1238
+ tripRef,
1239
+ enqueue: (engine, input) => {
1240
+ const { itemId, version } = input;
1241
+ return engine.enqueue({
1242
+ tripRef,
1243
+ method: client.SyncOpMethod.Delete,
1244
+ path: `/api/v1/trips/${tripRef}/itinerary/items/${itemId}`,
1245
+ operationId: "deleteItineraryItem",
1246
+ ifMatch: version
1247
+ });
1248
+ },
1249
+ direct: (client2, input) => client2.itinerary.items.remove({ tripRef, ...input })
1250
+ });
1251
+ const removeItemMutate = removeItemMutation.mutate;
1252
+ const removeItem = react.useCallback(
1253
+ async (input) => {
1254
+ const op = await removeItemMutate(input);
1255
+ void refresh();
1256
+ return op;
1257
+ },
1258
+ [removeItemMutate, refresh]
1259
+ );
1260
+ const reorderItemMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1261
+ tripRef,
1262
+ enqueue: (engine, input) => {
1263
+ const { itemId, ...body } = input;
1264
+ return engine.enqueue({
1265
+ tripRef,
1266
+ method: client.SyncOpMethod.Post,
1267
+ path: `/api/v1/trips/${tripRef}/itinerary/items/${itemId}/reorder`,
1268
+ operationId: "reorderItineraryItem",
1269
+ body
1270
+ });
1271
+ },
1272
+ direct: (client2, input) => client2.itinerary.items.reorder({ tripRef, ...input })
1273
+ });
1274
+ const reorderItemMutate = reorderItemMutation.mutate;
1275
+ const reorderItem = react.useCallback(
1276
+ async (input) => {
1277
+ const op = await reorderItemMutate(input);
1278
+ void refresh();
1279
+ return op;
1280
+ },
1281
+ [reorderItemMutate, refresh]
1282
+ );
1283
+ if (!loaded && !lastFetchFailed) {
1284
+ return { status: "loading" };
1285
+ }
1286
+ if (!loaded && lastFetchFailed) {
1287
+ return { status: "error" };
1288
+ }
1289
+ return {
1290
+ status: "ready",
1291
+ trip,
1292
+ initialDayIso,
1293
+ canAddItems,
1294
+ canAddItemsReason,
1295
+ days,
1296
+ items,
1297
+ loaded,
1298
+ lastFetchFailed,
1299
+ syncedAt,
1300
+ refresh,
1301
+ changeLog,
1302
+ changeLogLoaded,
1303
+ changeLogFetchFailed,
1304
+ loadChangeLog,
1305
+ patchDay,
1306
+ addItem,
1307
+ patchItem,
1308
+ removeItem,
1309
+ reorderItem
1310
+ };
1311
+ }
1312
+ function useManagers(tripRef) {
1313
+ const client = chunkEM7JV3D7_cjs.useKaafilClient();
1314
+ const persona = chunkEM7JV3D7_cjs.usePersona();
1315
+ const [result, setResult] = react.useState({ status: "loading" });
1316
+ react.useEffect(() => {
1317
+ if (persona === "share") {
1318
+ if (chunkEM7JV3D7_cjs.isDevelopment()) {
1319
+ throw new Error(
1320
+ "useManagers() was called from a share session \u2014 it is manager/agencyAdmin only."
1321
+ );
1322
+ }
1323
+ return;
1324
+ }
1325
+ let cancelled = false;
1326
+ setResult({ status: "loading" });
1327
+ void Promise.resolve().then(() => client.trips.managers.list({ tripRef })).then((managers) => {
1328
+ if (!cancelled) {
1329
+ setResult({ status: "ready", managers });
1330
+ }
1331
+ }).catch((error) => {
1332
+ if (!cancelled) {
1333
+ setResult({ status: "error", error: classifyError(error) });
1334
+ }
1335
+ });
1336
+ return () => {
1337
+ cancelled = true;
1338
+ };
1339
+ }, [client, persona, tripRef]);
1340
+ return result;
1341
+ }
1342
+ function useManagerToday(tripRef) {
1343
+ const client = chunkEM7JV3D7_cjs.useKaafilClient();
1344
+ const [result, setResult] = react.useState({ status: "loading" });
1345
+ react.useEffect(() => {
1346
+ let cancelled = false;
1347
+ setResult({ status: "loading" });
1348
+ client.managerToday.read({ tripRef }).then((response) => {
1349
+ if (cancelled) {
1350
+ return;
1351
+ }
1352
+ const { meta, ...data } = response;
1353
+ setResult({ status: "ready", ...data, syncedAt: meta.serverTime });
1354
+ }).catch(() => {
1355
+ if (!cancelled) {
1356
+ setResult({ status: "error" });
1357
+ }
1358
+ });
1359
+ return () => {
1360
+ cancelled = true;
1361
+ };
1362
+ }, [client, tripRef]);
1363
+ return result;
1364
+ }
1365
+ function isLiveParty(row) {
1366
+ return !("_tombstone" in row);
1367
+ }
1368
+ function useParties(tripRef) {
1369
+ const client$1 = chunkEM7JV3D7_cjs.useKaafilClient();
1370
+ const [rows, setRows] = react.useState([]);
1371
+ const [listLoaded, setListLoaded] = react.useState(false);
1372
+ const [listFetchFailed, setListFetchFailed] = react.useState(false);
1373
+ const [listFetchedAt, setListFetchedAt] = react.useState(void 0);
1374
+ const [firstLoadError, setFirstLoadError] = react.useState(void 0);
1375
+ const refreshList = react.useCallback(async () => {
1376
+ try {
1377
+ const response = await client$1.trips.parties.list({ tripRef });
1378
+ setRows(response.filter(isLiveParty));
1379
+ setListLoaded(true);
1380
+ setListFetchFailed(false);
1381
+ setListFetchedAt(response.meta.serverTime);
1382
+ setFirstLoadError(void 0);
1383
+ } catch (error) {
1384
+ setListFetchFailed(true);
1385
+ setFirstLoadError((previous) => previous ?? classifyError(error));
1386
+ }
1387
+ }, [client$1, tripRef]);
1388
+ react.useEffect(() => {
1389
+ void refreshList();
1390
+ }, [refreshList]);
1391
+ const [rosterRows, setRosterRows] = react.useState([]);
1392
+ const [rosterLoaded, setRosterLoaded] = react.useState(false);
1393
+ const [rosterFetchFailed, setRosterFetchFailed] = react.useState(false);
1394
+ const [rosterFetchedAt, setRosterFetchedAt] = react.useState(void 0);
1395
+ const refreshRoster = react.useCallback(async () => {
1396
+ try {
1397
+ const response = await client$1.travellers.listForTrip({ tripRef });
1398
+ setRosterRows(response);
1399
+ setRosterLoaded(true);
1400
+ setRosterFetchFailed(false);
1401
+ setRosterFetchedAt(response.meta.serverTime);
1402
+ } catch {
1403
+ setRosterFetchFailed(true);
1404
+ }
1405
+ }, [client$1, tripRef]);
1406
+ react.useEffect(() => {
1407
+ void refreshRoster();
1408
+ }, [refreshRoster]);
1409
+ const addMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1410
+ tripRef,
1411
+ enqueue: (engine, input) => engine.enqueue({
1412
+ tripRef,
1413
+ method: client.SyncOpMethod.Post,
1414
+ path: `/api/v1/trips/${tripRef}/parties`,
1415
+ operationId: "createParty",
1416
+ body: input
1417
+ })
1418
+ });
1419
+ const patchMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1420
+ tripRef,
1421
+ enqueue: (engine, input) => {
1422
+ const { partyId, version, ...body } = input;
1423
+ return engine.enqueue({
1424
+ tripRef,
1425
+ method: client.SyncOpMethod.Patch,
1426
+ path: `/api/v1/trips/${tripRef}/parties/${partyId}`,
1427
+ operationId: "patchParty",
1428
+ body,
1429
+ ifMatch: version
1430
+ });
1431
+ }
1432
+ });
1433
+ const removeMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1434
+ tripRef,
1435
+ enqueue: (engine, input) => {
1436
+ const { partyId } = input;
1437
+ return engine.enqueue({
1438
+ tripRef,
1439
+ method: client.SyncOpMethod.Delete,
1440
+ path: `/api/v1/trips/${tripRef}/parties/${partyId}`,
1441
+ operationId: "deleteParty"
1442
+ });
1443
+ }
1444
+ });
1445
+ const addMutate = addMutation.mutate;
1446
+ const add = react.useCallback(
1447
+ async (input) => {
1448
+ const op = await addMutate(input);
1449
+ void refreshList();
1450
+ return op;
1451
+ },
1452
+ [addMutate, refreshList]
1453
+ );
1454
+ const patchMutate = patchMutation.mutate;
1455
+ const patch = react.useCallback(
1456
+ async (input) => {
1457
+ const op = await patchMutate(input);
1458
+ void refreshList();
1459
+ return op;
1460
+ },
1461
+ [patchMutate, refreshList]
1462
+ );
1463
+ const removeMutate = removeMutation.mutate;
1464
+ const remove = react.useCallback(
1465
+ async (input) => {
1466
+ const op = await removeMutate(input);
1467
+ void refreshList();
1468
+ return op;
1469
+ },
1470
+ [removeMutate, refreshList]
1471
+ );
1472
+ if (!listLoaded && !listFetchFailed) {
1473
+ return { status: "loading" };
1474
+ }
1475
+ if (!listLoaded && listFetchFailed) {
1476
+ return {
1477
+ status: "error",
1478
+ error: firstLoadError ?? {
1479
+ path: "surface-to-user",
1480
+ code: void 0,
1481
+ status: void 0,
1482
+ unsatisfiableScheme: false,
1483
+ cause: void 0
1484
+ },
1485
+ retry: refreshList
1486
+ };
1487
+ }
1488
+ return {
1489
+ status: "ready",
1490
+ list: {
1491
+ rows,
1492
+ loaded: listLoaded,
1493
+ lastFetchFailed: listFetchFailed,
1494
+ fetchedAt: listFetchedAt,
1495
+ refresh: refreshList
1496
+ },
1497
+ tripRoster: {
1498
+ rows: rosterRows,
1499
+ loaded: rosterLoaded,
1500
+ lastFetchFailed: rosterFetchFailed,
1501
+ fetchedAt: rosterFetchedAt,
1502
+ refresh: refreshRoster
1503
+ },
1504
+ add,
1505
+ patch,
1506
+ remove
1507
+ };
1508
+ }
1509
+ var usePickupsInternal = createDomainHook("pickup-points", (tripRef) => {
1510
+ const client$1 = chunkEM7JV3D7_cjs.useKaafilClient();
1511
+ const {
1512
+ rows: stops,
1513
+ syncedAt,
1514
+ refreshLive
1515
+ } = useSnapshotList(tripRef, "pickups", {
1516
+ live: async (liveClient, ref) => {
1517
+ const response = await liveClient.pickups.list({ tripRef: ref });
1518
+ return { rows: response, syncedAt: response.meta.serverTime };
1519
+ }
1520
+ });
1521
+ const createMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1522
+ tripRef,
1523
+ enqueue: (engine, input) => engine.enqueue({
1524
+ tripRef,
1525
+ method: client.SyncOpMethod.Post,
1526
+ path: `/api/v1/trips/${tripRef}/pickups`,
1527
+ // `OperationId` is not exported from `kaafil-js/client`'s public
1528
+ // surface (verified, same gap `useRooming.ts` documents) — every
1529
+ // literal below is checked against `kaafil-js/src/generated/
1530
+ // security.ts`'s own operation-id table.
1531
+ operationId: "createPickupStop",
1532
+ body: input
1533
+ }),
1534
+ // The desk lane. `board`, `close` and `reopen` below deliberately get
1535
+ // NONE — they are `managerAuth`-only on the wire, so a direct call from
1536
+ // an agency-admin session would be refused by `CredentialResolver`
1537
+ // before it left the process. See this file's own persona note.
1538
+ direct: (liveClient, input) => liveClient.pickups.create({ tripRef, ...input })
1539
+ });
1540
+ const patchMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1541
+ tripRef,
1542
+ enqueue: (engine, input) => {
1543
+ const { pointId, version, ...body } = input;
1544
+ return engine.enqueue({
1545
+ tripRef,
1546
+ method: client.SyncOpMethod.Patch,
1547
+ path: `/api/v1/trips/${tripRef}/pickups/${pointId}`,
1548
+ operationId: "patchPickupStop",
1549
+ body,
1550
+ ifMatch: version
1551
+ });
1552
+ },
1553
+ direct: (liveClient, input) => liveClient.pickups.patch({ tripRef, ...input })
1554
+ });
1555
+ const removeMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1556
+ tripRef,
1557
+ enqueue: (engine, input) => {
1558
+ const { pointId, version, force } = input;
1559
+ const query = force === true ? "?force=true" : "";
1560
+ return engine.enqueue({
1561
+ tripRef,
1562
+ method: client.SyncOpMethod.Delete,
1563
+ path: `/api/v1/trips/${tripRef}/pickups/${pointId}${query}`,
1564
+ operationId: "deletePickupStop",
1565
+ ifMatch: version
1566
+ });
1567
+ },
1568
+ direct: (liveClient, input) => liveClient.pickups.remove({ tripRef, ...input })
1569
+ });
1570
+ const reorderMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1571
+ tripRef,
1572
+ enqueue: (engine, input) => engine.enqueue({
1573
+ tripRef,
1574
+ method: client.SyncOpMethod.Post,
1575
+ path: `/api/v1/trips/${tripRef}/pickups/reorder`,
1576
+ operationId: "reorderPickupStops",
1577
+ body: input
1578
+ }),
1579
+ direct: (liveClient, input) => liveClient.pickups.reorder({ tripRef, ...input })
1580
+ });
1581
+ const assignMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1582
+ tripRef,
1583
+ enqueue: (engine, input) => {
1584
+ const { pointId, ...body } = input;
1585
+ return engine.enqueue({
1586
+ tripRef,
1587
+ method: client.SyncOpMethod.Post,
1588
+ path: `/api/v1/trips/${tripRef}/pickups/${pointId}/assign`,
1589
+ operationId: "assignPickupTraveller",
1590
+ body
1591
+ });
1592
+ },
1593
+ direct: (liveClient, input) => liveClient.pickups.assign({ tripRef, ...input })
1594
+ });
1595
+ const boardMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1596
+ tripRef,
1597
+ enqueue: (engine, input) => {
1598
+ const { pointId, ...body } = input;
1599
+ return engine.enqueue({
1600
+ tripRef,
1601
+ method: client.SyncOpMethod.Post,
1602
+ path: `/api/v1/trips/${tripRef}/pickups/${pointId}/board`,
1603
+ operationId: "boardPickupTraveller",
1604
+ body
1605
+ });
1606
+ }
1607
+ });
1608
+ const correctBoardStatusMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1609
+ tripRef,
1610
+ enqueue: (engine, input) => {
1611
+ const { pointId, travellerId, ...body } = input;
1612
+ return engine.enqueue({
1613
+ tripRef,
1614
+ method: client.SyncOpMethod.Patch,
1615
+ path: `/api/v1/trips/${tripRef}/pickups/${pointId}/board/${travellerId}`,
1616
+ operationId: "correctPickupBoardStatus",
1617
+ body
1618
+ });
1619
+ },
1620
+ // The office's ONE door onto the board table, so it needs the desk lane
1621
+ // as much as the five stop writes do — `board`/`close`/`reopen` below
1622
+ // still get none, because they are `managerAuth`-only.
1623
+ direct: (liveClient, input) => liveClient.pickups.correctBoardStatus({ tripRef, ...input })
1624
+ });
1625
+ const closeMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1626
+ tripRef,
1627
+ enqueue: (engine, input) => {
1628
+ const { pointId, ...body } = input;
1629
+ return engine.enqueue({
1630
+ tripRef,
1631
+ method: client.SyncOpMethod.Post,
1632
+ path: `/api/v1/trips/${tripRef}/pickups/${pointId}/close`,
1633
+ operationId: "closePickupStop",
1634
+ body
1635
+ });
1636
+ }
1637
+ });
1638
+ const reopenMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1639
+ tripRef,
1640
+ enqueue: (engine, input) => {
1641
+ const { pointId } = input;
1642
+ return engine.enqueue({
1643
+ tripRef,
1644
+ method: client.SyncOpMethod.Post,
1645
+ path: `/api/v1/trips/${tripRef}/pickups/${pointId}/reopen`,
1646
+ operationId: "reopenPickupStop"
1647
+ });
1648
+ }
1649
+ });
1650
+ const reassign = react.useCallback(
1651
+ (input) => client$1.pickups.reassign({ tripRef, ...input }),
1652
+ [client$1, tripRef]
1653
+ );
1654
+ const manifestByPickup = react.useCallback(
1655
+ (input) => client$1.pickups.manifestByPickup({ tripRef, ...input }),
1656
+ [client$1, tripRef]
1657
+ );
1658
+ return {
1659
+ stops,
1660
+ syncedAt,
1661
+ refreshLive,
1662
+ create: createMutation.mutate,
1663
+ patch: patchMutation.mutate,
1664
+ remove: removeMutation.mutate,
1665
+ reorder: reorderMutation.mutate,
1666
+ assign: assignMutation.mutate,
1667
+ reassign,
1668
+ board: boardMutation.mutate,
1669
+ correctBoardStatus: correctBoardStatusMutation.mutate,
1670
+ close: closeMutation.mutate,
1671
+ reopen: reopenMutation.mutate,
1672
+ manifestByPickup
1673
+ };
1674
+ });
1675
+ function usePickups(tripRef) {
1676
+ return usePickupsInternal(tripRef);
1677
+ }
1678
+ var useRoomingInternal = createDomainHook("rooming", (tripRef) => {
1679
+ const client$1 = chunkEM7JV3D7_cjs.useKaafilClient();
1680
+ const {
1681
+ rows: rooms,
1682
+ syncedAt: roomsSyncedAt,
1683
+ refreshLive: refreshRoomsLive
1684
+ } = useSnapshotList(tripRef, "rooming", {
1685
+ live: async (liveClient, ref) => {
1686
+ const response = await liveClient.rooming.read({ tripRef: ref });
1687
+ return { rows: response.rooms, syncedAt: response.meta.serverTime };
1688
+ }
1689
+ });
1690
+ const {
1691
+ rows: stayWindows,
1692
+ syncedAt: windowsSyncedAt,
1693
+ refreshLive: refreshWindowsLive
1694
+ } = useSnapshotList(tripRef, "stayWindows", {
1695
+ live: async (liveClient, ref) => {
1696
+ const response = await liveClient.rooming.stayWindows.list({ tripRef: ref });
1697
+ return { rows: response, syncedAt: response.meta.serverTime };
1698
+ }
1699
+ });
1700
+ const refreshLive = react.useCallback(async () => {
1701
+ await Promise.all([refreshRoomsLive(), refreshWindowsLive()]);
1702
+ }, [refreshRoomsLive, refreshWindowsLive]);
1703
+ const assignMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1704
+ tripRef,
1705
+ enqueue: (engine, input) => engine.enqueue({
1706
+ tripRef,
1707
+ method: client.SyncOpMethod.Post,
1708
+ path: `/api/v1/trips/${tripRef}/rooming/assign`,
1709
+ // Hardcoded literal, not imported: `OperationId` is not exported from
1710
+ // `kaafil-js/client`'s public surface (verified — see this worker's
1711
+ // final report). Value verified against
1712
+ // `kaafil-js/src/generated/security.ts` this session.
1713
+ operationId: "assignRoomingBed",
1714
+ body: input,
1715
+ // `RoomingAssignDto.rooms` is every room this write touched, whole —
1716
+ // up to two, on a swap. `arrayKey` is this hook's multi-row rebase
1717
+ // (`OutboxEntityRef.arrayKey`), the reason the room grid now
1718
+ // repaints the instant an assign lands rather than waiting for the
1719
+ // next full pull.
1720
+ entity: { listName: "rooming", arrayKey: "rooms" }
1721
+ }),
1722
+ // The desk lane. Every rooming write takes the admin triple, so unlike
1723
+ // `usePickups` there is no member here that deliberately lacks one.
1724
+ direct: (liveClient, input) => liveClient.rooming.assign({ tripRef, ...input })
1725
+ });
1726
+ const [poolTravellers, setPoolTravellers] = react.useState([]);
1727
+ const [poolLoaded, setPoolLoaded] = react.useState(false);
1728
+ const [poolFetchFailed, setPoolFetchFailed] = react.useState(false);
1729
+ const [poolFetchedAt, setPoolFetchedAt] = react.useState(void 0);
1730
+ const lastRequestedStayWindowIdRef = react.useRef(void 0);
1731
+ const refreshUnassignedPool = react.useCallback(
1732
+ async (stayWindowId) => {
1733
+ lastRequestedStayWindowIdRef.current = stayWindowId;
1734
+ try {
1735
+ const response = await client$1.rooming.read({ tripRef, stayWindowId });
1736
+ setPoolTravellers(response.unassigned);
1737
+ setPoolLoaded(true);
1738
+ setPoolFetchFailed(false);
1739
+ setPoolFetchedAt(response.meta.serverTime);
1740
+ } catch {
1741
+ setPoolFetchFailed(true);
1742
+ }
1743
+ },
1744
+ [client$1, tripRef]
1745
+ );
1746
+ react.useEffect(() => {
1747
+ void refreshUnassignedPool();
1748
+ }, [refreshUnassignedPool]);
1749
+ const assignMutate = assignMutation.mutate;
1750
+ const assign = react.useCallback(
1751
+ async (input) => {
1752
+ const op = await assignMutate(input);
1753
+ void refreshUnassignedPool(lastRequestedStayWindowIdRef.current);
1754
+ return op;
1755
+ },
1756
+ [assignMutate, refreshUnassignedPool]
1757
+ );
1758
+ const createWindowMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1759
+ tripRef,
1760
+ enqueue: (engine, input) => engine.enqueue({
1761
+ tripRef,
1762
+ method: client.SyncOpMethod.Post,
1763
+ path: `/api/v1/trips/${tripRef}/rooming/stay-windows`,
1764
+ operationId: "createRoomingStayWindow",
1765
+ body: input
1766
+ }),
1767
+ direct: (liveClient, input) => liveClient.rooming.stayWindows.create({ tripRef, ...input })
1768
+ });
1769
+ const patchWindowMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1770
+ tripRef,
1771
+ enqueue: (engine, input) => {
1772
+ const { windowId, version, ...body } = input;
1773
+ return engine.enqueue({
1774
+ tripRef,
1775
+ method: client.SyncOpMethod.Patch,
1776
+ path: `/api/v1/trips/${tripRef}/rooming/stay-windows/${windowId}`,
1777
+ operationId: "patchRoomingStayWindow",
1778
+ body,
1779
+ ifMatch: version
1780
+ });
1781
+ },
1782
+ direct: (liveClient, input) => liveClient.rooming.stayWindows.patch({ tripRef, ...input })
1783
+ });
1784
+ const removeWindowMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1785
+ tripRef,
1786
+ enqueue: (engine, input) => {
1787
+ const { windowId, version, force } = input;
1788
+ const query = force === true ? "?force=true" : "";
1789
+ return engine.enqueue({
1790
+ tripRef,
1791
+ method: client.SyncOpMethod.Delete,
1792
+ path: `/api/v1/trips/${tripRef}/rooming/stay-windows/${windowId}${query}`,
1793
+ operationId: "deleteRoomingStayWindow",
1794
+ ifMatch: version
1795
+ });
1796
+ },
1797
+ direct: (liveClient, input) => liveClient.rooming.stayWindows.remove({ tripRef, ...input })
1798
+ });
1799
+ const createRoomMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1800
+ tripRef,
1801
+ enqueue: (engine, input) => engine.enqueue({
1802
+ tripRef,
1803
+ method: client.SyncOpMethod.Post,
1804
+ path: `/api/v1/trips/${tripRef}/rooming/rooms`,
1805
+ operationId: "createRoomingRoom",
1806
+ body: input
1807
+ }),
1808
+ direct: (liveClient, input) => liveClient.rooming.rooms.create({ tripRef, ...input })
1809
+ });
1810
+ const patchRoomMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1811
+ tripRef,
1812
+ enqueue: (engine, input) => {
1813
+ const { roomId, version, ...body } = input;
1814
+ return engine.enqueue({
1815
+ tripRef,
1816
+ method: client.SyncOpMethod.Patch,
1817
+ path: `/api/v1/trips/${tripRef}/rooming/rooms/${roomId}`,
1818
+ operationId: "patchRoomingRoom",
1819
+ body,
1820
+ ifMatch: version
1821
+ });
1822
+ },
1823
+ direct: (liveClient, input) => liveClient.rooming.rooms.patch({ tripRef, ...input })
1824
+ });
1825
+ const removeRoomMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1826
+ tripRef,
1827
+ enqueue: (engine, input) => {
1828
+ const { roomId, version, force } = input;
1829
+ const query = force === true ? "?force=true" : "";
1830
+ return engine.enqueue({
1831
+ tripRef,
1832
+ method: client.SyncOpMethod.Delete,
1833
+ path: `/api/v1/trips/${tripRef}/rooming/rooms/${roomId}${query}`,
1834
+ operationId: "deleteRoomingRoom",
1835
+ ifMatch: version
1836
+ });
1837
+ },
1838
+ direct: (liveClient, input) => liveClient.rooming.rooms.remove({ tripRef, ...input })
1839
+ });
1840
+ const syncedAt = roomsSyncedAt === void 0 ? windowsSyncedAt : windowsSyncedAt === void 0 ? roomsSyncedAt : roomsSyncedAt > windowsSyncedAt ? roomsSyncedAt : windowsSyncedAt;
1841
+ const autoAssign = react.useCallback(
1842
+ (input) => client$1.rooming.autoAssign({ tripRef, ...input }),
1843
+ [client$1, tripRef]
1844
+ );
1845
+ return {
1846
+ rooms,
1847
+ stayWindows,
1848
+ syncedAt,
1849
+ refreshLive,
1850
+ unassignedPool: {
1851
+ travellers: poolTravellers,
1852
+ loaded: poolLoaded,
1853
+ lastFetchFailed: poolFetchFailed,
1854
+ fetchedAt: poolFetchedAt,
1855
+ refresh: refreshUnassignedPool
1856
+ },
1857
+ assign,
1858
+ autoAssign,
1859
+ createStayWindow: createWindowMutation.mutate,
1860
+ patchStayWindow: patchWindowMutation.mutate,
1861
+ removeStayWindow: removeWindowMutation.mutate,
1862
+ createRoom: createRoomMutation.mutate,
1863
+ patchRoom: patchRoomMutation.mutate,
1864
+ removeRoom: removeRoomMutation.mutate
1865
+ };
1866
+ });
1867
+ function useRooming(tripRef) {
1868
+ return useRoomingInternal(tripRef);
1869
+ }
1870
+ var useSeatingInternal = createDomainHook("transport-seating", (tripRef) => {
1871
+ const client$1 = chunkEM7JV3D7_cjs.useKaafilClient();
1872
+ const {
1873
+ rows: vehicles,
1874
+ syncedAt,
1875
+ refreshLive
1876
+ } = useSnapshotList(tripRef, "seating", {
1877
+ live: async (liveClient, ref) => {
1878
+ const response = await liveClient.seating.read({ tripRef: ref });
1879
+ return { rows: response.vehicles, syncedAt: response.meta.serverTime };
1880
+ }
1881
+ });
1882
+ const assignMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1883
+ tripRef,
1884
+ enqueue: (engine, input) => engine.enqueue({
1885
+ tripRef,
1886
+ method: client.SyncOpMethod.Post,
1887
+ path: `/api/v1/trips/${tripRef}/seating/assign`,
1888
+ operationId: "assignSeating",
1889
+ body: input,
1890
+ // `SeatingAssignDto.vehicles` is "every vehicle touched by this
1891
+ // write, whole — a client rebases without a follow-up read" (the
1892
+ // engine DTO's own words) — up to two, on a displacement. `arrayKey`
1893
+ // is this hook's one multi-row rebase (`OutboxEntityRef.arrayKey`),
1894
+ // the reason the vehicle grid now repaints the instant an assign
1895
+ // lands rather than waiting for the next full pull.
1896
+ entity: { listName: "seating", arrayKey: "vehicles" }
1897
+ }),
1898
+ // The desk lane. Every `transport-seating` write takes the admin triple,
1899
+ // so unlike `usePickups` there is no member here that deliberately
1900
+ // lacks one.
1901
+ direct: (liveClient, input) => liveClient.seating.assign({ tripRef, ...input })
1902
+ });
1903
+ const [poolTravellers, setPoolTravellers] = react.useState([]);
1904
+ const [poolLoaded, setPoolLoaded] = react.useState(false);
1905
+ const [poolFetchFailed, setPoolFetchFailed] = react.useState(false);
1906
+ const [poolFetchedAt, setPoolFetchedAt] = react.useState(void 0);
1907
+ const refreshUnassignedPool = react.useCallback(async () => {
1908
+ try {
1909
+ const response = await client$1.seating.read({ tripRef });
1910
+ setPoolTravellers(response.unassignedPool);
1911
+ setPoolLoaded(true);
1912
+ setPoolFetchFailed(false);
1913
+ setPoolFetchedAt(response.meta.serverTime);
1914
+ } catch {
1915
+ setPoolFetchFailed(true);
1916
+ }
1917
+ }, [client$1, tripRef]);
1918
+ react.useEffect(() => {
1919
+ void refreshUnassignedPool();
1920
+ }, [refreshUnassignedPool]);
1921
+ const assignMutate = assignMutation.mutate;
1922
+ const assign = react.useCallback(
1923
+ async (input) => {
1924
+ const op = await assignMutate(input);
1925
+ void refreshUnassignedPool();
1926
+ return op;
1927
+ },
1928
+ [assignMutate, refreshUnassignedPool]
1929
+ );
1930
+ const createVehicleMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1931
+ tripRef,
1932
+ enqueue: (engine, input) => engine.enqueue({
1933
+ tripRef,
1934
+ method: client.SyncOpMethod.Post,
1935
+ path: `/api/v1/trips/${tripRef}/seating/vehicles`,
1936
+ operationId: "createSeatingVehicle",
1937
+ body: input
1938
+ }),
1939
+ direct: (liveClient, input) => liveClient.seating.vehicles.create({ tripRef, ...input })
1940
+ });
1941
+ const patchVehicleMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1942
+ tripRef,
1943
+ enqueue: (engine, input) => {
1944
+ const { vehicleId, version, ...body } = input;
1945
+ return engine.enqueue({
1946
+ tripRef,
1947
+ method: client.SyncOpMethod.Patch,
1948
+ path: `/api/v1/trips/${tripRef}/seating/vehicles/${vehicleId}`,
1949
+ operationId: "patchSeatingVehicle",
1950
+ body,
1951
+ ifMatch: version
1952
+ });
1953
+ },
1954
+ direct: (liveClient, input) => liveClient.seating.vehicles.patch({ tripRef, ...input })
1955
+ });
1956
+ const removeVehicleMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1957
+ tripRef,
1958
+ enqueue: (engine, input) => {
1959
+ const { vehicleId, version } = input;
1960
+ return engine.enqueue({
1961
+ tripRef,
1962
+ method: client.SyncOpMethod.Delete,
1963
+ path: `/api/v1/trips/${tripRef}/seating/vehicles/${vehicleId}`,
1964
+ operationId: "deleteSeatingVehicle",
1965
+ ifMatch: version
1966
+ });
1967
+ },
1968
+ direct: (liveClient, input) => liveClient.seating.vehicles.remove({ tripRef, ...input })
1969
+ });
1970
+ const removeVehicleMutate = removeVehicleMutation.mutate;
1971
+ const removeVehicle = react.useCallback(
1972
+ async (input) => {
1973
+ const op = await removeVehicleMutate(input);
1974
+ void refreshUnassignedPool();
1975
+ return op;
1976
+ },
1977
+ [removeVehicleMutate, refreshUnassignedPool]
1978
+ );
1979
+ const patchVehicleMutate = patchVehicleMutation.mutate;
1980
+ const patchVehicleDays = react.useCallback(
1981
+ async (vehicleRef, days) => {
1982
+ const current = vehicles.find(
1983
+ (row) => row.id === vehicleRef && !("_tombstone" in row)
1984
+ );
1985
+ if (current === void 0) {
1986
+ throw new Error(
1987
+ `patchVehicleDays: vehicle "${vehicleRef}" is not in the current seating cache \u2014 read the board before patching its day coverage.`
1988
+ );
1989
+ }
1990
+ return patchVehicleMutate({
1991
+ vehicleId: vehicleRef,
1992
+ version: current.version,
1993
+ days: [...days]
1994
+ });
1995
+ },
1996
+ [patchVehicleMutate, vehicles]
1997
+ );
1998
+ const linkManagerMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
1999
+ tripRef,
2000
+ enqueue: (engine, input) => {
2001
+ const { vehicleId, ...body } = input;
2002
+ return engine.enqueue({
2003
+ tripRef,
2004
+ method: client.SyncOpMethod.Post,
2005
+ path: `/api/v1/trips/${tripRef}/seating/vehicles/${vehicleId}/manager`,
2006
+ operationId: "linkSeatingManager",
2007
+ body
2008
+ });
2009
+ },
2010
+ direct: (liveClient, input) => liveClient.seating.vehicles.manager.link({ tripRef, ...input })
2011
+ });
2012
+ const unlinkManagerMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
2013
+ tripRef,
2014
+ enqueue: (engine, input) => {
2015
+ const { vehicleId, version } = input;
2016
+ return engine.enqueue({
2017
+ tripRef,
2018
+ method: client.SyncOpMethod.Delete,
2019
+ path: `/api/v1/trips/${tripRef}/seating/vehicles/${vehicleId}/manager`,
2020
+ operationId: "unlinkSeatingManager",
2021
+ ifMatch: version
2022
+ });
2023
+ },
2024
+ direct: (liveClient, input) => liveClient.seating.vehicles.manager.unlink({ tripRef, ...input })
2025
+ });
2026
+ const autoAssign = react.useCallback(
2027
+ (input) => client$1.seating.autoAssign({ tripRef, ...input }),
2028
+ [client$1, tripRef]
2029
+ );
2030
+ return {
2031
+ vehicles,
2032
+ syncedAt,
2033
+ refreshLive,
2034
+ unassignedPool: {
2035
+ travellers: poolTravellers,
2036
+ loaded: poolLoaded,
2037
+ lastFetchFailed: poolFetchFailed,
2038
+ fetchedAt: poolFetchedAt,
2039
+ refresh: refreshUnassignedPool
2040
+ },
2041
+ assign,
2042
+ autoAssign,
2043
+ createVehicle: createVehicleMutation.mutate,
2044
+ patchVehicle: patchVehicleMutation.mutate,
2045
+ removeVehicle,
2046
+ patchVehicleDays,
2047
+ linkManager: linkManagerMutation.mutate,
2048
+ unlinkManager: unlinkManagerMutation.mutate
2049
+ };
2050
+ });
2051
+ function useSeating(tripRef) {
2052
+ return useSeatingInternal(tripRef);
2053
+ }
2054
+ function useTravellerProfile(tripRef, travellerRef) {
2055
+ const client$1 = chunkEM7JV3D7_cjs.useKaafilClient();
2056
+ const [read, setRead] = react.useState(void 0);
2057
+ const [readFailed, setReadFailed] = react.useState(false);
2058
+ const refresh = react.useCallback(async () => {
2059
+ try {
2060
+ const response = await client$1.travellers.getDetail({ tripRef, travellerRef });
2061
+ setRead(response);
2062
+ setReadFailed(false);
2063
+ } catch {
2064
+ setReadFailed(true);
2065
+ }
2066
+ }, [client$1, tripRef, travellerRef]);
2067
+ react.useEffect(() => {
2068
+ void refresh();
2069
+ }, [refresh]);
2070
+ chunkEM7JV3D7_cjs.useOfflineEvent("sync.drained", refresh);
2071
+ const noteMutation = chunkEM7JV3D7_cjs.useOfflineMutation({
2072
+ tripRef,
2073
+ enqueue: (engine, input) => engine.enqueue({
2074
+ tripRef,
2075
+ method: client.SyncOpMethod.Post,
2076
+ path: `/api/v1/trips/${tripRef}/travellers/${travellerRef}/notes`,
2077
+ operationId: "addTravellerNote",
2078
+ body: input
2079
+ })
2080
+ });
2081
+ const noteMutate = noteMutation.mutate;
2082
+ const addNote = react.useCallback(
2083
+ async (input) => {
2084
+ const op = await noteMutate(input);
2085
+ void refresh();
2086
+ return op;
2087
+ },
2088
+ [noteMutate, refresh]
2089
+ );
2090
+ return { read, readFailed, refresh, addNote };
2091
+ }
2092
+ function useVendors(tripRef, agencyRef) {
2093
+ const client = chunkEM7JV3D7_cjs.useKaafilClient();
2094
+ const { rows, loaded: capabilitiesLoaded } = chunkEM7JV3D7_cjs.useCapabilityRows(tripRef);
2095
+ const [vendors, setVendors] = react.useState([]);
2096
+ const [listLoaded, setListLoaded] = react.useState(false);
2097
+ const [lastFetchFailed, setLastFetchFailed] = react.useState(false);
2098
+ const [syncedAt, setSyncedAt] = react.useState(void 0);
2099
+ const [firstLoadError, setFirstLoadError] = react.useState(void 0);
2100
+ const refresh = react.useCallback(async () => {
2101
+ try {
2102
+ const response = await client.vendors.list({ tripRef });
2103
+ setVendors(response);
2104
+ setListLoaded(true);
2105
+ setLastFetchFailed(false);
2106
+ setSyncedAt(response.meta.serverTime);
2107
+ setFirstLoadError(void 0);
2108
+ } catch (error) {
2109
+ setLastFetchFailed(true);
2110
+ setFirstLoadError((previous) => previous ?? classifyError(error));
2111
+ }
2112
+ }, [client, tripRef]);
2113
+ react.useEffect(() => {
2114
+ void refresh();
2115
+ }, [refresh]);
2116
+ const create = react.useCallback((input) => client.vendors.create(input), [client]);
2117
+ const upsert = react.useCallback((input) => client.vendors.upsert(input), [client]);
2118
+ const remove = react.useCallback((input) => client.vendors.remove(input), [client]);
2119
+ if (!capabilitiesLoaded) {
2120
+ return { status: "loading" };
2121
+ }
2122
+ const row = rows.find((candidate) => candidate.capability === "vendors");
2123
+ const triple = row === void 0 ? chunkEM7JV3D7_cjs.UNKNOWN_CAPABILITY_TRIPLE : chunkEM7JV3D7_cjs.deriveCapabilityTriple(row);
2124
+ if (triple.status !== "lit") {
2125
+ const reason = chunkEM7JV3D7_cjs.darkReasonFor(triple);
2126
+ return { status: "dark", reason };
2127
+ }
2128
+ if (!listLoaded && lastFetchFailed) {
2129
+ return {
2130
+ status: "error",
2131
+ error: firstLoadError ?? {
2132
+ path: "surface-to-user",
2133
+ code: void 0,
2134
+ status: void 0,
2135
+ unsatisfiableScheme: false,
2136
+ cause: void 0
2137
+ }
2138
+ };
2139
+ }
2140
+ return {
2141
+ status: "ready",
2142
+ vendors,
2143
+ loaded: listLoaded,
2144
+ lastFetchFailed,
2145
+ syncedAt,
2146
+ refresh,
2147
+ create,
2148
+ upsert,
2149
+ remove
2150
+ };
2151
+ }
2152
+
2153
+ Object.defineProperty(exports, "FALLBACK_GLYPH", {
2154
+ enumerable: true,
2155
+ get: function () { return client.FALLBACK_GLYPH; }
2156
+ });
2157
+ Object.defineProperty(exports, "SHADES_PER_FAMILY", {
2158
+ enumerable: true,
2159
+ get: function () { return client.SHADES_PER_FAMILY; }
2160
+ });
2161
+ Object.defineProperty(exports, "TONE_FAMILIES", {
2162
+ enumerable: true,
2163
+ get: function () { return client.TONE_FAMILIES; }
2164
+ });
2165
+ Object.defineProperty(exports, "parseRoomingTone", {
2166
+ enumerable: true,
2167
+ get: function () { return client.parseRoomingTone; }
2168
+ });
2169
+ Object.defineProperty(exports, "roomingHeuristicSeverity", {
2170
+ enumerable: true,
2171
+ get: function () { return client.roomingHeuristicSeverity; }
2172
+ });
2173
+ exports.ERROR_HANDLING_PATH = ERROR_HANDLING_PATH;
2174
+ exports.FORM_FIELD_KIND_SINGLE_BOOLEAN = FORM_FIELD_KIND_SINGLE_BOOLEAN;
2175
+ exports.classifyError = classifyError;
2176
+ exports.createDomainHook = createDomainHook;
2177
+ exports.useChecklists = useChecklists;
2178
+ exports.useCloseout = useCloseout;
2179
+ exports.useCollections = useCollections;
2180
+ exports.useExpenses = useExpenses;
2181
+ exports.useFiles = useFiles;
2182
+ exports.useFloat = useFloat;
2183
+ exports.useForms = useForms;
2184
+ exports.useItinerary = useItinerary;
2185
+ exports.useManagerToday = useManagerToday;
2186
+ exports.useManagers = useManagers;
2187
+ exports.useParties = useParties;
2188
+ exports.usePickups = usePickups;
2189
+ exports.useRooming = useRooming;
2190
+ exports.useSeating = useSeating;
2191
+ exports.useSnapshotList = useSnapshotList;
2192
+ exports.useTravellerProfile = useTravellerProfile;
2193
+ exports.useVendors = useVendors;
2194
+ //# sourceMappingURL=chunk-LL243STJ.cjs.map
2195
+ //# sourceMappingURL=chunk-LL243STJ.cjs.map