jamespot-react-core 1.1.183 → 1.1.185

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.
Files changed (33) hide show
  1. package/build/724.843c4f66e67a00f149d5.chunk.js +561 -0
  2. package/build/724.843c4f66e67a00f149d5.chunk.js.map +1 -0
  3. package/build/app.bundle.js +653 -641
  4. package/build/app.bundle.js.map +1 -1
  5. package/build/socket.sharedworker.36b2317446c7c433029e.js.map +1 -1
  6. package/build/src/ReactCore.d.ts +10 -4
  7. package/build/src/components/widgets/wrapper/JRCWidgetDatasourceTableWrapper.d.ts +1 -1
  8. package/build/src/components/widgets/wrapper/JRCWidgetExcelDatasourceTableWrapper.d.ts +1 -1
  9. package/build/src/components/widgets/wrapper/utils.d.ts +2 -2
  10. package/build/src/displayer/DisplayForm.component.d.ts +1 -2
  11. package/build/src/displayer/types.d.ts +1 -0
  12. package/build/src/displayer/useDisplay.d.ts +1 -2
  13. package/build/src/initTinymce.d.ts +2 -0
  14. package/build/src/redux/store.d.ts +2644 -0
  15. package/build/src/registry/CommonRegistry.d.ts +2 -0
  16. package/build/src/registry/CoreRegistry.d.ts +2 -0
  17. package/build/src/registry/GlobalRegistry.d.ts +13 -0
  18. package/build/src/registry/ReactCommonRegistry.d.ts +13 -0
  19. package/build/src/registry/ReactCoreRegistry.d.ts +13 -0
  20. package/build/src/registry/index.d.ts +1 -0
  21. package/build/src/registry/types.common.d.ts +14 -0
  22. package/build/src/registry/types.core.d.ts +14 -0
  23. package/build/src/types.d.ts +2 -1
  24. package/build/src/utils/socket.d.ts +1 -1
  25. package/build/src/utils/types.d.ts +4 -50
  26. package/build/src/utils/types.socket.d.ts +48 -0
  27. package/build/tsconfig.tsbuildinfo +1 -0
  28. package/package.json +10 -10
  29. package/build/724.4e810912c9eacc41e4bb.chunk.js +0 -559
  30. package/build/724.4e810912c9eacc41e4bb.chunk.js.map +0 -1
  31. package/build/src/registry/ReactRegistry.d.ts +0 -13
  32. package/build/src/registry/Registry.d.ts +0 -2
  33. package/build/src/registry/types.d.ts +0 -31
@@ -1,559 +0,0 @@
1
- "use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[724],{724:(e,t,n)=>{n.r(t),n.d(t,{AIModal:()=>T,Audience:()=>w,Avatar:()=>p,CommentsBloc:()=>qn,DisplayForm:()=>In,EditorsPortal:()=>Di,Empty:()=>zi,JRCInputTinyMCEWithExt:()=>Gi,JRCInputTinyMCEWithExtRaw:()=>Ui,MarkdownModal:()=>Fe,ModalAudience:()=>Vi,TwoColLayout:()=>Yi,WidgetList:()=>Z,WidgetWrapperCore:()=>pn});var i=n(594),l=n.n(i),o=n(196),a=n.n(o),r=n(493),s=n(137),c=n(939),d=n(704),u=n(455);const m=u.O.getLazyComponent("JRCAvatar"),g=u.O.getLazyComponent("Icon"),p=e=>{var t;const n=(0,o.useTheme)(),i=(0,d.useSelector)(c.Bx.selectors.selectNetworkPublic);return e.uri===(null==i?void 0:i.uri)?l().createElement(g,{name:"icon-fs-wall",size:8*(null!==(t=e.size)&&void 0!==t?t:3),color:n.color.primary,variant:"circle"}):l().createElement(m,Object.assign({},e))},E=u.O.getLazyComponent("FlexBox"),f=u.O.getLazyComponent("ModalContent"),h=u.O.getLazyComponent("ModalLayout"),y=u.O.getLazyComponent("StyledHref"),v=u.O.getLazyComponent("Tooltip"),b=u.O.getLazyComponent("Typography"),x=a().div`
2
- display: flex;
3
- flex-direction: column;
4
- gap: 12px;
5
- margin-bottom: 24px;
6
- `,C=a().a`
7
- display: flex;
8
- justify-content: center;
9
- align-items: center;
10
- position: relative;
11
- width: 40px;
12
- height: 40px;
13
- border-radius: 40px;
14
- overflow: hidden;
15
- color: ${e=>e.theme.color.white};
16
- background-color: ${e=>e.theme.color.lavender};
17
- border: 4px solid ${e=>e.theme.color.white};
18
- margin-left: ${e=>e.overlap?"-18px":"0"};
19
- cursor: pointer;
20
- `,w=({audience:e,limit:t=2})=>{const n=(0,r.useIntl)(),a=(0,o.useTheme)(),[c,d]=(0,i.useState)(!1);return l().createElement(l().Fragment,null,l().createElement(E,null,[...e].splice(0,t).map(((e,t)=>l().createElement(C,{overlap:0!==t,href:e._url,target:"_blank",key:e.id},l().createElement(v,{description:void 0===e.title?" ":e.title,position:"left"},l().createElement(p,{uri:e.uri,size:4,variant:"circle",alt:"image",timestamp:e.dateModified?s.Utils.date.strToTimestamp(e.dateModified):void 0,focusable:!0}))))),e.length>t&&l().createElement(C,{onClick:()=>d(!0),overlap:!0},"+",e.length-t)),e.length>t&&l().createElement(h,{closeHandler:()=>d(!1),enableClickAwayCloseModal:!0,open:c,variant:"fixed-height",maxHeight:"800px"},l().createElement(f,{title:n.formatMessage({id:"GLOBAL_Audience"}),overflow:"scroll",onClickIconClose:()=>d(!1)},l().createElement(x,null,e.map(((e,t)=>l().createElement(E,{key:`audience-${t}`,y:"center",gap:a.space.l},l().createElement(p,{size:5,uri:`${e.type}/${e.id}`}),l().createElement(y,{href:`${e.type}/${e.id}`},l().createElement(b,null,e.title)))))))))};var k=n(833),q=n.n(k);const O=u.O.getLazyComponent("Loader"),W=u.O.getLazyComponent("ModalContent"),S=u.O.getLazyComponent("ModalLayout"),L=u.O.getLazyComponent("Typography"),A=a().div`
21
- padding: ${e=>e.theme.space.md}px;
22
- `,M={response:void 0,loading:!0,error:void 0},T=({query:e})=>{const t=(0,r.useIntl)(),[n,a]=(0,i.useState)(M),s=(0,o.useTheme)(),c=(0,i.useCallback)((e=>{a(M),q().jia.textEnhancement({text:e.text,capacity:e.capability}).then((e=>{if(e.error)return void a({error:`${t.formatMessage({id:"JIA_ERROR_AI_CALL"})}${e.errorMsg&&": "+e.errorMsg}`,loading:!1,response:void 0});const n=e.result.text;a({error:void 0,loading:!1,response:n})})).catch((e=>{a({error:t.formatMessage({id:"JIA_ERROR_AI_CALL"}),loading:!1,response:void 0})}))}),[t]);return(0,i.useEffect)((()=>{e&&e.text.trim().length>0&&c(e)}),[e,c]),l().createElement(S,{zIndex:s.zIndex.tinyMCEModal,open:!!e,closeHandler:()=>{null==e||e.reject()}},l().createElement(W,{overflow:"scroll",buttons:[{children:t.formatMessage({id:"GLOBAL_Try_Again"}),clickHandler:()=>{e&&c(e)}},{children:t.formatMessage({id:"GLOBAL_Validation"}),clickHandler:()=>n.response&&(null==e?void 0:e.resolve(n.response))},{children:t.formatMessage({id:"GLOBAL_Cancel"}),clickHandler:()=>null==e?void 0:e.reject()}],isFull:!0},l().createElement(A,null,n.loading&&l().createElement(l().Fragment,null,l().createElement(O,null),l().createElement(L,{align:"center"},t.formatMessage({id:"JIA_WAITING_WARNIG"}))),!n.loading&&n.error&&l().createElement("p",null,n.error),!n.loading&&n.response&&l().createElement("p",null,n.response))))};var I=n(690),_=n(746);var j=n(206),D=n(743);const z=u.O.getLazyComponent("EditorsPortal"),$=u.O.getLazyComponent("ThemeProvider"),R=()=>{const e=document.getElementById("react-portals"),t=(0,i.useMemo)((()=>e&&(e=>{let t=document.getElementById("react-portals");return t||(t=document.createElement("div"),t.id=(0,D.A)(),e.appendChild(t)),t})(e)),[e]);return t?(0,j.createPortal)(l().createElement($,null,l().createElement(z,null)),t):null},F=a().div`
23
- display: flex;
24
- flex-direction: row;
25
- flex-wrap: wrap;
26
- gap: 10px;
27
- justify-content: center;
28
- `,G=a().div`
29
- border: 1px solid ${e=>e.theme.color.grey2};
30
- border-radius: 8px;
31
- cursor: pointer;
32
- padding: 12px;
33
- position: relative;
34
- opacity: ${e=>e.available?"1":".4"};
35
- pointer-events: ${e=>e.available?"all":"none"};
36
-
37
- .show-on-hover {
38
- position: absolute;
39
- inset: 0;
40
- border-radius: 8px;
41
- justify-content: center;
42
- align-items: center;
43
- display: flex;
44
- opacity: 0;
45
- background-color: #ffffffe6;
46
- }
47
-
48
- &:hover {
49
- .show-on-hover {
50
- opacity: 1;
51
- }
52
- }
53
- `,B=a().div`
54
- border: 2px solid ${e=>e.theme.color.primary};
55
- height: ${e=>e.open?e.height:"54"}px;
56
- border-radius: 8px;
57
- display: flex;
58
- justify-content: top;
59
- flex-direction: column;
60
- transition: height 0.4s;
61
- overflow: hidden;
62
- flex-direction: column;
63
- `,U=a().div`
64
- display: flex;
65
- flex-direction: row;
66
- flex-wrap: wrap;
67
- justify-content: center;
68
- gap: 10px;
69
- ${e=>e.column&&"flex-direction: column;"}
70
- `,H=a().div`
71
- min-height: 50px;
72
- display: flex;
73
- justify-content: center;
74
- align-items: center;
75
- cursor: pointer;
76
- color: ${e=>e.theme.color.primary};
77
- &:hover {
78
- background-color: ${e=>e.theme.color.grey0};
79
- }
80
- `,N=a().button`
81
- display: flex;
82
- align-items: center;
83
- padding: ${e=>e.parentIsColumn?"36px 16px":"0 10px"};
84
- gap: 10px;
85
- width: 40%;
86
- border: 1px solid ${e=>e.theme.color.grey1};
87
- border-radius: 8px;
88
- transition: opacity 0.4s ease ${e=>40*e.index}ms;
89
- opacity: ${e=>e.open?1:0};
90
- img {
91
- width: 40px;
92
- }
93
- ${e=>e.full&&"flex: 1; width: 100%;"}
94
- ${e=>e.parentIsColumn&&"flex-basis: 72px;"}
95
- ${e=>!e.parentIsColumn&&"height: 72px;"}
96
- &:hover {
97
- background-color: ${e=>e.theme.color.grey0};
98
- }
99
-
100
- ${(0,s.DashedFocusBorder)()}
101
- `,P=a().div`
102
- display: flex;
103
- flex-direction: ${e=>"row"===e.direction?"row":"column"};
104
- align-items: ${e=>"row"===e.direction?"center":"flex-start"};
105
- justify-content: ${e=>"row"===e.direction?"flex-start":"center"};
106
- flex: 1;
107
- ${e=>e.gap&&`gap:${e.gap}px`}
108
- `,V=u.O.getLazyComponent("Button"),Q=u.O.getLazyComponent("ModalLayout"),K=u.O.getLazyComponent("ModalContent"),X=u.O.getLazyComponent("Tooltip"),Y=u.O.getLazyComponent("IconButton"),Z=({mode:e,view:t,children:n,namespace:i="default",onChange:o})=>{const[a,s]=l().useState(!1),d=function(e){switch(e){case"widget-article-image":return[c.x0.definition(k.WidgetsName.ArticleTitle),c.x0.definition(k.WidgetsName.ArticleButton)];case"comment":return[c.x0.definition(k.WidgetsName.CheckList),c.x0.definition(k.WidgetsName.Presence),c.x0.definition(k.WidgetsName.QuickSurvey)];default:return[c.x0.definition(k.WidgetsName.ArticleTitle),c.x0.definition(k.WidgetsName.ArticleText),c.x0.definition(k.WidgetsName.ArticleImage),c.x0.definition(k.WidgetsName.ArticleButton),c.x0.definition(k.WidgetsName.ArticleSlider),c.x0.definition(k.WidgetsName.ArticleAttachment),c.x0.definition(k.WidgetsName.Presence)]}}(i),u=(0,r.useIntl)(),m={open:a,portalId:"react-modal",variant:"full-height",closeHandler:()=>s(!1)},g=e=>{o(c.x0.factory(e)),s(!1)};return l().createElement(l().Fragment,null,l().createElement(Q,Object.assign({},m),l().createElement(K,{onClickIconClose:m.closeHandler,buttons:"comment"===e?[{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Close"}),color:"cancel",clickHandler:()=>s(!1)}]:void 0,title:u.formatMessage({id:"WIDGET_Builder"})},"comment"===e?l().createElement(U,{column:!0},d.map(((e,t)=>l().createElement(N,{key:e.name,open:!0,full:!0,parentIsColumn:!0,index:t,onClick:()=>g(e.name)},l().createElement(P,{direction:"row",gap:12},l().createElement("img",{src:e.img}),l().createElement(P,{direction:"column"},l().createElement("h3",null,u.formatMessage({id:e.label})),l().createElement("p",null,u.formatMessage({id:e.description})))))))):l().createElement(F,null,d.map(((e,t)=>l().createElement(G,{key:t,onClick:()=>g(e.name),available:e.available},l().createElement("img",{src:e.img}),l().createElement("div",{className:"show-on-hover"},u.formatMessage({id:e.label})))))))),"custom"===e&&n?l().createElement("div",{onClick:()=>s(!0)},n):l().createElement(l().Fragment,null),"button"===e&&"edit"===t?l().createElement(V,{onClick:()=>s(!0),variant:"outlined",minWidth:"100%"},u.formatMessage({id:"WIDGET_Add_Widget"})):l().createElement(l().Fragment,null),"gallery"===e&&"edit"===t?l().createElement(F,null,d.map(((e,t)=>l().createElement(G,{key:t,onClick:()=>g(e.name),available:e.available},l().createElement("img",{src:e.img}),l().createElement("div",{className:"show-on-hover"},u.formatMessage({id:e.label})))))):l().createElement(l().Fragment,null),"article"===e&&"edit"===t?l().createElement(ee,{widgets:d,onClick:g}):l().createElement(l().Fragment,null),"comment"===e&&"edit"===t?l().createElement(te,{onClick:()=>{s(!0)}}):l().createElement(l().Fragment,null))},ee=({widgets:e,onClick:t})=>{const[n,o]=l().useState(!1),a=(0,r.useIntl)(),s=(0,i.useMemo)((()=>80*Math.ceil(e.length/2)+50+10),[e]);return l().createElement(l().Fragment,null,l().createElement(B,{open:n,height:s},l().createElement(H,{onClick:()=>o(!n)},a.formatMessage({id:"WIDGET_Add_Widget"})),l().createElement(U,null,e.map(((e,i)=>l().createElement(N,{key:e.name,open:n,index:i,onClick:()=>t(e.name)},l().createElement("img",{src:e.img}),a.formatMessage({id:e.label})))))))},te=({onClick:e})=>{const t=(0,r.useIntl)();return l().createElement(l().Fragment,null,l().createElement(X,{description:t.formatMessage({id:"COMMENT_Add_Widget"})},l().createElement(Y,{bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:22,onClick:()=>{e()},icon:"icon-fs-puzzle"})))};var ne=n(876);const ie=u.O.getLazyComponent("InputFileAdvancedRaw"),le=a().div`
109
- width: 0;
110
- height: 0;
111
- overflow: hidden;
112
- `,oe=({children:e,initialFiles:t,initialClick:n,multiple:i,accept:o,onUploadStart:a,onUploadEnd:r,onUploadSuccess:s})=>{const u=l().useRef(null),m=(0,d.useSelector)(c.x0.selectors.selectToken),[g,p]=l().useState(0),[E,f]=l().useState(t);return l().useEffect((()=>{var e;n&&(null===(e=u.current)||void 0===e||e.click())}),[n]),l().useEffect((()=>{t.length!==E.length&&f(t)}),[t]),l().useEffect((()=>{s(E)}),[E]),l().useEffect((()=>{0===g&&r()}),[g]),l().createElement(l().Fragment,null,l().createElement("div",{onClick:()=>{var e;n&&(null===(e=u.current)||void 0===e||e.click())}},e),l().createElement(le,null,l().createElement(ie,{ref:u,id:"widget-upload-file",name:"editorFiles",content:"",accept:o,multiple:i,token:m,onUploadStart:e=>{void 0!==e&&p((t=>t+e)),"function"==typeof a&&0!==e&&a()},onUploadSuccess:e=>{void 0!==e&&(p((e=>void 0!==e?e-1:0)),f((t=>i?[...t,e]:[e])))}})))},ae=u.O.getLazyComponent("WidgetAttachment"),re=u.O.getLazyComponent("WidgetEmptyInplace"),se=u.O.getLazyComponent("FileViewer"),ce=a().div`
113
- flex: 1;
114
- `,de=({widget:e,inplace:t,mode:n})=>{const o=(0,r.useIntl)(),{uniqid:a}=e,{files:s}=e.content,u=(0,d.useDispatch)(),m=(0,d.useSelector)((e=>c.x0.selectors.isActive(e,a)),d.shallowEqual),g=e=>{u(c.y8.actions.error({label:null!=e?e:o.formatMessage({id:"GLOBAL_Error"})}))};(0,i.useEffect)((()=>{u(c.x0.slice.actions.setWidgetState({uniqid:a,mounted:!0}))}),[]),(0,i.useEffect)((()=>{u(c.x0.slice.actions.setWidgetState({uniqid:a,empty:!s||0===s.length}))}),[s]);const p=(0,d.useSelector)((e=>c.lg.selectors.selectById(e,"OnlyOfficeHook"))),E=[{label:o.formatMessage({id:"WIDGET_Open_With_Wedoc"}),onClick:e=>{e&&q().object.getAccessHash(`fileArticle/${e.id}`).then((t=>{if(""===t.result)throw new Error("result empty");const n=t.result;((e,t)=>{window.open(function(e,t){return`/ng/rr/file/${e}/${t}`}(e,t),void 0)})(e.id,n)})).catch((()=>{u(c.y8.actions.error({label:"WIDGET_Open_Failed"},6e3))}))}}],f=p?[{condition:e=>["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation"].includes(e.mimetype),options:E}]:[];return void 0!==s?l().createElement(ce,null,"view"!==n?l().createElement(ae,{files:s,onClick:()=>{},onError:g}):l().createElement(se,{files:s,openWithOptions:f},(e=>l().createElement(ae,{files:s,onClick:t=>e(t),onError:g}))),t&&"view"!==n&&l().createElement(oe,{initialFiles:s,initialClick:m,multiple:!0,accept:"*",onUploadSuccess:e=>{Array.isArray(e)&&u((0,c.vR)(a,{files:e}))},onUploadStart:()=>{u(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!0}))},onUploadEnd:()=>{u(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!1}))}},"edit"===n?l().createElement(re,{label:"WIDGET_Article_Attachment_Empty_Label",description:"WIDGET_Article_Attachment_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}}):l().createElement(l().Fragment,null))):l().createElement(l().Fragment,null)},ue=u.O.getLazyComponent("WidgetButton"),me=a().div`
115
- display: flex;
116
- flex: 1;
117
- justify-content: center;
118
- align-items: center;
119
- `,ge=a().div`
120
- pointer-events: ${e=>e.clickable?"all":"none"};
121
- cursor: pointer;
122
- display: flex;
123
- flex: 1;
124
- justify-content: center;
125
- align-items: center;
126
- `,pe=({widget:e,mode:t})=>{const n=(0,d.useDispatch)(),{uniqid:o}=e,{text:a,url:r,target:s,color:u,backgroundColor:m,buttonSize:g,borderRadius:p,variant:E}=e.content;return(0,i.useEffect)((()=>{n(c.x0.slice.actions.setWidgetState({uniqid:o,empty:!a||0===a.length}))}),[a]),l().createElement(me,{onClick:()=>{"edit"===t&&n(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}},l().createElement(ge,{clickable:"edit"!==t},l().createElement(ue,{text:a,url:r,target:s,color:u,backgroundColor:m,buttonSize:g,borderRadius:p,variant:E})))},Ee=u.O.getLazyComponent("WidgetArticleGallery"),fe=u.O.getLazyComponent("WidgetEmptyInplace"),he=u.O.getLazyComponent("FileViewer"),ye=a().button`
127
- cursor: pointer;
128
- `,ve=({widget:e,inplace:t,mode:n})=>{var i,o;const{uniqid:a}=e,{files:r}=e.content,s=(0,d.useDispatch)(),u=(0,d.useSelector)((e=>c.x0.selectors.isActive(e,a)),d.shallowEqual);return l().useEffect((()=>{s(c.x0.slice.actions.setWidgetState({uniqid:a,mounted:!0}))}),[]),void 0!==r?l().createElement(l().Fragment,null,"edit"===n?l().createElement(Ee,{files:r,maxWidth:800,gap:null!==(i=e.content.gap)&&void 0!==i?i:"10",column:null!==(o=e.content.column)&&void 0!==o?o:"3",onClick:()=>{}}):l().createElement(he,{files:r,openWithOptions:[]},(t=>{var n,i;return l().createElement(ye,null,l().createElement(Ee,{files:r,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(oe,{initialFiles:r,initialClick:u,accept:"image/png, image/jpeg, image/jpg",multiple:!0,onUploadSuccess:e=>{Array.isArray(e)&&s((0,c.vR)(a,{files:e}))},onUploadStart:()=>{s(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!0}))},onUploadEnd:()=>{s(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!1}))}},l().createElement(fe,{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)},be=u.O.getLazyComponent("WidgetImage"),xe=u.O.getLazyComponent("FileViewer"),Ce=u.O.getLazyComponent("WidgetEmptyInplace"),we=a().div`
129
- position: absolute;
130
- inset: 0;
131
- background-color: rgba(0, 0, 0, 0.4);
132
- pointer-events: none;
133
- display: flex;
134
- justify-content: center;
135
- align-items: center;
136
- opacity: 0;
137
- color: ${e=>e.theme.color.white};
138
- &:hover {
139
- opacity: 1;
140
- }
141
- `,ke=a().button`
142
- cursor: pointer;
143
- `,qe={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},Oe=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},We=({widget:e,width:t,inplace:n,mode:o})=>{const{uniqid:a}=e,{file:s,useFilter:u}=e.content,m=(0,d.useDispatch)(),g=(0,d.useSelector)((e=>c.x0.selectors.isActive(e,a)),d.shallowEqual),[p,E]=(0,i.useState)(void 0),f=(0,r.useIntl)();return(0,i.useEffect)((()=>{m(c.x0.slice.actions.setWidgetState({uniqid:a,mounted:!0}))}),[]),(0,i.useEffect)((()=>{m(c.x0.slice.actions.setWidgetState({uniqid:a,empty:!s}))}),[s]),(0,i.useEffect)((()=>{s&&E((0,k.formatImgUrl)({timestamp:s.dateModified?Oe(s.dateModified):Date.now(),from:"imagecache",size:"fitx1200",uri:s.uri}))}),[s]),l().createElement(l().Fragment,null,"edit"===o?void 0!==p?l().createElement(be,{maxWidth:null!=t?t:600,uri:p,useFilter:null!=u&&u}):l().createElement(l().Fragment,null):l().createElement(xe,{files:[Object.assign(Object.assign({},qe),{path:p,mimetype:"image/png"})],openWithOptions:[]},(e=>l().createElement(ke,{onClick:()=>e(0)},l().createElement(be,{maxWidth:null!=t?t:600,uri:p,useFilter:null!=u&&u})))),n&&"edit"===o?l().createElement(oe,{initialFiles:[],initialClick:g,accept:"image/png, image/jpeg, image/jpg",multiple:!1,onUploadSuccess:e=>{Array.isArray(e)&&void 0!==e[0]&&m((0,c.vR)(a,{file:e[0]}))},onUploadStart:()=>{m(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!0}))},onUploadEnd:()=>{m(c.x0.slice.actions.setWidgetState({uniqid:a,loading:!1}))}},void 0!==s?l().createElement(we,null,f.formatMessage({id:"ARTICLE_Widget_Image_Change"})):l().createElement(Ce,{label:"WIDGET_Article_Image_Empty_Label",description:"WIDGET_Article_Image_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}})):l().createElement(l().Fragment,null))};var Se=n(750);const Le=u.O.getLazyComponent("FileViewer"),Ae=u.O.getLazyComponent("WidgetEmptyInplace"),Me=u.O.getLazyComponent("WidgetSlider"),Te=a().div`
144
- flex: 1;
145
- display: flex;
146
- flex-direction: row;
147
- min-height: 60px;
148
- align-items: center;
149
- width: ${e=>e.maxWidth}px;
150
- `,Ie={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},_e=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},je=({widget:e,mode:t,width:n})=>{const{uniqid:o}=e,a=(0,Se.jL)(),r=(0,d.useSelector)((e=>c.x0.selectors.isActive(e,o)),d.shallowEqual),s=null!=n?n:600,[u,m]=(0,i.useState)(void 0),g=(0,i.useRef)(null),p=(0,i.useMemo)((()=>e.content.slides?[...e.content.slides.map(((e,t)=>Object.assign(Object.assign({},Ie),{id:e.file?e.file.id:t,mimetype:e.file?e.file.mimetype:Ie.mimetype,path:(0,k.formatImgUrl)({size:"fitx1200",uri:e.file?e.file.uri:"",from:"imagecache",timestamp:e.file&&e.file.dateModified?_e(e.file.dateModified):Date.now()})})))]:[]),[e.content.slides]),E=(0,i.useMemo)((()=>void 0!==e.content.slides?[...e.content.slides.map((e=>e.file?Object.assign(Object.assign({},e),{uri:(0,k.formatImgUrl)({timestamp:e.file.dateModified?_e(e.file.dateModified):Date.now(),size:`fitx${u&&u<s?u:s}`,from:"imagecache",uri:e.file.uri})}):Object.assign(Object.assign({},e),{uri:""})))]:[]),[e.content.slides,u,s]);(0,i.useEffect)((()=>{r&&"edit"===t&&a(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}),[r]),(0,i.useEffect)((()=>{const e=()=>{g.current&&m(g.current?g.current.offsetWidth:s)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[g]),(0,i.useEffect)((()=>{m(g.current?g.current.offsetWidth:s)}),[g]),(0,i.useEffect)((()=>{a(c.x0.slice.actions.setWidgetState({uniqid:o,empty:!e.content.slides||0===e.content.slides.length}))}),[e.content.slides]);const f=(0,i.useMemo)((()=>"edit"===t&&Array.isArray(e.content.slides)&&0===e.content.slides.length),[e.content.slides,t]),h=(0,i.useCallback)((()=>{a(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))}),[a,e.uniqid,e.name]);return void 0===u?l().createElement("div",{ref:g,style:{width:"100%"}}):l().createElement(Te,{maxWidth:u&&u<s?u:s},l().createElement(Le,{files:p,openWithOptions:[]},(n=>{var i,r;return l().createElement(Me,{slides:E,maxWidth:u&&u<s?u:s,useDots:null===(i=e.content.useDots)||void 0===i||i,loop:null!==(r=e.content.loop)&&void 0!==r&&r,startAt:0,onClickSlide:i=>{if("edit"!==t){if(e.content.slides){const t=e.content.slides[i];t&&t.file&&n(t.file.id)}}else a(c.cr.slice.actions.registerEditor({uniqid:o,name:e.name}))}})})),f?l().createElement(Ae,{label:"WIDGET_Article_Slider_Empty_Label",description:"WIDGET_Article_Slider_Empty_Description",url:"widget-article-image-placeholder.png",onClick:h}):l().createElement(l().Fragment,null))};var De=n(912),ze=n(201);const $e=u.O.getLazyComponent("InputTextareaRaw"),Re=u.O.getLazyComponent("Modal"),Fe=({onInsert:e,open:t,close:n})=>{const o=(0,r.useIntl)(),[a,s]=l().useState(""),c=(0,i.useCallback)((()=>{s(""),n()}),[n]);return l().createElement(Re,{title:o.formatMessage({id:"TINY_MCE_Insert_Markdown"}),open:t,closeHandler:c,enableClickAwayCloseModal:!0,buttons:[{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:c},{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Insert"}),color:"valid",disabled:!a,clickHandler:()=>{e(ze.xI.parse(a,{async:!1}).replace(/<br>/g,"<br><br>")),c()}}]},l().createElement($e,{value:a,onChange:e=>s(e.target.value),height:"400px"}))},Ge=()=>{const e=(0,r.useIntl)(),[t,n]=(0,i.useState)(!1),[l,o]=(0,i.useState)();return{open:t,onInsert:e=>{null==l||l.execCommand("InsertHTML",!1,e)},close:()=>n(!1),ext:(0,i.useMemo)((()=>s.JTinyMCEExtensionsBuilders.markdown((e=>{o(e),n(!0)}),e)),[e]),isActive:!0}},Be=De.default.registry.getLazyComponent("WidgetArticleText"),Ue=a().div`
151
- width: 100%;
152
- cursor: text;
153
- p {
154
- word-wrap: break-word;
155
- }
156
- a {
157
- word-wrap: break-word;
158
- }
159
- `,He=({widget:e,mode:t})=>{const{uniqid:n}=e,a=(0,o.useTheme)(),{text:s}=e.content,u=(0,d.useDispatch)(),m=(0,d.useSelector)((e=>c.x0.selectors.isActive(e,n)),d.shallowEqual),g=(0,d.useSelector)((e=>{var t;return null===(t=c.x0.selectors.selectWidgetState(e,n))||void 0===t?void 0:t.busy})),p=(0,d.useSelector)(c.x0.selectors.selectToken),E=(0,d.useSelector)(c.sU.selectors.selectTinyMCECommonOptions),f=(0,d.useSelector)(c.Kx.selectors.selectAll),h=(0,r.useIntl)(),{open:y,onInsert:v,close:b,ext:x,isActive:C}=Ge(),w=(0,i.useCallback)((e=>{u(c.y8.actions.error({label:null!=e?e:h.formatMessage({id:"GLOBAL_Error"})}))}),[u,h]);(0,i.useEffect)((()=>{u(c.x0.slice.actions.setWidgetState({uniqid:n,empty:!s||0===s.length}))}),[s]);const k=(0,i.useMemo)((()=>(0,De.getTinyMCEMentionsQueries)(f,a,w)),[f,w,a]);return g?l().createElement(l().Fragment,null):l().createElement(Ue,null,l().createElement(Be,{autoFocus:m,text:null!=s?s:"",token:"edit"===t&&void 0!==p?p:"",tinyMCECommonOptions:"edit"===t&&E?{commonOptions:E,mentionsQueries:k}:void 0,mode:t,onChange:e=>{u((0,c.vR)(n,{text:e}))},additionalExtensions:[x]}),C&&l().createElement(Fe,{onInsert:v,open:y,close:b}))},Ne=u.O.getLazyComponent("WidgetArticleTitle"),Pe=a().div`
160
- flex: 1;
161
- display: flex;
162
- flex-direction: row;
163
- align-items: center;
164
- cursor: text;
165
- `,Ve=a().div`
166
- display: flex;
167
- flex-direction: row;
168
- border-radius: 8px;
169
- overflow: hidden;
170
- margin: 4px;
171
- border: 1px solid ${e=>e.theme.color.grey1};
172
- `,Je=a().button`
173
- display: flex;
174
- width: 40px;
175
- height: 40px;
176
- justify-content: center;
177
- align-items: center;
178
- cursor: pointer;
179
- opacity: ${e=>e.isActive?"1.0":".8"};
180
- background-color: ${e=>e.isActive?e.theme.color.grey1:e.theme.color.white};
181
- &:hover {
182
- background-color: ${e=>e.theme.color.grey1};
183
- }
184
- `,Qe=({widget:e,inplace:t,mode:n})=>{const{uniqid:o}=e,{text:a,color:r,heading:s}=e.content,u=(0,d.useDispatch)(),m=(0,d.useSelector)((e=>c.x0.selectors.isActive(e,o)),d.shallowEqual);return(0,i.useEffect)((()=>{u(c.x0.slice.actions.setWidgetState({uniqid:o,empty:!a||0===a.length}))}),[a]),l().createElement(Pe,null,l().createElement(Ne,{text:a,color:r,heading:s,autoFocus:m,inplace:t,mode:n,onChange:e=>{u((0,c.vR)(o,{text:e}))}}),m&&"edit"===n?l().createElement(Ke,{heading:s,onClick:e=>{u((0,c.vR)(o,{heading:e}))}}):l().createElement(l().Fragment,null))},Ke=({heading:e="h1",onClick:t})=>l().createElement(Ve,null,["h1","h2","h3","h4"].map(((n,i)=>l().createElement(Je,{key:i,isActive:e===n,onClick:()=>t(n)},n)))),Xe=u.O.getLazyComponent("Button"),Ye=u.O.getLazyComponent("ModalLayout"),Ze=u.O.getLazyComponent("ModalContent"),et=(a().button`
185
- padding: ${e=>e.theme.space.md}px;
186
- `,a().div`
187
- padding: ${e=>e.theme.space.md}px;
188
- display: flex;
189
- flex-direction: row-reverse;
190
- `),tt=({id:e,type:t,uniqid:n})=>{const o=(0,d.useDispatch)(),a=(0,r.useIntl)(),[u,m]=(0,i.useState)(!1);return l().createElement(l().Fragment,null,l().createElement(s.JRCIconButton,{iconSize:14,onClick:()=>m(!0),icon:"icon-trash"}),u&&l().createElement(Ye,{enableClickAwayCloseModal:!0,open:u,closeHandler:()=>m(!1)},l().createElement(Ze,{overflow:"scroll",title:a.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>m(!1)},a.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})),l().createElement(et,null,l().createElement(Xe,{label:a.formatMessage({id:"GLOBAL_Confirm"}),onClick:()=>{q().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"}))))}}))))},nt=a().div`
191
- display: flex;
192
- flex: 1;
193
- flex-direction: row;
194
- border-top: 1px solid ${e=>e.theme.color.grey1};
195
- `,it=a().button`
196
- display: flex;
197
- flex: 1;
198
- justify-content: center;
199
- align-items: center;
200
- background-color: ${e=>e.theme.color.white};
201
- &:hover {
202
- background-color: ${e=>e.theme.color.grey0};
203
- }
204
- `,lt=({name:e,uniqid:t,mode:n,collaborationRights:o,handleOpenEditor:a})=>{const s=(0,r.useIntl)(),u=(0,d.useDispatch)(),m=(0,d.useSelector)((e=>c.x0.selectors.selectWidgetObject(e,t)),d.shallowEqual),g=(0,d.useSelector)((e=>c.x0.selectors.selectWidgetObjectRights(e,t)),d.shallowEqual),p=(0,i.useMemo)((()=>m&&g&&g.update||o&&o.update),[m,g,o]),E=(0,i.useMemo)((()=>m&&g&&g.delete),[m,g]),f=(0,i.useCallback)((()=>{u(c.cr.slice.actions.registerEditor({uniqid:t,name:e,mode:n}))}),[t,u,e,n]);return p&&(0,k.ensureWidgetObjectHasMinimumProperties)(m)?l().createElement(nt,null,l().createElement(it,{onClick:null!=a?a:f},s.formatMessage({id:"WIDGET_Set_Widget"})),E&&l().createElement(tt,{id:m.id,type:m.type,uniqid:t})):l().createElement(l().Fragment,null)},ot=a().div`
205
- position: absolute;
206
- inset: 0;
207
- display: flex;
208
- justify-content: center;
209
- align-items: center;
210
- background-color: rgba(255, 255, 255, 0.4);
211
- `,at=()=>l().createElement(ot,null,l().createElement(s.JRCLoader,{size:"m"}));var rt=n(655);const st=a().div`
212
- padding: ${e=>e.theme.space.md}px;
213
- display: flex;
214
- flex-direction: row;
215
- fieldset {
216
- margin: 0.2rem !important;
217
- }
218
- `,ct=({placeholder:e,handleClick:t})=>{const n=(0,r.useIntl)(),o=(0,d.useDispatch)(),[a,c]=(0,i.useState)(""),{control:u,watch:m,reset:g}=(0,rt.useForm)({defaultValues:{label:a},criteriaMode:"all"});return(0,i.useEffect)((()=>{const e=m((e=>{var t;c(null!==(t=e.label)&&void 0!==t?t:"")}));return()=>e.unsubscribe()}),[m,o]),l().createElement(st,null,l().createElement(s.JRCInputText,{name:"label",control:u,placeholder:e,width:"100%"}),l().createElement(s.JRCButton,{label:n.formatMessage({id:"GLOBAL_Confirm"}),disabled:!a.length,onClick:()=>{t(a),c(""),g()}}))};var dt=n(586);const ut=u.O.getLazyComponent("WidgetCheckList"),mt=u.O.getLazyComponent("WidgetCheckListEditor"),gt=(a().div`
219
- display: flex;
220
- flex-direction: row;
221
- justify-content: space-between;
222
- align-items: center;
223
- border: ${e=>e.border?`1px solid ${e.theme.color.grey2}`:"none"};
224
- min-height: 24px;
225
- border-radius: 4px;
226
- padding: 4px 8px;
227
- `,a().div`
228
- width: 100%;
229
- display: flex;
230
- gap: 14px;
231
- padding: 16px;
232
- `),pt=a().div`
233
- position: relative;
234
- `,Et=({widget:e,inplace:t,mode:n,onWidgetUpdate:o})=>{var a;const u=(0,r.useIntl)(),{uniqid:m,content:g}=e,p=(0,d.useDispatch)(),[E,f]=(0,i.useState)(),[h,y]=(0,i.useState)(!1),v=(0,d.useSelector)(c.x0.selectors.selectToken,d.shallowEqual),b=(0,d.useSelector)((t=>c.x0.selectors.selectWidgetObjectUri(t,e.uniqid)),d.shallowEqual),x=(0,d.useSelector)((e=>c.x0.selectors.selectWidgetObjectRights(e,m)),d.shallowEqual),C=(0,d.useSelector)((t=>c.x0.selectors.selectAllWidgetRTObject(t,e.uniqid)),d.shallowEqual),w=(0,i.useMemo)((()=>x&&x.update),[x]),O=(0,i.useMemo)((()=>x&&x.administrate),[x]),W=(0,i.useCallback)((e=>{p(c.y8.actions.error({label:null!=e?e:u.formatMessage({id:"GLOBAL_Error"})}))}),[p,u]),S=(0,i.useCallback)(((e,t)=>{p((0,c.vR)(e,t))}),[p]),L=(0,i.useCallback)((()=>{b&&(y(!0),q().widget.getWidget({uri:b,uniqid:m}).then((e=>{(0,k.ensureWidgetCheckListType)(e.result)&&S(m,e.result.content)})).catch((e=>!e.aborted&&W)).finally((()=>y(!1))))}),[m,W,b,S]),A=t=>{p(c.cr.slice.actions.flushAllEditor()),p(c.x0.slice.actions.setToken({token:t})),p(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:k.WidgetsName.CheckList,mode:n}))};(0,i.useEffect)((()=>{v||"edit"!==n||q().network.token().then((e=>{p(c.x0.slice.actions.setToken({token:e.result}))}))}),[n,v,p]),(0,i.useEffect)((()=>{var t;const n=null===(t=e.content.arr)||void 0===t?void 0:t.map((e=>{var t,n,i,l;return Object.assign(Object.assign(Object.assign({text:null!==(t=e.title)&&void 0!==t?t:"",file:null!==(n=e.file)&&void 0!==n?n:void 0,checked:null!==(i=e.value)&&void 0!==i&&i},e.links&&{links:e.links}),e.user&&{user:null!==(l=e.user)&&void 0!==l?l:void 0}),e.id&&{id:e.id,mimetype:"image/png"})}));f(n)}),[e.content.arr,g]),(0,i.useEffect)((()=>{if(!Array.isArray(C))return;const t=C.at(-1);t&&b&&t.object.uri===b&&t.uniqid===e.uniqid&&("check-list-response"!==t.fn&&"widget-update"!==t.fn||L())}),[C,e.uniqid,b,W,p,L]);const M=t=>{if(!e.content.arr||!b)return;const n=Object.assign(Object.assign({},e.content),{arr:[...e.content.arr,{title:t,value:!1}]});q().widget.updateWidget({uri:b,uniqid:e.uniqid,content:n,v2:!0}).then((()=>S(e.uniqid,n))).catch((e=>W(e.errorMsg)))},T=(0,i.useMemo)((()=>{if(!Array.isArray(g.arr))return[];const e=[];return g.arr.forEach((t=>{t.file&&e.push(t.file)})),e}),[g]);return"edit"===n&&t?l().createElement(gt,null,l().createElement(mt,{token:v,uniqid:m,content:Object.assign(Object.assign({},g),{arr:null===(a=g.arr)||void 0===a?void 0:a.map((e=>Object.assign(Object.assign({},e),{title:s.Utils.html.htmlDecodeSpecialChars(e.title)})))}),inplace:t,onChangeContent:S,onChangeWrapper:e=>{p(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:t=>p((0,c.vR)(e.uniqid,t))})):l().createElement(dt.M,{useRT:()=>{(0,ne.AW)(e.uniqid)}},E&&l().createElement(s.JRCFileViewer,{files:T,openWithOptions:[]},(t=>l().createElement(pt,{key:e.uniqid},l().createElement(ut,{limit:10,initialEntries:E,onFileClick:e=>e.id&&t(e.id),onItemCheckListChange:t=>((e,t)=>{b&&(h||(y(!0),q().widget.checkListRespond({uri:b,uniqid:e,index:t}).then((()=>{o&&o()})).catch((e=>{W(e.message),y(!1)}))))})(e.uniqid,t)}),g.edit&&l().createElement(ct,{handleClick:M,placeholder:u.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Add_New_Task"})}),O&&v&&l().createElement(lt,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!(!g.edit&&!w)},mode:n,handleOpenEditor:()=>{v?A(v):(y(!0),q().network.token().then((e=>{p(c.x0.slice.actions.setToken({token:e.result})),A(e.result)})).finally((()=>y(!1))))}}),h&&l().createElement(at,null)))))},ft=(e,t)=>{const n=[];return e.filter((e=>e.isVisible)).forEach((e=>{const i=t.find((t=>t.name===e.name));i&&n.push(i)})),n},ht=u.O.getLazyComponent("Button"),yt=u.O.getLazyComponent("Html"),vt=u.O.getLazyComponent("WidgetTable"),bt=u.O.getLazyComponent("Loader"),xt=(a().div``,a().div`
235
- position: absolute;
236
- inset: 0;
237
- display: flex;
238
- flex-direction: column;
239
- justify-content: center;
240
- align-items: center;
241
- gap: ${e=>e.theme.space.md}px;
242
- `),Ct=a().div`
243
- position: absolute;
244
- inset: 0;
245
- display: flex;
246
- flex-direction: row;
247
- justify-content: center;
248
- align-items: center;
249
- gap: ${e=>e.theme.space.md}px;
250
- color: ${e=>e.theme.color.primary};
251
- cursor: pointer;
252
- opacity: 0;
253
- border: 1px solid ${e=>e.theme.color.primary};
254
- &:hover {
255
- background-color: ${e=>e.theme.color.grey2};
256
- opacity: 0.9;
257
- }
258
- `,wt=({uniqid:e,uri:t,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:u,tableColumnsData:m=[],tableBorderRadius:g,tableSizedColumns:p,tableSizedColumnsWidth:E,mode:f})=>{const h=(0,r.useIntl)(),y=(0,Se.jL)(),[v,b]=(0,i.useState)(!1),[x,C]=(0,i.useState)(!1),[w,O]=(0,i.useState)([]),[W,S]=(0,i.useState)([]),[L,A]=(0,i.useState)({order:"ascending",name:"unknown"}),[M,T]=(0,i.useState)(void 0),[I,_]=(0,i.useState)(""),j=(0,i.useMemo)((()=>c.x0.definition(k.WidgetsName.DatasourceTable)),[]),D=(0,i.useMemo)((()=>"studio"===M?[{type:[I]}]:[]),[M,I]),z=(0,i.useMemo)((()=>"doc"===M?[I]:[]),[M,I]),{rtLastObject:$}=(0,ne.YL)(D,z),R=(0,i.useCallback)((()=>{t&&(C(!0),q().datasource.get(t,k.Format.VIEW).then((e=>{S(e.result.model),O(e.result.data),A(e.result.sort),T(e.result.datasource.datasourceType),_(e.result.datasource.datasourceIdentifier)})).finally((()=>C(!1))))}),[t]);(0,i.useEffect)((()=>{void 0!==t&&0!==m.length&&0===W.length&&R()}),[t,m,W,R]),(0,i.useEffect)((()=>{$&&R()}),[$,R]),(0,i.useEffect)((()=>{t||S([])}),[t]);const F=(0,i.useCallback)((()=>{y(c.cr.slice.actions.flushAllEditor()),setTimeout((()=>{y(c.cr.slice.actions.registerEditor({uniqid:e,name:k.WidgetsName.DatasourceTable}))}),0)}),[y,e]);(0,i.useEffect)((()=>{"view"!==f&&"preview"!==f||y(c.cr.slice.actions.flushAllEditor())}),[f,y]),(0,i.useEffect)((()=>{v||t||"edit"!==f||(F(),b(!0))}),[y,e,v,t,F,f]);const G=(0,i.useMemo)((()=>ft(m,W)),[m,W]);return 0!==m.length||x||"edit"!==f?x?l().createElement(xt,null,l().createElement(bt,null)):l().createElement(l().Fragment,null,x||0!==w.length?l().createElement(vt,{rows:w,columns:G,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:u,tableBorderRadius:g,tableColumnsData:m,tableSizedColumns:p,tableSizedColumnsWidth:E,tableDefaultSortOrder:L.order,tableDefaultSortName:L.name}):l().createElement(xt,null,l().createElement("img",{src:`/img/fast-intranet/${k.WidgetsName.DatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:"WIDGET_Datasource_No_Results"})),"edit"===f?l().createElement(Ct,{onClick:F},l().createElement(yt,{__html:`${h.formatMessage({id:"WIDGET_Set_Widget"})} <b>${h.formatMessage({id:j.label})}</b>`})):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null,l().createElement(xt,{onClick:F},l().createElement("img",{src:`/img/fast-intranet/${k.WidgetsName.DatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:j.label}),l().createElement(ht,{label:"GLOBAL_Settings"})),l().createElement(Ct,{onClick:F},l().createElement(yt,{__html:`${h.formatMessage({id:"WIDGET_Set_Widget"})} <b>${h.formatMessage({id:j.label})}</b>`})))},kt=u.O.getLazyComponent("Button"),qt=u.O.getLazyComponent("Html"),Ot=u.O.getLazyComponent("WidgetTable"),Wt=u.O.getLazyComponent("Loader"),St=(a().div``,a().div`
259
- position: absolute;
260
- inset: 0;
261
- display: flex;
262
- flex-direction: column;
263
- justify-content: center;
264
- align-items: center;
265
- gap: ${e=>e.theme.space.md}px;
266
- `),Lt=a().div`
267
- position: absolute;
268
- inset: 0;
269
- display: flex;
270
- flex-direction: row;
271
- justify-content: center;
272
- align-items: center;
273
- gap: ${e=>e.theme.space.md}px;
274
- color: ${e=>e.theme.color.primary};
275
- cursor: pointer;
276
- opacity: 0;
277
- border: 1px solid ${e=>e.theme.color.primary};
278
- &:hover {
279
- background-color: ${e=>e.theme.color.grey2};
280
- opacity: 0.9;
281
- }
282
- `,At=({uniqid:e,uri:t,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:u,tableColumnsData:m=[],tableBorderRadius:g,tableSizedColumns:p,tableSizedColumnsWidth:E,mode:f})=>{const h=(0,r.useIntl)(),y=(0,Se.jL)(),[v,b]=(0,i.useState)(!1),[x,C]=(0,i.useState)(!1),[w,O]=(0,i.useState)([]),[W,S]=(0,i.useState)([]),L=(0,i.useMemo)((()=>c.x0.definition(k.WidgetsName.ExcelDatasourceTable)),[]);(0,i.useEffect)((()=>{void 0!==t&&0!==m.length&&0===W.length&&(C(!0),q().datasource.get(t,k.Format.VIEW).then((e=>{S(e.result.model),O(e.result.data)})).finally((()=>C(!1))))}),[t,m,W]),(0,i.useEffect)((()=>{t||S([])}),[t]);const A=(0,i.useCallback)((()=>{y(c.cr.slice.actions.flushAllEditor()),setTimeout((()=>y(c.cr.slice.actions.registerEditor({uniqid:e,name:k.WidgetsName.ExcelDatasourceTable}))),0)}),[y,e]);(0,i.useEffect)((()=>{"view"!==f&&"preview"!==f||y(c.cr.slice.actions.flushAllEditor())}),[f,y]),(0,i.useEffect)((()=>{v||t||"edit"!==f||(A(),b(!0))}),[y,e,v,t,A,f]);const M=(0,i.useMemo)((()=>ft(m,W)),[m,W]);return 0!==m.length||x||"edit"!==f?x?l().createElement(St,null,l().createElement(Wt,null)):l().createElement(l().Fragment,null,x||0!==w.length?l().createElement(Ot,{rows:w,columns:M,limit:n,tableHeadColor:o,tableHeadTextColor:a,tableHeadIconColor:s,tableRowColor:d,tableRowTextColor:u,tableBorderRadius:g,tableColumnsData:m,tableSizedColumns:p,tableSizedColumnsWidth:E}):l().createElement(St,null,l().createElement("img",{src:`/img/fast-intranet/${k.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:"WIDGET_Datasource_No_Results"})),"edit"===f?l().createElement(Lt,{onClick:A},l().createElement(qt,{__html:`${h.formatMessage({id:"WIDGET_Set_Widget"})} <b>${h.formatMessage({id:L.label})}</b>`})):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null,l().createElement(St,{onClick:A},l().createElement("img",{src:`/img/fast-intranet/${k.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),l().createElement(r.FormattedMessage,{id:L.label}),l().createElement(kt,{label:"GLOBAL_Settings"})),l().createElement(Lt,{onClick:A},l().createElement(qt,{__html:`${h.formatMessage({id:"WIDGET_Set_Widget"})} <b>${h.formatMessage({id:L.label})}</b>`})))},Mt=a().div`
283
- padding: ${e=>e.theme.space.md}px;
284
- `,Tt=a().a`
285
- cursor: pointer;
286
- color: ${e=>e.theme.color.secondary};
287
- `,It=a().div`
288
- display: flex;
289
- justify-content: center;
290
- align-items: center;
291
- `,_t=({mode:e,uniqid:t,content:n})=>{const o=(0,r.useIntl)(),a=(0,d.useDispatch)(),s=(0,d.useSelector)((e=>c.x0.selectors.selectWidgetObjectUri(e,t)),d.shallowEqual),u=(0,d.useSelector)((e=>c.x0.selectors.selectWidgetObjectRights(e,t)),d.shallowEqual),m=(0,i.useMemo)((()=>!(!u||!u.update)),[u]),g=(0,i.useCallback)((()=>{if("edit"===e||!m||!s)return;const i=Object.assign(Object.assign({},n),{isClosed:!0});q().widget.updateWidget({uri:s,uniqid:t,content:i,v2:!0}).then((()=>a(c.x0.slice.actions.updateWidget({uniqid:t,content:i})))).catch((()=>a(c.y8.actions.error({label:"WIDGET_Presence_Error"}))))}),[e,t,m,s,n,a]);return l().createElement(l().Fragment,null,m&&!n.isClosed&&l().createElement(Mt,null,l().createElement(It,null,l().createElement(Tt,{onClick:g},o.formatMessage({id:"WIDGET_Presence_Closing"})))))},jt=u.O.getLazyComponent("WidgetPresence"),Dt=u.O.getLazyComponent("ModalUserList"),zt=a().div`
292
- display: flex;
293
- flex: 1;
294
- position: relative;
295
- flex-direction: column;
296
- `,$t=(a().div`
297
- position: absolute;
298
- inset: 0;
299
- background-color: rgba(255, 255, 255, 0.7);
300
- display: flex;
301
- flex: 1;
302
- justify-content: center;
303
- align-items: center;
304
- `,a().div`
305
- flex: 1;
306
- display: flex;
307
- padding: ${e=>e.theme.space.md}px;
308
- border: 1px dashed ${e=>e.theme.color.orange};
309
- justify-content: center;
310
- align-items: center;
311
- border-radius: ${e=>e.theme.space.sm}px;
312
- margin: ${e=>e.theme.space.sm}px;
313
- `),Rt=({widget:e,mode:t})=>{const n=(0,r.useIntl)(),o=(0,d.useDispatch)(),{limit:a,limitValue:s,closing:u,isClosed:m}=e.content,{uniqid:g}=e,[p,E]=(0,i.useState)({userValue:-1,userAvailableList:[],userUnavailableList:[],userAvailableTotal:0,userUnavailableTotal:0}),[f,h]=(0,i.useState)(!1),[y]=(0,i.useState)(new AbortController),[v,b]=(0,i.useState)(!1),[x,C]=(0,i.useState)(),[w,k]=(0,i.useState)(),O=(0,i.useRef)(y),W=(0,d.useSelector)((e=>c.x0.selectors.selectWidgetObjectUri(e,g)),d.shallowEqual),S=(0,d.useSelector)((e=>c.x0.selectors.selectAllWidgetRTObject(e,g)),d.shallowEqual),L=(0,i.useCallback)((()=>o(c.y8.actions.error({label:"WIDGET_Presence_Error"}))),[o]),A=(0,i.useMemo)((()=>!(a&&s&&p.userAvailableTotal>=s)),[a,s,p.userAvailableTotal]),M=(0,i.useMemo)((()=>u&&m||"edit"===t),[u,m,t]),T=(0,i.useCallback)((()=>{W&&!M&&(A?(h(!0),q().widget.presenceCancel({uri:W,uniqid:g}).catch(L).finally((()=>h(!1)))):o(c.y8.actions.error({label:"WIDGET_Presence_Limit_Response_Error"})))}),[o,g,L,W,A,M]),I=(0,i.useCallback)((e=>{W&&!M&&(h(!0),q().widget.presenceRespond({uri:W,uniqid:g,value:e},O.current.signal).catch(L).finally((()=>h(!1))))}),[W,g,L,M]),_=(0,i.useCallback)((()=>{"edit"!==t&&W&&(h(!0),q().widget.presenceGetResponse({uri:W,uniqid:g},O.current.signal).then((e=>{E(e.result)})).catch((e=>!e.aborted&&L())).finally((()=>h(!1))))}),[W,L,g,t]),j=(e,t)=>{W&&q().widget.presenceGetResponseUserList({uri:W,uniqid:g,index:e,page:t,limit:8},O.current.signal).then((e=>{k(Object.assign(Object.assign({},e.result),{data:[...e.result.data],cnt:e.result.cnt}))})).catch((e=>!e.aborted&&L))},D=(0,i.useCallback)((()=>{W&&(h(!0),q().widget.getWidget({uri:W,uniqid:g}).then((e=>{o((0,c.vR)(g,e.result))})).catch((e=>!e.aborted&&L)).finally((()=>h(!1))))}),[o,L,W,g]);return(0,i.useEffect)((()=>{const e=O.current;return()=>{e.abort()}}),[]),(0,i.useEffect)((()=>{_()}),[_]),(0,i.useEffect)((()=>{if(!Array.isArray(S))return;const e=S.at(-1);e&&W&&e.object.uri===W&&e.uniqid===g&&("widget-presence-response"===e.fn&&_(),"widget-update"===e.fn&&D())}),[S,_,g,W,D]),l().createElement(dt.M,{useRT:()=>{(0,ne.AW)(e.uniqid)}},l().createElement(zt,null,l().createElement(jt,{limit:a,limitValue:s,userAvailableList:p.userAvailableList,userUnavailableList:p.userUnavailableList,userValue:p.userValue,userAvailableTotal:null==p?void 0:p.userAvailableTotal,userUnavailableTotal:null==p?void 0:p.userUnavailableTotal,isClosed:u&&m,handleClickAvailable:()=>1===p.userValue?T():I(1),handleClickUnavailable:()=>0===p.userValue?T():I(0),handleOpenUsersModal:e=>{k({limit:0,page:0,data:[],cnt:0}),C(e),j(e),b(!0)}}),u&&m&&l().createElement($t,null,n.formatMessage({id:"WIDGET_Presence_Is_Closed"})),u&&!m&&l().createElement(_t,{mode:t,uniqid:e.uniqid,content:e.content}),"view"===t&&l().createElement(lt,{uniqid:e.uniqid,name:e.name,mode:t}),f&&l().createElement(at,null),l().createElement(Dt,{open:v,usersList:w,title:1===x?n.formatMessage({id:"WIDGET_Presence_On"}):n.formatMessage({id:"WIDGET_Presence_Off"}),setOpen:b,onClose:()=>{k({limit:0,page:0,data:[],cnt:0})},handleLoadUsersList:e=>{j(null!=x?x:0,e)}})))},Ft=u.O.getLazyComponent("WidgetQuickSurvey"),Gt=u.O.getLazyComponent("WidgetQuickSurveyEditor"),Bt=u.O.getLazyComponent("ModalUserList"),Ut=a().div`
314
- width: 100%;
315
- display: flex;
316
- flex-direction: column;
317
- gap: 14px;
318
- ${e=>e.withPadding&&"padding: 0 12px;"}
319
- padding-top: 16px;
320
- `,Ht=({widget:e,inplace:t,mode:n})=>{var o,a,u;const m=(0,r.useIntl)(),g=(0,d.useDispatch)(),{uniqid:p,content:E}=e,[f,h]=(0,i.useState)({userResponses:[],totalRespondent:0,totalResponse:0,userLoggedResponses:[]}),[y,v]=(0,i.useState)(!1),[b,x]=(0,i.useState)(!1),[C,w]=(0,i.useState)(),[O,W]=(0,i.useState)(),[S]=(0,i.useState)(new AbortController),L=(0,i.useRef)(S),A=(0,d.useSelector)(c.x0.selectors.selectToken,d.shallowEqual),M=(0,d.useSelector)((t=>c.x0.selectors.selectWidgetObjectUri(t,e.uniqid)),d.shallowEqual),T=(0,d.useSelector)((e=>c.x0.selectors.selectWidgetObjectRights(e,p)),d.shallowEqual),I=(0,d.useSelector)((t=>c.x0.selectors.selectAllWidgetRTObject(t,e.uniqid)),d.shallowEqual),_=(0,i.useCallback)(((e,t)=>{g((0,c.vR)(e,t))}),[g]),j=t=>{g(c.cr.slice.actions.flushAllEditor()),g(c.x0.slice.actions.setToken({token:t})),g(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:k.WidgetsName.QuickSurvey}))},D=(0,i.useCallback)((()=>g(c.y8.actions.error({label:"WIDGET_Presence_Error"}))),[g]),z=(0,i.useCallback)((e=>{"edit"!==n&&M&&(x(!0),q().widget.quickSurveyGetResponse({uri:M,uniqid:e},L.current.signal).then((e=>{h(e.result)})).catch((e=>!e.aborted&&D)).finally((()=>x(!1))))}),[D,M,n]),$=(0,i.useCallback)((()=>{M&&(x(!0),q().widget.getWidget({uri:M,uniqid:p},L.current.signal).then((e=>{_(p,e.result.content)})).catch((e=>!e.aborted&&D)).finally((()=>x(!1))))}),[p,D,M,_]),R=()=>{if(M&&E.closing){const e=Object.assign(Object.assign({},E),{isClosed:!0});q().widget.updateWidget({uri:M,uniqid:p,content:e}).catch((()=>{D()}))}},F=t=>{(t=>{"edit"!==n&&M&&(x(!0),q().widget.quickSurveyRespond({uri:M,index:t,multi:E.multi?1:0,uniqid:p},L.current.signal).then((()=>{z(e.uniqid)})).catch((e=>!e.aborted&&D)).finally((()=>x(!1))))})(t)},G=(e,t)=>{M&&q().widget.quickSurveyGetResponseUserList({uri:M,uniqid:p,index:e,page:t,limit:8},L.current.signal).then((e=>{W(Object.assign(Object.assign({},e.result),{data:[...e.result.data],cnt:e.result.cnt}))})).catch((e=>!e.aborted&&D))},B=(0,i.useMemo)((()=>T&&T.update),[T]);(0,i.useEffect)((()=>{z(e.uniqid)}),[z,e.uniqid]),(0,i.useEffect)((()=>{if(!Array.isArray(I))return;const t=I.at(-1);t&&M&&t.object.uri===M&&t.uniqid===e.uniqid&&("widget-quick-survey-response"===t.fn&&z(e.uniqid),"widget-update"===t.fn&&$())}),[I,M,e.uniqid,$,z]);const U=(0,i.useMemo)((()=>{if(!Array.isArray(E.arr))return[];const e=[];return E.arr.forEach((t=>{t.file&&e.push(t.file)})),e}),[E]);return(0,i.useEffect)((()=>{A||"edit"!==n||q().network.token().then((e=>{g(c.x0.slice.actions.setToken({token:e.result}))}))}),[n,A,g]),"edit"===n&&t?l().createElement(Ut,{withPadding:!0},l().createElement(Gt,{token:A,uniqid:p,content:e.content,onChangeContent:_,onChangeWrapper:e=>{g(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:e=>_(p,e),inplace:t})):l().createElement(dt.M,{useRT:()=>{(0,ne.AW)(e.uniqid)}},l().createElement(Ut,null,l().createElement(s.JRCFileViewer,{files:U,openWithOptions:[]},(t=>{var n,i,o,a,r,s,c;return l().createElement(Ft,{limit:null!==(n=f.totalResponse)&&void 0!==n?n:0,values:null!==(i=E.arr)&&void 0!==i?i:[],userResponses:f.userResponses,userHasAlreadyVoted:f.userLoggedResponses.length>0,canCloseSurvey:null!==(o=e.content.closing)&&void 0!==o&&o,isClosed:null!==(a=e.content.isClosed)&&void 0!==a&&a,open:null!==(r=e.content.open)&&void 0!==r&&r,anonymize:null!==(s=e.content.anonymize)&&void 0!==s&&s,seeResponseAfter:null!==(c=e.content.seeResponseAfter)&&void 0!==c&&c,canUpdate:B,handleClickFile:e=>e.id&&t(e.id),handleCloseSurvey:R,handleProgressBarClick:F,setOpenUsersModal:e=>{w(e),G(e),v(!0)}})})),E.open&&l().createElement(ct,{handleClick:e=>{var t;if(!M)return;const n=Object.assign(Object.assign({},E),{arr:[...null!==(t=E.arr)&&void 0!==t?t:[],{title:e}]});q().widget.quickSurveyAddEnty({uri:M,uniqid:p,label:e}).then((()=>{g(c.x0.slice.actions.updateWidget({uniqid:p,content:n}))})).catch(D)},placeholder:m.formatMessage({id:"FIELDS_Add_Option"})}),B&&l().createElement(lt,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!!B},mode:n,handleOpenEditor:()=>{A?j(A):(x(!0),q().network.token().then((e=>{g(c.x0.slice.actions.setToken({token:e.result})),j(e.result)})).finally((()=>x(!1))))}}),b&&l().createElement(at,null),l().createElement(Bt,{open:y,usersList:O,title:null!==(u=null===(a=null===(o=E.arr)||void 0===o?void 0:o[null!=C?C:0])||void 0===a?void 0:a.title)&&void 0!==u?u:"",setOpen:v,handleLoadUsersList:e=>{G(null!=C?C:0,e)},onClose:()=>{W({limit:0,page:0,data:[],cnt:0})}})))},Nt=a().div`
321
- padding: ${e=>e.theme.space.md}px;
322
- border-bottom: 1px solid ${e=>e.theme.color.grey1};
323
- `,Pt=({uniqid:e})=>{var t;const n=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e)),d.shallowEqual);return l().createElement(l().Fragment,null,n&&"string"==typeof n.title&&0!==n.title.length&&l().createElement(Nt,null,l().createElement(s.JRCHtml,{__html:null!==(t=n.title)&&void 0!==t?t:""})))},Vt=({uniqid:e})=>{const t=(0,r.useIntl)(),n=(0,d.useDispatch)(),o=(0,d.useSelector)((t=>{var n;return null===(n=c.x0.selectors.selectWidget(t,e))||void 0===n?void 0:n.title}),d.shallowEqual),{control:a,watch:u}=(0,rt.useForm)({defaultValues:{widgetTitle:o},criteriaMode:"all"});return(0,i.useEffect)((()=>{const t=u((t=>{n(c.x0.slice.actions.updateWidgetWrapper({uniqid:e,title:t.widgetTitle}))}));return()=>t.unsubscribe()}),[u,n,e]),l().createElement(s.JRCInputText,{name:"widgetTitle",control:a,placeholder:t.formatMessage({id:"GLOBAL_Title"}),width:"100%",margin:"0"})},Jt=u.O.getLazyComponent("Button"),Qt=u.O.getLazyComponent("ModalLayout"),Kt=u.O.getLazyComponent("ModalContent"),Xt=a().div`
324
- padding: ${e=>e.theme.space.md}px;
325
- display: flex;
326
- flex-direction: row-reverse;
327
- `,Yt=a().div`
328
- flex: 1;
329
- display: flex;
330
- flex-direction: row;
331
- gap: ${e=>e.theme.space.sm}px;
332
- padding: ${e=>e.theme.space.sm}px;
333
- border-bottom: 1px solid ${e=>e.theme.color.grey1};
334
- `,Zt=a().div`
335
- flex: 1;
336
- display: flex;
337
- fieldset:first-of-type {
338
- margin: 0px !important;
339
- }
340
- `,en=a().div`
341
- display: flex;
342
- gap: ${e=>e.theme.space.sm}px;
343
- `,tn=({uniqid:e,name:t,handleOpenEditor:n})=>{const o=(0,Se.jL)(),a=(0,r.useIntl)(),[d,u]=(0,i.useState)(!1),m=(0,i.useCallback)((()=>{o(c.cr.slice.actions.registerEditor({uniqid:e,name:t,mode:"edit"}))}),[e,o,t]),g=(0,i.useCallback)((()=>{o(c.x0.slice.actions.flushWidget({uniqid:e}))}),[e,o]);return l().createElement(l().Fragment,null,l().createElement(Yt,null,l().createElement(Zt,null,l().createElement(Vt,{uniqid:e})),l().createElement(en,null,l().createElement(s.JRCIconButton,{icon:"icon-pencil",bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:14,onClick:null!=n?n:m,title:a.formatMessage({id:"BUTTON_Title_Open_Edit_Panel"})}),l().createElement(s.JRCIconButton,{icon:"icon-trash",bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:14,onClick:()=>u(!0),title:a.formatMessage({id:"BUTTON_Title_Open_Remove_Widget"})}))),d&&l().createElement(Qt,{enableClickAwayCloseModal:!0,open:d,closeHandler:()=>u(!1)},l().createElement(Kt,{overflow:"scroll",title:a.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>u(!1)},a.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})),l().createElement(Xt,null,l().createElement(Jt,{label:a.formatMessage({id:"GLOBAL_Confirm"}),onClick:g}))))},nn=a().div`
344
- display: flex;
345
- flex: 1;
346
- flex-direction: column;
347
- `,ln=({widget:e,width:t,inplace:n=!1,mode:i="view",onWidgetUpdate:o,cannotDisplayComponent:a})=>{const{name:r}=e;return(0,k.ensureWidgetArticleButtonType)(e)?l().createElement(pe,{widget:e,inplace:n,mode:i}):(0,k.ensureWidgetArticleGalleryType)(e)?l().createElement(ve,{widget:e,inplace:n,mode:i}):(0,k.ensureWidgetArticleAttachmentType)(e)?l().createElement(de,{widget:e,inplace:n,mode:i}):(0,k.ensureWidgetArticleImageType)(e)?l().createElement(We,{widget:e,inplace:n,mode:i}):(0,k.ensureWidgetArticleSliderType)(e)?l().createElement(je,{widget:e,inplace:n,mode:i,width:null!=t?t:800}):(0,k.ensureWidgetArticleTitleType)(e)?l().createElement(Qe,{widget:e,inplace:n,mode:i}):(0,k.ensureWidgetArticleTextType)(e)?l().createElement(He,{widget:e,inplace:n,mode:i}):(0,k.ensureWidgetExcelDatasourceTableType)(e)?l().createElement(nn,null,l().createElement(Pt,{uniqid:e.uniqid}),l().createElement(At,Object.assign({},e.content,{uniqid:e.uniqid,mode:i}))):(0,k.ensureWidgetDatasourceTableType)(e)?l().createElement(nn,null,l().createElement(Pt,{uniqid:e.uniqid}),l().createElement(wt,Object.assign({},e.content,{uniqid:e.uniqid,mode:i}))):(0,k.ensureWidgetCheckListType)(e,"widget-check-list"===e.name)?l().createElement(nn,null,"edit"===i?l().createElement(tn,{name:e.name,uniqid:e.uniqid}):l().createElement(Pt,{uniqid:e.uniqid}),l().createElement(Et,{widget:e,inplace:n,mode:i,onWidgetUpdate:o})):(0,k.ensureWidgetPresenceType)(e)?l().createElement(nn,null,"edit"===i?l().createElement(tn,{name:e.name,uniqid:e.uniqid}):l().createElement(Pt,{uniqid:e.uniqid}),l().createElement(Rt,{widget:e,inplace:n,mode:i})):(0,k.ensureWidgetQuickSurveyType)(e)?l().createElement(nn,null,"edit"===i?l().createElement(tn,{name:e.name,uniqid:e.uniqid}):l().createElement(Pt,{uniqid:e.uniqid}),l().createElement(Ht,{widget:e,inplace:n,mode:i})):a?l().createElement(l().Fragment,null,a(r)):l().createElement(l().Fragment,null,"cannot display widget (",r,")")},on=(a().div`
348
- height: 0;
349
- overflow: hidden;
350
- `,a().div`
351
- color: ${e=>e.theme.color.grey3};
352
- font-style: italic;
353
- `,a().div`
354
- display: flex;
355
- flex: 1;
356
- width: 100%;
357
- border: 0;
358
- min-height: ${50}px;
359
- margin: 0;
360
- align-items: center;
361
- border-radius: ${8}px;
362
- padding: 8px;
363
- cursor: pointer;
364
- gap: 10px;
365
- color: ${e=>e.color?e.color:e.theme.font.color};
366
- transition: opacity 0.4s;
367
-
368
- &:hover {
369
- img {
370
- filter: grayscale(0);
371
- opacity: 1;
372
- }
373
- }
374
-
375
- img {
376
- filter: grayscale(1);
377
- opacity: 0.4;
378
- }
379
- `,a().div`
380
- position: absolute;
381
- inset: 0;
382
- display: flex;
383
- flex: 1;
384
- justify-content: center;
385
- align-items: center;
386
- min-height: 200px;
387
- `,a().div`
388
- display: flex;
389
- `),an=a().div`
390
- position: absolute;
391
- inset: 0;
392
- opacity: ${e=>e.opacity};
393
- background-color: ${e=>e.backgroundColor};
394
- pointer-events: ${e=>e.pointerEvents};
395
- `,rn=u.O.getLazyComponent("DoubleClick"),sn=({uniqid:e,mode:t})=>{const n=(0,d.useSelector)((t=>t.widgets.ids[e].widget.layers),d.shallowEqual);return l().createElement(l().Fragment,null,null==n?void 0:n.map(((e,t)=>l().createElement(cn,{uniqid:e,key:t,mode:"edit"}))))},cn=({uniqid:e,mode:t})=>{const n=(0,d.useSelector)((t=>t.widgets.layers[e]));return"view"===t?l().createElement(an,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},n.widgets.map(((e,t)=>l().createElement(dn,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):l().createElement(an,{opacity:n.visible?1:0,backgroundColor:n.visible?"rgba(255,255,255,.1)":"transparent",pointerEvents:n.locked?"none":"all"},n.widgets.map(((e,t)=>l().createElement(dn,{key:t,layerId:n.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},dn=({uniqid:e,layerId:t,mode:n})=>{const i=(0,d.useDispatch)(),o=(0,d.useSelector)((t=>t.widgets.ids[e]),d.shallowEqual),a=(0,d.useSelector)((e=>e.widgets.layers[t]));return o&&a&&a.position?"view"===n?l().createElement("div",{style:{position:"absolute",top:a.position.y,left:a.position.x}},l().createElement(En,{uniqid:e,widget:o,mode:n,inplace:!0})):l().createElement(un,{position:{x:a.position.x,y:a.position.y},onMouseUp:e=>{(a.position&&a.position.x!==e.x||a.position&&a.position.y!==e.y)&&(e=>{i(c.x0.slice.actions.updateLayer({uniqid:t,props:{position:e}}))})(e)}},l().createElement(rn,{onDoubleTap:()=>((e,t)=>{i(c.cr.slice.actions.registerEditor({uniqid:e,name:t}))})(o.widget.uniqid,o.widget.name)},l().createElement(En,{uniqid:e,widget:o,mode:n,inplace:!0}))):l().createElement(l().Fragment,null)},un=({position:e,children:t,onMouseUp:n})=>{const[o,a]=l().useState(!1),[r,s]=l().useState({x:0,y:0}),[c,d]=l().useState({x:0,y:0}),[u,m]=l().useState({x:e.x,y:e.y}),g=l().useRef(null),p=(0,i.useCallback)((e=>{a(!0),g.current&&(s({x:e.nativeEvent.clientX,y:e.nativeEvent.clientY}),d({x:u.x,y:u.y}))}),[u.x,u.y]),E=l().useCallback((e=>{if(o&&g.current){const t=c.x+(e.clientX-r.x),n=c.y+(e.clientY-r.y);m({x:t,y:n})}}),[r.x,r.y,o,c.x,c.y]),f=(0,i.useCallback)((()=>{a(!1),n({x:u.x,y:u.y})}),[u.x,u.y,n]);return l().useEffect((()=>(document.addEventListener("mousemove",E),document.addEventListener("mouseup",f),()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",f)})),[E,f]),l().createElement("div",{style:{position:"absolute",top:u.y,left:u.x},ref:g,onMouseDown:p},t)},mn=u.O.getLazyComponent("Loader"),gn=({name:e,uniqid:t,inplace:n})=>{const i=(0,d.useSelector)((e=>c.x0.selectors.selectWidgetState(e,t))),o=c.x0.definition(e);return(null==i?void 0:i.loading)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}},l().createElement(mn,null)):(null==i?void 0:i.hover)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}}):!(null==i?void 0:i.initialized)&&n||(null==i?void 0:i.initialized)||n?l().createElement(l().Fragment,null):l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,1)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}},l().createElement("img",{src:o.img}))},pn=({uniqid:e,widgetObject:t,widget:n,inplace:o=!0,mode:a,width:r,onWidgetUpdate:s,cannotDisplayComponent:u})=>{const m=(0,d.useDispatch)(),g=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e))),p=(0,d.useSelector)((t=>t.widgets.editableMap[e]),d.shallowEqual),E=(0,d.useSelector)((e=>e.widgets.currentEditableWidgetId),d.shallowEqual),f=(0,d.useSelector)((t=>t.widgets.currentEditableWidgetId===e),d.shallowEqual),{ref:h,isComponentVisible:y,setIsComponentVisible:v}=(0,ne.xv)(!1);if((0,i.useEffect)((()=>{t&&m(c.x0.slice.actions.registerWidgetObject({uniqid:e,object:t}))}),[]),(0,i.useEffect)((()=>{n&&m(c.x0.slice.actions.registerWidget({uniqid:e,widget:n}))}),[]),(0,i.useEffect)((()=>{y||e===E&&m(c.x0.slice.actions.setEditableWidgetId({uniqid:void 0}))}),[y]),(0,i.useEffect)((()=>{y!==f&&v(f)}),[f]),void 0===g)return l().createElement(l().Fragment,null,"This widget cannot be displayed");const b=g.widget,x=()=>{"edit"===a?C():(0,k.ensureWidgetArticleButtonType)(b)&&"link"===b.content.openingType&&b.content.openingTypeLink&&window.open(b.content.openingTypeLink.url,b.content.openingTypeLink.target)},C=()=>{if("view"===a)return;const{widget:e}=g;m(c.cr.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))};return o&&"view"!==a?l().createElement(on,{ref:h,onClick:()=>{v(!0),p&&(m(c.x0.slice.actions.setEditableIndex({index:p.index})),m(c.x0.slice.actions.setEditableWidgetId({uniqid:e})))}},l().createElement(ln,{width:r,widget:Object.assign(Object.assign({},g.widget),g.title&&{title:g.title}),inplace:o,mode:a,onClick:x}),l().createElement(sn,{uniqid:e,mode:a}),l().createElement(gn,{name:g.widget.name,uniqid:g.widget.uniqid,inplace:o})):l().createElement(on,{onClick:C},l().createElement(ln,{widget:Object.assign(Object.assign({},g.widget),g.title&&{title:g.title}),inplace:o,mode:a,width:r,onClick:x,onWidgetUpdate:s,cannotDisplayComponent:u}),l().createElement(sn,{uniqid:e,mode:a}),l().createElement(gn,{name:g.widget.name,uniqid:g.widget.uniqid,inplace:o}))},En=pn,fn=a().div`
396
- border-radius: ${e=>e.theme.space.sm}px;
397
- border: 1px solid ${e=>e.theme.color.grey1};
398
- background-color: ${e=>e.theme.color.white};
399
- overflow: hidden;
400
- `,hn=u.O.getLazyComponent("Message"),yn=({widgets:e})=>{const t=(0,r.useIntl)(),n=(0,d.useSelector)(c.x0.selectors.selectFlushedWidgets,d.shallowEqual);return l().createElement(l().Fragment,null,e.filter((e=>!n.includes(e.widget.uniqid))).map((e=>e&&e.widget&&l().createElement(fn,{key:e.widget.uniqid},l().createElement(En,{uniqid:e.widget.uniqid,widget:e,inplace:!0,mode:"edit",cannotDisplayComponent:e=>l().createElement(hn,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))},vn=u.O.getLazyComponent("Message"),bn=e=>{const t=(0,r.useIntl)(),{widgets:n,comment:i,inplace:o,mode:a,handleWidgetUpdate:s}=e,u=(0,d.useSelector)(c.x0.selectors.selectFlushedWidgets,d.shallowEqual);return l().createElement(l().Fragment,null,n.filter((e=>!u.includes(e.widget.uniqid))).map((e=>e&&l().createElement(fn,{key:e.widget.uniqid},l().createElement(En,{uniqid:e.widget.uniqid,widgetObject:i,widget:e,inplace:o,mode:a,onWidgetUpdate:s,cannotDisplayComponent:e=>l().createElement(vn,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})})})))))};var xn=n(730),Cn=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 wn=u.O.getLazyComponent("JRCCommentsBloc"),kn=a().div`
401
- display: flex;
402
- flex-direction: column;
403
- gap: 4px;
404
- flex: 1;
405
- width: 100%;
406
- margin-top: 10px;
407
- `,qn=({articleId:e,variant:t="inline",canComment:n,commentType:a="comment",socialQuestion:s})=>{var u;const m=(0,r.useIntl)(),g=(0,o.useTheme)(),p=(0,d.useDispatch)(),[E,f]=(0,i.useState)(),[h,y]=(0,i.useState)(!1),[v,b]=(0,i.useState)([]),[x,C]=(0,i.useState)(!1),w=(0,d.useSelector)(c.xJ.selectors.get),k=(0,d.useSelector)(c.x0.selectors.selectWidgets),O=(0,d.useSelector)(c.sU.selectors.selectTinyMCECommonOptions),W=(0,d.useSelector)(c.sU.selectors.selectTinyMCEExtendedOptions),S=(0,d.useSelector)(c.Kx.selectors.selectAll),L=(0,d.useSelector)(c.OD.selectors.selectPlatformConfig),A=(0,d.useSelector)((e=>c.lg.selectors.selectById(e,"OnlyOfficeHook"))),M=(0,d.useSelector)((t=>c.Mw.selectors.commentList(t,e))),T=(0,d.useSelector)((e=>c.qn.selectors.selectHook(e,"DriveHook"))),j=(0,d.useSelector)((e=>c.lg.selectors.selectById(e,"FileBankHook"))),D=(0,d.useSelector)((e=>c.qn.selectors.selectHook(e,"WidgetHook"))),[z,$]=(0,i.useState)(s),{open:F,onInsert:G,close:B,ext:U,isActive:H}=Ge();(0,I.A)(e),((e,t)=>{const n=(0,d.useDispatch)(),l=(0,i.useMemo)((()=>_.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])})(M.map((e=>e.id)),e);const N=(0,i.useCallback)((e=>{p(c.y8.actions.error({label:null!=e?e:m.formatMessage({id:"GLOBAL_Error"})}))}),[p,m]),P=()=>{p(c.Mw.actions.fetchComments({idArticle:e})),V()},V=(0,i.useCallback)((()=>{E||x||(C(!0),q().network.token().then((e=>{f(e.result),C(!1),p(c.x0.slice.actions.setToken({token:e.result}))})).catch((e=>{N(e.errorMsg)})))}),[N,E,x,p]),J=(0,i.useCallback)((t=>Cn(void 0,void 0,void 0,(function*(){if(E){y(!0);const n=Object.keys(k).map((e=>(null==v?void 0:v.some((t=>t.widget.uniqid===e)))?k[e]:null)).filter((e=>null!==e));try{yield q().article.addComment(Object.assign(Object.assign({},t),{widgets:n,token:E,idArticle:e,type:a})).then((()=>{b([])})),V()}catch(e){N(e.errorMsg)}finally{y(!1)}}}))),[e,a,V,N,E,k,v]);return(0,i.useEffect)((()=>{V()}),[V]),(0,i.useEffect)((()=>{p(c.Mw.actions.fetchComments({idArticle:e}))}),[e,p]),(0,i.useEffect)((()=>{M&&M.forEach((e=>{var t;null===(t=e._widgets)||void 0===t||t.forEach((t=>{p(c.x0.slice.actions.registerWidgetObject({uniqid:t.widget.uniqid,object:e})),p(c.x0.slice.actions.registerWidgetObjectRights({uniqid:t.widget.uniqid,rights:e._right}))}))}))}),[M,p]),l().createElement(l().Fragment,null,O&&W&&l().createElement(l().Fragment,null,l().createElement(kn,null,l().createElement(wn,{canComment:n,loading:h,token:E,comments:M,onComment:J,onCommentUpdate:t=>Cn(void 0,void 0,void 0,(function*(){var n,i;const l=M.find((e=>e.id===t.idComment));if(l)return q().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((()=>{p(c.Mw.actions.fetchComments({idArticle:e})),V()})).catch((e=>{N(e.errorMsg)}))})),onCommentDelete:e=>Cn(void 0,void 0,void 0,(function*(){q().article.deleteComment(e).catch(N)})),isWidgetActive:!!((null==D?void 0:D.isActive)&&(null==D?void 0:D.create)&&(null===(u=null==D?void 0:D.autorize)||void 0===u?void 0:u.includes("comment"))),widgetListComponent:l().createElement(Z,{mode:"comment",namespace:"comment",onChange:e=>{b([e]),p(c.x0.slice.actions.registerWidget({uniqid:e.widget.uniqid,widget:e})),f(void 0),V()},view:"edit"}),newWidgetsWrapperComponent:l().createElement(yn,{widgets:v}),existingWidgetsWrapperComponent:(e,t,n,i=!0)=>l().createElement(bn,{comment:e,widgets:t,mode:n,inplace:i,handleWidgetUpdate:P,handleWidgetRemove:V}),currentUser:w,tinyMCEConfig:{commonOptions:Object.assign(Object.assign({},O),{toolbar:W.commentsToolbar}),mentionsQueries:(0,xn.X)(S,g,N)},onError:N,highlightFields:L.userHighlightFields,userAccountStatus:L.userAccountStatus,userModel:S.find((e=>"user"===e.type)),isWedocActive:!!A,onGetHashError:e=>p(c.y8.actions.error({label:null!=e?e:m.formatMessage({id:"GLOBAL_Error"})})),activeDrives:[...j&&T?["fileBank"]:[],...c.qn.utils.buildDrivesArrayFromObject(null==T?void 0:T.drives)],variant:t,handlers:{drive:q().drive,filebank:q().filebank,file:q().file,user:q().user,socialAction:q().socialAction,questionAnswer:q().questionAnswer},socialQuestion:z?Object.assign(Object.assign({},z),{onSelectResponse:e=>{$(Object.assign(Object.assign({},z),{responseId:e,isResolved:!0}))},onUnselectResponse:()=>{$(Object.assign(Object.assign({},z),{responseId:void 0,isResolved:!1}))}}):void 0,articleId:e,additionalExtensions:[U]}),l().createElement(R,null))),H&&l().createElement(Fe,{onInsert:G,open:F,close:B}))};var On=n(749),Wn=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(i=Object.getOwnPropertySymbols(e);l<i.length;l++)t.indexOf(i[l])<0&&Object.prototype.propertyIsEnumerable.call(e,i[l])&&(n[i[l]]=e[i[l]])}return n};const Sn=o.css`
408
- height: 100%;
409
- display: flex;
410
- flex-direction: column;
411
- justify-content: space-between;
412
- `,Ln=a().div`
413
- ${({stretch:e})=>e&&Sn}
414
- `,An=a().form`
415
- ${({stretch:e})=>e&&Sn}
416
- `,Mn=i.forwardRef(((e,t)=>e.onSubmit?i.createElement(An,{stretch:e.stretch,onSubmit:e.onSubmit,ref:t},e.children):i.createElement(Ln,{stretch:e.stretch,ref:t},e.children))),Tn=a().div`
417
- ${e=>e.stretch&&"\n flex: 1;\n"}
418
- `,In=i.forwardRef(((e,t)=>{const n=i.useRef(null),[l,o]=(0,On.SC)(e.fields,e.type,e.forceMandatory),a=(0,rt.useForm)({defaultValues:Object.assign(Object.assign({},o),e.defaultValues),criteriaMode:"all"}),{handleSubmit:r,control:s,reset:c}=a,d=Wn(a,["handleSubmit","control","reset"]),u=(0,i.useCallback)((e=>{const t={};return Object.keys(e).forEach((n=>{var i;const o=null===(i=l.find((e=>e.name===n)))||void 0===i?void 0:i.widget;switch(null==o?void 0:o.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}),[l]);return i.useImperativeHandle(t,(()=>Object.assign(Object.assign({},d),{handleSubmit:r,control:s,reset:()=>{var e;null===(e=null==n?void 0:n.current)||void 0===e||e.scrollTo(0,0),c()},getFormattedValues:()=>u(d.getValues())})),[]),i.createElement(Mn,{stretch:e.stretch,onSubmit:e.onSubmit?r(e.onSubmit):void 0,ref:n},i.createElement(Tn,{stretch:e.stretch},l.map((t=>{var{Input:n}=t,l=Wn(t,["Input"]);return i.createElement(n,Object.assign({key:l.name,control:s},l,{dataCy:`${e.dataCy}-${l.name}`,readOnly:e.readOnly}))})),e.extraInputs&&e.extraInputs(s)),e.buttons)})),_n=(a().div`
419
- margin-bottom: 24px;
420
- `,a().div`
421
- margin-bottom: 4px;
422
- `,a().div`
423
- position: absolute;
424
- background-color: ${e=>e.isActive?"rgba(0,0,0,.1)":"transparent"};
425
- inset: 0;
426
- pointer-events: ${e=>e.isActive?"all":"none"};
427
- flex: 1;
428
- display: flex;
429
- overflow: hidden;
430
- `),jn=a().div`
431
- flex-direction: row;
432
- display: flex;
433
- min-height: 60px;
434
- border-bottom: 1px solid ${e=>e.theme.color.grey2};
435
- `,Dn=a().div`
436
- width: 60px;
437
- display: flex;
438
- align-items: center;
439
- justify-content: center;
440
- `,zn=a().div`
441
- flex: 1;
442
- display: flex;
443
- align-items: center;
444
- justify-content: center;
445
- `,$n=a().div`
446
- position: relative;
447
- overflow: hidden;
448
- top: 91px;
449
- width: ${460}px;
450
- `,Rn=a().div`
451
- position: absolute;
452
- top: 0;
453
- ${e=>"left"===e.position?"left: 0px;":""}
454
- ${e=>"right"===e.position?"right: -1000px;":""}
455
- width: ${440}px;
456
- bottom: 90px;
457
- display: flex;
458
- background-color: ${e=>e.theme.color.white};
459
- flex-direction: row;
460
- transition: all 0.4s;
461
- box-shadow: -4px 0px 20px 0px #00000017;
462
-
463
- &.animate {
464
- right: 0px;
465
- }
466
- `,Fn=a().div`
467
- flex: 1;
468
- display: flex;
469
- flex-direction: column;
470
- padding: 12px;
471
- overflow: auto;
472
- margin-bottom: 12px;
473
- position: relative;
474
- `,Gn=a().div`
475
- position: absolute;
476
- inset: 0;
477
- background-color: rgba(255, 255, 255, 0.8);
478
- display: flex;
479
- align-items: center;
480
- justify-content: center;
481
- `,Bn=a().div`
482
- position: absolute;
483
- inset: 0;
484
- background-color: ${e=>e.theme.color.white};
485
- padding: ${e=>e.theme.space.md}px;
486
- `,Un=a().div`
487
- width: ${50}px;
488
- padding-top: 60px;
489
- display: flex;
490
- flex-direction: column;
491
- border-right: 1px solid ${e=>e.theme.color.grey2};
492
- `,Hn=a().button`
493
- border-radius: 4px;
494
- cursor: pointer;
495
- height: 42px;
496
- margin: 4px;
497
- width: 42px;
498
- display: flex;
499
- align-items: center;
500
- justify-content: center;
501
- background-color: ${e=>e.isActive?e.theme.color.grey1:e.theme.color.white};
502
- &:hover {
503
- background-color: ${e=>e.theme.color.grey1};
504
- }
505
- `,Nn=(a().div`
506
- display: flex;
507
- border: 1px solid ${e=>e.theme.color.grey1};
508
- border-radius: ${8}px;
509
- margin-bottom: 24px;
510
- input {
511
- width: 100%;
512
- border: 0;
513
- height: ${50}px;
514
- margin: 0;
515
- }
516
- `,a().div`
517
- display: flex;
518
- flex-direction: row;
519
- padding: 12px;
520
- background-color: ${e=>e.theme.color.grey0};
521
- border-radius: 8px;
522
- margin-bottom: 4px;
523
- `),Pn=a().div`
524
- display: flex;
525
- flex: 1;
526
- align-items: center;
527
- `,Vn=a().div`
528
- width: 40px;
529
- display: flex;
530
- justify-content: center;
531
- align-items: center;
532
- `,Jn=(a().div`
533
- flex-direction: row;
534
- display: flex;
535
- align-items: center;
536
- `,a().div`
537
- flex: 1;
538
- display: flex;
539
- align-items: center;
540
- `,u.O.getLazyComponent("Button")),Qn=u.O.getLazyComponent("Icon"),Kn=({uniqid:e})=>{const t=(0,d.useDispatch)(),n=(0,d.useSelector)((t=>c.cr.selectors.selectEditor(t,e)));return n&&n.popup&&n.view?l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",backgroundColor:"white",marginTop:90}},l().createElement(jn,null,l().createElement(Dn,null),l().createElement(zn,null,"Popup"),l().createElement(Dn,null,l().createElement(Hn,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},l().createElement(Qn,{name:"icon-times",color:"grey2"})))),l().createElement("div",{style:{flex:1,display:"flex"}},n.view),l().createElement(jn,null,l().createElement(Jn,{onClick:()=>{t(c.cr.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):l().createElement(l().Fragment,null)};var Xn=n(320);const Yn=u.O.getLazyComponent("WidgetArticleTitleEditor"),Zn=u.O.getLazyComponent("WidgetArticleTextEditor"),ei=u.O.getLazyComponent("WidgetArticleGalleryEditor"),ti=u.O.getLazyComponent("WidgetArticleAttachmentEditor"),ni=u.O.getLazyComponent("WidgetArticleSliderEditor"),ii=u.O.getLazyComponent("WidgetArticleImageEditor"),li=u.O.getLazyComponent("WidgetButtonEditor"),oi=u.O.getLazyComponent("WidgetCheckListEditor"),ai=u.O.getLazyComponent("WidgetQuickSurveyEditor"),ri=u.O.getLazyComponent("WidgetDatasourceTableEditor"),si=u.O.getLazyComponent("WidgetExcelDatasourceTableEditor"),ci=u.O.getLazyComponent("WidgetPresenceEditor"),di=({uniqid:e})=>{var t,n,i,o,a,r;const u=(0,d.useDispatch)(),m=(0,d.useSelector)(c.x0.selectors.selectToken),g=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e)),d.shallowEqual),p=(0,d.useSelector)((t=>{var n;return null===(n=c.cr.selectors.selectEditor(t,e))||void 0===n?void 0:n.onSave}),d.shallowEqual),E=e=>{var t;return null===(t=c.qn.selectors.selectHook(Xn.M.getState(),e))||void 0===t?void 0:t.isActive},f=t=>{g&&u(c.x0.slice.actions.updateWidget({uniqid:e,content:t})),u(c.cr.slice.actions.flushEditor({uniqid:e})),p&&p(t)},h=(t,n)=>{u(void 0!==n?c.x0.slice.actions.setWidgetState(Object.assign({uniqid:n},t)):c.x0.slice.actions.setWidgetState(Object.assign({uniqid:e},t)))},y=t=>{u(c.cr.slice.actions.registerEditorPopup({uniqid:e,view:t}))},v=null==g?void 0:g.widget;return v?(0,k.ensureWidgetArticleButtonType)(v)?l().createElement(li,Object.assign({},v.content,{onChange:t=>{u((0,c.vR)(e,t,!1))},onSave:()=>f({})})):(0,k.ensureWidgetArticleGalleryType)(v)?l().createElement(ei,{token:m,content:v.content,onChange:t=>u((0,c.vR)(e,t,!1)),onSave:f,onStateChange:h}):(0,k.ensureWidgetArticleAttachmentType)(v)?l().createElement(ti,{token:m,content:v.content,onChange:t=>{u((0,c.vR)(e,t,!1))},onSave:f,onStateChange:h,onOpen:y}):(0,k.ensureWidgetArticleImageType)(v)?l().createElement(ii,{content:v.content,token:m,onChange:t=>{u((0,c.vR)(e,t,!1))},onSave:f,onStateChange:h}):(0,k.ensureWidgetArticleSliderType)(v)?void 0!==m?l().createElement(ni,{slides:null!==(t=v.content.slides)&&void 0!==t?t:[],loop:null!==(n=v.content.loop)&&void 0!==n&&n,useDots:null===(i=v.content.useDots)||void 0===i||i,onChange:t=>{u((0,c.vR)(e,t,!1))},token:m,onSave:f}):l().createElement(l().Fragment,null,"Token is mandatory"):(0,k.ensureWidgetArticleTitleType)(v)?l().createElement(Yn,{onChange:t=>{u((0,c.vR)(e,t,!1))},onSave:f,content:v.content,onOpen:y}):(0,k.ensureWidgetArticleTextType)(v)?l().createElement(Zn,{onChange:t=>{u((0,c.vR)(e,t,!1))},onSave:f,content:v.content}):(0,k.ensureWidgetPresenceType)(v)?l().createElement(ci,Object.assign({onChange:t=>{u((0,c.vR)(e,t,!1))},onSave:f,onStateChange:h},v.content)):(0,k.ensureWidgetCheckListType)(v)?l().createElement(oi,{token:m,uniqid:v.uniqid,content:Object.assign(Object.assign({},v.content),{arr:null===(o=v.content.arr)||void 0===o?void 0:o.map((e=>Object.assign(Object.assign({},e),{title:s.Utils.html.htmlDecodeSpecialChars(e.title)})))}),onChangeContent:(e,t)=>{u((0,c.vR)(e,t,!1))},onChangeWrapper:e=>{u(c.x0.slice.actions.updateWidgetWrapper(Object.assign(Object.assign({},e),{title:s.Utils.html.htmlDecodeSpecialChars(e.title)})))},handleChange:t=>u((0,c.vR)(e,t,!1))}):(0,k.ensureWidgetQuickSurveyType)(v)?l().createElement(ai,{token:m,uniqid:v.uniqid,content:v.content,onChangeContent:(e,t)=>{u((0,c.vR)(e,t,!1))},onChangeWrapper:e=>{u(c.x0.slice.actions.updateWidgetWrapper(Object.assign({},e)))},handleChange:t=>u((0,c.vR)(e,t,!1))}):(0,k.ensureWidgetExcelDatasourceTableType)(v)?l().createElement(si,Object.assign({},v.content,{uri:v.content.uri,limit:null!==(a=v.content.limit)&&void 0!==a?a:20,hook:{isActive:E},handlers:{jamespot:{datasource:q().datasource,network:q().network,filebank:q().filebank,wedoc:q().wedoc},handleStart:()=>h({busy:!0}),handleCatch:e=>u(c.y8.actions.error({label:e.errorMsg})),handleFinally:()=>h({busy:!1})},onSave:f,onChange:(t,n)=>u((0,c.vR)(e,t,null!=n&&n)),onStateChange:h,onError:e=>u(c.y8.actions.error({label:e}))})):(0,k.ensureWidgetDatasourceTableType)(v)?l().createElement(ri,Object.assign({},v.content,{uri:v.content.uri,limit:null!==(r=v.content.limit)&&void 0!==r?r:20,hook:{isActive:E},handlers:{jamespot:{datasource:q().datasource,network:q().network,application:q().application,filebank:q().filebank},handleStart:()=>h({busy:!0}),handleCatch:e=>u(c.y8.actions.error({label:e.errorMsg})),handleFinally:()=>h({busy:!1})},onSave:f,onChange:(t,n)=>u((0,c.vR)(e,t,null!=n&&n)),onStateChange:h,onError:e=>{u(c.y8.actions.error({label:e}))}})):l().createElement(l().Fragment,null,"cannot display editor"):null},ui=u.O.getLazyComponent("Icon"),mi=({uniqid:e,position:t})=>{const n=(0,d.useDispatch)();return l().createElement(Dn,null,l().createElement(Hn,{onClick:()=>{n(c.cr.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},l().createElement(ui,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:"grey2"})))},gi=u.O.getLazyComponent("BETA_DragAndDrop"),pi=u.O.getLazyComponent("Icon"),Ei=({uniqid:e})=>{var t;const n=(0,d.useDispatch)(),i=(0,r.useIntl)(),o=null===(t=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e))))||void 0===t?void 0:t.widget,a=(null==o?void 0:o.content)&&"widgets"in o.content&&o.content.widgets?o.content.widgets:[];return l().createElement("div",{style:{flex:1}},l().createElement(fi,{uniqid:e}),o?a.map(((t,r)=>{const s=c.x0.definition(t.widget.name);return l().createElement("div",{key:r},l().createElement(Nn,null,l().createElement(Pn,{onClick:()=>((e,t)=>{n(c.cr.slice.actions.registerEditor({uniqid:e,name:t}))})(t.widget.uniqid,t.widget.name)},i.formatMessage({id:s.label})),l().createElement(Vn,{onClick:()=>{n(c.x0.slice.actions.updateWidget({uniqid:e,content:Object.assign(Object.assign({},o.content),{widgets:[...a.filter(((e,t)=>t!==r)).map((e=>((0,k.ensureWidgetWrapperProps)(e)||console.error("Zozod",e),e)))]})}))}},l().createElement(pi,{name:"icon-trash"}))))})):l().createElement(l().Fragment,null))},fi=({uniqid:e})=>{const t=(0,d.useDispatch)(),n=(0,d.useSelector)((t=>t.widgets.ids[e].widget.layers),d.shallowEqual);return l().createElement(l().Fragment,null,l().createElement(gi,{onDrag:()=>{},renderEl:(e,t)=>l().createElement(bi,{uniqid:e,key:t}),elms:n||[]}),l().createElement(Z,{namespace:"default",onChange:n=>{t(c.x0.slice.actions.registerLayer({uniqid:e,widget:n}))},mode:"button"}))},hi=({uniqid:e})=>{const t=(0,d.useDispatch)(),n=(0,d.useSelector)((t=>t.widgets.layers[e]));return l().createElement("div",{onClick:()=>{t(c.x0.slice.actions.updateLayer({uniqid:e,props:{locked:!n.locked}}))}},l().createElement(pi,{name:n.locked?"icon-lock":"icon-unlock"}))},yi=({uniqid:e})=>{const t=(0,d.useDispatch)(),n=(0,d.useSelector)((t=>t.widgets.layers[e]));return l().createElement("div",{onClick:()=>{t(c.x0.slice.actions.updateLayer({uniqid:e,props:{visible:!n.visible}}))}},l().createElement(pi,{name:n.visible?"icon-eye":"icon-eye-slash"}))},vi=({uniqid:e,layerId:t})=>{const n=(0,d.useDispatch)();return l().createElement("div",{onClick:()=>{n(c.x0.slice.actions.flushLayer({uniqid:e,layerId:t}))}},l().createElement(pi,{name:"icon-trash"}))},bi=({uniqid:e})=>{const t=(0,d.useSelector)((t=>t.widgets.layers[e]));return l().createElement(l().Fragment,null,t.title,t.widgets.map(((n,i)=>{const o=c.x0.definition(n.widget.name);return l().createElement("div",{style:{flexDirection:"row",display:"flex"},key:i},l().createElement("div",{style:{flex:1,alignItems:"center"}},o.label),l().createElement(hi,{uniqid:e}),l().createElement(yi,{uniqid:e}),l().createElement(vi,{uniqid:n.widget.uniqid,layerId:t.uniqid}))})))},xi=u.O.getLazyComponent("InputText"),Ci=({uniqid:e})=>{var t;const n=(0,r.useIntl)(),i=(0,d.useDispatch)(),o=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e))),{control:a,watch:s}=(0,rt.useForm)({defaultValues:{text:null!==(t=null==o?void 0:o.title.replace(/&amp;/g,"&"))&&void 0!==t?t:""},criteriaMode:"all"});return l().useEffect((()=>{const t=s((t=>{i(c.x0.slice.actions.updateWidgetWrapper({uniqid:e,title:t.text}))}));return()=>t.unsubscribe()}),[s,e,i]),o?l().createElement(xi,{name:"text",width:"100%",control:a,placeholder:n.formatMessage({id:"WIDGET_Title"})}):l().createElement(l().Fragment,null)},wi=u.O.getLazyComponent("Loader"),ki=({uniqid:e})=>{var t;const n=null===(t=(0,d.useSelector)((t=>c.x0.selectors.selectWidgetState(t,e)),d.shallowEqual))||void 0===t?void 0:t.busy;return l().createElement(l().Fragment,null,n&&l().createElement(Gn,null,l().createElement(wi,{size:"l"})))},qi=({uniqid:e,children:t})=>{var n;return(null===(n=(0,d.useSelector)((t=>c.x0.selectors.selectWidgetState(t,e))))||void 0===n?void 0:n.initialized)?t:l().createElement(l().Fragment,null)},Oi=({uniqid:e})=>{var t;const n=(0,r.useIntl)();return(null===(t=(0,d.useSelector)((t=>c.x0.selectors.selectWidgetState(t,e)),d.shallowEqual))||void 0===t?void 0:t.locked)?l().createElement(Bn,null,n.formatMessage({id:"INTRANET_Panel_Change_Off"})):l().createElement(l().Fragment,null)},Wi=u.O.getLazyComponent("Button"),Si=({uniqid:e,mode:t})=>{const n=(0,r.useIntl)(),i=(0,d.useDispatch)(),o=(0,d.useSelector)((t=>c.x0.selectors.selectWidget(t,e)),d.shallowEqual),a=(0,d.useSelector)((t=>c.x0.selectors.selectWidgetObjectUri(t,e)),d.shallowEqual);return l().createElement(Wi,{onClick:()=>{i(c.cr.slice.actions.flushEditor({uniqid:e}));const l=o&&o.widget&&o.widget.content;a&&o&&l&&("view"==t&&q().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"}))},Li=["widget-presence","widget-quick-survey","widget-check-list"],Ai=u.O.getLazyComponent("Icon"),Mi=({uniqid:e,position:t})=>{const n=(0,r.useIntl)(),o=(0,d.useDispatch)(),a=(0,i.useRef)(null),s=(0,d.useSelector)((t=>c.cr.selectors.selectEditor(t,e)),d.shallowEqual),u=c.x0.definition(null==s?void 0:s.name),[m,g]=l().useState("default");return(0,i.useEffect)((()=>{setTimeout((()=>{a&&a.current&&(a.current.className=a.current.className+" animate")}),0)}),[]),s?l().createElement($n,null,l().createElement(Rn,{ref:a,position:t},(u.panel.useWrapper||u.panel.useEditor||u.panel.useWidgets)&&l().createElement(Un,null,u.panel.useWrapper?l().createElement(Hn,{isActive:"wrapper"===m,onClick:()=>g("wrapper")},l().createElement(Ai,{name:"icon-font",color:"grey2"})):l().createElement(l().Fragment,null),u.panel.useEditor?l().createElement(Hn,{isActive:"default"===m,onClick:()=>g("default")},l().createElement(Ai,{name:"icon-pen",color:"grey2"})):l().createElement(l().Fragment,null),u.panel.useWidgets?l().createElement(qi,{uniqid:e},l().createElement(Hn,{isActive:"widgets"===m,onClick:()=>g("widgets")},l().createElement(Ai,{name:"icon-sliders",color:"grey2"}))):l().createElement(l().Fragment,null)),l().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",width:"390px"}},l().createElement(jn,null,l().createElement(mi,{uniqid:e,position:s.position}),l().createElement(zn,null,n.formatMessage({id:u.label})),l().createElement(Dn,null,l().createElement(Hn,{onClick:()=>{o(c.cr.slice.actions.flushEditor({uniqid:e}))}},l().createElement(Ai,{name:"icon-times",color:"grey2"})))),l().createElement(Fn,null,"default"===m&&u.panel.useEditor?l().createElement(di,{uniqid:s.uniqid}):l().createElement(l().Fragment,null),"wrapper"===m&&u.panel.useWrapper?l().createElement(Ci,{uniqid:s.uniqid}):l().createElement(l().Fragment,null),"widgets"===m&&u.panel.useWidgets?l().createElement(Ei,{uniqid:e,namespace:u.name}):l().createElement(l().Fragment,null),l().createElement(ki,{uniqid:e}),l().createElement(Oi,{uniqid:e}),Li.includes(s.name)&&l().createElement(Si,{uniqid:e,mode:s.mode})))),(null==s?void 0:s.popup)?l().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"#000",opacity:".7"}}):l().createElement(l().Fragment,null)):l().createElement(l().Fragment,null)},Ti=a().div`
541
- position: absolute;
542
- inset: 0;
543
- pointer-events: none;
544
- z-index: 1;
545
- `,Ii=a().div`
546
- flex: 1;
547
- display: flex;
548
- margintop: ${90}px;
549
- pointer-events: ${e=>e.isActive?"all":"none"};
550
- `,_i=a().div`
551
- flex: 1;
552
- display: flex;
553
- flex-direction: row;
554
- pointer-events: none;
555
- `,ji=a().div`
556
- width: ${440}px;
557
- pointer-events: none;
558
- `,Di=()=>{const e=(0,d.useSelector)(c.cr.selectors.selectEditors,d.shallowEqual);return l().createElement(Ti,{className:"editor-portal-wrapper"},e.map(((e,t)=>"left"===e.position?l().createElement(_n,{isActive:!1,key:t},l().createElement(_i,null,l().createElement(Mi,{uniqid:e.uniqid,position:e.position}),l().createElement(Ii,{isActive:void 0!==e.popup},l().createElement(Kn,{uniqid:e.uniqid})),l().createElement(ji,null))):l().createElement(_n,{isActive:!1,key:t},l().createElement(_i,null,l().createElement(ji,null),l().createElement(Ii,{isActive:void 0!==e.popup},l().createElement(Kn,{uniqid:e.uniqid})),l().createElement(Mi,{uniqid:e.uniqid,position:e.position}))))))},zi=()=>i.createElement(i.Fragment,null);var $i=n(286);const Ri=()=>{const[e,t]=(0,i.useState)(),n=(0,r.useIntl)(),l=(0,i.useMemo)((()=>{var e,t;return(null===(t=null===(e=J.hooks)||void 0===e?void 0:e.JIAHook)||void 0===t?void 0:t.isActive)&&J.debug.JIABETA}),[]),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}},Fi=u.O.getLazyComponent("InputTinyMCE"),Gi=e=>{const t=(0,r.useIntl)(),n=(0,d.useDispatch)(),a=(0,o.useTheme)(),s=(0,d.useSelector)(c.Kx.selectors.selectAll),{query:u,ext:m,isActive:g}=Ri(),{open:p,onInsert:E,close:f,ext:h,isActive:y}=Ge(),v=(0,i.useMemo)((()=>[...y?[h]:[],...g?[m]:[]]),[m,h,g,y]),b=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),x=(0,i.useMemo)((()=>(0,xn.X)(s,a,b)),[s,b,a]),C=(0,i.useMemo)((()=>$i.p9),[]);return l().createElement(l().Fragment,null,C&&l().createElement(Fi,Object.assign({commonOptions:C,additionalExtensions:v,mentionsQueries:x},e)),g&&l().createElement(T,{query:u}),y&&l().createElement(Fe,{onInsert:E,open:p,close:f}))},Bi=u.O.getLazyComponent("InputTinyMCERaw"),Ui=e=>{const t=(0,r.useIntl)(),n=(0,d.useDispatch)(),a=(0,o.useTheme)(),s=(0,d.useSelector)(c.Kx.selectors.selectAll),{query:u,ext:m,isActive:g}=Ri(),{open:p,onInsert:E,close:f,ext:h,isActive:y}=Ge(),v=(0,i.useMemo)((()=>[...y?[h]:[],...g?[m]:[]]),[m,h,g,y]),b=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),x=(0,i.useMemo)((()=>(0,xn.X)(s,a,b)),[s,b,a]),C=(0,i.useMemo)((()=>$i.p9),[]);return l().createElement(l().Fragment,null,C&&l().createElement(Bi,Object.assign({commonOptions:C,additionalExtensions:v,mentionsQueries:x},e)),g&&l().createElement(T,{query:u}),y&&l().createElement(Fe,{onInsert:E,open:p,close:f}))},Hi=u.O.getLazyComponent("InputAudience"),Ni=u.O.getLazyComponent("Message"),Pi=u.O.getLazyComponent("Modal"),Vi=({open:e,closeHandler:t,title:n,control:i,warningMessage:o,onSubmit:a,name:s="publishTo"})=>{const u=(0,r.useIntl)(),m=(0,d.useSelector)(c.Bx.selectors.selectNetworkPublic);return l().createElement(Pi,{open:e,closeHandler:t,title:null!=n?n:u.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(Ni,{variant:"warning",message:null!=o?o:u.formatMessage({id:"FORM_Audience_Empty"})}),l().createElement(Hi,{asyncPromise:e=>q().audience.autocomplete(e),searchable:!0,control:i,multiple:!0,placeholder:u.formatMessage({id:"GLOBAL_Audience"}),name:s,defaultCustomOptions:m?[{uri:m.uri,title:m.title,resetOptions:!0,icon:"icon-fs-wall"}]:[]}))};var Ji=n(737);const Qi=u.O.getLazyComponent("Container"),Ki=u.O.getLazyComponent("AppColumn"),Xi=u.O.getLazyComponent("MainColumn");function Yi({extensionRoute:e,routes:t,description:n,mode:l="center"}){var o;const a=(0,r.useIntl)(),{pathname:s}=(0,Ji.useLocation)(),c=(0,i.useMemo)((()=>Object.values(t)),[t]),[d,u]=i.useState(null===(o=null==c?void 0:c[0])||void 0===o?void 0:o.key),m=c.map((t=>Object.assign(Object.assign({},t),{label:a.formatMessage({id:t.label}),href:t.absolutePath?t.path:`/ng/rr/${e}/${t.path}`,group:t.group?a.formatMessage({id:t.group}):void 0})));return i.useEffect((()=>{const t=c.find((t=>{var n;return`/ng/rr/${e}/${t.path}`===s||(null===(n=t.paths)||void 0===n?void 0:n.reduce(((t,n)=>{const i=`/ng/rr/${e}/${n}`,l=null!==(0,Ji.matchPath)(i,s);return t||l}),!1))}));t&&u(t.key)}),[s,c,e]),i.createElement(i.Suspense,{fallback:i.createElement(i.Fragment,null)},i.createElement(Qi,{mode:l},i.createElement(Ki,{mode:l,description:n,tabs:m,activeTab:d||""}),i.createElement(Xi,{mode:l,flex:!0},i.createElement(Ji.Outlet,null))))}}}]);
559
- //# sourceMappingURL=724.4e810912c9eacc41e4bb.chunk.js.map