@powerhousedao/contributor-billing 0.0.75 → 0.0.77
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.
- package/dist/document-models/billing-statement/gen/general/actions.d.ts +13 -4
- package/dist/document-models/billing-statement/gen/general/actions.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/general/object.d.ts +3 -3
- package/dist/document-models/billing-statement/gen/general/object.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/index.d.ts +2 -0
- package/dist/document-models/billing-statement/gen/index.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/index.js +1 -0
- package/dist/document-models/billing-statement/gen/line-items/actions.d.ts +9 -3
- package/dist/document-models/billing-statement/gen/line-items/actions.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/line-items/object.d.ts +3 -3
- package/dist/document-models/billing-statement/gen/line-items/object.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/object.d.ts +4 -5
- package/dist/document-models/billing-statement/gen/object.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/object.js +2 -2
- package/dist/document-models/billing-statement/gen/ph-factories.d.ts +27 -0
- package/dist/document-models/billing-statement/gen/ph-factories.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/ph-factories.js +58 -0
- package/dist/document-models/billing-statement/gen/reducer.d.ts +4 -2
- package/dist/document-models/billing-statement/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/reducer.js +4 -1
- package/dist/document-models/billing-statement/gen/schema/types.d.ts +4 -0
- package/dist/document-models/billing-statement/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/tags/actions.d.ts +5 -2
- package/dist/document-models/billing-statement/gen/tags/actions.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/tags/object.d.ts +3 -3
- package/dist/document-models/billing-statement/gen/tags/object.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/types.d.ts +4 -4
- package/dist/document-models/billing-statement/gen/types.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/utils.d.ts +18 -3
- package/dist/document-models/billing-statement/gen/utils.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/utils.js +33 -29
- package/dist/document-models/billing-statement/index.d.ts +8 -9
- package/dist/document-models/billing-statement/index.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/index.d.ts +2 -0
- package/dist/document-models/integrations/gen/index.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/index.js +1 -0
- package/dist/document-models/integrations/gen/integrations/actions.d.ts +13 -4
- package/dist/document-models/integrations/gen/integrations/actions.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/integrations/object.d.ts +3 -3
- package/dist/document-models/integrations/gen/integrations/object.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/object.d.ts +4 -5
- package/dist/document-models/integrations/gen/object.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/object.js +2 -2
- package/dist/document-models/integrations/gen/ph-factories.d.ts +27 -0
- package/dist/document-models/integrations/gen/ph-factories.d.ts.map +1 -0
- package/dist/document-models/integrations/gen/ph-factories.js +75 -0
- package/dist/document-models/integrations/gen/reducer.d.ts +4 -2
- package/dist/document-models/integrations/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/reducer.js +4 -1
- package/dist/document-models/integrations/gen/schema/types.d.ts +4 -0
- package/dist/document-models/integrations/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/types.d.ts +4 -4
- package/dist/document-models/integrations/gen/types.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/utils.d.ts +18 -3
- package/dist/document-models/integrations/gen/utils.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/utils.js +36 -32
- package/dist/document-models/integrations/index.d.ts +8 -9
- package/dist/document-models/integrations/index.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/actions.d.ts +21 -6
- package/dist/document-models/invoice/gen/general/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/object.d.ts +3 -3
- package/dist/document-models/invoice/gen/general/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/index.d.ts +2 -0
- package/dist/document-models/invoice/gen/index.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/index.js +1 -0
- package/dist/document-models/invoice/gen/items/actions.d.ts +21 -6
- package/dist/document-models/invoice/gen/items/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/items/object.d.ts +3 -3
- package/dist/document-models/invoice/gen/items/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/object.d.ts +4 -5
- package/dist/document-models/invoice/gen/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/object.js +2 -2
- package/dist/document-models/invoice/gen/parties/actions.d.ts +25 -7
- package/dist/document-models/invoice/gen/parties/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/parties/object.d.ts +3 -3
- package/dist/document-models/invoice/gen/parties/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/ph-factories.d.ts +27 -0
- package/dist/document-models/invoice/gen/ph-factories.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/ph-factories.js +190 -0
- package/dist/document-models/invoice/gen/reducer.d.ts +4 -2
- package/dist/document-models/invoice/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/reducer.js +4 -1
- package/dist/document-models/invoice/gen/schema/types.d.ts +4 -0
- package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/transitions/actions.d.ts +49 -13
- package/dist/document-models/invoice/gen/transitions/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/transitions/object.d.ts +3 -3
- package/dist/document-models/invoice/gen/transitions/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/types.d.ts +4 -4
- package/dist/document-models/invoice/gen/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/utils.d.ts +18 -3
- package/dist/document-models/invoice/gen/utils.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/utils.js +33 -29
- package/dist/document-models/invoice/index.d.ts +8 -9
- package/dist/document-models/invoice/index.d.ts.map +1 -1
- package/dist/editors/billing-statement/editor.d.ts +2 -3
- package/dist/editors/billing-statement/editor.d.ts.map +1 -1
- package/dist/editors/billing-statement/editor.js +11 -3
- package/dist/editors/billing-statement/index.d.ts +1 -2
- package/dist/editors/billing-statement/index.d.ts.map +1 -1
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.js +1 -1
- package/dist/editors/contributor-billing/components/CreateDocument.d.ts +5 -7
- package/dist/editors/contributor-billing/components/CreateDocument.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/CreateDocument.js +18 -9
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts +6 -16
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.js +190 -89
- package/dist/editors/contributor-billing/components/EditorContainer.d.ts +9 -13
- package/dist/editors/contributor-billing/components/EditorContainer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/EditorContainer.js +37 -26
- package/dist/editors/contributor-billing/components/FolderTree.d.ts +7 -3
- package/dist/editors/contributor-billing/components/FolderTree.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/FolderTree.js +11 -4
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +1 -2
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +4 -8
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +125 -119
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts +1 -2
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.js +24 -4
- package/dist/editors/contributor-billing/editor.d.ts +9 -4
- package/dist/editors/contributor-billing/editor.d.ts.map +1 -1
- package/dist/editors/contributor-billing/editor.js +15 -41
- package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts +1 -2
- package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts.map +1 -1
- package/dist/editors/contributor-billing/index.d.ts +1 -2
- package/dist/editors/contributor-billing/index.d.ts.map +1 -1
- package/dist/editors/integrations/editor.d.ts +1 -4
- package/dist/editors/integrations/editor.d.ts.map +1 -1
- package/dist/editors/integrations/editor.js +10 -1
- package/dist/editors/integrations/index.d.ts +1 -2
- package/dist/editors/integrations/index.d.ts.map +1 -1
- package/dist/editors/invoice/editor.d.ts +1 -4
- package/dist/editors/invoice/editor.d.ts.map +1 -1
- package/dist/editors/invoice/editor.js +10 -1
- package/dist/editors/invoice/index.d.ts +1 -2
- package/dist/editors/invoice/index.d.ts.map +1 -1
- package/dist/editors/invoice/ingestPDF.js +1 -1
- package/dist/editors/invoice/invoiceToGnosis.js +2 -2
- package/dist/editors/invoice/requestFinance.js +2 -2
- package/dist/editors/invoice/uploadPdfChunked.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/reducers/general.d.ts +8 -0
- package/dist/reducers/general.d.ts.map +1 -0
- package/dist/reducers/general.js +73 -0
- package/dist/reducers/items.d.ts +8 -0
- package/dist/reducers/items.d.ts.map +1 -0
- package/dist/reducers/items.js +195 -0
- package/dist/reducers/parties.d.ts +8 -0
- package/dist/reducers/parties.d.ts.map +1 -0
- package/dist/reducers/parties.js +266 -0
- package/dist/reducers/transitions.d.ts +8 -0
- package/dist/reducers/transitions.d.ts.map +1 -0
- package/dist/reducers/transitions.js +162 -0
- package/dist/scripts/contributor-billing/createXeroCsv.js +2 -2
- package/dist/style.css +730 -108
- package/dist/subgraphs/billing-statement/index.d.ts +2 -1
- package/dist/subgraphs/billing-statement/index.d.ts.map +1 -1
- package/dist/subgraphs/billing-statement/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/billing-statement/resolvers.js +101 -69
- package/dist/subgraphs/billing-statement/schema.js +3 -3
- package/dist/subgraphs/integrations/index.d.ts +2 -1
- package/dist/subgraphs/integrations/index.d.ts.map +1 -1
- package/dist/subgraphs/integrations/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/integrations/resolvers.js +61 -46
- package/dist/subgraphs/integrations/schema.js +3 -3
- package/dist/subgraphs/invoice/index.d.ts +2 -1
- package/dist/subgraphs/invoice/index.d.ts.map +1 -1
- package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/invoice/resolvers.js +323 -181
- package/dist/subgraphs/invoice/schema.js +3 -3
- package/package.json +14 -14
|
@@ -1,48 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { DriveContextProvider } from "@powerhousedao/reactor-browser/hooks/useDriveContext";
|
|
3
|
-
import { addFolder, deleteNode, updateNode, generateNodesCopy, copyNode, } from "document-drive";
|
|
4
2
|
import { WagmiContext } from "@powerhousedao/design-system";
|
|
3
|
+
import { AnalyticsProvider, DriveContextProvider, useAppConfig, } from "@powerhousedao/reactor-browser";
|
|
5
4
|
import { DriveExplorer } from "./components/DriveExplorer.js";
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Base editor component that renders the drive explorer interface.
|
|
7
|
+
* Customize document opening behavior and drive-level actions here.
|
|
8
|
+
*/
|
|
8
9
|
export function BaseEditor(props) {
|
|
9
|
-
const {
|
|
10
|
-
|
|
11
|
-
const [nodes, setNodes] = useState(props.document.state.global.nodes);
|
|
12
|
-
// Keep nodes in sync with props (in case of external updates)
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
setNodes(props.document.state.global.nodes);
|
|
15
|
-
}, [props.document.state.global.nodes]);
|
|
16
|
-
const onAddFolder = useCallback((name, parentFolder) => {
|
|
17
|
-
dispatch(addFolder({
|
|
18
|
-
id: generateId(),
|
|
19
|
-
name,
|
|
20
|
-
parentFolder,
|
|
21
|
-
}));
|
|
22
|
-
}, [dispatch]);
|
|
23
|
-
const onDeleteNode = useCallback((nodeId) => {
|
|
24
|
-
dispatch(deleteNode({ id: nodeId }));
|
|
25
|
-
setNodes([...props.document.state.global.nodes]);
|
|
26
|
-
}, [dispatch, props.document.state.global.nodes]);
|
|
27
|
-
const renameNode = useCallback((nodeId, name) => {
|
|
28
|
-
dispatch(updateNode({ id: nodeId, name }));
|
|
29
|
-
}, [dispatch]);
|
|
30
|
-
const onCopyNode = useCallback((nodeId, targetName, parentId) => {
|
|
31
|
-
const generateIdWrapper = (prevId) => generateId();
|
|
32
|
-
const copyNodesInput = generateNodesCopy({
|
|
33
|
-
srcId: nodeId,
|
|
34
|
-
targetParentFolder: parentId,
|
|
35
|
-
targetName,
|
|
36
|
-
}, generateIdWrapper, props.document.state.global.nodes);
|
|
37
|
-
const copyNodesAction = copyNodesInput.map((input) => {
|
|
38
|
-
return copyNode(input);
|
|
39
|
-
});
|
|
40
|
-
for (const copyNodeAction of copyNodesAction) {
|
|
41
|
-
dispatch(copyNodeAction);
|
|
42
|
-
}
|
|
43
|
-
}, [dispatch, props.document.state.global.nodes]);
|
|
44
|
-
return (_jsx("div", { className: "new-drive-explorer", children: _jsx(DriveExplorer, { driveId: props.document.header.id, nodes: nodes, onAddFolder: onAddFolder, onDeleteNode: onDeleteNode, renameNode: renameNode, onCopyNode: onCopyNode, context: context, document: props.document, dispatch: dispatch }, nodes.length) }));
|
|
10
|
+
const { context, document } = props;
|
|
11
|
+
return (_jsx("div", { className: "new-drive-explorer", style: { height: "100%" }, children: _jsx(DriveExplorer, { document: document, context: context }) }));
|
|
45
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Main editor entry point with required providers.
|
|
15
|
+
*/
|
|
46
16
|
export default function Editor(props) {
|
|
47
|
-
|
|
17
|
+
const appConfig = useAppConfig();
|
|
18
|
+
const analyticsDatabaseName = appConfig?.analyticsDatabaseName;
|
|
19
|
+
return (
|
|
20
|
+
// Required context providers for drive functionality
|
|
21
|
+
_jsx(DriveContextProvider, { value: props.context, children: _jsx(WagmiContext, { children: _jsx(AnalyticsProvider, { databaseName: analyticsDatabaseName, children: _jsx(BaseEditor, { ...props }) }) }) }));
|
|
48
22
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { Node } from "document-drive";
|
|
2
|
-
|
|
3
|
-
export declare function useTransformedNodes(nodes: Node[], driveId: string): (UiFileNode | UiFolderNode)[];
|
|
2
|
+
export declare function useTransformedNodes(nodes: Node[], driveId: string): any[];
|
|
4
3
|
//# 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;
|
|
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,5 +1,4 @@
|
|
|
1
1
|
import { type DriveEditorModule } from "@powerhousedao/reactor-browser";
|
|
2
|
-
|
|
3
|
-
export declare const module: DriveEditorModule<DocumentDriveDocument>;
|
|
2
|
+
export declare const module: DriveEditorModule;
|
|
4
3
|
export default module;
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/contributor-billing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/contributor-billing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGxE,eAAO,MAAM,MAAM,EAAE,iBASpB,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { type IntegrationsDocument } from "../../document-models/integrations/index.js";
|
|
3
|
-
export type IProps = EditorProps<IntegrationsDocument>;
|
|
4
|
-
export default function Editor(props: IProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export default function Editor(props: any): import("react/jsx-runtime").JSX.Element;
|
|
5
2
|
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/integrations/editor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/integrations/editor.tsx"],"names":[],"mappings":"AAeA,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,GAAG,2CA8TxC"}
|
|
@@ -2,13 +2,22 @@ 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 { useSelectedDocument } from "@powerhousedao/reactor-browser";
|
|
5
6
|
const TABS = [
|
|
6
7
|
{ key: "requestFinance", label: "Request Finance" },
|
|
7
8
|
{ key: "gnosisSafe", label: "Gnosis Safe" },
|
|
8
9
|
{ key: "googleCloud", label: "Google Cloud" },
|
|
9
10
|
];
|
|
10
11
|
export default function Editor(props) {
|
|
11
|
-
|
|
12
|
+
let dispatch;
|
|
13
|
+
const { document } = props;
|
|
14
|
+
if (props?.dispatch) {
|
|
15
|
+
dispatch = props.dispatch;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
const selectedDocument = useSelectedDocument();
|
|
19
|
+
dispatch = selectedDocument[1];
|
|
20
|
+
}
|
|
12
21
|
const [activeTab, setActiveTab] = useState("requestFinance");
|
|
13
22
|
// State for each form
|
|
14
23
|
const [requestFinance, setRequestFinance] = useState(() => ({
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { EditorModule } from "document-model";
|
|
2
|
-
|
|
3
|
-
export declare const module: EditorModule<IntegrationsDocument>;
|
|
2
|
+
export declare const module: EditorModule;
|
|
4
3
|
export default module;
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/integrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/integrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,eAAO,MAAM,MAAM,EAAE,YASpB,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { type InvoiceDocument } from "../../document-models/invoice/index.js";
|
|
3
|
-
export type IProps = EditorProps<InvoiceDocument>;
|
|
4
|
-
export default function Editor(props: IProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export default function Editor(props: any): import("react/jsx-runtime").JSX.Element;
|
|
5
2
|
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/invoice/editor.tsx"],"names":[],"mappings":"
|
|
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,2CAk7BxC"}
|
|
@@ -23,11 +23,20 @@ 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 { useSelectedDocument } from "@powerhousedao/reactor-browser";
|
|
26
27
|
function isFiatCurrency(currency) {
|
|
27
28
|
return currencyList.find((c) => c.ticker === currency)?.crypto === false;
|
|
28
29
|
}
|
|
29
30
|
export default function Editor(props) {
|
|
30
|
-
|
|
31
|
+
let dispatch;
|
|
32
|
+
const { document: doc } = props;
|
|
33
|
+
if (props?.dispatch) {
|
|
34
|
+
dispatch = props.dispatch;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const selectedDocument = useSelectedDocument();
|
|
38
|
+
dispatch = selectedDocument[1];
|
|
39
|
+
}
|
|
31
40
|
const state = doc.state.global;
|
|
32
41
|
// Dynamic property check based on the actual schema
|
|
33
42
|
try {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { EditorModule } from "document-model";
|
|
2
|
-
|
|
3
|
-
export declare const module: EditorModule<InvoiceDocument>;
|
|
2
|
+
export declare const module: EditorModule;
|
|
4
3
|
export default module;
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/invoice/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/invoice/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,eAAO,MAAM,MAAM,EAAE,YASpB,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { uploadPdfChunked } from "./uploadPdfChunked.js";
|
|
|
6
6
|
import { getCountryCodeFromName } from "./utils/utils.js";
|
|
7
7
|
let GRAPHQL_URL = 'http://localhost:4001/graphql/invoice';
|
|
8
8
|
if (!window.document.baseURI.includes('localhost')) {
|
|
9
|
-
GRAPHQL_URL = 'https://switchboard-
|
|
9
|
+
GRAPHQL_URL = 'https://switchboard-dev.powerhouse.xyz/graphql/invoice';
|
|
10
10
|
}
|
|
11
11
|
export async function loadPDFFile({ file, dispatch, }) {
|
|
12
12
|
if (!file)
|
|
@@ -3,8 +3,8 @@ import { useState } 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(
|
|
7
|
-
GRAPHQL_URL =
|
|
6
|
+
if (!window.document.baseURI.includes("localhost")) {
|
|
7
|
+
GRAPHQL_URL = "https://switchboard-dev.powerhouse.xyz/graphql/invoice";
|
|
8
8
|
}
|
|
9
9
|
const InvoiceToGnosis = ({ docState, dispatch, }) => {
|
|
10
10
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -3,8 +3,8 @@ import { useState } 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(
|
|
7
|
-
GRAPHQL_URL =
|
|
6
|
+
if (!window.document.baseURI.includes("localhost")) {
|
|
7
|
+
GRAPHQL_URL = "https://switchboard-dev.powerhouse.xyz/graphql/invoice";
|
|
8
8
|
}
|
|
9
9
|
const RequestFinance = ({ docState, dispatch, }) => {
|
|
10
10
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
let GRAPHQL_URL = 'http://localhost:4001/graphql/invoice';
|
|
9
9
|
if (!window.document.baseURI.includes('localhost')) {
|
|
10
|
-
GRAPHQL_URL = 'https://switchboard-
|
|
10
|
+
GRAPHQL_URL = 'https://switchboard-dev.powerhouse.xyz/graphql/invoice';
|
|
11
11
|
}
|
|
12
12
|
export async function uploadPdfChunked(pdfData, endpoint = GRAPHQL_URL, chunkSize = 500 * 1024, // 500KB chunks
|
|
13
13
|
onProgress) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Manifest } from "document-model";
|
|
2
2
|
export declare const manifest: Manifest;
|
|
3
|
-
export declare const documentModels: (import("document-model").DocumentModelModule<import("./document-models/invoice/
|
|
4
|
-
export declare const editors: (import("document-model").EditorModule
|
|
3
|
+
export declare const documentModels: (import("document-model").DocumentModelModule<import("./document-models/invoice/gen/ph-factories.js").InvoicePHState> | import("document-model").DocumentModelModule<import("./document-models/billing-statement/gen/ph-factories.js").BillingStatementPHState> | import("document-model").DocumentModelModule<import("./document-models/integrations/gen/ph-factories.js").IntegrationsPHState>)[];
|
|
4
|
+
export declare const editors: (import("document-model").EditorModule | import("@powerhousedao/reactor-browser").DriveEditorModule)[];
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAK1C,eAAO,MAAM,QAAQ,EAAE,QAAuB,CAAC;AAC/C,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAK1C,eAAO,MAAM,QAAQ,EAAE,QAAuB,CAAC;AAC/C,eAAO,MAAM,cAAc,qYAAuC,CAAC;AACnE,eAAO,MAAM,OAAO,wGAAgC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a scaffold file meant for customization:
|
|
3
|
+
* - modify it by implementing the reducer functions
|
|
4
|
+
* - delete the file and run the code generator again to have it reset
|
|
5
|
+
*/
|
|
6
|
+
import type { InvoiceGeneralOperations } from "../../gen/general/operations.js";
|
|
7
|
+
export declare const reducer: InvoiceGeneralOperations;
|
|
8
|
+
//# sourceMappingURL=general.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../reducers/general.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,eAAO,MAAM,OAAO,EAAE,wBAkErB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a scaffold file meant for customization:
|
|
3
|
+
* - modify it by implementing the reducer functions
|
|
4
|
+
* - delete the file and run the code generator again to have it reset
|
|
5
|
+
*/
|
|
6
|
+
export const reducer = {
|
|
7
|
+
editInvoiceOperation(state, action, dispatch) {
|
|
8
|
+
try {
|
|
9
|
+
const newState = { ...state };
|
|
10
|
+
newState.currency = action.input.currency ?? state.currency;
|
|
11
|
+
newState.dateDue = action.input.dateDue ?? state.dateDue;
|
|
12
|
+
newState.dateIssued = action.input.dateIssued ?? state.dateIssued;
|
|
13
|
+
newState.invoiceNo = action.input.invoiceNo ?? state.invoiceNo;
|
|
14
|
+
newState.notes = action.input.notes ?? state.notes;
|
|
15
|
+
state = Object.assign(state, newState);
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
console.error(e);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
editStatusOperation(state, action, dispatch) {
|
|
22
|
+
try {
|
|
23
|
+
state.status = action.input.status;
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
console.error(e);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
editPaymentDataOperation(state, action, dispatch) {
|
|
30
|
+
try {
|
|
31
|
+
const payment = state.payments.find((payment) => payment.id === action.input.id);
|
|
32
|
+
if (payment) {
|
|
33
|
+
payment.processorRef = action.input.processorRef ?? payment.processorRef;
|
|
34
|
+
payment.paymentDate = action.input.paymentDate ?? payment.paymentDate;
|
|
35
|
+
payment.txnRef = action.input.txnRef ?? payment.txnRef;
|
|
36
|
+
payment.confirmed = action.input.confirmed ?? payment.confirmed;
|
|
37
|
+
payment.issue = action.input.issue ?? payment.issue;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
console.error(e);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
addPaymentOperation(state, action, dispatch) {
|
|
45
|
+
try {
|
|
46
|
+
const payment = {
|
|
47
|
+
id: action.input.id,
|
|
48
|
+
processorRef: action.input.processorRef ?? "",
|
|
49
|
+
paymentDate: action.input.paymentDate ?? "",
|
|
50
|
+
txnRef: action.input.txnRef ?? "",
|
|
51
|
+
confirmed: action.input.confirmed ?? false,
|
|
52
|
+
issue: action.input.issue ?? "",
|
|
53
|
+
amount: 0,
|
|
54
|
+
};
|
|
55
|
+
state.payments.push(payment);
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
console.error(e);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
setExportedDataOperation(state, action, dispatch) {
|
|
62
|
+
try {
|
|
63
|
+
const exportedData = {
|
|
64
|
+
timestamp: action.input.timestamp,
|
|
65
|
+
exportedLineItems: action.input.exportedLineItems,
|
|
66
|
+
};
|
|
67
|
+
state.exported = exportedData;
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
console.error(e);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a scaffold file meant for customization:
|
|
3
|
+
* - modify it by implementing the reducer functions
|
|
4
|
+
* - delete the file and run the code generator again to have it reset
|
|
5
|
+
*/
|
|
6
|
+
import type { InvoiceItemsOperations } from "../../gen/items/operations.js";
|
|
7
|
+
export declare const reducer: InvoiceItemsOperations;
|
|
8
|
+
//# sourceMappingURL=items.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../reducers/items.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG5E,eAAO,MAAM,OAAO,EAAE,sBA6GrB,CAAC"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a scaffold file meant for customization:
|
|
3
|
+
* - modify it by implementing the reducer functions
|
|
4
|
+
* - delete the file and run the code generator again to have it reset
|
|
5
|
+
*/
|
|
6
|
+
export const reducer = {
|
|
7
|
+
addLineItemOperation(state, action, dispatch) {
|
|
8
|
+
try {
|
|
9
|
+
const item = {
|
|
10
|
+
...action.input,
|
|
11
|
+
lineItemTag: [],
|
|
12
|
+
};
|
|
13
|
+
if (state.lineItems.find((x) => x.id === item.id))
|
|
14
|
+
throw new Error("Duplicate input.id");
|
|
15
|
+
validatePrices(item);
|
|
16
|
+
state.lineItems.push(item);
|
|
17
|
+
updateTotals(state);
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
console.error(e);
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
editLineItemOperation(state, action, dispatch) {
|
|
24
|
+
try {
|
|
25
|
+
const stateItem = state.lineItems.find((x) => x.id === action.input.id);
|
|
26
|
+
if (!stateItem)
|
|
27
|
+
throw new Error("Item matching input.id not found");
|
|
28
|
+
const sanitizedInput = Object.fromEntries(Object.entries(action.input).filter(([, value]) => value !== null));
|
|
29
|
+
// Ensure lineItemTag is always an array if provided
|
|
30
|
+
if ('lineItemTag' in action.input) {
|
|
31
|
+
sanitizedInput.lineItemTag = (action.input.lineItemTag ?? []);
|
|
32
|
+
}
|
|
33
|
+
const nextItem = {
|
|
34
|
+
...stateItem,
|
|
35
|
+
...sanitizedInput,
|
|
36
|
+
};
|
|
37
|
+
validatePrices(nextItem);
|
|
38
|
+
applyInvariants(state, nextItem);
|
|
39
|
+
Object.assign(stateItem, nextItem);
|
|
40
|
+
updateTotals(state);
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
console.error(e);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
deleteLineItemOperation(state, action, dispatch) {
|
|
47
|
+
try {
|
|
48
|
+
state.lineItems = state.lineItems.filter((x) => x.id !== action.input.id);
|
|
49
|
+
updateTotals(state);
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
console.error(e);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
setLineItemTagOperation(state, action, dispatch) {
|
|
56
|
+
try {
|
|
57
|
+
const stateItem = state.lineItems.find((x) => x.id === action.input.lineItemId);
|
|
58
|
+
if (!stateItem)
|
|
59
|
+
throw new Error("Item matching input.id not found");
|
|
60
|
+
// if tag already exists with the same dimension, update the value and label
|
|
61
|
+
const existingTag = stateItem.lineItemTag?.find((tag) => tag.dimension === action.input.dimension);
|
|
62
|
+
if (existingTag) {
|
|
63
|
+
existingTag.value = action.input.value;
|
|
64
|
+
existingTag.label = action.input.label || null;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
// if tag does not exist, add it
|
|
68
|
+
const newTag = {
|
|
69
|
+
dimension: action.input.dimension,
|
|
70
|
+
value: action.input.value,
|
|
71
|
+
label: action.input.label || null,
|
|
72
|
+
};
|
|
73
|
+
if (!stateItem.lineItemTag) {
|
|
74
|
+
stateItem.lineItemTag = [];
|
|
75
|
+
}
|
|
76
|
+
// Add the new tag
|
|
77
|
+
stateItem.lineItemTag?.push(newTag);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (e) {
|
|
81
|
+
console.error(e);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
setInvoiceTagOperation(state, action, dispatch) {
|
|
85
|
+
try {
|
|
86
|
+
// if tag already exists with the same dimension, update the value and label
|
|
87
|
+
const existingTag = state.invoiceTags?.find((tag) => tag.dimension === action.input.dimension);
|
|
88
|
+
if (existingTag) {
|
|
89
|
+
existingTag.value = action.input.value;
|
|
90
|
+
existingTag.label = action.input.label || null;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
// if tag does not exist, add it
|
|
94
|
+
const newTag = {
|
|
95
|
+
dimension: action.input.dimension,
|
|
96
|
+
value: action.input.value,
|
|
97
|
+
label: action.input.label || null,
|
|
98
|
+
};
|
|
99
|
+
if (!state.invoiceTags) {
|
|
100
|
+
state.invoiceTags = [];
|
|
101
|
+
}
|
|
102
|
+
// Add the new tag
|
|
103
|
+
state.invoiceTags.push(newTag);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
console.error(e);
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
function updateTotals(state) {
|
|
112
|
+
state.totalPriceTaxExcl = state.lineItems.reduce((total, lineItem) => {
|
|
113
|
+
return total + lineItem.quantity * lineItem.unitPriceTaxExcl;
|
|
114
|
+
}, 0.0);
|
|
115
|
+
state.totalPriceTaxIncl = state.lineItems.reduce((total, lineItem) => {
|
|
116
|
+
return total + lineItem.quantity * lineItem.unitPriceTaxIncl;
|
|
117
|
+
}, 0.0);
|
|
118
|
+
}
|
|
119
|
+
function validatePrices(item) {
|
|
120
|
+
const EPSILON = 0.00001; // Small value for floating point comparisons
|
|
121
|
+
// Calculate total prices from unit prices and quantity
|
|
122
|
+
const calcPriceIncl = item.quantity * item.unitPriceTaxIncl;
|
|
123
|
+
const calcPriceExcl = item.quantity * item.unitPriceTaxExcl;
|
|
124
|
+
// Convert tax percentage to decimal rate
|
|
125
|
+
const taxRate = item.taxPercent / 100;
|
|
126
|
+
// Helper function to compare floating point numbers
|
|
127
|
+
const isClose = (a, b) => Math.abs(a - b) < EPSILON;
|
|
128
|
+
// Validate unit prices (tax-exclusive should equal tax-inclusive / (1 + taxRate))
|
|
129
|
+
const expectedUnitPriceExcl = item.unitPriceTaxIncl / (1 + taxRate);
|
|
130
|
+
if (!isClose(item.unitPriceTaxExcl, expectedUnitPriceExcl)) {
|
|
131
|
+
throw new Error("Tax inclusive/exclusive unit prices failed comparison.");
|
|
132
|
+
}
|
|
133
|
+
// Validate total prices
|
|
134
|
+
if (!isClose(calcPriceIncl, item.totalPriceTaxIncl)) {
|
|
135
|
+
throw new Error("Calculated unitPriceTaxIncl does not match input total");
|
|
136
|
+
}
|
|
137
|
+
if (!isClose(calcPriceExcl, item.totalPriceTaxExcl)) {
|
|
138
|
+
throw new Error("Calculated unitPriceTaxExcl does not match input total");
|
|
139
|
+
}
|
|
140
|
+
// Validate total prices using the tax rate
|
|
141
|
+
const expectedTotalPriceExcl = calcPriceIncl / (1 + taxRate);
|
|
142
|
+
if (!isClose(calcPriceExcl, expectedTotalPriceExcl)) {
|
|
143
|
+
throw new Error("Tax inclusive/exclusive totals failed comparison.");
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const applyInvariants = (state, nextItem) => {
|
|
147
|
+
const EPSILON = 0.00001; // Small value for floating point comparisons
|
|
148
|
+
// Helper function to compare floating point numbers
|
|
149
|
+
const isClose = (a, b) => Math.abs(a - b) < EPSILON;
|
|
150
|
+
// Helper function to check if a value has changed significantly
|
|
151
|
+
const hasChanged = (oldValue, newValue) => !isClose(oldValue, newValue);
|
|
152
|
+
// Find the current state of this line item
|
|
153
|
+
const currentItem = state.lineItems.find(item => item.id === nextItem.id);
|
|
154
|
+
if (!currentItem) {
|
|
155
|
+
// New item, no comparison needed
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const taxRate = nextItem.taxPercent / 100;
|
|
159
|
+
// Check if totalPriceTaxExcl was changed and update unitPriceTaxExcl accordingly
|
|
160
|
+
const expectedTotalPriceTaxExcl = nextItem.quantity * nextItem.unitPriceTaxExcl;
|
|
161
|
+
if (hasChanged(expectedTotalPriceTaxExcl, nextItem.totalPriceTaxExcl)) {
|
|
162
|
+
// Total was changed, update unit price
|
|
163
|
+
nextItem.unitPriceTaxExcl = nextItem.totalPriceTaxExcl / nextItem.quantity;
|
|
164
|
+
// Update tax-inclusive unit price to maintain tax relationship
|
|
165
|
+
nextItem.unitPriceTaxIncl = nextItem.unitPriceTaxExcl * (1 + taxRate);
|
|
166
|
+
// Update tax-inclusive total to maintain consistency
|
|
167
|
+
nextItem.totalPriceTaxIncl = nextItem.quantity * nextItem.unitPriceTaxIncl;
|
|
168
|
+
}
|
|
169
|
+
// Check if totalPriceTaxIncl was changed and update unitPriceTaxIncl accordingly
|
|
170
|
+
const expectedTotalPriceTaxIncl = nextItem.quantity * nextItem.unitPriceTaxIncl;
|
|
171
|
+
if (hasChanged(expectedTotalPriceTaxIncl, nextItem.totalPriceTaxIncl)) {
|
|
172
|
+
// Total was changed, update unit price
|
|
173
|
+
nextItem.unitPriceTaxIncl = nextItem.totalPriceTaxIncl / nextItem.quantity;
|
|
174
|
+
// Update tax-exclusive unit price to maintain tax relationship
|
|
175
|
+
nextItem.unitPriceTaxExcl = nextItem.unitPriceTaxIncl / (1 + taxRate);
|
|
176
|
+
// Update tax-exclusive total to maintain consistency
|
|
177
|
+
nextItem.totalPriceTaxExcl = nextItem.quantity * nextItem.unitPriceTaxExcl;
|
|
178
|
+
}
|
|
179
|
+
// Check if unitPriceTaxExcl was changed and update totals accordingly
|
|
180
|
+
const expectedUnitPriceTaxIncl = nextItem.unitPriceTaxExcl * (1 + taxRate);
|
|
181
|
+
if (hasChanged(expectedUnitPriceTaxIncl, nextItem.unitPriceTaxIncl)) {
|
|
182
|
+
// Unit price was changed, update tax-inclusive unit price and totals
|
|
183
|
+
nextItem.unitPriceTaxIncl = nextItem.unitPriceTaxExcl * (1 + taxRate);
|
|
184
|
+
nextItem.totalPriceTaxExcl = nextItem.quantity * nextItem.unitPriceTaxExcl;
|
|
185
|
+
nextItem.totalPriceTaxIncl = nextItem.quantity * nextItem.unitPriceTaxIncl;
|
|
186
|
+
}
|
|
187
|
+
// Check if unitPriceTaxIncl was changed and update totals accordingly
|
|
188
|
+
const expectedUnitPriceTaxExcl = nextItem.unitPriceTaxIncl / (1 + taxRate);
|
|
189
|
+
if (hasChanged(expectedUnitPriceTaxExcl, nextItem.unitPriceTaxExcl)) {
|
|
190
|
+
// Unit price was changed, update tax-exclusive unit price and totals
|
|
191
|
+
nextItem.unitPriceTaxExcl = nextItem.unitPriceTaxIncl / (1 + taxRate);
|
|
192
|
+
nextItem.totalPriceTaxExcl = nextItem.quantity * nextItem.unitPriceTaxExcl;
|
|
193
|
+
nextItem.totalPriceTaxIncl = nextItem.quantity * nextItem.unitPriceTaxIncl;
|
|
194
|
+
}
|
|
195
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a scaffold file meant for customization:
|
|
3
|
+
* - modify it by implementing the reducer functions
|
|
4
|
+
* - delete the file and run the code generator again to have it reset
|
|
5
|
+
*/
|
|
6
|
+
import type { InvoicePartiesOperations } from "../../gen/parties/operations.js";
|
|
7
|
+
export declare const reducer: InvoicePartiesOperations;
|
|
8
|
+
//# sourceMappingURL=parties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parties.d.ts","sourceRoot":"","sources":["../../reducers/parties.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAShF,eAAO,MAAM,OAAO,EAAE,wBAwarB,CAAC"}
|