@powerhousedao/contributor-billing 0.1.50 → 0.1.52
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/document-models/expense-report/src/reducers/wallet.d.ts.map +1 -1
- package/dist/document-models/expense-report/src/reducers/wallet.js +4 -4
- package/dist/editors/account-transactions-editor/alchemyIntegration.d.ts +1 -0
- package/dist/editors/account-transactions-editor/alchemyIntegration.d.ts.map +1 -1
- package/dist/editors/account-transactions-editor/alchemyIntegration.js +1 -0
- package/dist/editors/account-transactions-editor/editor.d.ts.map +1 -1
- package/dist/editors/account-transactions-editor/editor.js +67 -10
- package/dist/editors/accounts-editor/components/AccountCard.d.ts.map +1 -1
- package/dist/editors/accounts-editor/components/AccountCard.js +1 -1
- package/dist/editors/accounts-editor/components/AccountForm.d.ts.map +1 -1
- package/dist/editors/accounts-editor/components/AccountForm.js +55 -16
- package/dist/editors/accounts-editor/components/AccountsList.js +1 -1
- package/dist/editors/accounts-editor/editor.d.ts.map +1 -1
- package/dist/editors/accounts-editor/editor.js +86 -44
- package/dist/editors/contributor-billing/components/BillingOverview.d.ts +2 -1
- package/dist/editors/contributor-billing/components/BillingOverview.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/BillingOverview.js +2 -2
- package/dist/editors/contributor-billing/components/DashboardHome.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DashboardHome.js +78 -8
- package/dist/editors/contributor-billing/components/DocumentDropZone.d.ts +13 -0
- package/dist/editors/contributor-billing/components/DocumentDropZone.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/DocumentDropZone.js +101 -0
- package/dist/editors/contributor-billing/components/DriveContents.d.ts +2 -1
- package/dist/editors/contributor-billing/components/DriveContents.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveContents.js +7 -7
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.js +25 -3
- package/dist/editors/contributor-billing/components/FolderTree.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/FolderTree.js +37 -34
- package/dist/editors/contributor-billing/components/MonthReportCard.d.ts +2 -1
- package/dist/editors/contributor-billing/components/MonthReportCard.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/MonthReportCard.js +12 -2
- package/dist/editors/contributor-billing/components/MonthlyReportsOverview.d.ts +2 -1
- package/dist/editors/contributor-billing/components/MonthlyReportsOverview.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/MonthlyReportsOverview.js +69 -8
- package/dist/editors/contributor-billing/components/ReportingView.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/ReportingView.js +38 -9
- package/dist/editors/contributor-billing/components/SubscriptionsOverview.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/SubscriptionsOverview.js +1 -1
- package/dist/editors/contributor-billing/config.d.ts.map +1 -1
- package/dist/editors/contributor-billing/config.js +2 -1
- package/dist/editors/contributor-billing/hooks/useDocumentAutoPlacement.d.ts +18 -0
- package/dist/editors/contributor-billing/hooks/useDocumentAutoPlacement.d.ts.map +1 -0
- package/dist/editors/contributor-billing/hooks/useDocumentAutoPlacement.js +149 -0
- package/dist/editors/contributor-billing/hooks/useMonthlyReports.d.ts.map +1 -1
- package/dist/editors/contributor-billing/hooks/useMonthlyReports.js +30 -4
- package/dist/editors/expense-report/components/SetOwner.d.ts.map +1 -1
- package/dist/editors/expense-report/components/SetOwner.js +43 -2
- package/dist/editors/expense-report/components/WalletsTable.d.ts.map +1 -1
- package/dist/editors/expense-report/components/WalletsTable.js +22 -3
- package/dist/editors/expense-report/editor.d.ts.map +1 -1
- package/dist/editors/expense-report/editor.js +20 -2
- package/dist/editors/expense-report/hooks/useSyncWallet.d.ts.map +1 -1
- package/dist/editors/expense-report/hooks/useSyncWallet.js +41 -24
- package/dist/editors/operational-hub-profile-editor/components/ProfileOverview.d.ts +10 -0
- package/dist/editors/operational-hub-profile-editor/components/ProfileOverview.d.ts.map +1 -0
- package/dist/editors/operational-hub-profile-editor/components/ProfileOverview.js +114 -0
- package/dist/editors/operational-hub-profile-editor/components/SubteamsPicker.d.ts.map +1 -1
- package/dist/editors/operational-hub-profile-editor/components/SubteamsPicker.js +44 -4
- package/dist/editors/operational-hub-profile-editor/editor.d.ts.map +1 -1
- package/dist/editors/operational-hub-profile-editor/editor.js +7 -2
- package/dist/editors/snapshot-report-editor/components/SetOwner.d.ts.map +1 -1
- package/dist/editors/snapshot-report-editor/components/SetOwner.js +43 -2
- package/dist/editors/snapshot-report-editor/editor.d.ts.map +1 -1
- package/dist/editors/snapshot-report-editor/editor.js +9 -2
- package/dist/editors/snapshot-report-editor/hooks/useSyncSnapshotAccount.d.ts.map +1 -1
- package/dist/editors/snapshot-report-editor/hooks/useSyncSnapshotAccount.js +120 -27
- package/dist/editors/snapshot-report-editor/utils/balanceCalculations.d.ts +5 -1
- package/dist/editors/snapshot-report-editor/utils/balanceCalculations.d.ts.map +1 -1
- package/dist/editors/snapshot-report-editor/utils/balanceCalculations.js +47 -1
- package/dist/style.css +138 -0
- package/dist/subgraphs/budget-statements/schema.d.ts.map +1 -1
- package/dist/subgraphs/budget-statements/schema.js +1 -0
- package/dist/subgraphs/index.d.ts +0 -1
- package/dist/subgraphs/index.d.ts.map +1 -1
- package/dist/subgraphs/index.js +0 -1
- package/dist/subgraphs/resources-services/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/resources-services/resolvers.js +150 -0
- package/dist/subgraphs/resources-services/schema.d.ts.map +1 -1
- package/dist/subgraphs/resources-services/schema.js +18 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../../../../document-models/expense-report/src/reducers/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mEAAmE,CAAC;AAiEvH,eAAO,MAAM,6BAA6B,EAAE,
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../../../../document-models/expense-report/src/reducers/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mEAAmE,CAAC;AAiEvH,eAAO,MAAM,6BAA6B,EAAE,6BAuR3C,CAAC"}
|
|
@@ -126,10 +126,10 @@ export const expenseReportWalletOperations = {
|
|
|
126
126
|
lineItem.forecast = action.input.forecast;
|
|
127
127
|
nextTotals.totalForecast = action.input.forecast;
|
|
128
128
|
}
|
|
129
|
-
if (action.input.payments !== undefined
|
|
130
|
-
|
|
131
|
-
lineItem.payments = action.input.payments;
|
|
132
|
-
nextTotals.totalPayments = action.input.payments;
|
|
129
|
+
if (action.input.payments !== undefined) {
|
|
130
|
+
// Explicitly handle null to reset payments to 0
|
|
131
|
+
lineItem.payments = action.input.payments ?? null;
|
|
132
|
+
nextTotals.totalPayments = action.input.payments ?? 0;
|
|
133
133
|
}
|
|
134
134
|
if (action.input.comments !== undefined &&
|
|
135
135
|
action.input.comments !== null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alchemyIntegration.d.ts","sourceRoot":"","sources":["../../../editors/account-transactions-editor/alchemyIntegration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"alchemyIntegration.d.ts","sourceRoot":"","sources":["../../../editors/account-transactions-editor/alchemyIntegration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,sBAAsB,EAAE,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,qBAAa,yBAAyB;IACpC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,OAAO,CAAU;;IAOzB;;;OAGG;IACG,0BAA0B,CAC9B,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,yBAAyB,CAAC;IA0ErC;;;OAGG;IACG,4BAA4B,CAChC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,wBAAwB,CAAC;IA0DpC;;OAEG;IACH,kBAAkB;;;;;CAOnB;AAGD,eAAO,MAAM,kBAAkB,2BAAkC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/account-transactions-editor/editor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/account-transactions-editor/editor.tsx"],"names":[],"mappings":"AAgCA,MAAM,CAAC,OAAO,UAAU,MAAM,4CAwb7B"}
|
|
@@ -2,7 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { Button } from "@powerhousedao/document-engineering";
|
|
4
4
|
import { DocumentToolbar } from "@powerhousedao/design-system/connect";
|
|
5
|
-
import { setSelectedNode, useParentFolderForSelectedNode, } from "@powerhousedao/reactor-browser";
|
|
5
|
+
import { setSelectedNode, useParentFolderForSelectedNode, useSelectedDrive, useDocumentsInSelectedDrive, dispatchActions, } from "@powerhousedao/reactor-browser";
|
|
6
|
+
import { deleteNode } from "document-drive";
|
|
6
7
|
import { generateId } from "document-model/core";
|
|
7
8
|
import { useSelectedAccountTransactionsDocument } from "../hooks/useAccountTransactionsDocument.js";
|
|
8
9
|
import { addTransaction, updateTransaction, deleteTransaction, setAccount, } from "../../document-models/account-transactions/gen/creators.js";
|
|
@@ -10,12 +11,17 @@ import { TransactionsTable } from "./components/TransactionsTable.js";
|
|
|
10
11
|
import { TransactionForm } from "./components/TransactionForm.js";
|
|
11
12
|
import { AccountSection } from "./components/AccountSection.js";
|
|
12
13
|
import { alchemyIntegration } from "./alchemyIntegration.js";
|
|
14
|
+
import { actions as accountsActions } from "../../document-models/accounts/index.js";
|
|
15
|
+
import { actions as expenseReportActions } from "../../document-models/expense-report/index.js";
|
|
13
16
|
export default function Editor() {
|
|
14
17
|
const [document, dispatch] = useSelectedAccountTransactionsDocument();
|
|
15
18
|
const parentFolder = useParentFolderForSelectedNode();
|
|
19
|
+
const [selectedDrive] = useSelectedDrive();
|
|
20
|
+
const allDocuments = useDocumentsInSelectedDrive();
|
|
16
21
|
const [viewMode, setViewMode] = useState("list");
|
|
17
22
|
const [editingTransaction, setEditingTransaction] = useState(null);
|
|
18
23
|
const [isLoadingTransactions, setIsLoadingTransactions] = useState(false);
|
|
24
|
+
const [isDeleting, setIsDeleting] = useState(false);
|
|
19
25
|
function handleClose() {
|
|
20
26
|
setSelectedNode(parentFolder?.id);
|
|
21
27
|
}
|
|
@@ -46,6 +52,62 @@ export default function Editor() {
|
|
|
46
52
|
setViewMode("list");
|
|
47
53
|
setEditingTransaction(null);
|
|
48
54
|
}
|
|
55
|
+
async function handleDeleteDocument() {
|
|
56
|
+
if (!document)
|
|
57
|
+
return;
|
|
58
|
+
const confirmMessage = "Are you sure you want to delete this account transactions document? This will also remove all references to it from Accounts, Expense Reports, and Snapshot Reports.";
|
|
59
|
+
if (!window.confirm(confirmMessage)) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
setIsDeleting(true);
|
|
63
|
+
const documentId = document.header.id;
|
|
64
|
+
try {
|
|
65
|
+
// Step 1: Find and remove references from Accounts documents
|
|
66
|
+
const accountsDocs = allDocuments?.filter((doc) => doc.header.documentType === "powerhouse/accounts") || [];
|
|
67
|
+
for (const accountsDoc of accountsDocs) {
|
|
68
|
+
const state = accountsDoc.state;
|
|
69
|
+
const accounts = (state?.global?.accounts || []);
|
|
70
|
+
const accountsToUpdate = accounts.filter((acc) => acc.accountTransactionsId === documentId);
|
|
71
|
+
if (accountsToUpdate.length > 0) {
|
|
72
|
+
const updateActions = accountsToUpdate.map((acc) => accountsActions.updateAccount({
|
|
73
|
+
id: acc.id,
|
|
74
|
+
accountTransactionsId: null,
|
|
75
|
+
}));
|
|
76
|
+
await dispatchActions(updateActions, accountsDoc.header.id);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// Step 2: Find and remove references from Expense Report documents
|
|
80
|
+
const expenseReportDocs = allDocuments?.filter((doc) => doc.header.documentType === "powerhouse/expense-report") || [];
|
|
81
|
+
for (const expenseReportDoc of expenseReportDocs) {
|
|
82
|
+
const state = expenseReportDoc.state;
|
|
83
|
+
const wallets = (state?.global?.wallets || []);
|
|
84
|
+
const walletsToUpdate = wallets.filter((wallet) => wallet.accountTransactionsDocumentId === documentId);
|
|
85
|
+
if (walletsToUpdate.length > 0) {
|
|
86
|
+
const updateActions = walletsToUpdate.map((wallet) => expenseReportActions.updateWallet({
|
|
87
|
+
address: wallet.wallet,
|
|
88
|
+
accountTransactionsDocumentId: null,
|
|
89
|
+
}));
|
|
90
|
+
await dispatchActions(updateActions, expenseReportDoc.header.id);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Step 3: Note about Snapshot Reports
|
|
94
|
+
// Snapshot Reports don't have an action to update accountTransactionsId,
|
|
95
|
+
// so those references will remain but won't cause errors since the document is deleted
|
|
96
|
+
// Step 4: Delete the document node from the drive
|
|
97
|
+
if (selectedDrive?.header.id) {
|
|
98
|
+
await dispatchActions([deleteNode({ id: documentId })], selectedDrive.header.id);
|
|
99
|
+
}
|
|
100
|
+
// Step 5: Navigate back to parent folder
|
|
101
|
+
setSelectedNode(parentFolder?.id);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
console.error("Error deleting account transactions document:", error);
|
|
105
|
+
alert(`Failed to delete document: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
106
|
+
}
|
|
107
|
+
finally {
|
|
108
|
+
setIsDeleting(false);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
49
111
|
async function handleFetchTransactions() {
|
|
50
112
|
const account = document.state.global.account;
|
|
51
113
|
if (!account?.account) {
|
|
@@ -117,14 +179,6 @@ export default function Editor() {
|
|
|
117
179
|
unit: txData.token,
|
|
118
180
|
};
|
|
119
181
|
}
|
|
120
|
-
// Create unique key for this transaction (include amount to handle multiple transfers in same tx)
|
|
121
|
-
const amountStr = `${amount.value}-${amount.unit}`;
|
|
122
|
-
const txKey = `${txData.txHash}-${txData.blockNumber}-${txData.token}-${txData.counterParty}-${amountStr}`;
|
|
123
|
-
// Skip if transaction already exists
|
|
124
|
-
if (existingTxKeys.has(txKey)) {
|
|
125
|
-
skippedCount++;
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
182
|
// Validation - ensure we have required fields before adding
|
|
129
183
|
if (!txData.direction) {
|
|
130
184
|
console.error(`[Editor] Skipping transaction with undefined direction:`, txData);
|
|
@@ -141,6 +195,8 @@ export default function Editor() {
|
|
|
141
195
|
skippedCount++;
|
|
142
196
|
continue;
|
|
143
197
|
}
|
|
198
|
+
// Dispatch transaction - reducer will prevent duplicates based on uniqueId
|
|
199
|
+
// If uniqueId already exists, the reducer will throw an error which is stored in the operation
|
|
144
200
|
dispatch(addTransaction({
|
|
145
201
|
id: generateId(),
|
|
146
202
|
counterParty: txData.counterParty,
|
|
@@ -149,6 +205,7 @@ export default function Editor() {
|
|
|
149
205
|
txHash: txData.txHash,
|
|
150
206
|
token: txData.token,
|
|
151
207
|
blockNumber: txData.blockNumber,
|
|
208
|
+
uniqueId: txData.uniqueId || null,
|
|
152
209
|
accountingPeriod: txData.accountingPeriod,
|
|
153
210
|
direction: txData.direction || "OUTFLOW", // Use direction from Alchemy data or default to OUTFLOW
|
|
154
211
|
budget: null, // No budget assigned initially
|
|
@@ -196,7 +253,7 @@ export default function Editor() {
|
|
|
196
253
|
setIsLoadingTransactions(false);
|
|
197
254
|
}
|
|
198
255
|
}
|
|
199
|
-
return (_jsxs("div", { className: "h-screen flex flex-col bg-gray-50", children: [_jsx(DocumentToolbar, { document: document, onClose: handleClose }),
|
|
256
|
+
return (_jsxs("div", { className: "h-screen flex flex-col bg-gray-50", children: [_jsx(DocumentToolbar, { document: document, onClose: handleClose }), _jsxs("div", { className: "bg-white border-b border-gray-200 px-4 py-3 flex items-center justify-between", children: [_jsx("h1", { className: "text-lg font-semibold text-gray-900", children: "Account Transactions" }), _jsx(Button, { onClick: handleDeleteDocument, disabled: isDeleting, className: "bg-red-600 hover:bg-red-700 disabled:bg-gray-400 text-white px-4 py-2 rounded-lg font-medium shadow-sm transition-colors", children: isDeleting ? "Deleting..." : "Delete Document" })] }), _jsx("div", { className: "flex-1 overflow-auto", children: _jsxs("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8", children: [_jsx(AccountSection, { account: document.state.global.account, hasFetchedTransactions: (document.state.global.transactions || []).length > 0, onSetAccount: (address, name) => {
|
|
200
257
|
dispatch(setAccount({
|
|
201
258
|
id: generateId(),
|
|
202
259
|
account: address || "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountCard.d.ts","sourceRoot":"","sources":["../../../../editors/accounts-editor/components/AccountCard.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EACtB,MAAM,uDAAuD,CAAC;AAG/D,UAAU,gBAAgB;IACxB,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IACxC,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,iBAAiB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACvE,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IACvD,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,MAAM,EACN,QAAQ,EACR,iBAAiB,EACjB,oBAAoB,EACpB,sBAA8B,GAC/B,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"AccountCard.d.ts","sourceRoot":"","sources":["../../../../editors/accounts-editor/components/AccountCard.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EACtB,MAAM,uDAAuD,CAAC;AAG/D,UAAU,gBAAgB;IACxB,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IACxC,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,iBAAiB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACvE,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IACvD,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,MAAM,EACN,QAAQ,EACR,iBAAiB,EACjB,oBAAoB,EACpB,sBAA8B,GAC/B,EAAE,gBAAgB,2CA2VlB"}
|
|
@@ -15,7 +15,7 @@ export function AccountCard({ account, onEdit, onDelete, onUpdateKycStatus, onCr
|
|
|
15
15
|
onUpdateKycStatus(account.id, status);
|
|
16
16
|
setShowKycMenu(false);
|
|
17
17
|
}
|
|
18
|
-
return (_jsx("div", { className: "bg-white rounded-xl border border-gray-200 shadow-sm hover:shadow-md transition-shadow", children: _jsxs("div", { className: "p-6", children: [_jsxs("div", { className: "flex items-start justify-between mb-4", children: [_jsxs("div", { className: "flex-1", children: [_jsx("h3", { className: "text-lg font-semibold text-gray-900 mb-1", children: account.name }), _jsx("p", { className: "text-sm text-gray-600 font-mono", children: account.account })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("button", { onClick: () => onEdit(account), className: "p-2 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded-lg transition-colors", title: "Edit account", "aria-label": `Edit account ${account.name}`, children: _jsx("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" }) }) }), _jsx("button", { onClick: () => onDelete(account.id), className: "p-2 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors", title: "Delete account", "aria-label": `Delete account ${account.name}`, children: _jsx("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" }) }) })] })] }), _jsxs("div", { className: "space-y-3", children: [account.type && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-sm font-medium text-gray-500", children: "Type:" }), _jsx("span", { className: `inline-flex items-center px-2.5 py-0.5 rounded-md text-xs font-medium ${accountTypeColors[account.type]}`, children: account.type })] })), account.budgetPath && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-sm font-medium text-gray-500", children: "Budget Path:" }), _jsx("span", { className: "text-sm text-gray-900", children: account.budgetPath })] })), account.accountTransactionsId && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-sm font-medium text-gray-500", children: "Transactions ID:" }), _jsx("span", { className: "text-sm text-gray-900 font-mono", children: account.accountTransactionsId })] })), account.chain && account.chain.length > 0 && (_jsxs("div", { className: "flex items-start gap-2", children: [_jsx("span", { className: "text-sm font-medium text-gray-500", children: "Chains:" }), _jsx("div", { className: "flex flex-wrap gap-1.5", children: account.chain.map((chain, idx) => (_jsx("span", { className: "inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium bg-gray-100 text-gray-700", children: chain }, idx))) })] })), account.owners && account.owners.length > 0 && (_jsxs("div", { className: "flex items-start gap-2", children: [_jsx("span", { className: "text-sm font-medium text-gray-500", children: "Owners:" }), _jsx("div", { className: "flex flex-wrap gap-1.5", children: account.owners.map((owner, idx) => (_jsx("span", { className: "inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium bg-indigo-100 text-indigo-700", children: owner }, idx))) })] })), _jsxs("div", { className: "pt-3 border-t border-gray-100", children: [_jsxs("div", { className: "flex items-center justify-between mb-4", children: [_jsx("span", { className: "text-sm font-medium text-gray-500", children: "KYC/AML Status:" }), _jsxs("div", { className: "relative", children: [_jsx("button", { onClick: () => setShowKycMenu(!showKycMenu), className: "hover:opacity-80 transition-opacity", title: "Update KYC/AML status", "aria-label": `Update KYC/AML status for ${account.name}, currently ${account.KycAmlStatus || "Not Set"}`, "aria-expanded": showKycMenu, "aria-haspopup": "
|
|
18
|
+
return (_jsx("div", { className: "bg-white rounded-xl border border-gray-200 shadow-sm hover:shadow-md transition-shadow", children: _jsxs("div", { className: "p-6", children: [_jsxs("div", { className: "flex items-start justify-between mb-4", children: [_jsxs("div", { className: "flex-1", children: [_jsx("h3", { className: "text-lg font-semibold text-gray-900 mb-1", children: account.name }), _jsx("p", { className: "text-sm text-gray-600 font-mono", children: account.account })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("button", { onClick: () => onEdit(account), className: "p-2 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded-lg transition-colors focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 focus:outline-none", title: "Edit account", "aria-label": `Edit account ${account.name}`, children: _jsx("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" }) }) }), _jsx("button", { onClick: () => onDelete(account.id), className: "p-2 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors focus-visible:ring-2 focus-visible:ring-red-500 focus-visible:ring-offset-2 focus:outline-none", title: "Delete account", "aria-label": `Delete account ${account.name}`, children: _jsx("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" }) }) })] })] }), _jsxs("div", { className: "space-y-3", children: [account.type && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-sm font-medium text-gray-500", children: "Type:" }), _jsx("span", { className: `inline-flex items-center px-2.5 py-0.5 rounded-md text-xs font-medium ${accountTypeColors[account.type]}`, children: account.type })] })), account.budgetPath && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-sm font-medium text-gray-500", children: "Budget Path:" }), _jsx("span", { className: "text-sm text-gray-900", children: account.budgetPath })] })), account.accountTransactionsId && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-sm font-medium text-gray-500", children: "Transactions ID:" }), _jsx("span", { className: "text-sm text-gray-900 font-mono", children: account.accountTransactionsId })] })), account.chain && account.chain.length > 0 && (_jsxs("div", { className: "flex items-start gap-2", children: [_jsx("span", { className: "text-sm font-medium text-gray-500", children: "Chains:" }), _jsx("div", { className: "flex flex-wrap gap-1.5", children: account.chain.map((chain, idx) => (_jsx("span", { className: "inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium bg-gray-100 text-gray-700", children: chain }, idx))) })] })), account.owners && account.owners.length > 0 && (_jsxs("div", { className: "flex items-start gap-2", children: [_jsx("span", { className: "text-sm font-medium text-gray-500", children: "Owners:" }), _jsx("div", { className: "flex flex-wrap gap-1.5", children: account.owners.map((owner, idx) => (_jsx("span", { className: "inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium bg-indigo-100 text-indigo-700", children: owner }, idx))) })] })), _jsxs("div", { className: "pt-3 border-t border-gray-100", children: [_jsxs("div", { className: "flex items-center justify-between mb-4", children: [_jsx("span", { className: "text-sm font-medium text-gray-500", children: "KYC/AML Status:" }), _jsxs("div", { className: "relative", children: [_jsx("button", { id: `kyc-status-button-${account.id}`, onClick: () => setShowKycMenu(!showKycMenu), className: "hover:opacity-80 transition-opacity focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 focus:outline-none rounded", title: "Update KYC/AML status", "aria-label": `Update KYC/AML status for ${account.name}, currently ${account.KycAmlStatus || "Not Set"}`, "aria-expanded": showKycMenu, "aria-haspopup": "menu", children: _jsx(KYCStatusBadge, { status: account.KycAmlStatus }) }), showKycMenu && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-10", onClick: () => setShowKycMenu(false), "aria-hidden": "true" }), _jsx("div", { className: "absolute right-0 mt-2 w-48 bg-white rounded-lg shadow-lg border border-gray-200 z-20", role: "menu", "aria-orientation": "vertical", "aria-labelledby": `kyc-status-button-${account.id}`, children: _jsxs("div", { className: "py-1", children: [_jsxs("button", { role: "menuitem", onClick: () => handleKycStatusChange("PASSED"), className: "w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-green-50 hover:text-green-900 flex items-center gap-2 focus:bg-green-50 focus:text-green-900 focus:outline-none", children: [_jsx("span", { className: "w-2 h-2 rounded-full bg-green-500", "aria-hidden": "true" }), "Passed"] }), _jsxs("button", { role: "menuitem", onClick: () => handleKycStatusChange("PENDING"), className: "w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-yellow-50 hover:text-yellow-900 flex items-center gap-2 focus:bg-yellow-50 focus:text-yellow-900 focus:outline-none", children: [_jsx("span", { className: "w-2 h-2 rounded-full bg-yellow-500", "aria-hidden": "true" }), "Pending"] }), _jsxs("button", { role: "menuitem", onClick: () => handleKycStatusChange("FAILED"), className: "w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-red-50 hover:text-red-900 flex items-center gap-2 focus:bg-red-50 focus:text-red-900 focus:outline-none", children: [_jsx("span", { className: "w-2 h-2 rounded-full bg-red-500", "aria-hidden": "true" }), "Failed"] })] }) })] }))] })] }), onCreateTransactions && (_jsx("div", { className: "flex flex-col gap-2", children: account.accountTransactionsId ? (
|
|
19
19
|
// Show link to transactions document if it exists
|
|
20
20
|
_jsx("button", { onClick: () => setSelectedNode(account.accountTransactionsId), className: "w-full bg-blue-50 hover:bg-blue-100 border border-blue-200 rounded-lg p-3 transition-colors text-left", "aria-label": `View transaction history for ${account.name}`, children: _jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("svg", { className: "w-5 h-5 text-blue-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) }), _jsxs("div", { children: [_jsx("span", { className: "text-sm font-medium text-blue-900", children: "View Transaction History" }), _jsx("p", { className: "text-xs text-blue-600 mt-0.5", children: "Transactions synced for reporting" })] })] }), _jsx("svg", { className: "w-5 h-5 text-blue-600 flex-shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) })] }) })) : (
|
|
21
21
|
// Show warning and create button if no transactions document exists
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountForm.d.ts","sourceRoot":"","sources":["../../../../editors/accounts-editor/components/AccountForm.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AccountForm.d.ts","sourceRoot":"","sources":["../../../../editors/accounts-editor/components/AccountForm.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,uDAAuD,CAAC;AAE/D,UAAU,gBAAgB;IACxB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,CAAC,MAAM,EAAE;QACjB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAC/B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QACjB,IAAI,CAAC,EAAE,gBAAgB,CAAC;QACxB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAClB,YAAY,CAAC,EAAE,qBAAqB,CAAC;KACtC,KAAK,IAAI,CAAC;IACX,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,gBAAgB,2CAoW5E"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { Button } from "@powerhousedao/document-engineering";
|
|
4
4
|
import { Tooltip, TooltipProvider } from "@powerhousedao/design-system/ui";
|
|
5
|
+
import { toast } from "@powerhousedao/design-system/connect";
|
|
5
6
|
import { Info } from "lucide-react";
|
|
7
|
+
import { isValidEthereumAddress } from "../../../scripts/alchemy/alchemyHelpers.js";
|
|
6
8
|
export function AccountForm({ account, onSubmit, onCancel }) {
|
|
7
9
|
const [formData, setFormData] = useState({
|
|
8
10
|
account: account?.account || "",
|
|
@@ -14,8 +16,29 @@ export function AccountForm({ account, onSubmit, onCancel }) {
|
|
|
14
16
|
owners: account?.owners?.join(", ") || "",
|
|
15
17
|
KycAmlStatus: account?.KycAmlStatus || "",
|
|
16
18
|
});
|
|
19
|
+
const [accountError, setAccountError] = useState("");
|
|
20
|
+
function validateAccount(address) {
|
|
21
|
+
if (!address || address.trim() === "") {
|
|
22
|
+
setAccountError("Account address is required");
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
if (!isValidEthereumAddress(address.trim())) {
|
|
26
|
+
setAccountError("Invalid Ethereum address format. Must be 0x followed by 40 hexadecimal characters.");
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
setAccountError("");
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
17
32
|
function handleSubmit(e) {
|
|
18
33
|
e.preventDefault();
|
|
34
|
+
// Validate Ethereum address
|
|
35
|
+
if (!validateAccount(formData.account)) {
|
|
36
|
+
const accountInput = e.currentTarget.querySelector('input[name="account"]');
|
|
37
|
+
if (accountInput) {
|
|
38
|
+
accountInput.focus();
|
|
39
|
+
}
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
19
42
|
const chain = formData.chain
|
|
20
43
|
.split(",")
|
|
21
44
|
.map((c) => c.trim())
|
|
@@ -32,7 +55,7 @@ export function AccountForm({ account, onSubmit, onCancel }) {
|
|
|
32
55
|
typeSelect.reportValidity();
|
|
33
56
|
}
|
|
34
57
|
else {
|
|
35
|
-
|
|
58
|
+
toast("Account Type is required", { type: "warning" });
|
|
36
59
|
}
|
|
37
60
|
return;
|
|
38
61
|
}
|
|
@@ -41,7 +64,7 @@ export function AccountForm({ account, onSubmit, onCancel }) {
|
|
|
41
64
|
}
|
|
42
65
|
onSubmit({
|
|
43
66
|
...(account?.id && { id: account.id }),
|
|
44
|
-
account: formData.account,
|
|
67
|
+
account: formData.account.trim(),
|
|
45
68
|
name: formData.name,
|
|
46
69
|
budgetPath: formData.budgetPath || undefined,
|
|
47
70
|
accountTransactionsId: formData.accountTransactionsId || undefined,
|
|
@@ -51,18 +74,34 @@ export function AccountForm({ account, onSubmit, onCancel }) {
|
|
|
51
74
|
KycAmlStatus: formData.KycAmlStatus || undefined,
|
|
52
75
|
});
|
|
53
76
|
}
|
|
54
|
-
return (_jsxs(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
77
|
+
return (_jsxs(_Fragment, { children: [_jsx("style", { children: `
|
|
78
|
+
input[name="account"]::placeholder {
|
|
79
|
+
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
80
|
+
}
|
|
81
|
+
` }), _jsxs("form", { onSubmit: handleSubmit, className: "bg-white rounded-xl border border-gray-200 shadow-sm p-6", children: [_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [_jsxs("div", { children: [_jsxs("label", { htmlFor: "account-address", className: "block text-sm font-medium text-gray-700 mb-2", children: ["Account ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { type: "text", id: "account-address", name: "account", value: formData.account, onChange: (e) => {
|
|
82
|
+
const value = e.target.value;
|
|
83
|
+
setFormData({ ...formData, account: value });
|
|
84
|
+
// Clear error when user starts typing
|
|
85
|
+
if (accountError) {
|
|
86
|
+
setAccountError("");
|
|
87
|
+
}
|
|
88
|
+
}, onBlur: (e) => {
|
|
89
|
+
// Validate on blur
|
|
90
|
+
validateAccount(e.target.value);
|
|
91
|
+
}, placeholder: "e.g., 0x1234...abcd", spellCheck: false, autoComplete: "off", className: `w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent ${accountError
|
|
92
|
+
? "border-red-300 focus:ring-red-500"
|
|
93
|
+
: "border-gray-300"}`, required: true }), accountError && (_jsx("p", { className: "mt-1 text-sm text-red-600", children: accountError })), !accountError && formData.account && (_jsx("p", { className: "mt-1 text-xs text-gray-500", children: "Ethereum address format: 0x followed by 40 hexadecimal characters" }))] }), _jsxs("div", { children: [_jsxs("label", { htmlFor: "account-name", className: "block text-sm font-medium text-gray-700 mb-2", children: ["Name ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { type: "text", id: "account-name", name: "name", value: formData.name, onChange: (e) => setFormData({ ...formData, name: e.target.value }), placeholder: "e.g., Main Treasury", className: "w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent", required: true })] })] }), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [_jsxs("div", { children: [_jsx(TooltipProvider, { delayDuration: 0, children: _jsxs("label", { htmlFor: "account-type", className: "flex items-center gap-1 text-sm font-medium text-gray-700 mb-2", children: ["Account Type ", _jsx("span", { className: "text-red-500", children: "*" }), _jsx(Tooltip, { content: _jsxs("div", { className: "text-xs", children: [_jsx("div", { className: "font-semibold mb-1", children: "Account Types:" }), _jsxs("div", { children: [_jsx("strong", { children: "Source:" }), " Origin of funds (e.g., revenue streams)"] }), _jsxs("div", { children: [_jsx("strong", { children: "Internal:" }), " Accounts within your organization"] }), _jsxs("div", { children: [_jsx("strong", { children: "Destination:" }), " Where funds are sent (e.g., payments)"] }), _jsxs("div", { children: [_jsx("strong", { children: "External:" }), " Third-party accounts outside your org"] })] }), side: "right", children: _jsx(Info, { className: "w-4 h-4 text-gray-400 cursor-help" }) })] }) }), _jsxs("select", { id: "account-type", name: "accountType", value: formData.type, onChange: (e) => {
|
|
94
|
+
setFormData({
|
|
95
|
+
...formData,
|
|
96
|
+
type: e.target.value,
|
|
97
|
+
});
|
|
98
|
+
// Clear custom validation message when user selects a value
|
|
99
|
+
e.target.setCustomValidity("");
|
|
100
|
+
}, className: "w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white", required: true, children: [_jsx("option", { value: "", children: "Select type..." }), _jsx("option", { value: "Source", children: "Source" }), _jsx("option", { value: "Internal", children: "Internal" }), _jsx("option", { value: "Destination", children: "Destination" }), _jsx("option", { value: "External", children: "External" })] })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "kyc-status", className: "block text-sm font-medium text-gray-700 mb-2", children: "KYC/AML Status" }), _jsxs("select", { id: "kyc-status", name: "kycStatus", value: formData.KycAmlStatus, onChange: (e) => setFormData({
|
|
101
|
+
...formData,
|
|
102
|
+
KycAmlStatus: e.target.value,
|
|
103
|
+
}), className: "w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white", children: [_jsx("option", { value: "", children: "Select status..." }), _jsx("option", { value: "PASSED", children: "Passed" }), _jsx("option", { value: "PENDING", children: "Pending" }), _jsx("option", { value: "FAILED", children: "Failed" })] })] })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "budget-path", className: "block text-sm font-medium text-gray-700 mb-2", children: "Budget Path" }), _jsx("input", { type: "text", id: "budget-path", name: "budgetPath", value: formData.budgetPath, onChange: (e) => setFormData({ ...formData, budgetPath: e.target.value }), placeholder: "e.g., /treasury/operations", className: "w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent" })] }), account && (_jsxs("div", { children: [_jsx("label", { htmlFor: "account-transactions-id", className: "block text-sm font-medium text-gray-700 mb-2", children: "Account Transactions ID" }), _jsx("input", { type: "text", id: "account-transactions-id", name: "accountTransactionsId", value: formData.accountTransactionsId, onChange: (e) => setFormData({
|
|
62
104
|
...formData,
|
|
63
|
-
|
|
64
|
-
}), className: "w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent
|
|
65
|
-
...formData,
|
|
66
|
-
accountTransactionsId: e.target.value,
|
|
67
|
-
}), placeholder: "e.g., tx-12345", className: "w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent" })] }), _jsxs("div", { children: [_jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: ["Chains", _jsx("span", { className: "ml-2 text-xs text-gray-500 font-normal", children: "(comma-separated)" })] }), _jsx("input", { type: "text", value: formData.chain, onChange: (e) => setFormData({ ...formData, chain: e.target.value }), placeholder: "e.g., Ethereum, Polygon, Arbitrum", className: "w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent" })] }), _jsxs("div", { children: [_jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: ["Owners", _jsx("span", { className: "ml-2 text-xs text-gray-500 font-normal", children: "(comma-separated)" })] }), _jsx("input", { type: "text", value: formData.owners, onChange: (e) => setFormData({ ...formData, owners: e.target.value }), placeholder: "e.g., Alice, Bob, Charlie", className: "w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent" })] })] }), _jsxs("div", { className: "mt-8 flex items-center justify-end gap-3 pt-6 border-t border-gray-200", children: [_jsx(Button, { type: "button", onClick: onCancel, className: "px-6 py-2.5 border border-gray-300 rounded-lg font-medium text-gray-700 hover:bg-gray-50 transition-colors", children: "Cancel" }), _jsx(Button, { type: "submit", className: "px-6 py-2.5 bg-blue-600 hover:bg-blue-700 text-white rounded-lg font-medium shadow-sm transition-colors", children: account ? "Update Account" : "Add Account" })] })] }));
|
|
105
|
+
accountTransactionsId: e.target.value,
|
|
106
|
+
}), placeholder: "e.g., tx-12345", className: "w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent" })] })), _jsxs("div", { children: [_jsxs("label", { htmlFor: "chains", className: "block text-sm font-medium text-gray-700 mb-2", children: ["Chains", _jsx("span", { className: "ml-2 text-xs text-gray-500 font-normal", children: "(comma-separated)" })] }), _jsx("input", { type: "text", id: "chains", name: "chain", value: formData.chain, onChange: (e) => setFormData({ ...formData, chain: e.target.value }), placeholder: "e.g., Ethereum, Polygon, Arbitrum", className: "w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent" })] }), _jsxs("div", { children: [_jsxs("label", { htmlFor: "owners", className: "block text-sm font-medium text-gray-700 mb-2", children: ["Owners", _jsx("span", { className: "ml-2 text-xs text-gray-500 font-normal", children: "(comma-separated)" })] }), _jsx("input", { type: "text", id: "owners", name: "owners", value: formData.owners, onChange: (e) => setFormData({ ...formData, owners: e.target.value }), placeholder: "e.g., Alice, Bob, Charlie", className: "w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent" })] })] }), _jsxs("div", { className: "mt-8 flex items-center justify-end gap-3 pt-6 border-t border-gray-200", children: [_jsx(Button, { type: "button", onClick: onCancel, className: "px-6 py-2.5 border border-gray-300 rounded-lg font-medium text-gray-700 hover:bg-gray-50 transition-colors", children: "Cancel" }), _jsx(Button, { type: "submit", className: "px-6 py-2.5 bg-blue-600 hover:bg-blue-700 text-white rounded-lg font-medium shadow-sm transition-colors", children: account ? "Update Account" : "Add Account" })] })] })] }));
|
|
68
107
|
}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { AccountCard } from "./AccountCard.js";
|
|
3
3
|
export function AccountsList({ accounts, onEdit, onDelete, onUpdateKycStatus, onCreateTransactions, creatingTransactionsFor, }) {
|
|
4
4
|
if (accounts.length === 0) {
|
|
5
|
-
return (_jsxs("div", { className: "bg-white rounded-xl border border-gray-200 p-12 text-center", children: [_jsx("svg", { className: "mx-auto h-12 w-12 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4" }) }), _jsx("h3", { className: "mt-4 text-lg font-medium text-gray-900", children: "No accounts
|
|
5
|
+
return (_jsxs("div", { className: "bg-white rounded-xl border border-gray-200 p-12 text-center", children: [_jsx("svg", { className: "mx-auto h-12 w-12 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4" }) }), _jsx("h3", { className: "mt-4 text-lg font-medium text-gray-900", children: "No accounts yet" }), _jsx("p", { className: "mt-2 text-sm text-gray-600", children: "Get started by adding your first account" })] }));
|
|
6
6
|
}
|
|
7
7
|
const accountsWithoutTransactions = accounts.filter((account) => !account.accountTransactionsId);
|
|
8
8
|
return (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "text-sm text-gray-600", children: [accounts.length, " account", accounts.length !== 1 ? "s" : ""] }), accountsWithoutTransactions.length > 0 && (_jsxs("div", { className: "flex items-center gap-1.5 text-sm text-amber-700 bg-amber-50 px-3 py-1.5 rounded-full border border-amber-200", children: [_jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }), _jsxs("span", { children: [accountsWithoutTransactions.length, " account", accountsWithoutTransactions.length !== 1 ? "s" : "", " need", accountsWithoutTransactions.length === 1 ? "s" : "", " transaction history"] })] }))] }), _jsx("div", { className: "space-y-4", children: accounts.map((account) => (_jsx(AccountCard, { account: account, onEdit: onEdit, onDelete: onDelete, onUpdateKycStatus: onUpdateKycStatus, onCreateTransactions: onCreateTransactions, isCreatingTransactions: creatingTransactionsFor === account.id }, account.id))) })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/accounts-editor/editor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/accounts-editor/editor.tsx"],"names":[],"mappings":"AA0IA,MAAM,CAAC,OAAO,UAAU,MAAM,4CA0kB7B"}
|