Liferay.Loader.define("commerce-organization-web@5.0.46/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 AccountMenuContent({closeMenu:e,data:t,parentData:n}){const{chartInstanceRef:l}=(0,o.useContext)(i.default);const f=[];(0,d.hasPermission)(t,c.ACTION_KEYS.account.REMOVE)&&f.push(o.default.createElement(r.default.Item,{key:"remove",onClick:function handleRemove(){(0,a.openConfirmModal)({message:(0,a.sub)(Liferay.Language.get("x-will-be-removed-from-x"),t.name,n.name),onConfirm:r=>{r&&(0,u.updateAccount)(t.id,{organizationIds:t.organizationIds.filter((e=>Number(e)!==Number(n.id)))}).then((()=>{l.current.deleteNodes([t],!1),e()}))}})}},Liferay.Language.get("remove")));(0,d.hasPermission)(t,c.ACTION_KEYS.account.DELETE)&&f.push(o.default.createElement(r.default.Item,{key:"delete",onClick:function handleDelete(){(0,a.openConfirmModal)({message:(0,a.sub)(Liferay.Language.get("x-will-be-deleted"),t.name),onConfirm:n=>{n&&(0,u.deleteAccount)(t.id).then((()=>{l.current.deleteNodes([t],!0),e()}))}})}},Liferay.Language.get("delete")));return f};var r=_interopRequireDefault(n("@frontend-taglib-clay$clayui/drop-down")),a=n("frontend-js-web"),o=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();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")),i=_interopRequireDefault(n("../ChartContext")),u=n("../data/accounts"),c=n("../utils/constants"),d=n("../utils/index");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}}}));
//# sourceMappingURL=AccountMenuContent.js.map