Files

1 line
11 KiB
JavaScript
Raw Permalink Normal View History

2025-12-10 12:17:30 -05:00
"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[5023,800,4759,2921],{10800:(e,t,a)=>{a.r(t),a.d(t,{default:()=>A});var r=a(51609),s=a(86087),l=a(58168),n=a(9957),c=a(91071),i=a(62133),o=a(81351),d=a(85357),u=a(31769),p=a(12579);const h="Switch",[m,g]=(0,i.A)(h),[b,f]=m(h),_=(0,r.forwardRef)(((e,t)=>{const{__scopeSwitch:a,name:s,checked:i,defaultChecked:d,required:u,disabled:h,value:m="on",onCheckedChange:g,...f}=e,[_,E]=(0,r.useState)(null),k=(0,c.s)(t,(e=>E(e))),w=(0,r.useRef)(!1),A=!_||Boolean(_.closest("form")),[S=!1,z]=(0,o.i)({prop:i,defaultProp:d,onChange:g});return(0,r.createElement)(b,{scope:a,checked:S,disabled:h},(0,r.createElement)(p.sG.button,(0,l.A)({type:"button",role:"switch","aria-checked":S,"aria-required":u,"data-state":y(S),"data-disabled":h?"":void 0,disabled:h,value:m},f,{ref:k,onClick:(0,n.m)(e.onClick,(e=>{z((e=>!e)),A&&(w.current=e.isPropagationStopped(),w.current||e.stopPropagation())}))})),A&&(0,r.createElement)(v,{control:_,bubbles:!w.current,name:s,value:m,checked:S,required:u,disabled:h,style:{transform:"translateX(-100%)"}}))})),v=e=>{const{control:t,checked:a,bubbles:s=!0,...n}=e,c=(0,r.useRef)(null),i=(0,d.Z)(a),o=(0,u.X)(t);return(0,r.useEffect)((()=>{const e=c.current,t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(i!==a&&r){const t=new Event("click",{bubbles:s});r.call(e,a),e.dispatchEvent(t)}}),[i,a,s]),(0,r.createElement)("input",(0,l.A)({type:"checkbox","aria-hidden":!0,defaultChecked:a},n,{tabIndex:-1,ref:c,style:{...e.style,...o,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function y(e){return e?"checked":"unchecked"}const E=_,k=(0,r.forwardRef)(((e,t)=>{const{__scopeSwitch:a,...s}=e,n=f("SwitchThumb",a);return(0,r.createElement)(p.sG.span,(0,l.A)({"data-state":y(n.checked),"data-disabled":n.disabled?"":void 0},s,{ref:t}))}));var w=a(4219);const A=(0,s.memo)((({value:e,onChange:t,required:a,disabled:s,className:l,label:n,id:c})=>{const{getField:i}=(0,w.default)();let o=e;return"0"!==e&&"1"!==e||(o="1"===e),(0,r.createElement)("div",{className:"cmplz-input-group cmplz-switch-group"},(0,r.createElement)(E,{className:"cmplz-switch-root "+l,checked:o,onCheckedChange:e=>{"banner"===i(c).data_target&&(e=e?"1":"0"),t(e)},disabled:s,required:a},(0,r.createElement)(k,{className:"cmplz-switch-thumb"})))}))},34759:(e,t,a)=>{a.r(t),a.d(t,{default:()=>n});var r=a(81621),s=a(16535),l=a(9588);const n=(0,r.vt)(((e,t)=>({integrationsLoaded:!1,fetching:!1,services:[],plugins:[],scripts:[],placeholders:[],blockedScripts:[],setScript:(t,a)=>{e((0,s.Ay)((e=>{if("block_script"===a){let a=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,s]of Object.entries(a))r===t&&(e=!0);e||(a[r]=r)}e.blockedScripts=a}}const r=e.scripts[a].findIndex((e=>e.id===t.id));-1!==r&&(e.scripts[a][r]=t)})))},fetchIntegrationsData:async()=>{if(t().fetching)return;e({fetching:!0});const{services:a,plugins:r,scripts:s,placeholders:l,blocked_scripts:n}=await c();let i=s;i.block_script&&i.block_script.length>0&&i.block_script.forEach(((e,t)=>{e.id=t})),i.add_script&&i.add_script.length>0&&i.add_script.forEach(((e,t)=>{e.id=t})),i.whitelist_script&&i.whitelist_script.length>0&&i.whitelist_script.forEach(((e,t)=>{e.id=t})),e((()=>({integrationsLoaded:!0,services:a,plugins:r,scripts:i,fetching:!1,placeholders:l,blockedScripts:n})))},addScript:a=>{e({fetching:!0}),t().scripts[a]&&Array.isArray(t().scripts[a])||e((0,s.Ay)((e=>{e.scripts[a]=[]}))),e((0,s.Ay)((e=>{e.scripts[a].push({name:"general",id:e.scripts[a].length,enable:!0})})));let r=t().scripts;return l.doAction("update_scripts",{scripts:r}).then((t=>(e({fetching:!1}),t))).catch((e=>{console.error(e)}))},saveScript:(a,r)=>{e({fetching:!0}),t().scripts[r]&&Array.isArray(t().scripts[r])||e((0,s.Ay)((e=>{e.scripts[r]=[]}))),e((0,s.Ay)((e=>{const t=e.scripts[r].findIndex((e=>e.id===a.id));-1!==t&&(e.scripts[r][t]=a)})));let n=t().scripts;return l.doAction("update_scripts",{scripts:n}).then((t=>(e({fet