PageSourceSearch

https://salesindex.ai/assets/AccountDashboard-CG8EmEgO.js

js salesindex.ai collected 2026-10-05 13:06:31 UTC 8,417 bytes, 11 lines download raw bytes

1import{c as _,r as a,j as e,B as n,e as l,b as w,L as g,A as R,d as b,v as U,h as B}from"./index-DXRSXi55.js";import{B as F}from"./badge-Cjl91Hxs.js";import{L as o}from"./loader-circle-B9bvuObw.js";import{C as O}from"./circle-check-big-QEeFMfiS.js";import{C as v}from"./circle-x-CGTHRCq7.js";import{T as C}from"./triangle-alert-OHOh6dtF.js";import{C as z}from"./calendar-D49cm-OT.js";import{f as S}from"./format-7_oTgTIh.js";import{f as k}from"./fromUnixTime-BOzVZisp.js";import{C as D}from"./credit-card-DfagACuV.js";/**
2 * @license lucide-react v0.475.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 E=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],$=_("LogOut",E);/**
7 * @license lucide-react v0.475.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const I=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],q=_("Pause",I),G={active:"bg-green-100 text-green-700",trialing:"bg-blue-100 text-blue-700",past_due:"bg-yellow-100 text-yellow-700",canceled:"bg-gray-100 text-gray-500",paused:"bg-orange-100 text-orange-700"};function re(){const[t,L]=a.useState(null),[A,M]=a.useState(!0),[H,T]=a.useState(!1),[m,Y]=a.useState(null),[P,p]=a.useState(!1),[i,j]=a.useState(""),[d,h]=a.use
11State(null);a.useEffect(()=>{async function r(){if(!await l.auth.isAuthenticated()){l.auth.redirectToLogin(window.location.href);return}T(!0);const c=await l.auth.me();L(c),M(!1),y(c.email)}r()},[]);const y=async r=>{p(!0);const x=await l.functions.invoke("manageStripeSubscription",{action:"get",email:r});Y(x.data),p(!1)},u=async(r,x)=>{var f,N;j(r),h(null);const c=await l.functions.invoke("manageStripeSubscription",{action:r,email:t.email,subscription_id:x});((f=c.data)==null?void 0:f.success)!==!1?(h({type:"success",text:{cancel:"Your subscription will cancel at the end of the billing period.",reactivate:"Your subscription has been reactivated!",pause:"Your subscription has been paused.",resume:"Your subscription has been resumed!"}[r]||"Action completed."}),y(t.email)):h({type:"error",text:((N=c.data)==null?void 0:N.error)||"Something went wrong."}),j("")};if(A)return e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx(o,{className:"w-8 h-8 animate-spin text-blue-600"})});const s=m==null?void 0:m.subscription;return e.jsx("div",{className:"min-h-screen bg-gray-50 py-12 px-6",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-extrabold text-gray-900",children:"Account Dashboard"}),e.jsxs("p",{className:"text-gray-500 text-sm mt-1",children:["Welcome back, ",(t==null?void 0:t.full_name)||(t==null?void 0:t.email)]})]}),e.jsxs(n,{variant:"outline",size:"sm",onClick:()=>l.auth.logout(),className:"text-gray-500",children:[e.jsx($,{className:"w-4 h-4 mr-1"})," Sign Out"]})]}),d&&e.jsxs("div",{className:`flex items-center gap-3 rounded-xl px-4 py-3 mb-6 text-sm font-medium ${d.type==="success"?"bg-green-50 text-green-700 border border-green-200":"bg-red-50 text-red-700 border border-red-200"}`,children:[d.type==="success"?e.jsx(O,{className:"w-4 h-4 flex-shrink-0"}):e.jsx(v,{className:"w-4 h-4 flex-shrink-0"}),d.text]}),e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-4 mb-6 flex items-center gap-3",children:[e.jsx(w,{className:"w-5 h-5 text-blue-600 flex-shrink-0"}),e.jsxs("p",{className:"text-sm text-blue-800",children:[e.jsx("strong",{children:"Flexible plans:"})," Add or remove reps, change coaching plans, or pause your subscription anytime."]})]}),P?e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 p-12 text-center",children:[e.jsx(o,{className:"w-8 h-8 animate-spin text-blue-600 mx-auto"}),e.jsx("p",{className:"text-gray-500 mt-3",children:"Loading your subscription..."})]}):s?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-2xl shadow-sm border border-gray-100 p-6",children:[e.jsxs("div",{className:"flex items-start justify-between mb-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-gray-900",children:s.product_name}),e.jsxs("p",{className:"text-2xl font-extrabold text-gray-900 mt-1",children:["$",(s.amount/100).toFixed(0),e.jsxs("span",{className:"text-sm font-normal text-gray-400",children:["/",s.interval]})]})]}),e.jsx(F,{className:G[s.status]||"bg-gray-100 text-gray-500",children:s.status.replace("_"," ")})]}),e.jsxs("div",{className:"space-y-3 border-t border-gray-100 pt-4 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3 text-sm text-gray-600",children:[e.jsx(z,{className:"w-4 h-4 text-gray-400"}),e.jsx("span",{children:s.cancel_at_period_end?e.jsxs(e.Fragment,{children:["Cancels on ",e.jsx("strong",{children:S(k(s.current_period_end),"MMMM d, yyyy")})]}):e.jsxs(e.Fragment,{children:["Renews on ",e.jsx("strong",{children:S(k(s.current_period_end),"MMMM d, yyyy")})]})})]}),e.jsxs("div",{className:"flex items-center gap-3 text-sm text-gray-600",children:[e.jsx(D,{className:"w-4 h-4 text-gray-400"}),e.jsxs("span",{children:["Subscription ID: ",e.jsx("span",{className:"font-mono text-xs text-gray-400",children:s.id})]})]})]}),e.jsx("div",{className:"space-y-3",children:s.cancel_at_period_end?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-yellow-50 border border-yellow-200 rounded-xl p-4 text-sm text-yellow-800 flex items-center gap-2",children:[e.jsx(C,{className:"w-4 h-4 flex-shrink-0"}),"Your subscription is set to cancel at the end of the billing period."]}),e.jsxs(n,{onClick:()=>u("reactivate",s.id),disabled:!!i,className:"w-full bg-green-600 hover:bg-green-700 text-white",children:[i==="reactivate"?e.jsx(o,{className:"w-4 h-4 animate-spin mr-2"}):e.jsx(U,{className:"w-4 h-4 mr-2"}),"Reactivate Subscription"]})]}):e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs(n,{variant:"outline",onClick:()=>u("pause",s.id),disabled:!!i,className:"text-orange-600 border-orange-200 hover:bg-orange-50",children:[i==="pause"?e.jsx(o,{className:"w-4 h-4 animate-spin mr-2"}):e.jsx(q,{className:"w-4 h-4 mr-2"}),"Pause"]}),e.jsxs(n,{variant:"outline",onClick:()=>{window.confirm("Are you sure you want to cancel? You will retain access until the end of the billing period.")&&u("cancel",s.id)},disabled:!!i,className:"text-red-600 border-red-200 hover:bg-red-50",children:[i==="cancel"?e.jsx(o,{className:"w-4 h-4 animate-spin mr-2"}):e.jsx(v,{className:"w-4 h-4 mr-2"}),"Cancel"]})]})})]}),e.jsxs("div",{className:"bg-white rounded-2xl shadow-sm border border-gray-100 p-6",children:[e.jsxs("h3",{className:"text-lg font-bold text-gray-900 mb-2 flex items-center gap-2",children:[e.jsx(w,{className:"w-5 h-5 text-blue-600"})," Manage Your Team"]}),e.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"Need to adjust your plan? Contact us to add or remove reps, change coaching tiers, or modify your package."}),e.jsx(g,{to:b("Contact"),children:e.jsxs(n,{className:"bg-blue-600 hover:bg-blue-700 text-white w-full",children:[e.jsx(B,{className:"w-4 h-4 mr-2"})," Request Plan Changes"]})})]}),e.jsxs("div",{className:"bg-white rounded-2xl shadow-sm border border-gray-100 p-6",children:[e.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-4",children:"Qu
11ick Links"}),e.jsx("div",{className:"grid grid-cols-1 gap-3",children:e.jsx(g,{to:b("Contact"),children:e.jsx(n,{variant:"outline",className:"w-full justify-start",children:"Contact Support"})})})]})]}):e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 p-12 text-center",children:[e.jsx(C,{className:"w-10 h-10 text-yellow-400 mx-auto mb-3"}),e.jsx("p",{className:"text-gray-700 font-semibold mb-2",children:"No active subscription found"}),e.jsx("p",{className:"text-gray-400 text-sm mb-6",children:"Get started with a plan that fits your team."}),e.jsx(g,{to:b("Contact"),children:e.jsxs(n,{className:"bg-blue-600 hover:bg-blue-700 text-white",children:["Contact Us ",e.jsx(R,{className:"w-4 h-4 ml-2"})]})})]})]})})}export{re 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.