@mx-cartographer/experiences 9.2.5 → 9.2.6
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 +4 -0
- package/dist/{DebtUtils-i4pI2Uoe.mjs → DebtUtils-jG2NU0Pb.mjs} +2 -2
- package/dist/DebtUtils-jG2NU0Pb.mjs.map +1 -0
- package/dist/{UserStore-Cp-2Jtnw.mjs → UserStore-BceB3WHz.mjs} +2 -2
- package/dist/{UserStore-Cp-2Jtnw.mjs.map → UserStore-BceB3WHz.mjs.map} +1 -1
- package/dist/common/index.es.js +1 -1
- package/dist/core/index.es.js +1 -1
- package/dist/debts/index.es.js +3 -3
- package/dist/debts/index.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/DebtUtils-i4pI2Uoe.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DebtUtils-i4pI2Uoe.mjs","sources":["../src/core/constants/Debts.ts","../src/core/utils/DebtUtils.ts"],"sourcesContent":["export const MONTHS = 12\nexport const INTEREST_TO_DECIMAL = 100\n\nexport enum DebtPriority {\n FASTEST_PAYOFF_FIRST = 1,\n HIGHEST_INTEREST = 2,\n LOWEST_BALANCE = 3,\n HIGHEST_BALANCE = 4,\n}\n","import { getDate } from 'date-fns/getDate'\nimport { addMonths } from 'date-fns/addMonths'\nimport { fromUnixTime } from 'date-fns/fromUnixTime'\nimport { getUnixTime } from 'date-fns/getUnixTime'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport { DebtPriority, INTEREST_TO_DECIMAL, MONTHS } from '../constants/Debts'\nimport { AccountType, type Account, type Debt, type DebtsCopy, type Goal } from '../types'\n\nconst copy = {\n unnamed_label: 'Unnamed Debt',\n}\n\ntype DataPoint = { x: Date; y: number; payment?: number; extra?: number }\ntype Dataset = DataPoint[]\n\nexport interface DebtChartData extends Debt {\n dataset: Dataset\n}\n\ninterface MonthlyPayment {\n balance: number\n interest: number\n payment: number\n principal: number\n timestamp: number\n}\n\ninterface DebtWithPayments extends Debt {\n minimumPayments: MonthlyPayment[]\n minimumFinalPayment?: number | undefined\n}\n\nexport const transformDebtsChartData = (\n debts: Debt[],\n debtPriority: DebtPriority,\n extraPaydown = 0,\n): DebtChartData[] => {\n // Copy debts to avoid overwiting balance during payoff calculation\n const sortedDebts = debts.map((d) => ({ ...d }))\n sortDebtsByPrioriy(sortedDebts, debtPriority)\n\n const currentDate = new Date()\n const chartData: DebtChartData[] = []\n let monthlyExtra = 0\n let priorityCounter = 1\n\n // Initialize chartData for each debt\n for (const debt of sortedDebts) {\n chartData.push({\n ...debt,\n // Start with the initial balance\n dataset: [{ x: new Date(currentDate), y: debt.balance }],\n })\n }\n\n // Process debts using the Snowball method\n while (sortedDebts.some((debt) => debt.balance >= 0.01 && !debt.is_impossible)) {\n let madePayment = false // Track if any payment was made this month\n let hasAppliedSnowballExtra = false // Track if snowball extra has been applied this month\n let hasAppliedExtraPaydown = false // Track if extraPaydown has been applied this month\n\n for (const [index, debt] of sortedDebts.entries()) {\n // Skip if debt is already paid off\n if (debt.balance <= 0.01) continue\n\n const dataset = chartData[index].dataset\n const interestRate = (debt.interest_rate ?? 0) / 100\n const monthlyRate = interestRate / 12\n const monthlyInterest = debt.balance * monthlyRate\n const baseMonthlyPayment = debt.monthly_payment ?? 0\n let monthlyPayment = baseMonthlyPayment\n let extraThisMonth = 0\n\n // Add extra payment to the highest priority unpaid debt (first unpaid debt in sorted order)\n if (!hasAppliedExtraPaydown && extraPaydown > 0) {\n monthlyPayment += extraPaydown\n hasAppliedExtraPaydown = true\n }\n\n // Add snowball extra payment to the highest priority unpaid debt\n if (!hasAppliedSnowballExtra && monthlyExtra > 0) {\n extraThisMonth = monthlyExtra\n hasAppliedSnowballExtra = true\n }\n\n // Apply interest before payment\n debt.balance += monthlyInterest\n // Apply monthly payment with any extra payment from snowball\n const appliedPayment = Math.min(debt.balance, monthlyPayment + extraThisMonth)\n\n // If payment doesn't reduce balance, mark as stagnant\n if (appliedPayment <= monthlyInterest) {\n debt.is_impossible = true\n chartData[index].is_impossible = true\n chartData[index].priority = undefined\n dataset.push({ x: new Date(currentDate), y: debt.balance })\n continue\n }\n\n debt.balance -= appliedPayment\n // Avoid floating-point precision issues\n debt.balance = debt.balance < 0.01 ? 0 : debt.balance\n // Add a data point for the current debt balance\n dataset.push({\n x: new Date(currentDate),\n y: Math.max(0, debt.balance),\n payment: appliedPayment,\n extra: extraThisMonth,\n })\n\n // Roll over payments when debt gets paid off (snowball effect)\n // Only roll over the base monthly payment to avoid double-counting extraPaydown\n if (debt.balance <= 0) {\n monthlyExtra += baseMonthlyPayment\n chartData[index].projected_payoff_date = new Date(currentDate)\n }\n\n if (appliedPayment > 0) madePayment = true\n }\n\n if (madePayment) currentDate.setMonth(currentDate.getMonth() + 1)\n }\n\n // Don't project a debt as paid off until missing info is provided\n chartData.forEach((d) => {\n if (d.interest_rate === undefined || d.monthly_payment === undefined) {\n d.projected_payoff_date = undefined\n }\n })\n\n // Set priorities after all calculations\n chartData.forEach((debt) => {\n debt.priority = !debt.is_paid_off && !debt.is_impossible ? priorityCounter++ : undefined\n })\n\n return chartData\n}\n\nexport const buildEmptyStateProps = (\n copy: DebtsCopy,\n hasAggregation: boolean,\n handler: () => void,\n) => ({\n description: hasAggregation\n ? copy.empty_state_description\n : copy.empty_state_description_no_aggregation,\n header: hasAggregation ? copy.empty_state_header : copy.empty_state_header_no_aggregation,\n onClickHandler: hasAggregation ? handler : undefined,\n primaryButton: hasAggregation ? copy.connect_accounts : undefined,\n})\n\nexport function loadDebts(accounts: Account[], goals: Goal[]): Debt[] {\n const debtAccounts = accounts.filter((acc) => {\n // Exclude checking line of credit accounts with positive balance\n // Q: Because CLOC spending is represented by negative? (this logic is from raja)\n if (acc.account_type === AccountType.CHECKING_LINE_OF_CREDIT) {\n return Number(acc.balance) <= 0\n }\n // Exclude explicity excluded acccounts\n return acc.is_excluded_from_debts !== true\n })\n\n // Creat debts with associated goals\n const goalDebts = goals\n .filter((goal) => debtAccounts.some((acc) => acc.guid === goal.account_guid))\n .map((goal) =>\n createDebt(debtAccounts.find((acc) => acc.guid === goal.account_guid) as Account, goal),\n )\n\n // Create debts without associated goals, but are based on liabity accounts\n const liabilityDebts = debtAccounts\n .filter((acc) => !goalDebts.some((debt) => debt.account.guid === acc.guid))\n .map((account) => createDebt(account))\n\n return [...goalDebts, ...liabilityDebts]\n}\n\nexport function createDebt(account: Account, goal?: Goal): Debt {\n const debt = { account, goal, guid: account.guid } as Debt\n\n if (goal) {\n // Derive next payment date; default to 1st of month\n const paymentDay = goal.payment_due_at ? getDate(fromUnixTime(goal.payment_due_at)) : 1\n const paymentDueDate = startOfMonth(new Date()).setDate(paymentDay)\n\n debt.balance = Math.abs(goal.amount - goal.current_amount)\n debt.interest_rate = goal.interest_rate\n debt.is_paid_off = goal.is_complete\n debt.monthly_payment = goal.monthly_payment\n debt.name = goal.name\n debt.original_balance = goal.initial_amount // TODO: Does a debt need this?\n debt.payment_due_date = paymentDueDate\n } else {\n // Derive next payment date; default to 1st of month\n const paymentDay = account.payment_due_at ? getDate(fromUnixTime(account.payment_due_at)) : 1\n const paymentDueDate = startOfMonth(new Date()).setDate(paymentDay)\n const balance = account.balance ?? 0\n const monthlyPayment = account.minimum_payment ?? undefined\n const rate = account.interest_rate ?? account.apr ?? account.apy\n\n debt.balance = Math.max(balance, 0) // Don't use overpaid/negative balances for debt calculations\n debt.interest_rate = rate\n debt.is_paid_off = balance === 0\n debt.monthly_payment = monthlyPayment\n debt.name = account?.name ?? copy.unnamed_label\n debt.original_balance = account.original_balance // TODO: Does a debt need this?\n debt.payment_due_date = paymentDueDate\n }\n\n debt.is_impossible = false\n debt.priority = undefined\n debt.projected_payoff_date = undefined\n\n return debt\n}\n\nexport const calculateFinalPayment = (monthlyPayments: MonthlyPayment[]) => {\n const lastPayment = monthlyPayments[monthlyPayments.length - 1] || {}\n\n return lastPayment.timestamp\n}\n\n// Sorts (in place) the passed debts array, according to the given priority\nexport const sortDebtsByPrioriy = (debts: Debt[], debtPriority: DebtPriority) => {\n // Separate valid debts that can be prioritized from those that can't be\n\n const [activeDebts, inactiveDebts] = debts.reduce<[DebtWithPayments[], DebtWithPayments[]]>(\n ([active, inactive], debt) => {\n if (debt.is_paid_off || debt.is_impossible) {\n inactive.push({ ...debt, minimumPayments: [] })\n } else {\n active.push(calculateMinimumPayments(debt))\n }\n return [active, inactive]\n },\n [[], []],\n )\n\n switch (debtPriority) {\n case DebtPriority.FASTEST_PAYOFF_FIRST:\n activeDebts.sort((a, b) => (a.minimumFinalPayment ?? 0) - (b.minimumFinalPayment ?? 0))\n break\n case DebtPriority.HIGHEST_INTEREST:\n activeDebts.sort((a, b) => (b.interest_rate ?? 0) - (a.interest_rate ?? 0))\n break\n case DebtPriority.LOWEST_BALANCE:\n activeDebts.sort((a, b) => a.balance - b.balance)\n break\n case DebtPriority.HIGHEST_BALANCE:\n activeDebts.sort((a, b) => b.balance - a.balance)\n break\n default:\n activeDebts.sort((a, b) => a.balance - b.balance) // Default to lowest balance\n }\n\n // Reorder debts to begin with sorted/active and end with paid/impossible\n debts.splice(0, debts.length, ...activeDebts, ...inactiveDebts)\n}\n\nconst calculateMinimumPayments = (debt: Debt): DebtWithPayments => {\n const { monthly_payment, interest_rate, balance, payment_due_date } = debt\n const paymentCount = getPaymentCount(balance, interest_rate ?? 0, monthly_payment ?? 0)\n\n const minimumPayments = getMonthlyPayments(\n paymentCount,\n balance,\n interest_rate ?? 0,\n monthly_payment ?? 0,\n payment_due_date,\n )\n\n const minimumFinalPayment = calculateFinalPayment(minimumPayments)\n\n return {\n ...debt,\n minimumFinalPayment,\n minimumPayments,\n }\n}\n\nconst getPaymentCount = (\n balance: number,\n interestRate: number | undefined = 0,\n minimumPayment: number | undefined = 0,\n) => {\n if (minimumPayment === 0) return 0\n\n const monthlyInterestRate = interestRate / (MONTHS * INTEREST_TO_DECIMAL)\n\n return Math.ceil(\n monthlyInterestRate === 0\n ? balance / minimumPayment\n : -Math.log(1 - (monthlyInterestRate * balance) / minimumPayment) /\n Math.log(1 + monthlyInterestRate),\n )\n}\n\nconst getMonthlyPayments = (\n paymentCount: number,\n startingBalance: number,\n interestRate: number,\n scheduledPayment: number,\n startingDate: number,\n) => {\n const monthlyPayments = []\n // If the interest rate is zero, getting the monthly payment is easier, so\n // keep its logic separate from actual interest rate calculations.\n\n if (interestRate === 0) {\n for (let i = 0; i < paymentCount; i++) {\n const newBalance = startingBalance - scheduledPayment * (i + 1)\n const prevBalance = startingBalance - scheduledPayment * i\n const payment = newBalance >= 0 ? scheduledPayment : prevBalance\n monthlyPayments.push({\n balance: newBalance >= 0 ? newBalance : 0,\n interest: interestRate,\n payment,\n principal: payment,\n timestamp: getUnixTime(\n addMonths(\n fromUnixTime(startingDate), // convert seconds → Date\n i + 1, // add (index + 1) months\n ),\n ),\n })\n }\n return monthlyPayments\n }\n const monthlyRate = interestRate / 1200\n\n for (let index = 0; index < paymentCount; index++) {\n const timestamp = getUnixTime(addMonths(fromUnixTime(startingDate), index + 1))\n\n const priorPow = Math.pow(1 + monthlyRate, index)\n const priorBalance =\n startingBalance * priorPow - scheduledPayment * ((priorPow - 1) / monthlyRate)\n\n const pow = Math.pow(1 + monthlyRate, index + 1)\n const balance = startingBalance * pow - scheduledPayment * ((pow - 1) / monthlyRate)\n\n const payment = scheduledPayment + Math.min(balance, 0)\n const interest = priorBalance * monthlyRate\n\n monthlyPayments.push({\n balance: Math.max(0, balance),\n interest,\n payment,\n principal: payment - interest,\n timestamp,\n })\n }\n\n return monthlyPayments\n}\n"],"names":["MONTHS","INTEREST_TO_DECIMAL","DebtPriority","copy","transformDebtsChartData","debts","debtPriority","extraPaydown","sortedDebts","d","sortDebtsByPrioriy","currentDate","chartData","monthlyExtra","priorityCounter","debt","madePayment","hasAppliedSnowballExtra","hasAppliedExtraPaydown","index","dataset","monthlyRate","monthlyInterest","baseMonthlyPayment","monthlyPayment","extraThisMonth","appliedPayment","buildEmptyStateProps","hasAggregation","handler","loadDebts","accounts","goals","debtAccounts","acc","AccountType","goalDebts","goal","createDebt","liabilityDebts","account","paymentDay","getDate","fromUnixTime","paymentDueDate","startOfMonth","balance","rate","calculateFinalPayment","monthlyPayments","activeDebts","inactiveDebts","active","inactive","calculateMinimumPayments","a","b","monthly_payment","interest_rate","payment_due_date","paymentCount","getPaymentCount","minimumPayments","getMonthlyPayments","minimumFinalPayment","interestRate","minimumPayment","monthlyInterestRate","startingBalance","scheduledPayment","startingDate","i","newBalance","prevBalance","payment","getUnixTime","addMonths","timestamp","priorPow","priorBalance","pow","interest"],"mappings":";;;;;;AAAO,MAAMA,IAAS,IACTC,IAAsB;AAE5B,IAAKC,sBAAAA,OACVA,EAAAA,EAAA,uBAAuB,CAAA,IAAvB,wBACAA,EAAAA,EAAA,mBAAmB,CAAA,IAAnB,oBACAA,EAAAA,EAAA,iBAAiB,CAAA,IAAjB,kBACAA,EAAAA,EAAA,kBAAkB,CAAA,IAAlB,mBAJUA,IAAAA,KAAA,CAAA,CAAA;ACMZ,MAAMC,IAAO;AAAA,EACX,eAAe;AACjB,GAsBaC,IAA0B,CACrCC,GACAC,GACAC,IAAe,MACK;AAEpB,QAAMC,IAAcH,EAAM,IAAI,CAACI,OAAO,EAAE,GAAGA,IAAI;AAC/C,EAAAC,EAAmBF,GAAaF,CAAY;AAE5C,QAAMK,wBAAkB,KAAA,GAClBC,IAA6B,CAAA;AACnC,MAAIC,IAAe,GACfC,IAAkB;AAGtB,aAAWC,KAAQP;AACjB,IAAAI,EAAU,KAAK;AAAA,MACb,GAAGG;AAAA;AAAA,MAEH,SAAS,CAAC,EAAE,GAAG,IAAI,KAAKJ,CAAW,GAAG,GAAGI,EAAK,QAAA,CAAS;AAAA,IAAA,CACxD;AAIH,SAAOP,EAAY,KAAK,CAACO,MAASA,EAAK,WAAW,QAAQ,CAACA,EAAK,aAAa,KAAG;AAC9E,QAAIC,IAAc,IACdC,IAA0B,IAC1BC,IAAy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