jamespot-react-core 1.1.201 → 1.1.202

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[940],{940:(e,t,n)=>{n.r(t),n.d(t,{AIModal:()=>M,AddReportModal:()=>Z,Audience:()=>x,Avatar:()=>g,CommentsBloc:()=>Jl,DisplayForm:()=>$,Editor:()=>Ge,EditorsPortal:()=>ut,Empty:()=>Ql,JRCInputTinyMCEWithExt:()=>eo,JRCInputTinyMCEWithExtRaw:()=>no,MarkdownModal:()=>jn,ModalAudience:()=>ao,TwoColLayout:()=>mo,WidgetList:()=>Wt,WidgetWrapperCore:()=>Vl});var i=n(594),l=n.n(i),o=n(196),a=n.n(o),r=n(493),s=n(275),c=n(153),d=n(996),u=n(683);const m=d.j.getLazyComponent("Icon"),g=e=>{var t;const n=(0,o.useTheme)(),i=(0,u.GV)(c.Bx.selectors.selectNetworkPublic);return e.uri===(null==i?void 0:i.uri)?l().createElement(m,{name:"icon-fs-wall",size:8*(null!==(t=e.size)&&void 0!==t?t:3),color:n.color.primary,variant:"circle"}):l().createElement(s.JRCAvatar,Object.assign({},e))},p=d.j.getLazyComponent("FlexBox"),f=d.j.getLazyComponent("ModalContent"),E=d.j.getLazyComponent("ModalLayout"),h=d.j.getLazyComponent("StyledHref"),b=d.j.getLazyComponent("Tooltip"),v=d.j.getLazyComponent("Typography"),y=a().div`
1
+ "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[940],{940:(e,t,n)=>{n.r(t),n.d(t,{AIModal:()=>M,AddReportModal:()=>Z,Audience:()=>x,Avatar:()=>g,CommentsBloc:()=>Jl,DisplayForm:()=>$,Editor:()=>Ge,EditorsPortal:()=>ut,Empty:()=>Ql,JRCInputTinyMCEWithExt:()=>eo,JRCInputTinyMCEWithExtRaw:()=>no,MarkdownModal:()=>jn,ModalAudience:()=>ao,TwoColLayout:()=>mo,WidgetList:()=>Wt,WidgetWrapperCore:()=>Vl});var i=n(594),l=n.n(i),o=n(196),a=n.n(o),r=n(493),s=n(574),c=n(153),d=n(996),u=n(683);const m=d.j.getLazyComponent("Icon"),g=e=>{var t;const n=(0,o.useTheme)(),i=(0,u.GV)(c.Bx.selectors.selectNetworkPublic);return e.uri===(null==i?void 0:i.uri)?l().createElement(m,{name:"icon-fs-wall",size:8*(null!==(t=e.size)&&void 0!==t?t:3),color:n.color.primary,variant:"circle"}):l().createElement(s.JRCAvatar,Object.assign({},e))},p=d.j.getLazyComponent("FlexBox"),f=d.j.getLazyComponent("ModalContent"),E=d.j.getLazyComponent("ModalLayout"),h=d.j.getLazyComponent("StyledHref"),b=d.j.getLazyComponent("Tooltip"),v=d.j.getLazyComponent("Typography"),y=a().div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 12px;
@@ -30,7 +30,7 @@
30
30
  ${({stretch:e})=>e&&O}
31
31
  `,D=(0,i.forwardRef)(((e,t)=>e.onSubmit?l().createElement(G,{stretch:e.stretch,onSubmit:e.onSubmit,ref:t,"data-cy":e.dataCy},e.children):l().createElement(z,{stretch:e.stretch,ref:t,"data-cy":e.dataCy},e.children))),V=a().div`
32
32
  ${e=>e.stretch&&"\n flex: 1;\n"}
33
- `,$=(0,i.forwardRef)(((e,t)=>{var{onInit:n}=e,o=I(e,["onInit"]);const a=(0,i.useRef)(null),[r,s]=(0,A.SC)(o.fields,o.type,o.forceMandatory),[c,d]=(0,i.useState)(!1),u=(0,T.useForm)({defaultValues:Object.assign(Object.assign({},s),o.defaultValues),criteriaMode:"all"}),{handleSubmit:m,control:g,reset:p}=u,f=I(u,["handleSubmit","control","reset"]);(0,i.useEffect)((()=>{n&&!c&&(n(f),d(!0))}),[n,f,c]);const E=(0,i.useCallback)((e=>{const t={};return Object.keys(e).forEach((n=>{var i;const l=null===(i=r.find((e=>e.name===n)))||void 0===i?void 0:i.widget;switch(null==l?void 0:l.type){case"audience":t[n]=e[n].map((e=>e.uri)).join(",");break;case"taxonomy":t[n]=e[n].map((e=>e.title)).join(",");break;case"toggle":t[n]=e[n]?"1":"0";break;default:t[n]=e[n]}})),t}),[r]);return(0,i.useImperativeHandle)(t,(()=>Object.assign(Object.assign({},f),{handleSubmit:m,control:g,reset:()=>{var e;null===(e=null==a?void 0:a.current)||void 0===e||e.scrollTo(0,0),p()},getFormattedValues:()=>E(f.getValues())})),[]),l().createElement(D,{dataCy:o.dataCy,stretch:o.stretch,onSubmit:o.onSubmit?m(o.onSubmit):void 0,ref:a},l().createElement(V,{stretch:o.stretch},r.map((e=>{var{Input:t}=e,n=I(e,["Input"]);return l().createElement(t,Object.assign({key:n.name,control:g},n,{dataCy:`${o.dataCy}-${n.name}`,readOnly:o.readOnly}))})),o.extraInputs&&o.extraInputs(g)),o.buttons)}));var F=n(491),R=function(e,t,n,i){return new(n||(n=Promise))((function(l,o){function a(e){try{s(i.next(e))}catch(e){o(e)}}function r(e){try{s(i.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?l(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,r)}s((i=i.apply(e,t||[])).next())}))};const B=d.j.getLazyComponent("ModalForm"),H=d.j.getLazyComponent("Loader"),P=d.j.getLazyComponent("Icon"),U=d.j.getLazyComponent("Typography"),N=d.j.getLazyComponent("Ellipsis"),Y=d.j.getLazyComponent("StyledHref"),Q=a().div`
33
+ `,$=(0,i.forwardRef)(((e,t)=>{var{onInit:n}=e,o=I(e,["onInit"]);const a=(0,i.useRef)(null),[r,s]=(0,A.SC)(o.fields,o.type,o.forceMandatory),[c,d]=(0,i.useState)(!1),u=(0,T.useForm)({defaultValues:Object.assign(Object.assign({},s),o.defaultValues),criteriaMode:"all"}),{handleSubmit:m,control:g,reset:p}=u,f=I(u,["handleSubmit","control","reset"]);(0,i.useEffect)((()=>{n&&!c&&(n(f),d(!0))}),[n,f,c]);const E=(0,i.useCallback)((e=>{const t={};return Object.keys(e).forEach((n=>{var i;const l=null===(i=r.find((e=>e.name===n)))||void 0===i?void 0:i.widget;switch(null==l?void 0:l.type){case"audience":t[n]=e[n].map((e=>e.uri)).join(",");break;case"taxonomy":t[n]=e[n].map((e=>e.title)).join(",");break;case"toggle":t[n]=e[n]?"1":"0";break;default:t[n]=e[n]}})),t}),[r]);return(0,i.useImperativeHandle)(t,(()=>Object.assign(Object.assign({},f),{handleSubmit:m,control:g,reset:()=>{var e;null===(e=null==a?void 0:a.current)||void 0===e||e.scrollTo(0,0),p()},getFormattedValues:()=>E(f.getValues())})),[]),l().createElement(D,{dataCy:o.dataCy,stretch:o.stretch,onSubmit:o.onSubmit?m(o.onSubmit):void 0,ref:a},l().createElement(V,{stretch:o.stretch},r.map((e=>{var{Input:t}=e,n=I(e,["Input"]);return l().createElement(t,Object.assign({key:n.name,control:g},n,{dataCy:`${o.dataCy}-${n.name}`,readOnly:o.readOnly}))})),o.extraInputs&&o.extraInputs(g)),o.buttons)}));var F=n(491),R=function(e,t,n,i){return new(n||(n=Promise))((function(l,o){function a(e){try{s(i.next(e))}catch(e){o(e)}}function r(e){try{s(i.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?l(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,r)}s((i=i.apply(e,t||[])).next())}))};const B=d.j.getLazyComponent("ModalForm"),H=d.j.getLazyComponent("Loader"),U=d.j.getLazyComponent("Icon"),P=d.j.getLazyComponent("Typography"),N=d.j.getLazyComponent("Ellipsis"),Y=d.j.getLazyComponent("StyledHref"),Q=a().div`
34
34
  display: flex;
35
35
  flex-direction: column;
36
36
  gap: ${({theme:e})=>e.space.md}px;
@@ -46,7 +46,7 @@
46
46
  display: flex;
47
47
  flex-direction: column;
48
48
  gap: ${({theme:e})=>e.space.sm}px;
49
- `,Z=({onClose:e,articleId:t,articleUri:n,commentUri:o})=>{const a=(0,r.useIntl)(),s=(0,i.useRef)(null),d=(0,u.jL)(),[m,g]=l().useState(!0),[p,f]=(0,i.useState)(),[E,h]=(0,i.useState)(),[b,v]=(0,i.useState)(!0),[y,C]=(0,i.useState)(!1),x=(0,F.Ie)();(0,i.useEffect)((()=>{Promise.all([R(void 0,void 0,void 0,(function*(){const e=yield k().article.get({idArticle:t,format:"raw-list"},{signal:x.signal});f(e.result)})),R(void 0,void 0,void 0,(function*(){if(o){const e=yield k().article.getComments({idArticle:t},{format:"raw-list",signal:x.signal});h(e.result.find((e=>e.uri===o)))}}))]).then((()=>{v(!1)}))}),[x,t,o]);const w=(0,i.useCallback)((()=>{g(!1),e()}),[e]),L=(0,i.useCallback)((e=>{(null==e?void 0:e.trim())?(C(!0),k().contentReport.createReport({uri:o||n,description:e}).then((()=>{d(c.y8.actions.success({label:a.formatMessage({id:"CRPT_Report_Sent"})})),w()})).catch((e=>{var t;c.y8.actions.error({label:null!==(t=e.errorMsg)&&void 0!==t?t:"GLOBAL_Error"}),C(!1)}))):d(c.y8.actions.error({label:a.formatMessage({id:"CRPT_Report_Description_Required"})}))}),[n,w,o,d,a]),W=(0,i.useCallback)((({description:e})=>{L(e)}),[L]);return l().createElement(B,{title:a.formatMessage({id:"CRPT_Add_Report"}),open:m,closeHandler:w,onSubmit:()=>R(void 0,void 0,void 0,(function*(){var e;return L(null===(e=s.current)||void 0===e?void 0:e.getValues().description)})),enableClickAwayCloseModal:!0,maxHeight:"520px",buttons:[{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:w},{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Send"}),clickHandler:()=>{var e;return L(null===(e=s.current)||void 0===e?void 0:e.getValues().description)},color:"valid",loading:y}]},b?l().createElement(H,{size:"l"}):l().createElement(Q,null,l().createElement(X,null,l().createElement(P,{name:o?"icon-comment":"icon-file",size:50,variant:"square"}),l().createElement(K,null,l().createElement(U,{variant:o?"h3":"h2"},l().createElement(N,{label:null==p?void 0:p.title,length:40})),E&&l().createElement(U,null,a.formatMessage({id:"CRPT_Comment_Of"})," ",l().createElement(Y,{href:null==E?void 0:E._user._url},null==E?void 0:E._user.title)))),l().createElement($,{ref:s,fields:["description"],type:"contentReport",onSubmit:W})))};var ee=n(690),te=n(746);var ne=n(206),ie=n(743),le=n(704);const oe=(a().div`
49
+ `,Z=({onClose:e,articleId:t,articleUri:n,commentUri:o})=>{const a=(0,r.useIntl)(),s=(0,i.useRef)(null),d=(0,u.jL)(),[m,g]=l().useState(!0),[p,f]=(0,i.useState)(),[E,h]=(0,i.useState)(),[b,v]=(0,i.useState)(!0),[y,C]=(0,i.useState)(!1),x=(0,F.Ie)();(0,i.useEffect)((()=>{Promise.all([R(void 0,void 0,void 0,(function*(){const e=yield k().article.get({idArticle:t,format:"raw-list"},{signal:x.signal});f(e.result)})),R(void 0,void 0,void 0,(function*(){if(o){const e=yield k().article.getComments({idArticle:t},{format:"raw-list",signal:x.signal});h(e.result.find((e=>e.uri===o)))}}))]).then((()=>{v(!1)}))}),[x,t,o]);const w=(0,i.useCallback)((()=>{g(!1),e()}),[e]),L=(0,i.useCallback)((e=>{(null==e?void 0:e.trim())?(C(!0),k().contentReport.createReport({uri:o||n,description:e}).then((()=>{d(c.y8.actions.success({label:a.formatMessage({id:"CRPT_Report_Sent"})})),w()})).catch((e=>{var t;c.y8.actions.error({label:null!==(t=e.errorMsg)&&void 0!==t?t:"GLOBAL_Error"}),C(!1)}))):d(c.y8.actions.error({label:a.formatMessage({id:"CRPT_Report_Description_Required"})}))}),[n,w,o,d,a]),W=(0,i.useCallback)((({description:e})=>{L(e)}),[L]);return l().createElement(B,{title:a.formatMessage({id:"CRPT_Add_Report"}),open:m,closeHandler:w,onSubmit:()=>R(void 0,void 0,void 0,(function*(){var e;return L(null===(e=s.current)||void 0===e?void 0:e.getValues().description)})),enableClickAwayCloseModal:!0,maxHeight:"520px",buttons:[{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:w},{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Send"}),clickHandler:()=>{var e;return L(null===(e=s.current)||void 0===e?void 0:e.getValues().description)},color:"valid",loading:y}]},b?l().createElement(H,{size:"l"}):l().createElement(Q,null,l().createElement(X,null,l().createElement(U,{name:o?"icon-comment":"icon-file",size:50,variant:"square"}),l().createElement(K,null,l().createElement(P,{variant:o?"h3":"h2"},l().createElement(N,{label:null==p?void 0:p.title,length:40})),E&&l().createElement(P,null,a.formatMessage({id:"CRPT_Comment_Of"})," ",l().createElement(Y,{href:null==E?void 0:E._user._url},null==E?void 0:E._user.title)))),l().createElement($,{ref:s,fields:["description"],type:"contentReport",onSubmit:W})))};var ee=n(690),te=n(746);var ne=n(206),ie=n(743),le=n(704);const oe=(a().div`
50
50
  margin-bottom: 24px;
51
51
  `,a().div`
52
52
  margin-bottom: 4px;
@@ -185,7 +185,7 @@
185
185
  `,Re=a().fieldset`
186
186
  margin: 12px 0px !important;
187
187
  width: 100% !important;
188
- `,Be=({label:e,initialValue:t,handleChange:n})=>{const i=(0,o.useTheme)(),a=[{name:(0,r.useIntl)().formatMessage({id:"GLOBAL_Platform_Color"}),colors:[i.color.primary,i.color.secondary,i.color.headerColor,i.color.lavender,i.color.orange,i.color.green,i.color.navy,i.color.overseas]}];return l().createElement(Re,null,l().createElement(Fe,null,l().createElement(r.FormattedMessage,{id:e})),l().createElement($e,{palettes:a,label:e,initialValue:null!=t?t:i.color.primary,name:"background-color",onChange:n}))},He=d.j.getLazyComponent("InputNumber"),Pe=({label:e,initialValue:t,handleChange:n})=>{const i=(0,r.useIntl)(),{control:o,watch:a}=(0,T.useForm)({defaultValues:{value:null!=t?t:"0"},criteriaMode:"all"});return l().useEffect((()=>{const e=a((e=>{var t;n(null!==(t=e.value)&&void 0!==t?t:"")}));return()=>e.unsubscribe()}),[a,n]),l().createElement(He,{label:e,name:"value",width:"100%",control:o,placeholder:i.formatMessage({id:e})})},Ue=d.j.getLazyComponent("InputSelectExtended"),Ne=({label:e,options:t=[],initialValue:n,required:o=!1,handleChange:a})=>{const r=(0,i.useMemo)((()=>n&&t.find((e=>e.value===n))?t.find((e=>e.value===n)):t[0]),[n,t]),{control:s,watch:c}=(0,T.useForm)({defaultValues:{select:r},criteriaMode:"all"});return l().useEffect((()=>{const e=c((e=>{a(e.select.value)}));return()=>e.unsubscribe()}),[c,a]),l().createElement(Ue,{options:t,label:e,getValue:e=>e.value,getLabel:"label",getSearch:"label",rules:{required:o},hideDeleteIcon:!0,required:o,control:s,name:"select"})},Ye=d.j.getLazyComponent("InputText"),Je=({uniqid:e})=>{var t;const n=(0,r.useIntl)(),a=(0,u.jL)(),s=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e))),d=(0,o.useTheme)(),m=(0,u.GV)((t=>c.x0.selectors.selectWidgetTitleStyle(t,e)),le.shallowEqual),{control:g,watch:p}=(0,T.useForm)({defaultValues:{text:null!==(t=null==s?void 0:s.title.replace(/&/g,"&"))&&void 0!==t?t:""},criteriaMode:"all"});(0,i.useEffect)((()=>{const t=p((t=>{a(c.x0.slice.actions.updateWidgetWrapper({uniqid:e,title:t.text}))}));return()=>t.unsubscribe()}),[p,e,a]);const f=(0,i.useMemo)((()=>({color:m&&m.color?String(m.color):d.color.black,backgroundColor:m&&m["background-color"]?String(m["background-color"]):"transparent",fontSize:m&&m["font-size"]?String(m["font-size"]):"24",fontWeight:m&&m["font-weight"]?String(m["font-weight"]):"medium",textAlign:m&&m["text-align"]?String(m["text-align"]):"left"})),[m,d]),E=(0,i.useCallback)(((t,n)=>{a(c.x0.slice.actions.setWidgetTitleStyle({uniqid:e,styles:{[t]:n}}))}),[a,e]);return s?l().createElement(l().Fragment,null,l().createElement(Ye,{name:"text",label:"WIDGET_Title",width:"100%",control:g,placeholder:n.formatMessage({id:"WIDGET_Title"})}),l().createElement(Be,{label:"STYLE_Text_Color",initialValue:f.color,handleChange:e=>E("color",e)}),l().createElement(Be,{label:"STYLE_Background_Color",initialValue:f.backgroundColor,handleChange:e=>E("background-color",e)}),l().createElement(Pe,{label:"STYLE_Text_Size",initialValue:f.fontSize,handleChange:e=>E("font-size",e)}),l().createElement(Ne,{label:"STYLE_Font_Weight",initialValue:f.fontWeight,options:[{label:n.formatMessage({id:"STYLE_Font_Weight_Normal"}),value:"normal"},{label:n.formatMessage({id:"STYLE_Font_Weight_Medium"}),value:"medium"},{label:n.formatMessage({id:"STYLE_Font_Weight_Bold"}),value:"bold"}],required:!1,handleChange:e=>E("font-weight",e)}),l().createElement(Ne,{label:"STYLE_Text_Align",initialValue:f.textAlign,options:[{label:n.formatMessage({id:"STYLE_Text_Align_Left"}),value:"left"},{label:n.formatMessage({id:"STYLE_Text_Align_Center"}),value:"center"},{label:n.formatMessage({id:"STYLE_Text_Align_Justify"}),value:"justify"},{label:n.formatMessage({id:"STYLE_Text_Align_Right"}),value:"right"}],required:!1,handleChange:e=>E("text-align",e)})):l().createElement(l().Fragment,null)},Qe=d.j.getLazyComponent("Loader"),Xe=({uniqid:e})=>{var t;const n=null===(t=(0,u.GV)((t=>c.x0.selectors.selectWidgetState(t,e)),le.shallowEqual))||void 0===t?void 0:t.busy;return l().createElement(l().Fragment,null,n&&l().createElement(ge,null,l().createElement(Qe,{size:"l"})))},Ke=({uniqid:e})=>{var t;const n=(0,r.useIntl)();return(null===(t=(0,u.GV)((t=>c.x0.selectors.selectWidgetState(t,e)),le.shallowEqual))||void 0===t?void 0:t.locked)?l().createElement(pe,null,n.formatMessage({id:"INTRANET_Panel_Change_Off"})):l().createElement(l().Fragment,null)},Ze=d.j.getLazyComponent("Button"),et=({uniqid:e,mode:t})=>{const n=(0,r.useIntl)(),i=(0,u.jL)(),o=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e)),le.shallowEqual),a=(0,u.GV)((t=>c.x0.selectors.selectWidgetObjectUri(t,e)),le.shallowEqual);return l().createElement(Ze,{color:"valid",onClick:()=>{i(c.cr.slice.actions.flushEditor({uniqid:e}));const l=o&&o.widget&&o.widget.content;a&&o&&l&&("view"==t&&k().widget.updateWidget({uri:a,uniqid:e,title:o.title,content:l,v2:!0}).catch((e=>{var t;i(c.y8.actions.error({label:null!==(t=e.errorMsg)&&void 0!==t?t:n.formatMessage({id:"GLOBAL_Error"})}))})),"edit"===t&&i(c.x0.slice.actions.updateWidget({uniqid:e,content:l})))}},n.formatMessage({id:"GLOBAL_Save"}))},tt=({uniqid:e})=>{const t=(0,o.useTheme)(),n=(0,u.jL)(),a=(0,r.useIntl)(),s=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),le.shallowEqual),d=(0,i.useMemo)((()=>({color:s&&s.color?String(s.color):t.color.black,backgroundColor:s&&s["background-color"]?String(s["background-color"]):t.color.white,padding:s&&s.padding?String(s.padding):"0",borderRadius:s&&s["border-radius"]?String(s["border-radius"]):"0",borderColor:s["border-color"]?String(s["border-color"]):t.color.black,borderWidth:s["border-width"]?String(s["border-width"]):"0",borderStyle:s["border-style"]?String(s["border-style"]):"none"})),[s,t]),m=(0,i.useCallback)(((t,i)=>{n(c.x0.slice.actions.setWidgetWrapperStyle({uniqid:e,styles:{[t]:i}}))}),[e,n]);return l().createElement(l().Fragment,null,l().createElement(Be,{label:"STYLE_Background_Color",initialValue:d.backgroundColor,handleChange:e=>m("background-color",e)}),l().createElement(Be,{label:"STYLE_Text_Color",initialValue:d.color,handleChange:e=>m("color",e)}),l().createElement("hr",null),l().createElement(Pe,{label:"STYLE_Padding",initialValue:d.padding,handleChange:e=>m("padding",String(e))}),l().createElement(Pe,{label:"STYLE_Radius",initialValue:d.borderRadius,handleChange:e=>m("border-radius",String(e))}),l().createElement(Ne,{label:"STYLE_Border_Style",initialValue:d.borderStyle,options:[{label:a.formatMessage({id:"STYLE_Border_Style_None"}),value:"none"},{label:a.formatMessage({id:"STYLE_Border_Style_Solid"}),value:"solid"},{label:a.formatMessage({id:"STYLE_Border_Style_Dashed"}),value:"dashed"},{label:a.formatMessage({id:"STYLE_Border_Style_Dotted"}),value:"dotted"}],required:!1,handleChange:e=>{m("border-style",e),"none"!==e&&m("border-color",t.color.black),"none"!==e&&m("border-width","1")}}),"string"==typeof d.borderStyle&&"none"!==d.borderStyle&&l().createElement(Be,{label:"STYLE_Border_Color",initialValue:d.borderColor,handleChange:e=>m("border-color",e)}),"string"==typeof d.borderStyle&&"none"!==d.borderStyle&&l().createElement(Pe,{label:"STYLE_Border_Width",initialValue:d.borderWidth,handleChange:e=>m("border-width",e)}))},nt=({uniqid:e})=>{const t=(0,u.jL)(),n=(0,r.useIntl)(),o=(0,u.GV)((t=>c.cr.selectors.selectEditor(t,e)),le.shallowEqual),a=c.x0.definition(null==o?void 0:o.name),s=(0,u.GV)((t=>c.x0.selectors.selectWidgetLevel(t,e)),le.shallowEqual),d=(0,i.useCallback)((n=>{t(c.x0.slice.actions.updateWidgetWrapper({uniqid:e,level:Number(n)}))}),[e,t]);return l().createElement(Ne,{handleChange:d,required:!0,label:"WIDGET_Display_Level_Select",initialValue:s?String(s):"3",options:[{label:n.formatMessage({id:"WIDGET_Display_Level_1"}),value:"1"},{label:n.formatMessage({id:"WIDGET_Display_Level_2"}),value:"2"},{label:n.formatMessage({id:"WIDGET_Display_Level_3"}),value:"3"},{label:n.formatMessage({id:"WIDGET_Display_Level_4"}),value:"4"}].filter((e=>Array.isArray(a.displayLevel)?a.displayLevel.includes(Number(e.value)):[]))})},it=["widget-presence","widget-quick-survey","widget-check-list","widget-emails-imap","widget-contact-cardDav","widget-calendar-calDav"],lt=d.j.getLazyComponent("Icon"),ot=d.j.getLazyComponent("Tooltip"),at=({uniqid:e,position:t})=>{const n=(0,r.useIntl)(),a=(0,u.jL)(),s=(0,o.useTheme)(),d=(0,i.useRef)(null),m=(0,u.GV)((t=>c.cr.selectors.selectEditor(t,e)),le.shallowEqual),g=c.x0.definition(null==m?void 0:m.name),p=(0,i.useMemo)((()=>void 0!==g.displayLevel&&Array.isArray(g.displayLevel)&&0!==g.displayLevel.length),[g]),f=(0,i.useMemo)((()=>[{name:"widget-title",label:n.formatMessage({id:"PANEL_Title"}),enable:g.panel.useWrapper,icon:"icon-font"},{name:"widget-selection",label:n.formatMessage({id:"PANEL_Widget_Selection"}),enable:g.panel.useSelection,icon:"icon-sliders"},{name:"widget-settings",label:n.formatMessage({id:"PANEL_Widget_Settings"}),enable:g.panel.useEditor,icon:"icon-pen"},{name:"widget-level",label:n.formatMessage({id:"PANEL_Widget_Level"}),enable:p,icon:"icon-edit"}]),[g,n,p]),E=(0,i.useMemo)((()=>g.panel.useEditor?f.find((e=>"widget-settings"===e.name)):f.filter((e=>e.enable))[0]),[g,f]),[h,b]=(0,i.useState)(E);return(0,i.useEffect)((()=>{setTimeout((()=>{d&&d.current&&(d.current.className=d.current.className+" animate")}),0)}),[]),m?l().createElement(ce,null,l().createElement(de,{ref:d,position:t},l().createElement(fe,null,f.filter((e=>e.enable)).map((e=>l().createElement(Ee,{key:e.name,isActive:h&&h.name===e.name,onClick:()=>b(e)},l().createElement(ot,{position:"left",description:e.label},l().createElement(lt,{name:e.icon,color:h&&h.name===e.name?s.color.white:s.color.lavender})))))),l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",width:"390px"}},l().createElement(ae,null,l().createElement(Ve,{uniqid:e,position:m.position}),l().createElement(se,null,l().createElement("h3",null,h?h.label:n.formatMessage({id:g.label}))),l().createElement(re,null,l().createElement(Ee,{onClick:()=>{a(c.cr.slice.actions.flushEditor({uniqid:e}))}},l().createElement(lt,{name:"icon-times",color:s.color.lavender,size:26.75})))),l().createElement(ue,null,l().createElement(me,null,h&&"widget-settings"===h.name&&g.panel.useEditor&&l().createElement(Ge,{uniqid:m.uniqid}),h&&"widget-title"===h.name&&g.panel.useWrapper&&l().createElement(Je,{uniqid:m.uniqid}),h&&"widget-selection"===h.name&&l().createElement(tt,{uniqid:e}),h&&"widget-level"===h.name&&p&&l().createElement(nt,{uniqid:e})),l().createElement(Xe,{uniqid:e}),l().createElement(Ke,{uniqid:e}),it.includes(m.name)&&l().createElement(et,{uniqid:e,mode:m.mode})))),(null==m?void 0:m.popup)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"#000",opacity:".7"}}):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null)},rt=a().div`
188
+ `,Be=({label:e,initialValue:t,handleChange:n})=>{const i=(0,o.useTheme)(),a=[{name:(0,r.useIntl)().formatMessage({id:"GLOBAL_Platform_Color"}),colors:[i.color.primary,i.color.secondary,i.color.headerColor,i.color.lavender,i.color.orange,i.color.green,i.color.navy,i.color.overseas]}];return l().createElement(Re,null,l().createElement(Fe,null,l().createElement(r.FormattedMessage,{id:e})),l().createElement($e,{palettes:a,label:e,initialValue:null!=t?t:i.color.primary,name:"background-color",onChange:n}))},He=d.j.getLazyComponent("InputNumber"),Ue=({label:e,initialValue:t,handleChange:n})=>{const i=(0,r.useIntl)(),{control:o,watch:a}=(0,T.useForm)({defaultValues:{value:null!=t?t:"0"},criteriaMode:"all"});return l().useEffect((()=>{const e=a((e=>{var t;n(null!==(t=e.value)&&void 0!==t?t:"")}));return()=>e.unsubscribe()}),[a,n]),l().createElement(He,{label:e,name:"value",width:"100%",control:o,placeholder:i.formatMessage({id:e})})},Pe=d.j.getLazyComponent("InputSelectExtended"),Ne=({label:e,options:t=[],initialValue:n,required:o=!1,handleChange:a})=>{const r=(0,i.useMemo)((()=>n&&t.find((e=>e.value===n))?t.find((e=>e.value===n)):t[0]),[n,t]),{control:s,watch:c}=(0,T.useForm)({defaultValues:{select:r},criteriaMode:"all"});return l().useEffect((()=>{const e=c((e=>{a(e.select.value)}));return()=>e.unsubscribe()}),[c,a]),l().createElement(Pe,{options:t,label:e,getValue:e=>e.value,getLabel:"label",getSearch:"label",rules:{required:o},hideDeleteIcon:!0,required:o,control:s,name:"select"})},Ye=d.j.getLazyComponent("InputText"),Je=({uniqid:e})=>{var t;const n=(0,r.useIntl)(),a=(0,u.jL)(),s=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e))),d=(0,o.useTheme)(),m=(0,u.GV)((t=>c.x0.selectors.selectWidgetTitleStyle(t,e)),le.shallowEqual),{control:g,watch:p}=(0,T.useForm)({defaultValues:{text:null!==(t=null==s?void 0:s.title.replace(/&/g,"&"))&&void 0!==t?t:""},criteriaMode:"all"});(0,i.useEffect)((()=>{const t=p((t=>{a(c.x0.slice.actions.updateWidgetWrapper({uniqid:e,title:t.text}))}));return()=>t.unsubscribe()}),[p,e,a]);const f=(0,i.useMemo)((()=>({color:m&&m.color?String(m.color):d.color.black,backgroundColor:m&&m["background-color"]?String(m["background-color"]):"transparent",fontSize:m&&m["font-size"]?String(m["font-size"]):"24",fontWeight:m&&m["font-weight"]?String(m["font-weight"]):"medium",textAlign:m&&m["text-align"]?String(m["text-align"]):"left"})),[m,d]),E=(0,i.useCallback)(((t,n)=>{a(c.x0.slice.actions.setWidgetTitleStyle({uniqid:e,styles:{[t]:n}}))}),[a,e]);return s?l().createElement(l().Fragment,null,l().createElement(Ye,{name:"text",label:"WIDGET_Title",width:"100%",control:g,placeholder:n.formatMessage({id:"WIDGET_Title"})}),l().createElement(Be,{label:"STYLE_Text_Color",initialValue:f.color,handleChange:e=>E("color",e)}),l().createElement(Be,{label:"STYLE_Background_Color",initialValue:f.backgroundColor,handleChange:e=>E("background-color",e)}),l().createElement(Ue,{label:"STYLE_Text_Size",initialValue:f.fontSize,handleChange:e=>E("font-size",e)}),l().createElement(Ne,{label:"STYLE_Font_Weight",initialValue:f.fontWeight,options:[{label:n.formatMessage({id:"STYLE_Font_Weight_Normal"}),value:"normal"},{label:n.formatMessage({id:"STYLE_Font_Weight_Medium"}),value:"medium"},{label:n.formatMessage({id:"STYLE_Font_Weight_Bold"}),value:"bold"}],required:!1,handleChange:e=>E("font-weight",e)}),l().createElement(Ne,{label:"STYLE_Text_Align",initialValue:f.textAlign,options:[{label:n.formatMessage({id:"STYLE_Text_Align_Left"}),value:"left"},{label:n.formatMessage({id:"STYLE_Text_Align_Center"}),value:"center"},{label:n.formatMessage({id:"STYLE_Text_Align_Justify"}),value:"justify"},{label:n.formatMessage({id:"STYLE_Text_Align_Right"}),value:"right"}],required:!1,handleChange:e=>E("text-align",e)})):l().createElement(l().Fragment,null)},Qe=d.j.getLazyComponent("Loader"),Xe=({uniqid:e})=>{var t;const n=null===(t=(0,u.GV)((t=>c.x0.selectors.selectWidgetState(t,e)),le.shallowEqual))||void 0===t?void 0:t.busy;return l().createElement(l().Fragment,null,n&&l().createElement(ge,null,l().createElement(Qe,{size:"l"})))},Ke=({uniqid:e})=>{var t;const n=(0,r.useIntl)();return(null===(t=(0,u.GV)((t=>c.x0.selectors.selectWidgetState(t,e)),le.shallowEqual))||void 0===t?void 0:t.locked)?l().createElement(pe,null,n.formatMessage({id:"INTRANET_Panel_Change_Off"})):l().createElement(l().Fragment,null)},Ze=d.j.getLazyComponent("Button"),et=({uniqid:e,mode:t})=>{const n=(0,r.useIntl)(),i=(0,u.jL)(),o=(0,u.GV)((t=>c.x0.selectors.selectWidget(t,e)),le.shallowEqual),a=(0,u.GV)((t=>c.x0.selectors.selectWidgetObjectUri(t,e)),le.shallowEqual);return l().createElement(Ze,{color:"valid",onClick:()=>{i(c.cr.slice.actions.flushEditor({uniqid:e}));const l=o&&o.widget&&o.widget.content;a&&o&&l&&("view"==t&&k().widget.updateWidget({uri:a,uniqid:e,title:o.title,content:l,v2:!0}).catch((e=>{var t;i(c.y8.actions.error({label:null!==(t=e.errorMsg)&&void 0!==t?t:n.formatMessage({id:"GLOBAL_Error"})}))})),"edit"===t&&i(c.x0.slice.actions.updateWidget({uniqid:e,content:l})))}},n.formatMessage({id:"GLOBAL_Save"}))},tt=({uniqid:e})=>{const t=(0,o.useTheme)(),n=(0,u.jL)(),a=(0,r.useIntl)(),s=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),le.shallowEqual),d=(0,i.useMemo)((()=>({color:s&&s.color?String(s.color):t.color.black,backgroundColor:s&&s["background-color"]?String(s["background-color"]):t.color.white,padding:s&&s.padding?String(s.padding):"0",borderRadius:s&&s["border-radius"]?String(s["border-radius"]):"0",borderColor:s["border-color"]?String(s["border-color"]):t.color.black,borderWidth:s["border-width"]?String(s["border-width"]):"0",borderStyle:s["border-style"]?String(s["border-style"]):"none"})),[s,t]),m=(0,i.useCallback)(((t,i)=>{n(c.x0.slice.actions.setWidgetWrapperStyle({uniqid:e,styles:{[t]:i}}))}),[e,n]);return l().createElement(l().Fragment,null,l().createElement(Be,{label:"STYLE_Background_Color",initialValue:d.backgroundColor,handleChange:e=>m("background-color",e)}),l().createElement(Be,{label:"STYLE_Text_Color",initialValue:d.color,handleChange:e=>m("color",e)}),l().createElement("hr",null),l().createElement(Ue,{label:"STYLE_Padding",initialValue:d.padding,handleChange:e=>m("padding",String(e))}),l().createElement(Ue,{label:"STYLE_Radius",initialValue:d.borderRadius,handleChange:e=>m("border-radius",String(e))}),l().createElement(Ne,{label:"STYLE_Border_Style",initialValue:d.borderStyle,options:[{label:a.formatMessage({id:"STYLE_Border_Style_None"}),value:"none"},{label:a.formatMessage({id:"STYLE_Border_Style_Solid"}),value:"solid"},{label:a.formatMessage({id:"STYLE_Border_Style_Dashed"}),value:"dashed"},{label:a.formatMessage({id:"STYLE_Border_Style_Dotted"}),value:"dotted"}],required:!1,handleChange:e=>{m("border-style",e),"none"!==e&&m("border-color",t.color.black),"none"!==e&&m("border-width","1")}}),"string"==typeof d.borderStyle&&"none"!==d.borderStyle&&l().createElement(Be,{label:"STYLE_Border_Color",initialValue:d.borderColor,handleChange:e=>m("border-color",e)}),"string"==typeof d.borderStyle&&"none"!==d.borderStyle&&l().createElement(Ue,{label:"STYLE_Border_Width",initialValue:d.borderWidth,handleChange:e=>m("border-width",e)}))},nt=({uniqid:e})=>{const t=(0,u.jL)(),n=(0,r.useIntl)(),o=(0,u.GV)((t=>c.cr.selectors.selectEditor(t,e)),le.shallowEqual),a=c.x0.definition(null==o?void 0:o.name),s=(0,u.GV)((t=>c.x0.selectors.selectWidgetLevel(t,e)),le.shallowEqual),d=(0,i.useCallback)((n=>{t(c.x0.slice.actions.updateWidgetWrapper({uniqid:e,level:Number(n)}))}),[e,t]);return l().createElement(Ne,{handleChange:d,required:!0,label:"WIDGET_Display_Level_Select",initialValue:s?String(s):"3",options:[{label:n.formatMessage({id:"WIDGET_Display_Level_1"}),value:"1"},{label:n.formatMessage({id:"WIDGET_Display_Level_2"}),value:"2"},{label:n.formatMessage({id:"WIDGET_Display_Level_3"}),value:"3"},{label:n.formatMessage({id:"WIDGET_Display_Level_4"}),value:"4"}].filter((e=>Array.isArray(a.displayLevel)?a.displayLevel.includes(Number(e.value)):[]))})},it=["widget-presence","widget-quick-survey","widget-check-list","widget-emails-imap","widget-contact-cardDav","widget-calendar-calDav"],lt=d.j.getLazyComponent("Icon"),ot=d.j.getLazyComponent("Tooltip"),at=({uniqid:e,position:t})=>{const n=(0,r.useIntl)(),a=(0,u.jL)(),s=(0,o.useTheme)(),d=(0,i.useRef)(null),m=(0,u.GV)((t=>c.cr.selectors.selectEditor(t,e)),le.shallowEqual),g=c.x0.definition(null==m?void 0:m.name),p=(0,i.useMemo)((()=>void 0!==g.displayLevel&&Array.isArray(g.displayLevel)&&0!==g.displayLevel.length),[g]),f=(0,i.useMemo)((()=>[{name:"widget-title",label:n.formatMessage({id:"PANEL_Title"}),enable:g.panel.useWrapper,icon:"icon-font"},{name:"widget-selection",label:n.formatMessage({id:"PANEL_Widget_Selection"}),enable:g.panel.useSelection,icon:"icon-sliders"},{name:"widget-settings",label:n.formatMessage({id:"PANEL_Widget_Settings"}),enable:g.panel.useEditor,icon:"icon-pen"},{name:"widget-level",label:n.formatMessage({id:"PANEL_Widget_Level"}),enable:p,icon:"icon-edit"}]),[g,n,p]),E=(0,i.useMemo)((()=>g.panel.useEditor?f.find((e=>"widget-settings"===e.name)):f.filter((e=>e.enable))[0]),[g,f]),[h,b]=(0,i.useState)(E);return(0,i.useEffect)((()=>{setTimeout((()=>{d&&d.current&&(d.current.className=d.current.className+" animate")}),0)}),[]),m?l().createElement(ce,null,l().createElement(de,{ref:d,position:t},l().createElement(fe,null,f.filter((e=>e.enable)).map((e=>l().createElement(Ee,{key:e.name,isActive:h&&h.name===e.name,onClick:()=>b(e)},l().createElement(ot,{position:"left",description:e.label},l().createElement(lt,{name:e.icon,color:h&&h.name===e.name?s.color.white:s.color.lavender})))))),l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",width:"390px"}},l().createElement(ae,null,l().createElement(Ve,{uniqid:e,position:m.position}),l().createElement(se,null,l().createElement("h3",null,h?h.label:n.formatMessage({id:g.label}))),l().createElement(re,null,l().createElement(Ee,{onClick:()=>{a(c.cr.slice.actions.flushEditor({uniqid:e}))}},l().createElement(lt,{name:"icon-times",color:s.color.lavender,size:26.75})))),l().createElement(ue,null,l().createElement(me,null,h&&"widget-settings"===h.name&&g.panel.useEditor&&l().createElement(Ge,{uniqid:m.uniqid}),h&&"widget-title"===h.name&&g.panel.useWrapper&&l().createElement(Je,{uniqid:m.uniqid}),h&&"widget-selection"===h.name&&l().createElement(tt,{uniqid:e}),h&&"widget-level"===h.name&&p&&l().createElement(nt,{uniqid:e})),l().createElement(Xe,{uniqid:e}),l().createElement(Ke,{uniqid:e}),it.includes(m.name)&&l().createElement(et,{uniqid:e,mode:m.mode})))),(null==m?void 0:m.popup)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"#000",opacity:".7"}}):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null)},rt=a().div`
189
189
  position: absolute;
190
190
  inset: 0;
191
191
  pointer-events: none;
@@ -307,9 +307,9 @@
307
307
  flex: 1;
308
308
  justify-content: center;
309
309
  align-items: center;
310
- `,Bt=({widget:e,mode:t})=>{const n=(0,u.jL)(),{uniqid:o}=e,{text:a,url:r,target:s,color:d,backgroundColor:m,buttonSize:g,borderRadius:p,variant:f}=e.content;return(0,i.useEffect)((()=>{n(c.x0.slice.actions.setWidgetState({uniqid:o,empty:!a||0===a.length}))}),[a]),l().createElement(Ft,{onClick:()=>{"edit"===t&&n(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}},l().createElement(Rt,{clickable:"edit"!==t},l().createElement($t,{text:a,url:r,target:s,color:d,backgroundColor:m,buttonSize:g,borderRadius:p,variant:f})))},Ht=d.j.getLazyComponent("WidgetArticleGallery"),Pt=d.j.getLazyComponent("WidgetEmptyInplace"),Ut=d.j.getLazyComponent("FileViewer"),Nt=a().button`
310
+ `,Bt=({widget:e,mode:t})=>{const n=(0,u.jL)(),{uniqid:o}=e,{text:a,url:r,target:s,color:d,backgroundColor:m,buttonSize:g,borderRadius:p,variant:f}=e.content;return(0,i.useEffect)((()=>{n(c.x0.slice.actions.setWidgetState({uniqid:o,empty:!a||0===a.length}))}),[a]),l().createElement(Ft,{onClick:()=>{"edit"===t&&n(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}},l().createElement(Rt,{clickable:"edit"!==t},l().createElement($t,{text:a,url:r,target:s,color:d,backgroundColor:m,buttonSize:g,borderRadius:p,variant:f})))},Ht=d.j.getLazyComponent("WidgetArticleGallery"),Ut=d.j.getLazyComponent("WidgetEmptyInplace"),Pt=d.j.getLazyComponent("FileViewer"),Nt=a().button`
311
311
  cursor: pointer;
312
- `,Yt=({widget:e,inplace:t,mode:n})=>{var o,a;const{uniqid:r}=e,{files:s}=e.content,d=(0,u.jL)(),m=(0,u.GV)((e=>c.x0.selectors.isActive(e,r)),le.shallowEqual);return(0,i.useEffect)((()=>{d(c.x0.slice.actions.setWidgetState({uniqid:r,mounted:!0}))}),[]),void 0!==s?l().createElement(l().Fragment,null,"edit"===n?l().createElement(Ht,{files:s,maxWidth:800,gap:null!==(o=e.content.gap)&&void 0!==o?o:"10",column:null!==(a=e.content.column)&&void 0!==a?a:"3",onClick:()=>{}}):l().createElement(Ut,{files:s,openWithOptions:[]},(t=>{var n,i;return l().createElement(Nt,null,l().createElement(Ht,{files:s,maxWidth:600,gap:null!==(n=e.content.gap)&&void 0!==n?n:"10",column:null!==(i=e.content.column)&&void 0!==i?i:"3",onClick:e=>t(e)}))})),t&&"edit"===n?l().createElement(It,{initialFiles:s,initialClick:m,accept:"image/png, image/jpeg, image/jpg",multiple:!0,onUploadSuccess:e=>{Array.isArray(e)&&d((0,c.vR)(r,{files:e}))},onUploadStart:()=>{d(c.x0.slice.actions.setWidgetState({uniqid:r,loading:!0}))},onUploadEnd:()=>{d(c.x0.slice.actions.setWidgetState({uniqid:r,loading:!1}))}},l().createElement(Pt,{label:"WIDGET_Article_Gallery_Empty_Label",description:"WIDGET_Article_Gallery_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}})):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null)},Jt=a().div`
312
+ `,Yt=({widget:e,inplace:t,mode:n})=>{var o,a;const{uniqid:r}=e,{files:s}=e.content,d=(0,u.jL)(),m=(0,u.GV)((e=>c.x0.selectors.isActive(e,r)),le.shallowEqual);return(0,i.useEffect)((()=>{d(c.x0.slice.actions.setWidgetState({uniqid:r,mounted:!0}))}),[]),void 0!==s?l().createElement(l().Fragment,null,"edit"===n?l().createElement(Ht,{files:s,maxWidth:800,gap:null!==(o=e.content.gap)&&void 0!==o?o:"10",column:null!==(a=e.content.column)&&void 0!==a?a:"3",onClick:()=>{}}):l().createElement(Pt,{files:s,openWithOptions:[]},(t=>{var n,i;return l().createElement(Nt,null,l().createElement(Ht,{files:s,maxWidth:600,gap:null!==(n=e.content.gap)&&void 0!==n?n:"10",column:null!==(i=e.content.column)&&void 0!==i?i:"3",onClick:e=>t(e)}))})),t&&"edit"===n?l().createElement(It,{initialFiles:s,initialClick:m,accept:"image/png, image/jpeg, image/jpg",multiple:!0,onUploadSuccess:e=>{Array.isArray(e)&&d((0,c.vR)(r,{files:e}))},onUploadStart:()=>{d(c.x0.slice.actions.setWidgetState({uniqid:r,loading:!0}))},onUploadEnd:()=>{d(c.x0.slice.actions.setWidgetState({uniqid:r,loading:!1}))}},l().createElement(Ut,{label:"WIDGET_Article_Gallery_Empty_Label",description:"WIDGET_Article_Gallery_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}})):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null)},Jt=a().div`
313
313
  display: flex;
314
314
  flex-direction: column;
315
315
  `,Qt=({uniqid:e,children:t})=>{const n=(0,u.GV)((t=>c.x0.selectors.selectWidgetWrapperStyle(t,e)),le.shallowEqual),o=(0,i.useMemo)((()=>({padding:n&&n.padding?`${n.padding}px`:"0px"})),[n]);return l().createElement(Jt,{style:{padding:o.padding}},t)},Xt=a().div`
@@ -417,7 +417,7 @@
417
417
  padding: ${e=>e.theme.space.md}px;
418
418
  display: flex;
419
419
  flex-direction: row-reverse;
420
- `),Pn=({id:e,type:t,uniqid:n})=>{const o=(0,u.jL)(),a=(0,r.useIntl)(),[d,m]=(0,i.useState)(!1);return l().createElement(l().Fragment,null,l().createElement(s.JRCIconButton,{iconSize:14,onClick:()=>m(!0),icon:"icon-trash"}),d&&l().createElement(Rn,{enableClickAwayCloseModal:!0,open:d,closeHandler:()=>m(!1)},l().createElement(Bn,{overflow:"scroll",title:a.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>m(!1)},a.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})),l().createElement(Hn,null,l().createElement(Fn,{label:a.formatMessage({id:"GLOBAL_Confirm"}),onClick:()=>{k().widget.removeWidget({id:e,type:t,uniqid:n}).then((()=>{o(c.x0.slice.actions.flushWidget({uniqid:n}))})).catch((()=>o(c.y8.actions.error({label:"WIDGET_Presence_Error"}))))}}))))},Un=a().div`
420
+ `),Un=({id:e,type:t,uniqid:n})=>{const o=(0,u.jL)(),a=(0,r.useIntl)(),[d,m]=(0,i.useState)(!1);return l().createElement(l().Fragment,null,l().createElement(s.JRCIconButton,{iconSize:14,onClick:()=>m(!0),icon:"icon-trash"}),d&&l().createElement(Rn,{enableClickAwayCloseModal:!0,open:d,closeHandler:()=>m(!1)},l().createElement(Bn,{overflow:"scroll",title:a.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>m(!1)},a.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})),l().createElement(Hn,null,l().createElement(Fn,{label:a.formatMessage({id:"GLOBAL_Confirm"}),onClick:()=>{k().widget.removeWidget({id:e,type:t,uniqid:n}).then((()=>{o(c.x0.slice.actions.flushWidget({uniqid:n}))})).catch((()=>o(c.y8.actions.error({label:"WIDGET_Presence_Error"}))))}}))))},Pn=a().div`
421
421
  display: flex;
422
422
  flex: 1;
423
423
  flex-direction: row;
@@ -431,7 +431,7 @@
431
431
  &:hover {
432
432
  background-color: ${e=>e.theme.color.grey0};
433
433
  }
434
- `,Yn=({name:e,uniqid:t,mode:n,collaborationRights:o,handleOpenEditor:a})=>{const s=(0,r.useIntl)(),d=(0,u.jL)(),m=(0,u.GV)((e=>c.x0.selectors.selectWidgetObject(e,t)),le.shallowEqual),g=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectRights(e,t)),le.shallowEqual),p=(0,i.useMemo)((()=>m&&g&&g.update||o&&o.update),[m,g,o]),f=(0,i.useMemo)((()=>m&&g&&g.delete),[m,g]),E=(0,i.useCallback)((()=>{d(c.cr.slice.actions.registerEditor({uniqid:t,name:e,mode:n}))}),[t,d,e,n]);return p&&(0,w.ensureWidgetObjectHasMinimumProperties)(m)?l().createElement(Un,null,l().createElement(Nn,{onClick:null!=a?a:E},s.formatMessage({id:"WIDGET_Set_Widget"})),f&&l().createElement(Pn,{id:m.id,type:m.type,uniqid:t})):l().createElement(l().Fragment,null)},Jn=a().div`
434
+ `,Yn=({name:e,uniqid:t,mode:n,collaborationRights:o,handleOpenEditor:a})=>{const s=(0,r.useIntl)(),d=(0,u.jL)(),m=(0,u.GV)((e=>c.x0.selectors.selectWidgetObject(e,t)),le.shallowEqual),g=(0,u.GV)((e=>c.x0.selectors.selectWidgetObjectRights(e,t)),le.shallowEqual),p=(0,i.useMemo)((()=>m&&g&&g.update||o&&o.update),[m,g,o]),f=(0,i.useMemo)((()=>m&&g&&g.delete),[m,g]),E=(0,i.useCallback)((()=>{d(c.cr.slice.actions.registerEditor({uniqid:t,name:e,mode:n}))}),[t,d,e,n]);return p&&(0,w.ensureWidgetObjectHasMinimumProperties)(m)?l().createElement(Pn,null,l().createElement(Nn,{onClick:null!=a?a:E},s.formatMessage({id:"WIDGET_Set_Widget"})),f&&l().createElement(Un,{id:m.id,type:m.type,uniqid:t})):l().createElement(l().Fragment,null)},Jn=a().div`
435
435
  padding: ${e=>e.theme.space.md}px;
436
436
  display: flex;
437
437
  flex-direction: row;
@@ -535,17 +535,17 @@
535
535
  align-items: center;
536
536
  `,$i=a().div`
537
537
  margin-bottom: ${e=>e.theme.space.md}px;
538
- `,Fi={username:"",password:"",hostname:"",imapPort:993,imapConnectionSecurity:w.ImapConnection.NONE,imapMailbox:"",cardDavAddressBook:"",calDavCalendar:"",provider:""},Ri=()=>{const e=(0,r.useIntl)(),t=(0,le.useDispatch)(),n=(0,s.useAbortController)(),[o,a]=(0,i.useState)(!1),[d,u]=(0,i.useState)(!1),{control:m,reset:g,setValue:p,getValues:f,watch:E,formState:{isValid:h}}=(0,T.useForm)({defaultValues:Fi,criteriaMode:"all"}),[b,v]=(0,i.useState)([]),y=E(),C=[{label:"NONE",value:w.ImapConnection.NONE},{label:"SSL",value:w.ImapConnection.SSL},{label:"STARTTLS",value:w.ImapConnection.STARTTLS}],x=(0,i.useCallback)((e=>{k().office.getConfiguration().then((({result:t})=>{var n;g(Object.assign(Object.assign({},t),{provider:e.includes(null!==(n=t.provider)&&void 0!==n?n:"")?t.provider:e[0]}))}))}),[g]);(0,i.useEffect)((()=>{o&&(u(!0),k().office.getProviders({signal:n.signal}).then((({result:e})=>{n.signal.aborted||(v(e),x(e.map((e=>e.id))))})).catch((e=>{n.signal.aborted||t(c.y8.actions.error({label:e.errorMsg}))})).finally((()=>{u(!1)})))}),[o,n.signal,t,x]),(0,i.useEffect)((()=>{1===b.length&&p("provider",b[0].id)}),[b,p]);const L=()=>a(!1),W=(0,i.useMemo)((()=>b.length>1),[b]);return l().createElement(l().Fragment,null,l().createElement(Di,null,l().createElement(Mi,{label:e.formatMessage({id:"Office_Set_Configuration"}),onClick:()=>a(!0)})),l().createElement(Si,{open:o,radius:"small",closeHandler:L},l().createElement(ji,{overflow:"scroll",title:e.formatMessage({id:"Office_Set_Configuration"}),onClickIconClose:L},d?l().createElement(s.JRCLoader,{size:"s"}):l().createElement(l().Fragment,null,0===b.length&&l().createElement(Vi,null,e.formatMessage({id:"Office_No_Providers"})),l().createElement(Gi,{isLocked:0===b.length},W&&l().createElement(l().Fragment,null,l().createElement($i,null,l().createElement(zi,{size:"l"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_Provider"})),l().createElement(Bi,{label:"OfficeHook_Conf_Select_Provider",initialValue:{label:b[0].label,value:b[0].id},options:b.map((e=>({label:e.label,value:e.id}))),handleChange:e=>{f("provider")!==e&&g(),p("provider",e)}}))),l().createElement($i,null,l().createElement(zi,{size:"l"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Settings"})),l().createElement(Ti,{control:m,name:"hostname",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Hostname"}),rules:{required:!0}}),l().createElement(Ti,{control:m,name:"username",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_Username"}),rules:{required:!0}}),l().createElement(Oi,{control:m,name:"password",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_Password"}),rules:{required:!0}})),l().createElement($i,null,l().createElement(zi,{size:"l"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_IMap_Mailbox"})),l().createElement(Ai,{control:m,name:"imapPort",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Port"}),rules:{required:!0}}),l().createElement(Bi,{label:"OfficeHook_Conf_Select_Connection_Security",initialValue:C[0],options:C,handleChange:e=>p("imapConnectionSecurity",e)}),l().createElement(Ti,{control:m,name:"imapMailbox",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Mailbox"}),rules:{required:!0}})),l().createElement($i,null,l().createElement(zi,{size:"l"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_CalDav_Calendar"})),l().createElement(Ti,{control:m,name:"calDavCalendar",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_CalDav_Calendar"}),rules:{required:!0}})),l().createElement($i,null,l().createElement(zi,{size:"l"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_CardDav_Address_Book"})),l().createElement(Ti,{control:m,name:"cardDavAddressBook",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_CardDav_Address_Book"}),rules:{required:!0}}))),l().createElement(Mi,{label:e.formatMessage({id:"OfficeHook_Conf_Prompt_Submit"}),loader:d,disabled:d||0===b.length||!h,onClick:()=>{d||(u(!0),k().office.setConfiguration(y).then((()=>window.location.reload())).catch((e=>t(c.y8.actions.error({label:e.errorMsg})))).finally((()=>{a(!1),u(!1),g()})))}})))))},Bi=({label:e,initialValue:t,options:n,handleChange:o})=>{const{control:a,watch:r}=(0,T.useForm)({defaultValues:{provider:t},criteriaMode:"all"});return(0,i.useEffect)((()=>{const e=r((e=>{e.provider&&e.provider.value&&o(e.provider.value)}));return()=>e.unsubscribe()}),[r,o]),l().createElement(Ii,{label:e,name:"provider",options:null!=n?n:[],getValue:e=>e.value,getLabel:"label",getSearch:"label",control:a,rules:{required:!0}})},Hi=d.j.getLazyComponent("ButtonDropdown"),Pi=d.j.getLazyComponent("Tooltip"),Ui=a().div`
538
+ `,Fi={username:"",password:"",hostname:"",imapPort:993,imapConnectionSecurity:w.ImapConnection.NONE,imapMailbox:"",cardDavAddressBook:"",calDavCalendar:"",provider:""},Ri=()=>{const e=(0,r.useIntl)(),t=(0,le.useDispatch)(),n=(0,s.useAbortController)(),[o,a]=(0,i.useState)(!1),[d,u]=(0,i.useState)(!1),{control:m,reset:g,setValue:p,getValues:f,watch:E,formState:{isValid:h}}=(0,T.useForm)({defaultValues:Fi,criteriaMode:"all"}),[b,v]=(0,i.useState)([]),y=E(),C=[{label:"NONE",value:w.ImapConnection.NONE},{label:"SSL",value:w.ImapConnection.SSL},{label:"STARTTLS",value:w.ImapConnection.STARTTLS}],x=(0,i.useCallback)((e=>{k().office.getConfiguration().then((({result:t})=>{var n;g(Object.assign(Object.assign({},t),{provider:e.includes(null!==(n=t.provider)&&void 0!==n?n:"")?t.provider:e[0]}))}))}),[g]);(0,i.useEffect)((()=>{o&&(u(!0),k().office.getProviders({signal:n.signal}).then((({result:e})=>{n.signal.aborted||(v(e),x(e.map((e=>e.id))))})).catch((e=>{n.signal.aborted||t(c.y8.actions.error({label:e.errorMsg}))})).finally((()=>{u(!1)})))}),[o,n.signal,t,x]),(0,i.useEffect)((()=>{1===b.length&&p("provider",b[0].id)}),[b,p]);const L=()=>a(!1),W=(0,i.useMemo)((()=>b.length>1),[b]);return l().createElement(l().Fragment,null,l().createElement(Di,null,l().createElement(Mi,{label:e.formatMessage({id:"Office_Set_Configuration"}),onClick:()=>a(!0)})),l().createElement(Si,{open:o,radius:"small",closeHandler:L},l().createElement(ji,{overflow:"scroll",title:e.formatMessage({id:"Office_Set_Configuration"}),onClickIconClose:L},d?l().createElement(s.JRCLoader,{size:"s"}):l().createElement(l().Fragment,null,0===b.length&&l().createElement(Vi,null,e.formatMessage({id:"Office_No_Providers"})),l().createElement(Gi,{isLocked:0===b.length},W&&l().createElement(l().Fragment,null,l().createElement($i,null,l().createElement(zi,{size:"l"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_Provider"})),l().createElement(Bi,{label:"OfficeHook_Conf_Select_Provider",initialValue:{label:b[0].label,value:b[0].id},options:b.map((e=>({label:e.label,value:e.id}))),handleChange:e=>{f("provider")!==e&&g(),p("provider",e)}}))),l().createElement($i,null,l().createElement(zi,{size:"l"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Settings"})),l().createElement(Ti,{control:m,name:"hostname",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Hostname"}),rules:{required:!0}}),l().createElement(Ti,{control:m,name:"username",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_Username"}),rules:{required:!0}}),l().createElement(Oi,{control:m,name:"password",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_Password"}),rules:{required:!0}})),l().createElement($i,null,l().createElement(zi,{size:"l"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_IMap_Mailbox"})),l().createElement(Ai,{control:m,name:"imapPort",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Port"}),rules:{required:!0}}),l().createElement(Bi,{label:"OfficeHook_Conf_Select_Connection_Security",initialValue:C[0],options:C,handleChange:e=>p("imapConnectionSecurity",e)}),l().createElement(Ti,{control:m,name:"imapMailbox",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Mailbox"}),rules:{required:!0}})),l().createElement($i,null,l().createElement(zi,{size:"l"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_CalDav_Calendar"})),l().createElement(Ti,{control:m,name:"calDavCalendar",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_CalDav_Calendar"}),rules:{required:!0}})),l().createElement($i,null,l().createElement(zi,{size:"l"},l().createElement(r.FormattedMessage,{id:"OfficeHook_Conf_CardDav_Address_Book"})),l().createElement(Ti,{control:m,name:"cardDavAddressBook",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_CardDav_Address_Book"}),rules:{required:!0}}))),l().createElement(Mi,{label:e.formatMessage({id:"OfficeHook_Conf_Prompt_Submit"}),loader:d,disabled:d||0===b.length||!h,onClick:()=>{d||(u(!0),k().office.setConfiguration(y).then((()=>window.location.reload())).catch((e=>t(c.y8.actions.error({label:e.errorMsg})))).finally((()=>{a(!1),u(!1),g()})))}})))))},Bi=({label:e,initialValue:t,options:n,handleChange:o})=>{const{control:a,watch:r}=(0,T.useForm)({defaultValues:{provider:t},criteriaMode:"all"});return(0,i.useEffect)((()=>{const e=r((e=>{e.provider&&e.provider.value&&o(e.provider.value)}));return()=>e.unsubscribe()}),[r,o]),l().createElement(Ii,{label:e,name:"provider",options:null!=n?n:[],getValue:e=>e.value,getLabel:"label",getSearch:"label",control:a,rules:{required:!0}})},Hi=d.j.getLazyComponent("ButtonDropdown"),Ui=d.j.getLazyComponent("Tooltip"),Pi=a().div`
539
539
  margin-right: ${e=>e.theme.space.sm}px;
540
540
  button {
541
541
  background: ${e=>e.theme.color.white};
542
542
  }
543
- `,Ni=({uniqid:e,isConfigurationValid:t=!1,handleLogout:n})=>{const i=(0,r.useIntl)(),o=(0,le.useDispatch)(),a=[{label:i.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{o(c.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(Fi).finally(n)}}];return l().createElement(sn,{uniqid:e,dropdown:()=>t&&l().createElement(Ui,null,l().createElement(Pi,{position:"left",description:i.formatMessage({id:"WIDGET_Prompt_Dropdown"})},l().createElement(Hi,{small:!0,smallOpenDirection:"left",options:a,icon:"icon-cogwheel",label:"",color:"primary",variant:"outlined"})))})},Yi=d.j.getLazyComponent("WidgetContactCardDav"),Ji=({widget:e,mode:t,levelFallback:n})=>{const{uniqid:o}=e,a=(0,u.jL)(),[r,s]=(0,i.useState)(void 0),[d,m]=(0,i.useState)(void 0),[g,p]=(0,i.useState)(!1),f=(0,u.GV)((e=>c.x0.selectors.selectWidgetLevel(e,o)),le.shallowEqual),[E,h]=(0,i.useState)([]),b=(0,i.useCallback)(((e,t)=>{e&&400===e.error&&k().office.setConfiguration(Fi),t?window.location.reload():(s(!1),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0,loading:!1})))}),[a,o]),v=(0,i.useCallback)((e=>{s(e),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0}))}),[a,o]),y=(0,i.useCallback)((e=>a(c.x0.slice.actions.setWidgetState({uniqid:o,loading:e}))),[o,a]),C=(0,i.useCallback)((()=>{k().office.getProviderBaseUrls().then((({result:e})=>{m(e.dav_address_book_url)})).finally((()=>y(!1)))}),[y]),x=(0,i.useCallback)((()=>{k().office.davAddressBookGetContacts({limit:10}).then((({result:e})=>{h(e),p(!0)})).catch((()=>{a(c.y8.actions.error({label:"PLUGIN_Manager_Connection_Error"})),s(!1),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0,loading:!1}))})).finally((()=>y(!1)))}),[y,a,o]);return(0,i.useEffect)((()=>{if(!g)return;if(!r)return;if(f!==w.WIDGET_LEVEL_3)return;const e=setInterval(x,4e3);return()=>clearInterval(e)}),[r,x,g,f]),(0,i.useEffect)((()=>{y(!0),k().office.isConfigurationValid().then((({result:e})=>v(e))).catch(b).finally((()=>y(!1)))}),[v,f,C,y,b]),(0,i.useEffect)((()=>{if(r)return f===w.WIDGET_LEVEL_1?(y(!0),void C()):void x()}),[r,C,y,x,f]),r&&f&&f!==w.WIDGET_LEVEL_3&&n?l().createElement(l().Fragment,null,n(f,null!=d?d:"")):l().createElement(en,{header:()=>l().createElement(l().Fragment,null,l().createElement(Ni,{uniqid:o,isConfigurationValid:void 0!==r&&!0===r,handleLogout:()=>b(void 0,!0)})),scrollable:()=>l().createElement(Qt,{uniqid:o},r&&l().createElement(Yi,{contactCardList:E}),void 0===r&&l().createElement(l().Fragment,null),void 0!==r&&!1===r&&"view"===t&&l().createElement(Ri,null))})},Qi=d.j.getLazyComponent("ButtonDropdown"),Xi=d.j.getLazyComponent("Tooltip"),Ki=a().div`
543
+ `,Ni=({uniqid:e,isConfigurationValid:t=!1,handleLogout:n})=>{const i=(0,r.useIntl)(),o=(0,le.useDispatch)(),a=[{label:i.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{o(c.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(Fi).finally(n)}}];return l().createElement(sn,{uniqid:e,dropdown:()=>t&&l().createElement(Pi,null,l().createElement(Ui,{position:"left",description:i.formatMessage({id:"WIDGET_Prompt_Dropdown"})},l().createElement(Hi,{small:!0,smallOpenDirection:"left",options:a,icon:"icon-cogwheel",label:"",color:"primary",variant:"outlined"})))})},Yi=d.j.getLazyComponent("WidgetContactCardDav"),Ji=({widget:e,mode:t,levelFallback:n})=>{const{uniqid:o}=e,a=(0,u.jL)(),[r,s]=(0,i.useState)(void 0),[d,m]=(0,i.useState)(void 0),[g,p]=(0,i.useState)(!1),f=(0,u.GV)((e=>c.x0.selectors.selectWidgetLevel(e,o)),le.shallowEqual),[E,h]=(0,i.useState)([]),b=(0,i.useCallback)(((e,t)=>{e&&400===e.error&&k().office.setConfiguration(Fi),t?window.location.reload():(s(!1),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0,loading:!1})))}),[a,o]),v=(0,i.useCallback)((e=>{s(e),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0}))}),[a,o]),y=(0,i.useCallback)((e=>a(c.x0.slice.actions.setWidgetState({uniqid:o,loading:e}))),[o,a]),C=(0,i.useCallback)((()=>{k().office.getProviderBaseUrls().then((({result:e})=>{m(e.dav_address_book_url)})).finally((()=>y(!1)))}),[y]),x=(0,i.useCallback)((()=>{k().office.davAddressBookGetContacts({limit:10}).then((({result:e})=>{h(e),p(!0)})).catch((()=>{a(c.y8.actions.error({label:"PLUGIN_Manager_Connection_Error"})),s(!1),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0,loading:!1}))})).finally((()=>y(!1)))}),[y,a,o]);return(0,i.useEffect)((()=>{if(!g)return;if(!r)return;if(f!==w.WIDGET_LEVEL_3)return;const e=setInterval(x,4e3);return()=>clearInterval(e)}),[r,x,g,f]),(0,i.useEffect)((()=>{y(!0),k().office.isConfigurationValid().then((({result:e})=>v(e))).catch(b).finally((()=>y(!1)))}),[v,f,C,y,b]),(0,i.useEffect)((()=>{if(r)return f===w.WIDGET_LEVEL_1?(y(!0),void C()):void x()}),[r,C,y,x,f]),r&&f&&f!==w.WIDGET_LEVEL_3&&n?l().createElement(l().Fragment,null,n(f,null!=d?d:"")):l().createElement(en,{header:()=>l().createElement(l().Fragment,null,l().createElement(Ni,{uniqid:o,isConfigurationValid:void 0!==r&&!0===r,handleLogout:()=>b(void 0,!0)})),scrollable:()=>l().createElement(Qt,{uniqid:o},r&&l().createElement(Yi,{contactCardList:E}),void 0===r&&l().createElement(l().Fragment,null),void 0!==r&&!1===r&&"view"===t&&l().createElement(Ri,null))})},Qi=d.j.getLazyComponent("ButtonDropdown"),Xi=d.j.getLazyComponent("Tooltip"),Ki=a().div`
544
544
  margin-right: ${e=>e.theme.space.sm}px;
545
545
  button {
546
546
  background: ${e=>e.theme.color.white};
547
547
  }
548
- `,Zi=({uniqid:e,isConfigurationValid:t=!1,handleLogout:n})=>{const i=(0,r.useIntl)(),o=(0,le.useDispatch)(),a=[{label:i.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{o(c.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(Fi).finally(n)}}];return l().createElement(sn,{uniqid:e,dropdown:()=>t&&l().createElement(Ki,null,l().createElement(Xi,{position:"left",description:i.formatMessage({id:"WIDGET_Prompt_Dropdown"})},l().createElement(Qi,{small:!0,smallOpenDirection:"left",options:a,icon:"icon-cogwheel",label:"",color:"primary",variant:"outlined"})))})},el=d.j.getLazyComponent("WidgetCalendarCalDav"),tl=({widget:e,mode:t,levelFallback:n})=>{const{uniqid:o}=e,a=(0,u.jL)(),[r,d]=(0,i.useState)(void 0),[m,g]=(0,i.useState)(!1),p=(0,u.GV)((e=>c.x0.selectors.selectWidgetLevel(e,o)),le.shallowEqual),{moment:f}=(0,s.useMoment)(),[E,h]=(0,i.useState)(void 0),[b,v]=(0,i.useState)([]),y=(0,i.useCallback)(((e,t)=>{e&&400===e.error&&k().office.setConfiguration(Fi),t?window.location.reload():(d(!1),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0,loading:!1})))}),[a,o]),C=(0,i.useCallback)((e=>{d(e),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0}))}),[a,o]),x=(0,i.useCallback)((e=>a(c.x0.slice.actions.setWidgetState({uniqid:o,loading:e}))),[o,a]),L=(0,i.useCallback)((()=>{k().office.getProviderBaseUrls().then((({result:e})=>{h(e.dav_calendar_url)})).finally((()=>x(!1)))}),[x]),W=(0,i.useCallback)((()=>{k().office.davCalendarGetEvents({limit:10,dateStart:f().format("YYYY-MM-DD hh:mm:ss"),dateEnd:f(f()).add(1,"M").format("YYYY-MM-DD hh:mm:ss")}).then((({result:e})=>{v(e),g(!0)})).catch((()=>{a(c.y8.actions.error({label:"PLUGIN_Manager_Connection_Error"})),d(!1),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0,loading:!1}))})).finally((()=>x(!1)))}),[x,a,o,f]);return(0,i.useEffect)((()=>{if(!m)return;if(!r)return;if(p!==w.WIDGET_LEVEL_3)return;const e=setInterval(W,6e4);return()=>clearInterval(e)}),[r,W,m,p]),(0,i.useEffect)((()=>{x(!0),k().office.isConfigurationValid().then((({result:e})=>C(e))).catch(y)}),[y,x,C]),(0,i.useEffect)((()=>{if(r)return p===w.WIDGET_LEVEL_1?(x(!0),void L()):void W()}),[r,L,x,W,f,p]),r&&p&&p!==w.WIDGET_LEVEL_3&&n?l().createElement(l().Fragment,null,n(p,null!=E?E:"")):l().createElement(en,{header:()=>l().createElement(l().Fragment,null,l().createElement(Zi,{uniqid:o,isConfigurationValid:void 0!==r&&!0===r,handleLogout:()=>y(void 0,!0)})),scrollable:()=>l().createElement(Qt,{uniqid:o},r&&l().createElement(el,{calendarListEvent:b}),void 0===r&&l().createElement(l().Fragment,null),void 0!==r&&!1===r&&"view"===t&&l().createElement(Ri,null))})},nl=d.j.getLazyComponent("ButtonDropdown"),il=d.j.getLazyComponent("Tooltip"),ll=a().div`
548
+ `,Zi=({uniqid:e,isConfigurationValid:t=!1,handleLogout:n})=>{const i=(0,r.useIntl)(),o=(0,le.useDispatch)(),a=[{label:i.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{o(c.x0.slice.actions.setWidgetState({uniqid:e,loading:!0})),k().office.setConfiguration(Fi).finally(n)}}];return l().createElement(sn,{uniqid:e,dropdown:()=>t&&l().createElement(Ki,null,l().createElement(Xi,{position:"left",description:i.formatMessage({id:"WIDGET_Prompt_Dropdown"})},l().createElement(Qi,{small:!0,smallOpenDirection:"left",options:a,icon:"icon-cogwheel",label:"",color:"primary",variant:"outlined"})))})},el=d.j.getLazyComponent("WidgetCalendarCalDav"),tl=({widget:e,mode:t,levelFallback:n})=>{const{uniqid:o}=e,a=(0,u.jL)(),[r,d]=(0,i.useState)(void 0),[m,g]=(0,i.useState)(!1),p=(0,u.GV)((e=>c.x0.selectors.selectWidgetLevel(e,o)),le.shallowEqual),[f,E]=(0,i.useState)(void 0),[h,b]=(0,i.useState)([]),v=(0,i.useCallback)(((e,t)=>{e&&400===e.error&&k().office.setConfiguration(Fi),t?window.location.reload():(d(!1),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0,loading:!1})))}),[a,o]),y=(0,i.useCallback)((e=>{d(e),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0}))}),[a,o]),C=(0,i.useCallback)((e=>a(c.x0.slice.actions.setWidgetState({uniqid:o,loading:e}))),[o,a]),x=(0,i.useCallback)((()=>{k().office.getProviderBaseUrls().then((({result:e})=>{E(e.dav_calendar_url)})).finally((()=>C(!1)))}),[C]),L=(0,i.useCallback)((()=>{const e=new Date,t=s.Utils.date.addMonth(new Date(e));k().office.davCalendarGetEvents({limit:10,dateStart:s.Utils.date.formatDateTime(e),dateEnd:s.Utils.date.formatDateTime(t)}).then((({result:e})=>{b(e),g(!0)})).catch((()=>{a(c.y8.actions.error({label:"PLUGIN_Manager_Connection_Error"})),d(!1),a(c.x0.slice.actions.setWidgetState({uniqid:o,initialized:!0,loading:!1}))})).finally((()=>C(!1)))}),[C,a,o]);return(0,i.useEffect)((()=>{if(!m)return;if(!r)return;if(p!==w.WIDGET_LEVEL_3)return;const e=setInterval(L,6e4);return()=>clearInterval(e)}),[r,L,m,p]),(0,i.useEffect)((()=>{C(!0),k().office.isConfigurationValid().then((({result:e})=>y(e))).catch(v)}),[v,C,y]),(0,i.useEffect)((()=>{if(r)return p===w.WIDGET_LEVEL_1?(C(!0),void x()):void L()}),[r,x,C,L,p]),r&&p&&p!==w.WIDGET_LEVEL_3&&n?l().createElement(l().Fragment,null,n(p,null!=f?f:"")):l().createElement(en,{header:()=>l().createElement(l().Fragment,null,l().createElement(Zi,{uniqid:o,isConfigurationValid:void 0!==r&&!0===r,handleLogout:()=>v(void 0,!0)})),scrollable:()=>l().createElement(Qt,{uniqid:o},r&&l().createElement(el,{calendarListEvent:h}),void 0===r&&l().createElement(l().Fragment,null),void 0!==r&&!1===r&&"view"===t&&l().createElement(Ri,null))})},nl=d.j.getLazyComponent("ButtonDropdown"),il=d.j.getLazyComponent("Tooltip"),ll=a().div`
549
549
  margin-right: ${e=>e.theme.space.sm}px;
550
550
  button {
551
551
  background: ${e=>e.theme.color.white};
@@ -635,12 +635,12 @@
635
635
  border: 1px solid ${e=>e.theme.color.grey1};
636
636
  background-color: ${e=>e.theme.color.white};
637
637
  overflow: hidden;
638
- `,Rl=d.j.getLazyComponent("Message"),Bl=({widgets:e})=>{const t=(0,r.useIntl)(),n=(0,u.GV)(c.x0.selectors.selectFlushedWidgets,le.shallowEqual);return l().createElement(l().Fragment,null,e.filter((e=>!n.includes(e.widget.uniqid))).map((e=>e&&e.widget&&l().createElement(Fl,{key:e.widget.uniqid},l().createElement($l,{uniqid:e.widget.uniqid,widget:e,inplace:!0,mode:"edit",cannotDisplayComponent:e=>l().createElement(Rl,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))},Hl=d.j.getLazyComponent("Message"),Pl=e=>{const t=(0,r.useIntl)(),{widgets:n,comment:i,inplace:o,mode:a,handleWidgetUpdate:s}=e,d=(0,u.GV)(c.x0.selectors.selectFlushedWidgets,le.shallowEqual);return l().createElement(l().Fragment,null,n.filter((e=>!d.includes(e.widget.uniqid))).map((e=>e&&l().createElement(Fl,{key:e.widget.uniqid},l().createElement($l,{uniqid:e.widget.uniqid,widgetObject:i,widget:e,inplace:o,mode:a,onWidgetUpdate:s,cannotDisplayComponent:e=>l().createElement(Hl,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))};var Ul=function(e,t,n,i){return new(n||(n=Promise))((function(l,o){function a(e){try{s(i.next(e))}catch(e){o(e)}}function r(e){try{s(i.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?l(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,r)}s((i=i.apply(e,t||[])).next())}))};const Nl=d.j.getLazyComponent("JRCCommentsBloc"),Yl=a().div`
638
+ `,Rl=d.j.getLazyComponent("Message"),Bl=({widgets:e})=>{const t=(0,r.useIntl)(),n=(0,u.GV)(c.x0.selectors.selectFlushedWidgets,le.shallowEqual);return l().createElement(l().Fragment,null,e.filter((e=>!n.includes(e.widget.uniqid))).map((e=>e&&e.widget&&l().createElement(Fl,{key:e.widget.uniqid},l().createElement($l,{uniqid:e.widget.uniqid,widget:e,inplace:!0,mode:"edit",cannotDisplayComponent:e=>l().createElement(Rl,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))},Hl=d.j.getLazyComponent("Message"),Ul=e=>{const t=(0,r.useIntl)(),{widgets:n,comment:i,inplace:o,mode:a,handleWidgetUpdate:s}=e,d=(0,u.GV)(c.x0.selectors.selectFlushedWidgets,le.shallowEqual);return l().createElement(l().Fragment,null,n.filter((e=>!d.includes(e.widget.uniqid))).map((e=>e&&l().createElement(Fl,{key:e.widget.uniqid},l().createElement($l,{uniqid:e.widget.uniqid,widgetObject:i,widget:e,inplace:o,mode:a,onWidgetUpdate:s,cannotDisplayComponent:e=>l().createElement(Hl,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))};var Pl=function(e,t,n,i){return new(n||(n=Promise))((function(l,o){function a(e){try{s(i.next(e))}catch(e){o(e)}}function r(e){try{s(i.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?l(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,r)}s((i=i.apply(e,t||[])).next())}))};const Nl=d.j.getLazyComponent("JRCCommentsBloc"),Yl=a().div`
639
639
  display: flex;
640
640
  flex-direction: column;
641
641
  gap: 4px;
642
642
  flex: 1;
643
643
  width: 100%;
644
644
  margin-top: 10px;
645
- `,Jl=({articleId:e,variant:t="inline",canComment:n,commentType:a="comment",socialQuestion:s,articleUri:d})=>{var m,g;const p=(0,r.useIntl)(),f=(0,o.useTheme)(),E=(0,u.jL)(),[h,b]=(0,i.useState)(),[v,y]=(0,i.useState)(!1),[C,x]=(0,i.useState)([]),[w,L]=(0,i.useState)(!1),W=(0,u.GV)(c.xJ.selectors.get),_=(0,u.GV)(c.x0.selectors.selectWidgets),q=(0,u.GV)(c.sU.selectors.selectTinyMCECommonOptions),S=(0,u.GV)(c.sU.selectors.selectTinyMCEExtendedOptions),j=(0,u.GV)(c.Kx.selectors.selectAll),M=(0,u.GV)(c.OD.selectors.selectPlatformConfig),T=(0,u.GV)((e=>c.lg.selectors.selectById(e,"OnlyOfficeHook"))),A=(0,u.GV)((t=>c.Mw.selectors.commentList(t,e))),I=(0,u.GV)((e=>c.qn.selectors.selectHook(e,"DriveHook"))),O=(0,u.GV)((e=>c.lg.selectors.selectById(e,"FileBankHook"))),z=(0,u.GV)((e=>c.qn.selectors.selectHook(e,"WidgetHook"))),[G,D]=(0,i.useState)(s),[V,$]=(0,i.useState)(null),{open:F,onInsert:R,close:B,ext:H,isActive:P}=St();(0,ee.A)(e),((e,t)=>{const n=(0,u.jL)(),l=(0,i.useMemo)((()=>te.A),[]),o=(0,i.useMemo)((()=>c.Mw.getCommentsLikeRTHandlers(n,e,t)),[n,e,t]);(0,i.useEffect)((()=>(o.forEach((e=>{l.onMessage(e.namespace,e.function,e.handler)})),()=>{o.forEach((e=>{l.offMessage(e.namespace,e.function,e.handler)}))})),[o,l])})(A.map((e=>e.id)),e);const U=(0,i.useCallback)((e=>{E(c.y8.actions.error({label:null!=e?e:p.formatMessage({id:"GLOBAL_Error"})}))}),[E,p]),N=()=>{E(c.Mw.actions.fetchComments({idArticle:e})),Y()},Y=(0,i.useCallback)((()=>{h||w||(L(!0),k().network.token().then((e=>{b(e.result),L(!1),E(c.x0.slice.actions.setToken({token:e.result}))})).catch((e=>{U(e.errorMsg)})))}),[U,h,w,E]),J=(0,i.useCallback)((t=>Ul(void 0,void 0,void 0,(function*(){if(h){y(!0);const n=Object.keys(_).map((e=>(null==C?void 0:C.some((t=>t.widget.uniqid===e)))?_[e]:null)).filter((e=>null!==e));try{yield k().article.addComment(Object.assign(Object.assign({},t),{widgets:n,token:h,idArticle:e,type:a})).then((()=>{x([])})),Y()}catch(e){throw U(e.errorMsg),e}finally{y(!1)}}}))),[e,a,Y,U,h,_,C]);return(0,i.useEffect)((()=>{Y()}),[Y]),(0,i.useEffect)((()=>{E(c.Mw.actions.fetchComments({idArticle:e}))}),[e,E]),(0,i.useEffect)((()=>{A&&A.forEach((e=>{var t;null===(t=e._widgets)||void 0===t||t.forEach((t=>{E(c.x0.slice.actions.registerWidgetObject({uniqid:t.widget.uniqid,object:e})),E(c.x0.slice.actions.registerWidgetObjectRights({uniqid:t.widget.uniqid,rights:e._right}))}))}))}),[A,E]),l().createElement(l().Fragment,null,q&&S&&l().createElement(l().Fragment,null,l().createElement(Yl,null,l().createElement(Nl,{canComment:n,loading:v,token:h,comments:A,onComment:J,onCommentUpdate:t=>Ul(void 0,void 0,void 0,(function*(){var n,i;const l=A.find((e=>e.id===t.idComment));if(l)return k().article.updateComment({idComment:t.idComment,description:null!==(i=null!==(n=t.description)&&void 0!==n?n:l.description)&&void 0!==i?i:void 0,token:t.token,widgets:t.widgets}).then((()=>{E(c.Mw.actions.fetchComments({idArticle:e})),Y()})).catch((e=>{U(e.errorMsg)}))})),onCommentDelete:t=>Ul(void 0,void 0,void 0,(function*(){E(c.Mw.actions.deleteComment({idComment:t,idArticle:e}))})),isWidgetActive:!(!(null==z?void 0:z.isActive)||!(null===(m=null==z?void 0:z.autorize)||void 0===m?void 0:m.includes("comment"))),canCreateWidget:!!((null==z?void 0:z.isActive)&&(null==z?void 0:z.create)&&(null===(g=null==z?void 0:z.autorize)||void 0===g?void 0:g.includes("comment"))),widgetListComponent:l().createElement(Wt,{mode:"comment",namespace:"comment",onChange:e=>{x([e]),E(c.x0.slice.actions.registerWidget({uniqid:e.widget.uniqid,widget:e})),b(void 0),Y()},view:"edit"}),newWidgetsWrapperComponent:l().createElement(Bl,{widgets:C}),existingWidgetsWrapperComponent:(e,t,n,i=!0)=>l().createElement(Pl,{comment:e,widgets:t,mode:n,inplace:i,handleWidgetUpdate:N,handleWidgetRemove:Y}),currentUser:W,tinyMCEConfig:{commonOptions:Object.assign(Object.assign({},q),{toolbar:S.commentsToolbar}),mentionsQueries:(0,jt.X)(j,f,U)},onError:U,highlightFields:M.userHighlightFields,userAccountStatus:M.userAccountStatus,userModel:j.find((e=>"user"===e.type)),isWedocActive:!!T,onGetHashError:e=>E(c.y8.actions.error({label:null!=e?e:p.formatMessage({id:"GLOBAL_Error"})})),activeDrives:[...O&&I?["fileBank"]:[],...c.qn.utils.buildDrivesArrayFromObject(null==I?void 0:I.drives)],variant:t,handlers:{drive:k().drive,filebank:k().filebank,file:k().file,user:k().user,socialAction:k().socialAction,questionAnswer:k().questionAnswer},socialQuestion:G?Object.assign(Object.assign({},G),{onSelectResponse:e=>{D(Object.assign(Object.assign({},G),{responseId:e,isResolved:!0}))},onUnselectResponse:()=>{D(Object.assign(Object.assign({},G),{responseId:void 0,isResolved:!1}))}}):void 0,articleId:e,additionalExtensions:[H],onReport:t=>$({articleId:e,commentUri:t,articleUri:d})}),l().createElement(gt,null))),P&&l().createElement(jn,{onInsert:R,open:F,close:B}),V&&l().createElement(Z,Object.assign({onClose:()=>$(null)},V)))},Ql=()=>l().createElement(l().Fragment,null);var Xl=n(286);const Kl=()=>{const[e,t]=(0,i.useState)(),n=(0,r.useIntl)(),l=(0,i.useMemo)((()=>{var e,t,n,i;return(null===(t=null===(e=J.hooks)||void 0===e?void 0:e.MagicWandHook)||void 0===t?void 0:t.isActive)&&(null===(i=null===(n=J.hooks)||void 0===n?void 0:n.MagicWandHook)||void 0===i?void 0:i.menuItems)&&J.hooks.MagicWandHook.menuItems.length}),[]),o=(0,i.useCallback)((e=>{t(Object.assign(Object.assign({},e),{reject:n=>{e.reject(n),t(void 0)},resolve:n=>{e.resolve(n),t(void 0)}}))}),[]),a=(0,i.useCallback)(((e,t)=>new Promise(((n,i)=>{o({reject:i,resolve:n,text:e,capability:t})}))),[o]),c=(0,i.useMemo)((()=>({develop:e=>a(e,"develop"),summarize:e=>a(e,"summarize"),tldr:e=>a(e,"tldr"),en:e=>a(e,"en"),es:e=>a(e,"es"),formal:e=>a(e,"formal"),funny:e=>a(e,"funny")})),[a]);return{query:e,ext:(0,i.useMemo)((()=>s.JTinyMCEExtensionsBuilders.jia(c,n)),[n,c]),isActive:l}},Zl=d.j.getLazyComponent("InputTinyMCE"),eo=e=>{const t=(0,r.useIntl)(),n=(0,u.jL)(),a=(0,o.useTheme)(),s=(0,u.GV)(c.Kx.selectors.selectAll),{query:d,ext:m,isActive:g}=Kl(),{open:p,onInsert:f,close:E,ext:h,isActive:b}=St(),v=(0,i.useMemo)((()=>[...b?[h]:[],...g?[m]:[]]),[m,h,g,b]),y=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),C=(0,i.useMemo)((()=>(0,jt.X)(s,a,y)),[s,y,a]),x=(0,i.useMemo)((()=>Xl.p9),[]);return l().createElement(l().Fragment,null,x&&l().createElement(Zl,Object.assign({commonOptions:x,additionalExtensions:v,mentionsQueries:C},e)),g&&l().createElement(M,{query:d}),b&&l().createElement(jn,{onInsert:f,open:p,close:E}))},to=d.j.getLazyComponent("InputTinyMCERaw"),no=e=>{const t=(0,r.useIntl)(),n=(0,u.jL)(),a=(0,o.useTheme)(),s=(0,u.GV)(c.Kx.selectors.selectAll),{query:d,ext:m,isActive:g}=Kl(),{open:p,onInsert:f,close:E,ext:h,isActive:b}=St(),v=(0,i.useMemo)((()=>[...b?[h]:[],...g?[m]:[]]),[m,h,g,b]),y=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),C=(0,i.useMemo)((()=>(0,jt.X)(s,a,y)),[s,y,a]),x=(0,i.useMemo)((()=>Xl.p9),[]);return l().createElement(l().Fragment,null,x&&l().createElement(to,Object.assign({commonOptions:x,additionalExtensions:v,mentionsQueries:C},e)),g&&l().createElement(M,{query:d}),b&&l().createElement(jn,{onInsert:f,open:p,close:E}))},io=d.j.getLazyComponent("InputAudience"),lo=d.j.getLazyComponent("Message"),oo=d.j.getLazyComponent("Modal"),ao=({open:e,closeHandler:t,title:n,control:i,warningMessage:o,onSubmit:a,name:s="publishTo"})=>{const c=(0,r.useIntl)();return l().createElement(oo,{open:e,closeHandler:t,title:null!=n?n:c.formatMessage({id:"GLOBAL_Audience"}),buttons:[{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:()=>t()},{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Continue"}),color:"danger",clickHandler:()=>{t(),a()}}]},l().createElement(lo,{variant:"warning",message:null!=o?o:c.formatMessage({id:"FORM_Audience_Empty"})}),l().createElement(io,{asyncPromise:e=>k().audience.autocomplete(e),searchable:!0,control:i,multiple:!0,placeholder:c.formatMessage({id:"GLOBAL_Audience"}),name:s}))};var ro=n(737);const so=d.j.getLazyComponent("Container"),co=d.j.getLazyComponent("AppColumn"),uo=d.j.getLazyComponent("MainColumn");function mo({extensionRoute:e,routes:t,description:n,mode:o="center",mainColumnProps:a}){var s;const c=(0,r.useIntl)(),{pathname:d}=(0,ro.useLocation)(),u=(0,i.useMemo)((()=>Object.values(t)),[t]),[m,g]=(0,i.useState)(null===(s=null==u?void 0:u[0])||void 0===s?void 0:s.key),p=u.map((t=>Object.assign(Object.assign({},t),{label:c.formatMessage({id:t.label}),href:t.absolutePath?t.path:`/ng/rr/${e}/${t.path}`,group:t.group?c.formatMessage({id:t.group}):void 0})));return(0,i.useEffect)((()=>{const t=u.find((t=>{var n;return`/ng/rr/${e}/${t.path}`===d||(null===(n=t.paths)||void 0===n?void 0:n.reduce(((t,n)=>{const i=`/ng/rr/${e}/${n}`,l=null!==(0,ro.matchPath)(i,d);return t||l}),!1))}));t&&g(t.key)}),[d,u,e]),l().createElement(i.Suspense,{fallback:l().createElement(l().Fragment,null)},l().createElement(so,{mode:o},l().createElement(co,{mode:o,description:n,tabs:p,activeTab:m||""}),l().createElement(uo,Object.assign({mode:o,flex:!0},a),l().createElement(ro.Outlet,null))))}}}]);
646
- //# sourceMappingURL=940.0344d9b4885b1abed664.chunk.js.map
645
+ `,Jl=({articleId:e,variant:t="inline",canComment:n,commentType:a="comment",socialQuestion:s,articleUri:d})=>{var m,g;const p=(0,r.useIntl)(),f=(0,o.useTheme)(),E=(0,u.jL)(),[h,b]=(0,i.useState)(),[v,y]=(0,i.useState)(!1),[C,x]=(0,i.useState)([]),[w,L]=(0,i.useState)(!1),W=(0,u.GV)(c.xJ.selectors.get),_=(0,u.GV)(c.x0.selectors.selectWidgets),q=(0,u.GV)(c.sU.selectors.selectTinyMCECommonOptions),S=(0,u.GV)(c.sU.selectors.selectTinyMCEExtendedOptions),j=(0,u.GV)(c.Kx.selectors.selectAll),M=(0,u.GV)(c.OD.selectors.selectPlatformConfig),T=(0,u.GV)((e=>c.lg.selectors.selectById(e,"OnlyOfficeHook"))),A=(0,u.GV)((t=>c.Mw.selectors.commentList(t,e))),I=(0,u.GV)((e=>c.qn.selectors.selectHook(e,"DriveHook"))),O=(0,u.GV)((e=>c.lg.selectors.selectById(e,"FileBankHook"))),z=(0,u.GV)((e=>c.qn.selectors.selectHook(e,"WidgetHook"))),[G,D]=(0,i.useState)(s),[V,$]=(0,i.useState)(null),{open:F,onInsert:R,close:B,ext:H,isActive:U}=St();(0,ee.A)(e),((e,t)=>{const n=(0,u.jL)(),l=(0,i.useMemo)((()=>te.A),[]),o=(0,i.useMemo)((()=>c.Mw.getCommentsLikeRTHandlers(n,e,t)),[n,e,t]);(0,i.useEffect)((()=>(o.forEach((e=>{l.onMessage(e.namespace,e.function,e.handler)})),()=>{o.forEach((e=>{l.offMessage(e.namespace,e.function,e.handler)}))})),[o,l])})(A.map((e=>e.id)),e);const P=(0,i.useCallback)((e=>{E(c.y8.actions.error({label:null!=e?e:p.formatMessage({id:"GLOBAL_Error"})}))}),[E,p]),N=()=>{E(c.Mw.actions.fetchComments({idArticle:e})),Y()},Y=(0,i.useCallback)((()=>{h||w||(L(!0),k().network.token().then((e=>{b(e.result),L(!1),E(c.x0.slice.actions.setToken({token:e.result}))})).catch((e=>{P(e.errorMsg)})))}),[P,h,w,E]),J=(0,i.useCallback)((t=>Pl(void 0,void 0,void 0,(function*(){if(h){y(!0);const n=Object.keys(_).map((e=>(null==C?void 0:C.some((t=>t.widget.uniqid===e)))?_[e]:null)).filter((e=>null!==e));try{yield k().article.addComment(Object.assign(Object.assign({},t),{widgets:n,token:h,idArticle:e,type:a})).then((()=>{x([])})),Y()}catch(e){throw P(e.errorMsg),e}finally{y(!1)}}}))),[e,a,Y,P,h,_,C]);return(0,i.useEffect)((()=>{Y()}),[Y]),(0,i.useEffect)((()=>{E(c.Mw.actions.fetchComments({idArticle:e}))}),[e,E]),(0,i.useEffect)((()=>{A&&A.forEach((e=>{var t;null===(t=e._widgets)||void 0===t||t.forEach((t=>{E(c.x0.slice.actions.registerWidgetObject({uniqid:t.widget.uniqid,object:e})),E(c.x0.slice.actions.registerWidgetObjectRights({uniqid:t.widget.uniqid,rights:e._right}))}))}))}),[A,E]),l().createElement(l().Fragment,null,q&&S&&l().createElement(l().Fragment,null,l().createElement(Yl,null,l().createElement(Nl,{canComment:n,loading:v,token:h,comments:A,onComment:J,onCommentUpdate:t=>Pl(void 0,void 0,void 0,(function*(){var n,i;const l=A.find((e=>e.id===t.idComment));if(l)return k().article.updateComment({idComment:t.idComment,description:null!==(i=null!==(n=t.description)&&void 0!==n?n:l.description)&&void 0!==i?i:void 0,token:t.token,widgets:t.widgets}).then((()=>{E(c.Mw.actions.fetchComments({idArticle:e})),Y()})).catch((e=>{P(e.errorMsg)}))})),onCommentDelete:t=>Pl(void 0,void 0,void 0,(function*(){E(c.Mw.actions.deleteComment({idComment:t,idArticle:e}))})),isWidgetActive:!(!(null==z?void 0:z.isActive)||!(null===(m=null==z?void 0:z.autorize)||void 0===m?void 0:m.includes("comment"))),canCreateWidget:!!((null==z?void 0:z.isActive)&&(null==z?void 0:z.create)&&(null===(g=null==z?void 0:z.autorize)||void 0===g?void 0:g.includes("comment"))),widgetListComponent:l().createElement(Wt,{mode:"comment",namespace:"comment",onChange:e=>{x([e]),E(c.x0.slice.actions.registerWidget({uniqid:e.widget.uniqid,widget:e})),b(void 0),Y()},view:"edit"}),newWidgetsWrapperComponent:l().createElement(Bl,{widgets:C}),existingWidgetsWrapperComponent:(e,t,n,i=!0)=>l().createElement(Ul,{comment:e,widgets:t,mode:n,inplace:i,handleWidgetUpdate:N,handleWidgetRemove:Y}),currentUser:W,tinyMCEConfig:{commonOptions:Object.assign(Object.assign({},q),{toolbar:S.commentsToolbar}),mentionsQueries:(0,jt.X)(j,f,P)},onError:P,highlightFields:M.userHighlightFields,userAccountStatus:M.userAccountStatus,userModel:j.find((e=>"user"===e.type)),isWedocActive:!!T,onGetHashError:e=>E(c.y8.actions.error({label:null!=e?e:p.formatMessage({id:"GLOBAL_Error"})})),activeDrives:[...O&&I?["fileBank"]:[],...c.qn.utils.buildDrivesArrayFromObject(null==I?void 0:I.drives)],variant:t,handlers:{drive:k().drive,filebank:k().filebank,file:k().file,user:k().user,socialAction:k().socialAction,questionAnswer:k().questionAnswer},socialQuestion:G?Object.assign(Object.assign({},G),{onSelectResponse:e=>{D(Object.assign(Object.assign({},G),{responseId:e,isResolved:!0}))},onUnselectResponse:()=>{D(Object.assign(Object.assign({},G),{responseId:void 0,isResolved:!1}))}}):void 0,articleId:e,additionalExtensions:[H],onReport:t=>$({articleId:e,commentUri:t,articleUri:d})}),l().createElement(gt,null))),U&&l().createElement(jn,{onInsert:R,open:F,close:B}),V&&l().createElement(Z,Object.assign({onClose:()=>$(null)},V)))},Ql=()=>l().createElement(l().Fragment,null);var Xl=n(286);const Kl=()=>{const[e,t]=(0,i.useState)(),n=(0,r.useIntl)(),l=(0,i.useMemo)((()=>{var e,t,n,i;return(null===(t=null===(e=J.hooks)||void 0===e?void 0:e.MagicWandHook)||void 0===t?void 0:t.isActive)&&(null===(i=null===(n=J.hooks)||void 0===n?void 0:n.MagicWandHook)||void 0===i?void 0:i.menuItems)&&J.hooks.MagicWandHook.menuItems.length}),[]),o=(0,i.useCallback)((e=>{t(Object.assign(Object.assign({},e),{reject:n=>{e.reject(n),t(void 0)},resolve:n=>{e.resolve(n),t(void 0)}}))}),[]),a=(0,i.useCallback)(((e,t)=>new Promise(((n,i)=>{o({reject:i,resolve:n,text:e,capability:t})}))),[o]),c=(0,i.useMemo)((()=>({develop:e=>a(e,"develop"),summarize:e=>a(e,"summarize"),tldr:e=>a(e,"tldr"),en:e=>a(e,"en"),es:e=>a(e,"es"),formal:e=>a(e,"formal"),funny:e=>a(e,"funny")})),[a]);return{query:e,ext:(0,i.useMemo)((()=>s.JTinyMCEExtensionsBuilders.jia(c,n)),[n,c]),isActive:l}},Zl=d.j.getLazyComponent("InputTinyMCE"),eo=e=>{const t=(0,r.useIntl)(),n=(0,u.jL)(),a=(0,o.useTheme)(),s=(0,u.GV)(c.Kx.selectors.selectAll),{query:d,ext:m,isActive:g}=Kl(),{open:p,onInsert:f,close:E,ext:h,isActive:b}=St(),v=(0,i.useMemo)((()=>[...b?[h]:[],...g?[m]:[]]),[m,h,g,b]),y=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),C=(0,i.useMemo)((()=>(0,jt.X)(s,a,y)),[s,y,a]),x=(0,i.useMemo)((()=>Xl.p9),[]);return l().createElement(l().Fragment,null,x&&l().createElement(Zl,Object.assign({commonOptions:x,additionalExtensions:v,mentionsQueries:C},e)),g&&l().createElement(M,{query:d}),b&&l().createElement(jn,{onInsert:f,open:p,close:E}))},to=d.j.getLazyComponent("InputTinyMCERaw"),no=e=>{const t=(0,r.useIntl)(),n=(0,u.jL)(),a=(0,o.useTheme)(),s=(0,u.GV)(c.Kx.selectors.selectAll),{query:d,ext:m,isActive:g}=Kl(),{open:p,onInsert:f,close:E,ext:h,isActive:b}=St(),v=(0,i.useMemo)((()=>[...b?[h]:[],...g?[m]:[]]),[m,h,g,b]),y=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),C=(0,i.useMemo)((()=>(0,jt.X)(s,a,y)),[s,y,a]),x=(0,i.useMemo)((()=>Xl.p9),[]);return l().createElement(l().Fragment,null,x&&l().createElement(to,Object.assign({commonOptions:x,additionalExtensions:v,mentionsQueries:C},e)),g&&l().createElement(M,{query:d}),b&&l().createElement(jn,{onInsert:f,open:p,close:E}))},io=d.j.getLazyComponent("InputAudience"),lo=d.j.getLazyComponent("Message"),oo=d.j.getLazyComponent("Modal"),ao=({open:e,closeHandler:t,title:n,control:i,warningMessage:o,onSubmit:a,name:s="publishTo"})=>{const c=(0,r.useIntl)();return l().createElement(oo,{open:e,closeHandler:t,title:null!=n?n:c.formatMessage({id:"GLOBAL_Audience"}),buttons:[{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:()=>t()},{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Continue"}),color:"danger",clickHandler:()=>{t(),a()}}]},l().createElement(lo,{variant:"warning",message:null!=o?o:c.formatMessage({id:"FORM_Audience_Empty"})}),l().createElement(io,{asyncPromise:e=>k().audience.autocomplete(e),searchable:!0,control:i,multiple:!0,placeholder:c.formatMessage({id:"GLOBAL_Audience"}),name:s}))};var ro=n(737);const so=d.j.getLazyComponent("Container"),co=d.j.getLazyComponent("AppColumn"),uo=d.j.getLazyComponent("MainColumn");function mo({extensionRoute:e,routes:t,description:n,mode:o="center",mainColumnProps:a}){var s;const c=(0,r.useIntl)(),{pathname:d}=(0,ro.useLocation)(),u=(0,i.useMemo)((()=>Object.values(t)),[t]),[m,g]=(0,i.useState)(null===(s=null==u?void 0:u[0])||void 0===s?void 0:s.key),p=u.map((t=>Object.assign(Object.assign({},t),{label:c.formatMessage({id:t.label}),href:t.absolutePath?t.path:`/ng/rr/${e}/${t.path}`,group:t.group?c.formatMessage({id:t.group}):void 0})));return(0,i.useEffect)((()=>{const t=u.find((t=>{var n;return`/ng/rr/${e}/${t.path}`===d||(null===(n=t.paths)||void 0===n?void 0:n.reduce(((t,n)=>{const i=`/ng/rr/${e}/${n}`,l=null!==(0,ro.matchPath)(i,d);return t||l}),!1))}));t&&g(t.key)}),[d,u,e]),l().createElement(i.Suspense,{fallback:l().createElement(l().Fragment,null)},l().createElement(so,{mode:o},l().createElement(co,{mode:o,description:n,tabs:p,activeTab:m||""}),l().createElement(uo,Object.assign({mode:o,flex:!0},a),l().createElement(ro.Outlet,null))))}}}]);
646
+ //# sourceMappingURL=940.1541e8dee5276c39d4ce.chunk.js.map