1import{j as e,S as c,i as F,P as C,K as M,N as U,J as T,_,H as B,W as O,$ as z,F as G,a0 as H,a1 as A,A as V,g as X,p as Y}from"./index-dMR4j5tN.js";import{d as K,b as m,L as N}from"./vendor-react-vYi1UZO1.js";import{E as R}from"./EmptyState-CLnATaRS.js";import{S as P}from"./StatusBadge-CehjkJ_r.js";import{g as q}from"./entityService-DY1byM1L.js";import"./vendor-amplify-__Ux8f_S.js";function J(){return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:[...Array(6)].map((u,r)=>e.jsx(c,{width:"w-20",height:"h-8",rounded:"full"},r))}),e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[...Array(6)].map((u,r)=>e.jsxs("div",{className:"rounded-lg border border-brand-neutral-200 bg-surface p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(c,{width:"w-40",height:"h-5"}),e.jsx(c,{width:"w-16",height:"h-5",rounded:"full"})]}),e.jsx(c,{width:"w-24",height:"h-5",rounded:"full"}),e.jsx(c,{width:"w-full",height:"h-3"}),e.jsx(c,{width:"w-32",height:"h-3"}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx(c,{width:"w-24",height:"h-8",rounded:"md"}),e.jsx(c,{width:"w-16",height:"h-8",rounded:"md"})]})]},r))})]})}const W="https://3h28eo2k43.execute-api.us-east-1.amazonaws.com/prod";function Q(u){const r=new Map;for(const y of u){const g=y.entityName||"Unassigned",j=r.get(g)??[];j.push(y),r.set(g,j)}return r}const Z=[{value:"all",label:"All Services"},{value:"ACTIVE",label:"Active"},{value:"PENDING",label:"Pending"},{value:"SUSPENDED",label:"Suspended"},{value:"EXPIRED",label:"Expired"},{value:"CANCELLED",label:"Cancelled"}];function ne(){const u=K(),[r,y]=m.useState([]),[g,j]=m.useState(new Map),[w,$]=m.useState([]),[d,I]=m.useState(!0),[h,k]=m.useState(null),[i,L]=m.useState("all");m.useEffect(()=>{async function s(){I(!0),k(null);try{const[a,o,f]=await Promise.allSettled([V(),X(),q()]),t=a.status==="fulfilled"?a.value.services:[],v=o.status==="fulfilled"?o.value:[],x=f.status==="fulfilled"?f.value:[];y(t),j(new Map(x.map(l=>[l.legalName,l.entityId]))),a.status==="rejected"&&(console.error("Failed to fetch services:",a.reason),k("Failed to load services. Please try again."));const b=v.filter(l=>l.status==="paid"||l.status==="completed");if(b.length>0&&t.length===0){const l=await Y(),D=(await Promise.allSettled(b.map(async n=>{const E=await fetch(`${W}/magic-link/activation-status/${encodeURIComponent(n.orderId)}`,{headers:l?{Authorization:`Bearer ${l}`}:{}});if(!E.ok)return null;const S=await E.json();return S.ready&&S.activationUrl?{orderId:n.orderId,activationUrl:S.activationUrl,serviceName:n.primaryService}:null}))).filter(n=>n.status==="fulfilled").map(n=>n.value).filter(n=>n!==null);$(D)}}catch(a){console.error("Failed to fetch services:",a),k("Failed to load services. Please try again.")}finally{I(!1)}}s()},[]);const p=i==="all"?r:r.filter(s=>s.status===i);return e.jsxs("div",{className:"space-y-6",children:[e.jsx(F,{title:"Services",description:"Every service on your account. One page, one source of truth.",action:e.jsxs(N,{to:"/order",className:"inline-flex items-center justify-center gap-2 rounded-md bg-brand-red px-5 py-2.5 text-sm font-bold uppercase tracking-btn text-white shadow-cta transition-all hover:brightness-110 active:scale-[0.98]",children:[e.jsx(C,{className:"h-4 w-4"}),"New Service"]})}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Z.map(({value:s,label:a})=>{const o=i===s;return e.jsx("button",{onClick:()=>L(s),className:o?"rounded-pill bg-brand-gold px-3 py-1 text-xs font-bold uppercase tracking-label text-black transition-colors":"rounded-pill border border-hairline-subtle px-3 py-1 text-xs font-semibold uppercase tracking-label text-ink-secondary transition-colors hover:text-brand-gold hover:border-brand-gold/40",children:a},s)})}),d&&e.jsx(J,{}),!d&&h&&e.jsxs("div",{className:"rounded-lg border p-8 text-center",style:{borderColor:"hsl(var(--color-error-200))",backgroundColor:"hsl(var(--color-error-50))"},children:[e.jsx(M,{className:"mx-auto h-12 w-12",style:{color:"hsl(var(--color-error-400))"}}),e.jsx("h3",{className:"mt-4 text-lg font-medium",style:{color:"hsl(var(--color-error-900))"},children:"Error loading services"}),e.jsx("p",{className:"mt-2 text-sm",style:{color:"hsl(var(--color-error-700))"},children:h}),e.jsx("button",{onClick:()=>window.location.reload(),className:"mt-4 inline-flex items-center gap-2 rounded-md px-4 py-2 text-sm font-semibold text-white",style:{backgroundColor:"hsl(var(--color-primary-600))"},children:"Try Again"})]}),!d&&!h&&p.length>0&&(()=>{const s=Q(p),a=s.size>1;return e.jsx("div",{className:"space-y-6",children:[...s.entries()].map(([o,f])=>e.jsxs("div",{children:[a&&(()=>{const t=g.get(o);return e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(U,{className:"h-5 w-5",style:{color:"hsl(var(--color-neutral-500))"}}),t?e.jsx(N,{to:`/entities/${t}`,className:"font-display text-lg font-extrabold uppercase tracking-tight text-brand-gold hover:brightness-110",children:o}):e.jsx("h2",{className:"font-display text-lg font-extrabold uppercase tracking-tight text-ink-primary",children:o}),e.jsx("span",{className:"rounded-pill border border-hairline-subtle px-2 py-0.5 font-mono text-[10px] font-semibold uppercase tracking-label text-ink-tertiary",children:f.length})]})})(),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:f.map(t=>{const v=T(t.status),x=_(t.state),b=g.get(t.entityName),l=x?`${x.street1}, ${x.city}, ${x.stateCode} ${x.zip}`:"Address pending â will be provided after activation";return e.jsxs("div",{className:"rounded-2xl border border-hairline-subtle bg-surface-elevated p-5 transition-all duration-200 hover:border-brand-gold/30 hover:-translate-y-
1px",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"font-display text-base font-extrabold uppercase tracking-tight text-ink-primary truncate",children:t.offeringName||`${B(t.state)} Registered Agent`}),e.jsxs("p",{className:"mt-1 flex items-center gap-1.5 text-sm text-ink-secondary",children:[e.jsx("span",{className:"truncate",children:t.entityName}),e.jsx(P,{label:t.state,variant:"neutral",className:"text-[10px] flex-shrink-0"})]})]}),e.jsx(P,{label:v.label,bgColor:v.bgColor,textColor:v.textColor})]}),e.jsxs("div",{className:"mt-4 space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(O,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-ink-tertiary"}),e.jsx("span",{className:"font-mono text-[12px] text-ink-secondary",children:l})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"h-4 w-4 text-ink-tertiary"}),e.jsxs("span",{className:"font-mono text-[12px] text-ink-secondary",children:["Renews ",new Date(t.renewalDate).toLocaleDateString()]})]})]}),e.jsxs("div",{className:"mt-4 flex gap-2 border-t border-hairline-subtle pt-4",children:[e.jsx(N,{to:`/services/${t.serviceId}`,className:"flex-1 rounded-md border border-hairline-subtle px-3 py-1.5 text-center text-xs font-bold uppercase tracking-btn text-ink-primary hover:border-brand-gold hover:text-brand-gold transition-colors",children:"View â"}),e.jsxs(N,{to:b?`/entities/${b}`:"/documents",className:"inline-flex items-center justify-center gap-1 rounded-md border border-hairline-subtle px-3 py-1.5 text-xs font-bold uppercase tracking-btn text-ink-secondary hover:border-brand-gold hover:text-brand-gold transition-colors","aria-label":"Documents",children:[e.jsx(G,{className:"h-3.5 w-3.5"}),"Docs"]}),(t.status==="ACTIVE"||t.status==="EXPIRED")&&e.jsx("button",{onClick:()=>u(`/order?serviceId=${t.serviceId}&type=renewal`),className:"flex-1 rounded-md bg-brand-red px-3 py-1.5 text-xs font-bold uppercase tracking-btn text-white shadow-cta transition-all hover:brightness-110",children:t.status==="EXPIRED"?"Reactivate":"Renew"})]})]},t.serviceId)})})]},o))})})(),!d&&!h&&p.length===0&&i==="all"&&w.length>0&&e.jsx("div",{className:"space-y-3",children:w.map(s=>e.jsx("div",{className:"rounded-lg border-2 p-6",style:{borderColor:"hsl(var(--color-primary-200))",backgroundColor:"hsl(var(--color-primary-50))"},children:e.jsxs("div",{className:"flex flex-col items-center text-center sm:flex-row sm:items-start sm:text-left sm:gap-4",children:[e.jsx("div",{className:"rounded-md p-2 mb-3 sm:mb-0",style:{backgroundColor:"hsl(var(--color-primary-100))"},children:e.jsx(H,{className:"h-8 w-8",style:{color:"hsl(var(--color-primary-600))"}})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("h3",{className:"text-lg font-semibold",style:{color:"hsl(var(--color-primary-900))"},children:["Your ",s.serviceName||"Registered Agent Service"," is ready to activate"]}),e.jsx("p",{className:"mt-1 text-sm",style:{color:"hsl(var(--color-primary-700))"},children:"You purchased a service â complete a quick form to get started."}),e.jsx("a",{href:s.activationUrl,className:"mt-3 inline-flex items-center rounded-md bg-brand-red px-5 py-2.5 text-sm font-bold uppercase tracking-btn text-white shadow-cta transition-all hover:brightness-110",children:"Activate now â"})]})]})},s.orderId))}),!d&&!h&&p.length===0&&i==="all"&&w.length===0&&r.length===0&&e.jsx(R,{icon:e.jsx(A,{className:"h-12 w-12"}),title:"No services yet",description:"Get started by adding your first registered agent service.",actionLabel:"New Service",actionHref:"/order",actionIcon:e.jsx(C,{className:"h-4 w-4"})}),!d&&!h&&p.length===0&&i!=="all"&&e.jsx(R,{icon:e.jsx(A,{className:"h-12 w-12"}),title:`No ${i.toLowerCase()} services`,description:`You don't have any services with ${i.toLowerCase()} status.`}),!d&&!h&&r.length>0&&e.jsxs("div",{className:"rounded-lg p-4 text-sm",style:{backgroundColor:"hsl(var(--color-neutral-50))",color:"hsl(var(--color-neutral-600))"},children:["Showing ",p.length," of ",r.length," services"]})]})}export{ne as Services}; 2//# sourceMappingURL=Services-BL4Y1k8M.js.map
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.