"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["3658"],{70149:function(e,t,i){i.d(t,{Z:()=>o});var a=i(7409),n=i(99282),l=i(16584),r=i(64515);let o=e=>(0,l.BX)(r.l,(0,n._)((0,a._)({},e),{name:"BannedIcon",svgParams:{height:100,width:100},additionalStaticParams:{preserveAspectRatio:"none"},children:[(0,l.tZ)("circle",{cx:"50",cy:"50",stroke:"#000000",r:46,strokeWidth:"8"}),(0,l.tZ)("line",{x1:"20",y1:"20",x2:"80",y2:"80",stroke:"#000000",strokeWidth:"8"})]}))},42493:function(e,t,i){i.d(t,{FQ:()=>q,EB:()=>W,_0:()=>V});var a=i(27412),n=i(7409),l=i(99282);if(!/^(6673|7778|9049)$/.test(i.j))var r=i(98848);var o=i(58865),s=i(16584),c=i(6400),d=i(30396),u=i(94184),h=i.n(u),p=i(14293),m=i.n(p),b=i(50486),v=i(887),f=i(95441),y=i(98914),g=i(94874),Z=i(71068),_=i(15771);let k=e=>{let{photoUrl:t,newPhotoUrl:i,newPhotoOrientation:a,updatePhoto:n}=e,l=(0,d.sO)(null),{iString:r}=(0,f.M1)(),o=async()=>{var e;let t,i;if(!l.current)return;let a=null===(e=l.current.files)||void 0===e?void 0:e[0];if(l.current.value="",!a){n({newPhotoUrl:null,newPhotoOrientation:null});return}try{t=await (0,y.Zk)(a)}catch(e){console.error("Failed to get data URL from file:",e),alert(e.message);return}try{i=await (0,y.oA)(a)}catch(e){console.error("Failed to extract EXIF data from file:",e)}n({newPhotoUrl:t,newPhotoOrientation:i})};return(0,s.BX)(Z.xu,{position:"relative",children:[(0,s.tZ)(g.qE,{size:94,photoUrl:i||t||void 0,className:"avatar-pXO8aB"}),(0,s.BX)(_.hU,{priority:"secondary",size:"sm",className:"addButton-F9NSy4",rounded:!0,onClick:()=>{var e;null===(e=l.current)||void 0===e||e.click()},"aria-label":r("Edit profile image"),children:[(0,s.tZ)("input",{ref:l,type:"file",name:"photo",accept:"image/*",onChange:o,className:"input-QmLEx0"}),(0,s.tZ)(v.Z,{size:16})]})]})};var x=i(20253),B=i(93666),C=i(57391),w=i(68833),S=i(48980),X=i(17352),E=i(82402),N=i(19081),I=i(1844),F=i(68709),P=i(38841),T=i(17688),L=i(58175),O=i(64300),R=i(51776),z=i(57641),U=i(60308),D=i(70408);let A={checkbox:"checkbox-jbvy_H",tosCheckboxContainer:"tosCheckboxContainer-vfMi_Y"};function j(){let e=(0,o._)([""," on Substack"]);return j=function(){return e},e}let H=e=>{let{sub:t,onSetVisibility:i}=e,a=t.publication;return(0,s.BX)("div",{className:"edit-sub-visibility-row",children:[(0,s.BX)("div",{className:"left",children:[(0,s.tZ)(P.wk,{pub:a}),(0,s.tZ)("span",{children:a.name})]}),(0,s.tZ)("div",{className:"right",children:(0,s.tZ)(b.p,{checked:"public"===t.visibility,onChange:()=>i("public"===t.visibility?"private":"public")})})]})},q=e=>{let{profile:t,onFinalizeVisibility:i,onSetVisibility:a,source:r}=e,{iString:o}=(0,f.M1)();if(!t)return null;let c=t.subscriptions.every(e=>{let{visibility:t}=e;return"public"===t}),d=e=>i=>{a(t.subscriptions.reduce((t,a)=>{let{visibility:r,publication:o}=a;return(0,l._)((0,n._)({},t),{[o.id]:o.id===e.id?i:r})},{})),(0,w.j)(w.FP.PROFILE_EDITED,{type:"read_visibility_toggled",visibility:i})},u=(0,s.tZ)("button",{className:"small",onClick:()=>{a(t.subscriptions.reduce((e,t)=>{let{publication:i}=t;return(0,l._)((0,n._)({},e),{[i.id]:c?"private":"public"})},{})),(0,w.j)(w.FP.PROFILE_EDITED,{type:"visibility_toggled_all",for:"reads",count:t.subscriptions.length})},children:o(c?"Hide all":"Show all")});return(0,s.BX)("div",{className:"edit-sub-visibility-form",children:[(0,s.tZ)("div",{className:"bulk-action-row",children:u}),(0,s.tZ)("div",{className:"edit-sub-visibility-frame",children:t.subscriptions.map(e=>(0,s.tZ)(H,{sub:e,onSetVisibility:d(e.publication),source:r}))}),(0,s.tZ)("div",{className:"modal-ctas",children:(0,s.tZ)(_.zx,{priority:"primary",onClick:i,children:o("Done")})})]})};class M extends c.Component{componentDidMount(){if(this.props.autoSubmit){var e,t,i;this.isComplete()?null===(e=this.formRef.current)||void 0===e||e.handleSubmit():null===(t=(i=this.props).onAutoSubmitFailed)||void 0===t||t.call(i)}}isComplete(){let{user:e,needsPhoto:t}=this.props;return e&&!e.is_magic&&e.name&&(!t||e.photo_url)}async onFileInputChanged(){var e,t;let i,a;let n=null===(t=this.fileInput)||void 0===t?void 0:null===(e=t.files)||void 0===e?void 0:e[0];if(this.fileInput&&(this.fileInput.value=""),!n){this.setState({newPhotoUrl:null,newPhotoOrientation:null});return}try{i=await (0,y.Zk)(n)}catch(e){console.error("Failed to get data URL from file:",e),alert(e.message);return}try{a=await (0,y.oA)(n)}catch(e){console.error("Failed to extract EXIF data from file:",e)}this.setState({newPhotoUrl:i,newPhotoOrientation:a})}onError(e){var t,i,a;this.props.autoSubmit&&!this.state.autoSubmitFailed&&(this.setState({autoSubmitFailed:!0}),null===(i=(a=this.props).onAutoSubmitFailed)||void 0===i||i.call(a)),this.setState({sentLoginEmail:!1}),(null===(t=e.response)||void 0===t?void 0:t.status)===401&&this.sendLoginEmail()}async createDefaultPublication(e,t){let{iTemplate:i}=this.props;try{let a=await (0,S.rd)("/api/v1/publication/suggestion"),n=t||i(j(),e);await (0,S.rd)("/api/v1/publication",{method:"post",json:{name:e,subdomain:a.subdomain,hero_text:n,tos:!0}})}catch(e){(0,w.j)(w.FP.DEFAULT_PUBLICATION_CREATION_FAILED),console.warn("couldn't set up a default publication",e)}}async sendLoginEmail(){let e=this.state.newEmail||this.props.freeSignupEmail;if(!this.state.loading&&e){this.setState({loading:!0});try{await (0,S.rd)("/api/v1/email-login",{method:"post",json:{email:e,redirect:document.location.href}}),this.setState({sentLoginEmail:!0})}catch(e){console.error("Failed send login email:",e)}this.setState({loading:!1})}}render(e,t){let{className:i,user:a,numVisibleSubscriptions:n,numSubscriptions:l,freeSignup:r,freeSignupEmail:o,initialPhotoUrl:c,needsPhoto:d,optionalPhoto:u,showHandle:p=!0,token:b,text:v,onSuccess:f,prepareData:y,pageTitle:g,primaryEligiblePublications:B,isPostInvite:C,complete:w,profileExists:S,onSkip:U,onEditReadVisibility:j,barebones:H,onEditRecommendations:q,numRecommendationsToMake:M,noSubscribeCta:V,style:W,iString:Y,iPlural:J,showSocialHandle:K,pub:Q}=e,{newPhotoUrl:$,newPhotoOrientation:G,newName:ee,newHandle:et,newEmail:ei,loading:ea,sentLoginEmail:en,sentAccountConfirmationEmail:el,newBio:er,createPublication:eo,selectedSocial:es,selectedSocialHandle:ec,tosAccepted:ed,subscribeToNewsletter:eu}=t,eh=$||c||(0,D.ln)(a,{}),ep="string"==typeof g?g:Y(this.isComplete()?"Update your profile":"Create your profile"),em=ee||a&&a.name||"",eb=et||(null==a?void 0:a.handle)||"",ev="string"==typeof er?er:a&&a.bio||"",ef=(!a||a.is_magic)&&!o&&!C,ey=!S&&!!q&&!m()(M)&&M>0,eg=C&&B&&(null==a?void 0:a.has_publication)&&B.length>1,eZ="number"==typeof n&&!m()(l)&&l>0&&j,e_=!V&&!(a&&(a.is_subscribed||a.is_free_subscribed)||r),ek=C&&!(null==a?void 0:a.has_publication),ex=async(e,t)=>{if(e.body.emailConfirmationRequired){this.setState({sentAccountConfirmationEmail:!0});return}eo&&await this.createDefaultPublication(em,ev),f(e,t)};return(0,s.BX)("div",{className:h()("profile-updater",i),style:W,children:[(0,s.tZ)(L.xv.H4,{align:"left",paddingBottom:20,children:ep}),(eh||d||u)&&(0,s.tZ)(N.X2,{flex:"grow",justifyContent:"center",alignItems:"center",children:(0,s.tZ)(k,{photoUrl:eh,newPhotoUrl:$,newPhotoOrientation:G,updatePhoto:e=>{let{newPhotoOrientation:t,newPhotoUrl:i}=e;return this.setState({newPhotoOrientation:t,newPhotoUrl:i})}})}),(0,s.BX)(x.ZP,{ref:this.formRef,method:"put",action:"/api/v1/user/profile",prepareData:y,onSuccess:ex,onError:e=>this.onError(e),noInlineErrors:!0,loading:ea,autoLock:!0,children:[(0,s.BX)(N.sg,{gap:20,children:[(0,s.BX)(R.fv,{children:[(0,s.tZ)(F.Y5,{htmlFor:"name",children:Y("Name")}),Q?(0,s.tZ)("input",{type:"hidden",name:"pub_id",value:Q.id}):null,(0,s.tZ)(R.oi,{autoFocus:!0,type:"text",className:"profile-name",placeholder:Y("Type your name..."),name:"name",id:"name",value:em,onInput:e=>{this.setState({newName:e.currentTarget.value})}})]}),ef&&(0,s.BX)(R.fv,{children:[(0,s.tZ)(F.Y5,{htmlFor:"email",children:Y("Email")}),(0,s.tZ)(R.oi,{type:"email",placeholder:Y("Enter your email address..."),name:"email",value:null!=ei?ei:void 0,onInput:e=>{this.setState({newEmail:e.currentTarget.value})}})]}),p&&(0,s.BX)(R.fv,{children:[(0,s.tZ)(F.__,{htmlFor:"handle",children:Y("Handle")}),(0,s.tZ)(R.oi,{type:"text",className:"profile-name",placeholder:Y("Type your handle..."),name:"handle",id:"handle",value:eb,onInput:e=>{this.setState({newHandle:e.currentTarget.value})}})]}),!H&&(0,s.BX)(R.fv,{children:[(0,s.tZ)(F.__,{htmlFor:"bio",children:Y("Bio")}),(0,s.tZ)(O.g,{placeholder:Y("Say something about yourself..."),name:"bio",id:"bio",value:ev,onInput:e=>{this.setState({newBio:e.currentTarget.value})}}),C&&(0,s.tZ)(I.p6,{align:"left",children:Y("Tip: this will be shown at the bottom of your guest post")})]}),C&&(0,s.tZ)("input",{type:"hidden",name:"needs_bio",value:"true"}),K&&(0,s.BX)(R.fv,{children:[(0,s.tZ)(F.OV,{htmlFor:"social",hint:Y("Optional"),children:Y("Where else can you be found?")}),(0,s.BX)(N.X2,{gap:8,children:[(0,s.BX)(T.i,{name:"social",value:es,onChange:e=>{this.setState({selectedSocial:e.currentTarget.value})},children:[(0,s.tZ)(T.d,{children:Y("Select a social network")}),(0,s.tZ)("option",{value:"twitter",children:Y("Twitter")}),(0,s.tZ)("option",{value:"instagram",children:Y("Instagram")}),(0,s.tZ)("option",{value:"tiktok",children:Y("Tiktok")}),(0,s.tZ)("option",{value:"linkedin",children:Y("LinkedIn")}),(0,s.tZ)("option",{value:"youtube",children:Y("Youtube")})]}),(0,s.tZ)(R.oi,{flex:"grow",type:"text",placeholder:Y("@yourhandle"),name:"socialHandle",value:ec,onInput:e=>{this.setState({selectedSocialHandle:e.currentTarget.value})}})]})]}),eg&&(0,s.BX)(R.fv,{children:[(0,s.tZ)(F.__,{children:Y("Publication to display")}),(0,s.tZ)(X.Z,{padding:12,gap:12,children:B.map((e,t)=>{var i,a;return(0,s.tZ)(F.__,{for:"primary-radio-".concat(e.id),children:(0,s.BX)(N.X2,{gap:12,alignItems:"center",children:[(0,s.tZ)("input",{id:"primary-radio-".concat(e.id),type:"radio",name:"primary_publication_user_id",value:e.id,checked:0===t}),(0,s.tZ)(P.wk,{pub:e.publication,size:24}),(0,s.tZ)(L.xv.B3,{as:"span",children:null!==(a=null===(i=e.publication)||void 0===i?void 0:i.name)&&void 0!==a?a:""})]})})})})]}),e_&&(0,s.BX)(N.gq,{as:"label",className:A.checkbox,gap:8,children:[(0,s.tZ)(E.X,{size:"sm",name:"free_signup",defaultChecked:!0,checked:eu,onChange:e=>this.setState({subscribeToNewsletter:e})}),(0,s.tZ)(L.xv.B3,{as:"span",children:Y("Subscribe to the newsletter")})]}),ek&&(0,s.BX)(N.gq,{as:"label",className:A.checkbox,gap:8,children:[(0,s.tZ)(E.X,{type:"checkbox",name:"create_publication",id:"create-publication-checkbox",checked:eo,onChange:e=>{this.setState({createPublication:e})}}),(0,s.tZ)(L.xv.B3,{as:"span",children:Y("Create a Substack publication for me")})]}),(0,s.tZ)("input",{type:"hidden",name:"confirmation_redirect_pathname",value:document.location.pathname}),(0,s.tZ)("input",{type:"hidden",name:"photo_url",value:null!=eh?eh:void 0}),(0,s.tZ)("input",{type:"hidden",name:"user_id",value:(null==a?void 0:a.id)||""}),(0,s.tZ)("input",{type:"hidden",name:"needs_photo",value:!!d}),(0,s.tZ)("input",{type:"hidden",name:"token",value:b}),w&&(0,s.tZ)("input",{type:"hidden",name:"complete",value:!0}),(0,s.BX)("div",{id:"error-container",children:[en&&(0,s.BX)(L.xv,{as:"div",translated:!0,className:"error other-error",children:["If you have an account with us, we've sent an email to ",(0,s.tZ)("b",{children:I18N.p(null!=ei?ei:"")})," with a link that you can use to sign in."]}),el&&(0,s.tZ)("div",{className:"error other-error",children:Y("We have sent you a confirmation email. Please check your inbox before continuing.")})]}),eZ&&(0,s.BX)(L.xv.B3,{as:"span",children:[S?J("1 subscription is displayed on your profile.","%1 subscriptions are displayed on your profile.",n):J("1 subscription will be displayed on your profile.","%1 subscriptions will be displayed on your profile.",n)," ",(0,s.tZ)(L.hh,{decoration:"underline",onClick:j,children:Y("Edit")})]}),ey&&(0,s.BX)(L.xv.B3,{as:"span",children:[J("1 recommendation will be made on your publication.","%1 recommendations will be made on your publication.",M)," ",(0,s.tZ)(L.hh,{decoration:"underline",onClick:q,children:Y("Edit")})]})]}),(0,s.BX)(N.sg,{gap:8,paddingTop:20,children:[!a&&(0,s.tZ)(Z.xu,{className:A.tosCheckboxContainer,paddingBottom:12,children:(0,s.tZ)(z.O,{checked:ed,onCheckboxChange:e=>this.setState({tosAccepted:e}),style:{display:"flex"}})}),(0,s.tZ)(_.zx,{priority:"primary",disabled:!a&&!ed,type:"submit",size:"lg",children:v||Y("Save")}),U&&(0,s.tZ)(_.zx,{priority:"secondary",onClick:U||(()=>{}),children:Y("Skip")})]})]})]})}constructor(e,t){var i;super(e,t),(0,a._)(this,"formRef",void 0),(0,a._)(this,"fileInput",void 0),this.formRef=(0,c.createRef)();let n=!!e.isPostInvite||!!e.profileExists;this.state={newName:null,newHandle:null,newBio:null,newEmail:e.user&&e.user.is_magic?e.user.email:null,selectedSocial:"instagram",createPublication:!!e.isPostInvite&&!(null===(i=e.user)||void 0===i?void 0:i.has_publication),tosAccepted:n,subscribeToNewsletter:!0}}}let V=(0,C.f9)((0,f.fz)(M));class W extends(/^(6673|7778|9049)$/.test(i.j)?null:B.p){renderChildren(){let e=this.props,{ref:t,onBeforeClose:i,contributor:a}=e,o=(0,r._)(e,["ref","onBeforeClose","contributor"]);return(0,s.tZ)("div",{className:"profile-updater-modal",children:a?(0,s.tZ)(Y,(0,l._)((0,n._)({},o),{user:o.user,pub:o.pub,profile:o.profile,onSuccess:()=>this.close(!0)})):(0,s.tZ)(V,(0,l._)((0,n._)({},o),{onSuccess:()=>this.close(!0)}))})}}let Y=e=>{let{profile:t,user:i,pub:a,onSuccess:n,isOwnProfile:l}=e,r=(0,d.sO)(null),{iString:o}=(0,f.M1)(),[c,u]=(0,d.eJ)(null),[h,p]=(0,d.eJ)(null),m=c||t&&t.photo_url,[b,v]=(0,d.eJ)(t.name),[g,Z]=(0,d.eJ)(t.bio),k=async()=>{var e;let t,i;let a=(null===(e=r.current)||void 0===e?void 0:e.files)?r.current.files[0]:null;if(r.current&&(r.current.value=""),!a){u(null),p(null);return}try{t=await (0,y.Zk)(a)}catch(e){console.error("Failed to get data URL from file:",e),alert(e.message);return}try{i=await (0,y.oA)(a)}catch(e){console.error("Failed to extract EXIF data from file:",e)}u(t),p(i)};return(0,s.BX)("div",{className:"profile-updater",children:[(0,s.tZ)("h2",{className:"page-title profile-updater-title",children:"Edit contributor profile"}),(0,s.BX)("div",{className:"profile-photo-wrap",children:[m&&(0,s.tZ)("div",{className:"profile-photo-image",style:{backgroundImage:"url(".concat(c||(0,U.zF4)(t.photo_url,144),")"),transform:(0,y.P_)(h)}}),(0,s.BX)(_.zx,{priority:"secondary",onClick:()=>{if((0,y.w1)()||(0,y.vU)()){var e;null===(e=r.current)||void 0===e||e.click()}},children:[!m&&o("Set photo"),(0,s.tZ)("input",{ref:r,type:"file",name:"photo",accept:"image/*",onChange:()=>k()})]})]}),(0,s.BX)(x.ZP,{method:"patch",action:"/api/v1/publication/users/".concat(t.id),onSuccess:n,autoLock:!0,children:[(0,s.tZ)("input",{type:"text",className:"profile-name",placeholder:"Contributor's name…",name:"name",value:b,onInput:e=>{v(e.target.value)}}),(0,s.tZ)("textarea",{className:"profile-bio",placeholder:"Contributor's bio…",name:"bio",value:g,onInput:e=>{Z(e.target.value)}}),(0,s.tZ)("input",{type:"hidden",name:"photo_url",value:m}),(0,s.BX)("span",{className:"notice",children:[(0,s.BX)(L.xv,{translated:!0,as:"p",children:[(0,s.tZ)("b",{children:"Note:"})," This is a contributor profile, viewable by ",I18N.p(a.name),"'s readers."]}),l&&(0,s.BX)(L.xv,{translated:!0,as:"p",children:["You may also edit your"," ",(0,s.tZ)("a",{native:!0,href:"".concat((0,U.NNq)(i)),children:"personal profile"}),"."]})]}),(0,s.tZ)(_.zx,{priority:"primary",type:"submit",children:o("Update profile")})]})]})}},57641:function(e,t,i){i.d(t,{O:()=>m});var a=i(7409),n=i(99282),l=i(16584),r=i(58319),o=i(68833),s=i(82402),c=i(19081),d=i(58175),u=i(37313),h=i(6911);let p={tosCheckbox:"tosCheckbox-XbLWCT",tosCheckboxBox:"tosCheckboxBox-KXqPaU"},m=e=>{let{includeCheckbox:t=!0,onCheckboxChange:i=()=>{},checked:m=!1,addSubscribePreamble:b=!1,addSignupPreamble:v=!1,fontWeight:f="regular",size:y="regular",color:g="primary",textAlign:Z="left",style:_}=e;return(0,l.BX)(l.HY,{children:[(0,l.tZ)(r.Z,{onVisible:()=>{(0,o.j)(u.F.TERMS_OF_SERVICE_SEEN,{withCheckbox:t,initialCheckboxValue:m})}}),(0,l.BX)(c.gq,{as:"label",alignItems:"center",justifyContent:"center",gap:8,style:_,className:p.tosCheckbox,children:[t&&(0,l.tZ)("div",{className:p.tosCheckboxBox,children:(0,l.tZ)(s.X,{checked:m,onChange:e=>{(0,o.j)(u.F.TERMS_OF_SERVICE_CHECKBOX_CLICKED,{checkboxValue:e}),i(e)},size:"sm"})}),(0,l.BX)(d.xv.B4,(0,n._)((0,a._)({color:g,textAlign:Z,fontWeight:f},"small"===y?{size:11,lineHeight:16}:{}),{children:[b?"By subscribing, ":v?"By creating an account, ":""," I agree to Substack's"," ",(0,l.tZ)(d.xv,{as:"a",href:(0,h._Q)(),target:"_blank",style:{textDecoration:"underline"},children:"Terms of Use"}),", and acknowledge its"," ",(0,l.tZ)(d.xv,{as:"a",href:(0,h.WF)(),target:"_blank",style:{textDecoration:"underline"},children:"Information Collection Notice"})," ","and"," ",(0,l.tZ)(d.xv,{as:"a",href:(0,h.Zz)(),target:"_blank",style:{textDecoration:"underline"},children:"Privacy Policy"}),"."]}))]})]})}}}]);