@powerhousedao/contributor-billing 0.0.20 → 0.0.21

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.
Files changed (61) hide show
  1. package/dist/document-models/invoice/gen/document-model.d.ts.map +1 -1
  2. package/dist/document-models/invoice/gen/document-model.js +24 -2
  3. package/dist/document-models/invoice/gen/general/actions.d.ts +4 -2
  4. package/dist/document-models/invoice/gen/general/actions.d.ts.map +1 -1
  5. package/dist/document-models/invoice/gen/general/creators.d.ts +4 -2
  6. package/dist/document-models/invoice/gen/general/creators.d.ts.map +1 -1
  7. package/dist/document-models/invoice/gen/general/creators.js +2 -0
  8. package/dist/document-models/invoice/gen/general/object.d.ts +3 -1
  9. package/dist/document-models/invoice/gen/general/object.d.ts.map +1 -1
  10. package/dist/document-models/invoice/gen/general/object.js +7 -1
  11. package/dist/document-models/invoice/gen/general/operations.d.ts +3 -1
  12. package/dist/document-models/invoice/gen/general/operations.d.ts.map +1 -1
  13. package/dist/document-models/invoice/gen/reducer.d.ts.map +1 -1
  14. package/dist/document-models/invoice/gen/reducer.js +8 -0
  15. package/dist/document-models/invoice/gen/schema/types.d.ts +10 -0
  16. package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
  17. package/dist/document-models/invoice/gen/schema/zod.d.ts +3 -1
  18. package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
  19. package/dist/document-models/invoice/gen/schema/zod.js +14 -0
  20. package/dist/document-models/invoice/gen/utils.d.ts.map +1 -1
  21. package/dist/document-models/invoice/gen/utils.js +3 -0
  22. package/dist/document-models/invoice/index.d.ts +2 -0
  23. package/dist/document-models/invoice/index.d.ts.map +1 -1
  24. package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -1
  25. package/dist/document-models/invoice/src/reducers/general.js +19 -0
  26. package/dist/document-models/invoice/src/tests/general.test.js +17 -0
  27. package/dist/editors/billing-statement/editor.js +2 -2
  28. package/dist/editors/billing-statement/lineItemTags/lineItemTags.js +5 -4
  29. package/dist/editors/billing-statement/lineItemTags/tagMapping.d.ts +2 -0
  30. package/dist/editors/billing-statement/lineItemTags/tagMapping.d.ts.map +1 -1
  31. package/dist/editors/billing-statement/lineItemTags/tagMapping.js +105 -26
  32. package/dist/editors/contributor-billing/components/DriveExplorer.d.ts +1 -1
  33. package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
  34. package/dist/editors/contributor-billing/components/DriveExplorer.js +5 -8
  35. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +9 -1
  36. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
  37. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +128 -3
  38. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts +10 -1
  39. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -1
  40. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.js +7 -8
  41. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts +4 -1
  42. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts.map +1 -1
  43. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.js +5 -2
  44. package/dist/editors/invoice/editor.js +1 -1
  45. package/dist/editors/invoice/ingestPDF.js +1 -1
  46. package/dist/editors/invoice/invoiceToGnosis.d.ts.map +1 -1
  47. package/dist/editors/invoice/invoiceToGnosis.js +5 -2
  48. package/dist/editors/invoice/lineItemTags/lineItemTags.d.ts.map +1 -1
  49. package/dist/editors/invoice/lineItemTags/lineItemTags.js +1 -1
  50. package/dist/editors/invoice/lineItemTags/tagMapping.d.ts.map +1 -1
  51. package/dist/editors/invoice/lineItemTags/tagMapping.js +5 -1
  52. package/dist/editors/invoice/requestFinance.js +1 -1
  53. package/dist/editors/invoice/uploadPdfChunked.js +1 -1
  54. package/dist/scripts/invoice/gnosisTransactionBuilder.d.ts.map +1 -1
  55. package/dist/scripts/invoice/gnosisTransactionBuilder.js +9 -2
  56. package/dist/style.css +14 -8
  57. package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -1
  58. package/dist/subgraphs/invoice/resolvers.js +14 -0
  59. package/dist/subgraphs/invoice/schema.d.ts.map +1 -1
  60. package/dist/subgraphs/invoice/schema.js +20 -0
  61. package/package.json +2 -2
@@ -1,44 +1,123 @@
1
1
  const billingTagMapping = [
2
- { fusion: "Budget", xero: "Revenue" },
3
- { fusion: "Current Liability", xero: "Current Liability" },
4
- { fusion: "Interest Income", xero: "Revenue" },
5
- { fusion: "Travel & Entertainment", xero: "Expense" },
6
- { fusion: "Cost of Goods Sold", xero: "Direct Costs" },
7
- { fusion: "Marketing Expense", xero: "Expense" },
8
- { fusion: "Professional Services", xero: "Expense" },
9
- { fusion: "Software Development Expense", xero: "Expense" },
10
- { fusion: "Compensation & Benefits", xero: "Expense" },
11
- { fusion: "Admin Expense", xero: "Expense" },
2
+ { fusion: "Budget", xero: "Grants from Maker DAO" },
3
+ { fusion: "Current Asset", xero: "Clearing Account" },
4
+ { fusion: "Current Liability", xero: "Request Finance IC account" },
5
+ { fusion: "Interest Income", xero: "Interest Income" },
6
+ { fusion: "Travel & Entertainment", xero: "Activities and Events" },
7
+ { fusion: "Travel & Entertainment", xero: "Meals" },
8
+ { fusion: "Travel & Entertainment", xero: "Airfare" },
9
+ { fusion: "Travel & Entertainment", xero: "Hotels" },
10
+ { fusion: "Travel & Entertainment", xero: "Transportation (Uber, Taxi etc)" },
11
+ { fusion: "Travel & Entertainment", xero: "Other travel cost" },
12
+ { fusion: "Cost of Goods Sold", xero: "Cost of Goods Sold" },
13
+ { fusion: "Marketing Expense", xero: "Advertising" },
14
+ { fusion: "Professional Services", xero: "Legal Fees Abroad" },
15
+ { fusion: "Professional Services", xero: "Legal Fees Switzerland" },
16
+ { fusion: "Professional Services", xero: "Finance Team Fees Abroad" },
17
+ { fusion: "Professional Services", xero: "Fnance and Accounting Fees Switzerland" },
18
+ { fusion: "Software Development Expense", xero: "Software Development Team Fees" },
19
+ { fusion: "Professional Services", xero: "Research Team Fees" },
20
+ { fusion: "Marketing Expense", xero: "Marketing Team Fees" },
21
+ { fusion: "Compensation & Benefits", xero: "Health Care Fees" },
22
+ { fusion: "Compensation & Benefits", xero: "Contractor Fees" },
23
+ { fusion: "Compensation & Benefits", xero: "Insurance Fees Team" },
24
+ { fusion: "Compensation & Benefits", xero: "HR Fees" },
25
+ { fusion: "Compensation & Benefits", xero: "Team Bonus" },
26
+ { fusion: "Compensation & Benefits", xero: "Refferal Fees" },
27
+ { fusion: "Other", xero: "Depreciation" },
28
+ { fusion: "Other", xero: "Freight & Courier" },
29
+ { fusion: "Other", xero: "Interest Expense" },
30
+ { fusion: "Admin Expense", xero: "Office Expenses" },
31
+ { fusion: "Admin Expense", xero: "Rent" },
32
+ { fusion: "Admin Expense", xero: "Subscriptions" },
12
33
  { fusion: "Other Income Expense (Non-operating)", xero: "Bank Revaluations" },
13
- { fusion: "Other Income", xero: "Unrealized Currency Gains" },
14
- { fusion: "Other Income", xero: "Realized Currency Gains" },
15
- { fusion: "Income Tax Expense", xero: "Expense" },
34
+ { fusion: "Other Income", xero: "Unrealised Currency Gains" },
35
+ { fusion: "Other Income", xero: "Realised Currency Gains" },
36
+ { fusion: "Income Tax Expense", xero: "Income Tax Expense" },
16
37
  { fusion: "Current Asset", xero: "Accounts Receivable" },
17
- { fusion: "Current Asset", xero: "Current Asset" },
38
+ { fusion: "Current Asset", xero: "Prepayments" },
18
39
  { fusion: "Current Asset", xero: "Inventory" },
19
- { fusion: "Software Expense", xero: "Expense" },
20
- { fusion: "Fixed Asset", xero: "Fixed Asset" },
21
- { fusion: "Non-Current Asset", xero: "Fixed Asset" },
40
+ { fusion: "Software Expense", xero: "Software/IT Subscriptions" },
41
+ { fusion: "Software Expense", xero: "Telephone and Internet Charges" },
42
+ { fusion: "Fixed Asset", xero: "Office Equipment" },
43
+ { fusion: "Fixed Asset", xero: "Less Accumulated Depreciation on Office Equipment" },
44
+ { fusion: "Non-Current Asset", xero: "Computer Equipment" },
45
+ { fusion: "Non-Current Asset", xero: "Less Accumulated Depreciation on Computer Equipment" },
22
46
  { fusion: "Current Liability", xero: "Accounts Payable" },
23
- { fusion: "Gas Expense", xero: "Expense" },
47
+ { fusion: "Other", xero: "Bank Fees" },
48
+ { fusion: "Gas Expense", xero: "Gas Fees" },
49
+ { fusion: "Other", xero: "Exchange Fees" },
24
50
  { fusion: "Current Liability", xero: "Unpaid Expense Claims" },
51
+ { fusion: "Current Liability", xero: "Accrued Expenses" },
25
52
  { fusion: "Current Liability", xero: "Wages Payable" },
26
- { fusion: "Current Liability", xero: "Sales Tax" },
53
+ { fusion: "Current Liability", xero: "Employee Tax Payable" },
54
+ { fusion: "Current Liability", xero: "Superannuation Payable" },
55
+ { fusion: "Current Liability", xero: "Income Tax Payable" },
56
+ { fusion: "Other", xero: "Sales Tax" },
27
57
  { fusion: "Adjustment A/C", xero: "Historical Adjustment" },
28
- { fusion: "Temporary Holding Account", xero: "Current Liability" },
58
+ { fusion: "Temporary Holding Account", xero: "Suspense" },
29
59
  { fusion: "Other", xero: "Rounding" },
30
- { fusion: "Internal Transfers", xero: "Tracking" },
31
- { fusion: "Owner Equity", xero: "Current Liability" },
32
- { fusion: "Non-current Liability", xero: "Non-current Liability" },
60
+ { fusion: "Internal Transfers", xero: "Tracking Transfers" },
61
+ { fusion: "Owner Equity", xero: "Owner A Drawings" },
62
+ { fusion: "Owner Equity", xero: "Owner A Funds Introduced" },
63
+ { fusion: "Non-current Liability", xero: "Loan" },
33
64
  { fusion: "Equity", xero: "Retained Earnings" },
34
- { fusion: "Equity", xero: "Equity" }
65
+ { fusion: "Equity", xero: "Owner A Share Capital" }
35
66
  ];
67
+ // Mapping of labels to values
68
+ const fusionLabelToValue = {
69
+ "Budget": "budget",
70
+ "Current Liability": "liabilities/current",
71
+ "Interest Income": "income/interest",
72
+ "Travel & Entertainment": "expenses/headcount/travel-and-entertainment",
73
+ "Cost of Goods Sold": "expenses/non-headcount/direct-costs",
74
+ "Marketing Expense": "expenses/headcount/marketing",
75
+ "Professional Services": "expenses/headcount/professional-services",
76
+ "Software Development Expense": "expenses/non-headcount/software-development",
77
+ "Compensation & Benefits": "expenses/headcount/compensation-and-benefits",
78
+ "Admin Expense": "expenses/headcount/admin",
79
+ "Other Income Expense (Non-operating)": "income/non-operating",
80
+ "Other Income": "income/other",
81
+ "Income Tax Expense": "expenses/non-headcount/income-tax",
82
+ "Current Asset": "assets/current",
83
+ "Software Expense": "expenses/non-headcount/software",
84
+ "Fixed Asset": "assets/fixed",
85
+ "Non-Current Asset": "assets/non-current",
86
+ "Gas Expense": "expenses/non-headcount/gas",
87
+ "Adjustment A/C": "accounts/adjustment",
88
+ "Temporary Holding Account": "accounts/temporary",
89
+ "Other": "accounts/other",
90
+ "Internal Transfers": "accounts/internal-transfers",
91
+ "Owner Equity": "equity/owner",
92
+ "Non-current Liability": "liabilities/non-current",
93
+ "Equity": "equity/retained",
94
+ };
36
95
  export const expenseAccountOptions = Array.from(new Set(billingTagMapping.map((tag) => tag.fusion))).map((tag) => {
37
96
  return {
38
97
  label: tag,
39
- value: tag
98
+ value: fusionLabelToValue[tag] || tag, // Fallback to tag name if no code mapping exists
40
99
  };
41
100
  });
42
101
  export const budgetOptions = [
43
- { label: "powerhouse", value: "PH-001" },
102
+ { label: "Powerhouse", value: "PH-001" },
103
+ { label: "Jetstream", value: "JTS-001" },
44
104
  ];
105
+ export const mapTags = (lineItemTags) => {
106
+ if (lineItemTags.length === 0)
107
+ return [];
108
+ const tags = lineItemTags.map((tag) => {
109
+ const mapping = billingTagMapping.find((mapping) => mapping.xero === tag.label);
110
+ const fusionLabel = fusionLabelToValue[mapping?.fusion || ""];
111
+ if (mapping && fusionLabel) {
112
+ return {
113
+ dimension: "expense-account",
114
+ value: fusionLabel,
115
+ label: mapping.fusion,
116
+ };
117
+ }
118
+ if (tag.dimension === "accounting-period") {
119
+ return tag;
120
+ }
121
+ });
122
+ return tags;
123
+ };
@@ -12,6 +12,6 @@ interface DriveExplorerProps {
12
12
  document: DocumentDriveDocument;
13
13
  dispatch: EditorDispatch<DocumentDriveAction>;
14
14
  }
15
- export declare function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddFolder, onCopyNode, context, document, dispatch }: DriveExplorerProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddFolder, onCopyNode, context, document, dispatch, }: DriveExplorerProps): import("react/jsx-runtime").JSX.Element;
16
16
  export {};
17
17
  //# sourceMappingURL=DriveExplorer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/DriveExplorer.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAqB,mBAAmB,EAAY,KAAK,qBAAqB,EAAiB,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AASxI,OAAO,KAAK,EAAsC,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGzF,OAAO,EACL,KAAK,kBAAkB,EAMxB,MAAM,gCAAgC,CAAC;AAKxC,UAAU,kBAAkB;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5E,OAAO,EAAE,kBAAkB,CAAC;IAC5B,QAAQ,EAAE,qBAAqB,CAAC;IAChC,QAAQ,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAAA;CAC9C;AAED,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,KAAK,EACL,YAAY,EACZ,UAAU,EACV,WAAW,EACX,UAAU,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,EACT,EAAE,kBAAkB,2CA+OpB"}
1
+ {"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/DriveExplorer.tsx"],"names":[],"mappings":"AAUA,OAAO,EAGL,mBAAmB,EAEnB,KAAK,qBAAqB,EAE1B,KAAK,IAAI,EACV,MAAM,gBAAgB,CAAC;AASxB,OAAO,KAAK,EAGV,cAAc,EACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,KAAK,kBAAkB,EAMxB,MAAM,gCAAgC,CAAC;AAKxC,UAAU,kBAAkB;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5E,OAAO,EAAE,kBAAkB,CAAC;IAC5B,QAAQ,EAAE,qBAAqB,CAAC;IAChC,QAAQ,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAAC;CAC/C;AAED,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,KAAK,EACL,YAAY,EACZ,UAAU,EACV,WAAW,EACX,UAAU,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,GACT,EAAE,kBAAkB,2CAyQpB"}
@@ -1,20 +1,17 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useState, useRef, useEffect } from "react";
3
3
  import { twMerge } from "tailwind-merge";
4
- import { FileItemsGrid } from "./FileItemsGrid.js";
5
- import { FolderItemsGrid } from "./FolderItemsGrid.js";
6
4
  import { useTransformedNodes } from "../hooks/useTransformedNodes.js";
7
5
  import { useSelectedFolderChildren } from "../hooks/useSelectedFolderChildren.js";
8
6
  import { useDispatchMap } from "../hooks/useDispatchMap.js";
9
7
  import { DocumentDispatch } from "./DocumentDispatch.js";
10
8
  import { EditorContainer } from "./EditorContainer.js";
11
9
  import { CreateDocumentModal } from "@powerhousedao/design-system";
12
- import { CreateDocument } from "./CreateDocument.js";
13
10
  import { useDriveActionsWithUiNodes, useDriveContext, } from "@powerhousedao/reactor-browser";
14
11
  import { InvoiceTable } from "./InvoiceTable/InvoiceTable.js";
15
12
  import { actions } from "../../../document-models/invoice/index.js";
16
13
  import { useDrop } from "../hooks/useDrop.js";
17
- export function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddFolder, onCopyNode, context, document, dispatch }) {
14
+ export function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddFolder, onCopyNode, context, document, dispatch, }) {
18
15
  const [selectedNodeId, setSelectedNodeId] = useState();
19
16
  const [activeDocumentId, setActiveDocumentId] = useState();
20
17
  const [openModal, setOpenModal] = useState(false);
@@ -29,18 +26,18 @@ export function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddF
29
26
  Object.entries(selected).forEach(([id, checked]) => {
30
27
  console.log(action);
31
28
  if (checked) {
32
- if (action === 'approve' && dispatchMap[id]) {
29
+ if (action === "approve" && dispatchMap[id]) {
33
30
  dispatchMap[id](actions.editStatus({
34
31
  status: "AWAITINGPAYMENT",
35
32
  }));
36
33
  }
37
- else if (action === 'reject' && dispatchMap[id]) {
34
+ else if (action === "reject" && dispatchMap[id]) {
38
35
  dispatchMap[id](actions.editStatus({
39
36
  status: "REJECTED",
40
37
  }));
41
38
  }
42
39
  }
43
- else if (action === 'pay' && dispatchMap[id]) {
40
+ else if (action === "pay" && dispatchMap[id]) {
44
41
  dispatchMap[id](actions.editStatus({
45
42
  status: "PAYMENTRECEIVED",
46
43
  }));
@@ -108,5 +105,5 @@ export function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddF
108
105
  const editorModule = activeDocument
109
106
  ? context.getEditor(activeDocument.documentType)
110
107
  : null;
111
- return (_jsxs("div", { className: "flex h-full", children: [nodes.map(node => (_jsx(DocumentDispatch, { documentId: node.id, driveId: driveId, documentModelModule: documentModels[1], context: context, onDispatchReady: (dispatch) => handleDispatchReady(node.id, dispatch) }, node.id))), _jsx("div", { className: "flex-1 p-4 overflow-y-auto", children: activeDocument && documentModelModule && editorModule ? (_jsx(EditorContainer, { context: context, documentId: activeDocumentId, documentType: activeDocument.documentType, driveId: driveId, onClose: handleEditorClose, title: activeDocument.name, documentModelModule: documentModelModule, editorModule: editorModule })) : (_jsxs("div", { ...dropProps, className: twMerge('rounded-md border-2 border-transparent ', isDropTarget && 'border-dashed border-blue-100'), children: [_jsx(FolderItemsGrid, { folders: selectedFolderChildren.folders, onSelectNode: handleNodeSelect, onRenameNode: renameNode, onDuplicateNode: (uiNode) => onCopyNode(uiNode.id, "Copy of " + uiNode.name, uiNode.parentFolder), onDeleteNode: onDeleteNode, onAddFile: dummyAddFile, onCopyNode: async (uiNode, targetNode) => onCopyNode(uiNode.id, "Copy of " + uiNode.name, targetNode.id), onMoveNode: dummyMoveNode, isAllowedToCreateDocuments: true, onAddFolder: onAddFolder, parentFolderId: selectedNodeId }), _jsx(FileItemsGrid, { files: selectedFolderChildren.files, onSelectNode: handleFileSelect, onRenameNode: renameNode, onDuplicateNode: dummyDuplicateNode, onDeleteNode: onDeleteNode, isAllowedToCreateDocuments: true }), _jsx(CreateDocument, { createDocument: onSelectDocumentModel, documentModels: filteredDocumentModels }), _jsx(InvoiceTable, { setActiveDocumentId: setActiveDocumentId, files: files, state: state, getDispatch: () => dispatchMap[activeDocumentId || ""], selected: selected, setSelected: setSelected, onBatchAction: handleBatchAction })] })) }), _jsx(CreateDocumentModal, { onContinue: onCreateDocument, onOpenChange: (open) => setOpenModal(open), open: openModal })] }));
108
+ return (_jsxs("div", { className: "flex h-full", children: [nodes.map((node) => (_jsx(DocumentDispatch, { documentId: node.id, driveId: driveId, documentModelModule: documentModels, context: context, onDispatchReady: (dispatch) => handleDispatchReady(node.id, dispatch) }, node.id))), _jsx("div", { className: "flex-1 p-4 overflow-y-auto", children: activeDocument && documentModelModule && editorModule ? (_jsx(EditorContainer, { context: context, documentId: activeDocumentId, documentType: activeDocument.documentType, driveId: driveId, onClose: handleEditorClose, title: activeDocument.name, documentModelModule: documentModelModule, editorModule: editorModule })) : (_jsx("div", { ...dropProps, className: twMerge("editor-container rounded-md border-2 border-transparent ", isDropTarget && "border-dashed border-blue-100"), children: _jsx(InvoiceTable, { setActiveDocumentId: setActiveDocumentId, files: files, state: state, getDispatch: () => dispatchMap[activeDocumentId || ""], selected: selected, setSelected: setSelected, onBatchAction: handleBatchAction, onDeleteNode: onDeleteNode, renameNode: renameNode, filteredDocumentModels: filteredDocumentModels, onSelectDocumentModel: onSelectDocumentModel, dispatchMap: dispatchMap }) })) }), _jsx(CreateDocumentModal, { onContinue: onCreateDocument, onOpenChange: (open) => setOpenModal(open), open: openModal })] }));
112
109
  }
@@ -1,4 +1,7 @@
1
1
  import { type UiFileNode } from "@powerhousedao/design-system";
2
+ import { EditorDispatch } from "document-model";
3
+ import { DocumentModelModule } from "document-model";
4
+ import { DocumentDriveAction } from "document-drive";
2
5
  interface InvoiceTableProps {
3
6
  files: UiFileNode[];
4
7
  state: Record<string, any>;
@@ -15,7 +18,12 @@ interface InvoiceTableProps {
15
18
  [id: string]: boolean;
16
19
  })) => void;
17
20
  onBatchAction: (action: string) => void;
21
+ onDeleteNode: (nodeId: string) => void;
22
+ renameNode: (nodeId: string, name: string) => void;
23
+ filteredDocumentModels: DocumentModelModule[];
24
+ onSelectDocumentModel: (model: DocumentModelModule) => void;
25
+ dispatchMap: Record<string, EditorDispatch<DocumentDriveAction>>;
18
26
  }
19
- export declare const InvoiceTable: ({ files, state, setActiveDocumentId, getDispatch, selected, setSelected, onBatchAction, }: InvoiceTableProps) => import("react/jsx-runtime").JSX.Element;
27
+ export declare const InvoiceTable: ({ files, state, setActiveDocumentId, getDispatch, selected, setSelected, onBatchAction, onDeleteNode, renameNode, filteredDocumentModels, onSelectDocumentModel, dispatchMap, }: InvoiceTableProps) => import("react/jsx-runtime").JSX.Element;
20
28
  export {};
21
29
  //# sourceMappingURL=InvoiceTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InvoiceTable.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AA0B/D,UAAU,iBAAiB;IACzB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChE,QAAQ,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACpC,WAAW,EAAE,CAAC,QAAQ,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,CAAC,CAAC,IAAI,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,KAAK;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,KAAK,IAAI,CAAC;IAC9H,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,YAAY,GAAI,2FAQ1B,iBAAiB,4CAqMnB,CAAC"}
1
+ {"version":3,"file":"InvoiceTable.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAM/D,OAAO,EAAE,cAAc,EAAc,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAsBrD,UAAU,iBAAiB;IACzB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChE,QAAQ,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACpC,WAAW,EAAE,CACX,QAAQ,EACJ;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GACzB,CAAC,CAAC,IAAI,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,KAAK;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,KACjE,IAAI,CAAC;IACV,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,sBAAsB,EAAE,mBAAmB,EAAE,CAAC;IAC9C,qBAAqB,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC5D,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAAC,CAAC;CAClE;AAED,eAAO,MAAM,YAAY,GAAI,iLAa1B,iBAAiB,4CA0bnB,CAAC"}
@@ -3,14 +3,25 @@ import { useState } from "react";
3
3
  import { HeaderControls } from "./HeaderControls.js";
4
4
  import { InvoiceTableSection } from "./InvoiceTableSection.js";
5
5
  import { InvoiceTableRow } from "./InvoiceTableRow.js";
6
+ import { useDriveContext, } from "@powerhousedao/reactor-browser";
7
+ import { mapTags } from "../../../billing-statement/lineItemTags/tagMapping.js";
6
8
  const statusOptions = [
9
+ { label: "Draft", value: "DRAFT" },
7
10
  { label: "Awaiting Approval", value: "AWAITINGAPPROVAL" },
8
11
  { label: "Awaiting Payment", value: "AWAITINGPAYMENT" },
9
12
  { label: "Payment Received", value: "PAYMENTRECEIVED" },
10
13
  { label: "Rejected", value: "REJECTED" },
14
+ { label: "Other", value: "OTHER" },
11
15
  ];
12
- export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, selected, setSelected, onBatchAction, }) => {
16
+ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, selected, setSelected, onBatchAction, onDeleteNode, renameNode, filteredDocumentModels, onSelectDocumentModel, dispatchMap, }) => {
13
17
  const [selectedStatuses, setSelectedStatuses] = useState([]);
18
+ const { addDocument, addFile, documentModels, useDriveDocumentStates, selectedNode, } = useDriveContext();
19
+ const billingDocStates = Object.entries(state)
20
+ .filter(([_, doc]) => doc.documentType === "powerhouse/billing-statement")
21
+ .map(([id, doc]) => ({
22
+ id,
23
+ contributor: doc.global.contributor,
24
+ }));
14
25
  const getMenuOptions = () => {
15
26
  return [
16
27
  { label: "View Invoice", value: "view-invoice" },
@@ -30,16 +41,130 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
30
41
  .map(([id, doc]) => ({
31
42
  id,
32
43
  issuer: doc.global.issuer?.name || "Unknown",
44
+ status: doc.global.status,
33
45
  invoiceNo: doc.global.invoiceNo,
34
46
  issueDate: doc.global.dateIssued,
35
47
  dueDate: doc.global.dateDue,
36
48
  currency: doc.global.currency,
37
49
  amount: doc.global.totalPriceTaxIncl?.toString() ?? "",
50
+ exported: doc.global.exported,
38
51
  }));
39
52
  };
53
+ // console.log('filteredDocumentModels', filteredDocumentModels)
54
+ const getOtherInvoices = () => {
55
+ return Object.entries(state)
56
+ .filter(([_, doc]) => doc.documentType === "powerhouse/invoice" &&
57
+ doc.global.status !== "DRAFT" &&
58
+ doc.global.status !== "ISSUED" &&
59
+ doc.global.status !== "AWAITINGAPPROVAL" &&
60
+ doc.global.status !== "PAYMENTSCHEDULED" &&
61
+ doc.global.status !== "PAYMENTRECEIVED" &&
62
+ doc.global.status !== "REJECTED")
63
+ .map(([id, doc]) => ({
64
+ id,
65
+ issuer: doc.global.issuer?.name || "Unknown",
66
+ status: doc.global.status,
67
+ invoiceNo: doc.global.invoiceNo,
68
+ issueDate: doc.global.dateIssued,
69
+ dueDate: doc.global.dateDue,
70
+ currency: doc.global.currency,
71
+ amount: doc.global.totalPriceTaxIncl?.toString() ?? "",
72
+ documentType: doc.documentType,
73
+ exported: doc.global.exported,
74
+ }));
75
+ };
76
+ const draft = getInvoicesByStatus("DRAFT");
40
77
  const awaitingApproval = getInvoicesByStatus("ISSUED");
41
- const awaitingPayment = getInvoicesByStatus("AWAITINGPAYMENT");
78
+ const awaitingPayment = getInvoicesByStatus("PAYMENTSCHEDULED");
42
79
  const paid = getInvoicesByStatus("PAYMENTRECEIVED");
43
80
  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))) })] }) }))] }));
81
+ const otherInvoices = getOtherInvoices();
82
+ const handleDelete = (id) => {
83
+ onDeleteNode(id);
84
+ // Clear selection for deleted item
85
+ };
86
+ const handleCreateBillingStatement = async (id) => {
87
+ const driveId = selectedNode?.id;
88
+ if (!driveId)
89
+ return;
90
+ const invoiceFile = files.find((file) => file.id === id);
91
+ const invoiceState = state[id];
92
+ const billingDoc = await addDocument(driveId, `bill-${invoiceFile?.name}`, "powerhouse/billing-statement", undefined, {
93
+ name: `bill-${invoiceFile?.name}`,
94
+ created: new Date().toISOString(),
95
+ lastModified: new Date().toISOString(),
96
+ documentType: "powerhouse/billing-statement",
97
+ state: {
98
+ global: {
99
+ contributor: id,
100
+ dateIssued: invoiceState.global.dateIssued,
101
+ dateDue: invoiceState.global.dateDue,
102
+ lineItems: invoiceState.global.lineItems.map((item) => {
103
+ return {
104
+ id: item.id,
105
+ description: item.description,
106
+ quantity: item.quantity,
107
+ unit: 'UNIT',
108
+ unitPricePwt: 0,
109
+ unitPriceCash: item.unitPriceTaxIncl,
110
+ totalPricePwt: 0,
111
+ totalPriceCash: item.totalPriceTaxIncl,
112
+ lineItemTag: mapTags(item.lineItemTag || []),
113
+ };
114
+ }),
115
+ status: invoiceState.global.status,
116
+ currency: invoiceState.global.currency,
117
+ totalCash: invoiceState.global.lineItems.reduce((acc, item) => acc + item.totalPriceTaxIncl, 0),
118
+ totalPowt: 0,
119
+ notes: invoiceState.global.notes,
120
+ },
121
+ local: {},
122
+ },
123
+ revision: {
124
+ global: 0,
125
+ local: 0,
126
+ },
127
+ operations: {
128
+ global: [],
129
+ local: [],
130
+ },
131
+ initialState: {
132
+ name: `bill-${invoiceFile?.name}`,
133
+ documentType: "powerhouse/billing-statement",
134
+ created: new Date().toISOString(),
135
+ lastModified: new Date().toISOString(),
136
+ revision: {
137
+ global: 0,
138
+ local: 0,
139
+ },
140
+ state: {
141
+ global: {},
142
+ local: {},
143
+ },
144
+ },
145
+ clipboard: [],
146
+ });
147
+ };
148
+ const handleCSVExport = () => {
149
+ console.log('exporting...', selected);
150
+ };
151
+ return (_jsxs("div", { className: "w-full h-full bg-white rounded-lg p-4 border border-gray-200 shadow-md mt-4 overflow-x-auto", children: [_jsx(HeaderControls, { statusOptions: statusOptions, onStatusChange: handleStatusChange, onBatchAction: onBatchAction, onExport: handleCSVExport }), shouldShowSection("DRAFT") && (_jsx(InvoiceTableSection, { title: "Draft", count: draft.length, onSelectDocumentModel: onSelectDocumentModel, filteredDocumentModels: filteredDocumentModels, 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-center", children: "Invoice" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: draft.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
152
+ ...prev,
153
+ [row.id]: checked,
154
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode }, row.id))) })] }) })), 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-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: awaitingApproval.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
155
+ ...prev,
156
+ [row.id]: checked,
157
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, 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-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: awaitingPayment.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
158
+ ...prev,
159
+ [row.id]: checked,
160
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, 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-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Exported" })] }) }), _jsx("tbody", { children: paid.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
161
+ ...prev,
162
+ [row.id]: checked,
163
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, 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-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-centert", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: rejected.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
164
+ ...prev,
165
+ [row.id]: checked,
166
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode }, row.id))) })] }) })), shouldShowSection("OTHER") && (_jsx(InvoiceTableSection, { title: "Other", count: otherInvoices.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-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Exported" })] }) }), _jsx("tbody", { children: otherInvoices.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
167
+ ...prev,
168
+ [row.id]: checked,
169
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode }, row.id))) })] }) }))] }, `${Object.keys(state).length}`));
45
170
  };
@@ -1,4 +1,6 @@
1
- export declare const InvoiceTableRow: ({ row, isSelected, onSelect, menuOptions, onMenuAction, setActiveDocumentId }: {
1
+ import { type UiFileNode } from "@powerhousedao/design-system";
2
+ export declare const InvoiceTableRow: ({ files, row, isSelected, onSelect, menuOptions, onMenuAction, setActiveDocumentId, onDeleteNode, renameNode, onCreateBillingStatement, billingDocStates, }: {
3
+ files?: UiFileNode[];
2
4
  row: any;
3
5
  isSelected: boolean;
4
6
  onSelect: (checked: boolean) => void;
@@ -8,5 +10,12 @@ export declare const InvoiceTableRow: ({ row, isSelected, onSelect, menuOptions,
8
10
  }[];
9
11
  onMenuAction: (action: string) => void;
10
12
  setActiveDocumentId: (id: string) => void;
13
+ onDeleteNode: (nodeId: string) => void;
14
+ renameNode: (nodeId: string, name: string) => void;
15
+ onCreateBillingStatement?: (id: string) => void;
16
+ billingDocStates?: {
17
+ id: string;
18
+ contributor: string;
19
+ }[];
11
20
  }) => import("react/jsx-runtime").JSX.Element;
12
21
  //# sourceMappingURL=InvoiceTableRow.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"InvoiceTableRow.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,UAAU,EAEhB,MAAM,8BAA8B,CAAC;AAEtC,eAAO,MAAM,eAAe,GAAI,6JAY7B;IACD,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,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;IAC1C,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,wBAAwB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,gBAAgB,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC1D,4CA8FA,CAAC"}
@@ -1,12 +1,11 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState, useRef } from "react";
3
- import { RowActionMenu } from "./RowActionMenu.js";
4
- export const InvoiceTableRow = ({ row, isSelected, onSelect, menuOptions, onMenuAction, setActiveDocumentId }) => {
3
+ import { FileItem, } from "@powerhousedao/design-system";
4
+ export const InvoiceTableRow = ({ files, row, isSelected, onSelect, menuOptions, onMenuAction, setActiveDocumentId, onDeleteNode, renameNode, onCreateBillingStatement, billingDocStates, }) => {
5
5
  const [menuOpen, setMenuOpen] = useState(false);
6
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
- } })] }))] }) })] }));
7
+ const billingDoc = billingDocStates?.find((doc) => doc.contributor === row.id);
8
+ const billingFile = files?.find((file) => file.id === billingDoc?.id);
9
+ const file = files?.find((file) => file.id === row.id);
10
+ 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: "py-1 w-10", children: file && (_jsx(FileItem, { uiNode: file, onSelectNode: () => setActiveDocumentId(row.id), onRenameNode: (name) => renameNode(row.id, name), onDuplicateNode: () => { }, onDeleteNode: () => onDeleteNode(row.id), isAllowedToCreateDocuments: true, className: "h-10" }, row.id)) }), _jsx("td", { className: "px-2 py-2 text-center", children: row.invoiceNo }), _jsx("td", { className: "px-2 py-2 text-center", children: row.issueDate }), _jsx("td", { className: "px-2 py-2 text-center", children: row.dueDate }), _jsx("td", { className: "px-2 py-2 text-center", children: row.currency }), _jsx("td", { className: "px-2 py-2 text-center", children: row.amount }), (row.status === "ISSUED" || row.status === "PAYMENTSCHEDULED" || row.status === "PAYMENTRECEIVED") && !billingFile && (_jsx("td", { className: "px-2 py-2 text-center", children: _jsx("button", { className: "bg-white border border-gray-300 rounded px-3 py-1 text-sm hover:bg-gray-100 col-span-1 justify-self-end", onClick: () => onCreateBillingStatement?.(row.id), children: "Generate Billing Statement" }) })), billingFile && (_jsx("td", { className: "px-2 py-2 text-center", children: _jsx(FileItem, { uiNode: billingFile, onSelectNode: () => setActiveDocumentId(billingDoc?.id), onRenameNode: (name) => renameNode(billingDoc?.id, name), onDuplicateNode: () => { }, onDeleteNode: () => onDeleteNode(billingDoc?.id), isAllowedToCreateDocuments: true, className: "h-10" }, billingDoc?.id) })), _jsx("td", { className: "px-2 py-2 text-center", children: row.exported ? _jsx("span", { className: "text-green-500", children: "Yes" }) : _jsx("span", { className: "text-red-500", children: "No" }) })] }));
12
11
  };
@@ -1,7 +1,10 @@
1
- export declare const InvoiceTableSection: ({ title, count, children, color, }: {
1
+ import { DocumentModelModule } from "document-model";
2
+ export declare const InvoiceTableSection: ({ title, count, children, color, onSelectDocumentModel, filteredDocumentModels, }: {
2
3
  title: string;
3
4
  count: number;
4
5
  children: React.ReactNode;
5
6
  color?: string;
7
+ onSelectDocumentModel?: (model: DocumentModelModule) => void;
8
+ filteredDocumentModels?: DocumentModelModule[];
6
9
  }) => import("react/jsx-runtime").JSX.Element;
7
10
  //# sourceMappingURL=InvoiceTableSection.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"InvoiceTableSection.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,eAAO,MAAM,mBAAmB,GAAI,mFAOjC;IACD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC7D,sBAAsB,CAAC,EAAE,mBAAmB,EAAE,CAAC;CAChD,4CAsCA,CAAC"}
@@ -1,7 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import { ChevronDown, ChevronRight } from "lucide-react";
4
- export const InvoiceTableSection = ({ title, count, children, color = "bg-blue-100 text-blue-600", }) => {
4
+ export const InvoiceTableSection = ({ title, count, children, color = "bg-blue-100 text-blue-600", onSelectDocumentModel, filteredDocumentModels, }) => {
5
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 }))] }));
6
+ const invoiceDodModel = filteredDocumentModels?.find(model => model.documentModel.id === "powerhouse/invoice");
7
+ return (_jsxs("div", { className: "mb-2", children: [_jsxs("div", { className: "grid grid-cols-2", children: [_jsxs("button", { onClick: () => setIsExpanded(!isExpanded), className: "w-full flex items-center gap-2 hover:opacity-80 transition-opacity col-span-1", 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" }))] }), title === "Draft" && (_jsx("button", { className: "bg-white border border-gray-300 rounded px-3 py-1 text-sm hover:bg-gray-100 col-span-1 justify-self-end", onClick: () => {
8
+ onSelectDocumentModel?.(invoiceDodModel);
9
+ }, children: "Create Invoice" }))] }), isExpanded && _jsx("div", { className: "mt-2", children: children })] }));
7
10
  };
@@ -396,7 +396,7 @@ export default function Editor(props) {
396
396
  dateDelivered: newValue,
397
397
  }));
398
398
  }
399
- }, value: state.dateDelivered || "" })] })] }), _jsx(LegalEntityForm, { legalEntity: state.issuer, onChangeInfo: (input) => dispatch(actions.editIssuer(input)), onChangeBank: (input) => dispatch(actions.editIssuerBank(input)), onChangeWallet: (input) => dispatch(actions.editIssuerWallet(input)), basicInfoDisabled: false, bankDisabled: !fiatMode, walletDisabled: fiatMode, currency: state.currency, status: state.status, walletvalidation: walletValidation, mainCountryValidation: mainCountryValidation, bankCountryValidation: bankCountryValidation, ibanvalidation: ibanValidation, bicvalidation: bicValidation, banknamevalidation: bankNameValidation, streetaddressvalidation: streetAddressValidation, cityvalidation: cityValidation, postalcodevalidation: postalCodeValidation, payeremailvalidation: payerEmailValidation })] }), _jsxs("div", { className: "border border-gray-200 rounded-lg p-4", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Payer" }), _jsxs("div", { className: "mb-2", children: [_jsx("label", { className: "block mb-1 text-sm", children: "Due Date:" }), _jsx(DatePicker, { name: "dateDue", className: String.raw `w-full p-0`, onChange: (e) => dispatch(actions.editInvoice({
399
+ }, value: state.dateDelivered || "" })] })] }), _jsx(LegalEntityForm, { legalEntity: state.issuer, onChangeInfo: (input) => dispatch(actions.editIssuer(input)), onChangeBank: (input) => dispatch(actions.editIssuerBank(input)), onChangeWallet: (input) => dispatch(actions.editIssuerWallet(input)), basicInfoDisabled: false, bankDisabled: !fiatMode, walletDisabled: fiatMode, currency: state.currency, status: state.status, walletvalidation: walletValidation, mainCountryValidation: mainCountryValidation, bankCountryValidation: bankCountryValidation, ibanvalidation: ibanValidation, bicvalidation: bicValidation, banknamevalidation: bankNameValidation, streetaddressvalidation: streetAddressValidation, cityvalidation: cityValidation, postalcodevalidation: postalCodeValidation, payeremailvalidation: payerEmailValidation })] }), _jsxs("div", { className: "border border-gray-200 rounded-lg p-4", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Payer" }), _jsxs("div", { className: "mb-2", children: [_jsx("label", { className: "block mb-1 text-sm", children: "Due Date:" }), _jsx(DatePicker, { name: "dateDue", className: 'w-64', onChange: (e) => dispatch(actions.editInvoice({
400
400
  dateDue: e.target.value.split("T")[0],
401
401
  })), value: state.dateDue })] }), _jsx(LegalEntityForm, { bankDisabled: true, legalEntity: state.payer, onChangeInfo: (input) => dispatch(actions.editPayer(input)), currency: state.currency, status: state.status, payeremailvalidation: payerEmailValidation })] })] }), _jsx("div", { className: "mb-8", children: _jsx(LineItemsTable, { currency: state.currency, lineItems: state.lineItems.map((item) => ({
402
402
  ...item,
@@ -6,7 +6,7 @@ import { uploadPdfChunked } from "./uploadPdfChunked.js";
6
6
  import { getCountryCodeFromName } from "./utils/utils.js";
7
7
  let GRAPHQL_URL = 'http://localhost:4001/graphql/invoice';
8
8
  if (window.document.baseURI !== 'http://localhost:3000/') {
9
- GRAPHQL_URL = 'https://switchboard.powerhouse.xyz/graphql/invoice';
9
+ GRAPHQL_URL = 'https://switchboard-dev.powerhouse.xyz/graphql/invoice';
10
10
  }
11
11
  export async function loadPDFFile({ file, dispatch, }) {
12
12
  if (!file)
@@ -1 +1 @@
1
- {"version":3,"file":"invoiceToGnosis.d.ts","sourceRoot":"","sources":["../../../editors/invoice/invoiceToGnosis.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAQxC,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,GAAG,CAAC;CACf;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAqLnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"invoiceToGnosis.d.ts","sourceRoot":"","sources":["../../../editors/invoice/invoiceToGnosis.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAYxC,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,GAAG,CAAC;CACf;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAqLnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -2,7 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  let GRAPHQL_URL = "http://localhost:4001/graphql/invoice";
4
4
  if (window.document.baseURI !== "http://localhost:3000/") {
5
- GRAPHQL_URL = "https://switchboard.powerhouse.xyz/graphql/invoice";
5
+ GRAPHQL_URL = "https://switchboard-dev.powerhouse.xyz/graphql/invoice";
6
+ }
7
+ if (window.document.baseURI !== "http://localhost:3001/") {
8
+ GRAPHQL_URL = "https://switchboard-dev.powerhouse.xyz/graphql/invoice";
6
9
  }
7
10
  const InvoiceToGnosis = ({ docState }) => {
8
11
  const [isLoading, setIsLoading] = useState(false);
@@ -124,6 +127,6 @@ const InvoiceToGnosis = ({ docState }) => {
124
127
  }
125
128
  };
126
129
  const urlChainName = parseChainName(chainName);
127
- return (_jsxs("div", { className: "space-y-4", children: [currency && chainName && currency !== "" && chainName !== "" && (_jsx("button", { className: "bg-blue-500 text-black px-4 py-2 rounded-md hover:bg-blue-600", onClick: handleInvoiceToGnosis, disabled: isLoading, children: isLoading ? "Processing..." : "Send Payment to Gnosis >" })), error && (_jsx("div", { className: "text-red-500 bg-red-50 p-3 rounded-md", children: error })), safeTxHash && (_jsxs("div", { className: "bg-gray-50 p-4 rounded-md space-y-2", children: [_jsxs("p", { className: "font-medium", children: ["Safe Transaction Hash:", _jsx("span", { className: "font-mono text-sm ml-2 break-all", children: safeTxHash })] }), _jsx("a", { href: `https://app.safe.global/transactions/queue?safe=${urlChainName}:0xF130f741d4E3185b29412c65397363f8c23A0460`, target: "_blank", rel: "noopener noreferrer", className: "text-blue-500 hover:text-blue-600 underline block", children: "View Transaction" })] })), invoiceStatusResponse && (_jsxs("div", { className: "bg-gray-50 p-4 rounded-md", children: [_jsx("p", { className: "font-medium", children: "Payment Details:" }), _jsx("p", { className: "text-gray-700", children: invoiceStatusResponse })] }))] }));
130
+ return (_jsxs("div", { className: "space-y-4", children: [currency && chainName && currency !== "" && chainName !== "" && (_jsx("button", { className: "bg-blue-500 text-black px-4 py-2 rounded-md hover:bg-blue-600", onClick: handleInvoiceToGnosis, disabled: isLoading, children: isLoading ? "Processing..." : "Send Payment to Gnosis >" })), error && (_jsx("div", { className: "text-red-500 bg-red-50 p-3 rounded-md", children: error })), safeTxHash && (_jsxs("div", { className: "bg-gray-50 p-4 rounded-md space-y-2", children: [_jsxs("p", { className: "font-medium", children: ["Safe Transaction Hash:", _jsx("span", { className: "font-mono text-sm ml-2 break-all", children: safeTxHash })] }), _jsx("a", { href: `https://app.safe.global/transactions/queue?safe=${urlChainName}:0x1FB6bEF04230d67aF0e3455B997a28AFcCe1F45e`, target: "_blank", rel: "noopener noreferrer", className: "text-blue-500 hover:text-blue-600 underline block", children: "View Transaction" })] })), invoiceStatusResponse && (_jsxs("div", { className: "bg-gray-50 p-4 rounded-md", children: [_jsx("p", { className: "font-medium", children: "Payment Details:" }), _jsx("p", { className: "text-gray-700", children: invoiceStatusResponse })] }))] }));
128
131
  };
129
132
  export default InvoiceToGnosis;
@@ -1 +1 @@
1
- {"version":3,"file":"lineItemTags.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/lineItemTags/lineItemTags.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAKjC,OAAO,EAAW,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAGhF,UAAU,gBAAgB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,UAAU,sBAAsB;IAC9B,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACxB,eAAe,EAAE,UAAU,EAAE,CAAC;CAC/B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,OAAO,EACP,QAAQ,EACR,eAAe,GAChB,EAAE,sBAAsB,2CA6LxB"}
1
+ {"version":3,"file":"lineItemTags.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/lineItemTags/lineItemTags.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAKjC,OAAO,EAAW,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAGhF,UAAU,gBAAgB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,UAAU,sBAAsB;IAC9B,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACxB,eAAe,EAAE,UAAU,EAAE,CAAC;CAC/B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,OAAO,EACP,QAAQ,EACR,eAAe,GAChB,EAAE,sBAAsB,2CA2LxB"}