@powerhousedao/contributor-billing 0.0.1

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 (282) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +22 -0
  3. package/dist/document-models/index.d.ts +2 -0
  4. package/dist/document-models/index.d.ts.map +1 -0
  5. package/dist/document-models/index.js +1 -0
  6. package/dist/document-models/invoice/gen/actions.d.ts +8 -0
  7. package/dist/document-models/invoice/gen/actions.d.ts.map +1 -0
  8. package/dist/document-models/invoice/gen/actions.js +3 -0
  9. package/dist/document-models/invoice/gen/creators.d.ts +4 -0
  10. package/dist/document-models/invoice/gen/creators.d.ts.map +1 -0
  11. package/dist/document-models/invoice/gen/creators.js +3 -0
  12. package/dist/document-models/invoice/gen/document-model.d.ts +3 -0
  13. package/dist/document-models/invoice/gen/document-model.d.ts.map +1 -0
  14. package/dist/document-models/invoice/gen/document-model.js +227 -0
  15. package/dist/document-models/invoice/gen/general/actions.d.ts +10 -0
  16. package/dist/document-models/invoice/gen/general/actions.d.ts.map +1 -0
  17. package/dist/document-models/invoice/gen/general/actions.js +1 -0
  18. package/dist/document-models/invoice/gen/general/creators.d.ts +9 -0
  19. package/dist/document-models/invoice/gen/general/creators.d.ts.map +1 -0
  20. package/dist/document-models/invoice/gen/general/creators.js +8 -0
  21. package/dist/document-models/invoice/gen/general/error.d.ts +2 -0
  22. package/dist/document-models/invoice/gen/general/error.d.ts.map +1 -0
  23. package/dist/document-models/invoice/gen/general/error.js +1 -0
  24. package/dist/document-models/invoice/gen/general/object.d.ts +12 -0
  25. package/dist/document-models/invoice/gen/general/object.d.ts.map +1 -0
  26. package/dist/document-models/invoice/gen/general/object.js +22 -0
  27. package/dist/document-models/invoice/gen/general/operations.d.ts +12 -0
  28. package/dist/document-models/invoice/gen/general/operations.d.ts.map +1 -0
  29. package/dist/document-models/invoice/gen/general/operations.js +1 -0
  30. package/dist/document-models/invoice/gen/index.d.ts +6 -0
  31. package/dist/document-models/invoice/gen/index.d.ts.map +1 -0
  32. package/dist/document-models/invoice/gen/index.js +5 -0
  33. package/dist/document-models/invoice/gen/items/actions.d.ts +8 -0
  34. package/dist/document-models/invoice/gen/items/actions.d.ts.map +1 -0
  35. package/dist/document-models/invoice/gen/items/actions.js +1 -0
  36. package/dist/document-models/invoice/gen/items/creators.d.ts +7 -0
  37. package/dist/document-models/invoice/gen/items/creators.d.ts.map +1 -0
  38. package/dist/document-models/invoice/gen/items/creators.js +6 -0
  39. package/dist/document-models/invoice/gen/items/error.d.ts +2 -0
  40. package/dist/document-models/invoice/gen/items/error.d.ts.map +1 -0
  41. package/dist/document-models/invoice/gen/items/error.js +1 -0
  42. package/dist/document-models/invoice/gen/items/object.d.ts +10 -0
  43. package/dist/document-models/invoice/gen/items/object.d.ts.map +1 -0
  44. package/dist/document-models/invoice/gen/items/object.js +16 -0
  45. package/dist/document-models/invoice/gen/items/operations.d.ts +10 -0
  46. package/dist/document-models/invoice/gen/items/operations.d.ts.map +1 -0
  47. package/dist/document-models/invoice/gen/items/operations.js +1 -0
  48. package/dist/document-models/invoice/gen/object.d.ts +20 -0
  49. package/dist/document-models/invoice/gen/object.d.ts.map +1 -0
  50. package/dist/document-models/invoice/gen/object.js +29 -0
  51. package/dist/document-models/invoice/gen/parties/actions.d.ts +10 -0
  52. package/dist/document-models/invoice/gen/parties/actions.d.ts.map +1 -0
  53. package/dist/document-models/invoice/gen/parties/actions.js +1 -0
  54. package/dist/document-models/invoice/gen/parties/creators.d.ts +9 -0
  55. package/dist/document-models/invoice/gen/parties/creators.d.ts.map +1 -0
  56. package/dist/document-models/invoice/gen/parties/creators.js +8 -0
  57. package/dist/document-models/invoice/gen/parties/error.d.ts +2 -0
  58. package/dist/document-models/invoice/gen/parties/error.d.ts.map +1 -0
  59. package/dist/document-models/invoice/gen/parties/error.js +1 -0
  60. package/dist/document-models/invoice/gen/parties/object.d.ts +12 -0
  61. package/dist/document-models/invoice/gen/parties/object.d.ts.map +1 -0
  62. package/dist/document-models/invoice/gen/parties/object.js +22 -0
  63. package/dist/document-models/invoice/gen/parties/operations.d.ts +12 -0
  64. package/dist/document-models/invoice/gen/parties/operations.d.ts.map +1 -0
  65. package/dist/document-models/invoice/gen/parties/operations.js +1 -0
  66. package/dist/document-models/invoice/gen/reducer.d.ts +3 -0
  67. package/dist/document-models/invoice/gen/reducer.d.ts.map +1 -0
  68. package/dist/document-models/invoice/gen/reducer.js +79 -0
  69. package/dist/document-models/invoice/gen/schema/index.d.ts +3 -0
  70. package/dist/document-models/invoice/gen/schema/index.d.ts.map +1 -0
  71. package/dist/document-models/invoice/gen/schema/index.js +2 -0
  72. package/dist/document-models/invoice/gen/schema/types.d.ts +390 -0
  73. package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -0
  74. package/dist/document-models/invoice/gen/schema/types.js +1 -0
  75. package/dist/document-models/invoice/gen/schema/zod.d.ts +56 -0
  76. package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -0
  77. package/dist/document-models/invoice/gen/schema/zod.js +362 -0
  78. package/dist/document-models/invoice/gen/types.d.ts +10 -0
  79. package/dist/document-models/invoice/gen/types.d.ts.map +1 -0
  80. package/dist/document-models/invoice/gen/types.js +1 -0
  81. package/dist/document-models/invoice/gen/utils.d.ts +7 -0
  82. package/dist/document-models/invoice/gen/utils.d.ts.map +1 -0
  83. package/dist/document-models/invoice/gen/utils.js +166 -0
  84. package/dist/document-models/invoice/index.d.ts +41 -0
  85. package/dist/document-models/invoice/index.d.ts.map +1 -0
  86. package/dist/document-models/invoice/index.js +21 -0
  87. package/dist/document-models/invoice/src/reducers/general.d.ts +8 -0
  88. package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -0
  89. package/dist/document-models/invoice/src/reducers/general.js +79 -0
  90. package/dist/document-models/invoice/src/reducers/items.d.ts +8 -0
  91. package/dist/document-models/invoice/src/reducers/items.d.ts.map +1 -0
  92. package/dist/document-models/invoice/src/reducers/items.js +108 -0
  93. package/dist/document-models/invoice/src/reducers/parties.d.ts +8 -0
  94. package/dist/document-models/invoice/src/reducers/parties.d.ts.map +1 -0
  95. package/dist/document-models/invoice/src/reducers/parties.js +266 -0
  96. package/dist/document-models/invoice/src/tests/document-model.test.d.ts +6 -0
  97. package/dist/document-models/invoice/src/tests/document-model.test.d.ts.map +1 -0
  98. package/dist/document-models/invoice/src/tests/document-model.test.js +17 -0
  99. package/dist/document-models/invoice/src/tests/general.test.d.ts +6 -0
  100. package/dist/document-models/invoice/src/tests/general.test.d.ts.map +1 -0
  101. package/dist/document-models/invoice/src/tests/general.test.js +75 -0
  102. package/dist/document-models/invoice/src/tests/items.test.d.ts +6 -0
  103. package/dist/document-models/invoice/src/tests/items.test.d.ts.map +1 -0
  104. package/dist/document-models/invoice/src/tests/items.test.js +45 -0
  105. package/dist/document-models/invoice/src/tests/parties.test.d.ts +6 -0
  106. package/dist/document-models/invoice/src/tests/parties.test.d.ts.map +1 -0
  107. package/dist/document-models/invoice/src/tests/parties.test.js +75 -0
  108. package/dist/document-models/invoice/src/utils.d.ts +2 -0
  109. package/dist/document-models/invoice/src/utils.d.ts.map +1 -0
  110. package/dist/document-models/invoice/src/utils.js +1 -0
  111. package/dist/editors/contributor-billing/components/CreateDocument.d.ts +8 -0
  112. package/dist/editors/contributor-billing/components/CreateDocument.d.ts.map +1 -0
  113. package/dist/editors/contributor-billing/components/CreateDocument.js +14 -0
  114. package/dist/editors/contributor-billing/components/DocumentDispatch.d.ts +12 -0
  115. package/dist/editors/contributor-billing/components/DocumentDispatch.d.ts.map +1 -0
  116. package/dist/editors/contributor-billing/components/DocumentDispatch.js +20 -0
  117. package/dist/editors/contributor-billing/components/DriveExplorer.d.ts +17 -0
  118. package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -0
  119. package/dist/editors/contributor-billing/components/DriveExplorer.js +112 -0
  120. package/dist/editors/contributor-billing/components/EditorContainer.d.ts +14 -0
  121. package/dist/editors/contributor-billing/components/EditorContainer.d.ts.map +1 -0
  122. package/dist/editors/contributor-billing/components/EditorContainer.js +28 -0
  123. package/dist/editors/contributor-billing/components/FileItemsGrid.d.ts +12 -0
  124. package/dist/editors/contributor-billing/components/FileItemsGrid.d.ts.map +1 -0
  125. package/dist/editors/contributor-billing/components/FileItemsGrid.js +7 -0
  126. package/dist/editors/contributor-billing/components/FolderItemsGrid.d.ts +17 -0
  127. package/dist/editors/contributor-billing/components/FolderItemsGrid.d.ts.map +1 -0
  128. package/dist/editors/contributor-billing/components/FolderItemsGrid.js +14 -0
  129. package/dist/editors/contributor-billing/components/FolderTree.d.ts +9 -0
  130. package/dist/editors/contributor-billing/components/FolderTree.d.ts.map +1 -0
  131. package/dist/editors/contributor-billing/components/FolderTree.js +31 -0
  132. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +16 -0
  133. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -0
  134. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.js +16 -0
  135. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +21 -0
  136. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -0
  137. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +45 -0
  138. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts +12 -0
  139. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -0
  140. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.js +12 -0
  141. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts +7 -0
  142. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.d.ts.map +1 -0
  143. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableSection.js +7 -0
  144. package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.d.ts +8 -0
  145. package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.d.ts.map +1 -0
  146. package/dist/editors/contributor-billing/components/InvoiceTable/RowActionMenu.js +2 -0
  147. package/dist/editors/contributor-billing/editor.d.ts +6 -0
  148. package/dist/editors/contributor-billing/editor.d.ts.map +1 -0
  149. package/dist/editors/contributor-billing/editor.js +48 -0
  150. package/dist/editors/contributor-billing/hooks/useDispatchMap.d.ts +9 -0
  151. package/dist/editors/contributor-billing/hooks/useDispatchMap.d.ts.map +1 -0
  152. package/dist/editors/contributor-billing/hooks/useDispatchMap.js +21 -0
  153. package/dist/editors/contributor-billing/hooks/useDrop.d.ts +22 -0
  154. package/dist/editors/contributor-billing/hooks/useDrop.d.ts.map +1 -0
  155. package/dist/editors/contributor-billing/hooks/useDrop.js +57 -0
  156. package/dist/editors/contributor-billing/hooks/useSelectedFolderChildren.d.ts +8 -0
  157. package/dist/editors/contributor-billing/hooks/useSelectedFolderChildren.d.ts.map +1 -0
  158. package/dist/editors/contributor-billing/hooks/useSelectedFolderChildren.js +19 -0
  159. package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts +4 -0
  160. package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts.map +1 -0
  161. package/dist/editors/contributor-billing/hooks/useTransformedNodes.js +32 -0
  162. package/dist/editors/contributor-billing/index.d.ts +5 -0
  163. package/dist/editors/contributor-billing/index.d.ts.map +1 -0
  164. package/dist/editors/contributor-billing/index.js +12 -0
  165. package/dist/editors/index.d.ts +3 -0
  166. package/dist/editors/index.d.ts.map +1 -0
  167. package/dist/editors/index.js +2 -0
  168. package/dist/editors/invoice/InvoicePDF.d.ts +8 -0
  169. package/dist/editors/invoice/InvoicePDF.d.ts.map +1 -0
  170. package/dist/editors/invoice/InvoicePDF.js +359 -0
  171. package/dist/editors/invoice/assets/custom.d.ts +4 -0
  172. package/dist/editors/invoice/assets/powerhouseLogo.png +0 -0
  173. package/dist/editors/invoice/components/countryForm.d.ts +12 -0
  174. package/dist/editors/invoice/components/countryForm.d.ts.map +1 -0
  175. package/dist/editors/invoice/components/countryForm.js +28 -0
  176. package/dist/editors/invoice/components/currencyForm.d.ts +13 -0
  177. package/dist/editors/invoice/components/currencyForm.d.ts.map +1 -0
  178. package/dist/editors/invoice/components/currencyForm.js +26 -0
  179. package/dist/editors/invoice/components/datePicker.d.ts +11 -0
  180. package/dist/editors/invoice/components/datePicker.d.ts.map +1 -0
  181. package/dist/editors/invoice/components/datePicker.js +8 -0
  182. package/dist/editors/invoice/components/inputField.d.ts +14 -0
  183. package/dist/editors/invoice/components/inputField.d.ts.map +1 -0
  184. package/dist/editors/invoice/components/inputField.js +25 -0
  185. package/dist/editors/invoice/components/numberForm.d.ts +11 -0
  186. package/dist/editors/invoice/components/numberForm.d.ts.map +1 -0
  187. package/dist/editors/invoice/components/numberForm.js +7 -0
  188. package/dist/editors/invoice/components/selectField.d.ts +8 -0
  189. package/dist/editors/invoice/components/selectField.d.ts.map +1 -0
  190. package/dist/editors/invoice/components/selectField.js +323 -0
  191. package/dist/editors/invoice/editor.d.ts +5 -0
  192. package/dist/editors/invoice/editor.d.ts.map +1 -0
  193. package/dist/editors/invoice/editor.js +377 -0
  194. package/dist/editors/invoice/exportUBL.d.ts +85 -0
  195. package/dist/editors/invoice/exportUBL.d.ts.map +1 -0
  196. package/dist/editors/invoice/exportUBL.js +382 -0
  197. package/dist/editors/invoice/index.d.ts +5 -0
  198. package/dist/editors/invoice/index.d.ts.map +1 -0
  199. package/dist/editors/invoice/index.js +12 -0
  200. package/dist/editors/invoice/ingestPDF.d.ts +12 -0
  201. package/dist/editors/invoice/ingestPDF.d.ts.map +1 -0
  202. package/dist/editors/invoice/ingestPDF.js +193 -0
  203. package/dist/editors/invoice/ingestUBL.d.ts +21 -0
  204. package/dist/editors/invoice/ingestUBL.d.ts.map +1 -0
  205. package/dist/editors/invoice/ingestUBL.js +169 -0
  206. package/dist/editors/invoice/invoiceToGnosis.d.ts +7 -0
  207. package/dist/editors/invoice/invoiceToGnosis.d.ts.map +1 -0
  208. package/dist/editors/invoice/invoiceToGnosis.js +139 -0
  209. package/dist/editors/invoice/legalEntity/bankSection.d.ts +14 -0
  210. package/dist/editors/invoice/legalEntity/bankSection.d.ts.map +1 -0
  211. package/dist/editors/invoice/legalEntity/bankSection.js +156 -0
  212. package/dist/editors/invoice/legalEntity/common.d.ts +6 -0
  213. package/dist/editors/invoice/legalEntity/common.d.ts.map +1 -0
  214. package/dist/editors/invoice/legalEntity/common.js +6 -0
  215. package/dist/editors/invoice/legalEntity/legalEntity.d.ts +40 -0
  216. package/dist/editors/invoice/legalEntity/legalEntity.d.ts.map +1 -0
  217. package/dist/editors/invoice/legalEntity/legalEntity.js +63 -0
  218. package/dist/editors/invoice/legalEntity/walletSection.d.ts +13 -0
  219. package/dist/editors/invoice/legalEntity/walletSection.d.ts.map +1 -0
  220. package/dist/editors/invoice/legalEntity/walletSection.js +55 -0
  221. package/dist/editors/invoice/lineItems.d.ts +23 -0
  222. package/dist/editors/invoice/lineItems.d.ts.map +1 -0
  223. package/dist/editors/invoice/lineItems.js +157 -0
  224. package/dist/editors/invoice/requestFinance.d.ts +7 -0
  225. package/dist/editors/invoice/requestFinance.d.ts.map +1 -0
  226. package/dist/editors/invoice/requestFinance.js +155 -0
  227. package/dist/editors/invoice/uploadPdfChunked.d.ts +10 -0
  228. package/dist/editors/invoice/uploadPdfChunked.d.ts.map +1 -0
  229. package/dist/editors/invoice/uploadPdfChunked.js +79 -0
  230. package/dist/editors/invoice/utils/utils.d.ts +2 -0
  231. package/dist/editors/invoice/utils/utils.d.ts.map +1 -0
  232. package/dist/editors/invoice/utils/utils.js +54 -0
  233. package/dist/editors/invoice/validation/validationManager.d.ts +28 -0
  234. package/dist/editors/invoice/validation/validationManager.d.ts.map +1 -0
  235. package/dist/editors/invoice/validation/validationManager.js +65 -0
  236. package/dist/editors/invoice/validation/validationRules.d.ts +14 -0
  237. package/dist/editors/invoice/validation/validationRules.d.ts.map +1 -0
  238. package/dist/editors/invoice/validation/validationRules.js +334 -0
  239. package/dist/index.d.ts +5 -0
  240. package/dist/index.d.ts.map +1 -0
  241. package/dist/index.js +6 -0
  242. package/dist/powerhouse.manifest.json +31 -0
  243. package/dist/processors/index.d.ts +2 -0
  244. package/dist/processors/index.d.ts.map +1 -0
  245. package/dist/processors/index.js +1 -0
  246. package/dist/scripts/invoice/exampleBatchTxn.d.ts +2 -0
  247. package/dist/scripts/invoice/exampleBatchTxn.d.ts.map +1 -0
  248. package/dist/scripts/invoice/exampleBatchTxn.js +44 -0
  249. package/dist/scripts/invoice/gnosisTransactionBuilder.d.ts +28 -0
  250. package/dist/scripts/invoice/gnosisTransactionBuilder.d.ts.map +1 -0
  251. package/dist/scripts/invoice/gnosisTransactionBuilder.js +74 -0
  252. package/dist/scripts/invoice/pdfToDocumentAi.d.ts +5 -0
  253. package/dist/scripts/invoice/pdfToDocumentAi.d.ts.map +1 -0
  254. package/dist/scripts/invoice/pdfToDocumentAi.js +659 -0
  255. package/dist/scripts/invoice/requestFinance.d.ts +2 -0
  256. package/dist/scripts/invoice/requestFinance.d.ts.map +1 -0
  257. package/dist/scripts/invoice/requestFinance.js +38 -0
  258. package/dist/style.css +6463 -0
  259. package/dist/subgraphs/index.d.ts +2 -0
  260. package/dist/subgraphs/index.d.ts.map +1 -0
  261. package/dist/subgraphs/index.js +1 -0
  262. package/dist/subgraphs/invoice/customResolvers.d.ts +50 -0
  263. package/dist/subgraphs/invoice/customResolvers.d.ts.map +1 -0
  264. package/dist/subgraphs/invoice/customResolvers.js +327 -0
  265. package/dist/subgraphs/invoice/index.d.ts +10 -0
  266. package/dist/subgraphs/invoice/index.d.ts.map +1 -0
  267. package/dist/subgraphs/invoice/index.js +30 -0
  268. package/dist/subgraphs/invoice/resolvers.d.ts +3 -0
  269. package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -0
  270. package/dist/subgraphs/invoice/resolvers.js +184 -0
  271. package/dist/subgraphs/invoice/schema.d.ts +3 -0
  272. package/dist/subgraphs/invoice/schema.d.ts.map +1 -0
  273. package/dist/subgraphs/invoice/schema.js +460 -0
  274. package/dist/tailwind.config.d.ts +13 -0
  275. package/dist/tailwind.config.d.ts.map +1 -0
  276. package/dist/tailwind.config.js +15 -0
  277. package/dist/vitest.config.d.ts +3 -0
  278. package/dist/vitest.config.d.ts.map +1 -0
  279. package/dist/vitest.config.js +8 -0
  280. package/editors/invoice/assets/custom.d.ts +4 -0
  281. package/editors/invoice/assets/powerhouseLogo.png +0 -0
  282. package/package.json +117 -0
@@ -0,0 +1,45 @@
1
+ /**
2
+ * This is a scaffold file meant for customization:
3
+ * - change it by adding new tests or modifying the existing ones
4
+ */
5
+ import { generateMock } from "@powerhousedao/codegen";
6
+ import utils from "../../gen/utils.js";
7
+ import { z, } from "../../gen/schema/index.js";
8
+ import { reducer } from "../../gen/reducer.js";
9
+ import * as creators from "../../gen/items/creators.js";
10
+ describe("Items Operations", () => {
11
+ let document;
12
+ beforeEach(() => {
13
+ document = utils.createDocument();
14
+ });
15
+ it("should handle addLineItem operation", () => {
16
+ // generate a random id
17
+ // const id = documentModelUtils.hashKey();
18
+ const input = generateMock(z.AddLineItemInputSchema());
19
+ const updatedDocument = reducer(document, creators.addLineItem(input));
20
+ expect(updatedDocument.operations.global).toHaveLength(1);
21
+ expect(updatedDocument.operations.global[0].type).toBe("ADD_LINE_ITEM");
22
+ expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
23
+ expect(updatedDocument.operations.global[0].index).toEqual(0);
24
+ });
25
+ it("should handle editLineItem operation", () => {
26
+ // generate a random id
27
+ // const id = documentModelUtils.hashKey();
28
+ const input = generateMock(z.EditLineItemInputSchema());
29
+ const updatedDocument = reducer(document, creators.editLineItem(input));
30
+ expect(updatedDocument.operations.global).toHaveLength(1);
31
+ expect(updatedDocument.operations.global[0].type).toBe("EDIT_LINE_ITEM");
32
+ expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
33
+ expect(updatedDocument.operations.global[0].index).toEqual(0);
34
+ });
35
+ it("should handle deleteLineItem operation", () => {
36
+ // generate a random id
37
+ // const id = documentModelUtils.hashKey();
38
+ const input = generateMock(z.DeleteLineItemInputSchema());
39
+ const updatedDocument = reducer(document, creators.deleteLineItem(input));
40
+ expect(updatedDocument.operations.global).toHaveLength(1);
41
+ expect(updatedDocument.operations.global[0].type).toBe("DELETE_LINE_ITEM");
42
+ expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
43
+ expect(updatedDocument.operations.global[0].index).toEqual(0);
44
+ });
45
+ });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This is a scaffold file meant for customization:
3
+ * - change it by adding new tests or modifying the existing ones
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=parties.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parties.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/src/tests/parties.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * This is a scaffold file meant for customization:
3
+ * - change it by adding new tests or modifying the existing ones
4
+ */
5
+ import { generateMock } from "@powerhousedao/codegen";
6
+ import utils from "../../gen/utils.js";
7
+ import { z, } from "../../gen/schema/index.js";
8
+ import { reducer } from "../../gen/reducer.js";
9
+ import * as creators from "../../gen/parties/creators.js";
10
+ describe("Parties Operations", () => {
11
+ let document;
12
+ beforeEach(() => {
13
+ document = utils.createDocument();
14
+ });
15
+ it("should handle editIssuer operation", () => {
16
+ // generate a random id
17
+ // const id = documentModelUtils.hashKey();
18
+ const input = generateMock(z.EditIssuerInputSchema());
19
+ const updatedDocument = reducer(document, creators.editIssuer(input));
20
+ expect(updatedDocument.operations.global).toHaveLength(1);
21
+ expect(updatedDocument.operations.global[0].type).toBe("EDIT_ISSUER");
22
+ expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
23
+ expect(updatedDocument.operations.global[0].index).toEqual(0);
24
+ });
25
+ it("should handle editIssuerBank operation", () => {
26
+ // generate a random id
27
+ // const id = documentModelUtils.hashKey();
28
+ const input = generateMock(z.EditIssuerBankInputSchema());
29
+ const updatedDocument = reducer(document, creators.editIssuerBank(input));
30
+ expect(updatedDocument.operations.global).toHaveLength(1);
31
+ expect(updatedDocument.operations.global[0].type).toBe("EDIT_ISSUER_BANK");
32
+ expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
33
+ expect(updatedDocument.operations.global[0].index).toEqual(0);
34
+ });
35
+ it("should handle editIssuerWallet operation", () => {
36
+ // generate a random id
37
+ // const id = documentModelUtils.hashKey();
38
+ const input = generateMock(z.EditIssuerWalletInputSchema());
39
+ const updatedDocument = reducer(document, creators.editIssuerWallet(input));
40
+ expect(updatedDocument.operations.global).toHaveLength(1);
41
+ expect(updatedDocument.operations.global[0].type).toBe("EDIT_ISSUER_WALLET");
42
+ expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
43
+ expect(updatedDocument.operations.global[0].index).toEqual(0);
44
+ });
45
+ it("should handle editPayer operation", () => {
46
+ // generate a random id
47
+ // const id = documentModelUtils.hashKey();
48
+ const input = generateMock(z.EditPayerInputSchema());
49
+ const updatedDocument = reducer(document, creators.editPayer(input));
50
+ expect(updatedDocument.operations.global).toHaveLength(1);
51
+ expect(updatedDocument.operations.global[0].type).toBe("EDIT_PAYER");
52
+ expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
53
+ expect(updatedDocument.operations.global[0].index).toEqual(0);
54
+ });
55
+ it("should handle editPayerBank operation", () => {
56
+ // generate a random id
57
+ // const id = documentModelUtils.hashKey();
58
+ const input = generateMock(z.EditPayerBankInputSchema());
59
+ const updatedDocument = reducer(document, creators.editPayerBank(input));
60
+ expect(updatedDocument.operations.global).toHaveLength(1);
61
+ expect(updatedDocument.operations.global[0].type).toBe("EDIT_PAYER_BANK");
62
+ expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
63
+ expect(updatedDocument.operations.global[0].index).toEqual(0);
64
+ });
65
+ it("should handle editPayerWallet operation", () => {
66
+ // generate a random id
67
+ // const id = documentModelUtils.hashKey();
68
+ const input = generateMock(z.EditPayerWalletInputSchema());
69
+ const updatedDocument = reducer(document, creators.editPayerWallet(input));
70
+ expect(updatedDocument.operations.global).toHaveLength(1);
71
+ expect(updatedDocument.operations.global[0].type).toBe("EDIT_PAYER_WALLET");
72
+ expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
73
+ expect(updatedDocument.operations.global[0].index).toEqual(0);
74
+ });
75
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../document-models/invoice/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import { type DocumentModelModule } from "document-model";
2
+ interface CreateDocumentProps {
3
+ documentModels?: DocumentModelModule[];
4
+ createDocument: (doc: DocumentModelModule) => void;
5
+ }
6
+ export declare const CreateDocument: React.FC<CreateDocumentProps>;
7
+ export {};
8
+ //# sourceMappingURL=CreateDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreateDocument.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/CreateDocument.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,UAAU,mBAAmB;IAC3B,cAAc,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACvC,cAAc,EAAE,CAAC,GAAG,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACpD;AAUD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA4BxD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button } from "@powerhousedao/design-system";
3
+ function getDocumentSpec(doc) {
4
+ if ("documentModelState" in doc) {
5
+ return doc.documentModelState;
6
+ }
7
+ return doc.documentModel;
8
+ }
9
+ export const CreateDocument = ({ documentModels, createDocument, }) => {
10
+ return (_jsxs("div", { className: "px-6", children: [_jsx("h3", { className: "mb-3 mt-4 text-sm font-bold text-gray-600", children: "New document" }), _jsx("div", { className: "flex w-full flex-wrap gap-4", children: documentModels?.map((doc) => {
11
+ const spec = getDocumentSpec(doc);
12
+ return (_jsx(Button, { color: "light", size: "small", className: "cursor-pointer", "aria-details": spec.description, onClick: () => createDocument(doc), children: _jsx("span", { className: "text-sm", children: spec.name }) }, spec.id));
13
+ }) })] }));
14
+ };
@@ -0,0 +1,12 @@
1
+ import { type FC } from 'react';
2
+ import { type DriveEditorContext } from "@powerhousedao/reactor-browser";
3
+ interface DocumentDispatchProps {
4
+ documentId: string;
5
+ driveId: string;
6
+ documentModelModule: any;
7
+ context: DriveEditorContext;
8
+ onDispatchReady: (dispatch: (action: any) => void) => void;
9
+ }
10
+ export declare const DocumentDispatch: FC<DocumentDispatchProps>;
11
+ export {};
12
+ //# sourceMappingURL=DocumentDispatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentDispatch.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/DocumentDispatch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAqB,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,KAAK,kBAAkB,EAAa,MAAM,gCAAgC,CAAC;AAEpF,UAAU,qBAAqB;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB,EAAE,GAAG,CAAC;IACzB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,eAAe,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,KAAK,IAAI,CAAC;CAC5D;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA2BtD,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { useEffect, useRef } from 'react';
2
+ export const DocumentDispatch = ({ documentId, driveId, documentModelModule, context, onDispatchReady, }) => {
3
+ const { useDocumentEditorProps } = context;
4
+ const { dispatch } = useDocumentEditorProps({
5
+ documentId,
6
+ documentType: "powerhouse/invoice",
7
+ driveId,
8
+ documentModelModule,
9
+ user: context.user,
10
+ });
11
+ // Keep track of whether we've already notified about this dispatch
12
+ const hasNotified = useRef(false);
13
+ useEffect(() => {
14
+ if (dispatch && !hasNotified.current) {
15
+ onDispatchReady(dispatch);
16
+ hasNotified.current = true;
17
+ }
18
+ }, [dispatch, onDispatchReady]);
19
+ return null;
20
+ };
@@ -0,0 +1,17 @@
1
+ import { DocumentDriveAction, type DocumentDriveDocument, type Node } from "document-drive";
2
+ import type { EditorDispatch } from "document-model";
3
+ import { type DriveEditorContext } from "@powerhousedao/reactor-browser";
4
+ interface DriveExplorerProps {
5
+ driveId: string;
6
+ nodes: Node[];
7
+ onAddFolder: (name: string, parentFolder?: string) => void;
8
+ onDeleteNode: (nodeId: string) => void;
9
+ renameNode: (nodeId: string, name: string) => void;
10
+ onCopyNode: (nodeId: string, targetName: string, parentId?: string) => void;
11
+ context: DriveEditorContext;
12
+ document: DocumentDriveDocument;
13
+ dispatch: EditorDispatch<DocumentDriveAction>;
14
+ }
15
+ export declare function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddFolder, onCopyNode, context, document, dispatch }: DriveExplorerProps): import("react/jsx-runtime").JSX.Element;
16
+ export {};
17
+ //# sourceMappingURL=DriveExplorer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/DriveExplorer.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAqB,mBAAmB,EAAY,KAAK,qBAAqB,EAAiB,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AASxI,OAAO,KAAK,EAAsC,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGzF,OAAO,EACL,KAAK,kBAAkB,EAMxB,MAAM,gCAAgC,CAAC;AAKxC,UAAU,kBAAkB;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5E,OAAO,EAAE,kBAAkB,CAAC;IAC5B,QAAQ,EAAE,qBAAqB,CAAC;IAChC,QAAQ,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAAA;CAC9C;AAED,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,KAAK,EACL,YAAY,EACZ,UAAU,EACV,WAAW,EACX,UAAU,EACV,OAAO,EACP,QAAQ,EACR,QAAQ,EACT,EAAE,kBAAkB,2CA+OpB"}
@@ -0,0 +1,112 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useState, useRef, useEffect } from "react";
3
+ import { twMerge } from "tailwind-merge";
4
+ import { FileItemsGrid } from "./FileItemsGrid.js";
5
+ import { FolderItemsGrid } from "./FolderItemsGrid.js";
6
+ import { useTransformedNodes } from "../hooks/useTransformedNodes.js";
7
+ import { useSelectedFolderChildren } from "../hooks/useSelectedFolderChildren.js";
8
+ import { useDispatchMap } from "../hooks/useDispatchMap.js";
9
+ import { DocumentDispatch } from "./DocumentDispatch.js";
10
+ import { EditorContainer } from "./EditorContainer.js";
11
+ import { CreateDocumentModal } from "@powerhousedao/design-system";
12
+ import { CreateDocument } from "./CreateDocument.js";
13
+ import { useDriveActionsWithUiNodes, useDriveContext, } from "@powerhousedao/reactor-browser";
14
+ import { InvoiceTable } from "./InvoiceTable/InvoiceTable.js";
15
+ import { actions } from "../../../document-models/invoice/index.js";
16
+ import { useDrop } from "../hooks/useDrop.js";
17
+ export function DriveExplorer({ driveId, nodes, onDeleteNode, renameNode, onAddFolder, onCopyNode, context, document, dispatch }) {
18
+ const [selectedNodeId, setSelectedNodeId] = useState();
19
+ const [activeDocumentId, setActiveDocumentId] = useState();
20
+ const [openModal, setOpenModal] = useState(false);
21
+ const [selected, setSelected] = useState({});
22
+ const selectedDocumentModel = useRef(null);
23
+ const { addDocument, documentModels, useDriveDocumentStates, selectedNode } = useDriveContext();
24
+ const [state, fetchDocuments] = useDriveDocumentStates({ driveId });
25
+ const { useDocumentEditorProps } = context;
26
+ // Use our custom hook to manage the dispatch map
27
+ const { dispatchMap, handleDispatchReady } = useDispatchMap(nodes, driveId, documentModels[1], context);
28
+ const handleBatchAction = useCallback((action) => {
29
+ Object.entries(selected).forEach(([id, checked]) => {
30
+ console.log(action);
31
+ if (checked) {
32
+ if (action === 'approve' && dispatchMap[id]) {
33
+ dispatchMap[id](actions.editStatus({
34
+ status: "AWAITINGPAYMENT",
35
+ }));
36
+ }
37
+ else if (action === 'reject' && dispatchMap[id]) {
38
+ dispatchMap[id](actions.editStatus({
39
+ status: "REJECTED",
40
+ }));
41
+ }
42
+ }
43
+ else if (action === 'pay' && dispatchMap[id]) {
44
+ dispatchMap[id](actions.editStatus({
45
+ status: "PAYMENTRECEIVED",
46
+ }));
47
+ }
48
+ });
49
+ }, [selected, dispatchMap]);
50
+ // Transform nodes using the custom hook
51
+ const transformedNodes = useTransformedNodes(nodes, driveId);
52
+ // Separate folders and files
53
+ const folders = transformedNodes.filter((node) => node.kind === "FOLDER");
54
+ const files = transformedNodes.filter((node) => node.kind === "FILE");
55
+ // Get the active document info from nodes
56
+ const activeDocument = activeDocumentId
57
+ ? files.find((file) => file.id === activeDocumentId)
58
+ : undefined;
59
+ const documentModelModule = activeDocument
60
+ ? context.getDocumentModelModule(activeDocument.documentType)
61
+ : null;
62
+ useEffect(() => {
63
+ fetchDocuments(driveId).catch(console.error);
64
+ }, [activeDocumentId]);
65
+ // Dummy functions to satisfy component types
66
+ const dummyDuplicateNode = useCallback((node) => {
67
+ console.log("Duplicate node:", node);
68
+ }, []);
69
+ const dummyAddFile = useCallback(async (file, parentNode) => {
70
+ console.log("Add file:", file, parentNode);
71
+ }, []);
72
+ const dummyMoveNode = useCallback(async (uiNode, targetNode) => {
73
+ console.log("Move node:", uiNode, targetNode);
74
+ }, []);
75
+ const handleNodeSelect = useCallback((node) => {
76
+ console.log("Selected node:", node);
77
+ setSelectedNodeId(node.id);
78
+ }, []);
79
+ const handleFileSelect = useCallback((node) => {
80
+ setActiveDocumentId(node.id);
81
+ }, []);
82
+ const handleEditorClose = useCallback(() => {
83
+ setActiveDocumentId(undefined);
84
+ }, []);
85
+ const onCreateDocument = useCallback(async (fileName) => {
86
+ setOpenModal(false);
87
+ const documentModel = selectedDocumentModel.current;
88
+ if (!documentModel)
89
+ return;
90
+ const node = await addDocument(driveId, fileName, documentModel.documentModel.id);
91
+ selectedDocumentModel.current = null;
92
+ setActiveDocumentId(node.id);
93
+ }, [addDocument, driveId]);
94
+ const { addFile, copyNode, moveNode } = useDriveActionsWithUiNodes(document, dispatch);
95
+ const { isDropTarget, dropProps } = useDrop({
96
+ uiNode: selectedNode?.kind === "FOLDER" ? selectedNode : null,
97
+ onAddFile: addFile,
98
+ onCopyNode: copyNode,
99
+ onMoveNode: moveNode,
100
+ });
101
+ const onSelectDocumentModel = useCallback((documentModel) => {
102
+ selectedDocumentModel.current = documentModel;
103
+ setOpenModal(true);
104
+ }, []);
105
+ const filteredDocumentModels = documentModels;
106
+ // Get children of selected folder using the custom hook
107
+ const selectedFolderChildren = useSelectedFolderChildren(selectedNodeId, folders, files);
108
+ const editorModule = activeDocument
109
+ ? context.getEditor(activeDocument.documentType)
110
+ : null;
111
+ return (_jsxs("div", { className: "flex h-full", children: [nodes.map(node => (_jsx(DocumentDispatch, { documentId: node.id, driveId: driveId, documentModelModule: documentModels[1], context: context, onDispatchReady: (dispatch) => handleDispatchReady(node.id, dispatch) }, node.id))), _jsx("div", { className: "flex-1 p-4 overflow-y-auto", children: activeDocument && documentModelModule && editorModule ? (_jsx(EditorContainer, { context: context, documentId: activeDocumentId, documentType: activeDocument.documentType, driveId: driveId, onClose: handleEditorClose, title: activeDocument.name, documentModelModule: documentModelModule, editorModule: editorModule })) : (_jsxs("div", { ...dropProps, className: twMerge('rounded-md border-2 border-transparent ', isDropTarget && 'border-dashed border-blue-100'), children: [_jsx(FolderItemsGrid, { folders: selectedFolderChildren.folders, onSelectNode: handleNodeSelect, onRenameNode: renameNode, onDuplicateNode: (uiNode) => onCopyNode(uiNode.id, "Copy of " + uiNode.name, uiNode.parentFolder), onDeleteNode: onDeleteNode, onAddFile: dummyAddFile, onCopyNode: async (uiNode, targetNode) => onCopyNode(uiNode.id, "Copy of " + uiNode.name, targetNode.id), onMoveNode: dummyMoveNode, isAllowedToCreateDocuments: true, onAddFolder: onAddFolder, parentFolderId: selectedNodeId }), _jsx(FileItemsGrid, { files: selectedFolderChildren.files, onSelectNode: handleFileSelect, onRenameNode: renameNode, onDuplicateNode: dummyDuplicateNode, onDeleteNode: onDeleteNode, isAllowedToCreateDocuments: true }), _jsx(CreateDocument, { createDocument: onSelectDocumentModel, documentModels: filteredDocumentModels }), _jsx(InvoiceTable, { setActiveDocumentId: setActiveDocumentId, files: files, state: state, getDispatch: () => dispatchMap[activeDocumentId || ""], selected: selected, setSelected: setSelected, onBatchAction: handleBatchAction })] })) }), _jsx(CreateDocumentModal, { onContinue: onCreateDocument, onOpenChange: (open) => setOpenModal(open), open: openModal })] }));
112
+ }
@@ -0,0 +1,14 @@
1
+ import { type DriveEditorContext } from "@powerhousedao/reactor-browser";
2
+ import { type DocumentModelModule, type EditorModule, type PHDocument } from "document-model";
3
+ export interface EditorContainerProps {
4
+ driveId: string;
5
+ documentId: string;
6
+ documentType: string;
7
+ onClose: () => void;
8
+ title: string;
9
+ context: DriveEditorContext;
10
+ documentModelModule: DocumentModelModule<PHDocument>;
11
+ editorModule: EditorModule;
12
+ }
13
+ export declare const EditorContainer: React.FC<EditorContainerProps>;
14
+ //# sourceMappingURL=EditorContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/EditorContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAEjB,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AAQxB,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,kBAAkB,CAAC;IAC5B,mBAAmB,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;IACrD,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAmE1D,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useDriveContext, exportDocument, } from "@powerhousedao/reactor-browser";
3
+ import { DocumentToolbar, RevisionHistory, DefaultEditorLoader, } from "@powerhousedao/design-system";
4
+ import { useState, Suspense, useCallback } from "react";
5
+ export const EditorContainer = (props) => {
6
+ const { title, driveId, context, onClose, documentId, documentType, editorModule, documentModelModule, } = props;
7
+ const [showRevisionHistory, setShowRevisionHistory] = useState(false);
8
+ const { useDocumentEditorProps } = useDriveContext();
9
+ const user = context.user;
10
+ const { dispatch, error, document } = useDocumentEditorProps({
11
+ documentId,
12
+ documentType,
13
+ driveId,
14
+ documentModelModule,
15
+ user,
16
+ });
17
+ const onExport = useCallback(async () => {
18
+ if (document) {
19
+ const ext = documentModelModule.documentModel.extension;
20
+ await exportDocument(document, title, ext);
21
+ }
22
+ }, [document?.revision.global, document?.revision.local]);
23
+ const loadingContent = (_jsx("div", { className: "flex-1 flex justify-center items-center h-full", children: _jsx(DefaultEditorLoader, {}) }));
24
+ if (!document)
25
+ return loadingContent;
26
+ const EditorComponent = editorModule.Component;
27
+ return showRevisionHistory ? (_jsx(RevisionHistory, { documentId: documentId, documentTitle: title, globalOperations: document.operations.global, localOperations: document.operations.local, onClose: () => setShowRevisionHistory(false) }, documentId)) : (_jsxs(Suspense, { fallback: loadingContent, children: [_jsx(DocumentToolbar, { onClose: onClose, onExport: onExport, onShowRevisionHistory: () => setShowRevisionHistory(true), onSwitchboardLinkClick: () => { }, title: title }), _jsx(EditorComponent, { context: context, dispatch: dispatch, document: document, error: error })] }));
28
+ };
@@ -0,0 +1,12 @@
1
+ import { type UiFileNode, type BaseUiFileNode } from "@powerhousedao/design-system";
2
+ interface FileItemsGridProps {
3
+ files: UiFileNode[];
4
+ onSelectNode: (node: BaseUiFileNode) => void;
5
+ onRenameNode: (nodeId: string, name: string) => void;
6
+ onDuplicateNode: (node: BaseUiFileNode) => void;
7
+ onDeleteNode: (nodeId: string) => void;
8
+ isAllowedToCreateDocuments: boolean;
9
+ }
10
+ export declare function FileItemsGrid({ files, onSelectNode, onRenameNode, onDuplicateNode, onDeleteNode, isAllowedToCreateDocuments, }: FileItemsGridProps): import("react/jsx-runtime").JSX.Element | null;
11
+ export {};
12
+ //# sourceMappingURL=FileItemsGrid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileItemsGrid.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/FileItemsGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,cAAc,EACpB,MAAM,8BAA8B,CAAC;AAEtC,UAAU,kBAAkB;IAC1B,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,YAAY,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7C,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,eAAe,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IAChD,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,0BAA0B,EAAE,OAAO,CAAC;CACrC;AAED,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,0BAA0B,GAC3B,EAAE,kBAAkB,kDAqBpB"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { FileItem, } from "@powerhousedao/design-system";
3
+ export function FileItemsGrid({ files, onSelectNode, onRenameNode, onDuplicateNode, onDeleteNode, isAllowedToCreateDocuments, }) {
4
+ if (files.length === 0)
5
+ return null;
6
+ return (_jsxs("div", { children: [_jsx("h3", { className: "text-sm font-medium text-gray-500 mb-2", children: "Files" }), _jsx("div", { className: "flex flex-wrap gap-2", children: files.map((file) => (_jsx(FileItem, { uiNode: file, onSelectNode: onSelectNode, onRenameNode: (name) => onRenameNode(file.id, name), onDuplicateNode: onDuplicateNode, onDeleteNode: () => onDeleteNode(file.id), isAllowedToCreateDocuments: isAllowedToCreateDocuments }, file.id))) })] }));
7
+ }
@@ -0,0 +1,17 @@
1
+ import { type UiFolderNode, type BaseUiFolderNode, type BaseUiNode } from "@powerhousedao/design-system";
2
+ interface FolderItemsGridProps {
3
+ folders: UiFolderNode[];
4
+ onSelectNode: (node: BaseUiFolderNode) => void;
5
+ onRenameNode: (nodeId: string, name: string) => void;
6
+ onDuplicateNode: (node: BaseUiFolderNode) => void;
7
+ onDeleteNode: (nodeId: string) => void;
8
+ onAddFile: (file: File, parentNode: BaseUiNode | null) => Promise<void>;
9
+ onCopyNode: (uiNode: BaseUiNode, targetNode: BaseUiNode) => Promise<void>;
10
+ onMoveNode: (uiNode: BaseUiNode, targetNode: BaseUiNode) => Promise<void>;
11
+ isAllowedToCreateDocuments: boolean;
12
+ onAddFolder: (name: string, parentFolder?: string) => void;
13
+ parentFolderId?: string;
14
+ }
15
+ export declare function FolderItemsGrid({ folders, onSelectNode, onRenameNode, onDuplicateNode, onDeleteNode, onAddFile, onCopyNode, onMoveNode, isAllowedToCreateDocuments, onAddFolder, parentFolderId, }: FolderItemsGridProps): import("react/jsx-runtime").JSX.Element;
16
+ export {};
17
+ //# sourceMappingURL=FolderItemsGrid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FolderItemsGrid.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/FolderItemsGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAChB,MAAM,8BAA8B,CAAC;AAGtC,UAAU,oBAAoB;IAC5B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,YAAY,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC/C,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,eAAe,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAClD,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,UAAU,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E,UAAU,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E,0BAA0B,EAAE,OAAO,CAAC;IACpC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,SAAS,EACT,UAAU,EACV,UAAU,EACV,0BAA0B,EAC1B,WAAW,EACX,cAAc,GACf,EAAE,oBAAoB,2CAwDtB"}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { FolderItem, } from "@powerhousedao/design-system";
3
+ import { useState } from "react";
4
+ export function FolderItemsGrid({ folders, onSelectNode, onRenameNode, onDuplicateNode, onDeleteNode, onAddFile, onCopyNode, onMoveNode, isAllowedToCreateDocuments, onAddFolder, parentFolderId, }) {
5
+ const [newFolderName, setNewFolderName] = useState("");
6
+ const handleSubmit = (e) => {
7
+ e.preventDefault();
8
+ if (newFolderName.trim()) {
9
+ onAddFolder(newFolderName.trim(), parentFolderId);
10
+ setNewFolderName("");
11
+ }
12
+ };
13
+ return (_jsxs("div", { className: "mb-6", children: [_jsx("div", { className: "flex items-center gap-4 mb-2" }), folders.length > 0 && (_jsx("div", { className: "flex flex-wrap gap-2", children: folders.map((folder) => (_jsx(FolderItem, { uiNode: folder, onSelectNode: onSelectNode, onRenameNode: (name) => onRenameNode(folder.id, name), onDuplicateNode: onDuplicateNode, onDeleteNode: () => onDeleteNode(folder.id), onAddFile: onAddFile, onCopyNode: onCopyNode, onMoveNode: onMoveNode, isAllowedToCreateDocuments: isAllowedToCreateDocuments }, folder.id))) }))] }));
14
+ }
@@ -0,0 +1,9 @@
1
+ import type { UiFolderNode } from "@powerhousedao/design-system";
2
+ interface FolderTreeProps {
3
+ folders: UiFolderNode[];
4
+ selectedNodeId?: string;
5
+ onSelectNode: (node: UiFolderNode) => void;
6
+ }
7
+ export declare function FolderTree({ folders, selectedNodeId, onSelectNode, }: FolderTreeProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=FolderTree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FolderTree.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/FolderTree.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,UAAU,eAAe;IACvB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;CAC5C;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,cAAc,EACd,YAAY,GACb,EAAE,eAAe,2CA2EjB"}
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ export function FolderTree({ folders, selectedNodeId, onSelectNode, }) {
4
+ const [expandedFolders, setExpandedFolders] = useState(new Set());
5
+ const toggleFolder = (folderId) => {
6
+ setExpandedFolders((prev) => {
7
+ const next = new Set(prev);
8
+ if (next.has(folderId)) {
9
+ next.delete(folderId);
10
+ }
11
+ else {
12
+ next.add(folderId);
13
+ }
14
+ return next;
15
+ });
16
+ };
17
+ const renderFolder = (folder, level = 0) => {
18
+ const hasChildren = folders.some((f) => f.parentFolder === folder.id);
19
+ const isExpanded = expandedFolders.has(folder.id);
20
+ const isSelected = selectedNodeId === folder.id;
21
+ return (_jsxs("div", { children: [_jsxs("div", { className: `flex items-center py-1 px-2 cursor-pointer hover:bg-gray-100 rounded ${isSelected ? "bg-gray-100" : ""}`, style: { paddingLeft: `${level * 16 + 8}px` }, onClick: () => onSelectNode(folder), children: [hasChildren && (_jsx("button", { className: "w-4 h-4 mr-1 flex items-center justify-center", onClick: (e) => {
22
+ e.stopPropagation();
23
+ toggleFolder(folder.id);
24
+ }, children: isExpanded ? "▼" : "▶" })), _jsx("span", { className: "text-sm", children: folder.name })] }), isExpanded && hasChildren && (_jsx("div", { children: folders
25
+ .filter((f) => f.parentFolder === folder.id)
26
+ .map((child) => renderFolder(child, level + 1)) }))] }, folder.id));
27
+ };
28
+ return (_jsxs("div", { className: "space-y-1", children: [_jsx("div", { className: `flex items-center py-1 px-2 cursor-pointer hover:bg-gray-100 rounded ${!selectedNodeId ? "bg-gray-100" : ""}`, onClick: () => onSelectNode({ id: "", name: "Root", kind: "FOLDER" }), children: _jsx("span", { className: "text-sm font-medium", children: "Root" }) }), folders
29
+ .filter((folder) => !folder.parentFolder)
30
+ .map((folder) => renderFolder(folder))] }));
31
+ }
@@ -0,0 +1,16 @@
1
+ export declare const HeaderControls: ({ contributorOptions, statusOptions, onContributorChange, onStatusChange, onSearchChange, onExport, onBatchAction, }: {
2
+ contributorOptions?: {
3
+ label: string;
4
+ value: string;
5
+ }[];
6
+ statusOptions?: {
7
+ label: string;
8
+ value: string;
9
+ }[];
10
+ onContributorChange?: (value: string | string[]) => void;
11
+ onStatusChange?: (value: string | string[]) => void;
12
+ onSearchChange?: (value: string) => void;
13
+ onExport?: () => void;
14
+ onBatchAction?: (action: string) => void;
15
+ }) => import("react/jsx-runtime").JSX.Element;
16
+ //# sourceMappingURL=HeaderControls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeaderControls.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/HeaderControls.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,GAAI,sHAQ5B;IACD,kBAAkB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxD,aAAa,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnD,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACzD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACpD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C,4CAwDA,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Select } from "@powerhousedao/document-engineering";
3
+ export const HeaderControls = ({ contributorOptions = [], statusOptions = [], onContributorChange, onStatusChange, onSearchChange, onExport, onBatchAction, }) => {
4
+ const batchOptions = [
5
+ { label: "$ Pay Selected", value: "pay" },
6
+ { label: "Approve Selected", value: "approve" },
7
+ { label: "Reject Selected", value: "reject" },
8
+ ];
9
+ return (_jsxs("div", { className: "flex flex-col gap-4 mb-4", children: [_jsxs("div", { className: "flex justify-between items-center", children: [_jsx("h3", { className: "text-lg font-bold", children: "Powerhouse OH Admin Drive" }), _jsxs("div", { className: "flex gap-2 items-center", children: [_jsx("button", { className: "bg-white border border-gray-300 rounded px-3 py-1 text-sm hover:bg-gray-100", onClick: onExport, children: "Export to CSV" }), _jsx(Select, { style: {
10
+ width: "180px",
11
+ height: "30px",
12
+ }, options: batchOptions, onChange: (value) => onBatchAction?.(value), placeholder: "Batch Action", selectionIcon: "checkmark" })] })] }), _jsxs("div", { className: "flex gap-2 items-center", children: [_jsx(Select, { style: {
13
+ width: "200px",
14
+ height: "30px",
15
+ }, options: statusOptions, onChange: onStatusChange, placeholder: "Status", selectionIcon: "checkmark", multiple: true }), _jsx("input", { type: "text", className: "border rounded px-2 py-1 text-sm", placeholder: "Search", onChange: (e) => onSearchChange?.(e.target.value) })] })] }));
16
+ };
@@ -0,0 +1,21 @@
1
+ import { type UiFileNode } from "@powerhousedao/design-system";
2
+ interface InvoiceTableProps {
3
+ files: UiFileNode[];
4
+ state: Record<string, any>;
5
+ setActiveDocumentId: (id: string) => void;
6
+ getDispatch: () => (action: any, onErrorCallback?: any) => void;
7
+ selected: {
8
+ [id: string]: boolean;
9
+ };
10
+ setSelected: (selected: {
11
+ [id: string]: boolean;
12
+ } | ((prev: {
13
+ [id: string]: boolean;
14
+ }) => {
15
+ [id: string]: boolean;
16
+ })) => void;
17
+ onBatchAction: (action: string) => void;
18
+ }
19
+ export declare const InvoiceTable: ({ files, state, setActiveDocumentId, getDispatch, selected, setSelected, onBatchAction, }: InvoiceTableProps) => import("react/jsx-runtime").JSX.Element;
20
+ export {};
21
+ //# sourceMappingURL=InvoiceTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InvoiceTable.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AA0B/D,UAAU,iBAAiB;IACzB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChE,QAAQ,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACpC,WAAW,EAAE,CAAC,QAAQ,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,CAAC,CAAC,IAAI,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,KAAK;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,KAAK,IAAI,CAAC;IAC9H,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,YAAY,GAAI,2FAQ1B,iBAAiB,4CAqMnB,CAAC"}