'use strict';

var initializers = require('@bigbinary/neeto-commons-frontend/initializers');
var Callout = require('@bigbinary/neetoui/Callout');
var reactI18next = require('react-i18next');
var reactRouterDom = require('react-router-dom');
var uaParser = require('./ua-parser-E0eEtHJZ.js');
var jsxRuntime = require('react/jsx-runtime');

var MOBILE_PLATFORMS = ["Android", "iOS", "Windows Phone"];

var DownloadMobileAppCallout = function DownloadMobileAppCallout(_ref) {
  var _globalProps$appName;
  var excludePathRegex = _ref.excludePathRegex;
  var _useLocation = reactRouterDom.useLocation(),
    pathname = _useLocation.pathname;
  var parser = new uaParser.UAParser(navigator.userAgent);
  var result = parser.getResult();
  var isMobilePlatform = MOBILE_PLATFORMS.includes(result.os.name);
  if (!isMobilePlatform) return null;
  var shouldExcludePath = excludePathRegex && excludePathRegex.test(pathname);
  if (shouldExcludePath) return null;
  var appName = (_globalProps$appName = initializers.globalProps.appName) === null || _globalProps$appName === void 0 ? void 0 : _globalProps$appName.toLowerCase();
  var mobileAppDownloadUrl = "https://www.neeto.com/".concat(appName, "/mobile");
  return /*#__PURE__*/jsxRuntime.jsx(Callout, {
    className: "m-4 block",
    style: "warning",
    children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
      i18nKey: "neetoMolecules.downloadMobileAppCallout.message",
      components: {
        a: /*#__PURE__*/jsxRuntime.jsx("a", {
          className: "neeto-ui-btn--style-link",
          href: mobileAppDownloadUrl,
          rel: "noreferrer",
          target: "_blank"
        })
      }
    })
  });
};

module.exports = DownloadMobileAppCallout;
//# sourceMappingURL=DownloadMobileAppCallout.js.map
