@mx-cartographer/experiences 9.4.58 → 9.4.60
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 +42 -1
- package/dist/core/api/BeatApi.d.ts +6 -0
- package/dist/core/api/BeatApi.es.js +1 -1
- package/dist/core/api/BeatApi.es.js.map +1 -1
- package/dist/core/api/UserApi.d.ts +2 -1
- package/dist/core/api/UserApi.es.js +6 -5
- package/dist/core/api/UserApi.es.js.map +1 -1
- package/dist/core/constants/ApiEndpoints.d.ts +1 -0
- package/dist/core/constants/ApiEndpoints.es.js +1 -0
- package/dist/core/constants/ApiEndpoints.es.js.map +1 -1
- package/dist/core/stores/AccountStore.d.ts +2 -1
- package/dist/core/stores/AccountStore.es.js +16 -16
- package/dist/core/stores/AccountStore.es.js.map +1 -1
- package/dist/core/stores/BeatStore.d.ts +6 -0
- package/dist/core/stores/BeatStore.es.js +30 -17
- package/dist/core/stores/BeatStore.es.js.map +1 -1
- package/dist/core/stores/BudgetsStore.d.ts +2 -1
- package/dist/core/stores/BudgetsStore.es.js +8 -8
- package/dist/core/stores/BudgetsStore.es.js.map +1 -1
- package/dist/core/stores/CategoryStore.d.ts +7 -0
- package/dist/core/stores/CategoryStore.es.js +18 -7
- package/dist/core/stores/CategoryStore.es.js.map +1 -1
- package/dist/core/stores/InsightsV2Store.es.js.map +1 -1
- package/dist/core/stores/SettingsStore.d.ts +2 -1
- package/dist/core/stores/SettingsStore.es.js +11 -11
- package/dist/core/stores/SettingsStore.es.js.map +1 -1
- package/dist/core/stores/TransactionStore.d.ts +4 -2
- package/dist/core/stores/TransactionStore.es.js +6 -6
- package/dist/core/stores/TransactionStore.es.js.map +1 -1
- package/dist/core/stores/UserStore.d.ts +15 -1
- package/dist/core/stores/UserStore.es.js +21 -3
- package/dist/core/stores/UserStore.es.js.map +1 -1
- package/dist/core/types/Beat.d.ts +6 -0
- package/dist/core/types/Beat.es.js.map +1 -1
- package/dist/core/types/Insights.d.ts +127 -5
- package/dist/core/types/InsightsInstanceSlotData.d.ts +1 -13
- package/dist/core/types/InsightsInstanceSlotData.es.js.map +1 -1
- package/dist/core/types/RepeatingTransaction.d.ts +2 -0
- package/dist/core/types/RepeatingTransaction.es.js.map +1 -1
- package/dist/core/types/User.d.ts +11 -0
- package/dist/core/types/index.d.ts +2 -3
- package/dist/insights-v2/actionBlocks/ContactSupportActionBlock.d.ts +31 -0
- package/dist/insights-v2/actionBlocks/ContactSupportActionBlock.es.js +22 -0
- package/dist/insights-v2/actionBlocks/ContactSupportActionBlock.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.d.ts +10 -9
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.es.js +7 -7
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.es.js.map +1 -1
- package/dist/insights-v2/beatActions.d.ts +7 -0
- package/dist/insights-v2/beatActions.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js +8 -8
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.d.ts +30 -3
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +67 -24
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/index.d.ts +1 -1
- package/dist/insights-v2/components/BadgedTile.d.ts +22 -0
- package/dist/insights-v2/components/BadgedTile.es.js +46 -0
- package/dist/insights-v2/components/BadgedTile.es.js.map +1 -0
- package/dist/insights-v2/components/BaseLayout.es.js +113 -92
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/components/CompactInsightCard.d.ts +31 -0
- package/dist/insights-v2/components/CompactInsightCard.es.js +129 -0
- package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -0
- package/dist/insights-v2/components/Footer.d.ts +1 -4
- package/dist/insights-v2/components/Footer.es.js +30 -21
- package/dist/insights-v2/components/Footer.es.js.map +1 -1
- package/dist/insights-v2/components/Header.es.js +10 -10
- package/dist/insights-v2/components/Header.es.js.map +1 -1
- package/dist/insights-v2/components/InsightErrorCard.d.ts +19 -0
- package/dist/insights-v2/components/InsightErrorCard.es.js +45 -0
- package/dist/insights-v2/components/InsightErrorCard.es.js.map +1 -0
- package/dist/insights-v2/components/InsightTransactionRow.es.js +19 -15
- package/dist/insights-v2/components/InsightTransactionRow.es.js.map +1 -1
- package/dist/insights-v2/components/LogoFromGuid.d.ts +26 -0
- package/dist/insights-v2/components/LogoFromGuid.es.js +48 -0
- package/dist/insights-v2/components/LogoFromGuid.es.js.map +1 -0
- package/dist/insights-v2/components/StatusBadge.d.ts +16 -0
- package/dist/insights-v2/components/StatusBadge.es.js +29 -0
- package/dist/insights-v2/components/StatusBadge.es.js.map +1 -0
- package/dist/insights-v2/components/StatusPill.d.ts +11 -2
- package/dist/insights-v2/components/StatusPill.es.js +25 -13
- package/dist/insights-v2/components/StatusPill.es.js.map +1 -1
- package/dist/insights-v2/components/SubHeader.es.js +7 -5
- package/dist/insights-v2/components/SubHeader.es.js.map +1 -1
- package/dist/insights-v2/components/TransactionListCard.es.js +11 -11
- package/dist/insights-v2/components/TransactionListCard.es.js.map +1 -1
- package/dist/insights-v2/components/shared/EntityLogo.d.ts +26 -0
- package/dist/insights-v2/components/shared/EntityLogo.es.js +33 -0
- package/dist/insights-v2/components/shared/EntityLogo.es.js.map +1 -0
- package/dist/insights-v2/index.d.ts +6 -0
- package/dist/insights-v2/index.es.js +95 -81
- package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js +2 -1
- package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
- package/dist/insights-v2/mappings/blocks.es.js +50 -44
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/dist/insights-v2/resolveInsightRender.d.ts +30 -0
- package/dist/insights-v2/resolveInsightRender.es.js +10 -0
- package/dist/insights-v2/resolveInsightRender.es.js.map +1 -0
- package/dist/microinsights/cards/InsightCard.es.js +83 -39
- package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
- package/dist/microinsights/carousel/BeatList.es.js +24 -24
- package/dist/microinsights/carousel/BeatList.es.js.map +1 -1
- package/dist/notifications/components/NotificationBadge.es.js +12 -10
- package/dist/notifications/components/NotificationBadge.es.js.map +1 -1
- package/dist/notifications/components/NotificationCard.es.js +27 -18
- package/dist/notifications/components/NotificationCard.es.js.map +1 -1
- package/dist/transactions/components/shared/TransactionDetails.d.ts +7 -0
- package/dist/transactions/components/shared/TransactionDetails.es.js +159 -143
- package/dist/transactions/components/shared/TransactionDetails.es.js.map +1 -1
- package/dist/transactions/components/shared/TransactionInsightTag.d.ts +26 -0
- package/dist/transactions/components/shared/TransactionInsightTag.es.js +53 -0
- package/dist/transactions/components/shared/TransactionInsightTag.es.js.map +1 -0
- package/dist/transactions/components/shared/transactionlist/TransactionRow.es.js +30 -39
- package/dist/transactions/components/shared/transactionlist/TransactionRow.es.js.map +1 -1
- package/dist/transactions/components/shared/transactiontable/cells/AmountCell.es.js +15 -15
- package/dist/transactions/components/shared/transactiontable/cells/AmountCell.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Logo, LogoRef } from '../../../core';
|
|
2
|
+
/**
|
|
3
|
+
* The V2 beat envelope (LargeTransactionV2 onward) sends an entity logo as an opaque guid instead
|
|
4
|
+
* of V1's named `institution_guid` / `merchant_guid` / `category_guid` fields. The entity is
|
|
5
|
+
* carried only by the guid's prefix, so this maps a guid back onto the named `Logo` shape the
|
|
6
|
+
* existing renderers (`SubHeader`, mxui logo components) already understand.
|
|
7
|
+
*
|
|
8
|
+
* An unrecognized prefix returns `undefined` rather than guessing: rendering a merchant logo for
|
|
9
|
+
* an institution guid would silently show the wrong image.
|
|
10
|
+
*/
|
|
11
|
+
export declare const logoFromEntityGuid: (guid?: string, alt?: string) => Logo | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Resolves a V2 `LogoRef` (header or row) onto the named `Logo` shape. The one mapping both the
|
|
14
|
+
* header and the rows go through, so the two can never disagree about precedence:
|
|
15
|
+
*
|
|
16
|
+
* - `icon` becomes V1's `logo_name` / `logo_color` and wins over `guid`, as `logo_name` does in
|
|
17
|
+
* `SubHeader`.
|
|
18
|
+
* - Otherwise `guid` resolves by prefix (`logoFromEntityGuid`). For an `MCH-` guid, a `CAT-`
|
|
19
|
+
* `fallback_guid` becomes the merchant's `category_guid`: `MerchantLogo` draws that category as a
|
|
20
|
+
* tile when the merchant image fails to load, and without it the tile is the Uncategorized icon.
|
|
21
|
+
* Only a category fallback is applied, because a category tile is the only fallback
|
|
22
|
+
* `MerchantLogo` has.
|
|
23
|
+
*
|
|
24
|
+
* `fallbackAlt` names the logo when the ref carries no `alt` (rows pass their `primary_text`).
|
|
25
|
+
*/
|
|
26
|
+
export declare const logoFromRef: (ref?: LogoRef, fallbackAlt?: string) => Logo | undefined;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var i = (t, o) => {
|
|
2
|
+
if (t) {
|
|
3
|
+
if (t.startsWith("INS-")) return {
|
|
4
|
+
institution_guid: t,
|
|
5
|
+
institution_name: o
|
|
6
|
+
};
|
|
7
|
+
if (t.startsWith("MCH-")) return {
|
|
8
|
+
merchant_guid: t,
|
|
9
|
+
merchant_name: o
|
|
10
|
+
};
|
|
11
|
+
if (t.startsWith("CAT-")) return {
|
|
12
|
+
category_guid: t,
|
|
13
|
+
category_name: o
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}, n = (t, o) => {
|
|
17
|
+
if (!t) return;
|
|
18
|
+
if (t.icon) return {
|
|
19
|
+
logo_color: t.color,
|
|
20
|
+
logo_name: t.icon
|
|
21
|
+
};
|
|
22
|
+
const r = i(t.guid, t.alt ?? o);
|
|
23
|
+
return r?.merchant_guid && t.fallback_guid?.startsWith("CAT-") ? {
|
|
24
|
+
...r,
|
|
25
|
+
category_guid: t.fallback_guid
|
|
26
|
+
} : r;
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
i as logoFromEntityGuid,
|
|
30
|
+
n as logoFromRef
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=EntityLogo.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityLogo.es.js","names":[],"sources":["../../../../src/insights-v2/components/shared/EntityLogo.tsx"],"sourcesContent":["import type { Logo, LogoRef } from '../../../core'\n\n/**\n * The V2 beat envelope (LargeTransactionV2 onward) sends an entity logo as an opaque guid instead\n * of V1's named `institution_guid` / `merchant_guid` / `category_guid` fields. The entity is\n * carried only by the guid's prefix, so this maps a guid back onto the named `Logo` shape the\n * existing renderers (`SubHeader`, mxui logo components) already understand.\n *\n * An unrecognized prefix returns `undefined` rather than guessing: rendering a merchant logo for\n * an institution guid would silently show the wrong image.\n */\nexport const logoFromEntityGuid = (guid?: string, alt?: string): Logo | undefined => {\n if (!guid) return undefined\n\n if (guid.startsWith('INS-')) {\n return { institution_guid: guid, institution_name: alt }\n }\n\n if (guid.startsWith('MCH-')) {\n return { merchant_guid: guid, merchant_name: alt }\n }\n\n if (guid.startsWith('CAT-')) {\n return { category_guid: guid, category_name: alt }\n }\n\n return undefined\n}\n\n/**\n * Resolves a V2 `LogoRef` (header or row) onto the named `Logo` shape. The one mapping both the\n * header and the rows go through, so the two can never disagree about precedence:\n *\n * - `icon` becomes V1's `logo_name` / `logo_color` and wins over `guid`, as `logo_name` does in\n * `SubHeader`.\n * - Otherwise `guid` resolves by prefix (`logoFromEntityGuid`). For an `MCH-` guid, a `CAT-`\n * `fallback_guid` becomes the merchant's `category_guid`: `MerchantLogo` draws that category as a\n * tile when the merchant image fails to load, and without it the tile is the Uncategorized icon.\n * Only a category fallback is applied, because a category tile is the only fallback\n * `MerchantLogo` has.\n *\n * `fallbackAlt` names the logo when the ref carries no `alt` (rows pass their `primary_text`).\n */\nexport const logoFromRef = (ref?: LogoRef, fallbackAlt?: string): Logo | undefined => {\n if (!ref) return undefined\n\n if (ref.icon) {\n return { logo_color: ref.color, logo_name: ref.icon }\n }\n\n const logo = logoFromEntityGuid(ref.guid, ref.alt ?? fallbackAlt)\n\n if (logo?.merchant_guid && ref.fallback_guid?.startsWith('CAT-')) {\n return { ...logo, category_guid: ref.fallback_guid }\n }\n\n return logo\n}\n"],"mappings":"AAWA,IAAa,IAAA,CAAsB,GAAe,MAAmC;AACnF,MAAK,GAEL;AAAA,QAAI,EAAK,WAAW,MAAM,EACxB,QAAO;AAAA,MAAE,kBAAkB;AAAA,MAAM,kBAAkB;AAAA,IAAI;AAGzD,QAAI,EAAK,WAAW,MAAM,EACxB,QAAO;AAAA,MAAE,eAAe;AAAA,MAAM,eAAe;AAAA,IAAI;AAGnD,QAAI,EAAK,WAAW,MAAM,EACxB,QAAO;AAAA,MAAE,eAAe;AAAA,MAAM,eAAe;AAAA,IAAI;AAAA;AAIrD,GAgBa,IAAA,CAAe,GAAe,MAA2C;AACpF,MAAI,CAAC,EAAK;AAEV,MAAI,EAAI,KACN,QAAO;AAAA,IAAE,YAAY,EAAI;AAAA,IAAO,WAAW,EAAI;AAAA,EAAK;AAGtD,QAAM,IAAO,EAAmB,EAAI,MAAM,EAAI,OAAO,CAAW;AAEhE,SAAI,GAAM,iBAAiB,EAAI,eAAe,WAAW,MAAM,IACtD;AAAA,IAAE,GAAG;AAAA,IAAM,eAAe,EAAI;AAAA,EAAc,IAG9C;AACT"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
export * from './blocks';
|
|
2
2
|
export { default as AccountHeroCard } from './components/AccountHeroCard';
|
|
3
3
|
export { default as AmountPill } from './components/AmountPill';
|
|
4
|
+
export { default as BadgedTile } from './components/BadgedTile';
|
|
5
|
+
export { default as StatusBadge, type StatusTone } from './components/StatusBadge';
|
|
4
6
|
export { default as DesignateEmergencySavingsCard, type DesignateEmergencySavingsOption, } from './components/DesignateEmergencySavingsCard';
|
|
5
7
|
export { default as BaseLayout } from './components/BaseLayout';
|
|
8
|
+
export { default as CompactInsightCard, type CompactInsightCardProps, } from './components/CompactInsightCard';
|
|
9
|
+
export { default as InsightErrorCard, type InsightErrorCardProps, } from './components/InsightErrorCard';
|
|
10
|
+
export { default as LogoFromGuid, isLogoGuid, type LogoFromGuidProps, } from './components/LogoFromGuid';
|
|
11
|
+
export { resolveInsightRender, type InsightRender } from './resolveInsightRender';
|
|
6
12
|
export { default as ErrorCard, type ErrorCardProps } from './components/ErrorCard';
|
|
7
13
|
export { default as LoadingCard } from './components/LoadingCard';
|
|
8
14
|
export { default as StatusMessageCard } from './components/StatusMessageCard';
|
|
@@ -1,83 +1,97 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import L from "./
|
|
12
|
-
import v from "./blocks/
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
1
|
+
import o from "./components/StatusPill.es.js";
|
|
2
|
+
import { resolveInsightRender as t } from "./resolveInsightRender.es.js";
|
|
3
|
+
import { useBeatActions as a } from "./beatActions.es.js";
|
|
4
|
+
import f from "./components/BadgedTile.es.js";
|
|
5
|
+
import { OverflowMenu as n } from "./components/OverflowMenu.es.js";
|
|
6
|
+
import { InsightOptionsMenu as c } from "./components/InsightOptionsMenu.es.js";
|
|
7
|
+
import d, { isLogoGuid as g } from "./components/LogoFromGuid.es.js";
|
|
8
|
+
import B from "./components/StatusBadge.es.js";
|
|
9
|
+
import h from "./components/CompactInsightCard.es.js";
|
|
10
|
+
import S from "./components/InsightErrorCard.es.js";
|
|
11
|
+
import { BAR_CHART_VARIANTS as b, barChartVariant as D, buildChartData as L, buildDataSeries as T } from "./blocks/ChartBlocks/BarchartBlock/utils.es.js";
|
|
12
|
+
import { BarchartBlock as v } from "./blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js";
|
|
13
|
+
import { DoubleBarChartBlock as H } from "./blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js";
|
|
14
|
+
import R from "./blocks/ChartBlocks/StepChartBlock/StepChartBlock.es.js";
|
|
15
|
+
import O from "./blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js";
|
|
16
|
+
import w from "./blocks/ChartBlocks/DoubleProgressBarBlock/DoubleProgressBarBlock.es.js";
|
|
17
|
+
import y from "./blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js";
|
|
18
|
+
import G from "./components/TransferLogoCard.es.js";
|
|
19
|
+
import N from "./blocks/ComponentBlocks/AccountSwitchBlock/AccountSwitchBlock.es.js";
|
|
20
|
+
import { BudgetBlock as j } from "./blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js";
|
|
21
|
+
import z from "./components/SaveAnExtraCard.es.js";
|
|
22
|
+
import K from "./blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js";
|
|
23
|
+
import W from "./components/InsightTransactionRow.es.js";
|
|
24
|
+
import Y from "./components/TransactionListCard.es.js";
|
|
25
|
+
import { TransactionBlock as $, TransactionBlockVariant as rr } from "./blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js";
|
|
26
|
+
import { SVGImageBlock as mr } from "./blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js";
|
|
27
|
+
import ir from "./components/AccountHeroCard.es.js";
|
|
28
|
+
import pr from "./components/AmountPill.es.js";
|
|
29
|
+
import er from "./components/DesignateEmergencySavingsCard.es.js";
|
|
30
|
+
import { FeedbackBar as sr } from "./components/FeedbackBar.es.js";
|
|
31
|
+
import lr from "./components/FeedbackDialog.es.js";
|
|
32
|
+
import { DismissInsightDialog as gr } from "./components/DismissInsightDialog.es.js";
|
|
33
|
+
import { HiddenConfirmationCard as Br } from "./components/HiddenConfirmationCard.es.js";
|
|
34
|
+
import { ErrorCard as hr } from "./components/ErrorCard.es.js";
|
|
35
|
+
import { LoadingCard as Sr } from "./components/LoadingCard.es.js";
|
|
36
|
+
import { ObsolesceBanner as br } from "./components/ObsolesceBanner.es.js";
|
|
37
|
+
import Lr from "./components/BaseLayout.es.js";
|
|
38
|
+
import Ir from "./components/StatusMessageCard.es.js";
|
|
39
|
+
import Er from "./components/LogoTile.es.js";
|
|
40
|
+
import Pr from "./components/LogoClusterCard.es.js";
|
|
41
|
+
import Mr from "./components/MerchantHighlightCard.es.js";
|
|
42
|
+
import Vr from "./components/P2PLogoStack.es.js";
|
|
43
|
+
import xr from "./components/SavingsOpportunityCard.es.js";
|
|
44
|
+
import Fr from "./components/SubscriptionHeroCard.es.js";
|
|
45
|
+
import _r from "./components/UpcomingBillCard.es.js";
|
|
40
46
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
47
|
+
y as AccountBlock,
|
|
48
|
+
ir as AccountHeroCard,
|
|
49
|
+
N as AccountSwitchBlock,
|
|
50
|
+
pr as AmountPill,
|
|
51
|
+
b as BAR_CHART_VARIANTS,
|
|
52
|
+
f as BadgedTile,
|
|
53
|
+
v as BarchartBlock,
|
|
54
|
+
Lr as BaseLayout,
|
|
55
|
+
j as BudgetBlock,
|
|
56
|
+
h as CompactInsightCard,
|
|
57
|
+
er as DesignateEmergencySavingsCard,
|
|
58
|
+
gr as DismissInsightDialog,
|
|
59
|
+
O as DonutChartBlock,
|
|
60
|
+
H as DoubleBarChartBlock,
|
|
61
|
+
w as DoubleProgressBarBlock,
|
|
62
|
+
hr as ErrorCard,
|
|
63
|
+
sr as FeedbackBar,
|
|
64
|
+
lr as FeedbackDialog,
|
|
65
|
+
Br as HiddenConfirmationCard,
|
|
66
|
+
S as InsightErrorCard,
|
|
67
|
+
c as InsightOptionsMenu,
|
|
68
|
+
W as InsightTransactionRow,
|
|
69
|
+
Sr as LoadingCard,
|
|
70
|
+
Pr as LogoClusterCard,
|
|
71
|
+
d as LogoFromGuid,
|
|
72
|
+
Er as LogoTile,
|
|
73
|
+
Mr as MerchantHighlightCard,
|
|
74
|
+
br as ObsolesceBanner,
|
|
75
|
+
n as OverflowMenu,
|
|
76
|
+
Vr as P2PLogoStack,
|
|
77
|
+
mr as SVGImageBlock,
|
|
78
|
+
z as SaveAnExtraCard,
|
|
79
|
+
K as SaveExtraBlock,
|
|
80
|
+
xr as SavingsOpportunityCard,
|
|
81
|
+
B as StatusBadge,
|
|
82
|
+
Ir as StatusMessageCard,
|
|
83
|
+
o as StatusPill,
|
|
84
|
+
R as StepChartBlock,
|
|
85
|
+
Fr as SubscriptionHeroCard,
|
|
86
|
+
$ as TransactionBlock,
|
|
87
|
+
rr as TransactionBlockVariant,
|
|
88
|
+
Y as TransactionListCard,
|
|
89
|
+
G as TransferLogoCard,
|
|
90
|
+
_r as UpcomingBillCard,
|
|
91
|
+
D as barChartVariant,
|
|
92
|
+
L as buildChartData,
|
|
93
|
+
T as buildDataSeries,
|
|
94
|
+
g as isLogoGuid,
|
|
95
|
+
t as resolveInsightRender,
|
|
96
|
+
a as useBeatActions
|
|
83
97
|
};
|
|
@@ -2,7 +2,8 @@ var _ = {
|
|
|
2
2
|
PLACEHOLDER_ACTION_BLOCK: "PlaceholderActionBlock",
|
|
3
3
|
MAKE_TRANSFER_ACTION_BLOCK: "make_transfer",
|
|
4
4
|
TRANSCATION_HISTORY_ACTION_BLOCK: "transaction_history_block",
|
|
5
|
-
TRANSACTION_DETAILS_ACTION_BLOCK: "
|
|
5
|
+
TRANSACTION_DETAILS_ACTION_BLOCK: "transaction_details_block",
|
|
6
|
+
CONTACT_SUPPORT_ACTION_BLOCK: "contact_support_block"
|
|
6
7
|
};
|
|
7
8
|
export {
|
|
8
9
|
_ as actionBlocksKey
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionBlocksKey.es.js","names":[],"sources":["../../../src/insights-v2/mappings/actionBlocksKey.ts"],"sourcesContent":["// Keys for the drawer drilldown registry in `blocks.ts`, extracted into their own module.\n//\n// Why: chart blocks (e.g. BarchartBlock, DoubleBarChartBlock) need\n// `TRANSCATION_HISTORY_ACTION_BLOCK` to tag a chart bar's drilldown context, but they are\n// themselves re-exported through `../blocks` -> `mappings/blocks.ts` imports from that same\n// barrel to build its `blocks` registry. Importing the key straight from `mappings/blocks.ts`\n// closed that loop into a circular import: evaluating `mappings/blocks.ts` pulled in the\n// `blocks` barrel, which (before it got to `ComponentBlocks`/`AccountBlock`) loaded\n// `BarchartBlock`, which imported back into the still-initializing `mappings/blocks.ts` —\n// tripping a \"Cannot access 'AccountBlock' before initialization\" TDZ error in Storybook/Vite.\n//\n// Keeping the keys here (no dependency on `mappings/blocks.ts`) lets chart blocks reference\n// them without re-entering that module.\nexport const actionBlocksKey = {\n PLACEHOLDER_ACTION_BLOCK: 'PlaceholderActionBlock',\n MAKE_TRANSFER_ACTION_BLOCK: 'make_transfer',\n TRANSCATION_HISTORY_ACTION_BLOCK: 'transaction_history_block',\n TRANSACTION_DETAILS_ACTION_BLOCK: '
|
|
1
|
+
{"version":3,"file":"actionBlocksKey.es.js","names":[],"sources":["../../../src/insights-v2/mappings/actionBlocksKey.ts"],"sourcesContent":["// Keys for the drawer drilldown registry in `blocks.ts`, extracted into their own module.\n//\n// Why: chart blocks (e.g. BarchartBlock, DoubleBarChartBlock) need\n// `TRANSCATION_HISTORY_ACTION_BLOCK` to tag a chart bar's drilldown context, but they are\n// themselves re-exported through `../blocks` -> `mappings/blocks.ts` imports from that same\n// barrel to build its `blocks` registry. Importing the key straight from `mappings/blocks.ts`\n// closed that loop into a circular import: evaluating `mappings/blocks.ts` pulled in the\n// `blocks` barrel, which (before it got to `ComponentBlocks`/`AccountBlock`) loaded\n// `BarchartBlock`, which imported back into the still-initializing `mappings/blocks.ts` —\n// tripping a \"Cannot access 'AccountBlock' before initialization\" TDZ error in Storybook/Vite.\n//\n// Keeping the keys here (no dependency on `mappings/blocks.ts`) lets chart blocks reference\n// them without re-entering that module.\n//\n// Names follow ditto: its registry ends every CTA block in `_block` and the V2 envelope copies those\n// names verbatim (`transaction_details_block`, `contact_support_block`). `make_transfer` is a legacy\n// name that stays as an alias until the last legacy payload is gone.\nexport const actionBlocksKey = {\n PLACEHOLDER_ACTION_BLOCK: 'PlaceholderActionBlock',\n MAKE_TRANSFER_ACTION_BLOCK: 'make_transfer',\n TRANSCATION_HISTORY_ACTION_BLOCK: 'transaction_history_block',\n TRANSACTION_DETAILS_ACTION_BLOCK: 'transaction_details_block',\n CONTACT_SUPPORT_ACTION_BLOCK: 'contact_support_block',\n}\n"],"mappings":"AAiBA,IAAa,IAAkB;AAAA,EAC7B,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAC5B,kCAAkC;AAAA,EAClC,kCAAkC;AAAA,EAClC,8BAA8B;AAChC"}
|
|
@@ -1,70 +1,76 @@
|
|
|
1
|
+
import { ContactSupportActionBlock as a } from "../actionBlocks/ContactSupportActionBlock.es.js";
|
|
1
2
|
import { actionBlocksKey as o } from "./actionBlocksKey.es.js";
|
|
2
|
-
import { BarchartBlock as
|
|
3
|
-
import { DoubleBarChartBlock as
|
|
4
|
-
import
|
|
3
|
+
import { BarchartBlock as c } from "../blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js";
|
|
4
|
+
import { DoubleBarChartBlock as l } from "../blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js";
|
|
5
|
+
import i from "../blocks/ChartBlocks/StepChartBlock/StepChartBlock.es.js";
|
|
5
6
|
import m from "../blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
7
|
+
import n from "../blocks/ChartBlocks/DoubleProgressBarBlock/DoubleProgressBarBlock.es.js";
|
|
8
|
+
import p from "../blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js";
|
|
8
9
|
import _ from "../blocks/ComponentBlocks/AccountSwitchBlock/AccountSwitchBlock.es.js";
|
|
9
10
|
import { BudgetBlock as k } from "../blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js";
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
11
|
+
import s from "../blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js";
|
|
12
|
+
import { TransactionBlock as B } from "../blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js";
|
|
13
|
+
import C from "../blocks/ImageBlocks/ImageBlock.es.js";
|
|
13
14
|
import { SVGImageBlock as f } from "../blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js";
|
|
14
|
-
import { PlaceholderActionBlock as
|
|
15
|
-
import { getMakeTransferDrawerTitle as
|
|
16
|
-
import { MakeTransferActionBlockLayer as
|
|
17
|
-
import { getDrawerHeaderTitle as
|
|
18
|
-
import { TransactionDetailsBlock as
|
|
19
|
-
import { useTransactionDetailsPrepare as
|
|
20
|
-
import { TransactionHistoryBlock as
|
|
21
|
-
var
|
|
22
|
-
},
|
|
15
|
+
import { PlaceholderActionBlock as u } from "../actionBlocks/PlaceholderActionBlock.es.js";
|
|
16
|
+
import { getMakeTransferDrawerTitle as T } from "../actionBlocks/MakeTransferActionBlock/layout.es.js";
|
|
17
|
+
import { MakeTransferActionBlockLayer as b } from "../actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer.es.js";
|
|
18
|
+
import { getDrawerHeaderTitle as A } from "../actionBlocks/TransactionHistoryBlock/utils.es.js";
|
|
19
|
+
import { TransactionDetailsBlock as O } from "../actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.es.js";
|
|
20
|
+
import { useTransactionDetailsPrepare as h } from "../actionBlocks/TransactionDetailsBlock/useTransactionDetailsPrepare.es.js";
|
|
21
|
+
import { TransactionHistoryBlock as L } from "../actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js";
|
|
22
|
+
var t = (e) => {
|
|
23
|
+
}, N = /* @__PURE__ */ new Set([
|
|
23
24
|
"",
|
|
24
25
|
"null",
|
|
25
26
|
"undefined"
|
|
26
|
-
]),
|
|
27
|
-
const
|
|
28
|
-
return !!
|
|
29
|
-
},
|
|
27
|
+
]), Y = (e) => {
|
|
28
|
+
const r = e?.trim().toLowerCase();
|
|
29
|
+
return !!r && !N.has(r);
|
|
30
|
+
}, j = {
|
|
30
31
|
[o.PLACEHOLDER_ACTION_BLOCK]: {
|
|
31
|
-
Component:
|
|
32
|
-
usePrepare:
|
|
32
|
+
Component: u,
|
|
33
|
+
usePrepare: t,
|
|
33
34
|
title: () => "Action Block Layer Drilldown"
|
|
34
35
|
},
|
|
35
36
|
[o.MAKE_TRANSFER_ACTION_BLOCK]: {
|
|
36
|
-
Component:
|
|
37
|
-
usePrepare:
|
|
38
|
-
title:
|
|
37
|
+
Component: b,
|
|
38
|
+
usePrepare: t,
|
|
39
|
+
title: T
|
|
39
40
|
},
|
|
40
41
|
[o.TRANSCATION_HISTORY_ACTION_BLOCK]: {
|
|
41
|
-
Component:
|
|
42
|
-
usePrepare:
|
|
43
|
-
title:
|
|
42
|
+
Component: L,
|
|
43
|
+
usePrepare: t,
|
|
44
|
+
title: A
|
|
44
45
|
},
|
|
45
46
|
[o.TRANSACTION_DETAILS_ACTION_BLOCK]: {
|
|
46
|
-
Component:
|
|
47
|
-
usePrepare:
|
|
47
|
+
Component: O,
|
|
48
|
+
usePrepare: h,
|
|
48
49
|
title: () => "Transaction Details"
|
|
50
|
+
},
|
|
51
|
+
[o.CONTACT_SUPPORT_ACTION_BLOCK]: {
|
|
52
|
+
Component: a,
|
|
53
|
+
usePrepare: t,
|
|
54
|
+
title: (e, r) => r.help?.request_support ?? ""
|
|
49
55
|
}
|
|
50
|
-
},
|
|
51
|
-
account_block:
|
|
56
|
+
}, J = {
|
|
57
|
+
account_block: p,
|
|
52
58
|
account_switch_block: _,
|
|
53
|
-
bar_chart_block:
|
|
59
|
+
bar_chart_block: c,
|
|
54
60
|
budget_block: k,
|
|
55
|
-
category_transactions_block: s,
|
|
56
61
|
donut_chart_block: m,
|
|
57
|
-
double_bar_chart_block:
|
|
58
|
-
double_progress_bar_block:
|
|
59
|
-
image_block:
|
|
60
|
-
save_extra_block:
|
|
61
|
-
step_chart_block:
|
|
62
|
-
svg_image_block: f
|
|
62
|
+
double_bar_chart_block: l,
|
|
63
|
+
double_progress_bar_block: n,
|
|
64
|
+
image_block: C,
|
|
65
|
+
save_extra_block: s,
|
|
66
|
+
step_chart_block: i,
|
|
67
|
+
svg_image_block: f,
|
|
68
|
+
transaction_block: B
|
|
63
69
|
};
|
|
64
70
|
export {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
j as actionBlocks,
|
|
72
|
+
J as blocks,
|
|
73
|
+
Y as hasDrawerBlock
|
|
68
74
|
};
|
|
69
75
|
|
|
70
76
|
//# sourceMappingURL=blocks.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.es.js","names":[],"sources":["../../../src/insights-v2/mappings/blocks.ts"],"sourcesContent":["import {\n AccountBlock,\n AccountSwitchBlock,\n BarchartBlock,\n BudgetBlock,\n
|
|
1
|
+
{"version":3,"file":"blocks.es.js","names":[],"sources":["../../../src/insights-v2/mappings/blocks.ts"],"sourcesContent":["import {\n AccountBlock,\n AccountSwitchBlock,\n BarchartBlock,\n BudgetBlock,\n DonutChartBlock,\n DoubleBarChartBlock,\n DoubleProgressBarBlock,\n SaveExtraBlock,\n SVGImageBlock,\n TransactionBlock,\n} from '../blocks'\nimport StepChartBlock from '../blocks/ChartBlocks/StepChartBlock'\nimport ImageBlock from '../blocks/ImageBlocks/ImageBlock'\n\nimport type { Beat, GlobalCopy, InsightsPayload } from '../../core'\nimport { ContactSupportActionBlock } from '../actionBlocks/ContactSupportActionBlock'\nimport { PlaceholderActionBlock } from '../actionBlocks/PlaceholderActionBlock'\nimport { MakeTransferActionBlockLayer } from '../actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer'\nimport { getMakeTransferDrawerTitle } from '../actionBlocks/MakeTransferActionBlock/layout'\nimport { TransactionHistoryBlock } from '../actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock'\nimport { getDrawerHeaderTitle } from '../actionBlocks/TransactionHistoryBlock/utils'\nimport {\n TransactionDetailsBlock,\n useTransactionDetailsPrepare,\n} from '../actionBlocks/TransactionDetailsBlock'\n// Keys live in ./actionBlocksKey (imported directly by chart blocks/tests too) to avoid a\n// circular import between this module and the chart blocks — see that file for details.\nimport { actionBlocksKey } from './actionBlocksKey'\n\n// Drilldown indexes are not passed down: action blocks read them from\n// InsightsV2Store (useInsightsV2Store().actionDrawer).\nexport interface ActionBlockProps {\n beat: Beat\n}\n\nconst noop = (_: ActionBlockProps) => {}\n\n// A CTA opens a drawer only when it carries a real `block`. The backend may send\n// an empty/absent block (or the literal strings \"null\"/\"undefined\") for CTAs\n// that trigger something else (e.g. a postMessage) instead of a drilldown.\nconst NON_BLOCK_VALUES = new Set(['', 'null', 'undefined'])\nexport const hasDrawerBlock = (block?: string | null): boolean => {\n const normalized = block?.trim().toLowerCase()\n return !!normalized && !NON_BLOCK_VALUES.has(normalized)\n}\n\nexport interface ActionBlockEntry {\n Component: React.ComponentType<ActionBlockProps>\n usePrepare: (props: ActionBlockProps) => void // required; default to noop in each entry\n // Resolves the drawer title from the clicked CTA's variant + copy (e.g.\n // MakeTransfer reads its variant title from layout.ts). Falls back to the CTA label.\n title?: (variant: string | null | undefined, copy: GlobalCopy) => string\n}\n\n// Registry of drawer drilldowns, keyed by the `block` name the backend sends\n// on a beat's CTA. To add one: create a component taking ActionBlockProps,\n// read the clicked indexes from useInsightsV2Store().actionDrawer, and\n// register it here. Add\n// `usePrepare` when the block needs to load data before rendering.\n\nexport const actionBlocks = {\n [actionBlocksKey.PLACEHOLDER_ACTION_BLOCK]: {\n Component: PlaceholderActionBlock,\n usePrepare: noop,\n title: () => 'Action Block Layer Drilldown',\n },\n [actionBlocksKey.MAKE_TRANSFER_ACTION_BLOCK]: {\n Component: MakeTransferActionBlockLayer,\n usePrepare: noop,\n title: getMakeTransferDrawerTitle,\n },\n [actionBlocksKey.TRANSCATION_HISTORY_ACTION_BLOCK]: {\n Component: TransactionHistoryBlock,\n usePrepare: noop,\n title: getDrawerHeaderTitle,\n },\n [actionBlocksKey.TRANSACTION_DETAILS_ACTION_BLOCK]: {\n Component: TransactionDetailsBlock,\n usePrepare: useTransactionDetailsPrepare,\n title: () => 'Transaction Details',\n },\n // The block renders its own drawer (the help module's RequestSupport) on top of the action\n // drawer, so the action drawer's title is the CTA label.\n [actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK]: {\n Component: ContactSupportActionBlock,\n usePrepare: noop,\n title: (_variant, copy) => copy.help?.request_support ?? '',\n },\n} as Record<string, ActionBlockEntry>\n\nexport const blocks = {\n account_block: AccountBlock,\n account_switch_block: AccountSwitchBlock,\n bar_chart_block: BarchartBlock,\n budget_block: BudgetBlock,\n donut_chart_block: DonutChartBlock,\n double_bar_chart_block: DoubleBarChartBlock,\n double_progress_bar_block: DoubleProgressBarBlock,\n image_block: ImageBlock,\n save_extra_block: SaveExtraBlock,\n step_chart_block: StepChartBlock,\n svg_image_block: SVGImageBlock,\n transaction_block: TransactionBlock,\n} as Record<string, React.ComponentType<{ payload: InsightsPayload; beatGuid?: string }>>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoCA,IAAM,IAAA,CAAQ,MAAwB;AAAC,GAKjC,IAAmB,oBAAI,IAAI;AAAA,EAAC;AAAA,EAAI;AAAA,EAAQ;AAAW,CAAC,GAC7C,IAAA,CAAkB,MAAmC;AAChE,QAAM,IAAa,GAAO,KAAK,EAAE,YAAY;AAC7C,SAAO,CAAC,CAAC,KAAc,CAAC,EAAiB,IAAI,CAAU;AACzD,GAgBa,IAAe;AAAA,EACzB,CAAA,EAAgB,wBAAA,GAA2B;AAAA,IAC1C,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAA,MAAa;AAAA,EACf;AAAA,EACC,CAAA,EAAgB,0BAAA,GAA6B;AAAA,IAC5C,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAO;AAAA,EACT;AAAA,EACC,CAAA,EAAgB,gCAAA,GAAmC;AAAA,IAClD,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAO;AAAA,EACT;AAAA,EACC,CAAA,EAAgB,gCAAA,GAAmC;AAAA,IAClD,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAA,MAAa;AAAA,EACf;AAAA,EAGC,CAAA,EAAgB,4BAAA,GAA+B;AAAA,IAC9C,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAA,CAAQ,GAAU,MAAS,EAAK,MAAM,mBAAmB;AAAA,EAC3D;AACF,GAEa,IAAS;AAAA,EACpB,eAAe;AAAA,EACf,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,wBAAwB;AAAA,EACxB,2BAA2B;AAAA,EAC3B,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,mBAAmB;AACrB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Beat } from '../core';
|
|
2
|
+
/**
|
|
3
|
+
* Which renderer draws a beat:
|
|
4
|
+
* - `legacy` — the per-template legacy component (feed, mini, micro) or the legacy caption / embedded
|
|
5
|
+
* `switch` (transaction row, details drawer).
|
|
6
|
+
* - `v2` — `BaseLayout` (full, mini) or `CompactInsightCard` (micro, embedded) from `insights_payload`.
|
|
7
|
+
* - `error` — `InsightErrorCard`: the beat is flagged but its envelope is missing.
|
|
8
|
+
*/
|
|
9
|
+
export type InsightRender = 'legacy' | 'v2' | 'error';
|
|
10
|
+
/**
|
|
11
|
+
* The single gate every surface calls. Two facts decide: `beat.is_insights_v2` (written by firefly
|
|
12
|
+
* when the insight's Insights 2.0 flag is on) and whether the envelope is present.
|
|
13
|
+
*
|
|
14
|
+
* | `is_insights_v2` | envelope | result |
|
|
15
|
+
* | false / absent | any | `legacy` |
|
|
16
|
+
* | true | non-empty | `v2` |
|
|
17
|
+
* | true | empty | `error` |
|
|
18
|
+
*
|
|
19
|
+
* `error` is never downgraded to `legacy`: a flagged insight's legacy copy fields are filled from the
|
|
20
|
+
* same V2 copy block, so a failed envelope would otherwise render a plausible legacy-looking card with
|
|
21
|
+
* no block, no logo and no footer, and the failure would never surface. An absent flag (older firefly,
|
|
22
|
+
* cortex) renders the legacy path unchanged.
|
|
23
|
+
*
|
|
24
|
+
* An envelope counts as present only when it carries both an `instance_slot` and a `description`: a
|
|
25
|
+
* bare `{}` is a half-built envelope, every V2 renderer reads `instance_slot.block` first, and all
|
|
26
|
+
* three — `BaseLayout`, `CompactInsightCard` and the micro `InsightCard` — paint
|
|
27
|
+
* `description.html_text` unguarded, so a half-built envelope has to resolve to `error` rather than
|
|
28
|
+
* throw inside the renderer.
|
|
29
|
+
*/
|
|
30
|
+
export declare const resolveInsightRender: (beat?: Beat | null) => InsightRender;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveInsightRender.es.js","names":[],"sources":["../../src/insights-v2/resolveInsightRender.ts"],"sourcesContent":["import type { Beat } from '../core'\n\n/**\n * Which renderer draws a beat:\n * - `legacy` — the per-template legacy component (feed, mini, micro) or the legacy caption / embedded\n * `switch` (transaction row, details drawer).\n * - `v2` — `BaseLayout` (full, mini) or `CompactInsightCard` (micro, embedded) from `insights_payload`.\n * - `error` — `InsightErrorCard`: the beat is flagged but its envelope is missing.\n */\nexport type InsightRender = 'legacy' | 'v2' | 'error'\n\n/**\n * The single gate every surface calls. Two facts decide: `beat.is_insights_v2` (written by firefly\n * when the insight's Insights 2.0 flag is on) and whether the envelope is present.\n *\n * | `is_insights_v2` | envelope | result |\n * | false / absent | any | `legacy` |\n * | true | non-empty | `v2` |\n * | true | empty | `error` |\n *\n * `error` is never downgraded to `legacy`: a flagged insight's legacy copy fields are filled from the\n * same V2 copy block, so a failed envelope would otherwise render a plausible legacy-looking card with\n * no block, no logo and no footer, and the failure would never surface. An absent flag (older firefly,\n * cortex) renders the legacy path unchanged.\n *\n * An envelope counts as present only when it carries both an `instance_slot` and a `description`: a\n * bare `{}` is a half-built envelope, every V2 renderer reads `instance_slot.block` first, and all\n * three — `BaseLayout`, `CompactInsightCard` and the micro `InsightCard` — paint\n * `description.html_text` unguarded, so a half-built envelope has to resolve to `error` rather than\n * throw inside the renderer.\n */\nexport const resolveInsightRender = (beat?: Beat | null): InsightRender => {\n if (!beat?.is_insights_v2) return 'legacy'\n\n const payload = beat.insights_payload\n\n return payload?.instance_slot && payload.description ? 'v2' : 'error'\n}\n"],"mappings":"AA+BA,IAAa,IAAA,CAAwB,MAAsC;AACzE,MAAI,CAAC,GAAM,eAAgB,QAAO;AAElC,QAAM,IAAU,EAAK;AAErB,SAAO,GAAS,iBAAiB,EAAQ,cAAc,OAAO;AAChE"}
|