@powerhousedao/contributor-billing 0.1.29 → 0.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +3 -3
  226. package/dist/editors/invoice/legalEntity/bankSection.d.ts.map +1 -1
  227. package/dist/editors/invoice/legalEntity/legalEntity.d.ts.map +1 -1
  228. package/dist/editors/invoice/legalEntity/walletSection.d.ts.map +1 -1
  229. package/dist/editors/invoice/legalEntity/walletSection.js +3 -3
  230. package/dist/editors/invoice/lineItemTags/lineItemTags.d.ts.map +1 -1
  231. package/dist/editors/invoice/lineItemTags/lineItemTags.js +1 -1
  232. package/dist/editors/invoice/lineItemTags/tagMobileModal.d.ts.map +1 -1
  233. package/dist/editors/invoice/lineItemTags/tagMobileModal.js +4 -3
  234. package/dist/editors/invoice/lineItems.d.ts.map +1 -1
  235. package/dist/editors/invoice/module.d.ts +1 -0
  236. package/dist/editors/invoice/module.d.ts.map +1 -1
  237. package/dist/editors/invoice/module.js +2 -1
  238. package/dist/editors/invoice/requestFinance.js +4 -4
  239. package/dist/editors/invoice/uploadPdfChunked.d.ts.map +1 -1
  240. package/dist/editors/invoice/uploadPdfChunked.js +5 -4
  241. package/dist/editors/invoice/utils/utils.d.ts.map +1 -1
  242. package/dist/editors/invoice/utils/utils.js +5 -4
  243. package/dist/editors/invoice/validation/validationHandler.d.ts.map +1 -1
  244. package/dist/editors/invoice/validation/validationHandler.js +11 -5
  245. package/dist/editors/invoice/validation/validationManager.d.ts +2 -2
  246. package/dist/editors/invoice/validation/validationManager.d.ts.map +1 -1
  247. package/dist/editors/invoice/validation/validationManager.js +5 -5
  248. package/dist/editors/invoice/validation/validationRules.d.ts.map +1 -1
  249. package/dist/editors/invoice/validation/validationRules.js +178 -178
  250. package/dist/index.d.ts +2 -2
  251. package/dist/index.d.ts.map +1 -1
  252. package/dist/index.js +4 -2
  253. package/dist/old-contributor-billing/components/DriveExplorer.d.ts +7 -0
  254. package/dist/old-contributor-billing/components/DriveExplorer.d.ts.map +1 -0
  255. package/dist/old-contributor-billing/components/DriveExplorer.js +184 -0
  256. package/dist/old-contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -0
  257. package/dist/old-contributor-billing/components/InvoiceTable/HeaderStats.d.ts +2 -0
  258. package/dist/old-contributor-billing/components/InvoiceTable/HeaderStats.d.ts.map +1 -0
  259. package/dist/old-contributor-billing/components/InvoiceTable/HeaderStats.js +73 -0
  260. package/dist/old-contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -0
  261. package/dist/old-contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -0
  262. package/dist/old-contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts.map +1 -0
  263. package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/InvoiceTableSection.js +1 -1
  264. package/dist/{editors/contributor-billing → old-contributor-billing}/components/InvoiceTable/RowActionMenu.d.ts +1 -1
  265. package/dist/old-contributor-billing/components/InvoiceTable/RowActionMenu.d.ts.map +1 -0
  266. package/dist/old-contributor-billing/components/InvoiceTable/RowActionMenu.js +2 -0
  267. package/dist/old-contributor-billing/config.d.ts +3 -0
  268. package/dist/old-contributor-billing/config.d.ts.map +1 -0
  269. package/dist/old-contributor-billing/config.js +4 -0
  270. package/dist/old-contributor-billing/editor.d.ts +3 -0
  271. package/dist/old-contributor-billing/editor.d.ts.map +1 -0
  272. package/dist/old-contributor-billing/editor.js +8 -0
  273. package/dist/old-contributor-billing/module.d.ts +3 -0
  274. package/dist/old-contributor-billing/module.d.ts.map +1 -0
  275. package/dist/old-contributor-billing/module.js +9 -0
  276. package/dist/old-contributor-billing/util.d.ts.map +1 -0
  277. package/dist/{editors/contributor-billing → old-contributor-billing}/util.js +11 -9
  278. package/dist/powerhouse.manifest.json +6 -41
  279. package/dist/processors/index.d.ts +1 -6
  280. package/dist/processors/index.d.ts.map +1 -1
  281. package/dist/processors/index.js +1 -18
  282. package/dist/scripts/contributor-billing/createExpenseReportCsv.d.ts.map +1 -1
  283. package/dist/scripts/contributor-billing/createExpenseReportCsv.js +24 -24
  284. package/dist/scripts/contributor-billing/createXeroCsv.d.ts.map +1 -1
  285. package/dist/scripts/contributor-billing/createXeroCsv.js +52 -46
  286. package/dist/scripts/invoice/autoTagging.d.ts +1 -1
  287. package/dist/scripts/invoice/autoTagging.d.ts.map +1 -1
  288. package/dist/scripts/invoice/autoTagging.js +168 -138
  289. package/dist/scripts/invoice/exampleBatchTxn.js +16 -16
  290. package/dist/scripts/invoice/gnosisTransactionBuilder.d.ts.map +1 -1
  291. package/dist/scripts/invoice/gnosisTransactionBuilder.js +32 -25
  292. package/dist/scripts/invoice/pdfToClaudeAI.d.ts.map +1 -1
  293. package/dist/scripts/invoice/pdfToClaudeAI.js +36 -30
  294. package/dist/scripts/invoice/requestFinance.d.ts.map +1 -1
  295. package/dist/scripts/invoice/requestFinance.js +13 -13
  296. package/dist/style.css +407 -13659
  297. package/dist/subgraphs/billing-statement/resolvers.d.ts +1 -1
  298. package/dist/subgraphs/billing-statement/resolvers.d.ts.map +1 -1
  299. package/dist/subgraphs/billing-statement/resolvers.js +16 -5
  300. package/dist/subgraphs/billing-statement/schema.d.ts.map +1 -1
  301. package/dist/subgraphs/billing-statement/schema.js +12 -67
  302. package/dist/subgraphs/expense-report/resolvers.d.ts +1 -1
  303. package/dist/subgraphs/expense-report/resolvers.d.ts.map +1 -1
  304. package/dist/subgraphs/expense-report/resolvers.js +4 -5
  305. package/dist/subgraphs/expense-report/schema.d.ts.map +1 -1
  306. package/dist/subgraphs/expense-report/schema.js +5 -48
  307. package/dist/subgraphs/index.d.ts +1 -0
  308. package/dist/subgraphs/index.d.ts.map +1 -1
  309. package/dist/subgraphs/index.js +1 -0
  310. package/dist/subgraphs/integrations/resolvers.d.ts +1 -1
  311. package/dist/subgraphs/integrations/resolvers.d.ts.map +1 -1
  312. package/dist/subgraphs/integrations/resolvers.js +4 -5
  313. package/dist/subgraphs/integrations/schema.d.ts.map +1 -1
  314. package/dist/subgraphs/integrations/schema.js +3 -43
  315. package/dist/subgraphs/invoice/index.d.ts.map +1 -1
  316. package/dist/subgraphs/invoice/index.js +1 -20
  317. package/dist/subgraphs/invoice/resolvers.d.ts +1 -1
  318. package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -1
  319. package/dist/subgraphs/invoice/resolvers.js +4 -9
  320. package/dist/subgraphs/invoice/schema.d.ts.map +1 -1
  321. package/dist/subgraphs/invoice/schema.js +14 -232
  322. package/dist/subgraphs/{invoice → invoice-addon}/customResolvers.d.ts +1 -1
  323. package/dist/subgraphs/invoice-addon/customResolvers.d.ts.map +1 -0
  324. package/dist/subgraphs/{invoice → invoice-addon}/customResolvers.js +38 -34
  325. package/dist/subgraphs/invoice-addon/index.d.ts +11 -0
  326. package/dist/subgraphs/invoice-addon/index.d.ts.map +1 -0
  327. package/dist/subgraphs/invoice-addon/index.js +11 -0
  328. package/dist/subgraphs/invoice-addon/resolvers.d.ts +3 -0
  329. package/dist/subgraphs/invoice-addon/resolvers.d.ts.map +1 -0
  330. package/dist/subgraphs/invoice-addon/resolvers.js +12 -0
  331. package/dist/subgraphs/invoice-addon/schema.d.ts +3 -0
  332. package/dist/subgraphs/invoice-addon/schema.d.ts.map +1 -0
  333. package/dist/subgraphs/invoice-addon/schema.js +52 -0
  334. package/package.json +9 -20
  335. package/dist/document-models/expense-report/gen/expense-report/actions.d.ts +0 -8
  336. package/dist/document-models/expense-report/gen/expense-report/actions.d.ts.map +0 -1
  337. package/dist/document-models/expense-report/gen/expense-report/actions.js +0 -1
  338. package/dist/document-models/expense-report/gen/expense-report/creators.d.ts +0 -4
  339. package/dist/document-models/expense-report/gen/expense-report/creators.d.ts.map +0 -1
  340. package/dist/document-models/expense-report/gen/expense-report/creators.js +0 -3
  341. package/dist/document-models/expense-report/gen/expense-report/error.d.ts +0 -2
  342. package/dist/document-models/expense-report/gen/expense-report/error.d.ts.map +0 -1
  343. package/dist/document-models/expense-report/gen/expense-report/error.js +0 -1
  344. package/dist/document-models/expense-report/gen/expense-report/operations.d.ts +0 -7
  345. package/dist/document-models/expense-report/gen/expense-report/operations.d.ts.map +0 -1
  346. package/dist/document-models/expense-report/gen/expense-report/operations.js +0 -3
  347. package/dist/document-models/expense-report/src/tests/expense-report.test.d.ts +0 -6
  348. package/dist/document-models/expense-report/src/tests/expense-report.test.d.ts.map +0 -1
  349. package/dist/document-models/expense-report/src/tests/expense-report.test.js +0 -24
  350. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +0 -1
  351. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderStats.d.ts.map +0 -1
  352. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +0 -1
  353. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +0 -1
  354. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts.map +0 -1
  355. package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.d.ts.map +0 -1
  356. package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.js +0 -2
  357. package/dist/editors/contributor-billing/util.d.ts.map +0 -1
  358. package/dist/editors/hooks/useBillingStatementDocument.d.ts +0 -4
  359. package/dist/editors/hooks/useBillingStatementDocument.d.ts.map +0 -1
  360. package/dist/editors/hooks/useBillingStatementDocument.js +0 -8
  361. package/dist/editors/hooks/useExpenseReportDocument.d.ts +0 -4
  362. package/dist/editors/hooks/useExpenseReportDocument.d.ts.map +0 -1
  363. package/dist/editors/hooks/useExpenseReportDocument.js +0 -8
  364. package/dist/editors/hooks/useIntegrationsDocument.d.ts +0 -4
  365. package/dist/editors/hooks/useIntegrationsDocument.d.ts.map +0 -1
  366. package/dist/editors/hooks/useIntegrationsDocument.js +0 -8
  367. package/dist/editors/hooks/useInvoiceDocument.d.ts +0 -4
  368. package/dist/editors/hooks/useInvoiceDocument.d.ts.map +0 -1
  369. package/dist/editors/hooks/useInvoiceDocument.js +0 -8
  370. package/dist/editors/integrations/config.d.ts +0 -3
  371. package/dist/editors/integrations/config.d.ts.map +0 -1
  372. package/dist/editors/integrations/config.js +0 -3
  373. package/dist/editors/invoice/exportSAFTPT.d.ts +0 -184
  374. package/dist/editors/invoice/exportSAFTPT.d.ts.map +0 -1
  375. package/dist/editors/invoice/exportSAFTPT.js +0 -548
  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
@@ -1,182 +1,7 @@
1
1
  import { gql } from "graphql-tag";
2
2
  export const schema = gql `
3
3
  """
4
- Subgraph definition for Invoice (powerhouse/invoice)
5
- """
6
- type InvoiceState {
7
- status: Status!
8
- invoiceNo: String!
9
- dateIssued: Date!
10
- dateDue: Date!
11
- dateDelivered: Date
12
- issuer: LegalEntity!
13
- payer: LegalEntity!
14
- currency: String!
15
- lineItems: [InvoiceLineItem!]!
16
- totalPriceTaxExcl: Float!
17
- totalPriceTaxIncl: Float!
18
- notes: String
19
- rejections: [Rejection!]!
20
- payments: [Payment!]!
21
- payAfter: DateTime
22
- invoiceTags: [InvoiceTag!]! # e.g. {'xero-payment-account', '090', 'PowerhouseUSD'}
23
- exported: ExportedData
24
- closureReason: ClosureReason
25
- }
26
-
27
- enum ClosureReason {
28
- UNDERPAID
29
- OVERPAID
30
- CANCELLED
31
- }
32
-
33
- type Rejection {
34
- id: OID!
35
- reason: String!
36
- final: Boolean!
37
- }
38
-
39
- type ExportedData {
40
- timestamp: DateTime! # ISO 8601 timestamp of the export
41
- exportedLineItems: [[String!]!]! # CSV Format
42
- }
43
-
44
- type Payment {
45
- id: OID!
46
- processorRef: String
47
- paymentDate: DateTime
48
- txnRef: String
49
- confirmed: Boolean!
50
- issue: String
51
- amount: Float
52
- }
53
-
54
- type Token {
55
- evmAddress: String
56
- symbol: String
57
- chainName: String
58
- chainId: String
59
- rpc: String
60
- }
61
-
62
- type LegalEntity {
63
- id: LegalEntityId
64
- name: String
65
- address: Address
66
- contactInfo: ContactInfo
67
- country: String
68
- paymentRouting: PaymentRouting
69
- }
70
-
71
- type Address {
72
- streetAddress: String
73
- extendedAddress: String
74
- city: String
75
- postalCode: String
76
- country: String
77
- stateProvince: String
78
- }
79
-
80
- type ContactInfo {
81
- tel: String
82
- email: String
83
- }
84
-
85
- type PaymentRouting {
86
- bank: Bank
87
- wallet: InvoiceWallet
88
- }
89
-
90
- type Bank {
91
- name: String!
92
- address: Address!
93
- ABA: String
94
- BIC: String
95
- SWIFT: String
96
- accountNum: String!
97
- accountType: InvoiceAccountType
98
- beneficiary: String
99
- intermediaryBank: IntermediaryBank
100
- memo: String
101
- }
102
-
103
- type IntermediaryBank {
104
- name: String!
105
- address: Address!
106
- ABA: String
107
- BIC: String
108
- SWIFT: String
109
- accountNum: String!
110
- accountType: InvoiceAccountType
111
- beneficiary: String
112
- memo: String
113
- }
114
-
115
- type InvoiceWallet {
116
- rpc: String
117
- chainName: String
118
- chainId: String
119
- address: String
120
- }
121
-
122
- type InvoiceLineItem {
123
- id: OID!
124
- description: String!
125
- taxPercent: Float!
126
- quantity: Float!
127
- currency: String!
128
- unitPriceTaxExcl: Float!
129
- unitPriceTaxIncl: Float!
130
- totalPriceTaxExcl: Float!
131
- totalPriceTaxIncl: Float!
132
- lineItemTag: [InvoiceTag!]
133
- }
134
-
135
- type InvoiceTag {
136
- dimension: String! # "xero-expense-account", "xero-payment-account", "accounting-period", ...
137
- value: String! # "627", ..., "090", ..., "2025/05", "2025/Q1", ...
138
- label: String # "Marketing", ..., "Business Bank", ..., "May 2025"
139
- }
140
-
141
- union LegalEntityId = LegalEntityTaxId | LegalEntityCorporateRegistrationId
142
-
143
- type LegalEntityTaxId {
144
- taxId: String!
145
- }
146
-
147
- type LegalEntityCorporateRegistrationId {
148
- corpRegId: String!
149
- }
150
-
151
- enum Status {
152
- DRAFT
153
- ISSUED
154
- CANCELLED
155
- ACCEPTED
156
- REJECTED
157
- PAYMENTSCHEDULED
158
- PAYMENTSENT
159
- PAYMENTISSUE
160
- PAYMENTRECEIVED
161
- PAYMENTCLOSED
162
- }
163
-
164
- enum InvoiceAccountType {
165
- CHECKING
166
- SAVINGS
167
- TRUST
168
- WALLET
169
- }
170
-
171
- enum InvoiceAccountTypeInput {
172
- CHECKING
173
- SAVINGS
174
- TRUST
175
- WALLET
176
- }
177
-
178
- """
179
- Queries: Invoice
4
+ Queries: Invoice Document
180
5
  """
181
6
  type InvoiceQueries {
182
7
  getDocument(docId: PHID!, driveId: PHID): Invoice
@@ -325,64 +150,21 @@ export const schema = gql `
325
150
  docId: PHID
326
151
  input: Invoice_ClosePaymentInput
327
152
  ): Int
328
- Invoice_processGnosisPayment(
329
- chainName: String!
330
- paymentDetails: JSON!
331
- invoiceNo: String!
332
- ): ProcessGnosisPaymentOutput
333
- Invoice_createRequestFinancePayment(
334
- paymentData: JSON!
335
- ): CreateRequestFinancePaymentOutput
336
- Invoice_uploadInvoicePdfChunk(
337
- chunk: String!
338
- chunkIndex: Int!
339
- totalChunks: Int!
340
- fileName: String!
341
- sessionId: String!
342
- ): UploadInvoicePdfChunkOutput
343
153
  }
344
154
 
345
- """
346
- Output type for PDF chunk upload
347
- """
348
- type UploadInvoicePdfChunkOutput {
349
- success: Boolean!
350
- data: JSON
351
- error: String
352
- }
353
-
354
- """
355
- Output type for request finance payment
356
- """
357
- type CreateRequestFinancePaymentOutput {
358
- success: Boolean!
359
- data: JSON
360
- error: String
361
- }
362
-
363
- """
364
- Output type for process gnosis payment
365
- """
366
- type ProcessGnosisPaymentOutput {
367
- success: Boolean!
368
- data: JSON
369
- error: String
370
- }
371
-
372
- scalar JSON
373
-
374
155
  """
375
156
  Module: General
376
157
  """
377
158
  input Invoice_EditInvoiceInput {
378
159
  invoiceNo: String
379
160
  dateIssued: String
161
+ dateDelivered: String
380
162
  dateDue: String
381
163
  currency: String
382
164
  notes: String
383
165
  }
384
166
  input Invoice_EditStatusInput {
385
- status: Status!
167
+ status: Invoice_Status!
386
168
  }
387
169
  input Invoice_EditPaymentDataInput {
388
170
  id: OID!
@@ -432,7 +214,7 @@ export const schema = gql `
432
214
  BIC: String
433
215
  SWIFT: String
434
216
  accountNum: String
435
- accountType: InvoiceAccountTypeInput
217
+ accountType: Invoice_InvoiceAccountTypeInput
436
218
  beneficiary: String
437
219
  memo: String
438
220
  # intermediaryBank
@@ -447,7 +229,7 @@ export const schema = gql `
447
229
  BICIntermediary: String
448
230
  SWIFTIntermediary: String
449
231
  accountNumIntermediary: String
450
- accountTypeIntermediary: InvoiceAccountTypeInput
232
+ accountTypeIntermediary: Invoice_InvoiceAccountTypeInput
451
233
  beneficiaryIntermediary: String
452
234
  memoIntermediary: String
453
235
  }
@@ -482,7 +264,7 @@ export const schema = gql `
482
264
  BIC: String
483
265
  SWIFT: String
484
266
  accountNum: String
485
- accountType: InvoiceAccountTypeInput
267
+ accountType: Invoice_InvoiceAccountTypeInput
486
268
  beneficiary: String
487
269
  memo: String
488
270
  # intermediaryBank
@@ -497,7 +279,7 @@ export const schema = gql `
497
279
  BICIntermediary: String
498
280
  SWIFTIntermediary: String
499
281
  accountNumIntermediary: String
500
- accountTypeIntermediary: InvoiceAccountTypeInput
282
+ accountTypeIntermediary: Invoice_InvoiceAccountTypeInput
501
283
  beneficiaryIntermediary: String
502
284
  memoIntermediary: String
503
285
  }
@@ -564,7 +346,7 @@ export const schema = gql `
564
346
  _placeholder: String
565
347
  }
566
348
  input Invoice_RejectInput {
567
- id: OID! # New Rejection ID
349
+ id: OID! # New Invoice_Rejection ID
568
350
  reason: String!
569
351
  final: Boolean!
570
352
  }
@@ -576,7 +358,7 @@ export const schema = gql `
576
358
  _placeholder: String
577
359
  }
578
360
  input Invoice_SchedulePaymentInput {
579
- id: OID! # New Payment ID
361
+ id: OID! # New Invoice_Payment ID
580
362
  processorRef: String!
581
363
  }
582
364
  input Invoice_ReapprovePaymentInput {
@@ -584,23 +366,23 @@ export const schema = gql `
584
366
  _placeholder: String
585
367
  }
586
368
  input Invoice_RegisterPaymentTxInput {
587
- id: OID! # Payment ID
369
+ id: OID! # Invoice_Payment ID
588
370
  timestamp: DateTime!
589
371
  txRef: String!
590
372
  }
591
373
  input Invoice_ReportPaymentIssueInput {
592
- id: OID! # Payment ID
374
+ id: OID! # Invoice_Payment ID
593
375
  issue: String!
594
376
  }
595
377
  input Invoice_ConfirmPaymentInput {
596
- id: OID! # Payment ID
378
+ id: OID! # Invoice_Payment ID
597
379
  amount: Float!
598
380
  }
599
381
  input Invoice_ClosePaymentInput {
600
- closureReason: ClosureReasonInput
382
+ closureReason: Invoice_ClosureReasonInput
601
383
  }
602
384
 
603
- enum ClosureReasonInput {
385
+ enum Invoice_ClosureReasonInput {
604
386
  UNDERPAID
605
387
  OVERPAID
606
388
  CANCELLED
@@ -1,4 +1,4 @@
1
- declare let pendingTransactions: Record<string, {
1
+ declare const pendingTransactions: Record<string, {
2
2
  invoiceNo: string;
3
3
  chainName: string;
4
4
  paymentDetails: any;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customResolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/invoice-addon/customResolvers.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,mBAAmB,EAAE,MAAM,CAC/B,MAAM,EACN;IACE,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,GAAG,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CACG,CAAC;AAQP,UAAU,yBAAyB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAaD,eAAO,MAAM,4BAA4B,GAAU,GAAG,GAAG,EAAE,MAAM,GAAG,iBA8EnE,CAAC;AAEF,eAAO,MAAM,mCAAmC,GAC9C,GAAG,GAAG,EACN,MAAM,GAAG;;;;;;;;;;;EAoCV,CAAC;AAEF,eAAO,MAAM,6BAA6B,GACxC,GAAG,GAAG,EACN,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;EAgFhC,CAAC;AAGF,eAAO,MAAM,UAAU,GAAI,iBAAiB,GAAG,SAE9C,CAAC;AAGF,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAG/B,eAAO,MAAM,6BAA6B,YA2BzC,CAAC;AAmDF,eAAO,MAAM,aAAa,GAAU,KAAK,GAAG,EAAE,KAAK,GAAG,iBAuLrD,CAAC"}
@@ -4,7 +4,7 @@ import { actions } from "../../document-models/invoice/index.js";
4
4
  import { uploadPdfAndGetJsonClaude } from "../../scripts/invoice/pdfToClaudeAI.js";
5
5
  import * as crypto from "crypto";
6
6
  // Store pending transactions for webhook matching
7
- let pendingTransactions = {};
7
+ const pendingTransactions = {};
8
8
  // Add a set to track processed transaction hashes to avoid duplicate processing
9
9
  let processedTransactions = new Set();
10
10
  // Track in-flight payment requests to prevent concurrent processing of the same invoice
@@ -18,7 +18,7 @@ export const Invoice_processGnosisPayment = async (_, args) => {
18
18
  console.log("Processing gnosis payment:", {
19
19
  chainName,
20
20
  invoiceNo,
21
- paymentDetails
21
+ paymentDetails,
22
22
  });
23
23
  // Check if there's already a payment request in progress for this invoice
24
24
  const paymentKey = `payment-${invoiceNo}`;
@@ -41,7 +41,7 @@ export const Invoice_processGnosisPayment = async (_, args) => {
41
41
  invoiceNo,
42
42
  chainName,
43
43
  paymentDetails,
44
- timestamp: Date.now()
44
+ timestamp: Date.now(),
45
45
  };
46
46
  console.log(`Stored pending transaction ${transactionId} for invoice ${invoiceNo}`);
47
47
  }
@@ -84,7 +84,7 @@ export const Invoice_createRequestFinancePayment = async (_, args) => {
84
84
  if (!paymentData) {
85
85
  return {
86
86
  success: false,
87
- error: "No payment data provided"
87
+ error: "No payment data provided",
88
88
  };
89
89
  }
90
90
  console.log("Creating direct payment with data:", paymentData.invoiceNumber);
@@ -92,15 +92,15 @@ export const Invoice_createRequestFinancePayment = async (_, args) => {
92
92
  if (response.errors && response.errors.length > 0) {
93
93
  return {
94
94
  success: false,
95
- error: response.errors[0]
95
+ error: response.errors[0],
96
96
  };
97
97
  }
98
98
  return {
99
99
  success: true,
100
100
  data: {
101
101
  message: "Direct payment request received successfully",
102
- response
103
- }
102
+ response,
103
+ },
104
104
  };
105
105
  }
106
106
  catch (error) {
@@ -118,8 +118,8 @@ export const Invoice_uploadInvoicePdfChunk = async (_, args) => {
118
118
  // Initialize array for this file if it doesn't exist
119
119
  if (!fileChunksMap.has(fileKey)) {
120
120
  fileChunksMap.set(fileKey, {
121
- chunks: new Array(totalChunks).fill(''),
122
- receivedChunks: 0
121
+ chunks: new Array(totalChunks).fill(""),
122
+ receivedChunks: 0,
123
123
  });
124
124
  }
125
125
  // Get the file chunks data
@@ -131,7 +131,7 @@ export const Invoice_uploadInvoicePdfChunk = async (_, args) => {
131
131
  // If we've received all chunks, process the complete file
132
132
  if (fileData.receivedChunks === totalChunks) {
133
133
  // Combine all chunks
134
- const completeFile = fileData.chunks.join('');
134
+ const completeFile = fileData.chunks.join("");
135
135
  console.log("Processing PDF with Claude Haiku 4.5...");
136
136
  const startTime = Date.now();
137
137
  try {
@@ -141,16 +141,16 @@ export const Invoice_uploadInvoicePdfChunk = async (_, args) => {
141
141
  const responseData = {
142
142
  invoiceData: claudeResult.invoiceData,
143
143
  processingMetadata: {
144
- provider: 'claude-haiku-4.5',
144
+ provider: "claude-haiku-4.5",
145
145
  processingTimeMs: processingTime,
146
- processingTimestamp: new Date().toISOString()
147
- }
146
+ processingTimestamp: new Date().toISOString(),
147
+ },
148
148
  };
149
149
  // Clean up
150
150
  fileChunksMap.delete(fileKey);
151
151
  return {
152
152
  success: true,
153
- data: responseData
153
+ data: responseData,
154
154
  };
155
155
  }
156
156
  catch (error) {
@@ -158,7 +158,7 @@ export const Invoice_uploadInvoicePdfChunk = async (_, args) => {
158
158
  fileChunksMap.delete(fileKey);
159
159
  return {
160
160
  success: false,
161
- error: error instanceof Error ? error.message : 'Unknown error'
161
+ error: error instanceof Error ? error.message : "Unknown error",
162
162
  };
163
163
  }
164
164
  }
@@ -167,8 +167,8 @@ export const Invoice_uploadInvoicePdfChunk = async (_, args) => {
167
167
  success: true,
168
168
  data: {
169
169
  message: `Chunk ${chunkIndex + 1}/${totalChunks} received`,
170
- progress: (fileData.receivedChunks / totalChunks) * 100
171
- }
170
+ progress: (fileData.receivedChunks / totalChunks) * 100,
171
+ },
172
172
  };
173
173
  }
174
174
  catch (error) {
@@ -218,18 +218,18 @@ function isValidSignatureForStringBody(body, signature, signingKey) {
218
218
  }
219
219
  const updateDocumentStatus = async (invoiceNo) => {
220
220
  try {
221
- const drive = await reactor.getDrive('powerhouse');
222
- const documents = drive.state.global.nodes.filter((node) => node.documentType === 'powerhouse/invoice');
221
+ const drive = await reactor.getDrive("powerhouse");
222
+ const documents = drive.state.global.nodes.filter((node) => node.documentType === "powerhouse/invoice");
223
223
  if (documents.length === 0) {
224
224
  console.log(`No documents found for invoice ${invoiceNo}`);
225
225
  return Promise.reject(new Error(`No documents found for invoice ${invoiceNo}`));
226
226
  }
227
227
  for (const document of documents) {
228
- const invoiceDocument = await reactor.getDocument('powerhouse', document.id);
228
+ const invoiceDocument = await reactor.getDocument("powerhouse", document.id);
229
229
  const reactorInvoiceNo = invoiceDocument.state.global.invoiceNo;
230
230
  if (reactorInvoiceNo === invoiceNo) {
231
231
  console.log(`Changing status of Invoice No: ${invoiceNo} to PAID`);
232
- await reactor.addAction('powerhouse', document.id, actions.editStatus({
232
+ await reactor.addAction("powerhouse", document.id, actions.editStatus({
233
233
  status: "PAYMENTRECEIVED",
234
234
  }));
235
235
  return Promise.resolve();
@@ -244,25 +244,25 @@ const updateDocumentStatus = async (invoiceNo) => {
244
244
  // Webhook handler method
245
245
  export const handleWebhook = async (req, res) => {
246
246
  try {
247
- console.log('Webhook received');
247
+ console.log("Webhook received");
248
248
  // Log all headers to debug
249
249
  // console.log('Webhook request headers:', req.headers);
250
250
  // console.log('Webhook request body:', req.body);
251
251
  // Get the request body and signature
252
- let payload = req.body;
253
- let rawBody = JSON.stringify(payload);
254
- const signature = req.headers['x-alchemy-signature'];
252
+ const payload = req.body;
253
+ const rawBody = JSON.stringify(payload);
254
+ const signature = req.headers["x-alchemy-signature"];
255
255
  if (!signature) {
256
- console.warn('Missing signature header');
256
+ console.warn("Missing signature header");
257
257
  // For testing, continue anyway
258
258
  // return res.status(400).json({ error: 'Missing signature header' });
259
259
  }
260
260
  else {
261
261
  // Validate the signature
262
- const signingKey = process.env.ALCHEMY_SIGNING_KEY || 'whsec_test';
262
+ const signingKey = process.env.ALCHEMY_SIGNING_KEY || "whsec_test";
263
263
  const isValid = isValidSignatureForStringBody(rawBody, signature, signingKey);
264
264
  if (!isValid) {
265
- console.warn('Invalid signature');
265
+ console.warn("Invalid signature");
266
266
  // For testing, continue anyway
267
267
  // return res.status(401).json({ error: 'Invalid signature' });
268
268
  }
@@ -277,7 +277,10 @@ export const handleWebhook = async (req, res) => {
277
277
  : [payload.event.activity];
278
278
  for (const activity of activities) {
279
279
  // Check if this is a transaction with relevant details
280
- if (activity.category === 'token' && activity.fromAddress && activity.toAddress && activity.rawContract) {
280
+ if (activity.category === "token" &&
281
+ activity.fromAddress &&
282
+ activity.toAddress &&
283
+ activity.rawContract) {
281
284
  console.log(`Processing token transfer from ${activity.fromAddress} to ${activity.toAddress}`);
282
285
  // Check if we've already processed this transaction
283
286
  if (activity.hash && processedTransactions.has(activity.hash)) {
@@ -316,7 +319,8 @@ export const handleWebhook = async (req, res) => {
316
319
  // Allow for a small difference due to precision issues
317
320
  const amountDifference = Math.abs(expectedAmount - actualAmount);
318
321
  const isAmountSimilar = amountDifference < 0.0001 ||
319
- (expectedAmount > 0 && amountDifference / expectedAmount < 0.01); // 1% tolerance
322
+ (expectedAmount > 0 &&
323
+ amountDifference / expectedAmount < 0.01); // 1% tolerance
320
324
  if (isAmountSimilar) {
321
325
  console.log(`Found matching transaction for invoice ${txInfo.invoiceNo}`);
322
326
  console.log(`Expected: ${expectedAmount}, Actual: ${actualAmount}`);
@@ -355,7 +359,7 @@ export const handleWebhook = async (req, res) => {
355
359
  }
356
360
  }
357
361
  else {
358
- console.log('No matching pending transaction found for this activity');
362
+ console.log("No matching pending transaction found for this activity");
359
363
  }
360
364
  }
361
365
  }
@@ -363,13 +367,13 @@ export const handleWebhook = async (req, res) => {
363
367
  // For testing, just acknowledge receipt
364
368
  return res.status(200).json({
365
369
  success: true,
366
- message: 'Webhook received successfully'
370
+ message: "Webhook received successfully",
367
371
  });
368
372
  }
369
373
  catch (error) {
370
- console.error('Error processing webhook:', error);
374
+ console.error("Error processing webhook:", error);
371
375
  return res.status(500).json({
372
- error: error instanceof Error ? error.message : 'Unknown error'
376
+ error: error instanceof Error ? error.message : "Unknown error",
373
377
  });
374
378
  }
375
379
  };
@@ -0,0 +1,11 @@
1
+ import { BaseSubgraph } from "@powerhousedao/reactor-api";
2
+ import type { DocumentNode } from "graphql";
3
+ export declare class InvoiceAddonSubgraph extends BaseSubgraph {
4
+ name: string;
5
+ typeDefs: DocumentNode;
6
+ resolvers: Record<string, unknown>;
7
+ additionalContextFields: {};
8
+ onSetup(): Promise<void>;
9
+ onDisconnect(): Promise<void>;
10
+ }
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/invoice-addon/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5C,qBAAa,oBAAqB,SAAQ,YAAY;IACpD,IAAI,SAAmB;IACvB,QAAQ,EAAE,YAAY,CAAU;IAChC,SAAS,0BAAsB;IAC/B,uBAAuB,KAAM;IACvB,OAAO;IACP,YAAY;CACnB"}
@@ -0,0 +1,11 @@
1
+ import { BaseSubgraph } from "@powerhousedao/reactor-api";
2
+ import { schema } from "./schema.js";
3
+ import { getResolvers } from "./resolvers.js";
4
+ export class InvoiceAddonSubgraph extends BaseSubgraph {
5
+ name = "invoice-addon";
6
+ typeDefs = schema;
7
+ resolvers = getResolvers(this);
8
+ additionalContextFields = {};
9
+ async onSetup() { }
10
+ async onDisconnect() { }
11
+ }
@@ -0,0 +1,3 @@
1
+ import { type ISubgraph } from "@powerhousedao/reactor-api";
2
+ export declare const getResolvers: (subgraph: ISubgraph) => Record<string, unknown>;
3
+ //# sourceMappingURL=resolvers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/invoice-addon/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAO5D,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAUxE,CAAC"}
@@ -0,0 +1,12 @@
1
+ import {} from "@powerhousedao/reactor-api";
2
+ import { Invoice_processGnosisPayment, Invoice_createRequestFinancePayment, Invoice_uploadInvoicePdfChunk, } from "./customResolvers.js";
3
+ export const getResolvers = (subgraph) => {
4
+ const reactor = subgraph.reactor;
5
+ return {
6
+ Mutation: {
7
+ Invoice_processGnosisPayment: Invoice_processGnosisPayment,
8
+ Invoice_createRequestFinancePayment: Invoice_createRequestFinancePayment,
9
+ Invoice_uploadInvoicePdfChunk: Invoice_uploadInvoicePdfChunk,
10
+ },
11
+ };
12
+ };
@@ -0,0 +1,3 @@
1
+ import type { DocumentNode } from "graphql";
2
+ export declare const schema: DocumentNode;
3
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/invoice-addon/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YAkDpB,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { gql } from "graphql-tag";
2
+ export const schema = gql `
3
+ """
4
+ Subgraph definition
5
+ """
6
+ type Mutation {
7
+ Invoice_processGnosisPayment(
8
+ chainName: String!
9
+ paymentDetails: JSON!
10
+ invoiceNo: String!
11
+ ): ProcessGnosisPaymentOutput
12
+ Invoice_createRequestFinancePayment(
13
+ paymentData: JSON!
14
+ ): CreateRequestFinancePaymentOutput
15
+ Invoice_uploadInvoicePdfChunk(
16
+ chunk: String!
17
+ chunkIndex: Int!
18
+ totalChunks: Int!
19
+ fileName: String!
20
+ sessionId: String!
21
+ ): UploadInvoicePdfChunkOutput
22
+ }
23
+
24
+ """
25
+ Output type for PDF chunk upload
26
+ """
27
+ type UploadInvoicePdfChunkOutput {
28
+ success: Boolean!
29
+ data: JSON
30
+ error: String
31
+ }
32
+
33
+ """
34
+ Output type for request finance payment
35
+ """
36
+ type CreateRequestFinancePaymentOutput {
37
+ success: Boolean!
38
+ data: JSON
39
+ error: String
40
+ }
41
+
42
+ """
43
+ Output type for process gnosis payment
44
+ """
45
+ type ProcessGnosisPaymentOutput {
46
+ success: Boolean!
47
+ data: JSON
48
+ error: String
49
+ }
50
+
51
+ scalar JSON
52
+ `;