"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/asyncToGenerator"),r=require("@babel/runtime/helpers/slicedToArray"),t=require("@babel/runtime/regenerator"),i=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 s=require("../../api/companies/fetchCompanies.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../../constants.js"),require("../../api/shared/dataFormatter.js");var u=n(e),a=n(r),o=n(t);exports.useCompanyProvider=function(e){var r=i.useState(null),t=a.default(r,2),n=t[0],c=t[1];return i.useEffect((function(){function r(){return(r=u.default(o.default.mark((function r(){var t,i,n;return o.default.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!e){r.next=6;break}return r.next=3,s.fetchCompanies();case 3:r.t0=r.sent,r.next=7;break;case 6:r.t0=[];case 7:i=r.t0,n=(null===(t=i.find((function(r){return r.id===e})))||void 0===t?void 0:t.provider)||null,c(n);case 10:case"end":return r.stop()}}),r)})))).apply(this,arguments)}c(null),function(){r.apply(this,arguments)}()}),[e]),[n]};
//# sourceMappingURL=useCompanyProvider.js.map
