Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 | 69x 1204x 69x 69x 628x 628x 628x 628x 628x 69x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 69x 69x 69x 69x 184x 184x 184x 184x 184x 184x 184x 184x 52x 132x 132x 132x 132x 102x 17x 13x 13x 13x 4x 132x 104x 104x 104x 104x 52x 52x 52x 52x 52x 69x 727x 727x 69x 69x 755x 69x 69x 69x 52x 52x 26x 26x 69x 69x 69x 823x 69x 697x 628x 755x 839x 69x 76x 69x 69x | import { TransactionTableRow } from "@components/ManageMoney/TransactionTable/transactions.types";
import GiveTruncateText from "@shared/Text/GiveTruncateText";
import { Box, Stack, SxProps } from "@mui/material";
import {
capitalizeCardType,
capitalizeEachWord,
formatLargeNumber,
parseAmount,
} from "@utils/index";
import VisaCard from "@assets/images/PaymentCards/visa.svg";
import MasterCard from "@assets/images/PaymentCards/mastercard.svg";
import AmexCard from "@assets/images/PaymentCards/amex.svg";
import { DiscoverCardIcon } from "@assets/builderIcons";
import { styled } from "@theme/v2/Provider";
import GiveText from "@shared/Text/GiveText";
import {
getOriginalChargedAmount,
getAmountFormatAndStyle,
getStatus,
getType,
getFormattedDescription,
} from "@components/ManageMoney/TransactionTable/transactions.helpers";
import GiveChip, { TChipColors } from "@shared/Chip/GiveChip";
import { capitalize } from "lodash";
import { checkPortals } from "@utils/routing";
import {
feesArray,
moveFundsArray,
} from "@components/ManageMoney/TransactionTable/transactions.types";
import { useFormatDateInTimezone } from "@utils/date.helpers";
import GiveDateTooltip from "@shared/Tooltip/GiveDateTooltip";
import { useCustomThemeV2 } from "@theme/hooks/useCustomThemeV2";
import { CHARGEBACK_REFUND } from "@constants/constants";
import { useGetFeatureFlagValues } from "FeatureFlags/useGetFeatureFlagValues";
import { getTransactionStateInfo } from "@features/TransactionPanel/utils";
import { AlertDot } from "@features/Processing/ProcessingTable.atoms";
import { tabNames } from "@features/Processing/hooks/useTransactionsFilters";
import { formatNumberToShort } from "@utils/index";
import GiveTooltip from "@shared/Tooltip/GiveTooltip";
export const isFeeTransaction = (
transactionType = "",
isAcquirerPortal = false,
) => {
return feesArray.includes(transactionType || "") && isAcquirerPortal;
};
export const DescriptionFeesText = ({
transactionType,
}: {
transactionType?: string;
}) => {
const { isAcquirerPortal } = checkPortals();
const isFee = isFeeTransaction(transactionType, isAcquirerPortal);
return (
<>
{isFee && (
<GiveTruncateText variant="bodyS" lineClamp={1} maxWidth="auto">
{getFeeRenderText(transactionType)}
</GiveTruncateText>
)}
</>
);
};
type DateColumnProps = TransactionTableRow & {
config?: {
tab?: string;
queryFilters?: any;
isWideView?: boolean;
isLargeView?: boolean;
};
};
export const DateColumn = ({
config: { tab, queryFilters, isWideView } = {},
...row
}: DateColumnProps) => {
const { formatInTimezone } = useFormatDateInTimezone();
const isTransactionBlocked =
queryFilters?.blocked?.includes("isBlocked:true");
const hideAlertDot =
!isWideView || !(isTransactionBlocked && tab === tabNames.suspected);
const alertDot =
isTransactionBlocked && row.firstCheckedAt === null ? <AlertDot /> : null;
return (
<Stack
direction="row"
alignItems="center"
gap="12px"
sx={{
marginLeft: "-8px",
}}
>
<Box
sx={{
visibility: hideAlertDot ? "hidden" : "visible",
display: "flex",
alignItems: "center",
width: "6px",
}}
>
{alertDot}
</Box>
<GiveDateTooltip>
<GiveTruncateText
data-testid={`manage-money-row-${row.createdAt}`}
variant="bodyS"
fontWeight="regular"
lineClamp={1}
color={"primary"}
>
{formatInTimezone(row?.timeV2, "MMM dd, yyyy HH:mm")}
</GiveTruncateText>
</GiveDateTooltip>
</Stack>
);
};
export const DesktopDescriptionColumn = (row: TransactionTableRow) => {
const { isMerchantPortal, isAcquirerPortal } = checkPortals();
const formattedDescription = getFormattedDescription(
row?.detailedDescription?.[0],
row?.transactionType,
isMerchantPortal,
false,
row?.description,
);
//TODO remove this when the BE returns for the sidepanel endpoint the isPending value
const { status, feeText } = getTransactionStateInfo(row);
const textColor = "primary";
const textColorSecondary = "secondary";
const isFee = isFeeTransaction(row?.transactionType, isAcquirerPortal);
const isMoveFunds = row?.transactionType === "move_funds";
const isSidepanel = Boolean(row?.isSidepanel);
//this check is used for new manage money table (transaction-base endpoint)
const isDestinationAccUsed = row?.destinationAccount?.type === "merchant";
const usedName =
row?.merchantName ||
(isDestinationAccUsed ? row?.dstAccMerchantName : row?.srcAccMerchantName);
Eif (!isMerchantPortal) {
return isFee ? (
<GiveTruncateText
color={textColor}
variant="bodyS"
lineClamp={1}
maxWidth="auto"
>
{getFeeRenderText(row?.transactionType)}
</GiveTruncateText>
) : (
<Stack gap="4px">
<Stack
flex={1}
spacing={1}
direction="row"
alignItems="center"
justifyContent="flex-start"
>
{row?.cardType && (
<Box height="18px" alignItems="center" justifyContent="center">
{cardIconsMap()[row?.cardType as keyof typeof cardIconsMap]}
</Box>
)}
{isMoveFunds && isSidepanel ? (
<GiveText color={textColor} variant="bodyS">
Transfer
</GiveText>
) : (
<>
<GiveTruncateText lineClamp={1} color={textColor} variant="bodyS">
{isMoveFunds ? row?.description : feeText}
</GiveTruncateText>
{usedName && <Dot>•</Dot>}
<GiveTruncateText lineClamp={1} color={textColor} variant="bodyS">
{usedName}
</GiveTruncateText>
</>
)}
</Stack>
<Stack
flex={1}
spacing={1}
direction="row"
alignItems="center"
justifyContent="flex-start"
>
<GiveText variant="bodyS" color={textColorSecondary}>
{parseAmount(row?.cost)} USD
</GiveText>
<GiveText variant="bodyS" color={textColorSecondary}>
{capitalizeEachWord(status)}
</GiveText>
</Stack>
</Stack>
);
}
return (
<Stack gap="4px">
<Stack flex={1} spacing={1} direction="row">
<DescriptionFeesText transactionType={row?.transactionType} />
{row?.cardDigits && (
<>
<Box height="18px">
{cardIconsMap()[row?.cardType as keyof typeof cardIconsMap]}
</Box>
<GiveText variant="bodyS">{row?.cardDigits}</GiveText>
<Dot>•</Dot>
</>
)}
<GiveTruncateText variant="bodyS" lineClamp={1} maxWidth="auto">
{capitalizeCardType(formattedDescription)}
</GiveTruncateText>
</Stack>
</Stack>
);
};
type MobileDescriptionColumnProps = TransactionTableRow & {
formatInTimezone?: any;
};
export const MobileDescriptionColumn = ({
formatInTimezone,
...row
}: MobileDescriptionColumnProps) => {
const { isMerchantPortal, isManageMoney, isSettlementPage } = checkPortals();
const isReserve = ["reserve_deposit", "reserve_release"].includes(
row?.transactionType || "",
);
const isMoveFunds = row?.transactionType === "move_funds";
const isDestinationAccMerchant =
row?.destinationAccount?.type === "merchant";
const usedMerchantName =
row?.merchantName ||
(isDestinationAccMerchant
? row?.dstAccMerchantName
: row?.srcAccMerchantName);
const mobileStatus = getStatus(row)?.displayStatus?.toLowerCase() as string;
const formattedDescription = getFormattedDescription(
row?.detailedDescription?.[0],
row?.transactionType,
isMerchantPortal,
false,
row?.description,
);
//TODO remove this when the BE returns for the sidepanel endpoint the isPending value
const {
isPending: isPendingFromSidepanel,
status,
feeText,
} = getTransactionStateInfo(row);
const isNotMerchantManageMoney = !isMerchantPortal && isManageMoney;
const isPending = isPendingFromSidepanel && isNotMerchantManageMoney;
const textColor = "primary";
if (isSettlementPage) {
return (
<Stack gap="8px" flex={1}>
<GiveTruncateText
color={textColor}
variant="bodyS"
fontWeight="regular"
lineClamp={1}
>
{formatInTimezone(row?.timeV2, "MMM dd, yyyy HH:mm")}
</GiveTruncateText>
<Stack
flex={1}
spacing={1}
direction="row"
alignItems="center"
justifyContent="flex-start"
>
{row?.cardType && (
<Box height="18px" alignItems="center" justifyContent="center">
{
cardIconsMap(isPending)[
row?.cardType as keyof typeof cardIconsMap
]
}
</Box>
)}
<GiveText variant="bodyS">{row?.cardDigits}</GiveText>
<Dot>•</Dot>
<GiveTruncateText lineClamp={1} color={textColor} variant="bodyS">
{row?.merchantName}
</GiveTruncateText>
</Stack>
<StatusTextColumn row={row} />
</Stack>
);
}
if (!isMerchantPortal) {
return (
<Stack gap="8px" flex={1}>
<GiveTruncateText
color={textColor}
variant="bodyS"
fontWeight="regular"
lineClamp={1}
>
{formatInTimezone(row?.timeV2, "MMM dd, yyyy HH:mm")}
</GiveTruncateText>
{!isReserve ? (
<>
<Stack
flex={1}
spacing={1}
direction="row"
alignItems="center"
justifyContent="flex-start"
>
{row?.cardType && (
<Box height="18px" alignItems="center" justifyContent="center">
{cardIconsMap()[row?.cardType as keyof typeof cardIconsMap]}
</Box>
)}
<GiveText color={textColor} variant="bodyS">
{isMoveFunds ? row?.description : feeText}
</GiveText>
</Stack>
<GiveText color={textColor} variant="bodyXS">
{usedMerchantName}
</GiveText>
</>
) : (
<GiveTruncateText variant="bodyXS" lineClamp={1} maxWidth="auto">
{capitalizeCardType(formattedDescription || "")}
</GiveTruncateText>
)}
{isMoveFunds ? (
<GiveText variant="bodyXS" color="secondary">
{parseAmount(row?.cost)} USD {capitalizeEachWord(status)}
</GiveText>
) : (
!isPending && (
<Stack
flex={1}
spacing={1}
direction="row"
alignItems="center"
justifyContent="flex-start"
>
<GiveText
variant="bodyS"
sx={{
color:
(statusTextColorsMap[mobileStatus] as string) ?? textColor,
textTransform: "capitalize",
}}
>
{capitalize(mobileStatus)}
</GiveText>
</Stack>
)
)}
</Stack>
);
}
return (
<Stack gap="8px" flex={1}>
<GiveTruncateText variant="bodyS" fontWeight="regular" lineClamp={1}>
{formatInTimezone(row?.timeV2, "MMM dd, yyyy HH:mm")}
</GiveTruncateText>
<Stack gap="8px" direction="row" alignItems="center">
{row?.cardDigits && (
<>
{cardIconsMap()[row?.cardType as keyof typeof cardIconsMap]}
<GiveText variant="bodyXS">{row?.cardDigits}</GiveText>
<Dot>•</Dot>
</>
)}
<GiveTruncateText variant="bodyXS" lineClamp={1} maxWidth="auto">
{capitalizeCardType(formattedDescription || "")}
</GiveTruncateText>
</Stack>
<GiveText
variant="bodyXS"
sx={{
color: (isMoveFunds
? statusTextColorsMap[mobileStatus]
: statusTextColorsMap[status]) as string,
textTransform: "capitalize",
}}
>
{capitalize(isMoveFunds ? mobileStatus : status)}
</GiveText>
</Stack>
);
};
export const MerchantColumn = (row: TransactionTableRow) => {
const { isAcquirerPortal } = checkPortals();
const isFee = isFeeTransaction(row?.transactionType, isAcquirerPortal);
if (isFee) return null;
return (
<GiveTruncateText
variant="bodyXS"
fontWeight="regular"
color="secondary"
lineClamp={1}
>
{row?.merchantName}
</GiveTruncateText>
);
};
export const TypeColumn = (row: TransactionTableRow) => (
<GiveTruncateText variant="bodyS" lineClamp={1}>
{getType(row)?.replace("Money Transfer", "Transfer")}
</GiveTruncateText>
);
export function AmountColumn(row: TransactionTableRow) {
const { isWideView } = useCustomThemeV2();
const processingState = row?.processingState;
const { amount } = getAmountFormatAndStyle(row);
const isTransferFunds =
row?.transactionType && moveFundsArray.includes(row?.transactionType);
const chargedAmount = formatLargeNumber(getOriginalChargedAmount(row, true));
return (
<Stack alignItems="flex-end" marginLeft="auto" maxWidth="200px">
<GiveText
variant="bodyS"
color={
amount?.includes("+") && processingState === "settled"
? "success"
: "primary"
}
>
{!isTransferFunds ? amount : chargedAmount} {!isWideView && "USD"}
</GiveText>
{!isTransferFunds && (
<GiveText variant="bodyXS" color="secondary">
{chargedAmount}
</GiveText>
)}
</Stack>
);
}
export const getAmountDisplayLogic = (
row: TransactionTableRow,
variant: "credit" | "debit" | "mobile",
showOperator = false,
isMerchantPortal = false,
ignoreDebitColor = false,
) => {
//TODO remove this when the BE returns for the sidepanel endpoint the isPending value
const { isPending: isPendingFromSidepanel } = getTransactionStateInfo(row);
const isPending = row?.isGrayedOut ?? isPendingFromSidepanel;
const processingState = row?.processingState;
const { amount } = getAmountFormatAndStyle(row);
const status = getStatus(
row,
).displayStatus.toLowerCase() as keyof typeof chipColorsMap;
const isCredit = amount?.includes("+");
const isDebit = amount?.includes("-");
// Return null if variant doesn't match amount type
if ((variant === "credit" && isDebit) || (variant === "debit" && !isDebit)) {
return null;
}
const defaultAmount =
variant === "credit" || variant === "mobile" ? parseAmount(0) : "";
const baseAmount = amount ?? defaultAmount;
const displayAmount = showOperator
? baseAmount
: baseAmount?.replace(/^[-+]/, "");
const getTextColor = () => {
if (isCredit && processingState === "settled") return "success";
if (isDebit && status !== "requested" && !ignoreDebitColor) {
const color = chipColorsMap[status];
Iif (color === "warning" && isMerchantPortal) {
return "warning";
}
return "error";
}
return "primary";
};
return {
displayAmount,
color: isPending ? "secondary" : getTextColor(),
shouldGrayOut: isPending,
isCredit,
isDebit,
isPending,
};
};
function BaseAmount({
row,
variant,
}: {
row: TransactionTableRow;
variant: "credit" | "debit" | "mobile";
}) {
const { isWideView } = useCustomThemeV2();
const { isMerchantPortal } = checkPortals();
const amountData = getAmountDisplayLogic(
row,
variant,
false,
isMerchantPortal,
);
if (!amountData) return null;
const isMoveFunds = row?.transactionType === "move_funds";
const showEndingBalance =
variant === "mobile" && isMoveFunds && !amountData.isPending;
return (
<Stack
alignItems="flex-end"
maxWidth="200px"
width="100%"
sx={{ textAlign: "right" }}
>
<GiveTooltip
title={Math.abs(row?.balanceAdjustment)?.toLocaleString()}
placement="bottom"
disableHoverListener={Math.abs(row?.balanceAdjustment || 0) < 1_000_000}
fluidWidth
>
<GiveText
variant="bodyS"
color={amountData.color}
sx={{ width: "100%" }}
>
{formatNumberToShort(amountData.displayAmount)} {!isWideView && "USD"}
</GiveText>
</GiveTooltip>
{showEndingBalance && (
<GiveText variant="bodyXS" color="secondary">
{parseAmount(row?.endingBalance)}
</GiveText>
)}
</Stack>
);
}
export function CreditColumn(row: TransactionTableRow) {
return <BaseAmount row={row} variant="credit" />;
}
export function DebitColumn(row: TransactionTableRow) {
return <BaseAmount row={row} variant="debit" />;
}
export function MobileAmountColumn(row: TransactionTableRow) {
return <BaseAmount row={row} variant="mobile" />;
}
export const StatusColumn = (row: TransactionTableRow) => {
const status = getStatus(row)?.displayStatus?.toLowerCase() as string;
return <GiveTransactionStatus status={status as TChipColors} />;
};
export const PaymentFormStatusColumn = ({
row,
}: {
row: TransactionTableRow;
}) => StatusColumn(row);
export const GiveTransactionStatus = ({
status,
sx,
label,
}: {
status: TChipColors;
sx?: SxProps;
label?: string;
}) => {
return (
<StyledChip
variant="light"
color={chipColorsMap[status]}
label={label ?? capitalize(status)}
size="small"
sx={sx}
/>
);
};
export const StatusTextColumn = ({
row,
sx,
}: {
row: TransactionTableRow;
sx?: SxProps;
}) => {
const status = getStatus(row)?.displayStatus?.toLowerCase() as string;
return <GiveTransactionTextStatus status={status as TChipColors} sx={sx} />;
};
export const GiveTransactionTextStatus = ({
status,
sx,
label,
}: {
status: TChipColors;
sx?: SxProps;
label?: string;
}) => {
return (
<GiveText
variant="bodyXS"
sx={{ ...sx, color: statusTextColorsMap[status] as string }}
>
{label ?? capitalize(status)}
</GiveText>
);
};
export const BalanceColumn = (row: TransactionTableRow) => {
const isPending = row?.isGrayedOut;
if (isPending)
return (
<GiveText variant="bodyS" color="secondary" sx={{ textAlign: "right" }}>
Pending
</GiveText>
);
return (
<GiveTooltip
title={Math.abs(row?.endingBalance)?.toLocaleString()}
placement="bottom"
disableHoverListener={Math.abs(row?.endingBalance || 0) < 1_000_000}
>
<GiveText
variant="bodyS"
color="primary"
sx={{ textAlign: "right", width: "100%" }}
>
{parseAmount(row?.endingBalance)}
</GiveText>
</GiveTooltip>
);
};
const chipColorsMap: Record<string, TChipColors> = {
approved: "success",
successful: "success",
refunded: "warning",
canceled: "default",
chargeback: "error",
"chargeback reversal": "success",
failed: "error",
declined: "error",
error: "error",
captured: "default",
pending: "default",
voided: "default",
authorized: "default",
quarantined: "default",
settled: "success",
sent: "success",
sending: "success",
"refund pending": "warning",
"refund declined": "warning",
"refund error": "warning",
requested: "warning",
"ready to process": "default",
[CHARGEBACK_REFUND]: "error",
returned: "primitiveblue10",
"reconciliation credit": "success",
};
const statusTextColorsMap: any = {
approved: "text.secondary",
successful: "primitive.success.50",
refunded: "primitive.warning.50",
canceled: "text.secondary",
chargeback: "primitive.error.50",
"chargeback reversal": "primitive.success.50",
failed: "text.secondary",
declined: "primitive.error.50",
error: "primitive.error.50",
pending: "text.secondary",
voided: "text.secondary",
authorized: "text.secondary",
settled: "primitive.success.50",
sent: "primitive.success.50",
sending: "text.secondary",
"refund pending": "text.secondary",
requested: "primitive.warning.50",
"ready to process": "text.secondary",
[CHARGEBACK_REFUND]: "primitive.error.50",
returned: "primitive.blue.100",
};
export const Image = styled("img")<{ isPending?: boolean }>(
({ isPending }) => ({
height: 18,
width: 28,
filter: isPending ? "grayscale(100%) brightness(0.8)" : "none",
transition: "filter 0.3s ease",
}),
);
export const Dot = styled("div", {
shouldForwardProp: (prop) => prop !== "color",
})<{
color?: "secondary" | "primary";
}>(({ theme, color = "secondary" }) => ({
color: theme.palette.icon?.[`icon-${color}`],
}));
const StyledChip = styled(GiveChip)(() => ({
borderRadius: "40px",
padding: "6px 16px",
width: "100%",
textTransform: "capitalize",
}));
export const cardIconsMap = (isPending?: boolean) => ({
visa: <Image src={VisaCard} isPending={isPending} />,
mastercard: <Image src={MasterCard} isPending={isPending} />,
amex: <Image src={AmexCard} isPending={isPending} />,
discover: <GrayableDiscoverCardIcon isGrayed={isPending} />,
"american express": <Image src={AmexCard} isPending={isPending} />,
});
export type CardType = keyof ReturnType<typeof cardIconsMap>;
export const CardIcon = ({ type }: { type: CardType }) => (
<Box sx={{ display: "inline-flex", alignItems: "center", lineHeight: 0 }}>
{cardIconsMap()[type]}
</Box>
);
const getFeeRenderText = (type?: string): string => {
switch (type) {
case "network_fees":
case "other_fees":
case "processor_fees":
return "Network Fees";
case "assessment_fees":
return "Assessment Fees";
default:
return "Network Fees";
}
};
const GrayableDiscoverCardIcon = ({ isGrayed }: { isGrayed?: boolean }) => {
return (
<Box
sx={{
height: 18,
width: 28,
display: "flex",
alignItems: "center",
justifyContent: "center",
filter: isGrayed ? "grayscale(100%) brightness(0.5)" : "none",
transition: "filter 0.3s ease",
}}
>
<DiscoverCardIcon height={18} width={28} />
</Box>
);
};
|