@mx-cartographer/experiences 9.7.28 → 9.7.30

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 (49) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/core/api/UserApi.es.js +8 -8
  3. package/dist/core/api/UserApi.es.js.map +1 -1
  4. package/dist/core/stores/GlobalStore.d.ts +4 -2
  5. package/dist/core/stores/GlobalStore.es.js +34 -34
  6. package/dist/core/stores/GlobalStore.es.js.map +1 -1
  7. package/dist/core/types/localization/InsightsFeedCopy.d.ts +25 -0
  8. package/dist/core/types/localization/index.d.ts +1 -1
  9. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.d.ts +11 -0
  10. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js +132 -0
  11. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js.map +1 -0
  12. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.d.ts +12 -0
  13. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js +124 -0
  14. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js.map +1 -0
  15. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/index.d.ts +1 -0
  16. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/layout.d.ts +26 -0
  17. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/layout.es.js +64 -0
  18. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/layout.es.js.map +1 -0
  19. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/payoff.d.ts +8 -0
  20. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/payoff.es.js +26 -0
  21. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/payoff.es.js.map +1 -0
  22. package/dist/insights-v2/analytics/analyticsEventsConfig.d.ts +12 -0
  23. package/dist/insights-v2/analytics/analyticsEventsConfig.es.js +12 -0
  24. package/dist/insights-v2/analytics/analyticsEventsConfig.es.js.map +1 -1
  25. package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.d.ts +15 -0
  26. package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.es.js +30 -0
  27. package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.es.js.map +1 -0
  28. package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.d.ts +1 -1
  29. package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js +32 -11
  30. package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js.map +1 -1
  31. package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.d.ts +10 -7
  32. package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.es.js +17 -10
  33. package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.es.js.map +1 -1
  34. package/dist/insights-v2/components/CtaStatus.d.ts +19 -0
  35. package/dist/insights-v2/components/CtaStatus.es.js +67 -0
  36. package/dist/insights-v2/components/CtaStatus.es.js.map +1 -0
  37. package/dist/insights-v2/ctaActions/ctaConfig.es.js +21 -6
  38. package/dist/insights-v2/ctaActions/ctaConfig.es.js.map +1 -1
  39. package/dist/insights-v2/ctaActions/ctaPostMessages.es.js +7 -7
  40. package/dist/insights-v2/ctaActions/ctaPostMessages.es.js.map +1 -1
  41. package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -1
  42. package/dist/insights-v2/ctaActions/types.d.ts +1 -1
  43. package/dist/insights-v2/index.es.js +30 -30
  44. package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
  45. package/dist/insights-v2/mappings/actionBlocksKey.es.js +2 -1
  46. package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
  47. package/dist/insights-v2/mappings/blocks.es.js +65 -59
  48. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  49. package/package.json +1 -1
@@ -0,0 +1,64 @@
1
+ import { buildDynamicCopy as i } from "../../../core/utils/Localization.es.js";
2
+ import { calculatePayoff as o } from "./payoff.es.js";
3
+ var s = [
4
+ 0,
5
+ 10,
6
+ 20
7
+ ], u = [
8
+ "balance",
9
+ "interestRate",
10
+ "monthlyPayment"
11
+ ], f = {
12
+ balance: {
13
+ label: "credit_card_balance",
14
+ min: 0.01
15
+ },
16
+ interestRate: {
17
+ label: "interest_rate",
18
+ min: 0,
19
+ max: 100
20
+ },
21
+ monthlyPayment: {
22
+ label: "monthly_payment",
23
+ min: 0.01,
24
+ max: 1e6
25
+ }
26
+ }, b = /^(\d+\.?\d*|\.\d+)$/, y = (e, t, a) => {
27
+ const r = f[e], n = a[r.label], m = t.trim();
28
+ if (!m) return i(a.value_is_required, n);
29
+ if (!b.test(m)) return i(a.value_must_be_a_number, n);
30
+ const _ = Number(m);
31
+ if (_ < r.min) return i(a.value_must_be_greater_than_or_equal_to, n, String(r.min));
32
+ if (r.max !== void 0 && _ > r.max) return i(a.value_must_be_less_than_or_equal_to, n, String(r.max));
33
+ }, R = (e, t) => {
34
+ const a = {};
35
+ for (const r of u) {
36
+ const n = y(r, e[r], t);
37
+ n && (a[r] = n);
38
+ }
39
+ return a;
40
+ }, h = (e, t, a) => s.map((r) => ({
41
+ increment: r,
42
+ monthlyPayment: a + r,
43
+ result: o(e, t, a + r)
44
+ })), p = (e) => ({
45
+ balance: Number(e.balance),
46
+ interestRate: Number(e.interestRate),
47
+ monthlyPayment: Number(e.monthlyPayment)
48
+ }), v = (e) => e.is_manual ? e.interest_rate ?? void 0 : e.apr ?? e.apy ?? e.interest_rate ?? void 0, l = (e) => e ? String(e) : "", N = (e) => ({
49
+ balance: l(e?.balance),
50
+ interestRate: l(e && v(e)),
51
+ monthlyPayment: l(e?.minimum_payment)
52
+ }), E = (e, t) => e.primary_account ?? t.find((a) => a.guid === e.primary_account_guid);
53
+ export {
54
+ s as PAYMENT_INCREMENTS,
55
+ u as PAYOFF_FIELDS,
56
+ h as buildPayoffRows,
57
+ N as initialPayoffInputs,
58
+ v as interestRateOf,
59
+ p as parsePayoffInputs,
60
+ E as resolvePrimaryAccount,
61
+ R as validatePayoffInputs
62
+ };
63
+
64
+ //# sourceMappingURL=layout.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffCalculatorBlock/layout.ts"],"sourcesContent":["import { buildDynamicCopy } from '../../../common'\nimport type { Account, Beat, PayoffCalculatorCopy } from '../../../core'\n\nimport { calculatePayoff, type PayoffResult } from './payoff'\n\n/** The three monthly payments the results compare: the entered one and two small increases. */\nexport const PAYMENT_INCREMENTS = [0, 10, 20] as const\n\nexport type PayoffField = 'balance' | 'interestRate' | 'monthlyPayment'\n\nexport type PayoffInputs = Record<PayoffField, string>\n\nexport type PayoffErrors = Partial<Record<PayoffField, string>>\n\nexport const PAYOFF_FIELDS: readonly PayoffField[] = ['balance', 'interestRate', 'monthlyPayment']\n\ninterface FieldRule {\n label: 'credit_card_balance' | 'interest_rate' | 'monthly_payment'\n min: number\n max?: number\n}\n\nconst RULES: Record<PayoffField, FieldRule> = {\n balance: { label: 'credit_card_balance', min: 0.01 },\n interestRate: { label: 'interest_rate', min: 0, max: 100 },\n monthlyPayment: { label: 'monthly_payment', min: 0.01, max: 1_000_000 },\n}\n\nconst NUMBER_PATTERN = /^(\\d+\\.?\\d*|\\.\\d+)$/\n\nconst fieldError = (\n field: PayoffField,\n value: string,\n copy: PayoffCalculatorCopy,\n): string | undefined => {\n const rule = RULES[field]\n const label = copy[rule.label]\n const trimmed = value.trim()\n\n if (!trimmed) return buildDynamicCopy(copy.value_is_required, label) as string\n if (!NUMBER_PATTERN.test(trimmed))\n return buildDynamicCopy(copy.value_must_be_a_number, label) as string\n\n const amount = Number(trimmed)\n\n if (amount < rule.min) {\n return buildDynamicCopy(\n copy.value_must_be_greater_than_or_equal_to,\n label,\n String(rule.min),\n ) as string\n }\n if (rule.max !== undefined && amount > rule.max) {\n return buildDynamicCopy(\n copy.value_must_be_less_than_or_equal_to,\n label,\n String(rule.max),\n ) as string\n }\n\n return undefined\n}\n\nexport const validatePayoffInputs = (\n inputs: PayoffInputs,\n copy: PayoffCalculatorCopy,\n): PayoffErrors => {\n const errors: PayoffErrors = {}\n\n for (const field of PAYOFF_FIELDS) {\n const error = fieldError(field, inputs[field], copy)\n\n if (error) errors[field] = error\n }\n\n return errors\n}\n\nexport interface PayoffRow {\n /** How much more than the entered payment this row pays each month. */\n increment: number\n monthlyPayment: number\n result: PayoffResult\n}\n\nexport const buildPayoffRows = (\n annualRatePercent: number,\n balance: number,\n payment: number,\n): PayoffRow[] =>\n PAYMENT_INCREMENTS.map((increment) => ({\n increment,\n monthlyPayment: payment + increment,\n result: calculatePayoff(annualRatePercent, balance, payment + increment),\n }))\n\nexport const parsePayoffInputs = (inputs: PayoffInputs) => ({\n balance: Number(inputs.balance),\n interestRate: Number(inputs.interestRate),\n monthlyPayment: Number(inputs.monthlyPayment),\n})\n\n/** Manual accounts carry their rate as `interest_rate`; aggregated ones as APR, else APY. */\nexport const interestRateOf = (account: Account): number | undefined => {\n if (account.is_manual) return account.interest_rate ?? undefined\n\n return account.apr ?? account.apy ?? account.interest_rate ?? undefined\n}\n\n/** A known, non-zero figure as the field's starting text; anything else starts empty. */\nconst toInputValue = (value?: number | null): string => (value ? String(value) : '')\n\nexport const initialPayoffInputs = (account?: Account): PayoffInputs => ({\n balance: toInputValue(account?.balance),\n interestRate: toInputValue(account && interestRateOf(account)),\n monthlyPayment: toInputValue(account?.minimum_payment),\n})\n\n/** The beat's primary account: from the beat when the host attached it, else the loaded accounts. */\nexport const resolvePrimaryAccount = (beat: Beat, accounts: Account[]): Account | undefined =>\n beat.primary_account ?? accounts.find((account) => account.guid === beat.primary_account_guid)\n"],"mappings":";;AAMA,IAAa,IAAqB;AAAA,EAAC;AAAA,EAAG;AAAA,EAAI;AAAE,GAQ/B,IAAwC;AAAA,EAAC;AAAA,EAAW;AAAA,EAAgB;AAAgB,GAQ3F,IAAwC;AAAA,EAC5C,SAAS;AAAA,IAAE,OAAO;AAAA,IAAuB,KAAK;AAAA,EAAK;AAAA,EACnD,cAAc;AAAA,IAAE,OAAO;AAAA,IAAiB,KAAK;AAAA,IAAG,KAAK;AAAA,EAAI;AAAA,EACzD,gBAAgB;AAAA,IAAE,OAAO;AAAA,IAAmB,KAAK;AAAA,IAAM,KAAK;AAAA,EAAU;AACxE,GAEM,IAAiB,uBAEjB,IAAA,CACJ,GACA,GACA,MACuB;AACvB,QAAM,IAAO,EAAM,CAAA,GACb,IAAQ,EAAK,EAAK,KAAA,GAClB,IAAU,EAAM,KAAK;AAE3B,MAAI,CAAC,EAAS,QAAO,EAAiB,EAAK,mBAAmB,CAAK;AACnE,MAAI,CAAC,EAAe,KAAK,CAAO,EAC9B,QAAO,EAAiB,EAAK,wBAAwB,CAAK;AAE5D,QAAM,IAAS,OAAO,CAAO;AAE7B,MAAI,IAAS,EAAK,IAChB,QAAO,EACL,EAAK,wCACL,GACA,OAAO,EAAK,GAAG,CACjB;AAEF,MAAI,EAAK,QAAQ,UAAa,IAAS,EAAK,IAC1C,QAAO,EACL,EAAK,qCACL,GACA,OAAO,EAAK,GAAG,CACjB;AAIJ,GAEa,IAAA,CACX,GACA,MACiB;AACjB,QAAM,IAAuB,CAAC;AAE9B,aAAW,KAAS,GAAe;AACjC,UAAM,IAAQ,EAAW,GAAO,EAAO,CAAA,GAAQ,CAAI;AAEnD,IAAI,MAAO,EAAO,CAAA,IAAS;AAAA,EAC7B;AAEA,SAAO;AACT,GASa,IAAA,CACX,GACA,GACA,MAEA,EAAmB,IAAA,CAAK,OAAe;AAAA,EACrC,WAAA;AAAA,EACA,gBAAgB,IAAU;AAAA,EAC1B,QAAQ,EAAgB,GAAmB,GAAS,IAAU,CAAS;AACzE,EAAE,GAES,IAAA,CAAqB,OAA0B;AAAA,EAC1D,SAAS,OAAO,EAAO,OAAO;AAAA,EAC9B,cAAc,OAAO,EAAO,YAAY;AAAA,EACxC,gBAAgB,OAAO,EAAO,cAAc;AAC9C,IAGa,IAAA,CAAkB,MACzB,EAAQ,YAAkB,EAAQ,iBAAiB,SAEhD,EAAQ,OAAO,EAAQ,OAAO,EAAQ,iBAAiB,QAI1D,IAAA,CAAgB,MAAmC,IAAQ,OAAO,CAAK,IAAI,IAEpE,IAAA,CAAuB,OAAqC;AAAA,EACvE,SAAS,EAAa,GAAS,OAAO;AAAA,EACtC,cAAc,EAAa,KAAW,EAAe,CAAO,CAAC;AAAA,EAC7D,gBAAgB,EAAa,GAAS,eAAe;AACvD,IAGa,IAAA,CAAyB,GAAY,MAChD,EAAK,mBAAmB,EAAS,KAAA,CAAM,MAAY,EAAQ,SAAS,EAAK,oBAAoB"}
@@ -0,0 +1,8 @@
1
+ export interface PayoffResult {
2
+ /** Monthly payments until the balance reaches zero. */
3
+ paymentCount: number;
4
+ totalInterestPaid: number;
5
+ }
6
+ export declare const paymentCountFor: (balance: number, monthlyRate: number, payment: number) => number;
7
+ export declare const isPayoffPossible: (annualRatePercent: number, balance: number, payment: number) => boolean;
8
+ export declare const calculatePayoff: (annualRatePercent: number, balance: number, payment: number) => PayoffResult;
@@ -0,0 +1,26 @@
1
+ var l = 1200, u = (r) => r / 1200, a = (r, o, t) => Math.ceil(o === 0 ? r / t : -Math.log(1 - o * r / t) / Math.log(1 + o)), v = (r, o, t, i) => {
2
+ if (t === 0) return 0;
3
+ let e = 0;
4
+ for (let s = 0; s < r; s += 1) {
5
+ const n = Math.pow(1 + t, s), f = o * n - i * ((n - 1) / t);
6
+ e += f * t;
7
+ }
8
+ return e;
9
+ }, M = (r, o, t) => {
10
+ if (!Number.isFinite(r) || !Number.isFinite(o) || !(t > 0)) return !1;
11
+ const i = a(o, u(r), t);
12
+ return Number.isFinite(i) && i <= l;
13
+ }, c = (r, o, t) => {
14
+ const i = u(r), e = a(o, i, t);
15
+ return {
16
+ paymentCount: e,
17
+ totalInterestPaid: v(e, o, i, t)
18
+ };
19
+ };
20
+ export {
21
+ c as calculatePayoff,
22
+ M as isPayoffPossible,
23
+ a as paymentCountFor
24
+ };
25
+
26
+ //# sourceMappingURL=payoff.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payoff.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffCalculatorBlock/payoff.ts"],"sourcesContent":["const MONTHS_PER_YEAR = 12\n\n/** A payoff further out than this is treated as unreachable (pulse `src/utils/Debt.js`). */\nconst MAX_MONTHS = 100 * MONTHS_PER_YEAR\n\nexport interface PayoffResult {\n /** Monthly payments until the balance reaches zero. */\n paymentCount: number\n totalInterestPaid: number\n}\n\nconst monthlyRateOf = (annualRatePercent: number) => annualRatePercent / (MONTHS_PER_YEAR * 100)\n\n// http://financeformulas.net/Solve-for-Number-of-Periods-PV-and-FV.html\nexport const paymentCountFor = (balance: number, monthlyRate: number, payment: number): number =>\n Math.ceil(\n monthlyRate === 0\n ? balance / payment\n : -Math.log(1 - (monthlyRate * balance) / payment) / Math.log(1 + monthlyRate),\n )\n\nconst totalInterestFor = (\n paymentCount: number,\n balance: number,\n monthlyRate: number,\n payment: number,\n): number => {\n if (monthlyRate === 0) return 0\n\n let total = 0\n\n for (let month = 0; month < paymentCount; month += 1) {\n const growth = Math.pow(1 + monthlyRate, month)\n const openingBalance = balance * growth - payment * ((growth - 1) / monthlyRate)\n\n total += openingBalance * monthlyRate\n }\n\n return total\n}\n\nexport const isPayoffPossible = (\n annualRatePercent: number,\n balance: number,\n payment: number,\n): boolean => {\n if (!Number.isFinite(annualRatePercent) || !Number.isFinite(balance) || !(payment > 0)) {\n return false\n }\n\n const paymentCount = paymentCountFor(balance, monthlyRateOf(annualRatePercent), payment)\n\n return Number.isFinite(paymentCount) && paymentCount <= MAX_MONTHS\n}\n\nexport const calculatePayoff = (\n annualRatePercent: number,\n balance: number,\n payment: number,\n): PayoffResult => {\n const monthlyRate = monthlyRateOf(annualRatePercent)\n const paymentCount = paymentCountFor(balance, monthlyRate, payment)\n\n return {\n paymentCount,\n totalInterestPaid: totalInterestFor(paymentCount, balance, monthlyRate, payment),\n }\n}\n"],"mappings":"AAGA,IAAM,IAAa,MAQb,IAAA,CAAiB,MAA8B,IAAqB,MAG7D,IAAA,CAAmB,GAAiB,GAAqB,MACpE,KAAK,KACH,MAAgB,IACZ,IAAU,IACV,CAAC,KAAK,IAAI,IAAK,IAAc,IAAW,CAAO,IAAI,KAAK,IAAI,IAAI,CAAW,CACjF,GAEI,IAAA,CACJ,GACA,GACA,GACA,MACW;AACX,MAAI,MAAgB,EAAG,QAAO;AAE9B,MAAI,IAAQ;AAEZ,WAAS,IAAQ,GAAG,IAAQ,GAAc,KAAS,GAAG;AACpD,UAAM,IAAS,KAAK,IAAI,IAAI,GAAa,CAAK,GACxC,IAAiB,IAAU,IAAS,MAAY,IAAS,KAAK;AAEpE,IAAA,KAAS,IAAiB;AAAA,EAC5B;AAEA,SAAO;AACT,GAEa,IAAA,CACX,GACA,GACA,MACY;AACZ,MAAI,CAAC,OAAO,SAAS,CAAiB,KAAK,CAAC,OAAO,SAAS,CAAO,KAAK,EAAE,IAAU,GAClF,QAAO;AAGT,QAAM,IAAe,EAAgB,GAAS,EAAc,CAAiB,GAAG,CAAO;AAEvF,SAAO,OAAO,SAAS,CAAY,KAAK,KAAgB;AAC1D,GAEa,IAAA,CACX,GACA,GACA,MACiB;AACjB,QAAM,IAAc,EAAc,CAAiB,GAC7C,IAAe,EAAgB,GAAS,GAAa,CAAO;AAElE,SAAO;AAAA,IACL,cAAA;AAAA,IACA,mBAAmB,EAAiB,GAAc,GAAS,GAAa,CAAO;AAAA,EACjF;AACF"}
@@ -54,6 +54,18 @@ export declare const ANALYTICS_EVENTS_CONFIG: {
54
54
  readonly category: "Safety Net";
55
55
  readonly action: (beat: Beat) => string;
56
56
  };
57
+ readonly EMERGENCY_SAVINGS_ACCT_SELECTED: {
58
+ readonly category: "Emergency Savings";
59
+ readonly action: "Designate Emergency Savings Account Selected";
60
+ };
61
+ readonly EMERGENCY_SAVINGS_ACCT_SAVED: {
62
+ readonly category: "Emergency Savings";
63
+ readonly action: "Designate Emergency Savings Account Saved";
64
+ };
65
+ readonly EMERGENCY_SAVINGS_ACCT_CREATED: {
66
+ readonly category: "Emergency Savings";
67
+ readonly action: "Designate Emergency Savings Account - Savings Account Created";
68
+ };
57
69
  readonly OPENED_CONNECT_DRAWER: {
58
70
  readonly postHog: {
59
71
  readonly eventName: "opened_connect_drawer";
@@ -43,6 +43,18 @@ var t = (e) => e?.replace(/([A-Z]+)/g, " $1")?.replace(/^ /, "") ?? "", a = {
43
43
  category: "Safety Net",
44
44
  action: (e) => `${t(e.template)} = Edit Safety Net - Cancel`
45
45
  },
46
+ EMERGENCY_SAVINGS_ACCT_SELECTED: {
47
+ category: "Emergency Savings",
48
+ action: "Designate Emergency Savings Account Selected"
49
+ },
50
+ EMERGENCY_SAVINGS_ACCT_SAVED: {
51
+ category: "Emergency Savings",
52
+ action: "Designate Emergency Savings Account Saved"
53
+ },
54
+ EMERGENCY_SAVINGS_ACCT_CREATED: {
55
+ category: "Emergency Savings",
56
+ action: "Designate Emergency Savings Account - Savings Account Created"
57
+ },
46
58
  OPENED_CONNECT_DRAWER: { postHog: {
47
59
  eventName: "opened_connect_drawer",
48
60
  properties: (e) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"analyticsEventsConfig.es.js","names":[],"sources":["../../../src/insights-v2/analytics/analyticsEventsConfig.ts"],"sourcesContent":["import type { Beat } from '../../core'\n\n// PascalCase template to label, ported from Pulse.\nexport const sentenceCaseTemplate = (template?: string | null): string =>\n template?.replace(/([A-Z]+)/g, ' $1')?.replace(/^ /, '') ?? ''\n\n// Fixed or beat-computed value.\ntype Resolvable = string | ((beat: Beat) => string)\n\n// Source of truth for insights-v2 analytics events. Mirrors Pulse's strings.\n// Entry has a Firefly half (action/category) and/or a postHog half.\nexport interface AnalyticsEventConfigEntry {\n category?: Resolvable\n action?: Resolvable\n postHog?: {\n eventName: string\n properties?: (beat: Beat) => Record<string, unknown>\n }\n}\n\nexport const ANALYTICS_EVENTS_CONFIG = {\n // Primary/secondary CTA click, fired via sendCtaAnalytics.\n PRIMARY_ACTION_SELECTED: {\n category: 'Beat Interaction',\n action: 'Primary Action Selected',\n },\n SECONDARY_ACTION_SELECTED: {\n category: 'Beat Interaction',\n action: 'Secondary Action Selected',\n },\n // Fires once, gated on !beat.cta_clicked_at.\n FIRST_TIME_PRIMARY_ACTION_SELECTED: {\n category: 'Beat Interaction',\n action: 'First Time Primary Action Selected',\n },\n\n // Bar click on the card's inline chart.\n CHART_BAR_CLICKED: {\n category: 'Beat Chart',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Bar Clicked`,\n },\n // Bar click inside the drill-down drawer.\n DRAWER_CHART_BAR_CLICKED: {\n category: 'Drawer Chart',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Bar Clicked`,\n },\n // Month/tab change inside the drill-down drawer.\n TAB_SELECTED: {\n category: 'Drawer Chart',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Month Tab Selected`,\n },\n\n // LowAccountBalance threshold dialog.\n EDIT_INSIGHT_THRESHOLD_SAVE: {\n category: 'User Configurable Settings',\n action: 'Edit Insight Threshold Save',\n },\n EDIT_INSIGHT_THRESHOLD_CANCELED: {\n category: 'User Configurable Settings',\n action: 'Edit Insight Threshold Canceled',\n },\n EDIT_INSIGHT_THRESHOLD_INPUT_SELECTED: {\n category: 'User Configurable Settings',\n action: 'Edit Insight Threshold Input Selected',\n },\n\n // SavingsOpportunityV2 safety-net dialog.\n EDIT_SAFETY_NET_SAVE: {\n category: 'Safety Net',\n action: 'Edit Safety Net',\n },\n // Ported verbatim from Pulse (uses '=' not '-').\n EDIT_SAFETY_NET_CANCEL: {\n category: 'Safety Net',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} = Edit Safety Net - Cancel`,\n },\n\n // Connect drawer opened. PostHog-only.\n OPENED_CONNECT_DRAWER: {\n postHog: {\n eventName: 'opened_connect_drawer',\n properties: (beat) => ({ beat_guid: beat.guid, template: beat.template }),\n },\n },\n} as const satisfies Record<string, AnalyticsEventConfigEntry>\n"],"mappings":"AAGA,IAAa,IAAA,CAAwB,MACnC,GAAU,QAAQ,aAAa,KAAK,GAAG,QAAQ,MAAM,EAAE,KAAK,IAgBjD,IAA0B;AAAA,EAErC,yBAAyB;AAAA,IACvB,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,2BAA2B;AAAA,IACzB,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAEA,oCAAoC;AAAA,IAClC,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAGA,mBAAmB;AAAA,IACjB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAEA,0BAA0B;AAAA,IACxB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAEA,cAAc;AAAA,IACZ,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAGA,6BAA6B;AAAA,IAC3B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,iCAAiC;AAAA,IAC/B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,uCAAuC;AAAA,IACrC,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAGA,sBAAsB;AAAA,IACpB,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAEA,wBAAwB;AAAA,IACtB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAGA,uBAAuB,EACrB,SAAS;AAAA,IACP,WAAW;AAAA,IACX,YAAA,CAAa,OAAU;AAAA,MAAE,WAAW,EAAK;AAAA,MAAM,UAAU,EAAK;AAAA,IAAS;AAAA,EACzE,EACF;AACF"}
1
+ {"version":3,"file":"analyticsEventsConfig.es.js","names":[],"sources":["../../../src/insights-v2/analytics/analyticsEventsConfig.ts"],"sourcesContent":["import type { Beat } from '../../core'\n\n// PascalCase template to label, ported from Pulse.\nexport const sentenceCaseTemplate = (template?: string | null): string =>\n template?.replace(/([A-Z]+)/g, ' $1')?.replace(/^ /, '') ?? ''\n\n// Fixed or beat-computed value.\ntype Resolvable = string | ((beat: Beat) => string)\n\n// Source of truth for insights-v2 analytics events. Mirrors Pulse's strings.\n// Entry has a Firefly half (action/category) and/or a postHog half.\nexport interface AnalyticsEventConfigEntry {\n category?: Resolvable\n action?: Resolvable\n postHog?: {\n eventName: string\n properties?: (beat: Beat) => Record<string, unknown>\n }\n}\n\nexport const ANALYTICS_EVENTS_CONFIG = {\n // Primary/secondary CTA click, fired via sendCtaAnalytics.\n PRIMARY_ACTION_SELECTED: {\n category: 'Beat Interaction',\n action: 'Primary Action Selected',\n },\n SECONDARY_ACTION_SELECTED: {\n category: 'Beat Interaction',\n action: 'Secondary Action Selected',\n },\n // Fires once, gated on !beat.cta_clicked_at.\n FIRST_TIME_PRIMARY_ACTION_SELECTED: {\n category: 'Beat Interaction',\n action: 'First Time Primary Action Selected',\n },\n\n // Bar click on the card's inline chart.\n CHART_BAR_CLICKED: {\n category: 'Beat Chart',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Bar Clicked`,\n },\n // Bar click inside the drill-down drawer.\n DRAWER_CHART_BAR_CLICKED: {\n category: 'Drawer Chart',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Bar Clicked`,\n },\n // Month/tab change inside the drill-down drawer.\n TAB_SELECTED: {\n category: 'Drawer Chart',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} - Month Tab Selected`,\n },\n\n // LowAccountBalance threshold dialog.\n EDIT_INSIGHT_THRESHOLD_SAVE: {\n category: 'User Configurable Settings',\n action: 'Edit Insight Threshold Save',\n },\n EDIT_INSIGHT_THRESHOLD_CANCELED: {\n category: 'User Configurable Settings',\n action: 'Edit Insight Threshold Canceled',\n },\n EDIT_INSIGHT_THRESHOLD_INPUT_SELECTED: {\n category: 'User Configurable Settings',\n action: 'Edit Insight Threshold Input Selected',\n },\n\n // SavingsOpportunityV2 safety-net dialog.\n EDIT_SAFETY_NET_SAVE: {\n category: 'Safety Net',\n action: 'Edit Safety Net',\n },\n // Ported verbatim from Pulse (uses '=' not '-').\n EDIT_SAFETY_NET_CANCEL: {\n category: 'Safety Net',\n action: (beat) => `${sentenceCaseTemplate(beat.template)} = Edit Safety Net - Cancel`,\n },\n\n // Designate Emergency Savings Account (picker pick, Save, Open a Savings Account). Pulse's strings.\n EMERGENCY_SAVINGS_ACCT_SELECTED: {\n category: 'Emergency Savings',\n action: 'Designate Emergency Savings Account Selected',\n },\n EMERGENCY_SAVINGS_ACCT_SAVED: {\n category: 'Emergency Savings',\n action: 'Designate Emergency Savings Account Saved',\n },\n EMERGENCY_SAVINGS_ACCT_CREATED: {\n category: 'Emergency Savings',\n action: 'Designate Emergency Savings Account - Savings Account Created',\n },\n\n // Connect drawer opened. PostHog-only.\n OPENED_CONNECT_DRAWER: {\n postHog: {\n eventName: 'opened_connect_drawer',\n properties: (beat) => ({ beat_guid: beat.guid, template: beat.template }),\n },\n },\n} as const satisfies Record<string, AnalyticsEventConfigEntry>\n"],"mappings":"AAGA,IAAa,IAAA,CAAwB,MACnC,GAAU,QAAQ,aAAa,KAAK,GAAG,QAAQ,MAAM,EAAE,KAAK,IAgBjD,IAA0B;AAAA,EAErC,yBAAyB;AAAA,IACvB,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,2BAA2B;AAAA,IACzB,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAEA,oCAAoC;AAAA,IAClC,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAGA,mBAAmB;AAAA,IACjB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAEA,0BAA0B;AAAA,IACxB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAEA,cAAc;AAAA,IACZ,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAGA,6BAA6B;AAAA,IAC3B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,iCAAiC;AAAA,IAC/B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,uCAAuC;AAAA,IACrC,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAGA,sBAAsB;AAAA,IACpB,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAEA,wBAAwB;AAAA,IACtB,UAAU;AAAA,IACV,QAAA,CAAS,MAAS,GAAG,EAAqB,EAAK,QAAQ,CAAA;AAAA,EACzD;AAAA,EAGA,iCAAiC;AAAA,IAC/B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,8BAA8B;AAAA,IAC5B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EACA,gCAAgC;AAAA,IAC9B,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AAAA,EAGA,uBAAuB,EACrB,SAAS;AAAA,IACP,WAAW;AAAA,IACX,YAAA,CAAa,OAAU;AAAA,MAAE,WAAW,EAAK;AAAA,MAAM,UAAU,EAAK;AAAA,IAAS;AAAA,EACzE,EACF;AACF"}
@@ -0,0 +1,15 @@
1
+ interface EmergencySavingsAccountPickerProps {
2
+ beatGuid?: string;
3
+ /** The beat's `instance_slot.data` for the `savings_account_picker` variant. */
4
+ data?: Record<string, unknown>;
5
+ }
6
+ /**
7
+ * Designate Emergency Savings Account picker (svg_image_block / savings_account_picker). Lists
8
+ * the user's savings accounts from the account store; the words come from the slot. A pick is
9
+ * only written to the beat's context — the card's "Save" CTA (`select_savings_account`) reads it
10
+ * and makes the API call.
11
+ */
12
+ export declare const EmergencySavingsAccountPicker: (({ beatGuid, data }: EmergencySavingsAccountPickerProps) => import("react/jsx-runtime").JSX.Element | null) & {
13
+ displayName: string;
14
+ };
15
+ export {};
@@ -0,0 +1,30 @@
1
+ import { useAccountStore as p, useInsightsV2Store as u } from "../../../../common/context/hooks.es.js";
2
+ import { ANALYTICS_EVENTS_CONFIG as _ } from "../../../analytics/analyticsEventsConfig.es.js";
3
+ import { useAnalyticsEvent as v } from "../../../analytics/useAnalyticsEvent.es.js";
4
+ import d from "../../../components/DesignateEmergencySavingsCard.es.js";
5
+ import { observer as E } from "mobx-react-lite";
6
+ import { jsx as S } from "react/jsx-runtime";
7
+ var o = (t) => typeof t == "string" ? t : void 0, b = E(({ beatGuid: t, data: n = {} }) => {
8
+ const i = p(), r = u(), l = v();
9
+ if (!t) return null;
10
+ const a = o(r.beatContext[t]?.selected_account_guid), s = i.visibleSavingsAccounts.filter((e) => !e.is_closed && !e.is_deleted).map(({ guid: e, name: m }) => ({
11
+ value: e,
12
+ label: m ?? ""
13
+ })), c = a ?? o(n.emergency_savings_account_guid), g = s.some((e) => e.value === c) ? c ?? "" : "";
14
+ return /* @__PURE__ */ S(d, {
15
+ graphic: null,
16
+ onChange: (e) => {
17
+ r.setBeatContext(t, { selected_account_guid: e }), l(_.EMERGENCY_SAVINGS_ACCT_SELECTED);
18
+ },
19
+ options: s,
20
+ placeholder: o(n.picker_placeholder),
21
+ selectLabel: o(n.picker_label),
22
+ sx: { width: "100%" },
23
+ value: g
24
+ });
25
+ });
26
+ export {
27
+ b as EmergencySavingsAccountPicker
28
+ };
29
+
30
+ //# sourceMappingURL=EmergencySavingsAccountPicker.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmergencySavingsAccountPicker.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport { useAccountStore, useInsightsV2Store } from '../../../../common'\nimport DesignateEmergencySavingsCard from '../../../components/DesignateEmergencySavingsCard'\nimport { ANALYTICS_EVENTS_CONFIG } from '../../../analytics/analyticsEventsConfig'\nimport { useAnalyticsEvent } from '../../../analytics'\n\ninterface EmergencySavingsAccountPickerProps {\n beatGuid?: string\n /** The beat's `instance_slot.data` for the `savings_account_picker` variant. */\n data?: Record<string, unknown>\n}\n\nconst text = (value: unknown) => (typeof value === 'string' ? value : undefined)\n\n/**\n * Designate Emergency Savings Account picker (svg_image_block / savings_account_picker). Lists\n * the user's savings accounts from the account store; the words come from the slot. A pick is\n * only written to the beat's context — the card's \"Save\" CTA (`select_savings_account`) reads it\n * and makes the API call.\n */\nexport const EmergencySavingsAccountPicker = observer(\n ({ beatGuid, data = {} }: EmergencySavingsAccountPickerProps) => {\n const accountStore = useAccountStore()\n const insightsV2Store = useInsightsV2Store()\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n if (!beatGuid) return null\n\n const picked = text(insightsV2Store.beatContext[beatGuid]?.selected_account_guid)\n // Only an account the user can still save into: visible, open and not deleted.\n const options = accountStore.visibleSavingsAccounts\n .filter((account) => !account.is_closed && !account.is_deleted)\n .map(({ guid, name }) => ({ value: guid, label: name ?? '' }))\n\n // The pick, else the designation the slot carries — only when it is among the options, so an\n // account the filter dropped (hidden, closed, deleted) shows the placeholder, not a blank value.\n const candidate = picked ?? text(data.emergency_savings_account_guid)\n const value = options.some((option) => option.value === candidate) ? (candidate ?? '') : ''\n\n const onChange = (guid: string) => {\n insightsV2Store.setBeatContext(beatGuid, { selected_account_guid: guid })\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_SELECTED)\n }\n\n return (\n <DesignateEmergencySavingsCard\n graphic={null}\n onChange={onChange}\n options={options}\n placeholder={text(data.picker_placeholder)}\n selectLabel={text(data.picker_label)}\n sx={{ width: '100%' }}\n value={value}\n />\n )\n },\n)\n"],"mappings":";;;;;;AAaA,IAAM,IAAA,CAAQ,MAAoB,OAAO,KAAU,WAAW,IAAQ,QAQzD,IAAgC,EAAA,CAC1C,EAAE,UAAA,GAAU,MAAA,IAAO,CAAC,EAAA,MAA4C;AAC/D,QAAM,IAAe,EAAgB,GAC/B,IAAkB,EAAmB,GACrC,IAAqB,EAAkB;AAE7C,MAAI,CAAC,EAAU,QAAO;AAEtB,QAAM,IAAS,EAAK,EAAgB,YAAY,CAAA,GAAW,qBAAqB,GAE1E,IAAU,EAAa,uBAC1B,OAAA,CAAQ,MAAY,CAAC,EAAQ,aAAa,CAAC,EAAQ,UAAU,EAC7D,IAAA,CAAK,EAAE,MAAA,GAAM,MAAA,EAAA,OAAY;AAAA,IAAE,OAAO;AAAA,IAAM,OAAO,KAAQ;AAAA,EAAG,EAAE,GAIzD,IAAY,KAAU,EAAK,EAAK,8BAA8B,GAC9D,IAAQ,EAAQ,KAAA,CAAM,MAAW,EAAO,UAAU,CAAS,IAAK,KAAa,KAAM;AAOzF,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,SAAS;AAAA,IACC,UARR,CAAY,MAAiB;AACjC,MAAA,EAAgB,eAAe,GAAU,EAAE,uBAAuB,EAAK,CAAC,GACxE,EAAmB,EAAwB,+BAA+B;AAAA,IAC5E;AAAA,IAMa,SAAA;AAAA,IACT,aAAa,EAAK,EAAK,kBAAkB;AAAA,IACzC,aAAa,EAAK,EAAK,YAAY;AAAA,IACnC,IAAI,EAAE,OAAO,OAAO;AAAA,IACb,OAAA;AAAA,EACR,CAAA;AAEL,CACF"}
@@ -1,3 +1,3 @@
1
1
  import { BlockProps } from '../../types';
2
2
  import { SVGImageBlockData } from '../../../../core/types/InsightsInstanceSlotData';
3
- export declare const SVGImageBlock: ({ payload: { instance_slot, instance_slot_data, widget_type }, }: BlockProps<SVGImageBlockData>) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const SVGImageBlock: ({ payload: { instance_slot, instance_slot_data, widget_type }, beatGuid, }: BlockProps<SVGImageBlockData>) => import("react/jsx-runtime").JSX.Element;
@@ -1,20 +1,41 @@
1
- import { ThemedSVGImage as n } from "../../../components/chartblocks/ThemedSVGImage.es.js";
2
- import { getLayoutConfig as g } from "./layout.es.js";
1
+ import { ThemedSVGImage as f } from "../../../components/chartblocks/ThemedSVGImage.es.js";
2
+ import { resolveVariantConfig as p } from "../../resolveVariantConfig.es.js";
3
+ import { getLayoutConfig as d } from "./layout.es.js";
4
+ import { CtaStatus as v } from "../../../components/CtaStatus.es.js";
5
+ import { EmergencySavingsAccountPicker as h } from "./EmergencySavingsAccountPicker.es.js";
3
6
  import s from "@mui/material/Stack";
4
- import { jsx as i } from "react/jsx-runtime";
5
- var d = ({ payload: { instance_slot: o, instance_slot_data: t, widget_type: m } }) => {
6
- const r = m === "mini", { variant: a } = o, e = g(a, t?.isCIBC);
7
- return /* @__PURE__ */ i(s, {
7
+ import { jsx as o, jsxs as u } from "react/jsx-runtime";
8
+ var V = ({ payload: { instance_slot: m, instance_slot_data: n, widget_type: t }, beatGuid: c }) => {
9
+ const l = t === "mini", a = t === "full", { variant: g, data: e } = m, i = p(d(n?.isCIBC), g, "savings", "SVGImageBlock"), r = typeof e?.saved_label == "string" ? e.saved_label.trim() : "";
10
+ return /* @__PURE__ */ u(s, {
8
11
  alignItems: "center",
9
12
  sx: { width: "100%" },
10
- children: /* @__PURE__ */ i(n, {
11
- image: e.image,
12
- isMini: r
13
- })
13
+ children: [
14
+ /* @__PURE__ */ o(f, {
15
+ image: i.image,
16
+ isMini: l
17
+ }),
18
+ i.showPicker && a && /* @__PURE__ */ o(h, {
19
+ beatGuid: c,
20
+ data: e
21
+ }),
22
+ i.showSavedLabel && a && r && /* @__PURE__ */ o(s, {
23
+ sx: {
24
+ pt: 24,
25
+ px: 16,
26
+ width: "100%"
27
+ },
28
+ children: /* @__PURE__ */ o(v, {
29
+ icon: "check_circle",
30
+ label: r,
31
+ tone: "success"
32
+ })
33
+ })
34
+ ]
14
35
  });
15
36
  };
16
37
  export {
17
- d as SVGImageBlock
38
+ V as SVGImageBlock
18
39
  };
19
40
 
20
41
  //# sourceMappingURL=SVGImageBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SVGImageBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.tsx"],"sourcesContent":["import { BlockProps } from '../../types'\nimport Stack from '@mui/material/Stack'\nimport { getLayoutConfig } from './layout'\n\nimport type { SVGImageBlockData } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport { ThemedSVGImage } from '../../../components/chartblocks/ThemedSVGImage'\n\nexport const SVGImageBlock = ({\n payload: { instance_slot, instance_slot_data, widget_type },\n}: BlockProps<SVGImageBlockData>) => {\n const isMini = widget_type === 'mini'\n const { variant } = instance_slot\n const layoutConfig = getLayoutConfig(variant, instance_slot_data?.isCIBC)\n\n // TODO : Add Designate Emergency Savings Account dropdown, post discussion with BE design.\n return (\n <Stack alignItems=\"center\" sx={{ width: '100%' }}>\n <ThemedSVGImage image={layoutConfig.image} isMini={isMini} />\n </Stack>\n )\n}\n"],"mappings":";;;;AAQA,IAAa,IAAA,CAAiB,EAC5B,SAAS,EAAE,eAAA,GAAe,oBAAA,GAAoB,aAAA,EAAA,EAAA,MACX;AACnC,QAAM,IAAS,MAAgB,QACzB,EAAE,SAAA,EAAA,IAAY,GACd,IAAe,EAAgB,GAAS,GAAoB,MAAM;AAGxE,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,YAAW;AAAA,IAAS,IAAI,EAAE,OAAO,OAAO;AAAA,IAC7C,UAAA,gBAAA,EAAC,GAAD;AAAA,MAAgB,OAAO,EAAa;AAAA,MAAe,QAAA;AAAA,IAAS,CAAA;AAAA,EACvD,CAAA;AAEX"}
1
+ {"version":3,"file":"SVGImageBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { BlockProps } from '../../types'\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { getLayoutConfig } from './layout'\n\nimport type { SVGImageBlockData } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport { ThemedSVGImage } from '../../../components/chartblocks/ThemedSVGImage'\nimport { CtaStatus } from '../../../components/CtaStatus'\nimport { EmergencySavingsAccountPicker } from './EmergencySavingsAccountPicker'\n\nexport const SVGImageBlock = ({\n payload: { instance_slot, instance_slot_data, widget_type },\n beatGuid,\n}: BlockProps<SVGImageBlockData>) => {\n const isMini = widget_type === 'mini'\n const isFull = widget_type === 'full'\n const { variant, data } = instance_slot\n // An unknown variant (drift with ditto) warns and draws the plain illustration.\n const layoutConfig = resolveVariantConfig(\n getLayoutConfig(instance_slot_data?.isCIBC),\n variant,\n 'savings',\n 'SVGImageBlock',\n )\n\n const savedLabel = typeof data?.saved_label === 'string' ? data.saved_label.trim() : ''\n\n return (\n <Stack alignItems=\"center\" sx={{ width: '100%' }}>\n <ThemedSVGImage image={layoutConfig.image} isMini={isMini} />\n {layoutConfig.showPicker && isFull && (\n <EmergencySavingsAccountPicker beatGuid={beatGuid} data={data} />\n )}\n {layoutConfig.showSavedLabel &&\n isFull &&\n savedLabel && (\n // Figma 1943:219096: the saved status sits in the card body, under the illustration.\n <Stack sx={{ pt: 24, px: 16, width: '100%' }}>\n <CtaStatus icon=\"check_circle\" label={savedLabel} tone=\"success\" />\n </Stack>\n )}\n </Stack>\n )\n}\n"],"mappings":";;;;;;;AAYA,IAAa,IAAA,CAAiB,EAC5B,SAAS,EAAE,eAAA,GAAe,oBAAA,GAAoB,aAAA,EAAA,GAC9C,UAAA,EAAA,MACmC;AACnC,QAAM,IAAS,MAAgB,QACzB,IAAS,MAAgB,QACzB,EAAE,SAAA,GAAS,MAAA,EAAA,IAAS,GAEpB,IAAe,EACnB,EAAgB,GAAoB,MAAM,GAC1C,GACA,WACA,eACF,GAEM,IAAa,OAAO,GAAM,eAAgB,WAAW,EAAK,YAAY,KAAK,IAAI;AAErF,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,YAAW;AAAA,IAAS,IAAI,EAAE,OAAO,OAAO;AAAA,IAA/C,UAAA;AAAA,MACE,gBAAA,EAAC,GAAD;AAAA,QAAgB,OAAO,EAAa;AAAA,QAAe,QAAA;AAAA,MAAS,CAAA;AAAA,MAC3D,EAAa,cAAc,KAC1B,gBAAA,EAAC,GAAD;AAAA,QAAyC,UAAA;AAAA,QAAgB,MAAA;AAAA,MAAO,CAAA;AAAA,MAEjE,EAAa,kBACZ,KACA,KAEE,gBAAA,EAAC,GAAD;AAAA,QAAO,IAAI;AAAA,UAAE,IAAI;AAAA,UAAI,IAAI;AAAA,UAAI,OAAO;AAAA,QAAO;AAAA,QACzC,UAAA,gBAAA,EAAC,GAAD;AAAA,UAAW,MAAK;AAAA,UAAe,OAAO;AAAA,UAAY,MAAK;AAAA,QAAW,CAAA;AAAA,MAC7D,CAAA;AAAA,IAEN;AAAA;AAEX"}
@@ -1,7 +1,10 @@
1
- export declare const getLayoutConfig: (variant?: string | null, isCibc?: boolean) => {
2
- image: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
3
- } | {
4
- image: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
5
- } | {
6
- image: import('react').FunctionComponent<import('react').SVGProps<SVGSVGElement>>;
7
- };
1
+ export interface SVGImageLayoutConfig {
2
+ image: React.FC<React.SVGProps<SVGSVGElement>>;
3
+ /** Draw the savings-account picker under the image (full card only). */
4
+ showPicker?: boolean;
5
+ /** Draw the slot's `saved_label` as a status under the image (full card only). */
6
+ showSavedLabel?: boolean;
7
+ }
8
+ export type SVGImageVariant = 'Holiday' | 'Reminder' | 'savings' | 'savings_account_picker' | 'savings_account_saved';
9
+ /** Variant table for resolveVariantConfig; `isCibc` picks the CIBC art where a variant has one. */
10
+ export declare const getLayoutConfig: (isCibc?: boolean) => Record<SVGImageVariant, SVGImageLayoutConfig>;
@@ -1,15 +1,22 @@
1
- import { ReactComponent as e } from "./images/UpcomingTaxDeadlineAlert.es.js";
2
- import { ReactComponent as a } from "./images/UpcomingTaxDeadlineAlertCIBC.es.js";
3
- import { ReactComponent as m } from "./images/FederalBankHoliday.es.js";
4
- import { ReactComponent as t } from "./images/FederalBankHolidayCibc.es.js";
1
+ import { ReactComponent as o } from "./images/UpcomingTaxDeadlineAlert.es.js";
2
+ import { ReactComponent as r } from "./images/UpcomingTaxDeadlineAlertCIBC.es.js";
3
+ import { ReactComponent as t } from "./images/FederalBankHoliday.es.js";
4
+ import { ReactComponent as m } from "./images/FederalBankHolidayCibc.es.js";
5
5
  import { ReactComponent as n } from "./images/DesignateEmergencySavingsAccount.es.js";
6
- var g = (r, o = !1) => ({
7
- Holiday: { image: o ? t : m },
8
- Reminder: { image: o ? a : e },
9
- Savings: { image: n }
10
- })[r];
6
+ var a = (e = {}) => ({
7
+ image: n,
8
+ showPicker: !1,
9
+ showSavedLabel: !1,
10
+ ...e
11
+ }), R = (e = !1) => ({
12
+ Holiday: { image: e ? m : t },
13
+ Reminder: { image: e ? r : o },
14
+ savings: a(),
15
+ savings_account_picker: a({ showPicker: !0 }),
16
+ savings_account_saved: a({ showSavedLabel: !0 })
17
+ });
11
18
  export {
12
- g as getLayoutConfig
19
+ R as getLayoutConfig
13
20
  };
14
21
 
15
22
  //# sourceMappingURL=layout.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.ts"],"sourcesContent":["// SVGs to be moved to S3 and imported from there.\nimport { ReactComponent as UpcomingTaxDeadline } from './images/UpcomingTaxDeadlineAlert.svg'\nimport { ReactComponent as UpcomingTaxDeadlineCIBC } from './images/UpcomingTaxDeadlineAlertCIBC.svg'\n\nimport { ReactComponent as FederalBankHoliday } from './images/FederalBankHoliday.svg'\nimport { ReactComponent as FederalBankHolidayCIBC } from './images/FederalBankHolidayCibc.svg'\n\nimport { ReactComponent as DesignateEmergencySavingsAccount } from './images/DesignateEmergencySavingsAccount.svg'\n\nexport const getLayoutConfig = (variant?: string | null, isCibc: boolean = false) => {\n const config = {\n Holiday: {\n image: isCibc ? FederalBankHolidayCIBC : FederalBankHoliday,\n },\n Reminder: {\n image: isCibc ? UpcomingTaxDeadlineCIBC : UpcomingTaxDeadline,\n },\n Savings: {\n image: DesignateEmergencySavingsAccount,\n },\n }\n return config[variant as keyof typeof config]\n}\n"],"mappings":";;;;;AASA,IAAa,IAAA,CAAmB,GAAyB,IAAkB,QAYlE;AAAA,EAVL,SAAS,EACP,OAAO,IAAS,IAAyB,EAC3C;AAAA,EACA,UAAU,EACR,OAAO,IAAS,IAA0B,EAC5C;AAAA,EACA,SAAS,EACP,OAAO,EACT;AAEK,GAAO,CAAA"}
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ImageBlocks/SVGImageBlock/layout.ts"],"sourcesContent":["// SVGs to be moved to S3 and imported from there.\nimport { ReactComponent as UpcomingTaxDeadline } from './images/UpcomingTaxDeadlineAlert.svg'\nimport { ReactComponent as UpcomingTaxDeadlineCIBC } from './images/UpcomingTaxDeadlineAlertCIBC.svg'\n\nimport { ReactComponent as FederalBankHoliday } from './images/FederalBankHoliday.svg'\nimport { ReactComponent as FederalBankHolidayCIBC } from './images/FederalBankHolidayCibc.svg'\n\nimport { ReactComponent as DesignateEmergencySavingsAccount } from './images/DesignateEmergencySavingsAccount.svg'\n\nexport interface SVGImageLayoutConfig {\n image: React.FC<React.SVGProps<SVGSVGElement>>\n /** Draw the savings-account picker under the image (full card only). */\n showPicker?: boolean\n /** Draw the slot's `saved_label` as a status under the image (full card only). */\n showSavedLabel?: boolean\n}\n\n// Designate Emergency Savings Account (ditto layout variants): the illustration alone (open_account),\n// with the account picker (choose_account), or with the \"Account Saved!\" status in the card body\n// (change_account, the card the beat refreshes into after Save; Figma 1943:219096).\nconst emergencySavings = (overrides: Partial<SVGImageLayoutConfig> = {}): SVGImageLayoutConfig => ({\n image: DesignateEmergencySavingsAccount,\n showPicker: false,\n showSavedLabel: false,\n ...overrides,\n})\n\nexport type SVGImageVariant =\n | 'Holiday'\n | 'Reminder'\n | 'savings'\n | 'savings_account_picker'\n | 'savings_account_saved'\n\n/** Variant table for resolveVariantConfig; `isCibc` picks the CIBC art where a variant has one. */\nexport const getLayoutConfig = (\n isCibc: boolean = false,\n): Record<SVGImageVariant, SVGImageLayoutConfig> => ({\n Holiday: {\n image: isCibc ? FederalBankHolidayCIBC : FederalBankHoliday,\n },\n Reminder: {\n image: isCibc ? UpcomingTaxDeadlineCIBC : UpcomingTaxDeadline,\n },\n savings: emergencySavings(),\n savings_account_picker: emergencySavings({ showPicker: true }),\n savings_account_saved: emergencySavings({ showSavedLabel: true }),\n})\n"],"mappings":";;;;;AAoBA,IAAM,IAAA,CAAoB,IAA2C,CAAC,OAA6B;AAAA,EACjG,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,GAAG;AACL,IAUa,IAAA,CACX,IAAkB,QACiC;AAAA,EACnD,SAAS,EACP,OAAO,IAAS,IAAyB,EAC3C;AAAA,EACA,UAAU,EACR,OAAO,IAAS,IAA0B,EAC5C;AAAA,EACA,SAAS,EAAiB;AAAA,EAC1B,wBAAwB,EAAiB,EAAE,YAAY,GAAK,CAAC;AAAA,EAC7D,uBAAuB,EAAiB,EAAE,gBAAgB,GAAK,CAAC;AAClE"}
@@ -0,0 +1,19 @@
1
+ export type CtaStatusTone = 'success' | 'neutral' | 'error';
2
+ export interface CtaStatusProps {
3
+ /** The words, from the backend (copy or a slot) so they stay localized and customizable. */
4
+ label: string;
5
+ /** Background, border, icon and text colours. */
6
+ tone: CtaStatusTone;
7
+ /** mx-icons name, drawn filled and hidden from assistive technology. */
8
+ icon?: string;
9
+ /** An inline button inside the status (e.g. Subscription Detected's "Undo"). */
10
+ action?: {
11
+ label: string;
12
+ onPress: () => void;
13
+ };
14
+ }
15
+ /**
16
+ * A CTA slot's status: what the slot shows once its action is done, instead of a button. Not a
17
+ * control itself (`role="status"`); only the optional inline `action` is pressable.
18
+ */
19
+ export declare const CtaStatus: ({ label, tone, icon, action }: CtaStatusProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,67 @@
1
+ import i from "@mui/material/Stack";
2
+ import { Text as n } from "@mxenabled/mxui";
3
+ import c from "@mui/material/Button";
4
+ import { Icon as m } from "@mxenabled/mx-icons";
5
+ import { jsx as t, jsxs as s } from "react/jsx-runtime";
6
+ var d = {
7
+ success: {
8
+ main: "success.main",
9
+ fill: "success.lighter",
10
+ text: "success.dark"
11
+ },
12
+ neutral: {
13
+ main: "text.secondary",
14
+ fill: "background.default",
15
+ text: "text.primary"
16
+ },
17
+ error: {
18
+ main: "error.main",
19
+ fill: "error.lighter",
20
+ text: "error.dark"
21
+ }
22
+ }, g = ({ label: l, tone: a, icon: o, action: e }) => {
23
+ const r = d[a];
24
+ return /* @__PURE__ */ s(i, {
25
+ alignItems: "center",
26
+ direction: "row",
27
+ gap: 8,
28
+ justifyContent: e ? "space-between" : "center",
29
+ sx: {
30
+ bgcolor: r.fill,
31
+ border: "1px solid",
32
+ borderColor: r.main,
33
+ borderRadius: 1,
34
+ minHeight: 44,
35
+ px: 16,
36
+ py: 8
37
+ },
38
+ children: [/* @__PURE__ */ s(i, {
39
+ alignItems: "center",
40
+ direction: "row",
41
+ gap: 8,
42
+ role: "status",
43
+ children: [o && /* @__PURE__ */ t(m, {
44
+ "aria-hidden": !0,
45
+ fill: !0,
46
+ name: o,
47
+ size: 24,
48
+ sx: { color: r.main }
49
+ }), /* @__PURE__ */ t(n, {
50
+ bold: !0,
51
+ sx: { color: r.text },
52
+ variant: "body1",
53
+ children: l
54
+ })]
55
+ }), e && /* @__PURE__ */ t(c, {
56
+ onClick: e.onPress,
57
+ size: "small",
58
+ sx: { color: r.text },
59
+ children: e.label
60
+ })]
61
+ });
62
+ };
63
+ export {
64
+ g as CtaStatus
65
+ };
66
+
67
+ //# sourceMappingURL=CtaStatus.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CtaStatus.es.js","names":[],"sources":["../../../src/insights-v2/components/CtaStatus.tsx"],"sourcesContent":["import Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nexport type CtaStatusTone = 'success' | 'neutral' | 'error'\n\nexport interface CtaStatusProps {\n /** The words, from the backend (copy or a slot) so they stay localized and customizable. */\n label: string\n /** Background, border, icon and text colours. */\n tone: CtaStatusTone\n /** mx-icons name, drawn filled and hidden from assistive technology. */\n icon?: string\n /** An inline button inside the status (e.g. Subscription Detected's \"Undo\"). */\n action?: { label: string; onPress: () => void }\n}\n\n// Figma: the \"after the press\" bar drawn in a CTA's place (Designate's \"Account Saved!\",\n// Subscription Detected's \"Confirmed / Undo\"). Button-sized, outlined, tinted fill.\nconst TONE_COLORS: Record<CtaStatusTone, { main: string; fill: string; text: string }> = {\n success: { main: 'success.main', fill: 'success.lighter', text: 'success.dark' },\n neutral: { main: 'text.secondary', fill: 'background.default', text: 'text.primary' },\n error: { main: 'error.main', fill: 'error.lighter', text: 'error.dark' },\n}\n\n/**\n * A CTA slot's status: what the slot shows once its action is done, instead of a button. Not a\n * control itself (`role=\"status\"`); only the optional inline `action` is pressable.\n */\nexport const CtaStatus = ({ label, tone, icon, action }: CtaStatusProps) => {\n const colors = TONE_COLORS[tone]\n\n return (\n <Stack\n alignItems=\"center\"\n direction=\"row\"\n gap={8}\n justifyContent={action ? 'space-between' : 'center'}\n sx={{\n bgcolor: colors.fill,\n border: '1px solid',\n borderColor: colors.main,\n borderRadius: 1,\n minHeight: 44,\n px: 16,\n py: 8,\n }}\n >\n <Stack alignItems=\"center\" direction=\"row\" gap={8} role=\"status\">\n {icon && (\n <Icon aria-hidden={true} fill={true} name={icon} size={24} sx={{ color: colors.main }} />\n )}\n <Text bold={true} sx={{ color: colors.text }} variant=\"body1\">\n {label}\n </Text>\n </Stack>\n {action && (\n <Button onClick={action.onPress} size=\"small\" sx={{ color: colors.text }}>\n {action.label}\n </Button>\n )}\n </Stack>\n )\n}\n"],"mappings":";;;;;AAqBA,IAAM,IAAmF;AAAA,EACvF,SAAS;AAAA,IAAE,MAAM;AAAA,IAAgB,MAAM;AAAA,IAAmB,MAAM;AAAA,EAAe;AAAA,EAC/E,SAAS;AAAA,IAAE,MAAM;AAAA,IAAkB,MAAM;AAAA,IAAsB,MAAM;AAAA,EAAe;AAAA,EACpF,OAAO;AAAA,IAAE,MAAM;AAAA,IAAc,MAAM;AAAA,IAAiB,MAAM;AAAA,EAAa;AACzE,GAMa,IAAA,CAAa,EAAE,OAAA,GAAO,MAAA,GAAM,MAAA,GAAM,QAAA,EAAA,MAA6B;AAC1E,QAAM,IAAS,EAAY,CAAA;AAE3B,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,YAAW;AAAA,IACX,WAAU;AAAA,IACV,KAAK;AAAA,IACL,gBAAgB,IAAS,kBAAkB;AAAA,IAC3C,IAAI;AAAA,MACF,SAAS,EAAO;AAAA,MAChB,QAAQ;AAAA,MACR,aAAa,EAAO;AAAA,MACpB,cAAc;AAAA,MACd,WAAW;AAAA,MACX,IAAI;AAAA,MACJ,IAAI;AAAA,IACN;AAAA,IAbF,UAAA,CAeE,gBAAA,EAAC,GAAD;AAAA,MAAO,YAAW;AAAA,MAAS,WAAU;AAAA,MAAM,KAAK;AAAA,MAAG,MAAK;AAAA,MAAxD,UAAA,CACG,KACC,gBAAA,EAAC,GAAD;AAAA,QAAM,eAAa;AAAA,QAAM,MAAM;AAAA,QAAM,MAAM;AAAA,QAAM,MAAM;AAAA,QAAI,IAAI,EAAE,OAAO,EAAO,KAAK;AAAA,MAAI,CAAA,GAE1F,gBAAA,EAAC,GAAD;AAAA,QAAM,MAAM;AAAA,QAAM,IAAI,EAAE,OAAO,EAAO,KAAK;AAAA,QAAG,SAAQ;AAAA,QACnD,UAAA;AAAA,MACG,CAAA,CACD;AAAA,IACN,CAAA,GAAA,KACC,gBAAA,EAAC,GAAD;AAAA,MAAQ,SAAS,EAAO;AAAA,MAAS,MAAK;AAAA,MAAQ,IAAI,EAAE,OAAO,EAAO,KAAK;AAAA,MACpE,UAAA,EAAO;AAAA,IACF,CAAA,CAEL;AAAA;AAEX"}
@@ -1,10 +1,25 @@
1
- import { HOST_ACTIONS as s } from "./hostActions.es.js";
2
- var o = { dismiss_beat: {
3
- run: "delegateToHost",
4
- params: { hostAction: s.dismissBeat }
5
- } };
1
+ import { ANALYTICS_EVENTS_CONFIG as n } from "../analytics/analyticsEventsConfig.es.js";
2
+ import { HOST_ACTIONS as o } from "./hostActions.es.js";
3
+ var a = ({ beat: e, stores: t }) => {
4
+ const s = t.insightsV2Store.beatContext[e.guid]?.selected_account_guid;
5
+ if (typeof s == "string")
6
+ return t.accountStore.visibleSavingsAccounts.some((i) => i.guid === s && !i.is_closed && !i.is_deleted) ? s : void 0;
7
+ }, _ = {
8
+ dismiss_beat: {
9
+ run: "delegateToHost",
10
+ params: { hostAction: o.dismissBeat }
11
+ },
12
+ select_savings_account: {
13
+ run: "updateUserInsightProfile",
14
+ params: (e) => ({ fields: { emergency_savings_account_guid: a(e) } }),
15
+ disabledWhen: (e) => !a(e),
16
+ onSuccess: ["refreshBeat"],
17
+ analytics: n.EMERGENCY_SAVINGS_ACCT_SAVED
18
+ },
19
+ open_savings_account: { analytics: n.EMERGENCY_SAVINGS_ACCT_CREATED }
20
+ };
6
21
  export {
7
- o as ctaActions
22
+ _ as ctaActions
8
23
  };
9
24
 
10
25
  //# sourceMappingURL=ctaConfig.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ctaConfig.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaConfig.ts"],"sourcesContent":["import { HOST_ACTIONS } from './hostActions'\nimport type { CtaStep } from './types'\n\n/**\n * Steps keyed by the backend-named `cta.action_key` (ditto `*_cta_action`, via tupac). No key or\n * an unknown key = default: open the CTA's block drawer, if any. Its post message, when one\n * resolves (`cta.metadata` / `ctaPostMessages`), is sent either way. A new key is registered in\n * ditto and here in the same change; most CTAs need none. See README.md.\n */\nexport const ctaActions: Record<string, CtaStep> = {\n /** ConnectDiscoveredAccounts \"I don't have any\": dismiss through the host, then stop. */\n dismiss_beat: {\n run: 'delegateToHost',\n params: { hostAction: HOST_ACTIONS.dismissBeat },\n },\n}\n"],"mappings":";AASA,IAAa,IAAsC,EAEjD,cAAc;AAAA,EACZ,KAAK;AAAA,EACL,QAAQ,EAAE,YAAY,EAAa,YAAY;AACjD,EACF"}
1
+ {"version":3,"file":"ctaConfig.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaConfig.ts"],"sourcesContent":["import { ANALYTICS_EVENTS_CONFIG } from '../analytics/analyticsEventsConfig'\nimport { HOST_ACTIONS } from './hostActions'\nimport type { CtaStateContext, CtaStep } from './types'\n\n/**\n * The account the svg_image_block picker wrote into this beat's context, and only while it is\n * still one the user can save into (visible, open, not deleted) — a pick that went stale between\n * pick and Save never reaches the API.\n */\nconst pickedSavingsAccountGuid = ({ beat, stores }: Pick<CtaStateContext, 'beat' | 'stores'>) => {\n const picked = stores.insightsV2Store.beatContext[beat.guid]?.selected_account_guid\n\n if (typeof picked !== 'string') return undefined\n\n const usable = stores.accountStore.visibleSavingsAccounts.some(\n (account) => account.guid === picked && !account.is_closed && !account.is_deleted,\n )\n\n return usable ? picked : undefined\n}\n\n/**\n * Steps keyed by the backend-named `cta.action_key` (ditto `*_cta_action`, via tupac). No key or\n * an unknown key = default: open the CTA's block drawer, if any. Its post message, when one\n * resolves (`cta.metadata` / `ctaPostMessages`), is sent either way. A new key is registered in\n * ditto and here in the same change; most CTAs need none. See README.md.\n */\nexport const ctaActions: Record<string, CtaStep> = {\n /** ConnectDiscoveredAccounts \"I don't have any\": dismiss through the host, then stop. */\n dismiss_beat: {\n run: 'delegateToHost',\n params: { hostAction: HOST_ACTIONS.dismissBeat },\n },\n\n /**\n * Designate Emergency Savings Account \"Save\": designates the account picked in the\n * svg_image_block picker (kept in the per-beat context), then refreshes the beat. The beat is\n * sampled, so the refresh re-reads its sample, which the backend rebuilds as the saved card\n * (change_account: \"Account Saved!\", no CTA). Disabled until a pick is made.\n */\n select_savings_account: {\n run: 'updateUserInsightProfile',\n params: (ctx) => ({\n fields: { emergency_savings_account_guid: pickedSavingsAccountGuid(ctx) },\n }),\n disabledWhen: (ctx) => !pickedSavingsAccountGuid(ctx),\n onSuccess: ['refreshBeat'],\n analytics: ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_SAVED,\n },\n\n /**\n * Designate Emergency Savings Account \"Open a Savings Account\": no handler. The op_1 post\n * message comes from `ctaPostMessages`; this step adds the Created event.\n */\n open_savings_account: {\n analytics: ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_CREATED,\n },\n}\n"],"mappings":";;AASA,IAAM,IAAA,CAA4B,EAAE,MAAA,GAAM,QAAA,EAAA,MAAuD;AAC/F,QAAM,IAAS,EAAO,gBAAgB,YAAY,EAAK,IAAA,GAAO;AAE9D,MAAI,OAAO,KAAW;AAMtB,WAJe,EAAO,aAAa,uBAAuB,KAAA,CACvD,MAAY,EAAQ,SAAS,KAAU,CAAC,EAAQ,aAAa,CAAC,EAAQ,UAGlE,IAAS,IAAS;AAC3B,GAQa,IAAsC;AAAA,EAEjD,cAAc;AAAA,IACZ,KAAK;AAAA,IACL,QAAQ,EAAE,YAAY,EAAa,YAAY;AAAA,EACjD;AAAA,EAQA,wBAAwB;AAAA,IACtB,KAAK;AAAA,IACL,QAAA,CAAS,OAAS,EAChB,QAAQ,EAAE,gCAAgC,EAAyB,CAAG,EAAE,EAC1E;AAAA,IACA,cAAA,CAAe,MAAQ,CAAC,EAAyB,CAAG;AAAA,IACpD,WAAW,CAAC,aAAa;AAAA,IACzB,WAAW,EAAwB;AAAA,EACrC;AAAA,EAMA,sBAAsB,EACpB,WAAW,EAAwB,+BACrC;AACF"}
@@ -1,9 +1,9 @@
1
- import { AccountType as s } from "../../core/types/Account.es.js";
1
+ import { AccountType as u } from "../../core/types/Account.es.js";
2
2
  import { BEAT_OPERATION_1 as n, BEAT_OPERATION_2 as l } from "../../common/utils/PostMessage.es.js";
3
3
  var c = (a) => !a.is_hidden && !a.is_deleted && !a.is_closed, e = ({ beat: a, stores: t }) => a.primary_account ?? t.accountStore.accounts.find((o) => o.guid === a.primary_account_guid), d = ({ beat: a, stores: t }) => {
4
4
  const o = new Set(a.account_guids);
5
5
  return t.accountStore.accounts.filter((r) => o.has(r.guid) && c(r));
6
- }, _ = ({ stores: a }) => a.accountStore.accounts.filter((t) => t.account_type === s.SAVINGS && c(t)), i = { primary: () => ({ action: n }) }, g = {
6
+ }, _ = ({ stores: a }) => a.accountStore.accounts.filter((t) => t.account_type === u.SAVINGS && c(t)), i = { primary: () => ({ action: n }) }, p = {
7
7
  SaveAnExtra100Dollars: i,
8
8
  SaveAnExtra100DollarsV2: i,
9
9
  PaydayCashLeftOverStatus: { primary: () => ({ action: n }) },
@@ -16,7 +16,7 @@ var c = (a) => !a.is_hidden && !a.is_deleted && !a.is_closed, e = ({ beat: a, st
16
16
  } : null;
17
17
  } },
18
18
  MonthlyObligationsStatus: { primary: ({ beat: a }) => (a.payload?.total_remaining ?? 0) < 0 ? { action: n } : null },
19
- DesignateEmergencySavingsAccount: { primary: ({ beat: a }) => !a.payload?.emergency_savings_account_guid && !a.account_guids.length ? { action: n } : null },
19
+ DesignateEmergencySavingsAccount: { primary: ({ cta: a }) => a.action_key === "open_savings_account" ? { action: n } : null },
20
20
  ReplenishSavings: { primary: (a) => ({
21
21
  action: n,
22
22
  payload: {
@@ -38,17 +38,17 @@ var c = (a) => !a.is_hidden && !a.is_deleted && !a.is_closed, e = ({ beat: a, st
38
38
  action: n,
39
39
  payload: {
40
40
  ...r,
41
- destination_account_ids: o.map((u) => u.external_guid)
41
+ destination_account_ids: o.map((s) => s.external_guid)
42
42
  }
43
43
  } : {
44
44
  action: l,
45
45
  payload: r
46
46
  };
47
47
  } }
48
- }, y = (a) => a.cta.metadata ?? g[a.beat.template]?.[a.slot]?.(a) ?? null;
48
+ }, g = (a) => a.cta.metadata ?? p[a.beat.template]?.[a.slot]?.(a) ?? null;
49
49
  export {
50
- g as ctaPostMessages,
51
- y as resolveCtaMetadata
50
+ p as ctaPostMessages,
51
+ g as resolveCtaMetadata
52
52
  };
53
53
 
54
54
  //# sourceMappingURL=ctaPostMessages.es.js.map