"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[6676],{26676:(e,t,s)=>{s.r(t),s.d(t,{default:()=>C});var i=s(37270),n=s(32446),r=s(97282),o=s(35631),a=s(57898),c=s(8361),m=s(65952),d=s(26614),l=s(77440),p=s(80635),u=s(63647);const y=[];var h=s(62688),f=s.n(h),g=(s(17046),s(4290),s(36418)),v=s.n(g),b=s(14778),_=s(37266),A=s(78451);function E(e,t,s){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class S extends v().PureComponent{constructor(){var e;super(...arguments),e=this,E(this,"getCurrentNotice",(()=>{for(const t of this.props.notices){var e;if(!this.props.dismissedNotices[t.name]&&!this.props.preferences[t.name]&&(!t.adminOnly||this.props.isSystemAdmin)&&null!==(e=t.show)&&void 0!==e&&e.call(t,this.props.serverVersion,this.props.config,this.props.license,this.props.analytics,this.props.currentChannel))return t}return null})),E(this,"hide",(function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const s=e.getCurrentNotice();s&&(t||e.props.actions.savePreferences(e.props.currentUserId,[{user_id:e.props.currentUserId,category:A.pm.CATEGORY_SYSTEM_NOTICE,name:s.name,value:"dismissed"}]),e.props.actions.dismissNotice(s.name))})),E(this,"hideAndRemind",(()=>{this.hide(!0)})),E(this,"hideAndForget",(()=>{this.hide(!1)}))}componentDidMount(){this.props.isSystemAdmin&&this.props.actions.getStandardAnalytics()}componentDidUpdate(e){e.isSystemAdmin!==this.props.isSystemAdmin&&this.props.isSystemAdmin&&this.props.actions.getStandardAnalytics()}render(){const e=this.getCurrentNotice();if(null==e)return null;let t;e.adminOnly&&(t=v().createElement("div",{className:"system-notice__info"},v().createElement("i",{className:"fa fa-eye",title:this.props.intl.formatMessage({id:"system_notice.adminVisible.icon",defaultMessage:"Only visible to System Admins Icon"})}),v().createElement(b.FormattedMessage,{id:"system_notice.adminVisible",defaultMessage:"Only visible to System Admins"})));const s=e.icon||v().createElement(_.A,null);return v().createElement("div",{className:"system-notice bg--white"},v().createElement("div",{className:"system-notice__logo"},s),v().createElement("div",{className:"system-notice__body"},v().createElement("div",{className:"system-notice__title"},e.title),e.body,t,v().createElement("div",{className:"system-notice__footer"},v().createElement("button",{id:"systemnotice_remindme",className:"btn btn-sm btn-primary",onClick:this.hideAndRemind},v().createElement(b.FormattedMessage,{id:"system_notice.remind_me",defaultMessage:"Remind Me Later"})),e.allowForget&&v().createElement("button",{id:"systemnotice_dontshow",className:"btn btn-sm btn-tertiary",onClick:this.hideAndForget},v().createElement(b.FormattedMessage,{id:"system_notice.dont_show",defaultMessage:"Don't Show Again"})))))}}E(S,"propTypes",{currentUserId:f().string.isRequired,notices:f().array.isRequired,preferences:f().objectOf(f().any).isRequired,dismissedNotices:f().any.isRequired,isSystemAdmin:f().bool,serverVersion:f().string.isRequired,actions:f().shape({}).isRequired});const N=(0,b.injectIntl)(S),M=(0,l.dI)("getSystemNoticePreferences",A.pm.CATEGORY_SYSTEM_NOTICE),w=(0,c.Mz)("getPreferenceNameMap",M,(e=>{const t={};return e.forEach((e=>{t[e.name]=e})),t})),C=(0,i.connect)((function(e){const t=(0,d.Ay)(e),s=(0,d.zj)(e),i=e.entities.general.serverVersion,n=e.entities.admin.analytics;return{currentUserId:e.entities.users.currentUserId,preferences:w(e),dismissedNotices:e.views.notice.hasBeenDismissed,isSystemAdmin:(0,p.y4)(e,{permission:a.xB.MANAGE_SYSTEM}),notices:y,config:s,license:t,serverVersion:i,analytics:n,currentChannel:(0,m.Lw)(e)}}),(function(e){return{actions:(0,n.zH)({savePreferences:o.SF,dismissNotice:u.L,getStandardAnalytics:r.ur},e)}}))(N)}}]);
//# sourceMappingURL=6676.078c12aca657f180d333.js.map