@mx-cartographer/experiences 9.7.206 → 10.0.0
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 +5 -0
- package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsChart.d.ts +2 -0
- package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsChart.es.js +39 -23
- package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsChart.es.js.map +1 -1
- package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsHeader.d.ts +3 -1
- package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsHeader.es.js +37 -33
- package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsHeader.es.js.map +1 -1
- package/dist/accounts/utils/AccountFields.d.ts +3 -1
- package/dist/accounts/utils/AccountFields.es.js +39 -39
- package/dist/accounts/utils/AccountFields.es.js.map +1 -1
- package/dist/common/components/charts/LineChart.d.ts +4 -0
- package/dist/common/components/charts/LineChart.es.js +114 -112
- package/dist/common/components/charts/LineChart.es.js.map +1 -1
- package/dist/common/components/charts/linechart/CustomLegend.es.js +24 -21
- package/dist/common/components/charts/linechart/CustomLegend.es.js.map +1 -1
- package/dist/core/types/Insights.d.ts +9 -1
- package/dist/core/types/Insights.es.js.map +1 -1
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +42 -0
- package/dist/core/types/localization/index.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/AccountDetailsBlock/AccountDetailsBlock.d.ts +7 -1
- package/dist/insights-v2/actionBlocks/AccountDetailsBlock/AccountDetailsBlock.es.js +39 -20
- package/dist/insights-v2/actionBlocks/AccountDetailsBlock/AccountDetailsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountDetailsBlock/SpendVsIncomeChart.d.ts +4 -0
- package/dist/insights-v2/actionBlocks/AccountDetailsBlock/SpendVsIncomeChart.es.js +42 -0
- package/dist/insights-v2/actionBlocks/AccountDetailsBlock/SpendVsIncomeChart.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/AccountDetailsBlock/SpendVsPaymentChart.d.ts +7 -0
- package/dist/insights-v2/actionBlocks/AccountDetailsBlock/SpendVsPaymentChart.es.js +54 -0
- package/dist/insights-v2/actionBlocks/AccountDetailsBlock/SpendVsPaymentChart.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +10 -10
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/CreateBudgetDialog.es.js +24 -23
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/CreateBudgetDialog.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js +75 -73
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.d.ts +5 -1
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.es.js +21 -21
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetSummary.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.d.ts +11 -0
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.es.js +65 -58
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsV2.es.js +17 -17
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsV2.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/BalanceStepper.es.js +9 -10
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/BalanceStepper.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/SaveEnoughToLiveOnBottomSection.es.js +21 -22
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/SaveEnoughToLiveOnBottomSection.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js +35 -35
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js +44 -49
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.es.js +19 -16
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesContent.d.ts +2 -2
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesContent.es.js +212 -166
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesContent.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/StepIcon.d.ts +4 -0
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/StepIcon.es.js +24 -0
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/StepIcon.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/layout.d.ts +6 -5
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/layout.es.js +38 -38
- package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js +1 -1
- package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.d.ts +1 -5
- package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.es.js +37 -36
- package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/layout.d.ts +9 -11
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/layout.es.js +12 -6
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js +46 -40
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +141 -126
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +8 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +243 -200
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.d.ts +2 -0
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js +54 -53
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListHeaderIconTile.d.ts +6 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListHeaderIconTile.es.js +14 -13
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListHeaderIconTile.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.d.ts +4 -3
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js +24 -21
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.d.ts +14 -4
- package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js +79 -67
- package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChart.d.ts +3 -1
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChart.es.js +48 -32
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChart.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js +19 -14
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/layout.d.ts +4 -0
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/layout.es.js +19 -15
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js +26 -19
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.d.ts +1 -0
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js +17 -21
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/StepChartBlock.d.ts +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/StepChartBlock.es.js +11 -11
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/StepChartBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/index.es.js +15 -11
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/index.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/layout.d.ts +20 -0
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/layout.es.js +21 -0
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/layout.es.js.map +1 -0
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/MilestoneProgress.d.ts +2 -4
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/MilestoneProgress.es.js +78 -82
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/MilestoneProgress.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/WithText.d.ts +10 -2
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/WithText.es.js +115 -54
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/WithText.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.d.ts +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +37 -36
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js +27 -22
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js +8 -8
- package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/CompactDirectDepositBlock.d.ts +7 -0
- package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/CompactDirectDepositBlock.es.js +46 -0
- package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/CompactDirectDepositBlock.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/index.d.ts +3 -0
- package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/layout.d.ts +13 -0
- package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/layout.es.js +22 -0
- package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/layout.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js +29 -21
- package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/layout.d.ts +0 -2
- package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/layout.es.js +17 -21
- package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/FeeChargedBlock/FeeChargedBlock.es.js +5 -6
- package/dist/insights-v2/blocks/ComponentBlocks/FeeChargedBlock/FeeChargedBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/FeedbackBlock.d.ts +3 -7
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/FeedbackBlock.es.js +120 -306
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/FeedbackBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/RatingScale.d.ts +17 -0
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/RatingScale.es.js +93 -0
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/RatingScale.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/StepBar.d.ts +5 -0
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/StepBar.es.js +21 -0
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/StepBar.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/SurveyResult.d.ts +18 -0
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/SurveyResult.es.js +71 -0
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/SurveyResult.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/survey.d.ts +82 -8
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/survey.es.js +66 -15
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/survey.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js +46 -63
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.d.ts +3 -3
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.es.js +44 -53
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/QuizBlock.d.ts +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/QuizBlock.es.js +30 -31
- package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/QuizBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js +25 -20
- package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/layout.d.ts +22 -0
- package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/layout.es.js +24 -0
- package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/layout.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/StrategiesBlock/StrategiesBlock.d.ts +7 -0
- package/dist/insights-v2/blocks/ComponentBlocks/StrategiesBlock/StrategiesBlock.es.js +89 -0
- package/dist/insights-v2/blocks/ComponentBlocks/StrategiesBlock/StrategiesBlock.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/StrategiesBlock/index.d.ts +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/StrategiesBlock/layout.d.ts +43 -0
- package/dist/insights-v2/blocks/ComponentBlocks/StrategiesBlock/layout.es.js +28 -0
- package/dist/insights-v2/blocks/ComponentBlocks/StrategiesBlock/layout.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +54 -53
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.d.ts +7 -3
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js +20 -11
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js +29 -28
- package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/index.d.ts +2 -0
- package/dist/insights-v2/blocks/ImageBlocks/ImageBlock.es.js +6 -5
- package/dist/insights-v2/blocks/ImageBlocks/ImageBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/images/FederalBankHoliday.es.js +117 -71
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/images/FederalBankHoliday.es.js.map +1 -1
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.d.ts +1 -1
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.es.js +10 -7
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/components/AccountHeroCard.d.ts +3 -1
- package/dist/insights-v2/components/AccountHeroCard.es.js.map +1 -1
- package/dist/insights-v2/components/BaseLayout.d.ts +3 -1
- package/dist/insights-v2/components/BaseLayout.es.js +134 -119
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/components/CompactDirectDepositCard.d.ts +28 -0
- package/dist/insights-v2/components/CompactDirectDepositCard.es.js +78 -0
- package/dist/insights-v2/components/CompactDirectDepositCard.es.js.map +1 -0
- package/dist/insights-v2/components/CompactInsightCard.es.js +122 -118
- package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
- package/dist/insights-v2/components/DirectDepositCard.d.ts +6 -1
- package/dist/insights-v2/components/DirectDepositCard.es.js +24 -22
- package/dist/insights-v2/components/DirectDepositCard.es.js.map +1 -1
- package/dist/insights-v2/components/LoadingCard.es.js +13 -9
- package/dist/insights-v2/components/LoadingCard.es.js.map +1 -1
- package/dist/insights-v2/components/LogoFromGuid.d.ts +1 -1
- package/dist/insights-v2/components/LogoFromGuid.es.js.map +1 -1
- package/dist/insights-v2/components/MerchantHighlightCard.es.js +4 -4
- package/dist/insights-v2/components/SaveAnExtraCard.d.ts +4 -1
- package/dist/insights-v2/components/SaveAnExtraCard.es.js +32 -20
- package/dist/insights-v2/components/SaveAnExtraCard.es.js.map +1 -1
- package/dist/insights-v2/components/SubTabs.d.ts +2 -1
- package/dist/insights-v2/components/SubTabs.es.js +29 -24
- package/dist/insights-v2/components/SubTabs.es.js.map +1 -1
- package/dist/insights-v2/components/TransactionListCard.d.ts +3 -1
- package/dist/insights-v2/components/TransactionListCard.es.js +39 -37
- package/dist/insights-v2/components/TransactionListCard.es.js.map +1 -1
- package/dist/insights-v2/components/TransferLogoCard.es.js +1 -0
- package/dist/insights-v2/components/TransferLogoCard.es.js.map +1 -1
- package/dist/insights-v2/components/UpcomingBillCard.es.js +39 -35
- package/dist/insights-v2/components/UpcomingBillCard.es.js.map +1 -1
- package/dist/insights-v2/components/celebrationGradients.d.ts +17 -8
- package/dist/insights-v2/components/celebrationGradients.es.js +14 -14
- package/dist/insights-v2/components/celebrationGradients.es.js.map +1 -1
- package/dist/insights-v2/components/chartblocks/ChartLegend.es.js +16 -10
- package/dist/insights-v2/components/chartblocks/ChartLegend.es.js.map +1 -1
- package/dist/insights-v2/components/chartblocks/DoubleBarChart.d.ts +10 -4
- package/dist/insights-v2/components/chartblocks/DoubleBarChart.es.js +62 -61
- package/dist/insights-v2/components/chartblocks/DoubleBarChart.es.js.map +1 -1
- package/dist/insights-v2/components/chartblocks/EmptyBarChart.es.js +13 -6
- package/dist/insights-v2/components/chartblocks/EmptyBarChart.es.js.map +1 -1
- package/dist/insights-v2/components/shared/images/DesignateEmergencySavings.es.js +2 -3
- package/dist/insights-v2/components/shared/images/DesignateEmergencySavings.es.js.map +1 -1
- package/dist/insights-v2/components/statusIcon.d.ts +2 -1
- package/dist/insights-v2/components/statusIcon.es.js +10 -8
- package/dist/insights-v2/components/statusIcon.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/ctaConfig.es.js +19 -17
- package/dist/insights-v2/ctaActions/ctaConfig.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/ctaHandlers.d.ts +5 -1
- package/dist/insights-v2/ctaActions/ctaHandlers.es.js +71 -54
- package/dist/insights-v2/ctaActions/ctaHandlers.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/ctaPostMessages.es.js +41 -24
- package/dist/insights-v2/ctaActions/ctaPostMessages.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/feedbackSurvey.d.ts +9 -0
- package/dist/insights-v2/ctaActions/feedbackSurvey.es.js +51 -0
- package/dist/insights-v2/ctaActions/feedbackSurvey.es.js.map +1 -0
- package/dist/insights-v2/ctaActions/runCtaAction.es.js +36 -35
- package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/types.d.ts +7 -0
- package/dist/insights-v2/index.es.js +126 -120
- package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -1
- package/dist/insights-v2/mappings/actionBlocksKey.es.js +1 -1
- package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
- package/dist/insights-v2/mappings/blocks.es.js +126 -122
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/dist/microinsights/MicroCardTemplate.es.js +1 -1
- package/dist/microinsights/MicroCardTemplate.es.js.map +1 -1
- package/dist/microinsights/cards/InsightCard.es.js +53 -53
- package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/index.d.ts +0 -13
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/images/DesignateEmergencySavingsAccount.es.js +0 -296
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/images/DesignateEmergencySavingsAccount.es.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveEnoughToLiveOnBottomSection.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/MakeTransferActionBlock/SaveEnoughToLiveOnBottomSection.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { type SxProps } from '@mui/material/styles'\n\nimport { H2, Text } from '@mxenabled/mxui'\n\nimport { ReactComponent as Image } from '../../components/shared/images/SaveEnoughToLiveOnBottom.svg'\nimport { ThemedSVGImage } from '../../components/chartblocks/ThemedSVGImage'\n\nconst ROW_STYLES = {\n alignItems: 'center',\n flexDirection: 'row',\n height: 40,\n justifyContent: 'space-between',\n px: 16,\n py: 2,\n}\n\ninterface BalanceRowProps {\n label: string\n value: string\n withBorder?: boolean\n}\n\nconst BalanceRow = ({ label, value, withBorder = false }: BalanceRowProps) => (\n <Stack\n sx={{\n ...ROW_STYLES,\n ...(withBorder && {\n borderBottom: '1px solid',\n borderColor: 'divider',\n }),\n }}\n >\n <Text color=\"text.secondary\" variant=\"caption\">\n {label}\n </Text>\n <Text bold={true} variant=\"body2\">\n {value}\n </Text>\n </Stack>\n)\n\ninterface SaveEnoughToLiveOnBottomSectionProps {\n content: string\n leftLabel: string\n leftValue: string\n rightLabel: string\n rightValue: string\n sx?: SxProps\n}\n\nconst SaveEnoughToLiveOnBottomSection = ({\n content,\n leftLabel,\n leftValue,\n rightLabel,\n rightValue,\n sx,\n}: SaveEnoughToLiveOnBottomSectionProps) => (\n <Stack sx={{ alignItems: 'center', gap: 12 }}>\n <Box sx={{ display: 'grid', placeItems: 'center' }}>\n <ThemedSVGImage\n divProps={{ style: { height: 'auto', gridArea: '1 / 1', lineHeight: 0 } }}\n image={Image}\n />\n <H2 sx={{ color: 'neutral.contrastText', gridArea: '1 / 1', textAlign: 'center' }}>\n {content}\n </H2>\n </Box>\n <Stack\n sx={{\n
|
|
1
|
+
{"version":3,"file":"SaveEnoughToLiveOnBottomSection.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/MakeTransferActionBlock/SaveEnoughToLiveOnBottomSection.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { type SxProps } from '@mui/material/styles'\n\nimport { H2, Text } from '@mxenabled/mxui'\n\nimport { ReactComponent as Image } from '../../components/shared/images/SaveEnoughToLiveOnBottom.svg'\nimport { ThemedSVGImage } from '../../components/chartblocks/ThemedSVGImage'\n\nconst ROW_STYLES = {\n alignItems: 'center',\n flexDirection: 'row',\n height: 40,\n justifyContent: 'space-between',\n px: 16,\n py: 2,\n}\n\ninterface BalanceRowProps {\n label: string\n value: string\n withBorder?: boolean\n}\n\nconst BalanceRow = ({ label, value, withBorder = false }: BalanceRowProps) => (\n <Stack\n sx={{\n ...ROW_STYLES,\n ...(withBorder && {\n borderBottom: '1px solid',\n borderColor: 'divider',\n }),\n }}\n >\n <Text color=\"text.secondary\" variant=\"caption\">\n {label}\n </Text>\n <Text bold={true} variant=\"body2\">\n {value}\n </Text>\n </Stack>\n)\n\ninterface SaveEnoughToLiveOnBottomSectionProps {\n content: string\n leftLabel: string\n leftValue: string\n rightLabel: string\n rightValue: string\n sx?: SxProps\n}\n\nconst SaveEnoughToLiveOnBottomSection = ({\n content,\n leftLabel,\n leftValue,\n rightLabel,\n rightValue,\n sx,\n}: SaveEnoughToLiveOnBottomSectionProps) => (\n <Stack sx={{ alignItems: 'center', gap: 12 }}>\n <Box sx={{ display: 'grid', placeItems: 'center' }}>\n <ThemedSVGImage\n divProps={{ style: { height: 'auto', gridArea: '1 / 1', lineHeight: 0 } }}\n image={Image}\n />\n <H2 sx={{ color: 'neutral.contrastText', gridArea: '1 / 1', textAlign: 'center' }}>\n {content}\n </H2>\n </Box>\n <Stack\n sx={{\n // Drawn inside, so the two 40px rows make Figma's 80px table.\n boxShadow: (theme) => `inset 0 0 0 1px ${theme.palette.divider}`,\n borderRadius: 2,\n width: 288,\n ...sx,\n }}\n >\n <BalanceRow label={leftLabel} value={leftValue} withBorder={true} />\n <BalanceRow label={rightLabel} value={rightValue} />\n </Stack>\n </Stack>\n)\n\nexport default SaveEnoughToLiveOnBottomSection\n"],"mappings":";;;;;;AAUA,IAAM,IAAa;AAAA,EACjB,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,IAAI;AAAA,EACJ,IAAI;AACN,GAQM,IAAA,CAAc,EAAE,OAAA,GAAO,OAAA,GAAO,YAAA,IAAa,GAAA,MAC/C,gBAAA,EAAC,GAAD;AAAA,EACE,IAAI;AAAA,IACF,GAAG;AAAA,IACH,GAAI,KAAc;AAAA,MAChB,cAAc;AAAA,MACd,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EAPF,UAAA,CASE,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAM;AAAA,IAAiB,SAAQ;AAAA,IAClC,UAAA;AAAA,EACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,IAAM,MAAM;AAAA,IAAM,SAAQ;AAAA,IACvB,UAAA;AAAA,EACG,CAAA,CACD;IAYH,IAAA,CAAmC,EACvC,SAAA,GACA,WAAA,GACA,WAAA,GACA,YAAA,GACA,YAAA,GACA,IAAA,EAAA,MAEA,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,YAAY;AAAA,IAAU,KAAK;AAAA,EAAG;AAAA,EAA3C,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IAAK,IAAI;AAAA,MAAE,SAAS;AAAA,MAAQ,YAAY;AAAA,IAAS;AAAA,IAAjD,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MACE,UAAU,EAAE,OAAO;AAAA,QAAE,QAAQ;AAAA,QAAQ,UAAU;AAAA,QAAS,YAAY;AAAA,MAAE,EAAE;AAAA,MACxE,OAAO;AAAA,IACR,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,MAAI,IAAI;AAAA,QAAE,OAAO;AAAA,QAAwB,UAAU;AAAA,QAAS,WAAW;AAAA,MAAS;AAAA,MAC7E,UAAA;AAAA,IACC,CAAA,CACD;AAAA,EACL,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,IACE,IAAI;AAAA,MAEF,WAAA,CAAY,MAAU,mBAAmB,EAAM,QAAQ,OAAA;AAAA,MACvD,cAAc;AAAA,MACd,OAAO;AAAA,MACP,GAAG;AAAA,IACL;AAAA,IAPF,UAAA,CASE,gBAAA,EAAC,GAAD;AAAA,MAAY,OAAO;AAAA,MAAW,OAAO;AAAA,MAAW,YAAY;AAAA,IAAO,CAAA,GACnE,gBAAA,EAAC,GAAD;AAAA,MAAY,OAAO;AAAA,MAAY,OAAO;AAAA,IAAa,CAAA,CAC9C;AAAA,EACF,CAAA,CAAA"}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import
|
|
1
|
+
import C from "../../../common/utils/AccountDisplayName.es.js";
|
|
2
2
|
import { useAccountStore as m } from "../../../common/context/hooks.es.js";
|
|
3
|
-
import { useRequiredCopy as
|
|
4
|
-
import
|
|
5
|
-
import { isPayoffPossible as
|
|
6
|
-
import { buildPayoffRows as
|
|
7
|
-
import { CalculationFailed as
|
|
3
|
+
import { useRequiredCopy as S } from "../useRequiredCopy.es.js";
|
|
4
|
+
import w from "../../components/SubHeader.es.js";
|
|
5
|
+
import { isPayoffPossible as A } from "./payoff.es.js";
|
|
6
|
+
import { buildPayoffRows as I, initialPayoffInputs as k, parsePayoffInputs as R, resolvePrimaryAccount as B, validatePayoffInputs as D } from "./layout.es.js";
|
|
7
|
+
import { CalculationFailed as F, PayoffResults as $ } from "./PayoffResults.es.js";
|
|
8
8
|
import c from "react";
|
|
9
|
-
import { observer as
|
|
9
|
+
import { observer as j } from "mobx-react-lite";
|
|
10
10
|
import l from "@mui/material/Stack";
|
|
11
|
-
import { Text as
|
|
12
|
-
import
|
|
11
|
+
import { P as E, Text as L, TextField as T } from "@mxenabled/mxui";
|
|
12
|
+
import G from "@mui/material/Button";
|
|
13
13
|
import { jsx as e, jsxs as u } from "react/jsx-runtime";
|
|
14
|
-
import
|
|
14
|
+
import H from "@mui/material/Box";
|
|
15
15
|
import N from "@mui/material/Divider";
|
|
16
16
|
import O from "@mui/material/InputAdornment";
|
|
17
|
-
var
|
|
17
|
+
var st = ({ beat: o }) => {
|
|
18
18
|
const { accountsLoaded: t, loadAccounts: s } = m();
|
|
19
19
|
c.useEffect(() => {
|
|
20
20
|
!o.primary_account && !t && s();
|
|
21
21
|
}, []);
|
|
22
|
-
},
|
|
22
|
+
}, nt = ({ beat: o }) => {
|
|
23
23
|
const { accountsLoaded: t } = m();
|
|
24
24
|
return { ready: !!o.primary_account || t };
|
|
25
25
|
}, W = ({ account: o, copy: t }) => {
|
|
26
|
-
const s = c.useId(), [n, x] = c.useState(() =>
|
|
26
|
+
const s = c.useId(), [n, x] = c.useState(() => k(o)), [p, g] = c.useState({}), [d, P] = c.useState({ status: "idle" }), h = o ? C(o) : "", v = (r) => (i) => x((a) => ({
|
|
27
27
|
...a,
|
|
28
28
|
[r]: i.target.value
|
|
29
|
-
})),
|
|
29
|
+
})), _ = (r) => {
|
|
30
30
|
r.preventDefault();
|
|
31
|
-
const i =
|
|
32
|
-
if (
|
|
33
|
-
const { balance: a, interestRate: y, monthlyPayment: b } =
|
|
34
|
-
|
|
31
|
+
const i = D(n, t);
|
|
32
|
+
if (g(i), Object.keys(i).length > 0) return;
|
|
33
|
+
const { balance: a, interestRate: y, monthlyPayment: b } = R(n);
|
|
34
|
+
P(A(y, a, b) ? {
|
|
35
35
|
status: "calculated",
|
|
36
|
-
rows:
|
|
36
|
+
rows: I(y, a, b)
|
|
37
37
|
} : { status: "failed" });
|
|
38
|
-
}, f = (r, i, a) => /* @__PURE__ */ e(
|
|
38
|
+
}, f = (r, i, a) => /* @__PURE__ */ e(T, {
|
|
39
39
|
error: !!p[r],
|
|
40
40
|
fullWidth: !0,
|
|
41
41
|
helperText: p[r],
|
|
42
42
|
id: `${s}-${r}`,
|
|
43
43
|
label: i,
|
|
44
|
-
onChange:
|
|
44
|
+
onChange: v(r),
|
|
45
45
|
slotProps: {
|
|
46
46
|
htmlInput: { inputMode: "decimal" },
|
|
47
47
|
input: { [a.position === "start" ? "startAdornment" : "endAdornment"]: /* @__PURE__ */ e(O, {
|
|
@@ -58,7 +58,7 @@ var it = ({ beat: o }) => {
|
|
|
58
58
|
/* @__PURE__ */ u(l, {
|
|
59
59
|
component: "form",
|
|
60
60
|
noValidate: !0,
|
|
61
|
-
onSubmit:
|
|
61
|
+
onSubmit: _,
|
|
62
62
|
sx: {
|
|
63
63
|
bgcolor: "background.paper",
|
|
64
64
|
pb: 24,
|
|
@@ -71,20 +71,20 @@ var it = ({ beat: o }) => {
|
|
|
71
71
|
pb: 12,
|
|
72
72
|
pt: 16
|
|
73
73
|
},
|
|
74
|
-
children: [t.heading && /* @__PURE__ */ e(
|
|
74
|
+
children: [t.heading && /* @__PURE__ */ e(L, {
|
|
75
75
|
bold: !0,
|
|
76
76
|
component: "h3",
|
|
77
77
|
variant: "h3",
|
|
78
78
|
children: t.heading
|
|
79
|
-
}), h && /* @__PURE__ */ e(
|
|
79
|
+
}), h && /* @__PURE__ */ e(w, { subtitle: {
|
|
80
80
|
logo: o?.institution_guid ? { institution_guid: o.institution_guid } : void 0,
|
|
81
81
|
text: h
|
|
82
82
|
} })]
|
|
83
83
|
}),
|
|
84
|
-
/* @__PURE__ */ e(
|
|
84
|
+
/* @__PURE__ */ e(E, {
|
|
85
85
|
color: "text.secondary",
|
|
86
|
-
component: "p",
|
|
87
86
|
variant: "body2",
|
|
87
|
+
sx: { lineHeight: "20px" },
|
|
88
88
|
children: t.description
|
|
89
89
|
}),
|
|
90
90
|
/* @__PURE__ */ u(l, {
|
|
@@ -110,7 +110,7 @@ var it = ({ beat: o }) => {
|
|
|
110
110
|
})]
|
|
111
111
|
})]
|
|
112
112
|
}),
|
|
113
|
-
/* @__PURE__ */ e(
|
|
113
|
+
/* @__PURE__ */ e(G, {
|
|
114
114
|
fullWidth: !0,
|
|
115
115
|
size: "large",
|
|
116
116
|
type: "submit",
|
|
@@ -120,31 +120,31 @@ var it = ({ beat: o }) => {
|
|
|
120
120
|
]
|
|
121
121
|
}),
|
|
122
122
|
/* @__PURE__ */ e(N, {}),
|
|
123
|
-
/* @__PURE__ */ e(
|
|
123
|
+
/* @__PURE__ */ e(H, {
|
|
124
124
|
sx: {
|
|
125
125
|
bgcolor: "background.default",
|
|
126
126
|
flexGrow: 1,
|
|
127
127
|
p: 24
|
|
128
128
|
},
|
|
129
|
-
children: d.status === "failed" ? /* @__PURE__ */ e(
|
|
129
|
+
children: d.status === "failed" ? /* @__PURE__ */ e(F, { copy: t }) : /* @__PURE__ */ e($, {
|
|
130
130
|
copy: t,
|
|
131
131
|
rows: d.status === "calculated" ? d.rows : void 0
|
|
132
132
|
})
|
|
133
133
|
})
|
|
134
134
|
]
|
|
135
135
|
});
|
|
136
|
-
}, q = (o) => o.insights_feed?.payoff_calculator,
|
|
137
|
-
const { accounts: s } = m(), n =
|
|
136
|
+
}, q = (o) => o.insights_feed?.payoff_calculator, lt = j(function({ beat: t }) {
|
|
137
|
+
const { accounts: s } = m(), n = S(q);
|
|
138
138
|
return /* @__PURE__ */ e(W, {
|
|
139
|
-
account:
|
|
139
|
+
account: B(t, s),
|
|
140
140
|
copy: n
|
|
141
141
|
}, t.guid);
|
|
142
142
|
});
|
|
143
143
|
export {
|
|
144
|
-
|
|
144
|
+
lt as PayoffCalculatorBlock,
|
|
145
145
|
q as selectPayoffCalculatorCopy,
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
nt as usePayoffCalculatorLoadState,
|
|
147
|
+
st as usePayoffCalculatorPrepare
|
|
148
148
|
};
|
|
149
149
|
|
|
150
150
|
//# sourceMappingURL=PayoffCalculatorBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayoffCalculatorBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Divider from '@mui/material/Divider'\nimport InputAdornment from '@mui/material/InputAdornment'\nimport Stack from '@mui/material/Stack'\n\nimport { Text, TextField } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useAccountStore } from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport type { Account, GlobalCopy, PayoffCalculatorCopy } from '../../../core'\nimport type { ActionBlockProps, BlockLoadState } from '../../mappings/blocks'\nimport SubHeader from '../../components/SubHeader'\nimport { useRequiredCopy } from '../useRequiredCopy'\n\nimport {\n buildPayoffRows,\n initialPayoffInputs,\n parsePayoffInputs,\n resolvePrimaryAccount,\n validatePayoffInputs,\n type PayoffErrors,\n type PayoffField,\n type PayoffInputs,\n type PayoffRow,\n} from './layout'\nimport { isPayoffPossible } from './payoff'\nimport { CalculationFailed, PayoffResults } from './PayoffResults'\n\n/** Loads accounts once per open when the host did not attach the beat's primary account. */\nexport const usePayoffCalculatorPrepare = ({ beat }: ActionBlockProps) => {\n const { accountsLoaded, loadAccounts } = useAccountStore()\n\n React.useEffect(() => {\n if (!beat.primary_account && !accountsLoaded) void loadAccounts()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n}\n\n/** Ready at once when the host attached the beat's account, else once the accounts load. */\nexport const usePayoffCalculatorLoadState = ({ beat }: ActionBlockProps): BlockLoadState => {\n const { accountsLoaded } = useAccountStore()\n\n return { ready: !!beat.primary_account || accountsLoaded }\n}\n\ntype Outcome =\n | { status: 'idle' }\n | { status: 'calculated'; rows: PayoffRow[] }\n | { status: 'failed' }\n\ninterface PayoffCalculatorFormProps {\n account?: Account\n copy: PayoffCalculatorCopy\n}\n\nconst PayoffCalculatorForm = ({ account, copy }: PayoffCalculatorFormProps) => {\n const id = React.useId()\n const [inputs, setInputs] = React.useState<PayoffInputs>(() => initialPayoffInputs(account))\n const [errors, setErrors] = React.useState<PayoffErrors>({})\n const [outcome, setOutcome] = React.useState<Outcome>({ status: 'idle' })\n\n const accountName = account ? getAccountDisplayName(account) : ''\n\n const setField = (field: PayoffField) => (event: React.ChangeEvent<HTMLInputElement>) =>\n setInputs((previous) => ({ ...previous, [field]: event.target.value }))\n\n const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {\n event.preventDefault()\n\n const nextErrors = validatePayoffInputs(inputs, copy)\n\n setErrors(nextErrors)\n if (Object.keys(nextErrors).length > 0) return\n\n const { balance, interestRate, monthlyPayment } = parsePayoffInputs(inputs)\n\n setOutcome(\n isPayoffPossible(interestRate, balance, monthlyPayment)\n ? { status: 'calculated', rows: buildPayoffRows(interestRate, balance, monthlyPayment) }\n : { status: 'failed' },\n )\n }\n\n const field = (\n name: PayoffField,\n label: string,\n adornment: { position: 'start' | 'end'; symbol: string },\n ) => (\n <TextField\n error={!!errors[name]}\n fullWidth={true}\n helperText={errors[name]}\n id={`${id}-${name}`}\n label={label}\n onChange={setField(name)}\n slotProps={{\n htmlInput: { inputMode: 'decimal' },\n input: {\n [adornment.position === 'start' ? 'startAdornment' : 'endAdornment']: (\n <InputAdornment aria-hidden=\"true\" position={adornment.position}>\n {adornment.symbol}\n </InputAdornment>\n ),\n },\n }}\n value={inputs[name]}\n />\n )\n\n // Figma `Monthly CC Interest Summary/Drilldown`: the form on paper, a divider, then the scenario\n // card on the grey wash.\n return (\n <Stack sx={{ flexGrow: 1 }}>\n <Stack\n component=\"form\"\n noValidate={true}\n onSubmit={handleSubmit}\n sx={{ bgcolor: 'background.paper', pb: 24, px: 24 }}\n >\n <Stack sx={{ gap: 4, pb: 12, pt: 16 }}>\n {copy.heading && (\n <Text bold={true} component=\"h3\" variant=\"h3\">\n {copy.heading}\n </Text>\n )}\n {accountName && (\n <SubHeader\n subtitle={{\n logo: account?.institution_guid\n ? { institution_guid: account.institution_guid }\n : undefined,\n text: accountName,\n }}\n />\n )}\n </Stack>\n <Text color=\"text.secondary\" component=\"p\" variant=\"body2\">\n {copy.description}\n </Text>\n <Stack sx={{ gap: 24, pb: 24, pt: 36 }}>\n {field('balance', copy.credit_card_balance, { position: 'start', symbol: '$' })}\n <Stack sx={{ flexDirection: 'row', gap: 16 }}>\n {field('interestRate', copy.interest_rate, { position: 'end', symbol: '%' })}\n {field('monthlyPayment', copy.monthly_payment, { position: 'start', symbol: '$' })}\n </Stack>\n </Stack>\n <Button fullWidth={true} size=\"large\" type=\"submit\" variant=\"contained\">\n {copy.calculate}\n </Button>\n </Stack>\n <Divider />\n <Box sx={{ bgcolor: 'background.default', flexGrow: 1, p: 24 }}>\n {outcome.status === 'failed' ? (\n <CalculationFailed copy={copy} />\n ) : (\n <PayoffResults\n copy={copy}\n rows={outcome.status === 'calculated' ? outcome.rows : undefined}\n />\n )}\n </Box>\n </Stack>\n )\n}\n\nexport const selectPayoffCalculatorCopy = (copy: GlobalCopy) =>\n copy.insights_feed?.payoff_calculator\n\n/**\n * Monthly Credit Card Interest Summary's \"Learn how to save\" drawer: the credit card payoff\n * calculator. The beat's account prefills the balance, interest rate and minimum payment; the\n * user edits them and compares the payoff at that payment, $10 more and $20 more.\n */\nexport const PayoffCalculatorBlock = observer(function PayoffCalculatorBlock({\n beat,\n}: ActionBlockProps) {\n const { accounts } = useAccountStore()\n const copy = useRequiredCopy(selectPayoffCalculatorCopy)\n\n return (\n <Pay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AAe,EAAQ,OAAO;AAAA,QACxD,CAAA;AAAA,MAEA,CAAA;AAAA,IACA;AAAA;AAEX,GAEa,IAAA,CAA8B,MACzC,EAAK,eAAe,mBAOT,KAAwB,EAAS,SAA+B,EAC3E,MAAA,EAAA,GACmB;AACnB,QAAM,EAAE,UAAA,EAAA,IAAa,EAAgB,GAC/B,IAAO,EAAgB,CAA0B;AAEvD,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,SAAS,EAAsB,GAAM,CAAQ;AAAA,IACvC,MAAA;AAAA,EAEP,GADM,EAAK,IACX;AAEL,CAAC"}
|
|
1
|
+
{"version":3,"file":"PayoffCalculatorBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Divider from '@mui/material/Divider'\nimport InputAdornment from '@mui/material/InputAdornment'\nimport Stack from '@mui/material/Stack'\n\nimport { P, Text, TextField } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useAccountStore } from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport type { Account, GlobalCopy, PayoffCalculatorCopy } from '../../../core'\nimport type { ActionBlockProps, BlockLoadState } from '../../mappings/blocks'\nimport SubHeader from '../../components/SubHeader'\nimport { useRequiredCopy } from '../useRequiredCopy'\n\nimport {\n buildPayoffRows,\n initialPayoffInputs,\n parsePayoffInputs,\n resolvePrimaryAccount,\n validatePayoffInputs,\n type PayoffErrors,\n type PayoffField,\n type PayoffInputs,\n type PayoffRow,\n} from './layout'\nimport { isPayoffPossible } from './payoff'\nimport { CalculationFailed, PayoffResults } from './PayoffResults'\n\n/** Loads accounts once per open when the host did not attach the beat's primary account. */\nexport const usePayoffCalculatorPrepare = ({ beat }: ActionBlockProps) => {\n const { accountsLoaded, loadAccounts } = useAccountStore()\n\n React.useEffect(() => {\n if (!beat.primary_account && !accountsLoaded) void loadAccounts()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n}\n\n/** Ready at once when the host attached the beat's account, else once the accounts load. */\nexport const usePayoffCalculatorLoadState = ({ beat }: ActionBlockProps): BlockLoadState => {\n const { accountsLoaded } = useAccountStore()\n\n return { ready: !!beat.primary_account || accountsLoaded }\n}\n\ntype Outcome =\n | { status: 'idle' }\n | { status: 'calculated'; rows: PayoffRow[] }\n | { status: 'failed' }\n\ninterface PayoffCalculatorFormProps {\n account?: Account\n copy: PayoffCalculatorCopy\n}\n\nconst PayoffCalculatorForm = ({ account, copy }: PayoffCalculatorFormProps) => {\n const id = React.useId()\n const [inputs, setInputs] = React.useState<PayoffInputs>(() => initialPayoffInputs(account))\n const [errors, setErrors] = React.useState<PayoffErrors>({})\n const [outcome, setOutcome] = React.useState<Outcome>({ status: 'idle' })\n\n const accountName = account ? getAccountDisplayName(account) : ''\n\n const setField = (field: PayoffField) => (event: React.ChangeEvent<HTMLInputElement>) =>\n setInputs((previous) => ({ ...previous, [field]: event.target.value }))\n\n const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {\n event.preventDefault()\n\n const nextErrors = validatePayoffInputs(inputs, copy)\n\n setErrors(nextErrors)\n if (Object.keys(nextErrors).length > 0) return\n\n const { balance, interestRate, monthlyPayment } = parsePayoffInputs(inputs)\n\n setOutcome(\n isPayoffPossible(interestRate, balance, monthlyPayment)\n ? { status: 'calculated', rows: buildPayoffRows(interestRate, balance, monthlyPayment) }\n : { status: 'failed' },\n )\n }\n\n const field = (\n name: PayoffField,\n label: string,\n adornment: { position: 'start' | 'end'; symbol: string },\n ) => (\n <TextField\n error={!!errors[name]}\n fullWidth={true}\n helperText={errors[name]}\n id={`${id}-${name}`}\n label={label}\n onChange={setField(name)}\n slotProps={{\n htmlInput: { inputMode: 'decimal' },\n input: {\n [adornment.position === 'start' ? 'startAdornment' : 'endAdornment']: (\n <InputAdornment aria-hidden=\"true\" position={adornment.position}>\n {adornment.symbol}\n </InputAdornment>\n ),\n },\n }}\n value={inputs[name]}\n />\n )\n\n // Figma `Monthly CC Interest Summary/Drilldown`: the form on paper, a divider, then the scenario\n // card on the grey wash.\n return (\n <Stack sx={{ flexGrow: 1 }}>\n <Stack\n component=\"form\"\n noValidate={true}\n onSubmit={handleSubmit}\n sx={{ bgcolor: 'background.paper', pb: 24, px: 24 }}\n >\n <Stack sx={{ gap: 4, pb: 12, pt: 16 }}>\n {copy.heading && (\n <Text bold={true} component=\"h3\" variant=\"h3\">\n {copy.heading}\n </Text>\n )}\n {accountName && (\n <SubHeader\n subtitle={{\n logo: account?.institution_guid\n ? { institution_guid: account.institution_guid }\n : undefined,\n text: accountName,\n }}\n />\n )}\n </Stack>\n <P color=\"text.secondary\" variant=\"body2\" sx={{ lineHeight: '20px' }}>\n {copy.description}\n </P>\n <Stack sx={{ gap: 24, pb: 24, pt: 36 }}>\n {field('balance', copy.credit_card_balance, { position: 'start', symbol: '$' })}\n <Stack sx={{ flexDirection: 'row', gap: 16 }}>\n {field('interestRate', copy.interest_rate, { position: 'end', symbol: '%' })}\n {field('monthlyPayment', copy.monthly_payment, { position: 'start', symbol: '$' })}\n </Stack>\n </Stack>\n <Button fullWidth={true} size=\"large\" type=\"submit\" variant=\"contained\">\n {copy.calculate}\n </Button>\n </Stack>\n <Divider />\n <Box sx={{ bgcolor: 'background.default', flexGrow: 1, p: 24 }}>\n {outcome.status === 'failed' ? (\n <CalculationFailed copy={copy} />\n ) : (\n <PayoffResults\n copy={copy}\n rows={outcome.status === 'calculated' ? outcome.rows : undefined}\n />\n )}\n </Box>\n </Stack>\n )\n}\n\nexport const selectPayoffCalculatorCopy = (copy: GlobalCopy) =>\n copy.insights_feed?.payoff_calculator\n\n/**\n * Monthly Credit Card Interest Summary's \"Learn how to save\" drawer: the credit card payoff\n * calculator. The beat's account prefills the balance, interest rate and minimum payment; the\n * user edits them and compares the payoff at that payment, $10 more and $20 more.\n */\nexport const PayoffCalculatorBlock = observer(function PayoffCalculatorBlock({\n beat,\n}: ActionBlockProps) {\n const { accounts } = useAccountStore()\n const copy = useRequiredCopy(selectPayoffCalculatorCopy)\n\n return (\n <PayoffCalculatorForm\n account={resolvePrimaryAccount(beat, accounts)}\n copy={copy}\n key={beat.guid}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAiCA,IAAa,KAAA,CAA8B,EAAE,MAAA,EAAA,MAA6B;AACxE,QAAM,EAAE,gBAAA,GAAgB,cAAA,EAAA,IAAiB,EAAgB;AAEzD,EAAA,EAAM,UAAA,MAAgB;AACpB,IAAI,CAAC,EAAK,mBAAmB,CAAC,KAAgB,EAAkB;AAAA,EAElE,GAAG,CAAC,CAAC;AACP,GAGa,KAAA,CAAgC,EAAE,MAAA,EAAA,MAA6C;AAC1F,QAAM,EAAE,gBAAA,EAAA,IAAmB,EAAgB;AAE3C,SAAO,EAAE,OAAO,CAAC,CAAC,EAAK,mBAAmB,EAAe;AAC3D,GAYM,IAAA,CAAwB,EAAE,SAAA,GAAS,MAAA,EAAA,MAAsC;AAC7E,QAAM,IAAK,EAAM,MAAM,GACjB,CAAC,GAAQ,CAAA,IAAa,EAAM,SAAA,MAA6B,EAAoB,CAAO,CAAC,GACrF,CAAC,GAAQ,CAAA,IAAa,EAAM,SAAuB,CAAC,CAAC,GACrD,CAAC,GAAS,CAAA,IAAc,EAAM,SAAkB,EAAE,QAAQ,OAAO,CAAC,GAElE,IAAc,IAAU,EAAsB,CAAO,IAAI,IAEzD,IAAA,CAAY,MAAA,CAAwB,MACxC,EAAA,CAAW,OAAc;AAAA,IAAE,GAAG;AAAA,IAAW,CAAA,CAAA,GAAQ,EAAM,OAAO;AAAA,EAAM,EAAE,GAElE,IAAA,CAAgB,MAA4C;AAChE,IAAA,EAAM,eAAe;AAErB,UAAM,IAAa,EAAqB,GAAQ,CAAI;AAGpD,QADA,EAAU,CAAU,GAChB,OAAO,KAAK,CAAU,EAAE,SAAS,EAAG;AAExC,UAAM,EAAE,SAAA,GAAS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,gBAAA,EAAC,GAAD,EAAyB,MAAA,EAAO,CAAA,IAEhC,gBAAA,EAAC,GAAD;AAAA,UACQ,MAAA;AAAA,UACN,MAAM,EAAQ,WAAW,eAAe,EAAQ,OAAO;AAAA,QACxD,CAAA;AAAA,MAEA,CAAA;AAAA,IACA;AAAA;AAEX,GAEa,IAAA,CAA8B,MACzC,EAAK,eAAe,mBAOT,KAAwB,EAAS,SAA+B,EAC3E,MAAA,EAAA,GACmB;AACnB,QAAM,EAAE,UAAA,EAAA,IAAa,EAAgB,GAC/B,IAAO,EAAgB,CAA0B;AAEvD,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,SAAS,EAAsB,GAAM,CAAQ;AAAA,IACvC,MAAA;AAAA,EAEP,GADM,EAAK,IACX;AAEL,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { PayoffRow } from './layout';
|
|
|
4
4
|
export declare const formatPayoffTime: (copy: PayoffCalculatorCopy, paymentCount: number) => string;
|
|
5
5
|
interface PayoffResultsProps {
|
|
6
6
|
copy: PayoffCalculatorCopy;
|
|
7
|
-
/** Undefined until the user has calculated: the figures
|
|
7
|
+
/** Undefined until the user has calculated: the figures show $0 / "-" in text.primary, as Figma. */
|
|
8
8
|
rows?: PayoffRow[];
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import { CURRENCY_FORMAT as
|
|
3
|
-
import { ELEVATION_SHADOW as
|
|
4
|
-
import { SubTabs as
|
|
1
|
+
import { buildDynamicCopy as w, buildPluralCopy as P } from "../../../core/utils/Localization.es.js";
|
|
2
|
+
import { CURRENCY_FORMAT as s, formatCurrency as m } from "../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import { ELEVATION_SHADOW as g } from "../../components/shared/elevation.es.js";
|
|
4
|
+
import { SubTabs as S, subTabPanelProps as T } from "../../components/SubTabs.es.js";
|
|
5
5
|
import { PAYMENT_INCREMENTS as u } from "./layout.es.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import x from "react";
|
|
7
|
+
import l from "@mui/material/Stack";
|
|
8
8
|
import { Text as o } from "@mxenabled/mxui";
|
|
9
|
-
import { Icon as
|
|
9
|
+
import { Icon as v } from "@mxenabled/mx-icons";
|
|
10
10
|
import { jsx as r, jsxs as n } from "react/jsx-runtime";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
var
|
|
11
|
+
import c from "@mui/material/Box";
|
|
12
|
+
import C from "@mui/material/Divider";
|
|
13
|
+
var b = (e) => m(e, Number.isInteger(e) ? s.whole : s.cents), k = (e, t) => t < 1 ? "-" : e.months_short ? w(e.months_short, String(t)) : P(e.month, e.months, t, String(t)), f = ({ label: e, muted: t = !1, value: a }) => /* @__PURE__ */ n(l, {
|
|
14
14
|
sx: {
|
|
15
15
|
alignItems: "center",
|
|
16
16
|
flex: 1,
|
|
@@ -18,9 +18,8 @@ var f = (e) => m(e, Number.isInteger(e) ? c.whole : c.cents), E = (e, t) => t <
|
|
|
18
18
|
},
|
|
19
19
|
children: [/* @__PURE__ */ r(o, {
|
|
20
20
|
bold: !0,
|
|
21
|
-
color: t,
|
|
21
|
+
color: t ? "text.secondary" : "text.primary",
|
|
22
22
|
component: "span",
|
|
23
|
-
sx: { transition: "color 0.5s" },
|
|
24
23
|
variant: "h3",
|
|
25
24
|
children: a
|
|
26
25
|
}), /* @__PURE__ */ r(o, {
|
|
@@ -29,7 +28,7 @@ var f = (e) => m(e, Number.isInteger(e) ? c.whole : c.cents), E = (e, t) => t <
|
|
|
29
28
|
variant: "caption",
|
|
30
29
|
children: e
|
|
31
30
|
})]
|
|
32
|
-
}),
|
|
31
|
+
}), y = ({ icon: e, label: t, value: a }) => /* @__PURE__ */ n(l, {
|
|
33
32
|
direction: "row",
|
|
34
33
|
sx: {
|
|
35
34
|
alignItems: "center",
|
|
@@ -38,7 +37,7 @@ var f = (e) => m(e, Number.isInteger(e) ? c.whole : c.cents), E = (e, t) => t <
|
|
|
38
37
|
py: 14
|
|
39
38
|
},
|
|
40
39
|
children: [
|
|
41
|
-
/* @__PURE__ */ r(
|
|
40
|
+
/* @__PURE__ */ r(c, {
|
|
42
41
|
"aria-hidden": !0,
|
|
43
42
|
sx: {
|
|
44
43
|
alignItems: "center",
|
|
@@ -51,7 +50,7 @@ var f = (e) => m(e, Number.isInteger(e) ? c.whole : c.cents), E = (e, t) => t <
|
|
|
51
50
|
justifyContent: "center",
|
|
52
51
|
width: 32
|
|
53
52
|
},
|
|
54
|
-
children: /* @__PURE__ */ r(
|
|
53
|
+
children: /* @__PURE__ */ r(v, {
|
|
55
54
|
name: e,
|
|
56
55
|
size: 20
|
|
57
56
|
})
|
|
@@ -67,36 +66,35 @@ var f = (e) => m(e, Number.isInteger(e) ? c.whole : c.cents), E = (e, t) => t <
|
|
|
67
66
|
}),
|
|
68
67
|
/* @__PURE__ */ r(o, {
|
|
69
68
|
bold: !0,
|
|
70
|
-
color:
|
|
69
|
+
color: "text.primary",
|
|
71
70
|
component: "span",
|
|
72
|
-
sx: { transition: "color 0.5s" },
|
|
73
71
|
variant: "body1",
|
|
74
|
-
children:
|
|
72
|
+
children: a
|
|
75
73
|
})
|
|
76
74
|
]
|
|
77
|
-
}),
|
|
78
|
-
const a =
|
|
79
|
-
return /* @__PURE__ */ n(
|
|
75
|
+
}), $ = ({ copy: e, rows: t }) => {
|
|
76
|
+
const a = x.useId(), [d, _] = x.useState(0), p = u[d], i = t?.[d], I = i ? i.monthlyPayment - i.increment : 0, R = u.map((h) => ({ label: h === 0 ? e.standard ?? e.monthly_payment : `+${m(h, s.whole)}` }));
|
|
77
|
+
return /* @__PURE__ */ n(c, {
|
|
80
78
|
sx: {
|
|
81
79
|
bgcolor: "background.paper",
|
|
82
80
|
borderRadius: "8px",
|
|
83
|
-
boxShadow:
|
|
81
|
+
boxShadow: g[1],
|
|
84
82
|
overflow: "hidden"
|
|
85
83
|
},
|
|
86
|
-
children: [/* @__PURE__ */ r(
|
|
84
|
+
children: [/* @__PURE__ */ r(S, {
|
|
87
85
|
ariaLabel: e.your_results,
|
|
88
86
|
id: a,
|
|
89
87
|
isTypeFilter: !1,
|
|
90
|
-
onChange:
|
|
91
|
-
selectedIndex:
|
|
92
|
-
tabs:
|
|
93
|
-
}), /* @__PURE__ */ n(
|
|
94
|
-
...
|
|
88
|
+
onChange: _,
|
|
89
|
+
selectedIndex: d,
|
|
90
|
+
tabs: R
|
|
91
|
+
}), /* @__PURE__ */ n(l, {
|
|
92
|
+
...T(a, d),
|
|
95
93
|
sx: {
|
|
96
94
|
gap: 16,
|
|
97
95
|
p: 16
|
|
98
96
|
},
|
|
99
|
-
children: [/* @__PURE__ */ n(
|
|
97
|
+
children: [/* @__PURE__ */ n(l, {
|
|
100
98
|
direction: "row",
|
|
101
99
|
sx: {
|
|
102
100
|
alignItems: "center",
|
|
@@ -105,10 +103,9 @@ var f = (e) => m(e, Number.isInteger(e) ? c.whole : c.cents), E = (e, t) => t <
|
|
|
105
103
|
py: 8
|
|
106
104
|
},
|
|
107
105
|
children: [
|
|
108
|
-
/* @__PURE__ */ r(
|
|
106
|
+
/* @__PURE__ */ r(f, {
|
|
109
107
|
label: e.monthly_payment,
|
|
110
|
-
|
|
111
|
-
value: f(R)
|
|
108
|
+
value: b(I)
|
|
112
109
|
}),
|
|
113
110
|
/* @__PURE__ */ r(o, {
|
|
114
111
|
"aria-hidden": !0,
|
|
@@ -117,49 +114,47 @@ var f = (e) => m(e, Number.isInteger(e) ? c.whole : c.cents), E = (e, t) => t <
|
|
|
117
114
|
variant: "h3",
|
|
118
115
|
children: "+"
|
|
119
116
|
}),
|
|
120
|
-
/* @__PURE__ */ r(
|
|
117
|
+
/* @__PURE__ */ r(f, {
|
|
121
118
|
label: e.extra_payment ?? e.monthly_payment,
|
|
122
|
-
|
|
123
|
-
value:
|
|
119
|
+
muted: p === 0,
|
|
120
|
+
value: b(p)
|
|
124
121
|
})
|
|
125
122
|
]
|
|
126
|
-
}), /* @__PURE__ */ n(
|
|
123
|
+
}), /* @__PURE__ */ n(c, {
|
|
127
124
|
sx: {
|
|
128
125
|
border: 1,
|
|
129
126
|
borderColor: "divider",
|
|
130
127
|
borderRadius: "8px"
|
|
131
128
|
},
|
|
132
129
|
children: [
|
|
133
|
-
/* @__PURE__ */ r(
|
|
130
|
+
/* @__PURE__ */ r(y, {
|
|
134
131
|
icon: "calendar_clock",
|
|
135
132
|
label: e.payoff ?? e.time_to_payoff,
|
|
136
|
-
|
|
137
|
-
value: E(e, l?.result.paymentCount ?? 0)
|
|
133
|
+
value: k(e, i?.result.paymentCount ?? 0)
|
|
138
134
|
}),
|
|
139
|
-
/* @__PURE__ */ r(
|
|
140
|
-
/* @__PURE__ */ r(
|
|
135
|
+
/* @__PURE__ */ r(C, { sx: { ml: 72 } }),
|
|
136
|
+
/* @__PURE__ */ r(y, {
|
|
141
137
|
icon: "list_alt",
|
|
142
138
|
label: e.interest_paid ?? e.total_interest_paid,
|
|
143
|
-
|
|
144
|
-
value: m(l?.result.totalInterestPaid ?? 0, c.cents)
|
|
139
|
+
value: m(i?.result.totalInterestPaid ?? 0, s.cents)
|
|
145
140
|
})
|
|
146
141
|
]
|
|
147
142
|
})]
|
|
148
143
|
})]
|
|
149
144
|
});
|
|
150
|
-
},
|
|
145
|
+
}, B = ({ copy: e }) => /* @__PURE__ */ n(l, {
|
|
151
146
|
role: "alert",
|
|
152
147
|
sx: {
|
|
153
148
|
alignItems: "center",
|
|
154
149
|
bgcolor: "background.paper",
|
|
155
150
|
borderRadius: "8px",
|
|
156
|
-
boxShadow:
|
|
151
|
+
boxShadow: g[1],
|
|
157
152
|
px: 32,
|
|
158
153
|
py: 40,
|
|
159
154
|
textAlign: "center"
|
|
160
155
|
},
|
|
161
156
|
children: [
|
|
162
|
-
/* @__PURE__ */ r(
|
|
157
|
+
/* @__PURE__ */ r(v, {
|
|
163
158
|
"aria-hidden": "true",
|
|
164
159
|
fill: !0,
|
|
165
160
|
name: "error",
|
|
@@ -184,9 +179,9 @@ var f = (e) => m(e, Number.isInteger(e) ? c.whole : c.cents), E = (e, t) => t <
|
|
|
184
179
|
]
|
|
185
180
|
});
|
|
186
181
|
export {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
182
|
+
B as CalculationFailed,
|
|
183
|
+
$ as PayoffResults,
|
|
184
|
+
k as formatPayoffTime
|
|
190
185
|
};
|
|
191
186
|
|
|
192
187
|
//# sourceMappingURL=PayoffResults.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayoffResults.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { buildDynamicCopy, buildPluralCopy } from '../../../common'\nimport type { PayoffCalculatorCopy } from '../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\n\nimport { SubTabs, subTabPanelProps } from '../../components/SubTabs'\nimport { ELEVATION_SHADOW } from '../../components/shared/elevation'\n\nimport { PAYMENT_INCREMENTS, type PayoffRow } from './layout'\n\ntype Tone = 'text.primary' | 'text.secondary'\n\n/** Whole dollars without cents (Figma's \"$0\", \"$155\"), otherwise to the cent. */\nconst formatPayment = (amount: number) =>\n formatCurrency(amount, Number.isInteger(amount) ? CURRENCY_FORMAT.whole : CURRENCY_FORMAT.cents)\n\n/** \"_1{number} mo\" when the copy has the short form, else the \"month\"/\"months\" plural. */\nexport const formatPayoffTime = (copy: PayoffCalculatorCopy, paymentCount: number): string => {\n if (paymentCount < 1) return '-'\n if (copy.months_short) return buildDynamicCopy(copy.months_short, String(paymentCount)) as string\n\n return buildPluralCopy(copy.month, copy.months, paymentCount, String(paymentCount)) as string\n}\n\nconst PaymentFigure = ({ label, tone, value }: { label: string; tone: Tone; value: string }) => (\n <Stack sx={{ alignItems: 'center', flex: 1, minWidth: 0 }}>\n <Text bold={true} color={tone} component=\"span\" sx={{ transition: 'color 0.5s' }} variant=\"h3\">\n {value}\n </Text>\n <Text color=\"text.secondary\" component=\"span\" variant=\"caption\">\n {label}\n </Text>\n </Stack>\n)\n\ninterface ResultRowProps {\n icon: string\n label: string\n tone: Tone\n value: string\n}\n\nconst ResultRow = ({ icon, label, tone, value }: ResultRowProps) => (\n <Stack direction=\"row\" sx={{ alignItems: 'center', gap: 16, px: 24, py: 14 }}>\n {/* Figma `_components/avatar/background` (#ECECEC) → `secondary.lighter`, dark-mode safe. */}\n <Box\n aria-hidden={true}\n sx={{\n alignItems: 'center',\n bgcolor: 'secondary.lighter',\n borderRadius: '4px',\n color: 'text.primary',\n display: 'flex',\n flexShrink: 0,\n height: 32,\n justifyContent: 'center',\n width: 32,\n }}\n >\n <Icon name={icon} size={20} />\n </Box>\n <Text component=\"span\" sx={{ flexGrow: 1, minWidth: 0 }} variant=\"body1\">\n {label}\n </Text>\n <Text\n bold={true}\n color={tone}\n component=\"span\"\n sx={{ transition: 'color 0.5s' }}\n variant=\"body1\"\n >\n {value}\n </Text>\n </Stack>\n)\n\ninterface PayoffResultsProps {\n copy: PayoffCalculatorCopy\n /** Undefined until the user has calculated: the figures then show placeholders. */\n rows?: PayoffRow[]\n}\n\n/**\n * The scenario card (Figma `Monthly CC Prediction Summary/Drilldown Content`): one tab per payment\n * increment — Standard, +$10, +$20 — each showing the entered payment plus the extra, then the\n * time to payoff and the interest paid at that payment.\n */\nexport const PayoffResults = ({ copy, rows }: PayoffResultsProps) => {\n const id = React.useId()\n const [selectedIndex, setSelectedIndex] = React.useState(0)\n\n const isCalculated = !!rows\n const tone: Tone = isCalculated ? 'text.primary' : 'text.secondary'\n const increment = PAYMENT_INCREMENTS[selectedIndex]\n const row = rows?.[selectedIndex]\n const basePayment = row ? row.monthlyPayment - row.increment : 0\n\n const tabs = PAYMENT_INCREMENTS.map((amount) => ({\n label:\n amount === 0\n ? (copy.standard ?? copy.monthly_payment)\n : `+${formatCurrency(amount, CURRENCY_FORMAT.whole)}`,\n }))\n\n return (\n <Box\n sx={{\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: ELEVATION_SHADOW[1],\n overflow: 'hidden',\n }}\n >\n {/* MUI Tabs draws its own divider under the row. */}\n <SubTabs\n ariaLabel={copy.your_results}\n id={id}\n isTypeFilter={false}\n onChange={setSelectedIndex}\n selectedIndex={selectedIndex}\n tabs={tabs}\n />\n <Stack {...subTabPanelProps(id, selectedIndex)} sx={{ gap: 16, p: 16 }}>\n <Stack\n direction=\"row\"\n sx={{ alignItems: 'center', bgcolor: 'background.default', borderRadius: '8px', py: 8 }}\n >\n <PaymentFigure\n label={copy.monthly_payment}\n tone={tone}\n value={formatPayment(basePayment)}\n />\n <Text aria-hidden={true} color=\"text.secondary\" component=\"span\" variant=\"h3\">\n +\n </Text>\n <PaymentFigure\n label={copy.extra_payment ?? copy.monthly_payment}\n tone={increment > 0 ? tone : 'text.secondary'}\n value={formatPayment(increment)}\n />\n </Stack>\n <Box sx={{ border: 1, borderColor: 'divider', borderRadius: '8px' }}>\n <ResultRow\n icon=\"calendar_clock\"\n label={copy.payoff ?? copy.time_to_payoff}\n tone={tone}\n value={formatPayoffTime(copy, row?.result.paymentCount ?? 0)}\n />\n <Divider sx={{ ml: 72 }} />\n <ResultRow\n icon=\"list_alt\"\n label={copy.interest_paid ?? copy.total_interest_paid}\n tone={tone}\n value={formatCurrency(row?.result.totalInterestPaid ?? 0, CURRENCY_FORMAT.cents)}\n />\n </Box>\n </Stack>\n </Box>\n )\n}\n\nexport const CalculationFailed = ({ copy }: { copy: PayoffCalculatorCopy }) => (\n <Stack\n role=\"alert\"\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: ELEVATION_SHADOW[1],\n px: 32,\n py: 40,\n textAlign: 'center',\n }}\n >\n <Icon aria-hidden=\"true\" fill={true} name=\"error\" size={24} sx={{ color: 'primary.main' }} />\n <Text bold={true} component=\"p\" sx={{ pb: 8, pt: 16 }} variant=\"body1\">\n {copy.calculation_failed}\n </Text>\n <Text component=\"p\" variant=\"body2\">\n {copy.calculation_failed_description}\n </Text>\n </Stack>\n)\n"],"mappings":";;;;;;;;;;;;AAqBA,IAAM,IAAA,CAAiB,MACrB,EAAe,GAAQ,OAAO,UAAU,CAAM,IAAI,EAAgB,QAAQ,EAAgB,KAAK,GAGpF,IAAA,CAAoB,GAA4B,MACvD,IAAe,IAAU,MACzB,EAAK,eAAqB,EAAiB,EAAK,cAAc,OAAO,CAAY,CAAC,IAE/E,EAAgB,EAAK,OAAO,EAAK,QAAQ,GAAc,OAAO,CAAY,CAAC,GAG9E,IAAA,CAAiB,EAAE,OAAA,GAAO,MAAA,GAAM,OAAA,EAAA,MACpC,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,YAAY;AAAA,IAAU,MAAM;AAAA,IAAG,UAAU;AAAA,EAAE;AAAA,EAAxD,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IAAM,MAAM;AAAA,IAAM,OAAO;AAAA,IAAM,WAAU;AAAA,IAAO,IAAI,EAAE,YAAY,aAAa;AAAA,IAAG,SAAQ;AAAA,IACvF,UAAA;AAAA,EACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAM;AAAA,IAAiB,WAAU;AAAA,IAAO,SAAQ;AAAA,IACnD,UAAA;AAAA,EACG,CAAA,CACD;IAUH,IAAA,CAAa,EAAE,MAAA,GAAM,OAAA,GAAO,MAAA,GAAM,OAAA,EAAA,MACtC,gBAAA,EAAC,GAAD;AAAA,EAAO,WAAU;AAAA,EAAM,IAAI;AAAA,IAAE,YAAY;AAAA,IAAU,KAAK;AAAA,IAAI,IAAI;AAAA,IAAI,IAAI;AAAA,EAAG;AAAA,EAA3E,UAAA;AAAA,IAEE,gBAAA,EAAC,GAAD;AA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EAAE,IAAI,GAAG,EAAI,CAAA;AAAA,UAC1B,gBAAA,EAAC,GAAD;AAAA,YACE,MAAK;AAAA,YACL,OAAO,EAAK,iBAAiB,EAAK;AAAA,YAC5B,MAAA;AAAA,YACN,OAAO,EAAe,GAAK,OAAO,qBAAqB,GAAG,EAAgB,KAAK;AAAA,UAChF,CAAA;AAAA,QACE;AAAA,MACA,CAAA,CAAA;AAAA,IACJ,CAAA,CAAA;AAAA;AAET,GAEa,IAAA,CAAqB,EAAE,MAAA,EAAA,MAClC,gBAAA,EAAC,GAAD;AAAA,EACE,MAAK;AAAA,EACL,IAAI;AAAA,IACF,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,cAAc;AAAA,IACd,WAAW,EAAiB,CAAA;AAAA,IAC5B,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,WAAW;AAAA,EACb;AAAA,EAVF,UAAA;AAAA,IAYE,gBAAA,EAAC,GAAD;AAAA,MAAM,eAAY;AAAA,MAAO,MAAM;AAAA,MAAM,MAAK;AAAA,MAAQ,MAAM;AAAA,MAAI,IAAI,EAAE,OAAO,eAAe;AAAA,IAAI,CAAA;AAAA,IAC5F,gBAAA,EAAC,GAAD;AAAA,MAAM,MAAM;AAAA,MAAM,WAAU;AAAA,MAAI,IAAI;AAAA,QAAE,IAAI;AAAA,QAAG,IAAI;AAAA,MAAG;AAAA,MAAG,SAAQ;AAAA,MAC5D,UAAA,EAAK;AAAA,IACF,CAAA;AAAA,IACN,gBAAA,EAAC,GAAD;AAAA,MAAM,WAAU;AAAA,MAAI,SAAQ;AAAA,MACzB,UAAA,EAAK;AAAA,IACF,CAAA;AAAA,EACD"}
|
|
1
|
+
{"version":3,"file":"PayoffResults.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { buildDynamicCopy, buildPluralCopy } from '../../../common'\nimport type { PayoffCalculatorCopy } from '../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\n\nimport { SubTabs, subTabPanelProps } from '../../components/SubTabs'\nimport { ELEVATION_SHADOW } from '../../components/shared/elevation'\n\nimport { PAYMENT_INCREMENTS, type PayoffRow } from './layout'\n\n/** Whole dollars without cents (Figma's \"$0\", \"$155\"), otherwise to the cent. */\nconst formatPayment = (amount: number) =>\n formatCurrency(amount, Number.isInteger(amount) ? CURRENCY_FORMAT.whole : CURRENCY_FORMAT.cents)\n\n/** \"_1{number} mo\" when the copy has the short form, else the \"month\"/\"months\" plural. */\nexport const formatPayoffTime = (copy: PayoffCalculatorCopy, paymentCount: number): string => {\n if (paymentCount < 1) return '-'\n if (copy.months_short) return buildDynamicCopy(copy.months_short, String(paymentCount)) as string\n\n return buildPluralCopy(copy.month, copy.months, paymentCount, String(paymentCount)) as string\n}\n\n/** `muted`: the +$0 extra payment on the Standard tab, the one figure Figma draws in text.secondary. */\nconst PaymentFigure = ({\n label,\n muted = false,\n value,\n}: {\n label: string\n muted?: boolean\n value: string\n}) => (\n <Stack sx={{ alignItems: 'center', flex: 1, minWidth: 0 }}>\n <Text\n bold={true}\n color={muted ? 'text.secondary' : 'text.primary'}\n component=\"span\"\n variant=\"h3\"\n >\n {value}\n </Text>\n <Text color=\"text.secondary\" component=\"span\" variant=\"caption\">\n {label}\n </Text>\n </Stack>\n)\n\ninterface ResultRowProps {\n icon: string\n label: string\n value: string\n}\n\nconst ResultRow = ({ icon, label, value }: ResultRowProps) => (\n <Stack direction=\"row\" sx={{ alignItems: 'center', gap: 16, px: 24, py: 14 }}>\n {/* Figma `_components/avatar/background` (#ECECEC) → `secondary.lighter`, dark-mode safe. */}\n <Box\n aria-hidden={true}\n sx={{\n alignItems: 'center',\n bgcolor: 'secondary.lighter',\n borderRadius: '4px',\n color: 'text.primary',\n display: 'flex',\n flexShrink: 0,\n height: 32,\n justifyContent: 'center',\n width: 32,\n }}\n >\n <Icon name={icon} size={20} />\n </Box>\n <Text component=\"span\" sx={{ flexGrow: 1, minWidth: 0 }} variant=\"body1\">\n {label}\n </Text>\n <Text bold={true} color=\"text.primary\" component=\"span\" variant=\"body1\">\n {value}\n </Text>\n </Stack>\n)\n\ninterface PayoffResultsProps {\n copy: PayoffCalculatorCopy\n /** Undefined until the user has calculated: the figures show $0 / \"-\" in text.primary, as Figma. */\n rows?: PayoffRow[]\n}\n\n/**\n * The scenario card (Figma `Monthly CC Prediction Summary/Drilldown Content`): one tab per payment\n * increment — Standard, +$10, +$20 — each showing the entered payment plus the extra, then the\n * time to payoff and the interest paid at that payment.\n */\nexport const PayoffResults = ({ copy, rows }: PayoffResultsProps) => {\n const id = React.useId()\n const [selectedIndex, setSelectedIndex] = React.useState(0)\n\n const increment = PAYMENT_INCREMENTS[selectedIndex]\n const row = rows?.[selectedIndex]\n const basePayment = row ? row.monthlyPayment - row.increment : 0\n\n const tabs = PAYMENT_INCREMENTS.map((amount) => ({\n label:\n amount === 0\n ? (copy.standard ?? copy.monthly_payment)\n : `+${formatCurrency(amount, CURRENCY_FORMAT.whole)}`,\n }))\n\n return (\n <Box\n sx={{\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: ELEVATION_SHADOW[1],\n overflow: 'hidden',\n }}\n >\n {/* MUI Tabs draws its own divider under the row. */}\n <SubTabs\n ariaLabel={copy.your_results}\n id={id}\n isTypeFilter={false}\n onChange={setSelectedIndex}\n selectedIndex={selectedIndex}\n tabs={tabs}\n />\n <Stack {...subTabPanelProps(id, selectedIndex)} sx={{ gap: 16, p: 16 }}>\n <Stack\n direction=\"row\"\n sx={{ alignItems: 'center', bgcolor: 'background.default', borderRadius: '8px', py: 8 }}\n >\n <PaymentFigure label={copy.monthly_payment} value={formatPayment(basePayment)} />\n <Text aria-hidden={true} color=\"text.secondary\" component=\"span\" variant=\"h3\">\n +\n </Text>\n <PaymentFigure\n label={copy.extra_payment ?? copy.monthly_payment}\n muted={increment === 0}\n value={formatPayment(increment)}\n />\n </Stack>\n <Box sx={{ border: 1, borderColor: 'divider', borderRadius: '8px' }}>\n <ResultRow\n icon=\"calendar_clock\"\n label={copy.payoff ?? copy.time_to_payoff}\n value={formatPayoffTime(copy, row?.result.paymentCount ?? 0)}\n />\n <Divider sx={{ ml: 72 }} />\n <ResultRow\n icon=\"list_alt\"\n label={copy.interest_paid ?? copy.total_interest_paid}\n value={formatCurrency(row?.result.totalInterestPaid ?? 0, CURRENCY_FORMAT.cents)}\n />\n </Box>\n </Stack>\n </Box>\n )\n}\n\nexport const CalculationFailed = ({ copy }: { copy: PayoffCalculatorCopy }) => (\n <Stack\n role=\"alert\"\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: ELEVATION_SHADOW[1],\n px: 32,\n py: 40,\n textAlign: 'center',\n }}\n >\n <Icon aria-hidden=\"true\" fill={true} name=\"error\" size={24} sx={{ color: 'primary.main' }} />\n <Text bold={true} component=\"p\" sx={{ pb: 8, pt: 16 }} variant=\"body1\">\n {copy.calculation_failed}\n </Text>\n <Text component=\"p\" variant=\"body2\">\n {copy.calculation_failed_description}\n </Text>\n </Stack>\n)\n"],"mappings":";;;;;;;;;;;;AAmBA,IAAM,IAAA,CAAiB,MACrB,EAAe,GAAQ,OAAO,UAAU,CAAM,IAAI,EAAgB,QAAQ,EAAgB,KAAK,GAGpF,IAAA,CAAoB,GAA4B,MACvD,IAAe,IAAU,MACzB,EAAK,eAAqB,EAAiB,EAAK,cAAc,OAAO,CAAY,CAAC,IAE/E,EAAgB,EAAK,OAAO,EAAK,QAAQ,GAAc,OAAO,CAAY,CAAC,GAI9E,IAAA,CAAiB,EACrB,OAAA,GACA,OAAA,IAAQ,IACR,OAAA,EAAA,MAMA,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,YAAY;A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,MAAM,WAAU;AAAA,MAAI,IAAI;AAAA,QAAE,IAAI;AAAA,QAAG,IAAI;AAAA,MAAG;AAAA,MAAG,SAAQ;AAAA,MAC5D,UAAA,EAAK;AAAA,IACF,CAAA;AAAA,IACN,gBAAA,EAAC,GAAD;AAAA,MAAM,WAAU;AAAA,MAAI,SAAQ;AAAA,MACzB,UAAA,EAAK;AAAA,IACF,CAAA;AAAA,EACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GlobalCopy } from '../../../core';
|
|
2
2
|
import { ActionBlockProps } from '../../mappings/blocks';
|
|
3
|
-
export declare const selectPayoffStrategiesCopy: (copy: GlobalCopy) => import('../../../core
|
|
3
|
+
export declare const selectPayoffStrategiesCopy: (copy: GlobalCopy) => import('../../../core').PayoffStrategiesCopy | undefined;
|
|
4
4
|
/**
|
|
5
5
|
* Debt Payoff Strategies drawer: Avalanche / Snowball tabs, each with the strategy's words and the
|
|
6
6
|
* beat's debt accounts in that strategy's order. A tapped account opens its Account Details (the
|
|
@@ -1,29 +1,32 @@
|
|
|
1
|
-
import { useAccountStore as l, useGlobalCopyStore as
|
|
1
|
+
import { useAccountStore as l, useGlobalCopyStore as f } from "../../../common/context/hooks.es.js";
|
|
2
2
|
import p from "../../../common/components/drawer/Drawer.es.js";
|
|
3
|
-
import { useRequiredCopy as
|
|
4
|
-
import { AccountDetailsBlock as
|
|
5
|
-
import { buildStrategies as
|
|
6
|
-
import
|
|
7
|
-
import { useState as
|
|
8
|
-
import { observer as
|
|
3
|
+
import { useRequiredCopy as m } from "../useRequiredCopy.es.js";
|
|
4
|
+
import { AccountDetailsBlock as y } from "../AccountDetailsBlock/AccountDetailsBlock.es.js";
|
|
5
|
+
import { buildStrategies as d, resolveStrategyAccounts as g, toPayoffAccountRow as S } from "./layout.es.js";
|
|
6
|
+
import A from "./PayoffStrategiesContent.es.js";
|
|
7
|
+
import { useState as _ } from "react";
|
|
8
|
+
import { observer as C } from "mobx-react-lite";
|
|
9
9
|
import { Fragment as v, jsx as t, jsxs as b } from "react/jsx-runtime";
|
|
10
|
-
var P = (e) => e.insights_feed?.
|
|
11
|
-
const [o, c] =
|
|
12
|
-
return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ t(
|
|
10
|
+
var P = (e) => e.insights_feed?.payoff_strategies, R = C(function({ beat: r }) {
|
|
11
|
+
const [o, c] = _(null), { accounts: s } = f(), { visibleAccounts: i } = l(), a = m(P), n = g(r, i).map(S), u = () => c(null);
|
|
12
|
+
return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ t(A, {
|
|
13
13
|
accounts: n,
|
|
14
14
|
copy: a,
|
|
15
15
|
onAccountClick: c,
|
|
16
|
-
strategies:
|
|
16
|
+
strategies: d(a)
|
|
17
17
|
}), /* @__PURE__ */ t(p, {
|
|
18
18
|
ariaLabelClose: s?.close_account_details_aria,
|
|
19
19
|
isOpen: o !== null,
|
|
20
20
|
onClose: u,
|
|
21
21
|
title: s?.account_details,
|
|
22
|
-
children: o && /* @__PURE__ */ t(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
children: o && /* @__PURE__ */ t(y, {
|
|
23
|
+
beat: {
|
|
24
|
+
...r,
|
|
25
|
+
primary_account: void 0,
|
|
26
|
+
primary_account_guid: o
|
|
27
|
+
},
|
|
28
|
+
payoffStrategiesView: !0
|
|
29
|
+
})
|
|
27
30
|
})] });
|
|
28
31
|
});
|
|
29
32
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayoffStrategiesBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport { Drawer, useAccountStore, useGlobalCopyStore } from '../../../common'\nimport type { GlobalCopy } from '../../../core'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { AccountDetailsBlock } from '../AccountDetailsBlock'\nimport { useRequiredCopy } from '../useRequiredCopy'\n\nimport PayoffStrategiesContent from './PayoffStrategiesContent'\nimport { buildStrategies, resolveStrategyAccounts, toPayoffAccountRow } from './layout'\n\nexport const selectPayoffStrategiesCopy = (copy: GlobalCopy)
|
|
1
|
+
{"version":3,"file":"PayoffStrategiesBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport { Drawer, useAccountStore, useGlobalCopyStore } from '../../../common'\nimport type { GlobalCopy } from '../../../core'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { AccountDetailsBlock } from '../AccountDetailsBlock'\nimport { useRequiredCopy } from '../useRequiredCopy'\n\nimport PayoffStrategiesContent from './PayoffStrategiesContent'\nimport { buildStrategies, resolveStrategyAccounts, toPayoffAccountRow } from './layout'\n\nexport const selectPayoffStrategiesCopy = (copy: GlobalCopy) =>\n copy.insights_feed?.payoff_strategies\n\n/**\n * Debt Payoff Strategies drawer: Avalanche / Snowball tabs, each with the strategy's words and the\n * beat's debt accounts in that strategy's order. A tapped account opens its Account Details (the\n * shared AccountDetailsBlock) in a nested drawer.\n */\nexport const PayoffStrategiesBlock = observer(function PayoffStrategiesBlock({\n beat,\n}: ActionBlockProps) {\n const [tappedAccountGuid, setTappedAccountGuid] = useState<string | null>(null)\n const { accounts: accountsCopy } = useGlobalCopyStore()\n const { visibleAccounts } = useAccountStore()\n const copy = useRequiredCopy(selectPayoffStrategiesCopy)\n\n const rows = resolveStrategyAccounts(beat, visibleAccounts).map(toPayoffAccountRow)\n const closeAccountDetails = () => setTappedAccountGuid(null)\n\n return (\n <>\n <PayoffStrategiesContent\n accounts={rows}\n copy={copy}\n onAccountClick={setTappedAccountGuid}\n strategies={buildStrategies(copy)}\n />\n <Drawer\n ariaLabelClose={accountsCopy?.close_account_details_aria}\n isOpen={tappedAccountGuid !== null}\n onClose={closeAccountDetails}\n title={accountsCopy?.account_details}\n >\n {tappedAccountGuid && (\n // The shared block shows the beat's account, so hand it the tapped one instead.\n <AccountDetailsBlock\n beat={{ ...beat, primary_account: undefined, primary_account_guid: tappedAccountGuid }}\n payoffStrategiesView={true}\n />\n )}\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;AAaA,IAAa,IAAA,CAA8B,MACzC,EAAK,eAAe,mBAOT,IAAwB,EAAS,SAA+B,EAC3E,MAAA,EAAA,GACmB;AACnB,QAAM,CAAC,GAAmB,CAAA,IAAwB,EAAwB,IAAI,GACxE,EAAE,UAAU,EAAA,IAAiB,EAAmB,GAChD,EAAE,iBAAA,EAAA,IAAoB,EAAgB,GACtC,IAAO,EAAgB,CAA0B,GAEjD,IAAO,EAAwB,GAAM,CAAe,EAAE,IAAI,CAAkB,GAC5E,IAAA,MAA4B,EAAqB,IAAI;AAE3D,SACE,gBAAA,EAAA,GAAA,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IACE,UAAU;AAAA,IACJ,MAAA;AAAA,IACN,gBAAgB;AAAA,IAChB,YAAY,EAAgB,CAAI;AAAA,EACjC,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,IACE,gBAAgB,GAAc;AAAA,IAC9B,QAAQ,MAAsB;AAAA,IAC9B,SAAS;AAAA,IACT,OAAO,GAAc;AAAA,IAEpB,UAAA,KAEC,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM;AAAA,QAAE,GAAG;AAAA,QAAM,iBAAiB;AAAA,QAAW,sBAAsB;AAAA,MAAkB;AAAA,MACrF,sBAAsB;AAAA,IACvB,CAAA;AAAA,EAEG,CAAA,CACR,EAAA,CAAA;AAEN,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PayoffStrategiesCopy } from '../../../core/types/localization/InsightsFeedCopy';
|
|
2
2
|
import { PayoffAccountRow, PayoffStrategy } from './layout';
|
|
3
3
|
export interface PayoffStrategiesContentProps {
|
|
4
|
-
copy:
|
|
4
|
+
copy: PayoffStrategiesCopy;
|
|
5
5
|
strategies: PayoffStrategy[];
|
|
6
6
|
/** The beat's debt accounts, unordered; each tab orders them its own way. */
|
|
7
7
|
accounts: PayoffAccountRow[];
|