"use strict";(globalThis.webpackChunk_automattic_jetpack_forms=globalThis.webpackChunk_automattic_jetpack_forms||[]).push([[687],{87098(){},59202(e,t,s){s.r(t),s.d(t,{default:()=>j});var a=s(85985),i=s(94715),n=s(56427),o=s(47143),r=s(86087),c=s(27723),l=s(26257),p=s(74506),d=s(75517),m=s(42140),g=s(39650),h=s(76454),u=s(10790);const __=c.__;function j({attributes:e,setAttributes:t}){const[s,c]=(0,r.useState)(!1),j=(0,o.useSelect)(e=>e(d.Qf).getIntegrations()||[],[]),k=(0,o.useSelect)(e=>e(d.Qf).isIntegrationsLoading(),[]),{refreshIntegrations:f}=(0,o.useDispatch)(d.Qf),{tracks:_}=(0,a.st)(),b=(0,p.A)("showIntegrationIcons"),x=(0,r.useMemo)(()=>({ConsentToggle:g.A}),[]),v=e=>{_.recordEvent("jetpack_forms_block_modal_view",{entry_point:e}),c(!0)};return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(n.PanelBody,{title:__("Integrations","jetpack-forms"),className:"jetpack-contact-form__panel jetpack-contact-form__integrations-panel",initialOpen:!1,children:[!1!==b&&(0,u.jsx)(m.A,{integrations:j,attributes:e,isLoading:k}),(0,u.jsx)(n.Button,{variant:"secondary",onClick:()=>v("block-sidebar"),__next40pxDefaultSize:!0,children:__("Manage integrations","jetpack-forms")})]}),(0,u.jsx)(i.BlockControls,{children:(0,u.jsx)(n.ToolbarGroup,{children:(0,u.jsx)(n.ToolbarButton,{icon:l.A,onClick:()=>v("block-toolbar"),style:{paddingLeft:0},children:__("Integrations","jetpack-forms")})})}),(0,u.jsx)(h.A,{isOpen:s,onClose:()=>c(!1),attributes:e,setAttributes:t,integrationsData:j,refreshIntegrations:f,components:x})]})}},42140(e,t,s){s.d(t,{A:()=>c});var a=s(56427),i=s(27723),n=s(26257),o=s(72815),r=(s(87098),s(10790));const __=i.__;function c({integrations:e,attributes:t,isLoading:s}){const i=e.reduce((e,s)=>{switch(s.id){case"akismet":s.isConnected&&e.push(s);break;case"zero-bs-crm":s.isActive&&s.details?.hasExtension&&t.jetpackCRM&&e.push(s);break;case"mailpoet":s.isActive&&s.isConnected&&t.mailpoet?.enabledForForm&&e.push(s);break;case"hostinger-reach":s.isActive&&s.isConnected&&t.hostingerReach?.enabledForForm&&e.push(s);break;case"salesforce":t.salesforceData?.sendToSalesforce&&t.salesforceData?.organizationId&&(0,o.v)(t.salesforceData.organizationId)&&e.push(s)}return e},[]);return s?(0,r.jsx)("div",{className:"jetpack-forms-active-integrations",children:(0,r.jsx)(a.Spinner,{})}):i?.length?(0,r.jsx)("div",{className:"jetpack-forms-active-integrations",children:i.map(e=>(0,r.jsx)(a.Tooltip,{text:e.activeTooltip||e.title||"",children:(0,r.jsxs)("span",{className:"jetpack-forms-active-integrations__item",children:[e.iconUrl?(0,r.jsx)("img",{src:e.iconUrl,alt:e.title||e.id,width:30,height:30,className:"jetpack-forms-active-integrations__icon"}):(0,r.jsx)(a.Icon,{icon:n.A,size:30,className:"jetpack-forms-active-integrations__icon"}),(0,r.jsx)("span",{className:"jetpack-forms-active-integrations__status"})]})},e.id))}):(0,r.jsx)("p",{children:(0,r.jsx)("em",{children:__("Form does not have integrations set up.","jetpack-forms")})})}}}]);