@mx-cartographer/experiences 9.4.39 → 9.4.41
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 +8 -0
- package/dist/core/stores/GlobalStore.es.js +12 -8
- package/dist/core/stores/GlobalStore.es.js.map +1 -1
- package/dist/core/stores/RecurringTransactionsStore.d.ts +1 -0
- package/dist/core/stores/RecurringTransactionsStore.es.js +40 -36
- package/dist/core/stores/RecurringTransactionsStore.es.js.map +1 -1
- package/dist/core/types/Transaction.d.ts +1 -0
- package/dist/core/types/Transaction.es.js.map +1 -1
- package/dist/core/utils/TransactionUtils.d.ts +4 -2
- package/dist/core/utils/TransactionUtils.es.js +52 -50
- package/dist/core/utils/TransactionUtils.es.js.map +1 -1
- package/dist/transactions/components/shared/TransactionDetails.es.js +84 -82
- package/dist/transactions/components/shared/TransactionDetails.es.js.map +1 -1
- package/dist/transactions/components/shared/transactiondetails/Description.d.ts +1 -0
- package/dist/transactions/components/shared/transactiondetails/Description.es.js +39 -39
- package/dist/transactions/components/shared/transactiondetails/Description.es.js.map +1 -1
- package/dist/transactions/components/shared/transactiondetails/TransactionAmountHeader.es.js +18 -17
- package/dist/transactions/components/shared/transactiondetails/TransactionAmountHeader.es.js.map +1 -1
- package/dist/transactions/components/shared/transactionlist/TransactionRow.es.js +26 -25
- package/dist/transactions/components/shared/transactionlist/TransactionRow.es.js.map +1 -1
- package/dist/transactions/components/shared/transactiontable/cells/PayeeCell.d.ts +2 -1
- package/dist/transactions/components/shared/transactiontable/cells/PayeeCell.es.js +27 -23
- package/dist/transactions/components/shared/transactiontable/cells/PayeeCell.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionDetails.es.js","names":[],"sources":["../../../../src/transactions/components/shared/TransactionDetails.tsx"],"sourcesContent":["import React, { useMemo } from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Alert from '@mui/material/Alert'\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport List from '@mui/material/List'\nimport Paper from '@mui/material/Paper'\nimport Snackbar from '@mui/material/Snackbar'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { MerchantLogo, P, Text } from '@mxenabled/mxui'\n\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { isBefore } from 'date-fns/isBefore'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport {\n ANALYTICS_EVENTS,\n Loader,\n useCategoryStore,\n useEvent,\n useGlobalCopyStore,\n useGlobalUiStore,\n useTransactionStore,\n useUserStore,\n} from '../../../common'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport { Transaction, TransactionType } from '../../../core'\nimport { fromUnixUTC } from '../../../core/utils/DateUtil'\nimport { isFeatureEnabled } from '../../../core/utils/UserUtils'\nimport { ChartTransactionWithDrillDown, EmbeddedCard } from '../../../insights'\n\nimport {\n BottomActions,\n DEFAULT_BOTTOM_ACTIONS,\n DEFAULT_TOP_ACTIONS,\n TopActions,\n} from '../../constants/Actions'\n\nimport {\n AddMerchantBudgetAction,\n CategoryAction,\n DateAction,\n DeleteAction,\n DeleteLogoAction,\n ExcludeAction,\n MemoAction,\n SplitAction,\n TagsAction,\n} from './transactiondetails/actions'\nimport Description from './transactiondetails/Description'\nimport FlagTransaction from './transactiondetails/FlagTransaction'\nimport TransactionDetailsView from './transactiondetails/TransactionDetailsView'\nimport { getEmbeddedInstanceSlotByBeatTemplates } from './getEmbeddedInstanceSlotByBeatTemplates'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\n\nexport interface TransactionDetailsProps {\n bottomActions?: BottomActions[]\n canFlagTransaction?: boolean\n topActions?: TopActions[]\n transaction: Transaction\n}\n\nconst TransactionDetails: React.FC<TransactionDetailsProps> = ({\n bottomActions = DEFAULT_BOTTOM_ACTIONS,\n canFlagTransaction = true,\n topActions = DEFAULT_TOP_ACTIONS,\n transaction,\n}) => {\n const { onEvent } = useEvent()\n const { isCopyLoaded } = useGlobalUiStore()\n const { userFeatures } = useUserStore()\n const { accounts: copy, common: commonCopy, insights_feed: insightsCopy } = useGlobalCopyStore()\n\n const { detailedCategories } = useCategoryStore()\n const {\n alert,\n associatedBeats,\n detailedTransactions,\n cachedStartDate,\n loadEmbeddedInstanceTransactions,\n setAlert,\n } = useTransactionStore()\n\n const [showTranscationDrilldownDrawer, setShowTransactionDrillDownDrawer] = React.useState(false)\n\n const [isLoading, setIsLoading] = React.useState(false)\n const [closeTipSection, setCloseTipSection] = React.useState(false)\n const theme = useTheme()\n\n const showFullNumber = transaction?.number && transaction.number.length > 4\n\n const isCredit = transaction?.transaction_type === TransactionType.CREDIT\n\n const beat = React.useMemo(() => {\n return associatedBeats.find((beat) => beat.associated_transaction_guid === transaction.guid)\n }, [associatedBeats, transaction])\n\n const embeddedData = getEmbeddedInstanceSlotByBeatTemplates(commonCopy, beat)\n\n const [selectedTabIndex, setSelectedTabIndex] = React.useState(\n embeddedData ? embeddedData.dataSeries.length - 1 : 0,\n )\n\n React.useEffect(\n () =>\n onEvent(ANALYTICS_EVENTS.TRANSACTION_DETAILS_VIEW, { transaction_guid: transaction.guid }),\n [],\n )\n\n React.useEffect(() => {\n if (!embeddedData || embeddedData.dataSeries.length === 0) return\n\n const { date: selectedSeriesItemDate } = embeddedData.dataSeries[selectedTabIndex]\n\n const start = startOfMonth(selectedSeriesItemDate)\n\n if (isBefore(start, cachedStartDate)) {\n setIsLoading(true)\n loadEmbeddedInstanceTransactions(start).finally(() => {\n setIsLoading(false)\n })\n }\n }, [selectedTabIndex, embeddedData, cachedStartDate])\n\n //if merchant_guid is null then no need to show the MerchantBudget action.\n const updatedBottomActions =\n bottomActions.includes(BottomActions.MerchantBudget) && !transaction?.merchant_guid\n ? bottomActions.filter((action) => action !== BottomActions.MerchantBudget)\n : bottomActions\n\n const embeddedCardDataCategory = useMemo(() => {\n if (embeddedData) {\n const category = detailedCategories.find(\n (cat) => cat.guid === transaction.top_level_category_guid,\n )\n const mean = beat?.payload?.average_amount ?? 0\n const currentAmount = transaction.amount\n\n let changetype = insightsCopy.general.increased_text\n if (currentAmount - mean < 0) {\n changetype = insightsCopy.general.decreased_text\n }\n const percentageAmount =\n mean === 0 ? 0 : Math.round((Math.abs(currentAmount - mean) / mean) * 100)\n\n return { category, percentageAmount, changetype }\n }\n return null\n }, [embeddedData, detailedCategories])\n\n const filteredTransactions = useMemo(() => {\n if (!embeddedData?.dataSeries?.length) {\n return []\n }\n\n const { guid: selectedSeriesItemGuid, date: selectedSeriesItemDate } =\n embeddedData.dataSeries[selectedTabIndex]\n\n const start = startOfMonth(selectedSeriesItemDate)\n const end = endOfMonth(selectedSeriesItemDate)\n\n return detailedTransactions.filter((t) => {\n const transactionDate = fromUnixUTC(t.date)\n return transactionDate >= start && transactionDate <= end && t.guid === selectedSeriesItemGuid\n })\n }, [selectedTabIndex, embeddedData, detailedTransactions, isLoading])\n\n if (!isCopyLoaded) {\n return <Loader />\n }\n\n const shouldShowViewOnlyMode = isFeatureEnabled(userFeatures, 'MX_TXN_DETAILS_VIEW_ONLY')\n\n const bgColor = theme.palette.mode === 'dark' ? 'grey.800' : 'grey.100'\n\n return (\n <Box className=\"mx-txn-transaction-details\" width=\"100%\">\n {transaction && (\n <Stack>\n <Stack gap={12} p={24}>\n <Paper elevation={2} sx={{ width: 64 }}>\n <MerchantLogo\n categoryGuid={transaction.top_level_category_guid || ''}\n merchantGuid={transaction.merchant_guid || ''}\n size={64}\n />\n </Paper>\n\n <Description transaction={transaction} viewOnly={shouldShowViewOnlyMode} />\n\n <Stack direction=\"row\" justifyContent=\"space-between\" sx={{ minHeight: 44 }}>\n <P color={isCredit ? 'success.main' : 'text.primary'} variant=\"h1\">\n {isCredit ? '+' : ''}\n {formatCurrency(transaction.amount, '0,0.00')}\n </P>\n {!shouldShowViewOnlyMode && canFlagTransaction && (\n <FlagTransaction transaction={transaction} />\n )}\n </Stack>\n\n {embeddedData?.instanceSlot && (\n <EmbeddedCard\n callToAction={embeddedData.callToAction}\n description={\n buildDynamicCopy(\n insightsCopy.general.embedded_description,\n embeddedCardDataCategory!.changetype,\n <strong>{embeddedCardDataCategory!.percentageAmount}</strong>,\n ) as string\n }\n instanceSlot={embeddedData.instanceSlot}\n onCtaClick={() => {\n setShowTransactionDrillDownDrawer(true)\n }}\n title={beat!.html_micro_title!}\n />\n )}\n <Stack sx={{ bgcolor: bgColor, borderRadius: '4px', gap: 4, p: 8 }}>\n <Text bold={true}>\n {`${transaction.account}\n ${\n showFullNumber\n ? transaction.number\n : '\\u2022'.repeat(4).concat(transaction.number ?? '')\n }`}\n </Text>\n <Text bold={true} truncate={true} variant=\"tiny\">\n {transaction.feed_description}\n </Text>\n </Stack>\n </Stack>\n\n <Paper square={true} sx={{ boxShadow: 'none' }}>\n {shouldShowViewOnlyMode ? (\n <TransactionDetailsView transaction={transaction} />\n ) : (\n <List>\n {topActions.map((action, index) => (\n <React.Fragment key={action}>\n {action === TopActions.Category && <CategoryAction transaction={transaction} />}\n {action === TopActions.Date && <DateAction transaction={transaction} />}\n {action === TopActions.Memo && <MemoAction transaction={transaction} />}\n {action === TopActions.Tags && <TagsAction transaction={transaction} />}\n <Divider\n component=\"li\"\n variant={index < topActions.length - 1 ? 'inset' : 'fullWidth'}\n />\n </React.Fragment>\n ))}\n </List>\n )}\n </Paper>\n\n {!shouldShowViewOnlyMode && updatedBottomActions.length > 0 && (\n <React.Fragment>\n <Text bold={true} mb={8} ml={26} mt={16} variant=\"body1\">\n {copy.actions}\n </Text>\n\n <Paper square={true} sx={{ boxShadow: 'none' }}>\n <List>\n {updatedBottomActions.map((action, index) => (\n <React.Fragment key={action}>\n {action === BottomActions.MerchantBudget && (\n <AddMerchantBudgetAction transaction={transaction} />\n )}\n {action === BottomActions.SplitTransaction && (\n <SplitAction transaction={transaction} />\n )}\n {action === BottomActions.HideTransaction && (\n <ExcludeAction transaction={transaction} />\n )}\n {action === BottomActions.MerchantLogo && (\n <DeleteLogoAction transaction={transaction} />\n )}\n <Divider\n component=\"li\"\n variant={index < updatedBottomActions.length - 1 ? 'inset' : 'fullWidth'}\n />\n </React.Fragment>\n ))}\n\n {/*\n Show DeleteAction only if:\n - The transaction is manual\n - The transaction is NOT a parent transaction (no parent_guid)\n - The transaction has NOT been split (has_been_split is false)\n \n This ensures delete is hidden for parent or split transactions.\n */}\n {transaction.is_manual &&\n !transaction.parent_guid &&\n !transaction.has_been_split && <DeleteAction transaction={transaction} />}\n </List>\n </Paper>\n </React.Fragment>\n )}\n </Stack>\n )}\n {beat && embeddedData && (\n <ChartTransactionWithDrillDown\n ariaLabel={formatDate(\n embeddedData?.dataSeries[selectedTabIndex]?.date,\n DATE_FORMATS_INTL.MONTH,\n )}\n barChartProps={{\n amounts: {\n average: beat.payload.average_amount,\n formattedAverage: formatCurrency(beat.payload.average_amount, '0,0'),\n },\n color: embeddedCardDataCategory!.category?.color || '',\n data: embeddedData.chartData,\n margin: { bottom: 10, left: 24, right: 24, top: 20 },\n monthlyAmountLabel: insightsCopy.general.monthly_amount,\n onBarClick: (index) => {\n setSelectedTabIndex(index)\n },\n trendAmountLabel: insightsCopy.general.trend,\n legendPosition: 'top',\n }}\n beat={{\n heading: beat.html_title,\n subHeading: {\n category_guid: transaction.category_guid ?? '',\n merchant_guid: transaction.merchant_guid ?? '',\n description: transaction.description ?? '',\n },\n }}\n data={embeddedData.chartData}\n defaultSelectedIndex={selectedTabIndex}\n icon={\n <MerchantLogo\n alt={transaction.description ?? ''}\n categoryGuid={transaction.category_guid ?? ''}\n merchantGuid={transaction.merchant_guid ?? ''}\n size={16}\n />\n }\n isOpen={showTranscationDrilldownDrawer}\n onClose={() => {\n setShowTransactionDrillDownDrawer(false)\n setSelectedTabIndex(embeddedData!.dataSeries.length - 1)\n }}\n onTabChange={(index: number) => {\n setSelectedTabIndex(index)\n }}\n tipSection={\n !closeTipSection\n ? {\n message: buildDynamicCopy(\n insightsCopy.general.tip_section_message,\n <strong>{insightsCopy.general.tip_section_title}</strong>,\n <strong>{beat.primary_transaction?.description}</strong>,\n ) as string,\n onDismiss: () => setCloseTipSection(true),\n }\n : undefined\n }\n title={insightsCopy.general.transaction_history_title}\n transactionListProps={{\n showLoader: isLoading,\n showInsights: true,\n transaction: filteredTransactions,\n }}\n />\n )}\n <Snackbar\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n autoHideDuration={3500}\n onClose={() => setAlert('')}\n open={Boolean(alert)}\n >\n <Alert closeText=\"\" onClose={() => setAlert('')} severity=\"success\" variant=\"filled\">\n {alert}\n </Alert>\n </Snackbar>\n </Box>\n )\n}\n\nexport default observer(TransactionDetails)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,IAAM,KAAA,CAAyD,EAC7D,eAAA,IAAgB,IAChB,oBAAA,IAAqB,IACrB,YAAA,IAAa,IACb,aAAA,EAAA,MACI;AACJ,QAAM,EAAE,SAAA,EAAA,IAAY,GAAS,GACvB,EAAE,cAAA,EAAA,IAAiB,GAAiB,GACpC,EAAE,cAAA,EAAA,IAAiB,GAAa,GAChC,EAAE,UAAU,GAAM,QAAQ,GAAY,eAAe,EAAA,IAAiB,GAAmB,GAEzF,EAAE,oBAAA,EAAA,IAAuB,GAAiB,GAC1C,EACJ,OAAA,GACA,iBAAA,GACA,sBAAA,GACA,iBAAA,GACA,kCAAA,GACA,UAAA,EAAA,IACE,GAAoB,GAElB,CAAC,GAAgC,CAAA,IAAqC,EAAM,SAAS,EAAK,GAE1F,CAAC,GAAW,CAAA,IAAgB,EAAM,SAAS,EAAK,GAChD,CAAC,GAAiB,CAAA,IAAsB,EAAM,SAAS,EAAK,GAC5D,IAAQ,GAAS,GAEjB,IAAiB,GAAa,UAAU,EAAY,OAAO,SAAS,GAEpE,IAAW,GAAa,qBAAqB,GAAgB,QAE7D,IAAO,EAAM,QAAA,MACV,EAAgB,KAA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E,gBAAA,EAAC,GAAD;AAAA,UACE,KAAK,EAAY,eAAe;AAAA,UAChC,cAAc,EAAY,iBAAiB;AAAA,UAC3C,cAAc,EAAY,iBAAiB;AAAA,UAC3C,MAAM;AAAA,QACP,CAAA;AAAA,QAEH,QAAQ;AAAA,QACR,SAAA,MAAe;AACb,UAAA,EAAkC,EAAK,GACvC,EAAoB,EAAc,WAAW,SAAS,CAAC;AAAA,QACzD;AAAA,QACA,aAAA,CAAc,MAAkB;AAC9B,UAAA,EAAoB,CAAK;AAAA,QAC3B;AAAA,QACA,YACG,IASG,SARA;AAAA,UACE,SAAS,EACP,EAAa,QAAQ,qBACrB,gBAAA,EAAC,UAAD,EAAA,UAAS,EAAa,QAAQ,kBAA0B,CAAA,GACxD,gBAAA,EAAC,UAAD,EAAA,UAAS,EAAK,qBAAqB,YAAoB,CAAA,CACzD;AAAA,UACA,WAAA,MAAiB,EAAmB,EAAI;AAAA,QAC1C;AAAA,QAGN,OAAO,EAAa,QAAQ;AAAA,QAC5B,sBAAsB;AAAA,UACpB,YAAY;AAAA,UACZ,cAAc;AAAA,UACd,aAAa;AAAA,QACf;AAAA,MACD,CAAA;AAAA,MAEH,gBAAA,EAAC,IAAD;AAAA,QACE,cAAc;AAAA,UAAE,UAAU;AAAA,UAAU,YAAY;AAAA,QAAQ;AAAA,QACxD,kBAAkB;AAAA,QAClB,SAAA,MAAe,EAAS,EAAE;AAAA,QAC1B,MAAM,EAAQ;AAAA,QAEd,UAAA,gBAAA,EAAC,IAAD;AAAA,UAAO,WAAU;AAAA,UAAG,SAAA,MAAe,EAAS,EAAE;AAAA,UAAG,UAAS;AAAA,UAAU,SAAQ;AAAA,UACzE,UAAA;AAAA,QACI,CAAA;AAAA,MACC,CAAA;AAAA,IACP;AAAA;AAET,GAEA,KAAe,GAAS,EAAkB"}
|
|
1
|
+
{"version":3,"file":"TransactionDetails.es.js","names":[],"sources":["../../../../src/transactions/components/shared/TransactionDetails.tsx"],"sourcesContent":["import React, { useMemo } from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Alert from '@mui/material/Alert'\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport List from '@mui/material/List'\nimport Paper from '@mui/material/Paper'\nimport Snackbar from '@mui/material/Snackbar'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { MerchantLogo, P, Text } from '@mxenabled/mxui'\n\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { isBefore } from 'date-fns/isBefore'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport {\n ANALYTICS_EVENTS,\n Loader,\n useCategoryStore,\n useEvent,\n useGlobalCopyStore,\n useGlobalUiStore,\n useTransactionStore,\n useUserStore,\n} from '../../../common'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport { Transaction, TransactionType } from '../../../core'\nimport { fromUnixUTC } from '../../../core/utils/DateUtil'\nimport { isTransferTransaction } from '../../../core/utils/TransactionUtils'\nimport { isFeatureEnabled } from '../../../core/utils/UserUtils'\nimport { ChartTransactionWithDrillDown, EmbeddedCard } from '../../../insights'\n\nimport {\n BottomActions,\n DEFAULT_BOTTOM_ACTIONS,\n DEFAULT_TOP_ACTIONS,\n TopActions,\n} from '../../constants/Actions'\n\nimport {\n AddMerchantBudgetAction,\n CategoryAction,\n DateAction,\n DeleteAction,\n DeleteLogoAction,\n ExcludeAction,\n MemoAction,\n SplitAction,\n TagsAction,\n} from './transactiondetails/actions'\nimport Description from './transactiondetails/Description'\nimport FlagTransaction from './transactiondetails/FlagTransaction'\nimport TransactionDetailsView from './transactiondetails/TransactionDetailsView'\nimport { getEmbeddedInstanceSlotByBeatTemplates } from './getEmbeddedInstanceSlotByBeatTemplates'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\n\nexport interface TransactionDetailsProps {\n bottomActions?: BottomActions[]\n canFlagTransaction?: boolean\n topActions?: TopActions[]\n transaction: Transaction\n}\n\nconst TransactionDetails: React.FC<TransactionDetailsProps> = ({\n bottomActions = DEFAULT_BOTTOM_ACTIONS,\n canFlagTransaction = true,\n topActions = DEFAULT_TOP_ACTIONS,\n transaction,\n}) => {\n const { onEvent } = useEvent()\n const { isCopyLoaded } = useGlobalUiStore()\n const { userFeatures } = useUserStore()\n const { accounts: copy, common: commonCopy, insights_feed: insightsCopy } = useGlobalCopyStore()\n\n const { detailedCategories } = useCategoryStore()\n const {\n alert,\n associatedBeats,\n detailedTransactions,\n cachedStartDate,\n loadEmbeddedInstanceTransactions,\n setAlert,\n } = useTransactionStore()\n\n const [showTranscationDrilldownDrawer, setShowTransactionDrillDownDrawer] = React.useState(false)\n\n const [isLoading, setIsLoading] = React.useState(false)\n const [closeTipSection, setCloseTipSection] = React.useState(false)\n const theme = useTheme()\n\n const showFullNumber = transaction?.number && transaction.number.length > 4\n\n const isCredit = transaction?.transaction_type === TransactionType.CREDIT\n\n const showInstitution = isTransferTransaction(transaction) && Boolean(transaction.institutionName)\n\n const beat = React.useMemo(() => {\n return associatedBeats.find((beat) => beat.associated_transaction_guid === transaction.guid)\n }, [associatedBeats, transaction])\n\n const embeddedData = getEmbeddedInstanceSlotByBeatTemplates(commonCopy, beat)\n\n const [selectedTabIndex, setSelectedTabIndex] = React.useState(\n embeddedData ? embeddedData.dataSeries.length - 1 : 0,\n )\n\n React.useEffect(\n () =>\n onEvent(ANALYTICS_EVENTS.TRANSACTION_DETAILS_VIEW, { transaction_guid: transaction.guid }),\n [],\n )\n\n React.useEffect(() => {\n if (!embeddedData || embeddedData.dataSeries.length === 0) return\n\n const { date: selectedSeriesItemDate } = embeddedData.dataSeries[selectedTabIndex]\n\n const start = startOfMonth(selectedSeriesItemDate)\n\n if (isBefore(start, cachedStartDate)) {\n setIsLoading(true)\n loadEmbeddedInstanceTransactions(start).finally(() => {\n setIsLoading(false)\n })\n }\n }, [selectedTabIndex, embeddedData, cachedStartDate])\n\n //if merchant_guid is null then no need to show the MerchantBudget action.\n const updatedBottomActions =\n bottomActions.includes(BottomActions.MerchantBudget) && !transaction?.merchant_guid\n ? bottomActions.filter((action) => action !== BottomActions.MerchantBudget)\n : bottomActions\n\n const embeddedCardDataCategory = useMemo(() => {\n if (embeddedData) {\n const category = detailedCategories.find(\n (cat) => cat.guid === transaction.top_level_category_guid,\n )\n const mean = beat?.payload?.average_amount ?? 0\n const currentAmount = transaction.amount\n\n let changetype = insightsCopy.general.increased_text\n if (currentAmount - mean < 0) {\n changetype = insightsCopy.general.decreased_text\n }\n const percentageAmount =\n mean === 0 ? 0 : Math.round((Math.abs(currentAmount - mean) / mean) * 100)\n\n return { category, percentageAmount, changetype }\n }\n return null\n }, [embeddedData, detailedCategories])\n\n const filteredTransactions = useMemo(() => {\n if (!embeddedData?.dataSeries?.length) {\n return []\n }\n\n const { guid: selectedSeriesItemGuid, date: selectedSeriesItemDate } =\n embeddedData.dataSeries[selectedTabIndex]\n\n const start = startOfMonth(selectedSeriesItemDate)\n const end = endOfMonth(selectedSeriesItemDate)\n\n return detailedTransactions.filter((t) => {\n const transactionDate = fromUnixUTC(t.date)\n return transactionDate >= start && transactionDate <= end && t.guid === selectedSeriesItemGuid\n })\n }, [selectedTabIndex, embeddedData, detailedTransactions, isLoading])\n\n if (!isCopyLoaded) {\n return <Loader />\n }\n\n const shouldShowViewOnlyMode = isFeatureEnabled(userFeatures, 'MX_TXN_DETAILS_VIEW_ONLY')\n\n const bgColor = theme.palette.mode === 'dark' ? 'grey.800' : 'grey.100'\n\n return (\n <Box className=\"mx-txn-transaction-details\" width=\"100%\">\n {transaction && (\n <Stack>\n <Stack gap={12} p={24}>\n <Paper elevation={2} sx={{ width: 64 }}>\n <MerchantLogo\n categoryGuid={transaction.top_level_category_guid || ''}\n merchantGuid={transaction.merchant_guid || ''}\n size={64}\n />\n </Paper>\n\n <Description\n displayValue={showInstitution ? transaction.institutionName : undefined}\n transaction={transaction}\n viewOnly={shouldShowViewOnlyMode || showInstitution}\n />\n\n <Stack direction=\"row\" justifyContent=\"space-between\" sx={{ minHeight: 44 }}>\n <P color={isCredit ? 'success.main' : 'text.primary'} variant=\"h1\">\n {isCredit ? '+' : ''}\n {formatCurrency(transaction.amount, '0,0.00')}\n </P>\n {!shouldShowViewOnlyMode && canFlagTransaction && (\n <FlagTransaction transaction={transaction} />\n )}\n </Stack>\n\n {embeddedData?.instanceSlot && (\n <EmbeddedCard\n callToAction={embeddedData.callToAction}\n description={\n buildDynamicCopy(\n insightsCopy.general.embedded_description,\n embeddedCardDataCategory!.changetype,\n <strong>{embeddedCardDataCategory!.percentageAmount}</strong>,\n ) as string\n }\n instanceSlot={embeddedData.instanceSlot}\n onCtaClick={() => {\n setShowTransactionDrillDownDrawer(true)\n }}\n title={beat!.html_micro_title!}\n />\n )}\n <Stack sx={{ bgcolor: bgColor, borderRadius: '4px', gap: 4, p: 8 }}>\n <Text bold={true}>\n {`${transaction.account}\n ${\n showFullNumber\n ? transaction.number\n : '\\u2022'.repeat(4).concat(transaction.number ?? '')\n }`}\n </Text>\n <Text bold={true} truncate={true} variant=\"tiny\">\n {transaction.feed_description}\n </Text>\n </Stack>\n </Stack>\n\n <Paper square={true} sx={{ boxShadow: 'none' }}>\n {shouldShowViewOnlyMode ? (\n <TransactionDetailsView transaction={transaction} />\n ) : (\n <List>\n {topActions.map((action, index) => (\n <React.Fragment key={action}>\n {action === TopActions.Category && <CategoryAction transaction={transaction} />}\n {action === TopActions.Date && <DateAction transaction={transaction} />}\n {action === TopActions.Memo && <MemoAction transaction={transaction} />}\n {action === TopActions.Tags && <TagsAction transaction={transaction} />}\n <Divider\n component=\"li\"\n variant={index < topActions.length - 1 ? 'inset' : 'fullWidth'}\n />\n </React.Fragment>\n ))}\n </List>\n )}\n </Paper>\n\n {!shouldShowViewOnlyMode && updatedBottomActions.length > 0 && (\n <React.Fragment>\n <Text bold={true} mb={8} ml={26} mt={16} variant=\"body1\">\n {copy.actions}\n </Text>\n\n <Paper square={true} sx={{ boxShadow: 'none' }}>\n <List>\n {updatedBottomActions.map((action, index) => (\n <React.Fragment key={action}>\n {action === BottomActions.MerchantBudget && (\n <AddMerchantBudgetAction transaction={transaction} />\n )}\n {action === BottomActions.SplitTransaction && (\n <SplitAction transaction={transaction} />\n )}\n {action === BottomActions.HideTransaction && (\n <ExcludeAction transaction={transaction} />\n )}\n {action === BottomActions.MerchantLogo && (\n <DeleteLogoAction transaction={transaction} />\n )}\n <Divider\n component=\"li\"\n variant={index < updatedBottomActions.length - 1 ? 'inset' : 'fullWidth'}\n />\n </React.Fragment>\n ))}\n\n {/*\n Show DeleteAction only if:\n - The transaction is manual\n - The transaction is NOT a parent transaction (no parent_guid)\n - The transaction has NOT been split (has_been_split is false)\n \n This ensures delete is hidden for parent or split transactions.\n */}\n {transaction.is_manual &&\n !transaction.parent_guid &&\n !transaction.has_been_split && <DeleteAction transaction={transaction} />}\n </List>\n </Paper>\n </React.Fragment>\n )}\n </Stack>\n )}\n {beat && embeddedData && (\n <ChartTransactionWithDrillDown\n ariaLabel={formatDate(\n embeddedData?.dataSeries[selectedTabIndex]?.date,\n DATE_FORMATS_INTL.MONTH,\n )}\n barChartProps={{\n amounts: {\n average: beat.payload.average_amount,\n formattedAverage: formatCurrency(beat.payload.average_amount, '0,0'),\n },\n color: embeddedCardDataCategory!.category?.color || '',\n data: embeddedData.chartData,\n margin: { bottom: 10, left: 24, right: 24, top: 20 },\n monthlyAmountLabel: insightsCopy.general.monthly_amount,\n onBarClick: (index) => {\n setSelectedTabIndex(index)\n },\n trendAmountLabel: insightsCopy.general.trend,\n legendPosition: 'top',\n }}\n beat={{\n heading: beat.html_title,\n subHeading: {\n category_guid: transaction.category_guid ?? '',\n merchant_guid: transaction.merchant_guid ?? '',\n description: transaction.description ?? '',\n },\n }}\n data={embeddedData.chartData}\n defaultSelectedIndex={selectedTabIndex}\n icon={\n <MerchantLogo\n alt={transaction.description ?? ''}\n categoryGuid={transaction.category_guid ?? ''}\n merchantGuid={transaction.merchant_guid ?? ''}\n size={16}\n />\n }\n isOpen={showTranscationDrilldownDrawer}\n onClose={() => {\n setShowTransactionDrillDownDrawer(false)\n setSelectedTabIndex(embeddedData!.dataSeries.length - 1)\n }}\n onTabChange={(index: number) => {\n setSelectedTabIndex(index)\n }}\n tipSection={\n !closeTipSection\n ? {\n message: buildDynamicCopy(\n insightsCopy.general.tip_section_message,\n <strong>{insightsCopy.general.tip_section_title}</strong>,\n <strong>{beat.primary_transaction?.description}</strong>,\n ) as string,\n onDismiss: () => setCloseTipSection(true),\n }\n : undefined\n }\n title={insightsCopy.general.transaction_history_title}\n transactionListProps={{\n showLoader: isLoading,\n showInsights: true,\n transaction: filteredTransactions,\n }}\n />\n )}\n <Snackbar\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n autoHideDuration={3500}\n onClose={() => setAlert('')}\n open={Boolean(alert)}\n >\n <Alert closeText=\"\" onClose={() => setAlert('')} severity=\"success\" variant=\"filled\">\n {alert}\n </Alert>\n </Snackbar>\n </Box>\n )\n}\n\nexport default observer(TransactionDetails)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,IAAM,KAAA,CAAyD,EAC7D,eAAA,IAAgB,IAChB,oBAAA,IAAqB,IACrB,YAAA,IAAa,IACb,aAAA,EAAA,MACI;AACJ,QAAM,EAAE,SAAA,EAAA,IAAY,GAAS,GACvB,EAAE,cAAA,EAAA,IAAiB,GAAiB,GACpC,EAAE,cAAA,EAAA,IAAiB,GAAa,GAChC,EAAE,UAAU,GAAM,QAAQ,GAAY,eAAe,EAAA,IAAiB,GAAmB,GAEzF,EAAE,oBAAA,EAAA,IAAuB,GAAiB,GAC1C,EACJ,OAAA,GACA,iBAAA,GACA,sBAAA,GACA,iBAAA,GACA,kCAAA,GACA,UAAA,EAAA,IACE,GAAoB,GAElB,CAAC,GAAgC,CAAA,IAAqC,EAAM,SAAS,EAAK,GAE1F,CAAC,GAAW,CAAA,IAAgB,EAAM,SAAS,EAAK,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U;AAAA,UAAG,SAAA,MAAe,EAAS,EAAE;AAAA,UAAG,UAAS;AAAA,UAAU,SAAQ;AAAA,UACzE,UAAA;AAAA,QACI,CAAA;AAAA,MACC,CAAA;AAAA,IACP;AAAA;AAET,GAEA,KAAe,GAAS,EAAkB"}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { useEvent as
|
|
2
|
-
import { useAriaLive as
|
|
3
|
-
import { ANALYTICS_EVENTS as
|
|
4
|
-
import { ON_CLICK_EVENTS as
|
|
5
|
-
import
|
|
6
|
-
import { observer as
|
|
7
|
-
import
|
|
8
|
-
import { Icon as
|
|
9
|
-
import
|
|
1
|
+
import { useEvent as E, useGlobalCopyStore as h, useTransactionStore as R } from "../../../../common/context/hooks.es.js";
|
|
2
|
+
import { useAriaLive as S } from "../../../../common/hooks/useAriaLive.es.js";
|
|
3
|
+
import { ANALYTICS_EVENTS as v } from "../../../../common/constants/Analytics.es.js";
|
|
4
|
+
import { ON_CLICK_EVENTS as x } from "../../../constants/OnClickEvents.es.js";
|
|
5
|
+
import n from "react";
|
|
6
|
+
import { observer as N } from "mobx-react-lite";
|
|
7
|
+
import y from "@mui/material/Stack";
|
|
8
|
+
import { Icon as L, Text as O } from "@mxenabled/mxui";
|
|
9
|
+
import A from "@mui/material/Button";
|
|
10
10
|
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
var
|
|
16
|
-
const { updateTransaction:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}, [
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
11
|
+
import B from "@mui/material/Box";
|
|
12
|
+
import D from "@mui/material/IconButton";
|
|
13
|
+
import k from "@mui/material/TextField";
|
|
14
|
+
import w from "@mui/material/FormGroup";
|
|
15
|
+
var K = ({ transaction: o, viewOnly: p = !1, displayValue: s }) => {
|
|
16
|
+
const l = p || !!s, { updateTransaction: f } = R(), { common: I, transactions: t } = h(), { onEvent: c } = E(), { announce: T, ariaLive: _ } = S(), [r, d] = n.useState(!1), [i, u] = n.useState(""), m = n.useRef(null);
|
|
17
|
+
n.useEffect(() => {
|
|
18
|
+
r && (u(o.description), m?.current?.focus());
|
|
19
|
+
}, [r]);
|
|
20
|
+
const C = () => {
|
|
21
|
+
d(!0), c(x.ON_TRANSACTION_DESCRIPTION_EDIT_CLICK), setTimeout(() => document.getElementById("transaction-description-input")?.focus(), 0);
|
|
22
|
+
}, b = async () => {
|
|
23
|
+
c(v.TRANSACTION_DETAILS_CLICK_DESCRIPTION, { transaction_guid: o.guid }), await f({
|
|
24
24
|
...o,
|
|
25
25
|
description: i
|
|
26
|
-
}),
|
|
26
|
+
}), d(!1), T(`${t.payee_title}: ${i}`), setTimeout(() => document.getElementById("transaction-description-edit-button")?.focus(), 0);
|
|
27
27
|
};
|
|
28
|
-
return /* @__PURE__ */ a(
|
|
28
|
+
return /* @__PURE__ */ a(B, {
|
|
29
29
|
className: "mx-txn-transaction-description",
|
|
30
|
-
children: [
|
|
30
|
+
children: [_, r ? /* @__PURE__ */ a(w, {
|
|
31
31
|
row: !0,
|
|
32
|
-
children: [/* @__PURE__ */ e(
|
|
32
|
+
children: [/* @__PURE__ */ e(k, {
|
|
33
33
|
"aria-label": t.payee_title,
|
|
34
34
|
id: "transaction-description-input",
|
|
35
35
|
label: t.payee_title,
|
|
36
36
|
name: t.payee_title,
|
|
37
|
-
onChange: (
|
|
38
|
-
ref:
|
|
37
|
+
onChange: (g) => u(g.target.value),
|
|
38
|
+
ref: m,
|
|
39
39
|
slotProps: { htmlInput: { maxLength: 140 } },
|
|
40
40
|
sx: {
|
|
41
41
|
backgroundColor: "background.paper",
|
|
@@ -47,39 +47,39 @@ var k = ({ transaction: o, viewOnly: p = !1 }) => {
|
|
|
47
47
|
width: 250
|
|
48
48
|
},
|
|
49
49
|
value: i
|
|
50
|
-
}), /* @__PURE__ */ e(
|
|
50
|
+
}), /* @__PURE__ */ e(A, {
|
|
51
51
|
disabled: !i,
|
|
52
|
-
onClick:
|
|
52
|
+
onClick: b,
|
|
53
53
|
sx: {
|
|
54
54
|
borderTopLeftRadius: 0,
|
|
55
55
|
borderBottomLeftRadius: 0
|
|
56
56
|
},
|
|
57
57
|
variant: "outlined",
|
|
58
|
-
children:
|
|
58
|
+
children: I.save_button
|
|
59
59
|
})]
|
|
60
|
-
}) : /* @__PURE__ */ a(
|
|
60
|
+
}) : /* @__PURE__ */ a(y, {
|
|
61
61
|
alignItems: "center",
|
|
62
62
|
direction: "row",
|
|
63
63
|
gap: 4,
|
|
64
64
|
sx: { minHeight: 44 },
|
|
65
|
-
children: [/* @__PURE__ */ e(
|
|
65
|
+
children: [/* @__PURE__ */ e(O, {
|
|
66
66
|
bold: !0,
|
|
67
|
-
children: o.description
|
|
68
|
-
}), !
|
|
67
|
+
children: s ?? o.description
|
|
68
|
+
}), !l && /* @__PURE__ */ e(D, {
|
|
69
69
|
"aria-label": t.payee_edit,
|
|
70
70
|
id: "transaction-description-edit-button",
|
|
71
|
-
onClick:
|
|
71
|
+
onClick: C,
|
|
72
72
|
sx: { color: "action.active" },
|
|
73
|
-
children: /* @__PURE__ */ e(
|
|
73
|
+
children: /* @__PURE__ */ e(L, {
|
|
74
74
|
name: "create",
|
|
75
75
|
size: 22
|
|
76
76
|
})
|
|
77
77
|
})]
|
|
78
78
|
})]
|
|
79
79
|
});
|
|
80
|
-
},
|
|
80
|
+
}, W = N(K);
|
|
81
81
|
export {
|
|
82
|
-
|
|
82
|
+
W as default
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
//# sourceMappingURL=Description.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Description.es.js","names":[],"sources":["../../../../../src/transactions/components/shared/transactiondetails/Description.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport FormGroup from '@mui/material/FormGroup'\nimport IconButton from '@mui/material/IconButton'\nimport Stack from '@mui/material/Stack'\nimport TextField from '@mui/material/TextField'\n\nimport { Icon, Text } from '@mxenabled/mxui'\n\nimport type { Transaction } from '../../../../core'\n\nimport {\n ANALYTICS_EVENTS,\n useEvent,\n useGlobalCopyStore,\n useTransactionStore,\n} from '../../../../common'\nimport { useAriaLive } from '../../../../common/hooks/useAriaLive'\nimport { ON_CLICK_EVENTS } from '../../../constants/OnClickEvents'\n\ninterface DescriptionProps {\n transaction: Transaction\n viewOnly?: boolean\n}\n\nconst Description: React.FC<DescriptionProps> = ({
|
|
1
|
+
{"version":3,"file":"Description.es.js","names":[],"sources":["../../../../../src/transactions/components/shared/transactiondetails/Description.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport FormGroup from '@mui/material/FormGroup'\nimport IconButton from '@mui/material/IconButton'\nimport Stack from '@mui/material/Stack'\nimport TextField from '@mui/material/TextField'\n\nimport { Icon, Text } from '@mxenabled/mxui'\n\nimport type { Transaction } from '../../../../core'\n\nimport {\n ANALYTICS_EVENTS,\n useEvent,\n useGlobalCopyStore,\n useTransactionStore,\n} from '../../../../common'\nimport { useAriaLive } from '../../../../common/hooks/useAriaLive'\nimport { ON_CLICK_EVENTS } from '../../../constants/OnClickEvents'\n\ninterface DescriptionProps {\n transaction: Transaction\n viewOnly?: boolean\n // Overrides the displayed value (e.g. institution name on transfers) while\n // leaving the underlying transaction description untouched. A display override\n // is inherently read-only, so it also suppresses the edit affordance.\n displayValue?: string\n}\n\nconst Description: React.FC<DescriptionProps> = ({\n transaction,\n viewOnly = false,\n displayValue,\n}) => {\n const isReadOnly = viewOnly || Boolean(displayValue)\n const { updateTransaction } = useTransactionStore()\n const { common: commonCopy, transactions: copy } = useGlobalCopyStore()\n const { onEvent } = useEvent()\n const { announce, ariaLive } = useAriaLive()\n\n const [isEditing, setIsEditing] = React.useState(false)\n const [description, setDescription] = React.useState('')\n\n const inputRef = React.useRef<HTMLInputElement>(null)\n\n React.useEffect(() => {\n if (isEditing) {\n setDescription(transaction.description)\n inputRef?.current?.focus()\n }\n }, [isEditing])\n\n const handleEdit = () => {\n setIsEditing(true)\n onEvent(ON_CLICK_EVENTS.ON_TRANSACTION_DESCRIPTION_EDIT_CLICK)\n setTimeout(() => document.getElementById(`transaction-description-input`)?.focus(), 0)\n }\n\n const handleSave = async () => {\n onEvent(ANALYTICS_EVENTS.TRANSACTION_DETAILS_CLICK_DESCRIPTION, {\n transaction_guid: transaction.guid,\n })\n await updateTransaction({ ...transaction, description })\n setIsEditing(false)\n announce(`${copy.payee_title}: ${description}`)\n setTimeout(() => document.getElementById(`transaction-description-edit-button`)?.focus(), 0)\n }\n\n return (\n <Box className=\"mx-txn-transaction-description\">\n {ariaLive}\n {isEditing ? (\n <FormGroup row={true}>\n <TextField\n aria-label={copy.payee_title}\n id={`transaction-description-input`}\n label={copy.payee_title}\n name={copy.payee_title}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => setDescription(e.target.value)}\n ref={inputRef}\n slotProps={{ htmlInput: { maxLength: 140 } }}\n sx={{\n backgroundColor: 'background.paper',\n '.MuiOutlinedInput-root': { borderTopRightRadius: 0, borderBottomRightRadius: 0 },\n '.MuiOutlinedInput-input': { p: 11 },\n width: 250,\n }}\n value={description}\n />\n <Button\n disabled={!description}\n onClick={handleSave}\n sx={{\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n }}\n variant=\"outlined\"\n >\n {commonCopy.save_button}\n </Button>\n </FormGroup>\n ) : (\n <Stack alignItems=\"center\" direction=\"row\" gap={4} sx={{ minHeight: 44 }}>\n <Text bold={true}>{displayValue ?? transaction.description}</Text>\n {!isReadOnly && (\n <IconButton\n aria-label={copy.payee_edit}\n id={`transaction-description-edit-button`}\n onClick={handleEdit}\n sx={{ color: 'action.active' }}\n >\n <Icon name=\"create\" size={22} />\n </Icon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ader.es.js
CHANGED
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
import { TransactionType as
|
|
2
|
-
import { formatCurrency as
|
|
1
|
+
import { TransactionType as l } from "../../../../core/types/Transaction.es.js";
|
|
2
|
+
import { formatCurrency as f } from "../../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import { isTransferTransaction as h } from "../../../../core/utils/TransactionUtils.es.js";
|
|
3
4
|
import "react";
|
|
4
|
-
import
|
|
5
|
-
import { MerchantLogo as
|
|
6
|
-
import { jsx as
|
|
7
|
-
var
|
|
8
|
-
const { amount:
|
|
9
|
-
return /* @__PURE__ */ r(
|
|
5
|
+
import a from "@mui/material/Stack";
|
|
6
|
+
import { MerchantLogo as y, P as x, Text as T } from "@mxenabled/mxui";
|
|
7
|
+
import { jsx as i, jsxs as r } from "react/jsx-runtime";
|
|
8
|
+
var I = ({ transaction: t }) => {
|
|
9
|
+
const { amount: n, description: c, institutionName: o, merchant_guid: m, payee: s, top_level_category_guid: d, transaction_type: u } = t, e = u === l.CREDIT, p = h(t) && !!o;
|
|
10
|
+
return /* @__PURE__ */ r(a, {
|
|
10
11
|
className: "mx-txn-amount-header",
|
|
11
12
|
direction: "row",
|
|
12
13
|
gap: 12,
|
|
13
14
|
px: 16,
|
|
14
15
|
py: 24,
|
|
15
|
-
children: [/* @__PURE__ */
|
|
16
|
+
children: [/* @__PURE__ */ i(y, {
|
|
16
17
|
categoryGuid: d || "",
|
|
17
|
-
merchantGuid:
|
|
18
|
+
merchantGuid: m || "",
|
|
18
19
|
size: 64
|
|
19
|
-
}), /* @__PURE__ */ r(
|
|
20
|
+
}), /* @__PURE__ */ r(a, {
|
|
20
21
|
overflow: "hidden",
|
|
21
|
-
children: [/* @__PURE__ */
|
|
22
|
+
children: [/* @__PURE__ */ i(T, {
|
|
22
23
|
bold: !0,
|
|
23
24
|
mb: 4,
|
|
24
25
|
truncate: !0,
|
|
25
26
|
variant: "body1",
|
|
26
|
-
children:
|
|
27
|
-
}), /* @__PURE__ */ r(
|
|
28
|
-
color:
|
|
27
|
+
children: p ? o : c || s
|
|
28
|
+
}), /* @__PURE__ */ r(x, {
|
|
29
|
+
color: e ? "success.main" : "text.primary",
|
|
29
30
|
truncate: !0,
|
|
30
31
|
variant: "h1",
|
|
31
|
-
children: [
|
|
32
|
+
children: [e ? "+" : "", f(n, "0,0.00")]
|
|
32
33
|
})]
|
|
33
34
|
})]
|
|
34
35
|
});
|
|
35
36
|
};
|
|
36
37
|
export {
|
|
37
|
-
|
|
38
|
+
I as default
|
|
38
39
|
};
|
|
39
40
|
|
|
40
41
|
//# sourceMappingURL=TransactionAmountHeader.es.js.map
|
package/dist/transactions/components/shared/transactiondetails/TransactionAmountHeader.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionAmountHeader.es.js","names":[],"sources":["../../../../../src/transactions/components/shared/transactiondetails/TransactionAmountHeader.tsx"],"sourcesContent":["import React from 'react'\n\nimport Stack from '@mui/material/Stack'\n\nimport { MerchantLogo, P, Text } from '@mxenabled/mxui'\n\nimport { type Transaction, TransactionType } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\ninterface TransactionAmountHeaderProps {\n transaction: Transaction\n}\n\nconst TransactionAmountHeader: React.FC<TransactionAmountHeaderProps> = ({ transaction }) => {\n const {
|
|
1
|
+
{"version":3,"file":"TransactionAmountHeader.es.js","names":[],"sources":["../../../../../src/transactions/components/shared/transactiondetails/TransactionAmountHeader.tsx"],"sourcesContent":["import React from 'react'\n\nimport Stack from '@mui/material/Stack'\n\nimport { MerchantLogo, P, Text } from '@mxenabled/mxui'\n\nimport { type Transaction, TransactionType } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport { isTransferTransaction } from '../../../../core/utils/TransactionUtils'\n\ninterface TransactionAmountHeaderProps {\n transaction: Transaction\n}\n\nconst TransactionAmountHeader: React.FC<TransactionAmountHeaderProps> = ({ transaction }) => {\n const {\n amount,\n description,\n institutionName,\n merchant_guid,\n payee,\n top_level_category_guid,\n transaction_type,\n } = transaction\n\n const isCredit = transaction_type === TransactionType.CREDIT\n\n const showInstitution = isTransferTransaction(transaction) && Boolean(institutionName)\n\n return (\n <Stack className=\"mx-txn-amount-header\" direction=\"row\" gap={12} px={16} py={24}>\n <MerchantLogo\n categoryGuid={top_level_category_guid || ''}\n merchantGuid={merchant_guid || ''}\n size={64}\n />\n <Stack overflow=\"hidden\">\n <Text bold={true} mb={4} truncate={true} variant=\"body1\">\n {showInstitution ? institutionName : description || payee}\n </Text>\n <P color={isCredit ? 'success.main' : 'text.primary'} truncate={true} variant=\"h1\">\n {isCredit ? '+' : ''}\n {formatCurrency(amount, '0,0.00')}\n </P>\n </Stack>\n </Stack>\n )\n}\n\nexport default TransactionAmountHeader\n"],"mappings":";;;;;;;AAcA,IAAM,IAAA,CAAmE,EAAE,aAAA,EAAA,MAAkB;AAC3F,QAAM,EACJ,QAAA,GACA,aAAA,GACA,iBAAA,GACA,eAAA,GACA,OAAA,GACA,yBAAA,GACA,kBAAA,EAAA,IACE,GAEE,IAAW,MAAqB,EAAgB,QAEhD,IAAkB,EAAsB,CAAW,KAAK,EAAQ;AAEtE,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,WAAU;AAAA,IAAuB,WAAU;AAAA,IAAM,KAAK;AAAA,IAAI,IAAI;AAAA,IAAI,IAAI;AAAA,IAA7E,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MACE,cAAc,KAA2B;AAAA,MACzC,cAAc,KAAiB;AAAA,MAC/B,MAAM;AAAA,IACP,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,MAAO,UAAS;AAAA,MAAhB,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,QAAM,MAAM;AAAA,QAAM,IAAI;AAAA,QAAG,UAAU;AAAA,QAAM,SAAQ;AAAA,QAC9C,UAAA,IAAkB,IAAkB,KAAe;AAAA,MAChD,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,QAAG,OAAO,IAAW,iBAAiB;AAAA,QAAgB,UAAU;AAAA,QAAM,SAAQ;AAAA,QAA9E,UAAA,CACG,IAAW,MAAM,IACjB,EAAe,GAAQ,QAAQ,CAC/B;AAAA,MACE,CAAA,CAAA;AAAA,IACF,CAAA,CAAA;AAAA;AAEX"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { useGlobalCopyStore as
|
|
2
|
-
import { TransactionType as
|
|
1
|
+
import { useGlobalCopyStore as I, useTransactionStore as C } from "../../../../common/context/hooks.es.js";
|
|
2
|
+
import { TransactionType as w } from "../../../../core/types/Transaction.es.js";
|
|
3
3
|
import { formatCurrency as S } from "../../../../core/utils/NumberFormatting.es.js";
|
|
4
|
-
import {
|
|
4
|
+
import { isTransferTransaction as k } from "../../../../core/utils/TransactionUtils.es.js";
|
|
5
|
+
import { ListItemWrapper as N } from "../../../../common/components/ListItemWrapper.es.js";
|
|
5
6
|
import { useTransactionsUiStore as f } from "../../../context/hooks.es.js";
|
|
6
|
-
import { ON_CLICK_EVENTS as
|
|
7
|
-
import { postInsightOnTransaction as
|
|
7
|
+
import { ON_CLICK_EVENTS as L } from "../../../constants/OnClickEvents.es.js";
|
|
8
|
+
import { postInsightOnTransaction as E } from "../../../../common/utils/PostMessage.es.js";
|
|
8
9
|
import _ from "react";
|
|
9
|
-
import { observer as
|
|
10
|
+
import { observer as R } from "mobx-react-lite";
|
|
10
11
|
import d from "@mui/material/Stack";
|
|
11
|
-
import { Icon as c, MerchantLogo as
|
|
12
|
+
import { Icon as c, MerchantLogo as j, Text as n } from "@mxenabled/mxui";
|
|
12
13
|
import { jsx as t, jsxs as i } from "react/jsx-runtime";
|
|
13
|
-
import { useTheme as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
var
|
|
17
|
-
const g =
|
|
14
|
+
import { useTheme as M } from "@mui/material/styles";
|
|
15
|
+
import O from "@mui/material/ListItemAvatar";
|
|
16
|
+
import z from "@mui/material/ListItemText";
|
|
17
|
+
var A = ({ transaction: e, onClick: m, component: p }) => {
|
|
18
|
+
const g = M().palette.mode === "dark", { associatedBeats: l } = C(), { expandedSplits: h } = f(), { transactions: y } = I(), { showInsights: T } = f(), u = e.transaction_type === w.CREDIT, b = k(e) && !!e.institutionName, a = _.useMemo(() => l.find((r) => r.associated_transaction_guid === e.guid), [l, e]), v = (r, o) => {
|
|
18
19
|
const s = [];
|
|
19
20
|
return r.is_flagged && s.push(/* @__PURE__ */ t(c, {
|
|
20
21
|
fill: !0,
|
|
@@ -28,19 +29,19 @@ var O = ({ transaction: e, onClick: p, component: l }) => {
|
|
|
28
29
|
name: "call_split",
|
|
29
30
|
size: 16
|
|
30
31
|
}, "split")), s;
|
|
31
|
-
},
|
|
32
|
-
return /* @__PURE__ */ i(
|
|
33
|
-
clickEventName:
|
|
34
|
-
...
|
|
35
|
-
onClick:
|
|
32
|
+
}, x = (r, o) => r.is_hidden ? o.is_excluded : r.has_been_split ? o.split_transaction_category_label : r.category || "";
|
|
33
|
+
return /* @__PURE__ */ i(N, {
|
|
34
|
+
clickEventName: L.ON_TRANSACTION_LIST_ITEM_CLICK,
|
|
35
|
+
...p && { component: p },
|
|
36
|
+
onClick: m ? () => m(e.guid) : void 0,
|
|
36
37
|
sx: e.is_hidden ? {
|
|
37
38
|
backgroundColor: "grey.50",
|
|
38
39
|
color: "text.secondary"
|
|
39
40
|
} : void 0,
|
|
40
|
-
children: [/* @__PURE__ */ t(
|
|
41
|
+
children: [/* @__PURE__ */ t(O, { children: e.parent_guid && h.includes(e.parent_guid) ? /* @__PURE__ */ t(_.Fragment, {}) : /* @__PURE__ */ t(j, {
|
|
41
42
|
categoryGuid: e.top_level_category_guid || "",
|
|
42
43
|
merchantGuid: e.merchant_guid || ""
|
|
43
|
-
}) }), /* @__PURE__ */ t(
|
|
44
|
+
}) }), /* @__PURE__ */ t(z, {
|
|
44
45
|
disableTypography: !0,
|
|
45
46
|
secondary: /* @__PURE__ */ i(d, {
|
|
46
47
|
direction: "row",
|
|
@@ -49,16 +50,16 @@ var O = ({ transaction: e, onClick: p, component: l }) => {
|
|
|
49
50
|
alignItems: "center",
|
|
50
51
|
direction: "row",
|
|
51
52
|
gap: 4,
|
|
52
|
-
children: [
|
|
53
|
+
children: [v(e, g), /* @__PURE__ */ t(n, {
|
|
53
54
|
truncate: !0,
|
|
54
55
|
variant: "caption",
|
|
55
|
-
children:
|
|
56
|
+
children: x(e, y)
|
|
56
57
|
})]
|
|
57
58
|
}), a && T && /* @__PURE__ */ t(n, {
|
|
58
59
|
bold: !0,
|
|
59
60
|
color: "action.active",
|
|
60
61
|
onClick: (r) => {
|
|
61
|
-
r.stopPropagation(), r.preventDefault(),
|
|
62
|
+
r.stopPropagation(), r.preventDefault(), E(a.guid);
|
|
62
63
|
},
|
|
63
64
|
truncate: !0,
|
|
64
65
|
variant: "caption",
|
|
@@ -73,7 +74,7 @@ var O = ({ transaction: e, onClick: p, component: l }) => {
|
|
|
73
74
|
bold: !0,
|
|
74
75
|
truncate: !0,
|
|
75
76
|
variant: "body1",
|
|
76
|
-
children: e.payee || e.description || e.feed_description
|
|
77
|
+
children: b ? e.institutionName : e.payee || e.description || e.feed_description
|
|
77
78
|
}), /* @__PURE__ */ i(n, {
|
|
78
79
|
bold: !0,
|
|
79
80
|
color: u ? "success.main" : "text.primary",
|
|
@@ -84,9 +85,9 @@ var O = ({ transaction: e, onClick: p, component: l }) => {
|
|
|
84
85
|
})
|
|
85
86
|
})]
|
|
86
87
|
});
|
|
87
|
-
},
|
|
88
|
+
}, $ = R(A);
|
|
88
89
|
export {
|
|
89
|
-
|
|
90
|
+
$ as default
|
|
90
91
|
};
|
|
91
92
|
|
|
92
93
|
//# sourceMappingURL=TransactionRow.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionRow.es.js","names":[],"sources":["../../../../../src/transactions/components/shared/transactionlist/TransactionRow.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport ListItemAvatar from '@mui/material/ListItemAvatar'\nimport ListItemText from '@mui/material/ListItemText'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Icon, MerchantLogo, Text } from '@mxenabled/mxui'\n\nimport { ListItemWrapper, useGlobalCopyStore, useTransactionStore } from '../../../../common'\nimport { Transaction, TransactionType } from '../../../../core'\n\nimport { postInsightOnTransaction } from '../../../../common/utils/PostMessage'\n\nimport { ON_CLICK_EVENTS } from '../../../constants/OnClickEvents'\nimport { useTransactionsUiStore } from '../../../context/hooks'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\ninterface TransactionRowProps {\n component?: React.ElementType\n onClick?: (guid: string) => void\n transaction: Transaction\n}\n\nconst TransactionRow: React.FC<TransactionRowProps> = ({ transaction, onClick, component }) => {\n const theme = useTheme()\n const isDarkMode = theme.palette.mode === 'dark'\n\n const { associatedBeats } = useTransactionStore()\n const { expandedSplits } = useTransactionsUiStore()\n const { transactions: copy } = useGlobalCopyStore()\n const { showInsights } = useTransactionsUiStore()\n\n const isCredit = transaction.transaction_type === TransactionType.CREDIT\n\n const beat = React.useMemo(() => {\n return associatedBeats.find((beat) => beat.associated_transaction_guid === transaction.guid)\n }, [associatedBeats, transaction])\n\n const getTransactionStatusIcons = (\n transaction: Transaction,\n isDarkMode: boolean,\n ): React.ReactNode[] => {\n const icons: React.ReactNode[] = []\n\n if (transaction.is_flagged) {\n icons.push(\n <Icon\n fill={true}\n key=\"flag\"\n name=\"flag\"\n size={16}\n sx={{ color: isDarkMode ? 'primary.main' : 'warning.dark' }}\n />,\n )\n }\n\n if (transaction.is_hidden) {\n icons.push(<Icon key=\"hidden\" name=\"visibility_off\" size={16} />)\n }\n\n if (transaction.has_been_split) {\n icons.push(<Icon key=\"split\" name=\"call_split\" size={16} />)\n }\n\n return icons\n }\n\n const getTransactionCategoryText = (transaction: Transaction, copy: any): string => {\n if (transaction.is_hidden) {\n return copy.is_excluded\n }\n\n if (transaction.has_been_split) {\n return copy.split_transaction_category_label\n }\n\n return transaction.category || ''\n }\n\n return (\n //TODO: implement common/components/ListItemRow.tsx\n <ListItemWrapper\n clickEventName={ON_CLICK_EVENTS.ON_TRANSACTION_LIST_ITEM_CLICK}\n {...(component && { component })}\n onClick={onClick ? () => onClick(transaction.guid) : undefined}\n sx={\n transaction.is_hidden ? { backgroundColor: 'grey.50', color: 'text.secondary' } : undefined\n }\n >\n <ListItemAvatar>\n {transaction.parent_guid && expandedSplits.includes(transaction.parent_guid) ? (\n <React.Fragment />\n ) : (\n <MerchantLogo\n categoryGuid={transaction.top_level_category_guid || ''}\n merchantGuid={transaction.merchant_guid || ''}\n />\n )}\n </ListItemAvatar>\n <ListItemText\n disableTypography={true}\n secondary={\n <Stack direction=\"row\" justifyContent=\"space-between\">\n <Stack alignItems=\"center\" direction=\"row\" gap={4}>\n {getTransactionStatusIcons(transaction, isDarkMode)}\n <Text truncate={true} variant=\"caption\">\n {getTransactionCategoryText(transaction, copy)}\n </Text>\n </Stack>\n {beat && showInsights && (\n <Text\n bold={true}\n color=\"action.active\"\n onClick={(e) => {\n e.stopPropagation()\n e.preventDefault()\n\n postInsightOnTransaction(beat.guid)\n }}\n truncate={true}\n variant=\"caption\"\n >\n {beat.short_title}\n </Text>\n )}\n </Stack>\n }\n >\n <Stack direction=\"row\" justifyContent=\"space-between\" sx={{ gap: 8 }}>\n <Text bold={true} truncate={true} variant=\"body1\">\n {transaction.payee || transaction.description || transaction.feed_description}\n </Text>\n <Text\n bold={true}\n color={isCredit ? 'success.main' : 'text.primary'}\n sx={{ flexShrink: 0 }}\n variant=\"body1\"\n >\n {isCredit ? '+' : ''}\n {formatCurrency(transaction.amount, '0,0.00')}\n </Text>\n </Stack>\n </ListItemText>\n </ListItemWrapper>\n )\n}\n\nexport default observer(TransactionRow)\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"TransactionRow.es.js","names":[],"sources":["../../../../../src/transactions/components/shared/transactionlist/TransactionRow.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport ListItemAvatar from '@mui/material/ListItemAvatar'\nimport ListItemText from '@mui/material/ListItemText'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Icon, MerchantLogo, Text } from '@mxenabled/mxui'\n\nimport { ListItemWrapper, useGlobalCopyStore, useTransactionStore } from '../../../../common'\nimport { Transaction, TransactionType } from '../../../../core'\nimport { isTransferTransaction } from '../../../../core/utils/TransactionUtils'\n\nimport { postInsightOnTransaction } from '../../../../common/utils/PostMessage'\n\nimport { ON_CLICK_EVENTS } from '../../../constants/OnClickEvents'\nimport { useTransactionsUiStore } from '../../../context/hooks'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\ninterface TransactionRowProps {\n component?: React.ElementType\n onClick?: (guid: string) => void\n transaction: Transaction\n}\n\nconst TransactionRow: React.FC<TransactionRowProps> = ({ transaction, onClick, component }) => {\n const theme = useTheme()\n const isDarkMode = theme.palette.mode === 'dark'\n\n const { associatedBeats } = useTransactionStore()\n const { expandedSplits } = useTransactionsUiStore()\n const { transactions: copy } = useGlobalCopyStore()\n const { showInsights } = useTransactionsUiStore()\n\n const isCredit = transaction.transaction_type === TransactionType.CREDIT\n\n const showInstitution = isTransferTransaction(transaction) && Boolean(transaction.institutionName)\n\n const beat = React.useMemo(() => {\n return associatedBeats.find((beat) => beat.associated_transaction_guid === transaction.guid)\n }, [associatedBeats, transaction])\n\n const getTransactionStatusIcons = (\n transaction: Transaction,\n isDarkMode: boolean,\n ): React.ReactNode[] => {\n const icons: React.ReactNode[] = []\n\n if (transaction.is_flagged) {\n icons.push(\n <Icon\n fill={true}\n key=\"flag\"\n name=\"flag\"\n size={16}\n sx={{ color: isDarkMode ? 'primary.main' : 'warning.dark' }}\n />,\n )\n }\n\n if (transaction.is_hidden) {\n icons.push(<Icon key=\"hidden\" name=\"visibility_off\" size={16} />)\n }\n\n if (transaction.has_been_split) {\n icons.push(<Icon key=\"split\" name=\"call_split\" size={16} />)\n }\n\n return icons\n }\n\n const getTransactionCategoryText = (transaction: Transaction, copy: any): string => {\n if (transaction.is_hidden) {\n return copy.is_excluded\n }\n\n if (transaction.has_been_split) {\n return copy.split_transaction_category_label\n }\n\n return transaction.category || ''\n }\n\n return (\n //TODO: implement common/components/ListItemRow.tsx\n <ListItemWrapper\n clickEventName={ON_CLICK_EVENTS.ON_TRANSACTION_LIST_ITEM_CLICK}\n {...(component && { component })}\n onClick={onClick ? () => onClick(transaction.guid) : undefined}\n sx={\n transaction.is_hidden ? { backgroundColor: 'grey.50', color: 'text.secondary' } : undefined\n }\n >\n <ListItemAvatar>\n {transaction.parent_guid && expandedSplits.includes(transaction.parent_guid) ? (\n <React.Fragment />\n ) : (\n <MerchantLogo\n categoryGuid={transaction.top_level_category_guid || ''}\n merchantGuid={transaction.merchant_guid || ''}\n />\n )}\n </ListItemAvatar>\n <ListItemText\n disableTypography={true}\n secondary={\n <Stack direction=\"row\" justifyContent=\"space-between\">\n <Stack alignItems=\"center\" direction=\"row\" gap={4}>\n {getTransactionStatusIcons(transaction, isDarkMode)}\n <Text truncate={true} variant=\"caption\">\n {getTransactionCategoryText(transaction, copy)}\n </Text>\n </Stack>\n {beat && showInsights && (\n <Text\n bold={true}\n color=\"action.active\"\n onClick={(e) => {\n e.stopPropagation()\n e.preventDefault()\n\n postInsightOnTransaction(beat.guid)\n }}\n truncate={true}\n variant=\"caption\"\n >\n {beat.short_title}\n </Text>\n )}\n </Stack>\n }\n >\n <Stack direction=\"row\" justifyContent=\"space-between\" sx={{ gap: 8 }}>\n <Text bold={true} truncate={true} variant=\"body1\">\n {showInstitution\n ? transaction.institutionName\n : transaction.payee || transaction.description || transaction.feed_description}\n </Text>\n <Text\n bold={true}\n color={isCredit ? 'success.main' : 'text.primary'}\n sx={{ flexShrink: 0 }}\n variant=\"body1\"\n >\n {isCredit ? '+' : ''}\n {formatCurrency(transaction.amount, '0,0.00')}\n </Text>\n </Stack>\n </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AAAA,UAAM,MAAM;AAAA,UAAM,UAAU;AAAA,UAAM,SAAQ;AAAA,UACvC,UAAA,IACG,EAAY,kBACZ,EAAY,SAAS,EAAY,eAAe,EAAY;AAAA,QAC5D,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,UACE,MAAM;AAAA,UACN,OAAO,IAAW,iBAAiB;AAAA,UACnC,IAAI,EAAE,YAAY,EAAE;AAAA,UACpB,SAAQ;AAAA,UAJV,UAAA,CAMG,IAAW,MAAM,IACjB,EAAe,EAAY,QAAQ,QAAQ,CACxC;AAAA,QACD,CAAA,CAAA;AAAA;IACK,CAAA,CACC;AAAA;AAErB,GAEA,IAAe,EAAS,CAAc"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GridCellParams } from '@mui/x-data-grid';
|
|
2
|
-
|
|
2
|
+
import { Transaction } from '../../../../../core';
|
|
3
|
+
interface PayeeCellProps extends GridCellParams<Transaction> {
|
|
3
4
|
excludedText: string;
|
|
4
5
|
}
|
|
5
6
|
declare const PayeeCell: (params: PayeeCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,28 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
children: e
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { isTransferTransaction as c } from "../../../../../core/utils/TransactionUtils.es.js";
|
|
2
|
+
import o from "@mui/material/Stack";
|
|
3
|
+
import { MerchantLogo as d, Text as i } from "@mxenabled/mxui";
|
|
4
|
+
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
5
|
+
var w = (t) => {
|
|
6
|
+
const r = c(t.row) && !!t.row.institutionName;
|
|
7
|
+
return /* @__PURE__ */ n(o, {
|
|
8
|
+
alignItems: "center",
|
|
9
|
+
direction: "row",
|
|
10
|
+
gap: 8,
|
|
11
|
+
children: [/* @__PURE__ */ e(d, {
|
|
12
|
+
categoryGuid: t.row.top_level_category_guid || "",
|
|
13
|
+
merchantGuid: t.row.merchant_guid || ""
|
|
14
|
+
}), /* @__PURE__ */ n(o, {
|
|
15
|
+
alignItems: "flex-start",
|
|
16
|
+
direction: "column",
|
|
17
|
+
children: [/* @__PURE__ */ e(i, {
|
|
18
|
+
tabIndex: t.tabIndex,
|
|
19
|
+
variant: "body2",
|
|
20
|
+
children: r ? t.row.institutionName : t.row.payee
|
|
21
|
+
}), t.row.is_hidden && /* @__PURE__ */ e(i, {
|
|
22
|
+
variant: "caption",
|
|
23
|
+
children: t.excludedText
|
|
24
|
+
})]
|
|
21
25
|
})]
|
|
22
|
-
})
|
|
23
|
-
}
|
|
26
|
+
});
|
|
27
|
+
};
|
|
24
28
|
export {
|
|
25
|
-
|
|
29
|
+
w as default
|
|
26
30
|
};
|
|
27
31
|
|
|
28
32
|
//# sourceMappingURL=PayeeCell.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayeeCell.es.js","names":[],"sources":["../../../../../../src/transactions/components/shared/transactiontable/cells/PayeeCell.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { GridCellParams } from '@mui/x-data-grid'\n\nimport { MerchantLogo, Text } from '@mxenabled/mxui'\n\ninterface PayeeCellProps extends GridCellParams {\n excludedText: string\n}\n\nconst PayeeCell = (params: PayeeCellProps) => {\n return (\n <Stack alignItems=\"center\" direction=\"row\" gap={8}>\n <MerchantLogo\n categoryGuid={params.row.top_level_category_guid || ''}\n merchantGuid={params.row.merchant_guid || ''}\n />\n <Stack alignItems=\"flex-start\" direction=\"column\">\n <Text tabIndex={params.tabIndex} variant=\"body2\">\n {params.row.payee}\n </Text>\n {params.row.is_hidden && <Text variant=\"caption\">{params.excludedText}</Text>}\n </Stack>\n </Stack>\n )\n}\n\nexport default PayeeCell\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PayeeCell.es.js","names":[],"sources":["../../../../../../src/transactions/components/shared/transactiontable/cells/PayeeCell.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { GridCellParams } from '@mui/x-data-grid'\n\nimport { MerchantLogo, Text } from '@mxenabled/mxui'\n\nimport { type Transaction } from '../../../../../core'\nimport { isTransferTransaction } from '../../../../../core/utils/TransactionUtils'\n\ninterface PayeeCellProps extends GridCellParams<Transaction> {\n excludedText: string\n}\n\nconst PayeeCell = (params: PayeeCellProps) => {\n const showInstitution = isTransferTransaction(params.row) && Boolean(params.row.institutionName)\n\n return (\n <Stack alignItems=\"center\" direction=\"row\" gap={8}>\n <MerchantLogo\n categoryGuid={params.row.top_level_category_guid || ''}\n merchantGuid={params.row.merchant_guid || ''}\n />\n <Stack alignItems=\"flex-start\" direction=\"column\">\n <Text tabIndex={params.tabIndex} variant=\"body2\">\n {showInstitution ? params.row.institutionName : params.row.payee}\n </Text>\n {params.row.is_hidden && <Text variant=\"caption\">{params.excludedText}</Text>}\n </Stack>\n </Stack>\n )\n}\n\nexport default PayeeCell\n"],"mappings":";;;;AAaA,IAAM,IAAA,CAAa,MAA2B;AAC5C,QAAM,IAAkB,EAAsB,EAAO,GAAG,KAAK,EAAQ,EAAO,IAAI;AAEhF,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,YAAW;AAAA,IAAS,WAAU;AAAA,IAAM,KAAK;AAAA,IAAhD,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MACE,cAAc,EAAO,IAAI,2BAA2B;AAAA,MACpD,cAAc,EAAO,IAAI,iBAAiB;AAAA,IAC3C,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,MAAO,YAAW;AAAA,MAAa,WAAU;AAAA,MAAzC,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,QAAM,UAAU,EAAO;AAAA,QAAU,SAAQ;AAAA,QACtC,UAAA,IAAkB,EAAO,IAAI,kBAAkB,EAAO,IAAI;AAAA,MACvD,CAAA,GACL,EAAO,IAAI,aAAa,gBAAA,EAAC,GAAD;AAAA,QAAM,SAAQ;AAAA,QAAW,UAAA,EAAO;AAAA,MAAmB,CAAA,CACvE;AAAA,IACF,CAAA,CAAA;AAAA;AAEX"}
|