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