@mx-cartographer/experiences 9.7.110 → 9.7.112
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 +9 -0
- package/dist/common/hooks/useCombineEvents.d.ts +2 -2
- package/dist/common/hooks/useCombineEvents.es.js +11 -11
- package/dist/common/hooks/useCombineEvents.es.js.map +1 -1
- package/dist/core/types/Analytics.d.ts +6 -2
- package/dist/core/types/index.d.ts +1 -1
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +3 -3
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.d.ts +1 -6
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js +25 -24
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.d.ts +2 -2
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.es.js +49 -69
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.d.ts +23 -15
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.es.js +33 -18
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/analytics/resolveAnalyticsEvent.es.js +11 -7
- package/dist/insights-v2/analytics/resolveAnalyticsEvent.es.js.map +1 -1
- package/dist/insights-v2/beatActions.d.ts +1 -0
- package/dist/insights-v2/beatActions.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js.map +1 -1
- package/dist/microinsights/analytics.d.ts +2 -1
- package/dist/microinsights/analytics.es.js +8 -5
- package/dist/microinsights/analytics.es.js.map +1 -1
- package/dist/microinsights/beatActions.es.js +12 -11
- package/dist/microinsights/beatActions.es.js.map +1 -1
- package/dist/microinsights/cards/InsightCard.es.js +81 -78
- package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
- package/dist/microinsights/stores/InsightsMicroWidgetStore.d.ts +2 -1
- package/dist/microinsights/stores/InsightsMicroWidgetStore.es.js +22 -22
- package/dist/microinsights/stores/InsightsMicroWidgetStore.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/layout.ts"],"sourcesContent":["import type { Account, Beat } from '../../../core'\n\nconst balanceOf = (account: Account) => account.balance ?? 0\n\n
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AccountListBlock/layout.ts"],"sourcesContent":["import type { Account, Beat, DrilldownData } from '../../../core'\nimport type { AccountListCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport { formatSignedCurrency } from '../../../core/utils/NumberFormatting'\nimport { resolveVariantConfig } from '../../blocks/resolveVariantConfig'\nimport { finiteNumberOf } from '../TransactionHistoryBlock/utils'\n\nconst balanceOf = (account: Account) => account.balance ?? 0\n\n/** The beat's `account_guids` among visible accounts (or every cash account when it names none), largest first. */\nexport const resolveBeatAccounts = (\n beat: Beat,\n visibleAccounts: Account[],\n cashAccounts: Account[],\n): Account[] => {\n const guids = new Set<string>(\n beat.account_guids?.length ? beat.account_guids : cashAccounts.map(({ guid }) => guid),\n )\n\n return visibleAccounts\n .filter((account) => guids.has(account.guid))\n .sort((a, b) => balanceOf(b) - balanceOf(a))\n}\n\nexport const sumBalances = (accounts: Account[]): number =>\n accounts.reduce((total, account) => total + balanceOf(account), 0)\n\n/** The last four digits of an account number; empty when the account has none. */\nexport const lastFour = (accountNumber?: string): string =>\n accountNumber?.replace(/\\D/g, '').slice(-4) ?? ''\n\n/** A generic breakdown row: a label and its already-formatted display value. */\nexport interface SummaryRow {\n key: string\n label: string\n value: string\n /** The emphasised total row. */\n bold?: boolean\n}\n\n/** The \"How is this calculated?\" breakdown, built per insight so AccountListContent stays generic. */\nexport interface AccountListSummary {\n heading: string\n rows: SummaryRow[]\n}\n\ntype SummaryBuilder = (\n drilldown: DrilldownData | undefined,\n copy: AccountListCopy,\n) => AccountListSummary | undefined\n\n/** Monthly Obligations breakdown; undefined unless all three figures are finite, so the drawer falls back to the list. */\nconst buildMonthlyObligationsSummary: SummaryBuilder = (drilldown, copy) => {\n const availableFunds = finiteNumberOf(drilldown?.available_funds)\n const plannedExpenses = finiteNumberOf(drilldown?.planned_expenses)\n const totalRemaining = finiteNumberOf(drilldown?.total_remaining)\n\n if (\n availableFunds === undefined ||\n plannedExpenses === undefined ||\n totalRemaining === undefined\n ) {\n return undefined\n }\n\n return {\n heading: copy.how_is_this_calculated,\n rows: [\n {\n key: 'available_funds',\n label: copy.available_funds,\n value: formatSignedCurrency(availableFunds),\n },\n // Shown as a deduction (-$1,200.00), per Figma; the figure is stored positive.\n {\n key: 'planned_expenses',\n label: copy.planned_expenses,\n value: formatSignedCurrency(-plannedExpenses),\n },\n {\n bold: true,\n key: 'remaining',\n label: copy.remaining,\n value: formatSignedCurrency(totalRemaining),\n },\n ],\n }\n}\n\nconst SUMMARY_BUILDERS = {\n monthly_obligations: buildMonthlyObligationsSummary,\n} satisfies Record<string, SummaryBuilder>\n\n/**\n * Builds the drawer breakdown from whichever CTA opened it, keyed by the CTA's `variant` (ditto's\n * `*_cta_variant`). Unknown/absent variants fall back to Monthly Obligations and warn.\n */\nexport const buildSummary = (\n cta: { variant?: string | null; drilldown_data?: DrilldownData } | undefined,\n copy: AccountListCopy,\n): AccountListSummary | undefined =>\n resolveVariantConfig(\n SUMMARY_BUILDERS,\n cta?.variant,\n 'monthly_obligations',\n 'AccountListBlock',\n )(cta?.drilldown_data, copy)\n"],"mappings":";;;AAMA,IAAM,IAAA,CAAa,MAAqB,EAAQ,WAAW,GAG9C,IAAA,CACX,GACA,GACA,MACc;AACd,QAAM,IAAQ,IAAI,IACh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eof e == "function" ? e(t) : e, v = (e, t) => {
|
|
3
|
+
const s = r(e.action, t), o = r(e.category, t), p = r(e.value, t);
|
|
4
4
|
return {
|
|
5
|
-
...
|
|
6
|
-
...
|
|
7
|
-
...(
|
|
5
|
+
...s && { action: s },
|
|
6
|
+
...o && { category: o },
|
|
7
|
+
...(s || o) && { label: a(t.template) },
|
|
8
8
|
...p && { value: p },
|
|
9
|
+
metadata: { is_insights_v2: !0 },
|
|
9
10
|
...e.postHog && { postHog: {
|
|
10
11
|
eventName: e.postHog.eventName,
|
|
11
|
-
properties:
|
|
12
|
+
properties: {
|
|
13
|
+
...e.postHog.properties?.(t),
|
|
14
|
+
is_insights_v2: !0
|
|
15
|
+
}
|
|
12
16
|
} }
|
|
13
17
|
};
|
|
14
18
|
};
|
|
15
19
|
export {
|
|
16
|
-
|
|
20
|
+
v as resolveAnalyticsEvent,
|
|
17
21
|
a as sentenceCaseTemplate
|
|
18
22
|
};
|
|
19
23
|
|
|
@@ -1 +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 const value = resolve(config.value, beat)\n\n return {\n ...(action && { action }),\n ...(category && { category }),\n ...((action || category) && { label: sentenceCaseTemplate(beat.template) }),\n ...(value && { value }),\n ...(config.postHog && {\n postHog: {\n eventName: config.postHog.eventName,\n properties: config.postHog.properties?.(beat)
|
|
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 const value = resolve(config.value, beat)\n\n return {\n ...(action && { action }),\n ...(category && { category }),\n ...((action || category) && { label: sentenceCaseTemplate(beat.template) }),\n ...(value && { value }),\n metadata: { is_insights_v2: true },\n ...(config.postHog && {\n postHog: {\n eventName: config.postHog.eventName,\n properties: { ...config.postHog.properties?.(beat), is_insights_v2: true },\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,GACxC,IAAQ,EAAQ,EAAO,OAAO,CAAI;AAExC,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,KAAS,EAAE,OAAA,EAAM;AAAA,IACrB,UAAU,EAAE,gBAAgB,GAAK;AAAA,IACjC,GAAI,EAAO,WAAW,EACpB,SAAS;AAAA,MACP,WAAW,EAAO,QAAQ;AAAA,MAC1B,YAAY;AAAA,QAAE,GAAG,EAAO,QAAQ,aAAa,CAAI;AAAA,QAAG,gBAAgB;AAAA,MAAK;AAAA,IAC3E,EACF;AAAA,EACF;AACF"}
|
|
@@ -28,6 +28,7 @@ export interface AnalyticsEventPayload {
|
|
|
28
28
|
label?: string;
|
|
29
29
|
/** Detail stored with the Firefly event, e.g. a survey reason. */
|
|
30
30
|
value?: string;
|
|
31
|
+
metadata?: Record<string, unknown>;
|
|
31
32
|
postHog?: {
|
|
32
33
|
eventName: string;
|
|
33
34
|
properties?: Record<string, unknown>;
|
|
@@ -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 { 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' | 'not_interested'\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 /** Detail stored with the Firefly event, e.g. a survey reason. */\n value?: 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 /** The survey for `variant` opened (the hide survey, from \"Leave feedback\"). */\n onFeedbackSurveyShown?: (variant: InsightRating | 'hide') => void\n /** The survey closed unsent; `variant` says which one it was. */\n onFeedbackDialogClose?: (\n reason: FeedbackDialogCloseReason,\n variant?: InsightRating | 'hide',\n ) => 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":";;
|
|
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' | 'not_interested'\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 /** Detail stored with the Firefly event, e.g. a survey reason. */\n value?: string\n metadata?: Record<string, unknown>\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 /** The survey for `variant` opened (the hide survey, from \"Leave feedback\"). */\n onFeedbackSurveyShown?: (variant: InsightRating | 'hide') => void\n /** The survey closed unsent; `variant` says which one it was. */\n onFeedbackDialogClose?: (\n reason: FeedbackDialogCloseReason,\n variant?: InsightRating | 'hide',\n ) => 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":";;AA+EA,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.ts"],"sourcesContent":["import { alpha, type SxProps, type Theme } from '@mui/material/styles'\n\nimport {\n CELEBRATION_GRADIENT,\n ERROR_WASH_GRADIENT,\n WARM_LIME_ACCENT_GRADIENT,\n} from '../../../components/celebrationGradients'\n\nexport interface BlockLayoutConfig {\n background?: string\n logo_color?: string\n logo_bGcolor?: string\n logo_border_color?: string\n /** Corner radius of the icon tile (`icon_name` or an `ICO-` logo). Defaults to 6px. */\n logo_border_radius?: string\n /** Glyph size in px for an `ICO-` logo: on the confetti tile (default 24) and on the standard\n * icon tile (default `TILE_ICON_SIZE`). */\n logo_icon_size?: number\n /** mx-icons glyph shown before `sub_text` (e.g. a warning icon on overdraft_warning). */\n sub_logo?: string\n /** mx-icons glyph badged on the logo's corner (e.g. `error` on Low Account Balance's V2 tile). */\n badge?: string\n /** When true, AccountBlock renders the confetti-backed celebration card using the fields below. */\n isConfetti?: boolean\n /** Gradient wash layered over `background.paper` for the confetti card. */\n gradient?: string\n /** Which illustration sits left of the text. `logo` is the data-driven merchant/institution logo. */\n graphic?: 'paidOffCard' | 'savings' | 'logo'\n /** Amount typography variant — `h2` for milestones, `h3` for deposits. */\n amountVariant?: 'h2' | 'h3'\n /** Prefix prepended to the formatted amount, e.g. `+` for deposits. */\n amountPrefix?: string\n /** Render the colored category strip (`header_text`) at the top of the card. */\n categoryStrip?: boolean\n /** Raise the strip and body together with elevation/1. */\n cardShadow?: boolean\n /** Layout overrides for the graphic+text row (padding, gap). */\n rowSx?: SxProps\n /** Which payload field feeds the secondary line beside the amount. */\n secondarySource?: 'merchant' | 'label'\n /** Whether the secondary line sits above or below the amount. */\n secondaryPosition?: 'above' | 'below'\n /** Typography variant for the secondary line. */\n secondaryVariant?: 'body2' | 'caption'\n /** Theme color path for the secondary line. */\n secondaryColor?: string\n}\n\n/** Glyph size in px on the standard icon tile (IconComponent). */\nexport const TILE_ICON_SIZE = 30\n\n// Low Account Balance's red tile, shared by its legacy (`low_balance_alert`) and V2 (`low_balance`)\n// variant names.\nconst LOW_BALANCE_TILE: BlockLayoutConfig = {\n background: ERROR_WASH_GRADIENT,\n}\n\nexport const getLayoutConfig = (theme: Theme): Record<string, BlockLayoutConfig> => {\n return {\n overdraft_warning: {\n background: theme.palette.warning.light,\n sub_logo: 'error',\n },\n low_balance_alert: LOW_BALANCE_TILE,\n // V2 name for the same tile: content from `instance_slot.data`, the logo badged with `badge`.\n low_balance: { ...LOW_BALANCE_TILE, badge: 'error' },\n // Shared on/off-track status pair — used by Monthly Obligations Status and\n // Payday Cash Left Over Status (identical designs, different copy).\n status_off_track: {\n logo_color: 'background.paper',\n logo_bGcolor: 'error.main',\n // Figma 9936:39145: the money icon's tile has 4px corners.\n logo_border_radius: '4px',\n // Figma draws the money glyph at 24px in both status tiles (9936:39156).\n logo_icon_size: 24,\n background: ERROR_WASH_GRADIENT,\n },\n interest_charges_summary: {\n logo_color: 'text.primary',\n logo_bGcolor: alpha(theme.palette.categories?.feesCharges || '', 0.25),\n logo_border_color: 'categories.feesCharges',\n background:\n 'linear-gradient(256.82deg, rgba(227, 39, 39, 0.2) 1.86%, rgba(255, 123, 0, 0.2) 101.54%)',\n },\n // Shared deposit-celebration card — used by both the standard deposit and the emergency-fund\n // deposit beats (identical design, different copy), so one design-named variant serves both.\n deposit_received: {\n isConfetti: true,\n gradient: WARM_LIME_ACCENT_GRADIENT,\n graphic: 'logo',\n amountVariant: '
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.ts"],"sourcesContent":["import { alpha, type SxProps, type Theme } from '@mui/material/styles'\n\nimport {\n CELEBRATION_GRADIENT,\n ERROR_WASH_GRADIENT,\n WARM_LIME_ACCENT_GRADIENT,\n} from '../../../components/celebrationGradients'\n\nexport interface BlockLayoutConfig {\n background?: string\n logo_color?: string\n logo_bGcolor?: string\n logo_border_color?: string\n /** Corner radius of the icon tile (`icon_name` or an `ICO-` logo). Defaults to 6px. */\n logo_border_radius?: string\n /** Glyph size in px for an `ICO-` logo: on the confetti tile (default 24) and on the standard\n * icon tile (default `TILE_ICON_SIZE`). */\n logo_icon_size?: number\n /** mx-icons glyph shown before `sub_text` (e.g. a warning icon on overdraft_warning). */\n sub_logo?: string\n /** mx-icons glyph badged on the logo's corner (e.g. `error` on Low Account Balance's V2 tile). */\n badge?: string\n /** When true, AccountBlock renders the confetti-backed celebration card using the fields below. */\n isConfetti?: boolean\n /** Gradient wash layered over `background.paper` for the confetti card. */\n gradient?: string\n /** Which illustration sits left of the text. `logo` is the data-driven merchant/institution logo. */\n graphic?: 'paidOffCard' | 'savings' | 'logo'\n /** Amount typography variant — `h2` for milestones, `h3` for deposits. */\n amountVariant?: 'h2' | 'h3'\n /** Prefix prepended to the formatted amount, e.g. `+` for deposits. */\n amountPrefix?: string\n /** Render the colored category strip (`header_text`) at the top of the card. */\n categoryStrip?: boolean\n /** Raise the strip and body together with elevation/1. */\n cardShadow?: boolean\n /** Layout overrides for the graphic+text row (padding, gap). */\n rowSx?: SxProps\n /** Which payload field feeds the secondary line beside the amount. */\n secondarySource?: 'merchant' | 'label'\n /** Whether the secondary line sits above or below the amount. */\n secondaryPosition?: 'above' | 'below'\n /** Typography variant for the secondary line. */\n secondaryVariant?: 'body2' | 'caption'\n /** Theme color path for the secondary line. */\n secondaryColor?: string\n}\n\n/** Glyph size in px on the standard icon tile (IconComponent). */\nexport const TILE_ICON_SIZE = 30\n\n// Low Account Balance's red tile, shared by its legacy (`low_balance_alert`) and V2 (`low_balance`)\n// variant names.\nconst LOW_BALANCE_TILE: BlockLayoutConfig = {\n background: ERROR_WASH_GRADIENT,\n}\n\nexport const getLayoutConfig = (theme: Theme): Record<string, BlockLayoutConfig> => {\n return {\n overdraft_warning: {\n background: theme.palette.warning.light,\n sub_logo: 'error',\n },\n low_balance_alert: LOW_BALANCE_TILE,\n // V2 name for the same tile: content from `instance_slot.data`, the logo badged with `badge`.\n low_balance: { ...LOW_BALANCE_TILE, badge: 'error' },\n // Shared on/off-track status pair — used by Monthly Obligations Status and\n // Payday Cash Left Over Status (identical designs, different copy).\n status_off_track: {\n logo_color: 'background.paper',\n logo_bGcolor: 'error.main',\n // Figma 9936:39145: the money icon's tile has 4px corners.\n logo_border_radius: '4px',\n // Figma draws the money glyph at 24px in both status tiles (9936:39156).\n logo_icon_size: 24,\n background: ERROR_WASH_GRADIENT,\n },\n interest_charges_summary: {\n logo_color: 'text.primary',\n logo_bGcolor: alpha(theme.palette.categories?.feesCharges || '', 0.25),\n logo_border_color: 'categories.feesCharges',\n background:\n 'linear-gradient(256.82deg, rgba(227, 39, 39, 0.2) 1.86%, rgba(255, 123, 0, 0.2) 101.54%)',\n },\n // Shared deposit-celebration card — used by both the standard deposit and the emergency-fund\n // deposit beats (identical design, different copy), so one design-named variant serves both.\n deposit_received: {\n isConfetti: true,\n gradient: WARM_LIME_ACCENT_GRADIENT,\n graphic: 'logo',\n // Figma: the hero amount is h2 (23px), consistent with the other confetti tiles. Design sign-off:\n // https://mxenabled.slack.com/archives/C0C0F6V8TAQ/p1793864013010539\n amountVariant: 'h2',\n amountPrefix: '+',\n categoryStrip: true,\n cardShadow: true,\n rowSx: { gap: 12, p: 12 },\n secondarySource: 'merchant',\n secondaryPosition: 'below',\n secondaryVariant: 'body2',\n secondaryColor: 'text.primary',\n },\n status_on_track: {\n isConfetti: true,\n gradient: WARM_LIME_ACCENT_GRADIENT,\n graphic: 'logo',\n amountVariant: 'h2',\n rowSx: { gap: 16, p: 16 },\n secondarySource: 'label',\n secondaryPosition: 'below',\n secondaryVariant: 'caption',\n secondaryColor: 'text.secondary',\n },\n payoff_celebration: {\n isConfetti: true,\n gradient: CELEBRATION_GRADIENT,\n graphic: 'paidOffCard',\n amountVariant: 'h2',\n rowSx: { gap: 16, px: 24, py: 16 },\n secondarySource: 'label',\n secondaryPosition: 'below',\n secondaryVariant: 'caption',\n secondaryColor: 'text.secondary',\n },\n savings_deposit: {\n isConfetti: true,\n gradient: CELEBRATION_GRADIENT,\n graphic: 'savings',\n amountVariant: 'h2',\n rowSx: { gap: 16, p: 16 },\n secondarySource: 'label',\n secondaryPosition: 'above',\n secondaryVariant: 'body2',\n secondaryColor: 'text.primary',\n },\n // Neutral fallback for an unknown/unmatched variant: renders the plain standard card (no\n // confetti, no special background). `resolveVariantConfig` warns before falling back here.\n default: {},\n }\n}\n"],"mappings":";;AAqDA,IAAM,IAAsC,EAC1C,YAAY,EACd,GAEa,IAAA,CAAmB,OACvB;AAAA,EACL,mBAAmB;AAAA,IACjB,YAAY,EAAM,QAAQ,QAAQ;AAAA,IAClC,UAAU;AAAA,EACZ;AAAA,EACA,mBAAmB;AAAA,EAEnB,aAAa;AAAA,IAAE,GAAG;AAAA,IAAkB,OAAO;AAAA,EAAQ;AAAA,EAGnD,kBAAkB;AAAA,IAChB,YAAY;AAAA,IACZ,cAAc;AAAA,IAEd,oBAAoB;AAAA,IAEpB,gBAAgB;AAAA,IAChB,YAAY;AAAA,EACd;AAAA,EACA,0BAA0B;AAAA,IACxB,YAAY;AAAA,IACZ,cAAc,EAAM,EAAM,QAAQ,YAAY,eAAe,IAAI,IAAI;AAAA,IACrE,mBAAmB;AAAA,IACnB,YACE;AAAA,EACJ;AAAA,EAGA,kBAAkB;AAAA,IAChB,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,SAAS;AAAA,IAGT,eAAe;AAAA,IACf,cAAc;AAAA,IACd,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,OAAO;AAAA,MAAE,KAAK;AAAA,MAAI,GAAG;AAAA,IAAG;AAAA,IACxB,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,EAClB;AAAA,EACA,iBAAiB;AAAA,IACf,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,SAAS;AAAA,IACT,eAAe;AAAA,IACf,OAAO;AAAA,MAAE,KAAK;AAAA,MAAI,GAAG;AAAA,IAAG;AAAA,IACxB,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,EAClB;AAAA,EACA,oBAAoB;AAAA,IAClB,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,SAAS;AAAA,IACT,eAAe;AAAA,IACf,OAAO;AAAA,MAAE,KAAK;AAAA,MAAI,IAAI;AAAA,MAAI,IAAI;AAAA,IAAG;AAAA,IACjC,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,EAClB;AAAA,EACA,iBAAiB;AAAA,IACf,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,SAAS;AAAA,IACT,eAAe;AAAA,IACf,OAAO;AAAA,MAAE,KAAK;AAAA,MAAI,GAAG;AAAA,IAAG;AAAA,IACxB,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,EAClB;AAAA,EAGA,SAAS,CAAC;AACZ"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { analyticsSession } from '../common/utils/Analytics';
|
|
2
|
+
import { AnalyticEventProps } from '../core/types/Analytics';
|
|
2
3
|
export type AnalyticSession = Awaited<ReturnType<typeof analyticsSession>>;
|
|
3
|
-
export declare const onAnalyticEvent: (event: string, session: AnalyticSession) => Promise<any>;
|
|
4
|
+
export declare const onAnalyticEvent: (event: string, session: AnalyticSession, props?: AnalyticEventProps) => Promise<any>;
|
|
4
5
|
export declare const onAnalyticPageView: (page: string, session: AnalyticSession) => Promise<any>;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { ANALYTICS_EVENTS as
|
|
2
|
-
var A = async (
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ANALYTICS_EVENTS as e, ANALYTICS_PAGEVIEWS as c } from "./constants/Analytics.es.js";
|
|
2
|
+
var A = async (a, n, t) => !n || !e[a] ? null : n.sendAnalyticEvent({
|
|
3
|
+
...e[a],
|
|
4
|
+
...t?.metadata && { metadata: JSON.stringify(t.metadata) }
|
|
5
|
+
}).then((r) => r).catch((r) => {
|
|
6
|
+
throw r;
|
|
7
|
+
}), l = async (a, n) => !n || !c[a] ? null : n.sendAnalyticsPageview(c[a]).then((t) => t).catch((t) => {
|
|
8
|
+
throw t;
|
|
6
9
|
});
|
|
7
10
|
export {
|
|
8
11
|
A as onAnalyticEvent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.es.js","names":[],"sources":["../../src/microinsights/analytics.ts"],"sourcesContent":["import { analyticsSession } from '../common/utils/Analytics'\nimport { AnalyticsPageviewObjectType } from '../core/types/Analytics'\n\nimport { ANALYTICS_EVENTS, ANALYTICS_PAGEVIEWS } from './constants/Analytics'\nimport type { AnalyticsEventsObjectType } from './constants/Analytics'\n\nexport type AnalyticSession = Awaited<ReturnType<typeof analyticsSession>>\n\nexport const onAnalyticEvent = async (event: string
|
|
1
|
+
{"version":3,"file":"analytics.es.js","names":[],"sources":["../../src/microinsights/analytics.ts"],"sourcesContent":["import { analyticsSession } from '../common/utils/Analytics'\nimport { AnalyticEventProps, AnalyticsPageviewObjectType } from '../core/types/Analytics'\n\nimport { ANALYTICS_EVENTS, ANALYTICS_PAGEVIEWS } from './constants/Analytics'\nimport type { AnalyticsEventsObjectType } from './constants/Analytics'\n\nexport type AnalyticSession = Awaited<ReturnType<typeof analyticsSession>>\n\nexport const onAnalyticEvent = async (\n event: string,\n session: AnalyticSession,\n props?: AnalyticEventProps,\n) => {\n if (!session || !ANALYTICS_EVENTS[event]) return null\n\n return session\n .sendAnalyticEvent({\n ...(ANALYTICS_EVENTS[event] as AnalyticsEventsObjectType),\n ...(props?.metadata && { metadata: JSON.stringify(props.metadata) }),\n })\n .then((response) => response)\n .catch((error) => {\n throw error\n })\n}\n\nexport const onAnalyticPageView = async (page: string, session: AnalyticSession) => {\n if (!session || !ANALYTICS_PAGEVIEWS[page]) {\n return null\n }\n\n return session\n .sendAnalyticsPageview(ANALYTICS_PAGEVIEWS[page] as AnalyticsPageviewObjectType)\n .then((response) => response)\n .catch((error) => {\n throw error\n })\n}\n"],"mappings":";AAQA,IAAa,IAAkB,OAC7B,GACA,GACA,MAEI,CAAC,KAAW,CAAC,EAAiB,CAAA,IAAe,OAE1C,EACJ,kBAAkB;AAAA,EACjB,GAAI,EAAiB,CAAA;AAAA,EACrB,GAAI,GAAO,YAAY,EAAE,UAAU,KAAK,UAAU,EAAM,QAAQ,EAAE;AACpE,CAAC,EACA,KAAA,CAAM,MAAa,CAAQ,EAC3B,MAAA,CAAO,MAAU;AAChB,QAAM;AACR,CAAC,GAGQ,IAAqB,OAAO,GAAc,MACjD,CAAC,KAAW,CAAC,EAAoB,CAAA,IAC5B,OAGF,EACJ,sBAAsB,EAAoB,CAAA,CAAoC,EAC9E,KAAA,CAAM,MAAa,CAAQ,EAC3B,MAAA,CAAO,MAAU;AAChB,QAAM;AACR,CAAC"}
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
onAnalyticsEvent: ({ action: e, category:
|
|
3
|
-
|
|
1
|
+
var b = ({ store: a, template: s, posthog: d }) => ({
|
|
2
|
+
onAnalyticsEvent: ({ action: e, category: i, label: n, metadata: c, postHog: t, value: l }) => {
|
|
3
|
+
a.session && (e || i) && a.session.sendAnalyticEvent({
|
|
4
4
|
action: e ?? "",
|
|
5
|
-
category:
|
|
5
|
+
category: i ?? "",
|
|
6
6
|
label: n ?? "",
|
|
7
|
-
value:
|
|
7
|
+
value: l ?? null,
|
|
8
|
+
...c && { metadata: JSON.stringify(c) }
|
|
8
9
|
}).catch(() => {
|
|
9
|
-
}), t?.eventName &&
|
|
10
|
+
}), t?.eventName && d?.capture(t.eventName, t.properties);
|
|
10
11
|
},
|
|
11
|
-
onSubmitFeedback: async ({ beatGuid: e, option:
|
|
12
|
-
await
|
|
12
|
+
onSubmitFeedback: async ({ beatGuid: e, option: i, detail: n }) => {
|
|
13
|
+
await a.insightsMicroWidgetStore.sendBeatFeedback({
|
|
13
14
|
beat_guid: e,
|
|
14
|
-
template:
|
|
15
|
-
comments: n ||
|
|
15
|
+
template: s,
|
|
16
|
+
comments: n || i || "No feedback"
|
|
16
17
|
});
|
|
17
18
|
}
|
|
18
19
|
});
|
|
19
20
|
export {
|
|
20
|
-
|
|
21
|
+
b as buildMicroBeatActions
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
//# sourceMappingURL=beatActions.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beatActions.es.js","names":[],"sources":["../../src/microinsights/beatActions.ts"],"sourcesContent":["import type { BeatActions } from '../insights-v2/beatActions'\n\nimport type { AppStore } from './stores/AppStore'\nimport type { TheWholeHog } from './interfaces'\n\ninterface MicroBeatActionsDeps {\n store: Pick<AppStore, 'session' | 'insightsMicroWidgetStore'>\n template: string\n posthog?: TheWholeHog\n}\n\n/**\n * Host callbacks for an action block opened from a micro card, built from what the widget already\n * owns (analytics session, beat API, `posthog`), so the host supplies nothing more.\n *\n * - `onAnalyticsEvent`: Firefly half via the analytics session, PostHog half via `posthog`.\n * Fire-and-forget.\n * - `onSubmitFeedback`: `POST /beat_feedback` with pulse's body (`detail`, else the option, else\n * `No feedback`). A rejection drives the survey's error state.\n *\n * Other host effects (`onCtaAction`, `onUpdate`, ...) are not provided and no-op.\n */\nexport const buildMicroBeatActions = ({\n store,\n template,\n posthog,\n}: MicroBeatActionsDeps): BeatActions => ({\n onAnalyticsEvent: ({ action, category, label, postHog, value }) => {\n if (store.session && (action || category)) {\n store.session\n .sendAnalyticEvent({\n action: action ?? '',\n category: category ?? '',\n label: label ?? '',\n value: value ?? null,\n })\n .catch(() => {})\n }\n\n if (postHog?.eventName) {\n posthog?.capture(postHog.eventName, postHog.properties)\n }\n },\n onSubmitFeedback: async ({ beatGuid, option, detail }) => {\n await store.insightsMicroWidgetStore.sendBeatFeedback({\n beat_guid: beatGuid,\n template,\n comments: detail || option || 'No feedback',\n })\n },\n})\n"],"mappings":"AAsBA,IAAa,IAAA,CAAyB,EACpC,OAAA,GACA,UAAA,GACA,SAAA,EAAA,OACwC;AAAA,EACxC,kBAAA,CAAmB,EAAE,QAAA,GAAQ,UAAA,GAAU,OAAA,GAAO,SAAA,GAAS,OAAA,EAAA,MAAY;
|
|
1
|
+
{"version":3,"file":"beatActions.es.js","names":[],"sources":["../../src/microinsights/beatActions.ts"],"sourcesContent":["import type { BeatActions } from '../insights-v2/beatActions'\n\nimport type { AppStore } from './stores/AppStore'\nimport type { TheWholeHog } from './interfaces'\n\ninterface MicroBeatActionsDeps {\n store: Pick<AppStore, 'session' | 'insightsMicroWidgetStore'>\n template: string\n posthog?: TheWholeHog\n}\n\n/**\n * Host callbacks for an action block opened from a micro card, built from what the widget already\n * owns (analytics session, beat API, `posthog`), so the host supplies nothing more.\n *\n * - `onAnalyticsEvent`: Firefly half via the analytics session, PostHog half via `posthog`.\n * Fire-and-forget.\n * - `onSubmitFeedback`: `POST /beat_feedback` with pulse's body (`detail`, else the option, else\n * `No feedback`). A rejection drives the survey's error state.\n *\n * Other host effects (`onCtaAction`, `onUpdate`, ...) are not provided and no-op.\n */\nexport const buildMicroBeatActions = ({\n store,\n template,\n posthog,\n}: MicroBeatActionsDeps): BeatActions => ({\n onAnalyticsEvent: ({ action, category, label, metadata, postHog, value }) => {\n if (store.session && (action || category)) {\n store.session\n .sendAnalyticEvent({\n action: action ?? '',\n category: category ?? '',\n label: label ?? '',\n value: value ?? null,\n ...(metadata && { metadata: JSON.stringify(metadata) }),\n })\n .catch(() => {})\n }\n\n if (postHog?.eventName) {\n posthog?.capture(postHog.eventName, postHog.properties)\n }\n },\n onSubmitFeedback: async ({ beatGuid, option, detail }) => {\n await store.insightsMicroWidgetStore.sendBeatFeedback({\n beat_guid: beatGuid,\n template,\n comments: detail || option || 'No feedback',\n })\n },\n})\n"],"mappings":"AAsBA,IAAa,IAAA,CAAyB,EACpC,OAAA,GACA,UAAA,GACA,SAAA,EAAA,OACwC;AAAA,EACxC,kBAAA,CAAmB,EAAE,QAAA,GAAQ,UAAA,GAAU,OAAA,GAAO,UAAA,GAAU,SAAA,GAAS,OAAA,EAAA,MAAY;AAC3E,IAAI,EAAM,YAAY,KAAU,MAC9B,EAAM,QACH,kBAAkB;AAAA,MACjB,QAAQ,KAAU;AAAA,MAClB,UAAU,KAAY;AAAA,MACtB,OAAO,KAAS;AAAA,MAChB,OAAO,KAAS;AAAA,MAChB,GAAI,KAAY,EAAE,UAAU,KAAK,UAAU,CAAQ,EAAE;AAAA,IACvD,CAAC,EACA,MAAA,MAAY;AAAA,IAAC,CAAC,GAGf,GAAS,aACX,GAAS,QAAQ,EAAQ,WAAW,EAAQ,UAAU;AAAA,EAE1D;AAAA,EACA,kBAAkB,OAAO,EAAE,UAAA,GAAU,QAAA,GAAQ,QAAA,EAAA,MAAa;AACxD,UAAM,EAAM,yBAAyB,iBAAiB;AAAA,MACpD,WAAW;AAAA,MACX,UAAA;AAAA,MACA,UAAU,KAAU,KAAU;AAAA,IAChC,CAAC;AAAA,EACH;AACF"}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { GlobalDataContext as
|
|
2
|
-
import { slot as
|
|
3
|
-
import { resolveInsightRender as
|
|
4
|
-
import { hasDrawerBlock as
|
|
5
|
-
import
|
|
6
|
-
import { statusIconName as
|
|
7
|
-
import { ON_CLICK_EVENT as
|
|
8
|
-
import
|
|
9
|
-
import { BeatIcon as
|
|
10
|
-
import { useCopyStore as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { MicroCtaStatusGate as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { Fragment as
|
|
17
|
-
import { alpha as
|
|
18
|
-
import
|
|
19
|
-
import { useInView as
|
|
20
|
-
var
|
|
21
|
-
const { ref:
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { GlobalDataContext as H } from "../../common/context/GlobalDataProvider.es.js";
|
|
2
|
+
import { slot as I } from "../../core/types/Insights.es.js";
|
|
3
|
+
import { resolveInsightRender as K } from "../../insights-v2/resolveInsightRender.es.js";
|
|
4
|
+
import { hasDrawerBlock as Z } from "../../insights-v2/mappings/hasDrawerBlock.es.js";
|
|
5
|
+
import J from "../../insights-v2/components/LogoFromGuid.es.js";
|
|
6
|
+
import { statusIconName as Q, statusIconPalette as U } from "../../insights-v2/components/statusIcon.es.js";
|
|
7
|
+
import { ON_CLICK_EVENT as w, ON_VIEW_EVENT as X, ON_VIEW_FIRST_TIME_EVENT as Y } from "../constants/Analytics.es.js";
|
|
8
|
+
import F from "../beaticons/BeatMaterialIcon.es.js";
|
|
9
|
+
import { BeatIcon as b } from "../beaticons/BeatIcon.es.js";
|
|
10
|
+
import { useCopyStore as ii, useEvent as ti, useInsightsMicroWidgetStore as ei } from "../context/hooks.es.js";
|
|
11
|
+
import O from "../MicroCardTemplate.es.js";
|
|
12
|
+
import oi from "./InlineActionBlock.es.js";
|
|
13
|
+
import { MicroCtaStatusGate as ri } from "./MicroCtaStatus.es.js";
|
|
14
|
+
import ni from "../../insights-v2/components/InsightErrorCard.es.js";
|
|
15
|
+
import si, { useEffect as W, useState as ai } from "react";
|
|
16
|
+
import { Fragment as ci, jsx as e, jsxs as li } from "react/jsx-runtime";
|
|
17
|
+
import { alpha as G, useTheme as mi } from "@mui/material/styles";
|
|
18
|
+
import _i from "@mui/material/Box";
|
|
19
|
+
import { useInView as pi } from "react-intersection-observer";
|
|
20
|
+
var di = 32, wi = ({ ariaLabel: u, beat: i, elevation: y, inDescriptionCtaBehavior: q = "external", index: s, isActiveCard: g, onCardClick: a, posthog: r, widthOverrides: c, variant: C, showIcon: E, heightOverrides: f }) => {
|
|
21
|
+
const { ref: h, inView: l } = pi({ threshold: 1 }), v = mi(), { cardsCopy: A } = ii(), { onEvent: m } = ti(), { updateBeat: D, updateOffer: j } = ei(), _ = "is_insights_v2" in i && i.is_insights_v2, p = _ ? { metadata: { is_insights_v2: !0 } } : void 0;
|
|
22
|
+
W(() => {
|
|
23
|
+
l && (i.has_been_displayed ? m(X(i.template), p) : (i.guid.startsWith("OFR") ? j({
|
|
24
24
|
...i,
|
|
25
25
|
has_been_displayed: !0
|
|
26
|
-
}) :
|
|
26
|
+
}) : D({
|
|
27
27
|
...i,
|
|
28
28
|
has_been_displayed: !0
|
|
29
|
-
}), m(
|
|
30
|
-
}, [
|
|
31
|
-
if (
|
|
29
|
+
}), m(Y(i.template), p)));
|
|
30
|
+
}, [l]), W(() => {
|
|
31
|
+
if (l && i) if (i.template === "MarketingOffer") {
|
|
32
32
|
const t = i;
|
|
33
33
|
r?.capture("viewed_messaging_insight", {
|
|
34
34
|
template: i.template,
|
|
@@ -40,15 +40,16 @@ var pi = 32, vi = ({ ariaLabel: d, beat: i, elevation: h, inDescriptionCtaBehavi
|
|
|
40
40
|
} else r?.capture("viewed_insight", {
|
|
41
41
|
beat_guid: i.guid,
|
|
42
42
|
template: i.template,
|
|
43
|
-
position:
|
|
43
|
+
position: s,
|
|
44
|
+
..._ && { is_insights_v2: !0 }
|
|
44
45
|
});
|
|
45
46
|
}, [
|
|
46
47
|
i,
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
s,
|
|
49
|
+
l
|
|
49
50
|
]);
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
51
|
+
const k = K(i), o = k === "v2" ? i.insights_payload : void 0, L = si.useContext(H) !== null, x = q === "internal" && L && Z(o?.in_description_cta?.block), [N, $] = ai(0), d = () => {
|
|
52
|
+
if (x ? $((t) => t + 1) : a && a(i), m(w(i.template), p), i.template === "MarketingOffer") {
|
|
52
53
|
const t = i;
|
|
53
54
|
r?.capture("clicked_messaging_insight", {
|
|
54
55
|
template: i.template,
|
|
@@ -60,82 +61,84 @@ var pi = 32, vi = ({ ariaLabel: d, beat: i, elevation: h, inDescriptionCtaBehavi
|
|
|
60
61
|
} else r?.capture("clicked_insight", {
|
|
61
62
|
beat_guid: i.guid,
|
|
62
63
|
template: i.template,
|
|
63
|
-
position:
|
|
64
|
+
position: s,
|
|
65
|
+
..._ && { is_insights_v2: !0 }
|
|
64
66
|
});
|
|
65
67
|
};
|
|
66
|
-
return
|
|
67
|
-
"aria-hidden": !
|
|
68
|
-
"aria-label":
|
|
68
|
+
return k === "error" ? /* @__PURE__ */ e(_i, {
|
|
69
|
+
"aria-hidden": !g,
|
|
70
|
+
"aria-label": u,
|
|
69
71
|
"aria-roledescription": "slide",
|
|
70
|
-
ref:
|
|
72
|
+
ref: h,
|
|
71
73
|
role: "group",
|
|
72
74
|
sx: {
|
|
73
|
-
height:
|
|
74
|
-
minWidth:
|
|
75
|
+
height: f ? "100%" : 120,
|
|
76
|
+
minWidth: c ? `${c}px` : "100%",
|
|
75
77
|
my: 1
|
|
76
78
|
},
|
|
77
|
-
children: /* @__PURE__ */ e(
|
|
78
|
-
}) : o ? /* @__PURE__ */ e(
|
|
79
|
+
children: /* @__PURE__ */ e(ni, { beat: i })
|
|
80
|
+
}) : o ? /* @__PURE__ */ e(ri, {
|
|
79
81
|
beat: i,
|
|
80
82
|
posthog: r,
|
|
81
83
|
children: ({ presentation: n }) => {
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
+
const T = n?.kind === "status" ? n : void 0, B = I(o.instance_slot.data, "logo"), R = I(o.instance_slot.data, T && I(o.instance_slot.data, "reviewed_icon") ? "reviewed_icon" : "icon"), V = Q(R?.guid), M = U(R?.color), z = n ? T?.action?.label : o.primary_cta?.label || o.in_description_cta?.label || void 0, P = () => {
|
|
85
|
+
a && a(i), m(w(i.template), p), r?.capture("clicked_insight", {
|
|
84
86
|
beat_guid: i.guid,
|
|
85
87
|
template: i.template,
|
|
86
|
-
position:
|
|
88
|
+
position: s,
|
|
89
|
+
..._ && { is_insights_v2: !0 }
|
|
87
90
|
});
|
|
88
|
-
}, S = /* @__PURE__ */ e(
|
|
91
|
+
}, S = /* @__PURE__ */ e(O, {
|
|
89
92
|
"aria-roledescription": "slide",
|
|
90
|
-
ariaLabel:
|
|
93
|
+
ariaLabel: u,
|
|
91
94
|
description: o.description.html_text,
|
|
92
|
-
elevation:
|
|
93
|
-
heightOverrides:
|
|
94
|
-
icon:
|
|
95
|
-
logo:
|
|
96
|
-
size:
|
|
97
|
-
}) :
|
|
98
|
-
bgColor:
|
|
95
|
+
elevation: y,
|
|
96
|
+
heightOverrides: f,
|
|
97
|
+
icon: E && (B ? /* @__PURE__ */ e(J, {
|
|
98
|
+
logo: B,
|
|
99
|
+
size: di
|
|
100
|
+
}) : V ? /* @__PURE__ */ e(F, {
|
|
101
|
+
bgColor: G(v.palette[M].main, 0.15),
|
|
99
102
|
iconColor: M,
|
|
100
|
-
name:
|
|
101
|
-
}) : /* @__PURE__ */ e(
|
|
102
|
-
bgColor:
|
|
103
|
+
name: V
|
|
104
|
+
}) : /* @__PURE__ */ e(F, {
|
|
105
|
+
bgColor: G(v.palette.primary.main, 0.15),
|
|
103
106
|
name: "lightbulb"
|
|
104
107
|
})),
|
|
105
|
-
isActiveCard:
|
|
106
|
-
onCardClick: n ?
|
|
107
|
-
onPrimaryAction: n ?
|
|
108
|
-
primaryActionText:
|
|
109
|
-
ref:
|
|
108
|
+
isActiveCard: g,
|
|
109
|
+
onCardClick: n ? P : d,
|
|
110
|
+
onPrimaryAction: n ? P : d,
|
|
111
|
+
primaryActionText: z,
|
|
112
|
+
ref: h,
|
|
110
113
|
title: n?.title || o.title || "",
|
|
111
|
-
variant:
|
|
112
|
-
widthOverrides:
|
|
114
|
+
variant: C,
|
|
115
|
+
widthOverrides: c
|
|
113
116
|
});
|
|
114
|
-
return
|
|
117
|
+
return x ? /* @__PURE__ */ li(ci, { children: [S, N > 0 && /* @__PURE__ */ e(oi, {
|
|
115
118
|
beat: i,
|
|
116
|
-
openRequest:
|
|
119
|
+
openRequest: N,
|
|
117
120
|
posthog: r
|
|
118
121
|
})] }) : S;
|
|
119
122
|
}
|
|
120
|
-
}) : /* @__PURE__ */ e(
|
|
123
|
+
}) : /* @__PURE__ */ e(O, {
|
|
121
124
|
"aria-roledescription": "slide",
|
|
122
|
-
ariaLabel:
|
|
125
|
+
ariaLabel: u,
|
|
123
126
|
description: i?.html_micro_description && i?.html_micro_description.length > 0 ? i.html_micro_description : i.html_description || "",
|
|
124
|
-
elevation:
|
|
125
|
-
heightOverrides:
|
|
126
|
-
icon:
|
|
127
|
-
isActiveCard:
|
|
128
|
-
onCardClick:
|
|
129
|
-
onPrimaryAction:
|
|
130
|
-
primaryActionText: i.micro_call_to_action ||
|
|
131
|
-
ref:
|
|
127
|
+
elevation: y,
|
|
128
|
+
heightOverrides: f,
|
|
129
|
+
icon: E && /* @__PURE__ */ e(b, { beat: i }),
|
|
130
|
+
isActiveCard: g,
|
|
131
|
+
onCardClick: d,
|
|
132
|
+
onPrimaryAction: d,
|
|
133
|
+
primaryActionText: i.micro_call_to_action || A?.micro_card_cta,
|
|
134
|
+
ref: h,
|
|
132
135
|
title: i.micro_title && i.micro_title.length > 0 ? i.micro_title : i.title,
|
|
133
|
-
variant:
|
|
134
|
-
widthOverrides:
|
|
136
|
+
variant: C,
|
|
137
|
+
widthOverrides: c
|
|
135
138
|
});
|
|
136
139
|
};
|
|
137
140
|
export {
|
|
138
|
-
|
|
141
|
+
wi as InsightCard
|
|
139
142
|
};
|
|
140
143
|
|
|
141
144
|
//# sourceMappingURL=InsightCard.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InsightCard.es.js","names":[],"sources":["../../../src/microinsights/cards/InsightCard.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\nimport { useInView } from 'react-intersection-observer'\n\nimport Box from '@mui/material/Box'\nimport { alpha, useTheme } from '@mui/material/styles'\n\nimport { BeatIcon } from '../beaticons'\nimport BeatMaterialIcon from '../beaticons/BeatMaterialIcon'\n\nimport { useCopyStore, useEvent, useInsightsMicroWidgetStore } from '../context/hooks'\n\nimport { ON_CLICK_EVENT, ON_VIEW_EVENT, ON_VIEW_FIRST_TIME_EVENT } from '../constants/Analytics'\nimport { VIEW_THRESHOLD } from '../constants/App'\n\nimport type { BeatLikeOffer, MicroInsightCardProps } from '../interfaces'\nimport type { Beat } from '../../core/types/Beat'\n// Leaf imports, not the `core` barrel: that pulls GlobalStore and every feature store into the\n// micro bundle, and through `core/stores` it reintroduces a circular path this module avoids.\nimport { slot } from '../../core/types/Insights'\nimport type { LogoRef } from '../../core/types/Insights'\nimport MicroCardTemplate from '../MicroCardTemplate'\n// Leaf import, not the `common` barrel, which would pull the shared layer into the micro bundle.\nimport { GlobalDataContext } from '../../common/context/GlobalDataProvider'\n// TODO: load this with `React.lazy` to keep the block registry and charts out of the micro bundle,\n// once it is verified in every host that embeds the micro widget.\nimport InlineActionBlock from './InlineActionBlock'\nimport MicroCtaStatusGate, { type MicroCtaStatus } from './MicroCtaStatus'\n// Leaf imports on purpose: the `insights-v2` barrel pulls in `mappings/blocks` and its charts.\nimport InsightErrorCard from '../../insights-v2/components/InsightErrorCard'\nimport LogoFromGuid from '../../insights-v2/components/LogoFromGuid'\nimport { statusIconName, statusIconPalette } from '../../insights-v2/components/statusIcon'\nimport { hasDrawerBlock } from '../../insights-v2/mappings/hasDrawerBlock'\nimport { resolveInsightRender } from '../../insights-v2/resolveInsightRender'\n\n/** The legacy micro card's icon tile size (BeatMaterialIcon). */\nconst ICON_SIZE = 32\n\nexport interface InsightCardProps extends MicroInsightCardProps {\n beat: Beat | BeatLikeOffer\n index?: number\n}\n\nexport const InsightCard: React.FC<InsightCardProps> = ({\n ariaLabel,\n beat,\n elevation,\n inDescriptionCtaBehavior = 'external',\n index,\n isActiveCard,\n onCardClick,\n posthog,\n widthOverrides,\n variant,\n showIcon,\n heightOverrides,\n}) => {\n const { ref, inView } = useInView({\n threshold: VIEW_THRESHOLD,\n })\n\n const theme = useTheme()\n\n // *************** Context functions *********************\n const { cardsCopy } = useCopyStore()\n const { onEvent } = useEvent()\n const { updateBeat, updateOffer } = useInsightsMicroWidgetStore()\n\n // ************** Use Effects Hooks **********************\n useEffect(() => {\n if (inView) {\n if (!beat.has_been_displayed) {\n if (beat.guid.startsWith('OFR')) {\n updateOffer({\n ...beat,\n has_been_displayed: true,\n })\n } else {\n updateBeat({\n ...beat,\n has_been_displayed: true,\n })\n }\n onEvent(ON_VIEW_FIRST_TIME_EVENT(beat.template))\n } else {\n onEvent(ON_VIEW_EVENT(beat.template))\n }\n }\n }, [inView])\n\n useEffect(() => {\n if (inView && beat) {\n if (beat.template === 'MarketingOffer') {\n const offerBeat = beat as BeatLikeOffer\n posthog?.capture('viewed_messaging_insight', {\n template: beat.template,\n campaign_guid: offerBeat.campaign_guid,\n campaign_name: offerBeat.pulse_campaign_name,\n offer_guid: offerBeat.guid,\n user_guid: offerBeat.user_guid,\n })\n } else {\n posthog?.capture('viewed_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n })\n }\n }\n }, [beat, index, inView])\n\n const insightRender = resolveInsightRender(beat as Beat)\n const v2Payload = insightRender === 'v2' ? beat.insights_payload : undefined\n // Only a V2 beat whose `in_description_cta` names a drawer block opens in place; everything else\n // keeps the host's behavior. Micro sends its one action as `in_description_cta`.\n // It also needs the host's `GlobalDataProvider`; without one the tap goes to the host instead.\n const hasGlobalData = React.useContext(GlobalDataContext) !== null\n const opensInline =\n inDescriptionCtaBehavior === 'internal' &&\n hasGlobalData &&\n hasDrawerBlock(v2Payload?.in_description_cta?.block)\n\n // *************** Click handlers ************************\n // Taps that opened the beat's own action block.\n const [inlineOpenRequest, setInlineOpenRequest] = useState(0)\n\n const handleClick = () => {\n /* eslint-disable no-unused-expressions */\n // Internal opens the block here and skips the host's `onCardClick`; analytics are unchanged.\n if (opensInline) {\n setInlineOpenRequest((count) => count + 1)\n } else {\n onCardClick && onCardClick(beat)\n }\n onEvent(ON_CLICK_EVENT(beat.template))\n\n if (beat.template === 'MarketingOffer') {\n const offerBeat = beat as BeatLikeOffer\n posthog?.capture('clicked_messaging_insight', {\n template: beat.template,\n campaign_guid: offerBeat.campaign_guid,\n campaign_name: offerBeat.pulse_campaign_name,\n offer_guid: offerBeat.guid,\n user_guid: offerBeat.user_guid,\n })\n } else {\n posthog?.capture('clicked_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n })\n }\n }\n\n if (insightRender === 'error') {\n // Keeps the carousel's slot sizing; the error card does not know about it.\n return (\n <Box\n aria-hidden={!isActiveCard}\n aria-label={ariaLabel}\n aria-roledescription=\"slide\"\n ref={ref}\n role=\"group\"\n sx={{\n height: heightOverrides ? '100%' : 120,\n minWidth: widthOverrides ? `${widthOverrides}px` : '100%',\n my: 1,\n }}\n >\n <InsightErrorCard beat={beat} />\n </Box>\n )\n }\n\n if (v2Payload) {\n // Figma (Micro Widget | Large Transaction) is the legacy micro card's layout fed from the envelope:\n // the slot's logo on the left (merchant, or the category without one), title, description, and the\n // primary CTA as a link. The logo falls back to the insight glyph when the slot carries none.\n // ditto ≥ 1.4.3 words micro's action as in_description_cta instead of primary_cta; either way\n // the label stays the card's tap (`micro-carousel/cta`), never a drawer.\n // A block with no row logo may name a status icon instead (account_block `minimal`: `ICO-error`),\n // drawn in the legacy card's tinted tile (Figma Micro | Low Account Balance).\n // The status tile takes the palette the slot names (Payday's on-track check is `success.main`),\n // falling back to error. `||` on the label: the copy may send the primary label as \"\".\n // Answered (mirrors the full card): reviewed title, icon and the Undo label. Display only: the card\n // and its label tap go to the host, which opens the insight with its block; nothing runs here.\n const renderCard = ({ presentation }: MicroCtaStatus) => {\n const answered = presentation?.kind === 'status' ? presentation : undefined\n const rowLogo = slot<LogoRef>(v2Payload.instance_slot.data, 'logo')\n const statusIcon = slot<LogoRef>(\n v2Payload.instance_slot.data,\n answered && slot<LogoRef>(v2Payload.instance_slot.data, 'reviewed_icon')\n ? 'reviewed_icon'\n : 'icon',\n )\n const statusName = statusIconName(statusIcon?.guid)\n const statusPalette = statusIconPalette(statusIcon?.color)\n const actionLabel = presentation\n ? answered?.action?.label\n : v2Payload.primary_cta?.label || v2Payload.in_description_cta?.label || undefined\n const handleHostClick = () => {\n onCardClick && onCardClick(beat)\n onEvent(ON_CLICK_EVENT(beat.template))\n posthog?.capture('clicked_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n })\n }\n\n const card = (\n <MicroCardTemplate\n aria-roledescription=\"slide\"\n ariaLabel={ariaLabel}\n description={v2Payload.description.html_text}\n elevation={elevation}\n heightOverrides={heightOverrides}\n icon={\n showIcon &&\n (rowLogo ? (\n <LogoFromGuid logo={rowLogo} size={ICON_SIZE} />\n ) : statusName ? (\n <BeatMaterialIcon\n bgColor={alpha(theme.palette[statusPalette].main, 0.15)}\n iconColor={statusPalette}\n name={statusName}\n />\n ) : (\n <BeatMaterialIcon\n bgColor={alpha(theme.palette.primary.main, 0.15)}\n name=\"lightbulb\"\n />\n ))\n }\n isActiveCard={isActiveCard}\n onCardClick={presentation ? handleHostClick : handleClick}\n onPrimaryAction={presentation ? handleHostClick : handleClick}\n primaryActionText={actionLabel}\n ref={ref}\n title={presentation?.title || v2Payload.title || ''}\n variant={variant}\n widthOverrides={widthOverrides}\n />\n )\n\n if (!opensInline) return card\n\n return (\n <>\n {card}\n {/* Nothing renders until the first tap. */}\n {inlineOpenRequest > 0 && (\n <InlineActionBlock\n beat={beat as Beat}\n openRequest={inlineOpenRequest}\n posthog={posthog}\n />\n )}\n </>\n )\n }\n\n return (\n <MicroCtaStatusGate beat={beat as Beat} posthog={posthog}>\n {renderCard}\n </MicroCtaStatusGate>\n )\n }\n\n return (\n <MicroCardTemplate\n aria-roledescription=\"slide\"\n ariaLabel={ariaLabel}\n description={\n beat?.html_micro_description && beat?.html_micro_description.length > 0\n ? beat.html_micro_description\n : beat.html_description || ''\n }\n elevation={elevation}\n heightOverrides={heightOverrides}\n icon={showIcon && <BeatIcon beat={beat} />}\n isActiveCard={isActiveCard}\n onCardClick={handleClick}\n onPrimaryAction={handleClick}\n primaryActionText={beat.micro_call_to_action || cardsCopy?.micro_card_cta}\n ref={ref}\n title={beat.micro_title && beat.micro_title.length > 0 ? beat.micro_title : beat.title}\n variant={variant}\n widthOverrides={widthOverrides}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmCA,IAAM,KAAY,IAOL,KAAA,CAA2C,EACtD,WAAA,GACA,MAAA,GACA,WAAA,GACA,0BAAA,IAA2B,YAC3B,OAAA,GACA,cAAA,GACA,aAAA,GACA,SAAA,GACA,gBAAA,GACA,SAAA,GACA,UAAA,GACA,iBAAA,EAAA,MACI;AACJ,QAAM,EAAE,KAAA,GAAK,QAAA,EAAA,IAAW,GAAU,EAChC,WAAA,EACF,CAAC,GAEK,IAAQ,GAAS,GAGjB,EAAE,WAAA,EAAA,IAAc,EAAa,GAC7B,EAAE,SAAA,EAAA,IAAY,EAAS,GACvB,EAAE,YAAA,GAAY,aAAA,EAAA,IAAgB,GAA4B;AAGhE,EAAA,EAAA,MAAgB;AACd,IAAI,MACG,EAAK,qBAcR,EAAQ,EAAc,EAAK,QAAQ,CAAC,KAbhC,EAAK,KAAK,WAAW,KAAK,IAC5B,EAAY;AAAA,MACV,GAAG;AAAA,MACH,oBAAoB;AAAA,IACtB,CAAC,IAED,EAAW;AAAA,MACT,GAAG;AAAA,MACH,oBAAoB;AAAA,IACtB,CAAC,GAEH,EAAQ,EAAyB,EAAK,QAAQ,CAAC;AAAA,EAKrD,GAAG,CAAC,CAAM,CAAC,G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Ae,MAAM,IAAI;AAAA,UACtD,WAAW;AAAA,UACX,MAAM;AAAA,QACP,CAAA,IAED,gBAAA,EAAC,GAAD;AAAA,UACE,SAAS,EAAM,EAAM,QAAQ,QAAQ,MAAM,IAAI;AAAA,UAC/C,MAAK;AAAA,QACN,CAAA;AAAA,QAGS,cAAA;AAAA,QACd,aAAa,IAAe,IAAkB;AAAA,QAC9C,iBAAiB,IAAe,IAAkB;AAAA,QAClD,mBAAmB;AAAA,QACd,KAAA;AAAA,QACL,OAAO,GAAc,SAAS,EAAU,SAAS;AAAA,QACxC,SAAA;AAAA,QACO,gBAAA;AAAA,MACjB,CAAA;AAGH,aAAK,IAGH,gBAAA,GAAA,IAAA,EAAA,UAAA,CACG,GAEA,IAAoB,KACnB,gBAAA,EAAC,IAAD;AAAA,QACQ,MAAA;AAAA,QACN,aAAa;AAAA,QACJ,SAAA;AAAA,MACV,CAAA,CAEH,EAAA,CAAA,IAbqB;AAAA,IAe3B;AAAA,EAKsB,CAAA,IAKtB,gBAAA,EAAC,GAAD;AAAA,IACE,wBAAqB;AAAA,IACV,WAAA;AAAA,IACX,aACE,GAAM,0BAA0B,GAAM,uBAAuB,SAAS,IAClE,EAAK,yBACL,EAAK,oBAAoB;AAAA,IAEpB,WAAA;AAAA,IACM,iBAAA;AAAA,IACjB,MAAM,KAAY,gBAAA,EAAC,GAAD,EAAgB,MAAA,EAAO,CAAA;AAAA,IAC3B,cAAA;AAAA,IACd,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB,EAAK,wBAAwB,GAAW;AAAA,IACtD,KAAA;AAAA,IACL,OAAO,EAAK,eAAe,EAAK,YAAY,SAAS,IAAI,EAAK,cAAc,EAAK;AAAA,IACxE,SAAA;AAAA,IACO,gBAAA;AAAA,EACjB,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"InsightCard.es.js","names":[],"sources":["../../../src/microinsights/cards/InsightCard.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\nimport { useInView } from 'react-intersection-observer'\n\nimport Box from '@mui/material/Box'\nimport { alpha, useTheme } from '@mui/material/styles'\n\nimport { BeatIcon } from '../beaticons'\nimport BeatMaterialIcon from '../beaticons/BeatMaterialIcon'\n\nimport { useCopyStore, useEvent, useInsightsMicroWidgetStore } from '../context/hooks'\n\nimport { ON_CLICK_EVENT, ON_VIEW_EVENT, ON_VIEW_FIRST_TIME_EVENT } from '../constants/Analytics'\nimport { VIEW_THRESHOLD } from '../constants/App'\n\nimport type { BeatLikeOffer, MicroInsightCardProps } from '../interfaces'\nimport type { Beat } from '../../core/types/Beat'\n// Leaf imports, not the `core` barrel: that pulls GlobalStore and every feature store into the\n// micro bundle, and through `core/stores` it reintroduces a circular path this module avoids.\nimport { slot } from '../../core/types/Insights'\nimport type { LogoRef } from '../../core/types/Insights'\nimport MicroCardTemplate from '../MicroCardTemplate'\n// Leaf import, not the `common` barrel, which would pull the shared layer into the micro bundle.\nimport { GlobalDataContext } from '../../common/context/GlobalDataProvider'\n// TODO: load this with `React.lazy` to keep the block registry and charts out of the micro bundle,\n// once it is verified in every host that embeds the micro widget.\nimport InlineActionBlock from './InlineActionBlock'\nimport MicroCtaStatusGate, { type MicroCtaStatus } from './MicroCtaStatus'\n// Leaf imports on purpose: the `insights-v2` barrel pulls in `mappings/blocks` and its charts.\nimport InsightErrorCard from '../../insights-v2/components/InsightErrorCard'\nimport LogoFromGuid from '../../insights-v2/components/LogoFromGuid'\nimport { statusIconName, statusIconPalette } from '../../insights-v2/components/statusIcon'\nimport { hasDrawerBlock } from '../../insights-v2/mappings/hasDrawerBlock'\nimport { resolveInsightRender } from '../../insights-v2/resolveInsightRender'\n\n/** The legacy micro card's icon tile size (BeatMaterialIcon). */\nconst ICON_SIZE = 32\n\nexport interface InsightCardProps extends MicroInsightCardProps {\n beat: Beat | BeatLikeOffer\n index?: number\n}\n\nexport const InsightCard: React.FC<InsightCardProps> = ({\n ariaLabel,\n beat,\n elevation,\n inDescriptionCtaBehavior = 'external',\n index,\n isActiveCard,\n onCardClick,\n posthog,\n widthOverrides,\n variant,\n showIcon,\n heightOverrides,\n}) => {\n const { ref, inView } = useInView({\n threshold: VIEW_THRESHOLD,\n })\n\n const theme = useTheme()\n\n // *************** Context functions *********************\n const { cardsCopy } = useCopyStore()\n const { onEvent } = useEvent()\n const { updateBeat, updateOffer } = useInsightsMicroWidgetStore()\n\n const isV2 = 'is_insights_v2' in beat && beat.is_insights_v2\n const eventProps = isV2 ? { metadata: { is_insights_v2: true } } : undefined\n\n // ************** Use Effects Hooks **********************\n useEffect(() => {\n if (inView) {\n if (!beat.has_been_displayed) {\n if (beat.guid.startsWith('OFR')) {\n updateOffer({\n ...beat,\n has_been_displayed: true,\n })\n } else {\n updateBeat({\n ...beat,\n has_been_displayed: true,\n })\n }\n onEvent(ON_VIEW_FIRST_TIME_EVENT(beat.template), eventProps)\n } else {\n onEvent(ON_VIEW_EVENT(beat.template), eventProps)\n }\n }\n }, [inView])\n\n useEffect(() => {\n if (inView && beat) {\n if (beat.template === 'MarketingOffer') {\n const offerBeat = beat as BeatLikeOffer\n posthog?.capture('viewed_messaging_insight', {\n template: beat.template,\n campaign_guid: offerBeat.campaign_guid,\n campaign_name: offerBeat.pulse_campaign_name,\n offer_guid: offerBeat.guid,\n user_guid: offerBeat.user_guid,\n })\n } else {\n posthog?.capture('viewed_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n ...(isV2 && { is_insights_v2: true }),\n })\n }\n }\n }, [beat, index, inView])\n\n const insightRender = resolveInsightRender(beat as Beat)\n const v2Payload = insightRender === 'v2' ? beat.insights_payload : undefined\n // Only a V2 beat whose `in_description_cta` names a drawer block opens in place; everything else\n // keeps the host's behavior. Micro sends its one action as `in_description_cta`.\n // It also needs the host's `GlobalDataProvider`; without one the tap goes to the host instead.\n const hasGlobalData = React.useContext(GlobalDataContext) !== null\n const opensInline =\n inDescriptionCtaBehavior === 'internal' &&\n hasGlobalData &&\n hasDrawerBlock(v2Payload?.in_description_cta?.block)\n\n // *************** Click handlers ************************\n // Taps that opened the beat's own action block.\n const [inlineOpenRequest, setInlineOpenRequest] = useState(0)\n\n const handleClick = () => {\n /* eslint-disable no-unused-expressions */\n // Internal opens the block here and skips the host's `onCardClick`; analytics are unchanged.\n if (opensInline) {\n setInlineOpenRequest((count) => count + 1)\n } else {\n onCardClick && onCardClick(beat)\n }\n onEvent(ON_CLICK_EVENT(beat.template), eventProps)\n\n if (beat.template === 'MarketingOffer') {\n const offerBeat = beat as BeatLikeOffer\n posthog?.capture('clicked_messaging_insight', {\n template: beat.template,\n campaign_guid: offerBeat.campaign_guid,\n campaign_name: offerBeat.pulse_campaign_name,\n offer_guid: offerBeat.guid,\n user_guid: offerBeat.user_guid,\n })\n } else {\n posthog?.capture('clicked_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n ...(isV2 && { is_insights_v2: true }),\n })\n }\n }\n\n if (insightRender === 'error') {\n // Keeps the carousel's slot sizing; the error card does not know about it.\n return (\n <Box\n aria-hidden={!isActiveCard}\n aria-label={ariaLabel}\n aria-roledescription=\"slide\"\n ref={ref}\n role=\"group\"\n sx={{\n height: heightOverrides ? '100%' : 120,\n minWidth: widthOverrides ? `${widthOverrides}px` : '100%',\n my: 1,\n }}\n >\n <InsightErrorCard beat={beat} />\n </Box>\n )\n }\n\n if (v2Payload) {\n // Figma (Micro Widget | Large Transaction) is the legacy micro card's layout fed from the envelope:\n // the slot's logo on the left (merchant, or the category without one), title, description, and the\n // primary CTA as a link. The logo falls back to the insight glyph when the slot carries none.\n // ditto ≥ 1.4.3 words micro's action as in_description_cta instead of primary_cta; either way\n // the label stays the card's tap (`micro-carousel/cta`), never a drawer.\n // A block with no row logo may name a status icon instead (account_block `minimal`: `ICO-error`),\n // drawn in the legacy card's tinted tile (Figma Micro | Low Account Balance).\n // The status tile takes the palette the slot names (Payday's on-track check is `success.main`),\n // falling back to error. `||` on the label: the copy may send the primary label as \"\".\n // Answered (mirrors the full card): reviewed title, icon and the Undo label. Display only: the card\n // and its label tap go to the host, which opens the insight with its block; nothing runs here.\n const renderCard = ({ presentation }: MicroCtaStatus) => {\n const answered = presentation?.kind === 'status' ? presentation : undefined\n const rowLogo = slot<LogoRef>(v2Payload.instance_slot.data, 'logo')\n const statusIcon = slot<LogoRef>(\n v2Payload.instance_slot.data,\n answered && slot<LogoRef>(v2Payload.instance_slot.data, 'reviewed_icon')\n ? 'reviewed_icon'\n : 'icon',\n )\n const statusName = statusIconName(statusIcon?.guid)\n const statusPalette = statusIconPalette(statusIcon?.color)\n const actionLabel = presentation\n ? answered?.action?.label\n : v2Payload.primary_cta?.label || v2Payload.in_description_cta?.label || undefined\n const handleHostClick = () => {\n onCardClick && onCardClick(beat)\n onEvent(ON_CLICK_EVENT(beat.template), eventProps)\n posthog?.capture('clicked_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n ...(isV2 && { is_insights_v2: true }),\n })\n }\n\n const card = (\n <MicroCardTemplate\n aria-roledescription=\"slide\"\n ariaLabel={ariaLabel}\n description={v2Payload.description.html_text}\n elevation={elevation}\n heightOverrides={heightOverrides}\n icon={\n showIcon &&\n (rowLogo ? (\n <LogoFromGuid logo={rowLogo} size={ICON_SIZE} />\n ) : statusName ? (\n <BeatMaterialIcon\n bgColor={alpha(theme.palette[statusPalette].main, 0.15)}\n iconColor={statusPalette}\n name={statusName}\n />\n ) : (\n <BeatMaterialIcon\n bgColor={alpha(theme.palette.primary.main, 0.15)}\n name=\"lightbulb\"\n />\n ))\n }\n isActiveCard={isActiveCard}\n onCardClick={presentation ? handleHostClick : handleClick}\n onPrimaryAction={presentation ? handleHostClick : handleClick}\n primaryActionText={actionLabel}\n ref={ref}\n title={presentation?.title || v2Payload.title || ''}\n variant={variant}\n widthOverrides={widthOverrides}\n />\n )\n\n if (!opensInline) return card\n\n return (\n <>\n {card}\n {/* Nothing renders until the first tap. */}\n {inlineOpenRequest > 0 && (\n <InlineActionBlock\n beat={beat as Beat}\n openRequest={inlineOpenRequest}\n posthog={posthog}\n />\n )}\n </>\n )\n }\n\n return (\n <MicroCtaStatusGate beat={beat as Beat} posthog={posthog}>\n {renderCard}\n </MicroCtaStatusGate>\n )\n }\n\n return (\n <MicroCardTemplate\n aria-roledescription=\"slide\"\n ariaLabel={ariaLabel}\n description={\n beat?.html_micro_description && beat?.html_micro_description.length > 0\n ? beat.html_micro_description\n : beat.html_description || ''\n }\n elevation={elevation}\n heightOverrides={heightOverrides}\n icon={showIcon && <BeatIcon beat={beat} />}\n isActiveCard={isActiveCard}\n onCardClick={handleClick}\n onPrimaryAction={handleClick}\n primaryActionText={beat.micro_call_to_action || cardsCopy?.micro_card_cta}\n ref={ref}\n title={beat.micro_title && beat.micro_title.length > 0 ? beat.micro_title : beat.title}\n variant={variant}\n widthOverrides={widthOverrides}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmCA,IAAM,KAAY,IAOL,KAAA,CAA2C,EACtD,WAAA,GACA,MAAA,GACA,WAAA,GACA,0BAAA,IAA2B,YAC3B,OAAA,GACA,cAAA,GACA,aAAA,GACA,SAAA,GACA,gBAAA,GACA,SAAA,GACA,UAAA,GACA,iBAAA,EAAA,MACI;AACJ,QAAM,EAAE,KAAA,GAAK,QAAA,EAAA,IAAW,GAAU,EAChC,WAAA,EACF,CAAC,GAEK,IAAQ,GAAS,GAGjB,EAAE,WAAA,EAAA,IAAc,GAAa,GAC7B,EAAE,SAAA,EAAA,IAAY,GAAS,GACvB,EAAE,YAAA,GAAY,aAAA,EAAA,IAAgB,GAA4B,GAE1D,IAAO,oBAAoB,KAAQ,EAAK,gBACxC,IAAa,IAAO,EAAE,UAAU,EAAE,gBAAgB,GAAK,EAAE,IAAI;AAGnE,EAAA,EAAA,MAAgB;AACd,IAAI,MACG,EAAK,qBAcR,EAAQ,EAAc,EAAK,QAAQ,GAAG,CAAU,KAb5C,EAAK,KAAK,WAAW,KAAK,IAC5B,EAAY;AAAA,MACV,GAAG;AAAA,MACH,oBAAoB;AAAA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;AAAA,IACjB,mBAAmB,EAAK,wBAAwB,GAAW;AAAA,IACtD,KAAA;AAAA,IACL,OAAO,EAAK,eAAe,EAAK,YAAY,SAAS,IAAI,EAAK,cAAc,EAAK;AAAA,IACxE,SAAA;AAAA,IACO,gBAAA;AAAA,EACjB,CAAA;AAEL"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { AnalyticSession } from '../analytics';
|
|
2
2
|
import { BeatApi, BeatFeedbackRequest } from '../../core/api/BeatApi';
|
|
3
3
|
import { Beat } from '../../core/types/Beat';
|
|
4
|
+
import { AnalyticEventProps } from '../../core/types/Analytics';
|
|
4
5
|
export interface ErrPromise<TSuccess, TError = unknown> {
|
|
5
6
|
then<TResult1 = TSuccess, TResult2 = never>(onfulfilled?: ((value: TSuccess) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: TError) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
|
|
6
7
|
catch<TResult = never>(onrejected?: ((reason: TError) => TResult | PromiseLike<TResult>) | undefined | null): Promise<TSuccess | TResult>;
|
|
7
8
|
}
|
|
8
9
|
export declare class InsightsMicroWidgetStore {
|
|
9
|
-
onAnalyticEvent: (event: string, session: AnalyticSession) => ErrPromise<string, AnalyticSession>;
|
|
10
|
+
onAnalyticEvent: (event: string, session: AnalyticSession, props?: AnalyticEventProps) => ErrPromise<string, AnalyticSession>;
|
|
10
11
|
onAnalyticPageView: (event: string, session: AnalyticSession) => ErrPromise<string, AnalyticSession>;
|
|
11
12
|
beatApi: BeatApi;
|
|
12
13
|
constructor();
|