"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[1356,4759,7320],{7320:(t,e,i)=>{i.r(e),i.d(e,{default:()=>a});var s=i(29243),r=i(86087),c=i(10790);const a=(0,r.memo)(({label:t,id:e,value:i,onChange:r,required:a,defaultValue:n,disabled:l,options:d={}})=>(0,c.jsx)(s.bL,{disabled:l&&!Array.isArray(l),className:"cmplz-input-group cmplz-radio-group",value:i,"aria-label":t,onValueChange:r,required:a,default:n,children:Object.entries(d).map(([t,i])=>(0,c.jsxs)("div",{className:"cmplz-radio-group__item",children:[(0,c.jsx)(s.q7,{disabled:Array.isArray(l)&&l.includes(t),value:t,id:e+"_"+t,children:(0,c.jsx)(s.C1,{className:"cmplz-radio-group__indicator"})}),(0,c.jsx)("label",{className:"cmplz-radio-label",htmlFor:e+"_"+t,children:i})]},t))}))},31356:(t,e,i)=>{i.r(e),i.d(e,{default:()=>n});var s=i(7320),r=i(27723),c=i(34759),a=i(10790);const n=t=>{const{setScript:e,fetching:i}=(0,c.default)(),n=t.script,l={statistics:(0,r.__)("Statistics","complianz-gdpr"),marketing:(0,r.__)("Marketing","complianz-gdpr")};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("label",{children:(0,r.__)("Category","complianz-gdpr")}),(0,a.jsx)(s.default,{disabled:i,label:(0,r.__)("Marketing","complianz-gdpr"),id:"category",value:n.category,onChange:i=>(i=>{let s={...n};s.category=i,e(s,t.type)})(i),defaultValue:"marketing",options:l})]})}},34759:(t,e,i)=>{i.r(e),i.d(e,{default:()=>a});var s=i(81621),r=i(16535),c=i(9588);const a=(0,s.vt)((t,e)=>({integrationsLoaded:!1,fetching:!1,services:[],plugins:[],scripts:[],placeholders:[],blockedScripts:[],setScript:(e,i)=>{t((0,r.Ay)(t=>{if("block_script"===i){let i=t.blockedScripts;if(e.urls){for(const[t,s]of Object.entries(e.urls)){if(!s||0===s.length)continue;let t=!1;for(const[e,r]of Object.entries(i))s===e&&(t=!0);t||(i[s]=s)}t.blockedScripts=i}}const s=t.scripts[i].findIndex(t=>t.id===e.id);-1!==s&&(t.scripts[i][s]=e)}))},fetchIntegrationsData:async()=>{if(e().fetching)return;t({fetching:!0});const{services:i,plugins:s,scripts:r,placeholders:c,blocked_scripts:a}=await n();let l=r;l.block_script&&l.block_script.length>0&&l.block_script.forEach((t,e)=>{t.id=e}),l.add_script&&l.add_script.length>0&&l.add_script.forEach((t,e)=>{t.id=e}),l.whitelist_script&&l.whitelist_script.length>0&&l.whitelist_script.forEach((t,e)=>{t.id=e}),t(()=>({integrationsLoaded:!0,services:i,plugins:s,scripts:l,fetching:!1,placeholders:c,blockedScripts:a}))},addScript:i=>{t({fetching:!0}),e().scripts[i]&&Array.isArray(e().scripts[i])||t((0,r.Ay)(t=>{t.scripts[i]=[]})),t((0,r.Ay)(t=>{t.scripts[i].push({name:"general",id:t.scripts[i].length,enable:!0})}));let s=e().scripts;return c.doAction("update_scripts",{scripts:s}).then(e=>(t({fetching:!1}),e)).catch(t=>{console.error(t)})},saveScript:(i,s)=>{t({fetching:!0}),e().scripts[s]&&Array.isArray(e().scripts[s])||t((0,r.Ay)(t=>{t.scripts[s]=[]})),t((0,r.Ay)(t=>{const e=t.scripts[s].findIndex(t=>t.id===i.id);-1!==e&&(t.scripts[s][e]=i)}));let a=e().scripts;return c.doAction("update_scripts",{scripts:a}).then(e=>(t({fetching:!1}),e)).catch(t=>{console.error(t)})},deleteScript:(i,s)=>{t({fetching:!0}),e().scripts[s]&&Array.isArray(e().scripts[s])||t((0,r.Ay)(t=>{t.scripts[s]=[]})),t((0,r.Ay)(t=>{const e=t.scripts[s].findIndex(t=>t.id===i.id);-1!==e&&t.scripts[s].splice(e,1)}));let a=e().scripts;return c.doAction("update_scripts",{scripts:a}).then(e=>(t({fetching:!1}),e)).catch(t=>{console.error(t)})},updatePluginStatus:async(e,i)=>{t({fetching:!0}),t((0,r.Ay)(t=>{const s=t.plugins.findIndex(t=>t.id===e);-1!==s&&(t.plugins[s].enabled=i)}));const s=await c.doAction("update_plugin_status",{plugin:e,enabled:i}).then(t=>t).catch(t=>{console.error(t)});return t({fetching:!1}),s},updatePlaceholderStatus:async(e,i,s)=>{t({fetching:!0}),s&&t((0,r.Ay)(t=>{const s=t.plugins.findIndex(t=>t.id===e);-1!==s&&(t.plugins[s].placeholder=i?"enabled":"disabled")}));const a=await c.doAction("update_placeholder_status",{id:e,enabled:i}).then(t=>t).catch(t=>{console.error(t)});return t({fetching:!1}),a}})),n=()=>c.doAction("get_integrations_data",{}).then(t=>t).catch(t=>{console.error(t)})}}]);