@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,324 +1,138 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import { useGlobalStore as
|
|
3
|
-
import { VISUALLY_HIDDEN_SX as
|
|
4
|
-
import { BEAT_CARD_TITLE_KEY as
|
|
5
|
-
import { useBeatActions as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"feedback_placeholder",
|
|
31
|
-
"thank_you",
|
|
32
|
-
"feedback_sent",
|
|
33
|
-
"oops",
|
|
34
|
-
"feedback_error",
|
|
35
|
-
"try_again",
|
|
36
|
-
"rating_aria",
|
|
37
|
-
"step_count"
|
|
38
|
-
], _e = (e) => xe.every((i) => le(e?.[i]) !== void 0) ? e : void 0, g = [
|
|
39
|
-
1,
|
|
40
|
-
2,
|
|
41
|
-
3,
|
|
42
|
-
4,
|
|
43
|
-
5
|
|
44
|
-
], X = 3, U = 500, ve = "survey_shown", M = "survey_phase", $ = {
|
|
45
|
-
ArrowDown: 1,
|
|
46
|
-
ArrowLeft: -1,
|
|
47
|
-
ArrowRight: 1,
|
|
48
|
-
ArrowUp: -1
|
|
49
|
-
}, Se = (e) => e === "sent" || e === "error", Ee = ({ step: e }) => /* @__PURE__ */ o(u, {
|
|
50
|
-
"aria-hidden": !0,
|
|
51
|
-
direction: "row",
|
|
52
|
-
sx: {
|
|
53
|
-
gap: 4,
|
|
54
|
-
height: 4
|
|
55
|
-
},
|
|
56
|
-
children: Array.from({ length: X }, (i, t) => /* @__PURE__ */ o(S, { sx: (a) => ({
|
|
57
|
-
bgcolor: t <= e ? "primary.main" : a.palette.grey[a.palette.mode === "dark" ? 500 : 300],
|
|
58
|
-
borderRadius: "24px",
|
|
59
|
-
flex: 1
|
|
60
|
-
}) }, t))
|
|
61
|
-
}), Re = (e, i) => {
|
|
62
|
-
if (e === "Home") return 0;
|
|
63
|
-
if (e === "End") return g.length - 1;
|
|
64
|
-
if (e in $) return (i + $[e] + g.length) % g.length;
|
|
65
|
-
}, ke = ({ ariaLabel: e, label: i, onChange: t, tabStopRef: a, value: n }) => {
|
|
66
|
-
const p = m([]), y = n === void 0 ? 0 : g.indexOf(n), b = (l, f) => {
|
|
67
|
-
const c = Re(l.key, f);
|
|
68
|
-
c !== void 0 && (l.preventDefault(), p.current[c]?.focus(), t(g[c]));
|
|
69
|
-
};
|
|
70
|
-
return /* @__PURE__ */ o(u, {
|
|
71
|
-
"aria-label": i,
|
|
72
|
-
direction: "row",
|
|
73
|
-
role: "radiogroup",
|
|
74
|
-
children: g.map((l, f) => {
|
|
75
|
-
const c = l === n;
|
|
76
|
-
return /* @__PURE__ */ o(be, {
|
|
77
|
-
"aria-checked": c,
|
|
78
|
-
"aria-label": e(l),
|
|
79
|
-
onClick: () => t(l),
|
|
80
|
-
onKeyDown: (r) => b(r, f),
|
|
81
|
-
ref: (r) => {
|
|
82
|
-
p.current[f] = r, f === y && (a.current = r);
|
|
83
|
-
},
|
|
84
|
-
role: "radio",
|
|
85
|
-
sx: (r) => ({
|
|
86
|
-
bgcolor: c ? ge(r.palette.primary.main, r.palette.action.selectedOpacity) : void 0,
|
|
87
|
-
border: 1,
|
|
88
|
-
borderColor: c ? "primary.main" : "divider",
|
|
89
|
-
color: "primary.main",
|
|
90
|
-
flex: 1,
|
|
91
|
-
fontSize: 13,
|
|
92
|
-
fontWeight: 600,
|
|
93
|
-
height: 44,
|
|
94
|
-
lineHeight: "16px",
|
|
95
|
-
zIndex: c ? 1 : 0,
|
|
96
|
-
"&:not(:first-of-type)": { ml: "-1px" },
|
|
97
|
-
"&:first-of-type": {
|
|
98
|
-
borderBottomLeftRadius: 4,
|
|
99
|
-
borderTopLeftRadius: 4
|
|
100
|
-
},
|
|
101
|
-
"&:last-of-type": {
|
|
102
|
-
borderBottomRightRadius: 4,
|
|
103
|
-
borderTopRightRadius: 4
|
|
104
|
-
},
|
|
105
|
-
"&.Mui-focusVisible": {
|
|
106
|
-
outline: `2px solid ${r.palette.info.main}`,
|
|
107
|
-
outlineOffset: -2,
|
|
108
|
-
zIndex: 2
|
|
109
|
-
}
|
|
110
|
-
}),
|
|
111
|
-
tabIndex: f === y ? 0 : -1,
|
|
112
|
-
children: l
|
|
113
|
-
}, l);
|
|
114
|
-
})
|
|
115
|
-
});
|
|
116
|
-
}, W = ({ action: e, bannerRef: i, message: t, severity: a }) => /* @__PURE__ */ h(u, {
|
|
117
|
-
direction: "row",
|
|
118
|
-
ref: i,
|
|
119
|
-
role: a === "error" ? "alert" : "status",
|
|
120
|
-
sx: (n) => {
|
|
121
|
-
const p = n.palette.mode === "dark";
|
|
122
|
-
return {
|
|
123
|
-
bgcolor: p ? n.palette[a].main : n.palette[a][600],
|
|
124
|
-
borderRadius: "4px",
|
|
125
|
-
color: p ? n.palette.common.black : n.palette.common.white,
|
|
126
|
-
px: 16,
|
|
127
|
-
py: 8
|
|
128
|
-
};
|
|
129
|
-
},
|
|
130
|
-
tabIndex: -1,
|
|
131
|
-
children: [/* @__PURE__ */ o(S, {
|
|
132
|
-
sx: {
|
|
133
|
-
flexShrink: 0,
|
|
134
|
-
pt: 8,
|
|
135
|
-
width: 32
|
|
136
|
-
},
|
|
137
|
-
children: /* @__PURE__ */ o(he, {
|
|
138
|
-
fill: !0,
|
|
139
|
-
name: a === "success" ? "check_circle" : "error",
|
|
140
|
-
size: 24
|
|
141
|
-
})
|
|
142
|
-
}), /* @__PURE__ */ h(u, {
|
|
143
|
-
sx: {
|
|
144
|
-
gap: 12,
|
|
145
|
-
pl: 4,
|
|
146
|
-
py: 8
|
|
147
|
-
},
|
|
148
|
-
children: [/* @__PURE__ */ o(C, {
|
|
149
|
-
sx: { color: "inherit" },
|
|
150
|
-
variant: "subtitle1",
|
|
151
|
-
children: t
|
|
152
|
-
}), e]
|
|
153
|
-
})]
|
|
154
|
-
}), Me = me(({ beatGuid: e = "", payload: i }) => {
|
|
155
|
-
const t = _e(i.instance_slot?.data), { beatContext: a, setBeatContext: n } = ie(), { onCtaAction: p } = ce(), y = se(), b = pe(), l = y.appDataStore.appConfig?.postHogPublicKey, f = de(l), c = fe(l), [r, J] = _(0), [E, Q] = _([]), [R, Z] = _(""), [d, G] = _(() => {
|
|
156
|
-
const s = a[e]?.[M];
|
|
157
|
-
return Se(s) ? s : "survey";
|
|
158
|
-
}), [I, B] = _(!1), k = m(!1), D = m(i.is_dismissed);
|
|
159
|
-
D.current = i.is_dismissed;
|
|
160
|
-
const w = m(null), K = m(null), P = m(null), H = m(!1), L = !!t;
|
|
161
|
-
x(() => {
|
|
162
|
-
!L || a[e]?.survey_shown || (n(e, { [ve]: !0 }), b(c.shown));
|
|
1
|
+
import { buildDynamicCopy as d } from "../../../../core/utils/Localization.es.js";
|
|
2
|
+
import { useGlobalStore as K, useInsightsV2Store as N } from "../../../../common/context/hooks.es.js";
|
|
3
|
+
import { VISUALLY_HIDDEN_SX as P } from "../../../../common/constants/Styles.es.js";
|
|
4
|
+
import { BEAT_CARD_TITLE_KEY as I, BEAT_KEEP_AFTER_DISMISS_KEY as L } from "../../../../core/stores/InsightsV2Store.es.js";
|
|
5
|
+
import { useBeatActions as F } from "../../../beatActions.es.js";
|
|
6
|
+
import { SURVEY_CONTEXT as h, dismissSurveyBeat as O, readSurvey as Y, surveyEvents as j, surveyState as q } from "./survey.es.js";
|
|
7
|
+
import { useAnalyticsEvent as V } from "../../../analytics/useAnalyticsEvent.es.js";
|
|
8
|
+
import { RatingScale as W } from "./RatingScale.es.js";
|
|
9
|
+
import { StepBar as M } from "./StepBar.es.js";
|
|
10
|
+
import { SurveyResult as k } from "./SurveyResult.es.js";
|
|
11
|
+
import { useEffect as a, useRef as c, useState as U } from "react";
|
|
12
|
+
import { observer as X } from "mobx-react-lite";
|
|
13
|
+
import z from "@mui/material/Stack";
|
|
14
|
+
import { jsx as l, jsxs as J } from "react/jsx-runtime";
|
|
15
|
+
import Q from "@mui/material/Box";
|
|
16
|
+
import Z from "@mui/material/TextField";
|
|
17
|
+
var ge = X(({ beatGuid: t = "", payload: m }) => {
|
|
18
|
+
const e = Y(m.instance_slot?.data), { beatContext: D, setBeatContext: n } = N(), u = K(), _ = V(), { onCtaAction: H } = F(), f = D[t], { step: r, answers: x, phase: s } = q(f, e?.steps.length), v = c(null), E = c(null), g = c(null), R = c(r), A = c(s), [S, b] = U(!1), w = !!f?.[h.SHOWN], B = !!f?.[L], C = u.appDataStore.appConfig?.postHogPublicKey;
|
|
19
|
+
a(() => {
|
|
20
|
+
!t || !e || w || (n(t, { [h.SHOWN]: !0 }), _(j(e, C).shown));
|
|
21
|
+
}, [
|
|
22
|
+
t,
|
|
23
|
+
_,
|
|
24
|
+
C,
|
|
25
|
+
n,
|
|
26
|
+
w,
|
|
27
|
+
e
|
|
28
|
+
]), a(() => {
|
|
29
|
+
s === "error" && B && !S && !m.is_dismissed && n(t, { [L]: !1 });
|
|
163
30
|
}, [
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
31
|
+
t,
|
|
32
|
+
B,
|
|
33
|
+
m.is_dismissed,
|
|
34
|
+
s,
|
|
35
|
+
S,
|
|
36
|
+
n
|
|
167
37
|
]);
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const O = t ? [
|
|
175
|
-
t.question1,
|
|
176
|
-
t.question2,
|
|
177
|
-
t.question3
|
|
178
|
-
] : [], te = {
|
|
179
|
-
sent: t?.thank_you,
|
|
180
|
-
error: t?.oops
|
|
181
|
-
}, T = d === "survey" ? O[r] : te[d];
|
|
182
|
-
if (x(() => {
|
|
183
|
-
e && typeof T == "string" && n(e, { [V]: T });
|
|
38
|
+
const y = s ? {
|
|
39
|
+
sent: e?.success_title,
|
|
40
|
+
error: e?.error_title
|
|
41
|
+
}[s] : e?.steps[r]?.question;
|
|
42
|
+
if (a(() => {
|
|
43
|
+
t && y && n(t, { [I]: y });
|
|
184
44
|
}, [
|
|
185
|
-
|
|
45
|
+
t,
|
|
186
46
|
n,
|
|
187
|
-
|
|
188
|
-
]),
|
|
189
|
-
|
|
190
|
-
}, [
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
47
|
+
y
|
|
48
|
+
]), a(() => () => {
|
|
49
|
+
t && n(t, { [I]: void 0 });
|
|
50
|
+
}, [t, n]), a(() => {
|
|
51
|
+
r !== R.current && (R.current = r, e?.steps[r]?.type === "text" ? E.current?.focus() : v.current?.focus());
|
|
52
|
+
}, [r, e]), a(() => {
|
|
53
|
+
s !== A.current && (A.current = s, s && g.current?.focus());
|
|
54
|
+
}, [s]), !e) return null;
|
|
55
|
+
if (s) return s === "sent" ? /* @__PURE__ */ l(k, {
|
|
56
|
+
bannerRef: g,
|
|
57
|
+
message: e.success_message,
|
|
58
|
+
severity: "success"
|
|
59
|
+
}) : /* @__PURE__ */ l(k, {
|
|
60
|
+
bannerRef: g,
|
|
61
|
+
message: e.error_message,
|
|
62
|
+
retry: {
|
|
63
|
+
label: e.retry_label,
|
|
64
|
+
pending: S,
|
|
65
|
+
onPress: async () => {
|
|
66
|
+
b(!0);
|
|
67
|
+
try {
|
|
68
|
+
await O({
|
|
69
|
+
beatGuid: t,
|
|
70
|
+
stores: u,
|
|
71
|
+
onCtaAction: H
|
|
72
|
+
});
|
|
73
|
+
} catch (i) {
|
|
74
|
+
u.captureException(i, {
|
|
75
|
+
store: "FeedbackBlock",
|
|
76
|
+
handler: "retry"
|
|
77
|
+
});
|
|
78
|
+
} finally {
|
|
79
|
+
b(!1);
|
|
80
|
+
}
|
|
213
81
|
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
if (d !== "survey") return /* @__PURE__ */ o(S, {
|
|
82
|
+
},
|
|
83
|
+
severity: "error"
|
|
84
|
+
});
|
|
85
|
+
const o = e.steps[r];
|
|
86
|
+
if (!o) return null;
|
|
87
|
+
const p = x[r], T = (i) => n(t, { [h.ANSWERS]: Object.assign([...x], { [r]: i }) });
|
|
88
|
+
return /* @__PURE__ */ J(z, {
|
|
222
89
|
sx: {
|
|
223
|
-
|
|
90
|
+
gap: 24,
|
|
91
|
+
pb: 24,
|
|
224
92
|
px: 16,
|
|
225
93
|
width: "100%"
|
|
226
94
|
},
|
|
227
|
-
children:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ l(Q, {
|
|
97
|
+
component: "span",
|
|
98
|
+
sx: P,
|
|
99
|
+
children: d(e.step_count, String(r + 1), String(e.steps.length))
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ l(M, {
|
|
102
|
+
step: r,
|
|
103
|
+
steps: e.steps.length
|
|
104
|
+
}),
|
|
105
|
+
o.type === "rating" ? /* @__PURE__ */ l(W, {
|
|
106
|
+
ariaLabel: (i) => d(e.rating_aria, String(i)),
|
|
107
|
+
label: o.question,
|
|
108
|
+
maxLabel: o.max_label,
|
|
109
|
+
minLabel: o.min_label,
|
|
110
|
+
onChange: T,
|
|
111
|
+
tabStopRef: v,
|
|
112
|
+
value: typeof p == "number" ? p : void 0
|
|
113
|
+
}) : /* @__PURE__ */ l(Z, {
|
|
114
|
+
inputRef: E,
|
|
115
|
+
label: o.label,
|
|
116
|
+
minRows: 2,
|
|
117
|
+
multiline: !0,
|
|
118
|
+
onChange: (i) => T(i.target.value),
|
|
119
|
+
placeholder: o.placeholder,
|
|
120
|
+
size: "small",
|
|
121
|
+
slotProps: { htmlInput: {
|
|
122
|
+
"aria-required": !0,
|
|
123
|
+
maxLength: 500
|
|
124
|
+
} },
|
|
237
125
|
sx: {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
minHeight: 0,
|
|
241
|
-
p: 0
|
|
126
|
+
"& .MuiInputBase-root": { p: 12 },
|
|
127
|
+
"& textarea": { lineHeight: "20px" }
|
|
242
128
|
},
|
|
243
|
-
|
|
244
|
-
children: t.try_again
|
|
245
|
-
}),
|
|
246
|
-
bannerRef: w,
|
|
247
|
-
message: t.feedback_error,
|
|
248
|
-
severity: "error"
|
|
249
|
-
})
|
|
250
|
-
});
|
|
251
|
-
const v = r === 2, ne = v ? R.trim() !== "" : E[r] !== void 0;
|
|
252
|
-
return /* @__PURE__ */ h(u, {
|
|
253
|
-
sx: { width: "100%" },
|
|
254
|
-
children: [/* @__PURE__ */ h(u, {
|
|
255
|
-
sx: {
|
|
256
|
-
gap: 24,
|
|
257
|
-
pb: 16,
|
|
258
|
-
px: 16
|
|
259
|
-
},
|
|
260
|
-
children: [
|
|
261
|
-
/* @__PURE__ */ o(S, {
|
|
262
|
-
component: "span",
|
|
263
|
-
sx: ae,
|
|
264
|
-
children: F(t.step_count, String(r + 1), String(X))
|
|
265
|
-
}),
|
|
266
|
-
/* @__PURE__ */ o(Ee, { step: r }),
|
|
267
|
-
v ? /* @__PURE__ */ o(ye, {
|
|
268
|
-
inputRef: P,
|
|
269
|
-
label: t.feedback,
|
|
270
|
-
minRows: 2,
|
|
271
|
-
multiline: !0,
|
|
272
|
-
onChange: (s) => Z(s.target.value),
|
|
273
|
-
placeholder: t.feedback_placeholder,
|
|
274
|
-
slotProps: { htmlInput: { maxLength: U } },
|
|
275
|
-
value: R
|
|
276
|
-
}) : /* @__PURE__ */ h(u, {
|
|
277
|
-
sx: {
|
|
278
|
-
gap: 6,
|
|
279
|
-
pb: 8
|
|
280
|
-
},
|
|
281
|
-
children: [/* @__PURE__ */ o(ke, {
|
|
282
|
-
ariaLabel: (s) => F(t.rating_aria, String(s)),
|
|
283
|
-
label: O[r],
|
|
284
|
-
onChange: (s) => Q((A) => Object.assign([...A], { [r]: s })),
|
|
285
|
-
tabStopRef: K,
|
|
286
|
-
value: E[r]
|
|
287
|
-
}), /* @__PURE__ */ h(u, {
|
|
288
|
-
direction: "row",
|
|
289
|
-
sx: { justifyContent: "space-between" },
|
|
290
|
-
children: [/* @__PURE__ */ o(C, {
|
|
291
|
-
color: "text.secondary",
|
|
292
|
-
variant: "caption",
|
|
293
|
-
children: t.strongly_disagree
|
|
294
|
-
}), /* @__PURE__ */ o(C, {
|
|
295
|
-
color: "text.secondary",
|
|
296
|
-
variant: "caption",
|
|
297
|
-
children: t.strongly_agree
|
|
298
|
-
})]
|
|
299
|
-
})]
|
|
300
|
-
})
|
|
301
|
-
]
|
|
302
|
-
}), /* @__PURE__ */ o(u, {
|
|
303
|
-
sx: {
|
|
304
|
-
pb: 16,
|
|
305
|
-
px: 16
|
|
306
|
-
},
|
|
307
|
-
children: /* @__PURE__ */ o(z, {
|
|
308
|
-
disabled: !ne || I,
|
|
309
|
-
onClick: v ? () => {
|
|
310
|
-
re();
|
|
311
|
-
} : oe,
|
|
312
|
-
variant: "outlined",
|
|
313
|
-
children: v ? t.submit_feedback : t.continue
|
|
129
|
+
value: typeof p == "string" ? p : ""
|
|
314
130
|
})
|
|
315
|
-
|
|
131
|
+
]
|
|
316
132
|
});
|
|
317
133
|
});
|
|
318
134
|
export {
|
|
319
|
-
|
|
320
|
-
ve as SURVEY_SHOWN_KEY,
|
|
321
|
-
Me as default
|
|
135
|
+
ge as default
|
|
322
136
|
};
|
|
323
137
|
|
|
324
138
|
//# sourceMappingURL=FeedbackBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedbackBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/FeedbackBlock/FeedbackBlock.tsx"],"sourcesContent":["import { type KeyboardEvent, type RefObject, useEffect, useRef, useState } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport ButtonBase from '@mui/material/ButtonBase'\nimport Stack from '@mui/material/Stack'\nimport TextField from '@mui/material/TextField'\nimport { alpha } from '@mui/material/styles'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useGlobalStore, useInsightsV2Store, VISUALLY_HIDDEN_SX } from '../../../../common'\nimport {\n BEAT_CARD_TITLE_KEY,\n BEAT_KEEP_AFTER_DISMISS_KEY,\n} from '../../../../core/stores/InsightsV2Store'\nimport type { InstanceSlotData } from '../../../../core/types/Insights'\nimport { buildDynamicCopy } from '../../../../core/utils/Localization'\nimport { useAnalyticsEvent } from '../../../analytics'\nimport { useBeatActions } from '../../../beatActions'\nimport { HOST_ACTIONS } from '../../../ctaActions'\nimport { asNonEmptyText } from '../../slotReaders'\nimport type { BlockProps } from '../../types'\nimport { userFeedbackSurveyEvents, userFeedbackSurveyId } from './survey'\n\n/** The survey's words, sent by the server in `instance_slot.data`. */\nconst COPY_SLOTS = [\n 'question1',\n 'question2',\n 'question3',\n 'strongly_disagree',\n 'strongly_agree',\n 'continue',\n 'submit_feedback',\n 'feedback',\n 'feedback_placeholder',\n 'thank_you',\n 'feedback_sent',\n 'oops',\n 'feedback_error',\n 'try_again',\n // `_1{rating}`: a scale button's accessible name.\n 'rating_aria',\n // `_1{step} of _2{total}`: the survey's progress for screen readers (the step bar is decorative).\n 'step_count',\n] as const\ntype FeedbackCopy = Record<(typeof COPY_SLOTS)[number], string>\n\n/** Every copy slot as non-blank text, else undefined: the survey draws nothing rather than a blank label. */\nconst readCopy = (data?: InstanceSlotData): FeedbackCopy | undefined =>\n COPY_SLOTS.every((key) => asNonEmptyText(data?.[key]) !== undefined)\n ? (data as FeedbackCopy)\n : undefined\n\nconst RATINGS = [1, 2, 3, 4, 5]\nconst STEPS = 3\n/** The free-text answer's limit, on the field and on the sent payload. */\nconst FEEDBACK_MAX_LENGTH = 500\n/** beatContext key: the survey's shown event already fired for this beat (survives a remount after Undo). */\nexport const SURVEY_SHOWN_KEY = 'survey_shown'\n/** beatContext key: the result phase ('sent' | 'error'), so a remount shows it, not the survey again. */\nexport const SURVEY_PHASE_KEY = 'survey_phase'\n\n// ARIA radio group keys: arrows step (wrapping), Home and End jump to the ends.\nconst RATING_KEY_STEPS: Record<string, number> = {\n ArrowDown: 1,\n ArrowLeft: -1,\n ArrowRight: 1,\n ArrowUp: -1,\n}\n\ntype Phase = 'survey' | 'sent' | 'error'\n\nconst isResultPhase = (value: unknown): value is Exclude<Phase, 'survey'> =>\n value === 'sent' || value === 'error'\n\nconst StepBar = ({ step }: { step: number }) => (\n <Stack aria-hidden={true} direction=\"row\" sx={{ gap: 4, height: 4 }}>\n {Array.from({ length: STEPS }, (_, index) => (\n <Box\n key={index}\n sx={(theme) => ({\n // Figma `_components/stepper/inactive`: grey 300 light, 500 dark.\n bgcolor:\n index <= step\n ? 'primary.main'\n : theme.palette.grey[theme.palette.mode === 'dark' ? 500 : 300],\n borderRadius: '24px',\n flex: 1,\n })}\n />\n ))}\n </Stack>\n)\n\n// Figma \"Toggle | NumberRating\": five joined 44px cells, the picked one tinted primary. A radio group:\n// one tab stop (the picked cell, else the first), and the arrow keys move focus and pick.\nconst ratingKeyTarget = (key: string, index: number) => {\n if (key === 'Home') return 0\n if (key === 'End') return RATINGS.length - 1\n if (key in RATING_KEY_STEPS) {\n return (index + RATING_KEY_STEPS[key] + RATINGS.length) % RATINGS.length\n }\n return undefined\n}\n\nconst RatingScale = ({\n ariaLabel,\n label,\n onChange,\n tabStopRef,\n value,\n}: {\n ariaLabel: (rating: number) => string\n label: string\n onChange: (rating: number) => void\n /** Receives the group's tab stop, for focus to land on after Continue. */\n tabStopRef: RefObject<HTMLButtonElement | null>\n value?: number\n}) => {\n const cells = useRef<(HTMLButtonElement | null)[]>([])\n const tabStop = value === undefined ? 0 : RATINGS.indexOf(value)\n\n const onKeyDown = (event: KeyboardEvent, index: number) => {\n const target = ratingKeyTarget(event.key, index)\n if (target === undefined) return\n event.preventDefault()\n cells.current[target]?.focus()\n onChange(RATINGS[target])\n }\n\n return (\n <Stack aria-label={label} direction=\"row\" role=\"radiogroup\">\n {RATINGS.map((rating, index) => {\n const selected = rating === value\n return (\n <ButtonBase\n aria-checked={selected}\n aria-label={ariaLabel(rating)}\n key={rating}\n onClick={() => onChange(rating)}\n onKeyDown={(event) => onKeyDown(event, index)}\n ref={(cell) => {\n cells.current[index] = cell\n if (index === tabStop) tabStopRef.current = cell\n }}\n role=\"radio\"\n sx={(theme) => ({\n bgcolor: selected\n ? alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity)\n : undefined,\n border: 1,\n borderColor: selected ? 'primary.main' : 'divider',\n color: 'primary.main',\n flex: 1,\n fontSize: 13,\n fontWeight: 600,\n height: 44,\n lineHeight: '16px',\n zIndex: selected ? 1 : 0,\n // Joined cells: one shared border between neighbours, the picked cell drawn on top.\n '&:not(:first-of-type)': { ml: '-1px' },\n '&:first-of-type': { borderBottomLeftRadius: 4, borderTopLeftRadius: 4 },\n '&:last-of-type': { borderBottomRightRadius: 4, borderTopRightRadius: 4 },\n // Inset, so the joined neighbours do not cover it; raised above the picked cell.\n '&.Mui-focusVisible': {\n outline: `2px solid ${theme.palette.info.main}`,\n outlineOffset: -2,\n zIndex: 2,\n },\n })}\n tabIndex={index === tabStop ? 0 : -1}\n >\n {rating}\n </ButtonBase>\n )\n })}\n </Stack>\n )\n}\n\n// Figma `<Snackbar>` (`_components/snackbar/*/background`): light mode draws white text on the 600 tone; dark\n// mode the lighter main tone, where white fails AA, so black text (6.6:1 on error, 7.6:1 on success). The icon\n// takes the same colour.\nconst StatusBanner = ({\n action,\n bannerRef,\n message,\n severity,\n}: {\n action?: React.ReactNode\n bannerRef: RefObject<HTMLDivElement | null>\n message: string\n severity: 'success' | 'error'\n}) => (\n <Stack\n direction=\"row\"\n ref={bannerRef}\n role={severity === 'error' ? 'alert' : 'status'}\n sx={(theme) => {\n const isDark = theme.palette.mode === 'dark'\n return {\n bgcolor: isDark ? theme.palette[severity].main : theme.palette[severity][600],\n borderRadius: '4px',\n color: isDark ? theme.palette.common.black : theme.palette.common.white,\n px: 16,\n py: 8,\n }\n }}\n tabIndex={-1}\n >\n <Box sx={{ flexShrink: 0, pt: 8, width: 32 }}>\n <Icon fill={true} name={severity === 'success' ? 'check_circle' : 'error'} size={24} />\n </Box>\n <Stack sx={{ gap: 12, pl: 4, py: 8 }}>\n <Text sx={{ color: 'inherit' }} variant=\"subtitle1\">\n {message}\n </Text>\n {action}\n </Stack>\n </Stack>\n)\n\n/**\n * The User Feedback survey (Figma 1283:81740): two 1-5 ratings and a free-text answer, one per step,\n * then a thank-you. The question is the card's title. On submit it sends PostHog's survey events and\n * dismisses the beat, keeping the card (and its thank-you) in the feed until the next refresh.\n */\nconst FeedbackBlock = observer(({ beatGuid = '', payload }: BlockProps) => {\n const copy = readCopy(payload.instance_slot?.data)\n const { beatContext, setBeatContext } = useInsightsV2Store()\n const { onCtaAction } = useBeatActions()\n const stores = useGlobalStore()\n const fireAnalyticsEvent = useAnalyticsEvent()\n const postHogPublicKey = stores.appDataStore.appConfig?.postHogPublicKey\n const surveyId = userFeedbackSurveyId(postHogPublicKey)\n const surveyEvents = userFeedbackSurveyEvents(postHogPublicKey)\n\n const [step, setStep] = useState(0)\n const [ratings, setRatings] = useState<(number | undefined)[]>([])\n const [text, setText] = useState('')\n const [phase, setPhase] = useState<Phase>(() => {\n const savedPhase = beatContext[beatGuid]?.[SURVEY_PHASE_KEY]\n return isResultPhase(savedPhase) ? savedPhase : 'survey'\n })\n const [isSubmitting, setIsSubmitting] = useState(false)\n // The state disables the button on the next render; the ref drops a second click before it.\n const isSubmittingRef = useRef(false)\n // The latest is_dismissed, read after the host's dismiss call settles.\n const isDismissedRef = useRef(payload.is_dismissed)\n isDismissedRef.current = payload.is_dismissed\n\n const bannerRef = useRef<HTMLDivElement>(null)\n const ratingTabStopRef = useRef<HTMLButtonElement>(null)\n const feedbackInputRef = useRef<HTMLTextAreaElement>(null)\n const hasContinuedRef = useRef(false)\n\n // Once per beat, as pulse's survey shown, and only once the survey can draw.\n const hasCopy = !!copy\n useEffect(() => {\n if (!hasCopy || beatContext[beatGuid]?.[SURVEY_SHOWN_KEY]) return\n setBeatContext(beatGuid, { [SURVEY_SHOWN_KEY]: true })\n fireAnalyticsEvent(surveyEvents.shown)\n }, [beatGuid, hasCopy, surveyId])\n\n // The survey's controls unmount with the result, so focus moves to the banner that replaced them.\n // Only on a change: a card that mounts with its result (a remount) must not steal focus.\n const initialPhase = useRef(phase)\n useEffect(() => {\n if (phase !== 'survey' && phase !== initialPhase.current) bannerRef.current?.focus()\n }, [phase])\n\n // After Continue the pressed button stays, so focus moves on to the next step's first control.\n useEffect(() => {\n if (!hasContinuedRef.current) return\n if (step === STEPS - 1) feedbackInputRef.current?.focus()\n else ratingTabStopRef.current?.focus()\n }, [step])\n\n const questions = copy ? [copy.question1, copy.question2, copy.question3] : []\n const resultTitles = { sent: copy?.thank_you, error: copy?.oops }\n const title = phase === 'survey' ? questions[step] : resultTitles[phase]\n\n useEffect(() => {\n if (beatGuid && typeof title === 'string') {\n setBeatContext(beatGuid, { [BEAT_CARD_TITLE_KEY]: title })\n }\n }, [beatGuid, setBeatContext, title])\n\n // Hand the header back to the envelope's title when the block goes.\n useEffect(\n () => () => {\n if (beatGuid) setBeatContext(beatGuid, { [BEAT_CARD_TITLE_KEY]: undefined })\n },\n [beatGuid, setBeatContext],\n )\n\n if (!copy) return null\n\n const showResult = (result: Exclude<Phase, 'survey'>) => {\n setBeatContext(beatGuid, { [SURVEY_PHASE_KEY]: result })\n setPhase(result)\n }\n\n const dismiss = async () => {\n try {\n if (!onCtaAction) throw new Error('No onCtaAction handler to dismiss the beat')\n setBeatContext(beatGuid, { [BEAT_KEEP_AFTER_DISMISS_KEY]: true })\n await onCtaAction({ beatGuid, name: HOST_ACTIONS.dismissBeat })\n showResult('sent')\n } catch (error) {\n stores.captureException(error, { store: 'FeedbackBlock', handler: 'dismissBeat' })\n // Set before the call (the host flips is_dismissed mid-call); cleared so the menu returns on\n // failure, unless the host dismissed the beat anyway (clearing it would swap Oops for the hidden card).\n if (!isDismissedRef.current)\n setBeatContext(beatGuid, { [BEAT_KEEP_AFTER_DISMISS_KEY]: false })\n showResult('error')\n }\n }\n\n // One run at a time: Submit and Try Again ignore a press while the host's dismiss is pending.\n const runOnce = async (run: () => Promise<void>) => {\n if (isSubmittingRef.current) return\n isSubmittingRef.current = true\n setIsSubmitting(true)\n try {\n await run()\n } finally {\n isSubmittingRef.current = false\n setIsSubmitting(false)\n }\n }\n\n const submit = () =>\n runOnce(() => {\n const [first, second] = ratings\n fireAnalyticsEvent(\n surveyEvents.sent(first, second, text.trim().slice(0, FEEDBACK_MAX_LENGTH)),\n )\n fireAnalyticsEvent(surveyEvents.dismissed)\n return dismiss()\n })\n\n const continueToNextStep = () => {\n hasContinuedRef.current = true\n setStep(step + 1)\n }\n\n if (phase !== 'survey') {\n return (\n <Box sx={{ pb: 16, px: 16, width: '100%' }}>\n {phase === 'sent' ? (\n <StatusBanner bannerRef={bannerRef} message={copy.feedback_sent} severity=\"success\" />\n ) : (\n <StatusBanner\n action={\n <Button\n disabled={isSubmitting}\n onClick={() => void runOnce(dismiss)}\n sx={{ alignSelf: 'flex-start', color: 'inherit', minHeight: 0, p: 0 }}\n variant=\"text\"\n >\n {copy.try_again}\n </Button>\n }\n bannerRef={bannerRef}\n message={copy.feedback_error}\n severity=\"error\"\n />\n )}\n </Box>\n )\n }\n\n const isTextStep = step === STEPS - 1\n const canContinue = isTextStep ? text.trim() !== '' : ratings[step] !== undefined\n\n return (\n <Stack sx={{ width: '100%' }}>\n <Stack sx={{ gap: 24, pb: 16, px: 16 }}>\n <Box component=\"span\" sx={VISUALLY_HIDDEN_SX}>\n {buildDynamicCopy(copy.step_count, String(step + 1), String(STEPS)) as string}\n </Box>\n <StepBar step={step} />\n {isTextStep ? (\n <TextField\n inputRef={feedbackInputRef}\n label={copy.feedback}\n minRows={2}\n multiline={true}\n onChange={(event) => setText(event.target.value)}\n placeholder={copy.feedback_placeholder}\n slotProps={{ htmlInput: { maxLength: FEEDBACK_MAX_LENGTH } }}\n value={text}\n />\n ) : (\n <Stack sx={{ gap: 6, pb: 8 }}>\n <RatingScale\n ariaLabel={(rating) => buildDynamicCopy(copy.rating_aria, String(rating)) as string}\n label={questions[step]}\n onChange={(rating) =>\n setRatings((current) => Object.assign([...current], { [step]: rating }))\n }\n tabStopRef={ratingTabStopRef}\n value={ratings[step]}\n />\n <Stack direction=\"row\" sx={{ justifyContent: 'space-between' }}>\n <Text color=\"text.secondary\" variant=\"caption\">\n {copy.strongly_disagree}\n </Text>\n <Text color=\"text.secondary\" variant=\"caption\">\n {copy.strongly_agree}\n </Text>\n </Stack>\n </Stack>\n )}\n </Stack>\n <Stack sx={{ pb: 16, px: 16 }}>\n <Button\n disabled={!canContinue || isSubmitting}\n onClick={isTextStep ? () => void submit() : continueToNextStep}\n variant=\"outlined\"\n >\n {isTextStep ? copy.submit_feedback : copy.continue}\n </Button>\n </Stack>\n </Stack>\n )\n})\n\nexport default FeedbackBlock\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4BA,IAAM,KAAa;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;AACF,GAIM,KAAA,CAAY,MAChB,GAAW,MAAA,CAAO,MAAQ,GAAe,IAAO,CAAA,CAAI,MAAM,MAAS,IAC9D,IACD,QAEA,IAAU;AAAA,EAAC;AAAA,EAAG;AAAA,EAAG;AAAA,EAAG;AAAA,EAAG;AAAC,GACxB,IAAQ,GAER,IAAsB,KAEf,KAAmB,gBAEnB,IAAmB,gBAG1B,IAA2C;AAAA,EAC/C,WAAW;AAAA,EACX,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,SAAS;AACX,GAIM,KAAA,CAAiB,MACrB,MAAU,UAAU,MAAU,SAE1B,KAAA,CAAW,EAAE,MAAA,EAAA,MACjB,gBAAA,EAAC,GAAD;AAAA,EAAO,eAAa;AAAA,EAAM,WAAU;AAAA,EAAM,IAAI;AAAA,IAAE,KAAK;AAAA,IAAG,QAAQ;AAAA,EAAE;AAAA,EAC/D,UAAA,MAAM,KAAK,EAAE,QAAQ,EAAM,GAAA,CAAI,GAAG,MACjC,gBAAA,EAAC,GAAD,EAEE,IAAA,CAAK,OAAW;AAAA,IAEd,SACE,KAAS,IACL,iBACA,EAAM,QAAQ,KAAK,EAAM,QAAQ,SAAS,SAAS,MAAM,GAAA;AAAA,IAC/D,cAAc;AAAA,IACd,MAAM;AAAA,EACR,GACD,GAVM,CAUN,CACF;AACI,CAAA,GAKH,KAAA,CAAmB,GAAa,MAAkB;AACtD,MAAI,MAAQ,OAAQ,QAA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A,CAAY,MAAW,EAAiB,EAAK,aAAa,OAAO,CAAM,CAAC;AAAA,YACxE,OAAO,EAAU,CAAA;AAAA,YACjB,UAAA,CAAW,MACT,EAAA,CAAY,MAAY,OAAO,OAAO,CAAC,GAAG,CAAO,GAAG,EAAA,CAAG,CAAA,GAAO,EAAO,CAAC,CAAC;AAAA,YAEzE,YAAY;AAAA,YACZ,OAAO,EAAQ,CAAA;AAAA,UAChB,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,YAAO,WAAU;AAAA,YAAM,IAAI,EAAE,gBAAgB,gBAAgB;AAAA,YAA7D,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,cAAM,OAAM;AAAA,cAAiB,SAAQ;AAAA,cAClC,UAAA,EAAK;AAAA,YACF,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,cAAM,OAAM;AAAA,cAAiB,SAAQ;AAAA,cAClC,UAAA,EAAK;AAAA,YACF,CAAA,CACD;AAAA,UACF,CAAA,CAAA;AAAA;MAEJ;AAAA,IACP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI;AAAA,QAAE,IAAI;AAAA,QAAI,IAAI;AAAA,MAAG;AAAA,MAC1B,UAAA,gBAAA,EAAC,GAAD;AAAA,QACE,UAAU,CAAC,MAAe;AAAA,QAC1B,SAAS,IAAA,MAAA;AAAmB,UAAK,GAAO;AAAA,YAAI;AAAA,QAC5C,SAAQ;AAAA,QAEP,UAAA,IAAa,EAAK,kBAAkB,EAAK;AAAA,MACpC,CAAA;AAAA,IACH,CAAA,CACF;AAAA;AAEX,CAAC"}
|
|
1
|
+
{"version":3,"file":"FeedbackBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/FeedbackBlock/FeedbackBlock.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport TextField from '@mui/material/TextField'\n\nimport { observer } from 'mobx-react-lite'\n\nimport { useGlobalStore, useInsightsV2Store, VISUALLY_HIDDEN_SX } from '../../../../common'\nimport {\n BEAT_CARD_TITLE_KEY,\n BEAT_KEEP_AFTER_DISMISS_KEY,\n} from '../../../../core/stores/InsightsV2Store'\nimport { buildDynamicCopy } from '../../../../core/utils/Localization'\nimport { useAnalyticsEvent } from '../../../analytics'\nimport { useBeatActions } from '../../../beatActions'\nimport type { BlockProps } from '../../types'\nimport { RatingScale } from './RatingScale'\nimport { StepBar } from './StepBar'\nimport { SurveyResult } from './SurveyResult'\nimport {\n dismissSurveyBeat,\n readSurvey,\n SURVEY_CONTEXT,\n type SurveyAnswer,\n surveyEvents,\n surveyState,\n TEXT_MAX_LENGTH,\n} from './survey'\n\n/**\n * A survey in the card: one step per screen (a 1-5 rating or a free-text answer), then its result.\n * The block draws the current step, keeping the answers in the beat context, and the result; the\n * card's primary CTA (`answer_feedback_survey`) moves on and submits. The question is the card's title.\n */\nconst FeedbackBlock = observer(({ beatGuid = '', payload }: BlockProps) => {\n const survey = readSurvey(payload.instance_slot?.data)\n const { beatContext, setBeatContext } = useInsightsV2Store()\n const stores = useGlobalStore()\n const fireAnalyticsEvent = useAnalyticsEvent()\n const { onCtaAction } = useBeatActions()\n const context = beatContext[beatGuid]\n const { step, answers, phase } = surveyState(context, survey?.steps.length)\n const ratingTabStopRef = useRef<HTMLButtonElement>(null)\n const textRef = useRef<HTMLTextAreaElement>(null)\n const bannerRef = useRef<HTMLDivElement>(null)\n const shownStep = useRef(step)\n const shownPhase = useRef(phase)\n const [retrying, setRetrying] = useState(false)\n const shown = !!context?.[SURVEY_CONTEXT.SHOWN]\n const keepsCard = !!context?.[BEAT_KEEP_AFTER_DISMISS_KEY]\n const postHogKey = stores.appDataStore.appConfig?.postHogPublicKey\n\n // Once per beat, and only once the survey can draw.\n useEffect(() => {\n if (!beatGuid || !survey || shown) return\n setBeatContext(beatGuid, { [SURVEY_CONTEXT.SHOWN]: true })\n fireAnalyticsEvent(surveyEvents(survey, postHogKey).shown)\n }, [beatGuid, fireAnalyticsEvent, postHogKey, setBeatContext, shown, survey])\n\n // A failed dismiss leaves the beat live, so hand the card back its overflow menu; not while a retry\n // runs, and not once the host flipped is_dismissed (the kept card is all that shows the error).\n useEffect(() => {\n if (phase === 'error' && keepsCard && !retrying && !payload.is_dismissed) {\n setBeatContext(beatGuid, { [BEAT_KEEP_AFTER_DISMISS_KEY]: false })\n }\n }, [beatGuid, keepsCard, payload.is_dismissed, phase, retrying, setBeatContext])\n\n const title = phase\n ? { sent: survey?.success_title, error: survey?.error_title }[phase]\n : survey?.steps[step]?.question\n\n useEffect(() => {\n if (beatGuid && title) setBeatContext(beatGuid, { [BEAT_CARD_TITLE_KEY]: title })\n }, [beatGuid, setBeatContext, title])\n\n // Hand the header back to the envelope's title when the block goes.\n useEffect(\n () => () => {\n if (beatGuid) setBeatContext(beatGuid, { [BEAT_CARD_TITLE_KEY]: undefined })\n },\n [beatGuid, setBeatContext],\n )\n\n // Continue is the card's button, which stays put, so focus moves on to the new step's control.\n useEffect(() => {\n if (step === shownStep.current) return\n shownStep.current = step\n if (survey?.steps[step]?.type === 'text') textRef.current?.focus()\n else ratingTabStopRef.current?.focus()\n }, [step, survey])\n\n // The result replaces the steps and the card's button, so focus moves to it; not on a remount.\n useEffect(() => {\n if (phase === shownPhase.current) return\n shownPhase.current = phase\n if (phase) bannerRef.current?.focus()\n }, [phase])\n\n if (!survey) return null\n\n if (phase) {\n return phase === 'sent' ? (\n <SurveyResult bannerRef={bannerRef} message={survey.success_message} severity=\"success\" />\n ) : (\n <SurveyResult\n bannerRef={bannerRef}\n message={survey.error_message}\n retry={{\n label: survey.retry_label,\n pending: retrying,\n onPress: async () => {\n setRetrying(true)\n try {\n await dismissSurveyBeat({ beatGuid, stores, onCtaAction })\n } catch (error) {\n stores.captureException(error, { store: 'FeedbackBlock', handler: 'retry' })\n } finally {\n setRetrying(false)\n }\n },\n }}\n severity=\"error\"\n />\n )\n }\n\n const current = survey.steps[step]\n if (!current) return null\n\n const answer = answers[step]\n const setAnswer = (value: SurveyAnswer) =>\n setBeatContext(beatGuid, {\n [SURVEY_CONTEXT.ANSWERS]: Object.assign([...answers], { [step]: value }),\n })\n\n return (\n <Stack sx={{ gap: 24, pb: 24, px: 16, width: '100%' }}>\n <Box component=\"span\" sx={VISUALLY_HIDDEN_SX}>\n {\n buildDynamicCopy(\n survey.step_count,\n String(step + 1),\n String(survey.steps.length),\n ) as string\n }\n </Box>\n <StepBar step={step} steps={survey.steps.length} />\n {current.type === 'rating' ? (\n <RatingScale\n ariaLabel={(rating) => buildDynamicCopy(survey.rating_aria, String(rating)) as string}\n label={current.question}\n maxLabel={current.max_label}\n minLabel={current.min_label}\n onChange={setAnswer}\n tabStopRef={ratingTabStopRef}\n value={typeof answer === 'number' ? answer : undefined}\n />\n ) : (\n <TextField\n inputRef={textRef}\n label={current.label}\n minRows={2}\n multiline={true}\n onChange={(event) => setAnswer(event.target.value)}\n placeholder={current.placeholder}\n size=\"small\"\n // aria-required, not `required`, which would add \" *\" to Figma's label.\n slotProps={{ htmlInput: { 'aria-required': true, maxLength: TEXT_MAX_LENGTH } }}\n // Figma: 12px padding and 20px lines, so two lines make its 64px field. From the TextField, so\n // the selector outranks the theme's multiline padding-top.\n sx={{ '& .MuiInputBase-root': { p: 12 }, '& textarea': { lineHeight: '20px' } }}\n value={typeof answer === 'string' ? answer : ''}\n />\n )}\n </Stack>\n )\n})\n\nexport default FeedbackBlock\n"],"mappings":";;;;;;;;;;;;;;;;AAmCA,IAAM,KAAgB,EAAA,CAAU,EAAE,UAAA,IAAW,IAAI,SAAA,EAAA,MAA0B;AACzE,QAAM,IAAS,EAAW,EAAQ,eAAe,IAAI,GAC/C,EAAE,aAAA,GAAa,gBAAA,EAAA,IAAmB,EAAmB,GACrD,IAAS,EAAe,GACxB,IAAqB,EAAkB,GACvC,EAAE,aAAA,EAAA,IAAgB,EAAe,GACjC,IAAU,EAAY,CAAA,GACtB,EAAE,MAAA,GAAM,SAAA,GAA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;AAAA;AAEX,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
interface RatingScaleProps {
|
|
3
|
+
ariaLabel: (rating: number) => string;
|
|
4
|
+
label: string;
|
|
5
|
+
maxLabel: string;
|
|
6
|
+
minLabel: string;
|
|
7
|
+
onChange: (rating: number) => void;
|
|
8
|
+
/** Receives the group's tab stop, for focus to land on when the step appears. */
|
|
9
|
+
tabStopRef: RefObject<HTMLButtonElement | null>;
|
|
10
|
+
value?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Figma "Toggle | NumberRating": five joined 44px cells, the picked one tinted primary, over its end
|
|
14
|
+
* labels. A radio group: one tab stop (the picked cell, else the first); the arrow keys move and pick.
|
|
15
|
+
*/
|
|
16
|
+
export declare const RatingScale: ({ ariaLabel, label, maxLabel, minLabel, onChange, tabStopRef, value, }: RatingScaleProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { useRef as w } from "react";
|
|
2
|
+
import d from "@mui/material/Stack";
|
|
3
|
+
import { Text as m } from "@mxenabled/mxui";
|
|
4
|
+
import { jsx as a, jsxs as u } from "react/jsx-runtime";
|
|
5
|
+
import { alpha as R } from "@mui/material/styles";
|
|
6
|
+
import v from "@mui/material/ButtonBase";
|
|
7
|
+
var n = [
|
|
8
|
+
1,
|
|
9
|
+
2,
|
|
10
|
+
3,
|
|
11
|
+
4,
|
|
12
|
+
5
|
|
13
|
+
], h = {
|
|
14
|
+
ArrowDown: 1,
|
|
15
|
+
ArrowLeft: -1,
|
|
16
|
+
ArrowRight: 1,
|
|
17
|
+
ArrowUp: -1
|
|
18
|
+
}, S = (e, c) => {
|
|
19
|
+
if (e === "Home") return 0;
|
|
20
|
+
if (e === "End") return n.length - 1;
|
|
21
|
+
if (e in h) return (c + h[e] + n.length) % n.length;
|
|
22
|
+
}, z = ({ ariaLabel: e, label: c, maxLabel: x, minLabel: b, onChange: f, tabStopRef: y, value: l }) => {
|
|
23
|
+
const p = w([]), s = l === void 0 ? 0 : n.indexOf(l), g = (r, i) => {
|
|
24
|
+
const o = S(r.key, i);
|
|
25
|
+
o !== void 0 && (r.preventDefault(), p.current[o]?.focus(), f(n[o]));
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ u(d, {
|
|
28
|
+
sx: { gap: 6 },
|
|
29
|
+
children: [/* @__PURE__ */ a(d, {
|
|
30
|
+
"aria-label": c,
|
|
31
|
+
direction: "row",
|
|
32
|
+
role: "radiogroup",
|
|
33
|
+
children: n.map((r, i) => {
|
|
34
|
+
const o = r === l;
|
|
35
|
+
return /* @__PURE__ */ a(v, {
|
|
36
|
+
"aria-checked": o,
|
|
37
|
+
"aria-label": e(r),
|
|
38
|
+
onClick: () => f(r),
|
|
39
|
+
onKeyDown: (t) => g(t, i),
|
|
40
|
+
ref: (t) => {
|
|
41
|
+
p.current[i] = t, i === s && (y.current = t);
|
|
42
|
+
},
|
|
43
|
+
role: "radio",
|
|
44
|
+
sx: (t) => ({
|
|
45
|
+
bgcolor: o ? R(t.palette.primary.main, t.palette.action.selectedOpacity) : void 0,
|
|
46
|
+
border: 1,
|
|
47
|
+
borderColor: o ? "primary.main" : "divider",
|
|
48
|
+
color: "primary.main",
|
|
49
|
+
flex: 1,
|
|
50
|
+
fontSize: 13,
|
|
51
|
+
fontWeight: 600,
|
|
52
|
+
height: 44,
|
|
53
|
+
lineHeight: "16px",
|
|
54
|
+
zIndex: o ? 1 : 0,
|
|
55
|
+
"&:not(:first-of-type)": { ml: "-1px" },
|
|
56
|
+
"&:first-of-type": {
|
|
57
|
+
borderBottomLeftRadius: 4,
|
|
58
|
+
borderTopLeftRadius: 4
|
|
59
|
+
},
|
|
60
|
+
"&:last-of-type": {
|
|
61
|
+
borderBottomRightRadius: 4,
|
|
62
|
+
borderTopRightRadius: 4
|
|
63
|
+
},
|
|
64
|
+
"&.Mui-focusVisible": {
|
|
65
|
+
outline: `2px solid ${t.palette.info.main}`,
|
|
66
|
+
outlineOffset: -2,
|
|
67
|
+
zIndex: 2
|
|
68
|
+
}
|
|
69
|
+
}),
|
|
70
|
+
tabIndex: i === s ? 0 : -1,
|
|
71
|
+
children: r
|
|
72
|
+
}, r);
|
|
73
|
+
})
|
|
74
|
+
}), /* @__PURE__ */ u(d, {
|
|
75
|
+
direction: "row",
|
|
76
|
+
sx: { justifyContent: "space-between" },
|
|
77
|
+
children: [/* @__PURE__ */ a(m, {
|
|
78
|
+
color: "text.secondary",
|
|
79
|
+
variant: "caption",
|
|
80
|
+
children: b
|
|
81
|
+
}), /* @__PURE__ */ a(m, {
|
|
82
|
+
color: "text.secondary",
|
|
83
|
+
variant: "caption",
|
|
84
|
+
children: x
|
|
85
|
+
})]
|
|
86
|
+
})]
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
export {
|
|
90
|
+
z as RatingScale
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=RatingScale.es.js.map
|