"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[2010,3254,4759],{34759:(e,s,t)=>{t.r(s),t.d(s,{default:()=>n});var i=t(81621),c=t(16535),r=t(9588);const n=(0,i.vt)(((e,s)=>({integrationsLoaded:!1,fetching:!1,services:[],plugins:[],scripts:[],placeholders:[],blockedScripts:[],setScript:(s,t)=>{e((0,c.Ay)((e=>{if("block_script"===t){let t=e.blockedScripts;if(s.urls){for(const[e,i]of Object.entries(s.urls)){if(!i||0===i.length)continue;let e=!1;for(const[s,c]of Object.entries(t))i===s&&(e=!0);e||(t[i]=i)}e.blockedScripts=t}}const i=e.scripts[t].findIndex((e=>e.id===s.id));-1!==i&&(e.scripts[t][i]=s)})))},fetchIntegrationsData:async()=>{if(s().fetching)return;e({fetching:!0});const{services:t,plugins:i,scripts:c,placeholders:r,blocked_scripts:n}=await l();let a=c;a.block_script&&a.block_script.length>0&&a.block_script.forEach(((e,s)=>{e.id=s})),a.add_script&&a.add_script.length>0&&a.add_script.forEach(((e,s)=>{e.id=s})),a.whitelist_script&&a.whitelist_script.length>0&&a.whitelist_script.forEach(((e,s)=>{e.id=s})),e((()=>({integrationsLoaded:!0,services:t,plugins:i,scripts:a,fetching:!1,placeholders:r,blockedScripts:n})))},addScript:t=>{e({fetching:!0}),s().scripts[t]&&Array.isArray(s().scripts[t])||e((0,c.Ay)((e=>{e.scripts[t]=[]}))),e((0,c.Ay)((e=>{e.scripts[t].push({name:"general",id:e.scripts[t].length,enable:!0})})));let i=s().scripts;return r.doAction("update_scripts",{scripts:i}).then((s=>(e({fetching:!1}),s))).catch((e=>{console.error(e)}))},saveScript:(t,i)=>{e({fetching:!0}),s().scripts[i]&&Array.isArray(s().scripts[i])||e((0,c.Ay)((e=>{e.scripts[i]=[]}))),e((0,c.Ay)((e=>{const s=e.scripts[i].findIndex((e=>e.id===t.id));-1!==s&&(e.scripts[i][s]=t)})));let n=s().scripts;return r.doAction("update_scripts",{scripts:n}).then((s=>(e({fetching:!1}),s))).catch((e=>{console.error(e)}))},deleteScript:(t,i)=>{e({fetching:!0}),s().scripts[i]&&Array.isArray(s().scripts[i])||e((0,c.Ay)((e=>{e.scripts[i]=[]}))),e((0,c.Ay)((e=>{const s=e.scripts[i].findIndex((e=>e.id===t.id));-1!==s&&e.scripts[i].splice(s,1)})));let n=s().scripts;return r.doAction("update_scripts",{scripts:n}).then((s=>(e({fetching:!1}),s))).catch((e=>{console.error(e)}))},updatePluginStatus:async(s,t)=>{e({fetching:!0}),e((0,c.Ay)((e=>{const i=e.plugins.findIndex((e=>e.id===s));-1!==i&&(e.plugins[i].enabled=t)})));const i=await r.doAction("update_plugin_status",{plugin:s,enabled:t}).then((e=>e)).catch((e=>{console.error(e)}));return e({fetching:!1}),i},updatePlaceholderStatus:async(s,t,i)=>{e({fetching:!0}),i&&e((0,c.Ay)((e=>{const i=e.plugins.findIndex((e=>e.id===s));-1!==i&&(e.plugins[i].placeholder=t?"enabled":"disabled")})));const n=await r.doAction("update_placeholder_status",{id:s,enabled:t}).then((e=>e)).catch((e=>{console.error(e)}));return e({fetching:!1}),n}}))),l=()=>r.doAction("get_integrations_data",{}).then((e=>e)).catch((e=>{console.error(e)}))},43254:(e,s,t)=>{t.r(s),t.d(s,{default:()=>d});var i=t(27723),c=t(86087),r=t(52010),n=t(34759),l=t(4219),a=t(10790);const d=(0,c.memo)((()=>{const{services:e,integrationsLoaded:s,plugins:t,fetchIntegrationsData:d}=(0,n.default)(),[o,p]=(0,c.useState)([]),{fields:u,getField:h}=(0,l.default)();(0,c.useEffect)((()=>{s||d()}),[s]),(0,c.useEffect)((()=>{_()}),[u,s]);const _=()=>{let s=[...e];s.forEach((function(e,t){let i={...e},c=h(e.source);if("multicheckbox"===c.type){let s=c.value;Array.isArray(s)||(s=[]),i.enabled=s.includes(e.id)}else i.enabled="yes"===c.value;s[t]=i})),s=s.filter((e=>e.enabled)),p(s)},f=e=>Array.isArray(e)?e.map(((e,s)=>(0,a.jsx)("div",{children:e.label},s))):null;let g=Array.isArray(o)?o.length:0,m=Array.isArray(t)?t.length:0;return(0,a.jsx)("div",{className:"cmplz-plugins_overview",children:(0,a.jsxs)("div",{className:"cmplz-panel__list",children:[(0,a.jsx)(r.default,{summary:(0,i.__)("We found %s active plugin integrations","complianz-gdpr").replace("%s",m),details:f(t),icon:"plugin"}),(0,a.jsx)(r.default,{summary:(0,i.__)("We found %s active service integrations","complianz-gdpr").replace("%s",g),details:f(o),icon:"services"})]})})}))},52010:(e,s,t)=>{t.r(s),t.d(s,{default:()=>n});var i=t(45111),c=t(86087),r=t(10790);const n=e=>{const[s,t]=(0,c.useState)(!1);return(0,r.jsx)("div",{className:"cmplz-panel__list__item",style:e.style?e.style:{},children:(0,r.jsxs)("details",{open:s,children:[(0,r.jsxs)("summary",{onClick:e=>(e=>{e.preventDefault(),t(!s)})(e),children:[e.icon&&(0,r.jsx)(i.default,{name:e.icon}),(0,r.jsx)("h5",{className:"cmplz-panel__list__item__title",children:e.summary}),(0,r.jsx)("div",{className:"cmplz-panel__list__item__comment",children:e.comment}),(0,r.jsx)("div",{className:"cmplz-panel__list__item__icons",children:e.icons}),(0,r.jsx)(i.default,{name:"chevron-down",size:18})]}),(0,r.jsx)("div",{className:"cmplz-panel__list__item__details",children:s&&e.details})]})})}}}]);