@mx-cartographer/experiences 7.1.4-ram2-alpha-finstrong-credit-score-graph-check → 7.1.5-alpha.sms1

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 (127) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/{Account-CpRTVIHg.mjs → Account-8IUM_CLv.mjs} +1 -1
  3. package/dist/{AccountDetailsContent-6aPMU6Hp.mjs → AccountDetailsContent-CuZSSAEc.mjs} +10 -10
  4. package/dist/{AccountDetailsHeader-BkUZYoV8.mjs → AccountDetailsHeader-BZBsIKdF.mjs} +8 -8
  5. package/dist/{AccountFields-DOLjKu5l.mjs → AccountFields-BD_0GT68.mjs} +5 -5
  6. package/dist/{AccountListItem-CTT5m4qx.mjs → AccountListItem-CllIBCao.mjs} +4 -4
  7. package/dist/{AccountStore-DTfpr3h0.mjs → AccountStore-BL0FE1QL.mjs} +15 -26
  8. package/dist/{Accounts-D0BmvNxn.mjs → Accounts-Bvc9TJaO.mjs} +1 -1
  9. package/dist/{BudgetUtil-D2Jcp-E-.mjs → BudgetUtil-psfk-Amb.mjs} +1 -1
  10. package/dist/{CategorySelectorDrawer-DomNyubP.mjs → CategorySelectorDrawer-BmenK5bu.mjs} +3 -3
  11. package/dist/{CategoryStore-C1IfDPCE.mjs → CategoryStore-BCcpI3oJ.mjs} +1 -1
  12. package/dist/{CategoryUtil-DUM8NuGO.mjs → CategoryUtil-BR3H5i6n.mjs} +1 -1
  13. package/dist/{ConnectDrawer--gJHyp-S.mjs → ConnectDrawer-CPTXh70j.mjs} +2 -2
  14. package/dist/{ConnectionsDrawer-DabiwV9L.mjs → ConnectionsDrawer-Dkb4vBmt.mjs} +3 -3
  15. package/dist/{CurrencyInput-CC5cwVit.mjs → CurrencyInput-C4xNRL2W.mjs} +1 -1
  16. package/dist/{DateUtil-CBdcsyuk.mjs → DateUtil-BcuH7ErC.mjs} +3 -3
  17. package/dist/{DebtsStore-9aR2sTJQ.mjs → DebtsStore-D4grpB4m.mjs} +1 -1
  18. package/dist/{Dialog-BPTr3qHE.mjs → Dialog-CWW597AF.mjs} +2 -2
  19. package/dist/Drawer-kEE73B87.mjs +113 -0
  20. package/dist/{ExportCsvAction-Um-CDa4C.mjs → ExportCsvAction-CBJAfyAw.mjs} +3 -3
  21. package/dist/FinstrongStore-F2c607dj.mjs +101 -0
  22. package/dist/{GoalStore-CiBKZvTg.mjs → GoalStore-B5MZzPLZ.mjs} +3 -3
  23. package/dist/{Help-BZ8pIkkR.mjs → Help-CzBAsKA2.mjs} +2 -2
  24. package/dist/LineChart-B35qvXik.mjs +541 -0
  25. package/dist/{ListItemAction-DGaxy7oz.mjs → ListItemAction-DSrYDGAP.mjs} +10 -10
  26. package/dist/{ManageIncome-BaNgfwr5.mjs → ManageIncome-DUuT-yMV.mjs} +32 -34
  27. package/dist/{MicroWidgetContainer-C3iV1FBR.mjs → MicroWidgetContainer-C4QQHfD7.mjs} +1 -1
  28. package/dist/{MiniWidgetContainer-LtXXgZ6H.mjs → MiniWidgetContainer-DTQdRK-3.mjs} +1 -1
  29. package/dist/{NetWorthStore-MnpP5KEc.mjs → NetWorthStore-Do1Gk8Te.mjs} +2 -2
  30. package/dist/{NotificationSettings-Ckx8tgQj.mjs → NotificationSettings-BuShgjn6.mjs} +5 -5
  31. package/dist/{OriginalBalanceAction-CGZDUsCc.mjs → OriginalBalanceAction-BsxcvNEF.mjs} +3 -3
  32. package/dist/{RecurringSettings-DE4T4yQy.mjs → RecurringSettings-BVOt46uV.mjs} +4 -4
  33. package/dist/{RecurringTransactions-CngsRZ3K.mjs → RecurringTransactions-ej39mgA6.mjs} +44 -45
  34. package/dist/{RecurringTransactionsStore-C4RVULF8.mjs → RecurringTransactionsStore-DrzS1LmF.mjs} +1 -1
  35. package/dist/{SpendingData-BuJ03S9d.mjs → SpendingData-D5vsfYKo.mjs} +16 -16
  36. package/dist/{TransactionDetails-DRlrltGq.mjs → TransactionDetails-_cXLXTd3.mjs} +8 -11
  37. package/dist/{TransactionStore-D8MKYDMb.mjs → TransactionStore-B-Tq_YFE.mjs} +3 -3
  38. package/dist/{TrendsStore-DL3Vuh71.mjs → TrendsStore-ZZ8X36lJ.mjs} +14 -14
  39. package/dist/{User-BthIKO4w.mjs → User-DaJAQ09j.mjs} +2 -2
  40. package/dist/{ViewMoreMicroCard-DTtQNV3D.mjs → ViewMoreMicroCard-K-RUX-V6.mjs} +175 -197
  41. package/dist/{WidgetContainer-DJA1bxLn.mjs → WidgetContainer-DtPnPQZY.mjs} +4 -4
  42. package/dist/accounts/index.es.js +14 -14
  43. package/dist/accounts/stores/AccountStore.d.ts +0 -2
  44. package/dist/analytics/index.es.js +2 -2
  45. package/dist/budgets/index.es.js +12 -12
  46. package/dist/cashflow/index.es.js +11 -11
  47. package/dist/categories/index.es.js +2 -2
  48. package/dist/common/components/Select.d.ts +2 -4
  49. package/dist/common/components/charts/LineChart.d.ts +0 -2
  50. package/dist/common/components/charts/linechart/CustomMark.d.ts +0 -2
  51. package/dist/common/components/drawer/Drawer.d.ts +0 -3
  52. package/dist/common/index.es.js +33 -33
  53. package/dist/common/types/Finstrong.d.ts +0 -50
  54. package/dist/common/types/index.d.ts +1 -1
  55. package/dist/common/types/localization/FinstrongCopy.d.ts +1 -57
  56. package/dist/dashboard/index.es.js +2 -2
  57. package/dist/debts/index.es.js +11 -11
  58. package/dist/{exportTransactionsToCSV-XqdHNe2V.mjs → exportTransactionsToCSV-D8TTNrrE.mjs} +2 -2
  59. package/dist/finstrong/api/FinstrongApi.d.ts +0 -5
  60. package/dist/finstrong/components/ConnectMoreAccountsCard.d.ts +1 -2
  61. package/dist/finstrong/components/KeyIndicatorsBorrowTab.d.ts +2 -2
  62. package/dist/finstrong/components/KeyIndicatorsDrawer.d.ts +1 -1
  63. package/dist/finstrong/components/KeyIndicatorsSaveTab.d.ts +2 -2
  64. package/dist/finstrong/components/KeyIndicatorsSpendTab.d.ts +2 -2
  65. package/dist/finstrong/components/KeyIndicatorsTabItem.d.ts +3 -4
  66. package/dist/finstrong/components/KeyIndicatorsTabsWidget.d.ts +2 -2
  67. package/dist/finstrong/index.es.js +1008 -2890
  68. package/dist/finstrong/stores/FinstrongStore.d.ts +1 -9
  69. package/dist/finstrong/util/finstrongUtils.d.ts +1 -65
  70. package/dist/finstrong/utils/Finstrong.d.ts +6 -0
  71. package/dist/goals/index.es.js +14 -14
  72. package/dist/help/index.es.js +3 -3
  73. package/dist/{hooks-CBST3rkm.mjs → hooks-CE2TKk4a.mjs} +3 -3
  74. package/dist/investments/index.es.js +4 -4
  75. package/dist/merchants/index.es.js +1 -1
  76. package/dist/microinsights/index.es.js +1 -1
  77. package/dist/networth/index.es.js +34 -34
  78. package/dist/notifications/index.es.js +4 -4
  79. package/dist/recurringtransactions/index.es.js +13 -13
  80. package/dist/settings/index.es.js +8 -8
  81. package/dist/spending/index.es.js +373 -222
  82. package/dist/transactions/index.es.js +15 -15
  83. package/dist/trends/index.es.js +16 -16
  84. package/dist/{useAccountDisplayName-DH1CuQ9R.mjs → useAccountDisplayName-BXGkZN5B.mjs} +2 -2
  85. package/dist/{useInsightsEnabled-jdvS1ppf.mjs → useInsightsEnabled-DSnpkUq0.mjs} +1 -1
  86. package/package.json +1 -1
  87. package/dist/Drawer-BEtCk82g.mjs +0 -163
  88. package/dist/FinstrongStore-CC4SrBjA.mjs +0 -436
  89. package/dist/LineChart-CE3oLBQ0.mjs +0 -566
  90. package/dist/SpendingLegend-D24CEkL3.mjs +0 -170
  91. package/dist/accounts/components/AccountsListCompact.d.ts +0 -10
  92. package/dist/common/components/drawer/Footer.d.ts +0 -17
  93. package/dist/finstrong/components/CreditOverTimeGraph.d.ts +0 -1
  94. package/dist/finstrong/components/CreditScore/CreditScoreContent.d.ts +0 -4
  95. package/dist/finstrong/components/CreditScore/CreditScoreHeader.d.ts +0 -4
  96. package/dist/finstrong/components/HaveManageableDebt/DebtPaymentTabContent.d.ts +0 -3
  97. package/dist/finstrong/components/HaveManageableDebt/HaveManageableDebtComponent.d.ts +0 -3
  98. package/dist/finstrong/components/HaveManageableDebt/HaveManageableDebtProgressBar.d.ts +0 -4
  99. package/dist/finstrong/components/HaveManageableDebt/IncomeTabContent.d.ts +0 -3
  100. package/dist/finstrong/components/KeyIndicatorsTabItemDrawer.d.ts +0 -10
  101. package/dist/finstrong/components/MaintainingEmergencySavings/EstimatedContributionCalculator.d.ts +0 -6
  102. package/dist/finstrong/components/MaintainingEmergencySavings/MaintainingEmergencySavingsContent.d.ts +0 -4
  103. package/dist/finstrong/components/MaintainingEmergencySavings/MaintainingEmergencySavingsSticky.d.ts +0 -4
  104. package/dist/finstrong/components/ProgressBar.d.ts +0 -15
  105. package/dist/finstrong/components/SaveEnoughToLiveOn/AvailableTabContent.d.ts +0 -3
  106. package/dist/finstrong/components/SaveEnoughToLiveOn/SaveEnoughToLiveOnDrawerContent.d.ts +0 -3
  107. package/dist/finstrong/components/SaveEnoughToLiveOn/SaveEnoughToLiveOnProgressBar.d.ts +0 -4
  108. package/dist/finstrong/components/SaveEnoughToLiveOn/SpendingTabContent.d.ts +0 -3
  109. package/dist/finstrong/components/SpendLessThanYouMake/SpendLessThanYouMakeComponent.d.ts +0 -3
  110. package/dist/finstrong/components/SpendLessThanYouMake/SpendLessThanYouMakeProgressBar.d.ts +0 -4
  111. package/dist/finstrong/components/StatusChip.d.ts +0 -5
  112. package/dist/finstrong/components/onboarding/Onboarding.d.ts +0 -2
  113. package/dist/finstrong/components/onboarding/OnboardingAddMonthlyIncome.d.ts +0 -11
  114. package/dist/finstrong/components/onboarding/OnboardingBirthday.d.ts +0 -8
  115. package/dist/finstrong/components/onboarding/OnboardingCreditScore.d.ts +0 -8
  116. package/dist/finstrong/components/onboarding/OnboardingStepsDrawer.d.ts +0 -14
  117. package/dist/finstrong/components/onboarding/OnboardingStepsHeader.d.ts +0 -8
  118. package/dist/finstrong/components/paybillsontime/PayBillsOnTimeDrawerComponent.d.ts +0 -4
  119. package/dist/finstrong/components/paybillsontime/PayBillsOnTimeStickyComponent.d.ts +0 -4
  120. package/dist/finstrong/components/shared/Accounts.d.ts +0 -8
  121. package/dist/finstrong/components/shared/CustomDoubleBarPlot.d.ts +0 -25
  122. package/dist/finstrong/components/shared/DoubleBarChart.d.ts +0 -28
  123. package/dist/finstrong/components/shared/LineGraph.d.ts +0 -7
  124. package/dist/finstrong/components/shared/TotalCard.d.ts +0 -8
  125. package/dist/finstrong/components/shared/TransactionList.d.ts +0 -15
  126. package/dist/finstrong/components/shared/Transactions.d.ts +0 -11
  127. package/dist/finstrong/constants/index.d.ts +0 -8
@@ -1,436 +0,0 @@
1
- import { makeAutoObservable as b, runInAction as l } from "mobx";
2
- import { format as y } from "date-fns/format";
3
- import { fromUnixTime as D } from "date-fns/fromUnixTime";
4
- import { getUnixTime as I } from "date-fns/getUnixTime";
5
- import { subMonths as x } from "date-fns/subMonths";
6
- import { F as H, A as h } from "./Fetch-87LIQbEA.mjs";
7
- import { jsx as i, jsxs as T } from "react/jsx-runtime";
8
- import { addDays as v } from "date-fns/addDays";
9
- import { addMonths as M } from "date-fns/addMonths";
10
- import { addYears as G } from "date-fns/addYears";
11
- import { differenceInDays as L } from "date-fns/differenceInDays";
12
- import { differenceInMonths as w } from "date-fns/differenceInMonths";
13
- import { differenceInWeeks as A } from "date-fns/differenceInWeeks";
14
- import { startOfToday as N } from "date-fns/startOfToday";
15
- import { ChevronRight as P, Check as k } from "@mxenabled/mx-icons";
16
- import $ from "react";
17
- import B from "@mui/material/Avatar";
18
- import Y from "@mui/material/Box";
19
- import K from "@mui/material/Divider";
20
- import U from "@mui/material/List";
21
- import X from "@mui/material/ListItem";
22
- import V from "@mui/material/ListItemAvatar";
23
- import j from "@mui/material/ListItemButton";
24
- import z from "@mui/material/ListItemText";
25
- import { Text as F } from "@mxenabled/mxui";
26
- import { f as O, a as C } from "./Dialog-BPTr3qHE.mjs";
27
- import { b as W } from "./Localization-2MODESHW.mjs";
28
- const m = {
29
- creditScore: {
30
- poor: 600,
31
- good: 720
32
- },
33
- daysOfCashOnHand: {
34
- poor: 30,
35
- good: 90
36
- },
37
- debtToIncomeRatio: {
38
- poor: 40,
39
- good: 30
40
- },
41
- emergencySavings: {
42
- poor: 750,
43
- good: 1e3
44
- },
45
- spendToIncomeRatio: {
46
- poor: 110,
47
- good: 100
48
- }
49
- }, S = {
50
- GOOD: "Good",
51
- FAIR: "Fair",
52
- OFF_TRACK: "Off Track",
53
- MISSING: "Missing"
54
- };
55
- var _ = /* @__PURE__ */ ((e) => (e.Connections = "connections", e.CreditScore = "credit_score", e.DateOfBirth = "date_of_birth", e.MonthlyIncome = "monthly_income", e))(_ || {});
56
- const q = ({ list: e, onClickItem: t }) => /* @__PURE__ */ i(Y, { sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ i(
57
- U,
58
- {
59
- sx: {
60
- "& .MuiListItemSecondaryAction-root": {
61
- color: "text.primary",
62
- pr: 24
63
- }
64
- },
65
- children: e.map((r, n) => /* @__PURE__ */ T($.Fragment, { children: [
66
- /* @__PURE__ */ i(X, { secondaryAction: /* @__PURE__ */ i(P, {}), children: /* @__PURE__ */ T(j, { onClick: () => t(r.key), children: [
67
- /* @__PURE__ */ i(V, { children: /* @__PURE__ */ i(
68
- B,
69
- {
70
- sx: {
71
- bgcolor: "primary.main",
72
- ...!r.isComplete && {
73
- bgcolor: "transparent",
74
- borderColor: "action.active",
75
- borderStyle: "solid",
76
- borderWidth: 1,
77
- color: "action.active"
78
- }
79
- },
80
- children: r.icon
81
- }
82
- ) }),
83
- /* @__PURE__ */ i(
84
- z,
85
- {
86
- primary: /* @__PURE__ */ i(F, { sx: { color: "text.secondary" }, variant: "caption", children: r.primaryText }),
87
- secondary: /* @__PURE__ */ i(F, { sx: { color: "text.primary", fontWeight: 600 }, variant: "body1", children: r.secondaryText })
88
- }
89
- )
90
- ] }) }),
91
- n < e.length - 1 && /* @__PURE__ */ i(K, { sx: { color: "divider", ml: 68 } })
92
- ] }, r.key))
93
- }
94
- ) }), vt = q, Mt = (e) => e * (180 / Math.PI), Gt = (e, t) => [
95
- {
96
- description: t.vulnerable_description,
97
- max: 25,
98
- scoreContent: t.accordion_details_text.vulnerable,
99
- status: t.vulnerable
100
- },
101
- {
102
- description: t.building_description,
103
- max: 50,
104
- scoreContent: t.accordion_details_text.building,
105
- status: t.building
106
- },
107
- {
108
- description: t.stable_description,
109
- max: 75,
110
- scoreContent: t.accordion_details_text.stable,
111
- status: t.stable
112
- },
113
- {
114
- description: t.strong_description,
115
- max: 100,
116
- scoreContent: t.accordion_details_text.strong,
117
- status: t.strong
118
- }
119
- ].find((a) => e > 0 && e <= a.max) || { status: t.insufficient_data, description: "", scoreContent: "" }, g = {
120
- POOR: "#8C0E0E",
121
- FAIR: "#E32727",
122
- GOOD: "#FFB70D",
123
- VERY_GOOD: "#0EA26C",
124
- EXCEPTIONAL: "#005C3D"
125
- }, u = {
126
- POOR: "#B21C1C",
127
- FAIR: "#FF3232",
128
- GOOD: "#FFC02C",
129
- VERY_GOOD: "#29C76B",
130
- EXCEPTIONAL: "#008A5A"
131
- }, Lt = (e, t, r) => e >= 300 && e < 580 ? {
132
- status: r.poor,
133
- color: t ? u.POOR : g.POOR
134
- } : e >= 580 && e < 670 ? {
135
- status: r.fair,
136
- color: t ? u.FAIR : g.FAIR
137
- } : e >= 670 && e < 740 ? {
138
- status: r.good,
139
- color: t ? u.GOOD : g.GOOD
140
- } : e >= 740 && e < 800 ? {
141
- status: r.very_good,
142
- color: t ? u.VERY_GOOD : g.VERY_GOOD
143
- } : e >= 800 && e <= 850 ? {
144
- status: r.exceptional,
145
- color: t ? u.EXCEPTIONAL : g.EXCEPTIONAL
146
- } : { status: r.missing_data }, wt = (e, t, r, n) => {
147
- const a = e.reduce((c, d) => c + d.value, 0);
148
- let s = 0;
149
- const o = e.map((c) => {
150
- const d = c.value / a * t, p = r + s, f = p + d;
151
- return s += d, {
152
- ...c,
153
- startAngle: p,
154
- endAngle: f
155
- };
156
- });
157
- return [o[n].startAngle, o[n].endAngle];
158
- }, Nt = (e, t, r, n, a) => {
159
- let s = 0, o = 0;
160
- const c = Math.floor(n), d = n - c;
161
- return c > r ? (s = e, o = t) : c === r && d > 0 && (s = e, o = a), [s, o];
162
- }, Pt = (e, t, r = 0) => {
163
- const n = e * Math.sin(t - r), a = -e * Math.cos(t - r);
164
- return [n, a];
165
- }, kt = ({
166
- dynamicCopy: e,
167
- fallbackLabel: t,
168
- icon: r,
169
- key: n,
170
- label: a,
171
- value: s
172
- }) => {
173
- const o = !!s, c = o ? J(n, s) : e && W(e, t) || t;
174
- return {
175
- icon: o ? /* @__PURE__ */ i(k, {}) : r,
176
- isComplete: o,
177
- key: n,
178
- primaryText: a,
179
- secondaryText: c
180
- };
181
- }, J = (e, t) => ({
182
- [_.DateOfBirth]: (n) => y(new Date(Number(n) * 1e3), "MMM d, yyyy"),
183
- [_.MonthlyIncome]: (n) => `$${n}`
184
- })[e]?.(t) ?? String(t), $t = (e) => e !== null ? Math.round(e * 100) : null, Bt = (e) => {
185
- const t = new Date((/* @__PURE__ */ new Date()).getFullYear(), e - 1, 1);
186
- return O(t, C.MONTH_SHORT);
187
- }, Yt = (e) => {
188
- const { good: t, poor: r } = m.daysOfCashOnHand;
189
- return e === null ? "MISSING" : e >= t ? "GOOD" : e >= r ? "FAIR" : "OFF_TRACK";
190
- }, Kt = (e) => {
191
- const { good: t, poor: r } = m.emergencySavings;
192
- return e === null ? "MISSING" : e >= t ? "GOOD" : e >= r ? "FAIR" : "OFF_TRACK";
193
- }, Ut = (e) => {
194
- const { good: t, poor: r } = m.spendToIncomeRatio;
195
- return e === null ? "MISSING" : e < t ? "GOOD" : e < r ? "FAIR" : "OFF_TRACK";
196
- }, Xt = (e) => {
197
- const { good: t, poor: r } = m.debtToIncomeRatio;
198
- return e === null ? "MISSING" : e <= t ? "GOOD" : e <= r ? "FAIR" : "OFF_TRACK";
199
- }, Vt = (e) => {
200
- const { good: t, poor: r } = m.creditScore;
201
- return e === null ? "MISSING" : e >= t ? "GOOD" : e >= r ? "FAIR" : "OFF_TRACK";
202
- }, Q = (e) => e === null ? "MISSING" : e === 0 ? "GOOD" : "OFF_TRACK", jt = (e, t) => {
203
- const r = Q(e), n = {
204
- GOOD: t.count_good_description,
205
- OFF_TRACK: t.count_off_track_description,
206
- MISSING: t.count_missing_description
207
- };
208
- return {
209
- cardState: r,
210
- description: n[r],
211
- title: t.count_card_title
212
- };
213
- }, zt = (e) => ({
214
- [S.GOOD]: { backgroundColor: "success.lighter", color: "success.dark" },
215
- [S.FAIR]: { backgroundColor: "warning.lighter", color: "warning.dark" },
216
- [S.OFF_TRACK]: { backgroundColor: "error.lighter", color: "error.dark" },
217
- [S.MISSING]: { backgroundColor: "divider", color: "text.secondary" }
218
- })[e], Z = 1, tt = 1, et = {
219
- 1: M,
220
- 2: G,
221
- 3: v
222
- }, rt = {
223
- 1: w,
224
- 2: (e, t) => A(e, t) / 2,
225
- 3: A,
226
- 4: L
227
- }, E = [
228
- { contributionPeriodIndex: 3, targetAmount: 6, upperLimit: 500 },
229
- { contributionPeriodIndex: 3, targetAmount: 3, upperLimit: 900 },
230
- { contributionPeriodIndex: 2, targetAmount: 1, upperLimit: 1e3 }
231
- ], Wt = ({
232
- contribution: e,
233
- goalAmount: t,
234
- goalPeriod: r,
235
- targetPeriod: n,
236
- totalSaved: a
237
- }) => {
238
- const s = t - a;
239
- if (s <= 0) return 0;
240
- const o = N(), c = et[n], d = rt[e];
241
- if (!c || !d) return s;
242
- const p = c(o, r), f = d(p, o);
243
- return Math.max(s / (f || 1), 1);
244
- }, qt = (e) => !e || e <= 0 ? "0%" : e >= 1e3 ? "100%" : `${Math.round(e / 10)}%`, Jt = (e) => E.find((r) => e < r.upperLimit)?.targetAmount ?? tt, Qt = (e) => E.find((n) => e < n.upperLimit)?.contributionPeriodIndex ?? Z, Zt = (e, t) => e.map((n, a) => {
245
- const s = new Date(0, n.month - 1, 1), o = O(s, C.MONTH_SHORT);
246
- return t === "credit_score" ? {
247
- x: o,
248
- y: n[t],
249
- showMark: a === 0
250
- } : { x: o, y: n[t] };
251
- }).reverse(), nt = (e) => e?.health_scores.sort((t, r) => t.monthly_health_score_average.month - r.monthly_health_score_average.month).map((t) => ({
252
- x: O(
253
- new Date(0, t.monthly_health_score_average.month - 1, 1),
254
- C.MONTH_SHORT
255
- ),
256
- y: t.monthly_health_score_average.average_health_score
257
- })), ot = (e) => e.sort((r, n) => n.transaction.date - r.transaction.date).map(({ transaction: r }) => ({
258
- ...r
259
- }));
260
- class R {
261
- fetchInstance;
262
- constructor(t, r, n) {
263
- this.fetchInstance = new H(t, r, void 0, n);
264
- }
265
- calculateHealthScore = async () => this.fetchInstance.post(`${h.HEALTH_SCORES}/calculate`).then((t) => t.health_score);
266
- getAverageHealthScores = async () => this.fetchInstance.get(`${h.HEALTH_SCORES}/monthly_averages`).then((t) => t);
267
- getDebtSpend = async () => this.fetchInstance.get(`${h.HEALTH_SCORES}/transactions/debt_spend`).then((t) => t.debt_spend);
268
- getIncome = async () => this.fetchInstance.get(`${h.HEALTH_SCORES}/transactions/income`).then((t) => t.income);
269
- getMonthlySummaries = async () => this.fetchInstance.get(`${h.HEALTH_SCORES}/monthly_summaries`).then((t) => t.monthly_summaries);
270
- getHealthScoreChangeReports = async (t, r) => this.fetchInstance.get(`${h.HEALTH_SCORES}/change_report/from/${t}/to/${r}`).then((n) => n);
271
- getPeerScore = async (t) => this.fetchInstance.get(`${h.HEALTH_SCORES}/average/${t}`).then((r) => r.average_health_score);
272
- getSpendingFeeTransactions = async () => this.fetchInstance.get(`${h.HEALTH_SCORES}/transactions/spending_fee`).then((t) => t);
273
- getStandardSpend = async () => this.fetchInstance.get(`${h.HEALTH_SCORES}/transactions/standard_spend`).then((t) => t);
274
- }
275
- class te {
276
- api = new R("/", "");
277
- augmentedChartData = [];
278
- averageHealthScores = [];
279
- monthlySummaries = [];
280
- allTransactions = {
281
- income: [],
282
- debtSpend: [],
283
- spendingFee: [],
284
- spend: []
285
- };
286
- globalStore;
287
- healthScore = {};
288
- healthScoreChange;
289
- healthScoreChangeReports = [];
290
- peerScore = null;
291
- constructor(t) {
292
- this.globalStore = t, this.api = new R(t.endpoint, t.sessionToken, t.onError), b(this);
293
- }
294
- calculateHealthScore = async () => {
295
- try {
296
- const t = await this.api.calculateHealthScore();
297
- let r = 0;
298
- await this.loadHealthScoreChangeReports();
299
- const n = t?.health_score || 0, a = this.healthScoreChangeReports.at(-1)?.older_health_score || 0;
300
- r = n - a, l(() => {
301
- this.healthScore = t, this.healthScoreChange = r;
302
- });
303
- } catch (t) {
304
- console.error("Error calculating health score:", t);
305
- }
306
- };
307
- loadAverageHealthScores = async () => {
308
- try {
309
- const t = await this.api.getAverageHealthScores();
310
- l(() => {
311
- this.averageHealthScores = t;
312
- });
313
- } catch (t) {
314
- console.error("Error loading average health scores:", t);
315
- }
316
- };
317
- loadMonthlySummaries = async () => {
318
- try {
319
- const t = await this.api.getMonthlySummaries();
320
- l(() => {
321
- this.monthlySummaries = t;
322
- });
323
- } catch (t) {
324
- console.error("Error loading monthly summaries:", t);
325
- }
326
- };
327
- loadDebtSpend = async () => {
328
- try {
329
- const t = await this.api.getDebtSpend();
330
- l(() => {
331
- this.allTransactions.debtSpend = t;
332
- });
333
- } catch (t) {
334
- console.error("Error loading debt spend:", t);
335
- }
336
- };
337
- loadIncome = async () => {
338
- try {
339
- const t = await this.api.getIncome();
340
- l(() => {
341
- this.allTransactions.income = t;
342
- });
343
- } catch (t) {
344
- console.error("Error loading income:", t);
345
- }
346
- };
347
- loadHealthScoreChangeReports = async () => {
348
- const t = I(x(/* @__PURE__ */ new Date(), 2)), r = I(/* @__PURE__ */ new Date());
349
- try {
350
- const n = await this.api.getHealthScoreChangeReports(
351
- t,
352
- r
353
- );
354
- l(() => {
355
- this.healthScoreChangeReports = n;
356
- });
357
- } catch (n) {
358
- console.error("Error loading health score change reports:", n);
359
- }
360
- };
361
- loadPeerScore = async () => {
362
- const t = y(D(this.globalStore.appDataStore.user.birthday), "yyyy");
363
- try {
364
- const r = await this.api.getPeerScore(t);
365
- l(() => {
366
- this.peerScore = r;
367
- });
368
- } catch (r) {
369
- console.error("Error loading peer score:", r);
370
- }
371
- };
372
- loadAugmentedChartData = async () => {
373
- try {
374
- const t = await this.api.getAverageHealthScores();
375
- l(() => {
376
- this.augmentedChartData = nt(t);
377
- });
378
- } catch (t) {
379
- console.error(`Error occurred while getting augmented chart data: ${t}`);
380
- }
381
- };
382
- getSpendingFeeTransactions = async () => {
383
- try {
384
- const t = await this.api.getSpendingFeeTransactions(), r = ot(t);
385
- l(() => {
386
- this.allTransactions.spendingFee = r;
387
- });
388
- } catch (t) {
389
- console.error(`Error occurred while getting spending fee transactions: ${t}`);
390
- }
391
- };
392
- loadSpendTransactions = async () => {
393
- try {
394
- const t = await this.api.getStandardSpend();
395
- l(() => {
396
- this.allTransactions.spend = [...t];
397
- });
398
- } catch (t) {
399
- console.error("Error loading spend transactions:", t);
400
- }
401
- };
402
- get spendAndDebtTransactions() {
403
- return [...this.allTransactions.spend, ...this.allTransactions.debtSpend];
404
- }
405
- }
406
- export {
407
- _ as A,
408
- u as C,
409
- te as F,
410
- vt as P,
411
- Nt as a,
412
- Pt as b,
413
- Gt as c,
414
- Lt as d,
415
- g as e,
416
- Zt as f,
417
- wt as g,
418
- zt as h,
419
- S as i,
420
- Vt as j,
421
- Qt as k,
422
- Jt as l,
423
- Wt as m,
424
- qt as n,
425
- Kt as o,
426
- Q as p,
427
- Yt as q,
428
- Mt as r,
429
- $t as s,
430
- Bt as t,
431
- jt as u,
432
- Ut as v,
433
- Xt as w,
434
- kt as x,
435
- R as y
436
- };