All files / src/features/Products ProductList.tsx

14.28% Statements 1/7
0% Branches 0/6
0% Functions 0/2
14.28% Lines 1/7

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                      1x                                                            
import { ProductScreenNotAuthorizedWrapper } from "@components/Product/commons/ProductScreenNotAuthorizedWrapper";
import NiceModal from "@ebay/nice-modal-react";
import { CREATE_PRE_BUILD_FORM_MODAL } from "modals/modal_names";
import { useEffect } from "react";
import { useLocation } from "react-router-dom";
import BackgroundAnimation from "@shared/Banner/BackgroundAnimation";
import ProductListTable from "./table/ProductListTable";
import { TCampaignType } from "./types";
import GiveMotionWrapper from "@shared/Motion/GiveMotionWrapper";
import { PortalRootContainerV2 } from "components/Layout/LayoutV2";
 
const ProductList = ({ type }: { type: TCampaignType }) => {
  const { state } = useLocation();
  const isNewProduct = state?.newProduct || false;
 
  useEffect(() => {
    if (isNewProduct && type === "payment-form")
      NiceModal.show(CREATE_PRE_BUILD_FORM_MODAL);
  }, [isNewProduct]);
 
  return (
    <ProductScreenNotAuthorizedWrapper type={type}>
      <PortalRootContainerV2>
        <BackgroundAnimation page="merchantPaymentForms" />
        <GiveMotionWrapper
          delay={30}
          containerProps={{ sx: { height: "100%", zIndex: 2 } }}
          customStyle={{
            height: "100%",
            display: "flex",
            justifyContent: "center",
          }}
        >
          <ProductListTable type={type} />
        </GiveMotionWrapper>
      </PortalRootContainerV2>
    </ProductScreenNotAuthorizedWrapper>
  );
};
 
export default ProductList;