Your IP : 216.73.216.187
"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[144],{70144:(e,t,a)=>{a.r(t),a.d(t,{default:()=>s});var l=a(51280),n=a(36044),r=a(93396),o=a(61744),u=a(88496),c=a(21184),d=a(15832),i=a(25536),m=a(30052);const s=(0,u.memo)((({id:e,value:t,options:a,defaultValue:s,disabled:p})=>{const[g,_]=(0,u.useState)(!1),[h,v]=(0,u.useState)(""),[E,f]=(0,u.useState)([]),[b,y]=(0,u.useState)(!1),[z,A]=(0,u.useState)(!1),[C,S]=(0,u.useState)(null),T=(0,u.useRef)(t),{updateField:k,setChangedField:F}=(0,i.default)(),N=a=>{let l=T.current!==t||a;if("custom"!==t||b||(T.current=t,l&&w(!1)),"url"===t&&!z){let a={};T.current=t,a.type=e,o.doAction("get_custom_legal_document_url",a).then((e=>{v(e.pageUrl),A(!0)}))}};(0,u.useEffect)((()=>{a.map((e=>e.value)).includes(t)||k(e,s),N(!0)}),[]),(0,c.c)((()=>{N(!1)}));const w=t=>{let a={};return a.type=e,a.search=t,o.doAction("get_pages_list",a).then((e=>{let t=e.pages.filter((function(t){return t.value===e.pageId}));return _(t),y(!0),f(e.pages),e.pages}))},L={};for(const e in a){const t=a[e];L[t.value]=t.label}return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(m.default,{id:e,options:L,value:t,onChange:t=>{k(e,t),F(e,t)},disabled:p}),"custom"===t&&!b&&(0,l.createElement)("div",{className:"cmplz-documents-loader"},(0,l.createElement)("div",null,(0,l.createElement)(d.default,{name:"loading",color:"grey"})),(0,l.createElement)("div",null,(0,r.__)("Loading...","complianz-gdpr"))),"custom"===t&&b&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)(n.c,{label:(0,r.__)("Link to custom page","complianz-gdpr"),defaultOptions:E,loadOptions:e=>new Promise((t=>{setTimeout((()=>{t(w(e))}),1e3)})),menuPortalTarget:document.body,menuPosition:"fixed",placeholder:(0,r.__)("Type at least two characters","complianz-gdpr"),onChange:t=>(t=>{let a={};a.pageId=t.value,a.type=e,_(t),o.doAction("update_custom_legal_document_id",a).then((e=>{}))})(t),value:g})),"url"===t&&!z&&(0,l.createElement)("div",{className:"cmplz-documents-loader"},(0,l.createElement)("div",null,(0,l.createElement)(d.default,{name:"loading",color:"grey"})),(0,l.createElement)("div",null,(0,r.__)("Loading...","complianz-gdpr"))),"url"===t&&z&&(0,l.createElement)(l.Fragment,null,(0,l.createElement)("input",{type:"text",value:h,onChange:t=>{let a={},l=t.target.value;a.pageUrl=l,a.type=e,v(l),clearTimeout(C);const n=setTimeout((()=>{o.doAction("update_custom_legal_document_url",a).then((e=>{}))}),500);S(n)},placeholder:"https://domain.com/your-policy"})))}))},30052:(e,t,a)=>{a.r(t),a.d(t,{default:()=>r});var l=a(51280),n=a(1828);const r=(0,a(88496).memo)((({label:e,id:t,value:a,onChange:r,required:o,defaultValue:u,disabled:c,options:d={}})=>(0,l.createElement)(n.Ss,{disabled:c&&!Array.isArray(c),className:"cmplz-input-group cmplz-radio-group",value:a,"aria-label":e,onValueChange:r,required:o,default:u},Object.entries(d).map((([e,a])=>(0,l.createElement)("div",{key:e,className:"cmplz-radio-group__item"},(0,l.createElement)(n.iY,{disabled:Array.isArray(c)&&c.includes(e),value:e,id:t+"_"+e},(0,l.createElement)(n.wH,{className:"cmplz-radio-group__indicator"})),(0,l.createElement)("label",{className:"cmplz-radio-label",htmlFor:t+"_"+e},a)))))))}}]);