@mx-cartographer/experiences 9.5.0-alpha.al0 → 9.5.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.
Files changed (93) hide show
  1. package/CHANGELOG.md +4 -1
  2. package/dist/accounts/components/AccountListItem.es.js +1 -1
  3. package/dist/accounts/components/AccountsList.es.js +1 -1
  4. package/dist/accounts/components/detailsdrawer/Accounts/AccountConnection.es.js +3 -3
  5. package/dist/accounts/components/detailsdrawer/Accounts/ConnectionErrorMessage.es.js +3 -3
  6. package/dist/accounts/utils/AccountFields.es.js +11 -11
  7. package/dist/budgets/BubbleBudgetsMiniWidget.es.js +1 -1
  8. package/dist/budgets/components/Overview.es.js +1 -1
  9. package/dist/budgets/components/addbudget/UnbudgetedRow.es.js +4 -4
  10. package/dist/budgets/components/shared/BudgetDetailsTopSection.es.js +1 -1
  11. package/dist/cashflow/CashflowOnboarding.es.js +57 -55
  12. package/dist/cashflow/CashflowOnboarding.es.js.map +1 -1
  13. package/dist/cashflow/CashflowWidget.es.js +1 -1
  14. package/dist/cashflow/components/SummaryTab.es.js +1 -1
  15. package/dist/common/hooks/index.d.ts +1 -0
  16. package/dist/common/hooks/useRepeatingTransactionEligibility.d.ts +6 -0
  17. package/dist/common/hooks/useRepeatingTransactionEligibility.es.js +12 -0
  18. package/dist/common/hooks/useRepeatingTransactionEligibility.es.js.map +1 -0
  19. package/dist/common/index.es.js +114 -112
  20. package/dist/core/constants/repeatingTransactions.d.ts +5 -2
  21. package/dist/core/constants/repeatingTransactions.es.js +24 -9
  22. package/dist/core/constants/repeatingTransactions.es.js.map +1 -1
  23. package/dist/core/index.es.js +79 -79
  24. package/dist/core/stores/AccountStore.es.js +1 -1
  25. package/dist/core/stores/CashflowStore.es.js +1 -1
  26. package/dist/core/stores/CategoryStore.es.js +1 -1
  27. package/dist/core/stores/FinstrongStore.es.js +4 -4
  28. package/dist/core/stores/GoalStore.es.js +1 -1
  29. package/dist/core/stores/RecurringTransactionsStore.es.js +9 -9
  30. package/dist/core/stores/SettingsStore.es.js +7 -7
  31. package/dist/core/stores/TransactionStore.es.js +13 -13
  32. package/dist/core/utils/BudgetUtil.es.js +1 -1
  33. package/dist/core/utils/DateUtil.es.js +5 -5
  34. package/dist/core/utils/DebtUtils.es.js +6 -6
  35. package/dist/core/utils/RecurringTransactionsUtil.d.ts +13 -1
  36. package/dist/core/utils/RecurringTransactionsUtil.es.js +111 -106
  37. package/dist/core/utils/RecurringTransactionsUtil.es.js.map +1 -1
  38. package/dist/core/utils/TransactionUtils.es.js +6 -6
  39. package/dist/debts/DebtsWidget.es.js +1 -1
  40. package/dist/debts/components/DebtsChart.es.js +4 -4
  41. package/dist/debts/components/DebtsTable.es.js +6 -6
  42. package/dist/debts/components/actions/ExtraPaymentAction.es.js +4 -4
  43. package/dist/debts/components/actions/InterestRateAction.es.js +4 -4
  44. package/dist/debts/components/actions/MonthlyPaymentAction.es.js +4 -4
  45. package/dist/debts/components/actions/OriginalBalanceAction.es.js +4 -4
  46. package/dist/debts/components/debtsdrawer/DebtScheduleTab.es.js +1 -1
  47. package/dist/finstrong/components/MaintainingEmergencySavings/MaintainingEmergencySavingsContent.es.js +4 -4
  48. package/dist/finstrong/components/ProfileDrawer.es.js +1 -1
  49. package/dist/finstrong/components/SaveEnoughToLiveOn/AvailableTabContent.es.js +1 -1
  50. package/dist/finstrong/components/onboarding/OnboardingStepsDrawer.es.js +106 -104
  51. package/dist/finstrong/components/onboarding/OnboardingStepsDrawer.es.js.map +1 -1
  52. package/dist/finstrong/components/shared/Accounts.es.js +4 -4
  53. package/dist/finstrong/components/shared/Transactions.es.js +4 -4
  54. package/dist/goals/GoalsWidget.es.js +7 -7
  55. package/dist/goals/components/AccountSelectionDrawer.es.js +4 -4
  56. package/dist/goals/components/AddGoal.es.js +1 -1
  57. package/dist/goals/components/GoalDetailsDrawer.es.js +1 -1
  58. package/dist/goals/components/ManageGoals.es.js +1 -1
  59. package/dist/goals/components/actions/ChangeAccountAction.es.js +1 -1
  60. package/dist/goals/components/managegoals/OngoingListItem.es.js +4 -4
  61. package/dist/insights/components/shared/DrillDownCalculation/DrillDownCalculation.es.js +1 -1
  62. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +4 -4
  63. package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.es.js +1 -1
  64. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js +1 -1
  65. package/dist/investments/InvestmentsWidget.es.js +7 -7
  66. package/dist/recurringtransactions/components/RecurringTransactionDetails.es.js +10 -10
  67. package/dist/recurringtransactions/components/RecurringTransactionDetailsDrawer.es.js +4 -4
  68. package/dist/recurringtransactions/components/RecurringTransactionList.es.js +10 -10
  69. package/dist/recurringtransactions/components/actions/LinkTransactionDrawer.es.js +4 -4
  70. package/dist/recurringtransactions/components/actions/PaymentScheduleAction.es.js +6 -6
  71. package/dist/recurringtransactions/components/shared/recurringsettings/AddRecurringTransaction.es.js +45 -43
  72. package/dist/recurringtransactions/components/shared/recurringsettings/AddRecurringTransaction.es.js.map +1 -1
  73. package/dist/recurringtransactions/components/shared/recurringsettings/ManageExpenses.es.js +1 -1
  74. package/dist/recurringtransactions/components/shared/recurringsettings/ManageIncome.es.js +1 -1
  75. package/dist/recurringtransactions/components/shared/recurringsettings/RecurringRow.es.js +6 -6
  76. package/dist/recurringtransactions/components/shared/recurringsettings/SelectTransaction.d.ts +7 -1
  77. package/dist/recurringtransactions/components/shared/recurringsettings/SelectTransaction.es.js +15 -16
  78. package/dist/recurringtransactions/components/shared/recurringsettings/SelectTransaction.es.js.map +1 -1
  79. package/dist/settings/components/devices/DeviceList.es.js +1 -1
  80. package/dist/settings/components/devices/DeviceTable.es.js +1 -1
  81. package/dist/settings/components/notifications/AccountProfileListItem.es.js +5 -5
  82. package/dist/settings/components/notifications/NotificationSettings.es.js +1 -1
  83. package/dist/spending/components/SpendingDonut.es.js +1 -1
  84. package/dist/transactions/components/shared/TransactionDetails.es.js +8 -8
  85. package/dist/transactions/components/shared/TransactionList.es.js +4 -4
  86. package/dist/transactions/components/shared/transactiondetails/actions/AddMerchantBudgetAction.es.js +1 -1
  87. package/dist/transactions/components/shared/transactiondetails/actions/DateAction.es.js +6 -6
  88. package/dist/transactions/components/splitmanager/SplitManager.es.js +4 -4
  89. package/dist/transactions/utils/Transactions.es.js +1 -1
  90. package/dist/trends/components/CategoriesListItem.es.js +4 -4
  91. package/dist/trends/components/CategoryDetails.es.js +6 -6
  92. package/dist/trends/components/TrendsChart.es.js +1 -1
  93. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"RecurringTransactionsUtil.es.js","names":[],"sources":["../../../src/core/utils/RecurringTransactionsUtil.ts"],"sourcesContent":["import { addDays } from 'date-fns/addDays'\nimport { addMonths } from 'date-fns/addMonths'\nimport { addQuarters } from 'date-fns/addQuarters'\nimport { addWeeks } from 'date-fns/addWeeks'\nimport { addYears } from 'date-fns/addYears'\nimport { differenceInDays } from 'date-fns/differenceInDays'\nimport { formatISO } from 'date-fns/formatISO'\nimport { fromUnixTime } from 'date-fns/fromUnixTime'\nimport { getUnixTime } from 'date-fns/getUnixTime'\nimport { isAfter } from 'date-fns/isAfter'\nimport { isBefore } from 'date-fns/isBefore'\nimport { isSameDay } from 'date-fns/isSameDay'\nimport { lastDayOfMonth } from 'date-fns/lastDayOfMonth'\nimport { nextDay } from 'date-fns/nextDay'\nimport { parseISO } from 'date-fns/parseISO'\nimport { setDate } from 'date-fns/setDate'\nimport { setDay } from 'date-fns/setDay'\nimport { setDayOfYear } from 'date-fns/setDayOfYear'\nimport { startOfToday } from 'date-fns/startOfToday'\nimport { subDays } from 'date-fns/subDays'\nimport { subMonths } from 'date-fns/subMonths'\nimport { subQuarters } from 'date-fns/subQuarters'\nimport { subWeeks } from 'date-fns/subWeeks'\nimport { subYears } from 'date-fns/subYears'\n\nimport type { Day } from 'date-fns'\n\nimport { DATE_FORMATS_INTL, formatDate } from '../constants'\nimport {\n ALLOWED_MERCHANTLESS_BILL_CATEGORIES,\n ALLOWED_MERCHANTLESS_INCOME_MAIN_CLASSES,\n} from '../constants/repeatingTransactions'\nimport {\n type Account,\n type DateRange,\n type Recurrence,\n type RecurringCopy,\n type RepeatingTransaction,\n type Transaction,\n RecurrenceType,\n RecurrenceStatus,\n RepeatingType,\n Frequency,\n} from '../types'\n\nimport {\n getNextBiMonthlyDate,\n getNextBiQuarterlyDate,\n getNextBiWeeklyDate,\n getNextMonthlyDate,\n getNextQuarterlyDate,\n getNextTwiceMonthlyDate,\n getNextWeeklyDate,\n getNextYearlyDate,\n getTwiceMonthlyDates,\n} from './DateUtil'\nimport { formatOrdinal } from './NumberFormatting'\nimport { buildDynamicCopy } from './Localization'\n\nexport type GroupedRecurrence = {\n recurrences: Recurrence[]\n id: string\n date: Date\n}\n\nexport const buildInstitutionName = (account?: Account) => {\n if (!account) return ''\n\n let name = account.user_name || account.feed_name || ''\n if (account.account_number) {\n name = `${name} *${account.account_number}`\n }\n return name\n}\n\nconst buildRepeatingRecurrences = (\n repeatingTransaction: RepeatingTransaction,\n dateRange: DateRange,\n) => {\n const recurrences: Recurrence[] = []\n\n const isYearly = repeatingTransaction.recurrence_type === Frequency.EveryYear\n\n const pastTransaction = repeatingTransaction.transactions.find(\n (t) => t.repeating_transaction_guid === repeatingTransaction.guid,\n )\n\n /*\n Since past transactions for yearly recurrences can be outside the 90 day data range, we need to display them\n even if there is no past transaction to match to. This will display it without a category, but that's the\n tradeoff until we impove our transactions service to return past transactions for all recurring transactions.\n */\n if (!isYearly && !pastTransaction) return []\n\n const occursOn = parseISO(repeatingTransaction.predicted_occurs_on)\n const baseRecurrence: Recurrence = {\n accountGuid: repeatingTransaction.account?.guid || '',\n amount: repeatingTransaction.amount,\n categoryGuid: pastTransaction?.category_guid || '',\n expectedDate: occursOn,\n frequency: repeatingTransaction.recurrence_type,\n institutionGuid: repeatingTransaction.account?.institution_guid || '',\n institutionName: buildInstitutionName(repeatingTransaction.account),\n merchantGuid: repeatingTransaction.merchant_guid,\n name: repeatingTransaction.description,\n recurrenceDay: repeatingTransaction.recurrence_day,\n repeatingTransactionGuid: repeatingTransaction.guid,\n secondRecurrenceDay: repeatingTransaction.second_recurrence_day,\n status: RecurrenceStatus.Upcoming,\n type:\n repeatingTransaction.repeating_transaction_type === RepeatingType.Income\n ? RecurrenceType.Income\n : RecurrenceType.Expense,\n transaction: undefined,\n }\n\n const startDate = dateRange.start\n const endDate = dateRange.end\n\n switch (repeatingTransaction.recurrence_type) {\n case Frequency.EveryWeek:\n recurrences.push(...getWeeklyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryOtherWeek:\n recurrences.push(...getBiWeeklyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.TwiceAMonth:\n recurrences.push(...getTwiceMonthlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryMonth:\n recurrences.push(...getMonthlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryOtherMonth:\n recurrences.push(...getBiMonthlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryQuarter:\n recurrences.push(...getQuarterlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryOtherQuarter:\n recurrences.push(...getBiQuarterlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryYear:\n recurrences.push(...getYearlyRecurrences(baseRecurrence, startDate, endDate))\n break\n }\n\n // Track which transactions have already been matched to avoid double-counting\n const matchedTransactionGuids = new Set<string>()\n\n for (const recurrence of recurrences) {\n // First, try to find a manually linked transaction (any date)\n const linkedTransactions = repeatingTransaction.transactions.filter(\n (t) =>\n t.repeating_transaction_guid === repeatingTransaction.guid &&\n !matchedTransactionGuids.has(t.guid),\n )\n\n const transaction =\n linkedTransactions.find(\n (t) =>\n t.date > getUnixTime(subDays(recurrence.expectedDate, 5)) &&\n t.date < getUnixTime(addDays(recurrence.expectedDate, 5)),\n ) ||\n (isBefore(recurrence.expectedDate, startOfToday())\n ? linkedTransactions.reduce<Transaction | undefined>((closest, t) => {\n const dist = Math.abs(t.date - getUnixTime(recurrence.expectedDate))\n const closestDist = closest\n ? Math.abs(closest.date - getUnixTime(recurrence.expectedDate))\n : Infinity\n return dist < closestDist ? t : closest\n }, undefined)\n : undefined)\n\n if (transaction) {\n matchedTransactionGuids.add(transaction.guid)\n recurrence.transaction = transaction\n recurrence.status = RecurrenceStatus.Paid\n recurrence.occurredOnDate = fromUnixTime(transaction.date)\n } else if (isBefore(recurrence.expectedDate, subDays(startOfToday(), 3))) {\n recurrence.status = RecurrenceStatus.Missed\n }\n }\n\n return recurrences\n}\n\nconst getWeeklyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const activities: Recurrence[] = []\n\n // Add recurrence for each week for the current month and next month\n let nextDate = nextDay(startDate, baseRecurrence.recurrenceDay as Day)\n while (isBefore(nextDate, endDate)) {\n activities.push({ ...baseRecurrence, expectedDate: nextDate })\n nextDate = nextDay(nextDate, baseRecurrence.recurrenceDay as Day)\n }\n\n return activities\n}\n\nconst getBiWeeklyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n // Determine the first occurrence of the bi-weekly recurrence within the date range\n let nextDate = baseRecurrence.expectedDate\n if (isBefore(nextDate, startDate)) {\n while (isBefore(nextDate, startDate)) {\n nextDate = addWeeks(nextDate, 2)\n }\n } else {\n while (isAfter(nextDate, startDate) || isSameDay(nextDate, startDate)) {\n nextDate = subWeeks(nextDate, 2)\n }\n nextDate = addWeeks(nextDate, 2)\n }\n\n while (isBefore(nextDate, endDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n nextDate = addDays(nextDate, 14)\n }\n\n return recurrences\n}\n\nconst getTwiceMonthlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n let firstOccurrence = setDate(startDate, baseRecurrence.recurrenceDay)\n\n while (isBefore(firstOccurrence, endDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: firstOccurrence })\n firstOccurrence = addMonths(firstOccurrence, 1)\n }\n\n let secondOccurrence =\n baseRecurrence.secondRecurrenceDay && baseRecurrence.secondRecurrenceDay < 28\n ? setDate(startDate, baseRecurrence.secondRecurrenceDay)\n : lastDayOfMonth(startDate)\n\n while (isBefore(secondOccurrence, endDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: secondOccurrence })\n secondOccurrence = addMonths(secondOccurrence, 1)\n }\n\n return recurrences\n}\n\nconst getMonthlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n let expectedDate = setDate(startDate, baseRecurrence.recurrenceDay)\n\n // Add current month's repeating transaction recurrence\n recurrences.push({ ...baseRecurrence, expectedDate })\n\n expectedDate = addMonths(expectedDate, 1)\n while (isBefore(expectedDate, endDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate })\n expectedDate = addMonths(expectedDate, 1)\n }\n\n return recurrences\n}\n\nconst getBiMonthlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n const occursOn = baseRecurrence.expectedDate\n let nextDate = isBefore(occursOn, endDate) ? occursOn : subMonths(occursOn, 2)\n while (isBefore(nextDate, endDate)) {\n if (isAfter(nextDate, startDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n }\n nextDate = addMonths(nextDate, 2)\n }\n\n return recurrences\n}\n\nconst getQuarterlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n const occursOn = baseRecurrence.expectedDate\n let nextDate = isBefore(occursOn, endDate) ? occursOn : subQuarters(occursOn, 1)\n while (isBefore(nextDate, endDate)) {\n if (isAfter(nextDate, startDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n }\n nextDate = addQuarters(nextDate, 1)\n }\n\n return recurrences\n}\n\nconst getBiQuarterlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n const occursOn = baseRecurrence.expectedDate\n let nextDate = isBefore(occursOn, endDate) ? occursOn : subQuarters(occursOn, 2)\n while (isBefore(nextDate, endDate)) {\n if (isAfter(nextDate, startDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n }\n nextDate = addQuarters(nextDate, 2)\n }\n\n return recurrences\n}\n\nconst getYearlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n const occursOn = baseRecurrence.expectedDate\n let nextDate = isBefore(occursOn, endDate) ? occursOn : subYears(occursOn, 1)\n while (isBefore(nextDate, endDate)) {\n if (isAfter(nextDate, startDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n }\n nextDate = addYears(nextDate, 1)\n }\n\n return recurrences\n}\n\nexport const buildAllRecurrences = (\n repeatingTransactions: RepeatingTransaction[],\n dateRange: DateRange,\n) => {\n const recurrences: Recurrence[] = []\n\n for (const repeatingTransaction of repeatingTransactions) {\n const activity = buildRepeatingRecurrences(repeatingTransaction, dateRange)\n recurrences.push(...activity)\n }\n\n return recurrences.sort(\n (a, b) =>\n getUnixTime(a.occurredOnDate || a.expectedDate) -\n getUnixTime(b.occurredOnDate || b.expectedDate),\n )\n}\n\nexport const augmentRepeatingTransactions = (\n accounts: Account[],\n repeatingTransactions: RepeatingTransaction[],\n transactions: Transaction[],\n) => {\n const augmentedRepeatingTransactions: RepeatingTransaction[] = []\n\n for (const repeatingTransaction of repeatingTransactions) {\n const relatedTransactions = transactions.filter(\n (t) => t.repeating_transaction_guid === repeatingTransaction.guid,\n )\n\n if (transactions.length > 0) {\n augmentedRepeatingTransactions.push({\n ...repeatingTransaction,\n account: accounts.find((account) => account.guid === repeatingTransaction.account_guid),\n transactions: relatedTransactions,\n })\n }\n }\n\n return augmentedRepeatingTransactions\n}\n\nexport const groupRecurrencesByDate = (recurrences: Recurrence[]): GroupedRecurrence[] => {\n return recurrences.reduce((groupedRecurrences: GroupedRecurrence[], recurrence) => {\n const dateString = formatISO(recurrence.expectedDate, { representation: 'date' })\n const existingGroup = groupedRecurrences.find(\n (group) => group.date.toString() === recurrence.expectedDate.toString(),\n )\n\n if (existingGroup) {\n existingGroup.recurrences.push(recurrence)\n } else {\n groupedRecurrences.push({\n date: recurrence.expectedDate,\n id: `date-${dateString}`,\n recurrences: [recurrence],\n })\n }\n\n return groupedRecurrences\n }, [])\n}\n\nexport const getFrequencyLabel = (\n copy: RecurringCopy,\n repeatingTransaction: RepeatingTransaction,\n showOrdinal: boolean,\n) => {\n const nextWeekday = nextDay(startOfToday(), repeatingTransaction.recurrence_day as Day)\n const nextAnnualDate = setDayOfYear(startOfToday(), repeatingTransaction.recurrence_day)\n const firstDateOrdinal = formatOrdinal(repeatingTransaction.recurrence_day)\n const secondDateOrdinal = repeatingTransaction.second_recurrence_day\n ? formatOrdinal(repeatingTransaction.second_recurrence_day)\n : ''\n\n let frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.monthly_ordinal, firstDateOrdinal)\n : copy.monthly\n\n switch (repeatingTransaction.recurrence_type) {\n case Frequency.EveryQuarter:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.quarterly_ordinal, firstDateOrdinal)\n : copy.quarterly\n break\n case Frequency.EveryWeek:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(\n copy.weekly_ordinal,\n formatDate(nextWeekday, DATE_FORMATS_INTL.DAY_OF_WEEK),\n )\n : copy.weekly\n break\n case Frequency.EveryYear:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(\n copy.anually_ordinal,\n formatDate(nextAnnualDate, DATE_FORMATS_INTL.MONTH_DAY),\n )\n : copy.anually\n break\n case Frequency.EveryOtherWeek:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(\n copy.every_other_week_ordinal,\n formatDate(nextWeekday, DATE_FORMATS_INTL.DAY_OF_WEEK),\n )\n : copy.every_other_week\n break\n case Frequency.EveryOtherMonth:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.every_other_month_ordinal, firstDateOrdinal)\n : copy.every_other_month\n break\n case Frequency.EveryOtherQuarter:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.every_other_quarter_ordinal, firstDateOrdinal)\n : copy.every_other_quarter\n break\n case Frequency.TwiceAMonth:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.twice_a_month_ordinal, firstDateOrdinal, secondDateOrdinal)\n : copy.twice_a_month\n break\n }\n\n return frequencyLabel as string\n}\n\nexport const getNextPaymentDate = (\n frequency: Frequency,\n date: Date,\n recurrenceDay?: number,\n secondRecurrenceDay?: number,\n) => {\n let baseDate = date\n\n // Apply user selected recurrenceDay based on frequency type\n if (recurrenceDay !== undefined) {\n if (frequency === Frequency.EveryWeek || frequency === Frequency.EveryOtherWeek) {\n baseDate = setDay(date, recurrenceDay)\n } else if (frequency === Frequency.EveryYear) {\n baseDate = setDayOfYear(date, recurrenceDay)\n } else {\n baseDate = setDate(date, recurrenceDay)\n }\n }\n\n let nextDate = baseDate\n\n switch (frequency) {\n case Frequency.EveryWeek:\n nextDate = getNextWeeklyDate(baseDate)\n break\n case Frequency.EveryOtherWeek:\n nextDate = getNextBiWeeklyDate(baseDate)\n break\n case Frequency.TwiceAMonth:\n nextDate = getNextTwiceMonthlyDate(\n recurrenceDay ?? baseDate.getDate(),\n secondRecurrenceDay ?? 28,\n )\n break\n case Frequency.EveryMonth:\n nextDate = getNextMonthlyDate(baseDate)\n break\n case Frequency.EveryOtherMonth:\n nextDate = getNextBiMonthlyDate(baseDate)\n break\n case Frequency.EveryQuarter:\n nextDate = getNextQuarterlyDate(baseDate)\n break\n case Frequency.EveryOtherQuarter:\n nextDate = getNextBiQuarterlyDate(baseDate)\n break\n case Frequency.EveryYear:\n nextDate = getNextYearlyDate(baseDate)\n break\n }\n\n return nextDate\n}\n\nexport const getNextUpcomingDate = (\n recurringTransaction: RepeatingTransaction,\n recurrences: Recurrence[],\n): Date => {\n const nextUpcoming = recurrences.find(\n (r) =>\n r.repeatingTransactionGuid === recurringTransaction.guid &&\n r.status === RecurrenceStatus.Upcoming,\n )\n if (nextUpcoming) return nextUpcoming.expectedDate\n\n const isPaidNearDate = (date: Date) =>\n recurrences.some(\n (r) =>\n r.repeatingTransactionGuid === recurringTransaction.guid &&\n r.status === RecurrenceStatus.Paid &&\n Math.abs(differenceInDays(r.expectedDate, date)) <= 5,\n )\n\n const frequencyAdvancers: Partial<Record<Frequency, (d: Date) => Date>> = {\n [Frequency.EveryWeek]: (d) => addWeeks(d, 1),\n [Frequency.EveryOtherWeek]: (d) => addWeeks(d, 2),\n [Frequency.TwiceAMonth]: (d) => {\n const candidates = getTwiceMonthlyDates(\n recurringTransaction.recurrence_day,\n recurringTransaction.second_recurrence_day ?? 28,\n )\n return candidates.find((c) => isAfter(c, d)) ?? candidates[candidates.length - 1]\n },\n [Frequency.EveryMonth]: (d) => addMonths(d, 1),\n [Frequency.EveryOtherMonth]: (d) => addMonths(d, 2),\n [Frequency.EveryQuarter]: (d) => addMonths(d, 3),\n [Frequency.EveryOtherQuarter]: (d) => addMonths(d, 6),\n [Frequency.EveryYear]: (d) => addYears(d, 1),\n }\n\n const baseNext = getNextPaymentDate(\n recurringTransaction.recurrence_type,\n parseISO(recurringTransaction.predicted_occurs_on),\n recurringTransaction.recurrence_day,\n recurringTransaction.second_recurrence_day,\n )\n\n if (!isPaidNearDate(baseNext)) return baseNext\n\n const advance = frequencyAdvancers[recurringTransaction.recurrence_type]\n return advance ? advance(baseNext) : baseNext\n}\n\nexport const isEligibleRepeatingTransaction = (transaction: Transaction): boolean => {\n if (transaction.merchant_guid && transaction.merchant_guid.trim() !== '') {\n return true\n }\n\n const categoryGuids = [transaction.category_guid, transaction.top_level_category_guid].filter(\n (guid): guid is string => !!guid,\n )\n if (\n categoryGuids.some((guid) =>\n (ALLOWED_MERCHANTLESS_BILL_CATEGORIES as readonly string[]).includes(guid),\n )\n ) {\n return true\n }\n\n if (\n transaction.main_class_guid &&\n (ALLOWED_MERCHANTLESS_INCOME_MAIN_CLASSES as readonly string[]).includes(\n transaction.main_class_guid,\n )\n ) {\n return true\n }\n\n return false\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,IAAa,KAAA,CAAwB,MAAsB;AACzD,MAAI,CAAC,EAAS,QAAO;AAErB,MAAI,IAAO,EAAQ,aAAa,EAAQ,aAAa;AACrD,SAAI,EAAQ,mBACV,IAAO,GAAG,CAAA,KAAS,EAAQ,cAAA,KAEtB;AACT,GAEM,KAAA,CACJ,GACA,MACG;AACH,QAAM,IAA4B,CAAC,GAE7B,IAAW,EAAqB,oBAAoB,EAAU,WAE9D,IAAkB,EAAqB,aAAa,KAAA,CACvD,MAAM,EAAE,+BAA+B,EAAqB,IAC/D;AAOA,MAAI,CAAC,KAAY,CAAC,EAAiB,QAAO,CAAC;AAE3C,QAAM,IAAW,EAAS,EAAqB,mBAAmB,GAC5D,IAA6B;AAAA,IACjC,aAAa,EAAqB,SAAS,QAAQ;AAAA,IACnD,QAAQ,EAAqB;AAAA,IAC7B,cAAc,GAAiB,iBAAiB;AAAA,IAChD,cAAc;AAAA,IACd,WAAW,EAAqB;AAAA,IAChC,iBAAiB,EAAqB,SAAS,oBAAoB;AAAA,IACnE,iBAAiB,GAAqB,EAAqB,OAAO;AAAA,IAClE,cAAc,EAAqB;AAAA,IACnC,MAAM,EAAqB;AAAA,IAC3B,eAAe,EAAqB;AAAA,IACpC,0BAA0B,EAAqB;AAAA,IAC/C,qBAAqB,EAAqB;AAAA,IAC1C,QAAQ,EAAiB;AAAA,IACzB,MACE,EAAqB,+BAA+B,EAAc,SAC9D,EAAe,SACf,EAAe;AAAA,IACrB,aAAa;AAAA,EACf,GAEM,IAAY,EAAU,OACtB,IAAU,EAAU;AAE1B,UAAQ,EAAqB,iBAA7B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AqB,eAAA;AACxD,SAAO,IAAU,EAAQ,CAAQ,IAAI;AACvC,GAEa,KAAA,CAAkC,MACzC,GAAA,EAAY,iBAAiB,EAAY,cAAc,KAAK,MAAM,MAIhD,CAAC,EAAY,eAAe,EAAY,uBAAuB,EAAE,OAAA,CACpF,MAAyB,CAAC,CAAC,CAG5B,EAAc,KAAA,CAAM,MACjB,EAA2D,SAAS,CAAI,CAC3E,KAMA,EAAY,mBACX,EAA+D,SAC9D,EAAY,eACd"}
1
+ {"version":3,"file":"RecurringTransactionsUtil.es.js","names":[],"sources":["../../../src/core/utils/RecurringTransactionsUtil.ts"],"sourcesContent":["import { addDays } from 'date-fns/addDays'\nimport { addMonths } from 'date-fns/addMonths'\nimport { addQuarters } from 'date-fns/addQuarters'\nimport { addWeeks } from 'date-fns/addWeeks'\nimport { addYears } from 'date-fns/addYears'\nimport { differenceInDays } from 'date-fns/differenceInDays'\nimport { formatISO } from 'date-fns/formatISO'\nimport { fromUnixTime } from 'date-fns/fromUnixTime'\nimport { getUnixTime } from 'date-fns/getUnixTime'\nimport { isAfter } from 'date-fns/isAfter'\nimport { isBefore } from 'date-fns/isBefore'\nimport { isSameDay } from 'date-fns/isSameDay'\nimport { lastDayOfMonth } from 'date-fns/lastDayOfMonth'\nimport { nextDay } from 'date-fns/nextDay'\nimport { parseISO } from 'date-fns/parseISO'\nimport { setDate } from 'date-fns/setDate'\nimport { setDay } from 'date-fns/setDay'\nimport { setDayOfYear } from 'date-fns/setDayOfYear'\nimport { startOfToday } from 'date-fns/startOfToday'\nimport { subDays } from 'date-fns/subDays'\nimport { subMonths } from 'date-fns/subMonths'\nimport { subQuarters } from 'date-fns/subQuarters'\nimport { subWeeks } from 'date-fns/subWeeks'\nimport { subYears } from 'date-fns/subYears'\n\nimport type { Day } from 'date-fns'\n\nimport { DATE_FORMATS_INTL, formatDate } from '../constants'\nimport {\n ALLOWED_MERCHANTLESS_BILL_CATEGORIES,\n ALLOWED_MERCHANTLESS_INCOME_MAIN_CLASSES,\n VALID_REPEATING_TRANSACTION_ACCOUNT_TYPES,\n} from '../constants/repeatingTransactions'\nimport {\n type Account,\n type DateRange,\n type Recurrence,\n type RecurringCopy,\n type RepeatingTransaction,\n type Transaction,\n RecurrenceType,\n RecurrenceStatus,\n RepeatingType,\n Frequency,\n} from '../types'\n\nimport {\n getNextBiMonthlyDate,\n getNextBiQuarterlyDate,\n getNextBiWeeklyDate,\n getNextMonthlyDate,\n getNextQuarterlyDate,\n getNextTwiceMonthlyDate,\n getNextWeeklyDate,\n getNextYearlyDate,\n getTwiceMonthlyDates,\n} from './DateUtil'\nimport { formatOrdinal } from './NumberFormatting'\nimport { buildDynamicCopy } from './Localization'\n\nexport type GroupedRecurrence = {\n recurrences: Recurrence[]\n id: string\n date: Date\n}\n\nexport const buildInstitutionName = (account?: Account) => {\n if (!account) return ''\n\n let name = account.user_name || account.feed_name || ''\n if (account.account_number) {\n name = `${name} *${account.account_number}`\n }\n return name\n}\n\nconst buildRepeatingRecurrences = (\n repeatingTransaction: RepeatingTransaction,\n dateRange: DateRange,\n) => {\n const recurrences: Recurrence[] = []\n\n const isYearly = repeatingTransaction.recurrence_type === Frequency.EveryYear\n\n const pastTransaction = repeatingTransaction.transactions.find(\n (t) => t.repeating_transaction_guid === repeatingTransaction.guid,\n )\n\n /*\n Since past transactions for yearly recurrences can be outside the 90 day data range, we need to display them\n even if there is no past transaction to match to. This will display it without a category, but that's the\n tradeoff until we impove our transactions service to return past transactions for all recurring transactions.\n */\n if (!isYearly && !pastTransaction) return []\n\n const occursOn = parseISO(repeatingTransaction.predicted_occurs_on)\n const baseRecurrence: Recurrence = {\n accountGuid: repeatingTransaction.account?.guid || '',\n amount: repeatingTransaction.amount,\n categoryGuid: pastTransaction?.category_guid || '',\n expectedDate: occursOn,\n frequency: repeatingTransaction.recurrence_type,\n institutionGuid: repeatingTransaction.account?.institution_guid || '',\n institutionName: buildInstitutionName(repeatingTransaction.account),\n merchantGuid: repeatingTransaction.merchant_guid,\n name: repeatingTransaction.description,\n recurrenceDay: repeatingTransaction.recurrence_day,\n repeatingTransactionGuid: repeatingTransaction.guid,\n secondRecurrenceDay: repeatingTransaction.second_recurrence_day,\n status: RecurrenceStatus.Upcoming,\n type:\n repeatingTransaction.repeating_transaction_type === RepeatingType.Income\n ? RecurrenceType.Income\n : RecurrenceType.Expense,\n transaction: undefined,\n }\n\n const startDate = dateRange.start\n const endDate = dateRange.end\n\n switch (repeatingTransaction.recurrence_type) {\n case Frequency.EveryWeek:\n recurrences.push(...getWeeklyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryOtherWeek:\n recurrences.push(...getBiWeeklyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.TwiceAMonth:\n recurrences.push(...getTwiceMonthlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryMonth:\n recurrences.push(...getMonthlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryOtherMonth:\n recurrences.push(...getBiMonthlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryQuarter:\n recurrences.push(...getQuarterlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryOtherQuarter:\n recurrences.push(...getBiQuarterlyRecurrences(baseRecurrence, startDate, endDate))\n break\n case Frequency.EveryYear:\n recurrences.push(...getYearlyRecurrences(baseRecurrence, startDate, endDate))\n break\n }\n\n // Track which transactions have already been matched to avoid double-counting\n const matchedTransactionGuids = new Set<string>()\n\n for (const recurrence of recurrences) {\n // First, try to find a manually linked transaction (any date)\n const linkedTransactions = repeatingTransaction.transactions.filter(\n (t) =>\n t.repeating_transaction_guid === repeatingTransaction.guid &&\n !matchedTransactionGuids.has(t.guid),\n )\n\n const transaction =\n linkedTransactions.find(\n (t) =>\n t.date > getUnixTime(subDays(recurrence.expectedDate, 5)) &&\n t.date < getUnixTime(addDays(recurrence.expectedDate, 5)),\n ) ||\n (isBefore(recurrence.expectedDate, startOfToday())\n ? linkedTransactions.reduce<Transaction | undefined>((closest, t) => {\n const dist = Math.abs(t.date - getUnixTime(recurrence.expectedDate))\n const closestDist = closest\n ? Math.abs(closest.date - getUnixTime(recurrence.expectedDate))\n : Infinity\n return dist < closestDist ? t : closest\n }, undefined)\n : undefined)\n\n if (transaction) {\n matchedTransactionGuids.add(transaction.guid)\n recurrence.transaction = transaction\n recurrence.status = RecurrenceStatus.Paid\n recurrence.occurredOnDate = fromUnixTime(transaction.date)\n } else if (isBefore(recurrence.expectedDate, subDays(startOfToday(), 3))) {\n recurrence.status = RecurrenceStatus.Missed\n }\n }\n\n return recurrences\n}\n\nconst getWeeklyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const activities: Recurrence[] = []\n\n // Add recurrence for each week for the current month and next month\n let nextDate = nextDay(startDate, baseRecurrence.recurrenceDay as Day)\n while (isBefore(nextDate, endDate)) {\n activities.push({ ...baseRecurrence, expectedDate: nextDate })\n nextDate = nextDay(nextDate, baseRecurrence.recurrenceDay as Day)\n }\n\n return activities\n}\n\nconst getBiWeeklyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n // Determine the first occurrence of the bi-weekly recurrence within the date range\n let nextDate = baseRecurrence.expectedDate\n if (isBefore(nextDate, startDate)) {\n while (isBefore(nextDate, startDate)) {\n nextDate = addWeeks(nextDate, 2)\n }\n } else {\n while (isAfter(nextDate, startDate) || isSameDay(nextDate, startDate)) {\n nextDate = subWeeks(nextDate, 2)\n }\n nextDate = addWeeks(nextDate, 2)\n }\n\n while (isBefore(nextDate, endDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n nextDate = addDays(nextDate, 14)\n }\n\n return recurrences\n}\n\nconst getTwiceMonthlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n let firstOccurrence = setDate(startDate, baseRecurrence.recurrenceDay)\n\n while (isBefore(firstOccurrence, endDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: firstOccurrence })\n firstOccurrence = addMonths(firstOccurrence, 1)\n }\n\n let secondOccurrence =\n baseRecurrence.secondRecurrenceDay && baseRecurrence.secondRecurrenceDay < 28\n ? setDate(startDate, baseRecurrence.secondRecurrenceDay)\n : lastDayOfMonth(startDate)\n\n while (isBefore(secondOccurrence, endDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: secondOccurrence })\n secondOccurrence = addMonths(secondOccurrence, 1)\n }\n\n return recurrences\n}\n\nconst getMonthlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n let expectedDate = setDate(startDate, baseRecurrence.recurrenceDay)\n\n // Add current month's repeating transaction recurrence\n recurrences.push({ ...baseRecurrence, expectedDate })\n\n expectedDate = addMonths(expectedDate, 1)\n while (isBefore(expectedDate, endDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate })\n expectedDate = addMonths(expectedDate, 1)\n }\n\n return recurrences\n}\n\nconst getBiMonthlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n const occursOn = baseRecurrence.expectedDate\n let nextDate = isBefore(occursOn, endDate) ? occursOn : subMonths(occursOn, 2)\n while (isBefore(nextDate, endDate)) {\n if (isAfter(nextDate, startDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n }\n nextDate = addMonths(nextDate, 2)\n }\n\n return recurrences\n}\n\nconst getQuarterlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n const occursOn = baseRecurrence.expectedDate\n let nextDate = isBefore(occursOn, endDate) ? occursOn : subQuarters(occursOn, 1)\n while (isBefore(nextDate, endDate)) {\n if (isAfter(nextDate, startDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n }\n nextDate = addQuarters(nextDate, 1)\n }\n\n return recurrences\n}\n\nconst getBiQuarterlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n const occursOn = baseRecurrence.expectedDate\n let nextDate = isBefore(occursOn, endDate) ? occursOn : subQuarters(occursOn, 2)\n while (isBefore(nextDate, endDate)) {\n if (isAfter(nextDate, startDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n }\n nextDate = addQuarters(nextDate, 2)\n }\n\n return recurrences\n}\n\nconst getYearlyRecurrences = (baseRecurrence: Recurrence, startDate: Date, endDate: Date) => {\n const recurrences: Recurrence[] = []\n\n const occursOn = baseRecurrence.expectedDate\n let nextDate = isBefore(occursOn, endDate) ? occursOn : subYears(occursOn, 1)\n while (isBefore(nextDate, endDate)) {\n if (isAfter(nextDate, startDate)) {\n recurrences.push({ ...baseRecurrence, expectedDate: nextDate })\n }\n nextDate = addYears(nextDate, 1)\n }\n\n return recurrences\n}\n\nexport const buildAllRecurrences = (\n repeatingTransactions: RepeatingTransaction[],\n dateRange: DateRange,\n) => {\n const recurrences: Recurrence[] = []\n\n for (const repeatingTransaction of repeatingTransactions) {\n const activity = buildRepeatingRecurrences(repeatingTransaction, dateRange)\n recurrences.push(...activity)\n }\n\n return recurrences.sort(\n (a, b) =>\n getUnixTime(a.occurredOnDate || a.expectedDate) -\n getUnixTime(b.occurredOnDate || b.expectedDate),\n )\n}\n\nexport const augmentRepeatingTransactions = (\n accounts: Account[],\n repeatingTransactions: RepeatingTransaction[],\n transactions: Transaction[],\n) => {\n const augmentedRepeatingTransactions: RepeatingTransaction[] = []\n\n for (const repeatingTransaction of repeatingTransactions) {\n const relatedTransactions = transactions.filter(\n (t) => t.repeating_transaction_guid === repeatingTransaction.guid,\n )\n\n if (transactions.length > 0) {\n augmentedRepeatingTransactions.push({\n ...repeatingTransaction,\n account: accounts.find((account) => account.guid === repeatingTransaction.account_guid),\n transactions: relatedTransactions,\n })\n }\n }\n\n return augmentedRepeatingTransactions\n}\n\nexport const groupRecurrencesByDate = (recurrences: Recurrence[]): GroupedRecurrence[] => {\n return recurrences.reduce((groupedRecurrences: GroupedRecurrence[], recurrence) => {\n const dateString = formatISO(recurrence.expectedDate, { representation: 'date' })\n const existingGroup = groupedRecurrences.find(\n (group) => group.date.toString() === recurrence.expectedDate.toString(),\n )\n\n if (existingGroup) {\n existingGroup.recurrences.push(recurrence)\n } else {\n groupedRecurrences.push({\n date: recurrence.expectedDate,\n id: `date-${dateString}`,\n recurrences: [recurrence],\n })\n }\n\n return groupedRecurrences\n }, [])\n}\n\nexport const getFrequencyLabel = (\n copy: RecurringCopy,\n repeatingTransaction: RepeatingTransaction,\n showOrdinal: boolean,\n) => {\n const nextWeekday = nextDay(startOfToday(), repeatingTransaction.recurrence_day as Day)\n const nextAnnualDate = setDayOfYear(startOfToday(), repeatingTransaction.recurrence_day)\n const firstDateOrdinal = formatOrdinal(repeatingTransaction.recurrence_day)\n const secondDateOrdinal = repeatingTransaction.second_recurrence_day\n ? formatOrdinal(repeatingTransaction.second_recurrence_day)\n : ''\n\n let frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.monthly_ordinal, firstDateOrdinal)\n : copy.monthly\n\n switch (repeatingTransaction.recurrence_type) {\n case Frequency.EveryQuarter:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.quarterly_ordinal, firstDateOrdinal)\n : copy.quarterly\n break\n case Frequency.EveryWeek:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(\n copy.weekly_ordinal,\n formatDate(nextWeekday, DATE_FORMATS_INTL.DAY_OF_WEEK),\n )\n : copy.weekly\n break\n case Frequency.EveryYear:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(\n copy.anually_ordinal,\n formatDate(nextAnnualDate, DATE_FORMATS_INTL.MONTH_DAY),\n )\n : copy.anually\n break\n case Frequency.EveryOtherWeek:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(\n copy.every_other_week_ordinal,\n formatDate(nextWeekday, DATE_FORMATS_INTL.DAY_OF_WEEK),\n )\n : copy.every_other_week\n break\n case Frequency.EveryOtherMonth:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.every_other_month_ordinal, firstDateOrdinal)\n : copy.every_other_month\n break\n case Frequency.EveryOtherQuarter:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.every_other_quarter_ordinal, firstDateOrdinal)\n : copy.every_other_quarter\n break\n case Frequency.TwiceAMonth:\n frequencyLabel = showOrdinal\n ? buildDynamicCopy(copy.twice_a_month_ordinal, firstDateOrdinal, secondDateOrdinal)\n : copy.twice_a_month\n break\n }\n\n return frequencyLabel as string\n}\n\nexport const getNextPaymentDate = (\n frequency: Frequency,\n date: Date,\n recurrenceDay?: number,\n secondRecurrenceDay?: number,\n) => {\n let baseDate = date\n\n // Apply user selected recurrenceDay based on frequency type\n if (recurrenceDay !== undefined) {\n if (frequency === Frequency.EveryWeek || frequency === Frequency.EveryOtherWeek) {\n baseDate = setDay(date, recurrenceDay)\n } else if (frequency === Frequency.EveryYear) {\n baseDate = setDayOfYear(date, recurrenceDay)\n } else {\n baseDate = setDate(date, recurrenceDay)\n }\n }\n\n let nextDate = baseDate\n\n switch (frequency) {\n case Frequency.EveryWeek:\n nextDate = getNextWeeklyDate(baseDate)\n break\n case Frequency.EveryOtherWeek:\n nextDate = getNextBiWeeklyDate(baseDate)\n break\n case Frequency.TwiceAMonth:\n nextDate = getNextTwiceMonthlyDate(\n recurrenceDay ?? baseDate.getDate(),\n secondRecurrenceDay ?? 28,\n )\n break\n case Frequency.EveryMonth:\n nextDate = getNextMonthlyDate(baseDate)\n break\n case Frequency.EveryOtherMonth:\n nextDate = getNextBiMonthlyDate(baseDate)\n break\n case Frequency.EveryQuarter:\n nextDate = getNextQuarterlyDate(baseDate)\n break\n case Frequency.EveryOtherQuarter:\n nextDate = getNextBiQuarterlyDate(baseDate)\n break\n case Frequency.EveryYear:\n nextDate = getNextYearlyDate(baseDate)\n break\n }\n\n return nextDate\n}\n\nexport const getNextUpcomingDate = (\n recurringTransaction: RepeatingTransaction,\n recurrences: Recurrence[],\n): Date => {\n const nextUpcoming = recurrences.find(\n (r) =>\n r.repeatingTransactionGuid === recurringTransaction.guid &&\n r.status === RecurrenceStatus.Upcoming,\n )\n if (nextUpcoming) return nextUpcoming.expectedDate\n\n const isPaidNearDate = (date: Date) =>\n recurrences.some(\n (r) =>\n r.repeatingTransactionGuid === recurringTransaction.guid &&\n r.status === RecurrenceStatus.Paid &&\n Math.abs(differenceInDays(r.expectedDate, date)) <= 5,\n )\n\n const frequencyAdvancers: Partial<Record<Frequency, (d: Date) => Date>> = {\n [Frequency.EveryWeek]: (d) => addWeeks(d, 1),\n [Frequency.EveryOtherWeek]: (d) => addWeeks(d, 2),\n [Frequency.TwiceAMonth]: (d) => {\n const candidates = getTwiceMonthlyDates(\n recurringTransaction.recurrence_day,\n recurringTransaction.second_recurrence_day ?? 28,\n )\n return candidates.find((c) => isAfter(c, d)) ?? candidates[candidates.length - 1]\n },\n [Frequency.EveryMonth]: (d) => addMonths(d, 1),\n [Frequency.EveryOtherMonth]: (d) => addMonths(d, 2),\n [Frequency.EveryQuarter]: (d) => addMonths(d, 3),\n [Frequency.EveryOtherQuarter]: (d) => addMonths(d, 6),\n [Frequency.EveryYear]: (d) => addYears(d, 1),\n }\n\n const baseNext = getNextPaymentDate(\n recurringTransaction.recurrence_type,\n parseISO(recurringTransaction.predicted_occurs_on),\n recurringTransaction.recurrence_day,\n recurringTransaction.second_recurrence_day,\n )\n\n if (!isPaidNearDate(baseNext)) return baseNext\n\n const advance = frequencyAdvancers[recurringTransaction.recurrence_type]\n return advance ? advance(baseNext) : baseNext\n}\n\n/**\n * Mirrors Sherlock's recurrence eligibility (`RepeatingTransaction#has_detectable_recurrences` +\n * `Sherlock::Recurrence`): a supported account type, plus either a merchant or a description with\n * an allowlisted leaf bill category or income main class. Only the leaf category counts, so\n * `top_level_category_guid` is deliberately ignored.\n *\n * Description is `payee || description || feed_description` — the value the create flows send and\n * Sherlock validates — so checking the bare `description` would wrongly hide eligible transactions.\n *\n * `account` is required (may be undefined) so a caller can't forget it and silently fail everything;\n * an unresolved account returns false, as Sherlock would never see such a transaction.\n */\nexport const isEligibleRepeatingTransaction = (\n transaction: Transaction,\n account: Account | undefined,\n): boolean => {\n if (!account || !VALID_REPEATING_TRANSACTION_ACCOUNT_TYPES.includes(account.account_type)) {\n return false\n }\n\n if (transaction.merchant_guid && transaction.merchant_guid.trim() !== '') {\n return true\n }\n\n const description = transaction.payee || transaction.description || transaction.feed_description\n if (!description || description.trim() === '') {\n return false\n }\n\n if (\n transaction.category_guid &&\n ALLOWED_MERCHANTLESS_BILL_CATEGORIES.includes(transaction.category_guid)\n ) {\n return true\n }\n\n return Boolean(\n transaction.main_class_guid &&\n ALLOWED_MERCHANTLESS_INCOME_MAIN_CLASSES.includes(transaction.main_class_guid),\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,IAAa,KAAA,CAAwB,MAAsB;AACzD,MAAI,CAAC,EAAS,QAAO;AAErB,MAAI,IAAO,EAAQ,aAAa,EAAQ,aAAa;AACrD,SAAI,EAAQ,mBACV,IAAO,GAAG,CAAA,KAAS,EAAQ,cAAA,KAEtB;AACT,GAEM,KAAA,CACJ,GACA,MACG;AACH,QAAM,IAA4B,CAAC,GAE7B,IAAW,EAAqB,oBAAoB,EAAU,WAE9D,IAAkB,EAAqB,aAAa,KAAA,CACvD,MAAM,EAAE,+BAA+B,EAAqB,IAC/D;AAOA,MAAI,CAAC,KAAY,CAAC,EAAiB,QAAO,CAAC;AAE3C,QAAM,IAAW,EAAS,EAAqB,mBAAmB,GAC5D,IAA6B;AAAA,IACjC,aAAa,EAAqB,SAAS,QAAQ;AAAA,IACnD,QAAQ,EAAqB;AAAA,IAC7B,cAAc,GAAiB,iBAAiB;AAAA,IAChD,cAAc;AAAA,IACd,WAAW,EAAqB;AAAA,IAChC,iBAAiB,EAAqB,SAAS,oBAAoB;AAAA,IACnE,iBAAiB,GAAqB,EAAqB,O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,GAAG,CAAC;AAAA,IAC9C,CAAA,EAAU,iBAAA,GAAA,CAAqB,MAAM,EAAU,GAAG,CAAC;AAAA,IACnD,CAAA,EAAU,SAAA,GAAA,CAAa,MAAM,EAAS,GAAG,CAAC;AAAA,EAC7C,GAEM,IAAW,GACf,EAAqB,iBACrB,EAAS,EAAqB,mBAAmB,GACjD,EAAqB,gBACrB,EAAqB,qBACvB;AAEA,MAAI,CAAC,EAAe,CAAQ,EAAG,QAAO;AAEtC,QAAM,IAAU,EAAmB,EAAqB,eAAA;AACxD,SAAO,IAAU,EAAQ,CAAQ,IAAI;AACvC,GAca,KAAA,CACX,GACA,MACY;AACZ,MAAI,CAAC,KAAW,CAAC,EAA0C,SAAS,EAAQ,YAAY,EACtF,QAAO;AAGT,MAAI,EAAY,iBAAiB,EAAY,cAAc,KAAK,MAAM,GACpE,QAAO;AAGT,QAAM,IAAc,EAAY,SAAS,EAAY,eAAe,EAAY;AAChF,SAAI,CAAC,KAAe,EAAY,KAAK,MAAM,KAClC,KAIP,EAAY,iBACZ,EAAqC,SAAS,EAAY,aAAa,IAEhE,KAGF,GACL,EAAY,mBACZ,EAAyC,SAAS,EAAY,eAAe;AAEjF"}
@@ -1,9 +1,9 @@
1
1
  import { CategoryGuidToName as y, CategoryGuids as T } from "../constants/Category.es.js";
2
2
  import { DATE_FORMATS_INTL as m, formatDate as f } from "../constants/DateFormats.es.js";
3
3
  import { TransactionStatus as C, TransactionType as v } from "../types/Transaction.es.js";
4
- import { getLocalizedCategoryName as A } from "./CategoryUtil.es.js";
5
- import { formatCurrency as O } from "./NumberFormatting.es.js";
6
- import { endOfUtcDay as D, fromUnixUTC as h, startOfUtcDay as E } from "./DateUtil.es.js";
4
+ import { endOfUtcDay as A, fromUnixUTC as h, startOfUtcDay as O } from "./DateUtil.es.js";
5
+ import { formatCurrency as D } from "./NumberFormatting.es.js";
6
+ import { getLocalizedCategoryName as E } from "./CategoryUtil.es.js";
7
7
  import { TABLE_CONST as S } from "../constants/Table.es.js";
8
8
  import { COLUMN_NAMES as _ } from "../constants/Transaction.es.js";
9
9
  import { format as b } from "date-fns/format";
@@ -36,7 +36,7 @@ var X = (t) => t.top_level_category_guid === T.TRANSFER, ee = (t, r, n, d = [],
36
36
  account: s?.user_name || "Unknown",
37
37
  accountIsClosed: s?.is_closed,
38
38
  accountIsHidden: s?.is_hidden,
39
- category: u ? A(u, i) : "Uncategorized",
39
+ category: u ? E(u, i) : "Uncategorized",
40
40
  institutionName: s?.institution?.name || s?.institutionName || void 0,
41
41
  isIncome: e.top_level_category_guid === T.INCOME,
42
42
  isPending: e.feed_status === C.PENDING,
@@ -56,11 +56,11 @@ var X = (t) => t.top_level_category_guid === T.TRANSFER, ee = (t, r, n, d = [],
56
56
  start: N(M()),
57
57
  end: U()
58
58
  }, custom: c = () => !0, searchTerm: o = "", showSplits: a = !1 } = t;
59
- return n.filter((e) => a ? !e.has_been_split : !e.parent_guid).filter((e) => !!d.find((s) => s === e.account_guid)).filter((e) => e.date >= E(i.start) && e.date <= D(i.end)).filter(c).filter((e) => {
59
+ return n.filter((e) => a ? !e.has_been_split : !e.parent_guid).filter((e) => !!d.find((s) => s === e.account_guid)).filter((e) => e.date >= O(i.start) && e.date <= A(i.end)).filter(c).filter((e) => {
60
60
  if (o === L && e.has_been_split) return !1;
61
61
  if (/^spl/i.test(o) && (e.has_been_split || e.parent_guid)) return !0;
62
62
  const s = e.tags.some((g) => p(o, r.find((l) => l.guid === g)?.name)), u = h(e.date);
63
- return p(o, e.payee) || p(o, e.feed_description) || p(o, e.category) || p(o, f(u, m.MONTH)) || p(o, f(u, m.DAY)) || p(o, f(u, m.FULL_MONTH_DAY)) || p(o, f(u, m.MONTH_DAY_YEAR)) || p(o, b(u, "do")) || p(o, e.account) || p(o, O(e.amount, "0,0.00")) || p(o, e.memo) || s;
63
+ return p(o, e.payee) || p(o, e.feed_description) || p(o, e.category) || p(o, f(u, m.MONTH)) || p(o, f(u, m.DAY)) || p(o, f(u, m.FULL_MONTH_DAY)) || p(o, f(u, m.MONTH_DAY_YEAR)) || p(o, b(u, "do")) || p(o, e.account) || p(o, D(e.amount, "0,0.00")) || p(o, e.memo) || s;
64
64
  });
65
65
  }, I = (t, r, n) => [...t].sort((d, i) => {
66
66
  const c = r, o = (d[c] || "") > (i[c] || "");
@@ -1,8 +1,8 @@
1
+ import { AccountType as n } from "../core/types/Account.es.js";
1
2
  import { useAccountStore as Q, useAppConfig as X, useDebtStore as Z, useEvent as tt, useGlobalCopyStore as et, useGlobalUiStore as ot, useGoalStore as rt } from "../common/context/hooks.es.js";
2
3
  import { useScreenSize as nt } from "../common/hooks/useScreenSize.es.js";
3
4
  import { useWidgetLoadTimer as st } from "../common/hooks/useWidgetLoadTimer.es.js";
4
5
  import { ANALYTICS_EVENTS as d } from "../common/constants/Analytics.es.js";
5
- import { AccountType as n } from "../core/types/Account.es.js";
6
6
  import { buildEmptyStateProps as it, transformDebtsChartData as at } from "../core/utils/DebtUtils.es.js";
7
7
  import ct from "../common/components/Loader.es.js";
8
8
  import { WidgetContainer as lt } from "../common/components/WidgetContainer.es.js";
@@ -1,7 +1,7 @@
1
1
  import { DATE_FORMATS_INTL as C, formatDate as k } from "../../core/constants/DateFormats.es.js";
2
2
  import { useEvent as _ } from "../../common/context/hooks.es.js";
3
- import { ANALYTICS_EVENTS as D } from "../../common/constants/Analytics.es.js";
4
- import { formatCurrency as v } from "../../core/utils/NumberFormatting.es.js";
3
+ import { formatCurrency as D } from "../../core/utils/NumberFormatting.es.js";
4
+ import { ANALYTICS_EVENTS as v } from "../../common/constants/Analytics.es.js";
5
5
  import { BASE_LINE_COLOR as S, adjustBrightness as w } from "../utils/DebtsChart.es.js";
6
6
  import "react";
7
7
  import { jsx as d } from "react/jsx-runtime";
@@ -81,7 +81,7 @@ var K = ({ sx: g, height: f = 500, width: y, debts: A, hoveredDebtGuid: l, onCli
81
81
  onAreaClick: (t, e) => {
82
82
  T?.();
83
83
  const a = r.find((n) => n.id === e.seriesId);
84
- b(D.DEBTS_CLICK_CHART_AREA, { account_guid: a?.guid });
84
+ b(v.DEBTS_CLICK_CHART_AREA, { account_guid: a?.guid });
85
85
  },
86
86
  onHighlightChange: (t) => {
87
87
  const e = r.find((a) => a.id === t?.seriesId)?.guid;
@@ -123,7 +123,7 @@ var K = ({ sx: g, height: f = 500, width: y, debts: A, hoveredDebtGuid: l, onCli
123
123
  min: 0,
124
124
  max: E,
125
125
  disableTicks: !0,
126
- valueFormatter: (t) => v(t, "0a")
126
+ valueFormatter: (t) => D(t, "0a")
127
127
  }]
128
128
  })
129
129
  });
@@ -1,8 +1,8 @@
1
1
  import { DATE_FORMATS_INTL as w, formatDate as E } from "../../core/constants/DateFormats.es.js";
2
2
  import { useEvent as M, useGlobalCopyStore as R } from "../../common/context/hooks.es.js";
3
3
  import { useScreenSize as H } from "../../common/hooks/useScreenSize.es.js";
4
- import { ANALYTICS_EVENTS as b } from "../../common/constants/Analytics.es.js";
5
- import { formatCurrency as y } from "../../core/utils/NumberFormatting.es.js";
4
+ import { formatCurrency as b } from "../../core/utils/NumberFormatting.es.js";
5
+ import { ANALYTICS_EVENTS as y } from "../../common/constants/Analytics.es.js";
6
6
  import { getPriorityValue as D, priorityComparator as B } from "../utils/DebtsTable.es.js";
7
7
  import { HeaderCell as l } from "../../trends/components/trendstable/HeaderCell.es.js";
8
8
  import { PriorityCell as L } from "./debtstable/PriorityCell.es.js";
@@ -51,7 +51,7 @@ var oe = ({ sx: _ = {}, debts: d, hoveredDebtGuid: C, onHoverRow: m, onClickRow:
51
51
  renderCell: (e) => /* @__PURE__ */ t(n, {
52
52
  color: a.palette.text.primary,
53
53
  variant: "body2",
54
- children: y(e.value, "0,0")
54
+ children: b(e.value, "0,0")
55
55
  }),
56
56
  sortable: !0,
57
57
  hideSortIcons: r,
@@ -102,7 +102,7 @@ var oe = ({ sx: _ = {}, debts: d, hoveredDebtGuid: C, onHoverRow: m, onClickRow:
102
102
  renderCell: (e) => /* @__PURE__ */ t(n, {
103
103
  color: a.palette.text.primary,
104
104
  variant: "body2",
105
- children: typeof e.value == "number" ? y(e.value, "0,0") : "---"
105
+ children: typeof e.value == "number" ? b(e.value, "0,0") : "---"
106
106
  }),
107
107
  sortable: !0,
108
108
  hideSortIcons: r,
@@ -156,10 +156,10 @@ var oe = ({ sx: _ = {}, debts: d, hoveredDebtGuid: C, onHoverRow: m, onClickRow:
156
156
  hideFooter: !0,
157
157
  initialState: { sorting: { sortModel: c } },
158
158
  onRowClick: (e) => {
159
- v(), s(b.DEBTS_CLICK_TABLE_ROW, { account_guid: e.row.guid });
159
+ v(), s(y.DEBTS_CLICK_TABLE_ROW, { account_guid: e.row.guid });
160
160
  },
161
161
  onSortModelChange: (e) => {
162
- x(e), s(b.DEBTS_CLICK_TABLE_SORT);
162
+ x(e), s(y.DEBTS_CLICK_TABLE_SORT);
163
163
  },
164
164
  rows: f,
165
165
  slotProps: {
@@ -1,6 +1,6 @@
1
1
  import { useEvent as u, useGlobalCopyStore as l, useGoalStore as _ } from "../../../common/context/hooks.es.js";
2
- import { ANALYTICS_EVENTS as c } from "../../../common/constants/Analytics.es.js";
3
- import { formatCurrency as d } from "../../../core/utils/NumberFormatting.es.js";
2
+ import { formatCurrency as c } from "../../../core/utils/NumberFormatting.es.js";
3
+ import { ANALYTICS_EVENTS as d } from "../../../common/constants/Analytics.es.js";
4
4
  import x from "../../../common/components/CurrencyInput.es.js";
5
5
  import { ListItemAction as f } from "../../../common/components/ListItemAction.es.js";
6
6
  import S from "react";
@@ -11,7 +11,7 @@ var I = h(() => {
11
11
  t && (await s({
12
12
  ...t,
13
13
  extra_payment: e
14
- }), t.extra_payment = e, i(c.DEBTS_SAVE_PAYDOWN_ACTION, { user_guid: t?.user_guid }));
14
+ }), t.extra_payment = e, i(d.DEBTS_SAVE_PAYDOWN_ACTION, { user_guid: t?.user_guid }));
15
15
  }, y = () => {
16
16
  setTimeout(() => {
17
17
  o(t?.extra_payment ?? 0);
@@ -23,7 +23,7 @@ var I = h(() => {
23
23
  onCancel: y,
24
24
  onSave: p,
25
25
  primaryText: r.paydown_drawer_extra_payment,
26
- secondaryText: d(t?.extra_payment, "0,0"),
26
+ secondaryText: c(t?.extra_payment, "0,0"),
27
27
  zeroStateText: t?.extra_payment ? void 0 : r.add_extra_payment,
28
28
  children: /* @__PURE__ */ m(x, {
29
29
  amount: e,
@@ -1,6 +1,6 @@
1
1
  import { useAccountStore as u, useEvent as _, useGlobalCopyStore as p } from "../../../common/context/hooks.es.js";
2
- import { ANALYTICS_EVENTS as v } from "../../../common/constants/Analytics.es.js";
3
- import { formatPercentage as d } from "../../../core/utils/NumberFormatting.es.js";
2
+ import { formatPercentage as v } from "../../../core/utils/NumberFormatting.es.js";
3
+ import { ANALYTICS_EVENTS as d } from "../../../common/constants/Analytics.es.js";
4
4
  import { ListItemAction as S } from "../../../common/components/ListItemAction.es.js";
5
5
  import f from "react";
6
6
  import { observer as T } from "mobx-react-lite";
@@ -11,7 +11,7 @@ var R = T(({ debt: t }) => {
11
11
  await i({
12
12
  ...t.account,
13
13
  interest_rate: e
14
- }), t.interest_rate = e, c(v.DEBTS_SAVE_RATE_ACTION, { account_guid: t.guid });
14
+ }), t.interest_rate = e, c(d.DEBTS_SAVE_RATE_ACTION, { account_guid: t.guid });
15
15
  }, l = () => {
16
16
  setTimeout(() => {
17
17
  a(t.interest_rate ?? 0);
@@ -23,7 +23,7 @@ var R = T(({ debt: t }) => {
23
23
  onCancel: l,
24
24
  onSave: m,
25
25
  primaryText: r.details_interest_rate,
26
- secondaryText: d(Number(t.interest_rate) / 100),
26
+ secondaryText: v(Number(t.interest_rate) / 100),
27
27
  zeroStateText: t.interest_rate ? void 0 : r.add_interest_rate,
28
28
  children: /* @__PURE__ */ s(A, {
29
29
  error: o,
@@ -1,6 +1,6 @@
1
1
  import { useAccountStore as c, useEvent as p, useGlobalCopyStore as l } from "../../../common/context/hooks.es.js";
2
- import { ANALYTICS_EVENTS as _ } from "../../../common/constants/Analytics.es.js";
3
- import { formatCurrency as h } from "../../../core/utils/NumberFormatting.es.js";
2
+ import { formatCurrency as _ } from "../../../core/utils/NumberFormatting.es.js";
3
+ import { ANALYTICS_EVENTS as h } from "../../../common/constants/Analytics.es.js";
4
4
  import d from "../../../common/components/CurrencyInput.es.js";
5
5
  import { ListItemAction as A } from "../../../common/components/ListItemAction.es.js";
6
6
  import S from "react";
@@ -11,7 +11,7 @@ var M = f(({ debt: t }) => {
11
11
  await y({
12
12
  ...t.account,
13
13
  minimum_payment: o
14
- }), t.monthly_payment = o, i(_.DEBTS_SAVE_PAYMENT_ACTION, { account_guid: t.guid });
14
+ }), t.monthly_payment = o, i(h.DEBTS_SAVE_PAYMENT_ACTION, { account_guid: t.guid });
15
15
  }, u = () => {
16
16
  setTimeout(() => {
17
17
  e(t.monthly_payment ?? 0);
@@ -23,7 +23,7 @@ var M = f(({ debt: t }) => {
23
23
  onCancel: u,
24
24
  onSave: s,
25
25
  primaryText: n.details_monthly_payment,
26
- secondaryText: h(t.monthly_payment, "0,0"),
26
+ secondaryText: _(t.monthly_payment, "0,0"),
27
27
  zeroStateText: t.monthly_payment ? void 0 : n.add_monthly_payment,
28
28
  children: /* @__PURE__ */ r(d, {
29
29
  amount: o,
@@ -1,6 +1,6 @@
1
1
  import { useAccountStore as m, useEvent as p, useGlobalCopyStore as _ } from "../../../common/context/hooks.es.js";
2
- import { ANALYTICS_EVENTS as g } from "../../../common/constants/Analytics.es.js";
3
- import { formatCurrency as b } from "../../../core/utils/NumberFormatting.es.js";
2
+ import { formatCurrency as g } from "../../../core/utils/NumberFormatting.es.js";
3
+ import { ANALYTICS_EVENTS as b } from "../../../common/constants/Analytics.es.js";
4
4
  import A from "../../../common/components/CurrencyInput.es.js";
5
5
  import { ListItemAction as d } from "../../../common/components/ListItemAction.es.js";
6
6
  import S from "react";
@@ -11,7 +11,7 @@ var I = f(({ debt: a }) => {
11
11
  await c({
12
12
  ...a.account,
13
13
  original_balance: o
14
- }), a.original_balance = o, l(g.DEBTS_SAVE_BALANCE_ACTION, { account_guid: a.guid });
14
+ }), a.original_balance = o, l(b.DEBTS_SAVE_BALANCE_ACTION, { account_guid: a.guid });
15
15
  }, u = () => {
16
16
  setTimeout(() => {
17
17
  e(a.original_balance ?? 0);
@@ -23,7 +23,7 @@ var I = f(({ debt: a }) => {
23
23
  onCancel: u,
24
24
  onSave: s,
25
25
  primaryText: n.details_original_balance,
26
- secondaryText: b(a.original_balance, "0,0"),
26
+ secondaryText: g(a.original_balance, "0,0"),
27
27
  zeroStateText: a.original_balance ? void 0 : n.add_original_balance,
28
28
  children: /* @__PURE__ */ i(A, {
29
29
  amount: o,
@@ -1,7 +1,7 @@
1
1
  import { DATE_FORMATS_INTL as b, formatDate as f } from "../../../core/constants/DateFormats.es.js";
2
2
  import { useEvent as u, useGlobalCopyStore as x } from "../../../common/context/hooks.es.js";
3
- import { ANALYTICS_EVENTS as _ } from "../../../common/constants/Analytics.es.js";
4
3
  import { formatCurrency as c } from "../../../core/utils/NumberFormatting.es.js";
4
+ import { ANALYTICS_EVENTS as _ } from "../../../common/constants/Analytics.es.js";
5
5
  import { useDebtsUiStore as v } from "../../hooks/useDebtsUiStore.es.js";
6
6
  import y from "react";
7
7
  import { observer as g } from "mobx-react-lite";
@@ -1,5 +1,5 @@
1
- import { useAccountStore as u, useGlobalCopyStore as p } from "../../../common/context/hooks.es.js";
2
- import { AccountType as f } from "../../../core/types/Account.es.js";
1
+ import { AccountType as u } from "../../../core/types/Account.es.js";
2
+ import { useAccountStore as p, useGlobalCopyStore as f } from "../../../common/context/hooks.es.js";
3
3
  import d from "../../../common/components/ConnectDrawer.es.js";
4
4
  import g from "../shared/Accounts.es.js";
5
5
  import _ from "../shared/TotalCard.es.js";
@@ -11,7 +11,7 @@ import v from "@mui/material/Button";
11
11
  import { jsx as o, jsxs as i } from "react/jsx-runtime";
12
12
  import S from "@mui/material/Card";
13
13
  var y = () => {
14
- const { savingsAccounts: n } = u(), { finstrong: t } = p(), [s, e] = a.useState(!1), r = a.useMemo(() => n.reduce((m, l) => m + (l.balance ?? 0), 0), [n]);
14
+ const { savingsAccounts: n } = p(), { finstrong: t } = f(), [s, e] = a.useState(!1), r = a.useMemo(() => n.reduce((m, l) => m + (l.balance ?? 0), 0), [n]);
15
15
  return /* @__PURE__ */ i(c, {
16
16
  sx: { gap: 24 },
17
17
  children: [
@@ -26,7 +26,7 @@ var y = () => {
26
26
  balance: r,
27
27
  title: t.maintain_emergency_savings_your_savings
28
28
  }), n.length ? /* @__PURE__ */ o(g, {
29
- loadAccounts: [f.SAVINGS],
29
+ loadAccounts: [u.SAVINGS],
30
30
  loadMoreLabel: t.connect_more_accounts_button
31
31
  }) : /* @__PURE__ */ o(v, {
32
32
  onClick: () => e(!0),
@@ -1,7 +1,7 @@
1
1
  import { buildDynamicCopy as D } from "../../core/utils/Localization.es.js";
2
2
  import { useAccountStore as w, useGlobalCopyStore as x, useRecurringTransactionsStore as P, useUserStore as A } from "../../common/context/hooks.es.js";
3
- import d from "../../common/components/drawer/Drawer.es.js";
4
3
  import { Frequency as B, RepeatingType as I } from "../../core/types/RepeatingTransaction.es.js";
4
+ import d from "../../common/components/drawer/Drawer.es.js";
5
5
  import M from "../../accounts/components/ConnectionsDrawer.es.js";
6
6
  import { RecurringSettings as O } from "../../recurringtransactions/components/shared/RecurringSettings.es.js";
7
7
  import L, { Action as r } from "./ProfileList.es.js";
@@ -1,5 +1,5 @@
1
- import { useAccountStore as e, useGlobalCopyStore as c } from "../../../common/context/hooks.es.js";
2
1
  import { AccountType as a } from "../../../core/types/Account.es.js";
2
+ import { useAccountStore as e, useGlobalCopyStore as c } from "../../../common/context/hooks.es.js";
3
3
  import n from "../shared/Accounts.es.js";
4
4
  import l from "../shared/TotalCard.es.js";
5
5
  import "react";