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 | 3x 269x 269x 269x 269x 269x 269x 269x 269x 227x 227x | import { Box } from "@mui/material";
import { FormProvider } from "react-hook-form";
import CreateMerchantHeader from "./components/CreateMerchantPanelHeader";
import GiveSidePanel from "shared/SidePanel/GiveSidePanel";
import { useCreateMerchant } from "components/Merchants/CreateMerchantPanel/hooks/useCreateMerchant";
import GiveButton from "shared/Button/GiveButton";
import useNiceModal from "components/common/Modal/ModalFactory/hooks/useNiceModal";
import { Stack } from "@mui/material";
import { styled } from "theme/v2/Provider";
import NiceModal from "@ebay/nice-modal-react";
import BasicInfoForm from "./components/BasicInfoForm";
import { SidePanelContainerWrapper } from "shared/SidePanel/SidePanelAtoms";
import { useEnterprisePermissions } from "components/AcquirerEnterprises/CreateEnterprise/hooks/useEnterprisePermissions";
import Placeholders from "./components/Placeholders";
import LocalPah from "./components/LocalPah";
import LocalBP from "./components/LocalBP";
import LocalBO from "./components/LocalBO";
import LocalBA from "./components/LocalBA";
import LocalMcc from "./components/LocalMcc";
import LocalConfiguration from "./components/LocalConfiguration";
import MerchantAgreement from "./components/MerchantAgreement";
import { useGetFeatureFlagValues } from "FeatureFlags/useGetFeatureFlagValues";
type Props = {
isProvider?: boolean;
};
const GiveCreateMerchantPanel = NiceModal.create(({ isProvider }: Props) => {
const { open } = useNiceModal();
const { isOnboardingLinkBPEnabled } = useGetFeatureFlagValues();
const {
handleClose,
methods,
onSubmit,
isLoading,
handleCloseBusinessOwnerModal,
handleCloseBankAccountModal,
handleCloseMerchantAgreement,
parentCategories,
} = useCreateMerchant(isProvider);
const values = methods.watch();
const enterpriseConfiguration = useEnterprisePermissions();
const { modify_merchant } = enterpriseConfiguration;
const showLinkingProgress =
isOnboardingLinkBPEnabled &&
values?.businessProfile?.isLinkBusinessProfile &&
values?.businessProfile?.isOutOfMerchantTree;
return (
<GiveSidePanel
open={open}
onClose={handleClose}
isSecondPanelOpen={false}
isFirstPannelHidden={false}
>
<CreateMerchantHeader
handleClose={handleClose}
isMerchant={!isProvider}
/>
<SidePanelContainerWrapper>
<FormProvider {...methods}>
<Container component="form" onSubmit={methods.handleSubmit(onSubmit)}>
<Stack paddingY="40px" gap="20px">
<BasicInfoForm
modifyMerchant={modify_merchant}
isProvider={isProvider}
/>
<LocalPah isProvider={isProvider} />
<LocalBP isProvider={isProvider} />
{values.businessOwners?.length !== 0 && !showLinkingProgress ? (
<LocalBO
isMerchant
onCloseModal={handleCloseBusinessOwnerModal}
/>
) : null}
{values.bankAccounts?.length !== 0 ? (
<LocalBA onCloseModal={handleCloseBankAccountModal} />
) : null}
{values.merchantAgreement.msaPCICompliant && (
<MerchantAgreement
handleCloseMerchantAgreement={handleCloseMerchantAgreement}
isEnterprise={isProvider}
/>
)}
{isProvider && (
<LocalMcc parentCategories={parentCategories || []} />
)}
{isProvider && <LocalConfiguration />}
<Placeholders
enterpriseConfiguration={enterpriseConfiguration}
isProvider={isProvider}
parentCategories={parentCategories || []}
/>
</Stack>
<StyledFooter direction="row">
<GiveButton
variant="ghost"
data-testid="cancel-creation-button"
size="large"
disabled={isLoading}
label="Cancel"
onClick={handleClose}
/>
<GiveButton
data-testid="create-merchant-button"
size="large"
type="submit"
disabled={isLoading}
label="Add"
/>
</StyledFooter>
</Container>
</FormProvider>
</SidePanelContainerWrapper>
</GiveSidePanel>
);
});
const Container = styled(Box)(({ theme }) => ({
display: "flex",
flexDirection: "column",
gap: "24px",
[theme.breakpoints.up("v2_sm")]: {
paddingBottom: "120px",
},
}));
const StyledFooter = styled(Stack)(({ theme }) => ({
padding: "8px 20px",
display: "flex",
justifyContent: "space-between",
backdropFilter: "blur(8px)",
alignItems: "center",
minHeight: "64px",
position: "fixed",
bottom: 0,
maxWidth: "600px",
width: "100%",
zIndex: 10,
borderTop: `1px solid ${theme.palette.border?.primary}`,
}));
export default GiveCreateMerchantPanel;
|