@mx-cartographer/experiences 7.12.5 → 7.12.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "7.12.5",
3
+ "version": "7.12.7",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",
@@ -1,252 +0,0 @@
1
- import { jsxs as o, jsx as t } from "react/jsx-runtime";
2
- import p from "react";
3
- import { observer as v } from "mobx-react-lite";
4
- import { useVirtualizer as B } from "@tanstack/react-virtual";
5
- import T from "@mui/material/Box";
6
- import H from "@mui/material/Divider";
7
- import W from "@mui/material/List";
8
- import { G as X, h as C, u as R, g as K } from "./hooks-BxkfR-Ff.mjs";
9
- import { MerchantLogo as P, Icon as w, Text as l, P as Y, H2 as Z } from "@mxenabled/mxui";
10
- import F from "@mui/material/ListItemAvatar";
11
- import q from "@mui/material/ListItemText";
12
- import s from "@mui/material/Stack";
13
- import { T as J, L as Q, O as ee } from "./Transaction-B_2AG36b.mjs";
14
- import { f as te } from "./NumberFormatting-QCaNwbjv.mjs";
15
- import { Receipt as re } from "@mxenabled/mx-icons";
16
- import { fromUnixTime as S } from "date-fns/fromUnixTime";
17
- import { isSameDay as z } from "date-fns/isSameDay";
18
- import { h as ne } from "./DateUtil-wcYTmDRD.mjs";
19
- import { L as oe } from "./Loader-D3rjKx72.mjs";
20
- import { A as ie } from "./Analytics-BYItVAe-.mjs";
21
- const I = () => {
22
- if (!p.useContext(X))
23
- throw new Error("useTransactionsUiStore() must be used within the GlobalDataContext");
24
- return C().uiStore;
25
- };
26
- function se() {
27
- return window.opener && window.opener.location ? window.opener.location.toString() : document.referrer;
28
- }
29
- function ae(e) {
30
- const r = se().replace(/([^:]+:\/\/[^\/]+).*/, "$1"), n = window.parent || window.opener || !1;
31
- return n && n.postMessage && r ? (n.postMessage(e, r), !0) : !1;
32
- }
33
- function ce(e) {
34
- return ae({
35
- metadata: { beat_guid: e },
36
- mx: !0,
37
- type: "mx/moneyDashboard/insightOnTransaction"
38
- });
39
- }
40
- const le = ({ transaction: e, onClick: r }) => {
41
- const { associatedBeats: n } = C(), { expandedSplits: c } = I(), { transactions: h } = R(), { showInsights: g } = I(), d = e.transaction_type === J.CREDIT, u = p.useMemo(() => n.find((m) => m.associated_transaction_guid === e.guid), [n, e]);
42
- return (
43
- //TODO: implement common/components/ListItemRow.tsx
44
- /* @__PURE__ */ o(
45
- Q,
46
- {
47
- clickEventName: ee.ON_TRANSACTION_LIST_ITEM_CLICK,
48
- onClick: r ? () => r(e.guid) : void 0,
49
- children: [
50
- /* @__PURE__ */ t(F, { children: e.parent_guid && c.includes(e.parent_guid) ? /* @__PURE__ */ t(p.Fragment, {}) : /* @__PURE__ */ t(
51
- P,
52
- {
53
- categoryGuid: e.top_level_category_guid || "",
54
- merchantGuid: e.merchant_guid || ""
55
- }
56
- ) }),
57
- /* @__PURE__ */ t(
58
- q,
59
- {
60
- disableTypography: !0,
61
- secondary: /* @__PURE__ */ o(s, { direction: "row", justifyContent: "space-between", children: [
62
- /* @__PURE__ */ o(s, { alignItems: "center", direction: "row", gap: 4, children: [
63
- e.is_flagged && /* @__PURE__ */ t(w, { fill: !0, name: "flag", size: 16, sx: { color: "warning.dark" } }),
64
- e.is_hidden && /* @__PURE__ */ t(w, { name: "visibility_off", size: 16 }),
65
- e.has_been_split && /* @__PURE__ */ t(w, { name: "call_split", size: 16 }),
66
- /* @__PURE__ */ t(l, { variant: "XSmall", children: e.has_been_split ? h.split_transaction_category_label : e.category })
67
- ] }),
68
- u && g && /* @__PURE__ */ t(
69
- l,
70
- {
71
- bold: !0,
72
- color: "action.active",
73
- onClick: (m) => {
74
- m.stopPropagation(), m.preventDefault(), ce(u.guid);
75
- },
76
- variant: "XSmall",
77
- children: u.short_title
78
- }
79
- )
80
- ] }),
81
- children: /* @__PURE__ */ o(s, { direction: "row", justifyContent: "space-between", sx: { gap: 8 }, children: [
82
- /* @__PURE__ */ o(l, { bold: !0, variant: "Body", children: [
83
- e.is_hidden && h.hide_trnx_cancel_hidden_note,
84
- e.payee || e.description || e.feed_description
85
- ] }),
86
- /* @__PURE__ */ o(
87
- l,
88
- {
89
- bold: !0,
90
- color: d ? "success.main" : "text.primary",
91
- sx: { flexShrink: 0 },
92
- variant: "Body",
93
- children: [
94
- d ? "+" : "",
95
- te(e.amount, "0,0.00")
96
- ]
97
- }
98
- )
99
- ] })
100
- }
101
- )
102
- ]
103
- }
104
- )
105
- );
106
- }, de = v(le), ue = ({
107
- bgcolor: e = "background.default",
108
- children: r
109
- }) => /* @__PURE__ */ t(T, { display: "inline-block", sx: { bgcolor: e, py: 6, width: "100%" }, children: /* @__PURE__ */ t(l, { bold: !0, sx: { pl: 24 }, variant: "XSmall", children: r }) }), me = ({ showIcon: e = !0, showSubtitle: r = !0 }) => {
110
- const { transactions: n } = R();
111
- return /* @__PURE__ */ o(s, { alignItems: "center", gap: 12, height: "auto", mb: 24, mt: 24, children: [
112
- e && /* @__PURE__ */ t(re, { color: "action", sx: { fontSize: 32 } }),
113
- /* @__PURE__ */ t(l, { bold: !0, color: "text.secondary", variant: "Small", children: n.zero_state_no_transactions }),
114
- r && /* @__PURE__ */ t(l, { color: "text.secondary", variant: "XSmall", children: n.zero_state_there_are_no_transactions })
115
- ] });
116
- }, pe = v(me), L = (e, r) => {
117
- const n = S(r[e].date), c = S(r[e - 1]?.date);
118
- return !z(n, c);
119
- }, he = (e, r) => {
120
- const n = S(r[e].date), c = S(r[e + 1]?.date);
121
- return z(n, c);
122
- }, A = 65, N = 32, fe = ({
123
- bgcolor: e,
124
- filter: r,
125
- height: n = "calc(100dvh - 36px)",
126
- loader: c = /* @__PURE__ */ t(oe, { label: "Loading", size: 40 }),
127
- onClick: h,
128
- showInsights: g = !1,
129
- showLoader: d = !1,
130
- showHiddenTransactions: u = !1,
131
- transaction: m,
132
- width: D = "100%",
133
- zeroState: O = /* @__PURE__ */ t(pe, {})
134
- }) => {
135
- const { isLoading: b, sortedTransactions: y } = C(), f = p.useMemo(() => {
136
- const i = r ? y.filter(r) : y, a = m ?? i;
137
- return u ? a : a.filter((x) => !x.is_hidden);
138
- }, [y, u]), { clearExpandedSplits: k, setShowInsights: G, toggleSplit: V } = I(), { onEvent: M } = K(), $ = (i) => {
139
- const a = f.find((x) => x.guid === i);
140
- if (a?.has_been_split) {
141
- V(a.guid);
142
- return;
143
- }
144
- M(ie.ACCOUNT_DETAILS_CLICK_TRANSACTION, {
145
- account_guid: a?.account_guid,
146
- transaction_guid: i
147
- }), h?.(i);
148
- }, E = p.useRef(null), _ = B({
149
- count: f.length,
150
- getScrollElement: () => E.current,
151
- estimateSize: (i) => A + (L(i, f) ? N : 0),
152
- overscan: 5
153
- });
154
- return p.useEffect(() => _.measure(), [f]), p.useEffect(() => G(g), [g]), p.useEffect(() => () => k(), []), /* @__PURE__ */ t(W, { sx: { width: D }, children: /* @__PURE__ */ t(T, { height: n, overflow: "auto", ref: E, width: D, children: /* @__PURE__ */ o(
155
- T,
156
- {
157
- height: (
158
- // set the height to auto when there are no transactions so the zero state isn't set to 0
159
- _.getVirtualItems().length === 0 ? "auto" : _.getTotalSize()
160
- ),
161
- position: "relative",
162
- width: "100%",
163
- children: [
164
- (b || d) && c,
165
- !b && !d && _.getVirtualItems().length === 0 && O,
166
- !b && !d && _.getVirtualItems().length > 0 && _.getVirtualItems().map((i) => {
167
- const a = f[i.index], x = L(i.index, f), U = he(i.index, f), j = A + (x ? N : 0);
168
- return /* @__PURE__ */ o(
169
- T,
170
- {
171
- sx: {
172
- height: j,
173
- position: "absolute",
174
- transform: `translateY(${i.start}px)`,
175
- width: "100%",
176
- bgcolor: "background.paper"
177
- },
178
- children: [
179
- x && /* @__PURE__ */ t(ue, { bgcolor: e, children: ne(a.date) }),
180
- /* @__PURE__ */ t(
181
- de,
182
- {
183
- ...h && { onClick: $ },
184
- transaction: a
185
- }
186
- ),
187
- /* @__PURE__ */ t(H, { sx: { ml: U ? 68 : 0 } })
188
- ]
189
- },
190
- a.guid
191
- );
192
- })
193
- ]
194
- }
195
- ) }) });
196
- }, Ve = v(fe), ge = ({
197
- amount: e,
198
- borderRadius: r = "2px",
199
- completeColor: n = "success.main",
200
- icon: c,
201
- label: h,
202
- leftLabel: g,
203
- percentComplete: d = 0,
204
- rightLabel: u,
205
- sx: m
206
- }) => /* @__PURE__ */ t(s, { sx: { p: 24, width: "100%", ...m }, children: /* @__PURE__ */ o(s, { className: "details-container", sx: { gap: 16 }, children: [
207
- /* @__PURE__ */ o(s, { sx: { alignItems: "center", flexDirection: "row", gap: 12 }, children: [
208
- /* @__PURE__ */ t(T, { children: c }),
209
- /* @__PURE__ */ o(s, { children: [
210
- /* @__PURE__ */ t(Y, { variant: "body2", children: h }),
211
- typeof e == "string" ? /* @__PURE__ */ t(Z, { children: e }) : e
212
- ] })
213
- ] }),
214
- /* @__PURE__ */ o(s, { sx: { gap: 4 }, children: [
215
- /* @__PURE__ */ t(
216
- s,
217
- {
218
- sx: {
219
- bgcolor: "divider",
220
- borderRadius: r,
221
- flexDirection: "row",
222
- height: 16,
223
- width: "100%"
224
- },
225
- children: /* @__PURE__ */ t(
226
- T,
227
- {
228
- sx: {
229
- bgcolor: n,
230
- borderRadius: r,
231
- height: 16,
232
- width: `${d}%`
233
- }
234
- }
235
- )
236
- }
237
- ),
238
- /* @__PURE__ */ o(s, { sx: { flexDirection: "row", justifyContent: "space-between" }, children: [
239
- /* @__PURE__ */ t(l, { variant: "body2", children: g }),
240
- /* @__PURE__ */ t(l, { variant: "body2", children: u })
241
- ] })
242
- ] })
243
- ] }) }), Me = ge;
244
- export {
245
- ue as S,
246
- Ve as T,
247
- de as a,
248
- Me as b,
249
- he as h,
250
- L as s,
251
- I as u
252
- };