@mx-cartographer/experiences 9.7.69 → 9.7.71-alpha-ram-usp-2
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 +16 -0
- package/dist/core/stores/GlobalCopyStore.d.ts +6 -0
- package/dist/core/stores/GlobalCopyStore.es.js +14 -8
- package/dist/core/stores/GlobalCopyStore.es.js.map +1 -1
- package/dist/core/stores/GoalStore.d.ts +1 -1
- package/dist/core/stores/GoalStore.es.js +1 -1
- package/dist/core/stores/GoalStore.es.js.map +1 -1
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +24 -0
- package/dist/goals/GoalsMiniWidget.d.ts +7 -0
- package/dist/goals/{GoalsMicroWidget.es.js → GoalsMiniWidget.es.js} +14 -14
- package/dist/goals/GoalsMiniWidget.es.js.map +1 -0
- package/dist/goals/components/{micro/GoalMicroStatusCard.d.ts → mini/GoalMiniStatusCard.d.ts} +1 -1
- package/dist/goals/components/{micro/GoalMicroStatusCard.es.js → mini/GoalMiniStatusCard.es.js} +2 -2
- package/dist/goals/components/mini/GoalMiniStatusCard.es.js.map +1 -0
- package/dist/goals/components/{micro/GoalsMicroEmptyState.d.ts → mini/GoalsMiniEmptyState.d.ts} +1 -1
- package/dist/goals/components/{micro/GoalsMicroEmptyState.es.js → mini/GoalsMiniEmptyState.es.js} +2 -2
- package/dist/goals/components/mini/GoalsMiniEmptyState.es.js.map +1 -0
- package/dist/goals/index.d.ts +1 -1
- package/dist/goals/index.es.js +4 -4
- package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.d.ts +6 -0
- package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js +168 -0
- package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +11 -11
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js +3 -3
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +92 -59
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.d.ts +9 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js +9 -5
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js +5 -5
- package/dist/insights-v2/components/AccountHeroCard.es.js +7 -5
- package/dist/insights-v2/components/AccountHeroCard.es.js.map +1 -1
- package/dist/insights-v2/components/BaseLayout.es.js +157 -138
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/components/CtaStatus.d.ts +14 -1
- package/dist/insights-v2/components/CtaStatus.es.js +76 -38
- package/dist/insights-v2/components/CtaStatus.es.js.map +1 -1
- package/dist/insights-v2/components/InsightTransactionRow.d.ts +3 -1
- package/dist/insights-v2/components/InsightTransactionRow.es.js +36 -20
- package/dist/insights-v2/components/InsightTransactionRow.es.js.map +1 -1
- package/dist/insights-v2/components/StatusPill.es.js +12 -11
- package/dist/insights-v2/components/StatusPill.es.js.map +1 -1
- package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.d.ts +4 -0
- package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.es.js +10 -0
- package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.es.js.map +1 -0
- package/dist/insights-v2/components/TransactionListCard.d.ts +5 -1
- package/dist/insights-v2/components/TransactionListCard.es.js +69 -49
- package/dist/insights-v2/components/TransactionListCard.es.js.map +1 -1
- package/dist/insights-v2/components/shared/StatusSnackbar.d.ts +10 -1
- package/dist/insights-v2/components/shared/StatusSnackbar.es.js +27 -11
- package/dist/insights-v2/components/shared/StatusSnackbar.es.js.map +1 -1
- package/dist/insights-v2/components/shared/elevation.d.ts +16 -0
- package/dist/insights-v2/components/shared/elevation.es.js +15 -0
- package/dist/insights-v2/components/shared/elevation.es.js.map +1 -0
- package/dist/insights-v2/ctaActions/ctaConfig.es.js +23 -9
- package/dist/insights-v2/ctaActions/ctaConfig.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/runCtaAction.d.ts +7 -0
- package/dist/insights-v2/ctaActions/runCtaAction.es.js +73 -62
- package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/subscriptionAnswer.d.ts +10 -1
- package/dist/insights-v2/ctaActions/subscriptionAnswer.es.js +115 -0
- package/dist/insights-v2/ctaActions/subscriptionAnswer.es.js.map +1 -0
- package/dist/insights-v2/ctaActions/types.d.ts +5 -2
- package/dist/insights-v2/ctaActions/useCtaAction.d.ts +6 -0
- package/dist/insights-v2/ctaActions/useCtaAction.es.js +32 -27
- package/dist/insights-v2/ctaActions/useCtaAction.es.js.map +1 -1
- package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js +1 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
- package/dist/insights-v2/mappings/blocks.es.js +74 -68
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/dist/microinsights/MicroCardTemplate.es.js +21 -17
- package/dist/microinsights/MicroCardTemplate.es.js.map +1 -1
- package/dist/microinsights/cards/InsightCard.es.js +91 -86
- package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
- package/dist/microinsights/cards/MicroCtaStatus.d.ts +18 -0
- package/dist/microinsights/cards/MicroCtaStatus.es.js +44 -0
- package/dist/microinsights/cards/MicroCtaStatus.es.js.map +1 -0
- package/dist/microinsights/stores/CopyStore.d.ts +4 -1
- package/dist/microinsights/stores/CopyStore.es.js +13 -10
- package/dist/microinsights/stores/CopyStore.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/goals/GoalsMicroWidget.d.ts +0 -7
- package/dist/goals/GoalsMicroWidget.es.js.map +0 -1
- package/dist/goals/components/micro/GoalMicroStatusCard.es.js.map +0 -1
- package/dist/goals/components/micro/GoalsMicroEmptyState.es.js.map +0 -1
|
@@ -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 DebtsBlock,\n DetailedAccountBlock,\n DonutChartBlock,\n GoalsBlock,\n MerchantBlock,\n DoubleBarChartBlock,\n DoubleProgressBarBlock,\n NoSpendDaysBlock,\n RepeatingTransactionBlock,\n SaveExtraBlock,\n SavingsOpportunityBlock,\n SVGImageBlock,\n UpcomingSubscriptionBlock,\n WithdrawalBlock,\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 { FeedbackModalActionBlock } from '../actionBlocks/FeedbackModalActionBlock'\nimport { ConnectionDetailActionBlock } from '../actionBlocks/ConnectionDetailActionBlock'\nimport { ConnectWidgetActionBlock } from '../actionBlocks/ConnectWidgetActionBlock'\nimport { SurveyModalActionBlock } from '../actionBlocks/SurveyModalActionBlock'\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 { useTransactionHistoryPrepare } from '../actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare'\nimport {\n TransactionDetailsBlock,\n useTransactionDetailsPrepare,\n} from '../actionBlocks/TransactionDetailsBlock'\nimport {\n RecurringTransactionBlock,\n useRecurringTransactionPrepare,\n} from '../actionBlocks/RecurringTransactionBlock'\nimport { TransactionListBlock } from '../actionBlocks/TransactionListBlock'\nimport { getTransactionListDrawerTitle } from '../actionBlocks/TransactionListBlock/layout'\nimport { RemainingCashBlock } from '../actionBlocks/RemainingCashBlock'\nimport { AmountInputModalBlock } from '../actionBlocks/AmountInputModalBlock'\nimport { OverdraftBlock, useOverdraftPrepare } from '../actionBlocks/OverdraftBlock'\nimport { AccountListBlock, useAccountListPrepare } from '../actionBlocks/AccountListBlock'\nimport { EmergencySavingsBlock } from '../actionBlocks/EmergencySavingsBlock'\nimport {\n CreditUtilizationBlock,\n useCreditUtilizationPrepare,\n} from '../actionBlocks/CreditUtilizationBlock'\nimport {\n PayoffCalculatorBlock,\n usePayoffCalculatorPrepare,\n} from '../actionBlocks/PayoffCalculatorBlock'\nimport { BudgetDetailsBlock } from '../actionBlocks/BudgetDetailsBlock'\nimport { AccountDetailsBlock, useAccountDetailsPrepare } from '../actionBlocks/AccountDetailsBlock'\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// Re-exported so existing `hasDrawerBlock` imports from this module keep working.\nexport { hasDrawerBlock } from './hasDrawerBlock'\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, with the beat available\n // for blocks that title from beat fields (e.g. transaction-list reads insights_payload.title).\n // Falls back to the CTA label when the resolver returns an empty string / is absent.\n title?: (variant: string | null | undefined, copy: GlobalCopy, beat?: Beat) => string\n // 'drawer' (default) or 'modal' (component renders its own dialog, no Drawer wrapper).\n presentation?: 'drawer' | 'modal'\n}\n\n// Registry of drawer drilldowns, keyed by the `block` name the backend sends Add\n// `usePrepare` when the block needs to load data before rendering.\n\n/**\n * A registry entry whose fields read their imports when used, not when this module loads. Some\n * registered blocks render `TransactionDetails`, whose embedded card mounts `ActionBlockLayer`,\n * which imports this registry: when one of those blocks loads first, its own import is not\n * initialised yet while this module evaluates, so a value copied at load would be `undefined`\n * (or throw under native ES modules). Reading on access sees the finished import.\n */\nconst liveEntry = (resolve: () => ActionBlockEntry): ActionBlockEntry => ({\n get Component() {\n return resolve().Component\n },\n get usePrepare() {\n return resolve().usePrepare\n },\n get title() {\n return resolve().title\n },\n get presentation() {\n return resolve().presentation\n },\n})\n\nexport const actionBlocks = {\n [actionBlocksKey.PLACEHOLDER_ACTION_BLOCK]: liveEntry(() => ({\n Component: PlaceholderActionBlock,\n usePrepare: noop,\n title: () => 'Action Block Layer Drilldown',\n })),\n [actionBlocksKey.MAKE_TRANSFER_ACTION_BLOCK]: liveEntry(() => ({\n Component: MakeTransferActionBlockLayer,\n usePrepare: noop,\n title: getMakeTransferDrawerTitle,\n })),\n [actionBlocksKey.TRANSCATION_HISTORY_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionHistoryBlock,\n usePrepare: useTransactionHistoryPrepare,\n title: getDrawerHeaderTitle,\n })),\n [actionBlocksKey.TRANSACTION_DETAILS_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionDetailsBlock,\n usePrepare: useTransactionDetailsPrepare,\n title: () => 'Transaction Details',\n })),\n // Expense Details for one recurring subscription. Which subscription a beat names is resolved in\n // `RecurringTransactionBlock/subscriptionBeats.ts`, not through this registry.\n [actionBlocksKey.RECURRING_TRANSACTION_ACTION_BLOCK]: liveEntry(() => ({\n Component: RecurringTransactionBlock,\n usePrepare: useRecurringTransactionPrepare,\n title: (_variant, copy) => copy.recurring?.expense_details ?? '',\n })),\n // Remaining Cash for the Payday Cash Left Over Status beat. Store-driven: reuses the recurring\n // loader, which also loads accounts and categories, so CashflowStore's computeds are ready.\n [actionBlocksKey.REMAINING_CASH_ACTION_BLOCK]: liveEntry(() => ({\n Component: RemainingCashBlock,\n usePrepare: useRecurringTransactionPrepare,\n title: (_variant, copy) => copy.insights_feed?.remaining_cash?.title ?? '',\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]: liveEntry(() => ({\n Component: ContactSupportActionBlock,\n usePrepare: noop,\n title: (_variant, copy) => copy.help?.request_support ?? '',\n })),\n [actionBlocksKey.FEEDBACK_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: FeedbackModalActionBlock,\n usePrepare: noop,\n presentation: 'modal',\n })),\n [actionBlocksKey.CONNECTION_DETAIL_ACTION_BLOCK]: liveEntry(() => ({\n Component: ConnectionDetailActionBlock,\n usePrepare: noop,\n title: (_variant, copy) =>\n copy.insights_feed?.connection_details?.connection_details_drawer_title ?? '',\n })),\n // Boots MX's Connect widget (web-widget-sdk iframe) inside the action\n // drawer; the drawer title falls back to the CTA label.\n [actionBlocksKey.CONNECT_WIDGET_ACTION_BLOCK]: liveEntry(() => ({\n Component: ConnectWidgetActionBlock,\n usePrepare: noop,\n })),\n [actionBlocksKey.SURVEY_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: SurveyModalActionBlock,\n usePrepare: noop,\n presentation: 'modal',\n })),\n [actionBlocksKey.TRANSACTION_LIST_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionListBlock,\n usePrepare: useTransactionDetailsPrepare,\n title: getTransactionListDrawerTitle,\n })),\n // One whole-dollar setting in a dialog; the CTA variant picks which (low-balance threshold or\n // safety net). A modal: no drawer, so no drawer title.\n [actionBlocksKey.AMOUNT_INPUT_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: AmountInputModalBlock,\n presentation: 'modal',\n // Loads inside the block: it mounts only while open, so mounting is the open-time load.\n usePrepare: noop,\n })),\n // Transparent Overdraft's \"Learn more\": the projected overdraft, its account and the confidence\n // meter. Titled from the beat, as the pulse drawer was.\n [actionBlocksKey.OVERDRAFT_ACTION_BLOCK]: liveEntry(() => ({\n Component: OverdraftBlock,\n usePrepare: useOverdraftPrepare,\n title: (_variant, _copy, beat) => beat?.insights_payload?.title ?? '',\n })),\n // Credit Utilization's \"Learn more\": donut summary, legend and the per-card list. Loads accounts\n // for the institution logos; the rows themselves ride on the beat.\n [actionBlocksKey.CREDIT_UTILIZATION_ACTION_BLOCK]: liveEntry(() => ({\n Component: CreditUtilizationBlock,\n usePrepare: useCreditUtilizationPrepare,\n title: (_variant, copy) => copy.insights_feed?.credit_utilization?.title ?? '',\n })),\n [actionBlocksKey.EMERGENCY_SAVINGS_ACTION_BLOCK]: liveEntry(() => ({\n Component: EmergencySavingsBlock,\n usePrepare: noop,\n title: (_variant, _copy, beat) => beat?.insights_payload?.title ?? '',\n })),\n // Monthly Credit Card Interest Summary's \"Learn how to save\": the credit card payoff calculator.\n [actionBlocksKey.PAYOFF_CALCULATOR_ACTION_BLOCK]: liveEntry(() => ({\n Component: PayoffCalculatorBlock,\n usePrepare: usePayoffCalculatorPrepare,\n title: (_variant, copy) => copy.insights_feed?.payoff_calculator?.title ?? '',\n })),\n [actionBlocksKey.BUDGET_DETAILS_ACTION_BLOCK]: liveEntry(() => ({\n Component: BudgetDetailsBlock,\n usePrepare: noop,\n title: (_variant, copy, beat) =>\n beat?.insights_payload?.title || copy.budgets?.details_title || '',\n })),\n // The accounts widget's account details (header, trend chart, tabs, connection, actions) for the\n // beat's primary account. Shared by every beat that opens an account.\n [actionBlocksKey.ACCOUNT_DETAILS_ACTION_BLOCK]: liveEntry(() => ({\n Component: AccountDetailsBlock,\n usePrepare: useAccountDetailsPrepare,\n title: (_variant, copy) => copy.accounts?.account_details ?? '',\n })),\n // Monthly Obligations Status's account list: the beat's calculation and the accounts behind it.\n [actionBlocksKey.ACCOUNT_LIST_ACTION_BLOCK]: liveEntry(() => ({\n Component: AccountListBlock,\n usePrepare: useAccountListPrepare,\n title: (_variant, copy) => copy.insights_feed?.account_list?.title ?? '',\n })),\n} as Record<string, ActionBlockEntry>\n\nexport const blocks = {\n account_block: AccountBlock,\n account_switch_block: AccountSwitchBlock,\n direct_deposit_block: DetailedAccountBlock,\n bar_chart_block: BarchartBlock,\n budget_block: BudgetBlock,\n debts_block: DebtsBlock,\n donut_chart_block: DonutChartBlock,\n double_bar_chart_block: DoubleBarChartBlock,\n double_progress_bar_block: DoubleProgressBarBlock,\n goals_block: GoalsBlock,\n image_block: ImageBlock,\n merchant_block: MerchantBlock,\n no_spend_days_block: NoSpendDaysBlock,\n repeating_transaction_block: RepeatingTransactionBlock,\n save_extra_block: SaveExtraBlock,\n savings_opportunity_block: SavingsOpportunityBlock,\n step_chart_block: StepChartBlock,\n svg_image_block: SVGImageBlock,\n upcoming_bill_block: RepeatingTransactionBlock,\n upcoming_subscription_block: UpcomingSubscriptionBlock,\n withdrawal_block: WithdrawalBlock,\n transaction_block: TransactionBlock,\n} as Record<string, React.ComponentType<{ payload: InsightsPayload; beatGuid?: string }>>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,IAAM,IAAA,CAAQ,MAAwB;AAAC,GA0BjC,IAAA,CAAa,OAAuD;AAAA,EACxE,IAAI,YAAY;AACd,WAAO,EAAQ,EAAE;AAAA,EACnB;AAAA,EACA,IAAI,aAAa;AACf,WAAO,EAAQ,EAAE;AAAA,EACnB;AAAA,EACA,IAAI,QAAQ;AACV,WAAO,EAAQ,EAAE;AAAA,EACnB;AAAA,EACA,IAAI,eAAe;AACjB,WAAO,EAAQ,EAAE;AAAA,EACnB;AACF,IAEa,KAAe;AAAA,EACzB,CAAA,EAAgB,wBAAA,GAA2B,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AAAA,IAC9D,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAA,CAAQ,GAAU,GAAM,MACtB,GAAM,kBAAkB,SAAS,EAAK,SAAS,iBAAiB;AAAA,EACpE,EAAE;AAAA,EAGD,CAAA,EAAgB,4BAAA,GAA+B,EAAA,OAAiB;AAAA,IAC/D,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAA,CAAQ,GAAU,MAAS,EAAK,UAAU,mBAAmB;AAAA,EAC/D,EAAE;AAAA,EAED,CAAA,EAAgB,yBAAA,GAA4B,EAAA,OAAiB;AAAA,IAC5D,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAA,CAAQ,GAAU,MAAS,EAAK,eAAe,cAAc,SAAS;AAAA,EACxE,EAAE;AACJ,GAEa,KAAS;AAAA,EACpB,eAAe;AAAA,EACf,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,wBAAwB;AAAA,EACxB,2BAA2B;AAAA,EAC3B,aAAa;AAAA,EACb,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,qBAAqB;AAAA,EACrB,6BAA6B;AAAA,EAC7B,kBAAkB;AAAA,EAClB,2BAA2B;AAAA,EAC3B,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,qBAAqB;AAAA,EACrB,6BAA6B;AAAA,EAC7B,kBAAkB;AAAA,EAClB,mBAAmB;AACrB"}
|
|
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 DebtsBlock,\n DetailedAccountBlock,\n DonutChartBlock,\n GoalsBlock,\n MerchantBlock,\n DoubleBarChartBlock,\n DoubleProgressBarBlock,\n NoSpendDaysBlock,\n RepeatingTransactionBlock,\n SaveExtraBlock,\n SavingsOpportunityBlock,\n SVGImageBlock,\n UpcomingSubscriptionBlock,\n WithdrawalBlock,\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 { FeedbackModalActionBlock } from '../actionBlocks/FeedbackModalActionBlock'\nimport { ConnectionDetailActionBlock } from '../actionBlocks/ConnectionDetailActionBlock'\nimport { ConnectWidgetActionBlock } from '../actionBlocks/ConnectWidgetActionBlock'\nimport { SurveyModalActionBlock } from '../actionBlocks/SurveyModalActionBlock'\nimport { SubscriptionStatusModalBlock } from '../actionBlocks/SubscriptionStatusModalBlock'\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 { useTransactionHistoryPrepare } from '../actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare'\nimport {\n TransactionDetailsBlock,\n useTransactionDetailsPrepare,\n} from '../actionBlocks/TransactionDetailsBlock'\nimport {\n RecurringTransactionBlock,\n useRecurringTransactionPrepare,\n} from '../actionBlocks/RecurringTransactionBlock'\nimport { TransactionListBlock } from '../actionBlocks/TransactionListBlock'\nimport { getTransactionListDrawerTitle } from '../actionBlocks/TransactionListBlock/layout'\nimport { RemainingCashBlock } from '../actionBlocks/RemainingCashBlock'\nimport { AmountInputModalBlock } from '../actionBlocks/AmountInputModalBlock'\nimport { OverdraftBlock, useOverdraftPrepare } from '../actionBlocks/OverdraftBlock'\nimport { AccountListBlock, useAccountListPrepare } from '../actionBlocks/AccountListBlock'\nimport { EmergencySavingsBlock } from '../actionBlocks/EmergencySavingsBlock'\nimport {\n CreditUtilizationBlock,\n useCreditUtilizationPrepare,\n} from '../actionBlocks/CreditUtilizationBlock'\nimport {\n PayoffCalculatorBlock,\n usePayoffCalculatorPrepare,\n} from '../actionBlocks/PayoffCalculatorBlock'\nimport { BudgetDetailsBlock } from '../actionBlocks/BudgetDetailsBlock'\nimport { AccountDetailsBlock, useAccountDetailsPrepare } from '../actionBlocks/AccountDetailsBlock'\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// Re-exported so existing `hasDrawerBlock` imports from this module keep working.\nexport { hasDrawerBlock } from './hasDrawerBlock'\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, with the beat available\n // for blocks that title from beat fields (e.g. transaction-list reads insights_payload.title).\n // Falls back to the CTA label when the resolver returns an empty string / is absent.\n title?: (variant: string | null | undefined, copy: GlobalCopy, beat?: Beat) => string\n // 'drawer' (default) or 'modal' (component renders its own dialog, no Drawer wrapper).\n presentation?: 'drawer' | 'modal'\n}\n\n// Registry of drawer drilldowns, keyed by the `block` name the backend sends Add\n// `usePrepare` when the block needs to load data before rendering.\n\n/**\n * A registry entry whose fields read their imports when used, not when this module loads. Some\n * registered blocks render `TransactionDetails`, whose embedded card mounts `ActionBlockLayer`,\n * which imports this registry: when one of those blocks loads first, its own import is not\n * initialised yet while this module evaluates, so a value copied at load would be `undefined`\n * (or throw under native ES modules). Reading on access sees the finished import.\n */\nconst liveEntry = (resolve: () => ActionBlockEntry): ActionBlockEntry => ({\n get Component() {\n return resolve().Component\n },\n get usePrepare() {\n return resolve().usePrepare\n },\n get title() {\n return resolve().title\n },\n get presentation() {\n return resolve().presentation\n },\n})\n\nexport const actionBlocks = {\n [actionBlocksKey.PLACEHOLDER_ACTION_BLOCK]: liveEntry(() => ({\n Component: PlaceholderActionBlock,\n usePrepare: noop,\n title: () => 'Action Block Layer Drilldown',\n })),\n [actionBlocksKey.MAKE_TRANSFER_ACTION_BLOCK]: liveEntry(() => ({\n Component: MakeTransferActionBlockLayer,\n usePrepare: noop,\n title: getMakeTransferDrawerTitle,\n })),\n [actionBlocksKey.TRANSCATION_HISTORY_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionHistoryBlock,\n usePrepare: useTransactionHistoryPrepare,\n title: getDrawerHeaderTitle,\n })),\n [actionBlocksKey.TRANSACTION_DETAILS_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionDetailsBlock,\n usePrepare: useTransactionDetailsPrepare,\n title: () => 'Transaction Details',\n })),\n // Expense Details for one recurring subscription. Which subscription a beat names is resolved in\n // `RecurringTransactionBlock/subscriptionBeats.ts`, not through this registry.\n [actionBlocksKey.RECURRING_TRANSACTION_ACTION_BLOCK]: liveEntry(() => ({\n Component: RecurringTransactionBlock,\n usePrepare: useRecurringTransactionPrepare,\n title: (_variant, copy) => copy.recurring?.expense_details ?? '',\n })),\n // Remaining Cash for the Payday Cash Left Over Status beat. Store-driven: reuses the recurring\n // loader, which also loads accounts and categories, so CashflowStore's computeds are ready.\n [actionBlocksKey.REMAINING_CASH_ACTION_BLOCK]: liveEntry(() => ({\n Component: RemainingCashBlock,\n usePrepare: useRecurringTransactionPrepare,\n title: (_variant, copy) => copy.insights_feed?.remaining_cash?.title ?? '',\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]: liveEntry(() => ({\n Component: ContactSupportActionBlock,\n usePrepare: noop,\n title: (_variant, copy) => copy.help?.request_support ?? '',\n })),\n [actionBlocksKey.FEEDBACK_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: FeedbackModalActionBlock,\n usePrepare: noop,\n presentation: 'modal',\n })),\n [actionBlocksKey.CONNECTION_DETAIL_ACTION_BLOCK]: liveEntry(() => ({\n Component: ConnectionDetailActionBlock,\n usePrepare: noop,\n title: (_variant, copy) =>\n copy.insights_feed?.connection_details?.connection_details_drawer_title ?? '',\n })),\n // Boots MX's Connect widget (web-widget-sdk iframe) inside the action\n // drawer; the drawer title falls back to the CTA label.\n [actionBlocksKey.CONNECT_WIDGET_ACTION_BLOCK]: liveEntry(() => ({\n Component: ConnectWidgetActionBlock,\n usePrepare: noop,\n })),\n [actionBlocksKey.SURVEY_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: SurveyModalActionBlock,\n usePrepare: noop,\n presentation: 'modal',\n })),\n // Unexpected Subscription Payment's Subscription Status modal.\n [actionBlocksKey.SUBSCRIPTION_STATUS_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: SubscriptionStatusModalBlock,\n usePrepare: noop,\n presentation: 'modal',\n })),\n [actionBlocksKey.TRANSACTION_LIST_ACTION_BLOCK]: liveEntry(() => ({\n Component: TransactionListBlock,\n usePrepare: useTransactionDetailsPrepare,\n title: getTransactionListDrawerTitle,\n })),\n // One whole-dollar setting in a dialog; the CTA variant picks which (low-balance threshold or\n // safety net). A modal: no drawer, so no drawer title.\n [actionBlocksKey.AMOUNT_INPUT_MODAL_ACTION_BLOCK]: liveEntry(() => ({\n Component: AmountInputModalBlock,\n presentation: 'modal',\n // Loads inside the block: it mounts only while open, so mounting is the open-time load.\n usePrepare: noop,\n })),\n // Transparent Overdraft's \"Learn more\": the projected overdraft, its account and the confidence\n // meter. Titled from the beat, as the pulse drawer was.\n [actionBlocksKey.OVERDRAFT_ACTION_BLOCK]: liveEntry(() => ({\n Component: OverdraftBlock,\n usePrepare: useOverdraftPrepare,\n title: (_variant, _copy, beat) => beat?.insights_payload?.title ?? '',\n })),\n // Credit Utilization's \"Learn more\": donut summary, legend and the per-card list. Loads accounts\n // for the institution logos; the rows themselves ride on the beat.\n [actionBlocksKey.CREDIT_UTILIZATION_ACTION_BLOCK]: liveEntry(() => ({\n Component: CreditUtilizationBlock,\n usePrepare: useCreditUtilizationPrepare,\n title: (_variant, copy) => copy.insights_feed?.credit_utilization?.title ?? '',\n })),\n [actionBlocksKey.EMERGENCY_SAVINGS_ACTION_BLOCK]: liveEntry(() => ({\n Component: EmergencySavingsBlock,\n usePrepare: noop,\n title: (_variant, _copy, beat) => beat?.insights_payload?.title ?? '',\n })),\n // Monthly Credit Card Interest Summary's \"Learn how to save\": the credit card payoff calculator.\n [actionBlocksKey.PAYOFF_CALCULATOR_ACTION_BLOCK]: liveEntry(() => ({\n Component: PayoffCalculatorBlock,\n usePrepare: usePayoffCalculatorPrepare,\n title: (_variant, copy) => copy.insights_feed?.payoff_calculator?.title ?? '',\n })),\n [actionBlocksKey.BUDGET_DETAILS_ACTION_BLOCK]: liveEntry(() => ({\n Component: BudgetDetailsBlock,\n usePrepare: noop,\n title: (_variant, copy, beat) =>\n beat?.insights_payload?.title || copy.budgets?.details_title || '',\n })),\n // The accounts widget's account details (header, trend chart, tabs, connection, actions) for the\n // beat's primary account. Shared by every beat that opens an account.\n [actionBlocksKey.ACCOUNT_DETAILS_ACTION_BLOCK]: liveEntry(() => ({\n Component: AccountDetailsBlock,\n usePrepare: useAccountDetailsPrepare,\n title: (_variant, copy) => copy.accounts?.account_details ?? '',\n })),\n // Monthly Obligations Status's account list: the beat's calculation and the accounts behind it.\n [actionBlocksKey.ACCOUNT_LIST_ACTION_BLOCK]: liveEntry(() => ({\n Component: AccountListBlock,\n usePrepare: useAccountListPrepare,\n title: (_variant, copy) => copy.insights_feed?.account_list?.title ?? '',\n })),\n} as Record<string, ActionBlockEntry>\n\nexport const blocks = {\n account_block: AccountBlock,\n account_switch_block: AccountSwitchBlock,\n direct_deposit_block: DetailedAccountBlock,\n bar_chart_block: BarchartBlock,\n budget_block: BudgetBlock,\n debts_block: DebtsBlock,\n donut_chart_block: DonutChartBlock,\n double_bar_chart_block: DoubleBarChartBlock,\n double_progress_bar_block: DoubleProgressBarBlock,\n goals_block: GoalsBlock,\n image_block: ImageBlock,\n merchant_block: MerchantBlock,\n no_spend_days_block: NoSpendDaysBlock,\n repeating_transaction_block: RepeatingTransactionBlock,\n save_extra_block: SaveExtraBlock,\n savings_opportunity_block: SavingsOpportunityBlock,\n step_chart_block: StepChartBlock,\n svg_image_block: SVGImageBlock,\n upcoming_bill_block: RepeatingTransactionBlock,\n upcoming_subscription_block: UpcomingSubscriptionBlock,\n withdrawal_block: WithdrawalBlock,\n transaction_block: TransactionBlock,\n} as Record<string, React.ComponentType<{ payload: InsightsPayload; beatGuid?: string }>>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwEA,IAAM,IAAA,CAAQ,MAAwB;AAAC,GA0BjC,IAAA,CAAa,OAAuD;AAAA,EACxE,IAAI,YAAY;AACd,WAAO,EAAQ,EAAE;AAAA,EACnB;AAAA,EACA,IAAI,aAAa;AACf,WAAO,EAAQ,EAAE;AAAA,EACnB;AAAA,EACA,IAAI,QAAQ;AACV,WAAO,EAAQ,EAAE;AAAA,EACnB;AAAA,EACA,IAAI,eAAe;AACjB,WAAO,EAAQ,EAAE;AAAA,EACnB;AACF,IAEa,KAAe;AAAA,EACzB,CAAA,EAAgB,wBAAA,GAA2B,EAAA,OAAiB;AAAA,IAC3D,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAA,MAAa;AAAA,EACf,EAAE;AAAA,EACD,CAAA,EAAgB,0BAAA,GAA6B,EAAA,OAAiB;AAAA,IAC7D,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAO;AAAA,EACT,EAAE;AAAA,EACD,CAAA,EAAgB,gCA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B;AAAA,EACpE,EAAE;AAAA,EAGD,CAAA,EAAgB,4BAAA,GAA+B,EAAA,OAAiB;AAAA,IAC/D,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAA,CAAQ,GAAU,MAAS,EAAK,UAAU,mBAAmB;AAAA,EAC/D,EAAE;AAAA,EAED,CAAA,EAAgB,yBAAA,GAA4B,EAAA,OAAiB;AAAA,IAC5D,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAA,CAAQ,GAAU,MAAS,EAAK,eAAe,cAAc,SAAS;AAAA,EACxE,EAAE;AACJ,GAEa,KAAS;AAAA,EACpB,eAAe;AAAA,EACf,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,wBAAwB;AAAA,EACxB,2BAA2B;AAAA,EAC3B,aAAa;AAAA,EACb,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,qBAAqB;AAAA,EACrB,6BAA6B;AAAA,EAC7B,kBAAkB;AAAA,EAClB,2BAA2B;AAAA,EAC3B,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,qBAAqB;AAAA,EACrB,6BAA6B;AAAA,EAC7B,kBAAkB;AAAA,EAClB,mBAAmB;AACrB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import D from "react";
|
|
2
|
-
import { P as
|
|
2
|
+
import { P as m, Text as b } from "@mxenabled/mxui";
|
|
3
3
|
import { Close as M } from "@mxenabled/mx-icons";
|
|
4
4
|
import { Fragment as T, jsx as o, jsxs as e } from "react/jsx-runtime";
|
|
5
5
|
import { Box as j, Button as u, Card as I, CardActionArea as R, IconButton as S, Stack as i } from "@mui/material";
|
|
6
|
-
var O = D.forwardRef(function({ ariaLabel: f, closeAriaLabel: w, description: v, elevation: P, icon:
|
|
6
|
+
var O = D.forwardRef(function({ ariaLabel: f, closeAriaLabel: w, description: v, elevation: P, icon: n, isActiveCard: l, heightOverrides: W, onClose: p, onCardClick: r, onPrimaryAction: s, onSecondaryAction: h, primaryActionText: d, secondaryActionText: c, title: k, variant: y, widthOverrides: x, ...C }, B) {
|
|
7
7
|
const a = !!(s && d), g = /* @__PURE__ */ e(T, { children: [p && /* @__PURE__ */ o(S, {
|
|
8
8
|
"aria-label": w,
|
|
9
9
|
onClick: (t) => {
|
|
@@ -34,20 +34,20 @@ var O = D.forwardRef(function({ ariaLabel: f, closeAriaLabel: w, description: v,
|
|
|
34
34
|
flexDirection: "row",
|
|
35
35
|
gap: 12
|
|
36
36
|
},
|
|
37
|
-
children: [
|
|
37
|
+
children: [n, /* @__PURE__ */ e(i, {
|
|
38
38
|
sx: { gap: 6 },
|
|
39
39
|
children: [/* @__PURE__ */ o(i, {
|
|
40
40
|
sx: {
|
|
41
41
|
flexDirection: "row",
|
|
42
42
|
justifyContent: "space-between"
|
|
43
43
|
},
|
|
44
|
-
children: /* @__PURE__ */ o(
|
|
44
|
+
children: /* @__PURE__ */ o(m, {
|
|
45
45
|
bold: !0,
|
|
46
46
|
sx: { lineHeight: "16px" },
|
|
47
47
|
variant: "body1",
|
|
48
|
-
children:
|
|
48
|
+
children: k
|
|
49
49
|
})
|
|
50
|
-
}), /* @__PURE__ */ o(
|
|
50
|
+
}), /* @__PURE__ */ o(m, {
|
|
51
51
|
dangerouslySetInnerHTML: { __html: v },
|
|
52
52
|
sx: {
|
|
53
53
|
display: "-webkit-box",
|
|
@@ -70,7 +70,7 @@ var O = D.forwardRef(function({ ariaLabel: f, closeAriaLabel: w, description: v,
|
|
|
70
70
|
flexDirection: "row",
|
|
71
71
|
height: 28,
|
|
72
72
|
pb: 4,
|
|
73
|
-
pl:
|
|
73
|
+
pl: n ? 36 : 0
|
|
74
74
|
},
|
|
75
75
|
children: [a && /* @__PURE__ */ o(u, {
|
|
76
76
|
onClick: (t) => {
|
|
@@ -84,11 +84,12 @@ var O = D.forwardRef(function({ ariaLabel: f, closeAriaLabel: w, description: v,
|
|
|
84
84
|
},
|
|
85
85
|
size: "small",
|
|
86
86
|
sx: {
|
|
87
|
+
minWidth: 0,
|
|
87
88
|
px: 8,
|
|
88
|
-
ml:
|
|
89
|
+
ml: n ? 0 : -8
|
|
89
90
|
},
|
|
90
91
|
variant: "text",
|
|
91
|
-
children: /* @__PURE__ */ o(
|
|
92
|
+
children: /* @__PURE__ */ o(b, {
|
|
92
93
|
bold: !0,
|
|
93
94
|
variant: "body2",
|
|
94
95
|
children: d
|
|
@@ -104,9 +105,12 @@ var O = D.forwardRef(function({ ariaLabel: f, closeAriaLabel: w, description: v,
|
|
|
104
105
|
t.stopPropagation();
|
|
105
106
|
},
|
|
106
107
|
size: "small",
|
|
107
|
-
sx: {
|
|
108
|
+
sx: {
|
|
109
|
+
minWidth: 0,
|
|
110
|
+
px: 8
|
|
111
|
+
},
|
|
108
112
|
variant: "text",
|
|
109
|
-
children: /* @__PURE__ */ o(
|
|
113
|
+
children: /* @__PURE__ */ o(b, {
|
|
110
114
|
bold: !0,
|
|
111
115
|
sx: { color: "text.secondary" },
|
|
112
116
|
variant: "body2",
|
|
@@ -123,18 +127,18 @@ var O = D.forwardRef(function({ ariaLabel: f, closeAriaLabel: w, description: v,
|
|
|
123
127
|
role: "group",
|
|
124
128
|
sx: {
|
|
125
129
|
backgroundColor: "background.paper",
|
|
126
|
-
height:
|
|
130
|
+
height: W ? "100%" : 120,
|
|
127
131
|
minWidth: x ? `${x}px` : "100%",
|
|
128
132
|
position: "relative",
|
|
129
133
|
my: 1,
|
|
130
134
|
borderRadius: 2
|
|
131
135
|
},
|
|
132
|
-
tabIndex:
|
|
133
|
-
variant:
|
|
134
|
-
...
|
|
135
|
-
children:
|
|
136
|
+
tabIndex: r || !l ? -1 : 0,
|
|
137
|
+
variant: y,
|
|
138
|
+
...C,
|
|
139
|
+
children: r ? /* @__PURE__ */ o(R, {
|
|
136
140
|
component: "div",
|
|
137
|
-
onClick:
|
|
141
|
+
onClick: r,
|
|
138
142
|
sx: {
|
|
139
143
|
pb: 8,
|
|
140
144
|
pt: 16,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MicroCardTemplate.es.js","names":[],"sources":["../../src/microinsights/MicroCardTemplate.tsx"],"sourcesContent":["import React from 'react'\nimport { Box, Button, Card, CardActionArea, IconButton, Stack } from '@mui/material'\n\nimport { P, Text } from '@mxenabled/mxui'\nimport { Close } from '@mxenabled/mx-icons'\n\ninterface MicroCardTemplateProps {\n ariaLabel?: string\n closeAriaLabel?: string\n description: string\n elevation?: number\n icon?: React.ReactNode\n isActiveCard?: boolean\n heightOverrides?: string | number\n onClose?: () => void\n onCardClick?: () => void\n onPrimaryAction?: () => void\n onSecondaryAction?: () => void\n primaryActionText?: string\n secondaryActionText?: string\n title: string\n variant?: 'outlined' | 'elevation' | undefined\n widthOverrides?: string | number\n}\n\nconst MicroCardTemplate = React.forwardRef<HTMLDivElement, MicroCardTemplateProps>(\n function MicroCardTemplate(\n {\n ariaLabel,\n closeAriaLabel,\n description,\n elevation,\n icon,\n isActiveCard,\n heightOverrides,\n onClose,\n onCardClick,\n onPrimaryAction,\n onSecondaryAction,\n primaryActionText,\n secondaryActionText,\n title,\n variant,\n widthOverrides,\n ...restProps\n },\n inViewRef,\n ) {\n const hasPrimaryAction = Boolean(onPrimaryAction && primaryActionText)\n const hasSecondaryAction = Boolean(onSecondaryAction && secondaryActionText)\n\n const innerContent = (\n <>\n {onClose && (\n <IconButton\n aria-label={closeAriaLabel}\n onClick={(e) => {\n e.stopPropagation()\n onClose?.()\n }}\n onMouseDown={(e) => {\n e.stopPropagation()\n }}\n onTouchStart={(e) => {\n e.stopPropagation()\n }}\n sx={{ minHeight: 40, minWidth: 40, position: 'absolute', right: 4, top: 4 }}\n >\n <Close />\n </IconButton>\n )}\n <Stack sx={{ gap: 6, height: '100%', justifyContent: 'space-between' }}>\n <Stack sx={{ flexDirection: 'row', gap: 12 }}>\n {icon}\n <Stack sx={{ gap: 6 }}>\n <Stack sx={{ flexDirection: 'row', justifyContent: 'space-between' }}>\n <P bold={true} sx={{ lineHeight: '16px' }} variant=\"body1\">\n {title}\n </P>\n </Stack>\n <P\n dangerouslySetInnerHTML={{ __html: description }}\n sx={{\n display: '-webkit-box',\n fontWeight: 'fontWeightRegular',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: hasPrimaryAction ? 2 : 3,\n '& .bold-copy': {\n fontWeight: 'bold',\n fontFamily: 'inherit',\n },\n }}\n variant=\"subtitle2\"\n />\n </Stack>\n </Stack>\n\n {hasPrimaryAction && (\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n height: 28,\n pb: 4,\n pl: icon ? 36 : 0,\n }}\n >\n {hasPrimaryAction && (\n <Button\n onClick={(e) => {\n e.stopPropagation()\n onPrimaryAction?.()\n }}\n onMouseDown={(e) => {\n e.stopPropagation()\n }}\n onTouchStart={(e) => {\n e.stopPropagation()\n }}\n size=\"small\"\n sx={{ px: 8, ml: icon ? 0 : -8 }}\n variant=\"text\"\n >\n <Text bold={true} variant=\"body2\">\n {primaryActionText}\n </Text>\n </Button>\n )}\n\n {hasSecondaryAction && (\n <Button\n onClick={(e) => {\n e.stopPropagation()\n onSecondaryAction?.()\n }}\n onMouseDown={(e) => {\n e.stopPropagation()\n }}\n onTouchStart={(e) => {\n e.stopPropagation()\n }}\n size=\"small\"\n sx={{ px: 8 }}\n variant=\"text\"\n >\n <Text bold={true} sx={{ color: 'text.secondary' }} variant=\"body2\">\n {secondaryActionText}\n </Text>\n </Button>\n )}\n </Stack>\n )}\n </Stack>\n </>\n )\n\n return (\n <Card\n aria-hidden={!isActiveCard}\n aria-label={ariaLabel}\n elevation={elevation}\n ref={inViewRef}\n role=\"group\"\n sx={{\n backgroundColor: 'background.paper',\n height: heightOverrides ? '100%' : 120,\n minWidth: widthOverrides ? `${widthOverrides}px` : '100%',\n position: 'relative',\n my: 1,\n borderRadius: 2,\n }}\n tabIndex={onCardClick || !isActiveCard ? -1 : 0}\n variant={variant}\n {...restProps}\n >\n {onCardClick ? (\n <CardActionArea\n component=\"div\"\n onClick={onCardClick}\n sx={{\n pb: 8,\n pt: 16,\n px: 16,\n height: '100%',\n }}\n >\n {innerContent}\n </CardActionArea>\n ) : (\n <Box sx={{ pb: 8, pt: 16, px: 16, height: '100%' }}>{innerContent}</Box>\n )}\n </Card>\n )\n },\n)\n\nexport default MicroCardTemplate\n"],"mappings":";;;;;AAyBA,IAAM,IAAoB,EAAM,WAC9B,SACE,EACE,WAAA,GACA,gBAAA,GACA,aAAA,GACA,WAAA,GACA,MAAA,GACA,cAAA,GACA,iBAAA,GACA,SAAA,GACA,aAAA,GACA,iBAAA,GACA,mBAAA,GACA,mBAAA,GACA,qBAAA,GACA,OAAA,GACA,SAAA,GACA,gBAAA,GACA,GAAG,EAAA,GAEL,GACA;AACA,QAAM,IAAmB,GAAQ,KAAmB,IAG9C,IACJ,gBAAA,EAAA,GAAA,EAAA,UAAA,CACG,KACC,gBAAA,EAAC,GAAD;AAAA,IACE,cAAY;AAAA,IACZ,SAAA,CAAU,MAAM;AACd,MAAA,EAAE,gBAAgB,GAClB,IAAU;AAAA,IACZ;AAAA,IACA,aAAA,CAAc,MAAM;AAClB,MAAA,EAAE,gBAAgB;AAAA,IACpB;AAAA,IACA,cAAA,CAAe,MAAM;AACnB,MAAA,EAAE,gBAAgB;AAAA,IACpB;AAAA,IACA,IAAI;AAAA,MAAE,WAAW;AAAA,MAAI,UAAU;AAAA,MAAI,UAAU;AAAA,MAAY,OAAO;AAAA,MAAG,KAAK;AAAA,IAAE;AAAA,IAE1E,UAAA,gBAAA,EAAC,GAAD,CAAQ,CAAA;AAAA,EACE,CAAA,GAEd,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,KAAK;AAAA,MAAG,QAAQ;AAAA,MAAQ,gBAAgB;AAAA,IAAgB;AAAA,IAArE,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MAAO,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version":3,"file":"MicroCardTemplate.es.js","names":[],"sources":["../../src/microinsights/MicroCardTemplate.tsx"],"sourcesContent":["import React from 'react'\nimport { Box, Button, Card, CardActionArea, IconButton, Stack } from '@mui/material'\n\nimport { P, Text } from '@mxenabled/mxui'\nimport { Close } from '@mxenabled/mx-icons'\n\ninterface MicroCardTemplateProps {\n ariaLabel?: string\n closeAriaLabel?: string\n description: string\n elevation?: number\n icon?: React.ReactNode\n isActiveCard?: boolean\n heightOverrides?: string | number\n onClose?: () => void\n onCardClick?: () => void\n onPrimaryAction?: () => void\n onSecondaryAction?: () => void\n primaryActionText?: string\n secondaryActionText?: string\n title: string\n variant?: 'outlined' | 'elevation' | undefined\n widthOverrides?: string | number\n}\n\nconst MicroCardTemplate = React.forwardRef<HTMLDivElement, MicroCardTemplateProps>(\n function MicroCardTemplate(\n {\n ariaLabel,\n closeAriaLabel,\n description,\n elevation,\n icon,\n isActiveCard,\n heightOverrides,\n onClose,\n onCardClick,\n onPrimaryAction,\n onSecondaryAction,\n primaryActionText,\n secondaryActionText,\n title,\n variant,\n widthOverrides,\n ...restProps\n },\n inViewRef,\n ) {\n const hasPrimaryAction = Boolean(onPrimaryAction && primaryActionText)\n const hasSecondaryAction = Boolean(onSecondaryAction && secondaryActionText)\n\n const innerContent = (\n <>\n {onClose && (\n <IconButton\n aria-label={closeAriaLabel}\n onClick={(e) => {\n e.stopPropagation()\n onClose?.()\n }}\n onMouseDown={(e) => {\n e.stopPropagation()\n }}\n onTouchStart={(e) => {\n e.stopPropagation()\n }}\n sx={{ minHeight: 40, minWidth: 40, position: 'absolute', right: 4, top: 4 }}\n >\n <Close />\n </IconButton>\n )}\n <Stack sx={{ gap: 6, height: '100%', justifyContent: 'space-between' }}>\n <Stack sx={{ flexDirection: 'row', gap: 12 }}>\n {icon}\n <Stack sx={{ gap: 6 }}>\n <Stack sx={{ flexDirection: 'row', justifyContent: 'space-between' }}>\n <P bold={true} sx={{ lineHeight: '16px' }} variant=\"body1\">\n {title}\n </P>\n </Stack>\n <P\n dangerouslySetInnerHTML={{ __html: description }}\n sx={{\n display: '-webkit-box',\n fontWeight: 'fontWeightRegular',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: hasPrimaryAction ? 2 : 3,\n '& .bold-copy': {\n fontWeight: 'bold',\n fontFamily: 'inherit',\n },\n }}\n variant=\"subtitle2\"\n />\n </Stack>\n </Stack>\n\n {hasPrimaryAction && (\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n height: 28,\n pb: 4,\n pl: icon ? 36 : 0,\n }}\n >\n {hasPrimaryAction && (\n <Button\n onClick={(e) => {\n e.stopPropagation()\n onPrimaryAction?.()\n }}\n onMouseDown={(e) => {\n e.stopPropagation()\n }}\n onTouchStart={(e) => {\n e.stopPropagation()\n }}\n size=\"small\"\n // No min-width: MUI's 64px would center a short label (\"Undo\") off the text's edge.\n sx={{ minWidth: 0, px: 8, ml: icon ? 0 : -8 }}\n variant=\"text\"\n >\n <Text bold={true} variant=\"body2\">\n {primaryActionText}\n </Text>\n </Button>\n )}\n\n {hasSecondaryAction && (\n <Button\n onClick={(e) => {\n e.stopPropagation()\n onSecondaryAction?.()\n }}\n onMouseDown={(e) => {\n e.stopPropagation()\n }}\n onTouchStart={(e) => {\n e.stopPropagation()\n }}\n size=\"small\"\n sx={{ minWidth: 0, px: 8 }}\n variant=\"text\"\n >\n <Text bold={true} sx={{ color: 'text.secondary' }} variant=\"body2\">\n {secondaryActionText}\n </Text>\n </Button>\n )}\n </Stack>\n )}\n </Stack>\n </>\n )\n\n return (\n <Card\n aria-hidden={!isActiveCard}\n aria-label={ariaLabel}\n elevation={elevation}\n ref={inViewRef}\n role=\"group\"\n sx={{\n backgroundColor: 'background.paper',\n height: heightOverrides ? '100%' : 120,\n minWidth: widthOverrides ? `${widthOverrides}px` : '100%',\n position: 'relative',\n my: 1,\n borderRadius: 2,\n }}\n tabIndex={onCardClick || !isActiveCard ? -1 : 0}\n variant={variant}\n {...restProps}\n >\n {onCardClick ? (\n <CardActionArea\n component=\"div\"\n onClick={onCardClick}\n sx={{\n pb: 8,\n pt: 16,\n px: 16,\n height: '100%',\n }}\n >\n {innerContent}\n </CardActionArea>\n ) : (\n <Box sx={{ pb: 8, pt: 16, px: 16, height: '100%' }}>{innerContent}</Box>\n )}\n </Card>\n )\n },\n)\n\nexport default MicroCardTemplate\n"],"mappings":";;;;;AAyBA,IAAM,IAAoB,EAAM,WAC9B,SACE,EACE,WAAA,GACA,gBAAA,GACA,aAAA,GACA,WAAA,GACA,MAAA,GACA,cAAA,GACA,iBAAA,GACA,SAAA,GACA,aAAA,GACA,iBAAA,GACA,mBAAA,GACA,mBAAA,GACA,qBAAA,GACA,OAAA,GACA,SAAA,GACA,gBAAA,GACA,GAAG,EAAA,GAEL,GACA;AACA,QAAM,IAAmB,GAAQ,KAAmB,IAG9C,IACJ,gBAAA,EAAA,GAAA,EAAA,UAAA,CACG,KACC,gBAAA,EAAC,GAAD;AAAA,IACE,cAAY;AAAA,IACZ,SAAA,CAAU,MAAM;AACd,MAAA,EAAE,gBAAgB,GAClB,IAAU;AAAA,IACZ;AAAA,IACA,aAAA,CAAc,MAAM;AAClB,MAAA,EAAE,gBAAgB;AAAA,IACpB;AAAA,IACA,cAAA,CAAe,MAAM;AACnB,MAAA,EAAE,gBAAgB;AAAA,IACpB;AAAA,IACA,IAAI;AAAA,MAAE,WAAW;AAAA,MAAI,UAAU;AAAA,MAAI,UAAU;AAAA,MAAY,OAAO;AAAA,MAAG,KAAK;AAAA,IAAE;AAAA,IAE1E,UAAA,gBAAA,EAAC,GAAD,CAAQ,CAAA;AAAA,EACE,CAAA,GAEd,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,KAAK;AAAA,MAAG,QAAQ;AAAA,MAAQ,gBAAgB;AAAA,IAAgB;AAAA,IAArE,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI;AAAA,QAA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;AAAA,MACV,SAAS;AAAA,MACT,IAAI;AAAA,QACF,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,QAAQ;AAAA,MACV;AAAA,MAEC,UAAA;AAAA,IACa,CAAA,IAEhB,gBAAA,EAAC,GAAD;AAAA,MAAK,IAAI;AAAA,QAAE,IAAI;AAAA,QAAG,IAAI;AAAA,QAAI,IAAI;AAAA,QAAI,QAAQ;AAAA,MAAO;AAAA,MAAI,UAAA;AAAA,IAAkB,CAAA;AAAA,EAErE,CAAA;AAEV,CACF"}
|
|
@@ -1,33 +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
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { GlobalDataContext as $ } from "../../common/context/GlobalDataProvider.es.js";
|
|
2
|
+
import { slot as f } from "../../core/types/Insights.es.js";
|
|
3
|
+
import { resolveInsightRender as z } from "../../insights-v2/resolveInsightRender.es.js";
|
|
4
|
+
import { hasDrawerBlock as H } from "../../insights-v2/mappings/hasDrawerBlock.es.js";
|
|
5
|
+
import K from "../../insights-v2/components/LogoFromGuid.es.js";
|
|
6
|
+
import { statusIconName as Z, statusIconPalette as J } from "../../insights-v2/components/statusIcon.es.js";
|
|
7
|
+
import { ON_CLICK_EVENT as v, ON_VIEW_EVENT as Q, ON_VIEW_FIRST_TIME_EVENT as U } from "../constants/Analytics.es.js";
|
|
8
|
+
import w from "../beaticons/BeatMaterialIcon.es.js";
|
|
9
|
+
import { BeatIcon as X } from "../beaticons/BeatIcon.es.js";
|
|
10
|
+
import { useCopyStore as Y, useEvent as b, useInsightsMicroWidgetStore as ii } from "../context/hooks.es.js";
|
|
11
|
+
import F from "../MicroCardTemplate.es.js";
|
|
12
|
+
import ti from "./InlineActionBlock.es.js";
|
|
13
|
+
import { MicroCtaStatusGate as ei } from "./MicroCtaStatus.es.js";
|
|
14
|
+
import oi from "../../insights-v2/components/InsightErrorCard.es.js";
|
|
15
|
+
import ri, { useEffect as O, useState as ni } from "react";
|
|
16
|
+
import { Fragment as si, jsx as e, jsxs as ai } from "react/jsx-runtime";
|
|
17
|
+
import { alpha as P, useTheme as li } from "@mui/material/styles";
|
|
18
|
+
import mi from "@mui/material/Box";
|
|
19
|
+
import { useInView as ci } from "react-intersection-observer";
|
|
20
|
+
var pi = 32, vi = ({ ariaLabel: p, beat: i, elevation: h, inDescriptionCtaBehavior: W = "external", index: d, isActiveCard: _, onCardClick: s, posthog: r, widthOverrides: a, variant: I, showIcon: y, heightOverrides: u }) => {
|
|
21
|
+
const { ref: g, inView: l } = ci({ threshold: 1 }), C = li(), { cardsCopy: G } = Y(), { onEvent: m } = b(), { updateBeat: q, updateOffer: A } = ii();
|
|
22
|
+
O(() => {
|
|
23
|
+
l && (i.has_been_displayed ? m(Q(i.template)) : (i.guid.startsWith("OFR") ? A({
|
|
23
24
|
...i,
|
|
24
25
|
has_been_displayed: !0
|
|
25
|
-
}) :
|
|
26
|
+
}) : q({
|
|
26
27
|
...i,
|
|
27
28
|
has_been_displayed: !0
|
|
28
|
-
}),
|
|
29
|
-
}, [
|
|
30
|
-
if (
|
|
29
|
+
}), m(U(i.template))));
|
|
30
|
+
}, [l]), O(() => {
|
|
31
|
+
if (l && i) if (i.template === "MarketingOffer") {
|
|
31
32
|
const t = i;
|
|
32
33
|
r?.capture("viewed_messaging_insight", {
|
|
33
34
|
template: i.template,
|
|
@@ -39,15 +40,15 @@ var si = 32, Ti = ({ ariaLabel: m, beat: i, elevation: u, inDescriptionCtaBehavi
|
|
|
39
40
|
} else r?.capture("viewed_insight", {
|
|
40
41
|
beat_guid: i.guid,
|
|
41
42
|
template: i.template,
|
|
42
|
-
position:
|
|
43
|
+
position: d
|
|
43
44
|
});
|
|
44
45
|
}, [
|
|
45
46
|
i,
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
d,
|
|
48
|
+
l
|
|
48
49
|
]);
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
50
|
+
const E = z(i), o = E === "v2" ? i.insights_payload : void 0, D = ri.useContext($) !== null, x = W === "internal" && D && H(o?.in_description_cta?.block), [k, j] = ni(0), c = () => {
|
|
51
|
+
if (x ? j((t) => t + 1) : s && s(i), m(v(i.template)), i.template === "MarketingOffer") {
|
|
51
52
|
const t = i;
|
|
52
53
|
r?.capture("clicked_messaging_insight", {
|
|
53
54
|
template: i.template,
|
|
@@ -59,74 +60,78 @@ var si = 32, Ti = ({ ariaLabel: m, beat: i, elevation: u, inDescriptionCtaBehavi
|
|
|
59
60
|
} else r?.capture("clicked_insight", {
|
|
60
61
|
beat_guid: i.guid,
|
|
61
62
|
template: i.template,
|
|
62
|
-
position:
|
|
63
|
+
position: d
|
|
63
64
|
});
|
|
64
65
|
};
|
|
65
|
-
|
|
66
|
-
"aria-hidden": !
|
|
67
|
-
"aria-label":
|
|
66
|
+
return E === "error" ? /* @__PURE__ */ e(mi, {
|
|
67
|
+
"aria-hidden": !_,
|
|
68
|
+
"aria-label": p,
|
|
68
69
|
"aria-roledescription": "slide",
|
|
69
|
-
ref:
|
|
70
|
+
ref: g,
|
|
70
71
|
role: "group",
|
|
71
72
|
sx: {
|
|
72
|
-
height:
|
|
73
|
-
minWidth:
|
|
73
|
+
height: u ? "100%" : 120,
|
|
74
|
+
minWidth: a ? `${a}px` : "100%",
|
|
74
75
|
my: 1
|
|
75
76
|
},
|
|
76
|
-
children: /* @__PURE__ */ e(
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
77
|
+
children: /* @__PURE__ */ e(oi, { beat: i })
|
|
78
|
+
}) : o ? /* @__PURE__ */ e(ei, {
|
|
79
|
+
beat: i,
|
|
80
|
+
posthog: r,
|
|
81
|
+
children: ({ presentation: n }) => {
|
|
82
|
+
const N = n?.kind === "status" ? n : void 0, T = f(o.instance_slot.data, "logo"), B = f(o.instance_slot.data, N && f(o.instance_slot.data, "reviewed_icon") ? "reviewed_icon" : "icon"), R = Z(B?.guid), M = J(B?.color), L = n ? N?.action?.label : o.primary_cta?.label || o.in_description_cta?.label || void 0, V = () => {
|
|
83
|
+
s && s(i), m(v(i.template));
|
|
84
|
+
}, S = /* @__PURE__ */ e(F, {
|
|
85
|
+
"aria-roledescription": "slide",
|
|
86
|
+
ariaLabel: p,
|
|
87
|
+
description: o.description.html_text,
|
|
88
|
+
elevation: h,
|
|
89
|
+
heightOverrides: u,
|
|
90
|
+
icon: y && (T ? /* @__PURE__ */ e(K, {
|
|
91
|
+
logo: T,
|
|
92
|
+
size: pi
|
|
93
|
+
}) : R ? /* @__PURE__ */ e(w, {
|
|
94
|
+
bgColor: P(C.palette[M].main, 0.15),
|
|
95
|
+
iconColor: M,
|
|
96
|
+
name: R
|
|
97
|
+
}) : /* @__PURE__ */ e(w, {
|
|
98
|
+
bgColor: P(C.palette.primary.main, 0.15),
|
|
99
|
+
name: "lightbulb"
|
|
100
|
+
})),
|
|
101
|
+
isActiveCard: _,
|
|
102
|
+
onCardClick: n ? V : c,
|
|
103
|
+
onPrimaryAction: n ? V : c,
|
|
104
|
+
primaryActionText: L,
|
|
105
|
+
ref: g,
|
|
106
|
+
title: n?.title || o.title || "",
|
|
107
|
+
variant: I,
|
|
108
|
+
widthOverrides: a
|
|
109
|
+
});
|
|
110
|
+
return x ? /* @__PURE__ */ ai(si, { children: [S, k > 0 && /* @__PURE__ */ e(ti, {
|
|
111
|
+
beat: i,
|
|
112
|
+
openRequest: k,
|
|
113
|
+
posthog: r
|
|
114
|
+
})] }) : S;
|
|
115
|
+
}
|
|
116
|
+
}) : /* @__PURE__ */ e(F, {
|
|
112
117
|
"aria-roledescription": "slide",
|
|
113
|
-
ariaLabel:
|
|
118
|
+
ariaLabel: p,
|
|
114
119
|
description: i?.html_micro_description && i?.html_micro_description.length > 0 ? i.html_micro_description : i.html_description || "",
|
|
115
|
-
elevation:
|
|
116
|
-
heightOverrides:
|
|
117
|
-
icon:
|
|
118
|
-
isActiveCard:
|
|
119
|
-
onCardClick:
|
|
120
|
-
onPrimaryAction:
|
|
121
|
-
primaryActionText: i.micro_call_to_action ||
|
|
122
|
-
ref:
|
|
120
|
+
elevation: h,
|
|
121
|
+
heightOverrides: u,
|
|
122
|
+
icon: y && /* @__PURE__ */ e(X, { beat: i }),
|
|
123
|
+
isActiveCard: _,
|
|
124
|
+
onCardClick: c,
|
|
125
|
+
onPrimaryAction: c,
|
|
126
|
+
primaryActionText: i.micro_call_to_action || G?.micro_card_cta,
|
|
127
|
+
ref: g,
|
|
123
128
|
title: i.micro_title && i.micro_title.length > 0 ? i.micro_title : i.title,
|
|
124
|
-
variant:
|
|
125
|
-
widthOverrides:
|
|
129
|
+
variant: I,
|
|
130
|
+
widthOverrides: a
|
|
126
131
|
});
|
|
127
132
|
};
|
|
128
133
|
export {
|
|
129
|
-
|
|
134
|
+
vi as InsightCard
|
|
130
135
|
};
|
|
131
136
|
|
|
132
137
|
//# 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'\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 const rowLogo = slot<LogoRef>(v2Payload.instance_slot.data, 'logo')\n const statusIcon = slot<LogoRef>(v2Payload.instance_slot.data, 'icon')\n const statusName = statusIconName(statusIcon?.guid)\n const statusPalette = statusIconPalette(statusIcon?.color)\n const actionLabel =\n v2Payload.primary_cta?.label || v2Payload.in_description_cta?.label || undefined\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 bgColor={alpha(theme.palette.primary.main, 0.15)} name=\"lightbulb\" />\n ))\n }\n isActiveCard={isActiveCard}\n onCardClick={handleClick}\n onPrimaryAction={handleClick}\n primaryActionText={actionLabel}\n ref={ref}\n 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 <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":";;;;;;;;;;;;;;;;;;AAkCA,IAAM,KAA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tD,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 // ************** 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 }\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,EA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AM;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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Beat } from '../../core/types/Beat';
|
|
3
|
+
import { CtaPresentation } from '../../insights-v2/ctaActions/types';
|
|
4
|
+
import { TheWholeHog } from '../interfaces';
|
|
5
|
+
export interface MicroCtaStatus {
|
|
6
|
+
/** The micro action's presentation. */
|
|
7
|
+
presentation?: CtaPresentation;
|
|
8
|
+
}
|
|
9
|
+
interface MicroCtaStatusGateProps {
|
|
10
|
+
beat: Beat;
|
|
11
|
+
posthog?: TheWholeHog;
|
|
12
|
+
children: (status: MicroCtaStatus) => React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/** Resolves the micro card's action CTA (`cardActionCta`) through the CTA layer, as full and mini do. */
|
|
15
|
+
export declare const MicroCtaStatusGate: (({ beat, posthog, children, }: MicroCtaStatusGateProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
18
|
+
export default MicroCtaStatusGate;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { GlobalDataContext as S } from "../../common/context/GlobalDataProvider.es.js";
|
|
2
|
+
import { cardActionCta as C, resolveCtaState as g, resolveStep as v } from "../../insights-v2/ctaActions/runCtaAction.es.js";
|
|
3
|
+
import { useCopyStore as y, useStore as h } from "../context/hooks.es.js";
|
|
4
|
+
import { buildMicroBeatActions as x } from "../beatActions.es.js";
|
|
5
|
+
import { useContext as M, useEffect as p, useMemo as A } from "react";
|
|
6
|
+
import { observer as F } from "mobx-react-lite";
|
|
7
|
+
import { Fragment as m, jsx as f } from "react/jsx-runtime";
|
|
8
|
+
var b = F(function({ beat: o, posthog: s, children: a }) {
|
|
9
|
+
const l = M(S), i = h(), t = l?.globalStore, n = C(o.insights_payload), e = n.action_key ? n : void 0, r = e ? v({ cta: e }) : void 0, u = A(() => x({
|
|
10
|
+
store: i,
|
|
11
|
+
template: o.template,
|
|
12
|
+
posthog: s
|
|
13
|
+
}), [
|
|
14
|
+
i,
|
|
15
|
+
o.template,
|
|
16
|
+
s
|
|
17
|
+
]), { insightsFeedCopy: c } = y();
|
|
18
|
+
if (p(() => {
|
|
19
|
+
t && t.copyStore.setSection("insights_feed", c);
|
|
20
|
+
}, [t, c]), p(() => {
|
|
21
|
+
t && r?.prepare?.({
|
|
22
|
+
beat: o,
|
|
23
|
+
stores: t
|
|
24
|
+
});
|
|
25
|
+
}, [
|
|
26
|
+
o.guid,
|
|
27
|
+
r?.prepare,
|
|
28
|
+
t
|
|
29
|
+
]), !t || !e || !r?.presenter) return /* @__PURE__ */ f(m, { children: a({}) });
|
|
30
|
+
const { presentation: d } = g({
|
|
31
|
+
beat: o,
|
|
32
|
+
cta: e,
|
|
33
|
+
slot: "primary",
|
|
34
|
+
stores: t,
|
|
35
|
+
hostActions: u
|
|
36
|
+
});
|
|
37
|
+
return /* @__PURE__ */ f(m, { children: a({ presentation: d }) });
|
|
38
|
+
});
|
|
39
|
+
export {
|
|
40
|
+
b as MicroCtaStatusGate,
|
|
41
|
+
b as default
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=MicroCtaStatus.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MicroCtaStatus.es.js","names":[],"sources":["../../../src/microinsights/cards/MicroCtaStatus.tsx"],"sourcesContent":["import React, { useContext, useEffect, useMemo } from 'react'\nimport { observer } from 'mobx-react-lite'\n\n// Leaf imports.\nimport { GlobalDataContext } from '../../common/context/GlobalDataProvider'\nimport type { Beat } from '../../core/types/Beat'\nimport {\n cardActionCta,\n resolveCtaState,\n resolveStep,\n} from '../../insights-v2/ctaActions/runCtaAction'\nimport type { CtaPresentation } from '../../insights-v2/ctaActions/types'\nimport { buildMicroBeatActions } from '../beatActions'\nimport { useCopyStore, useStore } from '../context/hooks'\nimport type { TheWholeHog } from '../interfaces'\n\nexport interface MicroCtaStatus {\n /** The micro action's presentation. */\n presentation?: CtaPresentation\n}\n\ninterface MicroCtaStatusGateProps {\n beat: Beat\n posthog?: TheWholeHog\n children: (status: MicroCtaStatus) => React.ReactNode\n}\n\n/** Resolves the micro card's action CTA (`cardActionCta`) through the CTA layer, as full and mini do. */\nexport const MicroCtaStatusGate = observer(function MicroCtaStatusGate({\n beat,\n posthog,\n children,\n}: MicroCtaStatusGateProps) {\n const globalData = useContext(GlobalDataContext)\n const appStore = useStore()\n const stores = globalData?.globalStore\n const actionCta = cardActionCta(beat.insights_payload)\n const ctaRef = actionCta.action_key ? actionCta : undefined\n const step = ctaRef ? resolveStep({ cta: ctaRef }) : undefined\n\n // The step's context (the presenter's Undo is never pressed from micro).\n const hostActions = useMemo(\n () => buildMicroBeatActions({ store: appStore, template: beat.template, posthog }),\n [appStore, beat.template, posthog],\n )\n\n // A micro host may not load the global copy: hand over the insights_feed micro loaded with its own\n // copy (one request per widget), so the presenter reads the same words as on full and mini.\n const { insightsFeedCopy } = useCopyStore()\n\n useEffect(() => {\n if (stores) stores.copyStore.setSection('insights_feed', insightsFeedCopy)\n }, [stores, insightsFeedCopy])\n\n useEffect(() => {\n if (stores) step?.prepare?.({ beat, stores })\n // eslint-disable-next-line react-hooks/exhaustive-deps -- once per beat\n }, [beat.guid, step?.prepare, stores])\n\n if (!stores || !ctaRef || !step?.presenter) return <>{children({})}</>\n\n const { presentation } = resolveCtaState({\n beat,\n cta: ctaRef,\n slot: 'primary',\n stores,\n hostActions,\n })\n\n return <>{children({ presentation })}</>\n})\n\nexport default MicroCtaStatusGate\n"],"mappings":";;;;;;;AA4BA,IAAa,IAAqB,EAAS,SAA4B,EACrE,MAAA,GACA,SAAA,GACA,UAAA,EAAA,GAC0B;AAC1B,QAAM,IAAa,EAAW,CAAiB,GACzC,IAAW,EAAS,GACpB,IAAS,GAAY,aACrB,IAAY,EAAc,EAAK,gBAAgB,GAC/C,IAAS,EAAU,aAAa,IAAY,QAC5C,IAAO,IAAS,EAAY,EAAE,KAAK,EAAO,CAAC,IAAI,QAG/C,IAAc,EAAA,MACZ,EAAsB;AAAA,IAAE,OAAO;AAAA,IAAU,UAAU,EAAK;AAAA,IAAU,SAAA;AAAA,EAAQ,CAAC,GACjF;AAAA,IAAC;AAAA,IAAU,EAAK;AAAA,IAAU;AAAA,EAAO,CACnC,GAIM,EAAE,kBAAA,EAAA,IAAqB,EAAa;AAW1C,MATA,EAAA,MAAgB;AACd,IAAI,KAAQ,EAAO,UAAU,WAAW,iBAAiB,CAAgB;AAAA,EAC3E,GAAG,CAAC,GAAQ,CAAgB,CAAC,GAE7B,EAAA,MAAgB;AACd,IAAI,KAAQ,GAAM,UAAU;AAAA,MAAE,MAAA;AAAA,MAAM,QAAA;AAAA,IAAO,CAAC;AAAA,EAE9C,GAAG;AAAA,IAAC,EAAK;AAAA,IAAM,GAAM;AAAA,IAAS;AAAA,EAAM,CAAC,GAEjC,CAAC,KAAU,CAAC,KAAU,CAAC,GAAM,UAAW,QAAO,gBAAA,EAAA,GAAA,EAAA,UAAG,EAAS,CAAC,CAAC,EAAI,CAAA;AAErE,QAAM,EAAE,cAAA,EAAA,IAAiB,EAAgB;AAAA,IACvC,MAAA;AAAA,IACA,KAAK;AAAA,IACL,MAAM;AAAA,IACN,QAAA;AAAA,IACA,aAAA;AAAA,EACF,CAAC;AAED,SAAO,gBAAA,EAAA,GAAA,EAAA,UAAG,EAAS,EAAE,cAAA,EAAa,CAAC,EAAI,CAAA;AACzC,CAAC"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { GlobalCopyApi } from '../../core/api/GlobalCopyApi';
|
|
2
|
-
import { MicroInsightsCopy } from '../../core/types/localization';
|
|
2
|
+
import { InsightsFeedCopy, MicroInsightsCopy } from '../../core/types/localization';
|
|
3
3
|
export declare class CopyStore {
|
|
4
4
|
copyApi: GlobalCopyApi;
|
|
5
5
|
copyObject: MicroInsightsCopy;
|
|
6
6
|
namespace: string;
|
|
7
7
|
translationKey: string;
|
|
8
|
+
/** Insights 2.0 state words (a CTA presenter's title and label), which hosts may not load for micro. */
|
|
9
|
+
insightsFeedKey: string;
|
|
10
|
+
insightsFeedCopy: InsightsFeedCopy | undefined;
|
|
8
11
|
constructor();
|
|
9
12
|
initialize: (endpoint: string, token: string) => Promise<void>;
|
|
10
13
|
loadCopy: () => Promise<void>;
|