PageSourceSearch

https://post-pulse.com/static/js/index.BXnjoZvG.js

js post-pulse.com collected 2026-10-04 22:30:37 UTC 12,329 bytes, 6 lines download raw bytes

1
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="67499384-d5c7-5f81-98c3-e5477629db95")}catch(e){}}();
3import{r as n,j as e}from"./react.B6O_k1Ij.js";import{l as Ee,S as g,o as Z,C as ee,p as se,q as te,m as w,n as R,f as Te,M as _,i as Fe,r as Be,j as Ae,s as Ie,k as De}from"./ProductApp.CeWc7Fvz.js";import{S as $,b as L}from"./stripeRedirect.CR5W2hAm.js";import{r as M}from"./safeRedirect.DXRLqO02.js";import Y from"./posthog.DGZuutmQ.js";import{a as ke}from"./App.B5TG08ca.js";import{B as i,l as v,a as t,m as we,n as C,o as j,q as z,aH as Re,af as N,aq as ae,ar as ne,W as _e,C as W,ak as ie,aI as re,ah as $e,ai as oe,D as ce,aJ as Le,aK as Me,aL as Ye,aM as ze,aN as le,aO as u,aP as Ne,aQ as We}from"./mui.jAZKmtsM.js";import"./index.CbrsOE9I.js";import"./apiClient.DUpGGhBc.js";import"./socialPlatforms.DJoo4lT1.js";import"./site.CNMvyz8o.js";import"./muiTheme._VZ3-E_1.js";import"./consent.00J4GVId.js";const ts=()=>{const E=ke(),y=Ee(),[de,Q]=n.useState(!0),[ue,T]=n.useState(null),[r,F]=n.useState(null),[f,G]=n.useState(null),[q,xe]=n.useState([]),[K,O]=n.useState([]),[he,U]=n.useState(0),[B,pe]=n.useState(0),[p,H]=n.useState(25),[J,V]=n.useState(!1),[x,me]=n.useState(g.MONTH),[c,X]=n.useState(1),[h,P]=n.useState(!1),[a,be]=n.useState(null),[A,l]=n.useState({open:!1,message:"",severity:"success"}),m=ue?.active??!1,S=f!=null,ge=!m&&!S;n.useEffect(()=>{(async()=>{Q(!0);const[d,Se,ve,Pe,Ce]=await Promise.all([w().catch(()=>({active:!1,paid:!1})),R().catch(()=>null),Fe().catch(()=>[]),se().catch(()=>null),Be().catch(()=>null)]);T(d),F(Se),xe(ve),G(Pe),be(Ce),Q(!1)})()},[]),n.useEffect(()=>{S&&Z(B,10).then(s=>{O(s.content),U(s.totalElements)}).catch(()=>{})},[S,B]),n.useEffect(()=>{const s=new URLSearchParams(E.search);s.get("credits")==="success"?(Y.capture("credits_purchased"),l({open:!0,message:"Credits purchased successfully!",severity:"success"}),y.invalidateQueries({queryKey:[ee.BALANCE]}),se().then(G).catch(()=>{}),Z(0,10).then(d=>{O(d.content),U(d.totalElements)}).catch(()=>{})):s.get("credits")==="canceled"?l({open:!0,message:"Credit purchase canceled",severity:"info"}):s.get("subscription")==="success"?(l({open:!0,message:"Subscription activated!",severity:"success"}),y.invalidateQueries({queryKey:[te.STATUS]}),w().then(T).catch(()=>{}),R().then(F).catch(()=>{})):s.get("subscription")==="canceled"?l({open:!0,message:"Subscription purchase canceled",severity:"info"}):s.get("source")==="portal"&&(y.invalidateQueries({queryKey:[te.STATUS]}),y.invalidateQueries({queryKey:[ee.BALANCE]}),w().then(T).catch(()=>{}),R().then(F).catch(()=>{})),s.toString()&&window.history.replaceState({},"",E.pathname)},[E.search,y]);const je=async()=>{V(!0);try{Y.capture("credits_checkout_started",{credit_quantity:p});const s=await Ie(p);M(s.url,$,"stripe_credits_checkout")}catch(s){l({open:!0,message:L(s,"Failed to create checkout session"),severity:"error"})}finally{V(!1)}},ye=async()=>{P(!0);try{Y.capture("subscription_checkout_started",{seat_quantity:c,billing_interval:x});const s=await De(c,x);M(s.url,$,"stripe_checkout")}catch(s){l({open:!0,message:L(s,"Failed to create checkout session"),severity:"error"})}finally{P(!1)}},I=async()=>{P(!0);try{const s=await Ae();M(s.url,$,"stripe_billing_portal")}catch(s){l({open:!0,message:L(s,"Failed to open subscription portal"),severity:"error"})}finally{P(!1)}},fe=q.find(s=>s.recurring?.interval===x)||q[0],D=Te(fe),o=Math.max(1,a?.connectedAccounts??1),b=r?.expiresAt?new Date(r.expiresAt):null,k=m&&!!r?.cancelAtPeriodEnd&&!!b&&b.getTime()>Date.now();return n.useEffect(()=>{o>c&&X(o)},[o]),de?e.jsx(i,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"80vh"},children:e.jsx(v,{})}):e.jsxs(i,{children:[e.jsx(t,{variant:"h4",gutterBottom:!0,children:"Billing"}),e.jsx(we,{open:A.open,autoHideDuration:6e3,onClose:()=>l(s=>({...s,open:!1})),anchorOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(C,{onClose:()=>l(s=>({...s,open:!1})),severity:A.severity,sx:{width:"100%"},children:A.message})}),k&&b&&e.jsxs(C,{severity:"warning",sx:{mb:3},action:e.jsx(j,{color:"inherit",size:"small",onClick:I,disabled:h,children:"Manage Subscription"}),children:["Your subscription ends on ",e.jsx("strong",{children:b.toLocaleDateString()}),". After that, publications will be charged per post (Pay as You Go). Manage Subscription in Stripe to resume before then."]}),a&&a.recommendedPlan&&e.jsxs(z,{sx:{p:3,mb:3,backgroundColor:"#F8FAFF",border:"1px solid #EEF2FF"},children:[e.jsxs(i,{sx:{display:"flex",alignItems:"center",mb:2},children:[e.jsx(Re,{sx:{mr:1,color:"#F59E0B"}}),e.jsx(t,{variant:"h6",children:"Based on your last 30 days"})]}),e.jsxs(t,{variant:"body1",sx:{mb:2},children:["You have"," ",e.jsxs("strong",{children:[a.connectedAccounts," account",a.connectedAccounts!==1?"s":""]})," ","and made"," ",e.jsxs("strong",{children:[a.publicationsLast30Days," publication",a.publicationsLast30Days!==1?"s":""]}),"."]}),e.jsxs(i,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},gap:2,mb:2},children:[e.jsxs(i,{sx:{flex:1,p:2,borderRadius:2,backgroundColor:"#FFFFFF",border:a.recommendedPlan==="PAYG"?"2px solid #2748F2":"1px solid #E5E7EB"},children:[e.jsx(t,{variant:"body2",color:"text.secondary",children:"Pay as You Go"}),e.jsxs(t,{variant:"h5",sx:{fontWeight:600},children:["$",a.paygEstimate.toFixed(2),e.jsx(t,{component:"span",variant:"body2",color:"text.secondary",children:"/month"})]}),e.jsxs(t,{variant:"caption",color:"text.secondary",children:[a.publicationsLast30Days," x $",a.paygPricePerPublication.toFixed(2)]})]}),e.jsxs(i,{sx:{flex:1,p:2,borderRadius:2,backgroundColor:"#FFFFFF",border:a.recommendedPlan==="SUBSCRIPTION"?"2px solid #2748F2":"1px solid #E5E7EB"},children:[e.jsx(t,{variant:"body2",color:"text.secondary",children:"Subscription"}),e.jsxs(t,{variant:"h5",sx:{fontWeight:600},children:["$",a.subscriptionEstimate.toFixed(2),e.jsx(t,{component:"span",variant:"body2",color:"text.secondary",children:"/month"})]}),e.jsxs(t,{variant:"caption",color:"text.secondary",children:[Math.max(a.connectedAccounts,1)," x $",a.subscriptionPricePerSeat.toFixed(2)]})]})]}),e.jsxs(C,{severity:"success",icon:e.jsx(N,{}),children:[e.jsx("strong",{children:a.recommendedPlan==="PAYG"?"Pay as You Go":"Subscription"})," would save you $",Math.abs(a.paygEstimate-a.subscriptionEstimate).toFixed(2),"/month"]})]}),e.jsx(t,{variant:"h5",sx:{mb:3},children:ge?"Choose Your Plan":"Compare Plans"}),e.jsxs(i,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:3,mb:4},children:[e.jsx(ae,{sx:{flex:1,borderRadius:3,border:a?.recommendedPlan==="PAYG"?"3px solid #2748F2":"2px s
3olid #E5E7EB"},children:e.jsxs(ne,{sx:{p:3},children:[e.jsxs(i,{sx:{display:"flex",alignItems:"center",mb:1},children:[e.jsx(_e,{sx:{mr:1,color:"primary.main"}}),e.jsx(t,{variant:"h6",children:"Pay as You Go"}),!m&&S&&(f?.balance??0)>0&&e.jsx(W,{label:"Current Plan",size:"small",color:"primary",sx:{ml:"auto"}})]}),e.jsx(t,{variant:"h4",sx:{fontWeight:"bold",color:"primary.main",mb:1},children:"$0.20"}),e.jsx(t,{variant:"body2",color:"text.secondary",sx:{mb:3},children:"per publication"}),f&&e.jsxs(C,{severity:f.balance>0?"info":"warning",sx:{mb:2},children:["Current balance: ",e.jsxs("strong",{children:[f.balance," credits"]})]}),e.jsx(i,{sx:{display:"flex",gap:1,mb:2},children:[25,50,100].map(s=>e.jsx(j,{variant:p===s?"contained":"outlined",size:"small",onClick:()=>H(s),sx:{flex:1},children:s},s))}),e.jsx(ie,{label:"Custom amount",type:"number",value:p,onChange:s=>H(Math.max(_,parseInt(s.target.value)||_)),fullWidth:!0,size:"small",slotProps:{input:{inputProps:{min:_}}},helperText:`Total: $${(p*.2).toFixed(2)}`,sx:{mb:2}}),e.jsx(j,{variant:"contained",fullWidth:!0,onClick:je,disabled:J,children:J?e.jsx(v,{size:24}):`Buy ${p} Credits`}),e.jsx(i,{sx:{mt:3},children:["No commitment — pay only for what you use","Connect unlimited accounts","Ideal for occasional posting"].map(s=>e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[e.jsx(N,{sx:{fontSize:18,color:"success.main"}}),e.jsx(t,{variant:"body2",children:s})]},s))})]})}),e.jsx(ae,{sx:{flex:1,borderRadius:3,border:a?.recommendedPlan==="SUBSCRIPTION"?"3px solid #2748F2":"2px solid #E5E7EB"},children:e.jsxs(ne,{sx:{p:3},children:[e.jsxs(i,{sx:{display:"flex",alignItems:"center",mb:1},children:[e.jsx(re,{sx:{mr:1}}),e.jsx(t,{variant:"h6",children:"Subscription"}),m&&e.jsx(W,{label:"Current Plan",size:"small",color:"primary",sx:{ml:"auto"}})]}),e.jsxs(i,{sx:{display:"flex",alignItems:"baseline",gap:.5,mb:1},children:[e.jsxs(t,{variant:"h4",sx:{fontWeight:"bold"},children:["$",D.toFixed(0)]}),e.jsxs(t,{variant:"body2",color:"text.secondary",children:["/seat/",x===g.YEAR?"year":"month"]})]}),m?e.jsxs(e.Fragment,{children:[e.jsx(t,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"To change seats, billing cycle, payment method, or cancel, use the Stripe Billing Portal."}),e.jsx(j,{variant:"outlined",fullWidth:!0,onClick:I,disabled:h,children:h?e.jsx(v,{size:24}):"Manage Subscription in Stripe"})]}):e.jsxs(e.Fragment,{children:[e.jsxs($e,{value:x,exclusive:!0,onChange:(s,d)=>d&&me(d),size:"small",sx:{mb:3,width:"100%"},children:[e.jsx(oe,{value:g.MONTH,sx:{flex:1},children:"Monthly"}),e.jsxs(oe,{value:g.YEAR,sx:{flex:1},children:["Yearly",e.jsx(W,{label:"Save 20%",size:"small",color:"success",sx:{ml:1}})]})]}),e.jsx(ie,{label:"Number of seats",type:"number",value:c,onChange:s=>X(Math.max(o,parseInt(s.target.value)||o)),fullWidth:!0,size:"small",slotProps:{input:{inputProps:{min:o,max:50}}},helperText:o>1?`Minimum ${o} seats required for your ${o} connected accounts. Total: $${(c*D).toFixed(2)}/${x===g.YEAR?"year":"month"}`:`Total: $${(c*D).toFixed(2)}/${x===g.YEAR?"year":"month"}`,sx:{mb:2}}),e.jsx(j,{variant:"contained",fullWidth:!0,onClick:ye,disabled:h||c<o,children:h?e.jsx(v,{size:24}):`Subscribe — ${c} Seat${c>1?"s":""}`})]}),e.jsx(i,{sx:{mt:3},children:["Unlimited posting per seat","Best for regular posting schedules","Priority support"].map(s=>e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[e.jsx(N,{sx:{fontSize:18,color:"success.main"}}),e.jsx(t,{variant:"body2",children:s})]},s))})]})})]}),m&&r&&e.jsxs(z,{sx:{p:3,mb:3},children:[e.jsxs(i,{sx:{display:"flex",alignItems:"center",mb:2},children:[e.jsx(re,{sx:{mr:1}}),e.jsx(t,{variant:"h6",children:"Your Subscription"})]}),e.jsx(ce,{sx:{mb:2}}),e.jsxs(t,{variant:"body1",gutterBottom:!0,children:[e.jsx("strong",{children:"Status:"})," ",k&&b?e.jsxs("span",{style:{color:"#B45309"},children:["Active — canceling on ",b.toLocaleDateString()]}):e.jsx("span",{style:{color:"green"},children:"Active"})]}),r.seats&&e.jsxs(t,{variant:"body1",gutterBottom:!0,children:[e.jsx("strong",{children:"Seats:"})," ",r.seats.total," total (",r.seats.available," available,"," ",r.seats.total-r.seats.available," in use)"]}),r.expiresAt&&e.jsxs(t,{variant:"body1",gutterBottom:!0,children:[e.jsxs("strong",{children:[k?"Ends":"Next Payment",":"]})," ",new Date(r.expiresAt).toLocaleDateString()]}),e.jsx(j,{variant:"contained",onClick:I,disabled:h,sx:{mt:2},children:h?e.jsx(v,{size:24}):"Manage Subscription in Stripe"})]}),S&&K.length>0&&e.jsxs(z,{sx:{p:3},children:[e.jsxs(i,{sx:{display:"flex",alignItems:"center",mb:2},children:[e.jsx(Le,{sx:{mr:1}}),e.jsx(t,{variant:"h6",children:"Transaction History"})]}),e.jsx(ce,{sx:{mb:2}}),e.jsx(Me,{children:e.jsxs(Ye,{size:"small",children:[e.jsx(ze,{children:e.jsxs(le,{children:[e.jsx(u,{children:"Date"}),e.jsx(u,{children:"Description"}),e.jsx(u,{align:"right",children:"Amount"}),e.jsx(u,{align:"right",children:"Balance"})]})}),e.jsx(Ne,{children:K.map(s=>e.jsxs(le,{children:[e.jsx(u,{children:new Date(s.createdTime).toLocaleDateString()}),e.jsx(u,{children:s.description}),e.jsxs(u,{align:"right",sx:{color:s.amount>0?"success.main":"error.main"},children:[s.amount>0?"+":"",s.amount]}),e.jsx(u,{align:"right",children:s.balanceAfter})]},s.id))})]})}),e.jsx(We,{component:"div",count:he,page:B,onPageChange:(s,d)=>pe(d),rowsPerPage:10,rowsPerPageOptions:[10]})]})]})};export{ts as default};
4
5
6//# debugId=67499384-d5c7-5f81-98c3-e5477629db95

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.