1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[710],{90581:function(e){var t=Math.floor;e.exports=function(e,r){var n="";if(!e||r<1||r>9007199254740991)return n;do r%2&&(n+=e),(r=t(r/2))&&(e+=e);while(r);return n}},80396:function(e,t,r){var n=r(79867),a=r(78859);e.exports=function(e,t,r,s){return a(e,t,r(n(e,t)),s)}},62079:function(e,t,r){var n=r(31137);e.exports=function(e){return"function"==typeof e?e:n}},98052:function(e,t,r){var n=r(65567),a=r(76744);e.exports=function(e){return a(n(e).toLowerCase())}},43605:function(e,t,r){var n=r(98497),a=r(19785);e.exports=function(e,t,r,s){return null==e?[]:(a(t)||(t=null==t?[]:[t]),a(r=s?void 0:r)||(r=null==r?[]:[r]),n(e,t,r))}},62086:function(e,t,r){var n=r(90581),a=r(57535),s=r(47991),i=r(65567);e.exports=function(e,t,r){return t=(r?a(e,t,r):void 0===t)?1:s(t),n(i(e),t)}},94919:function(e,t,r){var n=r(91936),a=1/0;e.exports=function(e){return e?(e=n(e))===a||e===-a?(e<0?-1:1)*17976931348623157e292:e==e?e:0:0===e?e:0}},47991:function(e,t,r){var n=r(94919);e.exports=function(e){var t=n(e),r=t%1;return t==t?r?t-r:t:0}},91936:function(e,t,r){var n=r(74833),a=r(11611),s=r(55193),i=0/0,o=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,d=/^0o[0-7]+$/i,c=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(s(e))return i;if(a(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=a(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=l.test(e);return r||d.test(e)?c(e.slice(2),r?2:8):o.test(e)?i:+e}},90271:function(e,t,r){var n=r(80396),a=r(62079);e.exports=function(e,t,r){return null==e?e:n(e,t,a(r))}},62810:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/integrations",function(){return r(54154)}])},29883:function(e,t,r){"use strict";var n=r(24246),a=r(27378),s=r(98052),i=r.n(s),o=r(98585),l=r(15620),d=r(27693),c=r.n(d),u=r(46076);let Bar=e=>{let{timestamp:t,timespan:r,count:s,up_pct:i,down_pct:l,degraded_pct:d,maintenance_pct:f,defaultBackgroundColor:m}=e,[p,x]=a.useState(!1),h="",g="";0===s?(g="No data",h=m):l>=5?(g="Down ".concat((l||0).toFixed(0),"%"),h="bg-red-500"):d>=5?(g="Degraded ".concat((d||0).toFixed(0),"%"),h="bg-yellow-500"):f>=5?(g="Maintenance ".concat((f||0).toFixed(0),"%"),h="bg-blue-500"):(g="Operational ".concat((i||0).toFixed(0),"%"),h="bg-emerald-500");let v=c()(t).format("MMM DD, YYYY");return"hour"===r&&(v=c()(t).format("h:mm A"),c()(t).isBefore(c()(),"day")&&(v=c()(t).format("MMM DD, ")+v)),(0,n.jsxs)(o.fC,{open:p,onOpenChange:x,openDelay:0,closeDelay:0,children:[(0,n.jsx)(o.xz,{onClick:()=>x(!0),asChild:!0,children:(0,n.jsx)("div",{className:(0,u.cn)("h-full w-full rounded-[1px] first:rounded-l-[4px] last:rounded-r-[4px]",h||m)})}),(0,n.jsx)(o.h_,{children:(0,n.jsxs)(o.VY,{sideOffset:10,side:"top",align:"center",avoidCollisions:!0,className:(0,u.cn)("group relative min-w-52 max-w-64 rounded-md px-2 py-1 text-sm shadow-md","text-white dark:text-gray-900","bg-gray-900/70 dark:bg-gray-50"),children:[(0,n.jsxs)("div",{className:"flex space-x-2 p-2",children:[(0,n.jsx)("div",{className:"w-1 shrink-0 rounded ".concat(h),"aria-hidden":"true"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"font-medium",children:(0,n.jsxs)("div",{className:"focus:outline-none",tabIndex:"-1",children:[(0,n.jsx)("span",{className:"absolute inset-0","aria-hidden":"true"}),g]})}),(0,n.jsx)("p",{className:"mt-1 text-xs",children:v})]})]}),(0,n.jsx)(o.Eh,{style:{fill:"rgba(17, 24, 39, 0.7)"}})]})})]})},f=a.forwardRef((e,t)=>{let{data:r=[],defaultBackgroundColor:s="bg-gray-400 dark:bg-gray-400",className:o,...d}=e,[f,m]=a.useState(r);a.useEffect(()=>{m(r)},[r]);let p=0;f.length>1&&(p=f[1].timestamp-f[0].timestamp);let x=0;f.length>0&&(x=Math.floor((c()().valueOf()-(f[f.length-1].timestamp+p))/1e3/60));let h="day";if(f.length>0){let e=c()(f[0].timestamp),t=c()(f[f.length-1].timestamp),r=t.diff(e,"day");r<=2&&(h="hour")}return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{ref:t,className:(0,u.cn)("flex h-10 w-full items-center","gap-px lg:gap-0.5",o),...d,children:f.map((e,t)=>{var r;return(0,n.jsx)(Bar,{defaultBackgroundColor:s,timespan:h,...e},null!==(r=e.key)&&void 0!==r?r:t)})}),f.length>1&&(0,n.jsxs)("div",{className:"mt-2 flex justify-between items-center text-xs text-gray-400",children:[(0,n.jsx)("span",{children:c()().diff(c()(f[0].timestamp),"day")>2?c()().diff(c()(f[0].timestamp),"day")+" days ago":i()(c()(f[0].timestamp).fromNow())}),(0,n.jsx)(l.Z,{className:"flex-1 mx-3"}),(0,n.jsx)("span",{children:x<5?"Now":i()(c()(f[f.length-1].timestamp+p).fromNow())})]})]})});Bar.displayName="Bar",f.displayName="UptimeBar",t.Z=f},81549:function(e,t,r){"use strict";r.d(t,{z:function(){return d}});
1var n=r(24246),a=r(27378),s=r(54315),i=r(12430),o=r(46076);let l=(0,i.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",xs:"h-4 rounded-md px-3",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),d=a.forwardRef((e,t)=>{let{className:r,variant:a,size:i,asChild:d=!1,...c}=e,u=d?s.g7:"button";return(0,n.jsx)(u,{className:(0,o.cn)(l({variant:a,size:i,className:r})),ref:t,...c})});d.displayName="Button"},89351:function(e,t,r){"use strict";r.d(t,{Ol:function(){return o},SZ:function(){return d},Zb:function(){return i},aY:function(){return c},ll:function(){return l}});var n=r(24246),a=r(27378),s=r(46076);let i=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("div",{ref:t,className:(0,s.cn)("rounded-sm border bg-card text-card-foreground",r),...a})});i.displayName="Card";let o=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("div",{ref:t,className:(0,s.cn)("flex flex-col space-y-1 px-4 py-3",r),...a})});o.displayName="CardHeader";let l=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("h3",{ref:t,className:(0,s.cn)("text-2xl font-semibold leading-none tracking-tight",r),...a})});l.displayName="CardTitle";let d=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("p",{ref:t,className:(0,s.cn)("text-sm text-muted-foreground",r),...a})});d.displayName="CardDescription";let c=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("div",{ref:t,className:(0,s.cn)("px-4 pb-3 pt-0",r),...a})});c.displayName="CardContent";let u=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("div",{ref:t,className:(0,s.cn)("flex items-center px-4 pb-3 pt-0",r),...a})});u.displayName="CardFooter"},95449:function(e,t,r){"use strict";r.d(t,{NI:function(){return p},Wi:function(){return FormField},l0:function(){return d},lX:function(){return m},pf:function(){return x},xJ:function(){return f},zG:function(){return h}});var n=r(24246),a=r(27378),s=r(54315),i=r(88039),o=r(46076),l=r(43965);let d=i.RV,c=a.createContext({}),FormField=e=>{let{...t}=e;return(0,n.jsx)(c.Provider,{value:{name:t.name},children:(0,n.jsx)(i.Qr,{...t})})},useFormField=()=>{let e=a.useContext(c),t=a.useContext(u),{getFieldState:r,formState:n}=(0,i.Gc)(),s=r(e.name,n);if(!e)throw Error("useFormField should be used within <FormField>");let{id:o}=t;return{id:o,name:e.name,formItemId:"".concat(o,"-form-item"),formDescriptionId:"".concat(o,"-form-item-description"),formMessageId:"".concat(o,"-form-item-message"),...s}},u=a.createContext({}),f=a.forwardRef((e,t)=>{let{className:r,...s}=e,i=a.useId();return(0,n.jsx)(u.Provider,{value:{id:i},children:(0,n.jsx)("div",{ref:t,className:(0,o.cn)("space-y-2",r),...s})})});f.displayName="FormItem";let m=a.forwardRef((e,t)=>{let{className:r,...a}=e,{error:s,formItemId:i}=useFormField();return(0,n.jsx)(l._,{ref:t,className:(0,o.cn)(s&&"text-destructive",r),htmlFor:i,...a})});m.displayName="FormLabel";let p=a.forwardRef((e,t)=>{let{...r}=e,{error:a,formItemId:i,formDescriptionId:o,formMessageId:l}=useFormField();return(0,n.jsx)(s.g7,{ref:t,id:i,"aria-describedby":a?"".concat(o," ").concat(l):"".concat(o),"aria-invalid":!!a,...r})});p.displayName="FormControl";let x=a.forwardRef((e,t)=>{let{className:r,...a}=e,{formDescriptionId:s}=useFormField();return(0,n.jsx)("p",{ref:t,id:s,className:(0,o.cn)("text-sm text-muted-foreground",r),...a})});x.displayName="FormDescription";let h=a.forwardRef((e,t)=>
1{let{className:r,children:a,...s}=e,{error:i,formMessageId:l}=useFormField(),d=i?String(null==i?void 0:i.message):a;return d?(0,n.jsx)("p",{ref:t,id:l,className:(0,o.cn)("text-sm font-medium text-destructive",r),...s,children:d}):null});h.displayName="FormMessage"},23550:function(e,t,r){"use strict";r.d(t,{I:function(){return i}});var n=r(24246),a=r(27378),s=r(46076);let i=a.forwardRef((e,t)=>{let{className:r,type:a,...i}=e;return(0,n.jsx)("input",{type:a,className:(0,s.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus:border-gray-400 focus:ring-gray-100 disabled:cursor-not-allowed disabled:opacity-50",r),ref:t,...i})});i.displayName="Input"},43965:function(e,t,r){"use strict";r.d(t,{_:function(){return d}});var n=r(24246),a=r(27378),s=r(78166),i=r(12430),o=r(46076);let l=(0,i.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)(s.f,{ref:t,className:(0,o.cn)(l(),r),...a})});d.displayName=s.f.displayName},15620:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var n=r(24246),a=r(27378),s=r(35015),i=r(46076);let o=a.forwardRef((e,t)=>{let{className:r,orientation:a="horizontal",decorative:o=!0,...l}=e;return(0,n.jsx)(s.f,{ref:t,decorative:o,orientation:a,className:(0,i.cn)("shrink-0 bg-border","horizontal"===a?"h-[1px] w-full":"h-full w-[1px]",r),...l})});o.displayName=s.f.displayName},6183:function(e,t,r){"use strict";r.d(t,{r:function(){return o}});var n=r(24246),a=r(27378),s=r(3398),i=r(46076);let o=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)(s.fC,{className:(0,i.cn)("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-green-500 data-[state=unchecked]:bg-input",r),...a,ref:t,children:(0,n.jsx)(s.bU,{className:(0,i.cn)("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})})});o.displayName=s.fC.displayName},92543:function(e,t,r){"use strict";r.d(t,{RM:function(){return l},SC:function(){return c},iA:function(){return i},pj:function(){return f},ss:function(){return u},xD:function(){return o}});var n=r(24246),a=r(27378),s=r(46076);let i=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("div",{className:"relative w-full overflow-auto",children:(0,n.jsx)("table",{ref:t,className:(0,s.cn)("w-full caption-bottom text-sm",r),...a})})});i.displayName="Table";let o=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("thead",{ref:t,className:(0,s.cn)("[&_tr]:border-b",r),...a})});o.displayName="TableHeader";let l=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("tbody",{ref:t,className:(0,s.cn)("[&_tr:last-child]:border-0",r),...a})});l.displayName="TableBody";let d=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("tfoot",{ref:t,className:(0,s.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",r),...a})});d.displayName="TableFooter";let c=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("tr",{ref:t,className:(0,s.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",r),...a})});c.displayName="TableRow";let u=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("th",{ref:t,className:(0,s.cn)("h-8 rounded bg-muted px-3 text-left align-middle text-sm font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",r),...a})});u.displayName="TableHead";let f=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("td",{ref:t,className:(0,s.cn)("px-3 py-2 align-middle [&:has([role=checkbox])]:pr-0",r),...a})});f.displayName="TableCell";let m=a.forwardRef((e,t)=>
1{let{className:r,...a}=e;return(0,n.jsx)("caption",{ref:t,className:(0,s.cn)("mt-4 text-sm text-muted-foreground",r),...a})});m.displayName="TableCaption"},54154:function(e,t,r){"use strict";r.r(t),r.d(t,{__N_SSP:function(){return D},default:function(){return Integrations}});var n=r(24246),a=r(27378),s=r(23615),i=r.n(s),o=r(99729),l=r.n(o);r(43605);let d=a.forwardRef(function({title:e,titleId:t,...r},n){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},r),e?a.createElement("title",{id:t},e):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"}))});var c=r(73471);/** 2 * @license lucide-react v0.427.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */let u=(0,c.Z)("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]),f=(0,c.Z)("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);var m=r(75356),p=r(61181),x=r(81549),h=r(89351),g=r(6183),v=r(35225),b=r(27693),y=r(98052),j=r.n(y),w=r(62086);r(54760),r(92543),r(36701),r(57691),i().array,r(29883),r(11916),i().object;var N=r(37613),k=r(95449),C=r(2936),F=r(41993),S=r(88039),I=r(13575);function ModalConfigureIntegration(e){let{show:t,setShow:r,onSubmit:s,integration:i}=e,{org:o}=a.useContext(m.K),{user:d}=a.useContext(p.S),[c,u]=a.useState(null),f=(0,S.cI)({resolver:(0,F.F)(null==i?void 0:i.schema),defaultValues:l()(i,"config_json",{})});a.useEffect(()=>{i?f.reset(l()(i,"config_json",{})):f.reset()},[i]),a.useEffect(()=>{t||(u(null),f.reset())},[t]);let handleSubmit=async e=>{let t;(t=i&&i.id?await I.updateIntegration({orgId:o.id,token:d.token,id:i.id,data:{config_json:e}}):await I.createIntegration({orgId:o.id,token:d.token,data:{name:i.name,type:i.type,provider:i.provider,config_json:e}})).success?(r(!1),s&&s(t.data)):u(t.message)};return(0,n.jsx)(N.Vq,{onOpenChange:r,open:t,children:(0,n.jsxs)(N.cZ,{className:"sm:max-w-[600px]",children:[(0,n.jsxs)(N.fK,{children:[(0,n.jsxs)(N.$N,{children:["Configure ",null==i?void 0:i.name]}),(0,n.jsx)(N.Be,{children:null==i?void 0:i.description})]}),(0,n.jsx)(k.l0,{...f,children:(null==i?void 0:i.form)&&(0,n.jsx)(i.form,{integration:i,form:f,user:d,org:o})}),c&&(0,n.jsx)("div",{className:"bg-red-100 text-red-800 p-4 rounded",children:c}),(0,n.jsxs)("div",{className:"mt-8 flex justify-end gap-x-4",children:[(0,n.jsx)(x.z,{variant:"outline",onClick:()=>r(!1),children:"Close"}),(0,n.jsx)(x.z,{onClick:f.handleSubmit(handleSubmit,e=>{console.log("errors:",e)}),disabled:f.formState.isSubmitting,children:f.formState.isSubmitting?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(C.Z,{className:"animate-spin h-5 w-5 mr-2 text-white"}),"Saving..."]}):"Save"})]})]})})}ModalConfigureIntegration.propTypes={show:i().bool,setShow:i().func,onSubmit:i().func,integration:i().object};var R=r(55663),_=r.n(R),E=r(82558),T=r(23550);function FormEmail(e){let{integration:t,form:r,user:s,org:i}=e,[o,d]=a.useState(""),[c,u]=a.useState([]),[f,m]=a.useState(!1),updateFormValue=e=>{let t=e.reduce((e,t)=>(t.address=_()(t.address),e.push(t),e),[]);r.setValue("emails",t)},verify=async e=>{m(!0);try{let r=await I.updateIntegration({orgId:i.id,token:s.token,id:t.id,data:{config_json:{emails:e}}});if(!r.success)throw Error(r.message);r=await I.verifyIntegration({orgId:i.id,token:s.token,id:t.id}),u(r.data.config_json.emails),updateFormValue(r.data.config_json.emails)}finally{m(!1)}},remove=e=>{let t=c.filter((t,r)=>r!==e);u(t),updateFormValue(t)},append=async e=>{let t=[];if(c.filter(t=>t.address===e&&"removed"===t.status).length)t=c.map(t=>(t.address===e&&(t.status="pending"),t));else{if(c.filter(t=>t.address===e).length)return;t=[...c,{address:e,status:"pending"}]}await verify(t),d("")};return a.useEffect(()=>{u(r.watch("emails")||[])},[r.watch]),(0,n.jsxs)("div",{className:"flex flex-col divide-y",children:[c.filter(e=>"removed"!==e.status).map((e,t)=>(0,n.jsxs)("div",{className:"flex items-center justify-between py-4",children:[(0,n.jsx)("span",{children:e.address}),(0,n.jsx)("span",{className:"text-sm text-gray-500",children:j()(e.status)||"Pending"}),(0,n.jsx)("span",{children:(0,n.jsx)(x.z,{variant:"ghost",size:"xs",className:"px-0 text-muted-foreground hover:bg-transparent",onClick:()=>remove(t),type:"button",disabled:e.address===l()(s,"email"),children:(0,n.jsx)(E.Z,{className:"w-4 h-4 ml-1"})})})]},t)),(0,n.jsxs)("div",{className:"flex items-center justify-between gap-x-8 py-4",children:[(0,n.jsx)(T.I,{type:"email",placeholder:"[email protected]",onChange:e=>d(e.target.value),disabled:f}),(0,n.jsx)(x.z,{type:"submit",onClick:()=>{append(o)},disabled:!o||f||c.find(e=>e.address===o&&"removed"!==e.status)||!o.includes("@"),children:f?(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(C.Z,{className:"animate-spin h-5 w-5 text-white"})}):"Add Email"})]})]})}function FormWebhook(e){let{integration:t,form:r,user:s,org:i}=e,[o,l]=a.useState(!t),[d,c]=a.useState(t&&t.is_verified||!1),[u,f]=a.useState({}
6),[m,p]=a.useState(!1),updateFormValue=e=>{f({...u,endpoint:e}),r.setValue("endpoint",e)};return a.useEffect(()=>{f({...u||{},endpoint:r.watch("endpoint")||""})},[r.watch]),a.useEffect(()=>{t&&c(t.is_verified)},[t]),(0,n.jsx)("div",{className:"flex flex-col divide-y",children:(0,n.jsx)("div",{className:"flex items-center justify-between gap-x-4 py-4",children:(0,n.jsx)(T.I,{type:"email",placeholder:"https://example.com/webhook",value:u.endpoint||"",onChange:e=>updateFormValue(e.target.value),disabled:m})})})}FormEmail.propTypes={integration:i().object,form:i().object,user:i().object,org:i().object},r(90271),FormWebhook.propTypes={integration:i().object,form:i().object,user:i().object,org:i().object};var M=r(69804),O=r(84200);let P=[{name:"Email",provider:"email",type:"notification",description:"Add additional emails to send notifications to.",icon:u,form:FormEmail,schema:O.Ry({emails:O.IX(O.Ry({address:O.oQ.string().email(),status:O.Km(["pending","active","removed"])}))})},{name:"Webhook",provider:"webhook",type:"notification",description:"HTTP POST notifications to your server.",icon:f,form:FormWebhook,schema:O.Ry({endpoint:O.oQ.string().url().or(O.i0("")),method:O.Km(["GET","POST","PUT","DELETE"]).default("POST"),headers:O.IX(O.Ry({key:O.oQ.string(),value:O.oQ.string()})).optional(),last_tested_at:O.Rx().optional(),status:O.Km(["pending","verified"]).optional()})}];function IntegrationCard(e){let{integration:t,onClick:r,onActiveChange:a}=e;return(0,n.jsxs)(h.Zb,{className:"flex flex-col justify-between",children:[(0,n.jsxs)(h.Ol,{className:"p-4 space-y-4 pb-2",children:[t.icon?(0,n.jsx)("div",{className:"mx-auto flex-shrink-0 flex items-center justify-center h-14 w-14 rounded-lg border p-.5 sm:mx-0 sm:h-12 sm:w-12 bg-gray-50 shadow-sm",children:(0,n.jsx)(t.icon,{className:"h-10 w-10 text-gray-600","aria-hidden":"true"})}):(0,n.jsx)(n.Fragment,{}),(0,n.jsx)(h.ll,{className:"text-lg font-medium",children:t.name})]}),(0,n.jsxs)(h.aY,{className:"p-0 flex flex-grow flex-col justify-between",children:[(0,n.jsx)("p",{className:"p-4 text-sm",children:t.description}),(0,n.jsxs)("div",{className:"flex items-center justify-between border-t bg-gray-100",children:[(0,n.jsxs)(x.z,{variant:"outline",onClick:r,className:"m-2",children:[(0,n.jsx)(d,{className:"h-5 w-5 mr-2","aria-hidden":"true"}),t.config_json?"Update":"Configure"]}),t.config_json&&(0,n.jsx)(g.r,{className:"m-4",checked:t.is_active,onCheckedChange:a})]})]})]},t.name)}IntegrationCard.propTypes={integration:i().object,onClick:i().func,onActiveChange:i().func},Integrations.propTypes={_integrations:i().arrayOf(i().object)};var D=!0;function Integrations(e){let{_integrations:t}=e,{user:r}=a.useContext(p.S),{org:s}=a.useContext(m.K),[i,o]=a.useState(!1),[l,d]=a.useState(t||[]),[c,u]=a.useState(null),{toast:f}=(0,M.pm)(),onActiveChange=async(e,t)=>{d(l.map(r=>(r.id===e&&(r.is_active=t),r)));let n=await I.updateIntegration({orgId:s.id,token:r.token,id:e,data:{is_active:t}});n.success||f({description:n.message,variant:"destructive"})};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(v.Z,{children:[(0,n.jsxs)("div",{className:"my-4",children:[(0,n.jsx)("h1",{className:"text-gray-800 text-3xl font-semibold",children:"Integrations"}),(0,n.jsx)("span",{className:"text-gray-500",children:"Connect with your favorite services to receive notifications where you need them."})]}),(0,n.jsx)("div",{className:"mt-12 grid grid-cols-3 gap-8",children:P.map(e=>{let t=l.find(t=>e.provider===t.provider)||{};return(0,n.jsx)(IntegrationCard,{integration:{...e,...t},onClick:()=>{u({...e,...t}),o(!0)},onActiveChange:e=>onActiveChange(null==t?void 0:t.id,e)},e.name)})})]}),(0,n.jsx)(ModalConfigureIntegration,{show:i,setShow:e=>{o(e),e||u(null)},integration:c,onSubmit:e=>{d(l.find(t=>t.id===e.id)?l.map(t=>t.id===e.id?e:t):[...l,e])}})]})}},3398:function(e,t,r){"use strict";r.d(t,{bU:function(){return j},fC:function(){return y}});var n=r(27378),a=r(76949),s=r(62921),i=r(13958),o=r(37517),l=r(68464),d=r(40261),c=r(23392),u=r(24246),f="Switch",[m,p]=(0,i.b)(f),[x,h]=m(f),g=n.forwardRef((e,t)=>{let{__scopeSwitch:r,name:i,checked:l,defaultChecked:d,required:f,disabled:m,value:p="on",onCheckedChange:h,form:g,...v}=e,[b,y]=n.useState(null),j=(0,s.e)(t,e=>y(e)),w=n.useRef(!1),N=!b||g||!!b.closest("form"),[k=!1,C]=(0,o.T)({prop:l,defaultProp:d,onChange:h});return(0,u.jsxs)(x,{scope:r,checked:k,disabled:m,children:[(0,u.jsx)(c.WV.button,{type:"button",role:"switch","aria-checked":k,"aria-required":f,"data-state":getState(k),"data-disabled":m?"":void 0,disabled:m,value:p,...v,ref:j,onClick:(0,a.M)(e.onClick,e=>{C(e=>!e),N&&(w.current=e.isPropagationStopped(),w.current||e.stopPropagation())})}),N&&(0,u.jsx)(BubbleInput,{control:b,bubbles:!w.current,name:i,value:p,checked:k,required:f,disabled:m,form:g,style:{transform:"translateX(-100%)"}})]})});g.displayName=f;var v="SwitchThumb",b=n.forwardRef((e,t)=>
6{let{__scopeSwitch:r,...n}=e,a=h(v,r);return(0,u.jsx)(c.WV.span,{"data-state":getState(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t})});b.displayName=v;var BubbleInput=e=>{let{control:t,checked:r,bubbles:a=!0,...s}=e,i=n.useRef(null),o=(0,l.D)(r),c=(0,d.t)(t);return n.useEffect(()=>{let e=i.current,t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked"),s=n.set;if(o!==r&&s){let t=new Event("click",{bubbles:a});s.call(e,r),e.dispatchEvent(t)}},[o,r,a]),(0,u.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:i,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function getState(e){return e?"checked":"unchecked"}var y=g,j=b},68464:function(e,t,r){"use strict";r.d(t,{D:function(){return usePrevious}});var n=r(27378);function usePrevious(e){let t=n.useRef({value:e,previous:e});return n.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}}},function(e){e.O(0,[357,604,768,774,888,179],function(){return e(e.s=62810)}),_N_E=e.O()}]);
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.