@ixo/editor 3.0.0-beta.30 → 3.0.0-beta.32

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.
@@ -194,6 +194,18 @@ async function sendDirectMessage(matrixClient, targetDid, message) {
194
194
  return { roomId };
195
195
  }
196
196
 
197
+ // src/core/lib/actionRegistry/diffRegistry.ts
198
+ var diffResolvers = /* @__PURE__ */ new Map();
199
+ function registerDiffResolver(actionType, reg) {
200
+ diffResolvers.set(actionType, reg);
201
+ }
202
+ function getDiffResolver(actionType) {
203
+ return diffResolvers.get(actionType);
204
+ }
205
+ function hasDiffResolver(actionType) {
206
+ return diffResolvers.has(actionType);
207
+ }
208
+
197
209
  // src/core/lib/actionRegistry/actions/httpRequest.ts
198
210
  registerAction({
199
211
  type: "qi/http.request",
@@ -375,7 +387,7 @@ registerAction({
375
387
  }
376
388
  });
377
389
 
378
- // src/core/lib/actionRegistry/actions/bid.ts
390
+ // src/core/lib/actionRegistry/actions/bid/bid.ts
379
391
  function normalizeBidRole(role) {
380
392
  const normalized = String(role || "").trim().toLowerCase();
381
393
  if (normalized === "service_agent" || normalized === "sa") return "SA";
@@ -438,7 +450,7 @@ registerAction({
438
450
  }
439
451
  });
440
452
 
441
- // src/core/lib/actionRegistry/actions/evaluateBid.ts
453
+ // src/core/lib/actionRegistry/actions/evaluateBid/evaluateBid.ts
442
454
  function normalizeDecision(value) {
443
455
  const normalized = String(value || "").trim().toLowerCase();
444
456
  if (normalized === "approve" || normalized === "reject") {
@@ -559,7 +571,7 @@ registerAction({
559
571
  }
560
572
  });
561
573
 
562
- // src/core/lib/actionRegistry/actions/claim.ts
574
+ // src/core/lib/actionRegistry/actions/claim/claim.ts
563
575
  registerAction({
564
576
  type: "qi/claim.submit",
565
577
  can: "claim/submit",
@@ -631,7 +643,7 @@ registerAction({
631
643
  }
632
644
  });
633
645
 
634
- // src/core/lib/actionRegistry/actions/evaluateClaim.ts
646
+ // src/core/lib/actionRegistry/actions/evaluateClaim/evaluateClaim.ts
635
647
  function normalizeDecision2(value) {
636
648
  const normalized = String(value || "").trim().toLowerCase();
637
649
  if (normalized === "approve" || normalized === "reject") {
@@ -1622,6 +1634,276 @@ registerAction({
1622
1634
  }
1623
1635
  });
1624
1636
 
1637
+ // src/core/lib/actionRegistry/actions/bid/bid.diff.ts
1638
+ registerDiffResolver("bid", {
1639
+ resolver: async (inputs, _ctx) => {
1640
+ if (!inputs.surveyStarted) return [];
1641
+ const collectionId = String(inputs.collectionId || "").trim();
1642
+ const role = String(inputs.role || "").trim();
1643
+ const roleLabel = role === "evaluation_agent" || role === "ea" ? "Evaluator" : role ? "Contributor" : "Selected at runtime";
1644
+ return [
1645
+ {
1646
+ key: "applicationStatus",
1647
+ label: "Application Status",
1648
+ before: "None",
1649
+ after: "Pending",
1650
+ changeType: "replace",
1651
+ severity: "info"
1652
+ },
1653
+ {
1654
+ key: "role",
1655
+ label: "Role",
1656
+ before: "None",
1657
+ after: roleLabel,
1658
+ changeType: role ? "replace" : "unchanged"
1659
+ },
1660
+ {
1661
+ key: "collection",
1662
+ label: "Collection",
1663
+ before: collectionId || "Not configured",
1664
+ after: collectionId || "Not configured",
1665
+ changeType: "unchanged"
1666
+ },
1667
+ {
1668
+ key: "surveyAnswers",
1669
+ label: "Survey Answers",
1670
+ before: "None",
1671
+ after: "Submitted at runtime",
1672
+ changeType: "replace"
1673
+ }
1674
+ ];
1675
+ }
1676
+ });
1677
+
1678
+ // src/core/lib/actionRegistry/actions/evaluateBid/evaluateBid.diff.ts
1679
+ var USDC_DENOM = "ibc/6BBE9BD4246F8E04948D5A4EEE7164B2630263B9EBB5E7DC5F0A46C62A2FF97B";
1680
+ function formatCoin(coin) {
1681
+ const denom = coin.denom === USDC_DENOM ? "USDC" : coin.denom === "uixo" ? "IXO" : coin.denom;
1682
+ return `${coin.amount} ${denom}`;
1683
+ }
1684
+ registerDiffResolver("evaluateBid", {
1685
+ resolver: async (inputs, _ctx) => {
1686
+ const bidId = String(inputs.bidId || "").trim();
1687
+ if (!bidId) return [];
1688
+ const decision = String(inputs.decision || "").trim().toLowerCase();
1689
+ const role = String(inputs.role || "").trim();
1690
+ const collectionId = String(inputs.collectionId || "").trim();
1691
+ const applicantDid = String(inputs.applicantDid || "").trim();
1692
+ const roleLower = role.toLowerCase();
1693
+ const isEvaluator = roleLower === "evaluation_agent" || roleLower === "ea";
1694
+ const roleLabel = isEvaluator ? "Evaluator" : roleLower === "service_agent" || roleLower === "sa" ? "Contributor" : role || "Unknown";
1695
+ const isApprove = decision === "approve";
1696
+ const isReject = decision === "reject";
1697
+ const decisionLabel = isApprove ? "Approve" : isReject ? "Reject" : "Not selected";
1698
+ const afterStatus = isApprove ? "Approved" : isReject ? "Rejected" : "Pending";
1699
+ const results = [
1700
+ {
1701
+ key: "bidStatus",
1702
+ label: "Bid Status",
1703
+ before: "Pending",
1704
+ after: afterStatus,
1705
+ changeType: decision ? "replace" : "unchanged",
1706
+ severity: isReject ? "warning" : "info"
1707
+ },
1708
+ {
1709
+ key: "decision",
1710
+ label: "Decision",
1711
+ before: "None",
1712
+ after: decisionLabel,
1713
+ changeType: decision ? "replace" : "unchanged"
1714
+ },
1715
+ {
1716
+ key: "applicantRole",
1717
+ label: "Applicant Role",
1718
+ before: roleLabel,
1719
+ after: roleLabel,
1720
+ changeType: "unchanged"
1721
+ },
1722
+ {
1723
+ key: "bidId",
1724
+ label: "Bid ID",
1725
+ before: bidId || "Not selected",
1726
+ after: bidId || "Not selected",
1727
+ changeType: "unchanged"
1728
+ },
1729
+ {
1730
+ key: "collection",
1731
+ label: "Collection",
1732
+ before: collectionId || "Not configured",
1733
+ after: collectionId || "Not configured",
1734
+ changeType: "unchanged"
1735
+ }
1736
+ ];
1737
+ if (isEvaluator) {
1738
+ let amountsLabel = "None";
1739
+ try {
1740
+ const parsed = typeof inputs.maxAmounts === "string" ? JSON.parse(inputs.maxAmounts) : inputs.maxAmounts;
1741
+ if (Array.isArray(parsed) && parsed.length > 0) {
1742
+ amountsLabel = parsed.map((a) => formatCoin(a)).join(", ");
1743
+ }
1744
+ } catch {
1745
+ }
1746
+ results.push({
1747
+ key: "maxAmounts",
1748
+ label: "Max Amounts",
1749
+ before: "None",
1750
+ after: amountsLabel,
1751
+ changeType: amountsLabel !== "None" ? "replace" : "unchanged"
1752
+ });
1753
+ }
1754
+ if (isReject) {
1755
+ const reason = String(inputs.rejectReason || inputs.reason || "").trim();
1756
+ results.push({
1757
+ key: "reason",
1758
+ label: "Rejection Reason",
1759
+ before: "None",
1760
+ after: reason || "Not provided",
1761
+ changeType: reason ? "replace" : "unchanged",
1762
+ severity: "warning"
1763
+ });
1764
+ }
1765
+ if (applicantDid) {
1766
+ results.push({
1767
+ key: "applicant",
1768
+ label: "Applicant",
1769
+ before: applicantDid,
1770
+ after: applicantDid,
1771
+ changeType: "unchanged"
1772
+ });
1773
+ }
1774
+ return results;
1775
+ }
1776
+ });
1777
+
1778
+ // src/core/lib/actionRegistry/actions/claim/claim.diff.ts
1779
+ registerDiffResolver("claim", {
1780
+ resolver: async (inputs, _ctx) => {
1781
+ if (!inputs.claimStarted) return [];
1782
+ const collectionId = String(inputs.collectionId || "").trim();
1783
+ const deedDid = String(inputs.deedDid || "").trim();
1784
+ return [
1785
+ {
1786
+ key: "claimStatus",
1787
+ label: "Claim Status",
1788
+ before: "None",
1789
+ after: "Pending",
1790
+ changeType: "replace",
1791
+ severity: "info"
1792
+ },
1793
+ {
1794
+ key: "collection",
1795
+ label: "Collection",
1796
+ before: collectionId || "Not configured",
1797
+ after: collectionId || "Not configured",
1798
+ changeType: "unchanged"
1799
+ },
1800
+ {
1801
+ key: "deed",
1802
+ label: "Deed",
1803
+ before: deedDid || "Not configured",
1804
+ after: deedDid || "Not configured",
1805
+ changeType: "unchanged"
1806
+ },
1807
+ {
1808
+ key: "surveyAnswers",
1809
+ label: "Survey Answers",
1810
+ before: "None",
1811
+ after: "Submitted at runtime",
1812
+ changeType: "replace"
1813
+ }
1814
+ ];
1815
+ }
1816
+ });
1817
+
1818
+ // src/core/lib/actionRegistry/actions/evaluateClaim/evaluateClaim.diff.ts
1819
+ var USDC_DENOM2 = "ibc/6BBE9BD4246F8E04948D5A4EEE7164B2630263B9EBB5E7DC5F0A46C62A2FF97B";
1820
+ var DECIMALS = 6;
1821
+ function formatCoin2(coin) {
1822
+ const denom = coin.denom === USDC_DENOM2 ? "USDC" : coin.denom === "uixo" ? "IXO" : coin.denom;
1823
+ const raw = Number(coin.amount);
1824
+ const display = raw >= Math.pow(10, DECIMALS) ? raw / Math.pow(10, DECIMALS) : raw;
1825
+ return `${display} ${denom}`;
1826
+ }
1827
+ registerDiffResolver("evaluateClaim", {
1828
+ resolver: async (inputs, _ctx) => {
1829
+ const claimId = String(inputs.claimId || "").trim();
1830
+ if (!claimId || inputs.alreadyEvaluated) return [];
1831
+ const decision = String(inputs.decision || "").trim().toLowerCase();
1832
+ const collectionId = String(inputs.collectionId || "").trim();
1833
+ const createUdid = Boolean(inputs.createUdid);
1834
+ const isApprove = decision === "approve";
1835
+ const isReject = decision === "reject";
1836
+ const decisionLabel = isApprove ? "Approve" : isReject ? "Reject" : "Not selected";
1837
+ const afterStatus = isApprove ? "Approved" : isReject ? "Rejected" : "Pending";
1838
+ const results = [
1839
+ {
1840
+ key: "claimStatus",
1841
+ label: "Claim Status",
1842
+ before: "Pending",
1843
+ after: afterStatus,
1844
+ changeType: decision ? "replace" : "unchanged",
1845
+ severity: isReject ? "warning" : "info"
1846
+ },
1847
+ {
1848
+ key: "decision",
1849
+ label: "Decision",
1850
+ before: "None",
1851
+ after: decisionLabel,
1852
+ changeType: decision ? "replace" : "unchanged"
1853
+ },
1854
+ {
1855
+ key: "claimId",
1856
+ label: "Claim ID",
1857
+ before: claimId || "Not selected",
1858
+ after: claimId || "Not selected",
1859
+ changeType: "unchanged"
1860
+ },
1861
+ {
1862
+ key: "collection",
1863
+ label: "Collection",
1864
+ before: collectionId || "Not configured",
1865
+ after: collectionId || "Not configured",
1866
+ changeType: "unchanged"
1867
+ },
1868
+ {
1869
+ key: "udidProof",
1870
+ label: "UDID Proof",
1871
+ before: "None",
1872
+ after: createUdid ? "Will be generated" : "Skipped",
1873
+ changeType: createUdid ? "replace" : "unchanged"
1874
+ }
1875
+ ];
1876
+ let amountsLabel = "None";
1877
+ try {
1878
+ const raw = typeof inputs.amount === "string" ? JSON.parse(inputs.amount) : inputs.amount;
1879
+ if (Array.isArray(raw) && raw.length > 0) {
1880
+ amountsLabel = raw.map((a) => formatCoin2(a)).join(", ");
1881
+ } else if (raw && typeof raw === "object" && raw.denom) {
1882
+ amountsLabel = formatCoin2(raw);
1883
+ }
1884
+ } catch {
1885
+ }
1886
+ results.push({
1887
+ key: "payment",
1888
+ label: "Payment",
1889
+ before: "None",
1890
+ after: amountsLabel,
1891
+ changeType: amountsLabel !== "None" ? "replace" : "unchanged"
1892
+ });
1893
+ if (inputs.outcomeComplete !== void 0) {
1894
+ results.push({
1895
+ key: "outcome",
1896
+ label: "Outcome Template",
1897
+ before: "None",
1898
+ after: inputs.outcomeComplete ? "Completed" : "Not completed",
1899
+ changeType: inputs.outcomeComplete ? "replace" : "unchanged",
1900
+ severity: inputs.outcomeComplete ? "info" : "warning"
1901
+ });
1902
+ }
1903
+ return results;
1904
+ }
1905
+ });
1906
+
1625
1907
  // src/core/lib/ucanDelegationStore.ts
1626
1908
  var ROOT_DELEGATION_KEY = "__root__";
1627
1909
  var STORE_VERSION_KEY = "__version__";
@@ -2538,6 +2820,8 @@ export {
2538
2820
  typeToCan,
2539
2821
  getAllCanMappings,
2540
2822
  buildServicesFromHandlers,
2823
+ getDiffResolver,
2824
+ hasDiffResolver,
2541
2825
  buildVerifiableCredential,
2542
2826
  buildDomainCardLinkedResource,
2543
2827
  parseLinkedEntities,
@@ -2561,4 +2845,4 @@ export {
2561
2845
  executeNode,
2562
2846
  createUcanService
2563
2847
  };
2564
- //# sourceMappingURL=chunk-77R3T42S.mjs.map
2848
+ //# sourceMappingURL=chunk-5D26UG3I.mjs.map