title: How to close Iframe(Im using popup model from Typeform)
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import React, { useRef, useEffect } from 'react';
  import { createPopup } from '@typeform/embed';
  import '@typeform/embed/build/css/popup.css';
  
  const UserRatingFeedback = (props: { email: string }) =&gt; {
    const ref = useRef&lt;HTMLDivElement&gt;(null);
  
    const { toggle, close, unmount } = createPopup('ilirmpfR', {
      size: 40,
      hidden: {
        email: props.email,
      },
    });
  
    useEffect(() =&gt; {
      toggle();
    }, []);
  
    useEffect(() =&gt; {
      const handleClick = (e: MouseEvent) =&gt; {
        const target = e.target as HTMLElement;
  
        if (ref.current?.contains(target)) {
          return unmount();
        }
      };
      window.addEventListener('click', handleClick, true);
      return () =&gt; {
        window.removeEventListener('click', handleClick, true);
      };
    });
  
    useEffect(() =&gt; {
      console.log('this is the element', window.close() == undefined);
      // console.log('this is the window-top',parent?.closeIframe());
      console.log('this is ref', ref.current);
    });
  
    return (
        &lt;div
          data-tf-widget="ilirmpfR"
          data-tf-opacity="0"
          data-tf-hide-headers
          data-tf-iframe-props="title=CSAT"
          data-tf-medium="snippet"
          data-tf-hidden="email=Luis@gmail.com"
          style={{ width: '66%', height: '450px' }}
        &gt;&lt;/div&gt;
    );
  };
  
  export default UserRatingFeedback;
  
  The createPopup function gives you multiple methods to use. I can use the unmout() or close() to close the modal but i'm failing to do so. Im trying to use a ref to listen to the click event outside of the popup modal but the Iframe when it loads takes up the entire webpage. I need a way to close the pop up modal when i click outside of it.</code></pre>
  </div>
  </div>
  </p>