@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,169 @@
1
+ import { actions, } from "../../document-models/invoice/index.js";
2
+ export class UBLConverter {
3
+ dispatch;
4
+ constructor(config) {
5
+ this.dispatch = config.dispatch;
6
+ }
7
+ convertUBLToInvoice(ublXml) {
8
+ const parser = new DOMParser();
9
+ const xmlDoc = parser.parseFromString(ublXml, "text/xml");
10
+ // Handle parsing errors
11
+ const parserError = xmlDoc.querySelector("parsererror");
12
+ if (parserError) {
13
+ throw new Error(`Invalid XML: ${parserError.textContent}`);
14
+ }
15
+ // Find Invoice element (handling potential namespace)
16
+ const invoice = xmlDoc.querySelector("Invoice, ubl\\:Invoice");
17
+ if (!invoice) {
18
+ throw new Error("Invalid UBL document: No Invoice element found");
19
+ }
20
+ this.processGeneralData(invoice);
21
+ this.processParties(invoice);
22
+ this.processLineItems(invoice);
23
+ }
24
+ getElementText(node, selector, schemeID) {
25
+ const elements = node.querySelectorAll(selector);
26
+ for (const el of elements) {
27
+ if (!schemeID || el.getAttribute("schemeID") === schemeID) {
28
+ return el.textContent?.trim() ?? null;
29
+ }
30
+ }
31
+ return null;
32
+ }
33
+ getElementTextList(parent, selector) {
34
+ const elements = parent.querySelectorAll(selector);
35
+ return Array.from(elements).map((el) => el.textContent || "");
36
+ }
37
+ processGeneralData(invoice) {
38
+ // Process basic invoice data
39
+ this.dispatch(actions.editInvoice({
40
+ invoiceNo: this.getElementText(invoice, "ID, cbc\\:ID"),
41
+ dateIssued: this.getElementText(invoice, "IssueDate, cbc\\:IssueDate"),
42
+ dateDue: this.getElementText(invoice, "PaymentDueDate, cbc\\:PaymentDueDate"),
43
+ dateDelivered: this.getElementText(invoice, "ActualDeliveryDate, cbc\\:ActualDeliveryDate") ||
44
+ this.getElementText(invoice, "TaxPointDate, cbc\\:TaxPointDate") ||
45
+ null,
46
+ currency: this.getElementText(invoice, "CurrencyCode, cbc\\:CurrencyCode") ||
47
+ this.getElementText(invoice, "DocumentCurrencyCode, cbc\\:DocumentCurrencyCode"),
48
+ }));
49
+ }
50
+ processParties(invoice) {
51
+ // Process issuer (AccountingSupplierParty)
52
+ const supplier = invoice.querySelector("AccountingSupplierParty Party, cac\\:AccountingSupplierParty cac\\:Party");
53
+ if (supplier) {
54
+ this.dispatch(actions.editIssuer({
55
+ id: this.getElementText(supplier, "PartyIdentification ID, cac\\:PartyIdentification cbc\\:ID") ||
56
+ this.getElementText(supplier, "CompanyID, cac\\:CompanyID cbc\\:ID"),
57
+ name: this.getElementText(supplier, "PartyName Name, cac\\:PartyName cbc\\:Name"),
58
+ streetAddress: this.getElementText(supplier, "PostalAddress StreetName, cac\\:PostalAddress cbc\\:StreetName"),
59
+ city: this.getElementText(supplier, "PostalAddress CityName, cac\\:PostalAddress cbc\\:CityName"),
60
+ postalCode: this.getElementText(supplier, "PostalAddress PostalZone, cac\\:PostalAddress cbc\\:PostalZone"),
61
+ country: this.getElementText(supplier, "PostalAddress Country IdentificationCode, cac\\:PostalAddress cac\\:Country cbc\\:IdentificationCode"),
62
+ stateProvince: this.getElementText(supplier, "PostalAddress CountrySubentity, cac\\:PostalAddress cbc\\:CountrySubentity"),
63
+ tel: this.getElementText(supplier, "Contact Telephone, cac\\:Contact cbc\\:Telephone"),
64
+ email: this.getElementText(supplier, "Contact ElectronicMail, cac\\:Contact cbc\\:ElectronicMail"),
65
+ }));
66
+ const paymentMeans = invoice.querySelector("PaymentMeans, cac\\:PaymentMeans");
67
+ if (paymentMeans) {
68
+ const financialAccount = paymentMeans.querySelector("PayeeFinancialAccount, cac\\:PayeeFinancialAccount");
69
+ if (financialAccount) {
70
+ const walletAddress = this.getElementText(financialAccount, "cbc\\:ID, ID", "walletAddress");
71
+ if (walletAddress) {
72
+ this.dispatch(actions.editIssuerWallet({
73
+ address: walletAddress,
74
+ chainName: this.getElementText(financialAccount, "cbc\\:ID, ID", "chainName"),
75
+ chainId: this.getElementText(financialAccount, "cbc\\:ID, ID", "chainId"),
76
+ }));
77
+ }
78
+ else {
79
+ this.dispatch(actions.editIssuerBank({
80
+ accountNum: this.getElementText(financialAccount, "cbc\\:ID, ID", "IBAN") ?? this.getElementText(financialAccount, "cbc\\:ID, ID"),
81
+ BIC: this.getElementText(financialAccount, "cbc\\:ID, ID", "BIC"),
82
+ SWIFT: this.getElementText(financialAccount, "cbc\\:ID, ID", "SWIFT"),
83
+ ABA: this.getElementText(financialAccount, "cbc\\:ID, ID", "ABA"),
84
+ name: this.getElementText(financialAccount, "FinancialInstitutionBranch FinancialInstitution Name, " +
85
+ "cac\\:FinancialInstitutionBranch cac\\:FinancialInstitution cbc\\:Name"),
86
+ streetAddress: this.getElementText(financialAccount, "cbc\\:StreetName, StreetName", "streetAddress"),
87
+ extendedAddress: this.getElementText(financialAccount, "cbc\\:AdditionalStreetName, AdditionalStreetName", "extendedAddress"),
88
+ city: this.getElementText(financialAccount, "cbc\\:CityName, CityName", "city"),
89
+ stateProvince: this.getElementText(financialAccount, "cbc\\:CountrySubentity, CountrySubentity", "stateProvince"),
90
+ postalCode: this.getElementText(financialAccount, "cbc\\:PostalZone, PostalZone", "postalCode"),
91
+ country: this.getElementText(financialAccount, "cbc\\:IdentificationCode, IdentificationCode", "country"),
92
+ }));
93
+ }
94
+ }
95
+ }
96
+ }
97
+ // Process payer (AccountingCustomerParty)
98
+ const customer = invoice.querySelector("AccountingCustomerParty Party, cac\\:AccountingCustomerParty cac\\:Party");
99
+ if (customer) {
100
+ this.dispatch(actions.editPayer({
101
+ id: this.getElementText(customer, "PartyIdentification ID, cac\\:PartyIdentification cbc\\:ID") ||
102
+ this.getElementText(customer, "CompanyID, cac\\:CompanyID cbc\\:ID"),
103
+ name: this.getElementText(customer, "PartyName Name, cac\\:PartyName cbc\\:Name"),
104
+ streetAddress: this.getElementText(customer, "PostalAddress StreetName, cac\\:PostalAddress cbc\\:StreetName"),
105
+ city: this.getElementText(customer, "PostalAddress CityName, cac\\:PostalAddress cbc\\:CityName"),
106
+ postalCode: this.getElementText(customer, "PostalAddress PostalZone, cac\\:PostalAddress cbc\\:PostalZone"),
107
+ country: this.getElementText(customer, "PostalAddress Country IdentificationCode, cac\\:PostalAddress cac\\:Country cbc\\:IdentificationCode"),
108
+ stateProvince: this.getElementText(customer, "PostalAddress CountrySubentity, cac\\:PostalAddress cbc\\:CountrySubentity"),
109
+ tel: this.getElementText(customer, "Contact Telephone, cac\\:Contact cbc\\:Telephone"),
110
+ email: this.getElementText(customer, "Contact ElectronicMail, cac\\:Contact cbc\\:ElectronicMail"),
111
+ }));
112
+ // Process payer bank details
113
+ const financialAccount = customer.querySelector("FinancialAccount, cac\\:FinancialAccount");
114
+ if (financialAccount) {
115
+ this.dispatch(actions.editPayerBank({
116
+ name: this.getElementText(financialAccount, "FinancialInstitutionBranch FinancialInstitution Name, cac\\:FinancialInstitutionBranch cac\\:FinancialInstitution cbc\\:Name"),
117
+ accountNum: this.getElementText(financialAccount, "ID, cbc\\:ID"),
118
+ SWIFT: this.getElementText(financialAccount, "FinancialInstitutionBranch FinancialInstitution ID, cac\\:FinancialInstitutionBranch cac\\:FinancialInstitution cbc\\:ID"),
119
+ }));
120
+ }
121
+ }
122
+ }
123
+ processLineItems(invoice) {
124
+ const invoiceLines = invoice.querySelectorAll("InvoiceLine, cac\\:InvoiceLine");
125
+ invoiceLines.forEach((line) => {
126
+ const taxPercent = parseFloat(this.getElementText(line, "cbc\\:Percent, Percent") ?? "0") || 0;
127
+ const quantity = parseFloat(this.getElementText(line, "cbc\\:InvoicedQuantity, InvoicedQuantity") ?? "0") || 0;
128
+ const unitPriceExcl = parseFloat(this.getElementText(line, "cbc\\:PriceAmount, PriceAmount") ?? "0") || 0;
129
+ const unitPriceIncl = unitPriceExcl * (1 + taxPercent / 100);
130
+ this.dispatch(actions.addLineItem({
131
+ id: this.getElementText(line, "cbc\\:ID, ID") ?? "",
132
+ description: this.getElementText(line, "cbc\\:Description, Description") ||
133
+ this.getElementText(line, "cbc\\:Name, Name") ||
134
+ "No description",
135
+ taxPercent,
136
+ quantity,
137
+ currency: line
138
+ .querySelector("cbc\\:PriceAmount, PriceAmount")
139
+ ?.getAttribute("currencyID") ||
140
+ line
141
+ .querySelector("cbc\\:LineExtensionAmount, LineExtensionAmount")
142
+ ?.getAttribute("currencyID") ||
143
+ this.getElementText(invoice, "CurrencyCode, cbc\\:CurrencyCode") ||
144
+ this.getElementText(invoice, "DocumentCurrencyCode, cbc\\:DocumentCurrencyCode") ||
145
+ "USD",
146
+ unitPriceTaxExcl: unitPriceExcl,
147
+ unitPriceTaxIncl: unitPriceIncl,
148
+ totalPriceTaxExcl: quantity * unitPriceExcl,
149
+ totalPriceTaxIncl: quantity * unitPriceIncl,
150
+ }));
151
+ });
152
+ }
153
+ }
154
+ export async function loadUBLFile({ file, dispatch, }) {
155
+ try {
156
+ if (!/text\/xml|application\/xml/.exec(file.type)) {
157
+ throw new Error("Please select a valid XML file");
158
+ }
159
+ const fileContent = await file.text();
160
+ const converter = new UBLConverter({
161
+ dispatch,
162
+ });
163
+ return converter.convertUBLToInvoice(fileContent);
164
+ }
165
+ catch (error) {
166
+ console.error("Error loading UBL file:", error);
167
+ throw error;
168
+ }
169
+ }
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ interface InvoiceToGnosisProps {
3
+ docState: any;
4
+ }
5
+ declare const InvoiceToGnosis: React.FC<InvoiceToGnosisProps>;
6
+ export default InvoiceToGnosis;
7
+ //# sourceMappingURL=invoiceToGnosis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoiceToGnosis.d.ts","sourceRoot":"","sources":["../../../editors/invoice/invoiceToGnosis.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAQxC,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,GAAG,CAAC;CACf;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA8LnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,139 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ let GRAPHQL_URL = "http://localhost:4001/graphql/invoice";
4
+ if (window.document.baseURI !== "http://localhost:3000/") {
5
+ GRAPHQL_URL = "https://switchboard-dev.powerhouse.xyz/graphql/invoice";
6
+ }
7
+ const InvoiceToGnosis = ({ docState }) => {
8
+ const [isLoading, setIsLoading] = useState(false);
9
+ const [error, setError] = useState(null);
10
+ const [responseData, setResponseData] = useState(null);
11
+ const [invoiceStatusResponse, setInvoiceStatusResponse] = useState(null);
12
+ const [safeTxHash, setsafeTxHash] = useState(null);
13
+ const currency = docState.currency;
14
+ const chainName = docState.issuer.paymentRouting.wallet.chainName;
15
+ const TOKEN_ADDRESSES = {
16
+ BASE: {
17
+ USDC: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
18
+ USDS: "0x820C137fa70C8691f0e44Dc420a5e53c168921Dc",
19
+ DAI: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",
20
+ // Add more tokens as needed
21
+ },
22
+ ETHEREUM: {
23
+ USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
24
+ USDS: "0xdC035D45d973E3EC169d2276DDab16f1e407384F",
25
+ DAI: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
26
+ // Add more tokens as needed
27
+ },
28
+ "ARBITRUM ONE": {
29
+ USDC: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
30
+ USDS: "0x6491c05A82219b8D1479057361ff1654749b876b",
31
+ DAI: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
32
+ // Add more tokens as needed
33
+ },
34
+ // Add more networks as needed
35
+ };
36
+ // Separate payerWallet configuration
37
+ const payerWallet = {
38
+ BASE: {
39
+ rpc: "https://base.llamarpc.com",
40
+ chainName: "Base",
41
+ chainId: "8453",
42
+ address: "0x1FB6bEF04230d67aF0e3455B997a28AFcCe1F45e", // Safe address
43
+ },
44
+ ETHEREUM: {
45
+ rpc: "https://eth.llamarpc.com",
46
+ chainName: "Ethereum",
47
+ chainId: "1",
48
+ address: "0x1FB6bEF04230d67aF0e3455B997a28AFcCe1F45e", // Safe address
49
+ },
50
+ "ARBITRUM ONE": {
51
+ rpc: "https://arb1.arbitrum.io/rpc",
52
+ chainName: "Arbitrum One",
53
+ chainId: "42161",
54
+ address: "0x1FB6bEF04230d67aF0e3455B997a28AFcCe1F45e", // Safe address
55
+ },
56
+ };
57
+ // Extract payment details from current-state.json
58
+ const paymentDetails = {
59
+ payeeWallet: {
60
+ address: docState.issuer.paymentRouting.wallet.address,
61
+ chainName: docState.issuer.paymentRouting.wallet.chainName,
62
+ chainId: docState.issuer.paymentRouting.wallet.chainId,
63
+ },
64
+ token: {
65
+ evmAddress: getTokenAddress(chainName, currency),
66
+ symbol: docState.currency,
67
+ chainName: docState.issuer.paymentRouting.wallet.chainName,
68
+ chainId: docState.issuer.paymentRouting.wallet.chainId,
69
+ },
70
+ amount: docState.totalPriceTaxIncl || 0.000015, // Make the amount small for testing
71
+ };
72
+ function getTokenAddress(chainName, symbol) {
73
+ const networkTokens = TOKEN_ADDRESSES[chainName.toUpperCase()];
74
+ if (!networkTokens) {
75
+ console.error(`Network ${chainName} not supported`);
76
+ }
77
+ const tokenAddress = networkTokens[symbol];
78
+ if (!tokenAddress) {
79
+ console.error(`Token ${symbol} not supported on ${chainName}`);
80
+ }
81
+ return tokenAddress;
82
+ }
83
+ const handleInvoiceToGnosis = async () => {
84
+ setIsLoading(true);
85
+ setError(null);
86
+ try {
87
+ const response = await fetch(GRAPHQL_URL, {
88
+ method: "POST",
89
+ headers: {
90
+ "Content-Type": "application/json",
91
+ },
92
+ body: JSON.stringify({
93
+ query: `
94
+ mutation Invoice_processGnosisPayment($payerWallet: JSON!, $paymentDetails: JSON!, $invoiceNo: String!) {
95
+ Invoice_processGnosisPayment(payerWallet: $payerWallet, paymentDetails: $paymentDetails, invoiceNo: $invoiceNo) {
96
+ success
97
+ data
98
+ error
99
+ }
100
+ }
101
+ `,
102
+ variables: {
103
+ payerWallet: payerWallet[chainName.toUpperCase()],
104
+ paymentDetails: paymentDetails,
105
+ invoiceNo: docState.invoiceNo,
106
+ },
107
+ }),
108
+ });
109
+ const result = await response.json();
110
+ const data = result.data.Invoice_processGnosisPayment;
111
+ if (data.success) {
112
+ const dataObj = typeof data.data === "string" ? JSON.parse(data.data) : data.data;
113
+ setsafeTxHash(dataObj.txHash);
114
+ if (dataObj.paymentDetails) {
115
+ // Format the payment details for better readability
116
+ const formattedDetails = {
117
+ amount: dataObj.paymentDetails[0].amount,
118
+ token: dataObj.paymentDetails[0].token.symbol,
119
+ chain: chainName,
120
+ };
121
+ setInvoiceStatusResponse(`Amount: ${formattedDetails.amount} ${formattedDetails.token} on ${formattedDetails.chain}`);
122
+ }
123
+ }
124
+ else {
125
+ setError(data.error);
126
+ }
127
+ setIsLoading(false);
128
+ }
129
+ catch (error) {
130
+ console.error("Error during transfer:", error);
131
+ setIsLoading(false);
132
+ }
133
+ };
134
+ if (!currency || !chainName || currency === "" || chainName === "") {
135
+ return null;
136
+ }
137
+ return (_jsxs("div", { className: "space-y-4", children: [currency && chainName && currency !== "" && chainName !== "" && (_jsx("button", { className: "bg-blue-500 text-black px-4 py-2 rounded-md hover:bg-blue-600", onClick: handleInvoiceToGnosis, disabled: isLoading, children: isLoading ? "Processing..." : "Send Payment to Gnosis >" })), error && (_jsx("div", { className: "text-red-500 bg-red-50 p-3 rounded-md", children: error })), safeTxHash && (_jsxs("div", { className: "bg-gray-50 p-4 rounded-md space-y-2", children: [_jsxs("p", { className: "font-medium", children: ["Safe Transaction Hash:", _jsx("span", { className: "font-mono text-sm ml-2 break-all", children: safeTxHash })] }), _jsx("a", { href: `https://app.safe.global/transactions/queue?safe=base:0x1FB6bEF04230d67aF0e3455B997a28AFcCe1F45e`, target: "_blank", rel: "noopener noreferrer", className: "text-blue-500 hover:text-blue-600 underline block", children: "View Transaction" })] })), invoiceStatusResponse && (_jsxs("div", { className: "bg-gray-50 p-4 rounded-md", children: [_jsx("p", { className: "font-medium", children: "Payment Details:" }), _jsx("p", { className: "text-gray-700", children: invoiceStatusResponse })] }))] }));
138
+ };
139
+ export default InvoiceToGnosis;
@@ -0,0 +1,14 @@
1
+ import { ComponentPropsWithRef } from "react";
2
+ import { EditLegalEntityBankInput } from "./legalEntity.js";
3
+ import { ValidationResult } from "../validation/validationManager.js";
4
+ export type LegalEntityBankSectionProps = Omit<ComponentPropsWithRef<"div">, "children"> & {
5
+ readonly value: EditLegalEntityBankInput;
6
+ readonly onChange: (value: EditLegalEntityBankInput) => void;
7
+ readonly disabled?: boolean;
8
+ readonly countryvalidation?: ValidationResult | null;
9
+ readonly ibanvalidation?: ValidationResult | null;
10
+ readonly bicvalidation?: ValidationResult | null;
11
+ readonly banknamevalidation?: ValidationResult | null;
12
+ };
13
+ export declare const LegalEntityBankSection: import("react").ForwardRefExoticComponent<Omit<LegalEntityBankSectionProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
14
+ //# sourceMappingURL=bankSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bankSection.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/legalEntity/bankSection.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAMtB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAG5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAiCtE,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAC5C,qBAAqB,CAAC,KAAK,CAAC,EAC5B,UAAU,CACX,GAAG;IACF,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAC;IACzC,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC7D,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACrD,QAAQ,CAAC,cAAc,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,aAAa,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACjD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACvD,CAAC;AAgBF,eAAO,MAAM,sBAAsB,qIAkalC,CAAC"}
@@ -0,0 +1,156 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useCallback, useState, useEffect, } from "react";
3
+ import { twMerge } from "tailwind-merge";
4
+ import { CountryForm } from "../components/countryForm.js";
5
+ import { InputField } from "../components/inputField.js";
6
+ const FieldLabel = ({ children }) => (_jsx("label", { className: "block text-sm font-medium text-gray-700", children: children }));
7
+ const ACCOUNT_TYPES = ["CHECKING", "SAVINGS", "TRUST"];
8
+ const AccountTypeSelect = forwardRef(function AccountTypeSelect(props, ref) {
9
+ return (_jsxs("select", { ...props, className: twMerge("h-10 w-full rounded-md border border-gray-200 bg-white px-3 transition-colors focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 disabled:bg-gray-50 disabled:p-0", props.className), ref: ref, children: [_jsx("option", { value: "", children: "Select Account Type" }), ACCOUNT_TYPES.map((type) => (_jsx("option", { value: type, children: type }, type)))] }));
10
+ });
11
+ function flattenBankInput(value) {
12
+ return {
13
+ ...value,
14
+ ...(value.address && {
15
+ streetAddress: value.address.streetAddress ?? "",
16
+ extendedAddress: value.address.extendedAddress ?? "",
17
+ city: value.address.city ?? "",
18
+ postalCode: value.address.postalCode ?? "",
19
+ country: value.address.country ?? "",
20
+ stateProvince: value.address.stateProvince ?? "",
21
+ }),
22
+ };
23
+ }
24
+ export const LegalEntityBankSection = forwardRef(function LegalEntityBankSection(props, ref) {
25
+ const { value, onChange, disabled, countryvalidation, ibanvalidation, bicvalidation, banknamevalidation, ...divProps } = props;
26
+ const [showIntermediary, setShowIntermediary] = useState(false);
27
+ const [localState, setLocalState] = useState(flattenBankInput(value));
28
+ useEffect(() => {
29
+ setLocalState(flattenBankInput(value));
30
+ }, [value]);
31
+ const handleInputChange = useCallback(function handleInputChange(field, event) {
32
+ setLocalState((prevState) => ({
33
+ ...prevState,
34
+ [field]: event.target.value,
35
+ }));
36
+ }, []);
37
+ const handleBlur = useCallback(function handleBlur(field, event) {
38
+ onChange({
39
+ [field]: event.target.value,
40
+ });
41
+ }, [onChange]);
42
+ const handleIntermediaryToggle = useCallback(function handleIntermediaryToggle(event) {
43
+ setShowIntermediary(event.target.checked);
44
+ }, []);
45
+ function createInputHandler(field) {
46
+ return function handleFieldChange(event) {
47
+ handleInputChange(field, event);
48
+ };
49
+ }
50
+ function createBlurHandler(field) {
51
+ return function handleFieldBlur(event) {
52
+ handleBlur(field, event);
53
+ };
54
+ }
55
+ return (_jsxs("div", { ...divProps, className: twMerge("rounded-lg border border-gray-200 bg-white p-6", props.className), ref: ref, children: [_jsx("h3", { className: "mb-4 text-lg font-semibold text-gray-900", children: "Banking Information" }), _jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "space-y-4", children: [_jsx("div", { className: "space-y-2", children: _jsx(InputField
56
+ // input={localState.accountNum ?? ""}
57
+ , {
58
+ // input={localState.accountNum ?? ""}
59
+ value: localState.accountNum ?? "", label: "Account Number", placeholder: "Account Number", onBlur: createBlurHandler("accountNum"), handleInputChange: createInputHandler("accountNum"), className: "h-10 w-full text-md mb-2", validation: ibanvalidation }) }), _jsx("div", { className: "space-y-2", children: _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(FieldLabel, { children: "Account Details" }), _jsx(AccountTypeSelect, { disabled: disabled, onChange: createInputHandler("accountType"), onBlur: createBlurHandler("accountType"), value: localState.accountType ?? "" })] }), _jsx("div", { className: "space-y-2", children: _jsx(InputField
60
+ // input={
61
+ // (localState.ABA || localState.BIC || localState.SWIFT) ??
62
+ // ""
63
+ // }
64
+ , {
65
+ // input={
66
+ // (localState.ABA || localState.BIC || localState.SWIFT) ??
67
+ // ""
68
+ // }
69
+ value: (localState.ABA || localState.BIC || localState.SWIFT) ??
70
+ "", label: "ABA/BIC/SWIFT No.", placeholder: "ABA/BIC/SWIFT No.", onBlur: createBlurHandler("BIC"), handleInputChange: createInputHandler("BIC"), className: "h-10 w-full text-md mb-2", validation: bicvalidation }) })] }) })] }), _jsx("div", { className: "space-y-4", children: _jsx(InputField
71
+ // input={localState.beneficiary ?? ""}
72
+ , {
73
+ // input={localState.beneficiary ?? ""}
74
+ value: localState.beneficiary ?? "", label: "Beneficiary Information", placeholder: "Beneficiary Name", onBlur: createBlurHandler("beneficiary"), handleInputChange: createInputHandler("beneficiary"), className: "h-10 w-full text-md mb-2" }) }), _jsx("div", { className: "space-y-4", children: _jsx(InputField
75
+ // input={localState.name ?? ""}
76
+ , {
77
+ // input={localState.name ?? ""}
78
+ value: localState.name ?? "", label: "Bank Details", placeholder: "Bank Name", onBlur: createBlurHandler("name"), handleInputChange: createInputHandler("name"), className: "h-10 w-full text-md mb-2", validation: banknamevalidation }) }), _jsx("div", { className: "space-y-4", children: _jsxs("div", { className: "space-y-4 rounded-lg", children: [_jsx(InputField
79
+ // input={localState.streetAddress ?? ""}
80
+ , {
81
+ // input={localState.streetAddress ?? ""}
82
+ value: localState.streetAddress ?? "", label: "Bank Address", placeholder: "Street Address", onBlur: createBlurHandler("streetAddress"), handleInputChange: createInputHandler("streetAddress"), className: "h-10 w-full text-md mb-2" }), _jsx(InputField
83
+ // input={localState.extendedAddress ?? ""}
84
+ , {
85
+ // input={localState.extendedAddress ?? ""}
86
+ value: localState.extendedAddress ?? "", placeholder: "Extended Address", onBlur: createBlurHandler("extendedAddress"), handleInputChange: createInputHandler("extendedAddress"), className: "h-10 w-full text-md mb-2" }), _jsxs("div", { className: "grid grid-cols-2 gap-2", children: [_jsx(InputField
87
+ // input={localState.city ?? ""}
88
+ , {
89
+ // input={localState.city ?? ""}
90
+ value: localState.city ?? "", label: "City", placeholder: "City", onBlur: createBlurHandler("city"), handleInputChange: createInputHandler("city"), className: "h-10 w-full text-md mb-2" }), _jsx(InputField
91
+ // input={localState.stateProvince ?? ""}
92
+ , {
93
+ // input={localState.stateProvince ?? ""}
94
+ value: localState.stateProvince ?? "", label: "State/Province", placeholder: "State/Province", onBlur: createBlurHandler("stateProvince"), handleInputChange: createInputHandler("stateProvince"), className: "h-10 w-full text-md mb-2" })] }), _jsxs("div", { className: "grid grid-cols-2 gap-2", children: [_jsx(InputField
95
+ // input={localState.postalCode ?? ""}
96
+ , {
97
+ // input={localState.postalCode ?? ""}
98
+ value: localState.postalCode ?? "", label: "Postal Code", placeholder: "Postal Code", onBlur: createBlurHandler("postalCode"), handleInputChange: createInputHandler("postalCode"), className: "h-10 w-full text-md mb-2" }), _jsx(CountryForm, { label: "Country", country: localState.country ?? "", handleInputChange: createInputHandler("country"), handleBlur: createBlurHandler("country"), className: "h-10 w-full text-md mb-2", validation: countryvalidation })] })] }) }), _jsx("div", { className: "space-y-2", children: _jsx(InputField
99
+ // input={localState.memo ?? ""}
100
+ , {
101
+ // input={localState.memo ?? ""}
102
+ value: localState.memo ?? "", label: "Memo", placeholder: "Memo", onBlur: createBlurHandler("memo"), handleInputChange: createInputHandler("memo"), className: "h-10 w-full text-md mb-2" }) }), _jsx("div", { className: "pt-4", children: _jsxs("label", { className: "flex items-center space-x-2", children: [_jsx("input", { checked: showIntermediary, className: "size-4 rounded border-gray-300 text-blue-600 focus:ring-2 focus:ring-blue-500", id: "showIntermediary", onChange: handleIntermediaryToggle, type: "checkbox" }), _jsx("span", { className: "text-sm font-medium text-gray-700", children: "Include Intermediary Bank" })] }) }), showIntermediary ? (_jsxs("div", { className: "bg-blue-50 mt-4 space-y-6 rounded-lg border border-blue-100 p-6", children: [_jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "Intermediary Bank Details" }), _jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "space-y-4", children: [_jsx("div", { className: "space-y-2", children: _jsx(InputField
103
+ // input={localState.accountNumIntermediary ?? ""}
104
+ , {
105
+ // input={localState.accountNumIntermediary ?? ""}
106
+ value: localState.accountNumIntermediary ?? "", label: "Account Number", placeholder: "Intermediary Account Number", onBlur: createBlurHandler("accountNumIntermediary"), handleInputChange: createInputHandler("accountNumIntermediary"), className: "h-10 w-full text-md mb-2" }) }), _jsx("div", { className: "space-y-2", children: _jsxs("div", { className: "grid grid-cols-2 gap-2", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(FieldLabel, { children: "Account Details" }), _jsx(AccountTypeSelect, { disabled: disabled, onChange: createInputHandler("accountTypeIntermediary"), onBlur: createBlurHandler("accountTypeIntermediary"), value: localState.accountTypeIntermediary ?? "" })] }), _jsx("div", { className: "space-y-2", children: _jsx(InputField
107
+ // input={
108
+ // (localState.ABAIntermediary ||
109
+ // localState.BICIntermediary ||
110
+ // localState.SWIFTIntermediary) ??
111
+ // ""
112
+ // }
113
+ , {
114
+ // input={
115
+ // (localState.ABAIntermediary ||
116
+ // localState.BICIntermediary ||
117
+ // localState.SWIFTIntermediary) ??
118
+ // ""
119
+ // }
120
+ value: (localState.ABAIntermediary ||
121
+ localState.BICIntermediary ||
122
+ localState.SWIFTIntermediary) ??
123
+ "", label: "ABA/BIC/SWIFT No.", placeholder: "ABA/BIC/SWIFT No.", onBlur: createBlurHandler("BICIntermediary"), handleInputChange: createInputHandler("BICIntermediary"), className: "h-10 w-full text-md mb-2" }) })] }) })] }), _jsx("div", { className: "space-y-4", children: _jsx(InputField
124
+ // input={localState.beneficiaryIntermediary ?? ""}
125
+ , {
126
+ // input={localState.beneficiaryIntermediary ?? ""}
127
+ value: localState.beneficiaryIntermediary ?? "", label: "Beneficiary Information", placeholder: "Intermediary Beneficiary Name", onBlur: createBlurHandler("beneficiaryIntermediary"), handleInputChange: createInputHandler("beneficiaryIntermediary"), className: "h-10 w-full text-md mb-2" }) }), _jsx("div", { className: "space-y-4", children: _jsx(InputField
128
+ // input={localState.nameIntermediary ?? ""}
129
+ , {
130
+ // input={localState.nameIntermediary ?? ""}
131
+ value: localState.nameIntermediary ?? "", label: "Bank Details", placeholder: "Intermediary Bank Name", onBlur: createBlurHandler("nameIntermediary"), handleInputChange: createInputHandler("nameIntermediary"), className: "h-10 w-full text-md mb-2" }) }), _jsx("div", { className: "space-y-4", children: _jsxs("div", { className: "space-y-4 rounded-lg", children: [_jsx(InputField
132
+ // input={localState.streetAddressIntermediary ?? ""}
133
+ , {
134
+ // input={localState.streetAddressIntermediary ?? ""}
135
+ value: localState.streetAddressIntermediary ?? "", label: "Bank Address", placeholder: "Street Address", onBlur: createBlurHandler("streetAddressIntermediary"), handleInputChange: createInputHandler("streetAddressIntermediary"), className: "h-10 w-full text-md mb-2" }), _jsx(InputField
136
+ // input={localState.extendedAddressIntermediary ?? ""}
137
+ , {
138
+ // input={localState.extendedAddressIntermediary ?? ""}
139
+ value: localState.extendedAddressIntermediary ?? "", placeholder: "Extended Address", onBlur: createBlurHandler("extendedAddressIntermediary"), handleInputChange: createInputHandler("extendedAddressIntermediary"), className: "h-10 w-full text-md mb-2" }), _jsxs("div", { className: "grid grid-cols-2 gap-2", children: [_jsx(InputField
140
+ // input={localState.cityIntermediary ?? ""}
141
+ , {
142
+ // input={localState.cityIntermediary ?? ""}
143
+ value: localState.cityIntermediary ?? "", label: "City", placeholder: "City", onBlur: createBlurHandler("cityIntermediary"), handleInputChange: createInputHandler("cityIntermediary"), className: "h-10 w-full text-md mb-2" }), _jsx(InputField
144
+ // input={localState.stateProvinceIntermediary ?? ""}
145
+ , {
146
+ // input={localState.stateProvinceIntermediary ?? ""}
147
+ value: localState.stateProvinceIntermediary ?? "", label: "State/Province", placeholder: "State/Province", onBlur: createBlurHandler("stateProvinceIntermediary"), handleInputChange: createInputHandler("stateProvinceIntermediary"), className: "h-10 w-full text-md mb-2" })] }), _jsxs("div", { className: "grid grid-cols-2 gap-2", children: [_jsx(InputField
148
+ // input={localState.postalCodeIntermediary ?? ""}
149
+ , {
150
+ // input={localState.postalCodeIntermediary ?? ""}
151
+ value: localState.postalCodeIntermediary ?? "", label: "Postal Code", placeholder: "Postal Code", onBlur: createBlurHandler("postalCodeIntermediary"), handleInputChange: createInputHandler("postalCodeIntermediary"), className: "h-10 w-full text-md mb-2" }), _jsx(CountryForm, { label: "Country", country: localState.countryIntermediary ?? "", handleInputChange: createInputHandler("countryIntermediary"), handleBlur: createBlurHandler("countryIntermediary"), className: "h-10 w-full text-md mb-2" })] })] }) }), _jsx("div", { className: "space-y-2", children: _jsx(InputField
152
+ // input={localState.memoIntermediary ?? ""}
153
+ , {
154
+ // input={localState.memoIntermediary ?? ""}
155
+ value: localState.memoIntermediary ?? "", label: "Memo", placeholder: "Memo", onBlur: createBlurHandler("memoIntermediary"), handleInputChange: createInputHandler("memoIntermediary"), className: "h-10 w-full text-md mb-2" }) })] })] })) : null] })] }));
156
+ });
@@ -0,0 +1,6 @@
1
+ import { ComponentProps } from "react";
2
+ export declare const FieldLabel: ({ children, }: {
3
+ readonly children: React.ReactNode;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const TextInput: (props: ComponentProps<"input">) => import("react/jsx-runtime").JSX.Element;
6
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/legalEntity/common.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAGvC,eAAO,MAAM,UAAU,GAAI,eAExB;IACD,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CACpC,4CAEA,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,OAAO,cAAc,CAAC,OAAO,CAAC,4CAWvD,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { twMerge } from "tailwind-merge";
3
+ export const FieldLabel = ({ children, }) => (_jsx("label", { className: "block text-sm font-medium text-gray-700", children: children }));
4
+ export const TextInput = (props) => {
5
+ return (_jsx("input", { ...props, className: twMerge("h-10 w-full rounded-md border border-gray-200 bg-white px-3 transition-colors focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 disabled:bg-gray-50 disabled:p-0", props.className), type: "text" }));
6
+ };
@@ -0,0 +1,40 @@
1
+ import { EditIssuerBankInput, EditIssuerInput, EditIssuerWalletInput, EditPayerBankInput, EditPayerInput, EditPayerWalletInput, LegalEntity } from "../../../document-models/invoice/index.js";
2
+ import { ComponentPropsWithRef } from "react";
3
+ import { ValidationResult } from "../validation/validationManager.js";
4
+ export type EditLegalEntityWalletInput = EditIssuerWalletInput | EditPayerWalletInput;
5
+ export type EditLegalEntityBankInput = EditIssuerBankInput | EditPayerBankInput;
6
+ export type EditLegalEntityInput = EditIssuerInput | EditPayerInput;
7
+ export type LegalEntityMainSectionProps = Omit<ComponentPropsWithRef<"div">, "children"> & {
8
+ readonly value: EditLegalEntityInput;
9
+ readonly onChange: (value: EditLegalEntityInput) => void;
10
+ readonly disabled?: boolean;
11
+ readonly countryvalidation?: ValidationResult | null;
12
+ readonly streetaddressvalidation?: ValidationResult | null;
13
+ readonly cityvalidation?: ValidationResult | null;
14
+ readonly postalcodevalidation?: ValidationResult | null;
15
+ readonly payeremailvalidation?: ValidationResult | null;
16
+ };
17
+ export declare const LegalEntityMainSection: (props: LegalEntityMainSectionProps) => import("react/jsx-runtime").JSX.Element;
18
+ type LegalEntityFormProps = {
19
+ readonly legalEntity: LegalEntity;
20
+ readonly onChangeInfo?: (info: EditLegalEntityInput) => void;
21
+ readonly onChangeBank?: (bank: EditLegalEntityBankInput) => void;
22
+ readonly onChangeWallet?: (wallet: EditLegalEntityWalletInput) => void;
23
+ readonly basicInfoDisabled?: boolean;
24
+ readonly bankDisabled?: boolean;
25
+ readonly walletDisabled?: boolean;
26
+ readonly currency: string;
27
+ readonly status: string;
28
+ readonly walletvalidation?: ValidationResult | null;
29
+ readonly countryvalidation?: ValidationResult | null;
30
+ readonly ibanvalidation?: ValidationResult | null;
31
+ readonly bicvalidation?: ValidationResult | null;
32
+ readonly banknamevalidation?: ValidationResult | null;
33
+ readonly streetaddressvalidation?: ValidationResult | null;
34
+ readonly cityvalidation?: ValidationResult | null;
35
+ readonly postalcodevalidation?: ValidationResult | null;
36
+ readonly payeremailvalidation?: ValidationResult | null;
37
+ };
38
+ export declare function LegalEntityForm({ legalEntity, onChangeInfo, onChangeBank, onChangeWallet, basicInfoDisabled, bankDisabled, walletDisabled, currency, status, walletvalidation, countryvalidation, ibanvalidation, bicvalidation, banknamevalidation, streetaddressvalidation, cityvalidation, postalcodevalidation, payeremailvalidation }: LegalEntityFormProps): import("react/jsx-runtime").JSX.Element;
39
+ export {};
40
+ //# sourceMappingURL=legalEntity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legalEntity.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/legalEntity/legalEntity.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EAEpB,WAAW,EAGZ,MAAM,2CAA2C,CAAC;AAOnD,OAAO,EAAE,qBAAqB,EAAO,MAAM,OAAO,CAAC;AAKnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAGtE,MAAM,MAAM,0BAA0B,GAClC,qBAAqB,GACrB,oBAAoB,CAAC;AAEzB,MAAM,MAAM,wBAAwB,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAChF,MAAM,MAAM,oBAAoB,GAAG,eAAe,GAAG,cAAc,CAAC;AAMpE,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAC5C,qBAAqB,CAAC,KAAK,CAAC,EAC5B,UAAU,CACX,GAAG;IACF,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACzD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACrD,QAAQ,CAAC,uBAAuB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC3D,QAAQ,CAAC,cAAc,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACxD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACzD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,OAAO,2BAA2B,4CAgKxE,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC7D,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,wBAAwB,KAAK,IAAI,CAAC;IACjE,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,0BAA0B,KAAK,IAAI,CAAC;IACvE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACrC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACpD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACrD,QAAQ,CAAC,cAAc,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,aAAa,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACjD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACtD,QAAQ,CAAC,uBAAuB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC3D,QAAQ,CAAC,cAAc,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACxD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACzD,CAAC;AA+BF,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACrB,EAAE,oBAAoB,2CAyCtB"}