"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/asyncToGenerator"),r=require("@babel/runtime/helpers/slicedToArray"),i=require("@babel/runtime/regenerator"),s=require("react");require("lodash"),require("@babel/runtime/helpers/toConsumableArray"),require("@babel/runtime/helpers/defineProperty"),require("uuid"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment"),require("../../../clients/jsonApi/index.js"),require("../../../clients/subscriptions/constants.js"),require("../../../clients/subscriptions.v1.js"),require("../../../clients/subscriptions/subscriptions-client.factory.js"),require("../../../clients/api/apiCore.js"),require("../../../clients/constants.js"),require("../../../clients/sso/auth0.js"),require("../../../clients/sso/oauth2.js"),require("../../../clients/api/rateLimiter.js");var t=require("../api/companies/fetchCompanies.js");require("../constants.js"),require("../api/shared/dataFormatter.js");var n=require("./useCompanySelectorPermission.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(e),o=a(r),c=a(i);exports.useCompanies=function(e){var r=e.open,i=s.useState([]),a=o.default(i,2),l=a[0],p=a[1],q=n.useCompanySelectorPermission(),m=q.canViewCompanies,f=q.canViewCompaniesLoading;return s.useEffect((function(){function e(){return(e=u.default(c.default.mark((function e(){var r;return c.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.fetchCompanies();case 2:r=e.sent,p(r);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}m&&r&&0===l.length&&function(){e.apply(this,arguments)}()}),[m,l.length,r]),{canViewCompanies:m,canViewCompaniesLoading:f,companies:l}};
//# sourceMappingURL=useCompanies.js.map
