@mx-cartographer/experiences 9.7.201 → 9.7.203
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 +10 -0
- package/dist/core/stores/AnalyticsStore.es.js +9 -8
- package/dist/core/stores/AnalyticsStore.es.js.map +1 -1
- package/dist/core/stores/InsightsV2Store.d.ts +4 -0
- package/dist/core/stores/InsightsV2Store.es.js +10 -8
- package/dist/core/stores/InsightsV2Store.es.js.map +1 -1
- package/dist/core/types/Insights.d.ts +1 -0
- package/dist/core/types/Insights.es.js.map +1 -1
- package/dist/core/utils/PostHog.d.ts +2 -0
- package/dist/core/utils/PostHog.es.js +6 -0
- package/dist/core/utils/PostHog.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +75 -73
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.d.ts +5 -2
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js +27 -8
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/FeedbackBlock.d.ts +14 -0
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/FeedbackBlock.es.js +324 -0
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/FeedbackBlock.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/index.d.ts +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/survey.d.ts +29 -0
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/survey.es.js +25 -0
- package/dist/insights-v2/blocks/ComponentBlocks/FeedbackBlock/survey.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/QuizBlock.es.js +8 -8
- package/dist/insights-v2/blocks/ComponentBlocks/index.d.ts +1 -0
- package/dist/insights-v2/components/BaseLayout.es.js +137 -135
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/components/Header.d.ts +5 -1
- package/dist/insights-v2/components/Header.es.js +15 -15
- package/dist/insights-v2/components/Header.es.js.map +1 -1
- package/dist/insights-v2/index.es.js +51 -49
- package/dist/insights-v2/mappings/blocks.es.js +96 -94
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { useRef } from 'react'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { slot, type InsightsPayload } from '../../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport { Confetti } from '../../../components/shared/Confetti'\nimport { ReactComponent as PaidOffCardGraphic } from '../../../components/shared/images/PaidOffCard.svg'\nimport { ReactComponent as SavingsGraphic } from '../../../components/shared/images/SavingsAccountDeposit.svg'\nimport { statusIconName } from '../../../components/statusIcon'\nimport { useContainerDimensions } from '../../../hooks/useContainerDimensions'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { asLogoRef, asNumber, asText } from '../../slotReaders'\nimport { DetailedAccountBlock, isDetailedAccountVariant } from '../DetailedAccountBlock'\n\nimport { HeaderComponent } from './HeaderComponent'\nimport { IconComponent } from './IconComponent'\nimport { getLayoutConfig } from './layout'\n\nconst AccountBlock = ({ payload }: { payload: InsightsPayload; beatGuid?: string }) => {\n const theme = useTheme()\n const containerRef = useRef<HTMLDivElement>(null)\n const { height, width } = useContainerDimensions(containerRef)\n const { instance_slot } = payload\n const { variant, institution_guid, institution_name, icon_name, merchant_name } = instance_slot\n\n if (isDetailedAccountVariant(variant)) return <DetailedAccountBlock payload={payload} />\n\n // V1 beats send no `data`. V2 reads only `data` (no `slotOrFlat`): its stale flat fields must never show.\n const { data } = instance_slot\n const v2 = data !== undefined\n const amount = v2 ? asNumber(slot(data, 'amount')) : instance_slot.amount\n // One V2 slot; V1 named it `sub_text` on the standard tile and `label` on the confetti one.\n const v2SubText = asText(slot(data, 'sub_text'))\n const sub_text = v2 ? v2SubText : instance_slot.sub_text\n const label = v2 ? v2SubText : instance_slot.label\n const header_text = v2 ? asText(slot(data, 'header_text')) : instance_slot.header_text\n // `icon` carries the tile glyph when the beat's `logo` is kept for its compact card (charges_summary).\n const logo = asLogoRef(slot(data, 'logo')) ?? asLogoRef(slot(data, 'icon'))\n const layoutConfig = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n 'default',\n 'AccountBlock',\n )\n\n if (layoutConfig?.isConfetti) {\n const confettiIcon = statusIconName(logo?.guid)\n const graphics: Record<string, React.ReactNode> = {\n paidOffCard: (\n // The 58x46 SVG's card sits 14px down (its check badge overflows top-right); box it to the\n // 48x32 frame so it lines up with the text.\n <Box sx={{ flexShrink: 0, height: 32, position: 'relative', width: 48 }}>\n <PaidOffCardGraphic\n aria-hidden={true}\n role=\"presentation\"\n style={{ left: 0, position: 'absolute', top: -14 }}\n />\n </Box>\n ),\n savings: <SavingsGraphic aria-hidden={true} height={55} role=\"presentation\" width={55} />,\n logo: (\n <Box\n sx={{\n borderRadius: '4px',\n flexShrink: 0,\n height: 48,\n overflow: 'hidden',\n width: 48,\n }}\n >\n {/* An ICO- icon keeps the tile's look: an outlined glyph in success.contrastText on\n the success.main square. It is drawn with Icon, as IconComponent does, because\n LogoFromGuid fills every ICO- glyph. Any other guid renders via LogoFromGuid. */}\n {confettiIcon ? (\n <Stack\n data-icon={confettiIcon}\n sx={{\n alignItems: 'center',\n bgcolor: 'success.main',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n }}\n >\n <Icon\n aria-hidden={true}\n name={confettiIcon}\n size={layoutConfig.logo_icon_size ?? 24}\n sx={{ color: 'success.contrastText' }}\n />\n </Stack>\n ) : logo?.guid ? (\n <LogoFromGuid logo={logo} size={48} />\n ) : null}\n </Box>\n ),\n }\n const graphic = graphics[layoutConfig.graphic ?? 'logo']\n\n // The payer: V2's `secondary_text`, else the merchant, else the institution.\n const payer = asText(slot(data, 'secondary_text')) || (merchant_name ?? institution_name)\n const secondaryText = layoutConfig.secondarySource === 'merchant' ? payer : label\n const secondary = secondaryText ? (\n <Text\n color={layoutConfig.secondaryColor}\n noWrap={layoutConfig.secondaryOneLine}\n variant={layoutConfig.secondaryVariant}\n >\n {secondaryText}\n </Text>\n ) : null\n // No figure for a missing amount: `formatCurrency` would print a confident `$0.00`.\n const amountText =\n amount != null ? (\n <Text\n bold={!layoutConfig.amountKeepsVariantWeight}\n color=\"success.dark\"\n variant={layoutConfig.amountVariant}\n >\n {`${layoutConfig.amountPrefix ?? ''}${formatCurrency(amount, CURRENCY_FORMAT.cents)}`}\n </Text>\n ) : null\n\n return (\n <Box\n ref={containerRef}\n sx={{\n backgroundImage: layoutConfig.gradient,\n bgcolor: 'background.paper',\n overflow: 'hidden',\n position: 'relative',\n p: 16,\n width: '100%',\n }}\n >\n <Box\n sx={{\n inset: 0,\n pointerEvents: 'none',\n position: 'absolute',\n zIndex: 1,\n }}\n >\n <Confetti height={height} shouldRun={height > 0 && width > 0} width={width} />\n </Box>\n\n <Stack\n sx={{\n borderRadius: '8px',\n ...(layoutConfig.cardShadow && { boxShadow: theme.shadows[1] }),\n overflow: 'hidden',\n position: 'relative',\n width: '100%',\n zIndex: 2,\n }}\n >\n {layoutConfig.categoryStrip && header_text && (\n <Box sx={{ bgcolor: 'success.main', px: 12, py: 4 }}>\n <Text color=\"success.contrastText\" variant=\"caption\">\n {header_text}\n </Text>\n </Box>\n )}\n\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'success.lighter',\n border: '1px solid',\n borderColor: 'success.main',\n borderRadius: '8px',\n // With a strip above, the body's top corners tuck under it (no double border line).\n ...(layoutConfig.categoryStrip && {\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n borderTop: 0,\n }),\n flexDirection: 'row',\n ...layoutConfig.rowSx,\n }}\n >\n <Box sx={{ display: 'flex', flexShrink: 0 }}>{graphic}</Box>\n\n <Stack sx={{ flex: '1 0 0', minWidth: 0 }}>\n {layoutConfig.secondaryPosition === 'above' && secondary}\n {amountText}\n {layoutConfig.secondaryPosition === 'below' && secondary}\n </Stack>\n </Stack>\n </Stack>\n </Box>\n )\n }\n\n return (\n <Stack\n sx={{\n background: layoutConfig.background,\n p: 16,\n }}\n >\n <Stack\n sx={{\n borderRadius: '8px',\n boxShadow: theme.shadows[1],\n width: '100%',\n }}\n >\n {header_text && <HeaderComponent headerText={header_text} />}\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n gap: 16,\n // Figma's standard tile: 16px on every side, 80px tall in the 112px slot.\n p: 16,\n width: '100%',\n ...(header_text && {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n }),\n ...((institution_guid || icon_name || logo?.guid) && {\n flexDirection: 'row',\n }),\n }}\n >\n <IconComponent logo={logo} slot={instance_slot} variant={variant} />\n\n <Stack>\n {amount != null && (\n <Text variant=\"h2\">{formatCurrency(amount, CURRENCY_FORMAT.cents)}</Text>\n )}\n <Stack sx={{ gap: 8, flexDirection: 'row', alignItems: 'center' }}>\n {layoutConfig.sub_logo && (\n <Icon color=\"warning\" fill={true} name={layoutConfig.sub_logo} size={20} />\n )}\n {sub_text && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {sub_text}\n </Text>\n )}\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default AccountBlock\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyBA,IA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,GAAQ,EAAgB,KAAK;AAAA,QAAQ,CAAA,GAE1E,gBAAA,EAAC,GAAD;AAAA,UAAO,IAAI;AAAA,YAAE,KAAK;AAAA,YAAG,eAAe;AAAA,YAAO,YAAY;AAAA,UAAS;AAAA,UAAhE,UAAA,CACG,EAAa,YACZ,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAU,MAAM;AAAA,YAAM,MAAM,EAAa;AAAA,YAAU,MAAM;AAAA,UAAK,CAAA,GAE3E,KACC,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAiB,SAAQ;AAAA,YAClC,UAAA;AAAA,UACG,CAAA,CAEH;AAAA,QACF,CAAA,CAAA,EAAA,CAAA,CACF;AAAA,MACF,CAAA,CAAA;AAAA;EACF,CAAA;AAEX"}
|
|
1
|
+
{"version":3,"file":"AccountBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { useRef } from 'react'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { slot, type InsightsPayload } from '../../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport { LinedCardZeroState } from '../../../../insights/components/shared/ZeroState/LinedCardZeroState'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport { Confetti } from '../../../components/shared/Confetti'\nimport { ReactComponent as PaidOffCardGraphic } from '../../../components/shared/images/PaidOffCard.svg'\nimport { ReactComponent as SavingsGraphic } from '../../../components/shared/images/SavingsAccountDeposit.svg'\nimport { statusIconName } from '../../../components/statusIcon'\nimport { useContainerDimensions } from '../../../hooks/useContainerDimensions'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { asLogoRef, asNumber, asText } from '../../slotReaders'\nimport { DetailedAccountBlock, isDetailedAccountVariant } from '../DetailedAccountBlock'\n\nimport { HeaderComponent } from './HeaderComponent'\nimport { IconComponent } from './IconComponent'\nimport { getLayoutConfig } from './layout'\n\nconst AccountBlock = ({ payload }: { payload: InsightsPayload; beatGuid?: string }) => {\n const theme = useTheme()\n const containerRef = useRef<HTMLDivElement>(null)\n const { height, width } = useContainerDimensions(containerRef)\n const { instance_slot } = payload\n const { variant, institution_guid, institution_name, icon_name, merchant_name } = instance_slot\n\n if (isDetailedAccountVariant(variant)) return <DetailedAccountBlock payload={payload} />\n\n // V1 beats send no `data`. V2 reads only `data` (no `slotOrFlat`): its stale flat fields must never show.\n const { data } = instance_slot\n const v2 = data !== undefined\n const amount = v2 ? asNumber(slot(data, 'amount')) : instance_slot.amount\n // One V2 slot; V1 named it `sub_text` on the standard tile and `label` on the confetti one.\n const v2SubText = asText(slot(data, 'sub_text'))\n const sub_text = v2 ? v2SubText : instance_slot.sub_text\n const label = v2 ? v2SubText : instance_slot.label\n const header_text = v2 ? asText(slot(data, 'header_text')) : instance_slot.header_text\n // `icon` carries the tile glyph when the beat's `logo` is kept for its compact card (charges_summary).\n const logo = asLogoRef(slot(data, 'logo')) ?? asLogoRef(slot(data, 'icon'))\n const layoutConfig = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n 'default',\n 'AccountBlock',\n )\n\n if (layoutConfig.zero_state_when_no_amount && (amount == null || payload.is_zero_state)) {\n return <LinedCardZeroState />\n }\n\n if (layoutConfig?.isConfetti) {\n const confettiIcon = statusIconName(logo?.guid)\n const graphics: Record<string, React.ReactNode> = {\n paidOffCard: (\n // The 58x46 SVG's card sits 14px down (its check badge overflows top-right); box it to the\n // 48x32 frame so it lines up with the text.\n <Box sx={{ flexShrink: 0, height: 32, position: 'relative', width: 48 }}>\n <PaidOffCardGraphic\n aria-hidden={true}\n role=\"presentation\"\n style={{ left: 0, position: 'absolute', top: -14 }}\n />\n </Box>\n ),\n savings: <SavingsGraphic aria-hidden={true} height={55} role=\"presentation\" width={55} />,\n logo: (\n <Box\n sx={{\n borderRadius: layoutConfig.logo_border_radius ?? '4px',\n flexShrink: 0,\n height: 48,\n overflow: 'hidden',\n width: 48,\n }}\n >\n {/* An ICO- icon keeps the tile's look: an outlined glyph in success.contrastText on\n the success.main square. It is drawn with Icon, as IconComponent does, because\n LogoFromGuid fills every ICO- glyph. Any other guid renders via LogoFromGuid. */}\n {confettiIcon ? (\n <Stack\n data-icon={confettiIcon}\n sx={{\n alignItems: 'center',\n bgcolor: 'success.main',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n }}\n >\n <Icon\n aria-hidden={true}\n name={confettiIcon}\n size={layoutConfig.logo_icon_size ?? 24}\n sx={{ color: 'success.contrastText' }}\n />\n </Stack>\n ) : logo?.guid ? (\n <LogoFromGuid logo={logo} size={48} />\n ) : null}\n </Box>\n ),\n }\n const graphic = graphics[layoutConfig.graphic ?? 'logo']\n\n // The payer: V2's `secondary_text`, else the merchant, else the institution.\n const payer = asText(slot(data, 'secondary_text')) || (merchant_name ?? institution_name)\n const secondaryText = layoutConfig.secondarySource === 'merchant' ? payer : label\n const secondary = secondaryText ? (\n <Text\n color={layoutConfig.secondaryColor}\n noWrap={layoutConfig.secondaryOneLine}\n variant={layoutConfig.secondaryVariant}\n >\n {secondaryText}\n </Text>\n ) : null\n // No figure for a missing amount: `formatCurrency` would print a confident `$0.00`.\n const amountText =\n amount != null ? (\n <Text\n bold={!layoutConfig.amountKeepsVariantWeight}\n color=\"success.dark\"\n variant={layoutConfig.amountVariant}\n >\n {`${amount > 0 ? (layoutConfig.amountPrefix ?? '') : ''}${formatCurrency(amount, CURRENCY_FORMAT.cents)}`}\n </Text>\n ) : null\n\n return (\n <Box\n ref={containerRef}\n sx={{\n backgroundImage: layoutConfig.gradient,\n bgcolor: 'background.paper',\n overflow: 'hidden',\n position: 'relative',\n p: 16,\n width: '100%',\n }}\n >\n <Box\n sx={{\n inset: 0,\n pointerEvents: 'none',\n position: 'absolute',\n zIndex: 1,\n }}\n >\n <Confetti height={height} shouldRun={height > 0 && width > 0} width={width} />\n </Box>\n\n <Stack\n sx={{\n borderRadius: '8px',\n ...(layoutConfig.cardShadow && { boxShadow: theme.shadows[1] }),\n overflow: 'hidden',\n position: 'relative',\n width: '100%',\n zIndex: 2,\n }}\n >\n {layoutConfig.categoryStrip && header_text && (\n <Box sx={{ bgcolor: 'success.main', px: 12, py: 4 }}>\n <Text color=\"success.contrastText\" variant=\"caption\">\n {header_text}\n </Text>\n </Box>\n )}\n\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'success.lighter',\n border: '1px solid',\n borderColor: 'success.main',\n borderRadius: '8px',\n // With a strip above, the body's top corners tuck under it (no double border line).\n ...(layoutConfig.categoryStrip && {\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n borderTop: 0,\n }),\n flexDirection: 'row',\n ...layoutConfig.rowSx,\n }}\n >\n <Box sx={{ display: 'flex', flexShrink: 0 }}>{graphic}</Box>\n\n <Stack sx={{ flex: '1 0 0', minWidth: 0 }}>\n {layoutConfig.secondaryPosition === 'above' && secondary}\n {amountText}\n {layoutConfig.secondaryPosition === 'below' && secondary}\n </Stack>\n </Stack>\n </Stack>\n </Box>\n )\n }\n\n return (\n <Stack\n sx={{\n background: layoutConfig.background,\n p: 16,\n }}\n >\n <Stack\n sx={{\n borderRadius: '8px',\n boxShadow: theme.shadows[1],\n width: '100%',\n }}\n >\n {header_text && <HeaderComponent headerText={header_text} />}\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n gap: 16,\n // Figma's standard tile: 16px on every side, 80px tall in the 112px slot.\n p: 16,\n width: '100%',\n ...(header_text && {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n }),\n ...((institution_guid || icon_name || logo?.guid) && {\n flexDirection: 'row',\n }),\n }}\n >\n <IconComponent logo={logo} slot={instance_slot} variant={variant} />\n\n <Stack>\n {amount != null && (\n <Text variant=\"h2\">{formatCurrency(amount, CURRENCY_FORMAT.cents)}</Text>\n )}\n <Stack sx={{ gap: 8, flexDirection: 'row', alignItems: 'center' }}>\n {layoutConfig.sub_logo && (\n <Icon color=\"warning\" fill={true} name={layoutConfig.sub_logo} size={20} />\n )}\n {sub_text && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {sub_text}\n </Text>\n )}\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default AccountBlock\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAM,KAAA,CAAgB,EAAE,SAAA,EAAA,MAA+D;AACrF,QAAM,IAAQ,EAAS,GACjB,IAAe,EAAuB,IAAI,GAC1C,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAuB,CAAY,GACvD,EAAE,eAAA,EAAA,IAAkB,GACpB,EAAE,SAAA,GAAS,kBAAA,GAAkB,kBAAA,GAAkB,WAAA,GAAW,eAAA,EAAA,IAAkB;AAElF,MAAI,EAAyB,CAAO,EAAG,QAAO,gBAAA,EAAC,GAAD,EAA+B,SAAA,EAAU,CAAA;AAGvF,QAAM,EAAE,MAAA,EAAA,IAAS,GACX,IAAK,MAAS,QACd,IAAS,IAAK,EAAS,EAAK,GAAM,QAAQ,CAAC,IAAI,EAAc,QAE7D,IAAY,EAAO,EAAK,GAAM,UAAU,CAAC,GACzC,IAAW,IAAK,IAAY,EAAc,UAC1C,IAAQ,IAAK,IAAY,EAAc,OACvC,IAAc,IAAK,EAAO,EAAK,GAAM,aAAa,CAAC,IAAI,EAAc,aAErE,IAAO,EAAU,EAAK,GAAM,MAAM,CAAC,KAAK,EAAU,EAAK,GAAM,MAAM,CAAC,GACpE,IAAe,EACnB,EAAgB,CAAK,GACrB,GACA,WACA,cACF;AAEA,MAAI,EAAa,8BAA8B,KAAU,QAAQ,EAAQ,eACvE,QAAO,gBAAA,EAAC,GAAD,CAAqB,CAAA;AAG9B,MAAI,GAAc,YAAY;AAC5B,UAAM,IAAe,EAAe,GAAM,IAAI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,UACT,cAAc;AAAA,UACd,KAAK;AAAA,UAEL,GAAG;AAAA,UACH,OAAO;AAAA,UACP,GAAI,KAAe;AAAA,YACjB,qBAAqB;AAAA,YACrB,sBAAsB;AAAA,UACxB;AAAA,UACA,IAAK,KAAoB,KAAa,GAAM,SAAS,EACnD,eAAe,MACjB;AAAA,QACF;AAAA,QAhBF,UAAA,CAkBE,gBAAA,EAAC,GAAD;AAAA,UAAqB,MAAA;AAAA,UAAM,MAAM;AAAA,UAAwB,SAAA;AAAA,QAAU,CAAA,GAEnE,gBAAA,EAAC,GAAD,EAAA,UAAA,CACG,KAAU,QACT,gBAAA,EAAC,GAAD;AAAA,UAAM,SAAQ;AAAA,UAAM,UAAA,EAAe,GAAQ,EAAgB,KAAK;AAAA,QAAQ,CAAA,GAE1E,gBAAA,EAAC,GAAD;AAAA,UAAO,IAAI;AAAA,YAAE,KAAK;AAAA,YAAG,eAAe;AAAA,YAAO,YAAY;AAAA,UAAS;AAAA,UAAhE,UAAA,CACG,EAAa,YACZ,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAU,MAAM;AAAA,YAAM,MAAM,EAAa;AAAA,YAAU,MAAM;AAAA,UAAK,CAAA,GAE3E,KACC,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAiB,SAAQ;AAAA,YAClC,UAAA;AAAA,UACG,CAAA,CAEH;AAAA,QACF,CAAA,CAAA,EAAA,CAAA,CACF;AAAA,MACF,CAAA,CAAA;AAAA;EACF,CAAA;AAEX"}
|
|
@@ -8,7 +8,7 @@ export interface BlockLayoutConfig {
|
|
|
8
8
|
logo_color?: string;
|
|
9
9
|
logo_bGcolor?: string;
|
|
10
10
|
logo_border_color?: string;
|
|
11
|
-
/** Corner radius of the icon tile (`icon_name` or an `ICO-` logo)
|
|
11
|
+
/** Corner radius of the icon tile (`icon_name` or an `ICO-` logo; 6px default) or the confetti logo (4px default). */
|
|
12
12
|
logo_border_radius?: string;
|
|
13
13
|
/** Glyph size in px for an `ICO-` logo: on the confetti tile (default 24) and on the standard
|
|
14
14
|
* icon tile (default `TILE_ICON_SIZE`). */
|
|
@@ -25,7 +25,7 @@ export interface BlockLayoutConfig {
|
|
|
25
25
|
graphic?: 'paidOffCard' | 'savings' | 'logo';
|
|
26
26
|
/** Amount typography variant. */
|
|
27
27
|
amountVariant?: 'h2' | 'h3';
|
|
28
|
-
/** Prefix prepended to
|
|
28
|
+
/** Prefix prepended to a positive formatted amount, e.g. `+` for deposits. */
|
|
29
29
|
amountPrefix?: string;
|
|
30
30
|
/** Keep the variant's own weight (h2 is 700) instead of the confetti tile's semi bold. */
|
|
31
31
|
amountKeepsVariantWeight?: boolean;
|
|
@@ -45,6 +45,9 @@ export interface BlockLayoutConfig {
|
|
|
45
45
|
secondaryColor?: string;
|
|
46
46
|
/** Truncate the secondary line to one line with an ellipsis. */
|
|
47
47
|
secondaryOneLine?: boolean;
|
|
48
|
+
/** Render the neutral lined-card zero state instead of the card when the slot has no amount or
|
|
49
|
+
* the beat is a zero state. */
|
|
50
|
+
zero_state_when_no_amount?: boolean;
|
|
48
51
|
}
|
|
49
52
|
/** Glyph size in px on the standard icon tile (IconComponent). */
|
|
50
53
|
export declare const TILE_ICON_SIZE = 30;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { CELEBRATION_GRADIENT as o, DIRECT_DEPOSIT_COMPLETE_GRADIENT as
|
|
2
|
-
var
|
|
1
|
+
import { CELEBRATION_GRADIENT as o, DIRECT_DEPOSIT_COMPLETE_GRADIENT as r, ERROR_WASH_GRADIENT as e, FEES_WASH_GRADIENT as n, WARM_LIME_ACCENT_GRADIENT as i } from "../../../components/celebrationGradients.es.js";
|
|
2
|
+
var a = { background: e }, d = (t) => ({
|
|
3
3
|
overdraft_warning: {
|
|
4
|
-
background:
|
|
4
|
+
background: t.palette.warning.light,
|
|
5
5
|
sub_logo: "error"
|
|
6
6
|
},
|
|
7
|
-
low_balance_alert:
|
|
7
|
+
low_balance_alert: a,
|
|
8
8
|
low_balance: {
|
|
9
|
-
...
|
|
9
|
+
...a,
|
|
10
10
|
badge: "error"
|
|
11
11
|
},
|
|
12
12
|
status_off_track: {
|
|
@@ -14,7 +14,7 @@ var r = { background: a }, s = (e) => ({
|
|
|
14
14
|
logo_bGcolor: "error.main",
|
|
15
15
|
logo_border_radius: "4px",
|
|
16
16
|
logo_icon_size: 24,
|
|
17
|
-
background:
|
|
17
|
+
background: e
|
|
18
18
|
},
|
|
19
19
|
charges_summary: {
|
|
20
20
|
category_tint: 0.25,
|
|
@@ -23,7 +23,7 @@ var r = { background: a }, s = (e) => ({
|
|
|
23
23
|
},
|
|
24
24
|
deposit_received: {
|
|
25
25
|
isConfetti: !0,
|
|
26
|
-
gradient:
|
|
26
|
+
gradient: r,
|
|
27
27
|
graphic: "logo",
|
|
28
28
|
amountVariant: "h2",
|
|
29
29
|
amountKeepsVariantWeight: !0,
|
|
@@ -40,6 +40,25 @@ var r = { background: a }, s = (e) => ({
|
|
|
40
40
|
secondaryColor: "text.secondary",
|
|
41
41
|
secondaryOneLine: !0
|
|
42
42
|
},
|
|
43
|
+
deposit_received_on_date: {
|
|
44
|
+
isConfetti: !0,
|
|
45
|
+
gradient: r,
|
|
46
|
+
graphic: "logo",
|
|
47
|
+
logo_border_radius: "8px",
|
|
48
|
+
amountVariant: "h2",
|
|
49
|
+
amountKeepsVariantWeight: !0,
|
|
50
|
+
amountPrefix: "+",
|
|
51
|
+
cardShadow: !0,
|
|
52
|
+
rowSx: {
|
|
53
|
+
gap: 16,
|
|
54
|
+
p: 16
|
|
55
|
+
},
|
|
56
|
+
secondarySource: "label",
|
|
57
|
+
secondaryPosition: "below",
|
|
58
|
+
secondaryVariant: "caption",
|
|
59
|
+
secondaryColor: "text.secondary",
|
|
60
|
+
zero_state_when_no_amount: !0
|
|
61
|
+
},
|
|
43
62
|
status_on_track: {
|
|
44
63
|
isConfetti: !0,
|
|
45
64
|
gradient: i,
|
|
@@ -87,7 +106,7 @@ var r = { background: a }, s = (e) => ({
|
|
|
87
106
|
default: {}
|
|
88
107
|
});
|
|
89
108
|
export {
|
|
90
|
-
|
|
109
|
+
d as getLayoutConfig
|
|
91
110
|
};
|
|
92
111
|
|
|
93
112
|
//# sourceMappingURL=layout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.ts"],"sourcesContent":["import { type SxProps, type Theme } from '@mui/material/styles'\n\nimport {\n CELEBRATION_GRADIENT,\n DIRECT_DEPOSIT_COMPLETE_GRADIENT,\n ERROR_WASH_GRADIENT,\n FEES_WASH_GRADIENT,\n WARM_LIME_ACCENT_GRADIENT,\n} from '../../../components/celebrationGradients'\n\nexport interface BlockLayoutConfig {\n background?: string\n /** Opacity of the category colour behind a `CAT-` tile, with a category-colour border; none = mxui's tile. */\n category_tint?: number\n /** Width in px of that tinted tile's category-colour border. Defaults to 1. */\n category_border_width?: number\n logo_color?: string\n logo_bGcolor?: string\n logo_border_color?: string\n /** Corner radius of the icon tile (`icon_name` or an `ICO-` logo)
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.ts"],"sourcesContent":["import { type SxProps, type Theme } from '@mui/material/styles'\n\nimport {\n CELEBRATION_GRADIENT,\n DIRECT_DEPOSIT_COMPLETE_GRADIENT,\n ERROR_WASH_GRADIENT,\n FEES_WASH_GRADIENT,\n WARM_LIME_ACCENT_GRADIENT,\n} from '../../../components/celebrationGradients'\n\nexport interface BlockLayoutConfig {\n background?: string\n /** Opacity of the category colour behind a `CAT-` tile, with a category-colour border; none = mxui's tile. */\n category_tint?: number\n /** Width in px of that tinted tile's category-colour border. Defaults to 1. */\n category_border_width?: number\n logo_color?: string\n logo_bGcolor?: string\n logo_border_color?: string\n /** Corner radius of the icon tile (`icon_name` or an `ICO-` logo; 6px default) or the confetti logo (4px default). */\n logo_border_radius?: string\n /** Glyph size in px for an `ICO-` logo: on the confetti tile (default 24) and on the standard\n * icon tile (default `TILE_ICON_SIZE`). */\n logo_icon_size?: number\n /** mx-icons glyph shown before `sub_text` (e.g. a warning icon on overdraft_warning). */\n sub_logo?: string\n /** mx-icons glyph badged on the logo's corner (e.g. `error` on Low Account Balance's V2 tile). */\n badge?: string\n /** When true, AccountBlock renders the confetti-backed celebration card using the fields below. */\n isConfetti?: boolean\n /** Gradient wash layered over `background.paper` for the confetti card. */\n gradient?: string\n /** Which illustration sits left of the text. `logo` is the data-driven merchant/institution logo. */\n graphic?: 'paidOffCard' | 'savings' | 'logo'\n /** Amount typography variant. */\n amountVariant?: 'h2' | 'h3'\n /** Prefix prepended to a positive formatted amount, e.g. `+` for deposits. */\n amountPrefix?: string\n /** Keep the variant's own weight (h2 is 700) instead of the confetti tile's semi bold. */\n amountKeepsVariantWeight?: boolean\n /** Render the colored category strip (`header_text`) at the top of the card. */\n categoryStrip?: boolean\n /** Raise the strip and body together with elevation/1. */\n cardShadow?: boolean\n /** Layout overrides for the graphic+text row (padding, gap). */\n rowSx?: SxProps\n /** Which payload field feeds the secondary line beside the amount. */\n secondarySource?: 'merchant' | 'label'\n /** Whether the secondary line sits above or below the amount. */\n secondaryPosition?: 'above' | 'below'\n /** Typography variant for the secondary line. */\n secondaryVariant?: 'body2' | 'caption'\n /** Theme color path for the secondary line. */\n secondaryColor?: string\n /** Truncate the secondary line to one line with an ellipsis. */\n secondaryOneLine?: boolean\n /** Render the neutral lined-card zero state instead of the card when the slot has no amount or\n * the beat is a zero state. */\n zero_state_when_no_amount?: boolean\n}\n\n/** Glyph size in px on the standard icon tile (IconComponent). */\nexport const TILE_ICON_SIZE = 30\n\n// Low Account Balance's red tile, shared by its legacy (`low_balance_alert`) and V2 (`low_balance`)\n// variant names.\nconst LOW_BALANCE_TILE: BlockLayoutConfig = {\n background: ERROR_WASH_GRADIENT,\n}\n\nexport const getLayoutConfig = (theme: Theme): Record<string, BlockLayoutConfig> => {\n return {\n overdraft_warning: {\n background: theme.palette.warning.light,\n sub_logo: 'error',\n },\n low_balance_alert: LOW_BALANCE_TILE,\n // V2 name for the same tile: content from `instance_slot.data`, the logo badged with `badge`.\n low_balance: { ...LOW_BALANCE_TILE, badge: 'error' },\n // Shared on/off-track status pair — used by Monthly Obligations Status and\n // Payday Cash Left Over Status (identical designs, different copy).\n status_off_track: {\n logo_color: 'background.paper',\n logo_bGcolor: 'error.main',\n // Figma 9936:39145: the money icon's tile has 4px corners.\n logo_border_radius: '4px',\n // Figma draws the money glyph at 24px in both status tiles (9936:39156).\n logo_icon_size: 24,\n background: ERROR_WASH_GRADIENT,\n },\n // Monthly Credit Card Interest Summary's fees tile (ditto account_block `charges_summary`); its category\n // glyph rides in `icon`.\n charges_summary: {\n category_tint: 0.25,\n // Figma 1365:301242 <Categories>: a 1.5px category-colour border.\n category_border_width: 1.5,\n background: FEES_WASH_GRADIENT,\n },\n // Unified Deposit and its standalone deposit templates; Figma draws every state alike.\n deposit_received: {\n isConfetti: true,\n gradient: DIRECT_DEPOSIT_COMPLETE_GRADIENT,\n graphic: 'logo',\n amountVariant: 'h2',\n amountKeepsVariantWeight: true,\n amountPrefix: '+',\n categoryStrip: true,\n cardShadow: true,\n rowSx: { gap: 12, p: 12 },\n secondarySource: 'merchant',\n secondaryPosition: 'below',\n secondaryVariant: 'caption',\n secondaryColor: 'text.secondary',\n secondaryOneLine: true,\n },\n // Figma 1943:218986\n deposit_received_on_date: {\n isConfetti: true,\n gradient: DIRECT_DEPOSIT_COMPLETE_GRADIENT,\n graphic: 'logo',\n logo_border_radius: '8px',\n amountVariant: 'h2',\n amountKeepsVariantWeight: true,\n amountPrefix: '+',\n cardShadow: true,\n rowSx: { gap: 16, p: 16 },\n secondarySource: 'label',\n secondaryPosition: 'below',\n secondaryVariant: 'caption',\n secondaryColor: 'text.secondary',\n zero_state_when_no_amount: true,\n },\n status_on_track: {\n isConfetti: true,\n gradient: WARM_LIME_ACCENT_GRADIENT,\n graphic: 'logo',\n amountVariant: 'h2',\n amountKeepsVariantWeight: true,\n rowSx: { gap: 16, p: 16 },\n secondarySource: 'label',\n secondaryPosition: 'below',\n secondaryVariant: 'caption',\n secondaryColor: 'text.secondary',\n },\n payoff_celebration: {\n isConfetti: true,\n gradient: CELEBRATION_GRADIENT,\n graphic: 'paidOffCard',\n amountVariant: 'h2',\n rowSx: { gap: 16, px: 24, py: 16 },\n secondarySource: 'label',\n secondaryPosition: 'below',\n secondaryVariant: 'caption',\n secondaryColor: 'text.secondary',\n },\n savings_deposit: {\n isConfetti: true,\n gradient: CELEBRATION_GRADIENT,\n graphic: 'savings',\n amountVariant: 'h2',\n rowSx: { gap: 16, p: 16 },\n secondarySource: 'label',\n secondaryPosition: 'above',\n secondaryVariant: 'body2',\n secondaryColor: 'text.primary',\n },\n // Neutral fallback for an unknown/unmatched variant: renders the plain standard card (no\n // confetti, no special background). `resolveVariantConfig` warns before falling back here.\n default: {},\n }\n}\n"],"mappings":";AAkEA,IAAM,IAAsC,EAC1C,YAAY,EACd,GAEa,IAAA,CAAmB,OACvB;AAAA,EACL,mBAAmB;AAAA,IACjB,YAAY,EAAM,QAAQ,QAAQ;AAAA,IAClC,UAAU;AAAA,EACZ;AAAA,EACA,mBAAmB;AAAA,EAEnB,aAAa;AAAA,IAAE,GAAG;AAAA,IAAkB,OAAO;AAAA,EAAQ;AAAA,EAGnD,kBAAkB;AAAA,IAChB,YAAY;AAAA,IACZ,cAAc;AAAA,IAEd,oBAAoB;AAAA,IAEpB,gBAAgB;AAAA,IAChB,YAAY;AAAA,EACd;AAAA,EAGA,iBAAiB;AAAA,IACf,eAAe;AAAA,IAEf,uBAAuB;AAAA,IACvB,YAAY;AAAA,EACd;AAAA,EAEA,kBAAkB;AAAA,IAChB,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,SAAS;AAAA,IACT,eAAe;AAAA,IACf,0BAA0B;AAAA,IAC1B,cAAc;AAAA,IACd,eAAe;AAAA,I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ACxB,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,EAClB;AAAA,EAGA,SAAS,CAAC;AACZ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BlockProps } from '../../types';
|
|
2
|
+
/** beatContext key: the survey's shown event already fired for this beat (survives a remount after Undo). */
|
|
3
|
+
export declare const SURVEY_SHOWN_KEY = "survey_shown";
|
|
4
|
+
/** beatContext key: the result phase ('sent' | 'error'), so a remount shows it, not the survey again. */
|
|
5
|
+
export declare const SURVEY_PHASE_KEY = "survey_phase";
|
|
6
|
+
/**
|
|
7
|
+
* The User Feedback survey (Figma 1283:81740): two 1-5 ratings and a free-text answer, one per step,
|
|
8
|
+
* then a thank-you. The question is the card's title. On submit it sends PostHog's survey events and
|
|
9
|
+
* dismisses the beat, keeping the card (and its thank-you) in the feed until the next refresh.
|
|
10
|
+
*/
|
|
11
|
+
declare const FeedbackBlock: (({ beatGuid, payload }: BlockProps) => import("react/jsx-runtime").JSX.Element | null) & {
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
14
|
+
export default FeedbackBlock;
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { buildDynamicCopy as F } from "../../../../core/utils/Localization.es.js";
|
|
2
|
+
import { useGlobalStore as se, useInsightsV2Store as ie } from "../../../../common/context/hooks.es.js";
|
|
3
|
+
import { VISUALLY_HIDDEN_SX as ae } from "../../../../common/constants/Styles.es.js";
|
|
4
|
+
import { BEAT_CARD_TITLE_KEY as V, BEAT_KEEP_AFTER_DISMISS_KEY as j } from "../../../../core/stores/InsightsV2Store.es.js";
|
|
5
|
+
import { useBeatActions as ce } from "../../../beatActions.es.js";
|
|
6
|
+
import { asNonEmptyText as le } from "../../slotReaders.es.js";
|
|
7
|
+
import { HOST_ACTIONS as ue } from "../../../ctaActions/hostActions.es.js";
|
|
8
|
+
import { useAnalyticsEvent as pe } from "../../../analytics/useAnalyticsEvent.es.js";
|
|
9
|
+
import { userFeedbackSurveyEvents as fe, userFeedbackSurveyId as de } from "./survey.es.js";
|
|
10
|
+
import { useEffect as x, useRef as m, useState as _ } from "react";
|
|
11
|
+
import { observer as me } from "mobx-react-lite";
|
|
12
|
+
import u from "@mui/material/Stack";
|
|
13
|
+
import { Text as C } from "@mxenabled/mxui";
|
|
14
|
+
import z from "@mui/material/Button";
|
|
15
|
+
import { Icon as he } from "@mxenabled/mx-icons";
|
|
16
|
+
import { jsx as o, jsxs as h } from "react/jsx-runtime";
|
|
17
|
+
import { alpha as ge } from "@mui/material/styles";
|
|
18
|
+
import S from "@mui/material/Box";
|
|
19
|
+
import ye from "@mui/material/TextField";
|
|
20
|
+
import be from "@mui/material/ButtonBase";
|
|
21
|
+
var xe = [
|
|
22
|
+
"question1",
|
|
23
|
+
"question2",
|
|
24
|
+
"question3",
|
|
25
|
+
"strongly_disagree",
|
|
26
|
+
"strongly_agree",
|
|
27
|
+
"continue",
|
|
28
|
+
"submit_feedback",
|
|
29
|
+
"feedback",
|
|
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));
|
|
163
|
+
}, [
|
|
164
|
+
e,
|
|
165
|
+
L,
|
|
166
|
+
f
|
|
167
|
+
]);
|
|
168
|
+
const ee = m(d);
|
|
169
|
+
x(() => {
|
|
170
|
+
d !== "survey" && d !== ee.current && w.current?.focus();
|
|
171
|
+
}, [d]), x(() => {
|
|
172
|
+
H.current && (r === 2 ? P.current?.focus() : K.current?.focus());
|
|
173
|
+
}, [r]);
|
|
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 });
|
|
184
|
+
}, [
|
|
185
|
+
e,
|
|
186
|
+
n,
|
|
187
|
+
T
|
|
188
|
+
]), x(() => () => {
|
|
189
|
+
e && n(e, { [V]: void 0 });
|
|
190
|
+
}, [e, n]), !t) return null;
|
|
191
|
+
const N = (s) => {
|
|
192
|
+
n(e, { [M]: s }), G(s);
|
|
193
|
+
}, Y = async () => {
|
|
194
|
+
try {
|
|
195
|
+
if (!p) throw new Error("No onCtaAction handler to dismiss the beat");
|
|
196
|
+
n(e, { [j]: !0 }), await p({
|
|
197
|
+
beatGuid: e,
|
|
198
|
+
name: ue.dismissBeat
|
|
199
|
+
}), N("sent");
|
|
200
|
+
} catch (s) {
|
|
201
|
+
y.captureException(s, {
|
|
202
|
+
store: "FeedbackBlock",
|
|
203
|
+
handler: "dismissBeat"
|
|
204
|
+
}), D.current || n(e, { [j]: !1 }), N("error");
|
|
205
|
+
}
|
|
206
|
+
}, q = async (s) => {
|
|
207
|
+
if (!k.current) {
|
|
208
|
+
k.current = !0, B(!0);
|
|
209
|
+
try {
|
|
210
|
+
await s();
|
|
211
|
+
} finally {
|
|
212
|
+
k.current = !1, B(!1);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}, re = () => q(() => {
|
|
216
|
+
const [s, A] = E;
|
|
217
|
+
return b(c.sent(s, A, R.trim().slice(0, U))), b(c.dismissed), Y();
|
|
218
|
+
}), oe = () => {
|
|
219
|
+
H.current = !0, J(r + 1);
|
|
220
|
+
};
|
|
221
|
+
if (d !== "survey") return /* @__PURE__ */ o(S, {
|
|
222
|
+
sx: {
|
|
223
|
+
pb: 16,
|
|
224
|
+
px: 16,
|
|
225
|
+
width: "100%"
|
|
226
|
+
},
|
|
227
|
+
children: d === "sent" ? /* @__PURE__ */ o(W, {
|
|
228
|
+
bannerRef: w,
|
|
229
|
+
message: t.feedback_sent,
|
|
230
|
+
severity: "success"
|
|
231
|
+
}) : /* @__PURE__ */ o(W, {
|
|
232
|
+
action: /* @__PURE__ */ o(z, {
|
|
233
|
+
disabled: I,
|
|
234
|
+
onClick: () => {
|
|
235
|
+
q(Y);
|
|
236
|
+
},
|
|
237
|
+
sx: {
|
|
238
|
+
alignSelf: "flex-start",
|
|
239
|
+
color: "inherit",
|
|
240
|
+
minHeight: 0,
|
|
241
|
+
p: 0
|
|
242
|
+
},
|
|
243
|
+
variant: "text",
|
|
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
|
|
314
|
+
})
|
|
315
|
+
})]
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
export {
|
|
319
|
+
M as SURVEY_PHASE_KEY,
|
|
320
|
+
ve as SURVEY_SHOWN_KEY,
|
|
321
|
+
Me as default
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
//# sourceMappingURL=FeedbackBlock.es.js.map
|
|
@@ -0,0 +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,E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;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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as FeedbackBlock } from './FeedbackBlock';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** pulse's USER_FEEDBACK_INSIGHT_SURVEY_ID: the same PostHog survey, per environment. */
|
|
2
|
+
export declare const userFeedbackSurveyId: (postHogPublicKey?: string) => "01986709-032e-0000-5496-ad8f17623225" | "0198428e-bfe6-0000-002d-1fe2e87b3821";
|
|
3
|
+
/** The PostHog survey events pulse's UserFeedback beat sends, with the same keys. */
|
|
4
|
+
export declare const userFeedbackSurveyEvents: (postHogPublicKey?: string) => {
|
|
5
|
+
shown: {
|
|
6
|
+
postHog: {
|
|
7
|
+
eventName: string;
|
|
8
|
+
properties: () => {
|
|
9
|
+
$survey_id: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
dismissed: {
|
|
14
|
+
postHog: {
|
|
15
|
+
eventName: string;
|
|
16
|
+
properties: () => {
|
|
17
|
+
$survey_id: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
sent: (first?: number, second?: number, feedback?: string) => {
|
|
22
|
+
postHog: {
|
|
23
|
+
eventName: string;
|
|
24
|
+
properties: () => {
|
|
25
|
+
$survey_id: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|