jamespot-react-core 1.1.146 → 1.1.147
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.
- package/build/524.bundle.js +349 -0
- package/build/524.bundle.js.map +1 -0
- package/build/app.bundle.js +686 -647
- package/build/app.bundle.js.map +1 -1
- package/build/src/components/widgets/WidgetWrapperCore.d.ts +3 -2
- package/build/src/components/widgets/components/WidgetEditorPanel.d.ts +2 -0
- package/build/src/components/widgets/wrapper/JRCWidgetCheckListWrapper.d.ts +5 -2
- package/package.json +7 -5
- package/build/977.bundle.js +0 -330
- package/build/977.bundle.js.map +0 -1
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[524],{524:(e,t,i)=>{i.r(t),i.d(t,{AIModal:()=>Gt,CommentsBloc:()=>Ne,DisplayForm:()=>Yt,EditorsPortal:()=>Rt,Empty:()=>Pe,JRCInputTinyMCEWithExt:()=>Bt,JRCInputTinyMCEWithExtRaw:()=>Ut,TwoColLayout:()=>Ye,WidgetList:()=>q,WidgetWrapperCore:()=>Me});var n=i(915),l=i(48),o=i(298),r=i(6),a=i.n(r),c=i(363),s=i.n(c),d=i(181),u=i(855),m=i(754),g=i.n(m);const p=g().div`
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: row;
|
|
4
|
+
flex-wrap: wrap;
|
|
5
|
+
gap: 10px;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
`,f=g().div`
|
|
8
|
+
border: 1px solid ${e=>e.theme.color.grey2};
|
|
9
|
+
border-radius: 8px;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
padding: 12px;
|
|
12
|
+
position: relative;
|
|
13
|
+
opacity: ${e=>e.available?"1":".4"};
|
|
14
|
+
pointer-events: ${e=>e.available?"all":"none"};
|
|
15
|
+
|
|
16
|
+
.show-on-hover {
|
|
17
|
+
position: absolute;
|
|
18
|
+
inset: 0;
|
|
19
|
+
border-radius: 8px;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
align-items: center;
|
|
22
|
+
display: flex;
|
|
23
|
+
opacity: 0;
|
|
24
|
+
background-color: #ffffffe6;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&:hover {
|
|
28
|
+
.show-on-hover {
|
|
29
|
+
opacity: 1;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`,E=g().div`
|
|
33
|
+
border: 2px solid ${e=>e.theme.color.primary};
|
|
34
|
+
height: ${e=>e.open?"320":"54"}px;
|
|
35
|
+
border-radius: 8px;
|
|
36
|
+
display: flex;
|
|
37
|
+
justify-content: top;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
transition: height 0.4s;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
`,y=g().div`
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: row;
|
|
45
|
+
flex-wrap: wrap;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
gap: 10px;
|
|
48
|
+
`,v=g().div`
|
|
49
|
+
min-height: 50px;
|
|
50
|
+
display: flex;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
align-items: center;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
color: ${e=>e.theme.color.primary};
|
|
55
|
+
&:hover {
|
|
56
|
+
background-color: ${e=>e.theme.color.grey0};
|
|
57
|
+
}
|
|
58
|
+
`,h=g().button`
|
|
59
|
+
height: 72px;
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
padding: 0 10px;
|
|
63
|
+
gap: 10px;
|
|
64
|
+
width: 40%;
|
|
65
|
+
border: 1px solid ${e=>e.theme.color.grey2};
|
|
66
|
+
border-radius: 8px;
|
|
67
|
+
transition: opacity 0.4s ease ${e=>40*e.index}ms;
|
|
68
|
+
opacity: ${e=>e.open?1:0};
|
|
69
|
+
img {
|
|
70
|
+
width: 40px;
|
|
71
|
+
}
|
|
72
|
+
${e=>e.full&&"flex: 1"}
|
|
73
|
+
`,w=g().div`
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: ${e=>"row"===e.direction?"row":"column"};
|
|
76
|
+
align-items: ${e=>"row"===e.direction?"center":"flex-start"};
|
|
77
|
+
justify-content: ${e=>"row"===e.direction?"flex-start":"center"};
|
|
78
|
+
flex: 1;
|
|
79
|
+
${e=>e.gap&&`gap:${e.gap}px`}
|
|
80
|
+
`,x=n.default.registry.getLazyComponent("Button"),C=n.default.registry.getLazyComponent("ModalLayout"),b=n.default.registry.getLazyComponent("ModalContent"),k=n.default.registry.getLazyComponent("Tooltip"),L=n.default.registry.getLazyComponent("IconButton"),q=({mode:e,view:t,children:i,namespace:n="default",onChange:o})=>{const[r,a]=s().useState(!1),c=function(e){switch(e){case"widget-article-image":return[l.$L.definition("widget-article-title"),l.$L.definition("widget-article-button")];case"comment":return[l.$L.definition("widget-check-list")];default:return[l.$L.definition("widget-article-title"),l.$L.definition("widget-article-text"),l.$L.definition("widget-article-image"),l.$L.definition("widget-article-button"),l.$L.definition("widget-article-slider"),l.$L.definition("widget-article-attachment")]}}(n),u=(0,d.useIntl)(),m={open:r,portalId:"react-modal",variant:"full-height",closeHandler:()=>a(!1)},g=e=>{o(l.$L.factory(e)),a(!1)};return s().createElement(s().Fragment,null,s().createElement(C,Object.assign({},m),s().createElement(b,{onClickIconClose:m.closeHandler,buttons:"comment"===e?[{children:s().createElement(d.FormattedMessage,{id:"GLOBAL_Close"}),color:"cancel",clickHandler:()=>a(!1)}]:void 0,title:u.formatMessage({id:"WIDGET_Builder"})},"comment"===e?s().createElement(y,null,c.map(((e,t)=>s().createElement(h,{key:e.name,open:!0,full:!0,index:t,onClick:()=>g(e.name)},s().createElement(w,{direction:"row",gap:12},s().createElement("img",{src:e.img}),s().createElement(w,{direction:"column"},s().createElement("h3",null,u.formatMessage({id:e.label})),s().createElement("p",null,u.formatMessage({id:e.description})))))))):s().createElement(p,null,c.map(((e,t)=>s().createElement(f,{key:t,onClick:()=>g(e.name),available:e.available},s().createElement("img",{src:e.img}),s().createElement("div",{className:"show-on-hover"},u.formatMessage({id:e.label})))))))),"custom"===e&&i?s().createElement("div",{onClick:()=>a(!0)},i):s().createElement(s().Fragment,null),"button"===e&&"edit"===t?s().createElement(x,{onClick:()=>a(!0),variant:"outlined",minWidth:"100%"},u.formatMessage({id:"WIDGET_Add_Widget"})):s().createElement(s().Fragment,null),"gallery"===e&&"edit"===t?s().createElement(p,null,c.map(((e,t)=>s().createElement(f,{key:t,onClick:()=>g(e.name),available:e.available},s().createElement("img",{src:e.img}),s().createElement("div",{className:"show-on-hover"},u.formatMessage({id:e.label})))))):s().createElement(s().Fragment,null),"article"===e&&"edit"===t?s().createElement(W,{widgets:c,onClick:g}):s().createElement(s().Fragment,null),"comment"===e&&"edit"===t?s().createElement(S,{onClick:()=>{a(!0)}}):s().createElement(s().Fragment,null))},W=({widgets:e,onClick:t})=>{const[i,n]=s().useState(!1),l=(0,d.useIntl)();return s().createElement(s().Fragment,null,s().createElement(E,{open:i},s().createElement(v,{onClick:()=>n(!i)},l.formatMessage({id:"WIDGET_Add_Widget"})),s().createElement(y,null,e.map(((e,n)=>s().createElement(h,{key:e.name,open:i,index:n,onClick:()=>t(e.name)},s().createElement("img",{src:e.img}),l.formatMessage({id:e.label})))))))},S=({onClick:e})=>{const t=(0,d.useIntl)();return s().createElement(s().Fragment,null,s().createElement(k,{description:t.formatMessage({id:"COMMENT_Add_Widget"})},s().createElement(L,{bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:14,onClick:()=>{e()},icon:"icon-fs-puzzle"})))},$=g().div`
|
|
81
|
+
flex: 1;
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: row;
|
|
84
|
+
min-height: 60px;
|
|
85
|
+
align-items: center;
|
|
86
|
+
`,M=({widget:e})=>{const{url:t,keys:i,order:n,orderBy:l}=e.content,[r,a]=s().useState([]);return s().useEffect((()=>{t&&function(e){return"string"==typeof e&&0!==e.length&&e.startsWith("https://")}(t)?fetch(t,{method:"POST",headers:{"Content-Type":"application/json"}}).then((e=>e.json())).then((e=>{Array.isArray(e.result)||console.warn("resposne must be an array"),a(e.result)})):console.warn(`${t} is not a valid url`)}),[t]),s().createElement($,null,s().createElement(o.JRCWidgetApi,{data:r,keys:null!=i?i:[],order:null!=n?n:"",orderBy:null!=l?l:"asc"}))},I=g().div`
|
|
87
|
+
width: 0;
|
|
88
|
+
height: 0;
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
`,A=({children:e,initialFiles:t,initialClick:i,multiple:n,accept:r,onUploadStart:a,onUploadEnd:c,onUploadSuccess:d})=>{const m=s().useRef(null),g=(0,u.useSelector)(l.$L.selectors.selectToken),[p,f]=s().useState(0),[E,y]=s().useState(t);return s().useEffect((()=>{var e;i&&(null===(e=m.current)||void 0===e||e.click())}),[i]),s().useEffect((()=>{t.length!==E.length&&y(t)}),[t]),s().useEffect((()=>{d(E)}),[E]),s().useEffect((()=>{0===p&&c()}),[p]),s().createElement(s().Fragment,null,s().createElement("div",{onClick:()=>{var e;i&&(null===(e=m.current)||void 0===e||e.click())}},e),s().createElement(I,null,s().createElement(o.JRCInputFileAdvancedRaw,{ref:m,id:"widget-upload-file",name:"editorFiles",content:"",accept:r,multiple:n,token:g,onUploadStart:e=>{void 0!==e&&f((t=>t+e)),"function"==typeof a&&0!==e&&a()},onUploadSuccess:e=>{void 0!==e&&(f((e=>void 0!==e?e-1:0)),y((t=>n?[...t,e]:[e])))}})))},O=n.default.registry.getLazyComponent("WidgetAttachment"),T=n.default.registry.getLazyComponent("FileViewer"),F=g().div`
|
|
91
|
+
flex: 1;
|
|
92
|
+
`,j=({widget:e,inplace:t,mode:i})=>{const n=(0,d.useIntl)(),{uniqid:r}=e,{files:m}=e.content,g=(0,u.useDispatch)(),p=(0,u.useSelector)((e=>l.$L.selectors.isActive(e,r)),u.shallowEqual),f=e=>{g(l.FN.actions.error({label:null!=e?e:n.formatMessage({id:"GLOBAL_Error"})}))};(0,c.useEffect)((()=>{g(l.$L.slice.actions.setWidgetState({uniqid:r,mounted:!0}))}),[]),(0,c.useEffect)((()=>{g(l.$L.slice.actions.setWidgetState({uniqid:r,empty:!m||0===m.length}))}),[m]);const E=(0,u.useSelector)((e=>l.Mx.selectors.selectById(e,"OnlyOfficeHook"))),y=[{label:n.formatMessage({id:"WIDGET_Open_With_Wedoc"}),onClick:e=>{e&&a().object.getAccessHash(`fileArticle/${e.id}`).then((t=>{if(""===t.result)throw new Error("result empty");const i=t.result;((e,t,i)=>{window.open(function(e,t){return`/ng/rr/file/${e}/${t}`}(e,t),void 0)})(e.id,i)})).catch((()=>{g(l.FN.actions.error({label:"WIDGET_Open_Failed"},6e3))}))}}],v=E?[{condition:e=>["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation"].includes(e.mimetype),options:y}]:[];return void 0!==m?s().createElement(F,null,"view"!==i?s().createElement(O,{files:m,onClick:()=>{},onError:f}):s().createElement(T,{files:m,openWithOptions:v},(e=>s().createElement(O,{files:m,onClick:t=>e(t),onError:f}))),t&&"view"!==i&&s().createElement(A,{initialFiles:m,initialClick:p,multiple:!0,accept:"*",onUploadSuccess:e=>{Array.isArray(e)&&g((0,l.O5)(r,{files:e}))},onUploadStart:()=>{g(l.$L.slice.actions.setWidgetState({uniqid:r,loading:!0}))},onUploadEnd:()=>{g(l.$L.slice.actions.setWidgetState({uniqid:r,loading:!1}))}},"edit"===i?s().createElement(o.JRCWidgetEmptyInplace,{label:"WIDGET_Article_Attachment_Empty_Label",description:"WIDGET_Article_Attachment_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}}):s().createElement(s().Fragment,null))):s().createElement(s().Fragment,null)},_=g().div`
|
|
93
|
+
display: flex;
|
|
94
|
+
flex: 1;
|
|
95
|
+
justify-content: center;
|
|
96
|
+
align-items: center;
|
|
97
|
+
`,R=g().div`
|
|
98
|
+
pointer-events: ${e=>e.clickable?"all":"none"};
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
display: flex;
|
|
101
|
+
flex: 1;
|
|
102
|
+
justify-content: center;
|
|
103
|
+
align-items: center;
|
|
104
|
+
`,D=({widget:e,mode:t})=>{const i=(0,u.useDispatch)(),{uniqid:n}=e,{text:r,url:a,target:d,color:m,backgroundColor:g,buttonSize:p,borderRadius:f,variant:E}=e.content;return(0,c.useEffect)((()=>{i(l.$L.slice.actions.setWidgetState({uniqid:n,empty:!r||0===r.length}))}),[r]),s().createElement(_,{onClick:()=>{"edit"===t&&i(l.Wq.slice.actions.registerEditor({uniqid:n,name:e.name}))}},s().createElement(R,{clickable:"edit"!==t},s().createElement(o.JRCWidgetButton,{text:r,url:a,target:d,color:m,backgroundColor:g,buttonSize:p,borderRadius:f,variant:E})))},z=n.default.registry.getLazyComponent("WidgetArticleGallery"),G=n.default.registry.getLazyComponent("FileViewer"),B=g().button`
|
|
105
|
+
cursor: pointer;
|
|
106
|
+
`,U=({widget:e,inplace:t,mode:i})=>{var n,r;const{uniqid:a}=e,{files:c}=e.content,d=(0,u.useDispatch)(),m=(0,u.useSelector)((e=>l.$L.selectors.isActive(e,a)),u.shallowEqual);return s().useEffect((()=>{d(l.$L.slice.actions.setWidgetState({uniqid:a,mounted:!0}))}),[]),void 0!==c?s().createElement(s().Fragment,null,"edit"===i?s().createElement(z,{files:c,maxWidth:800,gap:null!==(n=e.content.gap)&&void 0!==n?n:"10",column:null!==(r=e.content.column)&&void 0!==r?r:"3",onClick:()=>{}}):s().createElement(G,{files:c,openWithOptions:[]},(t=>{var i,n;return s().createElement(B,null,s().createElement(z,{files:c,maxWidth:600,gap:null!==(i=e.content.gap)&&void 0!==i?i:"10",column:null!==(n=e.content.column)&&void 0!==n?n:"3",onClick:e=>t(e)}))})),t&&"edit"===i?s().createElement(A,{initialFiles:c,initialClick:m,accept:"image/png, image/jpeg, image/jpg",multiple:!0,onUploadSuccess:e=>{Array.isArray(e)&&d((0,l.O5)(a,{files:e}))},onUploadStart:()=>{d(l.$L.slice.actions.setWidgetState({uniqid:a,loading:!0}))},onUploadEnd:()=>{d(l.$L.slice.actions.setWidgetState({uniqid:a,loading:!1}))}},s().createElement(o.JRCWidgetEmptyInplace,{label:"WIDGET_Article_Gallery_Empty_Label",description:"WIDGET_Article_Gallery_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}})):s().createElement(s().Fragment,null)):s().createElement(s().Fragment,null)},H=n.default.registry.getLazyComponent("WidgetImage"),N=n.default.registry.getLazyComponent("FileViewer"),P=g().div`
|
|
107
|
+
position: absolute;
|
|
108
|
+
inset: 0;
|
|
109
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
110
|
+
pointer-event: none;
|
|
111
|
+
display: flex;
|
|
112
|
+
justify-content: center;
|
|
113
|
+
align-items: center;
|
|
114
|
+
opacity: 0;
|
|
115
|
+
color: ${e=>e.theme.color.white};
|
|
116
|
+
&:hover {
|
|
117
|
+
opacity: 1;
|
|
118
|
+
}
|
|
119
|
+
`,V=g().button`
|
|
120
|
+
cursor: pointer;
|
|
121
|
+
`,Q={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},K=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},X=({widget:e,width:t,inplace:i,mode:n})=>{const{uniqid:a}=e,{file:m,useFilter:g}=e.content,p=(0,u.useDispatch)(),f=(0,u.useSelector)((e=>l.$L.selectors.isActive(e,a)),u.shallowEqual),[E,y]=(0,c.useState)(void 0),v=(0,d.useIntl)();return(0,c.useEffect)((()=>{p(l.$L.slice.actions.setWidgetState({uniqid:a,mounted:!0}))}),[]),(0,c.useEffect)((()=>{p(l.$L.slice.actions.setWidgetState({uniqid:a,empty:!m}))}),[m]),(0,c.useEffect)((()=>{m&&y((0,r.formatImgUrl)({timestamp:m.dateModified?K(m.dateModified):Date.now(),from:"imagecache",size:"fitx1200",uri:m.uri}))}),[m]),s().createElement(s().Fragment,null,"edit"===n?void 0!==E?s().createElement(H,{maxWidth:null!=t?t:600,uri:E,useFilter:null!=g&&g}):s().createElement(s().Fragment,null):s().createElement(N,{files:[Object.assign(Object.assign({},Q),{path:E,mimetype:"image/png"})],openWithOptions:[]},(e=>s().createElement(V,{onClick:()=>e(0)},s().createElement(H,{maxWidth:null!=t?t:600,uri:E,useFilter:null!=g&&g})))),i&&"edit"===n?s().createElement(A,{initialFiles:[],initialClick:f,accept:"image/png, image/jpeg, image/jpg",multiple:!1,onUploadSuccess:e=>{Array.isArray(e)&&void 0!==e[0]&&p((0,l.O5)(a,{file:e[0]}))},onUploadStart:()=>{p(l.$L.slice.actions.setWidgetState({uniqid:a,loading:!0}))},onUploadEnd:()=>{p(l.$L.slice.actions.setWidgetState({uniqid:a,loading:!1}))}},void 0!==m?s().createElement(P,null,v.formatMessage({id:"ARTICLE_Widget_Image_Change"})):s().createElement(o.JRCWidgetEmptyInplace,{label:"WIDGET_Article_Image_Empty_Label",description:"WIDGET_Article_Image_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}})):s().createElement(s().Fragment,null))};var Y=i(5);const Z=n.default.registry.getLazyComponent("FileViewer"),ee=g().div`
|
|
122
|
+
flex: 1;
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: row;
|
|
125
|
+
min-height: 60px;
|
|
126
|
+
align-items: center;
|
|
127
|
+
width: ${e=>e.maxWidth}px;
|
|
128
|
+
`,te={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},ie=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},ne=({widget:e,mode:t,width:i})=>{const{uniqid:n}=e,a=(0,Y.TL)(),d=(0,u.useSelector)((e=>l.$L.selectors.isActive(e,n)),u.shallowEqual),m=null!=i?i:600,[g,p]=(0,c.useState)(void 0),f=(0,c.useRef)(null),E=(0,c.useMemo)((()=>e.content.slides?[...e.content.slides.map(((e,t)=>Object.assign(Object.assign({},te),{id:e.file?e.file.id:t,mimetype:e.file?e.file.mimetype:te.mimetype,path:(0,r.formatImgUrl)({size:"fitx1200",uri:e.file?e.file.uri:"",from:"imagecache",timestamp:e.file&&e.file.dateModified?ie(e.file.dateModified):Date.now()})})))]:[]),[e.content.slides]),y=(0,c.useMemo)((()=>void 0!==e.content.slides?[...e.content.slides.map((e=>e.file?Object.assign(Object.assign({},e),{uri:(0,r.formatImgUrl)({timestamp:e.file.dateModified?ie(e.file.dateModified):Date.now(),size:`fitx${g&&g<m?g:m}`,from:"imagecache",uri:e.file.uri})}):Object.assign(Object.assign({},e),{uri:""})))]:[]),[e.content.slides,g,m]);(0,c.useEffect)((()=>{d&&"edit"===t&&a(l.Wq.slice.actions.registerEditor({uniqid:n,name:e.name}))}),[d]),(0,c.useEffect)((()=>{const e=()=>{f.current&&p(f.current?f.current.offsetWidth:m)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[f]),(0,c.useEffect)((()=>{p(f.current?f.current.offsetWidth:m)}),[f]),(0,c.useEffect)((()=>{a(l.$L.slice.actions.setWidgetState({uniqid:n,empty:!e.content.slides||0===e.content.slides.length}))}),[e.content.slides]);const v=(0,c.useMemo)((()=>"edit"===t&&Array.isArray(e.content.slides)&&0===e.content.slides.length),[e.content.slides,t]),h=(0,c.useCallback)((()=>{a(l.Wq.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))}),[a,e.uniqid,e.name]);return void 0===g?s().createElement("div",{ref:f,style:{width:"100%"}}):s().createElement(ee,{maxWidth:g&&g<m?g:m},s().createElement(Z,{files:E,openWithOptions:[]},(i=>{var r,c;return s().createElement(o.JRCWidgetSlider,{slides:y,maxWidth:g&&g<m?g:m,useDots:null===(r=e.content.useDots)||void 0===r||r,loop:null!==(c=e.content.loop)&&void 0!==c&&c,startAt:0,onClickSlide:o=>{if("edit"!==t){if(e.content.slides){const t=e.content.slides[o];t&&t.file&&i(t.file.id)}}else a(l.Wq.slice.actions.registerEditor({uniqid:n,name:e.name}))}})})),v?s().createElement(o.JRCWidgetEmptyInplace,{label:"WIDGET_Article_Slider_Empty_Label",description:"WIDGET_Article_Slider_Empty_Description",url:"widget-article-image-placeholder.png",onClick:h}):s().createElement(s().Fragment,null))},le=n.default.registry.getLazyComponent("WidgetArticleText"),oe=g().div`
|
|
129
|
+
cursor: text;
|
|
130
|
+
p {
|
|
131
|
+
word-wrap: break-word;
|
|
132
|
+
}
|
|
133
|
+
a {
|
|
134
|
+
word-wrap: break-word;
|
|
135
|
+
}
|
|
136
|
+
`,re=({widget:e,mode:t})=>{const{uniqid:i}=e,o=(0,m.useTheme)(),{text:r}=e.content,a=(0,u.useDispatch)(),g=(0,u.useSelector)((e=>l.$L.selectors.isActive(e,i)),u.shallowEqual),p=(0,u.useSelector)((e=>{var t;return null===(t=l.$L.selectors.selectWidgetState(e,i))||void 0===t?void 0:t.busy})),f=(0,u.useSelector)(l.$L.selectors.selectToken),E=(0,u.useSelector)(l.zh.selectors.selectTinyMCECommonOptions),y=(0,u.useSelector)(l.Hn.selectors.selectAll),v=(0,d.useIntl)(),h=(0,c.useCallback)((e=>{a(l.FN.actions.error({label:null!=e?e:v.formatMessage({id:"GLOBAL_Error"})}))}),[a,v]);(0,c.useEffect)((()=>{a(l.$L.slice.actions.setWidgetState({uniqid:i,empty:!r||0===r.length}))}),[r]);const w=(0,c.useMemo)((()=>(0,n.getTinyMCEMentionsQueries)(y,o,h)),[y,h,o]);return p?s().createElement(s().Fragment,null):s().createElement(oe,null,s().createElement(le,{autoFocus:g,text:null!=r?r:"",token:"edit"===t&&void 0!==f?f:"",tinyMCECommonOptions:"edit"===t&&E?{tinymceScriptSrc:"https://ecosysteme.jamespot.pro/js/tinymce/tinymce.min.js",commonOptions:E,mentionsQueries:w}:void 0,mode:t,onChange:e=>{a((0,l.O5)(i,{text:e}))}}))},ae=n.default.registry.getLazyComponent("WidgetArticleTitle"),ce=g().div`
|
|
137
|
+
flex: 1;
|
|
138
|
+
display: flex;
|
|
139
|
+
flex-direction: row;
|
|
140
|
+
align-items: center;
|
|
141
|
+
cursor: text;
|
|
142
|
+
`,se=g().div`
|
|
143
|
+
display: flex;
|
|
144
|
+
flex-direction: row;
|
|
145
|
+
border-radius: 8px;
|
|
146
|
+
overflow: hidden;
|
|
147
|
+
margin: 4px;
|
|
148
|
+
border: 1px solid ${e=>e.theme.color.grey1};
|
|
149
|
+
`,de=g().button`
|
|
150
|
+
display: flex;
|
|
151
|
+
width: 40px;
|
|
152
|
+
height: 40px;
|
|
153
|
+
justify-content: center;
|
|
154
|
+
align-items: center;
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
opacity: ${e=>e.isActive?"1.0":".8"};
|
|
157
|
+
background-color: ${e=>e.isActive?e.theme.color.grey1:e.theme.color.white};
|
|
158
|
+
&:hover {
|
|
159
|
+
background-color: ${e=>e.theme.color.grey1};
|
|
160
|
+
}
|
|
161
|
+
`,ue=({widget:e,inplace:t,mode:i})=>{const{uniqid:n}=e,{text:o,color:r,heading:a}=e.content,d=(0,u.useDispatch)(),m=(0,u.useSelector)((e=>l.$L.selectors.isActive(e,n)),u.shallowEqual);return(0,c.useEffect)((()=>{d(l.$L.slice.actions.setWidgetState({uniqid:n,empty:!o||0===o.length}))}),[o]),s().createElement(ce,null,s().createElement(ae,{text:o,color:r,heading:a,autoFocus:m,inplace:t,mode:i,onChange:e=>{d((0,l.O5)(n,{text:e}))}}),m&&"edit"===i?s().createElement(me,{heading:a,onClick:e=>{d((0,l.O5)(n,{heading:e}))}}):s().createElement(s().Fragment,null))},me=({heading:e="h1",onClick:t})=>s().createElement(se,null,["h1","h2","h3","h4"].map(((i,n)=>s().createElement(de,{key:n,isActive:e===i,onClick:()=>t(i)},i)))),ge=J.react.registry.getLazyComponent("WidgetCheckList"),pe=J.react.registry.getLazyComponent("WidgetCheckListEditor"),fe=J.react.registry.getLazyComponent("Typography"),Ee=(g().div`
|
|
162
|
+
display: flex;
|
|
163
|
+
flex-direction: row;
|
|
164
|
+
justify-content: space-between;
|
|
165
|
+
align-items: center;
|
|
166
|
+
border: ${e=>e.border?`1px solid ${e.theme.color.grey2}`:"none"};
|
|
167
|
+
min-height: 24px;
|
|
168
|
+
border-radius: 4px;
|
|
169
|
+
padding: 4px 8px;
|
|
170
|
+
`,g().div`
|
|
171
|
+
display: flex;
|
|
172
|
+
justify-content: center;
|
|
173
|
+
align-items: center;
|
|
174
|
+
border: 1px solid ${e=>e.theme.color.grey1};
|
|
175
|
+
border-bottom-left-radius: 4px;
|
|
176
|
+
border-bottom-right-radius: 4px;
|
|
177
|
+
padding: 4px;
|
|
178
|
+
margin-bottom: 8px;
|
|
179
|
+
|
|
180
|
+
div:first-child {
|
|
181
|
+
margin: 0 auto;
|
|
182
|
+
}
|
|
183
|
+
div:last-child {
|
|
184
|
+
align-self: flex-end;
|
|
185
|
+
}
|
|
186
|
+
`),ye=g().div`
|
|
187
|
+
width: 100%;
|
|
188
|
+
flex: 1;
|
|
189
|
+
display: flex;
|
|
190
|
+
flex-direction: column;
|
|
191
|
+
align-items: flex-start;
|
|
192
|
+
justify-content: 'center';
|
|
193
|
+
gap: 8px;
|
|
194
|
+
`,ve=g().div`
|
|
195
|
+
display: flex;
|
|
196
|
+
gap: 14px;
|
|
197
|
+
padding: 10px 10px 0 10px;
|
|
198
|
+
border-radius: 8px;
|
|
199
|
+
background-color: ${({theme:e})=>e.color.white};
|
|
200
|
+
border: 1px solid ${e=>e.theme.color.grey2};
|
|
201
|
+
`,he=g().div`
|
|
202
|
+
width: 100%;
|
|
203
|
+
padding-bottom: 12px;
|
|
204
|
+
border-bottom: ${e=>e.border?`1px solid ${e.theme.color.grey1}`:0};
|
|
205
|
+
`,we=({widget:e,commentId:t,inplace:i,mode:n,editRight:r,deleteRight:m,onRemove:g,onWidgetUpdate:p})=>{const f=(0,d.useIntl)(),{uniqid:E,content:y}=e,v=(0,u.useDispatch)(),[h,w]=(0,c.useState)(),[x,C]=(0,c.useState)(!1),[b,k]=(0,c.useState)(),[L,q]=(0,c.useState)(!1),W=(0,u.useSelector)((e=>l.$L.selectors.selectWidget(e,E))),S=(0,u.useSelector)(l.EK.selectors.get),$=(0,c.useCallback)((e=>{v(l.FN.actions.error({label:null!=e?e:f.formatMessage({id:"GLOBAL_Error"})}))}),[v,f]),M=e=>{v(l.$L.slice.actions.updateWidgetWrapper(Object.assign({},e)))},I=()=>{v(l.$L.slice.actions.flushWidget({uniqid:E})),g&&g(E),C(!1)},A=t=>{v(l.Wq.slice.actions.flushAllEditor()),v(l.$L.slice.actions.setToken({token:t})),v(l.Wq.slice.actions.registerEditor({uniqid:e.uniqid,name:"widget-check-list"}))};return(0,c.useEffect)((()=>{var t;const i=null===(t=e.content.arr)||void 0===t?void 0:t.map((e=>{var t,i,n;return Object.assign(Object.assign(Object.assign({text:null!==(t=e.title)&&void 0!==t?t:"",checked:null!==(i=e.value)&&void 0!==i&&i},e.links&&{links:e.links}),e.user&&{user:null!==(n=e.user)&&void 0!==n?n:void 0}),e.id&&{id:e.id,mimetype:"image/png"})}));w(i)}),[e.content.arr,y]),(0,c.useEffect)((()=>{b||L||(q(!0),a().network.token().then((e=>{k(e.result),q(!1)})).catch((e=>{$(e.errorMsg)})))}),[$,b,L]),"edit"===n&&i?s().createElement(s().Fragment,null,s().createElement(ve,null,s().createElement(ye,null,s().createElement(he,{border:!0},s().createElement("label",null,f.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Title"})),s().createElement(o.JRCInputTextRaw,{id:f.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Title"}),required:!0,placeholder:f.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Title"}),type:"text",value:null==W?void 0:W.title,onChange:e=>{const{value:t}=e.target;M({uniqid:E,title:t})},margin:"2px",width:"100%"})),s().createElement(pe,{token:b,uniqid:E,content:y,onChangeContent:(e,t)=>{v((0,l.O5)(e,t))},onChangeWrapper:M,openEditorPanel:A,onRemoveWidget:I})))):s().createElement(s().Fragment,null,h&&s().createElement("div",{key:e.uniqid,style:{width:"100%"}},s().createElement(ge,{title:null==W?void 0:W.title,limit:10,initialEntries:h,onFileClick:()=>{},onItemCheckListChange:(i,n)=>((e,i,n)=>{if(!t)return;const o={arr:null==n?void 0:n.map((e=>{var t,i;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({title:e.text},e.id&&{id:e.id}),e.links&&{links:e.links}),e.mimetype&&{mimetypes:e.mimetype}),S&&e.checked&&{user:{id:null!==(i=null===(t=e.user)||void 0===t?void 0:t.id)&&void 0!==i?i:S.id,mainType:"user",type:"user"}}),e.checked&&{value:e.checked})}))};v((0,l.O5)(e,o)),a().widget.checkListRespond({id:t,type:"comment",idUser:null==S?void 0:S.id,uniqid:e,index:i}).then((()=>{p&&p()})).catch((e=>{$(e.message)}))})(e.uniqid,i,n)}),r&&s().createElement(s().Fragment,null,s().createElement(Ee,null,s().createElement("div",{style:{cursor:"pointer"},onClick:()=>{b?A(b):$(f.formatMessage({id:"GLOBAL_Error"}))}},s().createElement(fe,{size:"s"},f.formatMessage({id:"COMMENT_WIDGET_Configure"}))),m&&s().createElement("div",null,s().createElement(o.JRCIconButton,{iconSize:14,onClick:()=>C(!0),icon:"icon-trash"})))),s().createElement(o.JRCModal,{buttons:[{color:"cancel",clickHandler:()=>C(!1),children:s().createElement(d.FormattedMessage,{id:"GLOBAL_Cancel"})},{color:"danger",clickHandler:I,children:s().createElement(d.FormattedMessage,{id:"GLOBAL_Delete"})}],open:x,closeHandler:()=>C(!1),title:f.formatMessage({id:"GLOBAL_Delete"})},f.formatMessage({id:"COMMENT_WIDGET_Delete_Widget"}))))},xe=({widget:e,commentId:t,width:i,inplace:n=!1,mode:l="view",editRight:o,deleteRight:r,onWidgetUpdate:a,onRemove:c})=>{const{name:d}=e;switch(d){default:return s().createElement(s().Fragment,null,"cannot display widget (",d,")");case"widget-check-list":return s().createElement(we,{widget:e,commentId:t,inplace:n,mode:l,editRight:null!=o&&o,deleteRight:null!=r&&r,onRemove:c,onWidgetUpdate:a});case"widget-article-button":return s().createElement(D,{widget:e,inplace:n,mode:l});case"widget-article-gallery":return s().createElement(U,{widget:e,inplace:n,mode:l});case"widget-article-attachment":return s().createElement(j,{widget:e,inplace:n,mode:l});case"widget-article-image":return s().createElement(X,{widget:e,inplace:n,mode:l,width:null!=i?i:800});case"widget-api":return s().createElement(M,{widget:e,inplace:n,mode:l});case"widget-article-slider":return s().createElement(ne,{widget:e,inplace:n,mode:l,width:null!=i?i:800});case"widget-article-title":return s().createElement(ue,{widget:e,inplace:n,mode:l});case"widget-article-text":return s().createElement(re,{widget:e,inplace:n,mode:l})}},Ce=g().div`
|
|
206
|
+
position: absolute;
|
|
207
|
+
inset: 0;
|
|
208
|
+
opacity: ${e=>e.opacity};
|
|
209
|
+
background-color: ${e=>e.backgroundColor};
|
|
210
|
+
pointer-events: ${e=>e.pointerEvents};
|
|
211
|
+
`,be=({uniqid:e,mode:t})=>{const i=(0,u.useSelector)((t=>t.widgets.ids[e].widget.layers),u.shallowEqual);return s().createElement(s().Fragment,null,null==i?void 0:i.map(((e,t)=>s().createElement(ke,{uniqid:e,key:t,mode:"edit"}))))},ke=({uniqid:e,mode:t})=>{const i=(0,u.useSelector)((t=>t.widgets.layers[e]));return"view"===t?s().createElement(Ce,{opacity:1,backgroundColor:"transparent",pointerEvents:"none"},i.widgets.map(((e,t)=>s().createElement(Le,{key:t,layerId:i.uniqid,uniqid:e.widget.uniqid,mode:"view"})))):s().createElement(Ce,{opacity:i.visible?1:0,backgroundColor:i.visible?"rgba(255,255,255,.1)":"transparent",pointerEvents:i.locked?"none":"all"},i.widgets.map(((e,t)=>s().createElement(Le,{key:t,layerId:i.uniqid,uniqid:e.widget.uniqid,mode:"edit"}))))},Le=({uniqid:e,layerId:t,mode:i})=>{const n=(0,u.useDispatch)(),r=(0,u.useSelector)((t=>t.widgets.ids[e]),u.shallowEqual),a=(0,u.useSelector)((e=>e.widgets.layers[t]));return r&&a&&a.position?"view"===i?s().createElement("div",{style:{position:"absolute",top:a.position.y,left:a.position.x}},s().createElement(Ie,{uniqid:e,widget:r,mode:i,inplace:!0})):s().createElement(qe,{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=>{n(l.$L.slice.actions.updateLayer({uniqid:t,props:{position:e}}))})(e)}},s().createElement(o.BETA_JRCDoubleClick,{onDoubleTap:()=>((e,t)=>{n(l.Wq.slice.actions.registerEditor({uniqid:e,name:t}))})(r.widget.uniqid,r.widget.name)},s().createElement(Ie,{uniqid:e,widget:r,mode:i,inplace:!0}))):s().createElement(s().Fragment,null)},qe=({position:e,children:t,onMouseUp:i})=>{const[n,l]=s().useState(!1),[o,r]=s().useState({x:0,y:0}),[a,d]=s().useState({x:0,y:0}),[u,m]=s().useState({x:e.x,y:e.y}),g=s().useRef(null),p=(0,c.useCallback)((e=>{l(!0),g.current&&(r({x:e.nativeEvent.clientX,y:e.nativeEvent.clientY}),d({x:u.x,y:u.y}))}),[u.x,u.y]),f=s().useCallback((e=>{if(n&&g.current){const t=a.x+(e.clientX-o.x),i=a.y+(e.clientY-o.y);m({x:t,y:i})}}),[o.x,o.y,n,a.x,a.y]),E=(0,c.useCallback)((()=>{l(!1),i({x:u.x,y:u.y})}),[u.x,u.y,i]);return s().useEffect((()=>(document.addEventListener("mousemove",f),document.addEventListener("mouseup",E),()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",E)})),[f,E]),s().createElement("div",{style:{position:"absolute",top:u.y,left:u.x},ref:g,onMouseDown:p},t)},We=n.default.registry.getLazyComponent("Loader"),Se=({name:e,uniqid:t,inplace:i})=>{const n=(0,u.useSelector)((e=>l.$L.selectors.selectWidgetState(e,t))),o=l.$L.definition(e);return(null==n?void 0:n.loading)?s().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}},s().createElement(We,null)):(null==n?void 0:n.hover)?s().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}}):!(null==n?void 0:n.initialized)&&i||(null==n?void 0:n.initialized)||i?s().createElement(s().Fragment,null):s().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,1)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}},s().createElement("img",{src:o.img}))};var $e=i(769);const Me=({uniqid:e,widgetObject:t,commentId:i,widget:n,inplace:o=!0,mode:r,width:a,editRight:d,deleteRight:m,onWidgetUpdate:g,onRemove:p})=>{const f=(0,u.useDispatch)(),E=(0,u.useSelector)((t=>l.$L.selectors.selectWidget(t,e))),y=(0,u.useSelector)((t=>t.widgets.editableMap[e]),u.shallowEqual),v=(0,u.useSelector)((e=>e.widgets.currentEditableWidgetId),u.shallowEqual),h=(0,u.useSelector)((t=>t.widgets.currentEditableWidgetId===e),u.shallowEqual),{ref:w,isComponentVisible:x,setIsComponentVisible:C}=(0,$e.I)(!1);if((0,c.useEffect)((()=>{t&&f(l.$L.slice.actions.registerWidgetObject({uniqid:e,object:t}))}),[]),(0,c.useEffect)((()=>{n&&f(l.$L.slice.actions.registerWidget({uniqid:e,widget:n}))}),[]),(0,c.useEffect)((()=>{x||e===v&&f(l.$L.slice.actions.setEditableWidgetId({uniqid:void 0}))}),[x]),(0,c.useEffect)((()=>{x!==h&&C(h)}),[h]),void 0===E)return s().createElement(s().Fragment,null,"This widget cannot be displayed");const b=()=>{"edit"===r?k():"widget-article-button"===E.widget.name&&"link"===E.widget.content.openingType&&E.widget.content.openingTypeLink&&window.open(E.widget.content.openingTypeLink.url,E.widget.content.openingTypeLink.target)},k=()=>{if("view"===r)return;const{widget:e}=E;f(l.Wq.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))};return o&&"view"!==r?s().createElement("div",{ref:w,onClick:()=>{C(!0),y&&(f(l.$L.slice.actions.setEditableIndex({index:y.index})),f(l.$L.slice.actions.setEditableWidgetId({uniqid:e})))}},s().createElement(xe,{width:a,widget:E.widget,inplace:o,mode:r,onClick:b,onRemove:p}),s().createElement(be,{uniqid:e,mode:r}),s().createElement(Se,{name:E.widget.name,uniqid:E.widget.uniqid,inplace:o})):s().createElement("div",{onClick:k},s().createElement(xe,{widget:Object.assign(Object.assign({},E.widget),E.title&&{title:E.title}),commentId:i,inplace:o,mode:r,width:a,onClick:b,editRight:d,deleteRight:m,onWidgetUpdate:g,onRemove:p}),s().createElement(be,{uniqid:e,mode:r}),s().createElement(Se,{name:E.widget.name,uniqid:E.widget.uniqid,inplace:o}))},Ie=Me;var Ae,Oe=i(533),Te=new Uint8Array(16);function Fe(){if(!Ae&&!(Ae="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ae(Te)}const je=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var _e=[],Re=0;Re<256;++Re)_e.push((Re+256).toString(16).substr(1));const De=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(_e[e[t+0]]+_e[e[t+1]]+_e[e[t+2]]+_e[e[t+3]]+"-"+_e[e[t+4]]+_e[e[t+5]]+"-"+_e[e[t+6]]+_e[e[t+7]]+"-"+_e[e[t+8]]+_e[e[t+9]]+"-"+_e[e[t+10]]+_e[e[t+11]]+_e[e[t+12]]+_e[e[t+13]]+_e[e[t+14]]+_e[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&je.test(e)}(i))throw TypeError("Stringified UUID is invalid");return i},ze=function(e,t,i){var n=(e=e||{}).random||(e.rng||Fe)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(var l=0;l<16;++l)t[i+l]=n[l];return t}return De(n)},Je=J.react.registry.getLazyComponent("EditorsPortal"),Ge=J.react.registry.getLazyComponent("ThemeProvider"),Be=()=>{const e=document.getElementById("react-portals"),t=(0,c.useMemo)((()=>e&&(e=>{let t=document.getElementById("react-portals");return t||(t=document.createElement("div"),t.id=ze(),e.appendChild(t)),t})(e)),[e]);return t?(0,Oe.createPortal)(s().createElement(Ge,null,s().createElement(Je,null)),t):null};var Ue=function(e,t,i,n){return new(i||(i=Promise))((function(l,o){function r(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?l(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};const He=g().div`
|
|
212
|
+
display: flex;
|
|
213
|
+
flex-direction: column;
|
|
214
|
+
gap: 4px;
|
|
215
|
+
flex: 1;
|
|
216
|
+
width: 100%;
|
|
217
|
+
margin-top: 10px;
|
|
218
|
+
`,Ne=({articleId:e,variant:t="inline"})=>{var i;const r=(0,d.useIntl)(),g=(0,m.useTheme)(),p=(0,u.useDispatch)(),[f,E]=(0,c.useState)(),[y,v]=(0,c.useState)(!1),[h,w]=(0,c.useState)([]),[x,C]=(0,c.useState)(!1),b=(0,u.useSelector)(l.EK.selectors.get),k=(0,u.useSelector)(l.$L.selectors.selectWidgets),L=(0,u.useSelector)(l.zh.selectors.selectTinyMCECommonOptions),W=(0,u.useSelector)(l.Hn.selectors.selectAll),S=(0,u.useSelector)(l.t4.selectors.selectPlatformConfig),$=(0,u.useSelector)((e=>l.Mx.selectors.selectById(e,"OnlyOfficeHook"))),M=(0,u.useSelector)((t=>l.sv.selectors.commentList(t,e))),I=(0,u.useSelector)((e=>l.ew.selectors.selectHook(e,"DriveHook"))),A=(0,u.useSelector)((e=>l.Mx.selectors.selectById(e,"FileBankHook"))),O=(0,u.useSelector)((e=>l.ew.selectors.selectHook(e,"WidgetHook")));(e=>{const t=(0,u.useDispatch)(),i=(0,c.useMemo)((()=>n.default.socket),[n.default.socket]),o=(0,c.useMemo)((()=>l.sv.getCommentRTHandlers(t,e)),[t,e]);(0,c.useEffect)((()=>(o.forEach((e=>{i.onMessage(e.namespace,e.function,e.handler)})),()=>{o.forEach((e=>{i.offMessage(e.namespace,e.function,e.handler)}))})),[o,i])})(e),((e,t)=>{const i=(0,u.useDispatch)(),o=(0,c.useMemo)((()=>n.default.socket),[n.default.socket]),r=(0,c.useMemo)((()=>l.sv.getCommentsLikeRTHandlers(i,e,t)),[i,e,t]);(0,c.useEffect)((()=>(r.forEach((e=>{o.onMessage(e.namespace,e.function,e.handler)})),()=>{r.forEach((e=>{o.offMessage(e.namespace,e.function,e.handler)}))})),[r,o])})(null==M?void 0:M.list.map((e=>e.id)),e);const T=(0,c.useCallback)((e=>{p(l.FN.actions.error({label:null!=e?e:r.formatMessage({id:"GLOBAL_Error"})}))}),[p,r]),F=()=>{p(l.sv.actions.fetchComments({idArticle:e})),j()},j=(0,c.useCallback)((()=>{f||x||(C(!0),a().network.token().then((e=>{E(e.result),C(!1)})).catch((e=>{T(e.errorMsg)})))}),[T,f,x]),_=(0,c.useCallback)((t=>Ue(void 0,void 0,void 0,(function*(){if(f){v(!0);const i=Object.keys(k).map((e=>(null==h?void 0:h.some((t=>t.widget.uniqid===e)))?k[e]:null)).filter((e=>null!==e));try{yield a().article.addComment(Object.assign(Object.assign({},t),{widgets:i,token:f,idArticle:e})).then((()=>{h.forEach((e=>{p(l.$L.slice.actions.flushWidget({uniqid:e.widget.uniqid}))})),w([])})),j()}catch(e){T(e.errorMsg)}finally{v(!1)}}}))),[e,p,j,T,f,k,h]);return(0,c.useEffect)((()=>{j()}),[j]),(0,c.useEffect)((()=>(p(l.sv.actions.fetchComments({idArticle:e})),()=>{p(l.sv.actions.discardComments({idArticle:e}))})),[]),s().createElement(s().Fragment,null,L&&s().createElement(s().Fragment,null,s().createElement(He,null,s().createElement(o.JRCCommentsBloc,{loading:y,token:f,comments:null==M?void 0:M.list,onComment:_,onCommentUpdate:t=>Ue(void 0,void 0,void 0,(function*(){var i,n;const o=null==M?void 0:M.list.find((e=>e.id===t.idComment));if(o)return a().article.updateComment({idComment:t.idComment,description:null!==(n=null!==(i=t.description)&&void 0!==i?i:o.description)&&void 0!==n?n:void 0,token:t.token,widgets:t.widgets}).then((()=>{p(l.sv.actions.fetchComments({idArticle:e})),j()})).catch((e=>{T(e.errorMsg)}))})),onCommentDelete:e=>Ue(void 0,void 0,void 0,(function*(){a().article.deleteComment(e).catch(T)})),isWidgetActive:!!((null==O?void 0:O.isActive)&&(null==O?void 0:O.create)&&(null===(i=null==O?void 0:O.autorize)||void 0===i?void 0:i.includes("comment"))),widgetListComponent:s().createElement(q,{mode:"comment",namespace:"comment",onChange:e=>{w([...h,e]),p(l.$L.slice.actions.registerWidget({uniqid:e.widget.uniqid,widget:e}))},view:"edit"}),newWidgetsWrapperComponent:s().createElement(s().Fragment,null,h.map((e=>e&&e.widget&&s().createElement("div",{key:e.widget.uniqid},s().createElement(Ie,{uniqid:e.widget.uniqid,widget:e,inplace:!0,mode:"edit",onRemove:e=>w(h.filter((t=>t.widget.uniqid!==e)))}))))),existingWidgetsWrapperComponent:(t,i,n,o=!0,r,c=!1,d=!1)=>s().createElement(s().Fragment,null,null==i?void 0:i.map((i=>i&&s().createElement("div",{key:i.widget.uniqid},s().createElement(Ie,{uniqid:i.widget.uniqid,widgetObject:t,commentId:r,widget:i,inplace:o,mode:n,editRight:c,deleteRight:d,onWidgetUpdate:F,onRemove:t=>{a().widget.removeWidget({id:r,type:"comment",uniqid:t}).then((()=>{p(l.sv.actions.fetchComments({idArticle:e})),j()})).catch((e=>{T(e.errorMsg)}))}}))))),currentUser:b,tinyMCEConfig:{commonOptions:L,mentionsQueries:(0,n.getTinyMCEMentionsQueries)(W,g,T)},onError:T,highlightFields:S.userHighlightFields,userAccountStatus:S.userAccountStatus,userModel:W.find((e=>"user"===e.type)),isWedocActive:!!$,onGetHashError:e=>p(l.FN.actions.error({label:null!=e?e:r.formatMessage({id:"GLOBAL_Error"})})),activeDrives:J.debug.UploadFromDrives?[...A&&I?["fileBank"]:[],...l.ew.utils.buildDrivesArrayFromObject(null==I?void 0:I.drives)]:[],socialActionAdd:({targetId:e,targetType:t,type:i})=>a().socialAction.add({targetType:t,targetId:e,type:i}),deleteFile:e=>Ue(void 0,void 0,void 0,(function*(){f&&(yield a().file.deleteFile(e,"attachment",f))})),fetchUser:e=>a().user.get(e),fetchUserFields:(e,t)=>a().user.getFields(e,t),fetchSocialActionUserList:({targetId:e,targetType:t,type:i})=>a().socialAction.getUsers({targetType:t,targetId:e,type:i}),removeLike:({targetId:e,targetType:t,type:i})=>a().socialAction.remove({targetType:t,targetId:e,type:i}),variant:t}),s().createElement(Be,null))))},Pe=()=>c.createElement(c.Fragment,null);var Ve=i(248);const Qe=n.default.registry.getLazyComponent("Container"),Ke=n.default.registry.getLazyComponent("AppColumn"),Xe=n.default.registry.getLazyComponent("MainColumn");function Ye({extensionRoute:e,routes:t,description:i,mode:n="center"}){var l;const o=(0,d.useIntl)(),{pathname:r}=(0,Ve.useLocation)(),a=(0,c.useMemo)((()=>Object.values(t)),[t]),[s,u]=c.useState(null===(l=null==a?void 0:a[0])||void 0===l?void 0:l.key),m=a.map((t=>Object.assign(Object.assign({},t),{label:o.formatMessage({id:t.label}),href:t.absolutePath?t.path:`/ng/rr/${e}/${t.path}`,group:t.group?o.formatMessage({id:t.group}):void 0})));return c.useEffect((()=>{const t=a.find((t=>r===`/ng/rr/${e}/${t.path}`));t&&u(t.key)}),[r,a,e]),c.createElement(c.Suspense,{fallback:c.createElement(c.Fragment,null)},c.createElement(Qe,{mode:n},c.createElement(Ke,{mode:n,description:i,tabs:m,activeTab:s||""}),c.createElement(Xe,{mode:n},c.createElement(Ve.Outlet,null))))}g().div`
|
|
219
|
+
margin-bottom: 24px;
|
|
220
|
+
`,g().div`
|
|
221
|
+
margin-bottom: 4px;
|
|
222
|
+
`;const Ze=g().div`
|
|
223
|
+
position: absolute;
|
|
224
|
+
background-color: ${e=>e.isActive?"rgba(0,0,0,.1)":"transparent"};
|
|
225
|
+
inset: 0;
|
|
226
|
+
pointer-events: ${e=>e.isActive?"all":"none"};
|
|
227
|
+
flex: 1;
|
|
228
|
+
display: flex;
|
|
229
|
+
overflow: hidden;
|
|
230
|
+
`,et=g().div`
|
|
231
|
+
flex-direction: row;
|
|
232
|
+
display: flex;
|
|
233
|
+
min-height: 60px;
|
|
234
|
+
border-bottom: 1px solid ${e=>e.theme.color.grey2};
|
|
235
|
+
`,tt=g().div`
|
|
236
|
+
width: 60px;
|
|
237
|
+
display: flex;
|
|
238
|
+
align-items: center;
|
|
239
|
+
justify-content: center;
|
|
240
|
+
`,it=g().div`
|
|
241
|
+
flex: 1;
|
|
242
|
+
display: flex;
|
|
243
|
+
align-items: center;
|
|
244
|
+
justify-content: center;
|
|
245
|
+
`,nt=g().div`
|
|
246
|
+
position: absolute;
|
|
247
|
+
top: 90px;
|
|
248
|
+
right: ${e=>e.visible?"0":"-1000"}px;
|
|
249
|
+
width: ${440}px;
|
|
250
|
+
bottom: 0;
|
|
251
|
+
display: flex;
|
|
252
|
+
background-color: ${e=>e.theme.color.white};
|
|
253
|
+
flex-direction: row;
|
|
254
|
+
transition: all 0.4s;
|
|
255
|
+
box-shadow: -4px 0px 20px 0px #00000017;
|
|
256
|
+
`,lt=g().div`
|
|
257
|
+
flex: 1;
|
|
258
|
+
display: flex;
|
|
259
|
+
flex-direction: row;
|
|
260
|
+
padding: 12px;
|
|
261
|
+
overflow: auto;
|
|
262
|
+
margin-bottom: 12px;
|
|
263
|
+
`,ot=g().div`
|
|
264
|
+
width: ${50}px;
|
|
265
|
+
padding-top: 60px;
|
|
266
|
+
display: flex;
|
|
267
|
+
flex-direction: column;
|
|
268
|
+
border-right: 1px solid ${e=>e.theme.color.grey2};
|
|
269
|
+
`,rt=g().button`
|
|
270
|
+
border-radius: 4px;
|
|
271
|
+
cursor: pointer;
|
|
272
|
+
height: 42px;
|
|
273
|
+
margin: 4px;
|
|
274
|
+
width: 42px;
|
|
275
|
+
display: flex;
|
|
276
|
+
align-items: center;
|
|
277
|
+
justify-content: center;
|
|
278
|
+
background-color: ${e=>e.isActive?e.theme.color.grey1:e.theme.color.white};
|
|
279
|
+
&:hover {
|
|
280
|
+
background-color: ${e=>e.theme.color.grey1};
|
|
281
|
+
}
|
|
282
|
+
`,at=(g().div`
|
|
283
|
+
display: flex;
|
|
284
|
+
border: 1px solid ${e=>e.theme.color.grey1};
|
|
285
|
+
border-radius: ${8}px;
|
|
286
|
+
margin-bottom: 24px;
|
|
287
|
+
input {
|
|
288
|
+
width: 100%;
|
|
289
|
+
border: 0;
|
|
290
|
+
height: ${50}px;
|
|
291
|
+
margin: 0;
|
|
292
|
+
}
|
|
293
|
+
`,g().div`
|
|
294
|
+
display: flex;
|
|
295
|
+
flex-direction: row;
|
|
296
|
+
padding: 12px;
|
|
297
|
+
background-color: ${e=>e.theme.color.grey0};
|
|
298
|
+
border-radius: 8px;
|
|
299
|
+
margin-bottom: 4px;
|
|
300
|
+
`),ct=g().div`
|
|
301
|
+
display: flex;
|
|
302
|
+
flex: 1;
|
|
303
|
+
align-items: center;
|
|
304
|
+
`,st=g().div`
|
|
305
|
+
width: 40px;
|
|
306
|
+
display: flex;
|
|
307
|
+
justify-content: center;
|
|
308
|
+
align-items: center;
|
|
309
|
+
`,dt=(g().div`
|
|
310
|
+
flex-direction: row;
|
|
311
|
+
display: flex;
|
|
312
|
+
align-items: center;
|
|
313
|
+
`,g().div`
|
|
314
|
+
flex: 1;
|
|
315
|
+
display: flex;
|
|
316
|
+
align-items: center;
|
|
317
|
+
`,({uniqid:e})=>{const t=(0,u.useDispatch)(),i=(0,u.useSelector)((t=>l.Wq.selectors.selectEditor(t,e)));return i&&i.popup&&i.view?s().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",backgroundColor:"white",marginTop:90}},s().createElement(et,null,s().createElement(tt,null),s().createElement(it,null,"Popup"),s().createElement(tt,null,s().createElement(rt,{onClick:()=>{t(l.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},s().createElement(o.JRCIcon,{name:"icon-times",color:"grey2"})))),s().createElement("div",{style:{flex:1,display:"flex"}},i.view),s().createElement(et,null,s().createElement(o.JRCButton,{onClick:()=>{t(l.Wq.slice.actions.flushEditorPopup({uniqid:e}))}},"Save"))):s().createElement(s().Fragment,null)});const ut=n.default.registry.getLazyComponent("WidgetArticleTitleEditor"),mt=n.default.registry.getLazyComponent("WidgetArticleTextEditor"),gt=n.default.registry.getLazyComponent("WidgetArticleGalleryEditor"),pt=n.default.registry.getLazyComponent("WidgetArticleAttachmentEditor"),ft=n.default.registry.getLazyComponent("WidgetArticleSliderEditor"),Et=n.default.registry.getLazyComponent("WidgetArticleImageEditor"),yt=n.default.registry.getLazyComponent("WidgetButtonEditor"),vt=n.default.registry.getLazyComponent("WidgetApiEditor"),ht=n.default.registry.getLazyComponent("WidgetCheckListEditor"),wt=({uniqid:e})=>{var t,i,n,o,r,c;const m=(0,d.useIntl)(),g=(0,u.useDispatch)(),p=(0,u.useSelector)(l.$L.selectors.selectToken),f=(0,u.useSelector)((t=>l.$L.selectors.selectWidget(t,e))),E=(0,u.useSelector)((t=>l.$L.selectors.selectWidgetObject(t,e))),y=t=>{f&&g(l.$L.slice.actions.updateWidget({uniqid:e,content:t})),g(l.Wq.slice.actions.flushEditor({uniqid:e}))},v=(t,i)=>{g(void 0!==i?l.$L.slice.actions.setWidgetState(Object.assign({uniqid:i},t)):l.$L.slice.actions.setWidgetState(Object.assign({uniqid:e},t)))},h=t=>{g(l.Wq.slice.actions.registerEditorPopup({uniqid:e,view:t}))};switch(null==f?void 0:f.widget.name){default:return s().createElement(s().Fragment,null,"cannot display editor");case"widget-article-button":return s().createElement(s().Fragment,null,s().createElement(yt,Object.assign({},f.widget.content,{onChange:t=>{g((0,l.O5)(e,t,!1))},onSave:()=>y({})})));case"widget-article-attachment":return s().createElement(pt,{token:p,content:f.widget.content,onChange:t=>{g((0,l.O5)(e,t,!1))},onSave:y,onStateChange:v,onOpen:h});case"widget-article-gallery":return s().createElement(gt,{token:p,content:f.widget.content,onChange:t=>g((0,l.O5)(e,t,!1)),onSave:y,onStateChange:v});case"widget-article-text":return s().createElement(mt,{onChange:t=>{g((0,l.O5)(e,t,!1))},onSave:y,content:f.widget.content});case"widget-article-image":return s().createElement(Et,{content:f.widget.content,token:p,onChange:t=>{g((0,l.O5)(e,t,!1))},onSave:y,onStateChange:v});case"widget-api":return s().createElement(vt,{onChange:t=>g((0,l.O5)(e,t,!1)),provider:e=>{return t=void 0,i=void 0,l=function*(){return fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}}).then((e=>e.json())).then((e=>e.result))},new((n=void 0)||(n=Promise))((function(e,o){function r(e){try{c(l.next(e))}catch(e){o(e)}}function a(e){try{c(l.throw(e))}catch(e){o(e)}}function c(t){var i;t.done?e(t.value):(i=t.value,i instanceof n?i:new n((function(e){e(i)}))).then(r,a)}c((l=l.apply(t,i||[])).next())}));var t,i,n,l},initialUrl:null!==(t=f.widget.content.url)&&void 0!==t?t:"",order:null!==(i=f.widget.content.order)&&void 0!==i?i:"",orderBy:null!==(n=f.widget.content.orderBy)&&void 0!==n?n:"asc"});case"widget-article-title":return s().createElement(ut,{onChange:t=>{g((0,l.O5)(e,t,!1))},onSave:y,content:f.widget.content,onOpen:h});case"widget-article-slider":return void 0!==p?s().createElement(ft,{slides:null!==(o=f.widget.content.slides)&&void 0!==o?o:[],loop:null!==(r=f.widget.content.loop)&&void 0!==r&&r,useDots:null===(c=f.widget.content.useDots)||void 0===c||c,onChange:t=>{g((0,l.O5)(e,t,!1))},token:p,onSave:y}):s().createElement(s().Fragment,null,"Token is mandatory");case"widget-check-list":return s().createElement(ht,{token:p,uniqid:f.widget.uniqid,content:f.widget.content,onChangeContent:(e,t)=>{g((0,l.O5)(e,t,!1))},onChangeWrapper:e=>{g(l.$L.slice.actions.updateWidgetWrapper(Object.assign({},e)))},onSave:(e,t)=>{var i;void 0!==(i=E)&&void 0!==i.id&&void 0!==i.type?a().widget.updateWidget({id:E.id,uniqid:e,type:E.type,title:f.title,content:t}).then((()=>{y(t)})).catch((e=>{var t;g(l.FN.actions.error({label:null!==(t=e.errorMsg)&&void 0!==t?t:m.formatMessage({id:"GLOBAL_Error"})}))})):y(t)}})}},xt=({uniqid:e})=>{const t=(0,u.useDispatch)(),i=(0,d.useIntl)(),n=(0,u.useSelector)((t=>l.$L.selectors.selectWidgetContent(t,e)));return s().createElement("div",{style:{flex:1}},s().createElement(Ct,{uniqid:e}),n&&n.widgets?n.widgets.map(((r,a)=>{const c=l.$L.definition(r.widget.name);return s().createElement("div",{key:a},s().createElement(at,null,s().createElement(ct,{onClick:()=>((e,i)=>{t(l.Wq.slice.actions.registerEditor({uniqid:e,name:i}))})(r.widget.uniqid,r.widget.name)},i.formatMessage({id:c.label})),s().createElement(st,{onClick:()=>{n.widgets&&t(l.$L.slice.actions.updateWidget({uniqid:e,content:Object.assign(Object.assign({},n),{widgets:[...n.widgets.filter(((e,t)=>t!==a))]})}))}},s().createElement(o.JRCIcon,{name:"icon-trash"}))))})):s().createElement(s().Fragment,null))},Ct=({uniqid:e})=>{const t=(0,u.useDispatch)(),i=(0,u.useSelector)((t=>t.widgets.ids[e].widget.layers),u.shallowEqual);return s().createElement(s().Fragment,null,s().createElement(o.BETA_JRCDragAndDrop,{onDrag:()=>{},renderEl:(e,t)=>s().createElement(qt,{uniqid:e,key:t}),elms:i||[]}),s().createElement(q,{namespace:"default",onChange:i=>{t(l.$L.slice.actions.registerLayer({uniqid:e,widget:i}))},mode:"button"}))},bt=({uniqid:e})=>{const t=(0,u.useDispatch)(),i=(0,u.useSelector)((t=>t.widgets.layers[e]));return s().createElement("div",{onClick:()=>{t(l.$L.slice.actions.updateLayer({uniqid:e,props:{locked:!i.locked}}))}},s().createElement(o.JRCIcon,{name:i.locked?"icon-lock":"icon-unlock"}))},kt=({uniqid:e})=>{const t=(0,u.useDispatch)(),i=(0,u.useSelector)((t=>t.widgets.layers[e]));return s().createElement("div",{onClick:()=>{t(l.$L.slice.actions.updateLayer({uniqid:e,props:{visible:!i.visible}}))}},s().createElement(o.JRCIcon,{name:i.visible?"icon-eye":"icon-eye-slash"}))},Lt=({uniqid:e,layerId:t})=>{const i=(0,u.useDispatch)();return s().createElement("div",{onClick:()=>{i(l.$L.slice.actions.flushLayer({uniqid:e,layerId:t}))}},s().createElement(o.JRCIcon,{name:"icon-trash"}))},qt=({uniqid:e})=>{const t=(0,u.useSelector)((t=>t.widgets.layers[e]));return s().createElement(s().Fragment,null,t.title,t.widgets.map(((i,n)=>{const o=l.$L.definition(i.widget.name);return s().createElement("div",{style:{flexDirection:"row",display:"flex"},key:n},s().createElement("div",{style:{flex:1,alignItems:"center"}},o.label),s().createElement(bt,{uniqid:e}),s().createElement(kt,{uniqid:e}),s().createElement(Lt,{uniqid:i.widget.uniqid,layerId:t.uniqid}))})))};var Wt=i(230);const St=n.default.registry.getLazyComponent("Button"),$t=({uniqid:e})=>{const t=(0,d.useIntl)(),i=(0,u.useDispatch)(),n=(0,u.useSelector)((t=>l.$L.selectors.selectWidget(t,e))),[r,a]=s().useState(null==n?void 0:n.title),{control:c,watch:m}=(0,Wt.useForm)({defaultValues:{text:null!=r?r:""},criteriaMode:"all"});return s().useEffect((()=>{const e=m((e=>{a(e.text)}));return()=>e.unsubscribe()}),[m]),n?s().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"space-between"}},s().createElement(o.JRCInputText,{name:"text",control:c,placeholder:t.formatMessage({id:"WIDGET_Title"})}),s().createElement(St,{onClick:()=>{void 0!==r&&(i(l.$L.slice.actions.updateWidgetWrapper({uniqid:e,title:r})),i(l.Wq.slice.actions.flushEditor({uniqid:e})))},minWidth:"100%"},t.formatMessage({id:"GLOBAL_Save"}))):s().createElement(s().Fragment,null,"No wrapper")},Mt=n.default.registry.getLazyComponent("Icon"),It=({uniqid:e})=>{const t=(0,d.useIntl)(),i=(0,u.useDispatch)(),n=(0,u.useSelector)((t=>l.Wq.selectors.selectEditor(t,e))),o=l.$L.definition(null==n?void 0:n.name),[r,a]=s().useState(!1),[c,m]=s().useState("default");return s().useEffect((()=>{setTimeout((()=>{a(!0)}),0)})),n?s().createElement("div",{style:{width:440,position:"relative"}},s().createElement(nt,{visible:r},(o.panel.useWrapper||o.panel.useEditor||o.panel.useWidgets)&&s().createElement(ot,null,o.panel.useWrapper?s().createElement(rt,{isActive:"wrapper"===c,onClick:()=>m("wrapper")},s().createElement(Mt,{name:"icon-font",color:"grey2"})):s().createElement(s().Fragment,null),o.panel.useEditor?s().createElement(rt,{isActive:"default"===c,onClick:()=>m("default")},s().createElement(Mt,{name:"icon-pen",color:"grey2"})):s().createElement(s().Fragment,null),o.panel.useWidgets?s().createElement(Ot,{uniqid:e},s().createElement(rt,{isActive:"widgets"===c,onClick:()=>m("widgets")},s().createElement(Mt,{name:"icon-sliders",color:"grey2"}))):s().createElement(s().Fragment,null)),s().createElement("div",{style:{flex:1,display:"flex",flexDirection:"column"}},s().createElement(et,null,s().createElement(At,{uniqid:e,position:n.position}),s().createElement(it,null,t.formatMessage({id:o.label})),s().createElement(tt,null,s().createElement(rt,{onClick:()=>{i(l.Wq.slice.actions.flushEditor({uniqid:e}))}},s().createElement(Mt,{name:"icon-times",color:"grey2"})))),s().createElement(lt,null,"default"===c&&o.panel.useEditor?s().createElement(wt,{uniqid:n.uniqid}):s().createElement(s().Fragment,null),"wrapper"===c&&o.panel.useWrapper?s().createElement($t,{uniqid:n.uniqid}):s().createElement(s().Fragment,null),"widgets"===c&&o.panel.useWidgets?s().createElement(xt,{uniqid:e,namespace:o.name}):s().createElement(s().Fragment,null)))),(null==n?void 0:n.popup)?s().createElement("div",{style:{position:"absolute",inset:0,backgroundColor:"#000",opacity:".7"}}):s().createElement(s().Fragment,null)):s().createElement(s().Fragment,null)},At=({uniqid:e,position:t})=>{const i=(0,u.useDispatch)();return s().createElement(tt,null,s().createElement(rt,{onClick:()=>{i(l.Wq.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))}},s().createElement(Mt,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:"grey2"})))},Ot=({uniqid:e,children:t})=>{const i=(0,u.useSelector)((t=>l.$L.selectors.selectWidgetState(t,e)));return(null==i?void 0:i.initialized)?t:s().createElement(s().Fragment,null)},Tt=g().div`
|
|
318
|
+
position: absolute;
|
|
319
|
+
inset: 0;
|
|
320
|
+
pointer-events: none;
|
|
321
|
+
z-index: 100;
|
|
322
|
+
`,Ft=g().div`
|
|
323
|
+
flex: 1;
|
|
324
|
+
display: flex;
|
|
325
|
+
margintop: ${90}px;
|
|
326
|
+
pointer-events: ${e=>e.isActive?"all":"none"};
|
|
327
|
+
`,jt=g().div`
|
|
328
|
+
flex: 1;
|
|
329
|
+
display: flex;
|
|
330
|
+
flex-direction: row;
|
|
331
|
+
pointer-events: none;
|
|
332
|
+
`,_t=g().div`
|
|
333
|
+
width: ${440}px;
|
|
334
|
+
pointer-events: none;
|
|
335
|
+
`,Rt=()=>{const e=(0,u.useSelector)(l.Wq.selectors.selectEditors);return s().createElement(Tt,null,e.map(((e,t)=>"left"===e.position?s().createElement(Ze,{isActive:!1,key:t},s().createElement(jt,null,s().createElement(It,{uniqid:e.uniqid}),s().createElement(Ft,{isActive:void 0!==e.popup},s().createElement(dt,{uniqid:e.uniqid})),s().createElement(_t,null))):s().createElement(Ze,{isActive:!1,key:t},s().createElement(jt,null,s().createElement(_t,null),s().createElement(Ft,{isActive:void 0!==e.popup},s().createElement(dt,{uniqid:e.uniqid})),s().createElement(It,{uniqid:e.uniqid}))))))},Dt=()=>{const[e,t]=(0,c.useState)(),i=(0,d.useIntl)(),n=(0,c.useCallback)((e=>{t(Object.assign(Object.assign({},e),{reject:i=>{e.reject(i),t(void 0)},resolve:i=>{e.resolve(i),t(void 0)}}))}),[]),l=(0,c.useCallback)(((e,t)=>new Promise(((i,l)=>{n({reject:l,resolve:i,text:e,capability:t})}))),[n]),r=(0,c.useMemo)((()=>({develop:e=>l(e,"develop"),summarize:e=>l(e,"summarize"),tldr:e=>l(e,"tldr"),en:e=>l(e,"en"),es:e=>l(e,"es"),formal:e=>l(e,"formal"),funny:e=>l(e,"funny")})),[l]);return[e,(0,c.useMemo)((()=>o.JTinyMCEExtensionsBuilders.jia(r,i)),[i,r])]},zt=g().div`
|
|
336
|
+
padding: ${e=>e.theme.space.md}px;
|
|
337
|
+
`,Jt={response:void 0,loading:!0,error:void 0},Gt=({query:e})=>{const t=(0,d.useIntl)(),[i,n]=(0,c.useState)(Jt),l=(0,c.useCallback)((e=>{n(Jt),a().jia.textEnhancement({text:e.text,capacity:e.capability}).then((e=>{if(e.error)return void n({error:`${t.formatMessage({id:"JIA_ERROR_AI_CALL"})}${e.errorMsg&&": "+e.errorMsg}`,loading:!1,response:void 0});const i=e.result.text;n({error:void 0,loading:!1,response:i})})).catch((e=>{n({error:t.formatMessage({id:"JIA_ERROR_AI_CALL"}),loading:!1,response:void 0})}))}),[t]);return(0,c.useEffect)((()=>{e&&e.text.trim().length>0&&l(e)}),[e,l]),s().createElement(o.JRCModalLayout,{zIndex:50010,open:!!e,closeHandler:()=>{null==e||e.reject()}},s().createElement(o.JRCModalContent,{overflow:"scroll",buttons:[{children:t.formatMessage({id:"GLOBAL_Try_Again"}),clickHandler:()=>{e&&l(e)}},{children:t.formatMessage({id:"GLOBAL_Validation"}),clickHandler:()=>i.response&&(null==e?void 0:e.resolve(i.response))},{children:t.formatMessage({id:"GLOBAL_Cancel"}),clickHandler:()=>null==e?void 0:e.reject()}],isFull:!0},s().createElement(zt,null,i.loading&&s().createElement(s().Fragment,null,s().createElement(o.JRCLoader,null),s().createElement(o.JRCTypography,{align:"center"},t.formatMessage({id:"JIA_WAITING_WARNIG"}))),!i.loading&&i.error&&s().createElement("p",null,i.error),!i.loading&&i.response&&s().createElement("p",null,i.response))))},Bt=e=>{const t=(0,d.useIntl)(),i=(0,u.useDispatch)(),r=(0,m.useTheme)(),a=(0,u.useSelector)(l.Hn.selectors.selectAll),[g,p]=Dt(),f=(0,c.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}),[]),E=(0,c.useMemo)((()=>f?[p]:[]),[p,f]),y=(0,c.useCallback)((e=>{i(l.FN.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[i,t]),v=(0,c.useMemo)((()=>(0,n.getTinyMCEMentionsQueries)(a,r,y)),[a,y,r]),h=(0,c.useMemo)((()=>n.default.tinymceCommonOptions),[]);return s().createElement(s().Fragment,null,h&&s().createElement(o.JRCInputTinyMCE,Object.assign({commonOptions:h,additionalExtensions:E,mentionsQueries:v},e)),s().createElement(Gt,{query:g}))},Ut=e=>{const t=(0,d.useIntl)(),i=(0,u.useDispatch)(),r=(0,m.useTheme)(),a=(0,u.useSelector)(l.Hn.selectors.selectAll),[g,p]=Dt(),f=(0,c.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}),[]),E=(0,c.useMemo)((()=>f?[p]:[]),[p,f]),y=(0,c.useCallback)((e=>{i(l.FN.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[i,t]),v=(0,c.useMemo)((()=>(0,n.getTinyMCEMentionsQueries)(a,r,y)),[a,y,r]),h=(0,c.useMemo)((()=>n.default.tinymceCommonOptions),[]);return s().createElement(s().Fragment,null,h&&s().createElement(o.JRCInputTinyMCERaw,Object.assign({commonOptions:h,additionalExtensions:E,mentionsQueries:v},e)),s().createElement(Gt,{query:g}))};var Ht=i(603),Nt=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(n=Object.getOwnPropertySymbols(e);l<n.length;l++)t.indexOf(n[l])<0&&Object.prototype.propertyIsEnumerable.call(e,n[l])&&(i[n[l]]=e[n[l]])}return i};const Pt=m.css`
|
|
338
|
+
height: 100%;
|
|
339
|
+
display: flex;
|
|
340
|
+
flex-direction: column;
|
|
341
|
+
justify-content: space-between;
|
|
342
|
+
`,Vt=g().div`
|
|
343
|
+
${({stretch:e})=>e&&Pt}
|
|
344
|
+
`,Qt=g().form`
|
|
345
|
+
${({stretch:e})=>e&&Pt}
|
|
346
|
+
`,Kt=c.forwardRef(((e,t)=>e.onSubmit?c.createElement(Qt,{stretch:e.stretch,onSubmit:e.onSubmit,ref:t},e.children):c.createElement(Vt,{stretch:e.stretch,ref:t},e.children))),Xt=g().div`
|
|
347
|
+
${e=>e.stretch&&"\n flex: 1;\n"}
|
|
348
|
+
`,Yt=c.forwardRef(((e,t)=>{const i=c.useRef(null),[n,l]=(0,Ht.GF)(e.fields,e.type),o=(0,Wt.useForm)({defaultValues:Object.assign(Object.assign({},l),e.defaultValues),criteriaMode:"all"}),{handleSubmit:r,control:a,reset:s}=o,d=Nt(o,["handleSubmit","control","reset"]);return c.useImperativeHandle(t,(()=>Object.assign(Object.assign({},d),{handleSubmit:r,control:a,reset:()=>{var e;null===(e=null==i?void 0:i.current)||void 0===e||e.scrollTo(0,0),s()}})),[]),c.createElement(Kt,{stretch:e.stretch,onSubmit:e.onSubmit?r(e.onSubmit):void 0,ref:i},c.createElement(Xt,{stretch:e.stretch},n.map((t=>{var{Input:i}=t,n=Nt(t,["Input"]);return c.createElement(i,Object.assign({key:n.name,control:a},n,{dataCy:`${e.dataCy}-${n.name}`,readOnly:e.readOnly}))})),e.extraInputs&&e.extraInputs(a)),e.buttons)}))}}]);
|
|
349
|
+
//# sourceMappingURL=524.bundle.js.map
|