PageSourceSearch

https://www.ecomdroptv.com/assets/AdminProcessReferralPage-D3an1_Jx.js

js ecomdroptv.com collected 2026-10-02 01:29:19 UTC 3,819 bytes, 1 lines download raw bytes

1import{h as f,u as g,j as e}from"./index-D_T1XJ3U.js";import{d as x,e as p,r as m}from"./vendor-react-Bxgxa9T6.js";function k(){const{user:i}=f(),h=g(),u=x(),[d]=p(),[r,s]=m.useState({kind:"idle"}),o=d.get("id")||d.get("paymentId")||"",a=d.get("ref")||d.get("reference")||"";return m.useEffect(()=>{if(!i||i.role!=="admin")return;if(!o&&!a){s({kind:"error",message:"Falta ?id=<paymentId> o ?ref=<reference> en la URL."});return}s({kind:"running"});const c={};o?c.paymentId=Number(o):c.reference=a,h("/api/admin/billing/process-referral",{method:"POST",body:JSON.stringify(c)}).then(async n=>{const t=await n.json().catch(()=>({}));n.ok?s({kind:"ok",result:t}):s({kind:"error",message:(t==null?void 0:t.message)||(t==null?void 0:t.error)||`HTTP ${n.status}`})}).catch(n=>s({kind:"error",message:(n==null?void 0:n.message)||"Error de red"}))},[o,a,i==null?void 0:i.id]),i?i.role!=="admin"?e.jsx(l,{children:e.jsx("div",{style:{color:"#EF4444"},children:"Solo admin."})}):e.jsxs(l,{children:[e.jsx("div",{style:{fontSize:11,fontWeight:700,color:"#737373",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:8},children:"Procesar comisión referido (retroactivo)"}),e.jsxs("div",{style:{fontSize:13,color:"#525252",marginBottom:20},children:["Payment: ",e.jsx("code",{style:y,children:o||a||"?"})]}),r.kind==="running"&&e.jsx("div",{style:{color:"#737373",fontSize:14},children:"Procesando…"}),r.kind==="ok"&&e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:22,fontWeight:800,color:"#10B981",margin:"0 0 12px"},children:"✓ Procesado"}),e.jsxs("div",{style:{background:"var(--bg-tertiary)",borderRadius:10,padding:14,marginBottom:18,fontSize:13},children:[e.jsxs("div",{children:["Payment ",e.jsxs("b",{children:["#",r.result.paymentId]})," · user ",e.jsx("b",{children:r.result.userId})]}),e.jsxs("div",{children:["Monto USD: ",e.jsxs("b",{children:["$",r.result.usdPrice.toFixed(2)]})]}),e.jsxs("div",{children:["Primer pago del user: ",e.jsx("b",{children:r.result.wasFirstPayment?"sí":"no"})]}),e.jsxs("div",{style:{marginTop:8},children:["Credits antes: ",r.result.creditsBefore," · después: ",r.result.creditsAfter,e.jsx("br",{}),e.jsx("b",{style:{color:r.result.newCredits>0?"#10B981":"#EF4444"},children:r.result.newCredits>0?`✓ +${r.result.newCredits} credit(s) nuevos al inviter`:"⚠ 0 credits nuevos — el user puede no tener inviter (community_id/referred_by) o ya se procesó antes"})]})]}),e.jsx("button",{onClick:()=>u("/referidos"),style:b,children:"Ver mi panel referidos"})]}),r.kind==="error"&&e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:20,fontWeight:800,color:"#EF4444",margin:"0 0 10px"},children:"No se pudo procesar"}),e.jsx("p",{style:{fontSize:14,color:"#3F3F3F",lineHeight:1.55,margin:"0 0 18px"},children:r.message}),e.jsx("button",{onClick:()=>u("/"),style:v,children:"Volver"})]})]}):e.jsx(l,{children:e.jsx("div",{children:"Inicia sesión."})})}function l({children:i}){return e.jsx("div",{style:{minHeight:"100vh",background:"var(--bg-primary)",display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:e.jsx("div",{style:{background:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:16,padding:32,maxWidth:520,width:"100%",boxShadow:"var(--shadow-md)"},children:i})})}const y={background:"var(--bg-tertiary)",padding:"2px 8px",borderRadius:6,fontFamily:"monospace",fontSize:12,color:"var(--text-primary)"},b={padding:"10px 18px",fontSize:13,fontWeight:700,fontFamily:"inherit",background:"linear-gradient(135deg, #6366F1, #A855F7)",color:"#fff",border:"none",borderRadius:10,cursor:"pointer"},v={padding:"10px 18px",fontSize:13,fontWeight:700,fontFamily:"inherit",background:"transparent",color:"var(--text-primary)",border:"1px solid var(--border)",borderRadius:10,cursor:"pointer"};export{k as AdminProcessReferralPage};

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.