"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[6676],{26676(e,s,t){t.r(s),t.d(s,{default:()=>M}),t(43617),t(99930);var i=t(37270),n=t(32446),r=t(97282),o=t(35631),a=t(26366),c=t(8361),m=t(65952),d=t(26614),l=t(77440),p=t(80635),h=t(63647);const u=[];var y=t(36418),f=t(14778),g=t(14891),_=t(37266),A=t(81444);class E extends y.PureComponent{componentDidMount(){this.props.isSystemAdmin&&this.props.actions.getStandardAnalytics()}componentDidUpdate(e){e.isSystemAdmin!==this.props.isSystemAdmin&&this.props.isSystemAdmin&&this.props.actions.getStandardAnalytics()}getCurrentNotice=()=>{for(const e of this.props.notices)if(!this.props.dismissedNotices[e.name]&&!this.props.preferences[e.name]&&(!e.adminOnly||this.props.isSystemAdmin)&&e.show?.(this.props.serverVersion,this.props.config,this.props.license,this.props.analytics,this.props.currentChannel))return e;return null};hide=(e=!1)=>{const s=this.getCurrentNotice();s&&(e||this.props.actions.savePreferences(this.props.currentUserId,[{user_id:this.props.currentUserId,category:A.pm.CATEGORY_SYSTEM_NOTICE,name:s.name,value:"dismissed"}]),this.props.actions.dismissNotice(s.name))};hideAndRemind=()=>{this.hide(!0)};hideAndForget=()=>{this.hide(!1)};render(){const e=this.getCurrentNotice();if(null==e)return null;let s;e.adminOnly&&(s=y.createElement("div",{className:"system-notice__info"},y.createElement("i",{className:"fa fa-eye",title:this.props.intl.formatMessage({id:"system_notice.adminVisible.icon",defaultMessage:"Only visible to System Admins Icon"})}),y.createElement(f.FormattedMessage,{id:"system_notice.adminVisible",defaultMessage:"Only visible to System Admins"})));const t=e.icon||y.createElement(_.A,null);return y.createElement("div",{className:"system-notice bg--white"},y.createElement("div",{className:"system-notice__logo"},t),y.createElement("div",{className:"system-notice__body"},y.createElement("div",{className:"system-notice__title"},e.title),e.body,s,y.createElement("div",{className:"system-notice__footer"},y.createElement(g.Button,{id:"systemnotice_remindme",emphasis:"primary",size:"sm",onClick:this.hideAndRemind},y.createElement(f.FormattedMessage,{id:"system_notice.remind_me",defaultMessage:"Remind Me Later"})),e.allowForget&&y.createElement(g.Button,{id:"systemnotice_dontshow",emphasis:"tertiary",size:"sm",onClick:this.hideAndForget},y.createElement(f.FormattedMessage,{id:"system_notice.dont_show",defaultMessage:"Don't Show Again"})))))}}const S=(0,f.injectIntl)(E),N=(0,l.dI)("getSystemNoticePreferences",A.pm.CATEGORY_SYSTEM_NOTICE),v=(0,c.Mz)("getPreferenceNameMap",N,e=>{const s={};return e.forEach(e=>{s[e.name]=e}),s}),M=(0,i.connect)(function(e){const s=(0,d.Ay)(e),t=(0,d.zj)(e),i=e.entities.general.serverVersion,n=e.entities.admin.analytics;return{currentUserId:e.entities.users.currentUserId,preferences:v(e),dismissedNotices:e.views.notice.hasBeenDismissed,isSystemAdmin:(0,p.y4)(e,{permission:a.xB.MANAGE_SYSTEM}),notices:u,config:t,license:s,serverVersion:i,analytics:n,currentChannel:(0,m.Lw)(e)}},function(e){return{actions:(0,n.zH)({savePreferences:o.SF,dismissNotice:h.L,getStandardAnalytics:r.ur},e)}})(S)}}]);
//# sourceMappingURL=6676.64794624c2f19dd232a9.js.map