@mx-cartographer/experiences 6.26.33-alpha.mm0 → 7.0.0-alpha.mega1

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 (104) hide show
  1. package/CHANGELOG.md +2 -3
  2. package/dist/Account-DY6nxO7y.mjs +30 -0
  3. package/dist/AccountDetailsContent-DvPs81kL.mjs +677 -0
  4. package/dist/AccountDetailsHeader-W2U7ZVm_.mjs +119 -0
  5. package/dist/AccountFields-DAVcbZy5.mjs +135 -0
  6. package/dist/AccountListItem-DFlbdcmT.mjs +90 -0
  7. package/dist/AccountStore-CU7qV3vg.mjs +230 -0
  8. package/dist/Accounts-BLlrQA5m.mjs +9 -0
  9. package/dist/BeatApi-DLu87ijw.mjs +21 -0
  10. package/dist/BeatStore-By4aGoRM.mjs +81 -0
  11. package/dist/BudgetUtil-Ci1TN0J5.mjs +101 -0
  12. package/dist/CashflowStore-D9Dpuz7X.mjs +91 -0
  13. package/dist/Category-5S6uwuXz.mjs +301 -0
  14. package/dist/CategorySelectorDrawer-rHyHHYuh.mjs +397 -0
  15. package/dist/CategoryStore-B5EW6I1d.mjs +183 -0
  16. package/dist/CategoryUtil-DRyruNgi.mjs +78 -0
  17. package/dist/ConnectDrawer-D9cR5phc.mjs +508 -0
  18. package/dist/ConnectionsDrawer-BzGqljSp.mjs +52 -0
  19. package/dist/CurrencyInput-D74cemI2.mjs +83 -0
  20. package/dist/CurrencyText-YUhH2caW.mjs +20 -0
  21. package/dist/DateUtil-BcuH7ErC.mjs +48 -0
  22. package/dist/DebtsStore-S0l9kr0r.mjs +60 -0
  23. package/dist/Dialog-CWW597AF.mjs +123 -0
  24. package/dist/Donut-1UMNcG67.mjs +57 -0
  25. package/dist/Drawer-kEE73B87.mjs +113 -0
  26. package/dist/EmptyState-Dcb-o2tl.mjs +55 -0
  27. package/dist/Fetch-CkFKy79O.mjs +116 -0
  28. package/dist/FinstrongStore-mkALvztw.mjs +101 -0
  29. package/dist/GoalStore-DioeeL-s.mjs +263 -0
  30. package/dist/HeaderCell-DjuifqHJ.mjs +6 -0
  31. package/dist/Help-DhcC-C05.mjs +320 -0
  32. package/dist/Help-DpYRO8oA.mjs +3181 -0
  33. package/dist/IconBacking-B9oC6uL2.mjs +39 -0
  34. package/dist/InvestmentUtil-jOyOgzIB.mjs +134 -0
  35. package/dist/LineChart-CcyX38kK.mjs +499 -0
  36. package/dist/ListItemAction-BabpYivr.mjs +69 -0
  37. package/dist/Loader-Dp1P2gNw.mjs +14 -0
  38. package/dist/Localization-2MODESHW.mjs +30 -0
  39. package/dist/ManageIncome-ndMuhJMG.mjs +535 -0
  40. package/dist/MerchantStore-DVH-QOf0.mjs +37 -0
  41. package/dist/MicroWidgetContainer-CsvHLYKX.mjs +45 -0
  42. package/dist/MiniWidgetContainer-BoOp-A05.mjs +39 -0
  43. package/dist/NetWorthStore-PD-RUe09.mjs +150 -0
  44. package/dist/Notification-AMGWM1Al.mjs +78 -0
  45. package/dist/NotificationSettings-VhHuMAFU.mjs +667 -0
  46. package/dist/NotificationStore-DHtSGySy.mjs +67 -0
  47. package/dist/NumberFormatting-CtWHhyBX.mjs +40 -0
  48. package/dist/OriginalBalanceAction-D39mx6uE.mjs +115 -0
  49. package/dist/RecurringSettings-D_HnMYZP.mjs +57 -0
  50. package/dist/RecurringTransactionsStore-BKLD3OWo.mjs +263 -0
  51. package/dist/RepeatingTransaction-BPWfaB3f.mjs +282 -0
  52. package/dist/SearchBox-B2_zLv8-.mjs +42 -0
  53. package/dist/SettingsStore-CE7jDVFL.mjs +265 -0
  54. package/dist/SingleSegmentDonut-BgbLgwHi.mjs +69 -0
  55. package/dist/SpendingData-BkrxzHdr.mjs +55 -0
  56. package/dist/StatusBar-BK_uYHAB.mjs +30 -0
  57. package/dist/TabContentContainer-j01JYR_7.mjs +21 -0
  58. package/dist/Transaction-CA0FW2Ij.mjs +312 -0
  59. package/dist/TransactionApi-DbbcjI2L.mjs +86 -0
  60. package/dist/TransactionDetails-WBHFmbxL.mjs +1283 -0
  61. package/dist/TransactionStore-CeLdmVnC.mjs +669 -0
  62. package/dist/TrendsStore-BHJUapXF.mjs +487 -0
  63. package/dist/ViewMoreMicroCard-CAPFNz-J.mjs +1959 -0
  64. package/dist/WidgetContainer-DWCusxYI.mjs +556 -0
  65. package/dist/accounts/index.es.js +752 -0
  66. package/dist/analytics/index.es.js +171 -0
  67. package/dist/budgets/index.es.js +1075 -0
  68. package/dist/cashflow/index.es.js +1098 -0
  69. package/dist/categories/index.es.js +9 -0
  70. package/dist/common/components/WidgetContainer.d.ts +1 -1
  71. package/dist/common/components/charts/LineChart.d.ts +0 -1
  72. package/dist/common/constants/Analytics.d.ts +10 -20
  73. package/dist/common/context/hooks.d.ts +13 -13
  74. package/dist/common/index.es.js +1451 -0
  75. package/dist/dashboard/index.es.js +181 -0
  76. package/dist/debts/index.es.js +1460 -0
  77. package/dist/exportTransactionsToCSV-CmwsKl2D.mjs +47 -0
  78. package/dist/finstrong/index.es.js +1455 -0
  79. package/dist/goals/index.es.js +1209 -0
  80. package/dist/help/components/content/section/index.d.ts +15 -15
  81. package/dist/help/index.es.js +14 -0
  82. package/dist/hooks-30y_BLwc.mjs +71 -0
  83. package/dist/index.d.ts +0 -22
  84. package/dist/insights/index.d.ts +1 -0
  85. package/dist/insights/index.es.js +4 -0
  86. package/dist/investments/index.es.js +1638 -0
  87. package/dist/merchants/index.es.js +79 -0
  88. package/dist/microinsights/components/carouselheader/CarouselHeader.d.ts +0 -1
  89. package/dist/microinsights/components/microBeatCarousel/MicroBeatCarousel.d.ts +0 -1
  90. package/dist/microinsights/index.es.js +16 -0
  91. package/dist/networth/index.es.js +576 -0
  92. package/dist/notifications/index.es.js +192 -0
  93. package/dist/recurringtransactions/index.es.js +879 -0
  94. package/dist/settings/index.es.js +879 -0
  95. package/dist/spending/index.es.js +570 -0
  96. package/dist/transactions/index.es.js +587 -0
  97. package/dist/trends/index.es.js +1086 -0
  98. package/dist/useCombineEvents-DaDBSR_1.mjs +92 -0
  99. package/dist/useDimensions-27p2evRx.mjs +36 -0
  100. package/dist/useScreenSize-B6JyS_Lj.mjs +36 -0
  101. package/package.json +155 -3
  102. package/dist/index.es.js +0 -30564
  103. package/dist/index.es.js.map +0 -1
  104. package/dist/trends/constants/TrendsWidget.d.ts +0 -3
@@ -0,0 +1,119 @@
1
+ import { jsx as e, jsxs as u } from "react/jsx-runtime";
2
+ import { observer as p } from "mobx-react-lite";
3
+ import d from "@mui/material/Stack";
4
+ import { H3 as w, InstitutionLogo as I, Text as m, H2 as L } from "@mxenabled/mxui";
5
+ import { g as N } from "./AccountFields-DAVcbZy5.mjs";
6
+ import h from "react";
7
+ import { G as v, c as S, k as y, u as _, l as E } from "./hooks-30y_BLwc.mjs";
8
+ import G from "@mui/material/Card";
9
+ import O from "@mui/material/CardContent";
10
+ import P from "@mui/material/CardHeader";
11
+ import { useTheme as M } from "@mui/material/styles";
12
+ import { g as B, a as H, b as U } from "./SpendingData-BkrxzHdr.mjs";
13
+ import { L as j } from "./LineChart-CcyX38kK.mjs";
14
+ import { I as f, P as g, S as C } from "./Account-DY6nxO7y.mjs";
15
+ import { A } from "./ConnectDrawer-D9cR5phc.mjs";
16
+ import { L as z } from "./Loader-Dp1P2gNw.mjs";
17
+ import { f as Y, D as k } from "./Dialog-CWW597AF.mjs";
18
+ import { f as R } from "./NumberFormatting-CtWHhyBX.mjs";
19
+ const b = () => {
20
+ if (!h.useContext(v))
21
+ throw new Error("useCategoryUiStore() must be used within the GlobalDataContext");
22
+ return S().uiStore;
23
+ }, $ = (o, n) => {
24
+ const t = f.includes(n) ? B(o) : [], a = g.includes(n) ? H(o) : [], r = C.includes(n) ? U(o) : [];
25
+ return [t, a, r].filter((s) => s.length > 0);
26
+ }, F = (o, n, t) => {
27
+ const [a, r] = o, s = a, c = r ?? a, i = [];
28
+ if (s && c && f.includes(n)) {
29
+ const l = s[s.length - 1].y;
30
+ i.push({ label: t.income_label, amount: l });
31
+ } else if (g.includes(n)) {
32
+ const l = s[s.length - 1].y;
33
+ i.push({ label: t.payments_label, amount: l });
34
+ }
35
+ if (c && C.includes(n)) {
36
+ const l = c[c.length - 1].y;
37
+ i.push({ label: t.spending_label, amount: l });
38
+ }
39
+ return i;
40
+ }, V = () => {
41
+ const o = M(), { selectedAccount: n } = b(), { monthlyCategoryTotals: t } = y(), { trends: a } = _(), r = [o.palette.chart?.chart1, o.palette.chart?.chart2], s = $(t, n.account_type), c = F(s, n.account_type, a), i = [A.LOAN, A.MORTGAGE].includes(n.account_type);
42
+ return /* @__PURE__ */ e("div", { "data-testid": "TrendsChart", children: /* @__PURE__ */ e(
43
+ j,
44
+ {
45
+ colors: r,
46
+ datasets: s,
47
+ height: 185,
48
+ labels: c,
49
+ showAverage: i,
50
+ showBars: i,
51
+ showLegend: !0,
52
+ valueFormatterString: "0,0"
53
+ }
54
+ ) });
55
+ }, W = p(V), q = ({ sx: o }) => {
56
+ const { loadMonthlyCategoryTotals: n } = y(), { isInitialized: t } = E(), { selectedAccount: a } = b(), [r, s] = h.useState(!1);
57
+ return h.useEffect(() => {
58
+ t && n([a]).finally(() => {
59
+ s(!0);
60
+ });
61
+ }, [t, a]), !t || !r ? /* @__PURE__ */ e(z, {}) : /* @__PURE__ */ u(
62
+ G,
63
+ {
64
+ sx: {
65
+ "& .MuiCardContent-root:last-child": {
66
+ pb: 0
67
+ },
68
+ ...o
69
+ },
70
+ children: [
71
+ /* @__PURE__ */ e(
72
+ P,
73
+ {
74
+ sx: { pb: 0 },
75
+ title: /* @__PURE__ */ e(w, { sx: { pb: 4 }, children: Y(/* @__PURE__ */ new Date(), k.MONTH_LONG) })
76
+ }
77
+ ),
78
+ /* @__PURE__ */ e(O, { sx: { p: 0 }, children: /* @__PURE__ */ e(W, {}) })
79
+ ]
80
+ }
81
+ );
82
+ }, J = p(q), K = ({ customDetailsChart: o }) => {
83
+ const { institutions: n } = S(), { selectedAccount: t } = b(), { accounts: a } = _(), { firstSubtitle: r, firstValue: s, hasAvailableBalance: c, secondSubtitle: i, secondValue: l } = N(t, a), T = n.find(
84
+ (x) => x.guid === t?.institution_guid
85
+ ), D = [
86
+ ...f,
87
+ ...g,
88
+ ...C
89
+ ].includes(t.account_type);
90
+ return /* @__PURE__ */ u(d, { bgcolor: "background.default", p: 24, children: [
91
+ /* @__PURE__ */ u(d, { gap: 12, children: [
92
+ /* @__PURE__ */ e(
93
+ I,
94
+ {
95
+ alt: a.institution_logo_alt,
96
+ institutionGuid: t.institution_guid || "",
97
+ size: 64
98
+ }
99
+ ),
100
+ /* @__PURE__ */ e(m, { variant: "Small", children: T?.name })
101
+ ] }),
102
+ /* @__PURE__ */ u(d, { gap: 8, mb: 24, mt: 4, children: [
103
+ /* @__PURE__ */ e(L, { children: t.name || t.feed_name }),
104
+ /* @__PURE__ */ u(d, { direction: "row", justifyContent: "space-between", children: [
105
+ /* @__PURE__ */ e(m, { bold: c, variant: "Body", children: r }),
106
+ /* @__PURE__ */ e(m, { bold: !0, variant: "Body", children: R(s, "0,0.00") })
107
+ ] }),
108
+ /* @__PURE__ */ u(d, { direction: "row", justifyContent: "space-between", children: [
109
+ /* @__PURE__ */ e(m, { variant: "Small", children: i }),
110
+ /* @__PURE__ */ e(m, { variant: "Small", children: l })
111
+ ] })
112
+ ] }),
113
+ D && /* @__PURE__ */ e(d, { children: o || /* @__PURE__ */ e(J, {}) })
114
+ ] });
115
+ }, ft = p(K);
116
+ export {
117
+ ft as A,
118
+ b as u
119
+ };
@@ -0,0 +1,135 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { Icon as p, Text as c } from "@mxenabled/mxui";
3
+ import { F as m, A as b, a as v, P as h, b as F } from "./ConnectDrawer-D9cR5phc.mjs";
4
+ import { i as D, u as T, a as A, b as O, c as g } from "./Accounts-BLlrQA5m.mjs";
5
+ import { f as _, i as d, a as N, b as S } from "./NumberFormatting-CtWHhyBX.mjs";
6
+ import { b as i } from "./Localization-2MODESHW.mjs";
7
+ import { f, D as o } from "./Dialog-CWW597AF.mjs";
8
+ const w = (l, e) => {
9
+ const r = [
10
+ {
11
+ event: "account_details_click_account_name",
12
+ label: e.account_name,
13
+ name: "user_name",
14
+ placeholder: i(e.enter_value, e.account_name),
15
+ type: m.Input,
16
+ validation: (a) => a ? "" : i(e.field_is_required, e.account_name),
17
+ valueFormatter: (a) => a
18
+ }
19
+ ];
20
+ if (D(l)) {
21
+ r.unshift({
22
+ label: e.account_balance,
23
+ name: "balance",
24
+ placeholder: i(e.enter_value, e.account_balance),
25
+ type: m.Currency,
26
+ valueFormatter: (t) => _(t, "0,0.00")
27
+ });
28
+ const a = Object.keys(b).filter((t) => Number(t)).map((t) => ({
29
+ label: e.account_types[t],
30
+ value: Number(t),
31
+ icon: /* @__PURE__ */ s(p, { name: v[t] })
32
+ }));
33
+ r.push({
34
+ label: e.account_type,
35
+ name: "account_type",
36
+ options: a,
37
+ placeholder: i(e.select_value, e.account_type),
38
+ type: m.Select,
39
+ valueFormatter: (t) => a.find((n) => n.value === t)?.label
40
+ });
41
+ }
42
+ if (l.account_type === b.PROPERTY) {
43
+ const a = Object.keys(h).filter((t) => Number(t)).map((t) => ({
44
+ label: e.property_types[t],
45
+ value: Number(t),
46
+ icon: /* @__PURE__ */ s(p, { name: F[t] })
47
+ }));
48
+ r.push({
49
+ label: e.property_type,
50
+ name: "property_type",
51
+ options: a,
52
+ placeholder: i(e.select_value, e.property_type),
53
+ type: m.Select,
54
+ valueFormatter: (t) => a.find((n) => n.value === t)?.label
55
+ });
56
+ }
57
+ if (T(l)) {
58
+ let a = e.interest_rate, t = "interest_rate";
59
+ l.is_manual || (typeof l.apr == "number" && (a = e.apr, t = "apr"), typeof l.apy == "number" && (a = e.apy, t = "apy")), r.push({
60
+ event: "account_details_click_interest_rate",
61
+ label: a,
62
+ name: t,
63
+ placeholder: i(e.enter_value, a),
64
+ type: m.Input,
65
+ validation: (n) => d(n) ? "" : e.error_amount_is_invalid,
66
+ valueFormatter: (n) => d(n) ? N(n / 100) : n
67
+ });
68
+ }
69
+ return A(l) && (r.push({
70
+ label: e.minimum_payment,
71
+ name: "minimum_payment",
72
+ placeholder: i(e.enter_value, e.minimum_payment),
73
+ type: m.Currency,
74
+ valueFormatter: (a) => _(a, "0,0.00")
75
+ }), l.payment_due_at ? r.push({
76
+ label: e.next_payment,
77
+ name: "payment_due_at",
78
+ type: m.Date,
79
+ valueFormatter: (a) => {
80
+ const t = typeof a == "number" ? new Date(a * 1e3) : a;
81
+ return f(t, o.MED_MONTH_SHORT_DAY_FULL_YEAR);
82
+ }
83
+ }) : r.push({
84
+ label: e.day_payment_due,
85
+ name: "day_payment_is_due",
86
+ placeholder: i(e.enter_value, e.day_payment_due),
87
+ type: m.Date,
88
+ valueFormatter: (a) => i(
89
+ e.day_of_every_month,
90
+ S(a <= 31 ? a : new Date(a).getDate())
91
+ )
92
+ })), O(l) && r.push({
93
+ label: e.credit_limit,
94
+ name: "credit_limit",
95
+ placeholder: i(e.enter_value, e.credit_limit),
96
+ type: m.Currency,
97
+ valueFormatter: (a) => _(a, "0,0.00")
98
+ }), g(l) && r.push({
99
+ label: e.original_balance,
100
+ minAmount: 1,
101
+ name: "original_balance",
102
+ placeholder: i(e.enter_value, e.original_balance),
103
+ type: m.Currency,
104
+ valueFormatter: (a) => _(a, "0,0.00")
105
+ }), r;
106
+ }, x = (l, e) => {
107
+ let r = "", a = null, t = null, n = null, u = !1;
108
+ switch (l.account_type) {
109
+ case 1:
110
+ case 2: {
111
+ l.available_balance ? (r = e.available_balance, a = l.available_balance, t = l.available_balance ? e.current_balance : null, n = _(l.balance, "0,0.00"), u = !0) : (r = e.current_balance, a = l.balance);
112
+ break;
113
+ }
114
+ default:
115
+ if (r = e.current_balance, a = l.balance, l.minimum_payment && l.payment_due_at) {
116
+ const y = typeof l.payment_due_at == "number" ? new Date(l.payment_due_at * 1e3) : l.payment_due_at;
117
+ t = /* @__PURE__ */ s(c, { component: "strong", variant: "XSmall", children: i(
118
+ e.payment_due_on,
119
+ _(l.minimum_payment, "0,0.00"),
120
+ f(y, o.FULL_MONTH_DAY)
121
+ ) });
122
+ } else l.credit_limit && (t = e.available_credit, n = _(l.credit_limit - (l?.balance ?? 0), "0,0.00"));
123
+ }
124
+ return {
125
+ firstSubtitle: r,
126
+ firstValue: a,
127
+ secondSubtitle: t,
128
+ secondValue: n,
129
+ hasAvailableBalance: u
130
+ };
131
+ };
132
+ export {
133
+ w as a,
134
+ x as g
135
+ };
@@ -0,0 +1,90 @@
1
+ import { jsx as e, jsxs as r, Fragment as a } from "react/jsx-runtime";
2
+ import { observer as b } from "mobx-react-lite";
3
+ import y from "@mui/material/Badge";
4
+ import l from "@mui/material/Box";
5
+ import I from "@mui/material/ListItem";
6
+ import S from "@mui/material/ListItemAvatar";
7
+ import _ from "@mui/material/ListItemButton";
8
+ import v from "@mui/material/ListItemText";
9
+ import C from "@mui/material/styles/useTheme";
10
+ import { InstitutionLogo as B, Text as o } from "@mxenabled/mxui";
11
+ import "@mui/icons-material/CheckCircle";
12
+ import L from "@mui/icons-material/Error";
13
+ import { I as A } from "./IconBacking-B9oC6uL2.mjs";
14
+ import { g as j } from "./AccountFields-DAVcbZy5.mjs";
15
+ import { d } from "./ConnectDrawer-D9cR5phc.mjs";
16
+ import { u as T } from "./hooks-30y_BLwc.mjs";
17
+ import { f as X } from "./NumberFormatting-CtWHhyBX.mjs";
18
+ const $ = {
19
+ gridRow: 1,
20
+ gridColumn: 1,
21
+ zIndex: 2
22
+ }, k = ({ size: t = 20 }) => /* @__PURE__ */ e(A, { size: t, children: /* @__PURE__ */ e(L, { color: "error", sx: { fontSize: t, ...$ } }) }), w = ({
23
+ account: t,
24
+ onRowClick: n,
25
+ listItemProps: c,
26
+ shouldShowConnectionStatus: p = !1
27
+ }) => {
28
+ const f = C(), { accounts: i } = T(), { firstSubtitle: u, firstValue: h, secondSubtitle: g, secondValue: x } = j(
29
+ t,
30
+ i
31
+ );
32
+ let s;
33
+ (t.connectionStatus === d.Error || t.connectionStatus === d.RequiresMfa) && (s = /* @__PURE__ */ e(k, { size: 16 }));
34
+ const m = /* @__PURE__ */ r(a, { children: [
35
+ /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(
36
+ y,
37
+ {
38
+ badgeContent: p ? s : void 0,
39
+ sx: {
40
+ "& .MuiBadge-badge": {
41
+ right: -1
42
+ }
43
+ },
44
+ children: /* @__PURE__ */ e(B, { alt: "MX", institutionGuid: t.institution_guid || "" })
45
+ }
46
+ ) }),
47
+ /* @__PURE__ */ e(
48
+ v,
49
+ {
50
+ disableTypography: !0,
51
+ primary: /* @__PURE__ */ r(
52
+ o,
53
+ {
54
+ bold: !0,
55
+ color: t.is_hidden ? f.palette.text.secondary : void 0,
56
+ sx: { whiteSpace: "normal" },
57
+ variant: "Body",
58
+ children: [
59
+ `${t.name || t.feed_name} ${t.account_number ? `*${t.account_number}` : ""}`,
60
+ " ",
61
+ t.is_hidden && !t.is_closed && i.is_hidden,
62
+ t.is_closed && i.is_closed
63
+ ]
64
+ }
65
+ ),
66
+ secondary: /* @__PURE__ */ r(a, { children: [
67
+ /* @__PURE__ */ r(l, { sx: { alignItems: "center", display: "flex", justifyContent: "space-between" }, children: [
68
+ /* @__PURE__ */ e(o, { variant: "XSmall", children: u }),
69
+ /* @__PURE__ */ e(o, { bold: !0, variant: "Small", children: X(h, "0,0.00") })
70
+ ] }),
71
+ /* @__PURE__ */ r(l, { sx: { alignItems: "center", display: "flex", justifyContent: "space-between" }, children: [
72
+ /* @__PURE__ */ e(o, { variant: "XSmall", children: g }),
73
+ /* @__PURE__ */ e(o, { ml: "auto", variant: "XSmall", children: x })
74
+ ] })
75
+ ] })
76
+ }
77
+ )
78
+ ] });
79
+ return /* @__PURE__ */ e(
80
+ I,
81
+ {
82
+ sx: { backgroundColor: "background.paper", color: t.is_closed ? "grey.700" : "" },
83
+ ...c,
84
+ children: n ? /* @__PURE__ */ e(_, { alignItems: "flex-start", onClick: n, sx: { px: 24 }, children: m }) : m
85
+ }
86
+ );
87
+ }, W = b(w);
88
+ export {
89
+ W as A
90
+ };
@@ -0,0 +1,230 @@
1
+ import { makeAutoObservable as m, runInAction as a } from "mobx";
2
+ import { F as A, A as o } from "./Fetch-CkFKy79O.mjs";
3
+ import { A as n, d as u, E as _, g, h as f } from "./ConnectDrawer-D9cR5phc.mjs";
4
+ class l {
5
+ fetchInstance;
6
+ constructor(t, e) {
7
+ this.fetchInstance = new A(t, e);
8
+ }
9
+ createAccount = async (t) => this.fetchInstance.post(o.ACCOUNTS, t).then((e) => e.account).catch((e) => e);
10
+ deleteAccount = async (t) => this.fetchInstance.delete(`${o.ACCOUNTS}/${t}`).catch((e) => e);
11
+ getAccounts = async () => this.fetchInstance.get(o.ACCOUNTS).then((t) => t.accounts).catch((t) => t);
12
+ getInstitutions = async () => this.fetchInstance.get(o.INSTITUTIONS).then((t) => t).catch((t) => t);
13
+ getMembers = async () => this.fetchInstance.get(o.MEMBERS).then((t) => t.members).catch((t) => t);
14
+ getMonthlyAccountBalances = async (t) => this.fetchInstance.get(`${o.ACCOUNTS}/${t}/monthly_account_balances`).then((e) => e.monthly_account_balances).catch((e) => e);
15
+ mergeAccounts = async (t) => this.fetchInstance.put(`${o.ACCOUNTS}/merge`, { accounts: t }).then((e) => e).catch((e) => e);
16
+ refreshAllMembers = async () => this.fetchInstance.get(`${o.MEMBERS}/refresh_all`).then((t) => t).catch((t) => t);
17
+ updateAccount = async (t) => this.fetchInstance.put(`${o.ACCOUNTS}/${t.guid}`, t).then((e) => e.account).catch((e) => e);
18
+ }
19
+ class p {
20
+ isLoading = !1;
21
+ selectedAccount = {};
22
+ selectedMember = {};
23
+ constructor() {
24
+ m(this);
25
+ }
26
+ setIsLoading = (t) => this.isLoading = t;
27
+ setSelectedAccount = (t) => this.selectedAccount = t;
28
+ setSelectedMember = (t) => this.selectedMember = t;
29
+ }
30
+ class C {
31
+ globalStore;
32
+ api = new l("/", "");
33
+ accounts = [];
34
+ institutions = [];
35
+ members = [];
36
+ uiStore;
37
+ constructor(t) {
38
+ this.globalStore = t, this.uiStore = new p(), this.api = new l(t.endpoint, t.sessionToken), m(this);
39
+ }
40
+ loadAccountData = async ({
41
+ accounts: t,
42
+ institutions: e
43
+ } = {}) => {
44
+ await Promise.all([this.loadAccounts(t), this.loadInstitutions(e)]);
45
+ };
46
+ get cashAccounts() {
47
+ return this.accounts.filter(
48
+ (t) => t.account_type === n.CASH || t.account_type === n.CHECKING || t.account_type === n.PREPAID || t.account_type === n.SAVINGS || t.account_type === n.CHECKING_LINE_OF_CREDIT
49
+ );
50
+ }
51
+ get cashBalance() {
52
+ return this.cashAccounts.reduce((t, e) => t + (e?.balance || 0), 0);
53
+ }
54
+ get checkingAccounts() {
55
+ return this.accounts.filter((t) => t.account_type === n.CHECKING);
56
+ }
57
+ get debtAccounts() {
58
+ return this.accounts.filter(
59
+ (t) => t.account_type === n.CREDIT_CARD || t.account_type === n.LOAN || t.account_type === n.MORTGAGE || t.account_type === n.LINE_OF_CREDIT || t.account_type === n.CHECKING_LINE_OF_CREDIT
60
+ );
61
+ }
62
+ get finstrongAccounts() {
63
+ const t = /* @__PURE__ */ new Set([
64
+ n.CHECKING,
65
+ n.SAVINGS,
66
+ n.CREDIT_CARD,
67
+ n.INVESTMENT
68
+ ]);
69
+ return this.accounts.filter((e) => t.has(e.account_type));
70
+ }
71
+ get investmentAccounts() {
72
+ return this.accounts.filter(
73
+ (t) => t.account_type === n.INVESTMENT
74
+ );
75
+ }
76
+ get savingsAccounts() {
77
+ return this.accounts.filter((t) => t.account_type === n.SAVINGS);
78
+ }
79
+ get visibleAccounts() {
80
+ return this.accounts.filter((t) => !t.is_hidden);
81
+ }
82
+ get visibleCashAccounts() {
83
+ return this.cashAccounts.filter((t) => !t.is_hidden);
84
+ }
85
+ get visibleCashBalance() {
86
+ return this.visibleCashAccounts.reduce((t, e) => t + (e?.balance || 0), 0);
87
+ }
88
+ get visibleCheckingAccounts() {
89
+ return this.checkingAccounts.filter((t) => !t.is_hidden);
90
+ }
91
+ get visibleDebtAccounts() {
92
+ return this.debtAccounts.filter((t) => !t.is_hidden);
93
+ }
94
+ get visibleFinstrongAccounts() {
95
+ return this.finstrongAccounts.filter(
96
+ (t) => !(t.is_closed || t.is_deleted || t.is_hidden)
97
+ );
98
+ }
99
+ get visibleInvestmentAccounts() {
100
+ return this.investmentAccounts.filter((t) => !t.is_hidden);
101
+ }
102
+ get visibleSavingsAccounts() {
103
+ return this.savingsAccounts.filter((t) => !t.is_hidden);
104
+ }
105
+ addAccount = async (t) => {
106
+ try {
107
+ const e = await this.api.createAccount(t);
108
+ a(() => {
109
+ this.accounts = [...this.accounts, e];
110
+ });
111
+ } catch (e) {
112
+ console.error(`Error occurred while adding an account: ${e}`);
113
+ }
114
+ };
115
+ augmentAccounts = (t = this.accounts) => {
116
+ const e = [];
117
+ return t.forEach((c) => {
118
+ const s = this.members.findIndex(
119
+ (r) => r.guid === c.member_guid
120
+ );
121
+ if (s > -1) {
122
+ let r = u.Connected;
123
+ const i = this.members[s];
124
+ _.includes(i.connection_status) ? r = u.Error : g.includes(i.connection_status) ? r = u.Processing : f.includes(i.connection_status) && (r = u.RequiresMfa);
125
+ let h = c.user_name || c.feed_name || "";
126
+ c.account_number && (h = `${h} *${c.account_number}`), e.push({
127
+ ...c,
128
+ institutionName: h,
129
+ memberName: i.name,
130
+ connectionStatus: r
131
+ }), this.members[s].connectionStatus = r;
132
+ }
133
+ }), e;
134
+ };
135
+ loadAccounts = async (t) => {
136
+ await this.loadMembers();
137
+ try {
138
+ const e = t || await this.api.getAccounts();
139
+ a(() => {
140
+ this.accounts = this.sortAccounts(this.augmentAccounts(e));
141
+ });
142
+ } catch (e) {
143
+ console.error(`Error occurred while loading accounts: ${e}`);
144
+ }
145
+ };
146
+ loadInstitutions = async (t) => {
147
+ try {
148
+ const e = t || await this.api.getInstitutions();
149
+ a(() => {
150
+ this.institutions = e;
151
+ });
152
+ } catch (e) {
153
+ console.error(`Error occurred while loading institutions: ${e}`);
154
+ }
155
+ };
156
+ loadMembers = async () => {
157
+ try {
158
+ const t = await this.api.getMembers();
159
+ a(() => {
160
+ this.members = t;
161
+ });
162
+ } catch (t) {
163
+ console.error(`Error occurred while loading members: ${t}`);
164
+ }
165
+ };
166
+ mergeAccounts = async (t) => {
167
+ try {
168
+ const e = await this.api.mergeAccounts(t), c = e[Object.keys(e)[0]];
169
+ a(() => {
170
+ const s = this.accounts.findIndex((i) => i.guid === t[1]);
171
+ this.accounts.splice(s, 1);
172
+ const r = this.accounts.findIndex((i) => i.guid === t[0]);
173
+ this.accounts.splice(r, 1, c);
174
+ });
175
+ } catch (e) {
176
+ console.error(`Error occurred while merging accounts: ${e}`);
177
+ }
178
+ };
179
+ sortAccounts = (t = this.accounts) => t.sort((e, c) => e.account_type > c.account_type ? 1 : e.account_type < c.account_type ? -1 : (e.name || "") > (c.name || "") ? 1 : (e.name || "") < (c.name || "") ? -1 : 0);
180
+ refreshAccounts = async () => {
181
+ this.uiStore.setIsLoading(!0), await Promise.all([this.loadAccounts(), this.loadInstitutions()]), this.uiStore.setIsLoading(!1);
182
+ };
183
+ refreshMembers = async () => {
184
+ try {
185
+ await this.api.refreshAllMembers(), await this.loadMembers();
186
+ } catch (t) {
187
+ console.error(`Error occurredwhile refreshing members: ${t}`);
188
+ }
189
+ };
190
+ removeAccount = async (t) => {
191
+ try {
192
+ await this.api.deleteAccount(t), a(() => {
193
+ const e = this.accounts.findIndex((c) => c.guid === t);
194
+ this.accounts.splice(e, 1);
195
+ });
196
+ } catch (e) {
197
+ console.error(`Error occurred while removing an account: ${e}`);
198
+ }
199
+ };
200
+ updateAccount = async (t) => {
201
+ try {
202
+ const e = await this.api.updateAccount(t);
203
+ a(() => {
204
+ const c = this.accounts.findIndex(
205
+ (s) => s.guid === e.guid
206
+ );
207
+ this.accounts.splice(c, 1, e), this.accounts = this.augmentAccounts(this.accounts);
208
+ });
209
+ } catch (e) {
210
+ console.error(`Error occurred while updating account: ${e}`);
211
+ }
212
+ };
213
+ updateAccountFiltering = async (t, e) => {
214
+ for (const c of t) {
215
+ const s = this.accounts.find((r) => r.guid === c);
216
+ if (s) {
217
+ s.is_excluded_from_accounts = e, s.is_excluded_from_budgets = e, s.is_excluded_from_cash_flow = e, s.is_excluded_from_debts = e, s.is_excluded_from_goals = e, s.is_excluded_from_investments = e, s.is_excluded_from_net_worth = e, s.is_excluded_from_spending = e, s.is_excluded_from_transactions = e, s.is_excluded_from_trends = e;
218
+ try {
219
+ this.updateAccount(s);
220
+ } catch (r) {
221
+ console.error(`Failed to update account ${c} (added):`, r);
222
+ }
223
+ }
224
+ }
225
+ };
226
+ }
227
+ export {
228
+ l as A,
229
+ C as a
230
+ };
@@ -0,0 +1,9 @@
1
+ import { A as _ } from "./ConnectDrawer-D9cR5phc.mjs";
2
+ const s = (t) => t && (t.account_type === _.CREDIT_CARD || t.account_type === _.LOAN || t.account_type === _.MORTGAGE || t.account_type === _.LINE_OF_CREDIT || t.account_type === _.CHECKING_LINE_OF_CREDIT), p = (t) => t.is_manual || !t.guid, E = (t) => t.account_type === _.LINE_OF_CREDIT || t.account_type === _.CREDIT_CARD || t.account_type === _.CHECKING_LINE_OF_CREDIT, a = (t) => t.account_type === _.SAVINGS || t.account_type === _.CHECKING || t.account_type === _.LINE_OF_CREDIT || t.account_type === _.CREDIT_CARD || t.account_type === _.LOAN || t.account_type === _.MORTGAGE, y = (t) => t.account_type === _.LOAN || t.account_type === _.MORTGAGE;
3
+ export {
4
+ s as a,
5
+ E as b,
6
+ y as c,
7
+ p as i,
8
+ a as u
9
+ };
@@ -0,0 +1,21 @@
1
+ import { F as c, A as s } from "./Fetch-CkFKy79O.mjs";
2
+ class i {
3
+ fetchInstance;
4
+ constructor(t, e) {
5
+ this.fetchInstance = new c(t, e);
6
+ }
7
+ getBeats = async (t, e) => {
8
+ const n = `page=${t || 1}&per_page=${e || 5}`;
9
+ return this.fetchInstance.get(`${s.BEATS}?${n}`).then((a) => a.beats);
10
+ };
11
+ getBeatsWithAssociatedTransaction = async (t) => {
12
+ let e = "has_associated_transaction_guid=true";
13
+ return e += t ? `&from_date=${t}` : "", this.fetchInstance.get(`${s.BEATS}?${e}`).then((n) => n.beats);
14
+ };
15
+ getOffers = async () => this.fetchInstance.get(`${s.OFFERS}/${s.PULSE_COMMUNICATIONS}`).then((t) => t.pulse_communications);
16
+ updateBeat = async (t) => this.fetchInstance.put(`${s.BEATS}/${t.guid}`, t).then((e) => e.beat);
17
+ updateOffer = async (t) => this.fetchInstance.put(`${s.OFFERS}/${t.guid}`, t).then((e) => e.beat);
18
+ }
19
+ export {
20
+ i as B
21
+ };
@@ -0,0 +1,81 @@
1
+ import { makeAutoObservable as c, runInAction as r } from "mobx";
2
+ import { B as n } from "./BeatApi-DLu87ijw.mjs";
3
+ function d(t, a, s, i = "asc") {
4
+ const e = i === "desc" ? -1 : 1;
5
+ return [...t, ...a].sort((_, l) => _[s] < l[s] ? -1 * e : _[s] > l[s] ? 1 * e : 0);
6
+ }
7
+ const m = (t) => ({
8
+ ...t,
9
+ //fields that are offer specific, adding here for visibility
10
+ image_url: t.image_url,
11
+ guid: t.guid,
12
+ created_at: t.created_at,
13
+ dismissed_at: t.dismissed_at,
14
+ active_at: t.campaign_activated_at,
15
+ displayed_at: t.has_been_viewed,
16
+ post_message_secondary: t.pulse_post_message_secondary,
17
+ //offer fields mapped to beat fields for functionality
18
+ title: t.pulse_title || t.campaign_name,
19
+ html_title: t.pulse_title || t.campaign_name,
20
+ short_title: t.pulse_title || t.campaign_name,
21
+ html_short_title: t.pulse_title || t.campaign_name,
22
+ micro_title: t.pulse_title || t.campaign_name,
23
+ html_micro_title: t.pulse_title || t.campaign_name,
24
+ supporting_action: t.pulse_call_to_action_text_secondary,
25
+ description: t.pulse_body,
26
+ html_description: t.pulse_body,
27
+ micro_description: t.pulse_body,
28
+ html_micro_description: t.pulse_body,
29
+ call_to_action: t.pulse_call_to_action_text,
30
+ html_micro_call_to_action: t.pulse_call_to_action_text,
31
+ micro_call_to_action: t.pulse_call_to_action_text,
32
+ is_dismissed: t.has_been_dismissed,
33
+ icon_type: 5,
34
+ template: "MarketingOffer",
35
+ //beat fields we null out
36
+ account_guids: [],
37
+ data_series: {},
38
+ has_been_displayed: !1,
39
+ is_obsolete: !1,
40
+ is_refreshable: !1,
41
+ is_sampled: !1,
42
+ merchant_guids: [],
43
+ payload: {},
44
+ pulse_campaign_name: t.campaign_name,
45
+ scheduled_payment_guids: [],
46
+ transaction_guids: [],
47
+ user_guid: "",
48
+ user_verification: 0
49
+ });
50
+ class u {
51
+ globalStore;
52
+ api = new n("/", "");
53
+ beats = [];
54
+ isLoading = !1;
55
+ constructor(a) {
56
+ this.globalStore = a, this.api = new n(a.endpoint, a.sessionToken), c(this);
57
+ }
58
+ loadBeats = async () => {
59
+ this.isLoading = !0;
60
+ const a = await this.api.getBeats(), i = (await this.api.getOffers()).map((e) => m(e));
61
+ r(() => {
62
+ this.beats = d(a, i, "active_at", "desc"), this.isLoading = !1;
63
+ });
64
+ };
65
+ getFilteredBeats(a) {
66
+ const { categoryGuids: s, templates: i } = a;
67
+ let e = this.beats;
68
+ return s && (e = this.filterBeatsByCategory(e, s)), i && (e = this.filterBeatsByTemplate(e, i)), e;
69
+ }
70
+ // Return beats with any beat.category_guids that are in categoryGuids
71
+ filterBeatsByCategory(a, s) {
72
+ return a.filter((i) => i.category_guids?.some((e) => s.includes(e)));
73
+ }
74
+ // Return beats with a beat.template that is in templates
75
+ filterBeatsByTemplate(a, s) {
76
+ return a.filter((i) => s.some((e) => i.template === e));
77
+ }
78
+ }
79
+ export {
80
+ u as B
81
+ };