@mx-cartographer/experiences 4.0.14-alpha.JB1 → 4.0.14-alpha.JB2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AccountStore-B23-oV1B.mjs +244 -0
- package/dist/AccountStore-B23-oV1B.mjs.map +1 -0
- package/dist/BeatApi-BxXgbSJY.mjs +99 -0
- package/dist/BeatApi-BxXgbSJY.mjs.map +1 -0
- package/dist/BudgetUtil-BSn9Zr71.mjs +208 -0
- package/dist/BudgetUtil-BSn9Zr71.mjs.map +1 -0
- package/dist/CashflowApi-zcebgnO1.mjs +103 -0
- package/dist/CashflowApi-zcebgnO1.mjs.map +1 -0
- package/dist/CashflowStore-gPEEBiXo.mjs +53 -0
- package/dist/CashflowStore-gPEEBiXo.mjs.map +1 -0
- package/dist/Categories-XVFviD23.mjs +117 -0
- package/dist/Categories-XVFviD23.mjs.map +1 -0
- package/dist/CategoryStore-CSNSMNA6.mjs +298 -0
- package/dist/CategoryStore-CSNSMNA6.mjs.map +1 -0
- package/dist/ConnectMiniWidget-Ep65CtHH.mjs +10854 -0
- package/dist/ConnectMiniWidget-Ep65CtHH.mjs.map +1 -0
- package/dist/DebtsStore-Duf3n1vZ.mjs +127 -0
- package/dist/DebtsStore-Duf3n1vZ.mjs.map +1 -0
- package/dist/Donut-DgMeKScZ.mjs +53 -0
- package/dist/Donut-DgMeKScZ.mjs.map +1 -0
- package/dist/Fetch-DpUi1_Dx.mjs +99 -0
- package/dist/Fetch-DpUi1_Dx.mjs.map +1 -0
- package/dist/GoalStore-BYoRLx99.mjs +128 -0
- package/dist/GoalStore-BYoRLx99.mjs.map +1 -0
- package/dist/MerchantStore-RhLvDvX-.mjs +118 -0
- package/dist/MerchantStore-RhLvDvX-.mjs.map +1 -0
- package/dist/NetWorthStore-syD1VnxE.mjs +66 -0
- package/dist/NetWorthStore-syD1VnxE.mjs.map +1 -0
- package/dist/NotificationStore-CqTYHfJC.mjs +141 -0
- package/dist/NotificationStore-CqTYHfJC.mjs.map +1 -0
- package/dist/RecurringActivityStore-B_COvGWG.mjs +304 -0
- package/dist/RecurringActivityStore-B_COvGWG.mjs.map +1 -0
- package/dist/StackedLineChart-CCqGRwvs.mjs +342 -0
- package/dist/StackedLineChart-CCqGRwvs.mjs.map +1 -0
- package/dist/TransactionStore-BUrjBWkk.mjs +478 -0
- package/dist/TransactionStore-BUrjBWkk.mjs.map +1 -0
- package/dist/index.es.js +12 -17869
- package/dist/index.es.js.map +1 -1
- package/dist/index.es10.js +107 -0
- package/dist/index.es10.js.map +1 -0
- package/dist/index.es11.js +159 -0
- package/dist/index.es11.js.map +1 -0
- package/dist/index.es12.js +483 -0
- package/dist/index.es12.js.map +1 -0
- package/dist/index.es13.js +620 -0
- package/dist/index.es13.js.map +1 -0
- package/dist/index.es14.js +788 -0
- package/dist/index.es14.js.map +1 -0
- package/dist/index.es15.js +891 -0
- package/dist/index.es15.js.map +1 -0
- package/dist/index.es16.js +962 -0
- package/dist/index.es16.js.map +1 -0
- package/dist/index.es17.js +1904 -0
- package/dist/index.es17.js.map +1 -0
- package/dist/index.es2.js +11 -0
- package/dist/index.es2.js.map +1 -0
- package/dist/index.es3.js +10 -0
- package/dist/index.es3.js.map +1 -0
- package/dist/index.es4.js +9 -0
- package/dist/index.es4.js.map +1 -0
- package/dist/index.es5.js +7 -0
- package/dist/index.es5.js.map +1 -0
- package/dist/index.es6.js +7 -0
- package/dist/index.es6.js.map +1 -0
- package/dist/index.es7.js +10 -0
- package/dist/index.es7.js.map +1 -0
- package/dist/index.es8.js +10 -0
- package/dist/index.es8.js.map +1 -0
- package/dist/index.es9.js +18 -0
- package/dist/index.es9.js.map +1 -0
- package/dist/useCombineEvents-CZUDHE96.mjs +170 -0
- package/dist/useCombineEvents-CZUDHE96.mjs.map +1 -0
- package/dist/usePrevious-BLb3umpI.mjs +11 -0
- package/dist/usePrevious-BLb3umpI.mjs.map +1 -0
- package/package.json +2 -3
- package/src/accounts/AccountsMiniWidget.tsx +0 -62
- package/src/accounts/AccountsWidget.tsx +0 -93
- package/src/accounts/ConnectMiniWidget.tsx +0 -36
- package/src/accounts/__tests__/Accounts.test.tsx +0 -561
- package/src/accounts/api/AccountApi.ts +0 -74
- package/src/accounts/api/__mocks__/AccountApi.ts +0 -46
- package/src/accounts/components/AccountListItem.tsx +0 -102
- package/src/accounts/components/AccountsList.tsx +0 -133
- package/src/accounts/components/ConnectImage.tsx +0 -314
- package/src/accounts/components/ConnectMiniWidgetCard.tsx +0 -41
- package/src/accounts/components/ConnectStatus.tsx +0 -44
- package/src/accounts/components/ConnectionStatusIcons.tsx +0 -26
- package/src/accounts/components/ConnectionsDrawer.tsx +0 -84
- package/src/accounts/components/detailsdrawer/Accounts/AccountActions.tsx +0 -177
- package/src/accounts/components/detailsdrawer/Accounts/AccountActionsRow.tsx +0 -33
- package/src/accounts/components/detailsdrawer/Accounts/AccountConnection.tsx +0 -139
- package/src/accounts/components/detailsdrawer/Accounts/AccountDetailEdit.tsx +0 -162
- package/src/accounts/components/detailsdrawer/Accounts/AccountDetails.tsx +0 -98
- package/src/accounts/components/detailsdrawer/Accounts/AccountDetailsChart.tsx +0 -63
- package/src/accounts/components/detailsdrawer/Accounts/AccountDetailsContent.tsx +0 -52
- package/src/accounts/components/detailsdrawer/Accounts/AccountDetailsHeader.tsx +0 -71
- package/src/accounts/components/detailsdrawer/Accounts/AccountDetailsTab.tsx +0 -25
- package/src/accounts/components/detailsdrawer/Accounts/ConnectionErrorMessage.tsx +0 -99
- package/src/accounts/components/detailsdrawer/Transactions/TransactionsTab.tsx +0 -51
- package/src/accounts/constants/Accounts.ts +0 -11
- package/src/accounts/hooks/useGetMergeableAccounts.tsx +0 -13
- package/src/accounts/hooks/useUiStore.ts +0 -12
- package/src/accounts/index.ts +0 -8
- package/src/accounts/stores/AccountStore.ts +0 -220
- package/src/accounts/stores/UiStore.ts +0 -18
- package/src/accounts/stores/__tests__/AccountStore.test.ts +0 -204
- package/src/accounts/utils/AccountFields.tsx +0 -248
- package/src/accounts/utils/Accounts.ts +0 -28
- package/src/accounts/utils/__tests__/AccountFieldsUtils.test.tsx +0 -215
- package/src/accounts/utils/__tests__/AccountsUtils.test.tsx +0 -104
- package/src/accounts/utils/getConnectionMessages.tsx +0 -198
- package/src/accounts/utils/index.ts +0 -1
- package/src/budgets/BubbleBudgetsMiniWidget.tsx +0 -57
- package/src/budgets/BubbleBudgetsWidget.tsx +0 -154
- package/src/budgets/__tests__/BubbleBudgetsWidget.test.tsx +0 -40
- package/src/budgets/__tests__/BudgetList.test.tsx +0 -38
- package/src/budgets/__tests__/BudgetsStore.test.tsx +0 -48
- package/src/budgets/__tests__/Overview.test.tsx +0 -38
- package/src/budgets/api/BudgetsApi.ts +0 -43
- package/src/budgets/api/__mocks__/BudgetsApi.ts +0 -7
- package/src/budgets/components/AddBudgets.tsx +0 -50
- package/src/budgets/components/BubbleBudgets.tsx +0 -73
- package/src/budgets/components/BubbleChart.tsx +0 -50
- package/src/budgets/components/BudgetDetailsDrawer.tsx +0 -134
- package/src/budgets/components/BudgetList.tsx +0 -50
- package/src/budgets/components/Overview.tsx +0 -156
- package/src/budgets/components/ZeroState.tsx +0 -23
- package/src/budgets/components/addbudget/Header.tsx +0 -59
- package/src/budgets/components/addbudget/RecalculateBudgetRow.tsx +0 -53
- package/src/budgets/components/addbudget/RecalculateBudgets.tsx +0 -69
- package/src/budgets/components/addbudget/UnbudgetedRow.tsx +0 -57
- package/src/budgets/components/bubblechart/Bubble.tsx +0 -148
- package/src/budgets/components/bubblechart/Mercury.tsx +0 -57
- package/src/budgets/components/budgetdetails/AddSubBudget.tsx +0 -111
- package/src/budgets/components/budgetdetails/BudgetDetails.tsx +0 -93
- package/src/budgets/components/budgetdetails/Header.tsx +0 -48
- package/src/budgets/components/budgetdetails/SubBudgetList.tsx +0 -148
- package/src/budgets/components/budgetlist/BudgetRow.tsx +0 -63
- package/src/budgets/components/budgetlist/SubBudgetRow.tsx +0 -64
- package/src/budgets/components/budgetlist/SubBudgetZeroState.tsx +0 -22
- package/src/budgets/components/shared/BudgetAmount.tsx +0 -54
- package/src/budgets/index.ts +0 -2
- package/src/budgets/store/BudgetsStore.ts +0 -183
- package/src/budgets/utils/BubblesSVG.ts +0 -142
- package/src/budgets/utils/BudgetUtil.ts +0 -140
- package/src/cashflow/CashflowMiniWidget.tsx +0 -25
- package/src/cashflow/CashflowOnboarding.tsx +0 -298
- package/src/cashflow/CashflowWidget.tsx +0 -111
- package/src/cashflow/api/CashflowApi.ts +0 -62
- package/src/cashflow/api/__mocks__/CashflowApi.ts +0 -15
- package/src/cashflow/components/CashflowAmountHeading.tsx +0 -46
- package/src/cashflow/components/CashflowContent.tsx +0 -63
- package/src/cashflow/components/CashflowHeading.tsx +0 -172
- package/src/cashflow/components/CashflowWidgetContent.tsx +0 -225
- package/src/cashflow/components/DetailsExpenseHeader.tsx +0 -47
- package/src/cashflow/components/DetailsExpenseRow.tsx +0 -46
- package/src/cashflow/components/DetailsFooter.tsx +0 -28
- package/src/cashflow/components/DetailsTab.tsx +0 -128
- package/src/cashflow/components/RemainingCash.tsx +0 -44
- package/src/cashflow/components/SummaryTab.tsx +0 -247
- package/src/cashflow/components/onboarding/StepOne.tsx +0 -90
- package/src/cashflow/components/onboarding/StepTwo.tsx +0 -23
- package/src/cashflow/context/hooks.tsx +0 -12
- package/src/cashflow/images/cashflow-onboarding.png +0 -0
- package/src/cashflow/images/loading-animation.gif +0 -0
- package/src/cashflow/index.ts +0 -5
- package/src/cashflow/stores/CashflowStore.ts +0 -26
- package/src/cashflow/stores/UiStore.ts +0 -48
- package/src/cashflow/stores/__tests__/CashflowStore.test.ts +0 -16
- package/src/cashflow/util/Filters.ts +0 -15
- package/src/categories/components/CategoryList.tsx +0 -64
- package/src/categories/components/CategoryRow.tsx +0 -68
- package/src/categories/components/CategorySelector.tsx +0 -80
- package/src/categories/components/CategorySelectorDrawer.tsx +0 -41
- package/src/categories/components/CustomCategories/AddSubcategory.tsx +0 -65
- package/src/categories/components/CustomCategories/CustomCategoryModal.tsx +0 -99
- package/src/categories/components/CustomCategories/DeleteSubcategory.tsx +0 -49
- package/src/categories/components/CustomCategories/RenameSubcategory.tsx +0 -48
- package/src/categories/components/CustomCategories/index.ts +0 -4
- package/src/categories/components/SubcategoryList.tsx +0 -47
- package/src/categories/components/SubcategoryRow.tsx +0 -123
- package/src/categories/constants/Analytics.ts +0 -89
- package/src/categories/constants/OnClickEvents.ts +0 -13
- package/src/categories/context/hooks.ts +0 -12
- package/src/categories/index.ts +0 -5
- package/src/categories/stores/CategoryStore.ts +0 -184
- package/src/categories/stores/UiStore.ts +0 -36
- package/src/categories/stores/__tests__/CategoryStore.test.ts +0 -54
- package/src/categories/util/CategoryUtil.ts +0 -136
- package/src/common/api/AnalyticsApi.ts +0 -49
- package/src/common/api/BeatApi.ts +0 -32
- package/src/common/api/CategoryApi.ts +0 -52
- package/src/common/api/GlobalCopyApi.ts +0 -17
- package/src/common/api/LocalizedCopyApi.ts +0 -21
- package/src/common/api/NotificationApi.ts +0 -40
- package/src/common/api/ScheduledPaymentsApi.ts +0 -37
- package/src/common/api/UserApi.ts +0 -23
- package/src/common/api/WidgetApi.ts +0 -15
- package/src/common/api/__mocks__/BeatApi.ts +0 -8
- package/src/common/api/__mocks__/CategoryApi.ts +0 -15
- package/src/common/api/__mocks__/GlobalCopyApi.ts +0 -7
- package/src/common/api/__mocks__/NotificationApi.ts +0 -11
- package/src/common/api/__mocks__/ScheduledPaymentsApi.ts +0 -7
- package/src/common/api/__mocks__/UserApi.ts +0 -9
- package/src/common/api/__mocks__/WidgetApi.ts +0 -11
- package/src/common/api/index.ts +0 -9
- package/src/common/components/ConnectDrawer.tsx +0 -87
- package/src/common/components/CurrencyInput.tsx +0 -147
- package/src/common/components/CurrencyText.tsx +0 -44
- package/src/common/components/DataRow.tsx +0 -52
- package/src/common/components/IconBacking.tsx +0 -41
- package/src/common/components/InformationTooltip.tsx +0 -52
- package/src/common/components/ListItemWrapper.tsx +0 -49
- package/src/common/components/Loader.tsx +0 -24
- package/src/common/components/MiniWidgetContainer.tsx +0 -64
- package/src/common/components/ResponsiveButton.tsx +0 -65
- package/src/common/components/SearchBox.tsx +0 -64
- package/src/common/components/SelectionBox.tsx +0 -64
- package/src/common/components/SubheaderRow.tsx +0 -22
- package/src/common/components/TabContentContainer.tsx +0 -28
- package/src/common/components/WidgetContainer.tsx +0 -239
- package/src/common/components/accountfilter/AccountFilter.tsx +0 -133
- package/src/common/components/accountfilter/AccountFilterOptions.tsx +0 -263
- package/src/common/components/accountfilter/index.ts +0 -1
- package/src/common/components/barchart/Bar.tsx +0 -123
- package/src/common/components/barchart/BarChart.tsx +0 -136
- package/src/common/components/barchart/BarColumn.tsx +0 -150
- package/src/common/components/barchart/Legend.tsx +0 -60
- package/src/common/components/barchart/Util.ts +0 -54
- package/src/common/components/barchart/__tests__/BarChart.test.tsx +0 -46
- package/src/common/components/barchart/index.ts +0 -1
- package/src/common/components/calendar/Calendar.tsx +0 -223
- package/src/common/components/calendar/Day.tsx +0 -127
- package/src/common/components/calendar/Header.tsx +0 -58
- package/src/common/components/calendar/__tests__/Calendar.test.tsx +0 -50
- package/src/common/components/calendar/index.ts +0 -1
- package/src/common/components/calendar/upcomingActivity/CalendarIcons.tsx +0 -40
- package/src/common/components/charts/Donut.tsx +0 -82
- package/src/common/components/charts/LineChart.tsx +0 -204
- package/src/common/components/charts/StackedLineChart.tsx +0 -292
- package/src/common/components/charts/StatusBar.tsx +0 -41
- package/src/common/components/charts/index.ts +0 -4
- package/src/common/components/charts/linechart/CustomLegend.tsx +0 -49
- package/src/common/components/charts/linechart/CustomLine.tsx +0 -31
- package/src/common/components/charts/linechart/CustomMark.tsx +0 -68
- package/src/common/components/charts/stackedlinechart/CategoryIconLabel.tsx +0 -29
- package/src/common/components/charts/stackedlinechart/CustomAreaTooltip.tsx +0 -115
- package/src/common/components/charts/stackedlinechart/CustomLegend.tsx +0 -73
- package/src/common/components/charts/stackedlinechart/CustomPointTooltip.tsx +0 -41
- package/src/common/components/charts/stackedlinechart/utils.ts +0 -13
- package/src/common/components/daterangeselector/DateRangeSelector.tsx +0 -383
- package/src/common/components/daterangeselector/index.ts +0 -1
- package/src/common/components/dialog/Dialog.tsx +0 -92
- package/src/common/components/dialog/index.ts +0 -1
- package/src/common/components/donuts/MultiSegmentDonut.tsx +0 -89
- package/src/common/components/donuts/SingleSegmentDonut.tsx +0 -75
- package/src/common/components/donuts/index.ts +0 -2
- package/src/common/components/drawer/Drawer.tsx +0 -97
- package/src/common/components/drawer/Header.tsx +0 -64
- package/src/common/components/drawer/index.ts +0 -1
- package/src/common/components/index.ts +0 -22
- package/src/common/constants/Account.ts +0 -30
- package/src/common/constants/Analytics.ts +0 -70
- package/src/common/constants/ApiEndpoints.ts +0 -30
- package/src/common/constants/Category.ts +0 -302
- package/src/common/constants/Connect.ts +0 -2
- package/src/common/constants/DateFormats.ts +0 -122
- package/src/common/constants/Donut.ts +0 -2
- package/src/common/constants/Numbers.ts +0 -6
- package/src/common/constants/ScheduledPayment.ts +0 -21
- package/src/common/constants/Sizes.ts +0 -7
- package/src/common/constants/SpendingPlan.ts +0 -17
- package/src/common/constants/Table.ts +0 -13
- package/src/common/constants/index.ts +0 -21
- package/src/common/context/GlobalDataProvider.tsx +0 -31
- package/src/common/context/WidgetContainerProvider.tsx +0 -24
- package/src/common/context/__mocks__/GlobalDataProvider.tsx +0 -25
- package/src/common/context/hooks.tsx +0 -57
- package/src/common/context/index.ts +0 -22
- package/src/common/hooks/__tests__/useDimensions.test.tsx +0 -190
- package/src/common/hooks/index.ts +0 -3
- package/src/common/hooks/useCombineEvents.tsx +0 -53
- package/src/common/hooks/useDimensions.tsx +0 -78
- package/src/common/hooks/usePrevious.tsx +0 -10
- package/src/common/hooks/useScreenSize.tsx +0 -15
- package/src/common/index.ts +0 -23
- package/src/common/stores/ConnectStore.ts +0 -26
- package/src/common/stores/GlobalCopyStore.ts +0 -36
- package/src/common/stores/GlobalStore.ts +0 -83
- package/src/common/stores/GlobalUiStore.ts +0 -66
- package/src/common/stores/UserStore.ts +0 -45
- package/src/common/stores/__tests__/GlobalCopyStore.test.ts +0 -23
- package/src/common/stores/__tests__/GlobalStore.test.ts +0 -24
- package/src/common/stores/index.ts +0 -3
- package/src/common/types/Account.ts +0 -406
- package/src/common/types/Activity.ts +0 -31
- package/src/common/types/Analytics.ts +0 -70
- package/src/common/types/Beat.ts +0 -71
- package/src/common/types/Budget.ts +0 -29
- package/src/common/types/Cashflow.ts +0 -110
- package/src/common/types/Category.ts +0 -68
- package/src/common/types/Date.ts +0 -2
- package/src/common/types/Debt.ts +0 -19
- package/src/common/types/Expense.ts +0 -20
- package/src/common/types/Global.ts +0 -13
- package/src/common/types/GlobalCopy.ts +0 -37
- package/src/common/types/Goal.ts +0 -59
- package/src/common/types/Institution.ts +0 -11
- package/src/common/types/LocalizedContent.ts +0 -9
- package/src/common/types/Merchant.ts +0 -6
- package/src/common/types/Notification.ts +0 -15
- package/src/common/types/ScheduledPayment.ts +0 -15
- package/src/common/types/ScreenSize.tsx +0 -4
- package/src/common/types/SpendingPlan.ts +0 -48
- package/src/common/types/Transaction.ts +0 -91
- package/src/common/types/User.ts +0 -20
- package/src/common/types/Widgets.ts +0 -11
- package/src/common/types/index.ts +0 -93
- package/src/common/types/localization/AccountFilterCopy.ts +0 -12
- package/src/common/types/localization/AccountTypeCopy.ts +0 -16
- package/src/common/types/localization/AccountsCopy.ts +0 -113
- package/src/common/types/localization/BudgetsCopy.ts +0 -52
- package/src/common/types/localization/CashflowCopy.ts +0 -77
- package/src/common/types/localization/CategoryCopy.ts +0 -18
- package/src/common/types/localization/CommonCopy.ts +0 -30
- package/src/common/types/localization/ConnectCopy.ts +0 -74
- package/src/common/types/localization/CurrencyInputCopy.ts +0 -6
- package/src/common/types/localization/DateRangePickerCopy.ts +0 -23
- package/src/common/types/localization/GoalsCopy.ts +0 -37
- package/src/common/types/localization/InsightsFeedCopy.ts +0 -26
- package/src/common/types/localization/MicroInsightsCopy.ts +0 -28
- package/src/common/types/localization/NetWorthCopy.ts +0 -14
- package/src/common/types/localization/NotificationsCopy.ts +0 -7
- package/src/common/types/localization/RecurringCopy.ts +0 -76
- package/src/common/types/localization/SpendingCopy.ts +0 -16
- package/src/common/types/localization/TransactionsCopy.ts +0 -81
- package/src/common/types/localization/TrendsCopy.ts +0 -10
- package/src/common/types/localization/index.ts +0 -19
- package/src/common/utils/AccountFilter.ts +0 -45
- package/src/common/utils/Analytics.ts +0 -51
- package/src/common/utils/Categories.ts +0 -75
- package/src/common/utils/DateUtil.ts +0 -67
- package/src/common/utils/Fetch.ts +0 -115
- package/src/common/utils/Localization.ts +0 -67
- package/src/common/utils/NumberFormatting.ts +0 -65
- package/src/common/utils/__tests__/Fetch.test.tsx +0 -34
- package/src/common/utils/index.ts +0 -18
- package/src/dashboard/Dashboard.tsx +0 -92
- package/src/dashboard/Greeting.tsx +0 -75
- package/src/dashboard/__tests__/Dashboard.test.tsx +0 -84
- package/src/dashboard/constants/Dashboard.ts +0 -4
- package/src/dashboard/index.ts +0 -3
- package/src/dashboard/types/DashboardTypes.ts +0 -9
- package/src/debts/DebtsWidget.tsx +0 -90
- package/src/debts/components/DebtsChart.tsx +0 -190
- package/src/debts/components/DebtsTable.tsx +0 -209
- package/src/debts/components/SnowballCard.tsx +0 -70
- package/src/debts/components/SnowballDrawer.tsx +0 -384
- package/src/debts/components/debtstable/AccountCell.tsx +0 -25
- package/src/debts/components/debtstable/PriorityCell.tsx +0 -46
- package/src/debts/index.ts +0 -4
- package/src/debts/store/DebtsStore.ts +0 -20
- package/src/debts/utils/DebtStore.ts +0 -75
- package/src/debts/utils/DebtsWidget.ts +0 -32
- package/src/debts/utils/SnowballCard.tsx +0 -48
- package/src/goals/GoalsWidget.tsx +0 -128
- package/src/goals/api/GoalApi.ts +0 -29
- package/src/goals/components/GoalDetails.tsx +0 -240
- package/src/goals/components/GoalList.tsx +0 -101
- package/src/goals/components/GoalStatusCard.tsx +0 -87
- package/src/goals/components/TabTitle.tsx +0 -21
- package/src/goals/constants/CopyKeys.ts +0 -29
- package/src/goals/index.ts +0 -2
- package/src/goals/stores/GoalStore.ts +0 -47
- package/src/goals/util/GoalsUtil.ts +0 -61
- package/src/index.ts +0 -17
- package/src/insights/README.md +0 -16
- package/src/insights/contexts/ToastContext.tsx +0 -62
- package/src/insights/index.ts +0 -5
- package/src/insights/settings/SettingsDrawer.tsx +0 -40
- package/src/insights/settings/__tests__/SettingsDrawer.test.tsx +0 -50
- package/src/insights/settings/components/PulseSubheaderRow.tsx +0 -34
- package/src/insights/settings/components/SettingsItem.tsx +0 -55
- package/src/insights/settings/components/Toast.tsx +0 -69
- package/src/insights/settings/hiddeninsights/__tests__/HiddenInsightsDrawer.test.tsx +0 -108
- package/src/insights/settings/hiddeninsights/__tests__/SubCategoryDrawer.test.tsx +0 -150
- package/src/insights/settings/hiddeninsights/components/CategoryEmptyState.tsx +0 -50
- package/src/insights/settings/hiddeninsights/components/HiddenInsightsDrawer.tsx +0 -222
- package/src/insights/settings/hiddeninsights/components/HiddenInsightsDrawerWrapper.tsx +0 -24
- package/src/insights/settings/hiddeninsights/components/SubCategoryDrawer.tsx +0 -256
- package/src/insights/settings/hiddeninsights/images/no-insights.png +0 -0
- package/src/insights/settings/hiddeninsights/types/index.ts +0 -74
- package/src/insights/settings/manageaccounts/__tests__/AccountGroup.test.tsx +0 -92
- package/src/insights/settings/manageaccounts/__tests__/ManageAccountsDrawer.test.tsx +0 -83
- package/src/insights/settings/manageaccounts/components/AccountGroup.tsx +0 -109
- package/src/insights/settings/manageaccounts/components/ManageAccountsDrawer.tsx +0 -63
- package/src/insights/settings/manageaccounts/types/index.ts +0 -13
- package/src/insights/settings/types/index.ts +0 -4
- package/src/insights/store/BeatStore.ts +0 -25
- package/src/insights/utils/beatTemplateCategories.ts +0 -103
- package/src/merchants/api/MerchantApi.ts +0 -33
- package/src/merchants/components/MerchantLookup.tsx +0 -117
- package/src/merchants/index.ts +0 -2
- package/src/merchants/stores/MerchantStore.ts +0 -42
- package/src/microinsights/analytics.ts +0 -31
- package/src/microinsights/components/beatCard/BeatCard.tsx +0 -124
- package/src/microinsights/components/beaticons/BeatCategoryIcon.tsx +0 -20
- package/src/microinsights/components/beaticons/BeatIcon.tsx +0 -45
- package/src/microinsights/components/beaticons/BeatMerchantLogo.tsx +0 -33
- package/src/microinsights/components/beaticons/ChartFilledIcon.tsx +0 -37
- package/src/microinsights/components/beaticons/MonthlySpendComparisonIcon.tsx +0 -30
- package/src/microinsights/components/beaticons/ZeroStateIcon.tsx +0 -558
- package/src/microinsights/components/beaticons/index.tsx +0 -7
- package/src/microinsights/components/carouselheader/CarouselHeader.tsx +0 -111
- package/src/microinsights/components/insightsmicrowidget/InsightsMicroWidget.tsx +0 -163
- package/src/microinsights/components/microBeatCarousel/CarouselControls.tsx +0 -99
- package/src/microinsights/components/microBeatCarousel/MicroBeatCarousel.tsx +0 -207
- package/src/microinsights/components/microInsightCard/MicroInsightCard.tsx +0 -173
- package/src/microinsights/components/noRelevantInsightsCard/NoRelevantInsightsCard.tsx +0 -89
- package/src/microinsights/components/spinner/Spinner.tsx +0 -21
- package/src/microinsights/components/viewMoreMicroCard/ViewMoreMicroCard.tsx +0 -101
- package/src/microinsights/components/zeroStateCard/ZeroStateCard.tsx +0 -62
- package/src/microinsights/constants/Analytics.ts +0 -192
- package/src/microinsights/constants/App.ts +0 -53
- package/src/microinsights/constants/Insights.tsx +0 -3
- package/src/microinsights/constants/OnClickEvents.ts +0 -3
- package/src/microinsights/context/InsightsMicroWidgetDataProvider.tsx +0 -24
- package/src/microinsights/context/hooks.tsx +0 -65
- package/src/microinsights/index.ts +0 -16
- package/src/microinsights/interfaces.ts +0 -28
- package/src/microinsights/stores/AppStore.ts +0 -34
- package/src/microinsights/stores/CopyStore.ts +0 -38
- package/src/microinsights/stores/InsightsMicroWidgetStore.ts +0 -61
- package/src/microinsights/types/BeatUIComponent.ts +0 -5
- package/src/microinsights/utils/DataSeries.ts +0 -20
- package/src/networth/NetWorthWidget.tsx +0 -171
- package/src/networth/__tests__/AssetsLiabilitiesDetail.test.tsx +0 -94
- package/src/networth/__tests__/NetWorthChart.test.tsx +0 -31
- package/src/networth/__tests__/NetWorthList.test.tsx +0 -33
- package/src/networth/components/AssetsLiabilitiesDetail.tsx +0 -146
- package/src/networth/components/GainsLossesDetail.tsx +0 -110
- package/src/networth/components/NetWorthChange.tsx +0 -51
- package/src/networth/components/NetWorthChart.tsx +0 -71
- package/src/networth/components/NetWorthList.tsx +0 -91
- package/src/networth/components/NetWorthListItem.tsx +0 -72
- package/src/networth/components/NetWorthSummary.tsx +0 -36
- package/src/networth/index.ts +0 -5
- package/src/networth/stores/NetWorthStore.ts +0 -99
- package/src/networth/stores/__tests__/NetWorthStore.test.ts +0 -32
- package/src/networth/types/NetWorth.ts +0 -59
- package/src/networth/utils/NetWorthUtils.ts +0 -177
- package/src/networth/utils/__tests__/NetWorthUtils.test.ts +0 -198
- package/src/notifications/__tests__/NotificationList.test.tsx +0 -67
- package/src/notifications/components/DateRow.tsx +0 -21
- package/src/notifications/components/NotificationBadge.tsx +0 -51
- package/src/notifications/components/NotificationCard.tsx +0 -63
- package/src/notifications/components/NotificationList.tsx +0 -65
- package/src/notifications/constants/NotificationConstants.ts +0 -104
- package/src/notifications/index.ts +0 -3
- package/src/notifications/stores/NotificationStore.ts +0 -62
- package/src/notifications/utils/NotificationUtils.ts +0 -21
- package/src/recurringactivity/RecurringActivityMiniWidget.tsx +0 -45
- package/src/recurringactivity/RecurringActivityWidget.tsx +0 -89
- package/src/recurringactivity/__tests__/BuildActivities.test.ts +0 -30
- package/src/recurringactivity/__tests__/BuildNewActivity.test.ts +0 -59
- package/src/recurringactivity/__tests__/RecurringActivityWidget.test.tsx +0 -33
- package/src/recurringactivity/components/ActivityBadges.tsx +0 -40
- package/src/recurringactivity/components/ActivityDetails.tsx +0 -196
- package/src/recurringactivity/components/ActivityList.tsx +0 -141
- package/src/recurringactivity/components/ActivityRow.tsx +0 -161
- package/src/recurringactivity/components/ActivityStatus.tsx +0 -82
- package/src/recurringactivity/components/MiniWidgetContent.tsx +0 -61
- package/src/recurringactivity/components/RecurringActivity.tsx +0 -165
- package/src/recurringactivity/components/actions/FrequencyAction.tsx +0 -130
- package/src/recurringactivity/components/actions/PaymentDateAction.tsx +0 -99
- package/src/recurringactivity/components/activitycalendar/ActivityCalendar.tsx +0 -100
- package/src/recurringactivity/components/activitycalendar/ActivityDay.tsx +0 -88
- package/src/recurringactivity/components/activitycalendar/Legend.tsx +0 -42
- package/src/recurringactivity/components/shared/ActivitySettings.tsx +0 -43
- package/src/recurringactivity/components/shared/activitysettings/AddActivity.tsx +0 -175
- package/src/recurringactivity/components/shared/activitysettings/AddActivityDetails.tsx +0 -148
- package/src/recurringactivity/components/shared/activitysettings/ManageExpenses.tsx +0 -84
- package/src/recurringactivity/components/shared/activitysettings/ManageIncome.tsx +0 -102
- package/src/recurringactivity/components/shared/activitysettings/SelectTransaction.tsx +0 -45
- package/src/recurringactivity/index.ts +0 -5
- package/src/recurringactivity/stores/RecurringActivityStore.ts +0 -312
- package/src/recurringactivity/util/RecurringActivityUtils.ts +0 -40
- package/src/recurringactivity/util/buildActivities.ts +0 -334
- package/src/recurringactivity/util/buildNewActivity.ts +0 -111
- package/src/recurringactivity/util/getRecurrence.ts +0 -50
- package/src/recurringactivity/util/getStatus.ts +0 -32
- package/src/recurringactivity/util/updateActivity.ts +0 -66
- package/src/spending/SpendingMiniWidget.tsx +0 -23
- package/src/spending/SpendingWidget.tsx +0 -71
- package/src/spending/__tests__/MiniSpendingChart.test.tsx +0 -43
- package/src/spending/__tests__/SpendingData.test.ts +0 -38
- package/src/spending/__tests__/SpendingMiniWidget.test.tsx +0 -49
- package/src/spending/__tests__/SpendingWidget.test.tsx +0 -49
- package/src/spending/components/MiniSpendingChart.tsx +0 -125
- package/src/spending/components/Spending.tsx +0 -175
- package/src/spending/components/SpendingChart.tsx +0 -74
- package/src/spending/components/SpendingDonut.tsx +0 -125
- package/src/spending/components/SpendingLegend.tsx +0 -41
- package/src/spending/components/SpendingList.tsx +0 -112
- package/src/spending/components/SpendingTabLabel.tsx +0 -25
- package/src/spending/index.ts +0 -2
- package/src/spending/utils/SpendingData.ts +0 -196
- package/src/transactions/TransactionWidget.tsx +0 -319
- package/src/transactions/analytics.ts +0 -12
- package/src/transactions/api/TransactionApi.ts +0 -204
- package/src/transactions/api/__mocks__/TransactionApi.ts +0 -20
- package/src/transactions/components/shared/TransactionDetails.tsx +0 -140
- package/src/transactions/components/shared/TransactionList.tsx +0 -124
- package/src/transactions/components/shared/TransactionTable.tsx +0 -123
- package/src/transactions/components/shared/transactiondetails/Description.tsx +0 -97
- package/src/transactions/components/shared/transactiondetails/FlagTransaction.tsx +0 -63
- package/src/transactions/components/shared/transactiondetails/ManualTransactionDetails.tsx +0 -148
- package/src/transactions/components/shared/transactiondetails/TransactionAmountHeader.tsx +0 -39
- package/src/transactions/components/shared/transactiondetails/actions/CategoryAction.tsx +0 -149
- package/src/transactions/components/shared/transactiondetails/actions/DateAction.tsx +0 -119
- package/src/transactions/components/shared/transactiondetails/actions/DeleteAction.tsx +0 -85
- package/src/transactions/components/shared/transactiondetails/actions/DeleteLogoAction.tsx +0 -88
- package/src/transactions/components/shared/transactiondetails/actions/HideAction.tsx +0 -126
- package/src/transactions/components/shared/transactiondetails/actions/MemoAction.tsx +0 -112
- package/src/transactions/components/shared/transactiondetails/actions/SplitAction.tsx +0 -234
- package/src/transactions/components/shared/transactiondetails/actions/TagsAction.tsx +0 -119
- package/src/transactions/components/shared/transactiondetails/actions/index.ts +0 -8
- package/src/transactions/components/shared/transactionlist/DateRow.tsx +0 -33
- package/src/transactions/components/shared/transactionlist/TransactionRow.tsx +0 -92
- package/src/transactions/components/shared/transactionlist/ZeroState.tsx +0 -36
- package/src/transactions/components/shared/transactiontable/cells/AccountCell.tsx +0 -12
- package/src/transactions/components/shared/transactiontable/cells/AmountCell.tsx +0 -35
- package/src/transactions/components/shared/transactiontable/cells/CategoryCell.tsx +0 -37
- package/src/transactions/components/shared/transactiontable/cells/DateCell.tsx +0 -17
- package/src/transactions/components/shared/transactiontable/cells/FlagCell.tsx +0 -43
- package/src/transactions/components/shared/transactiontable/cells/HeaderCell.tsx +0 -11
- package/src/transactions/components/shared/transactiontable/cells/PayeeCell.tsx +0 -21
- package/src/transactions/components/shared/transactiontable/cells/index.ts +0 -7
- package/src/transactions/components/splitmanager/SplitManager.tsx +0 -93
- package/src/transactions/components/splitmanager/SplitRow.tsx +0 -149
- package/src/transactions/components/splitmanager/index.ts +0 -1
- package/src/transactions/components/tagmanager/Header.tsx +0 -100
- package/src/transactions/components/tagmanager/SearchBox.tsx +0 -60
- package/src/transactions/components/tagmanager/TagManager.tsx +0 -51
- package/src/transactions/components/tagmanager/TagRow.tsx +0 -145
- package/src/transactions/components/tagmanager/index.ts +0 -1
- package/src/transactions/components/transactionwidget/AddAccountModal.tsx +0 -30
- package/src/transactions/components/transactionwidget/actions/AddTransactionAction.tsx +0 -74
- package/src/transactions/components/transactionwidget/actions/EditCategoryAction.tsx +0 -80
- package/src/transactions/components/transactionwidget/actions/ExportCsvAction.tsx +0 -32
- package/src/transactions/constants/Actions.ts +0 -28
- package/src/transactions/constants/Analytics.ts +0 -272
- package/src/transactions/constants/OnClickEvents.ts +0 -45
- package/src/transactions/constants/Transaction.ts +0 -32
- package/src/transactions/constants/TransactionsTable.ts +0 -26
- package/src/transactions/context/hooks.tsx +0 -12
- package/src/transactions/index.ts +0 -12
- package/src/transactions/stores/TransactionStore.ts +0 -327
- package/src/transactions/stores/UiStore.ts +0 -72
- package/src/transactions/stores/__tests__/TransactionStore.test.ts +0 -80
- package/src/transactions/utils/Filters.ts +0 -35
- package/src/transactions/utils/Transactions.ts +0 -22
- package/src/transactions/utils/buildDetailedTransactions.ts +0 -66
- package/src/transactions/utils/exportTransactionsToCSV.ts +0 -85
- package/src/transactions/utils/sortAndFilterTransactions.ts +0 -127
- package/src/trends/TrendsFullWidget.tsx +0 -286
- package/src/trends/TrendsMiniWidget.tsx +0 -49
- package/src/trends/__tests__/TrendsFullWidget.test.tsx +0 -45
- package/src/trends/__tests__/TrendsMiniWidget.test.tsx +0 -35
- package/src/trends/components/SpendingChart.tsx +0 -29
- package/src/trends/components/TrendsChart.tsx +0 -75
- package/src/trends/components/TrendsDrawer.tsx +0 -74
- package/src/trends/components/TrendsTable.tsx +0 -161
- package/src/trends/components/__tests__/SpendingChart.test.tsx +0 -37
- package/src/trends/components/trendstable/AmountCell.tsx +0 -14
- package/src/trends/components/trendstable/CategoryCell.tsx +0 -39
- package/src/trends/components/trendstable/HeaderCell.tsx +0 -8
- package/src/trends/index.ts +0 -2
- package/src/trends/mocks.ts +0 -423
- package/src/trends/utils/SpendingData.ts +0 -76
- package/src/trends/utils/TrendsData.ts +0 -127
- package/src/trends/utils/shared.ts +0 -39
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { getUnixTime as i } from "date-fns/getUnixTime";
|
|
2
|
+
import "bowser";
|
|
3
|
+
import { F as m, A as r } from "./Fetch-DpUi1_Dx.mjs";
|
|
4
|
+
import "date-fns/intlFormat";
|
|
5
|
+
import "./ConnectMiniWidget-Ep65CtHH.mjs";
|
|
6
|
+
import "react";
|
|
7
|
+
import "numeral";
|
|
8
|
+
import "date-fns/addMonths";
|
|
9
|
+
import "date-fns/addQuarters";
|
|
10
|
+
import "date-fns/addWeeks";
|
|
11
|
+
import "date-fns/addYears";
|
|
12
|
+
import "date-fns/getDay";
|
|
13
|
+
import "date-fns/isBefore";
|
|
14
|
+
import "date-fns/nextDay";
|
|
15
|
+
import "date-fns/setDate";
|
|
16
|
+
import "date-fns/startOfToday";
|
|
17
|
+
import "date-fns/fromUnixTime";
|
|
18
|
+
import "react/jsx-runtime";
|
|
19
|
+
import "@mui/material/Button";
|
|
20
|
+
import "@kyper/mui";
|
|
21
|
+
import "@mui/material/Tooltip";
|
|
22
|
+
import "@mui/material/Box";
|
|
23
|
+
import "@mui/material/IconButton";
|
|
24
|
+
import "@mui/material/styles/useTheme";
|
|
25
|
+
import "@mui/material/useMediaQuery";
|
|
26
|
+
import "@mxenabled/cssinjs";
|
|
27
|
+
import "date-fns/addDays";
|
|
28
|
+
import "date-fns/eachDayOfInterval";
|
|
29
|
+
import "date-fns/eachWeekOfInterval";
|
|
30
|
+
import "date-fns/endOfMonth";
|
|
31
|
+
import "date-fns/format";
|
|
32
|
+
import "date-fns/isSameMonth";
|
|
33
|
+
import "date-fns/startOfMonth";
|
|
34
|
+
import "date-fns/subMonths";
|
|
35
|
+
import "@mui/material/Paper";
|
|
36
|
+
import "@mui/icons-material/KeyboardArrowLeftRounded";
|
|
37
|
+
import "@mui/icons-material/KeyboardArrowRightRounded";
|
|
38
|
+
import "date-fns/isSameDay";
|
|
39
|
+
import "date-fns/isWithinInterval";
|
|
40
|
+
import "d3";
|
|
41
|
+
import "@mui/material/styles";
|
|
42
|
+
import "@mui/x-charts";
|
|
43
|
+
import "@mui/material/Stack";
|
|
44
|
+
import "@mui/material";
|
|
45
|
+
import "date-fns/differenceInCalendarDays";
|
|
46
|
+
import "date-fns/endOfToday";
|
|
47
|
+
import "date-fns/endOfYear";
|
|
48
|
+
import "date-fns/startOfYear";
|
|
49
|
+
import "date-fns/subDays";
|
|
50
|
+
import "date-fns/subYears";
|
|
51
|
+
import "@mui/material/ButtonGroup";
|
|
52
|
+
import "@mui/material/Tab";
|
|
53
|
+
import "@mui/material/Tabs";
|
|
54
|
+
import "@mui/material/ToggleButton";
|
|
55
|
+
import "@mui/material/ToggleButtonGroup";
|
|
56
|
+
import "@mui/material/Dialog";
|
|
57
|
+
import "@mui/material/DialogContent";
|
|
58
|
+
import "@mui/icons-material/ArrowBackOutlined";
|
|
59
|
+
import "@mui/material/Card";
|
|
60
|
+
import "@mui/material/CardHeader";
|
|
61
|
+
import "@mui/material/CardContent";
|
|
62
|
+
import "uuid";
|
|
63
|
+
import "@mui/material/CircularProgress";
|
|
64
|
+
import "@mui/material/FormControlLabel";
|
|
65
|
+
import "@mui/material/Radio";
|
|
66
|
+
import "@mui/material/Avatar";
|
|
67
|
+
import "@mui/material/ListItem";
|
|
68
|
+
import "@mui/material/ListItemAvatar";
|
|
69
|
+
import "@mui/material/ListItemButton";
|
|
70
|
+
import "@mui/material/ListItemText";
|
|
71
|
+
import "@mui/material/ListItemIcon";
|
|
72
|
+
import "mobx";
|
|
73
|
+
import "date-fns/differenceInDays";
|
|
74
|
+
import "@mui/x-data-grid-pro";
|
|
75
|
+
import "date-fns";
|
|
76
|
+
import "date-fns/getMonth";
|
|
77
|
+
import "date-fns/isAfter";
|
|
78
|
+
import "date-fns/parseISO";
|
|
79
|
+
import "date-fns/subWeeks";
|
|
80
|
+
import "date-fns/formatISO";
|
|
81
|
+
class vt {
|
|
82
|
+
fetchInstance;
|
|
83
|
+
constructor(t, o) {
|
|
84
|
+
this.fetchInstance = new m(t, o);
|
|
85
|
+
}
|
|
86
|
+
addCashflowEvent = async (t) => this.fetchInstance.post(r.CASHFLOW_EVENTS, { ...t }).then((o) => o);
|
|
87
|
+
addCashflowSequence = async (t) => this.fetchInstance.post(r.CASHFLOW_SEQUENCES, { ...t }).then((o) => o.cashflow_sequence);
|
|
88
|
+
getCashflowSequences = async () => this.fetchInstance.get(r.CASHFLOW_SEQUENCES).then((t) => t.cashflow_sequences);
|
|
89
|
+
getCashflowEventsByDateRange = async (t, o) => this.fetchInstance.get(
|
|
90
|
+
`${r.CASHFLOW_EVENTS}/from/${i(t)}/to/${i(o)}`
|
|
91
|
+
).then((p) => p.cashflow_events);
|
|
92
|
+
deleteCashflowSequence = async (t) => this.fetchInstance.delete(`${r.CASHFLOW_SEQUENCES}/${t}`).then((o) => o);
|
|
93
|
+
getProjectedCashflowEvents = async (t, o) => this.fetchInstance.get(
|
|
94
|
+
`${r.CASHFLOW_SEQUENCES}/projected_events/from/${i(
|
|
95
|
+
t
|
|
96
|
+
)}/to/${i(o)}`
|
|
97
|
+
).then((p) => p.cashflow_events);
|
|
98
|
+
updateCashflowSequence = async (t) => this.fetchInstance.put(`${r.CASHFLOW_SEQUENCES}/${t.guid}`, t).then((o) => o.cashflow_sequence);
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
vt as C
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=CashflowApi-zcebgnO1.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CashflowApi-zcebgnO1.mjs","sources":["../src/cashflow/api/CashflowApi.ts"],"sourcesContent":["import { getUnixTime } from 'date-fns/getUnixTime'\n\nimport { ApiEndpoints, Fetch, type CashflowEvent, type CashflowSequence } from '../../common'\n\nexport class CashflowApi {\n fetchInstance: Fetch\n\n constructor(endpoint: string, token: string) {\n this.fetchInstance = new Fetch(endpoint, token)\n }\n\n addCashflowEvent = async (cashflowEvent: CashflowEvent) => {\n return this.fetchInstance\n .post(ApiEndpoints.CASHFLOW_EVENTS, { ...cashflowEvent })\n .then((data) => data)\n }\n\n addCashflowSequence = async (cashflowSequence: CashflowSequence) => {\n return this.fetchInstance\n .post(ApiEndpoints.CASHFLOW_SEQUENCES, { ...cashflowSequence })\n .then((data) => data.cashflow_sequence)\n }\n\n getCashflowSequences = async (): Promise<CashflowSequence[]> => {\n return this.fetchInstance\n .get(ApiEndpoints.CASHFLOW_SEQUENCES)\n .then((data) => data.cashflow_sequences)\n }\n\n getCashflowEventsByDateRange = async (\n beginDate: Date,\n endDate: Date,\n ): Promise<CashflowEvent[]> => {\n return this.fetchInstance\n .get(\n `${ApiEndpoints.CASHFLOW_EVENTS}/from/${getUnixTime(beginDate)}/to/${getUnixTime(endDate)}`,\n )\n .then((data) => data.cashflow_events)\n }\n\n deleteCashflowSequence = async (guid: string) => {\n return this.fetchInstance\n .delete(`${ApiEndpoints.CASHFLOW_SEQUENCES}/${guid}`)\n .then((data) => data)\n }\n\n getProjectedCashflowEvents = async (beginDate: Date, endDate: Date): Promise<CashflowEvent[]> => {\n return this.fetchInstance\n .get(\n `${ApiEndpoints.CASHFLOW_SEQUENCES}/projected_events/from/${getUnixTime(\n beginDate,\n )}/to/${getUnixTime(endDate)}`,\n )\n .then((data) => data.cashflow_events)\n }\n\n updateCashflowSequence = async (cashflowSequence: CashflowSequence) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.CASHFLOW_SEQUENCES}/${cashflowSequence.guid}`, cashflowSequence)\n .then((data) => data.cashflow_sequence)\n }\n}\n"],"names":["CashflowApi","endpoint","token","Fetch","cashflowEvent","ApiEndpoints","data","cashflowSequence","beginDate","endDate","getUnixTime","guid"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,MAAMA,GAAY;AAAA,EACvB;AAAA,EAEA,YAAYC,GAAkBC,GAAe;AAC3C,SAAK,gBAAgB,IAAIC,EAAMF,GAAUC,CAAK;AAAA,EAChD;AAAA,EAEA,mBAAmB,OAAOE,MACjB,KAAK,cACT,KAAKC,EAAa,iBAAiB,EAAE,GAAGD,EAAA,CAAe,EACvD,KAAK,CAACE,MAASA,CAAI;AAAA,EAGxB,sBAAsB,OAAOC,MACpB,KAAK,cACT,KAAKF,EAAa,oBAAoB,EAAE,GAAGE,EAAkB,CAAA,EAC7D,KAAK,CAACD,MAASA,EAAK,iBAAiB;AAAA,EAG1C,uBAAuB,YACd,KAAK,cACT,IAAID,EAAa,kBAAkB,EACnC,KAAK,CAACC,MAASA,EAAK,kBAAkB;AAAA,EAG3C,+BAA+B,OAC7BE,GACAC,MAEO,KAAK,cACT;AAAA,IACC,GAAGJ,EAAa,eAAe,SAASK,EAAYF,CAAS,CAAC,OAAOE,EAAYD,CAAO,CAAC;AAAA,EAE1F,EAAA,KAAK,CAACH,MAASA,EAAK,eAAe;AAAA,EAGxC,yBAAyB,OAAOK,MACvB,KAAK,cACT,OAAO,GAAGN,EAAa,kBAAkB,IAAIM,CAAI,EAAE,EACnD,KAAK,CAACL,MAASA,CAAI;AAAA,EAGxB,6BAA6B,OAAOE,GAAiBC,MAC5C,KAAK,cACT;AAAA,IACC,GAAGJ,EAAa,kBAAkB,0BAA0BK;AAAA,MAC1DF;AAAA,IACD,CAAA,OAAOE,EAAYD,CAAO,CAAC;AAAA,EAE7B,EAAA,KAAK,CAACH,MAASA,EAAK,eAAe;AAAA,EAGxC,yBAAyB,OAAOC,MACvB,KAAK,cACT,IAAI,GAAGF,EAAa,kBAAkB,IAAIE,EAAiB,IAAI,IAAIA,CAAgB,EACnF,KAAK,CAACD,MAASA,EAAK,iBAAiB;AAE5C;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { makeAutoObservable as o } from "mobx";
|
|
2
|
+
import { addDays as r } from "date-fns/addDays";
|
|
3
|
+
import { differenceInDays as n } from "date-fns/differenceInDays";
|
|
4
|
+
import { endOfMonth as i } from "date-fns/endOfMonth";
|
|
5
|
+
import { isBefore as a } from "date-fns/isBefore";
|
|
6
|
+
import { startOfToday as t } from "date-fns/startOfToday";
|
|
7
|
+
class c {
|
|
8
|
+
// Cashflow is hard-coded to display 30 days starting from today
|
|
9
|
+
dateRange = { start: t(), end: r(t(), 30) };
|
|
10
|
+
isDirty = !1;
|
|
11
|
+
nextIncome = void 0;
|
|
12
|
+
upcomingExpenses = [];
|
|
13
|
+
selectedCashAccounts = [];
|
|
14
|
+
constructor() {
|
|
15
|
+
o(this);
|
|
16
|
+
}
|
|
17
|
+
// Returns the number of days until the next income activity or 0 if there is no income activity
|
|
18
|
+
get daysUntilNextIncome() {
|
|
19
|
+
return this.nextIncome ? Math.abs(n(t(), this.nextIncome.expectedDate)) : 0;
|
|
20
|
+
}
|
|
21
|
+
// Returns the expenses (Activities) until the next income activity or the end of the month
|
|
22
|
+
// if there is no income activity
|
|
23
|
+
get expensesTilNextIncome() {
|
|
24
|
+
return this.upcomingExpenses.filter(
|
|
25
|
+
(e) => a(e.expectedDate, this.nextIncome?.expectedDate || i(/* @__PURE__ */ new Date()))
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
setNextIncome = (e) => {
|
|
29
|
+
this.nextIncome = e;
|
|
30
|
+
};
|
|
31
|
+
setUpcomingExpenses = (e) => {
|
|
32
|
+
this.upcomingExpenses = e;
|
|
33
|
+
};
|
|
34
|
+
setSelectedCashAccounts = (e) => this.selectedCashAccounts = e;
|
|
35
|
+
}
|
|
36
|
+
class f {
|
|
37
|
+
globalStore;
|
|
38
|
+
uiStore;
|
|
39
|
+
constructor(e) {
|
|
40
|
+
this.globalStore = e, this.uiStore = new c(), o(this);
|
|
41
|
+
}
|
|
42
|
+
completeOnboarding = async () => {
|
|
43
|
+
const e = {
|
|
44
|
+
...this.globalStore.userStore.userProfile,
|
|
45
|
+
has_completed_cash_flow_onboarding: !0
|
|
46
|
+
};
|
|
47
|
+
await this.globalStore.userStore.updateUserProfile(e);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
f as C
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=CashflowStore-gPEEBiXo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CashflowStore-gPEEBiXo.mjs","sources":["../src/cashflow/stores/UiStore.ts","../src/cashflow/stores/CashflowStore.ts"],"sourcesContent":["import { makeAutoObservable } from 'mobx'\nimport { addDays } from 'date-fns/addDays'\nimport { differenceInDays } from 'date-fns/differenceInDays'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { isBefore } from 'date-fns/isBefore'\nimport { startOfToday } from 'date-fns/startOfToday'\n\nimport { type Account, type Activity } from '../../common'\n\nexport class UiStore {\n // Cashflow is hard-coded to display 30 days starting from today\n dateRange = { start: startOfToday(), end: addDays(startOfToday(), 30) }\n isDirty = false\n\n nextIncome: Activity | undefined = undefined\n upcomingExpenses: Activity[] = []\n\n selectedCashAccounts: Account[] = []\n\n constructor() {\n makeAutoObservable(this)\n }\n\n // Returns the number of days until the next income activity or 0 if there is no income activity\n get daysUntilNextIncome() {\n return this.nextIncome\n ? Math.abs(differenceInDays(startOfToday(), this.nextIncome.expectedDate))\n : 0\n }\n\n // Returns the expenses (Activities) until the next income activity or the end of the month\n // if there is no income activity\n get expensesTilNextIncome() {\n return this.upcomingExpenses.filter((a) =>\n isBefore(a.expectedDate, this.nextIncome?.expectedDate || endOfMonth(new Date())),\n )\n }\n\n setNextIncome = (nextIncome: Activity) => {\n this.nextIncome = nextIncome\n }\n\n setUpcomingExpenses = (expenses: Activity[]) => {\n this.upcomingExpenses = expenses\n }\n\n setSelectedCashAccounts = (accounts: Account[]) => (this.selectedCashAccounts = accounts)\n}\n","import { makeAutoObservable } from 'mobx'\n\nimport { GlobalStore, type UserProfile } from '../../common'\n\nimport { UiStore } from './UiStore'\n\nexport class CashflowStore {\n globalStore: GlobalStore\n uiStore: UiStore\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.uiStore = new UiStore()\n\n makeAutoObservable(this)\n }\n\n completeOnboarding = async () => {\n const updatedUserProfile = {\n ...this.globalStore.userStore.userProfile,\n has_completed_cash_flow_onboarding: true,\n } as UserProfile\n\n await this.globalStore.userStore.updateUserProfile(updatedUserProfile)\n }\n}\n"],"names":["UiStore","startOfToday","addDays","makeAutoObservable","differenceInDays","a","isBefore","endOfMonth","nextIncome","expenses","accounts","CashflowStore","globalStore","updatedUserProfile"],"mappings":";;;;;;AASO,MAAMA,EAAQ;AAAA;AAAA,EAEnB,YAAY,EAAE,OAAOC,KAAgB,KAAKC,EAAQD,EAAA,GAAgB,EAAE;EACpE,UAAU;AAAA,EAEV,aAAmC;AAAA,EACnC,mBAA+B,CAAA;AAAA,EAE/B,uBAAkC,CAAA;AAAA,EAElC,cAAc;AACZ,IAAAE,EAAmB,IAAI;AAAA,EACzB;AAAA;AAAA,EAGA,IAAI,sBAAsB;AACjB,WAAA,KAAK,aACR,KAAK,IAAIC,EAAiBH,EAAa,GAAG,KAAK,WAAW,YAAY,CAAC,IACvE;AAAA,EACN;AAAA;AAAA;AAAA,EAIA,IAAI,wBAAwB;AAC1B,WAAO,KAAK,iBAAiB;AAAA,MAAO,CAACI,MACnCC,EAASD,EAAE,cAAc,KAAK,YAAY,gBAAgBE,EAAW,oBAAI,KAAM,CAAA,CAAC;AAAA,IAAA;AAAA,EAEpF;AAAA,EAEA,gBAAgB,CAACC,MAAyB;AACxC,SAAK,aAAaA;AAAA,EAAA;AAAA,EAGpB,sBAAsB,CAACC,MAAyB;AAC9C,SAAK,mBAAmBA;AAAA,EAAA;AAAA,EAG1B,0BAA0B,CAACC,MAAyB,KAAK,uBAAuBA;AAClF;ACzCO,MAAMC,EAAc;AAAA,EACzB;AAAA,EACA;AAAA,EAEA,YAAYC,GAA0B;AACpC,SAAK,cAAcA,GACd,KAAA,UAAU,IAAIZ,KAEnBG,EAAmB,IAAI;AAAA,EACzB;AAAA,EAEA,qBAAqB,YAAY;AAC/B,UAAMU,IAAqB;AAAA,MACzB,GAAG,KAAK,YAAY,UAAU;AAAA,MAC9B,oCAAoC;AAAA,IAAA;AAGtC,UAAM,KAAK,YAAY,UAAU,kBAAkBA,CAAkB;AAAA,EAAA;AAEzE;"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import "date-fns/intlFormat";
|
|
2
|
+
import "date-fns/getUnixTime";
|
|
3
|
+
import "bowser";
|
|
4
|
+
import "react";
|
|
5
|
+
import "@honeybadger-io/react";
|
|
6
|
+
import "react/jsx-runtime";
|
|
7
|
+
import "@mui/material/Button";
|
|
8
|
+
import "@kyper/mui";
|
|
9
|
+
import "@mui/material/Tooltip";
|
|
10
|
+
import "@mui/material/Box";
|
|
11
|
+
import "@mui/material/IconButton";
|
|
12
|
+
import { V as s } from "./ConnectMiniWidget-Ep65CtHH.mjs";
|
|
13
|
+
import "@mui/material/styles/useTheme";
|
|
14
|
+
import "@mui/material/useMediaQuery";
|
|
15
|
+
import "@mxenabled/cssinjs";
|
|
16
|
+
import "date-fns/addDays";
|
|
17
|
+
import "date-fns/addMonths";
|
|
18
|
+
import "date-fns/eachDayOfInterval";
|
|
19
|
+
import "date-fns/eachWeekOfInterval";
|
|
20
|
+
import "date-fns/endOfMonth";
|
|
21
|
+
import "date-fns/format";
|
|
22
|
+
import "date-fns/isBefore";
|
|
23
|
+
import "date-fns/isSameMonth";
|
|
24
|
+
import "date-fns/startOfMonth";
|
|
25
|
+
import "date-fns/startOfToday";
|
|
26
|
+
import "date-fns/subMonths";
|
|
27
|
+
import "@mui/material/Paper";
|
|
28
|
+
import "@mui/icons-material/KeyboardArrowLeftRounded";
|
|
29
|
+
import "@mui/icons-material/KeyboardArrowRightRounded";
|
|
30
|
+
import "date-fns/isSameDay";
|
|
31
|
+
import "date-fns/isWithinInterval";
|
|
32
|
+
import "d3";
|
|
33
|
+
import "@mui/material/styles";
|
|
34
|
+
import "@mui/x-charts";
|
|
35
|
+
import "@mui/material/Stack";
|
|
36
|
+
import "@mui/material";
|
|
37
|
+
import "date-fns/addYears";
|
|
38
|
+
import "date-fns/differenceInCalendarDays";
|
|
39
|
+
import "date-fns/endOfToday";
|
|
40
|
+
import "date-fns/endOfYear";
|
|
41
|
+
import "date-fns/startOfYear";
|
|
42
|
+
import "date-fns/subDays";
|
|
43
|
+
import "date-fns/subYears";
|
|
44
|
+
import "@mui/material/ButtonGroup";
|
|
45
|
+
import "@mui/material/Tab";
|
|
46
|
+
import "@mui/material/Tabs";
|
|
47
|
+
import "@mui/material/ToggleButton";
|
|
48
|
+
import "@mui/material/ToggleButtonGroup";
|
|
49
|
+
import "@mui/material/Dialog";
|
|
50
|
+
import "@mui/material/DialogContent";
|
|
51
|
+
import "@mui/icons-material/ArrowBackOutlined";
|
|
52
|
+
import "@mui/material/Card";
|
|
53
|
+
import "@mui/material/CardHeader";
|
|
54
|
+
import "@mui/material/CardContent";
|
|
55
|
+
import "uuid";
|
|
56
|
+
import "numeral";
|
|
57
|
+
import "@mui/material/CircularProgress";
|
|
58
|
+
import "@mui/material/FormControlLabel";
|
|
59
|
+
import "@mui/material/Radio";
|
|
60
|
+
import "@mui/material/Avatar";
|
|
61
|
+
import "@mui/material/ListItem";
|
|
62
|
+
import "@mui/material/ListItemAvatar";
|
|
63
|
+
import "@mui/material/ListItemButton";
|
|
64
|
+
import "@mui/material/ListItemText";
|
|
65
|
+
import "@mui/material/ListItemIcon";
|
|
66
|
+
import "mobx";
|
|
67
|
+
import "date-fns/differenceInDays";
|
|
68
|
+
import "date-fns/fromUnixTime";
|
|
69
|
+
import "@mui/x-data-grid-pro";
|
|
70
|
+
import "date-fns";
|
|
71
|
+
import "date-fns/getMonth";
|
|
72
|
+
import "date-fns/isAfter";
|
|
73
|
+
import "date-fns/addQuarters";
|
|
74
|
+
import "date-fns/addWeeks";
|
|
75
|
+
import "date-fns/nextDay";
|
|
76
|
+
import "date-fns/parseISO";
|
|
77
|
+
import "date-fns/setDate";
|
|
78
|
+
import "date-fns/subWeeks";
|
|
79
|
+
import "date-fns/getDay";
|
|
80
|
+
import "date-fns/formatISO";
|
|
81
|
+
const g = (o, r) => o.find((t) => t.guid === r), qt = (o, r) => o.find((t) => t.guid === r), wt = (o, r) => {
|
|
82
|
+
const t = o.find((i) => i.subCategories.find((p) => p.guid === r));
|
|
83
|
+
if (t)
|
|
84
|
+
return t.subCategories.find((i) => i.guid === r);
|
|
85
|
+
}, zt = (o, r) => {
|
|
86
|
+
const t = [];
|
|
87
|
+
for (const i of r) {
|
|
88
|
+
const p = g(o, i.category_guid);
|
|
89
|
+
if (!p) continue;
|
|
90
|
+
const m = p.parent_guid ?? p.guid, e = g(o, m);
|
|
91
|
+
if (!e) continue;
|
|
92
|
+
const n = {
|
|
93
|
+
amount: i.total,
|
|
94
|
+
category: p,
|
|
95
|
+
guid: p.guid,
|
|
96
|
+
subCategoryTotals: []
|
|
97
|
+
}, a = t.find((u) => u.guid === m);
|
|
98
|
+
a ? (a.amount += i.total, a.subCategoryTotals.push(n)) : t.push({
|
|
99
|
+
amount: i.total,
|
|
100
|
+
category: e,
|
|
101
|
+
guid: m,
|
|
102
|
+
subCategoryTotals: [n]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return t;
|
|
106
|
+
}, At = (o, r) => {
|
|
107
|
+
const t = o.find((i) => i.guid === r);
|
|
108
|
+
return t ? t.guid === s.INCOME || t.parent_guid === s.INCOME : !1;
|
|
109
|
+
};
|
|
110
|
+
export {
|
|
111
|
+
wt as a,
|
|
112
|
+
g as b,
|
|
113
|
+
zt as c,
|
|
114
|
+
qt as g,
|
|
115
|
+
At as i
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=Categories-XVFviD23.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Categories-XVFviD23.mjs","sources":["../src/common/utils/Categories.ts"],"sourcesContent":["import type { Category, CategoryTotal, DateRangeCategoryTotals, DetailedCategory } from '../types'\nimport { CategoryGuids } from '../constants'\n\nexport const getCategory = (\n categories: Category[],\n categoryGuid: string | undefined,\n): Category | undefined => {\n return categories.find((c) => c.guid === categoryGuid)\n}\n\nexport const getDetailedCategory = (\n detailedCategories: DetailedCategory[],\n guid: string | undefined,\n): DetailedCategory | undefined => {\n return detailedCategories.find((dc) => dc.guid === guid)\n}\n\nexport const getDetailedSubCategory = (\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 getCategoryTotalsByParent = (\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 = getCategory(categories, dateRangeTotal.category_guid)\n if (!category) continue\n\n const parentGuid = category.parent_guid ?? category.guid\n const parentCategory = getCategory(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"],"names":["getCategory","categories","categoryGuid","c","getDetailedCategory","detailedCategories","guid","dc","getDetailedSubCategory","parent","sc","getCategoryTotalsByParent","dateRangeTotals","categoryTotals","dateRangeTotal","category","parentGuid","parentCategory","categoryTotal","parentCategoryTotal","ct","isIncome","CategoryGuids"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGa,MAAAA,IAAc,CACzBC,GACAC,MAEOD,EAAW,KAAK,CAACE,MAAMA,EAAE,SAASD,CAAY,GAG1CE,KAAsB,CACjCC,GACAC,MAEOD,EAAmB,KAAK,CAACE,MAAOA,EAAG,SAASD,CAAI,GAG5CE,KAAyB,CACpCH,GACAC,MACiC;AACjC,QAAMG,IAASJ,EAAmB,KAAK,CAACE,MAAOA,EAAG,cAAc,KAAK,CAACG,MAAOA,EAAG,SAASJ,CAAI,CAAC;AAC1F,MAACG;AAEL,WAAOA,EAAO,cAAc,KAAK,CAACC,MAAOA,EAAG,SAASJ,CAAI;AAC3D,GAEaK,KAA4B,CACvCV,GACAW,MACoB;AACpB,QAAMC,IAAiB,CAAA;AAMvB,aAAWC,KAAkBF,GAAiB;AAC5C,UAAMG,IAAWf,EAAYC,GAAYa,EAAe,aAAa;AACrE,QAAI,CAACC,EAAU;AAET,UAAAC,IAAaD,EAAS,eAAeA,EAAS,MAC9CE,IAAiBjB,EAAYC,GAAYe,CAAU;AACzD,QAAI,CAACC,EAAgB;AAErB,UAAMC,IAAgB;AAAA,MACpB,QAAQJ,EAAe;AAAA,MACvB,UAAAC;AAAA,MACA,MAAMA,EAAS;AAAA,MACf,mBAAmB,CAAC;AAAA,IAAA,GAGhBI,IAAsBN,EAAe,KAAK,CAACO,MAAOA,EAAG,SAASJ,CAAU;AAC9E,IAAIG,KACFA,EAAoB,UAAUL,EAAe,OACzBK,EAAA,kBAAkB,KAAKD,CAAa,KAExDL,EAAe,KAAK;AAAA,MAClB,QAAQC,EAAe;AAAA,MACvB,UAAUG;AAAA,MACV,MAAMD;AAAA,MACN,mBAAmB,CAACE,CAAa;AAAA,IAAA,CAClC;AAAA,EAEL;AAEO,SAAAL;AACT,GAEaQ,KAAW,CAACpB,GAAwBK,MAAiB;AAChE,QAAMS,IAAWd,EAAW,KAAK,CAACE,MAAMA,EAAE,SAASG,CAAI;AACnD,SAACS,IAEEA,EAAS,SAASO,EAAc,UAAUP,EAAS,gBAAgBO,EAAc,SAFlE;AAGxB;"}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { makeAutoObservable as w, runInAction as h } from "mobx";
|
|
2
|
+
import { getUnixTime as l } from "date-fns/getUnixTime";
|
|
3
|
+
import { subMonths as p } from "date-fns/subMonths";
|
|
4
|
+
import { startOfMonth as d } from "date-fns/startOfMonth";
|
|
5
|
+
import { endOfMonth as C } from "date-fns/endOfMonth";
|
|
6
|
+
import "bowser";
|
|
7
|
+
import "date-fns/intlFormat";
|
|
8
|
+
import { aj as M, al as b, V as E, af as $, ag as G, am as L } from "./ConnectMiniWidget-Ep65CtHH.mjs";
|
|
9
|
+
import "react";
|
|
10
|
+
import "@honeybadger-io/react";
|
|
11
|
+
import "numeral";
|
|
12
|
+
import "date-fns/addMonths";
|
|
13
|
+
import "date-fns/addQuarters";
|
|
14
|
+
import "date-fns/addWeeks";
|
|
15
|
+
import "date-fns/addYears";
|
|
16
|
+
import "date-fns/getDay";
|
|
17
|
+
import "date-fns/isBefore";
|
|
18
|
+
import "date-fns/nextDay";
|
|
19
|
+
import "date-fns/setDate";
|
|
20
|
+
import { startOfToday as D } from "date-fns/startOfToday";
|
|
21
|
+
import "date-fns/fromUnixTime";
|
|
22
|
+
import { F as N, A as c } from "./Fetch-DpUi1_Dx.mjs";
|
|
23
|
+
import "react/jsx-runtime";
|
|
24
|
+
import "@mui/material/Button";
|
|
25
|
+
import "@kyper/mui";
|
|
26
|
+
import "@mui/material/Tooltip";
|
|
27
|
+
import "@mui/material/Box";
|
|
28
|
+
import "@mui/material/IconButton";
|
|
29
|
+
import "@mui/material/styles/useTheme";
|
|
30
|
+
import "@mui/material/useMediaQuery";
|
|
31
|
+
import "@mxenabled/cssinjs";
|
|
32
|
+
import "date-fns/addDays";
|
|
33
|
+
import "date-fns/eachDayOfInterval";
|
|
34
|
+
import "date-fns/eachWeekOfInterval";
|
|
35
|
+
import { format as T } from "date-fns/format";
|
|
36
|
+
import "date-fns/isSameMonth";
|
|
37
|
+
import "@mui/material/Paper";
|
|
38
|
+
import "@mui/icons-material/KeyboardArrowLeftRounded";
|
|
39
|
+
import "@mui/icons-material/KeyboardArrowRightRounded";
|
|
40
|
+
import "date-fns/isSameDay";
|
|
41
|
+
import "date-fns/isWithinInterval";
|
|
42
|
+
import "d3";
|
|
43
|
+
import "@mui/material/styles";
|
|
44
|
+
import "@mui/x-charts";
|
|
45
|
+
import "@mui/material/Stack";
|
|
46
|
+
import "@mui/material";
|
|
47
|
+
import "date-fns/differenceInCalendarDays";
|
|
48
|
+
import "date-fns/endOfToday";
|
|
49
|
+
import "date-fns/endOfYear";
|
|
50
|
+
import "date-fns/startOfYear";
|
|
51
|
+
import "date-fns/subDays";
|
|
52
|
+
import "date-fns/subYears";
|
|
53
|
+
import "@mui/material/ButtonGroup";
|
|
54
|
+
import "@mui/material/Tab";
|
|
55
|
+
import "@mui/material/Tabs";
|
|
56
|
+
import "@mui/material/ToggleButton";
|
|
57
|
+
import "@mui/material/ToggleButtonGroup";
|
|
58
|
+
import "@mui/material/Dialog";
|
|
59
|
+
import "@mui/material/DialogContent";
|
|
60
|
+
import "@mui/icons-material/ArrowBackOutlined";
|
|
61
|
+
import "@mui/material/Card";
|
|
62
|
+
import "@mui/material/CardHeader";
|
|
63
|
+
import "@mui/material/CardContent";
|
|
64
|
+
import "uuid";
|
|
65
|
+
import "@mui/material/CircularProgress";
|
|
66
|
+
import "@mui/material/FormControlLabel";
|
|
67
|
+
import "@mui/material/Radio";
|
|
68
|
+
import "@mui/material/Avatar";
|
|
69
|
+
import "@mui/material/ListItem";
|
|
70
|
+
import "@mui/material/ListItemAvatar";
|
|
71
|
+
import "@mui/material/ListItemButton";
|
|
72
|
+
import "@mui/material/ListItemText";
|
|
73
|
+
import "@mui/material/ListItemIcon";
|
|
74
|
+
import "date-fns/differenceInDays";
|
|
75
|
+
import "@mui/x-data-grid-pro";
|
|
76
|
+
import "date-fns";
|
|
77
|
+
import "date-fns/getMonth";
|
|
78
|
+
import "date-fns/isAfter";
|
|
79
|
+
import "date-fns/parseISO";
|
|
80
|
+
import "date-fns/subWeeks";
|
|
81
|
+
import "date-fns/formatISO";
|
|
82
|
+
class f {
|
|
83
|
+
fetchInstance;
|
|
84
|
+
constructor(t, e) {
|
|
85
|
+
this.fetchInstance = new N(t, e);
|
|
86
|
+
}
|
|
87
|
+
addCategory = async (t) => this.fetchInstance.post(c.CATEGORIES, t).then((e) => e.category);
|
|
88
|
+
getCategories = async () => this.fetchInstance.get(c.CATEGORIES).then((t) => t.categories);
|
|
89
|
+
getDateRangeCategoryTotals = async (t, e, r) => this.fetchInstance.post(`${c.DATE_RANGE_CATEGORY_TOTALS}/from/${t}/to/${e}`, {
|
|
90
|
+
account_guid: r.map((o) => o.guid)
|
|
91
|
+
}).then((o) => o.date_range_category_totals);
|
|
92
|
+
getMonthlyCategoryTotals = async (t, e, r) => r ? this.fetchInstance.post(`${c.MONTHLY_CATEGORY_TOTALS}/from/${t}/to/${e}`, {
|
|
93
|
+
account_guid: r.length === 0 ? [""] : r.map((o) => o.guid)
|
|
94
|
+
}).then((o) => o.monthly_category_totals) : this.fetchInstance.get(`${c.MONTHLY_CATEGORY_TOTALS}/from/${t}/to/${e}`).then((o) => o.monthly_category_totals);
|
|
95
|
+
removeCategory = async (t) => this.fetchInstance.delete(`${c.CATEGORIES}/${t}`);
|
|
96
|
+
updateCategory = async (t) => this.fetchInstance.put(`${c.CATEGORIES}/${t.guid}`, t).then((e) => e.category);
|
|
97
|
+
}
|
|
98
|
+
const v = 3, S = 12, x = (a, t, e) => a.filter((r) => !r.parent_guid).map(
|
|
99
|
+
(r) => O(
|
|
100
|
+
r,
|
|
101
|
+
t,
|
|
102
|
+
e,
|
|
103
|
+
a.filter((o) => o.parent_guid === r.guid)
|
|
104
|
+
)
|
|
105
|
+
), O = (a, t, e, r = []) => {
|
|
106
|
+
const o = a.guid, s = a.parent_guid || o, n = o === s, g = t.find((i) => i.category_guid === o)?.total || 0, m = _(
|
|
107
|
+
e.filter((i) => i.category_guid === o)
|
|
108
|
+
), y = _(
|
|
109
|
+
e.filter(
|
|
110
|
+
(i) => i.category_guid === o || i.top_level_category_guid === o
|
|
111
|
+
)
|
|
112
|
+
), u = r.map(
|
|
113
|
+
(i) => O(i, t, e)
|
|
114
|
+
), I = u.reduce(
|
|
115
|
+
(i, R) => i + R.currentAmount,
|
|
116
|
+
g
|
|
117
|
+
);
|
|
118
|
+
return {
|
|
119
|
+
...a,
|
|
120
|
+
currentAmount: g,
|
|
121
|
+
averageAmount: A(m),
|
|
122
|
+
color: M[s],
|
|
123
|
+
icon: b[s],
|
|
124
|
+
isTransfer: s === E.TRANSFER,
|
|
125
|
+
monthlyAmounts: m,
|
|
126
|
+
subCategories: u,
|
|
127
|
+
totalAmount: n ? I : 0,
|
|
128
|
+
totalAverageAmount: A(y),
|
|
129
|
+
totalMonthlyAmounts: n ? y : []
|
|
130
|
+
};
|
|
131
|
+
}, A = (a, t = v) => {
|
|
132
|
+
const e = t > history.length ? history.length : t;
|
|
133
|
+
return Math.ceil(
|
|
134
|
+
Math.max(
|
|
135
|
+
0,
|
|
136
|
+
a.slice(-e).reduce((r, o) => r + o.amount, 0) / e
|
|
137
|
+
)
|
|
138
|
+
);
|
|
139
|
+
}, _ = (a) => {
|
|
140
|
+
const t = [], e = D();
|
|
141
|
+
for (let r = 0; r <= S; r++) {
|
|
142
|
+
const o = d(p(e, S - r)), n = a.filter(
|
|
143
|
+
(g) => g.year_month === Number(T(o, "yyyyMM"))
|
|
144
|
+
).reduce((g, m) => g + m.total, 0);
|
|
145
|
+
t.push({
|
|
146
|
+
amount: n,
|
|
147
|
+
isoDate: T(o, "yyyy-MM-dd"),
|
|
148
|
+
label: $(o, G.MONTH_YEAR)
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
return t;
|
|
152
|
+
};
|
|
153
|
+
class Y {
|
|
154
|
+
expandedGuid = null;
|
|
155
|
+
selectedGuid = null;
|
|
156
|
+
searchValue = "";
|
|
157
|
+
showSelected = !0;
|
|
158
|
+
shouldDisableDrawerScroll = !1;
|
|
159
|
+
unselectable = [];
|
|
160
|
+
unselectableText = "";
|
|
161
|
+
savedOnSelect;
|
|
162
|
+
// todo
|
|
163
|
+
constructor() {
|
|
164
|
+
w(this);
|
|
165
|
+
}
|
|
166
|
+
setExpandedGuid = (t) => this.expandedGuid = t;
|
|
167
|
+
setSelectedGuid = (t) => this.selectedGuid = t;
|
|
168
|
+
setSearchValue = (t) => this.searchValue = t;
|
|
169
|
+
setShouldDisableDrawerScroll = (t) => this.shouldDisableDrawerScroll = t;
|
|
170
|
+
setShowSelected = (t) => this.showSelected = t;
|
|
171
|
+
setUnselectable = (t) => this.unselectable = t;
|
|
172
|
+
setUnselectableText = (t) => this.unselectableText = t;
|
|
173
|
+
onSelect = (t) => this.savedOnSelect(t);
|
|
174
|
+
setOnSelect = (t) => this.savedOnSelect = t;
|
|
175
|
+
}
|
|
176
|
+
class me {
|
|
177
|
+
api = new f("/", "");
|
|
178
|
+
globalStore;
|
|
179
|
+
uiStore;
|
|
180
|
+
categories = [];
|
|
181
|
+
dateRangeCategoryTotals = [];
|
|
182
|
+
monthlyCategoryTotals = [];
|
|
183
|
+
isLoadingCategoryTotals = !1;
|
|
184
|
+
constructor(t) {
|
|
185
|
+
this.globalStore = t, this.uiStore = new Y(), w(this);
|
|
186
|
+
}
|
|
187
|
+
initialize = async (t, e) => {
|
|
188
|
+
this.api = new f(t, e), await this.loadCategories();
|
|
189
|
+
};
|
|
190
|
+
get detailedCategories() {
|
|
191
|
+
return x(
|
|
192
|
+
this.categories,
|
|
193
|
+
this.dateRangeCategoryTotals,
|
|
194
|
+
this.monthlyCategoryTotals
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
get incomeCategories() {
|
|
198
|
+
return this.detailedCategories.filter((t) => t.is_income);
|
|
199
|
+
}
|
|
200
|
+
get spendCategories() {
|
|
201
|
+
return this.detailedCategories.filter(
|
|
202
|
+
(t) => !t.is_income && !t.isTransfer && t.guid !== E.INVESTMENTS
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
get transferCategories() {
|
|
206
|
+
return this.detailedCategories.filter((t) => t.isTransfer);
|
|
207
|
+
}
|
|
208
|
+
addCategory = async (t, e) => {
|
|
209
|
+
const r = { name: t, parent_guid: e };
|
|
210
|
+
try {
|
|
211
|
+
await this.api.addCategory(r), await this.loadCategories();
|
|
212
|
+
} catch (o) {
|
|
213
|
+
console.error(`Error occurred while adding category: ${o}`);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
loadCategories = async () => {
|
|
217
|
+
try {
|
|
218
|
+
const t = await this.api.getCategories(), { default_categories: e } = this.globalStore.copyStore.copy.categories;
|
|
219
|
+
h(() => {
|
|
220
|
+
this.categories = t.map((r) => ({
|
|
221
|
+
...r,
|
|
222
|
+
name: e[r.guid] ? e[r.guid].replace(/&/g, "&") : r.name
|
|
223
|
+
}));
|
|
224
|
+
});
|
|
225
|
+
} catch (t) {
|
|
226
|
+
console.error(`Error occurred while getting categories: ${t}`);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
loadDateRangeCategoryTotals = async (t, e, r) => {
|
|
230
|
+
this.setIsLoadingCategoryTotals(!0);
|
|
231
|
+
try {
|
|
232
|
+
const o = await this.api.getDateRangeCategoryTotals(
|
|
233
|
+
l(e),
|
|
234
|
+
l(r),
|
|
235
|
+
t
|
|
236
|
+
);
|
|
237
|
+
h(() => {
|
|
238
|
+
this.dateRangeCategoryTotals = o, this.setIsLoadingCategoryTotals(!1);
|
|
239
|
+
});
|
|
240
|
+
} catch (o) {
|
|
241
|
+
this.setIsLoadingCategoryTotals(!1), console.error(`Error occurred while getting date range category totals: ${o}`);
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
loadMonthlyCategoryTotals = async (t = this.globalStore.accountStore.accounts, e, r) => {
|
|
245
|
+
const o = l(d(e ?? p(/* @__PURE__ */ new Date(), 11))), s = l(C(r ?? /* @__PURE__ */ new Date()));
|
|
246
|
+
try {
|
|
247
|
+
const n = await this.api.getMonthlyCategoryTotals(o, s, t);
|
|
248
|
+
h(() => {
|
|
249
|
+
this.monthlyCategoryTotals = n;
|
|
250
|
+
});
|
|
251
|
+
} catch (n) {
|
|
252
|
+
console.error(`Error occurred while getting monthly category totals: ${n}`);
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
reloadCategoryTotals = async (t, e, r) => {
|
|
256
|
+
this.setIsLoadingCategoryTotals(!0);
|
|
257
|
+
try {
|
|
258
|
+
const o = await this.api.getDateRangeCategoryTotals(
|
|
259
|
+
l(e),
|
|
260
|
+
l(r),
|
|
261
|
+
t
|
|
262
|
+
), s = await this.api.getMonthlyCategoryTotals(
|
|
263
|
+
l(d(p(r, 11))),
|
|
264
|
+
l(C(r)),
|
|
265
|
+
t
|
|
266
|
+
);
|
|
267
|
+
h(() => {
|
|
268
|
+
this.dateRangeCategoryTotals = o, this.monthlyCategoryTotals = s, this.setIsLoadingCategoryTotals(!1);
|
|
269
|
+
});
|
|
270
|
+
} catch (o) {
|
|
271
|
+
console.error(`Error occurred while getting category totals: ${o}`);
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
removeCategory = async (t) => {
|
|
275
|
+
try {
|
|
276
|
+
await this.api.removeCategory(t), await this.loadCategories();
|
|
277
|
+
} catch (e) {
|
|
278
|
+
console.error(`Error occurred while removing category: ${e}`);
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
setIsLoadingCategoryTotals = (t) => {
|
|
282
|
+
this.isLoadingCategoryTotals = t;
|
|
283
|
+
};
|
|
284
|
+
updateCategory = async (t) => {
|
|
285
|
+
try {
|
|
286
|
+
await this.api.updateCategory(t), await this.loadCategories();
|
|
287
|
+
} catch (e) {
|
|
288
|
+
console.error(`Error occurred while updating category: ${e}`);
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
// TODO: Remove this after refactoring Trends components to use detailedCategories
|
|
292
|
+
getCategoryName = (t) => this.categories.find((r) => r.guid === t)?.name ?? L[t];
|
|
293
|
+
}
|
|
294
|
+
export {
|
|
295
|
+
me as C,
|
|
296
|
+
f as a
|
|
297
|
+
};
|
|
298
|
+
//# sourceMappingURL=CategoryStore-CSNSMNA6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategoryStore-CSNSMNA6.mjs","sources":["../src/common/api/CategoryApi.ts","../src/categories/util/CategoryUtil.ts","../src/categories/stores/UiStore.ts","../src/categories/stores/CategoryStore.ts"],"sourcesContent":["import Fetch from '../utils/Fetch'\n\nimport { ApiEndpoints } from '../constants/ApiEndpoints'\n\nimport type { Account } from '../types/Account'\nimport type { Category } from '../types/Category'\n\nexport class CategoryApi {\n fetchInstance: Fetch\n\n constructor(endpoint: string, token: string) {\n this.fetchInstance = new Fetch(endpoint, token)\n }\n\n addCategory = async (category: Category) => {\n return this.fetchInstance.post(ApiEndpoints.CATEGORIES, category).then((data) => data.category)\n }\n\n getCategories = async () => {\n return this.fetchInstance.get(ApiEndpoints.CATEGORIES).then((data) => data.categories)\n }\n\n getDateRangeCategoryTotals = async (startDate: number, endDate: number, accounts: Account[]) => {\n return this.fetchInstance\n .post(`${ApiEndpoints.DATE_RANGE_CATEGORY_TOTALS}/from/${startDate}/to/${endDate}`, {\n account_guid: accounts.map((account) => account.guid),\n })\n .then((data) => data.date_range_category_totals)\n }\n\n getMonthlyCategoryTotals = async (startDate: number, endDate: number, accounts?: Account[]) => {\n return accounts\n ? this.fetchInstance\n .post(`${ApiEndpoints.MONTHLY_CATEGORY_TOTALS}/from/${startDate}/to/${endDate}`, {\n account_guid: accounts.length === 0 ? [''] : accounts.map((account) => account.guid),\n })\n .then((data) => data.monthly_category_totals)\n : this.fetchInstance\n .get(`${ApiEndpoints.MONTHLY_CATEGORY_TOTALS}/from/${startDate}/to/${endDate}`)\n .then((data) => data.monthly_category_totals)\n }\n\n removeCategory = async (guid: string) => {\n return this.fetchInstance.delete(`${ApiEndpoints.CATEGORIES}/${guid}`)\n }\n\n updateCategory = async (category: Category) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.CATEGORIES}/${category.guid}`, category)\n .then((data) => data.category)\n }\n}\n","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 {\n type Category,\n type DateRangeCategoryTotals,\n type DetailedCategory,\n type MonthlyAmount,\n type MonthlyCategoryTotals,\n CategoryColors,\n CategoryGuids,\n CategoryIcon,\n DATE_FORMATS_INTL,\n formatDate,\n} from '../../common'\n\nconst MONTHLY_AVERAGE_LENGTH = 3\nconst MONTHS_OF_HISTORY = 12\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 */\nexport const augmentCategories = (\n categories: Category[],\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 currentCategoryTotals,\n monthlyCategoryTotals,\n categories.filter((c) => c.parent_guid === category.guid),\n ),\n )\n}\n\n/**\n * Get an augmented category with additional details\n * @param category - The category to augment\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 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, currentCategoryTotals, monthlyCategoryTotals),\n )\n const totalAmount = detailedSubCategories.reduce(\n (total, current) => total + current.currentAmount,\n currentAmount,\n )\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 subCategories: detailedSubCategories,\n totalAmount: isParent ? totalAmount : 0,\n totalAverageAmount: getAverage(totalMonthlyAmounts),\n totalMonthlyAmounts: isParent ? totalMonthlyAmounts : [],\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","import { makeAutoObservable } from 'mobx'\n\nexport class UiStore {\n expandedGuid: string | null = null\n selectedGuid: string | null = null\n searchValue = ''\n showSelected = true\n shouldDisableDrawerScroll = false\n unselectable: string[] = []\n unselectableText = ''\n\n savedOnSelect: any // todo\n\n constructor() {\n makeAutoObservable(this)\n }\n\n setExpandedGuid = (guid: string | null) => (this.expandedGuid = guid)\n\n setSelectedGuid = (guid: string | null) => (this.selectedGuid = guid)\n\n setSearchValue = (value: string) => (this.searchValue = value)\n\n setShouldDisableDrawerScroll = (shouldDisable: boolean) =>\n (this.shouldDisableDrawerScroll = shouldDisable)\n\n setShowSelected = (showSelected: boolean) => (this.showSelected = showSelected)\n\n setUnselectable = (unselectable: string[]) => (this.unselectable = unselectable)\n\n setUnselectableText = (text: string) => (this.unselectableText = text)\n\n onSelect = (guid: string) => this.savedOnSelect(guid)\n\n setOnSelect = (callback: any) => (this.savedOnSelect = callback)\n}\n","import { makeAutoObservable, runInAction } from 'mobx'\nimport { getUnixTime } from 'date-fns/getUnixTime'\nimport { subMonths } from 'date-fns/subMonths'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { endOfMonth } from 'date-fns/endOfMonth'\n\nimport { Account, CategoryApi, CategoryGuids, CategoryGuidToName } from '../../common'\n\nimport type {\n Category,\n DetailedCategory,\n DateRangeCategoryTotals,\n GlobalStore,\n MonthlyCategoryTotals,\n} from '../../common'\n\nimport { augmentCategories } from '../util/CategoryUtil'\nimport { UiStore } from './UiStore'\n\nexport class CategoryStore {\n api = new CategoryApi('/', '')\n globalStore: GlobalStore\n uiStore: UiStore\n\n categories: Category[] = []\n dateRangeCategoryTotals: DateRangeCategoryTotals[] = []\n monthlyCategoryTotals: MonthlyCategoryTotals[] = []\n\n isLoadingCategoryTotals = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.uiStore = new UiStore()\n\n makeAutoObservable(this)\n }\n\n initialize = async (endpoint: string, token: string) => {\n this.api = new CategoryApi(endpoint, token)\n\n await this.loadCategories()\n }\n\n get detailedCategories(): DetailedCategory[] {\n return augmentCategories(\n this.categories,\n this.dateRangeCategoryTotals,\n this.monthlyCategoryTotals,\n )\n }\n\n get incomeCategories(): DetailedCategory[] {\n return this.detailedCategories.filter((c) => c.is_income)\n }\n\n get spendCategories(): DetailedCategory[] {\n return this.detailedCategories.filter(\n (c) => !c.is_income && !c.isTransfer && c.guid !== CategoryGuids.INVESTMENTS,\n )\n }\n\n get transferCategories(): DetailedCategory[] {\n return this.detailedCategories.filter((c) => c.isTransfer)\n }\n\n addCategory = async (name: string, parentGuid: string) => {\n const category = { name, parent_guid: parentGuid } as Category\n\n try {\n await this.api.addCategory(category)\n await this.loadCategories()\n } catch (error) {\n console.error(`Error occurred while adding category: ${error}`)\n }\n }\n\n loadCategories = async () => {\n try {\n const categories = await this.api.getCategories()\n const { default_categories } = this.globalStore.copyStore.copy.categories\n\n runInAction(() => {\n this.categories = categories.map((category: Category) => ({\n ...category,\n name: default_categories[category.guid]\n ? default_categories[category.guid].replace(/&/g, '&')\n : category.name,\n }))\n })\n } catch (error) {\n console.error(`Error occurred while getting categories: ${error}`)\n }\n }\n\n loadDateRangeCategoryTotals = async (accounts: Account[], startDate: Date, endDate: Date) => {\n this.setIsLoadingCategoryTotals(true)\n try {\n const totals = await this.api.getDateRangeCategoryTotals(\n getUnixTime(startDate),\n getUnixTime(endDate),\n accounts,\n )\n runInAction(() => {\n this.dateRangeCategoryTotals = totals\n this.setIsLoadingCategoryTotals(false)\n })\n } catch (error) {\n this.setIsLoadingCategoryTotals(false)\n console.error(`Error occurred while getting date range category totals: ${error}`)\n }\n }\n\n loadMonthlyCategoryTotals = async (\n accounts: Account[] = this.globalStore.accountStore.accounts,\n startDate?: Date,\n endDate?: Date,\n ) => {\n const start = getUnixTime(startOfMonth(startDate ?? subMonths(new Date(), 11)))\n const end = getUnixTime(endOfMonth(endDate ?? new Date()))\n\n try {\n const totals = await this.api.getMonthlyCategoryTotals(start, end, accounts)\n\n runInAction(() => {\n this.monthlyCategoryTotals = totals\n })\n } catch (error) {\n console.error(`Error occurred while getting monthly category totals: ${error}`)\n }\n }\n\n reloadCategoryTotals = async (accounts: Account[], startDate: Date, endDate: Date) => {\n this.setIsLoadingCategoryTotals(true)\n try {\n const dateRangeTotals = await this.api.getDateRangeCategoryTotals(\n getUnixTime(startDate),\n getUnixTime(endDate),\n accounts,\n )\n\n const monthlyTotals = await this.api.getMonthlyCategoryTotals(\n getUnixTime(startOfMonth(subMonths(endDate, 11))),\n getUnixTime(endOfMonth(endDate)),\n accounts,\n )\n\n runInAction(() => {\n this.dateRangeCategoryTotals = dateRangeTotals\n this.monthlyCategoryTotals = monthlyTotals\n this.setIsLoadingCategoryTotals(false)\n })\n } catch (error) {\n console.error(`Error occurred while getting category totals: ${error}`)\n }\n }\n\n removeCategory = async (guid: string) => {\n try {\n await this.api.removeCategory(guid)\n await this.loadCategories()\n } catch (error) {\n console.error(`Error occurred while removing category: ${error}`)\n }\n }\n\n setIsLoadingCategoryTotals = (isLoading: boolean) => {\n this.isLoadingCategoryTotals = isLoading\n }\n\n updateCategory = async (category: Category) => {\n try {\n await this.api.updateCategory(category)\n await this.loadCategories()\n } catch (error) {\n console.error(`Error occurred while updating category: ${error}`)\n }\n }\n\n // TODO: Remove this after refactoring Trends components to use detailedCategories\n getCategoryName = (guid: string) => {\n const category = this.categories.find((c) => c.guid === guid)\n return category?.name ?? CategoryGuidToName[guid]\n }\n}\n"],"names":["CategoryApi","endpoint","token","Fetch","category","ApiEndpoints","data","startDate","endDate","accounts","account","guid","MONTHLY_AVERAGE_LENGTH","MONTHS_OF_HISTORY","augmentCategories","categories","currentCategoryTotals","monthlyCategoryTotals","getDetailedCategory","c","subCategories","parentGuid","isParent","currentAmount","t","monthlyAmounts","getMonthlyAmounts","total","totalMonthlyAmounts","detailedSubCategories","subCategory","totalAmount","current","getAverage","CategoryColors","CategoryIcon","CategoryGuids","numMonths","monthsBack","categoryTotals","today","startOfToday","i","historyDate","startOfMonth","subMonths","format","acc","curr","formatDate","DATE_FORMATS_INTL","UiStore","makeAutoObservable","value","shouldDisable","showSelected","unselectable","text","callback","CategoryStore","globalStore","name","error","default_categories","runInAction","totals","getUnixTime","start","end","endOfMonth","dateRangeTotals","monthlyTotals","isLoading","CategoryGuidToName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOO,MAAMA,EAAY;AAAA,EACvB;AAAA,EAEA,YAAYC,GAAkBC,GAAe;AAC3C,SAAK,gBAAgB,IAAIC,EAAMF,GAAUC,CAAK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