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