@mx-cartographer/experiences 9.7.52 → 9.7.54
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 +10 -0
- package/dist/common/utils/PostMessage.d.ts +14 -0
- package/dist/common/utils/PostMessage.es.js +33 -24
- package/dist/common/utils/PostMessage.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +47 -47
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/components/BaseLayout.es.js +97 -90
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [9.7.54] - 10-27-2026
|
|
2
|
+
|
|
3
|
+
- **ADDED** - Savings Account Balances Summary's "View more" drawer on Insights 2.0 (MEW2-3370): the `transaction_history_block` `account_balance` row now scopes to `beat.account_guids` (the slot field it read is never set on a bar chart payload) and ends the most recent month at the beat's creation only when the beat was created inside that month, reading the envelope's epoch-seconds `created_at` as well as the wrapper's ISO string. The fixture's CTA names `transaction_history_block` / `account_balance` with the beat guid and one mock savings account, its transactions in `SavingsAccountBalancesTransactions.ts` outside the shared mock generator, plus the beat story, contract test and `docs/action-blocks/transaction-history-block.md`
|
|
4
|
+
|
|
5
|
+
## [9.7.53] - 10-27-2026
|
|
6
|
+
|
|
7
|
+
- **ADDED** - Switch Direct Deposit on Insights 2.0 (WEC-2134): fixtures from tupac's real envelopes, one per widget and state (`SwitchDirectDeposit_<state>_<widget>` in `AccountSwitchBlockPayload.json`, `switchBeats` and friends in `AccountSwitchBlockBeats.ts`), the `InsightsV2/Insights/SwitchDirectDeposit` story and `SwitchDirectDepositContract.test.tsx`. It pins that the pending card draws both logos on `account_switch_block` (and omits a missing one), the complete card is the held account's tile on `direct_deposit_block`, embedded draws both logos and no action link (an open point), micro (the micro card) the held logo and the Atomic action, and the "Not Now" survey names the account from `instance_slot.data.account_name`
|
|
8
|
+
- **FIXED** - The client-configured in-description link (custom copy) on an Insights 2.0 card did nothing when clicked (WEC-2119). It now posts `client_configured_cta` with the beat's template, or on a mobile webview navigates through the client's webview scheme with the template and `user_guid`, and it shows `html_in_description_cta` as its label when `in_description_cta` is empty, as the legacy link does. Applies to every Insights 2.0 beat, Set Up Direct Deposit and Switch Direct Deposit included; the envelope's own link, which opens a drawer, is unchanged
|
|
9
|
+
- **ADDED** - `sendClientConfiguredCta(template, options)` in `common/utils/PostMessage`: the webview-aware sender for the client-configured link, modelled on `sendBeatCta` (WEC-2119)
|
|
10
|
+
|
|
1
11
|
## [9.7.52] - 10-27-2026
|
|
2
12
|
|
|
3
13
|
- **ADDED** - `merchant_block` component block: the Merchant card (WEC-1303 single, WEC-1305 multi) registered for Insights 2.0. The architecture doc's seven variants (`single_standard`, `single_large`, `single_success`, `single_error`, `multiple_standard`, `multiple_success`, `multiple_error`) render the existing `MerchantHighlightCard` or `LogoClusterCard` from `instance_slot.data` (`merchant_name`, `logo`, `amount`, `date`, `status_text`, `logos`), falling back to the flat slot fields. No logo guid draws a storefront tile, a zero or missing amount draws no figure, a missing merchant name draws no card, and an unknown variant degrades to `single_standard`. Fixtures, stories and tests (MEW2-3372)
|
|
@@ -63,3 +63,17 @@ export interface SendBeatCtaOptions {
|
|
|
63
63
|
* Pulse's `postMessages` epic (minus the RxJS buffering).
|
|
64
64
|
*/
|
|
65
65
|
export declare function sendBeatCta(beat: BeatCtaSource, { isMobileWebview, webviewScheme, userGuid, op, event, extras }?: SendBeatCtaOptions): void;
|
|
66
|
+
export declare const CLIENT_CONFIGURED_CTA_EVENT = "client_configured_cta";
|
|
67
|
+
export interface SendClientConfiguredCtaOptions {
|
|
68
|
+
isMobileWebview?: boolean;
|
|
69
|
+
/** Custom URL scheme for webview navigation (from client config). */
|
|
70
|
+
webviewScheme?: string;
|
|
71
|
+
/** Added to the webview metadata, as the Pulse epic does. */
|
|
72
|
+
userGuid?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Tell the host a client-configured in-description link (custom copy) was clicked. On web it posts
|
|
76
|
+
* `mx/pulse/client_configured_cta` with the template; a native webview cannot receive that, so it
|
|
77
|
+
* navigates to the scheme URL, as Pulse's PostMessage epic does for the legacy beat.
|
|
78
|
+
*/
|
|
79
|
+
export declare function sendClientConfiguredCta(template: string, { isMobileWebview, webviewScheme, userGuid }?: SendClientConfiguredCtaOptions): boolean;
|
|
@@ -1,64 +1,73 @@
|
|
|
1
|
-
function
|
|
1
|
+
function l() {
|
|
2
2
|
return window.opener && window.opener.location ? window.opener.location.toString() : document.referrer;
|
|
3
3
|
}
|
|
4
4
|
function a(e) {
|
|
5
|
-
const n =
|
|
5
|
+
const n = l().replace(/([^:]+:\/\/[^\/]+).*/, "$1"), t = window.parent || window.opener || !1;
|
|
6
6
|
return t && t.postMessage && n ? (t.postMessage(e, n), !0) : !1;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function E(e) {
|
|
9
9
|
return a({
|
|
10
10
|
metadata: { beat_guid: e },
|
|
11
11
|
mx: !0,
|
|
12
12
|
type: "mx/moneyDashboard/insightOnTransaction"
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function g(e) {
|
|
16
16
|
return a({
|
|
17
17
|
metadata: { template: e },
|
|
18
18
|
mx: !0,
|
|
19
19
|
type: "mx/pulse/client_configured_cta"
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
var
|
|
23
|
-
function
|
|
22
|
+
var _ = "beat/cta", w = "op_1", y = "op_2";
|
|
23
|
+
function m(e, n = w) {
|
|
24
24
|
const t = {
|
|
25
25
|
action: n,
|
|
26
26
|
beat_guid: e.guid,
|
|
27
27
|
beat_template: e.template
|
|
28
28
|
};
|
|
29
|
-
return e?.payload?.action_string && (t.action_string = e.payload.action_string), [
|
|
29
|
+
return e?.payload?.action_string && (t.action_string = e.payload.action_string), [_, t];
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function C(e, n, t = "mx/pulse") {
|
|
32
32
|
return window.self === window.top ? !1 : a({
|
|
33
33
|
metadata: n,
|
|
34
34
|
mx: !0,
|
|
35
35
|
type: `${t}/${e}`
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function s(e, n, t = "mx") {
|
|
39
39
|
let o = `${t}://pulse/${e}`;
|
|
40
40
|
n && (o += "?metadata=" + encodeURIComponent(JSON.stringify(n))), window.location.href = o;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
const [
|
|
42
|
+
function v(e, { isMobileWebview: n, webviewScheme: t, userGuid: o, op: u, event: c, extras: d } = {}) {
|
|
43
|
+
const [f, p] = m(e, u), r = {
|
|
44
44
|
...p,
|
|
45
45
|
...o ? { user_guid: o } : {},
|
|
46
|
-
...
|
|
47
|
-
}, i =
|
|
48
|
-
n ?
|
|
46
|
+
...d
|
|
47
|
+
}, i = c || f;
|
|
48
|
+
n ? s(i, r, t) : C(i, r);
|
|
49
|
+
}
|
|
50
|
+
var T = "client_configured_cta";
|
|
51
|
+
function x(e, { isMobileWebview: n, webviewScheme: t, userGuid: o } = {}) {
|
|
52
|
+
return n ? (s(T, {
|
|
53
|
+
template: e,
|
|
54
|
+
...o ? { user_guid: o } : {}
|
|
55
|
+
}, t), !0) : g(e);
|
|
49
56
|
}
|
|
50
57
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
_ as BEAT_CTA_EVENT,
|
|
59
|
+
w as BEAT_OPERATION_1,
|
|
60
|
+
y as BEAT_OPERATION_2,
|
|
61
|
+
T as CLIENT_CONFIGURED_CTA_EVENT,
|
|
62
|
+
m as getBaseCtaPostMessage,
|
|
63
|
+
l as getReferrer,
|
|
64
|
+
g as postClientConfiguredCta,
|
|
65
|
+
E as postInsightOnTransaction,
|
|
58
66
|
a as postMessageToParent,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
v as sendBeatCta,
|
|
68
|
+
C as sendBeatPostMessage,
|
|
69
|
+
x as sendClientConfiguredCta,
|
|
70
|
+
s as setWebviewURL
|
|
62
71
|
};
|
|
63
72
|
|
|
64
73
|
//# sourceMappingURL=PostMessage.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostMessage.es.js","names":[],"sources":["../../../src/common/utils/PostMessage.ts"],"sourcesContent":["export function getReferrer(): string {\n if (window.opener && window.opener.location) {\n return window.opener.location.toString()\n } else {\n return document.referrer\n }\n}\n\nexport interface PostMessageData {\n metadata?: Record<string, any>\n mx: boolean\n type: string\n [key: string]: any\n}\n\nexport function postMessageToParent(message: PostMessageData): boolean {\n const postUrl = getReferrer().replace(/([^:]+:\\/\\/[^\\/]+).*/, '$1') // eslint-disable-line\n const otherWindow = window.parent || window.opener || false\n\n if (otherWindow && otherWindow.postMessage && postUrl) {\n otherWindow.postMessage(message, postUrl)\n return true\n }\n\n return false\n}\n\nexport function postInsightOnTransaction(beatGuid: string): boolean {\n const message: PostMessageData = {\n metadata: { beat_guid: beatGuid },\n mx: true,\n type: 'mx/moneyDashboard/insightOnTransaction',\n }\n\n return postMessageToParent(message)\n}\n\nexport function postClientConfiguredCta(template: string): boolean {\n const message: PostMessageData = {\n metadata: { template: template },\n mx: true,\n type: 'mx/pulse/client_configured_cta',\n }\n\n return postMessageToParent(message)\n}\n\n// ============================================================================\n// Beat CTA post messages (ported from Pulse: src/utils/PostMessage.js +\n// src/constants/PostMessage.js + src/epics/PostMessage.js).\n//\n// Scope: currently only the Save an extra $100 beat uses this. When a beat CTA\n// has no drilldown drawer, clicking it notifies the host app via a beat/cta\n// post message instead of opening a drawer. Native (mobile webview) hosts can't\n// receive post messages, so we navigate the webview to a custom-scheme URL.\n// ============================================================================\n\nexport const BEAT_CTA_EVENT = 'beat/cta'\nexport const BEAT_OPERATION_1 = 'op_1'\nexport const BEAT_OPERATION_2 = 'op_2'\nexport const BEAT_OPERATION_3 = 'op_3'\n\n/** Minimal beat shape needed to build a CTA post message. */\nexport interface BeatCtaSource {\n guid: string\n template: string\n payload?: { action_string?: string } | null\n}\n\nexport interface BeatCtaPayload {\n action: string\n beat_guid: string\n beat_template: string\n action_string?: string\n [key: string]: unknown\n}\n\n/**\n * Build the `[event, payload]` tuple for a beat CTA post message.\n * Mirrors Pulse's `getBaseCtaPostMessage`.\n */\nexport function getBaseCtaPostMessage(\n beat: BeatCtaSource,\n op: string = BEAT_OPERATION_1,\n): [string, BeatCtaPayload] {\n const payload: BeatCtaPayload = {\n action: op,\n beat_guid: beat.guid,\n beat_template: beat.template,\n }\n\n if (beat?.payload?.action_string) {\n payload.action_string = beat.payload.action_string\n }\n\n return [BEAT_CTA_EVENT, payload]\n}\n\n/**\n * Send a beat post message to the parent window. Only posts when embedded in an\n * iframe (`window.self !== window.top`), mirroring Pulse's `sendPostMessage`\n * (default scheme `mx/pulse`). Returns false when not embedded or no target.\n */\nexport function sendBeatPostMessage(\n event: string,\n data: Record<string, unknown>,\n scheme = 'mx/pulse',\n): boolean {\n if (window.self === window.top) {\n return false\n }\n\n const message: PostMessageData = {\n metadata: data,\n mx: true,\n type: `${scheme}/${event}`,\n }\n\n return postMessageToParent(message)\n}\n\n/**\n * Navigate a mobile webview to a custom-scheme URL instead of posting a message.\n * Mirrors Pulse's `setWebviewURL` (default scheme `mx`).\n */\nexport function setWebviewURL(event: string, data?: Record<string, unknown>, scheme = 'mx'): void {\n let webviewUrl = `${scheme}://pulse/${event}`\n\n if (data) {\n webviewUrl += '?metadata=' + encodeURIComponent(JSON.stringify(data))\n }\n\n window.location.href = webviewUrl\n}\n\nexport interface SendBeatCtaOptions {\n /** True when running inside a native mobile webview. */\n isMobileWebview?: boolean\n /** Custom URL scheme for webview navigation (from client config). */\n webviewScheme?: string\n /** Current user guid, added to the metadata like the Pulse epic does. */\n userGuid?: string\n /** Operation string sent with the CTA (defaults to op_1). */\n op?: string\n /** Post message event name (defaults to `beat/cta`). */\n event?: string\n /** Beat-specific fields merged into the metadata after the base payload and `user_guid`. */\n extras?: Record<string, unknown>\n}\n\n/**\n * Send a beat CTA to the host: builds the payload, adds `user_guid`, then either\n * posts a message to the host or navigates the webview. Mirrors the behaviour of\n * Pulse's `postMessages` epic (minus the RxJS buffering).\n */\nexport function sendBeatCta(\n beat: BeatCtaSource,\n { isMobileWebview, webviewScheme, userGuid, op, event, extras }: SendBeatCtaOptions = {},\n): void {\n const [defaultEvent, basePayload] = getBaseCtaPostMessage(beat, op)\n const metadata: BeatCtaPayload = {\n ...basePayload,\n ...(userGuid ? { user_guid: userGuid } : {}),\n ...extras,\n }\n const eventName = event || defaultEvent\n\n if (isMobileWebview) {\n setWebviewURL(eventName, metadata, webviewScheme)\n } else {\n sendBeatPostMessage(eventName, metadata)\n }\n}\n"],"mappings":"AAAA,SAAgB,IAAsB;AACpC,SAAI,OAAO,UAAU,OAAO,OAAO,WAC1B,OAAO,OAAO,SAAS,SAAS,IAEhC,SAAS;AAEpB;AASA,SAAgB,EAAoB,GAAmC;AACrE,QAAM,IAAU,EAAY,EAAE,QAAQ,wBAAwB,IAAI,GAC5D,IAAc,OAAO,UAAU,OAAO,UAAU;AAEtD,SAAI,KAAe,EAAY,eAAe,KAC5C,EAAY,YAAY,GAAS,CAAO,GACjC,MAGF;AACT;AAEA,SAAgB,EAAyB,GAA2B;AAOlE,SAAO,EAAoB;AAAA,IALzB,UAAU,EAAE,WAAW,EAAS;AAAA,IAChC,IAAI;AAAA,IACJ,MAAM;AAAA,EAGmB,CAAO;AACpC;AAEA,SAAgB,EAAwB,GAA2B;AAOjE,SAAO,EAAoB;AAAA,IALzB,UAAU,EAAY,UAAA,EAAS;AAAA,IAC/B,IAAI;AAAA,IACJ,MAAM;AAAA,EAGmB,CAAO;AACpC;AAYA,IAAa,IAAiB,YACjB,IAAmB,QACnB,IAAmB;AAsBhC,SAAgB,EACd,GACA,IAAa,GACa;AAC1B,QAAM,IAA0B;AAAA,IAC9B,QAAQ;AAAA,IACR,WAAW,EAAK;AAAA,IAChB,eAAe,EAAK;AAAA,EACtB;AAEA,SAAI,GAAM,SAAS,kBACjB,EAAQ,gBAAgB,EAAK,QAAQ,gBAGhC,CAAC,GAAgB,CAAO;AACjC;AAOA,SAAgB,EACd,GACA,GACA,IAAS,YACA;AACT,SAAI,OAAO,SAAS,OAAO,MAClB,KASF,EAAoB;AAAA,IALzB,UAAU;AAAA,IACV,IAAI;AAAA,IACJ,MAAM,GAAG,CAAA,IAAU,CAAA;AAAA,EAGM,CAAO;AACpC;AAMA,SAAgB,EAAc,GAAe,GAAgC,IAAS,MAAY;AAChG,MAAI,IAAa,GAAG,CAAA,YAAkB,CAAA;AAEtC,EAAI,MACF,KAAc,eAAe,mBAAmB,KAAK,UAAU,CAAI,CAAC,IAGtE,OAAO,SAAS,OAAO;AACzB;AAsBA,SAAgB,EACd,GACA,EAAE,iBAAA,GAAiB,eAAA,GAAe,UAAA,GAAU,IAAA,GAAI,OAAA,GAAO,QAAA,EAAA,IAA+B,CAAC,GACjF;AACN,QAAM,CAAC,GAAc,CAAA,IAAe,EAAsB,GAAM,CAAE,GAC5D,IAA2B;AAAA,IAC/B,GAAG;AAAA,IACH,GAAI,IAAW,EAAE,WAAW,EAAS,IAAI,CAAC;AAAA,IAC1C,GAAG;AAAA,EACL,GACM,IAAY,KAAS;AAE3B,EAAI,IACF,EAAc,GAAW,GAAU,CAAa,IAEhD,EAAoB,GAAW,CAAQ;AAE3C"}
|
|
1
|
+
{"version":3,"file":"PostMessage.es.js","names":[],"sources":["../../../src/common/utils/PostMessage.ts"],"sourcesContent":["export function getReferrer(): string {\n if (window.opener && window.opener.location) {\n return window.opener.location.toString()\n } else {\n return document.referrer\n }\n}\n\nexport interface PostMessageData {\n metadata?: Record<string, any>\n mx: boolean\n type: string\n [key: string]: any\n}\n\nexport function postMessageToParent(message: PostMessageData): boolean {\n const postUrl = getReferrer().replace(/([^:]+:\\/\\/[^\\/]+).*/, '$1') // eslint-disable-line\n const otherWindow = window.parent || window.opener || false\n\n if (otherWindow && otherWindow.postMessage && postUrl) {\n otherWindow.postMessage(message, postUrl)\n return true\n }\n\n return false\n}\n\nexport function postInsightOnTransaction(beatGuid: string): boolean {\n const message: PostMessageData = {\n metadata: { beat_guid: beatGuid },\n mx: true,\n type: 'mx/moneyDashboard/insightOnTransaction',\n }\n\n return postMessageToParent(message)\n}\n\nexport function postClientConfiguredCta(template: string): boolean {\n const message: PostMessageData = {\n metadata: { template: template },\n mx: true,\n type: 'mx/pulse/client_configured_cta',\n }\n\n return postMessageToParent(message)\n}\n\n// ============================================================================\n// Beat CTA post messages (ported from Pulse: src/utils/PostMessage.js +\n// src/constants/PostMessage.js + src/epics/PostMessage.js).\n//\n// Scope: currently only the Save an extra $100 beat uses this. When a beat CTA\n// has no drilldown drawer, clicking it notifies the host app via a beat/cta\n// post message instead of opening a drawer. Native (mobile webview) hosts can't\n// receive post messages, so we navigate the webview to a custom-scheme URL.\n// ============================================================================\n\nexport const BEAT_CTA_EVENT = 'beat/cta'\nexport const BEAT_OPERATION_1 = 'op_1'\nexport const BEAT_OPERATION_2 = 'op_2'\nexport const BEAT_OPERATION_3 = 'op_3'\n\n/** Minimal beat shape needed to build a CTA post message. */\nexport interface BeatCtaSource {\n guid: string\n template: string\n payload?: { action_string?: string } | null\n}\n\nexport interface BeatCtaPayload {\n action: string\n beat_guid: string\n beat_template: string\n action_string?: string\n [key: string]: unknown\n}\n\n/**\n * Build the `[event, payload]` tuple for a beat CTA post message.\n * Mirrors Pulse's `getBaseCtaPostMessage`.\n */\nexport function getBaseCtaPostMessage(\n beat: BeatCtaSource,\n op: string = BEAT_OPERATION_1,\n): [string, BeatCtaPayload] {\n const payload: BeatCtaPayload = {\n action: op,\n beat_guid: beat.guid,\n beat_template: beat.template,\n }\n\n if (beat?.payload?.action_string) {\n payload.action_string = beat.payload.action_string\n }\n\n return [BEAT_CTA_EVENT, payload]\n}\n\n/**\n * Send a beat post message to the parent window. Only posts when embedded in an\n * iframe (`window.self !== window.top`), mirroring Pulse's `sendPostMessage`\n * (default scheme `mx/pulse`). Returns false when not embedded or no target.\n */\nexport function sendBeatPostMessage(\n event: string,\n data: Record<string, unknown>,\n scheme = 'mx/pulse',\n): boolean {\n if (window.self === window.top) {\n return false\n }\n\n const message: PostMessageData = {\n metadata: data,\n mx: true,\n type: `${scheme}/${event}`,\n }\n\n return postMessageToParent(message)\n}\n\n/**\n * Navigate a mobile webview to a custom-scheme URL instead of posting a message.\n * Mirrors Pulse's `setWebviewURL` (default scheme `mx`).\n */\nexport function setWebviewURL(event: string, data?: Record<string, unknown>, scheme = 'mx'): void {\n let webviewUrl = `${scheme}://pulse/${event}`\n\n if (data) {\n webviewUrl += '?metadata=' + encodeURIComponent(JSON.stringify(data))\n }\n\n window.location.href = webviewUrl\n}\n\nexport interface SendBeatCtaOptions {\n /** True when running inside a native mobile webview. */\n isMobileWebview?: boolean\n /** Custom URL scheme for webview navigation (from client config). */\n webviewScheme?: string\n /** Current user guid, added to the metadata like the Pulse epic does. */\n userGuid?: string\n /** Operation string sent with the CTA (defaults to op_1). */\n op?: string\n /** Post message event name (defaults to `beat/cta`). */\n event?: string\n /** Beat-specific fields merged into the metadata after the base payload and `user_guid`. */\n extras?: Record<string, unknown>\n}\n\n/**\n * Send a beat CTA to the host: builds the payload, adds `user_guid`, then either\n * posts a message to the host or navigates the webview. Mirrors the behaviour of\n * Pulse's `postMessages` epic (minus the RxJS buffering).\n */\nexport function sendBeatCta(\n beat: BeatCtaSource,\n { isMobileWebview, webviewScheme, userGuid, op, event, extras }: SendBeatCtaOptions = {},\n): void {\n const [defaultEvent, basePayload] = getBaseCtaPostMessage(beat, op)\n const metadata: BeatCtaPayload = {\n ...basePayload,\n ...(userGuid ? { user_guid: userGuid } : {}),\n ...extras,\n }\n const eventName = event || defaultEvent\n\n if (isMobileWebview) {\n setWebviewURL(eventName, metadata, webviewScheme)\n } else {\n sendBeatPostMessage(eventName, metadata)\n }\n}\n\nexport const CLIENT_CONFIGURED_CTA_EVENT = 'client_configured_cta'\n\nexport interface SendClientConfiguredCtaOptions {\n isMobileWebview?: boolean\n /** Custom URL scheme for webview navigation (from client config). */\n webviewScheme?: string\n /** Added to the webview metadata, as the Pulse epic does. */\n userGuid?: string\n}\n\n/**\n * Tell the host a client-configured in-description link (custom copy) was clicked. On web it posts\n * `mx/pulse/client_configured_cta` with the template; a native webview cannot receive that, so it\n * navigates to the scheme URL, as Pulse's PostMessage epic does for the legacy beat.\n */\nexport function sendClientConfiguredCta(\n template: string,\n { isMobileWebview, webviewScheme, userGuid }: SendClientConfiguredCtaOptions = {},\n): boolean {\n if (!isMobileWebview) return postClientConfiguredCta(template)\n\n setWebviewURL(\n CLIENT_CONFIGURED_CTA_EVENT,\n { template, ...(userGuid ? { user_guid: userGuid } : {}) },\n webviewScheme,\n )\n\n return true\n}\n"],"mappings":"AAAA,SAAgB,IAAsB;AACpC,SAAI,OAAO,UAAU,OAAO,OAAO,WAC1B,OAAO,OAAO,SAAS,SAAS,IAEhC,SAAS;AAEpB;AASA,SAAgB,EAAoB,GAAmC;AACrE,QAAM,IAAU,EAAY,EAAE,QAAQ,wBAAwB,IAAI,GAC5D,IAAc,OAAO,UAAU,OAAO,UAAU;AAEtD,SAAI,KAAe,EAAY,eAAe,KAC5C,EAAY,YAAY,GAAS,CAAO,GACjC,MAGF;AACT;AAEA,SAAgB,EAAyB,GAA2B;AAOlE,SAAO,EAAoB;AAAA,IALzB,UAAU,EAAE,WAAW,EAAS;AAAA,IAChC,IAAI;AAAA,IACJ,MAAM;AAAA,EAGmB,CAAO;AACpC;AAEA,SAAgB,EAAwB,GAA2B;AAOjE,SAAO,EAAoB;AAAA,IALzB,UAAU,EAAY,UAAA,EAAS;AAAA,IAC/B,IAAI;AAAA,IACJ,MAAM;AAAA,EAGmB,CAAO;AACpC;AAYA,IAAa,IAAiB,YACjB,IAAmB,Q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,MARsB,EAAwB,CAAQ;AAS/D"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import { DATE_FORMATS_INTL as
|
|
3
|
-
import { fromUnixUTC as
|
|
4
|
-
import { getCategoryColor as
|
|
5
|
-
import { getLayoutConfig as
|
|
6
|
-
import { MerchantLogo as
|
|
7
|
-
import { Icon as
|
|
8
|
-
import { jsx as
|
|
9
|
-
import { endOfMonth as
|
|
1
|
+
import { buildDynamicCopy as C } from "../../../core/utils/Localization.es.js";
|
|
2
|
+
import { DATE_FORMATS_INTL as A, formatDate as I } from "../../../core/constants/DateFormats.es.js";
|
|
3
|
+
import { fromUnixUTC as f } from "../../../core/utils/DateUtil.es.js";
|
|
4
|
+
import { getCategoryColor as h } from "../../../core/utils/CategoryUtil.es.js";
|
|
5
|
+
import { getLayoutConfig as L } from "../../blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js";
|
|
6
|
+
import { MerchantLogo as M } from "@mxenabled/mxui";
|
|
7
|
+
import { Icon as b } from "@mxenabled/mx-icons";
|
|
8
|
+
import { jsx as _ } from "react/jsx-runtime";
|
|
9
|
+
import { endOfMonth as S, fromUnixTime as E, isValid as O, parseISO as p, startOfMonth as T } from "date-fns";
|
|
10
10
|
var i = {
|
|
11
11
|
TRANSACTION: "not_standard_amount",
|
|
12
12
|
CATEGORY_SPEND: "category_spend",
|
|
@@ -20,10 +20,10 @@ var i = {
|
|
|
20
20
|
NON_ESSENTIAL_CATEGORY: "non_essential_category_summary",
|
|
21
21
|
DEPOSIT_SUMMARY: "monthly_deposit_summary",
|
|
22
22
|
LOW_BALANCE: "low_balance"
|
|
23
|
-
}, c = (t, e) => e &&
|
|
24
|
-
start:
|
|
25
|
-
end:
|
|
26
|
-
}),
|
|
23
|
+
}, c = (t, e) => e && h(e, t) || t.palette.primary.main, u = (t) => typeof t == "string" ? p(t) : new Date(t ?? NaN), g = (t) => ({
|
|
24
|
+
start: T(u(t)),
|
|
25
|
+
end: S(u(t))
|
|
26
|
+
}), y = (t) => t?.length ? { accounts: t } : {}, v = ({ beat: t }) => {
|
|
27
27
|
const { account_guid: e, from_date: o, to_date: r } = t.insights_payload?.drilldown_data ?? {};
|
|
28
28
|
return typeof e != "string" || typeof o != "number" || typeof r != "number" || !Number.isFinite(o) || !Number.isFinite(r) || r <= o ? {
|
|
29
29
|
accounts: [],
|
|
@@ -31,53 +31,53 @@ var i = {
|
|
|
31
31
|
} : {
|
|
32
32
|
accounts: [e],
|
|
33
33
|
dateRange: {
|
|
34
|
-
start:
|
|
35
|
-
end:
|
|
34
|
+
start: f(o),
|
|
35
|
+
end: f(r - 1)
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
}, m = ({ beatTransactions: t, dataSeries: e, selectedIndex: o }) => {
|
|
39
39
|
const r = e[o], a = r?.guid, s = t.find((n) => n.guid === a)?.has_been_split;
|
|
40
40
|
return {
|
|
41
41
|
custom: (n) => n.guid === a,
|
|
42
|
-
dateRange:
|
|
42
|
+
dateRange: g(r?.date),
|
|
43
43
|
showSplits: !s
|
|
44
44
|
};
|
|
45
|
-
},
|
|
45
|
+
}, D = ({ dataSeries: t, selectedIndex: e, instanceSlotData: o }) => {
|
|
46
46
|
const r = t[e], a = o.category_guid ?? r?.guid;
|
|
47
47
|
return {
|
|
48
48
|
custom: (s) => s.category_guid === a || s.top_level_category_guid === a,
|
|
49
|
-
dateRange:
|
|
49
|
+
dateRange: g(r?.date)
|
|
50
50
|
};
|
|
51
|
-
},
|
|
51
|
+
}, B = ({ dataSeries: t, selectedIndex: e, spendCategoryGuids: o, instanceSlotData: r }) => {
|
|
52
52
|
const a = t[e];
|
|
53
53
|
return {
|
|
54
54
|
custom: (s) => !!s.top_level_category_guid && o.includes(s.top_level_category_guid),
|
|
55
|
-
dateRange:
|
|
56
|
-
...
|
|
55
|
+
dateRange: g(a?.date),
|
|
56
|
+
...y(r.account_guids)
|
|
57
57
|
};
|
|
58
|
-
},
|
|
59
|
-
const s = e[o], { start: n, end:
|
|
58
|
+
}, R = (t) => typeof t == "number" ? E(t) : p(t ?? ""), G = ({ beat: t, dataSeries: e, selectedIndex: o, isLastTab: r, instanceSlotData: a }) => {
|
|
59
|
+
const s = e[o], { start: n, end: l } = g(s?.date), d = R(t.created_at);
|
|
60
60
|
return {
|
|
61
61
|
dateRange: {
|
|
62
62
|
start: n,
|
|
63
|
-
end: r &&
|
|
63
|
+
end: r && O(d) && d < l ? d : l
|
|
64
64
|
},
|
|
65
|
-
...
|
|
65
|
+
...y(t.account_guids?.length ? t.account_guids : a.account_guids)
|
|
66
66
|
};
|
|
67
|
-
},
|
|
68
|
-
const a = e[o], s = new Set(r === 1 ? a?.comparisonGuids : a?.mainGuids), n =
|
|
69
|
-
return !s.size || !
|
|
67
|
+
}, N = ({ beat: t, comparisonBars: e, selectedIndex: o, subIndex: r }) => {
|
|
68
|
+
const a = e[o], s = new Set(r === 1 ? a?.comparisonGuids : a?.mainGuids), n = p(a?.date ?? "");
|
|
69
|
+
return !s.size || !O(n) ? {
|
|
70
70
|
accounts: [],
|
|
71
71
|
custom: () => !1
|
|
72
72
|
} : {
|
|
73
|
-
custom: (
|
|
73
|
+
custom: (l) => s.has(l.guid),
|
|
74
74
|
dateRange: {
|
|
75
|
-
start:
|
|
76
|
-
end:
|
|
75
|
+
start: T(n),
|
|
76
|
+
end: S(n)
|
|
77
77
|
},
|
|
78
|
-
...
|
|
78
|
+
...y(t.account_guids)
|
|
79
79
|
};
|
|
80
|
-
},
|
|
80
|
+
}, z = {
|
|
81
81
|
[i.TRANSACTION]: {
|
|
82
82
|
top: "singleBar",
|
|
83
83
|
scope: "store",
|
|
@@ -89,7 +89,7 @@ var i = {
|
|
|
89
89
|
return {
|
|
90
90
|
heading: e,
|
|
91
91
|
subHeadingText: o?.text || void 0,
|
|
92
|
-
icon: /* @__PURE__ */
|
|
92
|
+
icon: /* @__PURE__ */ _(M, {
|
|
93
93
|
alt: o?.text,
|
|
94
94
|
categoryGuid: o?.logo?.category_guid || "",
|
|
95
95
|
merchantGuid: o?.logo?.merchant_guid || "",
|
|
@@ -98,20 +98,20 @@ var i = {
|
|
|
98
98
|
};
|
|
99
99
|
},
|
|
100
100
|
tipSection: (t, e, o = "") => ({
|
|
101
|
-
message:
|
|
101
|
+
message: C(e.general.tip_section_message, /* @__PURE__ */ _("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ _("strong", { children: o })),
|
|
102
102
|
onDismiss: () => t(!0)
|
|
103
103
|
})
|
|
104
104
|
},
|
|
105
105
|
[i.CATEGORY_SPEND]: {
|
|
106
106
|
top: "singleBar",
|
|
107
|
-
filterStrategy:
|
|
107
|
+
filterStrategy: D,
|
|
108
108
|
scope: "store",
|
|
109
109
|
filterMode: "store",
|
|
110
110
|
colors: (t, e) => [c(t, e)],
|
|
111
111
|
header: (t) => ({
|
|
112
112
|
heading: t.categoryName,
|
|
113
|
-
subHeadingText: t.selectedDate &&
|
|
114
|
-
icon: /* @__PURE__ */
|
|
113
|
+
subHeadingText: t.selectedDate && I(u(t.selectedDate), A.MONTH_LONG) || "",
|
|
114
|
+
icon: /* @__PURE__ */ _(b, {
|
|
115
115
|
name: "calendar_month",
|
|
116
116
|
size: 16
|
|
117
117
|
})
|
|
@@ -119,14 +119,14 @@ var i = {
|
|
|
119
119
|
},
|
|
120
120
|
[i.MONTHLY_SPEND]: {
|
|
121
121
|
top: "singleBar",
|
|
122
|
-
filterStrategy:
|
|
122
|
+
filterStrategy: B,
|
|
123
123
|
scope: "store",
|
|
124
124
|
filterMode: "store",
|
|
125
125
|
colors: (t) => [t.palette.chart.chart2 ?? t.palette.primary.main]
|
|
126
126
|
},
|
|
127
127
|
[i.ACCOUNT_BALANCE]: {
|
|
128
128
|
top: "singleBar",
|
|
129
|
-
filterStrategy:
|
|
129
|
+
filterStrategy: G,
|
|
130
130
|
scope: "store",
|
|
131
131
|
filterMode: "store",
|
|
132
132
|
colors: (t) => [t.palette.success.main]
|
|
@@ -140,28 +140,28 @@ var i = {
|
|
|
140
140
|
},
|
|
141
141
|
[i.LOW_BALANCE]: {
|
|
142
142
|
top: "list",
|
|
143
|
-
filterStrategy:
|
|
143
|
+
filterStrategy: v,
|
|
144
144
|
scope: "store",
|
|
145
145
|
filterMode: "store",
|
|
146
146
|
colors: (t) => [t.palette.primary.main]
|
|
147
147
|
},
|
|
148
148
|
[i.SPEND_TO_INCOME]: {
|
|
149
149
|
top: "doubleBar",
|
|
150
|
-
filterStrategy:
|
|
150
|
+
filterStrategy: N,
|
|
151
151
|
scope: "store",
|
|
152
152
|
filterMode: "store",
|
|
153
|
-
colors: (t) =>
|
|
153
|
+
colors: (t) => L(t, "spend_to_income")?.color ?? [],
|
|
154
154
|
subTabAriaLabels: (t) => [t.general.spend_transactions, t.general.income_transactions]
|
|
155
155
|
},
|
|
156
156
|
[i.COST_OF_LIVING]: {
|
|
157
157
|
top: "doubleBar",
|
|
158
|
-
filterStrategy:
|
|
158
|
+
filterStrategy: N,
|
|
159
159
|
scope: "store",
|
|
160
160
|
filterMode: "store",
|
|
161
161
|
colors: (t, e) => [c(t, e), t.palette.chart.chart4 ?? t.palette.primary.main],
|
|
162
162
|
subTabAriaLabels: (t) => [void 0, t.general.income_transactions]
|
|
163
163
|
}
|
|
164
|
-
},
|
|
164
|
+
}, j = {
|
|
165
165
|
top: "singleBar",
|
|
166
166
|
filterStrategy: m,
|
|
167
167
|
scope: "store",
|
|
@@ -170,8 +170,8 @@ var i = {
|
|
|
170
170
|
};
|
|
171
171
|
export {
|
|
172
172
|
i as DRILLDOWN_VARIANTS,
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
j as FALLBACK,
|
|
174
|
+
z as layout
|
|
175
175
|
};
|
|
176
176
|
|
|
177
177
|
//# sourceMappingURL=layout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/layout.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Theme } from '@mui/material/styles'\nimport { endOfMonth, isValid, parseISO, startOfMonth } from 'date-fns'\nimport { getCategoryColor } from '../../../core/utils/CategoryUtil'\nimport {\n type Beat,\n type InsightsFeedCopy,\n type Subtitle,\n type Transaction,\n buildDynamicCopy,\n} from '../../../core'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport type {\n DataSet,\n InsightsInstanceSlotData,\n} from '../../../core/types/InsightsInstanceSlotData'\nimport { MerchantLogo } from '@mxenabled/mxui'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport { fromUnixUTC } from '../../../core/utils/DateUtil'\nimport { Icon } from '@mxenabled/mx-icons'\nimport type { ChartDataSeriesItem } from '../../blocks/ChartBlocks/BarchartBlock/utils'\nimport { getLayoutConfig as getDoubleBarLayoutConfig } from '../../blocks/ChartBlocks/DoubleBarChartBlock/layout'\nimport type { TipSectionProps } from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\n\nexport interface DrillDownHeader {\n heading?: string\n subHeadingText?: string\n icon?: ReactNode\n}\n\nexport interface DrillDownHeaderContext {\n title?: string\n subHeader?: Subtitle\n categoryName: string\n selectedDate?: string | Date\n}\n\nexport const DRILLDOWN_VARIANTS = {\n TRANSACTION: 'not_standard_amount',\n CATEGORY_SPEND: 'category_spend',\n MONTHLY_SPEND: 'monthly_spend_comparison',\n ACCOUNT_BALANCE: 'account_balance',\n UPCOMING_BILL: 'upcoming_bill',\n SPEND_TO_INCOME: 'monthly_spend_to_income',\n SAVINGS_TO_INCOME: 'monthly_savings_to_income',\n DEBT_TO_INCOME: 'monthly_debt_to_income',\n COST_OF_LIVING: 'cost_living_to_income',\n NON_ESSENTIAL_CATEGORY: 'non_essential_category_summary',\n DEPOSIT_SUMMARY: 'monthly_deposit_summary',\n LOW_BALANCE: 'low_balance',\n} as const\n\nexport type DrillDownVariant = (typeof DRILLDOWN_VARIANTS)[keyof typeof DRILLDOWN_VARIANTS]\n\n/**\n * One row of the flattened data_series a filterStrategy indexes into: a single-bar monthly total or a\n * synthesized upcoming-bill bar. Fields are optional because the backend keys each row dynamically\n * from data_series.names and not every variant carries a guid/category. Double-bar comparison rows\n * will extend this in the next MR.\n */\n\n// Resolves the top-chart palette from the theme (and the beat's category, when relevant).\nexport type ColorKind = (theme: Theme, categoryGuid?: string) => string[]\n\n// Resolves the dynamic drawer header (heading/sub-heading/icon JSX) from the selection context.\nexport type HeaderKind = (ctx: DrillDownHeaderContext) => DrillDownHeader\n\n/**\n * Everything a filterStrategy needs to turn the currently-selected bar/sub-tab into a\n * TransactionFilter. Data-only so strategies stay pure and testable.\n */\nexport interface FilterContext {\n beat: Beat\n beatTransactions: Transaction[]\n dataSeries: ChartDataSeriesItem[]\n // The double-bar drawer's month columns (main / comparison per month, with their guids); empty\n // for every other top kind.\n comparisonBars: DataSet[]\n selectedIndex: number\n subIndex: number\n isLastTab: boolean\n instanceSlotData: InsightsInstanceSlotData\n spendCategoryGuids: string[]\n displayedDateRange: { start: Date; end: Date }\n}\n\n// Resolves the current selection into a TransactionFilter. Carried on each config row so behavior\n// lives next to the variant it belongs to (no separate strategy registry to chase).\nexport type FilterStrategy = (ctx: FilterContext) => TransactionFilter\n\nexport interface DrillDownVariantConfig {\n // `list`: no chart or tabs above the transaction list (an account's transactions for a window).\n top: 'singleBar' | 'upcomingBill' | 'doubleBar' | 'tabsOnly' | 'list'\n filterStrategy: FilterStrategy\n colors: ColorKind\n header?: HeaderKind\n tipSection?: (\n setCloseTipSection: (flag: boolean) => void,\n copy: InsightsFeedCopy,\n merchantName?: string,\n ) => TipSectionProps\n scope: 'store' | 'beat'\n filterMode: 'store' | 'local'\n // Double bar: accessible names for the series tabs ([0] main, [1] comparison), as legacy pulse.\n subTabAriaLabels?: (copy: InsightsFeedCopy) => (string | undefined)[]\n}\nconst categoryColor = (theme: Theme, categoryGuid?: string): string =>\n (categoryGuid && getCategoryColor(categoryGuid, theme)) || theme.palette.primary.main\n\nconst toLocalDate = (date: string | number | Date | undefined) =>\n typeof date === 'string' ? parseISO(date) : new Date(date ?? NaN)\n\nconst monthRange = (date: string | number | Date | undefined) => ({\n start: startOfMonth(toLocalDate(date)),\n end: endOfMonth(toLocalDate(date)),\n})\n\n// Scopes a filter to the beat's accounts when the beat carries account_guids; otherwise leaves\n// accounts unset so the store default (all accounts) applies.\nconst accountScope = (accountGuids?: string[]): Pick<TransactionFilter, 'accounts'> =>\n accountGuids?.length ? { accounts: accountGuids } : {}\n\n// Low Account Balance — `drilldown_data` names one account and a window (epoch seconds at UTC\n// midnight, to_date exclusive). Fails closed: a drawer that cannot name its rows shows none.\nconst accountWindowStrategy: FilterStrategy = ({ beat }) => {\n const { account_guid, from_date, to_date } = beat.insights_payload?.drilldown_data ?? {}\n if (\n typeof account_guid !== 'string' ||\n typeof from_date !== 'number' ||\n typeof to_date !== 'number' ||\n !Number.isFinite(from_date) ||\n !Number.isFinite(to_date) ||\n to_date <= from_date\n ) {\n return { accounts: [], custom: () => false }\n }\n\n return {\n accounts: [account_guid],\n dateRange: { start: fromUnixUTC(from_date), end: fromUnixUTC(to_date - 1) },\n }\n}\n\n// ── Single-bar filter strategies (this MR) ────────────────────────────────────────────────────\n\n// BillAmountNotStandard / UpcomingBill — the series carries a transaction (TRN) guid; match a single\n// transaction by guid within its month.\nconst transactionGuidStrategy: FilterStrategy = ({\n beatTransactions,\n dataSeries,\n selectedIndex,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n const seriesGuid = seriesItem?.guid\n const hasBeenSplit = beatTransactions.find((trn) => trn.guid === seriesGuid)?.has_been_split\n\n return {\n custom: (trn) => trn.guid === seriesGuid,\n dateRange: monthRange(seriesItem?.date),\n showSplits: !hasBeenSplit,\n }\n}\n\n// CategorySpendingV2 — match transactions in the beat's category (or whose top-level category is that\n// guid) within the month.\nconst categoryStrategy: FilterStrategy = ({ dataSeries, selectedIndex, instanceSlotData }) => {\n const seriesItem = dataSeries[selectedIndex]\n const categoryGuid = instanceSlotData.category_guid ?? seriesItem?.guid\n\n return {\n custom: (trn) =>\n trn.category_guid === categoryGuid || trn.top_level_category_guid === categoryGuid,\n dateRange: monthRange(seriesItem?.date),\n }\n}\n\n// MonthlySpendComparisonV2 — no per-bar guid; show all spending-category transactions\n// (income/transfers/investments excluded via spendCategoryGuids) within the month.\nconst spendCategoriesStrategy: FilterStrategy = ({\n dataSeries,\n selectedIndex,\n spendCategoryGuids,\n instanceSlotData,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n\n return {\n custom: (trn) =>\n !!trn.top_level_category_guid && spendCategoryGuids.includes(trn.top_level_category_guid),\n dateRange: monthRange(seriesItem?.date),\n ...accountScope(instanceSlotData.account_guids),\n }\n}\n\n// SavingsAccountBalancesSummary — balances, not categorized spend. Filter by month only; the most\n// recent month is capped at the beat's creation time to match the snapshot the balance was computed\n// from.\nconst accountDateStrategy: FilterStrategy = ({\n beat,\n dataSeries,\n selectedIndex,\n isLastTab,\n instanceSlotData,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n const { start, end } = monthRange(seriesItem?.date)\n\n return {\n dateRange: {\n start,\n end: isLastTab && beat.created_at ? new Date(beat.created_at) : end,\n },\n ...accountScope(instanceSlotData.account_guids),\n }\n}\n\n// ── Double-bar strategies ──────────────────────────────────────────────────────────────────────\n\n// Monthly Spend to Income Comparison — the selected month's main (Spend, sub-tab 0) or comparison\n// (Income, sub-tab 1) transactions: membership in that bar's stored guids (data_series\n// aggregated_guids), within the month. Fails closed: a bar that names no guids for the tab shows none.\nconst comparisonGuidsStrategy: FilterStrategy = ({\n beat,\n comparisonBars,\n selectedIndex,\n subIndex,\n}) => {\n const bar = comparisonBars[selectedIndex]\n const guids = new Set(subIndex === 1 ? bar?.comparisonGuids : bar?.mainGuids)\n // parseISO reads the 'yyyy-MM-dd' bar date as a local calendar day, so the month never shifts with\n // the viewer's time zone; a missing bar, guid list or date fails closed.\n const month = parseISO(bar?.date ?? '')\n if (!guids.size || !isValid(month)) return { accounts: [], custom: () => false }\n\n return {\n custom: (trn) => guids.has(trn.guid),\n dateRange: { start: startOfMonth(month), end: endOfMonth(month) },\n // The V2 payload carries no account_guids (neither instance_slot.data nor insights_payload).\n ...accountScope(beat.account_guids),\n }\n}\n\n// TODO(next MR — tabsOnly): aggregatedGuids / depositSummary strategies for the donut-drawer beats.\n\nexport const layout: Partial<Record<DrillDownVariant, DrillDownVariantConfig>> = {\n [DRILLDOWN_VARIANTS.TRANSACTION]: {\n top: 'singleBar',\n scope: 'store',\n filterMode: 'store',\n filterStrategy: transactionGuidStrategy,\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n header: (ctx: DrillDownHeaderContext) => {\n const { title, subHeader } = ctx\n return {\n heading: title,\n subHeadingText: subHeader?.text || undefined,\n icon: (\n <MerchantLogo\n alt={subHeader?.text}\n categoryGuid={subHeader?.logo?.category_guid || ''}\n merchantGuid={subHeader?.logo?.merchant_guid || ''}\n size={16}\n />\n ),\n }\n },\n tipSection: (setCloseTipSection, copy, merchantName = '') => {\n return {\n message: buildDynamicCopy(\n copy.general.tip_section_message,\n <strong>{copy.general.tip_section_title}</strong>,\n <strong>{merchantName}</strong>,\n ),\n onDismiss: () => setCloseTipSection(true),\n } as TipSectionProps\n },\n },\n [DRILLDOWN_VARIANTS.CATEGORY_SPEND]: {\n top: 'singleBar',\n filterStrategy: categoryStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n header: (ctx: DrillDownHeaderContext) => {\n return {\n heading: ctx.categoryName,\n subHeadingText: ctx.selectedDate\n ? formatDate(toLocalDate(ctx.selectedDate), DATE_FORMATS_INTL.MONTH_LONG) || ''\n : '',\n icon: <Icon name=\"calendar_month\" size={16} />,\n }\n },\n },\n [DRILLDOWN_VARIANTS.MONTHLY_SPEND]: {\n top: 'singleBar',\n filterStrategy: spendCategoriesStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.chart.chart2 ?? theme.palette.primary.main],\n },\n [DRILLDOWN_VARIANTS.ACCOUNT_BALANCE]: {\n top: 'singleBar',\n filterStrategy: accountDateStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.success.main],\n },\n [DRILLDOWN_VARIANTS.UPCOMING_BILL]: {\n top: 'upcomingBill',\n filterStrategy: transactionGuidStrategy,\n scope: 'beat',\n filterMode: 'local',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n },\n\n // Low Account Balance's \"Transactions\" link: the account's transactions for the alert's window.\n [DRILLDOWN_VARIANTS.LOW_BALANCE]: {\n top: 'list',\n filterStrategy: accountWindowStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.primary.main],\n },\n\n // ── Double-bar comparison beats (month tabs + main / comparison sub-tabs) ────────────────────\n // Monthly Spend to Income Comparison: Spend vs Income per month, in the card block's palette.\n [DRILLDOWN_VARIANTS.SPEND_TO_INCOME]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => getDoubleBarLayoutConfig(theme, 'spend_to_income')?.color ?? [],\n subTabAriaLabels: (copy) => [copy.general.spend_transactions, copy.general.income_transactions],\n },\n // Cost of Living to Income: one living-cost category (Housing, Groceries, ...) vs Income per month.\n // The cost bar takes the beat category's colour and Income the legacy chart4, as the pulse drawer.\n [DRILLDOWN_VARIANTS.COST_OF_LIVING]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [\n categoryColor(theme, categoryGuid),\n theme.palette.chart.chart4 ?? theme.palette.primary.main,\n ],\n subTabAriaLabels: (copy) => [undefined, copy.general.income_transactions],\n },\n // NEXT MR — the other double-bar beats reuse comparisonGuidsStrategy with their own palettes:\n // [DRILLDOWN_VARIANTS.SAVINGS_TO_INCOME]: comparison('savingsVsIncome'),\n // [DRILLDOWN_VARIANTS.DEBT_TO_INCOME]: comparison('debtVsIncome'),\n //\n // ── NEXT MR: tabsOnly donut-drawer beats (no top chart) ───────────────────────────────────\n // [DRILLDOWN_VARIANTS.NON_ESSENTIAL_CATEGORY]: { top: 'tabsOnly', ... },\n // [DRILLDOWN_VARIANTS.DEPOSIT_SUMMARY]: { top: 'tabsOnly', ... },\n}\n\n// Fallback for a missing/typo'd backend variant: a single-bar, store-scoped drawer filtered by the\n// beat's transaction guid and colored by category, so the drawer still renders instead of crashing.\nexport const FALLBACK: DrillDownVariantConfig = {\n top: 'singleBar',\n filterStrategy: transactionGuidStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n}\n"],"mappings":";;;;;;;;;AAqCA,IAAa,IAAqB;AAAA,EAChC,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,wBAAwB;AAAA,EACxB,iBAAiB;AAAA,EACjB,aAAa;AACf,GAwDM,IAAA,CAAiB,GAAc,MAClC,KAAgB,EAAiB,GAAc,CAAK,KAAM,EAAM,QAAQ,QAAQ,MAE7E,IAAA,CAAe,MACnB,OAAO,KAAS,WAAW,EAAS,CAAI,IAAI,IAAI,KAAK,KAAQ,GAAG,GAE5D,IAAA,CAAc,OAA8C;AAAA,EAChE,OAAO,EAAa,EAAY,CAAI,CAAC;AAAA,EACrC,KAAK,EAAW,EAAY,CAAI,CAAC;AACnC,IAIM,IAAA,CAAgB,MACpB,GAAc,SAAS,EAAE,UAAU,EAAa,IAAI,CAAC,GAIjD,IAAA,CAAyC,EAAE,MAAA,EAAA,MAAW;AAC1D,QAAM,EAAE,cAAA,GAAc,WAAA,GAAW,SAAA,EAAA,IAAY,EAAK,kBA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ights-v2/actionBlocks/TransactionHistoryBlock/layout.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Theme } from '@mui/material/styles'\nimport { endOfMonth, fromUnixTime, isValid, parseISO, startOfMonth } from 'date-fns'\nimport { getCategoryColor } from '../../../core/utils/CategoryUtil'\nimport {\n type Beat,\n type InsightsFeedCopy,\n type Subtitle,\n type Transaction,\n buildDynamicCopy,\n} from '../../../core'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport type {\n DataSet,\n InsightsInstanceSlotData,\n} from '../../../core/types/InsightsInstanceSlotData'\nimport { MerchantLogo } from '@mxenabled/mxui'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport { fromUnixUTC } from '../../../core/utils/DateUtil'\nimport { Icon } from '@mxenabled/mx-icons'\nimport type { ChartDataSeriesItem } from '../../blocks/ChartBlocks/BarchartBlock/utils'\nimport { getLayoutConfig as getDoubleBarLayoutConfig } from '../../blocks/ChartBlocks/DoubleBarChartBlock/layout'\nimport type { TipSectionProps } from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\n\nexport interface DrillDownHeader {\n heading?: string\n subHeadingText?: string\n icon?: ReactNode\n}\n\nexport interface DrillDownHeaderContext {\n title?: string\n subHeader?: Subtitle\n categoryName: string\n selectedDate?: string | Date\n}\n\nexport const DRILLDOWN_VARIANTS = {\n TRANSACTION: 'not_standard_amount',\n CATEGORY_SPEND: 'category_spend',\n MONTHLY_SPEND: 'monthly_spend_comparison',\n ACCOUNT_BALANCE: 'account_balance',\n UPCOMING_BILL: 'upcoming_bill',\n SPEND_TO_INCOME: 'monthly_spend_to_income',\n SAVINGS_TO_INCOME: 'monthly_savings_to_income',\n DEBT_TO_INCOME: 'monthly_debt_to_income',\n COST_OF_LIVING: 'cost_living_to_income',\n NON_ESSENTIAL_CATEGORY: 'non_essential_category_summary',\n DEPOSIT_SUMMARY: 'monthly_deposit_summary',\n LOW_BALANCE: 'low_balance',\n} as const\n\nexport type DrillDownVariant = (typeof DRILLDOWN_VARIANTS)[keyof typeof DRILLDOWN_VARIANTS]\n\n/**\n * One row of the flattened data_series a filterStrategy indexes into: a single-bar monthly total or a\n * synthesized upcoming-bill bar. Fields are optional because the backend keys each row dynamically\n * from data_series.names and not every variant carries a guid/category. Double-bar comparison rows\n * will extend this in the next MR.\n */\n\n// Resolves the top-chart palette from the theme (and the beat's category, when relevant).\nexport type ColorKind = (theme: Theme, categoryGuid?: string) => string[]\n\n// Resolves the dynamic drawer header (heading/sub-heading/icon JSX) from the selection context.\nexport type HeaderKind = (ctx: DrillDownHeaderContext) => DrillDownHeader\n\n/**\n * Everything a filterStrategy needs to turn the currently-selected bar/sub-tab into a\n * TransactionFilter. Data-only so strategies stay pure and testable.\n */\nexport interface FilterContext {\n beat: Beat\n beatTransactions: Transaction[]\n dataSeries: ChartDataSeriesItem[]\n // The double-bar drawer's month columns (main / comparison per month, with their guids); empty\n // for every other top kind.\n comparisonBars: DataSet[]\n selectedIndex: number\n subIndex: number\n isLastTab: boolean\n instanceSlotData: InsightsInstanceSlotData\n spendCategoryGuids: string[]\n displayedDateRange: { start: Date; end: Date }\n}\n\n// Resolves the current selection into a TransactionFilter. Carried on each config row so behavior\n// lives next to the variant it belongs to (no separate strategy registry to chase).\nexport type FilterStrategy = (ctx: FilterContext) => TransactionFilter\n\nexport interface DrillDownVariantConfig {\n // `list`: no chart or tabs above the transaction list (an account's transactions for a window).\n top: 'singleBar' | 'upcomingBill' | 'doubleBar' | 'tabsOnly' | 'list'\n filterStrategy: FilterStrategy\n colors: ColorKind\n header?: HeaderKind\n tipSection?: (\n setCloseTipSection: (flag: boolean) => void,\n copy: InsightsFeedCopy,\n merchantName?: string,\n ) => TipSectionProps\n scope: 'store' | 'beat'\n filterMode: 'store' | 'local'\n // Double bar: accessible names for the series tabs ([0] main, [1] comparison), as legacy pulse.\n subTabAriaLabels?: (copy: InsightsFeedCopy) => (string | undefined)[]\n}\nconst categoryColor = (theme: Theme, categoryGuid?: string): string =>\n (categoryGuid && getCategoryColor(categoryGuid, theme)) || theme.palette.primary.main\n\nconst toLocalDate = (date: string | number | Date | undefined) =>\n typeof date === 'string' ? parseISO(date) : new Date(date ?? NaN)\n\nconst monthRange = (date: string | number | Date | undefined) => ({\n start: startOfMonth(toLocalDate(date)),\n end: endOfMonth(toLocalDate(date)),\n})\n\n// Scopes a filter to the beat's accounts when the beat carries account_guids; otherwise leaves\n// accounts unset so the store default (all accounts) applies.\nconst accountScope = (accountGuids?: string[]): Pick<TransactionFilter, 'accounts'> =>\n accountGuids?.length ? { accounts: accountGuids } : {}\n\n// Low Account Balance — `drilldown_data` names one account and a window (epoch seconds at UTC\n// midnight, to_date exclusive). Fails closed: a drawer that cannot name its rows shows none.\nconst accountWindowStrategy: FilterStrategy = ({ beat }) => {\n const { account_guid, from_date, to_date } = beat.insights_payload?.drilldown_data ?? {}\n if (\n typeof account_guid !== 'string' ||\n typeof from_date !== 'number' ||\n typeof to_date !== 'number' ||\n !Number.isFinite(from_date) ||\n !Number.isFinite(to_date) ||\n to_date <= from_date\n ) {\n return { accounts: [], custom: () => false }\n }\n\n return {\n accounts: [account_guid],\n dateRange: { start: fromUnixUTC(from_date), end: fromUnixUTC(to_date - 1) },\n }\n}\n\n// ── Single-bar filter strategies (this MR) ────────────────────────────────────────────────────\n\n// BillAmountNotStandard / UpcomingBill — the series carries a transaction (TRN) guid; match a single\n// transaction by guid within its month.\nconst transactionGuidStrategy: FilterStrategy = ({\n beatTransactions,\n dataSeries,\n selectedIndex,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n const seriesGuid = seriesItem?.guid\n const hasBeenSplit = beatTransactions.find((trn) => trn.guid === seriesGuid)?.has_been_split\n\n return {\n custom: (trn) => trn.guid === seriesGuid,\n dateRange: monthRange(seriesItem?.date),\n showSplits: !hasBeenSplit,\n }\n}\n\n// CategorySpendingV2 — match transactions in the beat's category (or whose top-level category is that\n// guid) within the month.\nconst categoryStrategy: FilterStrategy = ({ dataSeries, selectedIndex, instanceSlotData }) => {\n const seriesItem = dataSeries[selectedIndex]\n const categoryGuid = instanceSlotData.category_guid ?? seriesItem?.guid\n\n return {\n custom: (trn) =>\n trn.category_guid === categoryGuid || trn.top_level_category_guid === categoryGuid,\n dateRange: monthRange(seriesItem?.date),\n }\n}\n\n// MonthlySpendComparisonV2 — no per-bar guid; show all spending-category transactions\n// (income/transfers/investments excluded via spendCategoryGuids) within the month.\nconst spendCategoriesStrategy: FilterStrategy = ({\n dataSeries,\n selectedIndex,\n spendCategoryGuids,\n instanceSlotData,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n\n return {\n custom: (trn) =>\n !!trn.top_level_category_guid && spendCategoryGuids.includes(trn.top_level_category_guid),\n dateRange: monthRange(seriesItem?.date),\n ...accountScope(instanceSlotData.account_guids),\n }\n}\n\n// The beat's creation: tupac sends epoch seconds on the envelope and an ISO string on the wrapper.\nconst toCreatedAt = (createdAt: Beat['created_at']) =>\n typeof createdAt === 'number' ? fromUnixTime(createdAt) : parseISO(createdAt ?? '')\n\n// SavingsAccountBalancesSummary — balances, not categorized spend: the beat's account within the\n// month. Bars are snapshots, so the most recent month ends at the beat's creation (the partial month\n// its balance was taken in); an older month, or a beat created after its last month ended, keeps the\n// whole month.\nconst accountDateStrategy: FilterStrategy = ({\n beat,\n dataSeries,\n selectedIndex,\n isLastTab,\n instanceSlotData,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n const { start, end } = monthRange(seriesItem?.date)\n const createdAt = toCreatedAt(beat.created_at)\n\n return {\n dateRange: {\n start,\n end: isLastTab && isValid(createdAt) && createdAt < end ? createdAt : end,\n },\n ...accountScope(\n beat.account_guids?.length ? beat.account_guids : instanceSlotData.account_guids,\n ),\n }\n}\n\n// ── Double-bar strategies ──────────────────────────────────────────────────────────────────────\n\n// Monthly Spend to Income Comparison — the selected month's main (Spend, sub-tab 0) or comparison\n// (Income, sub-tab 1) transactions: membership in that bar's stored guids (data_series\n// aggregated_guids), within the month. Fails closed: a bar that names no guids for the tab shows none.\nconst comparisonGuidsStrategy: FilterStrategy = ({\n beat,\n comparisonBars,\n selectedIndex,\n subIndex,\n}) => {\n const bar = comparisonBars[selectedIndex]\n const guids = new Set(subIndex === 1 ? bar?.comparisonGuids : bar?.mainGuids)\n // parseISO reads the 'yyyy-MM-dd' bar date as a local calendar day, so the month never shifts with\n // the viewer's time zone; a missing bar, guid list or date fails closed.\n const month = parseISO(bar?.date ?? '')\n if (!guids.size || !isValid(month)) return { accounts: [], custom: () => false }\n\n return {\n custom: (trn) => guids.has(trn.guid),\n dateRange: { start: startOfMonth(month), end: endOfMonth(month) },\n // The V2 payload carries no account_guids (neither instance_slot.data nor insights_payload).\n ...accountScope(beat.account_guids),\n }\n}\n\n// TODO(next MR — tabsOnly): aggregatedGuids / depositSummary strategies for the donut-drawer beats.\n\nexport const layout: Partial<Record<DrillDownVariant, DrillDownVariantConfig>> = {\n [DRILLDOWN_VARIANTS.TRANSACTION]: {\n top: 'singleBar',\n scope: 'store',\n filterMode: 'store',\n filterStrategy: transactionGuidStrategy,\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n header: (ctx: DrillDownHeaderContext) => {\n const { title, subHeader } = ctx\n return {\n heading: title,\n subHeadingText: subHeader?.text || undefined,\n icon: (\n <MerchantLogo\n alt={subHeader?.text}\n categoryGuid={subHeader?.logo?.category_guid || ''}\n merchantGuid={subHeader?.logo?.merchant_guid || ''}\n size={16}\n />\n ),\n }\n },\n tipSection: (setCloseTipSection, copy, merchantName = '') => {\n return {\n message: buildDynamicCopy(\n copy.general.tip_section_message,\n <strong>{copy.general.tip_section_title}</strong>,\n <strong>{merchantName}</strong>,\n ),\n onDismiss: () => setCloseTipSection(true),\n } as TipSectionProps\n },\n },\n [DRILLDOWN_VARIANTS.CATEGORY_SPEND]: {\n top: 'singleBar',\n filterStrategy: categoryStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n header: (ctx: DrillDownHeaderContext) => {\n return {\n heading: ctx.categoryName,\n subHeadingText: ctx.selectedDate\n ? formatDate(toLocalDate(ctx.selectedDate), DATE_FORMATS_INTL.MONTH_LONG) || ''\n : '',\n icon: <Icon name=\"calendar_month\" size={16} />,\n }\n },\n },\n [DRILLDOWN_VARIANTS.MONTHLY_SPEND]: {\n top: 'singleBar',\n filterStrategy: spendCategoriesStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.chart.chart2 ?? theme.palette.primary.main],\n },\n [DRILLDOWN_VARIANTS.ACCOUNT_BALANCE]: {\n top: 'singleBar',\n filterStrategy: accountDateStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.success.main],\n },\n [DRILLDOWN_VARIANTS.UPCOMING_BILL]: {\n top: 'upcomingBill',\n filterStrategy: transactionGuidStrategy,\n scope: 'beat',\n filterMode: 'local',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n },\n\n // Low Account Balance's \"Transactions\" link: the account's transactions for the alert's window.\n [DRILLDOWN_VARIANTS.LOW_BALANCE]: {\n top: 'list',\n filterStrategy: accountWindowStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.primary.main],\n },\n\n // ── Double-bar comparison beats (month tabs + main / comparison sub-tabs) ────────────────────\n // Monthly Spend to Income Comparison: Spend vs Income per month, in the card block's palette.\n [DRILLDOWN_VARIANTS.SPEND_TO_INCOME]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => getDoubleBarLayoutConfig(theme, 'spend_to_income')?.color ?? [],\n subTabAriaLabels: (copy) => [copy.general.spend_transactions, copy.general.income_transactions],\n },\n // Cost of Living to Income: one living-cost category (Housing, Groceries, ...) vs Income per month.\n // The cost bar takes the beat category's colour and Income the legacy chart4, as the pulse drawer.\n [DRILLDOWN_VARIANTS.COST_OF_LIVING]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [\n categoryColor(theme, categoryGuid),\n theme.palette.chart.chart4 ?? theme.palette.primary.main,\n ],\n subTabAriaLabels: (copy) => [undefined, copy.general.income_transactions],\n },\n // NEXT MR — the other double-bar beats reuse comparisonGuidsStrategy with their own palettes:\n // [DRILLDOWN_VARIANTS.SAVINGS_TO_INCOME]: comparison('savingsVsIncome'),\n // [DRILLDOWN_VARIANTS.DEBT_TO_INCOME]: comparison('debtVsIncome'),\n //\n // ── NEXT MR: tabsOnly donut-drawer beats (no top chart) ───────────────────────────────────\n // [DRILLDOWN_VARIANTS.NON_ESSENTIAL_CATEGORY]: { top: 'tabsOnly', ... },\n // [DRILLDOWN_VARIANTS.DEPOSIT_SUMMARY]: { top: 'tabsOnly', ... },\n}\n\n// Fallback for a missing/typo'd backend variant: a single-bar, store-scoped drawer filtered by the\n// beat's transaction guid and colored by category, so the drawer still renders instead of crashing.\nexport const FALLBACK: DrillDownVariantConfig = {\n top: 'singleBar',\n filterStrategy: transactionGuidStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n}\n"],"mappings":";;;;;;;;;AAqCA,IAAa,IAAqB;AAAA,EAChC,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,wBAAwB;AAAA,EACxB,iBAAiB;AAAA,EACjB,aAAa;AACf,GAwDM,IAAA,CAAiB,GAAc,MAClC,KAAgB,EAAiB,GAAc,CAAK,KAAM,EAAM,QAAQ,QAAQ,MAE7E,IAAA,CAAe,MACnB,OAAO,KAAS,WAAW,EAAS,CAAI,IAAI,IAAI,KAAK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AA,IAChB,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAA,CAAS,GAAc,MAA0B,CAC/C,EAAc,GAAO,CAAY,GACjC,EAAM,QAAQ,MAAM,UAAU,EAAM,QAAQ,QAAQ,IACtD;AAAA,IACA,kBAAA,CAAmB,MAAS,CAAC,QAAW,EAAK,QAAQ,mBAAmB;AAAA,EAC1E;AAQF,GAIa,IAAmC;AAAA,EAC9C,KAAK;AAAA,EACL,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,QAAA,CAAS,GAAc,MAA0B,CAAC,EAAc,GAAO,CAAY,CAAC;AACtF"}
|
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import { useAppConfig as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
1
|
+
import { useAppConfig as z, useGlobalCopyStore as K, useGlobalStore as W, useInsightsV2Store as X } from "../../common/context/hooks.es.js";
|
|
2
|
+
import { sendClientConfiguredCta as Y } from "../../common/utils/PostMessage.es.js";
|
|
3
|
+
import { BeatActionsProvider as $ } from "../beatActions.es.js";
|
|
4
|
+
import { isContactSupportCtaDisabled as q } from "../actionBlocks/ContactSupportActionBlock.es.js";
|
|
5
|
+
import { reportCtaClick as J } from "../ctaActions/runCtaAction.es.js";
|
|
6
|
+
import { useBeatCtaActions as Q } from "../ctaActions/useCtaAction.es.js";
|
|
7
|
+
import { actionBlocksKey as Z } from "../mappings/actionBlocksKey.es.js";
|
|
8
|
+
import { logoFromRef as oo } from "./shared/EntityLogo.es.js";
|
|
9
|
+
import eo from "./FeedbackDialog.es.js";
|
|
10
|
+
import { ErrorCard as io } from "./ErrorCard.es.js";
|
|
11
|
+
import { blocks as to } from "../mappings/blocks.es.js";
|
|
12
|
+
import { ActionBlockLayer as ro } from "../actionBlocks/ActionBlockLayer.es.js";
|
|
13
|
+
import no from "./Footer.es.js";
|
|
14
|
+
import so from "./Header.es.js";
|
|
15
|
+
import { FeedbackBar as ao } from "./FeedbackBar.es.js";
|
|
16
|
+
import { DismissInsightDialog as lo } from "./DismissInsightDialog.es.js";
|
|
17
|
+
import { HiddenConfirmationCard as co } from "./HiddenConfirmationCard.es.js";
|
|
18
|
+
import { LoadingCard as mo } from "./LoadingCard.es.js";
|
|
19
|
+
import { ObsolesceBanner as po } from "./ObsolesceBanner.es.js";
|
|
20
|
+
import { useBeatFeedbackFlow as uo } from "../hooks/useBeatFeedbackFlow.es.js";
|
|
21
|
+
import { useMemo as fo } from "react";
|
|
22
|
+
import { observer as Co } from "mobx-react-lite";
|
|
23
|
+
import y from "@mui/material/Stack";
|
|
24
|
+
import { P as bo } from "@mxenabled/mxui";
|
|
25
|
+
import d from "@mui/material/Button";
|
|
25
26
|
import { ChevronRight as T } from "@mxenabled/mx-icons";
|
|
26
|
-
import { Fragment as
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
var
|
|
27
|
+
import { Fragment as go, jsx as e, jsxs as m } from "react/jsx-runtime";
|
|
28
|
+
import ho from "@mui/material/Box";
|
|
29
|
+
import yo from "@mui/material/Card";
|
|
30
|
+
var _o = {}, ko = {
|
|
30
31
|
position: "absolute",
|
|
31
32
|
top: 0,
|
|
32
33
|
left: 0,
|
|
@@ -35,7 +36,7 @@ var ho = {}, yo = {
|
|
|
35
36
|
backgroundColor: "background.default",
|
|
36
37
|
opacity: 0.7,
|
|
37
38
|
zIndex: 3
|
|
38
|
-
},
|
|
39
|
+
}, vo = {
|
|
39
40
|
alignItems: "center",
|
|
40
41
|
alignSelf: "flex-start",
|
|
41
42
|
display: "flex",
|
|
@@ -43,44 +44,51 @@ var ho = {}, yo = {
|
|
|
43
44
|
height: 44,
|
|
44
45
|
px: 2,
|
|
45
46
|
textTransform: "none"
|
|
46
|
-
},
|
|
47
|
-
const
|
|
47
|
+
}, Qo = Co(({ beat: i, beatActions: s = _o, obsolete: f, isLoading: O = !1, isError: I = !1 }) => {
|
|
48
|
+
const A = K(), F = X(), { config: E } = z(), o = uo(i, s), _ = W(), { runCta: M, primary: k, secondary: v } = Q(i, s, i.insights_payload?.primary_cta, i.insights_payload?.secondary_cta), p = i.insights_payload?.widget_type === "mini", N = fo(() => ({
|
|
48
49
|
...o.wrappedActions,
|
|
49
50
|
beat: i
|
|
50
51
|
}), [o.wrappedActions, i]);
|
|
51
|
-
if (
|
|
52
|
-
const
|
|
53
|
-
if (!
|
|
54
|
-
const { instance_slot:
|
|
55
|
-
logo:
|
|
56
|
-
text:
|
|
57
|
-
} : void 0),
|
|
58
|
-
if (!
|
|
59
|
-
if (
|
|
60
|
-
|
|
52
|
+
if (I) return /* @__PURE__ */ e(io, {});
|
|
53
|
+
const t = i.insights_payload;
|
|
54
|
+
if (!t || o.cardState === "dismissed") return null;
|
|
55
|
+
const { instance_slot: R, primary_cta: r, secondary_cta: a, sub_title: G, title: H, guid: x, dismissed_at: P } = t, { block: V } = R, U = G ?? (t.subtitle ? {
|
|
56
|
+
logo: oo(t.logo),
|
|
57
|
+
text: t.subtitle
|
|
58
|
+
} : void 0), u = (n) => q(n, E, s.onContactSupport), S = async (n, c) => {
|
|
59
|
+
if (!u(c.block)) {
|
|
60
|
+
if (c.block === Z.CONTACT_SUPPORT_ACTION_BLOCK) {
|
|
61
|
+
J({
|
|
61
62
|
beat: i,
|
|
62
|
-
stores:
|
|
63
|
+
stores: _,
|
|
63
64
|
hostActions: s,
|
|
64
|
-
slot:
|
|
65
|
+
slot: n
|
|
65
66
|
}), s.onContactSupport?.();
|
|
66
67
|
return;
|
|
67
68
|
}
|
|
68
|
-
await
|
|
69
|
+
await M(n, c);
|
|
69
70
|
}
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
}, w = to[V], l = t.in_description_cta, C = !p && l?.label && l.block ? l : void 0, b = r?.label || (C ? void 0 : l?.label) || void 0, B = !p && !!r?.label, D = i.in_description_cta || i.html_in_description_cta, j = () => {
|
|
72
|
+
const { is_mobile_webview: n, clientConfig: c } = _.appDataStore.appConfig;
|
|
73
|
+
Y(i.template, {
|
|
74
|
+
isMobileWebview: n,
|
|
75
|
+
webviewScheme: c?.master?.ui_message_webview_url_scheme,
|
|
76
|
+
userGuid: t.user_guid ?? i.user_guid
|
|
77
|
+
});
|
|
78
|
+
}, L = !p && !!a?.label, g = A.insights_feed?.general, h = f?.state === "not_refreshable" && !P && !!g;
|
|
79
|
+
return /* @__PURE__ */ e($, {
|
|
80
|
+
value: N,
|
|
81
|
+
children: /* @__PURE__ */ m(y, {
|
|
74
82
|
sx: { mb: 16 },
|
|
75
83
|
children: [
|
|
76
|
-
o.cardState === "confirming" ? /* @__PURE__ */
|
|
84
|
+
o.cardState === "confirming" ? /* @__PURE__ */ e(co, {
|
|
77
85
|
onClose: o.collapseConfirmation,
|
|
78
86
|
onLeaveFeedback: o.openHideSurvey,
|
|
79
87
|
onUndo: o.undoDismiss
|
|
80
|
-
}) : /* @__PURE__ */
|
|
88
|
+
}) : /* @__PURE__ */ m(go, { children: [f && g && /* @__PURE__ */ e(po, {
|
|
81
89
|
...f,
|
|
82
|
-
copy:
|
|
83
|
-
}), /* @__PURE__ */
|
|
90
|
+
copy: g
|
|
91
|
+
}), /* @__PURE__ */ m(yo, {
|
|
84
92
|
inert: h,
|
|
85
93
|
sx: { ...h && {
|
|
86
94
|
position: "relative",
|
|
@@ -88,17 +96,17 @@ var ho = {}, yo = {
|
|
|
88
96
|
pointerEvents: "none"
|
|
89
97
|
} },
|
|
90
98
|
children: [
|
|
91
|
-
h && /* @__PURE__ */
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
isMini:
|
|
94
|
-
subtitle:
|
|
99
|
+
h && /* @__PURE__ */ e(ho, { sx: ko }),
|
|
100
|
+
/* @__PURE__ */ e(so, {
|
|
101
|
+
isMini: p,
|
|
102
|
+
subtitle: U,
|
|
95
103
|
title: H ?? ""
|
|
96
104
|
}),
|
|
97
|
-
|
|
98
|
-
beatGuid:
|
|
99
|
-
payload:
|
|
105
|
+
O ? /* @__PURE__ */ e(mo, {}) : w && /* @__PURE__ */ e(w, {
|
|
106
|
+
beatGuid: x,
|
|
107
|
+
payload: t
|
|
100
108
|
}),
|
|
101
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ m(y, {
|
|
102
110
|
sx: {
|
|
103
111
|
gap: 6,
|
|
104
112
|
pb: 16,
|
|
@@ -106,14 +114,14 @@ var ho = {}, yo = {
|
|
|
106
114
|
px: 16
|
|
107
115
|
},
|
|
108
116
|
children: [
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
-
dangerouslySetInnerHTML: { __html:
|
|
117
|
+
/* @__PURE__ */ e(bo, {
|
|
118
|
+
dangerouslySetInnerHTML: { __html: t.description.html_text },
|
|
111
119
|
variant: "subtitle2"
|
|
112
120
|
}),
|
|
113
|
-
|
|
114
|
-
endIcon: /* @__PURE__ */
|
|
115
|
-
onClick: () =>
|
|
116
|
-
guid:
|
|
121
|
+
C && /* @__PURE__ */ e(d, {
|
|
122
|
+
endIcon: /* @__PURE__ */ e(T, {}),
|
|
123
|
+
onClick: () => F.openActionDrawer({
|
|
124
|
+
guid: x,
|
|
117
125
|
trigger: "inDescriptionCta"
|
|
118
126
|
}),
|
|
119
127
|
sx: {
|
|
@@ -121,63 +129,62 @@ var ho = {}, yo = {
|
|
|
121
129
|
p: 4,
|
|
122
130
|
width: "max-content"
|
|
123
131
|
},
|
|
124
|
-
children:
|
|
132
|
+
children: C.label
|
|
125
133
|
}),
|
|
126
|
-
!
|
|
127
|
-
endIcon: /* @__PURE__ */
|
|
128
|
-
onClick:
|
|
129
|
-
},
|
|
134
|
+
!l?.label && D && /* @__PURE__ */ e(d, {
|
|
135
|
+
endIcon: /* @__PURE__ */ e(T, {}),
|
|
136
|
+
onClick: j,
|
|
130
137
|
sx: {
|
|
131
138
|
height: 24,
|
|
132
139
|
p: 4,
|
|
133
140
|
width: "max-content"
|
|
134
141
|
},
|
|
135
|
-
children:
|
|
142
|
+
children: D
|
|
136
143
|
})
|
|
137
144
|
]
|
|
138
145
|
}),
|
|
139
|
-
(b ||
|
|
146
|
+
(b || L) && /* @__PURE__ */ m(y, {
|
|
140
147
|
sx: {
|
|
141
148
|
gap: 8,
|
|
142
149
|
pb: 16,
|
|
143
150
|
px: 16
|
|
144
151
|
},
|
|
145
152
|
children: [
|
|
146
|
-
b && !B && /* @__PURE__ */
|
|
147
|
-
sx:
|
|
153
|
+
b && !B && /* @__PURE__ */ e(d, {
|
|
154
|
+
sx: vo,
|
|
148
155
|
variant: "text",
|
|
149
156
|
children: b
|
|
150
157
|
}),
|
|
151
|
-
B && r && /* @__PURE__ */
|
|
152
|
-
"aria-disabled":
|
|
158
|
+
B && r && /* @__PURE__ */ e(d, {
|
|
159
|
+
"aria-disabled": u(r.block) || k.disabled,
|
|
153
160
|
disabled: k.disabled,
|
|
154
|
-
onClick: () =>
|
|
155
|
-
sx: { ...
|
|
161
|
+
onClick: () => S("primary", r),
|
|
162
|
+
sx: { ...u(r.block) && { color: "text.disabled" } },
|
|
156
163
|
variant: "outlined",
|
|
157
164
|
children: r.label
|
|
158
165
|
}),
|
|
159
|
-
|
|
160
|
-
"aria-disabled":
|
|
166
|
+
L && a && /* @__PURE__ */ e(d, {
|
|
167
|
+
"aria-disabled": u(a.block) || v.disabled,
|
|
161
168
|
color: "secondary",
|
|
162
|
-
disabled:
|
|
163
|
-
onClick: () =>
|
|
164
|
-
children:
|
|
169
|
+
disabled: v.disabled,
|
|
170
|
+
onClick: () => S("secondary", a),
|
|
171
|
+
children: a.label
|
|
165
172
|
})
|
|
166
173
|
]
|
|
167
174
|
}),
|
|
168
|
-
/* @__PURE__ */
|
|
175
|
+
/* @__PURE__ */ e(ao, {
|
|
169
176
|
onTellUsMore: o.openRatingSurvey,
|
|
170
177
|
show: o.isFeedbackBarShown
|
|
171
178
|
})
|
|
172
179
|
]
|
|
173
180
|
})] }),
|
|
174
|
-
/* @__PURE__ */
|
|
175
|
-
/* @__PURE__ */
|
|
181
|
+
/* @__PURE__ */ e(ro, { beat: i }),
|
|
182
|
+
/* @__PURE__ */ e(lo, {
|
|
176
183
|
isOpen: o.isDismissOpen,
|
|
177
184
|
onClose: o.closeDismissDialog,
|
|
178
185
|
onDismiss: o.confirmDismiss
|
|
179
186
|
}),
|
|
180
|
-
o.isSurveyOpen && /* @__PURE__ */
|
|
187
|
+
o.isSurveyOpen && /* @__PURE__ */ e(eo, {
|
|
181
188
|
characterLimitLabel: o.survey.characterLimitLabel,
|
|
182
189
|
closeAriaLabel: o.survey.closeAriaLabel,
|
|
183
190
|
isOpen: !0,
|
|
@@ -190,13 +197,13 @@ var ho = {}, yo = {
|
|
|
190
197
|
secondaryText: o.survey.backText,
|
|
191
198
|
title: o.survey.title
|
|
192
199
|
}),
|
|
193
|
-
o.cardState === "visible" &&
|
|
200
|
+
o.cardState === "visible" && t.footer && /* @__PURE__ */ e(no, { footer: t.footer })
|
|
194
201
|
]
|
|
195
202
|
})
|
|
196
203
|
});
|
|
197
204
|
});
|
|
198
205
|
export {
|
|
199
|
-
|
|
206
|
+
Qo as default
|
|
200
207
|
};
|
|
201
208
|
|
|
202
209
|
//# sourceMappingURL=BaseLayout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseLayout.es.js","names":[],"sources":["../../../src/insights-v2/components/BaseLayout.tsx"],"sourcesContent":["import { useMemo } from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport Stack from '@mui/material/Stack'\n\nimport { ChevronRight } from '@mxenabled/mx-icons'\nimport { P } from '@mxenabled/mxui'\n\nimport { blocks } from '../mappings/blocks'\nimport { actionBlocksKey } from '../mappings/actionBlocksKey'\nimport { isContactSupportCtaDisabled } from '../actionBlocks/ContactSupportActionBlock'\nimport { logoFromRef } from './shared/EntityLogo'\n\nimport Footer from './Footer'\nimport Header from './Header'\nimport FeedbackBar from './FeedbackBar'\nimport FeedbackDialog from './FeedbackDialog'\nimport DismissInsightDialog from './DismissInsightDialog'\nimport HiddenConfirmationCard from './HiddenConfirmationCard'\nimport ErrorCard from './ErrorCard'\nimport LoadingCard from './LoadingCard'\nimport { ObsolesceBanner, type ObsolesceBannerState } from './ObsolesceBanner'\nimport { useAppConfig, useGlobalCopyStore, useGlobalStore, useInsightsV2Store } from '../../common'\nimport type { Beat, PrimaryCTA, SecondaryCTA } from '../../core'\nimport { BeatActionsProvider, type BeatActions } from '../beatActions'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { reportCtaClick, useBeatCtaActions } from '../ctaActions'\nimport { useBeatFeedbackFlow } from '../hooks/useBeatFeedbackFlow'\n\nexport interface ObsoleteState {\n state: ObsolesceBannerState\n onRefresh: () => void\n onDismiss: () => void\n}\n\ninterface BaseLayoutProps {\n beat: Beat\n beatActions?: BeatActions\n obsolete?: ObsoleteState\n /** Swap only the block slot for a LoadingCard (e.g. while a sampled beat loads). */\n isLoading?: boolean\n /** Replace the entire card with an ErrorCard (e.g. when the sample fails to load). */\n isError?: boolean\n}\n\nconst NO_BEAT_ACTIONS: BeatActions = {}\n\nconst OBSOLETE_OVERLAY_SX = {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n backgroundColor: 'background.default',\n opacity: 0.7,\n // Above every block's own z-index (hero card 1, AccountBlock 2), or that section shows through.\n zIndex: 3,\n} as const\n\n// Mini CTA label styled like a Button.\nconst MINI_CTA_SX = {\n alignItems: 'center',\n alignSelf: 'flex-start',\n display: 'flex',\n fontWeight: 600,\n height: 44,\n px: 2,\n textTransform: 'none',\n} as const\n\nconst BaseLayout = observer(\n ({\n beat,\n beatActions = NO_BEAT_ACTIONS,\n obsolete,\n isLoading = false,\n isError = false,\n }: BaseLayoutProps) => {\n const copy = useGlobalCopyStore()\n const insightsV2Store = useInsightsV2Store()\n const { config } = useAppConfig()\n const flow = useBeatFeedbackFlow(beat, beatActions)\n\n const stores = useGlobalStore()\n const {\n runCta: handleCtaClick,\n primary: primaryCtaState,\n secondary: secondaryCtaState,\n } = useBeatCtaActions(\n beat,\n beatActions,\n beat.insights_payload?.primary_cta,\n beat.insights_payload?.secondary_cta,\n )\n\n // Guard: payload may not be loaded yet (isLoading/isError states).\n const isMini = beat.insights_payload?.widget_type === 'mini'\n\n // Memoized: an inline object here would change identity every render, making every\n // useAnalyticsEvent() consumer's callback (and its effect deps) unstable too.\n const beatActionsValue = useMemo(\n () => ({ ...flow.wrappedActions, beat }),\n [flow.wrappedActions, beat],\n )\n\n // Error replaces the entire card; loading only swaps the block slot (below).\n if (isError) return <ErrorCard />\n\n const insights_payload = beat.insights_payload\n\n if (!insights_payload) return null\n if (flow.cardState === 'dismissed') return null\n\n const { instance_slot, primary_cta, secondary_cta, sub_title, title, guid, dismissed_at } =\n insights_payload\n const { block } = instance_slot\n\n // Rebuild V1 subtitle shape; sub_title wins if present.\n const subtitle =\n sub_title ??\n (insights_payload.subtitle\n ? {\n logo: logoFromRef(insights_payload.logo),\n text: insights_payload.subtitle,\n }\n : undefined)\n\n // CTAs run via ctaActions; contact_support_block bypasses it.\n const isCtaDisabled = (ctaBlock: string | null | undefined) =>\n isContactSupportCtaDisabled(ctaBlock, config, beatActions.onContactSupport)\n\n const onCtaClick = async (slot: 'primary' | 'secondary', cta: PrimaryCTA | SecondaryCTA) => {\n if (isCtaDisabled(cta.block)) return\n\n if (cta.block === actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK) {\n // Bypasses the runner, but still reports the press like any other CTA: the generic\n // press event, and (on a first primary press) FIRST_TIME_PRIMARY_ACTION_SELECTED +\n // cta_clicked_at.\n reportCtaClick({ beat, stores, hostActions: beatActions, slot })\n beatActions.onContactSupport?.()\n return\n }\n\n await handleCtaClick(slot, cta)\n }\n\n const Block = blocks[block as keyof typeof blocks]\n\n const inDescriptionCta = insights_payload.in_description_cta\n // Full card: the envelope's link opens the drawer its block names. A link with no block (mini's\n // \"Make a Transfer\") is the card's action, drawn as the mini label below, never a dead link.\n const envelopeLink =\n !isMini && inDescriptionCta?.label && inDescriptionCta.block ? inDescriptionCta : undefined\n // The card's action label: the primary CTA's, else a block-less envelope link's (ditto ≥ 1.4.3\n // sends mini's action as in_description_cta). `||`, not `??`: the copy may send the primary label\n // as \"\" rather than omit it, and an empty string must fall through. It is a button only on a full\n // card with a primary CTA; otherwise a label, so a tap reaches the host's card handler.\n const ctaLabel =\n primary_cta?.label || (envelopeLink ? undefined : inDescriptionCta?.label) || undefined\n const isCtaButton = !isMini && !!primary_cta?.label\n const showSecondaryCta = !isMini && !!secondary_cta?.label\n const obsoleteCopy = copy.insights_feed?.general\n const isObsoleteDimmed =\n obsolete?.state === 'not_refreshable' && !dismissed_at && !!obsoleteCopy\n\n return (\n <BeatActionsProvider value={beatActionsValue}>\n <Stack sx={{ mb: 16 }}>\n {flow.cardState === 'confirming' ? (\n <HiddenConfirmationCard\n onClose={flow.collapseConfirmation}\n onLeaveFeedback={flow.openHideSurvey}\n onUndo={flow.undoDismiss}\n />\n ) : (\n <>\n {obsolete && obsoleteCopy && <ObsolesceBanner {...obsolete} copy={obsoleteCopy} />}\n <Card\n inert={isObsoleteDimmed}\n sx={{\n ...(isObsoleteDimmed && {\n position: 'relative',\n zIndex: 2,\n pointerEvents: 'none',\n }),\n }}\n >\n {isObsoleteDimmed && <Box sx={OBSOLETE_OVERLAY_SX} />}\n <Header isMini={isMini} subtitle={subtitle} title={title ?? ''} />\n {isLoading ? (\n <LoadingCard />\n ) : (\n Block && <Block beatGuid={guid} payload={insights_payload} />\n )}\n\n <Stack sx={{ gap: 6, pb: 16, pt: 12, px: 16 }}>\n <P\n dangerouslySetInnerHTML={{\n __html: insights_payload.description.html_text,\n }}\n variant=\"subtitle2\"\n />\n {/* V2: the envelope's link opens the action block it names. */}\n {envelopeLink && (\n <Button\n endIcon={<ChevronRight />}\n onClick={() =>\n insightsV2Store.openActionDrawer({ guid, trigger: 'inDescriptionCta' })\n }\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {envelopeLink.label}\n </Button>\n )}\n {/* V1: the legacy field, shown for beats that do not send the envelope link. */}\n {!inDescriptionCta?.label && beat?.in_description_cta && (\n <Button\n endIcon={<ChevronRight />}\n onClick={() => {}}\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {beat.in_description_cta}\n </Button>\n )}\n </Stack>\n\n {(ctaLabel || showSecondaryCta) && (\n <Stack sx={{ gap: 8, pb: 16, px: 16 }}>\n {ctaLabel &&\n !isCtaButton && (\n // The card's action when it has no primary CTA button (mini always; a full card whose\n // only link names no block). What the tap does is the host's decision (Pulse posts\n // `carousel/cta`, the same redirect a V1 mini card sends), never the action drawer the\n // full card's CTA opens. It is a real (blue, focusable) button for that tap, but has no\n // handler of its own and does not stop the click, so it reaches the host's card handler\n // exactly as a tap on the card does.\n <Button sx={MINI_CTA_SX} variant=\"text\">\n {ctaLabel}\n </Button>\n )}\n {isCtaButton && primary_cta && (\n <Button\n aria-disabled={isCtaDisabled(primary_cta.block) || primaryCtaState.disabled}\n disabled={primaryCtaState.disabled}\n onClick={() => onCtaClick('primary', primary_cta)}\n sx={{\n ...(isCtaDisabled(primary_cta.block) && { color: 'text.disabled' }),\n }}\n variant=\"outlined\"\n >\n {primary_cta.label}\n </Button>\n )}\n {/* Mini has room for one CTA. */}\n {showSecondaryCta && secondary_cta && (\n <Button\n aria-disabled={\n isCtaDisabled(secondary_cta.block) || secondaryCtaState.disabled\n }\n color=\"secondary\"\n disabled={secondaryCtaState.disabled}\n onClick={() => onCtaClick('secondary', secondary_cta)}\n >\n {secondary_cta.label}\n </Button>\n )}\n </Stack>\n )}\n\n <FeedbackBar onTellUsMore={flow.openRatingSurvey} show={flow.isFeedbackBarShown} />\n </Card>\n </>\n )}\n\n <ActionBlockLayer beat={beat} />\n\n <DismissInsightDialog\n isOpen={flow.isDismissOpen}\n onClose={flow.closeDismissDialog}\n onDismiss={flow.confirmDismiss}\n />\n\n {flow.isSurveyOpen && (\n <FeedbackDialog\n characterLimitLabel={flow.survey.characterLimitLabel}\n closeAriaLabel={flow.survey.closeAriaLabel}\n isOpen={true}\n onBackClick={flow.feedbackDialogCallbacks.onBackClick}\n onClose={flow.closeSurvey}\n onSubmit={flow.submitSurvey}\n onTextInputFocus={flow.feedbackDialogCallbacks.onTextInputFocus}\n options={flow.survey.options}\n primaryText={flow.survey.submitText}\n secondaryText={flow.survey.backText}\n title={flow.survey.title}\n />\n )}\n\n {flow.cardState === 'visible' && insights_payload.footer && (\n <Footer footer={insights_payload.footer} />\n )}\n </Stack>\n </BeatActionsProvider>\n )\n },\n)\n\nexport default BaseLayout\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,IAAM,KAA+B,CAAC,GAEhC,KAAsB;AAAA,EAC1B,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,SAAS;AAAA,EAET,QAAQ;AACV,GAGM,KAAc;AAAA,EAClB,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,eAAe;AACjB,GAEM,KAAa,GAAA,CAChB,EACC,MAAA,GACA,aAAA,IAAc,IACd,UAAA,GACA,WAAA,IAAY,IACZ,SAAA,IAAU,GAAA,MACW;AACrB,QAAM,IAAO,EAAmB,GAC1B,IAAkB,EAAmB,GACrC,EAAE,QAAA,EAAA,I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/components/BaseLayout.tsx"],"sourcesContent":["import { useMemo } from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport Stack from '@mui/material/Stack'\n\nimport { ChevronRight } from '@mxenabled/mx-icons'\nimport { P } from '@mxenabled/mxui'\n\nimport { blocks } from '../mappings/blocks'\nimport { actionBlocksKey } from '../mappings/actionBlocksKey'\nimport { isContactSupportCtaDisabled } from '../actionBlocks/ContactSupportActionBlock'\nimport { logoFromRef } from './shared/EntityLogo'\n\nimport Footer from './Footer'\nimport Header from './Header'\nimport FeedbackBar from './FeedbackBar'\nimport FeedbackDialog from './FeedbackDialog'\nimport DismissInsightDialog from './DismissInsightDialog'\nimport HiddenConfirmationCard from './HiddenConfirmationCard'\nimport ErrorCard from './ErrorCard'\nimport LoadingCard from './LoadingCard'\nimport { ObsolesceBanner, type ObsolesceBannerState } from './ObsolesceBanner'\nimport { useAppConfig, useGlobalCopyStore, useGlobalStore, useInsightsV2Store } from '../../common'\nimport { sendClientConfiguredCta } from '../../common/utils/PostMessage'\nimport type { Beat, PrimaryCTA, SecondaryCTA } from '../../core'\nimport { BeatActionsProvider, type BeatActions } from '../beatActions'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { reportCtaClick, useBeatCtaActions } from '../ctaActions'\nimport { useBeatFeedbackFlow } from '../hooks/useBeatFeedbackFlow'\n\nexport interface ObsoleteState {\n state: ObsolesceBannerState\n onRefresh: () => void\n onDismiss: () => void\n}\n\ninterface BaseLayoutProps {\n beat: Beat\n beatActions?: BeatActions\n obsolete?: ObsoleteState\n /** Swap only the block slot for a LoadingCard (e.g. while a sampled beat loads). */\n isLoading?: boolean\n /** Replace the entire card with an ErrorCard (e.g. when the sample fails to load). */\n isError?: boolean\n}\n\nconst NO_BEAT_ACTIONS: BeatActions = {}\n\nconst OBSOLETE_OVERLAY_SX = {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n backgroundColor: 'background.default',\n opacity: 0.7,\n // Above every block's own z-index (hero card 1, AccountBlock 2), or that section shows through.\n zIndex: 3,\n} as const\n\n// Mini CTA label styled like a Button.\nconst MINI_CTA_SX = {\n alignItems: 'center',\n alignSelf: 'flex-start',\n display: 'flex',\n fontWeight: 600,\n height: 44,\n px: 2,\n textTransform: 'none',\n} as const\n\nconst BaseLayout = observer(\n ({\n beat,\n beatActions = NO_BEAT_ACTIONS,\n obsolete,\n isLoading = false,\n isError = false,\n }: BaseLayoutProps) => {\n const copy = useGlobalCopyStore()\n const insightsV2Store = useInsightsV2Store()\n const { config } = useAppConfig()\n const flow = useBeatFeedbackFlow(beat, beatActions)\n\n const stores = useGlobalStore()\n const {\n runCta: handleCtaClick,\n primary: primaryCtaState,\n secondary: secondaryCtaState,\n } = useBeatCtaActions(\n beat,\n beatActions,\n beat.insights_payload?.primary_cta,\n beat.insights_payload?.secondary_cta,\n )\n\n // Guard: payload may not be loaded yet (isLoading/isError states).\n const isMini = beat.insights_payload?.widget_type === 'mini'\n\n // Memoized: an inline object here would change identity every render, making every\n // useAnalyticsEvent() consumer's callback (and its effect deps) unstable too.\n const beatActionsValue = useMemo(\n () => ({ ...flow.wrappedActions, beat }),\n [flow.wrappedActions, beat],\n )\n\n // Error replaces the entire card; loading only swaps the block slot (below).\n if (isError) return <ErrorCard />\n\n const insights_payload = beat.insights_payload\n\n if (!insights_payload) return null\n if (flow.cardState === 'dismissed') return null\n\n const { instance_slot, primary_cta, secondary_cta, sub_title, title, guid, dismissed_at } =\n insights_payload\n const { block } = instance_slot\n\n // Rebuild V1 subtitle shape; sub_title wins if present.\n const subtitle =\n sub_title ??\n (insights_payload.subtitle\n ? {\n logo: logoFromRef(insights_payload.logo),\n text: insights_payload.subtitle,\n }\n : undefined)\n\n // CTAs run via ctaActions; contact_support_block bypasses it.\n const isCtaDisabled = (ctaBlock: string | null | undefined) =>\n isContactSupportCtaDisabled(ctaBlock, config, beatActions.onContactSupport)\n\n const onCtaClick = async (slot: 'primary' | 'secondary', cta: PrimaryCTA | SecondaryCTA) => {\n if (isCtaDisabled(cta.block)) return\n\n if (cta.block === actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK) {\n // Bypasses the runner, but still reports the press like any other CTA: the generic\n // press event, and (on a first primary press) FIRST_TIME_PRIMARY_ACTION_SELECTED +\n // cta_clicked_at.\n reportCtaClick({ beat, stores, hostActions: beatActions, slot })\n beatActions.onContactSupport?.()\n return\n }\n\n await handleCtaClick(slot, cta)\n }\n\n const Block = blocks[block as keyof typeof blocks]\n\n const inDescriptionCta = insights_payload.in_description_cta\n // Full card: the envelope's link opens the drawer its block names. A link with no block (mini's\n // \"Make a Transfer\") is the card's action, drawn as the mini label below, never a dead link.\n const envelopeLink =\n !isMini && inDescriptionCta?.label && inDescriptionCta.block ? inDescriptionCta : undefined\n // The card's action label: the primary CTA's, else a block-less envelope link's (ditto ≥ 1.4.3\n // sends mini's action as in_description_cta). `||`, not `??`: the copy may send the primary label\n // as \"\" rather than omit it, and an empty string must fall through. It is a button only on a full\n // card with a primary CTA; otherwise a label, so a tap reaches the host's card handler.\n const ctaLabel =\n primary_cta?.label || (envelopeLink ? undefined : inDescriptionCta?.label) || undefined\n const isCtaButton = !isMini && !!primary_cta?.label\n const clientConfiguredLabel = beat.in_description_cta || beat.html_in_description_cta\n const onClientConfiguredLinkClick = () => {\n const { is_mobile_webview, clientConfig } = stores.appDataStore.appConfig\n\n sendClientConfiguredCta(beat.template, {\n isMobileWebview: is_mobile_webview,\n webviewScheme: clientConfig?.master?.ui_message_webview_url_scheme,\n userGuid: insights_payload.user_guid ?? beat.user_guid,\n })\n }\n const showSecondaryCta = !isMini && !!secondary_cta?.label\n const obsoleteCopy = copy.insights_feed?.general\n const isObsoleteDimmed =\n obsolete?.state === 'not_refreshable' && !dismissed_at && !!obsoleteCopy\n\n return (\n <BeatActionsProvider value={beatActionsValue}>\n <Stack sx={{ mb: 16 }}>\n {flow.cardState === 'confirming' ? (\n <HiddenConfirmationCard\n onClose={flow.collapseConfirmation}\n onLeaveFeedback={flow.openHideSurvey}\n onUndo={flow.undoDismiss}\n />\n ) : (\n <>\n {obsolete && obsoleteCopy && <ObsolesceBanner {...obsolete} copy={obsoleteCopy} />}\n <Card\n inert={isObsoleteDimmed}\n sx={{\n ...(isObsoleteDimmed && {\n position: 'relative',\n zIndex: 2,\n pointerEvents: 'none',\n }),\n }}\n >\n {isObsoleteDimmed && <Box sx={OBSOLETE_OVERLAY_SX} />}\n <Header isMini={isMini} subtitle={subtitle} title={title ?? ''} />\n {isLoading ? (\n <LoadingCard />\n ) : (\n Block && <Block beatGuid={guid} payload={insights_payload} />\n )}\n\n <Stack sx={{ gap: 6, pb: 16, pt: 12, px: 16 }}>\n <P\n dangerouslySetInnerHTML={{\n __html: insights_payload.description.html_text,\n }}\n variant=\"subtitle2\"\n />\n {/* V2: the envelope's link opens the action block it names. */}\n {envelopeLink && (\n <Button\n endIcon={<ChevronRight />}\n onClick={() =>\n insightsV2Store.openActionDrawer({ guid, trigger: 'inDescriptionCta' })\n }\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {envelopeLink.label}\n </Button>\n )}\n {/* Custom-copy link when the envelope sends none; legacy mini shows it too, so no mini guard. */}\n {!inDescriptionCta?.label && clientConfiguredLabel && (\n <Button\n endIcon={<ChevronRight />}\n onClick={onClientConfiguredLinkClick}\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {clientConfiguredLabel}\n </Button>\n )}\n </Stack>\n\n {(ctaLabel || showSecondaryCta) && (\n <Stack sx={{ gap: 8, pb: 16, px: 16 }}>\n {ctaLabel &&\n !isCtaButton && (\n // The card's action when it has no primary CTA button (mini always; a full card whose\n // only link names no block). What the tap does is the host's decision (Pulse posts\n // `carousel/cta`, the same redirect a V1 mini card sends), never the action drawer the\n // full card's CTA opens. It is a real (blue, focusable) button for that tap, but has no\n // handler of its own and does not stop the click, so it reaches the host's card handler\n // exactly as a tap on the card does.\n <Button sx={MINI_CTA_SX} variant=\"text\">\n {ctaLabel}\n </Button>\n )}\n {isCtaButton && primary_cta && (\n <Button\n aria-disabled={isCtaDisabled(primary_cta.block) || primaryCtaState.disabled}\n disabled={primaryCtaState.disabled}\n onClick={() => onCtaClick('primary', primary_cta)}\n sx={{\n ...(isCtaDisabled(primary_cta.block) && { color: 'text.disabled' }),\n }}\n variant=\"outlined\"\n >\n {primary_cta.label}\n </Button>\n )}\n {/* Mini has room for one CTA. */}\n {showSecondaryCta && secondary_cta && (\n <Button\n aria-disabled={\n isCtaDisabled(secondary_cta.block) || secondaryCtaState.disabled\n }\n color=\"secondary\"\n disabled={secondaryCtaState.disabled}\n onClick={() => onCtaClick('secondary', secondary_cta)}\n >\n {secondary_cta.label}\n </Button>\n )}\n </Stack>\n )}\n\n <FeedbackBar onTellUsMore={flow.openRatingSurvey} show={flow.isFeedbackBarShown} />\n </Card>\n </>\n )}\n\n <ActionBlockLayer beat={beat} />\n\n <DismissInsightDialog\n isOpen={flow.isDismissOpen}\n onClose={flow.closeDismissDialog}\n onDismiss={flow.confirmDismiss}\n />\n\n {flow.isSurveyOpen && (\n <FeedbackDialog\n characterLimitLabel={flow.survey.characterLimitLabel}\n closeAriaLabel={flow.survey.closeAriaLabel}\n isOpen={true}\n onBackClick={flow.feedbackDialogCallbacks.onBackClick}\n onClose={flow.closeSurvey}\n onSubmit={flow.submitSurvey}\n onTextInputFocus={flow.feedbackDialogCallbacks.onTextInputFocus}\n options={flow.survey.options}\n primaryText={flow.survey.submitText}\n secondaryText={flow.survey.backText}\n title={flow.survey.title}\n />\n )}\n\n {flow.cardState === 'visible' && insights_payload.footer && (\n <Footer footer={insights_payload.footer} />\n )}\n </Stack>\n </BeatActionsProvider>\n )\n },\n)\n\nexport default BaseLayout\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,IAAM,KAA+B,CAAC,GAEhC,KAAsB;AAAA,EAC1B,UAAU;AAAA,EACV,KAAK;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