1"use strict";(self.webpackChunknyp_membership=self.webpackChunknyp_membership||[]).push([[1171],{1171:function(e,t,n){n.r(t),n.d(t,{FreeTrialPayflowForm:function(){return v}});var o=n(1085),a=n(9067),i=n.n(a),s=n(7309),r=n(8690),c=n(7093),u=n(8862),l=n(3486),d=n(1903),p=n(2906),m=n(7351),w=n(7682),g=n(3127),h=n(7661),_=n(8188),y=n(4041),f=n(4846);const v=({isModal:e=!1})=>{const t=(0,r.Zp)(),n=(0,r.zy)(),{state:a={},dispatch:i}=(0,m.rR)(),{dispatch:v}=(0,m.QW)(),{operations:b,state:x}=(0,f.i)(),{selectedPlan:T=null}=x,{operations:S}=(0,m.mu)(),{user:{sessionId:k="",trackingId:j=""}={}}=a,P=(0,p.o)(_.zZ),{planId:N=null,hasTrial:I=!1}=T||{},{payflowCheckoutTitle:D="",payflowCheckoutButtonLabel:F=""}=(0,u.px)(N,I);(0,y.useEffect)(()=>{if(!e&&void 0!==window.gtag){window.ga4Dims=window.ga4Dims||{};const e=Object.assign({},window.ga4Dims);e.source_unit="payflow_landing_page",e.event_action="view",e.event_label="payment_page",window.gtag("event","ux_engagement",e)}},[]);const E=(...o)=>{return a=void 0,s=[...o],p=function*(o={nonce:"",error:""}){var a;const{nonce:s}=o;b.setLoading(!0);const{planId:r,productId:p}=x.plans[0],{status:m,message:w=""}=yield(0,c.Yw)({paymentNonce:s,planId:r,productId:p,skipTrial:b.shouldSkipTrial(),sessionId:k,trackingId:j});if("error"===m){if(b.setLoading(!1),b.setError(`${l.y.errorSubscribing()} ${w}`),e&&void 0!==window.gtag){window.ga4Dims=window.ga4Dims||{};const e=Object.assign({},window.ga4Dims);e.source_unit="payflow_modal",e.event_action="payment_submit",e.event_label="failed",window.gtag("event","ux_engagement",e)}return}if(void 0!==window.gtag){window.ga4Dims=window.ga4Dims||{};const t=Object.assign({},window.ga4Dims);e?(t.source_unit="payflow_modal",t.event_action="payment_submit",t.event_label="success"):(t.source_unit="payflow_landing_page",t.event_action="view",t.event_label="payment_successful"),window.gtag("event","ux_engagement",t)}(null===(a=window.PARSELY)||void 0===a?void 0:a.conversions)&&window.gtfScripts.nypost_wp_vars.use_parsely_payment_conversion&&window.PARSELY.conversions.trackSubscription("Post Sports Plus Conversion");const _=yield(0,c.r7)({hadTrial:!0,onboarded:!1}),y=yield(0,c.X4)({active:!1,sessionId:k,trackingId:j}),f=(0,u.UF)(y),{activeSubscription:T,status:P}=f,N={activeSubscription:T,subscriptions:y,subscriptionStatus:P};v((0,g.yS)(N)),_&&(i((0,h.Uu)({hadTrial:!0,onboarded:!1})),i((0,h.ef)(!0))),S.refetchPaymentMethods(),"/account/subscribe"!==n.pathname||e||i((0,h.Be)(n.pathname)),t("/account/onboarding/welcome"),(0,d.A)()||window.history.pushState({},"",`${window.location.pathname}?welcome=true`)},new((r=void 0)||(r=Promise))(function(e,t){function n(e){try{i(p.next(e))}catch(e){t(e)}}function o(e){try{i(p.throw(e))}catch(e){t(e)}}function i(t){var a;t.done?e(t.value):(a=t.value,a instanceof r?a:new r(function(e){e(a)})).then(n,o)}i((p=p.apply(a,s||[])).next())});var a,s,r,p};return(0,o.jsx)(w.t8,{isModal:e,children:(0,o.jsx)("div",{className:"form-wrapper form-wrapper--payment",children:x.loading||!T?(0,o.jsx)(w.Ip,{}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("h1",{className:"form-wrapper__heading t-center",children:D||(null==T?void 0:T.getCallToAction())}),(0,o.jsx)("section",{className:"membership-section",children:(0,o.jsx)(w.XN,{html:x.selectedPlan.getBillingTextNewUser(),tagName:"p"})}),(0,o.jsx)("hr",{}),(0,o.jsx)("section",{className:"membership-section membership-section__one-step-checkout",children:!1!==x.authorizationToken?(0,o.jsx)(w.Nk,{authorizationToken:x.authorizationToken,onSubmitSuccess:E,amount:x.selectedPlan.amount,gaCategory:"Payflow - Payment Info Page"}):(0,o.jsx)(w.Ip,{height:"60px"})}),(0,o.jsx)("div",{className:"button-wrap-lines button-wrap-lines--divider button-wrap-lines--thin button-wrap-lines--black-text",children:(0,o.jsx)("div",{className:"button-wrap-lines__inner",children:(0,o.jsx)("span",{children:(0,s.__)("OR","nypost")})})}),(0,o.jsxs)("section",{className:"membership-section membership-section__pay-by-card",children:[x.error?b.renderError(x.error):null,!1!==x.authorizationToken?(0,o.jsxs)(o.Fragment,{children:[P?(0,o.jsx)(w.cy,Object.assign({amountDueText:I?(0,s.__)("Due Today: $0","nypost"):(0,s.nv)((0,s.__)("Due Today: $%s","nypost"),T.amount.toFixed(2)),authorizationToken:x.authorizationToken,onSubmitSuccess:E,submitButtonText:F||(0,s.__)("Submit","nypost")},!e&&{dataGa4Event:JSON.stringify({event_name:"ux_engagement",source_unit:"Payflow - Payment Info Page",source_position:I?"Button Click: Start Free Trial":"Button Click: Start Free Subscription"})})):(0,o.jsx)(w.QS,Object.assign({amountDueText:I?(0,s.__)("Due Today: $0","nypost"):(0,s.nv)((0,s.__)("Due Today: $%s","nypost"),T.amount.toFixed(2)),authorizationToken:x.authorizationToken},!e&&{dataGa4Event:JSON.stringify({event_name:"ux_engagement",source_unit:"Payflow - Payment Info Page",source_position:I?"Button Click: Start Free Trial":"Button Click: Start Free Subscription"})},{onSubmitSuccess:E,submitButtonText:F||(0,s.__)("Submit","nypost")})),(0,o.jsx)(w.XN,{className:"form-text form-text--terms",html:I?l.p.forPayflowFreeTrial():l.p.forPayflowNoFreeTrial(T,F||(0,s.__)("Submit","nypost")),tagName:"p",addAttr:["target"]})]}):(0,o.jsx)(w.Ip,{height:"120px"})]})]})})})};v.propTypes={isModal:i().bool.isRequired}},4846:function(e,t,n){n.d(t,{i:function(){return s}});var o=n(7351),a=n(4041),i=n(7093);const s=()=>{const{state:e}=(0,o.rR)(),{state:t}=(0,o.QW)(),{error:n,setError:s,renderError:r}=(0,o.MM)(),[c,u]=(0,a.useState)(!1),[l,d]=(0,a.useState)(!1),p=(0,o.ow)(),{availablePlans:m}=t,{dataLayer:{hadTrial:w=!1}={}}=e;return(0,a.useEffect)(()=>{var e,t,n,o;e=void 0,t=void 0,o=function*(){return u(yield(0,i.gf)())}
1,new((n=void 0)||(n=Promise))(function(a,i){function s(e){try{c(o.next(e))}catch(e){i(e)}}function r(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,r)}c((o=o.apply(e,t||[])).next())})},[]),{operations:{renderError:r,setError:s,setLoading:d,shouldSkipTrial:()=>!!w||!p.hasTrial},state:{authorizationToken:c,error:n,loading:l,plans:m,selectedPlan:p}}}}}]); 2//# sourceMappingURL=1171.bbcc4e97b6e18b8359f1.bundle.min.js.map
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.