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