PageSourceSearch

https://www.ag3ntic.ai/assets/billing-AEtQ94e1.js

js ag3ntic.ai collected 2026-10-05 13:41:02 UTC 15,297 bytes, 5 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]="df336f3b-c6f2-591e-8ff1-3fd2f267b1d2")}catch(e){}}();
3import{a as e,t}from"./jsx-runtime-CMgEUHpv.js";import{V as n,g as r}from"./dist-CAHjj65Z.js";import{t as i}from"./useTranslation-BymTnaHx.js";import{O as a,l as o}from"./components-B8bHjdou.js";import{t as s}from"./classnames-PxzWHlFm.js";import{t as c}from"./Typography-DJfjxaJy.js";import{n as l,r as u,t as d}from"./Section-C5SudLaW.js";import{t as f}from"./CheckIcon-DAWL0w4I.js";import{t as p}from"./ChevronDownIcon-Ezx0ffYN.js";import{t as m}from"./StatusInputs-Bo_bMqPM.js";import{t as h}from"./useToast-aQCYBESc.js";import{t as g}from"./Button-DG1GtAKw.js";import{t as _}from"./disclosure-Z-IQsoqQ.js";import{t as v}from"./useTypedLoaderData-p1j97aJ6.js";import{n as y,t as b}from"./getMergedMetaData-BX84vd1a.js";import{n as x,r as S,t as C}from"./subscriptions-oAlKpbbg.js";import{t as w}from"./Badge-Bh7O_4Po.js";var T=e(n());function E({title:e,titleId:t,...n},r){return T.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?T.createElement(`title`,{id:t},e):null,T.createElement(`path`,{fillRule:`evenodd`,d:`M8.25 3.75H19.5a.75.75 0 0 1 .75.75v11.25a.75.75 0 0 1-1.5 0V6.31L5.03 20.03a.75.75 0 0 1-1.06-1.06L17.69 5.25H8.25a.75.75 0 0 1 0-1.5Z`,clipRule:`evenodd`}))}var D=T.forwardRef(E);function O({title:e,titleId:t,...n},r){return T.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?T.createElement(`title`,{id:t},e):null,T.createElement(`path`,{fillRule:`evenodd`,d:`M11.47 7.72a.75.75 0 0 1 1.06 0l7.5 7.5a.75.75 0 1 1-1.06 1.06L12 9.31l-6.97 6.97a.75.75 0 0 1-1.06-1.06l7.5-7.5Z`,clipRule:`evenodd`}))}var k=T.forwardRef(O),A=e(s(),1),j=({subscription:e,subscriberId:t,isLoggedIn:n})=>{let r=o(),i=e.tier===`premium`,a=e.stripe_customer_id,s=i&&a&&n,[c,l]=(0,T.useState)(!1);return(0,T.useEffect)(()=>{!c&&s&&(r.load(`/stripe_premium_session?subscriber_id=${t}`),l(!0))},[r,s]),{isLoading:r.state===`loading`||!r?.data,premiumSessionUrl:r?.data?.sessionUrl}},M=e=>(e[0]||``).toUpperCase()+e.substring(1),N=t(),P=(0,T.createContext)(void 0);P.displayName=`BillingContext`;var F=({loaderData:e,children:t})=>{let{upgradePage:n,billingSummary:r,billingDetails:i,pricingDetails:a,subscription:o,subscriberId:s,isLoggedIn:c,publication:l}=e,{premium_enabled:u}=l,d=o.tier===`free`,f=o.tier===`premium`,p=o.premium_tiers.some(e=>e.permanent),[m,h]=(0,T.useState)(!1),[g,_]=(0,T.useState)(!1),v=(0,T.useMemo)(()=>({upgradePage:n,billingSummary:r,billingDetails:i,pricingDetails:a,publication:l,publicationPremiumEnabled:u,subscription:o,subscriberId:s,isLoggedIn:c,isFreeTier:d,isPremiumTier:f,isPermanentlyUpgraded:p,isPlansModalOpen:m,setIsPlansModalOpen:h,isChangingPlan:g,setIsChangingPlan:_}),[n,r,i,a,l,u,o,s,c,d,f,p,m,h,g,_]);return(0,N.jsx)(P.Provider,{value:v,children:t})},I=()=>{let e=(0,T.useContext)(P);if(e===void 0)throw Error(`useBillingContext must be used within a BillingProvider`);return e},L=()=>{let[e]=a(),t=e.get(`redirect_to_stripe`),{t:n}=i(``,{keyPrefix:`billing.details`}),{subscription:r,subscriberId:o,billingDetails:s,isPremiumTier:l,isLoggedIn:u}=I(),{premiumSessionUrl:f,isLoading:p}=j({subscription:r,subscriberId:o,isLoggedIn:u}),{line1:m,line2:h,state:_,city:v,country:y,postal_code:b}=s?.address||{},x=()=>{f&&(window.location.href=f)};return(0,T.useEffect)(()=>{t&&x()},[t]),l?(0,N.jsx)(d,{title:n(`title`),titleAction:(0,N.jsxs)(g,{type:`button`,variant:`secondary`,disabled:p,onClick:x,className:`space-x-1`,children:[(0,N.jsx)(`span`,{children:`Update Billing Info`}),(0,N.jsx)(D,{className:(0,A.default)(`h-4 w-4`,p?`text-gray-300`:`text-gray-600`)})]}),children:(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(c,{as:`p`,weight:`medium`,children:`Billing Information`}),(0,N.jsx)(`div`,{className:`px-3 py-2 bg-gray-100 border border-gray-200 rounded`,children:(0,N.jsxs)(c,{as:`p`,size:`sm`,className:`text-gray-400`,children:[`Name: `,s?.name||`-`,(0,N.jsx)(`br`,{}),(0,N.jsx)(`br`,{}),`Email: `,s?.email||`-`,(0,N.jsx)(`br`,{}),(0,N.jsx)(`br`,{}),`Address:`,(0,N.jsx)(`br`,{}),m&&(0,N.jsxs)(N.Fragment,{children:[m,(0,N.jsx)(`br`,{})]}),h&&(0,N.jsxs)(N.Fragment,{children:[h,(0,N.jsx)(`br`,{})]}),v&&_&&b&&(0,N.jsxs)(N.Fragment,{children:[v,`, `,_,` `,b,(0,N.jsx)(`br`,{})]}),y&&(0,N.jsxs)(N.Fragment,{children:[y,(0,N.jsx)(`br`,{})]}),(0,N.jsx)(`br`,{}),`Phone: `,s?.phone||`-`,(0,N.jsx)(`br`,{}),(0,N.jsx)(`br`,{}),`Tax IDs: `,s?.tax_ids?.join(`,`)||`-`]})})]}),s?.brand&&s?.last4&&(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(c,{as:`p`,weight:`medium`,children:`Payment Method`}),(0,N.jsx)(`div`,{className:`px-3 py-2 bg-gray-100 border border-gray-200 rounded`,children:(0,N.jsxs)(c,{as:`p`,size:`sm`,className:`text-gray-400`,children:[`Credit Card: `,M(s?.brand||``),` ending in `,s?.last4,(0,N.jsx)(`br`,{}),`Expires `,s?.exp_month,`/`,s?.exp_year]})})]})]})}):null},R=({locale:e=S,currency:t=`usd`})=>new Intl.NumberFormat(e,{style:`currency`,currency:t,minimumFractionDigits:2}),z=({locale:e=S})=>new Intl.DateTimeFormat(e,{year:`numeric`,month:`long`,day:`numeric`,timeZone:`UTC`}),B=({title:e,timestampPrefix:t,timestamp:n,amountCents:r,currency:a=`usd`,interval:o,locale:s=S,discount:l})=>{let{t:u}=i(``,{keyPrefix:`billing.summary`}),d=n?z({locale:s}).format(new Date(n)):u(`n_a`);return(0,N.jsxs)(`div`,{className:`w-full space-y-4 rounded border border-gray-200 bg-gray-50 p-6`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(c,{size:`xs`,children:e}),(0,N.jsxs)(c,{size:`sm`,weight:`light`,color:`text-gray-600`,children:[t,` `,d]})]}),l&&l>0&&(0,N.jsx)(`div`,{className:`rounded border border-yellow-200 bg-yellow-50 px-3 py-2`,children:(0,N.jsxs)(c,{size:`xs`,color:`text-yellow-800`,children:[u(`discount_applied`),`: `,R({locale:s,currency:a}).format(l/100)]})}),(0,N.jsxs)(`div`,{className:`flex flex-row items-end`,children:[(0,N.jsx)(c,{className:`w-full`,weight:`semibold`,size:`4xl`,children:typeof r==`number`?R({locale:s,currency:a}).format(r/100):u(`n_a`)}),o&&(0,N.jsxs)(c,{className:`mt-auto w-full whitespace-nowrap text-right`,weight:`light`,size:`sm`,color:`text-gray-600`,children:[`/`,u(`intervals.${o}`)]})]})]})},V={monthly:`month`,annual:`year`,quarterly:`quarter`},H=()=>{let{t:e}=i(``,{keyPrefix:`billing.summary`}),{isPremiumTier:t,isPermanentlyUpgraded:n,publication:r,billingSummary:a,subscription:o}=I();if(!t||o.status===`inactive`)return null;let{last_invoice:s,next_invoice:l}=a||{},u=o.premium_tiers.find(e=>e.paid_trial_info)?.paid_trial_info;return u?(0,N.jsx)(d,{title:e(`title`),children:(0,N.jsxs)(`div`,{className:`space-y-4 md:flex md:space-x-6 md:space-y-0`,children:[(0,N.jsx)(B,{title:e(`paid_trial.current_heading`),amountCents:u.trial_price_cents,interval:V[u.trial_billing_cadence],currency:u.currency,locale:r.language}),u.regular_price_cents==null?(0,N.jsxs)(`div`,{className:`w-full space-y-4 rounded border border-gray-200 bg-gray-50 p-6`,children:[(0,N.jsx)(`div`,{children:(0,N.jsx)(c,{size:`xs`,children:e(`paid_trial.upcoming_heading`)})}),(0,N.jsx)(`div`,{className:`flex flex-row items-end`,children:(0,N.jsx)(c,{className:`w-full`,weight:`semibold`,size:`4xl`,children:e(`n_a`)})})]}):(0,N.jsx)(B,{title:e(`paid_trial.upcoming_heading`),timestampPrefix:e(`paid_trial.upcoming_timestamp_prefix`),timestamp:u.ends_at,amountCents:u.regular_price_cents,interval:u.regular_billing_cadence?V[u.regular_billing_cadence]??u.regular_billing_cadence:void 0,currency:u.currency,locale:r.language})]})}):(0,N.jsx)(d,{title:e(`title`),children:(0,N.jsxs)(`div`,{className:`space-y-4 md:flex md:space-x-6 md:space-y-0`,children:[(0,N.jsx)(B,{title:e(`last_heading`),timestampPrefix:e(`last_timestamp_prefix`),timestamp:s?.timestamp,amountCents:s?.amount_cents,currency:s?.currency,interval:s?.cadence,locale:r.language,discount:s?.discount}),n?(0,N.jsxs)(`div`,{className:`w-full space-y-4 rounded border border-gray-200 bg-gray-50 p-6`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(c,{size:`xs`,children:e(`next_heading`)}),(0,N.jsx)(c,{size:`sm`,weight:`light`,color:`text-gray-600`,children:e(`lifetime_timestamp_prefix`)})]}),(0,N.jsx)(`div`,{className:`flex flex-row items-end`,children:(0,N.jsx)(c,{className:`w-full`,weight:`semibold`,size:`4xl`,children:e(`n_a`)})})]}):(0,N.jsx)(B,{title:e(`next_heading`),timestampPrefix:e(`next_timestamp_prefix`),timestamp:l?.timestamp,amountCents:l?.amount_cents,currency:l?.currency,interval:l?.cadence,locale:r.language,discount:l?.discount})]})})},U=({title:e,description:t,features:n})=>(0,N.jsxs)(`div`,{className:`overflow-hidden rounded-md border border-gray-200`,children:[(0,N.jsxs)(`div`,{className:`border-b border-gray-200 bg-gray-50 px-6 pb-4 pt-6`,children:[(0,N.jsx)(c,{as:`h3`,weight:`medium`,color:`text-900`,children:e}),t&&(0,N.jsx)(c,{as:`p`,size:`sm`,className:`text-gray-700`,children:t})]}),(0,N.jsx)(`ul`,{className:`space-y-3 px-6 pb-6 pt-4`,children:n.map(e=>(0,N.jsxs)(`li`,{className:`flex space-x-2 align-middle`,children:[(0,N.jsx)(f,{className:`mt-1 h-3 w-3 text-gray-700`}),(0,N.jsx)(c,{size:`sm`,className:`text-gray-700`,children:e})]},e))})]}),W=({upgradePage:e})=>{let{t}=i(``,{keyPrefix:`billing`}),n=r();return e?(0,N.jsx)(d,{title:t(`current_plan.title`),titleAction:(0,N.jsx)(g,{type:`button`,variant:`primary`,onClick:()=>n(`/upgrade`),children:t(`free_plan.upgrade`)}),children:(0,N.jsx)(U,{title:`Free Plan`,description:``,features:e.main_section.free_card_features})}):null},G=({price:e,tierName:t,isSubscribed:n})=>{let{t:a}=i(``,{keyPrefix:`billing.plans_modal`}
3),s=r(),{subscription:c,setIsPlansModalOpen:l,setIsChangingPlan:u}=I(),d=o(),f=d.data,p=d.state===`submitting`;return h(f?.toast),(0,T.useEffect)(()=>{f?.toast?.status===`success`&&(l(!1),s(`/subscribe/${c.id}/billing`))},[f?.toast,s,c.id,l]),(0,T.useEffect)(()=>{u(p)},[p,u]),(0,N.jsxs)(d.Form,{method:`patch`,action:`/update_subscription`,children:[(0,N.jsx)(`input`,{hidden:!0,name:`price_id`,defaultValue:e.id}),(0,N.jsx)(m,{name:`update_subscription`,errorMessage:a(`toast.error`),successMessage:a(`toast.success`)}),n?(0,N.jsx)(g,{variant:`primary`,className:`w-full`,disabled:!0,children:a(`current_plan_button`)}):(0,N.jsx)(g,{type:`submit`,variant:`primary`,className:`w-full`,isLoading:p,children:a(`select_plan_button`,{tier_name:t,interval:a(`intervals.${e.interval}`)})})]})},K=({tierName:e,price:t,isSubscribed:n})=>{let{t:r}=i(``,{keyPrefix:`billing.plans_modal`}),{publication:a}=I(),o=a.language,s=t.currency;return(0,N.jsxs)(`div`,{className:`flex flex-col flex-1 w-full border border-gray-200 rounded`,children:[(0,N.jsxs)(`div`,{className:`flex flex-row items-end p-4 bg-gray-100`,children:[(0,N.jsx)(c,{className:`w-full`,weight:`semibold`,size:`4xl`,children:R({locale:o,currency:s}).format(t.amount_cents/100)}),(0,N.jsxs)(c,{className:`w-full mt-auto text-right whitespace-nowrap`,weight:`light`,size:`sm`,color:`text-gray-600`,children:[`/`,r(`billing_intervals.${t.interval}`)]})]}),(0,N.jsxs)(`div`,{className:`flex flex-col justify-between flex-1 p-4`,children:[(0,N.jsx)(`div`,{className:`flex-grow mb-4 space-y-1`,children:t.features?.map(e=>(0,N.jsxs)(`div`,{className:`flex space-x-2 align-middle`,children:[(0,N.jsx)(f,{className:`w-3 h-3 mt-1 text-gray-700`}),(0,N.jsx)(c,{size:`sm`,className:`text-gray-700`,children:e})]},`${t.id}_${e}`))}),(0,N.jsx)(G,{price:t,tierName:e,isSubscribed:n})]})]})},q=({tier:e,isSubscribed:t})=>{let{billingSummary:n}=I();return(0,N.jsx)(_,{as:`div`,children:({open:r})=>(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(_.Button,{className:`flex items-center justify-between w-full px-8 pt-6 pb-4 space-x-6 text-left transition-colors bg-gray-50 hover:bg-gray-100`,children:[(0,N.jsxs)(`div`,{className:`space-y-1`,children:[(0,N.jsxs)(`div`,{className:`flex space-x-2`,children:[(0,N.jsx)(c,{size:`xs`,children:e.name}),t&&(0,N.jsx)(w,{size:`sm`,type:`success`,children:`Active`})]}),(0,N.jsx)(c,{size:`sm`,weight:`light`,color:`text-gray-600`,children:e.description})]}),r?(0,N.jsx)(k,{className:`w-5 h-5`,"aria-hidden":`true`}):(0,N.jsx)(p,{className:`w-5 h-5`,"aria-hidden":`true`})]}),(0,N.jsx)(_.Panel,{className:`grid gap-4 p-6 border-t md:grid-cols-2`,children:e.prices.map(t=>(0,N.jsx)(K,{tierName:e.name,price:t,isSubscribed:n?.price_id===t.id},t.id))})]})})},J=({isOpen:e,onClose:t})=>{let{t:n}=i(``,{keyPrefix:`billing.plans_modal`}),{pricingDetails:r,publicationPremiumEnabled:a,subscription:o,isChangingPlan:s}=I(),u=(r?.tiers||[]).filter(e=>e.prices.filter(e=>e.interval!==C.DONATION).length>0),d=o.premium_tiers;return!a||!u?null:(0,N.jsx)(x,{title:n(`title`),message:``,isOpen:e,onClose:()=>{s||t()},panelSizeClass:`max-w-2xl`,children:(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`div`,{className:`-mx-6 -mb-6 divide-y border-t border-gray-200`,children:u.map(e=>(0,N.jsx)(q,{tier:e,isSubscribed:d.some(t=>t.id===e.id)},e.id))}),s&&(0,N.jsxs)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-white bg-opacity-80`,children:[(0,N.jsx)(l,{className:`mr-3`}),(0,N.jsxs)(c,{as:`p`,size:`sm`,className:`text-gray-700`,children:[n(`submitting`),`…`]})]})]})})},Y=()=>{let{t:e}=i(``,{keyPrefix:`billing`}),{pricingDetails:t,billingSummary:n,isPlansModalOpen:r,setIsPlansModalOpen:a}=I();if(!t||!n)return null;let o=t.tiers.find(e=>e.prices.find(e=>e.id===n.price_id)),s=o?.prices.find(e=>e.id===n.price_id);return(0,N.jsxs)(d,{title:e(`current_plan.title`),titleAction:(0,N.jsx)(g,{type:`button`,variant:`secondary`,onClick:()=>a(!0),className:`space-x-1`,children:e(`plan.change_plan`)}),children:[(0,N.jsx)(`div`,{className:`space-y-4`,children:o&&s&&(0,N.jsx)(U,{title:o.name,description:o.description,features:s.features})}),(0,N.jsx)(J,{isOpen:r,onClose:()=>a(!1)})]})},X=()=>{let{t:e}=i(``,{keyPrefix:`billing`});return(0,N.jsx)(d,{title:e(`summary.title`),children:(0,N.jsx)(`p`,{className:`mt-4 py-4 text-left text-gray-500 lg:py-8 lg:text-center`,children:e(`summary.empty_state`)})})},Z=({data:e,matches:t})=>{let n=(t?.find(e=>e?.id===`root`))?.data?.publication,r=e?.metaTitle;return!n||!r?[{robots:`noindex`}]:b({canonicalUrl:y(e?.requestUrl),matches:t,returnEarlyCheck:!r,overrides:{robots:`noindex`,title:r,de
3scription:`Billing - ${n.name}`}})},Q=()=>{let{upgradePage:e,subscription:t,publication:n,publicationPremiumEnabled:r,isFreeTier:i,isPremiumTier:a,isLoggedIn:o}=I();return(0,N.jsx)(u,{isLoggedIn:o,subscriberId:t?.subscriber_id||``,hasPreferencesEnabled:n.has_subscriber_preferences,children:!r&&i?(0,N.jsx)(X,{}):(0,N.jsxs)(N.Fragment,{children:[a&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(H,{}),(0,N.jsx)(Y,{}),(0,N.jsx)(L,{})]}),i&&(0,N.jsx)(W,{upgradePage:e})]})})},$=()=>(0,N.jsx)(F,{loaderData:v(),children:(0,N.jsx)(Q,{})});export{$ as default,Z as meta};
4//# sourceMappingURL=billing-AEtQ94e1.js.map
5//# debugId=df336f3b-c6f2-591e-8ff1-3fd2f267b1d2

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.