@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.
Files changed (390) hide show
  1. package/README.md +165 -8
  2. package/dist/document-models/billing-statement/actions.d.ts +1 -0
  3. package/dist/document-models/billing-statement/actions.d.ts.map +1 -1
  4. package/dist/document-models/billing-statement/gen/document-model.d.ts.map +1 -1
  5. package/dist/document-models/billing-statement/gen/document-model.js +58 -47
  6. package/dist/document-models/billing-statement/gen/document-schema.d.ts +38 -38
  7. package/dist/document-models/billing-statement/gen/document-schema.d.ts.map +1 -1
  8. package/dist/document-models/billing-statement/gen/line-items/actions.d.ts +6 -2
  9. package/dist/document-models/billing-statement/gen/line-items/actions.d.ts.map +1 -1
  10. package/dist/document-models/billing-statement/gen/line-items/creators.d.ts +3 -2
  11. package/dist/document-models/billing-statement/gen/line-items/creators.d.ts.map +1 -1
  12. package/dist/document-models/billing-statement/gen/line-items/creators.js +2 -1
  13. package/dist/document-models/billing-statement/gen/line-items/operations.d.ts +2 -1
  14. package/dist/document-models/billing-statement/gen/line-items/operations.d.ts.map +1 -1
  15. package/dist/document-models/billing-statement/gen/ph-factories.js +1 -1
  16. package/dist/document-models/billing-statement/gen/reducer.d.ts.map +1 -1
  17. package/dist/document-models/billing-statement/gen/reducer.js +5 -1
  18. package/dist/document-models/billing-statement/gen/schema/types.d.ts +3 -0
  19. package/dist/document-models/billing-statement/gen/schema/types.d.ts.map +1 -1
  20. package/dist/document-models/billing-statement/gen/schema/zod.d.ts +2 -1
  21. package/dist/document-models/billing-statement/gen/schema/zod.d.ts.map +1 -1
  22. package/dist/document-models/billing-statement/gen/schema/zod.js +5 -0
  23. package/dist/document-models/billing-statement/gen/utils.js +2 -2
  24. package/dist/document-models/billing-statement/src/reducers/general.d.ts.map +1 -1
  25. package/dist/document-models/billing-statement/src/reducers/general.js +5 -4
  26. package/dist/document-models/billing-statement/src/reducers/line-items.d.ts.map +1 -1
  27. package/dist/document-models/billing-statement/src/reducers/line-items.js +7 -2
  28. package/dist/document-models/billing-statement/src/reducers/tags.d.ts.map +1 -1
  29. package/dist/document-models/billing-statement/src/reducers/tags.js +1 -1
  30. package/dist/document-models/billing-statement/src/tests/document-model.test.d.ts +4 -0
  31. package/dist/document-models/billing-statement/src/tests/document-model.test.d.ts.map +1 -1
  32. package/dist/document-models/billing-statement/src/tests/document-model.test.js +94 -7
  33. package/dist/document-models/billing-statement/src/tests/general.test.d.ts +2 -1
  34. package/dist/document-models/billing-statement/src/tests/general.test.d.ts.map +1 -1
  35. package/dist/document-models/billing-statement/src/tests/general.test.js +33 -88
  36. package/dist/document-models/billing-statement/src/tests/line-items.test.js +22 -125
  37. package/dist/document-models/billing-statement/src/tests/tags.test.js +13 -47
  38. package/dist/document-models/document-models.js +2 -2
  39. package/dist/document-models/expense-report/gen/document-model.d.ts.map +1 -1
  40. package/dist/document-models/expense-report/gen/document-model.js +48 -48
  41. package/dist/document-models/expense-report/gen/document-schema.d.ts +6 -6
  42. package/dist/document-models/expense-report/gen/utils.js +1 -1
  43. package/dist/document-models/expense-report/src/tests/document-model.test.d.ts +4 -0
  44. package/dist/document-models/expense-report/src/tests/document-model.test.d.ts.map +1 -1
  45. package/dist/document-models/expense-report/src/tests/document-model.test.js +94 -8
  46. package/dist/document-models/expense-report/src/tests/wallet.test.js +145 -10
  47. package/dist/document-models/index.d.ts +2 -6
  48. package/dist/document-models/index.d.ts.map +1 -1
  49. package/dist/document-models/index.js +2 -6
  50. package/dist/document-models/integrations/gen/document-model.js +33 -33
  51. package/dist/document-models/integrations/gen/document-schema.d.ts +6 -6
  52. package/dist/document-models/integrations/gen/utils.js +1 -1
  53. package/dist/document-models/integrations/src/reducers/integrations.d.ts.map +1 -1
  54. package/dist/document-models/integrations/src/reducers/integrations.js +9 -32
  55. package/dist/document-models/integrations/src/tests/document-model.test.d.ts +4 -0
  56. package/dist/document-models/integrations/src/tests/document-model.test.d.ts.map +1 -1
  57. package/dist/document-models/integrations/src/tests/document-model.test.js +91 -5
  58. package/dist/document-models/integrations/src/tests/integrations.test.js +21 -46
  59. package/dist/document-models/invoice/gen/document-model.js +147 -147
  60. package/dist/document-models/invoice/gen/document-schema.d.ts +127 -127
  61. package/dist/document-models/invoice/gen/document-schema.d.ts.map +1 -1
  62. package/dist/document-models/invoice/gen/ph-factories.d.ts.map +1 -1
  63. package/dist/document-models/invoice/gen/ph-factories.js +16 -122
  64. package/dist/document-models/invoice/gen/schema/types.d.ts +4 -4
  65. package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
  66. package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
  67. package/dist/document-models/invoice/gen/schema/zod.js +4 -4
  68. package/dist/document-models/invoice/gen/utils.d.ts.map +1 -1
  69. package/dist/document-models/invoice/gen/utils.js +17 -123
  70. package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -1
  71. package/dist/document-models/invoice/src/reducers/general.js +34 -10
  72. package/dist/document-models/invoice/src/reducers/items.d.ts.map +1 -1
  73. package/dist/document-models/invoice/src/reducers/items.js +7 -7
  74. package/dist/document-models/invoice/src/reducers/parties.d.ts.map +1 -1
  75. package/dist/document-models/invoice/src/reducers/parties.js +96 -50
  76. package/dist/document-models/invoice/src/reducers/transitions.d.ts.map +1 -1
  77. package/dist/document-models/invoice/src/reducers/transitions.js +69 -53
  78. package/dist/document-models/invoice/src/tests/document-model.test.d.ts +4 -0
  79. package/dist/document-models/invoice/src/tests/document-model.test.d.ts.map +1 -1
  80. package/dist/document-models/invoice/src/tests/document-model.test.js +91 -4
  81. package/dist/document-models/invoice/src/tests/general.test.js +24 -26
  82. package/dist/document-models/invoice/src/tests/items.test.js +37 -17
  83. package/dist/document-models/invoice/src/tests/parties.test.js +32 -26
  84. package/dist/document-models/invoice/src/tests/transitions.test.js +52 -500
  85. package/dist/document-models/invoice/utils/statusTransitions.d.ts.map +1 -1
  86. package/dist/document-models/invoice/utils/statusTransitions.js +10 -10
  87. package/dist/editors/billing-statement/components/lineItemsTable.d.ts.map +1 -1
  88. package/dist/editors/billing-statement/components/lineItemsTable.js +32 -23
  89. package/dist/editors/billing-statement/components/objectSetTable.d.ts.map +1 -1
  90. package/dist/editors/billing-statement/components/objectSetTable.js +1 -2
  91. package/dist/editors/billing-statement/editor.d.ts +4 -0
  92. package/dist/editors/billing-statement/editor.d.ts.map +1 -1
  93. package/dist/editors/billing-statement/editor.js +34 -16
  94. package/dist/editors/billing-statement/lineItemTags/lineItemTags.d.ts.map +1 -1
  95. package/dist/editors/billing-statement/lineItemTags/lineItemTags.js +36 -37
  96. package/dist/editors/billing-statement/lineItemTags/tagMapping.d.ts.map +1 -1
  97. package/dist/editors/billing-statement/lineItemTags/tagMapping.js +28 -10
  98. package/dist/editors/clean-new-editor/components/CreateDocument.d.ts +6 -0
  99. package/dist/editors/clean-new-editor/components/CreateDocument.d.ts.map +1 -0
  100. package/dist/editors/clean-new-editor/components/CreateDocument.js +18 -0
  101. package/dist/editors/clean-new-editor/components/DriveContents.d.ts +3 -0
  102. package/dist/editors/clean-new-editor/components/DriveContents.d.ts.map +1 -0
  103. package/dist/editors/clean-new-editor/components/DriveContents.js +10 -0
  104. package/dist/editors/clean-new-editor/components/DriveExplorer.d.ts +7 -0
  105. package/dist/editors/clean-new-editor/components/DriveExplorer.d.ts.map +1 -0
  106. package/dist/editors/clean-new-editor/components/DriveExplorer.js +16 -0
  107. package/dist/editors/clean-new-editor/components/EmptyState.d.ts +3 -0
  108. package/dist/editors/clean-new-editor/components/EmptyState.d.ts.map +1 -0
  109. package/dist/editors/clean-new-editor/components/EmptyState.js +10 -0
  110. package/dist/editors/clean-new-editor/components/Files.d.ts +3 -0
  111. package/dist/editors/clean-new-editor/components/Files.d.ts.map +1 -0
  112. package/dist/editors/clean-new-editor/components/Files.js +12 -0
  113. package/dist/editors/clean-new-editor/components/FolderTree.d.ts +6 -0
  114. package/dist/editors/clean-new-editor/components/FolderTree.d.ts.map +1 -0
  115. package/dist/editors/clean-new-editor/components/FolderTree.js +65 -0
  116. package/dist/editors/clean-new-editor/components/Folders.d.ts +3 -0
  117. package/dist/editors/clean-new-editor/components/Folders.d.ts.map +1 -0
  118. package/dist/editors/clean-new-editor/components/Folders.js +12 -0
  119. package/dist/editors/clean-new-editor/components/NavigationBreadcrumbs.d.ts +3 -0
  120. package/dist/editors/clean-new-editor/components/NavigationBreadcrumbs.d.ts.map +1 -0
  121. package/dist/editors/clean-new-editor/components/NavigationBreadcrumbs.js +6 -0
  122. package/dist/editors/clean-new-editor/config.d.ts +4 -0
  123. package/dist/editors/clean-new-editor/config.d.ts.map +1 -0
  124. package/dist/editors/clean-new-editor/config.js +5 -0
  125. package/dist/editors/clean-new-editor/editor.d.ts +4 -0
  126. package/dist/editors/clean-new-editor/editor.d.ts.map +1 -0
  127. package/dist/editors/clean-new-editor/editor.js +11 -0
  128. package/dist/editors/clean-new-editor/module.d.ts +3 -0
  129. package/dist/editors/clean-new-editor/module.d.ts.map +1 -0
  130. package/dist/editors/clean-new-editor/module.js +10 -0
  131. package/dist/editors/contributor-billing/components/ConfirmationModal.d.ts +14 -0
  132. package/dist/editors/contributor-billing/components/ConfirmationModal.d.ts.map +1 -0
  133. package/dist/editors/contributor-billing/components/ConfirmationModal.js +6 -0
  134. package/dist/editors/contributor-billing/components/CreateDocument.d.ts +6 -0
  135. package/dist/editors/contributor-billing/components/CreateDocument.d.ts.map +1 -0
  136. package/dist/editors/contributor-billing/components/CreateDocument.js +18 -0
  137. package/dist/editors/contributor-billing/components/DriveContents.d.ts +3 -0
  138. package/dist/editors/contributor-billing/components/DriveContents.d.ts.map +1 -0
  139. package/dist/editors/contributor-billing/components/DriveContents.js +10 -0
  140. package/dist/editors/contributor-billing/components/DriveExplorer.d.ts +3 -3
  141. package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
  142. package/dist/editors/contributor-billing/components/DriveExplorer.js +13 -180
  143. package/dist/editors/contributor-billing/components/EmptyState.d.ts +3 -0
  144. package/dist/editors/contributor-billing/components/EmptyState.d.ts.map +1 -0
  145. package/dist/editors/contributor-billing/components/EmptyState.js +10 -0
  146. package/dist/editors/contributor-billing/components/Files.d.ts +3 -0
  147. package/dist/editors/contributor-billing/components/Files.d.ts.map +1 -0
  148. package/dist/editors/contributor-billing/components/Files.js +12 -0
  149. package/dist/editors/contributor-billing/components/FolderTree.d.ts +6 -0
  150. package/dist/editors/contributor-billing/components/FolderTree.d.ts.map +1 -0
  151. package/dist/editors/contributor-billing/components/FolderTree.js +65 -0
  152. package/dist/editors/contributor-billing/components/Folders.d.ts +3 -0
  153. package/dist/editors/contributor-billing/components/Folders.d.ts.map +1 -0
  154. package/dist/editors/contributor-billing/components/Folders.js +12 -0
  155. package/dist/editors/contributor-billing/components/HeaderControls.d.ts +38 -0
  156. package/dist/editors/contributor-billing/components/HeaderControls.d.ts.map +1 -0
  157. package/dist/editors/contributor-billing/components/HeaderControls.js +124 -0
  158. package/dist/editors/contributor-billing/components/HeaderStats.d.ts.map +1 -0
  159. package/dist/editors/contributor-billing/components/{InvoiceTable/HeaderStats.js → HeaderStats.js} +1 -1
  160. package/dist/editors/contributor-billing/components/InvoiceTable.d.ts +22 -0
  161. package/dist/editors/contributor-billing/components/InvoiceTable.d.ts.map +1 -0
  162. package/dist/editors/contributor-billing/components/InvoiceTable.js +399 -0
  163. package/dist/editors/contributor-billing/components/InvoiceTableContainer.d.ts +6 -0
  164. package/dist/editors/contributor-billing/components/InvoiceTableContainer.d.ts.map +1 -0
  165. package/dist/editors/contributor-billing/components/InvoiceTableContainer.js +111 -0
  166. package/dist/editors/contributor-billing/components/InvoiceTableRow.d.ts +32 -0
  167. package/dist/editors/contributor-billing/components/InvoiceTableRow.d.ts.map +1 -0
  168. package/dist/editors/contributor-billing/components/InvoiceTableRow.js +55 -0
  169. package/dist/editors/contributor-billing/components/InvoiceTableSection.d.ts +13 -0
  170. package/dist/editors/contributor-billing/components/InvoiceTableSection.d.ts.map +1 -0
  171. package/dist/editors/contributor-billing/components/InvoiceTableSection.js +16 -0
  172. package/dist/editors/contributor-billing/components/NavigationBreadcrumbs.d.ts +3 -0
  173. package/dist/editors/contributor-billing/components/NavigationBreadcrumbs.d.ts.map +1 -0
  174. package/dist/editors/contributor-billing/components/NavigationBreadcrumbs.js +6 -0
  175. package/dist/editors/contributor-billing/config.d.ts +1 -0
  176. package/dist/editors/contributor-billing/config.d.ts.map +1 -1
  177. package/dist/editors/contributor-billing/config.js +4 -1
  178. package/dist/editors/contributor-billing/editor.d.ts +1 -0
  179. package/dist/editors/contributor-billing/editor.d.ts.map +1 -1
  180. package/dist/editors/contributor-billing/editor.js +4 -1
  181. package/dist/editors/contributor-billing/module.d.ts +1 -1
  182. package/dist/editors/contributor-billing/module.d.ts.map +1 -1
  183. package/dist/editors/contributor-billing/module.js +3 -2
  184. package/dist/editors/contributor-billing/utils/exchangeRate.d.ts +15 -0
  185. package/dist/editors/contributor-billing/utils/exchangeRate.d.ts.map +1 -0
  186. package/dist/editors/contributor-billing/utils/exchangeRate.js +122 -0
  187. package/dist/editors/editors.js +2 -2
  188. package/dist/editors/expense-report/components/AddBillingStatementModal.d.ts.map +1 -1
  189. package/dist/editors/expense-report/editor.js +8 -8
  190. package/dist/editors/index.d.ts +2 -2
  191. package/dist/editors/index.d.ts.map +1 -1
  192. package/dist/editors/index.js +2 -2
  193. package/dist/editors/integrations/components/EditName.d.ts +3 -0
  194. package/dist/editors/integrations/components/EditName.d.ts.map +1 -0
  195. package/dist/editors/integrations/components/EditName.js +31 -0
  196. package/dist/editors/integrations/editor.d.ts +2 -4
  197. package/dist/editors/integrations/editor.d.ts.map +1 -1
  198. package/dist/editors/integrations/editor.js +5 -132
  199. package/dist/editors/integrations/module.d.ts +1 -0
  200. package/dist/editors/integrations/module.d.ts.map +1 -1
  201. package/dist/editors/integrations/module.js +3 -2
  202. package/dist/editors/invoice/components/confirmationModal.js +1 -1
  203. package/dist/editors/invoice/components/countryForm.d.ts.map +1 -1
  204. package/dist/editors/invoice/components/countryForm.js +1 -1
  205. package/dist/editors/invoice/components/currencyForm.d.ts.map +1 -1
  206. package/dist/editors/invoice/components/currencyForm.js +1 -1
  207. package/dist/editors/invoice/components/datePicker.d.ts +1 -1
  208. package/dist/editors/invoice/components/datePicker.d.ts.map +1 -1
  209. package/dist/editors/invoice/components/datePicker.js +1 -1
  210. package/dist/editors/invoice/components/inputField.d.ts.map +1 -1
  211. package/dist/editors/invoice/components/inputField.js +3 -2
  212. package/dist/editors/invoice/components/lineItemMobileModal.d.ts.map +1 -1
  213. package/dist/editors/invoice/components/lineItemMobileModal.js +1 -1
  214. package/dist/editors/invoice/components/numberForm.d.ts.map +1 -1
  215. package/dist/editors/invoice/components/selectField.js +7 -7
  216. package/dist/editors/invoice/components/statusModalComponents.d.ts.map +1 -1
  217. package/dist/editors/invoice/components/statusModalComponents.js +27 -3
  218. package/dist/editors/invoice/editor.d.ts +1 -4
  219. package/dist/editors/invoice/editor.d.ts.map +1 -1
  220. package/dist/editors/invoice/editor.js +102 -40
  221. package/dist/editors/invoice/exportUBL.d.ts.map +1 -1
  222. package/dist/editors/invoice/exportUBL.js +35 -18
  223. package/dist/editors/invoice/ingestPDF.d.ts.map +1 -1
  224. package/dist/editors/invoice/ingestPDF.js +15 -9
  225. package/dist/editors/invoice/invoiceToGnosis.js +2 -2
  226. package/dist/editors/invoice/legalEntity/bankSection.d.ts.map +1 -1
  227. package/dist/editors/invoice/legalEntity/bankSection.js +19 -10
  228. package/dist/editors/invoice/legalEntity/legalEntity.d.ts +4 -0
  229. package/dist/editors/invoice/legalEntity/legalEntity.d.ts.map +1 -1
  230. package/dist/editors/invoice/legalEntity/legalEntity.js +66 -2
  231. package/dist/editors/invoice/legalEntity/walletSection.d.ts.map +1 -1
  232. package/dist/editors/invoice/legalEntity/walletSection.js +3 -3
  233. package/dist/editors/invoice/lineItemTags/lineItemTags.d.ts.map +1 -1
  234. package/dist/editors/invoice/lineItemTags/lineItemTags.js +1 -1
  235. package/dist/editors/invoice/lineItemTags/tagMobileModal.d.ts.map +1 -1
  236. package/dist/editors/invoice/lineItemTags/tagMobileModal.js +4 -3
  237. package/dist/editors/invoice/lineItems.d.ts.map +1 -1
  238. package/dist/editors/invoice/module.d.ts +1 -0
  239. package/dist/editors/invoice/module.d.ts.map +1 -1
  240. package/dist/editors/invoice/module.js +2 -1
  241. package/dist/editors/invoice/requestFinance.js +3 -3
  242. package/dist/editors/invoice/uploadPdfChunked.d.ts.map +1 -1
  243. package/dist/editors/invoice/uploadPdfChunked.js +5 -4
  244. package/dist/editors/invoice/utils/utils.d.ts.map +1 -1
  245. package/dist/editors/invoice/utils/utils.js +5 -4
  246. package/dist/editors/invoice/validation/validationHandler.d.ts.map +1 -1
  247. package/dist/editors/invoice/validation/validationHandler.js +11 -5
  248. package/dist/editors/invoice/validation/validationManager.d.ts +2 -2
  249. package/dist/editors/invoice/validation/validationManager.d.ts.map +1 -1
  250. package/dist/editors/invoice/validation/validationManager.js +5 -5
  251. package/dist/editors/invoice/validation/validationRules.d.ts.map +1 -1
  252. package/dist/editors/invoice/validation/validationRules.js +178 -178
  253. package/dist/index.d.ts +2 -2
  254. package/dist/index.d.ts.map +1 -1
  255. package/dist/index.js +4 -2
  256. package/dist/old-contributor-billing/components/DriveExplorer.d.ts +7 -0
  257. package/dist/old-contributor-billing/components/DriveExplorer.d.ts.map +1 -0
  258. package/dist/old-contributor-billing/components/DriveExplorer.js +184 -0
  259. package/dist/old-contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -0
  260. package/dist/old-contributor-billing/components/InvoiceTable/HeaderStats.d.ts +2 -0
  261. package/dist/old-contributor-billing/components/InvoiceTable/HeaderStats.d.ts.map +1 -0
  262. package/dist/old-contributor-billing/components/InvoiceTable/HeaderStats.js +73 -0
  263. package/dist/old-contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -0
  264. package/dist/old-contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -0
  265. package/dist/old-contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts.map +1 -0
  266. package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTableSection.js +1 -1
  267. package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/RowActionMenu.d.ts +1 -1
  268. package/dist/old-contributor-billing/components/InvoiceTable/RowActionMenu.d.ts.map +1 -0
  269. package/dist/old-contributor-billing/components/InvoiceTable/RowActionMenu.js +2 -0
  270. package/dist/old-contributor-billing/config.d.ts +3 -0
  271. package/dist/old-contributor-billing/config.d.ts.map +1 -0
  272. package/dist/old-contributor-billing/config.js +4 -0
  273. package/dist/old-contributor-billing/editor.d.ts +3 -0
  274. package/dist/old-contributor-billing/editor.d.ts.map +1 -0
  275. package/dist/old-contributor-billing/editor.js +8 -0
  276. package/dist/old-contributor-billing/module.d.ts +3 -0
  277. package/dist/old-contributor-billing/module.d.ts.map +1 -0
  278. package/dist/old-contributor-billing/module.js +9 -0
  279. package/dist/old-contributor-billing/util.d.ts.map +1 -0
  280. package/dist/{editors/contributor-billing → old-contributor-billing}/util.js +11 -9
  281. package/dist/powerhouse.manifest.json +6 -41
  282. package/dist/processors/index.d.ts +1 -6
  283. package/dist/processors/index.d.ts.map +1 -1
  284. package/dist/processors/index.js +1 -18
  285. package/dist/scripts/contributor-billing/createExpenseReportCsv.d.ts.map +1 -1
  286. package/dist/scripts/contributor-billing/createExpenseReportCsv.js +24 -24
  287. package/dist/scripts/contributor-billing/createXeroCsv.d.ts.map +1 -1
  288. package/dist/scripts/contributor-billing/createXeroCsv.js +52 -46
  289. package/dist/scripts/invoice/autoTagging.d.ts +1 -1
  290. package/dist/scripts/invoice/autoTagging.d.ts.map +1 -1
  291. package/dist/scripts/invoice/autoTagging.js +168 -138
  292. package/dist/scripts/invoice/exampleBatchTxn.js +16 -16
  293. package/dist/scripts/invoice/gnosisTransactionBuilder.d.ts.map +1 -1
  294. package/dist/scripts/invoice/gnosisTransactionBuilder.js +32 -25
  295. package/dist/scripts/invoice/pdfToClaudeAI.d.ts.map +1 -1
  296. package/dist/scripts/invoice/pdfToClaudeAI.js +36 -30
  297. package/dist/scripts/invoice/requestFinance.d.ts.map +1 -1
  298. package/dist/scripts/invoice/requestFinance.js +13 -13
  299. package/dist/style.css +407 -13659
  300. package/dist/subgraphs/billing-statement/resolvers.d.ts +1 -1
  301. package/dist/subgraphs/billing-statement/resolvers.d.ts.map +1 -1
  302. package/dist/subgraphs/billing-statement/resolvers.js +16 -5
  303. package/dist/subgraphs/billing-statement/schema.d.ts.map +1 -1
  304. package/dist/subgraphs/billing-statement/schema.js +12 -67
  305. package/dist/subgraphs/expense-report/resolvers.d.ts +1 -1
  306. package/dist/subgraphs/expense-report/resolvers.d.ts.map +1 -1
  307. package/dist/subgraphs/expense-report/resolvers.js +4 -5
  308. package/dist/subgraphs/expense-report/schema.d.ts.map +1 -1
  309. package/dist/subgraphs/expense-report/schema.js +5 -48
  310. package/dist/subgraphs/index.d.ts +1 -0
  311. package/dist/subgraphs/index.d.ts.map +1 -1
  312. package/dist/subgraphs/index.js +1 -0
  313. package/dist/subgraphs/integrations/resolvers.d.ts +1 -1
  314. package/dist/subgraphs/integrations/resolvers.d.ts.map +1 -1
  315. package/dist/subgraphs/integrations/resolvers.js +4 -5
  316. package/dist/subgraphs/integrations/schema.d.ts.map +1 -1
  317. package/dist/subgraphs/integrations/schema.js +3 -43
  318. package/dist/subgraphs/invoice/index.d.ts.map +1 -1
  319. package/dist/subgraphs/invoice/index.js +1 -20
  320. package/dist/subgraphs/invoice/resolvers.d.ts +1 -1
  321. package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -1
  322. package/dist/subgraphs/invoice/resolvers.js +4 -9
  323. package/dist/subgraphs/invoice/schema.d.ts.map +1 -1
  324. package/dist/subgraphs/invoice/schema.js +14 -232
  325. package/dist/subgraphs/{invoice → invoice-addon}/customResolvers.d.ts +1 -1
  326. package/dist/subgraphs/invoice-addon/customResolvers.d.ts.map +1 -0
  327. package/dist/subgraphs/{invoice → invoice-addon}/customResolvers.js +38 -34
  328. package/dist/subgraphs/invoice-addon/index.d.ts +11 -0
  329. package/dist/subgraphs/invoice-addon/index.d.ts.map +1 -0
  330. package/dist/subgraphs/invoice-addon/index.js +11 -0
  331. package/dist/subgraphs/invoice-addon/resolvers.d.ts +3 -0
  332. package/dist/subgraphs/invoice-addon/resolvers.d.ts.map +1 -0
  333. package/dist/subgraphs/invoice-addon/resolvers.js +12 -0
  334. package/dist/subgraphs/invoice-addon/schema.d.ts +3 -0
  335. package/dist/subgraphs/invoice-addon/schema.d.ts.map +1 -0
  336. package/dist/subgraphs/invoice-addon/schema.js +52 -0
  337. package/package.json +9 -20
  338. package/dist/document-models/expense-report/gen/expense-report/actions.d.ts +0 -8
  339. package/dist/document-models/expense-report/gen/expense-report/actions.d.ts.map +0 -1
  340. package/dist/document-models/expense-report/gen/expense-report/actions.js +0 -1
  341. package/dist/document-models/expense-report/gen/expense-report/creators.d.ts +0 -4
  342. package/dist/document-models/expense-report/gen/expense-report/creators.d.ts.map +0 -1
  343. package/dist/document-models/expense-report/gen/expense-report/creators.js +0 -3
  344. package/dist/document-models/expense-report/gen/expense-report/error.d.ts +0 -2
  345. package/dist/document-models/expense-report/gen/expense-report/error.d.ts.map +0 -1
  346. package/dist/document-models/expense-report/gen/expense-report/error.js +0 -1
  347. package/dist/document-models/expense-report/gen/expense-report/operations.d.ts +0 -7
  348. package/dist/document-models/expense-report/gen/expense-report/operations.d.ts.map +0 -1
  349. package/dist/document-models/expense-report/gen/expense-report/operations.js +0 -3
  350. package/dist/document-models/expense-report/src/tests/expense-report.test.d.ts +0 -6
  351. package/dist/document-models/expense-report/src/tests/expense-report.test.d.ts.map +0 -1
  352. package/dist/document-models/expense-report/src/tests/expense-report.test.js +0 -24
  353. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +0 -1
  354. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderStats.d.ts.map +0 -1
  355. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +0 -1
  356. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +0 -1
  357. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts.map +0 -1
  358. package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.d.ts.map +0 -1
  359. package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.js +0 -2
  360. package/dist/editors/contributor-billing/util.d.ts.map +0 -1
  361. package/dist/editors/hooks/useBillingStatementDocument.d.ts +0 -4
  362. package/dist/editors/hooks/useBillingStatementDocument.d.ts.map +0 -1
  363. package/dist/editors/hooks/useBillingStatementDocument.js +0 -8
  364. package/dist/editors/hooks/useExpenseReportDocument.d.ts +0 -4
  365. package/dist/editors/hooks/useExpenseReportDocument.d.ts.map +0 -1
  366. package/dist/editors/hooks/useExpenseReportDocument.js +0 -8
  367. package/dist/editors/hooks/useIntegrationsDocument.d.ts +0 -4
  368. package/dist/editors/hooks/useIntegrationsDocument.d.ts.map +0 -1
  369. package/dist/editors/hooks/useIntegrationsDocument.js +0 -8
  370. package/dist/editors/hooks/useInvoiceDocument.d.ts +0 -4
  371. package/dist/editors/hooks/useInvoiceDocument.d.ts.map +0 -1
  372. package/dist/editors/hooks/useInvoiceDocument.js +0 -8
  373. package/dist/editors/integrations/config.d.ts +0 -3
  374. package/dist/editors/integrations/config.d.ts.map +0 -1
  375. package/dist/editors/integrations/config.js +0 -3
  376. package/dist/processors/line-item-processor/index.d.ts +0 -11
  377. package/dist/processors/line-item-processor/index.d.ts.map +0 -1
  378. package/dist/processors/line-item-processor/index.js +0 -36
  379. package/dist/subgraphs/invoice/customResolvers.d.ts.map +0 -1
  380. package/editors/invoice/assets/custom.d.ts +0 -4
  381. package/editors/invoice/assets/powerhouseLogo.png +0 -0
  382. /package/dist/editors/contributor-billing/components/{InvoiceTable/HeaderStats.d.ts → HeaderStats.d.ts} +0 -0
  383. /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/HeaderControls.d.ts +0 -0
  384. /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/HeaderControls.js +0 -0
  385. /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTable.d.ts +0 -0
  386. /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTable.js +0 -0
  387. /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTableRow.d.ts +0 -0
  388. /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTableRow.js +0 -0
  389. /package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTableSection.d.ts +0 -0
  390. /package/dist/{editors/contributor-billing → old-contributor-billing}/util.d.ts +0 -0
@@ -2,506 +2,58 @@
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 * as utils from "../../gen/utils.js";
6
- import {} from "../../gen/schema/index.js";
7
- import { reducer } from "../../gen/reducer.js";
8
- import * as creators from "../../gen/transitions/creators.js";
5
+ import { describe, it, expect } from "vitest";
6
+ import { generateMock } from "@powerhousedao/codegen";
7
+ import { reducer, utils, isInvoiceDocument, cancel, CancelInputSchema, issue, IssueInputSchema, reset, ResetInputSchema, reject, RejectInputSchema, accept, AcceptInputSchema, } from "@powerhousedao/contributor-billing/document-models/invoice";
9
8
  describe("Transitions Operations", () => {
10
- let document;
11
- beforeEach(() => {
12
- document = utils.createDocument();
13
- });
14
- describe("DRAFT status transitions", () => {
15
- beforeEach(() => {
16
- // Ensure document starts in DRAFT status
17
- document.state.global.status = "DRAFT";
18
- });
19
- it("should handle DRAFT -> CANCELLED transition", () => {
20
- const input = {
21
- _placeholder: "cancel_placeholder"
22
- };
23
- const updatedDocument = reducer(document, creators.cancel(input));
24
- expect(updatedDocument.state.global.status).toBe("CANCELLED");
25
- expect(updatedDocument.operations.global).toHaveLength(1);
26
- expect(updatedDocument.operations.global[0].type).toBe("CANCEL");
27
- expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
28
- });
29
- it("should handle DRAFT -> ISSUED transition", () => {
30
- const input = {
31
- invoiceNo: "INV-2024-001",
32
- dateIssued: "2024-01-15"
33
- };
34
- const updatedDocument = reducer(document, creators.issue(input));
35
- expect(updatedDocument.state.global.status).toBe("ISSUED");
36
- expect(updatedDocument.state.global.invoiceNo).toBe("INV-2024-001");
37
- expect(updatedDocument.state.global.dateIssued).toBe("2024-01-15");
38
- expect(updatedDocument.operations.global).toHaveLength(1);
39
- expect(updatedDocument.operations.global[0].type).toBe("ISSUE");
40
- expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
41
- });
42
- });
43
- describe("CANCELLED status transitions", () => {
44
- beforeEach(() => {
45
- document.state.global.status = "CANCELLED";
46
- });
47
- it("should handle CANCELLED -> DRAFT transition", () => {
48
- const input = {
49
- _placeholder: "reset_placeholder"
50
- };
51
- const updatedDocument = reducer(document, creators.reset(input));
52
- expect(updatedDocument.state.global.status).toBe("DRAFT");
53
- expect(updatedDocument.operations.global).toHaveLength(1);
54
- expect(updatedDocument.operations.global[0].type).toBe("RESET");
55
- expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
56
- });
57
- });
58
- describe("ISSUED status transitions", () => {
59
- beforeEach(() => {
60
- document.state.global.status = "ISSUED";
61
- document.state.global.invoiceNo = "INV-2024-001";
62
- document.state.global.dateIssued = "2024-01-15";
63
- });
64
- it("should handle ISSUED -> REJECTED transition", () => {
65
- const input = {
66
- id: "rejection-1",
67
- reason: "Incorrect pricing information",
68
- final: false
69
- };
70
- const updatedDocument = reducer(document, creators.reject(input));
71
- expect(updatedDocument.state.global.status).toBe("REJECTED");
72
- expect(updatedDocument.state.global.rejections).toHaveLength(1);
73
- expect(updatedDocument.state.global.rejections[0].reason).toBe("Incorrect pricing information");
74
- expect(updatedDocument.state.global.rejections[0].final).toBe(false);
75
- expect(updatedDocument.operations.global).toHaveLength(1);
76
- expect(updatedDocument.operations.global[0].type).toBe("REJECT");
77
- expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
78
- });
79
- it("should handle ISSUED -> ACCEPTED transition", () => {
80
- const input = {
81
- payAfter: "2024-02-15T00:00:00Z"
82
- };
83
- const updatedDocument = reducer(document, creators.accept(input));
84
- expect(updatedDocument.state.global.status).toBe("ACCEPTED");
85
- expect(updatedDocument.state.global.payAfter).toBe("2024-02-15T00:00:00Z");
86
- expect(updatedDocument.operations.global).toHaveLength(1);
87
- expect(updatedDocument.operations.global[0].type).toBe("ACCEPT");
88
- expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
89
- });
90
- });
91
- describe("REJECTED status transitions", () => {
92
- beforeEach(() => {
93
- document.state.global.status = "REJECTED";
94
- document.state.global.rejections = [{
95
- id: "rejection-1",
96
- reason: "Incorrect pricing",
97
- final: false
98
- }];
99
- });
100
- it("should handle REJECTED -> ISSUED transition", () => {
101
- const input = {
102
- _placeholder: "reinstate_placeholder"
103
- };
104
- const updatedDocument = reducer(document, creators.reinstate(input));
105
- expect(updatedDocument.state.global.status).toBe("ISSUED");
106
- expect(updatedDocument.operations.global).toHaveLength(1);
107
- expect(updatedDocument.operations.global[0].type).toBe("REINSTATE");
108
- expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
109
- });
110
- it("should not allow REJECTED -> ISSUED transition when final rejection exists", () => {
111
- document.state.global.rejections = [{
112
- id: "rejection-1",
113
- reason: "Final rejection",
114
- final: true
115
- }];
116
- const input = {
117
- _placeholder: "reinstate_placeholder"
118
- };
119
- const updatedDocument = reducer(document, creators.reinstate(input));
120
- expect(updatedDocument.operations.global[0].error).toBe("Cannot reinstate an invoice that has been rejected");
121
- });
122
- });
123
- describe("ACCEPTED status transitions", () => {
124
- beforeEach(() => {
125
- document.state.global.status = "ACCEPTED";
126
- });
127
- it("should handle ACCEPTED -> PAYMENTSCHEDULED transition", () => {
128
- const input = {
129
- id: "payment-1",
130
- processorRef: "stripe_pi_123456"
131
- };
132
- const updatedDocument = reducer(document, creators.schedulePayment(input));
133
- expect(updatedDocument.state.global.status).toBe("PAYMENTSCHEDULED");
134
- expect(updatedDocument.state.global.payments).toHaveLength(1);
135
- expect(updatedDocument.state.global.payments[0].id).toBe("payment-1");
136
- expect(updatedDocument.state.global.payments[0].processorRef).toBe("stripe_pi_123456");
137
- expect(updatedDocument.state.global.payments[0].confirmed).toBe(false);
138
- expect(updatedDocument.operations.global).toHaveLength(1);
139
- expect(updatedDocument.operations.global[0].type).toBe("SCHEDULE_PAYMENT");
140
- expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
141
- });
142
- it("should handle ACCEPTED -> PAYMENTCLOSED transition", () => {
143
- const input = {
144
- closureReason: "CANCELLED"
145
- };
146
- const updatedDocument = reducer(document, creators.closePayment(input));
147
- expect(updatedDocument.state.global.status).toBe("PAYMENTCLOSED");
148
- expect(updatedDocument.state.global.closureReason).toBe("CANCELLED");
149
- expect(updatedDocument.operations.global).toHaveLength(1);
150
- expect(updatedDocument.operations.global[0].type).toBe("CLOSE_PAYMENT");
151
- expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
152
- });
153
- });
154
- describe("PAYMENTSCHEDULED status transitions", () => {
155
- beforeEach(() => {
156
- document.state.global.status = "PAYMENTSCHEDULED";
157
- document.state.global.payments = [{
158
- id: "payment-1",
159
- processorRef: "stripe_pi_123456",
160
- paymentDate: "",
161
- txnRef: "",
162
- confirmed: false,
163
- issue: "",
164
- amount: 0
165
- }];
166
- });
167
- it("should handle PAYMENTSCHEDULED -> PAYMENTSENT transition", () => {
168
- const input = {
169
- id: "payment-1",
170
- timestamp: "2024-01-20T10:30:00Z",
171
- txRef: "txn_789012"
172
- };
173
- const updatedDocument = reducer(document, creators.registerPaymentTx(input));
174
- expect(updatedDocument.state.global.status).toBe("PAYMENTSENT");
175
- expect(updatedDocument.state.global.payments[0].txnRef).toBe("txn_789012");
176
- expect(updatedDocument.state.global.payments[0].paymentDate).toBe("2024-01-20T10:30:00Z");
177
- expect(updatedDocument.operations.global).toHaveLength(1);
178
- expect(updatedDocument.operations.global[0].type).toBe("REGISTER_PAYMENT_TX");
179
- expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
180
- });
181
- it("should handle PAYMENTSCHEDULED -> PAYMENTISSUE transition", () => {
182
- const input = {
183
- id: "payment-1",
184
- issue: "Payment processor timeout"
185
- };
186
- const updatedDocument = reducer(document, creators.reportPaymentIssue(input));
187
- expect(updatedDocument.state.global.status).toBe("PAYMENTISSUE");
188
- expect(updatedDocument.state.global.payments[0].issue).toBe("Payment processor timeout");
189
- expect(updatedDocument.operations.global).toHaveLength(1);
190
- expect(updatedDocument.operations.global[0].type).toBe("REPORT_PAYMENT_ISSUE");
191
- expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
192
- });
193
- it("should handle PAYMENTSCHEDULED -> PAYMENTCLOSED transition", () => {
194
- const input = {
195
- closureReason: "CANCELLED"
196
- };
197
- const updatedDocument = reducer(document, creators.closePayment(input));
198
- expect(updatedDocument.state.global.status).toBe("PAYMENTCLOSED");
199
- expect(updatedDocument.state.global.closureReason).toBe("CANCELLED");
200
- expect(updatedDocument.operations.global).toHaveLength(1);
201
- expect(updatedDocument.operations.global[0].type).toBe("CLOSE_PAYMENT");
202
- expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
203
- });
204
- });
205
- describe("PAYMENTSENT status transitions", () => {
206
- beforeEach(() => {
207
- document.state.global.status = "PAYMENTSENT";
208
- document.state.global.payments = [{
209
- id: "payment-1",
210
- processorRef: "stripe_pi_123456",
211
- paymentDate: "2024-01-20T10:30:00Z",
212
- txnRef: "txn_789012",
213
- confirmed: false,
214
- issue: "",
215
- amount: 0
216
- }];
217
- });
218
- it("should handle PAYMENTSENT -> PAYMENTISSUE transition", () => {
219
- const input = {
220
- id: "payment-1",
221
- issue: "Transaction failed"
222
- };
223
- const updatedDocument = reducer(document, creators.reportPaymentIssue(input));
224
- expect(updatedDocument.state.global.status).toBe("PAYMENTISSUE");
225
- expect(updatedDocument.state.global.payments[0].issue).toBe("Transaction failed");
226
- expect(updatedDocument.operations.global).toHaveLength(1);
227
- expect(updatedDocument.operations.global[0].type).toBe("REPORT_PAYMENT_ISSUE");
228
- expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
229
- });
230
- it("should handle PAYMENTSENT -> PAYMENTRECEIVED transition", () => {
231
- const input = {
232
- id: "payment-1",
233
- amount: 1500.00
234
- };
235
- const updatedDocument = reducer(document, creators.confirmPayment(input));
236
- expect(updatedDocument.state.global.status).toBe("PAYMENTRECEIVED");
237
- expect(updatedDocument.state.global.payments[0].confirmed).toBe(true);
238
- expect(updatedDocument.state.global.payments[0].amount).toBe(1500.00);
239
- expect(updatedDocument.operations.global).toHaveLength(1);
240
- expect(updatedDocument.operations.global[0].type).toBe("CONFIRM_PAYMENT");
241
- expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
242
- });
243
- });
244
- describe("PAYMENTISSUE status transitions", () => {
245
- beforeEach(() => {
246
- document.state.global.status = "PAYMENTISSUE";
247
- document.state.global.payments = [{
248
- id: "payment-1",
249
- processorRef: "stripe_pi_123456",
250
- paymentDate: "",
251
- txnRef: "",
252
- confirmed: false,
253
- issue: "Payment processor timeout",
254
- amount: 0
255
- }];
256
- });
257
- it("should handle PAYMENTISSUE -> ACCEPTED transition", () => {
258
- const input = {
259
- _placeholder: "reapprove_placeholder"
260
- };
261
- const updatedDocument = reducer(document, creators.reapprovePayment(input));
262
- expect(updatedDocument.state.global.status).toBe("ACCEPTED");
263
- expect(updatedDocument.operations.global).toHaveLength(1);
264
- expect(updatedDocument.operations.global[0].type).toBe("REAPPROVE_PAYMENT");
265
- expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
266
- });
267
- it("should handle PAYMENTISSUE -> PAYMENTCLOSED transition", () => {
268
- const input = {
269
- closureReason: "CANCELLED"
270
- };
271
- const updatedDocument = reducer(document, creators.closePayment(input));
272
- expect(updatedDocument.state.global.status).toBe("PAYMENTCLOSED");
273
- expect(updatedDocument.state.global.closureReason).toBe("CANCELLED");
274
- expect(updatedDocument.operations.global).toHaveLength(1);
275
- expect(updatedDocument.operations.global[0].type).toBe("CLOSE_PAYMENT");
276
- expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
277
- });
278
- });
279
- describe("PAYMENTRECEIVED status transitions", () => {
280
- beforeEach(() => {
281
- document.state.global.status = "PAYMENTRECEIVED";
282
- document.state.global.payments = [{
283
- id: "payment-1",
284
- processorRef: "stripe_pi_123456",
285
- paymentDate: "2024-01-20T10:30:00Z",
286
- txnRef: "txn_789012",
287
- confirmed: true,
288
- issue: "",
289
- amount: 1500.00
290
- }];
291
- });
292
- it("should handle PAYMENTRECEIVED -> PAYMENTISSUE transition", () => {
293
- const input = {
294
- id: "payment-1",
295
- issue: "Payment amount discrepancy"
296
- };
297
- const updatedDocument = reducer(document, creators.reportPaymentIssue(input));
298
- expect(updatedDocument.state.global.status).toBe("PAYMENTISSUE");
299
- expect(updatedDocument.state.global.payments[0].issue).toBe("Payment amount discrepancy");
300
- expect(updatedDocument.operations.global).toHaveLength(1);
301
- expect(updatedDocument.operations.global[0].type).toBe("REPORT_PAYMENT_ISSUE");
302
- expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
303
- });
304
- });
305
- describe("PAYMENTCLOSED status transitions", () => {
306
- beforeEach(() => {
307
- document.state.global.status = "PAYMENTCLOSED";
308
- document.state.global.closureReason = "CANCELLED";
309
- });
310
- it("should handle PAYMENTCLOSED -> ACCEPTED transition", () => {
311
- const input = {
312
- _placeholder: "reapprove_placeholder"
313
- };
314
- const updatedDocument = reducer(document, creators.reapprovePayment(input));
315
- expect(updatedDocument.state.global.status).toBe("ACCEPTED");
316
- expect(updatedDocument.operations.global).toHaveLength(1);
317
- expect(updatedDocument.operations.global[0].type).toBe("REAPPROVE_PAYMENT");
318
- expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
319
- });
320
- });
321
- describe("Error cases", () => {
322
- it("should throw error for invalid DRAFT -> ACCEPTED transition", () => {
323
- document.state.global.status = "DRAFT";
324
- const input = {
325
- payAfter: "2024-02-15T00:00:00Z"
326
- };
327
- const updatedDocument = reducer(document, creators.accept(input));
328
- expect(updatedDocument.operations.global[0].error).toBe("Invalid transition from DRAFT to ACCEPTED");
329
- });
330
- it("should throw error for invalid ISSUED -> PAYMENTSCHEDULED transition", () => {
331
- document.state.global.status = "ISSUED";
332
- const input = {
333
- id: "payment-1",
334
- processorRef: "stripe_pi_123456"
335
- };
336
- const updatedDocument = reducer(document, creators.schedulePayment(input));
337
- expect(updatedDocument.operations.global[0].error).toBe("Invalid transition from ISSUED to PAYMENTSCHEDULED");
338
- });
339
- it("should throw error for missing required fields in issue operation", () => {
340
- document.state.global.status = "DRAFT";
341
- const input = {
342
- invoiceNo: "",
343
- dateIssued: ""
344
- };
345
- const updatedDocument = reducer(document, creators.issue(input));
346
- expect(updatedDocument.operations.global[0].error).toBe("Invoice number and date issued are required");
347
- });
348
- it("should throw error for missing required fields in reject operation", () => {
349
- document.state.global.status = "ISSUED";
350
- const input = {
351
- id: "",
352
- reason: "",
353
- final: false
354
- };
355
- const updatedDocument = reducer(document, creators.reject(input));
356
- expect(updatedDocument.operations.global[0].error).toBe("Reason, ID and final are required");
357
- });
358
- it("should throw error for missing required fields in schedulePayment operation", () => {
359
- document.state.global.status = "ACCEPTED";
360
- const input = {
361
- id: "",
362
- processorRef: ""
363
- };
364
- const updatedDocument = reducer(document, creators.schedulePayment(input));
365
- expect(updatedDocument.operations.global[0].error).toBe("ID and processorRef are required");
366
- });
367
- it("should throw error when payment not found in registerPaymentTx operation", () => {
368
- document.state.global.status = "PAYMENTSCHEDULED";
369
- document.state.global.payments = [{
370
- id: "payment-1",
371
- processorRef: "stripe_pi_123456",
372
- paymentDate: "",
373
- txnRef: "",
374
- confirmed: false,
375
- issue: "",
376
- amount: 0
377
- }];
378
- const input = {
379
- id: "non-existent-payment",
380
- timestamp: "2024-01-20T10:30:00Z",
381
- txRef: "txn_789012"
382
- };
383
- const updatedDocument = reducer(document, creators.registerPaymentTx(input));
384
- expect(updatedDocument.operations.global[0].error).toBe("Payment not found");
385
- });
386
- it("should throw schema validation error for invalid datetime in registerPaymentTx operation", () => {
387
- document.state.global.status = "PAYMENTSCHEDULED";
388
- document.state.global.payments = [{
389
- id: "payment-1",
390
- processorRef: "stripe_pi_123456",
391
- paymentDate: "",
392
- txnRef: "",
393
- confirmed: false,
394
- issue: "",
395
- amount: 0
396
- }];
397
- // This should fail at the schema level due to invalid datetime format
398
- expect(() => {
399
- const input = {
400
- id: "payment-1",
401
- timestamp: "invalid-datetime",
402
- txRef: "txn_789012"
403
- };
404
- reducer(document, creators.registerPaymentTx(input));
405
- }).toThrow();
406
- });
407
- it("should throw error for missing required fields in reportPaymentIssue operation", () => {
408
- document.state.global.status = "PAYMENTSCHEDULED";
409
- document.state.global.payments = [{
410
- id: "payment-1",
411
- processorRef: "stripe_pi_123456",
412
- paymentDate: "",
413
- txnRef: "",
414
- confirmed: false,
415
- issue: "",
416
- amount: 0
417
- }];
418
- const input = {
419
- id: "",
420
- issue: ""
421
- };
422
- const updatedDocument = reducer(document, creators.reportPaymentIssue(input));
423
- expect(updatedDocument.operations.global[0].error).toBe("ID and issue are required");
424
- });
425
- it("should throw error for missing required fields in confirmPayment operation", () => {
426
- document.state.global.status = "PAYMENTSENT";
427
- document.state.global.payments = [{
428
- id: "payment-1",
429
- processorRef: "stripe_pi_123456",
430
- paymentDate: "2024-01-20T10:30:00Z",
431
- txnRef: "txn_789012",
432
- confirmed: false,
433
- issue: "",
434
- amount: 0
435
- }];
436
- const input = {
437
- id: "",
438
- amount: 0
439
- };
440
- const updatedDocument = reducer(document, creators.confirmPayment(input));
441
- expect(updatedDocument.operations.global[0].error).toBe("ID and amount are required");
442
- });
443
- it("should throw error for missing required fields in closePayment operation", () => {
444
- document.state.global.status = "ACCEPTED";
445
- const input = {
446
- closureReason: undefined
447
- };
448
- const updatedDocument = reducer(document, creators.closePayment(input));
449
- expect(updatedDocument.operations.global[0].error).toBe("Closure reason is required");
450
- });
451
- it("should throw error when payment not found in registerPaymentTx", () => {
452
- document.state.global.status = "PAYMENTSCHEDULED";
453
- document.state.global.payments = [{
454
- id: "payment-1",
455
- processorRef: "stripe_pi_123456",
456
- paymentDate: "",
457
- txnRef: "",
458
- confirmed: false,
459
- issue: "",
460
- amount: 0
461
- }];
462
- const input = {
463
- id: "non-existent-payment",
464
- timestamp: "2024-01-20T10:30:00Z",
465
- txRef: "txn_789012"
466
- };
467
- const updatedDocument = reducer(document, creators.registerPaymentTx(input));
468
- expect(updatedDocument.operations.global[0].error).toBe("Payment not found");
469
- });
470
- it("should throw error when payment not found in reportPaymentIssue", () => {
471
- document.state.global.status = "PAYMENTSCHEDULED";
472
- document.state.global.payments = [{
473
- id: "payment-1",
474
- processorRef: "stripe_pi_123456",
475
- paymentDate: "",
476
- txnRef: "",
477
- confirmed: false,
478
- issue: "",
479
- amount: 0
480
- }];
481
- const input = {
482
- id: "non-existent-payment",
483
- issue: "Payment issue"
484
- };
485
- const updatedDocument = reducer(document, creators.reportPaymentIssue(input));
486
- expect(updatedDocument.operations.global[0].error).toBe("Payment not found");
487
- });
488
- it("should throw error when payment not found in confirmPayment", () => {
489
- document.state.global.status = "PAYMENTSENT";
490
- document.state.global.payments = [{
491
- id: "payment-1",
492
- processorRef: "stripe_pi_123456",
493
- paymentDate: "2024-01-20T10:30:00Z",
494
- txnRef: "txn_789012",
495
- confirmed: false,
496
- issue: "",
497
- amount: 0
498
- }];
499
- const input = {
500
- id: "non-existent-payment",
501
- amount: 1500.00
502
- };
503
- const updatedDocument = reducer(document, creators.confirmPayment(input));
504
- expect(updatedDocument.operations.global[0].error).toBe("Payment not found");
505
- });
9
+ it("should handle cancel operation", () => {
10
+ const document = utils.createDocument();
11
+ const input = generateMock(CancelInputSchema());
12
+ const updatedDocument = reducer(document, cancel(input));
13
+ expect(isInvoiceDocument(updatedDocument)).toBe(true);
14
+ expect(updatedDocument.operations.global).toHaveLength(1);
15
+ expect(updatedDocument.operations.global[0].action.type).toBe("CANCEL");
16
+ expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
17
+ expect(updatedDocument.operations.global[0].index).toEqual(0);
18
+ });
19
+ it("should handle issue operation", () => {
20
+ const document = utils.createDocument();
21
+ const input = generateMock(IssueInputSchema());
22
+ const updatedDocument = reducer(document, issue(input));
23
+ expect(isInvoiceDocument(updatedDocument)).toBe(true);
24
+ expect(updatedDocument.operations.global).toHaveLength(1);
25
+ expect(updatedDocument.operations.global[0].action.type).toBe("ISSUE");
26
+ expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
27
+ expect(updatedDocument.operations.global[0].index).toEqual(0);
28
+ });
29
+ it("should handle reset operation", () => {
30
+ const document = utils.createDocument();
31
+ const input = generateMock(ResetInputSchema());
32
+ const updatedDocument = reducer(document, reset(input));
33
+ expect(isInvoiceDocument(updatedDocument)).toBe(true);
34
+ expect(updatedDocument.operations.global).toHaveLength(1);
35
+ expect(updatedDocument.operations.global[0].action.type).toBe("RESET");
36
+ expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
37
+ expect(updatedDocument.operations.global[0].index).toEqual(0);
38
+ });
39
+ it("should handle reject operation", () => {
40
+ const document = utils.createDocument();
41
+ const input = generateMock(RejectInputSchema());
42
+ const updatedDocument = reducer(document, reject(input));
43
+ expect(isInvoiceDocument(updatedDocument)).toBe(true);
44
+ expect(updatedDocument.operations.global).toHaveLength(1);
45
+ expect(updatedDocument.operations.global[0].action.type).toBe("REJECT");
46
+ expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
47
+ expect(updatedDocument.operations.global[0].index).toEqual(0);
48
+ });
49
+ it("should handle accept operation", () => {
50
+ const document = utils.createDocument();
51
+ const input = generateMock(AcceptInputSchema());
52
+ const updatedDocument = reducer(document, accept(input));
53
+ expect(isInvoiceDocument(updatedDocument)).toBe(true);
54
+ expect(updatedDocument.operations.global).toHaveLength(1);
55
+ expect(updatedDocument.operations.global[0].action.type).toBe("ACCEPT");
56
+ expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
57
+ expect(updatedDocument.operations.global[0].index).toEqual(0);
506
58
  });
507
59
  });
@@ -1 +1 @@
1
- {"version":3,"file":"statusTransitions.d.ts","sourceRoot":"","sources":["../../../../document-models/invoice/utils/statusTransitions.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB;;;;;;;;;;;CAWhC,CAAA"}
1
+ {"version":3,"file":"statusTransitions.d.ts","sourceRoot":"","sources":["../../../../document-models/invoice/utils/statusTransitions.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB;;;;;;;;;;;CAWhC,CAAC"}
@@ -1,13 +1,13 @@
1
1
  // Status transitions mapping
2
2
  export const permittedTransitions = {
3
- DRAFT: ['CANCELLED', 'ISSUED'],
4
- CANCELLED: ['DRAFT'],
5
- ISSUED: ['REJECTED', 'ACCEPTED'],
6
- REJECTED: ['ISSUED'],
7
- ACCEPTED: ['PAYMENTSCHEDULED', 'PAYMENTCLOSED'],
8
- PAYMENTSCHEDULED: ['PAYMENTSENT', 'PAYMENTISSUE', 'PAYMENTCLOSED'],
9
- PAYMENTSENT: ['PAYMENTISSUE', 'PAYMENTRECEIVED'],
10
- PAYMENTISSUE: ['ACCEPTED', 'PAYMENTCLOSED'],
11
- PAYMENTRECEIVED: ['PAYMENTISSUE'],
12
- PAYMENTCLOSED: ['ACCEPTED'],
3
+ DRAFT: ["CANCELLED", "ISSUED"],
4
+ CANCELLED: ["DRAFT"],
5
+ ISSUED: ["REJECTED", "ACCEPTED"],
6
+ REJECTED: ["ISSUED"],
7
+ ACCEPTED: ["PAYMENTSCHEDULED", "PAYMENTCLOSED"],
8
+ PAYMENTSCHEDULED: ["PAYMENTSENT", "PAYMENTISSUE", "PAYMENTCLOSED"],
9
+ PAYMENTSENT: ["PAYMENTISSUE", "PAYMENTRECEIVED"],
10
+ PAYMENTISSUE: ["ACCEPTED", "PAYMENTCLOSED"],
11
+ PAYMENTRECEIVED: ["PAYMENTISSUE"],
12
+ PAYMENTCLOSED: ["ACCEPTED"],
13
13
  };
@@ -1 +1 @@
1
- {"version":3,"file":"lineItemsTable.d.ts","sourceRoot":"","sources":["../../../../editors/billing-statement/components/lineItemsTable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAW,KAAK,sBAAsB,EAAE,KAAK,qBAAqB,EAAkC,MAAM,qDAAqD,CAAC;AAmCvK,QAAA,MAAM,cAAc,GAAI,OAAO;IAAE,KAAK,EAAE,qBAAqB,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAA;CAAE,4CA+ZhH,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"lineItemsTable.d.ts","sourceRoot":"","sources":["../../../../editors/billing-statement/components/lineItemsTable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAE3B,MAAM,qDAAqD,CAAC;AAmC7D,QAAA,MAAM,cAAc,GAAI,OAAO;IAC7B,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;CAClD,4CAigBA,CAAC;AAEF,eAAe,cAAc,CAAC"}