@ixo/editor 6.31.3 → 6.31.4

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.
@@ -32251,22 +32251,65 @@ var ReadableKeyValues = ({ data }) => {
32251
32251
  };
32252
32252
 
32253
32253
  // src/mantine/blocks/action/actionTypes/_shared/bids/fetchAllBids.ts
32254
- var MAX_PAGES = 200;
32254
+ var MAX_PAGES = 5e3;
32255
+ var RETRIES_PER_PAGE = 1;
32256
+ var consoleLogger = (event) => {
32257
+ if (event.phase === "stop" && event.stop !== "complete") console.warn("[bids:paging] stopped", event);
32258
+ else if (event.phase === "retry") console.warn("[bids:paging] retrying page", event);
32259
+ else console.info("[bids:paging]", event);
32260
+ };
32255
32261
  async function fetchAllBids(queryBids, params, options) {
32256
32262
  const maxPages = options?.maxPages ?? MAX_PAGES;
32263
+ const log = options?.log === void 0 ? consoleLogger : options.log || (() => {
32264
+ });
32257
32265
  const bids = [];
32258
32266
  const seenTokens = /* @__PURE__ */ new Set();
32259
- let nextPageToken;
32267
+ const seenIds = /* @__PURE__ */ new Set();
32268
+ let sentToken;
32260
32269
  let pages = 0;
32270
+ const stop = (reason, error) => {
32271
+ log({ phase: "stop", page: pages, total: bids.length, unique: seenIds.size, stop: reason, error });
32272
+ return { bids, truncated: reason !== "complete", pages, stoppedBecause: reason, unique: seenIds.size, error };
32273
+ };
32261
32274
  for (; ; ) {
32262
- const response = await queryBids({ ...params, ...nextPageToken ? { pagination: { nextPageToken } } : {} });
32275
+ const request = { ...params, ...sentToken ? { pagination: { nextPageToken: sentToken } } : {} };
32276
+ let response;
32277
+ for (let attempt = 0; ; attempt += 1) {
32278
+ try {
32279
+ response = await queryBids(request);
32280
+ break;
32281
+ } catch (error) {
32282
+ if (attempt >= RETRIES_PER_PAGE) return stop("error", error);
32283
+ log({ phase: "retry", page: pages + 1, sentToken, total: bids.length, unique: seenIds.size, error });
32284
+ }
32285
+ }
32263
32286
  pages += 1;
32264
- if (Array.isArray(response?.data)) bids.push(...response.data);
32265
- nextPageToken = response?.nextPageToken;
32266
- if (!nextPageToken) return { bids, truncated: false, pages };
32267
- if (seenTokens.has(nextPageToken)) return { bids, truncated: true, pages };
32268
- seenTokens.add(nextPageToken);
32269
- if (pages >= maxPages) return { bids, truncated: true, pages };
32287
+ const page = Array.isArray(response?.data) ? response.data : null;
32288
+ const receivedToken = response?.nextPageToken;
32289
+ const fresh = page?.filter((entry) => !seenIds.has(entry.id)).length;
32290
+ log({ phase: "page", page: pages, sentToken, receivedToken, received: page?.length, fresh, total: bids.length + (page?.length ?? 0), unique: seenIds.size + (fresh ?? 0) });
32291
+ if (!page) return stop("error", new Error("get-bids returned no data array"));
32292
+ bids.push(...page);
32293
+ page.forEach((entry) => seenIds.add(entry.id));
32294
+ if (!receivedToken) return stop("complete");
32295
+ if (seenTokens.has(receivedToken)) return stop("repeated-token");
32296
+ seenTokens.add(receivedToken);
32297
+ if (pages >= maxPages) return stop("max-pages");
32298
+ sentToken = receivedToken;
32299
+ }
32300
+ }
32301
+ function describeBidsPagingStop(result) {
32302
+ if (!result.truncated) return null;
32303
+ const seen = `${result.unique} bid${result.unique === 1 ? "" : "s"} over ${result.pages} page${result.pages === 1 ? "" : "s"}`;
32304
+ switch (result.stoppedBecause) {
32305
+ case "repeated-token":
32306
+ return `Bid paging stopped early \u2014 the bids service kept returning the same page cursor, so it never moved past the first ${seen}. This list is incomplete. See the [bids:paging] entries in the browser console.`;
32307
+ case "max-pages":
32308
+ return `Bid paging stopped at the ${result.pages}-page safety limit \u2014 this list may be incomplete.`;
32309
+ case "error":
32310
+ return result.unique === 0 ? null : `Bid paging failed after ${seen} \u2014 showing what loaded. See the [bids:paging] entries in the browser console.`;
32311
+ default:
32312
+ return null;
32270
32313
  }
32271
32314
  }
32272
32315
  function dedupeBids(bids) {
@@ -32278,6 +32321,25 @@ function dedupeBids(bids) {
32278
32321
  });
32279
32322
  }
32280
32323
 
32324
+ // src/mantine/blocks/action/actionTypes/_shared/bids/sortBids.ts
32325
+ var STATUS_ORDER = { pending: 0, rejected: 1, approved: 2 };
32326
+ function createdMs(bid) {
32327
+ const ms = new Date(bid?.created || "").getTime();
32328
+ return Number.isNaN(ms) ? 0 : ms;
32329
+ }
32330
+ function partitionBidsByDecision(bids, context = {}) {
32331
+ const keyed = bids.map((bid) => ({ bid, key: getBidStatusInfo(bid, context).key, ms: createdMs(bid) }));
32332
+ keyed.sort((a, b) => STATUS_ORDER[a.key] - STATUS_ORDER[b.key] || b.ms - a.ms);
32333
+ return {
32334
+ open: keyed.filter((entry) => entry.key === "pending").map((entry) => entry.bid),
32335
+ decided: keyed.filter((entry) => entry.key !== "pending").map((entry) => entry.bid)
32336
+ };
32337
+ }
32338
+ function sortBidsForReview(bids, context = {}) {
32339
+ const { open, decided } = partitionBidsByDecision(bids, context);
32340
+ return [...open, ...decided];
32341
+ }
32342
+
32281
32343
  // src/mantine/blocks/action/actionTypes/evaluateBid/EvaluateBidFlowDetail.tsx
32282
32344
  function getRoleColor2(role) {
32283
32345
  const r = String(role || "").toLowerCase();
@@ -32378,8 +32440,9 @@ var EvaluateBidFlowDetail = ({
32378
32440
  return counts;
32379
32441
  }, [bids, statusContext]);
32380
32442
  const filteredBids = useMemo114(() => {
32381
- if (activeFilter === "all") return bids;
32382
- return bids.filter((bid) => getBidStatus(bid, t, statusContext).key === activeFilter);
32443
+ const ordered = sortBidsForReview(bids, statusContext);
32444
+ if (activeFilter === "all") return ordered;
32445
+ return ordered.filter((bid) => getBidStatus(bid, t, statusContext).key === activeFilter);
32383
32446
  }, [bids, activeFilter, t, statusContext]);
32384
32447
  const fetchGrantees = useCallback106(
32385
32448
  async (adminAddressForList) => {
@@ -32403,7 +32466,8 @@ var EvaluateBidFlowDetail = ({
32403
32466
  const [bidsResult, collectionsResponse] = await Promise.all([fetchAllBids(handlers2.queryBids, { collectionId, entityDid: deedDid }), handlers2.getClaimCollections(deedDid)]);
32404
32467
  const fetchedBids = dedupeBids(bidsResult.bids);
32405
32468
  setBids(fetchedBids);
32406
- if (bidsResult.truncated) setError("Bid paging stopped early \u2014 this list may be incomplete.");
32469
+ const pagingNote = describeBidsPagingStop(bidsResult);
32470
+ if (pagingNote) setError(pagingNote);
32407
32471
  if (selectedBidId && !fetchedBids.some((bid) => bid.id === selectedBidId)) {
32408
32472
  setSelectedBidId("");
32409
32473
  }
@@ -35448,6 +35512,7 @@ var BidInboxSection = ({
35448
35512
  },
35449
35513
  [bidStatusContext]
35450
35514
  );
35515
+ const { open: openBids, decided: decidedBids } = useMemo120(() => partitionBidsByDecision(bids, bidStatusContext), [bids, bidStatusContext]);
35451
35516
  const bidRowOptions = useMemo120(
35452
35517
  () => ({
35453
35518
  evaluatedByBidId,
@@ -35497,7 +35562,7 @@ var BidInboxSection = ({
35497
35562
  try {
35498
35563
  const result = await fetchAllBids(handlersRef.current.queryBids, { collectionId, entityDid: deedDid });
35499
35564
  setBids(dedupeBids(result.bids));
35500
- setError(result.truncated ? "Bid paging stopped early \u2014 this list may be incomplete." : null);
35565
+ setError(describeBidsPagingStop(result));
35501
35566
  } catch {
35502
35567
  setBids([]);
35503
35568
  setError(null);
@@ -35736,6 +35801,12 @@ var BidInboxSection = ({
35736
35801
  decision === "reject" ? "Reject bid" : actAs.actAsGroup ? "Propose approval" : "Approve bid"
35737
35802
  )));
35738
35803
  }
35804
+ const renderBidRow = (bid) => {
35805
+ const profile = profilesByDid[bid.did];
35806
+ const displayName = profile?.displayname || bid.did || bid.address;
35807
+ const status = bidEvaluatedStatus(bid) || "pending";
35808
+ return /* @__PURE__ */ React320.createElement(ListItemContainer, { key: bid.id, isChecked: false, onClick: () => setSelectedBidId(bid.id) }, /* @__PURE__ */ React320.createElement(Stack211, { gap: 0, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React320.createElement(Text199, { fw: 500, size: "sm", truncate: true }, displayName), /* @__PURE__ */ React320.createElement(Text199, { size: "xs", c: "dimmed", truncate: true }, truncateAddress4(bid.address))), /* @__PURE__ */ React320.createElement(Stack211, { gap: 2, align: "flex-end", style: { flexShrink: 0 } }, /* @__PURE__ */ React320.createElement(Group116, { gap: 4 }, /* @__PURE__ */ React320.createElement(Badge52, { size: "xs", variant: "light", color: getRoleColor3(bid.role) }, getBidRoleLabel(bid.role)), /* @__PURE__ */ React320.createElement(Badge52, { size: "xs", variant: "light", color: status === "approved" ? "green" : status === "rejected" ? "red" : "gray" }, status === "approved" ? "Approved" : status === "rejected" ? "Rejected" : "Pending")), /* @__PURE__ */ React320.createElement(Text199, { size: "xs", c: "dimmed" }, getTimeAgo3(bid.created || ""))));
35809
+ };
35739
35810
  return /* @__PURE__ */ React320.createElement(Stack211, { gap: "sm" }, lastDecision && /* @__PURE__ */ React320.createElement(
35740
35811
  MantineAlert,
35741
35812
  {
@@ -35747,12 +35818,7 @@ var BidInboxSection = ({
35747
35818
  styles: actionAlertStyles
35748
35819
  },
35749
35820
  lastDecision.kind === "proposed" ? `Proposal #${lastDecision.proposalId} asks the POD to grant ${lastDecision.roleLabel} access to ${lastDecision.name}. Nothing is granted until the vote passes \u2014 the bid stays pending until then.` : lastDecision.kind === "approved" ? `${lastDecision.roleLabel} access granted to ${lastDecision.name}. They can now ${lastDecision.roleLabel === "Evaluator" ? "evaluate" : "submit"} claims in this collection.` : `${lastDecision.name}'s application was declined.`
35750
- ), /* @__PURE__ */ React320.createElement(Group116, { justify: "space-between", align: "center" }, /* @__PURE__ */ React320.createElement(Text199, { size: "sm", fw: 600 }, "Incoming bids"), /* @__PURE__ */ React320.createElement(Group116, { gap: 4 }, /* @__PURE__ */ React320.createElement(DownloadCsvButton, { onDownload: handleDownloadBidsCsv, disabled: loading || bids.length === 0, label: "Download bids CSV", onError: setError }), /* @__PURE__ */ React320.createElement(DownloadZipButton, { onDownload: handleDownloadBidsZip, disabled: loading || bids.length === 0, label: "Download bids + media (ZIP)", onError: setError }), /* @__PURE__ */ React320.createElement(ActionIcon47, { variant: "subtle", color: "gray", size: "sm", onClick: refreshBids, disabled: loading }, /* @__PURE__ */ React320.createElement(IconRefresh9, { size: 16 })))), /* @__PURE__ */ React320.createElement(Divider22, { color: "color-mix(in srgb, var(--mantine-color-text) 6%, transparent)" }), loading && /* @__PURE__ */ React320.createElement(Group116, { gap: "xs", justify: "center", py: "sm" }, /* @__PURE__ */ React320.createElement(Loader61, { size: "xs" }), /* @__PURE__ */ React320.createElement(Text199, { size: "xs", c: "dimmed" }, "Loading bids\u2026")), !loading && bids.length === 0 && /* @__PURE__ */ React320.createElement(Text199, { size: "sm", c: "dimmed", ta: "center", py: "sm" }, "No bids available for this collection."), bids.map((bid) => {
35751
- const profile = profilesByDid[bid.did];
35752
- const displayName = profile?.displayname || bid.did || bid.address;
35753
- const status = bidEvaluatedStatus(bid) || "pending";
35754
- return /* @__PURE__ */ React320.createElement(ListItemContainer, { key: bid.id, isChecked: false, onClick: () => setSelectedBidId(bid.id) }, /* @__PURE__ */ React320.createElement(Stack211, { gap: 0, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React320.createElement(Text199, { fw: 500, size: "sm", truncate: true }, displayName), /* @__PURE__ */ React320.createElement(Text199, { size: "xs", c: "dimmed", truncate: true }, truncateAddress4(bid.address))), /* @__PURE__ */ React320.createElement(Stack211, { gap: 2, align: "flex-end", style: { flexShrink: 0 } }, /* @__PURE__ */ React320.createElement(Group116, { gap: 4 }, /* @__PURE__ */ React320.createElement(Badge52, { size: "xs", variant: "light", color: getRoleColor3(bid.role) }, getBidRoleLabel(bid.role)), /* @__PURE__ */ React320.createElement(Badge52, { size: "xs", variant: "light", color: status === "approved" ? "green" : status === "rejected" ? "red" : "gray" }, status === "approved" ? "Approved" : status === "rejected" ? "Rejected" : "Pending")), /* @__PURE__ */ React320.createElement(Text199, { size: "xs", c: "dimmed" }, getTimeAgo3(bid.created || ""))));
35755
- }), error && /* @__PURE__ */ React320.createElement(DismissibleAlert, { color: "red", styles: actionAlertStyles }, error));
35821
+ ), /* @__PURE__ */ React320.createElement(Group116, { justify: "space-between", align: "center" }, /* @__PURE__ */ React320.createElement(Text199, { size: "sm", fw: 600 }, "Incoming bids"), /* @__PURE__ */ React320.createElement(Group116, { gap: 4 }, /* @__PURE__ */ React320.createElement(DownloadCsvButton, { onDownload: handleDownloadBidsCsv, disabled: loading || bids.length === 0, label: "Download bids CSV", onError: setError }), /* @__PURE__ */ React320.createElement(DownloadZipButton, { onDownload: handleDownloadBidsZip, disabled: loading || bids.length === 0, label: "Download bids + media (ZIP)", onError: setError }), /* @__PURE__ */ React320.createElement(ActionIcon47, { variant: "subtle", color: "gray", size: "sm", onClick: refreshBids, disabled: loading }, /* @__PURE__ */ React320.createElement(IconRefresh9, { size: 16 })))), /* @__PURE__ */ React320.createElement(Divider22, { color: "color-mix(in srgb, var(--mantine-color-text) 6%, transparent)" }), loading && /* @__PURE__ */ React320.createElement(Group116, { gap: "xs", justify: "center", py: "sm" }, /* @__PURE__ */ React320.createElement(Loader61, { size: "xs" }), /* @__PURE__ */ React320.createElement(Text199, { size: "xs", c: "dimmed" }, "Loading bids\u2026")), !loading && bids.length === 0 && /* @__PURE__ */ React320.createElement(Text199, { size: "sm", c: "dimmed", ta: "center", py: "sm" }, "No bids available for this collection."), !loading && bids.length > 0 && openBids.length === 0 && /* @__PURE__ */ React320.createElement(Text199, { size: "sm", c: "dimmed", ta: "center", py: "sm" }, "No bids are awaiting a decision."), openBids.map(renderBidRow), decidedBids.length > 0 && /* @__PURE__ */ React320.createElement(React320.Fragment, null, /* @__PURE__ */ React320.createElement(Group116, { justify: "space-between", align: "center", mt: "xs" }, /* @__PURE__ */ React320.createElement(Text199, { size: "sm", fw: 600, c: "dimmed" }, "Already decided"), /* @__PURE__ */ React320.createElement(Badge52, { size: "xs", variant: "light", color: "gray" }, decidedBids.length)), /* @__PURE__ */ React320.createElement(Divider22, { color: "color-mix(in srgb, var(--mantine-color-text) 6%, transparent)" }), decidedBids.map(renderBidRow)), error && /* @__PURE__ */ React320.createElement(DismissibleAlert, { color: "red", styles: actionAlertStyles }, error));
35756
35822
  };
35757
35823
 
35758
35824
  // src/mantine/blocks/action/actionTypes/collectionUsers/index.ts
@@ -47827,7 +47893,7 @@ function MoreField({ label, value }) {
47827
47893
  }
47828
47894
 
47829
47895
  // src/mantine/blocks/action/actionTypes/xero/paymentCreate/XeroPaymentCreateFlowDetail.tsx
47830
- var STATUS_ORDER = { pending: 0, failed: 1, approved: 2, completed: 3, cancelled: 4 };
47896
+ var STATUS_ORDER2 = { pending: 0, failed: 1, approved: 2, completed: 3, cancelled: 4 };
47831
47897
  function shortId2(value, length = 10) {
47832
47898
  const text = String(value || "");
47833
47899
  return text.length > length ? text.slice(0, length) : text;
@@ -48052,7 +48118,7 @@ var XeroPaymentCreateFlowDetail = ({
48052
48118
  }, [provideSigningHandler, execute]);
48053
48119
  const sortedItems = useMemo154(
48054
48120
  () => [...workItems].sort((a, b) => {
48055
- const rank = (STATUS_ORDER[a.status] ?? 9) - (STATUS_ORDER[b.status] ?? 9);
48121
+ const rank = (STATUS_ORDER2[a.status] ?? 9) - (STATUS_ORDER2[b.status] ?? 9);
48056
48122
  if (rank !== 0) return rank;
48057
48123
  return (b.provenance?.createdAt || 0) - (a.provenance?.createdAt || 0);
48058
48124
  }),
@@ -59618,4 +59684,4 @@ export {
59618
59684
  ixoGraphQLClient,
59619
59685
  getEntity
59620
59686
  };
59621
- //# sourceMappingURL=chunk-B6S65337.js.map
59687
+ //# sourceMappingURL=chunk-2HFSD5YP.js.map