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 | 51x 51x 51x 51x 51x 37x 102x 102x 561x 2326x 2326x 37x 2326x 2326x | import { MERCHANT_FILE_TEXT } from "@constants/stringConstants";
import {
Accordion,
AccordionDetails,
AccordionSummary,
Box,
Grid,
Stack,
} from "@mui/material";
import {
CaretDownIcon,
CreditCardIcon,
ListChecksIcon,
} from "@phosphor-icons/react";
import GiveDivider from "@shared/GiveDivider/GiveDivider";
import SectionCardBase from "@shared/SidePanel/components/SectionCard/SectionCardBase";
import GiveText from "@shared/Text/GiveText";
import { useAppTheme } from "@theme/v2/Provider";
import useSnapShot from "features/Merchants/MerchantSidePanel/hooks/useSnapShot";
import { TMerchantBaseContextData } from "@components/Merchants/MerchantPreview/data.types";
type FeeDetails = {
isLast?: any;
label: string;
value: string | number | JSX.Element | Date | null;
isPhoneNumber?: boolean;
};
type SeeScheduleObj = {
[key: string]: FeeDetails[];
};
function MerchantApplicationScheduleFee({
defaultContext,
isOnboarding,
isEnterprise = false,
}: {
defaultContext?: TMerchantBaseContextData;
isOnboarding?: boolean;
isEnterprise?: boolean;
}) {
const {
transactionFees,
transferFees,
monthlyAccountFees,
gateAwayAccessFees,
chargeBackFees,
misleneousFees,
merchantInfo,
businessProfile,
primaryAccountHolder,
businessOwners,
bankAccounts,
} = useSnapShot({
defaultContext,
});
const seeScheduleObj = {
"Transaction Fees": transactionFees,
"Transfer Fees": transferFees,
"Monthly Account Fees": monthlyAccountFees,
"Gateway Access Fees": gateAwayAccessFees,
"Chargeback Fees": chargeBackFees,
"Miscellaneous Fees": misleneousFees,
};
const merchantApplication = {
[MERCHANT_FILE_TEXT]: merchantInfo,
"Business Profile": businessProfile,
"Bank Account": bankAccounts?.flat(),
"Primary Account Holder": primaryAccountHolder,
"Business Owners": businessOwners?.flat(),
};
const { palette } = useAppTheme();
return (
<SectionCardBase
childrenContainerSx={{
p: 0,
border: isOnboarding ? `1px solid ${palette.border?.primary}` : "",
}}
>
<CustomAccordion
mainTitle="Merchant Application"
objectSection={merchantApplication}
Icon={ListChecksIcon}
/>
<GiveDivider sx={{ m: 0 }} />
<CustomAccordion
mainTitle="Fee Schedule"
objectSection={seeScheduleObj}
Icon={CreditCardIcon}
/>
</SectionCardBase>
);
}
export default MerchantApplicationScheduleFee;
const CustomAccordion = ({
mainTitle,
objectSection,
Icon,
}: {
mainTitle: string;
objectSection: SeeScheduleObj;
Icon?: any;
}) => {
const { palette } = useAppTheme();
return (
<Accordion
disableGutters
sx={{
backgroundColor: "transparent", // Remove background color for Accordion
boxShadow: "none", // Remove box shadow
"&:before": { display: "none" }, // Remove the default border above Accordion
padding: "20px",
}}
>
<AccordionSummary
expandIcon={
<CaretDownIcon fill={palette.text.secondary} fontSize="20px" />
}
aria-controls="panel1-content"
id="panel1-header"
sx={{
padding: 0,
minHeight: 0,
"& .MuiAccordionSummary-content": { margin: 0 },
}}
>
<Stack gap="8px" alignItems="center" flexDirection="row">
<Icon size="24px" fill={palette.icon?.["icon-primary"]} />
<GiveText fontSize="16px" color="primary">
{mainTitle}
</GiveText>
</Stack>
</AccordionSummary>
<AccordionDetails
sx={{
padding: 0,
}}
>
{Object.keys(objectSection).map((key) => (
<Stack mt="20px" key={key} spacing={1}>
<GiveText
pb="8px"
pt="20px"
color="secondary"
fontSize="14px"
fontWeight={400}
>
{key}
</GiveText>
{objectSection[key].map((item, index) => {
const isEven = index % 2 === 0;
return (
<>
<ColoredTextGrid
label={item?.label}
key={index}
isEven={isEven}
value={item.value}
/>
{item?.isLast && (
<Box>
<GiveDivider
sx={{
mb: "24px",
}}
/>
</Box>
)}
</>
);
})}
</Stack>
))}
</AccordionDetails>
</Accordion>
);
};
export const ColoredTextGrid = ({
isEven,
label,
value,
}: {
isEven: boolean;
value: any;
label: string;
}) => {
const { palette } = useAppTheme();
return (
<Grid
p="12px 16px"
bgcolor={isEven ? palette.surface?.secondary : palette.surface?.primary}
container
>
<Grid xs={6} item paddingRight="8px">
<GiveText fontWeight={400} fontSize="14px" color="secondary">
{label}
</GiveText>
</Grid>
<Grid xs={6} item>
<GiveText
fontWeight={400}
fontSize="14px"
color="primary"
sx={{
whiteSpace: "normal",
overflow: "visible",
wordWrap: "break-word",
}}
>
{value || "-"}
</GiveText>
</Grid>
</Grid>
);
};
|