@powerhousedao/contributor-billing 0.0.1
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/LICENSE +661 -0
- package/README.md +22 -0
- package/dist/document-models/index.d.ts +2 -0
- package/dist/document-models/index.d.ts.map +1 -0
- package/dist/document-models/index.js +1 -0
- package/dist/document-models/invoice/gen/actions.d.ts +8 -0
- package/dist/document-models/invoice/gen/actions.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/actions.js +3 -0
- package/dist/document-models/invoice/gen/creators.d.ts +4 -0
- package/dist/document-models/invoice/gen/creators.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/creators.js +3 -0
- package/dist/document-models/invoice/gen/document-model.d.ts +3 -0
- package/dist/document-models/invoice/gen/document-model.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/document-model.js +227 -0
- package/dist/document-models/invoice/gen/general/actions.d.ts +10 -0
- package/dist/document-models/invoice/gen/general/actions.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/general/actions.js +1 -0
- package/dist/document-models/invoice/gen/general/creators.d.ts +9 -0
- package/dist/document-models/invoice/gen/general/creators.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/general/creators.js +8 -0
- package/dist/document-models/invoice/gen/general/error.d.ts +2 -0
- package/dist/document-models/invoice/gen/general/error.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/general/error.js +1 -0
- package/dist/document-models/invoice/gen/general/object.d.ts +12 -0
- package/dist/document-models/invoice/gen/general/object.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/general/object.js +22 -0
- package/dist/document-models/invoice/gen/general/operations.d.ts +12 -0
- package/dist/document-models/invoice/gen/general/operations.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/general/operations.js +1 -0
- package/dist/document-models/invoice/gen/index.d.ts +6 -0
- package/dist/document-models/invoice/gen/index.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/index.js +5 -0
- package/dist/document-models/invoice/gen/items/actions.d.ts +8 -0
- package/dist/document-models/invoice/gen/items/actions.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/items/actions.js +1 -0
- package/dist/document-models/invoice/gen/items/creators.d.ts +7 -0
- package/dist/document-models/invoice/gen/items/creators.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/items/creators.js +6 -0
- package/dist/document-models/invoice/gen/items/error.d.ts +2 -0
- package/dist/document-models/invoice/gen/items/error.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/items/error.js +1 -0
- package/dist/document-models/invoice/gen/items/object.d.ts +10 -0
- package/dist/document-models/invoice/gen/items/object.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/items/object.js +16 -0
- package/dist/document-models/invoice/gen/items/operations.d.ts +10 -0
- package/dist/document-models/invoice/gen/items/operations.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/items/operations.js +1 -0
- package/dist/document-models/invoice/gen/object.d.ts +20 -0
- package/dist/document-models/invoice/gen/object.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/object.js +29 -0
- package/dist/document-models/invoice/gen/parties/actions.d.ts +10 -0
- package/dist/document-models/invoice/gen/parties/actions.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/parties/actions.js +1 -0
- package/dist/document-models/invoice/gen/parties/creators.d.ts +9 -0
- package/dist/document-models/invoice/gen/parties/creators.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/parties/creators.js +8 -0
- package/dist/document-models/invoice/gen/parties/error.d.ts +2 -0
- package/dist/document-models/invoice/gen/parties/error.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/parties/error.js +1 -0
- package/dist/document-models/invoice/gen/parties/object.d.ts +12 -0
- package/dist/document-models/invoice/gen/parties/object.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/parties/object.js +22 -0
- package/dist/document-models/invoice/gen/parties/operations.d.ts +12 -0
- package/dist/document-models/invoice/gen/parties/operations.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/parties/operations.js +1 -0
- package/dist/document-models/invoice/gen/reducer.d.ts +3 -0
- package/dist/document-models/invoice/gen/reducer.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/reducer.js +79 -0
- package/dist/document-models/invoice/gen/schema/index.d.ts +3 -0
- package/dist/document-models/invoice/gen/schema/index.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/schema/index.js +2 -0
- package/dist/document-models/invoice/gen/schema/types.d.ts +390 -0
- package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/schema/types.js +1 -0
- package/dist/document-models/invoice/gen/schema/zod.d.ts +56 -0
- package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/schema/zod.js +362 -0
- package/dist/document-models/invoice/gen/types.d.ts +10 -0
- package/dist/document-models/invoice/gen/types.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/types.js +1 -0
- package/dist/document-models/invoice/gen/utils.d.ts +7 -0
- package/dist/document-models/invoice/gen/utils.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/utils.js +166 -0
- package/dist/document-models/invoice/index.d.ts +41 -0
- package/dist/document-models/invoice/index.d.ts.map +1 -0
- package/dist/document-models/invoice/index.js +21 -0
- package/dist/document-models/invoice/src/reducers/general.d.ts +8 -0
- package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -0
- package/dist/document-models/invoice/src/reducers/general.js +79 -0
- package/dist/document-models/invoice/src/reducers/items.d.ts +8 -0
- package/dist/document-models/invoice/src/reducers/items.d.ts.map +1 -0
- package/dist/document-models/invoice/src/reducers/items.js +108 -0
- package/dist/document-models/invoice/src/reducers/parties.d.ts +8 -0
- package/dist/document-models/invoice/src/reducers/parties.d.ts.map +1 -0
- package/dist/document-models/invoice/src/reducers/parties.js +266 -0
- package/dist/document-models/invoice/src/tests/document-model.test.d.ts +6 -0
- package/dist/document-models/invoice/src/tests/document-model.test.d.ts.map +1 -0
- package/dist/document-models/invoice/src/tests/document-model.test.js +17 -0
- package/dist/document-models/invoice/src/tests/general.test.d.ts +6 -0
- package/dist/document-models/invoice/src/tests/general.test.d.ts.map +1 -0
- package/dist/document-models/invoice/src/tests/general.test.js +75 -0
- package/dist/document-models/invoice/src/tests/items.test.d.ts +6 -0
- package/dist/document-models/invoice/src/tests/items.test.d.ts.map +1 -0
- package/dist/document-models/invoice/src/tests/items.test.js +45 -0
- package/dist/document-models/invoice/src/tests/parties.test.d.ts +6 -0
- package/dist/document-models/invoice/src/tests/parties.test.d.ts.map +1 -0
- package/dist/document-models/invoice/src/tests/parties.test.js +75 -0
- package/dist/document-models/invoice/src/utils.d.ts +2 -0
- package/dist/document-models/invoice/src/utils.d.ts.map +1 -0
- package/dist/document-models/invoice/src/utils.js +1 -0
- package/dist/editors/contributor-billing/components/CreateDocument.d.ts +8 -0
- package/dist/editors/contributor-billing/components/CreateDocument.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/CreateDocument.js +14 -0
- package/dist/editors/contributor-billing/components/DocumentDispatch.d.ts +12 -0
- package/dist/editors/contributor-billing/components/DocumentDispatch.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/DocumentDispatch.js +20 -0
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts +17 -0
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/DriveExplorer.js +112 -0
- package/dist/editors/contributor-billing/components/EditorContainer.d.ts +14 -0
- package/dist/editors/contributor-billing/components/EditorContainer.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/EditorContainer.js +28 -0
- package/dist/editors/contributor-billing/components/FileItemsGrid.d.ts +12 -0
- package/dist/editors/contributor-billing/components/FileItemsGrid.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/FileItemsGrid.js +7 -0
- package/dist/editors/contributor-billing/components/FolderItemsGrid.d.ts +17 -0
- package/dist/editors/contributor-billing/components/FolderItemsGrid.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/FolderItemsGrid.js +14 -0
- package/dist/editors/contributor-billing/components/FolderTree.d.ts +9 -0
- package/dist/editors/contributor-billing/components/FolderTree.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/FolderTree.js +31 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +16 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.js +16 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +21 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +45 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts +12 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.js +12 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts +7 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.js +7 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.d.ts +8 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.js +2 -0
- package/dist/editors/contributor-billing/editor.d.ts +6 -0
- package/dist/editors/contributor-billing/editor.d.ts.map +1 -0
- package/dist/editors/contributor-billing/editor.js +48 -0
- package/dist/editors/contributor-billing/hooks/useDispatchMap.d.ts +9 -0
- package/dist/editors/contributor-billing/hooks/useDispatchMap.d.ts.map +1 -0
- package/dist/editors/contributor-billing/hooks/useDispatchMap.js +21 -0
- package/dist/editors/contributor-billing/hooks/useDrop.d.ts +22 -0
- package/dist/editors/contributor-billing/hooks/useDrop.d.ts.map +1 -0
- package/dist/editors/contributor-billing/hooks/useDrop.js +57 -0
- package/dist/editors/contributor-billing/hooks/useSelectedFolderChildren.d.ts +8 -0
- package/dist/editors/contributor-billing/hooks/useSelectedFolderChildren.d.ts.map +1 -0
- package/dist/editors/contributor-billing/hooks/useSelectedFolderChildren.js +19 -0
- package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts +4 -0
- package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts.map +1 -0
- package/dist/editors/contributor-billing/hooks/useTransformedNodes.js +32 -0
- package/dist/editors/contributor-billing/index.d.ts +5 -0
- package/dist/editors/contributor-billing/index.d.ts.map +1 -0
- package/dist/editors/contributor-billing/index.js +12 -0
- package/dist/editors/index.d.ts +3 -0
- package/dist/editors/index.d.ts.map +1 -0
- package/dist/editors/index.js +2 -0
- package/dist/editors/invoice/InvoicePDF.d.ts +8 -0
- package/dist/editors/invoice/InvoicePDF.d.ts.map +1 -0
- package/dist/editors/invoice/InvoicePDF.js +359 -0
- package/dist/editors/invoice/assets/custom.d.ts +4 -0
- package/dist/editors/invoice/assets/powerhouseLogo.png +0 -0
- package/dist/editors/invoice/components/countryForm.d.ts +12 -0
- package/dist/editors/invoice/components/countryForm.d.ts.map +1 -0
- package/dist/editors/invoice/components/countryForm.js +28 -0
- package/dist/editors/invoice/components/currencyForm.d.ts +13 -0
- package/dist/editors/invoice/components/currencyForm.d.ts.map +1 -0
- package/dist/editors/invoice/components/currencyForm.js +26 -0
- package/dist/editors/invoice/components/datePicker.d.ts +11 -0
- package/dist/editors/invoice/components/datePicker.d.ts.map +1 -0
- package/dist/editors/invoice/components/datePicker.js +8 -0
- package/dist/editors/invoice/components/inputField.d.ts +14 -0
- package/dist/editors/invoice/components/inputField.d.ts.map +1 -0
- package/dist/editors/invoice/components/inputField.js +25 -0
- package/dist/editors/invoice/components/numberForm.d.ts +11 -0
- package/dist/editors/invoice/components/numberForm.d.ts.map +1 -0
- package/dist/editors/invoice/components/numberForm.js +7 -0
- package/dist/editors/invoice/components/selectField.d.ts +8 -0
- package/dist/editors/invoice/components/selectField.d.ts.map +1 -0
- package/dist/editors/invoice/components/selectField.js +323 -0
- package/dist/editors/invoice/editor.d.ts +5 -0
- package/dist/editors/invoice/editor.d.ts.map +1 -0
- package/dist/editors/invoice/editor.js +377 -0
- package/dist/editors/invoice/exportUBL.d.ts +85 -0
- package/dist/editors/invoice/exportUBL.d.ts.map +1 -0
- package/dist/editors/invoice/exportUBL.js +382 -0
- package/dist/editors/invoice/index.d.ts +5 -0
- package/dist/editors/invoice/index.d.ts.map +1 -0
- package/dist/editors/invoice/index.js +12 -0
- package/dist/editors/invoice/ingestPDF.d.ts +12 -0
- package/dist/editors/invoice/ingestPDF.d.ts.map +1 -0
- package/dist/editors/invoice/ingestPDF.js +193 -0
- package/dist/editors/invoice/ingestUBL.d.ts +21 -0
- package/dist/editors/invoice/ingestUBL.d.ts.map +1 -0
- package/dist/editors/invoice/ingestUBL.js +169 -0
- package/dist/editors/invoice/invoiceToGnosis.d.ts +7 -0
- package/dist/editors/invoice/invoiceToGnosis.d.ts.map +1 -0
- package/dist/editors/invoice/invoiceToGnosis.js +139 -0
- package/dist/editors/invoice/legalEntity/bankSection.d.ts +14 -0
- package/dist/editors/invoice/legalEntity/bankSection.d.ts.map +1 -0
- package/dist/editors/invoice/legalEntity/bankSection.js +156 -0
- package/dist/editors/invoice/legalEntity/common.d.ts +6 -0
- package/dist/editors/invoice/legalEntity/common.d.ts.map +1 -0
- package/dist/editors/invoice/legalEntity/common.js +6 -0
- package/dist/editors/invoice/legalEntity/legalEntity.d.ts +40 -0
- package/dist/editors/invoice/legalEntity/legalEntity.d.ts.map +1 -0
- package/dist/editors/invoice/legalEntity/legalEntity.js +63 -0
- package/dist/editors/invoice/legalEntity/walletSection.d.ts +13 -0
- package/dist/editors/invoice/legalEntity/walletSection.d.ts.map +1 -0
- package/dist/editors/invoice/legalEntity/walletSection.js +55 -0
- package/dist/editors/invoice/lineItems.d.ts +23 -0
- package/dist/editors/invoice/lineItems.d.ts.map +1 -0
- package/dist/editors/invoice/lineItems.js +157 -0
- package/dist/editors/invoice/requestFinance.d.ts +7 -0
- package/dist/editors/invoice/requestFinance.d.ts.map +1 -0
- package/dist/editors/invoice/requestFinance.js +155 -0
- package/dist/editors/invoice/uploadPdfChunked.d.ts +10 -0
- package/dist/editors/invoice/uploadPdfChunked.d.ts.map +1 -0
- package/dist/editors/invoice/uploadPdfChunked.js +79 -0
- package/dist/editors/invoice/utils/utils.d.ts +2 -0
- package/dist/editors/invoice/utils/utils.d.ts.map +1 -0
- package/dist/editors/invoice/utils/utils.js +54 -0
- package/dist/editors/invoice/validation/validationManager.d.ts +28 -0
- package/dist/editors/invoice/validation/validationManager.d.ts.map +1 -0
- package/dist/editors/invoice/validation/validationManager.js +65 -0
- package/dist/editors/invoice/validation/validationRules.d.ts +14 -0
- package/dist/editors/invoice/validation/validationRules.d.ts.map +1 -0
- package/dist/editors/invoice/validation/validationRules.js +334 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/powerhouse.manifest.json +31 -0
- package/dist/processors/index.d.ts +2 -0
- package/dist/processors/index.d.ts.map +1 -0
- package/dist/processors/index.js +1 -0
- package/dist/scripts/invoice/exampleBatchTxn.d.ts +2 -0
- package/dist/scripts/invoice/exampleBatchTxn.d.ts.map +1 -0
- package/dist/scripts/invoice/exampleBatchTxn.js +44 -0
- package/dist/scripts/invoice/gnosisTransactionBuilder.d.ts +28 -0
- package/dist/scripts/invoice/gnosisTransactionBuilder.d.ts.map +1 -0
- package/dist/scripts/invoice/gnosisTransactionBuilder.js +74 -0
- package/dist/scripts/invoice/pdfToDocumentAi.d.ts +5 -0
- package/dist/scripts/invoice/pdfToDocumentAi.d.ts.map +1 -0
- package/dist/scripts/invoice/pdfToDocumentAi.js +659 -0
- package/dist/scripts/invoice/requestFinance.d.ts +2 -0
- package/dist/scripts/invoice/requestFinance.d.ts.map +1 -0
- package/dist/scripts/invoice/requestFinance.js +38 -0
- package/dist/style.css +6463 -0
- package/dist/subgraphs/index.d.ts +2 -0
- package/dist/subgraphs/index.d.ts.map +1 -0
- package/dist/subgraphs/index.js +1 -0
- package/dist/subgraphs/invoice/customResolvers.d.ts +50 -0
- package/dist/subgraphs/invoice/customResolvers.d.ts.map +1 -0
- package/dist/subgraphs/invoice/customResolvers.js +327 -0
- package/dist/subgraphs/invoice/index.d.ts +10 -0
- package/dist/subgraphs/invoice/index.d.ts.map +1 -0
- package/dist/subgraphs/invoice/index.js +30 -0
- package/dist/subgraphs/invoice/resolvers.d.ts +3 -0
- package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -0
- package/dist/subgraphs/invoice/resolvers.js +184 -0
- package/dist/subgraphs/invoice/schema.d.ts +3 -0
- package/dist/subgraphs/invoice/schema.d.ts.map +1 -0
- package/dist/subgraphs/invoice/schema.js +460 -0
- package/dist/tailwind.config.d.ts +13 -0
- package/dist/tailwind.config.d.ts.map +1 -0
- package/dist/tailwind.config.js +15 -0
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.d.ts.map +1 -0
- package/dist/vitest.config.js +8 -0
- package/editors/invoice/assets/custom.d.ts +4 -0
- package/editors/invoice/assets/powerhouseLogo.png +0 -0
- package/package.json +117 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { HeaderControls } from "./HeaderControls.js";
|
|
4
|
+
import { InvoiceTableSection } from "./InvoiceTableSection.js";
|
|
5
|
+
import { InvoiceTableRow } from "./InvoiceTableRow.js";
|
|
6
|
+
const statusOptions = [
|
|
7
|
+
{ label: "Awaiting Approval", value: "AWAITINGAPPROVAL" },
|
|
8
|
+
{ label: "Awaiting Payment", value: "AWAITINGPAYMENT" },
|
|
9
|
+
{ label: "Payment Received", value: "PAYMENTRECEIVED" },
|
|
10
|
+
{ label: "Rejected", value: "REJECTED" },
|
|
11
|
+
];
|
|
12
|
+
export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, selected, setSelected, onBatchAction, }) => {
|
|
13
|
+
const [selectedStatuses, setSelectedStatuses] = useState([]);
|
|
14
|
+
const getMenuOptions = () => {
|
|
15
|
+
return [
|
|
16
|
+
{ label: "View Invoice", value: "view-invoice" },
|
|
17
|
+
// { label: "View Payment Transaction", value: "view-payment" },
|
|
18
|
+
];
|
|
19
|
+
};
|
|
20
|
+
const handleStatusChange = (value) => {
|
|
21
|
+
setSelectedStatuses(Array.isArray(value) ? value : [value]);
|
|
22
|
+
};
|
|
23
|
+
const shouldShowSection = (status) => {
|
|
24
|
+
return selectedStatuses.length === 0 || selectedStatuses.includes(status);
|
|
25
|
+
};
|
|
26
|
+
const getInvoicesByStatus = (status) => {
|
|
27
|
+
return Object.entries(state)
|
|
28
|
+
.filter(([_, doc]) => doc.documentType === "powerhouse/invoice" &&
|
|
29
|
+
doc.global.status === status)
|
|
30
|
+
.map(([id, doc]) => ({
|
|
31
|
+
id,
|
|
32
|
+
issuer: doc.global.issuer?.name || "Unknown",
|
|
33
|
+
invoiceNo: doc.global.invoiceNo,
|
|
34
|
+
issueDate: doc.global.dateIssued,
|
|
35
|
+
dueDate: doc.global.dateDue,
|
|
36
|
+
currency: doc.global.currency,
|
|
37
|
+
amount: doc.global.totalPriceTaxIncl?.toString() ?? "",
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
const awaitingApproval = getInvoicesByStatus("ISSUED");
|
|
41
|
+
const awaitingPayment = getInvoicesByStatus("AWAITINGPAYMENT");
|
|
42
|
+
const paid = getInvoicesByStatus("PAYMENTRECEIVED");
|
|
43
|
+
const rejected = getInvoicesByStatus("REJECTED");
|
|
44
|
+
return (_jsxs("div", { className: "w-full h-full bg-white rounded-lg p-4 border border-gray-200 shadow-md overflow-y-auto max-h-[500px] mt-4", children: [_jsx(HeaderControls, { statusOptions: statusOptions, onStatusChange: handleStatusChange, onBatchAction: onBatchAction }), shouldShowSection("AWAITINGAPPROVAL") && (_jsx(InvoiceTableSection, { title: "Awaiting Approval", count: awaitingApproval.length, children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-left", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Amount" }), _jsx("th", { className: "px-2 py-2 w-8" })] }) }), _jsx("tbody", { children: awaitingApproval.map((row) => (_jsx(InvoiceTableRow, { row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({ ...prev, [row.id]: checked })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId }, row.id))) })] }) })), shouldShowSection("AWAITINGPAYMENT") && (_jsx(InvoiceTableSection, { title: "Awaiting Payment", count: awaitingPayment.length, color: "bg-yellow-100 text-yellow-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-left", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Amount" }), _jsx("th", { className: "px-2 py-2 w-8" })] }) }), _jsx("tbody", { children: awaitingPayment.map((row) => (_jsx(InvoiceTableRow, { row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({ ...prev, [row.id]: checked })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId }, row.id))) })] }) })), shouldShowSection("PAYMENTRECEIVED") && (_jsx(InvoiceTableSection, { title: "Payment Received", count: paid.length, color: "bg-green-100 text-green-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-left", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Amount" }), _jsx("th", { className: "px-2 py-2 w-8" })] }) }), _jsx("tbody", { children: paid.map((row) => (_jsx(InvoiceTableRow, { row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({ ...prev, [row.id]: checked })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId }, row.id))) })] }) })), shouldShowSection("REJECTED") && (_jsx(InvoiceTableSection, { title: "Rejected", count: rejected.length, color: "bg-red-500 text-black-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-left", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-left", children: "Amount" }), _jsx("th", { className: "px-2 py-2 w-8" })] }) }), _jsx("tbody", { children: rejected.map((row) => (_jsx(InvoiceTableRow, { row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({ ...prev, [row.id]: checked })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId }, row.id))) })] }) }))] }));
|
|
45
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const InvoiceTableRow: ({ row, isSelected, onSelect, menuOptions, onMenuAction, setActiveDocumentId }: {
|
|
2
|
+
row: any;
|
|
3
|
+
isSelected: boolean;
|
|
4
|
+
onSelect: (checked: boolean) => void;
|
|
5
|
+
menuOptions: {
|
|
6
|
+
label: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}[];
|
|
9
|
+
onMenuAction: (action: string) => void;
|
|
10
|
+
setActiveDocumentId: (id: string) => void;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=InvoiceTableRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvoiceTableRow.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,GAAI,+EAO7B;IACD,GAAG,EAAE,GAAG,CAAC;IACT,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAChD,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,4CAiDA,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useRef } from "react";
|
|
3
|
+
import { RowActionMenu } from "./RowActionMenu.js";
|
|
4
|
+
export const InvoiceTableRow = ({ row, isSelected, onSelect, menuOptions, onMenuAction, setActiveDocumentId }) => {
|
|
5
|
+
const [menuOpen, setMenuOpen] = useState(false);
|
|
6
|
+
const menuRef = useRef(null);
|
|
7
|
+
return (_jsxs("tr", { className: "hover:bg-gray-50", children: [_jsx("td", { className: "px-2 py-2", children: _jsx("input", { type: "checkbox", checked: isSelected, onChange: e => onSelect(e.target.checked), className: "size-4 rounded border-gray-300 text-blue-600 focus:ring-2 focus:ring-blue-500" }) }), _jsx("td", { className: "px-2 py-2", children: row.issuer }), _jsx("td", { className: "px-2 py-2", children: row.invoiceNo }), _jsx("td", { className: "px-2 py-2", children: row.issueDate }), _jsx("td", { className: "px-2 py-2", children: row.dueDate }), _jsx("td", { className: "px-2 py-2", children: row.currency }), _jsx("td", { className: "px-2 py-2", children: row.amount }), _jsx("td", { className: "px-2 py-2 text-right relative", ref: menuRef, children: _jsxs("div", { className: "relative inline-block", children: [_jsx("button", { className: "px-2 py-1 hover:bg-gray-200 rounded", onClick: () => setMenuOpen(v => !v), children: "\u2026" }), menuOpen && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40", onClick: () => setMenuOpen(false) }), _jsx(RowActionMenu, { options: menuOptions, onAction: action => {
|
|
8
|
+
onMenuAction(action);
|
|
9
|
+
setMenuOpen(false);
|
|
10
|
+
setActiveDocumentId(row.id);
|
|
11
|
+
} })] }))] }) })] }));
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvoiceTableSection.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,GAAI,oCAKjC;IACD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,4CA8BA,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { ChevronDown, ChevronRight } from "lucide-react";
|
|
4
|
+
export const InvoiceTableSection = ({ title, count, children, color = "bg-blue-100 text-blue-600", }) => {
|
|
5
|
+
const [isExpanded, setIsExpanded] = useState(true);
|
|
6
|
+
return (_jsxs("div", { className: "mb-2", children: [_jsxs("button", { onClick: () => setIsExpanded(!isExpanded), className: "w-full flex items-center gap-2 hover:opacity-80 transition-opacity", children: [_jsx("span", { className: "font-medium", children: title }), _jsx("span", { className: `inline-flex items-center justify-center rounded-full text-xs font-bold px-2 ${color}`, children: count }), isExpanded ? (_jsx(ChevronDown, { className: "w-4 h-4 text-gray-900" })) : (_jsx(ChevronRight, { className: "w-4 h-4 text-gray-900" }))] }), isExpanded && (_jsx("div", { className: "mt-2", children: children }))] }));
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RowActionMenu.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/RowActionMenu.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,GAAI,uBAG3B;IACD,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,4CAiBA,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export const RowActionMenu = ({ options, onAction }) => (_jsx("div", { className: "absolute right-0 mt-2 w-[200px] rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 z-50", onClick: e => e.stopPropagation(), children: _jsx("div", { className: "py-1", children: options.map(opt => (_jsx("button", { className: "block w-full text-left px-4 py-2 text-sm hover:bg-gray-100", onClick: () => onAction(opt.value), children: opt.label }, opt.value))) }) }));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type DriveEditorProps } from "@powerhousedao/reactor-browser";
|
|
2
|
+
import { type DocumentDriveDocument } from "document-drive";
|
|
3
|
+
export type IProps = DriveEditorProps<DocumentDriveDocument>;
|
|
4
|
+
export declare function BaseEditor(props: IProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default function Editor(props: IProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/contributor-billing/editor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,OAAO,EACL,KAAK,qBAAqB,EAM3B,MAAM,gBAAgB,CAAC;AAMxB,MAAM,MAAM,MAAM,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;AAE7D,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,2CAgFvC;AAED,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,MAAM,2CAQ3C"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DriveContextProvider } from "@powerhousedao/reactor-browser/hooks/useDriveContext";
|
|
3
|
+
import { addFolder, deleteNode, updateNode, generateNodesCopy, copyNode, } from "document-drive";
|
|
4
|
+
import { WagmiContext } from "@powerhousedao/design-system";
|
|
5
|
+
import { DriveExplorer } from "./components/DriveExplorer.js";
|
|
6
|
+
import { useCallback, useState, useEffect } from "react";
|
|
7
|
+
import { generateId } from "document-model";
|
|
8
|
+
export function BaseEditor(props) {
|
|
9
|
+
const { dispatch, context } = props;
|
|
10
|
+
// Use state for nodes
|
|
11
|
+
const [nodes, setNodes] = useState(props.document.state.global.nodes);
|
|
12
|
+
// Keep nodes in sync with props (in case of external updates)
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
setNodes(props.document.state.global.nodes);
|
|
15
|
+
}, [props.document.state.global.nodes]);
|
|
16
|
+
const onAddFolder = useCallback((name, parentFolder) => {
|
|
17
|
+
dispatch(addFolder({
|
|
18
|
+
id: generateId(),
|
|
19
|
+
name,
|
|
20
|
+
parentFolder,
|
|
21
|
+
}));
|
|
22
|
+
}, [dispatch]);
|
|
23
|
+
const onDeleteNode = useCallback((nodeId) => {
|
|
24
|
+
dispatch(deleteNode({ id: nodeId }));
|
|
25
|
+
setNodes([...props.document.state.global.nodes]);
|
|
26
|
+
}, [dispatch, props.document.state.global.nodes]);
|
|
27
|
+
const renameNode = useCallback((nodeId, name) => {
|
|
28
|
+
dispatch(updateNode({ id: nodeId, name }));
|
|
29
|
+
}, [dispatch]);
|
|
30
|
+
const onCopyNode = useCallback((nodeId, targetName, parentId) => {
|
|
31
|
+
const generateIdWrapper = (prevId) => generateId();
|
|
32
|
+
const copyNodesInput = generateNodesCopy({
|
|
33
|
+
srcId: nodeId,
|
|
34
|
+
targetParentFolder: parentId,
|
|
35
|
+
targetName,
|
|
36
|
+
}, generateIdWrapper, props.document.state.global.nodes);
|
|
37
|
+
const copyNodesAction = copyNodesInput.map((input) => {
|
|
38
|
+
return copyNode(input);
|
|
39
|
+
});
|
|
40
|
+
for (const copyNodeAction of copyNodesAction) {
|
|
41
|
+
dispatch(copyNodeAction);
|
|
42
|
+
}
|
|
43
|
+
}, [dispatch, props.document.state.global.nodes]);
|
|
44
|
+
return (_jsx("div", { className: "new-drive-explorer", style: { height: "100%" }, children: _jsx(DriveExplorer, { driveId: props.document.state.global.id, nodes: nodes, onAddFolder: onAddFolder, onDeleteNode: onDeleteNode, renameNode: renameNode, onCopyNode: onCopyNode, context: context, document: props.document, dispatch: dispatch }, nodes.length) }));
|
|
45
|
+
}
|
|
46
|
+
export default function Editor(props) {
|
|
47
|
+
return (_jsx(DriveContextProvider, { value: props.context, children: _jsx(WagmiContext, { children: _jsx(BaseEditor, { ...props }) }) }));
|
|
48
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type DriveEditorContext } from "@powerhousedao/reactor-browser";
|
|
2
|
+
import { type Node } from "document-drive";
|
|
3
|
+
export declare const useDispatchMap: (nodes: Node[], driveId: string, documentModelModule: any, context: DriveEditorContext) => {
|
|
4
|
+
dispatchMap: {
|
|
5
|
+
[id: string]: (action: any) => void;
|
|
6
|
+
};
|
|
7
|
+
handleDispatchReady: (nodeId: string, dispatch: (action: any) => void) => void;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=useDispatchMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDispatchMap.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/hooks/useDispatchMap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,eAAO,MAAM,cAAc,GACzB,OAAO,IAAI,EAAE,EACb,SAAS,MAAM,EACf,qBAAqB,GAAG,EACxB,SAAS,kBAAkB;;+BAE6C,GAAG,KAAK,IAAI;;kCAGnC,MAAM,YAAY,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI;CAiBzF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useState, useCallback } from 'react';
|
|
2
|
+
export const useDispatchMap = (nodes, driveId, documentModelModule, context) => {
|
|
3
|
+
const [dispatchMap, setDispatchMap] = useState({});
|
|
4
|
+
// Update dispatch map when a new dispatch is ready
|
|
5
|
+
const handleDispatchReady = useCallback((nodeId, dispatch) => {
|
|
6
|
+
setDispatchMap(prev => {
|
|
7
|
+
// Only update if the dispatch is different
|
|
8
|
+
if (prev[nodeId] === dispatch) {
|
|
9
|
+
return prev;
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
...prev,
|
|
13
|
+
[nodeId]: dispatch
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
}, []);
|
|
17
|
+
return {
|
|
18
|
+
dispatchMap,
|
|
19
|
+
handleDispatchReady
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { UiNode } from "@powerhousedao/design-system";
|
|
2
|
+
import { type DragEvent } from "react";
|
|
3
|
+
type Props = {
|
|
4
|
+
uiNode: UiNode | null;
|
|
5
|
+
onAddFile: (file: File, parentNode: UiNode | null) => Promise<void>;
|
|
6
|
+
onMoveNode: (uiNode: UiNode, targetNode: UiNode) => Promise<void>;
|
|
7
|
+
onCopyNode: (uiNode: UiNode, targetNode: UiNode) => Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
export declare function useDrop(props: Props): {
|
|
10
|
+
isDropTarget: boolean;
|
|
11
|
+
dropProps: {
|
|
12
|
+
onDragOver: (event: DragEvent<HTMLDivElement>) => void;
|
|
13
|
+
onDragLeave: () => void;
|
|
14
|
+
onDrop: (event: DragEvent<HTMLDivElement>) => Promise<void>;
|
|
15
|
+
} | {
|
|
16
|
+
onDragOver: undefined;
|
|
17
|
+
onDragLeave: undefined;
|
|
18
|
+
onDrop: undefined;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=useDrop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDrop.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/hooks/useDrop.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,KAAK,SAAS,EAAkC,MAAM,OAAO,CAAC;AAEvE,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACnE,CAAC;AACF,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK;;;4BAKK,SAAS,CAAC,cAAc,CAAC;;wBAUhD,SAAS,CAAC,cAAc,CAAC;;;;;;EA2C1C"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { FILE, UI_NODE } from "@powerhousedao/design-system";
|
|
2
|
+
import { useCallback, useMemo, useState } from "react";
|
|
3
|
+
export function useDrop(props) {
|
|
4
|
+
const { uiNode, onAddFile, onCopyNode, onMoveNode } = props;
|
|
5
|
+
const [isDropTarget, setIsDropTarget] = useState(false);
|
|
6
|
+
const allowedToBeDropTarget = !uiNode || uiNode.kind !== FILE;
|
|
7
|
+
const onDragOver = useCallback((event) => {
|
|
8
|
+
event.preventDefault();
|
|
9
|
+
setIsDropTarget(true);
|
|
10
|
+
}, []);
|
|
11
|
+
const onDragLeave = useCallback(() => {
|
|
12
|
+
setIsDropTarget(false);
|
|
13
|
+
}, []);
|
|
14
|
+
const onDrop = useCallback(async (event) => {
|
|
15
|
+
event.preventDefault();
|
|
16
|
+
event.stopPropagation();
|
|
17
|
+
const droppedFiles = getDroppedFiles(event.dataTransfer.items).filter(Boolean);
|
|
18
|
+
if (droppedFiles.length) {
|
|
19
|
+
for (const file of droppedFiles) {
|
|
20
|
+
if (file) {
|
|
21
|
+
await onAddFile(file, uiNode);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else if (uiNode) {
|
|
26
|
+
const altOrOptionKeyPressed = event.getModifierState("Alt");
|
|
27
|
+
const data = event.dataTransfer.getData(UI_NODE);
|
|
28
|
+
const droppedNode = JSON.parse(data);
|
|
29
|
+
if (altOrOptionKeyPressed) {
|
|
30
|
+
await onCopyNode(droppedNode, uiNode);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
await onMoveNode(droppedNode, uiNode);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
setIsDropTarget(false);
|
|
37
|
+
}, [onAddFile, onCopyNode, onMoveNode, uiNode]);
|
|
38
|
+
return useMemo(() => {
|
|
39
|
+
const dropProps = allowedToBeDropTarget
|
|
40
|
+
? { onDragOver, onDragLeave, onDrop }
|
|
41
|
+
: {
|
|
42
|
+
onDragOver: undefined,
|
|
43
|
+
onDragLeave: undefined,
|
|
44
|
+
onDrop: undefined,
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
isDropTarget,
|
|
48
|
+
dropProps,
|
|
49
|
+
};
|
|
50
|
+
}, [allowedToBeDropTarget, isDropTarget, onDragLeave, onDragOver, onDrop]);
|
|
51
|
+
}
|
|
52
|
+
function getDroppedFiles(items) {
|
|
53
|
+
const droppedFiles = Array.from(items)
|
|
54
|
+
.map((item) => (item.kind === "file" ? item.getAsFile() : null))
|
|
55
|
+
.filter(Boolean);
|
|
56
|
+
return droppedFiles;
|
|
57
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UiFileNode, UiFolderNode } from "@powerhousedao/design-system";
|
|
2
|
+
interface SelectedFolderChildren {
|
|
3
|
+
folders: UiFolderNode[];
|
|
4
|
+
files: UiFileNode[];
|
|
5
|
+
}
|
|
6
|
+
export declare function useSelectedFolderChildren(selectedNodeId: string | undefined, folders: UiFolderNode[], files: UiFileNode[]): SelectedFolderChildren;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=useSelectedFolderChildren.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSelectedFolderChildren.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/hooks/useSelectedFolderChildren.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE7E,UAAU,sBAAsB;IAC9B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB;AAED,wBAAgB,yBAAyB,CACvC,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,OAAO,EAAE,YAAY,EAAE,EACvB,KAAK,EAAE,UAAU,EAAE,GAClB,sBAAsB,CAkBxB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
export function useSelectedFolderChildren(selectedNodeId, folders, files) {
|
|
3
|
+
return useMemo(() => {
|
|
4
|
+
if (!selectedNodeId) {
|
|
5
|
+
// Show root-level items when no folder is selected
|
|
6
|
+
return {
|
|
7
|
+
folders: folders.filter((f) => !f.parentFolder),
|
|
8
|
+
files: files.filter((f) => !f.parentFolder),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
const selectedFolder = folders.find((f) => f.id === selectedNodeId);
|
|
12
|
+
if (!selectedFolder)
|
|
13
|
+
return { folders: [], files: [] };
|
|
14
|
+
return {
|
|
15
|
+
folders: folders.filter((f) => f.parentFolder === selectedFolder.id),
|
|
16
|
+
files: files.filter((f) => f.parentFolder === selectedFolder.id),
|
|
17
|
+
};
|
|
18
|
+
}, [selectedNodeId, folders, files]);
|
|
19
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Node } from "document-drive";
|
|
2
|
+
import type { UiFileNode, UiFolderNode } from "@powerhousedao/design-system";
|
|
3
|
+
export declare function useTransformedNodes(nodes: Node[], driveId: string): (UiFileNode | UiFolderNode)[];
|
|
4
|
+
//# sourceMappingURL=useTransformedNodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTransformedNodes.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/hooks/useTransformedNodes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAY,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE7E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,iCA8BjE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
export function useTransformedNodes(nodes, driveId) {
|
|
3
|
+
return useMemo(() => {
|
|
4
|
+
return nodes
|
|
5
|
+
.map((node) => {
|
|
6
|
+
const isFolder = "kind" in node && node.kind === "folder";
|
|
7
|
+
if (isFolder) {
|
|
8
|
+
return {
|
|
9
|
+
id: node.id,
|
|
10
|
+
name: node.name,
|
|
11
|
+
kind: "FOLDER",
|
|
12
|
+
parentFolder: node.parentFolder || "",
|
|
13
|
+
driveId,
|
|
14
|
+
children: nodes
|
|
15
|
+
.filter((n) => n.parentFolder === node.id)
|
|
16
|
+
.map((n) => n.id),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return {
|
|
21
|
+
id: node.id,
|
|
22
|
+
name: node.name,
|
|
23
|
+
kind: "FILE",
|
|
24
|
+
parentFolder: node.parentFolder || "",
|
|
25
|
+
driveId,
|
|
26
|
+
documentType: node.documentType,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
.filter(Boolean);
|
|
31
|
+
}, [nodes, driveId]);
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/contributor-billing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAG5D,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,qBAAqB,CAS3D,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Editor from "./editor.js";
|
|
2
|
+
export const module = {
|
|
3
|
+
Component: Editor,
|
|
4
|
+
documentTypes: ["powerhouse/document-drive"],
|
|
5
|
+
config: {
|
|
6
|
+
id: "contributor-billing",
|
|
7
|
+
disableExternalControls: true,
|
|
8
|
+
documentToolbarEnabled: true,
|
|
9
|
+
showSwitchboardLink: true,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export default module;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../editors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,MAAM,IAAI,kBAAkB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InvoiceState } from "../../document-models/invoice/index.js";
|
|
2
|
+
interface InvoicePDFProps {
|
|
3
|
+
invoice: InvoiceState;
|
|
4
|
+
fiatMode: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const InvoicePDF: React.FC<InvoicePDFProps>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=InvoicePDF.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvoicePDF.d.ts","sourceRoot":"","sources":["../../../editors/invoice/InvoicePDF.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAA+D,MAAM,wCAAwC,CAAC;AAsSnI,UAAU,eAAe;IACvB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAyRhD,CAAC"}
|