"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _unidriver = require("../utils/test-utils/unidriver");
var _constants = require("./constants");
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) { (0, _defineProperty2.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 _default = base => {
  var byHook = dataHook => base.$("[data-hook=\"".concat(dataHook, "\"]"));
  return _objectSpread(_objectSpread({}, (0, _unidriver.baseUniDriverFactory)(base)), {}, {
    /** returns true if save status has been passed. Custom dataHook can be used */
    saveStatusExists: function () {
      var _saveStatusExists = (0, _asyncToGenerator2.default)(function* (dataHook) {
        return byHook(dataHook || _constants.dataHooks.saveStatus).exists();
      });
      function saveStatusExists(_x) {
        return _saveStatusExists.apply(this, arguments);
      }
      return saveStatusExists;
    }(),
    getSaveStatusValue: function () {
      var _getSaveStatusValue = (0, _asyncToGenerator2.default)(function* (dataHook) {
        return byHook(dataHook || _constants.dataHooks.saveStatus).text();
      });
      function getSaveStatusValue(_x2) {
        return _getSaveStatusValue.apply(this, arguments);
      }
      return getSaveStatusValue;
    }(),
    /** returns true if action exists. Requires dataHook. */
    actionsExists: function () {
      var _actionsExists = (0, _asyncToGenerator2.default)(function* (dataHook) {
        return byHook(dataHook).exists();
      });
      function actionsExists(_x3) {
        return _actionsExists.apply(this, arguments);
      }
      return actionsExists;
    }(),
    /** return true if main action exists */
    mainActionsExists: function () {
      var _mainActionsExists = (0, _asyncToGenerator2.default)(function* (dataHook) {
        return byHook(dataHook || _constants.dataHooks.mainAction).exists();
      });
      function mainActionsExists(_x4) {
        return _mainActionsExists.apply(this, arguments);
      }
      return mainActionsExists;
    }(),
    /** return true if backButton exists. */
    backButtonExists: function () {
      var _backButtonExists = (0, _asyncToGenerator2.default)(function* () {
        return byHook(_constants.dataHooks.backButton).exists();
      });
      function backButtonExists() {
        return _backButtonExists.apply(this, arguments);
      }
      return backButtonExists;
    }(),
    /** returns back button value in string */
    getBackButtonText: function () {
      var _getBackButtonText = (0, _asyncToGenerator2.default)(function* () {
        return byHook(_constants.dataHooks.backButton).text();
      });
      function getBackButtonText() {
        return _getBackButtonText.apply(this, arguments);
      }
      return getBackButtonText;
    }(),
    /** clicks on back button */
    clickBack: function () {
      var _clickBack = (0, _asyncToGenerator2.default)(function* () {
        return byHook(_constants.dataHooks.backButton).click();
      });
      function clickBack() {
        return _clickBack.apply(this, arguments);
      }
      return clickBack;
    }()
  });
};
exports.default = _default;
//# sourceMappingURL=ComposerHeader.uni.driver.js.map