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