"use strict";(self.webpackChunklite=self.webpackChunklite||[]).push([[3735],{16647:(e,t,n)=>{n.d(t,{h:()=>g});var i=n(64467),r=n(80296),l=n(55364),o=n.n(l),a=n(95420),s=n(96540),u=n(75636),c=n(11321),d=n(21335),m=n(72130),b=n(49287),v=n(91830),p=n(53301),w=n(99766);function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function h(e){for(var t=1;t1&&void 0!==arguments[1]&&arguments[1];A(!1),e&&!t&&null!=n&&n.id?q({variables:{userId:null==n?void 0:n.id}}):e&&null!=t&&t.id?G({variables:{newsletterV3Id:null==t?void 0:t.id,shouldRecordConsent:i}}):null!=t&&t.id?H({variables:{newsletterV3Id:null==t?void 0:t.id}}):A(!0)},loading:D}}},99766:(e,t,n)=>{n.d(t,{k:()=>r});var i=n(45458),r={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"NewsletterV3ViewerEdge"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"newsletterSlug"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"collectionSlug"}},type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"username"}},type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"newsletterV3"},arguments:[{kind:"Argument",name:{kind:"Name",value:"newsletterSlug"},value:{kind:"Variable",name:{kind:"Name",value:"newsletterSlug"}}},{kind:"Argument",name:{kind:"Name",value:"collectionSlug"},value:{kind:"Variable",name:{kind:"Name",value:"collectionSlug"}}},{kind:"Argument",name:{kind:"Name",value:"username"},value:{kind:"Variable",name:{kind:"Name",value:"username"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"NewsletterV3"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"viewerEdge"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"NewsletterV3ViewerEdge_newsletterV3ViewerEdge"}}]}}]}}]}}]}}].concat((0,i.A)([{kind:"FragmentDefinition",name:{kind:"Name",value:"NewsletterV3ViewerEdge_newsletterV3ViewerEdge"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"NewsletterV3ViewerEdge"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"isSubscribed"}}]}}]))}},11321:(e,t,n)=>{n.d(t,{h:()=>l});var i=n(39181),r=n(99766),l=function(e){var t,n=e.newsletterSlug,l=void 0===n?"":n,o=e.collectionSlug,a=void 0===o?null:o,s=e.username,u=void 0===s?null:s,c=(0,i.I)(r.k,{variables:{newsletterSlug:l,collectionSlug:a,username:u},ssr:!1,skip:!l&&!u}),d=c.loading,m=c.error,b=c.data;return d?{loading:d}:m?{error:m}:{viewerEdge:null==b||null===(t=b.newsletterV3)||void 0===t?void 0:t.viewerEdge}}},30572:(e,t,n)=>{n.d(t,{a:()=>b});var i=n(64467),r=n(96540),l=n(69733),o=n(99731),a=n(86527),s=n(72130),u=n(49287),c=n(46879);function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function m(e){for(var t=1;t{n.d(t,{m:()=>re});var i,r,l=n(80296),o=n(96540),a=n(54654),s=n(95420),u={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"UpdateUserPostSubscribeMembershipUpsellShownAt"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"userUpdatePostSubscribeMembershipUpsellShownAt"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"postSubscribeMembershipUpsellShownAt"}}]}}]}}]},c=n(27721),d=n(7580),m=n(64314),b=n(52290),v=n(95107),p=n(36557),w=n(72130),f=n(49287),h=n(39160),g=n(42600),S=n(79959),E=n(46879),k="after_subscribe_membership_upsell",y=function(e){var t=e.user,n=e.isVisible,i=e.hide,r=(0,h.d4)((function(e){return e.config.authDomain})),a=(0,w.$L)(),y=(0,c.R)(),V=y.value,N=y.loading;o.useEffect((function(){var e;N||null!=V&&V.postSubscribeMembershipUpsellShownAt||(a.event("newsletterV3.postSubscribeMembershipUpsellViewed",{newsletterV3Id:null===(e=t.newsletterV3)||void 0===e?void 0:e.id,source:k}),x())}),[N]);var O=(0,s.n)(u,{optimisticResponse:{userUpdatePostSubscribeMembershipUpsellShownAt:{__typename:"User",id:(null==V?void 0:V.id)||"",postSubscribeMembershipUpsellShownAt:(new Date).getTime()}}}),x=(0,l.A)(O,1)[0];return o.createElement(f.Ne,{source:{name:k}},o.createElement(m.m,{isVisible:n,hide:i,withCloseButton:!0,withAnimation:!0,buttonStyle:"STRONG",buttonSize:"REGULAR",cancelText:"Not now",confirmText:"Become a member",onConfirm:function(){var e,n;a.event("newsletterV3.postSubscribeMembershipUpsellClicked",{newsletterV3Id:null===(e=t.newsletterV3)||void 0===e?void 0:e.id,source:k}),n=(0,S.ST)((0,E.Qok)(r),{subscribeToUserId:t.id,source:k}),window.location.href=n},showCancelButton:!0,isDestructiveAction:!1},o.createElement(b.a,{marginBottom:"24px"},o.createElement(d.r,{miroId:t.imageId||g._3,alt:t.name||"",diameter:80,freezeGifs:!1})),o.createElement(b.a,{marginBottom:{xs:"8px",sm:"8px",md:"16px",lg:"16px",xl:"16px"}},o.createElement(v.mz,{scale:{xs:"S",sm:"S",md:"L",lg:"L",xl:"L"}},"You’re subscribed to get email updates. Become a member for more.")),o.createElement(b.a,{marginBottom:"32px"},o.createElement(p.kZ,{tag:"span",scale:{xs:"M",sm:"M",md:"L",lg:"L",xl:"L"},color:"DARKER"},"Your membership fee directly supports ",t.name," and other writers you read. Get full access to every story on Medium."))))},V=n(50684),N=n(16647),O=n(78493),x=n(20663),T=n(43634),A=n(30572),P=n(99731),C=n(24960),D=n(41299),R=n(46445),M=n(5600),U=n(44402),I=n(20239),F=n(66305),j=n(42976),_=n(91830);function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0&&n<=window.innerHeight};o.useEffect((function(){return Te(),window&&F.R5.on("scroll",Te),function(){F.R5.off("scroll",Te)}}),[]),o.useEffect((function(){Te()}),[d]);var Pe=(0,ne.e)(!1),Ce=(0,l.A)(Pe,3),De=Ce[0],Re=Ce[1],Me=Ce[2],Ue=function(e,t){var n=(0,c.R)(),i=n.value,r=n.loading,l=o.useRef(null),a=!(null==i||!i.membership),s=(0,V.MW)(),u=(0,f.PJ)(s||"").susiEntry,d=["newsletter_v3_promo","writer_subscription_landing","subscribe_user"].includes(void 0===u?"":u);if(r)return!1;if(null!==l.current)return l.current;var m=d&&!a&&!e.viewerEdge.isUser&&!!e.isPartnerProgramEnrolled&&!(null!=i&&i.postSubscribeMembershipUpsellShownAt);return l.current=m,m}(t),Ie=o.useState(!1),Fe=(0,l.A)(Ie,2),je=Fe[0],_e=Fe[1];o.useEffect((function(){i&&ae&&!je&&Ue?Re():Me()}),[ae,je,Ue]),o.useEffect((function(){le&&!Ue&&Ve&&ae&&(!Ne&&re===ye||Ne)&&X({duration:"NEXTPAGE",toastStyle:"NEWSLETTER_SUBSCRIBE",extraParams:{newsletterName:t.name,newsletterType:j.$J.NEWSLETTER_TYPE_AUTHOR,unsubscribeFn:function(){return ce(!1)}}})}),[le,ae]),o.useEffect((function(){if(ae&&Se&&K){var e=!be&&!!t.isPartnerProgramEnrolled;e&&ee.event("newsletterV3.postSubscribeMembershipUpsellViewed",{newsletterV3Id:K.id,source:ie}),fe(e),Ee(!1)}}),[ae,Se,K]);var Be=(0,x.r)().isWorkingPreview;if(se||t.viewerEdge.isUser&&!Be)return null;var Le,ze=k(!!ae),Ge=function(e,t){return function(n){return{stroke:t?n.colorTokens.background.neutral.secondary.base:e,height:v?"23px":"36px",width:v?"23px":"36px"}}},We=z(Ge("OBVIOUS"===ze?G.colorTokens.background.accent.primary.base:G.baseColor.fill.dark,ue)),He=z(Ge("STRONG"===ze?G.colorTokens.background.neutral.primary.base:G.backgroundColor,ue));Le=ae?v?o.createElement(L,{className:We}):o.createElement(H,{className:We}):v?o.createElement(Q,{className:He}):o.createElement(te,{className:He});var $e=o.createElement(P.$n,{loading:ue,buttonStyle:ze,onClick:function(){var e;Ee(!ae),W?ae?ce(!1):W&&W.allowEmailAddressSharingEditorWriter?ce(!0,!1):Z():null!==(e=t.newsletterV3)&&void 0!==e&&e.id?ee.event("newsletterV3.subscribeClicked",{newsletterV3Id:t.newsletterV3.id,source:ie}):ee.event("user.LOSubscribeClicked",{targetUserId:t.id,source:ie})},padding:"0","aria-label":"Subscribe"},Le),qe=function(){return o.createElement(b.a,{padding:"14px 12px 20px",maxWidth:"220px"},o.createElement(p.kZ,{tag:"div",scale:"S",color:"DARKER"},o.createElement("strong",null,"You're subscribed to ",t.name,". Become a member for more.")," Get full access to every story on Medium for ",Oe," a month."),o.createElement(b.a,{paddingTop:"8px"},o.createElement(A.a,{isButton:!0,buttonStyle:"STRONG",buttonSize:"SMALL",redirectUrl:me,width:"150px",onClick:function(){ee.event("newsletterV3.postSubscribeMembershipUpsellClicked",{newsletterV3Id:K.id,source:ie})}},o.createElement(b.a,{textAlign:"center"},o.createElement(p.kZ,{scale:"S",color:"WHITE"},"Become a member")))))},Ye=function(){return o.createElement(b.a,{padding:"10px 12px",maxWidth:"166px"},o.createElement(p.kZ,{tag:"div",scale:"S",color:"DARKER"},"Subscribe to get an email whenever ",t.name," publishes."))},Qe=function(e){var t=e.children;return o.createElement(C.A,{isVisible:!!s&&!ae,hide:s,placement:"bottom",popoverRenderFn:Ye,targetDistance:10,role:"tooltip"},t)},Ze=function(e){var t=e.children;return o.createElement(C.A,{isVisible:!ue&&we,hide:function(){return fe(!1)},placement:"bottom",popoverRenderFn:qe,targetDistance:10,role:"tooltip"},t)},Je=function(e){var t=e.children;return o.createElement(D.R,{isVisible:!ue&&!ae,hideOnClick:!0,noPortal:!0,mouseEnterDelay:500,mouseLeaveDelay:0,placement:"bottom",popoverRenderFn:Ye,role:"tooltip",targetDistance:10},t)},Ke=function(e){var t=e.children;return a&&!ae?o.createElement(Qe,null,t):we?o.createElement(Ze,null,t):ae?o.createElement(M.G,{tooltipText:"Subscribed",targetDistance:10},t):o.createElement(Je,null,t)};return o.createElement("div",{ref:B},o.createElement(Ke,null,o.createElement(b.a,null,W&&o.createElement(R.T,{onConfirm:function(){ce(!0,!0)},isVisible:Y,hide:J,titleText:"Confirm your subscription to ".concat(t.name),confirmText:"Confirm now",buttonStyle:"STRONG",buttonSize:"LARGE",showCancelButton:!1,withCloseButton:!1,isDestructiveAction:!1},"When you subscribe to a writer or publication, your email address will be shared with them so they can stay in contact with you outside of Medium. Opt out any time by unsubscribing in Settings."),W?$e:o.createElement(T.r,{operation:"register",newsletterV3:K,user:t,actionUrl:K?(0,E.gj9)(K.id):(0,E.Yrp)(t.id),susiEntry:"subscribe_user"},$e))),De&&o.createElement(y,{user:t,isVisible:De,hide:function(){_e(!0),Me()}}))},re=function(e){var t=e.creator,n=e.followButtonSize,i=void 0===n?"REGULAR":n,r=e.shouldHideTooltip,s=void 0!==r&&r,u=e.post,c=e.showMembershipUpsellModal,d=e.susiEntry,m=e.isVisible,v=e.width,p=e.isSubscribeCompact,w=void 0!==p&&p,f=e.buttonStyleFn,h=e.trackingV2,g=o.useState(!1),S=(0,l.A)(g,2),E=S[0],k=S[1];return o.createElement(o.Fragment,null,o.createElement(a.P,{buttonSize:i,onClick:function(){t.viewerEdge.isFollowing||k(!0)},post:u,user:t,susiEntry:d,width:v,buttonStyleFn:f,trackingV2:h}),o.createElement(b.a,{marginLeft:w?"4px":"8px"},o.createElement(ie,{user:t,showMembershipUpsellModal:c,showPostFollowSubscribeTooltip:E&&!s,hidePostFollowSubscribeTooltip:function(){return k(!1)},isVisible:m,isCompact:w,buttonStyleFn:f})))}}}]); //# sourceMappingURL=https://stats.medium.build/lite/sourcemaps/3735.afb7e926.chunk.js.map