PageSourceSearch

https://accounts.pabbly.com/assets/webhooks-CJrb0dXl.js

js pabbly.com collected 2026-10-01 08:35:48 UTC 12,616 bytes, 1 lines download raw bytes

1import{K as ee,J as te,s as se,T as m,b0 as le,r as h,q as ae,t as ie,j as e,_ as M,Q as ne,w as re,a1 as _,f as oe,B as u,g as W,i as S,k as P,a4 as R,a5 as F,a6 as U,b1 as B,a3 as H,aD as ce,a as w,c as A,e as D,D as de,ac as he,a0 as ue,H as V,C as q}from"./index-7MV_tGie.js";import{B as pe}from"./big-card-2_n4x225.js";import{b as G,c as k,a as xe,T as me,d as be}from"./TableRow-BhzWqrU9.js";import{C as E}from"./Chip-D-XJpVlL.js";import{D as $}from"./Dialog-BlxL-JId.js";import{D as J}from"./DialogTitle-Bh8C4ESe.js";import{D as Q}from"./DialogContent-B_Sc8vus.js";import{F as je}from"./FormControlLabel-mjTC6_Nt.js";import{D as X}from"./dialogTitleClasses-CbWO9LII.js";import{C as L}from"./Card-Cu10QyQm.js";import{C as fe}from"./CircularProgress-C2jm0anO.js";import{C as ge}from"./CardHeader-CT-6Jera.js";import{T as ve}from"./TableContainer-DOyWD8h9.js";import{A as ye}from"./access-denied-view-Cih0ShMn.js";function Ce(t){return te("MuiDialogContentText",t)}ee("MuiDialogContentText",["root"]);const ke=["children","className"],_e=t=>{const{classes:a}=t,o=re({root:["root"]},Ce,a);return M({},a,o)},we=se(m,{shouldForwardProp:t=>le(t)||t==="classes",name:"MuiDialogContentText",slot:"Root",overridesResolver:(t,a)=>a.root})({}),Se=h.forwardRef(function(a,x){const o=ae({props:a,name:"MuiDialogContentText"}),{className:c}=o,l=ie(o,ke),d=_e(l);return e.jsx(we,M({component:"p",variant:"body1",color:"text.secondary",ref:x,ownerState:l,className:ne(d.root,c)},o,{classes:d}))}),Ae={"customer.signup":"Signup","customer.project_access":"Project Access","customer.account_deleted":"Account Deleted"},De={all:"All Apps",pc:"Pabbly Connect",psb:"Pabbly Subscription Billing",pfb:"Pabbly Form Builder",pem:"Pabbly Email Marketing",pev:"Pabbly Email Verification",ph:"Pabbly Hook",pcf:"Pabbly Chatflow"};function Ee({row:t,onEdit:a,onDelete:x,onToggle:o}){return e.jsxs(G,{hover:!0,children:[e.jsx(k,{children:e.jsx(m,{variant:"body2",fontWeight:600,children:t.name})}),e.jsx(k,{children:e.jsx(_,{title:t.url,arrow:!0,placement:"top",children:e.jsx(m,{variant:"body2",sx:{maxWidth:280,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.url})})}),e.jsx(k,{children:e.jsxs(oe,{direction:"row",spacing:.5,flexWrap:"wrap",useFlexGap:!0,children:[(t.events||[]).map(c=>e.jsx(E,{label:Ae[c]||c,size:"small",variant:"outlined",color:"primary"},c)),(t.events||[]).includes("customer.project_access")&&(t.project_access_apps||["all"]).map(c=>e.jsx(E,{label:De[c]||c,size:"small",variant:"soft",color:"info"},`app-${c}`))]})}),e.jsx(k,{children:e.jsx(E,{label:t.is_active?"Active":"Inactive",size:"small",color:t.is_active?"success":"default",variant:"soft"})}),e.jsx(k,{align:"right",children:e.jsxs(u,{sx:{display:"flex",justifyContent:"flex-end",gap:.5},children:[e.jsx(_,{title:t.is_active?"Disable":"Enable",children:e.jsx(W,{size:"small",onClick:()=>o(t),children:e.jsx(S,{icon:t.is_active?"mdi:toggle-switch":"mdi:toggle-switch-off-outline",width:24,sx:{color:t.is_active?"success.main":"text.disabled"}})})}),e.jsx(_,{title:"Edit",children:e.jsx(W,{size:"small",onClick:()=>a(t),children:e.jsx(S,{icon:"mdi:pencil-outline",width:20})})}),e.jsx(_,{title:"Delete",children:e.jsx(W,{size:"small",color:"error",onClick:()=>x(t),children:e.jsx(S,{icon:"mdi:delete-outline",width:20})})})]})})]})}function Te({headLabel:t}){return e.jsx(xe,{children:e.jsx(G,{children:t.map(a=>e.jsx(k,{align:a.align||"left",sx:{whiteSpace:"nowrap"},children:e.jsx(_,{arrow:!0,placement:"top",disableInteractive:!0,title:a.tooltip||"",children:e.jsx(m,{variant:"subtitle2",sx:{fontWeight:600,cursor:a.tooltip?"help":"default"},children:a.label})})},a.id))})})}const N=[{value:"customer.signup",label:"Customer Signup"},{value:"customer.project_access",label:"Project Access"},{value:"customer.account_deleted",label:"Account Deleted"}],z=[{value:"all",label:"All Apps"},{value:"pc",label:"Pabbly Connect"},{value:"psb",label:"Pabbly Subscription Billing"},{value:"pfb",label:"Pabbly Form Builder"},{value:"pem",label:"Pabbly Email Marketing"},{value:"pev",label:"Pabbly Email Verification"},{value:"ph",label:"Pabbly Hook"},{value:"pcf",label:"Pabbly Chatflow"}];function We({open:t,onClose:a,onSave:x,webhook:o}){const c=!!o,[l,d]=h.useState({name:"",url:"",events:[],project_access_apps:["all"],is_active:!0,secret:""}),[p,v]=h.useState({});h.useEffect(()=>{d(o?{name:o.name||"",url:o.url||"",events:o.events||[],project_access_apps:o.project_access_apps||["all"],is_active:o.is_active!==!1,secret:o.secret||""}:{name:"",url:"",events:[],project_access_apps:["all"],is_active:!0,secret:""}),v({})},[o,t]);const b=s=>r=>{d(i=>({...i,[s]:r.target.value})),v(i=>({...i,[s]:""}))},j=s=>r=>{d(i=>({...i,[s]:r.target.checked}))},C=s=>{const r=s.target.value;if(r.includes("all")&&!l.project_access_apps.includes("all")){d(i=>({...i,project_access_apps:["all"]}));return}if(r.includes("all")&&r.length>1){d(i=>({...i,project_access_apps:r.filter(y=>y!=="all")}));return}if(r.length===0){d(i=>({...i,project_access_apps:["all"]}));return}d(i=>({...i,project_access_apps:r}))},I=l.events.includes("customer.project_access"),T=()=>{const s={};l.name.trim()||(s.name="Name is required"),l.url.trim()||(s.url="URL is required"),l.events.length===0&&(s.events="Select at least one event");
1try{l.url.trim()&&(new URL(l.url.trim()).protocol||(s.url="Enter a valid URL"))}catch{s.url="Enter a valid URL"}return v(s),Object.keys(s).length===0},f=()=>{if(!T())return;const s={...l,name:l.name.trim(),url:l.url.trim(),secret:l.secret.trim()||null};l.events.includes("customer.project_access")||(s.project_access_apps=["all"]),x(s)};return e.jsxs($,{open:t,onClose:a,maxWidth:"sm",fullWidth:!0,children:[e.jsx(J,{children:c?"Edit Webhook":"Add Webhook"}),e.jsxs(Q,{sx:{display:"flex",flexDirection:"column",gap:2.5,pt:1},children:[e.jsx(P,{label:"Name",value:l.name,onChange:b("name"),error:!!p.name,helperText:p.name,fullWidth:!0,sx:{mt:1}}),e.jsx(P,{label:"URL",value:l.url,onChange:b("url"),error:!!p.url,helperText:p.url,placeholder:"https://example.com/webhook",fullWidth:!0}),e.jsxs(R,{fullWidth:!0,error:!!p.events,children:[e.jsx(F,{children:"Events"}),e.jsx(U,{multiple:!0,value:l.events,onChange:b("events"),input:e.jsx(B,{label:"Events"}),renderValue:s=>e.jsx(u,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:s.map(r=>{const i=N.find(y=>y.value===r);return e.jsx(E,{label:(i==null?void 0:i.label)||r,size:"small"},r)})}),children:N.map(s=>e.jsx(H,{value:s.value,children:s.label},s.value))}),p.events&&e.jsx(u,{sx:{color:"error.main",fontSize:"0.75rem",mt:.5,ml:1.75},children:p.events})]}),I&&e.jsxs(R,{fullWidth:!0,children:[e.jsx(F,{children:"Project Access - Select Apps"}),e.jsx(U,{multiple:!0,value:l.project_access_apps,onChange:C,input:e.jsx(B,{label:"Project Access - Select Apps"}),renderValue:s=>e.jsx(u,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:s.map(r=>{const i=z.find(y=>y.value===r);return e.jsx(E,{label:(i==null?void 0:i.label)||r,size:"small"},r)})}),children:z.map(s=>e.jsx(H,{value:s.value,children:s.label},s.value))})]}),e.jsx(P,{label:"Secret (optional)",value:l.secret,onChange:b("secret"),placeholder:"HMAC-SHA256 signing key",helperText:"If set, payloads will be signed with this secret via X-Webhook-Signature header",fullWidth:!0}),e.jsx(je,{control:e.jsx(ce,{checked:l.is_active,onChange:j("is_active")}),label:"Active"})]}),e.jsxs(X,{children:[e.jsx(w,{onClick:a,color:"inherit",children:"Cancel"}),e.jsx(w,{onClick:f,variant:"contained",children:c?"Update":"Create"})]})]})}const O=[{id:"name",label:"Name",tooltip:"Webhook subscription name"},{id:"url",label:"URL",tooltip:"Destination URL for webhook delivery"},{id:"events",label:"Events",tooltip:"Event types this webhook subscribes to"},{id:"status",label:"Status",tooltip:"Whether this webhook is active or disabled"},{id:"actions",label:"Actions",align:"right",tooltip:"Edit, delete, or toggle the webhook"}];function Pe(){const[t,a]=h.useState([]),[x,o]=h.useState(!0),[c,l]=h.useState(null),[d,p]=h.useState(!1),[v,b]=h.useState(null),[j,C]=h.useState(null),[I,T]=h.useState(!1),f=h.useCallback(async()=>{try{o(!0),l(null);const n=await A(D.admin.webhooks,"GET");if(n&&n.success===!1){l(n.error||"Failed to fetch webhooks"),a([]);return}n&&n.data?a(n.data):a([])}catch(n){console.error("Error fetching webhooks:",n),l("Failed to fetch webhooks. Please try again."),a([])}finally{o(!1)}},[]);h.useEffect(()=>{f()},[f]);const s=()=>{b(null),p(!0)},r=n=>{b(n),p(!0)},i=()=>{p(!1),b(null)},y=async n=>{try{T(!0);let g;v?g=await A(D.admin.updateWebhook(v.id),"PUT",n):g=await A(D.admin.createWebhook,"POST",n),g&&g.success!==!1&&(i(),f())}catch(g){console.error("Error saving webhook:",g)}finally{T(!1)}},K=async n=>{try{await A(D.admin.updateWebhook(n.id),"PUT",{is_active:!n.is_active}),f()}catch(g){console.error("Error toggling webhook:",g)}},Z=n=>{C(n)},Y=async()=>{if(j)try{await A(D.admin.deleteWebhook(j.id),"DELETE"),C(null),f()}catch(n){console.error("Error deleting webhook:",n)}};return x?e.jsx(L,{children:e.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",py:10},children:e.jsx(fe,{})})}):c?e.jsx(L,{children:e.jsxs(u,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",py:10},children:[e.jsx(S,{icon:"mdi:alert-circle-outline",width:48,sx:{color:"error.main",mb:2}}),e.jsx(m,{variant:"h6",sx:{mb:1},children:"Error Loading Data"}),e.jsx(m,{variant:"body2",sx:{color:"text.secondary",mb:2},children:c}),e.jsx(w,{variant:"contained",onClick:f,startIcon:e.jsx(S,{icon:"mdi:refresh"}),children:"Retry"})]})}):e.jsxs(e.Fragment,{children:[e.jsxs(L,{children:[e.jsx(ge,{title:e.jsxs(u,{display:"flex",justifyContent:"space-between",alignItems:"flex-start",children:[e.jsxs(u,{display:"inline-block",children:[e.jsx(_,{arrow:!0,placement:"top",disableInteractive:!0,title:"Manage your webhook subscriptions here.",children:e.jsx(m,{variant:"h6",sx:{width:"fit-content"},children:"Webhooks"})}),e.jsx(m,{sx:{color:"text.disabled",fontSize:"14px",fontWeight:400},children:"Configure webhook URLs to receive event notifications."})]}),e.jsx(w,{variant:"contained",color:"primary",startIcon:e.jsx(S,{icon:"mdi:plus"}),onClick:s,size:"small",children:"Add Webhook"})]}),sx:{pb:3}}),e.jsx(de,{}),e.jsx(u,{sx:{position:"relative"},children:e.jsx(he,{children:e.jsx(ve,{sx:{minWidth:800},children:e.jsxs(me,{size:"medium",children:[e.jsx(Te,{headLabel:O}),e.jsxs(be,{children:[t.map(n=>e.jsx(Ee,{row:n,onEdit:r,onDelete:Z,onToggle:K},n.id)),t.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:O.length,children:e.jsxs(u,{sx:{py:10,textAlign:"center"},children:[e.jsx(m,{variant:"h6",sx:{mb:1},children:"No Webhooks Found"}),e.jsx(m,{variant:"body2",sx:{color:"text.secondary"},children:'Click "Add Webhook" to create your first webhook subscription.'})]})})})]})]})})})})]}),e.jsx(We,{open:d,onClose:i,onSave:y,webhook:v}),e.jsxs($,{open:!!j,onClose:()=>C(null),children:[e.jsx(J,{children:"Delete Webhook"}),e.jsx(Q,{children:e.jsxs(Se,{children:['Are you sure you want to delete the webhook "',j==null?void 0:j.name,'"? This action cannot be undone.']})}),e.jsxs(X,{children:[e.jsx(w,{onClick:()=>C(null),color:"inherit",children:"Cancel"}),e.jsx(w,{onClick:Y,color:"error",variant:"contained",children:"Delete"})]})]})]})}const Le={title:`Webhooks | ${q.site.name}`},Ie={items:['The "Webhooks" section allows administrators to configure webhook subscriptions for real-time event notifications.',"Supported events include: Customer Signup, Project Access, and Account Deletion.","Each webhook can subscribe to one or more event types and can be enabled or disabled at any time.","An optional secret key can be configured for HMAC-SHA256 payload signing (sent via X-Webhook-Signature header).",'Webhook delivery history is available in the "Webhook Events" section with 90-day retention.'],style:{pl:1.5,listStyleType:"disc","& li":{mb:.5}}};function Re(){const{isSuper:t}=ue(),{items:a,style:x}=Ie;return t?e.jsxs(e.Fragment,{children:[e.jsx(V,{children:e.jsx("title",{children:Le.title})}
1),e.jsx(u,{sx:{gap:3,display:"flex",flexDirection:{xs:"column",md:"row"},alignItems:"stretch"},children:e.jsxs(u,{width:"100%",children:[e.jsx(u,{sx:{mb:3},children:e.jsx(pe,{getHelp:!1,isVideo:!0,bigcardtitle:"Points To Remember!",style:x,items:a,videoLink:"https://www.youtube.com/embed/S-gpjyxqRZo?si=RraJU_Q1ht71Pk2T",thumbnailName:"pabbly-admin-panel.png"})}),e.jsx(Pe,{})]})})]}):e.jsx(ye,{})}function Xe(){return e.jsxs(e.Fragment,{children:[e.jsx(V,{children:e.jsx("title",{children:`Admin - Webhooks - ${q.site.name}`})}),e.jsx(Re,{})]})}export{Xe 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.