@mx-cartographer/experiences 9.1.3 → 9.1.4-alpha.al1

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 (131) hide show
  1. package/CHANGELOG.md +0 -6
  2. package/dist/{AccountDetailsDrawer-Cq4kiiKD.mjs → AccountDetailsDrawer-Da1-Y86z.mjs} +10 -10
  3. package/dist/{AccountDetailsDrawer-Cq4kiiKD.mjs.map → AccountDetailsDrawer-Da1-Y86z.mjs.map} +1 -1
  4. package/dist/{AccountDetailsHeader-BliEZhz7.mjs → AccountDetailsHeader-CE0HYbRA.mjs} +4 -4
  5. package/dist/{AccountDetailsHeader-BliEZhz7.mjs.map → AccountDetailsHeader-CE0HYbRA.mjs.map} +1 -1
  6. package/dist/{Analytics-CkYXKvco.mjs → Analytics-BJDUP2qI.mjs} +2 -2
  7. package/dist/{Analytics-CkYXKvco.mjs.map → Analytics-BJDUP2qI.mjs.map} +1 -1
  8. package/dist/{CategorySelectorDrawer-NJsFsKP1.mjs → CategorySelectorDrawer-BM5mKt7P.mjs} +2 -2
  9. package/dist/{CategorySelectorDrawer-NJsFsKP1.mjs.map → CategorySelectorDrawer-BM5mKt7P.mjs.map} +1 -1
  10. package/dist/{Connect-BH0Pt6zc.mjs → Connect-JoOkCXSZ.mjs} +2 -2
  11. package/dist/{Connect-BH0Pt6zc.mjs.map → Connect-JoOkCXSZ.mjs.map} +1 -1
  12. package/dist/{ConnectCard-D7uxoH5Y.mjs → ConnectCard-DnZHCv3m.mjs} +2 -2
  13. package/dist/{ConnectCard-D7uxoH5Y.mjs.map → ConnectCard-DnZHCv3m.mjs.map} +1 -1
  14. package/dist/{ConnectDrawer-CW4LA3H3.mjs → ConnectDrawer-Btol_U7o.mjs} +3 -3
  15. package/dist/{ConnectDrawer-CW4LA3H3.mjs.map → ConnectDrawer-Btol_U7o.mjs.map} +1 -1
  16. package/dist/{ConnectionsDrawer-CZU9ku-k.mjs → ConnectionsDrawer-DGv6aJ6x.mjs} +3 -3
  17. package/dist/{ConnectionsDrawer-CZU9ku-k.mjs.map → ConnectionsDrawer-DGv6aJ6x.mjs.map} +1 -1
  18. package/dist/{CurrencyInput-DaGEQaLW.mjs → CurrencyInput-CxAsTGg2.mjs} +2 -2
  19. package/dist/{CurrencyInput-DaGEQaLW.mjs.map → CurrencyInput-CxAsTGg2.mjs.map} +1 -1
  20. package/dist/{EmbeddedCard-DCOQnTz-.mjs → EmbeddedCard-Dwj1CkBK.mjs} +3 -3
  21. package/dist/{EmbeddedCard-DCOQnTz-.mjs.map → EmbeddedCard-Dwj1CkBK.mjs.map} +1 -1
  22. package/dist/{Error-Dtw6yxkf.mjs → Error-BMVsnvtd.mjs} +2 -2
  23. package/dist/{Error-Dtw6yxkf.mjs.map → Error-BMVsnvtd.mjs.map} +1 -1
  24. package/dist/ErrorBoundary-C7BlHx04.mjs +27 -0
  25. package/dist/ErrorBoundary-C7BlHx04.mjs.map +1 -0
  26. package/dist/{ExportCsvAction-C-IisDcv.mjs → ExportCsvAction-B23U4xj8.mjs} +3 -3
  27. package/dist/{ExportCsvAction-C-IisDcv.mjs.map → ExportCsvAction-B23U4xj8.mjs.map} +1 -1
  28. package/dist/{GlobalAccountFilter-BhzR5Vb1.mjs → GlobalAccountFilter-1NlROwU8.mjs} +2 -2
  29. package/dist/{GlobalAccountFilter-BhzR5Vb1.mjs.map → GlobalAccountFilter-1NlROwU8.mjs.map} +1 -1
  30. package/dist/GlobalCopyApi-Tz10hezK.mjs +130 -0
  31. package/dist/GlobalCopyApi-Tz10hezK.mjs.map +1 -0
  32. package/dist/{Help-zVZdcmlk.mjs → Help-BC5OU0yX.mjs} +145 -145
  33. package/dist/Help-BC5OU0yX.mjs.map +1 -0
  34. package/dist/{LineChart-CUfiH86G.mjs → LineChart-YCIQN3ho.mjs} +2 -2
  35. package/dist/{LineChart-CUfiH86G.mjs.map → LineChart-YCIQN3ho.mjs.map} +1 -1
  36. package/dist/{ListItemAction-BqUCLj_w.mjs → ListItemAction-D-XYTjj4.mjs} +2 -2
  37. package/dist/{ListItemAction-BqUCLj_w.mjs.map → ListItemAction-D-XYTjj4.mjs.map} +1 -1
  38. package/dist/{ListItemWrapper-DRse79Iu.mjs → ListItemWrapper-XiustNlS.mjs} +2 -2
  39. package/dist/{ListItemWrapper-DRse79Iu.mjs.map → ListItemWrapper-XiustNlS.mjs.map} +1 -1
  40. package/dist/{ManageIncome-B_8i71mE.mjs → ManageIncome-CWr2Eij2.mjs} +32 -32
  41. package/dist/{ManageIncome-B_8i71mE.mjs.map → ManageIncome-CWr2Eij2.mjs.map} +1 -1
  42. package/dist/{MicroWidgetContainer-B2NnKBgW.mjs → MicroWidgetContainer-u1hE4nVI.mjs} +2 -2
  43. package/dist/{MicroWidgetContainer-B2NnKBgW.mjs.map → MicroWidgetContainer-u1hE4nVI.mjs.map} +1 -1
  44. package/dist/{MiniWidgetContainer-Bmv_WeUd.mjs → MiniWidgetContainer-DFUhI7Ok.mjs} +2 -2
  45. package/dist/{MiniWidgetContainer-Bmv_WeUd.mjs.map → MiniWidgetContainer-DFUhI7Ok.mjs.map} +1 -1
  46. package/dist/{NotificationSettings-CW7okUrk.mjs → NotificationSettings-1OxkZpn7.mjs} +33 -33
  47. package/dist/{NotificationSettings-CW7okUrk.mjs.map → NotificationSettings-1OxkZpn7.mjs.map} +1 -1
  48. package/dist/{OriginalBalanceAction-YrvxBYAl.mjs → OriginalBalanceAction-BmuKAlKl.mjs} +4 -4
  49. package/dist/{OriginalBalanceAction-YrvxBYAl.mjs.map → OriginalBalanceAction-BmuKAlKl.mjs.map} +1 -1
  50. package/dist/{RecurringSettings-hs0YUp83.mjs → RecurringSettings-CMspUOGC.mjs} +3 -3
  51. package/dist/{RecurringSettings-hs0YUp83.mjs.map → RecurringSettings-CMspUOGC.mjs.map} +1 -1
  52. package/dist/{SpendingLegend-CxvNOg3c.mjs → SpendingLegend-CqLSaAYE.mjs} +2 -2
  53. package/dist/{SpendingLegend-CxvNOg3c.mjs.map → SpendingLegend-CqLSaAYE.mjs.map} +1 -1
  54. package/dist/{TransactionDetails-DT-MQqOB.mjs → TransactionDetails-DsWYPMCj.mjs} +5 -5
  55. package/dist/{TransactionDetails-DT-MQqOB.mjs.map → TransactionDetails-DsWYPMCj.mjs.map} +1 -1
  56. package/dist/{UserStore-E5WvBXaY.mjs → UserStore-CL_kIDzt.mjs} +367 -317
  57. package/dist/UserStore-CL_kIDzt.mjs.map +1 -0
  58. package/dist/{ViewMoreMicroCard-fnwE0hqd.mjs → ViewMoreMicroCard-CJckyYda.mjs} +4 -4
  59. package/dist/{ViewMoreMicroCard-fnwE0hqd.mjs.map → ViewMoreMicroCard-CJckyYda.mjs.map} +1 -1
  60. package/dist/{WidgetContainer-CjdCY4sj.mjs → WidgetContainer-C4PFkL6g.mjs} +3 -3
  61. package/dist/{WidgetContainer-CjdCY4sj.mjs.map → WidgetContainer-C4PFkL6g.mjs.map} +1 -1
  62. package/dist/accounts/index.es.js +11 -11
  63. package/dist/analytics/index.es.js +2 -2
  64. package/dist/budgets/index.es.js +10 -10
  65. package/dist/cashflow/index.es.js +70 -70
  66. package/dist/categories/index.es.js +1 -1
  67. package/dist/common/components/ErrorBoundary.d.ts +2 -0
  68. package/dist/common/components/ErrorTestButtons.d.ts +3 -0
  69. package/dist/common/components/index.d.ts +1 -0
  70. package/dist/common/context/GlobalDataProvider.d.ts +2 -1
  71. package/dist/common/context/hooks.d.ts +3 -0
  72. package/dist/common/context/index.d.ts +1 -1
  73. package/dist/common/index.es.js +252 -224
  74. package/dist/common/index.es.js.map +1 -1
  75. package/dist/core/api/AccountApi.d.ts +2 -2
  76. package/dist/core/api/AnalyticsApi.d.ts +2 -2
  77. package/dist/core/api/AppDataApi.d.ts +2 -2
  78. package/dist/core/api/BeatApi.d.ts +2 -2
  79. package/dist/core/api/BudgetsApi.d.ts +2 -2
  80. package/dist/core/api/CategoryApi.d.ts +2 -2
  81. package/dist/core/api/FinstrongApi.d.ts +2 -2
  82. package/dist/core/api/GlobalCopyApi.d.ts +2 -2
  83. package/dist/core/api/GoalApi.d.ts +2 -2
  84. package/dist/core/api/HelpApi.d.ts +2 -2
  85. package/dist/core/api/HoldingApi.d.ts +2 -2
  86. package/dist/core/api/MerchantApi.d.ts +2 -2
  87. package/dist/core/api/NotificationApi.d.ts +2 -2
  88. package/dist/core/api/RepeatingTransactionsApi.d.ts +2 -2
  89. package/dist/core/api/ScheduledPaymentsApi.d.ts +2 -2
  90. package/dist/core/api/SettingsApi.d.ts +2 -2
  91. package/dist/core/api/TransactionApi.d.ts +2 -2
  92. package/dist/core/api/UserApi.d.ts +2 -2
  93. package/dist/core/index.es.js +95 -95
  94. package/dist/core/index.es.js.map +1 -1
  95. package/dist/core/stores/GlobalStore.d.ts +4 -2
  96. package/dist/core/types/Handlers.d.ts +1 -0
  97. package/dist/core/types/index.d.ts +1 -1
  98. package/dist/core/utils/Fetch.d.ts +3 -2
  99. package/dist/dashboard/index.es.js +4 -4
  100. package/dist/debts/index.es.js +8 -8
  101. package/dist/finstrong/index.es.js +12 -12
  102. package/dist/goals/index.es.js +9 -9
  103. package/dist/help/index.es.js +4 -4
  104. package/dist/hooks-Chcgk3F2.mjs +83 -0
  105. package/dist/hooks-Chcgk3F2.mjs.map +1 -0
  106. package/dist/insights/index.es.js +4 -4
  107. package/dist/investments/index.es.js +4 -4
  108. package/dist/merchants/index.es.js +1 -1
  109. package/dist/microinsights/index.es.js +1 -1
  110. package/dist/networth/index.es.js +6 -6
  111. package/dist/notifications/index.es.js +8 -8
  112. package/dist/recurringtransactions/index.es.js +38 -38
  113. package/dist/settings/index.es.js +27 -27
  114. package/dist/spending/index.es.js +7 -7
  115. package/dist/transactions/index.es.js +11 -11
  116. package/dist/trends/index.es.js +12 -12
  117. package/dist/{useAccountDisplayName-BsiXA0qf.mjs → useAccountDisplayName-BC5i7pMh.mjs} +2 -2
  118. package/dist/{useAccountDisplayName-BsiXA0qf.mjs.map → useAccountDisplayName-BC5i7pMh.mjs.map} +1 -1
  119. package/dist/{useInsightsEnabled-D5Sdm0TJ.mjs → useInsightsEnabled-BpBk6YYj.mjs} +2 -2
  120. package/dist/{useInsightsEnabled-D5Sdm0TJ.mjs.map → useInsightsEnabled-BpBk6YYj.mjs.map} +1 -1
  121. package/dist/{useWidgetLoadTimer-B0tB-yzL.mjs → useWidgetLoadTimer-D0bW29qj.mjs} +2 -2
  122. package/dist/{useWidgetLoadTimer-B0tB-yzL.mjs.map → useWidgetLoadTimer-D0bW29qj.mjs.map} +1 -1
  123. package/package.json +1 -1
  124. package/dist/ErrorBoundary-CsdOcnJ9.mjs +0 -24
  125. package/dist/ErrorBoundary-CsdOcnJ9.mjs.map +0 -1
  126. package/dist/GlobalCopyApi-wcnDUzMV.mjs +0 -129
  127. package/dist/GlobalCopyApi-wcnDUzMV.mjs.map +0 -1
  128. package/dist/Help-zVZdcmlk.mjs.map +0 -1
  129. package/dist/UserStore-E5WvBXaY.mjs.map +0 -1
  130. package/dist/hooks-97sNJ_lf.mjs +0 -78
  131. package/dist/hooks-97sNJ_lf.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserStore-CL_kIDzt.mjs","sources":["../src/core/api/AccountApi.ts","../src/core/api/AppDataApi.ts","../src/core/api/BannerApi.ts","../src/core/api/BudgetsApi.ts","../src/core/api/CategoryApi.ts","../src/core/api/FinstrongApi.ts","../src/core/api/GoalApi.ts","../src/core/api/HelpApi.ts","../src/core/api/HoldingApi.ts","../src/core/api/MerchantApi.ts","../src/core/api/NotificationApi.ts","../src/core/api/RepeatingTransactionsApi.ts","../src/core/api/SettingsApi.ts","../src/core/api/TransactionApi.ts","../src/core/api/UserApi.ts","../src/core/api/WidgetApi.ts","../src/core/stores/AccountStore.ts","../src/core/stores/AppDataStore.ts","../src/core/stores/AnalyticsStore.ts","../src/core/utils/BeatUtils.ts","../src/core/stores/BeatStore.ts","../src/core/stores/BudgetsStore.ts","../src/core/stores/CashflowStore.ts","../src/core/stores/CategoryStore.ts","../src/core/stores/ConnectStore.ts","../src/core/stores/DebtsStore.ts","../src/core/utils/FinstrongUtils.ts","../src/core/stores/FinstrongStore.ts","../src/core/constants/DefaultConfig.ts","../src/core/stores/GlobalStore.ts","../src/core/stores/GlobalUiStore.ts","../src/core/stores/GlobalCopyStore.ts","../src/core/stores/GoalStore.ts","../src/core/utils/HelpUtil.ts","../src/core/stores/HelpStore.ts","../src/core/stores/HoldingStore.ts","../src/core/stores/MerchantStore.ts","../src/core/stores/NetWorthStore.ts","../src/core/stores/NotificationStore.ts","../src/core/stores/RecurringTransactionsStore.ts","../src/core/utils/SettingsUtil.ts","../src/core/stores/SettingsStore.ts","../src/core/stores/TransactionStore.ts","../src/core/stores/TrendsStore.ts","../src/core/stores/UserStore.ts"],"sourcesContent":["import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport type { Account, GlobalCaptureException, GlobalErrorHandler } from '..'\n\nexport class AccountApi {\n fetchInstance: Fetch\n\n constructor(\n endpoint: string,\n token: string,\n onError?: GlobalErrorHandler,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.fetchInstance = new Fetch(endpoint, token, undefined, onError, onCaptureException)\n }\n\n createAccount = async (account: Account) => {\n return this.fetchInstance\n .post(ApiEndpoints.ACCOUNTS, account)\n .then((data) => data.account)\n .catch((error) => error)\n }\n\n deleteAccount = async (accountGuid: string) => {\n return this.fetchInstance\n .delete(`${ApiEndpoints.ACCOUNTS}/${accountGuid}`)\n .catch((error) => error)\n }\n\n getAccounts = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.ACCOUNTS)\n .then((data) => data.accounts)\n .catch((error) => error)\n }\n\n getInstitutions = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.INSTITUTIONS)\n .then((data) => data)\n .catch((error) => error)\n }\n\n getMembers = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.MEMBERS)\n .then((data) => data.members)\n .catch((error) => error)\n }\n\n getMonthlyAccountBalances = async (guid: string) => {\n return this.fetchInstance\n .get(`${ApiEndpoints.ACCOUNTS}/${guid}/monthly_account_balances`)\n .then((data) => data.monthly_account_balances)\n .catch((error) => error)\n }\n\n mergeAccounts = async (accountGuids: string[]) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.ACCOUNTS}/merge`, { accounts: accountGuids })\n .then((data) => data)\n .catch((error) => error)\n }\n\n refreshAllMembers = async () => {\n return this.fetchInstance\n .get(`${ApiEndpoints.MEMBERS}/refresh_all`)\n .then((data) => data)\n .catch((error) => error)\n }\n\n updateAccount = async (account: Account) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.ACCOUNTS}/${account.guid}`, account)\n .then((data) => data.account)\n .catch((error) => error)\n }\n}\n","import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport type { AppData, GlobalCaptureException, GlobalErrorHandler } from '..'\n\nexport class AppDataApi {\n fetchInstance: Fetch\n\n constructor(\n endpoint: string,\n token: string,\n onError?: GlobalErrorHandler,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.fetchInstance = new Fetch(endpoint, token, undefined, onError, onCaptureException)\n }\n\n getAppData = async () => {\n return this.fetchInstance.get(ApiEndpoints.APP_DATA).then((data): AppData => data)\n }\n}\n","import { Fetch } from '../utils'\n\nexport class BannerApi {\n fetchInstance: Fetch | null\n\n constructor(bullseyeEndpoint: string) {\n // Override headers without MD-Session-Token to avoid CORS error in bullseye\n this.fetchInstance = new Fetch(bullseyeEndpoint, '', {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n })\n }\n\n getBanner = async (userGuid: string) => {\n try {\n const path = `/banner/${userGuid}/account_widget_banner`\n return this.fetchInstance?.get(path).then((data) => data.banner) ?? {}\n } catch (error) {\n console.error('Error fetching banner:', error)\n return null\n }\n }\n}\n","import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport type { GlobalCaptureException, GlobalErrorHandler, Budget, Category } from '..'\n\nexport class BudgetsApi {\n fetchInstance: Fetch\n\n constructor(\n endpoint: string,\n token: string,\n onError?: GlobalErrorHandler,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.fetchInstance = new Fetch(endpoint, token, undefined, onError, onCaptureException)\n }\n\n addBudget = async (category: Category, amount: number, parentGuid: string | null = null) => {\n return this.fetchInstance\n .post(ApiEndpoints.BUDGETS, {\n amount,\n category_guid: category.guid,\n category_name: category.name,\n parent_guid: parentGuid,\n })\n .then((data) => data.budget)\n .catch((error) => {\n throw error\n })\n }\n\n deleteBudget = async (guid: string) => {\n return this.fetchInstance\n .delete(`${ApiEndpoints.BUDGETS}/${guid}`)\n .then((data) => data)\n .catch((error) => {\n throw error\n })\n }\n\n getBudgets = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.BUDGETS)\n .then((data) => data.budgets)\n .catch((error) => error)\n }\n\n updateBudget = async (budget: Budget) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.BUDGETS}/${budget.guid}`, budget)\n .then((data) => data.budget)\n .catch((error) => {\n throw error\n })\n }\n\n addMerchantBudget = async (merchantGuid: string, amount: number) => {\n return this.fetchInstance\n .post(ApiEndpoints.MERCHANT_BUDGETS, {\n amount,\n merchant_guid: merchantGuid,\n })\n .then((data) => data.merchant_budget)\n .catch((error) => {\n throw error\n })\n }\n\n updateMerchantBudget = async (merchantBudgetGuid: string, amount: number) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.MERCHANT_BUDGETS}/${merchantBudgetGuid}`, {\n amount,\n })\n .then((data) => data.merchant_budget)\n .catch((error) => {\n throw error\n })\n }\n\n deleteMerchantBudget = async (merchantBudgetGuid: string) => {\n return this.fetchInstance\n .delete(`${ApiEndpoints.MERCHANT_BUDGETS}/${merchantBudgetGuid}`)\n .then((data) => data)\n .catch((error) => {\n throw error\n })\n }\n}\n","import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport type { Account, Category, GlobalCaptureException, GlobalErrorHandler } from '..'\n\nexport class CategoryApi {\n fetchInstance: Fetch\n\n constructor(\n endpoint: string,\n token: string,\n onError?: GlobalErrorHandler,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.fetchInstance = new Fetch(endpoint, token, undefined, onError, onCaptureException)\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 // If no accounts are selected, return an empty array\n if (accounts.length === 0) return []\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 try {\n const url = `${ApiEndpoints.MONTHLY_CATEGORY_TOTALS}/from/${startDate}/to/${endDate}`\n if (accounts) {\n const accountGuids = accounts.length === 0 ? [''] : accounts.map((account) => account.guid)\n const response = await this.fetchInstance.post(url, { account_guid: accountGuids })\n return response.monthly_category_totals\n } else {\n const response = await this.fetchInstance.get(url)\n return response.monthly_category_totals\n }\n } catch (error) {\n console.error('Error fetching monthly category totals:', error)\n throw error // Re-throw the error for the caller to handle\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 { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport type { GlobalCaptureException, GlobalErrorHandler } from '..'\n\nexport class FinstrongApi {\n fetchInstance: Fetch\n\n constructor(\n endpoint: string,\n token: string,\n onError?: GlobalErrorHandler,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.fetchInstance = new Fetch(endpoint, token, undefined, onError, onCaptureException)\n }\n\n calculateHealthScore = async () => {\n return this.fetchInstance\n .post(`${ApiEndpoints.HEALTH_SCORES}/calculate`)\n .then((data) => data.health_score)\n }\n\n getAverageHealthScores = async () => {\n return this.fetchInstance\n .get(`${ApiEndpoints.HEALTH_SCORES}/monthly_averages`)\n .then((data) => data)\n }\n\n getDebtSpend = async () => {\n return this.fetchInstance\n .get(`${ApiEndpoints.HEALTH_SCORES}/transactions/debt_spend`)\n .then((data) => data)\n }\n\n getIncome = async () => {\n return this.fetchInstance\n .get(`${ApiEndpoints.HEALTH_SCORES}/transactions/income`)\n .then((data) => data)\n }\n\n getMonthlySummaries = async () => {\n return this.fetchInstance\n .get(`${ApiEndpoints.HEALTH_SCORES}/monthly_summaries`)\n .then((data) => data)\n }\n\n getHealthScoreChangeReports = async (startDate: number, endDate: number) => {\n return this.fetchInstance\n .get(`${ApiEndpoints.HEALTH_SCORES}/change_report/from/${startDate}/to/${endDate}`)\n .then((data) => data)\n }\n\n getPeerScore = async (birthYear: string) => {\n return this.fetchInstance\n .get(`${ApiEndpoints.HEALTH_SCORES}/average/${birthYear}`)\n .then((data) => data)\n }\n\n getSpendingFeeTransactions = async () => {\n return this.fetchInstance\n .get(`${ApiEndpoints.HEALTH_SCORES}/transactions/spending_fee`)\n .then((data) => data)\n }\n\n getStandardSpend = async () => {\n return this.fetchInstance\n .get(`${ApiEndpoints.HEALTH_SCORES}/transactions/standard_spend`)\n .then((data) => data)\n }\n}\n","import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport { MonthlyCashFlowProfile, RetirementGoalAccount } from '..'\nimport type { GlobalCaptureException, GlobalErrorHandler, Goal } from '..'\n\nexport class GoalApi {\n fetchInstance: Fetch\n\n constructor(\n endpoint: string,\n token: string,\n onError?: GlobalErrorHandler,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.fetchInstance = new Fetch(endpoint, token, undefined, onError, onCaptureException)\n }\n\n addGoal = async (goal: Goal) => {\n return this.fetchInstance.post(ApiEndpoints.GOALS, goal).then((data) => data.goal)\n }\n\n addRetirementGoal = async (goal: Goal) => {\n return this.fetchInstance\n .post(ApiEndpoints.RETIREMENT_GOALS, goal)\n .then((data) => data.retirement_goal)\n }\n\n addRetirementGoalAccount = async (retirementAccount: RetirementGoalAccount) => {\n return this.fetchInstance\n .post(ApiEndpoints.RETIREMENT_GOAL_ACCOUNTS, retirementAccount)\n .then((data) => data.retirement_goal_account)\n }\n\n getGoalByGuid = async (guid: string) => {\n return this.fetchInstance.get(`${ApiEndpoints.GOALS}/${guid}`).then((data) => data.goal)\n }\n\n getGoals = async () => {\n return this.fetchInstance.get(ApiEndpoints.GOALS).then((data) => data.goals)\n }\n\n getMonthlyCashFlowProfile = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.MONTHLY_CASH_FLOW_PROFILE)\n .then((data) => data.monthly_cash_flow_profile)\n }\n\n getRetirementGoals = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.RETIREMENT_GOALS)\n .then((data) => data.retirement_goals)\n }\n\n getRetirementGoalAccounts = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.RETIREMENT_GOAL_ACCOUNTS)\n .then((data) => data.retirement_goal_accounts)\n }\n\n removeGoal = async (guid: string) => {\n return this.fetchInstance.delete(`${ApiEndpoints.GOALS}/${guid}`).then((data) => data)\n }\n\n removeRetirementGoal = async (guid: string) => {\n return this.fetchInstance\n .delete(`${ApiEndpoints.RETIREMENT_GOALS}/${guid}`)\n .then((data) => data)\n }\n\n removeRetirementGoalAccount = async (guid: string) => {\n return this.fetchInstance\n .delete(`${ApiEndpoints.RETIREMENT_GOAL_ACCOUNTS}/${guid}`)\n .then((data) => data)\n }\n\n reorderGoals = async (goals: Goal[]) => {\n return this.fetchInstance\n .post(`${ApiEndpoints.GOALS}/reposition`, { goals: goals })\n .then((data) => data.goals)\n }\n\n updateGoal = async (goal: Goal) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.GOALS}/${goal.guid}`, goal)\n .then((data) => data.goal)\n }\n\n updateMonthlyCashFlowProfile = async (profile: MonthlyCashFlowProfile) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.MONTHLY_CASH_FLOW_PROFILE}`, profile)\n .then((data) => data.monthly_cash_flow_profile)\n }\n\n updateRetirementGoal = async (goal: Goal) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.RETIREMENT_GOALS}/${goal.guid}`, goal)\n .then((data) => data.retirement_goal)\n }\n}\n","import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport type { GlobalCaptureException, GlobalErrorHandler, Ticket } from '..'\n\nexport class HelpApi {\n fetchInstance: Fetch\n\n constructor(\n endpoint: string,\n token: string,\n onError?: GlobalErrorHandler,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.fetchInstance = new Fetch(endpoint, token, undefined, onError, onCaptureException)\n }\n\n createSupportTicket = async (ticket: Ticket) => {\n return this.fetchInstance.post(ApiEndpoints.SUPPORT_TICKETS, ticket).then((data) => data)\n }\n}\n","import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport type { GlobalCaptureException, GlobalErrorHandler, Holding } from '..'\n\nexport class HoldingApi {\n fetchInstance: Fetch\n\n constructor(\n endpoint: string,\n token: string,\n onError?: GlobalErrorHandler,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.fetchInstance = new Fetch(endpoint, token, undefined, onError, onCaptureException)\n }\n\n getHoldings = async () => {\n return this.fetchInstance.get(ApiEndpoints.HOLDINGS).then((data) => data.holdings)\n }\n\n updateHoldings = async (holding: Holding) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.HOLDINGS}/${holding.guid}`, holding)\n .then((data) => data.holding)\n }\n}\n","import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport type { GlobalCaptureException, GlobalErrorHandler } from '..'\n\nexport class MerchantApi {\n fetchInstance: Fetch\n\n constructor(\n endpoint: string,\n token: string,\n onError?: GlobalErrorHandler,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.fetchInstance = new Fetch(endpoint, token, undefined, onError, onCaptureException)\n }\n\n getMerchants = async (\n searchValues = [] as string[],\n guids = [] as string[],\n page = 1,\n perPage = 25,\n ) => {\n let url = ApiEndpoints.MERCHANTS\n url += `?page=${page}&per_page=${perPage}`\n\n if (searchValues.length) {\n searchValues.forEach((value) => (url += `&fuzzy_name[]=${value}`))\n }\n\n if (guids.length) {\n guids.forEach((guid) => (url += `&guid[]=${guid}`))\n }\n\n return this.fetchInstance.get(url).then((data) => data.merchants)\n }\n\n getMerchantByGuid = async (guid: string) => {\n return this.fetchInstance.get(`${ApiEndpoints.MERCHANTS}/${guid}`).then((data) => data.merchant)\n }\n}\n","import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport type { Notification, GlobalCaptureException, GlobalErrorHandler } from '..'\n\nexport class NotificationApi {\n fetchInstance: Fetch\n\n constructor(\n endpoint: string,\n token: string,\n onError?: GlobalErrorHandler,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.fetchInstance = new Fetch(endpoint, token, undefined, onError, onCaptureException)\n }\n\n getNotifications = () => {\n return this.fetchInstance\n .get(ApiEndpoints.NOTIFICATIONS)\n .then((data) =>\n data.notifications.map((obj: { notification: Notification }) => obj.notification),\n )\n .finally()\n }\n\n updateNotification = (notification: Notification) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.NOTIFICATIONS}/${notification.guid}`, {\n guid: notification.guid,\n has_been_viewed: notification.has_been_viewed,\n })\n .then((data) => data.notification)\n .finally()\n }\n\n // Note: The notifications/mark_all_as_viewed endpoint is broken, but still returns 202.\n // A bug ticket has been filed to fix it, but should not require any changes here.\n markAllAsViewed = (channel?: number) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.NOTIFICATIONS}/mark_all_as_viewed`, { channel })\n .finally()\n }\n}\n","import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport type { GlobalCaptureException, GlobalErrorHandler, RepeatingTransaction } from '..'\n\nexport class RepeatingTransactionsApi {\n fetchInstance: Fetch\n\n constructor(\n endpoint: string,\n token: string,\n onError?: GlobalErrorHandler,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.fetchInstance = new Fetch(endpoint, token, undefined, onError, onCaptureException)\n }\n\n addRepeatingTransaction = async (repeatingTransaction: RepeatingTransaction) => {\n return this.fetchInstance\n .post(ApiEndpoints.REPEATING_TRANSACTIONS, repeatingTransaction)\n .then((data) => data.repeating_transaction)\n }\n\n getRepeatingTransactions = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.REPEATING_TRANSACTIONS)\n .then((data) => data.repeating_transactions)\n }\n\n updateRepeatingTransaction = async (repeatingTransaction: RepeatingTransaction) => {\n return this.fetchInstance\n .put(\n `${ApiEndpoints.REPEATING_TRANSACTIONS}/${repeatingTransaction.guid}`,\n repeatingTransaction,\n )\n .then((data) => data.repeating_transaction)\n }\n\n deleteRepeatingTransaction = async (guid: string) => {\n return this.fetchInstance\n .delete(`${ApiEndpoints.REPEATING_TRANSACTIONS}/${guid}`)\n .then((data) => data)\n }\n}\n","import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport { UserCommunicationProfile } from '..'\nimport type { Device, GlobalCaptureException, GlobalErrorHandler, NotificationProfile } from '..'\n\nexport class SettingsApi {\n fetchInstance: Fetch\n\n constructor(\n endpoint: string,\n token: string,\n onError?: GlobalErrorHandler,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.fetchInstance = new Fetch(endpoint, token, undefined, onError, onCaptureException)\n }\n\n deleteDevice = async (guid: string) => {\n return this.fetchInstance.delete(`${ApiEndpoints.DEVICES}/${guid}`).then((data) => data)\n }\n\n generateDeviceToken = async () => {\n return this.fetchInstance\n .get(`${ApiEndpoints.USER}/mobile_token`)\n .then((data) => data.mobile_token)\n }\n\n getDevices = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.DEVICES)\n .then((data) => data.map((item: { device: Device }) => item.device))\n }\n\n getNotificationProfiles = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.NOTIFICATION_PROFILES)\n .then((data) => data.notification_profiles)\n }\n\n // verifications endpoints respond with HTTP status codes; they error otherwise\n sendEmailVerification = async () => {\n return this.fetchInstance.post(ApiEndpoints.EMAIL_VERIFICATIONS)\n }\n\n sendPhoneVerification = async () => {\n return this.fetchInstance.post(ApiEndpoints.PHONE_VERIFICATIONS + '/deliver')\n }\n\n verifyPhoneToken = async (sms_verification_token: string) => {\n return this.fetchInstance\n .post(ApiEndpoints.PHONE_VERIFICATIONS + '/verify', { sms_verification_token })\n .then((res) => ({ verified: res.verified }))\n }\n\n updateDevice = async (device: Device) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.DEVICES}/${device.guid}`, device)\n .then((data) => data.device)\n }\n\n updateNotificationProfile = async (notificationProfile: NotificationProfile) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.NOTIFICATION_PROFILES}/${notificationProfile.guid}`, notificationProfile)\n .then((data) => data.notification_profile)\n }\n\n updateUserCommunicationProfile = async (userCommunicationProfile: UserCommunicationProfile) => {\n return this.fetchInstance\n .put(ApiEndpoints.USER_COMMUNICATION_PROFILE, userCommunicationProfile)\n .then((data) => data.user_communication_profile)\n }\n\n getInsightsNotificationProfiles = async () => {\n return this.fetchInstance\n .get(`${ApiEndpoints.NOTIFICATION_PROFILES}/${ApiEndpoints.INSIGHTS_NOTIFICATION_PROFILES}`)\n .then((data) => data)\n }\n}\n","import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport type {\n GlobalCaptureException,\n GlobalErrorHandler,\n Tag,\n Tagging,\n Transaction,\n TransactionRule,\n} from '..'\n\nexport class TransactionApi {\n fetchInstance: Fetch\n\n constructor(\n endpoint: string,\n token: string,\n onError?: GlobalErrorHandler,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.fetchInstance = new Fetch(endpoint, token, undefined, onError, onCaptureException)\n }\n\n addTag = async (tag: Tag) => {\n return this.fetchInstance\n .post(ApiEndpoints.TAGS, tag)\n .then((data) => data.tag)\n .catch((error) => error)\n }\n\n addTagging = async (tagging: Tagging) => {\n return this.fetchInstance\n .post(ApiEndpoints.TAGGINGS, tagging)\n .then((data) => data.tagging)\n .catch((error) => error)\n }\n\n addTransaction = async (transaction: Transaction) => {\n return this.fetchInstance\n .post(ApiEndpoints.TRANSACTIONS, transaction)\n .then((data) => data.transaction)\n .catch((error) => error)\n }\n\n addTransactionRule = async (rule: TransactionRule) => {\n return this.fetchInstance\n .post(ApiEndpoints.TRANSACTION_RULES, rule)\n .then((data) => data)\n .catch((error) => error)\n }\n\n getTaggings = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.TAGGINGS)\n .then((data) => data.map((item: { tagging: Tagging }) => item.tagging))\n }\n\n getTags = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.TAGS)\n .then((data) => data.map((item: { tag: Tag }) => item.tag))\n }\n\n getTransactionRules = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.TRANSACTION_RULES)\n .then((data) => data.transaction_rules)\n }\n\n getTransactionsByDateRange = async (startDate: number, endDate: number) => {\n return this.fetchInstance\n .get(`${ApiEndpoints.TRANSACTIONS}/by_date/${startDate}/${endDate}`)\n .then((data) => data.map((item: { transaction: Transaction }) => item.transaction))\n }\n\n // DEPRECATED\n getTransactionsByAccountsAndDateRange = async (\n accountGuids: string[],\n beginDate: number,\n endDate: number,\n ) => {\n console.warn('DEPRECATED: getTransactionsByAccountsAndDateRange will be removed')\n const accountsList = accountGuids.reduce(\n (acc: string, guid: string, i: number) =>\n `${acc}account_guids[]=${guid}${i !== accountGuids.length - 1 ? '&' : ''}`,\n '',\n )\n\n return this.fetchInstance\n .get(`${ApiEndpoints.TRANSACTIONS}/by_date/${beginDate}/${endDate}?${accountsList}`)\n .then((data) => data.map((item: { transaction: Transaction }) => item.transaction))\n }\n\n // DEPRECATED\n getTransactionsByGuids = async (guids: string[]) => {\n console.warn('DEPRECATED: getTransactionsByGuids will be removed')\n return this.fetchInstance\n .post(`${ApiEndpoints.TRANSACTIONS}/by_guids`, { guids: guids.join('+') })\n .then((data) => data.map((item: { transaction: Transaction }) => item.transaction))\n }\n\n // DEPRECATED\n getTransactionsByCategoryAndDate = async (\n categoryGuid: string,\n beginDate: number,\n endDate: number,\n ) => {\n console.warn('DEPRECATED: getTransactionsByCategoryAndDate will be removed')\n return this.fetchInstance\n .get(\n `${ApiEndpoints.TRANSACTIONS}/by_category_guid/${categoryGuid}/by_date/${beginDate}/${endDate}`,\n )\n .then((data) => data.map((item: { transaction: Transaction }) => item.transaction))\n }\n\n // DEPRECATED\n getTransactionsByCategoryDateAndAccounts = async (\n categoryGuid: string,\n beginDate: number,\n endDate: number,\n accountGuids: string[],\n ) => {\n console.warn('DEPRECATED: getTransactionsByCategoryDateAndAccounts will be removed')\n const accountsList = accountGuids.reduce(\n (acc: string, guid: string, i: number) =>\n `${acc}account_guids[]=${guid}${i !== accountGuids.length - 1 ? '&' : ''}`,\n '',\n )\n\n return this.fetchInstance\n .get(\n `${ApiEndpoints.TRANSACTIONS}/by_category_guid/${categoryGuid}/by_date/${beginDate}/${endDate}?${accountsList}`,\n )\n .then((data) => data.map((item: { transaction: Transaction }) => item.transaction))\n }\n\n // DEPRECATED\n getTransactionsByCategoriesDateAndAccounts = async (\n categoryGuids: string[],\n beginDate: number,\n endDate: number,\n accountGuids: string[],\n ) => {\n console.warn('DEPRECATED: getTransactionsByCategoriesDateAndAccounts will be removed')\n const accountsList = accountGuids.reduce(\n (acc: string, guid: string, i: number) =>\n `${acc}account_guids[]=${guid}${i !== accountGuids.length - 1 ? '&' : ''}`,\n '',\n )\n\n return this.fetchInstance\n .get(\n `${ApiEndpoints.TRANSACTIONS}/by_category_guids/${categoryGuids.join(\n '+',\n )}/by_date/${beginDate}/${endDate}?${accountsList}`,\n )\n .then((data) => data.map((item: { transaction: Transaction }) => item.transaction))\n }\n\n /**\n * DEPRECATED\n * Get all transactions by the top level category, between begin date and end date, and optionally\n * filtered by accounts\n * @param categoryGuid The top level category guid\n * @param beginDate the start date\n * @param endDate the end date\n * @param accountGuids an optional list of account guids\n */\n getTransactionsByTopLevelCategoryAndDate = async (\n categoryGuid: string,\n beginDate: number,\n endDate: number,\n accountGuids: string[] = [],\n ) => {\n console.warn('DEPRECATED: getTransactionsByTopLevelCategoryAndDate will be removed')\n let url = `${ApiEndpoints.TRANSACTIONS}/by_top_level_category_guid/${categoryGuid}/by_date/${beginDate}/${endDate}`\n\n if (accountGuids.length > 0) {\n const accountsList = accountGuids.reduce(\n (acc: string, guid: string, i: number) =>\n `${acc}account_guids[]=${guid}${i !== accountGuids.length - 1 ? '&' : ''}`,\n '',\n )\n url += `?${accountsList}`\n }\n\n return this.fetchInstance\n .get(url)\n .then((data) => data.map((item: { transaction: Transaction }) => item.transaction))\n }\n\n removeTag = async (guid: string) => {\n return this.fetchInstance\n .delete(`${ApiEndpoints.TAGS}/${guid}`)\n .then((data) => data)\n .catch((error) => error)\n }\n\n removeTagging = async (guid: string) => {\n return this.fetchInstance\n .delete(`${ApiEndpoints.TAGGINGS}/${guid}`)\n .then((data) => data)\n .catch((error) => error)\n }\n\n removeTransaction = async (guid: string) => {\n return this.fetchInstance.delete(`${ApiEndpoints.TRANSACTIONS}/${guid}`).then((data) => data)\n }\n\n removeTransactionRule = async (guid: string) => {\n return this.fetchInstance\n .delete(`${ApiEndpoints.TRANSACTION_RULES}/${guid}`)\n .catch((error) => error)\n }\n\n removeTransactionSplit = async (guid: string) => {\n return this.fetchInstance\n .delete(`${ApiEndpoints.TRANSACTIONS}/${guid}/unsplit`)\n .then((data) => data)\n .catch((error) => error)\n }\n\n updateTransactionRule = async (rule: TransactionRule) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.TRANSACTION_RULES}/${rule.guid}`, rule)\n .then((data) => data)\n .catch((error) => error)\n }\n\n updateTag = async (tag: Tag) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.TAGS}/${tag.guid}`, tag)\n .then((data) => data.tag)\n .catch((error) => error)\n }\n\n updateTransaction = async (transaction: Transaction) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.TRANSACTIONS}/${transaction.guid}`, transaction)\n .then((data) => data.transaction)\n .catch((error) => error)\n }\n}\n","import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport type { GlobalCaptureException, GlobalErrorHandler, User, UserProfile } from '..'\n\nexport class UserApi {\n fetchInstance: Fetch\n\n constructor(\n endpoint: string,\n token: string,\n onError?: GlobalErrorHandler,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.fetchInstance = new Fetch(endpoint, token, undefined, onError, onCaptureException)\n }\n\n getUserFeatures = async () => {\n return this.fetchInstance\n .get(ApiEndpoints.USER_FEATURES)\n .then((data) => data.user_features)\n .catch((e) => e)\n }\n\n updateUser = async (user: User) => {\n return this.fetchInstance.put(ApiEndpoints.USER, user).then((data) => data.user)\n }\n\n updateUserProfile = async (userProfile: UserProfile) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.USER_PROFILES}/${userProfile.guid}`, userProfile)\n .then((data) => data.user_profile)\n }\n}\n","import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\n\nexport class WidgetApi {\n fetchInstance: Fetch\n\n constructor(endpoint: string, token: string) {\n this.fetchInstance = new Fetch(endpoint, token)\n }\n\n requestWidgetUrl = async (req: any) => {\n return this.fetchInstance.post(ApiEndpoints.WIDGET_URLS, req).then((data) => data.widget_url)\n }\n}\n","import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { AccountApi } from '../api'\nimport {\n type Account,\n type DetailedAccount,\n type Institution,\n type Member,\n AccountType,\n AccountSubType,\n} from '../types'\nimport { augmentAccounts } from '../utils/AccountUtils'\nimport { isFeatureEnabled } from '../utils/UserUtils'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class AccountStore {\n globalStore: GlobalStore\n api: AccountApi = new AccountApi('/', '')\n\n accounts: Account[] = []\n accountsLoaded: boolean = false\n accountsLoading: boolean = false\n institutions: Institution[] = []\n institutionsLoaded: boolean = false\n institutionsLoading: boolean = false\n members: Member[] = []\n membersLoaded: boolean = false\n membersLoading: boolean = false\n uiStore: UiStore\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.uiStore = new UiStore()\n this.api = new AccountApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n globalStore.onCaptureException,\n )\n\n makeAutoObservable(this)\n }\n\n loadAccountData = async () => {\n await Promise.all([this.loadAccounts(), this.loadMembers(), this.loadInstitutions()])\n }\n\n get isAccountDataLoaded(): boolean {\n return this.accountsLoaded && this.membersLoaded && this.institutionsLoaded\n }\n\n get detailedAccounts(): DetailedAccount[] {\n const userFeatures = this.globalStore.userStore.userFeatures\n const excludeExternal = isFeatureEnabled(userFeatures, 'MD_EXCLUDE_EXTERNAL_ACCOUNTS')\n\n // Hide held account when this flag is toggled and this is the individual accounts widget\n const excludeHeld =\n this.globalStore.appConfig.config.display_only_external_accounts_in_accounts &&\n this.globalStore.appConfig.options.subtype === 'accounts' // Indicates this is an individual widget\n\n return augmentAccounts(\n this.accounts,\n this.institutions,\n this.members,\n excludeExternal,\n excludeHeld,\n )\n }\n\n get accountsByTypeMap(): Map<AccountType, DetailedAccount[]> {\n return this.detailedAccounts.reduce((typeMap: Map<AccountType, DetailedAccount[]>, account) => {\n const accountType = account.account_type\n\n let accounts = typeMap.get(accountType)\n if (!accounts) {\n accounts = []\n }\n accounts.push(account)\n typeMap.set(accountType, accounts)\n\n return typeMap\n }, new Map<AccountType, DetailedAccount[]>())\n }\n\n get cashAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter(\n (account: Account) =>\n account.account_type === AccountType.CASH ||\n account.account_type === AccountType.CHECKING ||\n account.account_type === AccountType.PREPAID ||\n account.account_type === AccountType.SAVINGS ||\n account.account_type === AccountType.CHECKING_LINE_OF_CREDIT,\n )\n }\n\n get cashBalance(): number {\n return this.cashAccounts.reduce((total, account) => total + (account?.balance || 0), 0)\n }\n\n get checkingAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter((a: Account) => a.account_type === AccountType.CHECKING)\n }\n\n get debtAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter(\n (account: Account) =>\n account.account_type === AccountType.CREDIT_CARD ||\n account.account_type === AccountType.LOAN ||\n account.account_type === AccountType.MORTGAGE ||\n account.account_type === AccountType.LINE_OF_CREDIT ||\n account.account_type === AccountType.CHECKING_LINE_OF_CREDIT,\n )\n }\n\n get finstrongAccounts(): DetailedAccount[] {\n const eligibleTypes = new Set([\n AccountType.CHECKING,\n AccountType.SAVINGS,\n AccountType.CREDIT_CARD,\n AccountType.INVESTMENT,\n ])\n\n return this.detailedAccounts.filter((account) => eligibleTypes.has(account.account_type))\n }\n\n get investmentAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter(\n (account: Account) => account.account_type === AccountType.INVESTMENT,\n )\n }\n\n get manualAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter((account) => account.is_manual)\n }\n\n get savingsAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter((a: Account) => a.account_type === AccountType.SAVINGS)\n }\n\n get retirementAccounts(): Account[] {\n return this.detailedAccounts.filter(\n (account: Account) =>\n account.account_type === AccountType.INVESTMENT ||\n account.account_type === AccountType.SAVINGS ||\n account.account_type === AccountType.CHECKING ||\n account.account_type === AccountType.CASH ||\n account.account_type === AccountType.PROPERTY ||\n (account.account_type === AccountType.INSURANCE &&\n (account.account_subtype === AccountSubType.WHOLE_LIFE ||\n account.account_subtype === AccountSubType.UNIVERSAL_LIFE ||\n account.account_subtype === AccountSubType.VARIABLE_UNIVERSAL_LIFE)),\n )\n }\n\n get visibleAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter((a: Account) => !a.is_hidden && !a.is_closed)\n }\n\n get visibleCashAccounts(): DetailedAccount[] {\n return this.cashAccounts.filter((account: Account) => !account.is_hidden)\n }\n\n get visibleCashBalance(): number {\n return this.visibleCashAccounts.reduce((total, account) => total + (account?.balance || 0), 0)\n }\n\n get visibleCheckingAccounts(): DetailedAccount[] {\n return this.checkingAccounts.filter((account: Account) => !account.is_hidden)\n }\n\n get visibleDebtAccounts(): DetailedAccount[] {\n return this.debtAccounts.filter((account: Account) => !account.is_hidden)\n }\n\n get visibleFinstrongAccounts(): DetailedAccount[] {\n return this.finstrongAccounts.filter(\n (account: Account) => !(account.is_closed || account.is_deleted || account.is_hidden),\n )\n }\n\n get visibleRetirementAccounts(): Account[] {\n return this.retirementAccounts.filter((account: Account) => !account.is_hidden)\n }\n\n get visibleInvestmentAccounts(): DetailedAccount[] {\n return this.investmentAccounts.filter((account: Account) => !account.is_hidden)\n }\n\n get visibleSavingsAccounts(): DetailedAccount[] {\n return this.savingsAccounts.filter((account: Account) => !account.is_hidden)\n }\n\n get savingsAndCheckingAccountsBalance(): number {\n const savingsAndCheckingAccountsList = this.savingsAndCheckingAccounts\n\n return savingsAndCheckingAccountsList.reduce(\n (total, account) => total + (account?.balance || 0),\n 0,\n )\n }\n\n get savingsAndCheckingAccounts(): Account[] {\n const savingsAndCheckingAccounts = this.accounts.filter(\n (account: Account) =>\n account.account_type === AccountType.SAVINGS ||\n account.account_type === AccountType.CHECKING,\n )\n\n return savingsAndCheckingAccounts\n }\n\n setAccounts = (accounts: Account[]) => {\n this.accounts = accounts\n this.accountsLoading = false\n this.accountsLoaded = true\n }\n\n setMembers = (members: Member[]) => {\n this.members = members\n this.membersLoading = false\n this.membersLoaded = true\n }\n\n setInstitutions = (institutions: Institution[]) => {\n this.institutions = institutions\n this.institutionsLoading = false\n this.institutionsLoaded = true\n }\n\n addAccount = async (account: Account) => {\n try {\n const newAccount = await this.api.createAccount(account)\n\n runInAction(() => {\n this.accounts = [...this.accounts, newAccount]\n })\n } catch (error) {\n console.error(`Error occurred while adding an account: ${error}`)\n this.globalStore.captureException(error, { store: 'AccountStore' })\n }\n }\n\n loadAccounts = async () => {\n if (this.accountsLoading) return\n\n this.accountsLoading = true\n try {\n const accounts = await this.api.getAccounts()\n this.setAccounts(accounts)\n } catch (error) {\n console.error(`Error occurred while loading accounts: ${error}`)\n this.globalStore.captureException(error, { store: 'AccountStore' })\n }\n }\n\n loadInstitutions = async () => {\n if (this.institutionsLoading) return\n\n this.institutionsLoading = true\n try {\n const institutions = await this.api.getInstitutions()\n this.setInstitutions(institutions)\n } catch (error) {\n console.error(`Error occurred while loading institutions: ${error}`)\n this.globalStore.captureException(error, { store: 'AccountStore' })\n }\n }\n\n loadMembers = async () => {\n if (this.membersLoading) return\n\n this.membersLoading = true\n try {\n const members = await this.api.getMembers()\n this.setMembers(members)\n } catch (error) {\n console.error(`Error occurred while loading members: ${error}`)\n this.globalStore.captureException(error, { store: 'AccountStore' })\n }\n }\n\n mergeAccounts = async (accountGuids: string[]) => {\n try {\n const response = await this.api.mergeAccounts(accountGuids)\n // the response from the api is a funky database key here, so this is essentially just getting the first item in the returned object\n // to prevent making multiple api calls here\n const mergedAccount = response[Object.keys(response)[0]]\n\n runInAction(() => {\n const account2Index = this.accounts.findIndex((account) => account.guid === accountGuids[1])\n this.accounts.splice(account2Index, 1)\n\n const account1Index = this.accounts.findIndex((account) => account.guid === accountGuids[0])\n this.accounts.splice(account1Index, 1, mergedAccount)\n })\n } catch (error) {\n console.error(`Error occurred while merging accounts: ${error}`)\n this.globalStore.captureException(error, { store: 'AccountStore' })\n }\n }\n\n /**\n * DEPRECATED: Use loadAccountData instead\n */\n refreshAccounts = async () => {\n await Promise.all([this.loadAccounts(), this.loadInstitutions(), this.loadMembers()])\n }\n\n refreshMembers = async () => {\n try {\n await this.api.refreshAllMembers()\n } catch (error) {\n console.error(`Error occurredwhile refreshing members: ${error}`)\n this.globalStore.captureException(error, { store: 'AccountStore' })\n }\n }\n\n removeAccount = async (accountGuid: string) => {\n try {\n await this.api.deleteAccount(accountGuid)\n\n const deletedIndex = this.accounts.findIndex((account) => account.guid === accountGuid)\n this.accounts.splice(deletedIndex, 1)\n } catch (error) {\n console.error(`Error occurred while removing an account: ${error}`)\n this.globalStore.captureException(error, { store: 'AccountStore' })\n }\n }\n\n updateAccount = async (account: Account) => {\n try {\n const updatedAccount = await this.api.updateAccount(account)\n\n const updatedAccountIndex = this.accounts.findIndex(\n (account) => account.guid === updatedAccount.guid,\n )\n\n this.accounts.splice(updatedAccountIndex, 1, updatedAccount)\n } catch (error) {\n console.error(`Error occurred while updating account: ${error}`)\n this.globalStore.captureException(error, { store: 'AccountStore' })\n }\n }\n\n updateAccountBalance = (accountGuid: string, balanceChange: number) => {\n const account = this.accounts.find((a) => a.guid === accountGuid)\n\n if (account) {\n runInAction(() => {\n account.balance = (account.balance || 0) + balanceChange\n })\n }\n }\n\n updateAccountFilter = async (accountMap: Map<string, boolean>) => {\n const accountUpdates: Promise<Account>[] = []\n for (const [guid, isSelected] of accountMap.entries()) {\n const account = this.accounts.find((acc) => acc.guid === guid)\n\n if (account && account.is_excluded_from_accounts === isSelected) {\n account.is_excluded_from_accounts = !isSelected\n accountUpdates.push(this.api.updateAccount(account))\n }\n }\n\n const updatedAccounts: Account[] = await Promise.all(accountUpdates)\n\n const accounts = [...this.accounts]\n for (const updatedAccount of updatedAccounts) {\n const index = accounts.findIndex((acc) => acc.guid === updatedAccount.guid)\n if (index !== -1) {\n accounts.splice(index, 1, updatedAccount)\n }\n }\n this.setAccounts(accounts)\n }\n}\n\n// TODO: Move into AccountStore\nclass UiStore {\n selectedAccount: Account = {} as Account\n selectedMember: Member = {} as Member\n\n constructor() {\n makeAutoObservable(this)\n }\n\n setSelectedAccount = (account: Account) => (this.selectedAccount = account)\n setSelectedMember = (member: Member) => (this.selectedMember = member)\n}\n","import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { AppDataApi, BannerApi } from '../api'\nimport type {\n AppConfig,\n AppData,\n Banner,\n User,\n UserCommunicationProfile,\n UserProfile,\n} from '../types'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class AppDataStore {\n globalStore: GlobalStore\n api: AppDataApi = new AppDataApi('/', '')\n bannerApi: BannerApi = new BannerApi('/')\n\n appData: AppData = {} as AppData\n isAppDataLoaded: boolean = false\n banner: Banner = {}\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new AppDataApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n globalStore.onCaptureException,\n )\n\n makeAutoObservable(this)\n }\n\n get appConfig(): AppConfig {\n return this.globalStore.appConfig\n }\n\n get clientCommunicationProfile() {\n return this.appData.client_communication_profile\n }\n\n get clientInsightProfile() {\n return this.appData.client_insight_profile\n }\n\n get user() {\n return this.appData.user\n }\n\n get userCommunicationProfile() {\n return this.appData.user_communication_profile\n }\n\n get userProfile() {\n return this.appData.user_profile\n }\n\n setAppData = (appData: AppData) => {\n this.appData = appData\n this.bannerApi = new BannerApi(appData.address?.bullseye || '/')\n this.isAppDataLoaded = true\n }\n\n loadAppData = async () => {\n try {\n const appData = await this.api.getAppData()\n this.setAppData(appData)\n } catch (error) {\n console.error(`Error loading app data: ${error}`)\n this.globalStore.captureException(error, { store: 'AppDataStore' })\n }\n }\n\n loadBanner = async () => {\n try {\n const userGuid = this.user?.guid ?? null\n const banner = userGuid ? await this.bannerApi.getBanner(userGuid) : {}\n\n runInAction(() => {\n this.banner = banner\n })\n } catch (error) {\n console.error(`Error loading banner: ${error}`)\n this.globalStore.captureException(error, { store: 'AppDataStore' })\n }\n }\n\n setUser = (user: User) => (this.appData.user = user)\n\n setUserCommunicationProfile = (profile: UserCommunicationProfile) =>\n (this.appData.user_communication_profile = profile)\n\n setUserProfile = (userProfile: UserProfile) => (this.appData.user_profile = userProfile)\n}\n","import { makeAutoObservable, runInAction } from 'mobx'\nimport posthog, { Survey, SurveyQuestion } from 'posthog-js'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class AnalyticsStore {\n globalStore: GlobalStore\n survey: Survey | null = null\n currentQuestionIndex: number = 0\n question: SurveyQuestion | null = null\n response: number | string | null = null\n responses: Record<string, number | string | null> = {}\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n makeAutoObservable(this)\n }\n\n get isLastQuestion() {\n return this.currentQuestionIndex === this.surveyQuestions.length - 1\n }\n\n get questionCount() {\n return `${this.currentQuestionIndex + 1}/${this.surveyQuestions.length}`\n }\n\n get responsePayload() {\n return {\n $survey_id: this.surveyId,\n ...this.responses,\n }\n }\n\n // TODO hardcode elsewhere\n get surveyId() {\n const posthogKey = window.app?.postHogPublicKey\n\n return posthogKey === 'phc_KclQGnOZEaYCttkpiVpuyOYeBlixGo6xNphYgWV4CXo'\n ? '0196caa6-9b37-0000-98a7-f04e8d56faf5'\n : '0196a6b0-ccde-0000-b980-0b84ea2fef4a'\n }\n\n get surveyQuestions() {\n return this.survey ? this.survey.questions : ([] as SurveyQuestion[])\n }\n\n loadSurvey = (forceReload: boolean = false) => {\n posthog.getActiveMatchingSurveys((surveys) => {\n runInAction(() => {\n if (surveys.length > 0) {\n const survey = surveys.find((s) => s.id === this.surveyId)\n if (survey) {\n this.survey = survey\n this.currentQuestionIndex = 0\n this.question = survey.questions[0]\n this.response = null\n this.responses = {}\n }\n }\n })\n }, forceReload)\n }\n\n nextQuestion = () => {\n if (this.currentQuestionIndex < this.surveyQuestions.length - 1) {\n this.currentQuestionIndex += 1\n }\n this.response = null\n this.question = this.surveyQuestions[this.currentQuestionIndex]\n }\n\n resetStore = () => {\n this.survey = null\n this.currentQuestionIndex = 0\n this.question = null\n this.response = null\n this.responses = {}\n }\n\n setResponse = (response: number | string | null) => {\n this.response = response\n if (this.question) {\n this.responses[`$survey_response_${this.question.id}`] = response\n }\n }\n}\n","import { Offer } from '../types'\n\ntype SortOrder = 'asc' | 'desc'\n\nexport function orderArray<T>(arr1: T[], arr2: T[], prop: keyof T, order: SortOrder = 'asc'): T[] {\n const direction = order === 'desc' ? -1 : 1\n return [...arr1, ...arr2].sort((item1, item2) => {\n if (item1[prop] < item2[prop]) return -1 * direction\n if (item1[prop] > item2[prop]) return 1 * direction\n return 0\n })\n}\n\nexport const transformOfferIntoBeatLikeObject = (offer: Offer) => {\n return {\n ...offer, //fields that are offer specific, adding here for visibility\n image_url: offer.image_url,\n guid: offer.guid,\n created_at: offer.created_at,\n dismissed_at: offer.dismissed_at,\n active_at: offer.campaign_activated_at,\n displayed_at: offer.has_been_viewed,\n post_message_secondary: offer.pulse_post_message_secondary, //offer fields mapped to beat fields for functionality\n title: offer.pulse_title || offer.campaign_name,\n html_title: offer.pulse_title || offer.campaign_name,\n short_title: offer.pulse_title || offer.campaign_name,\n html_short_title: offer.pulse_title || offer.campaign_name,\n micro_title: offer.pulse_title || offer.campaign_name,\n html_micro_title: offer.pulse_title || offer.campaign_name,\n supporting_action: offer.pulse_call_to_action_text_secondary,\n description: offer.pulse_body,\n html_description: offer.pulse_body,\n micro_description: offer.pulse_body,\n html_micro_description: offer.pulse_body,\n call_to_action: offer.pulse_call_to_action_text,\n html_micro_call_to_action: offer.pulse_call_to_action_text,\n micro_call_to_action: offer.pulse_call_to_action_text,\n is_dismissed: offer.has_been_dismissed,\n icon_type: 5,\n template: 'MarketingOffer',\n //beat fields we null out\n account_guids: [],\n data_series: {},\n has_been_displayed: false,\n is_obsolete: false,\n is_refreshable: false,\n is_sampled: false,\n merchant_guids: [],\n payload: {},\n pulse_campaign_name: offer.campaign_name,\n scheduled_payment_guids: [],\n transaction_guids: [],\n user_guid: '',\n user_verification: 0,\n }\n}\n","import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { BeatApi } from '../api'\nimport type { Beat, Offer } from '../types'\nimport { orderArray, transformOfferIntoBeatLikeObject } from '../utils/BeatUtils'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class BeatStore {\n globalStore: GlobalStore\n api: BeatApi = new BeatApi('/', '')\n beats: Beat[] = []\n isLoading = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new BeatApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n globalStore.onCaptureException,\n )\n\n makeAutoObservable(this)\n }\n\n loadBeats = async () => {\n this.isLoading = true\n const beats = await this.api.getBeats()\n const offers = await this.api.getOffers()\n const beatLikeOffers = offers.map((o: Offer) => transformOfferIntoBeatLikeObject(o))\n\n runInAction(() => {\n this.beats = orderArray(beats, beatLikeOffers, 'active_at', 'desc')\n this.isLoading = false\n })\n }\n\n getFilteredBeats(filter: { categoryGuids?: string[]; templates?: string[] }): Beat[] {\n const { categoryGuids, templates } = filter\n let filteredBeats = this.beats\n if (categoryGuids) filteredBeats = this.filterBeatsByCategory(filteredBeats, categoryGuids)\n if (templates) filteredBeats = this.filterBeatsByTemplate(filteredBeats, templates)\n return filteredBeats\n }\n\n // Return beats with any beat.category_guids that are in categoryGuids\n filterBeatsByCategory(beats: Beat[], categoryGuids: string[]): Beat[] {\n return beats.filter((beat) => {\n return beat.category_guids?.some((guid) => categoryGuids.includes(guid))\n })\n }\n\n // Return beats with a beat.template that is in templates\n filterBeatsByTemplate(beats: Beat[], templates: string[]): Beat[] {\n return beats.filter((beat) => {\n return templates.some((template) => beat.template === template)\n })\n }\n}\n","import { makeAutoObservable, reaction, runInAction } from 'mobx'\n\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { startOfToday } from 'date-fns/startOfToday'\n\nimport { Theme } from '@mui/system'\n\nimport { BudgetsApi } from '../api'\nimport { CategoryGuids } from '../constants'\nimport { augmentBudgets, findBudget, findSubBudget } from '../utils/BudgetUtil'\n\nimport { GlobalStore } from './GlobalStore'\n\nimport type {\n Budget,\n Category,\n DateRange,\n DetailedBudget,\n DetailedCategory,\n MerchantBudget,\n} from '../types'\n\nexport class BudgetsStore {\n api: BudgetsApi = new BudgetsApi('/', '')\n\n globalStore: GlobalStore\n\n alert: string = ''\n dateRange: DateRange = { start: startOfMonth(startOfToday()), end: endOfMonth(startOfToday()) }\n budgets: Budget[] = []\n selectedBudget: DetailedBudget | undefined\n selectedSubBudget: DetailedBudget | undefined\n isDataLoaded = false\n theme = {} as Theme\n merchantBudgets: MerchantBudget[] = []\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new BudgetsApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n globalStore.onCaptureException,\n )\n\n makeAutoObservable(this)\n }\n\n loadBudgetData = async () => {\n if (!this.globalStore.recurringTransactionsStore.isDataLoaded) {\n await this.globalStore.recurringTransactionsStore.loadRepeatingTransactionData()\n }\n await this.loadBudgets()\n\n /** Reaction to update the selected budget/sub-budget if detailedBudgets is updated **/\n reaction(\n () => this.detailedBudgets,\n (detailedBudgets) => {\n if (detailedBudgets) {\n const budget = this.selectedBudget\n if (budget) {\n this.selectedBudget = findBudget(detailedBudgets, budget.guid)\n }\n\n const subBudget = this.selectedSubBudget\n if (subBudget && subBudget.parent_guid) {\n this.selectedSubBudget = findSubBudget(\n detailedBudgets,\n subBudget.guid,\n subBudget.parent_guid,\n )\n }\n }\n },\n )\n }\n\n get detailedBudgets(): DetailedBudget[] {\n return augmentBudgets(\n this.budgets.filter(\n (budget: Budget) =>\n budget.category_guid !== CategoryGuids.INCOME &&\n budget.category_guid !== CategoryGuids.TRANSFER &&\n budget.category_guid !== CategoryGuids.INVESTMENTS,\n ),\n this.globalStore.categoryStore.detailedCategories,\n this.globalStore.copyStore.copy.budgets,\n this.theme,\n ).sort((a, b) => {\n if (a.percentage > b.percentage) return -1\n if (a.percentage < b.percentage) return 1\n return 0\n })\n }\n\n // TODO: Replace this with income from recurring transactions. Income budgets are deprecated.\n get incomeBudget(): number | undefined {\n const filteredBudgets = augmentBudgets(\n this.budgets.filter((budget: Budget) => !budget.parent_guid),\n this.globalStore.categoryStore.detailedCategories,\n this.globalStore.copyStore.copy.budgets,\n this.theme,\n )\n\n const incomeBudget = filteredBudgets.reduce(\n (acc, curr) => {\n if (curr.category_guid !== CategoryGuids.INCOME) return acc\n if (!acc || curr.percentage > acc.percentage) return curr\n return acc\n },\n undefined as DetailedBudget | undefined,\n )\n\n return incomeBudget?.amount\n }\n\n get unbudgetedCategories(): DetailedCategory[] {\n return this.globalStore.categoryStore.spendCategories.filter(\n (category) => !this.detailedBudgets.find((budget) => budget.category_guid === category.guid),\n )\n }\n\n get totalBudgeted(): number {\n return this.detailedBudgets.reduce((total, budget) => total + budget.amount, 0)\n }\n\n addBudget = async (category: Category, amount: number, parentGuid: string | null = null) => {\n try {\n const budget = await this.api.addBudget(category, amount, parentGuid)\n runInAction(() => {\n this.budgets.push(budget)\n })\n } catch (error) {\n console.error(`Error adding budget: ${error}`)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n }\n }\n\n deleteBudget = async (guid: string) => {\n try {\n await this.api.deleteBudget(guid)\n\n runInAction(() => {\n const index = this.budgets.findIndex((budget) => budget.guid === guid)\n if (index >= 0) {\n this.budgets.splice(index, 1)\n }\n })\n } catch (error) {\n console.error(`Error deleting budget: ${error}`)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n }\n }\n\n loadBudgets = async () => {\n try {\n const budgets = await this.api.getBudgets()\n this.setBudgets(budgets)\n } catch (error) {\n console.error(`Error occurred while loading budgets: ${error}`)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n throw error\n }\n }\n\n setAlert = (alert: string) => (this.alert = alert)\n\n setBudgets = (budgets: Budget[]) => {\n this.budgets = budgets\n this.isDataLoaded = true\n }\n\n setDateRange = (dateRange: DateRange) => (this.dateRange = dateRange)\n\n setSelectedBudget = (budget: DetailedBudget | undefined) => (this.selectedBudget = budget)\n\n setSelectedSubBudget = (budget: DetailedBudget | undefined) => (this.selectedSubBudget = budget)\n\n setTheme = (theme: Theme) => (this.theme = theme)\n\n /**\n * Recalculate budget by using the average amount from top-level categories\n * @param categories Detailed categories\n */\n recalculateBudgets = async (categories: DetailedCategory[]) => {\n try {\n for (const category of categories) {\n const budget = this.budgets.find((budget) => budget.category_guid === category.guid)\n if (budget) {\n await this.api.updateBudget({\n ...budget,\n amount: category.totalAverageAmount,\n })\n } else {\n await this.api.addBudget(category, category.totalAverageAmount)\n }\n }\n const budgetsToDelete = this.budgets.filter(\n (budget) => !categories.find((c) => c.guid === budget.category_guid),\n )\n\n for (const budgetToDelete of budgetsToDelete) {\n await this.api.deleteBudget(budgetToDelete.guid)\n }\n\n await this.loadBudgets()\n\n return { data: this.budgets, isSuccess: true }\n } catch (error) {\n console.error('error recalculating budgets', error)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n return { data: [], isSuccess: false }\n }\n }\n\n updateBudget = async (budget: Budget) => {\n try {\n const updatedBudget = await this.api.updateBudget(budget)\n\n runInAction(() => {\n const index = this.budgets.findIndex((b) => b.guid === budget.guid)\n if (index >= 0) {\n this.budgets[index] = updatedBudget\n }\n })\n } catch (error) {\n console.error(`Error updating budget: ${error}`)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n }\n }\n\n getMerchantBudgetByMerchantGuid = (merchantGuid: string): MerchantBudget | undefined => {\n return this.merchantBudgets.find(\n (eachMerchantBudget) => eachMerchantBudget?.merchant_guid === merchantGuid,\n )\n }\n\n setMerchantBudgets = (merchantBudgets: MerchantBudget[]) => {\n this.merchantBudgets = merchantBudgets\n }\n\n addMerchantBudget = async (merchantGuid: string, amount: number) => {\n try {\n const newMerchantBudget = await this.api.addMerchantBudget(merchantGuid, amount)\n\n runInAction(() => {\n this.merchantBudgets.push(newMerchantBudget)\n })\n return { isSuccess: true }\n } catch (error) {\n console.error(`Error adding merchant budget: ${error}`)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n return { isSuccess: false }\n }\n }\n\n updateMerchantBudget = async (merchantBudget: MerchantBudget) => {\n try {\n const { guid: merchantBudgetGuid, amount } = merchantBudget\n const updatedMerchantBudget = await this.api.updateMerchantBudget(merchantBudgetGuid, amount)\n\n runInAction(() => {\n const index = this.merchantBudgets.findIndex((b) => b.guid === merchantBudget.guid)\n if (index >= 0) {\n this.merchantBudgets[index] = updatedMerchantBudget\n }\n })\n return { isSuccess: true }\n } catch (error) {\n console.error(`Error updating merchant budget: ${error}`)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n return { isSuccess: false }\n }\n }\n\n deleteMerchantBudget = async (merchantBudgetGuid: string) => {\n try {\n await this.api.deleteMerchantBudget(merchantBudgetGuid)\n\n runInAction(() => {\n this.merchantBudgets = this.merchantBudgets.filter((b) => b.guid !== merchantBudgetGuid)\n })\n return { isSuccess: true }\n } catch (error) {\n console.error(`Error deleting merchant budget: ${error}`)\n this.globalStore.captureException(error, { store: 'BudgetsStore' })\n return { isSuccess: false }\n }\n }\n}\n","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, Recurrence, UserProfile } from '../types'\nimport { getAccountStartingBalance } from '../utils/AccountUtils'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class CashflowStore {\n globalStore: GlobalStore\n uiStore: UiStore\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.uiStore = new UiStore(globalStore)\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\nclass UiStore {\n globalStore: GlobalStore\n\n // Cashflow is hard-coded to display 30 days starting from today. This is the\n // single source of truth for Cash Flow's window; it intentionally does NOT\n // mutate RecurringTransactionsStore.dateRange, so Cash Flow stays decoupled\n // from other widgets (e.g. Recurring Transactions) that drive that shared range.\n dateRange = { start: startOfToday(), end: addDays(startOfToday(), 30) }\n isDirty = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n\n makeAutoObservable(this)\n }\n\n // Recurrence data scoped to Cash Flow's own dateRange, sourced from the\n // range-parameterized helpers on RecurringTransactionsStore. Computeds (not\n // component state) per the project's MobX conventions.\n get income(): Recurrence[] {\n return this.globalStore.recurringTransactionsStore.incomeForRange(this.dateRange)\n }\n\n get upcomingIncome(): Recurrence[] {\n return this.globalStore.recurringTransactionsStore.upcomingIncomeForRange(this.dateRange)\n }\n\n get upcomingExpenses(): Recurrence[] {\n return this.globalStore.recurringTransactionsStore.upcomingExpensesForRange(this.dateRange)\n }\n\n get nextIncome(): Recurrence | undefined {\n return this.globalStore.recurringTransactionsStore.nextIncomeForRange(this.dateRange)\n }\n\n // Visible cash accounts that are currently selected in the account filter.\n // Computed (single source of truth) so it stays in sync with account data and\n // the filter without effect-based syncing in components.\n get selectedCashAccounts(): Account[] {\n const { selectedAccountGuids } = this.globalStore.globalUiStore\n return this.globalStore.accountStore.visibleCashAccounts.filter((account) =>\n selectedAccountGuids.includes(account.guid),\n )\n }\n\n // Total spendable/starting balance across the selected cash accounts, using\n // the shared per-account balance rule (available vs current balance).\n get selectedCashBalance(): number {\n const showAvailableBalance =\n this.globalStore.appConfig.config.display_available_balance_in_accounts\n return this.selectedCashAccounts.reduce(\n (total, account) => total + getAccountStartingBalance(account, showAvailableBalance),\n 0,\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","import { makeAutoObservable } 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 { CategoryGuids, CategoryGuidToName } from '../constants'\nimport { CategoryApi } from '../api'\n\nimport { GlobalStore } from './GlobalStore'\n\nimport type {\n Account,\n Category,\n DetailedCategory,\n DetailedCategoryWithTransactions,\n DateRangeCategoryTotals,\n MonthlyCategoryTotals,\n} from '../types'\n\nimport { augmentCategories, getDetailedCategoryTransactions } from '../utils/CategoryUtil'\n\nexport class CategoryStore {\n globalStore: GlobalStore\n uiStore: UiStore\n api = new CategoryApi('/', '')\n\n categories: Category[] = []\n categoriesLoaded: boolean = false\n categoriesLoading: boolean = false\n dateRangeCategoryTotals: DateRangeCategoryTotals[] = []\n monthlyCategoryTotals: MonthlyCategoryTotals[] = []\n\n dateRangeTotalsLoaded = false\n dateRangeTotalsLoading = false\n monthlyTotalsLoaded = false\n monthlyTotalsLoading = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.uiStore = new UiStore()\n this.api = new CategoryApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n globalStore.onCaptureException,\n )\n\n makeAutoObservable(this)\n }\n\n get detailedCategories(): DetailedCategory[] {\n if (!this.globalStore.isInitialized) return []\n return augmentCategories(\n this.categories,\n this.globalStore.copyStore.copy.categories,\n this.dateRangeCategoryTotals,\n this.monthlyCategoryTotals,\n )\n }\n\n get detailedCategoriesWithTransactions(): DetailedCategoryWithTransactions[] {\n return getDetailedCategoryTransactions(\n this.detailedCategories,\n this.globalStore.transactionStore.sortedTransactions,\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 setCategories = (categories: Category[]) => {\n this.categories = categories\n this.categoriesLoading = false\n this.categoriesLoaded = true\n }\n\n setMonthlyCategoryTotals = (totals: MonthlyCategoryTotals[]) => {\n this.monthlyCategoryTotals = totals\n this.monthlyTotalsLoading = false\n this.monthlyTotalsLoaded = true\n }\n\n setDateRangeCategoryTotals = (totals: DateRangeCategoryTotals[]) => {\n this.dateRangeCategoryTotals = totals\n this.dateRangeTotalsLoading = false\n this.dateRangeTotalsLoaded = true\n }\n\n get trendsCategories(): DetailedCategory[] {\n return this.detailedCategories\n .filter((c) => c.totalAmount !== 0)\n .filter((c) => c.guid !== CategoryGuids.INVESTMENTS && c.guid !== CategoryGuids.TRANSFER)\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 this.globalStore.captureException(error, { store: 'CategoryStore' })\n }\n }\n\n loadCategories = async () => {\n if (this.categoriesLoading) return\n\n this.categoriesLoading = true\n try {\n const categories = await this.api.getCategories()\n this.setCategories(categories)\n } catch (error) {\n console.error(`Error occurred while getting categories: ${error}`)\n this.globalStore.captureException(error, { store: 'CategoryStore' })\n }\n }\n\n loadDateRangeCategoryTotals = async (accounts: Account[], startDate: Date, endDate: Date) => {\n if (this.dateRangeTotalsLoading) return\n\n this.dateRangeTotalsLoading = true\n try {\n const totals = await this.api.getDateRangeCategoryTotals(\n getUnixTime(startDate),\n getUnixTime(endDate),\n accounts,\n )\n this.setDateRangeCategoryTotals(totals)\n } catch (error) {\n console.error(`Error occurred while getting date range category totals: ${error}`)\n this.globalStore.captureException(error, { store: 'CategoryStore' })\n }\n }\n\n loadMonthlyCategoryTotals = async (\n accounts: Account[] = this.globalStore.globalUiStore.selectedAccounts,\n startDate?: Date,\n endDate?: Date,\n ) => {\n if (this.monthlyTotalsLoading) return\n\n this.monthlyTotalsLoading = true\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 this.setMonthlyCategoryTotals(totals)\n } catch (error) {\n console.error(`Error occurred while getting monthly category totals: ${error}`)\n this.globalStore.captureException(error, { store: 'CategoryStore' })\n }\n }\n\n reloadCategoryTotals = async (accounts: Account[], startDate?: Date, endDate?: Date) => {\n const start = startDate ?? subMonths(new Date(), 11)\n const end = endDate ?? endOfMonth(new Date())\n try {\n await Promise.all([\n this.loadMonthlyCategoryTotals(accounts, start, end),\n this.loadDateRangeCategoryTotals(accounts, start, end),\n ])\n } catch (error) {\n console.error(`Error occurred while getting category totals: ${error}`)\n this.globalStore.captureException(error, { store: 'CategoryStore' })\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 this.globalStore.captureException(error, { store: 'CategoryStore' })\n }\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 this.globalStore.captureException(error, { store: 'CategoryStore' })\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\n// TODO: Move into CategoryStore\nclass 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 } from 'mobx'\n\nimport { WidgetApi } from '../api'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class ConnectStore {\n globalStore: GlobalStore\n widgetApi: WidgetApi = new WidgetApi('/', '')\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.widgetApi = new WidgetApi(globalStore.endpoint, globalStore.sessionToken)\n\n makeAutoObservable(this)\n }\n\n loadWidget = async ({ widget = 'connect_widget', mode = 'light', ...rest }) => {\n return await this.widgetApi.requestWidgetUrl({\n widget_url: { widget_type: widget, color_scheme: mode, ...rest },\n })\n }\n}\n","import { makeAutoObservable } from 'mobx'\n\nimport { type Debt } from '../types'\nimport { loadDebts, type DebtChartData } from '../utils/DebtUtils'\nimport { DebtPriority } from '../constants/Debts'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class DebtsStore {\n globalStore: GlobalStore\n uiStore: UiStore\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.uiStore = new UiStore()\n makeAutoObservable(this)\n }\n\n get debts(): Debt[] {\n const { visibleDebtAccounts: debtAccounts } = this.globalStore.accountStore\n const { selectedAccountGuids } = this.globalStore.globalUiStore\n const { debtGoals } = this.globalStore.goalStore\n\n const filteredDebtAccounts = selectedAccountGuids.length\n ? debtAccounts.filter((acc) => selectedAccountGuids.includes(acc.guid))\n : debtAccounts\n\n return loadDebts(filteredDebtAccounts, debtGoals)\n }\n\n get totalMonthlyPayments(): number {\n const payments = this.debts.map((d) => Number(d.monthly_payment)).filter((p) => !isNaN(p))\n return payments.reduce((total, payment) => total + payment, 0)\n }\n}\n\nexport class UiStore {\n isLoading = false\n selectedDebtChartData: DebtChartData = {} as DebtChartData\n selectedDebtPriority: DebtPriority = DebtPriority.LOWEST_BALANCE\n\n constructor() {\n makeAutoObservable(this)\n }\n\n get showError() {\n const { interest_rate, monthly_payment } = this.selectedDebtChartData\n return interest_rate === undefined || monthly_payment === undefined\n }\n\n get showCompleted() {\n return this.selectedDebtChartData.is_paid_off\n }\n\n setIsLoading = (isLoading: boolean) => (this.isLoading = isLoading)\n\n setSelectedDebtChartData = (data: DebtChartData) => (this.selectedDebtChartData = data)\n\n setSelectedDebtPriority = (priority: DebtPriority) => (this.selectedDebtPriority = priority)\n}\n","import { DATE_FORMATS_INTL, formatDate } from '../constants'\nimport { type Transaction } from '../types'\nimport type { SpendingFeeTransaction, MonthlyHealthScoreItem } from '../../core/types/Finstrong'\n\nexport const augmentChartData = (averageHealthScores: MonthlyHealthScoreItem[]) => {\n return averageHealthScores\n .sort((a, b) => {\n // Sort by year first, then by month\n if (a.monthly_health_score_average.year !== b.monthly_health_score_average.year) {\n return a.monthly_health_score_average.year - b.monthly_health_score_average.year\n }\n return a.monthly_health_score_average.month - b.monthly_health_score_average.month\n })\n .map((item) => ({\n x: formatDate(\n new Date(0, item.monthly_health_score_average.month - 1, 1),\n DATE_FORMATS_INTL.MONTH_SHORT,\n ),\n y: Math.round(item.monthly_health_score_average.average_health_score),\n }))\n}\n\nexport const augmentSpendingFeeTransactions = (\n spendingFeeTransactions: SpendingFeeTransaction[],\n): Transaction[] => {\n const organizedSpendingFeeTransactions = spendingFeeTransactions\n .map(({ transaction }: SpendingFeeTransaction) => {\n return {\n ...transaction,\n }\n })\n .sort((a, b) => b.date - a.date)\n\n return organizedSpendingFeeTransactions\n}\n","import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { format } from 'date-fns/format'\nimport { fromUnixTime } from 'date-fns/fromUnixTime'\nimport { getUnixTime } from 'date-fns/getUnixTime'\nimport { subMonths } from 'date-fns/subMonths'\n\nimport { FinstrongApi } from '../api'\nimport type {\n MonthlySummaries,\n HealthScore,\n HealthScoreReport,\n MonthlyHealthScore,\n Transaction,\n} from '../types'\nimport type { FinstrongTransaction, PeerAverage } from '../types/Finstrong'\nimport { augmentChartData, augmentSpendingFeeTransactions } from '../utils/FinstrongUtils'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class FinstrongStore {\n api = new FinstrongApi('/', '')\n augmentedChartData: { x: string; y: number }[] = []\n averageHealthScores: MonthlyHealthScore[] = []\n monthlySummaries: MonthlySummaries[] = []\n incomeTransactions: FinstrongTransaction[] = []\n debtSpendTransactions: FinstrongTransaction[] = []\n spendingFeeTransactions: Transaction[] = []\n spendTransactions: FinstrongTransaction[] = []\n globalStore: GlobalStore\n healthScore: HealthScore = {} as HealthScore\n healthScoreChange?: number\n healthScoreChangeReports: HealthScoreReport[] = []\n peerScore: PeerAverage | null = null\n isSpendingInitialized: boolean = false\n isIncomeInitialized: boolean = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new FinstrongApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n globalStore.onCaptureException,\n )\n makeAutoObservable(this)\n }\n\n setSpendingInitialized = (isSpendingInitialized: boolean) => {\n this.isSpendingInitialized = isSpendingInitialized\n }\n\n setIncomeInitialized = (isIncomeInitialized: boolean) => {\n this.isIncomeInitialized = isIncomeInitialized\n }\n\n calculateHealthScore = async (needHealthScoreChangeReport: boolean = true) => {\n try {\n const healthScore = await this.api.calculateHealthScore()\n\n let healthScoreChange = 0\n\n if (needHealthScoreChangeReport) {\n await this.loadHealthScoreChangeReports()\n }\n\n const currentScore = healthScore?.health_score || 0\n const oldScore = this.healthScoreChangeReports.at(-1)?.older_health_score || 0\n healthScoreChange = currentScore - oldScore\n\n runInAction(() => {\n this.healthScore = healthScore\n this.healthScoreChange = healthScoreChange\n })\n } catch (e) {\n console.error('Error calculating health score:', e)\n this.globalStore.captureException(e, { store: 'FinstrongStore' })\n }\n }\n\n loadAverageHealthScores = async () => {\n try {\n const averageHealthScores = await this.api.getAverageHealthScores()\n runInAction(() => {\n this.averageHealthScores = averageHealthScores\n })\n } catch (e) {\n console.error('Error loading average health scores:', e)\n this.globalStore.captureException(e, { store: 'FinstrongStore' })\n }\n }\n\n loadMonthlySummaries = async () => {\n try {\n const monthlySummaries = await this.api.getMonthlySummaries()\n runInAction(() => {\n this.monthlySummaries = monthlySummaries\n })\n } catch (e) {\n console.error('Error loading monthly summaries:', e)\n this.globalStore.captureException(e, { store: 'FinstrongStore' })\n }\n }\n\n loadDebtSpend = async () => {\n try {\n const debtSpend = await this.api.getDebtSpend()\n runInAction(() => {\n this.debtSpendTransactions = debtSpend\n })\n } catch (e) {\n console.error('Error loading debt spend:', e)\n this.globalStore.captureException(e, { store: 'FinstrongStore' })\n }\n }\n\n loadIncome = async () => {\n this.setIncomeInitialized(false)\n try {\n const income = await this.api.getIncome()\n runInAction(() => {\n this.incomeTransactions = income\n this.setIncomeInitialized(true)\n })\n } catch (e) {\n console.error('Error loading income:', e)\n this.globalStore.captureException(e, { store: 'FinstrongStore' })\n }\n }\n\n loadHealthScoreChangeReports = async () => {\n const startDate = getUnixTime(subMonths(new Date(), 2))\n const endDate = getUnixTime(new Date())\n\n try {\n const healthScoreChangeReports = await this.api.getHealthScoreChangeReports(\n startDate,\n endDate,\n )\n runInAction(() => {\n this.healthScoreChangeReports = healthScoreChangeReports\n })\n } catch (e) {\n console.error('Error loading health score change reports:', e)\n this.globalStore.captureException(e, { store: 'FinstrongStore' })\n }\n }\n\n loadPeerScore = async () => {\n const birthYear = format(fromUnixTime(this.globalStore.appDataStore.user.birthday!), 'yyyy')\n\n try {\n const peerScore = await this.api.getPeerScore(birthYear)\n runInAction(() => {\n this.peerScore = peerScore\n })\n } catch (e) {\n console.error('Error loading peer score:', e)\n this.globalStore.captureException(e, { store: 'FinstrongStore' })\n }\n }\n\n loadAugmentedChartData = async () => {\n try {\n const augmentedChartData = await this.api.getAverageHealthScores()\n\n runInAction(() => {\n this.augmentedChartData = augmentChartData(augmentedChartData)\n })\n } catch (error) {\n console.error(`Error occurred while getting augmented chart data: ${error}`)\n this.globalStore.captureException(error, { store: 'FinstrongStore' })\n }\n }\n\n getSpendingFeeTransactions = async () => {\n try {\n const spendingFeeTransaction = await this.api.getSpendingFeeTransactions()\n const organizedSpendingFeeTransactions =\n augmentSpendingFeeTransactions(spendingFeeTransaction)\n runInAction(() => {\n this.spendingFeeTransactions = organizedSpendingFeeTransactions\n })\n } catch (error) {\n console.error(`Error occurred while getting spending fee transactions: ${error}`)\n this.globalStore.captureException(error, { store: 'FinstrongStore' })\n }\n }\n\n loadSpendTransactions = async () => {\n this.setSpendingInitialized(false)\n try {\n const spendTransaction = await this.api.getStandardSpend()\n runInAction(() => {\n this.spendTransactions = [...spendTransaction]\n this.setSpendingInitialized(true)\n })\n } catch (e) {\n console.error('Error loading spend transactions:', e)\n this.globalStore.captureException(e, { store: 'FinstrongStore' })\n }\n }\n\n get spendAndDebtTransactions() {\n return [...this.spendTransactions, ...this.debtSpendTransactions]\n }\n\n get allTransactions() {\n return {\n income: this.incomeTransactions,\n debtSpend: this.debtSpendTransactions,\n spendingFee: this.spendingFeeTransactions,\n spend: this.spendTransactions,\n }\n }\n handleFinstrongWidgetPrimaryCtaClick = (value: string) => () => {\n // eslint-disable-next-line no-void\n void value\n }\n}\n","import type { AppConfig } from '../types'\n\nexport const DefaultAppConfig: AppConfig = {\n clientConfig: {},\n clientStyleProfile: {},\n config: {\n assets_prefix: '/assets',\n bundle: 'widgetLoader',\n client_guid: '',\n dashboard_accounts_index: 6,\n dashboard_accounts_location: 0,\n dashboard_activity_index: 2,\n dashboard_activity_location: 0,\n dashboard_budgets_index: 5,\n dashboard_budgets_location: 1,\n dashboard_cash_flow_index: 0,\n dashboard_cash_flow_location: 0,\n dashboard_connect_index: 7,\n dashboard_connect_location: 1,\n dashboard_insights_index: 3,\n dashboard_insights_location: 1,\n dashboard_spending_index: 1,\n dashboard_spending_location: 1,\n dashboard_survey_index: 8,\n dashboard_survey_location: 1,\n dashboard_trends_index: 4,\n dashboard_trends_location: 0,\n display_account_number_in_accounts: true,\n display_add_manual_transaction_in_transactions: true,\n display_available_balance_in_accounts: true,\n display_email_edit_field_in_settings: true,\n display_mobile_devices_in_settings: true,\n display_notification_settings_in_settings: true,\n display_only_external_accounts_in_accounts: false,\n display_password_options_in_settings: true,\n display_sms_edit_field_in_settings: true,\n display_terms_and_conditions: true,\n display_user_profile_in_settings: true,\n display_user_transaction_rules_in_settings: true,\n display_widget_headings: true,\n enable_add_account_in_zero_state: true,\n enable_aggregation_prompts: true,\n enable_external_accounts_in_goals_widget: true,\n enable_funds_transfers_in_goals_widget: false,\n enable_manual_accounts: true,\n enable_mark_account_closed_for_held_accounts: true,\n enable_mark_account_duplicate_for_held_accounts: true,\n enable_renaming_home_accounts: true,\n enable_support_requests: false,\n language: 'en-US',\n product_name: 'Money Dashboard',\n session_token: '',\n show_account_nicknames_in_master: false,\n show_accounts_widget_in_master: true,\n show_budgets_widget_in_master: true,\n show_carousel_card_border_in_pulse_micro_widget: false,\n show_cash_flow_widget_in_master: true,\n show_connections_widget_in_master: true,\n show_debts_widget_in_master: true,\n show_finstrong_widget_in_master: true,\n show_full_experience_link_in_pulse_micro_widget: false,\n show_full_experience_link_in_pulse_mini_widget: false,\n show_goals_widget_in_master: true,\n show_help_widget_in_master: true,\n show_horizontal_padding_in_pulse_micro_widget: true,\n show_icon_in_pulse_micro_widget: true,\n show_insights_widget_in_master: true,\n show_investments_widget_in_master: false,\n show_mx_branding: true,\n show_navigation_controls_in_pulse_micro_widget: true,\n show_net_worth_widget_in_master: true,\n show_notifications_widget_in_master: true,\n show_recurring_transactions_widget_in_master: true,\n show_settings_widget_in_master: true,\n show_spending_plan_widget_in_master: false,\n show_spending_widget_in_master: true,\n show_transactions_widget_in_master: true,\n show_trends_widget_in_master: true,\n type: 'money-dashboard',\n websocket: {\n hmac: '',\n token: '',\n url: '',\n },\n widgets_display_name: 'Money Dashboard ',\n },\n honeyBadgerPublicKey: '',\n options: {\n assets_prefix: '/assets',\n brokaw_auth: {\n token: '',\n hmac: '',\n url: '',\n },\n brokaw_websocket_url: '',\n bundle: 'widgetLoader',\n custom_copy_namespace: '',\n language: 'en-US',\n product_name: 'Master Widget',\n session_token: '',\n subtype: 'master',\n type: 'money_dashboard',\n },\n postHogPublicKey: 'phc_1fVYJICC69TpW4wagp9o2XqQ8E7X98cAmcR5psSpfkE',\n userFeatures: [],\n}\n","import { autorun, makeAutoObservable } from 'mobx'\n\nimport { DefaultAppConfig } from '../constants/DefaultConfig'\n\nimport {\n AccountStore,\n AnalyticsStore,\n AppDataStore,\n BeatStore,\n BudgetsStore,\n CashflowStore,\n CategoryStore,\n ConnectStore,\n DebtsStore,\n FinstrongStore,\n GlobalCopyStore,\n GlobalUiStore,\n GoalStore,\n HelpStore,\n HoldingStore,\n MerchantStore,\n NetWorthStore,\n NotificationStore,\n RecurringTransactionsStore,\n SettingsStore,\n TransactionStore,\n TrendsStore,\n UserStore,\n} from '../stores'\n\nimport type {\n Account,\n Category,\n Institution,\n Member,\n AppConfig,\n AppData,\n Beat,\n GlobalCaptureException,\n GlobalErrorHandler,\n MerchantBudget,\n Tag,\n Tagging,\n Transaction,\n TransactionRule,\n UserFeature,\n} from '../types'\n\ninterface LoadDataProps {\n accounts?: Account[]\n appData?: AppData\n associatedBeats?: Beat[]\n categories?: Category[]\n institutions?: Institution[]\n members?: Member[]\n merchantBudgets?: MerchantBudget[]\n taggings?: Tagging[]\n tags?: Tag[]\n transactionRules?: TransactionRule[]\n transactions?: Transaction[]\n userFeatures?: UserFeature[]\n}\n\ntype OnStoreUpdate = (update: ObservedUpdate) => void\ntype ObservedUpdate = {\n transactions: Transaction[]\n}\nexport class GlobalStore {\n // Global properties\n appConfig: AppConfig = DefaultAppConfig\n endpoint: string = '/'\n sessionToken: string = ''\n onCaptureException?: GlobalCaptureException\n onError?: GlobalErrorHandler\n onStoreUpdate?: OnStoreUpdate\n\n // Data Stores\n accountStore: AccountStore\n appDataStore: AppDataStore\n analyticsStore: AnalyticsStore\n beatStore: BeatStore\n budgetsStore: BudgetsStore\n cashflowStore: CashflowStore\n categoryStore: CategoryStore\n connectStore: ConnectStore\n copyStore: GlobalCopyStore\n debtsStore: DebtsStore\n finstrongStore: FinstrongStore\n goalStore: GoalStore\n helpStore: HelpStore\n holdingStore: HoldingStore\n merchantStore: MerchantStore\n netWorthStore: NetWorthStore\n notificationStore: NotificationStore\n recurringTransactionsStore: RecurringTransactionsStore\n settingsStore: SettingsStore\n transactionStore: TransactionStore\n trendsStore: TrendsStore\n userStore: UserStore\n\n // UI Stores\n globalUiStore: GlobalUiStore\n\n constructor(\n appConfig: AppConfig = DefaultAppConfig,\n endpoint: string = '/',\n onError?: GlobalErrorHandler,\n onStoreUpdate?: OnStoreUpdate,\n onCaptureException?: GlobalCaptureException,\n ) {\n this.appConfig = appConfig\n this.endpoint = endpoint\n this.sessionToken = appConfig.options.session_token ?? ''\n this.onCaptureException = onCaptureException\n this.onError = onError\n this.onStoreUpdate = onStoreUpdate\n\n this.accountStore = new AccountStore(this)\n this.appDataStore = new AppDataStore(this)\n this.analyticsStore = new AnalyticsStore(this)\n this.beatStore = new BeatStore(this)\n this.budgetsStore = new BudgetsStore(this)\n this.cashflowStore = new CashflowStore(this)\n this.categoryStore = new CategoryStore(this)\n this.connectStore = new ConnectStore(this)\n this.copyStore = new GlobalCopyStore(this)\n this.debtsStore = new DebtsStore(this)\n this.finstrongStore = new FinstrongStore(this)\n this.goalStore = new GoalStore(this)\n this.helpStore = new HelpStore(this)\n this.holdingStore = new HoldingStore(this)\n this.merchantStore = new MerchantStore(this)\n this.netWorthStore = new NetWorthStore(this)\n this.notificationStore = new NotificationStore(this)\n this.recurringTransactionsStore = new RecurringTransactionsStore(this)\n this.settingsStore = new SettingsStore(this)\n this.transactionStore = new TransactionStore(this)\n this.trendsStore = new TrendsStore(this)\n this.userStore = new UserStore(this)\n\n this.globalUiStore = new GlobalUiStore(this)\n\n makeAutoObservable(this)\n\n // detects a change based on an observed value\n autorun(() => {\n // destructure or assign new variables to observe changes to them\n // in this case we are observing changes to `transactions`\n const { transactions } = this.transactionStore\n this.emitUpdate({\n transactions,\n })\n })\n }\n\n get isInitialized() {\n return this.globalUiStore.isInitialized\n }\n\n captureException = (error: unknown, context?: Record<string, string>) => {\n this.onCaptureException?.(error, context)\n }\n\n // emits change triggered in the autorun\n emitUpdate = (change: ObservedUpdate) => {\n this.onStoreUpdate?.(change)\n }\n\n loadConfigData = async () => {\n await Promise.all([\n // Load copy, config and user data\n this.copyStore.loadCopy(),\n this.appDataStore.loadAppData(),\n this.accountStore.refreshMembers(),\n this.userStore.loadUserFeatures(),\n ])\n }\n\n loadData = async ({\n accounts,\n appData,\n associatedBeats,\n categories,\n institutions,\n transactionRules,\n transactions,\n userFeatures,\n merchantBudgets,\n }: LoadDataProps = {}) => {\n if (!appData || !userFeatures) {\n await this.loadConfigData()\n }\n\n // Keep for backwards compatibility for Insights\n if (appData) {\n this.appDataStore.setAppData(appData)\n }\n\n if (userFeatures) {\n this.userStore.setUserFeatures(userFeatures)\n }\n\n if (accounts) {\n await this.accountStore.loadMembers()\n if (institutions) {\n this.accountStore.setInstitutions(institutions)\n }\n this.accountStore.setAccounts(accounts)\n }\n\n if (associatedBeats) {\n this.transactionStore.setAssociatedBeats(associatedBeats)\n }\n\n if (categories) {\n this.categoryStore.setCategories(categories)\n }\n\n if (transactions) {\n this.transactionStore.setTransactions(transactions)\n }\n\n if (transactionRules) {\n this.transactionStore.setTransactionRules(transactionRules)\n }\n\n if (merchantBudgets) {\n this.budgetsStore.setMerchantBudgets(merchantBudgets)\n }\n }\n}\n","import { makeAutoObservable, reaction } from 'mobx'\n\nimport { addMonths } from 'date-fns/addMonths'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { getMonth } from 'date-fns/getMonth'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport { Account } from '../types'\n\nimport type { GlobalStore } from './GlobalStore'\n\nexport class GlobalUiStore {\n globalStore: GlobalStore\n\n accountFilterMap: Map<string, boolean> = new Map()\n\n displayedDate = new Date()\n displayedDateRange = {\n start: startOfMonth(this.displayedDate),\n end: endOfMonth(this.displayedDate),\n }\n\n constructor(globalStore: GlobalStore) {\n makeAutoObservable(this)\n this.globalStore = globalStore\n\n reaction(\n () => this.globalStore.accountStore.visibleAccounts,\n (visibleAccounts) => {\n this.populateAccountFilterMap(visibleAccounts)\n },\n )\n }\n\n get allSelectedAccounts() {\n return this.globalStore.accountStore.detailedAccounts.filter(\n (account: Account) => !account.is_excluded_from_accounts,\n )\n }\n\n get selectedAccounts() {\n return this.globalStore.accountStore.visibleAccounts.filter(\n (account: Account) => !account.is_excluded_from_accounts,\n )\n }\n\n get selectedAccountGuids() {\n return this.selectedAccounts.map((account) => account.guid)\n }\n\n get isCopyLoaded() {\n return this.globalStore.copyStore.isInitialized\n }\n\n get isConfigLoaded() {\n return this.globalStore.appDataStore.isAppDataLoaded\n }\n\n get areUserFeaturesLoaded() {\n return this.globalStore.userStore.userFeaturesLoaded\n }\n\n get isInitialized() {\n return this.isCopyLoaded && this.isConfigLoaded && this.areUserFeaturesLoaded\n }\n\n populateAccountFilterMap = (accounts: Account[]) => {\n if (accounts) {\n accounts.forEach((account) => {\n this.accountFilterMap.set(account.guid, !account.is_excluded_from_accounts)\n })\n }\n }\n\n resetAccountFilterMap = () => {\n this.accountFilterMap.clear()\n this.populateAccountFilterMap(this.globalStore.accountStore.visibleAccounts)\n }\n\n updateAccountFilterMap = (guid: string, isIncluded: boolean) => {\n this.accountFilterMap.set(guid, isIncluded)\n }\n\n setDisplayedDate = (startDate: Date, endDate: Date) => {\n this.displayedDate = endDate\n this.displayedDateRange = {\n start: startDate,\n end: endDate,\n }\n }\n\n get shouldDisableNextDate() {\n const selectedMonth = getMonth(this.displayedDate)\n const nextMonth = getMonth(addMonths(new Date(), 1))\n\n return selectedMonth === nextMonth\n }\n\n get shouldDisablePrevDate() {\n const selectedMonth = getMonth(this.displayedDate)\n const currentMonth = getMonth(new Date())\n\n return selectedMonth === currentMonth\n }\n}\n","import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { GlobalCopyApi } from '../api'\nimport { GlobalCopy } from '../types'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class GlobalCopyStore {\n globalStore: GlobalStore\n api: GlobalCopyApi = new GlobalCopyApi('/', '')\n\n copy: GlobalCopy = {} as GlobalCopy\n featureNamespace = 'experiences'\n\n isInitialized = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new GlobalCopyApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n globalStore.onCaptureException,\n )\n\n makeAutoObservable(this)\n }\n\n loadCopy = async () => {\n await this.getCopy(this.featureNamespace)\n\n runInAction(() => {\n this.isInitialized = true\n })\n }\n\n getCopy = async (namespace: string, translationKey: string = '') => {\n try {\n const newCopy = await this.api.getGlobalCopy(namespace, translationKey)\n\n runInAction(() => {\n this.copy = newCopy[namespace]\n })\n } catch (error) {\n console.error(`Error occurred while fetching ${this.featureNamespace} copy: ${error}`)\n this.globalStore.captureException(error, { store: 'GlobalCopyStore' })\n }\n }\n}\n","import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { GoalApi } from '../api'\n\nimport {\n type Goal,\n type MonthlyCashFlowProfile,\n type RetirementGoalAccount,\n TrackType,\n} from '../types'\nimport { getProjectedRetirementDate } from '../utils/GoalsUtil'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class GoalStore {\n globalStore: GlobalStore\n api = new GoalApi('/', '')\n\n goals: Goal[] = []\n goalsLoaded: boolean = false\n retirementGoals: Goal[] = []\n retirementGoalsLoaded: boolean = false\n retirementGoalAccounts: RetirementGoalAccount[] = []\n retirementGoalAccountsLoaded: boolean = false\n monthlyCashFlowProfile: MonthlyCashFlowProfile | undefined = undefined\n monthlyCashFlowProfileLoaded: boolean = false\n\n newRetirementGoalAccounts: RetirementGoalAccount[] = []\n\n alert: string = ''\n selectedGoal: Goal | undefined = undefined\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new GoalApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n globalStore.onCaptureException,\n )\n\n makeAutoObservable(this)\n }\n\n get allGoals(): Goal[] {\n if (!this.isAllGoalDataLoaded) return []\n\n const goalsCopy = this.globalStore.copyStore.copy.goals\n const userBirthday = this.globalStore.userStore.user.birthday\n return [\n ...this.goals,\n ...this.retirementGoals.map((goal: Goal) => ({\n ...goal,\n amount: goal.target_amount,\n name: goalsCopy.retirement,\n track_type: TrackType.RETIREMENT_TRACK,\n projected_to_complete_at:\n goal.retirement_age && userBirthday\n ? getProjectedRetirementDate(goal.retirement_age, userBirthday)\n : undefined,\n })),\n ] as Goal[]\n }\n\n get orderedGoals(): Goal[] {\n return this.allGoals.slice().sort((a, b) => a.position - b.position)\n }\n\n get debtGoals() {\n return this.orderedGoals.filter((goal) => goal.track_type === TrackType.DEBT_TRACK)\n }\n\n get retirmentGoals() {\n return this.orderedGoals.filter((goal) => goal.track_type === TrackType.RETIREMENT_TRACK)\n }\n\n get savingGoals() {\n return this.orderedGoals.filter((goal) => goal.track_type === TrackType.SAVINGS_TRACK)\n }\n\n get ongoingGoalsForMicroWidget() {\n const ongoingGoals = this.allGoals.filter(\n (goal) =>\n !goal.is_complete &&\n goal.track_type !== TrackType.EMERGENCY_FUND_TRACK &&\n goal.track_type !== null,\n )\n const priorityOrder = [\n TrackType.SAVINGS_TRACK,\n TrackType.DEBT_TRACK,\n TrackType.RETIREMENT_TRACK,\n ]\n return ongoingGoals\n .sort((a, b) => {\n const aIndex = a.track_type ? priorityOrder.indexOf(a.track_type) : -1\n const bIndex = b.track_type ? priorityOrder.indexOf(b.track_type) : -1\n return aIndex - bIndex\n })\n .slice(0, 3)\n }\n\n get isAllGoalDataLoaded() {\n return (\n this.goalsLoaded &&\n this.retirementGoalsLoaded &&\n this.retirementGoalAccountsLoaded &&\n this.monthlyCashFlowProfileLoaded\n )\n }\n\n setGoals = (goals: Goal[]) => {\n this.goals = goals\n this.goalsLoaded = true\n }\n\n setRetirementGoals = (goals: Goal[]) => {\n this.retirementGoals = goals\n this.retirementGoalsLoaded = true\n }\n\n setRetirementGoalAccounts = (accounts: RetirementGoalAccount[]) => {\n this.retirementGoalAccounts = accounts\n this.retirementGoalAccountsLoaded = true\n }\n\n setMonthlyCashFlowProfile = (profile: MonthlyCashFlowProfile) => {\n this.monthlyCashFlowProfile = profile\n this.monthlyCashFlowProfileLoaded = true\n }\n\n loadGoalData = async () => {\n await Promise.all([\n this.loadGoals(),\n this.loadRetirementGoals(),\n this.loadRetirementGoalAccounts(),\n this.loadMonthlyCashFlowProfile(),\n ])\n }\n\n loadGoals = async () => {\n try {\n const goals = await this.api.getGoals()\n this.setGoals(goals)\n } catch (error) {\n console.error(`Error occured while getting goals: ${error}`)\n this.globalStore.captureException(error, { store: 'GoalStore' })\n }\n }\n\n loadRetirementGoals = async () => {\n try {\n const retirementGoals = await this.api.getRetirementGoals()\n this.setRetirementGoals(retirementGoals)\n } catch (error) {\n console.error(`Error occurred while loading retirement goals: ${error}`)\n this.globalStore.captureException(error, { store: 'GoalStore' })\n }\n }\n\n loadRetirementGoalAccounts = async () => {\n try {\n const retirementGoalAccounts = await this.api.getRetirementGoalAccounts()\n this.setRetirementGoalAccounts(retirementGoalAccounts)\n } catch (error) {\n console.error(`Error occurred while loading retirement goal accounts: ${error}`)\n this.globalStore.captureException(error, { store: 'GoalStore' })\n }\n }\n\n loadMonthlyCashFlowProfile = async () => {\n try {\n const monthlyCashFlowProfile = await this.api.getMonthlyCashFlowProfile()\n this.setMonthlyCashFlowProfile(monthlyCashFlowProfile)\n } catch (error) {\n console.error(`Error occurred while loading monthly cash flow profile: ${error}`)\n this.globalStore.captureException(error, { store: 'GoalStore' })\n }\n }\n\n addGoal = async (goal: Goal) => {\n try {\n const newGoal = await this.api.addGoal(goal)\n this.setGoals([...this.goals, newGoal])\n } catch (error) {\n console.error(`Error occurred while adding goal: ${error}`)\n this.globalStore.captureException(error, { store: 'GoalStore' })\n }\n }\n\n addRetirementGoal = async (goal: Goal) => {\n const goalsCopy = this.globalStore.copyStore.copy.goals\n try {\n const newGoal: Goal = await this.api.addRetirementGoal(goal)\n const newAccounts = [] as RetirementGoalAccount[]\n const userBirthday = this.globalStore.userStore.user.birthday\n for (const account of this.newRetirementGoalAccounts) {\n const newAccount = await this.api.addRetirementGoalAccount({\n ...account,\n retirement_goal_guid: newGoal.guid,\n })\n newAccounts.push(newAccount)\n }\n this.setNewRetirementGoalAccounts([])\n\n this.retirementGoals = [\n ...this.retirementGoals,\n {\n ...newGoal,\n amount: newGoal.target_amount,\n name: goalsCopy.retirement,\n track_type: TrackType.RETIREMENT_TRACK,\n projected_to_complete_at:\n newGoal.retirement_age && userBirthday\n ? getProjectedRetirementDate(newGoal.retirement_age, userBirthday)\n : undefined,\n } as Goal,\n ]\n this.setRetirementGoalAccounts([...this.retirementGoalAccounts, ...newAccounts])\n } catch (error) {\n console.error(`Error occurred while adding retirement goal: ${error}`)\n this.globalStore.captureException(error, { store: 'GoalStore' })\n }\n }\n\n addRetirementGoalAccount = async (account: RetirementGoalAccount) => {\n try {\n const newAccount = await this.api.addRetirementGoalAccount(account)\n\n runInAction(() => {\n this.retirementGoalAccounts = [...this.retirementGoalAccounts, newAccount]\n })\n } catch (error) {\n console.error(`Error occurred while adding retirement goal account: ${error}`)\n this.globalStore.captureException(error, { store: 'GoalStore' })\n }\n }\n\n deleteGoal = async (guid: string) => {\n try {\n await this.api.removeGoal(guid)\n\n const index = this.goals.findIndex((g) => g.guid === guid)\n if (index >= 0) {\n this.goals.splice(index, 1)\n }\n } catch (error) {\n console.error(`Error occured while deleting goal: ${error}`)\n this.globalStore.captureException(error, { store: 'GoalStore' })\n }\n }\n\n deleteRetirementGoal = async (goal: Goal) => {\n try {\n const accounts = this.retirementGoalAccounts.filter(\n (g) => g.retirement_goal_guid === goal.guid,\n )\n for (const account of accounts) {\n await this.deleteRetirementGoalAccount(account.guid)\n }\n await this.api.removeRetirementGoal(goal.guid)\n\n const index = this.retirementGoals.findIndex((g) => g.guid === goal.guid)\n if (index >= 0) {\n this.retirementGoals.splice(index, 1)\n }\n } catch (error) {\n console.error(`Error deleting retirement goal: ${error}`)\n this.globalStore.captureException(error, { store: 'GoalStore' })\n }\n }\n\n deleteRetirementGoalAccount = async (guid: string) => {\n try {\n await this.api.removeRetirementGoalAccount(guid)\n\n const index = this.retirementGoalAccounts.findIndex((rga) => rga.guid === guid)\n if (index >= 0) {\n this.retirementGoalAccounts.splice(index, 1)\n }\n } catch (error) {\n console.error(`Error deleting retirement goal account: ${error}`)\n this.globalStore.captureException(error, { store: 'GoalStore' })\n }\n }\n\n reorderGoals = async (goals: Goal[]) => {\n try {\n const reordered = (await this.api.reorderGoals(goals)) as Goal[]\n\n runInAction(() => {\n for (const goal of reordered) {\n const index = this.goals.findIndex((g) => g.guid === goal.guid)\n if (index >= 0) {\n this.goals[index].position = goal.position\n }\n }\n })\n } catch (error) {\n console.error(`Error reordering goals: ${error}`)\n this.globalStore.captureException(error, { store: 'GoalStore' })\n }\n }\n\n setAlert = (alert: string) => (this.alert = alert)\n\n setNewRetirementGoalAccounts = (accounts: RetirementGoalAccount[]) => {\n this.newRetirementGoalAccounts = accounts\n }\n\n setSelectedGoal = (goal: Goal | undefined) => (this.selectedGoal = goal)\n\n updateGoal = async (goal: Goal) => {\n try {\n const updatedGoal = await this.api.updateGoal(goal)\n\n runInAction(() => {\n const index = this.goals.findIndex((g) => g.guid === goal.guid)\n if (index >= 0) {\n this.goals[index] = updatedGoal\n }\n if (this.selectedGoal?.guid === goal.guid) {\n this.setSelectedGoal(updatedGoal)\n }\n })\n } catch (error) {\n console.error(`Error occurred while updating goal: ${error}`)\n this.globalStore.captureException(error, { store: 'GoalStore' })\n }\n }\n\n updateRetirementGoal = async (goal: Goal) => {\n try {\n const updatedRetirementGoal = await this.api.updateRetirementGoal({\n ...goal,\n target_amount: goal.amount,\n })\n\n runInAction(() => {\n const index = this.retirementGoals.findIndex((g) => g.guid === goal.guid)\n if (index >= 0) {\n this.retirementGoals[index] = updatedRetirementGoal\n }\n\n if (this.selectedGoal?.guid === goal.guid) {\n this.setSelectedGoal(this.allGoals.find((g) => g.guid === goal.guid))\n }\n })\n } catch (error) {\n console.error(`Error occurred while updating goal: ${error}`)\n this.globalStore.captureException(error, { store: 'GoalStore' })\n }\n }\n\n updateMonthlyCashFlowProfile = async (profile: MonthlyCashFlowProfile) => {\n try {\n const updatedProfile = await this.api.updateMonthlyCashFlowProfile(profile)\n this.setMonthlyCashFlowProfile(updatedProfile)\n } catch (error) {\n console.error(`Error occurred while updating monthly Cash Flow profile: ${error}`)\n this.globalStore.captureException(error, { store: 'GoalStore' })\n }\n }\n}\n","import type { HelpCategory, Profile } from '../types/Help'\nimport { CategoryList } from '../types/localization/HelpCopy'\nimport { HELP_CATEGORIES } from '../constants/Help'\n\nconst isCategoryAccessibleByProfile = (category: HelpCategory, profile: Profile): boolean => {\n if (category.guid === 'general' || category.guid === 'insights') return true\n if (!category.flags) return false\n return category.flags.every((flag) => profile[flag as keyof Profile])\n}\n\nexport const HelpUtil = (profile: Profile, categoryList: CategoryList): HelpCategory[] => {\n const accessibleCategories: HelpCategory[] = []\n\n for (const el of HELP_CATEGORIES) {\n const category = categoryList[el.guid as keyof CategoryList]\n if (!category) continue\n\n const updatedCategory = {\n ...el,\n title: category.label,\n topics: el.topics.map(({ topicKey }, index) => ({\n topicKey,\n label: category.topics[index],\n })),\n }\n if (isCategoryAccessibleByProfile(updatedCategory, profile))\n accessibleCategories.push(updatedCategory)\n }\n\n return accessibleCategories\n}\n","import { makeAutoObservable } from 'mobx'\n\nimport { HelpApi } from '../api'\nimport type { Config, HelpCopy, HelpAlertProps, Ticket } from '../types'\nimport { HelpUtil } from '../utils/HelpUtil'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class HelpStore {\n alert: HelpAlertProps = { message: '', severity: undefined }\n api = new HelpApi('/', '')\n appConfig: Config | undefined\n globalStore: GlobalStore\n isLoading: boolean = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new HelpApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n globalStore.onCaptureException,\n )\n\n makeAutoObservable(this)\n }\n\n createSupportTicket = async (ticket: Ticket) => {\n try {\n this.isLoading = true\n await this.api.createSupportTicket(ticket)\n this.setAlert(this.copy.request_support_submit_success_message, 'success')\n } catch (error) {\n this.setAlert(this.copy.request_support_submit_failure_message, 'error')\n console.error(`Error occurred while submitting:`, error)\n this.globalStore.captureException(error, { store: 'HelpStore' })\n } finally {\n this.isLoading = false\n }\n }\n\n setAlert = (message: string, severity: HelpAlertProps['severity'] = undefined) =>\n (this.alert = { message, severity })\n\n get copy(): HelpCopy {\n return this.globalStore.copyStore.copy.help\n }\n\n get helpCategories() {\n const { client_communication_profile, client_profile } = this.globalStore.appDataStore.appData\n\n const {\n help: { category_list },\n } = this.globalStore.copyStore.copy\n\n return HelpUtil(\n {\n ...client_communication_profile,\n ...client_profile,\n ...this.globalStore.appConfig.config,\n },\n category_list,\n )\n }\n}\n","import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { HoldingApi } from '../api'\nimport { AnalysisType } from '../constants/Investments'\nimport { type Holding } from '../types'\nimport {\n analysisChartData,\n analysisDetailsData,\n mapDataToPercentageGrid,\n} from '../utils/InvestmentUtil'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class HoldingStore {\n analysisType: AnalysisType = AnalysisType.Stocks\n api = new HoldingApi('/', '')\n holdings: Holding[] = []\n holdingsLoaded = false\n globalStore: GlobalStore\n showConnectionsWidget = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new HoldingApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n globalStore.onCaptureException,\n )\n\n makeAutoObservable(this)\n }\n\n get analysisChartData() {\n return mapDataToPercentageGrid(analysisChartData(this.visibleHoldings), this.analysisType)\n }\n\n get analysisDetails() {\n return analysisDetailsData(this.visibleHoldings)[this.analysisType] || {}\n }\n\n get visibleHoldings() {\n return this.holdings.filter((holding) =>\n this.globalStore.globalUiStore.selectedAccountGuids.includes(holding.account_guid),\n )\n }\n\n setHoldings = (holdings: Holding[]) => {\n this.holdings = holdings\n this.holdingsLoaded = true\n }\n\n setShowConnectionsWidget = (value: boolean) => {\n this.showConnectionsWidget = value\n }\n\n loadHoldings = async () => {\n try {\n const holdings = await this.api.getHoldings()\n this.setHoldings(holdings)\n } catch (error) {\n console.error(`Error occured while getting holdings: ${error}`)\n this.globalStore.captureException(error, { store: 'HoldingStore' })\n }\n }\n\n setAnalysisType = (analysisType: AnalysisType) => {\n this.analysisType = analysisType\n }\n\n updateHoldings = async (holding: Holding) => {\n this.holdingsLoaded = false\n try {\n const updatedHolding = await this.api.updateHoldings(holding)\n const updatedIndex = this.holdings.findIndex(({ guid }) => guid === holding.guid)\n\n if (updatedIndex >= 0) {\n const holdings = [...this.holdings]\n holdings[updatedIndex] = updatedHolding\n\n runInAction(() => {\n this.holdings = holdings\n this.holdingsLoaded = true\n })\n }\n } catch (error) {\n console.error(`Error occurred while updating holding: ${error}`)\n this.globalStore.captureException(error, { store: 'HoldingStore' })\n }\n }\n}\n","import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { MerchantApi } from '../api'\nimport type { Merchant } from '../types'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport interface CopyObject {\n [key: string]: string\n}\n\nexport class MerchantStore {\n globalStore: GlobalStore\n api: MerchantApi = new MerchantApi('/', '')\n\n merchant: Merchant | null = null\n merchants: Merchant[] = []\n isLoading = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new MerchantApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n globalStore.onCaptureException,\n )\n\n makeAutoObservable(this)\n }\n\n loadMerchants = async (searchValue = '') => {\n this.isLoading = true\n\n const merchants = await this.api.getMerchants([searchValue])\n\n runInAction(() => {\n this.merchants = merchants\n this.isLoading = false\n })\n }\n\n loadMerchantByGuid = async (guid: string) => {\n const merchant = await this.api.getMerchantByGuid(guid)\n\n runInAction(() => (this.merchant = merchant))\n }\n}\n","import { makeAutoObservable } from 'mobx'\n\nimport { AccountApi } from '../api'\nimport type {\n Account,\n AssetsLiabilities,\n DetailedAccount,\n GainsLosses,\n MonthlyAccountBalance,\n NetWorth,\n NetWorthData,\n} from '../types'\nimport {\n filterAccounts,\n flattenBalances,\n buildAssetsLiabilities,\n buildChartData,\n buildGainsLosses,\n getLatestNetWorthData,\n sortByYearMonthAscending,\n} from '../utils/NetWorthUtils'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class NetWorthStore {\n globalStore: GlobalStore\n accountsApi: AccountApi = new AccountApi('/', '')\n\n monthlyAccountBalances: MonthlyAccountBalance[] = []\n monthlyAccountBalancesLoaded: boolean = false\n hoveredIndex: number = -1\n selectedIndex: number = -1\n timeframe: number = 6 // default timeframe is 6 months\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.accountsApi = new AccountApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n globalStore.onCaptureException,\n )\n makeAutoObservable(this)\n }\n\n get isNetWorthDataLoaded(): boolean {\n return this.globalStore.accountStore.isAccountDataLoaded && this.monthlyAccountBalancesLoaded\n }\n\n get netWorthAccounts(): DetailedAccount[] {\n return filterAccounts(\n this.globalStore.globalUiStore.selectedAccounts,\n this.globalStore.accountStore.members,\n )\n }\n\n get netWorthData(): NetWorthData {\n return {\n accounts: this.netWorthAccounts,\n monthlyAccountBalances: this.monthlyAccountBalances,\n }\n }\n\n get netWorthChartData(): NetWorth[] {\n return buildChartData(this.netWorthAccounts, this.monthlyAccountBalances, this.timeframe)\n }\n\n get selectedData(): NetWorth | undefined {\n if (!this.netWorthChartData || this.netWorthChartData.length === 0) return undefined\n return this.selectedIndex === -1\n ? getLatestNetWorthData(this.netWorthChartData)\n : this.netWorthChartData[this.selectedIndex]\n }\n\n get hoveredData(): NetWorth | undefined {\n return this.hoveredIndex >= 0 ? this.netWorthChartData[this.hoveredIndex] : undefined\n }\n\n get gainsLosses(): GainsLosses {\n return buildGainsLosses(this.selectedData)\n }\n\n get assetsLiabilities(): AssetsLiabilities {\n const { assets, liabilities, totalAssets, totalLiabilities } = buildAssetsLiabilities(\n this.netWorthData.accounts,\n )\n return {\n netWorth: getLatestNetWorthData(this.netWorthChartData),\n assets,\n liabilities,\n totalAssets,\n totalLiabilities,\n }\n }\n\n loadNetWorthData = async () => {\n if (!this.globalStore.accountStore.isAccountDataLoaded) {\n await this.globalStore.accountStore.loadAccountData()\n }\n\n const accountBalances = await Promise.all(\n this.netWorthAccounts.map((account: Account) => this.getMonthlyAccountBalances(account.guid)),\n )\n\n const monthlyAccountBalances = accountBalances\n .reduce(flattenBalances, [])\n .sort(sortByYearMonthAscending)\n\n this.setMonthlyAccountBalances(monthlyAccountBalances)\n }\n\n getMonthlyAccountBalances = async (accountGuid: string) => {\n try {\n const balances = await this.accountsApi.getMonthlyAccountBalances(accountGuid)\n return balances as MonthlyAccountBalance[]\n } catch (error) {\n console.error(`Error occured while fetching monthly account balances: ${error}`)\n this.globalStore.captureException(error, { store: 'NetWorthStore' })\n return []\n }\n }\n\n setHoveredIndex = (index: number) => (this.hoveredIndex = index)\n\n setMonthlyAccountBalances = (balances: MonthlyAccountBalance[]) => {\n this.monthlyAccountBalances = balances\n this.monthlyAccountBalancesLoaded = true\n }\n\n setSelectedIndex = (index: number) => (this.selectedIndex = index)\n setTimeframe = (months: number) => (this.timeframe = months)\n}\n","import { makeAutoObservable, observable, runInAction } from 'mobx'\n\nimport { NotificationApi } from '../api'\nimport { type Notification } from '../types'\nimport { filterRecentNotifications } from '../utils/NotificationUtils'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class NotificationStore {\n globalStore: GlobalStore\n api = new NotificationApi('/', '')\n\n isLoading: boolean = true\n notifications: Notification[] = []\n notificationsLoaded: boolean = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new NotificationApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n globalStore.onCaptureException,\n )\n\n makeAutoObservable(this, { notifications: observable })\n }\n\n // Used in Money Dashboard\n get newNotifications(): Notification[] {\n return this.recentNotifications.filter((n) => !n.has_been_viewed)\n }\n\n get recentNotifications(): Notification[] {\n return filterRecentNotifications(this.notifications)\n }\n\n setNotifications = (notifications: Notification[]) => {\n this.notifications = notifications\n this.notificationsLoaded = true\n }\n\n loadNotifications = async () => {\n this.isLoading = true\n try {\n const notifications = await this.api.getNotifications()\n this.setNotifications(notifications)\n } catch (error) {\n console.error(`Error occurred while loading notifications: ${error}`)\n this.globalStore.captureException(error, { store: 'NotificationStore' })\n } finally {\n runInAction(() => {\n this.isLoading = false\n })\n }\n }\n\n markAllAsViewed = async () => {\n // Update on the server\n await this.api.markAllAsViewed()\n }\n\n updateNotification = async (notification: Notification) => {\n notification.has_been_viewed = true\n await this.api.updateNotification(notification)\n }\n}\n","import { type AlertProps } from '@mui/material'\nimport { makeAutoObservable, runInAction } from 'mobx'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { isAfter } from 'date-fns/isAfter'\nimport { isBefore } from 'date-fns/isBefore'\nimport { isSameDay } from 'date-fns/isSameDay'\nimport { isWithinInterval } from 'date-fns/isWithinInterval'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { startOfToday } from 'date-fns/startOfToday'\nimport { subDays } from 'date-fns/subDays'\n\nimport { RepeatingTransactionsApi } from '../api'\nimport {\n type Recurrence,\n type RecurringCopy,\n type RepeatingTransaction,\n type Transaction,\n RecurrenceStatus,\n RecurrenceType,\n type DateRange,\n} from '../types'\nimport {\n augmentRepeatingTransactions,\n buildAllRecurrences,\n} from '../utils/RecurringTransactionsUtil'\n\nimport { GlobalStore } from './GlobalStore'\n\nconst currentMonthFilter = (date: DateRange, recurrence: Recurrence) =>\n isWithinInterval(recurrence.expectedDate, date)\n\nconst recurrenceTotalReducer = (total: number, recurrence: Recurrence) => total + recurrence.amount\n\ninterface RecurringAlertProps {\n message: string\n severity: AlertProps['severity']\n}\n\nexport class RecurringTransactionsStore {\n globalStore: GlobalStore\n api = new RepeatingTransactionsApi('/', '')\n\n repeatingTransactions: RepeatingTransaction[] = []\n isDataLoaded: boolean = false\n\n selectedDay: Date | undefined\n dateRange: DateRange = { start: startOfMonth(startOfToday()), end: endOfMonth(startOfToday()) }\n selectedRepeatingTransactionGuid: string | null = null\n selectedRecurrence: Recurrence | null = null\n\n alert: RecurringAlertProps = { message: '', severity: undefined }\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new RepeatingTransactionsApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n )\n\n // The *ForRange helpers are parameterized computeds: they must stay plain\n // methods (not actions) so observable reads inside them remain tracked when\n // invoked from an observer/derivation. makeAutoObservable would otherwise\n // annotate them as actions, which do not track reads.\n makeAutoObservable(this, {\n recurrencesForRange: false,\n upcomingExpensesForRange: false,\n upcomingIncomeForRange: false,\n incomeForRange: false,\n nextIncomeForRange: false,\n })\n }\n\n get copy(): RecurringCopy {\n return this.globalStore.copyStore.copy.recurring\n }\n\n get detailedRepeatingTransactions(): RepeatingTransaction[] {\n return augmentRepeatingTransactions(\n this.globalStore.accountStore.visibleAccounts,\n this.repeatingTransactions,\n this.globalStore.transactionStore.transactions,\n )\n }\n\n /**\n * Returns all recurrences built from repeating transactions and filtered by\n * accounts, scoped to the supplied date range. This is the range-parameterized\n * core used by both the shared getters (which pass this.dateRange) and by\n * consumers such as Cash Flow that need their own independent window without\n * mutating the shared dateRange.\n */\n recurrencesForRange = (dateRange: DateRange): Recurrence[] => {\n const accounts = this.globalStore.accountStore.visibleAccounts\n\n return buildAllRecurrences(this.detailedRepeatingTransactions, dateRange)\n .filter((r) => accounts.some((a) => a.guid === r.accountGuid && !a.is_excluded_from_accounts))\n .filter((r) => isWithinInterval(r.expectedDate, dateRange))\n }\n\n /**\n * Returns the upcoming expense recurrences scoped to the supplied date range.\n */\n upcomingExpensesForRange = (dateRange: DateRange): Recurrence[] => {\n return this.recurrencesForRange(dateRange).filter(\n (recurrence: Recurrence) =>\n recurrence.type === RecurrenceType.Expense &&\n recurrence.status === RecurrenceStatus.Upcoming,\n )\n }\n\n /**\n * Returns the income recurrences scoped to the supplied date range.\n */\n incomeForRange = (dateRange: DateRange): Recurrence[] => {\n return this.recurrencesForRange(dateRange).filter(\n (recurrence: Recurrence) => recurrence.type === RecurrenceType.Income,\n )\n }\n\n /**\n * Returns the upcoming income recurrences scoped to the supplied date range.\n */\n upcomingIncomeForRange = (dateRange: DateRange): Recurrence[] => {\n return this.incomeForRange(dateRange).filter(\n (recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Upcoming,\n )\n }\n\n /**\n * Returns the next upcoming income recurrence scoped to the supplied range.\n */\n nextIncomeForRange = (dateRange: DateRange): Recurrence | undefined => {\n return this.upcomingIncomeForRange(dateRange).find((r) =>\n isAfter(r.expectedDate, startOfToday()),\n )\n }\n\n /**\n * Returns all recurrences built from repeating transactions and filtered by accounts.\n */\n get recurrences(): Recurrence[] {\n return this.recurrencesForRange(this.dateRange)\n }\n\n /**\n * Returns all recurrences that have occurred in the past, including those that are paid or missed\n */\n get pastRecurrences(): Recurrence[] {\n return this.recurrences.filter(\n (recurrence: Recurrence) =>\n recurrence.status === RecurrenceStatus.Paid ||\n recurrence.status === RecurrenceStatus.Missed,\n )\n }\n\n /**\n * Returns all recurrences that are expected to occur through the end of the month\n * or should have occurred in the last 3 days.\n */\n get upcomingRecurrences(): Recurrence[] {\n return this.recurrences.filter(\n (r) =>\n isAfter(r.expectedDate, subDays(startOfToday(), 3)) &&\n isBefore(r.expectedDate, this.dateRange.end) &&\n r.status === RecurrenceStatus.Upcoming,\n )\n }\n\n /**\n * Returns all expense recurrences.\n */\n get expenses(): Recurrence[] {\n return this.recurrences.filter(\n (recurrence: Recurrence) => recurrence.type === RecurrenceType.Expense,\n )\n }\n\n /**\n * Returns the upcoming expense recurrences.\n */\n get upcomingExpenses(): Recurrence[] {\n return this.expenses.filter(\n (recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Upcoming,\n )\n }\n\n /**\n * Returns all income recurrences.\n */\n get income(): Recurrence[] {\n return this.recurrences.filter(\n (recurrence: Recurrence) => recurrence.type === RecurrenceType.Income,\n )\n }\n\n /**\n * Returns the upcoming income recurrences.\n */\n get upcomingIncome(): Recurrence[] {\n return this.income.filter(\n (recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Upcoming,\n )\n }\n\n get nextIncomeRecurrence() {\n return this.upcomingIncome.find((r) => isAfter(r.expectedDate, startOfToday()))\n }\n\n /**\n * Returns the expense recurrences for the current month.\n */\n get currentMonthExpenses(): Recurrence[] {\n return this.expenses.filter((recurrence: Recurrence) =>\n currentMonthFilter(this.dateRange, recurrence),\n )\n }\n\n /**\n * Returns the income recurrences for the current month.\n */\n get currentMonthIncome(): Recurrence[] {\n return this.income.filter((recurrence: Recurrence) =>\n currentMonthFilter(this.dateRange, recurrence),\n )\n }\n\n /**\n * Calculates the total amount of all expenses for the current month.\n */\n get expenseTotal(): number {\n return this.currentMonthExpenses.reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Calculates the total amount of all paid expenses for the current month.\n */\n get paidExpenseTotal(): number {\n return this.currentMonthExpenses\n .filter((recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Paid)\n .reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Calculates the total amount of all missed expenses for the current month.\n */\n get missedExpenseTotal(): number {\n return this.currentMonthExpenses\n .filter((recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Missed)\n .reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Calculates the total amount of all upcoming expenses for the current month.\n */\n get upcomingExpenseTotal(): number {\n return this.currentMonthExpenses\n .filter((recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Upcoming)\n .reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Calculates the total amount of all income for the current month.\n */\n get incomeTotal(): number {\n return this.currentMonthIncome.reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Calculates the total amount of all paid income for the current month.\n */\n get paidIncomeTotal(): number {\n return this.currentMonthIncome\n .filter((recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Paid)\n .reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Calculates the total amount of all upcoming income for the current month.\n */\n get upcomingIncomeTotal(): number {\n return this.currentMonthIncome\n .filter((recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Upcoming)\n .reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Get the recurrences for the currently selected day.\n */\n get selectedDayRecurrences(): Recurrence[] | undefined {\n return (\n this.selectedDay &&\n this.recurrences.filter(\n (recurrence: Recurrence) =>\n this.selectedDay &&\n isSameDay(recurrence.occurredOnDate || recurrence.expectedDate, this.selectedDay),\n )\n )\n }\n\n get selectedRepeatingTransaction(): RepeatingTransaction | undefined {\n return this.selectedRepeatingTransactionGuid\n ? this.detailedRepeatingTransactions.find(\n (rt) => rt.guid === this.selectedRepeatingTransactionGuid,\n )\n : undefined\n }\n\n setSelectedRepeatingTransactionGuid = (guid: string | null) =>\n (this.selectedRepeatingTransactionGuid = guid)\n\n setSelectedRecurrence = (recurrence: Recurrence | null) => (this.selectedRecurrence = recurrence)\n\n setRepeatingTransactions = (repeating: RepeatingTransaction[]) => {\n this.repeatingTransactions = repeating\n this.isDataLoaded = true\n }\n\n /**\n * Set the date range for filtering recurrences.\n * @param dateRange - The date range to set.\n */\n setDateRange = (dateRange: DateRange) => (this.dateRange = dateRange)\n\n /**\n * Set the currently selected day.\n * @param day - The day to select.\n */\n setSelectedDay = (day: Date) => {\n this.selectedDay = this.selectedDay && isSameDay(day, this.selectedDay) ? undefined : day\n }\n\n loadRepeatingTransactionData = async () => {\n await Promise.all([\n this.globalStore.accountStore.loadAccountData(),\n this.globalStore.categoryStore.loadCategories(),\n this.globalStore.transactionStore.loadTransactionData(),\n ])\n await this.loadRepeatingTransactions()\n }\n\n /**\n * Load repeating transactions and augment them with additional data.\n */\n loadRepeatingTransactions = async () => {\n try {\n const repeatingTransactions = await this.api.getRepeatingTransactions()\n this.setRepeatingTransactions(repeatingTransactions)\n } catch (error) {\n console.error(`Error occurred while getting repeating transactions: ${error}`)\n this.globalStore.captureException(error, { store: 'RecurringTransactionsStore' })\n }\n }\n\n /**\n * Add a new repeating transaction and link it to the associated transaction.\n * @param repeatingTransaction - The repeating transaction to add.\n * @param transaction - The transaction associated with the repeating transaction.\n */\n addRepeatingTransaction = async (\n repeatingTransaction: RepeatingTransaction,\n transaction: Transaction,\n ) => {\n try {\n const newRepeating = await this.api.addRepeatingTransaction(repeatingTransaction)\n\n await this.globalStore.transactionStore.updateTransaction({\n ...transaction,\n repeating_transaction_guid: newRepeating.guid,\n })\n\n runInAction(() => {\n this.repeatingTransactions = [\n ...this.repeatingTransactions,\n ...augmentRepeatingTransactions(\n this.globalStore.accountStore.visibleAccounts,\n [newRepeating],\n this.globalStore.transactionStore.transactions,\n ),\n ]\n })\n } catch (error) {\n console.error(`Error occurred while adding repeating transaction: ${error}`)\n this.globalStore.captureException(error, { store: 'RecurringTransactionsStore' })\n }\n }\n\n /**\n * Delete a repeating transaction by its GUID.\n * @param guid - The GUID of the repeating transaction to delete.\n */\n deleteRepeatingTransaction = async (guid: string) => {\n try {\n await this.api.deleteRepeatingTransaction(guid)\n\n runInAction(() => {\n this.repeatingTransactions = [\n ...this.repeatingTransactions.filter((rt) => rt.guid !== guid),\n ]\n })\n } catch (error) {\n console.error(`Error occurred while deleting repeating transaction: ${error}`)\n this.globalStore.captureException(error, { store: 'RecurringTransactionsStore' })\n }\n }\n\n /**\n * Update an existing repeating transaction.\n * @param transaction - The repeating transaction to update.\n */\n updateRepeatingTransaction = async (transaction: RepeatingTransaction) => {\n try {\n const updatedTransaction = await this.api.updateRepeatingTransaction(transaction)\n\n const index = this.repeatingTransactions.findIndex(\n (rt) => rt.guid === updatedTransaction.guid,\n )\n if (index < 0) return\n\n runInAction(() => {\n this.repeatingTransactions = [\n ...this.repeatingTransactions.slice(0, index),\n ...augmentRepeatingTransactions(\n this.globalStore.accountStore.visibleAccounts,\n [updatedTransaction],\n this.globalStore.transactionStore.transactions,\n ),\n ...this.repeatingTransactions.slice(index + 1),\n ]\n })\n } catch (error) {\n console.error(`Error occurred while updating repeating transaction: ${error}`)\n this.globalStore.captureException(error, { store: 'RecurringTransactionsStore' })\n }\n }\n\n /**\n * Mark a recurrence as paid by linking a transaction to the repeating transaction.\n * @param repeatingTransactionGuid - The GUID of the repeating transaction.\n * @param transaction - The transaction to link.\n */\n markRecurrenceAsPaid = async (repeatingTransactionGuid: string, transaction: Transaction) => {\n try {\n await this.globalStore.transactionStore.updateTransaction({\n ...transaction,\n repeating_transaction_guid: repeatingTransactionGuid,\n })\n\n await this.loadRepeatingTransactions()\n this.setSelectedRecurrence(null)\n this.setAlert(this.copy.link_transaction_success, 'success')\n } catch (error) {\n console.error(`Error occurred while marking recurrence as paid: ${error}`)\n this.globalStore.captureException(error, { store: 'RecurringTransactionsStore' })\n this.setAlert(this.copy.link_transaction_error, 'error')\n }\n }\n\n /**\n * Mark a recurrence as unpaid by unlinking the associated transaction from the repeating transaction.\n * @param transaction - The transaction to unlink.\n */\n markRecurrenceAsUnpaid = async (transaction: Transaction) => {\n try {\n await this.globalStore.transactionStore.updateTransaction({\n ...transaction,\n repeating_transaction_guid: null,\n })\n\n await this.loadRepeatingTransactions()\n this.setSelectedRecurrence(null)\n this.setAlert(this.copy.unlink_transaction_success, 'success')\n } catch (error) {\n console.error(`Error occurred while marking recurrence as unpaid: ${error}`)\n this.globalStore.captureException(error, { store: 'RecurringTransactionsStore' })\n this.setAlert(this.copy.unlink_transaction_error, 'error')\n }\n }\n\n setAlert = (message: string, severity: RecurringAlertProps['severity'] = undefined) =>\n (this.alert = { message, severity })\n}\n","import {\n type Account,\n type ClientCommunicationProfile,\n type DetailedNotificationProfile,\n type NotificationProfile,\n type SettingsCopy,\n type User,\n type UserCommunicationProfile,\n AccountNotificationTypes,\n BudgetNotificationTypes,\n InsightNotificationTypes,\n} from '../types'\n\nconst PARENT_ENTITY = 'PARENT-ENTITY'\n\nconst getProfileLabel = (notificationType: number, copy: SettingsCopy) => {\n const labelMap: Record<number, string> = {\n [BudgetNotificationTypes.BudgetExceeded]: copy.notification_budget_exceeded,\n [BudgetNotificationTypes.BudgetOffTarget]: copy.notification_budget_off_target,\n [AccountNotificationTypes.DebtPaymentReminder]: copy.notification_debt_payment_reminder,\n [AccountNotificationTypes.AccountBalanceLow]: copy.notification_low_balance,\n [AccountNotificationTypes.AccountDepositLargePosted]: copy.notification_large_deposit,\n [AccountNotificationTypes.AccountDepositLarge]: copy.notification_large_deposit,\n [AccountNotificationTypes.TransactionExpenseLarge]: copy.notification_large_expense,\n [AccountNotificationTypes.TransactionFeeCharge]: copy.notification_transaction_fee,\n [AccountNotificationTypes.InternationalTransaction]:\n copy.notification_transaction_is_international,\n [InsightNotificationTypes.AccountBalanceLow]: copy.account_balance_low,\n [InsightNotificationTypes.BillAmountNotStandard]: copy.bill_amount_not_standard,\n [InsightNotificationTypes.CategorySpending]: copy.category_spending,\n [InsightNotificationTypes.CreditCardCloseToLimit]: copy.credit_card_close_to_limit,\n [InsightNotificationTypes.DebtPaymentReminder]: copy.debt_payment_reminder,\n [InsightNotificationTypes.DuplicatePayment]: copy.duplicate_payment,\n [InsightNotificationTypes.MonthlySpendComparison]: copy.monthly_spend_comparison,\n [InsightNotificationTypes.MonthlySpendToIncomeComparison]:\n copy.monthly_spend_to_income_comparison,\n [InsightNotificationTypes.MonthlySubscriptionAggregate]: copy.monthly_subscription_aggregate,\n [InsightNotificationTypes.MonthlyTopMerchantSpending]: copy.monthly_top_merchant_spending,\n [InsightNotificationTypes.SaveAnExtra100Dollars]: copy.save_an_extra_100_dollars,\n [InsightNotificationTypes.SavingsOpportunity]: copy.savings_opportunity,\n [InsightNotificationTypes.SetUpDirectDeposit]: copy.set_up_direct_deposit,\n [InsightNotificationTypes.SwitchDirectDeposit]: copy.switch_direct_deposit,\n [InsightNotificationTypes.UncategorizedTransactions]: copy.uncategorized_transactions,\n [InsightNotificationTypes.UnifiedDeposit]: copy.unified_deposit,\n [InsightNotificationTypes.UpcomingBill]: copy.upcoming_bill,\n [InsightNotificationTypes.WeekendSpendingSummary]: copy.weekend_spending_summary,\n [InsightNotificationTypes.WeeklyNewMerchants]: copy.weekly_new_merchants,\n [InsightNotificationTypes.DiscoveredAccounts]: copy.discovered_account,\n [InsightNotificationTypes.TransactionExpenseLarge]: copy.large_transaction,\n [InsightNotificationTypes.PromotionalCampaignMessages]: copy.promotional_campaign_messages,\n [InsightNotificationTypes.TransparentOverdraft]: copy.transparent_overdraft,\n }\n\n return labelMap[notificationType] || ''\n}\n\nexport const augmentNotificationProfiles = (\n accounts: Account[],\n clientCommunicationsProfile: ClientCommunicationProfile,\n copy: SettingsCopy,\n profiles: NotificationProfile[],\n userCommunicationsProfile: UserCommunicationProfile,\n user: User,\n) => {\n const detailedProfiles = [] as DetailedNotificationProfile[]\n const {\n email_notifications_enabled: clientEmailEnabled,\n sms_notifications_enabled: clientSmsEnabled,\n push_notifications_enabled: clientPushEnabled,\n } = clientCommunicationsProfile\n\n const {\n opted_out_of_email_notifications: userEmailOptedOut,\n opted_out_of_sms_notifications: userSmsOptedOut,\n opted_out_of_push_notifications: userPushOptedOut,\n } = userCommunicationsProfile\n\n for (const profile of profiles.filter((profile) => profile.entity_guid === PARENT_ENTITY)) {\n const label = getProfileLabel(profile.notification_type, copy)\n const children = profiles.filter(\n (child) =>\n child.entity_guid !== PARENT_ENTITY &&\n child.notification_type === profile.notification_type &&\n accounts.some((account) => account.guid === child.entity_guid),\n )\n\n const deliveryMethods = [] as string[]\n if (clientEmailEnabled && !userEmailOptedOut && profile.email_channel && user.email) {\n deliveryMethods.push(copy.delivery_method_email_label)\n }\n if (clientSmsEnabled && !userSmsOptedOut && profile.sms_channel && user.phone) {\n deliveryMethods.push(copy.delivery_method_sms_label)\n }\n if (clientPushEnabled && !userPushOptedOut && profile.push_channel) {\n deliveryMethods.push(copy.delivery_method_push_label)\n }\n\n detailedProfiles.push({\n ...profile,\n children: children.map((child) => ({\n ...child,\n account: accounts.find((a) => a.guid === child.entity_guid),\n label,\n })),\n deliveryMethodsLabel: deliveryMethods.join(', '),\n label,\n })\n }\n\n return detailedProfiles\n}\n","import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { AlertProps } from '@mui/material'\n\nimport {\n AccountNotificationTypes,\n BudgetNotificationTypes,\n InsightNotificationTypes,\n} from '../types'\n\nimport type {\n DetailedNotificationProfile,\n Device,\n NotificationProfile,\n SettingsCopy,\n TransactionRule,\n User,\n UserCommunicationProfile,\n} from '../types'\n\nimport { SettingsApi, TransactionApi } from '../api'\nimport { augmentNotificationProfiles } from '../utils/SettingsUtil'\n\nimport { GlobalStore } from './GlobalStore'\n\ninterface SettingsAlertProps {\n message: string\n severity: AlertProps['severity']\n}\n\nexport class SettingsStore {\n globalStore: GlobalStore\n api: SettingsApi = new SettingsApi('/', '')\n transactionApi: TransactionApi = new TransactionApi('/', '')\n\n alert: SettingsAlertProps = { message: '', severity: undefined }\n devices: Device[] = []\n notificationProfiles: NotificationProfile[] = []\n selectedRule: TransactionRule | undefined = undefined\n transactionRules: TransactionRule[] = []\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new SettingsApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n globalStore.onCaptureException,\n )\n this.transactionApi = new TransactionApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n globalStore.onCaptureException,\n )\n\n makeAutoObservable(this)\n }\n\n get accountProfiles() {\n const ccp = this.globalStore.appDataStore.clientCommunicationProfile\n\n // TODO: There has to be a better way to do this, but for now, it works\n return this.detailedNotificationProfiles.filter(\n (np) =>\n (np.notification_type === AccountNotificationTypes.DebtPaymentReminder &&\n ccp.debt_payment_reminder_notifications_enabled) ||\n (np.notification_type === AccountNotificationTypes.AccountBalanceLow &&\n ccp.low_balance_notifications_enabled) ||\n (np.notification_type === AccountNotificationTypes.AccountDepositLarge &&\n ccp.large_deposit_notifications_enabled) ||\n (np.notification_type === AccountNotificationTypes.TransactionExpenseLarge &&\n ccp.large_expense_notifications_enabled) ||\n (np.notification_type === AccountNotificationTypes.TransactionFeeCharge &&\n ccp.transaction_fee_notifications_enabled) ||\n (np.notification_type === AccountNotificationTypes.InternationalTransaction &&\n ccp.transaction_is_international_notifications_enabled) ||\n (np.notification_type === AccountNotificationTypes.AccountDepositLargePosted &&\n ccp.large_deposit_posted_notifications_enabled),\n )\n }\n\n get budgetProfiles() {\n const ccp = this.globalStore.appDataStore.clientCommunicationProfile\n\n // TODO: There has to be a better way to do this, but for now, it works\n return this.detailedNotificationProfiles.filter(\n (np) =>\n (np.notification_type === BudgetNotificationTypes.BudgetExceeded &&\n ccp.budget_exceeded_notifications_enabled) ||\n (np.notification_type === BudgetNotificationTypes.BudgetOffTarget &&\n ccp.budget_off_target_notifications_enabled),\n )\n }\n\n get insightsProfiles() {\n return this.detailedNotificationProfiles.filter((np) =>\n Object.values(InsightNotificationTypes).includes(np.notification_type),\n )\n }\n\n get clientCommunicationProfile() {\n return this.globalStore.appDataStore.clientCommunicationProfile\n }\n\n get copy(): SettingsCopy {\n return this.globalStore.copyStore.copy.settings\n }\n\n get detailedNotificationProfiles(): DetailedNotificationProfile[] {\n // Don't attempt to augment profile if global store is not initialized\n if (!this.globalStore.isInitialized) return []\n\n return augmentNotificationProfiles(\n this.globalStore.accountStore.accounts,\n this.clientCommunicationProfile,\n this.copy,\n this.notificationProfiles,\n this.userCommunicationsProfile,\n this.globalStore.userStore.user,\n )\n }\n\n get userCommunicationsProfile() {\n return this.globalStore.appDataStore.userCommunicationProfile\n }\n\n deleteDevice = async (guid: string) => {\n try {\n await this.api.deleteDevice(guid)\n\n const index = this.devices.findIndex((d) => d.guid === guid)\n if (index >= 0) {\n runInAction(() => {\n this.devices.splice(index, 1)\n })\n }\n\n return { success: true }\n } catch (error) {\n console.error(`Error deleting device: ${guid}`)\n this.globalStore.captureException(error, { store: 'SettingsStore' })\n return { success: false }\n }\n }\n\n deleteTransactionRule = async () => {\n if (!this.selectedRule) {\n return\n }\n this.transactionApi\n .removeTransactionRule(this.selectedRule?.guid)\n .then(() => {\n this.setAlert(this.copy.delete_rule_success, 'success')\n this.loadTransactionRules()\n })\n .catch((error) => {\n this.globalStore.captureException(error, { store: 'SettingsStore' })\n this.setAlert(this.copy.delete_rule_error, 'error')\n })\n }\n\n generateDeviceToken = async () => {\n try {\n return await this.api.generateDeviceToken()\n } catch (error) {\n console.error(`Error generating device token: ${error}`)\n this.globalStore.captureException(error, { store: 'SettingsStore' })\n }\n return undefined\n }\n\n loadDevices = async () => {\n try {\n const devices = await this.api.getDevices()\n\n runInAction(() => {\n this.devices = devices\n })\n } catch (error) {\n console.error(`Error loading devices: ${error}`)\n this.globalStore.captureException(error, { store: 'SettingsStore' })\n }\n }\n\n loadNotificationProfiles = async () => {\n try {\n const profiles = await this.api.getNotificationProfiles()\n\n runInAction(() => {\n this.notificationProfiles = profiles\n })\n } catch (error) {\n console.error(`Error loading notification profiles: ${error}`)\n this.globalStore.captureException(error, { store: 'SettingsStore' })\n }\n }\n\n loadTransactionRules = async () => {\n try {\n const rules = await this.transactionApi.getTransactionRules()\n\n runInAction(() => {\n this.transactionRules = rules\n })\n } catch (error) {\n console.error(`Error loading transaction rules: ${error}`)\n this.globalStore.captureException(error, { store: 'SettingsStore' })\n }\n }\n\n sendEmailVerification = async () => {\n try {\n await this.api.sendEmailVerification()\n this.setAlert(this.copy.verification_sent_success, 'success')\n } catch (error) {\n console.error(`Error sending email verification: ${error}`)\n this.globalStore.captureException(error, { store: 'SettingsStore' })\n this.setAlert(this.copy.verification_sent_error, 'error')\n }\n }\n\n sendPhoneVerification = async () => {\n try {\n await this.api.sendPhoneVerification()\n this.setAlert(this.copy.verification_sent_success, 'success')\n } catch (error) {\n console.error(`Error sending phone verification: ${error}`)\n this.globalStore.captureException(error, { store: 'SettingsStore' })\n this.setAlert(this.copy.verification_sent_error, 'error')\n }\n }\n\n setAlert = (message: string, severity: SettingsAlertProps['severity'] = undefined) =>\n (this.alert = { message, severity })\n\n setSelectedRule = (rule?: TransactionRule) => {\n this.selectedRule = rule\n }\n\n updateDevice = async (device: Device) => {\n try {\n const updatedDevice = await this.api.updateDevice(device)\n\n const index = this.devices.findIndex((d) => d.guid === device.guid)\n if (index >= 0) {\n runInAction(() => {\n this.devices[index] = updatedDevice\n })\n }\n return { success: true }\n } catch (error) {\n console.error(`Error updating device: ${error}`)\n this.globalStore.captureException(error, { store: 'SettingsStore' })\n return { success: false }\n }\n }\n\n updateNotificationProfile = async (profile: NotificationProfile) => {\n try {\n const updatedProfile = await this.api.updateNotificationProfile(profile)\n\n const index = this.notificationProfiles.findIndex((p) => p.guid === profile.guid)\n if (index >= 0) {\n runInAction(() => {\n this.notificationProfiles[index] = updatedProfile\n })\n }\n } catch (error) {\n console.error(`Error updating notification profile: ${error}`)\n this.globalStore.captureException(error, { store: 'SettingsStore' })\n }\n }\n\n updateRuleCategory = async (rule: TransactionRule) => {\n this.transactionApi.updateTransactionRule(rule).then(() => {\n this.loadTransactionRules()\n })\n }\n\n updateRulePayee = async (rule: TransactionRule) => {\n this.transactionApi\n .updateTransactionRule(rule)\n .then(() => {\n this.setAlert(this.copy.edit_payee_success, 'success')\n this.loadTransactionRules()\n })\n .catch((error) => {\n this.globalStore.captureException(error, { store: 'SettingsStore' })\n this.setAlert(this.copy.edit_payee_error, 'error')\n })\n }\n\n updateUser = async (user: User) => {\n this.globalStore.userStore\n .updateUser(user)\n .then(() => {\n this.setAlert(this.copy.information_updated_success, 'success')\n })\n .catch((error) => {\n this.globalStore.captureException(error, { store: 'SettingsStore' })\n this.setAlert(this.copy.information_updated_error, 'error')\n })\n }\n\n updateUserCommunicationProfile = async (profile: UserCommunicationProfile) => {\n try {\n const updatedProfile = await this.api.updateUserCommunicationProfile(profile)\n\n this.globalStore.appDataStore.setUserCommunicationProfile(updatedProfile)\n } catch (error) {\n console.error(`Error occurred while updating user communication profile: ${error}`)\n this.globalStore.captureException(error, { store: 'SettingsStore' })\n }\n }\n\n verifyPhoneToken = async (sms_verification_token: string) => {\n try {\n const { verified } = await this.api.verifyPhoneToken(sms_verification_token)\n if (!verified) {\n throw new Error()\n }\n this.setAlert(this.copy.verified_phone_success, 'success')\n } catch (error) {\n console.error(`Error verifying phone token: ${error}`)\n this.globalStore.captureException(error, { store: 'SettingsStore' })\n this.setAlert(this.copy.verified_phone_error, 'error')\n }\n }\n}\n","import { makeAutoObservable } from 'mobx'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { endOfToday } from 'date-fns/endOfToday'\nimport { formatISO } from 'date-fns/formatISO'\nimport { getUnixTime } from 'date-fns/getUnixTime'\nimport { isBefore } from 'date-fns/isBefore'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { startOfToday } from 'date-fns/startOfToday'\nimport { subDays } from 'date-fns/subDays'\n\nimport { BeatApi, TransactionApi } from '../api'\nimport { TABLE_CONST } from '../constants/Table'\nimport { COLUMN_NAMES, DEFAULT_TRANSACTION } from '../constants/Transaction'\nimport { TransactionType } from '../types'\nimport type { Beat, Tag, Tagging, Transaction, TransactionRule } from '../types'\nimport {\n buildDetailedTransactions,\n flattenTransactionsWithSplits,\n sortAndFilterTransactions,\n} from '../utils/TransactionUtils'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport type TransactionFilter = {\n accounts?: string[]\n dateRange?: { start: Date; end: Date }\n custom?: (value: Transaction) => boolean\n searchTerm?: string\n showSplits?: boolean\n}\n\nexport class TransactionStore {\n globalStore: GlobalStore\n uiStore: UiStore\n api = new TransactionApi('/', '')\n beatApi = new BeatApi('/', '')\n\n associatedBeats: Beat[] = []\n associatedBeatsLoaded: boolean = false\n associatedBeatsLoading: boolean = false\n transactions: Transaction[] = []\n transactionsLoaded: boolean = false\n transactionsLoading: boolean = false\n taggings: Tagging[] = []\n taggingsLoaded: boolean = false\n taggingsLoading: boolean = false\n tags: Tag[] = []\n tagsLoaded: boolean = false\n tagsLoading: boolean = false\n transactionRules: TransactionRule[] = []\n transactionRulesLoaded: boolean = false\n transactionRulesLoading: boolean = false\n transactionSplitting: boolean = false\n\n cachedStartDate: Date = subDays(startOfToday(), 90)\n filter: TransactionFilter = {}\n isLoading = true\n\n alert = ''\n\n sortColumn = COLUMN_NAMES.DATE\n sortDirection = TABLE_CONST.DESC\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.uiStore = new UiStore()\n this.api = new TransactionApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n globalStore.onCaptureException,\n )\n this.beatApi = new BeatApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n globalStore.onCaptureException,\n )\n\n makeAutoObservable(this)\n }\n\n loadTransactionData = async () => {\n if (!this.globalStore.accountStore.isAccountDataLoaded) {\n await this.globalStore.accountStore.loadAccountData()\n }\n if (!this.globalStore.categoryStore.categoriesLoaded) {\n await this.globalStore.categoryStore.loadCategories()\n }\n await Promise.all([\n this.loadAssociatedBeats(startOfMonth(new Date())),\n this.loadTags(),\n this.loadTaggings(),\n this.loadTransactionRules(),\n // By default loads 90 days of transactions\n this.loadTransactions(this.cachedStartDate),\n ])\n }\n\n get isTransactionDataLoaded(): boolean {\n return (\n this.associatedBeatsLoaded &&\n this.tagsLoaded &&\n this.taggingsLoaded &&\n this.transactionRulesLoaded &&\n this.transactionsLoaded\n )\n }\n\n get detailedTransactions(): Transaction[] {\n return this.isTransactionDataLoaded\n ? buildDetailedTransactions(\n this.transactions,\n this.globalStore.accountStore.visibleAccounts,\n this.globalStore.categoryStore.categories,\n this.taggings,\n )\n : []\n }\n\n get sortedTransactions(): Transaction[] {\n return sortAndFilterTransactions(\n this.filter,\n this.uiStore.expandedSplits,\n this.sortColumn,\n this.sortDirection,\n this.tags,\n this.detailedTransactions,\n )\n }\n\n get sortedTransactionsWithSplits(): Transaction[] {\n return flattenTransactionsWithSplits(this.sortedTransactions, this.detailedTransactions)\n }\n\n setAssociatedBeats = (beats: Beat[]) => {\n this.associatedBeats = beats\n this.associatedBeatsLoading = false\n this.associatedBeatsLoaded = true\n }\n\n setTaggings = (taggings: Tagging[]) => {\n this.taggings = taggings\n this.taggingsLoading = false\n this.taggingsLoaded = true\n }\n\n setTags = (tags: Tag[]) => {\n this.tags = tags\n this.tagsLoading = false\n this.tagsLoaded = true\n }\n\n setTransactionRules = (transactionRules: TransactionRule[]) => {\n this.transactionRules = transactionRules\n this.transactionRulesLoading = false\n this.transactionRulesLoaded = true\n }\n\n setTransactions = (transactions: Transaction[]) => {\n this.transactions = transactions\n this.transactionsLoading = false\n this.transactionsLoaded = true\n }\n\n setAlert = (alert: string) => {\n this.alert = alert\n }\n\n addTag = async (name: string) => {\n await this.api.addTag({ name } as Tag)\n await this.loadTags()\n }\n\n addTagging = async (tagGuid: string, transactionGuid: string) => {\n await this.api.addTagging({\n tag_guid: tagGuid,\n transaction_guid: transactionGuid,\n } as Tagging)\n }\n\n addOrUpdateTransactionRule = async (categoryGuid: string, transaction: Transaction) => {\n const existingRule = this.transactionRules.find(\n (rule: TransactionRule) => rule.guid === transaction.user_transaction_rule_guid,\n ) as TransactionRule | undefined\n\n if (existingRule) {\n await this.api.updateTransactionRule({\n ...existingRule,\n category_guid: categoryGuid,\n description: transaction.description,\n } as TransactionRule)\n } else {\n await this.api.addTransactionRule({\n category_guid: categoryGuid,\n description: transaction.description,\n match_description: transaction.description,\n } as TransactionRule)\n }\n await this.loadTransactionRules()\n }\n\n addTransaction = async (transaction: Transaction) => {\n const newTransaction = await this.api.addTransaction(transaction)\n\n if (newTransaction) {\n this.setTransactions([newTransaction, ...this.transactions])\n\n // Update the related account balance\n const balanceChange =\n newTransaction.transaction_type === TransactionType.CREDIT\n ? newTransaction.amount\n : -newTransaction.amount\n\n this.globalStore.accountStore.updateAccountBalance(newTransaction.account_guid, balanceChange)\n }\n }\n\n loadAssociatedBeats = async (fromDate?: Date) => {\n if (this.associatedBeatsLoading) return\n\n this.associatedBeatsLoading = true\n const fromDateISO = fromDate ? formatISO(fromDate, { representation: 'date' }) : undefined\n try {\n const beats = await this.beatApi.getBeatsWithAssociatedTransaction(fromDateISO)\n this.setAssociatedBeats(beats)\n } catch (error) {\n console.error(`Error occurred while loading associated beats: ${error}`)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n loadTags = async () => {\n if (this.tagsLoading) return\n\n this.tagsLoading = true\n try {\n const tags = await this.api.getTags()\n this.setTags(tags)\n } catch (error) {\n console.error(`Error occurred while loading tags: ${error}`)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n loadTaggings = async () => {\n if (this.taggingsLoading) return\n\n this.taggingsLoading = true\n try {\n const taggings = await this.api.getTaggings()\n this.setTaggings(taggings)\n } catch (error) {\n console.error(`Error occurred while loading taggings: ${error}`)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n\n loadTransactionRules = async () => {\n if (this.transactionRulesLoading) return\n\n this.transactionRulesLoading = true\n const transactionRules = await this.api.getTransactionRules()\n this.setTransactionRules(transactionRules)\n }\n\n loadTransactions = async (startDate: Date = this.cachedStartDate) => {\n if (this.transactionsLoading) return\n\n this.setIsLoading(true)\n this.transactionsLoading = true\n this.transactions = []\n\n try {\n const transactions = await this.api.getTransactionsByDateRange(\n getUnixTime(startDate),\n getUnixTime(endOfToday()),\n )\n this.setTransactions(transactions)\n } catch (error) {\n console.error(`Error occurred while loading transactions: ${error}`)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n this.setIsLoading(false)\n }\n\n modifyTransactionByAccountGuid = (guid: string, updates: Partial<Transaction>) => {\n this.transactions = this.transactions.map((txn) =>\n txn.account_guid === guid ? { ...txn, ...updates } : txn,\n )\n }\n\n removeTag = async (tagGuid: string) => {\n await this.api.removeTag(tagGuid)\n await this.loadTags()\n }\n\n removeTagging = async (taggingGuid: string) => {\n await this.api.removeTagging(taggingGuid)\n }\n\n removeTransaction = async (transactionGuid: string) => {\n await this.api.removeTransaction(transactionGuid)\n\n const index = this.transactions.findIndex((t: Transaction) => t.guid === transactionGuid)\n\n if (index >= 0) {\n const updatedTransactions = [...this.transactions]\n updatedTransactions.splice(index, 1)\n this.setTransactions(updatedTransactions)\n }\n }\n\n setFilter = (filter: TransactionFilter) => {\n this.filter = filter\n\n // Only reload transactions if new start date is prior to the current cached start date\n // Cached date range end date is always today\n if (filter.dateRange && isBefore(filter.dateRange.start, this.cachedStartDate)) {\n this.loadTransactions(filter.dateRange.start).then(() => {\n if (filter.dateRange) {\n this.cachedStartDate = filter.dateRange.start\n }\n })\n }\n }\n\n setIsLoading = (isLoading: boolean) => (this.isLoading = isLoading)\n\n splitTransaction = async (transaction: Transaction, splits: Transaction[]) => {\n if (this.transactionSplitting) return\n this.transactionSplitting = true\n\n try {\n const updatedTransaction = await this.api.updateTransaction(transaction)\n const children = [] as Transaction[]\n\n for (let i = 0; i < splits.length; i++) {\n const child = await this.api.addTransaction(splits[i])\n children.push(child)\n }\n\n const index = this.transactions.findIndex((t: Transaction) => t.guid === transaction.guid)\n\n if (index >= 0) {\n // Remove old parent and any existing children\n const filtered = this.transactions.filter(\n (t) => t.guid !== transaction.guid && t.parent_guid !== transaction.guid,\n )\n\n // Insert updated parent + new children at original position\n this.setTransactions([\n ...filtered.slice(0, index),\n updatedTransaction,\n ...children,\n ...filtered.slice(index),\n ])\n }\n } finally {\n this.transactionSplitting = false\n }\n }\n\n unSplitTransaction = async (guid: string) => {\n const children = this.transactions.filter((t) => t.parent_guid === guid)\n\n await this.api.removeTransactionSplit(guid)\n\n // Remove children\n const transactions = [...this.transactions]\n children.forEach((child) => {\n const index = transactions.findIndex((t) => t.guid === child.guid)\n\n if (index >= 0) {\n transactions.splice(index, 1)\n }\n })\n\n // Update parent\n const index = transactions.findIndex((t) => t.guid === guid)\n const transaction = transactions[index]\n transaction.has_been_split = false\n if (index >= 0) {\n this.setTransactions([\n ...transactions.slice(0, index),\n transaction,\n ...transactions.slice(index + 1),\n ])\n }\n }\n\n updateTaggings = async (tagGuids: string[], transactionGuid: string) => {\n const currentTaggings = this.taggings.filter((t) => t.transaction_guid === transactionGuid)\n\n const currentTagGuids = new Set(currentTaggings.map((t) => t.tag_guid))\n const incomingTagGuids = new Set(tagGuids)\n\n // Add new taggings that don't already exist\n for (const tagGuid of tagGuids) {\n if (!currentTagGuids.has(tagGuid)) {\n await this.addTagging(tagGuid, transactionGuid)\n }\n }\n\n // Remove taggings that are no longer needed\n for (const tagging of currentTaggings) {\n if (!incomingTagGuids.has(tagging.tag_guid)) {\n await this.removeTagging(tagging.guid)\n }\n }\n\n await this.loadTaggings()\n }\n\n updateTag = async (tag: Tag) => {\n await this.api.updateTag(tag)\n await this.loadTags()\n }\n\n updateTransaction = async (transaction: Transaction) => {\n const updatedTransaction = await this.api.updateTransaction(transaction)\n\n const index = this.transactions.findIndex((t: Transaction) => t.guid === transaction.guid)\n\n if (index >= 0) {\n this.setTransactions([\n ...this.transactions.slice(0, index),\n updatedTransaction,\n ...this.transactions.slice(index + 1),\n ])\n }\n }\n\n // This is used for loading the transactions list on demand, on clicking the different transactions of the insightful beats.\n loadEmbeddedInstanceTransactions = async (fromDate: Date) => {\n try {\n const transactions = await this.api.getTransactionsByDateRange(\n getUnixTime(fromDate),\n getUnixTime(endOfToday()),\n )\n this.cachedStartDate = fromDate\n this.transactions = transactions\n } catch (error) {\n console.error(`Error occurred while loading embedded instance transactions: ${error}`)\n this.globalStore.captureException(error, { store: 'TransactionStore' })\n }\n }\n}\n\nexport class UiStore {\n beginDate = startOfMonth(new Date())\n endDate = endOfMonth(new Date())\n\n expandedSplits = [] as string[]\n height = 550\n width = 1000\n shouldDisableDrawerScroll = false\n\n searchValue = ''\n selectedAccountGuids = [] as string[]\n\n manualTransaction: Transaction = DEFAULT_TRANSACTION\n isAmountValid = false\n\n showInsights = false\n\n constructor() {\n makeAutoObservable(this)\n }\n\n setDateRange = (beginDate: Date, endDate: Date) => {\n this.beginDate = beginDate\n this.endDate = endDate\n }\n\n setIsAmountValid = (valid: boolean) => (this.isAmountValid = valid)\n\n setSearchValue = (searchValue: string) => (this.searchValue = searchValue)\n\n setSelectedAccountGuids = (accountGuids: string[]) => (this.selectedAccountGuids = accountGuids)\n\n setShouldDisableDrawerScroll = (shouldDisable: boolean) =>\n (this.shouldDisableDrawerScroll = shouldDisable)\n\n setShowInsights = (showInsights: boolean) => {\n this.showInsights = showInsights\n }\n\n setSize = (height: number, width: number) => {\n this.height = height\n this.width = width\n }\n\n toggleSplit = (guid: string) => {\n const expandedSplits = [...this.expandedSplits]\n const index = this.expandedSplits.findIndex((splitGuid) => splitGuid === guid)\n\n if (index >= 0) {\n expandedSplits.splice(index, 1)\n } else {\n expandedSplits.push(guid)\n }\n\n this.expandedSplits = expandedSplits\n }\n\n clearExpandedSplits = () => {\n if (this.expandedSplits.length === 0) return\n this.expandedSplits = []\n }\n\n updateManualTransaction = (manualTransaction: Transaction) => {\n this.manualTransaction = manualTransaction\n }\n}\n","import { makeAutoObservable } from 'mobx'\nimport { addSeconds } from 'date-fns/addSeconds'\nimport { differenceInCalendarMonths } from 'date-fns/differenceInCalendarMonths'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { subMonths } from 'date-fns/subMonths'\n\nimport type { DateRange, DetailedCategoryWithTransactions } from '../types'\nimport { DATE_FORMATS_INTL, formatDate } from '../constants'\nimport {\n buildCategoryDetailsChartData,\n filterAndSortCategoriesWithTransactions,\n} from '../utils/TrendsUtil'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class TrendsStore {\n globalStore: GlobalStore\n selectedCategoryData: DetailedCategoryWithTransactions | null = null\n selectedDateRange: DateRange\n visibleListLength: number = 5\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.selectedDateRange = {\n start: addSeconds(endOfMonth(subMonths(new Date(), 6)), 1),\n end: endOfMonth(new Date()),\n }\n makeAutoObservable(this)\n }\n\n setSelectedCategoryData = (data: DetailedCategoryWithTransactions | null) => {\n this.selectedCategoryData = data\n }\n\n setSelectedDateRange = (dateRange: DateRange) => {\n this.selectedDateRange = dateRange\n }\n\n setVisibleListLength = (length: number) => {\n this.visibleListLength = length\n }\n\n get sortedDetailedCategoriesWithTransactions(): DetailedCategoryWithTransactions[] {\n return filterAndSortCategoriesWithTransactions(\n this.globalStore.categoryStore.detailedCategoriesWithTransactions,\n )\n }\n\n get selectedDateRangeMonthCount(): number {\n return differenceInCalendarMonths(this.selectedDateRange.end, this.selectedDateRange.start) + 1\n }\n\n get selectedDateRangeMonthRange(): string {\n const startMonth = formatDate(this.selectedDateRange.start, DATE_FORMATS_INTL.MONTH_LONG)\n const endMonth = formatDate(this.selectedDateRange.end, DATE_FORMATS_INTL.MONTH_LONG)\n return `${startMonth} - ${endMonth}`\n }\n\n get visibleCategories(): DetailedCategoryWithTransactions[] {\n return this.sortedDetailedCategoriesWithTransactions.slice(0, this.visibleListLength)\n }\n\n get collapsedCategories(): DetailedCategoryWithTransactions[] {\n return this.sortedDetailedCategoriesWithTransactions.slice(this.visibleListLength)\n }\n\n get categoryDetailsChartData() {\n return buildCategoryDetailsChartData(\n this.selectedCategoryData,\n this.selectedDateRangeMonthCount,\n )\n }\n}\n","import { makeAutoObservable } from 'mobx'\n\nimport { UserApi } from '../api'\nimport type { User, UserFeature, UserProfile } from '../types'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class UserStore {\n globalStore: GlobalStore\n api: UserApi = new UserApi('/', '')\n\n userFeatures: UserFeature[] = []\n userFeaturesLoaded: boolean = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new UserApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n globalStore.onCaptureException,\n )\n\n makeAutoObservable(this)\n }\n\n get userProfile() {\n return this.globalStore.appDataStore.userProfile\n }\n\n get user() {\n return this.globalStore.appDataStore.user\n }\n\n setUserFeatures = (features: UserFeature[]) => {\n this.userFeatures = features\n this.userFeaturesLoaded = true\n }\n\n loadUserFeatures = async () => {\n try {\n const features = await this.api.getUserFeatures()\n this.setUserFeatures(features)\n } catch (e) {\n console.error(`Error occurred while loading user features: ${e}`)\n this.globalStore.captureException(e, { store: 'UserStore' })\n }\n }\n\n updateUser = async (user: User) => {\n try {\n const updatedUser = await this.api.updateUser(user)\n\n this.globalStore.appDataStore.setUser(updatedUser)\n } catch (error) {\n console.error(`Error updating User: ${error}`)\n this.globalStore.captureException(error, { store: 'UserStore' })\n }\n }\n\n updateUserProfile = async (userProfile: UserProfile) => {\n try {\n const updatedProfile = await this.api.updateUserProfile(userProfile)\n\n this.globalStore.appDataStore.setUserProfile(updatedProfile)\n } catch (error) {\n console.error(`Error occurred while updating user profile: ${error}`)\n this.globalStore.captureException(error, { store: 'UserStore' })\n }\n }\n}\n"],"names":["AccountApi","endpoint","token","onError","onCaptureException","Fetch","account","ApiEndpoints","data","error","accountGuid","guid","accountGuids","AppDataApi","BannerApi","bullseyeEndpoint","userGuid","path","BudgetsApi","category","amount","parentGuid","budget","merchantGuid","merchantBudgetGuid","CategoryApi","startDate","endDate","accounts","url","FinstrongApi","birthYear","GoalApi","goal","retirementAccount","goals","profile","HelpApi","ticket","HoldingApi","holding","MerchantApi","searchValues","guids","page","perPage","value","NotificationApi","obj","notification","channel","RepeatingTransactionsApi","repeatingTransaction","SettingsApi","item","sms_verification_token","res","device","notificationProfile","userCommunicationProfile","TransactionApi","tag","tagging","transaction","rule","beginDate","accountsList","acc","i","categoryGuid","categoryGuids","UserApi","e","user","userProfile","WidgetApi","req","AccountStore","globalStore","UiStore","makeAutoObservable","userFeatures","excludeExternal","isFeatureEnabled","excludeHeld","augmentAccounts","typeMap","accountType","AccountType","total","a","eligibleTypes","AccountSubType","members","institutions","newAccount","runInAction","response","mergedAccount","account2Index","account1Index","deletedIndex","updatedAccount","updatedAccountIndex","balanceChange","accountMap","accountUpdates","isSelected","updatedAccounts","index","UiStore$4","member","AppDataStore","appData","banner","AnalyticsStore","forceReload","posthog","surveys","survey","s","orderArray","arr1","arr2","prop","order","direction","item1","item2","transformOfferIntoBeatLikeObject","offer","BeatStore","BeatApi","beats","beatLikeOffers","o","filter","templates","filteredBeats","beat","template","BudgetsStore","startOfMonth","startOfToday","endOfMonth","reaction","detailedBudgets","findBudget","subBudget","findSubBudget","augmentBudgets","CategoryGuids","b","curr","budgets","alert","dateRange","theme","categories","budgetsToDelete","c","budgetToDelete","updatedBudget","eachMerchantBudget","merchantBudgets","newMerchantBudget","merchantBudget","updatedMerchantBudget","CashflowStore","updatedUserProfile","UiStore$3","addDays","selectedAccountGuids","showAvailableBalance","getAccountStartingBalance","differenceInDays","isBefore","CategoryStore","augmentCategories","getDetailedCategoryTransactions","totals","name","getUnixTime","start","subMonths","end","CategoryGuidToName","UiStore$2","shouldDisable","showSelected","unselectable","text","callback","ConnectStore","widget","mode","rest","DebtsStore","debtAccounts","debtGoals","filteredDebtAccounts","loadDebts","d","p","payment","UiStore$1","DebtPriority","interest_rate","monthly_payment","isLoading","priority","augmentChartData","averageHealthScores","formatDate","DATE_FORMATS_INTL","augmentSpendingFeeTransactions","spendingFeeTransactions","FinstrongStore","isSpendingInitialized","isIncomeInitialized","needHealthScoreChangeReport","healthScore","healthScoreChange","currentScore","oldScore","monthlySummaries","debtSpend","income","healthScoreChangeReports","format","fromUnixTime","peerScore","augmentedChartData","spendingFeeTransaction","organizedSpendingFeeTransactions","spendTransaction","DefaultAppConfig","GlobalStore","appConfig","onStoreUpdate","GlobalCopyStore","GoalStore","HelpStore","HoldingStore","MerchantStore","NetWorthStore","NotificationStore","RecurringTransactionsStore","SettingsStore","TransactionStore","TrendsStore","UserStore","GlobalUiStore","autorun","transactions","context","change","associatedBeats","transactionRules","visibleAccounts","isIncluded","selectedMonth","getMonth","nextMonth","addMonths","currentMonth","GlobalCopyApi","namespace","translationKey","newCopy","goalsCopy","userBirthday","TrackType","getProjectedRetirementDate","ongoingGoals","priorityOrder","aIndex","bIndex","retirementGoals","retirementGoalAccounts","monthlyCashFlowProfile","newGoal","newAccounts","g","rga","reordered","updatedGoal","updatedRetirementGoal","updatedProfile","isCategoryAccessibleByProfile","flag","HelpUtil","categoryList","accessibleCategories","el","HELP_CATEGORIES","updatedCategory","topicKey","message","severity","client_communication_profile","client_profile","category_list","AnalysisType","mapDataToPercentageGrid","analysisChartData","analysisDetailsData","holdings","analysisType","updatedHolding","updatedIndex","searchValue","merchants","merchant","filterAccounts","buildChartData","getLatestNetWorthData","buildGainsLosses","assets","liabilities","totalAssets","totalLiabilities","buildAssetsLiabilities","monthlyAccountBalances","flattenBalances","sortByYearMonthAscending","balances","months","observable","n","filterRecentNotifications","notifications","currentMonthFilter","date","recurrence","isWithinInterval","recurrenceTotalReducer","augmentRepeatingTransactions","buildAllRecurrences","r","RecurrenceType","RecurrenceStatus","isAfter","subDays","isSameDay","rt","repeating","day","repeatingTransactions","newRepeating","updatedTransaction","repeatingTransactionGuid","PARENT_ENTITY","getProfileLabel","notificationType","copy","BudgetNotificationTypes","AccountNotificationTypes","InsightNotificationTypes","augmentNotificationProfiles","clientCommunicationsProfile","profiles","userCommunicationsProfile","detailedProfiles","clientEmailEnabled","clientSmsEnabled","clientPushEnabled","userEmailOptedOut","userSmsOptedOut","userPushOptedOut","label","children","child","deliveryMethods","ccp","np","devices","rules","updatedDevice","verified","COLUMN_NAMES","TABLE_CONST","buildDetailedTransactions","sortAndFilterTransactions","flattenTransactionsWithSplits","taggings","tags","tagGuid","transactionGuid","existingRule","newTransaction","TransactionType","fromDate","fromDateISO","formatISO","endOfToday","updates","txn","taggingGuid","t","updatedTransactions","splits","filtered","tagGuids","currentTaggings","currentTagGuids","incomingTagGuids","DEFAULT_TRANSACTION","valid","showInsights","height","width","expandedSplits","splitGuid","manualTransaction","addSeconds","length","filterAndSortCategoriesWithTransactions","differenceInCalendarMonths","startMonth","endMonth","buildCategoryDetailsChartData","features","updatedUser"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,MAAMA,EAAW;AAAA,EACtB;AAAA,EAEA,YACEC,GACAC,GACAC,GACAC,GACA;AACA,SAAK,gBAAgB,IAAIC,EAAMJ,GA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