"use strict";

exports.__esModule = true;
exports.validateOvertureApplication = exports.getScopes = exports.getScopeExtendedConfiguration = exports.getDefaultScope = exports.getAppModules = exports.applicationScopeHasChanged = exports.GET_SCOPE_EXTENDED_CONFIGURATION_SUCCESS = exports.GET_SCOPE_EXTENDED_CONFIGURATION_REQUEST = exports.GET_SCOPE_EXTENDED_CONFIGURATION_FAILURE = exports.GET_SCOPE_EXTENDED_CONFIGURATION = exports.GET_SCOPES_SUCCESS = exports.GET_SCOPES_REQUEST = exports.GET_SCOPES_FAILURE = exports.GET_SCOPES = exports.GET_MY_SCOPE_SUCCESS = exports.GET_MY_SCOPE_REQUEST = exports.GET_MY_SCOPE_FAILURE = exports.GET_MY_SCOPE = exports.GET_APPLICATION_MODULES_SUCCESS = exports.GET_APPLICATION_MODULES_REQUEST = exports.GET_APPLICATION_MODULES_FAILURE = exports.GET_APPLICATION_MODULES = exports.APPLICATION_SCOPE_HAS_CHANGED = void 0;
var _makeApiAction = require("./makeApiAction");
var _makeOrcApiAction = _interopRequireDefault(require("./makeOrcApiAction"));
var _requestsApi = require("./requestsApi");
var _constants = require("../constants");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();
(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _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(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var validateOvertureApplication = exports.validateOvertureApplication = function validateOvertureApplication() {
  if (!OVERTURE_APPLICATION) {
    throw new Error('"overtureApplication.name" is missing in the configuration.');
  }
};
validateOvertureApplication();
var GET_APPLICATION_MODULES = exports.GET_APPLICATION_MODULES = "GET_APPLICATION_MODULES";
var _makeActionTypes = (0, _makeApiAction.makeActionTypes)(GET_APPLICATION_MODULES),
  _makeActionTypes2 = _slicedToArray(_makeActionTypes, 3),
  GET_APPLICATION_MODULES_REQUEST = exports.GET_APPLICATION_MODULES_REQUEST = _makeActionTypes2[0],
  GET_APPLICATION_MODULES_SUCCESS = exports.GET_APPLICATION_MODULES_SUCCESS = _makeActionTypes2[1],
  GET_APPLICATION_MODULES_FAILURE = exports.GET_APPLICATION_MODULES_FAILURE = _makeActionTypes2[2];
var getAppModules = exports.getAppModules = function getAppModules() {
  return (0, _makeOrcApiAction.default)(GET_APPLICATION_MODULES, _requestsApi.getApplicationModules.buildUrl(OVERTURE_APPLICATION));
};
var GET_SCOPES = exports.GET_SCOPES = "GET_SCOPES";
var _makeActionTypes3 = (0, _makeApiAction.makeActionTypes)(GET_SCOPES),
  _makeActionTypes4 = _slicedToArray(_makeActionTypes3, 3),
  GET_SCOPES_REQUEST = exports.GET_SCOPES_REQUEST = _makeActionTypes4[0],
  GET_SCOPES_SUCCESS = exports.GET_SCOPES_SUCCESS = _makeActionTypes4[1],
  GET_SCOPES_FAILURE = exports.GET_SCOPES_FAILURE = _makeActionTypes4[2];
var getScopes = exports.getScopes = function getScopes(module) {
  return (0, _makeOrcApiAction.default)(GET_SCOPES, _requestsApi.getUserScopeTreeRequest.buildUrl(module === _constants.overtureModule.System ? _constants.overtureModule.Orders : module, {}), _requestsApi.getUserScopeTreeRequest.verb, {
    bailout: false,
    meta: {
      module: module
    }
  });
};
var GET_MY_SCOPE = exports.GET_MY_SCOPE = "GET_MY_SCOPE";
var _makeActionTypes5 = (0, _makeApiAction.makeActionTypes)(GET_MY_SCOPE),
  _makeActionTypes6 = _slicedToArray(_makeActionTypes5, 3),
  GET_MY_SCOPE_REQUEST = exports.GET_MY_SCOPE_REQUEST = _makeActionTypes6[0],
  GET_MY_SCOPE_SUCCESS = exports.GET_MY_SCOPE_SUCCESS = _makeActionTypes6[1],
  GET_MY_SCOPE_FAILURE = exports.GET_MY_SCOPE_FAILURE = _makeActionTypes6[2];
var getDefaultScope = exports.getDefaultScope = function getDefaultScope(module) {
  return (0, _makeOrcApiAction.default)(GET_MY_SCOPE, _requestsApi.getUserScopeRequest.buildUrl(module === _constants.overtureModule.System ? _constants.overtureModule.Orders : module), _requestsApi.getUserScopeRequest.verb, {
    bailout: false
  });
};
var APPLICATION_SCOPE_HAS_CHANGED = exports.APPLICATION_SCOPE_HAS_CHANGED = "APPLICATION_SCOPE_HAS_CHANGED";
var applicationScopeHasChanged = exports.applicationScopeHasChanged = function applicationScopeHasChanged(previousScope, newScope, moduleName) {
  return {
    type: APPLICATION_SCOPE_HAS_CHANGED,
    payload: {
      previousScope: previousScope,
      newScope: newScope,
      moduleName: moduleName
    }
  };
};
var GET_SCOPE_EXTENDED_CONFIGURATION = exports.GET_SCOPE_EXTENDED_CONFIGURATION = "GET_SCOPE_EXTENDED_CONFIGURATION";
var _makeActionTypes7 = (0, _makeApiAction.makeActionTypes)(GET_SCOPE_EXTENDED_CONFIGURATION),
  _makeActionTypes8 = _slicedToArray(_makeActionTypes7, 3),
  GET_SCOPE_EXTENDED_CONFIGURATION_REQUEST = exports.GET_SCOPE_EXTENDED_CONFIGURATION_REQUEST = _makeActionTypes8[0],
  GET_SCOPE_EXTENDED_CONFIGURATION_SUCCESS = exports.GET_SCOPE_EXTENDED_CONFIGURATION_SUCCESS = _makeActionTypes8[1],
  GET_SCOPE_EXTENDED_CONFIGURATION_FAILURE = exports.GET_SCOPE_EXTENDED_CONFIGURATION_FAILURE = _makeActionTypes8[2];
var getScopeExtendedConfiguration = exports.getScopeExtendedConfiguration = function getScopeExtendedConfiguration(scope) {
  return (0, _makeOrcApiAction.default)(GET_SCOPE_EXTENDED_CONFIGURATION, _requestsApi.getScopeExtendedConfigurationRequest.buildUrl(scope), _requestsApi.getScopeExtendedConfigurationRequest.verb, {
    bailout: false,
    meta: {
      scope: scope
    }
  });
};
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(validateOvertureApplication, "validateOvertureApplication", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_APPLICATION_MODULES, "GET_APPLICATION_MODULES", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_APPLICATION_MODULES_REQUEST, "GET_APPLICATION_MODULES_REQUEST", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_APPLICATION_MODULES_SUCCESS, "GET_APPLICATION_MODULES_SUCCESS", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_APPLICATION_MODULES_FAILURE, "GET_APPLICATION_MODULES_FAILURE", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(getAppModules, "getAppModules", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_SCOPES, "GET_SCOPES", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_SCOPES_REQUEST, "GET_SCOPES_REQUEST", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_SCOPES_SUCCESS, "GET_SCOPES_SUCCESS", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_SCOPES_FAILURE, "GET_SCOPES_FAILURE", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(getScopes, "getScopes", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_MY_SCOPE, "GET_MY_SCOPE", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_MY_SCOPE_REQUEST, "GET_MY_SCOPE_REQUEST", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_MY_SCOPE_SUCCESS, "GET_MY_SCOPE_SUCCESS", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_MY_SCOPE_FAILURE, "GET_MY_SCOPE_FAILURE", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(getDefaultScope, "getDefaultScope", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(APPLICATION_SCOPE_HAS_CHANGED, "APPLICATION_SCOPE_HAS_CHANGED", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(applicationScopeHasChanged, "applicationScopeHasChanged", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_SCOPE_EXTENDED_CONFIGURATION, "GET_SCOPE_EXTENDED_CONFIGURATION", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_SCOPE_EXTENDED_CONFIGURATION_REQUEST, "GET_SCOPE_EXTENDED_CONFIGURATION_REQUEST", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_SCOPE_EXTENDED_CONFIGURATION_SUCCESS, "GET_SCOPE_EXTENDED_CONFIGURATION_SUCCESS", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_SCOPE_EXTENDED_CONFIGURATION_FAILURE, "GET_SCOPE_EXTENDED_CONFIGURATION_FAILURE", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(getScopeExtendedConfiguration, "getScopeExtendedConfiguration", "/home/vsts/work/1/s/src/actions/scopes.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(validateOvertureApplication, "validateOvertureApplication", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_APPLICATION_MODULES, "GET_APPLICATION_MODULES", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_APPLICATION_MODULES_REQUEST, "GET_APPLICATION_MODULES_REQUEST", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_APPLICATION_MODULES_SUCCESS, "GET_APPLICATION_MODULES_SUCCESS", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_APPLICATION_MODULES_FAILURE, "GET_APPLICATION_MODULES_FAILURE", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(getAppModules, "getAppModules", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_SCOPES, "GET_SCOPES", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_SCOPES_REQUEST, "GET_SCOPES_REQUEST", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_SCOPES_SUCCESS, "GET_SCOPES_SUCCESS", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_SCOPES_FAILURE, "GET_SCOPES_FAILURE", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(getScopes, "getScopes", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_MY_SCOPE, "GET_MY_SCOPE", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_MY_SCOPE_REQUEST, "GET_MY_SCOPE_REQUEST", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_MY_SCOPE_SUCCESS, "GET_MY_SCOPE_SUCCESS", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_MY_SCOPE_FAILURE, "GET_MY_SCOPE_FAILURE", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(getDefaultScope, "getDefaultScope", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(APPLICATION_SCOPE_HAS_CHANGED, "APPLICATION_SCOPE_HAS_CHANGED", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(applicationScopeHasChanged, "applicationScopeHasChanged", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_SCOPE_EXTENDED_CONFIGURATION, "GET_SCOPE_EXTENDED_CONFIGURATION", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_SCOPE_EXTENDED_CONFIGURATION_REQUEST, "GET_SCOPE_EXTENDED_CONFIGURATION_REQUEST", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_SCOPE_EXTENDED_CONFIGURATION_SUCCESS, "GET_SCOPE_EXTENDED_CONFIGURATION_SUCCESS", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(GET_SCOPE_EXTENDED_CONFIGURATION_FAILURE, "GET_SCOPE_EXTENDED_CONFIGURATION_FAILURE", "/home/vsts/work/1/s/src/actions/scopes.js");
  reactHotLoader.register(getScopeExtendedConfiguration, "getScopeExtendedConfiguration", "/home/vsts/work/1/s/src/actions/scopes.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();