@mx-cartographer/experiences 9.7.65 → 9.7.66-alpha-harini-sov2-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +1 -1
- package/dist/core/stores/RecurringTransactionsStore.es.js +27 -22
- package/dist/core/stores/RecurringTransactionsStore.es.js.map +1 -1
- package/dist/core/types/Insights.d.ts +2 -7
- package/dist/core/types/Insights.es.js.map +1 -1
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +6 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +37 -37
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.d.ts +10 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js +12 -7
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/analytics/analyticsEventsConfig.d.ts +29 -0
- package/dist/insights-v2/analytics/analyticsEventsConfig.es.js +28 -0
- package/dist/insights-v2/analytics/analyticsEventsConfig.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.d.ts +7 -14
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js +13 -25
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js +4 -4
- package/dist/insights-v2/components/BaseLayout.es.js +113 -106
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/index.d.ts +1 -1
- package/dist/insights-v2/ctaActions/runCtaAction.d.ts +1 -1
- package/dist/insights-v2/ctaActions/runCtaAction.es.js +9 -6
- package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/subscriptionAnswer.d.ts +46 -0
- package/dist/insights-v2/ctaActions/types.d.ts +16 -2
- package/dist/insights-v2/ctaActions/useCtaAction.es.js +42 -30
- package/dist/insights-v2/ctaActions/useCtaAction.es.js.map +1 -1
- package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js +1 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
- package/dist/insights-v2/mappings/blocks.es.js +69 -64
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/layout.d.ts +0 -18
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/layout.es.js +0 -13
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/layout.es.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [9.7.67] - 10-29-2026
|
|
2
|
+
|
|
3
|
+
- **CHANGED** - Savings Opportunity V2 card now renders from the backend contract (WEC-1866): `SavingsOpportunityBlock` is a plain component registered under `savings_amount_block` that reads its slots off `instance_slot.data` (`primary_text`, `amount`), matching what tupac and ditto emit — it was `savings_opportunity_block` reading flat `instance_slot` fields with six speculative safety-net variants, so the card would not have rendered. ditto declares one `save_amount` variant with identical visuals, so the `createVariantBlock` dispatch and `layout.ts` are removed (as with `SaveExtraBlock` / `NoSpendDaysBlock`); the dead `instance_slot.slot` type field is dropped; `BlockType` key renamed `SavingsAmountBlock`; mock fixture, stories and block tests collapsed to the single card. The block guards its unchecked `slot()` reads — a payload without a numeric amount / string caption renders nothing rather than a fabricated `$0.00` coupon. Still to do on this story: the "Confirm Your Safety Net" drawer and the make_transfer / open_savings CTA action blocks (net-new UI, need Figma + the firefly endpoint)
|
|
4
|
+
- **ADDED** - Savings Opportunity V2's "Set Reminder" secondary CTA now opens the safety-net amount-input modal (WEC-1866). ditto names a dedicated `safety_net_block` on that CTA with no variant, so it is registered in `actionBlocks` to `AmountInputModalBlock` (modal presentation) alongside the shared `amount_input_modal_block`, and the block resolves its variant from the CTA that opened it (`resolveAmountInputVariant`): an explicit variant wins — so `amount_input_modal_block` keeps choosing `low_balance_threshold` / `safety_net`, and an unknown one still falls to the error dialog — otherwise `safety_net_block` selects the `safety_net` mode. The card fixture's secondary CTA points at the block; registry, layout-helper and block tests cover the new secondary-CTA path. The primary CTA ("Transfer Funds") stays a host post message with no block
|
|
5
|
+
|
|
6
|
+
## [9.7.66] - 10-29-2026
|
|
7
|
+
|
|
8
|
+
- **ADDED** - Shared subscription status CTA for Insights 2.0 (WEC-2158), for Subscription Detected and Unexpected Subscription Payment. The answer lives on the repeating transaction (`user_response`), so a CTA step can now draw a `CtaStatus` or nothing instead of the button (`presenter`, full card; `hideAll` also hides the secondary CTA) and load what it reads once per beat (`prepare`). `subscriptionEntryStep({ statusLabels, answerCounts? })` (`ctaActions/subscriptionAnswer.ts`) builds a beat's entry: unanswered draws the button; answered draws the status with Undo (writes `USER_RESPONSE_UNKNOWN`); a missing repeating transaction hides both CTAs, as pulse did. The repeating transactions load once per page on every card (mini too), retried by the next card after a failure; a second Undo while one is saving is ignored. The words are general copy, as pulse's were: `insights_feed.general` `confirmed` / `incorrect` / `subscribed` / `not_subscribed` / `undo` (new optional keys); the beat sends none. A beat's own survey saves the answer through `answerSubscription` and reports the "No" press through `reportSubscriptionMarkedIncorrect` (pulse's Subscription Confirmation events, Undo included). No beat registers an entry yet
|
|
9
|
+
- **FIXED** - `RecurringTransactionsStore.updateRepeatingTransaction` no longer drops the record when no transactions are loaded (the insights feed), keeping the server's record instead (WEC-2158)
|
|
10
|
+
|
|
1
11
|
## [9.7.65] - 10-28-2026
|
|
2
12
|
|
|
3
13
|
- **FIXED** - Fee Detected design QA (WEC-2139): quieter full-card Contact Support CTA, tighter Transaction Details header spacing with 32px action-row tiles, and Fee Detected fixtures that follow the V2 contract (no date header, orange `ICO-error` icon, `contact_support_block`).
|
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ The library is built using a modern React stack, leveraging industry-standard to
|
|
|
43
43
|
|
|
44
44
|
You need these tools to work in this repo:
|
|
45
45
|
|
|
46
|
-
- Node.js:
|
|
46
|
+
- Node.js: 22 (>=22.12). CI uses `node:22-alpine` (pinned, not the moving `lts` tag).
|
|
47
47
|
- Yarn: the version in the `packageManager` field of [package.json](package.json). Enable Corepack to get it.
|
|
48
48
|
|
|
49
49
|
### Installation
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { RecurrenceStatus as n, RecurrenceType as c } from "../types/RepeatingTransaction.es.js";
|
|
2
|
-
import { augmentRepeatingTransactions as o, buildAllRecurrences as
|
|
3
|
-
import { RepeatingTransactionsApi as
|
|
4
|
-
import { endOfMonth as
|
|
5
|
-
import { isBefore as
|
|
6
|
-
import { startOfMonth as
|
|
2
|
+
import { augmentRepeatingTransactions as o, buildAllRecurrences as R } from "../utils/RecurringTransactionsUtil.es.js";
|
|
3
|
+
import { RepeatingTransactionsApi as g } from "../api/RepeatingTransactionsApi.es.js";
|
|
4
|
+
import { endOfMonth as T } from "date-fns/endOfMonth";
|
|
5
|
+
import { isBefore as f } from "date-fns/isBefore";
|
|
6
|
+
import { startOfMonth as y } from "date-fns/startOfMonth";
|
|
7
7
|
import { startOfToday as s } from "date-fns/startOfToday";
|
|
8
|
-
import { isSameDay as
|
|
8
|
+
import { isSameDay as l } from "date-fns/isSameDay";
|
|
9
9
|
import { isWithinInterval as h } from "date-fns/isWithinInterval";
|
|
10
|
-
import { subDays as
|
|
10
|
+
import { subDays as S } from "date-fns/subDays";
|
|
11
11
|
import { isAfter as u } from "date-fns/isAfter";
|
|
12
|
-
import { makeAutoObservable as
|
|
13
|
-
var d = (e, t) => h(t.expectedDate, e), a = (e, t) => e + t.amount,
|
|
12
|
+
import { makeAutoObservable as _, runInAction as p } from "mobx";
|
|
13
|
+
var d = (e, t) => h(t.expectedDate, e), a = (e, t) => e + t.amount, G = class {
|
|
14
14
|
globalStore;
|
|
15
|
-
api = new
|
|
15
|
+
api = new g("/", "");
|
|
16
16
|
repeatingTransactions = [];
|
|
17
17
|
isDataLoaded = !1;
|
|
18
18
|
selectedDay;
|
|
19
19
|
dateRange = {
|
|
20
|
-
start:
|
|
21
|
-
end:
|
|
20
|
+
start: y(s()),
|
|
21
|
+
end: T(s())
|
|
22
22
|
};
|
|
23
23
|
selectedRepeatingTransactionGuid = null;
|
|
24
24
|
selectedRecurrence = null;
|
|
@@ -27,7 +27,7 @@ var d = (e, t) => h(t.expectedDate, e), a = (e, t) => e + t.amount, U = class {
|
|
|
27
27
|
severity: void 0
|
|
28
28
|
};
|
|
29
29
|
constructor(e) {
|
|
30
|
-
this.globalStore = e, this.api = new
|
|
30
|
+
this.globalStore = e, this.api = new g(e.endpoint, e.sessionToken, e.onError), _(this, {
|
|
31
31
|
recurrencesForRange: !1,
|
|
32
32
|
upcomingExpensesForRange: !1,
|
|
33
33
|
upcomingIncomeForRange: !1,
|
|
@@ -43,7 +43,7 @@ var d = (e, t) => h(t.expectedDate, e), a = (e, t) => e + t.amount, U = class {
|
|
|
43
43
|
}
|
|
44
44
|
recurrencesForRange = (e) => {
|
|
45
45
|
const t = this.globalStore.accountStore.visibleAccounts;
|
|
46
|
-
return
|
|
46
|
+
return R(this.detailedRepeatingTransactions, e).filter((r) => t.some((i) => i.guid === r.accountGuid && !i.is_excluded_from_accounts)).filter((r) => h(r.expectedDate, e));
|
|
47
47
|
};
|
|
48
48
|
upcomingExpensesForRange = (e) => this.recurrencesForRange(e).filter((t) => t.type === c.Expense && t.status === n.Upcoming);
|
|
49
49
|
incomeForRange = (e) => this.recurrencesForRange(e).filter((t) => t.type === c.Income);
|
|
@@ -56,7 +56,7 @@ var d = (e, t) => h(t.expectedDate, e), a = (e, t) => e + t.amount, U = class {
|
|
|
56
56
|
return this.recurrences.filter((e) => e.status === n.Paid || e.status === n.Missed);
|
|
57
57
|
}
|
|
58
58
|
get upcomingRecurrences() {
|
|
59
|
-
return this.recurrences.filter((e) => u(e.expectedDate,
|
|
59
|
+
return this.recurrences.filter((e) => u(e.expectedDate, S(s(), 3)) && f(e.expectedDate, this.dateRange.end) && e.status === n.Upcoming);
|
|
60
60
|
}
|
|
61
61
|
get expenses() {
|
|
62
62
|
return this.recurrences.filter((e) => e.type === c.Expense);
|
|
@@ -101,7 +101,7 @@ var d = (e, t) => h(t.expectedDate, e), a = (e, t) => e + t.amount, U = class {
|
|
|
101
101
|
return this.currentMonthIncome.filter((e) => e.status === n.Upcoming).reduce(a, 0);
|
|
102
102
|
}
|
|
103
103
|
get selectedDayRecurrences() {
|
|
104
|
-
return this.selectedDay && this.recurrences.filter((e) => this.selectedDay &&
|
|
104
|
+
return this.selectedDay && this.recurrences.filter((e) => this.selectedDay && l(e.occurredOnDate || e.expectedDate, this.selectedDay));
|
|
105
105
|
}
|
|
106
106
|
get selectedRepeatingTransaction() {
|
|
107
107
|
return this.selectedRepeatingTransactionGuid ? this.detailedRepeatingTransactions.find((e) => e.guid === this.selectedRepeatingTransactionGuid) : void 0;
|
|
@@ -113,7 +113,7 @@ var d = (e, t) => h(t.expectedDate, e), a = (e, t) => e + t.amount, U = class {
|
|
|
113
113
|
};
|
|
114
114
|
setDateRange = (e) => this.dateRange = e;
|
|
115
115
|
setSelectedDay = (e) => {
|
|
116
|
-
this.selectedDay = this.selectedDay &&
|
|
116
|
+
this.selectedDay = this.selectedDay && l(e, this.selectedDay) ? void 0 : e;
|
|
117
117
|
};
|
|
118
118
|
loadRepeatingTransactionData = async () => {
|
|
119
119
|
await Promise.all([
|
|
@@ -154,14 +154,19 @@ var d = (e, t) => h(t.expectedDate, e), a = (e, t) => e + t.amount, U = class {
|
|
|
154
154
|
};
|
|
155
155
|
updateRepeatingTransaction = async (e) => {
|
|
156
156
|
try {
|
|
157
|
-
const t = await this.api.updateRepeatingTransaction(e), r = this.repeatingTransactions.findIndex((
|
|
158
|
-
|
|
157
|
+
const t = await this.api.updateRepeatingTransaction(e), r = this.repeatingTransactions.findIndex((m) => m.guid === t.guid);
|
|
158
|
+
if (r < 0) return !1;
|
|
159
|
+
const [i] = o(this.globalStore.accountStore.visibleAccounts, [t], this.globalStore.transactionStore.transactions);
|
|
160
|
+
return p(() => {
|
|
159
161
|
this.repeatingTransactions = [
|
|
160
162
|
...this.repeatingTransactions.slice(0, r),
|
|
161
|
-
|
|
163
|
+
i ?? {
|
|
164
|
+
...this.repeatingTransactions[r],
|
|
165
|
+
...t
|
|
166
|
+
},
|
|
162
167
|
...this.repeatingTransactions.slice(r + 1)
|
|
163
168
|
];
|
|
164
|
-
}), this.setAlert(this.copy.update_repeating_transaction_success, "success"), !0
|
|
169
|
+
}), this.setAlert(this.copy.update_repeating_transaction_success, "success"), !0;
|
|
165
170
|
} catch (t) {
|
|
166
171
|
return this.captureError("updateRepeatingTransaction", t), this.setAlert(this.copy.update_repeating_transaction_error, "error"), !1;
|
|
167
172
|
}
|
|
@@ -196,7 +201,7 @@ var d = (e, t) => h(t.expectedDate, e), a = (e, t) => e + t.amount, U = class {
|
|
|
196
201
|
};
|
|
197
202
|
};
|
|
198
203
|
export {
|
|
199
|
-
|
|
204
|
+
G as RecurringTransactionsStore
|
|
200
205
|
};
|
|
201
206
|
|
|
202
207
|
//# sourceMappingURL=RecurringTransactionsStore.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecurringTransactionsStore.es.js","names":[],"sources":["../../../src/core/stores/RecurringTransactionsStore.ts"],"sourcesContent":["import { type AlertProps } from '@mui/material'\nimport { makeAutoObservable, runInAction } from 'mobx'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { isAfter } from 'date-fns/isAfter'\nimport { isBefore } from 'date-fns/isBefore'\nimport { isSameDay } from 'date-fns/isSameDay'\nimport { isWithinInterval } from 'date-fns/isWithinInterval'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { startOfToday } from 'date-fns/startOfToday'\nimport { subDays } from 'date-fns/subDays'\n\nimport { RepeatingTransactionsApi } from '../api'\nimport {\n type Recurrence,\n type RecurringCopy,\n type RepeatingTransaction,\n type Transaction,\n RecurrenceStatus,\n RecurrenceType,\n type DateRange,\n} from '../types'\nimport {\n augmentRepeatingTransactions,\n buildAllRecurrences,\n} from '../utils/RecurringTransactionsUtil'\n\nimport { GlobalStore } from './GlobalStore'\n\nconst currentMonthFilter = (date: DateRange, recurrence: Recurrence) =>\n isWithinInterval(recurrence.expectedDate, date)\n\nconst recurrenceTotalReducer = (total: number, recurrence: Recurrence) => total + recurrence.amount\n\ninterface RecurringAlertProps {\n message: string\n severity: AlertProps['severity']\n}\n\nexport class RecurringTransactionsStore {\n globalStore: GlobalStore\n api = new RepeatingTransactionsApi('/', '')\n\n repeatingTransactions: RepeatingTransaction[] = []\n isDataLoaded: boolean = false\n\n selectedDay: Date | undefined\n dateRange: DateRange = { start: startOfMonth(startOfToday()), end: endOfMonth(startOfToday()) }\n selectedRepeatingTransactionGuid: string | null = null\n selectedRecurrence: Recurrence | null = null\n\n alert: RecurringAlertProps = { message: '', severity: undefined }\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new RepeatingTransactionsApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n )\n\n // The *ForRange helpers are parameterized computeds: they must stay plain\n // methods (not actions) so observable reads inside them remain tracked when\n // invoked from an observer/derivation. makeAutoObservable would otherwise\n // annotate them as actions, which do not track reads.\n makeAutoObservable(this, {\n recurrencesForRange: false,\n upcomingExpensesForRange: false,\n upcomingIncomeForRange: false,\n incomeForRange: false,\n nextIncomeForRange: false,\n })\n }\n\n get copy(): RecurringCopy {\n return this.globalStore.copyStore.copy.recurring\n }\n\n get detailedRepeatingTransactions(): RepeatingTransaction[] {\n return augmentRepeatingTransactions(\n this.globalStore.accountStore.visibleAccounts,\n this.repeatingTransactions,\n this.globalStore.transactionStore.transactions,\n )\n }\n\n /**\n * Returns all recurrences built from repeating transactions and filtered by\n * accounts, scoped to the supplied date range. This is the range-parameterized\n * core used by both the shared getters (which pass this.dateRange) and by\n * consumers such as Cash Flow that need their own independent window without\n * mutating the shared dateRange.\n */\n recurrencesForRange = (dateRange: DateRange): Recurrence[] => {\n const accounts = this.globalStore.accountStore.visibleAccounts\n\n return buildAllRecurrences(this.detailedRepeatingTransactions, dateRange)\n .filter((r) => accounts.some((a) => a.guid === r.accountGuid && !a.is_excluded_from_accounts))\n .filter((r) => isWithinInterval(r.expectedDate, dateRange))\n }\n\n /**\n * Returns the upcoming expense recurrences scoped to the supplied date range.\n */\n upcomingExpensesForRange = (dateRange: DateRange): Recurrence[] => {\n return this.recurrencesForRange(dateRange).filter(\n (recurrence: Recurrence) =>\n recurrence.type === RecurrenceType.Expense &&\n recurrence.status === RecurrenceStatus.Upcoming,\n )\n }\n\n /**\n * Returns the income recurrences scoped to the supplied date range.\n */\n incomeForRange = (dateRange: DateRange): Recurrence[] => {\n return this.recurrencesForRange(dateRange).filter(\n (recurrence: Recurrence) => recurrence.type === RecurrenceType.Income,\n )\n }\n\n /**\n * Returns the upcoming income recurrences scoped to the supplied date range.\n */\n upcomingIncomeForRange = (dateRange: DateRange): Recurrence[] => {\n return this.incomeForRange(dateRange).filter(\n (recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Upcoming,\n )\n }\n\n /**\n * Returns the next upcoming income recurrence scoped to the supplied range.\n */\n nextIncomeForRange = (dateRange: DateRange): Recurrence | undefined => {\n return this.upcomingIncomeForRange(dateRange).find((r) =>\n isAfter(r.expectedDate, startOfToday()),\n )\n }\n\n /**\n * Returns all recurrences built from repeating transactions and filtered by accounts.\n */\n get recurrences(): Recurrence[] {\n return this.recurrencesForRange(this.dateRange)\n }\n\n /**\n * Returns all recurrences that have occurred in the past, including those that are paid or missed\n */\n get pastRecurrences(): Recurrence[] {\n return this.recurrences.filter(\n (recurrence: Recurrence) =>\n recurrence.status === RecurrenceStatus.Paid ||\n recurrence.status === RecurrenceStatus.Missed,\n )\n }\n\n /**\n * Returns all recurrences that are expected to occur through the end of the month\n * or should have occurred in the last 3 days.\n */\n get upcomingRecurrences(): Recurrence[] {\n return this.recurrences.filter(\n (r) =>\n isAfter(r.expectedDate, subDays(startOfToday(), 3)) &&\n isBefore(r.expectedDate, this.dateRange.end) &&\n r.status === RecurrenceStatus.Upcoming,\n )\n }\n\n /**\n * Returns all expense recurrences.\n */\n get expenses(): Recurrence[] {\n return this.recurrences.filter(\n (recurrence: Recurrence) => recurrence.type === RecurrenceType.Expense,\n )\n }\n\n /**\n * Returns the upcoming expense recurrences.\n */\n get upcomingExpenses(): Recurrence[] {\n return this.expenses.filter(\n (recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Upcoming,\n )\n }\n\n /**\n * Returns all income recurrences.\n */\n get income(): Recurrence[] {\n return this.recurrences.filter(\n (recurrence: Recurrence) => recurrence.type === RecurrenceType.Income,\n )\n }\n\n /**\n * Returns the upcoming income recurrences.\n */\n get upcomingIncome(): Recurrence[] {\n return this.income.filter(\n (recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Upcoming,\n )\n }\n\n get nextIncomeRecurrence() {\n return this.upcomingIncome.find((r) => isAfter(r.expectedDate, startOfToday()))\n }\n\n /**\n * Returns the expense recurrences for the current month.\n */\n get currentMonthExpenses(): Recurrence[] {\n return this.expenses.filter((recurrence: Recurrence) =>\n currentMonthFilter(this.dateRange, recurrence),\n )\n }\n\n /**\n * Returns the income recurrences for the current month.\n */\n get currentMonthIncome(): Recurrence[] {\n return this.income.filter((recurrence: Recurrence) =>\n currentMonthFilter(this.dateRange, recurrence),\n )\n }\n\n /**\n * Calculates the total amount of all expenses for the current month.\n */\n get expenseTotal(): number {\n return this.currentMonthExpenses.reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Calculates the total amount of all paid expenses for the current month.\n */\n get paidExpenseTotal(): number {\n return this.currentMonthExpenses\n .filter((recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Paid)\n .reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Calculates the total amount of all missed expenses for the current month.\n */\n get missedExpenseTotal(): number {\n return this.currentMonthExpenses\n .filter((recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Missed)\n .reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Calculates the total amount of all upcoming expenses for the current month.\n */\n get upcomingExpenseTotal(): number {\n return this.currentMonthExpenses\n .filter((recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Upcoming)\n .reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Calculates the total amount of all income for the current month.\n */\n get incomeTotal(): number {\n return this.currentMonthIncome.reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Calculates the total amount of all paid income for the current month.\n */\n get paidIncomeTotal(): number {\n return this.currentMonthIncome\n .filter((recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Paid)\n .reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Calculates the total amount of all upcoming income for the current month.\n */\n get upcomingIncomeTotal(): number {\n return this.currentMonthIncome\n .filter((recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Upcoming)\n .reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Get the recurrences for the currently selected day.\n */\n get selectedDayRecurrences(): Recurrence[] | undefined {\n return (\n this.selectedDay &&\n this.recurrences.filter(\n (recurrence: Recurrence) =>\n this.selectedDay &&\n isSameDay(recurrence.occurredOnDate || recurrence.expectedDate, this.selectedDay),\n )\n )\n }\n\n get selectedRepeatingTransaction(): RepeatingTransaction | undefined {\n return this.selectedRepeatingTransactionGuid\n ? this.detailedRepeatingTransactions.find(\n (rt) => rt.guid === this.selectedRepeatingTransactionGuid,\n )\n : undefined\n }\n\n setSelectedRepeatingTransactionGuid = (guid: string | null) =>\n (this.selectedRepeatingTransactionGuid = guid)\n\n setSelectedRecurrence = (recurrence: Recurrence | null) => (this.selectedRecurrence = recurrence)\n\n setRepeatingTransactions = (repeating: RepeatingTransaction[]) => {\n this.repeatingTransactions = repeating\n this.isDataLoaded = true\n }\n\n /**\n * Set the date range for filtering recurrences.\n * @param dateRange - The date range to set.\n */\n setDateRange = (dateRange: DateRange) => (this.dateRange = dateRange)\n\n /**\n * Set the currently selected day.\n * @param day - The day to select.\n */\n setSelectedDay = (day: Date) => {\n this.selectedDay = this.selectedDay && isSameDay(day, this.selectedDay) ? undefined : day\n }\n\n loadRepeatingTransactionData = async () => {\n await Promise.all([\n this.globalStore.accountStore.loadAccountData(),\n this.globalStore.categoryStore.loadCategories(),\n this.globalStore.transactionStore.loadTransactionData(),\n ])\n await this.loadRepeatingTransactions()\n }\n\n /**\n * Load repeating transactions and augment them with additional data.\n */\n loadRepeatingTransactions = async () => {\n try {\n const repeatingTransactions = await this.api.getRepeatingTransactions()\n this.setRepeatingTransactions(repeatingTransactions)\n } catch (error) {\n this.captureError('getRepeatingTransactions', error)\n }\n }\n\n /**\n * Add a new repeating transaction and link it to the associated transaction.\n * @param repeatingTransaction - The repeating transaction to add.\n * @param transaction - The transaction associated with the repeating transaction.\n */\n addRepeatingTransaction = async (\n repeatingTransaction: RepeatingTransaction,\n transaction: Transaction,\n ): Promise<boolean> => {\n try {\n const newRepeating = await this.api.addRepeatingTransaction(repeatingTransaction)\n\n await this.globalStore.transactionStore.updateTransaction({\n ...transaction,\n repeating_transaction_guid: newRepeating.guid,\n })\n\n runInAction(() => {\n this.repeatingTransactions = [\n ...this.repeatingTransactions,\n ...augmentRepeatingTransactions(\n this.globalStore.accountStore.visibleAccounts,\n [newRepeating],\n this.globalStore.transactionStore.transactions,\n ),\n ]\n })\n\n this.setAlert(this.copy.add_repeating_transaction_success, 'success')\n\n return true\n } catch (error) {\n this.captureError('addRepeatingTransaction', error)\n this.setAlert(this.copy.add_repeating_transaction_error, 'error')\n\n return false\n }\n }\n\n /**\n * Delete a repeating transaction by its GUID.\n * @param guid - The GUID of the repeating transaction to delete.\n */\n deleteRepeatingTransaction = async (guid: string): Promise<boolean> => {\n try {\n await this.api.deleteRepeatingTransaction(guid)\n\n runInAction(() => {\n this.repeatingTransactions = this.repeatingTransactions.filter((rt) => rt.guid !== guid)\n })\n\n this.setAlert(this.copy.remove_repeating_transaction_success, 'success')\n\n return true\n } catch (error) {\n this.captureError('deleteRepeatingTransaction', error)\n this.setAlert(this.copy.remove_repeating_transaction_error, 'error')\n\n return false\n }\n }\n\n /**\n * Update an existing repeating transaction.\n * @param transaction - The repeating transaction to update.\n */\n updateRepeatingTransaction = async (transaction: RepeatingTransaction): Promise<boolean> => {\n try {\n const updatedTransaction = await this.api.updateRepeatingTransaction(transaction)\n\n const index = this.repeatingTransactions.findIndex(\n (rt) => rt.guid === updatedTransaction.guid,\n )\n if (index < 0) return false\n\n runInAction(() => {\n this.repeatingTransactions = [\n ...this.repeatingTransactions.slice(0, index),\n ...augmentRepeatingTransactions(\n this.globalStore.accountStore.visibleAccounts,\n [updatedTransaction],\n this.globalStore.transactionStore.transactions,\n ),\n ...this.repeatingTransactions.slice(index + 1),\n ]\n })\n\n this.setAlert(this.copy.update_repeating_transaction_success, 'success')\n\n return true\n } catch (error) {\n this.captureError('updateRepeatingTransaction', error)\n this.setAlert(this.copy.update_repeating_transaction_error, 'error')\n\n return false\n }\n }\n\n /**\n * Mark a recurrence as paid by linking a transaction to the repeating transaction.\n * @param repeatingTransactionGuid - The GUID of the repeating transaction.\n * @param transaction - The transaction to link.\n */\n markRecurrenceAsPaid = async (repeatingTransactionGuid: string, transaction: Transaction) => {\n try {\n await this.globalStore.transactionStore.updateTransaction({\n ...transaction,\n repeating_transaction_guid: repeatingTransactionGuid,\n })\n\n await this.loadRepeatingTransactions()\n this.setSelectedRecurrence(null)\n this.setAlert(this.copy.link_transaction_success, 'success')\n } catch (error) {\n this.captureError('markRecurrenceAsPaid', error)\n this.setAlert(this.copy.link_transaction_error, 'error')\n }\n }\n\n /**\n * Mark a recurrence as unpaid by unlinking the associated transaction from the repeating transaction.\n * @param transaction - The transaction to unlink.\n */\n markRecurrenceAsUnpaid = async (transaction: Transaction) => {\n try {\n await this.globalStore.transactionStore.updateTransaction({\n ...transaction,\n repeating_transaction_guid: null,\n })\n\n await this.loadRepeatingTransactions()\n this.setSelectedRecurrence(null)\n this.setAlert(this.copy.unlink_transaction_success, 'success')\n } catch (error) {\n this.captureError('markRecurrenceAsUnpaid', error)\n this.setAlert(this.copy.unlink_transaction_error, 'error')\n }\n }\n\n private captureError = (action: string, error: unknown) =>\n this.globalStore.captureException(error, { store: 'RecurringTransactionsStore', action })\n\n setAlert = (message: string, severity: RecurringAlertProps['severity'] = undefined) =>\n (this.alert = { message, severity })\n}\n"],"mappings":";;;;;;;;;;;;AA4BA,IAAM,IAAA,CAAsB,GAAiB,MAC3C,EAAiB,EAAW,cAAc,CAAI,GAE1C,IAAA,CAA0B,GAAe,MAA2B,IAAQ,EAAW,QAOhF,IAAb,MAAwC;AAAA,EACtC;AAAA,EACA,MAAM,IAAI,EAAyB,KAAK,EAAE;AAAA,EAE1C,wBAAgD,CAAC;AAAA,EACjD,eAAwB;AAAA,EAExB;AAAA,EACA,YAAuB;AAAA,IAAE,OAAO,EAAa,EAAa,CAAC;AAAA,IAAG,KAAK,EAAW,EAAa,CAAC;AAAA,EAAE;AAAA,EAC9F,mCAAkD;AAAA,EAClD,qBAAwC;AAAA,EAExC,QAA6B;AAAA,IAAE,SAAS;AAAA,IAAI,UAAU;AAAA,EAAU;AAAA,EAEhE,YAAY,GAA0B;AACpC,SAAK,cAAc,GACnB,KAAK,MAAM,IAAI,EACb,EAAY,UACZ,EAAY,cACZ,EAAY,OACd,GAMA,EAAmB,MAAM;AAAA,MACvB,qBAAqB;AAAA,MACrB,0BAA0B;AAAA,MAC1B,wBAAwB;AAAA,MACxB,gBAAgB;AAAA,MAChB,oBAAoB;AAAA,IACtB,CAAC;AAAA,EACH;AAAA,EAEA,IAAI,OAAsB;AACxB,WAAO,KAAK,YAAY,UAAU,KAA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,KAAK,KAAK,0BAA0B,OAAO;AAAA,IAC3D;AAAA,EACF;AAAA,EAEA,eAAA,CAAwB,GAAgB,MACtC,KAAK,YAAY,iBAAiB,GAAO;AAAA,IAAE,OAAO;AAAA,IAA8B,QAAA;AAAA,EAAO,CAAC;AAAA,EAE1F,WAAA,CAAY,GAAiB,IAA4C,WACtE,KAAK,QAAQ;AAAA,IAAE,SAAA;AAAA,IAAS,UAAA;AAAA,EAAS;AACtC"}
|
|
1
|
+
{"version":3,"file":"RecurringTransactionsStore.es.js","names":[],"sources":["../../../src/core/stores/RecurringTransactionsStore.ts"],"sourcesContent":["import { type AlertProps } from '@mui/material'\nimport { makeAutoObservable, runInAction } from 'mobx'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { isAfter } from 'date-fns/isAfter'\nimport { isBefore } from 'date-fns/isBefore'\nimport { isSameDay } from 'date-fns/isSameDay'\nimport { isWithinInterval } from 'date-fns/isWithinInterval'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { startOfToday } from 'date-fns/startOfToday'\nimport { subDays } from 'date-fns/subDays'\n\nimport { RepeatingTransactionsApi } from '../api'\nimport {\n type Recurrence,\n type RecurringCopy,\n type RepeatingTransaction,\n type Transaction,\n RecurrenceStatus,\n RecurrenceType,\n type DateRange,\n} from '../types'\nimport {\n augmentRepeatingTransactions,\n buildAllRecurrences,\n} from '../utils/RecurringTransactionsUtil'\n\nimport { GlobalStore } from './GlobalStore'\n\nconst currentMonthFilter = (date: DateRange, recurrence: Recurrence) =>\n isWithinInterval(recurrence.expectedDate, date)\n\nconst recurrenceTotalReducer = (total: number, recurrence: Recurrence) => total + recurrence.amount\n\ninterface RecurringAlertProps {\n message: string\n severity: AlertProps['severity']\n}\n\nexport class RecurringTransactionsStore {\n globalStore: GlobalStore\n api = new RepeatingTransactionsApi('/', '')\n\n repeatingTransactions: RepeatingTransaction[] = []\n isDataLoaded: boolean = false\n\n selectedDay: Date | undefined\n dateRange: DateRange = { start: startOfMonth(startOfToday()), end: endOfMonth(startOfToday()) }\n selectedRepeatingTransactionGuid: string | null = null\n selectedRecurrence: Recurrence | null = null\n\n alert: RecurringAlertProps = { message: '', severity: undefined }\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new RepeatingTransactionsApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n )\n\n // The *ForRange helpers are parameterized computeds: they must stay plain\n // methods (not actions) so observable reads inside them remain tracked when\n // invoked from an observer/derivation. makeAutoObservable would otherwise\n // annotate them as actions, which do not track reads.\n makeAutoObservable(this, {\n recurrencesForRange: false,\n upcomingExpensesForRange: false,\n upcomingIncomeForRange: false,\n incomeForRange: false,\n nextIncomeForRange: false,\n })\n }\n\n get copy(): RecurringCopy {\n return this.globalStore.copyStore.copy.recurring\n }\n\n get detailedRepeatingTransactions(): RepeatingTransaction[] {\n return augmentRepeatingTransactions(\n this.globalStore.accountStore.visibleAccounts,\n this.repeatingTransactions,\n this.globalStore.transactionStore.transactions,\n )\n }\n\n /**\n * Returns all recurrences built from repeating transactions and filtered by\n * accounts, scoped to the supplied date range. This is the range-parameterized\n * core used by both the shared getters (which pass this.dateRange) and by\n * consumers such as Cash Flow that need their own independent window without\n * mutating the shared dateRange.\n */\n recurrencesForRange = (dateRange: DateRange): Recurrence[] => {\n const accounts = this.globalStore.accountStore.visibleAccounts\n\n return buildAllRecurrences(this.detailedRepeatingTransactions, dateRange)\n .filter((r) => accounts.some((a) => a.guid === r.accountGuid && !a.is_excluded_from_accounts))\n .filter((r) => isWithinInterval(r.expectedDate, dateRange))\n }\n\n /**\n * Returns the upcoming expense recurrences scoped to the supplied date range.\n */\n upcomingExpensesForRange = (dateRange: DateRange): Recurrence[] => {\n return this.recurrencesForRange(dateRange).filter(\n (recurrence: Recurrence) =>\n recurrence.type === RecurrenceType.Expense &&\n recurrence.status === RecurrenceStatus.Upcoming,\n )\n }\n\n /**\n * Returns the income recurrences scoped to the supplied date range.\n */\n incomeForRange = (dateRange: DateRange): Recurrence[] => {\n return this.recurrencesForRange(dateRange).filter(\n (recurrence: Recurrence) => recurrence.type === RecurrenceType.Income,\n )\n }\n\n /**\n * Returns the upcoming income recurrences scoped to the supplied date range.\n */\n upcomingIncomeForRange = (dateRange: DateRange): Recurrence[] => {\n return this.incomeForRange(dateRange).filter(\n (recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Upcoming,\n )\n }\n\n /**\n * Returns the next upcoming income recurrence scoped to the supplied range.\n */\n nextIncomeForRange = (dateRange: DateRange): Recurrence | undefined => {\n return this.upcomingIncomeForRange(dateRange).find((r) =>\n isAfter(r.expectedDate, startOfToday()),\n )\n }\n\n /**\n * Returns all recurrences built from repeating transactions and filtered by accounts.\n */\n get recurrences(): Recurrence[] {\n return this.recurrencesForRange(this.dateRange)\n }\n\n /**\n * Returns all recurrences that have occurred in the past, including those that are paid or missed\n */\n get pastRecurrences(): Recurrence[] {\n return this.recurrences.filter(\n (recurrence: Recurrence) =>\n recurrence.status === RecurrenceStatus.Paid ||\n recurrence.status === RecurrenceStatus.Missed,\n )\n }\n\n /**\n * Returns all recurrences that are expected to occur through the end of the month\n * or should have occurred in the last 3 days.\n */\n get upcomingRecurrences(): Recurrence[] {\n return this.recurrences.filter(\n (r) =>\n isAfter(r.expectedDate, subDays(startOfToday(), 3)) &&\n isBefore(r.expectedDate, this.dateRange.end) &&\n r.status === RecurrenceStatus.Upcoming,\n )\n }\n\n /**\n * Returns all expense recurrences.\n */\n get expenses(): Recurrence[] {\n return this.recurrences.filter(\n (recurrence: Recurrence) => recurrence.type === RecurrenceType.Expense,\n )\n }\n\n /**\n * Returns the upcoming expense recurrences.\n */\n get upcomingExpenses(): Recurrence[] {\n return this.expenses.filter(\n (recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Upcoming,\n )\n }\n\n /**\n * Returns all income recurrences.\n */\n get income(): Recurrence[] {\n return this.recurrences.filter(\n (recurrence: Recurrence) => recurrence.type === RecurrenceType.Income,\n )\n }\n\n /**\n * Returns the upcoming income recurrences.\n */\n get upcomingIncome(): Recurrence[] {\n return this.income.filter(\n (recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Upcoming,\n )\n }\n\n get nextIncomeRecurrence() {\n return this.upcomingIncome.find((r) => isAfter(r.expectedDate, startOfToday()))\n }\n\n /**\n * Returns the expense recurrences for the current month.\n */\n get currentMonthExpenses(): Recurrence[] {\n return this.expenses.filter((recurrence: Recurrence) =>\n currentMonthFilter(this.dateRange, recurrence),\n )\n }\n\n /**\n * Returns the income recurrences for the current month.\n */\n get currentMonthIncome(): Recurrence[] {\n return this.income.filter((recurrence: Recurrence) =>\n currentMonthFilter(this.dateRange, recurrence),\n )\n }\n\n /**\n * Calculates the total amount of all expenses for the current month.\n */\n get expenseTotal(): number {\n return this.currentMonthExpenses.reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Calculates the total amount of all paid expenses for the current month.\n */\n get paidExpenseTotal(): number {\n return this.currentMonthExpenses\n .filter((recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Paid)\n .reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Calculates the total amount of all missed expenses for the current month.\n */\n get missedExpenseTotal(): number {\n return this.currentMonthExpenses\n .filter((recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Missed)\n .reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Calculates the total amount of all upcoming expenses for the current month.\n */\n get upcomingExpenseTotal(): number {\n return this.currentMonthExpenses\n .filter((recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Upcoming)\n .reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Calculates the total amount of all income for the current month.\n */\n get incomeTotal(): number {\n return this.currentMonthIncome.reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Calculates the total amount of all paid income for the current month.\n */\n get paidIncomeTotal(): number {\n return this.currentMonthIncome\n .filter((recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Paid)\n .reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Calculates the total amount of all upcoming income for the current month.\n */\n get upcomingIncomeTotal(): number {\n return this.currentMonthIncome\n .filter((recurrence: Recurrence) => recurrence.status === RecurrenceStatus.Upcoming)\n .reduce(recurrenceTotalReducer, 0)\n }\n\n /**\n * Get the recurrences for the currently selected day.\n */\n get selectedDayRecurrences(): Recurrence[] | undefined {\n return (\n this.selectedDay &&\n this.recurrences.filter(\n (recurrence: Recurrence) =>\n this.selectedDay &&\n isSameDay(recurrence.occurredOnDate || recurrence.expectedDate, this.selectedDay),\n )\n )\n }\n\n get selectedRepeatingTransaction(): RepeatingTransaction | undefined {\n return this.selectedRepeatingTransactionGuid\n ? this.detailedRepeatingTransactions.find(\n (rt) => rt.guid === this.selectedRepeatingTransactionGuid,\n )\n : undefined\n }\n\n setSelectedRepeatingTransactionGuid = (guid: string | null) =>\n (this.selectedRepeatingTransactionGuid = guid)\n\n setSelectedRecurrence = (recurrence: Recurrence | null) => (this.selectedRecurrence = recurrence)\n\n setRepeatingTransactions = (repeating: RepeatingTransaction[]) => {\n this.repeatingTransactions = repeating\n this.isDataLoaded = true\n }\n\n /**\n * Set the date range for filtering recurrences.\n * @param dateRange - The date range to set.\n */\n setDateRange = (dateRange: DateRange) => (this.dateRange = dateRange)\n\n /**\n * Set the currently selected day.\n * @param day - The day to select.\n */\n setSelectedDay = (day: Date) => {\n this.selectedDay = this.selectedDay && isSameDay(day, this.selectedDay) ? undefined : day\n }\n\n loadRepeatingTransactionData = async () => {\n await Promise.all([\n this.globalStore.accountStore.loadAccountData(),\n this.globalStore.categoryStore.loadCategories(),\n this.globalStore.transactionStore.loadTransactionData(),\n ])\n await this.loadRepeatingTransactions()\n }\n\n /**\n * Load repeating transactions and augment them with additional data.\n */\n loadRepeatingTransactions = async () => {\n try {\n const repeatingTransactions = await this.api.getRepeatingTransactions()\n this.setRepeatingTransactions(repeatingTransactions)\n } catch (error) {\n this.captureError('getRepeatingTransactions', error)\n }\n }\n\n /**\n * Add a new repeating transaction and link it to the associated transaction.\n * @param repeatingTransaction - The repeating transaction to add.\n * @param transaction - The transaction associated with the repeating transaction.\n */\n addRepeatingTransaction = async (\n repeatingTransaction: RepeatingTransaction,\n transaction: Transaction,\n ): Promise<boolean> => {\n try {\n const newRepeating = await this.api.addRepeatingTransaction(repeatingTransaction)\n\n await this.globalStore.transactionStore.updateTransaction({\n ...transaction,\n repeating_transaction_guid: newRepeating.guid,\n })\n\n runInAction(() => {\n this.repeatingTransactions = [\n ...this.repeatingTransactions,\n ...augmentRepeatingTransactions(\n this.globalStore.accountStore.visibleAccounts,\n [newRepeating],\n this.globalStore.transactionStore.transactions,\n ),\n ]\n })\n\n this.setAlert(this.copy.add_repeating_transaction_success, 'success')\n\n return true\n } catch (error) {\n this.captureError('addRepeatingTransaction', error)\n this.setAlert(this.copy.add_repeating_transaction_error, 'error')\n\n return false\n }\n }\n\n /**\n * Delete a repeating transaction by its GUID.\n * @param guid - The GUID of the repeating transaction to delete.\n */\n deleteRepeatingTransaction = async (guid: string): Promise<boolean> => {\n try {\n await this.api.deleteRepeatingTransaction(guid)\n\n runInAction(() => {\n this.repeatingTransactions = this.repeatingTransactions.filter((rt) => rt.guid !== guid)\n })\n\n this.setAlert(this.copy.remove_repeating_transaction_success, 'success')\n\n return true\n } catch (error) {\n this.captureError('deleteRepeatingTransaction', error)\n this.setAlert(this.copy.remove_repeating_transaction_error, 'error')\n\n return false\n }\n }\n\n /**\n * Update an existing repeating transaction.\n * @param transaction - The repeating transaction to update.\n */\n updateRepeatingTransaction = async (transaction: RepeatingTransaction): Promise<boolean> => {\n try {\n const updatedTransaction = await this.api.updateRepeatingTransaction(transaction)\n\n const index = this.repeatingTransactions.findIndex(\n (rt) => rt.guid === updatedTransaction.guid,\n )\n if (index < 0) return false\n\n // augmentRepeatingTransactions returns nothing while no transactions are loaded (the insights\n // feed); keep the server's record then rather than drop it.\n const [augmented] = augmentRepeatingTransactions(\n this.globalStore.accountStore.visibleAccounts,\n [updatedTransaction],\n this.globalStore.transactionStore.transactions,\n )\n\n runInAction(() => {\n this.repeatingTransactions = [\n ...this.repeatingTransactions.slice(0, index),\n augmented ?? { ...this.repeatingTransactions[index], ...updatedTransaction },\n ...this.repeatingTransactions.slice(index + 1),\n ]\n })\n\n this.setAlert(this.copy.update_repeating_transaction_success, 'success')\n\n return true\n } catch (error) {\n this.captureError('updateRepeatingTransaction', error)\n this.setAlert(this.copy.update_repeating_transaction_error, 'error')\n\n return false\n }\n }\n\n /**\n * Mark a recurrence as paid by linking a transaction to the repeating transaction.\n * @param repeatingTransactionGuid - The GUID of the repeating transaction.\n * @param transaction - The transaction to link.\n */\n markRecurrenceAsPaid = async (repeatingTransactionGuid: string, transaction: Transaction) => {\n try {\n await this.globalStore.transactionStore.updateTransaction({\n ...transaction,\n repeating_transaction_guid: repeatingTransactionGuid,\n })\n\n await this.loadRepeatingTransactions()\n this.setSelectedRecurrence(null)\n this.setAlert(this.copy.link_transaction_success, 'success')\n } catch (error) {\n this.captureError('markRecurrenceAsPaid', error)\n this.setAlert(this.copy.link_transaction_error, 'error')\n }\n }\n\n /**\n * Mark a recurrence as unpaid by unlinking the associated transaction from the repeating transaction.\n * @param transaction - The transaction to unlink.\n */\n markRecurrenceAsUnpaid = async (transaction: Transaction) => {\n try {\n await this.globalStore.transactionStore.updateTransaction({\n ...transaction,\n repeating_transaction_guid: null,\n })\n\n await this.loadRepeatingTransactions()\n this.setSelectedRecurrence(null)\n this.setAlert(this.copy.unlink_transaction_success, 'success')\n } catch (error) {\n this.captureError('markRecurrenceAsUnpaid', error)\n this.setAlert(this.copy.unlink_transaction_error, 'error')\n }\n }\n\n private captureError = (action: string, error: unknown) =>\n this.globalStore.captureException(error, { store: 'RecurringTransactionsStore', action })\n\n setAlert = (message: string, severity: RecurringAlertProps['severity'] = undefined) =>\n (this.alert = { message, severity })\n}\n"],"mappings":";;;;;;;;;;;;AA4BA,IAAM,IAAA,CAAsB,GAAiB,MAC3C,EAAiB,EAAW,cAAc,CAAI,GAE1C,IAAA,C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A,IACT,SAAS,GAAO;AACd,kBAAK,aAAa,8BAA8B,CAAK,GACrD,KAAK,SAAS,KAAK,KAAK,oCAAoC,OAAO,GAE5D;AAAA,IACT;AAAA,EACF;AAAA,EAOA,uBAAuB,OAAO,GAAkC,MAA6B;AAC3F,QAAI;AACF,YAAM,KAAK,YAAY,iBAAiB,kBAAkB;AAAA,QACxD,GAAG;AAAA,QACH,4BAA4B;AAAA,MAC9B,CAAC,GAED,MAAM,KAAK,0BAA0B,GACrC,KAAK,sBAAsB,IAAI,GAC/B,KAAK,SAAS,KAAK,KAAK,0BAA0B,SAAS;AAAA,IAC7D,SAAS,GAAO;AACd,WAAK,aAAa,wBAAwB,CAAK,GAC/C,KAAK,SAAS,KAAK,KAAK,wBAAwB,OAAO;AAAA,IACzD;AAAA,EACF;AAAA,EAMA,yBAAyB,OAAO,MAA6B;AAC3D,QAAI;AACF,YAAM,KAAK,YAAY,iBAAiB,kBAAkB;AAAA,QACxD,GAAG;AAAA,QACH,4BAA4B;AAAA,MAC9B,CAAC,GAED,MAAM,KAAK,0BAA0B,GACrC,KAAK,sBAAsB,IAAI,GAC/B,KAAK,SAAS,KAAK,KAAK,4BAA4B,SAAS;AAAA,IAC/D,SAAS,GAAO;AACd,WAAK,aAAa,0BAA0B,CAAK,GACjD,KAAK,SAAS,KAAK,KAAK,0BAA0B,OAAO;AAAA,IAC3D;AAAA,EACF;AAAA,EAEA,eAAA,CAAwB,GAAgB,MACtC,KAAK,YAAY,iBAAiB,GAAO;AAAA,IAAE,OAAO;AAAA,IAA8B,QAAA;AAAA,EAAO,CAAC;AAAA,EAE1F,WAAA,CAAY,GAAiB,IAA4C,WACtE,KAAK,QAAQ;AAAA,IAAE,SAAA;AAAA,IAAS,UAAA;AAAA,EAAS;AACtC"}
|
|
@@ -265,7 +265,7 @@ export declare const BlockType: {
|
|
|
265
265
|
readonly NoSpendDaysBlock: "no_spend_days_block";
|
|
266
266
|
readonly RepeatingTransactionBlock: "repeating_transaction_block";
|
|
267
267
|
readonly SaveExtraBlock: "save_extra_block";
|
|
268
|
-
readonly
|
|
268
|
+
readonly SavingsAmountBlock: "savings_amount_block";
|
|
269
269
|
readonly StepChartBlock: "step_chart_block";
|
|
270
270
|
readonly SVGImageBlock: "svg_image_block";
|
|
271
271
|
readonly UpcomingBillBlock: "upcoming_bill_block";
|
|
@@ -340,13 +340,8 @@ export interface InstanceSlot {
|
|
|
340
340
|
merchant_name?: string;
|
|
341
341
|
/** Due date of the projected bill in ISO form (e.g. `2025-10-30`). */
|
|
342
342
|
due_date?: string;
|
|
343
|
-
/** Caption
|
|
343
|
+
/** Caption/label line for the confetti tile (V1 fallback). */
|
|
344
344
|
label?: string;
|
|
345
|
-
/**
|
|
346
|
-
* Whether to render the green gradient slot behind the coupon. Defaults to true. Backend sends
|
|
347
|
-
* `false` when the coupon is embedded in a parent surface that supplies its own background.
|
|
348
|
-
*/
|
|
349
|
-
slot?: boolean;
|
|
350
345
|
/** Billing cadence word that trails the price, e.g. `month` or `year`. */
|
|
351
346
|
cadence?: string;
|
|
352
347
|
/** Secondary line beneath the amount on the standard card, e.g. "Remaining after expenses". */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Insights.es.js","names":[],"sources":["../../../src/core/types/Insights.ts"],"sourcesContent":["// ============ Core InsightsV2 Types ============\n\nimport { InsightsInstanceSlotData } from './InsightsInstanceSlotData'\n\nexport interface ThemedSVGImageProps {\n divProps?: React.HTMLAttributes<HTMLDivElement>\n image: React.ComponentType<React.SVGProps<SVGSVGElement>>\n isMini?: boolean\n}\n\n/**\n * Emitted by a block when the user drills into a specific datum (e.g. clicks a\n * chart bar). Named fields rather than positional args so blocks with differing\n * shapes can extend this without the call sites transposing values.\n */\nexport interface DrilldownPayload {\n chartBarIndex: number\n tabIndex?: number\n transaction_guid?: string\n block?: string\n}\n\n/**\n * Which envelope a beat was fetched with. `embedded` (the transaction-row pill + details-drawer\n * card) and `notification` are V2 additions; a surface asks for one with `widget_type=` on the fetch.\n */\nexport type WidgetType = 'full' | 'mini' | 'micro' | 'embedded' | 'notification'\n\n/**\n * V2: the transaction-row tag, its own small section of the `embedded` envelope (the same grammar\n * as `description` / `footer`, with room for a tone or an icon later). Omitted for an insight that\n * tags no transaction row. It deliberately is *not* `short_title`, which stays a per-variant\n * attribute with a second consumer (the bank-holiday sub-header).\n */\nexport interface Pill {\n text: string\n}\n\n/**\n * V2: facts a drilldown shows that the card does not. On the payload: what every CTA of the card\n * shares (e.g. the account number for the Transaction Details drawer, or the guid list a list drawer\n * shows, `transaction_guids`). On a CTA: the figures that CTA's own drilldown renders (the Transaction\n * List summary header's `amount`, `start_date` / `end_date` and `count`, see `readSummary`). Scalars\n * or string lists, omitted when the insight has none. Never carries copy or user actions (memo,\n * tags, hide, flag come from the transaction store). Values come from the server, so a reader still\n * checks each value's runtime shape.\n */\nexport type DrilldownData = Record<string, string | number | boolean | null | string[]>\n\nexport interface InsightsPayload {\n widget_type: WidgetType\n instance_slot: InstanceSlot\n /**\n * V1 only. The v2 contract carries everything a block needs on `instance_slot.data`,\n * and omits this key entirely (see the LargeTransactionV2 payload). Blocks that still require it\n * get it as a required field through `BlockProps`, which re-declares it.\n */\n instance_slot_data?: InsightsInstanceSlotData\n description: Description\n primary_cta?: PrimaryCTA\n secondary_cta?: SecondaryCTA\n title?: string\n sub_title?: Subtitle\n /**\n * V2 rename of `sub_title`: a flat string, with the logo promoted to the payload-level `logo`\n * field below. `sub_title` wins when both are present.\n */\n subtitle?: string\n /** V2: header logo paired with the flat `subtitle`: an entity guid or a status icon (`LogoRef`). */\n logo?: LogoRef\n /** V2: which design branch the backend picked (e.g. `no_merchant`). */\n variant?: string\n /** V2, `embedded` envelope only: the transaction-row pill. */\n pill?: Pill\n /**\n * V2: drilldown-only facts, e.g. `{ account_number: 'XXXXXXXX043' }`, or the guid list a list\n * drawer shows (`{ transaction_guids: [...] }`).\n */\n drilldown_data?: DrilldownData\n footer?: Footer\n /**\n * V2: the link inside the description: on the full card a drawer of its own (Low Account\n * Balance's \"Transactions ›\"); on mini and micro the card's action, sent instead of `primary_cta`.\n * Absent when the beat has no link.\n */\n in_description_cta?: InDescriptionCTA\n guid: string\n user_guid: string\n client_guid?: string\n /** Template name, e.g. `LargeTransactionV2`. */\n template?: string\n revision?: number\n /** Unix seconds. */\n created_at?: number\n /** Unix seconds. */\n updated_at?: number\n /** Unix seconds. */\n active_at?: number\n displayed_at?: number | null\n dismissed_at: number | null\n cta_clicked_at?: number | null\n has_been_displayed?: boolean\n is_dismissed: boolean\n is_deleted?: boolean\n is_hidden_by_system?: boolean\n is_obsolete?: boolean\n is_refreshable?: boolean\n is_sampled?: boolean\n is_zero_state?: boolean\n status?: string | null\n /**\n * V2 (LargeTransactionV2 onward): the entities the beat is about, carried on the payload so\n * action blocks do not have to reach back out to the beat envelope.\n */\n primary_account_guid?: string | null\n primary_transaction_guid?: string | null\n primary_category_guid?: string | null\n primary_merchant_guid?: string | null\n /**\n * V2: the repeating transaction a subscription beat is about (Upcoming Subscription, Subscription\n * Price Increase). Read by `recurring_transaction_block`, see\n * `actionBlocks/RecurringTransactionBlock/subscriptionBeats.ts`.\n */\n primary_repeating_transaction_guid?: string | null\n}\n\nexport interface Legends {\n label: string\n value: number\n additional_value?: number\n additional_value_type?: string\n value_type?: string\n}\n\nexport interface Logo {\n category_guid?: string\n category_name?: string\n institution_guid?: string\n institution_name?: string\n logo_color?: string\n /** Draw the `logo_name` icon filled (V2 `ICO-` logos). */\n logo_fill?: boolean\n logo_name?: string\n merchant_guid?: string\n merchant_name?: string\n}\n\nexport interface Subtitle {\n logo?: Logo\n text: string\n}\n\n/**\n * A V2 logo, shared by the header (`InsightsPayload.logo`) and every instance-slot row. It takes\n * one of two shapes:\n *\n * - **Entity**: `guid`, whose prefix (`INS-` / `MCH-` / `CAT-`) picks the logo component, plus an\n * optional `fallback_guid` for when that component's asset cannot load. Today that is the\n * category behind an `MCH-` guid, which `MerchantLogo` shows as a tile when the merchant image\n * is missing.\n * - **Status icon**: `icon` (an mx-icons name, e.g. `warning`) and `color` (a theme palette path,\n * e.g. `error.main`), for subheaders that show a state rather than an entity (V1's\n * `logo_name` / `logo_color`).\n *\n * `alt` is the accessible name for either shape. A logo sends one shape; if it sends both, `icon`\n * wins, as `logo_name` does in V1's `SubHeader`.\n */\nexport interface LogoRef {\n alt?: string\n color?: string\n fallback_guid?: string\n guid?: string\n icon?: string\n}\n\nexport interface CategoryLogo {\n category_guid: string\n category_name: string\n}\n\nexport interface MerchantLogo {\n merchant_guid: string\n merchant_name: string\n}\n\nexport interface InstitutionLogo {\n institution_guid: string\n institution_name: string\n}\n\nexport interface Description {\n text: string\n html_text: string\n}\n\n/**\n * Post message a CTA press sends to the host, resolved by the backend for the beat's current\n * state. Absent/null = the backend has not described one: the frontend uses the template's\n * interim `ctaPostMessages` entry if there is one, else sends no message. `payload` carries only\n * beat-specific extras; the frontend always adds `beat_guid`, `beat_template`, `user_guid` and\n * `action_string`.\n */\nexport interface CtaPostMessageMetadata {\n /** Post message event; defaults to `beat/cta`. */\n event?: string | null\n /** Operation the host should perform, e.g. `op_1`, `op_2`, `op_3`. Defaults to `op_1`. */\n action?: string | null\n /** Beat-specific fields merged into the message metadata (account ids, amounts, ...). */\n payload?: Record<string, unknown> | null\n}\n\nexport interface PrimaryCTA {\n label: string\n block: string\n variant?: string | null\n /**\n * What pressing the CTA does beyond opening its block, named by the backend (ditto\n * `primary_cta_action`, passed through by tupac). Looked up in `insights-v2/ctaActions`;\n * null / absent / unknown means the CTA only opens its block or posts its message.\n */\n action_key?: string | null\n metadata?: CtaPostMessageMetadata | null\n /** Figures this CTA's drilldown renders (e.g. a summary header's amount/dates/count). */\n drilldown_data?: DrilldownData\n}\n\nexport interface SecondaryCTA {\n label: string\n /**\n * Drawer block to open. `null` when the CTA opens nothing (ditto `secondary_cta_block: null`,\n * e.g. Fee Detected's \"Contact Support\"): the press posts its message to the host instead.\n */\n block: string | null\n variant?: string | null\n /** See `PrimaryCTA.action_key` (ditto `secondary_cta_action`). */\n action_key?: string | null\n metadata?: CtaPostMessageMetadata | null\n /** Figures this CTA's drilldown renders (e.g. a summary header's amount/dates/count). */\n drilldown_data?: DrilldownData\n}\n\n/**\n * The description link: its label, the action block it opens and, like a CTA's, the variant that\n * tells that block what to show (ditto's `in_description_cta_variant`, e.g. `low_balance`). On mini\n * and micro it words the card's action; `block` is empty when that action opens no drawer.\n */\nexport interface InDescriptionCTA {\n label: string\n block?: string\n variant?: string | null\n action_key?: string | null\n /** Figures this CTA's drilldown renders (e.g. a summary header's amount/dates/count). */\n drilldown_data?: DrilldownData\n}\n\nexport interface Footer {\n /** V1: a pre-formatted date string. */\n date?: string\n /**\n * The account label, on both V1 and V2. The backend resolves the plurality: one account sends\n * its name (e.g. `Epic Bank`), several send a localized count (e.g. `2 Accounts`), none sends\n * `null` (tupac's `footer_account_label` returns nil for a beat with no accounts, as Payday Cash\n * Left Over Status does). There is deliberately no separate `accounts` key.\n */\n account?: string | null\n /**\n * V2 (LargeTransactionV2 onward): unix seconds, formatted by `Footer` for display.\n * Replaces `date`; `date` wins when a beat somehow sends both.\n */\n timestamp?: number\n}\n\n// ============ Instance Slot Types ============\n// Values are the snake_case block names the backend sends on a beat's instance slot; the PascalCase\n// keys stay as friendly references (e.g. BlockType.BarChartBlock === 'bar_chart_block').\nexport const BlockType = {\n AccountBlock: 'account_block',\n AccountSwitchBlock: 'account_switch_block',\n BarChartBlock: 'bar_chart_block',\n BudgetBlock: 'budget_block',\n DirectDepositBlock: 'direct_deposit_block',\n ImageBlock: 'image_block',\n MerchantBlock: 'merchant_block',\n TransactionBlock: 'transaction_block',\n DonutChartBlock: 'donut_chart_block',\n DoubleBarChartBlock: 'double_bar_chart_block',\n DoubleProgressBarBlock: 'double_progress_bar_block',\n DebtsBlock: 'debts_block',\n GoalsBlock: 'goals_block',\n NoSpendDaysBlock: 'no_spend_days_block',\n RepeatingTransactionBlock: 'repeating_transaction_block',\n SaveExtraBlock: 'save_extra_block',\n SavingsOpportunityBlock: 'savings_opportunity_block',\n StepChartBlock: 'step_chart_block',\n SVGImageBlock: 'svg_image_block',\n UpcomingBillBlock: 'upcoming_bill_block',\n UpcomingSubscriptionBlock: 'upcoming_subscription_block',\n WithdrawalBlock: 'withdrawal_block',\n} as const\n\nexport type BlockType = (typeof BlockType)[keyof typeof BlockType]\n\n/**\n * A pre-localized row on a V2 instance slot. The backend resolves the copy and formatting; the\n * logo is a `LogoRef` (an entity guid or a status icon, see `logoFromRef`).\n */\nexport interface InstanceSlotRow {\n amount?: number\n logo?: LogoRef\n primary_text?: string\n secondary_text?: string\n}\n\n/**\n * V2: the slots a block's variant filled, keyed by slot name; ditto owns the names and omits any\n * slot it has no value for (`lib/ditto/blocks/<block>.yml`). Read with `slot()`, which names the\n * kind the caller expects.\n */\nexport interface InstanceSlotData {\n [slot: string]: unknown\n}\n\n/**\n * Reads one slot off a block's `data`; undefined when ditto did not fill it.\n *\n * The caller names the kind, because the slot's kind lives in the block's ditto schema and not\n * here — a block fills slots with whatever its card needs, so no fixed list of kinds would hold\n * (`account_switch_block` alone carries a boolean and `budget_block` a nested object).\n */\nexport const slot = <T = unknown>(\n data: InstanceSlotData | undefined,\n name: string,\n): T | undefined => data?.[name] as T | undefined\n\n/**\n * V2: which block renders this beat's content, and what it renders.\n *\n * `block` is optional: a beat whose template has no ditto config arrives as an empty `{}` and the\n * card renders its copy and CTAs alone, so a reader cannot assume a block is named. One interface\n * with `block` optional rather than a union with `Record<string, never>`, which TypeScript absorbs\n * — that union left `block` reading as required and typed a promise it did not keep.\n *\n * `variant` is optional for the same reason — the empty `{}` carries neither. Every ditto beat\n * file that names a block also names a variant, so a *filled* slot always has one; ditto drops a\n * nil variant rather than sending null, which is why the type is `string | null | undefined`.\n */\nexport interface InstanceSlot {\n block?: BlockType\n variant?: string | null\n /** The slots this block's variant declares in ditto. */\n data?: InstanceSlotData\n // Direct Deposit block (Set Up Direct Deposit, Switch Direct Deposit, Missing\n // Interest Rate): account facts carried flat on the slot, beside `data`.\n /** Primary line on the hero card, e.g. \"Epic Bank Checking, *1234\". */\n account_name?: string\n /** Secondary line beneath the name, e.g. \"Checking Account\" / \"Credit Card\". */\n account_type?: string\n /** Status pill label, e.g. \"Direct Deposit Not Set Up\" / \"Interest Rate: 19.99% APR\". */\n status_text?: string\n institution_guid?: string\n institution_name?: string\n // Shared across multiple V2 component blocks:\n // `amount` — UpcomingBillBlock (projected bill), SavingsOpportunityBlock (coupon),\n // UpcomingSubscriptionBlock (price per cadence).\n // `merchant_guid` / `merchant_name` — UpcomingBillBlock (bill row logo + name),\n // UpcomingSubscriptionBlock (hero logo + name).\n /** Dollar amount (unformatted); the block formats it as currency. */\n amount?: number\n // Withdrawal block (Emergency Fund Withdrawal): one row flat on the slot - `amount` above is the\n // withdrawal, shown with its date line \"{amount_label} {withdrawal_date}\" over the balance row.\n /** Pre-localized lead-in for the date line, e.g. \"Withdrawn on\". */\n amount_label?: string\n /** The withdrawal's calendar day, `YYYY-MM-DD` (e.g. `2026-10-20`); the card formats it. */\n withdrawal_date?: string\n /** Account balance after the withdrawal (unformatted); the card formats it as currency. */\n balance?: number\n /** Pre-localized label for the balance row, e.g. \"Balance\". */\n balance_label?: string\n /** Merchant guid used to render the inline / hero logo via `LogoFromGuid` (`MCH-...`). */\n merchant_guid?: string\n /** Merchant display name — shown as logo alt text and as the merchant/hero label. */\n merchant_name?: string\n // Upcoming Bill block (Projected Bill Payment): the block derives the Sun→Sat week strip\n // around `due_date` at render time.\n /** Due date of the projected bill in ISO form (e.g. `2025-10-30`). */\n due_date?: string\n // Savings Opportunity block (Save An Extra, Potential Savings, Embedded): purely data-driven\n // coupon card. Backend sends the caption and the amount, plus `slot` to toggle the green\n // gradient background when the card is embedded in a parent surface that supplies its own.\n /** Caption shown above the amount, e.g. `Save an extra` or `Potential savings`. */\n label?: string\n /**\n * Whether to render the green gradient slot behind the coupon. Defaults to true. Backend sends\n * `false` when the coupon is embedded in a parent surface that supplies its own background.\n */\n slot?: boolean\n // Upcoming Subscription block: billing cadence for the price pill (`${amount} / ${cadence}`).\n /** Billing cadence word that trails the price, e.g. `month` or `year`. */\n cadence?: string\n // Account block (status on/off-track, deposit, payoff variants): card content carried flat on\n // the slot (the V2 contract drops `instance_slot_data`). `amount`, `label`, `merchant_guid`,\n // `merchant_name`, `institution_guid`, `institution_name` are shared fields declared above.\n /** Secondary line beneath the amount on the standard card, e.g. \"Remaining after expenses\". */\n sub_text?: string\n /** Header bar text (standard card) or the colored category strip label (deposit cards). */\n header_text?: string\n /** Generic-tile icon name used when no merchant/institution logo is available. */\n icon_name?: string\n /** Category guid used to render the deposit-card logo fallback. */\n category_guid?: string\n // Debts block: `amount` is the current balance; the shared account/institution fields above.\n /** Projected payoff date in ISO form (e.g. `2027-03-01`); the block formats it as month + year. */\n payoff_date?: string\n /** Monthly payment toward the debt (unformatted); the block formats it as currency. */\n monthly_payment?: number\n /** Annual interest rate as a percentage (e.g. `19.99`); the block formats it as a percent. */\n interest_rate?: number\n start_date?: string\n no_spend_days?: string[]\n}\n"],"mappings":"AAyUA,IAAa,IAAA,CACX,GACA,MACkB,IAAO,CAAA"}
|
|
1
|
+
{"version":3,"file":"Insights.es.js","names":[],"sources":["../../../src/core/types/Insights.ts"],"sourcesContent":["// ============ Core InsightsV2 Types ============\n\nimport { InsightsInstanceSlotData } from './InsightsInstanceSlotData'\n\nexport interface ThemedSVGImageProps {\n divProps?: React.HTMLAttributes<HTMLDivElement>\n image: React.ComponentType<React.SVGProps<SVGSVGElement>>\n isMini?: boolean\n}\n\n/**\n * Emitted by a block when the user drills into a specific datum (e.g. clicks a\n * chart bar). Named fields rather than positional args so blocks with differing\n * shapes can extend this without the call sites transposing values.\n */\nexport interface DrilldownPayload {\n chartBarIndex: number\n tabIndex?: number\n transaction_guid?: string\n block?: string\n}\n\n/**\n * Which envelope a beat was fetched with. `embedded` (the transaction-row pill + details-drawer\n * card) and `notification` are V2 additions; a surface asks for one with `widget_type=` on the fetch.\n */\nexport type WidgetType = 'full' | 'mini' | 'micro' | 'embedded' | 'notification'\n\n/**\n * V2: the transaction-row tag, its own small section of the `embedded` envelope (the same grammar\n * as `description` / `footer`, with room for a tone or an icon later). Omitted for an insight that\n * tags no transaction row. It deliberately is *not* `short_title`, which stays a per-variant\n * attribute with a second consumer (the bank-holiday sub-header).\n */\nexport interface Pill {\n text: string\n}\n\n/**\n * V2: facts a drilldown shows that the card does not. On the payload: what every CTA of the card\n * shares (e.g. the account number for the Transaction Details drawer, or the guid list a list drawer\n * shows, `transaction_guids`). On a CTA: the figures that CTA's own drilldown renders (the Transaction\n * List summary header's `amount`, `start_date` / `end_date` and `count`, see `readSummary`). Scalars\n * or string lists, omitted when the insight has none. Never carries copy or user actions (memo,\n * tags, hide, flag come from the transaction store). Values come from the server, so a reader still\n * checks each value's runtime shape.\n */\nexport type DrilldownData = Record<string, string | number | boolean | null | string[]>\n\nexport interface InsightsPayload {\n widget_type: WidgetType\n instance_slot: InstanceSlot\n /**\n * V1 only. The v2 contract carries everything a block needs on `instance_slot.data`,\n * and omits this key entirely (see the LargeTransactionV2 payload). Blocks that still require it\n * get it as a required field through `BlockProps`, which re-declares it.\n */\n instance_slot_data?: InsightsInstanceSlotData\n description: Description\n primary_cta?: PrimaryCTA\n secondary_cta?: SecondaryCTA\n title?: string\n sub_title?: Subtitle\n /**\n * V2 rename of `sub_title`: a flat string, with the logo promoted to the payload-level `logo`\n * field below. `sub_title` wins when both are present.\n */\n subtitle?: string\n /** V2: header logo paired with the flat `subtitle`: an entity guid or a status icon (`LogoRef`). */\n logo?: LogoRef\n /** V2: which design branch the backend picked (e.g. `no_merchant`). */\n variant?: string\n /** V2, `embedded` envelope only: the transaction-row pill. */\n pill?: Pill\n /**\n * V2: drilldown-only facts, e.g. `{ account_number: 'XXXXXXXX043' }`, or the guid list a list\n * drawer shows (`{ transaction_guids: [...] }`).\n */\n drilldown_data?: DrilldownData\n footer?: Footer\n /**\n * V2: the link inside the description: on the full card a drawer of its own (Low Account\n * Balance's \"Transactions ›\"); on mini and micro the card's action, sent instead of `primary_cta`.\n * Absent when the beat has no link.\n */\n in_description_cta?: InDescriptionCTA\n guid: string\n user_guid: string\n client_guid?: string\n /** Template name, e.g. `LargeTransactionV2`. */\n template?: string\n revision?: number\n /** Unix seconds. */\n created_at?: number\n /** Unix seconds. */\n updated_at?: number\n /** Unix seconds. */\n active_at?: number\n displayed_at?: number | null\n dismissed_at: number | null\n cta_clicked_at?: number | null\n has_been_displayed?: boolean\n is_dismissed: boolean\n is_deleted?: boolean\n is_hidden_by_system?: boolean\n is_obsolete?: boolean\n is_refreshable?: boolean\n is_sampled?: boolean\n is_zero_state?: boolean\n status?: string | null\n /**\n * V2 (LargeTransactionV2 onward): the entities the beat is about, carried on the payload so\n * action blocks do not have to reach back out to the beat envelope.\n */\n primary_account_guid?: string | null\n primary_transaction_guid?: string | null\n primary_category_guid?: string | null\n primary_merchant_guid?: string | null\n /**\n * V2: the repeating transaction a subscription beat is about (Upcoming Subscription, Subscription\n * Price Increase). Read by `recurring_transaction_block`, see\n * `actionBlocks/RecurringTransactionBlock/subscriptionBeats.ts`.\n */\n primary_repeating_transaction_guid?: string | null\n}\n\nexport interface Legends {\n label: string\n value: number\n additional_value?: number\n additional_value_type?: string\n value_type?: string\n}\n\nexport interface Logo {\n category_guid?: string\n category_name?: string\n institution_guid?: string\n institution_name?: string\n logo_color?: string\n /** Draw the `logo_name` icon filled (V2 `ICO-` logos). */\n logo_fill?: boolean\n logo_name?: string\n merchant_guid?: string\n merchant_name?: string\n}\n\nexport interface Subtitle {\n logo?: Logo\n text: string\n}\n\n/**\n * A V2 logo, shared by the header (`InsightsPayload.logo`) and every instance-slot row. It takes\n * one of two shapes:\n *\n * - **Entity**: `guid`, whose prefix (`INS-` / `MCH-` / `CAT-`) picks the logo component, plus an\n * optional `fallback_guid` for when that component's asset cannot load. Today that is the\n * category behind an `MCH-` guid, which `MerchantLogo` shows as a tile when the merchant image\n * is missing.\n * - **Status icon**: `icon` (an mx-icons name, e.g. `warning`) and `color` (a theme palette path,\n * e.g. `error.main`), for subheaders that show a state rather than an entity (V1's\n * `logo_name` / `logo_color`).\n *\n * `alt` is the accessible name for either shape. A logo sends one shape; if it sends both, `icon`\n * wins, as `logo_name` does in V1's `SubHeader`.\n */\nexport interface LogoRef {\n alt?: string\n color?: string\n fallback_guid?: string\n guid?: string\n icon?: string\n}\n\nexport interface CategoryLogo {\n category_guid: string\n category_name: string\n}\n\nexport interface MerchantLogo {\n merchant_guid: string\n merchant_name: string\n}\n\nexport interface InstitutionLogo {\n institution_guid: string\n institution_name: string\n}\n\nexport interface Description {\n text: string\n html_text: string\n}\n\n/**\n * Post message a CTA press sends to the host, resolved by the backend for the beat's current\n * state. Absent/null = the backend has not described one: the frontend uses the template's\n * interim `ctaPostMessages` entry if there is one, else sends no message. `payload` carries only\n * beat-specific extras; the frontend always adds `beat_guid`, `beat_template`, `user_guid` and\n * `action_string`.\n */\nexport interface CtaPostMessageMetadata {\n /** Post message event; defaults to `beat/cta`. */\n event?: string | null\n /** Operation the host should perform, e.g. `op_1`, `op_2`, `op_3`. Defaults to `op_1`. */\n action?: string | null\n /** Beat-specific fields merged into the message metadata (account ids, amounts, ...). */\n payload?: Record<string, unknown> | null\n}\n\nexport interface PrimaryCTA {\n label: string\n block: string\n variant?: string | null\n /**\n * What pressing the CTA does beyond opening its block, named by the backend (ditto\n * `primary_cta_action`, passed through by tupac). Looked up in `insights-v2/ctaActions`;\n * null / absent / unknown means the CTA only opens its block or posts its message.\n */\n action_key?: string | null\n metadata?: CtaPostMessageMetadata | null\n /** Figures this CTA's drilldown renders (e.g. a summary header's amount/dates/count). */\n drilldown_data?: DrilldownData\n}\n\nexport interface SecondaryCTA {\n label: string\n /**\n * Drawer block to open. `null` when the CTA opens nothing (ditto `secondary_cta_block: null`,\n * e.g. Fee Detected's \"Contact Support\"): the press posts its message to the host instead.\n */\n block: string | null\n variant?: string | null\n /** See `PrimaryCTA.action_key` (ditto `secondary_cta_action`). */\n action_key?: string | null\n metadata?: CtaPostMessageMetadata | null\n /** Figures this CTA's drilldown renders (e.g. a summary header's amount/dates/count). */\n drilldown_data?: DrilldownData\n}\n\n/**\n * The description link: its label, the action block it opens and, like a CTA's, the variant that\n * tells that block what to show (ditto's `in_description_cta_variant`, e.g. `low_balance`). On mini\n * and micro it words the card's action; `block` is empty when that action opens no drawer.\n */\nexport interface InDescriptionCTA {\n label: string\n block?: string\n variant?: string | null\n action_key?: string | null\n /** Figures this CTA's drilldown renders (e.g. a summary header's amount/dates/count). */\n drilldown_data?: DrilldownData\n}\n\nexport interface Footer {\n /** V1: a pre-formatted date string. */\n date?: string\n /**\n * The account label, on both V1 and V2. The backend resolves the plurality: one account sends\n * its name (e.g. `Epic Bank`), several send a localized count (e.g. `2 Accounts`), none sends\n * `null` (tupac's `footer_account_label` returns nil for a beat with no accounts, as Payday Cash\n * Left Over Status does). There is deliberately no separate `accounts` key.\n */\n account?: string | null\n /**\n * V2 (LargeTransactionV2 onward): unix seconds, formatted by `Footer` for display.\n * Replaces `date`; `date` wins when a beat somehow sends both.\n */\n timestamp?: number\n}\n\n// ============ Instance Slot Types ============\n// Values are the snake_case block names the backend sends on a beat's instance slot; the PascalCase\n// keys stay as friendly references (e.g. BlockType.BarChartBlock === 'bar_chart_block').\nexport const BlockType = {\n AccountBlock: 'account_block',\n AccountSwitchBlock: 'account_switch_block',\n BarChartBlock: 'bar_chart_block',\n BudgetBlock: 'budget_block',\n DirectDepositBlock: 'direct_deposit_block',\n ImageBlock: 'image_block',\n MerchantBlock: 'merchant_block',\n TransactionBlock: 'transaction_block',\n DonutChartBlock: 'donut_chart_block',\n DoubleBarChartBlock: 'double_bar_chart_block',\n DoubleProgressBarBlock: 'double_progress_bar_block',\n DebtsBlock: 'debts_block',\n GoalsBlock: 'goals_block',\n NoSpendDaysBlock: 'no_spend_days_block',\n RepeatingTransactionBlock: 'repeating_transaction_block',\n SaveExtraBlock: 'save_extra_block',\n SavingsAmountBlock: 'savings_amount_block',\n StepChartBlock: 'step_chart_block',\n SVGImageBlock: 'svg_image_block',\n UpcomingBillBlock: 'upcoming_bill_block',\n UpcomingSubscriptionBlock: 'upcoming_subscription_block',\n WithdrawalBlock: 'withdrawal_block',\n} as const\n\nexport type BlockType = (typeof BlockType)[keyof typeof BlockType]\n\n/**\n * A pre-localized row on a V2 instance slot. The backend resolves the copy and formatting; the\n * logo is a `LogoRef` (an entity guid or a status icon, see `logoFromRef`).\n */\nexport interface InstanceSlotRow {\n amount?: number\n logo?: LogoRef\n primary_text?: string\n secondary_text?: string\n}\n\n/**\n * V2: the slots a block's variant filled, keyed by slot name; ditto owns the names and omits any\n * slot it has no value for (`lib/ditto/blocks/<block>.yml`). Read with `slot()`, which names the\n * kind the caller expects.\n */\nexport interface InstanceSlotData {\n [slot: string]: unknown\n}\n\n/**\n * Reads one slot off a block's `data`; undefined when ditto did not fill it.\n *\n * The caller names the kind, because the slot's kind lives in the block's ditto schema and not\n * here — a block fills slots with whatever its card needs, so no fixed list of kinds would hold\n * (`account_switch_block` alone carries a boolean and `budget_block` a nested object).\n */\nexport const slot = <T = unknown>(\n data: InstanceSlotData | undefined,\n name: string,\n): T | undefined => data?.[name] as T | undefined\n\n/**\n * V2: which block renders this beat's content, and what it renders.\n *\n * `block` is optional: a beat whose template has no ditto config arrives as an empty `{}` and the\n * card renders its copy and CTAs alone, so a reader cannot assume a block is named. One interface\n * with `block` optional rather than a union with `Record<string, never>`, which TypeScript absorbs\n * — that union left `block` reading as required and typed a promise it did not keep.\n *\n * `variant` is optional for the same reason — the empty `{}` carries neither. Every ditto beat\n * file that names a block also names a variant, so a *filled* slot always has one; ditto drops a\n * nil variant rather than sending null, which is why the type is `string | null | undefined`.\n */\nexport interface InstanceSlot {\n block?: BlockType\n variant?: string | null\n /** The slots this block's variant declares in ditto. */\n data?: InstanceSlotData\n // Direct Deposit block (Set Up Direct Deposit, Switch Direct Deposit, Missing\n // Interest Rate): account facts carried flat on the slot, beside `data`.\n /** Primary line on the hero card, e.g. \"Epic Bank Checking, *1234\". */\n account_name?: string\n /** Secondary line beneath the name, e.g. \"Checking Account\" / \"Credit Card\". */\n account_type?: string\n /** Status pill label, e.g. \"Direct Deposit Not Set Up\" / \"Interest Rate: 19.99% APR\". */\n status_text?: string\n institution_guid?: string\n institution_name?: string\n // Shared across multiple V2 component blocks:\n // `amount` — UpcomingBillBlock (projected bill), UpcomingSubscriptionBlock (price per cadence).\n // (SavingsOpportunityBlock now reads `amount` off `instance_slot.data`, not this flat field.)\n // `merchant_guid` / `merchant_name` — UpcomingBillBlock (bill row logo + name),\n // UpcomingSubscriptionBlock (hero logo + name).\n /** Dollar amount (unformatted); the block formats it as currency. */\n amount?: number\n // Withdrawal block (Emergency Fund Withdrawal): one row flat on the slot - `amount` above is the\n // withdrawal, shown with its date line \"{amount_label} {withdrawal_date}\" over the balance row.\n /** Pre-localized lead-in for the date line, e.g. \"Withdrawn on\". */\n amount_label?: string\n /** The withdrawal's calendar day, `YYYY-MM-DD` (e.g. `2026-10-20`); the card formats it. */\n withdrawal_date?: string\n /** Account balance after the withdrawal (unformatted); the card formats it as currency. */\n balance?: number\n /** Pre-localized label for the balance row, e.g. \"Balance\". */\n balance_label?: string\n /** Merchant guid used to render the inline / hero logo via `LogoFromGuid` (`MCH-...`). */\n merchant_guid?: string\n /** Merchant display name — shown as logo alt text and as the merchant/hero label. */\n merchant_name?: string\n // Upcoming Bill block (Projected Bill Payment): the block derives the Sun→Sat week strip\n // around `due_date` at render time.\n /** Due date of the projected bill in ISO form (e.g. `2025-10-30`). */\n due_date?: string\n // Account block (confetti tile): V1 flat fallback for the label line when `instance_slot.data` is\n // absent — `AccountBlock` reads `data.sub_text` first, then this. (The Savings Opportunity coupon\n // now reads `primary_text`/`amount` off `data`, so it no longer reads this flat field.)\n /** Caption/label line for the confetti tile (V1 fallback). */\n label?: string\n // Upcoming Subscription block: billing cadence for the price pill (`${amount} / ${cadence}`).\n /** Billing cadence word that trails the price, e.g. `month` or `year`. */\n cadence?: string\n // Account block (status on/off-track, deposit, payoff variants): card content carried flat on\n // the slot (the V2 contract drops `instance_slot_data`). `amount`, `label`, `merchant_guid`,\n // `merchant_name`, `institution_guid`, `institution_name` are shared fields declared above.\n /** Secondary line beneath the amount on the standard card, e.g. \"Remaining after expenses\". */\n sub_text?: string\n /** Header bar text (standard card) or the colored category strip label (deposit cards). */\n header_text?: string\n /** Generic-tile icon name used when no merchant/institution logo is available. */\n icon_name?: string\n /** Category guid used to render the deposit-card logo fallback. */\n category_guid?: string\n // Debts block: `amount` is the current balance; the shared account/institution fields above.\n /** Projected payoff date in ISO form (e.g. `2027-03-01`); the block formats it as month + year. */\n payoff_date?: string\n /** Monthly payment toward the debt (unformatted); the block formats it as currency. */\n monthly_payment?: number\n /** Annual interest rate as a percentage (e.g. `19.99`); the block formats it as a percent. */\n interest_rate?: number\n start_date?: string\n no_spend_days?: string[]\n}\n"],"mappings":"AAyUA,IAAa,IAAA,CACX,GACA,MACkB,IAAO,CAAA"}
|
|
@@ -38,6 +38,12 @@ interface GeneralInsightsFeedCopy {
|
|
|
38
38
|
in_month_you_had_a_category_of_amount?: string;
|
|
39
39
|
income_transactions?: string;
|
|
40
40
|
spend_transactions?: string;
|
|
41
|
+
/** Subscription status CTA words: the ✓ / ✗ status and Undo. */
|
|
42
|
+
confirmed?: string;
|
|
43
|
+
incorrect?: string;
|
|
44
|
+
subscribed?: string;
|
|
45
|
+
not_subscribed?: string;
|
|
46
|
+
undo?: string;
|
|
41
47
|
}
|
|
42
48
|
interface SettingsMenuCopy {
|
|
43
49
|
close: string;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import
|
|
3
|
-
import { useGlobalCopyStore as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { useBeatActions as
|
|
1
|
+
import { buildDynamicCopy as z } from "../../../core/utils/Localization.es.js";
|
|
2
|
+
import q from "../../../common/utils/AccountDisplayName.es.js";
|
|
3
|
+
import { useGlobalCopyStore as J, useInsightsV2Store as K, useSettingsStore as Q, useUserStore as X } from "../../../common/context/hooks.es.js";
|
|
4
|
+
import Z from "../../../common/components/Loader.es.js";
|
|
5
|
+
import oo from "../../../common/components/CurrencyDialog.es.js";
|
|
6
|
+
import { useBeatActions as to } from "../../beatActions.es.js";
|
|
7
7
|
import { ANALYTICS_EVENTS_CONFIG as c } from "../../analytics/analyticsEventsConfig.es.js";
|
|
8
|
-
import { useCtaHandler as
|
|
9
|
-
import { useAnalyticsEvent as
|
|
10
|
-
import { getDynamicCtaBasedOnTriggers as
|
|
11
|
-
import { AMOUNT_INPUT_VARIANTS as
|
|
8
|
+
import { useCtaHandler as eo } from "../../ctaActions/useCtaAction.es.js";
|
|
9
|
+
import { useAnalyticsEvent as io } from "../../analytics/useAnalyticsEvent.es.js";
|
|
10
|
+
import { getDynamicCtaBasedOnTriggers as no } from "../util.es.js";
|
|
11
|
+
import { AMOUNT_INPUT_VARIANTS as ro, findLowBalanceProfile as ao, isAmountInputVariant as x, isWholeAmount as so, resolveAmountInputVariant as co, toInputValue as lo } from "./layout.es.js";
|
|
12
12
|
import r from "react";
|
|
13
|
-
import { observer as
|
|
13
|
+
import { observer as uo } from "mobx-react-lite";
|
|
14
14
|
import P from "@mui/material/Stack";
|
|
15
|
-
import { H3 as
|
|
16
|
-
import { Icon as
|
|
15
|
+
import { H3 as mo, InstitutionLogo as po, Text as H } from "@mxenabled/mxui";
|
|
16
|
+
import { Icon as _o } from "@mxenabled/mx-icons";
|
|
17
17
|
import { jsx as e, jsxs as k } from "react/jsx-runtime";
|
|
18
|
-
import
|
|
19
|
-
import
|
|
18
|
+
import fo from "@mui/material/Dialog";
|
|
19
|
+
import ho from "@mui/material/IconButton";
|
|
20
20
|
var w = ({ children: I, closeAriaLabel: i, heading: o, onClose: l }) => {
|
|
21
21
|
const u = r.useId();
|
|
22
|
-
return /* @__PURE__ */ e(
|
|
22
|
+
return /* @__PURE__ */ e(fo, {
|
|
23
23
|
"aria-labelledby": o ? u : void 0,
|
|
24
24
|
maxWidth: "xs",
|
|
25
25
|
onClose: l,
|
|
@@ -31,11 +31,11 @@ var w = ({ children: I, closeAriaLabel: i, heading: o, onClose: l }) => {
|
|
|
31
31
|
position: "relative"
|
|
32
32
|
},
|
|
33
33
|
children: [
|
|
34
|
-
o && /* @__PURE__ */ e(
|
|
34
|
+
o && /* @__PURE__ */ e(mo, {
|
|
35
35
|
id: u,
|
|
36
36
|
children: o
|
|
37
37
|
}),
|
|
38
|
-
/* @__PURE__ */ e(
|
|
38
|
+
/* @__PURE__ */ e(ho, {
|
|
39
39
|
"aria-label": i || "Close",
|
|
40
40
|
onClick: l,
|
|
41
41
|
sx: {
|
|
@@ -43,7 +43,7 @@ var w = ({ children: I, closeAriaLabel: i, heading: o, onClose: l }) => {
|
|
|
43
43
|
right: 8,
|
|
44
44
|
top: 18
|
|
45
45
|
},
|
|
46
|
-
children: /* @__PURE__ */ e(
|
|
46
|
+
children: /* @__PURE__ */ e(_o, {
|
|
47
47
|
name: "close",
|
|
48
48
|
sx: { color: "action.active" }
|
|
49
49
|
})
|
|
@@ -52,20 +52,20 @@ var w = ({ children: I, closeAriaLabel: i, heading: o, onClose: l }) => {
|
|
|
52
52
|
]
|
|
53
53
|
})
|
|
54
54
|
});
|
|
55
|
-
},
|
|
56
|
-
const { common: o, insights_feed: l } =
|
|
55
|
+
}, Bo = uo(function({ beat: i }) {
|
|
56
|
+
const { common: o, insights_feed: l } = J(), { actionDrawer: u, closeActionDrawer: m } = K(), f = Q(), { userInsightProfile: v } = X(), S = eo(i, to()), T = io(), { primary_cta: V, secondary_cta: B, in_description_cta: O } = i.insights_payload ?? {}, G = no(u, V, B, O), s = co(G), a = l?.amount_input_modal, t = s === ro.LOW_BALANCE_THRESHOLD, h = t ? ao(f.notificationProfiles, i.primary_account_guid) : void 0, A = t ? h?.threshold : v?.savings_opportunity_minimum_checking_account_balance, [R, F] = r.useState(t), d = r.useRef(!0);
|
|
57
57
|
r.useEffect(() => (d.current = !0, () => {
|
|
58
58
|
d.current = !1;
|
|
59
59
|
}), []), r.useEffect(() => {
|
|
60
60
|
t && f.loadNotificationProfiles().finally(() => {
|
|
61
|
-
d.current &&
|
|
61
|
+
d.current && F(!1);
|
|
62
62
|
});
|
|
63
63
|
}, [t, f]);
|
|
64
|
-
const [
|
|
65
|
-
if (
|
|
64
|
+
const [M, U] = r.useState(null), [E, C] = r.useState(!1), [$, y] = r.useState(!1), p = M ?? lo(A);
|
|
65
|
+
if (R) return /* @__PURE__ */ e(w, {
|
|
66
66
|
closeAriaLabel: o?.close_aria,
|
|
67
67
|
onClose: m,
|
|
68
|
-
children: /* @__PURE__ */ e(
|
|
68
|
+
children: /* @__PURE__ */ e(Z, {})
|
|
69
69
|
});
|
|
70
70
|
const n = x(s) ? a?.[s] : void 0, b = !!n?.title && !!n.description && !!n.input_label && !!a?.whole_number_error && !!a.save_error && !!o?.save_button && (!t || !!o.cancel_button) && !!o.close_aria;
|
|
71
71
|
if (!a || !n || !b || !(t ? h : v))
|
|
@@ -77,33 +77,33 @@ var w = ({ children: I, closeAriaLabel: i, heading: o, onClose: l }) => {
|
|
|
77
77
|
});
|
|
78
78
|
const D = () => {
|
|
79
79
|
T(t ? c.EDIT_INSIGHT_THRESHOLD_CANCELED : c.EDIT_SAFETY_NET_CANCEL), m();
|
|
80
|
-
}, L = !t && !!
|
|
81
|
-
if (!g ||
|
|
80
|
+
}, L = !t && !!A, N = i.primary_account ? q(i.primary_account) : "", g = so(p), W = p !== "" && !g, Y = async () => {
|
|
81
|
+
if (!g || E) return;
|
|
82
82
|
const _ = Number(p);
|
|
83
83
|
C(!0), y(!1);
|
|
84
|
-
const
|
|
84
|
+
const j = t ? await S("updateNotificationProfileThreshold", {
|
|
85
85
|
profileGuid: h?.guid,
|
|
86
86
|
threshold: _
|
|
87
87
|
}, { analytics: c.EDIT_INSIGHT_THRESHOLD_SAVE }) : await S("updateUserInsightProfile", { fields: { savings_opportunity_minimum_checking_account_balance: _ } }, { analytics: c.EDIT_SAFETY_NET_SAVE });
|
|
88
|
-
d.current && (C(!1),
|
|
88
|
+
d.current && (C(!1), j ? m() : y(!0));
|
|
89
89
|
};
|
|
90
|
-
return /* @__PURE__ */ e(
|
|
90
|
+
return /* @__PURE__ */ e(oo, {
|
|
91
91
|
closeAriaLabel: o.close_aria,
|
|
92
|
-
content:
|
|
93
|
-
errorText:
|
|
92
|
+
content: z(L && n.description_edit || n.description, /* @__PURE__ */ e("strong", { children: N }, "account")),
|
|
93
|
+
errorText: W ? a.whole_number_error : $ ? a.save_error : void 0,
|
|
94
94
|
handleInputChange: (_) => {
|
|
95
|
-
|
|
95
|
+
U(_), y(!1);
|
|
96
96
|
},
|
|
97
97
|
handleInputClick: t ? () => T(c.EDIT_INSIGHT_THRESHOLD_INPUT_SELECTED) : void 0,
|
|
98
98
|
handleModalClose: D,
|
|
99
99
|
handlePrimaryAction: () => {
|
|
100
|
-
|
|
100
|
+
Y();
|
|
101
101
|
},
|
|
102
102
|
handleSecondaryAction: D,
|
|
103
103
|
inputLabel: n.input_label,
|
|
104
104
|
inputValue: p,
|
|
105
105
|
isOpen: !0,
|
|
106
|
-
isPrimaryDisabled:
|
|
106
|
+
isPrimaryDisabled: E || !g,
|
|
107
107
|
primaryText: o.save_button,
|
|
108
108
|
secondaryText: t ? o.cancel_button : void 0,
|
|
109
109
|
subtitle: t && i.primary_account ? /* @__PURE__ */ k(P, {
|
|
@@ -112,7 +112,7 @@ var w = ({ children: I, closeAriaLabel: i, heading: o, onClose: l }) => {
|
|
|
112
112
|
flexDirection: "row",
|
|
113
113
|
gap: 8
|
|
114
114
|
},
|
|
115
|
-
children: [/* @__PURE__ */ e(
|
|
115
|
+
children: [/* @__PURE__ */ e(po, {
|
|
116
116
|
alt: "",
|
|
117
117
|
institutionGuid: i.primary_account.institution_guid ?? "",
|
|
118
118
|
size: 16
|
|
@@ -127,7 +127,7 @@ var w = ({ children: I, closeAriaLabel: i, heading: o, onClose: l }) => {
|
|
|
127
127
|
});
|
|
128
128
|
});
|
|
129
129
|
export {
|
|
130
|
-
|
|
130
|
+
Bo as AmountInputModalBlock
|
|
131
131
|
};
|
|
132
132
|
|
|
133
133
|
//# sourceMappingURL=AmountInputModalBlock.es.js.map
|