"use strict";(self.webpackChunklite=self.webpackChunklite||[]).push([[4769],{84075:(e,t,n)=>{n.d(t,{A:()=>a});var r,i,l=n(96540);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t{n.d(t,{k:()=>m});var r,i=n(96540),l=n(99731),o=n(52290),a=n(44402);function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t path":{fill:"SUBTLE"===e?t.colorTokens.foreground.neutral.primary.base:t.colorTokens.background.neutral.primary.base}}}},m=function(e){var t=e.buttonSize,n=void 0===t?"REGULAR":t,r=e.buttonStyle,c=void 0===r?"STRONG":r,m=e.showMailIcon,h=void 0===m||m,f=e.onClick,v=e.width,E=e.buttonText,w=void 0===E?"Get this newsletter":E,b=e.redirectUrl,p=e.displayOnly,g=void 0!==p&&p,x=e.loading,y=(0,a.l)();return i.createElement(l.$n,{buttonStyle:c,onClick:f,size:n,width:v,href:b,displayOnly:g,loading:x},i.createElement(o.a,{display:"flex",justifyContent:"center",alignItems:"center"},h&&i.createElement("span",{className:y(u),"aria-hidden":"true"},i.createElement(s,{className:y(d(c))})),w))}},4769:(e,t,n)=>{n.d(t,{j:()=>P});var r=n(58168),i=n(80296),l=n(96540),o=n(26390),a=n(16647),c=n(27721),s=n(43634),u=n(52290),d=n(46445),m=n(86527),h=n(60763),f=n(11334),v=n(99731),E=n(10531),w=n(46146),b=n(36557),p=n(72130),g=n(49287),x=n(44402),y=n(42976),T=n(91830),S=n(50684),R=n(39160),C=n(84075),k=n(60603),L=n(46879),O=n(40064),N=n(5197),V=function(e){return{marginRight:"8px",fill:e.colorTokens.foreground.neutral.primary.base}},A=function(e){var t=e.children;return l.createElement(u.a,{margin:{lg:void 0,xl:void 0,md:void 0,sm:void 0,xs:"10px 0 0 0"},flexShrink:"0"},t)},B=function(e){var t=e.children,n=e.helperTextColor,r=e.scale;return l.createElement(u.a,{maxWidth:"425px",margin:"10px 0 0 0"},l.createElement(b.kZ,{scale:r||"XS",color:n},t))},I=function(){return l.createElement(u.a,{height:"52px",width:"312px",borderRadius:"99em",backgroundColor:"BASE_NORMAL"})};function U(e){var t=e.withHelperText,n=e.helperTextChildren,r=e.button,i=e.isVertical,o=e.isLoading;return t&&o?l.createElement(u.a,{display:"flex",flexDirection:i?"column":{lg:"row",xl:"row",md:"row",sm:"column",xs:"column"},alignItems:i?"flex-start":{lg:"center",xl:"center",md:"center",sm:"flex-start",xs:"flex-start"},justifyContent:"center",width:"100%"},l.createElement(E.H,{itemPlaceholder:I,numPlaceholders:1})):i?l.createElement(u.a,{display:"flex",flexDirection:"column",width:"100%"},t&&l.createElement(u.a,{paddingBottom:"16px"},n),r):l.createElement(u.a,{display:"flex",flexDirection:{lg:"row",xl:"row",md:"row",sm:"column",xs:"column"},alignItems:{lg:"center",xl:"center",md:"center",sm:"flex-start",xs:"flex-start"},justifyContent:t?"space-between":"center",width:"100%"},t&&l.createElement(u.a,{paddingRight:{lg:"8px",xl:"8px",md:"8px",sm:"0",xs:"0"},paddingBottom:{lg:"0",xl:"0",md:"0",sm:"16px",xs:"16px"}},n),r)}var _=function(e){var t=e.newsletterV3,n=e.showMailIcon,a=void 0===n||n,c=e.buttonSize,u=void 0===c?"REGULAR":c,m=e.buttonStyle,h=void 0===m?"STRONG":m,f=e.redirectUrl,v=e.buttonText,E=e.width,w=e.viewer,b=e.subscribeButtonText,x=e.setSubscribe,y=e.user,T=e.collection,S=e.susiEntry,C=e.newsletterOrProfileName,O=e.loading,N=t.id,V=(0,L.gj9)(N),B=(0,g.Fo)(),I=(0,p.$L)(),U=(0,R.d4)((function(e){return e.config.productName})),_=(0,k.e)(!1),P=(0,i.A)(_,3),G=P[0],M=P[1],z=P[2],j={buttonSize:u,buttonStyle:h,onClick:function(){var e;w?w&&w.allowEmailAddressSharingEditorWriter?x(!0,!1):M():null!=y&&null!==(e=y.newsletterV3)&&void 0!==e&&e.id?I.event("newsletterV3.subscribeClicked",{newsletterV3Id:y.newsletterV3.id,source:B}):null!=y&&y.id&&I.event("user.LOSubscribeClicked",{targetUserId:y.id,source:B})},showMailIcon:a,buttonText:v||b,redirectUrl:f,width:E,loading:O};return l.createElement(A,null,w?l.createElement(l.Fragment,null,l.createElement(o.k,j),l.createElement(d.T,{onConfirm:function(){return x(!0,!0)},isVisible:G,hide:z,titleText:"Confirm your subscription to ".concat(C),confirmText:"Confirm now",buttonStyle:"STRONG",buttonSize:"LARGE",showCancelButton:!1,withCloseButton:!1,isDestructiveAction:!1},"By confirming, you agree to share your email address with the editors of newsletters and writers you've subscribed to so they can stay in contact with you outside of ".concat(U,". You can opt out of sharing your email address by unsubscribing in your Settings."))):l.createElement(s.r,{operation:"register",newsletterV3:t,user:y||void 0,collection:T||void 0,actionUrl:V,susiEntry:S,redirectTo:f},l.createElement(o.k,(0,r.A)({},j,{redirectUrl:void 0}))))},P=function(e){var t,n,r,i,o=e.newsletterV3,d=e.helperTextColor,E=void 0===d?"LIGHTER":d,b=e.showHelperText,p=void 0===b||b,R=e.showMailIcon,k=void 0===R||R,L=e.buttonSize,I=void 0===L?"REGULAR":L,P=e.buttonStyle,G=void 0===P?"STRONG":P,M=e.redirectUrl,z=e.buttonText,j=e.width,H=e.isVertical,F=e.hideLinkInConfirmationToast,D=e.isBaseTheme,W=(0,x.l)(),Y=(0,c.R)().value,$=o.collection?o.collection:void 0,J=o.user?o.user:void 0,X=(0,T.zF)(),K=(0,S.MW)();switch(o.type){case y.$J.NEWSLETTER_TYPE_COLLECTION:t=o.name,n="Get this newsletter",r="You’re signed up for ".concat(t,"."),i="newsletter_v3_promo";break;case y.$J.NEWSLETTER_TYPE_AUTHOR:t=null==J?void 0:J.name,n="Subscribe",r="You’re subscribed to ".concat(t),i="subscribe_user"}var Z=(0,a.h)({newsletterV3:o,newsletterName:t,hideLinkInConfirmationToast:F}),q=Z.isSubscribed,Q=Z.hasError,ee=Z.setSubscribe,te=Z.loading;l.useEffect((function(){if(K){var e=(0,g.PJ)(K||"").susiEntry;["collection_newsletter_v3_landing","newsletter_v3_promo"].includes(void 0===e?"":e)&&q&&X({duration:"NEXTPAGE",toastStyle:"NEWSLETTER_SUBSCRIBE",extraParams:{newsletterName:t,newsletterType:o.type,unsubscribeFn:function(){return ee(!1)}}})}}),[K,q]);var ne=l.useMemo((function(){return Y?l.createElement(l.Fragment,null,"Emails will be sent to ",Y.emailObfuscated,". ",l.createElement(s.r,{operation:"login",newsletterV3:o,collection:$,susiEntry:i,inline:!0},l.createElement(m.N,{linkStyle:"OBVIOUS",inline:!0,target:"_blank"},"Not you?"))):l.createElement(N.d,null)}),[Y,o,$,i]);return l.createElement(l.Fragment,null,l.createElement(h.A,null,(function(e){return l.createElement(f.N,{theme:D?e:(0,O.vU)($,e)},q?l.createElement(U,{withHelperText:p,helperTextChildren:l.createElement(B,{helperTextColor:"DARKER",scale:"S"},r),button:l.createElement(A,null,l.createElement(v.$n,{buttonStyle:"SUBTLE",onClick:function(){return ee(!1)},size:I,loading:!!te},l.createElement(u.a,{display:"flex",justifyContent:"center",alignItems:"center",tag:"span"},k&&l.createElement(C.A,{width:"24px",height:"24px",className:W(V)}),"Unsubscribe"))),isVertical:H,isLoading:!!te}):l.createElement(g.Ne,{source:{newsletterV3Id:o.id},extendSource:!0},l.createElement(U,{button:l.createElement(_,{redirectUrl:M,buttonText:z,width:j,showMailIcon:k,buttonSize:I,subscribeButtonText:n,setSubscribe:ee,user:J,collection:$,susiEntry:i,newsletterOrProfileName:t,viewer:Y,newsletterV3:o,buttonStyle:G,loading:!!te}),withHelperText:p,helperTextChildren:l.createElement(B,{helperTextColor:E},ne),isVertical:H,isLoading:!!te})))})),Q&&l.createElement(w.y,{toastStyle:"RETRYABLE_ERROR",isVisible:Q,hide:function(){}}))}},5197:(e,t,n)=>{n.d(t,{d:()=>a});var r=n(96540),i=n(86527),l=n(39160),o=n(46879),a=function(){var e=(0,l.d4)((function(e){return e.config.productName}));return r.createElement(r.Fragment,null,"By signing up, you will create a ",e," account if you don’t already have one. Review our"," ",r.createElement(i.N,{href:o.wuc,linkStyle:"OBVIOUS",inline:!0,target:"_blank"},"Privacy Policy")," ","for more information about our privacy practices.")}},60763:(e,t,n)=>{n.d(t,{A:()=>r});const r=n(5968).D.Consumer}}]); //# sourceMappingURL=https://stats.medium.build/lite/sourcemaps/4769.ed96940b.chunk.js.map