PageSourceSearch

https://getvsble.com/assets/AioLayout-CllS8Ir3.js

js getvsble.com collected 2026-10-09 04:53:32 UTC 11,266 bytes, 6 lines download raw bytes

1import{d as H,u as g,aj as K,b as T,j as e,an as $,B as x,S as G,a as W,H as J,r as l,s as f,p as X,av as Y,c as P,b5 as Z,aK as b,ae as ee,ax as se,bo as ae}from"./index-ByYYWl6V.js";import{u as te,A as re}from"./AioContext-tcHwp2Sp.js";import{T as ie}from"./ThemeToggle-BMzpTRWb.js";import{L as ne}from"./LanguageSwitcher-DnKojN5t.js";import{u as oe}from"./useAioCredits-DXWFt562.js";import{S as le}from"./StandaloneAccountPanel-D043IwtX.js";import{A as ce,b as de,a as me}from"./avatar-DfyiTc_8.js";import{S as ue,a as he,b as xe,c as pe,d as fe}from"./select-B7Jb7eSA.js";import{P as be,a as je,b as ge}from"./popover-iAHc-IZW.js";import{A as we,a as ye,b as ve,c as Ae,d as Ne,e as Ce,f as Se,g as ke}from"./alert-dialog-Cm0yc26w.js";import{L as De}from"./layout-dashboard-woW9s7V_.js";import{Q as Be}from"./quote-CM8gKfZc.js";import{U as Pe}from"./users-8DqkLtTC.js";import{T as _e}from"./trash-2-250o4KTP.js";import{P as _}from"./plus-CwyWY8pM.js";import{S as Ee,a as Te}from"./sheet-ke76V1vr.js";import{M as Me}from"./menu-B83JlL33.js";import"./sun-CAzXMSBU.js";import"./dropdown-menu-BZRKspBv.js";import"./index-CnBNeFET.js";import"./chevron-right-X_hlXzqd.js";import"./circle-DcpkfI2n.js";import"./badge-DuSeH5ON.js";import"./card-CsB1Huog.js";import"./rotate-ccw-C6kbywiV.js";import"./circle-x-BI9LabY8.js";import"./index-C4Lchjjk.js";import"./chevron-up-DJ99KL3C.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 Ie=H("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);function Ue(){const{user:a,isAdmin:n}=g(),c=K();return{hasAccess:!!a&&(n||c.aio.active),userEmail:a==null?void 0:a.email}}function Le({children:a}){const{hasAccess:n}=Ue(),{subscription:c}=g(),o=T();return n?e.jsx(e.Fragment,{children:a}):e.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:e.jsxs("div",{className:"text-center max-w-md mx-auto p-8 space-y-4",children:[e.jsx($,{className:"h-16 w-16 text-muted-foreground mx-auto"}),e.jsx("h1",{className:"text-2xl font-bold",children:"Brand AI Monitor"}),e.jsx("p",{className:"text-muted-foreground",children:"This tool is included in all Vsble Suite website plans, or available as a standalone subscription."}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(x,{onClick:()=>{o("/dashboard"),setTimeout(()=>window.dispatchEvent(new CustomEvent("open-account-tab",{detail:"aio"})),100)},className:"w-full",children:"View standalone plans"}),e.jsxs(x,{variant:"outline",onClick:()=>{o("/dashboard"),setTimeout(()=>window.dispatchEvent(new CustomEvent("start-trial")),100)},className:"w-full",children:[e.jsx(G,{className:"h-4 w-4 mr-2"}),c.trialEligible?"Start free trial (includes all tools)":"Subscribe (includes all tools)"]})]})]})})}function E({onNavigate:a}={}){const n=T(),c=W(),{brands:o,selectedBrandId:j,setSelectedBrandId:p,selectedBrand:d,refetchBrands:m}=te(),{user:t,subscription:u,refreshSubscription:M}=g(),h=oe(),{t:r}=J();l.useEffect(()=>{h.loading||!(u.subscribed||u.standaloneAio)||h.monthlyCredits===0&&h.purchasedBalance===0&&!h.lastResetAt&&M().then(()=>h.refresh())},[h.loading]);const[I,w]=l.useState(!1),[y,N]=l.useState(!1),[C,S]=l.useState(null),[U,k]=l.useState(!1),[v,L]=l.useState(null),[D,O]=l.useState(null);l.useEffect(()=>{if(!t)return;let s=!1;return f.from("profiles").select("display_name, avatar_url").eq("id",t.id).single().then(({data:i})=>{s||!i||(L(i.display_name??null),O(i.avatar_url??null))}),()=>{s=!0}},[t]);const B=((t==null?void 0:t.email)??"").split("@")[0]||"User",A=(v==null?void 0:v.trim())||B.charAt(0).toUpperCase()+B.slice(1),R=A.charAt(0).toUpperCase(),z=!u.subscribed&&!!u.standaloneAio,F=[{path:"/aio",label:r("aio.sidebar.navDashboard"),icon:De,exact:!0},{path:"/aio/queries",label:r("aio.sidebar.navQueries"),icon:X},{path:"/aio/citations",label:r("aio.sidebar.navCitations"),icon:Be}
6,{path:"/aio/competitors",label:r("aio.sidebar.navCompetitors"),icon:Pe}],V=async()=>{if(j){N(!0);try{const{error:s}=await f.from("aio_brands").delete().eq("id",j);if(s)throw s;b.success(r("aio.onboarding.brandDeleted")),p(null),await m()}catch{b.error(r("aio.onboarding.failedToDelete"))}finally{N(!1),w(!1)}}},q=async s=>{S(s);try{const{data:i,error:Q}=await f.functions.invoke("purchase-aio-credits",{body:{credits:s}});if(Q||!(i!=null&&i.url))throw new Error((i==null?void 0:i.error)||"Failed to create checkout");window.location.href=i.url}catch{b.error("Failed to start checkout")}finally{S(null),k(!1)}};return e.jsxs("div",{className:"flex h-full w-64 flex-col border-r bg-card",children:[e.jsxs("div",{className:"px-4 py-4 border-b space-y-3",children:[u.subscribed&&e.jsxs(x,{variant:"ghost",size:"sm",className:"w-full justify-start -ml-1.5 h-8 text-muted-foreground hover:text-foreground",onClick:()=>{n("/dashboard"),a==null||a()},children:[e.jsx(Y,{className:"h-3.5 w-3.5 mr-2"})," Back to workspace"]}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsxs(ce,{className:"h-8 w-8",children:[D?e.jsx(de,{src:D,alt:A}):null,e.jsx(me,{className:"bg-primary text-primary-foreground text-xs font-semibold",children:R})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold leading-tight truncate",children:A}),e.jsx("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"Brand Monitor"})]})]})]}),e.jsxs("div",{className:"p-4 border-b",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-2 block",children:r("aio.sidebar.brand")}),o.length>0?e.jsxs("div",{className:"space-y-2",children:[e.jsxs(ue,{value:j||"",onValueChange:p,children:[e.jsx(he,{className:"w-full",children:e.jsx(xe,{placeholder:r("aio.sidebar.selectBrand")})}),e.jsx(pe,{children:o.map(s=>e.jsx(fe,{value:s.id,children:s.company_name},s.id))})]}),d&&e.jsxs(x,{variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-xs text-muted-foreground hover:text-destructive",onClick:()=>w(!0),children:[e.jsx(_e,{className:"h-3 w-3"}),r("aio.sidebar.deleteBrand")]})]}):e.jsxs(x,{variant:"outline",size:"sm",className:"w-full justify-start gap-2",onClick:()=>{n("/aio/onboarding"),a==null||a()},children:[e.jsx(_,{className:"h-4 w-4"}),r("aio.sidebar.addBrand")]})]}),e.jsxs("nav",{className:"flex-1 p-2 space-y-1",children:[F.map(s=>{const i=s.exact?c.pathname===s.path:c.pathname.startsWith(s.path);return e.jsxs("button",{onClick:()=>{n(s.path),a==null||a()},className:P("flex w-full items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition-colors",i?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:[e.jsx(s.icon,{className:"h-4 w-4"}),s.label]},s.path)}),e.jsxs("button",{onClick:()=>{n("/aio/onboarding"),a==null||a()},className:"flex w-full items-center gap-3 rounded-md px-3 py-2 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",children:[e.jsx(_,{className:"h-4 w-4"}),r("aio.sidebar.addBrand")]})]}),e.jsxs("div",{className:"px-4 py-2 border-t flex items-center justify-between",children:[e.jsx(ne,{}),e.jsx(ie,{})]}),e.jsxs("div",{className:"p-3 border-t space-y-2",children:[z&&e.jsx(le,{product:"aio"}),e.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-2 py-2 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Brand Monitor Credits"}),e.jsxs(be,{open:U,onOpenChange:k,children:[e.jsx(je,{asChild:!0,children:e.jsxs(x,{variant:"outline",size:"sm",className:"h-6 gap-1 text-[11px] px-1.5",children:[e.jsx(Ie,{className:"h-3 w-3"}),"Top Up"]})}),e.jsxs(ge,{className:"w-56 p-2",align:"end",side:"top",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground px-2 py-1.5",children:"Brand Monitor credit pack"}),e.jsx("div",{className:"space-y-1",children:Z.map(s=>e.jsxs("button",{disabled:C!==null,onClick:()=>q(s.credits),className:P("flex w-full items-center justify-between rounded-md px-2 py-2 text-sm transition-colors hover:bg-accent",C===s.credits&&"opacity-60"),children:[e.jsxs("span",{className:"font-medium",children:[s.credits," Credits"]}),e.jsxs("span",{className:"text-muted-foreground",children:["€",s.priceEur]})]},s.credits))})]})]})]}),e.jsxs("div",{className:"text-[11px] text-muted-foreground flex items-center justify-between",children:[e.jsx("span",{children:"Monthly"}),e.jsxs("span",{className:"font-medium text-foreground",children:[h.monthlyRemaining," / ",h.monthlyCredits]})]}),e.jsxs("div",{className:"text-[11px] text-muted-foreground flex items-center justify-between",children:[e.jsx("span",{children:"Purchased"}),e.jsx("span",{className:"font-medium text-foreground",children:h.purchasedBalance})]})]})]}),e.jsx(we,{open:I,onOpenChange:w,children:e.jsxs(ye,{children:[e.jsxs(ve,{children:[e.jsx(Ae,{children:r("aio.deleteBrandDialog.title")}),e.jsx(Ne,{children:r("aio.deleteBrandDialog.description",{brandName:(d==null?void 0:d.company_name)||""})})]}),e.jsxs(Ce,{children:[e.jsx(Se,{disabled:y,children:r("common.cancel")}),e.jsx(ke,{onClick:V,disabled:y,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:r(y?"aio.deleteBrandDialog.deleting":"aio.deleteBrandDialog.confirm")})]})]})})]})}function hs(){const[a,n]=l.useState(!1),c=ee(),[o,j]=se(),{refreshCredits:p}=g();return l.useEffect(()=>{const d=o.get("session_id");if(o.get("aio_credits")==="success"&&d){f.functions.invoke("verify-aio-credit-purchase",{body:{session_id:d}}).then(({data:t,error:u})=>{!u&&(t!=null&&t.success)&&(b.success(`Brand Monitor credits added! Purchased balance: ${t.purchased_balance}`),p())});const m=new URL(window.location.href);m.searchParams.delete("aio_credits"),m.searchParams.delete("session_id"),window.history.replaceState({},"",m.pathname)}if(o.get("credits")==="success"&&d){f.functions.invoke("verify-credit-purchase",{body:{session_id:d}}).then(({data:t,error:u})=>{!u&&(t!=null&&t.success)&&(b.success(`Credits added! New balance: ${t.balance}`),p())});const m=new URL(window.location.href);m.searchParams.delete("credits"),m.searchParams.delete("session_id"),window.history.replaceState({},"",m.pathname)}}
6,[p]),e.jsx(Le,{children:e.jsx(re,{children:e.jsxs("div",{className:"flex h-screen bg-background",children:[c?e.jsx(Ee,{open:a,onOpenChange:n,children:e.jsx(Te,{side:"left",className:"w-64 p-0 [&>button]:hidden",children:e.jsx(E,{onNavigate:()=>n(!1)})})}):e.jsx(E,{}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[c&&e.jsxs("header",{className:"flex h-14 items-center gap-2 border-b bg-background px-4",children:[e.jsx(x,{variant:"ghost",size:"icon",onClick:()=>n(!0),children:e.jsx(Me,{className:"h-5 w-5"})}),e.jsx("span",{className:"font-semibold text-sm truncate",children:"AI Monitor"})]}),e.jsx("main",{className:"flex-1 overflow-auto",children:e.jsx(ae,{})})]})]})})})}export{hs 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.