@mx-cartographer/experiences 9.7.154 → 9.7.156

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/insights-v2/actionBlocks/AccountDetailsBlock/AccountDetailsBlock.es.js +19 -22
  3. package/dist/insights-v2/actionBlocks/AccountDetailsBlock/AccountDetailsBlock.es.js.map +1 -1
  4. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js +43 -48
  5. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js.map +1 -1
  6. package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js +30 -34
  7. package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js.map +1 -1
  8. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +52 -52
  9. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js.map +1 -1
  10. package/dist/insights-v2/actionBlocks/BlockErrorMessage.d.ts +4 -0
  11. package/dist/insights-v2/actionBlocks/BlockErrorMessage.es.js +17 -0
  12. package/dist/insights-v2/actionBlocks/BlockErrorMessage.es.js.map +1 -0
  13. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js +131 -135
  14. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js.map +1 -1
  15. package/dist/insights-v2/actionBlocks/ContactSupportActionBlock.es.js +14 -18
  16. package/dist/insights-v2/actionBlocks/ContactSupportActionBlock.es.js.map +1 -1
  17. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.es.js +19 -25
  18. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.es.js.map +1 -1
  19. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js +26 -28
  20. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js.map +1 -1
  21. package/dist/insights-v2/actionBlocks/HelpBlock/HelpBlock.es.js +11 -14
  22. package/dist/insights-v2/actionBlocks/HelpBlock/HelpBlock.es.js.map +1 -1
  23. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer.es.js +12 -12
  24. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer.es.js.map +1 -1
  25. package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js +28 -30
  26. package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js.map +1 -1
  27. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js +53 -55
  28. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js.map +1 -1
  29. package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.es.js +26 -31
  30. package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.es.js.map +1 -1
  31. package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesContent.es.js +18 -18
  32. package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesContent.es.js.map +1 -1
  33. package/dist/insights-v2/actionBlocks/PlaceholderActionBlock.es.js +23 -22
  34. package/dist/insights-v2/actionBlocks/PlaceholderActionBlock.es.js.map +1 -1
  35. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js +38 -41
  36. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js.map +1 -1
  37. package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js +44 -44
  38. package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js.map +1 -1
  39. package/dist/insights-v2/actionBlocks/SurveyModalActionBlock.es.js +24 -24
  40. package/dist/insights-v2/actionBlocks/SurveyModalActionBlock.es.js.map +1 -1
  41. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.es.js +11 -16
  42. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.es.js.map +1 -1
  43. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.es.js +20 -20
  44. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/useTransactionDetailsBlock.es.js.map +1 -1
  45. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/util.d.ts +1 -2
  46. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/util.es.js +3 -7
  47. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/util.es.js.map +1 -1
  48. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js +39 -42
  49. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map +1 -1
  50. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +102 -104
  51. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
  52. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js +11 -11
  53. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js.map +1 -1
  54. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js +58 -58
  55. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js.map +1 -1
  56. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListHeaderIconTile.d.ts +7 -0
  57. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListHeaderIconTile.es.js +28 -0
  58. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListHeaderIconTile.es.js.map +1 -0
  59. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSubscriptionHeader.es.js +14 -33
  60. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSubscriptionHeader.es.js.map +1 -1
  61. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js +24 -41
  62. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js.map +1 -1
  63. package/dist/insights-v2/actionBlocks/useOpenedCta.d.ts +9 -0
  64. package/dist/insights-v2/actionBlocks/useOpenedCta.es.js +11 -0
  65. package/dist/insights-v2/actionBlocks/useOpenedCta.es.js.map +1 -0
  66. package/dist/insights-v2/actionBlocks/util.d.ts +2 -1
  67. package/dist/insights-v2/actionBlocks/util.es.js.map +1 -1
  68. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"PlaceholderActionBlock.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/PlaceholderActionBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { H3, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useActionContext, useInsightsV2Store } from '../../common'\nimport type { Beat, DrilldownPayload } from '../../core'\n\nimport { createVariantBlock } from '../blocks/createVariantBlock'\nimport { type ActionBlockProps } from '../mappings/blocks'\n\n// This block doubles as the reference example for the two building blocks a real\n// action block uses:\n// 1. useActionContext<T>() — read the drawer's opaque, block-specific context.\n// 2. createVariantBlock — dispatch to a per-variant component with a fallback.\n// Register a block with variants exactly like `PlaceholderVariants` below, then\n// wire it into src/insights-v2/mappings/blocks.ts.\n\ninterface PlaceholderVariantProps {\n beat: Beat\n}\n\n/** Default variant — also the fallback for unknown/absent variants.\n * Wrapped in `observer` because it reads the drawer's observable context via\n * useActionContext; without it a memoized ancestor would stop it re-rendering.\n * This is the copy-paste template for real blocks, so it must model the rule. */\nconst DefaultPlaceholder = observer(({ beat }: PlaceholderVariantProps) => {\n // Chart drilldowns put { chartBarIndex, tabIndex } on the drawer context; a\n // CTA open carries none, so default to 0.\n const { chartBarIndex = 0, tabIndex = 0 } = useActionContext<DrilldownPayload>() ?? {}\n\n return (\n <Stack sx={{ alignItems: 'center', gap: 8, p: 24, textAlign: 'center' }}>\n <H3>Action Block Layer Drilldown</H3>\n <Text>\n This is a placeholder action block. Replace it with your own implementation by registering\n your block in src/insights-v2/mappings/blocks.ts.\n </Text>\n <Text>Beat: {beat.guid}</Text>\n <Text>\n Drilldown: chartBarIndex {chartBarIndex}, tabIndex {tabIndex}\n </Text>\n </Stack>\n )\n})\n\n/** A second sample variant, to show registry dispatch with more than one entry. */\nconst CompactPlaceholder = ({ beat }: PlaceholderVariantProps) => (\n <Stack sx={{ alignItems: 'center', gap: 8, p: 24, textAlign: 'center' }}>\n <H3>Action Block Layer Drilldown (compact)</H3>\n <Text>Beat: {beat.guid}</Text>\n </Stack>\n)\n\n// Register one component per backend `variant`; unknown/absent variants fall\n// back to DefaultPlaceholder.\nconst PlaceholderVariants = createVariantBlock<PlaceholderVariantProps>({\n variants: {\n default: DefaultPlaceholder,\n compact: CompactPlaceholder,\n },\n fallback: DefaultPlaceholder,\n name: 'Placeholder',\n})\n\nexport const PlaceholderActionBlock = observer(function PlaceholderActionBlock({\n beat,\n}: ActionBlockProps) {\n const { actionDrawer } = useInsightsV2Store()\n const cta =\n actionDrawer.trigger === 'secondaryCta'\n ? beat.insights_payload?.secondary_cta\n : beat.insights_payload?.primary_cta\n\n return <PlaceholderVariants beat={beat} variant={cta?.variant} />\n})\n"],"mappings":";;;;;;AA0BA,IAAM,IAAqB,EAAA,CAAU,EAAE,MAAA,EAAA,MAAoC;AAGzE,QAAM,EAAE,eAAA,IAAgB,GAAG,UAAA,IAAW,EAAA,IAAM,EAAmC,KAAK,CAAC;AAErF,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,YAAY;AAAA,MAAU,KAAK;AAAA,MAAG,GAAG;AAAA,MAAI,WAAW;AAAA,IAAS;AAAA,IAAtE,UAAA;AAAA,MACE,gBAAA,EAAC,GAAD,EAAA,UAAI,+BAAgC,CAAA;AAAA,MACpC,gBAAA,EAAC,GAAD,EAAA,UAAM,+IAGA,CAAA;AAAA,MACN,gBAAA,EAAC,GAAD,EAAA,UAAA,CAAM,UAAO,EAAK,IAAW,EAAA,CAAA;AAAA,MAC7B,gBAAA,EAAC,GAAD,EAAA,UAAA;AAAA,QAAM;AAAA,QACsB;AAAA,QAAc;AAAA,QAAY;AAAA,MAChD,EAAA,CAAA;AAAA,IACD;AAAA;AAEX,CAAC,GAGK,IAAA,CAAsB,EAAE,MAAA,EAAA,MAC5B,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,YAAY;AAAA,IAAU,KAAK;AAAA,IAAG,GAAG;AAAA,IAAI,WAAW;AAAA,EAAS;AAAA,EAAtE,UAAA,CACE,gBAAA,EAAC,GAAD,EAAA,UAAI,yCAA0C,CAAA,GAC9C,gBAAA,EAAC,GAAD,EAAA,UAAA,CAAM,UAAO,EAAK,IAAW,EAAA,CAAA,CACxB;IAKH,IAAsB,EAA4C;AAAA,EACtE,UAAU;AAAA,IACR,SAAS;AAAA,IACT,SAAS;AAAA,EACX;AAAA,EACA,UAAU;AAAA,EACV,MAAM;AACR,CAAC,GAEY,IAAyB,EAAS,SAAgC,EAC7E,MAAA,EAAA,GACmB;AACnB,QAAM,EAAE,cAAA,EAAA,IAAiB,EAAmB,GACtC,IACJ,EAAa,YAAY,iBACrB,EAAK,kBAAkB,gBACvB,EAAK,kBAAkB;AAE7B,SAAO,gBAAA,EAAC,GAAD;AAAA,IAA2B,MAAA;AAAA,IAAM,SAAS,GAAK;AAAA,EAAU,CAAA;AAClE,CAAC"}
1
+ {"version":3,"file":"PlaceholderActionBlock.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/PlaceholderActionBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { H3, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useActionContext } from '../../common'\nimport type { Beat, DrilldownPayload } from '../../core'\n\nimport { createVariantBlock } from '../blocks/createVariantBlock'\nimport { type ActionBlockProps } from '../mappings/blocks'\nimport { useOpenedCta } from './useOpenedCta'\n\n// This block doubles as the reference example for the two building blocks a real\n// action block uses:\n// 1. useActionContext<T>() — read the drawer's opaque, block-specific context.\n// 2. createVariantBlock — dispatch to a per-variant component with a fallback.\n// Register a block with variants exactly like `PlaceholderVariants` below, then\n// wire it into src/insights-v2/mappings/blocks.ts. ActionBlockLayer mounts it once\n// copy has loaded; render `BlockErrorMessage` when its copy or data is missing.\n\ninterface PlaceholderVariantProps {\n beat: Beat\n}\n\n/** Default variant — also the fallback for unknown/absent variants.\n * Wrapped in `observer` because it reads the drawer's observable context via\n * useActionContext; without it a memoized ancestor would stop it re-rendering.\n * This is the copy-paste template for real blocks, so it must model the rule. */\nconst DefaultPlaceholder = observer(({ beat }: PlaceholderVariantProps) => {\n // Chart drilldowns put { chartBarIndex, tabIndex } on the drawer context; a\n // CTA open carries none, so default to 0.\n const { chartBarIndex = 0, tabIndex = 0 } = useActionContext<DrilldownPayload>() ?? {}\n\n return (\n <Stack sx={{ alignItems: 'center', gap: 8, p: 24, textAlign: 'center' }}>\n <H3>Action Block Layer Drilldown</H3>\n <Text>\n This is a placeholder action block. Replace it with your own implementation by registering\n your block in src/insights-v2/mappings/blocks.ts.\n </Text>\n <Text>Beat: {beat.guid}</Text>\n <Text>\n Drilldown: chartBarIndex {chartBarIndex}, tabIndex {tabIndex}\n </Text>\n </Stack>\n )\n})\n\n/** A second sample variant, to show registry dispatch with more than one entry. */\nconst CompactPlaceholder = ({ beat }: PlaceholderVariantProps) => (\n <Stack sx={{ alignItems: 'center', gap: 8, p: 24, textAlign: 'center' }}>\n <H3>Action Block Layer Drilldown (compact)</H3>\n <Text>Beat: {beat.guid}</Text>\n </Stack>\n)\n\n// Register one component per backend `variant`; unknown/absent variants fall\n// back to DefaultPlaceholder.\nconst PlaceholderVariants = createVariantBlock<PlaceholderVariantProps>({\n variants: {\n default: DefaultPlaceholder,\n compact: CompactPlaceholder,\n },\n fallback: DefaultPlaceholder,\n name: 'Placeholder',\n})\n\nexport const PlaceholderActionBlock = observer(function PlaceholderActionBlock({\n beat,\n}: ActionBlockProps) {\n const cta = useOpenedCta(beat)\n\n return <PlaceholderVariants beat={beat} variant={cta?.variant} />\n})\n"],"mappings":";;;;;;;AA4BA,IAAM,IAAqB,EAAA,CAAU,EAAE,MAAA,EAAA,MAAoC;AAGzE,QAAM,EAAE,eAAA,IAAgB,GAAG,UAAA,IAAW,EAAA,IAAM,EAAmC,KAAK,CAAC;AAErF,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,YAAY;AAAA,MAAU,KAAK;AAAA,MAAG,GAAG;AAAA,MAAI,WAAW;AAAA,IAAS;AAAA,IAAtE,UAAA;AAAA,MACE,gBAAA,EAAC,GAAD,EAAA,UAAI,+BAAgC,CAAA;AAAA,MACpC,gBAAA,EAAC,GAAD,EAAA,UAAM,+IAGA,CAAA;AAAA,MACN,gBAAA,EAAC,GAAD,EAAA,UAAA,CAAM,UAAO,EAAK,IAAW,EAAA,CAAA;AAAA,MAC7B,gBAAA,EAAC,GAAD,EAAA,UAAA;AAAA,QAAM;AAAA,QACsB;AAAA,QAAc;AAAA,QAAY;AAAA,MAChD,EAAA,CAAA;AAAA,IACD;AAAA;AAEX,CAAC,GAGK,IAAA,CAAsB,EAAE,MAAA,EAAA,MAC5B,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,YAAY;AAAA,IAAU,KAAK;AAAA,IAAG,GAAG;AAAA,IAAI,WAAW;AAAA,EAAS;AAAA,EAAtE,UAAA,CACE,gBAAA,EAAC,GAAD,EAAA,UAAI,yCAA0C,CAAA,GAC9C,gBAAA,EAAC,GAAD,EAAA,UAAA,CAAM,UAAO,EAAK,IAAW,EAAA,CAAA,CACxB;IAKH,IAAsB,EAA4C;AAAA,EACtE,UAAU;AAAA,IACR,SAAS;AAAA,IACT,SAAS;AAAA,EACX;AAAA,EACA,UAAU;AAAA,EACV,MAAM;AACR,CAAC,GAEY,IAAyB,EAAS,SAAgC,EAC7E,MAAA,EAAA,GACmB;AACnB,QAAM,IAAM,EAAa,CAAI;AAE7B,SAAO,gBAAA,EAAC,GAAD;AAAA,IAA2B,MAAA;AAAA,IAAM,SAAS,GAAK;AAAA,EAAU,CAAA;AAClE,CAAC"}
@@ -1,47 +1,44 @@
1
- import { CategoryGuids as h } from "../../../core/constants/Category.es.js";
2
- import { DEFAULT_INSTITUTION_LOGO_URL as _ } from "../../../core/constants/InstitutionLogo.es.js";
3
- import y from "../../../common/utils/AccountDisplayName.es.js";
4
- import { useAccountStore as C, useAppConfig as x, useCashflowStore as T, useGlobalCopyStore as G } from "../../../common/context/hooks.es.js";
1
+ import { CategoryGuids as f } from "../../../core/constants/Category.es.js";
2
+ import { DEFAULT_INSTITUTION_LOGO_URL as h } from "../../../core/constants/InstitutionLogo.es.js";
3
+ import _ from "../../../common/utils/AccountDisplayName.es.js";
4
+ import { useAccountStore as y, useAppConfig as C, useCashflowStore as x, useGlobalCopyStore as G } from "../../../common/context/hooks.es.js";
5
5
  import { getAccountStartingBalance as R } from "../../../core/utils/AccountUtils.es.js";
6
- import L from "../../../common/components/Loader.es.js";
7
- import r from "../../components/CategoryTile.es.js";
8
- import { ErrorCard as E } from "../../components/ErrorCard.es.js";
9
- import { useRecurringExpensesLoadState as S } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
10
- import { foldOtherRows as a, getCaption as U } from "./layout.es.js";
11
- import A from "./RemainingCashContent.es.js";
12
- import { observer as I } from "mobx-react-lite";
13
- import O from "@mui/material/Stack";
14
- import { InstitutionLogo as s, Text as b } from "@mxenabled/mxui";
15
- import { jsx as n } from "react/jsx-runtime";
16
- var Q = I(function(N) {
17
- const { common: m, insights_feed: i } = G(), { config: c } = x(), { uiStore: t } = T(), { accountsLoaded: p } = C(), { failed: u, ready: d, retry: g } = S(), e = i?.remaining_cash;
18
- if (i?.general && !e) return /* @__PURE__ */ n(O, {
19
- sx: { p: 24 },
20
- children: /* @__PURE__ */ n(b, { children: m?.error_message })
21
- });
22
- if (u) return /* @__PURE__ */ n(E, { onRetry: g });
23
- if (!d || !p || !e) return /* @__PURE__ */ n(L, {});
24
- const l = a(t.selectedCashAccounts.map((o) => ({
25
- amount: R(o, c.display_available_balance_in_accounts),
6
+ import T from "../../../common/components/Loader.es.js";
7
+ import { BlockErrorMessage as E } from "../BlockErrorMessage.es.js";
8
+ import i from "../../components/CategoryTile.es.js";
9
+ import { ErrorCard as L } from "../../components/ErrorCard.es.js";
10
+ import { useRecurringExpensesLoadState as U } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
11
+ import { foldOtherRows as r, getCaption as A } from "./layout.es.js";
12
+ import I from "./RemainingCashContent.es.js";
13
+ import { observer as O } from "mobx-react-lite";
14
+ import { InstitutionLogo as a } from "@mxenabled/mxui";
15
+ import { jsx as t } from "react/jsx-runtime";
16
+ var J = O(function(b) {
17
+ const { insights_feed: s } = G(), { config: m } = C(), { uiStore: n } = x(), { accountsLoaded: c } = y(), { failed: u, ready: p, retry: d } = U(), e = s?.remaining_cash;
18
+ if (!e) return /* @__PURE__ */ t(E, {});
19
+ if (u) return /* @__PURE__ */ t(L, { onRetry: d });
20
+ if (!p || !c) return /* @__PURE__ */ t(T, {});
21
+ const g = r(n.selectedCashAccounts.map((o) => ({
22
+ amount: R(o, m.display_available_balance_in_accounts),
26
23
  key: o.guid,
27
- leading: /* @__PURE__ */ n(s, {
24
+ leading: /* @__PURE__ */ t(a, {
28
25
  alt: "",
29
26
  institutionGuid: o.institution_guid ?? "",
30
27
  size: 32
31
28
  }),
32
- name: y(o)
29
+ name: _(o)
33
30
  })), {
34
31
  multi: e.other_accounts,
35
32
  one: e.other_accounts_one
36
- }, /* @__PURE__ */ n(s, {
33
+ }, /* @__PURE__ */ t(a, {
37
34
  alt: "",
38
35
  institutionGuid: "",
39
- logoUrl: _,
36
+ logoUrl: h,
40
37
  size: 32
41
- })), f = a(t.expensesTilNextIncome.map((o) => ({
38
+ })), l = r(n.expensesTilNextIncome.map((o) => ({
42
39
  amount: o.amount,
43
40
  key: `${o.repeatingTransactionGuid}-${o.expectedDate.getTime()}`,
44
- leading: /* @__PURE__ */ n(r, {
41
+ leading: /* @__PURE__ */ t(i, {
45
42
  categoryGuid: o.categoryGuid,
46
43
  size: 32
47
44
  }),
@@ -49,33 +46,33 @@ var Q = I(function(N) {
49
46
  })), {
50
47
  multi: e.other_expenses,
51
48
  one: e.other_expenses_one
52
- }, /* @__PURE__ */ n(r, {
53
- categoryGuid: h.UNCATEGORIZED,
49
+ }, /* @__PURE__ */ t(i, {
50
+ categoryGuid: f.UNCATEGORIZED,
54
51
  size: 32
55
52
  }));
56
- return /* @__PURE__ */ n(A, {
53
+ return /* @__PURE__ */ t(I, {
57
54
  accounts: {
58
55
  header: e.accounts_header,
59
- rows: l
56
+ rows: g
60
57
  },
61
58
  expenses: {
62
59
  header: e.recurring_expenses_header,
63
- rows: f
60
+ rows: l
64
61
  },
65
62
  summary: {
66
- remaining: t.hasUpcomingPayday ? {
67
- amount: t.remainingUntilPayday,
68
- caption: U(e, t.daysUntilNextIncome)
63
+ remaining: n.hasUpcomingPayday ? {
64
+ amount: n.remainingUntilPayday,
65
+ caption: A(e, n.daysUntilNextIncome)
69
66
  } : void 0,
70
- cashOnHand: t.selectedCashBalance,
67
+ cashOnHand: n.selectedCashBalance,
71
68
  cashOnHandLabel: e.cash_on_hand,
72
- upcomingExpenses: t.upcomingExpensesTotal,
69
+ upcomingExpenses: n.upcomingExpensesTotal,
73
70
  upcomingExpensesLabel: e.upcoming_expenses
74
71
  }
75
72
  });
76
73
  });
77
74
  export {
78
- Q as RemainingCashBlock
75
+ J as RemainingCashBlock
79
76
  };
80
77
 
81
78
  //# sourceMappingURL=RemainingCashBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RemainingCashBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { InstitutionLogo, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Loader,\n useAccountStore,\n useAppConfig,\n useCashflowStore,\n useGlobalCopyStore,\n} from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { CategoryGuids } from '../../../core/constants/Category'\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport { getAccountStartingBalance } from '../../../core/utils/AccountUtils'\nimport CategoryTile from '../../components/CategoryTile'\nimport { ErrorCard } from '../../components/ErrorCard'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { useRecurringExpensesLoadState } from '../RecurringTransactionBlock'\n\nimport { foldOtherRows, getCaption } from './layout'\nimport RemainingCashContent from './RemainingCashContent'\n\n/** Remaining Cash drawer: today's figures from CashflowStore, not the card's (see docs/action-blocks/remaining-cash-block.md). */\nexport const RemainingCashBlock = observer(function RemainingCashBlock(_props: ActionBlockProps) {\n const { common: commonCopy, insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { config } = useAppConfig()\n const { uiStore } = useCashflowStore()\n const { accountsLoaded } = useAccountStore()\n const { failed, ready, retry } = useRecurringExpensesLoadState()\n const copy = insightsFeedCopy?.remaining_cash\n\n // Copy loads once, so a retry can't fix a missing namespace: a plain message, not ErrorCard.\n if (insightsFeedCopy?.general && !copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message}</Text>\n </Stack>\n )\n }\n\n if (failed) return <ErrorCard onRetry={retry} />\n\n // `accountsLoaded` / `ready` cover another widget's request still in flight.\n if (!ready || !accountsLoaded || !copy) return <Loader />\n\n const accountRows = foldOtherRows(\n uiStore.selectedCashAccounts.map((account) => ({\n amount: getAccountStartingBalance(account, config.display_available_balance_in_accounts),\n key: account.guid,\n // Decorative: the row's visible name already says which account it is.\n leading: (\n <InstitutionLogo alt=\"\" institutionGuid={account.institution_guid ?? ''} size={32} />\n ),\n name: getAccountDisplayName(account),\n })),\n { multi: copy.other_accounts, one: copy.other_accounts_one },\n <InstitutionLogo alt=\"\" institutionGuid=\"\" logoUrl={DEFAULT_INSTITUTION_LOGO_URL} size={32} />,\n )\n const expenseRows = foldOtherRows(\n uiStore.expensesTilNextIncome.map((expense) => ({\n amount: expense.amount,\n key: `${expense.repeatingTransactionGuid}-${expense.expectedDate.getTime()}`,\n leading: <CategoryTile categoryGuid={expense.categoryGuid} size={32} />,\n name: expense.name,\n })),\n { multi: copy.other_expenses, one: copy.other_expenses_one },\n <CategoryTile categoryGuid={CategoryGuids.UNCATEGORIZED} size={32} />,\n )\n\n return (\n <RemainingCashContent\n accounts={{ header: copy.accounts_header, rows: accountRows }}\n expenses={{ header: copy.recurring_expenses_header, rows: expenseRows }}\n summary={{\n remaining: uiStore.hasUpcomingPayday\n ? {\n amount: uiStore.remainingUntilPayday,\n caption: getCaption(copy, uiStore.daysUntilNextIncome),\n }\n : undefined,\n cashOnHand: uiStore.selectedCashBalance,\n cashOnHandLabel: copy.cash_on_hand,\n upcomingExpenses: uiStore.upcomingExpensesTotal,\n upcomingExpensesLabel: copy.upcoming_expenses,\n }}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;AAyBA,IAAa,IAAqB,EAAS,SAA4B,GAA0B;AAC/F,QAAM,EAAE,QAAQ,GAAY,eAAe,EAAA,IAAqB,EAAmB,GAC7E,EAAE,QAAA,EAAA,IAAW,EAAa,GAC1B,EAAE,SAAA,EAAA,IAAY,EAAiB,GAC/B,EAAE,gBAAA,EAAA,IAAmB,EAAgB,GACrC,EAAE,QAAA,GAAQ,OAAA,GAAO,OAAA,EAAA,IAAU,EAA8B,GACzD,IAAO,GAAkB;AAG/B,MAAI,GAAkB,WAAW,CAAC,EAChC,QACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,GAAG,GAAG;AAAA,IACjB,UAAA,gBAA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MAAE,QAAQ,EAAK;AAAA,MAAiB,MAAM;AAAA,IAAY;AAAA,IAC5D,UAAU;AAAA,MAAE,QAAQ,EAAK;AAAA,MAA2B,MAAM;AAAA,IAAY;AAAA,IACtE,SAAS;AAAA,MACP,WAAW,EAAQ,oBACf;AAAA,QACE,QAAQ,EAAQ;AAAA,QAChB,SAAS,EAAW,GAAM,EAAQ,mBAAmB;AAAA,MACvD,IACA;AAAA,MACJ,YAAY,EAAQ;AAAA,MACpB,iBAAiB,EAAK;AAAA,MACtB,kBAAkB,EAAQ;AAAA,MAC1B,uBAAuB,EAAK;AAAA,IAC9B;AAAA,EACD,CAAA;AAEL,CAAC"}
1
+ {"version":3,"file":"RemainingCashBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.tsx"],"sourcesContent":["import { InstitutionLogo } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Loader,\n useAccountStore,\n useAppConfig,\n useCashflowStore,\n useGlobalCopyStore,\n} from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { CategoryGuids } from '../../../core/constants/Category'\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport { getAccountStartingBalance } from '../../../core/utils/AccountUtils'\nimport CategoryTile from '../../components/CategoryTile'\nimport { ErrorCard } from '../../components/ErrorCard'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { BlockErrorMessage } from '../BlockErrorMessage'\nimport { useRecurringExpensesLoadState } from '../RecurringTransactionBlock'\n\nimport { foldOtherRows, getCaption } from './layout'\nimport RemainingCashContent from './RemainingCashContent'\n\n/** Remaining Cash drawer: today's figures from CashflowStore, not the card's (see docs/action-blocks/remaining-cash-block.md). */\nexport const RemainingCashBlock = observer(function RemainingCashBlock(_props: ActionBlockProps) {\n const { insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { config } = useAppConfig()\n const { uiStore } = useCashflowStore()\n const { accountsLoaded } = useAccountStore()\n const { failed, ready, retry } = useRecurringExpensesLoadState()\n const copy = insightsFeedCopy?.remaining_cash\n\n if (!copy) return <BlockErrorMessage />\n\n if (failed) return <ErrorCard onRetry={retry} />\n\n // `accountsLoaded` / `ready` cover another widget's request still in flight.\n if (!ready || !accountsLoaded) return <Loader />\n\n const accountRows = foldOtherRows(\n uiStore.selectedCashAccounts.map((account) => ({\n amount: getAccountStartingBalance(account, config.display_available_balance_in_accounts),\n key: account.guid,\n // Decorative: the row's visible name already says which account it is.\n leading: (\n <InstitutionLogo alt=\"\" institutionGuid={account.institution_guid ?? ''} size={32} />\n ),\n name: getAccountDisplayName(account),\n })),\n { multi: copy.other_accounts, one: copy.other_accounts_one },\n <InstitutionLogo alt=\"\" institutionGuid=\"\" logoUrl={DEFAULT_INSTITUTION_LOGO_URL} size={32} />,\n )\n const expenseRows = foldOtherRows(\n uiStore.expensesTilNextIncome.map((expense) => ({\n amount: expense.amount,\n key: `${expense.repeatingTransactionGuid}-${expense.expectedDate.getTime()}`,\n leading: <CategoryTile categoryGuid={expense.categoryGuid} size={32} />,\n name: expense.name,\n })),\n { multi: copy.other_expenses, one: copy.other_expenses_one },\n <CategoryTile categoryGuid={CategoryGuids.UNCATEGORIZED} size={32} />,\n )\n\n return (\n <RemainingCashContent\n accounts={{ header: copy.accounts_header, rows: accountRows }}\n expenses={{ header: copy.recurring_expenses_header, rows: expenseRows }}\n summary={{\n remaining: uiStore.hasUpcomingPayday\n ? {\n amount: uiStore.remainingUntilPayday,\n caption: getCaption(copy, uiStore.daysUntilNextIncome),\n }\n : undefined,\n cashOnHand: uiStore.selectedCashBalance,\n cashOnHandLabel: copy.cash_on_hand,\n upcomingExpenses: uiStore.upcomingExpensesTotal,\n upcomingExpensesLabel: copy.upcoming_expenses,\n }}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,IAAa,IAAqB,EAAS,SAA4B,GAA0B;AAC/F,QAAM,EAAE,eAAe,E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AAA,IAAE,OAAO,EAAK;AAAA,IAAgB,KAAK,EAAK;AAAA,EAAmB,GAC3D,gBAAA,EAAC,GAAD;AAAA,IAAc,cAAc,EAAc;AAAA,IAAe,MAAM;AAAA,EAAK,CAAA,CACtE;AAEA,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,UAAU;AAAA,MAAE,QAAQ,EAAK;AAAA,MAAiB,MAAM;AAAA,IAAY;AAAA,IAC5D,UAAU;AAAA,MAAE,QAAQ,EAAK;AAAA,MAA2B,MAAM;AAAA,IAAY;AAAA,IACtE,SAAS;AAAA,MACP,WAAW,EAAQ,oBACf;AAAA,QACE,QAAQ,EAAQ;AAAA,QAChB,SAAS,EAAW,GAAM,EAAQ,mBAAmB;AAAA,MACvD,IACA;AAAA,MACJ,YAAY,EAAQ;AAAA,MACpB,iBAAiB,EAAK;AAAA,MACtB,kBAAkB,EAAQ;AAAA,MAC1B,uBAAuB,EAAK;AAAA,IAC9B;AAAA,EACD,CAAA;AAEL,CAAC"}
@@ -1,91 +1,91 @@
1
1
  import { useGlobalCopyStore as z, useGlobalStore as X, useInsightsV2Store as $ } from "../../common/context/hooks.es.js";
2
- import { slot as d } from "../../core/types/Insights.es.js";
2
+ import { slot as p } from "../../core/types/Insights.es.js";
3
3
  import { CURRENCY_FORMAT as q, formatCurrency as Y } from "../../core/utils/NumberFormatting.es.js";
4
- import N from "../../common/components/dialog/Dialog.es.js";
4
+ import D from "../../common/components/dialog/Dialog.es.js";
5
5
  import { useBeatActions as Z } from "../beatActions.es.js";
6
6
  import { asLogoRef as J } from "../blocks/slotReaders.es.js";
7
- import { USER_RESPONSE as f, answerSubscription as K, repeatingTransactionOf as Q, reportSubscriptionMarkedIncorrect as tt } from "../ctaActions/subscriptionAnswer.es.js";
7
+ import { USER_RESPONSE as d, answerSubscription as K, repeatingTransactionOf as Q, reportSubscriptionMarkedIncorrect as tt } from "../ctaActions/subscriptionAnswer.es.js";
8
8
  import ot from "../components/LogoFromGuid.es.js";
9
9
  import "../components/celebrationGradients.es.js";
10
10
  import { ELEVATION_SHADOW as rt } from "../components/shared/elevation.es.js";
11
11
  import et from "../components/TransactionListCard.es.js";
12
12
  import { subscriptionFrequency as st } from "../components/SubscriptionStatus/subscriptionFrequency.es.js";
13
- import it from "../components/shared/StatusSnackbar.es.js";
14
- import { getDynamicCtaBasedOnTriggers as nt } from "./util.es.js";
15
- import { useEffect as at, useRef as k, useState as T } from "react";
13
+ import nt from "../components/shared/StatusSnackbar.es.js";
14
+ import { useOpenedCta as it } from "./useOpenedCta.es.js";
15
+ import { useEffect as at, useRef as N, useState as k } from "react";
16
16
  import { observer as ct } from "mobx-react-lite";
17
- import B from "@mui/material/Stack";
17
+ import T from "@mui/material/Stack";
18
18
  import { Text as lt } from "@mxenabled/mxui";
19
19
  import { Icon as ut } from "@mxenabled/mx-icons";
20
20
  import { Fragment as mt, jsx as r, jsxs as w } from "react/jsx-runtime";
21
21
  import pt from "@mui/material/Divider";
22
22
  import dt from "@mui/material/ButtonBase";
23
- var ft = 32, G = {
23
+ var ft = 32, B = {
24
24
  backgroundColor: "background.paper",
25
25
  borderRadius: 1,
26
26
  boxShadow: rt[16]
27
27
  }, L = {
28
- "& .MuiDialog-paper": G,
28
+ "& .MuiDialog-paper": B,
29
29
  "& .MuiDialogContent-root": { p: 0 },
30
30
  "& .MuiDialogContent-root ~ .MuiStack-root .MuiButton-root": {
31
31
  px: 16,
32
32
  py: 12
33
33
  }
34
34
  }, _t = [
35
- ["never_subscribed", f.NEVER_SUBSCRIBED],
36
- ["cancelled", f.CANCELLED],
37
- ["one_time_purchase", f.ONE_TIME_PURCHASE]
38
- ], o = (n) => typeof n == "string" && n.trim() ? n : void 0, Ft = ct(function({ beat: x }) {
39
- const P = X(), { insights_feed: _, recurring: F } = z(), { actionDrawer: W, closeActionDrawer: g } = $(), U = Z(), [E, b] = T("answers"), [e, a] = T(null), c = k(!1), y = k(!1), t = _?.subscription_status_modal, l = x.insights_payload, S = _t.flatMap(([s, m]) => {
40
- const p = o(t?.[s]);
41
- return p ? [{
42
- label: p,
43
- userResponse: m
35
+ ["never_subscribed", d.NEVER_SUBSCRIBED],
36
+ ["cancelled", d.CANCELLED],
37
+ ["one_time_purchase", d.ONE_TIME_PURCHASE]
38
+ ], o = (i) => typeof i == "string" && i.trim() ? i : void 0, Ft = ct(function({ beat: f }) {
39
+ const G = X(), { insights_feed: _, recurring: P } = z(), { closeActionDrawer: g } = $(), F = it(f), W = Z(), [x, b] = k("answers"), [e, a] = k(null), c = N(!1), y = N(!1), t = _?.subscription_status_modal, U = f.insights_payload, S = _t.flatMap(([s, u]) => {
40
+ const m = o(t?.[s]);
41
+ return m ? [{
42
+ label: m,
43
+ userResponse: u
44
44
  }] : [];
45
- }), O = !!o(t?.title) && !!o(t?.subscribed_answer) && !!o(t?.not_subscribed_answer) && S.length > 0, D = !!_ && !O;
45
+ }), E = !!o(t?.title) && !!o(t?.subscribed_answer) && !!o(t?.not_subscribed_answer) && S.length > 0, O = !!_ && !E;
46
46
  if (at(() => {
47
- D && (console.warn("[SubscriptionStatusModalBlock] subscription_status_modal is missing its title, answers or reasons; closing."), g());
48
- }, [D, g]), !l || !t || !O) return null;
47
+ O && (console.warn("[SubscriptionStatusModalBlock] subscription_status_modal is missing its title, answers or reasons; closing."), g());
48
+ }, [O, g]), !U || !t || !E) return null;
49
49
  const h = o(t.close_aria) ?? o(t.toast_close_aria) ?? o(_?.settings_menu?.close) ?? "", R = e && o(e.severity === "success" ? t.success_message : t.error_message), v = {
50
- beat: x,
51
- stores: P,
52
- hostActions: U
53
- }, u = nt(W, l.primary_cta, l.secondary_cta, l.in_description_cta)?.drilldown_data ?? {}, I = J(d(u, "logo")), A = d(u, "primary_text"), M = d(u, "amount"), C = async (s) => {
50
+ beat: f,
51
+ stores: G,
52
+ hostActions: W
53
+ }, l = F?.drilldown_data ?? {}, I = J(p(l, "logo")), A = p(l, "primary_text"), M = p(l, "amount"), C = async (s) => {
54
54
  if (!y.current) {
55
55
  y.current = !0, a(null), b("saving");
56
56
  try {
57
- await K(v, s), o(t.success_message) ? a({ severity: "success" }) : i();
57
+ await K(v, s), o(t.success_message) ? a({ severity: "success" }) : n();
58
58
  } catch {
59
59
  o(t.error_message) ? a({
60
60
  severity: "error",
61
61
  retry: s
62
- }) : i();
62
+ }) : n();
63
63
  } finally {
64
64
  y.current = !1;
65
65
  }
66
66
  b("done");
67
67
  }
68
- }, i = () => {
68
+ }, n = () => {
69
69
  a(null), g();
70
70
  }, H = () => {
71
71
  c.current = !0, tt(v), b("reasons");
72
72
  }, j = () => {
73
- c.current = !0, C(f.CONFIRMED);
73
+ c.current = !0, C(d.CONFIRMED);
74
74
  }, V = () => {
75
75
  if (c.current) {
76
76
  c.current = !1;
77
77
  return;
78
78
  }
79
- i();
79
+ n();
80
80
  };
81
81
  return /* @__PURE__ */ w(mt, { children: [
82
- /* @__PURE__ */ r(N, {
82
+ /* @__PURE__ */ r(D, {
83
83
  copy: {
84
84
  title: t.title,
85
85
  close_aria: h
86
86
  },
87
87
  fullWidth: !0,
88
- isOpen: E === "answers",
88
+ isOpen: x === "answers",
89
89
  onClose: V,
90
90
  onPrimaryAction: j,
91
91
  onSecondaryAction: H,
@@ -97,35 +97,35 @@ var ft = 32, G = {
97
97
  elevated: !0,
98
98
  rows: [{
99
99
  amount: typeof M == "number" ? Y(M, q.cents) : "",
100
- amountCaption: st(F, Q(v)),
100
+ amountCaption: st(P, Q(v)),
101
101
  leading: I ? /* @__PURE__ */ r(ot, {
102
102
  logo: I,
103
103
  size: ft
104
104
  }) : void 0,
105
- subtitle: d(u, "secondary_text") ?? "",
105
+ subtitle: p(l, "secondary_text") ?? "",
106
106
  title: A
107
107
  }]
108
108
  })
109
109
  }),
110
- /* @__PURE__ */ r(N, {
110
+ /* @__PURE__ */ r(D, {
111
111
  copy: {
112
112
  title: t.title,
113
113
  close_aria: h
114
114
  },
115
115
  fullWidth: !0,
116
- isOpen: E === "reasons",
117
- onClose: i,
116
+ isOpen: x === "reasons",
117
+ onClose: n,
118
118
  showActions: !1,
119
119
  sx: {
120
120
  ...L,
121
121
  "& .MuiDialog-paper": {
122
- ...G,
122
+ ...B,
123
123
  pb: 16
124
124
  }
125
125
  },
126
- children: /* @__PURE__ */ r(B, { children: S.map(({ label: s, userResponse: m }, p) => /* @__PURE__ */ w(B, { children: [/* @__PURE__ */ w(dt, {
126
+ children: /* @__PURE__ */ r(T, { children: S.map(({ label: s, userResponse: u }, m) => /* @__PURE__ */ w(T, { children: [/* @__PURE__ */ w(dt, {
127
127
  onClick: () => {
128
- C(m);
128
+ C(u);
129
129
  },
130
130
  sx: {
131
131
  gap: 12,
@@ -145,19 +145,19 @@ var ft = 32, G = {
145
145
  size: 24,
146
146
  sx: { color: "action.active" }
147
147
  })]
148
- }), p < S.length - 1 && /* @__PURE__ */ r(pt, { sx: {
148
+ }), m < S.length - 1 && /* @__PURE__ */ r(pt, { sx: {
149
149
  ml: 24,
150
150
  mt: "-1px"
151
- } })] }, m)) })
151
+ } })] }, u)) })
152
152
  }),
153
- e && R && /* @__PURE__ */ r(it, {
153
+ e && R && /* @__PURE__ */ r(nt, {
154
154
  actionText: e.retry ? o(t.try_again) : void 0,
155
155
  closeAriaLabel: o(t.toast_close_aria) ?? h,
156
156
  message: R,
157
157
  onActionClick: e.retry ? () => {
158
158
  C(e.retry);
159
159
  } : void 0,
160
- onClose: i,
160
+ onClose: n,
161
161
  open: !0,
162
162
  severity: e.severity,
163
163
  variant: "strong"
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriptionStatusModalBlock.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/SubscriptionStatusModalBlock.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport ButtonBase from '@mui/material/ButtonBase'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { Dialog, useGlobalCopyStore, useGlobalStore, useInsightsV2Store } from '../../common'\nimport { slot } from '../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../core/utils/NumberFormatting'\nimport { useBeatActions } from '../beatActions'\nimport { WARNING_WASH_GRADIENT } from '../components/celebrationGradients'\nimport LogoFromGuid from '../components/LogoFromGuid'\nimport { ELEVATION_SHADOW } from '../components/shared/elevation'\nimport StatusSnackbar from '../components/shared/StatusSnackbar'\nimport { subscriptionFrequency } from '../components/SubscriptionStatus/subscriptionFrequency'\nimport TransactionListCard from '../components/TransactionListCard'\nimport {\n answerSubscription,\n repeatingTransactionOf,\n reportSubscriptionMarkedIncorrect,\n USER_RESPONSE,\n} from '../ctaActions/subscriptionAnswer'\nimport type { ActionBlockProps } from '../mappings/blocks'\nimport { asLogoRef } from '../blocks/slotReaders'\nimport { getDynamicCtaBasedOnTriggers } from './util'\n\nconst ROW_LOGO_SIZE = 32\n\n// Figma dialog: paper, 4px radius, elevation/16.\nconst DIALOG_PAPER_SX = {\n backgroundColor: 'background.paper',\n borderRadius: 1,\n boxShadow: ELEVATION_SHADOW[16],\n}\nconst SUBSCRIPTION_DIALOG_SX = {\n '& .MuiDialog-paper': DIALOG_PAPER_SX,\n '& .MuiDialogContent-root': { p: 0 },\n '& .MuiDialogContent-root ~ .MuiStack-root .MuiButton-root': { px: 16, py: 12 },\n}\n\n// The reasons in Figma order; a reason with no word drops its row.\nconst REASONS = [\n ['never_subscribed', USER_RESPONSE.NEVER_SUBSCRIBED],\n ['cancelled', USER_RESPONSE.CANCELLED],\n ['one_time_purchase', USER_RESPONSE.ONE_TIME_PURCHASE],\n] as const\n\n/** A non-empty word, or undefined. */\nconst word = (value?: string): string | undefined =>\n typeof value === 'string' && value.trim() ? value : undefined\n\ntype Phase = 'answers' | 'reasons' | 'saving' | 'done'\ninterface Notice {\n severity: 'success' | 'error'\n retry?: string\n}\n\n/** Unexpected Subscription Payment's Subscription Status modal. */\nexport const SubscriptionStatusModalBlock = observer(function SubscriptionStatusModalBlock({\n beat,\n}: ActionBlockProps) {\n const stores = useGlobalStore()\n const { insights_feed, recurring } = useGlobalCopyStore()\n const { actionDrawer, closeActionDrawer } = useInsightsV2Store()\n const beatActions = useBeatActions()\n const [phase, setPhase] = useState<Phase>('answers')\n const [notice, setNotice] = useState<Notice | null>(null)\n // The Dialog calls onClose after its actions; keep the flow open.\n const actionTaken = useRef(false)\n // One save at a time: a double tap (a closing dialog is still clickable) or Try Again sends one PUT.\n const saving = useRef(false)\n\n const copy = insights_feed?.subscription_status_modal\n const payload = beat.insights_payload\n // Only the words needed to answer: the title, both answers and at least one reason. The rest\n // (snackbar words, close labels, reviewed_title, a key added later) never block the modal.\n const reasons = REASONS.flatMap(([key, userResponse]) => {\n const label = word(copy?.[key])\n\n return label ? [{ label, userResponse }] : []\n })\n const ready =\n !!word(copy?.title) &&\n !!word(copy?.subscribed_answer) &&\n !!word(copy?.not_subscribed_answer) &&\n reasons.length > 0\n // Copy loaded (insights_feed is there) but incomplete: say so and close, not a silent open drawer.\n const incomplete = !!insights_feed && !ready\n\n useEffect(() => {\n if (!incomplete) return\n console.warn(\n '[SubscriptionStatusModalBlock] subscription_status_modal is missing its title, answers or reasons; closing.',\n )\n closeActionDrawer()\n }, [incomplete, closeActionDrawer])\n\n if (!payload || !copy || !ready) return null\n\n const closeLabel =\n word(copy.close_aria) ??\n word(copy.toast_close_aria) ??\n word(insights_feed?.settings_menu?.close) ??\n ''\n const noticeMessage =\n notice && word(notice.severity === 'success' ? copy.success_message : copy.error_message)\n\n const ctx = { beat, stores, hostActions: beatActions }\n const cta = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n payload.primary_cta,\n payload.secondary_cta,\n payload.in_description_cta,\n )\n const row = cta?.drilldown_data ?? {}\n const logo = asLogoRef(slot(row, 'logo'))\n const title = slot<string>(row, 'primary_text')\n const amount = slot<number>(row, 'amount')\n\n const save = async (userResponse: string) => {\n if (saving.current) return\n saving.current = true\n setNotice(null)\n setPhase('saving')\n try {\n await answerSubscription(ctx, userResponse)\n // No snackbar word: the save stands, the flow just ends without the snackbar.\n if (word(copy.success_message)) setNotice({ severity: 'success' })\n else finish()\n } catch {\n if (word(copy.error_message)) setNotice({ severity: 'error', retry: userResponse })\n else finish()\n } finally {\n saving.current = false\n }\n setPhase('done')\n }\n\n const finish = () => {\n setNotice(null)\n closeActionDrawer()\n }\n\n const chooseNotSubscribed = () => {\n actionTaken.current = true\n reportSubscriptionMarkedIncorrect(ctx)\n setPhase('reasons')\n }\n\n const chooseSubscribed = () => {\n actionTaken.current = true\n void save(USER_RESPONSE.CONFIRMED)\n }\n\n const closeAnswers = () => {\n if (actionTaken.current) {\n actionTaken.current = false\n return\n }\n finish()\n }\n\n return (\n <>\n <Dialog\n copy={{ title: copy.title, close_aria: closeLabel }}\n fullWidth={true}\n isOpen={phase === 'answers'}\n onClose={closeAnswers}\n onPrimaryAction={chooseSubscribed}\n onSecondaryAction={chooseNotSubscribed}\n primaryText={copy.subscribed_answer}\n secondaryText={copy.not_subscribed_answer}\n // Full-bleed wash between title and actions.\n sx={SUBSCRIPTION_DIALOG_SX}\n >\n {typeof title === 'string' && title && (\n <TransactionListCard\n background={WARNING_WASH_GRADIENT}\n elevated={true}\n rows={[\n {\n amount:\n typeof amount === 'number' ? formatCurrency(amount, CURRENCY_FORMAT.cents) : '',\n amountCaption: subscriptionFrequency(recurring, repeatingTransactionOf(ctx)),\n leading: logo ? <LogoFromGuid logo={logo} size={ROW_LOGO_SIZE} /> : undefined,\n subtitle: slot<string>(row, 'secondary_text') ?? '',\n title,\n },\n ]}\n />\n )}\n </Dialog>\n\n <Dialog\n copy={{ title: copy.title, close_aria: closeLabel }}\n fullWidth={true}\n isOpen={phase === 'reasons'}\n onClose={finish}\n showActions={false}\n // Space under the list.\n sx={{ ...SUBSCRIPTION_DIALOG_SX, '& .MuiDialog-paper': { ...DIALOG_PAPER_SX, pb: 16 } }}\n >\n <Stack>\n {reasons.map(({ label, userResponse }, index) => (\n <Stack key={userResponse}>\n <ButtonBase\n onClick={() => void save(userResponse)}\n sx={{\n gap: 12,\n justifyContent: 'space-between',\n minHeight: 44,\n px: 24,\n py: 8,\n textAlign: 'left',\n width: '100%',\n }}\n >\n <Text variant=\"body1\">{label}</Text>\n <Icon\n aria-hidden={true}\n name=\"chevron_right\"\n size={24}\n sx={{ color: 'action.active' }}\n />\n </ButtonBase>\n {/* Between rows only, drawn over the row edge (as Figma) so rows stay 44px apart. */}\n {index < reasons.length - 1 && <Divider sx={{ ml: 24, mt: '-1px' }} />}\n </Stack>\n ))}\n </Stack>\n </Dialog>\n\n {notice && noticeMessage && (\n <StatusSnackbar\n actionText={notice.retry ? word(copy.try_again) : undefined}\n closeAriaLabel={word(copy.toast_close_aria) ?? closeLabel}\n message={noticeMessage}\n onActionClick={notice.retry ? () => void save(notice.retry as string) : undefined}\n onClose={finish}\n open={true}\n severity={notice.severity}\n variant=\"strong\"\n />\n )}\n </>\n )\n})\n\nexport default SubscriptionStatusModalBlock\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAM,KAAgB,IAGhB,IAAkB;AAAA,EACtB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,WAAW,GAAiB,EAAA;AAC9B,GACM,IAAyB;AAAA,EAC7B,sBAAsB;AAAA,EACtB,4BAA4B,EAAE,GAAG,EAAE;AAAA,EACnC,6DAA6D;AAAA,IAAE,IAAI;AAAA,IAAI,IAAI;AAAA,EAAG;AAChF,GAGM,KAAU;AAAA,EACd,CAAC,oBAAoB,EAAc,gBAAgB;AAAA,EACnD,CAAC,aAAa,EAAc,SAAS;AAAA,EACrC,CAAC,qBAAqB,EAAc,iBAAiB;AACvD,GAGM,IAAA,CAAQ,MACZ,OAAO,KAAU,YAAY,EAAM,KAAK,IAAI,IAAQ,QASzC,KAA+B,GAAS,SAAsC,EACzF,MAAA,EAAA,GACmB;AACnB,QAAM,IAAS,EAAe,GACxB,EAAE,eAAA,GAAe,WAAA,EAAA,IAAc,EAAmB,GAClD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CAAA,CACS;AAAA,MAEX,CAAA,GAAA,IAAQ,EAAQ,SAAS,KAAK,gBAAA,EAAC,IAAD,EAAS,IAAI;AAAA,QAAE,IAAI;AAAA,QAAI,IAAI;AAAA,MAAO,EAAI,CAAA,CAChE,EAAA,GAvBK,CAuBL,CACR,EACI,CAAA;AAAA,IACD,CAAA;AAAA,IAEP,KAAU,KACT,gBAAA,EAAC,IAAD;AAAA,MACE,YAAY,EAAO,QAAQ,EAAK,EAAK,SAAS,IAAI;AAAA,MAClD,gBAAgB,EAAK,EAAK,gBAAgB,KAAK;AAAA,MAC/C,SAAS;AAAA,MACT,eAAe,EAAO,QAAA,MAAA;AAAc,QAAK,EAAK,EAAO,KAAe;AAAA,UAAI;AAAA,MACxE,SAAS;AAAA,MACT,MAAM;AAAA,MACN,UAAU,EAAO;AAAA,MACjB,SAAQ;AAAA,IACT,CAAA;AAAA,EAEH,EAAA,CAAA;AAEN,CAAC"}
1
+ {"version":3,"file":"SubscriptionStatusModalBlock.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/SubscriptionStatusModalBlock.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport ButtonBase from '@mui/material/ButtonBase'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { Dialog, useGlobalCopyStore, useGlobalStore, useInsightsV2Store } from '../../common'\nimport { slot } from '../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../core/utils/NumberFormatting'\nimport { useBeatActions } from '../beatActions'\nimport { WARNING_WASH_GRADIENT } from '../components/celebrationGradients'\nimport LogoFromGuid from '../components/LogoFromGuid'\nimport { ELEVATION_SHADOW } from '../components/shared/elevation'\nimport StatusSnackbar from '../components/shared/StatusSnackbar'\nimport { subscriptionFrequency } from '../components/SubscriptionStatus/subscriptionFrequency'\nimport TransactionListCard from '../components/TransactionListCard'\nimport {\n answerSubscription,\n repeatingTransactionOf,\n reportSubscriptionMarkedIncorrect,\n USER_RESPONSE,\n} from '../ctaActions/subscriptionAnswer'\nimport type { ActionBlockProps } from '../mappings/blocks'\nimport { asLogoRef } from '../blocks/slotReaders'\nimport { useOpenedCta } from './useOpenedCta'\n\nconst ROW_LOGO_SIZE = 32\n\n// Figma dialog: paper, 4px radius, elevation/16.\nconst DIALOG_PAPER_SX = {\n backgroundColor: 'background.paper',\n borderRadius: 1,\n boxShadow: ELEVATION_SHADOW[16],\n}\nconst SUBSCRIPTION_DIALOG_SX = {\n '& .MuiDialog-paper': DIALOG_PAPER_SX,\n '& .MuiDialogContent-root': { p: 0 },\n '& .MuiDialogContent-root ~ .MuiStack-root .MuiButton-root': { px: 16, py: 12 },\n}\n\n// The reasons in Figma order; a reason with no word drops its row.\nconst REASONS = [\n ['never_subscribed', USER_RESPONSE.NEVER_SUBSCRIBED],\n ['cancelled', USER_RESPONSE.CANCELLED],\n ['one_time_purchase', USER_RESPONSE.ONE_TIME_PURCHASE],\n] as const\n\n/** A non-empty word, or undefined. */\nconst word = (value?: string): string | undefined =>\n typeof value === 'string' && value.trim() ? value : undefined\n\ntype Phase = 'answers' | 'reasons' | 'saving' | 'done'\ninterface Notice {\n severity: 'success' | 'error'\n retry?: string\n}\n\n/** Unexpected Subscription Payment's Subscription Status modal. */\nexport const SubscriptionStatusModalBlock = observer(function SubscriptionStatusModalBlock({\n beat,\n}: ActionBlockProps) {\n const stores = useGlobalStore()\n const { insights_feed, recurring } = useGlobalCopyStore()\n const { closeActionDrawer } = useInsightsV2Store()\n const cta = useOpenedCta(beat)\n const beatActions = useBeatActions()\n const [phase, setPhase] = useState<Phase>('answers')\n const [notice, setNotice] = useState<Notice | null>(null)\n // The Dialog calls onClose after its actions; keep the flow open.\n const actionTaken = useRef(false)\n // One save at a time: a double tap (a closing dialog is still clickable) or Try Again sends one PUT.\n const saving = useRef(false)\n\n const copy = insights_feed?.subscription_status_modal\n const payload = beat.insights_payload\n // Only the words needed to answer: the title, both answers and at least one reason. The rest\n // (snackbar words, close labels, reviewed_title, a key added later) never block the modal.\n const reasons = REASONS.flatMap(([key, userResponse]) => {\n const label = word(copy?.[key])\n\n return label ? [{ label, userResponse }] : []\n })\n const ready =\n !!word(copy?.title) &&\n !!word(copy?.subscribed_answer) &&\n !!word(copy?.not_subscribed_answer) &&\n reasons.length > 0\n // Copy loaded (insights_feed is there) but incomplete: say so and close, not a silent open drawer.\n const incomplete = !!insights_feed && !ready\n\n useEffect(() => {\n if (!incomplete) return\n console.warn(\n '[SubscriptionStatusModalBlock] subscription_status_modal is missing its title, answers or reasons; closing.',\n )\n closeActionDrawer()\n }, [incomplete, closeActionDrawer])\n\n if (!payload || !copy || !ready) return null\n\n const closeLabel =\n word(copy.close_aria) ??\n word(copy.toast_close_aria) ??\n word(insights_feed?.settings_menu?.close) ??\n ''\n const noticeMessage =\n notice && word(notice.severity === 'success' ? copy.success_message : copy.error_message)\n\n const ctx = { beat, stores, hostActions: beatActions }\n const row = cta?.drilldown_data ?? {}\n const logo = asLogoRef(slot(row, 'logo'))\n const title = slot<string>(row, 'primary_text')\n const amount = slot<number>(row, 'amount')\n\n const save = async (userResponse: string) => {\n if (saving.current) return\n saving.current = true\n setNotice(null)\n setPhase('saving')\n try {\n await answerSubscription(ctx, userResponse)\n // No snackbar word: the save stands, the flow just ends without the snackbar.\n if (word(copy.success_message)) setNotice({ severity: 'success' })\n else finish()\n } catch {\n if (word(copy.error_message)) setNotice({ severity: 'error', retry: userResponse })\n else finish()\n } finally {\n saving.current = false\n }\n setPhase('done')\n }\n\n const finish = () => {\n setNotice(null)\n closeActionDrawer()\n }\n\n const chooseNotSubscribed = () => {\n actionTaken.current = true\n reportSubscriptionMarkedIncorrect(ctx)\n setPhase('reasons')\n }\n\n const chooseSubscribed = () => {\n actionTaken.current = true\n void save(USER_RESPONSE.CONFIRMED)\n }\n\n const closeAnswers = () => {\n if (actionTaken.current) {\n actionTaken.current = false\n return\n }\n finish()\n }\n\n return (\n <>\n <Dialog\n copy={{ title: copy.title, close_aria: closeLabel }}\n fullWidth={true}\n isOpen={phase === 'answers'}\n onClose={closeAnswers}\n onPrimaryAction={chooseSubscribed}\n onSecondaryAction={chooseNotSubscribed}\n primaryText={copy.subscribed_answer}\n secondaryText={copy.not_subscribed_answer}\n // Full-bleed wash between title and actions.\n sx={SUBSCRIPTION_DIALOG_SX}\n >\n {typeof title === 'string' && title && (\n <TransactionListCard\n background={WARNING_WASH_GRADIENT}\n elevated={true}\n rows={[\n {\n amount:\n typeof amount === 'number' ? formatCurrency(amount, CURRENCY_FORMAT.cents) : '',\n amountCaption: subscriptionFrequency(recurring, repeatingTransactionOf(ctx)),\n leading: logo ? <LogoFromGuid logo={logo} size={ROW_LOGO_SIZE} /> : undefined,\n subtitle: slot<string>(row, 'secondary_text') ?? '',\n title,\n },\n ]}\n />\n )}\n </Dialog>\n\n <Dialog\n copy={{ title: copy.title, close_aria: closeLabel }}\n fullWidth={true}\n isOpen={phase === 'reasons'}\n onClose={finish}\n showActions={false}\n // Space under the list.\n sx={{ ...SUBSCRIPTION_DIALOG_SX, '& .MuiDialog-paper': { ...DIALOG_PAPER_SX, pb: 16 } }}\n >\n <Stack>\n {reasons.map(({ label, userResponse }, index) => (\n <Stack key={userResponse}>\n <ButtonBase\n onClick={() => void save(userResponse)}\n sx={{\n gap: 12,\n justifyContent: 'space-between',\n minHeight: 44,\n px: 24,\n py: 8,\n textAlign: 'left',\n width: '100%',\n }}\n >\n <Text variant=\"body1\">{label}</Text>\n <Icon\n aria-hidden={true}\n name=\"chevron_right\"\n size={24}\n sx={{ color: 'action.active' }}\n />\n </ButtonBase>\n {/* Between rows only, drawn over the row edge (as Figma) so rows stay 44px apart. */}\n {index < reasons.length - 1 && <Divider sx={{ ml: 24, mt: '-1px' }} />}\n </Stack>\n ))}\n </Stack>\n </Dialog>\n\n {notice && noticeMessage && (\n <StatusSnackbar\n actionText={notice.retry ? word(copy.try_again) : undefined}\n closeAriaLabel={word(copy.toast_close_aria) ?? closeLabel}\n message={noticeMessage}\n onActionClick={notice.retry ? () => void save(notice.retry as string) : undefined}\n onClose={finish}\n open={true}\n severity={notice.severity}\n variant=\"strong\"\n />\n )}\n </>\n )\n})\n\nexport default SubscriptionStatusModalBlock\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAM,KAAgB,IAGhB,IAAkB;AAAA,EACtB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,WAAW,GAAiB,EAAA;AAC9B,GACM,IAAyB;AAAA,EAC7B,sBAAsB;AAAA,EACtB,4BAA4B,EAAE,GAAG,EAAE;AAAA,EACnC,6DAA6D;AAAA,IAAE,IAAI;AAAA,IAAI,IAAI;AAAA,EAAG;AAChF,GAGM,KAAU;AAAA,EACd,CAAC,oBAAoB,EAAc,gBAAgB;AAAA,EACnD,CAAC,aAAa,EAAc,SAAS;AAAA,EACrC,CAAC,qBAAqB,EAAc,iBAAiB;AACvD,GAGM,IAAA,CAAQ,MACZ,OAAO,KAAU,YAAY,EAAM,KAAK,IAAI,IAAQ,QASzC,KAA+B,GAAS,SAAsC,EACzF,MAAA,EAAA,GACmB;AACnB,QAAM,IAAS,EAAe,GACxB,EAAE,eAAA,GAAe,WAAA,EAAA,IAAc,EAAmB,GAClD,EAAE,mBAAA,EAAA,IAAsB,EAAmB,GAC3C,IAAM,GAAa,CAAI,GACvB,IAAc,EAAe,GAC7B,CAAC,GAAO,CAAA,IAAY,EAAgB,SAAS,GAC7C,CAAC,GAAQ,CAAA,IAAa,EAAwB,IAAI,GAElD,IAAc,EAAO,EAAK,GAE1B,IAAS,EAAO,EAAK,GAErB,IAAO,GAAe,2BACtB,IAAU,EAAK,kBAGf,IAAU,GAAQ,QAAA,CAAS,CAAC,GAAK,CAAA,MAAkB;AACvD,UAAM,IAAQ,EAAK,IAAO,CAAA,CAAI;AAE9B,WAAO,IAAQ,CAAC;AAAA,MAAE,OAAA;AAAA,MAAO,c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AI;AAAA,MACxE,SAAS;AAAA,MACT,MAAM;AAAA,MACN,UAAU,EAAO;AAAA,MACjB,SAAQ;AAAA,IACT,CAAA;AAAA,EAEH,EAAA,CAAA;AAEN,CAAC"}
@@ -1,18 +1,18 @@
1
- import { useGlobalCopyStore as _, useGlobalStore as y, useInsightsV2Store as v } from "../../common/context/hooks.es.js";
2
- import { useBeatActions as d } from "../beatActions.es.js";
3
- import { resolveStep as g } from "../ctaActions/runCtaAction.es.js";
4
- import S from "../components/SurveyModal.es.js";
5
- import { getDynamicCtaBasedOnTriggers as f } from "./util.es.js";
6
- import { observer as h } from "mobx-react-lite";
7
- import { jsx as A } from "react/jsx-runtime";
8
- var B = h(function({ beat: t }) {
9
- const { actionDrawer: i, closeActionDrawer: n } = v(), r = d(), c = _(), l = y(), o = t.insights_payload, e = c.insights_feed?.survey_modal;
10
- if (!o || !e) return null;
11
- const a = f(i, o.primary_cta, o.secondary_cta, o.in_description_cta), s = a && g({ cta: a }).surveyAnswer?.({
12
- beat: t,
1
+ import { useGlobalCopyStore as b, useGlobalStore as v, useInsightsV2Store as y } from "../../common/context/hooks.es.js";
2
+ import { useBeatActions as _ } from "../beatActions.es.js";
3
+ import { resolveStep as d } from "../ctaActions/runCtaAction.es.js";
4
+ import g from "../components/SurveyModal.es.js";
5
+ import { useOpenedCta as S } from "./useOpenedCta.es.js";
6
+ import { observer as f } from "mobx-react-lite";
7
+ import { jsx as h } from "react/jsx-runtime";
8
+ var T = f(function({ beat: s }) {
9
+ const { closeActionDrawer: n } = y(), t = S(s), r = _(), a = b(), l = v(), i = s.insights_payload, e = a.insights_feed?.survey_modal;
10
+ if (!i || !e) return null;
11
+ const o = t && d({ cta: t }).surveyAnswer?.({
12
+ beat: s,
13
13
  stores: l,
14
14
  hostActions: r
15
- }, e), u = {
15
+ }, e), c = {
16
16
  title: e.title,
17
17
  options: [{
18
18
  overline: e.yes_overline,
@@ -26,30 +26,30 @@ var B = h(function({ beat: t }) {
26
26
  submitText: e.submit,
27
27
  closeAriaLabel: e.close_aria,
28
28
  reasonsTitle: e.reasons_title,
29
- reasonOptions: s?.reasonOptions ?? Object.values(e.reason_options ?? {}),
29
+ reasonOptions: o?.reasonOptions ?? Object.values(e.reason_options ?? {}),
30
30
  backText: e.back,
31
31
  characterLimitLabel: e.character_limit,
32
32
  successMessage: e.success_message,
33
33
  errorMessage: e.error_message,
34
34
  tryAgainText: e.try_again,
35
35
  toastCloseAriaLabel: e.toast_close_aria
36
- }, m = s?.onSubmit ?? ((p, b) => r.onSubmitFeedback?.({
37
- beatGuid: o.guid,
36
+ }, u = o?.onSubmit ?? ((m, p) => r.onSubmitFeedback?.({
37
+ beatGuid: i.guid,
38
38
  source: "cta",
39
- option: p,
40
- detail: b
39
+ option: m,
40
+ detail: p
41
41
  }));
42
- return /* @__PURE__ */ A(S, {
43
- copy: u,
42
+ return /* @__PURE__ */ h(g, {
43
+ copy: c,
44
44
  isOpen: !0,
45
45
  onClose: () => n(),
46
- onReasonsOpen: s?.onReasonsOpen,
47
- onSubmit: m,
48
- showDetailField: s?.showDetailField
46
+ onReasonsOpen: o?.onReasonsOpen,
47
+ onSubmit: u,
48
+ showDetailField: o?.showDetailField
49
49
  });
50
50
  });
51
51
  export {
52
- B as SurveyModalActionBlock
52
+ T as SurveyModalActionBlock
53
53
  };
54
54
 
55
55
  //# sourceMappingURL=SurveyModalActionBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SurveyModalActionBlock.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/SurveyModalActionBlock.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport { useGlobalCopyStore, useGlobalStore, useInsightsV2Store } from '../../common'\nimport SurveyModal, { type SurveyModalContent } from '../components/SurveyModal'\nimport { useBeatActions } from '../beatActions'\nimport { resolveStep } from '../ctaActions'\nimport type { ActionBlockProps } from '../mappings/blocks'\nimport { getDynamicCtaBasedOnTriggers } from './util'\n\n/**\n * `survey_modal_block` — the \"Does this look right?\" confirmation survey\n * (Figma `1941:212640`). Registered like any other drawer block; its content\n * is a MODAL (the dialog portals over the drawer).\n *\n * The survey has no action buttons — its rows act: the positive row submits\n * to the host via `beatActions.onSubmitFeedback` (source `cta`) and shows the\n * status snackbar; the negative row opens the FeedbackModal reasons dialog.\n * The session ends when the flow does (snackbar dismissed or dialogs closed).\n *\n * Copy comes from `insights_feed.survey_modal` in GlobalCopy.\n */\nexport const SurveyModalActionBlock = observer(function SurveyModalActionBlock({\n beat,\n}: ActionBlockProps) {\n const { actionDrawer, closeActionDrawer } = useInsightsV2Store()\n const beatActions = useBeatActions()\n const copyStore = useGlobalCopyStore()\n const stores = useGlobalStore()\n\n const insights_payload = beat.insights_payload\n const surveyCopy = copyStore.insights_feed?.survey_modal\n\n if (!insights_payload || !surveyCopy) return null\n\n // The step of the CTA that opened the drawer.\n const cta = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n insights_payload.primary_cta,\n insights_payload.secondary_cta,\n insights_payload.in_description_cta,\n )\n const survey =\n cta &&\n resolveStep({ cta }).surveyAnswer?.({ beat, stores, hostActions: beatActions }, surveyCopy)\n\n const copy: SurveyModalContent = {\n title: surveyCopy.title,\n options: [\n { overline: surveyCopy.yes_overline, label: surveyCopy.yes_label, tone: 'positive' },\n { overline: surveyCopy.no_overline, label: surveyCopy.no_label, tone: 'negative' },\n ],\n submitText: surveyCopy.submit,\n\n closeAriaLabel: surveyCopy.close_aria,\n reasonsTitle: surveyCopy.reasons_title,\n reasonOptions: survey?.reasonOptions ?? Object.values(surveyCopy.reason_options ?? {}),\n backText: surveyCopy.back,\n characterLimitLabel: surveyCopy.character_limit,\n successMessage: surveyCopy.success_message,\n errorMessage: surveyCopy.error_message,\n tryAgainText: surveyCopy.try_again,\n toastCloseAriaLabel: surveyCopy.toast_close_aria,\n }\n\n // Returned (not just fired): a host promise rejection drives the modal's\n // error snackbar + Try Again retry. The session closes when the flow ends\n // (snackbar dismissed), not on submit.\n\n //TODO: Need to update the onSubmit functionality as per pulse. This function is mis-matching with the current approach of switchdirectdeposit and setupdirectdeposit\n const handleSubmit =\n survey?.onSubmit ??\n ((option: string, detail?: string) =>\n beatActions.onSubmitFeedback?.({\n beatGuid: insights_payload.guid,\n source: 'cta',\n option,\n detail,\n }))\n\n return (\n <SurveyModal\n copy={copy}\n isOpen={true}\n onClose={() => closeActionDrawer()}\n onReasonsOpen={survey?.onReasonsOpen}\n onSubmit={handleSubmit}\n showDetailField={survey?.showDetailField}\n />\n )\n})\n"],"mappings":";;;;;;;AAqBA,IAAa,IAAyB,EAAS,SAAgC,EAC7E,MAAA,EAAA,GACmB;AACnB,QAAM,EAAE,cAAA,GAAc,mBAAA,EAAA,IAAsB,EAAmB,GACzD,IAAc,EAAe,GAC7B,IAAY,EAAmB,GAC/B,IAAS,EAAe,GAExB,IAAmB,EAAK,kBACxB,IAAa,EAAU,eAAe;AAE5C,MAAI,CAAC,KAAoB,CAAC,EAAY,QAAO;AAG7C,QAAM,IAAM,EACV,GACA,EAAiB,aACjB,EAAiB,eACjB,EAAiB,kBACnB,GACM,IACJ,KACA,EAAY,EAAE,KAAA,EAAI,CAAC,EAAE,eAAe;AAAA,IAAE,MAAA;AAAA,IAAM,QAAA;AAAA,IAAQ,aAAa;AAAA,EAAY,GAAG,CAAU,GAEtF,IAA2B;AAAA,IAC/B,OAAO,EAAW;AAAA,IAClB,SAAS,CACP;AAAA,MAAE,UAAU,EAAW;AAAA,MAAc,OAAO,EAAW;AAAA,MAAW,MAAM;AAAA,IAAW,GACnF;AAAA,MAAE,UAAU,EAAW;AAAA,MAAa,OAAO,EAAW;AAAA,MAAU,MAAM;AAAA,IAAW,CACnF;AAAA,IACA,YAAY,EAAW;AAAA,IAEvB,gBAAgB,EAAW;AAAA,IAC3B,cAAc,EAAW;AAAA,IACzB,eAAe,GAAQ,iBAAiB,OAAO,OAAO,EAAW,kBAAkB,CAAC,CAAC;AAAA,IACrF,UAAU,EAAW;AAAA,IACrB,qBAAqB,EAAW;AAAA,IAChC,gBAAgB,EAAW;AAAA,IAC3B,cAAc,EAAW;AAAA,IACzB,cAAc,EAAW;AAAA,IACzB,qBAAqB,EAAW;AAAA,EAClC,GAOM,IACJ,GAAQ,aAAA,CACN,GAAgB,MAChB,EAAY,mBAAmB;AAAA,IAC7B,UAAU,EAAiB;AAAA,IAC3B,QAAQ;AAAA,IACR,QAAA;AAAA,IACA,QAAA;AAAA,EACF,CAAC;AAEL,SACE,gBAAA,EAAC,GAAD;AAAA,IACQ,MAAA;AAAA,IACN,QAAQ;AAAA,IACR,SAAA,MAAe,EAAkB;AAAA,IACjC,eAAe,GAAQ;AAAA,IACvB,UAAU;AAAA,IACV,iBAAiB,GAAQ;AAAA,EAC1B,CAAA;AAEL,CAAC"}
1
+ {"version":3,"file":"SurveyModalActionBlock.es.js","names":[],"sources":["../../../src/insights-v2/actionBlocks/SurveyModalActionBlock.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport { useGlobalCopyStore, useGlobalStore, useInsightsV2Store } from '../../common'\nimport SurveyModal, { type SurveyModalContent } from '../components/SurveyModal'\nimport { useBeatActions } from '../beatActions'\nimport { resolveStep } from '../ctaActions'\nimport type { ActionBlockProps } from '../mappings/blocks'\nimport { useOpenedCta } from './useOpenedCta'\n\n/**\n * `survey_modal_block` — the \"Does this look right?\" confirmation survey\n * (Figma `1941:212640`). Registered like any other drawer block; its content\n * is a MODAL (the dialog portals over the drawer).\n *\n * The survey has no action buttons — its rows act: the positive row submits\n * to the host via `beatActions.onSubmitFeedback` (source `cta`) and shows the\n * status snackbar; the negative row opens the FeedbackModal reasons dialog.\n * The session ends when the flow does (snackbar dismissed or dialogs closed).\n *\n * Copy comes from `insights_feed.survey_modal` in GlobalCopy.\n */\nexport const SurveyModalActionBlock = observer(function SurveyModalActionBlock({\n beat,\n}: ActionBlockProps) {\n const { closeActionDrawer } = useInsightsV2Store()\n const cta = useOpenedCta(beat)\n const beatActions = useBeatActions()\n const copyStore = useGlobalCopyStore()\n const stores = useGlobalStore()\n\n const insights_payload = beat.insights_payload\n const surveyCopy = copyStore.insights_feed?.survey_modal\n\n if (!insights_payload || !surveyCopy) return null\n\n const survey =\n cta &&\n resolveStep({ cta }).surveyAnswer?.({ beat, stores, hostActions: beatActions }, surveyCopy)\n\n const copy: SurveyModalContent = {\n title: surveyCopy.title,\n options: [\n { overline: surveyCopy.yes_overline, label: surveyCopy.yes_label, tone: 'positive' },\n { overline: surveyCopy.no_overline, label: surveyCopy.no_label, tone: 'negative' },\n ],\n submitText: surveyCopy.submit,\n\n closeAriaLabel: surveyCopy.close_aria,\n reasonsTitle: surveyCopy.reasons_title,\n reasonOptions: survey?.reasonOptions ?? Object.values(surveyCopy.reason_options ?? {}),\n backText: surveyCopy.back,\n characterLimitLabel: surveyCopy.character_limit,\n successMessage: surveyCopy.success_message,\n errorMessage: surveyCopy.error_message,\n tryAgainText: surveyCopy.try_again,\n toastCloseAriaLabel: surveyCopy.toast_close_aria,\n }\n\n // Returned (not just fired): a host promise rejection drives the modal's\n // error snackbar + Try Again retry. The session closes when the flow ends\n // (snackbar dismissed), not on submit.\n\n //TODO: Need to update the onSubmit functionality as per pulse. This function is mis-matching with the current approach of switchdirectdeposit and setupdirectdeposit\n const handleSubmit =\n survey?.onSubmit ??\n ((option: string, detail?: string) =>\n beatActions.onSubmitFeedback?.({\n beatGuid: insights_payload.guid,\n source: 'cta',\n option,\n detail,\n }))\n\n return (\n <SurveyModal\n copy={copy}\n isOpen={true}\n onClose={() => closeActionDrawer()}\n onReasonsOpen={survey?.onReasonsOpen}\n onSubmit={handleSubmit}\n showDetailField={survey?.showDetailField}\n />\n )\n})\n"],"mappings":";;;;;;;AAqBA,IAAa,IAAyB,EAAS,SAAgC,EAC7E,MAAA,EAAA,GACmB;AACnB,QAAM,EAAE,mBAAA,EAAA,IAAsB,EAAmB,GAC3C,IAAM,EAAa,CAAI,GACvB,IAAc,EAAe,GAC7B,IAAY,EAAmB,GAC/B,IAAS,EAAe,GAExB,IAAmB,EAAK,kBACxB,IAAa,EAAU,eAAe;AAE5C,MAAI,CAAC,KAAoB,CAAC,EAAY,QAAO;AAE7C,QAAM,IACJ,KACA,EAAY,EAAE,KAAA,EAAI,CAAC,EAAE,eAAe;AAAA,IAAE,MAAA;AAAA,IAAM,QAAA;AAAA,IAAQ,aAAa;AAAA,EAAY,GAAG,CAAU,GAEtF,IAA2B;AAAA,IAC/B,OAAO,EAAW;AAAA,IAClB,SAAS,CACP;AAAA,MAAE,UAAU,EAAW;AAAA,MAAc,OAAO,EAAW;AAAA,MAAW,MAAM;AAAA,IAAW,GACnF;AAAA,MAAE,UAAU,EAAW;AAAA,MAAa,OAAO,EAAW;AAAA,MAAU,MAAM;AAAA,IAAW,CACnF;AAAA,IACA,YAAY,EAAW;AAAA,IAEvB,gBAAgB,EAAW;AAAA,IAC3B,cAAc,EAAW;AAAA,IACzB,eAAe,GAAQ,iBAAiB,OAAO,OAAO,EAAW,kBAAkB,CAAC,CAAC;AAAA,IACrF,UAAU,EAAW;AAAA,IACrB,qBAAqB,EAAW;AAAA,IAChC,gBAAgB,EAAW;AAAA,IAC3B,cAAc,EAAW;AAAA,IACzB,cAAc,EAAW;AAAA,IACzB,qBAAqB,EAAW;AAAA,EAClC,GAOM,IACJ,GAAQ,aAAA,CACN,GAAgB,MAChB,EAAY,mBAAmB;AAAA,IAC7B,UAAU,EAAiB;AAAA,IAC3B,QAAQ;AAAA,IACR,QAAA;AAAA,IACA,QAAA;AAAA,EACF,CAAC;AAEL,SACE,gBAAA,EAAC,GAAD;AAAA,IACQ,MAAA;AAAA,IACN,QAAQ;AAAA,IACR,SAAA,MAAe,EAAkB;AAAA,IACjC,eAAe,GAAQ;AAAA,IACvB,UAAU;AAAA,IACV,iBAAiB,GAAQ;AAAA,EAC1B,CAAA;AAEL,CAAC"}
@@ -1,25 +1,20 @@
1
- import { useGlobalCopyStore as m } from "../../../common/context/hooks.es.js";
2
- import s from "../../../common/components/Loader.es.js";
3
- import { useTransactionDetailsBlock as c } from "./useTransactionDetailsBlock.es.js";
4
- import l from "../../../transactions/components/shared/TransactionDetails.es.js";
1
+ import n from "../../../common/components/Loader.es.js";
2
+ import { BlockErrorMessage as e } from "../BlockErrorMessage.es.js";
3
+ import { useTransactionDetailsBlock as m } from "./useTransactionDetailsBlock.es.js";
4
+ import c from "../../../transactions/components/shared/TransactionDetails.es.js";
5
5
  import { observer as f } from "mobx-react-lite";
6
- import p from "@mui/material/Stack";
7
- import { Text as d } from "@mxenabled/mxui";
8
6
  import { jsx as o } from "react/jsx-runtime";
9
- var S = f(function({ beat: t }) {
10
- const { common: i } = m(), { bottomActions: e, isLoading: n, topActions: a, transaction: r } = c(t);
11
- return n ? /* @__PURE__ */ o(s, {}) : r ? /* @__PURE__ */ o(l, {
12
- bottomActions: e,
7
+ var T = f(function({ beat: t }) {
8
+ const { bottomActions: i, isLoading: a, topActions: s, transaction: r } = m(t);
9
+ return a ? /* @__PURE__ */ o(n, {}) : r ? /* @__PURE__ */ o(c, {
10
+ bottomActions: i,
13
11
  shouldShowEmbeddedCard: !1,
14
- topActions: a,
12
+ topActions: s,
15
13
  transaction: r
16
- }) : /* @__PURE__ */ o(p, {
17
- sx: { p: 24 },
18
- children: /* @__PURE__ */ o(d, { children: i.error_message })
19
- });
14
+ }) : /* @__PURE__ */ o(e, {});
20
15
  });
21
16
  export {
22
- S as TransactionDetailsBlock
17
+ T as TransactionDetailsBlock
23
18
  };
24
19
 
25
20
  //# sourceMappingURL=TransactionDetailsBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionDetailsBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { Loader, useGlobalCopyStore } from '../../../common'\nimport TransactionDetails from '../../../transactions/components/shared/TransactionDetails'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\nimport { useTransactionDetailsBlock } from './useTransactionDetailsBlock'\n\n/**\n * Single-transaction drawer content. The detail rendering and inline editing (category picker, date,\n * memo, tags, split/hide/merchant-budget) all live in the shared `TransactionDetails` component from\n * the transactions module — this block's job is only to resolve *which* transaction and *which*\n * actions, then hand off.\n *\n * `observer` is required: the resolved transaction comes from TransactionStore, and `usePrepare` may\n * still be loading it when this first renders. Without it the drawer would stay on the loader.\n */\nexport const TransactionDetailsBlock = observer(function TransactionDetailsBlock({\n beat,\n}: ActionBlockProps) {\n const { common: commonCopy } = useGlobalCopyStore()\n const { bottomActions, isLoading, topActions, transaction } = useTransactionDetailsBlock(beat)\n\n if (isLoading) return <Loader />\n\n // Loading finished and the guid still resolves to nothing — a stale beat pointing at a deleted or\n // out-of-window transaction. Mirrors ActionBlockLayer's unknown-block branch rather than rendering\n // an empty drawer.\n if (!transaction) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy.error_message}</Text>\n </Stack>\n )\n }\n\n return (\n <TransactionDetails\n bottomActions={bottomActions}\n // Embedded insight card is a PFM-only concern (TransactionDetails defaults to true); this beat's own drawer must not show a redundant embedded card of itself.\n shouldShowEmbeddedCard={false}\n topActions={topActions}\n transaction={transaction}\n />\n )\n})\n"],"mappings":";;;;;;;;AAoBA,IAAa,IAA0B,EAAS,SAAiC,EAC/E,MAAA,EAAA,GACmB;AACnB,QAAM,EAAE,QAAQ,EAAA,IAAe,EAAmB,GAC5C,EAAE,eAAA,GAAe,WAAA,GAAW,YAAA,GAAY,aAAA,EAAA,IAAgB,EAA2B,CAAI;AAE7F,SAAI,IAAkB,gBAAA,EAAC,GAAD,CAAS,CAAA,IAK1B,IASH,gBAAA,EAAC,GAAD;AAAA,IACiB,eAAA;AAAA,IAEf,wBAAwB;AAAA,IACZ,YAAA;AAAA,IACC,aAAA;AAAA,EACd,CAAA,IAbC,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,GAAG,GAAG;AAAA,IACjB,UAAA,gBAAA,EAAC,GAAD,EAAA,UAAO,EAAW,cAAoB,CAAA;AAAA,EACjC,CAAA;AAab,CAAC"}
1
+ {"version":3,"file":"TransactionDetailsBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport { Loader } from '../../../common'\nimport TransactionDetails from '../../../transactions/components/shared/TransactionDetails'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { BlockErrorMessage } from '../BlockErrorMessage'\n\nimport { useTransactionDetailsBlock } from './useTransactionDetailsBlock'\n\n/**\n * Single-transaction drawer content. The detail rendering and inline editing (category picker, date,\n * memo, tags, split/hide/merchant-budget) all live in the shared `TransactionDetails` component from\n * the transactions module — this block's job is only to resolve *which* transaction and *which*\n * actions, then hand off.\n *\n * `observer` is required: the resolved transaction comes from TransactionStore, and `usePrepare` may\n * still be loading it when this first renders. Without it the drawer would stay on the loader.\n */\nexport const TransactionDetailsBlock = observer(function TransactionDetailsBlock({\n beat,\n}: ActionBlockProps) {\n const { bottomActions, isLoading, topActions, transaction } = useTransactionDetailsBlock(beat)\n\n if (isLoading) return <Loader />\n\n // Stale beat: its transaction was deleted or is out of window.\n if (!transaction) {\n return <BlockErrorMessage />\n }\n\n return (\n <TransactionDetails\n bottomActions={bottomActions}\n // Embedded insight card is a PFM-only concern (TransactionDetails defaults to true); this beat's own drawer must not show a redundant embedded card of itself.\n shouldShowEmbeddedCard={false}\n topActions={topActions}\n transaction={transaction}\n />\n )\n})\n"],"mappings":";;;;;;AAkBA,IAAa,IAA0B,EAAS,SAAiC,EAC/E,MAAA,EAAA,GACmB;AACnB,QAAM,EAAE,eAAA,GAAe,WAAA,GAAW,YAAA,GAAY,aAAA,EAAA,IAAgB,EAA2B,CAAI;AAE7F,SAAI,IAAkB,gBAAA,EAAC,GAAD,CAAS,CAAA,IAG1B,IAKH,gBAAA,EAAC,GAAD;AAAA,IACiB,eAAA;AAAA,IAEf,wBAAwB;AAAA,IACZ,YAAA;AAAA,IACC,aAAA;AAAA,EACd,CAAA,IAVM,gBAAA,EAAC,GAAD,CAAoB,CAAA;AAY/B,CAAC"}