/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements. * Licensed under the Elastic License 2.0; you may not use this file except in compliance with the Elastic License 2.0. */ (window.cases_bundle_jsonpfunction=window.cases_bundle_jsonpfunction||[]).push([[14],{145:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));const a={jira:["jira"],resilient:["resilient"],servicenow:["servicenow"],jiraGetFieldsByIssueType:(e,t)=>[...a.jira,e,"getFields",t],jiraGetIssueTypes:e=>[...a.jira,e,"getIssueType"],jiraGetIssues:(e,t)=>[...a.jira,e,"getIssues",t],resilientGetIncidentTypes:e=>[...a.resilient,e,"getIncidentTypes"],resilientGetSeverity:e=>[...a.resilient,e,"getSeverity"],servicenowGetChoices:(e,t)=>[...a.servicenow,e,"getChoices",t]}},147:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));const a=({connector_id:e,service_message:t,...n})=>({...n,actionId:e,...t&&{serviceMessage:t}})},152:function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var a=n(2),l=n.n(a),i=n(15),o=n(1);const s=o.i18n.translate("xpack.cases.connectors.serviceNow.deprecatedConnectorWarningTitle",{defaultMessage:"This connector type is deprecated"}),r=o.i18n.translate("xpack.cases.connectors.serviceNow.deprecatedConnectorWarningDesc",{defaultMessage:"Update this connector, or create a new one."}),c=({type:e="warning"})=>l.a.createElement(i.EuiCallOut,{title:s,color:e,iconType:"warning","data-test-subj":"deprecated-connector-warning-callout"},r);c.displayName="DeprecatedCallout";const u=l.a.memo(c)},162:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));const a=e=>e.map((e=>({value:e.value,text:e.label})))},164:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var a=n(43),l=n(44),i=n(145),o=n(78),s=n(147),r=n(151);const c=({http:e,connector:t,fields:n})=>{var c;const{showErrorToast:u}=Object(l.a)();return Object(a.useQuery)(i.a.servicenowGetChoices(null!==(c=null==t?void 0:t.id)&&void 0!==c?c:"",n),(({signal:a})=>{var l;return async function({http:e,connectorId:t,fields:n,signal:a}){const l=await e.post(Object(o.b)(t),{body:JSON.stringify({params:{subAction:"getChoices",subActionParams:{fields:n}}}),signal:a});return Object(s.a)(l)}({http:e,signal:a,connectorId:null!==(l=null==t?void 0:t.id)&&void 0!==l?l:"",fields:n})}),{enabled:Boolean(t),staleTime:6e4,onSuccess:e=>{var t;e.status&&"error"===e.status&&u(new Error(r.d),{title:r.d,toastMessage:`${null!==(t=e.serviceMessage)&&void 0!==t?t:e.message}`})},onError:e=>{u(e,{title:r.d})}})}},329:function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return b}));var a=n(2),l=n.n(a),i=n(15),o=n(129),s=n(131),r=n(5),c=n(164),u=n(162),d=n(151),p=n(152);const m=["category","subcategory","priority"],g={category:[],subcategory:[],priority:[]},b=({connector:e})=>{var t;const n=Object(o.useFormContext)(),[{fields:b}]=Object(o.useFormData)(),{category:f=null}=null!=b?b:{},{http:E}=Object(r.g)().services,F=e.isDeprecated,{isLoading:h,isFetching:y,data:j}=Object(c.a)({http:E,connector:e,fields:m}),v=h||y,x=(null!==(t=null==j?void 0:j.data)&&void 0!==t?t:[]).reduce(((e,t)=>({...e,[t.element]:[...null!=e[t.element]?e[t.element]:[],t]})),g),I=Object(a.useMemo)((()=>Object(u.a)(x.category)),[x.category]),w=Object(a.useMemo)((()=>Object(u.a)(x.priority)),[x.priority]),C=Object(a.useMemo)((()=>Object(u.a)(x.subcategory.filter((e=>e.dependent_value===f)))),[x.subcategory,f]);return l.a.createElement(l.a.Fragment,null,F&&l.a.createElement(i.EuiFlexGroup,null,l.a.createElement(i.EuiFlexItem,null,l.a.createElement(p.a,null))),l.a.createElement(i.EuiFlexGroup,{"data-test-subj":"connector-fields-sn-sir",direction:"column",gutterSize:"s"},l.a.createElement(i.EuiFlexGroup,null,l.a.createElement(i.EuiFlexItem,null,l.a.createElement(i.EuiFormRow,{fullWidth:!0,label:d.a},l.a.createElement(l.a.Fragment,null,l.a.createElement(i.EuiFlexGroup,null,l.a.createElement(i.EuiFlexItem,null,l.a.createElement(o.UseField,{path:"fields.destIp",config:{defaultValue:!0},component:s.CheckBoxField,componentProps:{euiFieldProps:{"data-test-subj":"destIpCheckbox",label:d.e,compressed:!0}}})),l.a.createElement(i.EuiFlexItem,null,l.a.createElement(o.UseField,{path:"fields.sourceIp",config:{defaultValue:!0},component:s.CheckBoxField,componentProps:{euiFieldProps:{"data-test-subj":"sourceIpCheckbox",label:d.k,compressed:!0}}}))),l.a.createElement(i.EuiFlexGroup,null,l.a.createElement(i.EuiFlexItem,null,l.a.createElement(o.UseField,{path:"fields.malwareUrl",config:{defaultValue:!0},component:s.CheckBoxField,componentProps:{euiFieldProps:{"data-test-subj":"malwareUrlCheckbox",label:d.h,compressed:!0}}})),l.a.createElement(i.EuiFlexItem,null,l.a.createElement(o.UseField,{path:"fields.malwareHash",config:{defaultValue:!0},component:s.CheckBoxField,componentProps:{euiFieldProps:{"data-test-subj":"malwareHashCheckbox",label:d.g,compressed:!0}}}))))))),l.a.createElement(i.EuiFlexGroup,null,l.a.createElement(i.EuiFlexItem,null,l.a.createElement(o.UseField,{path:"fields.priority",component:s.SelectField,config:{label:d.i},componentProps:{euiFieldProps:{"data-test-subj":"prioritySelect",options:w,hasNoInitialSelection:!0,fullWidth:!0,disabled:v,isLoading:v}}}))),l.a.createElement(i.EuiFlexGroup,null,l.a.createElement(i.EuiFlexItem,null,l.a.createElement(o.UseField,{path:"fields.category",component:s.SelectField,config:{label:d.c},onChange:()=>{n.setFieldValue("fields.subcategory",null)},componentProps:{euiFieldProps:{"data-test-subj":"categorySelect",options:I,hasNoInitialSelection:!0,fullWidth:!0,disabled:v,isLoading:v}}})),l.a.createElement(i.EuiFlexItem,null,l.a.createElement(o.UseField,{path:"fields.subcategory",component:s.SelectField,config:{label:d.l},componentProps:{euiFieldProps:{"data-test-subj":"subcategorySelect",options:C,hasNoInitialSelection:!0,fullWidth:!0,disabled:v,isLoading:v}}})))))};b.displayName="ServiceNowSIRFieldsComponent"}}]);