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