@mx-cartographer/experiences 9.4.52-alpha.al0 → 9.4.53

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 CHANGED
@@ -1,9 +1,11 @@
1
+ ## [9.4.53] - 10-02-2026
2
+
3
+ - **FIXED** - Recalculated budget amounts now use the three-month spending average instead of varying by browser history MEW-4013
4
+ - **FIXED** - Recalculate budgets drawer now shows a loader, cannot close while saving, and stays open with an error if the save fails MEW-4013
5
+
1
6
  ## [9.4.52] - 10-02-2026
2
7
 
3
- - **FIXED** - Transaction Details date drawer now uses the MUI X date picker, styled by the MXUI theme MEW-4123
4
- - **CHANGED** - `Drawer` footer secondary buttons now use the text variant, and the default `secondaryColor` is `primary` MEW-4123
5
- - **CHANGED** - Deprecated the `Calendar` export from `./common` MEW-4123
6
- - **CHANGED** - Bumped `@mxenabled/mxui` to `^2.10.1` for date range picker contrast fixes MEW-4123
8
+ - **FIXED** - Storybook stories that crashed or rendered blank now load (MEW-4207)
7
9
 
8
10
  ## [9.4.51] - 10-01-2026
9
11
 
@@ -1,5 +1,7 @@
1
1
  interface RecalculateBudgetsProps {
2
2
  onRecalculateBudgets?: () => void;
3
3
  }
4
- export declare const RecalculateBudgets: ({ onRecalculateBudgets }: RecalculateBudgetsProps) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const RecalculateBudgets: (({ onRecalculateBudgets }: RecalculateBudgetsProps) => import("react/jsx-runtime").JSX.Element) & {
5
+ displayName: string;
6
+ };
5
7
  export {};
@@ -1,23 +1,37 @@
1
- import { useBudgetsStore as b, useCategoryStore as h, useGlobalCopyStore as x } from "../../../common/context/hooks.es.js";
2
- import y from "../../../common/components/drawer/Drawer.es.js";
3
- import { RecalculateBudgetRow as _ } from "./RecalculateBudgetRow.es.js";
4
- import i from "react";
5
- import n from "@mui/material/Stack";
6
- import { Text as a } from "@mxenabled/mxui";
7
- import C from "@mui/material/Button";
8
- import { jsx as e, jsxs as c } from "react/jsx-runtime";
9
- import v from "@mui/material/Box";
10
- import B from "@mui/material/List";
11
- var F = ({ onRecalculateBudgets: s }) => {
12
- const { budgets: t, common: m } = x(), { spendCategories: u } = h(), { recalculateBudgets: p, setAlert: d } = b(), [g, o] = i.useState(!1), l = u.filter((r) => r.totalAverageAmount > 0), f = async () => {
13
- await p(l), o(!1), d({
14
- msg: t.alert_recalculated_budgets,
15
- severity: "success"
16
- }), s?.();
1
+ import { useBudgetsStore as _, useCategoryStore as C, useGlobalCopyStore as S } from "../../../common/context/hooks.es.js";
2
+ import B from "../../../common/components/drawer/Drawer.es.js";
3
+ import { RecalculateBudgetRow as A } from "./RecalculateBudgetRow.es.js";
4
+ import o from "react";
5
+ import { observer as k } from "mobx-react-lite";
6
+ import p from "@mui/material/Stack";
7
+ import { Text as l } from "@mxenabled/mxui";
8
+ import w from "@mui/material/Button";
9
+ import { jsx as e, jsxs as i } from "react/jsx-runtime";
10
+ import R from "@mui/material/Box";
11
+ import I from "@mui/material/List";
12
+ import P from "@mui/material/Alert";
13
+ var J = k(({ onRecalculateBudgets: d }) => {
14
+ const { budgets: t, common: n } = S(), { spendCategories: f } = C(), { recalculateBudgets: g, setAlert: h } = _(), [x, s] = o.useState(!1), [c, m] = o.useState(!1), [y, a] = o.useState(!1), u = f.filter((r) => r.totalAverageAmount > 0), b = () => {
15
+ c || (s(!1), a(!1));
16
+ }, v = async () => {
17
+ m(!0), a(!1);
18
+ try {
19
+ const { isSuccess: r } = await g(u);
20
+ if (!r) {
21
+ a(!0);
22
+ return;
23
+ }
24
+ s(!1), h({
25
+ msg: t.alert_recalculated_budgets,
26
+ severity: "success"
27
+ }), d?.();
28
+ } finally {
29
+ m(!1);
30
+ }
17
31
  };
18
- return /* @__PURE__ */ c(i.Fragment, { children: [
19
- /* @__PURE__ */ e(C, {
20
- onClick: () => o(!0),
32
+ return /* @__PURE__ */ i(o.Fragment, { children: [
33
+ /* @__PURE__ */ e(w, {
34
+ onClick: () => s(!0),
21
35
  sx: {
22
36
  mt: 24,
23
37
  mx: 24
@@ -25,7 +39,7 @@ var F = ({ onRecalculateBudgets: s }) => {
25
39
  variant: "text",
26
40
  children: t.recalculate_button
27
41
  }),
28
- /* @__PURE__ */ e(a, {
42
+ /* @__PURE__ */ e(l, {
29
43
  sx: {
30
44
  mx: 24,
31
45
  my: 16,
@@ -35,33 +49,46 @@ var F = ({ onRecalculateBudgets: s }) => {
35
49
  component: "span",
36
50
  children: t.recalculate_help
37
51
  }),
38
- /* @__PURE__ */ e(y, {
39
- ariaLabelClose: m.close_aria,
40
- isOpen: g,
41
- onClose: () => o(!1),
42
- onPrimaryAction: f,
52
+ /* @__PURE__ */ e(B, {
53
+ ariaLabelClose: n.close_aria,
54
+ isOpen: x,
55
+ onClose: b,
56
+ onPrimaryAction: v,
57
+ primaryButtonProps: { loading: c },
43
58
  title: t.recalculate_title,
44
- children: /* @__PURE__ */ c(n, { children: [/* @__PURE__ */ c(n, {
45
- mx: 24,
46
- my: 16,
47
- children: [/* @__PURE__ */ e(a, {
48
- bold: !0,
49
- variant: "body1",
50
- children: t.recalculate_description_top
51
- }), /* @__PURE__ */ e(a, {
52
- component: "span",
53
- variant: "subtitle2",
54
- children: t.recalculate_description_bottom
55
- })]
56
- }), /* @__PURE__ */ e(v, {
57
- bgcolor: "background.paper",
58
- children: /* @__PURE__ */ e(B, { children: l.map((r) => /* @__PURE__ */ e(_, { category: r }, r.guid)) })
59
- })] })
59
+ children: /* @__PURE__ */ i(p, { children: [
60
+ y && /* @__PURE__ */ e(P, {
61
+ role: "alert",
62
+ severity: "error",
63
+ sx: {
64
+ mt: 16,
65
+ mx: 24
66
+ },
67
+ children: n.error_message
68
+ }),
69
+ /* @__PURE__ */ i(p, {
70
+ mx: 24,
71
+ my: 16,
72
+ children: [/* @__PURE__ */ e(l, {
73
+ bold: !0,
74
+ variant: "body1",
75
+ children: t.recalculate_description_top
76
+ }), /* @__PURE__ */ e(l, {
77
+ component: "span",
78
+ variant: "subtitle2",
79
+ children: t.recalculate_description_bottom
80
+ })]
81
+ }),
82
+ /* @__PURE__ */ e(R, {
83
+ bgcolor: "background.paper",
84
+ children: /* @__PURE__ */ e(I, { children: u.map((r) => /* @__PURE__ */ e(A, { category: r }, r.guid)) })
85
+ })
86
+ ] })
60
87
  })
61
88
  ] });
62
- };
89
+ });
63
90
  export {
64
- F as RecalculateBudgets
91
+ J as RecalculateBudgets
65
92
  };
66
93
 
67
94
  //# sourceMappingURL=RecalculateBudgets.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RecalculateBudgets.es.js","names":[],"sources":["../../../../src/budgets/components/addbudget/RecalculateBudgets.tsx"],"sourcesContent":["import React from 'react'\n\nimport Button from '@mui/material/Button'\nimport List from '@mui/material/List'\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { Drawer, useBudgetsStore, useCategoryStore, useGlobalCopyStore } from '../../../common'\n\nimport { RecalculateBudgetRow } from './RecalculateBudgetRow'\n\ninterface RecalculateBudgetsProps {\n onRecalculateBudgets?: () => void\n}\n\nexport const RecalculateBudgets = ({ onRecalculateBudgets }: RecalculateBudgetsProps) => {\n const { budgets: copy, common: commonCopy } = useGlobalCopyStore()\n const { spendCategories } = useCategoryStore()\n const { recalculateBudgets, setAlert } = useBudgetsStore()\n\n const [isOpen, setIsOpen] = React.useState(false)\n\n const newBudgetCategories = spendCategories.filter((category) => category.totalAverageAmount > 0)\n\n const handlePrimaryClick = async () => {\n await recalculateBudgets(newBudgetCategories)\n\n setIsOpen(false)\n setAlert({ msg: copy.alert_recalculated_budgets, severity: 'success' })\n onRecalculateBudgets?.()\n }\n\n return (\n <React.Fragment>\n <Button onClick={() => setIsOpen(true)} sx={{ mt: 24, mx: 24 }} variant=\"text\">\n {copy.recalculate_button}\n </Button>\n\n <Text sx={{ mx: 24, my: 16, textAlign: 'center' }} variant=\"subtitle1\" component=\"span\">\n {copy.recalculate_help}\n </Text>\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isOpen}\n onClose={() => setIsOpen(false)}\n onPrimaryAction={handlePrimaryClick}\n title={copy.recalculate_title}\n >\n <Stack>\n <Stack mx={24} my={16}>\n <Text bold={true} variant=\"body1\">\n {copy.recalculate_description_top}\n </Text>\n <Text component=\"span\" variant=\"subtitle2\">\n {copy.recalculate_description_bottom}\n </Text>\n </Stack>\n <Box bgcolor=\"background.paper\">\n <List>\n {newBudgetCategories.map((category) => (\n <RecalculateBudgetRow category={category} key={category.guid} />\n ))}\n </List>\n </Box>\n </Stack>\n </Drawer>\n </React.Fragment>\n )\n}\n"],"mappings":";;;;;;;;;;AAiBA,IAAa,IAAA,CAAsB,EAAE,sBAAA,EAAA,MAAoD;AACvF,QAAM,EAAE,SAAS,GAAM,QAAQ,EAAA,IAAe,EAAmB,GAC3D,EAAE,iBAAA,EAAA,IAAoB,EAAiB,GACvC,EAAE,oBAAA,GAAoB,UAAA,EAAA,IAAa,EAAgB,GAEnD,CAAC,GAAQ,CAAA,IAAa,EAAM,SAAS,EAAK,GAE1C,IAAsB,EAAgB,OAAA,CAAQ,MAAa,EAAS,qBAAqB,CAAC,GAE1F,IAAqB,YAAY;AACrC,UAAM,EAAmB,CAAmB,GAE5C,EAAU,EAAK,GACf,EAAS;AAAA,MAAE,KAAK,EAAK;AAAA,MAA4B,UAAU;AAAA,IAAU,CAAC,GACtE,IAAuB;AAAA,EACzB;AAEA,SACE,gBAAA,EAAC,EAAM,UAAP,EAAA,UAAA;AAAA,IACE,gBAAA,EAAC,GAAD;AAAA,MAAQ,SAAA,MAAe,EAAU,EAAI;AAAA,MAAG,IAAI;AAAA,QAAE,IAAI;AAAA,QAAI,IAAI;AAAA,MAAG;AAAA,MAAG,SAAQ;AAAA,MACrE,UAAA,EAAK;AAAA,IACA,CAAA;AAAA,IAER,gBAAA,EAAC,GAAD;AAAA,MAAM,IAAI;AAAA,QAAE,IAAI;AAAA,QAAI,IAAI;AAAA,QAAI,WAAW;AAAA,MAAS;AAAA,MAAG,SAAQ;AAAA,MAAY,WAAU;AAAA,MAC9E,UAAA,EAAK;AAAA,IACF,CAAA;AAAA,IACN,gBAAA,EAAC,GAAD;AAAA,MACE,gBAAgB,EAAW;AAAA,MACnB,QAAA;AAAA,MACR,SAAA,MAAe,EAAU,EAAK;AAAA,MAC9B,iBAAiB;AAAA,MACjB,OAAO,EAAK;AAAA,MAEZ,UAAA,gBAAA,EAAC,GAAD,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,QAAO,IAAI;AAAA,QAAI,IAAI;AAAA,QAAnB,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,UAAM,MAAM;AAAA,UAAM,SAAQ;AAAA,UACvB,UAAA,EAAK;AAAA,QACF,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,UAAM,WAAU;AAAA,UAAO,SAAQ;AAAA,UAC5B,UAAA,EAAK;AAAA,QACF,CAAA,CACD;AAAA,MACP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,QAAK,SAAQ;AAAA,QACX,UAAA,gBAAA,EAAC,GAAD,EAAA,UACG,EAAoB,IAAA,CAAK,MACxB,gBAAA,EAAC,GAAD,EAAgC,UAAA,EAA+B,GAAhB,EAAS,IAAO,CAChE,EACG,CAAA;AAAA,MACH,CAAA,CACA,EAAA,CAAA;AAAA,IACD,CAAA;AAAA,EACM,EAAA,CAAA;AAEpB"}
1
+ {"version":3,"file":"RecalculateBudgets.es.js","names":[],"sources":["../../../../src/budgets/components/addbudget/RecalculateBudgets.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Alert from '@mui/material/Alert'\nimport Button from '@mui/material/Button'\nimport List from '@mui/material/List'\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { Drawer, useBudgetsStore, useCategoryStore, useGlobalCopyStore } from '../../../common'\n\nimport { RecalculateBudgetRow } from './RecalculateBudgetRow'\n\ninterface RecalculateBudgetsProps {\n onRecalculateBudgets?: () => void\n}\n\nexport const RecalculateBudgets = observer(({ onRecalculateBudgets }: RecalculateBudgetsProps) => {\n const { budgets: copy, common: commonCopy } = useGlobalCopyStore()\n const { spendCategories } = useCategoryStore()\n const { recalculateBudgets, setAlert } = useBudgetsStore()\n\n const [isOpen, setIsOpen] = React.useState(false)\n const [isSaving, setIsSaving] = React.useState(false)\n const [isError, setIsError] = React.useState(false)\n\n const newBudgetCategories = spendCategories.filter((category) => category.totalAverageAmount > 0)\n\n const handleClose = () => {\n if (isSaving) return\n setIsOpen(false)\n setIsError(false)\n }\n\n const handlePrimaryClick = async () => {\n setIsSaving(true)\n setIsError(false)\n try {\n const { isSuccess } = await recalculateBudgets(newBudgetCategories)\n if (!isSuccess) {\n setIsError(true)\n return\n }\n setIsOpen(false)\n setAlert({ msg: copy.alert_recalculated_budgets, severity: 'success' })\n onRecalculateBudgets?.()\n } finally {\n setIsSaving(false)\n }\n }\n\n return (\n <React.Fragment>\n <Button onClick={() => setIsOpen(true)} sx={{ mt: 24, mx: 24 }} variant=\"text\">\n {copy.recalculate_button}\n </Button>\n\n <Text sx={{ mx: 24, my: 16, textAlign: 'center' }} variant=\"subtitle1\" component=\"span\">\n {copy.recalculate_help}\n </Text>\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isOpen}\n onClose={handleClose}\n onPrimaryAction={handlePrimaryClick}\n primaryButtonProps={{ loading: isSaving }}\n title={copy.recalculate_title}\n >\n <Stack>\n {isError && (\n <Alert role=\"alert\" severity=\"error\" sx={{ mt: 16, mx: 24 }}>\n {commonCopy.error_message}\n </Alert>\n )}\n <Stack mx={24} my={16}>\n <Text bold={true} variant=\"body1\">\n {copy.recalculate_description_top}\n </Text>\n <Text component=\"span\" variant=\"subtitle2\">\n {copy.recalculate_description_bottom}\n </Text>\n </Stack>\n <Box bgcolor=\"background.paper\">\n <List>\n {newBudgetCategories.map((category) => (\n <RecalculateBudgetRow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selectionType?: CalendarSelectionTypes;
21
21
  }
22
- /** @deprecated Use `DateCalendar` or `StaticDatePicker` from `@mui/x-date-pickers`. */
23
22
  declare const Calendar: React.FC<CalendarProps>;
24
23
  export default Calendar;
@@ -1 +1 @@
1
- {"version":3,"file":"Calendar.es.js","names":[],"sources":["../../../../src/common/components/calendar/Calendar.tsx"],"sourcesContent":["import React from 'react'\nimport { css } from '@mxenabled/cssinjs'\nimport { addDays } from 'date-fns/addDays'\nimport { addMonths } from 'date-fns/addMonths'\nimport { eachDayOfInterval } from 'date-fns/eachDayOfInterval'\nimport { eachWeekOfInterval } from 'date-fns/eachWeekOfInterval'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { format } from 'date-fns/format'\nimport { isBefore } from 'date-fns/isBefore'\nimport { isSameMonth } from 'date-fns/isSameMonth'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { startOfToday } from 'date-fns/startOfToday'\nimport { subMonths } from 'date-fns/subMonths'\n\nimport Button from '@mui/material/Button'\nimport Paper from '@mui/material/Paper'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport Header from './Header'\nimport Day from './Day'\n\nexport const CALENDAR_WIDTH = 340\nexport const DATE_SIZE = 44\nexport const enum CalendarSelectionTypes {\n None = 'None',\n Single = 'Single',\n Range = 'Range',\n}\n\nexport type CalendarCopy = {\n nextAria: string\n prevAria: string\n today: string\n}\n\nexport interface CalendarProps {\n copy: CalendarCopy\n beginDate?: Date\n endDate?: Date\n onDateSelected?: (date: Date) => void\n onRangeSelected?: (beginDate: Date, endDate: Date) => void\n selectionType?: CalendarSelectionTypes\n}\n\n/** @deprecated Use `DateCalendar` or `StaticDatePicker` from `@mui/x-date-pickers`. */\nconst Calendar: React.FC<CalendarProps> = ({\n copy,\n beginDate: beginDateProp = undefined,\n endDate: endDateProp = undefined,\n onDateSelected,\n onRangeSelected,\n selectionType = CalendarSelectionTypes.Single,\n}) => {\n const styles = getStyles()\n\n const [date, setDate] = React.useState(startOfToday)\n\n const [beginDate, setBeginDate] = React.useState<Date | undefined>(beginDateProp)\n const [endDate, setEndDate] = React.useState<Date | undefined>(endDateProp)\n\n React.useEffect(() => {\n setBeginDate(beginDateProp)\n setEndDate(endDateProp)\n if (beginDateProp) {\n setDate(beginDateProp)\n }\n }, [beginDateProp, endDateProp])\n\n const weeks = React.useMemo(() => {\n const weeksInInterval = eachWeekOfInterval({ start: startOfMonth(date), end: endOfMonth(date) })\n\n const weeks = [] as Date[][]\n for (let i = 0; i < weeksInInterval.length; i++) {\n const weekStart = weeksInInterval[i]\n const days = eachDayOfInterval({ start: weekStart, end: addDays(weekStart, 6) })\n\n const week = [] as Date[]\n for (let j = 0; j < days.length; j++) {\n week.push(days[j])\n }\n weeks.push(week)\n }\n\n return weeks\n }, [date])\n\n const handleSelection = (date: Date) => {\n if (selectionType === CalendarSelectionTypes.None) return\n\n if (selectionType === CalendarSelectionTypes.Single) {\n setBeginDate(date)\n onDateSelected?.(date)\n return\n }\n\n if (!beginDate || endDate) {\n setBeginDate(date)\n setEndDate(undefined)\n } else if (isBefore(date, beginDate)) {\n setEndDate(beginDate)\n setBeginDate(date)\n onRangeSelected?.(date, beginDate)\n } else {\n setEndDate(date)\n onRangeSelected?.(beginDate, date)\n }\n }\n\n const handleTodayClick = () => {\n const today = startOfToday()\n setDate(today)\n\n if (selectionType === CalendarSelectionTypes.None) return\n\n setBeginDate(today)\n\n if (selectionType === CalendarSelectionTypes.Single) {\n onDateSelected?.(today)\n } else {\n setEndDate(today)\n onRangeSelected?.(today, today)\n }\n }\n\n const handleNextMonthClick = () => {\n setDate(addMonths(date, 1))\n }\n\n const handlePreviousMonthClick = () => {\n setDate(subMonths(date, 1))\n }\n\n return (\n <div className={`mx-cmn-calendar ${styles}`}>\n <Paper sx={{ boxShadow: 'none' }}>\n <Header\n copy={copy}\n date={date}\n onNextClick={handleNextMonthClick}\n onPreviousClick={handlePreviousMonthClick}\n />\n\n <div className=\"mx-cmn-calendar-header-row\">\n {weeks[0].map((day, index) => (\n <div className=\"mx-cmn-calendar-header-cell\" key={index}>\n <Text bold={true} variant=\"body2\">\n {format(day, 'EEEEE')}\n </Text>\n </div>\n ))}\n </div>\n\n {weeks.map((week, index) => (\n <div className=\"mx-cmn-calendar-week\" key={`w-${index}`}>\n {week.map((day, index) => (\n <Day\n beginDate={beginDate}\n date={day}\n endDate={endDate}\n isInMonth={isSameMonth(day, date)}\n key={index}\n onClick={handleSelection}\n />\n ))}\n </div>\n ))}\n\n <div className=\"mx-cmn-calendar-today-container\">\n <Button onClick={handleTodayClick} size=\"small\" variant=\"text\">\n {copy.today}\n </Button>\n </div>\n </Paper>\n </div>\n )\n}\n\nconst getStyles = () =>\n css({\n width: CALENDAR_WIDTH,\n '& .MuiPaper-root': {\n paddingLeft: 24,\n paddingRight: 24,\n paddingTop: 4,\n paddingBottom: 4,\n },\n '& .mx-cmn-calendar-header-row': {\n display: 'flex',\n justifyContent: 'center',\n textAlign: 'center',\n '& .mx-cmn-calendar-header-cell': {\n height: DATE_SIZE,\n width: DATE_SIZE,\n minWidth: DATE_SIZE,\n '& .kmui-text': {\n alignItems: 'center',\n display: 'flex',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n },\n },\n },\n '& .mx-cmn-calendar-week': {\n display: 'flex',\n justifyContent: 'center',\n textAlign: 'center',\n },\n '& .mx-cmn-calendar-today-container': {\n display: 'block',\n marginTop: 16,\n textAlign: 'center',\n width: '100%',\n '& > .MuiButton-root': {\n display: 'inline-block',\n marginLeft: 'auto',\n marginRight: 'auto',\n },\n },\n })\n\nexport default Calendar\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwBA,IAAkB,KAAX,0BAAA,GAAA;AACL,SAAA,EAAA,OAAA,QACA,EAAA,SAAA,UACA,EAAA,QAAA;AACF,GAAA,CAAA,CAAA,GAkBM,KAAA,CAAqC,EACzC,MAAA,GACA,WAAW,IAAgB,QAC3B,SAAS,IAAc,QACvB,gBAAA,GACA,iBAAA,GACA,eAAA,IAAA,SAA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,QAED,gBAAA,EAAC,OAAD;AAAA,UAAK,WAAU;AAAA,UACb,UAAA,gBAAA,EAAC,GAAD;AAAA,YAAQ,SAAS;AAAA,YAAkB,MAAK;AAAA,YAAQ,SAAQ;AAAA,YACrD,UAAA,EAAK;AAAA,UACA,CAAA;AAAA,QACL,CAAA;AAAA,MACA;AAAA;EACJ,CAAA;AAET,GAEM,IAAA,MACJ,EAAI;AAAA,EACF,OAAA;AAAA,EACA,oBAAoB;AAAA,IAClB,aAAa;AAAA,IACb,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,eAAe;AAAA,EACjB;AAAA,EACA,iCAAiC;AAAA,IAC/B,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,kCAAkC;AAAA,MAChC,QAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MACA,gBAAgB;AAAA,QACd,YAAY;AAAA,QACZ,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,gBAAgB;AAAA,QAChB,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAAA,EACA,2BAA2B;AAAA,IACzB,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,WAAW;AAAA,EACb;AAAA,EACA,sCAAsC;AAAA,IACpC,SAAS;AAAA,IACT,WAAW;AAAA,IACX,WAAW;AAAA,IACX,OAAO;AAAA,IACP,uBAAuB;AAAA,MACrB,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,aAAa;AAAA,IACf;AAAA,EACF;AACF,CAAC"}
1
+ {"version":3,"file":"Calendar.es.js","names":[],"sources":["../../../../src/common/components/calendar/Calendar.tsx"],"sourcesContent":["import React from 'react'\nimport { css } from '@mxenabled/cssinjs'\nimport { addDays } from 'date-fns/addDays'\nimport { addMonths } from 'date-fns/addMonths'\nimport { eachDayOfInterval } from 'date-fns/eachDayOfInterval'\nimport { eachWeekOfInterval } from 'date-fns/eachWeekOfInterval'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { format } from 'date-fns/format'\nimport { isBefore } from 'date-fns/isBefore'\nimport { isSameMonth } from 'date-fns/isSameMonth'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { startOfToday } from 'date-fns/startOfToday'\nimport { subMonths } from 'date-fns/subMonths'\n\nimport Button from '@mui/material/Button'\nimport Paper from '@mui/material/Paper'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport Header from './Header'\nimport Day from './Day'\n\nexport const CALENDAR_WIDTH = 340\nexport const DATE_SIZE = 44\nexport const enum CalendarSelectionTypes {\n None = 'None',\n Single = 'Single',\n Range = 'Range',\n}\n\nexport type CalendarCopy = {\n nextAria: string\n prevAria: string\n today: string\n}\n\nexport interface CalendarProps {\n copy: CalendarCopy\n beginDate?: Date\n endDate?: Date\n onDateSelected?: (date: Date) => void\n onRangeSelected?: (beginDate: Date, endDate: Date) => void\n selectionType?: CalendarSelectionTypes\n}\n\nconst Calendar: React.FC<CalendarProps> = ({\n copy,\n beginDate: beginDateProp = undefined,\n endDate: endDateProp = undefined,\n onDateSelected,\n onRangeSelected,\n selectionType = CalendarSelectionTypes.Single,\n}) => {\n const styles = getStyles()\n\n const [date, setDate] = React.useState(startOfToday)\n\n const [beginDate, setBeginDate] = React.useState<Date | undefined>(beginDateProp)\n const [endDate, setEndDate] = React.useState<Date | undefined>(endDateProp)\n\n React.useEffect(() => {\n setBeginDate(beginDateProp)\n setEndDate(endDateProp)\n if (beginDateProp) {\n setDate(beginDateProp)\n }\n }, [beginDateProp, endDateProp])\n\n const weeks = React.useMemo(() => {\n const weeksInInterval = eachWeekOfInterval({ start: startOfMonth(date), end: endOfMonth(date) })\n\n const weeks = [] as Date[][]\n for (let i = 0; i < weeksInInterval.length; i++) {\n const weekStart = weeksInInterval[i]\n const days = eachDayOfInterval({ start: weekStart, end: addDays(weekStart, 6) })\n\n const week = [] as Date[]\n for (let j = 0; j < days.length; j++) {\n week.push(days[j])\n }\n weeks.push(week)\n }\n\n return weeks\n }, [date])\n\n const handleSelection = (date: Date) => {\n if (selectionType === CalendarSelectionTypes.None) return\n\n if (selectionType === CalendarSelectionTypes.Single) {\n setBeginDate(date)\n onDateSelected?.(date)\n return\n }\n\n if (!beginDate || endDate) {\n setBeginDate(date)\n setEndDate(undefined)\n } else if (isBefore(date, beginDate)) {\n setEndDate(beginDate)\n setBeginDate(date)\n onRangeSelected?.(date, beginDate)\n } else {\n setEndDate(date)\n onRangeSelected?.(beginDate, date)\n }\n }\n\n const handleTodayClick = () => {\n const today = startOfToday()\n setDate(today)\n\n if (selectionType === CalendarSelectionTypes.None) return\n\n setBeginDate(today)\n\n if (selectionType === CalendarSelectionTypes.Single) {\n onDateSelected?.(today)\n } else {\n setEndDate(today)\n onRangeSelected?.(today, today)\n }\n }\n\n const handleNextMonthClick = () => {\n setDate(addMonths(date, 1))\n }\n\n const handlePreviousMonthClick = () => {\n setDate(subMonths(date, 1))\n }\n\n return (\n <div className={`mx-cmn-calendar ${styles}`}>\n <Paper sx={{ boxShadow: 'none' }}>\n <Header\n copy={copy}\n date={date}\n onNextClick={handleNextMonthClick}\n onPreviousClick={handlePreviousMonthClick}\n />\n\n <div className=\"mx-cmn-calendar-header-row\">\n {weeks[0].map((day, index) => (\n <div className=\"mx-cmn-calendar-header-cell\" key={index}>\n <Text bold={true} variant=\"body2\">\n {format(day, 'EEEEE')}\n </Text>\n </div>\n ))}\n </div>\n\n {weeks.map((week, index) => (\n <div className=\"mx-cmn-calendar-week\" key={`w-${index}`}>\n {week.map((day, index) => (\n <Day\n beginDate={beginDate}\n date={day}\n endDate={endDate}\n isInMonth={isSameMonth(day, date)}\n key={index}\n onClick={handleSelection}\n />\n ))}\n </div>\n ))}\n\n <div className=\"mx-cmn-calendar-today-container\">\n <Button onClick={handleTodayClick} size=\"small\" variant=\"text\">\n {copy.today}\n </Button>\n </div>\n </Paper>\n </div>\n )\n}\n\nconst getStyles = () =>\n css({\n width: CALENDAR_WIDTH,\n '& .MuiPaper-root': {\n paddingLeft: 24,\n paddingRight: 24,\n paddingTop: 4,\n paddingBottom: 4,\n },\n '& .mx-cmn-calendar-header-row': {\n display: 'flex',\n justifyContent: 'center',\n textAlign: 'center',\n '& .mx-cmn-calendar-header-cell': {\n height: DATE_SIZE,\n width: DATE_SIZE,\n minWidth: DATE_SIZE,\n '& .kmui-text': {\n alignItems: 'center',\n display: 'flex',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n },\n },\n },\n '& .mx-cmn-calendar-week': {\n display: 'flex',\n justifyContent: 'center',\n textAlign: 'center',\n },\n '& .mx-cmn-calendar-today-container': {\n display: 'block',\n marginTop: 16,\n textAlign: 'center',\n width: '100%',\n '& > .MuiButton-root': {\n display: 'inline-block',\n marginLeft: 'auto',\n marginRight: 'auto',\n },\n },\n })\n\nexport default Calendar\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwBA,IAAkB,KAAX,0BAAA,GAAA;AACL,SAAA,EAAA,OAAA,QACA,EAAA,SAAA,UACA,EAAA,QAAA;AACF,GAAA,CAAA,CAAA,GAiBM,KAAA,CAAqC,EACzC,MAAA,GACA,WAAW,IAAgB,QAC3B,SAAS,IAAc,QACvB,gBAAA,GACA,iBAAA,GACA,eAAA,IAAA,SAAA,MACI;AACJ,QAAM,IAAS,EAAU,GAEnB,CAAC,GAAM,CAAA,IAAW,EAAM,SAAS,CAAY,GAE7C,CAAC,GAAW,CAAA,IAAgB,EAAM,SAA2B,CAAa,GAC1E,CAAC,GAAS,CAAA,IAAc,EAAM,SAA2B,CAAW;AAE1E,EAAA,EAAM,UAAA,MAAgB;AACpB,IAAA,EAAa,CAAa,GAC1B,EAAW,CAAW,GAClB,KACF,EAAQ,CAAa;AAAA,EAEzB,GAAG,CAAC,GAAe,CAAW,CAAC;AAE/B,QAAM,IAAQ,EAAM,QAAA,MAAc;AAChC,UAAM,IAAkB,EAAmB;AAAA,MAAE,OAAO,EAAa,CAAI;AAAA,MAAG,KAAK,EAAW,CAAI;AAAA,IAAE,CAAC,GAEzF,IAAQ,CAAC;AACf,aA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AAA;AAAA,MACA,UAAA;AAAA,MACA,gBAAgB;AAAA,QACd,YAAY;AAAA,QACZ,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,gBAAgB;AAAA,QAChB,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAAA,EACA,2BAA2B;AAAA,IACzB,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,WAAW;AAAA,EACb;AAAA,EACA,sCAAsC;AAAA,IACpC,SAAS;AAAA,IACT,WAAW;AAAA,IACX,WAAW;AAAA,IACX,OAAO;AAAA,IACP,uBAAuB;AAAA,MACrB,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,aAAa;AAAA,IACf;AAAA,EACF;AACF,CAAC"}
@@ -6,7 +6,7 @@ import j from "@mui/material/Stack";
6
6
  import { Drawer as C } from "@mxenabled/mxui";
7
7
  import { jsx as r, jsxs as v } from "react/jsx-runtime";
8
8
  import B from "@mui/material/Box";
9
- var G = ({ ariaLabelClose: i = "Close", children: s, footerStyles: u = {}, hasSecondaryAction: d = !0, id: p, isOpen: e, isPrimaryDisabled: m, onClose: o, onPrimaryAction: t, onSecondaryAction: l, primaryButtonProps: c, primaryColor: f = "primary", primaryText: h, secondaryColor: n = "primary", secondaryText: b, shouldShowHeaderBorders: w = !0, shouldShowHeaderShadow: g = !1, title: a, ...x }) => {
9
+ var G = ({ ariaLabelClose: s = "Close", children: u, footerStyles: d = {}, hasSecondaryAction: i = !0, id: p, isOpen: e, isPrimaryDisabled: c, onClose: o, onPrimaryAction: t, onSecondaryAction: l, primaryButtonProps: m, primaryColor: f = "primary", primaryText: n, secondaryColor: h = "secondary", secondaryText: b, shouldShowHeaderBorders: w = !0, shouldShowHeaderShadow: g = !1, title: a, ...x }) => {
10
10
  const { onExited: k, onFocus: R, rootRef: S } = y(e);
11
11
  return /* @__PURE__ */ r(C, {
12
12
  id: p,
@@ -33,7 +33,7 @@ var G = ({ ariaLabelClose: i = "Close", children: s, footerStyles: u = {}, hasSe
33
33
  justifyContent: "space-between",
34
34
  children: [
35
35
  /* @__PURE__ */ r(F, {
36
- ariaLabelClose: i,
36
+ ariaLabelClose: s,
37
37
  onClose: o,
38
38
  shouldShowBorders: w,
39
39
  shouldShowShadow: g,
@@ -42,18 +42,18 @@ var G = ({ ariaLabelClose: i = "Close", children: s, footerStyles: u = {}, hasSe
42
42
  /* @__PURE__ */ r(B, {
43
43
  height: "100%",
44
44
  overflow: "auto",
45
- children: s
45
+ children: u
46
46
  }),
47
47
  t && /* @__PURE__ */ r(D, {
48
- footerStyles: u,
49
- hasSecondaryAction: d,
50
- isPrimaryDisabled: m,
48
+ footerStyles: d,
49
+ hasSecondaryAction: i,
50
+ isPrimaryDisabled: c,
51
51
  onPrimaryAction: t,
52
52
  onSecondaryAction: l ?? o,
53
- primaryButtonProps: c,
53
+ primaryButtonProps: m,
54
54
  primaryColor: f,
55
- primaryText: h,
56
- secondaryColor: n,
55
+ primaryText: n,
56
+ secondaryColor: h,
57
57
  secondaryText: b
58
58
  })
59
59
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.es.js","names":[],"sources":["../../../../src/common/components/drawer/Drawer.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Drawer as KMuiDrawer } from '@mxenabled/mxui'\n\nimport { useFocusReturn } from '../../hooks/useFocusReturn'\n\nimport Footer from './Footer'\nimport Header from './Header'\n\nexport type CopyObject = {\n close_drawer_aria: string\n}\n\ninterface DrawerProps {\n ariaLabelClose?: string\n className?: string\n footerStyles?: SxProps\n hasSecondaryAction?: boolean\n id?: string\n isOpen: boolean\n isPrimaryDisabled?: boolean\n onClose: () => void\n onPrimaryAction?: () => void\n onSecondaryAction?: () => void\n primaryButtonProps?: React.ComponentProps<typeof Button>\n primaryColor?: 'primary' | 'inherit' | 'secondary' | 'success' | 'error' | 'info' | 'warning'\n primaryText?: string\n secondaryColor?: 'primary' | 'inherit' | 'secondary' | 'success' | 'error' | 'info' | 'warning'\n secondaryText?: string\n shouldShowHeaderBorders?: boolean\n shouldShowHeaderShadow?: boolean\n sx?: SxProps\n title: string\n}\n\nconst Drawer: React.FC<React.PropsWithChildren<DrawerProps>> = ({\n ariaLabelClose = 'Close',\n children,\n footerStyles = {},\n hasSecondaryAction = true,\n id,\n isOpen,\n isPrimaryDisabled,\n onClose,\n onPrimaryAction,\n onSecondaryAction,\n primaryButtonProps,\n primaryColor = 'primary',\n primaryText,\n secondaryColor = 'primary',\n secondaryText,\n shouldShowHeaderBorders = true,\n shouldShowHeaderShadow = false,\n title,\n ...rest\n}) => {\n const { onExited, onFocus, rootRef } = useFocusReturn(isOpen)\n\n return (\n <KMuiDrawer\n id={id}\n isOpen={isOpen}\n onClose={onClose}\n sx={{\n '& .MuiDrawer-paper': {\n backgroundColor: 'background.default',\n borderRadius: 0,\n },\n height: '100%',\n '& .MuiToolbar-root': {\n backgroundColor: 'background.paper',\n },\n }}\n {...rest}\n disableRestoreFocus={true}\n onFocus={onFocus}\n ref={rootRef}\n slotProps={{\n paper: {\n 'aria-labelledby': `${title?.replace(/\\s+/g, '-').toLowerCase()}-header-title`,\n },\n transition: { onExited },\n }}\n >\n <Stack height=\"100%\" justifyContent=\"space-between\">\n <Header\n ariaLabelClose={ariaLabelClose}\n onClose={onClose}\n shouldShowBorders={shouldShowHeaderBorders}\n shouldShowShadow={shouldShowHeaderShadow}\n title={title}\n />\n\n <Box height=\"100%\" overflow=\"auto\">\n {children}\n </Box>\n\n {onPrimaryAction && (\n <Footer\n footerStyles={footerStyles}\n hasSecondaryAction={hasSecondaryAction}\n isPrimaryDisabled={isPrimaryDisabled}\n onPrimaryAction={onPrimaryAction}\n onSecondaryAction={onSecondaryAction ?? onClose}\n primaryButtonProps={primaryButtonProps}\n primaryColor={primaryColor}\n primaryText={primaryText}\n secondaryColor={secondaryColor}\n secondaryText={secondaryText}\n />\n )}\n </Stack>\n </K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AAA;AAAA,QAEJ,KACC,gBAAA,EAAC,GAAD;AAAA,UACgB,cAAA;AAAA,UACM,oBAAA;AAAA,UACD,mBAAA;AAAA,UACF,iBAAA;AAAA,UACjB,mBAAmB,KAAqB;AAAA,UACpB,oBAAA;AAAA,UACN,cAAA;AAAA,UACD,aAAA;AAAA,UACG,gBAAA;AAAA,UACD,eAAA;AAAA,QAChB,CAAA;AAAA,MAEE;AAAA;EACG,CAAA;AAEhB"}
1
+ {"version":3,"file":"Drawer.es.js","names":[],"sources":["../../../../src/common/components/drawer/Drawer.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Drawer as KMuiDrawer } from '@mxenabled/mxui'\n\nimport { useFocusReturn } from '../../hooks/useFocusReturn'\n\nimport Footer from './Footer'\nimport Header from './Header'\n\nexport type CopyObject = {\n close_drawer_aria: string\n}\n\ninterface DrawerProps {\n ariaLabelClose?: string\n className?: string\n footerStyles?: SxProps\n hasSecondaryAction?: boolean\n id?: string\n isOpen: boolean\n isPrimaryDisabled?: boolean\n onClose: () => void\n onPrimaryAction?: () => void\n onSecondaryAction?: () => void\n primaryButtonProps?: React.ComponentProps<typeof Button>\n primaryColor?: 'primary' | 'inherit' | 'secondary' | 'success' | 'error' | 'info' | 'warning'\n primaryText?: string\n secondaryColor?: 'primary' | 'inherit' | 'secondary' | 'success' | 'error' | 'info' | 'warning'\n secondaryText?: string\n shouldShowHeaderBorders?: boolean\n shouldShowHeaderShadow?: boolean\n sx?: SxProps\n title: string\n}\n\nconst Drawer: React.FC<React.PropsWithChildren<DrawerProps>> = ({\n ariaLabelClose = 'Close',\n children,\n footerStyles = {},\n hasSecondaryAction = true,\n id,\n isOpen,\n isPrimaryDisabled,\n onClose,\n onPrimaryAction,\n onSecondaryAction,\n primaryButtonProps,\n primaryColor = 'primary',\n primaryText,\n secondaryColor = 'secondary',\n secondaryText,\n shouldShowHeaderBorders = true,\n shouldShowHeaderShadow = false,\n title,\n ...rest\n}) => {\n const { onExited, onFocus, rootRef } = useFocusReturn(isOpen)\n\n return (\n <KMuiDrawer\n id={id}\n isOpen={isOpen}\n onClose={onClose}\n sx={{\n '& .MuiDrawer-paper': {\n backgroundColor: 'background.default',\n borderRadius: 0,\n },\n height: '100%',\n '& .MuiToolbar-root': {\n backgroundColor: 'background.paper',\n },\n }}\n {...rest}\n disableRestoreFocus={true}\n onFocus={onFocus}\n ref={rootRef}\n slotProps={{\n paper: {\n 'aria-labelledby': `${title?.replace(/\\s+/g, '-').toLowerCase()}-header-title`,\n },\n transition: { onExited },\n }}\n >\n <Stack height=\"100%\" justifyContent=\"space-between\">\n <Header\n ariaLabelClose={ariaLabelClose}\n onClose={onClose}\n shouldShowBorders={shouldShowHeaderBorders}\n shouldShowShadow={shouldShowHeaderShadow}\n title={title}\n />\n\n <Box height=\"100%\" overflow=\"auto\">\n {children}\n </Box>\n\n {onPrimaryAction && (\n <Footer\n footerStyles={footerStyles}\n hasSecondaryAction={hasSecondaryAction}\n isPrimaryDisabled={isPrimaryDisabled}\n onPrimaryAction={onPrimaryAction}\n onSecondaryAction={onSecondaryAction ?? onClose}\n primaryButtonProps={primaryButtonProps}\n primaryColor={primaryColor}\n primaryText={primaryText}\n secondaryColor={secondaryColor}\n secondaryText={secondaryText}\n />\n )}\n </Stack>\n </KMuiDrawer>\n )\n}\n\nexport default Drawer\n"],"mappings":";;;;;;;;AAwCA,IAAM,IAAA,CAA0D,EAC9D,gBAAA,IAAiB,SACjB,UAAA,GACA,cAAA,IAAe,CAAC,GAChB,oBAAA,IAAqB,IACrB,IAAA,GACA,QAAA,GACA,mBAAA,GACA,SAAA,GACA,iBAAA,GACA,mBAAA,GACA,oBAAA,GACA,cAAA,IAAe,WACf,aAAA,GACA,gBAAA,IAAiB,aACjB,eAAA,GACA,yBAAA,IAA0B,IAC1B,wBAAA,IAAyB,IACzB,OAAA,GACA,G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import { jsx as o, jsxs as x } from "react/jsx-runtime";
4
- var v = ({ footerStyles: t = {}, hasSecondaryAction: a = !0, isPrimaryDisabled: n, onPrimaryAction: r, onSecondaryAction: i, primaryButtonProps: l = {}, primaryColor: c = "primary", primaryText: d = "Save", secondaryColor: p = "primary", secondaryText: f = "Cancel" }) => /* @__PURE__ */ x(s, {
2
+ import o from "@mui/material/Button";
3
+ import { jsx as e, jsxs as u } from "react/jsx-runtime";
4
+ var v = ({ footerStyles: t = {}, hasSecondaryAction: a = !0, isPrimaryDisabled: n, onPrimaryAction: r, onSecondaryAction: i, primaryButtonProps: l = {}, primaryColor: c = "primary", primaryText: d = "Save", secondaryColor: p = "primary", secondaryText: f = "Cancel" }) => /* @__PURE__ */ u(s, {
5
5
  sx: {
6
6
  bgcolor: "background.paper",
7
7
  flexDirection: "row",
@@ -10,12 +10,12 @@ var v = ({ footerStyles: t = {}, hasSecondaryAction: a = !0, isPrimaryDisabled:
10
10
  p: 24,
11
11
  ...t
12
12
  },
13
- children: [a && /* @__PURE__ */ o(e, {
13
+ children: [a && /* @__PURE__ */ e(o, {
14
14
  color: p,
15
15
  onClick: i,
16
- variant: r ? "text" : "contained",
16
+ variant: r ? "outlined" : "contained",
17
17
  children: f
18
- }), r && /* @__PURE__ */ o(e, {
18
+ }), r && /* @__PURE__ */ e(o, {
19
19
  ...l,
20
20
  color: c,
21
21
  disabled: n,
@@ -1 +1 @@
1
- {"version":3,"file":"Footer.es.js","names":[],"sources":["../../../../src/common/components/drawer/Footer.tsx"],"sourcesContent":["import Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport { type SxProps } from '@mui/material/styles'\n\ntype Color = 'primary' | 'inherit' | 'secondary' | 'success' | 'error' | 'info' | 'warning'\n\ntype FooterProps = {\n footerStyles?: SxProps\n hasSecondaryAction?: boolean\n isPrimaryDisabled?: boolean\n onPrimaryAction?: () => void\n onSecondaryAction?: () => void\n primaryButtonProps?: React.ComponentProps<typeof Button>\n primaryColor?: Color\n primaryText?: string\n secondaryColor?: Color\n secondaryText?: string\n}\n\nconst Footer = ({\n footerStyles = {},\n hasSecondaryAction = true,\n isPrimaryDisabled,\n onPrimaryAction,\n onSecondaryAction,\n primaryButtonProps = {},\n primaryColor = 'primary',\n primaryText = 'Save',\n secondaryColor = 'primary',\n secondaryText = 'Cancel',\n}: FooterProps) => {\n return (\n <Stack\n sx={{\n bgcolor: 'background.paper',\n flexDirection: 'row',\n gap: 16,\n justifyContent: 'flex-end',\n p: 24,\n ...footerStyles,\n }}\n >\n {hasSecondaryAction && (\n <Button\n color={secondaryColor}\n onClick={onSecondaryAction}\n variant={onPrimaryAction ? 'text' : 'contained'}\n >\n {secondaryText}\n </Button>\n )}\n\n {onPrimaryAction && (\n <Button\n {...primaryButtonProps}\n color={primaryColor}\n disabled={isPrimaryDisabled}\n onClick={onPrimaryAction}\n variant=\"contained\"\n >\n {primaryText}\n </Button>\n )}\n </Stack>\n )\n}\n\nexport default Footer\n"],"mappings":";;;AAmBA,IAAM,IAAA,CAAU,EACd,cAAA,IAAe,CAAC,GAChB,oBAAA,IAAqB,IACrB,mBAAA,GACA,iBAAA,GACA,mBAAA,GACA,oBAAA,IAAqB,CAAC,GACtB,cAAA,IAAe,WACf,aAAA,IAAc,QACd,gBAAA,IAAiB,WACjB,eAAA,IAAgB,SAAA,MAGd,gBAAA,EAAC,GAAD;AAAA,EACE,IAAI;AAAA,IACF,SAAS;AAAA,IACT,eAAe;AAAA,IACf,KAAK;AAAA,IACL,gBAAgB;AAAA,IAChB,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAAA,EARF,UAAA,CAUG,KACC,gBAAA,EAAC,GAAD;AAAA,IACE,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS,IAAkB,SAAS;AAAA,IAEnC,UAAA;AAAA,EACK,CAAA,GAGT,KACC,gBAAA,EAAC,GAAD;AAAA,IACE,GAAI;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAAS;AAAA,IACT,SAAQ;AAAA,IAEP,UAAA;AAAA,EACK,CAAA,CAEL"}
1
+ {"version":3,"file":"Footer.es.js","names":[],"sources":["../../../../src/common/components/drawer/Footer.tsx"],"sourcesContent":["import Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport { type SxProps } from '@mui/material/styles'\n\ntype Color = 'primary' | 'inherit' | 'secondary' | 'success' | 'error' | 'info' | 'warning'\n\ntype FooterProps = {\n footerStyles?: SxProps\n hasSecondaryAction?: boolean\n isPrimaryDisabled?: boolean\n onPrimaryAction?: () => void\n onSecondaryAction?: () => void\n primaryButtonProps?: React.ComponentProps<typeof Button>\n primaryColor?: Color\n primaryText?: string\n secondaryColor?: Color\n secondaryText?: string\n}\n\nconst Footer = ({\n footerStyles = {},\n hasSecondaryAction = true,\n isPrimaryDisabled,\n onPrimaryAction,\n onSecondaryAction,\n primaryButtonProps = {},\n primaryColor = 'primary',\n primaryText = 'Save',\n secondaryColor = 'primary',\n secondaryText = 'Cancel',\n}: FooterProps) => {\n return (\n <Stack\n sx={{\n bgcolor: 'background.paper',\n flexDirection: 'row',\n gap: 16,\n justifyContent: 'flex-end',\n p: 24,\n ...footerStyles,\n }}\n >\n {hasSecondaryAction && (\n <Button\n color={secondaryColor}\n onClick={onSecondaryAction}\n variant={onPrimaryAction ? 'outlined' : 'contained'}\n >\n {secondaryText}\n </Button>\n )}\n\n {onPrimaryAction && (\n <Button\n {...primaryButtonProps}\n color={primaryColor}\n disabled={isPrimaryDisabled}\n onClick={onPrimaryAction}\n variant=\"contained\"\n >\n {primaryText}\n </Button>\n )}\n </Stack>\n )\n}\n\nexport default Footer\n"],"mappings":";;;AAmBA,IAAM,IAAA,CAAU,EACd,cAAA,IAAe,CAAC,GAChB,oBAAA,IAAqB,IACrB,mBAAA,GACA,iBAAA,GACA,mBAAA,GACA,oBAAA,IAAqB,CAAC,GACtB,cAAA,IAAe,WACf,aAAA,IAAc,QACd,gBAAA,IAAiB,WACjB,eAAA,IAAgB,SAAA,MAGd,gBAAA,EAAC,GAAD;AAAA,EACE,IAAI;AAAA,IACF,SAAS;AAAA,IACT,eAAe;AAAA,IACf,KAAK;AAAA,IACL,gBAAgB;AAAA,IAChB,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAAA,EARF,UAAA,CAUG,KACC,gBAAA,EAAC,GAAD;AAAA,IACE,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS,IAAkB,aAAa;AAAA,IAEvC,UAAA;AAAA,EACK,CAAA,GAGT,KACC,gBAAA,EAAC,GAAD;AAAA,IACE,GAAI;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAAS;AAAA,IACT,SAAQ;AAAA,IAEP,UAAA;AAAA,EACK,CAAA,CAEL"}
@@ -1,18 +1,18 @@
1
1
  import { CategoryGuids as o } from "../constants/Category.es.js";
2
2
  import { BudgetsApi as g } from "../api/BudgetsApi.es.js";
3
3
  import { upsertByGuid as n } from "../utils/upsertByGuid.es.js";
4
- import { augmentBudgets as c, findBudget as h, findSubBudget as p } from "../utils/BudgetUtil.es.js";
4
+ import { augmentBudgets as c, findBudget as l, findSubBudget as p } from "../utils/BudgetUtil.es.js";
5
5
  import { endOfMonth as B } from "date-fns/endOfMonth";
6
6
  import { startOfMonth as f } from "date-fns/startOfMonth";
7
- import { startOfToday as l } from "date-fns/startOfToday";
7
+ import { startOfToday as h } from "date-fns/startOfToday";
8
8
  import { makeAutoObservable as S, reaction as b, runInAction as i } from "mobx";
9
9
  var A = class {
10
10
  api = new g("/", "");
11
11
  globalStore;
12
12
  alert = null;
13
13
  dateRange = {
14
- start: f(l()),
15
- end: B(l())
14
+ start: f(h()),
15
+ end: B(h())
16
16
  };
17
17
  budgets = [];
18
18
  selectedBudget;
@@ -27,7 +27,7 @@ var A = class {
27
27
  this.globalStore.recurringTransactionsStore.isDataLoaded || await this.globalStore.recurringTransactionsStore.loadRepeatingTransactionData(), await this.loadBudgets(), b(() => this.detailedBudgets, (t) => {
28
28
  if (t) {
29
29
  const e = this.selectedBudget;
30
- e && (this.selectedBudget = h(t, e.guid));
30
+ e && (this.selectedBudget = l(t, e.guid));
31
31
  const r = this.selectedSubBudget;
32
32
  r && r.parent_guid && (this.selectedSubBudget = p(t, r.guid, r.parent_guid));
33
33
  }
@@ -99,7 +99,8 @@ var A = class {
99
99
  isSuccess: !0
100
100
  };
101
101
  } catch (e) {
102
- return console.error("Error recalculating budgets:", e), this.globalStore.captureException(e, { store: "BudgetsStore" }), {
102
+ return console.error("Error recalculating budgets:", e), this.globalStore.captureException(e, { store: "BudgetsStore" }), await this.loadBudgets().catch(() => {
103
+ }), {
103
104
  data: [],
104
105
  isSuccess: !1
105
106
  };
@@ -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: { msg: string; severity: 'success' | 'error' } | null = null\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): Promise<boolean> => {\n const guids = [guid, ...this.budgets.filter((b) => b.parent_guid === guid).map((b) => b.guid)]\n const results = await Promise.allSettled(guids.map((g) => this.api.deleteBudget(g)))\n const deleted = new Set(guids.filter((_, i) => results[i].status === 'fulfilled'))\n runInAction(() => {\n this.budgets = this.budgets.filter((b) => !deleted.has(b.guid))\n })\n let failed = false\n for (const [i, r] of results.entries()) {\n if (r.status === 'rejected') {\n failed = true\n console.error('Error deleting budget:', r.reason)\n this.globalStore.captureException(r.reason, { store: 'BudgetsStore', guid: guids[i] })\n }\n }\n return !failed\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: { msg: string; severity: 'success' | 'error' } | null) => (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<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 true\n } catch (error) {\n console.error('Error updating budget:', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n return 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,QAA+D;AAAA,EAC/D,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,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A,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: { msg: string; severity: 'success' | 'error' } | null = null\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): Promise<boolean> => {\n const guids = [guid, ...this.budgets.filter((b) => b.parent_guid === guid).map((b) => b.guid)]\n const results = await Promise.allSettled(guids.map((g) => this.api.deleteBudget(g)))\n const deleted = new Set(guids.filter((_, i) => results[i].status === 'fulfilled'))\n runInAction(() => {\n this.budgets = this.budgets.filter((b) => !deleted.has(b.guid))\n })\n let failed = false\n for (const [i, r] of results.entries()) {\n if (r.status === 'rejected') {\n failed = true\n console.error('Error deleting budget:', r.reason)\n this.globalStore.captureException(r.reason, { store: 'BudgetsStore', guid: guids[i] })\n }\n }\n return !failed\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: { msg: string; severity: 'success' | 'error' } | null) => (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 // Some budgets may have saved before the failure; reload so a retry updates them.\n await this.loadBudgets().catch(() => undefined)\n return { data: [], isSuccess: false }\n }\n }\n\n updateBudget = async (budget: Budget): Promise<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 true\n } catch (error) {\n console.error('Error updating budget:', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n return 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,QAA+D;AAAA,EAC/D,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,QAA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Ae,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,7 +1,7 @@
1
- import { CategoryColors as M, CategoryGuids as h, CategoryIcon as N } from "../constants/Category.es.js";
1
+ import { CategoryColors as C, CategoryGuids as h, CategoryIcon as N } from "../constants/Category.es.js";
2
2
  import { DATE_FORMATS_INTL as T, formatDate as b } from "../constants/DateFormats.es.js";
3
3
  import { CategoryIconList as D } from "@mxenabled/mxui";
4
- import { format as c } from "date-fns/format";
4
+ import { format as l } from "date-fns/format";
5
5
  import { startOfMonth as O } from "date-fns/startOfMonth";
6
6
  import { startOfToday as E } from "date-fns/startOfToday";
7
7
  import { subMonths as I } from "date-fns/subMonths";
@@ -12,19 +12,19 @@ var R = 3, f = 12, S = (e, r) => {
12
12
  const t = D.find((o) => o.guid === e);
13
13
  return t ? r.palette.categories[t.colorName] || "" : r.palette.categories.uncategorized || "";
14
14
  }, _ = (e, r, t, o, a = []) => {
15
- const n = e.guid, u = e.parent_guid || n, s = n === u, g = t.find((i) => i.category_guid === n)?.total || 0, d = p(o.filter((i) => i.category_guid === n)), m = p(o.filter((i) => i.category_guid === n || i.top_level_category_guid === n)), l = a.map((i) => _(i, r, t, o)), A = l.reduce((i, C) => i + C.currentAmount, g), v = S(e, r);
15
+ const n = e.guid, u = e.parent_guid || n, s = n === u, g = t.find((i) => i.category_guid === n)?.total || 0, d = y(o.filter((i) => i.category_guid === n)), m = y(o.filter((i) => i.category_guid === n || i.top_level_category_guid === n)), c = a.map((i) => _(i, r, t, o)), A = c.reduce((i, M) => i + M.currentAmount, g), v = S(e, r);
16
16
  return {
17
17
  ...e,
18
18
  currentAmount: g,
19
- averageAmount: y(d),
20
- color: M[u],
19
+ averageAmount: p(d),
20
+ color: C[u],
21
21
  icon: N[u],
22
22
  isTransfer: u === h.TRANSFER,
23
23
  monthlyAmounts: d,
24
24
  name: v,
25
- subCategories: l,
25
+ subCategories: c,
26
26
  totalAmount: s ? A : 0,
27
- totalAverageAmount: y(m),
27
+ totalAverageAmount: p(m),
28
28
  totalMonthlyAmounts: s ? m : []
29
29
  };
30
30
  }, P = (e, r) => e.map((t) => {
@@ -33,16 +33,16 @@ var R = 3, f = 12, S = (e, r) => {
33
33
  ...t,
34
34
  transactions: o
35
35
  };
36
- }), y = (e, r = R) => {
37
- const t = r > history.length ? history.length : r;
36
+ }), p = (e, r = R) => {
37
+ const t = Math.min(r, e.length);
38
38
  return Math.ceil(Math.max(0, e.slice(-t).reduce((o, a) => o + a.amount, 0) / t));
39
- }, p = (e) => {
39
+ }, y = (e) => {
40
40
  const r = [], t = E();
41
41
  for (let o = 0; o <= f; o++) {
42
- const a = O(I(t, f - o)), n = e.filter((u) => u.year_month === Number(c(a, "yyyyMM"))).reduce((u, s) => u + s.total, 0);
42
+ const a = O(I(t, f - o)), n = e.filter((u) => u.year_month === Number(l(a, "yyyyMM"))).reduce((u, s) => u + s.total, 0);
43
43
  r.push({
44
44
  amount: n,
45
- isoDate: c(a, "yyyy-MM-dd"),
45
+ isoDate: l(a, "yyyy-MM-dd"),
46
46
  label: b(a, T.MONTH_YEAR)
47
47
  });
48
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CategoryUtil.es.js","names":[],"sources":["../../../src/core/utils/CategoryUtil.ts"],"sourcesContent":["import { format } from 'date-fns/format'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { startOfToday } from 'date-fns/startOfToday'\nimport { subMonths } from 'date-fns/subMonths'\n\nimport type { Palette, Theme } from '@mui/material'\n\nimport { CategoryIconList } from '@mxenabled/mxui'\n\nimport {\n CategoryColors,\n CategoryGuids,\n CategoryIcon,\n DATE_FORMATS_INTL,\n formatDate,\n} from '../constants'\n\nimport type {\n Category,\n DateRangeCategoryTotals,\n DetailedCategory,\n DetailedCategoryWithTransactions,\n MonthlyAmount,\n MonthlyCategoryTotals,\n Transaction,\n CategoryCopy,\n CategoryTotal,\n} from '../types'\n\nconst MONTHLY_AVERAGE_LENGTH = 3\nconst MONTHS_OF_HISTORY = 12\n\n/**\n * Resolve the localized display name for a category.\n *\n * Default (MX-supplied) categories arrive from the API with fixed English\n * names, but localized copy for them is delivered via CategoryCopy\n * `default_categories` (keyed by category guid). User-created categories have no\n * localized copy and legitimately fall back to their API name.\n * @param category - The category to resolve a name for\n * @param copy - Category copy containing localized default category names\n */\nexport const getLocalizedCategoryName = (category: Category, copy: CategoryCopy): string => {\n const localizedName = copy.default_categories?.[category.guid]\n return localizedName ? localizedName.replace(/&amp;/g, '&') : category.name\n}\n\n/**\n * Augment categories\n * @param categories - Categories to augment\n * @param monthlyCategoryTotals - Monthly category totals\n * @param currentCategoryTotals - Current month category totals\n * @param copy - Category copy\n */\nexport const augmentCategories = (\n categories: Category[],\n copy: CategoryCopy,\n currentCategoryTotals: DateRangeCategoryTotals[],\n monthlyCategoryTotals: MonthlyCategoryTotals[],\n): DetailedCategory[] => {\n return categories\n .filter((category) => !category.parent_guid)\n .map((category) =>\n getDetailedCategory(\n category,\n copy,\n currentCategoryTotals,\n monthlyCategoryTotals,\n categories.filter((c) => c.parent_guid === category.guid),\n ),\n )\n}\n\nexport const getCategoryColor = (guid: string, theme: Theme) => {\n const categoryInfo = CategoryIconList.find((c) => c.guid === guid)\n if (!categoryInfo) return theme.palette.categories.uncategorized || ''\n\n return theme.palette.categories[categoryInfo.colorName as keyof Palette['categories']] || ''\n}\n\nexport const getCategoryIcon = (guid: string) => {\n return CategoryIconList.find((c) => c.guid === guid)?.icon\n}\n\n/**\n * Get an augmented category with additional details\n * @param category - The category to augment\n * @param copy - Category copy\n * @param currentCategoryTotals - Current month category totals\n * @param monthlyCategoryTotals - Past monthly category totals\n * @param subCategories - Subcategories for the specified category (If applicable)\n */\nconst getDetailedCategory = (\n category: Category,\n copy: CategoryCopy,\n currentCategoryTotals: DateRangeCategoryTotals[],\n monthlyCategoryTotals: MonthlyCategoryTotals[],\n subCategories: Category[] = [],\n): DetailedCategory => {\n const guid = category.guid\n const parentGuid = category.parent_guid || guid\n const isParent = guid === parentGuid\n\n const currentAmount = currentCategoryTotals.find((t) => t.category_guid === guid)?.total || 0\n const monthlyAmounts = getMonthlyAmounts(\n monthlyCategoryTotals.filter((total) => total.category_guid === guid),\n )\n const totalMonthlyAmounts = getMonthlyAmounts(\n monthlyCategoryTotals.filter(\n (total) => total.category_guid === guid || total.top_level_category_guid === guid,\n ),\n )\n const detailedSubCategories = subCategories.map((subCategory) =>\n getDetailedCategory(subCategory, copy, currentCategoryTotals, monthlyCategoryTotals),\n )\n const totalAmount = detailedSubCategories.reduce(\n (total, current) => total + current.currentAmount,\n currentAmount,\n )\n\n const name = getLocalizedCategoryName(category, copy)\n\n return {\n ...category,\n currentAmount,\n averageAmount: getAverage(monthlyAmounts),\n color: CategoryColors[parentGuid],\n icon: CategoryIcon[parentGuid],\n isTransfer: parentGuid === CategoryGuids.TRANSFER,\n monthlyAmounts,\n name,\n subCategories: detailedSubCategories,\n totalAmount: isParent ? totalAmount : 0,\n totalAverageAmount: getAverage(totalMonthlyAmounts),\n totalMonthlyAmounts: isParent ? totalMonthlyAmounts : [],\n }\n}\n/**\n * get the transactions belonging to parent categories\n * @param detailedCategories - detailed categories from the category store\n * @param transactions - sortedTransactions from the transaction store\n */\nexport const getDetailedCategoryTransactions = (\n detailedCategories: DetailedCategory[],\n transactions: Transaction[],\n): DetailedCategoryWithTransactions[] => {\n return detailedCategories.map((category) => {\n const categoryTransactions = transactions.filter(\n (transaction) =>\n transaction.category_guid === category.guid ||\n transaction.top_level_category_guid === category.guid,\n )\n\n return {\n ...category,\n transactions: categoryTransactions,\n }\n })\n}\n\n/**\n * Get the average amount based on the number of months (numMonths) requested\n * @param monthlyAmounts - Monthly amounts to calculate and average from\n * @param numMonths - Number of months to base the average on (DEFAULT: 3)\n */\nconst getAverage = (\n monthlyAmounts: MonthlyAmount[],\n numMonths: number = MONTHLY_AVERAGE_LENGTH,\n): number => {\n const monthsBack = numMonths > history.length ? history.length : numMonths\n\n return Math.ceil(\n Math.max(\n 0,\n monthlyAmounts.slice(-monthsBack).reduce((total, current) => total + current.amount, 0) /\n monthsBack,\n ),\n )\n}\n\n/**\n * Get the last 12 months of amounts for a category\n * @param categoryTotals - Monthly category totals\n */\nconst getMonthlyAmounts = (categoryTotals: MonthlyCategoryTotals[]): MonthlyAmount[] => {\n const monthlyAmounts: MonthlyAmount[] = []\n const today = startOfToday()\n for (let i = 0; i <= MONTHS_OF_HISTORY; i++) {\n const historyDate = startOfMonth(subMonths(today, MONTHS_OF_HISTORY - i))\n const monthlyTotals = categoryTotals.filter(\n (total) => total.year_month === Number(format(historyDate, 'yyyyMM')),\n )\n const totalAmount = monthlyTotals.reduce((acc, curr) => acc + curr.total, 0)\n\n monthlyAmounts.push({\n amount: totalAmount,\n isoDate: format(historyDate, 'yyyy-MM-dd'),\n label: formatDate(historyDate, DATE_FORMATS_INTL.MONTH_YEAR),\n })\n }\n\n return monthlyAmounts\n}\n\nexport const findCategory = (\n categories: Category[],\n categoryGuid: string | undefined,\n): Category | undefined => {\n return categories.find((c) => c.guid === categoryGuid)\n}\n\nexport const findDetailedCategory = (\n detailedCategories: DetailedCategory[],\n guid: string | undefined,\n): DetailedCategory | undefined => {\n return detailedCategories.find((dc) => dc.guid === guid)\n}\n\nexport const findDetailedSubCategory = (\n detailedCategories: DetailedCategory[],\n guid: string | undefined,\n): DetailedCategory | undefined => {\n const parent = detailedCategories.find((dc) => dc.subCategories.find((sc) => sc.guid === guid))\n if (!parent) return undefined\n\n return parent.subCategories.find((sc) => sc.guid === guid)\n}\n\nexport const findCategoryTotalsByParent = (\n categories: Category[],\n dateRangeTotals: DateRangeCategoryTotals[],\n): CategoryTotal[] => {\n const categoryTotals = [] as CategoryTotal[]\n\n // Iterate over the category data from BE and roll up all categories into parent categories\n // acc is the accumulated category totals of type CategoryTotal that is initialized as an empty []\n // curr is the current DateRangeCategoryTotal\n\n for (const dateRangeTotal of dateRangeTotals) {\n const category = findCategory(categories, dateRangeTotal.category_guid)\n if (!category) continue\n\n const parentGuid = category.parent_guid ?? category.guid\n const parentCategory = findCategory(categories, parentGuid)\n if (!parentCategory) continue\n\n const categoryTotal = {\n amount: dateRangeTotal.total,\n category,\n guid: category.guid,\n subCategoryTotals: [],\n }\n\n const parentCategoryTotal = categoryTotals.find((ct) => ct.guid === parentGuid)\n if (parentCategoryTotal) {\n parentCategoryTotal.amount += dateRangeTotal.total\n parentCategoryTotal.subCategoryTotals.push(categoryTotal)\n } else {\n categoryTotals.push({\n amount: dateRangeTotal.total,\n category: parentCategory,\n guid: parentGuid,\n subCategoryTotals: [categoryTotal],\n })\n }\n }\n\n return categoryTotals\n}\n\nexport const isIncome = (categories: Category[], guid: string) => {\n const category = categories.find((c) => c.guid === guid)\n if (!category) return false\n\n return category.guid === CategoryGuids.INCOME || category.parent_guid === CategoryGuids.INCOME\n}\n"],"mappings":";;;;;;;AA6BA,IAAM,IAAyB,GACzB,IAAoB,IAYb,IAAA,CAA4B,GAAoB,MAA+B;AAC1F,QAAM,IAAgB,EAAK,qBAAqB,EAAS,IAAA;AACzD,SAAO,IAAgB,EAAc,QAAQ,UAAU,GAAG,IAAI,EAAS;AACzE,GASa,IAAA,CACX,GACA,GACA,GACA,MAEO,EACJ,OAAA,CAAQ,MAAa,CAAC,EAAS,WAAW,EAC1C,IAAA,CAAK,MACJ,EACE,GACA,GACA,GACA,GACA,EAAW,OA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EAAS,QACvC,EAAY,4BAA4B,EAAS,IACrD;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,cAAc;AAAA,EAChB;AACF,CAAC,GAQG,IAAA,CACJ,GACA,IAAoB,MACT;AACX,QAAM,IAAa,IAAY,QAAQ,SAAS,QAAQ,SAAS;AAEjE,SAAO,KAAK,KACV,KAAK,IACH,GACA,EAAe,MAAM,CAAC,CAAU,EAAE,OAAA,CAAQ,GAAO,MAAY,IAAQ,EAAQ,QAAQ,CAAC,IACpF,CACJ,CACF;AACF,GAMM,IAAA,CAAqB,MAA6D;AACtF,QAAM,IAAkC,CAAC,GACnC,IAAQ,EAAa;AAC3B,WAAS,IAAI,GAAG,KAAK,GAAmB,KAAK;AAC3C,UAAM,IAAc,EAAa,EAAU,GAAO,IAAoB,CAAC,CAAC,GAIlE,IAHgB,EAAe,OAAA,CAClC,MAAU,EAAM,eAAe,OAAO,EAAO,GAAa,QAAQ,CAAC,CAElD,EAAc,OAAA,CAAQ,GAAK,MAAS,IAAM,EAAK,OAAO,CAAC;AAE3E,IAAA,EAAe,KAAK;AAAA,MAClB,QAAQ;AAAA,MACR,SAAS,EAAO,GAAa,YAAY;AAAA,MACzC,OAAO,EAAW,GAAa,EAAkB,UAAU;AAAA,IAC7D,CAAC;AAAA,EACH;AAEA,SAAO;AACT,GASa,IAAA,CACX,GACA,MAEO,EAAmB,KAAA,CAAM,MAAO,EAAG,SAAS,CAAI,GAG5C,IAAA,CACX,GACA,MACiC;AACjC,QAAM,IAAS,EAAmB,KAAA,CAAM,MAAO,EAAG,cAAc,KAAA,CAAM,MAAO,EAAG,SAAS,CAAI,CAAC;AAC9F,MAAK;AAEL,WAAO,EAAO,cAAc,KAAA,CAAM,MAAO,EAAG,SAAS,CAAI;AAC3D"}
1
+ {"version":3,"file":"CategoryUtil.es.js","names":[],"sources":["../../../src/core/utils/CategoryUtil.ts"],"sourcesContent":["import { format } from 'date-fns/format'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { startOfToday } from 'date-fns/startOfToday'\nimport { subMonths } from 'date-fns/subMonths'\n\nimport type { Palette, Theme } from '@mui/material'\n\nimport { CategoryIconList } from '@mxenabled/mxui'\n\nimport {\n CategoryColors,\n CategoryGuids,\n CategoryIcon,\n DATE_FORMATS_INTL,\n formatDate,\n} from '../constants'\n\nimport type {\n Category,\n DateRangeCategoryTotals,\n DetailedCategory,\n DetailedCategoryWithTransactions,\n MonthlyAmount,\n MonthlyCategoryTotals,\n Transaction,\n CategoryCopy,\n CategoryTotal,\n} from '../types'\n\nconst MONTHLY_AVERAGE_LENGTH = 3\nconst MONTHS_OF_HISTORY = 12\n\n/**\n * Resolve the localized display name for a category.\n *\n * Default (MX-supplied) categories arrive from the API with fixed English\n * names, but localized copy for them is delivered via CategoryCopy\n * `default_categories` (keyed by category guid). User-created categories have no\n * localized copy and legitimately fall back to their API name.\n * @param category - The category to resolve a name for\n * @param copy - Category copy containing localized default category names\n */\nexport const getLocalizedCategoryName = (category: Category, copy: CategoryCopy): string => {\n const localizedName = copy.default_categories?.[category.guid]\n return localizedName ? localizedName.replace(/&amp;/g, '&') : category.name\n}\n\n/**\n * Augment categories\n * @param categories - Categories to augment\n * @param monthlyCategoryTotals - Monthly category totals\n * @param currentCategoryTotals - Current month category totals\n * @param copy - Category copy\n */\nexport const augmentCategories = (\n categories: Category[],\n copy: CategoryCopy,\n currentCategoryTotals: DateRangeCategoryTotals[],\n monthlyCategoryTotals: MonthlyCategoryTotals[],\n): DetailedCategory[] => {\n return categories\n .filter((category) => !category.parent_guid)\n .map((category) =>\n getDetailedCategory(\n category,\n copy,\n currentCategoryTotals,\n monthlyCategoryTotals,\n categories.filter((c) => c.parent_guid === category.guid),\n ),\n )\n}\n\nexport const getCategoryColor = (guid: string, theme: Theme) => {\n const categoryInfo = CategoryIconList.find((c) => c.guid === guid)\n if (!categoryInfo) return theme.palette.categories.uncategorized || ''\n\n return theme.palette.categories[categoryInfo.colorName as keyof Palette['categories']] || ''\n}\n\nexport const getCategoryIcon = (guid: string) => {\n return CategoryIconList.find((c) => c.guid === guid)?.icon\n}\n\n/**\n * Get an augmented category with additional details\n * @param category - The category to augment\n * @param copy - Category copy\n * @param currentCategoryTotals - Current month category totals\n * @param monthlyCategoryTotals - Past monthly category totals\n * @param subCategories - Subcategories for the specified category (If applicable)\n */\nconst getDetailedCategory = (\n category: Category,\n copy: CategoryCopy,\n currentCategoryTotals: DateRangeCategoryTotals[],\n monthlyCategoryTotals: MonthlyCategoryTotals[],\n subCategories: Category[] = [],\n): DetailedCategory => {\n const guid = category.guid\n const parentGuid = category.parent_guid || guid\n const isParent = guid === parentGuid\n\n const currentAmount = currentCategoryTotals.find((t) => t.category_guid === guid)?.total || 0\n const monthlyAmounts = getMonthlyAmounts(\n monthlyCategoryTotals.filter((total) => total.category_guid === guid),\n )\n const totalMonthlyAmounts = getMonthlyAmounts(\n monthlyCategoryTotals.filter(\n (total) => total.category_guid === guid || total.top_level_category_guid === guid,\n ),\n )\n const detailedSubCategories = subCategories.map((subCategory) =>\n getDetailedCategory(subCategory, copy, currentCategoryTotals, monthlyCategoryTotals),\n )\n const totalAmount = detailedSubCategories.reduce(\n (total, current) => total + current.currentAmount,\n currentAmount,\n )\n\n const name = getLocalizedCategoryName(category, copy)\n\n return {\n ...category,\n currentAmount,\n averageAmount: getAverage(monthlyAmounts),\n color: CategoryColors[parentGuid],\n icon: CategoryIcon[parentGuid],\n isTransfer: parentGuid === CategoryGuids.TRANSFER,\n monthlyAmounts,\n name,\n subCategories: detailedSubCategories,\n totalAmount: isParent ? totalAmount : 0,\n totalAverageAmount: getAverage(totalMonthlyAmounts),\n totalMonthlyAmounts: isParent ? totalMonthlyAmounts : [],\n }\n}\n/**\n * get the transactions belonging to parent categories\n * @param detailedCategories - detailed categories from the category store\n * @param transactions - sortedTransactions from the transaction store\n */\nexport const getDetailedCategoryTransactions = (\n detailedCategories: DetailedCategory[],\n transactions: Transaction[],\n): DetailedCategoryWithTransactions[] => {\n return detailedCategories.map((category) => {\n const categoryTransactions = transactions.filter(\n (transaction) =>\n transaction.category_guid === category.guid ||\n transaction.top_level_category_guid === category.guid,\n )\n\n return {\n ...category,\n transactions: categoryTransactions,\n }\n })\n}\n\n/**\n * Get the average amount based on the number of months (numMonths) requested\n * @param monthlyAmounts - Monthly amounts to calculate and average from\n * @param numMonths - Number of months to base the average on (DEFAULT: 3)\n */\nconst getAverage = (\n monthlyAmounts: MonthlyAmount[],\n numMonths: number = MONTHLY_AVERAGE_LENGTH,\n): number => {\n const monthsBack = Math.min(numMonths, monthlyAmounts.length)\n\n return Math.ceil(\n Math.max(\n 0,\n monthlyAmounts.slice(-monthsBack).reduce((total, current) => total + current.amount, 0) /\n monthsBack,\n ),\n )\n}\n\n/**\n * Get the last 12 months of amounts for a category\n * @param categoryTotals - Monthly category totals\n */\nconst getMonthlyAmounts = (categoryTotals: MonthlyCategoryTotals[]): MonthlyAmount[] => {\n const monthlyAmounts: MonthlyAmount[] = []\n const today = startOfToday()\n for (let i = 0; i <= MONTHS_OF_HISTORY; i++) {\n const historyDate = startOfMonth(subMonths(today, MONTHS_OF_HISTORY - i))\n const monthlyTotals = categoryTotals.filter(\n (total) => total.year_month === Number(format(historyDate, 'yyyyMM')),\n )\n const totalAmount = monthlyTotals.reduce((acc, curr) => acc + curr.total, 0)\n\n monthlyAmounts.push({\n amount: totalAmount,\n isoDate: format(historyDate, 'yyyy-MM-dd'),\n label: formatDate(historyDate, DATE_FORMATS_INTL.MONTH_YEAR),\n })\n }\n\n return monthlyAmounts\n}\n\nexport const findCategory = (\n categories: Category[],\n categoryGuid: string | undefined,\n): Category | undefined => {\n return categories.find((c) => c.guid === categoryGuid)\n}\n\nexport const findDetailedCategory = (\n detailedCategories: DetailedCategory[],\n guid: string | undefined,\n): DetailedCategory | undefined => {\n return detailedCategories.find((dc) => dc.guid === guid)\n}\n\nexport const findDetailedSubCategory = (\n detailedCategories: DetailedCategory[],\n guid: string | undefined,\n): DetailedCategory | undefined => {\n const parent = detailedCategories.find((dc) => dc.subCategories.find((sc) => sc.guid === guid))\n if (!parent) return undefined\n\n return parent.subCategories.find((sc) => sc.guid === guid)\n}\n\nexport const findCategoryTotalsByParent = (\n categories: Category[],\n dateRangeTotals: DateRangeCategoryTotals[],\n): CategoryTotal[] => {\n const categoryTotals = [] as CategoryTotal[]\n\n // Iterate over the category data from BE and roll up all categories into parent categories\n // acc is the accumulated category totals of type CategoryTotal that is initialized as an empty []\n // curr is the current DateRangeCategoryTotal\n\n for (const dateRangeTotal of dateRangeTotals) {\n const category = findCategory(categories, dateRangeTotal.category_guid)\n if (!category) continue\n\n const parentGuid = category.parent_guid ?? category.guid\n const parentCategory = findCategory(categories, parentGuid)\n if (!parentCategory) continue\n\n const categoryTotal = {\n amount: dateRangeTotal.total,\n category,\n guid: category.guid,\n subCategoryTotals: [],\n }\n\n const parentCategoryTotal = categoryTotals.find((ct) => ct.guid === parentGuid)\n if (parentCategoryTotal) {\n parentCategoryTotal.amount += dateRangeTotal.total\n parentCategoryTotal.subCategoryTotals.push(categoryTotal)\n } else {\n categoryTotals.push({\n amount: dateRangeTotal.total,\n category: parentCategory,\n guid: parentGuid,\n subCategoryTotals: [categoryTotal],\n })\n }\n }\n\n return categoryTotals\n}\n\nexport const isIncome = (categories: Category[], guid: string) => {\n const category = categories.find((c) => c.guid === guid)\n if (!category) return false\n\n return category.guid === CategoryGuids.INCOME || category.parent_guid === CategoryGuids.INCOME\n}\n"],"mappings":";;;;;;;AA6BA,IAAM,IAAyB,GACzB,IAAoB,IAYb,IAAA,CAA4B,GAAoB,MAA+B;AAC1F,QAAM,IAAgB,EAAK,qBAAqB,EAAS,IAAA;AACzD,SAAO,IAAgB,EAAc,QAAQ,UAAU,GAAG,IAAI,EAAS;AACzE,GASa,IAAA,CACX,GACA,GACA,GACA,MAEO,EACJ,OAAA,CAAQ,MAAa,CAAC,EAAS,WAAW,EAC1C,IAAA,CAAK,MACJ,EACE,GACA,GACA,GACA,GACA,EAAW,OAAA,CAAQ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C,EAAY,4BAA4B,EAAS,IACrD;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,cAAc;AAAA,EAChB;AACF,CAAC,GAQG,IAAA,CACJ,GACA,IAAoB,MACT;AACX,QAAM,IAAa,KAAK,IAAI,GAAW,EAAe,MAAM;AAE5D,SAAO,KAAK,KACV,KAAK,IACH,GACA,EAAe,MAAM,CAAC,CAAU,EAAE,OAAA,CAAQ,GAAO,MAAY,IAAQ,EAAQ,QAAQ,CAAC,IACpF,CACJ,CACF;AACF,GAMM,IAAA,CAAqB,MAA6D;AACtF,QAAM,IAAkC,CAAC,GACnC,IAAQ,EAAa;AAC3B,WAAS,IAAI,GAAG,KAAK,GAAmB,KAAK;AAC3C,UAAM,IAAc,EAAa,EAAU,GAAO,IAAoB,CAAC,CAAC,GAIlE,IAHgB,EAAe,OAAA,CAClC,MAAU,EAAM,eAAe,OAAO,EAAO,GAAa,QAAQ,CAAC,CAElD,EAAc,OAAA,CAAQ,GAAK,MAAS,IAAM,EAAK,OAAO,CAAC;AAE3E,IAAA,EAAe,KAAK;AAAA,MAClB,QAAQ;AAAA,MACR,SAAS,EAAO,GAAa,YAAY;AAAA,MACzC,OAAO,EAAW,GAAa,EAAkB,UAAU;AAAA,IAC7D,CAAC;AAAA,EACH;AAEA,SAAO;AACT,GASa,IAAA,CACX,GACA,MAEO,EAAmB,KAAA,CAAM,MAAO,EAAG,SAAS,CAAI,GAG5C,IAAA,CACX,GACA,MACiC;AACjC,QAAM,IAAS,EAAmB,KAAA,CAAM,MAAO,EAAG,cAAc,KAAA,CAAM,MAAO,EAAG,SAAS,CAAI,CAAC;AAC9F,MAAK;AAEL,WAAO,EAAO,cAAc,KAAA,CAAM,MAAO,EAAG,SAAS,CAAI;AAC3D"}
@@ -3,16 +3,16 @@ import g from "../../common/components/drawer/Drawer.es.js";
3
3
  import y from "react";
4
4
  import { observer as b } from "mobx-react-lite";
5
5
  import v from "@mui/material/Stack";
6
- import { jsx as e } from "react/jsx-runtime";
7
- import { alpha as o, useTheme as D } from "@mui/material/styles";
6
+ import { jsx as t } from "react/jsx-runtime";
7
+ import { alpha as e, useTheme as D } from "@mui/material/styles";
8
8
  import { AdapterDateFns as S } from "@mui/x-date-pickers/AdapterDateFnsV3";
9
- import { LocalizationProvider as x } from "@mui/x-date-pickers/LocalizationProvider";
10
- import { StaticDatePicker as w } from "@mui/x-date-pickers";
11
- var B = ({ isOpen: n, onClose: a }) => {
12
- const { finstrong: l } = u(), t = D(), { updateUser: c, user: i } = f(), { loadPeerScore: m } = h(), [r, s] = y.useState(i.birthday), p = (d) => {
9
+ import { StaticDatePicker as x } from "@mui/x-date-pickers";
10
+ import { LocalizationProvider as P } from "@mui/x-date-pickers/LocalizationProvider";
11
+ var w = ({ isOpen: n, onClose: a }) => {
12
+ const { finstrong: l } = u(), o = D(), { updateUser: c, user: i } = f(), { loadPeerScore: m } = h(), [r, s] = y.useState(i.birthday), p = (d) => {
13
13
  s(Math.floor(new Date(d).getTime() / 1e3));
14
14
  };
15
- return /* @__PURE__ */ e(g, {
15
+ return /* @__PURE__ */ t(g, {
16
16
  footerStyles: {
17
17
  borderTop: 1,
18
18
  borderColor: "divider",
@@ -31,28 +31,28 @@ var B = ({ isOpen: n, onClose: a }) => {
31
31
  },
32
32
  onSecondaryAction: a,
33
33
  title: l.date_of_birth,
34
- children: /* @__PURE__ */ e(v, {
34
+ children: /* @__PURE__ */ t(v, {
35
35
  sx: {
36
36
  bgcolor: "background.default",
37
37
  height: "100%"
38
38
  },
39
- children: /* @__PURE__ */ e(x, {
39
+ children: /* @__PURE__ */ t(P, {
40
40
  dateAdapter: S,
41
- children: /* @__PURE__ */ e(w, {
41
+ children: /* @__PURE__ */ t(x, {
42
42
  disableFuture: !0,
43
43
  onChange: p,
44
44
  slotProps: {
45
45
  nextIconButton: { sx: {
46
46
  color: "primary.main",
47
- "&:hover": { bgcolor: o(t.palette.primary.light, 0.1) }
47
+ "&:hover": { bgcolor: e(o.palette.primary.light, 0.1) }
48
48
  } },
49
49
  previousIconButton: { sx: {
50
50
  color: "primary.main",
51
- "&:hover": { bgcolor: o(t.palette.primary.light, 0.1) }
51
+ "&:hover": { bgcolor: e(o.palette.primary.light, 0.1) }
52
52
  } },
53
53
  switchViewButton: { sx: {
54
54
  color: "primary.main",
55
- "&:hover": { bgcolor: o(t.palette.primary.light, 0.1) }
55
+ "&:hover": { bgcolor: e(o.palette.primary.light, 0.1) }
56
56
  } }
57
57
  },
58
58
  slots: {
@@ -63,7 +63,7 @@ var B = ({ isOpen: n, onClose: a }) => {
63
63
  width: "100%",
64
64
  "& .MuiIconButton-edgeEnd": {
65
65
  color: "primary.main",
66
- "&:hover": { bgcolor: o(t.palette.primary.light, 0.1) }
66
+ "&:hover": { bgcolor: e(o.palette.primary.light, 0.1) }
67
67
  }
68
68
  },
69
69
  value: r ? /* @__PURE__ */ new Date(r * 1e3) : /* @__PURE__ */ new Date()
@@ -71,9 +71,9 @@ var B = ({ isOpen: n, onClose: a }) => {
71
71
  })
72
72
  })
73
73
  });
74
- }, j = b(B);
74
+ }, O = b(w);
75
75
  export {
76
- j as default
76
+ O as default
77
77
  };
78
78
 
79
79
  //# sourceMappingURL=ManageDOB.es.js.map
@@ -1,23 +1,23 @@
1
1
  import { DATE_FORMATS_INTL as b, formatDate as f } from "../../../core/constants/DateFormats.es.js";
2
2
  import { useGlobalCopyStore as u, useGoalStore as _, useUserStore as S } from "../../../common/context/hooks.es.js";
3
- import { ListItemAction as A } from "../../../common/components/ListItemAction.es.js";
3
+ import { ListItemAction as v } from "../../../common/components/ListItemAction.es.js";
4
4
  import i from "react";
5
- import { observer as T } from "mobx-react-lite";
5
+ import { observer as A } from "mobx-react-lite";
6
6
  import { jsx as o } from "react/jsx-runtime";
7
7
  import { fromUnixTime as s } from "date-fns/fromUnixTime";
8
- import { getUnixTime as v } from "date-fns/getUnixTime";
8
+ import { getUnixTime as T } from "date-fns/getUnixTime";
9
9
  import { AdapterDateFns as x } from "@mui/x-date-pickers/AdapterDateFnsV3";
10
- import { LocalizationProvider as D } from "@mui/x-date-pickers/LocalizationProvider";
11
- import { DatePicker as g } from "@mui/x-date-pickers";
10
+ import { DatePicker as D } from "@mui/x-date-pickers";
11
+ import { LocalizationProvider as g } from "@mui/x-date-pickers/LocalizationProvider";
12
12
  import { isValid as E } from "date-fns/isValid";
13
- var O = T(({ goal: a }) => {
13
+ var N = A(({ goal: a }) => {
14
14
  const { goals: r } = u(), { user: t, updateUser: d } = S(), { setAlert: m } = _(), [e, l] = i.useState(s(t.birthday ?? 0)), [n, p] = i.useState(null), c = a.is_complete, h = async () => {
15
15
  e && E(e) && (await d({
16
16
  ...t,
17
- birthday: v(e)
17
+ birthday: T(e)
18
18
  }), m(r.alert_goal_updated_birthday));
19
19
  };
20
- return /* @__PURE__ */ o(A, {
20
+ return /* @__PURE__ */ o(v, {
21
21
  isDisabled: c,
22
22
  isSaveDisabled: !!n,
23
23
  label: r.details_birthday,
@@ -25,9 +25,9 @@ var O = T(({ goal: a }) => {
25
25
  primaryText: r.details_birthday,
26
26
  secondaryText: `${f(s(t.birthday ?? 0), b.MONTH_DAY_YEAR)}`,
27
27
  zeroStateText: !a.guid && !t.birthday ? r.add_birthday : void 0,
28
- children: /* @__PURE__ */ o(D, {
28
+ children: /* @__PURE__ */ o(g, {
29
29
  dateAdapter: x,
30
- children: /* @__PURE__ */ o(g, {
30
+ children: /* @__PURE__ */ o(D, {
31
31
  label: r.details_birthday,
32
32
  onChange: l,
33
33
  onError: (y) => p(y),
@@ -38,7 +38,7 @@ var O = T(({ goal: a }) => {
38
38
  });
39
39
  });
40
40
  export {
41
- O as BirthdayAction
41
+ N as BirthdayAction
42
42
  };
43
43
 
44
44
  //# sourceMappingURL=BirthdayAction.es.js.map
@@ -4,16 +4,16 @@ import { formatOrdinal as M } from "../../core/utils/NumberFormatting.es.js";
4
4
  import { Select as n } from "../../common/components/Select.es.js";
5
5
  import g from "react";
6
6
  import A from "@mui/material/Stack";
7
- import { startOfToday as y } from "date-fns/startOfToday";
7
+ import { startOfToday as i } from "date-fns/startOfToday";
8
8
  import { jsx as t, jsxs as T } from "react/jsx-runtime";
9
9
  import { addYears as _ } from "date-fns/addYears";
10
10
  import { subDays as Y } from "date-fns/subDays";
11
11
  import { setDayOfYear as x } from "date-fns/setDayOfYear";
12
12
  import { AdapterDateFns as D } from "@mui/x-date-pickers/AdapterDateFnsV3";
13
- import { LocalizationProvider as C } from "@mui/x-date-pickers/LocalizationProvider";
14
- import { getDayOfYear as W } from "date-fns/getDayOfYear";
13
+ import { getDayOfYear as C } from "date-fns/getDayOfYear";
15
14
  import { DatePicker as P } from "@mui/x-date-pickers";
16
- var N = ({ frequency: a, firstDay: i, secondDay: h, onFrequencyChange: s, onFirstDayChange: d, onSecondDayChange: c }) => {
15
+ import { LocalizationProvider as W } from "@mui/x-date-pickers/LocalizationProvider";
16
+ var N = ({ frequency: a, firstDay: y, secondDay: h, onFrequencyChange: s, onFirstDayChange: d, onSecondDayChange: c }) => {
17
17
  const { recurring: e } = E(), f = g.useMemo(() => [
18
18
  {
19
19
  id: r.EveryWeek,
@@ -81,8 +81,8 @@ var N = ({ frequency: a, firstDay: i, secondDay: h, onFrequencyChange: s, onFirs
81
81
  label: M(o + 1)
82
82
  }));
83
83
  l[30].label += ` (${e.last_day_of_month})`;
84
- const v = l.slice(0, 15), b = l.slice(14), u = a === r.EveryWeek || a === r.EveryOtherWeek, k = a === r.TwiceAMonth || a === r.EveryMonth || a === r.EveryOtherMonth || a === r.EveryQuarter || a === r.EveryOtherQuarter, m = x(y(), i), w = m < y() ? _(m, 1) : m, O = (o) => {
85
- o && d(W(o));
84
+ const v = l.slice(0, 15), b = l.slice(14), u = a === r.EveryWeek || a === r.EveryOtherWeek, k = a === r.TwiceAMonth || a === r.EveryMonth || a === r.EveryOtherMonth || a === r.EveryQuarter || a === r.EveryOtherQuarter, m = x(i(), y), w = m < i() ? _(m, 1) : m, O = (o) => {
85
+ o && d(C(o));
86
86
  };
87
87
  return /* @__PURE__ */ T(A, {
88
88
  gap: 24,
@@ -98,13 +98,13 @@ var N = ({ frequency: a, firstDay: i, secondDay: h, onFrequencyChange: s, onFirs
98
98
  label: e.day_of_the_week,
99
99
  onChange: d,
100
100
  options: p,
101
- value: i
101
+ value: y
102
102
  }),
103
103
  k && /* @__PURE__ */ t(n, {
104
104
  label: a === r.TwiceAMonth ? e.first_day_of_the_month : e.day_of_the_month,
105
105
  onChange: d,
106
106
  options: a === r.TwiceAMonth ? v : l,
107
- value: i
107
+ value: y
108
108
  }),
109
109
  a === r.TwiceAMonth && /* @__PURE__ */ t(n, {
110
110
  label: e.second_day_of_the_month,
@@ -112,13 +112,13 @@ var N = ({ frequency: a, firstDay: i, secondDay: h, onFrequencyChange: s, onFirs
112
112
  options: b,
113
113
  value: h ?? ""
114
114
  }),
115
- a === r.EveryYear && /* @__PURE__ */ t(C, {
115
+ a === r.EveryYear && /* @__PURE__ */ t(W, {
116
116
  dateAdapter: D,
117
117
  children: /* @__PURE__ */ t(P, {
118
118
  disablePast: !0,
119
119
  label: e.next_payment_date,
120
- maxDate: Y(_(y(), 1), 1),
121
- minDate: y(),
120
+ maxDate: Y(_(i(), 1), 1),
121
+ minDate: i(),
122
122
  onChange: O,
123
123
  value: w
124
124
  })
@@ -1,24 +1,24 @@
1
- import { useAppConfig as F, useGlobalCopyStore as B, useSettingsStore as M, useUserStore as R } from "../../../common/context/hooks.es.js";
2
- import { useScreenSize as I } from "../../../common/hooks/useScreenSize.es.js";
3
- import L from "../../../common/components/dialog/Dialog.es.js";
4
- import z from "./actions/ResetPasswordAction.es.js";
1
+ import { useAppConfig as F, useGlobalCopyStore as B, useSettingsStore as L, useUserStore as M } from "../../../common/context/hooks.es.js";
2
+ import { useScreenSize as R } from "../../../common/hooks/useScreenSize.es.js";
3
+ import z from "../../../common/components/dialog/Dialog.es.js";
4
+ import I from "./actions/ResetPasswordAction.es.js";
5
5
  import N from "./actions/VerifyEmailAction.es.js";
6
- import j from "./actions/VerifyPhoneAction.es.js";
6
+ import $ from "./actions/VerifyPhoneAction.es.js";
7
7
  import p from "react";
8
- import { observer as H } from "mobx-react-lite";
8
+ import { observer as j } from "mobx-react-lite";
9
9
  import l from "@mui/material/Stack";
10
- import { H3 as J, P as O } from "@mxenabled/mxui";
11
- import $ from "@mui/material/Button";
10
+ import { H3 as H, P as J } from "@mxenabled/mxui";
11
+ import O from "@mui/material/Button";
12
12
  import { Fragment as G, jsx as t, jsxs as i } from "react/jsx-runtime";
13
13
  import { alpha as b, useTheme as K } from "@mui/material/styles";
14
14
  import Y from "@mui/material/Box";
15
15
  import { getUnixTime as q } from "date-fns/getUnixTime";
16
16
  import d from "@mui/material/TextField";
17
17
  import { AdapterDateFns as Q } from "@mui/x-date-pickers/AdapterDateFnsV3";
18
- import { LocalizationProvider as W } from "@mui/x-date-pickers/LocalizationProvider";
19
- import { DatePicker as X } from "@mui/x-date-pickers";
18
+ import { DatePicker as W } from "@mui/x-date-pickers";
19
+ import { LocalizationProvider as X } from "@mui/x-date-pickers/LocalizationProvider";
20
20
  var Z = ({ availableWidth: C, handleOnLeaveClick: f }) => {
21
- const u = K(), { common: w, settings: o } = B(), { isMobile: m } = I(C), { config: h } = F(), { updateUser: S } = M(), { user: r } = R(), [a, U] = p.useState({
21
+ const u = K(), { common: w, settings: o } = B(), { isMobile: m } = R(C), { config: h } = F(), { updateUser: S } = L(), { user: r } = M(), [a, U] = p.useState({
22
22
  first_name: r.first_name,
23
23
  last_name: r.last_name,
24
24
  email: r.email,
@@ -26,7 +26,7 @@ var Z = ({ availableWidth: C, handleOnLeaveClick: f }) => {
26
26
  birthday: r.birthday,
27
27
  postal_code: r.postal_code,
28
28
  credit_score: r.credit_score
29
- }), [c, y] = p.useState(!1), [T, g] = p.useState(!1), _ = p.useRef(null), v = a.email && !r.email_is_verified && !c, x = a.phone && !r.phone_is_verified && !c;
29
+ }), [c, y] = p.useState(!1), [P, g] = p.useState(!1), _ = p.useRef(null), v = a.email && !r.email_is_verified && !c, x = a.phone && !r.phone_is_verified && !c;
30
30
  p.useEffect(() => {
31
31
  if (f) {
32
32
  const e = (s) => {
@@ -37,17 +37,17 @@ var Z = ({ availableWidth: C, handleOnLeaveClick: f }) => {
37
37
  };
38
38
  }
39
39
  }, [c]);
40
- const V = () => {
40
+ const T = () => {
41
41
  if (a.birthday) {
42
42
  const e = /* @__PURE__ */ new Date(a.birthday * 1e3), s = e.getUTCFullYear(), A = e.getUTCMonth(), E = e.getUTCDate();
43
43
  return new Date(s, A, E);
44
44
  }
45
- }, D = async () => {
45
+ }, V = async () => {
46
46
  await S({
47
47
  ...r,
48
48
  ...a
49
49
  }), y(!1);
50
- }, P = () => {
50
+ }, D = () => {
51
51
  g(!1), f && f();
52
52
  }, k = () => {
53
53
  g(!1);
@@ -70,8 +70,8 @@ var Z = ({ availableWidth: C, handleOnLeaveClick: f }) => {
70
70
  "& .MuiTextField-root": { flex: 1 }
71
71
  },
72
72
  children: [
73
- /* @__PURE__ */ t(J, { children: o.personal_details }),
74
- /* @__PURE__ */ t(O, {
73
+ /* @__PURE__ */ t(H, { children: o.personal_details }),
74
+ /* @__PURE__ */ t(J, {
75
75
  variant: "body1",
76
76
  children: o.update_information
77
77
  }),
@@ -115,16 +115,16 @@ var Z = ({ availableWidth: C, handleOnLeaveClick: f }) => {
115
115
  label: o.mobile_number,
116
116
  onChange: (e) => n({ phone: e.target.value }),
117
117
  type: "tel"
118
- }), x && /* @__PURE__ */ t(j, {})]
118
+ }), x && /* @__PURE__ */ t($, {})]
119
119
  })]
120
120
  }),
121
121
  /* @__PURE__ */ i(l, {
122
122
  direction: m ? "column" : "row",
123
123
  spacing: 24,
124
124
  sx: { mb: 24 },
125
- children: [/* @__PURE__ */ t(W, {
125
+ children: [/* @__PURE__ */ t(X, {
126
126
  dateAdapter: Q,
127
- children: /* @__PURE__ */ t(X, {
127
+ children: /* @__PURE__ */ t(W, {
128
128
  label: o.birthdate,
129
129
  onChange: (e) => n({ birthday: q(e) }),
130
130
  slotProps: {
@@ -144,7 +144,7 @@ var Z = ({ availableWidth: C, handleOnLeaveClick: f }) => {
144
144
  "&:hover": { backgroundColor: b(u.palette.primary.light, 0.1) }
145
145
  }
146
146
  },
147
- value: V()
147
+ value: T()
148
148
  })
149
149
  }), /* @__PURE__ */ t(d, {
150
150
  defaultValue: a.postal_code,
@@ -158,26 +158,26 @@ var Z = ({ availableWidth: C, handleOnLeaveClick: f }) => {
158
158
  label: o.credit_score,
159
159
  onChange: (e) => n({ credit_score: Number(e.target.value) })
160
160
  }),
161
- h.display_password_options_in_settings && /* @__PURE__ */ t(z, {}),
162
- /* @__PURE__ */ t($, {
161
+ h.display_password_options_in_settings && /* @__PURE__ */ t(I, {}),
162
+ /* @__PURE__ */ t(O, {
163
163
  disabled: !c,
164
- onClick: D,
164
+ onClick: V,
165
165
  sx: { width: m ? "100%" : 124 },
166
166
  variant: "contained",
167
167
  children: w.save_button
168
168
  })
169
169
  ] })
170
170
  ]
171
- }), /* @__PURE__ */ t(L, {
171
+ }), /* @__PURE__ */ t(z, {
172
172
  copy: { title: o.discard_changes },
173
- isOpen: T,
173
+ isOpen: P,
174
174
  onClose: k,
175
- onSecondaryAction: P,
175
+ onSecondaryAction: D,
176
176
  primaryText: o.keep_editing,
177
177
  secondaryText: o.leave,
178
178
  children: o.discard_changes_message
179
179
  })] });
180
- }, ye = H(Z);
180
+ }, ye = j(Z);
181
181
  export {
182
182
  ye as default
183
183
  };
@@ -1,65 +1,64 @@
1
- import { DATE_FORMATS_INTL as A, formatDate as C } from "../../../../../core/constants/DateFormats.es.js";
2
- import { useEvent as S, useGlobalCopyStore as I, useTransactionStore as v } from "../../../../../common/context/hooks.es.js";
3
- import L from "../../../../../common/components/drawer/Drawer.es.js";
4
- import { ANALYTICS_EVENTS as g } from "../../../../../common/constants/Analytics.es.js";
5
- import { fromUnixUTC as s, toUnixUTC as N } from "../../../../../core/utils/DateUtil.es.js";
1
+ import { DATE_FORMATS_INTL as S, formatDate as C } from "../../../../../core/constants/DateFormats.es.js";
2
+ import I, { CalendarSelectionTypes as h } from "../../../../../common/components/calendar/Calendar.es.js";
3
+ import { useEvent as g, useGlobalCopyStore as L, useTransactionStore as v } from "../../../../../common/context/hooks.es.js";
4
+ import D from "../../../../../common/components/drawer/Drawer.es.js";
5
+ import { ANALYTICS_EVENTS as N } from "../../../../../common/constants/Analytics.es.js";
6
+ import { fromUnixUTC as m } from "../../../../../core/utils/DateUtil.es.js";
6
7
  import { useTransactionsUiStore as b } from "../../../../context/hooks.es.js";
7
- import { ON_CLICK_EVENTS as D } from "../../../../constants/OnClickEvents.es.js";
8
- import c from "react";
9
- import E from "@mui/material/Stack";
10
- import { Text as O } from "@mxenabled/mxui";
11
- import { Icon as d } from "@mxenabled/mx-icons";
8
+ import { ON_CLICK_EVENTS as E } from "../../../../constants/OnClickEvents.es.js";
9
+ import s from "react";
10
+ import O from "@mui/material/Stack";
11
+ import { Text as R } from "@mxenabled/mxui";
12
+ import { Icon as c } from "@mxenabled/mx-icons";
12
13
  import { jsx as t, jsxs as l } from "react/jsx-runtime";
13
- import { useTheme as k } from "@mui/material/styles";
14
- import P from "@mui/material/ListItem";
15
- import U from "@mui/material/Avatar";
16
- import M from "@mui/material/ListItemAvatar";
17
- import R from "@mui/material/ListItemButton";
18
- import w from "@mui/material/ListItemIcon";
19
- import B from "@mui/material/ListItemText";
20
- import { AdapterDateFns as F } from "@mui/x-date-pickers/AdapterDateFnsV3";
21
- import { LocalizationProvider as K } from "@mui/x-date-pickers/LocalizationProvider";
22
- import { StaticDatePicker as Y } from "@mui/x-date-pickers/StaticDatePicker";
23
- var dt = ({ transaction: e }) => {
24
- const { onEvent: n } = S(), { updateTransaction: p } = v(), { updateManualTransaction: f } = b(), { common: o, transactions: r } = I(), _ = k(), [u, a] = c.useState(!1), [i, T] = c.useState(e.date), x = (m) => {
25
- m && T(N(m));
14
+ import { useTheme as U } from "@mui/material/styles";
15
+ import { getUnixTime as k } from "date-fns/getUnixTime";
16
+ import K from "@mui/material/ListItem";
17
+ import M from "@mui/material/Avatar";
18
+ import P from "@mui/material/ListItemAvatar";
19
+ import Y from "@mui/material/ListItemButton";
20
+ import j from "@mui/material/ListItemIcon";
21
+ import w from "@mui/material/ListItemText";
22
+ var st = ({ transaction: e }) => {
23
+ const { onEvent: n } = g(), { updateTransaction: d } = v(), { updateManualTransaction: p } = b(), { common: r, transactions: o } = L(), f = U(), [_, a] = s.useState(!1), [i, T] = s.useState(e.date), u = (A) => {
24
+ T(k(A));
26
25
  }, y = async () => {
27
26
  if (e.is_manual && !e.guid) {
28
- f({
27
+ p({
29
28
  ...e,
30
29
  date: i
31
30
  }), a(!1);
32
31
  return;
33
32
  }
34
- await p({
33
+ await d({
35
34
  ...e,
36
35
  date: i
37
- }), n(g.TRANSACTION_DETAILS_CLICK_DATE, { transaction_guid: e.guid }), a(!1);
38
- }, h = _.palette.mode === "dark" ? "grey.800" : "grey.100";
39
- return /* @__PURE__ */ l(P, {
36
+ }), n(N.TRANSACTION_DETAILS_CLICK_DATE, { transaction_guid: e.guid }), a(!1);
37
+ }, x = f.palette.mode === "dark" ? "grey.800" : "grey.100";
38
+ return /* @__PURE__ */ l(K, {
40
39
  className: "mx-txn-date-action",
41
40
  disableGutters: !0,
42
41
  disablePadding: !0,
43
- children: [/* @__PURE__ */ l(R, {
42
+ children: [/* @__PURE__ */ l(Y, {
44
43
  onClick: () => {
45
- n(D.ON_TRANSACTION_DATE_CLICK), a(!0);
44
+ n(E.ON_TRANSACTION_DATE_CLICK), a(!0);
46
45
  },
47
46
  children: [
48
- /* @__PURE__ */ t(M, { children: /* @__PURE__ */ t(U, {
49
- sx: { bgcolor: h },
47
+ /* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(M, {
48
+ sx: { bgcolor: x },
50
49
  variant: "rounded",
51
- children: /* @__PURE__ */ t(d, {
50
+ children: /* @__PURE__ */ t(c, {
52
51
  name: "calendar_month",
53
52
  sx: { color: "text.primary" }
54
53
  })
55
54
  }) }),
56
- /* @__PURE__ */ t(B, {
57
- primary: r.date_title,
58
- secondary: /* @__PURE__ */ t(O, {
55
+ /* @__PURE__ */ t(w, {
56
+ primary: o.date_title,
57
+ secondary: /* @__PURE__ */ t(R, {
59
58
  bold: !0,
60
59
  sx: { color: "text.primary" },
61
60
  variant: "body1",
62
- children: C(s(e.date), A.FULL_MONTH_DAY_YEAR)
61
+ children: C(m(e.date), S.FULL_MONTH_DAY_YEAR)
63
62
  }),
64
63
  slotProps: { primary: {
65
64
  variant: "caption",
@@ -67,43 +66,38 @@ var dt = ({ transaction: e }) => {
67
66
  fontWeight: "normal"
68
67
  } }
69
68
  }),
70
- /* @__PURE__ */ t(w, { children: /* @__PURE__ */ t(d, {
69
+ /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(c, {
71
70
  name: "chevron_right",
72
71
  sx: { color: "text.primary" }
73
72
  }) })
74
73
  ]
75
- }), /* @__PURE__ */ t(L, {
76
- ariaLabelClose: o.close_aria,
77
- isOpen: u,
74
+ }), /* @__PURE__ */ t(D, {
75
+ ariaLabelClose: r.close_aria,
76
+ isOpen: _,
78
77
  onClose: () => a(!1),
79
78
  onPrimaryAction: y,
80
- primaryText: o.save_button,
81
- secondaryText: o.cancel_button,
82
- title: r.date_edit_title,
83
- children: /* @__PURE__ */ t(E, {
79
+ primaryText: r.save_button,
80
+ secondaryText: r.cancel_button,
81
+ title: o.date_edit_title,
82
+ children: /* @__PURE__ */ t(O, {
84
83
  alignItems: "center",
85
84
  mt: 40,
86
- children: /* @__PURE__ */ t(K, {
87
- dateAdapter: F,
88
- localeText: {
89
- nextMonth: r.date_next_aria,
90
- previousMonth: r.date_prev_aria,
91
- todayButtonLabel: o.date_range_picker.today
85
+ children: /* @__PURE__ */ t(I, {
86
+ beginDate: m(i),
87
+ copy: {
88
+ nextAria: o.date_next_aria,
89
+ prevAria: o.date_prev_aria,
90
+ today: r.date_range_picker.today
92
91
  },
93
- children: /* @__PURE__ */ t(Y, {
94
- displayStaticWrapperAs: "desktop",
95
- onChange: x,
96
- slotProps: { actionBar: { actions: ["today"] } },
97
- value: s(i),
98
- views: ["day"]
99
- })
92
+ onDateSelected: u,
93
+ selectionType: h.Single
100
94
  })
101
95
  })
102
96
  })]
103
97
  });
104
98
  };
105
99
  export {
106
- dt as default
100
+ st as default
107
101
  };
108
102
 
109
103
  //# sourceMappingURL=DateAction.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateAction.es.js","names":[],"sources":["../../../../../../src/transactions/components/shared/transactiondetails/actions/DateAction.tsx"],"sourcesContent":["import React from 'react'\n\nimport Avatar from '@mui/material/Avatar'\nimport Stack from '@mui/material/Stack'\nimport ListItem from '@mui/material/ListItem'\nimport ListItemAvatar from '@mui/material/ListItemAvatar'\nimport ListItemButton from '@mui/material/ListItemButton'\nimport ListItemIcon from '@mui/material/ListItemIcon'\nimport ListItemText from '@mui/material/ListItemText'\nimport { useTheme } from '@mui/material/styles'\nimport { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3'\nimport { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'\nimport { StaticDatePicker } from '@mui/x-date-pickers/StaticDatePicker'\n\nimport { Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport {\n ANALYTICS_EVENTS,\n Drawer,\n useEvent,\n useGlobalCopyStore,\n useTransactionStore,\n} from '../../../../../common'\n\nimport { DATE_FORMATS_INTL, formatDate } from '../../../../../core/constants'\nimport { fromUnixUTC, toUnixUTC } from '../../../../../core/utils/DateUtil'\nimport type { Transaction } from '../../../../../core'\n\nimport { useTransactionsUiStore } from '../../../../context/hooks'\nimport { ON_CLICK_EVENTS } from '../../../../constants/OnClickEvents'\n\ninterface DateActionProps {\n transaction: Transaction\n}\n\nconst DateAction: React.FC<DateActionProps> = ({ transaction }) => {\n const { onEvent } = useEvent()\n const { updateTransaction } = useTransactionStore()\n const { updateManualTransaction } = useTransactionsUiStore()\n const { common: commonCopy, transactions: copy } = useGlobalCopyStore()\n\n const theme = useTheme()\n const [open, setOpen] = React.useState(false)\n const [date, setDate] = React.useState<number>(transaction.date)\n\n const handleDateSelected = (selectedDate: Date | null) => {\n if (selectedDate) setDate(toUnixUTC(selectedDate))\n }\n\n const handleSave = async () => {\n if (transaction.is_manual && !transaction.guid) {\n updateManualTransaction({ ...transaction, date })\n setOpen(false)\n return\n }\n\n await updateTransaction({ ...transaction, date })\n onEvent(ANALYTICS_EVENTS.TRANSACTION_DETAILS_CLICK_DATE, { transaction_guid: transaction.guid })\n setOpen(false)\n }\n\n const bgColor = theme.palette.mode === 'dark' ? 'grey.800' : 'grey.100'\n\n return (\n <ListItem className=\"mx-txn-date-action\" disableGutters={true} disablePadding={true}>\n <ListItemButton\n onClick={() => {\n onEvent(ON_CLICK_EVENTS.ON_TRANSACTION_DATE_CLICK)\n setOpen(true)\n }}\n >\n <ListItemAvatar>\n <Avatar sx={{ bgcolor: bgColor }} variant=\"rounded\">\n <Icon name=\"calendar_month\" sx={{ color: 'text.primary' }} />\n </Avatar>\n </ListItemAvatar>\n <ListItemText\n primary={copy.date_title}\n secondary={\n <Text bold={true} sx={{ color: 'text.primary' }} variant=\"body1\">\n {formatDate(fromUnixUTC(transaction.date), DATE_FORMATS_INTL.FULL_MONTH_DAY_YEAR)}\n </Text>\n }\n slotProps={{ primary: { variant: 'caption', fontSize: 11, fontWeight: 'normal' } }}\n />\n <ListItemIcon>\n <Icon name=\"chevron_right\" sx={{ color: 'text.primary' }} />\n </ListItemIcon>\n </ListItemButton>\n\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={open}\n onClose={() => setOpen(false)}\n onPrimaryAction={handleSave}\n primaryText={commonCopy.save_button}\n secondaryText={commonCopy.cancel_button}\n title={copy.date_edit_title}\n >\n <Stack alignItems=\"center\" mt={40}>\n <LocalizationProvider\n dateAdapter={AdapterDateFns}\n localeText={{\n nextMonth: copy.date_next_aria,\n previousMonth: copy.date_prev_aria,\n todayButtonLabel: commonCopy.date_range_picker.today,\n }}\n >\n <StaticDatePicker\n displayStaticWrapperAs=\"desktop\"\n onChange={handleDateSelected}\n slotProps={{ actionBar: { actions: ['today'] } }}\n value={fromUnixUTC(date)}\n views={['day']}\n />\n </LocalizationProvider>\n </Stack>\n </Drawer>\n </ListItem>\n )\n}\n\nexport default DateAction\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoCA,IAAM,KAAA,CAAyC,EAAE,aAAA,EAAA,MAAkB;AACjE,QAAM,EAAE,SAAA,EAAA,IAAY,EAAS,GACvB,EAAE,mBAAA,EAAA,IAAsB,EAAoB,GAC5C,EAAE,yBAAA,EAAA,IAA4B,EAAuB,GACrD,EAAE,QAAQ,GAAY,cAAc,EAAA,IAAS,EAAmB,GAEhE,IAAQ,EAAS,GACjB,CAAC,GAAM,CAAA,IAAW,EAAM,SAAS,EAAK,GACtC,CAAC,GAAM,CAAA,IAAW,EAAM,SAAiB,EAAY,IAAI,GAEzD,IAAA,CAAsB,MAA8B;AACxD,IAAI,KAAc,EAAQ,EAAU,CAAY,CAAC;AAAA,EACnD,GAEM,IAAa,YAAY;AAC7B,QAAI,EAAY,aAAa,CAAC,EAAY,MAAM;AAC9C,MAAA,EAAwB;AAAA,QAAE,GAAG;AAAA,QAAa,MAAA;AAAA,MAAK,CAAC,GAChD,EAAQ,EAAK;AACb;AAAA,IACF;AAEA,UAAM,EAAkB;AAAA,MAAE,GAAG;AAAA,MAAa,MAAA;AAAA,IAAK,CAAC,GAChD,EAAQ,EAAiB,gCAAgC,EAAE,kBAAkB,EAAY,KAAK,CAAC,GAC/F,EAAQ,EAAK;AAAA,EACf,GAEM,IAAU,EAAM,QAAQ,SAAS,SAAS,aAAa;AAE7D,SACE,gBAAA,EAAC,GAAD;AAAA,IAAU,WAAU;AAAA,IAAqB,gBAAgB;AAAA,IAAM,gBAAgB;AAAA,IAA/E,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MACE,SAAA,MAAe;AACb,QAAA,EAAQ,EAAgB,yBAAyB,GACjD,E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AK;AAAA,YACpB,kBAAkB,EAAW,kBAAkB;AAAA,UACjD;AAAA,UAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,YACE,wBAAuB;AAAA,YACvB,UAAU;AAAA,YACV,WAAW,EAAE,WAAW,EAAE,SAAS,CAAC,OAAO,EAAE,EAAE;AAAA,YAC/C,OAAO,EAAY,CAAI;AAAA,YACvB,OAAO,CAAC,KAAK;AAAA,UACd,CAAA;AAAA,QACmB,CAAA;AAAA,MACjB,CAAA;AAAA,IACD,CAAA,CACA;AAAA;AAEd"}
1
+ {"version":3,"file":"DateAction.es.js","names":[],"sources":["../../../../../../src/transactions/components/shared/transactiondetails/actions/DateAction.tsx"],"sourcesContent":["import React from 'react'\nimport { getUnixTime } from 'date-fns/getUnixTime'\n\nimport Avatar from '@mui/material/Avatar'\nimport Stack from '@mui/material/Stack'\nimport ListItem from '@mui/material/ListItem'\nimport ListItemAvatar from '@mui/material/ListItemAvatar'\nimport ListItemButton from '@mui/material/ListItemButton'\nimport ListItemIcon from '@mui/material/ListItemIcon'\nimport ListItemText from '@mui/material/ListItemText'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport {\n ANALYTICS_EVENTS,\n Calendar,\n CalendarSelectionTypes,\n Drawer,\n useEvent,\n useGlobalCopyStore,\n useTransactionStore,\n} from '../../../../../common'\n\nimport { DATE_FORMATS_INTL, formatDate } from '../../../../../core/constants'\nimport { fromUnixUTC } from '../../../../../core/utils/DateUtil'\nimport type { Transaction } from '../../../../../core'\n\nimport { useTransactionsUiStore } from '../../../../context/hooks'\nimport { ON_CLICK_EVENTS } from '../../../../constants/OnClickEvents'\n\ninterface DateActionProps {\n transaction: Transaction\n}\n\nconst DateAction: React.FC<DateActionProps> = ({ transaction }) => {\n const { onEvent } = useEvent()\n const { updateTransaction } = useTransactionStore()\n const { updateManualTransaction } = useTransactionsUiStore()\n const { common: commonCopy, transactions: copy } = useGlobalCopyStore()\n\n const theme = useTheme()\n const [open, setOpen] = React.useState(false)\n const [date, setDate] = React.useState<number>(transaction.date)\n\n const handleDateSelected = (date: Date) => {\n setDate(getUnixTime(date))\n }\n\n const handleSave = async () => {\n if (transaction.is_manual && !transaction.guid) {\n updateManualTransaction({ ...transaction, date })\n setOpen(false)\n return\n }\n\n await updateTransaction({ ...transaction, date })\n onEvent(ANALYTICS_EVENTS.TRANSACTION_DETAILS_CLICK_DATE, { transaction_guid: transaction.guid })\n setOpen(false)\n }\n\n const bgColor = theme.palette.mode === 'dark' ? 'grey.800' : 'grey.100'\n\n return (\n <ListItem className=\"mx-txn-date-action\" disableGutters={true} disablePadding={true}>\n <ListItemButton\n onClick={() => {\n onEvent(ON_CLICK_EVENTS.ON_TRANSACTION_DATE_CLICK)\n setOpen(true)\n }}\n >\n <ListItemAvatar>\n <Avatar sx={{ bgcolor: bgColor }} variant=\"rounded\">\n <Icon name=\"calendar_month\" sx={{ color: 'text.primary' }} />\n </Avatar>\n </ListItemAvatar>\n <ListItemText\n primary={copy.date_title}\n secondary={\n <Text bold={true} sx={{ color: 'text.primary' }} variant=\"body1\">\n {formatDate(fromUnixUTC(transaction.date), DATE_FORMATS_INTL.FULL_MONTH_DAY_YEAR)}\n </Text>\n }\n slotProps={{ primary: { variant: 'caption', fontSize: 11, fontWeight: 'normal' } }}\n />\n <ListItemIcon>\n <Icon name=\"chevron_right\" sx={{ color: 'text.primary' }} />\n </ListItemIcon>\n </ListItemButton>\n\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={open}\n onClose={() => setOpen(false)}\n onPrimaryAction={handleSave}\n primaryText={commonCopy.save_button}\n secondaryText={commonCopy.cancel_button}\n title={copy.date_edit_title}\n >\n <Stack alignItems=\"center\" mt={40}>\n <Calendar\n beginDate={fromUnixUTC(date)}\n copy={{\n nextAria: copy.date_next_aria,\n prevAria: copy.date_prev_aria,\n today: commonCopy.date_range_picker.today,\n }}\n onDateSelected={handleDateSelected}\n select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CAAA;AAAA,MACI,CAAA;AAAA,IACD,CAAA,CACA;AAAA;AAEd"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "9.4.52-alpha.al0",
3
+ "version": "9.4.53",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",
@@ -220,7 +220,7 @@
220
220
  "@mui/x-date-pickers-pro": "^7.29.4",
221
221
  "@mxenabled/cssinjs": "^0.6.0",
222
222
  "@mxenabled/mx-icons": "^2.3.0",
223
- "@mxenabled/mxui": "^2.10.1",
223
+ "@mxenabled/mxui": "^2.9.2",
224
224
  "@mxenabled/web-widget-sdk": "^0.0.15",
225
225
  "@tanstack/react-virtual": "^3.14.9",
226
226
  "bowser": "^2.14.1",