jamespot-react-core 1.2.34 → 1.2.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[199],{199:(e,t,n)=>{n.r(t),n.d(t,{AIModal:()=>T,AddReportModal:()=>ee,Audience:()=>w,Avatar:()=>p,CommentsBloc:()=>Ql,DisplayForm:()=>$,Editor:()=>De,EditorsPortal:()=>mt,Empty:()=>Kl,FullPageLayout:()=>eo,JRCInputTinyMCEWithExt:()=>lo,JRCInputTinyMCEWithExtRaw:()=>ao,MarkdownModal:()=>Mn,ModalAudience:()=>uo,TwoColLayout:()=>fo,WidgetList:()=>_t,WidgetWrapperCore:()=>Fl});var i=n(594),l=n.n(i),o=n(196),a=n.n(o),r=n(493),s=n(
|
|
1
|
+
"use strict";(self.webpackChunkReactCore=self.webpackChunkReactCore||[]).push([[199],{199:(e,t,n)=>{n.r(t),n.d(t,{AIModal:()=>T,AddReportModal:()=>ee,Audience:()=>w,Avatar:()=>p,CommentsBloc:()=>Ql,DisplayForm:()=>$,Editor:()=>De,EditorsPortal:()=>mt,Empty:()=>Kl,FullPageLayout:()=>eo,JRCInputTinyMCEWithExt:()=>lo,JRCInputTinyMCEWithExtRaw:()=>ao,MarkdownModal:()=>Mn,ModalAudience:()=>uo,TwoColLayout:()=>fo,WidgetList:()=>_t,WidgetWrapperCore:()=>Fl});var i=n(594),l=n.n(i),o=n(196),a=n.n(o),r=n(493),s=n(6),c=n(525),d=n(996),u=n(683);const m=d.j.getLazyComponent("Icon"),g=a().span`
|
|
2
2
|
${s.SROnly}
|
|
3
3
|
`,p=e=>{var t;const n=(0,o.useTheme)(),i=(0,r.useIntl)(),a=(0,u.GV)(c.Bx.selectors.selectNetworkPublic);return e.uri===(null==a?void 0:a.uri)?l().createElement(l().Fragment,null,l().createElement(m,{name:"icon-fs-wall",size:8*(null!==(t=e.size)&&void 0!==t?t:3),color:n.color.primary,variant:"circle"}),l().createElement(g,null,i.formatMessage({id:"NETWORK_Public"}))):l().createElement(s.JRCAvatar,Object.assign({},e))},f=d.j.getLazyComponent("FlexBox"),E=d.j.getLazyComponent("ModalContent"),h=d.j.getLazyComponent("ModalLayout"),b=d.j.getLazyComponent("StyledHref"),v=d.j.getLazyComponent("Tooltip"),y=d.j.getLazyComponent("Typography"),C=a().div`
|
|
4
4
|
display: flex;
|
|
@@ -645,4 +645,4 @@
|
|
|
645
645
|
width: 100%;
|
|
646
646
|
margin-top: 10px;
|
|
647
647
|
`,Ql=({articleId:e,variant:t="inline",canComment:n,commentType:a="comment",socialQuestion:s,articleUri:d})=>{var m,g;const p=(0,r.useIntl)(),f=(0,o.useTheme)(),E=(0,u.jL)(),[h,b]=(0,i.useState)(),[v,y]=(0,i.useState)(!1),[C,x]=(0,i.useState)([]),[w,k]=(0,i.useState)(!1),W=(0,u.GV)(c.xJ.selectors.get),_=(0,u.GV)(c.x0.selectors.selectWidgets),q=(0,u.GV)(c.sU.selectors.selectTinyMCECommonOptions),S=(0,u.GV)(c.sU.selectors.selectTinyMCEExtendedOptions),j=(0,u.GV)(c.Kx.selectors.selectAll),M=(0,u.GV)(c.OD.selectors.selectPlatformConfig),T=(0,u.GV)((t=>c.Mw.selectors.commentList(t,e))),A=(0,u.GV)((e=>c.qn.selectors.selectHook(e,"DriveHook"))),I=(0,u.GV)((e=>c.lg.selectors.selectById(e,"FileBankHook"))),O=(0,u.GV)((e=>c.qn.selectors.selectHook(e,"WidgetHook"))),[z,G]=(0,i.useState)(s),[D,V]=(0,i.useState)(null),{open:F,onInsert:$,close:R,ext:B,isActive:H}=jt();(0,te.A)(e),((e,t)=>{const n=(0,u.jL)(),l=(0,i.useMemo)((()=>ne.A),[]),o=(0,i.useMemo)((()=>c.Mw.getCommentsLikeRTHandlers(n,e,t)),[n,e,t]);(0,i.useEffect)((()=>(o.forEach((e=>{l.onMessage(e.namespace,e.function,e.handler)})),()=>{o.forEach((e=>{l.offMessage(e.namespace,e.function,e.handler)}))})),[o,l])})(T.map((e=>e.id)),e);const P=(0,i.useCallback)((e=>{E(c.y8.actions.error({label:null!=e?e:p.formatMessage({id:"GLOBAL_Error"})}))}),[E,p]),U=()=>{E(c.Mw.actions.fetchComments({idArticle:e})),N()},N=(0,i.useCallback)((()=>{h||w||(k(!0),L().network.token().then((e=>{b(e.result),k(!1),E(c.x0.slice.actions.setToken({token:e.result}))})).catch((e=>{P(e.errorMsg)})))}),[P,h,w,E]),Y=(0,i.useCallback)((t=>Nl(void 0,void 0,void 0,(function*(){if(h){y(!0);const n=Object.keys(_).map((e=>(null==C?void 0:C.some((t=>t.widget.uniqid===e)))?_[e]:null)).filter((e=>null!==e));try{yield L().article.addComment(Object.assign(Object.assign({},t),{widgets:n,token:h,idArticle:e,type:a})).then((()=>{x([])})),N()}catch(e){throw P(e.errorMsg),e}finally{y(!1)}}}))),[e,a,N,P,h,_,C]);return(0,i.useEffect)((()=>{N()}),[N]),(0,i.useEffect)((()=>{E(c.Mw.actions.fetchComments({idArticle:e}))}),[e,E]),(0,i.useEffect)((()=>{T&&T.forEach((e=>{var t;null===(t=e._widgets)||void 0===t||t.forEach((t=>{E(c.x0.slice.actions.registerWidgetObject({uniqid:t.widget.uniqid,object:e})),E(c.x0.slice.actions.registerWidgetObjectRights({uniqid:t.widget.uniqid,rights:e._right}))}))}))}),[T,E]),l().createElement(l().Fragment,null,q&&S&&l().createElement(l().Fragment,null,l().createElement(Jl,null,l().createElement(Yl,{canComment:n,loading:v,token:h,comments:T,onComment:Y,onCommentUpdate:t=>Nl(void 0,void 0,void 0,(function*(){var n,i;const l=T.find((e=>e.id===t.idComment));if(l)return L().article.updateComment({idComment:t.idComment,description:null!==(i=null!==(n=t.description)&&void 0!==n?n:l.description)&&void 0!==i?i:void 0,token:t.token,widgets:t.widgets}).then((()=>{E(c.Mw.actions.fetchComments({idArticle:e})),N()})).catch((e=>{P(e.errorMsg)}))})),onCommentDelete:t=>Nl(void 0,void 0,void 0,(function*(){E(c.Mw.actions.deleteComment({idComment:t,idArticle:e}))})),isWidgetActive:!(!(null==O?void 0:O.isActive)||!(null===(m=null==O?void 0:O.autorize)||void 0===m?void 0:m.includes("comment"))),canCreateWidget:!!((null==O?void 0:O.isActive)&&(null==O?void 0:O.create)&&(null===(g=null==O?void 0:O.autorize)||void 0===g?void 0:g.includes("comment"))),widgetListComponent:l().createElement(_t,{mode:"comment",namespace:"comment",onChange:e=>{x([e]),E(c.x0.slice.actions.registerWidget({uniqid:e.widget.uniqid,widget:e,context:"comment"})),b(void 0),N()},view:"edit"}),newWidgetsWrapperComponent:l().createElement(Hl,{widgets:C}),existingWidgetsWrapperComponent:(e,t,n,i=!0)=>l().createElement(Ul,{comment:e,widgets:t,mode:n,inplace:i,handleWidgetUpdate:U,handleWidgetRemove:N}),currentUser:W,tinyMCEConfig:{commonOptions:Object.assign(Object.assign({},q),{toolbar:S.commentsToolbar}),mentionsQueries:(0,Mt.X)(j,f,P)},onError:P,highlightFields:M.userHighlightFields,userAccountStatus:M.userAccountStatus,userModel:j.find((e=>"user"===e.type)),onGetHashError:e=>E(c.y8.actions.error({label:null!=e?e:p.formatMessage({id:"GLOBAL_Error"})})),activeDrives:[...I&&A?["fileBank"]:[],...c.qn.utils.buildDrivesArrayFromObject(null==A?void 0:A.drives)],variant:t,handlers:{drive:L().drive,filebank:L().filebank,file:L().file,user:L().user,global:L().global,questionAnswer:L().questionAnswer},socialQuestion:z?Object.assign(Object.assign({},z),{onSelectResponse:e=>{G(Object.assign(Object.assign({},z),{responseId:e,isResolved:!0}))},onUnselectResponse:()=>{G(Object.assign(Object.assign({},z),{responseId:void 0,isResolved:!1}))}}):void 0,articleId:e,additionalExtensions:[B],onReport:t=>V({articleId:e,commentUri:t,articleUri:d})}),l().createElement(pt,null))),H&&l().createElement(Mn,{onInsert:$,open:F,close:R}),D&&l().createElement(ee,Object.assign({onClose:()=>V(null)},D)))},Kl=()=>l().createElement(l().Fragment,null);var Xl=n(737);const Zl=d.j.getLazyComponent("Container"),eo=()=>l().createElement(i.Suspense,{fallback:l().createElement(l().Fragment,null)},l().createElement(Zl,{backgroundColor:"white",mode:"fluid",flexDirection:"column"},l().createElement(Xl.Outlet,null)));var to=n(286);const no=()=>{const[e,t]=(0,i.useState)(),n=(0,r.useIntl)(),l=(0,i.useMemo)((()=>{var e,t,n,i;return(null===(t=null===(e=J.hooks)||void 0===e?void 0:e.MagicWandHook)||void 0===t?void 0:t.isActive)&&(null===(i=null===(n=J.hooks)||void 0===n?void 0:n.MagicWandHook)||void 0===i?void 0:i.menuItems)&&J.hooks.MagicWandHook.menuItems.length}),[]),o=(0,i.useCallback)((e=>{t(Object.assign(Object.assign({},e),{reject:n=>{e.reject(n),t(void 0)},resolve:n=>{e.resolve(n),t(void 0)}}))}),[]),a=(0,i.useCallback)(((e,t)=>new Promise(((n,i)=>{o({reject:i,resolve:n,text:e,capability:t})}))),[o]),c=(0,i.useMemo)((()=>({develop:e=>a(e,"develop"),summarize:e=>a(e,"summarize"),tldr:e=>a(e,"tldr"),en:e=>a(e,"en"),es:e=>a(e,"es"),formal:e=>a(e,"formal"),funny:e=>a(e,"funny")})),[a]);return{query:e,ext:(0,i.useMemo)((()=>s.JTinyMCEExtensionsBuilders.jia(c,n)),[n,c]),isActive:l}},io=d.j.getLazyComponent("InputTinyMCE"),lo=e=>{const t=(0,r.useIntl)(),n=(0,u.jL)(),a=(0,o.useTheme)(),s=(0,u.GV)(c.Kx.selectors.selectAll),{query:d,ext:m,isActive:g}=no(),{open:p,onInsert:f,close:E,ext:h,isActive:b}=jt(),v=(0,i.useMemo)((()=>[...b?[h]:[],...g?[m]:[]]),[m,h,g,b]),y=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),C=(0,i.useMemo)((()=>(0,Mt.X)(s,a,y)),[s,y,a]),x=(0,i.useMemo)((()=>to.p9),[]);return l().createElement(l().Fragment,null,x&&l().createElement(io,Object.assign({commonOptions:x,additionalExtensions:v,mentionsQueries:C},e)),g&&l().createElement(T,{query:d}),b&&l().createElement(Mn,{onInsert:f,open:p,close:E}))},oo=d.j.getLazyComponent("InputTinyMCERaw"),ao=e=>{const t=(0,r.useIntl)(),n=(0,u.jL)(),a=(0,o.useTheme)(),s=(0,u.GV)(c.Kx.selectors.selectAll),{query:d,ext:m,isActive:g}=no(),{open:p,onInsert:f,close:E,ext:h,isActive:b}=jt(),v=(0,i.useMemo)((()=>[...b?[h]:[],...g?[m]:[]]),[m,h,g,b]),y=(0,i.useCallback)((e=>{n(c.y8.actions.error({label:null!=e?e:t.formatMessage({id:"GLOBAL_Error"})}))}),[n,t]),C=(0,i.useMemo)((()=>(0,Mt.X)(s,a,y)),[s,y,a]),x=(0,i.useMemo)((()=>to.p9),[]);return l().createElement(l().Fragment,null,x&&l().createElement(oo,Object.assign({commonOptions:x,additionalExtensions:v,mentionsQueries:C},e)),g&&l().createElement(T,{query:d}),b&&l().createElement(Mn,{onInsert:f,open:p,close:E}))},ro=d.j.getLazyComponent("InputAudience"),so=d.j.getLazyComponent("Message"),co=d.j.getLazyComponent("Modal"),uo=({open:e,closeHandler:t,title:n,control:i,warningMessage:o,onSubmit:a,name:s="publishTo"})=>{const c=(0,r.useIntl)();return l().createElement(co,{open:e,closeHandler:t,title:null!=n?n:c.formatMessage({id:"GLOBAL_Audience"}),buttons:[{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Cancel"}),color:"cancel",clickHandler:()=>t()},{children:l().createElement(r.FormattedMessage,{id:"GLOBAL_Continue"}),color:"danger",clickHandler:()=>{t(),a()}}]},l().createElement(so,{variant:"warning",message:null!=o?o:c.formatMessage({id:"FORM_Audience_Empty"})}),l().createElement(ro,{asyncPromise:e=>L().audience.autocomplete(e),searchable:!0,control:i,multiple:!0,placeholder:c.formatMessage({id:"GLOBAL_Audience"}),name:s}))},mo=d.j.getLazyComponent("Container"),go=d.j.getLazyComponent("AppColumn"),po=d.j.getLazyComponent("MainColumn");function fo({extensionRoute:e,routes:t,description:n,mode:o="center",mainColumnProps:a}){var s;const c=(0,r.useIntl)(),{pathname:d}=(0,Xl.useLocation)(),u=(0,i.useMemo)((()=>Object.values(t)),[t]),[m,g]=(0,i.useState)(null===(s=null==u?void 0:u[0])||void 0===s?void 0:s.key),p=u.map((t=>Object.assign(Object.assign({},t),{label:c.formatMessage({id:t.label}),href:t.absolutePath?t.path:`/ng/rr/${e}/${t.path}`,group:t.group?c.formatMessage({id:t.group}):void 0})));return(0,i.useEffect)((()=>{const t=u.find((t=>{var n;return`/ng/rr/${e}/${t.path}`===d||(null===(n=t.paths)||void 0===n?void 0:n.reduce(((t,n)=>{const i=`/ng/rr/${e}/${n}`,l=null!==(0,Xl.matchPath)(i,d);return t||l}),!1))}));t&&g(t.key)}),[d,u,e]),l().createElement(i.Suspense,{fallback:l().createElement(l().Fragment,null)},l().createElement(mo,{mode:o},l().createElement(go,{mode:o,description:n,tabs:p,activeTab:m||""}),l().createElement(po,Object.assign({mode:o,flex:!0},a),l().createElement(Xl.Outlet,null))))}}}]);
|
|
648
|
-
//# sourceMappingURL=199.
|
|
648
|
+
//# sourceMappingURL=199.83ea2a609bf40e7e1d98.chunk.js.map
|