@mx-cartographer/experiences 9.7.24 → 9.7.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/common/components/MiniWidgetContainer.es.js +35 -45
  3. package/dist/common/components/MiniWidgetContainer.es.js.map +1 -1
  4. package/dist/common/components/charts/LineChart.es.js +86 -85
  5. package/dist/common/components/charts/LineChart.es.js.map +1 -1
  6. package/dist/common/constants/Styles.d.ts +2 -0
  7. package/dist/common/constants/Styles.es.js +17 -0
  8. package/dist/common/constants/Styles.es.js.map +1 -0
  9. package/dist/common/constants/index.d.ts +1 -0
  10. package/dist/common/hooks/useAriaLive.es.js +12 -22
  11. package/dist/common/hooks/useAriaLive.es.js.map +1 -1
  12. package/dist/common/index.es.js +111 -109
  13. package/dist/core/stores/TrendsStore.d.ts +5 -0
  14. package/dist/core/utils/DateUtil.d.ts +2 -0
  15. package/dist/core/utils/DateUtil.es.js +37 -35
  16. package/dist/core/utils/DateUtil.es.js.map +1 -1
  17. package/dist/core/utils/NumberFormatting.d.ts +1 -0
  18. package/dist/core/utils/NumberFormatting.es.js +14 -13
  19. package/dist/core/utils/NumberFormatting.es.js.map +1 -1
  20. package/dist/core/utils/TrendsUtil.d.ts +5 -0
  21. package/dist/core/utils/TrendsUtil.es.js +67 -59
  22. package/dist/core/utils/TrendsUtil.es.js.map +1 -1
  23. package/dist/insights-v2/components/BaseLayout.es.js +47 -48
  24. package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
  25. package/dist/transactions/components/shared/TransactionList.d.ts +4 -0
  26. package/dist/transactions/components/shared/TransactionList.es.js +138 -84
  27. package/dist/transactions/components/shared/TransactionList.es.js.map +1 -1
  28. package/dist/trends/components/CategoryDetailChart.d.ts +2 -1
  29. package/dist/trends/components/CategoryDetailChart.es.js +55 -35
  30. package/dist/trends/components/CategoryDetailChart.es.js.map +1 -1
  31. package/dist/trends/components/CategoryDetails.es.js +68 -71
  32. package/dist/trends/components/CategoryDetails.es.js.map +1 -1
  33. package/dist/trends/utils/TrendsTable.es.js +25 -25
  34. package/dist/trends/utils/TrendsTable.es.js.map +1 -1
  35. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"CategoryDetails.es.js","names":[],"sources":["../../../src/trends/components/CategoryDetails.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport List from '@mui/material/List'\nimport ListItem from '@mui/material/ListItem'\nimport ListItemAvatar from '@mui/material/ListItemAvatar'\nimport ListItemText from '@mui/material/ListItemText'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { CategoryIcon, Text } from '@mxenabled/mxui'\n\nimport {\n Drawer,\n useAppConfig,\n useGlobalCopyStore,\n useTrendsStore,\n useTransactionStore,\n useScreenSize,\n} from '../../common'\nimport { type Transaction } from '../../core'\n\nimport { getCategoryColor } from '../../core/utils/CategoryUtil'\nimport { ExportCsvAction, TransactionDetails, TransactionList } from '../../transactions'\n\nimport CategoryDetailChart from './CategoryDetailChart'\nimport { formatCurrency } from '../../core/utils/NumberFormatting'\n\nexport const CategoryDetails = observer(() => {\n const theme = useTheme()\n const { is_mobile_webview } = useAppConfig()\n const { isDesktop, isSmallTablet, isTablet } = useScreenSize()\n const { common: commonCopy, trends: copy } = useGlobalCopyStore()\n const { selectedCategoryData, selectedDateRangeMonthRange } = useTrendsStore()\n const { sortedTransactions: transactions } = useTransactionStore()\n\n const [transactionGuid, setTransactionGuid] = React.useState<string | null>(null)\n\n if (!selectedCategoryData) {\n return null\n }\n\n const { guid, name, is_income, totalAmount } = selectedCategoryData\n\n const chartColor = getCategoryColor(guid, theme)\n const chartLabel = is_income ? copy.income_label : copy.spending_label\n const transactionCountLabel = ` ${\n selectedCategoryData.transactions.length === 1 ? copy.transaction : copy.transactions\n } (${selectedCategoryData.transactions.length})`\n\n const transaction = React.useMemo(\n () => transactions.find((t) => t.guid === transactionGuid),\n [transactionGuid, transactions],\n )\n\n const shouldShowExportButton =\n transactions.length > 0 && !is_mobile_webview && (isDesktop || (isTablet && !isSmallTablet))\n\n const categoryFilter = (t: Transaction) =>\n t.category_guid === guid || t.top_level_category_guid === guid\n\n return (\n <Stack sx={{ alignItems: 'center', height: '100%' }}>\n <Stack\n sx={{ bgcolor: 'background.paper', borderRadius: 0, pb: 4, pt: 16, px: 12, width: '100%' }}\n >\n <List sx={{ px: 12 }}>\n <ListItem>\n <ListItemAvatar>\n <CategoryIcon categoryGuid={guid} />\n </ListItemAvatar>\n <ListItemText\n primary={name}\n secondary={selectedDateRangeMonthRange}\n slotProps={{\n primary: { component: 'div', variant: 'h3', fontSize: 18, fontWeight: 700 },\n secondary: { component: 'div', variant: 'body2', fontSize: 13 },\n }}\n />\n <Text component=\"div\" variant=\"h3\">\n {formatCurrency(Math.abs(totalAmount), '0,0.00')}\n </Text>\n </ListItem>\n </List>\n\n <CategoryDetailChart chartColor={chartColor} chartLabel={chartLabel} />\n\n <Stack alignItems=\"center\" direction=\"row\" justifyContent=\"space-between\" sx={{ mx: 12 }}>\n <Text bold={true} variant=\"body1\">\n {transactionCountLabel}\n </Text>\n {shouldShowExportButton && <ExportCsvAction filter={categoryFilter} />}\n </Stack>\n </Stack>\n <TransactionList\n filter={categoryFilter}\n height=\"calc(100vh - 475px)\"\n onClick={setTransactionGuid}\n />\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={Boolean(transaction)}\n onClose={() => setTransactionGuid('')}\n title={copy.transaction}\n >\n {transaction && <TransactionDetails transaction={transaction} />}\n </Drawer>\n </Stack>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4BA,IAAa,KAAkB,EAAA,MAAe;AAC5C,QAAM,IAAQ,EAAS,GACjB,EAAE,mBAAA,EAAA,IAAsB,EAAa,GACrC,EAAE,WAAA,GAAW,eAAA,GAAe,UAAA,EAAA,IAAa,EAAc,GACvD,EAAE,QAAQ,GAAY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"version":3,"file":"CategoryDetails.es.js","names":[],"sources":["../../../src/trends/components/CategoryDetails.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport List from '@mui/material/List'\nimport ListItem from '@mui/material/ListItem'\nimport ListItemAvatar from '@mui/material/ListItemAvatar'\nimport ListItemText from '@mui/material/ListItemText'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { CategoryIcon, Text } from '@mxenabled/mxui'\n\nimport {\n Drawer,\n useAppConfig,\n useGlobalCopyStore,\n useTrendsStore,\n useTransactionStore,\n useScreenSize,\n} from '../../common'\nimport { type Transaction } from '../../core'\n\nimport { getCategoryColor } from '../../core/utils/CategoryUtil'\nimport { ExportCsvAction, TransactionDetails, TransactionList } from '../../transactions'\n\nimport CategoryDetailChart from './CategoryDetailChart'\nimport { formatCurrency } from '../../core/utils/NumberFormatting'\n\nexport const CategoryDetails = observer(() => {\n const theme = useTheme()\n const { is_mobile_webview } = useAppConfig()\n const { isDesktop, isSmallTablet, isTablet } = useScreenSize()\n const { common: commonCopy, trends: copy } = useGlobalCopyStore()\n const { selectedCategoryData, selectedDateRangeMonthRange } = useTrendsStore()\n const { sortedTransactions: transactions } = useTransactionStore()\n\n const [transactionGuid, setTransactionGuid] = React.useState<string | null>(null)\n\n if (!selectedCategoryData) {\n return null\n }\n\n const { guid, name, is_income, totalAmount } = selectedCategoryData\n\n const chartColor = getCategoryColor(guid, theme)\n const chartLabel = is_income ? copy.income_label : copy.spending_label\n const chartTitle = `${name}, ${is_income ? copy.monthly_income : copy.monthly_spending}`\n const transactionCountLabel = ` ${\n selectedCategoryData.transactions.length === 1 ? copy.transaction : copy.transactions\n } (${selectedCategoryData.transactions.length})`\n\n const transaction = React.useMemo(\n () => transactions.find((t) => t.guid === transactionGuid),\n [transactionGuid, transactions],\n )\n\n const shouldShowExportButton =\n transactions.length > 0 && !is_mobile_webview && (isDesktop || (isTablet && !isSmallTablet))\n\n const categoryFilter = (t: Transaction) =>\n t.category_guid === guid || t.top_level_category_guid === guid\n\n return (\n <Stack sx={{ alignItems: 'center' }}>\n <Stack sx={{ bgcolor: 'background.paper', borderRadius: 0, pt: 16, px: 12, width: '100%' }}>\n <List sx={{ px: 12 }}>\n <ListItem>\n <ListItemAvatar>\n <CategoryIcon categoryGuid={guid} />\n </ListItemAvatar>\n <ListItemText\n primary={name}\n secondary={selectedDateRangeMonthRange}\n slotProps={{\n primary: { component: 'div', variant: 'h3', fontSize: 18, fontWeight: 700 },\n secondary: { component: 'div', variant: 'body2', fontSize: 13 },\n }}\n />\n <Text component=\"div\" variant=\"h3\">\n {formatCurrency(Math.abs(totalAmount), '0,0.00')}\n </Text>\n </ListItem>\n </List>\n\n <CategoryDetailChart\n chartColor={chartColor}\n chartLabel={chartLabel}\n chartTitle={chartTitle}\n />\n </Stack>\n <TransactionList\n filter={categoryFilter}\n onClick={setTransactionGuid}\n scrollsWithParent={true}\n stickyHeader={\n <Stack\n alignItems=\"center\"\n direction=\"row\"\n justifyContent=\"space-between\"\n sx={{ px: 24, py: 4 }}\n >\n <Text bold={true} variant=\"body1\">\n {transactionCountLabel}\n </Text>\n {shouldShowExportButton && <ExportCsvAction filter={categoryFilter} />}\n </Stack>\n }\n />\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={Boolean(transaction)}\n onClose={() => setTransactionGuid('')}\n title={copy.transaction}\n >\n {transaction && <TransactionDetails transaction={transaction} />}\n </Drawer>\n </Stack>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4BA,IAAa,KAAkB,EAAA,MAAe;AAC5C,QAAM,IAAQ,EAAS,GACjB,EAAE,mBAAA,EAAA,IAAsB,EAAa,GACrC,EAAE,WAAA,GAAW,eAAA,GAAe,UAAA,EAAA,IAAa,EAAc,GACvD,EAAE,QAAQ,GAAY,QAAQ,EAAA,IAAS,EAAmB,GAC1D,EAAE,sBAAA,GAAsB,6BAAA,EAAA,IAAgC,EAAe,GACvE,EAA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DATE_FORMATS_INTL as d, formatDate as u } from "../../core/constants/DateFormats.es.js";
3
- import { amountComparator as i, categoryComparator as p } from "../../core/utils/TrendsUtil.es.js";
1
+ import { buildDynamicCopy as _ } from "../../core/utils/Localization.es.js";
2
+ import { DATE_FORMATS_INTL as d, formatDate as g } from "../../core/constants/DateFormats.es.js";
3
+ import { formatIsoDate as f } from "../../core/utils/DateUtil.es.js";
4
+ import { amountComparator as u, categoryComparator as p } from "../../core/utils/TrendsUtil.es.js";
4
5
  import { HeaderCell as s } from "../components/trendstable/HeaderCell.es.js";
5
6
  import { CategoryCell as b } from "../components/trendstable/CategoryCell.es.js";
6
- import { AmountCell as c } from "../components/trendstable/AmountCell.es.js";
7
- import { parseISO as _ } from "date-fns/parseISO";
8
- var h = (n, o) => {
9
- const r = u(_(o.isoDate), d.MONTH_LONG);
7
+ import { AmountCell as i } from "../components/trendstable/AmountCell.es.js";
8
+ var c = (n, o) => {
9
+ const r = f(o.isoDate, d.MONTH_LONG);
10
10
  return n[r] = o.amount, n;
11
- }, f = (n) => (o, r) => {
12
- const a = u(_(r.isoDate), d.MONTH_LONG);
11
+ }, h = (n) => (o, r) => {
12
+ const a = f(r.isoDate, d.MONTH_LONG);
13
13
  return o + (n.includes(a) ? r.amount : 0);
14
- }, O = (n, o) => {
14
+ }, M = (n, o) => {
15
15
  const r = [], a = new Date(n);
16
16
  for (; a <= o; ) {
17
- const e = u(a, d.MONTH_LONG);
17
+ const e = g(a, d.MONTH_LONG);
18
18
  r.push(e), a.setMonth(a.getMonth() + 1);
19
19
  }
20
20
  return r;
21
- }, D = (n, o) => {
21
+ }, H = (n, o) => {
22
22
  const r = {
23
23
  field: "category",
24
24
  flex: 1,
@@ -37,13 +37,13 @@ var h = (n, o) => {
37
37
  headerName: l,
38
38
  minWidth: 100,
39
39
  renderHeader: s,
40
- renderCell: c,
40
+ renderCell: i,
41
41
  align: "center",
42
42
  headerAlign: "center",
43
43
  sortable: !0,
44
44
  hideSortIcons: !1,
45
45
  type: "number",
46
- sortComparator: i,
46
+ sortComparator: u,
47
47
  valueGetter: (t, m) => m.monthlyAmounts?.[l] ?? 0
48
48
  })), e = {
49
49
  field: "total",
@@ -52,20 +52,20 @@ var h = (n, o) => {
52
52
  headerName: o.table_column_total,
53
53
  minWidth: 100,
54
54
  renderHeader: s,
55
- renderCell: c,
55
+ renderCell: i,
56
56
  align: "center",
57
57
  headerAlign: "center",
58
58
  sortable: !0,
59
59
  hideSortIcons: !1,
60
60
  type: "number",
61
- sortComparator: i
61
+ sortComparator: u
62
62
  };
63
63
  return [
64
64
  r,
65
65
  ...a,
66
66
  e
67
67
  ];
68
- }, H = (n, o, r, a, e) => {
68
+ }, O = (n, o, r, a, e) => {
69
69
  const l = n.filter((t) => t.is_income === r).map((t) => {
70
70
  let m = t.totalMonthlyAmounts;
71
71
  return e && (m = t.monthlyAmounts), {
@@ -74,28 +74,28 @@ var h = (n, o) => {
74
74
  category_guid: t.guid,
75
75
  isParent: !1,
76
76
  top_level_category_guid: t.parent_guid || t.guid,
77
- total: m.reduce(f(a), 0),
78
- monthlyAmounts: m.reduce(h, {})
77
+ total: m.reduce(h(a), 0),
78
+ monthlyAmounts: m.reduce(c, {})
79
79
  };
80
80
  });
81
81
  if (e && e.is_income === r) {
82
- const t = e.monthlyAmounts.reduce(f(a), 0);
82
+ const t = e.monthlyAmounts.reduce(h(a), 0);
83
83
  t !== 0 && l.push({
84
84
  id: `sub-${e.guid}`,
85
- category: g(o.category_general, e.name),
85
+ category: _(o.category_general, e.name),
86
86
  category_guid: e.guid,
87
87
  isParent: !0,
88
88
  top_level_category_guid: e.guid,
89
89
  total: t,
90
- monthlyAmounts: e.monthlyAmounts.reduce(h, {})
90
+ monthlyAmounts: e.monthlyAmounts.reduce(c, {})
91
91
  });
92
92
  }
93
93
  return l;
94
94
  };
95
95
  export {
96
- O as generateMonthHeaders,
97
- D as getTrendsTableColumns,
98
- H as getTrendsTableRows
96
+ M as generateMonthHeaders,
97
+ H as getTrendsTableColumns,
98
+ O as getTrendsTableRows
99
99
  };
100
100
 
101
101
  //# sourceMappingURL=TrendsTable.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TrendsTable.es.js","names":[],"sources":["../../../src/trends/utils/TrendsTable.ts"],"sourcesContent":["import { parseISO } from 'date-fns/parseISO'\nimport { GridColDef } from '@mui/x-data-grid-pro'\nimport { HeaderCell } from '../components/trendstable/HeaderCell'\nimport { CategoryCell } from '../components/trendstable/CategoryCell'\nimport { amountComparator, categoryComparator } from '../../core/utils/TrendsUtil'\nimport { AmountCell } from '../components/trendstable/AmountCell'\nimport { DATE_FORMATS_INTL, formatDate } from '../../core/constants'\nimport { DetailedCategory, type MonthlyAmount, TrendsCopy } from '../../core'\nimport { buildDynamicCopy } from '../../core/utils/Localization'\n\nconst amountsReducer = (records: Record<string, number>, monthlyAmount: MonthlyAmount) => {\n const monthHeader = formatDate(parseISO(monthlyAmount.isoDate), DATE_FORMATS_INTL.MONTH_LONG)\n records[monthHeader] = monthlyAmount.amount\n return records\n}\n\nconst totalReducer = (monthHeaders: string[]) => (sum: number, ma: MonthlyAmount) => {\n const monthHeader = formatDate(parseISO(ma.isoDate), DATE_FORMATS_INTL.MONTH_LONG)\n return sum + (monthHeaders.includes(monthHeader) ? ma.amount : 0)\n}\n\nexport const generateMonthHeaders = (start: Date, end: Date): string[] => {\n const result: string[] = []\n const current = new Date(start)\n\n while (current <= end) {\n const formattedDate = formatDate(current, DATE_FORMATS_INTL.MONTH_LONG)\n result.push(formattedDate)\n current.setMonth(current.getMonth() + 1)\n }\n\n return result\n}\n\nexport const getTrendsTableColumns = (monthHeaders: string[], copy: TrendsCopy) => {\n const categoryColumn: GridColDef = {\n field: 'category',\n flex: 1,\n headerClassName: 'trends-table-header',\n headerName: copy.category_title,\n minWidth: 210,\n renderHeader: HeaderCell,\n renderCell: CategoryCell,\n sortable: true,\n sortComparator: categoryComparator,\n type: 'string',\n }\n\n const monthColumns: GridColDef[] = monthHeaders.map((monthHeader) => ({\n field: monthHeader,\n flex: 1,\n headerClassName: 'trends-table-header',\n headerName: monthHeader,\n minWidth: 100,\n renderHeader: HeaderCell,\n renderCell: AmountCell,\n align: 'center',\n headerAlign: 'center',\n sortable: true,\n hideSortIcons: false,\n type: 'number',\n sortComparator: amountComparator,\n valueGetter: (_value: unknown, row: TrendsTableRow) => row.monthlyAmounts?.[monthHeader] ?? 0,\n }))\n\n const totalColumn: GridColDef = {\n field: 'total',\n flex: 1,\n headerClassName: 'trends-table-header',\n headerName: copy.table_column_total,\n minWidth: 100,\n renderHeader: HeaderCell,\n renderCell: AmountCell,\n align: 'center',\n headerAlign: 'center',\n sortable: true,\n hideSortIcons: false,\n type: 'number',\n sortComparator: amountComparator,\n }\n\n return [categoryColumn, ...monthColumns, totalColumn]\n}\n\nexport type TrendsTableRow = {\n id: string\n category: string\n category_guid: string\n isParent: boolean\n top_level_category_guid: string\n total: number\n monthlyAmounts: Record<string, number>\n}\n\nexport const getTrendsTableRows = (\n categories: DetailedCategory[],\n copy: TrendsCopy,\n isIncome: boolean,\n monthHeaders: string[],\n parentCategory?: DetailedCategory,\n): TrendsTableRow[] => {\n const categoryRows = categories\n .filter((category) => category.is_income === isIncome)\n .map((category) => {\n let amounts = category.totalMonthlyAmounts\n if (parentCategory) {\n amounts = category.monthlyAmounts\n }\n\n return {\n id: category.guid,\n category: category.name,\n category_guid: category.guid,\n isParent: false,\n top_level_category_guid: category.parent_guid || category.guid,\n total: amounts.reduce(totalReducer(monthHeaders), 0),\n monthlyAmounts: amounts.reduce(amountsReducer, {}),\n }\n })\n\n // Add General category row when viewing sub-categories\n if (parentCategory && parentCategory.is_income === isIncome) {\n const total = parentCategory.monthlyAmounts.reduce(totalReducer(monthHeaders), 0)\n if (total !== 0) {\n categoryRows.push({\n id: `sub-${parentCategory.guid}`,\n category: buildDynamicCopy(copy.category_general, parentCategory.name) as string,\n category_guid: parentCategory.guid,\n isParent: true,\n top_level_category_guid: parentCategory.guid,\n total,\n monthlyAmounts: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}
1
+ {"version":3,"file":"TrendsTable.es.js","names":[],"sources":["../../../src/trends/utils/TrendsTable.ts"],"sourcesContent":["import { GridColDef } from '@mui/x-data-grid-pro'\nimport { HeaderCell } from '../components/trendstable/HeaderCell'\nimport { CategoryCell } from '../components/trendstable/CategoryCell'\nimport { amountComparator, categoryComparator } from '../../core/utils/TrendsUtil'\nimport { AmountCell } from '../components/trendstable/AmountCell'\nimport { DATE_FORMATS_INTL, formatDate } from '../../core/constants'\nimport { formatIsoDate } from '../../core/utils/DateUtil'\nimport { DetailedCategory, type MonthlyAmount, TrendsCopy } from '../../core'\nimport { buildDynamicCopy } from '../../core/utils/Localization'\n\nconst amountsReducer = (records: Record<string, number>, monthlyAmount: MonthlyAmount) => {\n const monthHeader = formatIsoDate(monthlyAmount.isoDate, DATE_FORMATS_INTL.MONTH_LONG)\n records[monthHeader] = monthlyAmount.amount\n return records\n}\n\nconst totalReducer = (monthHeaders: string[]) => (sum: number, ma: MonthlyAmount) => {\n const monthHeader = formatIsoDate(ma.isoDate, DATE_FORMATS_INTL.MONTH_LONG)\n return sum + (monthHeaders.includes(monthHeader) ? ma.amount : 0)\n}\n\nexport const generateMonthHeaders = (start: Date, end: Date): string[] => {\n const result: string[] = []\n const current = new Date(start)\n\n while (current <= end) {\n const formattedDate = formatDate(current, DATE_FORMATS_INTL.MONTH_LONG)\n result.push(formattedDate)\n current.setMonth(current.getMonth() + 1)\n }\n\n return result\n}\n\nexport const getTrendsTableColumns = (monthHeaders: string[], copy: TrendsCopy) => {\n const categoryColumn: GridColDef = {\n field: 'category',\n flex: 1,\n headerClassName: 'trends-table-header',\n headerName: copy.category_title,\n minWidth: 210,\n renderHeader: HeaderCell,\n renderCell: CategoryCell,\n sortable: true,\n sortComparator: categoryComparator,\n type: 'string',\n }\n\n const monthColumns: GridColDef[] = monthHeaders.map((monthHeader) => ({\n field: monthHeader,\n flex: 1,\n headerClassName: 'trends-table-header',\n headerName: monthHeader,\n minWidth: 100,\n renderHeader: HeaderCell,\n renderCell: AmountCell,\n align: 'center',\n headerAlign: 'center',\n sortable: true,\n hideSortIcons: false,\n type: 'number',\n sortComparator: amountComparator,\n valueGetter: (_value: unknown, row: TrendsTableRow) => row.monthlyAmounts?.[monthHeader] ?? 0,\n }))\n\n const totalColumn: GridColDef = {\n field: 'total',\n flex: 1,\n headerClassName: 'trends-table-header',\n headerName: copy.table_column_total,\n minWidth: 100,\n renderHeader: HeaderCell,\n renderCell: AmountCell,\n align: 'center',\n headerAlign: 'center',\n sortable: true,\n hideSortIcons: false,\n type: 'number',\n sortComparator: amountComparator,\n }\n\n return [categoryColumn, ...monthColumns, totalColumn]\n}\n\nexport type TrendsTableRow = {\n id: string\n category: string\n category_guid: string\n isParent: boolean\n top_level_category_guid: string\n total: number\n monthlyAmounts: Record<string, number>\n}\n\nexport const getTrendsTableRows = (\n categories: DetailedCategory[],\n copy: TrendsCopy,\n isIncome: boolean,\n monthHeaders: string[],\n parentCategory?: DetailedCategory,\n): TrendsTableRow[] => {\n const categoryRows = categories\n .filter((category) => category.is_income === isIncome)\n .map((category) => {\n let amounts = category.totalMonthlyAmounts\n if (parentCategory) {\n amounts = category.monthlyAmounts\n }\n\n return {\n id: category.guid,\n category: category.name,\n category_guid: category.guid,\n isParent: false,\n top_level_category_guid: category.parent_guid || category.guid,\n total: amounts.reduce(totalReducer(monthHeaders), 0),\n monthlyAmounts: amounts.reduce(amountsReducer, {}),\n }\n })\n\n // Add General category row when viewing sub-categories\n if (parentCategory && parentCategory.is_income === isIncome) {\n const total = parentCategory.monthlyAmounts.reduce(totalReducer(monthHeaders), 0)\n if (total !== 0) {\n categoryRows.push({\n id: `sub-${parentCategory.guid}`,\n category: buildDynamicCopy(copy.category_general, parentCategory.name) as string,\n category_guid: parentCategory.guid,\n isParent: true,\n top_level_category_guid: parentCategory.guid,\n total,\n monthlyAmounts: parentCategory.monthlyAmounts.reduce(amountsReducer, {}),\n })\n }\n }\n\n return categoryRows\n}\n"],"mappings":";;;;;;;AAUA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
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",