Reset Proximity facet when Map filtering is enabled

<?php
add_action('facetwp_scripts', function () {
  ?>
  <script>
    (function($) {
      document.addEventListener('facetwp-refresh', function() {
        if ( 'undefined' != typeof FWP_MAP && true === FWP_MAP.is_filtering) {
          $('.facetwp-location').val(''); // reset the value of the input field
          $('.facetwp-lat').val(''); // reset hidden field
          $('.facetwp-lng').val(''); // reset hidden field
          $('.facetwp-radius option').each(function () {
            if (this.defaultSelected) {
              this.selected = true;
              return false;
            } // reset default radius if it is a dropdown
          });
          FWP.facets['my_proximity_facet'] = []; // change 'my_proximity_facet' to name of your Proximity facet
        }
      });
    })(fUtil);
  </script>
  <?php
}, 100);