@mx-cartographer/experiences 9.7.160 → 9.7.161

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 (34) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/common/components/CurrencyDialog.d.ts +11 -1
  3. package/dist/common/components/CurrencyDialog.es.js +50 -44
  4. package/dist/common/components/CurrencyDialog.es.js.map +1 -1
  5. package/dist/common/components/index.d.ts +1 -1
  6. package/dist/core/types/localization/InsightsFeedCopy.d.ts +8 -0
  7. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.d.ts +1 -1
  8. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +91 -91
  9. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js.map +1 -1
  10. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.d.ts +42 -2
  11. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js +75 -15
  12. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js.map +1 -1
  13. package/dist/insights-v2/actionBlocks/QuizMerchantBlock/QuizMerchantBlock.es.js +3 -3
  14. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js +64 -59
  15. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js.map +1 -1
  16. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListCreditLimitHeader.d.ts +11 -0
  17. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListCreditLimitHeader.es.js +138 -0
  18. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListCreditLimitHeader.es.js.map +1 -0
  19. package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.d.ts +13 -0
  20. package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js +80 -63
  21. package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js.map +1 -1
  22. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js +14 -14
  23. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js.map +1 -1
  24. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/layout.d.ts +9 -2
  25. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/layout.es.js +14 -7
  26. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/layout.es.js.map +1 -1
  27. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/utils.d.ts +7 -1
  28. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/utils.es.js +14 -7
  29. package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/utils.es.js.map +1 -1
  30. package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js +1 -1
  31. package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js +4 -4
  32. package/dist/insights-v2/components/CompactInsightCard.es.js +164 -138
  33. package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
  34. package/package.json +1 -1
@@ -1,8 +1,12 @@
1
- import { NotificationProfile } from '../../../core';
1
+ import { NotificationProfile, UserInsightProfile } from '../../../core';
2
+ import { AnalyticsEventConfigEntry } from '../../analytics/analyticsEventsConfig';
3
+ import { CtaHandlerName } from '../../ctaActions/ctaHandlers';
4
+ import { CurrencyDialogUnit } from '../../../common/components';
2
5
  /** CTA variants `amount_input_modal_block` serves (ditto sets one on the beat's CTA). */
3
6
  export declare const AMOUNT_INPUT_VARIANTS: {
4
7
  readonly LOW_BALANCE_THRESHOLD: "low_balance_threshold";
5
8
  readonly SAFETY_NET: "safety_net";
9
+ readonly CREDIT_LIMIT_PERCENTAGE: "credit_limit_percentage";
6
10
  };
7
11
  /** Opens the Create Budget dialog instead of an amount setting (Category Spending). */
8
12
  export declare const CREATE_BUDGET_VARIANT = "create_budget";
@@ -18,9 +22,45 @@ export declare const resolveAmountInputVariant: (cta?: {
18
22
  block?: string | null;
19
23
  variant?: string | null;
20
24
  }) => string | undefined;
21
- /** Whole dollars from 1 to `MAX_AMOUNT`, as pulse v1 accepted for both settings. */
25
+ /** Whole dollars from 1 to `MAX_AMOUNT`, as pulse v1 accepted for its dollar settings. */
22
26
  export declare const isWholeAmount: (value: string) => boolean;
27
+ /** The user's credit-limit alert as a whole 1-100 percent, else the default; the dialog and the Spending header both read it. */
28
+ export declare const resolveCreditLimitAlertPercent: (profile?: Pick<UserInsightProfile, "credit_card_close_to_limit_percentage"> | null) => number;
29
+ /** Where a setting's value can live; the dialog loads both and each variant reads its own. */
30
+ interface AmountSources {
31
+ insightProfile?: UserInsightProfile | null;
32
+ lowBalanceProfile?: NotificationProfile;
33
+ }
34
+ /** What one variant edits, how it validates and words its field, and the pulse analytics it fires. */
35
+ interface AmountSetting {
36
+ /** The saved value, from the setting's own source. */
37
+ read: (sources: AmountSources) => number | null | undefined;
38
+ /** The CTA handler and params that save `amount`. */
39
+ save: (amount: number, sources: AmountSources) => [CtaHandlerName, Record<string, unknown>];
40
+ /** Whether the source the setting edits is loaded; without it the dialog shows the plain error. */
41
+ hasSource: (sources: AmountSources) => boolean;
42
+ /** The source is the account's notification profile, which the dialog reloads on open. */
43
+ needsNotificationProfiles: boolean;
44
+ isValid: (value: string) => boolean;
45
+ /** The `insights_feed.amount_input_modal` key of the validation message. */
46
+ errorKey: 'whole_number_error' | 'percentage_error';
47
+ unit: CurrencyDialogUnit;
48
+ hasCancel: boolean;
49
+ /** Switches to `title_edit` / `description_edit` once a value is saved. */
50
+ hasEditCopy: boolean;
51
+ /** The account line under the title. */
52
+ showsAccount: boolean;
53
+ analytics: {
54
+ save: AnalyticsEventConfigEntry;
55
+ cancel: AnalyticsEventConfigEntry;
56
+ /** Pulse fires input-selected for the threshold dialogs only (EditThreshold.js). */
57
+ inputSelected?: AnalyticsEventConfigEntry;
58
+ };
59
+ }
60
+ /** Per-variant behaviour of the amount setting dialog; a new variant adds an entry here. */
61
+ export declare const AMOUNT_SETTINGS: Record<AmountInputVariant, AmountSetting>;
23
62
  /** A saved amount as the field's starting text; nothing saved (or zero) starts empty. */
24
63
  export declare const toInputValue: (amount?: number | null) => string;
25
64
  /** The account's low-balance alert profile, which holds the threshold (as pulse v1 looked it up). */
26
65
  export declare const findLowBalanceProfile: (profiles: NotificationProfile[], accountGuid?: string | null) => NotificationProfile | undefined;
66
+ export {};
@@ -1,20 +1,80 @@
1
- import { AccountNotificationTypes as a } from "../../../core/types/Notification.es.js";
2
- import { actionBlocksKey as o } from "../../mappings/actionBlocksKey.es.js";
3
- var e = {
1
+ import { AccountNotificationTypes as T } from "../../../core/types/Notification.es.js";
2
+ import { asNumber as E } from "../../blocks/slotReaders.es.js";
3
+ import { ANALYTICS_EVENTS_CONFIG as a } from "../../analytics/analyticsEventsConfig.es.js";
4
+ import { actionBlocksKey as l } from "../../mappings/actionBlocksKey.es.js";
5
+ var i = {
4
6
  LOW_BALANCE_THRESHOLD: "low_balance_threshold",
5
- SAFETY_NET: "safety_net"
6
- }, T = "create_budget", u = (t) => Object.values(e).includes(t ?? ""), N = (t) => {
7
- if (t?.variant) return t.variant;
8
- if (t?.block === o.SAFETY_NET_ACTION_BLOCK) return e.SAFETY_NET;
9
- }, i = 1e9, c = (t) => /^\d+$/.test(t) && Number(t) >= 1 && Number(t) <= i, v = (t) => t ? String(Math.round(t)) : "", E = (t, r) => r ? t.find((n) => n.entity_guid === r && n.notification_type === a.AccountBalanceLow) : void 0;
7
+ SAFETY_NET: "safety_net",
8
+ CREDIT_LIMIT_PERCENTAGE: "credit_limit_percentage"
9
+ }, C = "create_budget", f = (e) => Object.values(i).includes(e ?? ""), p = (e) => {
10
+ if (e?.variant) return e.variant;
11
+ if (e?.block === l.SAFETY_NET_ACTION_BLOCK) return i.SAFETY_NET;
12
+ }, A = 1e9, s = 100, c = (e) => (r) => /^\d+$/.test(r) && Number(r) >= 1 && Number(r) <= e, o = c(A), u = 75, d = (e) => {
13
+ const r = E(e?.credit_card_close_to_limit_percentage), t = r === void 0 ? void 0 : Math.round(r);
14
+ return t !== void 0 && t >= 1 && t <= s ? t : u;
15
+ }, _ = (e) => ({
16
+ read: ({ insightProfile: r }) => r?.[e],
17
+ save: (r) => ["updateUserInsightProfile", { fields: { [e]: r } }],
18
+ hasSource: ({ insightProfile: r }) => !!r,
19
+ needsNotificationProfiles: !1
20
+ }), N = {
21
+ read: ({ lowBalanceProfile: e }) => e?.threshold,
22
+ save: (e, { lowBalanceProfile: r }) => ["updateNotificationProfileThreshold", {
23
+ profileGuid: r?.guid,
24
+ threshold: e
25
+ }],
26
+ hasSource: ({ lowBalanceProfile: e }) => !!e,
27
+ needsNotificationProfiles: !0
28
+ }, n = {
29
+ save: a.EDIT_INSIGHT_THRESHOLD_SAVE,
30
+ cancel: a.EDIT_INSIGHT_THRESHOLD_CANCELED,
31
+ inputSelected: a.EDIT_INSIGHT_THRESHOLD_INPUT_SELECTED
32
+ }, L = {
33
+ [i.LOW_BALANCE_THRESHOLD]: {
34
+ ...N,
35
+ isValid: o,
36
+ errorKey: "whole_number_error",
37
+ unit: "currency",
38
+ hasCancel: !0,
39
+ hasEditCopy: !1,
40
+ showsAccount: !0,
41
+ analytics: n
42
+ },
43
+ [i.SAFETY_NET]: {
44
+ ..._("savings_opportunity_minimum_checking_account_balance"),
45
+ isValid: o,
46
+ errorKey: "whole_number_error",
47
+ unit: "currency",
48
+ hasCancel: !1,
49
+ hasEditCopy: !0,
50
+ showsAccount: !1,
51
+ analytics: {
52
+ save: a.EDIT_SAFETY_NET_SAVE,
53
+ cancel: a.EDIT_SAFETY_NET_CANCEL
54
+ }
55
+ },
56
+ [i.CREDIT_LIMIT_PERCENTAGE]: {
57
+ ..._("credit_card_close_to_limit_percentage"),
58
+ read: ({ insightProfile: e }) => d(e),
59
+ isValid: c(s),
60
+ errorKey: "percentage_error",
61
+ unit: "percent",
62
+ hasCancel: !0,
63
+ hasEditCopy: !1,
64
+ showsAccount: !1,
65
+ analytics: n
66
+ }
67
+ }, m = (e) => e ? String(Math.round(e)) : "", D = (e, r) => r ? e.find((t) => t.entity_guid === r && t.notification_type === T.AccountBalanceLow) : void 0;
10
68
  export {
11
- e as AMOUNT_INPUT_VARIANTS,
12
- T as CREATE_BUDGET_VARIANT,
13
- E as findLowBalanceProfile,
14
- u as isAmountInputVariant,
15
- c as isWholeAmount,
16
- N as resolveAmountInputVariant,
17
- v as toInputValue
69
+ i as AMOUNT_INPUT_VARIANTS,
70
+ L as AMOUNT_SETTINGS,
71
+ C as CREATE_BUDGET_VARIANT,
72
+ D as findLowBalanceProfile,
73
+ f as isAmountInputVariant,
74
+ o as isWholeAmount,
75
+ p as resolveAmountInputVariant,
76
+ d as resolveCreditLimitAlertPercent,
77
+ m as toInputValue
18
78
  };
19
79
 
20
80
  //# sourceMappingURL=layout.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AmountInputModalBlock/layout.ts"],"sourcesContent":["import type { NotificationProfile } from '../../../core'\nimport { AccountNotificationTypes } from '../../../core/types/Notification'\nimport { actionBlocksKey } from '../../mappings/actionBlocksKey'\n\n/** CTA variants `amount_input_modal_block` serves (ditto sets one on the beat's CTA). */\nexport const AMOUNT_INPUT_VARIANTS = {\n LOW_BALANCE_THRESHOLD: 'low_balance_threshold',\n SAFETY_NET: 'safety_net',\n} as const\n\n/** Opens the Create Budget dialog instead of an amount setting (Category Spending). */\nexport const CREATE_BUDGET_VARIANT = 'create_budget'\n\nexport type AmountInputVariant = (typeof AMOUNT_INPUT_VARIANTS)[keyof typeof AMOUNT_INPUT_VARIANTS]\n\nexport const isAmountInputVariant = (variant?: string | null): variant is AmountInputVariant =>\n Object.values<string>(AMOUNT_INPUT_VARIANTS).includes(variant ?? '')\n\n/**\n * The variant the modal edits, from the CTA that opened it. ditto drives the shared\n * `amount_input_modal_block` by an explicit CTA variant, but gives Savings Opportunity's safety-net\n * reminder a dedicated `safety_net_block` with no variant, so there the block name selects it. An\n * explicit variant always wins (so an unknown one still falls to the block's \"unknown variant\" path).\n */\nexport const resolveAmountInputVariant = (cta?: {\n block?: string | null\n variant?: string | null\n}): string | undefined => {\n if (cta?.variant) return cta.variant\n if (cta?.block === actionBlocksKey.SAFETY_NET_ACTION_BLOCK)\n return AMOUNT_INPUT_VARIANTS.SAFETY_NET\n return undefined\n}\n\n/** Pulse v1's upper bound for a safety net; applied to both variants. */\nconst MAX_AMOUNT = 1_000_000_000\n\n/** Whole dollars from 1 to `MAX_AMOUNT`, as pulse v1 accepted for both settings. */\nexport const isWholeAmount = (value: string): boolean =>\n /^\\d+$/.test(value) && Number(value) >= 1 && Number(value) <= MAX_AMOUNT\n\n/** A saved amount as the field's starting text; nothing saved (or zero) starts empty. */\nexport const toInputValue = (amount?: number | null): string =>\n amount ? String(Math.round(amount)) : ''\n\n/** The account's low-balance alert profile, which holds the threshold (as pulse v1 looked it up). */\nexport const findLowBalanceProfile = (\n profiles: NotificationProfile[],\n accountGuid?: string | null,\n): NotificationProfile | undefined =>\n accountGuid\n ? profiles.find(\n (profile) =>\n profile.entity_guid === accountGuid &&\n profile.notification_type === AccountNotificationTypes.AccountBalanceLow,\n )\n : undefined\n"],"mappings":";;AAKA,IAAa,IAAwB;AAAA,EACnC,uBAAuB;AAAA,EACvB,YAAY;AACd,GAGa,IAAwB,iBAIxB,IAAA,CAAwB,MACnC,OAAO,OAAe,CAAqB,EAAE,SAAS,KAAW,EAAE,GAQxD,IAAA,CAA6B,MAGhB;AACxB,MAAI,GAAK,QAAS,QAAO,EAAI;AAC7B,MAAI,GAAK,UAAU,EAAgB,wBACjC,QAAO,EAAsB;AAEjC,GAGM,IAAa,KAGN,IAAA,CAAiB,MAC5B,QAAQ,KAAK,CAAK,KAAK,OAAO,CAAK,KAAK,KAAK,OAAO,CAAK,KAAK,GAGnD,IAAA,CAAgB,MAC3B,IAAS,OAAO,KAAK,MAAM,CAAM,CAAC,IAAI,IAG3B,IAAA,CACX,GACA,MAEA,IACI,EAAS,KAAA,CACN,MACC,EAAQ,gBAAgB,KACxB,EAAQ,sBAAsB,EAAyB,iBAC3D,IACA"}
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/AmountInputModalBlock/layout.ts"],"sourcesContent":["import type { NotificationProfile, UserInsightProfile } from '../../../core'\nimport { AccountNotificationTypes } from '../../../core/types/Notification'\nimport {\n ANALYTICS_EVENTS_CONFIG,\n type AnalyticsEventConfigEntry,\n} from '../../analytics/analyticsEventsConfig'\nimport type { CtaHandlerName } from '../../ctaActions/ctaHandlers'\nimport { actionBlocksKey } from '../../mappings/actionBlocksKey'\nimport { asNumber } from '../../blocks/slotReaders'\nimport type { CurrencyDialogUnit } from '../../../common/components'\n\n/** CTA variants `amount_input_modal_block` serves (ditto sets one on the beat's CTA). */\nexport const AMOUNT_INPUT_VARIANTS = {\n LOW_BALANCE_THRESHOLD: 'low_balance_threshold',\n SAFETY_NET: 'safety_net',\n CREDIT_LIMIT_PERCENTAGE: 'credit_limit_percentage',\n} as const\n\n/** Opens the Create Budget dialog instead of an amount setting (Category Spending). */\nexport const CREATE_BUDGET_VARIANT = 'create_budget'\n\nexport type AmountInputVariant = (typeof AMOUNT_INPUT_VARIANTS)[keyof typeof AMOUNT_INPUT_VARIANTS]\n\nexport const isAmountInputVariant = (variant?: string | null): variant is AmountInputVariant =>\n Object.values<string>(AMOUNT_INPUT_VARIANTS).includes(variant ?? '')\n\n/**\n * The variant the modal edits, from the CTA that opened it. ditto drives the shared\n * `amount_input_modal_block` by an explicit CTA variant, but gives Savings Opportunity's safety-net\n * reminder a dedicated `safety_net_block` with no variant, so there the block name selects it. An\n * explicit variant always wins (so an unknown one still falls to the block's \"unknown variant\" path).\n */\nexport const resolveAmountInputVariant = (cta?: {\n block?: string | null\n variant?: string | null\n}): string | undefined => {\n if (cta?.variant) return cta.variant\n if (cta?.block === actionBlocksKey.SAFETY_NET_ACTION_BLOCK)\n return AMOUNT_INPUT_VARIANTS.SAFETY_NET\n return undefined\n}\n\n/** Pulse v1's upper bound for a safety net; applied to both dollar settings. */\nconst MAX_AMOUNT = 1_000_000_000\n\nconst MAX_ALERT_PERCENT = 100\n\n/** A whole number from 1 to `max`, as pulse v1 validated its amount and threshold fields. */\nconst wholeNumberUpTo =\n (max: number) =>\n (value: string): boolean =>\n /^\\d+$/.test(value) && Number(value) >= 1 && Number(value) <= max\n\n/** Whole dollars from 1 to `MAX_AMOUNT`, as pulse v1 accepted for its dollar settings. */\nexport const isWholeAmount = wholeNumberUpTo(MAX_AMOUNT)\n\n/** tupac's default `credit_card_close_to_limit_percentage`, used when none (or an invalid one) is saved. */\nconst DEFAULT_CREDIT_LIMIT_ALERT_PERCENT = 75\n\n/** The user's credit-limit alert as a whole 1-100 percent, else the default; the dialog and the Spending header both read it. */\nexport const resolveCreditLimitAlertPercent = (\n profile?: Pick<UserInsightProfile, 'credit_card_close_to_limit_percentage'> | null,\n): number => {\n const saved = asNumber(profile?.credit_card_close_to_limit_percentage)\n // Rounded like the dialog's whole-number field, so a saved 60.6 shows 61 in both.\n const percent = saved === undefined ? undefined : Math.round(saved)\n return percent !== undefined && percent >= 1 && percent <= MAX_ALERT_PERCENT\n ? percent\n : DEFAULT_CREDIT_LIMIT_ALERT_PERCENT\n}\n\n/** A user insight profile field a variant prefills from and saves to. */\ntype InsightProfileField = keyof Pick<\n UserInsightProfile,\n 'savings_opportunity_minimum_checking_account_balance' | 'credit_card_close_to_limit_percentage'\n>\n\n/** Where a setting's value can live; the dialog loads both and each variant reads its own. */\ninterface AmountSources {\n insightProfile?: UserInsightProfile | null\n lowBalanceProfile?: NotificationProfile\n}\n\n/** A saved value read and written on a user insight profile field. */\nconst insightProfileField = (field: InsightProfileField) => ({\n read: ({ insightProfile }: AmountSources) => insightProfile?.[field],\n save: (amount: number): [CtaHandlerName, Record<string, unknown>] => [\n 'updateUserInsightProfile',\n { fields: { [field]: amount } },\n ],\n hasSource: ({ insightProfile }: AmountSources) => !!insightProfile,\n needsNotificationProfiles: false,\n})\n\n/** The account's low-balance alert threshold, on its notification profile. */\nconst lowBalanceThreshold = {\n read: ({ lowBalanceProfile }: AmountSources) => lowBalanceProfile?.threshold,\n save: (\n amount: number,\n { lowBalanceProfile }: AmountSources,\n ): [CtaHandlerName, Record<string, unknown>] => [\n 'updateNotificationProfileThreshold',\n { profileGuid: lowBalanceProfile?.guid, threshold: amount },\n ],\n hasSource: ({ lowBalanceProfile }: AmountSources) => !!lowBalanceProfile,\n needsNotificationProfiles: true,\n}\n\n/** What one variant edits, how it validates and words its field, and the pulse analytics it fires. */\ninterface AmountSetting {\n /** The saved value, from the setting's own source. */\n read: (sources: AmountSources) => number | null | undefined\n /** The CTA handler and params that save `amount`. */\n save: (amount: number, sources: AmountSources) => [CtaHandlerName, Record<string, unknown>]\n /** Whether the source the setting edits is loaded; without it the dialog shows the plain error. */\n hasSource: (sources: AmountSources) => boolean\n /** The source is the account's notification profile, which the dialog reloads on open. */\n needsNotificationProfiles: boolean\n isValid: (value: string) => boolean\n /** The `insights_feed.amount_input_modal` key of the validation message. */\n errorKey: 'whole_number_error' | 'percentage_error'\n unit: CurrencyDialogUnit\n hasCancel: boolean\n /** Switches to `title_edit` / `description_edit` once a value is saved. */\n hasEditCopy: boolean\n /** The account line under the title. */\n showsAccount: boolean\n analytics: {\n save: AnalyticsEventConfigEntry\n cancel: AnalyticsEventConfigEntry\n /** Pulse fires input-selected for the threshold dialogs only (EditThreshold.js). */\n inputSelected?: AnalyticsEventConfigEntry\n }\n}\n\nconst THRESHOLD_ANALYTICS = {\n save: ANALYTICS_EVENTS_CONFIG.EDIT_INSIGHT_THRESHOLD_SAVE,\n cancel: ANALYTICS_EVENTS_CONFIG.EDIT_INSIGHT_THRESHOLD_CANCELED,\n inputSelected: ANALYTICS_EVENTS_CONFIG.EDIT_INSIGHT_THRESHOLD_INPUT_SELECTED,\n}\n\n/** Per-variant behaviour of the amount setting dialog; a new variant adds an entry here. */\nexport const AMOUNT_SETTINGS: Record<AmountInputVariant, AmountSetting> = {\n [AMOUNT_INPUT_VARIANTS.LOW_BALANCE_THRESHOLD]: {\n ...lowBalanceThreshold,\n isValid: isWholeAmount,\n errorKey: 'whole_number_error',\n unit: 'currency',\n hasCancel: true,\n hasEditCopy: false,\n showsAccount: true,\n analytics: THRESHOLD_ANALYTICS,\n },\n [AMOUNT_INPUT_VARIANTS.SAFETY_NET]: {\n ...insightProfileField('savings_opportunity_minimum_checking_account_balance'),\n isValid: isWholeAmount,\n errorKey: 'whole_number_error',\n unit: 'currency',\n hasCancel: false,\n hasEditCopy: true,\n showsAccount: false,\n analytics: {\n save: ANALYTICS_EVENTS_CONFIG.EDIT_SAFETY_NET_SAVE,\n cancel: ANALYTICS_EVENTS_CONFIG.EDIT_SAFETY_NET_CANCEL,\n },\n },\n [AMOUNT_INPUT_VARIANTS.CREDIT_LIMIT_PERCENTAGE]: {\n ...insightProfileField('credit_card_close_to_limit_percentage'),\n // Same rule as the Spending header's marker, so the field and the marker always agree.\n read: ({ insightProfile }) => resolveCreditLimitAlertPercent(insightProfile),\n isValid: wholeNumberUpTo(MAX_ALERT_PERCENT),\n errorKey: 'percentage_error',\n unit: 'percent',\n hasCancel: true,\n hasEditCopy: false,\n showsAccount: false,\n analytics: THRESHOLD_ANALYTICS,\n },\n}\n\n/** A saved amount as the field's starting text; nothing saved (or zero) starts empty. */\nexport const toInputValue = (amount?: number | null): string =>\n amount ? String(Math.round(amount)) : ''\n\n/** The account's low-balance alert profile, which holds the threshold (as pulse v1 looked it up). */\nexport const findLowBalanceProfile = (\n profiles: NotificationProfile[],\n accountGuid?: string | null,\n): NotificationProfile | undefined =>\n accountGuid\n ? profiles.find(\n (profile) =>\n profile.entity_guid === accountGuid &&\n profile.notification_type === AccountNotificationTypes.AccountBalanceLow,\n )\n : undefined\n"],"mappings":";;;;AAYA,IAAa,IAAwB;AAAA,EACnC,uBAAuB;AAAA,EACvB,YAAY;AAAA,E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AACzC,GAGa,IAA6D;AAAA,EACvE,CAAA,EAAsB,qBAAA,GAAwB;AAAA,IAC7C,GAAG;AAAA,IACH,SAAS;AAAA,IACT,UAAU;AAAA,IACV,MAAM;AAAA,IACN,WAAW;AAAA,IACX,aAAa;AAAA,IACb,cAAc;AAAA,IACd,WAAW;AAAA,EACb;AAAA,EACC,CAAA,EAAsB,UAAA,GAAa;AAAA,IAClC,GAAG,EAAoB,sDAAsD;AAAA,IAC7E,SAAS;AAAA,IACT,UAAU;AAAA,IACV,MAAM;AAAA,IACN,WAAW;AAAA,IACX,aAAa;AAAA,IACb,cAAc;AAAA,IACd,WAAW;AAAA,MACT,MAAM,EAAwB;AAAA,MAC9B,QAAQ,EAAwB;AAAA,IAClC;AAAA,EACF;AAAA,EACC,CAAA,EAAsB,uBAAA,GAA0B;AAAA,IAC/C,GAAG,EAAoB,uCAAuC;AAAA,IAE9D,MAAA,CAAO,EAAE,gBAAA,EAAA,MAAqB,EAA+B,CAAc;AAAA,IAC3E,SAAS,EAAgB,CAAiB;AAAA,IAC1C,UAAU;AAAA,IACV,MAAM;AAAA,IACN,WAAW;AAAA,IACX,aAAa;AAAA,IACb,cAAc;AAAA,IACd,WAAW;AAAA,EACb;AACF,GAGa,IAAA,CAAgB,MAC3B,IAAS,OAAO,KAAK,MAAM,CAAM,CAAC,IAAI,IAG3B,IAAA,CACX,GACA,MAEA,IACI,EAAS,KAAA,CACN,MACC,EAAQ,gBAAgB,KACxB,EAAQ,sBAAsB,EAAyB,iBAC3D,IACA"}
@@ -6,8 +6,8 @@ import { formatIsoDate as O } from "../../../core/utils/DateUtil.es.js";
6
6
  import { CURRENCY_FORMAT as A, formatCurrency as w } from "../../../core/utils/NumberFormatting.es.js";
7
7
  import z from "../../../common/components/drawer/Drawer.es.js";
8
8
  import M from "../../../transactions/components/shared/TransactionList.es.js";
9
- import { merchantTransactions as B, quizMerchantLogo as F } from "../../blocks/ComponentBlocks/QuizBlock/quiz.es.js";
10
- import { selectTransactionsByGuids as G } from "../../CommonUtils.es.js";
9
+ import { selectTransactionsByGuids as B } from "../../CommonUtils.es.js";
10
+ import { merchantTransactions as F, quizMerchantLogo as G } from "../../blocks/ComponentBlocks/QuizBlock/quiz.es.js";
11
11
  import N from "../../components/LogoFromGuid.es.js";
12
12
  import { SMALL_CARD_SHADOW as q } from "../../components/shared/elevation.es.js";
13
13
  import { calendarDateOf as E } from "../TransactionHistoryBlock/utils.es.js";
@@ -54,7 +54,7 @@ var V = (a) => a.reduce((r, { amount: e, transaction_type: c }) => c === R.CREDI
54
54
  }), go = j(function({ beat: r }) {
55
55
  const { common: e, insights_feed: c } = L(), l = c?.quiz_block, { setActionContext: p } = k(), m = I(), n = D()?.quiz_merchant, [g, h] = $.useState(!1);
56
56
  if (!n) return null;
57
- const d = B(G(m.detailedTransactions, r.transaction_guids), n), u = E(r.payload?.described_month), T = S(l?.placement ?? "", String(n.rank), u ? O(u, v.MONTH_LONG) : ""), _ = F(n, d), C = (y) => {
57
+ const d = F(B(m.detailedTransactions, r.transaction_guids), n), u = E(r.payload?.described_month), T = S(l?.placement ?? "", String(n.rank), u ? O(u, v.MONTH_LONG) : ""), _ = G(n, d), C = (y) => {
58
58
  p({ transaction_guid: y }), h(!0);
59
59
  }, b = () => {
60
60
  h(!1), p({ transaction_guid: void 0 });
@@ -1,104 +1,109 @@
1
- import { useAccountStore as E, useGlobalCopyStore as q, useInsightsV2Store as F, useTransactionStore as U } from "../../../common/context/hooks.es.js";
1
+ import { useAccountStore as q, useGlobalCopyStore as F, useInsightsV2Store as U, useTransactionStore as V } from "../../../common/context/hooks.es.js";
2
2
  import g from "../../../common/components/drawer/Drawer.es.js";
3
- import V from "../../../transactions/components/shared/TransactionList.es.js";
4
- import { selectTransactionsByGuids as $ } from "../../CommonUtils.es.js";
5
- import { frequencyWord as P } from "../../components/SubscriptionStatus/subscriptionFrequency.es.js";
6
- import { useOpenedCta as z } from "../useOpenedCta.es.js";
7
- import { TransactionDetailsBlock as W } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
8
- import { useRecurringTransactionPrepare as J } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
9
- import { RecurringTransactionBlock as K } from "../RecurringTransactionBlock/RecurringTransactionBlock.es.js";
10
- import { HelpBlock as Q } from "../HelpBlock/HelpBlock.es.js";
11
- import { ACCOUNT_SUBLINE_VARIANTS as X, TRANSACTION_LIST_VARIANTS as Y, readHelpHeader as Z, readSubscriptionHeader as tt, readSummary as nt, readTransactionFrequencies as ot } from "./layout.es.js";
12
- import { TransactionAccountSubline as et } from "./TransactionAccountSubline.es.js";
13
- import { TransactionListHelpHeader as rt } from "./TransactionListHelpHeader.es.js";
14
- import { TransactionListSubscriptionHeader as it } from "./TransactionListSubscriptionHeader.es.js";
15
- import { TransactionListSummaryCard as st } from "./TransactionListSummaryCard.es.js";
3
+ import $ from "../../../transactions/components/shared/TransactionList.es.js";
4
+ import { selectTransactionsByGuids as P } from "../../CommonUtils.es.js";
5
+ import { frequencyWord as z } from "../../components/SubscriptionStatus/subscriptionFrequency.es.js";
6
+ import { useOpenedCta as W } from "../useOpenedCta.es.js";
7
+ import { TransactionDetailsBlock as J } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
8
+ import { useRecurringTransactionPrepare as K } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
9
+ import { RecurringTransactionBlock as Q } from "../RecurringTransactionBlock/RecurringTransactionBlock.es.js";
10
+ import { HelpBlock as X } from "../HelpBlock/HelpBlock.es.js";
11
+ import { ACCOUNT_SUBLINE_VARIANTS as Y, TRANSACTION_LIST_VARIANTS as Z, readCreditLimitHeader as tt, readHelpHeader as nt, readSubscriptionHeader as et, readSummary as ot, readTransactionFrequencies as rt } from "./layout.es.js";
12
+ import { TransactionAccountSubline as it } from "./TransactionAccountSubline.es.js";
13
+ import { TransactionListCreditLimitHeader as st } from "./TransactionListCreditLimitHeader.es.js";
14
+ import { TransactionListHelpHeader as at } from "./TransactionListHelpHeader.es.js";
15
+ import { TransactionListSubscriptionHeader as ct } from "./TransactionListSubscriptionHeader.es.js";
16
+ import { TransactionListSummaryCard as lt } from "./TransactionListSummaryCard.es.js";
16
17
  import f from "react";
17
- import { observer as at } from "mobx-react-lite";
18
- import { Text as ct } from "@mxenabled/mxui";
19
- import { Fragment as lt, jsx as t, jsxs as dt } from "react/jsx-runtime";
20
- var ut = (o) => Array.isArray(o) && o.every((n) => typeof n == "string"), pt = (o, n) => {
21
- const s = o.insights_payload?.drilldown_data, a = o.insights_payload?.instance_slot_data ?? {}, [l, c] = n && Object.hasOwn(n, "transaction_guids") ? ["cta.drilldown_data", n.transaction_guids] : s && Object.hasOwn(s, "transaction_guids") ? ["drilldown_data", s.transaction_guids] : ["instance_slot_data", a.transaction_guids];
18
+ import { observer as dt } from "mobx-react-lite";
19
+ import { Text as ut } from "@mxenabled/mxui";
20
+ import { Fragment as pt, jsx as t, jsxs as mt } from "react/jsx-runtime";
21
+ var _t = (e) => Array.isArray(e) && e.every((n) => typeof n == "string"), gt = (e, n) => {
22
+ const a = e.insights_payload?.drilldown_data, r = e.insights_payload?.instance_slot_data ?? {}, [l, c] = n && Object.hasOwn(n, "transaction_guids") ? ["cta.drilldown_data", n.transaction_guids] : a && Object.hasOwn(a, "transaction_guids") ? ["drilldown_data", a.transaction_guids] : ["instance_slot_data", r.transaction_guids];
22
23
  if (c != null) {
23
- if (ut(c)) return c;
24
+ if (_t(c)) return c;
24
25
  console.warn(`[TransactionListBlock] ${l}.transaction_guids is not a list of guids — listing no transactions.`);
25
26
  }
26
- }, mt = (o) => (J(o), /* @__PURE__ */ t(K, { ...o })), Rt = at(function({ beat: n }) {
27
- const { common: s, insights_feed: a, recurring: l } = q(), { setActionContext: c } = F(), O = U(), x = E(), [A, T] = f.useState(!1), [w, S] = f.useState(!1), { is_zero_state: H, drilldown_data: b, title: I } = n.insights_payload ?? {}, e = z(n), u = pt(n, e?.drilldown_data), h = $(O.detailedTransactions, u), p = nt(e), k = p?.count ?? u?.length ?? 0, m = !H && (u?.length ?? 0) > 0, B = p !== void 0 && m, d = Z(e, b), y = m ? tt(e) : void 0, R = X.has(e?.variant) ? (r) => /* @__PURE__ */ t(et, {
28
- institutionGuid: x.accounts.find(({ guid: i }) => i === r.account_guid)?.institution_guid,
29
- transaction: r
30
- }) : void 0, C = m ? ot(e) : void 0, G = C ? (r) => {
31
- const i = P(l, C.get(r.guid));
32
- return i ? /* @__PURE__ */ t(ct, {
27
+ }, ft = (e) => (K(e), /* @__PURE__ */ t(Q, { ...e })), Mt = dt(function({ beat: n }) {
28
+ const { common: a, insights_feed: r, recurring: l } = F(), { setActionContext: c } = U(), O = V(), x = q(), [A, T] = f.useState(!1), [b, S] = f.useState(!1), { is_zero_state: w, drilldown_data: I, title: k } = n.insights_payload ?? {}, o = W(n), u = gt(n, o?.drilldown_data), h = P(O.detailedTransactions, u), p = ot(o), B = p?.count ?? u?.length ?? 0, m = !w && (u?.length ?? 0) > 0, R = p !== void 0 && m, d = nt(o, I), y = tt(o), C = m ? et(o) : void 0, G = Y.has(o?.variant) ? (i) => /* @__PURE__ */ t(it, {
29
+ institutionGuid: x.accounts.find(({ guid: s }) => s === i.account_guid)?.institution_guid,
30
+ transaction: i
31
+ }) : void 0, L = m ? rt(o) : void 0, D = L ? (i) => {
32
+ const s = z(l, L.get(i.guid));
33
+ return s ? /* @__PURE__ */ t(ut, {
33
34
  bold: !0,
34
35
  color: "text.secondary",
35
36
  sx: { textTransform: "uppercase" },
36
37
  variant: "caption",
37
- children: i
38
+ children: s
38
39
  }) : null;
39
- } : void 0, [_, v] = f.useState(null), D = e?.variant === Y.SUBSCRIPTION_LIST, N = (r) => {
40
- const i = D ? h.find((j) => j.guid === r)?.repeating_transaction_guid : void 0;
41
- if (i) {
42
- v(i);
40
+ } : void 0, [_, v] = f.useState(null), N = o?.variant === Z.SUBSCRIPTION_LIST, M = (i) => {
41
+ const s = N ? h.find((E) => E.guid === i)?.repeating_transaction_guid : void 0;
42
+ if (s) {
43
+ v(s);
43
44
  return;
44
45
  }
45
- c({ transaction_guid: r }), T(!0);
46
- }, L = () => v(null), M = () => {
46
+ c({ transaction_guid: i }), T(!0);
47
+ }, H = () => v(null), j = () => {
47
48
  T(!1), c({ transaction_guid: void 0 });
48
49
  };
49
- return /* @__PURE__ */ dt(lt, { children: [
50
- B && /* @__PURE__ */ t(st, {
51
- copy: a.general,
52
- count: k,
50
+ return /* @__PURE__ */ mt(pt, { children: [
51
+ R && /* @__PURE__ */ t(lt, {
52
+ copy: r.general,
53
+ count: B,
53
54
  summary: p
54
55
  }),
55
- y && /* @__PURE__ */ t(it, {
56
- copy: a.transaction_list_block ?? {},
57
- header: y,
58
- tipTitle: a.general.tip_section_title
56
+ y && /* @__PURE__ */ t(st, {
57
+ copy: r.transaction_list_block,
58
+ header: y
59
59
  }),
60
- d && /* @__PURE__ */ t(rt, {
60
+ C && /* @__PURE__ */ t(ct, {
61
+ copy: r.transaction_list_block ?? {},
62
+ header: C,
63
+ tipTitle: r.general.tip_section_title
64
+ }),
65
+ d && /* @__PURE__ */ t(at, {
61
66
  descriptionHtml: d.descriptionHtml,
62
67
  learnMoreLabel: d.learnMore?.label,
63
68
  onLearnMore: () => S(!0),
64
- title: I ?? ""
69
+ title: k ?? ""
65
70
  }),
66
- /* @__PURE__ */ t(V, {
67
- onClick: N,
68
- renderAmountCaption: G,
69
- renderSecondaryText: R,
71
+ /* @__PURE__ */ t($, {
72
+ onClick: M,
73
+ renderAmountCaption: D,
74
+ renderSecondaryText: G,
70
75
  transaction: h
71
76
  }),
72
77
  d?.learnMore && /* @__PURE__ */ t(g, {
73
- ariaLabelClose: s.close_aria,
74
- isOpen: w,
78
+ ariaLabelClose: a.close_aria,
79
+ isOpen: b,
75
80
  onClose: () => S(!1),
76
81
  title: d.learnMore.label,
77
- children: /* @__PURE__ */ t(Q, { beat: n })
82
+ children: /* @__PURE__ */ t(X, { beat: n })
78
83
  }),
79
84
  /* @__PURE__ */ t(g, {
80
- ariaLabelClose: s.close_aria,
85
+ ariaLabelClose: a.close_aria,
81
86
  isOpen: A,
82
- onClose: M,
83
- title: a.general.transaction_details_title,
84
- children: /* @__PURE__ */ t(W, { beat: n })
87
+ onClose: j,
88
+ title: r.general.transaction_details_title,
89
+ children: /* @__PURE__ */ t(J, { beat: n })
85
90
  }),
86
91
  /* @__PURE__ */ t(g, {
87
92
  ariaLabelClose: l.close_drawer_aria,
88
93
  isOpen: _ !== null,
89
- onClose: L,
94
+ onClose: H,
90
95
  title: l.expense_details,
91
- children: _ && /* @__PURE__ */ t(mt, {
96
+ children: _ && /* @__PURE__ */ t(ft, {
92
97
  beat: n,
93
98
  layout: "insights",
94
- onDeleted: L,
99
+ onDeleted: H,
95
100
  repeatingTransactionGuid: _
96
101
  })
97
102
  })
98
103
  ] });
99
104
  });
100
105
  export {
101
- Rt as TransactionListBlock
106
+ Mt as TransactionListBlock
102
107
  };
103
108
 
104
109
  //# sourceMappingURL=TransactionListBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionListBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport {\n Drawer,\n useAccountStore,\n useGlobalCopyStore,\n useInsightsV2Store,\n useTransactionStore,\n} from '../../../common'\nimport type { Beat, Transaction } from '../../../core'\nimport type { InsightsInstanceSlotData } from '../../../core/types/InsightsInstanceSlotData'\nimport {\n RecurringTransactionBlock,\n useRecurringTransactionPrepare,\n} from '../RecurringTransactionBlock'\nimport { TransactionDetailsBlock } from '../TransactionDetailsBlock'\nimport { TransactionList } from '../../../transactions'\nimport { selectTransactionsByGuids } from '../../CommonUtils'\nimport { useOpenedCta } from '../useOpenedCta'\nimport { HelpBlock } from '../HelpBlock'\nimport { frequencyWord } from '../../components/SubscriptionStatus/subscriptionFrequency'\nimport {\n ACCOUNT_SUBLINE_VARIANTS,\n readHelpHeader,\n readSubscriptionHeader,\n readSummary,\n readTransactionFrequencies,\n TRANSACTION_LIST_VARIANTS,\n} from './layout'\nimport { TransactionAccountSubline } from './TransactionAccountSubline'\nimport { TransactionListHelpHeader } from './TransactionListHelpHeader'\nimport { TransactionListSubscriptionHeader } from './TransactionListSubscriptionHeader'\nimport { TransactionListSummaryCard } from './TransactionListSummaryCard'\n\nconst isStringArray = (value: unknown): value is string[] =>\n Array.isArray(value) && value.every((item) => typeof item === 'string')\n\n/**\n * The guids the drawer lists, from the first source that names them: the clicked CTA's own\n * `drilldown_data` (each drawer's data rides on the CTA that opens it), then the card-level\n * `drilldown_data`, then V1's `instance_slot_data`. The payload is untrusted, so a present but\n * malformed list fails closed (no rows, and a warning) rather than showing another source's rows; a\n * non-array would otherwise reach new Set() inside selectTransactionsByGuids and match per-character.\n */\nconst resolveTransactionGuids = (\n beat: Beat,\n ctaDrilldown: Record<string, unknown> | undefined,\n): string[] | undefined => {\n const drilldown = beat.insights_payload?.drilldown_data\n const slotData = (beat.insights_payload?.instance_slot_data ?? {}) as InsightsInstanceSlotData\n const [source, value]: [string, unknown] =\n ctaDrilldown && Object.hasOwn(ctaDrilldown, 'transaction_guids')\n ? ['cta.drilldown_data', ctaDrilldown.transaction_guids]\n : drilldown && Object.hasOwn(drilldown, 'transaction_guids')\n ? ['drilldown_data', drilldown.transaction_guids]\n : ['instance_slot_data', slotData.transaction_guids]\n\n if (value == null) return undefined\n if (isStringArray(value)) return value\n\n console.warn(\n `[TransactionListBlock] ${source}.transaction_guids is not a list of guids — listing no transactions.`,\n )\n return undefined\n}\n\n/** The shared Expense Details, with its own open-time load: the list's drawer only loads transactions. */\nconst SubscriptionExpenseDetails = (\n props: React.ComponentProps<typeof RecurringTransactionBlock>,\n) => {\n useRecurringTransactionPrepare(props)\n\n return <RecurringTransactionBlock {...props} />\n}\n\nexport interface TransactionListBlockProps {\n beat: Beat\n}\n\n/**\n * Opens a date-grouped list of the transactions a beat points at. Tapping a row stacks\n * the Transaction Details drawer over the list.\n *\n * ActionBlockLayer owns the outer Drawer (title, close button, copy-loaded gate).\n */\nexport const TransactionListBlock = observer(function TransactionListBlock({\n beat,\n}: TransactionListBlockProps) {\n const {\n common: commonCopy,\n insights_feed: insightsCopy,\n recurring: recurringCopy,\n } = useGlobalCopyStore()\n const { setActionContext } = useInsightsV2Store()\n const transactionStore = useTransactionStore()\n const accountStore = useAccountStore()\n\n const [isDetailsOpen, setIsDetailsOpen] = React.useState(false)\n const [isHelpOpen, setIsHelpOpen] = React.useState(false)\n\n // The clicked CTA carries the drawer's own data (its guids, and the summary figures), so read\n // the CTA that opened this drawer first. `readSummary` fails closed (no finite `amount` -> undefined),\n // so a plain list renders no card. A zero-state envelope, or one naming no transactions, has no\n // figures to head.\n const { is_zero_state, drilldown_data, title } = beat.insights_payload ?? {}\n const currentCta = useOpenedCta(beat)\n\n const guids = resolveTransactionGuids(beat, currentCta?.drilldown_data)\n const transactions = selectTransactionsByGuids(transactionStore.detailedTransactions, guids)\n const summary = readSummary(currentCta)\n // Count comes from the CTA's `drilldown_data`; fall back to the named guid count so the pill never\n // flashes \"0 transactions\" if the payload omits it.\n const count = summary?.count ?? guids?.length ?? 0\n // One answer for \"lists something\", so the header, summary and captions never disagree.\n const hasRows = !is_zero_state && (guids?.length ?? 0) > 0\n const showSummary = summary !== undefined && hasRows\n const helpHeader = readHelpHeader(currentCta, drilldown_data)\n const subscriptionHeader = hasRows ? readSubscriptionHeader(currentCta) : undefined\n\n // Account-subtitled drawers (Figma: the Replenish Savings and Monthly Subscription Aggregate V2 drilldowns).\n const renderSecondaryText = ACCOUNT_SUBLINE_VARIANTS.has(currentCta?.variant)\n ? (transaction: Transaction) => (\n <TransactionAccountSubline\n institutionGuid={\n accountStore.accounts.find(({ guid }) => guid === transaction.account_guid)\n ?.institution_guid\n }\n transaction={transaction}\n />\n )\n : undefined\n\n // Each amount is captioned with its merchant's schedule, worded from the host's `recurring` copy.\n const frequencies = hasRows ? readTransactionFrequencies(currentCta) : undefined\n const renderAmountCaption = frequencies\n ? (transaction: Transaction) => {\n const word = frequencyWord(recurringCopy, frequencies.get(transaction.guid))\n\n return word ? (\n <Text\n bold={true}\n color=\"text.secondary\"\n sx={{ textTransform: 'uppercase' }}\n variant=\"caption\"\n >\n {word}\n </Text>\n ) : null\n }\n : undefined\n\n // A subscription row opens its schedule's Expense Details; any other row, Transaction Details.\n const [expenseGuid, setExpenseGuid] = React.useState<string | null>(null)\n const isSubscriptionList = currentCta?.variant === TRANSACTION_LIST_VARIANTS.SUBSCRIPTION_LIST\n\n const handleRowClick = (guid: string) => {\n const repeatingGuid = isSubscriptionList\n ? transactions.find((transaction) => transaction.guid === guid)?.repeating_transaction_guid\n : undefined\n\n if (repeatingGuid) {\n setExpenseGuid(repeatingGuid)\n return\n }\n\n setActionContext({ transaction_guid: guid })\n setIsDetailsOpen(true)\n }\n\n const closeExpenseDetails = () => setExpenseGuid(null)\n\n const handleDetailsClose = () => {\n setIsDetailsOpen(false)\n // Clear only the key this nested drawer owns — same convention as TransactionHistoryBlock.\n // `setActionContext` merges, so an explicit `{}` would be a no-op; naming the key keeps the\n // outer drawer's own context intact.\n setActionContext({ transaction_guid: undefined })\n }\n\n return (\n <>\n {showSummary && (\n <TransactionListSummaryCard copy={insightsCopy.general} count={count} summary={summary} />\n )}\n {subscriptionHeader && (\n <TransactionListSubscriptionHeader\n copy={insightsCopy.transaction_list_block ?? {}}\n header={subscriptionHeader}\n tipTitle={insightsCopy.general.tip_section_title}\n />\n )}\n {helpHeader && (\n <TransactionListHelpHeader\n descriptionHtml={helpHeader.descriptionHtml}\n learnMoreLabel={helpHeader.learnMore?.label}\n onLearnMore={() => setIsHelpOpen(true)}\n title={title ?? ''}\n />\n )}\n <TransactionList\n onClick={handleRowClick}\n renderAmountCaption={renderAmountCaption}\n renderSecondaryText={renderSecondaryText}\n transaction={transactions}\n />\n {helpHeader?.learnMore && (\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isHelpOpen}\n onClose={() => setIsHelpOpen(false)}\n title={helpHeader.learnMore.label}\n >\n <HelpBlock beat={beat} />\n </Drawer>\n )}\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isDetailsOpen}\n onClose={handleDetailsClose}\n title={insightsCopy.general.transaction_details_title}\n >\n <TransactionDetailsBlock beat={beat} />\n </Drawer>\n <Drawer\n ariaLabelClose={recurringCopy.close_drawer_aria}\n isOpen={expenseGuid !== null}\n onClose={closeExpenseDetails}\n title={recurringCopy.expense_details}\n >\n {expenseGuid && (\n <SubscriptionExpenseDetails\n beat={beat}\n layout=\"insights\"\n onDeleted={closeExpenseDetails}\n repeatingTransactionGuid={expenseGuid}\n />\n )}\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsCA,IAAM,KAAA,CAAiB,MACrB,MAAM,QAAQ,CAAK,KAAK,EAAM,MAAA,CAAO,MAAS,OAAO,KAAS,QAAQ,GASlE,KAAA,CACJ,GACA,MACyB;AACzB,QAAM,IAAY,EAAK,kBAAkB,gBACnC,IAAY,EAAK,kBAAkB,sBAAsB,CAAC,GAC1D,CAAC,GAAQ,CAAA,IACb,KAAgB,OAAO,OAAO,GAAc,mBAAmB,IAC3D,CAAC,sBAAsB,EAAa,iBAAiB,IACrD,KAAa,OAAO,OAAO,GAAW,mBAAmB,IACvD,CAAC,kBAAkB,EAAU,iBAAiB,IAC9C,CAAC,sBAAsB,EAAS,iBAAiB;AAEzD,MAAI,KAAS,MACb;AAAA,QAAI,GAAc,CAAK,EAAG,QAAO;AAEjC,YAAQ,KACN,0BAA0B,CAAA,sEAC5B;AAAA;AAEF,GAGM,KAAA,CACJ,OAEA,EAA+B,CAAK,GAE7B,gBAAA,EAAC,GAAD,EAA2B,GAAI,EAAQ,CAAA,IAanC,KAAuB,GAAS,SAA8B,EACzE,MAAA,EAAA,GAC4B;AAC5B,QAAM,EACJ,QAAQ,GACR,eAAe,GACf,WAAW,EAAA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;AAAA,MACR,SAAS;AAAA,MACT,OAAO,EAAa,QAAQ;AAAA,MAE5B,UAAA,gBAAA,EAAC,GAAD,EAA+B,MAAA,EAAO,CAAA;AAAA,IAChC,CAAA;AAAA,IACR,gBAAA,EAAC,GAAD;AAAA,MACE,gBAAgB,EAAc;AAAA,MAC9B,QAAQ,MAAgB;AAAA,MACxB,SAAS;AAAA,MACT,OAAO,EAAc;AAAA,MAEpB,UAAA,KACC,gBAAA,EAAC,IAAD;AAAA,QACQ,MAAA;AAAA,QACN,QAAO;AAAA,QACP,WAAW;AAAA,QACX,0BAA0B;AAAA,MAC3B,CAAA;AAAA,IAEG,CAAA;AAAA,EACR,EAAA,CAAA;AAEN,CAAC"}
1
+ {"version":3,"file":"TransactionListBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport {\n Drawer,\n useAccountStore,\n useGlobalCopyStore,\n useInsightsV2Store,\n useTransactionStore,\n} from '../../../common'\nimport type { Beat, Transaction } from '../../../core'\nimport type { InsightsInstanceSlotData } from '../../../core/types/InsightsInstanceSlotData'\nimport {\n RecurringTransactionBlock,\n useRecurringTransactionPrepare,\n} from '../RecurringTransactionBlock'\nimport { TransactionDetailsBlock } from '../TransactionDetailsBlock'\nimport { TransactionList } from '../../../transactions'\nimport { selectTransactionsByGuids } from '../../CommonUtils'\nimport { useOpenedCta } from '../useOpenedCta'\nimport { HelpBlock } from '../HelpBlock'\nimport { frequencyWord } from '../../components/SubscriptionStatus/subscriptionFrequency'\nimport {\n ACCOUNT_SUBLINE_VARIANTS,\n readCreditLimitHeader,\n readHelpHeader,\n readSubscriptionHeader,\n readSummary,\n readTransactionFrequencies,\n TRANSACTION_LIST_VARIANTS,\n} from './layout'\nimport { TransactionAccountSubline } from './TransactionAccountSubline'\nimport { TransactionListCreditLimitHeader } from './TransactionListCreditLimitHeader'\nimport { TransactionListHelpHeader } from './TransactionListHelpHeader'\nimport { TransactionListSubscriptionHeader } from './TransactionListSubscriptionHeader'\nimport { TransactionListSummaryCard } from './TransactionListSummaryCard'\n\nconst isStringArray = (value: unknown): value is string[] =>\n Array.isArray(value) && value.every((item) => typeof item === 'string')\n\n/**\n * The guids the drawer lists, from the first source that names them: the clicked CTA's own\n * `drilldown_data` (each drawer's data rides on the CTA that opens it), then the card-level\n * `drilldown_data`, then V1's `instance_slot_data`. The payload is untrusted, so a present but\n * malformed list fails closed (no rows, and a warning) rather than showing another source's rows; a\n * non-array would otherwise reach new Set() inside selectTransactionsByGuids and match per-character.\n */\nconst resolveTransactionGuids = (\n beat: Beat,\n ctaDrilldown: Record<string, unknown> | undefined,\n): string[] | undefined => {\n const drilldown = beat.insights_payload?.drilldown_data\n const slotData = (beat.insights_payload?.instance_slot_data ?? {}) as InsightsInstanceSlotData\n const [source, value]: [string, unknown] =\n ctaDrilldown && Object.hasOwn(ctaDrilldown, 'transaction_guids')\n ? ['cta.drilldown_data', ctaDrilldown.transaction_guids]\n : drilldown && Object.hasOwn(drilldown, 'transaction_guids')\n ? ['drilldown_data', drilldown.transaction_guids]\n : ['instance_slot_data', slotData.transaction_guids]\n\n if (value == null) return undefined\n if (isStringArray(value)) return value\n\n console.warn(\n `[TransactionListBlock] ${source}.transaction_guids is not a list of guids — listing no transactions.`,\n )\n return undefined\n}\n\n/** The shared Expense Details, with its own open-time load: the list's drawer only loads transactions. */\nconst SubscriptionExpenseDetails = (\n props: React.ComponentProps<typeof RecurringTransactionBlock>,\n) => {\n useRecurringTransactionPrepare(props)\n\n return <RecurringTransactionBlock {...props} />\n}\n\nexport interface TransactionListBlockProps {\n beat: Beat\n}\n\n/**\n * Opens a date-grouped list of the transactions a beat points at. Tapping a row stacks\n * the Transaction Details drawer over the list.\n *\n * ActionBlockLayer owns the outer Drawer (title, close button, copy-loaded gate).\n */\nexport const TransactionListBlock = observer(function TransactionListBlock({\n beat,\n}: TransactionListBlockProps) {\n const {\n common: commonCopy,\n insights_feed: insightsCopy,\n recurring: recurringCopy,\n } = useGlobalCopyStore()\n const { setActionContext } = useInsightsV2Store()\n const transactionStore = useTransactionStore()\n const accountStore = useAccountStore()\n\n const [isDetailsOpen, setIsDetailsOpen] = React.useState(false)\n const [isHelpOpen, setIsHelpOpen] = React.useState(false)\n\n // The clicked CTA carries the drawer's own data (its guids, and the summary figures), so read\n // the CTA that opened this drawer first. `readSummary` fails closed (no finite `amount` -> undefined),\n // so a plain list renders no card. A zero-state envelope, or one naming no transactions, has no\n // figures to head.\n const { is_zero_state, drilldown_data, title } = beat.insights_payload ?? {}\n const currentCta = useOpenedCta(beat)\n\n const guids = resolveTransactionGuids(beat, currentCta?.drilldown_data)\n const transactions = selectTransactionsByGuids(transactionStore.detailedTransactions, guids)\n const summary = readSummary(currentCta)\n // Count comes from the CTA's `drilldown_data`; fall back to the named guid count so the pill never\n // flashes \"0 transactions\" if the payload omits it.\n const count = summary?.count ?? guids?.length ?? 0\n // One answer for \"lists something\", so the header, summary and captions never disagree.\n const hasRows = !is_zero_state && (guids?.length ?? 0) > 0\n const showSummary = summary !== undefined && hasRows\n const helpHeader = readHelpHeader(currentCta, drilldown_data)\n const creditLimitHeader = readCreditLimitHeader(currentCta)\n const subscriptionHeader = hasRows ? readSubscriptionHeader(currentCta) : undefined\n\n // Account-subtitled drawers (Figma: the Replenish Savings and Monthly Subscription Aggregate V2 drilldowns).\n const renderSecondaryText = ACCOUNT_SUBLINE_VARIANTS.has(currentCta?.variant)\n ? (transaction: Transaction) => (\n <TransactionAccountSubline\n institutionGuid={\n accountStore.accounts.find(({ guid }) => guid === transaction.account_guid)\n ?.institution_guid\n }\n transaction={transaction}\n />\n )\n : undefined\n\n // Each amount is captioned with its merchant's schedule, worded from the host's `recurring` copy.\n const frequencies = hasRows ? readTransactionFrequencies(currentCta) : undefined\n const renderAmountCaption = frequencies\n ? (transaction: Transaction) => {\n const word = frequencyWord(recurringCopy, frequencies.get(transaction.guid))\n\n return word ? (\n <Text\n bold={true}\n color=\"text.secondary\"\n sx={{ textTransform: 'uppercase' }}\n variant=\"caption\"\n >\n {word}\n </Text>\n ) : null\n }\n : undefined\n\n // A subscription row opens its schedule's Expense Details; any other row, Transaction Details.\n const [expenseGuid, setExpenseGuid] = React.useState<string | null>(null)\n const isSubscriptionList = currentCta?.variant === TRANSACTION_LIST_VARIANTS.SUBSCRIPTION_LIST\n\n const handleRowClick = (guid: string) => {\n const repeatingGuid = isSubscriptionList\n ? transactions.find((transaction) => transaction.guid === guid)?.repeating_transaction_guid\n : undefined\n\n if (repeatingGuid) {\n setExpenseGuid(repeatingGuid)\n return\n }\n\n setActionContext({ transaction_guid: guid })\n setIsDetailsOpen(true)\n }\n\n const closeExpenseDetails = () => setExpenseGuid(null)\n\n const handleDetailsClose = () => {\n setIsDetailsOpen(false)\n // Clear only the key this nested drawer owns — same convention as TransactionHistoryBlock.\n // `setActionContext` merges, so an explicit `{}` would be a no-op; naming the key keeps the\n // outer drawer's own context intact.\n setActionContext({ transaction_guid: undefined })\n }\n\n return (\n <>\n {showSummary && (\n <TransactionListSummaryCard copy={insightsCopy.general} count={count} summary={summary} />\n )}\n {creditLimitHeader && (\n <TransactionListCreditLimitHeader\n copy={insightsCopy.transaction_list_block}\n header={creditLimitHeader}\n />\n )}\n {subscriptionHeader && (\n <TransactionListSubscriptionHeader\n copy={insightsCopy.transaction_list_block ?? {}}\n header={subscriptionHeader}\n tipTitle={insightsCopy.general.tip_section_title}\n />\n )}\n {helpHeader && (\n <TransactionListHelpHeader\n descriptionHtml={helpHeader.descriptionHtml}\n learnMoreLabel={helpHeader.learnMore?.label}\n onLearnMore={() => setIsHelpOpen(true)}\n title={title ?? ''}\n />\n )}\n <TransactionList\n onClick={handleRowClick}\n renderAmountCaption={renderAmountCaption}\n renderSecondaryText={renderSecondaryText}\n transaction={transactions}\n />\n {helpHeader?.learnMore && (\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isHelpOpen}\n onClose={() => setIsHelpOpen(false)}\n title={helpHeader.learnMore.label}\n >\n <HelpBlock beat={beat} />\n </Drawer>\n )}\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isDetailsOpen}\n onClose={handleDetailsClose}\n title={insightsCopy.general.transaction_details_title}\n >\n <TransactionDetailsBlock beat={beat} />\n </Drawer>\n <Drawer\n ariaLabelClose={recurringCopy.close_drawer_aria}\n isOpen={expenseGuid !== null}\n onClose={closeExpenseDetails}\n title={recurringCopy.expense_details}\n >\n {expenseGuid && (\n <SubscriptionExpenseDetails\n beat={beat}\n layout=\"insights\"\n onDeleted={closeExpenseDetails}\n repeatingTransactionGuid={expenseGuid}\n />\n )}\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwCA,IAAM,KAAA,CAAiB,MACrB,MAAM,QAAQ,CAAK,KAAK,EAAM,MAAA,CAAO,MAAS,OAAO,KAAS,QAAQ,GASlE,KAAA,CACJ,GACA,MACyB;AACzB,QAAM,IAAY,EAAK,kBAAkB,gBACnC,IAAY,EAAK,kBAAkB,sBAAsB,CAAC,GAC1D,CAAC,GAAQ,CAAA,IACb,KAAgB,OAAO,OAAO,GAAc,mBAAmB,IAC3D,CAAC,sBAAsB,EAAa,iBAAiB,IACrD,KAAa,OAAO,OAAO,GAAW,mBAAmB,IACvD,CAAC,kBAAkB,EAAU,iBAAiB,IAC9C,CAAC,sBAAsB,EAAS,iBAAiB;AAEzD,MAAI,KAAS,MACb;AAAA,QAAI,GAAc,CAAK,EAAG,QAAO;AAEjC,YAAQ,KACN,0BAA0B,CAAA,sEAC5B;AAAA;AAEF,GAGM,KAAA,CACJ,OAEA,EAA+B,CAAK,GAE7B,gBAAA,EAAC,GAAD,EAA2B,GAAI,EAAQ,CAAA,IAanC,KAAuB,GAAS,SAA8B,EACzE,MAAA,EAAA,GAC4B;AAC5B,QAAM,EACJ,QAAQ,GACR,eAAe,GACf,WAAW,EA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AAD,EAAiB,MAAA,EAAO,CAAA;AAAA,IAClB,CAAA;AAAA,IAEV,gBAAA,EAAC,GAAD;AAAA,MACE,gBAAgB,EAAW;AAAA,MAC3B,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,OAAO,EAAa,QAAQ;AAAA,MAE5B,UAAA,gBAAA,EAAC,GAAD,EAA+B,MAAA,EAAO,CAAA;AAAA,IAChC,CAAA;AAAA,IACR,gBAAA,EAAC,GAAD;AAAA,MACE,gBAAgB,EAAc;AAAA,MAC9B,QAAQ,MAAgB;AAAA,MACxB,SAAS;AAAA,MACT,OAAO,EAAc;AAAA,MAEpB,UAAA,KACC,gBAAA,EAAC,IAAD;AAAA,QACQ,MAAA;AAAA,QACN,QAAO;AAAA,QACP,WAAW;AAAA,QACX,0BAA0B;AAAA,MAC3B,CAAA;AAAA,IAEG,CAAA;AAAA,EACR,EAAA,CAAA;AAEN,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { TransactionListBlockCopy } from '../../../core/types/localization/InsightsFeedCopy';
2
+ import { CreditLimitHeader } from './layout';
3
+ export interface TransactionListCreditLimitHeaderProps {
4
+ header: CreditLimitHeader;
5
+ copy?: TransactionListBlockCopy;
6
+ }
7
+ /** The Spending list's credit-limit header: card, balance, limit and utilization against the user's alert percentage. */
8
+ export declare const TransactionListCreditLimitHeader: (({ copy, header, }: TransactionListCreditLimitHeaderProps) => import("react/jsx-runtime").JSX.Element) & {
9
+ displayName: string;
10
+ };
11
+ export default TransactionListCreditLimitHeader;
@@ -0,0 +1,138 @@
1
+ import { buildDynamicCopy as v } from "../../../core/utils/Localization.es.js";
2
+ import { useUserStore as _ } from "../../../common/context/hooks.es.js";
3
+ import { CURRENCY_FORMAT as h, formatCurrency as u } from "../../../core/utils/NumberFormatting.es.js";
4
+ import w from "../../components/LogoFromGuid.es.js";
5
+ import { resolveCreditLimitAlertPercent as C } from "../AmountInputModalBlock/layout.es.js";
6
+ import { observer as $ } from "mobx-react-lite";
7
+ import r from "@mui/material/Stack";
8
+ import { Text as e } from "@mxenabled/mxui";
9
+ import { jsx as i, jsxs as t } from "react/jsx-runtime";
10
+ import n from "@mui/material/Box";
11
+ var k = $(function({ copy: a, header: x }) {
12
+ const { userInsightProfile: p } = _(), o = C(p), { accountName: c, balance: f, institutionGuid: s, institutionName: b, limit: g, utilization: l } = x, m = Math.min(l, 100), d = a?.credit_limit_header_utilization ? v(a.credit_limit_header_utilization, `${l}%`) : void 0;
13
+ return /* @__PURE__ */ t(r, {
14
+ "data-testid": "credit-limit-header",
15
+ sx: {
16
+ bgcolor: "background.paper",
17
+ borderBottom: 1,
18
+ borderColor: "divider",
19
+ gap: 16,
20
+ pb: 16,
21
+ pt: 24,
22
+ px: 24
23
+ },
24
+ children: [/* @__PURE__ */ t(r, {
25
+ sx: {
26
+ alignItems: "center",
27
+ flexDirection: "row",
28
+ gap: 12
29
+ },
30
+ children: [/* @__PURE__ */ i(w, {
31
+ logo: s ? {
32
+ guid: s,
33
+ alt: b
34
+ } : null,
35
+ size: 40
36
+ }), /* @__PURE__ */ t(r, {
37
+ sx: {
38
+ flexDirection: "row",
39
+ flexGrow: 1,
40
+ gap: 12,
41
+ minWidth: 0
42
+ },
43
+ children: [/* @__PURE__ */ t(r, {
44
+ sx: {
45
+ flexGrow: 1,
46
+ gap: 2,
47
+ minWidth: 0
48
+ },
49
+ children: [/* @__PURE__ */ i(e, {
50
+ bold: !0,
51
+ truncate: !0,
52
+ variant: "body1",
53
+ children: c ?? ""
54
+ }), a?.credit_limit_header_credit_limit && /* @__PURE__ */ i(e, {
55
+ color: "text.secondary",
56
+ variant: "body2",
57
+ children: a.credit_limit_header_credit_limit
58
+ })]
59
+ }), /* @__PURE__ */ t(r, {
60
+ sx: {
61
+ alignItems: "flex-end",
62
+ fontVariantNumeric: "tabular-nums",
63
+ gap: 2
64
+ },
65
+ children: [/* @__PURE__ */ i(e, {
66
+ bold: !0,
67
+ variant: "body1",
68
+ children: u(f, h.cents)
69
+ }), /* @__PURE__ */ i(e, {
70
+ color: "text.secondary",
71
+ variant: "body2",
72
+ children: u(g, h.cents)
73
+ })]
74
+ })]
75
+ })]
76
+ }), /* @__PURE__ */ t(r, {
77
+ sx: { gap: 2 },
78
+ children: [
79
+ /* @__PURE__ */ i(n, {
80
+ "aria-label": c ?? d,
81
+ "aria-valuemax": 100,
82
+ "aria-valuemin": 0,
83
+ "aria-valuenow": m,
84
+ "aria-valuetext": `${l}%`,
85
+ role: "meter",
86
+ sx: {
87
+ bgcolor: "neutral.light",
88
+ borderRadius: "4px",
89
+ height: 12,
90
+ overflow: "hidden"
91
+ },
92
+ children: /* @__PURE__ */ i(n, { sx: {
93
+ bgcolor: "warning.main",
94
+ borderRadius: "4px",
95
+ height: "100%",
96
+ width: `${m}%`
97
+ } })
98
+ }),
99
+ /* @__PURE__ */ t(n, {
100
+ sx: {
101
+ height: 24,
102
+ position: "relative"
103
+ },
104
+ children: [/* @__PURE__ */ i(n, {
105
+ "aria-hidden": !0,
106
+ sx: {
107
+ bgcolor: "divider",
108
+ height: 8,
109
+ left: `${o}%`,
110
+ position: "absolute",
111
+ transform: `translateX(-${o}%)`,
112
+ width: "1px"
113
+ }
114
+ }), /* @__PURE__ */ i(e, {
115
+ sx: {
116
+ left: `${o}%`,
117
+ position: "absolute",
118
+ top: 8,
119
+ transform: `translateX(-${o}%)`
120
+ },
121
+ variant: "caption",
122
+ children: `${o}%`
123
+ })]
124
+ }),
125
+ d && /* @__PURE__ */ i(e, {
126
+ variant: "caption",
127
+ children: d
128
+ })
129
+ ]
130
+ })]
131
+ });
132
+ });
133
+ export {
134
+ k as TransactionListCreditLimitHeader,
135
+ k as default
136
+ };
137
+
138
+ //# sourceMappingURL=TransactionListCreditLimitHeader.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransactionListCreditLimitHeader.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListCreditLimitHeader.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { useUserStore } from '../../../common'\n\nimport type { TransactionListBlockCopy } from '../../../core/types/localization/InsightsFeedCopy'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport LogoFromGuid from '../../components/LogoFromGuid'\nimport { resolveCreditLimitAlertPercent } from '../AmountInputModalBlock/layout'\n\nimport type { CreditLimitHeader } from './layout'\n\nexport interface TransactionListCreditLimitHeaderProps {\n header: CreditLimitHeader\n copy?: TransactionListBlockCopy\n}\n\n/** The Spending list's credit-limit header: card, balance, limit and utilization against the user's alert percentage. */\nexport const TransactionListCreditLimitHeader = observer(function TransactionListCreditLimitHeader({\n copy,\n header,\n}: TransactionListCreditLimitHeaderProps) {\n const { userInsightProfile } = useUserStore()\n const alertPercent = resolveCreditLimitAlertPercent(userInsightProfile)\n const { accountName, balance, institutionGuid, institutionName, limit, utilization } = header\n const fillPercent = Math.min(utilization, 100)\n const utilizationText = copy?.credit_limit_header_utilization\n ? (buildDynamicCopy(copy.credit_limit_header_utilization, `${utilization}%`) as string)\n : undefined\n\n return (\n <Stack\n data-testid=\"credit-limit-header\"\n sx={{\n bgcolor: 'background.paper',\n borderBottom: 1,\n borderColor: 'divider',\n gap: 16,\n pb: 16,\n pt: 24,\n px: 24,\n }}\n >\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12 }}>\n <LogoFromGuid\n logo={institutionGuid ? { guid: institutionGuid, alt: institutionName } : null}\n size={40}\n />\n <Stack sx={{ flexDirection: 'row', flexGrow: 1, gap: 12, minWidth: 0 }}>\n <Stack sx={{ flexGrow: 1, gap: 2, minWidth: 0 }}>\n <Text bold={true} truncate={true} variant=\"body1\">\n {accountName ?? ''}\n </Text>\n {copy?.credit_limit_header_credit_limit && (\n <Text color=\"text.secondary\" variant=\"body2\">\n {copy.credit_limit_header_credit_limit}\n </Text>\n )}\n </Stack>\n <Stack sx={{ alignItems: 'flex-end', fontVariantNumeric: 'tabular-nums', gap: 2 }}>\n <Text bold={true} variant=\"body1\">\n {formatCurrency(balance, CURRENCY_FORMAT.cents)}\n </Text>\n <Text color=\"text.secondary\" variant=\"body2\">\n {formatCurrency(limit, CURRENCY_FORMAT.cents)}\n </Text>\n </Stack>\n </Stack>\n </Stack>\n\n <Stack sx={{ gap: 2 }}>\n <Box\n aria-label={accountName ?? utilizationText}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuenow={fillPercent}\n aria-valuetext={`${utilization}%`}\n role=\"meter\"\n sx={{ bgcolor: 'neutral.light', borderRadius: '4px', height: 12, overflow: 'hidden' }}\n >\n <Box\n sx={{\n bgcolor: 'warning.main',\n borderRadius: '4px',\n height: '100%',\n width: `${fillPercent}%`,\n }}\n />\n </Box>\n {/* Own row, so a low alert can't overlap the caption; tick and label shift to stay inside the bar. */}\n <Box sx={{ height: 24, position: 'relative' }}>\n <Box\n aria-hidden={true}\n sx={{\n bgcolor: 'divider',\n height: 8,\n left: `${alertPercent}%`,\n position: 'absolute',\n transform: `translateX(-${alertPercent}%)`,\n width: '1px',\n }}\n />\n <Text\n sx={{\n left: `${alertPercent}%`,\n position: 'absolute',\n top: 8,\n transform: `translateX(-${alertPercent}%)`,\n }}\n variant=\"caption\"\n >\n {`${alertPercent}%`}\n </Text>\n </Box>\n {utilizationText && <Text variant=\"caption\">{utilizationText}</Text>}\n </Stack>\n </Stack>\n )\n})\n\nexport default TransactionListCreditLimitHeader\n"],"mappings":";;;;;;;;;;AAsBA,IAAa,IAAmC,EAAS,SAA0C,EACjG,MAAA,GACA,QAAA,EAAA,GACwC;AACxC,QAAM,EAAE,oBAAA,EAAA,IAAuB,EAAa,GACtC,IAAe,EAA+B,CAAkB,GAChE,EAAE,aAAA,GAAa,SAAA,GAAS,iBAAA,GAAiB,iBAAA,GAAiB,OAAA,GAAO,aAAA,EAAA,IAAgB,GACjF,IAAc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