"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[1724,5080,9056],{35080:(e,t,s)=>{s.r(t),s.d(t,{default:()=>n});var c=s(30809),i=s(524),r=s(61744);const n=(0,c.Su)(((e,t)=>({integrationsLoaded:!1,fetching:!1,services:[],plugins:[],scripts:[],placeholders:[],blockedScripts:[],setScript:(t,s)=>{e((0,i.cp)((e=>{if("block_script"===s){let s=e.blockedScripts;if(t.urls){for(const[e,c]of Object.entries(t.urls)){if(!c||0===c.length)continue;let e=!1;for(const[t,i]of Object.entries(s))c===t&&(e=!0);e||(s[c]=c)}e.blockedScripts=s}}const c=e.scripts[s].findIndex((e=>e.id===t.id));-1!==c&&(e.scripts[s][c]=t)})))},fetchIntegrationsData:async()=>{if(t().fetching)return;e({fetching:!0});const{services:s,plugins:c,scripts:i,placeholders:r,blocked_scripts:n}=await a();let l=i;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:c,scripts:l,fetching:!1,placeholders:r,blockedScripts:n})))},addScript:s=>{e({fetching:!0}),t().scripts[s]&&Array.isArray(t().scripts[s])||e((0,i.cp)((e=>{e.scripts[s]=[]}))),e((0,i.cp)((e=>{e.scripts[s].push({name:"general",id:e.scripts[s].length,enable:!0})})));let c=t().scripts;return r.doAction("update_scripts",{scripts:c}).then((t=>(e({fetching:!1}),t))).catch((e=>{console.error(e)}))},saveScript:(s,c)=>{e({fetching:!0}),t().scripts[c]&&Array.isArray(t().scripts[c])||e((0,i.cp)((e=>{e.scripts[c]=[]}))),e((0,i.cp)((e=>{const t=e.scripts[c].findIndex((e=>e.id===s.id));-1!==t&&(e.scripts[c][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,c)=>{e({fetching:!0}),t().scripts[c]&&Array.isArray(t().scripts[c])||e((0,i.cp)((e=>{e.scripts[c]=[]}))),e((0,i.cp)((e=>{const t=e.scripts[c].findIndex((e=>e.id===s.id));-1!==t&&e.scripts[c].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,i.cp)((e=>{const c=e.plugins.findIndex((e=>e.id===t));-1!==c&&(e.plugins[c].enabled=s)})));const c=await r.doAction("update_plugin_status",{plugin:t,enabled:s}).then((e=>e)).catch((e=>{console.error(e)}));return e({fetching:!1}),c},updatePlaceholderStatus:async(t,s,c)=>{e({fetching:!0}),c&&e((0,i.cp)((e=>{const c=e.plugins.findIndex((e=>e.id===t));-1!==c&&(e.plugins[c].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)}))},79056:(e,t,s)=>{s.r(t),s.d(t,{default:()=>n});var c=s(51280),i=s(15832),r=s(88496);const n=e=>{const[t,s]=(0,r.useState)(!1);return(0,c.createElement)("div",{className:"cmplz-panel__list__item",style:e.style?e.style:{}},(0,c.createElement)("details",{open:t},(0,c.createElement)("summary",{onClick:e=>(e=>{e.preventDefault(),s(!t)})(e)},e.icon&&(0,c.createElement)(i.default,{name:e.icon}),(0,c.createElement)("h5",{className:"cmplz-panel__list__item__title"},e.summary),(0,c.createElement)("div",{className:"cmplz-panel__list__item__comment"},e.comment),(0,c.createElement)("div",{className:"cmplz-panel__list__item__icons"},e.icons),(0,c.createElement)(i.default,{name:"chevron-down",size:18})),(0,c.createElement)("div",{className:"cmplz-panel__list__item__details"},t&&e.details)))}},71724:(e,t,s)=>{s.r(t),s.d(t,{default:()=>p});var c=s(51280),i=s(93396),r=s(88496),n=s(79056),a=s(35080),l=s(25536);const p=(0,r.memo)((()=>{const{services:e,integrationsLoaded:t,plugins:s,fetchIntegrationsData:p}=(0,a.default)(),[d,o]=(0,r.useState)([]),{fields:u,getField:h}=(0,l.default)();(0,r.useEffect)((()=>{t||p()}),[t]),(0,r.useEffect)((()=>{_()}),[u,t]);const _=()=>{let t=[...e];t.forEach((function(e,s){let c={...e},i=h(e.source);if("multicheckbox"===i.type){let t=i.value;Array.isArray(t)||(t=[]),c.enabled=t.includes(e.id)}else c.enabled="yes"===i.value;t[s]=c})),t=t.filter((e=>e.enabled)),o(t)},m=e=>Array.isArray(e)?e.map(((e,t)=>(0,c.createElement)("div",{key:t},e.label))):null;let f=Array.isArray(d)?d.length:0,g=Array.isArray(s)?s.length:0;return(0,c.createElement)("div",{className:"cmplz-plugins_overview"},(0,c.createElement)("div",{className:"cmplz-panel__list"},(0,c.createElement)(n.default,{summary:(0,i.__)("We found %s active plugin integrations","complianz-gdpr").replace("%s",g),details:m(s),icon:"plugin"}),(0,c.createElement)(n.default,{summary:(0,i.__)("We found %s active service integrations","complianz-gdpr").replace("%s",f),details:m(d),icon:"services"})))}))}}]);