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 | import { useMemo } from "react";
import { getTransactionLineItems } from "../helpers/getTransactionLineItems";
import { TransactionSummarySection } from "../helpers/getTransactionLineItems";
import { useTransactionComputedData } from "./useTransactionComputedData";
import { useCustomThemeV2 } from "@theme/hooks/useCustomThemeV2";
import { checkPortals } from "@utils/routing";
export const useTransactionSummarySection = (
data: any,
computed: ReturnType<typeof useTransactionComputedData>,
isRevenueSection?: boolean,
) => {
const { isMobileView } = useCustomThemeV2();
const { currentPortal, isEnterprisePortal } = checkPortals();
const section: TransactionSummarySection = useMemo(() => {
return getTransactionLineItems(data, {
isRefunded: computed.isRefunded,
isPreChargebackRefund: computed.isPreChargebackRefund,
isChargeback: computed.isChargeback,
isChargebackReversal: computed.isChargebackReversal,
isTransfer: computed.isTransfer,
isTransferFromProvider: computed.isTransfer && isEnterprisePortal,
formattedCreatedAt: computed.formattedCreatedAt,
merchantAccount: computed.merchantAccount,
providerAccount: computed.providerAccount,
merchantRevenue: computed.merchantRevenue,
providerRevenue: computed.providerRevenue,
acquirerRevenue: computed.acquirerRevenue,
interchangeFeesPaid: computed.interchangeFeesPaid,
isFees: computed.isFees,
hasNoRevenue: computed.hasNoRevenue,
hasNoAmount: computed.hasNoAmount,
portalType: currentPortal as "merchant" | "provider" | "acquirer",
isMobileView,
isRevenueSection,
});
}, [data, computed, isMobileView, isRevenueSection, currentPortal]);
return section;
};
|