@powerhousedao/contributor-billing 0.1.29 → 0.1.31
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 +2 -2
- 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 +3 -3
- package/dist/editors/invoice/uploadPdfChunked.d.ts.map +1 -1
- package/dist/editors/invoice/uploadPdfChunked.js +4 -3
- 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 -21
- 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
|
@@ -8,231 +8,259 @@
|
|
|
8
8
|
*/
|
|
9
9
|
// Xero expense account options from tagMapping.tsx
|
|
10
10
|
const XERO_EXPENSE_ACCOUNTS = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
11
|
+
"2001": "2001 - Clearing Account",
|
|
12
|
+
"2222": "2222 - Request Finance IC account",
|
|
13
|
+
"3000": "3000 - Activities and Events",
|
|
14
|
+
"3001": "3001 - Meals",
|
|
15
|
+
"3002": "3002 - Airfare",
|
|
16
|
+
"3003": "3003 - Hotels",
|
|
17
|
+
"3004": "3004 - Transportation (Uber, Taxi etc)",
|
|
18
|
+
"3005": "3005 - Other travel cost",
|
|
19
|
+
"400": "400 - Advertising",
|
|
20
|
+
"4001": "4001 - Legal Fees Abroad",
|
|
21
|
+
"4002": "4002 - Legal Fees Switzerland",
|
|
22
|
+
"4003": "4003 - Finance Team Fees Abroad",
|
|
23
|
+
"4004": "4004 - Finance and Accounting Fees Switzerland",
|
|
24
|
+
"4005": "4005 - Software Development Team Fees",
|
|
25
|
+
"4006": "4006 - Research Team Fees",
|
|
26
|
+
"4007": "4007 - Marketing Team Fees",
|
|
27
|
+
"4008": "4008 - Health Care Fees",
|
|
28
|
+
"4009": "4009 - Contractor Fees",
|
|
29
|
+
"4010": "4010 - Insurance Fees Team",
|
|
30
|
+
"4011": "4011 - HR Fees",
|
|
31
|
+
"4012": "4012 - Team Bonus",
|
|
32
|
+
"4013": "4013 - Refferal Fees",
|
|
33
|
+
"416": "416 - Depreciation",
|
|
34
|
+
"425": "425 - Freight & Courier",
|
|
35
|
+
"437": "437 - Interest Expense",
|
|
36
|
+
"453": "453 - Office Expenses",
|
|
37
|
+
"469": "469 - Rent",
|
|
38
|
+
"485": "485 - Subscriptions",
|
|
39
|
+
"505": "505 - Income Tax Expense",
|
|
40
|
+
"701": "701 - Software/IT Subscriptions",
|
|
41
|
+
"702": "702 - Telephone and Internet Charges",
|
|
42
|
+
"8000": "8000 - Bank Fees",
|
|
43
|
+
"8001": "8001 - Gas Fees",
|
|
44
|
+
"8003": "8003 - Exchange Fees",
|
|
45
45
|
};
|
|
46
46
|
// Keyword-based mapping rules (highest confidence)
|
|
47
47
|
const KEYWORD_RULES = [
|
|
48
48
|
// Software & Technology
|
|
49
49
|
{
|
|
50
|
-
patterns: [
|
|
51
|
-
|
|
50
|
+
patterns: [
|
|
51
|
+
"github",
|
|
52
|
+
"gitlab",
|
|
53
|
+
"figma",
|
|
54
|
+
"slack",
|
|
55
|
+
"notion",
|
|
56
|
+
"vercel",
|
|
57
|
+
"netlify",
|
|
58
|
+
"aws",
|
|
59
|
+
"google cloud",
|
|
60
|
+
],
|
|
61
|
+
account: "701",
|
|
52
62
|
confidence: 0.95,
|
|
53
|
-
reason:
|
|
63
|
+
reason: "Known software platform",
|
|
54
64
|
},
|
|
55
65
|
{
|
|
56
|
-
patterns: [
|
|
57
|
-
account:
|
|
66
|
+
patterns: ["software", "saas", "subscription", "api", "hosting", "cloud"],
|
|
67
|
+
account: "701",
|
|
58
68
|
confidence: 0.85,
|
|
59
|
-
reason:
|
|
69
|
+
reason: "Software/SaaS keywords",
|
|
60
70
|
},
|
|
61
71
|
{
|
|
62
|
-
patterns: [
|
|
63
|
-
account:
|
|
72
|
+
patterns: ["subscription", "monthly", "annual"],
|
|
73
|
+
account: "485",
|
|
64
74
|
confidence: 0.8,
|
|
65
|
-
reason:
|
|
75
|
+
reason: "General subscription",
|
|
66
76
|
},
|
|
67
77
|
// Travel & Transportation
|
|
68
78
|
{
|
|
69
|
-
patterns: [
|
|
70
|
-
account:
|
|
79
|
+
patterns: ["airline", "flight", "airfare", "airport"],
|
|
80
|
+
account: "3002",
|
|
71
81
|
confidence: 0.95,
|
|
72
|
-
reason:
|
|
82
|
+
reason: "Air travel",
|
|
73
83
|
},
|
|
74
84
|
{
|
|
75
|
-
patterns: [
|
|
76
|
-
|
|
85
|
+
patterns: [
|
|
86
|
+
"hotel",
|
|
87
|
+
"accommodation",
|
|
88
|
+
"lodging",
|
|
89
|
+
"booking.com",
|
|
90
|
+
"hotels.com",
|
|
91
|
+
],
|
|
92
|
+
account: "3003",
|
|
77
93
|
confidence: 0.95,
|
|
78
|
-
reason:
|
|
94
|
+
reason: "Hotel accommodation",
|
|
79
95
|
},
|
|
80
96
|
{
|
|
81
|
-
patterns: [
|
|
82
|
-
account:
|
|
97
|
+
patterns: ["uber", "lyft", "taxi", "rideshare", "transport"],
|
|
98
|
+
account: "3004",
|
|
83
99
|
confidence: 0.9,
|
|
84
|
-
reason:
|
|
100
|
+
reason: "Transportation services",
|
|
85
101
|
},
|
|
86
102
|
{
|
|
87
|
-
patterns: [
|
|
88
|
-
account:
|
|
103
|
+
patterns: ["restaurant", "meal", "food", "catering", "lunch", "dinner"],
|
|
104
|
+
account: "3001",
|
|
89
105
|
confidence: 0.85,
|
|
90
|
-
reason:
|
|
106
|
+
reason: "Meals & entertainment",
|
|
91
107
|
},
|
|
92
108
|
{
|
|
93
|
-
patterns: [
|
|
94
|
-
account:
|
|
109
|
+
patterns: ["travel", "trip", "conference"],
|
|
110
|
+
account: "3005",
|
|
95
111
|
confidence: 0.7,
|
|
96
|
-
reason:
|
|
112
|
+
reason: "General travel",
|
|
97
113
|
},
|
|
98
114
|
// Professional Services
|
|
99
115
|
{
|
|
100
|
-
patterns: [
|
|
101
|
-
account:
|
|
116
|
+
patterns: ["contractor", "freelancer", "consultant", "consulting"],
|
|
117
|
+
account: "4009",
|
|
102
118
|
confidence: 0.9,
|
|
103
|
-
reason:
|
|
119
|
+
reason: "Contractor services",
|
|
104
120
|
},
|
|
105
121
|
{
|
|
106
|
-
patterns: [
|
|
107
|
-
account:
|
|
122
|
+
patterns: ["legal", "attorney", "law", "lawyer"],
|
|
123
|
+
account: "4001",
|
|
108
124
|
confidence: 0.9,
|
|
109
|
-
reason:
|
|
125
|
+
reason: "Legal services",
|
|
110
126
|
},
|
|
111
127
|
{
|
|
112
|
-
patterns: [
|
|
113
|
-
account:
|
|
128
|
+
patterns: ["development", "developer", "programming", "coding"],
|
|
129
|
+
account: "4005",
|
|
114
130
|
confidence: 0.85,
|
|
115
|
-
reason:
|
|
131
|
+
reason: "Software development",
|
|
116
132
|
},
|
|
117
133
|
// Office & Operations
|
|
118
134
|
{
|
|
119
|
-
patterns: [
|
|
120
|
-
account:
|
|
135
|
+
patterns: ["rent", "lease", "office space", "coworking"],
|
|
136
|
+
account: "469",
|
|
121
137
|
confidence: 0.9,
|
|
122
|
-
reason:
|
|
138
|
+
reason: "Rent/office space",
|
|
123
139
|
},
|
|
124
140
|
{
|
|
125
|
-
patterns: [
|
|
126
|
-
account:
|
|
141
|
+
patterns: ["office", "supplies", "equipment", "stationery"],
|
|
142
|
+
account: "453",
|
|
127
143
|
confidence: 0.8,
|
|
128
|
-
reason:
|
|
144
|
+
reason: "Office expenses",
|
|
129
145
|
},
|
|
130
146
|
// Marketing & Advertising
|
|
131
147
|
{
|
|
132
|
-
patterns: [
|
|
133
|
-
account:
|
|
148
|
+
patterns: ["advertising", "marketing", "promotion", "campaign", "ads"],
|
|
149
|
+
account: "400",
|
|
134
150
|
confidence: 0.85,
|
|
135
|
-
reason:
|
|
151
|
+
reason: "Marketing/advertising",
|
|
136
152
|
},
|
|
137
153
|
// Fees & Financial
|
|
138
154
|
{
|
|
139
|
-
patterns: [
|
|
140
|
-
account:
|
|
155
|
+
patterns: ["bank fee", "transaction fee", "processing fee"],
|
|
156
|
+
account: "8000",
|
|
141
157
|
confidence: 0.9,
|
|
142
|
-
reason:
|
|
158
|
+
reason: "Bank fees",
|
|
143
159
|
},
|
|
144
160
|
{
|
|
145
|
-
patterns: [
|
|
146
|
-
account:
|
|
161
|
+
patterns: ["gas fee", "ethereum", "blockchain"],
|
|
162
|
+
account: "8001",
|
|
147
163
|
confidence: 0.95,
|
|
148
|
-
reason:
|
|
149
|
-
}
|
|
164
|
+
reason: "Blockchain gas fees",
|
|
165
|
+
},
|
|
150
166
|
];
|
|
151
167
|
// Vendor-specific mapping (very high confidence)
|
|
152
168
|
const VENDOR_RULES = [
|
|
153
169
|
// Software platforms
|
|
154
|
-
{ vendors: [
|
|
155
|
-
{ vendors: [
|
|
156
|
-
{ vendors: [
|
|
157
|
-
{ vendors: [
|
|
158
|
-
{ vendors: [
|
|
159
|
-
{
|
|
170
|
+
{ vendors: ["github.com", "github"], account: "701", confidence: 0.98 },
|
|
171
|
+
{ vendors: ["figma.com", "figma"], account: "701", confidence: 0.98 },
|
|
172
|
+
{ vendors: ["slack.com", "slack"], account: "701", confidence: 0.98 },
|
|
173
|
+
{ vendors: ["notion.so", "notion"], account: "701", confidence: 0.98 },
|
|
174
|
+
{ vendors: ["vercel.com", "vercel"], account: "701", confidence: 0.98 },
|
|
175
|
+
{
|
|
176
|
+
vendors: ["aws.amazon.com", "amazon web services"],
|
|
177
|
+
account: "701",
|
|
178
|
+
confidence: 0.98,
|
|
179
|
+
},
|
|
160
180
|
// Travel
|
|
161
|
-
{
|
|
162
|
-
|
|
163
|
-
|
|
181
|
+
{
|
|
182
|
+
vendors: ["booking.com", "expedia", "hotels.com"],
|
|
183
|
+
account: "3003",
|
|
184
|
+
confidence: 0.98,
|
|
185
|
+
},
|
|
186
|
+
{ vendors: ["uber", "lyft"], account: "3004", confidence: 0.98 },
|
|
187
|
+
{
|
|
188
|
+
vendors: ["delta", "american airlines", "united"],
|
|
189
|
+
account: "3002",
|
|
190
|
+
confidence: 0.98,
|
|
191
|
+
},
|
|
164
192
|
// Professional services
|
|
165
|
-
{ vendors: [
|
|
193
|
+
{ vendors: ["upwork", "fiverr"], account: "4009", confidence: 0.95 },
|
|
166
194
|
];
|
|
167
195
|
// Amount-based rules (lower confidence)
|
|
168
196
|
const AMOUNT_RULES = [
|
|
169
197
|
{
|
|
170
198
|
range: { min: 5, max: 50 },
|
|
171
|
-
patterns: [
|
|
172
|
-
account:
|
|
199
|
+
patterns: ["subscription", "monthly"],
|
|
200
|
+
account: "485",
|
|
173
201
|
confidence: 0.6,
|
|
174
|
-
reason:
|
|
202
|
+
reason: "Small subscription amount",
|
|
175
203
|
},
|
|
176
204
|
{
|
|
177
205
|
range: { min: 1000, max: 50000 },
|
|
178
|
-
patterns: [
|
|
179
|
-
account:
|
|
206
|
+
patterns: ["consulting", "development"],
|
|
207
|
+
account: "4009",
|
|
180
208
|
confidence: 0.7,
|
|
181
|
-
reason:
|
|
182
|
-
}
|
|
209
|
+
reason: "Large professional services amount",
|
|
210
|
+
},
|
|
183
211
|
];
|
|
184
212
|
/**
|
|
185
213
|
* Main auto-tagging function using smart hybrid approach
|
|
186
214
|
*/
|
|
187
215
|
export function autoTagLineItem(description, amount, vendor) {
|
|
188
216
|
const desc = description.toLowerCase();
|
|
189
|
-
const vendorLower = vendor?.toLowerCase() ||
|
|
217
|
+
const vendorLower = vendor?.toLowerCase() || "";
|
|
190
218
|
// 1. Try vendor-specific rules first (highest confidence)
|
|
191
219
|
for (const rule of VENDOR_RULES) {
|
|
192
|
-
if (rule.vendors.some(v => desc.includes(v) || vendorLower.includes(v))) {
|
|
220
|
+
if (rule.vendors.some((v) => desc.includes(v) || vendorLower.includes(v))) {
|
|
193
221
|
const label = XERO_EXPENSE_ACCOUNTS[rule.account];
|
|
194
222
|
return {
|
|
195
223
|
tag: {
|
|
196
|
-
dimension:
|
|
224
|
+
dimension: "xero-expense-account",
|
|
197
225
|
value: rule.account,
|
|
198
|
-
label: label
|
|
226
|
+
label: label,
|
|
199
227
|
},
|
|
200
228
|
confidence: rule.confidence,
|
|
201
|
-
method:
|
|
202
|
-
reason: `Matched vendor: ${rule.vendors[0]}
|
|
229
|
+
method: "vendor",
|
|
230
|
+
reason: `Matched vendor: ${rule.vendors[0]}`,
|
|
203
231
|
};
|
|
204
232
|
}
|
|
205
233
|
}
|
|
206
234
|
// 2. Try keyword-based rules
|
|
207
235
|
for (const rule of KEYWORD_RULES) {
|
|
208
|
-
if (rule.patterns.some(pattern => desc.includes(pattern))) {
|
|
236
|
+
if (rule.patterns.some((pattern) => desc.includes(pattern))) {
|
|
209
237
|
const label = XERO_EXPENSE_ACCOUNTS[rule.account];
|
|
210
238
|
return {
|
|
211
239
|
tag: {
|
|
212
|
-
dimension:
|
|
240
|
+
dimension: "xero-expense-account",
|
|
213
241
|
value: rule.account,
|
|
214
|
-
label: label
|
|
242
|
+
label: label,
|
|
215
243
|
},
|
|
216
244
|
confidence: rule.confidence,
|
|
217
|
-
method:
|
|
218
|
-
reason: rule.reason
|
|
245
|
+
method: "keyword",
|
|
246
|
+
reason: rule.reason,
|
|
219
247
|
};
|
|
220
248
|
}
|
|
221
249
|
}
|
|
222
250
|
// 3. Try amount-based rules
|
|
223
251
|
for (const rule of AMOUNT_RULES) {
|
|
224
252
|
if (amount >= rule.range.min && amount <= rule.range.max) {
|
|
225
|
-
if (rule.patterns.some(pattern => desc.includes(pattern))) {
|
|
253
|
+
if (rule.patterns.some((pattern) => desc.includes(pattern))) {
|
|
226
254
|
const label = XERO_EXPENSE_ACCOUNTS[rule.account];
|
|
227
255
|
return {
|
|
228
256
|
tag: {
|
|
229
|
-
dimension:
|
|
257
|
+
dimension: "xero-expense-account",
|
|
230
258
|
value: rule.account,
|
|
231
|
-
label: label
|
|
259
|
+
label: label,
|
|
232
260
|
},
|
|
233
261
|
confidence: rule.confidence,
|
|
234
|
-
method:
|
|
235
|
-
reason: rule.reason
|
|
262
|
+
method: "amount",
|
|
263
|
+
reason: rule.reason,
|
|
236
264
|
};
|
|
237
265
|
}
|
|
238
266
|
}
|
|
@@ -244,7 +272,7 @@ export function autoTagLineItem(description, amount, vendor) {
|
|
|
244
272
|
* Only used when rule-based matching fails
|
|
245
273
|
*/
|
|
246
274
|
export async function claudeClassifyExpense(description, amount) {
|
|
247
|
-
const apiKey = typeof process !==
|
|
275
|
+
const apiKey = typeof process !== "undefined" ? process.env?.CLAUDE_API_KEY : undefined;
|
|
248
276
|
if (!apiKey) {
|
|
249
277
|
return null;
|
|
250
278
|
}
|
|
@@ -263,21 +291,23 @@ Categories:
|
|
|
263
291
|
|
|
264
292
|
Respond with ONLY the category name: SOFTWARE|TRAVEL|CONTRACTOR|LEGAL|OFFICE|MARKETING|OTHER`;
|
|
265
293
|
try {
|
|
266
|
-
const response = await fetch(
|
|
267
|
-
method:
|
|
294
|
+
const response = await fetch("https://api.anthropic.com/v1/messages", {
|
|
295
|
+
method: "POST",
|
|
268
296
|
headers: {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
297
|
+
"Content-Type": "application/json",
|
|
298
|
+
"x-api-key": apiKey,
|
|
299
|
+
"anthropic-version": "2023-06-01",
|
|
272
300
|
},
|
|
273
301
|
body: JSON.stringify({
|
|
274
302
|
model: "claude-haiku-4-5-20251001",
|
|
275
303
|
max_tokens: 10,
|
|
276
|
-
messages: [
|
|
304
|
+
messages: [
|
|
305
|
+
{
|
|
277
306
|
role: "user",
|
|
278
|
-
content: prompt
|
|
279
|
-
}
|
|
280
|
-
|
|
307
|
+
content: prompt,
|
|
308
|
+
},
|
|
309
|
+
],
|
|
310
|
+
}),
|
|
281
311
|
});
|
|
282
312
|
if (!response.ok) {
|
|
283
313
|
throw new Error(`Claude API error: ${response.status}`);
|
|
@@ -286,25 +316,25 @@ Respond with ONLY the category name: SOFTWARE|TRAVEL|CONTRACTOR|LEGAL|OFFICE|MAR
|
|
|
286
316
|
const category = result.content[0]?.text?.trim().toUpperCase();
|
|
287
317
|
// Map category to Xero account
|
|
288
318
|
const categoryMapping = {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
319
|
+
SOFTWARE: "701",
|
|
320
|
+
TRAVEL: "3005",
|
|
321
|
+
CONTRACTOR: "4009",
|
|
322
|
+
LEGAL: "4001",
|
|
323
|
+
OFFICE: "453",
|
|
324
|
+
MARKETING: "400",
|
|
325
|
+
OTHER: "453", // Default to office expenses
|
|
296
326
|
};
|
|
297
|
-
const account = categoryMapping[category] ||
|
|
327
|
+
const account = categoryMapping[category] || "453";
|
|
298
328
|
const label = XERO_EXPENSE_ACCOUNTS[account];
|
|
299
329
|
return {
|
|
300
330
|
tag: {
|
|
301
|
-
dimension:
|
|
331
|
+
dimension: "xero-expense-account",
|
|
302
332
|
value: account,
|
|
303
|
-
label: label
|
|
333
|
+
label: label,
|
|
304
334
|
},
|
|
305
335
|
confidence: 0.6, // Lower confidence for Claude classifications
|
|
306
|
-
method:
|
|
307
|
-
reason: `Claude classified as ${category}
|
|
336
|
+
method: "claude",
|
|
337
|
+
reason: `Claude classified as ${category}`,
|
|
308
338
|
};
|
|
309
339
|
}
|
|
310
340
|
catch (error) {
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { executeTransferProposal } from
|
|
2
|
-
import dotenv from
|
|
1
|
+
import { executeTransferProposal } from "./gnosisTransactionBuilder.js";
|
|
2
|
+
import dotenv from "dotenv";
|
|
3
3
|
dotenv.config();
|
|
4
4
|
async function testBatchTransfer() {
|
|
5
5
|
try {
|
|
6
6
|
const payerWallet = {
|
|
7
|
-
rpc:
|
|
8
|
-
chainName:
|
|
9
|
-
chainId:
|
|
10
|
-
address:
|
|
7
|
+
rpc: "https://mainnet.base.org", // Base mainnet RPC
|
|
8
|
+
chainName: "Base",
|
|
9
|
+
chainId: "8453",
|
|
10
|
+
address: "0x1FB6bEF04230d67aF0e3455B997a28AFcCe1F45e",
|
|
11
11
|
};
|
|
12
12
|
const paymentDetails = [
|
|
13
13
|
{
|
|
14
14
|
payeeWallet: {
|
|
15
|
-
address:
|
|
15
|
+
address: "0x48f208afD0Abeacd4e7C8839Ea19e3CcCF0433DE",
|
|
16
16
|
},
|
|
17
17
|
token: {
|
|
18
|
-
symbol:
|
|
19
|
-
evmAddress:
|
|
18
|
+
symbol: "USDS",
|
|
19
|
+
evmAddress: "0x820C137fa70C8691f0e44Dc420a5e53c168921Dc",
|
|
20
20
|
decimals: 6,
|
|
21
21
|
},
|
|
22
|
-
amount:
|
|
22
|
+
amount: "10",
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
payeeWallet: {
|
|
26
|
-
address:
|
|
26
|
+
address: "0x48f208afD0Abeacd4e7C8839Ea19e3CcCF0433DE",
|
|
27
27
|
},
|
|
28
28
|
token: {
|
|
29
|
-
symbol:
|
|
30
|
-
evmAddress:
|
|
29
|
+
symbol: "USDS",
|
|
30
|
+
evmAddress: "0x820C137fa70C8691f0e44Dc420a5e53c168921Dc",
|
|
31
31
|
decimals: 6,
|
|
32
32
|
},
|
|
33
|
-
amount:
|
|
33
|
+
amount: "15.5",
|
|
34
34
|
},
|
|
35
35
|
];
|
|
36
36
|
const result = await executeTransferProposal(payerWallet.chainName, paymentDetails);
|
|
37
|
-
console.log(
|
|
37
|
+
console.log("\n✅ Batch transaction proposed successfully:");
|
|
38
38
|
console.log(result);
|
|
39
39
|
}
|
|
40
40
|
catch (err) {
|
|
41
|
-
console.error(
|
|
41
|
+
console.error("\n❌ Batch transaction test failed:", err);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
testBatchTransfer();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gnosisTransactionBuilder.d.ts","sourceRoot":"","sources":["../../../scripts/invoice/gnosisTransactionBuilder.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,aAAa,EAAE,CAAC;CACjC;
|
|
1
|
+
{"version":3,"file":"gnosisTransactionBuilder.d.ts","sourceRoot":"","sources":["../../../scripts/invoice/gnosisTransactionBuilder.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,aAAa,EAAE,CAAC;CACjC;AAwED,iBAAe,uBAAuB,CACpC,SAAS,EAAE,MAAM,EACjB,mBAAmB,EAAE,aAAa,GAAG,aAAa,EAAE,GACnD,OAAO,CAAC,cAAc,CAAC,CAuGzB;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import SafeApiKit from
|
|
2
|
-
import Safe from
|
|
3
|
-
import { OperationType } from
|
|
4
|
-
import { ethers, AbiCoder } from
|
|
5
|
-
import dotenv from
|
|
6
|
-
import { CHAIN_CONFIGS } from
|
|
1
|
+
import SafeApiKit from "@safe-global/api-kit";
|
|
2
|
+
import Safe from "@safe-global/protocol-kit";
|
|
3
|
+
import { OperationType } from "@safe-global/types-kit";
|
|
4
|
+
import { ethers, AbiCoder } from "ethers";
|
|
5
|
+
import dotenv from "dotenv";
|
|
6
|
+
import { CHAIN_CONFIGS } from "../../editors/invoice/utils/utils.js";
|
|
7
7
|
dotenv.config();
|
|
8
|
-
|
|
8
|
+
// Determine environment and use appropriate Safe address
|
|
9
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
10
|
+
const safeAddress = isProduction
|
|
11
|
+
? process.env.PRODUCTION_SAFE_ADDRESS
|
|
12
|
+
: process.env.DEV_STAGING_SAFE_ADDRESS;
|
|
9
13
|
if (!safeAddress) {
|
|
10
|
-
|
|
14
|
+
const envVarName = isProduction
|
|
15
|
+
? "PRODUCTION_SAFE_ADDRESS"
|
|
16
|
+
: "DEV_STAGING_SAFE_ADDRESS";
|
|
17
|
+
throw new Error(`Missing ${envVarName} in .env (NODE_ENV=${process.env.NODE_ENV || "undefined"})`);
|
|
11
18
|
}
|
|
19
|
+
console.log(`----- GNOSIS TRANSACTION BUILDER ----- Using ${isProduction ? "PRODUCTION" : "DEV/STAGING"} Safe address: ${safeAddress}`);
|
|
12
20
|
const payerWallets = {
|
|
13
21
|
BASE: {
|
|
14
22
|
...CHAIN_CONFIGS.base,
|
|
@@ -33,13 +41,13 @@ async function withRetry(fn, maxRetries = 3, initialDelay = 1000, operationName
|
|
|
33
41
|
return await fn();
|
|
34
42
|
}
|
|
35
43
|
catch (error) {
|
|
36
|
-
const isRateLimit = error?.message?.includes(
|
|
37
|
-
error?.message?.includes(
|
|
44
|
+
const isRateLimit = error?.message?.includes("Too Many Requests") ||
|
|
45
|
+
error?.message?.includes("429") ||
|
|
38
46
|
error?.status === 429;
|
|
39
47
|
if (isRateLimit && attempt < maxRetries - 1) {
|
|
40
48
|
const waitTime = initialDelay * Math.pow(2, attempt); // Exponential backoff
|
|
41
49
|
console.log(`[${operationName}] Rate limited, retrying in ${waitTime}ms... (attempt ${attempt + 1}/${maxRetries})`);
|
|
42
|
-
await new Promise(resolve => setTimeout(resolve, waitTime));
|
|
50
|
+
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
|
43
51
|
continue;
|
|
44
52
|
}
|
|
45
53
|
// If it's not a rate limit error, or we've exhausted retries, throw
|
|
@@ -56,9 +64,9 @@ async function executeTransferProposal(chainName, paymentDetailsInput) {
|
|
|
56
64
|
: [paymentDetailsInput];
|
|
57
65
|
const privateKey = process.env.SIGNER_PRIVATE_KEY;
|
|
58
66
|
if (!privateKey) {
|
|
59
|
-
throw new Error(
|
|
67
|
+
throw new Error("Missing SIGNER_PRIVATE_KEY in .env");
|
|
60
68
|
}
|
|
61
|
-
console.log(
|
|
69
|
+
console.log("\n=== Safe Transfer Initialization ===");
|
|
62
70
|
console.log(`Chain: ${payerWallet.chainName} (${payerWallet.chainId})`);
|
|
63
71
|
console.log(`Safe Address: ${payerWallet.address}`);
|
|
64
72
|
// Set up provider and signer
|
|
@@ -68,7 +76,7 @@ async function executeTransferProposal(chainName, paymentDetailsInput) {
|
|
|
68
76
|
// @ts-ignore - Ignoring constructor error as per requirements
|
|
69
77
|
const safeApiKit = new SafeApiKit({
|
|
70
78
|
chainId: BigInt(payerWallet.chainId),
|
|
71
|
-
apiKey: process.env.SAFE_API_KEY
|
|
79
|
+
apiKey: process.env.SAFE_API_KEY,
|
|
72
80
|
});
|
|
73
81
|
// Get next nonce with retry logic for rate limiting
|
|
74
82
|
const nextNonce = await withRetry(() => safeApiKit.getNextNonce(safeAddress), 3, 1000, "getNextNonce");
|
|
@@ -84,31 +92,30 @@ async function executeTransferProposal(chainName, paymentDetailsInput) {
|
|
|
84
92
|
const transactions = paymentDetails.map((pd) => {
|
|
85
93
|
const { payeeWallet, token, amount } = pd;
|
|
86
94
|
const amountSmall = ethers.parseUnits(amount.toString(), token.decimals);
|
|
87
|
-
console.log(
|
|
95
|
+
console.log("\n--- Preparing transfer ---");
|
|
88
96
|
console.log(`Token: ${token.symbol} @ ${token.evmAddress}`);
|
|
89
97
|
console.log(`To: ${payeeWallet.address}`);
|
|
90
98
|
console.log(`Amount: ${amount} → ${amountSmall}`);
|
|
91
99
|
// a9059cbb is the ERC-20 transfer method ID
|
|
92
|
-
const data =
|
|
93
|
-
coder
|
|
94
|
-
payeeWallet.address,
|
|
95
|
-
|
|
96
|
-
]).slice(2);
|
|
100
|
+
const data = "0xa9059cbb" +
|
|
101
|
+
coder
|
|
102
|
+
.encode(["address", "uint256"], [payeeWallet.address, amountSmall])
|
|
103
|
+
.slice(2);
|
|
97
104
|
return {
|
|
98
105
|
to: token.evmAddress,
|
|
99
|
-
value:
|
|
106
|
+
value: "0",
|
|
100
107
|
data,
|
|
101
108
|
operation: OperationType.Call,
|
|
102
109
|
};
|
|
103
110
|
});
|
|
104
|
-
console.log(
|
|
111
|
+
console.log("\n=== Creating Safe transaction ===");
|
|
105
112
|
const safeTx = await protocolKit.createTransaction({
|
|
106
113
|
transactions,
|
|
107
114
|
options: {
|
|
108
|
-
nonce: nextNonce
|
|
109
|
-
}
|
|
115
|
+
nonce: nextNonce,
|
|
116
|
+
},
|
|
110
117
|
});
|
|
111
|
-
console.log(
|
|
118
|
+
console.log("\n=== Signing & proposing ===");
|
|
112
119
|
const safeTxHash = await protocolKit.getTransactionHash(safeTx);
|
|
113
120
|
const signature = await protocolKit.signHash(safeTxHash);
|
|
114
121
|
const senderAddress = await signer.getAddress();
|