"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.ViewDialog = exports.Default = void 0;

var _react = _interopRequireDefault(require("react"));

var _IdleTimeout = _interopRequireDefault(require("./IdleTimeout"));

var _IdleTimeoutDialog = _interopRequireDefault(require("./IdleTimeoutDialog"));

var _addonDocs = require("@storybook/addon-docs");

var _clientApi = require("@storybook/client-api");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

var DocsPage = function DocsPage() {
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_addonDocs.Title, null), /*#__PURE__*/_react.default.createElement(_addonDocs.Subtitle, null), /*#__PURE__*/_react.default.createElement(_addonDocs.Description, null), /*#__PURE__*/_react.default.createElement(_addonDocs.ArgsTable, {
    story: _addonDocs.PRIMARY_STORY
  }));
};

var _default = {
  title: 'Components/Idle Timeout',
  component: _IdleTimeout.default,
  parameters: {
    docs: {
      inlineStories: false,
      page: DocsPage
    },
    loki: {
      skip: true
    }
  },
  argTypes: {},
  args: {
    timeToTimeout: 2,
    timeToWarning: 0.5,
    onTimeout: function onTimeout() {
      console.log('onTimeout');
    }
  }
};
exports.default = _default;

var Template = function Template(_ref) {
  var args = _extends({}, _ref);

  var _useArgs = (0, _clientApi.useArgs)(),
      _useArgs2 = _slicedToArray(_useArgs, 1),
      _useArgs2$ = _useArgs2[0],
      timeToTimeout = _useArgs2$.timeToTimeout,
      timeToWarning = _useArgs2$.timeToWarning;

  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("p", null, "Idle Timeout modal will show after ", timeToWarning, " minutes of inactivity."), /*#__PURE__*/_react.default.createElement(_IdleTimeout.default, _extends({
    timeToTimeout: timeToTimeout,
    timeToWarning: timeToWarning
  }, args)));
};

var Default = Template.bind({});
exports.Default = Default;

var ViewDialog = function ViewDialog() {
  return /*#__PURE__*/_react.default.createElement(_IdleTimeoutDialog.default, {
    continueSessionText: "Continue Session",
    heading: "Are you still there?",
    endSessionButtonText: "Logout",
    endSessionUrl: "#",
    message: "You\u2019ve been inactive for a while. Your session will end in 2 minutes. Select \"Continue session\" below if you want more time.",
    onClose: function onClose() {},
    onSessionContinue: function onSessionContinue() {},
    onSessionForcedEnd: function onSessionForcedEnd() {},
    showSessionEndButton: true
  });
}; // ViewDialog.parameters = {
//   loki: { skip: false }
// };


exports.ViewDialog = ViewDialog;