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 | 1x 22x 21x 21x 30x 21x 21x 21x | import { useGetMerchantById } from "@hooks/enterprise-api/account/useGetMerchants";
import { useMemo } from "react";
import { BusinessSectionContainer } from "@components/Settings/BusinessDetails/components/atoms";
import { WithMissingPermissionModule } from "@common/WithMissingPermissionModule";
import { useAppSelector } from "@redux/hooks";
import ErrorCatcher from "@common/Error/ErrorCatcher";
import { merchantInfoParser } from "@components/Settings/BusinessDetails/components/MerchantInfoSection/utils/merchantInfoParser";
import GiveMerchantInfoTabSkeleton from "@components/CustomSkeletons/GiveMerchantInfoTabSkeleton";
import GiveEnterpriseInfoForm from "./GiveEnterpriseInfoForm";
import MerchantStatusV2 from "features/MerchantPortal/MerchantSettings/components/MerchantStatusV2";
const GiveEnterpriseInfoSection = () => {
const { data, isLoading } = useGetMerchantById();
const merchant = useMemo(() => merchantInfoParser(data), [data]);
const missingPermissions = useAppSelector(
(state) => state.app.permissions?.get_merchant_by_id,
);
const isReadyToApproveArray = [
merchant?.approvedOwner,
merchant?.hasApprovedBankAccount,
merchant?.hasApprovedLegalEntity,
merchant?.approvedAgreement,
merchant?.underwritingScorePercentage,
];
const isReadyToApprove = isReadyToApproveArray.every((item) => !!item);
return (
<ErrorCatcher errorID="enterprise-info-section">
{!isLoading && !missingPermissions && (
<MerchantStatusV2
status={merchant?.status}
statusDisplayName={merchant?.statusDisplayName}
statusUpdatedAt={merchant?.statusUpdatedAt}
statusUpdatedByName={merchant?.statusUpdatedByName}
statusUpdatedByEmail={merchant?.statusUpdatedByEmail}
isReadyToApprove={isReadyToApprove}
isOnApprovalDelay={merchant?.isOnApprovalDelay}
onbStateName={merchant?.onbStateName}
/>
)}
<BusinessSectionContainer>
{isLoading ? (
<GiveMerchantInfoTabSkeleton isProvider={true} />
) : (
<WithMissingPermissionModule
message="You don't have permission to access Provider details"
notAuthorized={missingPermissions}
>
<GiveEnterpriseInfoForm data={merchant} />
</WithMissingPermissionModule>
)}
</BusinessSectionContainer>
</ErrorCatcher>
);
};
export default GiveEnterpriseInfoSection;
|