@capxul/sdk-react 4.20.0-beta.1 → 4.20.0-beta.2

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.
package/dist/index.d.mts CHANGED
@@ -487,6 +487,7 @@ interface ActivityReceipt {
487
487
  */
488
488
  type ActivityRow = {
489
489
  readonly kind: "payment";
490
+ readonly execution?: Payment["execution"];
490
491
  readonly reference: ActivityReference;
491
492
  readonly direction: PaymentDirection;
492
493
  readonly counterpartyLabel: string;
@@ -592,6 +593,8 @@ interface ActivityLoadMoreSlice {
592
593
  readonly sentinelRef: RefCallback<HTMLElement>;
593
594
  }
594
595
  interface ActivityDetailSlice {
596
+ /** Current Payment state from the existing detail read; absent for Movements. */
597
+ readonly payment?: Pick<Payment, "status" | "execution">;
595
598
  /** ONE finished document, never the array, so no consumer writes `documents[0]`. */
596
599
  readonly receiptDocument: PaymentDocumentRef | null;
597
600
  readonly openReceiptDocument: () => Promise<PaymentDocumentRender>;
package/dist/index.mjs CHANGED
@@ -1229,6 +1229,10 @@ function useActivityDetail(reference, actor) {
1229
1229
  typed
1230
1230
  ]);
1231
1231
  return {
1232
+ ...detail.data?.kind === "payment" ? { payment: {
1233
+ status: detail.data.payment.status,
1234
+ ...detail.data.payment.execution === void 0 ? {} : { execution: detail.data.payment.execution }
1235
+ } } : {},
1232
1236
  receiptDocument,
1233
1237
  openReceiptDocument,
1234
1238
  isOpeningDocument,
@@ -1432,16 +1436,18 @@ function toActivityRow(item, actor) {
1432
1436
  phase: MOVEMENT_PHASE,
1433
1437
  receipt: item.receipt
1434
1438
  };
1439
+ const reference = actor === void 0 ? {
1440
+ kind: "payment",
1441
+ id: item.id
1442
+ } : {
1443
+ kind: "payment",
1444
+ id: item.id,
1445
+ actor
1446
+ };
1435
1447
  return {
1436
1448
  kind: "payment",
1437
- reference: actor === void 0 ? {
1438
- kind: "payment",
1439
- id: item.id
1440
- } : {
1441
- kind: "payment",
1442
- id: item.id,
1443
- actor
1444
- },
1449
+ ...item.execution === void 0 ? {} : { execution: item.execution },
1450
+ reference,
1445
1451
  direction: item.direction,
1446
1452
  counterpartyLabel: item.counterpartyLabel,
1447
1453
  amountDisplay,
@@ -1451,7 +1457,10 @@ function toActivityRow(item, actor) {
1451
1457
  ledgerKind: item.ledgerKind,
1452
1458
  paymentType: item.paymentType,
1453
1459
  status: item.status,
1454
- phase: paymentPhase(item.status),
1460
+ phase: item.execution?.notSent ? {
1461
+ ...paymentPhase(item.status),
1462
+ needsAction: item.direction !== "in"
1463
+ } : paymentPhase(item.status),
1455
1464
  receipt: item.receipt
1456
1465
  };
1457
1466
  }
@@ -1525,7 +1534,7 @@ function buildCsv(items, actor, search) {
1525
1534
  row.direction,
1526
1535
  item.amount.value,
1527
1536
  item.amount.currency,
1528
- row.kind === "payment" ? row.status : "",
1537
+ row.kind === "payment" ? row.execution?.notSent ? "not_sent" : row.execution?.status === "unresolved" ? "verifying" : row.status : "",
1529
1538
  row.reference.id,
1530
1539
  row.receipt?.transactionHash ?? ""
1531
1540
  ]));
@@ -1642,6 +1651,16 @@ function useActivity(input) {
1642
1651
  searchText
1643
1652
  ]);
1644
1653
  const { fetchNextPage, hasNextPage, isFetchingNextPage, refetch } = query;
1654
+ const emptyContinuation = pages?.at(-1)?.items.length === 0 && hasNextPage && query.error === null;
1655
+ useEffect(() => {
1656
+ if (enabled && emptyContinuation && !isFetchingNextPage) fetchNextPage();
1657
+ }, [
1658
+ enabled,
1659
+ emptyContinuation,
1660
+ fetchNextPage,
1661
+ isFetchingNextPage,
1662
+ pages
1663
+ ]);
1645
1664
  const pagingRef = useRef({
1646
1665
  fetchNextPage,
1647
1666
  hasNextPage,
@@ -1744,7 +1763,7 @@ function useActivity(input) {
1744
1763
  },
1745
1764
  rows: {
1746
1765
  rows,
1747
- isLoading: query.isLoading,
1766
+ isLoading: query.isLoading || rows.length === 0 && emptyContinuation,
1748
1767
  error: asCapxulError$1(query.error),
1749
1768
  retry,
1750
1769
  observedAt: pages === void 0 ? null : pages[pages.length - 1]?.observedAt ?? null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/sdk-react",
3
- "version": "4.20.0-beta.1",
3
+ "version": "4.20.0-beta.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Xelmar-tech/infrastructure.git",
@@ -26,7 +26,7 @@
26
26
  "access": "public"
27
27
  },
28
28
  "dependencies": {
29
- "@capxul/sdk": "4.20.0-beta.1"
29
+ "@capxul/sdk": "4.20.0-beta.2"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@tanstack/react-query": "^5.66.9",
@@ -44,8 +44,8 @@
44
44
  "vite-plus": "0.3.0",
45
45
  "vitest": "4.1.11",
46
46
  "@capxul/errors": "0.3.0",
47
- "@capxul/types": "0.3.0",
48
- "@capxul/typescript-config": "0.0.0"
47
+ "@capxul/typescript-config": "0.0.0",
48
+ "@capxul/types": "0.3.0"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@tanstack/react-query": "^5.66.9",