@mx-cartographer/experiences 9.4.42-alph.mm1 → 9.4.43
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 +6 -2
- package/dist/core/utils/CategoryUtil.d.ts +1 -1
- package/dist/core/utils/CategoryUtil.es.js +1 -1
- package/dist/core/utils/CategoryUtil.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js.map +1 -1
- package/dist/insights-v2/components/BaseLayout.es.js +30 -29
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/components/SaveAnExtraCard.es.js +12 -14
- package/dist/insights-v2/components/SaveAnExtraCard.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
## [9.4.
|
|
1
|
+
## [9.4.43] - 09-25-2026
|
|
2
2
|
|
|
3
3
|
- **FIXED** - Category names now render localized copy instead of the raw API value in the Spending widget (main view list, drawer, donut legend), the Spending mini widget, the Finstrong spend-less-than-you-make chart, and the Transactions table Category column. (MEW-4166)
|
|
4
4
|
- **FIXED** - Trends category list "View more"/"View less" toggle is now localized and moved to common copy (MEW-4166)
|
|
5
5
|
- **FIXED** - Account type labels (e.g. Checking, Savings, Investment) in the Net Worth "Assets & Liabilities" drawer accordion and the Debts table account cell now use localized copy instead of hardcoded English (MEW-4166)
|
|
6
6
|
- **FIXED** - Category names in the shared category selection drawer (used by the transaction category-edit and split actions, and transaction-rule category edit) now render localized copy instead of the raw API value, and the search filter matches on the localized name (MEW-4166)
|
|
7
|
-
- **CHANGED** - Copy contract: added required `common.view_more` and `common.view_less` keys and removed the unused `trends.view_more` key
|
|
7
|
+
- **CHANGED** - Copy contract: added required `common.view_more` and `common.view_less` keys and removed the unused `trends.view_more` key; the component falls back to English if they are absent (MEW-4166)
|
|
8
|
+
|
|
9
|
+
## [9.4.42] - 09-24-2026
|
|
10
|
+
|
|
11
|
+
- **CHANGED** - insights-v2 Save an Extra beat UI polish: `SaveAnExtraCard` now uses mxui `P`/`Text` semantic typography (logo `boxShadow` removed), `BaseLayout` renders the beat description via mxui `P` (`subtitle2`), and `SaveExtraBlock` uses horizontal-only padding (WEC-1851)
|
|
8
12
|
|
|
9
13
|
## [9.4.41] - 09-24-2026
|
|
10
14
|
|
|
@@ -10,7 +10,7 @@ import { Category, DateRangeCategoryTotals, DetailedCategory, DetailedCategoryWi
|
|
|
10
10
|
* @param category - The category to resolve a name for
|
|
11
11
|
* @param copy - Category copy containing localized default category names
|
|
12
12
|
*/
|
|
13
|
-
export declare const getLocalizedCategoryName: (category: Category, copy
|
|
13
|
+
export declare const getLocalizedCategoryName: (category: Category, copy: CategoryCopy) => string;
|
|
14
14
|
/**
|
|
15
15
|
* Augment categories
|
|
16
16
|
* @param categories - Categories to augment
|
|
@@ -6,7 +6,7 @@ import { startOfMonth as O } from "date-fns/startOfMonth";
|
|
|
6
6
|
import { startOfToday as E } from "date-fns/startOfToday";
|
|
7
7
|
import { subMonths as I } from "date-fns/subMonths";
|
|
8
8
|
var R = 3, f = 12, S = (e, r) => {
|
|
9
|
-
const t = r
|
|
9
|
+
const t = r.default_categories?.[e.guid];
|
|
10
10
|
return t ? t.replace(/&/g, "&") : e.name;
|
|
11
11
|
}, k = (e, r, t, o) => e.filter((a) => !a.parent_guid).map((a) => _(a, r, t, o, e.filter((n) => n.parent_guid === a.guid))), B = (e, r) => {
|
|
12
12
|
const t = D.find((o) => o.guid === e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategoryUtil.es.js","names":[],"sources":["../../../src/core/utils/CategoryUtil.ts"],"sourcesContent":["import { format } from 'date-fns/format'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { startOfToday } from 'date-fns/startOfToday'\nimport { subMonths } from 'date-fns/subMonths'\n\nimport type { Palette, Theme } from '@mui/material'\n\nimport { CategoryIconList } from '@mxenabled/mxui'\n\nimport {\n CategoryColors,\n CategoryGuids,\n CategoryIcon,\n DATE_FORMATS_INTL,\n formatDate,\n} from '../constants'\n\nimport type {\n Category,\n DateRangeCategoryTotals,\n DetailedCategory,\n DetailedCategoryWithTransactions,\n MonthlyAmount,\n MonthlyCategoryTotals,\n Transaction,\n CategoryCopy,\n CategoryTotal,\n} from '../types'\n\nconst MONTHLY_AVERAGE_LENGTH = 3\nconst MONTHS_OF_HISTORY = 12\n\n/**\n * Resolve the localized display name for a category.\n *\n * Default (MX-supplied) categories arrive from the API with fixed English\n * names, but localized copy for them is delivered via CategoryCopy\n * `default_categories` (keyed by category guid). User-created categories have no\n * localized copy and legitimately fall back to their API name.\n * @param category - The category to resolve a name for\n * @param copy - Category copy containing localized default category names\n */\nexport const getLocalizedCategoryName = (category: Category, copy?: CategoryCopy): string => {\n const localizedName = copy?.default_categories?.[category.guid]\n return localizedName ? localizedName.replace(/&/g, '&') : category.name\n}\n\n/**\n * Augment categories\n * @param categories - Categories to augment\n * @param monthlyCategoryTotals - Monthly category totals\n * @param currentCategoryTotals - Current month category totals\n * @param copy - Category copy\n */\nexport const augmentCategories = (\n categories: Category[],\n copy: CategoryCopy,\n currentCategoryTotals: DateRangeCategoryTotals[],\n monthlyCategoryTotals: MonthlyCategoryTotals[],\n): DetailedCategory[] => {\n return categories\n .filter((category) => !category.parent_guid)\n .map((category) =>\n getDetailedCategory(\n category,\n copy,\n currentCategoryTotals,\n monthlyCategoryTotals,\n categories.filter((c) => c.parent_guid === category.guid),\n ),\n )\n}\n\nexport const getCategoryColor = (guid: string, theme: Theme) => {\n const categoryInfo = CategoryIconList.find((c) => c.guid === guid)\n if (!categoryInfo) return theme.palette.categories.uncategorized || ''\n\n return theme.palette.categories[categoryInfo.colorName as keyof Palette['categories']] || ''\n}\n\nexport const getCategoryIcon = (guid: string) => {\n return CategoryIconList.find((c) => c.guid === guid)?.icon\n}\n\n/**\n * Get an augmented category with additional details\n * @param category - The category to augment\n * @param copy - Category copy\n * @param currentCategoryTotals - Current month category totals\n * @param monthlyCategoryTotals - Past monthly category totals\n * @param subCategories - Subcategories for the specified category (If applicable)\n */\nconst getDetailedCategory = (\n category: Category,\n copy: CategoryCopy,\n currentCategoryTotals: DateRangeCategoryTotals[],\n monthlyCategoryTotals: MonthlyCategoryTotals[],\n subCategories: Category[] = [],\n): DetailedCategory => {\n const guid = category.guid\n const parentGuid = category.parent_guid || guid\n const isParent = guid === parentGuid\n\n const currentAmount = currentCategoryTotals.find((t) => t.category_guid === guid)?.total || 0\n const monthlyAmounts = getMonthlyAmounts(\n monthlyCategoryTotals.filter((total) => total.category_guid === guid),\n )\n const totalMonthlyAmounts = getMonthlyAmounts(\n monthlyCategoryTotals.filter(\n (total) => total.category_guid === guid || total.top_level_category_guid === guid,\n ),\n )\n const detailedSubCategories = subCategories.map((subCategory) =>\n getDetailedCategory(subCategory, copy, currentCategoryTotals, monthlyCategoryTotals),\n )\n const totalAmount = detailedSubCategories.reduce(\n (total, current) => total + current.currentAmount,\n currentAmount,\n )\n\n const name = getLocalizedCategoryName(category, copy)\n\n return {\n ...category,\n currentAmount,\n averageAmount: getAverage(monthlyAmounts),\n color: CategoryColors[parentGuid],\n icon: CategoryIcon[parentGuid],\n isTransfer: parentGuid === CategoryGuids.TRANSFER,\n monthlyAmounts,\n name,\n subCategories: detailedSubCategories,\n totalAmount: isParent ? totalAmount : 0,\n totalAverageAmount: getAverage(totalMonthlyAmounts),\n totalMonthlyAmounts: isParent ? totalMonthlyAmounts : [],\n }\n}\n/**\n * get the transactions belonging to parent categories\n * @param detailedCategories - detailed categories from the category store\n * @param transactions - sortedTransactions from the transaction store\n */\nexport const getDetailedCategoryTransactions = (\n detailedCategories: DetailedCategory[],\n transactions: Transaction[],\n): DetailedCategoryWithTransactions[] => {\n return detailedCategories.map((category) => {\n const categoryTransactions = transactions.filter(\n (transaction) =>\n transaction.category_guid === category.guid ||\n transaction.top_level_category_guid === category.guid,\n )\n\n return {\n ...category,\n transactions: categoryTransactions,\n }\n })\n}\n\n/**\n * Get the average amount based on the number of months (numMonths) requested\n * @param monthlyAmounts - Monthly amounts to calculate and average from\n * @param numMonths - Number of months to base the average on (DEFAULT: 3)\n */\nconst getAverage = (\n monthlyAmounts: MonthlyAmount[],\n numMonths: number = MONTHLY_AVERAGE_LENGTH,\n): number => {\n const monthsBack = numMonths > history.length ? history.length : numMonths\n\n return Math.ceil(\n Math.max(\n 0,\n monthlyAmounts.slice(-monthsBack).reduce((total, current) => total + current.amount, 0) /\n monthsBack,\n ),\n )\n}\n\n/**\n * Get the last 12 months of amounts for a category\n * @param categoryTotals - Monthly category totals\n */\nconst getMonthlyAmounts = (categoryTotals: MonthlyCategoryTotals[]): MonthlyAmount[] => {\n const monthlyAmounts: MonthlyAmount[] = []\n const today = startOfToday()\n for (let i = 0; i <= MONTHS_OF_HISTORY; i++) {\n const historyDate = startOfMonth(subMonths(today, MONTHS_OF_HISTORY - i))\n const monthlyTotals = categoryTotals.filter(\n (total) => total.year_month === Number(format(historyDate, 'yyyyMM')),\n )\n const totalAmount = monthlyTotals.reduce((acc, curr) => acc + curr.total, 0)\n\n monthlyAmounts.push({\n amount: totalAmount,\n isoDate: format(historyDate, 'yyyy-MM-dd'),\n label: formatDate(historyDate, DATE_FORMATS_INTL.MONTH_YEAR),\n })\n }\n\n return monthlyAmounts\n}\n\nexport const findCategory = (\n categories: Category[],\n categoryGuid: string | undefined,\n): Category | undefined => {\n return categories.find((c) => c.guid === categoryGuid)\n}\n\nexport const findDetailedCategory = (\n detailedCategories: DetailedCategory[],\n guid: string | undefined,\n): DetailedCategory | undefined => {\n return detailedCategories.find((dc) => dc.guid === guid)\n}\n\nexport const findDetailedSubCategory = (\n detailedCategories: DetailedCategory[],\n guid: string | undefined,\n): DetailedCategory | undefined => {\n const parent = detailedCategories.find((dc) => dc.subCategories.find((sc) => sc.guid === guid))\n if (!parent) return undefined\n\n return parent.subCategories.find((sc) => sc.guid === guid)\n}\n\nexport const findCategoryTotalsByParent = (\n categories: Category[],\n dateRangeTotals: DateRangeCategoryTotals[],\n): CategoryTotal[] => {\n const categoryTotals = [] as CategoryTotal[]\n\n // Iterate over the category data from BE and roll up all categories into parent categories\n // acc is the accumulated category totals of type CategoryTotal that is initialized as an empty []\n // curr is the current DateRangeCategoryTotal\n\n for (const dateRangeTotal of dateRangeTotals) {\n const category = findCategory(categories, dateRangeTotal.category_guid)\n if (!category) continue\n\n const parentGuid = category.parent_guid ?? category.guid\n const parentCategory = findCategory(categories, parentGuid)\n if (!parentCategory) continue\n\n const categoryTotal = {\n amount: dateRangeTotal.total,\n category,\n guid: category.guid,\n subCategoryTotals: [],\n }\n\n const parentCategoryTotal = categoryTotals.find((ct) => ct.guid === parentGuid)\n if (parentCategoryTotal) {\n parentCategoryTotal.amount += dateRangeTotal.total\n parentCategoryTotal.subCategoryTotals.push(categoryTotal)\n } else {\n categoryTotals.push({\n amount: dateRangeTotal.total,\n category: parentCategory,\n guid: parentGuid,\n subCategoryTotals: [categoryTotal],\n })\n }\n }\n\n return categoryTotals\n}\n\nexport const isIncome = (categories: Category[], guid: string) => {\n const category = categories.find((c) => c.guid === guid)\n if (!category) return false\n\n return category.guid === CategoryGuids.INCOME || category.parent_guid === CategoryGuids.INCOME\n}\n"],"mappings":";;;;;;;AA6BA,IAAM,IAAyB,GACzB,IAAoB,IAYb,IAAA,CAA4B,GAAoB,MAAgC;AAC3F,QAAM,IAAgB,GAAM,qBAAqB,EAAS,IAAA;AAC1D,SAAO,IAAgB,EAAc,QAAQ,UAAU,GAAG,IAAI,EAAS;AACzE,GASa,IAAA,CACX,GACA,GACA,GACA,MAEO,EACJ,OAAA,CAAQ,MAAa,CAAC,EAAS,WAAW,EAC1C,IAAA,CAAK,MACJ,EACE,GACA,GACA,GACA,GACA,EAAW,OAAA,CAAQ,MAAM,EAAE,gBAAgB,EAAS,IAAI,CAC1D,CACF,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,IACL,GAAG;AAAA,IACH,cAAc;AAAA,EAChB;AACF,CAAC,GAQG,IAAA,CACJ,GACA,IAAoB,MACT;AACX,QAAM,IAAa,IAAY,QAAQ,SAAS,QAAQ,SAAS;AAEjE,SAAO,KAAK,KACV,KAAK,IACH,GACA,EAAe,MAAM,CAAC,CAAU,EAAE,OAAA,CAAQ,GAAO,MAAY,IAAQ,EAAQ,QAAQ,CAAC,IACpF,CACJ,CACF;AACF,GAMM,IAAA,CAAqB,MAA6D;AACtF,QAAM,IAAkC,CAAC,GACnC,IAAQ,EAAa;AAC3B,WAAS,IAAI,GAAG,KAAK,GAAmB,KAAK;AAC3C,UAAM,IAAc,EAAa,EAAU,GAAO,IAAoB,CAAC,CAAC,GAIlE,IAHgB,EAAe,OAAA,CAClC,MAAU,EAAM,eAAe,OAAO,EAAO,GAAa,QAAQ,CAAC,CAElD,EAAc,OAAA,CAAQ,GAAK,MAAS,IAAM,EAAK,OAAO,CAAC;AAE3E,IAAA,EAAe,KAAK;AAAA,MAClB,QAAQ;AAAA,MACR,SAAS,EAAO,GAAa,YAAY;AAAA,MACzC,OAAO,EAAW,GAAa,EAAkB,UAAU;AAAA,IAC7D,CAAC;AAAA,EACH;AAEA,SAAO;AACT,GASa,IAAA,CACX,GACA,MAEO,EAAmB,KAAA,CAAM,MAAO,EAAG,SAAS,CAAI,GAG5C,IAAA,CACX,GACA,MACiC;AACjC,QAAM,IAAS,EAAmB,KAAA,CAAM,MAAO,EAAG,cAAc,KAAA,CAAM,MAAO,EAAG,SAAS,CAAI,CAAC;AAC9F,MAAK;AAEL,WAAO,EAAO,cAAc,KAAA,CAAM,MAAO,EAAG,SAAS,CAAI;AAC3D"}
|
|
1
|
+
{"version":3,"file":"CategoryUtil.es.js","names":[],"sources":["../../../src/core/utils/CategoryUtil.ts"],"sourcesContent":["import { format } from 'date-fns/format'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { startOfToday } from 'date-fns/startOfToday'\nimport { subMonths } from 'date-fns/subMonths'\n\nimport type { Palette, Theme } from '@mui/material'\n\nimport { CategoryIconList } from '@mxenabled/mxui'\n\nimport {\n CategoryColors,\n CategoryGuids,\n CategoryIcon,\n DATE_FORMATS_INTL,\n formatDate,\n} from '../constants'\n\nimport type {\n Category,\n DateRangeCategoryTotals,\n DetailedCategory,\n DetailedCategoryWithTransactions,\n MonthlyAmount,\n MonthlyCategoryTotals,\n Transaction,\n CategoryCopy,\n CategoryTotal,\n} from '../types'\n\nconst MONTHLY_AVERAGE_LENGTH = 3\nconst MONTHS_OF_HISTORY = 12\n\n/**\n * Resolve the localized display name for a category.\n *\n * Default (MX-supplied) categories arrive from the API with fixed English\n * names, but localized copy for them is delivered via CategoryCopy\n * `default_categories` (keyed by category guid). User-created categories have no\n * localized copy and legitimately fall back to their API name.\n * @param category - The category to resolve a name for\n * @param copy - Category copy containing localized default category names\n */\nexport const getLocalizedCategoryName = (category: Category, copy: CategoryCopy): string => {\n const localizedName = copy.default_categories?.[category.guid]\n return localizedName ? localizedName.replace(/&/g, '&') : category.name\n}\n\n/**\n * Augment categories\n * @param categories - Categories to augment\n * @param monthlyCategoryTotals - Monthly category totals\n * @param currentCategoryTotals - Current month category totals\n * @param copy - Category copy\n */\nexport const augmentCategories = (\n categories: Category[],\n copy: CategoryCopy,\n currentCategoryTotals: DateRangeCategoryTotals[],\n monthlyCategoryTotals: MonthlyCategoryTotals[],\n): DetailedCategory[] => {\n return categories\n .filter((category) => !category.parent_guid)\n .map((category) =>\n getDetailedCategory(\n category,\n copy,\n currentCategoryTotals,\n monthlyCategoryTotals,\n categories.filter((c) => c.parent_guid === category.guid),\n ),\n )\n}\n\nexport const getCategoryColor = (guid: string, theme: Theme) => {\n const categoryInfo = CategoryIconList.find((c) => c.guid === guid)\n if (!categoryInfo) return theme.palette.categories.uncategorized || ''\n\n return theme.palette.categories[categoryInfo.colorName as keyof Palette['categories']] || ''\n}\n\nexport const getCategoryIcon = (guid: string) => {\n return CategoryIconList.find((c) => c.guid === guid)?.icon\n}\n\n/**\n * Get an augmented category with additional details\n * @param category - The category to augment\n * @param copy - Category copy\n * @param currentCategoryTotals - Current month category totals\n * @param monthlyCategoryTotals - Past monthly category totals\n * @param subCategories - Subcategories for the specified category (If applicable)\n */\nconst getDetailedCategory = (\n category: Category,\n copy: CategoryCopy,\n currentCategoryTotals: DateRangeCategoryTotals[],\n monthlyCategoryTotals: MonthlyCategoryTotals[],\n subCategories: Category[] = [],\n): DetailedCategory => {\n const guid = category.guid\n const parentGuid = category.parent_guid || guid\n const isParent = guid === parentGuid\n\n const currentAmount = currentCategoryTotals.find((t) => t.category_guid === guid)?.total || 0\n const monthlyAmounts = getMonthlyAmounts(\n monthlyCategoryTotals.filter((total) => total.category_guid === guid),\n )\n const totalMonthlyAmounts = getMonthlyAmounts(\n monthlyCategoryTotals.filter(\n (total) => total.category_guid === guid || total.top_level_category_guid === guid,\n ),\n )\n const detailedSubCategories = subCategories.map((subCategory) =>\n getDetailedCategory(subCategory, copy, currentCategoryTotals, monthlyCategoryTotals),\n )\n const totalAmount = detailedSubCategories.reduce(\n (total, current) => total + current.currentAmount,\n currentAmount,\n )\n\n const name = getLocalizedCategoryName(category, copy)\n\n return {\n ...category,\n currentAmount,\n averageAmount: getAverage(monthlyAmounts),\n color: CategoryColors[parentGuid],\n icon: CategoryIcon[parentGuid],\n isTransfer: parentGuid === CategoryGuids.TRANSFER,\n monthlyAmounts,\n name,\n subCategories: detailedSubCategories,\n totalAmount: isParent ? totalAmount : 0,\n totalAverageAmount: getAverage(totalMonthlyAmounts),\n totalMonthlyAmounts: isParent ? totalMonthlyAmounts : [],\n }\n}\n/**\n * get the transactions belonging to parent categories\n * @param detailedCategories - detailed categories from the category store\n * @param transactions - sortedTransactions from the transaction store\n */\nexport const getDetailedCategoryTransactions = (\n detailedCategories: DetailedCategory[],\n transactions: Transaction[],\n): DetailedCategoryWithTransactions[] => {\n return detailedCategories.map((category) => {\n const categoryTransactions = transactions.filter(\n (transaction) =>\n transaction.category_guid === category.guid ||\n transaction.top_level_category_guid === category.guid,\n )\n\n return {\n ...category,\n transactions: categoryTransactions,\n }\n })\n}\n\n/**\n * Get the average amount based on the number of months (numMonths) requested\n * @param monthlyAmounts - Monthly amounts to calculate and average from\n * @param numMonths - Number of months to base the average on (DEFAULT: 3)\n */\nconst getAverage = (\n monthlyAmounts: MonthlyAmount[],\n numMonths: number = MONTHLY_AVERAGE_LENGTH,\n): number => {\n const monthsBack = numMonths > history.length ? history.length : numMonths\n\n return Math.ceil(\n Math.max(\n 0,\n monthlyAmounts.slice(-monthsBack).reduce((total, current) => total + current.amount, 0) /\n monthsBack,\n ),\n )\n}\n\n/**\n * Get the last 12 months of amounts for a category\n * @param categoryTotals - Monthly category totals\n */\nconst getMonthlyAmounts = (categoryTotals: MonthlyCategoryTotals[]): MonthlyAmount[] => {\n const monthlyAmounts: MonthlyAmount[] = []\n const today = startOfToday()\n for (let i = 0; i <= MONTHS_OF_HISTORY; i++) {\n const historyDate = startOfMonth(subMonths(today, MONTHS_OF_HISTORY - i))\n const monthlyTotals = categoryTotals.filter(\n (total) => total.year_month === Number(format(historyDate, 'yyyyMM')),\n )\n const totalAmount = monthlyTotals.reduce((acc, curr) => acc + curr.total, 0)\n\n monthlyAmounts.push({\n amount: totalAmount,\n isoDate: format(historyDate, 'yyyy-MM-dd'),\n label: formatDate(historyDate, DATE_FORMATS_INTL.MONTH_YEAR),\n })\n }\n\n return monthlyAmounts\n}\n\nexport const findCategory = (\n categories: Category[],\n categoryGuid: string | undefined,\n): Category | undefined => {\n return categories.find((c) => c.guid === categoryGuid)\n}\n\nexport const findDetailedCategory = (\n detailedCategories: DetailedCategory[],\n guid: string | undefined,\n): DetailedCategory | undefined => {\n return detailedCategories.find((dc) => dc.guid === guid)\n}\n\nexport const findDetailedSubCategory = (\n detailedCategories: DetailedCategory[],\n guid: string | undefined,\n): DetailedCategory | undefined => {\n const parent = detailedCategories.find((dc) => dc.subCategories.find((sc) => sc.guid === guid))\n if (!parent) return undefined\n\n return parent.subCategories.find((sc) => sc.guid === guid)\n}\n\nexport const findCategoryTotalsByParent = (\n categories: Category[],\n dateRangeTotals: DateRangeCategoryTotals[],\n): CategoryTotal[] => {\n const categoryTotals = [] as CategoryTotal[]\n\n // Iterate over the category data from BE and roll up all categories into parent categories\n // acc is the accumulated category totals of type CategoryTotal that is initialized as an empty []\n // curr is the current DateRangeCategoryTotal\n\n for (const dateRangeTotal of dateRangeTotals) {\n const category = findCategory(categories, dateRangeTotal.category_guid)\n if (!category) continue\n\n const parentGuid = category.parent_guid ?? category.guid\n const parentCategory = findCategory(categories, parentGuid)\n if (!parentCategory) continue\n\n const categoryTotal = {\n amount: dateRangeTotal.total,\n category,\n guid: category.guid,\n subCategoryTotals: [],\n }\n\n const parentCategoryTotal = categoryTotals.find((ct) => ct.guid === parentGuid)\n if (parentCategoryTotal) {\n parentCategoryTotal.amount += dateRangeTotal.total\n parentCategoryTotal.subCategoryTotals.push(categoryTotal)\n } else {\n categoryTotals.push({\n amount: dateRangeTotal.total,\n category: parentCategory,\n guid: parentGuid,\n subCategoryTotals: [categoryTotal],\n })\n }\n }\n\n return categoryTotals\n}\n\nexport const isIncome = (categories: Category[], guid: string) => {\n const category = categories.find((c) => c.guid === guid)\n if (!category) return false\n\n return category.guid === CategoryGuids.INCOME || category.parent_guid === CategoryGuids.INCOME\n}\n"],"mappings":";;;;;;;AA6BA,IAAM,IAAyB,GACzB,IAAoB,IAYb,IAAA,CAA4B,GAAoB,MAA+B;AAC1F,QAAM,IAAgB,EAAK,qBAAqB,EAAS,IAAA;AACzD,SAAO,IAAgB,EAAc,QAAQ,UAAU,GAAG,IAAI,EAAS;AACzE,GASa,IAAA,CACX,GACA,GACA,GACA,MAEO,EACJ,OAAA,CAAQ,MAAa,CAAC,EAAS,WAAW,EAC1C,IAAA,CAAK,MACJ,EACE,GACA,GACA,GACA,GACA,EAAW,OAAA,CAAQ,MAAM,EAAE,gBAAgB,EAAS,IAAI,CAC1D,CACF,GAGS,IAA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G;AAAA,IACH,cAAc;AAAA,EAChB;AACF,CAAC,GAQG,IAAA,CACJ,GACA,IAAoB,MACT;AACX,QAAM,IAAa,IAAY,QAAQ,SAAS,QAAQ,SAAS;AAEjE,SAAO,KAAK,KACV,KAAK,IACH,GACA,EAAe,MAAM,CAAC,CAAU,EAAE,OAAA,CAAQ,GAAO,MAAY,IAAQ,EAAQ,QAAQ,CAAC,IACpF,CACJ,CACF;AACF,GAMM,IAAA,CAAqB,MAA6D;AACtF,QAAM,IAAkC,CAAC,GACnC,IAAQ,EAAa;AAC3B,WAAS,IAAI,GAAG,KAAK,GAAmB,KAAK;AAC3C,UAAM,IAAc,EAAa,EAAU,GAAO,IAAoB,CAAC,CAAC,GAIlE,IAHgB,EAAe,OAAA,CAClC,MAAU,EAAM,eAAe,OAAO,EAAO,GAAa,QAAQ,CAAC,CAElD,EAAc,OAAA,CAAQ,GAAK,MAAS,IAAM,EAAK,OAAO,CAAC;AAE3E,IAAA,EAAe,KAAK;AAAA,MAClB,QAAQ;AAAA,MACR,SAAS,EAAO,GAAa,YAAY;AAAA,MACzC,OAAO,EAAW,GAAa,EAAkB,UAAU;AAAA,IAC7D,CAAC;AAAA,EACH;AAEA,SAAO;AACT,GASa,IAAA,CACX,GACA,MAEO,EAAmB,KAAA,CAAM,MAAO,EAAG,SAAS,CAAI,GAG5C,IAAA,CACX,GACA,MACiC;AACjC,QAAM,IAAS,EAAmB,KAAA,CAAM,MAAO,EAAG,cAAc,KAAA,CAAM,MAAO,EAAG,SAAS,CAAI,CAAC;AAC9F,MAAK;AAEL,WAAO,EAAO,cAAc,KAAA,CAAM,MAAO,EAAG,SAAS,CAAI;AAC3D"}
|
|
@@ -4,7 +4,7 @@ import { jsx as r } from "react/jsx-runtime";
|
|
|
4
4
|
var c = ({ payload: t }) => {
|
|
5
5
|
const { primary_text: a, secondary_text: e } = t.instance_slot_data;
|
|
6
6
|
return /* @__PURE__ */ r(x, {
|
|
7
|
-
sx: {
|
|
7
|
+
sx: { px: 16 },
|
|
8
8
|
children: /* @__PURE__ */ r(o, {
|
|
9
9
|
primaryText: a,
|
|
10
10
|
secondaryText: e
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveExtraBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport type { SaveExtraBlockData } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport SaveAnExtraCard from '../../../components/SaveAnExtraCard'\n\nimport type { BlockProps } from '../../types'\n\nconst SaveExtraBlock = ({ payload }: BlockProps<SaveExtraBlockData>) => {\n const { primary_text, secondary_text } = payload.instance_slot_data\n\n return (\n <Stack sx={{
|
|
1
|
+
{"version":3,"file":"SaveExtraBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport type { SaveExtraBlockData } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport SaveAnExtraCard from '../../../components/SaveAnExtraCard'\n\nimport type { BlockProps } from '../../types'\n\nconst SaveExtraBlock = ({ payload }: BlockProps<SaveExtraBlockData>) => {\n const { primary_text, secondary_text } = payload.instance_slot_data\n\n return (\n <Stack sx={{ px: 16 }}>\n <SaveAnExtraCard primaryText={primary_text} secondaryText={secondary_text} />\n </Stack>\n )\n}\n\nexport default SaveExtraBlock\n"],"mappings":";;;AAQA,IAAM,IAAA,CAAkB,EAAE,SAAA,EAAA,MAA8C;AACtE,QAAM,EAAE,cAAA,GAAc,gBAAA,EAAA,IAAmB,EAAQ;AAEjD,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,IAAI,GAAG;AAAA,IAClB,UAAA,gBAAA,EAAC,GAAD;AAAA,MAAiB,aAAa;AAAA,MAAc,eAAe;AAAA,IAAiB,CAAA;AAAA,EACvE,CAAA;AAEX"}
|
|
@@ -7,18 +7,19 @@ import R from "./Header.es.js";
|
|
|
7
7
|
import { FeedbackBar as j } from "./FeedbackBar.es.js";
|
|
8
8
|
import z from "./FeedbackDialog.es.js";
|
|
9
9
|
import { DismissInsightDialog as N } from "./DismissInsightDialog.es.js";
|
|
10
|
-
import { HiddenConfirmationCard as
|
|
11
|
-
import { ObsolesceBanner as
|
|
12
|
-
import { ActionBlockLayer as
|
|
10
|
+
import { HiddenConfirmationCard as P } from "./HiddenConfirmationCard.es.js";
|
|
11
|
+
import { ObsolesceBanner as U } from "./ObsolesceBanner.es.js";
|
|
12
|
+
import { ActionBlockLayer as V } from "../actionBlocks/ActionBlockLayer.es.js";
|
|
13
13
|
import { useBeatFeedbackFlow as W } from "../hooks/useBeatFeedbackFlow.es.js";
|
|
14
14
|
import { observer as X } from "mobx-react-lite";
|
|
15
15
|
import m from "@mui/material/Stack";
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import J from "
|
|
20
|
-
import K from "@mui/material/
|
|
21
|
-
|
|
16
|
+
import { P as Y } from "@mxenabled/mxui";
|
|
17
|
+
import p from "@mui/material/Button";
|
|
18
|
+
import { ChevronRight as q } from "@mxenabled/mx-icons";
|
|
19
|
+
import { Fragment as J, jsx as o, jsxs as r } from "react/jsx-runtime";
|
|
20
|
+
import K from "@mui/material/Box";
|
|
21
|
+
import Q from "@mui/material/Card";
|
|
22
|
+
var Z = {}, $ = {
|
|
22
23
|
position: "absolute",
|
|
23
24
|
top: 0,
|
|
24
25
|
left: 0,
|
|
@@ -27,29 +28,29 @@ var Q = {}, Z = {
|
|
|
27
28
|
backgroundColor: "background.default",
|
|
28
29
|
opacity: 0.7,
|
|
29
30
|
zIndex: 1
|
|
30
|
-
},
|
|
31
|
+
}, _e = X(({ beat: i, beatActions: h = Z, obsolete: s }) => {
|
|
31
32
|
const { openCtaDrawer: y } = A(), g = F(), { is_mobile_webview: k, clientConfig: v } = T(), e = W(i, h), t = i.insights_payload;
|
|
32
33
|
if (!t || e.cardState === "dismissed") return null;
|
|
33
|
-
const { instance_slot: _, primary_cta: n, secondary_cta: a, sub_title: C, title: x, widget_type: S, guid:
|
|
34
|
-
H(L) ? y(
|
|
34
|
+
const { instance_slot: _, primary_cta: n, secondary_cta: a, sub_title: C, title: x, widget_type: S, guid: d, user_guid: w, dismissed_at: B } = t, { block: D } = _, u = (L, O) => {
|
|
35
|
+
H(L) ? y(d, O) : I(i, {
|
|
35
36
|
isMobileWebview: k,
|
|
36
37
|
webviewScheme: v?.master?.ui_message_webview_url_scheme,
|
|
37
38
|
userGuid: w
|
|
38
39
|
});
|
|
39
|
-
},
|
|
40
|
+
}, b = E[D], f = S === "mini", l = g.insights_feed?.general, c = s?.state === "not_refreshable" && !B && !!l;
|
|
40
41
|
return /* @__PURE__ */ o(G, {
|
|
41
42
|
value: e.wrappedActions,
|
|
42
43
|
children: /* @__PURE__ */ r(m, {
|
|
43
44
|
sx: { mb: 16 },
|
|
44
45
|
children: [
|
|
45
|
-
e.cardState === "confirming" ? /* @__PURE__ */ o(
|
|
46
|
+
e.cardState === "confirming" ? /* @__PURE__ */ o(P, {
|
|
46
47
|
onClose: e.collapseConfirmation,
|
|
47
48
|
onLeaveFeedback: e.openHideSurvey,
|
|
48
49
|
onUndo: e.undoDismiss
|
|
49
|
-
}) : /* @__PURE__ */ r(
|
|
50
|
+
}) : /* @__PURE__ */ r(J, { children: [s && l && /* @__PURE__ */ o(U, {
|
|
50
51
|
...s,
|
|
51
52
|
copy: l
|
|
52
|
-
}), /* @__PURE__ */ r(
|
|
53
|
+
}), /* @__PURE__ */ r(Q, {
|
|
53
54
|
inert: c,
|
|
54
55
|
sx: { ...c && {
|
|
55
56
|
position: "relative",
|
|
@@ -57,14 +58,14 @@ var Q = {}, Z = {
|
|
|
57
58
|
pointerEvents: "none"
|
|
58
59
|
} },
|
|
59
60
|
children: [
|
|
60
|
-
c && /* @__PURE__ */ o(
|
|
61
|
+
c && /* @__PURE__ */ o(K, { sx: $ }),
|
|
61
62
|
/* @__PURE__ */ o(R, {
|
|
62
|
-
isMini:
|
|
63
|
+
isMini: f,
|
|
63
64
|
subtitle: C,
|
|
64
65
|
title: x ?? ""
|
|
65
66
|
}),
|
|
66
|
-
|
|
67
|
-
beatGuid:
|
|
67
|
+
b && /* @__PURE__ */ o(b, {
|
|
68
|
+
beatGuid: d,
|
|
68
69
|
payload: t
|
|
69
70
|
}),
|
|
70
71
|
/* @__PURE__ */ r(m, {
|
|
@@ -75,11 +76,11 @@ var Q = {}, Z = {
|
|
|
75
76
|
pr: 16,
|
|
76
77
|
pt: 12
|
|
77
78
|
},
|
|
78
|
-
children: [/* @__PURE__ */ o(
|
|
79
|
+
children: [/* @__PURE__ */ o(Y, {
|
|
79
80
|
dangerouslySetInnerHTML: { __html: t.description.html_text },
|
|
80
|
-
|
|
81
|
-
}), i?.in_description_cta && /* @__PURE__ */ o(
|
|
82
|
-
endIcon: /* @__PURE__ */ o(
|
|
81
|
+
variant: "subtitle2"
|
|
82
|
+
}), i?.in_description_cta && /* @__PURE__ */ o(p, {
|
|
83
|
+
endIcon: /* @__PURE__ */ o(q, {}),
|
|
83
84
|
onClick: () => {
|
|
84
85
|
},
|
|
85
86
|
sx: {
|
|
@@ -90,17 +91,17 @@ var Q = {}, Z = {
|
|
|
90
91
|
children: i.in_description_cta
|
|
91
92
|
})]
|
|
92
93
|
}),
|
|
93
|
-
!
|
|
94
|
+
!f && n?.label && /* @__PURE__ */ r(m, {
|
|
94
95
|
sx: {
|
|
95
96
|
gap: 8,
|
|
96
97
|
pb: 16,
|
|
97
98
|
px: 16
|
|
98
99
|
},
|
|
99
|
-
children: [/* @__PURE__ */ o(
|
|
100
|
+
children: [/* @__PURE__ */ o(p, {
|
|
100
101
|
onClick: () => u(n.block, "primaryCta"),
|
|
101
102
|
variant: "outlined",
|
|
102
103
|
children: n.label
|
|
103
|
-
}), a?.label && /* @__PURE__ */ o(
|
|
104
|
+
}), a?.label && /* @__PURE__ */ o(p, {
|
|
104
105
|
color: "secondary",
|
|
105
106
|
onClick: () => u(a.block, "secondaryCta"),
|
|
106
107
|
children: a.label
|
|
@@ -112,7 +113,7 @@ var Q = {}, Z = {
|
|
|
112
113
|
})
|
|
113
114
|
]
|
|
114
115
|
})] }),
|
|
115
|
-
/* @__PURE__ */ o(
|
|
116
|
+
/* @__PURE__ */ o(V, { beat: i }),
|
|
116
117
|
/* @__PURE__ */ o(N, {
|
|
117
118
|
isOpen: e.isDismissOpen,
|
|
118
119
|
onClose: e.closeDismissDialog,
|
|
@@ -137,7 +138,7 @@ var Q = {}, Z = {
|
|
|
137
138
|
});
|
|
138
139
|
});
|
|
139
140
|
export {
|
|
140
|
-
|
|
141
|
+
_e as default
|
|
141
142
|
};
|
|
142
143
|
|
|
143
144
|
//# sourceMappingURL=BaseLayout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseLayout.es.js","names":[],"sources":["../../../src/insights-v2/components/BaseLayout.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport Stack from '@mui/material/Stack'\n\nimport { ChevronRight } from '@mxenabled/mx-icons'\n\nimport { blocks, hasDrawerBlock } from '../mappings/blocks'\n\nimport Footer from './Footer'\nimport Header from './Header'\nimport FeedbackBar from './FeedbackBar'\nimport FeedbackDialog from './FeedbackDialog'\nimport DismissInsightDialog from './DismissInsightDialog'\nimport HiddenConfirmationCard from './HiddenConfirmationCard'\nimport { ObsolesceBanner, type ObsolesceBannerState } from './ObsolesceBanner'\nimport { useAppConfig, useGlobalCopyStore, useInsightsV2Store } from '../../common'\nimport { sendBeatCta } from '../../common/utils/PostMessage'\nimport type { Beat } from '../../core'\nimport { BeatActionsProvider, type BeatActions } from '../beatActions'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { useBeatFeedbackFlow } from '../hooks/useBeatFeedbackFlow'\n\nexport interface ObsoleteState {\n state: ObsolesceBannerState\n onRefresh: () => void\n onDismiss: () => void\n}\n\ninterface BaseLayoutProps {\n beat: Beat\n beatActions?: BeatActions\n obsolete?: ObsoleteState\n}\n\nconst NO_BEAT_ACTIONS: BeatActions = {}\n\nconst OBSOLETE_OVERLAY_SX = {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n backgroundColor: 'background.default',\n opacity: 0.7,\n zIndex: 1,\n} as const\n\nconst BaseLayout = observer(\n ({ beat, beatActions = NO_BEAT_ACTIONS, obsolete }: BaseLayoutProps) => {\n const { openCtaDrawer } = useInsightsV2Store()\n const copy = useGlobalCopyStore()\n const { is_mobile_webview, clientConfig } = useAppConfig()\n const flow = useBeatFeedbackFlow(beat, beatActions)\n\n const insights_payload = beat.insights_payload\n\n if (!insights_payload) return null\n if (flow.cardState === 'dismissed') return null\n\n const {\n instance_slot,\n primary_cta,\n secondary_cta,\n sub_title,\n title,\n widget_type,\n guid,\n user_guid,\n dismissed_at,\n } = insights_payload\n const { block } = instance_slot\n\n // A CTA with a real drilldown `block` opens a drawer; otherwise it notifies\n // the host app via a beat/cta post message (the \"Make a Transfer\" CTA on the\n // Save an extra $100 beat). Mirrors Pulse's SaveAnExtra100Dollars beat.\n const handleCtaClick = (\n ctaBlock: string | null | undefined,\n source: 'primaryCta' | 'secondaryCta',\n ) => {\n if (hasDrawerBlock(ctaBlock)) {\n openCtaDrawer(guid, source)\n } else {\n sendBeatCta(beat, {\n isMobileWebview: is_mobile_webview,\n webviewScheme: clientConfig?.master?.ui_message_webview_url_scheme,\n userGuid: user_guid,\n })\n }\n }\n\n const Block = blocks[block as keyof typeof blocks]\n\n const isMini = widget_type === 'mini'\n const obsoleteCopy = copy.insights_feed?.general\n const isObsoleteDimmed =\n obsolete?.state === 'not_refreshable' && !dismissed_at && !!obsoleteCopy\n\n return (\n <BeatActionsProvider value={flow.wrappedActions}>\n <Stack sx={{ mb: 16 }}>\n {flow.cardState === 'confirming' ? (\n <HiddenConfirmationCard\n onClose={flow.collapseConfirmation}\n onLeaveFeedback={flow.openHideSurvey}\n onUndo={flow.undoDismiss}\n />\n ) : (\n <>\n {obsolete && obsoleteCopy && <ObsolesceBanner {...obsolete} copy={obsoleteCopy} />}\n <Card\n inert={isObsoleteDimmed}\n sx={{\n ...(isObsoleteDimmed && {\n position: 'relative',\n zIndex: 2,\n pointerEvents: 'none',\n }),\n }}\n >\n {isObsoleteDimmed && <Box sx={OBSOLETE_OVERLAY_SX} />}\n <Header isMini={isMini} subtitle={sub_title} title={title ?? ''} />\n {Block && <Block beatGuid={guid} payload={insights_payload} />}\n\n <Stack sx={{ gap: 6, pb: 16, pl: 12, pr: 16, pt: 12 }}>\n <div\n dangerouslySetInnerHTML={{\n __html: insights_payload.description.html_text,\n }}\n style={{ paddingLeft: 4 }}\n />\n {/* TODO: Migrate to insights_payload.in_description_cta once backend provides it */}\n {beat?.in_description_cta && (\n <Button\n endIcon={<ChevronRight />}\n onClick={() => {}}\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {beat.in_description_cta}\n </Button>\n )}\n </Stack>\n\n {!isMini && primary_cta?.label && (\n <Stack sx={{ gap: 8, pb: 16, px: 16 }}>\n <Button\n onClick={() => handleCtaClick(primary_cta.block, 'primaryCta')}\n variant=\"outlined\"\n >\n {primary_cta.label}\n </Button>\n {secondary_cta?.label && (\n <Button\n color=\"secondary\"\n onClick={() => handleCtaClick(secondary_cta.block, 'secondaryCta')}\n >\n {secondary_cta.label}\n </Button>\n )}\n </Stack>\n )}\n\n <FeedbackBar onTellUsMore={flow.openRatingSurvey} show={flow.isFeedbackBarShown} />\n </Card>\n </>\n )}\n\n <ActionBlockLayer beat={beat} />\n\n <DismissInsightDialog\n isOpen={flow.isDismissOpen}\n onClose={flow.closeDismissDialog}\n onDismiss={flow.confirmDismiss}\n />\n\n {flow.isSurveyOpen && (\n <FeedbackDialog\n characterLimitLabel={flow.survey.characterLimitLabel}\n closeAriaLabel={flow.survey.closeAriaLabel}\n isOpen={true}\n onBackClick={flow.feedbackDialogCallbacks.onBackClick}\n onClose={flow.closeSurvey}\n onSubmit={flow.submitSurvey}\n onTextInputFocus={flow.feedbackDialogCallbacks.onTextInputFocus}\n options={flow.survey.options}\n primaryText={flow.survey.submitText}\n secondaryText={flow.survey.backText}\n title={flow.survey.title}\n />\n )}\n\n {flow.cardState === 'visible' && insights_payload.footer && (\n <Footer footer={insights_payload.footer} />\n )}\n </Stack>\n </BeatActionsProvider>\n )\n },\n)\n\nexport default BaseLayout\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqCA,IAAM,IAA+B,CAAC,GAEhC,IAAsB;AAAA,EAC1B,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,SAAS;AAAA,EACT,QAAQ;AACV,GAEM,KAAa,EAAA,CAChB,EAAE,MAAA,GAAM,aAAA,IAAc,GAAiB,UAAA,EAAA,MAAgC;AACtE,QAAM,EAAE,eAAA,EAAA,IAAkB,EAAmB,GACvC,IAAO,EAAmB,GAC1B,EAAE,mBAAA,GAAmB,cAAA,EAAA,IAAiB,EAAa,GACnD,IAAO,EAAoB,GAAM,CAAW,GAE5C,IAAmB,EAAK;AAG9B,MADI,CAAC,KACD,EAAK,cAAc,YAAa,QAAO;AAE3C,QAAM,EACJ,eAAA,GACA,aAAA,GACA,eAAA,GACA,WAAA,GACA,OAAA,GACA,aAAA,GACA,MAAA,GACA,WAAA,GACA,cAAA,EAAA,IACE,GACE,EAAE,OAAA,EAAA,IAAU,GAKZ,IAAA,CACJ,GACA,MACG;AACH,IAAI,EAAe,CAAQ,IACzB,EAAc,GAAM,CAAM,IAE1B,EAAY,GAAM;AAAA,MAChB,iBAAiB;AAAA,MACjB,eAAe,GAAc,QAAQ;AAAA,MACrC,UAAU;AAAA,IACZ,CAAC;AAAA,EAEL,GAEM,IAAQ,EAAO,CAAA,GA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1C,SAAS,EAAK;AAAA,UACd,UAAU,EAAK;AAAA,UACf,kBAAkB,EAAK,wBAAwB;AAAA,UAC/C,SAAS,EAAK,OAAO;AAAA,UACrB,aAAa,EAAK,OAAO;AAAA,UACzB,eAAe,EAAK,OAAO;AAAA,UAC3B,OAAO,EAAK,OAAO;AAAA,QACpB,CAAA;AAAA,QAGF,EAAK,cAAc,aAAa,EAAiB,UAChD,gBAAA,EAAC,GAAD,EAAQ,QAAQ,EAAiB,OAAS,CAAA;AAAA,MAEvC;AAAA;EACY,CAAA;AAEzB,CACF"}
|
|
1
|
+
{"version":3,"file":"BaseLayout.es.js","names":[],"sources":["../../../src/insights-v2/components/BaseLayout.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport Stack from '@mui/material/Stack'\n\nimport { ChevronRight } from '@mxenabled/mx-icons'\nimport { P } from '@mxenabled/mxui'\n\nimport { blocks, hasDrawerBlock } from '../mappings/blocks'\n\nimport Footer from './Footer'\nimport Header from './Header'\nimport FeedbackBar from './FeedbackBar'\nimport FeedbackDialog from './FeedbackDialog'\nimport DismissInsightDialog from './DismissInsightDialog'\nimport HiddenConfirmationCard from './HiddenConfirmationCard'\nimport { ObsolesceBanner, type ObsolesceBannerState } from './ObsolesceBanner'\nimport { useAppConfig, useGlobalCopyStore, useInsightsV2Store } from '../../common'\nimport { sendBeatCta } from '../../common/utils/PostMessage'\nimport type { Beat } from '../../core'\nimport { BeatActionsProvider, type BeatActions } from '../beatActions'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { useBeatFeedbackFlow } from '../hooks/useBeatFeedbackFlow'\n\nexport interface ObsoleteState {\n state: ObsolesceBannerState\n onRefresh: () => void\n onDismiss: () => void\n}\n\ninterface BaseLayoutProps {\n beat: Beat\n beatActions?: BeatActions\n obsolete?: ObsoleteState\n}\n\nconst NO_BEAT_ACTIONS: BeatActions = {}\n\nconst OBSOLETE_OVERLAY_SX = {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n backgroundColor: 'background.default',\n opacity: 0.7,\n zIndex: 1,\n} as const\n\nconst BaseLayout = observer(\n ({ beat, beatActions = NO_BEAT_ACTIONS, obsolete }: BaseLayoutProps) => {\n const { openCtaDrawer } = useInsightsV2Store()\n const copy = useGlobalCopyStore()\n const { is_mobile_webview, clientConfig } = useAppConfig()\n const flow = useBeatFeedbackFlow(beat, beatActions)\n\n const insights_payload = beat.insights_payload\n\n if (!insights_payload) return null\n if (flow.cardState === 'dismissed') return null\n\n const {\n instance_slot,\n primary_cta,\n secondary_cta,\n sub_title,\n title,\n widget_type,\n guid,\n user_guid,\n dismissed_at,\n } = insights_payload\n const { block } = instance_slot\n\n // A CTA with a real drilldown `block` opens a drawer; otherwise it notifies\n // the host app via a beat/cta post message (the \"Make a Transfer\" CTA on the\n // Save an extra $100 beat). Mirrors Pulse's SaveAnExtra100Dollars beat.\n const handleCtaClick = (\n ctaBlock: string | null | undefined,\n source: 'primaryCta' | 'secondaryCta',\n ) => {\n if (hasDrawerBlock(ctaBlock)) {\n openCtaDrawer(guid, source)\n } else {\n sendBeatCta(beat, {\n isMobileWebview: is_mobile_webview,\n webviewScheme: clientConfig?.master?.ui_message_webview_url_scheme,\n userGuid: user_guid,\n })\n }\n }\n\n const Block = blocks[block as keyof typeof blocks]\n\n const isMini = widget_type === 'mini'\n const obsoleteCopy = copy.insights_feed?.general\n const isObsoleteDimmed =\n obsolete?.state === 'not_refreshable' && !dismissed_at && !!obsoleteCopy\n\n return (\n <BeatActionsProvider value={flow.wrappedActions}>\n <Stack sx={{ mb: 16 }}>\n {flow.cardState === 'confirming' ? (\n <HiddenConfirmationCard\n onClose={flow.collapseConfirmation}\n onLeaveFeedback={flow.openHideSurvey}\n onUndo={flow.undoDismiss}\n />\n ) : (\n <>\n {obsolete && obsoleteCopy && <ObsolesceBanner {...obsolete} copy={obsoleteCopy} />}\n <Card\n inert={isObsoleteDimmed}\n sx={{\n ...(isObsoleteDimmed && {\n position: 'relative',\n zIndex: 2,\n pointerEvents: 'none',\n }),\n }}\n >\n {isObsoleteDimmed && <Box sx={OBSOLETE_OVERLAY_SX} />}\n <Header isMini={isMini} subtitle={sub_title} title={title ?? ''} />\n {Block && <Block beatGuid={guid} payload={insights_payload} />}\n\n <Stack sx={{ gap: 6, pb: 16, pl: 12, pr: 16, pt: 12 }}>\n <P\n dangerouslySetInnerHTML={{\n __html: insights_payload.description.html_text,\n }}\n variant=\"subtitle2\"\n />\n {/* TODO: Migrate to insights_payload.in_description_cta once backend provides it */}\n {beat?.in_description_cta && (\n <Button\n endIcon={<ChevronRight />}\n onClick={() => {}}\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {beat.in_description_cta}\n </Button>\n )}\n </Stack>\n\n {!isMini && primary_cta?.label && (\n <Stack sx={{ gap: 8, pb: 16, px: 16 }}>\n <Button\n onClick={() => handleCtaClick(primary_cta.block, 'primaryCta')}\n variant=\"outlined\"\n >\n {primary_cta.label}\n </Button>\n {secondary_cta?.label && (\n <Button\n color=\"secondary\"\n onClick={() => handleCtaClick(secondary_cta.block, 'secondaryCta')}\n >\n {secondary_cta.label}\n </Button>\n )}\n </Stack>\n )}\n\n <FeedbackBar onTellUsMore={flow.openRatingSurvey} show={flow.isFeedbackBarShown} />\n </Card>\n </>\n )}\n\n <ActionBlockLayer beat={beat} />\n\n <DismissInsightDialog\n isOpen={flow.isDismissOpen}\n onClose={flow.closeDismissDialog}\n onDismiss={flow.confirmDismiss}\n />\n\n {flow.isSurveyOpen && (\n <FeedbackDialog\n characterLimitLabel={flow.survey.characterLimitLabel}\n closeAriaLabel={flow.survey.closeAriaLabel}\n isOpen={true}\n onBackClick={flow.feedbackDialogCallbacks.onBackClick}\n onClose={flow.closeSurvey}\n onSubmit={flow.submitSurvey}\n onTextInputFocus={flow.feedbackDialogCallbacks.onTextInputFocus}\n options={flow.survey.options}\n primaryText={flow.survey.submitText}\n secondaryText={flow.survey.backText}\n title={flow.survey.title}\n />\n )}\n\n {flow.cardState === 'visible' && insights_payload.footer && (\n <Footer footer={insights_payload.footer} />\n )}\n </Stack>\n </BeatActionsProvider>\n )\n },\n)\n\nexport default BaseLayout\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsCA,IAAM,IAA+B,CAAC,GAEhC,IAAsB;AAAA,EAC1B,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,SAAS;AAAA,EACT,QAAQ;AACV,GAEM,KAAa,EAAA,CAChB,EAAE,MAAA,GAAM,aAAA,IAAc,GAAiB,UAAA,EAAA,MAAgC;AACtE,QAAM,EAAE,eAAA,EAAA,IAAkB,EAAmB,GACvC,IAAO,EAAmB,GAC1B,EAAE,mBAAA,GAAmB,cAAA,EAAA,IAAiB,EAAa,GACnD,IAAO,EAAoB,GAAM,CAAW,GAE5C,IAAmB,EAAK;AAG9B,MADI,CAAC,KACD,EAAK,cAAc,YAAa,QAAO;AAE3C,QAAM,EACJ,eAAA,GACA,aAAA,GACA,eAAA,GACA,WAAA,GACA,OAAA,GACA,aAAA,GACA,MAAA,GACA,WAAA,GACA,cAAA,EAAA,IACE,GACE,EAAE,OAAA,EAAA,IAAU,GAKZ,IAAA,CACJ,GACA,MACG;AACH,IAAI,EAAe,CAAQ,IACzB,EAAc,GAAM,CAAM,IAE1B,EAAY,GAAM;AAAA,MAChB,iBAAiB;AAAA,MACjB,eAAe,GAAc,QAAQ;AAAA,MACrC,UAAU;AAAA,IACZ,CAAC;AAAA,EAEL,GAEM,IAAQ,EAAO,CAAA,GAEf,IAAS,MAAgB,QACzB,IAAe,EAAK,eAAe,SACnC,IACJ,GAAU,UAAU,qBAAqB,CAAC,KAAgB,CAAC,CAAC;AAE9D,SACE,gBAAA,EAAC,GAAD;AAAA,IAAqB,OAAO,EAAK;AAAA,IAC/B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AK,OAAO;AAAA,QACpB,CAAA;AAAA,QAGF,EAAK,cAAc,aAAa,EAAiB,UAChD,gBAAA,EAAC,GAAD,EAAQ,QAAQ,EAAiB,OAAS,CAAA;AAAA,MAEvC;AAAA;EACY,CAAA;AAEzB,CACF"}
|
|
@@ -1,40 +1,38 @@
|
|
|
1
1
|
import { formatCurrency as h } from "../../core/utils/NumberFormatting.es.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { jsx as o, jsxs as e } from "react/jsx-runtime";
|
|
2
|
+
import { P as m, Text as o } from "@mxenabled/mxui";
|
|
3
|
+
import { jsx as r, jsxs as e } from "react/jsx-runtime";
|
|
5
4
|
import t from "@mui/material/Box";
|
|
6
|
-
var
|
|
7
|
-
const [l, d, s] =
|
|
5
|
+
var g = ({ primaryText: n = [], secondaryText: i = [], bgcolor: c = "success.main", sx: a }) => {
|
|
6
|
+
const [l, d, s] = n, [p, x] = i;
|
|
8
7
|
return /* @__PURE__ */ e(t, {
|
|
9
8
|
sx: {
|
|
10
9
|
border: "1px solid",
|
|
11
10
|
borderColor: "success.main",
|
|
12
11
|
borderRadius: 2,
|
|
13
|
-
boxShadow: m,
|
|
14
12
|
overflow: "hidden",
|
|
15
|
-
...
|
|
13
|
+
...a
|
|
16
14
|
},
|
|
17
15
|
children: [/* @__PURE__ */ e(t, {
|
|
18
16
|
sx: {
|
|
19
|
-
bgcolor:
|
|
17
|
+
bgcolor: c,
|
|
20
18
|
color: "success.contrastText",
|
|
21
19
|
p: 16,
|
|
22
20
|
pt: 12,
|
|
23
21
|
textAlign: "center"
|
|
24
22
|
},
|
|
25
23
|
children: [
|
|
26
|
-
/* @__PURE__ */
|
|
24
|
+
/* @__PURE__ */ r(m, {
|
|
27
25
|
color: "inherit",
|
|
28
26
|
variant: "subtitle1",
|
|
29
27
|
children: l
|
|
30
28
|
}),
|
|
31
|
-
/* @__PURE__ */ o
|
|
29
|
+
/* @__PURE__ */ r(o, {
|
|
32
30
|
bold: !0,
|
|
33
31
|
color: "inherit",
|
|
34
32
|
variant: "h1",
|
|
35
33
|
children: h(Number(d ?? "0"), "0,0.00")
|
|
36
34
|
}),
|
|
37
|
-
/* @__PURE__ */ o
|
|
35
|
+
/* @__PURE__ */ r(o, {
|
|
38
36
|
color: "inherit",
|
|
39
37
|
variant: "caption",
|
|
40
38
|
children: s
|
|
@@ -47,10 +45,10 @@ var C = ({ primaryText: i = [], secondaryText: n = [], bgcolor: a = "success.mai
|
|
|
47
45
|
py: 12,
|
|
48
46
|
textAlign: "center"
|
|
49
47
|
},
|
|
50
|
-
children: [/* @__PURE__ */ o
|
|
48
|
+
children: [/* @__PURE__ */ r(o, {
|
|
51
49
|
variant: "h3",
|
|
52
50
|
children: p
|
|
53
|
-
}), /* @__PURE__ */ o
|
|
51
|
+
}), /* @__PURE__ */ r(o, {
|
|
54
52
|
color: "text.secondary",
|
|
55
53
|
variant: "caption",
|
|
56
54
|
children: x
|
|
@@ -59,7 +57,7 @@ var C = ({ primaryText: i = [], secondaryText: n = [], bgcolor: a = "success.mai
|
|
|
59
57
|
});
|
|
60
58
|
};
|
|
61
59
|
export {
|
|
62
|
-
|
|
60
|
+
g as default
|
|
63
61
|
};
|
|
64
62
|
|
|
65
63
|
//# sourceMappingURL=SaveAnExtraCard.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveAnExtraCard.es.js","names":[],"sources":["../../../src/insights-v2/components/SaveAnExtraCard.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport type { SxProps, Theme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { formatCurrency } from '../../core/utils/NumberFormatting'\n\
|
|
1
|
+
{"version":3,"file":"SaveAnExtraCard.es.js","names":[],"sources":["../../../src/insights-v2/components/SaveAnExtraCard.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport type { SxProps, Theme } from '@mui/material/styles'\n\nimport { P, Text } from '@mxenabled/mxui'\n\nimport { formatCurrency } from '../../core/utils/NumberFormatting'\n\ninterface SaveAnExtraCardProps {\n primaryText?: string[]\n secondaryText?: string[]\n bgcolor?: string\n sx?: SxProps<Theme>\n}\n\nconst SaveAnExtraCard = ({\n primaryText = [],\n secondaryText = [],\n bgcolor = 'success.main',\n sx,\n}: SaveAnExtraCardProps) => {\n const [leadIn, amount, trailingCopy] = primaryText\n const [projected, projectedCaption] = secondaryText\n\n return (\n <Box\n sx={{\n border: '1px solid',\n borderColor: 'success.main',\n borderRadius: 2,\n\n overflow: 'hidden',\n ...sx,\n }}\n >\n {/* Green header */}\n <Box\n sx={{\n bgcolor,\n color: 'success.contrastText',\n p: 16,\n pt: 12,\n textAlign: 'center',\n }}\n >\n <P color=\"inherit\" variant=\"subtitle1\">\n {leadIn}\n </P>\n <Text bold={true} color=\"inherit\" variant=\"h1\">\n {formatCurrency(Number(amount ?? '0'), '0,0.00')}\n </Text>\n <Text color=\"inherit\" variant=\"caption\">\n {trailingCopy}\n </Text>\n </Box>\n\n {/* White footer with projected amount. The projected balance arrives\n pre-formatted from the backend (e.g. \"$3,320\"), so render it as-is. */}\n <Box\n sx={{\n bgcolor: 'background.paper',\n px: 16,\n py: 12,\n textAlign: 'center',\n }}\n >\n <Text variant=\"h3\">{projected}</Text>\n <Text color=\"text.secondary\" variant=\"caption\">\n {projectedCaption}\n </Text>\n </Box>\n </Box>\n )\n}\n\nexport default SaveAnExtraCard\n"],"mappings":";;;;AAcA,IAAM,IAAA,CAAmB,EACvB,aAAA,IAAc,CAAC,GACf,eAAA,IAAgB,CAAC,GACjB,SAAA,IAAU,gBACV,IAAA,EAAA,MAC0B;AAC1B,QAAM,CAAC,GAAQ,GAAQ,CAAA,IAAgB,GACjC,CAAC,GAAW,CAAA,IAAoB;AAEtC,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,IAAI;AAAA,MACF,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,cAAc;AAAA,MAEd,UAAU;AAAA,MACV,GAAG;AAAA,IACL;AA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