All files / src/components/Settings/BusinessDetails/RebrandedBusinessProfile BusinessProfileStatusV2.tsx

100% Statements 5/5
75% Branches 9/12
100% Functions 1/1
100% Lines 5/5

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                                  3x               3x           32x     32x       32x                                                                              
import { BusinessProfileStatusType } from "@common/Tag/BusinessProfileTag";
import { Stack } from "@mui/material";
import GiveText from "@shared/Text/GiveText";
import GiveBusinessProfileTag from "features/Merchants/MerchantSidePanel/GiveMerchantFile/businessProfile/GiveBusinessProfileTag";
import GiveMotionWrapper from "@shared/Motion/GiveMotionWrapper";
import GiveAlert from "@shared/GiveAlert/GiveAlert";
import { WarningIcon } from "@phosphor-icons/react";
 
import { useAppTheme } from "@theme/v2/Provider";
 
type Props = {
  status?: BusinessProfileStatusType;
  isConfirmedMatch: boolean;
  isSettingsPage?: boolean;
  showLinkedBP?: boolean;
};
 
const INCOMPLETE_STATUSES = [
  "pending_review",
  "move_back_to_pending",
  "pending",
  "declined_by_msp",
  "pending_review_issue",
];
 
const BusinessProfileStatus = ({
  status,
  isConfirmedMatch,
  isSettingsPage,
  showLinkedBP,
}: Props) => {
  const { palette } = useAppTheme();
 
  const statusCode =
    isSettingsPage && status && INCOMPLETE_STATUSES.includes(status)
      ? "incomplete"
      : status;
 
  return (
    <Stack
      mt={4.25}
      pb={4}
      gap={1}
      borderBottom={`1px solid ${palette.primitive?.neutral[20]}`}
    >
      <GiveMotionWrapper delay={50}>
        <Stack gap={2} direction={"row"} alignItems={"center"}>
          <GiveText color="primary" fontSize="18px">
            Business Profile
          </GiveText>
          {!isConfirmedMatch && status && (
            <GiveBusinessProfileTag
              statusCode={showLinkedBP ? "linking" : statusCode}
            />
          )}
        </Stack>
      </GiveMotionWrapper>
      {isConfirmedMatch && (
        <GiveMotionWrapper delay={150}>
          <GiveAlert
            type="warning2"
            label="Suspended due to a confirmed OFAC match"
            Icon={<WarningIcon size={20} />}
            sx={{
              mt: 2,
              "& .MuiBox-root": {
                display: "flex",
              },
            }}
          />
        </GiveMotionWrapper>
      )}
    </Stack>
  );
};
 
export default BusinessProfileStatus;