Liferay.Loader.define("portal-workflow-kaleo-designer-web@5.0.115/designer/js/definition-builder/diagram-builder/components/sidebar/sections/notifications/Notifications",["module","exports","require","@frontend-taglib-clay$clayui/data-provider","liferay!frontend-js-react-web$react","../../../../../DefinitionBuilderContext","../../../../../constants","../../../../../util/fetchUtil","../../../../DiagramBuilderContext","./NotificationsInfo"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=n("@frontend-taglib-clay$clayui/data-provider"),i=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 i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var o=r?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(n,i,o):n[i]=e[i]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react")),o=n("../../../../../DefinitionBuilderContext"),a=n("../../../../../constants"),c=n("../../../../../util/fetchUtil"),u=n("../../../../DiagramBuilderContext"),l=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(n("./NotificationsInfo"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach((function(t){_defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var _default=e=>{const{accountEntryId:t}=(0,i.useContext)(o.DefinitionBuilderContext),{selectedItem:n}=(0,i.useContext)(u.DiagramBuilderContext),{notifications:s}=null==n?void 0:n.data,[f,d]=(0,i.useState)([]),[p,y]=(0,i.useState)(4),[b,g]=(0,i.useState)([{identifier:"".concat(Date.now(),"-0")}]),{resource:O}=(0,r.useResource)({fetchOptions:{headers:_objectSpread(_objectSpread({},c.headers),{},{accept:"application/json","x-csrf-token":Liferay.authToken})},fetchPolicy:"cache-first",link:"".concat(window.location.origin).concat(a.contextUrl).concat(c.userBaseURL,"/roles"),onNetworkStatusChange:y,variables:{pageSize:-1}});return(0,i.useEffect)((()=>{(0,c.retrieveAccountRoles)(t).then((e=>e.json())).then((({items:e})=>{const t=e.map((({displayName:e,name:t})=>({roleKey:t,roleName:e,roleType:"Account"})));d(t)}));const e=[];if(s){for(let t=0;t<s.name.length;t++){let n=s.notificationTypes[t];void 0===n&&(n=""),e.push({description:s.description[t],executionType:s.executionType[t],identifier:"".concat(Date.now(),"-").concat(t),name:s.name[t],notificationTypes:n,recipients:s.recipients[t],template:s.template[t],templateLanguage:s.templateLanguage[t]})}g(e)}}),[]),b.map((({identifier:t},n)=>i.default.createElement(l.default,_extends({},e,{accountRoles:f,identifier:t,index:n,key:"section-".concat(t),networkStatus:p,resource:O,sectionsLength:null==b?void 0:b.length,setSections:g}))))};t.default=_default}}));
//# sourceMappingURL=Notifications.js.map