1"use strict";(self.webpackChunkclient_v2=self.webpackChunkclient_v2||[]).push([[1449],{148981:(Y,E,s)=>{s.r(E),s.d(E,{default:()=>K});var o=s(715621),P=s(483150);const t={"bg-primary-xlight":"bg-primary-xlight__AAr_1","bg-primary-light":"bg-primary-light__ZZvMr","bg-primary":"bg-primary__kgdOE","bg-primary-dark":"bg-primary-dark__uZe9X","bg-primary-xdark":"bg-primary-xdark__bRBFo","bg-secondary-xlight":"bg-secondary-xlight__BO6Lb","bg-secondary-light":"bg-secondary-light__SuJEI","bg-secondary":"bg-secondary__jQqOY","bg-secondary-dark":"bg-secondary-dark__lRGQs","bg-secondary-xdark":"bg-secondary-xdark__EB_V0","bg-success-xlight":"bg-success-xlight__yuBpL","bg-success-light":"bg-success-light__PVMRF","bg-success":"bg-success__iqUg6","bg-success-dark":"bg-success-dark__C6ux1","bg-success-xdark":"bg-success-xdark__Wmev_","bg-info-xlight":"bg-info-xlight__JF8Vc","bg-info-light":"bg-info-light__tGdsG","bg-info":"bg-info__sDyA7","bg-info-dark":"bg-info-dark__u6Oiu","bg-info-xdark":"bg-info-xdark__OByp9","bg-warning-xlight":"bg-warning-xlight__qHgNW","bg-warning-light":"bg-warning-light__tRcwf","bg-warning":"bg-warning__T1B6Q","bg-warning-dark":"bg-warning-dark__ocB73","bg-warning-xdark":"bg-warning-xdark__B_mFy","bg-alert-xlight":"bg-alert-xlight__lEyfy","bg-alert-light":"bg-alert-light__S04Zo","bg-alert":"bg-alert__A6nT5","bg-alert-dark":"bg-alert-dark__vbx3n","bg-alert-xdark":"bg-alert-xdark__CK2c2","bg-danger-xlight":"bg-danger-xlight__HvSYn","bg-danger-light":"bg-danger-light__RcPVj","bg-danger":"bg-danger__OLpZu","bg-danger-dark":"bg-danger-dark__S18Vy","bg-danger-xdark":"bg-danger-xdark__GARDF",header:"header__s42lF",description:"description__uZC_x",loader:"loader__ABcQx",body:"body__K01hz",error:"error__AJ5zx",form:"form__WnPOl",formField:"formField__Bgaab",legend:"legend__tfZfW",infoImage:"infoImage__fZ22F",testWebhook:"testWebhook__Bw9Ww"};var m=s(248883),g=s(537953);function B(){return{id:"webhookBasicConfiguration",title:"Webhook Basic Configuration",legendClassName:t.legend,fields:[{id:"moduleSettings.webhook.enabled",field:"switch",formFieldClassName:t.formField,label:"Enable Webhook?",description:"If enabled, PeopleGrove will ping on your server based on certain events.",className:"",inline:!0},{id:"moduleSettings.webhook.url",field:"text",label:"URL",formFieldClassName:t.formField,description:"Input the URL you want PeopleGrove to hit when activity happens",placeholder:"https://yourdomain.com",className:"",inline:!0},{id:"moduleSettings.webhook.method",field:"select",label:"Request Method",formFieldClassName:t.formField,placeholder:"Choose",description:"Choose the request method - POST OR GET. By default request will be sent by POST method",options:[{label:"POST",value:"POST"},{label:"GET",value:"GET"}],disabled:!1},{id:"moduleSettings.webhook.authHeader",formFieldClassName:t.formField,field:"text",label:"Auth Header (Advanced)",description:"If you would like to send 'Authorization' header with every request, enter it here",placeholder:"bearer someUniqueTokenForecurity"},{id:"moduleSettings.webhook.dedicatedIp",formFieldClassName:t.formField,field:"switch",label:"Use dedicated IP",description:"If enabled, PeopleGrove will ping on your server based on certain events.",inline:!0}]}}function U({testWebhook:e,isFormEdited:i}){return{id:"testWebhook",title:"Test Webhook",legendClassName:t.legend,description:"Clicking Test Webhook button will send a few requests to the URL specified above. This is not comprehensive but is just meant to ensure the connection is set up right",descriptionClassName:t.formField,fields:[{id:"test",field:"component",component:()=>(0,o.jsx)("div",{className:t.testWebhook,children:(0,o.jsx)(m.$n,{type:"secondary",onClick:e,disabled:i,children:"Test Webhook"})})}]}}function G(){return{id:"triggeringEvents",title:"Triggering Events",legendClassName:t.legend,descriptionClassName:t.formField,description:(0,o.jsxs)(o.Fragment,{children:["You can select which events you want to be notified of. For documentation on events triggered via the webhook, see this page:"," ",(0,o.jsx)("a",{href:"https://api.peoplegrove.com/api-docs/",target:"_blank",rel:"noreferrer",children:"Webhook documentation"})]}),fields:[{id:"moduleSettings.webhook.specificEvents",field:"checkboxGroup",formFieldClassName:t.formField,label:"Specific Events",options:[{label:"User Login Events",value:"user-login"},{label:"User Profile Updates",description:"",value:"user-profile-update"},{label:"Completed Pathway",value:"CompletedPathway"},{label:"User Joined",value:"UserJoined"},{label:"Registered Event",value:"RegisteredEvent"},{label:"Joined Event",value:"CheckedInEvent"},{label:"Profile Connection",value:"ProfileConnection"},{label:"Created a Post",value:"PostQuestions"},{label:"Replied to a Post",value:"PostAnswers"},{label:"Joined Group",value:"JoinedGroups"}]}]}}const M=({testWebhook:e,isFormEdited:i})=>{const r=B(),n=G(),l=U({testWebhook:e,isFormEdited:i});return[r,n,l]};var c=s(893602),T=s(839050),O=s(163081),R=s(425170),j=s(283766);const I={TestWebhooks:"Webhooks/TestWebhooks"};var N=s(967489);const L=async e=>{const{data:i}=await(0,N._kQ)({...e});return i},H=e=>(0,j.useMutation)(L,{...e}),J=async()=>{const{data:e}=await(0,N.MAi)();return e},Z=()=>(0,j.useQuery)(I.TestWebhooks,J,{enabled:!1,cacheTime:0});var Q=s(427781);const V=({showTestWebhookModal:e,handleCloseModal:i,testWebhookData:r,isTestingWebhook:n})=>(console.log(n,"isTestingWebhook"),(0,o.jsx)(m.aF,{id:"ed-info-modal",open:e,title:"Preview Webhook Response",onClose:i,children:n?(0,o.jsx)("div",{className:t.loader,children:(0,o.jsx)(Q.A,{className:"loader-animation"})}):(0,o.jsxs)(o.Fragment,{children:["Response body:",(0,o.jsx)("div",{children:`${JSON.stringify(r)}`})]})})),D="REFRESH_CURRENT_CLUSTER",$=()=>({type:D}),z=({initialData:e})=>{const i=(0,O.useDispatch)(),r=(0,T.er)(),n=(0,g.useRef)(null),[l,a]=(0,g.useState)(e!=null?e:{}),[v,h]=(0,g.useState)(!1),b=(0,g.useMemo)(()=>c.A.some(l,"dirty"),[l]),f=()=>{h(!1)},k=()=>{h(!0),y()},{mutate:p,isLoading:_}
1=H({onSuccess:()=>{i($()),(0,R.mei)("Settings updated"),a(c.A.mapValues(l,({value:d,error:u})=>({value:d,error:u})))},onError:()=>{(0,R.mei)("Something went wrong!","error")}}),{data:S,isFetching:x,refetch:y}=Z(),F=M({testWebhook:k,isFormEdited:b}),w=d=>{a(d)},W=async()=>{var d;if(!((d=n.current)!=null&&d.validateForm()))return;const u=c.A.pickBy(l,C=>C.dirty);if(!c.A.isEmpty(u)){const C=c.A.keys(u).map(A=>({id:A,value:u[A].value}));p({id:r.id,setting:C})}};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(m.lV,{className:t.form,fieldSets:F,data:l,onChange:w,ref:n,footer:(0,o.jsx)("div",{className:t.formField,children:(0,o.jsx)(m.$n,{onClick:W,disabled:!b||_,children:"Save"})})}),(0,o.jsx)(V,{showTestWebhookModal:v,handleCloseModal:f,testWebhookData:S,isTestingWebhook:x})]})},K=()=>{const e=(0,T.er)(),i=(0,g.useMemo)(()=>{var r,n,l,a,v,h,b,f,k,p,_,S,x,y,F,w,W,d;return{"moduleSettings.webhook.enabled":{value:(l=(n=(r=e==null?void 0:e.settings)==null?void 0:r.moduleSettings)==null?void 0:n.webhook)==null?void 0:l.enabled,error:void 0},"moduleSettings.webhook.url":{value:(h=(v=(a=e==null?void 0:e.settings)==null?void 0:a.moduleSettings)==null?void 0:v.webhook)==null?void 0:h.url,error:void 0},"moduleSettings.webhook.method":{value:(k=(f=(b=e==null?void 0:e.settings)==null?void 0:b.moduleSettings)==null?void 0:f.webhook)==null?void 0:k.method,error:void 0},"moduleSettings.webhook.authHeader":{value:(S=(_=(p=e==null?void 0:e.settings)==null?void 0:p.moduleSettings)==null?void 0:_.webhook)==null?void 0:S.authHeader,error:void 0},"moduleSettings.webhook.dedicatedIp":{value:(F=(y=(x=e==null?void 0:e.settings)==null?void 0:x.moduleSettings)==null?void 0:y.webhook)==null?void 0:F.dedicatedIp,error:void 0},"moduleSettings.webhook.specificEvents":{value:(d=(W=(w=e==null?void 0:e.settings)==null?void 0:w.moduleSettings)==null?void 0:W.webhook)==null?void 0:d.specificEvents,error:void 0}}},[e]);return(0,o.jsxs)("div",{children:[(0,o.jsx)(P.A,{titleNode:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:t.header,children:"Webhook Settings"}),(0,o.jsx)("p",{className:t.description,children:"Configure Webhook settings"})]}),actionNode:(0,o.jsx)(o.Fragment,{})}),(0,o.jsx)("div",{className:t.body,children:(0,o.jsx)(z,{initialData:i})})]})}}}]);
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.