Liferay.Loader.define("commerce-organization-web@5.0.46/js/data/organizations",["module","exports","require","../utils/constants","../utils/fetch"],(function(t,e,a){window;{Object.defineProperty(e,"__esModule",{value:!0}),e.createOrganizations=function createOrganizations(e,a){return Promise.allSettled(e.map((e=>(0,o.fetchFromHeadless)(t,{body:JSON.stringify({name:e,parentOrganization:{id:a}}),method:"POST"}))))},e.getOrganization=function getOrganization(e){const a=new URL("".concat(themeDisplay.getPathContext()).concat(t,"/").concat(e),themeDisplay.getPortalURL());return a.searchParams.append("nestedFields","".concat(n.ORGANIZATIONS_PROPERTY_NAME,",").concat(n.ACCOUNTS_PROPERTY_NAME,",").concat(n.USERS_PROPERTY_NAME_IN_ORGANIZATION)),(0,o.fetchFromHeadless)(a)},e.getOrganizations=function getOrganizations(e){const a=new URL("".concat(themeDisplay.getPathContext()).concat(t),themeDisplay.getPortalURL());return a.searchParams.append("pageSize",e),(0,o.fetchFromHeadless)(a)},e.deleteOrganization=function deleteOrganization(e){return(0,o.fetchFromHeadless)("".concat(t,"/").concat(e),{method:"DELETE"},null,!0)},e.updateOrganization=function updateOrganization(e,a){return(0,o.fetchFromHeadless)("".concat(t,"/").concat(e),{body:JSON.stringify(a),method:"PATCH"})},e.ORGANIZATIONS_ROOT_ENDPOINT=void 0;var n=a("../utils/constants"),o=a("../utils/fetch");const t="/o/headless-admin-user/v1.0/organizations";e.ORGANIZATIONS_ROOT_ENDPOINT=t}}));
//# sourceMappingURL=organizations.js.map