@mx-cartographer/experiences 9.7.42 → 9.7.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/core/types/InsightsInstanceSlotData.d.ts +3 -0
- package/dist/core/types/InsightsInstanceSlotData.es.js.map +1 -1
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +3 -0
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.d.ts +3 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js +85 -75
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +115 -93
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +3 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +66 -44
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js +49 -44
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js.map +1 -1
- package/dist/insights-v2/analytics/analyticsEventsConfig.d.ts +4 -0
- package/dist/insights-v2/analytics/analyticsEventsConfig.es.js +4 -0
- package/dist/insights-v2/analytics/analyticsEventsConfig.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.d.ts +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js +19 -19
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.d.ts +8 -1
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js +47 -31
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.d.ts +1 -5
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js +10 -6
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/components/SubTabs.d.ts +22 -0
- package/dist/insights-v2/components/SubTabs.es.js +38 -0
- package/dist/insights-v2/components/SubTabs.es.js.map +1 -0
- package/dist/insights-v2/components/chartblocks/ChartLegend.es.js +14 -18
- package/dist/insights-v2/components/chartblocks/ChartLegend.es.js.map +1 -1
- package/dist/insights-v2/components/chartblocks/DoubleBarChart.d.ts +5 -3
- package/dist/insights-v2/components/chartblocks/DoubleBarChart.es.js +108 -104
- package/dist/insights-v2/components/chartblocks/DoubleBarChart.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyticsEventsConfig.es.js","names":[],"sources":["../../../src/insights-v2/analytics/analyticsEventsConfig.ts"],"sourcesContent":["import type { Beat } from '../../core'\n\n// PascalCase template to label, ported from Pulse.\nexport const sentenceCaseTemplate = (template?: string | null): string =>\n template?.replace(/([A-Z]+)/g, ' $1')?.replace(/^ /, '') ?? ''\n\n// Fixed or beat-computed value.\ntype Resolvable = string | ((beat: Beat) => string)\n\n// Source of truth for insights-v2 analytics events. Mirrors Pulse's strings.\n// Entry has a Firefly half (action/category) and/or a postHog half.\nexport interface AnalyticsEventConfigEntry {\n category?: Resolvable\n action?: Resolvable\n /** Detail stored with the Firefly event, e.g. a survey reason. */\n value?: Resolvable\n postHog?: {\n eventName: string\n properties?: (beat: Beat) => Record<string, unknown>\n }\n}\n\nexport const ANALYTICS_EVENTS_CONFIG = {\n // Primary/secondary CTA click, fired via sendCtaAnalytics.\n PRIMARY_ACTION_SELECTED: {\n category: 'Beat Interaction',\n action: 'Primary Action Selected',\n },\n SECONDARY_ACTION_SELECTED: {\n category: 'Beat Interaction',\n action: 'Secondary Action Selected',\n },\n // Fires once, gated on !beat.cta_clicked_at.\n FIRST_TIME_PRIMARY_ACTION_SELECTED: {\n category: 'Beat Interaction',\n action: 'First Time Primary Action Selected',\n },\n\n // \"Not Interested\" survey submitted; the call site sets the picked reason as `value`.\n BEAT_DISMISSED: {\n category: 'Beat Interaction',\n action: 'Beat Dismissed',\n },\n\n // Bar click on the card's inline chart.\n CHART_BAR_CLICKED: {\n category: 'Beat Chart',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Bar Clicked`,\n },\n // Bar click inside the drill-down drawer.\n DRAWER_CHART_BAR_CLICKED: {\n category: 'Drawer Chart',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Bar Clicked`,\n },\n // Month/tab change inside the drill-down drawer.\n TAB_SELECTED: {\n category: 'Drawer Chart',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Month Tab Selected`,\n },\n\n // LowAccountBalance threshold dialog.\n EDIT_INSIGHT_THRESHOLD_SAVE: {\n category: 'User Configurable Settings',\n action: 'Edit Insight Threshold Save',\n },\n EDIT_INSIGHT_THRESHOLD_CANCELED: {\n category: 'User Configurable Settings',\n action: 'Edit Insight Threshold Canceled',\n },\n EDIT_INSIGHT_THRESHOLD_INPUT_SELECTED: {\n category: 'User Configurable Settings',\n action: 'Edit Insight Threshold Input Selected',\n },\n\n // SavingsOpportunityV2 safety-net dialog.\n EDIT_SAFETY_NET_SAVE: {\n category: 'Safety Net',\n action: 'Edit Safety Net',\n },\n // Ported verbatim from Pulse (uses '=' not '-').\n EDIT_SAFETY_NET_CANCEL: {\n category: 'Safety Net',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} = Edit Safety Net - Cancel`,\n },\n\n // Designate Emergency Savings Account (picker pick, Save, Open a Savings Account). Pulse's strings.\n EMERGENCY_SAVINGS_ACCT_SELECTED: {\n category: 'Emergency Savings',\n action: 'Designate Emergency Savings Account Selected',\n },\n EMERGENCY_SAVINGS_ACCT_SAVED: {\n category: 'Emergency Savings',\n action: 'Designate Emergency Savings Account Saved',\n },\n EMERGENCY_SAVINGS_ACCT_CREATED: {\n category: 'Emergency Savings',\n action: 'Designate Emergency Savings Account - Savings Account Created',\n },\n\n // Connect drawer opened. PostHog-only.\n OPENED_CONNECT_DRAWER: {\n postHog: {\n eventName: 'opened_connect_drawer',\n properties: (beat) => ({ beat_guid: beat.guid, template: beat.template }),\n },\n },\n} as const satisfies Record<string, AnalyticsEventConfigEntry>\n"],"mappings":"AAGA,IAAa,IAAA,CAAwB,MACnC,GAAU,QAAQ,aAAa,KAAK,GAAG,QAAQ,MAAM,EAAE,KAAK,IAkBjD,IAA0B;AAAA,EAErC,yBAAyB;AAAA,IACvB,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,2BAA2B;AAAA,IACzB,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAEA,oCAAoC;AAAA,IAClC,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAGA,gBAAgB;AAAA,IACd,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAGA,mBAAmB;AAAA,IACjB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAEA,0BAA0B;AAAA,IACxB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAEA,cAAc;AAAA,IACZ,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAGA,6BAA6B;AAAA,IAC3B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,iCAAiC;AAAA,IAC/B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,uCAAuC;AAAA,IACrC,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAGA,sBAAsB;AAAA,IACpB,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAEA,wBAAwB;AAAA,IACtB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAGA,iCAAiC;AAAA,IAC/B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,8BAA8B;AAAA,IAC5B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,gCAAgC;AAAA,IAC9B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAGA,uBAAuB,EACrB,SAAS;AAAA,IACP,WAAW;AAAA,IACX,YAAA,CAAa,OAAU;AAAA,MAAE,WAAW,EAAK;AAAA,MAAM,UAAU,EAAK;AAAA,IAAS;AAAA,EACzE,EACF;AACF"}
|
|
1
|
+
{"version":3,"file":"analyticsEventsConfig.es.js","names":[],"sources":["../../../src/insights-v2/analytics/analyticsEventsConfig.ts"],"sourcesContent":["import type { Beat } from '../../core'\n\n// PascalCase template to label, ported from Pulse.\nexport const sentenceCaseTemplate = (template?: string | null): string =>\n template?.replace(/([A-Z]+)/g, ' $1')?.replace(/^ /, '') ?? ''\n\n// Fixed or beat-computed value.\ntype Resolvable = string | ((beat: Beat) => string)\n\n// Source of truth for insights-v2 analytics events. Mirrors Pulse's strings.\n// Entry has a Firefly half (action/category) and/or a postHog half.\nexport interface AnalyticsEventConfigEntry {\n category?: Resolvable\n action?: Resolvable\n /** Detail stored with the Firefly event, e.g. a survey reason. */\n value?: Resolvable\n postHog?: {\n eventName: string\n properties?: (beat: Beat) => Record<string, unknown>\n }\n}\n\nexport const ANALYTICS_EVENTS_CONFIG = {\n // Primary/secondary CTA click, fired via sendCtaAnalytics.\n PRIMARY_ACTION_SELECTED: {\n category: 'Beat Interaction',\n action: 'Primary Action Selected',\n },\n SECONDARY_ACTION_SELECTED: {\n category: 'Beat Interaction',\n action: 'Secondary Action Selected',\n },\n // Fires once, gated on !beat.cta_clicked_at.\n FIRST_TIME_PRIMARY_ACTION_SELECTED: {\n category: 'Beat Interaction',\n action: 'First Time Primary Action Selected',\n },\n\n // \"Not Interested\" survey submitted; the call site sets the picked reason as `value`.\n BEAT_DISMISSED: {\n category: 'Beat Interaction',\n action: 'Beat Dismissed',\n },\n\n // Bar click on the card's inline chart.\n CHART_BAR_CLICKED: {\n category: 'Beat Chart',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Bar Clicked`,\n },\n // Bar click inside the drill-down drawer.\n DRAWER_CHART_BAR_CLICKED: {\n category: 'Drawer Chart',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Bar Clicked`,\n },\n // Month/tab change inside the drill-down drawer.\n TAB_SELECTED: {\n category: 'Drawer Chart',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Month Tab Selected`,\n },\n // Series (e.g. Spend / Income) tab change inside the double-bar drawer.\n TYPE_FILTER_SELECTED: {\n category: 'Transactions Filter',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Transactions Filtered By Type`,\n },\n\n // LowAccountBalance threshold dialog.\n EDIT_INSIGHT_THRESHOLD_SAVE: {\n category: 'User Configurable Settings',\n action: 'Edit Insight Threshold Save',\n },\n EDIT_INSIGHT_THRESHOLD_CANCELED: {\n category: 'User Configurable Settings',\n action: 'Edit Insight Threshold Canceled',\n },\n EDIT_INSIGHT_THRESHOLD_INPUT_SELECTED: {\n category: 'User Configurable Settings',\n action: 'Edit Insight Threshold Input Selected',\n },\n\n // SavingsOpportunityV2 safety-net dialog.\n EDIT_SAFETY_NET_SAVE: {\n category: 'Safety Net',\n action: 'Edit Safety Net',\n },\n // Ported verbatim from Pulse (uses '=' not '-').\n EDIT_SAFETY_NET_CANCEL: {\n category: 'Safety Net',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} = Edit Safety Net - Cancel`,\n },\n\n // Designate Emergency Savings Account (picker pick, Save, Open a Savings Account). Pulse's strings.\n EMERGENCY_SAVINGS_ACCT_SELECTED: {\n category: 'Emergency Savings',\n action: 'Designate Emergency Savings Account Selected',\n },\n EMERGENCY_SAVINGS_ACCT_SAVED: {\n category: 'Emergency Savings',\n action: 'Designate Emergency Savings Account Saved',\n },\n EMERGENCY_SAVINGS_ACCT_CREATED: {\n category: 'Emergency Savings',\n action: 'Designate Emergency Savings Account - Savings Account Created',\n },\n\n // Connect drawer opened. PostHog-only.\n OPENED_CONNECT_DRAWER: {\n postHog: {\n eventName: 'opened_connect_drawer',\n properties: (beat) => ({ beat_guid: beat.guid, template: beat.template }),\n },\n },\n} as const satisfies Record<string, AnalyticsEventConfigEntry>\n"],"mappings":"AAGA,IAAa,IAAA,CAAwB,MACnC,GAAU,QAAQ,aAAa,KAAK,GAAG,QAAQ,MAAM,EAAE,KAAK,IAkBjD,IAA0B;AAAA,EAErC,yBAAyB;AAAA,IACvB,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,2BAA2B;AAAA,IACzB,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAEA,oCAAoC;AAAA,IAClC,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAGA,gBAAgB;AAAA,IACd,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAGA,mBAAmB;AAAA,IACjB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAEA,0BAA0B;AAAA,IACxB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAEA,cAAc;AAAA,IACZ,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAEA,sBAAsB;AAAA,IACpB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAGA,6BAA6B;AAAA,IAC3B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,iCAAiC;AAAA,IAC/B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,uCAAuC;AAAA,IACrC,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAGA,sBAAsB;AAAA,IACpB,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAEA,wBAAwB;AAAA,IACtB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAGA,iCAAiC;AAAA,IAC/B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,8BAA8B;AAAA,IAC5B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,gCAAgC;AAAA,IAC9B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAGA,uBAAuB,EACrB,SAAS;AAAA,IACP,WAAW;AAAA,IACX,YAAA,CAAa,OAAU;AAAA,MAAE,WAAW,EAAK;AAAA,MAAM,UAAU,EAAK;AAAA,IAAS;AAAA,EACzE,EACF;AACF"}
|
|
@@ -5,4 +5,4 @@ import { BlockProps } from '../../types';
|
|
|
5
5
|
* DoubleBarChart and injects the card click behavior \u2014 open the shared drawer scoped to this beat
|
|
6
6
|
* (chartBarIndex = clicked column, tabIndex = clicked sub-series).
|
|
7
7
|
*/
|
|
8
|
-
export declare const DoubleBarChartBlock: ({ payload: { instance_slot,
|
|
8
|
+
export declare const DoubleBarChartBlock: ({ payload: { instance_slot, widget_type }, beatGuid, }: BlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { useInsightsV2Store as
|
|
2
|
-
import { actionBlocksKey as
|
|
3
|
-
import { DoubleBarChart as
|
|
4
|
-
import { buildComparisonSeries as
|
|
5
|
-
import { getLayoutConfig as
|
|
6
|
-
import { jsx as
|
|
7
|
-
import { useTheme as
|
|
8
|
-
var
|
|
9
|
-
const e =
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
-
bars:
|
|
12
|
-
colors:
|
|
1
|
+
import { useGlobalCopyStore as g, useInsightsV2Store as p } from "../../../../common/context/hooks.es.js";
|
|
2
|
+
import { actionBlocksKey as h } from "../../../mappings/actionBlocksKey.es.js";
|
|
3
|
+
import { DoubleBarChart as _ } from "../../../components/chartblocks/DoubleBarChart.es.js";
|
|
4
|
+
import { buildComparisonSeries as C, toLegendItems as b } from "./comparisonUtils.es.js";
|
|
5
|
+
import { getLayoutConfig as B } from "./layout.es.js";
|
|
6
|
+
import { jsx as I } from "react/jsx-runtime";
|
|
7
|
+
import { useTheme as x } from "@mui/material/styles";
|
|
8
|
+
var D = ({ payload: { instance_slot: o, widget_type: r }, beatGuid: t = "" }) => {
|
|
9
|
+
const e = x(), { openActionDrawer: a } = p(), n = g().insights_feed?.general?.in_month_you_had_a_category_of_amount, { variant: i } = o, { series: s, additional_data: m } = o.data ?? {}, c = C(s, n), l = b(m), d = B(e, i)?.color ?? [];
|
|
10
|
+
return /* @__PURE__ */ I(_, {
|
|
11
|
+
bars: c,
|
|
12
|
+
colors: d,
|
|
13
13
|
isMini: r === "mini",
|
|
14
|
-
legends:
|
|
15
|
-
onBarClick: (
|
|
14
|
+
legends: l,
|
|
15
|
+
onBarClick: (f, u) => {
|
|
16
16
|
if (r !== "full") return !1;
|
|
17
|
-
|
|
18
|
-
guid:
|
|
17
|
+
a({
|
|
18
|
+
guid: t,
|
|
19
19
|
trigger: "chartBar",
|
|
20
20
|
context: {
|
|
21
|
-
chartBarIndex:
|
|
21
|
+
chartBarIndex: f,
|
|
22
22
|
tabIndex: u,
|
|
23
|
-
block:
|
|
23
|
+
block: h.TRANSCATION_HISTORY_ACTION_BLOCK
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
export {
|
|
30
|
-
|
|
30
|
+
D as DoubleBarChartBlock
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
//# sourceMappingURL=DoubleBarChartBlock.es.js.map
|
package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DoubleBarChartBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.tsx"],"sourcesContent":["import { useTheme } from '@mui/material/styles'\n\nimport { useInsightsV2Store } from '../../../../common'\nimport type {
|
|
1
|
+
{"version":3,"file":"DoubleBarChartBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.tsx"],"sourcesContent":["import { useTheme } from '@mui/material/styles'\n\nimport { useGlobalCopyStore, useInsightsV2Store } from '../../../../common'\nimport type { DrilldownPayload } from '../../../../core'\nimport type { BarChartBlockData } from '../../../../core/types/InsightsInstanceSlotData'\nimport { DoubleBarChart } from '../../../components/chartblocks/DoubleBarChart'\n\nimport type { BlockProps } from '../../types'\n\nimport { buildComparisonSeries, toLegendItems } from './comparisonUtils'\nimport { getLayoutConfig } from './layout'\nimport { actionBlocksKey } from '../../../mappings/actionBlocksKey'\n\n/**\n * Card block for the double-bar chart. Mirrors BarchartBlock: it builds the shaped series\n * (buildComparisonSeries) and resolves the card palette (getLayoutConfig), then renders the reusable\n * DoubleBarChart and injects the card click behavior \\u2014 open the shared drawer scoped to this beat\n * (chartBarIndex = clicked column, tabIndex = clicked sub-series).\n */\nexport const DoubleBarChartBlock = ({\n payload: { instance_slot, widget_type },\n beatGuid = '',\n}: BlockProps) => {\n const theme = useTheme()\n const { openActionDrawer } = useInsightsV2Store()\n const ariaLabel =\n useGlobalCopyStore().insights_feed?.general?.in_month_you_had_a_category_of_amount\n const { variant } = instance_slot\n // The slots ditto fills on instance_slot.data, read as BarchartBlock reads them.\n const { series, additional_data } = (instance_slot.data ?? {}) as BarChartBlockData\n const bars = buildComparisonSeries(series, ariaLabel)\n const legendItems = toLegendItems(additional_data)\n // getLayoutConfig returns undefined for an unknown/unsupported variant; fall back to an empty\n // palette so an unregistered beat can't throw on mount.\n const colors = getLayoutConfig(theme, variant)?.color ?? []\n\n return (\n <DoubleBarChart\n bars={bars}\n colors={colors}\n isMini={widget_type === 'mini'}\n legends={legendItems}\n onBarClick={(columnIndex, subIndex) => {\n if (widget_type !== 'full') return false\n\n openActionDrawer({\n guid: beatGuid,\n trigger: 'chartBar',\n context: {\n chartBarIndex: columnIndex,\n tabIndex: subIndex,\n block: actionBlocksKey.TRANSCATION_HISTORY_ACTION_BLOCK,\n } satisfies DrilldownPayload,\n })\n }}\n />\n )\n}\n"],"mappings":";;;;;;;AAmBA,IAAa,IAAA,CAAuB,EAClC,SAAS,EAAE,eAAA,GAAe,aAAA,EAAA,GAC1B,UAAA,IAAW,GAAA,MACK;AAChB,QAAM,IAAQ,EAAS,GACjB,EAAE,kBAAA,EAAA,IAAqB,EAAmB,GAC1C,IACJ,EAAmB,EAAE,eAAe,SAAS,uCACzC,EAAE,SAAA,EAAA,IAAY,GAEd,EAAE,QAAA,GAAQ,iBAAA,EAAA,IAAqB,EAAc,QAAQ,CAAC,GACtD,IAAO,EAAsB,GAAQ,CAAS,GAC9C,IAAc,EAAc,CAAe,GAG3C,IAAS,EAAgB,GAAO,CAAO,GAAG,SAAS,CAAC;AAE1D,SACE,gBAAA,EAAC,GAAD;AAAA,IACQ,MAAA;AAAA,IACE,QAAA;AAAA,IACR,QAAQ,MAAgB;AAAA,IACxB,SAAS;AAAA,IACT,YAAA,CAAa,GAAa,MAAa;AACrC,UAAI,MAAgB,OAAQ,QAAO;AAEnC,MAAA,EAAiB;AAAA,QACf,MAAM;AAAA,QACN,SAAS;AAAA,QACT,SAAS;AAAA,UACP,eAAe;AAAA,UACf,UAAU;AAAA,UACV,OAAO,EAAgB;AAAA,QACzB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACD,CAAA;AAEL"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DataSeries } from '../../../../core';
|
|
2
|
-
import { DataSet } from '../../../../core/types/InsightsInstanceSlotData';
|
|
2
|
+
import { DataSet, LegendProps } from '../../../../core/types/InsightsInstanceSlotData';
|
|
3
|
+
export declare const COMPARISON_BAR_ARIA_LABEL = "_1{month}, _2{category}: _3{amount}";
|
|
3
4
|
/**
|
|
4
5
|
* Reshapes a flat comparison data_series into one shaped bar per month, sorted ascending by date —
|
|
5
6
|
* the double-bar equivalent of buildChartData. Each month has exactly two contiguous rows; the
|
|
@@ -7,3 +8,9 @@ import { DataSet } from '../../../../core/types/InsightsInstanceSlotData';
|
|
|
7
8
|
* Months are then sorted ascending so the chart's bar index and the axis line up.
|
|
8
9
|
*/
|
|
9
10
|
export declare const buildComparisonSeries: (data: DataSeries | undefined, ariaLabel?: string) => DataSet[];
|
|
11
|
+
/**
|
|
12
|
+
* The legend items from ditto's `additional_data` (`{ label, value, value_type }`, Insights 2.0): the
|
|
13
|
+
* amount formatted as currency. An item with no finite `value` (a beat stored before the totals were
|
|
14
|
+
* written, until its sample loads) keeps its label and shows no amount — never $0.00 or NaN.
|
|
15
|
+
*/
|
|
16
|
+
export declare const toLegendItems: (additionalData: unknown) => LegendProps[] | undefined;
|
|
@@ -1,43 +1,59 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import { DATE_FORMATS_INTL as
|
|
3
|
-
import { formatCurrency as
|
|
4
|
-
import { buildDataSeries as
|
|
5
|
-
import { parseISO as
|
|
6
|
-
import { isValid as
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
return Number.isFinite(
|
|
10
|
-
},
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
const
|
|
14
|
-
for (const t of
|
|
15
|
-
const
|
|
16
|
-
|
|
1
|
+
import { buildDynamicCopy as u } from "../../../../core/utils/Localization.es.js";
|
|
2
|
+
import { DATE_FORMATS_INTL as g, formatDate as c } from "../../../../core/constants/DateFormats.es.js";
|
|
3
|
+
import { formatCurrency as m } from "../../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import { buildDataSeries as A } from "../BarchartBlock/utils.es.js";
|
|
5
|
+
import { parseISO as d } from "date-fns/parseISO";
|
|
6
|
+
import { isValid as _ } from "date-fns/isValid";
|
|
7
|
+
var L = "income", v = (e) => String(e?.label ?? "").toLowerCase() === L, N = (e) => typeof e?.date == "string" && _(d(e.date)), h = "_1{month}, _2{category}: _3{amount}", p = (e) => String(e?.localized_label ?? e?.label ?? "").toLocaleLowerCase(), b = (e) => Array.isArray(e) ? e.filter((r) => typeof r == "string") : [], y = (e) => {
|
|
8
|
+
const r = typeof e == "number" ? e : Number(e);
|
|
9
|
+
return Number.isFinite(r) ? r : 0;
|
|
10
|
+
}, D = (e, r = h) => {
|
|
11
|
+
const n = A(e).filter(N);
|
|
12
|
+
if (n.length === 0) return [];
|
|
13
|
+
const s = /* @__PURE__ */ new Map();
|
|
14
|
+
for (const t of n) {
|
|
15
|
+
const a = String(t.date).slice(0, 7), o = s.get(a);
|
|
16
|
+
o ? o.push(t) : s.set(a, [t]);
|
|
17
17
|
}
|
|
18
|
-
const
|
|
19
|
-
return
|
|
20
|
-
const
|
|
18
|
+
const i = [...s.values()].filter((t) => t.length === 2);
|
|
19
|
+
return i.length === 0 ? [] : i.map((t) => {
|
|
20
|
+
const a = t.find(v) ?? t[t.length - 1];
|
|
21
21
|
return {
|
|
22
|
-
mainRow: t.find((
|
|
23
|
-
comparisonRow:
|
|
22
|
+
mainRow: t.find((o) => o !== a) ?? t[0],
|
|
23
|
+
comparisonRow: a
|
|
24
24
|
};
|
|
25
|
-
}).sort(({ mainRow: t }, { mainRow:
|
|
26
|
-
const
|
|
25
|
+
}).sort(({ mainRow: t }, { mainRow: a }) => d(t.date).getTime() - d(a.date).getTime()).map(({ mainRow: t, comparisonRow: a }) => {
|
|
26
|
+
const o = y(t.amount), l = y(a.amount), f = c(d(t.date), g.MONTH_LONG);
|
|
27
27
|
return {
|
|
28
|
-
ariaLabelMain:
|
|
29
|
-
ariaLabelComparison:
|
|
30
|
-
comparison:
|
|
28
|
+
ariaLabelMain: u(r, f, p(t), m(o, "0,0.00")),
|
|
29
|
+
ariaLabelComparison: u(r, f, p(a), m(l, "0,0.00")),
|
|
30
|
+
comparison: l,
|
|
31
|
+
comparisonGuids: b(a.aggregated_guids),
|
|
31
32
|
date: t.date,
|
|
32
|
-
formattedComparison:
|
|
33
|
-
formattedMain:
|
|
34
|
-
label:
|
|
35
|
-
main:
|
|
33
|
+
formattedComparison: m(l, "0,0"),
|
|
34
|
+
formattedMain: m(o, "0,0"),
|
|
35
|
+
label: c(d(t.date), g.MONTH_SHORT),
|
|
36
|
+
main: o,
|
|
37
|
+
mainGuids: b(t.aggregated_guids)
|
|
36
38
|
};
|
|
37
39
|
});
|
|
40
|
+
}, E = (e) => {
|
|
41
|
+
if (Array.isArray(e))
|
|
42
|
+
return e.filter((r) => typeof r?.label == "string" && r.label !== "").map(({ label: r, value: n, value_type: s }) => {
|
|
43
|
+
const i = Number.isFinite(n) ? n : void 0;
|
|
44
|
+
return {
|
|
45
|
+
label: r,
|
|
46
|
+
value_type: s,
|
|
47
|
+
value: i ?? 0,
|
|
48
|
+
amount: i ?? 0,
|
|
49
|
+
formattedAmount: i === void 0 ? "" : m(i, "0,0.00")
|
|
50
|
+
};
|
|
51
|
+
});
|
|
38
52
|
};
|
|
39
53
|
export {
|
|
40
|
-
|
|
54
|
+
h as COMPARISON_BAR_ARIA_LABEL,
|
|
55
|
+
D as buildComparisonSeries,
|
|
56
|
+
E as toLegendItems
|
|
41
57
|
};
|
|
42
58
|
|
|
43
59
|
//# sourceMappingURL=comparisonUtils.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comparisonUtils.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.ts"],"sourcesContent":["import { isValid } from 'date-fns/isValid'\nimport { parseISO } from 'date-fns/parseISO'\n\nimport { DATE_FORMATS_INTL, formatDate } from '../../../../core/constants'\nimport type { DataSeries } from '../../../../core'\nimport type { DataSet } from '../../../../core/types/InsightsInstanceSlotData'\nimport { buildDynamicCopy } from '../../../../core/utils/Localization'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport { buildDataSeries } from '../BarchartBlock/utils'\n\n// The comparison (second) series across every double-bar variant is Income (spend/savings/debt/\n// cost-of-living are all \"X to Income\"). `label` is the stable, non-localized category key, so we\n// key off it rather than row position — the wire lists income first within some months.\nconst INCOME_LABEL = 'income'\nconst isIncomeRow = (row: { label?: string }): boolean =>\n String(row?.label ?? '').toLowerCase() === INCOME_LABEL\n\n// A date-only wire string ('2026-03-01') is a valid ISO date; anything the backend sends that\n// parseISO can't turn into a real Date is dropped before it can poison the ascending sort with a\n// NaN comparator (which would scramble column order — and the chartBarIndex the card forwards to the\n// drilldown on click).\nconst hasValidDate = (row: { date?: string }): boolean =>\n typeof row?.date === 'string' && isValid(parseISO(row.date))\n\n//
|
|
1
|
+
{"version":3,"file":"comparisonUtils.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.ts"],"sourcesContent":["import { isValid } from 'date-fns/isValid'\nimport { parseISO } from 'date-fns/parseISO'\n\nimport { DATE_FORMATS_INTL, formatDate } from '../../../../core/constants'\nimport type { DataSeries } from '../../../../core'\nimport type { Legends } from '../../../../core'\nimport type { DataSet, LegendProps } from '../../../../core/types/InsightsInstanceSlotData'\nimport { buildDynamicCopy } from '../../../../core/utils/Localization'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport { buildDataSeries } from '../BarchartBlock/utils'\n\n// The comparison (second) series across every double-bar variant is Income (spend/savings/debt/\n// cost-of-living are all \"X to Income\"). `label` is the stable, non-localized category key, so we\n// key off it rather than row position — the wire lists income first within some months.\nconst INCOME_LABEL = 'income'\nconst isIncomeRow = (row: { label?: string }): boolean =>\n String(row?.label ?? '').toLowerCase() === INCOME_LABEL\n\n// A date-only wire string ('2026-03-01') is a valid ISO date; anything the backend sends that\n// parseISO can't turn into a real Date is dropped before it can poison the ascending sort with a\n// NaN comparator (which would scramble column order — and the chartBarIndex the card forwards to the\n// drilldown on click).\nconst hasValidDate = (row: { date?: string }): boolean =>\n typeof row?.date === 'string' && isValid(parseISO(row.date))\n\n// Fallback for insights_feed.general.in_month_you_had_a_category_of_amount (same slot order:\n// _1 month, _2 category, _3 amount). Used when the copy store hasn't loaded that key yet.\nexport const COMPARISON_BAR_ARIA_LABEL = '_1{month}, _2{category}: _3{amount}'\n\n// The series name shown to screen readers, lower-cased to match legacy pulse copy (\"...a spend of\").\n// `localized_label` is the backend's already-localized display name; `label` ('income'/'spend') is\n// an English-only fallback for dev/error scenarios.\nconst seriesName = (row: { localized_label?: string; label?: string }): string =>\n String(row?.localized_label ?? row?.label ?? '').toLocaleLowerCase()\n\n// `amount` is wire data and only loosely typed. `?? 0` guards a missing value but not a non-numeric\n// one (a stray string/null would render as NaN in the bar and the aria label), so coerce and fall\n// back to 0 unless the result is a finite number.\n// `aggregated_guids` is the row's transactions (wire data, loosely typed): keep the string guids only.\nconst toGuids = (value: unknown): string[] =>\n Array.isArray(value) ? value.filter((guid): guid is string => typeof guid === 'string') : []\n\nconst toAmount = (value: unknown): number => {\n const parsed = typeof value === 'number' ? value : Number(value)\n return Number.isFinite(parsed) ? parsed : 0\n}\n\n/**\n * Reshapes a flat comparison data_series into one shaped bar per month, sorted ascending by date —\n * the double-bar equivalent of buildChartData. Each month has exactly two contiguous rows; the\n * Income row becomes the comparison series and the other becomes main, regardless of wire order.\n * Months are then sorted ascending so the chart's bar index and the axis line up.\n */\nexport const buildComparisonSeries = (\n data: DataSeries | undefined,\n ariaLabel = COMPARISON_BAR_ARIA_LABEL,\n): DataSet[] => {\n // Guard the wire data before shaping it: `data_series` is type-asserted upstream, not validated, so\n // drop any row without a parseable date rather than let it flow into the sort/group logic.\n const flat = buildDataSeries(data).filter(hasValidDate)\n if (flat.length === 0) {\n return []\n }\n\n // Bucket rows by calendar month (YYYY-MM), not the exact date string, so a month whose rows carry\n // different day-of-month values (e.g. 2026-01-01 vs 2026-01-15) still groups into one bar rather\n // than two size-1 groups that are then dropped as malformed. First-seen order is preserved so the\n // ascending date sort below is stable.\n const byDate = new Map<string, any[]>()\n for (const row of flat) {\n const monthKey = String(row.date).slice(0, 7)\n const group = byDate.get(monthKey)\n if (group) group.push(row)\n else byDate.set(monthKey, [row])\n }\n\n // Keep only well-formed months (exactly one main + one comparison row). A month that lost a row to\n // the date guard above, or arrived malformed, is dropped on its own instead of blanking the whole\n // chart; return [] only when no valid month remains.\n const groups = [...byDate.values()].filter((group) => group.length === 2)\n if (groups.length === 0) {\n return []\n }\n\n return groups\n .map((group) => {\n // Income is always the comparison series; the remaining row is the main category. Fall back to\n // wire order (first = main, last = comparison) if no row is labeled income.\n const comparisonRow = group.find(isIncomeRow) ?? group[group.length - 1]\n const mainRow = group.find((row) => row !== comparisonRow) ?? group[0]\n return { mainRow, comparisonRow }\n })\n .sort(\n ({ mainRow: a }, { mainRow: b }) => parseISO(a.date).getTime() - parseISO(b.date).getTime(),\n )\n .map(({ mainRow, comparisonRow }) => {\n const main = toAmount(mainRow.amount)\n const comparison = toAmount(comparisonRow.amount)\n const monthLong = formatDate(parseISO(mainRow.date), DATE_FORMATS_INTL.MONTH_LONG)\n\n return {\n // Slots: _1 month, _2 series name, _3 amount (legacy in_month_you_had_a_category_of_amount).\n ariaLabelMain: buildDynamicCopy(\n ariaLabel,\n monthLong,\n seriesName(mainRow),\n formatCurrency(main, '0,0.00'),\n ) as string,\n ariaLabelComparison: buildDynamicCopy(\n ariaLabel,\n monthLong,\n seriesName(comparisonRow),\n formatCurrency(comparison, '0,0.00'),\n ) as string,\n comparison,\n // The bars' transactions, for the drawer's month x Spend / Income membership filter.\n comparisonGuids: toGuids(comparisonRow.aggregated_guids),\n date: mainRow.date,\n formattedComparison: formatCurrency(comparison, '0,0'),\n formattedMain: formatCurrency(main, '0,0'),\n label: formatDate(parseISO(mainRow.date), DATE_FORMATS_INTL.MONTH_SHORT),\n main,\n mainGuids: toGuids(mainRow.aggregated_guids),\n }\n })\n}\n\n/**\n * The legend items from ditto's `additional_data` (`{ label, value, value_type }`, Insights 2.0): the\n * amount formatted as currency. An item with no finite `value` (a beat stored before the totals were\n * written, until its sample loads) keeps its label and shows no amount — never $0.00 or NaN.\n */\nexport const toLegendItems = (additionalData: unknown): LegendProps[] | undefined => {\n if (!Array.isArray(additionalData)) return undefined\n\n return additionalData\n .filter((item): item is Legends => typeof item?.label === 'string' && item.label !== '')\n .map(({ label, value, value_type }): LegendProps => {\n // Number.isFinite also rejects a non-number value.\n const amount = Number.isFinite(value) ? value : undefined\n\n return {\n label,\n value_type,\n value: amount ?? 0,\n amount: amount ?? 0,\n formattedAmount: amount === undefined ? '' : formatCurrency(amount, '0,0.00'),\n }\n })\n}\n"],"mappings":"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"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
var a = (
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var a = (o) => ({ color: [o.palette.categories.billsUtilities, o.palette.chart.chart1] }), r = (o, t) => {
|
|
2
|
+
const c = {
|
|
3
|
+
SpendToIncome: a(o),
|
|
4
|
+
spend_to_income: a(o),
|
|
5
|
+
DebtToIncome: { color: [o.palette.chart.chart5, o.palette.chart.chart1] },
|
|
6
|
+
SavingsToIncome: { color: [o.palette.chartMono.chartMono5, o.palette.chartMono.chartMono3] }
|
|
7
|
+
};
|
|
8
|
+
return t && Object.hasOwn(c, t) ? c[t] : void 0;
|
|
9
|
+
};
|
|
6
10
|
export {
|
|
7
|
-
|
|
11
|
+
r as getLayoutConfig
|
|
8
12
|
};
|
|
9
13
|
|
|
10
14
|
//# sourceMappingURL=layout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles'\n\nexport const getLayoutConfig = (theme: Theme, variant?: string | null) => {\n const config = {\n SpendToIncome:
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles'\n\n// One palette per comparison; ditto's snake_case variant shares the legacy PascalCase entry's palette.\nconst spendToIncome = (theme: Theme) => ({\n color: [theme.palette.categories.billsUtilities, theme.palette.chart.chart1] as string[],\n})\n\nexport const getLayoutConfig = (theme: Theme, variant?: string | null) => {\n const config = {\n SpendToIncome: spendToIncome(theme),\n // Insights 2.0: ditto's layout variant for Monthly Spend to Income Comparison.\n spend_to_income: spendToIncome(theme),\n DebtToIncome: {\n color: [theme.palette.chart.chart5, theme.palette.chart.chart1] as string[],\n },\n SavingsToIncome: {\n color: [theme.palette.chartMono.chartMono5, theme.palette.chartMono.chartMono3] as string[],\n },\n }\n // Object.hasOwn: the variant is backend-controlled, and an inherited name like `constructor`\n // would otherwise return a truthy non-config.\n return variant && Object.hasOwn(config, variant)\n ? config[variant as keyof typeof config]\n : undefined\n}\n"],"mappings":"AAGA,IAAM,IAAA,CAAiB,OAAkB,EACvC,OAAO,CAAC,EAAM,QAAQ,WAAW,gBAAgB,EAAM,QAAQ,MAAM,MAAM,EAC7E,IAEa,IAAA,CAAmB,GAAc,MAA4B;AACxE,QAAM,IAAS;AAAA,IACb,eAAe,EAAc,CAAK;AAAA,IAElC,iBAAiB,EAAc,CAAK;AAAA,IACpC,cAAc,EACZ,OAAO,CAAC,EAAM,QAAQ,MAAM,QAAQ,EAAM,QAAQ,MAAM,MAAM,EAChE;AAAA,IACA,iBAAiB,EACf,OAAO,CAAC,EAAM,QAAQ,UAAU,YAAY,EAAM,QAAQ,UAAU,UAAU,EAChF;AAAA,EACF;AAGA,SAAO,KAAW,OAAO,OAAO,GAAQ,CAAO,IAC3C,EAAO,CAAA,IACP;AACN"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface SubTabItem {
|
|
2
|
+
label: string;
|
|
3
|
+
ariaLabel?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface SubTabsProps {
|
|
6
|
+
id: string;
|
|
7
|
+
tabs: SubTabItem[];
|
|
8
|
+
selectedIndex: number;
|
|
9
|
+
onChange: (index: number) => void;
|
|
10
|
+
ariaLabel?: string;
|
|
11
|
+
}
|
|
12
|
+
/** The tabpanel attributes for the content the sub-tabs control, labelled by the selected tab. */
|
|
13
|
+
export declare const subTabPanelProps: (id: string, selectedIndex: number) => {
|
|
14
|
+
'aria-labelledby': string;
|
|
15
|
+
id: string;
|
|
16
|
+
role: "tabpanel";
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The drill-down drawers' second tab row (e.g. Spend / Income). Fires pulse's
|
|
20
|
+
* "Transactions Filtered By Type" on a change, so every drawer that uses it keeps legacy analytics.
|
|
21
|
+
*/
|
|
22
|
+
export declare const SubTabs: ({ id, tabs, selectedIndex, onChange, ariaLabel }: SubTabsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ANALYTICS_EVENTS_CONFIG as u } from "../analytics/analyticsEventsConfig.es.js";
|
|
2
|
+
import { useAnalyticsEvent as T } from "../analytics/useAnalyticsEvent.es.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import v from "@mui/material/Tab";
|
|
5
|
+
import E from "@mui/material/Tabs";
|
|
6
|
+
var i = (a, l) => `${a}-tab-${l}`, o = (a) => `${a}-panel`, I = (a, l) => ({
|
|
7
|
+
"aria-labelledby": i(a, l),
|
|
8
|
+
id: o(a),
|
|
9
|
+
role: "tabpanel"
|
|
10
|
+
}), _ = ({ id: a, tabs: l, selectedIndex: t, onChange: b, ariaLabel: m }) => {
|
|
11
|
+
const p = T();
|
|
12
|
+
if (!l.length) return null;
|
|
13
|
+
const s = (r, e) => {
|
|
14
|
+
p(u.TYPE_FILTER_SELECTED), b(e);
|
|
15
|
+
};
|
|
16
|
+
return /* @__PURE__ */ n(E, {
|
|
17
|
+
"aria-label": m ?? l.map((r) => r.label).join(" / "),
|
|
18
|
+
onChange: s,
|
|
19
|
+
value: t,
|
|
20
|
+
variant: "fullWidth",
|
|
21
|
+
children: l.map((r, e) => /* @__PURE__ */ n(v, {
|
|
22
|
+
"aria-controls": o(a),
|
|
23
|
+
"aria-label": r.ariaLabel,
|
|
24
|
+
id: i(a, e),
|
|
25
|
+
label: r.label,
|
|
26
|
+
sx: {
|
|
27
|
+
minWidth: "auto",
|
|
28
|
+
px: 0
|
|
29
|
+
}
|
|
30
|
+
}, r.label))
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
_ as SubTabs,
|
|
35
|
+
I as subTabPanelProps
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=SubTabs.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubTabs.es.js","names":[],"sources":["../../../src/insights-v2/components/SubTabs.tsx"],"sourcesContent":["import type React from 'react'\n\nimport Tab from '@mui/material/Tab'\nimport Tabs from '@mui/material/Tabs'\n\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../analytics'\n\nexport interface SubTabItem {\n label: string\n // Screen-reader name when it differs from the visible label (legacy pulse: \"Spend transactions\").\n ariaLabel?: string\n}\n\nexport interface SubTabsProps {\n // Base id: tab N is `${id}-tab-N` and controls `${id}-panel`; render that panel with subTabPanelProps.\n id: string\n tabs: SubTabItem[]\n selectedIndex: number\n onChange: (index: number) => void\n // Tablist name; defaults to the visible labels joined (\"Spend / Income\").\n ariaLabel?: string\n}\n\nconst subTabId = (id: string, index: number) => `${id}-tab-${index}`\nconst subPanelId = (id: string) => `${id}-panel`\n\n/** The tabpanel attributes for the content the sub-tabs control, labelled by the selected tab. */\nexport const subTabPanelProps = (id: string, selectedIndex: number) => ({\n 'aria-labelledby': subTabId(id, selectedIndex),\n id: subPanelId(id),\n role: 'tabpanel' as const,\n})\n\n/**\n * The drill-down drawers' second tab row (e.g. Spend / Income). Fires pulse's\n * \"Transactions Filtered By Type\" on a change, so every drawer that uses it keeps legacy analytics.\n */\nexport const SubTabs = ({ id, tabs, selectedIndex, onChange, ariaLabel }: SubTabsProps) => {\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n if (!tabs.length) return null\n\n // MUI only calls onChange for a different tab, never on mount (legacy parity).\n const handleChange = (_event: React.SyntheticEvent, index: number) => {\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.TYPE_FILTER_SELECTED)\n onChange(index)\n }\n\n return (\n <Tabs\n aria-label={ariaLabel ?? tabs.map((tab) => tab.label).join(' / ')}\n onChange={handleChange}\n value={selectedIndex}\n variant=\"fullWidth\"\n >\n {tabs.map((tab, index) => (\n <Tab\n aria-controls={subPanelId(id)}\n aria-label={tab.ariaLabel}\n id={subTabId(id, index)}\n key={tab.label}\n label={tab.label}\n sx={{ minWidth: 'auto', px: 0 }}\n />\n ))}\n </Tabs>\n )\n}\n"],"mappings":";;;;;AAuBA,IAAM,IAAA,CAAY,GAAY,MAAkB,GAAG,CAAA,QAAU,CAAA,IACvD,IAAA,CAAc,MAAe,GAAG,CAAA,UAGzB,IAAA,CAAoB,GAAY,OAA2B;AAAA,EACtE,mBAAmB,EAAS,GAAI,CAAa;AAAA,EAC7C,IAAI,EAAW,CAAE;AAAA,EACjB,MAAM;AACR,IAMa,IAAA,CAAW,EAAE,IAAA,GAAI,MAAA,GAAM,eAAA,GAAe,UAAA,GAAU,WAAA,EAAA,MAA8B;AACzF,QAAM,IAAqB,EAAkB;AAE7C,MAAI,CAAC,EAAK,OAAQ,QAAO;AAGzB,QAAM,IAAA,CAAgB,GAA8B,MAAkB;AACpE,IAAA,EAAmB,EAAwB,oBAAoB,GAC/D,EAAS,CAAK;AAAA,EAChB;AAEA,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,cAAY,KAAa,EAAK,IAAA,CAAK,MAAQ,EAAI,KAAK,EAAE,KAAK,KAAK;AAAA,IAChE,UAAU;AAAA,IACV,OAAO;AAAA,IACP,SAAQ;AAAA,IAEP,UAAA,EAAK,IAAA,CAAK,GAAK,MACd,gBAAA,EAAC,GAAD;AAAA,MACE,iBAAe,EAAW,CAAE;AAAA,MAC5B,cAAY,EAAI;AAAA,MAChB,IAAI,EAAS,GAAI,CAAK;AAAA,MAEtB,OAAO,EAAI;AAAA,MACX,IAAI;AAAA,QAAE,UAAU;AAAA,QAAQ,IAAI;AAAA,MAAE;AAAA,IAC/B,GAHM,EAAI,KAGV,CACF;AAAA,EACG,CAAA;AAEV"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import n from "@mui/material/Stack";
|
|
2
|
-
import { Text as
|
|
3
|
-
import { jsx as
|
|
4
|
-
var
|
|
2
|
+
import { Text as c } from "@mxenabled/mxui";
|
|
3
|
+
import { jsx as e, jsxs as d } from "react/jsx-runtime";
|
|
4
|
+
var l = ({ legendItems: a, legendStyle: h }) => /* @__PURE__ */ e(n, {
|
|
5
5
|
sx: {
|
|
6
6
|
alignItems: "flex-start",
|
|
7
7
|
flexDirection: "row",
|
|
@@ -9,40 +9,36 @@ var f = ({ legendItems: h, legendStyle: o }) => /* @__PURE__ */ t(n, {
|
|
|
9
9
|
justifyContent: "flex-start",
|
|
10
10
|
py: 4,
|
|
11
11
|
width: "100%",
|
|
12
|
-
...
|
|
12
|
+
...h
|
|
13
13
|
},
|
|
14
|
-
children:
|
|
14
|
+
children: a.map(({ color: o, label: r, formattedAmount: i }, t) => r && /* @__PURE__ */ d(n, {
|
|
15
15
|
sx: {
|
|
16
16
|
alignItems: "center",
|
|
17
17
|
flexDirection: "row",
|
|
18
18
|
gap: 8
|
|
19
19
|
},
|
|
20
|
-
children: [/* @__PURE__ */
|
|
20
|
+
children: [/* @__PURE__ */ e("svg", {
|
|
21
21
|
"aria-hidden": "true",
|
|
22
|
-
"aria-labelledby":
|
|
22
|
+
"aria-labelledby": t === 0 ? "chartLegendLabel" : r,
|
|
23
23
|
fill: "none",
|
|
24
24
|
height: "12",
|
|
25
25
|
role: "figure",
|
|
26
26
|
width: "12",
|
|
27
|
-
children: /* @__PURE__ */
|
|
28
|
-
fill:
|
|
27
|
+
children: /* @__PURE__ */ e("rect", {
|
|
28
|
+
fill: o,
|
|
29
29
|
height: "12",
|
|
30
30
|
rx: "2",
|
|
31
31
|
width: "12"
|
|
32
32
|
})
|
|
33
|
-
}), /* @__PURE__ */
|
|
34
|
-
id:
|
|
33
|
+
}), /* @__PURE__ */ e(c, {
|
|
34
|
+
id: t === 0 ? "chartLegendLabel" : r,
|
|
35
35
|
variant: "caption",
|
|
36
|
-
children:
|
|
37
|
-
r,
|
|
38
|
-
" ",
|
|
39
|
-
i ? `: ${i}` : ""
|
|
40
|
-
]
|
|
36
|
+
children: i ? `${r}: ${i}` : r
|
|
41
37
|
})]
|
|
42
|
-
}, r ??
|
|
38
|
+
}, r ?? t))
|
|
43
39
|
});
|
|
44
40
|
export {
|
|
45
|
-
|
|
41
|
+
l as Legend
|
|
46
42
|
};
|
|
47
43
|
|
|
48
44
|
//# sourceMappingURL=ChartLegend.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartLegend.es.js","names":[],"sources":["../../../../src/insights-v2/components/chartblocks/ChartLegend.tsx"],"sourcesContent":["import { Text } from '@mxenabled/mxui'\n\nimport Stack from '@mui/material/Stack'\n\nimport type { SxProps } from '@mui/material/styles'\nimport type { LegendProps } from '../../../core/types/InsightsInstanceSlotData'\n\nexport interface LegendComponentProps {\n legendItems: LegendProps[]\n legendStyle?: SxProps\n}\n\nexport const Legend = ({ legendItems, legendStyle }: LegendComponentProps) => {\n return (\n <Stack\n sx={{\n alignItems: 'flex-start',\n flexDirection: 'row',\n gap: 24,\n justifyContent: 'flex-start',\n py: 4,\n width: '100%',\n ...legendStyle,\n }}\n >\n {legendItems.map(\n ({ color, label, formattedAmount }, index) =>\n label && (\n <Stack key={label ?? index} sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n <svg\n aria-hidden=\"true\"\n aria-labelledby={index === 0 ? 'chartLegendLabel' : label}\n fill=\"none\"\n height=\"12\"\n role=\"figure\"\n width=\"12\"\n >\n <rect fill={color} height=\"12\" rx=\"2\" width=\"12\" />\n </svg>\n <Text id={index === 0 ? 'chartLegendLabel' : label} variant=\"caption\">\n {
|
|
1
|
+
{"version":3,"file":"ChartLegend.es.js","names":[],"sources":["../../../../src/insights-v2/components/chartblocks/ChartLegend.tsx"],"sourcesContent":["import { Text } from '@mxenabled/mxui'\n\nimport Stack from '@mui/material/Stack'\n\nimport type { SxProps } from '@mui/material/styles'\nimport type { LegendProps } from '../../../core/types/InsightsInstanceSlotData'\n\nexport interface LegendComponentProps {\n legendItems: LegendProps[]\n legendStyle?: SxProps\n}\n\nexport const Legend = ({ legendItems, legendStyle }: LegendComponentProps) => {\n return (\n <Stack\n sx={{\n alignItems: 'flex-start',\n flexDirection: 'row',\n gap: 24,\n justifyContent: 'flex-start',\n py: 4,\n width: '100%',\n ...legendStyle,\n }}\n >\n {legendItems.map(\n ({ color, label, formattedAmount }, index) =>\n label && (\n <Stack key={label ?? index} sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n <svg\n aria-hidden=\"true\"\n aria-labelledby={index === 0 ? 'chartLegendLabel' : label}\n fill=\"none\"\n height=\"12\"\n role=\"figure\"\n width=\"12\"\n >\n <rect fill={color} height=\"12\" rx=\"2\" width=\"12\" />\n </svg>\n <Text id={index === 0 ? 'chartLegendLabel' : label} variant=\"caption\">\n {formattedAmount ? `${label}: ${formattedAmount}` : label}\n </Text>\n </Stack>\n ),\n )}\n </Stack>\n )\n}\n"],"mappings":";;;AAYA,IAAa,IAAA,CAAU,EAAE,aAAA,GAAa,aAAA,EAAA,MAElC,gBAAA,EAAC,GAAD;AAAA,EACE,IAAI;AAAA,IACF,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,KAAK;AAAA,IACL,gBAAgB;AAAA,IAChB,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,GAAG;AAAA,EACL;AAAA,EAEC,UAAA,EAAY,IAAA,CACV,EAAE,OAAA,GAAO,OAAA,GAAO,iBAAA,EAAA,GAAmB,MAClC,KACE,gBAAA,EAAC,GAAD;AAAA,IAA4B,IAAI;AAAA,MAAE,YAAY;AAAA,MAAU,eAAe;AAAA,MAAO,KAAK;AAAA,IAAE;AAAA,IAArF,UAAA,CACE,gBAAA,EAAC,OAAD;AAAA,MACE,eAAY;AAAA,MACZ,mBAAiB,MAAU,IAAI,qBAAqB;AAAA,MACpD,MAAK;AAAA,MACL,QAAO;AAAA,MACP,MAAK;AAAA,MACL,OAAM;AAAA,MAEN,UAAA,gBAAA,EAAC,QAAD;AAAA,QAAM,MAAM;AAAA,QAAO,QAAO;AAAA,QAAK,IAAG;AAAA,QAAI,OAAM;AAAA,MAAM,CAAA;AAAA,IAC/C,CAAA,GACL,gBAAA,EAAC,GAAD;AAAA,MAAM,IAAI,MAAU,IAAI,qBAAqB;AAAA,MAAO,SAAQ;AAAA,MACzD,UAAA,IAAkB,GAAG,CAAA,KAAU,CAAA,KAAoB;AAAA,IAChD,CAAA,CACD;AAAA,EAdK,GAAA,KAAS,CAcd,CAEb;AACK,CAAA"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Legends } from '../../../core';
|
|
2
|
-
import { DataSet
|
|
2
|
+
import { DataSet } from '../../../core/types/InsightsInstanceSlotData';
|
|
3
3
|
interface DoubleBarChartProps {
|
|
4
4
|
bars: DataSet[];
|
|
5
5
|
colors: string[];
|
|
6
|
-
legends?:
|
|
6
|
+
legends?: Legends[];
|
|
7
7
|
isMini?: boolean;
|
|
8
|
+
legendPosition?: 'top' | 'bottom';
|
|
9
|
+
selectedIndex?: number;
|
|
8
10
|
onBarClick: (columnIndex: number, subIndex: number) => void;
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
@@ -13,5 +15,5 @@ interface DoubleBarChartProps {
|
|
|
13
15
|
* selection, or data-shaping of its own. This mirrors BarChartV2; the DoubleBarChartBlock card
|
|
14
16
|
* wrapper builds the data and injects the store behavior, exactly as BarchartBlock wraps BarChartV2.
|
|
15
17
|
*/
|
|
16
|
-
export declare const DoubleBarChart: ({ bars, colors, legends, isMini, onBarClick, }: DoubleBarChartProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare const DoubleBarChart: ({ bars, colors, legends, isMini, legendPosition, selectedIndex, onBarClick, }: DoubleBarChartProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
19
|
export {};
|