PageSourceSearch

https://mostreams-com.lovable.app/assets/publishing-administration-CO75a6j_.js

js mostreams-com.lovable.app collected 2026-10-03 03:36:00 UTC 4,986 bytes, 1 lines download raw bytes

1import{r,j as t,B as _,s as a,v as i}from"./index-BNrdOJig.js";import{B as D,D as k,E as S}from"./BackOfficeWorkspace-BsNQ8xko.js";import{I as g}from"./input-CwAqzCK4.js";function F(){const[o,w]=r.useState([]),[n,C]=r.useState([]),[m,N]=r.useState([]),[I,P]=r.useState([]),[c,h]=r.useState(""),[x,p]=r.useState(""),[f,A]=r.useState("ASCAP"),[j,R]=r.useState("100"),[v,W]=r.useState(""),[E,b]=r.useState(!1),[l,y]=r.useState(""),u=async()=>{const{data:e}=await a.auth.getUser(),s=e.user?.id;if(!s)return;const[{data:L},{data:M},{data:d},{data:q}]=await Promise.all([a.from("publishing_admin_works").select("id, track_id, iswc, title, society, share_percent, status, created_at").eq("user_id",s).order("created_at",{ascending:!1}),a.from("royalty_admin_registrations").select("id, org_id, status, external_ref, created_at").eq("artist_id",s).order("created_at",{ascending:!1}),a.from("royalty_admin_orgs").select("id, name, slug").order("sort_order"),a.from("tracks").select("id, title").eq("owner_id",s).eq("removed",!1).limit(50)]);w(L??[]),C(M??[]),N(d??[]),P(q??[]),!l&&d&&d[0]&&y(d[0].id)};r.useEffect(()=>{u()},[]);const B=async()=>{if(!c.trim())return i.error("Title required");b(!0);const{data:e}=await a.auth.getUser(),{error:s}=await a.from("publishing_admin_works").insert({user_id:e.user.id,track_id:v||null,title:c.trim(),iswc:x.trim()||null,society:f,share_percent:parseFloat(j)||100,status:"registered"});if(b(!1),s)return i.error(s.message);h(""),p(""),i.success("Work registered."),u()},O=async()=>{if(!l)return;const{data:e}=await a.auth.getUser(),{error:s}=await a.from("royalty_admin_registrations").insert({artist_id:e.user.id,org_id:l,status:"pending"});if(s)return i.error(s.message);i.success("Registration started."),u()};return t.jsxs(D,{title:"Publishing Administration",subtitle:"Register your works, collect from PROs and neighbouring-rights orgs worldwide",intro:"Log your publishing works (ISWCs, splits, society) and file registrations with SoundExchange, PPL, ASCAP/BMI, MLC, and other royalty administrators.",kpis:[{label:"Works",value:o.length},{label:"With ISWC",value:o.filter(e=>e.iswc).length},{label:"PRO registrations",value:n.length},{label:"Confirmed",value:n.filter(e=>e.status==="confirmed"||e.status==="active").length}],toolbar:t.jsxs(t.Fragment,{children:[t.jsx(g,{placeholder:"Work title",value:c,onChange:e=>h(e.target.value),className:"w-52"}),t.jsx(g,{placeholder:"ISWC",value:x,onChange:e=>p(e.target.value),className:"w-36"}),t.jsxs("select",{value:f,onChange:e=>A(e.target.value),className:"rounded-md bg-background border border-border px-3 py-2 text-sm",children:[t.jsx("option",{children:"ASCAP"}),t.jsx("option",{children:"BMI"}),t.jsx("option",{children:"SESAC"}),t.jsx("option",{children:"PRS"}),t.jsx("option",{children:"SACEM"}),t.jsx("option",{children:"GEMA"}),t.jsx("option",{children:"MLC"})]}),t.jsx(g,{placeholder:"Share %",value:j,onChange:e=>R(e.target.value),className:"w-24",type:"number"}),t.jsxs("select",{value:v,onChange:e=>W(e.target.value),className:"rounded-md bg-background border border-border px-3 py-2 text-sm min-w-[180px]",children:[t.jsx("option",{value:"",children:"— Link track —"}),I.map(e=>t.jsx("option",{value:e.id,children:e.title},e.id))]}),t.jsx(_,{onClick:B,disabled:E,children:"Register work"})]}),children:[t.jsx(k,{title:"Royalty admin registrations",action:t.jsxs("div",{className:"flex gap-2",children:[t.jsx("select",{value:l,onChange:e=>y(e.target.value),className:"rounded-md bg-background border border-border px-2 py-1 text-xs",children:m.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id))}),t.jsx(_,{size:"sm",onClick:O,children:"Start"})]}),children:n.length===0?t.jsx(S,{title:"No PRO registrations",description:"Start a registration with a royalty organization above."}):t.jsx("ul",{className:"divide-y divide-white/5 text-sm",children:n.map(e=>t.jsxs("li",{className:"px-5 py-3 grid grid-cols-4 gap-2 items-center",children:[t.jsx("div",{className:"col-span-2 font-semibold",children:m.find(s=>s.id===e.org_id)?.name??e.org_id}),t.jsx("div",{className:"text-xs text-muted-foreground",children:e.external_ref??"—"}),t.jsxs("div",{className:"text-xs text-right",children:[e.status," · ",new Date(e.created_at).toLocaleDateString()]})]},e.id))})}),t.jsx(k,{title:"Your works",children:o.length===0?t.jsx(S,{title:"No works registered",description:"Register your first work above to start collecting mechanical and performance royalties."}):t.jsx("ul",{className:"divide-y divide-white/5 text-sm",children:o.map(e=>
1t.jsxs("li",{className:"px-5 py-3 grid grid-cols-5 gap-2 items-center",children:[t.jsx("div",{className:"col-span-2 font-semibold truncate",children:e.title}),t.jsx("div",{className:"text-xs text-muted-foreground",children:e.iswc??"no ISWC"}),t.jsxs("div",{className:"text-xs",children:[e.society??"—"," · ",e.share_percent??100,"%"]}),t.jsx("div",{className:"text-xs text-right",children:e.status??"—"})]},e.id))})})]})}export{F as component};

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.