kaafil-react-uikit 0.11.4 → 0.11.6

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.
@@ -7349,8 +7349,8 @@ function CheckIcon5(props) {
7349
7349
  return /* @__PURE__ */ jsxRuntime.jsx(
7350
7350
  "svg",
7351
7351
  {
7352
- width: "16",
7353
- height: "16",
7352
+ width: "20",
7353
+ height: "20",
7354
7354
  viewBox: "0 0 24 24",
7355
7355
  fill: "none",
7356
7356
  stroke: "currentColor",
@@ -8004,6 +8004,7 @@ function ReadyManagerPickupsSection({
8004
8004
  style
8005
8005
  }) {
8006
8006
  const pickups = chunkUSKVWPJD_cjs.usePickups(tripRef);
8007
+ const outbox = chunk5ORJRFXZ_cjs.useOutboxStatus();
8007
8008
  const StopListUI = components?.StopList ?? StopList;
8008
8009
  const BoardingViewUI = components?.BoardingView ?? BoardingView;
8009
8010
  const [kind, setKind] = react.useState("PICKUP");
@@ -8027,6 +8028,27 @@ function ReadyManagerPickupsSection({
8027
8028
  cancelled = true;
8028
8029
  };
8029
8030
  }, [ready, selectedStopId, kind]);
8031
+ const drainedFrom = react.useRef(outbox.pending);
8032
+ react.useEffect(() => {
8033
+ const hadWork = drainedFrom.current > 0;
8034
+ drainedFrom.current = outbox.pending;
8035
+ if (!hadWork || outbox.pending > 0) {
8036
+ return;
8037
+ }
8038
+ if (pickups.status !== "ready" || selectedStopId === void 0) {
8039
+ return;
8040
+ }
8041
+ let cancelled = false;
8042
+ void pickups.manifestByPickup({ kind }).then((result) => {
8043
+ if (!cancelled) {
8044
+ setManifest(result);
8045
+ }
8046
+ });
8047
+ void pickups.refreshLive();
8048
+ return () => {
8049
+ cancelled = true;
8050
+ };
8051
+ }, [outbox.pending, selectedStopId, kind]);
8030
8052
  if (pickups.status === "loading") {
8031
8053
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-manager-pickups__skeleton", style: chunk5ORJRFXZ_cjs.tokenStyle(style), children: [
8032
8054
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-manager-pickups__skeleton-line" }),
@@ -13299,15 +13321,28 @@ function TripListRow({ trip, onSelect, style }) {
13299
13321
  }
13300
13322
  );
13301
13323
  }
13324
+ var STATUS_RANK = {
13325
+ IN_PROGRESS: 0,
13326
+ CONFIRMED: 1,
13327
+ POSTPONED: 2,
13328
+ COMPLETED: 3,
13329
+ CANCELLED: 4
13330
+ };
13331
+ function byUrgency(a, b) {
13332
+ const rank = STATUS_RANK[a.status] - STATUS_RANK[b.status];
13333
+ if (rank !== 0) return rank;
13334
+ return a.startDate < b.startDate ? -1 : a.startDate > b.startDate ? 1 : 0;
13335
+ }
13302
13336
  function TripListScreen({
13303
13337
  trips,
13304
13338
  onSelect,
13305
13339
  TripListItemComponent
13306
13340
  }) {
13307
13341
  const { t } = chunk5ORJRFXZ_cjs.useKaafilChrome();
13342
+ const ordered = [...trips].sort(byUrgency);
13308
13343
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-manager-app__trip-list", children: [
13309
13344
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-eyebrow kf-manager-app__trip-list-eyebrow", children: t("chrome.managerApp.tripList.eyebrow") }),
13310
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-manager-app__trip-list-rows", children: trips.map((trip) => /* @__PURE__ */ jsxRuntime.jsx(TripListItemComponent, { trip, onSelect }, trip.tripRef)) })
13345
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-manager-app__trip-list-rows", children: ordered.map((trip) => /* @__PURE__ */ jsxRuntime.jsx(TripListItemComponent, { trip, onSelect }, trip.tripRef)) })
13311
13346
  ] });
13312
13347
  }
13313
13348
  function KaafilManagerApp(props) {
@@ -13399,7 +13434,9 @@ function ReadyKaafilManagerApp(props) {
13399
13434
  ] });
13400
13435
  }
13401
13436
  const { trips, manager, syncedAt } = managerMe;
13402
- const resolvedTripRef = controlledTripRef ?? internalTripRef ?? (trips.length === 1 ? trips[0]?.tripRef : void 0);
13437
+ const liveTrips = trips.filter((trip) => trip.status === "IN_PROGRESS");
13438
+ const onlyReasonableTrip = liveTrips.length === 1 ? liveTrips[0]?.tripRef : trips.length === 1 ? trips[0]?.tripRef : void 0;
13439
+ const resolvedTripRef = controlledTripRef ?? internalTripRef ?? onlyReasonableTrip;
13403
13440
  const currentTrip = trips.find((trip) => trip.tripRef === resolvedTripRef);
13404
13441
  if (currentTrip === void 0) {
13405
13442
  return /* @__PURE__ */ jsxRuntime.jsxs(ManagerShell, { header: { title: surfaceTitle }, components: shellComponents, style, children: [