"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[4078,2489,4759,2921],{32489:(e,t,s)=>{s.r(t),s.d(t,{default:()=>i});var r=s(86087),c=s(51609);const i=(0,c.memo)((({value:e,onChange:t,required:s,disabled:i,id:n,name:l,placeholder:a})=>{const o=n||l,[p,d]=(0,c.useState)("");return(0,c.useEffect)((()=>{d(e||"")}),[e]),(0,c.useEffect)((()=>{if(e===p)return;const s=setTimeout((()=>{t(p)}),400);return()=>{clearTimeout(s)}}),[p]),(0,r.createElement)("div",{className:"cmplz-input-group cmplz-text-input-group"},(0,r.createElement)("input",{type:"text",id:o,name:l,value:p,onChange:e=>(e=>{d(e)})(e.target.value),required:s,disabled:i,className:"cmplz-text-input-group__input",placeholder:a}))}))},34759:(e,t,s)=>{s.r(t),s.d(t,{default:()=>n});var r=s(81621),c=s(16535),i=s(9588);const n=(0,r.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,r]of Object.entries(t.urls)){if(!r||0===r.length)continue;let e=!1;for(const[t,c]of Object.entries(s))r===t&&(e=!0);e||(s[r]=r)}e.blockedScripts=s}}const r=e.scripts[s].findIndex((e=>e.id===t.id));-1!==r&&(e.scripts[s][r]=t)})))},fetchIntegrationsData:async()=>{if(t().fetching)return;e({fetching:!0});const{services:s,plugins:r,scripts:c,placeholders:i,blocked_scripts:n}=await l();let a=c;a.block_script&&a.block_script.length>0&&a.block_script.forEach(((e,t)=>{e.id=t})),a.add_script&&a.add_script.length>0&&a.add_script.forEach(((e,t)=>{e.id=t})),a.whitelist_script&&a.whitelist_script.length>0&&a.whitelist_script.forEach(((e,t)=>{e.id=t})),e((()=>({integrationsLoaded:!0,services:s,plugins:r,scripts:a,fetching:!1,placeholders:i,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 r=t().scripts;return i.doAction("update_scripts",{scripts:r}).then((t=>(e({fetching:!1}),t))).catch((e=>{console.error(e)}))},saveScript:(s,r)=>{e({fetching:!0}),t().scripts[r]&&Array.isArray(t().scripts[r])||e((0,c.Ay)((e=>{e.scripts[r]=[]}))),e((0,c.Ay)((e=>{const t=e.scripts[r].findIndex((e=>e.id===s.id));-1!==t&&(e.scripts[r][t]=s)})));let n=t().scripts;return i.doAction("update_scripts",{scripts:n}).then((t=>(e({fetching:!1}),t))).catch((e=>{console.error(e)}))},deleteScript:(s,r)=>{e({fetching:!0}),t().scripts[r]&&Array.isArray(t().scripts[r])||e((0,c.Ay)((e=>{e.scripts[r]=[]}))),e((0,c.Ay)((e=>{const t=e.scripts[r].findIndex((e=>e.id===s.id));-1!==t&&e.scripts[r].splice(t,1)})));let n=t().scripts;return i.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 r=e.plugins.findIndex((e=>e.id===t));-1!==r&&(e.plugins[r].enabled=s)})));const r=await i.doAction("update_plugin_status",{plugin:t,enabled:s}).then((e=>e)).catch((e=>{console.error(e)}));return e({fetching:!1}),r},updatePlaceholderStatus:async(t,s,r)=>{e({fetching:!0}),r&&e((0,c.Ay)((e=>{const r=e.plugins.findIndex((e=>e.id===t));-1!==r&&(e.plugins[r].placeholder=s?"enabled":"disabled")})));const n=await i.doAction("update_placeholder_status",{id:t,enabled:s}).then((e=>e)).catch((e=>{console.error(e)}));return e({fetching:!1}),n}}))),l=()=>i.doAction("get_integrations_data",{}).then((e=>e)).catch((e=>{console.error(e)}))},44078:(e,t,s)=>{s.r(t),s.d(t,{default:()=>p});var r=s(86087),c=s(27723),i=s(32921),n=s(32489),l=s(45111),a=s(34759),o=s(51609);const p=e=>{const{setScript:t,fetching:s}=(0,a.default)(),[p,d]=(0,o.useState)(!1),u=e.script,h=e.type;(0,o.useEffect)((()=>{(u.hasOwnProperty("urls")?Object.values(u.urls):[""]).includes("")?d(!0):d(!1)}),[u]);let g=u.hasOwnProperty("urls")?Object.entries(u.urls):[""];return(0,r.createElement)("div",{className:"cmplz-details-row"},(0,r.createElement)("label",null,"block_script"===h&&(0,c.__)("URLs that should be blocked before consent.","complianz-gdpr"),"whitelist_script"===h&&(0,r.createElement)(r.Fragment,null,(0,c.__)("URLs that should be whitelisted.","complianz-gdpr"),(0,i.default)("https://complianz.io/whitelisting-inline-script/"))),g.map((([c,i],a)=>(0,r.createElement)("div",{key:a,className:"cmplz-scriptcenter-url"},(0,r.createElement)(n.default,{disabled:s,value:i||"",onChange:s=>((s,r)=>{let c={...u},i={...c.urls};i[s]=r,c.urls=i,t(c,e.type)})(c,s),id:a+"_url",name:"url"}),0===a&&!p&&(0,r.createElement)("button",{className:"button button-default",onClick:()=>(()=>{let s={...u},r=s.hasOwnProperty("urls")?{...s.urls}:[""];r[Object.keys(r).length+1]="",s.urls=r,t(s,e.type)})()}," ",(0,r.createElement)(l.default,{name:"plus",size:14})),0!==a&&(0,r.createElement)("button",{className:"button button-default",onClick:()=>(s=>{let r={...u},c={...r.urls};delete c[s],r.urls=c,t(r,e.type)})(c)}," ",(0,r.createElement)(l.default,{name:"minus",size:14}))))))}},32921:(e,t,s)=>{s.r(t),s.d(t,{default:()=>n});var r=s(86087),c=s(27723),i=s(44124);const n=e=>(0,r.createElement)(r.Fragment,null," ",(0,r.createElement)(i.default,{url:e,target:"_blank",rel:"noopener noreferrer",text:(0,c.__)("For more information, please read this %sarticle%s.","complianz-gdpr")})," ")}}]);