"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.notificationUniDriverFactory = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _unidriver = require("../utils/test-utils/unidriver");
var _Notification = require("./Notification.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 notificationUniDriverFactory = base => {
  var getElementByDataHook = dataHook => base.$("[data-hook=\"".concat(dataHook, "\"]"));
  var notificationContent = getElementByDataHook(_Notification.dataHooks.notificationContent);
  var labelText = getElementByDataHook(_Notification.dataHooks.notificationLabel);
  var actionButton = getElementByDataHook(_Notification.dataHooks.notificationCtaButton);
  var closeButton = getElementByDataHook(_Notification.dataHooks.notificationCloseButton);
  var getSkin = /*#__PURE__*/function () {
    var _ref = (0, _asyncToGenerator2.default)(function* () {
      return yield base.attr('data-skin');
    });
    return function getSkin() {
      return _ref.apply(this, arguments);
    };
  }();
  var getType = /*#__PURE__*/function () {
    var _ref2 = (0, _asyncToGenerator2.default)(function* () {
      return yield base.attr('data-type');
    });
    return function getType() {
      return _ref2.apply(this, arguments);
    };
  }();
  return _objectSpread(_objectSpread({}, (0, _unidriver.baseUniDriverFactory)(base)), {}, {
    visible: () => notificationContent.exists(),
    /** @deprecated use hasSkin with skin prop instead */
    hasTheme: function () {
      var _hasTheme = (0, _asyncToGenerator2.default)(function* () {
        return !!(yield getSkin());
      });
      function hasTheme() {
        return _hasTheme.apply(this, arguments);
      }
      return hasTheme;
    }(),
    hasSkin: function () {
      var _hasSkin = (0, _asyncToGenerator2.default)(function* () {
        return !!(yield getSkin());
      });
      function hasSkin() {
        return _hasSkin.apply(this, arguments);
      }
      return hasSkin;
    }(),
    isStandardNotification: function () {
      var _isStandardNotification = (0, _asyncToGenerator2.default)(function* () {
        return (yield getSkin()) === _Notification.SKINS.standard;
      });
      function isStandardNotification() {
        return _isStandardNotification.apply(this, arguments);
      }
      return isStandardNotification;
    }(),
    isErrorNotification: function () {
      var _isErrorNotification = (0, _asyncToGenerator2.default)(function* () {
        return (yield getSkin()) === _Notification.SKINS.error;
      });
      function isErrorNotification() {
        return _isErrorNotification.apply(this, arguments);
      }
      return isErrorNotification;
    }(),
    isSuccessNotification: function () {
      var _isSuccessNotification = (0, _asyncToGenerator2.default)(function* () {
        return (yield getSkin()) === _Notification.SKINS.success;
      });
      function isSuccessNotification() {
        return _isSuccessNotification.apply(this, arguments);
      }
      return isSuccessNotification;
    }(),
    isWarningNotification: function () {
      var _isWarningNotification = (0, _asyncToGenerator2.default)(function* () {
        return (yield getSkin()) === _Notification.SKINS.warning;
      });
      function isWarningNotification() {
        return _isWarningNotification.apply(this, arguments);
      }
      return isWarningNotification;
    }(),
    isPremiumNotification: function () {
      var _isPremiumNotification = (0, _asyncToGenerator2.default)(function* () {
        return (yield getSkin()) === _Notification.SKINS.premium;
      });
      function isPremiumNotification() {
        return _isPremiumNotification.apply(this, arguments);
      }
      return isPremiumNotification;
    }(),
    getLabelText: () => labelText.text(),
    hasActionButton: () => actionButton.exists(),
    getActionButtonText: () => actionButton.text(),
    hasCloseButton: () => closeButton.exists(),
    isRelativelyPositioned: function () {
      var _isRelativelyPositioned = (0, _asyncToGenerator2.default)(function* () {
        return (yield getType()) === _Notification.TYPE_POSITIONS_MAP.relative;
      });
      function isRelativelyPositioned() {
        return _isRelativelyPositioned.apply(this, arguments);
      }
      return isRelativelyPositioned;
    }(),
    isFixedPositioned: function () {
      var _isFixedPositioned = (0, _asyncToGenerator2.default)(function* () {
        return (yield getType()) === _Notification.TYPE_POSITIONS_MAP.fixed;
      });
      function isFixedPositioned() {
        return _isFixedPositioned.apply(this, arguments);
      }
      return isFixedPositioned;
    }(),
    isAbsolutePositioned: function () {
      var _isAbsolutePositioned = (0, _asyncToGenerator2.default)(function* () {
        return (yield getType()) === _Notification.TYPE_POSITIONS_MAP.absolute;
      });
      function isAbsolutePositioned() {
        return _isAbsolutePositioned.apply(this, arguments);
      }
      return isAbsolutePositioned;
    }(),
    clickOnCloseButton: () => closeButton.click(),
    clickOnActionButton: () => actionButton.click(),
    getZIndex: function () {
      var _getZIndex = (0, _asyncToGenerator2.default)(function* () {
        var style = yield base._prop('style');
        return Number(style['z-index']);
      });
      function getZIndex() {
        return _getZIndex.apply(this, arguments);
      }
      return getZIndex;
    }()
  });
};
exports.notificationUniDriverFactory = notificationUniDriverFactory;
//# sourceMappingURL=Notification.uni.driver.js.map