import _pt from "prop-types";
import React from 'react';
import { Dialog } from '../Dialog';
import { Button } from '../Button';
export var IdleTimeoutDialog = function IdleTimeoutDialog(_ref) {
  var closeButtonText = _ref.closeButtonText,
      continueSessionText = _ref.continueSessionText,
      heading = _ref.heading,
      endSessionButtonText = _ref.endSessionButtonText,
      endSessionUrl = _ref.endSessionUrl,
      message = _ref.message,
      onClose = _ref.onClose,
      onSessionContinue = _ref.onSessionContinue,
      onSessionForcedEnd = _ref.onSessionForcedEnd,
      showSessionEndButton = _ref.showSessionEndButton;

  var renderDialogActions = function renderDialogActions() {
    var continueSessionButtonClasses = showSessionEndButton ? 'ds-u-margin-right--2' : null;
    return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
      variation: "solid",
      className: continueSessionButtonClasses,
      onClick: onSessionContinue
    }, continueSessionText), showSessionEndButton ? /*#__PURE__*/React.createElement(Button, {
      href: endSessionUrl,
      onClick: onSessionForcedEnd
    }, endSessionButtonText) : null);
  };

  return /*#__PURE__*/React.createElement(Dialog, {
    alert: true,
    dialogId: "session-timeout-dialog",
    escapeExits: false,
    heading: heading,
    actions: renderDialogActions(),
    onExit: onClose,
    closeButtonText: closeButtonText
  }, message);
};
IdleTimeoutDialog.propTypes = {
  /**
     *  The text for the dialog's 'close' button
     */
  closeButtonText: _pt.string,

  /**
     * The text for the 'continue session' button in warning dialog.
     */
  continueSessionText: _pt.string.isRequired,

  /**
     * The heading text for the warning dialog.
     */
  heading: _pt.string,

  /**
     * The text for the button that ends the session in warning dialog.
     */
  endSessionButtonText: _pt.string,

  /**
     *
     */
  endSessionUrl: _pt.string,

  /**
     * The message text for the warning dialog.
     * Note that using the token `<timeToTimeout>` will be replaced in the message text with the number of minutes until timeout.
     */
  message: _pt.oneOfType([_pt.string, _pt.node]).isRequired,

  /**
     * Function that is called when the user select the 'close' button for the dialog
     */
  onClose: _pt.func.isRequired,

  /**
     * Function that is called when the user chooses to keep the session alive.
     * The IdleTimeout component will reset the countdown internally.
     */
  onSessionContinue: _pt.func.isRequired,

  /**
     * Optional function that is called when the session is manually ended by user.
     * If not provided, the behavior of `onTimeout` will be used.
     */
  onSessionForcedEnd: _pt.func,

  /**
     * Describes if the button to manually end session should be shown
     */
  showSessionEndButton: _pt.bool
};
export default IdleTimeoutDialog;