jamespot-react-core 1.2.27 → 1.2.28
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:()=>M,AddReportModal:()=>Z,Audience:()=>x,Avatar:()=>g,CommentsBloc:()=>Jl,DisplayForm:()=>F,Editor:()=>Ge,EditorsPortal:()=>ut,Empty:()=>Ql,FullPageLayout:()=>Zl,JRCInputTinyMCEWithExt:()=>io,JRCInputTinyMCEWithExtRaw:()=>oo,MarkdownModal:()=>jn,ModalAudience:()=>co,TwoColLayout:()=>po,WidgetList:()=>Wt,WidgetWrapperCore:()=>Vl});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:()=>M,AddReportModal:()=>Z,Audience:()=>x,Avatar:()=>g,CommentsBloc:()=>Jl,DisplayForm:()=>F,Editor:()=>Ge,EditorsPortal:()=>ut,Empty:()=>Ql,FullPageLayout:()=>Zl,JRCInputTinyMCEWithExt:()=>io,JRCInputTinyMCEWithExtRaw:()=>oo,MarkdownModal:()=>jn,ModalAudience:()=>co,TwoColLayout:()=>po,WidgetList:()=>Wt,WidgetWrapperCore:()=>Vl});var i=n(594),l=n.n(i),o=n(196),a=n.n(o),r=n(493),s=n(947),c=n(59),d=n(996),u=n(683);const m=d.j.getLazyComponent("Icon"),g=e=>{var t;const n=(0,o.useTheme)(),i=(0,u.GV)(c.Bx.selectors.selectNetworkPublic);return e.uri===(null==i?void 0:i.uri)?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(s.JRCAvatar,Object.assign({},e))},p=d.j.getLazyComponent("FlexBox"),f=d.j.getLazyComponent("ModalContent"),E=d.j.getLazyComponent("ModalLayout"),h=d.j.getLazyComponent("StyledHref"),b=d.j.getLazyComponent("Tooltip"),v=d.j.getLazyComponent("Typography"),y=a().div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 12px;
|
|
@@ -643,4 +643,4 @@
|
|
|
643
643
|
width: 100%;
|
|
644
644
|
margin-top: 10px;
|
|
645
645
|
`,Jl=({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,L]=(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}=St();(0,ee.A)(e),((e,t)=>{const n=(0,u.jL)(),l=(0,i.useMemo)((()=>te.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||(L(!0),k().network.token().then((e=>{b(e.result),L(!1),E(c.x0.slice.actions.setToken({token:e.result}))})).catch((e=>{P(e.errorMsg)})))}),[P,h,w,E]),Y=(0,i.useCallback)((t=>Ul(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 k().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(Yl,null,l().createElement(Nl,{canComment:n,loading:v,token:h,comments:T,onComment:Y,onCommentUpdate:t=>Ul(void 0,void 0,void 0,(function*(){var n,i;const l=T.find((e=>e.id===t.idComment));if(l)return k().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=>Ul(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(Wt,{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(Bl,{widgets:C}),existingWidgetsWrapperComponent:(e,t,n,i=!0)=>l().createElement(Pl,{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,jt.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:k().drive,filebank:k().filebank,file:k().file,user:k().user,global:k().global,questionAnswer:k().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(gt,null))),H&&l().createElement(jn,{onInsert:$,open:F,close:R}),D&&l().createElement(Z,Object.assign({onClose:()=>V(null)},D)))},Ql=()=>l().createElement(l().Fragment,null);var Xl=n(737);const Kl=d.j.getLazyComponent("Container"),Zl=()=>l().createElement(i.Suspense,{fallback:l().createElement(l().Fragment,null)},l().createElement(Kl,{backgroundColor:"white",mode:"fluid",flexDirection:"column"},l().createElement(Xl.Outlet,null)));var eo=n(286);const to=()=>{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}},no=d.j.getLazyComponent("InputTinyMCE"),io=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}=to(),{open:p,onInsert:f,close:E,ext:h,isActive:b}=St(),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,jt.X)(s,a,y)),[s,y,a]),x=(0,i.useMemo)((()=>eo.p9),[]);return l().createElement(l().Fragment,null,x&&l().createElement(no,Object.assign({commonOptions:x,additionalExtensions:v,mentionsQueries:C},e)),g&&l().createElement(M,{query:d}),b&&l().createElement(jn,{onInsert:f,open:p,close:E}))},lo=d.j.getLazyComponent("InputTinyMCERaw"),oo=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}=to(),{open:p,onInsert:f,close:E,ext:h,isActive:b}=St(),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,jt.X)(s,a,y)),[s,y,a]),x=(0,i.useMemo)((()=>eo.p9),[]);return l().createElement(l().Fragment,null,x&&l().createElement(lo,Object.assign({commonOptions:x,additionalExtensions:v,mentionsQueries:C},e)),g&&l().createElement(M,{query:d}),b&&l().createElement(jn,{onInsert:f,open:p,close:E}))},ao=d.j.getLazyComponent("InputAudience"),ro=d.j.getLazyComponent("Message"),so=d.j.getLazyComponent("Modal"),co=({open:e,closeHandler:t,title:n,control:i,warningMessage:o,onSubmit:a,name:s="publishTo"})=>{const c=(0,r.useIntl)();return l().createElement(so,{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(ro,{variant:"warning",message:null!=o?o:c.formatMessage({id:"FORM_Audience_Empty"})}),l().createElement(ao,{asyncPromise:e=>k().audience.autocomplete(e),searchable:!0,control:i,multiple:!0,placeholder:c.formatMessage({id:"GLOBAL_Audience"}),name:s}))},uo=d.j.getLazyComponent("Container"),mo=d.j.getLazyComponent("AppColumn"),go=d.j.getLazyComponent("MainColumn");function po({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(uo,{mode:o},l().createElement(mo,{mode:o,description:n,tabs:p,activeTab:m||""}),l().createElement(go,Object.assign({mode:o,flex:!0},a),l().createElement(Xl.Outlet,null))))}}}]);
|
|
646
|
-
//# sourceMappingURL=199.
|
|
646
|
+
//# sourceMappingURL=199.091f4448d6a2131280cb.chunk.js.map
|