Liferay.Loader.define("commerce-organization-web@5.0.37/js/menu/AccountMenuContent",["module","exports","require","@frontend-taglib-clay$clayui/drop-down","frontend-js-web","liferay!frontend-js-react-web$react","../ChartContext","../data/accounts","../utils/constants","../utils/index"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({closeMenu:e,data:t,parentData:n}){const{chartInstanceRef:f}=(0,o.useContext)(u.default);const l=[];(0,d.hasPermission)(t,c.ACTION_KEYS.account.REMOVE)&&l.push(o.default.createElement(r.default.Item,{key:"remove",onClick:function(){(0,a.openConfirmModal)({message:(0,a.sub)(Liferay.Language.get("x-will-be-removed-from-x"),t.name,n.name),onConfirm:r=>{r&&(0,i.updateAccount)(t.id,{organizationIds:t.organizationIds.filter((e=>Number(e)!==Number(n.id)))}).then((()=>{f.current.deleteNodes([t],!1),e()}))}})}},Liferay.Language.get("remove")));(0,d.hasPermission)(t,c.ACTION_KEYS.account.DELETE)&&l.push(o.default.createElement(r.default.Item,{key:"delete",onClick:function(){(0,a.openConfirmModal)({message:(0,a.sub)(Liferay.Language.get("x-will-be-deleted"),t.name),onConfirm:n=>{n&&(0,i.deleteAccount)(t.id).then((()=>{f.current.deleteNodes([t],!0),e()}))}})}},Liferay.Language.get("delete")));return l};var r=l(n("@frontend-taglib-clay$clayui/drop-down")),a=n("frontend-js-web"),o=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=f();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var o=r?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react")),u=l(n("../ChartContext")),i=n("../data/accounts"),c=n("../utils/constants"),d=n("../utils/index");function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}function l(e){return e&&e.__esModule?e:{default:e}}}}));
//# sourceMappingURL=AccountMenuContent.js.map