import{b3 as m,aA as g,r as o,j as i,k as f,x as r}from"./main-TIUJvpaR.js";import{B as b}from"./billing-redirect-message-yudZRzMw.js";import{C as d,a as h}from"./checkout-product-summary-CrBTjCGM.js";import"./TaskAlt-S5LLkcsW.js";import"./skeleton-uSF3jNnm.js";import"./billing-queries-D1QXfRse.js";import"./formatted-price-BnJL0Dzb.js";import"./product-feature-list-jOnIJ0MT.js";function B(){const{productId:s,priceId:t}=m(),[e]=g(),a=o.useRef(!1),[p,n]=o.useState();return o.useEffect(()=>{const c=e.get("subscriptionId"),u=e.get("status");a.current||(c&&u==="success"?k(c).then(()=>{n(l("success",s,t)),window.location.href="/billing"}):n(l(u,s,t)),a.current=!0)},[t,s,e]),i.jsxs(d,{children:[i.jsx(b,{config:p}),i.jsx(h,{showBillingLine:!1})]})}function l(s,t,e){switch(s){case"success":return{message:r("Subscription successful!"),status:"success",buttonLabel:r("Return to site"),link:"/billing"};default:return{message:r("Something went wrong. Please try again."),status:"error",buttonLabel:r("Go back"),link:y(t,e)}}}function y(s,t){return s&&t?`/checkout/${s}/${t}`:"/"}function k(s){return f.post("billing/paypal/store-subscription-details-locally",{paypal_subscription_id:s})}export{B as Component};
