1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8615],{49718:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/user/notifications",function(){return n(87549)}])},87549:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return z},default:function(){return F}});var r=n(29071),i=n(90678),s=n(70520),o=n(75271),c=n(65652),a=n(52058),l=n(40761),d=n(29087),u=n(86492),h=n(51686),p=n(94132),f=n(69110),y=n(37531),g=n(51335);class w extends o.Component{async onSubmit(e,t){let{onSubmit:n,t:r}=this.props;try{await n(e),t.setSubmitting(!1),(0,g.Am)(r("user/notificationSettings.success"))}catch(e){if(500===e.status)g.Am.error(r("common/error.internalServerError"));else{let n=(0,l.z)(e.error);n.base&&g.Am.error(n.base),t.setErrors(n),t.setSubmitting(!1)}}}render(){let{t:e,initialValues:t}=this.props;return(0,r.tZ)(p.s,{title:(0,r.tZ)(h.H4,{children:e("accountDetails/notifications.notificationSettings")}),children:(0,r.tZ)(f.J9,{initialValues:t,onSubmit:this.onSubmit,children:t=>{let{errors:n,handleChange:i,touched:s,values:o,isSubmitting:a}=t;return(0,r.BX)(f.l0,{children:[(0,r.tZ)(c.Z,{desktop:"0 0 25px",children:(0,r.tZ)(u.X,{label:e("accountDetails/notifications.creditsBalance"),inputId:"notifyWhenLowCredits",checked:o.notifyWhenLowCredits,name:"notifyWhenLowCredits",onChange:i,error:s.notifyWhenLowCredits&&n.notifyWhenLowCredits})}),(0,r.tZ)(c.Z,{desktop:"0 0 25px",children:(0,r.tZ)(u.X,{label:e("accountDetails/notifications.creditBundle"),inputId:"notifyOnCreditBundlePurchase",checked:o.notifyOnCreditBundlePurchase,name:"notifyOnCreditBundlePurchase",onChange:i,error:s.notifyOnCreditBundlePurchase&&n.notifyOnCreditBundlePurchase})}),(0,r.tZ)(d.zx,{type:"submit",isLoading:a,variant:d.Wu.Loop,children:e("common/label.save")})]})}})})}constructor(e){super(e),this.onSubmit=this.onSubmit.bind(this)}}let m=(0,y.Zh)()((0,i.Pi)(w));var b=n(15767),Z=n(23293),P=n(20059),S=n(88868),C=n(69315);class B extends C.y{}B.type=P.H.NEWSLETTER_SUBSCRIPTION,(0,b.gn)([S.vg,(0,b.w6)("design:type",Boolean)],B.prototype,"subscribed",void 0),(0,b.gn)([S.vg,(0,b.w6)("design:type",String)],B.prototype,"subscriptionUrl",void 0);var v=n(53689),x=n(75470),E=n(78266);class N extends o.Component{render(){let{onClick:e}=this.props;return(0,r.tZ)(v.xv,{color:v.d9.Error,children:(0,r.BX)(y.cC,{i18nKey:"accountDetails/notifications.errorLoadingPreferences",children:["Something went wrong.",(0,r.tZ)(E.A,{onClick:e,type:E.w.Primary,children:"Click here"}),"to try again."]})})}}let _=(0,i.Pi)(N);var k=n(5325),L=n(66810),D=n(29132);class I extends o.Component{render(){let{t:e}=this.props;return(0,r.BX)(k.kC,{spacing:"16px",children:[(0,r.tZ)(L.B,{children:(0,r.tZ)(D.H,{className:"text-text-action-primary stroke-3"})}),(0,r.tZ)(L.B,{children:(0,r.tZ)(v.xv,{children:e("accountDetails/notifications.loadingPreferences")})})]})}}let O=(0,y.Zh)()((0,i.Pi)(I));class T extends o.Component{render(){let{preferences:e}=this.props;return(0,r.tZ)(v.xv,{children:e.subscribed?(0,r.BX)(y.cC,{i18nKey:"accountDetails/notifications.updateNewsletterPreferences",children:["Update your newsletter preferences",(0,r.tZ)(E.A,{bold:!0,size:E.R.Normal,type:E.w.Primary,href:e.subscriptionUrl,target:"_blank",children:"here"}),"."]}):(0,r.BX)(y.cC,{i18nKey:"accountDetails/notifications.subscribeToNewsletter",children:["Subscribe to our newsletter",(0,r.tZ)(E.A,{bold:!0,size:E.R.Normal,type:E.w.Primary,href:e.subscriptionUrl,target:"_blank",children:"here"}),"."]})})}}let U=(0,i.Pi)(T);class X extends o.Component{async fetchPreferences(){let{dataStore:e}=this.props;this.setIsLoading(!0),this.setError(!1);try{await e.fetch(P.H.NEWSLETTER_SUBSCRIPTION,e.currentUser.id)}catch(e){this.setError(!0)}this.setIsLoading(!1)}setIsLoading(e){this.componentState.loading=e}setError(e){this.componentState.error=e}get preferences(){let{dataStore:e}=this.props;return e.findOne(P.H.NEWSLETTER_SUBSCRIPTION,e.currentUser.id)}componentDidMount(){this.fetchPreferences()}render(){let{t:e}=this.props,{loading:t,error:n}=this.componentState;return(0,r.BX)(p.s,{title:(0,r.tZ)(h.H4,{children:e("accountDetails/notifications.newsletterPreferences")}),children:[(0,r.tZ)(c.Z,{desktop:"0 0 16px",children:(0,r.BX)(x.Ul,{variant:x.v.Default,children:[(0,r.tZ)(v.xv,{children:e("accountDetails/notifications.newsletter1")}),(0,r.tZ)(v.xv,{children:e("accountDetails/notifications.newsletter2")}),(0,r.tZ)(v.xv,{children:e("accountDetails/notifications.newsletter3")})]})}),t?(0,r.tZ)(O,{}):n?(0,r.tZ)(_,{onClick:this.fetchPreferences}):(0,r.tZ)(U,{preferences:this.preferences})]})}constructor(e){super(e),this.componentState={loading:!0,error:!1},this.fetchPreferences=this.fetchPreferences.bind(this)}}(0,b.gn)([Z.LO,(0,b.w6)("design:type","undefined"==typeof INewsletterPreferencesState?Object:INewsletterPreferencesState)],X.prototype,"componentState",void 0),(0,b.gn)([Z.aD.bound,(0,b.w6)("design:type",Function),(0,b.w6)("design:paramtypes",[Boolean]),(0,b.w6)("design:returntype",void 0)],X.prototype,"setIsLoading",null),(0,b.gn)([Z.aD.bound,(0,b.w6)("design:type",Function),(0,b.w6)("design:paramtypes",[Boolean]),(0,b.w6)("design:returntype",void 0)],X.prototype,"setError",null),(0,b.gn)([Z.Fl,(0,b.w6)("design:type",Function),(0,b.w6)("design:paramtypes",[]),(0,b.w6)("design:returntype",B)],X.prototype,"preferences",null);let W=(0,y.Zh)()((0,i.f3)("dataStore")((0,i.Pi)(X)));var R=n(76120),H=n(77554),A=n(10098),z=!0,F=(0,i.f3)("store")((0,i.Pi)(e=>{let{store:t}=e,n={notifyWhenLowCredits:t.data.currentUser.notifyWhenLowCredits,notifyOnCreditBundlePurchase:t.data.currentUser.notifyOnCreditBundlePurchase},i=async e=>{await (0,A.gS)(t.data,e)};return(0,r.BX)(r.HY,{children:[(0,r.tZ)(s.PB,{title:t.data.currentUser.publicName}),(0,r.tZ)(R.i,{activeId:H.T.Notifications,children:(0,r.BX)(a.P,{desktop:"560px",children:[(0,r.tZ)(c.Z,{desktop:"0 0 50px",children:(0,r.tZ)(W,{})}),(0,r.tZ)(m,{initialValues:n,onSubmit:i})]})})]})}))}},function(e){e.O(0,[8135,6120,2888,9774,179],function(){return e(e.s=49718)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.