import React from "react";
import { GTMProvider } from "@elgorditosalsero/react-gtm-hook";
import PropTypes from "prop-types";

var GoogleTagManager = function GoogleTagManager(props) {
  var dataLayerName = props.dataLayerName,
      id = props.id,
      children = props.children,
      sandbox = props.sandbox;
  var gtmParams = {
    id: id,
    dataLayerName: dataLayerName
  };

  if (sandbox) {
    return children;
  }

  return /*#__PURE__*/React.createElement(GTMProvider, {
    state: gtmParams
  }, children);
};

GoogleTagManager.propTypes = {
  id: PropTypes.string.isRequired,
  dataLayerName: PropTypes.string,
  sandbox: PropTypes.bool
};
GoogleTagManager.defaultProps = {
  dataLayerName: "dataLayer",
  sandbox: false
};
export default GoogleTagManager;