/******/ (() => { // webpackBootstrap
/******/ 	"use strict";

;// external ["wp","data"]
const external_wp_data_namespaceObject = window["wp"]["data"];
;// external ["wp","element"]
const external_wp_element_namespaceObject = window["wp"]["element"];
;// external ["wp","plugins"]
const external_wp_plugins_namespaceObject = window["wp"]["plugins"];
;// ./includes/wc-blocks/assets/js/free-shipping-banner/index.js



var render = function render() {
  var _cartData$extensions;
  var cartData = (0,external_wp_data_namespaceObject.useSelect)(function (select) {
    return select('wc/store/cart').getCartData();
  });
  var freeShippingBannerData = (_cartData$extensions = cartData.extensions) === null || _cartData$extensions === void 0 || (_cartData$extensions = _cartData$extensions.yith_dynamic_wc_block_manager) === null || _cartData$extensions === void 0 ? void 0 : _cartData$extensions.ywdpd_free_shipping_notices;
  (0,external_wp_element_namespaceObject.useEffect)(function () {
    if (typeof freeShippingBannerData !== 'undefined') {
      var boydClass = document.body.classList;
      if (Array.from(boydClass).includes('woocommerce-cart')) {
        var hide = freeShippingBannerData === '';
        var banner = document.querySelector('.ywdpd-cart-notices-wrapper');
        if (banner) {
          if (hide) {
            banner.classList.add('ywdpd_banner_hide');
          } else {
            banner.classList.remove('ywdpd_banner_hide');
            banner.innerHTML = freeShippingBannerData;
          }
        } else {
          if (!hide) {
            window.location.reload();
          }
        }
      }
    }
  }, [freeShippingBannerData]);
};
(0,external_wp_plugins_namespaceObject.registerPlugin)('ywdpd-free-shipping-banner', {
  render: render,
  scope: 'woocommerce-checkout'
});
/******/ })()
;
//# sourceMappingURL=index.js.map