kaafil-react-uikit 0.10.2 → 0.11.0

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 (63) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/admin/index.cjs +471 -363
  3. package/dist/admin/index.cjs.map +1 -1
  4. package/dist/admin/index.d.cts +4 -4
  5. package/dist/admin/index.d.ts +4 -4
  6. package/dist/admin/index.js +116 -8
  7. package/dist/admin/index.js.map +1 -1
  8. package/dist/{chunk-2OWH2KDY.cjs → chunk-2JNB5A6Z.cjs} +90 -84
  9. package/dist/chunk-2JNB5A6Z.cjs.map +1 -0
  10. package/dist/{chunk-S53XNHRU.cjs → chunk-4TTDAOOG.cjs} +18 -4
  11. package/dist/chunk-4TTDAOOG.cjs.map +1 -0
  12. package/dist/{chunk-AFWZFFEM.js → chunk-4WXIR6FD.js} +5 -5
  13. package/dist/{chunk-AFWZFFEM.js.map → chunk-4WXIR6FD.js.map} +1 -1
  14. package/dist/{chunk-NCHZLGEE.cjs → chunk-6MD4QTZZ.cjs} +9 -9
  15. package/dist/{chunk-NCHZLGEE.cjs.map → chunk-6MD4QTZZ.cjs.map} +1 -1
  16. package/dist/{chunk-7V2XJIXD.js → chunk-7CLYTDSC.js} +18 -4
  17. package/dist/chunk-7CLYTDSC.js.map +1 -0
  18. package/dist/{chunk-AJE2RNOR.cjs → chunk-DRUTYOTN.cjs} +4 -4
  19. package/dist/{chunk-AJE2RNOR.cjs.map → chunk-DRUTYOTN.cjs.map} +1 -1
  20. package/dist/{chunk-K5Z6N2FY.js → chunk-DTVRWYVN.js} +5 -5
  21. package/dist/{chunk-K5Z6N2FY.js.map → chunk-DTVRWYVN.js.map} +1 -1
  22. package/dist/{chunk-VCROLPO3.js → chunk-EGEVXI5K.js} +3 -3
  23. package/dist/{chunk-VCROLPO3.js.map → chunk-EGEVXI5K.js.map} +1 -1
  24. package/dist/{chunk-7752B4NM.js → chunk-F6SN6CEC.js} +3 -3
  25. package/dist/{chunk-7752B4NM.js.map → chunk-F6SN6CEC.js.map} +1 -1
  26. package/dist/{chunk-KV7ODN2X.js → chunk-HC4PLK4E.js} +3 -3
  27. package/dist/{chunk-KV7ODN2X.js.map → chunk-HC4PLK4E.js.map} +1 -1
  28. package/dist/{chunk-F4GGHUMX.cjs → chunk-KY752BBA.cjs} +55 -55
  29. package/dist/{chunk-F4GGHUMX.cjs.map → chunk-KY752BBA.cjs.map} +1 -1
  30. package/dist/chunk-PMXQQFQN.cjs +12 -0
  31. package/dist/{chunk-ZZK7USFC.cjs.map → chunk-PMXQQFQN.cjs.map} +1 -1
  32. package/dist/{chunk-TGP4GTIY.js → chunk-RK3CWJ56.js} +10 -4
  33. package/dist/chunk-RK3CWJ56.js.map +1 -0
  34. package/dist/{chunk-64R4ZJTA.cjs → chunk-UG4Z23IJ.cjs} +12 -12
  35. package/dist/{chunk-64R4ZJTA.cjs.map → chunk-UG4Z23IJ.cjs.map} +1 -1
  36. package/dist/{chunk-UUID3H4R.js → chunk-VWFNUQDH.js} +3 -3
  37. package/dist/{chunk-UUID3H4R.js.map → chunk-VWFNUQDH.js.map} +1 -1
  38. package/dist/{chunk-3AF2M2JD.cjs → chunk-W63ZEIC2.cjs} +17 -17
  39. package/dist/{chunk-3AF2M2JD.cjs.map → chunk-W63ZEIC2.cjs.map} +1 -1
  40. package/dist/core/index.cjs +107 -107
  41. package/dist/core/index.d.cts +5 -5
  42. package/dist/core/index.d.ts +5 -5
  43. package/dist/core/index.js +10 -10
  44. package/dist/index.css +1 -1
  45. package/dist/manager/index.cjs +256 -256
  46. package/dist/manager/index.d.cts +4 -4
  47. package/dist/manager/index.d.ts +4 -4
  48. package/dist/manager/index.js +6 -6
  49. package/dist/tokens.json +4 -1
  50. package/dist/traveller/index.cjs +35 -35
  51. package/dist/traveller/index.js +5 -5
  52. package/dist/{useAgencyTrip-gZB0NILH.d.ts → useAgencyTrip-BgQ4gkyy.d.ts} +1 -1
  53. package/dist/{useAgencyTrip-C1YmfuQq.d.cts → useAgencyTrip-CtUMpC-J.d.cts} +1 -1
  54. package/dist/{useNotifications-D262i5BQ.d.ts → useNotifications-B9t5jUQc.d.ts} +1 -1
  55. package/dist/{useNotifications-BZW1Z_ur.d.cts → useNotifications-xn08Oypa.d.cts} +1 -1
  56. package/dist/{useVendors-DXOuZWhZ.d.cts → useVendors-B827YIDs.d.cts} +20 -0
  57. package/dist/{useVendors-DXOuZWhZ.d.ts → useVendors-B827YIDs.d.ts} +20 -0
  58. package/package.json +2 -2
  59. package/dist/chunk-2OWH2KDY.cjs.map +0 -1
  60. package/dist/chunk-7V2XJIXD.js.map +0 -1
  61. package/dist/chunk-S53XNHRU.cjs.map +0 -1
  62. package/dist/chunk-TGP4GTIY.js.map +0 -1
  63. package/dist/chunk-ZZK7USFC.cjs +0 -12
@@ -2,12 +2,12 @@ export { B as BootErrorScreen, a as BootErrorScreenProps, b as BootFailureMode,
2
2
  export { L as LockedTripScreen, a as LockedTripScreenProps, N as NotFoundScreen, b as NotFoundScreenProps, S as SessionExpiredScreen, c as SessionExpiredScreenProps } from '../SessionExpiredScreen-CytQNuak.cjs';
3
3
  import { ReactNode, ComponentType } from 'react';
4
4
  import { K as KaafilTokenOverrides } from '../tokenStyle-CToG5oOS.cjs';
5
- import { C as ChecklistTemplateRow, a as ChecklistTemplateItemRow, F as FormDetailRow, b as FormFieldRow, c as FormRow, M as ManagerListRowResponse, T as TravellerDirectoryItemResponse, J as JourneyTriggerRow, A as AgencyTripRow, d as TripManifestRow, e as CollectionDeltaRow, f as AgencyTripRead } from '../useAgencyTrip-C1YmfuQq.cjs';
6
- export { g as AgencySettingsDocument, B as FormBuilderBindingRow, h as FormSectionRow } from '../useAgencyTrip-C1YmfuQq.cjs';
5
+ import { C as ChecklistTemplateRow, a as ChecklistTemplateItemRow, F as FormDetailRow, b as FormFieldRow, c as FormRow, M as ManagerListRowResponse, T as TravellerDirectoryItemResponse, J as JourneyTriggerRow, A as AgencyTripRow, d as TripManifestRow, e as CollectionDeltaRow, f as AgencyTripRead } from '../useAgencyTrip-CtUMpC-J.cjs';
6
+ export { g as AgencySettingsDocument, B as FormBuilderBindingRow, h as FormSectionRow } from '../useAgencyTrip-CtUMpC-J.cjs';
7
7
  import { ManagerAgencyProfileResponse, TravellerAgencyProfileResponse, BookingListRow, PickupStopDeltaRow, RoomingRoomDeltaRow, SeatingVehicleDeltaRow } from 'kaafil-js/client';
8
8
  export { BookingListRow, ManagerAgencyProfileResponse, SeatingOccupant, TravellerAgencyProfileResponse, AgencyTripSegmentCounts as TripDirectorySegmentCounts, TripManifestFacets } from 'kaafil-js/client';
9
- import { C as ChecklistSectionRow, a as ChecklistsReady, F as FileListItem, E as ExpenseDeltaRow, b as FloatMovementRow, T as TripFormRow, c as TripFormResponseRow, I as ItineraryDayRow, d as ItineraryItemRow, R as RoomingStayWindowRow, e as TripVendorRow } from '../useVendors-DXOuZWhZ.cjs';
10
- export { f as FloatSummaryRow } from '../useVendors-DXOuZWhZ.cjs';
9
+ import { C as ChecklistSectionRow, a as ChecklistsReady, F as FileListItem, E as ExpenseDeltaRow, b as FloatMovementRow, T as TripFormRow, c as TripFormResponseRow, I as ItineraryDayRow, d as ItineraryItemRow, R as RoomingStayWindowRow, e as TripVendorRow } from '../useVendors-B827YIDs.cjs';
10
+ export { f as FloatSummaryRow } from '../useVendors-B827YIDs.cjs';
11
11
 
12
12
  type PlanLockedReason = 'agency' | 'partner-ceiling';
13
13
  interface PlanLockedScreenProps {
@@ -2,12 +2,12 @@ export { B as BootErrorScreen, a as BootErrorScreenProps, b as BootFailureMode,
2
2
  export { L as LockedTripScreen, a as LockedTripScreenProps, N as NotFoundScreen, b as NotFoundScreenProps, S as SessionExpiredScreen, c as SessionExpiredScreenProps } from '../SessionExpiredScreen-D8GHyZc3.js';
3
3
  import { ReactNode, ComponentType } from 'react';
4
4
  import { K as KaafilTokenOverrides } from '../tokenStyle-CToG5oOS.js';
5
- import { C as ChecklistTemplateRow, a as ChecklistTemplateItemRow, F as FormDetailRow, b as FormFieldRow, c as FormRow, M as ManagerListRowResponse, T as TravellerDirectoryItemResponse, J as JourneyTriggerRow, A as AgencyTripRow, d as TripManifestRow, e as CollectionDeltaRow, f as AgencyTripRead } from '../useAgencyTrip-gZB0NILH.js';
6
- export { g as AgencySettingsDocument, B as FormBuilderBindingRow, h as FormSectionRow } from '../useAgencyTrip-gZB0NILH.js';
5
+ import { C as ChecklistTemplateRow, a as ChecklistTemplateItemRow, F as FormDetailRow, b as FormFieldRow, c as FormRow, M as ManagerListRowResponse, T as TravellerDirectoryItemResponse, J as JourneyTriggerRow, A as AgencyTripRow, d as TripManifestRow, e as CollectionDeltaRow, f as AgencyTripRead } from '../useAgencyTrip-BgQ4gkyy.js';
6
+ export { g as AgencySettingsDocument, B as FormBuilderBindingRow, h as FormSectionRow } from '../useAgencyTrip-BgQ4gkyy.js';
7
7
  import { ManagerAgencyProfileResponse, TravellerAgencyProfileResponse, BookingListRow, PickupStopDeltaRow, RoomingRoomDeltaRow, SeatingVehicleDeltaRow } from 'kaafil-js/client';
8
8
  export { BookingListRow, ManagerAgencyProfileResponse, SeatingOccupant, TravellerAgencyProfileResponse, AgencyTripSegmentCounts as TripDirectorySegmentCounts, TripManifestFacets } from 'kaafil-js/client';
9
- import { C as ChecklistSectionRow, a as ChecklistsReady, F as FileListItem, E as ExpenseDeltaRow, b as FloatMovementRow, T as TripFormRow, c as TripFormResponseRow, I as ItineraryDayRow, d as ItineraryItemRow, R as RoomingStayWindowRow, e as TripVendorRow } from '../useVendors-DXOuZWhZ.js';
10
- export { f as FloatSummaryRow } from '../useVendors-DXOuZWhZ.js';
9
+ import { C as ChecklistSectionRow, a as ChecklistsReady, F as FileListItem, E as ExpenseDeltaRow, b as FloatMovementRow, T as TripFormRow, c as TripFormResponseRow, I as ItineraryDayRow, d as ItineraryItemRow, R as RoomingStayWindowRow, e as TripVendorRow } from '../useVendors-B827YIDs.js';
10
+ export { f as FloatSummaryRow } from '../useVendors-B827YIDs.js';
11
11
 
12
12
  type PlanLockedReason = 'agency' | 'partner-ceiling';
13
13
  interface PlanLockedScreenProps {
@@ -1,8 +1,8 @@
1
- import { useAgencySettings, useAgencyChecklistTemplates, useAgencyForms, useAgencyManagerProfile, useAgencyJourneyTriggers, useBookings, useDirectories, useCapabilityStatuses, useAgencyTrip, useAgencyAdminMe, useTravellerFormResponses, useBuildShareUrl, familySafeSections, useShareLinks, usePaginatedList, useAgencyTrips, useAgencyTripManifest, resolveBlockerDeepLink } from '../chunk-AFWZFFEM.js';
2
- import { useChecklists, useFiles, useExpenses, useVendors, useFloat, useManagers, useForms, useItinerary, useCollections, useParties, usePickups, useRooming, useSeating, classifyError, useTravellerProfile, roomingHeuristicSeverity, useManagerToday, useCloseout, parseRoomingTone, TONE_FAMILIES, SHADES_PER_FAMILY, FALLBACK_GLYPH } from '../chunk-TGP4GTIY.js';
3
- import '../chunk-KV7ODN2X.js';
4
- export { BootErrorScreen, LockedTripScreen, NotFoundScreen, OfflineFallbackScreen, PlanLockedScreen, SessionExpiredScreen } from '../chunk-VCROLPO3.js';
5
- import { createRegistry, useSession, useKaafilChrome, tokenStyle, useKaafilClient, isDevelopment } from '../chunk-7V2XJIXD.js';
1
+ import { useAgencySettings, useAgencyChecklistTemplates, useAgencyForms, useAgencyManagerProfile, useAgencyJourneyTriggers, useBookings, useDirectories, useCapabilityStatuses, useAgencyTrip, useAgencyAdminMe, useTravellerFormResponses, useBuildShareUrl, familySafeSections, useShareLinks, usePaginatedList, useAgencyTrips, useAgencyTripManifest, resolveBlockerDeepLink } from '../chunk-4WXIR6FD.js';
2
+ import { useChecklists, useFiles, useExpenses, useVendors, useFloat, useManagers, useForms, useItinerary, useCollections, useParties, usePickups, useRooming, useSeating, classifyError, useTravellerProfile, roomingHeuristicSeverity, useManagerToday, useCloseout, parseRoomingTone, TONE_FAMILIES, SHADES_PER_FAMILY, FALLBACK_GLYPH } from '../chunk-RK3CWJ56.js';
3
+ import '../chunk-HC4PLK4E.js';
4
+ export { BootErrorScreen, LockedTripScreen, NotFoundScreen, OfflineFallbackScreen, PlanLockedScreen, SessionExpiredScreen } from '../chunk-EGEVXI5K.js';
5
+ import { createRegistry, useSession, useKaafilChrome, tokenStyle, useKaafilClient, isDevelopment } from '../chunk-7CLYTDSC.js';
6
6
  import { useState, useEffect, useCallback, useMemo, useId, useRef, Children } from 'react';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
 
@@ -9644,7 +9644,12 @@ function KindIcon({
9644
9644
  if (kind === "pdf") return /* @__PURE__ */ jsx(PdfFileIcon, {});
9645
9645
  return /* @__PURE__ */ jsx(GenericFileIcon, {});
9646
9646
  }
9647
- function DocumentRow({ row, onOpen }) {
9647
+ function DocumentRow({
9648
+ row,
9649
+ onOpen,
9650
+ onWithdraw,
9651
+ withdrawing = false
9652
+ }) {
9648
9653
  const { t } = useKaafilChrome();
9649
9654
  const { file, spend } = row;
9650
9655
  const purged = file.status === "purged";
@@ -9695,7 +9700,20 @@ function DocumentRow({ row, onOpen }) {
9695
9700
  ) }),
9696
9701
  classKey === null ? null : /* @__PURE__ */ jsx("span", { className: "kf-trip-documents-section__retention-class", children: t(classKey) })
9697
9702
  ] }),
9698
- /* @__PURE__ */ jsx("td", { className: "kf-trip-documents-section__actions-cell", children: isBrowsable(file.status) ? /* @__PURE__ */ jsx("button", { type: "button", className: "kf-trip-documents-section__link-button", onClick: onOpen, children: t("chrome.tripDocuments.open") }) : null })
9703
+ /* @__PURE__ */ jsxs("td", { className: "kf-trip-documents-section__actions-cell", children: [
9704
+ isBrowsable(file.status) ? /* @__PURE__ */ jsx("button", { type: "button", className: "kf-trip-documents-section__link-button", onClick: onOpen, children: t("chrome.tripDocuments.open") }) : null,
9705
+ onWithdraw === void 0 ? null : /* @__PURE__ */ jsx(
9706
+ "button",
9707
+ {
9708
+ type: "button",
9709
+ className: "kf-trip-documents-section__link-button",
9710
+ "data-destructive": "true",
9711
+ onClick: onWithdraw,
9712
+ disabled: withdrawing,
9713
+ children: t(withdrawing ? "chrome.tripDocuments.withdrawing" : "chrome.tripDocuments.withdraw")
9714
+ }
9715
+ )
9716
+ ] })
9699
9717
  ] });
9700
9718
  }
9701
9719
  var SKELETON_ROWS3 = ["s1", "s2", "s3", "s4"];
@@ -10057,6 +10075,54 @@ function UploadDialog({
10057
10075
  }
10058
10076
  );
10059
10077
  }
10078
+ function WithdrawDialog({
10079
+ documentName,
10080
+ busy,
10081
+ failed,
10082
+ onClose,
10083
+ onConfirm
10084
+ }) {
10085
+ const { t } = useKaafilChrome();
10086
+ const titleId = useId();
10087
+ return /* @__PURE__ */ jsxs(
10088
+ SheetDialog,
10089
+ {
10090
+ titleId,
10091
+ eyebrow: t("chrome.tripDocuments.withdraw"),
10092
+ title: t("chrome.tripDocuments.withdrawTitle"),
10093
+ onClose,
10094
+ closeLabel: t("chrome.tripDocuments.withdrawCancel"),
10095
+ footer: /* @__PURE__ */ jsxs(Fragment, { children: [
10096
+ /* @__PURE__ */ jsx(
10097
+ "button",
10098
+ {
10099
+ type: "button",
10100
+ className: "kf-trip-documents-section__dialog-secondary",
10101
+ onClick: onClose,
10102
+ disabled: busy,
10103
+ children: t("chrome.tripDocuments.withdrawCancel")
10104
+ }
10105
+ ),
10106
+ /* @__PURE__ */ jsx(
10107
+ "button",
10108
+ {
10109
+ type: "button",
10110
+ className: "kf-trip-documents-section__dialog-primary",
10111
+ "data-destructive": "true",
10112
+ onClick: onConfirm,
10113
+ disabled: busy,
10114
+ children: t(busy ? "chrome.tripDocuments.withdrawing" : "chrome.tripDocuments.withdrawConfirm")
10115
+ }
10116
+ )
10117
+ ] }),
10118
+ children: [
10119
+ /* @__PURE__ */ jsx("p", { className: "kf-trip-documents-section__withdraw-name", children: documentName }),
10120
+ /* @__PURE__ */ jsx("p", { className: "kf-trip-documents-section__withdraw-body", children: t("chrome.tripDocuments.withdrawBody") }),
10121
+ failed ? /* @__PURE__ */ jsx("p", { className: "kf-trip-documents-section__error", role: "alert", children: t("chrome.tripDocuments.withdrawFailed") }) : null
10122
+ ]
10123
+ }
10124
+ );
10125
+ }
10060
10126
  function TripDocumentsSection(props) {
10061
10127
  const session = useSession();
10062
10128
  if (session.status !== "authenticated") {
@@ -10080,9 +10146,13 @@ function ReadyTripDocumentsSection({ tripRef, style }) {
10080
10146
  const [uploadErrorKey, setUploadErrorKey] = useState(void 0);
10081
10147
  const [travellers, setTravellers] = useState([]);
10082
10148
  const [view, setView] = useState(void 0);
10149
+ const [withdrawRow, setWithdrawRow] = useState(null);
10150
+ const [withdrawingId, setWithdrawingId] = useState(null);
10151
+ const [withdrawFailed, setWithdrawFailed] = useState(false);
10083
10152
  const [viewFailed, setViewFailed] = useState(false);
10084
10153
  const list = files.list;
10085
10154
  const managerView = files.managerView;
10155
+ const removeFile = files.remove;
10086
10156
  const load = useCallback(async () => {
10087
10157
  setState({ kind: "loading" });
10088
10158
  try {
@@ -10091,6 +10161,22 @@ function ReadyTripDocumentsSection({ tripRef, style }) {
10091
10161
  setState({ kind: "failed" });
10092
10162
  }
10093
10163
  }, [list]);
10164
+ const confirmWithdraw = useCallback(async () => {
10165
+ if (withdrawRow === null) return;
10166
+ const { id, version } = withdrawRow.file;
10167
+ setWithdrawingId(id);
10168
+ setWithdrawFailed(false);
10169
+ try {
10170
+ await removeFile(id, version);
10171
+ setWithdrawRow(null);
10172
+ setOpen((current) => current?.file.id === id ? null : current);
10173
+ await load();
10174
+ } catch {
10175
+ setWithdrawFailed(true);
10176
+ } finally {
10177
+ setWithdrawingId(null);
10178
+ }
10179
+ }, [withdrawRow, removeFile, load]);
10094
10180
  useEffect(() => {
10095
10181
  let cancelled = false;
10096
10182
  setState({ kind: "loading" });
@@ -10256,10 +10342,32 @@ function ReadyTripDocumentsSection({ tripRef, style }) {
10256
10342
  /* @__PURE__ */ jsx("th", { scope: "col", children: t("chrome.tripDocuments.columnRetention") }),
10257
10343
  /* @__PURE__ */ jsx("th", { scope: "col", children: /* @__PURE__ */ jsx("span", { className: "kf-visually-hidden", children: t("chrome.tripDocuments.columnActions") }) })
10258
10344
  ] }) }),
10259
- /* @__PURE__ */ jsx("tbody", { children: shown.map((row) => /* @__PURE__ */ jsx(DocumentRow, { row, onOpen: () => setOpen(row) }, row.file.id)) })
10345
+ /* @__PURE__ */ jsx("tbody", { children: shown.map((row) => /* @__PURE__ */ jsx(
10346
+ DocumentRow,
10347
+ {
10348
+ row,
10349
+ onOpen: () => setOpen(row),
10350
+ onWithdraw: row.file.purpose === "trip_document" && row.file.status !== "purged" ? () => {
10351
+ setWithdrawFailed(false);
10352
+ setWithdrawRow(row);
10353
+ } : void 0,
10354
+ withdrawing: withdrawingId === row.file.id
10355
+ },
10356
+ row.file.id
10357
+ )) })
10260
10358
  ] }) }) : null,
10261
10359
  state.kind === "ready" ? /* @__PURE__ */ jsx("p", { className: "kf-trip-documents-section__hint", children: t("chrome.tripDocuments.howDocumentsArrive") }) : null,
10262
10360
  state.kind === "ready" && counts.expenseReceipt > 0 && spends === void 0 ? /* @__PURE__ */ jsx("p", { className: "kf-trip-documents-section__hint", "data-tone": "warn", children: t("chrome.tripDocuments.ledgerUnread") }) : null,
10361
+ withdrawRow === null ? null : /* @__PURE__ */ jsx(
10362
+ WithdrawDialog,
10363
+ {
10364
+ documentName: withdrawRow.file.title !== null && withdrawRow.file.title !== "" ? withdrawRow.file.title : t("chrome.tripDocuments.chipTripDocuments"),
10365
+ busy: withdrawingId === withdrawRow.file.id,
10366
+ failed: withdrawFailed,
10367
+ onClose: () => setWithdrawRow(null),
10368
+ onConfirm: () => void confirmWithdraw()
10369
+ }
10370
+ ),
10263
10371
  uploadOpen ? /* @__PURE__ */ jsx(
10264
10372
  UploadDialog,
10265
10373
  {