"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["2457"],{4291:function(e,t,s){s.d(t,{Z:()=>i});let i={pubTheme:"pubTheme-yiXxQA"}},30218:function(e,t,s){s.d(t,{Z:()=>c});var i=s(16584),o=s(30396),n=s(20253),r=s(15771),a=s(19081),l=s(58175),d=s(51776),p=s(26111);let c=e=>{let{allowAllDay:t,redirect:s,onCancel:c,requiresMfa:u}=e,[h,m]=(0,o.eJ)(!1),[v,_]=(0,o.eJ)(""),[f,g]=(0,o.eJ)(!u),y=(0,o.sO)(null),Z=s||(0,p.x)("redirect")||"/",b=(0,p.x)("for_pub")||"";return(0,o.d4)(()=>{y.current&&y.current.focus()},[]),(0,o.d4)(()=>{6===v.length&&g(!0)},[v]),(0,i.tZ)(n.ZP,{className:"customer-support-mode-form",analyticsName:"Customer Support Mode Form",action:"/api/v1/customer_support_mode",onSuccess:e=>{var t;let s=null==e?void 0:null===(t=e.body)||void 0===t?void 0:t.redirect;s?document.location.href=s:document.location.href=Z||"/"},autoLock:!0,children:(0,i.BX)(a.tu,{children:[(0,i.BX)(a.tu,{gap:8,children:[(0,i.tZ)(l.xv.Meta,{className:"danger",weight:"semibold",color:"error",children:"Danger"}),(0,i.tZ)(l.xv.H2,{children:"Support Mode"}),(0,i.tZ)(l.xv.B3,{children:"Be absolutely respectful to the writers on whose behalf you are working."}),u&&(0,i.BX)(i.HY,{children:[(0,i.tZ)(l.xv.B3,{paddingTop:12,weight:"bold",children:"Enter your MFA code"}),(0,i.tZ)(d.oi,{ref:y,name:"code",inputMode:"numeric",maxLength:6,placeholder:"Code",value:v,width:300,autoComplete:"off",onChange:e=>_(e.target.value)})]}),t&&(0,i.tZ)("label",{children:(0,i.BX)(a.gq,{gap:8,children:[(0,i.tZ)("input",{type:"checkbox",defaultChecked:!1,onInput:e=>m(e.target.checked)})," ",(0,i.tZ)(l.xv.B3,{children:"Allow access for the day"})]})}),h&&(0,i.tZ)("input",{type:"hidden",name:"all_pubs",value:"true"}),(0,i.tZ)("input",{type:"hidden",name:"minutes",value:h?600:30}),(0,i.tZ)("input",{type:"hidden",name:"for_pub",value:b}),(0,i.tZ)("input",{type:"hidden",name:"redirect",value:Z}),(0,i.BX)(a.gq,{gap:8,paddingTop:8,children:[(0,i.tZ)(r.zx,{priority:"destructive",type:"submit",id:"enter-support-mode",disabled:!f,children:"Enter support mode"}),c&&(0,i.tZ)(r.zx,{priority:"secondary",onClick:c,children:"Cancel"})]})]}),(0,i.tZ)("div",{id:"error-container"})]})})}},51323:function(e,t,s){s.r(t),s.d(t,{InviteActions:()=>C});var i=s(27412),o=s(16584),n=s(6400),r=s(30218),a=s(20253),l=s(25682),d=s(93666),p=s(347),c=s(95441),u=s(48980),h=s(65205),m=s(98914),v=s(15771),_=s(19081),f=s(58175),g=s(60308),y=s(26111);let Z={requestInput:"requestInput-WHeUXs",requestButton:"requestButton-cgAc0k",privateText:"privateText-wOhh5e",signInLink:"signInLink-uYK_GW",requestErrors:"requestErrors-fjW_fy",privateLockIcon:"privateLockIcon-rwwaF_"};class b extends n.Component{componentDidMount(){var e,t;let s=this.props.freeSignupEmail||this.props.user&&this.props.user.email;s&&this.emailInput?this.emailInput.value=s:s||(0,m.K1)()||null===(e=this.emailInput)||void 0===e||e.focus(),(0,y.x)("autoSubmit")&&((0,m.iO)("autoSubmit"),null===(t=this.form)||void 0===t||t.handleSubmit())}renderCustomerSupportModeModal(){var e;if(this.canTurnOnCustomerSupportMode())return(0,o.tZ)(d.p,{className:"account-info-customer-support-mode-modal",ref:this.assignCustomerSupportModeModal,children:(0,o.tZ)(r.Z,{redirect:(0,y.x)("redirect")||"/publish/home",onCancel:e=>{var t;return null===(t=this.customerSupportModeModal)||void 0===t?void 0:t.close(e)},allowAllDay:!1,requiresMfa:null===(e=this.props.user)||void 0===e?void 0:e.requires_global_admin_mfa_challenge})})}render(e,t){let{pub:s,user:i,freeSignupEmail:n,iString:r}=e,{loading:d,success:c}=t,y=n||i&&i.email;return(0,o.BX)("div",{className:"intro-popup-invite-actions",children:[this.renderCustomerSupportModeModal(),(0,o.BX)(a.ZP,{className:"subscription-request-form",ref:this.assignForm,noInlineErrors:!0,performSubmit:e=>{if(i)return(0,u.rd)("/api/v1/subscription/request",{method:"POST"});(0,m.uX)((0,g.uXE)({prefilled_email:null==e?void 0:e.email,redirect:(0,g.rhs)(window.location.href,{autoSubmit:!0})}))},onSuccess:()=>i&&this.setState({success:!0}),onError:e=>{this.setState({loading:!1}),alert((0,m.zx)(e,"Failed to request a subscription"))},children:[(0,o.tZ)("input",{type:"hidden",name:"first_url",value:h.xY}),(0,o.tZ)("input",{type:"hidden",name:"first_referrer",value:h.ip}),(0,o.tZ)("input",{type:"hidden",name:"first_session_url",value:h.ac}),(0,o.tZ)("input",{type:"hidden",name:"first_session_referrer",value:h.qR}),(0,o.tZ)("input",{type:"hidden",name:"current_url",value:h.UE}),(0,o.tZ)("input",{type:"hidden",name:"current_referrer",value:h.xU}),!!y&&(0,m.e5)(),(0,o.BX)(_.tu,{alignItems:"center",children:[(0,o.tZ)("input",{className:Z.requestInput,type:"email",name:"email",ref:this.assignEmailInput,readOnly:!!(y||d),disabled:!!(d||c||y),placeholder:r("Type your email...")}),(0,o.tZ)("div",{id:"error-container",className:Z.requestErrors}),(0,o.tZ)(p.h,{children:(0,o.tZ)(v.zx,{className:Z.requestButton,priority:c?"secondary":"primary",type:"submit",disabled:!!c,loading:d,onClick:()=>{this.setState({loading:!0})},children:r(c?"Requested":"Subscribe")})})]})]}),(0,o.BX)(_.tu,{gap:12,paddingBottom:12,alignItems:"center",justifyContent:"center",children:[(0,o.tZ)(l.Z,{className:Z.privateLockIcon}),(0,o.BX)(_.tu,{gap:2,children:[(0,o.tZ)(f.xv.B4,{translated:!0,weight:"semibold",className:Z.privateText,children:"This Substack is private"}),(0,o.tZ)(f.xv.B4,{translated:!0,className:Z.privateText,children:"Subscribe to see all their posts."})]})]}),this.canTurnOnCustomerSupportMode()&&(0,o.tZ)(f.xv.B3,{cursor:"pointer",decoration:"none",weight:"light",size:12,onClick:()=>this.showCustomerSupportModeModal(s),translated:!0,className:Z.privateText,children:"Support mode"}),(0,o.BX)("a",{className:Z.signInLink,href:(0,g.uXE)({for_pub:s.subdomain,redirect:"/",change_user:!!(i||n)}),native:!0,children:[(0,o.tZ)(f.xv.B3,{size:12,as:"span",translated:!0,className:Z.privateText,children:"Already a member?"})," ",i||n?(0,o.tZ)(f.xv.B3,{size:12,weight:"bold",as:"span",translated:!0,className:Z.privateText,children:"Switch accounts"}):(0,o.tZ)(f.xv.B3,{size:12,weight:"bold",as:"span",translated:!0,className:Z.privateText,children:"Sign in"})]})]})}constructor(...e){super(...e),(0,i._)(this,"emailInput",null),(0,i._)(this,"customerSupportModeModal",null),(0,i._)(this,"form",null),(0,i._)(this,"assignEmailInput",e=>{this.emailInput=e}),(0,i._)(this,"assignCustomerSupportModeModal",e=>{this.customerSupportModeModal=e}),(0,i._)(this,"assignForm",e=>{this.form=e}),(0,i._)(this,"canTurnOnCustomerSupportMode",()=>{let e=this.props.user;return(null==e?void 0:e.is_global_admin)&&!(null==e?void 0:e.is_admin)}),(0,i._)(this,"showCustomerSupportModeModal",e=>{if(this.canTurnOnCustomerSupportMode()){if(e.custom_domain){let t=window.location.pathname;(0,m.uX)((0,g.Q6L)(t,e),{local_navigation:!1})}else{var t;null===(t=this.customerSupportModeModal)||void 0===t||t.open()}}})}}(0,i._)(b,"state",{loading:!1,success:!1});let C=(0,c.fz)(b)},347:function(e,t,s){s.d(t,{h:()=>r});var i=s(16584);s(98661);var o=s(4615),n=s(4291);function r(e){let{children:t}=e;return(0,i.tZ)(o.f6,{theme:n.Z.pubTheme,children:t})}},25682:function(e,t,s){s.d(t,{Z:()=>l});var i=s(7409),o=s(99282),n=s(98848),r=s(16584),a=s(64515);let l=e=>{var{color:t="#262626"}=e,s=(0,n._)(e,["color"]);return(0,r.BX)(a.l,(0,o._)((0,i._)({},s),{name:"LockThinIcon",svgParams:{height:16,width:16},children:[(0,r.tZ)("path",{className:"lock-shackle",d:"M5 6L5 3.9C5 2.57452 6.11929 1.5 7.5 1.5C8.88071 1.5 10 2.57452 10 3.9V6",stroke:t}),(0,r.tZ)("path",{className:"lock-body",d:"M2 7.5C2 6.94772 2.44772 6.5 3 6.5H12C12.5523 6.5 13 6.94772 13 7.5V12.5C13 13.0523 12.5523 13.5 12 13.5H3C2.44771 13.5 2 13.0523 2 12.5V7.5Z",fill:t,stroke:t})]}))}},93666:function(e,t,s){s.d(t,{Z:()=>h,p:()=>m});var i=s(27412),o=s(7409),n=s(99282),r=s(16584),a=s(6400),l=s(94184),d=s.n(l),p=s(71375),c=s(98914),u=s(15771);class h extends a.Component{componentDidMount(){document.addEventListener("keydown",this.onDocumentKeyDown),this.props.openByDefault&&this.openImmediately()}componentWillUnmount(){document.removeEventListener("keydown",this.onDocumentKeyDown),this._timeout&&clearTimeout(this._timeout)}openImmediately(e){e&&(this._callback=e);let t=document.getElementsByTagName("html")[0];t&&!(0,c.pv)(t,"modal-in")&&(0,c.cn)(t,"modal-in"),this.setState({display:!0,open:!0})}async open(e){e&&(this._callback=e);let t=document.getElementsByTagName("html")[0];t&&!(0,c.pv)(t,"modal-in")&&(0,c.cn)(t,"modal-in"),this.onBeforeOpen(),this.props.onBeforeOpen&&this.props.onBeforeOpen(),await new Promise(e=>{this.setState({display:!0},()=>{this._timeout&&clearTimeout(this._timeout);let t=setTimeout(()=>{this.setState({open:!0},()=>{this.onOpen(),this.props.onOpen&&this.props.onOpen(),e()})},50);this._timeout=t})})}async close(e){this.isOpen()&&!1!==this.onBeforeClose(e)&&(!this.props.onBeforeClose||!1!==this.props.onBeforeClose(e))&&((0,c.IV)(document.getElementsByTagName("html")[0],"modal-in"),await new Promise(t=>{this.setState({open:!1},()=>{let s=setTimeout(()=>{this.setState({display:!1},()=>{this.onClose(e),this.props.onClose&&this.props.onClose(e),this._callback&&this._callback(e),t()})},750);this._timeout=s})}))}isOpen(){return this.state.open}onClickOuter(e){var t,s;e.stopPropagation(),null===(t=(s=this.props).onClick)||void 0===t||t.call(s,e),!this.props.noExit&&!this.props.noExitOnClick&&this.popup&&(this.noFullscreen||window.innerWidth>540)&&e.target&&this.container&&this.close()}onClickInner(e){var t,s;e.stopPropagation(),null===(t=(s=this.props).onClick)||void 0===t||t.call(s,e)}render(e,t){let s=this.state.open?"in":"out",i=!1===this.state.display?"gone":"",a="structured"===this.props.variant,l=!this.state.open;return(0,r.tZ)("div",{className:d()("modal typography",s,i,this.props.className,this.getClassName(),{"has-close-pill":this.props.closePill,"structured-modal":a,popup:this.popup}),inert:l,onClick:e=>this.onClickOuter(e),"data-testid":this.props.testID,role:"dialog",style:this.props.zIndex?{zIndex:this.props.zIndex}:{},children:(0,r.tZ)("div",{className:"modal-table",children:(0,r.tZ)("div",{className:"modal-row",children:(0,r.tZ)("div",{ref:this.assignContent,className:d()("modal-cell modal-content",{"no-fullscreen":this.noFullscreen}),children:(0,r.BX)("div",(0,n._)((0,o._)({className:d()({container:!a}),ref:this.assignContainer,onClick:e=>this.onClickInner(e)},this.props.trackInputsID&&{"data-track-inputs":this.props.trackInputsID}),{children:[!this.props.noExit&&(!this.props.noCloseButton||(0,c.K1)())&&(a?(0,r.tZ)("div",{className:"structured-modal__close-button",children:(0,r.tZ)(u.hU,{"data-testid":"close-modal",priority:"tertiary",onClick:()=>this.close(),children:(0,r.tZ)(p.Z,{size:20,color:"secondary"})})}):(0,r.tZ)(u.hU,{"data-testid":"close-modal",priority:"tertiary",className:d()("modal-btn modal-exit-btn no-margin",{"button btn btn-secondary btn-pill icon-only":this.props.closePill}),onClick:()=>this.close(),children:(0,r.tZ)(p.Z,{size:20,color:"secondary"})})),a?(0,r.BX)("div",{className:"structured-modal__wrapper",children:[(0,r.tZ)("div",{className:"structured-modal__header",children:this.props.modalTitle?(0,r.tZ)("h3",{children:this.props.modalTitle}):(0,r.tZ)("h3",{children:"\xa0"})}),(0,r.tZ)("div",{className:"structured-modal__body",children:(0,r.tZ)("div",{className:"container",children:this.renderChildren(this.props,this.state)})}),this.props.modalFooter&&(0,r.tZ)("div",{className:"structured-modal__footer",children:this.props.modalFooter})]}):this.renderChildren(this.props,this.state)]}))})})})})}getClassName(){}onBeforeOpen(){}onOpen(e){}onBeforeClose(e){}onClose(e){}renderChildren(e,t){let{children:s}=e;return s}constructor(e,t){super(e,t),(0,i._)(this,"popup",void 0),(0,i._)(this,"_timeout",void 0),(0,i._)(this,"_callback",void 0),(0,i._)(this,"content",void 0),(0,i._)(this,"container",void 0),(0,i._)(this,"assignContent",e=>{this.content=e}),(0,i._)(this,"assignContainer",e=>{this.container=e}),(0,i._)(this,"noFullscreen",void 0),(0,i._)(this,"state",void 0),(0,i._)(this,"onDocumentKeyDown",e=>{"Escape"!==e.key||this.props.noExit||(0,c.$Z)(this.base)||this.close()}),this.open=this.open.bind(this),this.close=this.close.bind(this),this.popup=!1,this.state={open:!1,display:!1,callback:null}}}class m extends h{constructor(e,t){super(e,t),this.popup=!0}}}}]);