'use strict';

require('core-js/modules/es.symbol.js');
require('core-js/modules/es.array.filter.js');
require('core-js/modules/es.object.get-own-property-descriptor.js');
require('core-js/modules/es.object.get-own-property-descriptors.js');
require('core-js/modules/es.object.keys.js');
require('core-js/modules/es.object.to-string.js');
require('core-js/modules/web.dom-collections.for-each.js');
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var React = require('react');
var PropTypes = require('prop-types');
var react = require('@carbon/react');

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

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

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var defaultProps = {
  isOpen: false,
  i18n: {
    heading: 'Do you wish to log out?',
    secondaryButton: 'Cancel',
    primaryButton: 'Log out',
    body: 'Logging out also logs you out of each application that is open in the same browser.  To ensure a secure log out, close all open browser windows.',
    closeButtonLabel: 'Close'
  },
  testId: 'suite-header-logout-modal'
};
var propTypes = {
  isOpen: PropTypes__default.default.bool,
  onClose: PropTypes__default.default.func.isRequired,
  onLogout: PropTypes__default.default.func.isRequired,
  i18n: PropTypes__default.default.shape({
    heading: PropTypes__default.default.string,
    primaryButton: PropTypes__default.default.string,
    secondaryButton: PropTypes__default.default.string,
    body: PropTypes__default.default.string,
    closeButtonLabel: PropTypes__default.default.string
  }),
  testId: PropTypes__default.default.string
};
var SuiteHeaderLogoutModal = function SuiteHeaderLogoutModal(_ref) {
  var isOpen = _ref.isOpen,
    onClose = _ref.onClose,
    onLogout = _ref.onLogout,
    i18n = _ref.i18n,
    testId = _ref.testId;
  var mergedI18N = _objectSpread(_objectSpread({}, defaultProps.i18n), i18n);
  return /*#__PURE__*/React__default.default.createElement(react.Modal, {
    open: isOpen,
    modalHeading: mergedI18N.heading,
    primaryButtonText: mergedI18N.primaryButton,
    secondaryButtonText: mergedI18N.secondaryButton,
    onSecondarySubmit: onClose,
    onRequestSubmit: onLogout,
    onRequestClose: onClose,
    "data-testid": testId,
    closeButtonLabel: mergedI18N.closeButtonLabel
  }, mergedI18N.body);
};
SuiteHeaderLogoutModal.propTypes = propTypes;
SuiteHeaderLogoutModal.defaultProps = defaultProps;
SuiteHeaderLogoutModal.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "SuiteHeaderLogoutModal",
  "props": {
    "isOpen": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "i18n": {
      "defaultValue": {
        "value": "{\n  heading: 'Do you wish to log out?',\n  secondaryButton: 'Cancel',\n  primaryButton: 'Log out',\n  body: 'Logging out also logs you out of each application that is open in the same browser.  To ensure a secure log out, close all open browser windows.',\n  closeButtonLabel: 'Close',\n}",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "shape",
        "value": {
          "heading": {
            "name": "string",
            "required": false
          },
          "primaryButton": {
            "name": "string",
            "required": false
          },
          "secondaryButton": {
            "name": "string",
            "required": false
          },
          "body": {
            "name": "string",
            "required": false
          },
          "closeButtonLabel": {
            "name": "string",
            "required": false
          }
        }
      },
      "required": false
    },
    "testId": {
      "defaultValue": {
        "value": "'suite-header-logout-modal'",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "string"
      },
      "required": false
    },
    "onClose": {
      "description": "",
      "type": {
        "name": "func"
      },
      "required": true
    },
    "onLogout": {
      "description": "",
      "type": {
        "name": "func"
      },
      "required": true
    }
  }
};
var SuiteHeaderLogoutModal$1 = SuiteHeaderLogoutModal;

module.exports = SuiteHeaderLogoutModal$1;
