1import{r as a,j as e}from"./vendor-react-DgOz2jQd.js";import{s}from"./sections.module-_Y9BxcsZ.js";import{a as E}from"./vendor-query-CCb-kr4I.js";import{T as o}from"./TextInputGlass-Buf8bN9v.js";import{A as G}from"./AmountInputGlass-DKVPt_E0.js";import{B as V}from"./index-DayLiz0y.js";import{D as W}from"./DropdownInputGlass-DfNJVIbJ.js";import"./vendor-mobx-DziDysUD.js";import"./vendor-forms-CeN62axY.js";import"./pluralize-BqhPSiJS.js";import"./copyToClipboard-CMgYcUjS.js";import"./inputmask-CP427Q3D.js";import"./ArtGlass-xtrGyfYe.js";import"./lazyArts-D2K_1G8g.js";const X=()=>{const[n,I]=a.useState(""),[c,f]=a.useState(""),[u,D]=a.useState(""),[r,C]=a.useState("donation.created"),[m,b]=a.useState("ТеÑÑовÑй зÑиÑелÑ"),[p,k]=a.useState("100.00"),[h,N]=a.useState("ТеÑÑовое ÑообÑение донаÑа!"),[x,T]=a.useState(""),[v,j]=a.useState(!1),[L,i]=a.useState(!1),[S,l]=a.useState(null),y=[{alias:"donation.created",title:"donation.created (Создание)"},{alias:"donation.paid",title:"donation.paid (ÐплаÑа)"},{alias:"donation.refunded",title:"donation.refunded (ÐозвÑаÑ)"}],w=async()=>{var t,g;if(!n.trim()){l("ÐведиÑе Client ID");return}j(!0),l(null),i(!1);try{await E.post("/api/v2/webhooks/test",{clientId:n.trim(),streamerId:c.trim(),partnerSuperDonationId:u.trim(),event:r,donatorName:m,amount:p,message:h,videoLink:x}),i(!0),setTimeout(()=>i(!1),3e3)}catch(d){l(((g=(t=d==null?void 0:d.response)==null?void 0:t.data)==null?void 0:g.message)||"ÐÑоизоÑла оÑибка пÑи оÑпÑавке")}finally{j(!1)}};return e.jsxs("div",{className:s.section,children:[e.jsx("h2",{children:"ÐÑпÑавка ÑеÑÑового вебÑ
Ñка"}),e.jsxs("p",{children:["ÐдеÑÑ Ð²Ñ Ð¼Ð¾Ð¶ÐµÑе ÑгенеÑиÑоваÑÑ Ð¸ оÑпÑавиÑÑ ÑеÑÑовÑй вебÑ
Ñк на Ð²Ð°Ñ ",e.jsx("code",{children:"Webhook URL"}),". УкажиÑе Ð²Ð°Ñ ",e.jsx("code",{children:"Client ID"})," (взÑÑÑ ÐµÐ³Ð¾ можно в наÑÑÑойкаÑ
паÑÑнÑÑÑкого пÑиложениÑ) и заполниÑе необÑ
одимÑе полÑ. ÐапÑÐ¾Ñ Ð±ÑÐ´ÐµÑ Ð¾ÑпÑавлен на ",e.jsx("code",{children:"POST /api/v2/webhooks/test"}),"."]}),e.jsxs("div",{className:s.formContainer,children:[e.jsx(o,{title:"Client ID",value:n,onChange:t=>I(t.target.value),placeholder:"ÐведиÑе Ð²Ð°Ñ Client ID"}),e.jsx(o,{title:"Streamer ID (опÑионалÑно)",value:c,onChange:t=>f(t.target.value),placeholder:"ID ÑÑÑимеÑа"}),e.jsx(o,{title:"Partner Super Donation ID (опÑионалÑно)",value:u,onChange:t=>D(t.target.value),placeholder:"ÐÐ°Ñ ID ÑÑпеÑдонаÑа"}),e.jsxs("div",{children:[e.jsx("label",{className:s.dropdownLabel,children:"СобÑÑие"}),e.jsx(W,{allVariants:y,currentVariant:r,onChange:t=>C(t.alias),placeholder:"ÐÑбеÑиÑе ÑобÑÑие"})]}),e.jsx(o,{title:"ÐÐ¼Ñ Ð¾ÑпÑавиÑелÑ",value:m,onChange:t=>b(t.target.value),placeholder:"ÐапÑимеÑ, User"}),e.jsx(G,{title:"СÑмма",value:p,setValue:t=>k(t.toString()),placeholder:"100.00",maxLength:7}),r==="donation.created"&&e.jsxs(e.Fragment,{children:[e.jsx(o,{title:"СообÑение",value:h,onChange:t=>N(t.target.value),placeholder:"ТекÑÑ Ð´Ð¾Ð½Ð°Ñа"}),e.jsx(o,{title:"СÑÑлка на видео (опÑионалÑно)",value:x,onChange:t=>T(t.target.value),placeholder:"https://youtube.com/..."})]}),S&&e.jsx("div",{className:s.errorText,children:S}),L&&e.jsx("div",{className:s.successText,children:"ÐебÑ
Ñк ÑÑпеÑно оÑпÑавлен!"}),e.jsx("div",{className:s.buttonWrapper,children:e.jsx(V,{text:"ÐÑпÑавиÑÑ ÑеÑÑовÑй вебÑ
Ñк",size:"m",theme:"accent",onClick:w,isLoading:v,isDisabled:v||!n.trim()})})]})]})};export{X as TestWebhooksSection};
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.