jamespot-react-core 1.3.8 → 1.3.9
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/581.02792caba0594f6815e2.chunk.js +2 -0
- package/build/581.02792caba0594f6815e2.chunk.js.map +1 -0
- package/build/70.b156a91742e3d8901eaf.chunk.js +715 -0
- package/build/70.b156a91742e3d8901eaf.chunk.js.map +1 -0
- package/build/app.bundle.js +464 -401
- package/build/app.bundle.js.map +1 -1
- package/build/src/components/articleEditor/ArticleEditor.d.ts +22 -0
- package/build/src/components/calendar/CreateCalendarEventModal.d.ts +3 -1
- package/build/src/components/calendar/socialEvent/CreateSocialEventOrRecurringEventModal.d.ts +3 -1
- package/build/src/components/calendar/socialEvent/SocialEventOrRecurringEventForm.d.ts +2 -17
- package/build/src/components/calendar/socialEvent/types.d.ts +17 -0
- package/build/src/components/calendar/socialEvent/useRecurringEventUpdateHook.d.ts +21 -0
- package/build/src/components/calendar/socialEvent/useSocialEventOrRecurringEventCreationHook.d.ts +27 -0
- package/build/src/components/calendar/socialEvent/useSocialEventUpdateHook.d.ts +21 -0
- package/build/src/components/layouts/EditorLayout.d.ts +1 -0
- package/build/src/components/{TwoColLayout.d.ts → layouts/TwoColLayout.d.ts} +1 -1
- package/build/src/components/modals/ModalSchedule.d.ts +1 -2
- package/build/src/hooks/index.d.ts +5 -1
- package/build/src/hooks/useHref.d.ts +3 -0
- package/build/src/registry/core-component-list.d.ts +3 -0
- package/build/src/registry/coreComponents.d.ts +5 -2
- package/build/src/registry/ext-component-list.d.ts +1 -0
- package/build/src/types.d.ts +1 -0
- package/package.json +4 -4
- package/build/346.5e80d1d74f0d543bfa32.chunk.js +0 -2
- package/build/346.5e80d1d74f0d543bfa32.chunk.js.map +0 -1
- package/build/605.e14ede6ac53f82a861c7.chunk.js +0 -707
- package/build/605.e14ede6ac53f82a861c7.chunk.js.map +0 -1
- /package/build/src/components/{FullPageLayout.d.ts → layouts/FullPageLayout.d.ts} +0 -0
|
@@ -0,0 +1,715 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[70],{2070:(e,t,i)=>{i.r(t),i.d(t,{AIModal:()=>M,AddReportModal:()=>K,ArticleEditor:()=>ge,Audience:()=>L,Avatar:()=>p,CalendarToolbar:()=>$n,CalendarWrapper:()=>bl,CommentsBloc:()=>vn,CreateMeetingModal:()=>nl,CreateSocialEventOrRecurringEventModal:()=>pl,DisplayForm:()=>O,Editor:()=>ns,EditorLayout:()=>yl,EditorsPortal:()=>Ts,Empty:()=>qs,ExportCalendarModal:()=>gl,FullPageLayout:()=>zs,GifsModal:()=>bn,JRCInputTinyMCEWithExt:()=>Pn,JRCInputTinyMCEWithExtRaw:()=>Is,MarkdownModal:()=>St,ModalAudience:()=>ce,ModalSchedule:()=>le,SocialEventOrRecurringEventForm:()=>ha,TwoColLayout:()=>Bs,WidgetList:()=>_e,WidgetWrapperCore:()=>rn});var o=i(7670),n=i(1142),a=i(5762),l=i(128),s=i(7444),r=i(9532),d=i(4071),c=i(2389);const u=c.j.getLazyComponent("Icon"),g=c.j.getLazyComponent("JRCAvatar"),m=a.default.span`
|
|
2
|
+
${s.SROnly}
|
|
3
|
+
`,p=e=>{const t=(0,a.useTheme)(),i=(0,l.A)(),n=(0,d.GV)(r.Network.selectors.selectNetworkPublic);return e.uri===n?.uri?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(u,{name:"icon-fs-wall",size:8*(e.size??3),color:t.color.primary,variant:"circle"}),(0,o.jsx)(m,{children:i.formatMessage({id:"NETWORK_Public"})})]}):(0,o.jsx)(g,{...e})},h=c.j.getLazyComponent("FlexBox"),f=c.j.getLazyComponent("ModalContent"),x=c.j.getLazyComponent("ModalLayout"),j=c.j.getLazyComponent("StyledHref"),b=c.j.getLazyComponent("Tooltip"),C=c.j.getLazyComponent("Typography"),y=a.default.div`
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: 12px;
|
|
7
|
+
margin-bottom: 24px;
|
|
8
|
+
`,v=a.default.a`
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
position: relative;
|
|
13
|
+
width: 40px;
|
|
14
|
+
height: 40px;
|
|
15
|
+
border-radius: 40px;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
color: ${e=>e.theme.color.white};
|
|
18
|
+
background-color: ${e=>e.theme.color.lavender};
|
|
19
|
+
border: 4px solid ${e=>e.theme.color.white};
|
|
20
|
+
margin-left: ${e=>e.overlap?"-18px":"0"};
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
`,L=({audience:e,limit:t=2})=>{const i=(0,l.A)(),r=(0,a.useTheme)(),[d,c]=(0,n.useState)(!1);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(h,{children:[[...e].splice(0,t).map((e,t)=>(0,o.jsx)(v,{overlap:0!==t,href:e._url,target:"_blank",children:(0,o.jsx)(b,{description:void 0===e.title?" ":e.title,position:"left",children:(0,o.jsx)(p,{uri:e.uri,size:4,variant:"circle",alt:"image",timestamp:e.dateModified?s.Utils.date.strToTimestamp(e.dateModified):void 0,focusable:!0})})},e.id)),e.length>t&&(0,o.jsxs)(v,{onClick:()=>c(!0),overlap:!0,children:["+",e.length-t]})]}),e.length>t&&(0,o.jsx)(x,{closeHandler:()=>c(!1),enableClickAwayCloseModal:!0,open:d,variant:"fixed-height",maxHeight:"800px",children:(0,o.jsx)(f,{title:i.formatMessage({id:"GLOBAL_Audience"}),overflow:"scroll",onClickIconClose:()=>c(!1),children:(0,o.jsx)(y,{children:e.map((e,t)=>(0,o.jsxs)(h,{y:"center",gap:r.space.l,children:[(0,o.jsx)(p,{size:5,uri:`${e.type}/${e.id}`}),(0,o.jsx)(j,{href:`${e.type}/${e.id}`,children:(0,o.jsx)(C,{children:e.title})})]},`audience-${t}`))})})})]})};var E=i(9108);const A=c.j.getLazyComponent("Loader"),k=c.j.getLazyComponent("ModalContent"),W=c.j.getLazyComponent("ModalLayout"),_=c.j.getLazyComponent("Typography"),w=a.default.div`
|
|
23
|
+
padding: ${e=>e.theme.space.md}px;
|
|
24
|
+
`,S={response:void 0,loading:!0,error:void 0},M=({query:e})=>{const t=(0,l.A)(),[i,s]=(0,n.useState)(S),r=(0,a.useTheme)(),d=(0,n.useCallback)(e=>{s(S),E.default.jia.textEnhancement({text:e.text,capacity:e.capability}).then(e=>{if(e.error)return void s({error:`${t.formatMessage({id:"JIA_ERROR_AI_CALL"})}${e.errorMsg&&": "+e.errorMsg}`,loading:!1,response:void 0});const i=e.result.text;s({error:void 0,loading:!1,response:i})}).catch(e=>{s({error:t.formatMessage({id:"JIA_ERROR_AI_CALL"}),loading:!1,response:void 0})})},[t]);return(0,n.useEffect)(()=>{e&&e.text.trim().length>0&&d(e)},[e,d]),(0,o.jsx)(W,{zIndex:r.zIndex.tinyMCEModal,open:!!e,closeHandler:()=>{e?.reject()},children:(0,o.jsx)(k,{overflow:"scroll",buttons:[{children:t.formatMessage({id:"GLOBAL_Try_Again"}),clickHandler:()=>{e&&d(e)}},{children:t.formatMessage({id:"GLOBAL_Validation"}),clickHandler:()=>i.response&&e?.resolve(i.response)},{children:t.formatMessage({id:"GLOBAL_Cancel"}),clickHandler:()=>e?.reject()}],isFull:!0,children:(0,o.jsxs)(w,{children:[i.loading&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(A,{}),(0,o.jsx)(_,{align:"center",children:t.formatMessage({id:"JIA_WAITING_WARNIG"})})]}),!i.loading&&i.error&&(0,o.jsx)("p",{children:i.error}),!i.loading&&i.response&&(0,o.jsx)("p",{children:i.response})]})})})};var T=i(59),q=i(9785),D=i(4155);const z=a.css`
|
|
25
|
+
height: 100%;
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
`,G=a.default.div`
|
|
30
|
+
${({stretch:e})=>e&&z}
|
|
31
|
+
`,I=a.default.form`
|
|
32
|
+
${({stretch:e})=>e&&z}
|
|
33
|
+
`,V=(0,n.forwardRef)((e,t)=>e.onSubmit?(0,o.jsx)(I,{stretch:e.stretch,onSubmit:e.onSubmit,ref:t,"data-cy":e.dataCy,children:e.children}):(0,o.jsx)(G,{stretch:e.stretch,ref:t,"data-cy":e.dataCy,children:e.children})),R=a.default.div`
|
|
34
|
+
${e=>e.stretch&&"\n flex: 1;\n"}
|
|
35
|
+
`,O=(0,n.forwardRef)(({onInit:e,...t},i)=>{const a=(0,n.useRef)(null),[l,s]=(0,D.SC)(t.fields,t.type,t.forceMandatory),[r,d]=(0,n.useState)(!1),{handleSubmit:c,control:u,reset:g,...m}=(0,q.useForm)({defaultValues:{...s,...t.defaultValues},criteriaMode:"all"});(0,n.useEffect)(()=>{e&&!r&&(e(m),d(!0))},[e,m,r]);const p=(0,n.useCallback)(e=>{const t={};return Object.keys(e).forEach(i=>{const o=l.find(e=>e.name===i)?.widget;switch(o?.type){case"audience":t[i]=e[i].map(e=>e.uri).join(",");break;case"taxonomy":t[i]=e[i].map(e=>e.title).join(",");break;case"toggle":t[i]=e[i]?"1":"0";break;default:t[i]=e[i]}}),t},[l]);return(0,n.useImperativeHandle)(i,()=>({...m,handleSubmit:c,control:u,reset:()=>{a?.current?.scrollTo(0,0),g()},getFormattedValues:()=>p(m.getValues())}),[]),(0,o.jsxs)(V,{dataCy:t.dataCy,stretch:t.stretch,onSubmit:t.onSubmit?c(t.onSubmit):void 0,ref:a,children:[(0,o.jsxs)(R,{stretch:t.stretch,children:[l.map(({Input:e,...i})=>(0,o.jsx)(e,{control:u,...i,dataCy:`${t.dataCy}-${i.name}`,readOnly:t.readOnly},i.name)),t.extraInputs&&t.extraInputs(u)]}),t.buttons]})});var $=i(9555);const B=c.j.getLazyComponent("ModalForm"),H=c.j.getLazyComponent("Loader"),F=c.j.getLazyComponent("Icon"),N=c.j.getLazyComponent("Typography"),U=c.j.getLazyComponent("Deprecated_Ellipsis"),P=c.j.getLazyComponent("StyledHref"),Y=a.default.div`
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
gap: ${({theme:e})=>e.space.md}px;
|
|
39
|
+
`,Q=a.default.div`
|
|
40
|
+
display: flex;
|
|
41
|
+
gap: ${({theme:e})=>e.space.md}px;
|
|
42
|
+
align-items: center;
|
|
43
|
+
border: 1px solid ${({theme:e})=>e.color.grey2};
|
|
44
|
+
background-color: ${({theme:e})=>e.color.grey0};
|
|
45
|
+
border-radius: ${({theme:e})=>e.size.sm}px;
|
|
46
|
+
padding: ${({theme:e})=>e.space.md}px;
|
|
47
|
+
`,X=a.default.div`
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
gap: ${({theme:e})=>e.space.sm}px;
|
|
51
|
+
`,K=({onClose:e,articleId:t,articleUri:i,commentUri:a})=>{const s=(0,l.A)(),c=(0,n.useRef)(null),u=(0,d.jL)(),[g,m]=(0,n.useState)(!0),[p,h]=(0,n.useState)(),[f,x]=(0,n.useState)(),[j,b]=(0,n.useState)(!0),[C,y]=(0,n.useState)(!1),v=(0,$.Ie)();(0,n.useEffect)(()=>{Promise.all([(async()=>{const e=await E.default.article.get({idArticle:t},{signal:v.signal,format:"raw-list"});h(e.result)})(),(async()=>{if(a){const e=await E.default.article.getComments({idArticle:t},{format:"raw-list",signal:v.signal});x(e.result.find(e=>e.uri===a))}})()]).then(()=>{b(!1)})},[v,t,a]);const L=(0,n.useCallback)(()=>{m(!1),e()},[e]),A=(0,n.useCallback)(e=>{e?.trim()?(y(!0),E.default.contentReport.createReport({uri:a||i,description:e}).then(()=>{u(r.Toast.actions.success({label:s.formatMessage({id:"CRPT_Report_Sent"})})),L()}).catch(e=>{r.Toast.actions.error({label:e.errorMsg??"GLOBAL_Error"}),y(!1)})):u(r.Toast.actions.error({label:s.formatMessage({id:"CRPT_Report_Description_Required"})}))},[i,L,a,u,s]),k=(0,n.useCallback)(({description:e})=>{A(e)},[A]);return(0,o.jsx)(B,{title:s.formatMessage({id:"CRPT_Add_Report"}),open:g,closeHandler:L,onSubmit:async()=>A(c.current?.getValues().description),enableClickAwayCloseModal:!0,maxHeight:"520px",buttons:[{children:(0,o.jsx)(T.A,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:L},{children:(0,o.jsx)(T.A,{id:"GLOBAL_Send"}),clickHandler:()=>A(c.current?.getValues().description),color:"valid",loading:C}],children:j?(0,o.jsx)(H,{size:"l"}):(0,o.jsxs)(Y,{children:[(0,o.jsxs)(Q,{children:[(0,o.jsx)(F,{name:a?"icon-comment":"icon-file",size:50,variant:"square"}),(0,o.jsxs)(X,{children:[(0,o.jsx)(N,{variant:a?"h3":"h2",children:(0,o.jsx)(U,{label:p?.title,length:40})}),f&&(0,o.jsxs)(N,{children:[s.formatMessage({id:"CRPT_Comment_Of"})," ",(0,o.jsx)(P,{href:f?._user._url,children:f?._user.title})]})]})]}),(0,o.jsx)(O,{ref:c,fields:["description"],type:"contentReport",onSubmit:k})]})})};var Z=i(5903);const ee=c.j.getLazyComponent("ModalForm"),te=c.j.getLazyComponent("InputDateTime"),ie=c.j.getLazyComponent("InputTextRaw"),oe=c.j.getLazyComponent("FlexBox"),ne=c.j.getLazyComponent("IconButton"),ae=a.default.div`
|
|
52
|
+
margin-bottom: ${({theme:e})=>e.space.xs}px;
|
|
53
|
+
`,le=({open:e,closeHandler:t,onSubmit:i})=>{const a=(0,l.A)(),c=(0,d.jL)(),u=(0,d.GV)(r.Platform.selectors.selectUrlBase),g=(0,q.useForm)({defaultValues:async()=>{const e=new Date;return{scheduleDate:`${s.Utils.date.formatDate(e)} ${(0,E.padStartTwoDigits)(e.getHours())}:${(0,E.padStartTwoDigits)(e.getMinutes())}`,permalinkId:(0,Z.A)()}}}),m=g.handleSubmit(e=>{i(e)});(0,n.useEffect)(()=>{e&&g.reset()},[g,e]);const p=(0,q.useWatch)({control:g.control,name:"permalinkId"}),h=(0,n.useMemo)(()=>`${u}permalink/${p}`,[p,u]);return(0,o.jsxs)(ee,{open:e,closeHandler:t,onSubmit:m,maxHeight:"620px",title:a.formatMessage({id:"GLOBAL_Schedule_Action"}),buttons:[{children:(0,o.jsx)(T.A,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:()=>t()},{children:(0,o.jsx)(T.A,{id:"GLOBAL_Schedule_Action"}),color:"valid",clickHandler:()=>{t(),m()},disabled:!g.watch("scheduleDate")}],children:[(0,o.jsx)(te,{rules:{required:!0},label:"GLOBAL_Scheduled_Date",control:g.control,name:"scheduleDate"}),(0,o.jsxs)(oe,{y:"flex-end",children:[(0,o.jsx)(ie,{label:a.formatMessage({id:"GLOBAL_Permalink"}),value:h,onChange:()=>null,margin:"0",width:"100%"}),(0,o.jsx)(ae,{children:(0,o.jsx)(ne,{srOnly:"GLOBAL_Copy_Link",icon:"icon-copy",colorVariant:"primary",onClick:()=>{navigator.clipboard.writeText(h).then(()=>{c(r.Toast.actions.success({label:a.formatMessage({id:"CLIPBOARD_Copy_Success"})}))})}})})]})]})},se=c.j.getLazyComponent("InputAudience"),re=c.j.getLazyComponent("Message"),de=c.j.getLazyComponent("Modal"),ce=({open:e,closeHandler:t,title:i,control:n,warningMessage:a,onSubmit:s,name:r="publishTo"})=>{const d=(0,l.A)();return(0,o.jsxs)(de,{open:e,closeHandler:t,title:i??d.formatMessage({id:"GLOBAL_Audience"}),buttons:[{children:(0,o.jsx)(T.A,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:()=>t()},{dataCy:"no-audience-continue",children:(0,o.jsx)(T.A,{id:"GLOBAL_Continue"}),color:"danger",clickHandler:()=>{t(),s()}}],children:[(0,o.jsx)(re,{variant:"warning",message:a??d.formatMessage({id:"FORM_Audience_Empty"})}),(0,o.jsx)(se,{asyncPromise:e=>E.default.audience.autocomplete(e),searchable:!0,control:n,multiple:!0,placeholder:d.formatMessage({id:"GLOBAL_Audience"}),name:r})]})},ue=c.j.getLazyComponent("FullPageEditor"),ge=({children:e,title:t,schedule:i,form:a,saveAsDraft:l,autoSaveDisabledFields:s,submit:c,isValid:u,loading:g,initialLoading:m,article:p})=>{const h=(0,d.jL)(),[f,x]=(0,n.useState)(),[j,b]=(0,n.useState)(!1),[C,y]=(0,n.useState)(null),[v,L]=(0,n.useState)(),[A,k]=(0,n.useState)(),[W,_]=(0,n.useState)(!1),w=(0,q.useWatch)({control:a.control});(0,n.useEffect)(()=>{if(!a||!l)return;let e;return Object.keys(a.formState.dirtyFields).some(e=>!(s??[]).includes(e))&&(e=setTimeout(()=>{l().then(()=>{x(new Date)})},2e3)),()=>{e&&clearTimeout(e)}},[s,a,l,w]);const S=(0,n.useCallback)((e,t)=>{u&&(e.publishTo&&0!==e.publishTo.length||t||p?c(e):y("publish"))},[u,p,c]),M=(0,n.useCallback)((e,t,o)=>{if(!(w.publishTo&&0!==w.publishTo.length||o))return y("schedule"),L(e),void k(t);i?.({scheduleDate:e,permalinkId:t})},[w.publishTo,i]),T=(0,n.useMemo)(()=>{if(p)return()=>{_(!0),E.default.article.delete(p.id).catch(e=>{_(!1),h(r.Toast.actions.error({label:e.errorMsg}))}).then(()=>{window.location.href="/"})}},[p,h]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ue,{title:t,onSchedule:i?()=>b(!0):void 0,onSubmit:a.handleSubmit(e=>S(e)),isValid:u,loading:g,cancelHref:p?._url??"#",onDelete:T,isDeleteLoading:W,initialLoading:m,lastDraftDate:f,children:e}),i&&(0,o.jsx)(n.Suspense,{fallback:(0,o.jsx)(o.Fragment,{}),children:(0,o.jsx)(le,{open:j,closeHandler:()=>b(!1),onSubmit:({scheduleDate:e,permalinkId:t})=>M(e,t)})}),!p&&(0,o.jsx)(n.Suspense,{fallback:(0,o.jsx)(o.Fragment,{}),children:(0,o.jsx)(ce,{open:null!==C,closeHandler:()=>y(null),control:a.control,onSubmit:()=>{"publish"===C?S(w,!0):"schedule"===C&&v&&A&&M(v,A,!0)}})})]})};var me=i(1861),pe=i(6626),he=i(3187);const fe=a.default.div`
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: row;
|
|
56
|
+
flex-wrap: wrap;
|
|
57
|
+
gap: 10px;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
`,xe=a.default.div`
|
|
60
|
+
border: 1px solid ${e=>e.theme.color.grey2};
|
|
61
|
+
border-radius: 8px;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
padding: 12px;
|
|
64
|
+
position: relative;
|
|
65
|
+
opacity: ${e=>e.available?"1":".4"};
|
|
66
|
+
pointer-events: ${e=>e.available?"all":"none"};
|
|
67
|
+
|
|
68
|
+
.show-on-hover {
|
|
69
|
+
position: absolute;
|
|
70
|
+
inset: 0;
|
|
71
|
+
border-radius: 8px;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
align-items: center;
|
|
74
|
+
display: flex;
|
|
75
|
+
opacity: 0;
|
|
76
|
+
background-color: #ffffffe6;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&:hover {
|
|
80
|
+
.show-on-hover {
|
|
81
|
+
opacity: 1;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
`,je=a.default.div`
|
|
85
|
+
border: 2px solid ${e=>e.theme.color.primary};
|
|
86
|
+
height: ${e=>e.open?e.height:"54"}px;
|
|
87
|
+
border-radius: 8px;
|
|
88
|
+
display: flex;
|
|
89
|
+
justify-content: top;
|
|
90
|
+
flex-direction: column;
|
|
91
|
+
transition: height 0.4s;
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
flex-direction: column;
|
|
94
|
+
`,be=a.default.div`
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-direction: row;
|
|
97
|
+
flex-wrap: wrap;
|
|
98
|
+
justify-content: center;
|
|
99
|
+
gap: 10px;
|
|
100
|
+
${e=>e.column&&"flex-direction: column;"}
|
|
101
|
+
`,Ce=a.default.div`
|
|
102
|
+
min-height: 50px;
|
|
103
|
+
display: flex;
|
|
104
|
+
justify-content: center;
|
|
105
|
+
align-items: center;
|
|
106
|
+
cursor: pointer;
|
|
107
|
+
color: ${e=>e.theme.color.primary};
|
|
108
|
+
&:hover {
|
|
109
|
+
background-color: ${e=>e.theme.color.grey0};
|
|
110
|
+
}
|
|
111
|
+
`,ye=a.default.button`
|
|
112
|
+
display: flex;
|
|
113
|
+
align-items: center;
|
|
114
|
+
padding: ${e=>e.parentIsColumn?"36px 16px":"0 10px"};
|
|
115
|
+
gap: 10px;
|
|
116
|
+
width: 40%;
|
|
117
|
+
border: 1px solid ${e=>e.theme.color.grey1};
|
|
118
|
+
border-radius: 8px;
|
|
119
|
+
transition: opacity 0.4s ease ${e=>40*e.index}ms;
|
|
120
|
+
opacity: ${e=>e.open?1:0};
|
|
121
|
+
img {
|
|
122
|
+
width: 40px;
|
|
123
|
+
}
|
|
124
|
+
${e=>e.full&&"flex: 1; width: 100%;"}
|
|
125
|
+
${e=>e.parentIsColumn&&"flex-basis: 72px;"}
|
|
126
|
+
${e=>!e.parentIsColumn&&"height: 72px;"}
|
|
127
|
+
&:hover {
|
|
128
|
+
background-color: ${e=>e.theme.color.grey0};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
${(0,s.DashedFocusBorder)()}
|
|
132
|
+
`,ve=a.default.div`
|
|
133
|
+
display: flex;
|
|
134
|
+
flex-direction: ${e=>"row"===e.direction?"row":"column"};
|
|
135
|
+
align-items: ${e=>"row"===e.direction?"center":"flex-start"};
|
|
136
|
+
justify-content: ${e=>"row"===e.direction?"flex-start":"center"};
|
|
137
|
+
flex: 1;
|
|
138
|
+
${e=>e.gap&&`gap:${e.gap}px`}
|
|
139
|
+
`,Le=c.j.getLazyComponent("Button"),Ee=c.j.getLazyComponent("ModalLayout"),Ae=c.j.getLazyComponent("ModalContent"),ke=c.j.getLazyComponent("Tooltip"),We=c.j.getLazyComponent("IconButton"),_e=({mode:e,view:t,children:i,namespace:a="default",onChange:s})=>{const[d,c]=(0,n.useState)(!1),u=function(e){switch(e){case"widget-article-image":return[r.Widget.definition(E.WidgetsName.ArticleTitle),r.Widget.definition(E.WidgetsName.ArticleButton)];case"comment":return[r.Widget.definition(E.WidgetsName.CheckList),r.Widget.definition(E.WidgetsName.Presence),r.Widget.definition(E.WidgetsName.QuickSurvey)];default:return[r.Widget.definition(E.WidgetsName.ArticleTitle),r.Widget.definition(E.WidgetsName.ArticleText),r.Widget.definition(E.WidgetsName.ArticleImage),r.Widget.definition(E.WidgetsName.ArticleButton),r.Widget.definition(E.WidgetsName.ArticleSlider),r.Widget.definition(E.WidgetsName.ArticleAttachment),r.Widget.definition(E.WidgetsName.Presence)]}}(a),g=(0,l.A)(),m={open:d,portalId:"react-modal",variant:"full-height",closeHandler:()=>c(!1)},p=e=>{s(r.Widget.factory(e)),c(!1)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Ee,{...m,children:(0,o.jsx)(Ae,{onClickIconClose:m.closeHandler,buttons:"comment"===e?[{children:(0,o.jsx)(T.A,{id:"GLOBAL_Close"}),color:"cancel",clickHandler:()=>c(!1)}]:void 0,title:g.formatMessage({id:"WIDGET_Builder"}),children:"comment"===e?(0,o.jsx)(be,{column:!0,children:u.map((e,t)=>(0,o.jsx)(ye,{open:!0,full:!0,parentIsColumn:!0,index:t,onClick:()=>p(e.name),children:(0,o.jsxs)(ve,{direction:"row",gap:12,children:[(0,o.jsx)("img",{src:e.img}),(0,o.jsxs)(ve,{direction:"column",children:[(0,o.jsx)("h3",{children:g.formatMessage({id:e.label})}),(0,o.jsx)("p",{children:g.formatMessage({id:e.description})})]})]})},e.name))}):(0,o.jsx)(fe,{children:u.map((e,t)=>(0,o.jsxs)(xe,{onClick:()=>p(e.name),available:e.available,children:[(0,o.jsx)("img",{src:e.img}),(0,o.jsx)("div",{className:"show-on-hover",children:g.formatMessage({id:e.label})})]},t))})})}),"custom"===e&&i?(0,o.jsx)("div",{onClick:()=>c(!0),children:i}):(0,o.jsx)(o.Fragment,{}),"button"===e&&"edit"===t?(0,o.jsx)(Le,{onClick:()=>c(!0),variant:"outlined",minWidth:"100%",children:g.formatMessage({id:"WIDGET_Add_Widget"})}):(0,o.jsx)(o.Fragment,{}),"gallery"===e&&"edit"===t?(0,o.jsx)(fe,{children:u.map((e,t)=>(0,o.jsxs)(xe,{onClick:()=>p(e.name),available:e.available,children:[(0,o.jsx)("img",{src:e.img}),(0,o.jsx)("div",{className:"show-on-hover",children:g.formatMessage({id:e.label})})]},t))}):(0,o.jsx)(o.Fragment,{}),"article"===e&&"edit"===t?(0,o.jsx)(we,{widgets:u,onClick:p}):(0,o.jsx)(o.Fragment,{}),"comment"===e&&"edit"===t?(0,o.jsx)(Se,{onClick:()=>{c(!0)}}):(0,o.jsx)(o.Fragment,{})]})},we=({widgets:e,onClick:t})=>{const[i,a]=(0,n.useState)(!1),s=(0,l.A)(),r=(0,n.useMemo)(()=>80*Math.ceil(e.length/2)+50+10,[e]);return(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)(je,{open:i,height:r,children:[(0,o.jsx)(Ce,{onClick:()=>a(!i),children:s.formatMessage({id:"WIDGET_Add_Widget"})}),(0,o.jsx)(be,{children:e.map((e,n)=>(0,o.jsxs)(ye,{open:i,index:n,onClick:()=>t(e.name),children:[(0,o.jsx)("img",{src:e.img}),s.formatMessage({id:e.label})]},e.name))})]})})},Se=({onClick:e})=>{const t=(0,l.A)();return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(ke,{description:t.formatMessage({id:"COMMENT_Add_Widget"}),children:(0,o.jsx)(We,{bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:22,onClick:()=>{e()},icon:"icon-fs-puzzle"})})})},Me=()=>{const e=(0,l.A)(),[t,i]=(0,n.useState)(!1),[o,a]=(0,n.useState)();return{open:t,onInsert:e=>{o?.execCommand("InsertHTML",!1,e)},close:()=>i(!1),ext:(0,n.useMemo)(()=>s.JTinyMCEExtensionsBuilders.markdown(e=>{a(e),i(!0)},e),[e]),isActive:!0}};var Te=i(4786),qe=i(1893),De=i(9876);const ze=c.j.getLazyComponent("InputText"),Ge=({uniqid:e})=>{const t=(0,l.A)(),i=(0,d.jL)(),a=(0,d.GV)(t=>r.Widget.selectors.selectWidget(t,e)?.title,qe.shallowEqual),{control:s,watch:c}=(0,q.useForm)({defaultValues:{widgetTitle:a},criteriaMode:"all"});return(0,n.useEffect)(()=>{const t=c(t=>{i(r.Widget.slice.actions.updateWidgetWrapper({uniqid:e,title:t.widgetTitle}))});return()=>t.unsubscribe()},[c,i,e]),(0,o.jsx)(ze,{name:"widgetTitle",control:s,placeholder:t.formatMessage({id:"GLOBAL_Title"}),width:"100%",margin:"0"})},Ie=c.j.getLazyComponent("Button"),Ve=c.j.getLazyComponent("ModalLayout"),Re=c.j.getLazyComponent("ModalContent"),Oe=c.j.getLazyComponent("IconButton"),$e=a.default.div`
|
|
140
|
+
padding: ${e=>e.theme.space.md}px;
|
|
141
|
+
display: flex;
|
|
142
|
+
flex-direction: row-reverse;
|
|
143
|
+
`,Be=a.default.div`
|
|
144
|
+
flex: 1;
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-direction: row;
|
|
147
|
+
gap: ${e=>e.theme.space.sm}px;
|
|
148
|
+
padding: ${e=>e.theme.space.sm}px;
|
|
149
|
+
border-bottom: 1px solid ${e=>e.theme.color.grey1};
|
|
150
|
+
`,He=a.default.div`
|
|
151
|
+
flex: 1;
|
|
152
|
+
display: flex;
|
|
153
|
+
fieldset:first-of-type {
|
|
154
|
+
margin: 0px !important;
|
|
155
|
+
}
|
|
156
|
+
`,Fe=a.default.div`
|
|
157
|
+
display: flex;
|
|
158
|
+
gap: ${e=>e.theme.space.sm}px;
|
|
159
|
+
`,Ne=({uniqid:e,name:t,handleOpenEditor:i})=>{const a=(0,d.jL)(),s=(0,l.A)(),[c,u]=(0,n.useState)(!1),g=(0,n.useCallback)(()=>{a(r.WidgetEditor.slice.actions.registerEditor({uniqid:e,name:t,mode:"edit"}))},[e,a,t]),m=(0,n.useCallback)(()=>{a(r.Widget.slice.actions.flushWidget({uniqid:e}))},[e,a]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(Be,{children:[(0,o.jsx)(He,{children:(0,o.jsx)(Ge,{uniqid:e})}),(0,o.jsxs)(Fe,{children:[(0,o.jsx)(Oe,{icon:"icon-pencil",bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:14,onClick:i??g,title:s.formatMessage({id:"BUTTON_Title_Open_Edit_Panel"})}),(0,o.jsx)(Oe,{icon:"icon-trash",bg:"grey1",bgHover:"grey2",color:"grey5",iconSize:14,onClick:()=>u(!0),title:s.formatMessage({id:"BUTTON_Title_Open_Remove_Widget"})})]})]}),c&&(0,o.jsxs)(Ve,{enableClickAwayCloseModal:!0,open:c,closeHandler:()=>u(!1),children:[(0,o.jsx)(Re,{overflow:"scroll",title:s.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>u(!1),children:s.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})}),(0,o.jsx)($e,{children:(0,o.jsx)(Ie,{label:s.formatMessage({id:"GLOBAL_Confirm"}),onClick:m})})]})]})},Ue=c.j.getLazyComponent("Html"),Pe=a.default.div`
|
|
160
|
+
padding: ${e=>e.theme.space.md}px;
|
|
161
|
+
border-bottom: 1px solid ${e=>e.theme.color.grey1};
|
|
162
|
+
`,Ye=({uniqid:e})=>{const t=(0,d.GV)(t=>r.Widget.selectors.selectWidget(t,e),qe.shallowEqual),i=(0,a.useTheme)(),l=(0,d.GV)(t=>r.Widget.selectors.selectWidgetTitleStyle(t,e),qe.shallowEqual),s=(0,n.useMemo)(()=>({color:l&&l.color?String(l.color):i.color.black,backgroundColor:l&&l["background-color"]?String(l["background-color"]):i.color.white,fontSize:l&&l["font-size"]?`${l["font-size"]}px`:"24px",fontWeight:l&&l["font-weight"]?String(l["font-weight"]):"medium",textAlign:l&&l["text-align"]?String(l["text-align"]):"left"}),[l,i]),c=(0,n.useMemo)(()=>t&&"string"==typeof t.title&&0!==t.title.length?t.title:void 0,[t]);return c?(0,o.jsx)(Pe,{style:{color:s.color,backgroundColor:s.backgroundColor,fontSize:s.fontSize,fontWeight:s.fontWeight,textAlign:s.textAlign},children:(0,o.jsx)(Ue,{as:"span",__html:c})}):(0,o.jsx)(o.Fragment,{})},Je=c.j.getLazyComponent("InputFileAdvancedRaw"),Qe=a.default.div`
|
|
163
|
+
width: 0;
|
|
164
|
+
height: 0;
|
|
165
|
+
overflow: hidden;
|
|
166
|
+
`,Xe=({children:e,initialFiles:t,initialClick:i,multiple:a,accept:l,onUploadStart:s,onUploadEnd:c,onUploadSuccess:u})=>{const g=(0,n.useRef)(null),m=(0,d.GV)(r.Widget.selectors.selectToken),[p,h]=(0,n.useState)(0),[f,x]=(0,n.useState)(t);return(0,n.useEffect)(()=>{i&&g.current?.click()},[i]),(0,n.useEffect)(()=>{t.length!==f.length&&x(t)},[t]),(0,n.useEffect)(()=>{u(f)},[f]),(0,n.useEffect)(()=>{0===p&&c()},[p]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{onClick:()=>{i&&g.current?.click()},children:e}),(0,o.jsx)(Qe,{children:(0,o.jsx)(Je,{ref:g,id:"widget-upload-file",name:"editorFiles",content:"",accept:l,multiple:a,token:m,onUploadStart:e=>{void 0!==e&&h(t=>t+e),"function"==typeof s&&0!==e&&s()},onUploadSuccess:e=>{void 0!==e&&(h(e=>void 0!==e?e-1:0),x(t=>a?[...t,e]:[e]))}})})]})},Ke=c.j.getLazyComponent("WidgetAttachment"),Ze=c.j.getLazyComponent("WidgetEmptyInplace"),et=c.j.getLazyComponent("FileViewer"),tt=a.default.div`
|
|
167
|
+
flex: 1;
|
|
168
|
+
`,it=({widget:e,inplace:t,mode:i})=>{const a=(0,l.A)(),{uniqid:s}=e,{files:c}=e.content,u=(0,d.jL)(),g=(0,d.GV)(e=>r.Widget.selectors.isActive(e,s),qe.shallowEqual),m=e=>{u(r.Toast.actions.error({label:e??a.formatMessage({id:"GLOBAL_Error"})}))};(0,n.useEffect)(()=>{u(r.Widget.slice.actions.setWidgetState({uniqid:s,mounted:!0}))},[]),(0,n.useEffect)(()=>{u(r.Widget.slice.actions.setWidgetState({uniqid:s,empty:!c||0===c.length}))},[c]);const p=(0,d.GV)(e=>r.Application.selectors.selectById(e,"WeDocHook")),h=[{label:a.formatMessage({id:"WIDGET_Open_With_Wedoc"}),onClick:e=>{e&&E.default.object.getAccessHash(`fileArticle/${e.id}`).then(t=>{if(""===t.result)throw new Error("result empty");const i=t.result;((e,t)=>{window.open(function(e,t){return`/ng/rr/file/${e}/${t}`}(e,t),void 0)})(e.id,i)}).catch(()=>{u(r.Toast.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:h}]:[];return void 0!==c?(0,o.jsxs)(tt,{children:["view"!==i?(0,o.jsx)(Ke,{files:c,onClick:()=>{},onError:m}):(0,o.jsx)(et,{files:c,openWithOptions:f,children:e=>(0,o.jsx)(Ke,{files:c.map(e=>({...e,uri:(0,E.resolveFilePath)(e)})),onClick:t=>e(t),onError:m})}),t&&"view"!==i&&(0,o.jsx)(Xe,{initialFiles:c,initialClick:g,multiple:!0,accept:"*",onUploadSuccess:e=>{Array.isArray(e)&&u((0,r.updateWidgetContent)(s,{files:e.map(e=>({...e,uri:(0,E.resolveFilePath)(e)??""}))}))},onUploadStart:()=>{u(r.Widget.slice.actions.setWidgetState({uniqid:s,loading:!0}))},onUploadEnd:()=>{u(r.Widget.slice.actions.setWidgetState({uniqid:s,loading:!1}))},children:"edit"===i?(0,o.jsx)(Ze,{label:"WIDGET_Article_Attachment_Empty_Label",description:"WIDGET_Article_Attachment_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}}):(0,o.jsx)(o.Fragment,{})})]}):(0,o.jsx)(o.Fragment,{})},ot=c.j.getLazyComponent("WidgetButton"),nt=a.default.div`
|
|
169
|
+
display: flex;
|
|
170
|
+
flex: 1;
|
|
171
|
+
justify-content: center;
|
|
172
|
+
align-items: center;
|
|
173
|
+
`,at=a.default.div`
|
|
174
|
+
pointer-events: ${e=>e.clickable?"all":"none"};
|
|
175
|
+
cursor: pointer;
|
|
176
|
+
display: flex;
|
|
177
|
+
flex: 1;
|
|
178
|
+
justify-content: center;
|
|
179
|
+
align-items: center;
|
|
180
|
+
`,lt=({widget:e,mode:t})=>{const i=(0,d.jL)(),{uniqid:a}=e,{text:l,url:s,target:c,color:u,backgroundColor:g,buttonSize:m,borderRadius:p,variant:h}=e.content;return(0,n.useEffect)(()=>{i(r.Widget.slice.actions.setWidgetState({uniqid:a,empty:!l||0===l.length}))},[l]),(0,o.jsx)(nt,{onClick:()=>{"edit"===t&&i(r.WidgetEditor.slice.actions.registerEditor({uniqid:a,name:e.name}))},children:(0,o.jsx)(at,{clickable:"edit"!==t,children:(0,o.jsx)(ot,{text:l,url:s,target:c,color:u,backgroundColor:g,buttonSize:m,borderRadius:p,variant:h})})})},st=c.j.getLazyComponent("WidgetArticleGallery"),rt=c.j.getLazyComponent("WidgetEmptyInplace"),dt=c.j.getLazyComponent("FileViewer"),ct=a.default.button`
|
|
181
|
+
cursor: pointer;
|
|
182
|
+
`,ut=({widget:e,inplace:t,mode:i})=>{const{uniqid:a}=e,{files:l}=e.content,s=(0,d.jL)(),c=(0,d.GV)(e=>r.Widget.selectors.isActive(e,a),qe.shallowEqual);return(0,n.useEffect)(()=>{s(r.Widget.slice.actions.setWidgetState({uniqid:a,mounted:!0}))},[]),void 0!==l?(0,o.jsxs)(o.Fragment,{children:["edit"===i?(0,o.jsx)(st,{files:l,maxWidth:800,gap:e.content.gap??"10",column:e.content.column??"3",onClick:()=>{}}):(0,o.jsx)(dt,{files:l,openWithOptions:[],children:t=>(0,o.jsx)(ct,{children:(0,o.jsx)(st,{files:l,maxWidth:600,gap:e.content.gap??"10",column:e.content.column??"3",onClick:e=>t(e)})})}),t&&"edit"===i?(0,o.jsx)(Xe,{initialFiles:l,initialClick:c,accept:"image/png, image/jpeg, image/jpg",multiple:!0,onUploadSuccess:e=>{Array.isArray(e)&&s((0,r.updateWidgetContent)(a,{files:e}))},onUploadStart:()=>{s(r.Widget.slice.actions.setWidgetState({uniqid:a,loading:!0}))},onUploadEnd:()=>{s(r.Widget.slice.actions.setWidgetState({uniqid:a,loading:!1}))},children:(0,o.jsx)(rt,{label:"WIDGET_Article_Gallery_Empty_Label",description:"WIDGET_Article_Gallery_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}})}):(0,o.jsx)(o.Fragment,{})]}):(0,o.jsx)(o.Fragment,{})},gt=c.j.getLazyComponent("WidgetImage"),mt=c.j.getLazyComponent("FileViewer"),pt=c.j.getLazyComponent("WidgetEmptyInplace"),ht=a.default.div`
|
|
183
|
+
position: absolute;
|
|
184
|
+
inset: 0;
|
|
185
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
186
|
+
pointer-events: none;
|
|
187
|
+
display: flex;
|
|
188
|
+
justify-content: center;
|
|
189
|
+
align-items: center;
|
|
190
|
+
opacity: 0;
|
|
191
|
+
color: ${e=>e.theme.color.white};
|
|
192
|
+
&:hover {
|
|
193
|
+
opacity: 1;
|
|
194
|
+
}
|
|
195
|
+
`,ft=a.default.button`
|
|
196
|
+
cursor: pointer;
|
|
197
|
+
`,xt={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},jt=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},bt=({widget:e,width:t,inplace:i,mode:a})=>{const{uniqid:s}=e,{file:c,useFilter:u}=e.content,g=(0,d.jL)(),m=(0,d.GV)(e=>r.Widget.selectors.isActive(e,s),qe.shallowEqual),[p,h]=(0,n.useState)(void 0),f=(0,l.A)();return(0,n.useEffect)(()=>{g(r.Widget.slice.actions.setWidgetState({uniqid:s,mounted:!0}))},[]),(0,n.useEffect)(()=>{g(r.Widget.slice.actions.setWidgetState({uniqid:s,empty:!c}))},[c]),(0,n.useEffect)(()=>{c&&h((0,E.formatImgUrl)({timestamp:c.dateModified?jt(c.dateModified):Date.now(),from:"imagecache",size:"fitx1200",uri:c.uri}))},[c]),(0,o.jsxs)(o.Fragment,{children:["edit"!==a&&(0,o.jsx)(mt,{files:[{...xt,...c,path:p,mimetype:"image/png"}],openWithOptions:[],children:e=>(0,o.jsx)(ft,{onClick:()=>e(c?.id??0),children:(0,o.jsx)(gt,{maxWidth:t??600,uri:p,useFilter:u??!1})})}),"edit"===a&&(0,o.jsxs)(o.Fragment,{children:[void 0!==p&&(0,o.jsx)(gt,{maxWidth:t??600,uri:p,useFilter:u??!1}),i&&(0,o.jsx)(Xe,{initialFiles:[],initialClick:m,accept:"image/png, image/jpeg, image/jpg",multiple:!1,onUploadSuccess:e=>{Array.isArray(e)&&void 0!==e[0]&&g((0,r.updateWidgetContent)(s,{file:e[0]}))},onUploadStart:()=>{g(r.Widget.slice.actions.setWidgetState({uniqid:s,loading:!0}))},onUploadEnd:()=>{g(r.Widget.slice.actions.setWidgetState({uniqid:s,loading:!1}))},children:void 0!==c?(0,o.jsx)(ht,{children:f.formatMessage({id:"ARTICLE_Widget_Image_Change"})}):(0,o.jsx)(pt,{label:"WIDGET_Article_Image_Empty_Label",description:"WIDGET_Article_Image_Empty_Description",url:"widget-article-image-placeholder.png",onClick:()=>{}})})]})]})},Ct=c.j.getLazyComponent("FileViewer"),yt=c.j.getLazyComponent("WidgetEmptyInplace"),vt=c.j.getLazyComponent("WidgetSlider"),Lt=a.default.div`
|
|
198
|
+
flex: 1;
|
|
199
|
+
display: flex;
|
|
200
|
+
flex-direction: row;
|
|
201
|
+
min-height: 60px;
|
|
202
|
+
align-items: center;
|
|
203
|
+
width: ${e=>e.maxWidth}px;
|
|
204
|
+
`,Et={id:0,type:"",title:"",uri:"",mimetype:"application/octet-stream",mainType:"",dateCreation:"",dateModified:"",_url:"",size:10},At=e=>{if(e){const t=Date.parse(e);if(!isNaN(t))return new Date(t).getTime()/1e3}},kt=({widget:e,mode:t,width:i})=>{const{uniqid:a}=e,l=(0,d.jL)(),s=(0,d.GV)(e=>r.Widget.selectors.isActive(e,a),qe.shallowEqual),c=i??600,[u,g]=(0,n.useState)(void 0),m=(0,n.useRef)(null),p=(0,n.useMemo)(()=>e.content.slides?[...e.content.slides.map((e,t)=>({...Et,id:e.file?e.file.id:t,mimetype:e.file?e.file.mimetype:Et.mimetype,path:e.file&&e.file.uri?(0,E.formatImgUrl)({size:"fitx1200",uri:e.file.uri,from:"imagecache",timestamp:e.file&&e.file.dateModified?At(e.file.dateModified):Date.now()}):""}))]:[],[e.content.slides]),h=(0,n.useMemo)(()=>void 0!==e.content.slides?[...e.content.slides.map(e=>e.file?{...e,uri:(0,E.formatImgUrl)({timestamp:e.file.dateModified?At(e.file.dateModified):Date.now(),size:`fitx${u&&u<c?u:c}`,from:"imagecache",uri:e.file.uri})}:{...e,uri:""})]:[],[e.content.slides,u,c]);(0,n.useEffect)(()=>{s&&"edit"===t&&l(r.WidgetEditor.slice.actions.registerEditor({uniqid:a,name:e.name}))},[s]),(0,n.useEffect)(()=>{const e=()=>{m.current&&g(m.current?m.current.offsetWidth:c)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[m]),(0,n.useEffect)(()=>{g(m.current?m.current.offsetWidth:c)},[m]),(0,n.useEffect)(()=>{l(r.Widget.slice.actions.setWidgetState({uniqid:a,empty:!e.content.slides||0===e.content.slides.length}))},[e.content.slides]);const f=(0,n.useMemo)(()=>"edit"===t&&Array.isArray(e.content.slides)&&0===e.content.slides.length,[e.content.slides,t]),x=(0,n.useCallback)(()=>{l(r.WidgetEditor.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))},[l,e.uniqid,e.name]);return void 0===u?(0,o.jsx)("div",{ref:m,style:{width:"100%"}}):(0,o.jsxs)(Lt,{maxWidth:u&&u<c?u:c,children:[(0,o.jsx)(Ct,{files:p,openWithOptions:[],children:i=>(0,o.jsx)(vt,{slides:h,maxWidth:u&&u<c?u:c,useDots:e.content.useDots??!0,loop:e.content.loop??!1,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 l(r.WidgetEditor.slice.actions.registerEditor({uniqid:a,name:e.name}))}})}),f?(0,o.jsx)(yt,{label:"WIDGET_Article_Slider_Empty_Label",description:"WIDGET_Article_Slider_Empty_Description",url:"widget-article-image-placeholder.png",onClick:x}):(0,o.jsx)(o.Fragment,{})]})};var Wt=i(4745);const _t=c.j.getLazyComponent("InputTextareaRaw"),wt=c.j.getLazyComponent("Modal"),St=({onInsert:e,open:t,close:i})=>{const a=(0,l.A)(),[s,r]=(0,n.useState)(""),d=(0,n.useCallback)(()=>{r(""),i()},[i]);return(0,o.jsx)(wt,{title:a.formatMessage({id:"TINY_MCE_Insert_Markdown"}),open:t,closeHandler:d,enableClickAwayCloseModal:!0,buttons:[{children:(0,o.jsx)(T.A,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:d},{children:(0,o.jsx)(T.A,{id:"GLOBAL_Insert"}),color:"valid",disabled:!s,clickHandler:()=>{e(Wt.xI.parse(s,{async:!1}).replace(/<br>/g,"<br><br>")),d()}}],children:(0,o.jsx)(_t,{value:s,onChange:e=>r(e.target.value),height:"400px"})})},Mt=c.j.getLazyComponent("WidgetArticleText"),Tt=a.default.div`
|
|
205
|
+
width: 100%;
|
|
206
|
+
cursor: text;
|
|
207
|
+
|
|
208
|
+
p {
|
|
209
|
+
word-wrap: break-word;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
a {
|
|
213
|
+
word-wrap: break-word;
|
|
214
|
+
}
|
|
215
|
+
`,qt=({widget:e,mode:t})=>{const{uniqid:i}=e,s=(0,a.useTheme)(),{text:c}=e.content,u=(0,d.jL)(),g=(0,d.GV)(e=>r.Widget.selectors.isActive(e,i),qe.shallowEqual),m=(0,d.GV)(e=>r.Widget.selectors.selectWidgetState(e,i)?.busy),p=(0,d.GV)(r.Widget.selectors.selectToken),h=(0,d.GV)(r.TinyMCE.selectors.selectTinyMCECommonOptions),f=(0,d.GV)(r.Model.selectors.selectAll),x=(0,l.A)(),{open:j,onInsert:b,close:C,ext:y,isActive:v}=Me(),L=(0,n.useCallback)(e=>{u(r.Toast.actions.error({label:e??x.formatMessage({id:"GLOBAL_Error"})}))},[u,x]);(0,n.useEffect)(()=>{u(r.Widget.slice.actions.setWidgetState({uniqid:i,empty:!c||0===c.length}))},[c]);const A=(0,n.useMemo)(()=>(0,Te.X)(f,s,L),[f,L,s]);return m?(0,o.jsx)(o.Fragment,{}):(0,o.jsxs)(Tt,{children:[(0,o.jsx)(Mt,{autoFocus:g,text:c??"",token:"edit"===t&&void 0!==p?p:"",tinyMCECommonOptions:"edit"===t&&h?{commonOptions:h,mentionsQueries:A}:void 0,mode:t,onChange:e=>{u((0,r.updateWidgetContent)(i,{text:e}))},additionalExtensions:[y],handlers:{file:E.default.file}}),v&&(0,o.jsx)(St,{onInsert:b,open:j,close:C})]})},Dt=c.j.getLazyComponent("WidgetArticleTitle"),zt=a.default.div`
|
|
216
|
+
flex: 1;
|
|
217
|
+
display: flex;
|
|
218
|
+
flex-direction: row;
|
|
219
|
+
align-items: center;
|
|
220
|
+
cursor: text;
|
|
221
|
+
`,Gt=a.default.div`
|
|
222
|
+
display: flex;
|
|
223
|
+
flex-direction: row;
|
|
224
|
+
border-radius: 8px;
|
|
225
|
+
overflow: hidden;
|
|
226
|
+
margin: 4px;
|
|
227
|
+
border: 1px solid ${e=>e.theme.color.grey1};
|
|
228
|
+
`,It=a.default.button`
|
|
229
|
+
display: flex;
|
|
230
|
+
width: 40px;
|
|
231
|
+
height: 40px;
|
|
232
|
+
justify-content: center;
|
|
233
|
+
align-items: center;
|
|
234
|
+
cursor: pointer;
|
|
235
|
+
opacity: ${e=>e.isActive?"1.0":".8"};
|
|
236
|
+
background-color: ${e=>e.isActive?e.theme.color.grey1:e.theme.color.white};
|
|
237
|
+
&:hover {
|
|
238
|
+
background-color: ${e=>e.theme.color.grey1};
|
|
239
|
+
}
|
|
240
|
+
`,Vt=({widget:e,inplace:t,mode:i,dataCy:a})=>{const{uniqid:l}=e,{text:s,color:c,heading:u}=e.content,g=(0,d.jL)(),m=(0,d.GV)(e=>r.Widget.selectors.isActive(e,l),qe.shallowEqual);return(0,n.useEffect)(()=>{g(r.Widget.slice.actions.setWidgetState({uniqid:l,empty:!s||0===s.length}))},[s]),(0,o.jsxs)(zt,{children:[(0,o.jsx)(Dt,{dataCy:a,text:s,color:c,heading:u,autoFocus:m,inplace:t,mode:i,onChange:e=>{g((0,r.updateWidgetContent)(l,{text:e}))}}),m&&"edit"===i?(0,o.jsx)(Rt,{heading:u,onClick:e=>{g((0,r.updateWidgetContent)(l,{heading:e}))}}):(0,o.jsx)(o.Fragment,{})]})},Rt=({heading:e="h1",onClick:t})=>(0,o.jsx)(Gt,{children:["h1","h2","h3","h4"].map((i,n)=>(0,o.jsx)(It,{isActive:e===i,onClick:()=>t(i),children:i},n))}),Ot=c.j.getLazyComponent("ModalLayout"),$t=c.j.getLazyComponent("ModalContent"),Bt=c.j.getLazyComponent("Button"),Ht=c.j.getLazyComponent("InputText"),Ft=c.j.getLazyComponent("InputNumber"),Nt=c.j.getLazyComponent("InputSelectExtended"),Ut=c.j.getLazyComponent("InputPassword"),Pt=c.j.getLazyComponent("Typography"),Yt=c.j.getLazyComponent("Loader"),Jt=a.default.div`
|
|
241
|
+
display: flex;
|
|
242
|
+
flex-direction: column;
|
|
243
|
+
opacity: ${e=>e.isLocked?".4":"1.0"};
|
|
244
|
+
`,Qt=a.default.div`
|
|
245
|
+
position: absolute;
|
|
246
|
+
inset: 0;
|
|
247
|
+
display: flex;
|
|
248
|
+
justify-content: center;
|
|
249
|
+
align-items: center;
|
|
250
|
+
`,Xt=a.default.div`
|
|
251
|
+
background-color: ${e=>e.theme.color.orange};
|
|
252
|
+
color: ${e=>e.theme.color.white};
|
|
253
|
+
padding: ${e=>e.theme.space.sm}px;
|
|
254
|
+
border-radius: ${e=>e.theme.space.sm}px;
|
|
255
|
+
display: flex;
|
|
256
|
+
justify-content: center;
|
|
257
|
+
align-items: center;
|
|
258
|
+
`,Kt=a.default.div`
|
|
259
|
+
margin-bottom: ${e=>e.theme.space.md}px;
|
|
260
|
+
`,Zt={username:"",password:"",hostname:"",imapPort:993,imapConnectionSecurity:E.ImapConnection.NONE,imapMailbox:"",cardDavAddressBook:"",calDavCalendar:"",provider:""},ei=()=>{const e=(0,l.A)(),t=(0,d.jL)(),i=(0,s.useAbortController)(),[a,c]=(0,n.useState)(!1),[u,g]=(0,n.useState)(!1),{control:m,reset:p,setValue:h,getValues:f,watch:x,formState:{isValid:j}}=(0,q.useForm)({defaultValues:Zt,criteriaMode:"all"}),[b,C]=(0,n.useState)([]),y=x(),v=[{label:"NONE",value:E.ImapConnection.NONE},{label:"SSL",value:E.ImapConnection.SSL},{label:"STARTTLS",value:E.ImapConnection.STARTTLS}],L=(0,n.useCallback)(e=>{E.default.office.getConfiguration().then(({result:t})=>{p({...t,provider:e.includes(t.provider??"")?t.provider:e[0]})})},[p]);(0,n.useEffect)(()=>{a&&(g(!0),E.default.office.getProviders({signal:i.signal}).then(({result:e})=>{i.signal.aborted||(C(e),L(e.map(e=>e.id)))}).catch(e=>{i.signal.aborted||t(r.Toast.actions.error({label:e.errorMsg}))}).finally(()=>{g(!1)}))},[a,i.signal,t,L]),(0,n.useEffect)(()=>{1===b.length&&h("provider",b[0].id)},[b,h]);const A=()=>c(!1),k=(0,n.useMemo)(()=>b.length>1,[b]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Qt,{children:(0,o.jsx)(Bt,{label:e.formatMessage({id:"Office_Set_Configuration"}),onClick:()=>c(!0)})}),(0,o.jsx)(Ot,{open:a,radius:"small",closeHandler:A,children:(0,o.jsx)($t,{overflow:"scroll",title:e.formatMessage({id:"Office_Set_Configuration"}),onClickIconClose:A,children:u?(0,o.jsx)(Yt,{size:"s"}):(0,o.jsxs)(o.Fragment,{children:[0===b.length&&(0,o.jsx)(Xt,{children:e.formatMessage({id:"Office_No_Providers"})}),(0,o.jsxs)(Jt,{isLocked:0===b.length,children:[k&&(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)(Kt,{children:[(0,o.jsx)(Pt,{size:"l",children:(0,o.jsx)(T.A,{id:"OfficeHook_Conf_Provider"})}),(0,o.jsx)(ti,{label:"OfficeHook_Conf_Select_Provider",initialValue:{label:b[0].label,value:b[0].id},options:b.map(e=>({label:e.label,value:e.id})),handleChange:e=>{f("provider")!==e&&p(),h("provider",e)}})]})}),(0,o.jsxs)(Kt,{children:[(0,o.jsx)(Pt,{size:"l",children:(0,o.jsx)(T.A,{id:"OfficeHook_Settings"})}),(0,o.jsx)(Ht,{control:m,name:"hostname",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Hostname"}),rules:{required:!0}}),(0,o.jsx)(Ht,{control:m,name:"username",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_Username"}),rules:{required:!0}}),(0,o.jsx)(Ut,{control:m,name:"password",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_Password"}),rules:{required:!0}})]}),(0,o.jsxs)(Kt,{children:[(0,o.jsx)(Pt,{size:"l",children:(0,o.jsx)(T.A,{id:"OfficeHook_Conf_IMap_Mailbox"})}),(0,o.jsx)(Ft,{control:m,name:"imapPort",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Port"}),rules:{required:!0}}),(0,o.jsx)(ti,{label:"OfficeHook_Conf_Select_Connection_Security",initialValue:v[0],options:v,handleChange:e=>h("imapConnectionSecurity",e)}),(0,o.jsx)(Ht,{control:m,name:"imapMailbox",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_IMap_Mailbox"}),rules:{required:!0}})]}),(0,o.jsxs)(Kt,{children:[(0,o.jsx)(Pt,{size:"l",children:(0,o.jsx)(T.A,{id:"OfficeHook_Conf_CalDav_Calendar"})}),(0,o.jsx)(Ht,{control:m,name:"calDavCalendar",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_CalDav_Calendar"}),rules:{required:!0}})]}),(0,o.jsxs)(Kt,{children:[(0,o.jsx)(Pt,{size:"l",children:(0,o.jsx)(T.A,{id:"OfficeHook_Conf_CardDav_Address_Book"})}),(0,o.jsx)(Ht,{control:m,name:"cardDavAddressBook",width:"400",placeholder:e.formatMessage({id:"OfficeHook_Conf_CardDav_Address_Book"}),rules:{required:!0}})]})]}),(0,o.jsx)(Bt,{label:e.formatMessage({id:"OfficeHook_Conf_Prompt_Submit"}),loader:u,disabled:u||0===b.length||!j,onClick:()=>{u||(g(!0),E.default.office.setConfiguration(y).then(()=>window.location.reload()).catch(e=>t(r.Toast.actions.error({label:e.errorMsg}))).finally(()=>{c(!1),g(!1),p()}))}})]})})})]})},ti=({label:e,initialValue:t,options:i,handleChange:a})=>{const{control:l,watch:s}=(0,q.useForm)({defaultValues:{provider:t},criteriaMode:"all"});return(0,n.useEffect)(()=>{const e=s(e=>{e.provider&&e.provider.value&&a(e.provider.value)});return()=>e.unsubscribe()},[s,a]),(0,o.jsx)(Nt,{label:e,name:"provider",options:i??[],getValue:e=>e.value,getLabel:"label",getSearch:"label",control:l,rules:{required:!0}})},ii=a.default.div`
|
|
261
|
+
flex-direction: column;
|
|
262
|
+
display: flex;
|
|
263
|
+
flex: 1;
|
|
264
|
+
`,oi=a.default.div`
|
|
265
|
+
position: relative;
|
|
266
|
+
display: flex;
|
|
267
|
+
flex: 1;
|
|
268
|
+
`,ni=a.default.div`
|
|
269
|
+
overflow: auto;
|
|
270
|
+
position: absolute;
|
|
271
|
+
inset: 0;
|
|
272
|
+
`,ai=({header:e,scrollable:t,footer:i})=>(0,o.jsxs)(ii,{children:[e&&e(),(0,o.jsx)(oi,{children:(0,o.jsx)(ni,{children:t&&t()})}),i&&i()]}),li=a.default.div`
|
|
273
|
+
display: flex;
|
|
274
|
+
flex-direction: column;
|
|
275
|
+
`,si=({uniqid:e,children:t})=>{const i=(0,d.GV)(t=>r.Widget.selectors.selectWidgetWrapperStyle(t,e),qe.shallowEqual),a=(0,n.useMemo)(()=>({padding:i&&i.padding?`${i.padding}px`:"0px"}),[i]);return(0,o.jsx)(li,{style:{padding:a.padding},children:t})},ri=a.default.div`
|
|
276
|
+
padding: ${e=>e.theme.space.md}px;
|
|
277
|
+
padding-right: 0px;
|
|
278
|
+
`,di=a.default.div`
|
|
279
|
+
text-align: ${e=>e.textAlign};
|
|
280
|
+
font-size: ${e=>e.fontSize}px;
|
|
281
|
+
font-weight: ${e=>e.fontWeight};
|
|
282
|
+
color: ${e=>e.color};
|
|
283
|
+
`,ci=({uniqid:e,textAlign:t="left",fontSize:i="16",fontWeight:n="medium",color:a})=>{const l=(0,d.GV)(t=>r.Widget.selectors.selectWidget(t,e),qe.shallowEqual);return(0,o.jsx)(o.Fragment,{children:l&&"string"==typeof l.title&&0!==l.title.length&&(0,o.jsx)(ri,{children:(0,o.jsx)(di,{textAlign:t,fontSize:i,fontWeight:n,color:a,children:l.title})})})},ui=a.default.div`
|
|
284
|
+
background-color: ${e=>e.backroundColor};
|
|
285
|
+
`,gi=a.default.div`
|
|
286
|
+
display: flex;
|
|
287
|
+
flex-direction: row;
|
|
288
|
+
align-items: center;
|
|
289
|
+
`,mi=(a.default.div`
|
|
290
|
+
padding: ${e=>e.theme.space.sm}px ${e=>e.theme.space.md}px;
|
|
291
|
+
color: ${e=>e.theme.color.grey4};
|
|
292
|
+
`,a.default.div`
|
|
293
|
+
flex: 1;
|
|
294
|
+
display: flex;
|
|
295
|
+
flex-direction: row;
|
|
296
|
+
gap: ${e=>e.theme.space.xs}px;
|
|
297
|
+
align-items: center;
|
|
298
|
+
`),pi=({uniqid:e,dropdown:t,subHeader:i})=>{const l=(0,a.useTheme)(),s=(0,d.GV)(t=>r.Widget.selectors.selectWidgetTitleStyle(t,e),qe.shallowEqual),c=(0,n.useMemo)(()=>({color:s&&s.color?String(s.color):l.color.black,backgroundColor:s&&s["background-color"]?String(s["background-color"]):"transparent",fontSize:s&&s["font-size"]?String(s["font-size"]):"16",fontWeight:s&&s["font-weight"]?String(s["font-weight"]):"medium",textAlign:s&&s["text-align"]?String(s["text-align"]):"left"}),[s,l]);return(0,o.jsx)(ui,{backroundColor:c.backgroundColor,children:(0,o.jsxs)(gi,{children:[(0,o.jsxs)(mi,{children:[(0,o.jsx)(ci,{uniqid:e,fontWeight:c.fontWeight,fontSize:c.fontSize,textAlign:c.textAlign,color:c.color}),i&&i(c.color)]}),t&&t()]})})},hi=c.j.getLazyComponent("ButtonDropdown"),fi=c.j.getLazyComponent("Tooltip"),xi=a.default.div`
|
|
299
|
+
margin-right: ${e=>e.theme.space.sm}px;
|
|
300
|
+
button {
|
|
301
|
+
background: ${e=>e.theme.color.white};
|
|
302
|
+
}
|
|
303
|
+
`,ji=({uniqid:e,isConfigurationValid:t=!1,handleLogout:i})=>{const n=(0,l.A)(),a=(0,qe.useDispatch)(),s=[{label:n.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{a(r.Widget.slice.actions.setWidgetState({uniqid:e,loading:!0})),E.default.office.setConfiguration(Zt).finally(i)}}];return(0,o.jsx)(pi,{uniqid:e,dropdown:()=>t&&(0,o.jsx)(xi,{children:(0,o.jsx)(fi,{position:"left",description:n.formatMessage({id:"WIDGET_Prompt_Dropdown"}),children:(0,o.jsx)(hi,{small:!0,smallOpenDirection:"left",options:s,icon:"icon-cogwheel",label:"",color:"primary",variant:"outlined"})})})})},bi=c.j.getLazyComponent("WidgetCalendarCalDav"),Ci=({widget:e,mode:t,levelFallback:i})=>{const{uniqid:a}=e,l=(0,d.jL)(),[c,u]=(0,n.useState)(void 0),[g,m]=(0,n.useState)(!1),p=(0,d.GV)(e=>r.Widget.selectors.selectWidgetLevel(e,a),qe.shallowEqual),[h,f]=(0,n.useState)(void 0),[x,j]=(0,n.useState)([]),b=(0,n.useCallback)((e,t)=>{e&&400===e.error&&E.default.office.setConfiguration(Zt),t?window.location.reload():(u(!1),l(r.Widget.slice.actions.setWidgetState({uniqid:a,initialized:!0,loading:!1})))},[l,a]),C=(0,n.useCallback)(e=>{u(e),l(r.Widget.slice.actions.setWidgetState({uniqid:a,initialized:!0}))},[l,a]),y=(0,n.useCallback)(e=>l(r.Widget.slice.actions.setWidgetState({uniqid:a,loading:e})),[a,l]),v=(0,n.useCallback)(()=>{E.default.office.getProviderBaseUrls().then(({result:e})=>{f(e.dav_calendar_url)}).finally(()=>y(!1))},[y]),L=(0,n.useCallback)(()=>{const e=new Date,t=s.Utils.date.addMonth(new Date(e));E.default.office.davCalendarGetEvents({limit:10,dateStart:s.Utils.date.formatDateTime(e),dateEnd:s.Utils.date.formatDateTime(t)}).then(({result:e})=>{j(e),m(!0)}).catch(()=>{l(r.Toast.actions.error({label:"PLUGIN_Manager_Connection_Error"})),u(!1),l(r.Widget.slice.actions.setWidgetState({uniqid:a,initialized:!0,loading:!1}))}).finally(()=>y(!1))},[y,l,a]);return(0,n.useEffect)(()=>{if(!g)return;if(!c)return;if(p!==E.WIDGET_LEVEL_3)return;const e=setInterval(L,6e4);return()=>clearInterval(e)},[c,L,g,p]),(0,n.useEffect)(()=>{y(!0),E.default.office.isConfigurationValid().then(({result:e})=>C(e)).catch(b)},[b,y,C]),(0,n.useEffect)(()=>{if(c)return p===E.WIDGET_LEVEL_1?(y(!0),void v()):void L()},[c,v,y,L,p]),c&&p&&p!==E.WIDGET_LEVEL_3&&i?(0,o.jsx)(o.Fragment,{children:i(p,h??"")}):(0,o.jsx)(ai,{header:()=>(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(ji,{uniqid:a,isConfigurationValid:void 0!==c&&!0===c,handleLogout:()=>b(void 0,!0)})}),scrollable:()=>(0,o.jsxs)(si,{uniqid:a,children:[c&&(0,o.jsx)(bi,{calendarListEvent:x}),void 0===c&&(0,o.jsx)(o.Fragment,{}),void 0!==c&&!1===c&&"view"===t&&(0,o.jsx)(ei,{})]})})};var yi=i(7858);const vi=c.j.getLazyComponent("Button"),Li=c.j.getLazyComponent("ModalLayout"),Ei=c.j.getLazyComponent("ModalContent"),Ai=c.j.getLazyComponent("IconButton"),ki=(a.default.button`
|
|
304
|
+
padding: ${e=>e.theme.space.md}px;
|
|
305
|
+
`,a.default.div`
|
|
306
|
+
padding: ${e=>e.theme.space.md}px;
|
|
307
|
+
display: flex;
|
|
308
|
+
flex-direction: row-reverse;
|
|
309
|
+
`),Wi=({id:e,type:t,uniqid:i})=>{const a=(0,d.jL)(),s=(0,l.A)(),[c,u]=(0,n.useState)(!1);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Ai,{iconSize:14,onClick:()=>u(!0),icon:"icon-trash"}),c&&(0,o.jsxs)(Li,{enableClickAwayCloseModal:!0,open:c,closeHandler:()=>u(!1),children:[(0,o.jsx)(Ei,{overflow:"scroll",title:s.formatMessage({id:"WIDGET_Remove_Widget"}),onClickIconClose:()=>u(!1),children:s.formatMessage({id:"WIDGET_Delete_Widget_Confirmation"})}),(0,o.jsx)(ki,{children:(0,o.jsx)(vi,{label:s.formatMessage({id:"GLOBAL_Confirm"}),onClick:()=>{E.default.widget.removeWidget({id:e,type:t,uniqid:i}).then(()=>{a(r.Widget.slice.actions.flushWidget({uniqid:i}))}).catch(()=>a(r.Toast.actions.error({label:"WIDGET_Presence_Error"})))}})})]})]})},_i=a.default.div`
|
|
310
|
+
display: flex;
|
|
311
|
+
flex: 1;
|
|
312
|
+
flex-direction: row;
|
|
313
|
+
border-top: 1px solid ${e=>e.theme.color.grey1};
|
|
314
|
+
`,wi=a.default.button`
|
|
315
|
+
display: flex;
|
|
316
|
+
flex: 1;
|
|
317
|
+
justify-content: center;
|
|
318
|
+
align-items: center;
|
|
319
|
+
background-color: ${e=>e.theme.color.white};
|
|
320
|
+
&:hover {
|
|
321
|
+
background-color: ${e=>e.theme.color.grey0};
|
|
322
|
+
}
|
|
323
|
+
`,Si=({name:e,uniqid:t,mode:i,collaborationRights:a,handleOpenEditor:s})=>{const c=(0,l.A)(),u=(0,d.jL)(),g=(0,d.GV)(e=>r.Widget.selectors.selectWidgetObject(e,t),qe.shallowEqual),m=(0,d.GV)(e=>r.Widget.selectors.selectWidgetObjectRights(e,t),qe.shallowEqual),p=(0,n.useMemo)(()=>g&&m&&m.update||a&&a.update,[g,m,a]),h=(0,n.useMemo)(()=>g&&m&&m.delete,[g,m]),f=(0,n.useCallback)(()=>{u(r.WidgetEditor.slice.actions.registerEditor({uniqid:t,name:e,mode:i}))},[t,u,e,i]);return p&&(0,E.ensureWidgetObjectHasMinimumProperties)(g)?(0,o.jsxs)(_i,{children:[(0,o.jsx)(wi,{onClick:s??f,children:c.formatMessage({id:"WIDGET_Set_Widget"})}),h&&(0,o.jsx)(Wi,{id:g.id,type:g.type,uniqid:t})]}):(0,o.jsx)(o.Fragment,{})},Mi=c.j.getLazyComponent("Button"),Ti=c.j.getLazyComponent("InputText"),qi=a.default.div`
|
|
324
|
+
padding: ${e=>e.theme.space.md}px;
|
|
325
|
+
display: flex;
|
|
326
|
+
flex-direction: row;
|
|
327
|
+
fieldset {
|
|
328
|
+
margin: 0.2rem !important;
|
|
329
|
+
}
|
|
330
|
+
`,Di=({placeholder:e,handleClick:t})=>{const i=(0,l.A)(),a=(0,d.jL)(),[s,r]=(0,n.useState)(""),{control:c,watch:u,reset:g}=(0,q.useForm)({defaultValues:{label:s},criteriaMode:"all"});return(0,n.useEffect)(()=>{const e=u(e=>{r(e.label??"")});return()=>e.unsubscribe()},[u,a]),(0,o.jsxs)(qi,{children:[(0,o.jsx)(Ti,{name:"label",control:c,placeholder:e,width:"100%"}),(0,o.jsx)(Mi,{label:i.formatMessage({id:"GLOBAL_Confirm"}),disabled:!s.length,onClick:()=>{t(s),r(""),g()}})]})},zi=c.j.getLazyComponent("Loader"),Gi=a.default.div`
|
|
331
|
+
position: absolute;
|
|
332
|
+
inset: 0;
|
|
333
|
+
display: flex;
|
|
334
|
+
justify-content: center;
|
|
335
|
+
align-items: center;
|
|
336
|
+
background-color: rgba(255, 255, 255, 0.4);
|
|
337
|
+
`,Ii=()=>(0,o.jsx)(Gi,{children:(0,o.jsx)(zi,{size:"m"})}),Vi=c.j.getLazyComponent("WidgetCheckList"),Ri=c.j.getLazyComponent("WidgetCheckListEditor"),Oi=c.j.getLazyComponent("FileViewer"),$i=(a.default.div`
|
|
338
|
+
display: flex;
|
|
339
|
+
flex-direction: row;
|
|
340
|
+
justify-content: space-between;
|
|
341
|
+
align-items: center;
|
|
342
|
+
border: ${e=>e.border?`1px solid ${e.theme.color.grey2}`:"none"};
|
|
343
|
+
min-height: 24px;
|
|
344
|
+
border-radius: 4px;
|
|
345
|
+
padding: 4px 8px;
|
|
346
|
+
`,a.default.div`
|
|
347
|
+
width: 100%;
|
|
348
|
+
display: flex;
|
|
349
|
+
gap: 14px;
|
|
350
|
+
padding: 16px;
|
|
351
|
+
`),Bi=a.default.div`
|
|
352
|
+
position: relative;
|
|
353
|
+
`,Hi=({widget:e,inplace:t,mode:i,onWidgetUpdate:a})=>{const c=(0,l.A)(),{uniqid:u,content:g}=e,m=(0,d.jL)(),[p,h]=(0,n.useState)(),[f,x]=(0,n.useState)(!1),[j,b]=(0,n.useState)(),[C,y]=(0,n.useState)(!1),v=(0,d.GV)(r.Widget.selectors.selectToken,qe.shallowEqual),L=(0,d.GV)(t=>r.Widget.selectors.selectWidgetObjectUri(t,e.uniqid),qe.shallowEqual),A=(0,d.GV)(e=>r.Widget.selectors.selectWidgetObjectRights(e,u),qe.shallowEqual),k=(0,d.GV)(t=>r.Widget.selectors.selectAllWidgetRTObject(t,e.uniqid),qe.shallowEqual),W=(0,n.useMemo)(()=>A&&A.update,[A]),_=(0,n.useMemo)(()=>A&&A.administrate,[A]),w=(0,n.useCallback)(e=>{m(r.Toast.actions.error({label:e??c.formatMessage({id:"GLOBAL_Error"})}))},[m,c]),S=(0,n.useCallback)(()=>{p||f||(x(!0),E.default.network.token().then(e=>{h(e.result),x(!1),m(r.Widget.slice.actions.setToken({token:e.result}))}).catch(e=>{w(e.errorMsg)}))},[w,p,f,m]);v?p||h(v):S();const M=(0,n.useCallback)((e,t)=>{m((0,r.updateWidgetContent)(e,t))},[m]),T=(0,n.useCallback)(()=>{L&&(y(!0),E.default.widget.getWidget({uri:L,uniqid:u}).then(e=>{(0,E.ensureWidgetCheckListType)(e.result)&&M(u,e.result.content)}).catch(e=>!e.aborted&&w).finally(()=>y(!1)))},[u,w,L,M]),q=t=>{m(r.WidgetEditor.slice.actions.flushAllEditor()),m(r.Widget.slice.actions.setToken({token:t})),m(r.WidgetEditor.slice.actions.registerEditor({uniqid:e.uniqid,name:E.WidgetsName.CheckList,mode:i}))};(0,n.useEffect)(()=>{p||"edit"!==i||E.default.network.token().then(e=>{m(r.Widget.slice.actions.setToken({token:e.result}))})},[i,p,m]),(0,n.useEffect)(()=>{const t=e.content.arr?.map(e=>({text:e.title??"",file:e.file??void 0,checked:e.value??!1,...e.links&&{links:e.links},...e.user&&{user:e.user??void 0},...e.id&&{id:e.id,mimetype:"image/png"}}));b(t)},[e.content.arr,g]),(0,n.useEffect)(()=>{if(!Array.isArray(k))return;const t=k.at(-1);t&&L&&t.object.uri===L&&t.uniqid===e.uniqid&&("check-list-response"!==t.fn&&"widget-update"!==t.fn||T())},[k,e.uniqid,L,w,m,T]);const D=t=>{if(!e.content.arr||!L)return;const i={...e.content,arr:[...e.content.arr,{title:t,value:!1}]};E.default.widget.updateWidget({uri:L,uniqid:e.uniqid,content:i,v2:!0}).then(()=>M(e.uniqid,i)).catch(e=>w(e.errorMsg))},z=(0,n.useMemo)(()=>{if(!Array.isArray(g.arr))return[];const e=[];return g.arr.forEach(t=>{t.file&&e.push(t.file)}),e},[g]);return"edit"===i&&t?(0,o.jsx)($i,{children:(0,o.jsx)(Ri,{token:p,uniqid:u,content:{...g,arr:g.arr?.map(e=>({...e,title:s.Utils.html.htmlDecodeSpecialChars(e.title)}))},inplace:t,onChangeContent:M,onChangeWrapper:e=>{m(r.Widget.slice.actions.updateWidgetWrapper({...e}))},handleChange:t=>m((0,r.updateWidgetContent)(e.uniqid,t))})}):(0,o.jsx)(yi.M,{useRT:()=>{(0,De.AW)(e.uniqid)},children:j&&(0,o.jsx)(Oi,{files:z,openWithOptions:[],children:t=>(0,o.jsxs)(Bi,{children:[(0,o.jsx)(Vi,{limit:10,initialEntries:j,onFileClick:e=>e.id&&t(e.id),onItemCheckListChange:t=>((e,t)=>{L&&(C||(y(!0),E.default.widget.checkListRespond({uri:L,uniqid:e,index:t}).then(()=>{a&&a()}).catch(e=>{w(e.message),y(!1)})))})(e.uniqid,t)}),g.edit&&(0,o.jsx)(Di,{handleClick:D,placeholder:c.formatMessage({id:"COMMENT_WIDGET_CHECKLIST_Add_New_Task"})}),_&&p&&(0,o.jsx)(Si,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!(!g.edit&&!W)},mode:i,handleOpenEditor:()=>{p?q(p):(y(!0),E.default.network.token().then(e=>{m(r.Widget.slice.actions.setToken({token:e.result})),q(e.result)}).finally(()=>y(!1)))}}),C&&(0,o.jsx)(Ii,{})]},e.uniqid)})})},Fi=c.j.getLazyComponent("ButtonDropdown"),Ni=c.j.getLazyComponent("Tooltip"),Ui=a.default.div`
|
|
354
|
+
margin-right: ${e=>e.theme.space.sm}px;
|
|
355
|
+
button {
|
|
356
|
+
background: ${e=>e.theme.color.white};
|
|
357
|
+
}
|
|
358
|
+
`,Pi=({uniqid:e,isConfigurationValid:t=!1,handleLogout:i})=>{const n=(0,l.A)(),a=(0,qe.useDispatch)(),s=[{label:n.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{a(r.Widget.slice.actions.setWidgetState({uniqid:e,loading:!0})),E.default.office.setConfiguration(Zt).finally(i)}}];return(0,o.jsx)(pi,{uniqid:e,dropdown:()=>t&&(0,o.jsx)(Ui,{children:(0,o.jsx)(Ni,{position:"left",description:n.formatMessage({id:"WIDGET_Prompt_Dropdown"}),children:(0,o.jsx)(Fi,{small:!0,smallOpenDirection:"left",options:s,icon:"icon-cogwheel",label:"",color:"primary",variant:"outlined"})})})})},Yi=c.j.getLazyComponent("WidgetContactCardDav"),Ji=({widget:e,mode:t,levelFallback:i})=>{const{uniqid:a}=e,l=(0,d.jL)(),[s,c]=(0,n.useState)(void 0),[u,g]=(0,n.useState)(void 0),[m,p]=(0,n.useState)(!1),h=(0,d.GV)(e=>r.Widget.selectors.selectWidgetLevel(e,a),qe.shallowEqual),[f,x]=(0,n.useState)([]),j=(0,n.useCallback)((e,t)=>{e&&400===e.error&&E.default.office.setConfiguration(Zt),t?window.location.reload():(c(!1),l(r.Widget.slice.actions.setWidgetState({uniqid:a,initialized:!0,loading:!1})))},[l,a]),b=(0,n.useCallback)(e=>{c(e),l(r.Widget.slice.actions.setWidgetState({uniqid:a,initialized:!0}))},[l,a]),C=(0,n.useCallback)(e=>l(r.Widget.slice.actions.setWidgetState({uniqid:a,loading:e})),[a,l]),y=(0,n.useCallback)(()=>{E.default.office.getProviderBaseUrls().then(({result:e})=>{g(e.dav_address_book_url)}).finally(()=>C(!1))},[C]),v=(0,n.useCallback)(()=>{E.default.office.davAddressBookGetContacts({limit:10}).then(({result:e})=>{x(e),p(!0)}).catch(()=>{l(r.Toast.actions.error({label:"PLUGIN_Manager_Connection_Error"})),c(!1),l(r.Widget.slice.actions.setWidgetState({uniqid:a,initialized:!0,loading:!1}))}).finally(()=>C(!1))},[C,l,a]);return(0,n.useEffect)(()=>{if(!m)return;if(!s)return;if(h!==E.WIDGET_LEVEL_3)return;const e=setInterval(v,4e3);return()=>clearInterval(e)},[s,v,m,h]),(0,n.useEffect)(()=>{C(!0),E.default.office.isConfigurationValid().then(({result:e})=>b(e)).catch(j).finally(()=>C(!1))},[b,h,y,C,j]),(0,n.useEffect)(()=>{if(s)return h===E.WIDGET_LEVEL_1?(C(!0),void y()):void v()},[s,y,C,v,h]),s&&h&&h!==E.WIDGET_LEVEL_3&&i?(0,o.jsx)(o.Fragment,{children:i(h,u??"")}):(0,o.jsx)(ai,{header:()=>(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(Pi,{uniqid:a,isConfigurationValid:void 0!==s&&!0===s,handleLogout:()=>j(void 0,!0)})}),scrollable:()=>(0,o.jsxs)(si,{uniqid:a,children:[s&&(0,o.jsx)(Yi,{contactCardList:f}),void 0===s&&(0,o.jsx)(o.Fragment,{}),void 0!==s&&!1===s&&"view"===t&&(0,o.jsx)(ei,{})]})})},Qi=c.j.getLazyComponent("ButtonDropdown"),Xi=c.j.getLazyComponent("Tooltip"),Ki=a.default.div`
|
|
359
|
+
margin-right: ${e=>e.theme.space.sm}px;
|
|
360
|
+
button {
|
|
361
|
+
background: ${e=>e.theme.color.white};
|
|
362
|
+
}
|
|
363
|
+
`,Zi=a.default.div`
|
|
364
|
+
font-size: ${e=>e.theme.size.sm+4}px;
|
|
365
|
+
color: ${e=>e.color};
|
|
366
|
+
`,eo=({uniqid:e,isConfigurationValid:t=!1,handleLogout:i})=>{const n=(0,l.A)(),a=(0,d.jL)(),s=(0,d.GV)(t=>r.Widget.selectors.selectWidgetChipCount(t,e),qe.shallowEqual),c=[{label:n.formatMessage({id:"WIDGET_Prompt_Logout"}),onClick:()=>{a(r.Widget.slice.actions.setWidgetState({uniqid:e,loading:!0})),E.default.office.setConfiguration(Zt).finally(i)}}];return(0,o.jsx)(pi,{uniqid:e,dropdown:()=>t&&(0,o.jsx)(Ki,{children:(0,o.jsx)(Xi,{position:"left",description:n.formatMessage({id:"WIDGET_Prompt_Dropdown"}),children:(0,o.jsx)(Qi,{small:!0,smallOpenDirection:"left",options:c,icon:"icon-cogwheel",label:"",color:"primary",variant:"outlined"})})}),subHeader:e=>t&&0!==s&&(0,o.jsxs)(Zi,{color:e,children:["(",n.formatMessage({id:"WIDGET_Email_IMAP_Unread_Emails"},{count:s}),")"]})})},to=c.j.getLazyComponent("WidgetEmailsImap"),io=({widget:e,mode:t,levelFallback:i})=>{const{uniqid:a}=e,l=(0,d.jL)(),[s,c]=(0,n.useState)(void 0),[u,g]=(0,n.useState)(!1),[m,p]=(0,n.useState)([]),[h,f]=(0,n.useState)(void 0),x=(0,d.GV)(t=>r.Widget.selectors.selectWidgetLevel(t,e.uniqid),qe.shallowEqual),j=(0,n.useCallback)((e,t)=>{e&&400===e.error&&E.default.office.setConfiguration(Zt),t?window.location.reload():(c(!1),l(r.Widget.slice.actions.setWidgetState({uniqid:a,initialized:!0,loading:!1})))},[l,a]),b=(0,n.useCallback)(()=>{E.default.office.imapInboxGetUnreadEmailsCount().then(({result:e})=>{l(r.Widget.slice.actions.setWidgetChipCount({uniqid:a,count:e})),l(r.Widget.slice.actions.setWidgetState({uniqid:a,initialized:!0}))}).catch(j)},[l,a,j]),C=(0,n.useCallback)(e=>l(r.Widget.slice.actions.setWidgetState({uniqid:a,loading:e})),[a,l]),y=(0,n.useCallback)(()=>{E.default.office.getProviderBaseUrls().then(({result:e})=>{f(e.imap_inbox_url)}).finally(()=>C(!1))},[C]),v=(0,n.useCallback)(e=>{c(e),l(r.Widget.slice.actions.setWidgetState({uniqid:a,initialized:!0}))},[l,a]),L=(0,n.useCallback)(()=>{E.default.office.imapInboxGetEmails({limit:10}).then(({result:e})=>{p(e),g(!0)}).catch(()=>{l(r.Toast.actions.error({label:"PLUGIN_Manager_Connection_Error"})),c(!1),l(r.Widget.slice.actions.setWidgetState({uniqid:a,initialized:!0,loading:!1}))}).finally(()=>C(!1))},[C,l,a]);return(0,n.useEffect)(()=>{if(!u)return;if(!s)return;if(x===E.WIDGET_LEVEL_1)return;const e=setInterval(()=>{x===E.WIDGET_LEVEL_2&&b(),x===E.WIDGET_LEVEL_3&&(b(),L())},6e4);return()=>clearInterval(e)},[s,L,u,b,x]),(0,n.useEffect)(()=>{E.default.office.isConfigurationValid().then(({result:e})=>v(e)).catch(j)},[v,j]),(0,n.useEffect)(()=>{if(s){if(x===E.WIDGET_LEVEL_1)return C(!0),void y();if(x===E.WIDGET_LEVEL_2)return C(!0),b(),void y();C(!0),b(),L()}},[s,x,y,L,C,b,l]),s&&x&&x!==E.WIDGET_LEVEL_3&&i?(0,o.jsx)(o.Fragment,{children:i(x,h??"")}):(0,o.jsx)(ai,{header:()=>(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(eo,{uniqid:a,isConfigurationValid:void 0!==s&&!0===s,handleLogout:()=>j(void 0,!0)})}),scrollable:()=>(0,o.jsxs)(si,{uniqid:a,children:[void 0===s&&(0,o.jsx)(o.Fragment,{}),void 0!==s&&!1===s&&"view"===t&&(0,o.jsx)(ei,{}),s&&(0,o.jsx)(to,{emailList:m})]})})},oo=a.default.div`
|
|
367
|
+
position: absolute;
|
|
368
|
+
inset: 0;
|
|
369
|
+
display: flex;
|
|
370
|
+
justify-content: center;
|
|
371
|
+
align-items: center;
|
|
372
|
+
`,no=c.j.getLazyComponent("WidgetLuccaAbsence"),ao=c.j.getLazyComponent("Loader"),lo=({uniqid:e})=>{const[t,i]=(0,n.useState)([]),[a,l]=(0,n.useState)(!1),[s,r]=(0,n.useState)(!0),d=(0,$.Ie)(),c=(0,n.useMemo)(()=>(new Date).getFullYear()+"-"+((new Date).getMonth()+1).toString().padStart(2,"0")+"-"+(new Date).getDate().toString().padStart(2,"0")+" 00:00:00",[]);return(0,n.useEffect)(()=>{E.default.lucca.getAbsence({date:c},{signal:d.signal}).then(({result:e})=>i(e)).catch(()=>{d.signal.aborted||l(!0)}).finally(()=>r(!1))},[c,d.signal]),s?(0,o.jsx)(oo,{children:(0,o.jsx)(ao,{size:"m"})}):a?(0,o.jsx)(oo,{children:(0,o.jsx)(T.A,{id:"WIDGET_Lucca_Absence_Url_Error"})}):(0,o.jsx)(ai,{header:()=>(0,o.jsx)(pi,{uniqid:e}),scrollable:()=>(0,o.jsx)(si,{uniqid:e,children:(0,o.jsx)(no,{list:t})})})},so=a.default.div`
|
|
373
|
+
padding: ${e=>e.theme.space.md}px;
|
|
374
|
+
`,ro=a.default.a`
|
|
375
|
+
cursor: pointer;
|
|
376
|
+
color: ${e=>e.theme.color.secondary};
|
|
377
|
+
`,co=a.default.div`
|
|
378
|
+
display: flex;
|
|
379
|
+
justify-content: center;
|
|
380
|
+
align-items: center;
|
|
381
|
+
`,uo=({mode:e,uniqid:t,content:i})=>{const a=(0,l.A)(),s=(0,d.jL)(),c=(0,d.GV)(e=>r.Widget.selectors.selectWidgetObjectUri(e,t),qe.shallowEqual),u=(0,d.GV)(e=>r.Widget.selectors.selectWidgetObjectRights(e,t),qe.shallowEqual),g=(0,n.useMemo)(()=>!(!u||!u.update),[u]),m=(0,n.useCallback)(()=>{if("edit"===e||!g||!c)return;const o={...i,isClosed:!0};E.default.widget.updateWidget({uri:c,uniqid:t,content:o,v2:!0}).then(()=>s(r.Widget.slice.actions.updateWidget({uniqid:t,content:o}))).catch(()=>s(r.Toast.actions.error({label:"WIDGET_Presence_Error"})))},[e,t,g,c,i,s]);return(0,o.jsx)(o.Fragment,{children:g&&!i.isClosed&&(0,o.jsx)(so,{children:(0,o.jsx)(co,{children:(0,o.jsx)(ro,{onClick:m,children:a.formatMessage({id:"WIDGET_Presence_Closing"})})})})})},go=c.j.getLazyComponent("WidgetPresence"),mo=c.j.getLazyComponent("ModalUserList"),po=a.default.div`
|
|
382
|
+
display: flex;
|
|
383
|
+
flex: 1;
|
|
384
|
+
position: relative;
|
|
385
|
+
flex-direction: column;
|
|
386
|
+
`,ho=(a.default.div`
|
|
387
|
+
position: absolute;
|
|
388
|
+
inset: 0;
|
|
389
|
+
background-color: rgba(255, 255, 255, 0.7);
|
|
390
|
+
display: flex;
|
|
391
|
+
flex: 1;
|
|
392
|
+
justify-content: center;
|
|
393
|
+
align-items: center;
|
|
394
|
+
`,a.default.div`
|
|
395
|
+
flex: 1;
|
|
396
|
+
display: flex;
|
|
397
|
+
padding: ${e=>e.theme.space.md}px;
|
|
398
|
+
border: 1px dashed ${e=>e.theme.color.orange};
|
|
399
|
+
justify-content: center;
|
|
400
|
+
align-items: center;
|
|
401
|
+
border-radius: ${e=>e.theme.space.sm}px;
|
|
402
|
+
margin: ${e=>e.theme.space.sm}px;
|
|
403
|
+
`),fo=({widget:e,mode:t})=>{const i=(0,l.A)(),a=(0,d.jL)(),{limit:s,limitValue:c,closing:u,isClosed:g}=e.content,{uniqid:m}=e,[p,h]=(0,n.useState)({userValue:-1,userAvailableList:[],userUnavailableList:[],userAvailableTotal:0,userUnavailableTotal:0}),[f,x]=(0,n.useState)(!1),[j]=(0,n.useState)(new AbortController),[b,C]=(0,n.useState)(!1),[y,v]=(0,n.useState)(),[L,A]=(0,n.useState)(),k=(0,n.useRef)(j),W=(0,d.GV)(e=>r.Widget.selectors.selectWidgetObjectUri(e,m),qe.shallowEqual),_=(0,d.GV)(e=>r.Widget.selectors.selectAllWidgetRTObject(e,m),qe.shallowEqual),w=(0,n.useCallback)(()=>a(r.Toast.actions.error({label:"WIDGET_Presence_Error"})),[a]),S=(0,n.useMemo)(()=>!(s&&c&&p.userAvailableTotal>=c),[s,c,p.userAvailableTotal]),M=(0,n.useMemo)(()=>u&&g||"edit"===t,[u,g,t]),T=(0,n.useCallback)(()=>{W&&!M&&(S?(x(!0),E.default.widget.presenceCancel({uri:W,uniqid:m}).catch(w).finally(()=>x(!1))):a(r.Toast.actions.error({label:"WIDGET_Presence_Limit_Response_Error"})))},[a,m,w,W,S,M]),q=(0,n.useCallback)(e=>{W&&!M&&(x(!0),E.default.widget.presenceRespond({uri:W,uniqid:m,value:e},k.current.signal).catch(w).finally(()=>x(!1)))},[W,m,w,M]),D=(0,n.useCallback)(()=>{"edit"!==t&&W&&(x(!0),E.default.widget.presenceGetResponse({uri:W,uniqid:m},k.current.signal).then(e=>{h(e.result)}).catch(e=>!e.aborted&&w()).finally(()=>x(!1)))},[W,w,m,t]),z=(e,t)=>{W&&E.default.widget.presenceGetResponseUserList({uri:W,uniqid:m,index:e,page:t,limit:8},k.current.signal).then(e=>{A({...e.result,data:[...e.result.data],cnt:e.result.cnt})}).catch(e=>!e.aborted&&w)},G=(0,n.useCallback)(()=>{W&&(x(!0),E.default.widget.getWidget({uri:W,uniqid:m}).then(e=>{a((0,r.updateWidgetContent)(m,e.result))}).catch(e=>!e.aborted&&w).finally(()=>x(!1)))},[a,w,W,m]);return(0,n.useEffect)(()=>{const e=k.current;return()=>{e.abort()}},[]),(0,n.useEffect)(()=>{D()},[D]),(0,n.useEffect)(()=>{if(!Array.isArray(_))return;const e=_.at(-1);e&&W&&e.object.uri===W&&e.uniqid===m&&("widget-presence-response"===e.fn&&D(),"widget-update"===e.fn&&G())},[_,D,m,W,G]),(0,o.jsx)(yi.M,{useRT:()=>{(0,De.AW)(e.uniqid)},children:(0,o.jsxs)(po,{children:[(0,o.jsx)(go,{limit:s,limitValue:c,userAvailableList:p.userAvailableList,userUnavailableList:p.userUnavailableList,userValue:p.userValue,userAvailableTotal:p?.userAvailableTotal,userUnavailableTotal:p?.userUnavailableTotal,isClosed:u&&g,handleClickAvailable:()=>1===p.userValue?T():q(1),handleClickUnavailable:()=>0===p.userValue?T():q(0),handleOpenUsersModal:e=>{A({limit:0,page:0,data:[],cnt:0}),v(e),z(e),C(!0)}}),u&&g&&(0,o.jsx)(ho,{children:i.formatMessage({id:"WIDGET_Presence_Is_Closed"})}),u&&!g&&(0,o.jsx)(uo,{mode:t,uniqid:e.uniqid,content:e.content}),"view"===t&&(0,o.jsx)(Si,{uniqid:e.uniqid,name:e.name,mode:t}),f&&(0,o.jsx)(Ii,{}),(0,o.jsx)(mo,{open:b,usersList:L,title:1===y?i.formatMessage({id:"WIDGET_Presence_On"}):i.formatMessage({id:"WIDGET_Presence_Off"}),setOpen:C,onClose:()=>{A({limit:0,page:0,data:[],cnt:0})},handleLoadUsersList:e=>{z(y??0,e)}})]})})},xo=c.j.getLazyComponent("WidgetQuickSurvey"),jo=c.j.getLazyComponent("WidgetQuickSurveyEditor"),bo=c.j.getLazyComponent("ModalUserList"),Co=c.j.getLazyComponent("FileViewer"),yo=a.default.div`
|
|
404
|
+
width: 100%;
|
|
405
|
+
display: flex;
|
|
406
|
+
flex-direction: column;
|
|
407
|
+
gap: 14px;
|
|
408
|
+
${e=>e.withPadding&&"padding: 0 12px;"}
|
|
409
|
+
padding-top: 16px;
|
|
410
|
+
`,vo=({widget:e,inplace:t,mode:i})=>{const a=(0,l.A)(),s=(0,d.jL)(),{uniqid:c,content:u}=e,[g,m]=(0,n.useState)({userResponses:[],totalRespondent:0,totalResponse:0,userLoggedResponses:[]}),[p,h]=(0,n.useState)(!1),[f,x]=(0,n.useState)(!1),[j,b]=(0,n.useState)(),[C,y]=(0,n.useState)(),[v]=(0,n.useState)(new AbortController),L=(0,n.useRef)(v),A=(0,d.GV)(r.Widget.selectors.selectToken,qe.shallowEqual),k=(0,d.GV)(t=>r.Widget.selectors.selectWidgetObjectUri(t,e.uniqid),qe.shallowEqual),W=(0,d.GV)(e=>r.Widget.selectors.selectWidgetObjectRights(e,c),qe.shallowEqual),_=(0,d.GV)(t=>r.Widget.selectors.selectAllWidgetRTObject(t,e.uniqid),qe.shallowEqual),w=(0,n.useCallback)((e,t)=>{s((0,r.updateWidgetContent)(e,t))},[s]),S=t=>{s(r.WidgetEditor.slice.actions.flushAllEditor()),s(r.Widget.slice.actions.setToken({token:t})),s(r.WidgetEditor.slice.actions.registerEditor({uniqid:e.uniqid,name:E.WidgetsName.QuickSurvey}))},M=(0,n.useCallback)(()=>s(r.Toast.actions.error({label:"WIDGET_Presence_Error"})),[s]),T=(0,n.useCallback)(e=>{"edit"!==i&&k&&(x(!0),E.default.widget.quickSurveyGetResponse({uri:k,uniqid:e},L.current.signal).then(e=>{m(e.result)}).catch(e=>!e.aborted&&M).finally(()=>x(!1)))},[M,k,i]),q=(0,n.useCallback)(()=>{k&&(x(!0),E.default.widget.getWidget({uri:k,uniqid:c},L.current.signal).then(e=>{w(c,e.result.content)}).catch(e=>!e.aborted&&M).finally(()=>x(!1)))},[c,M,k,w]),D=()=>{if(k&&u.closing){const e={...u,isClosed:!0};E.default.widget.updateWidget({uri:k,uniqid:c,content:e}).catch(()=>{M()})}},z=t=>{(t=>{"edit"!==i&&k&&(x(!0),E.default.widget.quickSurveyRespond({uri:k,index:t,multi:u.multi?1:0,uniqid:c},L.current.signal).then(()=>{T(e.uniqid)}).catch(e=>!e.aborted&&M).finally(()=>x(!1)))})(t)},G=(e,t)=>{k&&E.default.widget.quickSurveyGetResponseUserList({uri:k,uniqid:c,index:e,page:t,limit:8},L.current.signal).then(e=>{y({...e.result,data:[...e.result.data],cnt:e.result.cnt})}).catch(e=>!e.aborted&&M)},I=(0,n.useMemo)(()=>W&&W.update,[W]);(0,n.useEffect)(()=>{T(e.uniqid)},[T,e.uniqid]),(0,n.useEffect)(()=>{if(!Array.isArray(_))return;const t=_.at(-1);t&&k&&t.object.uri===k&&t.uniqid===e.uniqid&&("widget-quick-survey-response"===t.fn&&T(e.uniqid),"widget-update"===t.fn&&q())},[_,k,e.uniqid,q,T]);const V=(0,n.useMemo)(()=>{if(!Array.isArray(u.arr))return[];const e=[];return u.arr.forEach(t=>{t.file&&e.push(t.file)}),e},[u]);return(0,n.useEffect)(()=>{A||"edit"!==i||E.default.network.token().then(e=>{s(r.Widget.slice.actions.setToken({token:e.result}))})},[i,A,s]),"edit"===i&&t?(0,o.jsx)(yo,{withPadding:!0,children:(0,o.jsx)(jo,{token:A,uniqid:c,content:e.content,onChangeContent:w,onChangeWrapper:e=>{s(r.Widget.slice.actions.updateWidgetWrapper({...e}))},handleChange:e=>w(c,e),inplace:t})}):(0,o.jsx)(yi.M,{useRT:()=>{(0,De.AW)(e.uniqid)},children:(0,o.jsxs)(yo,{children:[(0,o.jsx)(Co,{files:V,openWithOptions:[],children:t=>(0,o.jsx)(xo,{limit:g.totalResponse??0,values:u.arr??[],userResponses:g.userResponses,userHasAlreadyVoted:g.userLoggedResponses.length>0,canCloseSurvey:e.content.closing??!1,isClosed:e.content.isClosed??!1,open:e.content.open??!1,anonymize:e.content.anonymize??!1,seeResponseAfter:e.content.seeResponseAfter??!1,canUpdate:I,handleClickFile:e=>e.id&&t(e.id),handleCloseSurvey:D,handleProgressBarClick:z,setOpenUsersModal:e=>{b(e),G(e),h(!0)}})}),u.open&&(0,o.jsx)(Di,{handleClick:e=>{if(!k)return;const t={...u,arr:[...u.arr??[],{title:e}]};E.default.widget.quickSurveyAddEnty({uri:k,uniqid:c,label:e}).then(()=>{s(r.Widget.slice.actions.updateWidget({uniqid:c,content:t}))}).catch(M)},placeholder:a.formatMessage({id:"FIELDS_Add_Option"})}),I&&(0,o.jsx)(Si,{uniqid:e.uniqid,name:e.name,collaborationRights:{update:!!I},mode:i,handleOpenEditor:()=>{A?S(A):(x(!0),E.default.network.token().then(e=>{s(r.Widget.slice.actions.setToken({token:e.result})),S(e.result)}).finally(()=>x(!1)))}}),f&&(0,o.jsx)(Ii,{}),(0,o.jsx)(bo,{open:p,usersList:C,title:u.arr?.[j??0]?.title??"",setOpen:h,handleLoadUsersList:e=>{G(j??0,e)},onClose:()=>{y({limit:0,page:0,data:[],cnt:0})}})]})})},Lo=c.j.getLazyComponent("WidgetUserProfile"),Eo=({widget:e,mode:t})=>{const i=(0,d.jL)(),{uniqid:a,name:l,content:s}=e,c=(0,d.GV)(r.UserCurrent.selectors.get);return(0,n.useEffect)(()=>(i(r.Widget.slice.actions.setWidgetState({uniqid:a,mounted:!0})),()=>{i(r.Widget.slice.actions.setWidgetState({uniqid:a,mounted:!1}))}),[a,i]),(0,n.useEffect)(()=>{"edit"===t&&(i(r.WidgetEditor.slice.actions.flushAllEditor()),i(r.WidgetEditor.slice.actions.registerEditor({uniqid:a,name:l})))},[i,t,l,a]),(0,n.useEffect)(()=>{"view"!==t&&"preview"!==t||i(r.WidgetEditor.slice.actions.flushAllEditor())},[t,i]),(0,o.jsx)(Lo,{currentUser:c,pictureSize:s.pictureSize,displayMode:s.buttonName,css:s.css})},Ao=c.j.getLazyComponent("WidgetWelcome"),ko=({widget:e,mode:t})=>{const i=(0,d.jL)(),{uniqid:a,name:l,content:s}=e,c=(0,d.GV)(r.UserCurrent.selectors.get);return(0,n.useEffect)(()=>(i(r.Widget.slice.actions.setWidgetState({uniqid:a,mounted:!0})),()=>{i(r.Widget.slice.actions.setWidgetState({uniqid:a,mounted:!1}))}),[a,i]),(0,n.useEffect)(()=>{"edit"===t&&(i(r.WidgetEditor.slice.actions.flushAllEditor()),i(r.WidgetEditor.slice.actions.registerEditor({uniqid:a,name:l})))},[i,t,l,a]),(0,n.useEffect)(()=>{"view"!==t&&"preview"!==t||i(r.WidgetEditor.slice.actions.flushAllEditor())},[t,i]),(0,o.jsx)(Ao,{currentUser:c,position:s.position,lineBreak:s.lineBreak,message:s.message,displayMode:s.buttonName,css:s.css})},Wo=c.j.getLazyComponent("WidgetColor"),_o=({widget:e,mode:t})=>{const i=(0,d.jL)(),{uniqid:a,name:l,content:s}=e;return(0,n.useEffect)(()=>(i(r.Widget.slice.actions.setWidgetState({uniqid:a,mounted:!0})),()=>{i(r.Widget.slice.actions.setWidgetState({uniqid:a,mounted:!1}))}),[a,i]),(0,n.useEffect)(()=>{"edit"===t&&(i(r.WidgetEditor.slice.actions.flushAllEditor()),i(r.WidgetEditor.slice.actions.registerEditor({uniqid:a,name:l})))},[i,t,l,a]),(0,n.useEffect)(()=>{"view"!==t&&"preview"!==t||i(r.WidgetEditor.slice.actions.flushAllEditor())},[t,i]),(0,o.jsx)(Wo,{backgroundColor:s.backgroundColor})},wo=({uniqid:e,extensionName:t})=>{const i=(0,n.useMemo)(()=>`widget-extension-${t}-${e}`,[t,e]);return(0,n.useEffect)(()=>{t&&J.react.require(t,{anchorId:i})},[t,i]),(0,o.jsx)("div",{id:i})},So=(e,t)=>{const i=[];return e.filter(e=>e.isVisible).forEach(e=>{const o=t.find(t=>t.name===e.name);o&&i.push(o)}),i},Mo=c.j.getLazyComponent("Button"),To=c.j.getLazyComponent("WidgetTable"),qo=c.j.getLazyComponent("Loader"),Do=(a.default.div``,a.default.div`
|
|
411
|
+
position: absolute;
|
|
412
|
+
inset: 0;
|
|
413
|
+
display: flex;
|
|
414
|
+
flex-direction: column;
|
|
415
|
+
justify-content: center;
|
|
416
|
+
align-items: center;
|
|
417
|
+
gap: ${e=>e.theme.space.md}px;
|
|
418
|
+
`),zo=({uri:e,limit:t,tableHeadColor:i,tableHeadTextColor:a,tableHeadIconColor:l,tableRowColor:s,tableRowTextColor:c,tableColumnsData:u=[],tableBorderRadius:g,tableSizedColumns:m,tableSizedColumnsWidth:p,mode:h})=>{const f=(0,d.jL)(),[x,j]=(0,n.useState)(!1),[b,C]=(0,n.useState)([]),[y,v]=(0,n.useState)([]),L=(0,n.useMemo)(()=>r.Widget.definition(E.WidgetsName.ExcelDatasourceTable),[]);(0,n.useEffect)(()=>{void 0!==e&&0!==u.length&&0===y.length&&(j(!0),E.default.datasource.get(e,E.Format.VIEW).then(e=>{v(e.result.model),C(e.result.data)}).finally(()=>j(!1)))},[e,u,y]),(0,n.useEffect)(()=>{e||v([])},[e]),(0,n.useEffect)(()=>{"view"!==h&&"preview"!==h||f(r.WidgetEditor.slice.actions.flushAllEditor())},[h,f]);const A=(0,n.useMemo)(()=>So(u,y),[u,y]);return 0!==u.length||x||"edit"!==h?x?(0,o.jsx)(Do,{children:(0,o.jsx)(qo,{})}):(0,o.jsx)(o.Fragment,{children:x||0!==b.length||"edit"===h?(0,o.jsx)(To,{rows:b,columns:A,limit:t,tableHeadColor:i,tableHeadTextColor:a,tableHeadIconColor:l,tableRowColor:s,tableRowTextColor:c,tableBorderRadius:g,tableColumnsData:u,tableSizedColumns:m,tableSizedColumnsWidth:p}):(0,o.jsxs)(Do,{children:[(0,o.jsx)("img",{src:`/img/fast-intranet/${E.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),(0,o.jsx)(T.A,{id:"WIDGET_Datasource_No_Results"})]})}):(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)(Do,{children:[(0,o.jsx)("img",{src:`/img/fast-intranet/${E.WidgetsName.ExcelDatasourceTable}.png`,alt:""}),(0,o.jsx)(T.A,{id:L.label}),(0,o.jsx)(Mo,{label:"GLOBAL_Settings"})]})})},Go=c.j.getLazyComponent("Button"),Io=c.j.getLazyComponent("WidgetTable"),Vo=c.j.getLazyComponent("Loader"),Ro=(a.default.div``,a.default.div`
|
|
419
|
+
position: absolute;
|
|
420
|
+
inset: 0;
|
|
421
|
+
display: flex;
|
|
422
|
+
flex-direction: column;
|
|
423
|
+
justify-content: center;
|
|
424
|
+
align-items: center;
|
|
425
|
+
gap: ${e=>e.theme.space.md}px;
|
|
426
|
+
`),Oo=({uri:e,limit:t,tableHeadColor:i,tableHeadTextColor:a,tableHeadIconColor:l,tableRowColor:s,tableRowTextColor:c,tableColumnsData:u=[],tableBorderRadius:g,tableSizedColumns:m,tableSizedColumnsWidth:p,mode:h})=>{const f=(0,d.jL)(),[x,j]=(0,n.useState)(!1),[b,C]=(0,n.useState)([]),[y,v]=(0,n.useState)([]),[L,A]=(0,n.useState)({order:"ascending",name:"unknown"}),[k,W]=(0,n.useState)(void 0),[_,w]=(0,n.useState)(""),S=(0,n.useMemo)(()=>r.Widget.definition(E.WidgetsName.DatasourceTable),[]),M=(0,n.useMemo)(()=>"studio"===k?[{type:[_]}]:[],[k,_]),q=(0,n.useMemo)(()=>"doc"===k?[_]:[],[k,_]),{rtLastObject:D}=(0,De.YL)(M,q),z=(0,n.useCallback)(()=>{e&&(j(!0),E.default.datasource.get(e,E.Format.VIEW).then(e=>{v(e.result.model),C(e.result.data),A(e.result.sort),W(e.result.datasource.datasourceType),w(e.result.datasource.datasourceIdentifier)}).finally(()=>j(!1)))},[e]);(0,n.useEffect)(()=>{void 0!==e&&0!==u.length&&0===y.length&&z()},[e,u,y,z]),(0,n.useEffect)(()=>{D&&z()},[D,z]),(0,n.useEffect)(()=>{e||v([])},[e]),(0,n.useEffect)(()=>{"view"!==h&&"preview"!==h||f(r.WidgetEditor.slice.actions.flushAllEditor())},[h,f]);const G=(0,n.useMemo)(()=>So(u,y),[u,y]);return 0!==u.length||x||"edit"!==h?x?(0,o.jsx)(Ro,{children:(0,o.jsx)(Vo,{})}):(0,o.jsx)(o.Fragment,{children:x||0!==b.length||"edit"===h?(0,o.jsx)(Io,{rows:b,columns:G,limit:t,tableHeadColor:i,tableHeadTextColor:a,tableHeadIconColor:l,tableRowColor:s,tableRowTextColor:c,tableBorderRadius:g,tableColumnsData:u,tableSizedColumns:m,tableSizedColumnsWidth:p,tableDefaultSortOrder:L.order,tableDefaultSortName:L.name}):(0,o.jsxs)(Ro,{children:[(0,o.jsx)("img",{src:`/img/fast-intranet/${E.WidgetsName.DatasourceTable}.png`,alt:""}),(0,o.jsx)(T.A,{id:"WIDGET_Datasource_No_Results"})]})}):(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)(Ro,{children:[(0,o.jsx)("img",{src:`/img/fast-intranet/${E.WidgetsName.DatasourceTable}.png`,alt:""}),(0,o.jsx)(T.A,{id:S.label}),(0,o.jsx)(Go,{label:"GLOBAL_Settings"})]})})},$o=a.default.div`
|
|
427
|
+
position: absolute;
|
|
428
|
+
inset: 0;
|
|
429
|
+
display: flex;
|
|
430
|
+
align-items: center;
|
|
431
|
+
justify-content: center;
|
|
432
|
+
color: ${e=>e.theme.color.orange};
|
|
433
|
+
`,Bo=({children:e,name:t})=>{const i=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,t)),n=(0,l.A)();return i&&!i.hasLicense?(0,o.jsx)($o,{children:n.formatMessage({id:"WIDGET_Missing_License"},{label:"label"in i?i.label:""})}):(0,o.jsx)(o.Fragment,{children:e})},Ho=a.default.div`
|
|
434
|
+
display: flex;
|
|
435
|
+
flex: 1;
|
|
436
|
+
flex-direction: column;
|
|
437
|
+
`,Fo=({widget:e,width:t,inplace:i=!1,mode:n="view",onWidgetUpdate:a,cannotDisplayComponent:l,levelFallback:s,dataCy:r})=>{const{name:d}=e;return(0,E.ensureWidgetArticleButtonType)(e)?(0,o.jsx)(lt,{widget:e,inplace:i,mode:n}):(0,E.ensureWidgetArticleGalleryType)(e)?(0,o.jsx)(ut,{widget:e,inplace:i,mode:n}):(0,E.ensureWidgetLuccaAbsenceType)(e)?(0,o.jsx)(Ho,{children:(0,o.jsx)(Bo,{name:"LuccaAbsenceHook",children:(0,o.jsx)(lo,{uniqid:e.uniqid})})}):(0,E.ensureWidgetArticleAttachmentType)(e)?(0,o.jsx)(it,{widget:e,inplace:i,mode:n}):(0,E.ensureWidgetArticleImageType)(e)?(0,o.jsx)(bt,{widget:e,inplace:i,mode:n}):(0,E.ensureWidgetArticleSliderType)(e)?(0,o.jsx)(kt,{widget:e,inplace:i,mode:n,width:t??800}):(0,E.ensureWidgetArticleTitleType)(e)?(0,o.jsx)(Vt,{widget:e,inplace:i,mode:n,dataCy:r}):(0,E.ensureWidgetArticleTextType)(e)?(0,o.jsx)(qt,{widget:e,inplace:i,mode:n}):(0,E.ensureWidgetExcelDatasourceTableType)(e)?(0,o.jsxs)(Ho,{children:[(0,o.jsx)(Ye,{uniqid:e.uniqid}),(0,o.jsx)(zo,{...e.content,uniqid:e.uniqid,mode:n})]}):(0,E.ensureWidgetDatasourceTableType)(e)?(0,o.jsxs)(Ho,{children:[(0,o.jsx)(Ye,{uniqid:e.uniqid}),(0,o.jsx)(Oo,{...e.content,uniqid:e.uniqid,mode:n})]}):(0,E.ensureWidgetCheckListType)(e,"widget-check-list"===e.name)?(0,o.jsxs)(Ho,{children:["edit"===n?(0,o.jsx)(Ne,{name:e.name,uniqid:e.uniqid}):(0,o.jsx)(Ye,{uniqid:e.uniqid}),(0,o.jsx)(Hi,{widget:e,inplace:i,mode:n,onWidgetUpdate:a})]}):(0,E.ensureWidgetPresenceType)(e)?(0,o.jsxs)(Ho,{children:["edit"===n?(0,o.jsx)(Ne,{name:e.name,uniqid:e.uniqid}):(0,o.jsx)(Ye,{uniqid:e.uniqid}),(0,o.jsx)(fo,{widget:e,inplace:i,mode:n})]}):(0,E.ensureWidgetQuickSurveyType)(e)?(0,o.jsxs)(Ho,{children:["edit"===n?(0,o.jsx)(Ne,{name:e.name,uniqid:e.uniqid}):(0,o.jsx)(Ye,{uniqid:e.uniqid}),(0,o.jsx)(vo,{widget:e,inplace:i,mode:n})]}):(0,E.ensureWidgetCalendarCalDavType)(e)?(0,o.jsx)(Ho,{children:(0,o.jsx)(Bo,{name:"OfficeHook",children:(0,o.jsx)(Ci,{widget:e,inplace:i,mode:n,levelFallback:s})})}):(0,E.ensureWidgetContactCardDavType)(e)?(0,o.jsx)(Ho,{children:(0,o.jsx)(Bo,{name:"OfficeHook",children:(0,o.jsx)(Ji,{widget:e,inplace:i,mode:n,levelFallback:s})})}):(0,E.ensureWidgetEmailsImapType)(e)?(0,o.jsx)(Ho,{children:(0,o.jsx)(Bo,{name:"OfficeHook",children:(0,o.jsx)(io,{widget:e,inplace:i,mode:n,levelFallback:s})})}):(0,E.ensureWidgetUserProfileType)(e)?(0,o.jsx)(Ho,{children:(0,o.jsx)(Eo,{widget:e,inplace:i,mode:n})}):(0,E.ensureWidgetColorType)(e)?(0,o.jsx)(Ho,{children:(0,o.jsx)(_o,{widget:e,inplace:i,mode:n})}):(0,E.ensureWidgetWelcomeType)(e)?(0,o.jsx)(Ho,{children:(0,o.jsx)(ko,{widget:e,inplace:i,mode:n})}):(0,E.ensureWidgetExtensionType)(e)&&e.content.extensionName?(0,o.jsx)(Ho,{children:(0,o.jsx)(wo,{uniqid:e.uniqid,name:e.name,extensionName:e.content.extensionName})}):l?(0,o.jsx)(o.Fragment,{children:l(d)}):(0,o.jsxs)(o.Fragment,{children:["cannot display widget (",d,")"]})},No=a.default.div`
|
|
438
|
+
position: absolute;
|
|
439
|
+
inset: 0;
|
|
440
|
+
opacity: ${e=>e.opacity};
|
|
441
|
+
background-color: ${e=>e.backgroundColor};
|
|
442
|
+
pointer-events: ${e=>e.pointerEvents};
|
|
443
|
+
`,Uo=c.j.getLazyComponent("DoubleClick"),Po=({uniqid:e,mode:t})=>{const i=(0,d.GV)(t=>t.widgets.ids[e].widget.layers,qe.shallowEqual);return(0,o.jsx)(o.Fragment,{children:i?.map((e,t)=>(0,o.jsx)(Yo,{uniqid:e,mode:"edit"},t))})},Yo=({uniqid:e,mode:t})=>{const i=(0,d.GV)(t=>t.widgets.layers[e]);return"view"===t?(0,o.jsx)(No,{opacity:1,backgroundColor:"transparent",pointerEvents:"none",children:i.widgets.map((e,t)=>(0,o.jsx)(Jo,{layerId:i.uniqid,uniqid:e.widget.uniqid,mode:"view"},t))}):(0,o.jsx)(No,{opacity:i.visible?1:0,backgroundColor:i.visible?"rgba(255,255,255,.1)":"transparent",pointerEvents:i.locked?"none":"all",children:i.widgets.map((e,t)=>(0,o.jsx)(Jo,{layerId:i.uniqid,uniqid:e.widget.uniqid,mode:"edit"},t))})},Jo=({uniqid:e,layerId:t,mode:i})=>{const n=(0,d.jL)(),a=(0,d.GV)(t=>t.widgets.ids[e],qe.shallowEqual),l=(0,d.GV)(e=>e.widgets.layers[t]);return a&&l&&l.position?"view"===i?(0,o.jsx)("div",{style:{position:"absolute",top:l.position.y,left:l.position.x},children:(0,o.jsx)(dn,{uniqid:e,widget:a,mode:i,inplace:!0,context:"article"})}):(0,o.jsx)(Qo,{position:{x:l.position.x,y:l.position.y},onMouseUp:e=>{(l.position&&l.position.x!==e.x||l.position&&l.position.y!==e.y)&&(e=>{n(r.Widget.slice.actions.updateLayer({uniqid:t,props:{position:e}}))})(e)},children:(0,o.jsx)(Uo,{onDoubleTap:()=>((e,t)=>{n(r.WidgetEditor.slice.actions.registerEditor({uniqid:e,name:t}))})(a.widget.uniqid,a.widget.name),children:(0,o.jsx)(dn,{uniqid:e,widget:a,mode:i,inplace:!0,context:"article"})})}):(0,o.jsx)(o.Fragment,{})},Qo=({position:e,children:t,onMouseUp:i})=>{const[a,l]=(0,n.useState)(!1),[s,r]=(0,n.useState)({x:0,y:0}),[d,c]=(0,n.useState)({x:0,y:0}),[u,g]=(0,n.useState)({x:e.x,y:e.y}),m=(0,n.useRef)(null),p=(0,n.useCallback)(e=>{l(!0),m.current&&(r({x:e.nativeEvent.clientX,y:e.nativeEvent.clientY}),c({x:u.x,y:u.y}))},[u.x,u.y]),h=(0,n.useCallback)(e=>{if(a&&m.current){const t=d.x+(e.clientX-s.x),i=d.y+(e.clientY-s.y);g({x:t,y:i})}},[s.x,s.y,a,d.x,d.y]),f=(0,n.useCallback)(()=>{l(!1),i({x:u.x,y:u.y})},[u.x,u.y,i]);return(0,n.useEffect)(()=>(document.addEventListener("mousemove",h),document.addEventListener("mouseup",f),()=>{document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",f)}),[h,f]),(0,o.jsx)("div",{style:{position:"absolute",top:u.y,left:u.x},ref:m,onMouseDown:p,children:t})},Xo=c.j.getLazyComponent("Loader"),Ko=({uniqid:e,inplace:t})=>{const i=(0,d.GV)(t=>r.Widget.selectors.selectWidgetState(t,e));return i?.loading?(0,o.jsx)("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"},children:(0,o.jsx)(Xo,{})}):i?.hover?(0,o.jsx)("div",{style:{position:"absolute",inset:0,backgroundColor:"rgba(255,255,255,.7)",display:"flex",flex:1,justifyContent:"center",alignItems:"center"}}):(0,o.jsx)(o.Fragment,{})},Zo=c.j.getLazyComponent("Html"),en=a.default.button`
|
|
444
|
+
position: absolute;
|
|
445
|
+
inset: 0;
|
|
446
|
+
display: flex;
|
|
447
|
+
flex-direction: row;
|
|
448
|
+
justify-content: center;
|
|
449
|
+
align-items: center;
|
|
450
|
+
gap: ${e=>e.theme.space.md}px;
|
|
451
|
+
color: ${e=>e.theme.color.primary};
|
|
452
|
+
cursor: pointer;
|
|
453
|
+
opacity: 0;
|
|
454
|
+
border: 1px solid ${e=>e.theme.color.primary};
|
|
455
|
+
&:hover {
|
|
456
|
+
background-color: ${e=>e.theme.color.grey2};
|
|
457
|
+
opacity: 0.9;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
${(0,s.DashedFocusBorder)()}
|
|
461
|
+
`,tn=({uniqid:e,name:t})=>{const i=(0,d.jL)(),a=(0,l.A)(),s=(0,n.useCallback)(()=>{i(r.WidgetEditor.slice.actions.flushAllEditor()),i(r.WidgetEditor.slice.actions.registerEditor({uniqid:e,name:t}))},[i,e,t]),c=r.Widget.definition(t);return(0,o.jsx)(en,{onClick:s,children:(0,o.jsx)(Zo,{__html:`${a.formatMessage({id:"WIDGET_Set_Widget"})} <b>${a.formatMessage({id:c.label})}</b>`})})},on=a.default.div`
|
|
462
|
+
display: flex;
|
|
463
|
+
flex-direction: column;
|
|
464
|
+
`,nn=({uniqid:e,onClick:t,children:i})=>{const l=(0,a.useTheme)(),s=(0,d.GV)(t=>r.Widget.selectors.selectWidgetWrapperStyle(t,e),qe.shallowEqual),c=(0,n.useMemo)(()=>({color:s&&s.color?String(s.color):l.color.black,backgroundColor:s&&s["background-color"]?String(s["background-color"]):l.color.white,borderRadius:s&&s["border-radius"]?`${s["border-radius"]}px`:"0px",borderColor:s["border-color"]?String(s["border-color"]):l.color.black,borderWidth:s["border-width"]?`${s["border-width"]}px`:"0px",borderStyle:s["border-style"]?String(s["border-style"]):"none"}),[s,l]);return(0,o.jsx)(on,{onClick:t,style:{color:c.color,borderColor:c.borderColor,borderStyle:c.borderStyle,borderRadius:c.borderRadius,borderWidth:c.borderWidth,backgroundColor:c.backgroundColor,overflow:Number(c.borderRadius)>0?"hidden":"initial"},children:i})},an=c.j.getLazyComponent("WidgetIcon"),ln=a.default.a`
|
|
465
|
+
position: absolute;
|
|
466
|
+
top: 0;
|
|
467
|
+
right: 0;
|
|
468
|
+
bottom: 0;
|
|
469
|
+
left: 0;
|
|
470
|
+
display: flex;
|
|
471
|
+
justify-content: center;
|
|
472
|
+
align-items: center;
|
|
473
|
+
flex-direction: column;
|
|
474
|
+
color: ${e=>e.color?e.color:e.theme.color.black};
|
|
475
|
+
transition: background-color 0.4s;
|
|
476
|
+
&:hover {
|
|
477
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
478
|
+
color: ${e=>e.color?e.color:e.theme.color.black};
|
|
479
|
+
}
|
|
480
|
+
`,sn=({uniqid:e,name:t,url:i,level:n})=>{const a=r.Widget.definition(t),l=(0,d.GV)(t=>2===n?r.Widget.selectors.selectWidgetChipCount(t,e):0,qe.shallowEqual),s=(0,d.GV)(t=>r.Widget.selectors.selectWidgetWrapperStyle(t,e),qe.shallowEqual);return(0,o.jsx)(ln,{href:i,target:"_blank",color:String(s.color)??void 0,rel:"noreferrer","aria-label":a.label,children:(0,o.jsx)(an,{count:l,img:a.img,label:a.label,maxValue:999})})},rn=({uniqid:e,widgetObject:t,widget:i,inplace:a=!0,mode:l,width:s,context:c,onWidgetUpdate:u,cannotDisplayComponent:g,dataCy:m})=>{const p=(0,d.jL)(),h=(0,d.GV)(t=>r.Widget.selectors.selectWidget(t,e)),f=(0,d.GV)(t=>t.widgets.editableMap[e],qe.shallowEqual),x=(0,d.GV)(e=>e.widgets.currentEditableWidgetId,qe.shallowEqual),j=(0,d.GV)(t=>t.widgets.currentEditableWidgetId===e,qe.shallowEqual),{isComponentVisible:b,setIsComponentVisible:C}=(0,De.xv)(!1);(0,n.useEffect)(()=>{t&&p(r.Widget.slice.actions.registerWidgetObject({uniqid:e,object:t}))},[]),(0,n.useEffect)(()=>{i&&p(r.Widget.slice.actions.registerWidget({uniqid:e,widget:i,context:c}))},[]),(0,n.useEffect)(()=>{b||e===x&&p(r.Widget.slice.actions.setEditableWidgetId({uniqid:void 0}))},[b]),(0,n.useEffect)(()=>{b!==j&&C(j)},[j]);const y=(0,n.useCallback)(()=>{if(void 0===h||"view"===l)return;p(r.WidgetEditor.slice.actions.flushAllEditor());const{widget:e}=h;p(r.WidgetEditor.slice.actions.registerEditor({uniqid:e.uniqid,name:e.name}))},[p,l,h]);return void 0===h?(0,o.jsx)(o.Fragment,{children:"This widget cannot be displayed"}):a&&"view"!==l?(0,o.jsxs)(nn,{uniqid:e,onClick:()=>{C(!0),f&&(p(r.Widget.slice.actions.setEditableIndex({index:f.index})),p(r.Widget.slice.actions.setEditableWidgetId({uniqid:e})))},children:[(0,o.jsx)(Fo,{dataCy:m,width:s,widget:{...h.widget,...h.title&&{title:h.title}},inplace:a,mode:l,levelFallback:(e,t)=>e<=2&&(0,o.jsx)(sn,{uniqid:i.widget.uniqid,name:i.widget.name,level:e,url:t})}),(0,o.jsx)(Po,{uniqid:e,mode:l}),(0,o.jsx)(Ko,{name:h.widget.name,uniqid:h.widget.uniqid,inplace:a})]}):(0,o.jsxs)(nn,{uniqid:e,onClick:y,children:[(0,o.jsx)(Fo,{dataCy:m,widget:{...h.widget,...h.title&&{title:h.title}},inplace:a,mode:l,width:s,onWidgetUpdate:u,cannotDisplayComponent:g,levelFallback:(e,t)=>e<=2&&(0,o.jsx)(sn,{uniqid:i.widget.uniqid,name:i.widget.name,level:e,url:t})}),(0,o.jsx)(Po,{uniqid:e,mode:l}),"edit"===l&&(0,o.jsx)(tn,{uniqid:e,name:i.widget.name}),(0,o.jsx)(Ko,{name:h.widget.name,uniqid:h.widget.uniqid,inplace:a})]})},dn=rn,cn=a.default.div`
|
|
481
|
+
border-radius: ${e=>e.theme.space.sm}px;
|
|
482
|
+
border: 1px solid ${e=>e.theme.color.grey1};
|
|
483
|
+
background-color: ${e=>e.theme.color.white};
|
|
484
|
+
overflow: hidden;
|
|
485
|
+
`,un=c.j.getLazyComponent("Message"),gn=({widgets:e})=>{const t=(0,l.A)(),i=(0,d.GV)(r.Widget.selectors.selectFlushedWidgets,qe.shallowEqual);return(0,o.jsx)(o.Fragment,{children:e.filter(e=>!i.includes(e.widget.uniqid)).map(e=>e&&e.widget&&(0,o.jsx)(cn,{children:(0,o.jsx)(dn,{uniqid:e.widget.uniqid,widget:e,inplace:!0,mode:"edit",cannotDisplayComponent:e=>(0,o.jsx)(un,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})}),context:"comment"})},e.widget.uniqid))})},mn=c.j.getLazyComponent("Message"),pn=e=>{const t=(0,l.A)(),{widgets:i,comment:n,inplace:a,mode:s,handleWidgetUpdate:c}=e,u=(0,d.GV)(r.Widget.selectors.selectFlushedWidgets,qe.shallowEqual);return(0,o.jsx)(o.Fragment,{children:i.filter(e=>!u.includes(e.widget.uniqid)).map(e=>e&&(0,o.jsx)(cn,{children:(0,o.jsx)(dn,{uniqid:e.widget.uniqid,widgetObject:n,widget:e,inplace:a,mode:s,onWidgetUpdate:c,cannotDisplayComponent:e=>(0,o.jsx)(mn,{variant:"info",message:t.formatMessage({id:"WIDGET_Cannot_Display"},{widget:e})}),context:"comment"})},e.widget.uniqid))})},hn=()=>{const[e,t]=(0,n.useState)(!1),[i,o]=(0,n.useState)();return{open:e,onSelect:e=>{i?.execCommand("InsertHTML",!1,`<img src="${e}" alt="" />`),t(!1)},close:()=>t(!1),ext:(0,n.useMemo)(()=>s.JTinyMCEExtensionsBuilders.gifs(e=>o(e),()=>t(!0)),[]),isActive:!0}};var fn=i(3291);const xn=c.j.getLazyComponent("GifsSelector"),jn=c.j.getLazyComponent("Modal"),bn=({onSelect:e,open:t,close:i})=>{const a=(0,d.jL)(),l=(0,fn.A)(),[s,c]=(0,n.useState)(!1),[u,g]=(0,n.useState)([]),[m,p]=(0,n.useState)({q:void 0,offset:0}),h=(0,n.useCallback)(()=>{i(),p({q:void 0,offset:0})},[i]);return(0,n.useEffect)(()=>{t&&(c(!0),E.default.jamespot.getGifs({q:m.q||"awesome",limit:10,offset:m.offset},{signal:l.signal}).then(e=>{g(0===m.offset?e.result:t=>[...t,...e.result])}).catch(e=>{e.aborted||a(r.Toast.actions.error({label:e.errorMsg??"GLOBAL_Error"}))}).finally(()=>{c(!1)}))},[l,a,t,m]),(0,o.jsx)(jn,{title:"Gif",open:t,closeHandler:h,enableClickAwayCloseModal:!0,variant:"fixed-height",buttons:[{children:(0,o.jsx)(T.A,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:h}],children:(0,o.jsx)(xn,{gifs:u,onSelectGif:e,loading:s,onSearch:e=>p({q:e,offset:0}),onReachEnd:()=>{p(e=>({...e,offset:e.offset+10}))}})})},Cn=c.j.getLazyComponent("JRCCommentsBloc"),yn=a.default.div`
|
|
486
|
+
display: flex;
|
|
487
|
+
flex-direction: column;
|
|
488
|
+
gap: 4px;
|
|
489
|
+
flex: 1;
|
|
490
|
+
width: 100%;
|
|
491
|
+
margin-top: 10px;
|
|
492
|
+
`,vn=({articleId:e,variant:t="inline",canComment:i,commentType:s="comment",socialQuestion:c,articleUri:u})=>{const g=(0,l.A)(),m=(0,a.useTheme)(),p=(0,d.jL)(),[h,f]=(0,n.useState)(),[x,j]=(0,n.useState)(!1),[b,C]=(0,n.useState)([]),[y,v]=(0,n.useState)(!1),L=(0,d.GV)(r.UserCurrent.selectors.get),A=(0,d.GV)(r.Widget.selectors.selectWidgets),k=(0,d.GV)(r.TinyMCE.selectors.selectTinyMCECommonOptions),W=(0,d.GV)(r.TinyMCE.selectors.selectTinyMCEExtendedOptions),_=(0,d.GV)(r.Model.selectors.selectAll),w=(0,d.GV)(r.Platform.selectors.selectPlatformConfig),S=(0,d.GV)(t=>r.Comment.selectors.commentList(t,e)),M=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"DriveHook")),T=(0,d.GV)(e=>r.Application.selectors.selectById(e,"FileBankHook")),q=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"WidgetHook")),[D,z]=(0,n.useState)(c),[G,I]=(0,n.useState)(null),{open:V,onInsert:R,close:O,ext:$,isActive:B}=Me(),{open:H,close:F,onSelect:N,ext:U,isActive:P}=hn();(0,pe.A)(e),((e,t)=>{const i=(0,d.jL)(),o=(0,n.useMemo)(()=>he.A,[]),a=(0,n.useMemo)(()=>r.Comment.getCommentsLikeRTHandlers(i,e,t),[i,e,t]);(0,n.useEffect)(()=>(a.forEach(e=>{o.onMessage(e.namespace,e.function,e.handler)}),()=>{a.forEach(e=>{o.offMessage(e.namespace,e.function,e.handler)})}),[a,o])})(S.map(e=>e.id),e);const Y=(0,n.useCallback)(e=>{p(r.Toast.actions.error({label:e??g.formatMessage({id:"GLOBAL_Error"})}))},[p,g]),J=()=>{p(r.Comment.actions.fetchComments({idArticle:e})),Q()},Q=(0,n.useCallback)(()=>{h||y||(v(!0),E.default.network.token().then(e=>{f(e.result),v(!1),p(r.Widget.slice.actions.setToken({token:e.result}))}).catch(e=>{Y(e.errorMsg)}))},[Y,h,y,p]),X=(0,n.useCallback)(async t=>{if(h){j(!0);const i=Object.keys(A).map(e=>b?.some(t=>t.widget.uniqid===e)?A[e]:null).filter(e=>null!==e);try{await E.default.article.addComment({...t,widgets:i,token:h,idArticle:e,type:s}).then(()=>{C([])}),Q()}catch(e){throw Y(e.errorMsg),e}finally{j(!1)}}},[e,s,Q,Y,h,A,b]);return(0,n.useEffect)(()=>{Q()},[Q]),(0,n.useEffect)(()=>{p(r.Comment.actions.fetchComments({idArticle:e}))},[e,p]),(0,n.useEffect)(()=>{S&&S.forEach(e=>{e._widgets?.forEach(t=>{p(r.Widget.slice.actions.registerWidgetObject({uniqid:t.widget.uniqid,object:e})),p(r.Widget.slice.actions.registerWidgetObjectRights({uniqid:t.widget.uniqid,rights:e._right}))})})},[S,p]),(0,o.jsxs)(o.Fragment,{children:[k&&W&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(yn,{children:(0,o.jsx)(Cn,{canComment:i,loading:x,token:h,comments:S,onComment:X,onCommentUpdate:async t=>{const i=S.find(e=>e.id===t.idComment);if(i)return E.default.article.updateComment({idComment:t.idComment,description:t.description??i.description??void 0,token:t.token,widgets:t.widgets}).then(()=>{p(r.Comment.actions.fetchComments({idArticle:e})),Q()}).catch(e=>{Y(e.errorMsg)})},onCommentDelete:async t=>{p(r.Comment.actions.deleteComment({idComment:t,idArticle:e}))},isWidgetActive:!(!q?.isActive||!q?.autorize?.includes("comment")),canCreateWidget:!!(q?.isActive&&q?.create&&q?.autorize?.includes("comment")),widgetListComponent:(0,o.jsx)(_e,{mode:"comment",namespace:"comment",onChange:e=>{C([e]),p(r.Widget.slice.actions.registerWidget({uniqid:e.widget.uniqid,widget:e,context:"comment"})),f(void 0),Q()},view:"edit"}),newWidgetsWrapperComponent:(0,o.jsx)(gn,{widgets:b}),existingWidgetsWrapperComponent:(e,t,i,n=!0)=>(0,o.jsx)(pn,{comment:e,widgets:t,mode:i,inplace:n,handleWidgetUpdate:J,handleWidgetRemove:Q}),currentUser:L,tinyMCEConfig:{commonOptions:{...k,toolbar:W.commentsToolbar},mentionsQueries:(0,Te.X)(_,m,Y)},onError:Y,highlightFields:w.userHighlightFields,userAccountStatus:w.userAccountStatus,userModel:_.find(e=>"user"===e.type),onGetHashError:e=>p(r.Toast.actions.error({label:e??g.formatMessage({id:"GLOBAL_Error"})})),activeDrives:[...T&&M?["fileBank"]:[],...r.Hook.utils.buildDrivesArrayFromObject(M?.drives)],variant:t,handlers:{drive:E.default.drive,filebank:E.default.filebank,file:E.default.file,fileIntegrity:E.default.fileIntegrity,user:E.default.user,global:E.default.global,questionAnswer:E.default.questionAnswer},socialQuestion:D?{...D,onSelectResponse:e=>{z({...D,responseId:e,isResolved:!0})},onUnselectResponse:()=>{z({...D,responseId:void 0,isResolved:!1})}}:void 0,articleId:e,additionalExtensions:[$,U],onReport:t=>I({articleId:e,commentUri:t,articleUri:u})})})}),B&&(0,o.jsx)(St,{onInsert:R,open:V,close:O}),G&&(0,o.jsx)(K,{onClose:()=>I(null),...G}),P&&(0,o.jsx)(bn,{open:H,close:F,onSelect:N})]})},Ln=a.default.li`
|
|
493
|
+
list-style: none;
|
|
494
|
+
`,En=a.default.a`
|
|
495
|
+
display: flex;
|
|
496
|
+
align-items: center;
|
|
497
|
+
gap: ${({theme:e})=>e.space.sm}px;
|
|
498
|
+
text-decoration: none;
|
|
499
|
+
color: ${({theme:e})=>e.font.color};
|
|
500
|
+
padding: ${({theme:e})=>e.space.sm}px ${({theme:e})=>e.space.md}px ${({theme:e})=>e.space.sm}px
|
|
501
|
+
${({theme:e})=>e.space.xs}px;
|
|
502
|
+
border-radius: ${({theme:e})=>e.size.sm}px;
|
|
503
|
+
|
|
504
|
+
&:hover {
|
|
505
|
+
text-decoration: none;
|
|
506
|
+
background-color: ${({theme:e})=>e.color.grey1};
|
|
507
|
+
color: ${({theme:e})=>e.font.color};
|
|
508
|
+
}
|
|
509
|
+
`,An=c.j.getLazyComponent("Icon"),kn=c.j.getLazyComponent("FlexBox"),Wn=c.j.getLazyComponent("Typography"),_n=c.j.getLazyComponent("DropDown"),wn=()=>{const e=(0,a.useTheme)(),t=(0,l.A)(),i=(0,d.GV)(e=>r.Application.selectors.selectById(e,"AnimatedMeetingHook")),n=(0,d.GV)(e=>r.Application.selectors.selectById(e,"calendar")),s=(0,d.GV)(e=>r.Application.selectors.selectById(e,"SurveyDateHook"));return n?(0,o.jsxs)(kn,{y:"center",children:[(0,o.jsx)(An,{name:"icon-"+n.icon,variant:"circle",color:n.color,size:40}),(0,o.jsx)(Wn,{variant:"h1",size:"xl",weight:"medium",children:n.label}),(s||i)&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Wn,{size:"xl",color:"grey4",children:"/"}),(0,o.jsx)(_n,{withBorder:!0,borderColor:"grey3",trigger:(0,o.jsxs)(kn,{y:"center",gap:e.space.xs,children:[(0,o.jsx)(Wn,{size:"xl",color:"grey4",children:t.formatMessage({id:"CALENDAR_Agenda"})}),(0,o.jsx)(An,{name:"icon-chevron-down",color:"grey4",size:16})]}),dropdown:()=>(0,o.jsxs)(kn,{direction:"column",gap:e.space.sm,as:"ul",children:[s&&(0,o.jsx)(Ln,{children:(0,o.jsxs)(En,{href:s.url,children:[(0,o.jsx)(An,{name:"icon-"+s.icon,size:25,variant:"circle",color:s.color}),(0,o.jsx)(Wn,{size:"l",children:s.label})]})}),i&&(0,o.jsx)(Ln,{children:(0,o.jsxs)(En,{href:i.url,children:[(0,o.jsx)(An,{name:"icon-"+i.icon,size:25,variant:"circle",color:i.color}),(0,o.jsx)(Wn,{size:"l",children:i.label})]})})]})})]})]}):null},Sn=c.j.getLazyComponent("Typography"),Mn=c.j.getLazyComponent("FlexBox"),Tn=c.j.getLazyComponent("ButtonDropdown"),qn=c.j.getLazyComponent("DropDown"),Dn=c.j.getLazyComponent("IconButton"),zn=c.j.getLazyComponent("InputSelectRaw"),Gn=c.j.getLazyComponent("InputCheckboxRaw"),In=c.j.getLazyComponent("StyledHref"),Vn=(0,a.default)(Sn)`
|
|
510
|
+
text-transform: capitalize;
|
|
511
|
+
margin-right: ${({theme:e})=>e.space.md}px;
|
|
512
|
+
`,Rn=a.default.div`
|
|
513
|
+
max-width: 200px;
|
|
514
|
+
display: flex;
|
|
515
|
+
align-items: center;
|
|
516
|
+
`,On=a.default.div`
|
|
517
|
+
padding: 0 ${({theme:e})=>e.space.md}px;
|
|
518
|
+
`,$n=({label:e,view:t,viewsOptions:i,calendarApi:a,isLoading:s,navigateWithQuery:c,setView:u,setCreationType:g,setExportModalOpen:m})=>{const p=(0,l.A)(),h=(0,d.jL)(),{types:f}=(0,d.GV)(r.Calendar.selectors.selectCalendarEvents),x=(0,d.GV)(e=>r.Application.selectors.selectById(e,"AnimatedMeetingHook")),j=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"AnimatedMeetingHook")),b=(0,d.GV)(e=>r.Application.selectors.selectById(e,"MeetingHook")),C=(0,d.GV)(e=>r.Application.selectors.selectById(e,"BoardcardHook")),y=(0,n.useMemo)(()=>[{label:p.formatMessage({id:"CALENDAR_Create_SocialEvent"}),onClick:()=>{g("socialEvent")}},...b?[{label:p.formatMessage({id:"CALENDAR_Create_Meeting"}),onClick:()=>{g("meeting")}}]:[],...x&&j?.create?[{label:p.formatMessage({id:"CALENDAR_Create_AnimatedMeeting"}),href:"/?action=spotlight-edit&type=animatedMeeting"}]:[]],[x,j?.create,p,b,g]),v=(0,n.useMemo)(()=>[{label:(0,o.jsx)(T.A,{id:"CALENDAR_SocialEvents"}),value:"socialEvent"},...b?[{label:(0,o.jsx)(T.A,{id:"CALENDAR_Meetings"}),value:"meeting"}]:[],...x?[{label:(0,o.jsx)(T.A,{id:"CALENDAR_AnimatedMeetings"}),value:"animatedMeeting"}]:[],...C?[{label:(0,o.jsx)(T.A,{id:"CALENDAR_BoardCards"}),value:"boardCard"}]:[]],[x,C,b]);return(0,o.jsxs)(Mn,{y:"center",children:[(0,o.jsx)(Vn,{size:"l",weight:"medium",children:e}),(0,o.jsxs)(Mn,{children:[(0,o.jsx)(Dn,{icon:"icon-chevron-left",onClick:()=>a?.prev(),color:"grey5"}),(0,o.jsx)(Dn,{icon:"icon-chevron-right",onClick:()=>a?.next(),color:"grey5"})]}),(0,o.jsx)(Dn,{icon:"icon-calendar",onClick:()=>a?.today(),tooltip:{description:"CALENDAR_Today",position:"bottom"},color:"grey5"}),(0,o.jsx)(Rn,{children:(0,o.jsx)(zn,{onChange:u,value:t,name:"selectView",options:i,getLabel:e=>e.label,getValue:e=>e.value,required:!0,minWidth:!1,loading:s,noMargin:!0})}),(0,o.jsx)(Tn,{noMargin:!0,color:"primary",icon:"icon-plus",label:p.formatMessage({id:"GLOBAL_Add"}),options:y,dataCy:"calendar-create-dropdown"}),(0,o.jsx)(qn,{trigger:(0,o.jsx)(Dn,{"aria-label":p.formatMessage({id:"GLOBAL_Filter"}),colorVariant:"light",icon:"icon-filter",badgeNumber:f.length}),dropdown:()=>(0,o.jsx)(n.Suspense,{fallback:(0,o.jsx)(o.Fragment,{}),children:(0,o.jsx)(On,{children:(0,o.jsxs)(Mn,{direction:"column",children:[(0,o.jsx)(Sn,{weight:"medium",color:"primary",children:p.formatMessage({id:"GLOBAL_Filter"})}),(0,o.jsx)(Gn,{labelPosition:"before",checkboxMode:"checkbox",direction:"column",onChange:e=>{h(r.Calendar.actions.setTypes(e)),c({types:e})},options:v,value:f,name:"0"}),(0,o.jsx)(In,{onClick:()=>{h(r.Calendar.actions.setTypes([])),c({types:[]})},as:"button",color:"cancel",disabled:0===f.length,children:p.formatMessage({id:"GLOBAL_Reset"})})]})})}),withBorder:!0,align:"right"}),(0,o.jsx)(Tn,{noMargin:!0,small:!0,smallOpenDirection:"left",color:"primary",variant:"outlined",icon:"icon-ellipsis-v",label:p.formatMessage({id:"GLOBAL_Options"}),options:[{label:p.formatMessage({id:"EVENT_Export_Calendar_ICalendar_Format"}),onClick:()=>m(!0)}]})]})};var Bn=i(3520),Hn=i(6225),Fn=i(9622);const Nn=()=>{const[e,t]=(0,n.useState)(),i=(0,l.A)(),o=(0,n.useMemo)(()=>J.hooks?.MagicWandHook?.isActive&&J.hooks?.MagicWandHook?.menuItems&&J.hooks.MagicWandHook.menuItems.length,[]),a=(0,n.useCallback)(e=>{t({...e,reject:i=>{e.reject(i),t(void 0)},resolve:i=>{e.resolve(i),t(void 0)}})},[]),r=(0,n.useCallback)((e,t)=>new Promise((i,o)=>{a({reject:o,resolve:i,text:e,capability:t})}),[a]),d=(0,n.useMemo)(()=>({develop:e=>r(e,"develop"),summarize:e=>r(e,"summarize"),tldr:e=>r(e,"tldr"),en:e=>r(e,"en"),es:e=>r(e,"es"),formal:e=>r(e,"formal"),funny:e=>r(e,"funny")}),[r]);return{query:e,ext:(0,n.useMemo)(()=>s.JTinyMCEExtensionsBuilders.jia(d,i),[i,d]),isActive:o}},Un=c.j.getLazyComponent("InputTinyMCE"),Pn=e=>{const t=(0,l.A)(),i=(0,d.jL)(),s=(0,a.useTheme)(),c=(0,d.GV)(r.Model.selectors.selectAll),{query:u,ext:g,isActive:m}=Nn(),{open:p,onInsert:h,close:f,ext:x,isActive:j}=Me(),{close:b,open:C,isActive:y,onSelect:v,ext:L}=hn(),E=(0,n.useMemo)(()=>[...j?[x]:[],...m?[g]:[],...y?[L]:[]],[g,x,L,m,y,j]),A=(0,n.useCallback)(e=>{i(r.Toast.actions.error({label:e??t.formatMessage({id:"GLOBAL_Error"})}))},[i,t]),k=(0,n.useMemo)(()=>(0,Te.X)(c,s,A),[c,A,s]),W=(0,n.useMemo)(()=>Fn.p9,[]);return(0,o.jsxs)(o.Fragment,{children:[W&&(0,o.jsx)(Un,{commonOptions:W,additionalExtensions:E,mentionsQueries:k,...e}),m&&(0,o.jsx)(M,{query:u}),j&&(0,o.jsx)(St,{onInsert:h,open:p,close:f}),y&&(0,o.jsx)(bn,{onSelect:v,open:C,close:b})]})},Yn=c.j.getLazyComponent("InputImage"),Jn=c.j.getLazyComponent("InputText"),Qn=c.j.getLazyComponent("InputCheckbox"),Xn=c.j.getLazyComponent("InputCheckboxRaw"),Kn=c.j.getLazyComponent("InputNumber"),Zn=c.j.getLazyComponent("InputAudience"),ea=c.j.getLazyComponent("InputFileAdvancedRaw"),ta=c.j.getLazyComponent("Typography"),ia=c.j.getLazyComponent("InputColor"),oa=c.j.getLazyComponent("InputDateTime"),na=c.j.getLazyComponent("InputDateTimeRaw"),aa=c.j.getLazyComponent("FlexBox"),la=c.j.getLazyComponent("InputAutocomplete"),sa=c.j.getLazyComponent("InputSelectRaw"),ra=c.j.getLazyComponent("InputSelect"),da=c.j.getLazyComponent("Message"),ca=c.j.getLazyComponent("Icon"),ua=c.j.getLazyComponent("Tooltip"),ga=a.default.div`
|
|
519
|
+
margin-top: -${({theme:e})=>e.space.sm}px;
|
|
520
|
+
margin-bottom: -${({theme:e})=>e.space.l}px;
|
|
521
|
+
`,ma=a.default.div`
|
|
522
|
+
${({$show:e})=>!e&&"\n position: absolute;\n visibility: hidden;\n pointer-events: none;\n height: 0;\n overflow: hidden;\n opacity: 0;\n "}
|
|
523
|
+
`,pa=a.default.div`
|
|
524
|
+
display: flex;
|
|
525
|
+
gap: ${({theme:e})=>e.space.xs}px;
|
|
526
|
+
padding: ${({theme:e})=>e.space.sm}px ${({theme:e})=>e.space.md}px;
|
|
527
|
+
border-radius: ${({theme:e})=>e.space.sm}px;
|
|
528
|
+
border: 1px solid ${({theme:e})=>e.color.grey2};
|
|
529
|
+
background-color: ${({theme:e})=>e.color.grey0};
|
|
530
|
+
align-items: center;
|
|
531
|
+
`,ha=({form:e,setUploadLoading:t,extraInitialValues:i,mode:s})=>{const c=(0,l.A)(),u=(0,d.jL)(),g=(0,a.useTheme)(),m=(0,n.useRef)(null),[p,h]=(0,n.useState)(!1),[f,x]=(0,n.useState)(i?.eventMode??"onSpot"),[j,b]=(0,n.useState)(i?.customColors??!1),[C,y]=(0,n.useState)(),[v,L]=(0,n.useState)(),A=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"calendarHook")),k=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"FileBankHook")),W=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"SpotHook")),_=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"BusinessContactHook")),w=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"DriveHook")),S=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"VisioConnectHook")),M=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"BigBlueButtonHook")),T=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"SharedContentHook")),D=(0,d.GV)(r.Model.selectors.selectAll),[z,G]=(0,n.useState)(i?.until);m.current?.watch(t=>{Object.keys(t).forEach(i=>{e.setValue(i,t[i])})});const I=(0,q.useWatch)({control:e.control,name:"sendAlert"});(0,n.useEffect)(()=>{I||e.setValue("alertAuthor",!1)},[e,I]);const V=(0,q.useWatch)({control:e.control,name:"dateStart"}),R=(0,q.useWatch)({control:e.control,name:"dateEnd"}),$=(0,n.useMemo)(()=>V&&R&&(0,Bn.d)(new Date(V),new Date(R)),[V,R]),B=(0,n.useMemo)(()=>[{label:c.formatMessage({id:"CALENDAR_On_Spot"}),value:"onSpot"},{label:c.formatMessage({id:"CALENDAR_Visio"}),value:"visio"},{label:c.formatMessage({id:"CALENDAR_Hybrid"}),value:"hybrid"}],[c]),H=(0,n.useMemo)(()=>{const e=[];return W&&W.isActive&&W.hasLicense&&e.push("group"),e.push("user"),k&&k.isActive&&e.push("folder"),_&&_.isActive&&e.push("businessContact"),e},[_,k,W]),F=(0,n.useCallback)(e=>u(r.Toast.actions.error({label:e??c.formatMessage({id:"GLOBAL_Error"})})),[u,c]),N=(0,q.useWatch)({control:e.control,name:"token"}),U=(0,n.useCallback)(async e=>{if(N)try{await E.default.file.deleteFile(e,"attachment",N)}catch(e){F&&F(e)}},[F,N]),P=(0,n.useMemo)(()=>[{value:"jitsi",label:c.formatMessage({id:"CALENDAR_Visio_Jitsi"})},...S&&S.isActive&&S.hasLicense?[{value:"visioConnect",label:c.formatMessage({id:"CALENDAR_Visio_VisioConnect"})}]:[],...M&&M.isActive&&M.hasLicense?[{value:"bbb",label:c.formatMessage({id:"CALENDAR_Visio_BBB"})},...T&&T.isActive?[{value:"bbb-public",label:c.formatMessage({id:"CALENDAR_Visio_BBB_Public"})}]:[]]:[],{value:"other",label:c.formatMessage({id:"CALENDAR_Visio_Other"})}],[M,c,T,S]),[Y,Q]=(0,n.useState)(P[P.length-1]),X=(0,n.useCallback)(t=>{switch(Q(t),t.value){case"jitsi":e.setValue("place","jitsi:"+J.urlBase+"?action=jitsiRedirect&id="+(0,Z.A)());break;case"visioConnect":e.setValue("place","visioConnect");break;case"other":e.setValue("place","");break;case"bbb":e.setValue("place","bbb");break;case"bbb-public":e.setValue("place","bbb-public")}},[e]),K=(0,q.useWatch)({control:e.control,name:"place"}),ee=(0,q.useWatch)({control:e.control,name:"address"}),te=(0,n.useCallback)(t=>x(i=>(h(!0),"visio"!==i&&"hybrid"!==i||y(K),"onSpot"!==i&&"hybrid"!==i||L(ee),"onSpot"===t?(e.setValue("place",null),"hybrid"!==i&&e.setValue("address",v)):"visio"===t?(e.setValue("address",null),"hybrid"!==i&&e.setValue("place",C)):"hybrid"===t&&("onSpot"!==i&&e.setValue("address",v),"visio"!==i&&e.setValue("place",C)),t)),[ee,e,K,v,C]),ie=(0,q.useWatch)({control:e.control,name:"recurrenceRule"});(0,n.useEffect)(()=>{ie&&(0,Hn.qY)(ie)&&ie.until!==z&&e.setValue("recurrenceRule",{...ie,until:z||void 0})},[e,ie,z]);const oe=(0,n.useMemo)(()=>(0,Hn.qY)(ie),[ie]),ne=(0,q.useWatch)({control:e.control,name:"allDay"}),ae=(0,q.useWatch)({control:e.control,name:"textColor"}),le=(0,q.useWatch)({control:e.control,name:"bgColor"}),se=(0,q.useWatch)({control:e.control,name:"socialEventUseCeiling"});return(0,o.jsxs)(aa,{direction:"column",gap:g.space.l,children:[(0,o.jsx)(ma,{$show:"update"===s&&!!oe,children:(0,o.jsx)(da,{variant:"warning",message:c.formatMessage({id:"CALENDAR_Recurrent_Event_Warning"})})}),(0,o.jsx)(Yn,{margin:"0",name:"image",dzDimensions:{width:"100%",height:275},control:e.control,token:N,aspectRatio:2,allowCustomRatio:!0,defaultImages:{imgs:[],columnCount:1}}),(0,o.jsx)(Jn,{margin:"0",label:c.formatMessage({id:"GLOBAL_Title"}),name:"title",control:e.control,rules:{required:!0}}),(0,o.jsxs)(aa,{direction:"column",gap:g.space.sm,children:[$&&(0,o.jsx)(da,{message:c.formatMessage({id:"CALENDAR_Date_Start_After_Date_End"}),variant:"error"}),(0,o.jsxs)(aa,{gap:g.space.md,y:"center",children:[(0,o.jsx)(oa,{mode:ne?"date":"datetime",margin:"0",width:"100%",label:"CALENDAR_DateTime_Start",control:e.control,name:"dateStart",rules:{required:!0},openDirection:"left"}),(0,o.jsx)(oa,{mode:ne?"date":"datetime",margin:"0",width:"100%",label:"CALENDAR_DateTime_End",control:e.control,name:"dateEnd",rules:{required:!0}})]}),(0,o.jsx)(Qn,{control:e.control,margin:"0",name:"allDay",checkboxMode:"checkbox",valueTypeIsBoolean:!0,options:[{label:c.formatMessage({id:"CALENDAR_All_Day"}),value:"YES"}]})]}),"create"===s&&A?.recurringEventsEnabled&&(0,o.jsx)(ra,{noMargin:!0,label:c.formatMessage({id:"CALENDAR_Event_Recurrence"}),name:"recurrenceRule",control:e.control,options:Hn.lK,rules:{required:!0},isCurrentOption:Hn.S1}),"update"===s&&oe&&(0,o.jsxs)(aa,{gap:g.space.sm,direction:"column",children:[(0,o.jsx)(ta,{children:c.formatMessage({id:"CALENDAR_Event_Recurrence"})}),(0,o.jsxs)(pa,{children:[(0,o.jsx)(ca,{name:"icon-refresh",color:"grey5"}),(0,o.jsx)(ta,{children:c.formatMessage({id:(0,Hn.C6)(ie)})}),(0,o.jsx)(ua,{description:c.formatMessage({id:"CALENDAR_Update_Recurrence_Info"}),children:(0,o.jsx)(ca,{name:"icon-question-circle-o",color:"grey3"})})]})]}),(0,o.jsx)(ma,{$show:!!oe,children:(0,o.jsxs)(aa,{direction:"column",children:[(0,o.jsx)(ta,{children:c.formatMessage({id:"CALENDAR_Event_Recurrence_UntilField"})}),(0,o.jsx)(na,{mode:"date",width:"100%",value:z,onChange:e=>G(e||void 0)})]})}),(0,o.jsxs)(aa,{direction:"column",gap:g.space.md,children:["update"===s&&p&&!ie&&(0,o.jsx)(da,{variant:"info",message:c.formatMessage({id:"Event_Warning_Message"})}),(0,o.jsx)(ma,{$show:!oe,children:(0,o.jsx)(Xn,{margin:"0",checkboxMode:"radio",direction:"row",value:f,name:"value",onChange:te,options:B})}),(0,o.jsx)(ma,{$show:"onSpot"===f||"hybrid"===f||!!oe,children:(0,o.jsx)(Jn,{margin:"0",label:c.formatMessage({id:"CALENDAR_Event_Address"}),name:"address",control:e.control})}),(0,o.jsx)(ma,{$show:("visio"===f||"hybrid"===f)&&!oe,children:(0,o.jsxs)(aa,{direction:"column",children:[(0,o.jsx)(ta,{children:c.formatMessage({id:"CALENDAR_Event_Place"})}),(0,o.jsxs)(aa,{gap:g.space.md,y:"flex-end",children:[(0,o.jsx)(aa,{flex:"1",margin:"0 0 4px 0",children:(0,o.jsx)(sa,{noMargin:!0,name:"visio",onChange:X,options:P,value:Y,required:!0,getLabel:e=>e.label,getValue:e=>e.value})}),("other"===Y.value||"jitsi"===Y.value)&&(0,o.jsx)(aa,{flex:"2",children:(0,o.jsx)(Jn,{width:"100%",margin:"0",name:"place",control:e.control,disabled:"jitsi"===Y.value})})]})]})}),(0,o.jsx)(ma,{$show:!!A?.externalGestion&&!oe,children:(0,o.jsx)(Jn,{margin:"0",label:c.formatMessage({id:"CALENDAR_External_Link"}),description:c.formatMessage({id:"CALENDAR_External_Link_Description"}),name:"urlGestion",control:e.control})}),(0,o.jsx)(Pn,{margin:"0",label:c.formatMessage({id:"GLOBAL_Description"}),control:e.control,name:"description",token:N,handlers:{file:E.default.file}}),(0,o.jsx)(ga,{children:(0,o.jsx)(O,{type:"socialEvent",fields:[{includes:"tags"}],ref:m,defaultValues:i?.tags})}),(0,o.jsx)(ma,{$show:!oe,children:(0,o.jsx)(la,{noMargin:!0,control:e.control,name:"uiObjectLink",label:c.formatMessage({id:"GLOBAL_Object_Link"}),searchable:!0,asyncPromise:e=>E.default.article.list({query:e,filters:[{name:"type",value:"internalDraft",operator:"<>"}]}).then(e=>e?.result?.data.map(e=>{const t=D.find(t=>t.type===e.type);return{uri:e.uri,title:e.title,icon:t?.icon,color:t?.color}}))})}),(0,o.jsxs)(aa,{direction:"column",gap:g.space.md,children:[(0,o.jsx)(Xn,{margin:"0",onChange:t=>{t?(e.setValue("textColor",g.color.grey5),e.setValue("bgColor",g.color.grey1)):(e.setValue("textColor",null),e.setValue("bgColor",null)),b(t)},value:j,name:"",checkboxMode:"checkbox",valueTypeIsBoolean:!0,options:[{label:c.formatMessage({id:"CALENDAR_Custom_Colors"}),value:"YES"}]}),(0,o.jsxs)(ma,{$show:j,children:[(0,o.jsx)(ma,{$show:!oe,children:(0,o.jsx)(ia,{margin:"0",control:e.control,name:"textColor",label:"CALENDAR_Text_Color",initialValue:ae??g.color.grey5})}),(0,o.jsx)(ia,{margin:"0",control:e.control,name:"bgColor",label:"CALENDAR_Background_Color",initialValue:le??g.color.grey1})]})]}),(0,o.jsx)(ma,{$show:!oe,children:(0,o.jsxs)(aa,{direction:"column",gap:g.space.sm,children:[(0,o.jsx)(Qn,{margin:"0",control:e.control,name:"socialEventUseCeiling",checkboxMode:"checkbox",valueTypeIsBoolean:!0,options:[{label:c.formatMessage({id:"CALENDAR_Subscribers_Limit"}),value:"YES"}]}),(0,o.jsx)(ma,{$show:!!se,children:(0,o.jsx)(Kn,{margin:"0",control:e.control,name:"socialEventCeiling"})})]})}),(0,o.jsx)(Zn,{margin:"0",label:c.formatMessage({id:"GLOBAL_Audience"}),control:e.control,name:"publishTo",searchable:!0,multiple:!0,views:{activeViews:H,handlers:{user:E.default.user,filebank:E.default.filebank,group:E.default.group},onError:F}}),(0,o.jsx)(ta,{children:c.formatMessage({id:"GLOBAL_Attachments"})}),(0,o.jsx)(ea,{token:N,multiple:!0,name:"attachment",deleteFile:U,activeDrives:[...k&&w?["fileBank"]:[],...r.Hook.utils.buildDrivesArrayFromObject(w?.drives)],handlers:{file:E.default.file,filebank:E.default.filebank,drive:E.default.drive},dispatchOnError:F,onUploadStart:()=>t(!0),onUploadSuccess:()=>t(!1),existingFiles:i?.attachments??[]}),(0,o.jsx)(ma,{$show:!oe||"create"===s,children:(0,o.jsx)(ta,{children:c.formatMessage({id:"CALENDAR_More_Options"})})}),(0,o.jsxs)("div",{children:[(0,o.jsx)(ma,{$show:!oe,children:(0,o.jsx)(Qn,{margin:"0",control:e.control,name:"noGestion",checkboxMode:"checkbox",valueTypeIsBoolean:!0,inverted:!0,options:[{label:c.formatMessage({id:"CALENDAR_Activate_Subscription"}),value:"YES"}]})}),(0,o.jsx)(ma,{$show:!oe,children:(0,o.jsx)(Qn,{margin:"0",control:e.control,name:"hideFromCalendar",checkboxMode:"checkbox",valueTypeIsBoolean:!0,inverted:!0,options:[{label:c.formatMessage({id:"CALENDAR_Calendar_Display"}),value:"YES"}]})}),(0,o.jsx)(ma,{$show:!oe,children:(0,o.jsx)(Qn,{margin:"0",control:e.control,name:"useQrcode",checkboxMode:"checkbox",valueTypeIsBoolean:!0,options:[{label:c.formatMessage({id:"CALENDAR_Use_QR_Code"}),value:"YES"}]})}),"create"===s&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Qn,{margin:"0",control:e.control,name:"sendAlert",checkboxMode:"checkbox",valueTypeIsBoolean:!0,options:[{label:c.formatMessage({id:"GLOBAL_Send_Alert"}),value:"YES"}]}),(0,o.jsx)(Qn,{margin:"0",control:e.control,name:"alertAuthor",checkboxMode:"checkbox",valueTypeIsBoolean:!0,options:[{label:c.formatMessage({id:"GLOBAL_Alert_Author"}),value:"YES"}],disabled:!I})]})]})]})]})},fa=c.j.getLazyComponent("ModalForm"),xa=({closeHandler:e,onSubmit:t,children:i,form:n,uploadLoading:a,type:s,loading:r,articleId:d})=>{const c=(0,l.A)();return(0,o.jsx)(fa,{onSubmit:t,loading:r,open:!!d,closeHandler:e,buttons:[{color:"cancel",children:c.formatMessage({id:"GLOBAL_Cancel"}),clickHandler:e},{color:"valid",isSubmit:!0,loading:r,disabled:!n.formState.isValid||r||a,children:c.formatMessage({id:"GLOBAL_Save"})}],extraTopButtons:d?[{icon:"icon-expand",href:`/?action=article-edit&IdArticle=${d}`}]:[],title:c.formatMessage({id:"socialEvent"===s?"CALENDAR_Update_SocialEvent_Title":"meeting"===s?"CALENDAR_Update_Meeting_Title":"CALENDAR_Update_RecurringEvent_Title"}),children:i})};var ja=i(5309);const ba=c.j.getLazyComponent("Typography"),Ca=c.j.getLazyComponent("Modal"),ya=({closeHandler:e,onUpdate:t,event:i})=>{const a=(0,l.A)(),[s,r]=(0,n.useState)(!1),{setUploadLoading:d,isValid:c,loading:u,uploadLoading:g,initialLoading:m,submit:p,extraInitialValues:h,form:f}=(0,ja.l)({event:i,onUpdate:t});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(xa,{articleId:i?.id,type:"socialEvent",closeHandler:e,onSubmit:f.handleSubmit(p),form:f,loading:u,isValid:c,uploadLoading:g,children:m?null:(0,o.jsx)(ha,{mode:"update",form:f,setUploadLoading:d,extraInitialValues:h})}),(0,o.jsx)(Ca,{open:s,closeHandler:()=>r(!1),title:a.formatMessage({id:"GLOBAL_Save"}),buttons:[{color:"cancel",clickHandler:()=>r(!1),children:a.formatMessage({id:"GLOBAL_Cancel"})},{color:"danger",clickHandler:f.handleSubmit(p),loading:u,children:a.formatMessage({id:"GLOBAL_Save"}),dataCy:"delete-continue"}],children:(0,o.jsx)(ba,{children:a.formatMessage({id:"CALENDAR_Update_Confirmation_Recurrent"})})})]})},va=c.j.getLazyComponent("InputImage"),La=c.j.getLazyComponent("InputText"),Ea=c.j.getLazyComponent("InputCheckbox"),Aa=c.j.getLazyComponent("InputCheckboxRaw"),ka=c.j.getLazyComponent("InputAudience"),Wa=c.j.getLazyComponent("InputFileAdvancedRaw"),_a=c.j.getLazyComponent("Typography"),wa=c.j.getLazyComponent("InputColor"),Sa=c.j.getLazyComponent("InputDateTime"),Ma=c.j.getLazyComponent("FlexBox"),Ta=c.j.getLazyComponent("InputAutocomplete"),qa=c.j.getLazyComponent("InputSelectRaw"),Da=c.j.getLazyComponent("Collapse"),za=c.j.getLazyComponent("Message"),Ga=a.default.div`
|
|
532
|
+
margin-top: -${({theme:e})=>e.space.sm}px;
|
|
533
|
+
margin-bottom: -${({theme:e})=>e.space.l}px;
|
|
534
|
+
`,Ia=a.default.div`
|
|
535
|
+
padding: ${({theme:e})=>e.space.md}px;
|
|
536
|
+
background-color: ${({theme:e})=>e.color.grey0};
|
|
537
|
+
border-radius: ${({theme:e})=>e.size.sm}px;
|
|
538
|
+
border: 1px solid ${({theme:e})=>e.color.grey1};
|
|
539
|
+
`,Va=a.default.div`
|
|
540
|
+
display: ${({$show:e})=>e?"block":"none"};
|
|
541
|
+
`,Ra=({form:e,setUploadLoading:t,extraInitialValues:i,mode:s})=>{const c=(0,l.A)(),u=(0,d.jL)(),g=(0,a.useTheme)(),m=(0,n.useRef)(null),[p,h]=(0,n.useState)(!1),[f,x]=(0,n.useState)(i?.eventMode??"onSpot"),[j,b]=(0,n.useState)(i?.customColors??!1),[C,y]=(0,n.useState)(),[v,L]=(0,n.useState)(),A=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"calendarHook")),k=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"FileBankHook")),W=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"SpotHook")),_=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"BusinessContactHook")),w=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"DriveHook")),S=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"VisioConnectHook")),M=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"BigBlueButtonHook")),T=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"SharedContentHook")),D=(0,d.GV)(r.Model.selectors.selectAll);m.current?.watch(t=>{Object.keys(t).forEach(i=>{e.setValue(i,t[i])})});const z=(0,q.useWatch)({control:e.control,name:"sendAlert"});(0,n.useEffect)(()=>{z||e.setValue("alertAuthor",!1)},[e,z]);const G=(0,q.useWatch)({control:e.control,name:"dateStart"}),I=(0,q.useWatch)({control:e.control,name:"dateEnd"}),V=(0,n.useMemo)(()=>G&&I&&(0,Bn.d)(new Date(G),new Date(I)),[G,I]),R=(0,n.useMemo)(()=>[{label:c.formatMessage({id:"CALENDAR_On_Spot"}),value:"onSpot"},{label:c.formatMessage({id:"CALENDAR_Visio"}),value:"visio"},{label:c.formatMessage({id:"CALENDAR_Hybrid"}),value:"hybrid"}],[c]),$=(0,n.useMemo)(()=>{const e=[];return W&&W.isActive&&W.hasLicense&&e.push("group"),e.push("user"),k&&k.isActive&&e.push("folder"),_&&_.isActive&&e.push("businessContact"),e},[_,k,W]),B=(0,n.useCallback)(e=>u(r.Toast.actions.error({label:e??c.formatMessage({id:"GLOBAL_Error"})})),[u,c]),H=(0,n.useCallback)(async t=>{const i=e.watch("token");if(i)try{await E.default.file.deleteFile(t,"attachment",i)}catch(e){B&&B(e)}},[e,B]),F=(0,n.useMemo)(()=>[{value:"jitsi",label:c.formatMessage({id:"CALENDAR_Visio_Jitsi"})},...S&&S.isActive&&S.hasLicense?[{value:"visioConnect",label:c.formatMessage({id:"CALENDAR_Visio_VisioConnect"})}]:[],...M&&M.isActive&&M.hasLicense?[{value:"bbb",label:c.formatMessage({id:"CALENDAR_Visio_BBB"})},...T&&T.isActive?[{value:"bbb-public",label:c.formatMessage({id:"CALENDAR_Visio_BBB_Public"})}]:[]]:[],{value:"other",label:c.formatMessage({id:"CALENDAR_Visio_Other"})}],[M,c,T,S]),[N,U]=(0,n.useState)(F[F.length-1]),P=(0,n.useCallback)(t=>{switch(U(t),t.value){case"jitsi":e.setValue("place","jitsi:"+J.urlBase+"?action=jitsiRedirect&id="+(0,Z.A)());break;case"visioConnect":e.setValue("place","visioConnect");break;case"other":e.setValue("place","");break;case"bbb":e.setValue("place","bbb");break;case"bbb-public":e.setValue("place","bbb-public")}},[e]),Y=(0,q.useWatch)({control:e.control,name:"place"}),Q=(0,q.useWatch)({control:e.control,name:"address"}),X=(0,n.useCallback)(t=>x(i=>(h(!0),"visio"!==i&&"hybrid"!==i||y(Y),"onSpot"!==i&&"hybrid"!==i||L(Q),"onSpot"===t?(e.setValue("place",null),"hybrid"!==i&&e.setValue("address",v)):"visio"===t?(e.setValue("address",null),"hybrid"!==i&&e.setValue("place",C)):"hybrid"===t&&("onSpot"!==i&&e.setValue("address",v),"visio"!==i&&e.setValue("place",C)),t)),[Q,e,Y,v,C]);return(0,o.jsxs)(Ma,{direction:"column",gap:g.space.l,children:[(0,o.jsx)(va,{margin:"0",name:"image",dzDimensions:{width:"100%",height:275},control:e.control,token:e.watch("token"),aspectRatio:2,allowCustomRatio:!0,defaultImages:{imgs:[],columnCount:1}}),(0,o.jsx)(La,{margin:"0",label:c.formatMessage({id:"GLOBAL_Title"}),name:"title",control:e.control,rules:{required:!0}}),(0,o.jsxs)(Ma,{direction:"column",gap:g.space.sm,children:[V&&(0,o.jsx)(za,{message:c.formatMessage({id:"CALENDAR_Date_Start_After_Date_End"}),variant:"error"}),(0,o.jsxs)(Ma,{gap:g.space.md,y:"center",children:[(0,o.jsx)(Sa,{mode:e.watch("allDay")?"date":"datetime",margin:"0",width:"100%",label:"CALENDAR_DateTime_Start",control:e.control,name:"dateStart",rules:{required:!0},openDirection:"left"}),(0,o.jsx)(Sa,{mode:e.watch("allDay")?"date":"datetime",margin:"0",width:"100%",label:"CALENDAR_DateTime_End",control:e.control,name:"dateEnd",rules:{required:!0}})]}),(0,o.jsx)(Ea,{control:e.control,margin:"0",name:"allDay",checkboxMode:"checkbox",valueTypeIsBoolean:!0,options:[{label:c.formatMessage({id:"CALENDAR_All_Day"}),value:"YES"}]})]}),(0,o.jsxs)(Ma,{direction:"column",gap:g.space.md,children:[(0,o.jsx)(Va,{$show:"update"===s&&p,children:(0,o.jsx)(za,{variant:"info",message:c.formatMessage({id:"Event_Warning_Message"})})}),(0,o.jsx)(Aa,{margin:"0",checkboxMode:"radio",direction:"row",value:f,name:"value",onChange:X,options:R}),("onSpot"===f||"hybrid"===f)&&(0,o.jsx)(La,{margin:"0",label:c.formatMessage({id:"CALENDAR_Event_Address"}),name:"address",control:e.control}),("visio"===f||"hybrid"===f)&&(0,o.jsxs)(Ma,{direction:"column",children:[(0,o.jsx)(_a,{children:c.formatMessage({id:"CALENDAR_Event_Place"})}),(0,o.jsxs)(Ma,{gap:g.space.md,y:"flex-end",children:[(0,o.jsx)(Ma,{flex:"1",margin:"0 0 4px 0",children:(0,o.jsx)(qa,{noMargin:!0,name:"visio",onChange:P,options:F,value:N,required:!0,getLabel:e=>e.label,getValue:e=>e.value})}),("other"===N.value||"jitsi"===N.value)&&(0,o.jsx)(Ma,{flex:"2",children:(0,o.jsx)(La,{width:"100%",margin:"0",name:"place",control:e.control,disabled:"jitsi"===N.value})})]})]}),A?.externalGestion&&(0,o.jsx)(La,{margin:"0",label:c.formatMessage({id:"CALENDAR_External_Link"}),description:c.formatMessage({id:"CALENDAR_External_Link_Description"}),name:"urlGestion",control:e.control}),(0,o.jsx)(Pn,{margin:"0",label:c.formatMessage({id:"GLOBAL_Description"}),control:e.control,name:"agenda",handlers:{file:E.default.file}}),(0,o.jsx)(Ga,{children:(0,o.jsx)(O,{type:"meeting",fields:[{includes:"tags"}],ref:m,defaultValues:i?.tags})}),(0,o.jsx)(Ta,{noMargin:!0,control:e.control,name:"uiObjectLink",label:c.formatMessage({id:"GLOBAL_Object_Link"}),searchable:!0,asyncPromise:e=>E.default.article.list({query:e,filters:[{name:"type",value:"internalDraft",operator:"<>"}]}).then(e=>e?.result?.data.map(e=>{const t=D.find(t=>t.type===e.type);return{uri:e.uri,title:e.title,icon:t?.icon,color:t?.color}}))}),(0,o.jsxs)(Ma,{direction:"column",gap:g.space.md,children:[(0,o.jsx)(Aa,{margin:"0",onChange:t=>{t?(e.setValue("textColor",g.color.grey5),e.setValue("bgColor",g.color.grey1)):(e.setValue("textColor",null),e.setValue("bgColor",null)),b(t)},value:j,name:"",checkboxMode:"checkbox",valueTypeIsBoolean:!0,options:[{label:c.formatMessage({id:"CALENDAR_Custom_Colors"}),value:"YES"}]}),(0,o.jsxs)(Va,{$show:j,children:[(0,o.jsx)(wa,{margin:"0",control:e.control,name:"textColor",label:"CALENDAR_Text_Color",initialValue:e.watch("textColor")??g.color.grey5}),(0,o.jsx)(wa,{margin:"0",control:e.control,name:"bgColor",label:"CALENDAR_Background_Color",initialValue:e.watch("bgColor")??g.color.grey1})]})]}),(0,o.jsx)(ka,{margin:"0",label:c.formatMessage({id:"GLOBAL_Audience"}),control:e.control,name:"publishTo",searchable:!0,multiple:!0,views:{activeViews:$,handlers:{user:E.default.user,filebank:E.default.filebank,group:E.default.group},onError:B}}),(0,o.jsx)(_a,{children:c.formatMessage({id:"GLOBAL_Attachments"})}),(0,o.jsx)(Wa,{token:e.watch("token"),multiple:!0,name:"attachment",deleteFile:H,activeDrives:[...k&&w?["fileBank"]:[],...r.Hook.utils.buildDrivesArrayFromObject(w?.drives)],handlers:{file:E.default.file,filebank:E.default.filebank,drive:E.default.drive},dispatchOnError:B,onUploadStart:()=>t(!0),onUploadSuccess:()=>t(!1),existingFiles:i?.attachments??[]}),(0,o.jsx)(Ia,{children:(0,o.jsx)(Da,{openByDefault:"update"===s,header:(0,o.jsx)(_a,{children:c.formatMessage({id:"CALENDAR_Report"})}),content:(0,o.jsxs)(Ma,{direction:"column",gap:g.space.l,children:[(0,o.jsx)(Pn,{margin:"0",control:e.control,name:"report",handlers:{file:E.default.file}}),(0,o.jsx)(_a,{children:c.formatMessage({id:"CALENDAR_Report_File"})}),(0,o.jsx)(Wa,{token:e.watch("token"),multiple:!0,name:"reportFile",deleteFile:H,activeDrives:[...k&&w?["fileBank"]:[],...r.Hook.utils.buildDrivesArrayFromObject(w?.drives)],handlers:{file:E.default.file,filebank:E.default.filebank,drive:E.default.drive},dispatchOnError:B,onUploadStart:()=>t(!0),onUploadSuccess:()=>t(!1),existingFiles:i?.reportFile?[i.reportFile]:[]})]})})}),(0,o.jsx)(_a,{children:c.formatMessage({id:"CALENDAR_More_Options"})}),(0,o.jsxs)("div",{children:[(0,o.jsx)(Ea,{margin:"0",control:e.control,name:"noGestion",checkboxMode:"checkbox",valueTypeIsBoolean:!0,inverted:!0,options:[{label:c.formatMessage({id:"CALENDAR_Activate_Subscription"}),value:"YES"}]}),"create"===s&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Ea,{margin:"0",control:e.control,name:"sendAlert",checkboxMode:"checkbox",valueTypeIsBoolean:!0,options:[{label:c.formatMessage({id:"GLOBAL_Send_Alert"}),value:"YES"}]}),(0,o.jsx)(Ea,{margin:"0",control:e.control,name:"alertAuthor",checkboxMode:"checkbox",valueTypeIsBoolean:!0,options:[{label:c.formatMessage({id:"GLOBAL_Alert_Author"}),value:"YES"}],disabled:!z})]})]})]})]})};var Oa=i(3320);const $a=(e,t)=>({...e,publishTo:(0,Oa.q9)(e.publishTo),uiObjectLink:e.uiObjectLink?e.uiObjectLink.uri:"",sendAlert:e.sendAlert?"1":"0",alertAuthor:e.alertAuthor?"1":"0",...(0,E.extractTaxonomiesFromObjectAndMapProperty)(e,"title",e=>e.join(",")),uri:t??"",type:"meeting"}),Ba=({closeHandler:e,onUpdate:t,meeting:i})=>{const a=(0,l.A)(),c=(0,fn.A)(),u=(0,q.useForm)(),g=(0,d.jL)(),[m,p]=(0,n.useState)(!0),[h,f]=(0,n.useState)(!1),[x,j]=(0,n.useState)(!1),b=(0,q.useWatch)({control:u.control}),C=(0,n.useMemo)(()=>E.meetingUpdateSchema.safeParse($a(b,i?.uri)).success,[i?.uri,b]);(0,n.useEffect)(()=>{if(i){const e=s.Utils.date.strToTimestamp(i.dateModified);E.default.network.token(c.signal).then(t=>{u.reset({title:i.title,noGestion:i.noGestion,dateEnd:i.dateEnd,dateStart:i.dateStart,address:i.address,allDay:i.allDay,bgColor:i.bgColor,image:e&&i.image?{type:"meeting",id:i.id,timestamp:String(e)}:void 0,place:i.place,textColor:i.textColor,agenda:i.agenda??void 0,report:i.report??void 0,urlGestion:i.urlGestion??void 0,publishTo:i._audience.map(e=>({uri:e.uri,title:e.title})),uiObjectLink:i.uiObjectLink&&i.uiObjectLink.length>0?{uri:i.uiObjectLink[0].uri,title:i.uiObjectLink[0].title}:void 0,token:t.result}),p(!1)}).catch(e=>{c.signal.aborted||g(r.Toast.actions.error({label:e.errorMsg??a.formatMessage({id:"GLOBAL_Error"})}))})}},[i,u,c.signal,g,a]);const y=(0,n.useMemo)(()=>{if(!i)return;let e="onSpot";return e=i.place&&i.address?"hybrid":i.address?"onSpot":i.place?"visio":"onSpot",{eventMode:e,customColors:!!i.textColor||!!i.bgColor,attachments:i._attachedFiles,reportFile:i.reportFile,tags:(0,E.extractTaxonomiesFromObject)(i)}},[i]),v=(0,n.useCallback)(e=>{f(!0),E.default.article.update($a(e,i?.uri),{signal:c.signal,format:E.Format.LITTLE}).then(e=>{t(),g(r.Toast.actions.success({label:"GLOBAL_Successfully_Saved",link:{label:"GLOBAL_Go_To_Content",url:e.result._url}}))}).catch(e=>{c.signal.aborted||g(r.Toast.actions.error({label:e.errorMsg??a.formatMessage({id:"GLOBAL_Error"})}))}).finally(()=>{c.signal.aborted||f(!1)})},[c.signal,g,a,i?.uri,t]);return(0,o.jsx)(xa,{articleId:i?.id,type:"meeting",closeHandler:e,onSubmit:u.handleSubmit(v),form:u,loading:h,uploadLoading:x,isValid:C,children:m?null:(0,o.jsx)(Ra,{mode:"update",form:u,setUploadLoading:j,extraInitialValues:y})})};var Ha=i(6339);const Fa=c.j.getLazyComponent("Typography"),Na=c.j.getLazyComponent("Modal"),Ua=({closeHandler:e,onUpdate:t,event:i})=>{const a=i?._extend?.recurringEventRecord,s=(0,l.A)(),[r,d]=(0,n.useState)(!1),{setUploadLoading:c,isValid:u,loading:g,uploadLoading:m,initialLoading:p,extraInitialValues:h,form:f,submit:x}=(0,Ha.r)({event:a,onUpdate:t});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(xa,{articleId:a?.id,type:"recurringEvent",closeHandler:e,onSubmit:f.handleSubmit(x),form:f,loading:g,isValid:u,uploadLoading:m,children:p?null:(0,o.jsx)(ha,{mode:"update",form:f,setUploadLoading:c,extraInitialValues:h})}),(0,o.jsx)(Na,{open:r,closeHandler:()=>d(!1),title:s.formatMessage({id:"GLOBAL_Save"}),buttons:[{color:"cancel",clickHandler:()=>d(!1),children:s.formatMessage({id:"GLOBAL_Cancel"})},{color:"danger",clickHandler:f.handleSubmit(x),loading:g,children:s.formatMessage({id:"GLOBAL_Save"}),dataCy:"delete-continue"}],children:(0,o.jsx)(Fa,{children:s.formatMessage({id:"CALENDAR_Update_Confirmation_Recurrent"})})})]})};var Pa=i(1974),Ya=i(4533);const Ja=c.j.getLazyComponent("SidePanelModal"),Qa=c.j.getLazyComponent("FlexBox"),Xa=c.j.getLazyComponent("Button"),Ka=c.j.getLazyComponent("Typography"),Za=c.j.getLazyComponent("IconButton"),el=a.default.div`
|
|
542
|
+
margin-right: ${({theme:e})=>e.space.sm}px;
|
|
543
|
+
`,tl=({open:e,closeHandler:t,onSubmit:i,onSchedule:s,children:r,form:d,uploadLoading:c,type:u,scheduleLoading:g,publishLoading:m,isValid:p,offsetTop:h,fixed:f})=>{const x=(0,l.A)(),j=(0,a.useTheme)(),b=(0,n.useRef)(),[C,y]=(0,n.useState)(),v=(0,n.useCallback)(()=>{t()},[t]);(0,n.useEffect)(()=>{e&&(b.current=void 0,d.reset(),y(void 0))},[d,e]);const L=(0,q.useWatch)({control:d.control});(0,n.useEffect)(()=>{let t;return e&&Object.keys(d.formState.dirtyFields).filter(e=>!["dateStart","dateEnd"].includes(e)).length>0&&(t=setTimeout(()=>{E.default.article.saveAsDraft({idDraft:b.current,form:{...L,type:u},contentType:u}).then(e=>{b.current=e.result.idDraft,y(new Date)})},2e3)),()=>{t&&clearTimeout(t)}},[e,L,u,d]);const A=(0,n.useMemo)(()=>c||g||m,[m,g,c]),k=(0,n.useCallback)(()=>"socialEvent"===u?b.current?`/ng/rr/article/event/draft/${b.current}`:"/ng/rr/article/event/create":b.current?`/?action=se&from=draft&idDraft=${b.current}`:`/?action=spotlight-edit&type=${u}`,[u]);return(0,o.jsx)(Ja,{offsetTop:h??0,position:"right",open:e,closeHandler:v,showIconClose:!0,fixed:f,options:(0,o.jsx)(Za,{icon:"icon-expand",href:k(),tooltip:{description:x.formatMessage({id:"GLOBAL_Form_All"})},srOnly:x.formatMessage({id:"GLOBAL_Form_All"})}),title:x.formatMessage({id:"socialEvent"===u?"CALENDAR_Create_SocialEvent_Title":"CALENDAR_Create_Meeting_Title"}),sticky:!0,footer:(0,o.jsxs)(Qa,{direction:"column",x:"flex-end",gap:j.space.xs,children:[C&&(0,o.jsx)(el,{children:(0,o.jsx)(Ka,{color:"grey5",size:"s",children:(0,Pa.r)(C,new Date)?x.formatMessage({id:"CALENDAR_Draft_Saved_Today"},{time:(0,Ya.Yq)(C,"HH:mm")}):x.formatMessage({id:"CALENDAR_Draft_Saved"},{date:x.formatDate(C,{day:"2-digit",month:"2-digit",year:"numeric"}),time:(0,Ya.Yq)(C,"HH:mm")})})}),(0,o.jsxs)(Qa,{children:[(0,o.jsx)(Xa,{color:"cancel",label:x.formatMessage({id:"GLOBAL_Cancel"}),onClick:v}),(0,o.jsx)(Xa,{color:"cancel",label:x.formatMessage({id:"GLOBAL_Schedule_Action"}),onClick:s,disabled:!p||A,loader:g}),(0,o.jsx)(Xa,{color:"valid",label:x.formatMessage({id:"GLOBAL_Publish"}),onClick:()=>i(),dataCy:`${u}-publish`,disabled:!p||A,loader:m})]})]}),children:(0,o.jsx)("form",{onSubmit:i,children:r})})};var il=i(3912);const ol=e=>({...e,publishTo:(0,Oa.q9)(e.publishTo),uiObjectLink:e.uiObjectLink?e.uiObjectLink.uri:"",sendAlert:e.sendAlert?"1":"0",alertAuthor:e.alertAuthor?"1":"0",...(0,E.extractTaxonomiesFromObjectAndMapProperty)(e,"title",e=>e.join(",")),type:"meeting"}),nl=({open:e,closeHandler:t,onCreate:i})=>{const a=(0,l.A)(),s=(0,fn.A)(),[c,u]=(0,n.useState)(null),[g,m]=(0,n.useState)(!1),[p,h]=(0,n.useState)(),[f,x]=(0,n.useState)(),j=(0,qe.useSelector)(r.Platform.selectors.selectPlatformConfig),b=(0,q.useForm)({defaultValues:async()=>{let e=new Date;e.setMinutes(e.getMinutes()<30?30:0),e=0===e.getMinutes()?(0,il.L)(e,1):e;let t=e;return t=(0,il.L)(t,1),{title:"",sendAlert:1===j.sendAlert,alertAuthor:1===j.sendAlert,dateStart:(0,Ya.Yq)(e,"yyyy-MM-dd HH:mm"),dateEnd:(0,Ya.Yq)(t,"yyyy-MM-dd HH:mm"),publishTo:[]}}}),C=(0,d.jL)(),[y,v]=(0,n.useState)(!1),[L,A]=(0,n.useState)(!1),[k,W]=(0,n.useState)(!1);(0,n.useEffect)(()=>{e&&E.default.network.token(s.signal).then(e=>{b.setValue("token",e.result)}).catch(e=>{s.signal.aborted||C(r.Toast.actions.error({label:e.errorMsg??a.formatMessage({id:"GLOBAL_Error"})}))})},[s.signal,C,b,a,e]);const _=(0,q.useWatch)({control:b.control}),w=(0,n.useMemo)(()=>E.meetingCreationSchema.safeParse(ol(_)).success,[_]),S=(0,n.useCallback)(e=>b.handleSubmit(t=>{t.publishTo&&0!==t.publishTo.length||e?(v(!0),E.default.article.create(ol(t),{signal:s.signal,format:E.Format.LITTLE}).then(e=>{i(),C(r.Toast.actions.success({label:"GLOBAL_Successfully_Saved",link:{label:"GLOBAL_Go_To_Content",url:e.result[0]._url}}))}).catch(e=>{C(r.Toast.actions.error({label:e.errorMsg??a.formatMessage({id:"GLOBAL_Error"})}))}).finally(()=>{v(!1)})):u("publish")})(),[C,b,a,i]),M=(0,n.useCallback)((e,t,o)=>b.handleSubmit(n=>{const l=ol(n);if(!(l.publishTo&&0!==l.publishTo.length||o))return u("schedule"),h(e),void x(t);A(!0),E.default.article.saveAsDraft({form:l,contentType:"meeting",scheduleDate:e,permalinkId:t},{signal:s.signal}).then(()=>{i(),C(r.Toast.actions.success({label:"GLOBAL_Successfully_Saved"}))}).catch(e=>{s.signal.aborted||C(r.Toast.actions.error({label:e.errorMsg??a.formatMessage({id:"GLOBAL_Error"})}))}).finally(()=>{s.signal.aborted||A(!1)})})(),[s.signal,C,b,a,i]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(tl,{type:"meeting",open:e,closeHandler:t,onSubmit:S,onSchedule:()=>m(!0),form:b,publishLoading:y,scheduleLoading:L,uploadLoading:k,isValid:w,children:(0,o.jsx)(Ra,{mode:"create",form:b,setUploadLoading:W})}),(0,o.jsx)(ce,{open:null!==c,closeHandler:()=>u(null),control:b.control,onSubmit:()=>{"publish"===c?S(!0):"schedule"===c&&p&&f&&M(p,f,!0)}}),(0,o.jsx)(le,{open:g,closeHandler:()=>m(!1),onSubmit:({scheduleDate:e,permalinkId:t})=>M(e,t)})]})},al=c.j.getLazyComponent("Modal"),ll=c.j.getLazyComponent("Message"),sl=c.j.getLazyComponent("Typography"),rl=c.j.getLazyComponent("FlexBox"),dl=c.j.getLazyComponent("IconButton"),cl=c.j.getLazyComponent("InputTextRaw"),ul=a.default.div`
|
|
544
|
+
display: flex;
|
|
545
|
+
flex-direction: column;
|
|
546
|
+
gap: ${({theme:e})=>e.space.sm}px;
|
|
547
|
+
margin-bottom: ${({theme:e})=>e.space.l}px;
|
|
548
|
+
`,gl=({open:e,closeHandler:t})=>{const i=(0,l.A)(),n=(0,d.jL)(),a=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"calendarHook"))?.iCalendarUrls;return a?(0,o.jsx)(al,{title:i.formatMessage({id:"EVENT_Export_Calendar_ICalendar_Format"}),open:e,closeHandler:t,enableClickAwayCloseModal:!0,children:(0,o.jsxs)(ul,{children:[(0,o.jsx)(ll,{message:i.formatMessage({id:"EVENT_ICalendar_Export_Url_Explanation"}),variant:"info"}),(0,o.jsxs)(rl,{direction:"column",children:[(0,o.jsx)(sl,{weight:"medium",children:i.formatMessage({id:"EVENT_ICalendar_Export_Url"})}),(0,o.jsxs)(rl,{children:[(0,o.jsx)(dl,{icon:"icon-copy",colorVariant:"primary",onClick:()=>{navigator.clipboard.writeText(a.all).then(()=>{n(r.Toast.actions.success({label:i.formatMessage({id:"CLIPBOARD_Copy_Success"})}))})}}),(0,o.jsx)(cl,{value:a.all,margin:"0",width:"100%"})]})]}),(0,o.jsxs)(rl,{direction:"column",children:[(0,o.jsx)(sl,{weight:"medium",children:i.formatMessage({id:"EVENT_ICalendar_Export_Url_Subscribed"})}),(0,o.jsxs)(rl,{children:[(0,o.jsx)(dl,{icon:"icon-copy",colorVariant:"primary",onClick:()=>{navigator.clipboard.writeText(a.accepted).then(()=>{n(r.Toast.actions.success({label:i.formatMessage({id:"CLIPBOARD_Copy_Success"})}))})}}),(0,o.jsx)(cl,{value:a.accepted,margin:"0",width:"100%"})]})]})]})}):null};var ml=i(5517);const pl=({open:e,closeHandler:t,onCreate:i,defaultDateSelection:a,offsetTop:l,fixed:s})=>{const{submit:r,schedule:d,form:c,publishLoading:u,scheduleLoading:g,uploadLoading:m,setUploadLoading:p,isValid:h}=(0,ml.n)({onCreate:i,defaultDateSelection:a,open:e}),[f,x]=(0,n.useState)(!1),[j,b]=(0,n.useState)(null),[C,y]=(0,n.useState)(null),[v,L]=(0,n.useState)(null),E=(0,n.useCallback)(e=>c.handleSubmit(t=>{h&&(t.publishTo&&0!==t.publishTo.length||e?r():b("publish"))})(),[r,c,h]),A=(0,n.useCallback)((e,t,i)=>c.handleSubmit(o=>{if(!(o.publishTo&&0!==o.publishTo.length||i))return b("schedule"),y(e),void L(t);d(e,t)})(),[c,d]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(tl,{type:"socialEvent",open:e,closeHandler:t,onSubmit:c.handleSubmit(()=>E()),onSchedule:()=>x(!0),form:c,publishLoading:u,scheduleLoading:g,uploadLoading:m,isValid:h,fixed:s,offsetTop:l,children:(0,o.jsx)(ha,{form:c,setUploadLoading:p,mode:"create"})}),(0,o.jsx)(ce,{open:null!==j,closeHandler:()=>b(null),control:c.control,onSubmit:()=>{"publish"===j?r():"schedule"===j&&C&&v&&A(C,v,!0)}}),(0,o.jsx)(le,{open:f,closeHandler:()=>x(!1),onSubmit:({scheduleDate:e,permalinkId:t})=>A(e,t)})]})},hl=c.j.getLazyComponent("Calendar"),fl=a.default.div`
|
|
549
|
+
margin-bottom: ${({theme:e})=>e.space.md}px;
|
|
550
|
+
`,xl=a.default.div`
|
|
551
|
+
height: 54px;
|
|
552
|
+
display: flex;
|
|
553
|
+
align-items: center;
|
|
554
|
+
justify-content: space-between;
|
|
555
|
+
${({view:e,theme:t})=>"list"===e&&`border-bottom: 1px solid ${t.color.grey2};`}
|
|
556
|
+
padding: 0 ${({theme:e})=>e.space.md}px;
|
|
557
|
+
`,jl=[{label:"CALENDAR_dayGridMonth",value:"dayGridMonth"},{label:"CALENDAR_timeGridWeek",value:"timeGridWeek"},{label:"CALENDAR_timeGridDay",value:"timeGridDay"},{label:"CALENDAR_listWeek",value:"list"}],bl=({views:e=["dayGridMonth","list","timeGridDay","timeGridWeek"],mode:t="full",withPadding:i=!0,withHeader:a=!0,withToolbar:c=!0,fluid:u})=>{const g=(0,l.A)(),m=(0,d.jL)(),p=(0,me.Zp)();(()=>{const e=(0,d.jL)(),t=(0,n.useMemo)(()=>he.A,[]),i=(0,n.useMemo)(()=>r.Calendar.getCalendarRTHandlers(e,E.default),[e]);(0,n.useEffect)(()=>(i.forEach(e=>{t.onMessage(e.namespace,e.function,e.handler)}),()=>{i.forEach(e=>{t.offMessage(e.namespace,e.function,e.handler)})}),[i,t])})();const[h,f]=(0,n.useState)(),{loading:x,list:j,pendingStatusChanges:b}=(0,d.GV)(r.Calendar.selectors.selectCalendarEvents),[C,y]=(0,n.useState)(),[v,L]=(0,n.useState)(null),[A,k]=(0,n.useState)(!1),[W,_]=(0,n.useState)(null),w=(0,d.GV)(e=>r.Hook.selectors.selectHook(e,"calendarHook"))?.defaultView,S=(0,n.useMemo)(()=>{const e=new URLSearchParams(window.location.search).get("view");switch(e){case"dayGridMonth":case"timeGridDay":case"timeGridWeek":case"list":return e;default:switch(w){case"month":default:return"dayGridMonth";case"week":return"timeGridWeek";case"day":return"timeGridDay";case"list":return"list"}}},[w]),M=(0,n.useMemo)(()=>jl.filter(t=>e.includes(t.value)).map(e=>({label:g.formatMessage({id:e.label}),value:e.value})),[e,g]),[T,q]=(0,n.useState)(M.find(e=>e.value===S)??M[0]),D=(0,n.useCallback)(e=>{const t=new URLSearchParams(window.location.search);void 0!==e.types&&(e.types.length>0?t.set("types",e.types.join(",")):t.delete("types")),void 0!==e.view&&(e.view?t.set("view",e.view):t.delete("view")),p(`?${t.toString()}`,{replace:!0})},[p]),z=(0,n.useCallback)(e=>{m(r.Toast.actions.error({label:e??g.formatMessage({id:"GLOBAL_Error"})}))},[m,g]),G=(0,n.useCallback)(e=>{m(r.Toast.actions.success({label:e}))},[m]),I=(0,n.useCallback)(e=>{q(e),D({view:e.value})},[D]),V=(0,n.useCallback)((e,t)=>{const i={start:s.Utils.date.formatDate(e),end:s.Utils.date.formatDate(t)};m(r.Calendar.actions.setDates(i))},[m]),[R,O]=(0,n.useState)(null);return(0,n.useEffect)(()=>{m(r.Calendar.actions.setTypes(new URLSearchParams(window.location.search).get("types")?.split(",").filter(e=>["socialEvent","meeting","animatedMeeting","boardCard"].includes(e))??[]))},[m]),(0,o.jsxs)(o.Fragment,{children:[(a||c)&&(0,o.jsxs)(xl,{view:T.value,children:[a&&(0,o.jsx)(wn,{}),c&&(0,o.jsxs)(n.Suspense,{fallback:(0,o.jsx)(o.Fragment,{}),children:[(0,o.jsx)($n,{label:h,isLoading:"pending"===x,view:T,calendarApi:C,viewsOptions:M,navigateWithQuery:D,setView:q,setCreationType:O,setExportModalOpen:k}),(0,o.jsx)(pl,{defaultDateSelection:W,closeHandler:()=>{O(null),_(null)},open:"socialEvent"===R||!!W,onCreate:()=>{O(null),_(null)}}),(0,o.jsx)(nl,{closeHandler:()=>O(null),open:"meeting"===R,onCreate:()=>{O(null)}}),(0,o.jsx)(gl,{open:A,closeHandler:()=>k(!1)})]})]}),(0,o.jsx)(hl,{fluid:u,mode:t,fullScreen:!0,withPadding:i,events:j,loading:"pending"===x,handler:{global:E.default.global,calendar:E.default.calendar,article:E.default.article},defaultView:T.value,eventModalExtraComponent:({id:e,uri:t,_right:i,type:n})=>"recurringEventOccurrence"===n?null:(0,o.jsx)(fl,{children:(0,o.jsx)(vn,{articleId:e,articleUri:t,canComment:i.comment})}),deportedToolbar:{onChangeLabel:f,onCalendarApiInit:y,view:T},onChangeDates:V,onError:z,onSuccess:G,onChangeView:I,onDeleteEvent:()=>{m(r.Toast.actions.success({label:g.formatMessage({id:"GLOBAL_Successfully_Deleted"})}))},onClickUpdateEvent:L,onUpdateStatus:e=>m(r.Calendar.actions.changeResponse(e)),isUpdateStatusLoading:e=>b.some(t=>t.eventId===e),onSelect:_,disableSelect:null!==W||null!==R}),(0,o.jsx)(ya,{event:"socialEvent"===v?.type?v:void 0,onUpdate:()=>{L(null)},closeHandler:()=>L(null)}),(0,o.jsx)(Ba,{meeting:"meeting"===v?.type?v:void 0,onUpdate:()=>{L(null)},closeHandler:()=>L(null)}),(0,o.jsx)(Ua,{event:v&&(0,E.isRecurringEventOccurrence)(v)?v:void 0,onUpdate:()=>{L(null)},closeHandler:()=>L(null)})]})},Cl=c.j.getLazyComponent("Container"),yl=()=>(0,o.jsx)(n.Suspense,{fallback:(0,o.jsx)(o.Fragment,{}),children:(0,o.jsx)(Cl,{mode:"full",children:(0,o.jsx)(me.sv,{})})}),vl=(a.default.div`
|
|
558
|
+
margin-bottom: 24px;
|
|
559
|
+
`,a.default.div`
|
|
560
|
+
margin-bottom: 4px;
|
|
561
|
+
`,a.default.div`
|
|
562
|
+
position: absolute;
|
|
563
|
+
background-color: ${e=>e.isActive?"rgba(0,0,0,.1)":"transparent"};
|
|
564
|
+
inset: 0;
|
|
565
|
+
pointer-events: ${e=>e.isActive?"all":"none"};
|
|
566
|
+
flex: 1;
|
|
567
|
+
display: flex;
|
|
568
|
+
overflow: hidden;
|
|
569
|
+
`),Ll=a.default.div`
|
|
570
|
+
flex-direction: row;
|
|
571
|
+
display: flex;
|
|
572
|
+
min-height: 60px;
|
|
573
|
+
border-bottom: 1px solid ${e=>e.theme.color.grey2};
|
|
574
|
+
`,El=a.default.div`
|
|
575
|
+
width: 60px;
|
|
576
|
+
display: flex;
|
|
577
|
+
align-items: center;
|
|
578
|
+
justify-content: center;
|
|
579
|
+
`,Al=a.default.div`
|
|
580
|
+
flex: 1;
|
|
581
|
+
display: flex;
|
|
582
|
+
align-items: center;
|
|
583
|
+
justify-content: center;
|
|
584
|
+
`,kl=a.default.div`
|
|
585
|
+
position: relative;
|
|
586
|
+
overflow: hidden;
|
|
587
|
+
top: 0px;
|
|
588
|
+
width: ${460}px;
|
|
589
|
+
`,Wl=a.default.div`
|
|
590
|
+
position: absolute;
|
|
591
|
+
top: 0;
|
|
592
|
+
${e=>"left"===e.position?"left: 0px;":""}
|
|
593
|
+
${e=>"right"===e.position?"right: -1000px;":""}
|
|
594
|
+
width: ${440}px;
|
|
595
|
+
bottom: 00px;
|
|
596
|
+
display: flex;
|
|
597
|
+
background-color: ${e=>e.theme.color.white};
|
|
598
|
+
flex-direction: row;
|
|
599
|
+
transition: all 0.4s;
|
|
600
|
+
box-shadow: -4px 0px 20px 0px #00000017;
|
|
601
|
+
|
|
602
|
+
&.animate {
|
|
603
|
+
right: 0px;
|
|
604
|
+
}
|
|
605
|
+
`,_l=a.default.div`
|
|
606
|
+
flex: 1;
|
|
607
|
+
display: flex;
|
|
608
|
+
flex-direction: column;
|
|
609
|
+
padding: 12px;
|
|
610
|
+
overflow: auto;
|
|
611
|
+
margin-bottom: 12px;
|
|
612
|
+
position: relative;
|
|
613
|
+
`,wl=a.default.div`
|
|
614
|
+
flex: 1;
|
|
615
|
+
display: flex;
|
|
616
|
+
flex-direction: column;
|
|
617
|
+
`,Sl=a.default.div`
|
|
618
|
+
position: absolute;
|
|
619
|
+
inset: 0;
|
|
620
|
+
background-color: rgba(255, 255, 255, 0.8);
|
|
621
|
+
display: flex;
|
|
622
|
+
align-items: center;
|
|
623
|
+
justify-content: center;
|
|
624
|
+
`,Ml=a.default.div`
|
|
625
|
+
position: absolute;
|
|
626
|
+
inset: 0;
|
|
627
|
+
background-color: ${e=>e.theme.color.white};
|
|
628
|
+
padding: ${e=>e.theme.space.md}px;
|
|
629
|
+
`,Tl=a.default.div`
|
|
630
|
+
width: ${50}px;
|
|
631
|
+
padding-top: 60px;
|
|
632
|
+
display: flex;
|
|
633
|
+
flex-direction: column;
|
|
634
|
+
border-right: 1px solid ${e=>e.theme.color.grey2};
|
|
635
|
+
`,ql=a.default.button`
|
|
636
|
+
border-radius: 4px;
|
|
637
|
+
cursor: pointer;
|
|
638
|
+
height: 42px;
|
|
639
|
+
margin: 4px;
|
|
640
|
+
width: 42px;
|
|
641
|
+
display: flex;
|
|
642
|
+
align-items: center;
|
|
643
|
+
justify-content: center;
|
|
644
|
+
background-color: ${e=>e.isActive?e.theme.color.grey2:e.theme.color.white};
|
|
645
|
+
|
|
646
|
+
${(0,s.DashedFocusBorder)()}
|
|
647
|
+
|
|
648
|
+
&:hover {
|
|
649
|
+
background-color: ${e=>e.theme.color.grey2};
|
|
650
|
+
}
|
|
651
|
+
`,Dl=(a.default.div`
|
|
652
|
+
display: flex;
|
|
653
|
+
border: 1px solid ${e=>e.theme.color.grey1};
|
|
654
|
+
border-radius: ${8}px;
|
|
655
|
+
margin-bottom: 24px;
|
|
656
|
+
input {
|
|
657
|
+
width: 100%;
|
|
658
|
+
border: 0;
|
|
659
|
+
height: ${50}px;
|
|
660
|
+
margin: 0;
|
|
661
|
+
}
|
|
662
|
+
`,a.default.div`
|
|
663
|
+
display: flex;
|
|
664
|
+
flex-direction: row;
|
|
665
|
+
padding: 12px;
|
|
666
|
+
background-color: ${e=>e.theme.color.grey0};
|
|
667
|
+
border-radius: 8px;
|
|
668
|
+
margin-bottom: 4px;
|
|
669
|
+
`,a.default.div`
|
|
670
|
+
display: flex;
|
|
671
|
+
flex: 1;
|
|
672
|
+
align-items: center;
|
|
673
|
+
`,a.default.div`
|
|
674
|
+
width: 40px;
|
|
675
|
+
display: flex;
|
|
676
|
+
justify-content: center;
|
|
677
|
+
align-items: center;
|
|
678
|
+
`,a.default.div`
|
|
679
|
+
flex-direction: row;
|
|
680
|
+
display: flex;
|
|
681
|
+
align-items: center;
|
|
682
|
+
`,a.default.div`
|
|
683
|
+
flex: 1;
|
|
684
|
+
display: flex;
|
|
685
|
+
align-items: center;
|
|
686
|
+
`,c.j.getLazyComponent("Button")),zl=c.j.getLazyComponent("Icon"),Gl=({uniqid:e})=>{const t=(0,d.jL)(),i=(0,d.GV)(t=>r.WidgetEditor.selectors.selectEditor(t,e));return i&&i.popup&&i.view?(0,o.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",backgroundColor:"white",marginTop:90},children:[(0,o.jsxs)(Ll,{children:[(0,o.jsx)(El,{}),(0,o.jsx)(Al,{children:"Popup"}),(0,o.jsx)(El,{children:(0,o.jsx)(ql,{onClick:()=>{t(r.WidgetEditor.slice.actions.flushEditorPopup({uniqid:e}))},children:(0,o.jsx)(zl,{name:"icon-times",color:"grey2",size:26.75})})})]}),(0,o.jsx)("div",{style:{flex:1,display:"flex"},children:i.view}),(0,o.jsx)(Ll,{children:(0,o.jsx)(Dl,{onClick:()=>{t(r.WidgetEditor.slice.actions.flushEditorPopup({uniqid:e}))},children:"Save"})})]}):(0,o.jsx)(o.Fragment,{})};var Il=i(3771);const Vl=c.j.getLazyComponent("WidgetArticleTitleEditor"),Rl=c.j.getLazyComponent("WidgetArticleTextEditor"),Ol=c.j.getLazyComponent("WidgetArticleGalleryEditor"),$l=c.j.getLazyComponent("WidgetArticleAttachmentEditor"),Bl=c.j.getLazyComponent("WidgetArticleSliderEditor"),Hl=c.j.getLazyComponent("WidgetArticleImageEditor"),Fl=c.j.getLazyComponent("WidgetButtonEditor"),Nl=c.j.getLazyComponent("WidgetCheckListEditor"),Ul=c.j.getLazyComponent("WidgetQuickSurveyEditor"),Pl=c.j.getLazyComponent("WidgetDatasourceTableEditor"),Yl=c.j.getLazyComponent("WidgetExcelDatasourceTableEditor"),Jl=c.j.getLazyComponent("WidgetPresenceEditor"),Ql=c.j.getLazyComponent("WidgetLuccaAbsenceEditor"),Xl=c.j.getLazyComponent("WidgetEmailsImapEditor"),Kl=c.j.getLazyComponent("WidgetContactCardDavEditor"),Zl=c.j.getLazyComponent("WidgetCalendarCalDavEditor"),es=c.j.getLazyComponent("WidgetUserProfileEditor"),ts=c.j.getLazyComponent("WidgetColorEditor"),is=c.j.getLazyComponent("WidgetWelcomeEditor"),os=c.j.getLazyComponent("WidgetExtensionEditor"),ns=({uniqid:e})=>{const t=(0,d.jL)(),i=(0,d.GV)(r.Widget.selectors.selectToken),n=(0,d.GV)(t=>r.Widget.selectors.selectWidget(t,e),qe.shallowEqual),a=(0,d.GV)(t=>r.WidgetEditor.selectors.selectEditor(t,e)?.onSave,qe.shallowEqual),l=e=>r.Hook.selectors.selectHook(Il.M.getState(),e)?.isActive,c=i=>{n&&t(r.Widget.slice.actions.updateWidget({uniqid:e,content:i})),t(r.WidgetEditor.slice.actions.flushEditor({uniqid:e})),a&&a(i)},u=(i,o)=>{t(void 0!==o?r.Widget.slice.actions.setWidgetState({uniqid:o,...i}):r.Widget.slice.actions.setWidgetState({uniqid:e,...i}))},g=i=>{t(r.WidgetEditor.slice.actions.registerEditorPopup({uniqid:e,view:i}))},m=n?.widget;return m?(0,E.ensureWidgetArticleButtonType)(m)?(0,o.jsx)(Fl,{...m.content,onChange:i=>{t((0,r.updateWidgetContent)(e,i,!1))},onSave:()=>c({})}):(0,E.ensureWidgetArticleGalleryType)(m)?(0,o.jsx)(Ol,{token:i,content:m.content,onChange:i=>t((0,r.updateWidgetContent)(e,i,!1)),onSave:c,onStateChange:u}):(0,E.ensureWidgetArticleAttachmentType)(m)?(0,o.jsx)($l,{token:i,content:m.content,onChange:i=>{t((0,r.updateWidgetContent)(e,i,!1))},onSave:c,onStateChange:u,onOpen:g}):(0,E.ensureWidgetLuccaAbsenceType)(m)?(0,o.jsx)(Ql,{}):(0,E.ensureWidgetArticleImageType)(m)?(0,o.jsx)(Hl,{content:m.content,token:i,onChange:i=>{t((0,r.updateWidgetContent)(e,i,!1))},onSave:c,onStateChange:u}):(0,E.ensureWidgetArticleSliderType)(m)?void 0!==i?(0,o.jsx)(Bl,{slides:m.content.slides??[],loop:m.content.loop??!1,useDots:m.content.useDots??!0,onChange:i=>{t((0,r.updateWidgetContent)(e,i,!1))},token:i,onSave:c}):(0,o.jsx)(o.Fragment,{children:"Token is mandatory"}):(0,E.ensureWidgetArticleTitleType)(m)?(0,o.jsx)(Vl,{onChange:i=>{t((0,r.updateWidgetContent)(e,i,!1))},onSave:c,content:m.content,onOpen:g}):(0,E.ensureWidgetArticleTextType)(m)?(0,o.jsx)(Rl,{onChange:i=>{t((0,r.updateWidgetContent)(e,i,!1))},onSave:c,content:m.content}):(0,E.ensureWidgetPresenceType)(m)?(0,o.jsx)(Jl,{onChange:i=>{t((0,r.updateWidgetContent)(e,i,!1))},onSave:c,onStateChange:u,...m.content}):(0,E.ensureWidgetCheckListType)(m)?(0,o.jsx)(Nl,{token:i,uniqid:m.uniqid,content:{...m.content,arr:m.content.arr?.map(e=>({...e,title:s.Utils.html.htmlDecodeSpecialChars(e.title)}))},onChangeContent:(e,i)=>{t((0,r.updateWidgetContent)(e,i,!1))},onChangeWrapper:e=>{t(r.Widget.slice.actions.updateWidgetWrapper({...e,title:s.Utils.html.htmlDecodeSpecialChars(e.title)}))},handleChange:i=>t((0,r.updateWidgetContent)(e,i,!1))}):(0,E.ensureWidgetQuickSurveyType)(m)?(0,o.jsx)(Ul,{token:i,uniqid:m.uniqid,content:m.content,onChangeContent:(e,i)=>{t((0,r.updateWidgetContent)(e,i,!1))},onChangeWrapper:e=>{t(r.Widget.slice.actions.updateWidgetWrapper({...e}))},handleChange:i=>t((0,r.updateWidgetContent)(e,i,!1))}):(0,E.ensureWidgetExcelDatasourceTableType)(m)?(0,o.jsx)(Yl,{...m.content,uri:m.content.uri,limit:m.content.limit??20,hook:{isActive:l},handlers:{jamespot:{datasource:E.default.datasource,network:E.default.network,filebank:E.default.filebank,wedoc:E.default.wedoc},handleStart:()=>u({busy:!0}),handleCatch:e=>t(r.Toast.actions.error({label:e.errorMsg})),handleFinally:()=>u({busy:!1})},onSave:c,onChange:(i,o)=>t((0,r.updateWidgetContent)(e,i,o??!1)),onStateChange:u,onError:e=>t(r.Toast.actions.error({label:e}))}):(0,E.ensureWidgetEmailsImapType)(m)?(0,o.jsx)(Xl,{}):(0,E.ensureWidgetExtensionType)(m)?(0,o.jsx)(os,{extensionName:m.content.extensionName,onChange:(i,o)=>t((0,r.updateWidgetContent)(e,i,o??!1)),onSave:c,onStateChange:u}):(0,E.ensureWidgetContactCardDavType)(m)?(0,o.jsx)(Kl,{}):(0,E.ensureWidgetCalendarCalDavType)(m)?(0,o.jsx)(Zl,{}):(0,E.ensureWidgetDatasourceTableType)(m)?(0,o.jsx)(Pl,{...m.content,uri:m.content.uri,limit:m.content.limit??20,hook:{isActive:l},handlers:{jamespot:{datasource:E.default.datasource,network:E.default.network,application:E.default.application,filebank:E.default.filebank},handleStart:()=>u({busy:!0}),handleCatch:e=>t(r.Toast.actions.error({label:e.errorMsg})),handleFinally:()=>u({busy:!1})},onSave:c,onChange:(i,o)=>t((0,r.updateWidgetContent)(e,i,o??!1)),onStateChange:u,onError:e=>{t(r.Toast.actions.error({label:e}))}}):(0,E.ensureWidgetUserProfileType)(m)?(0,o.jsx)(es,{uniqid:m.uniqid,content:m.content,onChangeContent:(e,i)=>{t((0,r.updateWidgetContent)(e,i,!1))}}):(0,E.ensureWidgetColorType)(m)?(0,o.jsx)(ts,{uniqid:m.uniqid,content:m.content,onChangeContent:(e,i)=>{t((0,r.updateWidgetContent)(e,i,!1))}}):(0,E.ensureWidgetWelcomeType)(m)?(0,o.jsx)(is,{uniqid:m.uniqid,content:m.content,onChangeContent:(e,i)=>{t((0,r.updateWidgetContent)(e,i,!1))}}):(0,o.jsx)(o.Fragment,{children:"cannot display editor"}):null},as=c.j.getLazyComponent("Icon"),ls=({uniqid:e,position:t})=>{const i=(0,d.jL)(),n=(0,a.useTheme)();return(0,o.jsx)(El,{children:(0,o.jsx)(ql,{onClick:()=>{i(r.WidgetEditor.slice.actions.setEditorPosition({uniqid:e,position:"left"===t?"right":"left"}))},children:(0,o.jsx)(as,{name:"left"===t?"icon-angle-right":"icon-angle-left",color:n.color.lavender,size:26.75})})})},ss=c.j.getLazyComponent("InputColorRaw"),rs=a.default.label`
|
|
687
|
+
margin-left: 2px;
|
|
688
|
+
margin-right: 2px;
|
|
689
|
+
margin-bottom: 8px;
|
|
690
|
+
font-size: 14px;
|
|
691
|
+
width: 100%;
|
|
692
|
+
min-height: 20px;
|
|
693
|
+
`,ds=a.default.fieldset`
|
|
694
|
+
margin: 12px 0px !important;
|
|
695
|
+
width: 100% !important;
|
|
696
|
+
`,cs=({label:e,initialValue:t,handleChange:i})=>{const n=(0,a.useTheme)(),s=[{name:(0,l.A)().formatMessage({id:"GLOBAL_Platform_Color"}),colors:[n.color.primary,n.color.secondary,n.color.headerColor,n.color.lavender,n.color.orange,n.color.green,n.color.navy,n.color.overseas,n.color.transparentHexa]}];return(0,o.jsxs)(ds,{children:[(0,o.jsx)(rs,{children:(0,o.jsx)(T.A,{id:e})}),(0,o.jsx)(ss,{palettes:s,label:e,initialValue:t??n.color.primary,name:"background-color",onChange:i})]})},us=c.j.getLazyComponent("InputNumber"),gs=({label:e,initialValue:t,handleChange:i})=>{const a=(0,l.A)(),{control:s,watch:r}=(0,q.useForm)({defaultValues:{value:t??"0"},criteriaMode:"all"});return(0,n.useEffect)(()=>{const e=r(e=>{i(e.value??"")});return()=>e.unsubscribe()},[r,i]),(0,o.jsx)(us,{label:e,name:"value",width:"100%",control:s,placeholder:a.formatMessage({id:e})})},ms=c.j.getLazyComponent("InputSelectExtended"),ps=({label:e,options:t=[],initialValue:i,required:a=!1,handleChange:l})=>{const s=(0,n.useMemo)(()=>i&&t.find(e=>e.value===i)?t.find(e=>e.value===i):t[0],[i,t]),{control:r,watch:d}=(0,q.useForm)({defaultValues:{select:s},criteriaMode:"all"});return(0,n.useEffect)(()=>{const e=d(e=>{l(e.select.value)});return()=>e.unsubscribe()},[d,l]),(0,o.jsx)(ms,{options:t,label:e,getValue:e=>e.value,getLabel:"label",getSearch:"label",rules:{required:a},hideDeleteIcon:!0,required:a,control:r,name:"select"})},hs=c.j.getLazyComponent("InputText"),fs=({uniqid:e})=>{const t=(0,l.A)(),i=(0,d.jL)(),s=(0,d.GV)(t=>r.Widget.selectors.selectWidget(t,e)),c=(0,d.GV)(t=>r.Widget.selectors.selectWidgetContext(t,e),qe.shallowEqual),u=(0,a.useTheme)(),g=(0,d.GV)(t=>r.Widget.selectors.selectWidgetTitleStyle(t,e),qe.shallowEqual),{control:m,watch:p}=(0,q.useForm)({defaultValues:{text:s?.title.replace(/&/g,"&")??""},criteriaMode:"all"});(0,n.useEffect)(()=>{const t=p(t=>{i(r.Widget.slice.actions.updateWidgetWrapper({uniqid:e,title:t.text}))});return()=>t.unsubscribe()},[p,e,i]);const h=(0,n.useMemo)(()=>({color:g&&g.color?String(g.color):u.color.black,backgroundColor:g&&g["background-color"]?String(g["background-color"]):"transparent",fontSize:g&&g["font-size"]?String(g["font-size"]):"24",fontWeight:g&&g["font-weight"]?String(g["font-weight"]):"medium",textAlign:g&&g["text-align"]?String(g["text-align"]):"left"}),[g,u]),f=(0,n.useCallback)((t,o)=>{i(r.Widget.slice.actions.setWidgetTitleStyle({uniqid:e,styles:{[t]:o}}))},[i,e]);return s?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(hs,{name:"text",label:"WIDGET_Title",width:"100%",control:m,placeholder:t.formatMessage({id:"WIDGET_Title"})}),"comment"!==c&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(cs,{label:"STYLE_Text_Color",initialValue:h.color,handleChange:e=>f("color",e)}),(0,o.jsx)(cs,{label:"STYLE_Background_Color",initialValue:h.backgroundColor,handleChange:e=>f("background-color",e)}),(0,o.jsx)(gs,{label:"STYLE_Text_Size",initialValue:h.fontSize,handleChange:e=>f("font-size",e)}),(0,o.jsx)(ps,{label:"STYLE_Font_Weight",initialValue:h.fontWeight,options:[{label:t.formatMessage({id:"STYLE_Font_Weight_Normal"}),value:"normal"},{label:t.formatMessage({id:"STYLE_Font_Weight_Medium"}),value:"medium"},{label:t.formatMessage({id:"STYLE_Font_Weight_Bold"}),value:"bold"}],required:!1,handleChange:e=>f("font-weight",e)}),(0,o.jsx)(ps,{label:"STYLE_Text_Align",initialValue:h.textAlign,options:[{label:t.formatMessage({id:"STYLE_Text_Align_Left"}),value:"left"},{label:t.formatMessage({id:"STYLE_Text_Align_Center"}),value:"center"},{label:t.formatMessage({id:"STYLE_Text_Align_Justify"}),value:"justify"},{label:t.formatMessage({id:"STYLE_Text_Align_Right"}),value:"right"}],required:!1,handleChange:e=>f("text-align",e)})]})]}):(0,o.jsx)(o.Fragment,{})},xs=c.j.getLazyComponent("Loader"),js=({uniqid:e})=>{const t=(0,d.GV)(t=>r.Widget.selectors.selectWidgetState(t,e),qe.shallowEqual)?.busy;return(0,o.jsx)(o.Fragment,{children:t&&(0,o.jsx)(Sl,{children:(0,o.jsx)(xs,{size:"l"})})})},bs=({uniqid:e})=>{const t=(0,l.A)(),i=(0,d.GV)(t=>r.Widget.selectors.selectWidgetState(t,e),qe.shallowEqual)?.locked;return i?(0,o.jsx)(Ml,{children:t.formatMessage({id:"INTRANET_Panel_Change_Off"})}):(0,o.jsx)(o.Fragment,{})},Cs=c.j.getLazyComponent("Button"),ys=({uniqid:e,mode:t})=>{const i=(0,l.A)(),n=(0,d.jL)(),a=(0,d.GV)(t=>r.Widget.selectors.selectWidget(t,e),qe.shallowEqual),s=(0,d.GV)(t=>r.Widget.selectors.selectWidgetObjectUri(t,e),qe.shallowEqual);return(0,o.jsx)(Cs,{color:"valid",onClick:()=>{n(r.WidgetEditor.slice.actions.flushEditor({uniqid:e}));const o=a&&a.widget&&a.widget.content;s&&a&&o&&("view"==t&&E.default.widget.updateWidget({uri:s,uniqid:e,title:a.title,content:o,v2:!0}).catch(e=>{n(r.Toast.actions.error({label:e.errorMsg??i.formatMessage({id:"GLOBAL_Error"})}))}),"edit"===t&&n(r.Widget.slice.actions.updateWidget({uniqid:e,content:o})))},children:i.formatMessage({id:"GLOBAL_Save"})})},vs=({uniqid:e})=>{const t=(0,a.useTheme)(),i=(0,d.jL)(),s=(0,l.A)(),c=(0,d.GV)(t=>r.Widget.selectors.selectWidgetWrapperStyle(t,e),qe.shallowEqual),u=(0,n.useMemo)(()=>({color:c&&c.color?String(c.color):t.color.black,backgroundColor:c&&c["background-color"]?String(c["background-color"]):t.color.white,padding:c&&c.padding?String(c.padding):"0",borderRadius:c&&c["border-radius"]?String(c["border-radius"]):"0",borderColor:c["border-color"]?String(c["border-color"]):t.color.black,borderWidth:c["border-width"]?String(c["border-width"]):"0",borderStyle:c["border-style"]?String(c["border-style"]):"none"}),[c,t]),g=(0,n.useCallback)((t,o)=>{i(r.Widget.slice.actions.setWidgetWrapperStyle({uniqid:e,styles:{[t]:o}}))},[e,i]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(cs,{label:"STYLE_Background_Color",initialValue:u.backgroundColor,handleChange:e=>g("background-color",e)}),(0,o.jsx)(cs,{label:"STYLE_Text_Color",initialValue:u.color,handleChange:e=>g("color",e)}),(0,o.jsx)("hr",{}),(0,o.jsx)(gs,{label:"STYLE_Padding",initialValue:u.padding,handleChange:e=>g("padding",String(e))}),(0,o.jsx)(gs,{label:"STYLE_Radius",initialValue:u.borderRadius,handleChange:e=>g("border-radius",String(e))}),(0,o.jsx)(ps,{label:"STYLE_Border_Style",initialValue:u.borderStyle,options:[{label:s.formatMessage({id:"STYLE_Border_Style_None"}),value:"none"},{label:s.formatMessage({id:"STYLE_Border_Style_Solid"}),value:"solid"},{label:s.formatMessage({id:"STYLE_Border_Style_Dashed"}),value:"dashed"},{label:s.formatMessage({id:"STYLE_Border_Style_Dotted"}),value:"dotted"}],required:!1,handleChange:e=>{g("border-style",e),"none"!==e&&g("border-color",t.color.black),"none"!==e&&g("border-width","1")}}),"string"==typeof u.borderStyle&&"none"!==u.borderStyle&&(0,o.jsx)(cs,{label:"STYLE_Border_Color",initialValue:u.borderColor,handleChange:e=>g("border-color",e)}),"string"==typeof u.borderStyle&&"none"!==u.borderStyle&&(0,o.jsx)(gs,{label:"STYLE_Border_Width",initialValue:u.borderWidth,handleChange:e=>g("border-width",e)})]})},Ls=({uniqid:e})=>{const t=(0,d.jL)(),i=(0,l.A)(),a=(0,d.GV)(t=>r.WidgetEditor.selectors.selectEditor(t,e),qe.shallowEqual),s=r.Widget.definition(a?.name),c=(0,d.GV)(t=>r.Widget.selectors.selectWidgetLevel(t,e),qe.shallowEqual),u=(0,n.useCallback)(i=>{t(r.Widget.slice.actions.updateWidgetWrapper({uniqid:e,level:Number(i)}))},[e,t]);return(0,o.jsx)(ps,{handleChange:u,required:!0,label:"WIDGET_Display_Level_Select",initialValue:c?String(c):"3",options:[{label:i.formatMessage({id:"WIDGET_Display_Level_1"}),value:"1"},{label:i.formatMessage({id:"WIDGET_Display_Level_2"}),value:"2"},{label:i.formatMessage({id:"WIDGET_Display_Level_3"}),value:"3"},{label:i.formatMessage({id:"WIDGET_Display_Level_4"}),value:"4"}].filter(e=>Array.isArray(s.displayLevel)?s.displayLevel.includes(Number(e.value)):[])})},Es=["widget-presence","widget-quick-survey","widget-check-list","widget-emails-imap","widget-contact-cardDav","widget-calendar-calDav"],As=c.j.getLazyComponent("Icon"),ks=c.j.getLazyComponent("Tooltip"),Ws=({uniqid:e,position:t})=>{const i=(0,l.A)(),s=(0,d.jL)(),c=(0,a.useTheme)(),u=(0,n.useRef)(null),g=(0,d.GV)(t=>r.WidgetEditor.selectors.selectEditor(t,e),qe.shallowEqual),m=r.Widget.definition(g?.name),p=(0,n.useMemo)(()=>void 0!==m.displayLevel&&Array.isArray(m.displayLevel)&&0!==m.displayLevel.length,[m]),h=(0,n.useMemo)(()=>[{name:"widget-title",label:i.formatMessage({id:"PANEL_Title"}),enable:m.panel.useWrapper,icon:"icon-font"},{name:"widget-selection",label:i.formatMessage({id:"PANEL_Widget_Selection"}),enable:m.panel.useSelection,icon:"icon-sliders"},{name:"widget-settings",label:i.formatMessage({id:"PANEL_Widget_Settings"}),enable:m.panel.useEditor,icon:"icon-pen"},{name:"widget-level",label:i.formatMessage({id:"PANEL_Widget_Level"}),enable:p,icon:"icon-edit"}],[m,i,p]),f=(0,n.useMemo)(()=>m.panel.useEditor?h.find(e=>"widget-settings"===e.name):h.filter(e=>e.enable)[0],[m,h]),[x,j]=(0,n.useState)(f);return(0,n.useEffect)(()=>{setTimeout(()=>{u&&u.current&&(u.current.className=u.current.className+" animate")},0)},[]),g?(0,o.jsxs)(kl,{children:[(0,o.jsxs)(Wl,{ref:u,position:t,children:[(0,o.jsx)(Tl,{children:h.filter(e=>e.enable).map(e=>(0,o.jsx)(ql,{isActive:x&&x.name===e.name,onClick:()=>j(e),children:(0,o.jsx)(ks,{position:"left",description:e.label,children:(0,o.jsx)(As,{name:e.icon,color:x&&x.name===e.name?c.color.white:c.color.lavender})})},e.name))}),(0,o.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",width:"390px"},children:[(0,o.jsxs)(Ll,{children:[(0,o.jsx)(ls,{uniqid:e,position:g.position}),(0,o.jsx)(Al,{children:(0,o.jsx)("h3",{children:x?x.label:i.formatMessage({id:m.label})})}),(0,o.jsx)(El,{children:(0,o.jsx)(ql,{onClick:()=>{s(r.WidgetEditor.slice.actions.flushEditor({uniqid:e}))},children:(0,o.jsx)(As,{name:"icon-times",color:c.color.lavender,size:26.75})})})]}),(0,o.jsxs)(_l,{children:[(0,o.jsxs)(wl,{children:[x&&"widget-settings"===x.name&&m.panel.useEditor&&(0,o.jsx)(ns,{uniqid:g.uniqid}),x&&"widget-title"===x.name&&m.panel.useWrapper&&(0,o.jsx)(fs,{uniqid:g.uniqid}),x&&"widget-selection"===x.name&&(0,o.jsx)(vs,{uniqid:e}),x&&"widget-level"===x.name&&p&&(0,o.jsx)(Ls,{uniqid:e})]}),(0,o.jsx)(js,{uniqid:e}),(0,o.jsx)(bs,{uniqid:e}),Es.includes(g.name)&&(0,o.jsx)(ys,{uniqid:e,mode:g.mode})]})]})]}),g?.popup?(0,o.jsx)("div",{style:{position:"absolute",inset:0,backgroundColor:"#000",opacity:".7"}}):(0,o.jsx)(o.Fragment,{})]}):(0,o.jsx)(o.Fragment,{})},_s=a.default.div`
|
|
697
|
+
position: absolute;
|
|
698
|
+
inset: 0;
|
|
699
|
+
pointer-events: none;
|
|
700
|
+
z-index: 1;
|
|
701
|
+
`,ws=a.default.div`
|
|
702
|
+
flex: 1;
|
|
703
|
+
display: flex;
|
|
704
|
+
margin-top: ${90}px;
|
|
705
|
+
pointer-events: ${e=>e.isActive?"all":"none"};
|
|
706
|
+
`,Ss=a.default.div`
|
|
707
|
+
flex: 1;
|
|
708
|
+
display: flex;
|
|
709
|
+
flex-direction: row;
|
|
710
|
+
pointer-events: none;
|
|
711
|
+
`,Ms=a.default.div`
|
|
712
|
+
width: ${440}px;
|
|
713
|
+
pointer-events: none;
|
|
714
|
+
`,Ts=()=>{const e=(0,d.jL)();(0,n.useEffect)(()=>{const t=()=>{e(r.WidgetEditor.slice.actions.flushAllEditor())};return window.addEventListener("NGWidgetEditorFlushAll",t),()=>{window.removeEventListener("NGWidgetEditorFlushAll",t)}},[e]);const t=(0,d.GV)(r.WidgetEditor.selectors.selectEditors,qe.shallowEqual);return(0,o.jsx)(_s,{className:"editor-portal-wrapper",children:t.map(e=>(0,o.jsx)(vl,{isActive:!1,children:(0,o.jsx)(Ss,{children:"left"===e.position?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Ws,{uniqid:e.uniqid,position:e.position}),(0,o.jsx)(ws,{isActive:void 0!==e.popup,children:(0,o.jsx)(Gl,{uniqid:e.uniqid})}),(0,o.jsx)(Ms,{})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Ms,{}),(0,o.jsx)(ws,{isActive:void 0!==e.popup,children:(0,o.jsx)(Gl,{uniqid:e.uniqid})}),(0,o.jsx)(Ws,{uniqid:e.uniqid,position:e.position})]})})},e.uniqid))})},qs=()=>(0,o.jsx)(o.Fragment,{}),Ds=c.j.getLazyComponent("Container"),zs=()=>(0,o.jsx)(n.Suspense,{fallback:(0,o.jsx)(o.Fragment,{}),children:(0,o.jsx)(Ds,{backgroundColor:"white",mode:"fluid",flexDirection:"column",children:(0,o.jsx)(me.sv,{})})}),Gs=c.j.getLazyComponent("InputTinyMCERaw"),Is=e=>{const t=(0,l.A)(),i=(0,d.jL)(),s=(0,a.useTheme)(),c=(0,d.GV)(r.Model.selectors.selectAll),{query:u,ext:g,isActive:m}=Nn(),{open:p,onInsert:h,close:f,ext:x,isActive:j}=Me(),b=(0,n.useMemo)(()=>[...j?[x]:[],...m?[g]:[]],[g,x,m,j]),C=(0,n.useCallback)(e=>{i(r.Toast.actions.error({label:e??t.formatMessage({id:"GLOBAL_Error"})}))},[i,t]),y=(0,n.useMemo)(()=>(0,Te.X)(c,s,C),[c,C,s]),v=(0,n.useMemo)(()=>Fn.p9,[]);return(0,o.jsxs)(o.Fragment,{children:[v&&(0,o.jsx)(Gs,{commonOptions:v,additionalExtensions:b,mentionsQueries:y,...e}),m&&(0,o.jsx)(M,{query:u}),j&&(0,o.jsx)(St,{onInsert:h,open:p,close:f})]})};var Vs=i(3570);const Rs=c.j.getLazyComponent("Container"),Os=c.j.getLazyComponent("AppColumn"),$s=c.j.getLazyComponent("MainColumn");function Bs({extensionRoute:e,routes:t,description:i,mode:a="center",mainColumnProps:s}){const r=(0,l.A)(),{pathname:d}=(0,me.zy)(),c=(0,n.useMemo)(()=>Object.values(t),[t]),[u,g]=(0,n.useState)(c?.[0]?.key),m=c.map(t=>({...t,label:r.formatMessage({id:t.label}),href:t.absolutePath?t.path:`/ng/rr/${e}/${t.path}`,group:t.group?r.formatMessage({id:t.group}):void 0}));return(0,n.useEffect)(()=>{const t=c.find(t=>`/ng/rr/${e}/${t.path}`===d||t.paths?.reduce((t,i)=>{const o=`/ng/rr/${e}/${i}`,n=null!==(0,Vs.B6)(o,d);return t||n},!1));t&&g(t.key)},[d,c,e]),(0,o.jsx)(n.Suspense,{fallback:(0,o.jsx)(o.Fragment,{}),children:(0,o.jsxs)(Rs,{mode:a,children:[(0,o.jsx)(Os,{mode:a,description:i,tabs:m,activeTab:u||""}),(0,o.jsx)($s,{mode:a,flex:!0,...s,children:(0,o.jsx)(me.sv,{})})]})})}}}]);
|
|
715
|
+
//# sourceMappingURL=70.b156a91742e3d8901eaf.chunk.js.map
|