1import{c as M,p as P,r as y,j as e,B as v,u as h,w as T,q as F,T as H,y as J}from"./index-BKInu8Gb.js";import{u as G,R as B}from"./ResellerLayout-BXe6ZB5h.js";import{u as D}from"./useMutation-BRPD8YYR.js";import{C as k,a as q,b as L,c as R,d as A}from"./card-BP0uVGrg.js";import{I as _}from"./input-DS1MAjnD.js";import{L as f}from"./label-Bs-8-fl1.js";import{S as $}from"./AnnouncementBanner-DnsBLgq7.js";import{B as C}from"./badge-kNeQxzMw.js";import{U as O}from"./upload-CRw-rl5e.js";import{L as X}from"./loader-circle-CYXtu1pc.js";import{T as W}from"./trash-2-x_P1GnwA.js";import{A as Z,a as I,b as ee,c as se,d as re,e as ae,f as te,g as ne,h as oe}from"./alert-dialog-Fn0A1pde.js";import{G as ie}from"./globe-DBDfSSAg.js";import{C as le}from"./clock-C42o-YdA.js";import{C as Y}from"./circle-check-Bljibo5l.js";import{S as V}from"./sparkles-Dy67g5WL.js";import{C as ce}from"./copy-C06rTEVO.js";import{E as de}from"./external-link-CcuYPQGf.js";import{B as me}from"./bell-CtnTuuTo.js";import{B as z}from"./building-2-vH9nABhZ.js";import{S as ue}from"./shield-check-BVSk9h-w.js";import{P as Q}from"./palette-Cdn0qg2_.js";import{M as xe}from"./mail-Ce9wnjTU.js";import{M as he}from"./message-square-CnLNEBSV.js";import"./anvevoice-logo-C8ZQvCP0.js";import"./BrandingContext-BRH9k_I2.js";import"./arrow-left-0nCR_9p3.js";import"./menu-d-k1676P.js";import"./index-Cuaw5peq.js";import"./layout-dashboard-D9pjzpyJ.js";import"./users-cdbo04JZ.js";import"./chart-column-CL-MSr0k.js";import"./wallet-C26ljaYp.js";import"./settings-B1GBuJyd.js";import"./index-Be2tF3Kx.js";import"./index-DyLHZbNU.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 pe=M("BellRing",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]]);/** 7 * @license lucide-react v0.462.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 ge=M("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** 12 * @license lucide-react v0.462.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const fe=M("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),je="image/png,image/jpeg,image/webp,image/svg+xml",be=2*1024*1024;function ye({organizationId:s,value:r,onChange:m,onPersist:t}){const b=P(),i=y.useRef(null),[d,g]=y.useState(!1),N=async c=>{var p,o;if(!c.type.match(/^image\/(png|jpeg|webp|svg\+xml)$/)){h.error("Please upload a PNG, JPG, WebP, or SVG image");return}if(c.size>be){h.error("Logo must be under 2MB");return}g(!0);const l=r;try{const n=((p=c.name.split(".").pop())==null?void 0:p.toLowerCase())||"png",j=`${s}/logo-${Date.now()}.${n}`,{error:E}=await b.storage.from("reseller-logos").upload(j,c,{cacheControl:"3600",upsert:!1});if(E)throw E;const{data:w}=b.storage.from("reseller-logos").getPublicUrl(j);if(t&&await t(w.publicUrl),m(w.publicUrl),l&&l.includes("/reseller-logos/"))try{const S=(o=l.split("/reseller-logos/")[1])==null?void 0:o.split("?")[0];S&&S.startsWith(s+"/")&&!w.publicUrl.endsWith(S)&&await b.storage.from("reseller-logos").remove([S])}catch{}h.success("Logo uploaded")}catch(n){h.error("Upload failed: "+(n.message||"Unknown error"))}finally{g(!1),i.current&&(i.current.value="")}},x=async()=>{var l;const c=r;g(!0);try{if(t&&await t(""),m(""),c&&c.includes("/reseller-logos/"))try{const p=(l=c.split("/reseller-logos/")[1])==null?void 0:l.split("?")[0];p&&p.startsWith(s+"/")&&await b.storage.from("reseller-logos").remove([p])}catch{}h.success("Logo removed")}catch(p){h.error("Remove failed: "+(p.message||"Unknown error"))}finally{g(!1)}};return e.jsx("div",{className:"space-y-3",children:e.jsxs("div",{className:"flex items-center gap-4 roun
16ded-lg border border-dashed border-border/60 bg-muted/20 p-4",onDragOver:c=>{c.preventDefault()},onDrop:c=>{var p;c.preventDefault();const l=(p=c.dataTransfer.files)==null?void 0:p[0];l&&N(l)},children:[r?e.jsx("img",{src:r,alt:"Logo preview",className:"h-14 w-14 rounded-md bg-background object-contain border border-border/40",onError:c=>{c.target.style.display="none"}}):e.jsx("div",{className:"h-14 w-14 rounded-md bg-background/60 border border-border/40 flex items-center justify-center text-muted-foreground",children:e.jsx(O,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:r?"Logo uploaded":"Upload your brand logo"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"PNG, JPG, WebP or SVG ⢠Max 2MB ⢠Square recommended"})]}),e.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.jsx(v,{type:"button",variant:"outline",size:"sm",onClick:()=>{var c;return(c=i.current)==null?void 0:c.click()},disabled:d,children:d?e.jsxs(e.Fragment,{children:[e.jsx(X,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"})," Uploading"]}):e.jsxs(e.Fragment,{children:[e.jsx(O,{className:"h-3.5 w-3.5 mr-1.5"})," ",r?"Replace":"Upload"]})}),r&&e.jsx(v,{type:"button",variant:"ghost",size:"sm",onClick:x,disabled:d,className:"text-destructive hover:text-destructive",children:e.jsx(W,{className:"h-3.5 w-3.5"})})]}),e.jsx("input",{ref:i,type:"file",accept:je,className:"hidden",onChange:c=>{var p;const l=(p=c.target.files)==null?void 0:p[0];l&&N(l)}})]})})}function ve({organizationId:s}){const r=P(),m=T(),[t,b]=y.useState(""),[i,d]=y.useState(""),[g,N]=y.useState(!1),{data:x,isLoading:c}=F({queryKey:["reseller-settings",s],queryFn:async()=>{const{data:a,error:u}=await r.from("reseller_settings").select("subdomain, subdomain_addon_active, subdomain_addon_expires_at, subdomain_addon_cancel_requested_at").eq("organization_id",s).maybeSingle();if(u)throw u;return a},enabled:!!s});y.useEffect(()=>{const a=setTimeout(()=>d(t.toLowerCase().trim()),350);return()=>clearTimeout(a)},[t]);const{data:l,isFetching:p}=F({queryKey:["subdomain-availability",i],queryFn:async()=>{const{data:a,error:u}=await r.rpc("is_subdomain_available",{_subdomain:i});if(u)throw u;return a},enabled:i.length>=3,staleTime:1e4}),o=D({mutationFn:async a=>{const{data:u,error:K}=await r.functions.invoke("claim-subdomain",{body:{organizationId:s,subdomain:a}});if(K)throw K;if(u!=null&&u.error)throw new Error(u.error);return u},onSuccess:()=>{h.success("Subdomain claimed!"),m.invalidateQueries({queryKey:["reseller-settings",s]}),b("")},onError:a=>h.error(a.message)}),n=D({mutationFn:async()=>{const{data:a,error:u}=await r.functions.invoke("cancel-subdomain-addon",{body:{organizationId:s}});if(u)throw u;if(a!=null&&a.error)throw new Error(a.error);return a},onSuccess:()=>{h.success("Add-on cancellation requested. Active until period end."),m.invalidateQueries({queryKey:["reseller-settings",s]})},onError:a=>h.error(a.message)}),j=D({mutationFn:async()=>{const{data:a,error:u}=await r.functions.invoke("release-subdomain",{body:{organizationId:s}});if(u)throw u;if(a!=null&&a.error)throw new Error(a.error);return a},onSuccess:()=>{h.success("Subdomain released. You can claim a new one now."),m.invalidateQueries({queryKey:["reseller-settings",s]})},onError:a=>h.error(a.message)}),E=async()=>{N(!0);try{const{data:a,error:u}=await r.functions.invoke("purchase-subdomain-addon",{body:{organizationId:s}});if(u)throw u;if(a!=null&&a.error)throw new Error(a.error);a!=null&&a.shortUrl&&(window.open(a.shortUrl,"_blank","noopener,noreferrer"),h.success("Complete payment in the new tab. Status will update automatically."))}catch(a){h.error(a instanceof Error?a.message:"Failed to start checkout")}finally{N(!1)}};if(c)return e.jsx($,{className:"h-64"});const w=(x==null?void 0:x.subdomain_addon_active)===!0,S=!!(x!=null&&x.subdomain),U=!!(x!=null&&x.subdomain_addon_cancel_requested_at);return e.jsxs(k,{children:[e.jsxs(q,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:[e.jsxs(L,{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"h-5 w-5"})," Branded Subdomain",e.jsx(C,{variant:"outline",className:"ml-1 text-xs",children:"$10/mo"})]}),w?U?e.jsxs(C,{variant:"outline",className:"text-amber-400 border-amber-500/30",children:[e.jsx(le,{className:"h-3 w-3 mr-1"})," Cancelling"]}):e.jsxs(C,{variant:"default",className:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",children:[e.jsx(Y,{className:"h-3 w-3 mr-1"})," Active"]}):e.jsx(C,{variant:"outline",className:"text-muted-foreground",children:"Inactive"})]}),e.jsxs(R,{children:["Give your clients a branded URL like ",e.jsx("code",{className:"text-xs",children:"your-name.app.anvevoice.app"})]})]}),e.jsxs(A,{className:"space-y-4",children:[!w&&e.jsxs("div",{className:"rounded-lg border border-border/50 bg-muted/30 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(V,{className:"h-5 w-5 text-primary mt-0.5"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"Activate Branded Subdomain"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["$10/month. Pick any available ",e.jsxs("code",{children:["<name>",".app.anvevoice.app"]}),". Cancel anytime."]})]})]}),e.jsx(v,{onClick:E,disabled:g,className:"w-full",children:g?"Opening checkout...":"Activate for $10/month"})]}),w&&!S&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(f,{children:"Choose your subdomain"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{value:t,onChange:a=>b(a.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),placeholder:"your-name",maxLength:30}),e.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:".app.anvevoice.app"})]}),i.length>=3&&e.jsx("p",{className:"text-xs",children:p?e.jsx("span",{className:"text-muted-foreground",children:"Checking..."}):l!=null&&l.available?e.jsx("span",{className:"text-emerald-400",children:"â Available"}):e.jsxs("span",{className:"text-destructive",children:["Not available (",(l==null?void 0:l.reason)||"unknown",")"]})}),e.jsx(v,{onClick:()=>o.mutate(i),disabled:o.isPending||!(l!=null&&l.available),className:"w-full",children:o.isPending?"Claiming...":"Claim Subdomain"})]}),w&&S&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-lg border border-border/50 bg-muted/30 p-4 space-y-2",children:[e.jsx(f,{className:"text-xs text-muted-foreground",children:"Your branded URL"}),e.jsxs("div",{className:"flex items-center gap-2 bg-background rounded-md p-2 border",children:[e.jsxs("code",{className:"text-sm flex-1 text-foreground",children:["https://",x.subdomain,".app.anvevoice.app"]}),e.jsx(v,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{navigator.clipboard.writeText(`https://${x.subdomain}.app.anvevoice.app`),h.success("Copied")},children:e.jsx(ce,{className:"h-3.5 w-3.5"})}),e.jsx(v,{variant:"ghost",size:"icon",className:"h-7 w-7",asChild:!0,children:e.jsx("a",{href:`https://${x.subdomain}.app.anvevoice.app`,target:"_blank",rel:"noopener noreferrer",children:e.jsx(de,{className:"h-3.5 w-3.5"})})})]})]}),!U&&e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(Z,{children:[e.jsx(I,{asChild:!0,children:e.jsxs(v,{variant:"ghost",size:"sm",disabled:j.isPending,className:"text-muted-foreground hover:text-destructive",children:[e.jsx(W,{className:"h-3.5 w-3.5 mr-1.5"}),j.isPending?"Releasing...":"Release & choose new"]})}),e.jsxs(ee,{children:[e.jsxs(se,{children:[e.jsx(re,{children:"Release this subdomain?"}),e.jsxs(ae,{children:["Your URL ",e.jsxs("code",{className:"text-xs",children:[x.subdomain,".app.anvevoice.app"]})," will stop working immediately and the slug will become available for anyone else to claim. Your $10/month add-on stays active, so you can pick a new subdomain right away."]})]}),e.jsxs(te,{children:[e.jsx(ne,{children:"Keep it"}),e.jsx(oe,{onClick:()=>j.mutate(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Release subdomain"})]})]})]}),e.jsx(v,{variant:"ghost",size:"sm",onClick:()=>n.mutate(),disabled:n.isPending,className:"text-muted-foreground hover:text-destructive",children:n.isPending?"Cancelling...":"Cancel add-on"})]}),U&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Add-on cancellation requested. Subdomain remains active until the end of your current billing period."})]})]})]})}function Ne({organizationId:s,userId:r}){const m=P(),t=T(),{data:b}=F({queryKey:["feature-interest","custom_domain",s,r],queryFn:async()=>
16{if(!r)return null;const{data:g,error:N}=await m.from("feature_interest").select("id").eq("user_id",r).eq("feature","custom_domain").eq("organization_id",s).maybeSingle();return N?null:g},enabled:!!r}),i=D({mutationFn:async()=>{if(!r)throw new Error("Not signed in");const{error:g}=await m.from("feature_interest").insert({user_id:r,feature:"custom_domain",organization_id:s,metadata:{source:"reseller_settings",price_point:"$10/mo"}});if(g&&g.code!=="23505")throw g},onSuccess:()=>{h.success("We'll notify you when custom domains launch!"),t.invalidateQueries({queryKey:["feature-interest","custom_domain"]})},onError:g=>h.error(g.message)}),d=!!b;return e.jsxs(k,{className:"opacity-90",children:[e.jsxs(q,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:[e.jsxs(L,{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-5 w-5 text-muted-foreground"})," Custom Domain",e.jsx(C,{variant:"outline",className:"ml-1 text-xs",children:"$10/mo"})]}),e.jsx(C,{variant:"outline",className:"text-amber-400 border-amber-500/30",children:"Coming Soon"})]}),e.jsxs(R,{children:["Use your own domain like ",e.jsx("code",{className:"text-xs",children:"voice.youragency.com"})," for the fully white-labeled experience."]})]}),e.jsxs(A,{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border border-dashed border-border/50 bg-muted/20 p-4 space-y-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Preview"}),e.jsx("code",{className:"text-sm text-foreground/70 block",children:"https://voice.youragency.com"})]}),e.jsx(v,{variant:"outline",onClick:()=>i.mutate(),disabled:i.isPending||d||!r,className:"w-full",children:d?e.jsxs(e.Fragment,{children:[e.jsx(pe,{className:"h-4 w-4 mr-2"})," You'll be notified"]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"h-4 w-4 mr-2"})," Notify me when available"]})})]})]})}const we=()=>{const{createOrganization:s}=G(),[r,m]=y.useState(""),[t,b]=y.useState(""),i=async()=>{!r||!t||await s.mutateAsync({name:r,slug:t})};return e.jsx("div",{className:"max-w-md mx-auto mt-12",children:e.jsxs(k,{children:[e.jsxs(q,{className:"text-center",children:[e.jsx(z,{className:"h-12 w-12 mx-auto text-primary mb-2"}),e.jsx(L,{children:"Create Reseller Organization"}),e.jsx(R,{children:"Set up your reseller account to start managing clients"})]}),e.jsxs(A,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(f,{children:"Organization Name"}),e.jsx(_,{value:r,onChange:d=>m(d.target.value),placeholder:"My Agency"})]}),e.jsxs("div",{children:[e.jsx(f,{children:"Slug (URL-friendly identifier)"}),e.jsx(_,{value:t,onChange:d=>b(d.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),placeholder:"my-agency"})]}),e.jsx(v,{onClick:i,disabled:!r||!t||s.isPending,className:"w-full",children:s.isPending?"Creating...":"Create Organization"})]})]})})};function _e(s){return s.trim().replace(/^https?:\/\//i,"").replace(/\/+$/,"").toLowerCase()}function Ce(s){return s?/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/.test(s):!0}const Se=({organizationId:s})=>{const r=P(),m=T(),{data:t,isLoading:b}=F({queryKey:["reseller-settings",s],queryFn:async()=>{const{data:o,error:n}=await r.from("reseller_settings").select("*").eq("organization_id",s).maybeSingle();if(n)throw n;return o},enabled:!!s}),[i,d]=y.useState({brand_name:"",logo_url:"",primary_color:"#7c3aed",custom_domain:"",support_email:"",footer_text:"",footer_link:""}),[g,N]=y.useState(""),[x,c]=y.useState("");y.useState(!1),y.useEffect(()=>{t&&d({brand_name:t.brand_name||"",logo_url:t.logo_url||"",primary_color:t.primary_color||"#7c3aed",custom_domain:t.custom_domain||"",support_email:t.support_email||"",footer_text:t.footer_text||"",footer_link:t.footer_link||""})},[t]);const l=D({mutationFn:async o=>{const n={...o,custom_domain:_e(o.custom_domain)};if(t){const{error:j}=await r.from("reseller_settings").update({...n,updated_at:new Date().toISOString()}).eq("organization_id",s);if(j)throw j}else{const{error:j}=await r.from("reseller_settings").insert({...n,organization_id:s});if(j)throw j}},onSuccess:()=>
16{m.invalidateQueries({queryKey:["reseller-settings",s]}),m.invalidateQueries({queryKey:["reseller-branding"]}),h.success("Branding settings saved")},onError:o=>{h.error("Failed to save: "+o.message)}});if(b)return e.jsx($,{className:"h-64"});const p=(t==null?void 0:t.white_label_enabled)===!0;return t==null||t.custom_domain_verified,i.custom_domain&&Ce(i.custom_domain),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(k,{children:[e.jsx(q,{children:e.jsxs(L,{className:"flex items-center gap-2",children:[e.jsx(ue,{className:"h-5 w-5"})," White-Label Status"]})}),e.jsx(A,{children:e.jsx("div",{className:"flex items-center gap-3",children:p?e.jsxs(e.Fragment,{children:[e.jsxs(C,{variant:"default",className:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",children:[e.jsx(Y,{className:"h-3.5 w-3.5 mr-1"})," Enabled"]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"All AnveVoice branding is hidden from your clients and their widgets."})]}):e.jsxs(e.Fragment,{children:[e.jsxs(C,{variant:"outline",className:"text-amber-400 border-amber-500/30",children:[e.jsx(H,{className:"h-3.5 w-3.5 mr-1"})," Upgrade Required"]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Contact support to enable full white-label mode for your organization."})]})})})]}),e.jsxs(k,{children:[e.jsxs(q,{children:[e.jsxs(L,{className:"flex items-center gap-2",children:[e.jsx(Q,{className:"h-5 w-5"})," Branding"]}),e.jsx(R,{children:"Customize how your clients see the platform"})]}),e.jsxs(A,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{className:"flex items-center gap-1.5",children:[e.jsx(z,{className:"h-3.5 w-3.5"})," Brand Name"]}),e.jsx(_,{value:i.brand_name,onChange:o=>d(n=>({...n,brand_name:o.target.value})),placeholder:"Your Brand Name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{className:"flex items-center gap-1.5",children:[e.jsx(xe,{className:"h-3.5 w-3.5"})," Support Email"]}),e.jsx(_,{type:"email",value:i.support_email,onChange:o=>d(n=>({...n,support_email:o.target.value})),placeholder:"[email protected]"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{className:"flex items-center gap-1.5",children:[e.jsx(ge,{className:"h-3.5 w-3.5"})," Logo"]}),e.jsx(ye,{organizationId:s,value:i.logo_url,onChange:o=>d(n=>({...n,logo_url:o})),onPersist:async o=>{if(t){const{error:n}=await r.from("reseller_settings").update({logo_url:o,updated_at:new Date().toISOString()}).eq("organization_id",s);if(n)throw n}else{const{error:n}=await r.from("reseller_settings").insert({organization_id:s,logo_url:o});if(n)throw n}m.invalidateQueries({queryKey:["reseller-settings",s]}),m.invalidateQueries({queryKey:["reseller-branding"]})}})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{className:"flex items-center gap-1.5",children:[e.jsx(Q,{className:"h-3.5 w-3.5"})," Primary Color"]}),e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx("input",{type:"color",value:i.primary_color,onChange:o=>d(n=>({...n,primary_color:o.target.value})),className:"w-10 h-10 rounded border cursor-pointer"}),e.jsx(_,{value:i.primary_color,onChange:o=>d(n=>({...n,primary_color:o.target.value})),className:"flex-1"})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 pt-2 border-t border-border/40 mt-2",children:[e.jsx("div",{className:"space-y-2 sm:col-span-2",children:e.jsx("p",{className:"text-xs text-muted-foreground",children:"Customize the footer shown inside your widget. Leave both blank to hide the footer entirely on white-labeled widgets."})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{className:"flex items-center gap-1.5",children:[e.jsx(he,{className:"h-3.5 w-3.5"})," Footer text"]}),e.jsx(_,{value:i.footer_text,onChange:o=>d(n=>({...n,footer_text:o.target.value})),placeholder:"Powered by Your Brand",maxLength:80})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{className:"flex items-center gap-1.5",children:[e.jsx(fe,{className:"h-3.5 w-3.5"})," Footer link URL"]}),e.jsx(_,{type:"url",value:i.footer_link,onChange:o=>{const n=o.target.value.trim();d(j=>({...j,footer_link:n})),n&&!/^https?:\/\/.+/i.test(n)?c("Must start with http:// or https://"):c("")},placeholder:"https://yourbrand.com"}),x&&e.jsx("p",{className:"text-xs text-destructive",children:x})]})]}),e.jsx(v,{onClick:()=>l.mutate(i),disabled:l.isPending||!!g||!!x,className:"w-full",children:l.isPending?"Saving...":"Save Branding Settings"})]})]})]})},ke=({organizationId:s})=>{var t;const{session:r}=J(),m=((t=r==null?void 0:r.user)==null?void 0:t.id)??null;return e.jsxs("div",{className:"space-y-6",children:[e.jsx(ve,{organizationId:s}),e.jsx(Ne,{organizationId:s,userId:m})]})},ds=()=>{const{organization:s,isReseller:r,isLoading:m}=G();return m?e.jsx(B,{children:e.jsx($,{className:"h-96"})}):r?e.jsx(B,{children:e.jsxs("div",{className:"space-y-6 max-w-2xl",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Organization Settings"}),e.jsxs(k,{children:[e.jsx(q,{children:e.jsx(L,{children:"Organization Details"})}),e.jsxs(A,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(f,{className:"text-muted-foreground",children:"Name"}),e.jsx("p",{className:"font-medium text-foreground",children:s==null?void 0:s.name})]}),e.jsxs("div",{children:[e.jsx(f,{className:"text-muted-foreground",children:"Slug"}),e.jsx("p",{className:"font-medium text-foreground",children:s==null?void 0:s.slug})]}),e.jsxs("div",{children:[e.jsx(f,{className:"text-muted-foreground",children:"Type"}),e.jsx("p",{className:"font-medium text-foreground capitalize",children:s==null?void 0:s.type})]}),e.jsxs("div",{children:[e.jsx(f,{className:"text-muted-foreground",children:"Status"}),e.jsx("p",{className:"font-medium text-foreground capitalize",children:s==null?void 0:s.status})]}),e.jsxs("div",{children:[e.jsx(f,{className:"text-muted-foreground",children:"Created"}),e.jsx("p",{className:"font-medium text-foreground",children:s!=null&&s.created_at?new Date(s.created_at).toLocaleDateString():"-"})]})]})]}),e.jsx(Se,{organizationId:s.id}),e.jsx(ke,{organizationId:s.id})]})}):e.jsx(B,{children:e.jsx(we,{})})};export{ds 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.