1"use strict";(self.webpackChunkstudio_tools=self.webpackChunkstudio_tools||[]).push([[5646],{75646:(t,e,a)=>{a.r(e),a.d(e,{default:()=>Z});var n=a(72791),s=a(1117),c=a(57960),i=a(20952),r=a(61431),o=a(21306),l=a(31773),d=a(91082),u=a(2556),p=a(64248),m=a(34957),h=a(40959),y=a(86005),x=a(50357),g=a(80184);const f={approved:"green",pending:"gold",suspended:"red"};function Z(){const[t,e]=(0,n.useState)([]),[a,Z]=(0,n.useState)(0),[v,w]=(0,n.useState)(1),[S,j]=(0,n.useState)(!1),[P,k]=(0,n.useState)(!1),[A,b]=(0,n.useState)("all"),[C]=s.Z.useForm(),I=(0,n.useCallback)((async()=>{j(!0);try{const t=await(0,x.AW)({page:v,limit:30});e(t.data),Z(t.total)}catch{c.ZP.error("Failed to load partners")}finally{j(!1)}}),[v]);(0,n.useEffect)((()=>{I()}),[I]);const F=(0,n.useMemo)((()=>t.filter((t=>"pending"===t.status)).length),[t]),N=(0,n.useMemo)((()=>"all"===A?t:t.filter((t=>{var e;return(null!==(e=t.status)&&void 0!==e?e:"pending")===A}))),[t,A]),T=[{title:"Name",dataIndex:"name",key:"name"},{title:"Slug",dataIndex:"slug",key:"slug"},{title:"Email",dataIndex:"contactEmail",key:"contactEmail"},{title:"Status",key:"status",width:110,render:(t,e)=>{var a;return e.status?(0,g.jsx)(i.Z,{color:null!==(a=f[e.status])&&void 0!==a?a:"default",children:e.status}):(0,g.jsx)(i.Z,{children:"\u2014"})}},{title:"Rev-share",key:"commissionPct",width:90,render:(t,e)=>null!=e.commissionPct?"".concat(Number(e.commissionPct),"%"):"\u2014"},{title:"Prompts",key:"promptsActive",width:90,render:(t,e)=>(0,g.jsx)(r.Z,{title:"Surface this influencer's prompts in Claude/ChatGPT by handle",children:(0,g.jsx)(o.Z,{checked:!!e.promptsActive,onChange:async t=>{try{await(0,x.BO)(e.id,{promptsActive:t}),c.ZP.success("Updated"),I()}catch{c.ZP.error("Failed")}}})})},{title:"Active",key:"isActive",width:90,render:(t,e)=>(0,g.jsx)(o.Z,{checked:e.isActive,onChange:async t=>{try{await(0,x.BO)(e.id,{isActive:t}),c.ZP.success("Updated"),I()}catch{c.ZP.error("Failed")}}})},{title:"Actions",key:"actions",width:200,render:(t,e)=>(0,g.jsxs)(l.Z,{children:["approved"!==e.status&&(0,g.jsx)(d.Z,{title:"Approve this affiliate? They can then receive payouts.",okText:"Approve",onConfirm:async()=>{try{await(0,x.EW)(e.id),c.ZP.success("Approved"),I()}catch{c.ZP.error("Failed")}},children:(0,g.jsx)(u.ZP,{type:"primary",size:"small",children:"Approve"})}),"approved"===e.status&&(0,g.jsx)(d.Z,{title:"Suspend this affiliate? Their affiliate features pause.",okText:"Suspend",okButtonProps:{danger:!0},onConfirm:async()=>{try{await(0,x.S4)(e.id),c.ZP.success("Suspended"),I()}catch{c.ZP.error("Failed")}},children:(0,g.jsx)(u.ZP,{danger:!0,size:"small",children:"Suspend"})})]})}];return(0,g.jsxs)("div",{className:"p-6",children:[(0,g.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,g.jsxs)("h1",{className:"text-xl font-semibold",children:["Partners"," ",F>0&&(0,g.jsxs)(i.Z,{color:"gold",children:[F," pending"]})]}),(0,g.jsx)(u.ZP,{type:"primary",onClick:()=>k(!0),children:"New partner"})]}),(0,g.jsx)(p.Z,{className:"mb-3",value:A,onChange:t=>b(t),options:[{label:"All",value:"all"},{label:"Pending",value:"pending"},{label:"Approved",value:"approved"},{label:"Suspended",value:"suspended"}]}),(0,g.jsx)(m.Z,{rowKey:"id",loading:S,columns:T,dataSource:N,pagination:{current:v,pageSize:30,total:a,onChange:t=>w(t)}}),(0,g.jsx)(h.default,{title:"Create partner",open:P,onCancel:()=>k(!1),okText:"Create",onOk:async()=>{try{const t=await C.validateFields();await(0,x.MU)({name:t.name,slug:t.slug,contactEmail:t.contactEmail,isActive:!0,notes:t.notes}),c.ZP.success("Created"),k(!1),C.resetFields(),I()}catch{c.ZP.error("Failed")}},children:(0,g.jsxs)(s.Z,{form:C,layout:"vertical",children:[(0,g.jsx)(s.Z.Item,{name:"name",label:"Name",rules:[{required:!0}],children:(0,g.jsx)(y.default,{})}),(0,g.jsx)(s.Z.Item,{name:"slug",label:"Slug (lowercase, hyphens)",rules:[{required:!0}],children:(0,g.jsx)(y.default,{})}),(0,g.jsx)(s.Z.Item,{name:"contactEmail",label:"Contact email",children:(0,g.jsx)(y.default,{type:"email"})}),(0,g.jsx)(s.Z.Item,{name:"notes",label:"Notes",children:(0,g.jsx)(y.default.TextArea,{rows:3})})]})})]})}},50357:(t,e,a)=>{a.d(e,{AW:()=>g,BO:()=>Z,Df:()=>p,EW:()=>v,KF:()=>d,Kz:()=>c,MU:()=>f,Mt:()=>l,S4:()=>w,S7:()=>o,j3:()=>h,jY:()=>i,kW:()=>y,p7:()=>u,wN:()=>S,x_:()=>r,yU:()=>m});var n=a(78270);const s="/admin/templates";async function c(t){const e=new URLSearchParams;t.page&&e.set("page",String(t.page)),t.limit&&e.set("limit",String(t.limit)),t.search&&e.set("search",t.search),t.mediaType&&e.set("mediaType",t.mediaType),null!=t.partnerId&&e.set("partnerId",String(t.partnerId)),void 0!==t.isActive&&e.set("isActive",String(t.isActive));const{data:a}=await n.Z.axios.get("".concat(s,"?").concat(e.toString()));return a}
1async function i(t){const{data:e}=await n.Z.axios.post("".concat(s,"/batch"),t);return e}async function r(t){const{data:e}=await n.Z.axios.post(s,t);return e}async function o(t,e){const{data:a}=await n.Z.axios.patch("".concat(s,"/").concat(t,"/active"),{isActive:e});return a}async function l(t){const{data:e}=await n.Z.axios.post("".concat(s,"/").concat(t,"/generate-preview"));return e}async function d(t){const{data:e}=await n.Z.axios.patch("".concat(s,"/").concat(t,"/clear-preview-job"));return e}async function u(t){await n.Z.axios.delete("".concat(s,"/").concat(t))}async function p(){const{data:t}=await n.Z.axios.get("".concat(s,"/categories"));return t.categories}async function m(t){const e=new URLSearchParams;t.galleryId&&e.set("galleryId",t.galleryId),null!=t.mediaId&&e.set("mediaId",String(t.mediaId));const{data:a}=await n.Z.axios.get("".concat(s,"/from-gallery/prefill?").concat(e.toString()));return a}async function h(t){const{data:e}=await n.Z.axios.post("".concat(s,"/from-gallery"),t);return e}async function y(t){const{data:e}=await n.Z.axios.post("".concat(s,"/parse-text"),t);return e}const x="/admin/partners";async function g(t){const e=new URLSearchParams;t.page&&e.set("page",String(t.page)),t.limit&&e.set("limit",String(t.limit)),t.search&&e.set("search",t.search);const{data:a}=await n.Z.axios.get("".concat(x,"?").concat(e.toString()));return a}async function f(t){const{data:e}=await n.Z.axios.post(x,t);return e}async function Z(t,e){const{data:a}=await n.Z.axios.put("".concat(x,"/").concat(t),e);return a}async function v(t){const{data:e}=await n.Z.axios.post("".concat(x,"/").concat(t,"/approve"));return e}async function w(t){const{data:e}=await n.Z.axios.post("".concat(x,"/").concat(t,"/suspend"));return e}async function S(t){const{data:e}=await n.Z.axios.post("".concat(s,"/seed-curated").concat(t?"?dryRun=true":""));return e}}}]); 2//# sourceMappingURL=5646.51a8e6bc.chunk.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.