@mx-cartographer/experiences 9.7.75 → 9.7.76
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 +6 -0
- package/dist/insights-v2/actionBlocks/SurveyModalActionBlock.es.js +28 -20
- package/dist/insights-v2/actionBlocks/SurveyModalActionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +11 -11
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js +3 -3
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +75 -68
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.d.ts +4 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js +2 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/components/BaseLayout.es.js +40 -40
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/components/CtaStatus.d.ts +2 -2
- package/dist/insights-v2/components/CtaStatus.es.js +23 -14
- package/dist/insights-v2/components/CtaStatus.es.js.map +1 -1
- package/dist/insights-v2/components/FeedbackDialog.d.ts +3 -1
- package/dist/insights-v2/components/FeedbackDialog.es.js +28 -28
- package/dist/insights-v2/components/FeedbackDialog.es.js.map +1 -1
- package/dist/insights-v2/components/FeedbackModal.d.ts +3 -1
- package/dist/insights-v2/components/FeedbackModal.es.js +17 -16
- package/dist/insights-v2/components/FeedbackModal.es.js.map +1 -1
- package/dist/insights-v2/components/InsightTransactionRow.d.ts +3 -1
- package/dist/insights-v2/components/InsightTransactionRow.es.js +36 -19
- package/dist/insights-v2/components/InsightTransactionRow.es.js.map +1 -1
- package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.d.ts +4 -0
- package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.es.js +11 -0
- package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.es.js.map +1 -0
- package/dist/insights-v2/components/SurveyModal.d.ts +5 -1
- package/dist/insights-v2/components/SurveyModal.es.js +46 -38
- package/dist/insights-v2/components/SurveyModal.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/ctaConfig.es.js +19 -11
- package/dist/insights-v2/ctaActions/ctaConfig.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/index.d.ts +1 -1
- package/dist/insights-v2/ctaActions/runCtaAction.d.ts +5 -1
- package/dist/insights-v2/ctaActions/runCtaAction.es.js +4 -4
- package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/subscriptionAnswer.d.ts +4 -2
- package/dist/insights-v2/ctaActions/subscriptionAnswer.es.js +136 -0
- package/dist/insights-v2/ctaActions/subscriptionAnswer.es.js.map +1 -0
- package/dist/insights-v2/ctaActions/types.d.ts +12 -0
- package/dist/insights-v2/ctaActions/useCtaAction.d.ts +4 -1
- package/dist/insights-v2/ctaActions/useCtaAction.es.js +33 -33
- package/dist/insights-v2/ctaActions/useCtaAction.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [9.7.76] - 11-02-2026
|
|
2
|
+
|
|
3
|
+
- **ADDED** - Subscription Detected beat on Insights 2.0 (WEC-2147): `confirm_subscription_detected` registers the shared subscription status CTA. "Does this look right?" opens the survey, which saves the answer to the repeating transaction (Yes → `CONFIRMED`; a reason → `NEVER_SUBSCRIBED` / `CANCELLED` / `ONE_TIME_PURCHASE` / `WRONG_FREQUENCY`); the card then shows ✓ Confirmed or ✗ Incorrect with Undo. A CTA step can now bring its own survey reasons and submit (`surveyAnswer`); otherwise `survey_modal_block` sends beat feedback, and the last reason can drop its free-text field (`showDetailField`). The `info_wash` row captions the amount with the subscription's live frequency (e.g. YEARLY, from the shared `RECURRENCE_COPY` words; none while unknown) via `InsightTransactionRow` `amountCaption` and TransactionBlock `showFrequency`. Mini shows the "Does this look right?" link (its tap is the host's, as micro); a card whose action travels as `in_description_cta` now runs that step's `prepare`, so mini still loads the frequency. Fixtures, the `InsightsV2/Insights/SubscriptionDetectedV2` story and a contract test
|
|
4
|
+
- **CHANGED** - A CTA status's inline action (e.g. Subscription Detected's Undo) is disabled until its press settles (WEC-2147)
|
|
5
|
+
- **FIXED** - The survey dialog's rows match Figma: no padding under the title, a divider only between rows, filled icons and Figma spacing; the row's frequency caption sits 4px below the amount (WEC-2147)
|
|
6
|
+
|
|
1
7
|
## [9.7.75] - 11-02-2026
|
|
2
8
|
|
|
3
9
|
- **CHANGED** - Savings Opportunity V2 card now renders from the backend contract (WEC-1866): `SavingsOpportunityBlock` is a plain component registered under `savings_amount_block` that reads its slots off `instance_slot.data` (`primary_text`, `amount`), matching what tupac and ditto emit — it was `savings_opportunity_block` reading flat `instance_slot` fields with six speculative safety-net variants, so the card would not have rendered. ditto declares one `save_amount` variant with identical visuals, so the `createVariantBlock` dispatch and `layout.ts` are removed (as with `SaveExtraBlock` / `NoSpendDaysBlock`); the dead `instance_slot.slot` type field is dropped; `BlockType` key renamed `SavingsAmountBlock`; mock fixture, stories and block tests collapsed to the single card. The block guards its unchecked `slot()` reads — a payload without a numeric amount / string caption renders nothing rather than a fabricated `$0.00` coupon. Still to do on this story: the make_transfer / open_savings CTA action blocks (net-new UI, need Figma)
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import { useGlobalCopyStore as
|
|
2
|
-
import { useBeatActions as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { useGlobalCopyStore as _, useGlobalStore as y, useInsightsV2Store as v } from "../../common/context/hooks.es.js";
|
|
2
|
+
import { useBeatActions as d } from "../beatActions.es.js";
|
|
3
|
+
import { resolveStep as g } from "../ctaActions/runCtaAction.es.js";
|
|
4
|
+
import S from "../components/SurveyModal.es.js";
|
|
5
|
+
import { getDynamicCtaBasedOnTriggers as f } from "./util.es.js";
|
|
6
|
+
import { observer as h } from "mobx-react-lite";
|
|
7
|
+
import { jsx as A } from "react/jsx-runtime";
|
|
8
|
+
var B = h(function({ beat: t }) {
|
|
9
|
+
const { actionDrawer: i, closeActionDrawer: n } = v(), r = d(), c = _(), l = y(), o = t.insights_payload, e = c.insights_feed?.survey_modal;
|
|
8
10
|
if (!o || !e) return null;
|
|
9
|
-
const i = {
|
|
11
|
+
const a = f(i, o.primary_cta, o.secondary_cta, o.in_description_cta), s = a && g({ cta: a }).surveyAnswer?.({
|
|
12
|
+
beat: t,
|
|
13
|
+
stores: l,
|
|
14
|
+
hostActions: r
|
|
15
|
+
}, e), u = {
|
|
10
16
|
title: e.title,
|
|
11
17
|
options: [{
|
|
12
18
|
overline: e.yes_overline,
|
|
@@ -20,28 +26,30 @@ var A = p(function({ beat: t }) {
|
|
|
20
26
|
submitText: e.submit,
|
|
21
27
|
closeAriaLabel: e.close_aria,
|
|
22
28
|
reasonsTitle: e.reasons_title,
|
|
23
|
-
reasonOptions: Object.values(e.reason_options ?? {}),
|
|
29
|
+
reasonOptions: s?.reasonOptions ?? Object.values(e.reason_options ?? {}),
|
|
24
30
|
backText: e.back,
|
|
25
31
|
characterLimitLabel: e.character_limit,
|
|
26
32
|
successMessage: e.success_message,
|
|
27
33
|
errorMessage: e.error_message,
|
|
28
34
|
tryAgainText: e.try_again,
|
|
29
35
|
toastCloseAriaLabel: e.toast_close_aria
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
}, m = s?.onSubmit ?? ((p, b) => r.onSubmitFeedback?.({
|
|
37
|
+
beatGuid: o.guid,
|
|
38
|
+
source: "cta",
|
|
39
|
+
option: p,
|
|
40
|
+
detail: b
|
|
41
|
+
}));
|
|
42
|
+
return /* @__PURE__ */ A(S, {
|
|
43
|
+
copy: u,
|
|
33
44
|
isOpen: !0,
|
|
34
|
-
onClose: () =>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
option: n,
|
|
39
|
-
detail: l
|
|
40
|
-
})
|
|
45
|
+
onClose: () => n(),
|
|
46
|
+
onReasonsOpen: s?.onReasonsOpen,
|
|
47
|
+
onSubmit: m,
|
|
48
|
+
showDetailField: s?.showDetailField
|
|
41
49
|
});
|
|
42
50
|
});
|
|
43
51
|
export {
|
|
44
|
-
|
|
52
|
+
B as SurveyModalActionBlock
|
|
45
53
|
};
|
|
46
54
|
|
|
47
55
|
//# sourceMappingURL=SurveyModalActionBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SurveyModalActionBlock.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/SurveyModalActionBlock.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport { useGlobalCopyStore, useInsightsV2Store } from '../../common'\nimport SurveyModal, { type SurveyModalContent } from '../components/SurveyModal'\nimport { useBeatActions } from '../beatActions'\nimport type { ActionBlockProps } from '../mappings/blocks'\n\n/**\n * `survey_modal_block` — the \"Does this look right?\" confirmation survey\n * (Figma `1941:212640`). Registered like any other drawer block; its content\n * is a MODAL (the dialog portals over the drawer).\n *\n * The survey has no action buttons — its rows act: the positive row submits\n * to the host via `beatActions.onSubmitFeedback` (source `cta`) and shows the\n * status snackbar; the negative row opens the FeedbackModal reasons dialog.\n * The session ends when the flow does (snackbar dismissed or dialogs closed).\n *\n * Copy comes from `insights_feed.survey_modal` in GlobalCopy.\n */\nexport const SurveyModalActionBlock = observer(function SurveyModalActionBlock({\n beat,\n}: ActionBlockProps) {\n const { closeActionDrawer } = useInsightsV2Store()\n const
|
|
1
|
+
{"version":3,"file":"SurveyModalActionBlock.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/SurveyModalActionBlock.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport { useGlobalCopyStore, useGlobalStore, useInsightsV2Store } from '../../common'\nimport SurveyModal, { type SurveyModalContent } from '../components/SurveyModal'\nimport { useBeatActions } from '../beatActions'\nimport { resolveStep } from '../ctaActions'\nimport type { ActionBlockProps } from '../mappings/blocks'\nimport { getDynamicCtaBasedOnTriggers } from './util'\n\n/**\n * `survey_modal_block` — the \"Does this look right?\" confirmation survey\n * (Figma `1941:212640`). Registered like any other drawer block; its content\n * is a MODAL (the dialog portals over the drawer).\n *\n * The survey has no action buttons — its rows act: the positive row submits\n * to the host via `beatActions.onSubmitFeedback` (source `cta`) and shows the\n * status snackbar; the negative row opens the FeedbackModal reasons dialog.\n * The session ends when the flow does (snackbar dismissed or dialogs closed).\n *\n * Copy comes from `insights_feed.survey_modal` in GlobalCopy.\n */\nexport const SurveyModalActionBlock = observer(function SurveyModalActionBlock({\n beat,\n}: ActionBlockProps) {\n const { actionDrawer, closeActionDrawer } = useInsightsV2Store()\n const beatActions = useBeatActions()\n const copyStore = useGlobalCopyStore()\n const stores = useGlobalStore()\n\n const insights_payload = beat.insights_payload\n const surveyCopy = copyStore.insights_feed?.survey_modal\n\n if (!insights_payload || !surveyCopy) return null\n\n // The step of the CTA that opened the drawer.\n const cta = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n insights_payload.primary_cta,\n insights_payload.secondary_cta,\n insights_payload.in_description_cta,\n )\n const survey =\n cta &&\n resolveStep({ cta }).surveyAnswer?.({ beat, stores, hostActions: beatActions }, surveyCopy)\n\n const copy: SurveyModalContent = {\n title: surveyCopy.title,\n options: [\n { overline: surveyCopy.yes_overline, label: surveyCopy.yes_label, tone: 'positive' },\n { overline: surveyCopy.no_overline, label: surveyCopy.no_label, tone: 'negative' },\n ],\n submitText: surveyCopy.submit,\n\n closeAriaLabel: surveyCopy.close_aria,\n reasonsTitle: surveyCopy.reasons_title,\n reasonOptions: survey?.reasonOptions ?? Object.values(surveyCopy.reason_options ?? {}),\n backText: surveyCopy.back,\n characterLimitLabel: surveyCopy.character_limit,\n successMessage: surveyCopy.success_message,\n errorMessage: surveyCopy.error_message,\n tryAgainText: surveyCopy.try_again,\n toastCloseAriaLabel: surveyCopy.toast_close_aria,\n }\n\n // Returned (not just fired): a host promise rejection drives the modal's\n // error snackbar + Try Again retry. The session closes when the flow ends\n // (snackbar dismissed), not on submit.\n\n //TODO: Need to update the onSubmit functionality as per pulse. This function is mis-matching with the current approach of switchdirectdeposit and setupdirectdeposit\n const handleSubmit =\n survey?.onSubmit ??\n ((option: string, detail?: string) =>\n beatActions.onSubmitFeedback?.({\n beatGuid: insights_payload.guid,\n source: 'cta',\n option,\n detail,\n }))\n\n return (\n <SurveyModal\n copy={copy}\n isOpen={true}\n onClose={() => closeActionDrawer()}\n onReasonsOpen={survey?.onReasonsOpen}\n onSubmit={handleSubmit}\n showDetailField={survey?.showDetailField}\n />\n )\n})\n"],"mappings":";;;;;;;AAqBA,IAAa,IAAyB,EAAS,SAAgC,EAC7E,MAAA,EAAA,GACmB;AACnB,QAAM,EAAE,cAAA,GAAc,mBAAA,EAAA,IAAsB,EAAmB,GACzD,IAAc,EAAe,GAC7B,IAAY,EAAmB,GAC/B,IAAS,EAAe,GAExB,IAAmB,EAAK,kBACxB,IAAa,EAAU,eAAe;AAE5C,MAAI,CAAC,KAAoB,CAAC,EAAY,QAAO;AAG7C,QAAM,IAAM,EACV,GACA,EAAiB,aACjB,EAAiB,eACjB,EAAiB,kBACnB,GACM,IACJ,KACA,EAAY,EAAE,KAAA,EAAI,CAAC,EAAE,eAAe;AAAA,IAAE,MAAA;AAAA,IAAM,QAAA;AAAA,IAAQ,aAAa;AAAA,EAAY,GAAG,CAAU,GAEtF,IAA2B;AAAA,IAC/B,OAAO,EAAW;AAAA,IAClB,SAAS,CACP;AAAA,MAAE,UAAU,EAAW;AAAA,MAAc,OAAO,EAAW;AAAA,MAAW,MAAM;AAAA,IAAW,GACnF;AAAA,MAAE,UAAU,EAAW;AAAA,MAAa,OAAO,EAAW;AAAA,MAAU,MAAM;AAAA,IAAW,CACnF;AAAA,IACA,YAAY,EAAW;AAAA,IAEvB,gBAAgB,EAAW;AAAA,IAC3B,cAAc,EAAW;AAAA,IACzB,eAAe,GAAQ,iBAAiB,OAAO,OAAO,EAAW,kBAAkB,CAAC,CAAC;AAAA,IACrF,UAAU,EAAW;AAAA,IACrB,qBAAqB,EAAW;AAAA,IAChC,gBAAgB,EAAW;AAAA,IAC3B,cAAc,EAAW;AAAA,IACzB,cAAc,EAAW;AAAA,IACzB,qBAAqB,EAAW;AAAA,EAClC,GAOM,IACJ,GAAQ,aAAA,CACN,GAAgB,MAChB,EAAY,mBAAmB;AAAA,IAC7B,UAAU,EAAiB;AAAA,IAC3B,QAAQ;AAAA,IACR,QAAA;AAAA,IACA,QAAA;AAAA,EACF,CAAC;AAEL,SACE,gBAAA,EAAC,GAAD;AAAA,IACQ,MAAA;AAAA,IACN,QAAQ;AAAA,IACR,SAAA,MAAe,EAAkB;AAAA,IACjC,eAAe,GAAQ;AAAA,IACvB,UAAU;AAAA,IACV,iBAAiB,GAAQ;AAAA,EAC1B,CAAA;AAEL,CAAC"}
|
|
@@ -9,25 +9,25 @@ import { ANALYTICS_EVENTS_CONFIG as P } from "../../analytics/analyticsEventsCon
|
|
|
9
9
|
import { useAnalyticsEvent as It } from "../../analytics/useAnalyticsEvent.es.js";
|
|
10
10
|
import { DoubleBarChart as xt } from "../../components/chartblocks/DoubleBarChart.es.js";
|
|
11
11
|
import { toLegendItems as Et } from "../../blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
12
|
+
import { getDynamicCtaBasedOnTriggers as Rt } from "../util.es.js";
|
|
13
|
+
import { TransactionDrillDown as Ot } from "./TransactionDrillDown.es.js";
|
|
14
|
+
import { getDefaultSelection as jt, getDrillDownConfig as Ft, getFlattenedDataSeries as Gt, resolveDrillDownSubHeader as Ht, splitProjectedTransaction as wt, toStoreFilter as kt } from "./utils.es.js";
|
|
15
|
+
import { useTransactionHistory as Nt } from "./useTransactionHistory.es.js";
|
|
16
16
|
import { TransactionDetailsBlock as Kt } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
|
|
17
17
|
import { useLayoutEffect as Mt, useState as m } from "react";
|
|
18
18
|
import { observer as Pt } from "mobx-react-lite";
|
|
19
19
|
import { Fragment as Vt, jsx as r, jsxs as zt } from "react/jsx-runtime";
|
|
20
20
|
import { useTheme as Ut } from "@mui/material/styles";
|
|
21
21
|
var pe = Pt(({ beat: s }) => {
|
|
22
|
-
const D = Ut(), { actionDrawer: B, setActionContext: S } = yt(), { insights_payload: c } = s, V =
|
|
22
|
+
const D = Ut(), { actionDrawer: B, setActionContext: S } = yt(), { insights_payload: c } = s, V = Rt(B, c?.primary_cta, c?.secondary_cta, c?.in_description_cta)?.variant, { top: e, filterMode: u, header: z, colors: U, filterStrategy: W, tipSection: L, subTabAriaLabels: Y, slotData: $, beatTransactions: q, hideListHeader: J } = Ft(V ?? ""), { instanceSlotData: a, beatTransactions: g, spendCategoryGuids: v, allAccountGuids: I, categoryName: Q, displayedDateRange: f, transactionStore: X } = Nt(s, {
|
|
23
23
|
slotData: $,
|
|
24
24
|
beatTransactions: q
|
|
25
|
-
}), { common: Z, insights_feed: n } = Tt(), { isCopyLoaded: tt } = Ct(), [et, x] = m(!1), [ot, at] = m(!1), E = It(), { dataSeries: p, chartData: b, comparisonBars: i } =
|
|
25
|
+
}), { common: Z, insights_feed: n } = Tt(), { isCopyLoaded: tt } = Ct(), [et, x] = m(!1), [ot, at] = m(!1), E = It(), { dataSeries: p, chartData: b, comparisonBars: i } = Gt({
|
|
26
26
|
data: a?.data_series,
|
|
27
27
|
ariaLabel: e === "doubleBar" ? n?.general?.in_month_you_had_a_category_of_amount ?? "_1{month}, _2{category}: _3{amount}" : St,
|
|
28
28
|
top: e,
|
|
29
29
|
beatTransactions: g
|
|
30
|
-
}), d = e === "doubleBar", nt = e === "tabsOnly", l = d ? i : b, { chartBarIndex: R, subTabIndex: rt } =
|
|
30
|
+
}), d = e === "doubleBar", nt = e === "tabsOnly", l = d ? i : b, { chartBarIndex: R, subTabIndex: rt } = jt({
|
|
31
31
|
chartTabCount: b.length,
|
|
32
32
|
comparisonTabCount: i.length,
|
|
33
33
|
actionDrawer: B,
|
|
@@ -46,7 +46,7 @@ var pe = Pt(({ beat: s }) => {
|
|
|
46
46
|
spendCategoryGuids: v,
|
|
47
47
|
displayedDateRange: f
|
|
48
48
|
}), lt = g.map((t) => t.guid).join(","), ct = v.join(","), dt = I.join(","), mt = e === "list" || e === "tabsOnly" || e === "monthTabs" || p.length > 0, j = () => {
|
|
49
|
-
u !== "store" || !mt || X.setFilter(
|
|
49
|
+
u !== "store" || !mt || X.setFilter(kt(C(o), {
|
|
50
50
|
allAccountGuids: I,
|
|
51
51
|
displayedDateRange: f
|
|
52
52
|
}));
|
|
@@ -66,14 +66,14 @@ var pe = Pt(({ beat: s }) => {
|
|
|
66
66
|
lt,
|
|
67
67
|
e
|
|
68
68
|
]);
|
|
69
|
-
const F =
|
|
69
|
+
const F = Ht(c), y = z?.({
|
|
70
70
|
title: c?.title,
|
|
71
71
|
subHeader: F,
|
|
72
72
|
categoryName: Q,
|
|
73
73
|
selectedDate: b[o]?.date ?? void 0
|
|
74
74
|
}), G = U(D, a?.category_guid);
|
|
75
75
|
if (!tt) return /* @__PURE__ */ r(Bt, {});
|
|
76
|
-
const [H, w] = a?.legends ?? [], ut = u === "local" ? (t) => C(t).custom ?? (() => !0) : void 0, { transactions: gt, projectedTransaction: A } =
|
|
76
|
+
const [H, w] = a?.legends ?? [], ut = u === "local" ? (t) => C(t).custom ?? (() => !0) : void 0, { transactions: gt, projectedTransaction: A } = wt(g), pt = u === "local" ? gt : void 0, k = n.general.projected_amount, bt = A && k && C(o).custom?.(A) ? {
|
|
77
77
|
heading: k,
|
|
78
78
|
transaction: A
|
|
79
79
|
} : void 0, N = (t, h) => {
|
|
@@ -116,7 +116,7 @@ var pe = Pt(({ beat: s }) => {
|
|
|
116
116
|
selectedTabIndex: o,
|
|
117
117
|
trendAmountLabel: w?.label ?? n.general.trend
|
|
118
118
|
}) : /* @__PURE__ */ r(vt, {}) : null;
|
|
119
|
-
return /* @__PURE__ */ zt(Vt, { children: [/* @__PURE__ */ r(
|
|
119
|
+
return /* @__PURE__ */ zt(Vt, { children: [/* @__PURE__ */ r(Ot, {
|
|
120
120
|
baseTransactions: pt,
|
|
121
121
|
hideListHeader: J,
|
|
122
122
|
projectedRow: bt,
|
package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useInsightsV2Store as d, useTransactionStore as f } from "../../../common/context/hooks.es.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { getDynamicCtaBasedOnTriggers as g } from "../util.es.js";
|
|
3
|
+
import { getDrillDownConfig as m, guidListOf as p } from "./utils.es.js";
|
|
4
4
|
import l from "react";
|
|
5
5
|
var w = ({ beat: t }) => {
|
|
6
6
|
const { isTransactionDataLoaded: o, loadMissingTransactionData: s, loadTransactionsByGuids: n } = f(), { actionDrawer: r } = d();
|
|
7
7
|
l.useEffect(() => {
|
|
8
|
-
const a = t?.insights_payload, c =
|
|
8
|
+
const a = t?.insights_payload, c = g(r, a?.primary_cta, a?.secondary_cta, a?.in_description_cta)?.variant, { fetchMissingTransactions: e } = m(c ?? ""), i = p(e?.(t));
|
|
9
9
|
(async () => (o || await s(), i && await n(i)))();
|
|
10
10
|
}, []);
|
|
11
11
|
};
|
|
@@ -1,95 +1,102 @@
|
|
|
1
|
-
import { useCategoryStore as
|
|
2
|
-
import { slot as
|
|
3
|
-
import { formatCurrency as
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { useCategoryStore as L, useGlobalCopyStore as O, useGlobalStore as B } from "../../../../common/context/hooks.es.js";
|
|
2
|
+
import { slot as n } from "../../../../core/types/Insights.es.js";
|
|
3
|
+
import { formatCurrency as f } from "../../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import { useBeatActions as k } from "../../../beatActions.es.js";
|
|
5
|
+
import { repeatingTransactionOf as z } from "../../../ctaActions/subscriptionAnswer.es.js";
|
|
6
|
+
import { logoFromRef as A } from "../../../components/shared/EntityLogo.es.js";
|
|
7
|
+
import F from "../../../components/LogoFromGuid.es.js";
|
|
8
|
+
import { resolveVariantConfig as M } from "../../resolveVariantConfig.es.js";
|
|
9
|
+
import R from "../../../components/TransactionListCard.es.js";
|
|
10
|
+
import q from "../../../components/StatusMessageCard.es.js";
|
|
11
|
+
import { subscriptionFrequency as E } from "../../../components/SubscriptionStatus/subscriptionFrequency.es.js";
|
|
12
|
+
import { getLayoutConfig as N, transactionBlockVariant as V } from "./layout.es.js";
|
|
13
|
+
import { observer as Z } from "mobx-react-lite";
|
|
14
|
+
import { CategoryIcon as j, InstitutionLogo as w, MerchantLogo as H } from "@mxenabled/mxui";
|
|
15
|
+
import { Icon as W } from "@mxenabled/mx-icons";
|
|
16
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
17
|
+
import { useTheme as $ } from "@mui/material/styles";
|
|
18
|
+
import u from "@mui/material/Box";
|
|
19
|
+
var i = 32, U = Math.round(i * 0.625), D = 20, J = (a, s) => {
|
|
20
|
+
const o = A(a.logo, a.primary_text);
|
|
21
|
+
if (o) {
|
|
22
|
+
if (o.logo_name) return /* @__PURE__ */ t(u, {
|
|
20
23
|
sx: {
|
|
21
24
|
alignItems: "center",
|
|
22
25
|
display: "flex",
|
|
23
|
-
height:
|
|
26
|
+
height: i,
|
|
24
27
|
justifyContent: "center",
|
|
25
|
-
width:
|
|
28
|
+
width: i
|
|
26
29
|
},
|
|
27
|
-
children: /* @__PURE__ */
|
|
28
|
-
name:
|
|
29
|
-
size:
|
|
30
|
-
sx: { color:
|
|
30
|
+
children: /* @__PURE__ */ t(W, {
|
|
31
|
+
name: o.logo_name,
|
|
32
|
+
size: U,
|
|
33
|
+
sx: { color: o.logo_color }
|
|
31
34
|
})
|
|
32
35
|
});
|
|
33
|
-
if (
|
|
34
|
-
alt:
|
|
35
|
-
categoryGuid:
|
|
36
|
-
merchantGuid:
|
|
37
|
-
size:
|
|
36
|
+
if (o.merchant_guid) return /* @__PURE__ */ t(H, {
|
|
37
|
+
alt: o.merchant_name ?? "",
|
|
38
|
+
categoryGuid: o.category_guid ? s(o.category_guid) : "",
|
|
39
|
+
merchantGuid: o.merchant_guid,
|
|
40
|
+
size: i
|
|
38
41
|
});
|
|
39
|
-
if (
|
|
40
|
-
alt:
|
|
41
|
-
institutionGuid:
|
|
42
|
-
size:
|
|
42
|
+
if (o.institution_guid) return /* @__PURE__ */ t(w, {
|
|
43
|
+
alt: o.institution_name ?? "",
|
|
44
|
+
institutionGuid: o.institution_guid,
|
|
45
|
+
size: i
|
|
43
46
|
});
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
"data-testid": `category-icon-${
|
|
47
|
+
if (o.category_guid) {
|
|
48
|
+
const m = s(o.category_guid);
|
|
49
|
+
return /* @__PURE__ */ t(u, {
|
|
50
|
+
"data-testid": `category-icon-${m}`,
|
|
48
51
|
sx: { display: "flex" },
|
|
49
|
-
children: /* @__PURE__ */
|
|
50
|
-
categoryGuid:
|
|
51
|
-
size:
|
|
52
|
+
children: /* @__PURE__ */ t(j, {
|
|
53
|
+
categoryGuid: m,
|
|
54
|
+
size: i
|
|
52
55
|
})
|
|
53
56
|
});
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
|
-
},
|
|
57
|
-
const s =
|
|
58
|
-
if (
|
|
59
|
-
const
|
|
60
|
-
return typeof
|
|
61
|
-
icon: /* @__PURE__ */
|
|
59
|
+
}, lo = Z(({ payload: a }) => {
|
|
60
|
+
const s = $(), { getTopLevelCategoryGuid: o } = L(), m = B(), { recurring: l } = O(), { beat: g } = k(), { data: e, variant: p } = a.instance_slot, { background: y, cardVariant: _, showFooter: h, showFrequency: x, showHeader: v, statusMessage: C } = M(N(s), p, V.NoHeader, "TransactionBlock");
|
|
61
|
+
if (C) {
|
|
62
|
+
const r = n(e, "message");
|
|
63
|
+
return typeof r != "string" || !r.trim() ? (console.warn("[TransactionBlock] status_message has no message — rendering nothing."), null) : /* @__PURE__ */ t(q, {
|
|
64
|
+
icon: /* @__PURE__ */ t(u, {
|
|
62
65
|
"aria-hidden": "true",
|
|
63
66
|
sx: { display: "flex" },
|
|
64
|
-
children: /* @__PURE__ */
|
|
65
|
-
logo:
|
|
66
|
-
size:
|
|
67
|
+
children: /* @__PURE__ */ t(F, {
|
|
68
|
+
logo: n(e, "icon"),
|
|
69
|
+
size: D
|
|
67
70
|
})
|
|
68
71
|
}),
|
|
69
|
-
message:
|
|
72
|
+
message: r
|
|
70
73
|
});
|
|
71
74
|
}
|
|
72
|
-
const
|
|
73
|
-
if (!Array.isArray(
|
|
74
|
-
const
|
|
75
|
-
label:
|
|
76
|
-
amount:
|
|
77
|
-
} : void 0
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
75
|
+
const c = n(e, "series"), d = n(e, "header_text");
|
|
76
|
+
if (!Array.isArray(c) || !c.length) return null;
|
|
77
|
+
const G = v && typeof d == "string" ? d : void 0, I = n(e, "footer_text"), T = n(e, "footer_amount"), b = h ? {
|
|
78
|
+
label: I,
|
|
79
|
+
amount: f(T, "0,0.00")
|
|
80
|
+
} : void 0, S = x && g ? E(l, z({
|
|
81
|
+
beat: g,
|
|
82
|
+
stores: m
|
|
83
|
+
})) : void 0;
|
|
84
|
+
return /* @__PURE__ */ t(R, {
|
|
85
|
+
background: y,
|
|
86
|
+
footer: b,
|
|
87
|
+
header: G,
|
|
88
|
+
variant: _,
|
|
89
|
+
rows: c.map((r) => ({
|
|
90
|
+
amount: typeof r.amount == "number" ? f(r.amount, "0,0.00") : "",
|
|
91
|
+
amountCaption: S,
|
|
92
|
+
leading: J(r, o),
|
|
93
|
+
subtitle: r.secondary_text ?? "",
|
|
94
|
+
title: r.primary_text ?? ""
|
|
88
95
|
}))
|
|
89
96
|
});
|
|
90
97
|
});
|
|
91
98
|
export {
|
|
92
|
-
|
|
99
|
+
lo as TransactionBlock
|
|
93
100
|
};
|
|
94
101
|
|
|
95
102
|
//# sourceMappingURL=TransactionBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport { useTheme } from '@mui/material/styles'\n\nimport { CategoryIcon, InstitutionLogo, MerchantLogo } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { useCategoryStore } from '../../../../common'\nimport { slot } from '../../../../core'\nimport type { InsightsPayload, InstanceSlotRow, LogoRef } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport StatusMessageCard from '../../../components/StatusMessageCard'\nimport TransactionListCard from '../../../components/TransactionListCard'\nimport { logoFromRef } from '../../../components/shared/EntityLogo'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { getLayoutConfig, transactionBlockVariant } from './layout'\n\ninterface TransactionBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nconst ROW_LOGO_SIZE = 32\n// Same glyph-to-tile ratio mxui's `CategoryIcon` uses, so a status icon sits like the other logos.\nconst ROW_ICON_SIZE = Math.round(ROW_LOGO_SIZE * 0.625)\nconst STATUS_ICON_SIZE = 20\n\n/**\n * Renders the row's leading logo from its `LogoRef`: a status icon, or an entity guid whose prefix\n * names the entity. An unrecognized prefix renders no logo rather than guessing.\n *\n * `resolveTopLevelCategory`: mxui's `CategoryIcon` only knows the top-level category guids and\n * silently falls back to the Uncategorized icon for a sub-category. The details drawer avoids\n * this by passing `transaction.top_level_category_guid`; the row only has the raw guid, so it is\n * walked up to its parent here (identity until categories load). That applies both to a `CAT-`\n * row logo and to a merchant's `fallback_guid`, which `MerchantLogo` draws through the same\n * `CategoryIcon` when the merchant image fails to load.\n */\nconst renderRowLogo = (row: InstanceSlotRow, resolveTopLevelCategory: (guid: string) => string) => {\n const logo = logoFromRef(row.logo, row.primary_text)\n\n if (!logo) return undefined\n\n if (logo.logo_name) {\n // A fixed box the size of the other logos keeps the row's text column aligned.\n return (\n <Box\n sx={{\n alignItems: 'center',\n display: 'flex',\n height: ROW_LOGO_SIZE,\n justifyContent: 'center',\n width: ROW_LOGO_SIZE,\n }}\n >\n <Icon name={logo.logo_name} size={ROW_ICON_SIZE} sx={{ color: logo.logo_color }} />\n </Box>\n )\n }\n\n if (logo.merchant_guid) {\n return (\n <MerchantLogo\n alt={logo.merchant_name ?? ''}\n categoryGuid={logo.category_guid ? resolveTopLevelCategory(logo.category_guid) : ''}\n merchantGuid={logo.merchant_guid}\n size={ROW_LOGO_SIZE}\n />\n )\n }\n\n if (logo.institution_guid) {\n return (\n <InstitutionLogo\n alt={logo.institution_name ?? ''}\n institutionGuid={logo.institution_guid}\n size={ROW_LOGO_SIZE}\n />\n )\n }\n\n if (logo.category_guid) {\n const topLevelGuid = resolveTopLevelCategory(logo.category_guid)\n return (\n <Box data-testid={`category-icon-${topLevelGuid}`} sx={{ display: 'flex' }}>\n <CategoryIcon categoryGuid={topLevelGuid} size={ROW_LOGO_SIZE} />\n </Box>\n )\n }\n\n return undefined\n}\n\n/**\n * The `transaction_block`: rows the backend already localized, carried inline on\n * `instance_slot.data.series` (`logo`, `primary_text`, `secondary_text`, `amount`). Only the\n * amount is formatted here, because the contract sends it as a number. `instance_slot.variant`\n * picks the header and slot treatment from `./layout.ts`.\n *\n * This is the full/mini shape. The reduced widgets (micro, embedded) resolve to the row logo\n * alone, carried flat on `data.logo` with no `series`, and are drawn by `CompactInsightCard`.\n *\n * `status_message` draws no rows: `data.message` beside the `data.icon` logo, as a\n * `StatusMessageCard` banner (Uncategorized Transactions V2 `complete`).\n *\n * A header, when the variant shows one, comes from `instance_slot.data.header_text` (the\n * transaction date, or \"{count} transactions\"). It deliberately does *not* come from the first\n * row: on a `with_merchant` card a row's `secondary_text` is the category, so reading it here\n * rendered the category twice and dropped the date entirely.\n *\n * A footer/summary row (Replenish Savings' \"Remaining Balance\") renders under the\n * `with_header_footer` variant, from `data.footer_text` with `data.footer_amount` beside it,\n * formatted like the row amounts (the contract sends it as a number).\n */\nexport const TransactionBlock = observer(({ payload }: TransactionBlockProps) => {\n const theme = useTheme()\n const { getTopLevelCategoryGuid } = useCategoryStore()\n const { data, variant } = payload.instance_slot\n // The plain row is the safe default: it adds nothing a wrong variant could misstate.\n const { background, cardVariant, showFooter, showHeader, statusMessage } = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n transactionBlockVariant.NoHeader,\n 'TransactionBlock',\n )\n\n if (statusMessage) {\n const message = slot<string>(data, 'message')\n if (typeof message !== 'string' || !message.trim()) {\n console.warn('[TransactionBlock] status_message has no message — rendering nothing.')\n return null\n }\n\n // The icon only decorates the message, so it is hidden from the status announcement.\n return (\n <StatusMessageCard\n icon={\n <Box aria-hidden=\"true\" sx={{ display: 'flex' }}>\n <LogoFromGuid logo={slot<LogoRef>(data, 'icon')} size={STATUS_ICON_SIZE} />\n </Box>\n }\n message={message}\n />\n )\n }\n\n const series = slot<InstanceSlotRow[]>(data, 'series')\n const headerText = slot<string>(data, 'header_text')\n\n if (!Array.isArray(series) || !series.length) return null\n\n const header = showHeader && typeof headerText === 'string' ? headerText : undefined\n\n const footerText = slot<string>(data, 'footer_text')\n const footerAmount = slot<number>(data, 'footer_amount')\n const footer = showFooter\n ? {\n label: footerText,\n amount: formatCurrency(footerAmount, '0,0.00'),\n }\n : undefined\n\n return (\n <TransactionListCard\n background={background}\n footer={footer}\n header={header}\n variant={cardVariant}\n rows={series.map((row) => ({\n amount: typeof row.amount === 'number' ? formatCurrency(row.amount, '0,0.00') : '',\n leading: renderRowLogo(row, getTopLevelCategoryGuid),\n subtitle: row.secondary_text ?? '',\n title: row.primary_text ?? '',\n }))}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;AA0BA,IAAM,IAAgB,IAEhB,IAAgB,KAAK,MAAM,IAAgB,KAAK,GAChD,IAAmB,IAanB,IAAA,CAAiB,GAAsB,MAAsD;AACjG,QAAM,IAAO,EAAY,EAAI,MAAM,EAAI,YAAY;AAEnD,MAAK,GAEL;AAAA,QAAI,EAAK,UAEP,QACE,gBAAA,EAAC,GAAD;AAAA,MACE,IAAI;AAAA,QACF,YAAY;AAAA,QACZ,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,gBAAgB;AAAA,QAChB,OAAO;AAAA,MACT;AAAA,MAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,QAAM,MAAM,EAAK;AAAA,QAAW,MAAM;AAAA,QAAe,IAAI,EAAE,OAAO,EAAK,WAAW;AAAA,MAAI,CAAA;AAAA,IAC/E,CAAA;AAIT,QAAI,EAAK,cACP,QACE,gBAAA,EAAC,GAAD;AAAA,MACE,KAAK,EAAK,iBAAiB;AAAA,MAC3B,cAAc,EAAK,gBAAgB,EAAwB,EAAK,aAAa,IAAI;AAAA,MACjF,cAAc,EAAK;AAAA,MACnB,MAAM;AAAA,IACP,CAAA;AAIL,QAAI,EAAK,iBACP,QACE,gBAAA,EAAC,GAAD;AAAA,MACE,KAAK,EAAK,oBAAoB;AAAA,MAC9B,iBAAiB,EAAK;AAAA,MACtB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,IAAa,QAErE,IAAa,EAAa,GAAM,aAAa,GAC7C,IAAe,EAAa,GAAM,eAAe,GACjD,IAAS,IACX;AAAA,IACE,OAAO;AAAA,IACP,QAAQ,EAAe,GAAc,QAAQ;AAAA,EAC/C,IACA;AAEJ,SACE,gBAAA,EAAC,GAAD;AAAA,IACc,YAAA;AAAA,IACJ,QAAA;AAAA,IACA,QAAA;AAAA,IACR,SAAS;AAAA,IACT,MAAM,EAAO,IAAA,CAAK,OAAS;AAAA,MACzB,QAAQ,OAAO,EAAI,UAAW,WAAW,EAAe,EAAI,QAAQ,QAAQ,IAAI;AAAA,MAChF,SAAS,EAAc,GAAK,CAAuB;AAAA,MACnD,UAAU,EAAI,kBAAkB;AAAA,MAChC,OAAO,EAAI,gBAAgB;AAAA,IAC7B,EAAE;AAAA,EACH,CAAA;AAEL,CAAC"}
|
|
1
|
+
{"version":3,"file":"TransactionBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport { useTheme } from '@mui/material/styles'\n\nimport { CategoryIcon, InstitutionLogo, MerchantLogo } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { useCategoryStore, useGlobalCopyStore, useGlobalStore } from '../../../../common'\nimport { slot } from '../../../../core'\nimport type { InsightsPayload, InstanceSlotRow, LogoRef } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport { useBeatActions } from '../../../beatActions'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport StatusMessageCard from '../../../components/StatusMessageCard'\nimport TransactionListCard from '../../../components/TransactionListCard'\nimport { logoFromRef } from '../../../components/shared/EntityLogo'\nimport { subscriptionFrequency } from '../../../components/SubscriptionStatus/subscriptionFrequency'\nimport { repeatingTransactionOf } from '../../../ctaActions/subscriptionAnswer'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { getLayoutConfig, transactionBlockVariant } from './layout'\n\ninterface TransactionBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nconst ROW_LOGO_SIZE = 32\n// Same glyph-to-tile ratio mxui's `CategoryIcon` uses, so a status icon sits like the other logos.\nconst ROW_ICON_SIZE = Math.round(ROW_LOGO_SIZE * 0.625)\nconst STATUS_ICON_SIZE = 20\n\n/**\n * Renders the row's leading logo from its `LogoRef`: a status icon, or an entity guid whose prefix\n * names the entity. An unrecognized prefix renders no logo rather than guessing.\n *\n * `resolveTopLevelCategory`: mxui's `CategoryIcon` only knows the top-level category guids and\n * silently falls back to the Uncategorized icon for a sub-category. The details drawer avoids\n * this by passing `transaction.top_level_category_guid`; the row only has the raw guid, so it is\n * walked up to its parent here (identity until categories load). That applies both to a `CAT-`\n * row logo and to a merchant's `fallback_guid`, which `MerchantLogo` draws through the same\n * `CategoryIcon` when the merchant image fails to load.\n */\nconst renderRowLogo = (row: InstanceSlotRow, resolveTopLevelCategory: (guid: string) => string) => {\n const logo = logoFromRef(row.logo, row.primary_text)\n\n if (!logo) return undefined\n\n if (logo.logo_name) {\n // A fixed box the size of the other logos keeps the row's text column aligned.\n return (\n <Box\n sx={{\n alignItems: 'center',\n display: 'flex',\n height: ROW_LOGO_SIZE,\n justifyContent: 'center',\n width: ROW_LOGO_SIZE,\n }}\n >\n <Icon name={logo.logo_name} size={ROW_ICON_SIZE} sx={{ color: logo.logo_color }} />\n </Box>\n )\n }\n\n if (logo.merchant_guid) {\n return (\n <MerchantLogo\n alt={logo.merchant_name ?? ''}\n categoryGuid={logo.category_guid ? resolveTopLevelCategory(logo.category_guid) : ''}\n merchantGuid={logo.merchant_guid}\n size={ROW_LOGO_SIZE}\n />\n )\n }\n\n if (logo.institution_guid) {\n return (\n <InstitutionLogo\n alt={logo.institution_name ?? ''}\n institutionGuid={logo.institution_guid}\n size={ROW_LOGO_SIZE}\n />\n )\n }\n\n if (logo.category_guid) {\n const topLevelGuid = resolveTopLevelCategory(logo.category_guid)\n return (\n <Box data-testid={`category-icon-${topLevelGuid}`} sx={{ display: 'flex' }}>\n <CategoryIcon categoryGuid={topLevelGuid} size={ROW_LOGO_SIZE} />\n </Box>\n )\n }\n\n return undefined\n}\n\n/**\n * The `transaction_block`: rows the backend already localized, carried inline on\n * `instance_slot.data.series` (`logo`, `primary_text`, `secondary_text`, `amount`). Only the\n * amount is formatted here, because the contract sends it as a number. `instance_slot.variant`\n * picks the header and slot treatment from `./layout.ts`.\n *\n * This is the full/mini shape. The reduced widgets (micro, embedded) resolve to the row logo\n * alone, carried flat on `data.logo` with no `series`, and are drawn by `CompactInsightCard`.\n *\n * `status_message` draws no rows: `data.message` beside the `data.icon` logo, as a\n * `StatusMessageCard` banner (Uncategorized Transactions V2 `complete`).\n *\n * A header, when the variant shows one, comes from `instance_slot.data.header_text` (the\n * transaction date, or \"{count} transactions\"). It deliberately does *not* come from the first\n * row: on a `with_merchant` card a row's `secondary_text` is the category, so reading it here\n * rendered the category twice and dropped the date entirely.\n *\n * A footer/summary row (Replenish Savings' \"Remaining Balance\") renders under the\n * `with_header_footer` variant, from `data.footer_text` with `data.footer_amount` beside it,\n * formatted like the row amounts (the contract sends it as a number).\n */\nexport const TransactionBlock = observer(({ payload }: TransactionBlockProps) => {\n const theme = useTheme()\n const { getTopLevelCategoryGuid } = useCategoryStore()\n const stores = useGlobalStore()\n const { recurring: recurringCopy } = useGlobalCopyStore()\n const { beat } = useBeatActions()\n const { data, variant } = payload.instance_slot\n // The plain row is the safe default: it adds nothing a wrong variant could misstate.\n const { background, cardVariant, showFooter, showFrequency, showHeader, statusMessage } =\n resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n transactionBlockVariant.NoHeader,\n 'TransactionBlock',\n )\n\n if (statusMessage) {\n const message = slot<string>(data, 'message')\n if (typeof message !== 'string' || !message.trim()) {\n console.warn('[TransactionBlock] status_message has no message — rendering nothing.')\n return null\n }\n\n // The icon only decorates the message, so it is hidden from the status announcement.\n return (\n <StatusMessageCard\n icon={\n <Box aria-hidden=\"true\" sx={{ display: 'flex' }}>\n <LogoFromGuid logo={slot<LogoRef>(data, 'icon')} size={STATUS_ICON_SIZE} />\n </Box>\n }\n message={message}\n />\n )\n }\n\n const series = slot<InstanceSlotRow[]>(data, 'series')\n const headerText = slot<string>(data, 'header_text')\n\n if (!Array.isArray(series) || !series.length) return null\n\n const header = showHeader && typeof headerText === 'string' ? headerText : undefined\n\n const footerText = slot<string>(data, 'footer_text')\n const footerAmount = slot<number>(data, 'footer_amount')\n const footer = showFooter\n ? {\n label: footerText,\n amount: formatCurrency(footerAmount, '0,0.00'),\n }\n : undefined\n\n // Live, as pulse: the repeating transaction the CTA's `prepare` loads.\n const frequency =\n showFrequency && beat\n ? subscriptionFrequency(recurringCopy, repeatingTransactionOf({ beat, stores }))\n : undefined\n\n return (\n <TransactionListCard\n background={background}\n footer={footer}\n header={header}\n variant={cardVariant}\n rows={series.map((row) => ({\n amount: typeof row.amount === 'number' ? formatCurrency(row.amount, '0,0.00') : '',\n amountCaption: frequency,\n leading: renderRowLogo(row, getTopLevelCategoryGuid),\n subtitle: row.secondary_text ?? '',\n title: row.primary_text ?? '',\n }))}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6BA,IAAM,IAAgB,IAEhB,IAAgB,KAAK,MAAM,IAAgB,KAAK,GAChD,IAAmB,IAanB,IAAA,CAAiB,GAAsB,MAAsD;AACjG,QAAM,IAAO,EAAY,EAAI,MAAM,EAAI,YAAY;AAEnD,MAAK,GAEL;AAAA,QAAI,EAAK,UAEP,QACE,gBAAA,EAAC,GAAD;AAAA,MACE,IAAI;AAAA,QACF,YAAY;AAAA,QACZ,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,gBAAgB;AAAA,QAChB,OAAO;AAAA,MACT;AAAA,MAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,QAAM,MAAM,EAAK;AAAA,QAAW,MAAM;AAAA,QAAe,IAAI,EAAE,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
|
|
9
9
|
* - `NoHeader` — the row alone (Large Transaction without a merchant).
|
|
10
10
|
* - `UncategorizedTransaction` — filled primary header ("{count} transactions").
|
|
11
|
-
* - `InfoWash` — borderless row on the blue slot wash
|
|
11
|
+
* - `InfoWash` — borderless row on the blue slot wash, with the subscription's live
|
|
12
|
+
* frequency under the amount (e.g. Subscription Detected).
|
|
12
13
|
* - `WarningWash` — borderless row on the warning slot wash (e.g. Unexpected
|
|
13
14
|
* Subscription Payment). Treatment names, not beat names, so any beat can reuse the wash.
|
|
14
15
|
* - `StatusMessage` — no rows: an icon + message banner from `data.icon` / `data.message`
|
|
@@ -35,6 +36,8 @@ export interface TransactionLayoutConfig {
|
|
|
35
36
|
background?: string;
|
|
36
37
|
/** Render `data.message` as a `StatusMessageCard` banner instead of the rows. */
|
|
37
38
|
statusMessage?: boolean;
|
|
39
|
+
/** Caption each amount with the beat's live repeating transaction frequency. */
|
|
40
|
+
showFrequency?: boolean;
|
|
38
41
|
}
|
|
39
42
|
/** Per-variant `TransactionListCard` props (mirrors DetailedAccountBlock's `getLayoutConfig`). */
|
|
40
43
|
export declare const getLayoutConfig: (theme: Theme) => Record<TransactionBlockVariant, TransactionLayoutConfig>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles'\n\nimport {\n WARNING_WASH_GRADIENT,\n getPrimaryWashGradient,\n} from '../../../components/celebrationGradients'\n\n/**\n * Transaction block variants, keyed by the backend `instance_slot.variant`. All render the same\n * pre-localized rows through `TransactionListCard`; only the header and the slot differ.\n *\n * - `WithHeader` — row under a date header (Fee Detected, Large Transaction).\n * - `WithHeaderFooter` — date header above the rows plus the footer/summary row from\n * `data.footer_text` / `data.footer_amount` (Replenish Savings' \"Remaining Balance\").\n * - `NoHeader` — the row alone (Large Transaction without a merchant).\n * - `UncategorizedTransaction` — filled primary header (\"{count} transactions\").\n * - `InfoWash` — borderless row on the blue slot wash (e.g. Subscription Detected).\n * - `WarningWash` — borderless row on the warning slot wash (e.g. Unexpected\n * Subscription Payment). Treatment names, not beat names, so any beat can reuse the wash.\n * - `StatusMessage` — no rows: an icon + message banner from `data.icon` / `data.message`\n * (Uncategorized Transactions V2 `complete`, \"All Categorized!\").\n */\nexport const transactionBlockVariant = {\n WithHeader: 'with_header',\n WithHeaderFooter: 'with_header_footer',\n NoHeader: 'no_header',\n UncategorizedTransaction: 'uncategorized_transaction',\n InfoWash: 'info_wash',\n WarningWash: 'warning_wash',\n StatusMessage: 'status_message',\n} as const\n\nexport type TransactionBlockVariant =\n (typeof transactionBlockVariant)[keyof typeof transactionBlockVariant]\n\nexport interface TransactionLayoutConfig {\n /** Show `instance_slot.data.header_text` above the rows. */\n showHeader: boolean\n /** Show the `data.footer_text` / `data.footer_amount` summary row beneath the rows. */\n showFooter?: boolean\n /** `TransactionListCard` style: grey utility header, or filled primary header. */\n cardVariant?: 'default' | 'primary'\n /** CSS background for the slot behind the card; the card then renders borderless on paper. */\n background?: string\n /** Render `data.message` as a `StatusMessageCard` banner instead of the rows. */\n statusMessage?: boolean\n}\n\n/** Per-variant `TransactionListCard` props (mirrors DetailedAccountBlock's `getLayoutConfig`). */\nexport const getLayoutConfig = (\n theme: Theme,\n): Record<TransactionBlockVariant, TransactionLayoutConfig> => ({\n [transactionBlockVariant.WithHeader]: { showHeader: true },\n [transactionBlockVariant.WithHeaderFooter]: { showHeader: true, showFooter: true },\n [transactionBlockVariant.NoHeader]: { showHeader: false },\n [transactionBlockVariant.UncategorizedTransaction]: { showHeader: true, cardVariant: 'primary' },\n [transactionBlockVariant.InfoWash]: {\n showHeader: false,\n background: getPrimaryWashGradient(theme),\n },\n [transactionBlockVariant.WarningWash]: {\n showHeader: false,\n background: WARNING_WASH_GRADIENT,\n },\n [transactionBlockVariant.StatusMessage]: { showHeader: false, statusMessage: true },\n})\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles'\n\nimport {\n WARNING_WASH_GRADIENT,\n getPrimaryWashGradient,\n} from '../../../components/celebrationGradients'\n\n/**\n * Transaction block variants, keyed by the backend `instance_slot.variant`. All render the same\n * pre-localized rows through `TransactionListCard`; only the header and the slot differ.\n *\n * - `WithHeader` — row under a date header (Fee Detected, Large Transaction).\n * - `WithHeaderFooter` — date header above the rows plus the footer/summary row from\n * `data.footer_text` / `data.footer_amount` (Replenish Savings' \"Remaining Balance\").\n * - `NoHeader` — the row alone (Large Transaction without a merchant).\n * - `UncategorizedTransaction` — filled primary header (\"{count} transactions\").\n * - `InfoWash` — borderless row on the blue slot wash, with the subscription's live\n * frequency under the amount (e.g. Subscription Detected).\n * - `WarningWash` — borderless row on the warning slot wash (e.g. Unexpected\n * Subscription Payment). Treatment names, not beat names, so any beat can reuse the wash.\n * - `StatusMessage` — no rows: an icon + message banner from `data.icon` / `data.message`\n * (Uncategorized Transactions V2 `complete`, \"All Categorized!\").\n */\nexport const transactionBlockVariant = {\n WithHeader: 'with_header',\n WithHeaderFooter: 'with_header_footer',\n NoHeader: 'no_header',\n UncategorizedTransaction: 'uncategorized_transaction',\n InfoWash: 'info_wash',\n WarningWash: 'warning_wash',\n StatusMessage: 'status_message',\n} as const\n\nexport type TransactionBlockVariant =\n (typeof transactionBlockVariant)[keyof typeof transactionBlockVariant]\n\nexport interface TransactionLayoutConfig {\n /** Show `instance_slot.data.header_text` above the rows. */\n showHeader: boolean\n /** Show the `data.footer_text` / `data.footer_amount` summary row beneath the rows. */\n showFooter?: boolean\n /** `TransactionListCard` style: grey utility header, or filled primary header. */\n cardVariant?: 'default' | 'primary'\n /** CSS background for the slot behind the card; the card then renders borderless on paper. */\n background?: string\n /** Render `data.message` as a `StatusMessageCard` banner instead of the rows. */\n statusMessage?: boolean\n /** Caption each amount with the beat's live repeating transaction frequency. */\n showFrequency?: boolean\n}\n\n/** Per-variant `TransactionListCard` props (mirrors DetailedAccountBlock's `getLayoutConfig`). */\nexport const getLayoutConfig = (\n theme: Theme,\n): Record<TransactionBlockVariant, TransactionLayoutConfig> => ({\n [transactionBlockVariant.WithHeader]: { showHeader: true },\n [transactionBlockVariant.WithHeaderFooter]: { showHeader: true, showFooter: true },\n [transactionBlockVariant.NoHeader]: { showHeader: false },\n [transactionBlockVariant.UncategorizedTransaction]: { showHeader: true, cardVariant: 'primary' },\n [transactionBlockVariant.InfoWash]: {\n showHeader: false,\n background: getPrimaryWashGradient(theme),\n showFrequency: true,\n },\n [transactionBlockVariant.WarningWash]: {\n showHeader: false,\n background: WARNING_WASH_GRADIENT,\n },\n [transactionBlockVariant.StatusMessage]: { showHeader: false, statusMessage: true },\n})\n"],"mappings":";AAuBA,IAAa,IAA0B;AAAA,EACrC,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,0BAA0B;AAAA,EAC1B,UAAU;AAAA,EACV,aAAa;AAAA,EACb,eAAe;AACjB,GAqBa,IAAA,CACX,OAC8D;AAAA,EAC7D,CAAA,EAAwB,UAAA,GAAa,EAAE,YAAY,GAAK;AAAA,EACxD,CAAA,EAAwB,gBAAA,GAAmB;AAAA,IAAE,YAAY;AAAA,IAAM,YAAY;AAAA,EAAK;AAAA,EAChF,CAAA,EAAwB,QAAA,GAAW,EAAE,YAAY,GAAM;AAAA,EACvD,CAAA,EAAwB,wBAAA,GAA2B;AAAA,IAAE,YAAY;AAAA,IAAM,aAAa;AAAA,EAAU;AAAA,EAC9F,CAAA,EAAwB,QAAA,GAAW;AAAA,IAClC,YAAY;AAAA,IACZ,YAAY,EAAuB,CAAK;AAAA,IACxC,eAAe;AAAA,EACjB;AAAA,EACC,CAAA,EAAwB,WAAA,GAAc;AAAA,IACrC,YAAY;AAAA,IACZ,YAAY;AAAA,EACd;AAAA,EACC,CAAA,EAAwB,aAAA,GAAgB;AAAA,IAAE,YAAY;AAAA,IAAO,eAAe;AAAA,EAAK;AACpF"}
|