@powerhousedao/contributor-billing 0.0.99 → 0.1.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 (98) hide show
  1. package/dist/document-models/billing-statement/src/reducers/general.d.ts.map +1 -1
  2. package/dist/document-models/billing-statement/src/reducers/general.js +8 -26
  3. package/dist/document-models/billing-statement/src/reducers/line-items.d.ts.map +1 -1
  4. package/dist/document-models/billing-statement/src/reducers/line-items.js +19 -29
  5. package/dist/document-models/billing-statement/src/reducers/tags.d.ts.map +1 -1
  6. package/dist/document-models/billing-statement/src/reducers/tags.js +20 -25
  7. package/dist/document-models/integrations/src/reducers/integrations.d.ts.map +1 -1
  8. package/dist/document-models/integrations/src/reducers/integrations.js +29 -44
  9. package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -1
  10. package/dist/document-models/invoice/src/reducers/general.js +31 -56
  11. package/dist/document-models/invoice/src/reducers/items.d.ts.map +1 -1
  12. package/dist/document-models/invoice/src/reducers/items.js +63 -88
  13. package/dist/document-models/invoice/src/reducers/parties.d.ts.map +1 -1
  14. package/dist/document-models/invoice/src/reducers/parties.js +199 -229
  15. package/dist/editors/billing-statement/components/lineItemsTable.d.ts +3 -2
  16. package/dist/editors/billing-statement/components/lineItemsTable.d.ts.map +1 -1
  17. package/dist/editors/billing-statement/components/lineItemsTable.js +12 -8
  18. package/dist/editors/billing-statement/components/objectSetTable.d.ts +3 -2
  19. package/dist/editors/billing-statement/components/objectSetTable.d.ts.map +1 -1
  20. package/dist/editors/billing-statement/editor.d.ts +3 -1
  21. package/dist/editors/billing-statement/editor.d.ts.map +1 -1
  22. package/dist/editors/billing-statement/editor.js +2 -2
  23. package/dist/editors/billing-statement/lineItemTags/lineItemTags.d.ts +2 -2
  24. package/dist/editors/billing-statement/lineItemTags/lineItemTags.d.ts.map +1 -1
  25. package/dist/editors/contributor-billing/components/DriveExplorer.d.ts +8 -1
  26. package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
  27. package/dist/editors/contributor-billing/components/DriveExplorer.js +18 -64
  28. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +2 -8
  29. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -1
  30. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.js +21 -7
  31. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +8 -10
  32. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
  33. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +27 -24
  34. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts +6 -8
  35. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -1
  36. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.js +8 -17
  37. package/dist/editors/contributor-billing/editor.d.ts +1 -10
  38. package/dist/editors/contributor-billing/editor.d.ts.map +1 -1
  39. package/dist/editors/contributor-billing/editor.js +2 -23
  40. package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts +2 -1
  41. package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts.map +1 -1
  42. package/dist/editors/contributor-billing/index.js +1 -1
  43. package/dist/editors/hooks/useBillingStatementDocument.d.ts +4 -0
  44. package/dist/editors/hooks/useBillingStatementDocument.d.ts.map +1 -0
  45. package/dist/editors/hooks/useBillingStatementDocument.js +8 -0
  46. package/dist/editors/hooks/useIntegrationsDocument.d.ts +4 -0
  47. package/dist/editors/hooks/useIntegrationsDocument.d.ts.map +1 -0
  48. package/dist/editors/hooks/useIntegrationsDocument.js +8 -0
  49. package/dist/editors/hooks/useInvoiceDocument.d.ts +4 -0
  50. package/dist/editors/hooks/useInvoiceDocument.d.ts.map +1 -0
  51. package/dist/editors/hooks/useInvoiceDocument.js +8 -0
  52. package/dist/editors/integrations/editor.d.ts +4 -1
  53. package/dist/editors/integrations/editor.d.ts.map +1 -1
  54. package/dist/editors/integrations/editor.js +7 -12
  55. package/dist/editors/invoice/editor.d.ts +4 -1
  56. package/dist/editors/invoice/editor.d.ts.map +1 -1
  57. package/dist/editors/invoice/editor.js +5 -4
  58. package/dist/editors/invoice/ingestPDF.d.ts.map +1 -1
  59. package/dist/editors/invoice/ingestPDF.js +3 -3
  60. package/dist/editors/invoice/invoiceToGnosis.d.ts +3 -2
  61. package/dist/editors/invoice/invoiceToGnosis.d.ts.map +1 -1
  62. package/dist/editors/invoice/invoiceToGnosis.js +11 -11
  63. package/dist/editors/invoice/legalEntity/bankSection.d.ts +1 -0
  64. package/dist/editors/invoice/legalEntity/bankSection.d.ts.map +1 -1
  65. package/dist/editors/invoice/legalEntity/bankSection.js +36 -12
  66. package/dist/editors/invoice/legalEntity/legalEntity.d.ts +2 -1
  67. package/dist/editors/invoice/legalEntity/legalEntity.d.ts.map +1 -1
  68. package/dist/editors/invoice/legalEntity/legalEntity.js +2 -2
  69. package/dist/editors/invoice/lineItemTags/lineItemTags.d.ts.map +1 -1
  70. package/dist/editors/invoice/lineItems.d.ts.map +1 -1
  71. package/dist/editors/invoice/lineItems.js +8 -6
  72. package/dist/editors/invoice/requestFinance.js +2 -2
  73. package/dist/editors/invoice/uploadPdfChunked.js +1 -1
  74. package/dist/editors/invoice/validation/validationHandler.d.ts +1 -1
  75. package/dist/editors/invoice/validation/validationHandler.d.ts.map +1 -1
  76. package/dist/editors/invoice/validation/validationHandler.js +25 -9
  77. package/dist/editors/invoice/validation/validationManager.d.ts.map +1 -1
  78. package/dist/editors/invoice/validation/validationManager.js +3 -2
  79. package/dist/editors/invoice/validation/validationRules.d.ts +2 -0
  80. package/dist/editors/invoice/validation/validationRules.d.ts.map +1 -1
  81. package/dist/editors/invoice/validation/validationRules.js +37 -7
  82. package/dist/scripts/contributor-billing/createExpenseReportCsv.d.ts +5 -0
  83. package/dist/scripts/contributor-billing/createExpenseReportCsv.d.ts.map +1 -0
  84. package/dist/scripts/contributor-billing/createExpenseReportCsv.js +122 -0
  85. package/dist/style.css +9 -6
  86. package/package.json +12 -12
  87. package/dist/reducers/general.d.ts +0 -8
  88. package/dist/reducers/general.d.ts.map +0 -1
  89. package/dist/reducers/general.js +0 -73
  90. package/dist/reducers/items.d.ts +0 -8
  91. package/dist/reducers/items.d.ts.map +0 -1
  92. package/dist/reducers/items.js +0 -195
  93. package/dist/reducers/parties.d.ts +0 -8
  94. package/dist/reducers/parties.d.ts.map +0 -1
  95. package/dist/reducers/parties.js +0 -266
  96. package/dist/reducers/transitions.d.ts +0 -8
  97. package/dist/reducers/transitions.d.ts.map +0 -1
  98. package/dist/reducers/transitions.js +0 -162
@@ -1,24 +1,3 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { WagmiContext } from "@powerhousedao/design-system";
3
- import { AnalyticsProvider, useAppConfig, } from "@powerhousedao/reactor-browser";
1
+ import { withDropZone } from "@powerhousedao/design-system";
4
2
  import { DriveExplorer } from "./components/DriveExplorer.js";
5
- import { withDropZone } from "./utils/withDropZone.js";
6
- /**
7
- * Base editor component that renders the drive explorer interface.
8
- * Customize document opening behavior and drive-level actions here.
9
- */
10
- export function BaseEditor(props) {
11
- return (_jsx("div", { className: "new-drive-explorer", style: { height: "100%" }, children: _jsx(DriveExplorer, { ...props }) }));
12
- }
13
- // Wrap base editor with drop zone functionality
14
- const BaseEditorWithDropZone = withDropZone(BaseEditor);
15
- /**
16
- * Main editor entry point with required providers.
17
- */
18
- export default function Editor(props) {
19
- const appConfig = useAppConfig();
20
- const analyticsDatabaseName = appConfig?.analyticsDatabaseName;
21
- return (
22
- // Required context providers for drive functionality
23
- _jsx(WagmiContext, { children: _jsx(AnalyticsProvider, { databaseName: analyticsDatabaseName, children: _jsx(BaseEditorWithDropZone, { ...props }) }) }));
24
- }
3
+ export const Editor = withDropZone(DriveExplorer);
@@ -1,3 +1,4 @@
1
1
  import type { Node } from "document-drive";
2
- export declare function useTransformedNodes(nodes: Node[], driveId: string): any[];
2
+ import type { UiFileNode, UiFolderNode } from "@powerhousedao/design-system";
3
+ export declare function useTransformedNodes(nodes: Node[], driveId: string): (UiFileNode | UiFolderNode)[];
3
4
  //# sourceMappingURL=useTransformedNodes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTransformedNodes.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/hooks/useTransformedNodes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAY,MAAM,gBAAgB,CAAC;AAGrD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,SA8BjE"}
1
+ {"version":3,"file":"useTransformedNodes.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/hooks/useTransformedNodes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAY,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE7E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,iCA8BjE"}
@@ -1,4 +1,4 @@
1
- import Editor from "./editor.js";
1
+ import { Editor } from "./editor.js";
2
2
  export const module = {
3
3
  Component: Editor,
4
4
  documentTypes: ["powerhouse/document-drive"],
@@ -0,0 +1,4 @@
1
+ import type { BillingStatementAction, BillingStatementDocument } from "../../document-models/billing-statement/index.js";
2
+ export declare function useBillingStatementDocument(documentId: string | null | undefined): never[] | [BillingStatementDocument, import("@powerhousedao/reactor-browser").DocumentDispatch<BillingStatementAction>];
3
+ export declare function useSelectedBillingStatementDocument(): never[] | [BillingStatementDocument, import("@powerhousedao/reactor-browser").DocumentDispatch<BillingStatementAction>];
4
+ //# sourceMappingURL=useBillingStatementDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBillingStatementDocument.d.ts","sourceRoot":"","sources":["../../../editors/hooks/useBillingStatementDocument.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,kDAAkD,CAAC;AAE1D,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,2HAMtC;AAED,wBAAgB,mCAAmC,4HAGlD"}
@@ -0,0 +1,8 @@
1
+ import { useDocumentOfType, useSelectedDocumentId, } from "@powerhousedao/reactor-browser";
2
+ export function useBillingStatementDocument(documentId) {
3
+ return useDocumentOfType(documentId, "powerhouse/billing-statement");
4
+ }
5
+ export function useSelectedBillingStatementDocument() {
6
+ const selectedDocumentId = useSelectedDocumentId();
7
+ return useBillingStatementDocument(selectedDocumentId);
8
+ }
@@ -0,0 +1,4 @@
1
+ import type { IntegrationsDocument } from "../../document-models/integrations/index.js";
2
+ export declare function useIntegrationsDocument(documentId: string | null | undefined): never[] | [IntegrationsDocument, import("@powerhousedao/reactor-browser").DocumentDispatch<import("../../document-models/integrations/gen/actions.js").IntegrationsIntegrationsAction>];
3
+ export declare function useSelectedIntegrationsDocument(): never[] | [IntegrationsDocument, import("@powerhousedao/reactor-browser").DocumentDispatch<import("../../document-models/integrations/gen/actions.js").IntegrationsIntegrationsAction>];
4
+ //# sourceMappingURL=useIntegrationsDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIntegrationsDocument.d.ts","sourceRoot":"","sources":["../../../editors/hooks/useIntegrationsDocument.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,oBAAoB,EACrB,MAAM,6CAA6C,CAAC;AAErD,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,2LAK5E;AAED,wBAAgB,+BAA+B,4LAG9C"}
@@ -0,0 +1,8 @@
1
+ import { useDocumentOfType, useSelectedDocumentId, } from "@powerhousedao/reactor-browser";
2
+ export function useIntegrationsDocument(documentId) {
3
+ return useDocumentOfType(documentId, "powerhouse/integrations");
4
+ }
5
+ export function useSelectedIntegrationsDocument() {
6
+ const selectedDocumentId = useSelectedDocumentId();
7
+ return useIntegrationsDocument(selectedDocumentId);
8
+ }
@@ -0,0 +1,4 @@
1
+ import type { InvoiceAction, InvoiceDocument } from "../../document-models/invoice/index.js";
2
+ export declare function useInvoiceDocument(documentId: string | null | undefined): never[] | [InvoiceDocument, import("@powerhousedao/reactor-browser").DocumentDispatch<InvoiceAction>];
3
+ export declare function useSelectedInvoiceDocument(): never[] | [InvoiceDocument, import("@powerhousedao/reactor-browser").DocumentDispatch<InvoiceAction>];
4
+ //# sourceMappingURL=useInvoiceDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInvoiceDocument.d.ts","sourceRoot":"","sources":["../../../editors/hooks/useInvoiceDocument.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EAChB,MAAM,wCAAwC,CAAC;AAEhD,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,yGAKvE;AAED,wBAAgB,0BAA0B,0GAGzC"}
@@ -0,0 +1,8 @@
1
+ import { useDocumentOfType, useSelectedDocumentId, } from "@powerhousedao/reactor-browser";
2
+ export function useInvoiceDocument(documentId) {
3
+ return useDocumentOfType(documentId, "powerhouse/invoice");
4
+ }
5
+ export function useSelectedInvoiceDocument() {
6
+ const selectedDocumentId = useSelectedDocumentId();
7
+ return useInvoiceDocument(selectedDocumentId);
8
+ }
@@ -1,2 +1,5 @@
1
- export default function Editor(props: any): import("react/jsx-runtime").JSX.Element | null;
1
+ import type { EditorProps } from "document-model";
2
+ export default function Editor(props: Partial<EditorProps> & {
3
+ documentId?: string;
4
+ }): import("react/jsx-runtime").JSX.Element | null;
2
5
  //# sourceMappingURL=editor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/integrations/editor.tsx"],"names":[],"mappings":"AAgBA,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,GAAG,kDAyTxC"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/integrations/editor.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AASlD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,kDAoTnF"}
@@ -2,14 +2,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { actions, } from "../../document-models/integrations/index.js";
3
3
  import { Button } from "@powerhousedao/document-engineering";
4
4
  import { useState } from "react";
5
- import { useDocumentById } from "@powerhousedao/reactor-browser";
5
+ import { useSelectedIntegrationsDocument } from "../hooks/useIntegrationsDocument.js";
6
6
  const TABS = [
7
7
  { key: "requestFinance", label: "Request Finance" },
8
8
  { key: "gnosisSafe", label: "Gnosis Safe" },
9
9
  { key: "googleCloud", label: "Google Cloud" },
10
10
  ];
11
11
  export default function Editor(props) {
12
- const [doc, dispatch] = useDocumentById(props.documentId);
12
+ const [doc, dispatch] = useSelectedIntegrationsDocument();
13
13
  const state = doc?.state.global;
14
14
  if (!state) {
15
15
  console.log("Document state not found from document id", props.documentId);
@@ -61,8 +61,7 @@ export default function Editor(props) {
61
61
  : "border-transparent text-gray-500 bg-gray-100 hover:text-blue-500"}`, onClick: () => setActiveTab(tab.key), type: "button", children: tab.label }, tab.key))) }), _jsxs("div", { className: "bg-white rounded-xl shadow p-4 sm:p-6", children: [activeTab === "requestFinance" && (_jsxs("form", { className: "flex flex-col gap-4", onSubmit: (e) => {
62
62
  e.preventDefault();
63
63
  handleRequestFinanceSave();
64
- }, children: [_jsx("h2", { className: "text-lg font-semibold mb-2", children: "Request Finance API" }), _jsxs("label", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-sm font-medium", children: "API Key" }), _jsx("input", { className: "input input-bordered rounded px-3 py-2 border border-gray-300 focus:border-blue-400 focus:ring focus:ring-blue-100 text-sm", type: "text", value: requestFinance.apiKey, onChange: (e) => setRequestFinance((v) => ({ ...v, apiKey: e.target.value })), placeholder: "Enter API Key" })] }), _jsxs("label", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-sm font-medium", children: "Email" }), _jsx("input", { className: "input input-bordered rounded px-3 py-2 border border-gray-300 focus:border-blue-400 focus:ring focus:ring-blue-100 text-sm", type: "email", value: requestFinance.email, onChange: (e) => setRequestFinance((v) => ({ ...v, email: e.target.value })), placeholder: "Enter Email" })] }), _jsx("div", { className: "flex justify-end mt-2", children: _jsx(Button, { size: "sm", variant: "outline", color: "black", type: "submit", className: "hover:bg-gray-200", disabled: state.requestFinance?.apiKey ===
65
- requestFinance.apiKey &&
64
+ }, children: [_jsx("h2", { className: "text-lg font-semibold mb-2", children: "Request Finance API" }), _jsxs("label", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-sm font-medium", children: "API Key" }), _jsx("input", { className: "input input-bordered rounded px-3 py-2 border border-gray-300 focus:border-blue-400 focus:ring focus:ring-blue-100 text-sm", type: "text", value: requestFinance.apiKey, onChange: (e) => setRequestFinance((v) => ({ ...v, apiKey: e.target.value })), placeholder: "Enter API Key" })] }), _jsxs("label", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-sm font-medium", children: "Email" }), _jsx("input", { className: "input input-bordered rounded px-3 py-2 border border-gray-300 focus:border-blue-400 focus:ring focus:ring-blue-100 text-sm", type: "email", value: requestFinance.email, onChange: (e) => setRequestFinance((v) => ({ ...v, email: e.target.value })), placeholder: "Enter Email" })] }), _jsx("div", { className: "flex justify-end mt-2", children: _jsx(Button, { size: "sm", variant: "outline", color: "black", type: "submit", className: "hover:bg-gray-200", disabled: state.requestFinance?.apiKey === requestFinance.apiKey &&
66
65
  state.requestFinance?.email === requestFinance.email, children: "Save" }) })] })), activeTab === "gnosisSafe" && (_jsxs("form", { className: "flex flex-col gap-4", onSubmit: (e) => {
67
66
  e.preventDefault();
68
67
  handleGnosisSafeSave();
@@ -72,8 +71,7 @@ export default function Editor(props) {
72
71
  })), placeholder: "0x..." })] }), _jsxs("label", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-sm font-medium", children: "Signer Private Key" }), _jsx("input", { className: "input input-bordered rounded px-3 py-2 border border-gray-300 focus:border-blue-400 focus:ring focus:ring-blue-100 text-sm", type: "text", value: gnosisSafe.signerPrivateKey, onChange: (e) => setGnosisSafe((v) => ({
73
72
  ...v,
74
73
  signerPrivateKey: e.target.value,
75
- })), placeholder: "Private Key" })] }), _jsx("div", { className: "flex justify-end mt-2", children: _jsx(Button, { size: "sm", variant: "outline", color: "black", type: "submit", className: "hover:bg-gray-200", disabled: state.gnosisSafe?.safeAddress ===
76
- gnosisSafe.safeAddress &&
74
+ })), placeholder: "Private Key" })] }), _jsx("div", { className: "flex justify-end mt-2", children: _jsx(Button, { size: "sm", variant: "outline", color: "black", type: "submit", className: "hover:bg-gray-200", disabled: state.gnosisSafe?.safeAddress === gnosisSafe.safeAddress &&
77
75
  state.gnosisSafe?.signerPrivateKey ===
78
76
  gnosisSafe.signerPrivateKey, children: "Save" }) })] })), activeTab === "googleCloud" && (_jsxs("form", { className: "flex flex-col gap-4", onSubmit: (e) => {
79
77
  e.preventDefault();
@@ -84,10 +82,8 @@ export default function Editor(props) {
84
82
  })), placeholder: "Processor ID" })] }), _jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: Object.entries(googleCloud.keyFile).map(([key, value]) => (_jsxs("label", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-sm font-medium", children: key.replace(/_/g, " ") }), _jsx("input", { className: "input input-bordered rounded px-3 py-2 border border-gray-300 focus:border-blue-400 focus:ring focus:ring-blue-100 text-sm", type: "text", value: value, onChange: (e) => setGoogleCloud((v) => ({
85
83
  ...v,
86
84
  keyFile: { ...v.keyFile, [key]: e.target.value },
87
- })), placeholder: key.replace(/_/g, " ") })] }, key))) }), _jsx("div", { className: "flex justify-end mt-2", children: _jsx(Button, { size: "sm", variant: "outline", color: "black", type: "submit", className: "hover:bg-gray-200", disabled: state.googleCloud?.projectId ===
88
- googleCloud.projectId &&
89
- state.googleCloud?.location ===
90
- googleCloud.location &&
85
+ })), placeholder: key.replace(/_/g, " ") })] }, key))) }), _jsx("div", { className: "flex justify-end mt-2", children: _jsx(Button, { size: "sm", variant: "outline", color: "black", type: "submit", className: "hover:bg-gray-200", disabled: state.googleCloud?.projectId === googleCloud.projectId &&
86
+ state.googleCloud?.location === googleCloud.location &&
91
87
  state.googleCloud?.processorId ===
92
88
  googleCloud.processorId &&
93
89
  state.googleCloud?.keyFile?.type ===
@@ -106,8 +102,7 @@ export default function Editor(props) {
106
102
  googleCloud.keyFile.auth_uri &&
107
103
  state.googleCloud?.keyFile?.token_uri ===
108
104
  googleCloud.keyFile.token_uri &&
109
- state.googleCloud?.keyFile
110
- ?.auth_provider_x509_cert_url ===
105
+ state.googleCloud?.keyFile?.auth_provider_x509_cert_url ===
111
106
  googleCloud.keyFile.auth_provider_x509_cert_url &&
112
107
  state.googleCloud?.keyFile?.client_x509_cert_url ===
113
108
  googleCloud.keyFile.client_x509_cert_url &&
@@ -1,2 +1,5 @@
1
- export default function Editor(props: any): import("react/jsx-runtime").JSX.Element | null;
1
+ import { type EditorProps } from "document-model";
2
+ export default function Editor(props: Partial<EditorProps> & {
3
+ documentId?: string;
4
+ }): import("react/jsx-runtime").JSX.Element | null;
2
5
  //# sourceMappingURL=editor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/invoice/editor.tsx"],"names":[],"mappings":"AA6CA,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,GAAG,kDA0mCxC"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/invoice/editor.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA4C9D,MAAM,CAAC,OAAO,UAAU,MAAM,CAC5B,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,kDA2oCtD"}
@@ -23,12 +23,12 @@ import ConfirmationModal from "./components/confirmationModal.js";
23
23
  import { ClosePaymentModalContent, ConfirmPaymentModalContent, FinalRejectionModalContent, IssueInvoiceModalContent, RegisterPaymentTxModalContent, RejectInvoiceModalContent, ReportPaymentIssueModalContent, SchedulePaymentModalContent, } from "./components/statusModalComponents.js";
24
24
  import { InvoiceStateSchema } from "../../document-models/invoice/gen/schema/zod.js";
25
25
  import validateStatusBeforeContinue from "./validation/validationHandler.js";
26
- import { useDocumentById } from "@powerhousedao/reactor-browser";
26
+ import { useSelectedInvoiceDocument } from "../hooks/useInvoiceDocument.js";
27
27
  function isFiatCurrency(currency) {
28
28
  return currencyList.find((c) => c.ticker === currency)?.crypto === false;
29
29
  }
30
30
  export default function Editor(props) {
31
- const [doc, dispatch] = useDocumentById(props.documentId);
31
+ const [doc, dispatch] = useSelectedInvoiceDocument();
32
32
  const state = doc?.state.global;
33
33
  // Mobile header menu state
34
34
  const [mobileHeaderOpen, setMobileHeaderOpen] = useState(false);
@@ -72,6 +72,7 @@ export default function Editor(props) {
72
72
  const [mainCountryValidation, setMainCountryValidation] = useState(null);
73
73
  const [bankCountryValidation, setBankCountryValidation] = useState(null);
74
74
  const [routingNumberValidation, setRoutingNumberValidation] = useState(null);
75
+ const [accountNumberValidation, setAccountNumberValidation] = useState(null);
75
76
  // Replace showConfirmationModal and pendingStatus with a single modal state
76
77
  const [activeModal, setActiveModal] = useState(null);
77
78
  // Track warning state for modal
@@ -273,7 +274,7 @@ export default function Editor(props) {
273
274
  }
274
275
  // Replace handleStatusChange logic for opening modals
275
276
  const handleStatusChange = (newStatus) => {
276
- const validationResult = validateStatusBeforeContinue(newStatus, state, setInvoiceValidation, setWalletValidation, setCurrencyValidation, setMainCountryValidation, setBankCountryValidation, setIbanValidation, setBicValidation, setBankNameValidation, setStreetAddressValidation, setCityValidation, setPostalCodeValidation, setPayerEmailValidation, setLineItemValidation, setRoutingNumberValidation, isFiatCurrency);
277
+ const validationResult = validateStatusBeforeContinue(newStatus, state, setInvoiceValidation, setWalletValidation, setCurrencyValidation, setMainCountryValidation, setBankCountryValidation, setIbanValidation, setBicValidation, setAccountNumberValidation, setBankNameValidation, setStreetAddressValidation, setCityValidation, setPostalCodeValidation, setPayerEmailValidation, setLineItemValidation, setRoutingNumberValidation, isFiatCurrency);
277
278
  if (validationResult) {
278
279
  return;
279
280
  }
@@ -407,7 +408,7 @@ export default function Editor(props) {
407
408
  if (newValue !== state.dateDelivered) {
408
409
  dispatch(actions.editInvoice({ dateDelivered: newValue }));
409
410
  }
410
- }, value: state.dateDelivered || "" })] })] }), _jsx(LegalEntityForm, { legalEntity: state.issuer, onChangeInfo: (input) => dispatch(actions.editIssuer(input)), onChangeBank: (input) => dispatch(actions.editIssuerBank(input)), onChangeWallet: (input) => dispatch(actions.editIssuerWallet(input)), basicInfoDisabled: false, bankDisabled: !fiatMode, walletDisabled: fiatMode, currency: state.currency, status: state.status, walletvalidation: walletValidation, mainCountryValidation: mainCountryValidation, bankCountryValidation: bankCountryValidation, ibanvalidation: ibanValidation, bicvalidation: bicValidation, banknamevalidation: bankNameValidation, streetaddressvalidation: streetAddressValidation, cityvalidation: cityValidation, postalcodevalidation: postalCodeValidation, payeremailvalidation: payerEmailValidation, routingNumbervalidation: routingNumberValidation })] }), _jsxs("div", { className: "border-0 lg:border lg:border-gray-200 lg:rounded-lg p-0 lg:p-4", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Payer" }), _jsxs("div", { className: "mb-2 w-64", children: [_jsx("label", { className: "block mb-1 text-sm", children: "Due Date:" }), _jsx(DatePicker, { name: "dateDue", className: String.raw `w-full p-0`, onChange: (e) => dispatch(actions.editInvoice({
411
+ }, value: state.dateDelivered || "" })] })] }), _jsx(LegalEntityForm, { legalEntity: state.issuer, onChangeInfo: (input) => dispatch(actions.editIssuer(input)), onChangeBank: (input) => dispatch(actions.editIssuerBank(input)), onChangeWallet: (input) => dispatch(actions.editIssuerWallet(input)), basicInfoDisabled: false, bankDisabled: !fiatMode, walletDisabled: fiatMode, currency: state.currency, status: state.status, walletvalidation: walletValidation, mainCountryValidation: mainCountryValidation, bankCountryValidation: bankCountryValidation, ibanvalidation: ibanValidation, bicvalidation: bicValidation, banknamevalidation: bankNameValidation, streetaddressvalidation: streetAddressValidation, cityvalidation: cityValidation, postalcodevalidation: postalCodeValidation, payeremailvalidation: payerEmailValidation, routingNumbervalidation: routingNumberValidation, accountNumbervalidation: accountNumberValidation })] }), _jsxs("div", { className: "border-0 lg:border lg:border-gray-200 lg:rounded-lg p-0 lg:p-4", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Payer" }), _jsxs("div", { className: "mb-2 w-64", children: [_jsx("label", { className: "block mb-1 text-sm", children: "Due Date:" }), _jsx(DatePicker, { name: "dateDue", className: String.raw `w-full p-0`, onChange: (e) => dispatch(actions.editInvoice({
411
412
  dateDue: e.target.value.split("T")[0],
412
413
  })), value: state.dateDue })] }), _jsx(LegalEntityForm, { bankDisabled: true, legalEntity: state.payer, onChangeInfo: (input) => dispatch(actions.editPayer(input)), currency: state.currency, status: state.status, payeremailvalidation: payerEmailValidation })] })] }), _jsx("div", { className: "mb-8", children: _jsx(LineItemsTable, { currency: state.currency, lineItems: state.lineItems.map((item) => ({
413
414
  ...item,
@@ -1 +1 @@
1
- {"version":3,"file":"ingestPDF.d.ts","sourceRoot":"","sources":["../../../editors/invoice/ingestPDF.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAW,MAAM,wCAAwC,CAAC;AAYhF,wBAAsB,WAAW,CAAC,EAChC,IAAI,EACJ,QAAQ,GACT,EAAE;IACD,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;CAC3C,iBAUA;AAED,UAAU,gBAAgB;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C,kBAAkB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAC7C;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,QAAQ,EACR,kBAAkB,GACnB,EAAE,gBAAgB,2CAoRlB"}
1
+ {"version":3,"file":"ingestPDF.d.ts","sourceRoot":"","sources":["../../../editors/invoice/ingestPDF.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAW,MAAM,wCAAwC,CAAC;AAWhF,wBAAsB,WAAW,CAAC,EAChC,IAAI,EACJ,QAAQ,GACT,EAAE;IACD,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;CAC3C,iBAUA;AAED,UAAU,gBAAgB;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C,kBAAkB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAC7C;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,QAAQ,EACR,kBAAkB,GACnB,EAAE,gBAAgB,2CAmRlB"}
@@ -4,9 +4,9 @@ import { actions } from "../../document-models/invoice/index.js";
4
4
  import { toast } from "@powerhousedao/design-system";
5
5
  import { uploadPdfChunked } from "./uploadPdfChunked.js";
6
6
  import { getCountryCodeFromName } from "./utils/utils.js";
7
- let GRAPHQL_URL = 'http://localhost:4001/graphql/invoice';
8
- if (!window.document.baseURI.includes('localhost')) {
9
- GRAPHQL_URL = 'https://switchboard-dev.powerhouse.xyz/graphql/invoice';
7
+ let GRAPHQL_URL = "http://localhost:4001/graphql/invoice";
8
+ if (!window.document.baseURI.includes("localhost")) {
9
+ GRAPHQL_URL = "https://switchboard-staging.powerhouse.xyz/graphql/invoice";
10
10
  }
11
11
  export async function loadPDFFile({ file, dispatch, }) {
12
12
  if (!file)
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
+ import type { InvoiceAction, InvoiceState } from "../../document-models/invoice/index.js";
2
3
  interface InvoiceToGnosisProps {
3
- docState: any;
4
- dispatch: any;
4
+ docState: InvoiceState;
5
+ dispatch: React.Dispatch<InvoiceAction>;
5
6
  }
6
7
  declare const InvoiceToGnosis: React.FC<InvoiceToGnosisProps>;
7
8
  export default InvoiceToGnosis;
@@ -1 +1 @@
1
- {"version":3,"file":"invoiceToGnosis.d.ts","sourceRoot":"","sources":["../../../editors/invoice/invoiceToGnosis.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAUnD,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,EAAE,GAAG,CAAC;CACf;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA+QnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"invoiceToGnosis.d.ts","sourceRoot":"","sources":["../../../editors/invoice/invoiceToGnosis.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACb,MAAM,wCAAwC,CAAC;AAQhD,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;CACzC;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAgRnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -3,8 +3,8 @@ import { useState, useEffect } from "react";
3
3
  import { actions } from "../../document-models/invoice/index.js";
4
4
  import { generateId } from "document-model";
5
5
  let GRAPHQL_URL = "http://localhost:4001/graphql/invoice";
6
- if (!window.document.baseURI.includes('localhost')) {
7
- GRAPHQL_URL = 'https://switchboard-dev.powerhouse.xyz/graphql/invoice';
6
+ if (!window.document.baseURI.includes("localhost")) {
7
+ GRAPHQL_URL = "https://switchboard-staging.powerhouse.xyz/graphql/invoice";
8
8
  }
9
9
  const InvoiceToGnosis = ({ docState, dispatch, }) => {
10
10
  const [isLoading, setIsLoading] = useState(false);
@@ -13,15 +13,15 @@ const InvoiceToGnosis = ({ docState, dispatch, }) => {
13
13
  const [safeTxHash, setsafeTxHash] = useState(null);
14
14
  const [safeAddress, setSafeAddress] = useState(null);
15
15
  const currency = docState.currency;
16
- const chainName = docState.issuer.paymentRouting.wallet.chainName;
16
+ const chainName = docState.issuer?.paymentRouting?.wallet?.chainName || "";
17
17
  const invoiceStatus = docState.status;
18
18
  useEffect(() => {
19
19
  // set safeADdress from processorRef
20
20
  if (docState.payments.length < 1)
21
21
  return;
22
- const lastPayment = docState.payments[docState.payments.length - 1].processorRef;
23
- console.log(lastPayment);
24
- const retrievedSafeAddress = lastPayment.split(":");
22
+ const lastPaymentRef = docState.payments[docState.payments.length - 1].processorRef || "";
23
+ console.log(lastPaymentRef);
24
+ const retrievedSafeAddress = lastPaymentRef.split(":");
25
25
  if (retrievedSafeAddress[0]) {
26
26
  setSafeAddress(retrievedSafeAddress[0]);
27
27
  }
@@ -50,15 +50,15 @@ const InvoiceToGnosis = ({ docState, dispatch, }) => {
50
50
  // Extract payment details from current-state.json
51
51
  const paymentDetails = {
52
52
  payeeWallet: {
53
- address: docState.issuer.paymentRouting.wallet.address,
54
- chainName: docState.issuer.paymentRouting.wallet.chainName,
55
- chainId: docState.issuer.paymentRouting.wallet.chainId,
53
+ address: docState.issuer?.paymentRouting?.wallet?.address || "",
54
+ chainName: docState.issuer?.paymentRouting?.wallet?.chainName || "",
55
+ chainId: docState.issuer?.paymentRouting?.wallet?.chainId || "",
56
56
  },
57
57
  token: {
58
58
  evmAddress: getTokenAddress(chainName, currency),
59
59
  symbol: docState.currency,
60
- chainName: docState.issuer.paymentRouting.wallet.chainName,
61
- chainId: docState.issuer.paymentRouting.wallet.chainId,
60
+ chainName: docState.issuer?.paymentRouting?.wallet?.chainName || "",
61
+ chainId: docState.issuer?.paymentRouting?.wallet?.chainId || "",
62
62
  },
63
63
  amount: docState.totalPriceTaxIncl || 0.000015, // Make the amount small for testing
64
64
  };
@@ -10,6 +10,7 @@ export type LegalEntityBankSectionProps = Omit<ComponentPropsWithRef<"div">, "ch
10
10
  readonly bicvalidation?: ValidationResult | null;
11
11
  readonly routingNumbervalidation?: ValidationResult | null;
12
12
  readonly banknamevalidation?: ValidationResult | null;
13
+ readonly accountNumbervalidation?: ValidationResult | null;
13
14
  readonly currency: string;
14
15
  };
15
16
  export declare const LegalEntityBankSection: import("react").ForwardRefExoticComponent<Omit<LegalEntityBankSectionProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -1 +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;AAgCtE,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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Q,EAAE,MAAM,CAAC;CAC3B,CAAC;AAmCF,eAAO,MAAM,sBAAsB,qIA6hBlC,CAAC"}
@@ -1,14 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useCallback, useState, useEffect, } from "react";
2
+ import { forwardRef, useCallback, useState, useEffect, useMemo, } from "react";
3
3
  import { twMerge } from "tailwind-merge";
4
4
  import { CountryForm } from "../components/countryForm.js";
5
5
  import { InputField } from "../components/inputField.js";
6
6
  import { Select } from "@powerhousedao/document-engineering";
7
- const FieldLabel = ({ children }) => (_jsx("label", { className: "block text-sm font-medium text-gray-700", children: children }));
7
+ import { isValidIBAN } from "../validation/validationRules.js";
8
8
  const ACCOUNT_TYPES = ["CHECKING", "SAVINGS", "TRUST"];
9
- const AccountTypeSelect = forwardRef(function AccountTypeSelect(props, ref) {
10
- 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)))] }));
11
- });
12
9
  function flattenBankInput(value) {
13
10
  return {
14
11
  ...value,
@@ -39,11 +36,22 @@ function flattenBankInput(value) {
39
36
  };
40
37
  }
41
38
  export const LegalEntityBankSection = forwardRef(function LegalEntityBankSection(props, ref) {
42
- const { value, onChange, disabled, countryvalidation, ibanvalidation, bicvalidation, routingNumbervalidation, banknamevalidation, currency, ...divProps } = props;
39
+ const { value, onChange, disabled, countryvalidation, ibanvalidation, bicvalidation, routingNumbervalidation, banknamevalidation, accountNumbervalidation, currency, ...divProps } = props;
43
40
  const [showIntermediary, setShowIntermediary] = useState(false);
44
41
  const [localState, setLocalState] = useState(flattenBankInput(value));
45
42
  useEffect(() => {
46
43
  setLocalState(flattenBankInput(value));
44
+ // Check if there's any intermediary bank data
45
+ const hasIntermediaryData = !!(localState.accountNumIntermediary ||
46
+ localState.nameIntermediary ||
47
+ localState.beneficiaryIntermediary ||
48
+ localState.ABAIntermediary ||
49
+ localState.BICIntermediary ||
50
+ localState.SWIFTIntermediary ||
51
+ localState.streetAddressIntermediary ||
52
+ localState.cityIntermediary ||
53
+ localState.countryIntermediary);
54
+ setShowIntermediary(hasIntermediaryData);
47
55
  }, [value]);
48
56
  const handleInputChange = useCallback(function handleInputChange(field, event) {
49
57
  setLocalState((prevState) => ({
@@ -58,7 +66,7 @@ export const LegalEntityBankSection = forwardRef(function LegalEntityBankSection
58
66
  }, [onChange]);
59
67
  const handleIntermediaryToggle = useCallback(function handleIntermediaryToggle(event) {
60
68
  setShowIntermediary(event.target.checked);
61
- }, []);
69
+ }, [showIntermediary]);
62
70
  function createInputHandler(field) {
63
71
  return function handleFieldChange(event) {
64
72
  handleInputChange(field, event);
@@ -70,11 +78,25 @@ export const LegalEntityBankSection = forwardRef(function LegalEntityBankSection
70
78
  };
71
79
  }
72
80
  const SEPA_SWIFT_CURRENCIES = ["EUR", "DKK", "GBP", "CHF", "JPY"];
81
+ const usdIbanPayment = useMemo(() => isValidIBAN(localState.accountNum ?? "") && currency === "USD", [localState.accountNum, currency]);
73
82
  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
74
83
  // input={localState.accountNum ?? ""}
75
84
  , {
76
85
  // input={localState.accountNum ?? ""}
77
- 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: [_jsx("div", { className: "space-y-2", children: _jsx(Select, { className: "h-10 w-full text-md mb-2", label: "Account Type", options: ACCOUNT_TYPES.map((type) => ({
86
+ 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:
87
+ // Prefer the first failing validation between IBAN and generic account number
88
+ (() => {
89
+ const firstInvalid = (ibanvalidation &&
90
+ !ibanvalidation.isValid &&
91
+ ibanvalidation) ||
92
+ (accountNumbervalidation &&
93
+ !accountNumbervalidation.isValid &&
94
+ accountNumbervalidation);
95
+ return (firstInvalid ||
96
+ ibanvalidation ||
97
+ accountNumbervalidation ||
98
+ null);
99
+ })() }) }), _jsx("div", { className: "space-y-2", children: _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsx("div", { className: "space-y-2", children: _jsx(Select, { className: "h-10 w-full text-md mb-2", label: "Account Type", options: ACCOUNT_TYPES.map((type) => ({
78
100
  label: type,
79
101
  value: type,
80
102
  })), value: localState.accountType ?? "", onChange: (value) => {
@@ -87,7 +109,7 @@ export const LegalEntityBankSection = forwardRef(function LegalEntityBankSection
87
109
  onChange({
88
110
  accountType: value,
89
111
  });
90
- } }) }), _jsx("div", { className: "space-y-2", children: SEPA_SWIFT_CURRENCIES.includes(currency) ? (_jsx(InputField, { value: (localState.BIC || localState.SWIFT) ?? "", label: "SWIFT/BIC", placeholder: "SWIFT/BIC", onBlur: createBlurHandler("BIC"), handleInputChange: createInputHandler("BIC"), className: "h-10 w-full text-md mb-2", validation: bicvalidation })) : (_jsxs("div", { children: [_jsx(InputField, { value: localState.ABA ?? "", label: "Routing Number (ABA/ACH)", placeholder: "Routing Number (ABA/ACH)", onBlur: createBlurHandler("ABA"), handleInputChange: createInputHandler("ABA"), className: "h-10 w-full text-md mb-2", validation: routingNumbervalidation }), _jsx(InputField, { value: (localState.BIC || localState.SWIFT) ?? "", label: "SWIFT/BIC", placeholder: "SWIFT/BIC", onBlur: createBlurHandler("SWIFT"), handleInputChange: createInputHandler("SWIFT"), className: "h-10 w-full text-md mb-2", validation: bicvalidation })] })) })] }) })] }), _jsx("div", { className: "space-y-4", children: _jsx(InputField
112
+ } }) }), _jsx("div", { className: "space-y-2", children: SEPA_SWIFT_CURRENCIES.includes(currency) ? (_jsx(InputField, { value: (localState.BIC || localState.SWIFT) ?? "", label: "SWIFT/BIC", placeholder: "SWIFT/BIC", onBlur: createBlurHandler("BIC"), handleInputChange: createInputHandler("BIC"), className: "h-10 w-full text-md mb-2", validation: bicvalidation })) : (_jsxs("div", { children: [_jsx(InputField, { value: localState.ABA ?? "", label: "Routing Number (ABA/ACH)", placeholder: "Routing Number (ABA/ACH)", onBlur: createBlurHandler("ABA"), handleInputChange: createInputHandler("ABA"), className: "h-10 w-full text-md mb-2", validation: usdIbanPayment ? null : routingNumbervalidation }), _jsx(InputField, { value: (localState.BIC || localState.SWIFT) ?? "", label: "SWIFT/BIC", placeholder: "SWIFT/BIC", onBlur: createBlurHandler("SWIFT"), handleInputChange: createInputHandler("SWIFT"), className: "h-10 w-full text-md mb-2", validation: bicvalidation })] })) })] }) })] }), _jsx("div", { className: "space-y-4", children: _jsx(InputField
91
113
  // input={localState.beneficiary ?? ""}
92
114
  , {
93
115
  // input={localState.beneficiary ?? ""}
@@ -136,9 +158,11 @@ export const LegalEntityBankSection = forwardRef(function LegalEntityBankSection
136
158
  onChange({
137
159
  accountType: value,
138
160
  });
139
- } }) }), _jsx("div", { className: "space-y-2", children: SEPA_SWIFT_CURRENCIES.includes(currency) ? (_jsx(InputField, { value: (localState.BICIntermediary ||
140
- localState.SWIFTIntermediary) ??
141
- "", label: "SWIFT/BIC", placeholder: "SWIFT/BIC", onBlur: createBlurHandler("BICIntermediary"), handleInputChange: createInputHandler("BICIntermediary"), className: "h-10 w-full text-md mb-2", validation: bicvalidation })) : (_jsxs("div", { children: [_jsx(InputField, { value: localState.ABAIntermediary ?? "", label: "Routing Number (ABA/ACH)", placeholder: "Routing Number (ABA/ACH)", onBlur: createBlurHandler("ABAIntermediary"), handleInputChange: createInputHandler("ABAIntermediary"), className: "h-10 w-full text-md mb-2" }), _jsx(InputField, { value: localState.SWIFTIntermediary ?? "", label: "SWIFT/BIC", placeholder: "SWIFT/BIC", onBlur: createBlurHandler("SWIFTIntermediary"), handleInputChange: createInputHandler("SWIFTIntermediary"), className: "h-10 w-full text-md mb-2" })] })) })] }) })] }), _jsx("div", { className: "space-y-4", children: _jsx(InputField
161
+ } }) }), _jsx("div", { className: "space-y-2", children: SEPA_SWIFT_CURRENCIES.includes(currency) ? (_jsx(InputField, { value: (localState.SWIFTIntermediary ||
162
+ localState.BICIntermediary) ??
163
+ "", label: "SWIFT/BIC", placeholder: "SWIFT/BIC", onBlur: createBlurHandler("BICIntermediary"), handleInputChange: createInputHandler("BICIntermediary"), className: "h-10 w-full text-md mb-2", validation: bicvalidation })) : (_jsxs("div", { children: [_jsx(InputField, { value: localState.ABAIntermediary ?? "", label: "Routing Number (ABA/ACH)", placeholder: "Routing Number (ABA/ACH)", onBlur: createBlurHandler("ABAIntermediary"), handleInputChange: createInputHandler("ABAIntermediary"), className: "h-10 w-full text-md mb-2" }), _jsx(InputField, { value: (localState.SWIFTIntermediary ||
164
+ localState.BICIntermediary) ??
165
+ "", label: "SWIFT/BIC", placeholder: "SWIFT/BIC", onBlur: createBlurHandler("SWIFTIntermediary"), handleInputChange: createInputHandler("SWIFTIntermediary"), className: "h-10 w-full text-md mb-2" })] })) })] }) })] }), _jsx("div", { className: "space-y-4", children: _jsx(InputField
142
166
  // input={localState.beneficiaryIntermediary ?? ""}
143
167
  , {
144
168
  // input={localState.beneficiaryIntermediary ?? ""}
@@ -37,7 +37,8 @@ type LegalEntityFormProps = {
37
37
  readonly postalcodevalidation?: ValidationResult | null;
38
38
  readonly payeremailvalidation?: ValidationResult | null;
39
39
  readonly routingNumbervalidation?: ValidationResult | null;
40
+ readonly accountNumbervalidation?: ValidationResult | null;
40
41
  };
41
- export declare function LegalEntityForm({ legalEntity, onChangeInfo, onChangeBank, onChangeWallet, basicInfoDisabled, bankDisabled, walletDisabled, currency, status, walletvalidation, mainCountryValidation, bankCountryValidation, ibanvalidation, bicvalidation, banknamevalidation, streetaddressvalidation, cityvalidation, postalcodevalidation, payeremailvalidation, routingNumbervalidation, }: LegalEntityFormProps): import("react/jsx-runtime").JSX.Element;
42
+ export declare function LegalEntityForm({ legalEntity, onChangeInfo, onChangeBank, onChangeWallet, basicInfoDisabled, bankDisabled, walletDisabled, currency, status, walletvalidation, mainCountryValidation, bankCountryValidation, ibanvalidation, bicvalidation, banknamevalidation, streetaddressvalidation, cityvalidation, postalcodevalidation, payeremailvalidation, routingNumbervalidation, accountNumbervalidation, }: LegalEntityFormProps): import("react/jsx-runtime").JSX.Element;
42
43
  export {};
43
44
  //# sourceMappingURL=legalEntity.d.ts.map
@@ -1 +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,EACpB,WAAW,EACZ,MAAM,2CAA2C,CAAC;AACnD,OAAc,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAKrD,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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EACR,MAAM,EACN,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,GACxB,EAAE,oBAAoB,2CA4CtB"}
@@ -52,12 +52,12 @@ function flattenLegalEntityToEditInput(legalEntity) {
52
52
  email: legalEntity.contactInfo?.email ?? "",
53
53
  };
54
54
  }
55
- export function LegalEntityForm({ legalEntity, onChangeInfo, onChangeBank, onChangeWallet, basicInfoDisabled, bankDisabled, walletDisabled, currency, status, walletvalidation, mainCountryValidation, bankCountryValidation, ibanvalidation, bicvalidation, banknamevalidation, streetaddressvalidation, cityvalidation, postalcodevalidation, payeremailvalidation, routingNumbervalidation, }) {
55
+ export function LegalEntityForm({ legalEntity, onChangeInfo, onChangeBank, onChangeWallet, basicInfoDisabled, bankDisabled, walletDisabled, currency, status, walletvalidation, mainCountryValidation, bankCountryValidation, ibanvalidation, bicvalidation, banknamevalidation, streetaddressvalidation, cityvalidation, postalcodevalidation, payeremailvalidation, routingNumbervalidation, accountNumbervalidation, }) {
56
56
  // Handler for main info section
57
57
  const handleChangeInfo = (update) => {
58
58
  if (!onChangeInfo)
59
59
  return;
60
60
  onChangeInfo(update);
61
61
  };
62
- return (_jsxs("div", { className: "space-y-8", children: [!basicInfoDisabled && !!onChangeInfo && (_jsx(LegalEntityMainSection, { onChange: handleChangeInfo, value: flattenLegalEntityToEditInput(legalEntity), mainCountryValidation: mainCountryValidation, streetaddressvalidation: streetaddressvalidation, cityvalidation: cityvalidation, postalcodevalidation: postalcodevalidation, payeremailvalidation: payeremailvalidation })), !walletDisabled && !!onChangeWallet && (_jsx(LegalEntityWalletSection, { onChange: onChangeWallet, value: legalEntity.paymentRouting?.wallet || {}, currency: currency, status: status, walletvalidation: walletvalidation })), !bankDisabled && !!onChangeBank && (_jsx(LegalEntityBankSection, { onChange: onChangeBank, currency: currency, value: legalEntity.paymentRouting?.bank || {}, countryvalidation: bankCountryValidation, ibanvalidation: ibanvalidation, bicvalidation: bicvalidation, routingNumbervalidation: routingNumbervalidation, banknamevalidation: banknamevalidation }))] }));
62
+ return (_jsxs("div", { className: "space-y-8", children: [!basicInfoDisabled && !!onChangeInfo && (_jsx(LegalEntityMainSection, { onChange: handleChangeInfo, value: flattenLegalEntityToEditInput(legalEntity), mainCountryValidation: mainCountryValidation, streetaddressvalidation: streetaddressvalidation, cityvalidation: cityvalidation, postalcodevalidation: postalcodevalidation, payeremailvalidation: payeremailvalidation })), !walletDisabled && !!onChangeWallet && (_jsx(LegalEntityWalletSection, { onChange: onChangeWallet, value: legalEntity.paymentRouting?.wallet || {}, currency: currency, status: status, walletvalidation: walletvalidation })), !bankDisabled && !!onChangeBank && (_jsx(LegalEntityBankSection, { onChange: onChangeBank, currency: currency, value: legalEntity.paymentRouting?.bank || {}, countryvalidation: bankCountryValidation, ibanvalidation: ibanvalidation, bicvalidation: bicvalidation, routingNumbervalidation: routingNumbervalidation, banknamevalidation: banknamevalidation, accountNumbervalidation: accountNumbervalidation }))] }));
63
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"lineItemTags.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/lineItemTags/lineItemTags.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,OAAO,CAAC;AAK3C,OAAO,EAAW,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAKhF,UAAU,gBAAgB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,UAAU,sBAAsB;IAC9B,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACxB,eAAe,EAAE,UAAU,EAAE,CAAC;CAC/B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,OAAO,EACP,QAAQ,EACR,eAAe,GAChB,EAAE,sBAAsB,2CA0PxB"}
1
+ {"version":3,"file":"lineItemTags.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/lineItemTags/lineItemTags.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,OAAO,CAAC;AAK3C,OAAO,EAAW,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAKhF,UAAU,gBAAgB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,UAAU,sBAAsB;IAC9B,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACxB,eAAe,EAAE,UAAU,EAAE,CAAC;CAC/B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,OAAO,EACP,QAAQ,EACR,eAAe,GAChB,EAAE,sBAAsB,2CAiQxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"lineItems.d.ts","sourceRoot":"","sources":["../../../editors/invoice/lineItems.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAChB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAKL,KAAK,QAAQ,EAEd,MAAM,OAAO,CAAC;AAef,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKlD;AAED,KAAK,QAAQ,GAAG;IACd,QA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CAAC;QACjB,gBAAgB,EAAE,MAAM,CAAC;QACzB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,GAAG,IAAI,KACL,IAAI,CAAC;IACV,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,UAAU,EAAE,CAAC;CACxC,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,QAAQ,EACR,eAAe,GAChB,EAAE,mBAAmB,2CA2arB"}
@@ -345,7 +345,7 @@ export function LineItemsTable({ lineItems, currency, onAddItem, onUpdateItem, o
345
345
  item: item.description,
346
346
  period: "", // Default value
347
347
  expenseAccount: "", // Default value
348
- total: `$${formatNumber(item.totalPriceTaxIncl)}`,
348
+ total: `${currency} ${formatNumber(item.totalPriceTaxIncl)}`,
349
349
  lineItemTag: item.lineItemTag,
350
350
  }));
351
351
  if (showTagTable) {
@@ -354,11 +354,11 @@ export function LineItemsTable({ lineItems, currency, onAddItem, onUpdateItem, o
354
354
  // Calculate totals for mobile footer
355
355
  const totalPriceTaxExcl = lineItems.reduce((sum, item) => sum + item.totalPriceTaxExcl, 0);
356
356
  const totalPriceTaxIncl = lineItems.reduce((sum, item) => sum + item.totalPriceTaxIncl, 0);
357
- return (_jsxs("div", { ref: containerRef, className: "relative w-full", children: [showMobileModal && (_jsx(LineItemMobileModal, { item: mobileEditItem || {}, currency: currency, isNew: !mobileEditItem?.id || mobileEditItem.id === '', onSave: (item) => {
357
+ return (_jsxs("div", { ref: containerRef, className: "relative w-full", children: [showMobileModal && (_jsx(LineItemMobileModal, { item: mobileEditItem || {}, currency: currency, isNew: !mobileEditItem?.id || mobileEditItem.id === "", onSave: (item) => {
358
358
  try {
359
359
  // If editing an item with empty ID, delete it first, then add new one
360
- if (mobileEditItem?.id === '') {
361
- onDeleteItem({ id: '' });
360
+ if (mobileEditItem?.id === "") {
361
+ onDeleteItem({ id: "" });
362
362
  onAddItem(item);
363
363
  }
364
364
  else if (mobileEditItem?.id) {
@@ -371,12 +371,14 @@ export function LineItemsTable({ lineItems, currency, onAddItem, onUpdateItem, o
371
371
  setMobileEditItem(null);
372
372
  }
373
373
  catch (error) {
374
- toast(error.message || "Failed to save line item", { type: "error" });
374
+ toast(error.message || "Failed to save line item", {
375
+ type: "error",
376
+ });
375
377
  }
376
378
  }, onCancel: () => {
377
379
  setShowMobileModal(false);
378
380
  setMobileEditItem(null);
379
- } }, mobileEditItem?.id || 'new')), _jsxs("div", { className: "mt-4", children: [_jsxs("div", { className: "mb-4 flex items-center justify-between", children: [_jsx("h4", { className: "text-xl font-semibold text-gray-900", children: "Line Items" }), _jsxs("div", { className: "hidden md:flex items-center gap-3", children: [_jsxs("button", { onClick: () => setShowTagTable(true), className: "flex items-center gap-2 px-4 py-2 border border-gray-300 rounded-md hover:bg-gray-50 transition-colors text-sm font-medium text-gray-700", title: "Manage Tags for All Line Items", children: [_jsx(Tag, { className: "w-4 h-4" }), _jsx("span", { className: "hidden md:inline", children: "Manage Tags" })] }), _jsx(RWAButton, { className: "hidden md:block", disabled: isAddingNew, onClick: handleAddClick, children: "Add Line Item" })] })] }), lineItems.length === 0 && !isAddingNew && (_jsx("div", { className: "md:hidden", children: _jsx(LineItemsEmptyState, { onAddItem: () => {
381
+ } }, mobileEditItem?.id || "new")), _jsxs("div", { className: "mt-4", children: [_jsxs("div", { className: "mb-4 flex items-center justify-between", children: [_jsx("h4", { className: "text-xl font-semibold text-gray-900", children: "Line Items" }), _jsxs("div", { className: "hidden md:flex items-center gap-3", children: [_jsxs("button", { onClick: () => setShowTagTable(true), className: "flex items-center gap-2 px-4 py-2 border border-gray-300 rounded-md hover:bg-gray-50 transition-colors text-sm font-medium text-gray-700", title: "Manage Tags for All Line Items", children: [_jsx(Tag, { className: "w-4 h-4" }), _jsx("span", { className: "hidden md:inline", children: "Manage Tags" })] }), _jsx(RWAButton, { className: "hidden md:block", disabled: isAddingNew, onClick: handleAddClick, children: "Add Line Item" })] })] }), lineItems.length === 0 && !isAddingNew && (_jsx("div", { className: "md:hidden", children: _jsx(LineItemsEmptyState, { onAddItem: () => {
380
382
  setMobileEditItem({});
381
383
  setShowMobileModal(true);
382
384
  } }) })), lineItems.length === 0 && !isAddingNew && (_jsx("div", { className: "hidden md:block", children: _jsx(LineItemsEmptyState, { onAddItem: handleAddClick }) })), lineItems.length > 0 && (_jsxs("div", { className: "md:hidden space-y-3", children: [_jsxs("div", { className: "flex gap-2 mb-4", children: [_jsxs("button", { onClick: () => setShowTagTable(true), className: "flex items-center justify-center gap-2 px-4 py-3 border border-gray-300 rounded-md hover:bg-gray-50 transition-colors font-medium text-gray-700", title: "Manage Tags for All Line Items", children: [_jsx(Tag, { className: "w-4 h-4" }), _jsx("span", { children: "Tags" })] }), _jsx("button", { onClick: () => {