All files / src/sections/PayBuilder/provider useIsPreviewMode.tsx

100% Statements 5/5
100% Branches 0/0
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        46x 1408x 1408x   1408x 1408x    
import { useModal } from "@ebay/nice-modal-react";
import { NEW_PEEK_MODE_MODAL } from "modals/modal_names";
import { useLocation } from "react-router-dom";
 
export const useIsPreviewMode = () => {
  const { pathname } = useLocation();
  const { visible: isPeekModalOpened } = useModal(NEW_PEEK_MODE_MODAL);
 
  const isPreviewMode = pathname.startsWith("/pay_product_builder");
  return { isPreviewMode, isPeekModalOpened };
};