PageSourceSearch

https://app.snapto.ai/assets/InstagramWebhookRelay-DhXusvS4.js

js snapto.ai collected 2026-10-05 15:08:42 UTC 3,040 bytes, 1 lines download raw bytes

1import{x as F,y as L,A as S,z as A,aj as r,r as n,p as a,L as T,ag as p,B as u,af as $,T as W,N as x}from"./index-C9IH3k-2.js";import{I as U,J as v}from"./TemplateUtil-D1DzmWLm.js";import{F as B}from"./Table-isZ0WXp4.js";import{S as E}from"./index-8jSYgZzf.js";import{P as C}from"./index-C0dhduHx.js";import"./Wrapper-ChjuDa3w.js";import"./HelperMethods-C-ewwU_x.js";import"./index-BOwvFOZJ.js";import"./Pagination-D1z-xPUv.js";import"./HolderOutlined-YOHjCGKZ.js";const l="/api/v1/admin/instagramWebhookRelay",N=async()=>(await F(l))?.data??[],D=async s=>(await L(l,s))?.data,P=async(s,i)=>(await S(`${l}/${s}/enabled?enabled=${i}`,{}))?.data,q=async s=>(await A(`${l}/${s}`))?.data,{Text:g}=W,V=()=>{const[s]=r.useForm(),[i,d]=n.useState([]),[b,y]=n.useState(!1),[f,h]=n.useState(!1),c=n.useCallback(async()=>{y(!0);try{d(await N())}catch(e){console.error("Failed to load Instagram webhook relays",e)}finally{y(!1)}},[]);n.useEffect(()=>{c()},[c]);const w=async e=>{h(!0);try{await D({url:e.url.trim(),note:e.note?.trim()||void 0,enabled:!0}),s.resetFields(["url","note"]),x.success("Relay URL added"),await c()}catch(t){console.error("Failed to add Instagram webhook relay",t)}finally{h(!1)}},I=async(e,t)=>{try{const o=await P(e.id,t);d(k=>k.map(m=>m.id===e.id?{...m,...o||{enabled:t}}:m))}catch(o){console.error("Failed to update Instagram webhook relay",o)}},R=async e=>{try{await q(e.id),d(t=>t.filter(o=>o.id!==e.id)),x.success("Relay URL deleted")}catch(t){console.error("Failed to delete Instagram webhook relay",t)}},j=[{title:"URL",dataIndex:"url",render:e=>a.jsx(g,{copyable:!0,style:{wordBreak:"break-all"},children:e})},{title:"Note",dataIndex:"note",width:200},{title:"Added",dataIndex:"createdAt",width:180,render:(e,t)=>e?`${new Date(e).toLocaleString()}${t.createdBy?` · ${t.createdBy}`:""}`:""},{title:"Enabled",dataIndex:"enabled",width:100,render:(e,t)=>a.jsx(E,{checked:!!e,onChange:o=>I(t,o)})},{title:"",key:"actions",width:60,render:(e,t)=>a.jsx(C,{title:"Delete this relay URL?",okText:"Yes",cancelText:"No",onConfirm:()=>R(t),children:a.jsx(u,{type:"text",danger:!0,icon:a.jsx(v,{}),"aria-label":"Delete"})})}];return a.jsx(U,{title:"Instagram Webhook Relay",extra:a.jsx(g,{type:"secondary",children:"Copies of verified inbound Instagram webhooks are POSTed to every enabled URL"}),children:a.jsxs(T,{vertical:!0,gap:"middle",children:[a.jsxs(r,{form:s,layout:"inline",onFinish:w,children:[a.jsx(r.Item,{name:"url",rules:[{required:!0,message:"URL is required"},{pattern:/^https?:\/\/\S+$/i,message:"Must be an http(s) URL"}],style:{flex:1,minWidth:320},children:a.jsx(p,{placeholder:"https://<your-tunnel>/api/v1/webhooks/meta/instagram"})}),a.jsx(r.Item,{name:"note",style:{minWidth:200},children:a.jsx(p,{placeholder:"Note (e.g. whose laptop)"})}),a.jsx(r.Item,{children:a.jsx(u,{type:"primary",htmlType:"submit",icon:a.jsx($,{}),loading:f,children:"Add"})})]}),a.jsx(B,{rowKey:"id",size:"small",columns:j,dataSource:i,loading:b,pagination:!1,locale:{emptyText:"No relay URLs"}})]})})};export{V 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.