PageSourceSearch

https://www.ecomdroptv.com/assets/PackWizard-C4H0jRDB.js

js ecomdroptv.com collected 2026-09-24 14:42:35 UTC 30,047 bytes, 1 lines download raw bytes

1import{j as e,I as te,u as oe,M as re,T as ae,D as ie,n as ne,m as se}from"./index-C6-4kgOT.js";import{r as a,f as le,e as ce,u as de}from"./vendor-react--UDKce57.js";import{n as pe,p as ue,a as ge,b as he}from"./Servicios-DBHiXgFB.js";const L="#6366F1",Z="#8B5CF6";function me({plan:t,choices:i,useCredit:f,creditUsd:c,cupon:b,onClose:w,onDone:R}){const h=f&&c&&c>0?Math.min(c,Math.max(0,t.priceUsd-5)):0,A=b&&Number(b.descuento_usd)||0,x=Math.round(Math.max(5,t.priceUsd-h-A)*100)/100,[u,N]=a.useState("card"),[T,d]=a.useState(!1),[M,S]=a.useState(!1),[q,v]=a.useState(!1),[z,k]=a.useState(""),[E,l]=a.useState(""),[y,I]=a.useState(""),[P,n]=a.useState(""),[g,$]=a.useState(""),[B,D]=a.useState(""),j=je(E),[_,V]=a.useState({disponible:!1,simulada:!1});a.useEffect(()=>{let r=!0;return fetch("/api/billing/bold/disponible").then(s=>s.json()).then(s=>{r&&(s!=null&&s.ok)&&V({disponible:!!s.disponible,simulada:!!s.simulada})}).catch(()=>{}),()=>{r=!1}},[]);async function Y(){var G;const r=await fetch("/api/billing/wompi/config").then(X=>X.json());if(!(r!=null&&r.ok)||!r.publicKey)throw new Error("Wompi no está configurado.");const s=r.sandbox?"https://sandbox.wompi.co/v1":"https://production.wompi.co/v1",m=y.replace(/\D/g,""),C=await fetch(`${s}/tokens/cards`,{method:"POST",headers:{Authorization:`Bearer ${r.publicKey}`,"Content-Type":"application/json"},body:JSON.stringify({number:E.replace(/\D/g,""),cvc:P.replace(/\D/g,""),exp_month:m.slice(0,2),exp_year:m.slice(2,4),card_holder:g.trim()||"Titular"})}).then(X=>X.json());if(!((G=C==null?void 0:C.data)!=null&&G.id))throw new Error("Revisa los datos de la tarjeta.");return C.data.id}async function Q(){const r=await fetch("/api/billing/wompi/nequi-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({phone:B.replace(/\D/g,"")})}).then(s=>s.json());if(!(r!=null&&r.ok)||!r.tokenId)throw new Error("No pudimos conectar con Nequi.");S(!0);for(let s=0;s<30;s++){await Se(3e3);const m=await fetch(`/api/billing/wompi/nequi-status/${encodeURIComponent(r.tokenId)}`).then(G=>G.json()),C=String((m==null?void 0:m.status)||"").toUpperCase();if(C==="APPROVED")return S(!1),r.tokenId;if(C==="DECLINED"||C==="ERROR")throw new Error("No se aprobó en Nequi.")}throw new Error("Se agotó el tiempo de espera en Nequi.")}const O={packKey:t.key,meses:t.meses===3?3:1,useCredit:!!f,cupon:(b==null?void 0:b.codigo)||void 0,starterAdsChoice:i.ads||void 0,starterLogisticsChoice:i.logistics||void 0,proLogisticsChoice:i.logistics||void 0};async function K(){k(""),d(!0);try{if(u==="bold"){const m=await fetch("/api/billing/bold/pay",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O)}).then(C=>C.json());if(!(m!=null&&m.ok)||!m.redirectUrl)throw new Error("No pudimos iniciar el pago con Bold. Intenta de nuevo.");window.location.href=m.redirectUrl;return}if(u==="bancolombia"){const m=await fetch("/api/billing/wompi/bancolombia-init",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(O)}).then(C=>C.json());if(!(m!=null&&m.ok)||!m.redirectUrl)throw new Error("No pudimos iniciar el pago con Bancolombia. Intenta de nuevo.");window.location.href=m.redirectUrl;return}const r=u==="card"?await Y():await Q(),s=await fetch("/api/billing/wompi/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...O,type:u==="card"?"CARD":"NEQUI",token:r})}).then(m=>m.json());if(!(s!=null&&s.ok)&&String((s==null?void 0:s.error)||"")==="cupon_invalido")throw new Error(`${String((s==null?void 0:s.message)||"Ese código ya no se puede usar.")} Quita el código y vuelve a intentar: se cobra el precio normal.`);if(!(s!=null&&s.ok))throw new Error(ke(s==null?void 0:s.error)+(s!=null&&s.detail?` (${String(s.detail).slice(0,160)})`:""));v(!0),setTimeout(R,1900)}catch(r){k(String((r==null?void 0:r.message)||"No pudimos completar el pago. Intenta de nuevo."))}finally{d(!1),S(!1)}}const p=E.replace(/\D/g,"").length>=15&&y.replace(/\D/g,"").length===4&&P.length>=3&&g.trim().length>1,W=B.replace(/\D/g,"").length===10,F=u==="card"?p:u==="nequi"?W:!0;return e.jsxs("div",{style:o.overlay,onClick:w,children:[e.jsxs("div",{style:o.modal,onClick:r=>r.stopPropagation(),children:[e.jsx("div",{style:o.topbar}),e.jsx("button",{type:"button",onClick:w,"aria-label":"Cerrar",style:o.close,children:"×"}),q?e.jsx("div",{style:o.pad,children:e.jsxs("div",{style:o.okwrap,children:[e.jsx("div",{style:o.okring,children:e.jsx("svg",{viewBox:"0 0 52 52",style:{width:34,he
1ight:34},children:e.jsx("path",{fill:"none",stroke:"#fff",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round",d:"M14 27l8 8 16-18",style:o.okpath})})}),e.jsxs("div",{style:o.okTitle,children:["Plan ",t.name," activo"]}),e.jsx("p",{style:o.okText,children:"Tu suscripción quedó activa y se renueva sola cada mes. Te avisamos por WhatsApp de cada cobro."})]})}):M?e.jsx("div",{style:o.pad,children:e.jsxs("div",{style:o.okwrap,children:[e.jsx("div",{style:o.spinner}),e.jsx("div",{style:o.okTitle,children:"Esperando tu aprobación"}),e.jsxs("p",{style:o.okText,children:["Abre tu app ",e.jsx("b",{style:{color:"var(--text-primary)"},children:"Nequi"})," y acepta el débito automático. Solo tienes que aceptar una vez."]})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:o.head,children:[e.jsx("div",{style:o.eyebrow,children:"Suscripción"}),e.jsxs("div",{style:o.planName,children:["Plan ",t.name]}),e.jsxs("div",{style:o.price,children:[e.jsxs("span",{style:o.priceBig,children:["$",t.priceUsd]}),e.jsx("span",{style:o.priceUnit,children:t.meses===3?" USD / 3 meses":" USD / mes"})]}),(h>0||A>0)&&e.jsxs("div",{style:o.creditLine,children:["Primer cobro ",e.jsxs("b",{style:{color:"var(--text-primary)"},children:["$",x]}),h>0?` · aplicas $${h.toFixed(2)} de crédito`:"",A>0?` · cupón ${(b==null?void 0:b.codigo)||""} −$${A.toFixed(2)}`:""]}),e.jsx("div",{style:o.headNote,children:u==="bancolombia"?"Pago del mes actual desde tu cuenta. Cancela cuando quieras.":u==="bold"?"Pago del mes actual. Cancela cuando quieras.":"Se cobra automático cada mes. Cancela cuando quieras."})]}),e.jsxs("div",{style:o.pad,children:[e.jsx("div",{style:o.methodRow,children:xe.filter(r=>r.key!=="bold"||_.disponible).map(r=>e.jsxs("button",{type:"button",onClick:()=>{N(r.key),k("")},style:{...o.methodBtn,...u===r.key?o.methodOn:{}},children:[e.jsx("img",{src:r.logo,alt:r.label,style:o.methodLogo}),e.jsx("span",{style:o.methodLabel,children:r.label})]},r.key))}),u==="card"&&e.jsxs("div",{style:o.form,children:[e.jsx(H,{label:"Número de tarjeta",children:e.jsxs("div",{style:{position:"relative"},children:[e.jsx("input",{style:o.input,inputMode:"numeric",placeholder:"0000 0000 0000 0000",value:E,onChange:r=>l(be(r.target.value))}),j&&e.jsx("img",{src:"/pay/visa-mastercard.jpg",alt:"",style:o.netLogo})]})}),e.jsxs("div",{style:o.two,children:[e.jsx(H,{label:"Vencimiento",children:e.jsx("input",{style:o.input,inputMode:"numeric",placeholder:"MM / AA",value:y,onChange:r=>I(ye(r.target.value))})}),e.jsx(H,{label:"CVC",children:e.jsx("input",{style:o.input,inputMode:"numeric",placeholder:"123",value:P,onChange:r=>n(r.target.value.replace(/\D/g,"").slice(0,4))})})]}),e.jsx(H,{label:"Nombre del titular",children:e.jsx("input",{style:o.input,placeholder:"Como aparece en la tarjeta",value:g,onChange:r=>$(r.target.value)})})]}),u==="nequi"&&e.jsxs("div",{style:o.form,children:[e.jsx(H,{label:"Número de celular Nequi",children:e.jsx("input",{style:o.input,inputMode:"numeric",placeholder:"300 000 0000",value:B,onChange:r=>D(ve(r.target.value))})}),e.jsxs("p",{style:o.hint,children:["Al pagar, te llega una notificación a tu app ",e.jsx("b",{style:{color:"var(--text-primary)"},children:"Nequi"})," para aprobar el débito automático."]})]}),u==="bold"&&e.jsxs("div",{style:o.form,children:[e.jsxs("p",{style:o.hint,children:["Te llevamos a la ventana segura de ",e.jsx("b",{style:{color:"var(--text-primary)"},children:"Bold"})," para pagar con tu tarjeta ",e.jsx("b",{style:{color:"var(--text-primary)"},children:"Visa o Mastercard de cualquier país"}),". Al volver, tu plan queda activo."]}),_.simulada&&e.jsx("p",{style:{...o.hint,fontSize:12,color:"var(--warning)"},children:"Modo local: el checkout es una simulación y no mueve plata."})]}),u==="bancolombia"&&e.jsx("div",{style:o.form,children:e.jsxs("p",{style:o.hint,children:["Te llevamos a la ventana segura de ",e.jsx("b",{style:{color:"var(--text-primary)"},children:"Bancolombia"})," para autorizar el pago de este mes desde tu cuenta. Al volver, tu plan queda activo."]})}),z&&e.jsx("div",{style:o.error,children:z}),e.jsx("button",{type:"button",style:{...o.pay,...F&&!T?{}:o.payOff},disabled:!F||T,onClick:K,children:T?u==="card"?"Cobrando…":"Conectando…":u==="bold"?`Continuar en Bold · $${x}`:u==="bancolombia"?`Continuar en Bancolombia · $${x}`:`Pagar $${x} y activar`}),e.jsxs("div",{style:o.trust,children:[e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{width:13,height:13,color:"#34d399"},children:[e.jsx("path",{d:"M12 2l7 3v6c0 5-3.5 8-7 9-3.5-1-7-4-7-9V5l7-3z"}),e.jsx("path",{d:"M9.2 12.2l2 2 3.6-4"})]}
1),"Pago seguro con Wompi. Tu tarjeta se cifra y no pasa por Lumy."]})]})]})]}),e.jsx("style",{children:fe})]})}function H({label:t,children:i}){return e.jsxs("div",{children:[e.jsx("label",{style:o.label,children:t}),i]})}const xe=[{key:"card",label:"Tarjeta",logo:"/pay/visa-mastercard.jpg"},{key:"nequi",label:"Nequi",logo:"/pay/nequi.jpg"},{key:"bancolombia",label:"Bancolombia",logo:"/pay/bancolombia.png"},{key:"bold",label:"Bold",logo:"/pay/bold.png"}],fe="@keyframes wc-in{from{opacity:0;transform:translateY(14px) scale(.98)}to{opacity:1;transform:none}}@keyframes wc-fade{from{opacity:0}to{opacity:1}}@keyframes wc-spin{to{transform:rotate(360deg)}}@keyframes wc-check{to{stroke-dashoffset:0}}@keyframes wc-pop{0%{transform:scale(.5);opacity:0}60%{transform:scale(1.08)}to{transform:scale(1);opacity:1}}",o={overlay:{position:"fixed",inset:0,background:"rgba(8,10,16,.62)",display:"flex",alignItems:"flex-start",justifyContent:"center",padding:"5vh 16px 24px",zIndex:4e3,overflowY:"auto",animation:"wc-fade .18s ease-out"},modal:{position:"relative",width:"100%",maxWidth:440,background:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:20,overflow:"hidden",boxShadow:"0 30px 80px -30px rgba(0,0,0,.6)",animation:"wc-in .28s cubic-bezier(.2,.8,.2,1)"},topbar:{height:4,width:"100%",background:`linear-gradient(90deg, ${L}, ${Z})`},close:{position:"absolute",top:16,right:16,width:30,height:30,borderRadius:999,border:0,background:"var(--bg)",color:"var(--text-muted)",fontSize:20,lineHeight:1,cursor:"pointer",zIndex:2},head:{textAlign:"center",padding:"26px 24px 22px",borderBottom:"1px solid var(--border)"},eyebrow:{fontSize:11.5,fontWeight:700,letterSpacing:".12em",textTransform:"uppercase",color:L},planName:{marginTop:6,fontSize:22,fontWeight:800,letterSpacing:"-.02em",color:"var(--text-primary)"},price:{marginTop:6,display:"flex",alignItems:"baseline",justifyContent:"center",gap:2},priceBig:{fontSize:34,fontWeight:800,letterSpacing:"-.03em",color:"var(--text-primary)"},priceUnit:{fontSize:14,color:"var(--text-muted)",fontWeight:500},creditLine:{marginTop:6,fontSize:12.5,color:"#10B981",fontWeight:600},headNote:{marginTop:8,fontSize:13,color:"var(--text-secondary)"},pad:{padding:24},methodRow:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:10},methodBtn:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"13px 6px",borderRadius:14,border:"1.5px solid var(--border)",background:"var(--bg)",cursor:"pointer",transition:"border-color .15s, transform .1s"},methodOn:{borderColor:L,background:"color-mix(in srgb, var(--brand, #6366F1) 8%, var(--bg-card))",boxShadow:`0 0 0 3px color-mix(in srgb, ${L} 16%, transparent)`},methodLogo:{height:22,width:"auto",maxWidth:52,objectFit:"contain",borderRadius:4},methodLabel:{fontSize:12.5,fontWeight:650,color:"var(--text-primary)"},form:{marginTop:20,display:"grid",gap:14},two:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:14},label:{display:"block",fontSize:11.5,fontWeight:650,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:".05em",marginBottom:7},input:{width:"100%",fontSize:16,color:"var(--text-primary)",background:"var(--bg)",border:"1px solid var(--border)",borderRadius:11,padding:"12px 14px",outline:"none",boxSizing:"border-box"},netLogo:{position:"absolute",right:12,top:"50%",transform:"translateY(-50%)",height:22,borderRadius:3},hint:{margin:0,fontSize:13.5,color:"var(--text-secondary)",textAlign:"center",lineHeight:1.55},error:{marginTop:16,fontSize:13,color:"#f87171",background:"rgba(248,113,113,.10)",border:"1px solid rgba(248,113,113,.30)",borderRadius:11,padding:"11px 13px",textAlign:"center"},pay:{marginTop:20,width:"100%",fontSize:15.5,fontWeight:750,color:"#fff",background:`linear-gradient(135deg, ${L}, ${Z})`,border:0,borderRadius:13,padding:"15px 20px",cursor:"pointer",letterSpacing:"-.01em",boxShadow:`0 14px 30px -14px ${L}`},payOff:{opacity:.5,cursor:"not-allowed",boxShadow:"none"},trust:{marginTop:14,display:"flex",alignItems:"center",justifyContent:"center",gap:7,fontSize:12,color:"var(--text-muted)",textAlign:"center"},okwrap:{textAlign:"center",padding:"20px 6px 12px"},okring:{width:62,height:62,margin:"0 auto 18px",borderRadius:"50%",background:"linear-gradient(135deg, #22c55e, #16a34a)",display:"grid",placeItems:"center",animation:"wc-pop .5s cubic-bezier(.2,.8,.2,1)"},okpath:{strokeDasharray:48,strokeDashoffset:48,animation:"wc-check .5s .25s ease-out forwards"},okTitle:{fontSize:20,fontWeight:800,letterSpacing:"-.02em",color:"var(--text-primary)"},okText:{margin:"10px auto 0",maxWidth:"32ch",fontSize:14,color:"var(--text-secondary)",lineHeight:1.55},spinner:{width:52,height:52,margin:"4px auto 18px",borderRadius:"50%",border:"4px solid var(--border)",borderTopColor:L,animation:"wc-spin .9s linear infinite"}};function be(t){return t.replace(/\D/g,"").slice(0,16).replace(/(.{4})/g,"$1 ").trim()}function ye(t){const i=t.replace(/\D/g,"").slice(0,4);return i.length>2?i.slice(0,2)+" / "+i.slice(2):i}function ve(t){return t.replace(/\D/g,"").slice(0,10).replace(/(\d{3})(\d{3})(\d{0,4})/,"$1 $2 $3").trim()}function je(t){const i=t.replace(/\D/g,"");return i[0]==="4"?"visa":i[0]==="5"||i[0]==="2"?"mc":i?"other":""}function Se(t){return new Promise(i=>setTimeout(i,t))}function ke(t){const i=String(t||"");
1if(/demasiados_intentos/.test(i))return"Hiciste varios intentos seguidos. Espera unos minutos antes de volver a probar: insistir ahora hace que tu banco bloquee la tarjeta.";if(/declined/.test(i)){try{const f=te().code;if(f&&f!=="CO")return"Tu banco no aprobó el pago. Suele pasar con tarjetas emitidas fuera de Colombia: no es un problema de tu tarjeta. Escríbenos por WhatsApp y te enviamos un enlace de pago que sí funciona desde tu país."}catch{}return"El pago fue rechazado. Revisa el método de pago."}return/acceptance|guardar/.test(i)?"No pudimos validar el método. Intenta de nuevo.":/elige/.test(i)?"Faltó una elección del plan. Vuelve y complétala.":i?`No se pudo completar el pago: ${i}`:"No pudimos completar el pago. Intenta de nuevo."}function Ce({packKey:t,meses:i,useCredit:f,aplicado:c,onCambio:b,onVerificando:w}){const[R,h]=a.useState(""),[A,x]=a.useState(""),[u,N]=a.useState(!1),T=a.useRef(b);T.current=b;const d=a.useRef(w);d.current=w;const M=`${t}|${i}|${f?1:0}`,S=a.useRef(M);S.current=M;const q=n=>`${n}|${M}`,v=a.useRef(""),z=a.useRef(0),k=a.useRef(!0);a.useEffect(()=>(k.current=!0,()=>{var n;k.current=!1,(n=d.current)==null||n.call(d,!1)}),[]);const E=a.useCallback(async n=>{const g=await fetch("/api/plan/cupon/revisar",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({codigo:n,packKey:t,meses:i,useCredit:f})}).then($=>$.json());return g!=null&&g.ok?{ok:!0,cupon:{codigo:String(g.codigo||n).toUpperCase(),descuento_usd:Number(g.descuento_usd)||0,total_usd:Number(g.total_usd)||0,etiqueta:String(g.etiqueta||"")}}:{ok:!1,mensaje:String((g==null?void 0:g.mensaje)||"No se pudo revisar el código.")}},[t,i,f]),l=a.useCallback(async(n,g)=>{var B,D;const $=++z.current;N(!0),(B=d.current)==null||B.call(d,!0);try{const j=await E(n);if(!k.current||$!==z.current||g!==`${n}|${S.current}`)return;j.ok&&j.cupon?(v.current=g,x(""),T.current(j.cupon)):(v.current="",h(n),x(j.mensaje||""),T.current(null))}catch{if(!k.current||$!==z.current)return;v.current="",h(n),x("No se pudo revisar el código. Intenta de nuevo."),T.current(null)}finally{k.current&&$===z.current&&(N(!1),(D=d.current)==null||D.call(d,!1))}},[E,t,i,f]),y=(c==null?void 0:c.codigo)||"";a.useEffect(()=>{var n;z.current++,N(!1),(n=d.current)==null||n.call(d,!1)},[t,i,f]),a.useEffect(()=>{if(!y)return;const n=q(y);v.current!==n&&l(y,n)},[y,t,i,f,l]);const I=()=>{const n=R.trim();if(!n){x("Escribe tu código para aplicarlo.");return}u||(x(""),l(n,q(n)))},P=()=>{var n;z.current++,v.current="",N(!1),(n=d.current)==null||n.call(d,!1),h(""),x(""),b(null)};return c?e.jsxs("div",{style:U.caja,role:"status","aria-live":"polite",children:[e.jsxs("div",{style:{flex:1,minWidth:170,fontSize:13,lineHeight:1.45,color:"var(--text-primary)"},children:[e.jsx("b",{style:{fontFamily:"ui-monospace, monospace"},children:c.codigo})," aplicado",c.descuento_usd>0&&e.jsxs("span",{style:{color:"#16A34A",fontWeight:700},children:[" · −$",c.descuento_usd.toFixed(2)]}),c.total_usd>0&&e.jsx("div",{style:{fontSize:11.5,color:"var(--text-muted)",marginTop:2},children:u?"Revisando tu código para esta compra…":`Pagas $${c.total_usd.toFixed(2)} en este cobro.`})]}),e.jsx("button",{type:"button",onClick:P,style:U.quitar,children:"Quitar"})]}):e.jsxs("div",{style:U.caja2,children:[e.jsx("div",{style:U.titulo,children:"¿Tienes un código promocional?"}),e.jsxs("div",{style:{display:"flex",gap:7},children:[e.jsx("input",{value:R,onChange:n=>{h(n.target.value.toUpperCase().slice(0,24)),x("")},onKeyDown:n=>{n.key==="Enter"&&(n.preventDefault(),I())},placeholder:"Escribe tu código","aria-label":"Código promocional",className:"caja-cupon-input",style:U.input}),e.jsx("button",{type:"button",onClick:I,style:U.aplicar,children:u?"…":"Aplicar"})]}),!!A&&e.jsx("div",{role:"alert",style:{fontSize:12,color:"var(--danger, #DC2626)",marginTop:6},children:A}),e.jsx("style",{children:".caja-cupon-input::placeholder{text-transform:none}"})]})}const U={titulo:{fontSize:12.5,fontWeight:700,color:"var(--text-secondary)",marginBottom:7},caja:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap",marginBottom:12,padding:12,borderRadius:12,border:"1px solid rgba(22,163,74,0.35)",background:"rgba(22,163,74,0.08)"},caja2:{marginBottom:12,padding:12,borderRadius:12,border:"1px solid var(--border, #e2e8f0)",background:"var(--bg-tertiary, #f8fafc)"},input:{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)"},aplicar:{flex:"none",padding:"9px 15px",borderRadius:10,border:0,background:"var(--accent-blue, #5B6CF9)",color:"#fff",fontSize:12.5,fontWeight:800,cursor:"pointer",fontFamily:"inherit"},quitar:{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"}},we={starter:{name:"Starter",price:15,price3m:39,needsAdsChoice:!0,needsLogisticsChoice:!0,description:"1 plataforma de ads (Meta o TikTok) + 1 plataforma logística + Landing (página de ventas)"},pro:{name:"Pro",price:29,price3m:75,needsAdsChoice:!1,needsLogisticsChoice:!0,description:"Meta ilimitado + 3 cuentas TikTok + 1 logística + Landing + EcomIA WhatsApp"},plus:{name:"Plus",price:50,price3m:129,needsAdsChoice:!1,needsLogisticsChoice:!1,description:"Todo ilimitado + las 3 logísticas + Landing + asesoría personalizada + módulos premium early access + soporte prioritario + EcomIA"}};function Be(){const{packKey:t}=le(),[i,f]=ce(),c=pe(i.get("meses")),b=p=>{const W=new URLSearchParams(i);p===3?W.set("meses","3"):W.delete("meses"),f(W,{replace:!0})},w=de(),R=oe(),[h,A]=a.useState(null),[x,u]=a.useState(null),[N,T]=a.useState(!1),[d,M]=a.use
1State(0),[S,q]=a.useState(!0),[v,z]=a.useState(null),[k,E]=a.useState(!1);a.useEffect(()=>{R("/api/referrals/me").then(p=>p.json()).then(p=>{p&&typeof p.availableUSD=="number"&&M(p.availableUSD)}).catch(()=>{})},[R]);const l=t?we[t]:null,y=l?ue({price_usd:l.price,price_usd_3m:l.price3m},c):0,I=l?ge({price_usd:l.price,price_usd_3m:l.price3m},c):0;if(!l)return e.jsxs("div",{style:{padding:40,textAlign:"center"},children:[e.jsx("div",{style:{marginBottom:16},children:"Pack no encontrado."}),e.jsx("button",{onClick:()=>w("/facturacion"),style:Te,children:"Ver planes"})]});const P=S&&d>0?Math.min(d,Math.max(0,y-5)):0,n=v&&Number(v.descuento_usd)||0,g=v&&v.total_usd>0?Math.round(v.total_usd*100)/100:Math.round(Math.max(5,y-P-n)*100)/100,$=g<y,B=p=>Number.isInteger(p)?`$${p}`:`$${p.toFixed(2)}`,D=(!l.needsAdsChoice||h!==null)&&(!l.needsLogisticsChoice||x!==null),j=l.needsAdsChoice&&h===null?"ads":l.needsLogisticsChoice&&x===null?"log":k?"cupon":null,_=a.useRef(null),V=a.useRef(null),[Y,Q]=a.useState(null),O=()=>{var W,F;if(!j){T(!0);return}if(j==="cupon")return;const p=j==="ads"?_.current:V.current;if(Q(j),window.setTimeout(()=>Q(null),1600),p){const r=(F=(W=window.matchMedia)==null?void 0:W.call(window,"(prefers-reduced-motion: reduce)"))==null?void 0:F.matches;p.scrollIntoView({behavior:r?"auto":"smooth",block:"center"})}},K=j==="ads"?"Elige una plataforma de ads para continuar.":j==="log"?"Elige una plataforma logística para continuar.":j==="cupon"?"Estamos revisando tu código para esta compra. Un momento.":"";return e.jsxs("div",{style:{maxWidth:560,margin:"40px auto",padding:"0 20px"},children:[e.jsxs("div",{style:{background:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:16,padding:28},children:[e.jsx("button",{onClick:()=>w("/facturacion"),style:{...ze,marginBottom:16},children:"← Volver a facturación"}),e.jsxs("div",{style:{marginBottom:24},children:[e.jsxs("h1",{style:{fontSize:26,fontWeight:800,margin:0},children:["Plan ",l.name]}),e.jsx("div",{style:{marginTop:4,color:"var(--text-secondary)",fontSize:14},children:l.description}),e.jsx("div",{style:{marginTop:12,display:"flex",alignItems:"baseline",gap:8,flexWrap:"wrap"},children:$?e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{fontSize:22,fontWeight:700,color:"var(--text-muted)",textDecoration:"line-through"},children:["$",y]}),e.jsx("span",{style:{fontSize:36,fontWeight:800,color:"#16A34A"},children:B(g)}),e.jsx("span",{style:{fontSize:14,color:"var(--text-muted)"},children:c===3?"los 3 meses":"este mes"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{fontSize:36,fontWeight:800},children:["$",y]}),e.jsx("span",{style:{fontSize:14,color:"var(--text-muted)"},children:c===3?"/ 3 meses":"/mes"})]})}),$&&c!==3&&e.jsxs("div",{style:{marginTop:6,fontSize:12.5,color:"var(--text-secondary)"},children:["Solo en este cobro. Después sigue en $",l.price,"/mes."]}),e.jsx("div",{role:"group","aria-label":"Período de pago",style:{marginTop:10,display:"inline-flex",gap:4,background:"var(--bg-tertiary)",border:"1px solid var(--border)",borderRadius:999,padding:3},children:[1,3].map(p=>e.jsx("button",{type:"button",onClick:()=>b(p),"aria-pressed":c===p,style:{font:"inherit",fontSize:12.5,fontWeight:800,cursor:"pointer",border:0,borderRadius:999,padding:"6px 12px",background:c===p?"rgb(99, 102, 241)":"transparent",color:c===p?"#fff":"var(--text-secondary)"},children:p===3?`3 meses · $${l.price3m}`:`Mensual · $${l.price}`},p))}),c===3&&e.jsxs("div",{style:{marginTop:8,fontSize:12.5,fontWeight:700,color:"#16A34A"},children:["Pagas los 3 meses de una y ahorras $",I,". Después, la renovación sigue mensual a $",l.price,"."]}),t==="pro"&&e.jsxs("div",{style:{marginTop:14,background:"linear-gradient(135deg, rgba(168,85,247,0.10), rgba(99,102,241,0.10))",border:"1px solid rgba(168,85,247,0.35)",borderRadius:12,padding:"12px 14px",display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{style:{fontSize:22},children:"🎁"}),e.jsxs("div",{style:{fontSize:13,color:"var(--text-primary)",lineHeight:1.5},children:[e.jsx("b",{children:"+15 días extra de regalo"})," si activas en tu periodo de cortesía."]})]})]}),l.needsAdsChoice&&e.jsxs("div",{ref:_,style:ee(Y==="ads"),children:[e.jsx("div",{style:{fontSize:13,fontWeight:700,marginBottom:10,color:"var(--text-muted)",textTransform:"uppercase"},children:"Paso 1 · Elige una plataforma de ads"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[e.jsx(J,{selected:h==="meta",onClick:()=>A("meta"),icon:e.jsx(re,{size:28}),title:"Meta Ads",subtitle:"Facebook + Instagram",color:"#0866FF"}),e.jsx(J,{selected:h==="tiktok",onClick:()=>A("tiktok"),icon:e.jsx(ae,{size:28}),title:"TikTok Ads",subtitle:"TikTok Business",color:"#FE2C55"})]})]}),l.needsLogisticsChoice&&e.jsxs("div",{ref:V,style:ee(Y==="log"),children:[e.jsxs("div",{style:{fontSize:13,fontWeight:700,marginBottom:10,color:"var(--text-muted)",textTransform:"uppercase"},children:[l.needsAdsChoice?"Paso 2":"Paso 1"," · Elige una plataforma logística"]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsx(J,{selected:x==="dropi",onClick:()=>u("dropi"),icon:e.jsx(ie,{size:44}
1),title:"Dropi",subtitle:"Utilidad real, devoluciones y cartera",color:"#F1701A",iconBleed:!0}),e.jsx(J,{selected:x==="mastershop",onClick:()=>u("mastershop"),icon:e.jsx(ne,{size:44}),title:"Mastershop",subtitle:"Pedidos y atribución desde Mastershop",color:"#A6F23B",iconBleed:!0}),e.jsx(J,{selected:x==="envios99",onClick:()=>u("envios99"),icon:e.jsx(se,{size:44}),title:"99envíos",subtitle:"Multi-courier LATAM · seguros y atribución",color:"#FF5500",iconBleed:!0})]})]}),!l.needsAdsChoice&&!l.needsLogisticsChoice&&e.jsxs("div",{style:{padding:14,background:"rgba(99, 102, 241, 0.08)",border:"1px solid rgba(99, 102, 241, 0.2)",borderRadius:10,fontSize:13,color:"var(--text-secondary)",marginBottom:20},children:["✨ Este pack incluye ",e.jsx("b",{children:"todo activado automáticamente"}),". Solo confirmá el pago."]}),d>0&&(()=>{const p=P,W=g;return e.jsx("div",{style:{background:"linear-gradient(135deg, rgba(16,185,129,0.10), rgba(168,85,247,0.08))",border:"1px solid rgba(16,185,129,0.30)",borderRadius:10,padding:12,marginBottom:14},children:e.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:10,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:S,onChange:F=>q(F.target.checked),style:{marginTop:3,width:18,height:18,cursor:"pointer",accentColor:"#10B981"}}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{fontSize:13,fontWeight:700,color:"var(--text-primary)",lineHeight:1.3},children:["💰 Usar mi crédito de referidos · $",d.toFixed(2)]}),S&&p>0&&e.jsxs("div",{style:{fontSize:11.5,color:"var(--text-secondary)",marginTop:4,lineHeight:1.5},children:["Se descuentan ",e.jsxs("strong",{style:{color:"#10B981"},children:["$",p.toFixed(2)]})," del primer cobro. Pagás ",e.jsxs("strong",{children:["$",W.toFixed(2)]}),"."]})]})]})})})(),e.jsx(Ce,{packKey:t,meses:c,useCredit:S&&d>0,aplicado:v,onCambio:z,onVerificando:E}),K&&e.jsx("div",{role:"status",style:{marginBottom:10,padding:"9px 12px",borderRadius:10,background:"rgba(245,158,11,0.10)",border:"1px solid rgba(245,158,11,0.35)",color:"var(--text-primary)",fontSize:12.5,lineHeight:1.45},children:K}),e.jsx("button",{onClick:O,"aria-disabled":!D,style:{width:"100%",padding:"14px",background:D?"rgb(99, 102, 241)":"var(--bg-tertiary)",color:D?"white":"var(--text-muted)",border:"none",borderRadius:12,fontSize:15,fontWeight:700,cursor:"pointer"},children:k?"Revisando tu código…":$?c===3?`Pagar 3 meses por ${B(g)}`:`Suscribirme por ${B(g)}`:c===3?`Pagar 3 meses por $${y}`:`Suscribirme por $${l.price}/mes`}),e.jsxs("div",{style:{marginTop:14,fontSize:12,color:"var(--text-muted)",textAlign:"center",lineHeight:1.5},children:["Pago seguro con Wompi",e.jsx("br",{}),"Tarjeta crédito / débito · Nequi · Bancolombia"]}),e.jsx(he,{esMax:t==="plus",plan:t==="pro"?"pro":"starter"})]}),N&&e.jsx(me,{plan:{key:t,name:l.name,priceUsd:y,meses:c},choices:{ads:h,logistics:x},useCredit:S&&d>0,creditUsd:d,cupon:v,onClose:()=>T(!1),onDone:()=>w("/facturacion")})]})}function ee(t){return{borderRadius:14,padding:t?12:0,marginTop:t?-12:0,marginLeft:t?-12:0,marginRight:t?-12:0,marginBottom:t?12:24,background:t?"rgba(245,158,11,0.08)":"transparent",boxShadow:t?"0 0 0 2px rgba(245,158,11,0.55)":"0 0 0 0 rgba(245,158,11,0)",transition:"box-shadow .25s ease, background .25s ease"}}function J({selected:t,onClick:i,icon:f,title:c,subtitle:b,color:w,iconBleed:R}){const h=w||"rgb(99, 102, 241)";return e.jsxs("button",{onClick:i,style:{textAlign:"left",padding:"14px 16px",background:t?`${h}10`:"var(--bg-tertiary)",border:t?`2px solid ${h}`:"2px solid transparent",borderRadius:12,cursor:"pointer",display:"flex",alignItems:"center",gap:12,color:"var(--text-primary)",fontFamily:"inherit"},children:[e.jsx("div",{style:{width:48,height:48,borderRadius:10,background:R?"transparent":`${h}12`,border:R?"none":`1px solid ${h}30`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,overflow:"hidden"},children:f}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:700,fontSize:14},children:c}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:2},children:b})]}),t&&e.jsx("span",{style:{color:h,fontSize:18,flexShrink:0},children:"✓"})]})}const Te={background:"transparent",border:"1.5px solid var(--border)",padding:"10px 18px",borderRadius:10,cursor:"pointer",fontWeight:600},ze={background:"transparent",border:"none",padding:"6px 0",color:"var(--text-secondary)",fontSize:13,cursor:"pointer"};export{Be as PackWizard};

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.