1import{c as Pe,u as _e,y as Se,ab as ke,I as pe,r as j,j as e,aq as Ae,aa as je,b1 as le,a$ as N,B as n,bW as De,Q as m,$ as u,bM as Me,bO as Ee,m as b,x as Te,V as _,Y as S,_ as $,a0 as v,s as Re,a1 as ie,bT as Ue,t as qe,ao as fe,b_ as ge,i as Fe,ag as Ne,aL as X,aO as J,cc as ve,al as Ie,ap as G,T as $e,H as Be,aP as ee,aQ as se,bb as te,b3 as ae,as as re,at as ce,au as de,av as oe,aw as xe,K as I}from"./index-B01jGDSO.js";import{T as Oe,a as Ye,b as me,c as C,d as Le,e as P}from"./table-B_s0nExu.js";import{S as ue}from"./switch-DMI64B-N.js";import{K as He}from"./key-round-Dn5RHfR1.js";import{S as Ke}from"./settings-2-CIaQOSEi.js";import{P as Qe}from"./pause-D1A_4xln.js";import{W as ye}from"./wallet-BY31gMZH.js";import{P as Ve}from"./printer-BUmnyIk3.js";import{D as We}from"./download-BRkpldLd.js";import{A as Ge,a as Xe}from"./arrow-up-GLAyVqpX.js";import{C as he}from"./credit-card-C2oB-bLE.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const be=Pe("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),Je=[{id:"profile",label:"Profile & Settings",icon:je},{id:"subscription",label:"Subscription & Plan",icon:ve},{id:"connected",label:"Connected Apps",icon:be},{id:"billing",label:"Billing History",icon:ye},{id:"notifications",label:"Notifications",icon:Ne}],T=[{id:"starter",name:"Starter",price:0,desc:"1 user · 1 crew · 5 routes/day",features:["1 User","1 Crew","CRM & Pipeline","Estimating & Proposals","Job Costing","Scheduling (1 crew)","Invoicing"]},{id:"growth",name:"Growth",price:49,desc:"3 users · 2 crews · 15 routes/day",features:["Everything in Starter","Fleet Tracking","Basic Reporting","Email Support"]},{id:"pro",name:"Professional",price:149,desc:"10 users · 5 crews · Unlimited routes",features:["Everything in Growth","Fleet & Equipment","Compliance & Training","AI Call-In & Alerts","QuickBooks Sync","Customer Portal","Employee Portal","WinterOps⢠Module"]},{id:"enterprise",name:"Enterprise",price:299,desc:"Unlimited users · crews · routes",features:["Everything in Professional","WinterOps⢠& Route Builder","Multi-Location / Holdings","Advanced AI & Guardrails","DocuSign Integration","Custom Automations","Priority Support","White-Label Branding"]}],Ze=["Too expensive","Don't need all features","Testing lower tier","Other"],ze=["Too expensive","Missing features","Switching to another tool","Business closed","Other"];function es({plan:o,organization:s,status:B,isPlatformOwner:l}){var F;const{toast:i}=pe(),y=Ie(),x=(o==null?void 0:o.id)||(s==null?void 0:s.plan_id)||"starter",w=T.findIndex(t=>t.id===x),[a,h]=j.useState(null),[f,k]=j.useState(""),[p,g]=j.useState(!1),[Z,c]=j.useState(!1),[A,R]=j.useState(""),[O,D]=j.useState(""),U=s==null?void 0:s.pending_plan_change,q=s==null?void 0:s.plan_change_date,Y=(F=T.find(t=>t.id===U))==null?void 0:F.name,L=(s==null?void 0:s.plan_status)==="cancelling",M=s!=null&&s.current_period_end?G(new Date(s.current_period_end),"MMM d, yyyy"):G(new Date(Date.now()+30*864e5),"MMM d, yyyy"),H=!!(s!=null&&s.stripe_subscription_id),K=async()=>{if(!(!a||!s)){if(!H){h(null),i({title:"Payment setup required",description:"Add a payment method to upgrade your plan."});return}g(!0);try{const{error:t}=await I.from("organizations").update({plan_id:a.targetPlan.id,pending_plan_change:null,plan_change_date:null,plan_status:"active"}).eq("id",s.id);if(t)throw t;await y.invalidateQueries({queryKey:["organization"]}),await y.invalidateQueries({queryKey:["subscription-plan"]}),i({title:`Plan upgraded to ${a.targetPlan.name}`,description:"Your new features are available immediately."})}catch{i({title:"Upgrade failed",description:"Please contact support.",variant:"destructive"})}finally{g(!1),h(null)}}},r=async()=>{if(!(!a||!s)){g(!0);try{const t=s.current_period_end||new Date(Date.now()+2592e6).toISOString(),{error:d}=await I.from("organizations").update({pending_plan_change:a.targetPlan.id,plan_change_date:t}).eq("id",s.id);if(d)throw d;await y.invalidateQueries({queryKey:["organization"]}),i({title:"Downgrade scheduled",description:`Your plan will change to ${a.targetPlan.name} at the end of your billing period.`})}catch{i({title:"Error",description:"Please contact support.",variant:"destructive"})}finally{g(!1),h(null),k("")}}},E=async()=>
6{if(s)try{const{error:t}=await I.from("organizations").update({pending_plan_change:null,plan_change_date:null}).eq("id",s.id);if(t)throw t;await y.invalidateQueries({queryKey:["organization"]}),i({title:"Downgrade cancelled",description:"Your current plan will continue."})}catch{i({title:"Error",description:"Please contact support.",variant:"destructive"})}},Q=async()=>{if(s){g(!0);try{const{error:t}=await I.from("organizations").update({plan_status:"cancelling"}).eq("id",s.id);if(t)throw t;await y.invalidateQueries({queryKey:["organization"]}),i({title:`Your plan will be cancelled on ${M}`,description:"You retain full access until then."})}catch{i({title:"Error",description:"Please contact support.",variant:"destructive"})}finally{g(!1),c(!1),R(""),D("")}}},V=async()=>{if(s)try{const{error:t}=await I.from("organizations").update({plan_status:"active"}).eq("id",s.id);if(t)throw t;await y.invalidateQueries({queryKey:["organization"]}),i({title:"Cancellation undone",description:"Your plan will continue as normal."})}catch{i({title:"Error",description:"Please contact support.",variant:"destructive"})}};return e.jsxs("div",{className:"space-y-6",children:[l&&e.jsx(m,{className:"border-primary/40 bg-primary/5",children:e.jsxs(u,{className:"flex items-center gap-3 py-4",children:[e.jsx(ge,{className:"h-5 w-5 text-primary shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-sm",children:"Complimentary Enterprise Access â No billing required"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Enterprise-level access, unlimited resources, $0.00 billing. No Stripe subscription required."})]}),e.jsx(b,{className:"ml-auto shrink-0",children:"Complimentary"})]})}),U&&q&&!l&&e.jsx(m,{className:"border-yellow-500/40 bg-yellow-50 dark:bg-yellow-950/20",children:e.jsxs(u,{className:"flex items-center justify-between py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($e,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-400"}),e.jsxs("p",{className:"text-sm font-medium",children:["â Downgrade to ",Y||U," scheduled for"," ",G(new Date(q),"MMM d, yyyy")]})]}),e.jsx(n,{variant:"outline",size:"sm",onClick:E,children:"Undo"})]})}),e.jsxs(m,{children:[e.jsx(_,{className:"pb-3",children:e.jsxs(S,{className:"text-base flex items-center gap-2",children:[e.jsx(ve,{className:"h-4 w-4"})," Current Plan"]})}),e.jsx(u,{children:e.jsxs("div",{className:"rounded-md border p-4 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground uppercase tracking-wider font-medium",children:"Plan"}),e.jsx("p",{className:"text-lg font-bold mt-0.5",children:l?"Enterprise (Platform Owner)":(o==null?void 0:o.name)||"Starter"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l?"$0.00/month":o!=null&&o.monthly_price_cents?`$${(o.monthly_price_cents/100).toFixed(0)}/month`:"$49/month"})]}),e.jsxs("div",{className:"text-right space-y-1.5",children:[e.jsx(b,{variant:l?"default":B.variant,children:l?"Active":B.label}),(s==null?void 0:s.current_period_end)&&!l&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Renews ",G(new Date(s.current_period_end),"MMM d, yyyy")]})]})]})})]}),e.jsxs(m,{children:[e.jsxs(_,{className:"pb-3",children:[e.jsx(S,{className:"text-base",children:"Available Plans"}),e.jsx($,{children:l?"For reference only â your access is complimentary.":"Upgrade or downgrade your plan at any time."})]}),e.jsx(u,{children:e.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:T.map(t=>{const d=t.id===x||l&&t.id==="enterprise",ne=T.findIndex(W=>W.id===t.id),we=ne>w,Ce=ne<w;return e.jsxs("div",{className:le("rounded-lg border p-4 space-y-3 transition-colors",d?"border-primary bg-primary/5":"hover:border-muted-foreground/30"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:t.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t.desc})]}),e.jsxs("p",{className:"text-lg font-bold",children:[l?"$0":`$${t.price}`,e.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:"/mo"})]})]}),e.jsx("ul",{className:"space-y-1",children:t.features.map(W=>e.jsxs("li",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(Be,{className:"h-3 w-3 text-primary shrink-0"}),W]},W))}),d?e.jsx(n,{variant:"outline",className:"w-full",disabled:!0,children:"Current Plan"}):l?null:we?e.jsxs(n,{className:"w-full gap-1.5 bg-[#F7941D] hover:bg-[#e0850f] text-white",onClick:()=>h({targetPlan:t,isUpgrade:!0}),children:[e.jsx(Ge,{className:"h-3.5 w-3.5"}),"Upgrade to ",t.name]}):Ce?e.jsxs(n,{variant:"outline",className:"w-full gap-1.5",onClick:()=>h({targetPlan:t,isUpgrade:!1}),children:[e.jsx(Xe,{className:"h-3.5 w-3.5"}),"Downgrade to ",t.name]}):null]},t.id)})})})]}),!l&&e.jsx(m,{children:e.jsxs(u,{className:"pt-6",children:[e.jsxs("p",{className:"text-sm font-medium flex items-center gap-1.5 mb-3",children:[e.jsx(he,{className:"h-4 w-4"})," Payment Method"]}),e.jsxs("div",{className:"rounded-md border p-4 flex items-center gap-4",children:[e.jsx("div",{className:"h-10 w-14 roun
6ded bg-muted flex items-center justify-center",children:e.jsx(he,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"Visa ending in â¢â¢â¢â¢ 4242"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Expires 12/2027"})]}),e.jsx(n,{variant:"ghost",size:"sm",className:"text-xs",children:"Update"})]})]})}),!l&&e.jsx(m,{className:"border-muted",children:e.jsx(u,{className:"pt-6",children:L?e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fe,{className:"h-4 w-4 text-green-600"}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-medium text-green-700 dark:text-green-400",children:["â Cancellation Scheduled â ",M]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"You retain full access until this date."})]})]}),e.jsx(n,{variant:"link",size:"sm",className:"text-primary",onClick:V,children:"Undo Cancellation"})]}):e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium flex items-center gap-1.5",children:"Cancel Subscription"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Your access continues until the end of your current billing period."})]}),e.jsx(n,{variant:"outline",size:"sm",className:"border-destructive text-destructive hover:bg-destructive/10",onClick:()=>c(!0),children:"Cancel Plan"})]})})}),e.jsx(X,{open:!!(a!=null&&a.isUpgrade),onOpenChange:t=>!t&&h(null),children:e.jsxs(J,{children:[e.jsxs(ee,{children:[e.jsxs(se,{children:["Upgrade to ",a==null?void 0:a.targetPlan.name]}),e.jsxs(te,{children:["Upgrade to ",a==null?void 0:a.targetPlan.name," â $",a==null?void 0:a.targetPlan.price,"/mo. Your billing will be updated immediately. Continue?"]})]}),e.jsxs(ae,{className:"gap-2",children:[e.jsx(n,{variant:"outline",onClick:()=>h(null),disabled:p,children:"Cancel"}),e.jsx(n,{className:"bg-[#F7941D] hover:bg-[#e0850f] text-white",onClick:K,disabled:p,children:p?"Processingâ¦":"Confirm Upgrade"})]})]})}),e.jsx(X,{open:a!==null&&!(a!=null&&a.isUpgrade),onOpenChange:t=>{t||(h(null),k(""))},children:e.jsxs(J,{children:[e.jsxs(ee,{children:[e.jsxs(se,{children:["Downgrade to ",a==null?void 0:a.targetPlan.name]}),e.jsxs(te,{children:["Your plan will change to ",a==null?void 0:a.targetPlan.name," at the end of your current billing period. You keep current access until then."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{className:"text-sm",children:"Reason for downgrading"}),e.jsxs(re,{value:f,onValueChange:k,children:[e.jsx(ce,{children:e.jsx(de,{placeholder:"Select a reasonâ¦"})}),e.jsx(oe,{children:Ze.map(t=>e.jsx(xe,{value:t,children:t},t))})]})]}),e.jsxs(ae,{className:"gap-2",children:[e.jsx(n,{className:"bg-[#F7941D] hover:bg-[#e0850f] text-white",onClick:()=>{h(null),k("")},disabled:p,children:"Keep Current Plan"}),e.jsx(n,{variant:"outline",className:"border-destructive text-destructive hover:bg-destructive/10",onClick:r,disabled:p||!f,children:p?"Processingâ¦":"Confirm Downgrade"})]})]})}),e.jsx(X,{open:Z,onOpenChange:c,children:e.jsxs(J,{children:[e.jsxs(ee,{children:[e.jsx(se,{className:"flex items-center gap-2",children:"Are you sure you want to cancel?"}),e.jsxs(te,{children:["Your access continues until ",M,"."]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{className:"text-sm",children:"Reason for cancelling"}),e.jsxs(re,{value:A,onValueChange:R,children:[e.jsx(ce,{children:e.jsx(de,{placeholder:"Select a reasonâ¦"})}),e.jsx(oe,{children:ze.map(t=>e.jsx(xe,{value:t,children:t},t))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(v,{className:"text-sm",children:["Anything else you'd like to tell us? ",e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx("textarea",{className:"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
6ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",placeholder:"We'd love to hear your feedbackâ¦",value:O,onChange:t=>D(t.target.value)})]})]}),e.jsxs(ae,{className:"gap-2",children:[e.jsx(n,{className:"bg-[#F7941D] hover:bg-[#e0850f] text-white",onClick:()=>{c(!1),R(""),D("")},disabled:p,children:"Keep My Plan"}),e.jsx(n,{variant:"destructive",onClick:Q,disabled:p||!A,children:p?"Processingâ¦":"Confirm Cancellation"})]})]})})]})}function ms(){var q,Y,z,L,M,H,K;const o=_e(),{user:s,signOut:B}=Se(),{organization:l,plan:i,subscriptionStatus:y,isPlatformOwner:x}=ke(),{toast:w}=pe(),[a,h]=j.useState("profile"),[f,k]=j.useState(!1),p=window.location.hostname.includes("preview"),[g,Z]=j.useState(!1),[c,A]=j.useState(null),R=(q=s==null?void 0:s.user_metadata)!=null&&q.full_name?s.user_metadata.full_name.split(" ").map(r=>r[0]).join("").toUpperCase():((z=(Y=s==null?void 0:s.email)==null?void 0:Y[0])==null?void 0:z.toUpperCase())||"?",O=!!((M=(L=s==null?void 0:s.app_metadata)==null?void 0:L.providers)!=null&&M.includes("google"))||!!((H=s==null?void 0:s.identities)!=null&&H.some(r=>r.provider==="google")),D={active:{label:"Active",variant:"default"},trialing:{label:"Trial",variant:"outline"},past_due:{label:"Past Due",variant:"destructive"},canceled:{label:"Canceled",variant:"secondary"}},U=D[y]||D.active;return e.jsxs(Ae,{children:[e.jsxs("div",{className:"flex gap-6 min-h-[600px] p-4 md:p-6",children:[e.jsxs("nav",{className:"w-56 shrink-0 space-y-1 sticky top-20 self-start",children:[e.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[e.jsx(je,{className:"h-5 w-5"})," My Account"]}),Je.map(r=>e.jsxs("button",{onClick:()=>h(r.id),className:le("flex items-center gap-2.5 w-full text-left px-3 py-2.5 text-sm rounded-lg transition-colors",a===r.id?"bg-primary text-primary-foreground font-medium":"text-muted-foreground hover:bg-muted hover:text-foreground"),children:[e.jsx(r.icon,{className:"h-4 w-4"}),r.label]},r.id)),e.jsx(N,{className:"my-4"}),e.jsxs(n,{variant:"ghost",className:"w-full justify-start text-destructive",onClick:B,children:[e.jsx(De,{className:"h-4 w-4 mr-2"})," Sign Out"]})]}),e.jsxs("div",{className:"flex-1 max-w-3xl space-y-6",children:[a==="profile"&&e.jsxs(e.Fragment,{children:[e.jsx(m,{children:e.jsx(u,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(Me,{className:"h-16 w-16",children:e.jsx(Ee,{className:"text-xl bg-primary/10 text-primary",children:R})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-semibold text-lg truncate",children:((K=s==null?void 0:s.user_metadata)==null?void 0:K.full_name)||"User"}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:s==null?void 0:s.email}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsxs(b,{variant:"outline",className:"text-xs",children:[e.jsx(Te,{className:"h-3 w-3 mr-1"}),(s==null?void 0:s.role)||"authenticated"]}),l&&e.jsx(b,{variant:"secondary",className:"text-xs truncate max-w-[200px]",children:l.name})]})]})]})})}),e.jsxs(m,{children:[e.jsxs(_,{className:"pb-3",children:[e.jsxs(S,{className:"text-base flex items-center gap-2",children:[e.jsx(He,{className:"h-4 w-4"})," Email & Password"]}),e.jsx($,{children:"Update your login credentials."})]}),e.jsxs(u,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(v,{className:"text-sm font-medium flex items-center gap-1.5",children:[e.jsx(Re,{className:"h-3.5 w-3.5"})," Email Address"]}),e.jsx(ie,{value:(s==null?void 0:s.email)||"",disabled:!0,className:"bg-muted"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Contact support to change your email address."})]}),e.jsx(N,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(v,{className:"text-sm font-medium flex items-center gap-1.5",children:[e.jsx(Ue,{className:"h-3.5 w-3.5"})," Password"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{value:"â¢â¢â¢â¢â¢â¢â¢â¢",disabled:!0,className:"bg-muted flex-1"}),e.jsx(n,{variant:"outline",size:"sm",onClick:()=>w({title:"Password reset",description:"Check your email for a password reset link."}),children:"Change"})]})]})]})]}),e.jsxs(m,{children:[e.jsx(_,{className:"pb-3",children:e.jsxs(S,{className:"text-base flex items-center gap-2",children:[e.jsx(Ke,{className:"h-4 w-4"})," Account Settings"]})}),e.jsxs(u,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(v,{className:"flex items-center gap-1.5 text-amber-600",children:[e.jsx(Qe,{className:"h-3.5 w-3.5"})," Pause Account"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Temporarily suspend your subscription"})]}),e.jsx(n,{variant:"outline",size:"sm",className:"text-amber-600 border-amber-200 hover:bg-amber-50",onClick:()=>{Z(!0),w({title:"Pause requested",description:"Contact support to finalize account pause."})},disabled:g,children:g?"Requested":"Pause"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(v,{className:"flex items-center gap-1.5 text-destructive",children:[e.jsx(qe,{className:"h-3.5 w-3.5"})," Deactivate Account"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Permanently close your account and data"})]}),e.jsx(n,{variant:"outline",size:"sm",className:"text-destructive border-destructive/30 hover:bg-destructive/5",onClick:()=>{w({title:"Deactivation",description:"Please contact support to deactivate your account.",variant:"destructive"})},children:"Deactivate"})]})]})]})]}),a==="subscription"&&e.jsxs("div",{className:"space-y-4",children:[p&&x&&e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-dashed border-yellow-500/50 bg-yellow-50/50 dark:bg-yellow-950/20 px-4 py-2.5",children:[e.jsx("span",{className:"text-xs font-medium text-yellow-700 dark:text-yellow-400",children:"ð DEV"}),e.jsx(v,{htmlFor:"preview-toggle",className:"text-sm cursor-pointer",children:"Preview as Standard Tenant"}),e.jsx(ue,{id:"preview-toggle",checked:f,onCheckedChange:k}),f&&e.jsx(b,{variant:"outline",className:"text-xs ml-auto",children:"Simulating: Professional plan"})]}),e.jsx(es,{plan:f?{id:"pro",name:"Professional",monthly_price_cents:14900}:i,organization:f?{...l,plan_id:"pro",stripe_subscription_id:"sim_123",plan_status:"active",pending_plan_change:null,plan_change_date:null}:l,status:f?{label:"Active",variant:"default"}:U,isPlatformOwner:f?!1:x})]}),a==="connected"&&e.jsxs(m,{children:[e.jsxs(_,{className:"pb-3",children:[e.jsxs(S,{className:"text-base flex items-center gap-2",children:[e.jsx(be,{className:"h-4 w-4"})," Connected Apps"]}
6),e.jsx($,{children:"External accounts linked to your profile."})]}),e.jsxs(u,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-9 w-9 rounded-lg bg-muted flex items-center justify-center",children:e.jsxs("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",children:[e.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),e.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),e.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),e.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Google"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:O?"Connected":"Not connected"})]})]}),O?e.jsxs(b,{variant:"default",className:"text-xs",children:[e.jsx(fe,{className:"h-3 w-3 mr-1"}),"Connected"]}):e.jsx(n,{variant:"outline",size:"sm",onClick:()=>o("/integrations"),children:"Connect"})]}),e.jsx(N,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-9 w-9 rounded-lg bg-muted flex items-center justify-center",children:e.jsxs("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{cx:"12",cy:"12",r:"11",fill:"#2CA01C"}),e.jsx("path",{d:"M7.5 8a2.5 2.5 0 00-2.5 2.5v3a2.5 2.5 0 005 0v-3h-1v3a1.5 1.5 0 01-3 0v-3a1.5 1.5 0 013 0h1A2.5 2.5 0 007.5 8z",fill:"white"}),e.jsx("path",{d:"M16.5 16a2.5 2.5 0 002.5-2.5v-3a2.5 2.5 0 00-5 0v3h1v-3a1.5 1.5 0 013 0v3a1.5 1.5 0 01-3 0h-1a2.5 2.5 0 002.5 2.5z",fill:"white"})]})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"QuickBooks"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Not connected"})]})]}),e.jsx(n,{variant:"outline",size:"sm",onClick:()=>o("/integrations"),children:"Connect"})]})]})]}),a==="billing"&&e.jsxs(m,{children:[e.jsxs(_,{className:"pb-3",children:[e.jsxs(S,{className:"text-base flex items-center gap-2",children:[e.jsx(ye,{className:"h-4 w-4"})," Billing History"]}),e.jsx($,{children:"Your past payments and invoices."})]}),e.jsxs(u,{className:"space-y-4",children:[x&&e.jsxs("div",{className:"rounded-lg border border-primary/30 bg-primary/5 p-3 flex items-center gap-2 mb-2",children:[e.jsx(ge,{className:"h-4 w-4 text-primary"}),e.jsx("p",{className:"text-sm font-medium",children:"Platform Owner â all charges are $0.00"})]}),e.jsx("div",{className:"rounded-md border overflow-hidden",children:e.jsxs(Oe,{children:[e.jsx(Ye,{children:e.jsxs(me,{children:[e.jsx(C,{className:"text-xs",children:"Date"}),e.jsx(C,{className:"text-xs",children:"Invoice #"}),e.jsx(C,{className:"text-xs",children:"Description"}),e.jsx(C,{className:"text-xs text-right",children:"Monthly Rate"}),e.jsx(C,{className:"text-xs text-right",children:"Amount Charged"}),e.jsx(C,{className:"text-xs text-center",children:"Status"}),e.jsx(C,{className:"text-xs text-right"})]})}),e.jsx(Le,{children:(()=>{var F,t;const E=`$${(i!=null&&i.monthly_price_cents?i.monthly_price_cents/100:((F=T.find(d=>d.id===((l==null?void 0:l.plan_id)||"starter")))==null?void 0:F.price)??0).toFixed(2)}`,Q=x?"$0.00":E,V=x?"Enterprise (Platform Owner)":(i==null?void 0:i.name)||((t=T.find(d=>d.id===((l==null?void 0:l.plan_id)||"starter")))==null?void 0:t.name)||"Starter";return[{date:"Feb 1, 2026",invoiceNo:"APX-2026-0002"},{date:"Jan 1, 2026",invoiceNo:"APX-2026-0001"},{date:"Dec 1, 2025",invoiceNo:"APX-2025-0012"}].map(d=>e.jsxs(me,{children:[e.jsx(P,{className:"text-sm",children:d.date}),e.jsx(P,{className:"text-sm font-mono text-xs",children:d.invoiceNo}),e.jsx(P,{className:"text-sm",children:x?"Platform Owner â Enterprise (Complimentary)":`${V} Plan â Monthly`}),e.jsx(P,{className:"text-sm text-right text-muted-foreground",children:x?e.jsx("span",{className:"line-through",children:E}):E}),e.jsx(P,{className:"text-sm text-right font-medium",children:Q}),e.jsx(P,{className:"text-center",children:e.jsx(b,{variant:"default",className:"text-xs",children:"Paid"})}),e.jsx(P,{className:"text-right",children:e.jsxs(n,{variant:"ghost",size:"sm",className:"text-xs gap-1.5 h-7",onClick:()=>A({invoiceNo:d.invoiceNo,date:d.date,tenantName:(l==null?void 0:l.name)||"Organization",planName:V,monthlyRate:E,amountCharged:Q,paymentMethod:x?"Complimentary (Platform Owner)":"Visa â¢â¢â¢â¢ 4242"}),children:[e.jsx(Fe,{className:"h-3 w-3"}),"Receipt"]})})]},d.date))})()})]})}),e.jsx("p",{className:"text-xs text-muted-foreground text-center pt-2",children:"Payments processed securely by Apex Technologiesâ¢"})]})]}),a==="notifications"&&e.jsxs(m,{children:[e.jsxs(_,{className:"pb-3",children:[e.jsxs(S,{className:"text-base flex items-center gap-2",children:[e.jsx(Ne,{className:"h-4 w-4"})," Notification Preferences"]}),e.jsx($,{children:"Control what notifications you receive."})]}),e.jsx(u,{className:"space-y-4",children:[{label:"Email Notifications",desc:"Receive account and billing emails"},{label:"Job Updates",desc:"Notifications when jobs are assigned or completed"},{label:"Estimate Responses",desc:"Get notified when customers respond to estimates"},{label:"Invoice Payments",desc:"Alerts when payments are received"},{label:"AI Flag Alerts",desc:"Daily AI-flagged issues and recommendations"}].map(r=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{children:r.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r.desc})]}),e.jsx(ue,{defaultChecked:!0})]},r.label))})]})]})]}),e.jsx(X,{open:!!c,onOpenChange:r=>!r&&A(null),children:e.jsx(J,{className:"max-w-md",children:c&&e.jsxs("div",{className:"space-y-6",id:"receipt-content",children:[e.jsxs("div",{className:"text-center space-y-1 border-b pb-4",children:[e.jsx("h2",{className:"text-xl font-bold tracking-tight",children:"Apex Technologiesâ¢"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"SaaS Platform Services"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-semibold uppercase tracking-wider text-muted-foreground",children:"Payment Receipt"}),e.jsx("p",{className:"text-lg font-bold mt-1",children:c.invoiceNo})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Date"}),e.jsx("span",{className:"font-medium",children:c.date})]}),e.jsx(N,{}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Tenant"}),e.jsx("span",{className:"font-medium",children:c.tenantName})]}),e.jsx(N,{}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Plan"}),e.jsx("span",{className:"font-medium",children:c.planName})]}),e.jsx(N,{}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Monthly Rate"}),e.jsx("span",{className:le("font-medium",x&&"line-through text-muted-foreground"),children:c.monthlyRate})]}),e.jsx(N,{}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Amount Charged"}),e.jsx("span",{className:"text-lg font-bold",children:c.amountCharged})]}),e.jsx(N,{}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Payment Method"}),e.jsx("span",{className:"font-medium",children:c.paymentMethod})]}),e.jsx(N,{}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Status"}),e.jsx(b,{variant:"default",className:"text-xs",children:"Paid"})]})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground text-center",children:"Payments processed securely by Apex Technologiesâ¢"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(n,{variant:"outline",className:"flex-1 gap-2",onClick:()=>{window.print()},children:[e.jsx(Ve,{className:"h-4 w-4"}),"Print"]}),e.jsxs(n,{className:"flex-1 gap-2",onClick:()=>{w({title:"Receipt downloaded",description:`Receipt ${c.invoiceNo} saved.`}),A(null)},children:[e.jsx(We,{className:"h-4 w-4"}),"Download PDF"]})]})]})})})]})}export{ms as default};
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.