PageSourceSearch

https://ihaqdonate.com/assets/TestWebhooksSection-B-Dh47il.js

js ihaqdonate.com collected 2026-10-07 15:09:38 UTC 3,807 bytes, 1 lines download raw bytes

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.