@mx-cartographer/experiences 9.6.6 → 9.6.8
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/CHANGELOG.md +8 -0
- package/dist/common/components/Banner.es.js +66 -26
- package/dist/common/components/Banner.es.js.map +1 -1
- package/dist/common/components/ConnectDrawer.d.ts +2 -0
- package/dist/common/components/ConnectDrawer.es.js +15 -14
- package/dist/common/components/ConnectDrawer.es.js.map +1 -1
- package/dist/common/components/ConnectWidgetPanel.d.ts +2 -0
- package/dist/common/components/ConnectWidgetPanel.es.js +48 -39
- package/dist/common/components/ConnectWidgetPanel.es.js.map +1 -1
- package/dist/common/constants/Analytics.d.ts +6 -0
- package/dist/common/constants/Analytics.es.js +7 -1
- package/dist/common/constants/Analytics.es.js.map +1 -1
- package/dist/common/constants/Connect.d.ts +7 -0
- package/dist/common/constants/Connect.es.js +6 -4
- package/dist/common/constants/Connect.es.js.map +1 -1
- package/dist/common/constants/index.d.ts +2 -1
- package/dist/common/index.es.js +95 -93
- package/dist/core/api/BannerApi.d.ts +1 -0
- package/dist/core/api/BannerApi.es.js +4 -2
- package/dist/core/api/BannerApi.es.js.map +1 -1
- package/dist/core/stores/AppDataStore.d.ts +1 -0
- package/dist/core/stores/AppDataStore.es.js +9 -2
- package/dist/core/stores/AppDataStore.es.js.map +1 -1
- package/dist/core/types/AppData.d.ts +2 -0
- package/dist/core/types/Insights.d.ts +7 -0
- package/dist/core/types/Insights.es.js.map +1 -1
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +9 -0
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.d.ts +24 -0
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js +56 -0
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/index.d.ts +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/index.d.ts +1 -0
- package/dist/insights-v2/components/DebtPayoffCard.d.ts +48 -0
- package/dist/insights-v2/components/DebtPayoffCard.es.js +132 -0
- package/dist/insights-v2/components/DebtPayoffCard.es.js.map +1 -0
- package/dist/insights-v2/index.d.ts +1 -0
- package/dist/insights-v2/index.es.js +85 -81
- package/dist/insights-v2/mappings/blocks.es.js +53 -51
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/package.json +1 -1
package/dist/common/index.es.js
CHANGED
|
@@ -4,9 +4,9 @@ import a from "./components/charts/StatusBar.es.js";
|
|
|
4
4
|
import p from "./components/charts/Donut.es.js";
|
|
5
5
|
import u from "./hooks/useAccountDisplayName.es.js";
|
|
6
6
|
import { useCombineEvents as C, useCombinePageviews as S } from "./hooks/useCombineEvents.es.js";
|
|
7
|
-
import { GlobalDataContext as c, GlobalDataProvider as
|
|
8
|
-
import { WidgetContainerContext as
|
|
9
|
-
import { useAccountStore as I, useActionContext as N, useAppConfig as P, useBudgetsStore as y, useCashflowStore as A, useCategoryStore as
|
|
7
|
+
import { GlobalDataContext as c, GlobalDataProvider as T } from "./context/GlobalDataProvider.es.js";
|
|
8
|
+
import { WidgetContainerContext as d, WidgetContainerProvider as D } from "./context/WidgetContainerProvider.es.js";
|
|
9
|
+
import { useAccountStore as I, useActionContext as N, useAppConfig as P, useBudgetsStore as y, useCashflowStore as A, useCategoryStore as O, useDebtStore as b, useError as W, useEvent as G, useFinstrongStore as L, useGlobalCopyStore as R, useGlobalStore as U, useGlobalUiStore as v, useGoalStore as B, useHelpStore as h, useHoldingStore as w, useInsightsV2Store as x, useLoad as M, useMerchantStore as Y, useNetWorthStore as H, useNotificationStore as F, usePageView as z, useRecurringTransactionsStore as V, useSettingsStore as Z, useTransactionStore as K, useTrendsStore as k, useUserStore as q, useWidgetContainerProvider as j } from "./context/hooks.es.js";
|
|
10
10
|
import { useInsightsEnabled as Q } from "./hooks/useInsightsEnabled.es.js";
|
|
11
11
|
import { useScreenSize as $ } from "./hooks/useScreenSize.es.js";
|
|
12
12
|
import ro from "./hooks/usePrevious.es.js";
|
|
@@ -18,112 +18,114 @@ import co from "./components/dialog/Dialog.es.js";
|
|
|
18
18
|
import Eo from "./components/drawer/Drawer.es.js";
|
|
19
19
|
import _o from "./components/daterangeselector/DateRangeSelector.es.js";
|
|
20
20
|
import { ANALYTICS_EVENTS as No } from "./constants/Analytics.es.js";
|
|
21
|
-
import { CONNECTIONS_WIDGET_ID as yo, CONNECT_WIDGET_ID as Ao,
|
|
22
|
-
import { GlobalStore as
|
|
23
|
-
import { INCOME_ACCOUNT_TYPES as
|
|
24
|
-
import { RECURRENCE_COPY as
|
|
25
|
-
import { LOADING_STATUS as
|
|
26
|
-
import { DEFAULT_DONUT_SIZE as
|
|
27
|
-
import { Sizes as
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import { GlobalAccountFilter as
|
|
35
|
-
import
|
|
36
|
-
import { WidgetContainer as
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
21
|
+
import { CONNECTIONS_WIDGET_ID as yo, CONNECT_WIDGET_ID as Ao, CONNECT_WIDGET_SOURCES as Oo, DEEP_LINK_TYPE as bo, MemberConnectionStatus as Wo } from "./constants/Connect.es.js";
|
|
22
|
+
import { GlobalStore as Lo } from "../core/stores/GlobalStore.es.js";
|
|
23
|
+
import { INCOME_ACCOUNT_TYPES as Uo, PAYMENT_ACCOUNT_TYPES as vo, SPENDING_ACCOUNT_TYPES as Bo } from "./constants/Account.es.js";
|
|
24
|
+
import { RECURRENCE_COPY as wo } from "./constants/ScheduledPayment.es.js";
|
|
25
|
+
import { LOADING_STATUS as Mo } from "./constants/SpendingPlan.es.js";
|
|
26
|
+
import { DEFAULT_DONUT_SIZE as Ho, DEFAULT_STROKE_WIDTH as Fo } from "./constants/Donut.es.js";
|
|
27
|
+
import { Sizes as Vo, TOUCH_TARGET as Zo } from "./constants/Sizes.es.js";
|
|
28
|
+
import ko from "./components/donuts/MultiSegmentDonut.es.js";
|
|
29
|
+
import jo from "./components/donuts/SingleSegmentDonut.es.js";
|
|
30
|
+
import Qo from "./components/ErrorBoundary.es.js";
|
|
31
|
+
import $o from "./components/Error.es.js";
|
|
32
|
+
import rr from "./components/MicroWidgetContainer.es.js";
|
|
33
|
+
import er from "./components/MiniWidgetContainer.es.js";
|
|
34
|
+
import { GlobalAccountFilter as mr } from "./components/GlobalAccountFilter.es.js";
|
|
35
|
+
import ar from "./components/Loader.es.js";
|
|
36
|
+
import { WidgetContainer as pr } from "./components/WidgetContainer.es.js";
|
|
37
|
+
import ur from "./components/ConnectWidgetPanel.es.js";
|
|
38
|
+
import Cr from "./components/ConnectDrawer.es.js";
|
|
39
|
+
import gr from "./components/CurrencyDialog.es.js";
|
|
40
|
+
import Tr from "./components/CurrencyInput.es.js";
|
|
41
41
|
import dr from "./components/ResponsiveButton.es.js";
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
import
|
|
48
|
-
import
|
|
49
|
-
import { ConnectCard as
|
|
50
|
-
import { CurrencyText as
|
|
51
|
-
import { EmptyState as
|
|
52
|
-
import { ListItemAction as
|
|
53
|
-
import { ListItemRow as
|
|
54
|
-
import { ListItemWrapper as
|
|
55
|
-
import { Select as
|
|
56
|
-
import { ToggleButtonListItem as
|
|
57
|
-
import { ToggleListItem as
|
|
58
|
-
import { analyticsSession as
|
|
59
|
-
import { getClientComponentOverrides as
|
|
42
|
+
import _r from "./components/SearchBox.es.js";
|
|
43
|
+
import Nr from "./components/SelectionBox.es.js";
|
|
44
|
+
import yr from "./components/TabContentContainer.es.js";
|
|
45
|
+
import Or from "./components/IconBacking.es.js";
|
|
46
|
+
import Wr from "./components/DataRow.es.js";
|
|
47
|
+
import Lr from "./components/ZeroState.es.js";
|
|
48
|
+
import Ur from "./components/InformationTooltip.es.js";
|
|
49
|
+
import { ConnectCard as Br } from "./components/ConnectCard.es.js";
|
|
50
|
+
import { CurrencyText as wr } from "./components/CurrencyText.es.js";
|
|
51
|
+
import { EmptyState as Mr } from "./components/EmptyState.es.js";
|
|
52
|
+
import { ListItemAction as Hr } from "./components/ListItemAction.es.js";
|
|
53
|
+
import { ListItemRow as zr } from "./components/ListItemRow.es.js";
|
|
54
|
+
import { ListItemWrapper as Zr } from "./components/ListItemWrapper.es.js";
|
|
55
|
+
import { Select as kr } from "./components/Select.es.js";
|
|
56
|
+
import { ToggleButtonListItem as jr } from "./components/listitems/ToggleButtonListItem.es.js";
|
|
57
|
+
import { ToggleListItem as Qr } from "./components/listitems/ToggleListItem.es.js";
|
|
58
|
+
import { analyticsSession as $r } from "./utils/Analytics.es.js";
|
|
59
|
+
import { getClientComponentOverrides as rt, getClientCustomizations as tt, getClientPaletteOptions as et, getClientTheme as it } from "./utils/Theme.es.js";
|
|
60
60
|
export {
|
|
61
61
|
No as ANALYTICS_EVENTS,
|
|
62
62
|
yo as CONNECTIONS_WIDGET_ID,
|
|
63
63
|
Ao as CONNECT_WIDGET_ID,
|
|
64
|
+
Oo as CONNECT_WIDGET_SOURCES,
|
|
64
65
|
i as Calendar,
|
|
65
66
|
m as CalendarSelectionTypes,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
Br as ConnectCard,
|
|
68
|
+
Cr as ConnectDrawer,
|
|
69
|
+
ur as ConnectWidgetPanel,
|
|
70
|
+
gr as CurrencyDialog,
|
|
71
|
+
Tr as CurrencyInput,
|
|
72
|
+
wr as CurrencyText,
|
|
73
|
+
bo as DEEP_LINK_TYPE,
|
|
74
|
+
Ho as DEFAULT_DONUT_SIZE,
|
|
75
|
+
Fo as DEFAULT_STROKE_WIDTH,
|
|
76
|
+
Wr as DataRow,
|
|
75
77
|
_o as DateRangeSelector,
|
|
76
78
|
co as Dialog,
|
|
77
79
|
p as Donut,
|
|
78
80
|
Eo as Drawer,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
Mr as EmptyState,
|
|
82
|
+
$o as Error,
|
|
83
|
+
Qo as ErrorBoundary,
|
|
84
|
+
mr as GlobalAccountFilter,
|
|
83
85
|
c as GlobalDataContext,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
86
|
+
T as GlobalDataProvider,
|
|
87
|
+
Lo as GlobalStore,
|
|
88
|
+
Uo as INCOME_ACCOUNT_TYPES,
|
|
89
|
+
Or as IconBacking,
|
|
90
|
+
Ur as InformationTooltip,
|
|
91
|
+
Mo as LOADING_STATUS,
|
|
92
|
+
Hr as ListItemAction,
|
|
93
|
+
zr as ListItemRow,
|
|
94
|
+
Zr as ListItemWrapper,
|
|
95
|
+
ar as Loader,
|
|
96
|
+
Wo as MemberConnectionStatus,
|
|
97
|
+
rr as MicroWidgetContainer,
|
|
98
|
+
er as MiniWidgetContainer,
|
|
99
|
+
ko as MultiSegmentDonut,
|
|
100
|
+
vo as PAYMENT_ACCOUNT_TYPES,
|
|
101
|
+
wo as RECURRENCE_COPY,
|
|
100
102
|
dr as ResponsiveButton,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
Bo as SPENDING_ACCOUNT_TYPES,
|
|
104
|
+
_r as SearchBox,
|
|
105
|
+
kr as Select,
|
|
106
|
+
Nr as SelectionBox,
|
|
107
|
+
jo as SingleSegmentDonut,
|
|
108
|
+
Vo as Sizes,
|
|
107
109
|
a as StatusBar,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
Zo as TOUCH_TARGET,
|
|
111
|
+
yr as TabContentContainer,
|
|
112
|
+
jr as ToggleButtonListItem,
|
|
113
|
+
Qr as ToggleListItem,
|
|
114
|
+
pr as WidgetContainer,
|
|
115
|
+
d as WidgetContainerContext,
|
|
114
116
|
D as WidgetContainerProvider,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
Lr as ZeroState,
|
|
118
|
+
$r as analyticsSession,
|
|
117
119
|
r as buildDynamicCopy,
|
|
118
120
|
t as buildPluralCopy,
|
|
119
121
|
eo as formatCurrency,
|
|
120
122
|
io as formatOrdinal,
|
|
121
123
|
mo as formatPercentage,
|
|
122
124
|
no as generateEqualIntervals,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
rt as getClientComponentOverrides,
|
|
126
|
+
tt as getClientCustomizations,
|
|
127
|
+
et as getClientPaletteOptions,
|
|
128
|
+
it as getClientTheme,
|
|
127
129
|
ao as getCurrencyCodes,
|
|
128
130
|
so as getPluralRules,
|
|
129
131
|
u as useAccountDisplayName,
|
|
@@ -132,10 +134,10 @@ export {
|
|
|
132
134
|
P as useAppConfig,
|
|
133
135
|
y as useBudgetsStore,
|
|
134
136
|
A as useCashflowStore,
|
|
135
|
-
|
|
137
|
+
O as useCategoryStore,
|
|
136
138
|
C as useCombineEvents,
|
|
137
139
|
S as useCombinePageviews,
|
|
138
|
-
|
|
140
|
+
b as useDebtStore,
|
|
139
141
|
W as useError,
|
|
140
142
|
G as useEvent,
|
|
141
143
|
L as useFinstrongStore,
|
|
@@ -157,9 +159,9 @@ export {
|
|
|
157
159
|
fo as useRepeatingTransactionEligibility,
|
|
158
160
|
$ as useScreenSize,
|
|
159
161
|
Z as useSettingsStore,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
162
|
+
K as useTransactionStore,
|
|
163
|
+
k as useTrendsStore,
|
|
164
|
+
q as useUserStore,
|
|
163
165
|
j as useWidgetContainerProvider,
|
|
164
166
|
lo as useWidgetHeaderStyles,
|
|
165
167
|
So as useWidgetLoadTimer
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ApiEndpoints as c } from "../constants/ApiEndpoints.es.js";
|
|
1
2
|
import { Fetch as r } from "../utils/Fetch.es.js";
|
|
2
|
-
var
|
|
3
|
+
var s = class {
|
|
3
4
|
fetchInstance;
|
|
4
5
|
constructor(n) {
|
|
5
6
|
this.fetchInstance = new r(n, "", {
|
|
@@ -15,9 +16,10 @@ var a = class {
|
|
|
15
16
|
return console.error("Error fetching banner:", t), null;
|
|
16
17
|
}
|
|
17
18
|
};
|
|
19
|
+
markClicked = async (n) => this.fetchInstance?.put(`/${c.OFFERS}/${encodeURIComponent(n)}/clicked`, {});
|
|
18
20
|
};
|
|
19
21
|
export {
|
|
20
|
-
|
|
22
|
+
s as BannerApi
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
//# sourceMappingURL=BannerApi.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerApi.es.js","names":[],"sources":["../../../src/core/api/BannerApi.ts"],"sourcesContent":["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"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BannerApi.es.js","names":[],"sources":["../../../src/core/api/BannerApi.ts"],"sourcesContent":["import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\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 // Records a banner click server-side. The deep-link path needs this because it\n // never hits `redirect_url`, which is what records the click for external\n // banners. Rejections propagate so AppDataStore can report them via its\n // captureException handler instead of being silently swallowed here.\n markClicked = async (guid: string) =>\n this.fetchInstance?.put(`/${ApiEndpoints.OFFERS}/${encodeURIComponent(guid)}/clicked`, {})\n}\n"],"mappings":";;AAGA,IAAa,IAAb,MAAuB;AAAA,EACrB;AAAA,EAEA,YAAY,GAA0B;AAEpC,SAAK,gBAAgB,IAAI,EAAM,GAAkB,IAAI;AAAA,MACnD,QAAQ;AAAA,MACR,gBAAgB;AAAA,IAClB,CAAC;AAAA,EACH;AAAA,EAEA,YAAY,OAAO,MAAqB;AACtC,QAAI;AACF,YAAM,IAAO,WAAW,CAAA;AACxB,aAAO,KAAK,eAAe,IAAI,CAAI,EAAE,KAAA,CAAM,MAAS,EAAK,MAAM,KAAK,CAAC;AAAA,IACvE,SAAS,GAAO;AACd,qBAAQ,MAAM,0BAA0B,CAAK,GACtC;AAAA,IACT;AAAA,EACF;AAAA,EAMA,cAAc,OAAO,MACnB,KAAK,eAAe,IAAI,IAAI,EAAa,MAAA,IAAU,mBAAmB,CAAI,CAAA,YAAa,CAAC,CAAC;AAC7F"}
|
|
@@ -18,6 +18,7 @@ export declare class AppDataStore {
|
|
|
18
18
|
setAppData: (appData: AppData) => void;
|
|
19
19
|
loadAppData: () => Promise<void>;
|
|
20
20
|
loadBanner: () => Promise<void>;
|
|
21
|
+
markBannerClicked: (guid: string) => Promise<void>;
|
|
21
22
|
setUser: (user: User) => User;
|
|
22
23
|
setUserCommunicationProfile: (profile: UserCommunicationProfile) => UserCommunicationProfile;
|
|
23
24
|
setUserProfile: (userProfile: UserProfile) => UserProfile;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AppDataApi as a } from "../api/AppDataApi.es.js";
|
|
2
2
|
import { BannerApi as e } from "../api/BannerApi.es.js";
|
|
3
3
|
import { makeAutoObservable as i, runInAction as o } from "mobx";
|
|
4
|
-
var
|
|
4
|
+
var c = class {
|
|
5
5
|
globalStore;
|
|
6
6
|
api = new a("/", "");
|
|
7
7
|
bannerApi = new e("/");
|
|
@@ -50,12 +50,19 @@ var l = class {
|
|
|
50
50
|
console.error("Error loading banner:", t), this.globalStore.captureException(t, { store: "AppDataStore" });
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
+
markBannerClicked = async (t) => {
|
|
54
|
+
try {
|
|
55
|
+
await this.bannerApi.markClicked(t);
|
|
56
|
+
} catch (r) {
|
|
57
|
+
console.error("Error marking banner clicked:", r), this.globalStore.captureException(r, { store: "AppDataStore" });
|
|
58
|
+
}
|
|
59
|
+
};
|
|
53
60
|
setUser = (t) => this.appData.user = t;
|
|
54
61
|
setUserCommunicationProfile = (t) => this.appData.user_communication_profile = t;
|
|
55
62
|
setUserProfile = (t) => this.appData.user_profile = t;
|
|
56
63
|
};
|
|
57
64
|
export {
|
|
58
|
-
|
|
65
|
+
c as AppDataStore
|
|
59
66
|
};
|
|
60
67
|
|
|
61
68
|
//# sourceMappingURL=AppDataStore.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppDataStore.es.js","names":[],"sources":["../../../src/core/stores/AppDataStore.ts"],"sourcesContent":["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(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\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"],"mappings":";;;AAcA,IAAa,IAAb,MAA0B;AAAA,EACxB;AAAA,EACA,MAAkB,IAAI,EAAW,KAAK,EAAE;AAAA,EACxC,YAAuB,IAAI,EAAU,GAAG;AAAA,EAExC,UAAmB,CAAC;AAAA,EACpB,kBAA2B;AAAA,EAC3B,SAAiB,CAAC;AAAA,EAElB,YAAY,GAA0B;AACpC,SAAK,cAAc,GACnB,KAAK,MAAM,IAAI,EAAW,EAAY,UAAU,EAAY,cAAc,EAAY,OAAO,GAE7F,EAAmB,IAAI;AAAA,EACzB;AAAA,EAEA,IAAI,YAAuB;AACzB,WAAO,KAAK,YAAY;AAAA,EAC1B;AAAA,EAEA,IAAI,6BAA6B;AAC/B,WAAO,KAAK,QAAQ;AAAA,EACtB;AAAA,EAEA,IAAI,uBAAuB;AACzB,WAAO,KAAK,QAAQ;AAAA,EACtB;AAAA,EAEA,IAAI,OAAO;AACT,WAAO,KAAK,QAAQ;AAAA,EACtB;AAAA,EAEA,IAAI,2BAA2B;AAC7B,WAAO,KAAK,QAAQ;AAAA,EACtB;AAAA,EAEA,IAAI,cAAc;AAChB,WAAO,KAAK,QAAQ;AAAA,EACtB;AAAA,EAEA,aAAA,CAAc,MAAqB;AACjC,SAAK,UAAU,GACf,KAAK,YAAY,IAAI,EAAU,EAAQ,SAAS,YAAY,GAAG,GAC/D,KAAK,kBAAkB;AAAA,EACzB;AAAA,EAEA,cAAc,YAAY;AACxB,QAAI;AACF,YAAM,IAAU,MAAM,KAAK,IAAI,WAAW;AAC1C,WAAK,WAAW,CAAO;AAAA,IACzB,SAAS,GAAO;AACd,cAAQ,MAAM,2BAA2B,CAAK,GAC9C,KAAK,YAAY,iBAAiB,GAAO,EAAE,OAAO,eAAe,CAAC;AAAA,IACpE;AAAA,EACF;AAAA,EAEA,aAAa,YAAY;AACvB,QAAI;AACF,YAAM,IAAW,KAAK,MAAM,QAAQ,MAC9B,IAAS,IAAW,MAAM,KAAK,UAAU,UAAU,CAAQ,IAAI,CAAC;AAEtE,MAAA,EAAA,MAAkB;AAChB,aAAK,SAAS;AAAA,MAChB,CAAC;AAAA,IACH,SAAS,GAAO;AACd,cAAQ,MAAM,yBAAyB,CAAK,GAC5C,KAAK,YAAY,iBAAiB,GAAO,EAAE,OAAO,eAAe,CAAC;AAAA,IACpE;AAAA,EACF;AAAA,EAEA,UAAA,CAAW,MAAgB,KAAK,QAAQ,OAAO;AAAA,EAE/C,8BAAA,CAA+B,MAC5B,KAAK,QAAQ,6BAA6B;AAAA,EAE7C,iBAAA,CAAkB,MAA8B,KAAK,QAAQ,eAAe;AAC9E"}
|
|
1
|
+
{"version":3,"file":"AppDataStore.es.js","names":[],"sources":["../../../src/core/stores/AppDataStore.ts"],"sourcesContent":["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(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\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 // Fire-and-forget click receipt for the deep-link banner path (see BannerApi).\n markBannerClicked = async (guid: string) => {\n try {\n await this.bannerApi.markClicked(guid)\n } catch (error) {\n console.error('Error marking banner clicked:', 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"],"mappings":";;;AAcA,IAAa,IAAb,MAA0B;AAAA,EACxB;AAAA,EACA,MAAkB,IAAI,EAAW,KAAK,EAAE;AAAA,EACxC,YAAuB,IAAI,EAAU,GAAG;AAAA,EAExC,UAAmB,CAAC;AAAA,EACpB,kBAA2B;AAAA,EAC3B,SAAiB,CAAC;AAAA,EAElB,YAAY,GAA0B;AACpC,SAAK,cAAc,GACnB,KAAK,MAAM,IAAI,EAAW,EAAY,UAAU,EAAY,cAAc,EAAY,OAAO,GAE7F,EAAmB,IAAI;AAAA,EACzB;AAAA,EAEA,IAAI,YAAuB;AACzB,WAAO,KAAK,YAAY;AAAA,EAC1B;AAAA,EAEA,IAAI,6BAA6B;AAC/B,WAAO,KAAK,QAAQ;AAAA,EACtB;AAAA,EAEA,IAAI,uBAAuB;AACzB,WAAO,KAAK,QAAQ;AAAA,EACtB;AAAA,EAEA,IAAI,OAAO;AACT,WAAO,KAAK,QAAQ;AAAA,EACtB;AAAA,EAEA,IAAI,2BAA2B;AAC7B,WAAO,KAAK,QAAQ;AAAA,EACtB;AAAA,EAEA,IAAI,cAAc;AAChB,WAAO,KAAK,QAAQ;AAAA,EACtB;AAAA,EAEA,aAAA,CAAc,MAAqB;AACjC,SAAK,UAAU,GACf,KAAK,YAAY,IAAI,EAAU,EAAQ,SAAS,YAAY,GAAG,GAC/D,KAAK,kBAAkB;AAAA,EACzB;AAAA,EAEA,cAAc,YAAY;AACxB,QAAI;AACF,YAAM,IAAU,MAAM,KAAK,IAAI,WAAW;AAC1C,WAAK,WAAW,CAAO;AAAA,IACzB,SAAS,GAAO;AACd,cAAQ,MAAM,2BAA2B,CAAK,GAC9C,KAAK,YAAY,iBAAiB,GAAO,EAAE,OAAO,eAAe,CAAC;AAAA,IACpE;AAAA,EACF;AAAA,EAEA,aAAa,YAAY;AACvB,QAAI;AACF,YAAM,IAAW,KAAK,MAAM,QAAQ,MAC9B,IAAS,IAAW,MAAM,KAAK,UAAU,UAAU,CAAQ,IAAI,CAAC;AAEtE,MAAA,EAAA,MAAkB;AAChB,aAAK,SAAS;AAAA,MAChB,CAAC;AAAA,IACH,SAAS,GAAO;AACd,cAAQ,MAAM,yBAAyB,CAAK,GAC5C,KAAK,YAAY,iBAAiB,GAAO,EAAE,OAAO,eAAe,CAAC;AAAA,IACpE;AAAA,EACF;AAAA,EAGA,oBAAoB,OAAO,MAAiB;AAC1C,QAAI;AACF,YAAM,KAAK,UAAU,YAAY,CAAI;AAAA,IACvC,SAAS,GAAO;AACd,cAAQ,MAAM,iCAAiC,CAAK,GACpD,KAAK,YAAY,iBAAiB,GAAO,EAAE,OAAO,eAAe,CAAC;AAAA,IACpE;AAAA,EACF;AAAA,EAEA,UAAA,CAAW,MAAgB,KAAK,QAAQ,OAAO;AAAA,EAE/C,8BAAA,CAA+B,MAC5B,KAAK,QAAQ,6BAA6B;AAAA,EAE7C,iBAAA,CAAkB,MAA8B,KAAK,QAAQ,eAAe;AAC9E"}
|
|
@@ -27,8 +27,10 @@ export interface AppConfig {
|
|
|
27
27
|
userFeatures: UserFeature[];
|
|
28
28
|
}
|
|
29
29
|
export interface Banner {
|
|
30
|
+
guid?: string;
|
|
30
31
|
image_url?: string;
|
|
31
32
|
redirect_url?: string;
|
|
33
|
+
deep_link_type?: number | null;
|
|
32
34
|
}
|
|
33
35
|
interface TransactionConfig {
|
|
34
36
|
selected_account_guid?: string;
|
|
@@ -221,6 +221,7 @@ export declare const BlockType: {
|
|
|
221
221
|
readonly DonutChartBlock: "donut_chart_block";
|
|
222
222
|
readonly DoubleBarChartBlock: "double_bar_chart_block";
|
|
223
223
|
readonly DoubleProgressBarBlock: "double_progress_bar_block";
|
|
224
|
+
readonly DebtsBlock: "debts_block";
|
|
224
225
|
readonly SaveExtraBlock: "save_extra_block";
|
|
225
226
|
readonly SavingsOpportunityBlock: "savings_opportunity_block";
|
|
226
227
|
readonly StepChartBlock: "step_chart_block";
|
|
@@ -306,4 +307,10 @@ export interface InstanceSlot {
|
|
|
306
307
|
icon_name?: string;
|
|
307
308
|
/** Category guid used to render the deposit-card logo fallback. */
|
|
308
309
|
category_guid?: string;
|
|
310
|
+
/** Projected payoff date in ISO form (e.g. `2027-03-01`); the block formats it as month + year. */
|
|
311
|
+
payoff_date?: string;
|
|
312
|
+
/** Monthly payment toward the debt (unformatted); the block formats it as currency. */
|
|
313
|
+
monthly_payment?: number;
|
|
314
|
+
/** Annual interest rate as a percentage (e.g. `19.99`); the block formats it as a percent. */
|
|
315
|
+
interest_rate?: number;
|
|
309
316
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Insights.es.js","names":[],"sources":["../../../src/core/types/Insights.ts"],"sourcesContent":["// ============ Core InsightsV2 Types ============\n\nimport { InsightsInstanceSlotData } from './InsightsInstanceSlotData'\n\nexport interface ThemedSVGImageProps {\n divProps?: React.HTMLAttributes<HTMLDivElement>\n image: React.ComponentType<React.SVGProps<SVGSVGElement>>\n isMini?: boolean\n}\n\n/**\n * Emitted by a block when the user drills into a specific datum (e.g. clicks a\n * chart bar). Named fields rather than positional args so blocks with differing\n * shapes can extend this without the call sites transposing values.\n */\nexport interface DrilldownPayload {\n chartBarIndex: number\n tabIndex?: number\n transaction_guid?: string\n block?: string\n}\n\n/**\n * Which envelope a beat was fetched with. `embedded` (the transaction-row pill + details-drawer\n * card) and `notification` are V2 additions; a surface asks for one with `widget_type=` on the fetch.\n */\nexport type WidgetType = 'full' | 'mini' | 'micro' | 'embedded' | 'notification'\n\n/**\n * V2: the transaction-row tag, its own small section of the `embedded` envelope (the same grammar\n * as `description` / `footer`, with room for a tone or an icon later). Omitted for an insight that\n * tags no transaction row. It deliberately is *not* `short_title`, which stays a per-variant\n * attribute with a second consumer (the bank-holiday sub-header).\n */\nexport interface Pill {\n text: string\n}\n\n/**\n * V2: facts a drilldown shows that the card does not (e.g. the account number for the Transaction\n * Details drawer). A flat hash shared by every CTA of the card, omitted when the insight has none.\n * Never carries copy or user actions (memo, tags, hide, flag come from the transaction store).\n */\nexport type DrilldownData = Record<string, string | number | boolean | null>\n\nexport interface InsightsPayload {\n widget_type: WidgetType\n instance_slot: InstanceSlot\n /**\n * V1 only. The v2 contract carries everything a block needs on `instance_slot.data`,\n * and omits this key entirely (see the LargeTransactionV2 payload). Blocks that still require it\n * get it as a required field through `BlockProps`, which re-declares it.\n */\n instance_slot_data?: InsightsInstanceSlotData\n description: Description\n primary_cta?: PrimaryCTA\n secondary_cta?: SecondaryCTA\n title?: string\n sub_title?: Subtitle\n /**\n * V2 rename of `sub_title`: a flat string, with the logo promoted to the payload-level `logo`\n * field below. `sub_title` wins when both are present.\n */\n subtitle?: string\n /** V2: header logo paired with the flat `subtitle`: an entity guid or a status icon (`LogoRef`). */\n logo?: LogoRef\n /** V2: which design branch the backend picked (e.g. `no_merchant`). */\n variant?: string\n /** V2, `embedded` envelope only: the transaction-row pill. */\n pill?: Pill\n /** V2: drilldown-only facts, e.g. `{ account_number: 'XXXXXXXX043' }`. */\n drilldown_data?: DrilldownData\n footer?: Footer\n // TODO: Add in_description_cta to insights_payload from backend\n guid: string\n user_guid: string\n client_guid?: string\n /** Template name, e.g. `LargeTransactionV2`. */\n template?: string\n revision?: number\n /** Unix seconds. */\n created_at?: number\n /** Unix seconds. */\n updated_at?: number\n /** Unix seconds. */\n active_at?: number\n displayed_at?: number | null\n dismissed_at: number | null\n cta_clicked_at?: number | null\n has_been_displayed?: boolean\n is_dismissed: boolean\n is_deleted?: boolean\n is_hidden_by_system?: boolean\n is_obsolete?: boolean\n is_refreshable?: boolean\n is_sampled?: boolean\n is_zero_state?: boolean\n status?: string | null\n /**\n * V2 (LargeTransactionV2 onward): the entities the beat is about, carried on the payload so\n * action blocks do not have to reach back out to the beat envelope.\n */\n primary_account_guid?: string | null\n primary_transaction_guid?: string | null\n primary_category_guid?: string | null\n primary_merchant_guid?: string | null\n /**\n * V2: the repeating transaction a subscription beat is about (Upcoming Subscription, Subscription\n * Price Increase). Read by `recurring_transaction_block`, see\n * `actionBlocks/RecurringTransactionBlock/subscriptionBeats.ts`.\n */\n primary_repeating_transaction_guid?: string | null\n}\n\nexport interface Legends {\n label: string\n value: number\n additional_value?: number\n additional_value_type?: string\n value_type?: string\n}\n\nexport interface Logo {\n category_guid?: string\n category_name?: string\n institution_guid?: string\n institution_name?: string\n logo_color?: string\n logo_name?: string\n merchant_guid?: string\n merchant_name?: string\n}\n\nexport interface Subtitle {\n logo?: Logo\n text: string\n}\n\n/**\n * A V2 logo, shared by the header (`InsightsPayload.logo`) and every instance-slot row. It takes\n * one of two shapes:\n *\n * - **Entity**: `guid`, whose prefix (`INS-` / `MCH-` / `CAT-`) picks the logo component, plus an\n * optional `fallback_guid` for when that component's asset cannot load. Today that is the\n * category behind an `MCH-` guid, which `MerchantLogo` shows as a tile when the merchant image\n * is missing.\n * - **Status icon**: `icon` (an mx-icons name, e.g. `warning`) and `color` (a theme palette path,\n * e.g. `error.main`), for subheaders that show a state rather than an entity (V1's\n * `logo_name` / `logo_color`).\n *\n * `alt` is the accessible name for either shape. A logo sends one shape; if it sends both, `icon`\n * wins, as `logo_name` does in V1's `SubHeader`.\n */\nexport interface LogoRef {\n alt?: string\n color?: string\n fallback_guid?: string\n guid?: string\n icon?: string\n}\n\nexport interface CategoryLogo {\n category_guid: string\n category_name: string\n}\n\nexport interface MerchantLogo {\n merchant_guid: string\n merchant_name: string\n}\n\nexport interface InstitutionLogo {\n institution_guid: string\n institution_name: string\n}\n\nexport interface Description {\n text: string\n html_text: string\n}\n\n/**\n * Post message a CTA press sends to the host, resolved by the backend for the beat's current\n * state. Absent/null = the backend has not described one: the frontend uses the template's\n * interim `ctaPostMessages` entry if there is one, else sends no message. `payload` carries only\n * beat-specific extras; the frontend always adds `beat_guid`, `beat_template`, `user_guid` and\n * `action_string`.\n */\nexport interface CtaPostMessageMetadata {\n /** Post message event; defaults to `beat/cta`. */\n event?: string | null\n /** Operation the host should perform, e.g. `op_1`, `op_2`, `op_3`. Defaults to `op_1`. */\n action?: string | null\n /** Beat-specific fields merged into the message metadata (account ids, amounts, ...). */\n payload?: Record<string, unknown> | null\n}\n\nexport interface PrimaryCTA {\n label: string\n block: string\n variant?: string | null\n /**\n * What pressing the CTA does beyond opening its block, named by the backend (ditto\n * `primary_cta_action`, passed through by tupac). Looked up in `insights-v2/ctaActions`;\n * null / absent / unknown means the CTA only opens its block or posts its message.\n */\n action_key?: string | null\n metadata?: CtaPostMessageMetadata | null\n}\n\nexport interface SecondaryCTA {\n label: string\n block: string\n variant?: string | null\n /** See `PrimaryCTA.action_key` (ditto `secondary_cta_action`). */\n action_key?: string | null\n metadata?: CtaPostMessageMetadata | null\n}\n\nexport interface Footer {\n /** V1: a pre-formatted date string. */\n date?: string\n /**\n * The account label, on both V1 and V2. The backend resolves the plurality: one account sends\n * its name (e.g. `Epic Bank`), several send a localized count (e.g. `2 Accounts`), none sends\n * nothing. There is deliberately no separate `accounts` key — see tupac's `footer_account_label`.\n */\n account?: string\n /**\n * V2 (LargeTransactionV2 onward): unix seconds, formatted by `Footer` for display.\n * Replaces `date`; `date` wins when a beat somehow sends both.\n */\n timestamp?: number\n}\n\n// ============ Instance Slot Types ============\n// Values are the snake_case block names the backend sends on a beat's instance slot; the PascalCase\n// keys stay as friendly references (e.g. BlockType.BarChartBlock === 'bar_chart_block').\nexport const BlockType = {\n AccountBlock: 'account_block',\n AccountSwitchBlock: 'account_switch_block',\n BarChartBlock: 'bar_chart_block',\n BudgetBlock: 'budget_block',\n ImageBlock: 'image_block',\n TransactionBlock: 'transaction_block',\n DonutChartBlock: 'donut_chart_block',\n DoubleBarChartBlock: 'double_bar_chart_block',\n DoubleProgressBarBlock: 'double_progress_bar_block',\n SaveExtraBlock: 'save_extra_block',\n SavingsOpportunityBlock: 'savings_opportunity_block',\n StepChartBlock: 'step_chart_block',\n SVGImageBlock: 'svg_image_block',\n UpcomingBillBlock: 'upcoming_bill_block',\n UpcomingSubscriptionBlock: 'upcoming_subscription_block',\n WithdrawalBlock: 'withdrawal_block',\n} as const\n\nexport type BlockType = (typeof BlockType)[keyof typeof BlockType]\n\n/**\n * A pre-localized row on a V2 instance slot. The backend resolves the copy and formatting; the\n * logo is a `LogoRef` (an entity guid or a status icon, see `logoFromRef`).\n */\nexport interface InstanceSlotRow {\n amount?: number\n logo?: LogoRef\n primary_text?: string\n secondary_text?: string\n}\n\n/**\n * V2: the slots a block's variant filled, keyed by slot name; ditto owns the names and omits any\n * slot it has no value for (`lib/ditto/blocks/<block>.yml`). Read with `slot()`, which names the\n * kind the caller expects.\n */\nexport interface InstanceSlotData {\n [slot: string]: unknown\n}\n\n/**\n * Reads one slot off a block's `data`; undefined when ditto did not fill it.\n *\n * The caller names the kind, because the slot's kind lives in the block's ditto schema and not\n * here — a block fills slots with whatever its card needs, so no fixed list of kinds would hold\n * (`account_switch_block` alone carries a boolean and `budget_block` a nested object).\n */\nexport const slot = <T = unknown>(\n data: InstanceSlotData | undefined,\n name: string,\n): T | undefined => data?.[name] as T | undefined\n\n/**\n * V2: which block renders this beat's content, and what it renders.\n *\n * `block` is optional: a beat whose template has no ditto config arrives as an empty `{}` and the\n * card renders its copy and CTAs alone, so a reader cannot assume a block is named. One interface\n * with `block` optional rather than a union with `Record<string, never>`, which TypeScript absorbs\n * — that union left `block` reading as required and typed a promise it did not keep.\n *\n * `variant` is optional for the same reason — the empty `{}` carries neither. Every ditto beat\n * file that names a block also names a variant, so a *filled* slot always has one; ditto drops a\n * nil variant rather than sending null, which is why the type is `string | null | undefined`.\n */\nexport interface InstanceSlot {\n block?: BlockType\n variant?: string | null\n /** The slots this block's variant declares in ditto. */\n data?: InstanceSlotData\n // Direct Deposit block (Set Up Direct Deposit, Switch Direct Deposit, Missing\n // Interest Rate): account facts carried flat on the slot, beside `data`.\n /** Primary line on the hero card, e.g. \"Epic Bank Checking, *1234\". */\n account_name?: string\n /** Secondary line beneath the name, e.g. \"Checking Account\" / \"Credit Card\". */\n account_type?: string\n /** Status pill label, e.g. \"Direct Deposit Not Set Up\" / \"Interest Rate: 19.99% APR\". */\n status_text?: string\n institution_guid?: string\n institution_name?: string\n // Shared across multiple V2 component blocks:\n // `amount` — UpcomingBillBlock (projected bill), SavingsOpportunityBlock (coupon),\n // UpcomingSubscriptionBlock (price per cadence).\n // `merchant_guid` / `merchant_name` — UpcomingBillBlock (bill row logo + name),\n // UpcomingSubscriptionBlock (hero logo + name).\n /** Dollar amount (unformatted); the block formats it as currency. */\n amount?: number\n /** Merchant guid used to render the inline / hero logo via `LogoFromGuid` (`MCH-...`). */\n merchant_guid?: string\n /** Merchant display name — shown as logo alt text and as the merchant/hero label. */\n merchant_name?: string\n // Upcoming Bill block (Projected Bill Payment): the block derives the Sun→Sat week strip\n // around `due_date` at render time.\n /** Due date of the projected bill in ISO form (e.g. `2025-10-30`). */\n due_date?: string\n // Savings Opportunity block (Save An Extra, Potential Savings, Embedded): purely data-driven\n // coupon card. Backend sends the caption and the amount, plus `slot` to toggle the green\n // gradient background when the card is embedded in a parent surface that supplies its own.\n /** Caption shown above the amount, e.g. `Save an extra` or `Potential savings`. */\n label?: string\n /**\n * Whether to render the green gradient slot behind the coupon. Defaults to true. Backend sends\n * `false` when the coupon is embedded in a parent surface that supplies its own background.\n */\n slot?: boolean\n // Upcoming Subscription block: billing cadence for the price pill (`${amount} / ${cadence}`).\n /** Billing cadence word that trails the price, e.g. `month` or `year`. */\n cadence?: string\n // Account block (status on/off-track, deposit, payoff variants): card content carried flat on\n // the slot (the V2 contract drops `instance_slot_data`). `amount`, `label`, `merchant_guid`,\n // `merchant_name`, `institution_guid`, `institution_name` are shared fields declared above.\n /** Secondary line beneath the amount on the standard card, e.g. \"Remaining after expenses\". */\n sub_text?: string\n /** Header bar text (standard card) or the colored category strip label (deposit cards). */\n header_text?: string\n /** Generic-tile icon name used when no merchant/institution logo is available. */\n icon_name?: string\n /** Category guid used to render the deposit-card logo fallback. */\n category_guid?: string\n}\n"],"mappings":"AA8RA,IAAa,IAAA,CACX,GACA,MACkB,IAAO,CAAA"}
|
|
1
|
+
{"version":3,"file":"Insights.es.js","names":[],"sources":["../../../src/core/types/Insights.ts"],"sourcesContent":["// ============ Core InsightsV2 Types ============\n\nimport { InsightsInstanceSlotData } from './InsightsInstanceSlotData'\n\nexport interface ThemedSVGImageProps {\n divProps?: React.HTMLAttributes<HTMLDivElement>\n image: React.ComponentType<React.SVGProps<SVGSVGElement>>\n isMini?: boolean\n}\n\n/**\n * Emitted by a block when the user drills into a specific datum (e.g. clicks a\n * chart bar). Named fields rather than positional args so blocks with differing\n * shapes can extend this without the call sites transposing values.\n */\nexport interface DrilldownPayload {\n chartBarIndex: number\n tabIndex?: number\n transaction_guid?: string\n block?: string\n}\n\n/**\n * Which envelope a beat was fetched with. `embedded` (the transaction-row pill + details-drawer\n * card) and `notification` are V2 additions; a surface asks for one with `widget_type=` on the fetch.\n */\nexport type WidgetType = 'full' | 'mini' | 'micro' | 'embedded' | 'notification'\n\n/**\n * V2: the transaction-row tag, its own small section of the `embedded` envelope (the same grammar\n * as `description` / `footer`, with room for a tone or an icon later). Omitted for an insight that\n * tags no transaction row. It deliberately is *not* `short_title`, which stays a per-variant\n * attribute with a second consumer (the bank-holiday sub-header).\n */\nexport interface Pill {\n text: string\n}\n\n/**\n * V2: facts a drilldown shows that the card does not (e.g. the account number for the Transaction\n * Details drawer). A flat hash shared by every CTA of the card, omitted when the insight has none.\n * Never carries copy or user actions (memo, tags, hide, flag come from the transaction store).\n */\nexport type DrilldownData = Record<string, string | number | boolean | null>\n\nexport interface InsightsPayload {\n widget_type: WidgetType\n instance_slot: InstanceSlot\n /**\n * V1 only. The v2 contract carries everything a block needs on `instance_slot.data`,\n * and omits this key entirely (see the LargeTransactionV2 payload). Blocks that still require it\n * get it as a required field through `BlockProps`, which re-declares it.\n */\n instance_slot_data?: InsightsInstanceSlotData\n description: Description\n primary_cta?: PrimaryCTA\n secondary_cta?: SecondaryCTA\n title?: string\n sub_title?: Subtitle\n /**\n * V2 rename of `sub_title`: a flat string, with the logo promoted to the payload-level `logo`\n * field below. `sub_title` wins when both are present.\n */\n subtitle?: string\n /** V2: header logo paired with the flat `subtitle`: an entity guid or a status icon (`LogoRef`). */\n logo?: LogoRef\n /** V2: which design branch the backend picked (e.g. `no_merchant`). */\n variant?: string\n /** V2, `embedded` envelope only: the transaction-row pill. */\n pill?: Pill\n /** V2: drilldown-only facts, e.g. `{ account_number: 'XXXXXXXX043' }`. */\n drilldown_data?: DrilldownData\n footer?: Footer\n // TODO: Add in_description_cta to insights_payload from backend\n guid: string\n user_guid: string\n client_guid?: string\n /** Template name, e.g. `LargeTransactionV2`. */\n template?: string\n revision?: number\n /** Unix seconds. */\n created_at?: number\n /** Unix seconds. */\n updated_at?: number\n /** Unix seconds. */\n active_at?: number\n displayed_at?: number | null\n dismissed_at: number | null\n cta_clicked_at?: number | null\n has_been_displayed?: boolean\n is_dismissed: boolean\n is_deleted?: boolean\n is_hidden_by_system?: boolean\n is_obsolete?: boolean\n is_refreshable?: boolean\n is_sampled?: boolean\n is_zero_state?: boolean\n status?: string | null\n /**\n * V2 (LargeTransactionV2 onward): the entities the beat is about, carried on the payload so\n * action blocks do not have to reach back out to the beat envelope.\n */\n primary_account_guid?: string | null\n primary_transaction_guid?: string | null\n primary_category_guid?: string | null\n primary_merchant_guid?: string | null\n /**\n * V2: the repeating transaction a subscription beat is about (Upcoming Subscription, Subscription\n * Price Increase). Read by `recurring_transaction_block`, see\n * `actionBlocks/RecurringTransactionBlock/subscriptionBeats.ts`.\n */\n primary_repeating_transaction_guid?: string | null\n}\n\nexport interface Legends {\n label: string\n value: number\n additional_value?: number\n additional_value_type?: string\n value_type?: string\n}\n\nexport interface Logo {\n category_guid?: string\n category_name?: string\n institution_guid?: string\n institution_name?: string\n logo_color?: string\n logo_name?: string\n merchant_guid?: string\n merchant_name?: string\n}\n\nexport interface Subtitle {\n logo?: Logo\n text: string\n}\n\n/**\n * A V2 logo, shared by the header (`InsightsPayload.logo`) and every instance-slot row. It takes\n * one of two shapes:\n *\n * - **Entity**: `guid`, whose prefix (`INS-` / `MCH-` / `CAT-`) picks the logo component, plus an\n * optional `fallback_guid` for when that component's asset cannot load. Today that is the\n * category behind an `MCH-` guid, which `MerchantLogo` shows as a tile when the merchant image\n * is missing.\n * - **Status icon**: `icon` (an mx-icons name, e.g. `warning`) and `color` (a theme palette path,\n * e.g. `error.main`), for subheaders that show a state rather than an entity (V1's\n * `logo_name` / `logo_color`).\n *\n * `alt` is the accessible name for either shape. A logo sends one shape; if it sends both, `icon`\n * wins, as `logo_name` does in V1's `SubHeader`.\n */\nexport interface LogoRef {\n alt?: string\n color?: string\n fallback_guid?: string\n guid?: string\n icon?: string\n}\n\nexport interface CategoryLogo {\n category_guid: string\n category_name: string\n}\n\nexport interface MerchantLogo {\n merchant_guid: string\n merchant_name: string\n}\n\nexport interface InstitutionLogo {\n institution_guid: string\n institution_name: string\n}\n\nexport interface Description {\n text: string\n html_text: string\n}\n\n/**\n * Post message a CTA press sends to the host, resolved by the backend for the beat's current\n * state. Absent/null = the backend has not described one: the frontend uses the template's\n * interim `ctaPostMessages` entry if there is one, else sends no message. `payload` carries only\n * beat-specific extras; the frontend always adds `beat_guid`, `beat_template`, `user_guid` and\n * `action_string`.\n */\nexport interface CtaPostMessageMetadata {\n /** Post message event; defaults to `beat/cta`. */\n event?: string | null\n /** Operation the host should perform, e.g. `op_1`, `op_2`, `op_3`. Defaults to `op_1`. */\n action?: string | null\n /** Beat-specific fields merged into the message metadata (account ids, amounts, ...). */\n payload?: Record<string, unknown> | null\n}\n\nexport interface PrimaryCTA {\n label: string\n block: string\n variant?: string | null\n /**\n * What pressing the CTA does beyond opening its block, named by the backend (ditto\n * `primary_cta_action`, passed through by tupac). Looked up in `insights-v2/ctaActions`;\n * null / absent / unknown means the CTA only opens its block or posts its message.\n */\n action_key?: string | null\n metadata?: CtaPostMessageMetadata | null\n}\n\nexport interface SecondaryCTA {\n label: string\n block: string\n variant?: string | null\n /** See `PrimaryCTA.action_key` (ditto `secondary_cta_action`). */\n action_key?: string | null\n metadata?: CtaPostMessageMetadata | null\n}\n\nexport interface Footer {\n /** V1: a pre-formatted date string. */\n date?: string\n /**\n * The account label, on both V1 and V2. The backend resolves the plurality: one account sends\n * its name (e.g. `Epic Bank`), several send a localized count (e.g. `2 Accounts`), none sends\n * nothing. There is deliberately no separate `accounts` key — see tupac's `footer_account_label`.\n */\n account?: string\n /**\n * V2 (LargeTransactionV2 onward): unix seconds, formatted by `Footer` for display.\n * Replaces `date`; `date` wins when a beat somehow sends both.\n */\n timestamp?: number\n}\n\n// ============ Instance Slot Types ============\n// Values are the snake_case block names the backend sends on a beat's instance slot; the PascalCase\n// keys stay as friendly references (e.g. BlockType.BarChartBlock === 'bar_chart_block').\nexport const BlockType = {\n AccountBlock: 'account_block',\n AccountSwitchBlock: 'account_switch_block',\n BarChartBlock: 'bar_chart_block',\n BudgetBlock: 'budget_block',\n ImageBlock: 'image_block',\n TransactionBlock: 'transaction_block',\n DonutChartBlock: 'donut_chart_block',\n DoubleBarChartBlock: 'double_bar_chart_block',\n DoubleProgressBarBlock: 'double_progress_bar_block',\n DebtsBlock: 'debts_block',\n SaveExtraBlock: 'save_extra_block',\n SavingsOpportunityBlock: 'savings_opportunity_block',\n StepChartBlock: 'step_chart_block',\n SVGImageBlock: 'svg_image_block',\n UpcomingBillBlock: 'upcoming_bill_block',\n UpcomingSubscriptionBlock: 'upcoming_subscription_block',\n WithdrawalBlock: 'withdrawal_block',\n} as const\n\nexport type BlockType = (typeof BlockType)[keyof typeof BlockType]\n\n/**\n * A pre-localized row on a V2 instance slot. The backend resolves the copy and formatting; the\n * logo is a `LogoRef` (an entity guid or a status icon, see `logoFromRef`).\n */\nexport interface InstanceSlotRow {\n amount?: number\n logo?: LogoRef\n primary_text?: string\n secondary_text?: string\n}\n\n/**\n * V2: the slots a block's variant filled, keyed by slot name; ditto owns the names and omits any\n * slot it has no value for (`lib/ditto/blocks/<block>.yml`). Read with `slot()`, which names the\n * kind the caller expects.\n */\nexport interface InstanceSlotData {\n [slot: string]: unknown\n}\n\n/**\n * Reads one slot off a block's `data`; undefined when ditto did not fill it.\n *\n * The caller names the kind, because the slot's kind lives in the block's ditto schema and not\n * here — a block fills slots with whatever its card needs, so no fixed list of kinds would hold\n * (`account_switch_block` alone carries a boolean and `budget_block` a nested object).\n */\nexport const slot = <T = unknown>(\n data: InstanceSlotData | undefined,\n name: string,\n): T | undefined => data?.[name] as T | undefined\n\n/**\n * V2: which block renders this beat's content, and what it renders.\n *\n * `block` is optional: a beat whose template has no ditto config arrives as an empty `{}` and the\n * card renders its copy and CTAs alone, so a reader cannot assume a block is named. One interface\n * with `block` optional rather than a union with `Record<string, never>`, which TypeScript absorbs\n * — that union left `block` reading as required and typed a promise it did not keep.\n *\n * `variant` is optional for the same reason — the empty `{}` carries neither. Every ditto beat\n * file that names a block also names a variant, so a *filled* slot always has one; ditto drops a\n * nil variant rather than sending null, which is why the type is `string | null | undefined`.\n */\nexport interface InstanceSlot {\n block?: BlockType\n variant?: string | null\n /** The slots this block's variant declares in ditto. */\n data?: InstanceSlotData\n // Direct Deposit block (Set Up Direct Deposit, Switch Direct Deposit, Missing\n // Interest Rate): account facts carried flat on the slot, beside `data`.\n /** Primary line on the hero card, e.g. \"Epic Bank Checking, *1234\". */\n account_name?: string\n /** Secondary line beneath the name, e.g. \"Checking Account\" / \"Credit Card\". */\n account_type?: string\n /** Status pill label, e.g. \"Direct Deposit Not Set Up\" / \"Interest Rate: 19.99% APR\". */\n status_text?: string\n institution_guid?: string\n institution_name?: string\n // Shared across multiple V2 component blocks:\n // `amount` — UpcomingBillBlock (projected bill), SavingsOpportunityBlock (coupon),\n // UpcomingSubscriptionBlock (price per cadence).\n // `merchant_guid` / `merchant_name` — UpcomingBillBlock (bill row logo + name),\n // UpcomingSubscriptionBlock (hero logo + name).\n /** Dollar amount (unformatted); the block formats it as currency. */\n amount?: number\n /** Merchant guid used to render the inline / hero logo via `LogoFromGuid` (`MCH-...`). */\n merchant_guid?: string\n /** Merchant display name — shown as logo alt text and as the merchant/hero label. */\n merchant_name?: string\n // Upcoming Bill block (Projected Bill Payment): the block derives the Sun→Sat week strip\n // around `due_date` at render time.\n /** Due date of the projected bill in ISO form (e.g. `2025-10-30`). */\n due_date?: string\n // Savings Opportunity block (Save An Extra, Potential Savings, Embedded): purely data-driven\n // coupon card. Backend sends the caption and the amount, plus `slot` to toggle the green\n // gradient background when the card is embedded in a parent surface that supplies its own.\n /** Caption shown above the amount, e.g. `Save an extra` or `Potential savings`. */\n label?: string\n /**\n * Whether to render the green gradient slot behind the coupon. Defaults to true. Backend sends\n * `false` when the coupon is embedded in a parent surface that supplies its own background.\n */\n slot?: boolean\n // Upcoming Subscription block: billing cadence for the price pill (`${amount} / ${cadence}`).\n /** Billing cadence word that trails the price, e.g. `month` or `year`. */\n cadence?: string\n // Account block (status on/off-track, deposit, payoff variants): card content carried flat on\n // the slot (the V2 contract drops `instance_slot_data`). `amount`, `label`, `merchant_guid`,\n // `merchant_name`, `institution_guid`, `institution_name` are shared fields declared above.\n /** Secondary line beneath the amount on the standard card, e.g. \"Remaining after expenses\". */\n sub_text?: string\n /** Header bar text (standard card) or the colored category strip label (deposit cards). */\n header_text?: string\n /** Generic-tile icon name used when no merchant/institution logo is available. */\n icon_name?: string\n /** Category guid used to render the deposit-card logo fallback. */\n category_guid?: string\n // Debts block: `amount` is the current balance; the shared account/institution fields above.\n /** Projected payoff date in ISO form (e.g. `2027-03-01`); the block formats it as month + year. */\n payoff_date?: string\n /** Monthly payment toward the debt (unformatted); the block formats it as currency. */\n monthly_payment?: number\n /** Annual interest rate as a percentage (e.g. `19.99`); the block formats it as a percent. */\n interest_rate?: number\n}\n"],"mappings":"AA+RA,IAAa,IAAA,CACX,GACA,MACkB,IAAO,CAAA"}
|
|
@@ -245,6 +245,13 @@ export interface AmountInputModalCopy {
|
|
|
245
245
|
/** Shown in the dialog when the save request fails; the value stays so Save can be retried. */
|
|
246
246
|
save_error: string;
|
|
247
247
|
}
|
|
248
|
+
/** Labels for the Debts component block; the values come pre-formatted off `instance_slot`. */
|
|
249
|
+
export interface DebtsBlockCopy {
|
|
250
|
+
balance_label: string;
|
|
251
|
+
payoff_date_label: string;
|
|
252
|
+
monthly_payment_label: string;
|
|
253
|
+
interest_rate_label: string;
|
|
254
|
+
}
|
|
248
255
|
export interface InsightsFeedCopy {
|
|
249
256
|
general: GeneralInsightsFeedCopy;
|
|
250
257
|
settings_menu: SettingsMenuCopy;
|
|
@@ -266,5 +273,7 @@ export interface InsightsFeedCopy {
|
|
|
266
273
|
dismiss: DismissInsightCopy;
|
|
267
274
|
/** Optional until the localized-content service ships the namespace. */
|
|
268
275
|
amount_input_modal?: AmountInputModalCopy;
|
|
276
|
+
/** Optional until the localized-content service ships the namespace. */
|
|
277
|
+
debts_block?: DebtsBlockCopy;
|
|
269
278
|
}
|
|
270
279
|
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { InsightsPayload } from '../../../../core';
|
|
2
|
+
import { DebtPayoffCardStyleProps } from '../../../components/DebtPayoffCard';
|
|
3
|
+
interface DebtsBlockProps {
|
|
4
|
+
payload: InsightsPayload;
|
|
5
|
+
beatGuid?: string;
|
|
6
|
+
}
|
|
7
|
+
/** `projected_payoff` look: primary-tinted slot and pill. The card story mirrors it from here. */
|
|
8
|
+
export declare const PAYOFF_STYLE: DebtPayoffCardStyleProps;
|
|
9
|
+
/**
|
|
10
|
+
* Debts component block — the content card for the Debt Payoff Strategies beat.
|
|
11
|
+
*
|
|
12
|
+
* The debt account's facts arrive flat on `instance_slot` (V2 contract — no `instance_slot_data`):
|
|
13
|
+
* the balance (`amount`), `payoff_date`, `monthly_payment`, `interest_rate`, plus the shared
|
|
14
|
+
* account/institution fields. Row labels come from `insights_feed.debts_block` copy, which
|
|
15
|
+
* ships separately: until it has, the card shows the account row only (never an unlabelled number)
|
|
16
|
+
* and warns once per mount so the rollout gap is traceable.
|
|
17
|
+
*
|
|
18
|
+
* `instance_slot.variant` is not read yet: the architecture doc's other Debts branches (Debt
|
|
19
|
+
* Summary, Interest Summary) have no design, so there is one look. Introduce a per-variant
|
|
20
|
+
* registry (`createVariantBlock` + a `layout.ts` table, as `AccountBlock` does) with the second
|
|
21
|
+
* variant, not before.
|
|
22
|
+
*/
|
|
23
|
+
declare const DebtsBlock: ({ payload }: DebtsBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export default DebtsBlock;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { DATE_FORMATS_INTL as y, formatDate as h } from "../../../../core/constants/DateFormats.es.js";
|
|
2
|
+
import { useGlobalCopyStore as v } from "../../../../common/context/hooks.es.js";
|
|
3
|
+
import { formatCurrency as _, formatPercentage as g } from "../../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import { DepositLogo as D } from "../../../components/ComponentBlocks/DepositLogo.es.js";
|
|
5
|
+
import T from "../../../components/DebtPayoffCard.es.js";
|
|
6
|
+
import { parseDueDate as C } from "../UpcomingBillBlock/UpcomingBillBlock.es.js";
|
|
7
|
+
import L from "react";
|
|
8
|
+
import { jsx as b } from "react/jsx-runtime";
|
|
9
|
+
var A = {
|
|
10
|
+
bgcolor: "primary.lighter",
|
|
11
|
+
pill: {
|
|
12
|
+
bgcolor: "primary.lighter",
|
|
13
|
+
labelColor: "text.primary"
|
|
14
|
+
}
|
|
15
|
+
}, E = /* @__PURE__ */ new Set([
|
|
16
|
+
"credit card",
|
|
17
|
+
"credit_card",
|
|
18
|
+
"creditcard"
|
|
19
|
+
]), R = (e) => E.has((e ?? "").trim().toLowerCase()) ? "credit_card" : "account_balance", S = (e) => !!e?.balance_label && !!e.payoff_date_label && !!e.monthly_payment_label && !!e.interest_rate_label, B = ({ payload: e }) => {
|
|
20
|
+
const a = v().insights_feed?.debts_block, t = S(a) ? a : void 0, { account_name: u, account_type: l, amount: r, institution_guid: f, institution_name: p, interest_rate: n, monthly_payment: i, payoff_date: s, status_text: d } = e.instance_slot;
|
|
21
|
+
L.useEffect(() => {
|
|
22
|
+
t || console.warn(`debts_block: ${a ? "copy incomplete" : "copy namespace missing"}; rendering the account row only`);
|
|
23
|
+
}, [a, t]);
|
|
24
|
+
const c = s ? C(s) : null, o = [];
|
|
25
|
+
t && c && o.push({
|
|
26
|
+
label: t.payoff_date_label,
|
|
27
|
+
value: h(c, y.MONTH_SHORT_YEAR)
|
|
28
|
+
}), t && i != null && o.push({
|
|
29
|
+
label: t.monthly_payment_label,
|
|
30
|
+
value: _(i, "0,0.00")
|
|
31
|
+
}), t && n != null && o.push({
|
|
32
|
+
label: t.interest_rate_label,
|
|
33
|
+
value: g(n / 100)
|
|
34
|
+
});
|
|
35
|
+
const m = t !== void 0 && r != null;
|
|
36
|
+
return /* @__PURE__ */ b(T, {
|
|
37
|
+
...A,
|
|
38
|
+
balance: m ? _(r, "0,0.00") : void 0,
|
|
39
|
+
balanceLabel: m ? t.balance_label : void 0,
|
|
40
|
+
logo: /* @__PURE__ */ b(D, {
|
|
41
|
+
iconName: R(l),
|
|
42
|
+
institutionGuid: f ?? "",
|
|
43
|
+
institutionName: p ?? ""
|
|
44
|
+
}),
|
|
45
|
+
name: u,
|
|
46
|
+
stats: o,
|
|
47
|
+
statusLabel: d,
|
|
48
|
+
subtitle: l
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
A as PAYOFF_STYLE,
|
|
53
|
+
B as default
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=DebtsBlock.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DebtsBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport { useGlobalCopyStore } from '../../../../common'\nimport type { InsightsPayload } from '../../../../core'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../../core/constants'\nimport type { DebtsBlockCopy } from '../../../../core/types/localization/InsightsFeedCopy'\nimport { formatCurrency, formatPercentage } from '../../../../core/utils/NumberFormatting'\n\nimport DepositLogo from '../../../components/ComponentBlocks/DepositLogo'\nimport DebtPayoffCard, {\n type DebtPayoffCardStyleProps,\n type DebtPayoffStat,\n} from '../../../components/DebtPayoffCard'\nimport { parseDueDate } from '../UpcomingBillBlock/UpcomingBillBlock'\n\ninterface DebtsBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\n/** `projected_payoff` look: primary-tinted slot and pill. The card story mirrors it from here. */\nexport const PAYOFF_STYLE: DebtPayoffCardStyleProps = {\n bgcolor: 'primary.lighter',\n pill: { bgcolor: 'primary.lighter', labelColor: 'text.primary' },\n}\n\n/** Account types drawn with the card glyph when there is no institution logo; the rest get the bank. */\nconst CREDIT_CARD_TYPES = new Set(['credit card', 'credit_card', 'creditcard'])\n\nconst iconFor = (accountType?: string) =>\n CREDIT_CARD_TYPES.has((accountType ?? '').trim().toLowerCase())\n ? 'credit_card'\n : 'account_balance'\n\n/** Every label the card renders; a partial namespace counts as missing. */\nconst hasAllLabels = (copy?: DebtsBlockCopy): copy is DebtsBlockCopy =>\n !!copy?.balance_label &&\n !!copy.payoff_date_label &&\n !!copy.monthly_payment_label &&\n !!copy.interest_rate_label\n\n/**\n * Debts component block — the content card for the Debt Payoff Strategies beat.\n *\n * The debt account's facts arrive flat on `instance_slot` (V2 contract — no `instance_slot_data`):\n * the balance (`amount`), `payoff_date`, `monthly_payment`, `interest_rate`, plus the shared\n * account/institution fields. Row labels come from `insights_feed.debts_block` copy, which\n * ships separately: until it has, the card shows the account row only (never an unlabelled number)\n * and warns once per mount so the rollout gap is traceable.\n *\n * `instance_slot.variant` is not read yet: the architecture doc's other Debts branches (Debt\n * Summary, Interest Summary) have no design, so there is one look. Introduce a per-variant\n * registry (`createVariantBlock` + a `layout.ts` table, as `AccountBlock` does) with the second\n * variant, not before.\n */\nconst DebtsBlock = ({ payload }: DebtsBlockProps) => {\n const copy = useGlobalCopyStore().insights_feed?.debts_block\n const labels = hasAllLabels(copy) ? copy : undefined\n const {\n account_name,\n account_type,\n amount,\n institution_guid,\n institution_name,\n interest_rate,\n monthly_payment,\n payoff_date,\n status_text,\n } = payload.instance_slot\n\n React.useEffect(() => {\n if (labels) return\n console.warn(\n `debts_block: ${copy ? 'copy incomplete' : 'copy namespace missing'}; rendering the account row only`,\n )\n }, [copy, labels])\n\n // A row with no value (or an unparseable date) is dropped rather than rendered blank.\n const payoffDate = payoff_date ? parseDueDate(payoff_date) : null\n const stats: DebtPayoffStat[] = []\n if (labels && payoffDate) {\n stats.push({\n label: labels.payoff_date_label,\n value: formatDate(payoffDate, DATE_FORMATS_INTL.MONTH_SHORT_YEAR),\n })\n }\n if (labels && monthly_payment != null) {\n stats.push({\n label: labels.monthly_payment_label,\n value: formatCurrency(monthly_payment, '0,0.00'),\n })\n }\n if (labels && interest_rate != null) {\n // `interest_rate` arrives as a percentage (19.99); Intl's percent style expects a fraction.\n stats.push({ label: labels.interest_rate_label, value: formatPercentage(interest_rate / 100) })\n }\n\n const hasBalance = labels !== undefined && amount != null\n\n return (\n <DebtPayoffCard\n {...PAYOFF_STYLE}\n balance={hasBalance ? formatCurrency(amount, '0,0.00') : undefined}\n balanceLabel={hasBalance ? labels.balance_label : undefined}\n logo={\n <DepositLogo\n iconName={iconFor(account_type)}\n institutionGuid={institution_guid ?? ''}\n institutionName={institution_name ?? ''}\n />\n }\n name={account_name}\n stats={stats}\n statusLabel={status_text}\n subtitle={account_type}\n />\n )\n}\n\nexport default DebtsBlock\n"],"mappings":";;;;;;;;AAqBA,IAAa,IAAyC;AAAA,EACpD,SAAS;AAAA,EACT,MAAM;AAAA,IAAE,SAAS;AAAA,IAAmB,YAAY;AAAA,EAAe;AACjE,GAGM,IAAoB,oBAAI,IAAI;AAAA,EAAC;AAAA,EAAe;AAAA,EAAe;AAAY,CAAC,GAExE,IAAA,CAAW,MACf,EAAkB,KAAK,KAAe,IAAI,KAAK,EAAE,YAAY,CAAC,IAC1D,gBACA,mBAGA,IAAA,CAAgB,MACpB,CAAC,CAAC,GAAM,iBACR,CAAC,CAAC,EAAK,qBACP,CAAC,CAAC,EAAK,yBACP,CAAC,CAAC,EAAK,qBAgBH,IAAA,CAAc,EAAE,SAAA,EAAA,MAA+B;AACnD,QAAM,IAAO,EAAmB,EAAE,eAAe,aAC3C,IAAS,EAAa,CAAI,IAAI,IAAO,QACrC,EACJ,cAAA,GACA,cAAA,GACA,QAAA,GACA,kBAAA,GACA,kBAAA,GACA,eAAA,GACA,iBAAA,GACA,aAAA,GACA,aAAA,EAAA,IACE,EAAQ;AAEZ,EAAA,EAAM,UAAA,MAAgB;AACpB,IAAI,KACJ,QAAQ,KACN,gBAAgB,IAAO,oBAAoB,wBAAA,kCAC7C;AAAA,EACF,GAAG,CAAC,GAAM,CAAM,CAAC;AAGjB,QAAM,IAAa,IAAc,EAAa,CAAW,IAAI,MACvD,IAA0B,CAAC;AACjC,EAAI,KAAU,KACZ,EAAM,KAAK;AAAA,IACT,OAAO,EAAO;AAAA,IACd,OAAO,EAAW,GAAY,EAAkB,gBAAgB;AAAA,EAClE,CAAC,GAEC,KAAU,KAAmB,QAC/B,EAAM,KAAK;AAAA,IACT,OAAO,EAAO;AAAA,IACd,OAAO,EAAe,GAAiB,QAAQ;AAAA,EACjD,CAAC,GAEC,KAAU,KAAiB,QAE7B,EAAM,KAAK;AAAA,IAAE,OAAO,EAAO;AAAA,IAAqB,OAAO,EAAiB,IAAgB,GAAG;AAAA,EAAE,CAAC;AAGhG,QAAM,IAAa,MAAW,UAAa,KAAU;AAErD,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,GAAI;AAAA,IACJ,SAAS,IAAa,EAAe,GAAQ,QAAQ,IAAI;AAAA,IACzD,cAAc,IAAa,EAAO,gBAAgB;AAAA,IAClD,MACE,gBAAA,EAAC,GAAD;AAAA,MACE,UAAU,EAAQ,CAAY;AAAA,MAC9B,iBAAiB,KAAoB;AAAA,MACrC,iBAAiB,KAAoB;AAAA,IACtC,CAAA;AAAA,IAEH,MAAM;AAAA,IACC,OAAA;AAAA,IACP,aAAa;AAAA,IACb,UAAU;AAAA,EACX,CAAA;AAEL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DebtsBlock } from './DebtsBlock';
|
|
@@ -2,6 +2,7 @@ export * from './AccountBlock';
|
|
|
2
2
|
export * from './AccountSwitchBlock';
|
|
3
3
|
export * from './DirectDepositBlock';
|
|
4
4
|
export * from './BudgetBlock';
|
|
5
|
+
export * from './DebtsBlock';
|
|
5
6
|
export * from './SaveExtraBlock';
|
|
6
7
|
export * from './SavingsOpportunityBlock';
|
|
7
8
|
export * from './TransactionBlock';
|