@mx-cartographer/experiences 9.4.1-alpha.al0 → 9.4.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.
- package/CHANGELOG.md +2 -3
- package/dist/budgets/components/BudgetDetailsDrawer.es.js +95 -133
- package/dist/budgets/components/BudgetDetailsDrawer.es.js.map +1 -1
- package/dist/budgets/components/budgetdetails/AddSubBudget.es.js +63 -64
- package/dist/budgets/components/budgetdetails/AddSubBudget.es.js.map +1 -1
- package/dist/budgets/components/budgetdetails/SubBudgetList.es.js +41 -42
- package/dist/budgets/components/budgetdetails/SubBudgetList.es.js.map +1 -1
- package/dist/budgets/components/budgetlist/BudgetRow.es.js +26 -15
- package/dist/budgets/components/budgetlist/BudgetRow.es.js.map +1 -1
- package/dist/budgets/components/budgetlist/SubBudgetRow.es.js +55 -12
- package/dist/budgets/components/budgetlist/SubBudgetRow.es.js.map +1 -1
- package/dist/budgets/components/shared/BudgetAmount.es.js +15 -14
- package/dist/budgets/components/shared/BudgetAmount.es.js.map +1 -1
- package/dist/core/stores/BudgetsStore.d.ts +1 -3
- package/dist/core/stores/BudgetsStore.es.js +32 -40
- package/dist/core/stores/BudgetsStore.es.js.map +1 -1
- package/dist/core/types/RepeatingTransaction.d.ts +2 -2
- package/dist/core/types/RepeatingTransaction.es.js.map +1 -1
- package/dist/core/types/localization/BudgetsCopy.d.ts +0 -3
- package/dist/core/utils/BudgetUtil.es.js +50 -56
- package/dist/core/utils/BudgetUtil.es.js.map +1 -1
- package/dist/recurringtransactions/components/RecurrenceRow.es.js +1 -1
- package/dist/recurringtransactions/components/RecurrenceRow.es.js.map +1 -1
- package/dist/recurringtransactions/components/RecurringTransactionDetails.es.js +1 -1
- package/dist/recurringtransactions/components/RecurringTransactionDetails.es.js.map +1 -1
- package/dist/recurringtransactions/components/RecurringTransactionList.es.js +1 -1
- package/dist/recurringtransactions/components/RecurringTransactionList.es.js.map +1 -1
- package/dist/recurringtransactions/components/shared/recurringsettings/RecurringRow.es.js +1 -1
- package/dist/recurringtransactions/components/shared/recurringsettings/RecurringRow.es.js.map +1 -1
- package/dist/recurringtransactions/components/shared/recurringsettings/SelectTransaction.es.js +14 -15
- package/dist/recurringtransactions/components/shared/recurringsettings/SelectTransaction.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/budgets/components/budgetdetails/SubBudgetAmounts.d.ts +0 -10
- package/dist/budgets/components/budgetdetails/SubBudgetAmounts.es.js +0 -58
- package/dist/budgets/components/budgetdetails/SubBudgetAmounts.es.js.map +0 -1
- package/dist/budgets/components/shared/BudgetDonut.d.ts +0 -8
- package/dist/budgets/components/shared/BudgetDonut.es.js +0 -25
- package/dist/budgets/components/shared/BudgetDonut.es.js.map +0 -1
- package/dist/budgets/components/shared/SubBudgetCategory.d.ts +0 -7
- package/dist/budgets/components/shared/SubBudgetCategory.es.js +0 -45
- package/dist/budgets/components/shared/SubBudgetCategory.es.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubBudgetList.es.js","names":[],"sources":["../../../../src/budgets/components/budgetdetails/SubBudgetList.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Divider from '@mui/material/Divider'\nimport List from '@mui/material/List'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport {\n Dialog,\n Drawer,\n useBudgetsStore,\n useGlobalCopyStore,\n useTransactionStore,\n} from '../../../common'\nimport { type Budget, type DetailedBudget, type Transaction } from '../../../core'\n\nimport { TransactionList } from '../../../transactions'\n\nimport { SubBudgetZeroState } from '../budgetlist/SubBudgetZeroState'\nimport { SubBudgetRow } from '../budgetlist/SubBudgetRow'\nimport { BudgetAmount } from '../shared/BudgetAmount'\nimport { AddSubBudget } from './AddSubBudget'\nimport { Header } from './Header'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\n\ninterface SubBudgetListProps {\n budget: DetailedBudget\n}\n\nexport const SubBudgetList: React.FC<SubBudgetListProps> = observer(({ budget }) => {\n const { category, subBudgets } = budget\n const { budgets: copy, common: commonCopy } = useGlobalCopyStore()\n const { deleteBudget, selectedSubBudget, setSelectedSubBudget, updateBudget } = useBudgetsStore()\n const { filter, setFilter } = useTransactionStore()\n\n const [isEditOpen, setIsEditOpen] = React.useState(false)\n const [isDeleteOpen, setIsDeleteOpen] = React.useState(false)\n const [amount, setAmount] = React.useState(``)\n\n React.useEffect(() => {\n if (selectedSubBudget) {\n setAmount(`${selectedSubBudget.amount}`)\n setFilter({\n ...filter,\n custom: (t: Transaction) => t.category_guid === selectedSubBudget.category_guid,\n })\n }\n }, [selectedSubBudget])\n\n const handleUpdateBudget = async () => {\n if (selectedSubBudget) {\n await updateBudget({\n ...selectedSubBudget,\n amount: Number(amount),\n } as Budget)\n
|
|
1
|
+
{"version":3,"file":"SubBudgetList.es.js","names":[],"sources":["../../../../src/budgets/components/budgetdetails/SubBudgetList.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Divider from '@mui/material/Divider'\nimport List from '@mui/material/List'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport {\n Dialog,\n Drawer,\n useBudgetsStore,\n useGlobalCopyStore,\n useTransactionStore,\n} from '../../../common'\nimport { type Budget, type DetailedBudget, type Transaction } from '../../../core'\n\nimport { TransactionList } from '../../../transactions'\n\nimport { SubBudgetZeroState } from '../budgetlist/SubBudgetZeroState'\nimport { SubBudgetRow } from '../budgetlist/SubBudgetRow'\nimport { BudgetAmount } from '../shared/BudgetAmount'\nimport { AddSubBudget } from './AddSubBudget'\nimport { Header } from './Header'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\n\ninterface SubBudgetListProps {\n budget: DetailedBudget\n}\n\nexport const SubBudgetList: React.FC<SubBudgetListProps> = observer(({ budget }) => {\n const { category, subBudgets } = budget\n const { budgets: copy, common: commonCopy } = useGlobalCopyStore()\n const { deleteBudget, selectedSubBudget, setSelectedSubBudget, updateBudget } = useBudgetsStore()\n const { filter, setFilter } = useTransactionStore()\n\n const [isEditOpen, setIsEditOpen] = React.useState(false)\n const [isDeleteOpen, setIsDeleteOpen] = React.useState(false)\n const [amount, setAmount] = React.useState(``)\n\n React.useEffect(() => {\n if (selectedSubBudget) {\n setAmount(`${selectedSubBudget.amount}`)\n setFilter({\n ...filter,\n custom: (t: Transaction) => t.category_guid === selectedSubBudget.category_guid,\n })\n }\n }, [selectedSubBudget])\n\n const handleUpdateBudget = async () => {\n if (selectedSubBudget) {\n await updateBudget({\n ...selectedSubBudget,\n amount: Number(amount),\n } as Budget)\n }\n }\n\n const handleDeleteBudget = async () => {\n if (selectedSubBudget) {\n await deleteBudget(selectedSubBudget.guid)\n }\n setIsDeleteOpen(false)\n handleClose()\n }\n\n const handleClose = () => {\n setFilter({\n ...filter,\n custom: (t: Transaction) =>\n t.category_guid === budget.category_guid ||\n t.top_level_category_guid === budget.category_guid,\n })\n setSelectedSubBudget(undefined)\n }\n\n return (\n <React.Fragment>\n <List sx={{ bgcolor: 'background.paper' }}>\n {subBudgets.length === 0 ? (\n <SubBudgetZeroState />\n ) : (\n subBudgets.map((subBudget) => (\n <React.Fragment key={subBudget.guid}>\n <SubBudgetRow budget={subBudget} />\n <Divider />\n </React.Fragment>\n ))\n )}\n <AddSubBudget category={category} parentBudget={budget} />\n </List>\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={Boolean(selectedSubBudget)}\n onClose={handleClose}\n onPrimaryAction={() => setIsEditOpen(true)}\n onSecondaryAction={() => setIsDeleteOpen(true)}\n primaryText={copy.details_edit_button}\n secondaryText={copy.details_delete_button}\n title={copy.details_title}\n >\n {selectedSubBudget && (\n <Stack gap={24}>\n <Header budget={selectedSubBudget} />\n <TransactionList height=\"100%\" />\n </Stack>\n )}\n </Drawer>\n\n {selectedSubBudget && (\n <React.Fragment>\n <Dialog\n copy={{ close_aria: commonCopy.close_aria, title: copy.details_edit_title }}\n disablePrimaryButton={Number(amount) <= 0}\n isOpen={isEditOpen}\n onClose={() => setIsEditOpen(false)}\n onPrimaryAction={handleUpdateBudget}\n primaryText={copy.edit_save_button}\n >\n <BudgetAmount\n amount={amount}\n categoryName={selectedSubBudget.category.name}\n onAmountChanged={setAmount}\n />\n </Dialog>\n\n <Dialog\n copy={{ close_aria: commonCopy.close_aria, title: copy.delete_title }}\n isOpen={isDeleteOpen}\n onClose={() => setIsDeleteOpen(false)}\n onPrimaryAction={handleDeleteBudget}\n primaryColor=\"error\"\n primaryText=\"Delete\"\n secondaryColor=\"secondary\"\n >\n <Text variant=\"subtitle1\">\n {buildDynamicCopy(copy.delete_description, selectedSubBudget.category.name) as string}\n </Text>\n </Dialog>\n </React.Fragment>\n )}\n </React.Fragment>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;AA+BA,IAAa,KAA8C,EAAA,CAAU,EAAE,QAAA,EAAA,MAAa;AAClF,QAAM,EAAE,UAAA,GAAU,YAAA,EAAA,IAAe,GAC3B,EAAE,SAAS,GAAM,QAAQ,EAAA,IAAe,EAAmB,GAC3D,EAAE,cAAA,GAAc,mBAAA,GAAmB,sBAAA,GAAsB,cAAA,EAAA,IAAiB,EAAgB,GAC1F,EAAE,QAAA,GAAQ,WAAA,EAAA,IAAc,EAAoB,GAE5C,CAAC,GAAY,CAAA,IAAiB,EAAM,SAAS,EAAK,GAClD,CAAC,GAAc,CAAA,IAAmB,EAAM,SAAS,EAAK,GACtD,CAAC,GAAQ,CAAA,IAAa,EAAM,SAAS,EAAE;AAE7C,EAAA,EAAM,UAAA,MAAgB;AACpB,IAAI,MACF,EAAU,GAAG,EAAkB,MAAA,EAAQ,GACvC,EAAU;AAAA,MACR,GAAG;AAAA,MACH,QAAA,CAAS,MAAmB,EAAE,kBAAkB,EAAkB;AAAA,IACpE,CAAC;AAAA,EAEL,GAAG,CAAC,CAAiB,CAAC;AAEtB,QAAM,IAAqB,YAAY;AACrC,IAAI,KACF,MAAM,EAAa;AAAA,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AiB,QAAO,OAAQ,CAAA,CAC3B;AAAA;IAEH,CAAA;AAAA,IAEP,KACC,gBAAA,EAAC,EAAM,UAAP,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM;AAAA,QAAE,YAAY,EAAW;AAAA,QAAY,OAAO,EAAK;AAAA,MAAmB;AAAA,MAC1E,sBAAsB,OAAO,CAAM,KAAK;AAAA,MACxC,QAAQ;AAAA,MACR,SAAA,MAAe,EAAc,EAAK;AAAA,MAClC,iBAAiB;AAAA,MACjB,aAAa,EAAK;AAAA,MAElB,UAAA,gBAAA,EAAC,GAAD;AAAA,QACU,QAAA;AAAA,QACR,cAAc,EAAkB,SAAS;AAAA,QACzC,iBAAiB;AAAA,MAClB,CAAA;AAAA,IACK,CAAA,GAER,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM;AAAA,QAAE,YAAY,EAAW;AAAA,QAAY,OAAO,EAAK;AAAA,MAAa;AAAA,MACpE,QAAQ;AAAA,MACR,SAAA,MAAe,EAAgB,EAAK;AAAA,MACpC,iBAAiB;AAAA,MACjB,cAAa;AAAA,MACb,aAAY;AAAA,MACZ,gBAAe;AAAA,MAEf,UAAA,gBAAA,EAAC,GAAD;AAAA,QAAM,SAAQ;AAAA,QACX,UAAA,EAAiB,EAAK,oBAAoB,EAAkB,SAAS,IAAI;AAAA,MACtE,CAAA;AAAA,IACA,CAAA,CACM,EAAA,CAAA;AAAA,EAEJ,EAAA,CAAA;AAEpB,CAAC"}
|
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
import { formatCurrency as c } from "../../../core/utils/NumberFormatting.es.js";
|
|
2
|
-
import
|
|
2
|
+
import h from "../../../common/components/donuts/SingleSegmentDonut.es.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import a from "@mui/material/Stack";
|
|
5
|
-
import { Text as o } from "@mxenabled/mxui";
|
|
5
|
+
import { CategoryIcon as b, Text as o } from "@mxenabled/mxui";
|
|
6
6
|
import { jsx as t, jsxs as e } from "react/jsx-runtime";
|
|
7
7
|
import y from "@mui/material/ListItem";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
import v from "@mui/material/ListItemButton";
|
|
9
|
+
import x from "@mui/material/ListItemText";
|
|
10
|
+
import C from "@mui/material/ListItemAvatar";
|
|
11
|
+
var _ = ({ budget: r, onClick: m }) => {
|
|
12
|
+
const { amount: s, budgetColors: { background: d, description: p }, category_guid: l, description: u, percentage: i, subBudgets: f, transaction_total: g } = r, n = i > 100;
|
|
13
|
+
return /* @__PURE__ */ t(y, { children: /* @__PURE__ */ e(v, {
|
|
13
14
|
onClick: () => m?.(r),
|
|
14
|
-
children: [/* @__PURE__ */ t(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
children: [/* @__PURE__ */ t(C, {
|
|
16
|
+
sx: {
|
|
17
|
+
mb: -8,
|
|
18
|
+
mr: 16
|
|
19
|
+
},
|
|
20
|
+
children: /* @__PURE__ */ t(h, {
|
|
21
|
+
color: d,
|
|
22
|
+
percent: i,
|
|
23
|
+
size: 40,
|
|
24
|
+
children: /* @__PURE__ */ t(b, {
|
|
25
|
+
categoryGuid: l,
|
|
26
|
+
variant: "basic"
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
}), /* @__PURE__ */ t(x, {
|
|
19
30
|
primary: /* @__PURE__ */ e(a, {
|
|
20
31
|
component: "span",
|
|
21
32
|
direction: "row",
|
|
@@ -29,7 +40,7 @@ var R = ({ budget: r, onClick: m }) => {
|
|
|
29
40
|
variant: "body1",
|
|
30
41
|
children: `
|
|
31
42
|
${c(g, "0,0")} /
|
|
32
|
-
${c(
|
|
43
|
+
${c(s, "0,0")}
|
|
33
44
|
`
|
|
34
45
|
})]
|
|
35
46
|
}),
|
|
@@ -47,14 +58,14 @@ var R = ({ budget: r, onClick: m }) => {
|
|
|
47
58
|
...n && { ".MuiListItemButton-root:hover &, .MuiListItemButton-root:active &": { color: "error.dark" } }
|
|
48
59
|
},
|
|
49
60
|
variant: "caption",
|
|
50
|
-
children:
|
|
61
|
+
children: u
|
|
51
62
|
})]
|
|
52
63
|
})
|
|
53
64
|
})]
|
|
54
65
|
}) });
|
|
55
66
|
};
|
|
56
67
|
export {
|
|
57
|
-
|
|
68
|
+
_ as BudgetRow
|
|
58
69
|
};
|
|
59
70
|
|
|
60
71
|
//# sourceMappingURL=BudgetRow.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BudgetRow.es.js","names":[],"sources":["../../../../src/budgets/components/budgetlist/BudgetRow.tsx"],"sourcesContent":["import React from 'react'\n\nimport ListItem from '@mui/material/ListItem'\nimport ListItemButton from '@mui/material/ListItemButton'\nimport ListItemText from '@mui/material/ListItemText'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport {
|
|
1
|
+
{"version":3,"file":"BudgetRow.es.js","names":[],"sources":["../../../../src/budgets/components/budgetlist/BudgetRow.tsx"],"sourcesContent":["import React from 'react'\n\nimport ListItem from '@mui/material/ListItem'\nimport ListItemAvatar from '@mui/material/ListItemAvatar'\nimport ListItemButton from '@mui/material/ListItemButton'\nimport ListItemText from '@mui/material/ListItemText'\nimport Stack from '@mui/material/Stack'\n\nimport { CategoryIcon, Text } from '@mxenabled/mxui'\n\nimport { SingleSegmentDonut } from '../../../common'\nimport { type DetailedBudget } from '../../../core'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\n\ninterface BudgetRowProps {\n budget: DetailedBudget\n onClick?: (budget: DetailedBudget) => void\n}\n\nexport const BudgetRow: React.FC<BudgetRowProps> = ({ budget, onClick }) => {\n const {\n amount,\n budgetColors: { background, description: descriptionColor },\n category_guid,\n description,\n percentage,\n subBudgets,\n transaction_total,\n } = budget\n\n const overBudget = percentage > 100\n\n return (\n <ListItem>\n <ListItemButton onClick={() => onClick?.(budget)}>\n <ListItemAvatar sx={{ mb: -8, mr: 16 }}>\n <SingleSegmentDonut color={background} percent={percentage} size={40}>\n <CategoryIcon categoryGuid={category_guid} variant=\"basic\" />\n </SingleSegmentDonut>\n </ListItemAvatar>\n <ListItemText\n primary={\n <Stack component=\"span\" direction=\"row\" justifyContent=\"space-between\">\n <Text bold={true} variant=\"body1\">\n {budget.category.name}\n </Text>\n <Text fontWeight={400} variant=\"body1\">\n {`\n ${formatCurrency(transaction_total, '0,0')} /\n ${formatCurrency(amount, '0,0')}\n `}\n </Text>\n </Stack>\n }\n secondary={\n <Stack component=\"span\" direction=\"row\" justifyContent=\"space-between\">\n <Text variant=\"caption\">{`${subBudgets.length} Sub-budgets`}</Text>\n <Text\n bold={overBudget}\n sx={{\n color: descriptionColor,\n ...(overBudget && {\n '.MuiListItemButton-root:hover &, .MuiListItemButton-root:active &': {\n color: 'error.dark',\n },\n }),\n }}\n variant=\"caption\"\n >\n {description}\n </Text>\n </Stack>\n }\n />\n </ListItemButton>\n </ListItem>\n )\n}\n"],"mappings":";;;;;;;;;;AAmBA,IAAa,IAAA,CAAuC,EAAE,QAAA,GAAQ,SAAA,EAAA,MAAc;AAC1E,QAAM,EACJ,QAAA,GACA,cAAc,EAAE,YAAA,GAAY,aAAa,EAAA,GACzC,eAAA,GACA,aAAA,GACA,YAAA,GACA,YAAA,GACA,mBAAA,EAAA,IACE,GAEE,IAAa,IAAa;AAEhC,SACE,gBAAA,EAAC,GAAD,EAAA,UACE,gBAAA,EAAC,GAAD;AAAA,IAAgB,SAAA,MAAe,IAAU,CAAM;AAAA,IAA/C,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MAAgB,IAAI;AAAA,QAAE,IAAI;AAAA,QAAI,IAAI;AAAA,MAAG;AAAA,MACnC,UAAA,gBAAA,EAAC,GAAD;AAAA,QAAoB,OAAO;AAAA,QAAY,SAAS;AAAA,QAAY,MAAM;AAAA,QAChE,UAAA,gBAAA,EAAC,GAAD;AAAA,UAAc,cAAc;AAAA,UAAe,SAAQ;AAAA,QAAS,CAAA;AAAA,MAC1C,CAAA;AAAA,IACN,CAAA,GAChB,gBAAA,EAAC,GAAD;AAAA,MACE,SACE,gBAAA,EAAC,GAAD;AAAA,QAAO,WAAU;AAAA,QAAO,WAAU;AAAA,QAAM,gBAAe;AAAA,QAAvD,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,UAAM,MAAM;AAAA,UAAM,SAAQ;AAAA,UACvB,UAAA,EAAO,SAAS;AAAA,QACb,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,UAAM,YAAY;AAAA,UAAK,SAAQ;AAAA,UAC5B,UAAA;AAAA,oBACG,EAAe,GAAmB,KAAK,CAAA;AAAA,oBACvC,EAAe,GAAQ,KAAK,CAAA;AAAA;AAAA,QAE5B,CAAA,CACD;AAAA;MAET,WACE,gBAAA,EAAC,GAAD;AAAA,QAAO,WAAU;AAAA,QAAO,WAAU;AAAA,QAAM,gBAAe;AAAA,QAAvD,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,UAAM,SAAQ;AAAA,UAAW,UAAA,GAAG,EAAW,MAAA;AAAA,QAA2B,CAAA,GAClE,gBAAA,EAAC,GAAD;AAAA,UACE,MAAM;AAAA,UACN,IAAI;AAAA,YACF,OAAO;AAAA,YACP,GAAI,KAAc,EAChB,qEAAqE,EACnE,OAAO,aACT,EACF;AAAA,UACF;AAAA,UACA,SAAQ;AAAA,UAEP,UAAA;AAAA,QACG,CAAA,CACD;AAAA;IAEV,CAAA,CACa;AAAA,EACR,CAAA,EAAA,CAAA;AAEd"}
|
|
@@ -1,19 +1,62 @@
|
|
|
1
|
-
import { useBudgetsStore as
|
|
2
|
-
import {
|
|
1
|
+
import { useBudgetsStore as d } from "../../../common/context/hooks.es.js";
|
|
2
|
+
import { formatCurrency as o } from "../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import f from "../../../common/components/donuts/SingleSegmentDonut.es.js";
|
|
3
4
|
import "react";
|
|
4
|
-
import { observer as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
import { observer as u } from "mobx-react-lite";
|
|
6
|
+
import e from "@mui/material/Stack";
|
|
7
|
+
import { CategoryIcon as l, Text as n } from "@mxenabled/mxui";
|
|
8
|
+
import { jsx as t, jsxs as g } from "react/jsx-runtime";
|
|
9
|
+
import y from "@mui/material/ListItem";
|
|
10
|
+
import b from "@mui/material/ListItemButton";
|
|
11
|
+
import h from "@mui/material/ListItemText";
|
|
12
|
+
import S from "@mui/material/ListItemAvatar";
|
|
13
|
+
var z = u(({ budget: r }) => {
|
|
14
|
+
const { amount: i, budgetColors: { background: m }, category: c, percentage: a, transaction_total: s } = r, { setSelectedSubBudget: p } = d();
|
|
15
|
+
return /* @__PURE__ */ t(y, { children: /* @__PURE__ */ g(b, {
|
|
16
|
+
onClick: () => p(r),
|
|
17
|
+
children: [/* @__PURE__ */ t(S, {
|
|
18
|
+
sx: {
|
|
19
|
+
mb: -8,
|
|
20
|
+
mr: 16
|
|
21
|
+
},
|
|
22
|
+
children: /* @__PURE__ */ t(f, {
|
|
23
|
+
color: m,
|
|
24
|
+
percent: a,
|
|
25
|
+
size: 40,
|
|
26
|
+
children: /* @__PURE__ */ t(l, {
|
|
27
|
+
categoryGuid: c.parent_guid,
|
|
28
|
+
variant: "basic"
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
}), /* @__PURE__ */ t(h, {
|
|
32
|
+
primary: /* @__PURE__ */ t(e, {
|
|
33
|
+
component: "span",
|
|
34
|
+
direction: "row",
|
|
35
|
+
justifyContent: "space-between",
|
|
36
|
+
children: /* @__PURE__ */ t(n, {
|
|
37
|
+
bold: !0,
|
|
38
|
+
variant: "body1",
|
|
39
|
+
children: r.category.name
|
|
40
|
+
})
|
|
41
|
+
}),
|
|
42
|
+
secondary: /* @__PURE__ */ t(e, {
|
|
43
|
+
component: "span",
|
|
44
|
+
direction: "row",
|
|
45
|
+
justifyContent: "space-between",
|
|
46
|
+
children: /* @__PURE__ */ t(n, {
|
|
47
|
+
fontWeight: 400,
|
|
48
|
+
variant: "body1",
|
|
49
|
+
children: `
|
|
50
|
+
${o(s, "0,0")} /
|
|
51
|
+
${o(i, "0,0")}
|
|
52
|
+
`
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
})]
|
|
13
56
|
}) });
|
|
14
57
|
});
|
|
15
58
|
export {
|
|
16
|
-
|
|
59
|
+
z as SubBudgetRow
|
|
17
60
|
};
|
|
18
61
|
|
|
19
62
|
//# sourceMappingURL=SubBudgetRow.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubBudgetRow.es.js","names":[],"sources":["../../../../src/budgets/components/budgetlist/SubBudgetRow.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport ListItem from '@mui/material/ListItem'\nimport ListItemButton from '@mui/material/ListItemButton'\n\nimport {
|
|
1
|
+
{"version":3,"file":"SubBudgetRow.es.js","names":[],"sources":["../../../../src/budgets/components/budgetlist/SubBudgetRow.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport ListItem from '@mui/material/ListItem'\nimport ListItemAvatar from '@mui/material/ListItemAvatar'\nimport ListItemButton from '@mui/material/ListItemButton'\nimport ListItemText from '@mui/material/ListItemText'\nimport Stack from '@mui/material/Stack'\n\nimport { CategoryIcon, Text } from '@mxenabled/mxui'\n\nimport { SingleSegmentDonut, useBudgetsStore } from '../../../common'\nimport { type DetailedBudget } from '../../../core'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\n\ninterface SubBudgetRowProps {\n budget: DetailedBudget\n}\n\nexport const SubBudgetRow: React.FC<SubBudgetRowProps> = observer(({ budget }) => {\n const {\n amount,\n budgetColors: { background },\n category,\n percentage,\n transaction_total,\n } = budget\n\n const { setSelectedSubBudget } = useBudgetsStore()\n\n return (\n <ListItem>\n <ListItemButton onClick={() => setSelectedSubBudget(budget)}>\n <ListItemAvatar sx={{ mb: -8, mr: 16 }}>\n <SingleSegmentDonut color={background} percent={percentage} size={40}>\n <CategoryIcon categoryGuid={category.parent_guid} variant=\"basic\" />\n </SingleSegmentDonut>\n </ListItemAvatar>\n <ListItemText\n primary={\n <Stack component=\"span\" direction=\"row\" justifyContent=\"space-between\">\n <Text bold={true} variant=\"body1\">\n {budget.category.name}\n </Text>\n </Stack>\n }\n secondary={\n <Stack component=\"span\" direction=\"row\" justifyContent=\"space-between\">\n <Text fontWeight={400} variant=\"body1\">\n {`\n ${formatCurrency(transaction_total, '0,0')} / \n ${formatCurrency(amount, '0,0')}\n `}\n </Text>\n </Stack>\n }\n />\n </ListItemButton>\n </ListItem>\n )\n})\n"],"mappings":";;;;;;;;;;;;AAmBA,IAAa,IAA4C,EAAA,CAAU,EAAE,QAAA,EAAA,MAAa;AAChF,QAAM,EACJ,QAAA,GACA,cAAc,EAAE,YAAA,EAAA,GAChB,UAAA,GACA,YAAA,GACA,mBAAA,EAAA,IACE,GAEE,EAAE,sBAAA,EAAA,IAAyB,EAAgB;AAEjD,SACE,gBAAA,EAAC,GAAD,EAAA,UACE,gBAAA,EAAC,GAAD;AAAA,IAAgB,SAAA,MAAe,EAAqB,CAAM;AAAA,IAA1D,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MAAgB,IAAI;AAAA,QAAE,IAAI;AAAA,QAAI,IAAI;AAAA,MAAG;AAAA,MACnC,UAAA,gBAAA,EAAC,GAAD;AAAA,QAAoB,OAAO;AAAA,QAAY,SAAS;AAAA,QAAY,MAAM;AAAA,QAChE,UAAA,gBAAA,EAAC,GAAD;AAAA,UAAc,cAAc,EAAS;AAAA,UAAa,SAAQ;AAAA,QAAS,CAAA;AAAA,MACjD,CAAA;AAAA,IACN,CAAA,GAChB,gBAAA,EAAC,GAAD;AAAA,MACE,SACE,gBAAA,EAAC,GAAD;AAAA,QAAO,WAAU;AAAA,QAAO,WAAU;AAAA,QAAM,gBAAe;AAAA,QACrD,UAAA,gBAAA,EAAC,GAAD;AAAA,UAAM,MAAM;AAAA,UAAM,SAAQ;AAAA,UACvB,UAAA,EAAO,SAAS;AAAA,QACb,CAAA;AAAA,MACD,CAAA;AAAA,MAET,WACE,gBAAA,EAAC,GAAD;AAAA,QAAO,WAAU;AAAA,QAAO,WAAU;AAAA,QAAM,gBAAe;AAAA,QACrD,UAAA,gBAAA,EAAC,GAAD;AAAA,UAAM,YAAY;AAAA,UAAK,SAAQ;AAAA,UAC5B,UAAA;AAAA,oBACG,EAAe,GAAmB,KAAK,CAAA;AAAA,oBACvC,EAAe,GAAQ,KAAK,CAAA;AAAA;AAAA,QAE5B,CAAA;AAAA,MACD,CAAA;AAAA,IAEV,CAAA,CACa;AAAA,EACR,CAAA,EAAA,CAAA;AAEd,CAAC"}
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import { useGlobalCopyStore as
|
|
3
|
-
import
|
|
1
|
+
import { buildDynamicCopy as r } from "../../../core/utils/Localization.es.js";
|
|
2
|
+
import { useBudgetsStore as a, useGlobalCopyStore as l, useRecurringTransactionsStore as f } from "../../../common/context/hooks.es.js";
|
|
3
|
+
import { formatCurrency as y } from "../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import b from "../../../common/components/CurrencyInput.es.js";
|
|
4
5
|
import "react";
|
|
5
|
-
import
|
|
6
|
-
import { Text as
|
|
7
|
-
import { jsx as
|
|
8
|
-
var
|
|
9
|
-
const { budgets:
|
|
10
|
-
return /* @__PURE__ */
|
|
6
|
+
import e from "@mui/material/Stack";
|
|
7
|
+
import { Text as m } from "@mxenabled/mxui";
|
|
8
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
9
|
+
var j = ({ amount: i, categoryName: u, onAmountChanged: c }) => {
|
|
10
|
+
const { budgets: o } = l(), { totalBudgeted: d } = a(), { incomeTotal: p } = f(), s = p - d;
|
|
11
|
+
return /* @__PURE__ */ n(e, {
|
|
11
12
|
gap: 16,
|
|
12
|
-
children: [/* @__PURE__ */
|
|
13
|
-
amount:
|
|
13
|
+
children: [/* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t(m, { children: r(o.add_description_top, y(s, "0,0")) }), /* @__PURE__ */ t(m, { children: r(o.add_description_bottom, u) })] }), /* @__PURE__ */ t(b, {
|
|
14
|
+
amount: i,
|
|
14
15
|
autoFocus: !0,
|
|
15
|
-
label:
|
|
16
|
+
label: o.add_label,
|
|
16
17
|
minAmount: 0,
|
|
17
|
-
setAmount:
|
|
18
|
+
setAmount: c,
|
|
18
19
|
sx: { ".MuiTypography-body1": { p: 0 } }
|
|
19
20
|
})]
|
|
20
21
|
});
|
|
21
22
|
};
|
|
22
23
|
export {
|
|
23
|
-
|
|
24
|
+
j as BudgetAmount
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
//# sourceMappingURL=BudgetAmount.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BudgetAmount.es.js","names":[],"sources":["../../../../src/budgets/components/shared/BudgetAmount.tsx"],"sourcesContent":["import React from 'react'\n\nimport Stack from '@mui/material/Stack'\nimport { Text } from '@mxenabled/mxui'\nimport {
|
|
1
|
+
{"version":3,"file":"BudgetAmount.es.js","names":[],"sources":["../../../../src/budgets/components/shared/BudgetAmount.tsx"],"sourcesContent":["import React from 'react'\n\nimport Stack from '@mui/material/Stack'\nimport { Text } from '@mxenabled/mxui'\nimport {\n CurrencyInput,\n useBudgetsStore,\n useGlobalCopyStore,\n useRecurringTransactionsStore,\n} from '../../../common'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\n\ninterface BudgetAmountProps {\n amount: string\n categoryName: string\n onAmountChanged: (amount: string) => void\n}\n\nexport const BudgetAmount: React.FC<BudgetAmountProps> = ({\n amount,\n categoryName,\n onAmountChanged,\n}) => {\n const { budgets: copy } = useGlobalCopyStore()\n const { totalBudgeted } = useBudgetsStore()\n const { incomeTotal } = useRecurringTransactionsStore()\n\n const unbudgetedIncome = incomeTotal - totalBudgeted\n\n return (\n <Stack gap={16}>\n <Stack>\n <Text>\n {\n buildDynamicCopy(\n copy.add_description_top,\n formatCurrency(unbudgetedIncome, '0,0'),\n ) as string\n }\n </Text>\n <Text>{buildDynamicCopy(copy.add_description_bottom, categoryName) as string}</Text>\n </Stack>\n <CurrencyInput\n amount={amount}\n autoFocus={true}\n label={copy.add_label}\n minAmount={0}\n setAmount={onAmountChanged}\n sx={{ '.MuiTypography-body1': { p: 0 } }}\n />\n </Stack>\n )\n}\n"],"mappings":";;;;;;;;AAmBA,IAAa,IAAA,CAA6C,EACxD,QAAA,GACA,cAAA,GACA,iBAAA,EAAA,MACI;AACJ,QAAM,EAAE,SAAS,EAAA,IAAS,EAAmB,GACvC,EAAE,eAAA,EAAA,IAAkB,EAAgB,GACpC,EAAE,aAAA,EAAA,IAAgB,EAA8B,GAEhD,IAAmB,IAAc;AAEvC,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,KAAK;AAAA,IAAZ,UAAA,CACE,gBAAA,EAAC,GAAD,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD,EAAA,UAEI,EACE,EAAK,qBACL,EAAe,GAAkB,KAAK,CACxC,EAEE,CAAA,GACN,gBAAA,EAAC,GAAD,EAAA,UAAO,EAAiB,EAAK,wBAAwB,CAAY,EAAkB,CAAA,CAC9E,EAAA,CAAA,GACP,gBAAA,EAAC,GAAD;AAAA,MACU,QAAA;AAAA,MACR,WAAW;AAAA,MACX,OAAO,EAAK;AAAA,MACZ,WAAW;AAAA,MACX,WAAW;AAAA,MACX,IAAI,EAAE,wBAAwB,EAAE,GAAG,EAAE,EAAE;AAAA,IACxC,CAAA,CACI;AAAA;AAEX"}
|
|
@@ -36,9 +36,7 @@ export declare class BudgetsStore {
|
|
|
36
36
|
data: Budget[];
|
|
37
37
|
isSuccess: boolean;
|
|
38
38
|
}>;
|
|
39
|
-
updateBudget: (budget: Budget) => Promise<
|
|
40
|
-
isSuccess: boolean;
|
|
41
|
-
}>;
|
|
39
|
+
updateBudget: (budget: Budget) => Promise<void>;
|
|
42
40
|
getMerchantBudgetByMerchantGuid: (merchantGuid: string) => MerchantBudget | undefined;
|
|
43
41
|
setMerchantBudgets: (merchantBudgets: MerchantBudget[]) => void;
|
|
44
42
|
addMerchantBudget: (merchantGuid: string, amount: number) => Promise<{
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { CategoryGuids as
|
|
2
|
-
import { BudgetsApi as
|
|
3
|
-
import { upsertByGuid as
|
|
4
|
-
import { augmentBudgets as
|
|
5
|
-
import { endOfMonth as
|
|
6
|
-
import { startOfMonth as
|
|
7
|
-
import { startOfToday as
|
|
8
|
-
import { makeAutoObservable as
|
|
9
|
-
var
|
|
10
|
-
api = new
|
|
1
|
+
import { CategoryGuids as i } from "../constants/Category.es.js";
|
|
2
|
+
import { BudgetsApi as o } from "../api/BudgetsApi.es.js";
|
|
3
|
+
import { upsertByGuid as u } from "../utils/upsertByGuid.es.js";
|
|
4
|
+
import { augmentBudgets as g, findBudget as h, findSubBudget as l } from "../utils/BudgetUtil.es.js";
|
|
5
|
+
import { endOfMonth as B } from "date-fns/endOfMonth";
|
|
6
|
+
import { startOfMonth as p } from "date-fns/startOfMonth";
|
|
7
|
+
import { startOfToday as n } from "date-fns/startOfToday";
|
|
8
|
+
import { makeAutoObservable as b, reaction as S, runInAction as d } from "mobx";
|
|
9
|
+
var _ = class {
|
|
10
|
+
api = new o("/", "");
|
|
11
11
|
globalStore;
|
|
12
12
|
alert = "";
|
|
13
13
|
dateRange = {
|
|
14
|
-
start:
|
|
15
|
-
end:
|
|
14
|
+
start: p(n()),
|
|
15
|
+
end: B(n())
|
|
16
16
|
};
|
|
17
17
|
budgets = [];
|
|
18
18
|
selectedBudget;
|
|
@@ -21,23 +21,23 @@ var C = class {
|
|
|
21
21
|
theme = {};
|
|
22
22
|
merchantBudgets = [];
|
|
23
23
|
constructor(t) {
|
|
24
|
-
this.globalStore = t, this.api = new
|
|
24
|
+
this.globalStore = t, this.api = new o(t.endpoint, t.sessionToken, t.onError), b(this);
|
|
25
25
|
}
|
|
26
26
|
loadBudgetData = async () => {
|
|
27
|
-
this.globalStore.recurringTransactionsStore.isDataLoaded || await this.globalStore.recurringTransactionsStore.loadRepeatingTransactionData(), await this.loadBudgets(),
|
|
27
|
+
this.globalStore.recurringTransactionsStore.isDataLoaded || await this.globalStore.recurringTransactionsStore.loadRepeatingTransactionData(), await this.loadBudgets(), S(() => this.detailedBudgets, (t) => {
|
|
28
28
|
if (t) {
|
|
29
29
|
const e = this.selectedBudget;
|
|
30
|
-
e && (this.selectedBudget =
|
|
30
|
+
e && (this.selectedBudget = h(t, e.guid));
|
|
31
31
|
const r = this.selectedSubBudget;
|
|
32
|
-
r && r.parent_guid && (this.selectedSubBudget =
|
|
32
|
+
r && r.parent_guid && (this.selectedSubBudget = l(t, r.guid, r.parent_guid));
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
36
|
get detailedBudgets() {
|
|
37
|
-
return
|
|
37
|
+
return g(this.budgets.filter((t) => t.category_guid !== i.INCOME && t.category_guid !== i.TRANSFER && t.category_guid !== i.INVESTMENTS), this.globalStore.categoryStore.detailedCategories, this.globalStore.copyStore.copy.budgets, this.theme).sort((t, e) => t.percentage > e.percentage ? -1 : t.percentage < e.percentage ? 1 : 0);
|
|
38
38
|
}
|
|
39
39
|
get incomeBudget() {
|
|
40
|
-
return
|
|
40
|
+
return g(this.budgets.filter((t) => !t.parent_guid), this.globalStore.categoryStore.detailedCategories, this.globalStore.copyStore.copy.budgets, this.theme).reduce((t, e) => e.category_guid !== i.INCOME ? t : !t || e.percentage > t.percentage ? e : t, void 0)?.amount;
|
|
41
41
|
}
|
|
42
42
|
get unbudgetedCategories() {
|
|
43
43
|
return this.globalStore.categoryStore.spendCategories.filter((t) => !this.detailedBudgets.find((e) => e.category_guid === t.guid));
|
|
@@ -48,8 +48,8 @@ var C = class {
|
|
|
48
48
|
addBudget = async (t, e, r = null) => {
|
|
49
49
|
try {
|
|
50
50
|
const s = await this.api.addBudget(t, e, r);
|
|
51
|
-
|
|
52
|
-
this.budgets =
|
|
51
|
+
d(() => {
|
|
52
|
+
this.budgets = u(this.budgets, s);
|
|
53
53
|
});
|
|
54
54
|
} catch (s) {
|
|
55
55
|
console.error("Error adding budget:", s), this.globalStore.captureException(s, { store: "BudgetsStore" });
|
|
@@ -57,18 +57,10 @@ var C = class {
|
|
|
57
57
|
};
|
|
58
58
|
deleteBudget = async (t) => {
|
|
59
59
|
try {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}), e?.subBudgets && e.subBudgets.forEach((d) => {
|
|
64
|
-
r.add(d.guid);
|
|
60
|
+
await this.api.deleteBudget(t), d(() => {
|
|
61
|
+
const e = this.budgets.findIndex((r) => r.guid === t);
|
|
62
|
+
e >= 0 && this.budgets.splice(e, 1);
|
|
65
63
|
});
|
|
66
|
-
const s = [t, ...Array.from(r)], a = await Promise.allSettled(s.map((d) => this.api.deleteBudget(d))), o = new Set(s.filter((d, B) => a[B].status === "fulfilled"));
|
|
67
|
-
i(() => {
|
|
68
|
-
this.budgets = this.budgets.filter((d) => !o.has(d.guid));
|
|
69
|
-
});
|
|
70
|
-
const g = a.find((d) => d.status === "rejected");
|
|
71
|
-
if (g) throw g.reason;
|
|
72
64
|
} catch (e) {
|
|
73
65
|
console.error("Error deleting budget:", e), this.globalStore.captureException(e, { store: "BudgetsStore" });
|
|
74
66
|
}
|
|
@@ -114,12 +106,12 @@ var C = class {
|
|
|
114
106
|
updateBudget = async (t) => {
|
|
115
107
|
try {
|
|
116
108
|
const e = await this.api.updateBudget(t);
|
|
117
|
-
|
|
109
|
+
d(() => {
|
|
118
110
|
const r = this.budgets.findIndex((s) => s.guid === t.guid);
|
|
119
111
|
r >= 0 && (this.budgets[r] = e);
|
|
120
|
-
})
|
|
112
|
+
});
|
|
121
113
|
} catch (e) {
|
|
122
|
-
|
|
114
|
+
console.error("Error updating budget:", e), this.globalStore.captureException(e, { store: "BudgetsStore" });
|
|
123
115
|
}
|
|
124
116
|
};
|
|
125
117
|
getMerchantBudgetByMerchantGuid = (t) => this.merchantBudgets.find((e) => e?.merchant_guid === t);
|
|
@@ -129,8 +121,8 @@ var C = class {
|
|
|
129
121
|
addMerchantBudget = async (t, e) => {
|
|
130
122
|
try {
|
|
131
123
|
const r = await this.api.addMerchantBudget(t, e);
|
|
132
|
-
return
|
|
133
|
-
this.merchantBudgets =
|
|
124
|
+
return d(() => {
|
|
125
|
+
this.merchantBudgets = u(this.merchantBudgets, r);
|
|
134
126
|
}), { isSuccess: !0 };
|
|
135
127
|
} catch (r) {
|
|
136
128
|
return console.error("Error adding merchant budget:", r), this.globalStore.captureException(r, { store: "BudgetsStore" }), { isSuccess: !1 };
|
|
@@ -139,8 +131,8 @@ var C = class {
|
|
|
139
131
|
updateMerchantBudget = async (t) => {
|
|
140
132
|
try {
|
|
141
133
|
const { guid: e, amount: r } = t, s = await this.api.updateMerchantBudget(e, r);
|
|
142
|
-
return
|
|
143
|
-
const a = this.merchantBudgets.findIndex((
|
|
134
|
+
return d(() => {
|
|
135
|
+
const a = this.merchantBudgets.findIndex((c) => c.guid === t.guid);
|
|
144
136
|
a >= 0 && (this.merchantBudgets[a] = s);
|
|
145
137
|
}), { isSuccess: !0 };
|
|
146
138
|
} catch (e) {
|
|
@@ -149,7 +141,7 @@ var C = class {
|
|
|
149
141
|
};
|
|
150
142
|
deleteMerchantBudget = async (t) => {
|
|
151
143
|
try {
|
|
152
|
-
return await this.api.deleteMerchantBudget(t),
|
|
144
|
+
return await this.api.deleteMerchantBudget(t), d(() => {
|
|
153
145
|
this.merchantBudgets = this.merchantBudgets.filter((e) => e.guid !== t);
|
|
154
146
|
}), { isSuccess: !0 };
|
|
155
147
|
} catch (e) {
|
|
@@ -158,7 +150,7 @@ var C = class {
|
|
|
158
150
|
};
|
|
159
151
|
};
|
|
160
152
|
export {
|
|
161
|
-
|
|
153
|
+
_ as BudgetsStore
|
|
162
154
|
};
|
|
163
155
|
|
|
164
156
|
//# sourceMappingURL=BudgetsStore.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BudgetsStore.es.js","names":[],"sources":["../../../src/core/stores/BudgetsStore.ts"],"sourcesContent":["import { makeAutoObservable, reaction, runInAction } from 'mobx'\n\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { startOfToday } from 'date-fns/startOfToday'\n\nimport { Theme } from '@mui/system'\n\nimport { BudgetsApi } from '../api'\nimport { upsertByGuid } from '../utils/upsertByGuid'\nimport { CategoryGuids } from '../constants'\nimport { augmentBudgets, findBudget, findSubBudget } from '../utils/BudgetUtil'\n\nimport { GlobalStore } from './GlobalStore'\n\nimport type {\n Budget,\n Category,\n DateRange,\n DetailedBudget,\n DetailedCategory,\n MerchantBudget,\n} from '../types'\n\nexport class BudgetsStore {\n api: BudgetsApi = new BudgetsApi('/', '')\n\n globalStore: GlobalStore\n\n alert: string = ''\n dateRange: DateRange = { start: startOfMonth(startOfToday()), end: endOfMonth(startOfToday()) }\n budgets: Budget[] = []\n selectedBudget: DetailedBudget | undefined\n selectedSubBudget: DetailedBudget | undefined\n isDataLoaded = false\n theme = {} as Theme\n merchantBudgets: MerchantBudget[] = []\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new BudgetsApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n\n makeAutoObservable(this)\n }\n\n loadBudgetData = async () => {\n if (!this.globalStore.recurringTransactionsStore.isDataLoaded) {\n await this.globalStore.recurringTransactionsStore.loadRepeatingTransactionData()\n }\n await this.loadBudgets()\n\n /** Reaction to update the selected budget/sub-budget if detailedBudgets is updated **/\n reaction(\n () => this.detailedBudgets,\n (detailedBudgets) => {\n if (detailedBudgets) {\n const budget = this.selectedBudget\n if (budget) {\n this.selectedBudget = findBudget(detailedBudgets, budget.guid)\n }\n\n const subBudget = this.selectedSubBudget\n if (subBudget && subBudget.parent_guid) {\n this.selectedSubBudget = findSubBudget(\n detailedBudgets,\n subBudget.guid,\n subBudget.parent_guid,\n )\n }\n }\n },\n )\n }\n\n get detailedBudgets(): DetailedBudget[] {\n return augmentBudgets(\n this.budgets.filter(\n (budget: Budget) =>\n budget.category_guid !== CategoryGuids.INCOME &&\n budget.category_guid !== CategoryGuids.TRANSFER &&\n budget.category_guid !== CategoryGuids.INVESTMENTS,\n ),\n this.globalStore.categoryStore.detailedCategories,\n this.globalStore.copyStore.copy.budgets,\n this.theme,\n ).sort((a, b) => {\n if (a.percentage > b.percentage) return -1\n if (a.percentage < b.percentage) return 1\n return 0\n })\n }\n\n // TODO: Replace this with income from recurring transactions. Income budgets are deprecated.\n get incomeBudget(): number | undefined {\n const filteredBudgets = augmentBudgets(\n this.budgets.filter((budget: Budget) => !budget.parent_guid),\n this.globalStore.categoryStore.detailedCategories,\n this.globalStore.copyStore.copy.budgets,\n this.theme,\n )\n\n const incomeBudget = filteredBudgets.reduce(\n (acc, curr) => {\n if (curr.category_guid !== CategoryGuids.INCOME) return acc\n if (!acc || curr.percentage > acc.percentage) return curr\n return acc\n },\n undefined as DetailedBudget | undefined,\n )\n\n return incomeBudget?.amount\n }\n\n get unbudgetedCategories(): DetailedCategory[] {\n return this.globalStore.categoryStore.spendCategories.filter(\n (category) => !this.detailedBudgets.find((budget) => budget.category_guid === category.guid),\n )\n }\n\n get totalBudgeted(): number {\n return this.detailedBudgets.reduce((total, budget) => total + budget.amount, 0)\n }\n\n addBudget = async (category: Category, amount: number, parentGuid: string | null = null) => {\n try {\n const budget = await this.api.addBudget(category, amount, parentGuid)\n runInAction(() => {\n this.budgets = upsertByGuid(this.budgets, budget)\n })\n } catch (error) {\n console.error('Error adding budget:', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n }\n }\n\n deleteBudget = async (guid: string) => {\n try {\n const detailedParent = this.detailedBudgets.find((b) => b.guid === guid)\n const subBudgetGuids = new Set<string>()\n\n this.budgets.forEach((b) => {\n if (b.parent_guid === guid) {\n subBudgetGuids.add(b.guid)\n }\n })\n\n if (detailedParent?.subBudgets) {\n detailedParent.subBudgets.forEach((sb) => {\n subBudgetGuids.add(sb.guid)\n })\n }\n\n const allGuidsToDelete = [guid, ...Array.from(subBudgetGuids)]\n\n const results = await Promise.allSettled(\n allGuidsToDelete.map((id) => this.api.deleteBudget(id)),\n )\n const deleted = new Set(allGuidsToDelete.filter((_, i) => results[i].status === 'fulfilled'))\n\n runInAction(() => {\n this.budgets = this.budgets.filter((budget) => !deleted.has(budget.guid))\n })\n\n const firstRejection = results.find(\n (r): r is PromiseRejectedResult => r.status === 'rejected',\n )\n if (firstRejection) {\n throw firstRejection.reason\n }\n } catch (error) {\n console.error('Error deleting budget:', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n }\n }\n\n loadBudgets = async () => {\n try {\n const budgets = await this.api.getBudgets()\n this.setBudgets(budgets)\n } catch (error) {\n console.error('Error occurred while loading budgets:', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n throw error\n }\n }\n\n setAlert = (alert: string) => (this.alert = alert)\n\n setBudgets = (budgets: Budget[]) => {\n this.budgets = budgets\n this.isDataLoaded = true\n }\n\n setDateRange = (dateRange: DateRange) => (this.dateRange = dateRange)\n\n setSelectedBudget = (budget: DetailedBudget | undefined) => (this.selectedBudget = budget)\n\n setSelectedSubBudget = (budget: DetailedBudget | undefined) => (this.selectedSubBudget = budget)\n\n setTheme = (theme: Theme) => (this.theme = theme)\n\n /**\n * Recalculate budget by using the average amount from top-level categories\n * @param categories Detailed categories\n */\n recalculateBudgets = async (categories: DetailedCategory[]) => {\n try {\n for (const category of categories) {\n const budget = this.budgets.find((budget) => budget.category_guid === category.guid)\n if (budget) {\n await this.api.updateBudget({\n ...budget,\n amount: category.totalAverageAmount,\n })\n } else {\n await this.api.addBudget(category, category.totalAverageAmount)\n }\n }\n const budgetsToDelete = this.budgets.filter(\n (budget) => !categories.find((c) => c.guid === budget.category_guid),\n )\n\n for (const budgetToDelete of budgetsToDelete) {\n await this.api.deleteBudget(budgetToDelete.guid)\n }\n\n await this.loadBudgets()\n\n return { data: this.budgets, isSuccess: true }\n } catch (error) {\n console.error('Error recalculating budgets:', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n return { data: [], isSuccess: false }\n }\n }\n\n updateBudget = async (budget: Budget): Promise<{ isSuccess: boolean }> => {\n try {\n const updatedBudget = await this.api.updateBudget(budget)\n\n runInAction(() => {\n const index = this.budgets.findIndex((b) => b.guid === budget.guid)\n if (index >= 0) {\n this.budgets[index] = updatedBudget\n }\n })\n return { isSuccess: true }\n } catch (error) {\n console.error('Error updating budget:', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n return { isSuccess: false }\n }\n }\n\n getMerchantBudgetByMerchantGuid = (merchantGuid: string): MerchantBudget | undefined => {\n return this.merchantBudgets.find(\n (eachMerchantBudget) => eachMerchantBudget?.merchant_guid === merchantGuid,\n )\n }\n\n setMerchantBudgets = (merchantBudgets: MerchantBudget[]) => {\n this.merchantBudgets = merchantBudgets\n }\n\n addMerchantBudget = async (merchantGuid: string, amount: number) => {\n try {\n const newMerchantBudget = await this.api.addMerchantBudget(merchantGuid, amount)\n\n runInAction(() => {\n this.merchantBudgets = upsertByGuid(this.merchantBudgets, newMerchantBudget)\n })\n return { isSuccess: true }\n } catch (error) {\n console.error('Error adding merchant budget:', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n return { isSuccess: false }\n }\n }\n\n updateMerchantBudget = async (merchantBudget: MerchantBudget) => {\n try {\n const { guid: merchantBudgetGuid, amount } = merchantBudget\n const updatedMerchantBudget = await this.api.updateMerchantBudget(merchantBudgetGuid, amount)\n\n runInAction(() => {\n const index = this.merchantBudgets.findIndex((b) => b.guid === merchantBudget.guid)\n if (index >= 0) {\n this.merchantBudgets[index] = updatedMerchantBudget\n }\n })\n return { isSuccess: true }\n } catch (error) {\n console.error('Error updating merchant budget:', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n return { isSuccess: false }\n }\n }\n\n deleteMerchantBudget = async (merchantBudgetGuid: string) => {\n try {\n await this.api.deleteMerchantBudget(merchantBudgetGuid)\n\n runInAction(() => {\n this.merchantBudgets = this.merchantBudgets.filter((b) => b.guid !== merchantBudgetGuid)\n })\n return { isSuccess: true }\n } catch (error) {\n console.error('Error deleting merchant budget:', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n return { isSuccess: false }\n }\n }\n}\n"],"mappings":";;;;;;;;AAwBA,IAAa,IAAb,MAA0B;AAAA,EACxB,MAAkB,IAAI,EAAW,KAAK,EAAE;AAAA,EAExC;AAAA,EAEA,QAAgB;AAAA,EAChB,YAAuB;AAAA,IAAE,OAAO,EAAa,EAAa,CAAC;AAAA,IAAG,KAAK,EAAW,EAAa,CAAC;AAAA,EAAE;AAAA,EAC9F,UAAoB,CAAC;AAAA,EACrB;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,QAAQ,CAAC;AAAA,EACT,kBAAoC,CAAC;AAAA,EAErC,YAAY,GAA0B;AACpC,SAAK,cAAc,GACnB,KAAK,MAAM,IAAI,EAAW,EAAY,UAAU,EAAY,cAAc,EAAY,OAAO,GAE7F,EAAmB,IAAI;AAAA,EACzB;AAAA,EAEA,iBAAiB,YAAY;AAC3B,IAAK,KAAK,YAAY,2BAA2B,gBAC/C,MAAM,KAAK,YAAY,2BAA2B,6BAA6B,GAEjF,MAAM,KAAK,YAAY,GAGvB,EAAA,MACQ,KAAK,iBAAA,CACV,MAAoB;AACnB,UAAI,GAAiB;AACnB,cAAM,IAAS,KAAK;AACpB,QAAI,MACF,KAAK,iBAAiB,EAAW,GAAiB,EAAO,IAAI;AAG/D,cAAM,IAAY,KAAK;AACvB,QAAI,KAAa,EAAU,gBACzB,KAAK,oBAAoB,EACvB,GACA,EAAU,MACV,EAAU,WACZ;AAA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ACM,EAAE,WAAW,GAAK;AAAA,IAC3B,SAAS,GAAO;AACd,qBAAQ,MAAM,mCAAmC,CAAK,GACtD,KAAK,YAAY,iBAAiB,GAAO,EAAE,OAAO,eAAe,CAAC,GAC3D,EAAE,WAAW,GAAM;AAAA,IAC5B;AAAA,EACF;AAAA,EAEA,uBAAuB,OAAO,MAA+B;AAC3D,QAAI;AACF,mBAAM,KAAK,IAAI,qBAAqB,CAAkB,GAEtD,EAAA,MAAkB;AAChB,aAAK,kBAAkB,KAAK,gBAAgB,OAAA,CAAQ,MAAM,EAAE,SAAS,CAAkB;AAAA,MACzF,CAAC,GACM,EAAE,WAAW,GAAK;AAAA,IAC3B,SAAS,GAAO;AACd,qBAAQ,MAAM,mCAAmC,CAAK,GACtD,KAAK,YAAY,iBAAiB,GAAO,EAAE,OAAO,eAAe,CAAC,GAC3D,EAAE,WAAW,GAAM;AAAA,IAC5B;AAAA,EACF;AACF"}
|
|
1
|
+
{"version":3,"file":"BudgetsStore.es.js","names":[],"sources":["../../../src/core/stores/BudgetsStore.ts"],"sourcesContent":["import { makeAutoObservable, reaction, runInAction } from 'mobx'\n\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { startOfToday } from 'date-fns/startOfToday'\n\nimport { Theme } from '@mui/system'\n\nimport { BudgetsApi } from '../api'\nimport { upsertByGuid } from '../utils/upsertByGuid'\nimport { CategoryGuids } from '../constants'\nimport { augmentBudgets, findBudget, findSubBudget } from '../utils/BudgetUtil'\n\nimport { GlobalStore } from './GlobalStore'\n\nimport type {\n Budget,\n Category,\n DateRange,\n DetailedBudget,\n DetailedCategory,\n MerchantBudget,\n} from '../types'\n\nexport class BudgetsStore {\n api: BudgetsApi = new BudgetsApi('/', '')\n\n globalStore: GlobalStore\n\n alert: string = ''\n dateRange: DateRange = { start: startOfMonth(startOfToday()), end: endOfMonth(startOfToday()) }\n budgets: Budget[] = []\n selectedBudget: DetailedBudget | undefined\n selectedSubBudget: DetailedBudget | undefined\n isDataLoaded = false\n theme = {} as Theme\n merchantBudgets: MerchantBudget[] = []\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new BudgetsApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n\n makeAutoObservable(this)\n }\n\n loadBudgetData = async () => {\n if (!this.globalStore.recurringTransactionsStore.isDataLoaded) {\n await this.globalStore.recurringTransactionsStore.loadRepeatingTransactionData()\n }\n await this.loadBudgets()\n\n /** Reaction to update the selected budget/sub-budget if detailedBudgets is updated **/\n reaction(\n () => this.detailedBudgets,\n (detailedBudgets) => {\n if (detailedBudgets) {\n const budget = this.selectedBudget\n if (budget) {\n this.selectedBudget = findBudget(detailedBudgets, budget.guid)\n }\n\n const subBudget = this.selectedSubBudget\n if (subBudget && subBudget.parent_guid) {\n this.selectedSubBudget = findSubBudget(\n detailedBudgets,\n subBudget.guid,\n subBudget.parent_guid,\n )\n }\n }\n },\n )\n }\n\n get detailedBudgets(): DetailedBudget[] {\n return augmentBudgets(\n this.budgets.filter(\n (budget: Budget) =>\n budget.category_guid !== CategoryGuids.INCOME &&\n budget.category_guid !== CategoryGuids.TRANSFER &&\n budget.category_guid !== CategoryGuids.INVESTMENTS,\n ),\n this.globalStore.categoryStore.detailedCategories,\n this.globalStore.copyStore.copy.budgets,\n this.theme,\n ).sort((a, b) => {\n if (a.percentage > b.percentage) return -1\n if (a.percentage < b.percentage) return 1\n return 0\n })\n }\n\n // TODO: Replace this with income from recurring transactions. Income budgets are deprecated.\n get incomeBudget(): number | undefined {\n const filteredBudgets = augmentBudgets(\n this.budgets.filter((budget: Budget) => !budget.parent_guid),\n this.globalStore.categoryStore.detailedCategories,\n this.globalStore.copyStore.copy.budgets,\n this.theme,\n )\n\n const incomeBudget = filteredBudgets.reduce(\n (acc, curr) => {\n if (curr.category_guid !== CategoryGuids.INCOME) return acc\n if (!acc || curr.percentage > acc.percentage) return curr\n return acc\n },\n undefined as DetailedBudget | undefined,\n )\n\n return incomeBudget?.amount\n }\n\n get unbudgetedCategories(): DetailedCategory[] {\n return this.globalStore.categoryStore.spendCategories.filter(\n (category) => !this.detailedBudgets.find((budget) => budget.category_guid === category.guid),\n )\n }\n\n get totalBudgeted(): number {\n return this.detailedBudgets.reduce((total, budget) => total + budget.amount, 0)\n }\n\n addBudget = async (category: Category, amount: number, parentGuid: string | null = null) => {\n try {\n const budget = await this.api.addBudget(category, amount, parentGuid)\n runInAction(() => {\n this.budgets = upsertByGuid(this.budgets, budget)\n })\n } catch (error) {\n console.error('Error adding budget:', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n }\n }\n\n deleteBudget = async (guid: string) => {\n try {\n await this.api.deleteBudget(guid)\n\n runInAction(() => {\n const index = this.budgets.findIndex((budget) => budget.guid === guid)\n if (index >= 0) {\n this.budgets.splice(index, 1)\n }\n })\n } catch (error) {\n console.error('Error deleting budget:', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n }\n }\n\n loadBudgets = async () => {\n try {\n const budgets = await this.api.getBudgets()\n this.setBudgets(budgets)\n } catch (error) {\n console.error('Error occurred while loading budgets:', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n throw error\n }\n }\n\n setAlert = (alert: string) => (this.alert = alert)\n\n setBudgets = (budgets: Budget[]) => {\n this.budgets = budgets\n this.isDataLoaded = true\n }\n\n setDateRange = (dateRange: DateRange) => (this.dateRange = dateRange)\n\n setSelectedBudget = (budget: DetailedBudget | undefined) => (this.selectedBudget = budget)\n\n setSelectedSubBudget = (budget: DetailedBudget | undefined) => (this.selectedSubBudget = budget)\n\n setTheme = (theme: Theme) => (this.theme = theme)\n\n /**\n * Recalculate budget by using the average amount from top-level categories\n * @param categories Detailed categories\n */\n recalculateBudgets = async (categories: DetailedCategory[]) => {\n try {\n for (const category of categories) {\n const budget = this.budgets.find((budget) => budget.category_guid === category.guid)\n if (budget) {\n await this.api.updateBudget({\n ...budget,\n amount: category.totalAverageAmount,\n })\n } else {\n await this.api.addBudget(category, category.totalAverageAmount)\n }\n }\n const budgetsToDelete = this.budgets.filter(\n (budget) => !categories.find((c) => c.guid === budget.category_guid),\n )\n\n for (const budgetToDelete of budgetsToDelete) {\n await this.api.deleteBudget(budgetToDelete.guid)\n }\n\n await this.loadBudgets()\n\n return { data: this.budgets, isSuccess: true }\n } catch (error) {\n console.error('Error recalculating budgets:', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n return { data: [], isSuccess: false }\n }\n }\n\n updateBudget = async (budget: Budget) => {\n try {\n const updatedBudget = await this.api.updateBudget(budget)\n\n runInAction(() => {\n const index = this.budgets.findIndex((b) => b.guid === budget.guid)\n if (index >= 0) {\n this.budgets[index] = updatedBudget\n }\n })\n } catch (error) {\n console.error('Error updating budget:', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n }\n }\n\n getMerchantBudgetByMerchantGuid = (merchantGuid: string): MerchantBudget | undefined => {\n return this.merchantBudgets.find(\n (eachMerchantBudget) => eachMerchantBudget?.merchant_guid === merchantGuid,\n )\n }\n\n setMerchantBudgets = (merchantBudgets: MerchantBudget[]) => {\n this.merchantBudgets = merchantBudgets\n }\n\n addMerchantBudget = async (merchantGuid: string, amount: number) => {\n try {\n const newMerchantBudget = await this.api.addMerchantBudget(merchantGuid, amount)\n\n runInAction(() => {\n this.merchantBudgets = upsertByGuid(this.merchantBudgets, newMerchantBudget)\n })\n return { isSuccess: true }\n } catch (error) {\n console.error('Error adding merchant budget:', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n return { isSuccess: false }\n }\n }\n\n updateMerchantBudget = async (merchantBudget: MerchantBudget) => {\n try {\n const { guid: merchantBudgetGuid, amount } = merchantBudget\n const updatedMerchantBudget = await this.api.updateMerchantBudget(merchantBudgetGuid, amount)\n\n runInAction(() => {\n const index = this.merchantBudgets.findIndex((b) => b.guid === merchantBudget.guid)\n if (index >= 0) {\n this.merchantBudgets[index] = updatedMerchantBudget\n }\n })\n return { isSuccess: true }\n } catch (error) {\n console.error('Error updating merchant budget:', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n return { isSuccess: false }\n }\n }\n\n deleteMerchantBudget = async (merchantBudgetGuid: string) => {\n try {\n await this.api.deleteMerchantBudget(merchantBudgetGuid)\n\n runInAction(() => {\n this.merchantBudgets = this.merchantBudgets.filter((b) => b.guid !== merchantBudgetGuid)\n })\n return { isSuccess: true }\n } catch (error) {\n console.error('Error deleting merchant budget:', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n return { isSuccess: false }\n }\n }\n}\n"],"mappings":";;;;;;;;AAwBA,IAAa,IAAb,MAA0B;AAAA,EACxB,MAAkB,IAAI,EAAW,KAAK,EAAE;AAAA,EAExC;AAAA,EAEA,QAAgB;AAAA,EAChB,YAAuB;AAAA,IAAE,OAAO,EAAa,EAAa,CAAC;AAAA,IAAG,KAAK,EAAW,EAAa,CAAC;AAAA,EAAE;AAAA,EAC9F,UAAoB,CAAC;AAAA,EACrB;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,QAAQ,CAAC;AAAA,EACT,kBAAoC,CAAC;AAAA,EAErC,YAAY,GAA0B;AACpC,SAAK,cAAc,GACnB,KAAK,MAAM,IAAI,EAAW,EAAY,UAAU,EAAY,cAAc,EAAY,OAAO,GAE7F,EAAmB,IAAI;AAAA,EACzB;AAAA,EAEA,iBAAiB,YAAY;AAC3B,IAAK,KAAK,YAAY,2BAA2B,gBAC/C,MAAM,KAAK,YAAY,2BAA2B,6BAA6B,GAEjF,MAAM,KAAK,YAAY,GAGvB,EAAA,MACQ,KAAK,iBAAA,CACV,MAAoB;AACnB,UAAI,GAAiB;AACnB,cAAM,IAAS,KAAK;AACpB,QAAI,MACF,KAAK,iBAAiB,EAAW,GAAiB,EAAO,IAAI;AAG/D,cAAM,IAAY,KAAK;AACvB,QAAI,KAAa,EAAU,gBACzB,KAAK,oBAAoB,EACvB,GACA,EAAU,MACV,EAAU,WACZ;AAAA,MAEJ;AAAA,IACF,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|
34
34
|
member_guid: string;
|
|
35
|
-
merchant_guid
|
|
35
|
+
merchant_guid?: string | null;
|
|
36
36
|
user_guid: string;
|
|
37
37
|
description: string;
|
|
38
38
|
amount: number;
|
|
@@ -53,7 +53,7 @@ export interface Recurrence {
|
|
|
53
53
|
frequency: Frequency;
|
|
54
54
|
institutionGuid: string;
|
|
55
55
|
institutionName: string;
|
|
56
|
-
merchantGuid
|
|
56
|
+
merchantGuid?: string | null;
|
|
57
57
|
name: string;
|
|
58
58
|
occurredOnDate?: Date;
|
|
59
59
|
recurrenceDay: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeatingTransaction.es.js","names":[],"sources":["../../../src/core/types/RepeatingTransaction.ts"],"sourcesContent":["import { Account } from './Account'\nimport { Transaction, TransactionType } from './Transaction'\n\nexport enum Frequency {\n Unknown = 0,\n EveryWeek = 1,\n EveryOtherWeek = 2,\n EveryMonth = 3,\n EveryOtherMonth = 4,\n EveryQuarter = 5,\n EveryOtherQuarter = 6,\n EveryYear = 7,\n TwiceAMonth = 8,\n}\n\nexport enum RecurrenceStatus {\n Paid = 0,\n Missed = 1,\n Upcoming = 2,\n}\n\nexport enum RecurrenceType {\n Expense = 0,\n Income = 1,\n}\n\nexport enum RepeatingType {\n Unknown = 0,\n Subscription = 1,\n Bill = 2,\n Income = 3,\n Transfer = 4,\n}\n\nexport interface RepeatingTransaction {\n // API fields\n guid: string\n account_guid: string\n created_by: number\n member_guid: string\n merchant_guid
|
|
1
|
+
{"version":3,"file":"RepeatingTransaction.es.js","names":[],"sources":["../../../src/core/types/RepeatingTransaction.ts"],"sourcesContent":["import { Account } from './Account'\nimport { Transaction, TransactionType } from './Transaction'\n\nexport enum Frequency {\n Unknown = 0,\n EveryWeek = 1,\n EveryOtherWeek = 2,\n EveryMonth = 3,\n EveryOtherMonth = 4,\n EveryQuarter = 5,\n EveryOtherQuarter = 6,\n EveryYear = 7,\n TwiceAMonth = 8,\n}\n\nexport enum RecurrenceStatus {\n Paid = 0,\n Missed = 1,\n Upcoming = 2,\n}\n\nexport enum RecurrenceType {\n Expense = 0,\n Income = 1,\n}\n\nexport enum RepeatingType {\n Unknown = 0,\n Subscription = 1,\n Bill = 2,\n Income = 3,\n Transfer = 4,\n}\n\nexport interface RepeatingTransaction {\n // API fields\n guid: string\n account_guid: string\n created_by: number\n member_guid: string\n merchant_guid?: string | null\n user_guid: string\n description: string\n amount: number\n predicted_occurs_on: string\n transaction_type: TransactionType\n recurrence_type: Frequency\n recurrence_day: number\n repeating_transaction_type: RepeatingType\n second_recurrence_day?: number\n\n // UI fields\n account?: Account\n transactions: Transaction[]\n}\n\nexport interface Recurrence {\n accountGuid: string\n amount: number\n categoryGuid: string\n expectedDate: Date\n frequency: Frequency\n institutionGuid: string\n institutionName: string\n merchantGuid?: string | null\n name: string\n occurredOnDate?: Date\n recurrenceDay: number\n repeatingTransactionGuid: string\n secondRecurrenceDay?: number\n status: RecurrenceStatus\n type: RecurrenceType\n transaction?: Transaction\n}\n"],"mappings":"AAGA,IAAY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,EAAA,UAAA,CAAA,IAAA,WACA,EAAA,EAAA,YAAA,CAAA,IAAA,aACA,EAAA,EAAA,iBAAA,CAAA,IAAA,kBACA,EAAA,EAAA,aAAA,CAAA,IAAA,cACA,EAAA,EAAA,kBAAA,CAAA,IAAA,mBACA,EAAA,EAAA,eAAA,CAAA,IAAA,gBACA,EAAA,EAAA,oBAAA,CAAA,IAAA,qBACA,EAAA,EAAA,YAAA,CAAA,IAAA,aACA,EAAA,EAAA,cAAA,CAAA,IAAA;AACF,GAAA,CAAA,CAAA,GAEY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,EAAA,OAAA,CAAA,IAAA,QACA,EAAA,EAAA,SAAA,CAAA,IAAA,UACA,EAAA,EAAA,WAAA,CAAA,IAAA;AACF,GAAA,CAAA,CAAA,GAEY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,EAAA,UAAA,CAAA,IAAA,WACA,EAAA,EAAA,SAAA,CAAA,IAAA;AACF,GAAA,CAAA,CAAA,GAEY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,EAAA,UAAA,CAAA,IAAA,WACA,EAAA,EAAA,eAAA,CAAA,IAAA,gBACA,EAAA,EAAA,OAAA,CAAA,IAAA,QACA,EAAA,EAAA,SAAA,CAAA,IAAA,UACA,EAAA,EAAA,WAAA,CAAA,IAAA;AACF,GAAA,CAAA,CAAA"}
|
|
@@ -40,7 +40,6 @@ export interface BudgetsCopy {
|
|
|
40
40
|
details_delete_button: string;
|
|
41
41
|
details_edit_button: string;
|
|
42
42
|
details_edit_title: string;
|
|
43
|
-
details_edit_title_subbudget: string;
|
|
44
43
|
details_subbudgets_tab: string;
|
|
45
44
|
details_title: string;
|
|
46
45
|
details_transaction_drawer: string;
|
|
@@ -59,7 +58,6 @@ export interface BudgetsCopy {
|
|
|
59
58
|
income_description: string;
|
|
60
59
|
income_title: string;
|
|
61
60
|
left_in_budgets: string;
|
|
62
|
-
monthly_total: string;
|
|
63
61
|
overspent_in_budgets: string;
|
|
64
62
|
overview_title: string;
|
|
65
63
|
percent_spent: string;
|
|
@@ -81,7 +79,6 @@ export interface BudgetsCopy {
|
|
|
81
79
|
status_on_track: string;
|
|
82
80
|
success_alert_delete_merchant_budget: string;
|
|
83
81
|
success_alert_edit_merchant_budget: string;
|
|
84
|
-
your_budget_summary: string;
|
|
85
82
|
zero_state_budget_list_text: string;
|
|
86
83
|
zero_state_description: string;
|
|
87
84
|
zero_state_generate_budgets_header: string;
|