@mx-cartographer/experiences 9.6.12 → 9.6.14
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 +21 -0
- package/dist/common/components/CurrencyDialog.d.ts +6 -1
- package/dist/common/components/CurrencyDialog.es.js +24 -23
- package/dist/common/components/CurrencyDialog.es.js.map +1 -1
- package/dist/core/types/Insights.d.ts +7 -1
- package/dist/core/types/Insights.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js +3 -3
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +66 -61
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/ConnectWidgetActionBlock.es.js +17 -11
- package/dist/insights-v2/actionBlocks/ConnectWidgetActionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/layout.d.ts +27 -0
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/layout.es.js +14 -0
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/layout.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.es.js +5 -5
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/util.d.ts +6 -2
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/util.es.js +7 -4
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/util.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +63 -57
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/util.d.ts +4 -3
- package/dist/insights-v2/actionBlocks/util.es.js.map +1 -1
- package/dist/insights-v2/analytics/analyticsEventsConfig.d.ts +67 -0
- package/dist/insights-v2/analytics/analyticsEventsConfig.es.js +59 -0
- package/dist/insights-v2/analytics/analyticsEventsConfig.es.js.map +1 -0
- package/dist/insights-v2/analytics/index.d.ts +3 -0
- package/dist/insights-v2/analytics/resolveAnalyticsEvent.d.ts +5 -0
- package/dist/insights-v2/analytics/resolveAnalyticsEvent.es.js +19 -0
- package/dist/insights-v2/analytics/resolveAnalyticsEvent.es.js.map +1 -0
- package/dist/insights-v2/analytics/useAnalyticsEvent.d.ts +3 -0
- package/dist/insights-v2/analytics/useAnalyticsEvent.es.js +20 -0
- package/dist/insights-v2/analytics/useAnalyticsEvent.es.js.map +1 -0
- package/dist/insights-v2/beatActions.d.ts +18 -13
- package/dist/insights-v2/beatActions.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js +24 -22
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js.map +1 -1
- package/dist/insights-v2/components/BaseLayout.es.js +89 -79
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/components/CompactInsightCard.es.js +34 -24
- package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
- package/dist/insights-v2/components/LogoFromGuid.d.ts +2 -2
- package/dist/insights-v2/components/LogoFromGuid.es.js +44 -32
- package/dist/insights-v2/components/LogoFromGuid.es.js.map +1 -1
- package/dist/insights-v2/components/SubHeader.es.js +3 -2
- package/dist/insights-v2/components/SubHeader.es.js.map +1 -1
- package/dist/insights-v2/components/chartblocks/EmptyBarChart.es.js +4 -4
- package/dist/insights-v2/components/shared/EntityLogo.es.js +31 -21
- package/dist/insights-v2/components/shared/EntityLogo.es.js.map +1 -1
- package/dist/insights-v2/components/shared/images/FeeDetected.es.js +243 -0
- package/dist/insights-v2/components/shared/images/FeeDetected.es.js.map +1 -0
- package/dist/insights-v2/ctaActions/ctaHandlers.d.ts +1 -6
- package/dist/insights-v2/ctaActions/ctaHandlers.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/index.d.ts +1 -1
- package/dist/insights-v2/ctaActions/runCtaAction.d.ts +20 -5
- package/dist/insights-v2/ctaActions/runCtaAction.es.js +63 -41
- package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/types.d.ts +6 -5
- package/dist/insights-v2/index.es.js +84 -84
- package/dist/insights-v2/mappings/blocks.es.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { sentenceCaseTemplate as s } from "./analyticsEventsConfig.es.js";
|
|
2
|
+
var p = (e, t) => typeof e == "function" ? e(t) : e, a = (e, t) => {
|
|
3
|
+
const o = p(e.action, t), r = p(e.category, t);
|
|
4
|
+
return {
|
|
5
|
+
...o && { action: o },
|
|
6
|
+
...r && { category: r },
|
|
7
|
+
...(o || r) && { label: s(t.template) },
|
|
8
|
+
...e.postHog && { postHog: {
|
|
9
|
+
eventName: e.postHog.eventName,
|
|
10
|
+
properties: e.postHog.properties?.(t) ?? {}
|
|
11
|
+
} }
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
a as resolveAnalyticsEvent,
|
|
16
|
+
s as sentenceCaseTemplate
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=resolveAnalyticsEvent.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveAnalyticsEvent.es.js","names":[],"sources":["../../../src/insights-v2/analytics/resolveAnalyticsEvent.ts"],"sourcesContent":["import type { AnalyticsEventPayload } from '../beatActions'\nimport type { Beat } from '../../core'\nimport { sentenceCaseTemplate, type AnalyticsEventConfigEntry } from './analyticsEventsConfig'\n\nexport { sentenceCaseTemplate }\n\nconst resolve = (\n value: string | ((beat: Beat) => string) | undefined,\n beat: Beat,\n): string | undefined => (typeof value === 'function' ? value(beat) : value)\n\n// Resolves a catalogue entry (e.g. ANALYTICS_EVENTS_CONFIG.PRIMARY_ACTION_SELECTED) + beat into\n// a final analytics payload. Takes the entry directly, not a lookup key: the call site already\n// has the entry via property access, so there is nothing to look up and nothing to mistype.\nexport const resolveAnalyticsEvent = (\n config: AnalyticsEventConfigEntry,\n beat: Beat,\n): AnalyticsEventPayload => {\n const action = resolve(config.action, beat)\n const category = resolve(config.category, beat)\n\n return {\n ...(action && { action }),\n ...(category && { category }),\n ...((action || category) && { label: sentenceCaseTemplate(beat.template) }),\n ...(config.postHog && {\n postHog: {\n eventName: config.postHog.eventName,\n properties: config.postHog.properties?.(beat) ?? {},\n },\n }),\n }\n}\n"],"mappings":";AAMA,IAAM,IAAA,CACJ,GACA,MACwB,OAAO,KAAU,aAAa,EAAM,CAAI,IAAI,GAKzD,IAAA,CACX,GACA,MAC0B;AAC1B,QAAM,IAAS,EAAQ,EAAO,QAAQ,CAAI,GACpC,IAAW,EAAQ,EAAO,UAAU,CAAI;AAE9C,SAAO;AAAA,IACL,GAAI,KAAU,EAAE,QAAA,EAAO;AAAA,IACvB,GAAI,KAAY,EAAE,UAAA,EAAS;AAAA,IAC3B,IAAK,KAAU,MAAa,EAAE,OAAO,EAAqB,EAAK,QAAQ,EAAE;AAAA,IACzE,GAAI,EAAO,WAAW,EACpB,SAAS;AAAA,MACP,WAAW,EAAO,QAAQ;AAAA,MAC1B,YAAY,EAAO,QAAQ,aAAa,CAAI,KAAK,CAAC;AAAA,IACpD,EACF;AAAA,EACF;AACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useGlobalStore as e } from "../../common/context/hooks.es.js";
|
|
2
|
+
import { useBeatActions as a } from "../beatActions.es.js";
|
|
3
|
+
import { sendCtaAnalytics as i } from "../ctaActions/runCtaAction.es.js";
|
|
4
|
+
import { useCallback as c } from "react";
|
|
5
|
+
var p = () => {
|
|
6
|
+
const t = a(), o = e();
|
|
7
|
+
return c((n) => {
|
|
8
|
+
const { beat: s, ...r } = t;
|
|
9
|
+
!s || !r.onAnalyticsEvent || i({
|
|
10
|
+
beat: s,
|
|
11
|
+
stores: o,
|
|
12
|
+
hostActions: r
|
|
13
|
+
}, n);
|
|
14
|
+
}, [t, o]);
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
p as useAnalyticsEvent
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=useAnalyticsEvent.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAnalyticsEvent.es.js","names":[],"sources":["../../../src/insights-v2/analytics/useAnalyticsEvent.ts"],"sourcesContent":["import { useCallback } from 'react'\n\nimport { useGlobalStore } from '../../common'\nimport { useBeatActions } from '../beatActions'\nimport { sendCtaAnalytics } from '../ctaActions'\nimport type { AnalyticsEventConfigEntry } from './analyticsEventsConfig'\n\n// Call-site API: fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.SOME_KEY).\nexport type FireAnalyticsEvent = (event: AnalyticsEventConfigEntry) => void\n\n// sendCtaAnalytics for React components; reads ctx from context, no-ops if unset.\n// Stable across renders (given a stable context value from BaseLayout's memoized\n// BeatActionsProvider) so effects that list it as a dependency (e.g.\n// ConnectWidgetActionBlock's open-fire effect) don't re-run every render. Depend on the\n// context object itself here, not a `{ beat, ...hostActions }` rest-spread of it: the\n// spread allocates a new object every render regardless of the context value's own\n// identity, which would re-break the memoization one layer down.\nexport const useAnalyticsEvent = (): FireAnalyticsEvent => {\n const actions = useBeatActions()\n const stores = useGlobalStore()\n\n return useCallback(\n (event: AnalyticsEventConfigEntry) => {\n const { beat, ...hostActions } = actions\n\n if (!beat || !hostActions.onAnalyticsEvent) return\n\n sendCtaAnalytics({ beat, stores, hostActions }, event)\n },\n [actions, stores],\n )\n}\n"],"mappings":";;;;AAiBA,IAAa,IAAA,MAA8C;AACzD,QAAM,IAAU,EAAe,GACzB,IAAS,EAAe;AAE9B,SAAO,EAAA,CACJ,MAAqC;AACpC,UAAM,EAAE,MAAA,GAAM,GAAG,EAAA,IAAgB;AAEjC,IAAI,CAAC,KAAQ,CAAC,EAAY,oBAE1B,EAAiB;AAAA,MAAE,MAAA;AAAA,MAAM,QAAA;AAAA,MAAQ,aAAA;AAAA,IAAY,GAAG,CAAK;AAAA,EACvD,GACA,CAAC,GAAS,CAAM,CAClB;AACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { Beat } from '../core';
|
|
2
3
|
import { DismissType } from './components/DismissInsightDialog';
|
|
3
4
|
import { FeedbackDialogCloseReason } from './components/FeedbackDialog';
|
|
4
5
|
export type InsightMenuAction = 'helpful' | 'not_helpful' | 'hide';
|
|
@@ -21,11 +22,16 @@ export interface DismissParams {
|
|
|
21
22
|
beatGuid: string;
|
|
22
23
|
type: DismissType;
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
export interface AnalyticsEventPayload {
|
|
26
|
+
action?: string;
|
|
27
|
+
category?: string;
|
|
28
|
+
label?: string;
|
|
29
|
+
postHog?: {
|
|
30
|
+
eventName: string;
|
|
31
|
+
properties?: Record<string, unknown>;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** A host-side CTA effect. See ctaActions/README.md. */
|
|
29
35
|
export interface CtaActionParams {
|
|
30
36
|
beatGuid: string;
|
|
31
37
|
name: string;
|
|
@@ -43,17 +49,16 @@ export interface BeatActions {
|
|
|
43
49
|
onFeedbackDialogClose?: (reason: FeedbackDialogCloseReason) => void;
|
|
44
50
|
onFeedbackDialogBack?: () => void;
|
|
45
51
|
onFeedbackTextFocus?: () => void;
|
|
46
|
-
|
|
47
|
-
* Opens the host's contact-support flow for a `contact_support_block` CTA. insights-v2 cannot
|
|
48
|
-
* import the help module (hosts that don't ship it stub the import), so the host supplies it:
|
|
49
|
-
* the experiences Help widget wires `RequestSupport`; pulse wires its own. When absent, the CTA
|
|
50
|
-
* renders disabled (see `isContactSupportCtaDisabled`).
|
|
51
|
-
*/
|
|
52
|
+
onAnalyticsEvent?: (payload: AnalyticsEventPayload) => void;
|
|
52
53
|
onContactSupport?: () => void;
|
|
53
54
|
onCtaAction?: (params: CtaActionParams) => Promise<void> | void;
|
|
54
55
|
}
|
|
56
|
+
interface BeatActionsContextValue extends BeatActions {
|
|
57
|
+
beat?: Beat;
|
|
58
|
+
}
|
|
55
59
|
export declare const BeatActionsProvider: ({ value, children, }: {
|
|
56
|
-
value:
|
|
60
|
+
value: BeatActionsContextValue;
|
|
57
61
|
children: ReactNode;
|
|
58
62
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
59
|
-
export declare const useBeatActions: () =>
|
|
63
|
+
export declare const useBeatActions: () => BeatActionsContextValue;
|
|
64
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beatActions.es.js","names":[],"sources":["../../src/insights-v2/beatActions.tsx"],"sourcesContent":["import { createContext, useContext, type ReactNode } from 'react'\n\nimport type { DismissType } from './components/DismissInsightDialog'\nimport type { FeedbackDialogCloseReason } from './components/FeedbackDialog'\n\nexport type InsightMenuAction = 'helpful' | 'not_helpful' | 'hide'\nexport type InsightRating = 'helpful' | 'not_helpful'\n\nexport interface MenuActionHandlers {\n onAction: (action: InsightMenuAction) => void\n onOpen?: () => void\n disabled?: boolean\n}\n\nexport interface UpdateParams {\n beatGuid: string\n}\n\nexport interface FeedbackParams {\n beatGuid: string\n source: InsightRating | 'hide' | 'cta'\n option: string\n detail?: string\n}\n\nexport interface DismissParams {\n beatGuid: string\n type: DismissType\n}\n\n
|
|
1
|
+
{"version":3,"file":"beatActions.es.js","names":[],"sources":["../../src/insights-v2/beatActions.tsx"],"sourcesContent":["import { createContext, useContext, type ReactNode } from 'react'\n\nimport type { Beat } from '../core'\nimport type { DismissType } from './components/DismissInsightDialog'\nimport type { FeedbackDialogCloseReason } from './components/FeedbackDialog'\n\nexport type InsightMenuAction = 'helpful' | 'not_helpful' | 'hide'\nexport type InsightRating = 'helpful' | 'not_helpful'\n\nexport interface MenuActionHandlers {\n onAction: (action: InsightMenuAction) => void\n onOpen?: () => void\n disabled?: boolean\n}\n\nexport interface UpdateParams {\n beatGuid: string\n}\n\nexport interface FeedbackParams {\n beatGuid: string\n source: InsightRating | 'hide' | 'cta'\n option: string\n detail?: string\n}\n\nexport interface DismissParams {\n beatGuid: string\n type: DismissType\n}\n\n// Raw analytics payload for the host.\nexport interface AnalyticsEventPayload {\n action?: string\n category?: string\n label?: string\n postHog?: {\n eventName: string\n properties?: Record<string, unknown>\n }\n}\n/** A host-side CTA effect. See ctaActions/README.md. */\nexport interface CtaActionParams {\n beatGuid: string\n name: string\n params?: Record<string, unknown>\n}\n\n/** Host callbacks for a beat card. */\nexport interface BeatActions {\n onMenuAction?: MenuActionHandlers\n onUpdate?: (params: UpdateParams) => void\n onSubmitFeedback?: (params: FeedbackParams) => void | Promise<void>\n onDismissInsight?: (params: DismissParams) => void\n onUndoDismiss?: (params: { beatGuid: string }) => void\n onFeedbackDialogClose?: (reason: FeedbackDialogCloseReason) => void\n onFeedbackDialogBack?: () => void\n onFeedbackTextFocus?: () => void\n // Raw analytics callback; use useAnalyticsEvent() instead.\n onAnalyticsEvent?: (payload: AnalyticsEventPayload) => void\n // Host's contact-support flow for a contact_support_block CTA.\n onContactSupport?: () => void\n onCtaAction?: (params: CtaActionParams) => Promise<void> | void\n}\n\n// BeatActions plus beat, for useAnalyticsEvent().\ninterface BeatActionsContextValue extends BeatActions {\n beat?: Beat\n}\n\nconst BeatActionsContext = createContext<BeatActionsContextValue>({})\n\nexport const BeatActionsProvider = ({\n value,\n children,\n}: {\n value: BeatActionsContextValue\n children: ReactNode\n}) => <BeatActionsContext.Provider value={value}>{children}</BeatActionsContext.Provider>\n\nexport const useBeatActions = () => useContext(BeatActionsContext)\n"],"mappings":";;AAsEA,IAAM,IAAqB,EAAuC,CAAC,CAAC,GAEvD,IAAA,CAAuB,EAClC,OAAA,GACA,UAAA,EAAA,MAII,gBAAA,EAAC,EAAmB,UAApB;AAAA,EAAoC,OAAA;AAAA,EAAQ,UAAA;AAAsC,CAAA,GAE3E,IAAA,MAAuB,EAAW,CAAkB"}
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { useGlobalCopyStore as B, useGlobalUiStore as
|
|
1
|
+
import { useGlobalCopyStore as B, useGlobalUiStore as I, useInsightsV2Store as L } from "../../../../common/context/hooks.es.js";
|
|
2
2
|
import { formatCurrency as S } from "../../../../core/utils/NumberFormatting.es.js";
|
|
3
|
-
import
|
|
4
|
-
import { actionBlocksKey as
|
|
5
|
-
import { BarChartV2 as
|
|
6
|
-
import { EmptyBarChart as
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
3
|
+
import T from "../../../../common/components/Loader.es.js";
|
|
4
|
+
import { actionBlocksKey as v } from "../../../mappings/actionBlocksKey.es.js";
|
|
5
|
+
import { BarChartV2 as E } from "../../../components/chartblocks/BarchartV2.es.js";
|
|
6
|
+
import { EmptyBarChart as N } from "../../../components/chartblocks/EmptyBarChart.es.js";
|
|
7
|
+
import { ANALYTICS_EVENTS_CONFIG as k } from "../../../analytics/analyticsEventsConfig.es.js";
|
|
8
|
+
import { useAnalyticsEvent as x } from "../../../analytics/useAnalyticsEvent.es.js";
|
|
9
|
+
import { barChartVariant as D, buildChartData as O, buildDataSeries as R } from "./utils.es.js";
|
|
10
|
+
import V from "react";
|
|
11
|
+
import { observer as G } from "mobx-react-lite";
|
|
10
12
|
import { jsx as e } from "react/jsx-runtime";
|
|
11
|
-
import { useTheme as
|
|
12
|
-
var
|
|
13
|
-
const l =
|
|
14
|
-
if (!f) return /* @__PURE__ */ e(
|
|
15
|
-
const
|
|
16
|
-
return t.length ? /* @__PURE__ */ e(
|
|
13
|
+
import { useTheme as K } from "@mui/material/styles";
|
|
14
|
+
var X = G(({ payload: i, beatGuid: m = "" }) => {
|
|
15
|
+
const l = K(), { openActionDrawer: c } = L(), { insights_feed: o } = B(), { isCopyLoaded: f } = I(), { instance_slot: p, instance_slot_data: a, widget_type: d } = i, { data_series: h, ariaLabel: u = "", average_amount: n = 0, legends: s = [] } = a, t = O(R(h), u), [g] = V.useState(t.length - 1), { color: C } = D(p, a, l), b = x();
|
|
16
|
+
if (!f) return /* @__PURE__ */ e(T, {});
|
|
17
|
+
const _ = [o.general.monthly_amount, o.general.trend], [A, y] = s.length ? s.map((r) => r.label) : _;
|
|
18
|
+
return t.length ? /* @__PURE__ */ e(E, {
|
|
17
19
|
amounts: {
|
|
18
20
|
average: n,
|
|
19
21
|
formattedAverage: S(n, "0,0")
|
|
20
22
|
},
|
|
21
|
-
color:
|
|
23
|
+
color: C,
|
|
22
24
|
data: t,
|
|
23
|
-
monthlyAmountLabel:
|
|
25
|
+
monthlyAmountLabel: A,
|
|
24
26
|
margin: {
|
|
25
27
|
bottom: 8,
|
|
26
28
|
left: 16,
|
|
@@ -29,21 +31,21 @@ var J = R(({ payload: m, beatGuid: i = "" }) => {
|
|
|
29
31
|
},
|
|
30
32
|
onBarClick: (r) => {
|
|
31
33
|
if (d !== "full") return !1;
|
|
32
|
-
c({
|
|
33
|
-
guid:
|
|
34
|
+
b(k.CHART_BAR_CLICKED), c({
|
|
35
|
+
guid: m,
|
|
34
36
|
trigger: "chartBar",
|
|
35
37
|
context: {
|
|
36
38
|
chartBarIndex: r,
|
|
37
|
-
block:
|
|
39
|
+
block: v.TRANSCATION_HISTORY_ACTION_BLOCK
|
|
38
40
|
}
|
|
39
41
|
});
|
|
40
42
|
},
|
|
41
|
-
selectedTabIndex:
|
|
43
|
+
selectedTabIndex: g,
|
|
42
44
|
trendAmountLabel: y
|
|
43
|
-
}) : /* @__PURE__ */ e(
|
|
45
|
+
}) : /* @__PURE__ */ e(N, {});
|
|
44
46
|
});
|
|
45
47
|
export {
|
|
46
|
-
|
|
48
|
+
X as BarchartBlock
|
|
47
49
|
};
|
|
48
50
|
|
|
49
51
|
//# sourceMappingURL=BarchartBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarchartBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.tsx"],"sourcesContent":["import React from 'react'\nimport { useTheme } from '@mui/material/styles'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n formatCurrency,\n Loader,\n useGlobalCopyStore,\n useGlobalUiStore,\n useInsightsV2Store,\n} from '../../../../common'\nimport type { DataSeries, DrilldownPayload } from '../../../../core'\nimport type { BarChartBlockData } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport { BarChartV2 } from '../../../components/chartblocks/BarchartV2'\nimport { EmptyBarChart } from '../../../components/chartblocks/EmptyBarChart'\n\nimport type { BlockProps } from '../../types'\n\nimport { barChartVariant, buildChartData, buildDataSeries } from './utils'\nimport { actionBlocksKey } from '../../../mappings/actionBlocksKey'\n\nexport const BarchartBlock = observer(\n ({ payload, beatGuid = '' }: BlockProps<BarChartBlockData>) => {\n const theme = useTheme()\n const { openActionDrawer } = useInsightsV2Store()\n const { insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { isCopyLoaded } = useGlobalUiStore()\n const { instance_slot, instance_slot_data, widget_type } = payload\n const { data_series, ariaLabel = '', average_amount = 0, legends = [] } = instance_slot_data\n const chartData = buildChartData(buildDataSeries(data_series as DataSeries), ariaLabel)\n const [selectedTabIndex] = React.useState(chartData.length - 1)\n const { color } = barChartVariant(instance_slot, instance_slot_data, theme)\n\n if (!isCopyLoaded) {\n return <Loader />\n }\n\n // TODO: Temporary fallback while the backend doesn't always send `legends` on every beat/variant.\n // Remove this once the backend guarantees `legends` on the payload.\n const fallbackLabels = [insightsFeedCopy.general.monthly_amount, insightsFeedCopy.general.trend]\n\n const [monthlyAmountLabel, trendAmountLabel] = legends.length\n ? legends.map((legend) => legend.label)\n : fallbackLabels\n\n return chartData.length ? (\n <BarChartV2\n amounts={{\n average: average_amount,\n formattedAverage: formatCurrency(average_amount, '0,0'),\n }}\n color={color}\n data={chartData}\n monthlyAmountLabel={monthlyAmountLabel}\n margin={{\n bottom: 8,\n left: 16,\n right: 16,\n top: 16,\n }}\n onBarClick={(index) => {\n if (widget_type !== 'full') return false\n\n openActionDrawer({\n guid: beatGuid,\n trigger: 'chartBar',\n context: {\n chartBarIndex: index,\n block: actionBlocksKey.TRANSCATION_HISTORY_ACTION_BLOCK,\n } satisfies DrilldownPayload,\n })\n }}\n selectedTabIndex={selectedTabIndex}\n trendAmountLabel={trendAmountLabel}\n />\n ) : (\n <EmptyBarChart />\n )\n },\n)\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BarchartBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.tsx"],"sourcesContent":["import React from 'react'\nimport { useTheme } from '@mui/material/styles'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n formatCurrency,\n Loader,\n useGlobalCopyStore,\n useGlobalUiStore,\n useInsightsV2Store,\n} from '../../../../common'\nimport type { DataSeries, DrilldownPayload } from '../../../../core'\nimport type { BarChartBlockData } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport { BarChartV2 } from '../../../components/chartblocks/BarchartV2'\nimport { EmptyBarChart } from '../../../components/chartblocks/EmptyBarChart'\n\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../../../analytics'\nimport type { BlockProps } from '../../types'\n\nimport { barChartVariant, buildChartData, buildDataSeries } from './utils'\nimport { actionBlocksKey } from '../../../mappings/actionBlocksKey'\n\nexport const BarchartBlock = observer(\n ({ payload, beatGuid = '' }: BlockProps<BarChartBlockData>) => {\n const theme = useTheme()\n const { openActionDrawer } = useInsightsV2Store()\n const { insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { isCopyLoaded } = useGlobalUiStore()\n const { instance_slot, instance_slot_data, widget_type } = payload\n const { data_series, ariaLabel = '', average_amount = 0, legends = [] } = instance_slot_data\n const chartData = buildChartData(buildDataSeries(data_series as DataSeries), ariaLabel)\n const [selectedTabIndex] = React.useState(chartData.length - 1)\n const { color } = barChartVariant(instance_slot, instance_slot_data, theme)\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n if (!isCopyLoaded) {\n return <Loader />\n }\n\n // TODO: Temporary fallback while the backend doesn't always send `legends` on every beat/variant.\n // Remove this once the backend guarantees `legends` on the payload.\n const fallbackLabels = [insightsFeedCopy.general.monthly_amount, insightsFeedCopy.general.trend]\n\n const [monthlyAmountLabel, trendAmountLabel] = legends.length\n ? legends.map((legend) => legend.label)\n : fallbackLabels\n\n return chartData.length ? (\n <BarChartV2\n amounts={{\n average: average_amount,\n formattedAverage: formatCurrency(average_amount, '0,0'),\n }}\n color={color}\n data={chartData}\n monthlyAmountLabel={monthlyAmountLabel}\n margin={{\n bottom: 8,\n left: 16,\n right: 16,\n top: 16,\n }}\n onBarClick={(index) => {\n if (widget_type !== 'full') return false\n\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.CHART_BAR_CLICKED)\n\n openActionDrawer({\n guid: beatGuid,\n trigger: 'chartBar',\n context: {\n chartBarIndex: index,\n block: actionBlocksKey.TRANSCATION_HISTORY_ACTION_BLOCK,\n } satisfies DrilldownPayload,\n })\n }}\n selectedTabIndex={selectedTabIndex}\n trendAmountLabel={trendAmountLabel}\n />\n ) : (\n <EmptyBarChart />\n )\n },\n)\n"],"mappings":";;;;;;;;;;;;;AAuBA,IAAa,IAAgB,EAAA,CAC1B,EAAE,SAAA,GAAS,UAAA,IAAW,GAAA,MAAwC;AAC7D,QAAM,IAAQ,EAAS,GACjB,EAAE,kBAAA,EAAA,IAAqB,EAAmB,GAC1C,EAAE,eAAe,EAAA,IAAqB,EAAmB,GACzD,EAAE,cAAA,EAAA,IAAiB,EAAiB,GACpC,EAAE,eAAA,GAAe,oBAAA,GAAoB,aAAA,EAAA,IAAgB,GACrD,EAAE,aAAA,GAAa,WAAA,IAAY,IAAI,gBAAA,IAAiB,GAAG,SAAA,IAAU,CAAC,EAAA,IAAM,GACpE,IAAY,EAAe,EAAgB,CAAyB,GAAG,CAAS,GAChF,CAAC,CAAA,IAAoB,EAAM,SAAS,EAAU,SAAS,CAAC,GACxD,EAAE,OAAA,EAAA,IAAU,EAAgB,GAAe,GAAoB,CAAK,GACpE,IAAqB,EAAkB;AAE7C,MAAI,CAAC,EACH,QAAO,gBAAA,EAAC,GAAD,CAAS,CAAA;AAKlB,QAAM,IAAiB,CAAC,EAAiB,QAAQ,gBAAgB,EAAiB,QAAQ,KAAK,GAEzF,CAAC,GAAoB,CAAA,IAAoB,EAAQ,SACnD,EAAQ,IAAA,CAAK,MAAW,EAAO,KAAK,IACpC;AAEJ,SAAO,EAAU,SACf,gBAAA,EAAC,GAAD;AAAA,IACE,SAAS;AAAA,MACP,SAAS;AAAA,MACT,kBAAkB,EAAe,GAAgB,KAAK;AAAA,IACxD;AAAA,IACO,OAAA;AAAA,IACP,MAAM;AAAA,IACc,oBAAA;AAAA,IACpB,QAAQ;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,MACP,KAAK;AAAA,IACP;AAAA,IACA,YAAA,CAAa,MAAU;AACrB,UAAI,MAAgB,OAAQ,QAAO;AAEnC,MAAA,EAAmB,EAAwB,iBAAiB,GAE5D,EAAiB;AAAA,QACf,MAAM;AAAA,QACN,SAAS;AAAA,QACT,SAAS;AAAA,UACP,eAAe;AAAA,UACf,OAAO,EAAgB;AAAA,QACzB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACkB,kBAAA;AAAA,IACA,kBAAA;AAAA,EACnB,CAAA,IAED,gBAAA,EAAC,GAAD,CAAgB,CAAA;AAEpB,CACF"}
|
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
import { useAppConfig as
|
|
2
|
-
import { BeatActionsProvider as
|
|
3
|
-
import { isContactSupportCtaDisabled as
|
|
4
|
-
import { logoFromRef as
|
|
5
|
-
import { actionBlocksKey as
|
|
6
|
-
import
|
|
7
|
-
import { ErrorCard as q } from "./ErrorCard.es.js";
|
|
1
|
+
import { useAppConfig as U, useGlobalCopyStore as j, useGlobalStore as z, useInsightsV2Store as K } from "../../common/context/hooks.es.js";
|
|
2
|
+
import { BeatActionsProvider as X } from "../beatActions.es.js";
|
|
3
|
+
import { isContactSupportCtaDisabled as W } from "../actionBlocks/ContactSupportActionBlock.es.js";
|
|
4
|
+
import { logoFromRef as Y } from "./shared/EntityLogo.es.js";
|
|
5
|
+
import { actionBlocksKey as $ } from "../mappings/actionBlocksKey.es.js";
|
|
6
|
+
import { reportCtaClick as q } from "../ctaActions/runCtaAction.es.js";
|
|
8
7
|
import { useBeatCtaActions as J } from "../ctaActions/useCtaAction.es.js";
|
|
9
|
-
import
|
|
10
|
-
import Z from "./
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
8
|
+
import Q from "./FeedbackDialog.es.js";
|
|
9
|
+
import { ErrorCard as Z } from "./ErrorCard.es.js";
|
|
10
|
+
import { blocks as oo } from "../mappings/blocks.es.js";
|
|
11
|
+
import to from "./Footer.es.js";
|
|
12
|
+
import io from "./Header.es.js";
|
|
13
|
+
import { FeedbackBar as eo } from "./FeedbackBar.es.js";
|
|
14
|
+
import { DismissInsightDialog as ro } from "./DismissInsightDialog.es.js";
|
|
15
|
+
import { HiddenConfirmationCard as no } from "./HiddenConfirmationCard.es.js";
|
|
16
|
+
import { LoadingCard as so } from "./LoadingCard.es.js";
|
|
17
|
+
import { ObsolesceBanner as ao } from "./ObsolesceBanner.es.js";
|
|
18
|
+
import { ActionBlockLayer as lo } from "../actionBlocks/ActionBlockLayer.es.js";
|
|
19
|
+
import { useBeatFeedbackFlow as co } from "../hooks/useBeatFeedbackFlow.es.js";
|
|
20
|
+
import { useMemo as mo } from "react";
|
|
21
|
+
import { observer as po } from "mobx-react-lite";
|
|
20
22
|
import g from "@mui/material/Stack";
|
|
21
|
-
import { P as
|
|
22
|
-
import
|
|
23
|
+
import { P as uo, Text as fo } from "@mxenabled/mxui";
|
|
24
|
+
import p from "@mui/material/Button";
|
|
23
25
|
import { ChevronRight as D } from "@mxenabled/mx-icons";
|
|
24
|
-
import { Fragment as
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
var
|
|
26
|
+
import { Fragment as bo, jsx as t, jsxs as l } from "react/jsx-runtime";
|
|
27
|
+
import Co from "@mui/material/Box";
|
|
28
|
+
import ho from "@mui/material/Card";
|
|
29
|
+
var yo = {}, go = {
|
|
28
30
|
position: "absolute",
|
|
29
31
|
top: 0,
|
|
30
32
|
left: 0,
|
|
@@ -33,7 +35,7 @@ var uo = {}, bo = {
|
|
|
33
35
|
backgroundColor: "background.default",
|
|
34
36
|
opacity: 0.7,
|
|
35
37
|
zIndex: 1
|
|
36
|
-
},
|
|
38
|
+
}, ko = {
|
|
37
39
|
alignItems: "center",
|
|
38
40
|
alignSelf: "flex-start",
|
|
39
41
|
display: "flex",
|
|
@@ -41,54 +43,62 @@ var uo = {}, bo = {
|
|
|
41
43
|
height: 44,
|
|
42
44
|
px: 2,
|
|
43
45
|
textTransform: "none"
|
|
44
|
-
},
|
|
45
|
-
const I = j(), w =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
}, $o = po(({ beat: i, beatActions: n = yo, obsolete: u, isLoading: L = !1, isError: O = !1 }) => {
|
|
47
|
+
const I = j(), w = K(), { config: A } = U(), o = co(i, n), F = z(), { runCta: E, primary: k, secondary: x } = J(i, n, i.insights_payload?.primary_cta, i.insights_payload?.secondary_cta), c = i.insights_payload?.widget_type === "mini", M = mo(() => ({
|
|
48
|
+
...o.wrappedActions,
|
|
49
|
+
beat: i
|
|
50
|
+
}), [o.wrappedActions, i]);
|
|
51
|
+
if (O) return /* @__PURE__ */ t(Z, {});
|
|
52
|
+
const e = i.insights_payload;
|
|
53
|
+
if (!e || o.cardState === "dismissed") return null;
|
|
54
|
+
const { instance_slot: N, primary_cta: r, secondary_cta: s, sub_title: R, title: H, guid: _, dismissed_at: P } = e, { block: V } = N, G = R ?? (e.subtitle ? {
|
|
55
|
+
logo: Y(e.logo),
|
|
56
|
+
text: e.subtitle
|
|
57
|
+
} : void 0), d = (m) => W(m, A, n.onContactSupport), v = async (m, y) => {
|
|
58
|
+
if (!d(y.block)) {
|
|
59
|
+
if (y.block === $.CONTACT_SUPPORT_ACTION_BLOCK) {
|
|
60
|
+
q({
|
|
61
|
+
beat: i,
|
|
62
|
+
stores: F,
|
|
63
|
+
hostActions: n,
|
|
64
|
+
slot: m
|
|
65
|
+
}), n.onContactSupport?.();
|
|
56
66
|
return;
|
|
57
67
|
}
|
|
58
|
-
await
|
|
68
|
+
await E(m, y);
|
|
59
69
|
}
|
|
60
|
-
}, S =
|
|
61
|
-
return /* @__PURE__ */ t(
|
|
62
|
-
value:
|
|
63
|
-
children: /* @__PURE__ */
|
|
70
|
+
}, S = oo[V], a = e.in_description_cta, f = !c && a?.label && a.block ? a : void 0, b = r?.label ?? (f ? void 0 : a?.label), B = !c && !!r?.label, T = !c && !!s?.label, C = I.insights_feed?.general, h = u?.state === "not_refreshable" && !P && !!C;
|
|
71
|
+
return /* @__PURE__ */ t(X, {
|
|
72
|
+
value: M,
|
|
73
|
+
children: /* @__PURE__ */ l(g, {
|
|
64
74
|
sx: { mb: 16 },
|
|
65
75
|
children: [
|
|
66
|
-
o.cardState === "confirming" ? /* @__PURE__ */ t(
|
|
76
|
+
o.cardState === "confirming" ? /* @__PURE__ */ t(no, {
|
|
67
77
|
onClose: o.collapseConfirmation,
|
|
68
78
|
onLeaveFeedback: o.openHideSurvey,
|
|
69
79
|
onUndo: o.undoDismiss
|
|
70
|
-
}) : /* @__PURE__ */
|
|
71
|
-
...
|
|
72
|
-
copy:
|
|
73
|
-
}), /* @__PURE__ */
|
|
74
|
-
inert:
|
|
75
|
-
sx: { ...
|
|
80
|
+
}) : /* @__PURE__ */ l(bo, { children: [u && C && /* @__PURE__ */ t(ao, {
|
|
81
|
+
...u,
|
|
82
|
+
copy: C
|
|
83
|
+
}), /* @__PURE__ */ l(ho, {
|
|
84
|
+
inert: h,
|
|
85
|
+
sx: { ...h && {
|
|
76
86
|
position: "relative",
|
|
77
87
|
zIndex: 2,
|
|
78
88
|
pointerEvents: "none"
|
|
79
89
|
} },
|
|
80
90
|
children: [
|
|
81
|
-
|
|
82
|
-
/* @__PURE__ */ t(
|
|
83
|
-
isMini:
|
|
84
|
-
subtitle:
|
|
85
|
-
title:
|
|
91
|
+
h && /* @__PURE__ */ t(Co, { sx: go }),
|
|
92
|
+
/* @__PURE__ */ t(io, {
|
|
93
|
+
isMini: c,
|
|
94
|
+
subtitle: G,
|
|
95
|
+
title: H ?? ""
|
|
86
96
|
}),
|
|
87
|
-
L ? /* @__PURE__ */ t(
|
|
97
|
+
L ? /* @__PURE__ */ t(so, {}) : S && /* @__PURE__ */ t(S, {
|
|
88
98
|
beatGuid: _,
|
|
89
|
-
payload:
|
|
99
|
+
payload: e
|
|
90
100
|
}),
|
|
91
|
-
/* @__PURE__ */
|
|
101
|
+
/* @__PURE__ */ l(g, {
|
|
92
102
|
sx: {
|
|
93
103
|
gap: 6,
|
|
94
104
|
pb: 16,
|
|
@@ -96,11 +106,11 @@ var uo = {}, bo = {
|
|
|
96
106
|
px: 16
|
|
97
107
|
},
|
|
98
108
|
children: [
|
|
99
|
-
/* @__PURE__ */ t(
|
|
100
|
-
dangerouslySetInnerHTML: { __html:
|
|
109
|
+
/* @__PURE__ */ t(uo, {
|
|
110
|
+
dangerouslySetInnerHTML: { __html: e.description.html_text },
|
|
101
111
|
variant: "subtitle2"
|
|
102
112
|
}),
|
|
103
|
-
f && /* @__PURE__ */ t(
|
|
113
|
+
f && /* @__PURE__ */ t(p, {
|
|
104
114
|
endIcon: /* @__PURE__ */ t(D, {}),
|
|
105
115
|
onClick: () => w.openActionDrawer({
|
|
106
116
|
guid: _,
|
|
@@ -113,7 +123,7 @@ var uo = {}, bo = {
|
|
|
113
123
|
},
|
|
114
124
|
children: f.label
|
|
115
125
|
}),
|
|
116
|
-
!a?.label &&
|
|
126
|
+
!a?.label && i?.in_description_cta && /* @__PURE__ */ t(p, {
|
|
117
127
|
endIcon: /* @__PURE__ */ t(D, {}),
|
|
118
128
|
onClick: () => {
|
|
119
129
|
},
|
|
@@ -122,53 +132,53 @@ var uo = {}, bo = {
|
|
|
122
132
|
p: 4,
|
|
123
133
|
width: "max-content"
|
|
124
134
|
},
|
|
125
|
-
children:
|
|
135
|
+
children: i.in_description_cta
|
|
126
136
|
})
|
|
127
137
|
]
|
|
128
138
|
}),
|
|
129
|
-
(
|
|
139
|
+
(b || T) && /* @__PURE__ */ l(g, {
|
|
130
140
|
sx: {
|
|
131
141
|
gap: 8,
|
|
132
142
|
pb: 16,
|
|
133
143
|
px: 16
|
|
134
144
|
},
|
|
135
145
|
children: [
|
|
136
|
-
|
|
146
|
+
b && !B && /* @__PURE__ */ t(fo, {
|
|
137
147
|
color: "primary.main",
|
|
138
|
-
sx:
|
|
148
|
+
sx: ko,
|
|
139
149
|
variant: "button",
|
|
140
|
-
children:
|
|
150
|
+
children: b
|
|
141
151
|
}),
|
|
142
|
-
B && r && /* @__PURE__ */ t(
|
|
143
|
-
"aria-disabled":
|
|
152
|
+
B && r && /* @__PURE__ */ t(p, {
|
|
153
|
+
"aria-disabled": d(r.block) || k.disabled,
|
|
144
154
|
disabled: k.disabled,
|
|
145
155
|
onClick: () => v("primary", r),
|
|
146
|
-
sx: { ...
|
|
156
|
+
sx: { ...d(r.block) && { color: "text.disabled" } },
|
|
147
157
|
variant: "outlined",
|
|
148
158
|
children: r.label
|
|
149
159
|
}),
|
|
150
|
-
T &&
|
|
151
|
-
"aria-disabled":
|
|
160
|
+
T && s && /* @__PURE__ */ t(p, {
|
|
161
|
+
"aria-disabled": d(s.block) || x.disabled,
|
|
152
162
|
color: "secondary",
|
|
153
163
|
disabled: x.disabled,
|
|
154
|
-
onClick: () => v("secondary",
|
|
155
|
-
children:
|
|
164
|
+
onClick: () => v("secondary", s),
|
|
165
|
+
children: s.label
|
|
156
166
|
})
|
|
157
167
|
]
|
|
158
168
|
}),
|
|
159
|
-
/* @__PURE__ */ t(
|
|
169
|
+
/* @__PURE__ */ t(eo, {
|
|
160
170
|
onTellUsMore: o.openRatingSurvey,
|
|
161
171
|
show: o.isFeedbackBarShown
|
|
162
172
|
})
|
|
163
173
|
]
|
|
164
174
|
})] }),
|
|
165
|
-
/* @__PURE__ */ t(
|
|
166
|
-
/* @__PURE__ */ t(
|
|
175
|
+
/* @__PURE__ */ t(lo, { beat: i }),
|
|
176
|
+
/* @__PURE__ */ t(ro, {
|
|
167
177
|
isOpen: o.isDismissOpen,
|
|
168
178
|
onClose: o.closeDismissDialog,
|
|
169
179
|
onDismiss: o.confirmDismiss
|
|
170
180
|
}),
|
|
171
|
-
o.isSurveyOpen && /* @__PURE__ */ t(
|
|
181
|
+
o.isSurveyOpen && /* @__PURE__ */ t(Q, {
|
|
172
182
|
characterLimitLabel: o.survey.characterLimitLabel,
|
|
173
183
|
closeAriaLabel: o.survey.closeAriaLabel,
|
|
174
184
|
isOpen: !0,
|
|
@@ -181,13 +191,13 @@ var uo = {}, bo = {
|
|
|
181
191
|
secondaryText: o.survey.backText,
|
|
182
192
|
title: o.survey.title
|
|
183
193
|
}),
|
|
184
|
-
o.cardState === "visible" &&
|
|
194
|
+
o.cardState === "visible" && e.footer && /* @__PURE__ */ t(to, { footer: e.footer })
|
|
185
195
|
]
|
|
186
196
|
})
|
|
187
197
|
});
|
|
188
198
|
});
|
|
189
199
|
export {
|
|
190
|
-
|
|
200
|
+
$o as default
|
|
191
201
|
};
|
|
192
202
|
|
|
193
203
|
//# sourceMappingURL=BaseLayout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseLayout.es.js","names":[],"sources":["../../../src/insights-v2/components/BaseLayout.tsx"],"sourcesContent":["import { 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, Text } 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, useInsightsV2Store } from '../../common'\nimport type { Beat, PrimaryCTA, SecondaryCTA } from '../../core'\nimport { BeatActionsProvider, type BeatActions } from '../beatActions'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { 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 zIndex: 1,\n} as const\n\n// Figma (Mini | Large Transaction): a left-aligned link under the description. The 2px padding plus\n// the CTA row's 16 lines the label up with the description's 18. The label is not a Button, so it\n// carries the theme's MuiButton look itself: semi-bold, no uppercase (typography.button uppercases),\n// and the medium Button's 44px height with the text centred.\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 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 // 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 {\n instance_slot,\n primary_cta,\n secondary_cta,\n sub_title,\n title,\n widget_type,\n guid,\n dismissed_at,\n } = insights_payload\n const { block } = instance_slot\n\n // V1 sends `sub_title: { text, logo }`. The V2 envelope flattens it to a `subtitle` string\n // with the logo promoted to a payload-level `LogoRef` (an entity guid or a status icon), so\n // rebuild the shape `Header`/`SubHeader` already render. `sub_title` wins when a beat sends both.\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 // CTA presses go through the ctaActions runner (../ctaActions): a backend `action_key` runs\n // its step, a `block` opens its drawer, and a resolved message (backend `metadata`, else the\n // template's `ctaPostMessages` entry) is posted. `contact_support_block` bypasses the runner:\n // the help flow is host-supplied via `beatActions.onContactSupport`, disabled without 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 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 isMini = widget_type === 'mini'\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 with no primary_cta). 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 = primary_cta?.label ?? (envelopeLink ? undefined : inDescriptionCta?.label)\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={flow.wrappedActions}>\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 // Mini is a tap target, as in V1: the card, not this label, is the control. The label\n // is deliberately not a button, so a tap on it reaches the host's card handler (Pulse\n // posts `carousel/cta`, the same redirect a V1 mini card sends) instead of opening\n // the action drawer the full card's CTA opens.\n <Text color=\"primary.main\" sx={MINI_CTA_SX} variant=\"button\">\n {ctaLabel}\n </Text>\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":";;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,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,EACT,QAAQ;AACV,GAMM,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;AAC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kB;AAAA,kBAE1D,OAAM;AAAA,kBACN,UAAU,EAAkB;AAAA,kBAC5B,SAAA,MAAe,EAAW,aAAa,CAAa;AAAA,kBAEnD,UAAA,EAAc;AAAA,gBACT,CAAA;AAAA,cAEL;AAAA;YAGT,gBAAA,EAAC,IAAD;AAAA,cAAa,cAAc,EAAK;AAAA,cAAkB,MAAM,EAAK;AAAA,YAAqB,CAAA;AAAA,UAC9E;AAAA,QACN,CAAA,CAAA,EAAA,CAAA;AAAA,QAGJ,gBAAA,EAAC,IAAD,EAAwB,MAAA,EAAO,CAAA;AAAA,QAE/B,gBAAA,EAAC,IAAD;AAAA,UACE,QAAQ,EAAK;AAAA,UACb,SAAS,EAAK;AAAA,UACd,WAAW,EAAK;AAAA,QACjB,CAAA;AAAA,QAEA,EAAK,gBACJ,gBAAA,EAAC,GAAD;AAAA,UACE,qBAAqB,EAAK,OAAO;AAAA,UACjC,gBAAgB,EAAK,OAAO;AAAA,UAC5B,QAAQ;AAAA,UACR,aAAa,EAAK,wBAAwB;AAAA,UAC1C,SAAS,EAAK;AAAA,UACd,UAAU,EAAK;AAAA,UACf,kBAAkB,EAAK,wBAAwB;AAAA,UAC/C,SAAS,EAAK,OAAO;AAAA,UACrB,aAAa,EAAK,OAAO;AAAA,UACzB,eAAe,EAAK,OAAO;AAAA,UAC3B,OAAO,EAAK,OAAO;AAAA,QACpB,CAAA;AAAA,QAGF,EAAK,cAAc,aAAa,EAAiB,UAChD,gBAAA,EAAC,GAAD,EAAQ,QAAQ,EAAiB,OAAS,CAAA;AAAA,MAEvC;AAAA;EACY,CAAA;AAEzB,CACF"}
|
|
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, Text } 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 zIndex: 1,\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 with no primary_cta). 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 = primary_cta?.label ?? (envelopeLink ? undefined : inDescriptionCta?.label)\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 // Mini is a tap target, as in V1: the card, not this label, is the control. The label\n // is deliberately not a button, so a tap on it reaches the host's card handler (Pulse\n // posts `carousel/cta`, the same redirect a V1 mini card sends) instead of opening\n // the action drawer the full card's CTA opens.\n <Text color=\"primary.main\" sx={MINI_CTA_SX} variant=\"button\">\n {ctaLabel}\n </Text>\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,EACT,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,IAAW,EAAa,GAC1B,IAAO,GAAoB,GAAM,CAAW,GAE5C,IAAS,EAAe,GACxB,EACJ,QAAQ,GACR,SAAS,GACT,WAAW,EAAA,IACT,EACF,GACA,GACA,EAAK,kBAAkB,aACvB,EAAK,kBAAkB,aACzB,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