'use strict';

var React = require('react');
var PropTypes = require('prop-types');
var reactHelmetAsync = require('react-helmet-async');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var React__default = /*#__PURE__*/_interopDefault(React);
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);

/* eslint-disable jsx-a11y/anchor-is-valid */
/* eslint-disable no-script-url */
/* eslint-disable no-underscore-dangle */
/* eslint-disable func-names */

var defaultProps = {
  lang: 'en'
};
var propTypes = {
  /** Walkme path */
  path: PropTypes__default.default.string.isRequired,
  /** Language code */
  lang: PropTypes__default.default.string
};
var Walkme = function Walkme(_ref) {
  var path = _ref.path,
    lang = _ref.lang;
  React.useEffect(function () {
    window._walkmeConfig = {
      smartLoad: true
    };
  }, []);
  React.useEffect(function () {
    window.walkme_get_language = function () {
      return lang === 'en' ? '' : lang;
    };
  }, [lang]);
  return /*#__PURE__*/React__default.default.createElement(reactHelmetAsync.HelmetProvider, null, /*#__PURE__*/React__default.default.createElement(reactHelmetAsync.Helmet, null, /*#__PURE__*/React__default.default.createElement("script", {
    type: "text/javascript",
    src: path
  })));
};
Walkme.defaultProps = defaultProps;
Walkme.propTypes = propTypes;
Walkme.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "Walkme",
  "props": {
    "lang": {
      "defaultValue": {
        "value": "'en'",
        "computed": false
      },
      "description": "Language code",
      "type": {
        "name": "string"
      },
      "required": false
    },
    "path": {
      "description": "Walkme path",
      "type": {
        "name": "string"
      },
      "required": true
    }
  }
};
var Walkme$1 = Walkme;

module.exports = Walkme$1;
