1import{y as M,c,b as u,u as o,h as j,w as b,d as e,z as A,k as x,A as _,e as a,t as i,B as K,f,q as O,g as R,F as T,G as W,m as P}from"./app-DGg9yO0A.js";import{_ as q}from"./AdminLayout-C124mma3.js";import{_ as v}from"./Button-BzgrTa0j.js";/* empty css */import"./EigdoLogo-Crwv6Up3.js";import"./ticket-B4ytzU_q.js";import"./building-2-BxI1ookC.js";import"./trash-2-BfQk6oQM.js";import"./shield-check-4E2-RW5h.js";import"./users-BNxC0kcH.js";import"./package-B41T9BkD.js";import"./credit-card-t266ijNQ.js";import"./message-square-14lOIAYY.js";import"./webhook-fSBlWWej.js";import"./globe-BtnyxAaG.js";import"./arrow-left-m7RSYxQ4.js";import"./log-out-BMSJiKet.js";import"./menu-D5d11qbY.js";const z={class:"block text-sm font-medium mb-1"},G={class:"text-xs text-slate-500"},$={class:"block text-sm font-medium mb-1"},L={class:"text-xs text-slate-500"},H={class:"flex items-center gap-3"},I={key:0},J={class:"font-semibold mb-1"},Q={class:"space-y-0.5 text-xs"},X={class:"font-mono"},Y={key:1},Z={class:"font-semibold mb-1"},ee={class:"text-xs"},te={class:"max-w-2xl mt-10 p-4 rounded-md border bg-slate-50"},se={class:"flex items-center gap-2"},oe=["value"],we={__name:"Stripe",props:{settings:Object},setup(d){var y,k;const m=d,l=M({stripe_publishable_key:((y=m.settings)==null?void 0:y.stripe_publishable_key)||"",stripe_secret_key:"",stripe_webhook_secret:"",stripe_currency:((k=m.settings)==null?void 0:k.stripe_currency)||"USD"}),B=()=>l.put(route("admin.settings.stripe.update"),{preserveScroll:!0}),p=P(!1),s=P(null),E=async()=>{var r;p.value=!0,s.value=null;try{const{data:t}=await W.post(route("admin.settings.stripe.test"));s.value=t}catch(t){s.value=((r=t.response)==null?void 0:r.data)||{ok:!1,error:t.message}}finally{p.value=!1}},F=()=>{var r;(r=m.settings)!=null&&r.webhook_url&&navigator.clipboard.writeText(m.settings.webhook_url)};return(r,t)=>(f(),c(T,null,[u(o(j),{title:"Stripe"}),u(q,null,{default:b(()=>{var g,w,h,S,C,D,U,V,N;return[t[15]||(t[15]=e("h1",{class:"text-2xl font-semibold mb-6"},"Configuración Stripe",-1)),e("form",{onSubmit:A(B,["prevent"]),class:"max-w-2xl space-y-5"},[e("div",null,[t[4]||(t[4]=e("label",{class:"block text-sm font-medium mb-1"},"Publishable Key (pk_...)",-1)),x(e("input",{"onUpdate:modelValue":t[0]||(t[0]=n=>o(l).stripe_publishable_key=n),type:"text",class:"w-full bg-white border border-slate-200 rounded-md px-3 py-2 text-sm font-mono"},null,512),[[_,o(l).stripe_publishable_key]])]),e("div",null,[e("label",z,[t[5]||(t[5]=a("Secret Key (sk_...) ",-1)),e("span",G,i(((g=d.settings)==null?void 0:g.stripe_secret_key)||"no configurado"),1)]),x(e("input",{"onUpdate:modelValue":t[1]||(t[1]=n=>o(l).stripe_secret_key=n),type:"password",class:"w-full bg-white border border-slate-200 rounded-md px-3 py-2 text-sm font-mono",placeholder:"Deja vacÃo para no cambiar"},null,512),[[_,o(l).stripe_secret_key]])]),e("div",null,[e("label",$,[t[6]||(t[6]=a("Webhook Secret (whsec_...) ",-1)),e("span",L,i(((w=d.settings)==null?void 0:w.stripe_webhook_secret)||"no configurado"),1)]),x(e("input",{"onUpdate:modelValue":t[2]||(t[2]=n=>o(l).stripe_webhook_secret=n),type:"password",class:"w-full bg-white border border-slate-200 rounded-md px-3 py-2 text-sm font-mono",placeholder:"Deja vacÃo para no cambiar"},null,512),[[_,o(l).stripe_webhook_secret]])]),e("div",null,[t[8]||(t[8]=e("label",{class:"block text-sm font-medium mb-1"},"Moneda",-1)),x(e("select",{"onUpdate:modelValue":t[3]||(t[3]=n=>o(l).stripe_currency=n),class:"w-full bg-white border border-slate-200 rounded-md px-3 py-2 text-sm"},[...t[7]||(t[7]=[e("option",null,"USD",-1),e("option",null,"DOP",-1),e("option",null,"EUR",-1)])],512),[[K,o(l).stripe_currency]])]),e("div",H,[u(o(v),{type:"submit",disabled:o(l).processing},{default:b(()=>[...t[9]||(t[9]=[a("Guardar",-1)])]),_:1},8,["disabled"]),u(o(v),{type:"button",variant:"outline",disabled:p.value||!((h=d.settings)!=null&&h.has_secret),onClick:E},{default:b(()=>[a(i(p.value?"Probandoâ¦":"Probar conexión"),1)]),_:1},8,["disabled"])])],32),s.value?(f(),c("div",{key:0,class:O(["max-w-2xl mt-4 p-4 rounded-md border text-sm",s.value.ok?"bg-emerald-50 border-emerald-200 text-emerald-900":"bg-rose-50 border-rose-200 text-rose-900"])},[s.value.ok?(f(),c("div",I,[e("div",J,"Conexión OK â modo "+i((S=s.value.account)==null?void 0:S.mode),1),e("ul",Q,[e("li",null,[t[10]||(t[10]=a("Account: ",-1)),e("span",X,i((C=s.value.account)==null?void 0:C.id),1)]),e("li",null,"Nombre: "+i(((D=s.value.account)==null?void 0:D.business_name)||"â"),1),e("li",null,"Email: "+i(((U=s.value.account)==null?void 0:U.email)||"â"),1),e("li",null,"PaÃs: "+i((V=s.value.account)==null?void 0:V.country),1)])])):(f(),c("div",Y,[e("div",Z,"Falló: "+i(s.value.code||"error"),1),e("div",ee,i(s.value.error),1)]))],2)):R("",!0),e("section",te,[t[12]||(t[12]=e("h2",{class:"text-sm font-semibold mb-2"},"URL de webhook",-1)),t[13]||(t[13]=e("p",{class:"text-xs text-slate-600 mb-3"}," Configura este endpoint en Stripe Dashboard â Developers â Webhooks â Add endpoint. Eventos requeridos: ",-1)),t[14]||(t[14]=e("ul",{class:"text-xs text-slate-700 mb-3 list-disc pl-5 space-y-0.5 font-mono"},[e("li",null,"checkout.session.completed"),e("li",null,"checkout.session.async_payment_succeeded"),e("li",null,"checkout.session.async_payment_failed"),e("li",null,"customer.subscription.created"),e("li",null,"customer.subscription.updated"),e("li",null,"customer.subscription.deleted"),e("li",null,"invoice.payment_succeeded"),e("li",null,"invoice.payment_failed"),e("li",null,"charge.refunded")],-1)),e("div",se,[e("input",{value:(N=d.settings)==null?void 0:N.webhook_url,readonly:"",class:"flex-1 bg-white border border-slate-200 rounded-md px-3 py-2 text-sm font-mono"},null,8,oe),u(o(v),{type:"button",variant:"outline",onClick:F},{default:b(()=>[...t[11]||(t[11]=[a("Copiar",-1)])]),_:1})])])]}),_:1})],64))}};export{we as default};
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.