PageSourceSearch

https://www.ecomdroptv.com/assets/BillingTab-DD4Gu6ky.js

js ecomdroptv.com collected 2026-10-02 01:28:50 UTC 45,178 bytes, 8 lines download raw bytes

1import{u as J,h as fe,n as he,o as ye,j as e,M as X,T as Q,S as be,g as ne,E as ie,D as ve,p as ke,q as Se}from"./index-D_T1XJ3U.js";import{r as l}from"./vendor-react-Bxgxa9T6.js";import{P as je}from"./Pricing-DHmyOZ1T.js";import{S as se}from"./Servicios-BEPAn2g6.js";import"./periodo-plan-NC4xkV1W.js";const ae=[{key:"landing",label:"Landing (página de ventas)",color:"#0E9F6E",basePriceUSD:10,extraLabel:"",extraPriceUSD:0,pitch:"Crea tu página de ventas contraentrega y vende hoy",features:["Arma tu página de ventas en minutos, sin programar","Formulario contraentrega que crea el pedido en Dropi solo","Importa cualquier landing por link y editala a tu gusto","Pixeles de Meta y TikTok integrados para medir ventas","Cobra al recibir o pago anticipado, tú eliges","CRM de pedidos tipo tablero incluido"]},{key:"meta",label:"Meta Ads",color:"#0866FF",basePriceUSD:5,extraLabel:"cuentas",extraPriceUSD:3,pitch:"Pausa, activa y ajusta presupuestos automáticamente",features:["Pausa o activa campañas con reglas automáticas","Sube o baja presupuestos sin abrir el administrador","IA detecta oportunidades y avisa cuando algo se 
1cae","Maneja tus anuncios desde el celular, donde estés","Más todo lo que ofrece TikTok Ads dentro de Lumy","Y mucho más 🔥"]},{key:"tiktok",label:"TikTok Ads",color:"#FE2C55",basePriceUSD:5,extraLabel:"cuentas",extraPriceUSD:3,pitch:"Reglas automáticas y control de budget en tiempo real",features:["Controla budget y reglas automáticas en cada anuncio","Demografía y comparativos sin abrir TikTok Business","Alertas inmediatas si algo se rompe en tus anuncios","Pausa, activa y ajusta desde tu celular","Más todo lo que ofrece Meta Ads dentro de Lumy","Y mucho más 🔥"]},{key:"dropi",label:"Dropi",color:"#F1701A",basePriceUSD:5,extraLabel:"",extraPriceUSD:0,pitch:"Mide devoluciones y dónde estás perdiendo plata",features:["Mide devoluciones y calcula dónde pierdes plata","Compara la mejor vs la peor transportadora con ranking","Utilidad real + cartera + cruce con tu pauta","Más todo lo que ofrecen Mastershop y 99envíos","Y mucho más 🔥"]},{key:"mastershop",label:"Mastershop",color:"#A6F23B",basePriceUSD:5,extraLabel:"",extraPriceUSD:0,pitch:"Pedidos, atribución y utilidad real de Mastershop",features:["Cruza pedidos Mastershop con tu pauta de ads","Utilidad real por producto sin tocar Excel","Detecta novedades, devueltos y pedidos atascados","Más todo lo que ofrecen Dropi y 99envíos","Y mucho más 🔥"]},{key:"envios99",label:"99envíos",color:"#FF5500",basePriceUSD:5,extraLabel:"",extraPriceUSD:0,pitch:"Multi-transportadora LATAM con seguros y atribución",features:["Conecta varias transportadoras LATAM con seguros","Mira cuánto cuesta cada envío y cuál transportadora rinde","Cruce de pedidos con tus campañas activas","Más todo lo que ofrecen Dropi y Mastershop","Y mucho más 🔥"]},{key:"academia",label:"Academia Lumy",color:"#A855F7",basePriceUSD:10,extraLabel:"",extraPriceUSD:0,pitch:"Cursos prácticos para escalar tu operación de COD",features:["Meta Ads: escalamiento vertical para COD","TikTok: hooks del segundo 0–3 que convierten","Dropi: leer cartera como operador pro","Testing 3×3 de creativos + matemática del margen","Acceso ilimitado al catálogo mientras tengas el addon"]}];function Ce(){const r=J(),[s,i]=l.useState(null),[h,o]=l.useState(""),[S,n]=l.useState(""),[b,T]=l.useState(!1),v=l.useRef(0);l.useEffect(()=>{const m=v.current;r("/api/plan/cupon/guardado").then(f=>f.json()).then(f=>{m===v.current&&(f!=null&&f.ok)&&f.cupon&&i(f.cupon)}).catch(()=>{})},[r]);const j=async()=>{const m=h.trim();if(!m){n("Escribe tu código para aplicarlo.");return}if(!b){v.current++,T(!0),n("");try{const f=await r("/api/plan/cupon/guardar",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({codigo:m})}).then(y=>y.json());f!=null&&f.ok?(i({codigo:m.toUpperCase(),descuento_usd:Number(f.descuento_usd)||0}),o(""),n("")):n(String((f==null?void 0:f.message)||"No se pudo aplicar el código."))}catch{n("No se pudo aplicar el código. Intenta de nuevo.")}finally{T(!1)}}},F=async()=>{if(!b){v.current++,T(!0),n("");try{const m=await r("/api/plan/cupon/guardado",{method:"DELETE"}),f=await m.json().catch(()=>null);if(!m.ok||f&&f.ok===!1){n("No pudimos quitarlo. Intenta de nuevo.");return}i(null),n("")}catch{n("No pudimos quitarlo. Intenta de nuevo.")}finally{T(!1)}}};return e.jsxs("div",{"data-guia":"facturacion.cupon",style:{marginTop:12,padding:12,borderRadius:12,border:"1px solid var(--border, #e2e8f0)",background:"var(--bg-secondary, #f8fafc)"},children:[s?e.jsxs("div",{role:"status","aria-live":"polite",style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[e.jsxs("div",{style:{flex:1,minWidth:180,fontSize:13,lineHeight:1.45},children:[e.jsx("b",{style:{fontFamily:"ui-monospace, monospace"},children:s.codigo})," listo para tu próximo cobro",s.descuento_usd>0&&e.jsxs("span",{style:{color:"var(--success, #16a34a)",fontWeight:700},children:[" · −$",s.descuento_usd.toFixed(2)]})]}),e.jsx("button",{disabled:b,onClick:F,style:{flex:"none",background:"transparent",border:"1px solid var(--border, #e2e8f0)",borderRadius:9,padding:"7px 12px",fontSize:12.5,fontWeight:700,color:"var(--text-secondary)",cursor:"pointer",fontFamily:"inherit"}
1,children:"Quitar"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{fontSize:12.5,fontWeight:700,color:"var(--text-secondary)",marginBottom:7},children:"¿Tienes un código promocional?"}),e.jsxs("div",{style:{display:"flex",gap:7},children:[e.jsx("input",{value:h,onChange:m=>{o(m.target.value.toUpperCase().slice(0,24)),n("")},onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),j())},placeholder:"Escribe tu código","aria-label":"Código promocional para tu próxima renovación",className:"caja-cupon-input",style:{flex:1,minWidth:0,padding:"9px 11px",borderRadius:10,border:"1px solid var(--border, #e2e8f0)",fontSize:13,fontFamily:"inherit",textTransform:"uppercase",background:"var(--bg-card, #fff)",color:"var(--text-primary)"}}),e.jsx("button",{onClick:j,style:{flex:"none",padding:"9px 15px",borderRadius:10,border:0,background:"var(--accent-blue, #5B6CF9)",color:"#fff",fontSize:12.5,fontWeight:800,cursor:b?"default":"pointer",fontFamily:"inherit"},children:b?"…":"Aplicar"})]}),e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginTop:6,lineHeight:1.4},children:"Se aplica solo en tu próximo cobro."}),e.jsx("style",{children:".caja-cupon-input::placeholder{text-transform:none}"}),!!S&&e.jsx("div",{role:"alert",style:{fontSize:12,color:"var(--danger, #dc2626)",marginTop:6},children:S})]}),!!s&&!!S&&e.jsx("div",{role:"alert",style:{fontSize:12,color:"var(--danger, #dc2626)",marginTop:6},children:S})]})}function we({platform:r,size:s=28}){return r==="meta"?e.jsx(X,{size:s}):r==="tiktok"?e.jsx(Q,{size:s}):r==="shopify"?e.jsx(be,{size:s}):r==="mastershop"?e.jsx(ne,{size:s}):r==="envios99"?e.jsx(ie,{size:s}):r==="wabot"?e.jsx("span",{style:{fontSize:Math.round(s*.9),lineHeight:1},children:"🤖"}):r==="academia"?e.jsx("span",{style:{fontSize:Math.round(s*.9),lineHeight:1},children:"🎓"}):r==="landing"?e.jsx("img",{src:"/logos/iconoF.png",alt:"",width:s,height:s,style:{objectFit:"contain",borderRadius:Math.round(s*.16)}}):e.jsx(ve,{size:s})}function Te(r){return new Intl.NumberFormat("es-CO",{style:"currency",currency:"COP",maximumFractionDigits:0}).format(r)}function $e(){const r=J(),{user:s}=fe(),i=he(),{limits:h}=ye(),[o,S]=l.useState(null),[n,b]=l.useState(null),[T,v]=l.useState(!0),[j,F]=l.useState(!1),[m,f]=l.useState(""),[y,A]=l.useState(!1),[k,I]=l.useState(null),[E,U]=l.useState(null);l.useEffect(()=>{const a=new URLSearchParams(window.location.search).get("pago");if(a){U(a);const c=new URL(window.location.href);c.searchParams.delete("pago"),window.history.replaceState({},"",c.toString())}},[]);const _=()=>{r("/api/billing/status").then(a=>a.json()).then(a=>{a&&S(a)}).catch(()=>{})},C=async()=>{A(!0),I(null);try{const a=await r("/api/plan/cancel",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:m.trim()||void 0})});if(!a.ok){const c=await a.json().catch(()=>({}));throw new Error(c.message||c.error||"No se pudo cancelar")}F(!1),f(""),_()}catch(a){I(a.message||"Error desconocido")}finally{A(!1)}},N=async()=>{A(!0);try{(await r("/api/plan/reactivate",{method:"POST"})).ok&&_()}catch{}finally{A(!1)}};l.useEffect(()=>{Promise.all([r("/api/billing/status").then(a=>a.json()).catch(()=>null),r("/api/plan/config").then(a=>a.json()).catch(()=>null),r("/api/referrals/me").then(a=>a.json()).catch(()=>null)]).then(([a,c,W])=>{a&&S(a),c!=null&&c.config&&b(c.config),W&&typeof W.availableUSD=="number"&&t(W.availableUSD)}).finally(()=>v(!1))},[r]);const q=()=>{const a=document.getElementById("packs-section");a&&a.scrollIntoView({behavior:"smooth",block:"start"})},B=(a,c=1)=>{window.location.href=`/plan/pack/${a}${c===3?"?meses=3":""}`},[g,K]=l.useState({meta:{on:!1,extras:0},tiktok:{on:!1,extras:0},shopify:{on:!1,extras:0},dropi:!1,mastershop:!1,envios99:!1,academia:!1,landing:!1}),[$,H]=l.useState(!1),[M,t]=l.useState(0),[p,u]=l.useState(!0),d=5,x=3,w=10,le=10,[Re,de]=l.useState({rate:4e3});l.useEffect(()=>{r("/api/plan/calculate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:"max"})}).then(a=>a.json()).then(a=>{a!=null&&a.rate&&de({rate:a.rate,date:a.rateDate})}).catch(()=>{})},[r]);const O=(()=>{const a=[];if(g.meta.on){const c=1+g.meta.extras,W=d+g.meta.extras*x;a.push({key:"meta",label:`Meta Ads · ${c} cuenta${c!==1?"s":""}`,sublabel:g.meta.extras>0?`1 incluida + ${g.meta.extras} adicional${g.meta.extras!==1?"es":""} ($${x} c/u)`:void 0,usd:W,color:"#0866FF"})}if(g.tiktok.on){const c=1+g.tiktok.extras,W=d+g.tiktok.extras*x;a.push({key:"tiktok",label:`TikTok Ads · ${c} cuenta${c!==1?"s":""}`,sublabel:g.tiktok.extras>0?`1 incluida + ${g.tiktok.extras} adicional${g.tiktok.extras!==1?"es":""} ($${x} c/u)`:void 0,usd:W,color:"#FE2C55"})}if(g.shopify.on){const c=1+g.shopify.extras,W=d+g.shopify.extras*x;a.push({key:"shopify",label:`Shopify · ${c} tienda${c!==1?"s":""}`,sublabel:g.shopify.extras>0?`1 incluida + ${g.shopify.extras} adicional${g.shopify.extras!==1?"es":""} ($${x} c/u)`:void 0,usd:W,color:"#5A8F3D"})}return g.dropi&&a.push({key:"dropi",label:"Dropi",usd:d,color:"#F1701A"}),g.mastershop&&a.push({key:"mastershop",label:"Mastershop",usd:d,color:"#A6F23B"}),g.envios99&&a.push({key:"envios99",label:"99envíos",usd:d,color:"#FF5500"}),g.academia&&a.push({key:"academia",label:"🎓 Academia Lumy",usd:w,color:"#A855F7"}),g.landing&&a.push({key:"landing",label:"Landing (página de ventas)",usd:le,color:"#0E9F6E"}),a})().reduce((a,c)=>a+c.usd,0),ce=async()=>
1{if(!(O<5)){H(!0);try{const a={plan:"modular",meta:g.meta.on,tiktok:g.tiktok.on,shopify:g.shopify.on,dropi:g.dropi,mastershop:g.mastershop,envios99:g.envios99,wabot:!0,academia:g.academia,landing:g.landing,metaExtraAccounts:g.meta.extras,tiktokExtraAccounts:g.tiktok.extras,shopifyExtraStores:g.shopify.extras,useCredit:p&&M>0},c=await r("/api/plan/checkout-custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then(W=>W.json());c.ok&&c.checkout_url?window.location.href=c.checkout_url:alert(c.message||c.error||"No se pudo crear el link de pago.")}catch(a){alert((a==null?void 0:a.message)||"Error de red")}finally{H(!1)}}},R=o==null?void 0:o.is_expired,L=!!(o!=null&&o.never_activated),V=(o==null?void 0:o.days_left)||0,D=o!=null&&o.is_admin?"#94A3B8":L?"#6366F1":R?"#EF4444":V<=7?"#F59E0B":"#10B981",pe=o!=null&&o.is_admin?"Cuenta admin":L?"Sin plan":R?"Vencido":V<=7?"Próximo a vencer":"Activo",ue=!!(n&&n.wabot),Z=a=>n?a==="wabot"?ue:!!n[a]:!1,ee=ae.filter(a=>Z(a.key));ae.filter(a=>!Z(a.key));const ge=a=>n?a==="meta"?n.metaExtraAccounts:a==="tiktok"?n.tiktokExtraAccounts:a==="shopify"?n.shopifyExtraStores:0:0;return e.jsxs("div",{style:{paddingBottom:i&&O>0?90:0},children:[E&&(()=>{const a=E==="aprobado",c=E==="pendiente",W=a?"rgba(16,185,129,0.12)":c?"rgba(245,158,11,0.12)":"rgba(239,68,68,0.12)",xe=a?"rgba(16,185,129,0.4)":c?"rgba(245,158,11,0.4)":"rgba(239,68,68,0.4)",te=a?"#10B981":c?"#F59E0B":"#EF4444",me=a?"Pago aprobado. Tu plan quedó activo.":c?"Tu pago está en proceso. Apenas el banco lo confirme, tu plan se activa.":"El pago no se completó. No se activó nada y no se te cobró. Puedes intentar de nuevo.";return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,background:W,border:`1px solid ${xe}`,color:te,borderRadius:12,padding:"13px 16px",marginBottom:14,fontSize:13.5,fontWeight:600},children:[e.jsx("span",{children:me}),e.jsx("button",{type:"button",onClick:()=>U(null),"aria-label":"Cerrar",style:{background:"transparent",border:0,color:te,fontSize:18,cursor:"pointer",lineHeight:1},children:"×"})]})})(),e.jsxs("div",{style:{background:"linear-gradient(135deg, #6366F1 0%, #A855F7 50%, #F97316 100%)",borderRadius:14,padding:i?"14px 16px":"20px 24px",color:"#fff",display:"flex",alignItems:"center",gap:i?12:16,marginBottom:i?14:18},children:[e.jsx("div",{style:{width:i?38:48,height:i?38:48,borderRadius:10,background:"rgba(255,255,255,0.18)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsxs("svg",{width:i?20:26,height:i?20:26,viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",ry:"2"}),e.jsx("line",{x1:"2",y1:"10",x2:"22",y2:"10"})]})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:800,fontSize:i?16:18,letterSpacing:"-0.01em"},children:"Facturación"}),e.jsx("div",{style:{fontSize:i?12:13,opacity:.92,marginTop:2},children:"Tu plan, días restantes y pagos anteriores"})]})]}),T&&e.jsx("div",{style:{padding:24,textAlign:"center",color:"var(--text-muted)"},children:"Cargando…"}),!T&&o&&e.jsxs(e.Fragment,{children:[o.plan==="trial"&&(n==null?void 0:n.pack)!=="pro"&&!n&&e.jsxs("div",{style:{background:"linear-gradient(135deg, rgba(168,85,247,0.10), rgba(99,102,241,0.10))",border:"1.5px solid rgba(168,85,247,0.40)",borderRadius:14,padding:"16px 18px",marginBottom:14,display:"flex",alignItems:"center",gap:12,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:30,flexShrink:0},children:"🎁"}),e.jsxs("div",{style:{flex:1,minWidth:220},children:[e.jsx("div",{style:{fontSize:14,fontWeight:800,color:"var(--text-primary)",marginBottom:3},children:"+15 días extra de regalo"}),e.jsx("div",{style:{fontSize:12.5,color:"var(--text-secondary)",lineHeight:1.5},children:"Si activas Pack Pro en tu periodo de cortesía."})]}),e.jsx("a",{href:"/plan/pack/pro",style:{padding:"10px 18px",fontSize:13,fontWeight:700,fontFamily:"inherit",background:"linear-gradient(135deg, #6366F1, #A855F7)",color:"#fff",borderRadius:10,textDecoration:"none",boxShadow:"0 4px 12px rgba(168,85,247,0.30)",whiteSpace:"nowrap"},children:"Ver Pack Pro →"})]}),h.inCourtesyPeriod&&h.courtesyEndsAt&&e.jsxs("div",{style:{background:"linear-gradient(135deg, rgba(168,85,247,0.10), rgba(99,102,241,0.10))",border:"1px solid rgba(168,85,247,0.30)",borderRadius:12,padding:"14px 16px",marginBottom:14,display:"flex",alignItems:"flex-start",ga
1p:10},children:[e.jsx("span",{style:{fontSize:22,lineHeight:1,flexShrink:0},children:"🎁"}),e.jsxs("div",{style:{flex:1,fontSize:13,lineHeight:1.6,color:"var(--text-primary)"},children:["Acceso completo hasta el ",e.jsx("b",{children:new Date(h.courtesyEndsAt).toLocaleDateString("es-CO",{day:"numeric",month:"long"})})," (acceso de cortesía).",h.nextDueAt&&e.jsxs(e.Fragment,{children:[" ","Tu plan de 30 días arranca después → próximo cobro ",e.jsx("b",{children:new Date(h.nextDueAt).toLocaleDateString("es-CO",{day:"numeric",month:"long"})}),"."]})]})]}),e.jsxs("div",{style:{background:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:14,padding:i?16:24,marginBottom:18},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",flexWrap:"wrap",gap:i?10:16,marginBottom:n?i?14:20:0},children:[e.jsxs("div",{style:{flex:1,minWidth:i?"100%":240},children:[e.jsx("div",{style:{fontSize:10.5,fontWeight:700,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:6},children:"Tu plan actual"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:i?19:26,fontWeight:800,color:"var(--text-primary)",lineHeight:1.15},children:o.is_admin?"Admin":o.plan==="trial"?"Acceso de cortesía":L||R?"Sin plan activo":n&&n.monthlyPriceUSD>=50?"Plan Max — Ilimitado":n?"Plan modular":"Sin plan activo"}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,padding:"3px 8px",borderRadius:999,background:`${D}15`,border:`1px solid ${D}40`,fontSize:10.5,fontWeight:700,color:D},children:[e.jsx("span",{style:{width:5,height:5,borderRadius:"50%",background:D}}),pe]})]}),e.jsx("div",{style:{fontSize:i?12:13,color:"var(--text-muted)"},children:n&&!L&&!R?e.jsxs(e.Fragment,{children:["$",n.monthlyPriceUSD.toFixed(2)," USD ",e.jsxs("span",{style:{opacity:.7},children:["≈ ",Te(n.monthlyPriceCOP)]})," / mes"]}):o.plan==="trial"?"Sin costo · cortesía":"—"})]}),e.jsxs("div",{style:{textAlign:i?"left":"right",width:i?"100%":"auto"},children:[e.jsx("div",{style:{fontSize:10.5,fontWeight:700,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:4},children:o.is_admin?"Vence":R?"Venció el":o.plan==="trial"?"Termina tu cortesía":"Próximo cobro"}),o.is_admin?e.jsx("div",{style:{fontSize:i?16:22,fontWeight:800,color:"var(--text-primary)"},children:"Sin vencimiento"}):R?e.jsx("div",{style:{fontSize:i?16:22,fontWeight:800,color:"#EF4444"},children:o.plan_active_until?new Date(o.plan_active_until).toLocaleDateString("es-CO",{day:"numeric",month:"short",year:"numeric"}):"—"}):L?e.jsx("div",{style:{fontSize:i?16:22,fontWeight:800,color:D},children:"—"}):e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:i?8:4,flexDirection:i?"row":"column",flexWrap:"wrap"},children:[e.jsxs("div",{style:{fontSize:i?22:32,fontWeight:800,color:D,lineHeight:1},children:[V," ",V===1?"día":"días"]}),e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)"},children:o.plan_active_until?new Date(o.plan_active_until).toLocaleDateString("es-CO",{day:"numeric",month:"long",year:"numeric"}):""}),n&&o.plan!=="trial"&&e.jsxs("div",{style:{fontSize:12,fontWeight:700,color:D,marginTop:4},children:["$",n.monthlyPriceUSD.toFixed(2)," USD"]})]})]})]}),n&&ee.length>0&&!L&&!R&&e.jsxs("div",{"data-guia":"facturacion.modulos",style:{borderTop:"1px solid var(--border)",paddingTop:i?12:16},children:[e.jsx("div",{style:{fontSize:10.5,fontWeight:700,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:8},children:"Incluido en tu plan"}),e.jsx("div",{style:{display:"flex",flexWrap:i?"nowrap":"wrap",gap:i?6:10,overflowX:i?"auto":"visible",paddingBottom:i?4:0,WebkitOverflowScrolling:"touch"},children:ee.map(a=>{const c=ge(a.key);return e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:i?6:10,padding:i?"6px 10px":"10px 14px",borderRadius:i?999:12,background:`${a.color}10`,border:`1px solid ${a.color}40`,flexShrink:0},children:[e.jsx(we,{platform:a.key,size:i?16:22}),e.jsx("span",{style:{fontSize:i?12:13,fontWeight:700,color:"var(--text-primary)"},children:a.label}),c>0&&e.jsxs("span",{style:{fontSize:i?10:11,fontWeight:700,padding:"1px 6px",borderRadius:999,background:`${a.color}20`,color:a.color},children:["+",c]})]},a.key)})})]}),!o.is_admin&&o.cancelled_at&&!R&&e.jsxs("div",{style:{marginTop:16,padding:"14px 16px",background:"rgba(245,158,11,0.08)",border:"1px solid rgba(245,158,11,0.30)",borderRadius:12},children:[e.jsx("div",{style:{fontSize:13,fontWeight:700,color:"#B45309",marginBottom:4},children:"Tu plan está cancelado"}),e.jsxs("div",{style:{fontSize:12.5,color:"var(--text-secondary)",lineHeight:1.5,marginBottom:10},children:["Sigues con acceso hasta el"," ",e.jsx("b",{children:o.plan_active_until?new Date(o.plan_active_until).toLocaleDateString("es-CO",{day:"numeric",month:"long",year:"numeric"}):"—"}),". No se hará ningún cobro nuevo. Si cambias de opinión, puedes reactivar antes de esa fecha sin pagar de nuevo."]}),e.jsx("button",{onClick:N,disabled:y,style:{...Y,padding:"8px 16px",fontSize:13,background:"#B45309",opacity:y?.7:1},children:y?"Reactivando...":"Reactivar plan"})]}),!o.is_admin&&e.jsxs(e.Fragment,{children:[!!n&&e.jsx(Ce,{}),e.jsxs("div",{style:{marginTop:14,display:"flex",gap:10,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("button",{onClick:()=>
1{if(n!=null&&n.pack){window.location.href=`/plan/pack/${n.pack}`;return}const a=document.getElementById("packs-section");a?a.scrollIntoView({behavior:"smooth",block:"start"}):q()},style:Y,children:R?"Renovar mi plan →":n?"Agregar o cambiar plataformas →":"Activar un plan →"}),!R&&(n==null?void 0:n.pack)&&e.jsx("a",{"data-guia":"facturacion.tres_meses",href:`/plan/pack/${n.pack}?meses=3`,style:{fontSize:13,fontWeight:800,color:"#16A34A",textDecoration:"none",border:"1.5px solid rgba(22,163,74,.45)",borderRadius:11,padding:"9px 14px",whiteSpace:"nowrap"},children:"Pagar otros 3 meses"}),!R&&!o.cancelled_at&&n&&e.jsx("button",{"data-guia":"facturacion.cancelar",onClick:()=>F(!0),style:{background:"transparent",border:"none",color:"var(--text-muted)",fontSize:12.5,fontWeight:600,cursor:"pointer",textDecoration:"underline",textUnderlineOffset:3,padding:"8px 4px"},children:"Cancelar plan"})]})]})]}),j&&e.jsx("div",{onClick:()=>!y&&F(!1),style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:16},children:e.jsxs("div",{onClick:a=>a.stopPropagation(),style:{background:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:16,padding:28,maxWidth:460,width:"100%",boxShadow:"0 20px 60px rgba(0,0,0,0.30)"},children:[e.jsx("div",{style:{fontSize:18,fontWeight:800,color:"var(--text-primary)",marginBottom:8},children:"¿Cancelar tu plan?"}),e.jsxs("div",{style:{fontSize:13.5,color:"var(--text-secondary)",lineHeight:1.6,marginBottom:16},children:["Vas a seguir con acceso hasta el"," ",e.jsx("b",{children:o.plan_active_until?new Date(o.plan_active_until).toLocaleDateString("es-CO",{day:"numeric",month:"long",year:"numeric"}):"—"}),". Después no se hará ningún cobro nuevo. Antes de esa fecha puedes reactivar sin pagar otra vez."]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("label",{style:{fontSize:11.5,fontWeight:700,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.06em",display:"block",marginBottom:6},children:"¿Por qué cancelas? (opcional)"}),e.jsx("textarea",{value:m,onChange:a=>f(a.target.value.slice(0,500)),placeholder:"Nos ayuda a mejorar...",rows:3,disabled:y,style:{width:"100%",padding:"10px 12px",background:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:10,fontSize:13,color:"var(--text-primary)",fontFamily:"inherit",resize:"vertical"}})]}),k&&e.jsx("div",{style:{fontSize:12.5,color:"#EF4444",marginBottom:12},children:k}),e.jsxs("div",{style:{display:"flex",gap:10,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>F(!1),disabled:y,style:{background:"transparent",border:"1px solid var(--border)",padding:"10px 18px",borderRadius:10,fontSize:13.5,fontWeight:700,color:"var(--text-primary)",cursor:y?"not-allowed":"pointer"},children:"Volver"}),e.jsx("button",{onClick:C,disabled:y,style:{background:"#EF4444",border:"none",padding:"10px 18px",borderRadius:10,fontSize:13.5,fontWeight:700,color:"#fff",cursor:y?"not-allowed":"pointer",opacity:y?.7:1},children:y?"Cancelando...":"Sí, cancelar plan"})]})]})}),!o.is_admin&&e.jsx(Fe,{}),o.is_admin&&e.jsxs("div",{style:{background:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:14,padding:20,marginBottom:18},children:[e.jsx("div",{style:{fontSize:15,fontWeight:700,color:"var(--text-primary)"},children:"Suscripción por Wompi"}),e.jsx("div",{style:{fontSize:12.5,color:"var(--text-muted)",marginTop:3,marginBottom:14},children:"Modo pruebas (sandbox). Elige un plan para abrir el checkout de suscripción con débito automático."}),e.jsx("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:[["starter","Starter · $15"],["pro","Pro · $29"],["plus","MAX · $50"]].map(([a,c])=>e.jsx("button",{type:"button",onClick:()=>B(a),style:{fontSize:14,fontWeight:700,color:"#fff",background:"linear-gradient(135deg, #6366F1, #8B5CF6)",border:0,borderRadius:11,padding:"11px 18px",cursor:"pointer"},children:c},a))}),e.jsx(Ee,{})]}),!o.is_admin&&e.jsxs("div",{id:"packs-section",style:{background:"linear-gradient(135deg, rgba(99,102,241,0.06), rgba(34,197,94,0.06))",border:"1px solid rgba(99,102,241,0.30)",borderRadius:14,padding:24,marginBottom:18,scrollMarginTop:80},children:[e.jsx(je,{onSelect:B}),!1]}),e.jsx("div",{id:"servicios-section","data-guia":"facturacion.extras",style:{background:"linear-gradient(135deg, rgba(168,85,247,0.05), rgba(34,197,94,0.05))",border:"1px solid rgba(168,85,247,0.24)",borderRadius:14,padding:"10px 24px 26px",marginBottom:18,scrollMarginTop:80},children:!o.is_admin&&!R&&(n!=null&&n.pack)?e.jsx(Ae,{esMax:o.plan==="max",onCambio:()=>_()}):e.jsx(se,{esMax:o.plan==="max"})}),!1,e.jsx("div",{style:{marginTop:18,fontSize:12,color:"var(--text-muted)",lineHeight:1.6},children:e.jsxs("p",{style:{margin:0},children:["Pagos procesados por Bold. No guardamos datos de tu tarjeta."," ","Si tienes problemas con un pago, escríbenos a "," ",e.jsx("a",{href:`mailto:[email protected]?subject=Soporte%20Facturación%20-%20${s==null?void 0:s.email}`,style:{color:"#A855F7"},children:"[email protected]"}),"."]})})]}),i&&O>0&&(()=>{const a=p&&M>0?Math.min(M,Math.max(0,O-1)):0,c=Math.max(1,O-a);return e.jsx("div",{style:{position:"fixed",bottom:0,left:0,right:0,background:"var(--bg-card)",borderTop:"1px solid var(--border)",padding:"10px 14px calc(10px + env(safe-area-inset-bottom, 0px))",zIndex:50,boxShadow:"0 -4px 20px rgba(0,0,0,0.12)"},children:e.jsx("button",{onClick:ce,disabled:$,style:{width:"100%",padding:"14px",background:"linear-gradient(135deg, #6366F1 0%, #A855F7 100%)",color:"#fff",border:"none",borderRadius:12,fontSize:15,fontWeight:700,cursor:$?"wait":"pointer",fontFamily:"inherit",boxShadow:"0 4px 14px rgba(168,85,247,0.40)"},children:$?"Procesando…":`✓ Pagar $${c.toFixed(2)} con Bold`})})})()]})}function re(r){return String(r??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,24)}const z="#6366F1",G="#16A34A";function P({plataforma:r,size:s=20}){return r==="meta"?e.jsx(X,{size:s}):r==="tiktok"?e.jsx(Q,{size:s}):r==="dropi"?e.jsx(ke,{size:s}):r==="mastershop"?e.jsx(ne,{size:s}):r==="envios99"?e.jsx(ie,{size:s}):r==="shopify"?e.jsx(Se,{size:s}):e.jsx("img",{src:"/logos/iconoF.png",alt:"Lumy",width:s,height:s,style:{borderRadius:6,objectFit:"contain"}})}function ze({k:r,opcion:s}){const i={width:44,height:44,borderRadius:12,flexShrink:0,background:z+"10",border:"1px solid "+z+"26",display:"flex",alignItems:"center",justifyContent:"center",gap:4};let h;return r==="ad_account"?h=s?e.jsx(P,{plataforma:s,size:22}):e.jsxs(e.Fragment,{children:[e.jsx(X,{size:17}),e.jsx(Q,{size:16})]}):r==="ads_platform"?h=e.jsx(P,{plataforma:s||"tiktok",size:22}):r==="logistics"?h=e.jsx(P,{plataforma:s||"dropi",size:22}
1):r==="dropi_account"?h=e.jsx(P,{plataforma:"dropi",size:22}):r==="shopify_store"?h=e.jsx(P,{plataforma:"shopify",size:21}):h=e.jsx(P,{plataforma:"lumy",size:22}),e.jsx("span",{style:i,"data-extra-icon":r,"data-extra-opcion":s||"",children:h})}function oe({rotulo:r,nota:s,titulo:i,linea:h}){return e.jsxs("div",{style:{margin:"0 0 16px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:10,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:11.5,fontWeight:800,letterSpacing:".09em",textTransform:"uppercase",color:z,whiteSpace:"nowrap"},children:r}),e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:s}),e.jsx("span",{"aria-hidden":!0,style:{flex:1,height:1,background:"var(--border)"}})]}),e.jsx("h4",{style:{fontSize:19,fontWeight:800,color:"var(--text-primary)",margin:"0 0 4px",letterSpacing:"-.02em",textAlign:"center"},children:i}),e.jsx("p",{style:{fontSize:13.5,color:"var(--text-secondary)",lineHeight:1.5,margin:"0 auto",maxWidth:640,textAlign:"center"},children:h})]})}function Ae({esMax:r,onCambio:s}){return e.jsxs("section",{id:"mas-para-tu-plan",style:{marginTop:24,scrollMarginTop:80,maxWidth:1180,marginLeft:"auto",marginRight:"auto"},children:[e.jsxs("div",{style:{textAlign:"center",maxWidth:640,margin:"0 auto 26px"},children:[e.jsx("div",{style:{display:"inline-block",fontSize:11.5,fontWeight:800,letterSpacing:".09em",textTransform:"uppercase",color:z,background:z+"14",border:"1px solid "+z+"2e",borderRadius:999,padding:"5px 13px",marginBottom:11},children:"Extras y servicios"}),e.jsx("h3",{style:{fontSize:22,fontWeight:800,color:"var(--text-primary)",margin:"0 0 8px",letterSpacing:"-.02em"},children:"Más para tu operación"}),e.jsx("p",{style:{fontSize:14.5,color:"var(--text-secondary)",lineHeight:1.55,margin:0},children:r?"Tu plan MAX ya incluye todo lo que hacemos por ti. Escríbenos cuando quieras usarlo.":"Lo que le falta a tu plan y lo que hacemos por ti. Los extras se suman a tu mensualidad; los servicios se pagan una sola vez."})]}),!r&&e.jsxs("div",{style:{marginBottom:34},children:[e.jsx(oe,{rotulo:"Extras",nota:"Se suman a tu mensualidad",titulo:"Ajusta tu plan sin cambiarlo",linea:"Hoy pagas solo lo que queda del mes. Desde la próxima renovación va dentro de tu mensualidad."}),e.jsx(We,{onCambio:s,sinCabecera:!0})]}),e.jsxs("div",{children:[e.jsx(oe,{rotulo:"Lo hacemos por ti",nota:r?"Incluido en tu plan":"Pago único, no suscripción",titulo:r?"Esto ya viene con tu plan":"¿Necesitas ayuda para arrancar?",linea:r?"Tu plan MAX incluye todo lo que hacemos por ti. Escríbenos cuando quieras usarlo.":"Lo montamos nosotros mientras tú te dedicas a vender. Cuesta menos según el plan que tengas."}),e.jsx(se,{esMax:r,sinCabecera:!0})]})]})}function We({onCambio:r,sinCabecera:s=!1}){const i=J(),[h,o]=l.useState(null),[S,n]=l.useState({}),[b,T]=l.useState(""),[v,j]=l.useState(null),[F,m]=l.useState({}),[f,y]=l.useState({}),[A,k]=l.useState({}),[I,E]=l.useState({}),[U,_]=l.useState({}),C=l.useRef({}),N=async()=>{try{const p=await(await i("/api/billing/extras")).json();p!=null&&p.ok&&o(p)}catch{}};if(l.useEffect(()=>{N()},[]),!h||!h.plan_activo)return null;const q=h.items.filter(t=>t.aplica);if(!q.length)return null;const B=t=>{var p,u;return S[t.key]||((u=(p=t.opciones)==null?void 0:p[0])==null?void 0:u.valor)||""},g=async t=>{const p=(f[t.key]||"").trim();
1if(!p){C.current[t.key]=(C.current[t.key]||0)+1,k(d=>({...d,[t.key]:null})),_(d=>({...d,[t.key]:!1})),E(d=>({...d,[t.key]:"Escribe tu código para aplicarlo."}));return}const u=C.current[t.key]=(C.current[t.key]||0)+1;_(d=>({...d,[t.key]:!0})),E(d=>({...d,[t.key]:""})),j(null);try{const d=await i("/api/billing/extras/cupon",{method:"POST",body:JSON.stringify({extra:t.key,codigo:p})}),x=await d.json().catch(()=>null);if(u!==C.current[t.key])return;if(!d.ok||!(x!=null&&x.ok)){k(w=>({...w,[t.key]:null})),E(w=>({...w,[t.key]:(x==null?void 0:x.mensaje)||(x==null?void 0:x.message)||"Ese código no sirve para este extra."}));return}k(w=>({...w,[t.key]:{descuento_usd:x.descuento_usd,total_usd:x.total_usd,antes_usd:x.antes_usd}}))}catch{u===C.current[t.key]&&E(d=>({...d,[t.key]:"Sin conexión. Intenta de nuevo."}))}finally{u===C.current[t.key]&&_(d=>({...d,[t.key]:!1}))}},K=t=>{C.current[t.key]=(C.current[t.key]||0)+1,y(p=>({...p,[t.key]:""})),k(p=>({...p,[t.key]:null})),E(p=>({...p,[t.key]:""})),m(p=>({...p,[t.key]:!1})),_(p=>({...p,[t.key]:!1}))},$=(t,p)=>re(t)===re(p),H=t=>{if(t)for(const p of h.items)$(f[p.key]||"",t)&&(C.current[p.key]=(C.current[p.key]||0)+1,y(u=>({...u,[p.key]:""})),k(u=>({...u,[p.key]:null})),E(u=>({...u,[p.key]:""})),m(u=>({...u,[p.key]:!1})),_(u=>({...u,[p.key]:!1})))},M=async t=>{T(t.key),j(null);try{const p=await i("/api/billing/extras/comprar",{method:"POST",body:JSON.stringify({extra:t.key,opcion:B(t),codigo:(f[t.key]||"").trim()||void 0})}),u=await p.json().catch(()=>null);if(!p.ok||!(u!=null&&u.ok)){if((u==null?void 0:u.error)==="cupon_invalido"){C.current[t.ke
1y]=(C.current[t.key]||0)+1,_(x=>({...x,[t.key]:!1})),k(x=>({...x,[t.key]:null})),m(x=>({...x,[t.key]:!0})),E(x=>({...x,[t.key]:`${(u==null?void 0:u.message)||"Ese código no sirve."} Quítalo para seguir sin él.`}));return}j({tipo:"err",texto:(u==null?void 0:u.message)||"No se pudo agregar el extra. Intenta de nuevo."});return}if(u.url){window.location.href=u.url;return}const d=Number(u.descuento_usd)||0;j({tipo:"ok",texto:u.activado?`Listo. ${t.nombre} ya está activo. Pagaste $${Number(u.pagado_usd).toFixed(2)} por lo que queda del mes${d>0?` (tu código te ahorró $${d.toFixed(2)})`:""}; desde la próxima renovación va en tu mensualidad.`:u.message||"El cobro quedó en proceso."}),H((f[t.key]||"").trim()),await N(),r()}catch{j({tipo:"err",texto:"Sin conexión. Intenta de nuevo."})}finally{T("")}};return e.jsxs("div",{id:"extras",style:{marginTop:s?0:26},children:[e.jsx("style",{children:`
2        .lumy-extras-grid{display:grid;grid-template-columns:1fr;gap:14px}
3        @media(min-width:760px){.lumy-extras-grid{grid-template-columns:repeat(2,1fr)}}
4        @media(min-width:1120px){.lumy-extras-grid{grid-template-columns:repeat(3,1fr)}}
5        .lumy-extra{transition:transform .16s ease,box-shadow .16s ease}
6        .lumy-extra:hover{transform:translateY(-2px);box-shadow:0 14px 30px -22px rgba(99,102,241,.55)}
7        @media(prefers-reduced-motion:reduce){.lumy-extra{transition:none}.lumy-extra:hover{transform:none}}
8      `}),!s&&e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",justifyContent:"space-between",gap:14,flexWrap:"wrap",marginBottom:14},children:[e.jsxs("div",{children:[e.jsx("div",{style:{display:"inline-block",fontSize:11.5,fontWeight:800,letterSpacing:".09em",textTransform:"uppercase",color:z,background:z+"14",border:"1px solid "+z+"2e",borderRadius:999,padding:"5px 13px",marginBottom:10},children:"Extras"}),e.jsx("h3",{style:{fontSize:20,fontWeight:800,color:"var(--text-primary)",margin:"0 0 4px",letterSpacing:"-.02em"},children:"Ajusta tu plan sin cambiarlo"}),e.jsx("p",{style:{fontSize:13.5,color:"var(--text-secondary)",lineHeight:1.5,margin:0,maxWidth:560},children:"Hoy pagas solo lo que queda del mes. Desde la próxima renovación va dentro de tu mensualidad."})]}),h.extras_usd_mes>0&&e.jsxs("div",{style:{fontSize:12.5,color:"var(--text-secondary)",background:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:999,padding:"7px 13px",whiteSpace:"nowrap"},children:["En extras: ",e.jsxs("b",{style:{color:"var(--text-primary)"},children:["$",h.extras_usd_mes,"/mes"]})]})]}),e.jsx("div",{className:"lumy-extras-grid",children:q.map(t=>{const p=b===t.key,u=Array.isArray(t.opciones)&&(t.opciones.length>1||t.key==="ad_account"&&t.opciones.length===1);return e.jsxs("div",{className:"lumy-extra","data-extra-card":t.key,style:{background:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:16,padding:"18px 18px 16px",display:"flex",flexDirection:"column",gap:12,position:"relative"},children:[t.tienes>0&&e.jsxs("span",{style:{position:"absolute",top:14,right:14,fontSize:11,fontWeight:800,letterSpacing:".03em",color:G,background:"rgba(22,163,74,.10)",border:"1px solid rgba(22,163,74,.28)",borderRadius:999,padding:"3px 9px"},children:["Tienes ",t.tienes]}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"flex-start"},children:[e.jsx(ze,{k:t.key,opcion:B(t)}),e.jsxs("div",{style:{minWidth:0,flex:1,paddingRight:t.tienes>0?64:0},children:[e.jsx("div",{style:{fontSize:15,fontWeight:800,color:"var(--text-primary)",lineHeight:1.3,letterSpacing:"-.01em"},children:t.nombre}),e.jsx("div",{style:{fontSize:12.5,color:"var(--text-secondary)",lineHeight:1.5,marginTop:4},children:t.explica})]})]}),u&&e.jsx("div",{role:"group","aria-label":"Cuál",style:{display:"flex",gap:6,flexWrap:"wrap"},children:t.opciones.map(d=>{const x=B(t)===d.valor;return e.jsxs("button",{type:"button",onClick:()=>n(w=>({...w,[t.key]:d.valor})),"aria-pressed":x,"data-extra-pastilla":d.valor,style:{font:"inherit",fontSize:12,fontWeight:700,cursor:"pointer",borderRadius:999,padding:"5px 11px 5px 7px",display:"inline-flex",alignItems:"center",gap:6,border:"1.5px solid "+(x?z:"var(--border)"),background:x?z+"12":"transparent",color:x?z:"var(--text-secondary)"},children:[e.jsx(P,{plataforma:d.valor,size:15}),d.valor==="dropi"?null:d.nombre]},d.valor)})}),e.jsxs("div",{style:{marginTop:"auto",display:"flex",alignItems:"flex-end",justifyContent:"space-between",gap:10},children:[e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:5},children:[e.jsxs("span",{style:{fontSize:26,fontWeight:800,color:z,letterSpacing:"-.02em",lineHeight:1},children:["$",t.precio_mes_usd]}),e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",fontWeight:600},children:"USD / mes"})]}),t.se_puede_comprar&&(A[t.key]?e.jsxs("div",{role:"status","aria-live":"polite",style:{fontSize:11.5,color:G,marginTop:3,fontWeight:700},children:["Hoy pagas ",e.jsxs("s",{style:{color:"var(--text-muted)",fontWeight:400}
8,children:["$",A[t.key].antes_usd.toFixed(2)]})," $",A[t.key].total_usd.toFixed(2)," con tu código"]}):t.hoy_usd<t.precio_mes_usd&&e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginTop:3},children:["Hoy pagas $",t.hoy_usd," por lo que queda del mes"]}))]}),t.se_puede_comprar?e.jsx("button",{type:"button",onClick:()=>M(t),disabled:!!b,style:{font:"inherit",fontSize:13.5,fontWeight:800,cursor:b?"default":"pointer",borderRadius:11,padding:"10px 16px",background:"transparent",color:z,border:"1.5px solid "+z,opacity:b&&!p?.55:1,whiteSpace:"nowrap"},children:p?"Cobrando…":"Agregar"}):e.jsx("span",{style:{fontSize:12,fontWeight:700,color:"var(--text-muted)"},children:t.tienes>0?"Ya lo tienes":"No disponible"})]}),t.se_puede_comprar&&(F[t.key]?e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[e.jsx("input",{value:f[t.key]||"",maxLength:24,placeholder:"Tu código","aria-label":`Código de descuento para ${t.nombre}`,onChange:d=>{const x=d.target.value.toUpperCase().slice(0,24);
8C.current[t.key]=(C.current[t.key]||0)+1,_(w=>({...w,[t.key]:!1})),y(w=>({...w,[t.key]:x})),k(w=>({...w,[t.key]:null})),E(w=>({...w,[t.key]:""}))},onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),g(t))},"data-cupon-extra":t.key,style:{flex:"1 1 120px",minWidth:0,font:"inherit",fontSize:12.5,fontFamily:"ui-monospace, monospace",padding:"7px 10px",borderRadius:9,border:"1px solid var(--border)",background:"var(--bg-card)",color:"var(--text-primary)"}}),e.jsx("button",{type:"button",onClick:()=>void g(t),"data-aplicar-cupon":t.key,style:{font:"inherit",fontSize:12.5,fontWeight:700,cursor:"pointer",borderRadius:9,padding:"7px 12px",background:"transparent",color:"var(--text-secondary)",border:"1px solid var(--border)",whiteSpace:"nowrap"},children:U[t.key]?"…":"Aplicar"}),e.jsx("button",{type:"button",onClick:()=>K(t),"data-quitar-cupon":t.key,"aria-label":`Quitar el código de ${t.nombre}`,style:{font:"inherit",fontSize:12.5,fontWeight:700,cursor:"pointer",borderRadius:9,padding:"7px 10px",background:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",whiteSpace:"nowrap"},children:"Quitar"})]}),!!I[t.key]&&e.jsx("div",{role:"alert",style:{fontSize:11.5,color:"#B45309",marginTop:5},children:I[t.key]}),!!A[t.key]&&e.jsxs("div",{role:"status","aria-live":"polite",style:{fontSize:11.5,color:G,marginTop:5,fontWeight:700},children:["Código aplicado: $",A[t.key].descuento_usd.toFixed(2)," menos hoy."]})]}):e.jsx("button",{type:"button",onClick:()=>m(d=>({...d,[t.key]:!0})),"data-abrir-cupon":t.key,style:{font:"inherit",fontSize:12,fontWeight:600,color:"var(--text-muted)",background:"none",border:0,padding:0,cursor:"pointer",textAlign:"left",textDecoration:"underline"},children:"¿Tienes un código?"}))]},t.key)})}),v&&e.jsx("div",{style:{marginTop:12,fontSize:12.5,lineHeight:1.5,borderRadius:10,padding:"10px 12px",color:v.tipo==="ok"?G:"#B45309",background:v.tipo==="ok"?"rgba(22,163,74,.10)":"rgba(245,158,11,.10)"},children:v.texto})]})}const Y={padding:"10px 20px",fontSize:13.5,fontWeight:700,fontFamily:"inherit",background:"linear-gradient(135deg, #6366F1 0%, #A855F7 100%)",color:"#fff",border:"none",borderRadius:10,cursor:"pointer",boxShadow:"0 4px 12px rgba(168,85,247,0.35)",whiteSpace:"nowrap"};function Fe(){const r=J(),[s,i]=l.useState(!0),[h,o]=l.useState(null),[S,n]=l.useState(""),[b,T]=l.useState(!1),[v,j]=l.useState(null),[F,m]=l.useState(!1);l.useEffect(()=>{r("/api/me/supported-community").then(y=>y.json()).then(y=>{y!=null&&y.community&&o(y.community)}).catch(()=>{}).finally(()=>i(!1))},[r]);const f=async()=>{j(null);const y=S.trim();if(y.length<3){j("El nombre debe tener al menos 3 caracteres");return}T(!0);try{const A=await r("/api/me/supported-community",{method:"POST",body:JSON.stringify({community:y})}),k=await A.json().catch(()=>({}));A.ok?(o(k.community),m(!0)):j((k==null?void 0:k.message)||(k==null?void 0:k.error)||"No se pudo guardar")}finally{T(!1)}};return s?null:h?e.jsxs("div",{style:{background:"linear-gradient(135deg, rgba(16,185,129,0.08), rgba(168,85,247,0.06))",border:"1px solid rgba(16,185,129,0.30)",borderRadius:12,padding:"12px 18px",marginBottom:14,display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{style:{fontSize:20},children:"💚"}),e.jsxs("div",{style:{fontSize:14,fontWeight:800,color:"var(--text-primary)"},children:["Apoyas a ",e.jsx("span",{style:{color:"#10B981"},children:h.displayName})]})]}):e.jsxs("div",{style:{background:"linear-gradient(135deg, rgba(168,85,247,0.06), rgba(99,102,241,0.06))",border:"1px dashed rgba(168,85,247,0.40)",borderRadius:12,padding:"16px 18px",marginBottom:14},children:[e.jsx("div",{style:{fontSize:12,fontWeight:700,color:"#A855F7",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:10},children:"💚 Apoya a tu comunidad favorita"}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsx("input",{value:S,onChange:y=>{n(y.target.value),j(null)},placeholder:"Nombre de la comunidad",style:{flex:1,minWidth:200,padding:"10px 12px",fontSize:13,background:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:8,color:"var(--text-primary)",fontFamily:"inherit"}}),e.jsx("button",{onClick:f,disabled:b||S.trim().length<3,style:{...Y,opacity:b||S.trim().length<3?.55:1},children:b?"Guardando…":"Guardar"})]}),v&&e.jsx("div",{style:{marginTop:8,fontSize:12.5,color:"#EF4444"},children:v}),F&&e.jsx("div",{style:{marginTop:8,fontSize:12.5,color:"#10B981",fontWeight:700},children:"✓ Listo"})]})}function Ee(){const[r,s]=l.useState(null),[i,h]=l.useState(!1),[o,S]=l.useState(""),[n,b]=l.useState(""),T=async v=>{S(v?"real":"sandbox"),b(""),s(null);try{const j=v?"/api/billing/wompi/admin/generate-link":"/api/billing/wompi/admin/test-link",F=v?JSON.stringify({packKey:"starter",starterAdsChoice:"meta",starterLogisticsChoice:"dropi"}):"{}",m=await fetch(j,{method:"POST",headers:{"Content-Type":"application/json"},body:F}).then(f=>f.json());m!=null&&m.ok&&m.url?(s(m.url),h(v)):b((m==null?void 0:m.error)||"no se pudo generar")}catch{b("error de red")}finally{S("")}};return e.jsxs("div",{style:{marginTop:14,borderTop:"1px solid var(--border)",paddingTop:14,display:"flex",flexDirection:"column",gap:10},children:[e.jsxs("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:[e.jsx("button",{type:"button",onClick:()=>T(!1),disabled:!!o,style:{fontSize:13,fontWeight:700,color:"var(--text-primary)",background:"var(--bg)",border:"1px solid var(--border)",borderRadius:10,padding:"9px 16px",cursor:o?"wait":"pointer"},children:o==="sandbox"?"Generando…":"Probar link (sandbox)"}),e.jsx("button",{type:"button",onClick:()=>T(!0),disabled:!!o,style:{fontSize:13,fontWeight:700,color:"#fff",background:"linear-gradient(135deg,#6366F1,#8B5CF6)",border:0,borderRadius:10,padding:"9px 16px",cursor:o?"wait":"pointer"},children:o==="real"?"Generando…":"Generar link REAL (Starter $15)"})]}),r&&e.jsxs("div",{style:{fontSize:12.5},children:[e.jsx("a",{href:r,target:"_blank",rel:"noreferrer",style:{color:"#6366F1",wordBreak:"break-all",fontWeight:600},children:r}),e.jsx("div",{style:{color:"var(--text-muted)",fontSize:11,marginTop:4},children:i?"Link REAL: ábrelo y págalo con tu tarjeta ($15, reembolsable). Al pagar, tu plan debe reflejarse solo en el panel (webhook).":"Sandbox: ábrelo, debe cargar el checkout de Wompi (prueba). Si carga, la API del link funciona."})]}),n&&e.jsx("div",{style:{fontSize:12,color:"#EF4444"},children:n})]})}export{$e as BillingTab,We as ExtrasDelPlan,re as normalizarCodigoLumy};

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.