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 | import { DocumentIconV2 } from "@assets/Merchanticons";
import {
FileLightIcon,
MerchantsIcon,
EnterpriseIcon,
} from "@assets/rebrandIcons";
import GiveDocumentsUploader from "../Business/GiveDocumentsUploader";
import { GiveBusinessSectionContainer } from "./components/atoms";
import GiveBusinessProfile from "./RebrandedBusinessProfile/GiveBusinessProfile";
import { useGetMerchantById } from "@hooks/enterprise-api/account/useGetMerchants";
import { ReactElement } from "react";
import MerchantInfoSectionV2 from "./components/MerchantInfoSection/MerchantInfoSectionV2";
import { MERCHANT_FILE_TEXT } from "@constants/stringConstants";
import GiveEnterpriseInfoSection from "@features/EnterprisePortal/EnterpriseSettings/components/GiveEnterpriseInfoSection";
import GiveEnterpriseDocumentsUploader from "@features/EnterprisePortal/EnterpriseSettings/components/GiveEnterpriseDocumentsUploader";
import { generateNameLabelPlaceholder } from "@features/GiveSignup/helpers";
import { TSectionName } from "./components/MerchantInfoSection/types";
type TabType = {
name: string;
LeftIcon: ReactElement;
Component: () => ReactElement;
};
export type TValuesObject = TabType[];
export const useBusinessDetailsTabs = ({
portal,
}: {
portal: TSectionName;
}) => {
const { data } = useGetMerchantById();
const displayedName =
data?.class && generateNameLabelPlaceholder(data.class.name);
const tabs: Record<TSectionName, TValuesObject> = {
Acquirer: [
{
name: "Acquirer Info",
LeftIcon: <EnterpriseIcon />,
Component: MerchantInfoSectionV2,
},
{
name: "Business Profile",
LeftIcon: <FileLightIcon />,
Component: GiveBusinessProfile,
},
],
Provider: [
{
name: displayedName ? `${displayedName} Info` : "Provider Info",
LeftIcon: <EnterpriseIcon />,
Component: GiveEnterpriseInfoSection,
},
{
name: "Business Profile",
LeftIcon: <FileLightIcon />,
Component: GiveBusinessProfile,
},
{
name: "Documents",
LeftIcon: <FileLightIcon />,
Component: () => (
<GiveBusinessSectionContainer>
<GiveEnterpriseDocumentsUploader />
</GiveBusinessSectionContainer>
),
},
],
Merchant: [
{
name: displayedName ? `${displayedName} File` : MERCHANT_FILE_TEXT,
LeftIcon: <MerchantsIcon />,
Component: MerchantInfoSectionV2,
},
{
name: "Business Profile",
LeftIcon: <FileLightIcon />,
Component: GiveBusinessProfile,
},
{
name: "Documents",
LeftIcon: <DocumentIconV2 />,
Component: () => (
<GiveBusinessSectionContainer>
<GiveDocumentsUploader refetcher="list-business-details-documents" />
</GiveBusinessSectionContainer>
),
},
],
};
return tabs[portal];
};
|