1import{f as ce,u as de,r as s,e as pe,j as e,S as ue,B as Y,C as ge,M as X}from"./index-BrT3F50e.js";import{I as H}from"./InfoSideCard-D3wCsKBG.js";import{C as K,D as N,a as he}from"./SettingsIcons-BTuZkbEP.js";import{p as d}from"./pricing-CyMwrRy-.js";import{f as me}from"./dayjs-CSchl2My.js";import{A as G}from"./index-DRrMmQ2c.js";import{R as $,C as A}from"./row-D-CZ3Hqh.js";import{C as D}from"./index-DhkPBYEu.js";import{T as fe}from"./index-JIFlWX-e.js";import{T as O}from"./index-KB2153Cz.js";import{S as xe}from"./index-BPE400BZ.js";import{I as ye}from"./index-BI2D8MSW.js";import{s as f}from"./index-DtDFBFnu.js";import"./timezoneNormalizer-l1yj-VtS.js";import"./useBreakpoint-FD8ghq8d.js";import"./index-DIQCRyy8.js";import"./EllipsisOutlined-Cu-qV7Vg.js";import"./Overflow-BkMYm1DN.js";import"./PlusOutlined-B06sW5qS.js";import"./Dropdown-DXdTgnhA.js";import"./getAllowClear-C4A34otO.js";import"./styleChecker-CI4V7a_h.js";import"./TextArea-BpydDq59.js";import"./Input-DOcZa3u3.js";const B=[{id:"",product_id:"prod_UKnRUDWdfjhVpe",name:"A pinch",description:"",credits:1e3,price:4.99,checkout_url:"login",interval:"month"},{id:"",product_id:"prod_UKnUCqaLA8ITfP",name:"A sprinkle",description:"",credits:2e3,price:9.99,checkout_url:"login",interval:"month"},{id:"",product_id:"prod_UKnUR9RdhnfG6K",name:"A handful",description:"",credits:5e3,price:19.99,checkout_url:"login",interval:"month"},{id:"",product_id:"prod_UKnVXvdOTqoaV6",name:"A pinch",description:"",credits:12e3,price:49,checkout_url:"login",interval:"year"},{id:"",product_id:"prod_UKnWVjGnJTuFLN",name:"A sprinkle",description:"",credits:24e3,price:99,checkout_url:"login",interval:"year"},{id:"",product_id:"prod_UKnXK000el7odT",name:"A handful",description:"",credits:6e4,price:219,checkout_url:"login",interval:"year"}],{Title:R,Text:c}=fe,V=u=>u==="year"?2:u==="month"?1:0,we={components:{Segmented:{itemColor:"rgba(28, 29, 31, 0.5)",itemHoverColor:"rgba(28, 29, 31, 0.7)",itemSelectedBg:"#2F6DFB",itemSelectedColor:"#F8F8F8",trackBg:"#F4F4F5",borderRadius:10,controlHeight:40,trackPadding:5}}},z={padding:30,marginBottom:20,borderRadius:20,border:"1px solid #E4E4E4"},T={header:{borderBottom:"none",padding:0,minHeight:"auto",marginBottom:30},body:{padding:0}},Ce=[{name:"Generate Email",cost:"15 credits"},{name:"Send Email",cost:"1 credit",suffix:"per contact"},{name:"Test send / preview",cost:"FREE",isFree:!0}];function Ne({isPublic:u=!1}){const{workspaceId:q}=ce({strict:!1}),{workspaces:Z}=de(),J=Z.find(t=>t.id===q)?.settings.timezone,[x,Q]=s.useState("Monthly"),[h,ee]=s.useState(""),[l,te]=s.useState(void 0),o=!!localStorage.getItem("auth_token"),[y,w]=s.useState(o?[]:B),[ne,C]=s.useState(o),[ie,W]=s.useState(null),[r,E]=s.useState(null),[L,b]=s.useState(!0),[j,S]=s.useState(null),[_,v]=s.useState(null),n=pe();s.useEffect(()=>{o?d.subscription().then(t=>{E(t),b(!1)}).catch(()=>{b(!1)}):b(!1)},[o]),s.useEffect(()=>{if(!o&&!l){w(B),C(!1);return}(async()=>{C(!0);try{const i=o?await d.get(l):await d.publicGet(l);w((i.products||[]).filter(a=>a.credits>=0))}catch(i){console.error(i),o||w(B)}finally{C(!1)}})()},[l,o]);const re=t=>`$${t.toFixed(2)}`,k={padding:16,marginBottom:16,borderRadius:16,border:"1px solid #E4E4E4"},g=r?.price_id?y.find(t=>t.price_id===r.price_id):void 0,M=!!(r?.is_subscribed&&r.price_id&&y.length>0&&!g),P=!!r?.pending_price_id,U=t=>{if(!r?.is_subscribed||!r.price_id)return"new";if(M||!t.price_id)return"unavailable";if(t.price_id===r.price_id)return P?"keep_current":"current";if(P&&t.price_id===r.pending_price_id)return"scheduled";if(!g)return"unavailable";const i=V(g.interval),a=V(t.interval);return a>i?"upgrade":a<i?"downgrade":(t.credits??0)>(g.credits??0)?"upgrade":(t.credits??0)<(g.credits??0)?"downgrade":"unavailable"},se=t=>{switch(t){case"current":return"Current Plan";case"keep_current":return"Keep current plan";case"scheduled":return"Scheduled";case"upgrade":return"Upgrade";case"downgrade":return"Downgrade";case"unavailable":return"Unavailable";default:return"Select Plan"}},F=async()=>{const t=await d.subscription();E(t)},I=async t=>{if(!o){window.open(t.checkout_url||"login","_blank");return}if(!t.price_id)return;const i=U(t);if(!(i==="current"||i==="scheduled"||i==="unavailable")){W(t.price_id);try{if(i==="keep_current")await d.upgradeSubscription(t.price_id),f.success("Scheduled plan change cancelled"),await F();else if(i==="upgrade")await d.upgradeSubscription(t.price_id,l),f.success("Plan upgraded successfully"),await F();else if(i==="downgrade")await d.downgradeSubscription(t.price_id,l),f.success("Plan downgrade scheduled for next billing period"),await F();else{const a=await d.subscriptionCheckout(t.price_id,l);a.checkout_url&&window.open(a.checkout_url,"_blank")}}catch(a){console.error(a),f.error("Something went wrong")}finally{W(null)}}},oe=async()=>
1{if(!j)return;const t=j;S(null),await I(t)},ae=async()=>{if(!_)return;const t=_;v(null),await I(t)},m=r?.pending_change_at?me(r.pending_change_at,J,"MMM D, YYYY"):null;return e.jsxs("div",{children:[!n&&!u&&e.jsx("div",{className:"flex justify-between items-center px-5 shrink-0",style:{position:"sticky",top:0,zIndex:10,height:"60px",backgroundColor:"#FAFAFA",borderBottom:"1px solid #EAEAEC"},children:e.jsx("h1",{className:"text-2xl font-semibold",style:{color:"#1C1D1F",marginBottom:0},children:"Pricing"})}),e.jsxs("div",{style:{padding:u?0:n?16:20},children:[n&&e.jsx("div",{style:{marginBottom:16},children:e.jsx(H,{icon:e.jsx(K,{size:32}),title:"How Credits Work",description:"Credits are used for everything inside Smart Mail AI â generating content, building emails, and sending campaigns. You'll always see the estimated credit cost before sending.",showPolicyLinks:!1})}),P&&e.jsx(G,{type:"info",showIcon:!0,style:{marginBottom:n?16:20,borderRadius:12},message:r?.pending_plan?`Scheduled change to ${r.pending_plan}${m?` on ${m}`:""}`:`Scheduled plan change${m?` on ${m}`:""}`,description:"Click your current plan to cancel, or upgrade now to cancel and switch immediately."}),e.jsxs($,{gutter:n?0:20,children:[e.jsxs(A,{xs:24,lg:15,children:[e.jsx(D,{style:n?k:z,styles:T,title:e.jsxs("div",{style:{display:"flex",flexDirection:n?"column":"row",alignItems:n?"stretch":"center",justifyContent:"space-between",gap:n?16:0},children:[e.jsx(R,{level:3,style:{margin:0,fontSize:n?20:24,fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:"Flexible subscription plans for every need"}),e.jsx(ge,{theme:we,children:e.jsx(xe,{value:x,onChange:t=>Q(t),options:["Monthly","Yearly"]})})]}),children:ne?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(ue,{})}):e.jsx($,{gutter:[n?10:16,n?10:16],children:y.map((t,i)=>{const a=x==="Yearly"&&t.interval==="year"||x==="Monthly"&&t.interval==="month",p=U(t),le=p==="current"||p==="scheduled"||p==="unavailable"||o&&(L||M);return a?e.jsx(A,{xs:24,sm:8,children:e.jsxs("div",{style:{textAlign:"center",borderRadius:20,padding:n?24:"30px 20px",background:"#F4F4F5",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[e.jsx("div",{style:{marginBottom:10},children:e.jsx(c,{style:{fontSize:n?20:24,fontWeight:500,lineHeight:1},children:t.name})}),e.jsxs(O,{style:{marginBottom:10,marginRight:0,padding:"8px 14px",borderRadius:10,background:"#1C1D1F0D",border:"none",display:"inline-flex",alignItems:"center",maxWidth:"100%",whiteSpace:"nowrap"},children:[e.jsx(N,{size:16}),e.jsxs(c,{style:{fontSize:14,fontWeight:500,color:"#1C1D1F",marginLeft:5,whiteSpace:"nowrap"},children:[(t.credits??0).toLocaleString()," credits"]})]}),e.jsxs(O,{style:{marginBottom:10,marginRight:0,padding:"8px 14px",borderRadius:10,background:"#1C1D1F0D",border:"none",display:"inline-flex",alignItems:"center",maxWidth:"100%",whiteSpace:"normal"},children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M18.5051 19H20C21.1046 19 22.0669 18.076 21.716 17.0286C21.1812 15.4325 19.8656 14.4672 17.5527 14.1329M14.5001 10.8645C14.7911 10.9565 15.1244 11 15.5 11C17.1667 11 18 10.1429 18 8C18 5.85714 17.1667 5 15.5 5C15.1244 5 14.7911 5.04354 14.5001 5.13552M9.5 14C13.1135 14 15.0395 15.0095 15.716 17.0286C16.0669 18.076 15.1046 19 14 19H5C3.89543 19 2.93311 18.076 3.28401 17.0286C3.96047 15.0095 5.88655 14 9.5 14ZM9.5 11C11.1667 11 12 10.1429 12 8C12 5.85714 11.1667 5 9.5 5C7.83333 5 7 5.85714 7 8C7 10.1429 7.83333 11 9.5 11Z",stroke:"#2F6DFB",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsxs(c,{style:{fontSize:14,fontWeight:500,color:"#1C1D1F",marginLeft:5,whiteSpace:"normal"},children:[(t.search_requests??(t.credits??0)*10).toLocaleString()," lead searches"]})]}
1),e.jsxs("div",{style:{marginBottom:n?20:24,display:"flex",alignItems:"flex-end",justifyContent:"center",gap:4},children:[e.jsx(c,{style:{fontSize:n?28:32,fontWeight:500,lineHeight:1,color:"#1C1D1F",whiteSpace:"nowrap"},children:re(t.price)}),e.jsxs(c,{style:{fontSize:14,fontWeight:500,color:"rgba(28, 29, 31, 0.5)",paddingBottom:2,whiteSpace:"nowrap"},children:["/",t.interval==="year"?"year":"month"]})]}),e.jsx(Y,{type:"primary",block:!0,disabled:le,loading:ie===t.price_id,onClick:()=>{p==="upgrade"?S(t):p==="downgrade"?v(t):I(t)},style:{borderRadius:8,height:40,fontWeight:600},children:o&&L?"Loading...":se(p)})]})},t.id||i):null})})}),e.jsx(D,{style:n?k:z,styles:T,title:e.jsx(R,{level:3,style:{margin:0,fontSize:n?20:24,fontWeight:700},children:"Got a discount?"}),children:e.jsxs("div",{style:{display:"flex",flexDirection:n?"column":"row",alignItems:n?"stretch":"center",gap:n?12:16},children:[e.jsxs("div",{style:{flex:n?void 0:1},children:[e.jsx(c,{style:{fontSize:16,fontWeight:600},children:"Enter the code in the box"}),e.jsx("br",{}),e.jsx(c,{style:{fontSize:14,fontWeight:500,color:"rgba(28, 29, 31, 0.4)"},children:"before starting subscription to receive discounted price"})]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx(ye,{placeholder:"XX-XX-XX-XX",value:h,onChange:t=>ee(t.target.value),style:{width:n?void 0:240,flex:n?1:void 0,height:50,borderRadius:10,textAlign:"center",fontSize:14}}),e.jsxs(Y,{type:"primary",disabled:!h,onClick:()=>te(h),style:{height:50,borderRadius:10,display:"flex",alignItems:"center",paddingInline:24,gap:8,...h?{}:{backgroundColor:"#2F6DFB33",border:"none",color:"#FAFAFA"}},children:[e.jsx(he,{size:18}),"Apply"]})]})]})}),e.jsx(D,{style:{...n?k:z,marginBottom:n?16:0},styles:T,title:e.jsx(R,{level:3,style:{margin:0,fontSize:n?20:24,fontWeight:700},children:"Pricing Table"}),children:Ce.map((t,i)=>e.jsxs("div",{style:{display:"flex",alignItems:n?"flex-start":"center",justifyContent:"space-between",flexDirection:n?"column":"row",gap:n?4:0,padding:n?"10px 8px":"10px",borderRadius:10,background:i%2===0?"#1C1D1F08":"transparent"},children:[e.jsx(c,{style:{fontSize:n?14:16,fontWeight:500},children:t.name}),e.jsxs("div",{className:"flex items-center gap-2",style:{flexShrink:0},children:[!t.isFree&&e.jsx(N,{size:14}),e.jsx(c,{style:{fontSize:n?13:14,fontWeight:500,...t.isFree?{color:"#1C1D1F"}:{}},children:t.cost}),t.suffix&&e.jsx(c,{style:{fontSize:n?13:14,fontWeight:500,color:"rgba(28, 29, 31, 0.4)"},children:t.suffix})]})]},i))})]}),!n&&e.jsx(A,{lg:9,children:e.jsx(H,{icon:e.jsx(K,{size:32}),title:"How Credits Work",description:"Credits are used for everything inside Smart Mail AI â generating content, building emails, and sending campaigns. You'll always see the estimated credit cost before sending.",showPolicyLinks:!1})})]})]}),e.jsxs(X,{title:"Confirm Plan Upgrade",open:!!j,onOk:oe,onCancel:()=>S(null),okText:"Yes, upgrade now",cancelText:"Cancel",children:[e.jsx("p",{children:"Your new subscription will start immediately at the full price. Are you sure you want to upgrade?"}),l&&e.jsxs("p",{style:{marginTop:12,color:"rgba(28, 29, 31, 0.65)"},children:["Promo code ",e.jsx("strong",{children:l})," will be applied to this upgrade if still valid."]})]}),e.jsxs(X,{title:"Confirm Plan Downgrade",open:!!_,onOk:ae,onCancel:()=>v(null),okText:"Yes, schedule downgrade",cancelText:"Cancel",children:[e.jsx("p",{children:"Your plan will change at the end of the current billing period. You keep your current plan until then."}),l&&e.jsx(G,{type:"warning",showIcon:!0,style:{marginTop:12},message:"Promo timing",description:"The discount applies when the new plan starts and may not apply if the code expires or is single-use before then."})]})]})}export{Ne as PricingPage};
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.