Liferay.Loader.define("@liferay/object-web@1.0.153/js/components/ObjectRelationship/DeleteRelationship",["module","exports","require","@frontend-taglib-clay$clayui/modal","@liferay/object-js-components-web","frontend-js-web","liferay!frontend-js-react-web$react","../DangerModal","../WarningModal"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function ModalWithProvider({isApproved:e}){const[t,a]=(0,o.useState)(),{observer:l,onClose:i}=(0,n.useModal)({onClose:()=>a(null)}),u=(0,o.useCallback)((e=>{r.API.deleteObjectRelationships(e).then((()=>{Liferay.Util.openToast({message:Liferay.Language.get("relationship-was-deleted-successfully")}),i(),setTimeout((()=>window.location.reload()),1500)}))}),[i]);return(0,o.useEffect)((()=>(Liferay.on("deleteObjectRelationship",(({itemData:t})=>{e||t.reverse?a(t):u(t.id)})),()=>Liferay.detach("deleteObjectRelationship"))),[u,e]),o.default.createElement(n.ClayModalProvider,null,t&&o.default.createElement(ModalDeleteObjectRelationship,{objectRelationship:t,observer:l,onClose:i,onDelete:u}))};var n=a("@frontend-taglib-clay$clayui/modal"),r=a("@liferay/object-js-components-web"),l=a("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 a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var l=n?Object.getOwnPropertyDescriptor(e,r):null;l&&(l.get||l.set)?Object.defineProperty(a,r,l):a[r]=e[r]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),i=_interopRequireDefault(a("../DangerModal")),u=_interopRequireDefault(a("../WarningModal"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function ModalDeleteObjectRelationship({objectRelationship:e,observer:t,onClose:a,onDelete:n}){return e.reverse?o.default.createElement(u.default,{observer:t,onClose:a,title:Liferay.Language.get("deletion-not-allowed")},o.default.createElement("div",null,Liferay.Language.get("you-do-not-have-permission-to-delete-this-relationship")),o.default.createElement("div",null,Liferay.Language.get("you-cannot-delete-a-relationship-from-here"))):o.default.createElement(i.default,{errorMessage:Liferay.Language.get("input-and-relationship-name-do-not-match"),observer:t,onClose:a,onDelete:()=>n(e.id),placeholder:Liferay.Language.get("confirm-relationship-name"),title:Liferay.Language.get("delete-relationship"),token:e.name},o.default.createElement("p",null,Liferay.Language.get("this-action-cannot-be-undone-and-will-permanently-permanently-all-related-fields-from-this-relationship")),o.default.createElement("p",null,Liferay.Language.get("it-may-affect-many-records")),o.default.createElement("p",{dangerouslySetInnerHTML:{__html:(0,l.sub)(Liferay.Language.get("please-type-the-relationship-name-x-to-confirm"),"<strong>".concat(e.name,"</strong>"))}}))}}}));
//# sourceMappingURL=DeleteRelationship.js.map