@powerhousedao/contributor-billing 0.1.29 → 0.1.30
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/README.md +165 -8
- package/dist/document-models/billing-statement/actions.d.ts +1 -0
- package/dist/document-models/billing-statement/actions.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/document-model.js +58 -47
- package/dist/document-models/billing-statement/gen/document-schema.d.ts +38 -38
- package/dist/document-models/billing-statement/gen/document-schema.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/line-items/actions.d.ts +6 -2
- package/dist/document-models/billing-statement/gen/line-items/actions.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/line-items/creators.d.ts +3 -2
- package/dist/document-models/billing-statement/gen/line-items/creators.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/line-items/creators.js +2 -1
- package/dist/document-models/billing-statement/gen/line-items/operations.d.ts +2 -1
- package/dist/document-models/billing-statement/gen/line-items/operations.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/ph-factories.js +1 -1
- package/dist/document-models/billing-statement/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/reducer.js +5 -1
- package/dist/document-models/billing-statement/gen/schema/types.d.ts +3 -0
- package/dist/document-models/billing-statement/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/schema/zod.d.ts +2 -1
- package/dist/document-models/billing-statement/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/schema/zod.js +5 -0
- package/dist/document-models/billing-statement/gen/utils.js +2 -2
- package/dist/document-models/billing-statement/src/reducers/general.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/reducers/general.js +5 -4
- package/dist/document-models/billing-statement/src/reducers/line-items.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/reducers/line-items.js +7 -2
- package/dist/document-models/billing-statement/src/reducers/tags.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/reducers/tags.js +1 -1
- package/dist/document-models/billing-statement/src/tests/document-model.test.d.ts +4 -0
- package/dist/document-models/billing-statement/src/tests/document-model.test.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/tests/document-model.test.js +94 -7
- package/dist/document-models/billing-statement/src/tests/general.test.d.ts +2 -1
- package/dist/document-models/billing-statement/src/tests/general.test.d.ts.map +1 -1
- package/dist/document-models/billing-statement/src/tests/general.test.js +33 -88
- package/dist/document-models/billing-statement/src/tests/line-items.test.js +22 -125
- package/dist/document-models/billing-statement/src/tests/tags.test.js +13 -47
- package/dist/document-models/document-models.js +2 -2
- package/dist/document-models/expense-report/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/expense-report/gen/document-model.js +48 -48
- package/dist/document-models/expense-report/gen/document-schema.d.ts +6 -6
- package/dist/document-models/expense-report/gen/utils.js +1 -1
- package/dist/document-models/expense-report/src/tests/document-model.test.d.ts +4 -0
- package/dist/document-models/expense-report/src/tests/document-model.test.d.ts.map +1 -1
- package/dist/document-models/expense-report/src/tests/document-model.test.js +94 -8
- package/dist/document-models/expense-report/src/tests/wallet.test.js +145 -10
- package/dist/document-models/index.d.ts +2 -6
- package/dist/document-models/index.d.ts.map +1 -1
- package/dist/document-models/index.js +2 -6
- package/dist/document-models/integrations/gen/document-model.js +33 -33
- package/dist/document-models/integrations/gen/document-schema.d.ts +6 -6
- package/dist/document-models/integrations/gen/utils.js +1 -1
- package/dist/document-models/integrations/src/reducers/integrations.d.ts.map +1 -1
- package/dist/document-models/integrations/src/reducers/integrations.js +9 -32
- package/dist/document-models/integrations/src/tests/document-model.test.d.ts +4 -0
- package/dist/document-models/integrations/src/tests/document-model.test.d.ts.map +1 -1
- package/dist/document-models/integrations/src/tests/document-model.test.js +91 -5
- package/dist/document-models/integrations/src/tests/integrations.test.js +21 -46
- package/dist/document-models/invoice/gen/document-model.js +147 -147
- package/dist/document-models/invoice/gen/document-schema.d.ts +127 -127
- package/dist/document-models/invoice/gen/document-schema.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/ph-factories.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/ph-factories.js +16 -122
- package/dist/document-models/invoice/gen/schema/types.d.ts +4 -4
- package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.js +4 -4
- package/dist/document-models/invoice/gen/utils.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/utils.js +17 -123
- package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/general.js +34 -10
- package/dist/document-models/invoice/src/reducers/items.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/items.js +7 -7
- package/dist/document-models/invoice/src/reducers/parties.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/parties.js +96 -50
- package/dist/document-models/invoice/src/reducers/transitions.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/transitions.js +69 -53
- package/dist/document-models/invoice/src/tests/document-model.test.d.ts +4 -0
- package/dist/document-models/invoice/src/tests/document-model.test.d.ts.map +1 -1
- package/dist/document-models/invoice/src/tests/document-model.test.js +91 -4
- package/dist/document-models/invoice/src/tests/general.test.js +24 -26
- package/dist/document-models/invoice/src/tests/items.test.js +37 -17
- package/dist/document-models/invoice/src/tests/parties.test.js +32 -26
- package/dist/document-models/invoice/src/tests/transitions.test.js +52 -500
- package/dist/document-models/invoice/utils/statusTransitions.d.ts.map +1 -1
- package/dist/document-models/invoice/utils/statusTransitions.js +10 -10
- package/dist/editors/billing-statement/components/lineItemsTable.d.ts.map +1 -1
- package/dist/editors/billing-statement/components/lineItemsTable.js +32 -23
- package/dist/editors/billing-statement/components/objectSetTable.d.ts.map +1 -1
- package/dist/editors/billing-statement/components/objectSetTable.js +1 -2
- package/dist/editors/billing-statement/editor.d.ts +4 -0
- package/dist/editors/billing-statement/editor.d.ts.map +1 -1
- package/dist/editors/billing-statement/editor.js +34 -16
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.d.ts.map +1 -1
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.js +36 -37
- package/dist/editors/billing-statement/lineItemTags/tagMapping.d.ts.map +1 -1
- package/dist/editors/billing-statement/lineItemTags/tagMapping.js +28 -10
- package/dist/editors/clean-new-editor/components/CreateDocument.d.ts +6 -0
- package/dist/editors/clean-new-editor/components/CreateDocument.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/CreateDocument.js +18 -0
- package/dist/editors/clean-new-editor/components/DriveContents.d.ts +3 -0
- package/dist/editors/clean-new-editor/components/DriveContents.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/DriveContents.js +10 -0
- package/dist/editors/clean-new-editor/components/DriveExplorer.d.ts +7 -0
- package/dist/editors/clean-new-editor/components/DriveExplorer.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/DriveExplorer.js +16 -0
- package/dist/editors/clean-new-editor/components/EmptyState.d.ts +3 -0
- package/dist/editors/clean-new-editor/components/EmptyState.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/EmptyState.js +10 -0
- package/dist/editors/clean-new-editor/components/Files.d.ts +3 -0
- package/dist/editors/clean-new-editor/components/Files.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/Files.js +12 -0
- package/dist/editors/clean-new-editor/components/FolderTree.d.ts +6 -0
- package/dist/editors/clean-new-editor/components/FolderTree.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/FolderTree.js +65 -0
- package/dist/editors/clean-new-editor/components/Folders.d.ts +3 -0
- package/dist/editors/clean-new-editor/components/Folders.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/Folders.js +12 -0
- package/dist/editors/clean-new-editor/components/NavigationBreadcrumbs.d.ts +3 -0
- package/dist/editors/clean-new-editor/components/NavigationBreadcrumbs.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/components/NavigationBreadcrumbs.js +6 -0
- package/dist/editors/clean-new-editor/config.d.ts +4 -0
- package/dist/editors/clean-new-editor/config.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/config.js +5 -0
- package/dist/editors/clean-new-editor/editor.d.ts +4 -0
- package/dist/editors/clean-new-editor/editor.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/editor.js +11 -0
- package/dist/editors/clean-new-editor/module.d.ts +3 -0
- package/dist/editors/clean-new-editor/module.d.ts.map +1 -0
- package/dist/editors/clean-new-editor/module.js +10 -0
- package/dist/editors/contributor-billing/components/ConfirmationModal.d.ts +14 -0
- package/dist/editors/contributor-billing/components/ConfirmationModal.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/ConfirmationModal.js +6 -0
- package/dist/editors/contributor-billing/components/CreateDocument.d.ts +6 -0
- package/dist/editors/contributor-billing/components/CreateDocument.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/CreateDocument.js +18 -0
- package/dist/editors/contributor-billing/components/DriveContents.d.ts +3 -0
- package/dist/editors/contributor-billing/components/DriveContents.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/DriveContents.js +10 -0
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts +3 -3
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.js +13 -180
- package/dist/editors/contributor-billing/components/EmptyState.d.ts +3 -0
- package/dist/editors/contributor-billing/components/EmptyState.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/EmptyState.js +10 -0
- package/dist/editors/contributor-billing/components/Files.d.ts +3 -0
- package/dist/editors/contributor-billing/components/Files.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/Files.js +12 -0
- package/dist/editors/contributor-billing/components/FolderTree.d.ts +6 -0
- package/dist/editors/contributor-billing/components/FolderTree.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/FolderTree.js +65 -0
- package/dist/editors/contributor-billing/components/Folders.d.ts +3 -0
- package/dist/editors/contributor-billing/components/Folders.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/Folders.js +12 -0
- package/dist/editors/contributor-billing/components/HeaderControls.d.ts +38 -0
- package/dist/editors/contributor-billing/components/HeaderControls.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/HeaderControls.js +124 -0
- package/dist/editors/contributor-billing/components/HeaderStats.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/{InvoiceTable/HeaderStats.js → HeaderStats.js} +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable.d.ts +22 -0
- package/dist/editors/contributor-billing/components/InvoiceTable.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTable.js +399 -0
- package/dist/editors/contributor-billing/components/InvoiceTableContainer.d.ts +6 -0
- package/dist/editors/contributor-billing/components/InvoiceTableContainer.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTableContainer.js +111 -0
- package/dist/editors/contributor-billing/components/InvoiceTableRow.d.ts +32 -0
- package/dist/editors/contributor-billing/components/InvoiceTableRow.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTableRow.js +55 -0
- package/dist/editors/contributor-billing/components/InvoiceTableSection.d.ts +13 -0
- package/dist/editors/contributor-billing/components/InvoiceTableSection.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/InvoiceTableSection.js +16 -0
- package/dist/editors/contributor-billing/components/NavigationBreadcrumbs.d.ts +3 -0
- package/dist/editors/contributor-billing/components/NavigationBreadcrumbs.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/NavigationBreadcrumbs.js +6 -0
- package/dist/editors/contributor-billing/config.d.ts +1 -0
- package/dist/editors/contributor-billing/config.d.ts.map +1 -1
- package/dist/editors/contributor-billing/config.js +4 -1
- package/dist/editors/contributor-billing/editor.d.ts +1 -0
- package/dist/editors/contributor-billing/editor.d.ts.map +1 -1
- package/dist/editors/contributor-billing/editor.js +4 -1
- package/dist/editors/contributor-billing/module.d.ts +1 -1
- package/dist/editors/contributor-billing/module.d.ts.map +1 -1
- package/dist/editors/contributor-billing/module.js +3 -2
- package/dist/editors/contributor-billing/utils/exchangeRate.d.ts +15 -0
- package/dist/editors/contributor-billing/utils/exchangeRate.d.ts.map +1 -0
- package/dist/editors/contributor-billing/utils/exchangeRate.js +122 -0
- package/dist/editors/editors.js +2 -2
- package/dist/editors/expense-report/components/AddBillingStatementModal.d.ts.map +1 -1
- package/dist/editors/expense-report/editor.js +8 -8
- package/dist/editors/index.d.ts +2 -2
- package/dist/editors/index.d.ts.map +1 -1
- package/dist/editors/index.js +2 -2
- package/dist/editors/integrations/components/EditName.d.ts +3 -0
- package/dist/editors/integrations/components/EditName.d.ts.map +1 -0
- package/dist/editors/integrations/components/EditName.js +31 -0
- package/dist/editors/integrations/editor.d.ts +2 -4
- package/dist/editors/integrations/editor.d.ts.map +1 -1
- package/dist/editors/integrations/editor.js +5 -132
- package/dist/editors/integrations/module.d.ts +1 -0
- package/dist/editors/integrations/module.d.ts.map +1 -1
- package/dist/editors/integrations/module.js +3 -2
- package/dist/editors/invoice/components/confirmationModal.js +1 -1
- package/dist/editors/invoice/components/countryForm.d.ts.map +1 -1
- package/dist/editors/invoice/components/countryForm.js +1 -1
- package/dist/editors/invoice/components/currencyForm.d.ts.map +1 -1
- package/dist/editors/invoice/components/currencyForm.js +1 -1
- package/dist/editors/invoice/components/datePicker.d.ts +1 -1
- package/dist/editors/invoice/components/datePicker.d.ts.map +1 -1
- package/dist/editors/invoice/components/datePicker.js +1 -1
- package/dist/editors/invoice/components/inputField.d.ts.map +1 -1
- package/dist/editors/invoice/components/inputField.js +3 -2
- package/dist/editors/invoice/components/lineItemMobileModal.d.ts.map +1 -1
- package/dist/editors/invoice/components/lineItemMobileModal.js +1 -1
- package/dist/editors/invoice/components/numberForm.d.ts.map +1 -1
- package/dist/editors/invoice/components/selectField.js +7 -7
- package/dist/editors/invoice/components/statusModalComponents.d.ts.map +1 -1
- package/dist/editors/invoice/components/statusModalComponents.js +27 -3
- package/dist/editors/invoice/editor.d.ts +1 -4
- package/dist/editors/invoice/editor.d.ts.map +1 -1
- package/dist/editors/invoice/editor.js +102 -40
- package/dist/editors/invoice/exportUBL.d.ts.map +1 -1
- package/dist/editors/invoice/exportUBL.js +35 -18
- package/dist/editors/invoice/ingestPDF.d.ts.map +1 -1
- package/dist/editors/invoice/ingestPDF.js +15 -9
- package/dist/editors/invoice/invoiceToGnosis.js +3 -3
- package/dist/editors/invoice/legalEntity/bankSection.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/legalEntity.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/walletSection.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/walletSection.js +3 -3
- package/dist/editors/invoice/lineItemTags/lineItemTags.d.ts.map +1 -1
- package/dist/editors/invoice/lineItemTags/lineItemTags.js +1 -1
- package/dist/editors/invoice/lineItemTags/tagMobileModal.d.ts.map +1 -1
- package/dist/editors/invoice/lineItemTags/tagMobileModal.js +4 -3
- package/dist/editors/invoice/lineItems.d.ts.map +1 -1
- package/dist/editors/invoice/module.d.ts +1 -0
- package/dist/editors/invoice/module.d.ts.map +1 -1
- package/dist/editors/invoice/module.js +2 -1
- package/dist/editors/invoice/requestFinance.js +4 -4
- package/dist/editors/invoice/uploadPdfChunked.d.ts.map +1 -1
- package/dist/editors/invoice/uploadPdfChunked.js +5 -4
- package/dist/editors/invoice/utils/utils.d.ts.map +1 -1
- package/dist/editors/invoice/utils/utils.js +5 -4
- package/dist/editors/invoice/validation/validationHandler.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationHandler.js +11 -5
- package/dist/editors/invoice/validation/validationManager.d.ts +2 -2
- package/dist/editors/invoice/validation/validationManager.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationManager.js +5 -5
- package/dist/editors/invoice/validation/validationRules.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationRules.js +178 -178
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/old-contributor-billing/components/DriveExplorer.d.ts +7 -0
- package/dist/old-contributor-billing/components/DriveExplorer.d.ts.map +1 -0
- package/dist/old-contributor-billing/components/DriveExplorer.js +184 -0
- package/dist/old-contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -0
- package/dist/old-contributor-billing/components/InvoiceTable/HeaderStats.d.ts +2 -0
- package/dist/old-contributor-billing/components/InvoiceTable/HeaderStats.d.ts.map +1 -0
- package/dist/old-contributor-billing/components/InvoiceTable/HeaderStats.js +73 -0
- package/dist/old-contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -0
- package/dist/old-contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -0
- package/dist/old-contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts.map +1 -0
- package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTableSection.js +1 -1
- package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/RowActionMenu.d.ts +1 -1
- package/dist/old-contributor-billing/components/InvoiceTable/RowActionMenu.d.ts.map +1 -0
- package/dist/old-contributor-billing/components/InvoiceTable/RowActionMenu.js +2 -0
- package/dist/old-contributor-billing/config.d.ts +3 -0
- package/dist/old-contributor-billing/config.d.ts.map +1 -0
- package/dist/old-contributor-billing/config.js +4 -0
- package/dist/old-contributor-billing/editor.d.ts +3 -0
- package/dist/old-contributor-billing/editor.d.ts.map +1 -0
- package/dist/old-contributor-billing/editor.js +8 -0
- package/dist/old-contributor-billing/module.d.ts +3 -0
- package/dist/old-contributor-billing/module.d.ts.map +1 -0
- package/dist/old-contributor-billing/module.js +9 -0
- package/dist/old-contributor-billing/util.d.ts.map +1 -0
- package/dist/{editors/contributor-billing → old-contributor-billing}/util.js +11 -9
- package/dist/powerhouse.manifest.json +6 -41
- package/dist/processors/index.d.ts +1 -6
- package/dist/processors/index.d.ts.map +1 -1
- package/dist/processors/index.js +1 -18
- package/dist/scripts/contributor-billing/createExpenseReportCsv.d.ts.map +1 -1
- package/dist/scripts/contributor-billing/createExpenseReportCsv.js +24 -24
- package/dist/scripts/contributor-billing/createXeroCsv.d.ts.map +1 -1
- package/dist/scripts/contributor-billing/createXeroCsv.js +52 -46
- package/dist/scripts/invoice/autoTagging.d.ts +1 -1
- package/dist/scripts/invoice/autoTagging.d.ts.map +1 -1
- package/dist/scripts/invoice/autoTagging.js +168 -138
- package/dist/scripts/invoice/exampleBatchTxn.js +16 -16
- package/dist/scripts/invoice/gnosisTransactionBuilder.d.ts.map +1 -1
- package/dist/scripts/invoice/gnosisTransactionBuilder.js +32 -25
- package/dist/scripts/invoice/pdfToClaudeAI.d.ts.map +1 -1
- package/dist/scripts/invoice/pdfToClaudeAI.js +36 -30
- package/dist/scripts/invoice/requestFinance.d.ts.map +1 -1
- package/dist/scripts/invoice/requestFinance.js +13 -13
- package/dist/style.css +407 -13659
- package/dist/subgraphs/billing-statement/resolvers.d.ts +1 -1
- package/dist/subgraphs/billing-statement/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/billing-statement/resolvers.js +16 -5
- package/dist/subgraphs/billing-statement/schema.d.ts.map +1 -1
- package/dist/subgraphs/billing-statement/schema.js +12 -67
- package/dist/subgraphs/expense-report/resolvers.d.ts +1 -1
- package/dist/subgraphs/expense-report/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/expense-report/resolvers.js +4 -5
- package/dist/subgraphs/expense-report/schema.d.ts.map +1 -1
- package/dist/subgraphs/expense-report/schema.js +5 -48
- package/dist/subgraphs/index.d.ts +1 -0
- package/dist/subgraphs/index.d.ts.map +1 -1
- package/dist/subgraphs/index.js +1 -0
- package/dist/subgraphs/integrations/resolvers.d.ts +1 -1
- package/dist/subgraphs/integrations/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/integrations/resolvers.js +4 -5
- package/dist/subgraphs/integrations/schema.d.ts.map +1 -1
- package/dist/subgraphs/integrations/schema.js +3 -43
- package/dist/subgraphs/invoice/index.d.ts.map +1 -1
- package/dist/subgraphs/invoice/index.js +1 -20
- package/dist/subgraphs/invoice/resolvers.d.ts +1 -1
- package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/invoice/resolvers.js +4 -9
- package/dist/subgraphs/invoice/schema.d.ts.map +1 -1
- package/dist/subgraphs/invoice/schema.js +14 -232
- package/dist/subgraphs/{invoice → invoice-addon}/customResolvers.d.ts +1 -1
- package/dist/subgraphs/invoice-addon/customResolvers.d.ts.map +1 -0
- package/dist/subgraphs/{invoice → invoice-addon}/customResolvers.js +38 -34
- package/dist/subgraphs/invoice-addon/index.d.ts +11 -0
- package/dist/subgraphs/invoice-addon/index.d.ts.map +1 -0
- package/dist/subgraphs/invoice-addon/index.js +11 -0
- package/dist/subgraphs/invoice-addon/resolvers.d.ts +3 -0
- package/dist/subgraphs/invoice-addon/resolvers.d.ts.map +1 -0
- package/dist/subgraphs/invoice-addon/resolvers.js +12 -0
- package/dist/subgraphs/invoice-addon/schema.d.ts +3 -0
- package/dist/subgraphs/invoice-addon/schema.d.ts.map +1 -0
- package/dist/subgraphs/invoice-addon/schema.js +52 -0
- package/package.json +9 -20
- package/dist/document-models/expense-report/gen/expense-report/actions.d.ts +0 -8
- package/dist/document-models/expense-report/gen/expense-report/actions.d.ts.map +0 -1
- package/dist/document-models/expense-report/gen/expense-report/actions.js +0 -1
- package/dist/document-models/expense-report/gen/expense-report/creators.d.ts +0 -4
- package/dist/document-models/expense-report/gen/expense-report/creators.d.ts.map +0 -1
- package/dist/document-models/expense-report/gen/expense-report/creators.js +0 -3
- package/dist/document-models/expense-report/gen/expense-report/error.d.ts +0 -2
- package/dist/document-models/expense-report/gen/expense-report/error.d.ts.map +0 -1
- package/dist/document-models/expense-report/gen/expense-report/error.js +0 -1
- package/dist/document-models/expense-report/gen/expense-report/operations.d.ts +0 -7
- package/dist/document-models/expense-report/gen/expense-report/operations.d.ts.map +0 -1
- package/dist/document-models/expense-report/gen/expense-report/operations.js +0 -3
- package/dist/document-models/expense-report/src/tests/expense-report.test.d.ts +0 -6
- package/dist/document-models/expense-report/src/tests/expense-report.test.d.ts.map +0 -1
- package/dist/document-models/expense-report/src/tests/expense-report.test.js +0 -24
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderStats.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.js +0 -2
- package/dist/editors/contributor-billing/util.d.ts.map +0 -1
- package/dist/editors/hooks/useBillingStatementDocument.d.ts +0 -4
- package/dist/editors/hooks/useBillingStatementDocument.d.ts.map +0 -1
- package/dist/editors/hooks/useBillingStatementDocument.js +0 -8
- package/dist/editors/hooks/useExpenseReportDocument.d.ts +0 -4
- package/dist/editors/hooks/useExpenseReportDocument.d.ts.map +0 -1
- package/dist/editors/hooks/useExpenseReportDocument.js +0 -8
- package/dist/editors/hooks/useIntegrationsDocument.d.ts +0 -4
- package/dist/editors/hooks/useIntegrationsDocument.d.ts.map +0 -1
- package/dist/editors/hooks/useIntegrationsDocument.js +0 -8
- package/dist/editors/hooks/useInvoiceDocument.d.ts +0 -4
- package/dist/editors/hooks/useInvoiceDocument.d.ts.map +0 -1
- package/dist/editors/hooks/useInvoiceDocument.js +0 -8
- package/dist/editors/integrations/config.d.ts +0 -3
- package/dist/editors/integrations/config.d.ts.map +0 -1
- package/dist/editors/integrations/config.js +0 -3
- package/dist/editors/invoice/exportSAFTPT.d.ts +0 -184
- package/dist/editors/invoice/exportSAFTPT.d.ts.map +0 -1
- package/dist/editors/invoice/exportSAFTPT.js +0 -548
- package/dist/processors/line-item-processor/index.d.ts +0 -11
- package/dist/processors/line-item-processor/index.d.ts.map +0 -1
- package/dist/processors/line-item-processor/index.js +0 -36
- package/dist/subgraphs/invoice/customResolvers.d.ts.map +0 -1
- package/editors/invoice/assets/custom.d.ts +0 -4
- package/editors/invoice/assets/powerhouseLogo.png +0 -0
- /package/dist/editors/contributor-billing/components/{InvoiceTable/HeaderStats.d.ts → HeaderStats.d.ts} +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/HeaderControls.d.ts +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/HeaderControls.js +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTable.d.ts +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTable.js +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTableRow.d.ts +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTableRow.js +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTableSection.d.ts +0 -0
- /package/dist/{editors/contributor-billing → old-contributor-billing}/util.d.ts +0 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback, useRef } from "react";
|
|
3
|
+
import { useNodesInSelectedDriveOrFolder, isFileNodeKind, useDocumentModelModules, showCreateDocumentModal, useDocumentsInSelectedDrive, useOnDropFile, } from "@powerhousedao/reactor-browser";
|
|
4
|
+
import { InvoiceTable } from "./InvoiceTable.js";
|
|
5
|
+
/**
|
|
6
|
+
* Container that renders the InvoiceTable.
|
|
7
|
+
* Uses useNodesInSelectedDriveOrFolder pattern to avoid freeze issues.
|
|
8
|
+
*/
|
|
9
|
+
export function InvoiceTableContainer() {
|
|
10
|
+
const [selected, setSelected] = useState({});
|
|
11
|
+
const [selectedStatuses, setSelectedStatuses] = useState([]);
|
|
12
|
+
const containerRef = useRef(null);
|
|
13
|
+
const pendingFilesRef = useRef(new Set());
|
|
14
|
+
const documentModelModules = useDocumentModelModules();
|
|
15
|
+
// Use the simple pattern - just nodes, no document fetching
|
|
16
|
+
const nodes = useNodesInSelectedDriveOrFolder();
|
|
17
|
+
const fileNodes = nodes.filter((n) => isFileNodeKind(n));
|
|
18
|
+
const allDocuments = useDocumentsInSelectedDrive();
|
|
19
|
+
// Get the drop file handler
|
|
20
|
+
const onDropFile = useOnDropFile();
|
|
21
|
+
// Handle file drop
|
|
22
|
+
const handleDrop = useCallback(async (event) => {
|
|
23
|
+
event.preventDefault();
|
|
24
|
+
event.stopPropagation();
|
|
25
|
+
const files = Array.from(event.dataTransfer.files);
|
|
26
|
+
if (files.length === 0)
|
|
27
|
+
return;
|
|
28
|
+
if (!onDropFile)
|
|
29
|
+
return;
|
|
30
|
+
// Track all files being processed
|
|
31
|
+
files.forEach((file) => pendingFilesRef.current.add(file));
|
|
32
|
+
// Process all files
|
|
33
|
+
const filePromises = files.map(async (file) => {
|
|
34
|
+
try {
|
|
35
|
+
await onDropFile(file, (progress) => {
|
|
36
|
+
// Handle progress updates if needed
|
|
37
|
+
if (progress.stage === "complete" || progress.stage === "failed") {
|
|
38
|
+
pendingFilesRef.current.delete(file);
|
|
39
|
+
// If all files are done, reload the page
|
|
40
|
+
if (pendingFilesRef.current.size === 0) {
|
|
41
|
+
window.location.reload();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
console.error("Error dropping file:", error);
|
|
48
|
+
pendingFilesRef.current.delete(file);
|
|
49
|
+
// If all files are done (including failed ones), reload
|
|
50
|
+
if (pendingFilesRef.current.size === 0) {
|
|
51
|
+
window.location.reload();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
// Wait for all files to complete
|
|
56
|
+
await Promise.allSettled(filePromises);
|
|
57
|
+
// Final check - reload if all files are done
|
|
58
|
+
if (pendingFilesRef.current.size === 0) {
|
|
59
|
+
window.location.reload();
|
|
60
|
+
}
|
|
61
|
+
}, [onDropFile]);
|
|
62
|
+
const handleDragOver = useCallback((event) => {
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
event.stopPropagation();
|
|
65
|
+
event.dataTransfer.dropEffect = "copy";
|
|
66
|
+
}, []);
|
|
67
|
+
const handleDragEnter = useCallback((event) => {
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
event.stopPropagation();
|
|
70
|
+
}, []);
|
|
71
|
+
// Handler for status filter changes
|
|
72
|
+
const handleStatusChange = useCallback((value) => {
|
|
73
|
+
setSelectedStatuses(Array.isArray(value) ? value : [value]);
|
|
74
|
+
}, []);
|
|
75
|
+
// Handler for row selection
|
|
76
|
+
const handleRowSelection = useCallback((rowId, checked, _rowStatus) => {
|
|
77
|
+
setSelected((prev) => ({
|
|
78
|
+
...prev,
|
|
79
|
+
[rowId]: checked,
|
|
80
|
+
}));
|
|
81
|
+
}, []);
|
|
82
|
+
// Stub for getDocDispatcher - requires documents to work properly
|
|
83
|
+
const getDocDispatcher = useCallback((_id) => {
|
|
84
|
+
return null;
|
|
85
|
+
}, []);
|
|
86
|
+
// Handle document model selection for create modal
|
|
87
|
+
const onSelectDocumentModel = useCallback((documentModel) => {
|
|
88
|
+
showCreateDocumentModal(documentModel.id);
|
|
89
|
+
}, []);
|
|
90
|
+
// Determine if CSV export should be enabled based on selected rows
|
|
91
|
+
const canExportSelectedRows = useCallback(() => {
|
|
92
|
+
const allowedStatuses = [
|
|
93
|
+
"ACCEPTED",
|
|
94
|
+
"AWAITINGPAYMENT",
|
|
95
|
+
"PAYMENTSCHEDULED",
|
|
96
|
+
"PAYMENTSENT",
|
|
97
|
+
"PAYMENTRECEIVED",
|
|
98
|
+
"PAYMENTCLOSED",
|
|
99
|
+
];
|
|
100
|
+
// Get all selected row IDs
|
|
101
|
+
const selectedRowIds = Object.keys(selected).filter((id) => selected[id]);
|
|
102
|
+
if (selectedRowIds.length === 0)
|
|
103
|
+
return false;
|
|
104
|
+
// Check if all selected rows have allowed statuses
|
|
105
|
+
const selectedRows = allDocuments?.filter((doc) => selectedRowIds.includes(doc.header.id)) ||
|
|
106
|
+
[];
|
|
107
|
+
return selectedRows.every((row) => allowedStatuses.includes(row.state.global
|
|
108
|
+
.status));
|
|
109
|
+
}, [selected, allDocuments]);
|
|
110
|
+
return (_jsx("div", { ref: containerRef, className: "w-full h-full", onDrop: handleDrop, onDragOver: handleDragOver, onDragEnter: handleDragEnter, children: _jsx(InvoiceTable, { files: fileNodes, selected: selected, setSelected: setSelected, filteredDocumentModels: documentModelModules || [], onSelectDocumentModel: onSelectDocumentModel, getDocDispatcher: getDocDispatcher, selectedStatuses: selectedStatuses, onStatusChange: handleStatusChange, onRowSelection: handleRowSelection, canExportSelectedRows: canExportSelectedRows }) }));
|
|
111
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { FileNode } from "document-drive";
|
|
2
|
+
export interface InvoiceRowData {
|
|
3
|
+
id: string;
|
|
4
|
+
issuer?: string;
|
|
5
|
+
status: string;
|
|
6
|
+
invoiceNo?: string;
|
|
7
|
+
issueDate?: string;
|
|
8
|
+
dueDate?: string;
|
|
9
|
+
currency?: string;
|
|
10
|
+
amount?: string;
|
|
11
|
+
exported?: {
|
|
12
|
+
timestamp?: string;
|
|
13
|
+
exportedLineItems?: unknown[];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface BillingDocState {
|
|
17
|
+
id: string;
|
|
18
|
+
contributor: string;
|
|
19
|
+
}
|
|
20
|
+
interface InvoiceTableRowProps {
|
|
21
|
+
files?: FileNode[];
|
|
22
|
+
row: InvoiceRowData;
|
|
23
|
+
isSelected: boolean;
|
|
24
|
+
onSelect: (checked: boolean) => void;
|
|
25
|
+
onCreateBillingStatement?: (id: string) => void;
|
|
26
|
+
billingDocStates?: BillingDocState[];
|
|
27
|
+
showIssuerColumn?: boolean;
|
|
28
|
+
showBillingStatementColumn?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare const InvoiceTableRow: ({ files, row, isSelected, onSelect, onCreateBillingStatement, billingDocStates, showIssuerColumn, showBillingStatementColumn, }: InvoiceTableRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=InvoiceTableRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvoiceTableRow.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/InvoiceTableRow.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE;QACT,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,iBAAiB,CAAC,EAAE,OAAO,EAAE,CAAC;KAC/B,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,oBAAoB;IAC5B,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,GAAG,EAAE,cAAc,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,wBAAwB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC;AAoCD,eAAO,MAAM,eAAe,GAAI,iIAS7B,oBAAoB,4CA2GtB,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FileItem } from "@powerhousedao/design-system/connect";
|
|
3
|
+
const formatTimestamp = (timestamp) => {
|
|
4
|
+
const date = new Date(timestamp);
|
|
5
|
+
const day = date.getDate().toString().padStart(2, "0");
|
|
6
|
+
const monthNames = [
|
|
7
|
+
"Jan",
|
|
8
|
+
"Feb",
|
|
9
|
+
"Mar",
|
|
10
|
+
"Apr",
|
|
11
|
+
"May",
|
|
12
|
+
"Jun",
|
|
13
|
+
"Jul",
|
|
14
|
+
"Aug",
|
|
15
|
+
"Sep",
|
|
16
|
+
"Oct",
|
|
17
|
+
"Nov",
|
|
18
|
+
"Dec",
|
|
19
|
+
];
|
|
20
|
+
const month = monthNames[date.getMonth()];
|
|
21
|
+
const year = date.getFullYear();
|
|
22
|
+
const hours = date.getHours().toString().padStart(2, "0");
|
|
23
|
+
const minutes = date.getMinutes().toString().padStart(2, "0");
|
|
24
|
+
return `${day}-${month}-${year} ${hours}:${minutes}`;
|
|
25
|
+
};
|
|
26
|
+
const formatAmount = (amount) => {
|
|
27
|
+
if (amount === undefined)
|
|
28
|
+
return "0.00";
|
|
29
|
+
const numAmount = typeof amount === "string" ? parseFloat(amount) : amount;
|
|
30
|
+
if (isNaN(numAmount))
|
|
31
|
+
return "0.00";
|
|
32
|
+
return numAmount.toLocaleString("en-US", {
|
|
33
|
+
minimumFractionDigits: 2,
|
|
34
|
+
maximumFractionDigits: 2,
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
export const InvoiceTableRow = ({ files, row, isSelected, onSelect, onCreateBillingStatement, billingDocStates, showIssuerColumn = true, showBillingStatementColumn = false, }) => {
|
|
38
|
+
// Simple computed values like old working code
|
|
39
|
+
const billingDoc = billingDocStates?.find((doc) => doc.contributor === row.id);
|
|
40
|
+
const billingFile = files?.find((file) => file.id === billingDoc?.id);
|
|
41
|
+
const invoiceFile = files?.find((file) => file.id === row.id);
|
|
42
|
+
const hasExportedData = row.exported != null && Boolean(row.exported.timestamp?.trim());
|
|
43
|
+
// Check if button should be shown
|
|
44
|
+
const allowedStatuses = [
|
|
45
|
+
"ISSUED",
|
|
46
|
+
"ACCEPTED",
|
|
47
|
+
"PAYMENTSCHEDULED",
|
|
48
|
+
"PAYMENTRECEIVED",
|
|
49
|
+
"PAYMENTSENT",
|
|
50
|
+
];
|
|
51
|
+
const canShowBillingStatementButton = showBillingStatementColumn &&
|
|
52
|
+
allowedStatuses.includes(row.status) &&
|
|
53
|
+
!billingFile;
|
|
54
|
+
return (_jsxs("tr", { className: "hover:bg-gray-50 transition-colors", children: [_jsx("td", { className: "px-2 py-2", children: _jsx("input", { type: "checkbox", checked: isSelected, onChange: (e) => onSelect(e.target.checked), className: "w-4 h-4 rounded border-gray-300 text-blue-600 focus:ring-2 focus:ring-blue-500" }) }), _jsx("td", { className: "py-1 px-2", children: showIssuerColumn ? (invoiceFile ? (_jsx(FileItem, { fileNode: invoiceFile, className: "h-10" })) : (_jsx("span", { className: "text-gray-500", children: row.issuer || "Unknown" }))) : invoiceFile ? (_jsx(FileItem, { fileNode: invoiceFile, className: "h-10" })) : (_jsx("span", { className: "text-gray-400", children: "-" })) }), _jsx("td", { className: "px-2 py-2 text-center text-sm text-gray-700", children: row.invoiceNo || "-" }), _jsx("td", { className: "px-2 py-2 text-center text-sm text-gray-700", children: row.issueDate ? new Date(row.issueDate).toLocaleDateString() : "-" }), _jsx("td", { className: "px-2 py-2 text-center text-sm text-gray-700", children: row.dueDate ? new Date(row.dueDate).toLocaleDateString() : "-" }), _jsx("td", { className: "px-2 py-2 text-center text-sm text-gray-700", children: row.currency || "-" }), _jsx("td", { className: "px-2 py-2 text-center text-sm font-medium text-gray-800", children: formatAmount(row.amount) }), showBillingStatementColumn && (_jsx("td", { className: "px-2 py-2 text-center", children: canShowBillingStatementButton ? (_jsx("button", { type: "button", className: "bg-white border border-gray-300 rounded px-3 py-1 text-xs font-medium hover:bg-gray-50 transition-colors", onClick: () => onCreateBillingStatement?.(row.id), children: "Generate Billing Statement" })) : billingFile ? (_jsx(FileItem, { fileNode: billingFile, className: "h-10" })) : null })), _jsx("td", { className: "px-2 py-2 text-center", children: hasExportedData ? (_jsxs("div", { className: "flex flex-col items-center", children: [_jsx("span", { className: "text-green-600 text-sm font-medium", children: "Yes" }), _jsx("span", { className: "text-green-600 text-xs", children: formatTimestamp(row.exported.timestamp) })] })) : (_jsx("span", { className: "text-red-500 text-sm", children: "No" })) })] }));
|
|
55
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { VetraDocumentModelModule } from "@powerhousedao/reactor-browser";
|
|
2
|
+
interface InvoiceTableSectionProps {
|
|
3
|
+
title: string;
|
|
4
|
+
count: number;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
color?: string;
|
|
7
|
+
onSelectDocumentModel?: (model: VetraDocumentModelModule) => void;
|
|
8
|
+
filteredDocumentModels?: VetraDocumentModelModule[];
|
|
9
|
+
defaultExpanded?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const InvoiceTableSection: ({ title, count, children, color, onSelectDocumentModel, filteredDocumentModels, defaultExpanded, }: InvoiceTableSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=InvoiceTableSection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvoiceTableSection.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/InvoiceTableSection.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE/E,UAAU,wBAAwB;IAChC,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,wBAAwB,KAAK,IAAI,CAAC;IAClE,sBAAsB,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACpD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,mBAAmB,GAAI,oGAQjC,wBAAwB,4CAoD1B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback } from "react";
|
|
3
|
+
import { ChevronDown, ChevronRight } from "lucide-react";
|
|
4
|
+
export const InvoiceTableSection = ({ title, count, children, color = "bg-blue-100 text-blue-600", onSelectDocumentModel, filteredDocumentModels, defaultExpanded = true, }) => {
|
|
5
|
+
const [isExpanded, setIsExpanded] = useState(defaultExpanded);
|
|
6
|
+
const invoiceDocModel = filteredDocumentModels?.find((model) => model.id === "powerhouse/invoice");
|
|
7
|
+
const handleToggle = useCallback(() => {
|
|
8
|
+
setIsExpanded((prev) => !prev);
|
|
9
|
+
}, []);
|
|
10
|
+
const handleCreateInvoice = useCallback(() => {
|
|
11
|
+
if (invoiceDocModel) {
|
|
12
|
+
onSelectDocumentModel?.(invoiceDocModel);
|
|
13
|
+
}
|
|
14
|
+
}, [invoiceDocModel, onSelectDocumentModel]);
|
|
15
|
+
return (_jsxs("div", { className: "contributor-billing-section mb-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("button", { type: "button", onClick: handleToggle, className: "flex items-center gap-2 hover:opacity-80 transition-opacity py-1", children: [_jsx("span", { className: "font-medium text-gray-800", children: title }), _jsx("span", { className: `inline-flex items-center justify-center rounded-full text-xs font-semibold px-2 py-0.5 min-w-[24px] ${color}`, children: count }), isExpanded ? (_jsx(ChevronDown, { className: "w-4 h-4 text-gray-600" })) : (_jsx(ChevronRight, { className: "w-4 h-4 text-gray-600" }))] }), title === "Draft" && invoiceDocModel && (_jsx("button", { type: "button", className: "bg-white border border-gray-300 rounded px-3 py-1 text-sm font-medium hover:bg-gray-50 transition-colors", onClick: handleCreateInvoice, children: "Create Invoice" }))] }), isExpanded && _jsx("div", { className: "mt-2", children: children })] }));
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationBreadcrumbs.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/NavigationBreadcrumbs.tsx"],"names":[],"mappings":"AAEA,wEAAwE;AACxE,wBAAgB,qBAAqB,4CAMpC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Breadcrumbs } from "@powerhousedao/design-system/connect";
|
|
3
|
+
/** Shows the navigation breadcrumbs for the selected drive or folder */
|
|
4
|
+
export function NavigationBreadcrumbs() {
|
|
5
|
+
return (_jsx("div", { className: "border-b border-gray-200 pb-3 space-y-3", children: _jsx(Breadcrumbs, {}) }));
|
|
6
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../editors/contributor-billing/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,eAAO,MAAM,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../editors/contributor-billing/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,+CAA+C;AAC/C,eAAO,MAAM,YAAY,EAAE,mBAQ1B,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
/** Editor config for the ContributorBilling */
|
|
1
2
|
export const editorConfig = {
|
|
3
|
+
isDragAndDropEnabled: true,
|
|
2
4
|
allowedDocumentTypes: [
|
|
3
5
|
"powerhouse/invoice",
|
|
4
6
|
"powerhouse/billing-statement",
|
|
7
|
+
"powerhouse/expense-report",
|
|
8
|
+
"powerhouse/integrations",
|
|
5
9
|
],
|
|
6
|
-
isDragAndDropEnabled: true,
|
|
7
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/contributor-billing/editor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/contributor-billing/editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,+DAA+D;AAC/D,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW,2CAKhD"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { DriveExplorer } from "./components/DriveExplorer.js";
|
|
3
2
|
import { useSetPHDriveEditorConfig } from "@powerhousedao/reactor-browser";
|
|
3
|
+
import { DriveExplorer } from "./components/DriveExplorer.js";
|
|
4
4
|
import { editorConfig } from "./config.js";
|
|
5
|
+
/** Editor component for the ContributorBilling drive editor */
|
|
5
6
|
export default function Editor(props) {
|
|
7
|
+
// set the config for this drive editor
|
|
8
|
+
// you can update these configs in `./config.ts`
|
|
6
9
|
useSetPHDriveEditorConfig(editorConfig);
|
|
7
10
|
return _jsx(DriveExplorer, { ...props });
|
|
8
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../editors/contributor-billing/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../editors/contributor-billing/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,eAAO,MAAM,kBAAkB,EAAE,YAOhC,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import {} from "document-model";
|
|
1
2
|
import { lazy } from "react";
|
|
2
3
|
export const ContributorBilling = {
|
|
3
4
|
Component: lazy(() => import("./editor.js")),
|
|
4
5
|
documentTypes: ["powerhouse/document-drive"],
|
|
5
6
|
config: {
|
|
6
|
-
id: "contributor-billing",
|
|
7
|
-
name: "
|
|
7
|
+
id: "contributor-billing-editor",
|
|
8
|
+
name: "contributor-billing",
|
|
8
9
|
},
|
|
9
10
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetches the exchange rate between two currencies using ExchangeRate-API.
|
|
3
|
+
* Supports both fiat and crypto currencies.
|
|
4
|
+
* @param fromCurrency - The currency code to convert from (e.g., 'USD', 'DAI').
|
|
5
|
+
* @param toCurrency - The currency code to convert to (e.g., 'EUR', 'USDS').
|
|
6
|
+
* @param amount - The amount to convert (optional, used for validation).
|
|
7
|
+
* @returns The exchange rate from fromCurrency to toCurrency.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getExchangeRate: (fromCurrency: string, toCurrency: string, amount?: number) => Promise<number>;
|
|
10
|
+
/** Currency list for selectors */
|
|
11
|
+
export declare const currencyList: {
|
|
12
|
+
ticker: string;
|
|
13
|
+
crypto: boolean;
|
|
14
|
+
}[];
|
|
15
|
+
//# sourceMappingURL=exchangeRate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exchangeRate.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/utils/exchangeRate.ts"],"names":[],"mappings":"AAoBA;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAC1B,cAAc,MAAM,EACpB,YAAY,MAAM,EAClB,SAAS,MAAM,KACd,OAAO,CAAC,MAAM,CAyHhB,CAAC;AAEF,kCAAkC;AAClC,eAAO,MAAM,YAAY;;;GAWxB,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// Cache for exchange rates to avoid repeated API calls
|
|
2
|
+
const exchangeRateCache = {};
|
|
3
|
+
/**
|
|
4
|
+
* Validates if an amount should trigger an exchange rate fetch
|
|
5
|
+
*/
|
|
6
|
+
const isValidAmount = (amount) => {
|
|
7
|
+
if (amount === undefined)
|
|
8
|
+
return false;
|
|
9
|
+
return !isNaN(amount) && amount > 0;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Fetches the exchange rate between two currencies using ExchangeRate-API.
|
|
13
|
+
* Supports both fiat and crypto currencies.
|
|
14
|
+
* @param fromCurrency - The currency code to convert from (e.g., 'USD', 'DAI').
|
|
15
|
+
* @param toCurrency - The currency code to convert to (e.g., 'EUR', 'USDS').
|
|
16
|
+
* @param amount - The amount to convert (optional, used for validation).
|
|
17
|
+
* @returns The exchange rate from fromCurrency to toCurrency.
|
|
18
|
+
*/
|
|
19
|
+
export const getExchangeRate = async (fromCurrency, toCurrency, amount) => {
|
|
20
|
+
// Normalize inputs
|
|
21
|
+
const base = (fromCurrency || "").trim().toUpperCase();
|
|
22
|
+
const quote = (toCurrency || "").trim().toUpperCase();
|
|
23
|
+
// Guard empty currencies
|
|
24
|
+
if (!base || !quote) {
|
|
25
|
+
return 1;
|
|
26
|
+
}
|
|
27
|
+
// Return 1 if currencies are the same
|
|
28
|
+
if (base === quote) {
|
|
29
|
+
return 1;
|
|
30
|
+
}
|
|
31
|
+
// Skip API call if amount is explicitly provided and invalid
|
|
32
|
+
if (amount !== undefined && !isValidAmount(amount)) {
|
|
33
|
+
return 1;
|
|
34
|
+
}
|
|
35
|
+
// Create cache key
|
|
36
|
+
const cacheKey = `${base}_${quote}`;
|
|
37
|
+
// Return cached rate if available
|
|
38
|
+
const cachedRate = exchangeRateCache[cacheKey];
|
|
39
|
+
if (cachedRate !== undefined) {
|
|
40
|
+
return cachedRate;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
// Use a CORS-friendly endpoint that does not redirect
|
|
44
|
+
const controller = new AbortController();
|
|
45
|
+
const timeoutId = setTimeout(() => controller.abort(), 10000);
|
|
46
|
+
const response = await fetch(`https://open.er-api.com/v6/latest/${base}`, {
|
|
47
|
+
signal: controller.signal,
|
|
48
|
+
});
|
|
49
|
+
clearTimeout(timeoutId);
|
|
50
|
+
if (!response.ok) {
|
|
51
|
+
throw new Error(`Failed to fetch exchange rates: ${response.status}`);
|
|
52
|
+
}
|
|
53
|
+
const data = (await response.json());
|
|
54
|
+
if (!data.rates || !data.rates[quote]) {
|
|
55
|
+
throw new Error(`Exchange rate not found for ${base} to ${quote}`);
|
|
56
|
+
}
|
|
57
|
+
const exchangeRate = data.rates[quote];
|
|
58
|
+
// Cache the result
|
|
59
|
+
exchangeRateCache[cacheKey] = exchangeRate;
|
|
60
|
+
return exchangeRate;
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
console.error("ExchangeRate-API error:", error);
|
|
64
|
+
// Fallback: try CoinGecko for crypto currencies
|
|
65
|
+
if (["USDS", "DAI"].includes(base) || ["USDS", "DAI"].includes(quote)) {
|
|
66
|
+
try {
|
|
67
|
+
const cryptoMapping = {
|
|
68
|
+
USDS: "usd-coin",
|
|
69
|
+
DAI: "dai",
|
|
70
|
+
};
|
|
71
|
+
const fromMapped = cryptoMapping[base] || base.toLowerCase();
|
|
72
|
+
const toMapped = cryptoMapping[quote] || quote.toLowerCase();
|
|
73
|
+
if (cryptoMapping[base]) {
|
|
74
|
+
const cryptoController = new AbortController();
|
|
75
|
+
const cryptoTimeoutId = setTimeout(() => cryptoController.abort(), 8000);
|
|
76
|
+
const response = await fetch(`https://api.coingecko.com/api/v3/simple/price?ids=${fromMapped}&vs_currencies=${toMapped}`, { signal: cryptoController.signal });
|
|
77
|
+
clearTimeout(cryptoTimeoutId);
|
|
78
|
+
if (response.ok) {
|
|
79
|
+
const data = (await response.json());
|
|
80
|
+
const rate = data[fromMapped]?.[toMapped];
|
|
81
|
+
if (rate) {
|
|
82
|
+
exchangeRateCache[cacheKey] = rate;
|
|
83
|
+
return rate;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else if (cryptoMapping[quote]) {
|
|
88
|
+
const cryptoController2 = new AbortController();
|
|
89
|
+
const cryptoTimeoutId2 = setTimeout(() => cryptoController2.abort(), 8000);
|
|
90
|
+
const response = await fetch(`https://api.coingecko.com/api/v3/simple/price?ids=${toMapped}&vs_currencies=${fromMapped}`, { signal: cryptoController2.signal });
|
|
91
|
+
clearTimeout(cryptoTimeoutId2);
|
|
92
|
+
if (response.ok) {
|
|
93
|
+
const data = (await response.json());
|
|
94
|
+
const rate = data[toMapped]?.[fromMapped];
|
|
95
|
+
if (rate) {
|
|
96
|
+
const invertedRate = 1 / rate;
|
|
97
|
+
exchangeRateCache[cacheKey] = invertedRate;
|
|
98
|
+
return invertedRate;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch (cryptoError) {
|
|
104
|
+
console.error("Crypto fallback error:", cryptoError);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return 1; // Final fallback to 1:1 on error
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
/** Currency list for selectors */
|
|
111
|
+
export const currencyList = [
|
|
112
|
+
{ ticker: "USDS", crypto: true },
|
|
113
|
+
{ ticker: "USDC", crypto: true },
|
|
114
|
+
{ ticker: "DAI", crypto: true },
|
|
115
|
+
{ ticker: "USD", crypto: false },
|
|
116
|
+
{ ticker: "EUR", crypto: false },
|
|
117
|
+
{ ticker: "DKK", crypto: false },
|
|
118
|
+
{ ticker: "GBP", crypto: false },
|
|
119
|
+
{ ticker: "JPY", crypto: false },
|
|
120
|
+
{ ticker: "CNY", crypto: false },
|
|
121
|
+
{ ticker: "CHF", crypto: false },
|
|
122
|
+
];
|
package/dist/editors/editors.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { Invoice } from "./invoice/module.js";
|
|
1
2
|
import { BillingStatement } from "./billing-statement/module.js";
|
|
2
3
|
import { ContributorBilling } from "./contributor-billing/module.js";
|
|
3
|
-
import { ExpenseReport } from "./expense-report/module.js";
|
|
4
4
|
import { Integrations } from "./integrations/module.js";
|
|
5
|
-
import {
|
|
5
|
+
import { ExpenseReport } from "./expense-report/module.js";
|
|
6
6
|
export const editors = [
|
|
7
7
|
BillingStatement,
|
|
8
8
|
ContributorBilling,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddBillingStatementModal.d.ts","sourceRoot":"","sources":["../../../../editors/expense-report/components/AddBillingStatementModal.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sDAAsD,CAAC;
|
|
1
|
+
{"version":3,"file":"AddBillingStatementModal.d.ts","sourceRoot":"","sources":["../../../../editors/expense-report/components/AddBillingStatementModal.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sDAAsD,CAAC;AAM1F,UAAU,6BAA6B;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,GAAG,CAAC;IACd,MAAM,EAAE,aAAa,EAAE,CAAC;CACzB;AA+BD,wBAAgB,wBAAwB,CAAC,EACvC,MAAM,EACN,OAAO,EACP,aAAa,EACb,QAAQ,EACR,MAAM,GACP,EAAE,6BAA6B,kDAuU/B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useMemo } from "react";
|
|
3
|
-
import { useSelectedExpenseReportDocument } from "
|
|
3
|
+
import { useSelectedExpenseReportDocument } from "../../document-models/expense-report/hooks.js";
|
|
4
4
|
import { actions } from "../../document-models/expense-report/index.js";
|
|
5
5
|
import { DatePicker, Icon, Button } from "@powerhousedao/document-engineering";
|
|
6
6
|
import { WalletsTable } from "./components/WalletsTable.js";
|
|
@@ -15,22 +15,22 @@ export default function Editor() {
|
|
|
15
15
|
const [document, dispatch] = useSelectedExpenseReportDocument();
|
|
16
16
|
const [selectedWallet, setSelectedWallet] = useState(null);
|
|
17
17
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
18
|
-
const [periodStart, setPeriodStart] = useState(document
|
|
19
|
-
const [periodEnd, setPeriodEnd] = useState(document
|
|
20
|
-
const { wallets, groups } = document
|
|
18
|
+
const [periodStart, setPeriodStart] = useState(document?.state.global.periodStart || "");
|
|
19
|
+
const [periodEnd, setPeriodEnd] = useState(document?.state.global.periodEnd || "");
|
|
20
|
+
const { wallets, groups } = document?.state.global || {};
|
|
21
21
|
// Handle period date changes
|
|
22
22
|
const handlePeriodStartChange = (e) => {
|
|
23
23
|
const value = e.target.value;
|
|
24
24
|
setPeriodStart(value);
|
|
25
25
|
if (value) {
|
|
26
|
-
dispatch(actions.setPeriodStart({ periodStart: value }));
|
|
26
|
+
dispatch?.(actions.setPeriodStart({ periodStart: value }));
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
const handlePeriodEndChange = (e) => {
|
|
30
30
|
const value = e.target.value;
|
|
31
31
|
setPeriodEnd(value);
|
|
32
32
|
if (value) {
|
|
33
|
-
dispatch(actions.setPeriodEnd({ periodEnd: value }));
|
|
33
|
+
dispatch?.(actions.setPeriodEnd({ periodEnd: value }));
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
// Handle wallet selection for adding billing statements
|
|
@@ -46,7 +46,7 @@ export default function Editor() {
|
|
|
46
46
|
// Handle PDF export
|
|
47
47
|
const handleExportPDF = async () => {
|
|
48
48
|
try {
|
|
49
|
-
const blob = await pdf(_jsx(ExpenseReportPDF, { periodStart: periodStart, periodEnd: periodEnd, wallets: wallets, groups: groups })).toBlob();
|
|
49
|
+
const blob = await pdf(_jsx(ExpenseReportPDF, { periodStart: periodStart, periodEnd: periodEnd, wallets: wallets || [], groups: groups || [] })).toBlob();
|
|
50
50
|
// Create download link
|
|
51
51
|
const url = URL.createObjectURL(blob);
|
|
52
52
|
const link = window.document.createElement("a");
|
|
@@ -79,5 +79,5 @@ export default function Editor() {
|
|
|
79
79
|
function handleClose() {
|
|
80
80
|
setSelectedNode(parentFolder?.id);
|
|
81
81
|
}
|
|
82
|
-
return (_jsxs("div", { children: [_jsx(DocumentToolbar, { document: document, onClose: handleClose }), _jsxs("div", { className: "ph-default-styles flex flex-col h-full w-full bg-gray-50 dark:bg-gray-900", children: [_jsx("div", { className: "flex-1 overflow-auto px-8 py-6", children: _jsxs("div", { className: "max-w-7xl mx-auto space-y-8", children: [_jsx("section", { className: "bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700", children: _jsx("div", { className: "px-6 py-6", children: _jsxs("div", { className: "relative", children: [_jsxs("div", { className: "text-center", children: [_jsx("h1", { className: "text-3xl font-bold text-gray-900 dark:text-white mb-4", children: "Expense Report" }), _jsx("div", { className: "flex items-center justify-center gap-4 text-sm text-gray-600 dark:text-gray-400", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "font-medium", children: "Period:" }), _jsx(DatePicker, { name: "periodStart", value: periodStart, onChange: handlePeriodStartChange, className: "bg-white" }), _jsx("span", { children: "to" }), _jsx(DatePicker, { name: "periodEnd", value: periodEnd, onChange: handlePeriodEndChange, className: "bg-white" })] }) })] }), _jsxs(Button, { variant: "ghost", onClick: handleExportPDF, className: "absolute top-0 right-0 flex items-center gap-2", children: [_jsx(Icon, { name: "ExportPdf", size: 18 }), "Export to PDF"] })] }) }) }), _jsxs("section", { className: "bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700", children: [_jsx("div", { className: "px-6 py-4 border-b border-gray-200 dark:border-gray-700", children: _jsx("h2", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: "Wallets" }) }), _jsx("div", { className: "p-6", children: _jsx(WalletsTable, { wallets: wallets, groups: groups, onAddBillingStatement: handleAddBillingStatement, dispatch: dispatch }) })] }), wallets.length > 0 && (_jsxs("section", { className: "bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700", children: [_jsx("div", { className: "px-6 py-4 border-b border-gray-200 dark:border-gray-700", children: _jsx("h2", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: breakdownTitle }) }), _jsx("div", { className: "p-6", children: _jsx(AggregatedExpensesTable, { wallets: wallets, groups: groups, periodStart: periodStart, periodEnd: periodEnd, dispatch: dispatch }) })] }))] }) }), isModalOpen && selectedWallet && (_jsx(AddBillingStatementModal, { isOpen: isModalOpen, onClose: handleCloseModal, walletAddress: selectedWallet, dispatch: dispatch, groups: groups }))] })] }));
|
|
82
|
+
return (_jsxs("div", { children: [_jsx(DocumentToolbar, { document: document, onClose: handleClose }), _jsxs("div", { className: "ph-default-styles flex flex-col h-full w-full bg-gray-50 dark:bg-gray-900", children: [_jsx("div", { className: "flex-1 overflow-auto px-8 py-6", children: _jsxs("div", { className: "max-w-7xl mx-auto space-y-8", children: [_jsx("section", { className: "bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700", children: _jsx("div", { className: "px-6 py-6", children: _jsxs("div", { className: "relative", children: [_jsxs("div", { className: "text-center", children: [_jsx("h1", { className: "text-3xl font-bold text-gray-900 dark:text-white mb-4", children: "Expense Report" }), _jsx("div", { className: "flex items-center justify-center gap-4 text-sm text-gray-600 dark:text-gray-400", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "font-medium", children: "Period:" }), _jsx(DatePicker, { name: "periodStart", value: periodStart, onChange: handlePeriodStartChange, className: "bg-white" }), _jsx("span", { children: "to" }), _jsx(DatePicker, { name: "periodEnd", value: periodEnd, onChange: handlePeriodEndChange, className: "bg-white" })] }) })] }), _jsxs(Button, { variant: "ghost", onClick: handleExportPDF, className: "absolute top-0 right-0 flex items-center gap-2", children: [_jsx(Icon, { name: "ExportPdf", size: 18 }), "Export to PDF"] })] }) }) }), _jsxs("section", { className: "bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700", children: [_jsx("div", { className: "px-6 py-4 border-b border-gray-200 dark:border-gray-700", children: _jsx("h2", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: "Wallets" }) }), _jsx("div", { className: "p-6", children: _jsx(WalletsTable, { wallets: wallets || [], groups: groups || [], onAddBillingStatement: handleAddBillingStatement, dispatch: dispatch }) })] }), wallets && wallets.length > 0 && (_jsxs("section", { className: "bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700", children: [_jsx("div", { className: "px-6 py-4 border-b border-gray-200 dark:border-gray-700", children: _jsx("h2", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: breakdownTitle }) }), _jsx("div", { className: "p-6", children: _jsx(AggregatedExpensesTable, { wallets: wallets, groups: groups || [], periodStart: periodStart, periodEnd: periodEnd, dispatch: dispatch || (() => { }) }) })] }))] }) }), isModalOpen && selectedWallet && (_jsx(AddBillingStatementModal, { isOpen: isModalOpen, onClose: handleCloseModal, walletAddress: selectedWallet, dispatch: dispatch, groups: groups || [] }))] })] }));
|
|
83
83
|
}
|
package/dist/editors/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
export { Invoice } from "./invoice/module.js";
|
|
1
2
|
export { BillingStatement } from "./billing-statement/module.js";
|
|
2
3
|
export { ContributorBilling } from "./contributor-billing/module.js";
|
|
3
|
-
export { ExpenseReport } from "./expense-report/module.js";
|
|
4
4
|
export { Integrations } from "./integrations/module.js";
|
|
5
|
-
export {
|
|
5
|
+
export { ExpenseReport } from "./expense-report/module.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../editors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../editors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/editors/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
export { Invoice } from "./invoice/module.js";
|
|
1
2
|
export { BillingStatement } from "./billing-statement/module.js";
|
|
2
3
|
export { ContributorBilling } from "./contributor-billing/module.js";
|
|
3
|
-
export { ExpenseReport } from "./expense-report/module.js";
|
|
4
4
|
export { Integrations } from "./integrations/module.js";
|
|
5
|
-
export {
|
|
5
|
+
export { ExpenseReport } from "./expense-report/module.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditName.d.ts","sourceRoot":"","sources":["../../../../editors/integrations/components/EditName.tsx"],"names":[],"mappings":"AAKA,oFAAoF;AACpF,wBAAgB,oBAAoB,mDAuEnC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { setName } from "document-model";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { useSelectedIntegrationsDocument } from "@powerhousedao/contributor-billing/document-models/integrations";
|
|
5
|
+
/** Displays the name of the selected Integrations document and allows editing it */
|
|
6
|
+
export function EditIntegrationsName() {
|
|
7
|
+
const [integrationsDocument, dispatch] = useSelectedIntegrationsDocument();
|
|
8
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
9
|
+
if (!integrationsDocument)
|
|
10
|
+
return null;
|
|
11
|
+
const integrationsDocumentName = integrationsDocument.header.name;
|
|
12
|
+
const onClickEditIntegrationsName = () => {
|
|
13
|
+
setIsEditing(true);
|
|
14
|
+
};
|
|
15
|
+
const onClickCancelEditIntegrationsName = () => {
|
|
16
|
+
setIsEditing(false);
|
|
17
|
+
};
|
|
18
|
+
const onSubmitSetName = (event) => {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
const form = event.currentTarget;
|
|
21
|
+
const nameInput = form.elements.namedItem("name");
|
|
22
|
+
const name = nameInput.value;
|
|
23
|
+
if (!name)
|
|
24
|
+
return;
|
|
25
|
+
dispatch(setName(name));
|
|
26
|
+
setIsEditing(false);
|
|
27
|
+
};
|
|
28
|
+
if (isEditing)
|
|
29
|
+
return (_jsxs("form", { className: "flex gap-2 items-center justify-between", onSubmit: onSubmitSetName, children: [_jsx("input", { className: "text-lg font-semibold text-gray-900 p-1", type: "text", name: "name", defaultValue: integrationsDocumentName, autoFocus: true }), _jsxs("div", { className: "flex gap-2", children: [_jsx("button", { type: "submit", className: "text-sm text-gray-600", children: "Save" }), _jsx("button", { className: "text-sm text-red-800", onClick: onClickCancelEditIntegrationsName, children: "Cancel" })] })] }));
|
|
30
|
+
return (_jsxs("div", { className: "flex justify-between items-center", children: [_jsx("h2", { className: "text-lg font-semibold text-gray-900", children: integrationsDocumentName }), _jsx("button", { className: "text-sm text-gray-600", onClick: onClickEditIntegrationsName, children: "Edit Name" })] }));
|
|
31
|
+
}
|