@powerhousedao/contributor-billing 0.1.27 → 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 +2 -2
- package/dist/editors/invoice/legalEntity/bankSection.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/bankSection.js +19 -10
- package/dist/editors/invoice/legalEntity/legalEntity.d.ts +4 -0
- package/dist/editors/invoice/legalEntity/legalEntity.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/legalEntity.js +66 -2
- 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 +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/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
|
@@ -2,42 +2,65 @@ function getStateValue(input, currentValue) {
|
|
|
2
2
|
return input === undefined ? currentValue : input;
|
|
3
3
|
}
|
|
4
4
|
export const invoicePartiesOperations = {
|
|
5
|
-
editIssuerOperation(state, action
|
|
6
|
-
if (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
editIssuerOperation(state, action) {
|
|
6
|
+
if ("address" in state.issuer &&
|
|
7
|
+
("city" in action.input ||
|
|
8
|
+
"country" in action.input ||
|
|
9
|
+
"extendedAddress" in action.input ||
|
|
10
|
+
"postalCode" in action.input ||
|
|
11
|
+
"stateProvince" in action.input ||
|
|
12
|
+
"streetAddress" in action.input)) {
|
|
12
13
|
state.issuer.address = {
|
|
13
14
|
...state.issuer.address,
|
|
14
|
-
city: action.input.city !== undefined
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
city: action.input.city !== undefined
|
|
16
|
+
? action.input.city
|
|
17
|
+
: (state.issuer.address?.city ?? null),
|
|
18
|
+
country: action.input.country !== undefined
|
|
19
|
+
? action.input.country
|
|
20
|
+
: (state.issuer.address?.country ?? null),
|
|
21
|
+
extendedAddress: action.input.extendedAddress !== undefined
|
|
22
|
+
? action.input.extendedAddress
|
|
23
|
+
: (state.issuer.address?.extendedAddress ?? null),
|
|
24
|
+
postalCode: action.input.postalCode !== undefined
|
|
25
|
+
? action.input.postalCode
|
|
26
|
+
: (state.issuer.address?.postalCode ?? null),
|
|
27
|
+
stateProvince: action.input.stateProvince !== undefined
|
|
28
|
+
? action.input.stateProvince
|
|
29
|
+
: (state.issuer.address?.stateProvince ?? null),
|
|
30
|
+
streetAddress: action.input.streetAddress !== undefined
|
|
31
|
+
? action.input.streetAddress
|
|
32
|
+
: (state.issuer.address?.streetAddress ?? null),
|
|
20
33
|
};
|
|
21
34
|
}
|
|
22
|
-
if (
|
|
23
|
-
|
|
35
|
+
if ("contactInfo" in state.issuer &&
|
|
36
|
+
("tel" in action.input || "email" in action.input)) {
|
|
24
37
|
state.issuer.contactInfo = {
|
|
25
38
|
...state.issuer.contactInfo,
|
|
26
|
-
tel: action.input.tel !== undefined
|
|
27
|
-
|
|
39
|
+
tel: action.input.tel !== undefined
|
|
40
|
+
? action.input.tel
|
|
41
|
+
: (state.issuer.contactInfo?.tel ?? null),
|
|
42
|
+
email: action.input.email !== undefined
|
|
43
|
+
? action.input.email
|
|
44
|
+
: (state.issuer.contactInfo?.email ?? null),
|
|
28
45
|
};
|
|
29
46
|
}
|
|
30
|
-
if (
|
|
31
|
-
state.issuer.country =
|
|
47
|
+
if ("country" in action.input) {
|
|
48
|
+
state.issuer.country =
|
|
49
|
+
action.input.country !== undefined
|
|
50
|
+
? action.input.country
|
|
51
|
+
: (state.issuer.country ?? null);
|
|
32
52
|
}
|
|
33
|
-
if (
|
|
53
|
+
if ("id" in action.input) {
|
|
34
54
|
state.issuer.id = action.input.id ? { taxId: action.input.id } : null;
|
|
35
55
|
}
|
|
36
|
-
if (
|
|
37
|
-
state.issuer.name =
|
|
56
|
+
if ("name" in action.input) {
|
|
57
|
+
state.issuer.name =
|
|
58
|
+
action.input.name !== undefined
|
|
59
|
+
? action.input.name
|
|
60
|
+
: (state.issuer.name ?? null);
|
|
38
61
|
}
|
|
39
62
|
},
|
|
40
|
-
editIssuerBankOperation(state, action
|
|
63
|
+
editIssuerBankOperation(state, action) {
|
|
41
64
|
if (!state.issuer.paymentRouting) {
|
|
42
65
|
state.issuer.paymentRouting = {
|
|
43
66
|
bank: null,
|
|
@@ -73,8 +96,8 @@ export const invoicePartiesOperations = {
|
|
|
73
96
|
accountType: getStateValue(action.input.accountTypeIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.accountType ??
|
|
74
97
|
null),
|
|
75
98
|
address: {
|
|
76
|
-
city: getStateValue(action.input.cityIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
|
|
77
|
-
|
|
99
|
+
city: getStateValue(action.input.cityIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address.city ??
|
|
100
|
+
null),
|
|
78
101
|
country: getStateValue(action.input.countryIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
|
|
79
102
|
.country ?? null),
|
|
80
103
|
extendedAddress: getStateValue(action.input.extendedAddressIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
|
|
@@ -95,7 +118,7 @@ export const invoicePartiesOperations = {
|
|
|
95
118
|
},
|
|
96
119
|
};
|
|
97
120
|
},
|
|
98
|
-
editIssuerWalletOperation(state, action
|
|
121
|
+
editIssuerWalletOperation(state, action) {
|
|
99
122
|
if (!state.issuer.paymentRouting) {
|
|
100
123
|
state.issuer.paymentRouting = {
|
|
101
124
|
bank: null,
|
|
@@ -115,42 +138,65 @@ export const invoicePartiesOperations = {
|
|
|
115
138
|
rpc: action.input.rpc ?? state.issuer.paymentRouting.wallet?.rpc ?? null,
|
|
116
139
|
};
|
|
117
140
|
},
|
|
118
|
-
editPayerOperation(state, action
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
141
|
+
editPayerOperation(state, action) {
|
|
142
|
+
if ("address" in state.payer &&
|
|
143
|
+
("city" in action.input ||
|
|
144
|
+
"country" in action.input ||
|
|
145
|
+
"extendedAddress" in action.input ||
|
|
146
|
+
"postalCode" in action.input ||
|
|
147
|
+
"stateProvince" in action.input ||
|
|
148
|
+
"streetAddress" in action.input)) {
|
|
125
149
|
state.payer.address = {
|
|
126
150
|
...state.payer.address,
|
|
127
|
-
city: action.input.city !== undefined
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
151
|
+
city: action.input.city !== undefined
|
|
152
|
+
? action.input.city
|
|
153
|
+
: (state.payer.address?.city ?? null),
|
|
154
|
+
country: action.input.country !== undefined
|
|
155
|
+
? action.input.country
|
|
156
|
+
: (state.payer.address?.country ?? null),
|
|
157
|
+
extendedAddress: action.input.extendedAddress !== undefined
|
|
158
|
+
? action.input.extendedAddress
|
|
159
|
+
: (state.payer.address?.extendedAddress ?? null),
|
|
160
|
+
postalCode: action.input.postalCode !== undefined
|
|
161
|
+
? action.input.postalCode
|
|
162
|
+
: (state.payer.address?.postalCode ?? null),
|
|
163
|
+
stateProvince: action.input.stateProvince !== undefined
|
|
164
|
+
? action.input.stateProvince
|
|
165
|
+
: (state.payer.address?.stateProvince ?? null),
|
|
166
|
+
streetAddress: action.input.streetAddress !== undefined
|
|
167
|
+
? action.input.streetAddress
|
|
168
|
+
: (state.payer.address?.streetAddress ?? null),
|
|
133
169
|
};
|
|
134
170
|
}
|
|
135
|
-
if (
|
|
136
|
-
|
|
171
|
+
if ("contactInfo" in state.payer &&
|
|
172
|
+
("tel" in action.input || "email" in action.input)) {
|
|
137
173
|
state.payer.contactInfo = {
|
|
138
174
|
...state.payer.contactInfo,
|
|
139
|
-
tel: action.input.tel !== undefined
|
|
140
|
-
|
|
175
|
+
tel: action.input.tel !== undefined
|
|
176
|
+
? action.input.tel
|
|
177
|
+
: (state.payer.contactInfo?.tel ?? null),
|
|
178
|
+
email: action.input.email !== undefined
|
|
179
|
+
? action.input.email
|
|
180
|
+
: (state.payer.contactInfo?.email ?? null),
|
|
141
181
|
};
|
|
142
182
|
}
|
|
143
|
-
if (
|
|
144
|
-
state.payer.country =
|
|
183
|
+
if ("country" in action.input) {
|
|
184
|
+
state.payer.country =
|
|
185
|
+
action.input.country !== undefined
|
|
186
|
+
? action.input.country
|
|
187
|
+
: (state.payer.country ?? null);
|
|
145
188
|
}
|
|
146
|
-
if (
|
|
189
|
+
if ("id" in action.input) {
|
|
147
190
|
state.payer.id = action.input.id ? { taxId: action.input.id } : null;
|
|
148
191
|
}
|
|
149
|
-
if (
|
|
150
|
-
state.payer.name =
|
|
192
|
+
if ("name" in action.input) {
|
|
193
|
+
state.payer.name =
|
|
194
|
+
action.input.name !== undefined
|
|
195
|
+
? action.input.name
|
|
196
|
+
: (state.payer.name ?? null);
|
|
151
197
|
}
|
|
152
198
|
},
|
|
153
|
-
editPayerBankOperation(state, action
|
|
199
|
+
editPayerBankOperation(state, action) {
|
|
154
200
|
if (!state.payer.paymentRouting) {
|
|
155
201
|
state.payer.paymentRouting = {
|
|
156
202
|
bank: null,
|
|
@@ -208,7 +254,7 @@ export const invoicePartiesOperations = {
|
|
|
208
254
|
},
|
|
209
255
|
};
|
|
210
256
|
},
|
|
211
|
-
editPayerWalletOperation(state, action
|
|
257
|
+
editPayerWalletOperation(state, action) {
|
|
212
258
|
if (!state.payer.paymentRouting) {
|
|
213
259
|
state.payer.paymentRouting = {
|
|
214
260
|
bank: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transitions.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/src/reducers/transitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,4DAA4D,CAAC;
|
|
1
|
+
{"version":3,"file":"transitions.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/src/reducers/transitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,4DAA4D,CAAC;AAgB/G,eAAO,MAAM,4BAA4B,EAAE,4BA+J1C,CAAC"}
|
|
@@ -4,42 +4,58 @@
|
|
|
4
4
|
* - delete the file and run the code generator again to have it reset
|
|
5
5
|
*/
|
|
6
6
|
import { permittedTransitions } from "../../utils/statusTransitions.js";
|
|
7
|
+
/**
|
|
8
|
+
* Converts a date string to ISO datetime format if it's not already in that format
|
|
9
|
+
* Handles both date-only (YYYY-MM-DD) and datetime (YYYY-MM-DDTHH:mm:ss.sssZ) strings
|
|
10
|
+
*/
|
|
11
|
+
function ensureDatetimeFormat(dateStr) {
|
|
12
|
+
if (!dateStr || dateStr.trim() === "")
|
|
13
|
+
return null;
|
|
14
|
+
// If it's already a datetime string, return as is
|
|
15
|
+
if (dateStr.includes("T"))
|
|
16
|
+
return dateStr;
|
|
17
|
+
// Convert date-only to datetime at midnight UTC
|
|
18
|
+
return `${dateStr}T00:00:00.000Z`;
|
|
19
|
+
}
|
|
7
20
|
export const invoiceTransitionsOperations = {
|
|
8
|
-
cancelOperation(state, action
|
|
9
|
-
if (permittedTransitions[state.status].includes(
|
|
10
|
-
state.status =
|
|
21
|
+
cancelOperation(state, action) {
|
|
22
|
+
if (permittedTransitions[state.status].includes("CANCELLED")) {
|
|
23
|
+
state.status = "CANCELLED";
|
|
11
24
|
}
|
|
12
25
|
else {
|
|
13
26
|
throw new Error(`Invalid transition from ${state.status} to CANCELLED`);
|
|
14
27
|
}
|
|
15
28
|
},
|
|
16
|
-
issueOperation(state, action
|
|
29
|
+
issueOperation(state, action) {
|
|
17
30
|
if (!action.input.invoiceNo || !action.input.dateIssued) {
|
|
18
|
-
throw new Error(
|
|
31
|
+
throw new Error("Invoice number and date issued are required");
|
|
19
32
|
}
|
|
20
|
-
if (permittedTransitions[state.status].includes(
|
|
21
|
-
state.status =
|
|
33
|
+
if (permittedTransitions[state.status].includes("ISSUED")) {
|
|
34
|
+
state.status = "ISSUED";
|
|
22
35
|
state.invoiceNo = action.input.invoiceNo;
|
|
23
|
-
|
|
36
|
+
// Convert date string to datetime format to match Zod schema requirements
|
|
37
|
+
state.dateIssued =
|
|
38
|
+
ensureDatetimeFormat(action.input.dateIssued) ||
|
|
39
|
+
action.input.dateIssued;
|
|
24
40
|
}
|
|
25
41
|
else {
|
|
26
42
|
throw new Error(`Invalid transition from ${state.status} to ISSUED`);
|
|
27
43
|
}
|
|
28
44
|
},
|
|
29
|
-
resetOperation(state, action
|
|
30
|
-
if (permittedTransitions[state.status].includes(
|
|
31
|
-
state.status =
|
|
45
|
+
resetOperation(state, action) {
|
|
46
|
+
if (permittedTransitions[state.status].includes("DRAFT")) {
|
|
47
|
+
state.status = "DRAFT";
|
|
32
48
|
}
|
|
33
49
|
else {
|
|
34
50
|
throw new Error(`Invalid transition from ${state.status} to DRAFT`);
|
|
35
51
|
}
|
|
36
52
|
},
|
|
37
|
-
rejectOperation(state, action
|
|
53
|
+
rejectOperation(state, action) {
|
|
38
54
|
if (!action.input.id || !action.input.reason) {
|
|
39
|
-
throw new Error(
|
|
55
|
+
throw new Error("Reason, ID and final are required");
|
|
40
56
|
}
|
|
41
|
-
if (permittedTransitions[state.status].includes(
|
|
42
|
-
state.status =
|
|
57
|
+
if (permittedTransitions[state.status].includes("REJECTED")) {
|
|
58
|
+
state.status = "REJECTED";
|
|
43
59
|
const rejection = {
|
|
44
60
|
id: action.input.id,
|
|
45
61
|
reason: action.input.reason,
|
|
@@ -51,40 +67,40 @@ export const invoiceTransitionsOperations = {
|
|
|
51
67
|
throw new Error(`Invalid transition from ${state.status} to REJECTED`);
|
|
52
68
|
}
|
|
53
69
|
},
|
|
54
|
-
acceptOperation(state, action
|
|
70
|
+
acceptOperation(state, action) {
|
|
55
71
|
if (!action.input.payAfter) {
|
|
56
|
-
throw new Error(
|
|
72
|
+
throw new Error("Pay after is required");
|
|
57
73
|
}
|
|
58
|
-
if (permittedTransitions[state.status].includes(
|
|
59
|
-
state.status =
|
|
74
|
+
if (permittedTransitions[state.status].includes("ACCEPTED")) {
|
|
75
|
+
state.status = "ACCEPTED";
|
|
60
76
|
state.payAfter = action.input.payAfter;
|
|
61
77
|
}
|
|
62
78
|
else {
|
|
63
79
|
throw new Error(`Invalid transition from ${state.status} to ACCEPTED`);
|
|
64
80
|
}
|
|
65
81
|
},
|
|
66
|
-
reinstateOperation(state, action
|
|
67
|
-
const finalRejection = state.rejections.find(rejection => rejection.final === true);
|
|
82
|
+
reinstateOperation(state, action) {
|
|
83
|
+
const finalRejection = state.rejections.find((rejection) => rejection.final === true);
|
|
68
84
|
if (finalRejection) {
|
|
69
|
-
throw new Error(
|
|
85
|
+
throw new Error("Cannot reinstate an invoice that has been rejected");
|
|
70
86
|
}
|
|
71
|
-
if (permittedTransitions[state.status].includes(
|
|
72
|
-
state.status =
|
|
87
|
+
if (permittedTransitions[state.status].includes("ISSUED")) {
|
|
88
|
+
state.status = "ISSUED";
|
|
73
89
|
}
|
|
74
90
|
else {
|
|
75
91
|
throw new Error(`Invalid transition from ${state.status} to ISSUED`);
|
|
76
92
|
}
|
|
77
93
|
},
|
|
78
|
-
schedulePaymentOperation(state, action
|
|
94
|
+
schedulePaymentOperation(state, action) {
|
|
79
95
|
if (!action.input.id || !action.input.processorRef) {
|
|
80
|
-
throw new Error(
|
|
96
|
+
throw new Error("ID and processorRef are required");
|
|
81
97
|
}
|
|
82
|
-
if (permittedTransitions[state.status].includes(
|
|
83
|
-
state.status =
|
|
98
|
+
if (permittedTransitions[state.status].includes("PAYMENTSCHEDULED")) {
|
|
99
|
+
state.status = "PAYMENTSCHEDULED";
|
|
84
100
|
state.payments.push({
|
|
85
101
|
id: action.input.id,
|
|
86
102
|
processorRef: action.input.processorRef,
|
|
87
|
-
paymentDate:
|
|
103
|
+
paymentDate: new Date().toISOString(),
|
|
88
104
|
txnRef: "",
|
|
89
105
|
confirmed: false,
|
|
90
106
|
issue: "",
|
|
@@ -95,20 +111,20 @@ export const invoiceTransitionsOperations = {
|
|
|
95
111
|
throw new Error(`Invalid transition from ${state.status} to PAYMENTSCHEDULED`);
|
|
96
112
|
}
|
|
97
113
|
},
|
|
98
|
-
reapprovePaymentOperation(state, action
|
|
99
|
-
if (permittedTransitions[state.status].includes(
|
|
100
|
-
state.status =
|
|
114
|
+
reapprovePaymentOperation(state, action) {
|
|
115
|
+
if (permittedTransitions[state.status].includes("ACCEPTED")) {
|
|
116
|
+
state.status = "ACCEPTED";
|
|
101
117
|
}
|
|
102
118
|
else {
|
|
103
119
|
throw new Error(`Invalid transition from ${state.status} to ACCEPTED`);
|
|
104
120
|
}
|
|
105
121
|
},
|
|
106
|
-
registerPaymentTxOperation(state, action
|
|
107
|
-
if (permittedTransitions[state.status].includes(
|
|
108
|
-
state.status =
|
|
109
|
-
const payment = state.payments.find(payment => payment.id === action.input.id);
|
|
122
|
+
registerPaymentTxOperation(state, action) {
|
|
123
|
+
if (permittedTransitions[state.status].includes("PAYMENTSENT")) {
|
|
124
|
+
state.status = "PAYMENTSENT";
|
|
125
|
+
const payment = state.payments.find((payment) => payment.id === action.input.id);
|
|
110
126
|
if (!payment)
|
|
111
|
-
throw new Error(
|
|
127
|
+
throw new Error("Payment not found");
|
|
112
128
|
payment.txnRef = action.input.txRef;
|
|
113
129
|
payment.paymentDate = action.input.timestamp;
|
|
114
130
|
}
|
|
@@ -116,30 +132,30 @@ export const invoiceTransitionsOperations = {
|
|
|
116
132
|
throw new Error(`Invalid transition from ${state.status} to PAYMENTSENT`);
|
|
117
133
|
}
|
|
118
134
|
},
|
|
119
|
-
reportPaymentIssueOperation(state, action
|
|
135
|
+
reportPaymentIssueOperation(state, action) {
|
|
120
136
|
if (!action.input.id || !action.input.issue) {
|
|
121
|
-
throw new Error(
|
|
137
|
+
throw new Error("ID and issue are required");
|
|
122
138
|
}
|
|
123
|
-
if (permittedTransitions[state.status].includes(
|
|
124
|
-
state.status =
|
|
125
|
-
const payment = state.payments.find(payment => payment.id === action.input.id);
|
|
139
|
+
if (permittedTransitions[state.status].includes("PAYMENTISSUE")) {
|
|
140
|
+
state.status = "PAYMENTISSUE";
|
|
141
|
+
const payment = state.payments.find((payment) => payment.id === action.input.id);
|
|
126
142
|
if (!payment)
|
|
127
|
-
throw new Error(
|
|
143
|
+
throw new Error("Payment not found");
|
|
128
144
|
payment.issue = action.input.issue;
|
|
129
145
|
}
|
|
130
146
|
else {
|
|
131
147
|
throw new Error(`Invalid transition from ${state.status} to PAYMENTISSUE`);
|
|
132
148
|
}
|
|
133
149
|
},
|
|
134
|
-
confirmPaymentOperation(state, action
|
|
150
|
+
confirmPaymentOperation(state, action) {
|
|
135
151
|
if (!action.input.id || !action.input.amount) {
|
|
136
|
-
throw new Error(
|
|
152
|
+
throw new Error("ID and amount are required");
|
|
137
153
|
}
|
|
138
|
-
if (permittedTransitions[state.status].includes(
|
|
139
|
-
state.status =
|
|
140
|
-
const payment = state.payments.find(payment => payment.id === action.input.id);
|
|
154
|
+
if (permittedTransitions[state.status].includes("PAYMENTRECEIVED")) {
|
|
155
|
+
state.status = "PAYMENTRECEIVED";
|
|
156
|
+
const payment = state.payments.find((payment) => payment.id === action.input.id);
|
|
141
157
|
if (!payment)
|
|
142
|
-
throw new Error(
|
|
158
|
+
throw new Error("Payment not found");
|
|
143
159
|
payment.confirmed = true;
|
|
144
160
|
payment.amount = action.input.amount;
|
|
145
161
|
}
|
|
@@ -147,12 +163,12 @@ export const invoiceTransitionsOperations = {
|
|
|
147
163
|
throw new Error(`Invalid transition from ${state.status} to PAYMENTRECEIVED`);
|
|
148
164
|
}
|
|
149
165
|
},
|
|
150
|
-
closePaymentOperation(state, action
|
|
166
|
+
closePaymentOperation(state, action) {
|
|
151
167
|
if (!action.input.closureReason) {
|
|
152
|
-
throw new Error(
|
|
168
|
+
throw new Error("Closure reason is required");
|
|
153
169
|
}
|
|
154
|
-
if (permittedTransitions[state.status].includes(
|
|
155
|
-
state.status =
|
|
170
|
+
if (permittedTransitions[state.status].includes("PAYMENTCLOSED")) {
|
|
171
|
+
state.status = "PAYMENTCLOSED";
|
|
156
172
|
state.closureReason = action.input.closureReason;
|
|
157
173
|
}
|
|
158
174
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-model.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/src/tests/document-model.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
1
|
+
{"version":3,"file":"document-model.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/src/tests/document-model.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;;GAGG"}
|
|
@@ -2,16 +2,103 @@
|
|
|
2
2
|
* This is a scaffold file meant for customization:
|
|
3
3
|
* - change it by adding new tests or modifying the existing ones
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* This is a scaffold file meant for customization:
|
|
7
|
+
* - change it by adding new tests or modifying the existing ones
|
|
8
|
+
*/
|
|
9
|
+
import { describe, it, expect } from "vitest";
|
|
10
|
+
import { utils, initialGlobalState, initialLocalState, invoiceDocumentType, isInvoiceDocument, assertIsInvoiceDocument, isInvoiceState, assertIsInvoiceState, } from "@powerhousedao/contributor-billing/document-models/invoice";
|
|
11
|
+
import { ZodError } from "zod";
|
|
6
12
|
describe("Invoice Document Model", () => {
|
|
7
13
|
it("should create a new Invoice document", () => {
|
|
8
|
-
const document = createDocument();
|
|
14
|
+
const document = utils.createDocument();
|
|
9
15
|
expect(document).toBeDefined();
|
|
10
|
-
expect(document.header
|
|
16
|
+
expect(document.header.documentType).toBe(invoiceDocumentType);
|
|
11
17
|
});
|
|
12
18
|
it("should create a new Invoice document with a valid initial state", () => {
|
|
13
|
-
const document = createDocument();
|
|
19
|
+
const document = utils.createDocument();
|
|
14
20
|
expect(document.state.global).toStrictEqual(initialGlobalState);
|
|
15
21
|
expect(document.state.local).toStrictEqual(initialLocalState);
|
|
22
|
+
expect(isInvoiceDocument(document)).toBe(true);
|
|
23
|
+
expect(isInvoiceState(document.state)).toBe(true);
|
|
24
|
+
});
|
|
25
|
+
it("should reject a document that is not a Invoice document", () => {
|
|
26
|
+
const wrongDocumentType = utils.createDocument();
|
|
27
|
+
wrongDocumentType.header.documentType = "the-wrong-thing-1234";
|
|
28
|
+
try {
|
|
29
|
+
expect(assertIsInvoiceDocument(wrongDocumentType)).toThrow();
|
|
30
|
+
expect(isInvoiceDocument(wrongDocumentType)).toBe(false);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
expect(error).toBeInstanceOf(ZodError);
|
|
34
|
+
}
|
|
16
35
|
});
|
|
36
|
+
const wrongState = utils.createDocument();
|
|
37
|
+
// @ts-expect-error - we are testing the error case
|
|
38
|
+
wrongState.state.global = {
|
|
39
|
+
...{ notWhat: "you want" },
|
|
40
|
+
};
|
|
41
|
+
try {
|
|
42
|
+
expect(isInvoiceState(wrongState.state)).toBe(false);
|
|
43
|
+
expect(assertIsInvoiceState(wrongState.state)).toThrow();
|
|
44
|
+
expect(isInvoiceDocument(wrongState)).toBe(false);
|
|
45
|
+
expect(assertIsInvoiceDocument(wrongState)).toThrow();
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
expect(error).toBeInstanceOf(ZodError);
|
|
49
|
+
}
|
|
50
|
+
const wrongInitialState = utils.createDocument();
|
|
51
|
+
// @ts-expect-error - we are testing the error case
|
|
52
|
+
wrongInitialState.initialState.global = {
|
|
53
|
+
...{ notWhat: "you want" },
|
|
54
|
+
};
|
|
55
|
+
try {
|
|
56
|
+
expect(isInvoiceState(wrongInitialState.state)).toBe(false);
|
|
57
|
+
expect(assertIsInvoiceState(wrongInitialState.state)).toThrow();
|
|
58
|
+
expect(isInvoiceDocument(wrongInitialState)).toBe(false);
|
|
59
|
+
expect(assertIsInvoiceDocument(wrongInitialState)).toThrow();
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
expect(error).toBeInstanceOf(ZodError);
|
|
63
|
+
}
|
|
64
|
+
const missingIdInHeader = utils.createDocument();
|
|
65
|
+
// @ts-expect-error - we are testing the error case
|
|
66
|
+
delete missingIdInHeader.header.id;
|
|
67
|
+
try {
|
|
68
|
+
expect(isInvoiceDocument(missingIdInHeader)).toBe(false);
|
|
69
|
+
expect(assertIsInvoiceDocument(missingIdInHeader)).toThrow();
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
expect(error).toBeInstanceOf(ZodError);
|
|
73
|
+
}
|
|
74
|
+
const missingNameInHeader = utils.createDocument();
|
|
75
|
+
// @ts-expect-error - we are testing the error case
|
|
76
|
+
delete missingNameInHeader.header.name;
|
|
77
|
+
try {
|
|
78
|
+
expect(isInvoiceDocument(missingNameInHeader)).toBe(false);
|
|
79
|
+
expect(assertIsInvoiceDocument(missingNameInHeader)).toThrow();
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
expect(error).toBeInstanceOf(ZodError);
|
|
83
|
+
}
|
|
84
|
+
const missingCreatedAtUtcIsoInHeader = utils.createDocument();
|
|
85
|
+
// @ts-expect-error - we are testing the error case
|
|
86
|
+
delete missingCreatedAtUtcIsoInHeader.header.createdAtUtcIso;
|
|
87
|
+
try {
|
|
88
|
+
expect(isInvoiceDocument(missingCreatedAtUtcIsoInHeader)).toBe(false);
|
|
89
|
+
expect(assertIsInvoiceDocument(missingCreatedAtUtcIsoInHeader)).toThrow();
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
expect(error).toBeInstanceOf(ZodError);
|
|
93
|
+
}
|
|
94
|
+
const missingLastModifiedAtUtcIsoInHeader = utils.createDocument();
|
|
95
|
+
// @ts-expect-error - we are testing the error case
|
|
96
|
+
delete missingLastModifiedAtUtcIsoInHeader.header.lastModifiedAtUtcIso;
|
|
97
|
+
try {
|
|
98
|
+
expect(isInvoiceDocument(missingLastModifiedAtUtcIsoInHeader)).toBe(false);
|
|
99
|
+
expect(assertIsInvoiceDocument(missingLastModifiedAtUtcIsoInHeader)).toThrow();
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
expect(error).toBeInstanceOf(ZodError);
|
|
103
|
+
}
|
|
17
104
|
});
|
|
@@ -2,50 +2,48 @@
|
|
|
2
2
|
* This is a scaffold file meant for customization:
|
|
3
3
|
* - change it by adding new tests or modifying the existing ones
|
|
4
4
|
*/
|
|
5
|
+
import { describe, it, expect } from "vitest";
|
|
5
6
|
import { generateMock } from "@powerhousedao/codegen";
|
|
6
|
-
import
|
|
7
|
-
import { EditInvoiceInputSchema, EditStatusInputSchema, } from "../../gen/schema/index.js";
|
|
8
|
-
import { reducer } from "../../gen/reducer.js";
|
|
9
|
-
import * as creators from "../../gen/general/creators.js";
|
|
7
|
+
import { reducer, utils, isInvoiceDocument, editInvoice, EditInvoiceInputSchema, editStatus, EditStatusInputSchema, editPaymentData, EditPaymentDataInputSchema, setExportedData, SetExportedDataInputSchema, } from "@powerhousedao/contributor-billing/document-models/invoice";
|
|
10
8
|
describe("General Operations", () => {
|
|
11
|
-
let document;
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
document = utils.createDocument();
|
|
14
|
-
});
|
|
15
9
|
it("should handle editInvoice operation", () => {
|
|
10
|
+
const document = utils.createDocument();
|
|
16
11
|
const input = generateMock(EditInvoiceInputSchema());
|
|
17
|
-
const updatedDocument = reducer(document,
|
|
12
|
+
const updatedDocument = reducer(document, editInvoice(input));
|
|
13
|
+
expect(isInvoiceDocument(updatedDocument)).toBe(true);
|
|
18
14
|
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
19
|
-
expect(updatedDocument.operations.global[0].type).toBe("EDIT_INVOICE");
|
|
20
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
15
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("EDIT_INVOICE");
|
|
16
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
21
17
|
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
22
18
|
});
|
|
23
19
|
it("should handle editStatus operation", () => {
|
|
20
|
+
const document = utils.createDocument();
|
|
24
21
|
const input = generateMock(EditStatusInputSchema());
|
|
25
|
-
const updatedDocument = reducer(document,
|
|
22
|
+
const updatedDocument = reducer(document, editStatus(input));
|
|
23
|
+
expect(isInvoiceDocument(updatedDocument)).toBe(true);
|
|
26
24
|
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
27
|
-
expect(updatedDocument.operations.global[0].type).toBe("EDIT_STATUS");
|
|
28
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
25
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("EDIT_STATUS");
|
|
26
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
29
27
|
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
30
28
|
});
|
|
31
29
|
it("should handle editPaymentData operation", () => {
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const updatedDocument = reducer(
|
|
30
|
+
const document = utils.createDocument();
|
|
31
|
+
const input = generateMock(EditPaymentDataInputSchema());
|
|
32
|
+
const updatedDocument = reducer(document, editPaymentData(input));
|
|
33
|
+
expect(isInvoiceDocument(updatedDocument)).toBe(true);
|
|
35
34
|
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
36
|
-
expect(updatedDocument.operations.global[0].type).toBe("EDIT_PAYMENT_DATA");
|
|
37
|
-
expect(updatedDocument.operations.global[0].input).
|
|
35
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("EDIT_PAYMENT_DATA");
|
|
36
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
38
37
|
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
39
38
|
});
|
|
40
39
|
it("should handle setExportedData operation", () => {
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const updatedDocument = reducer(document, creators.setExportedData(input));
|
|
40
|
+
const document = utils.createDocument();
|
|
41
|
+
const input = generateMock(SetExportedDataInputSchema());
|
|
42
|
+
const updatedDocument = reducer(document, setExportedData(input));
|
|
43
|
+
expect(isInvoiceDocument(updatedDocument)).toBe(true);
|
|
46
44
|
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
47
|
-
expect(updatedDocument.operations.global[0].type).toBe("SET_EXPORTED_DATA");
|
|
48
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
45
|
+
expect(updatedDocument.operations.global[0].action.type).toBe("SET_EXPORTED_DATA");
|
|
46
|
+
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
49
47
|
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
50
48
|
});
|
|
51
49
|
});
|