File "8550.9a47426cf830d8ff60a5.js"
Full path: /home/satkhirabarta/public_html/wp-content/plugins/complianz-gdpr/settings/build/8550.9a47426cf830d8ff60a5.js
File
size: 13.74 B (13.74 KB bytes)
MIME-type: text/plain
Charset: utf-8
Download Open Edit Advanced Editor &nnbsp; Back
"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[8550,9091,5207,9758,1366],{99091:(e,t,n)=>{n.r(t),n.d(t,{UseCookieScanData:()=>r});var a=n(81621),o=n(9588);const r=(0,a.vt)(((e,t)=>({initialLoadCompleted:!1,setInitialLoadCompleted:t=>e({initialLoadCompleted:t}),iframeLoaded:!1,loading:!1,nextPage:!1,progress:0,cookies:[],lastLoadedIframe:"",setIframeLoaded:t=>e({iframeLoaded:t}),setLastLoadedIframe:t=>e((e=>({lastLoadedIframe:t}))),setProgress:t=>e({progress:t}),fetchProgress:()=>(e({loading:!0}),o.doAction("get_scan_progress",{}).then((t=>(e({initialLoadCompleted:!0,loading:!1,nextPage:t.next_page,progress:t.progress,cookies:t.cookies}),t))))})))},28550:(e,t,n)=>{n.r(t),n.d(t,{default:()=>s});var a=n(86087),o=n(5207),r=n(27723),l=n(45111),c=n(81366);const s=(0,a.memo)((()=>{const{documents:e,documentsLoaded:t,fetchData:s,deleteDocuments:i,editDocument:d}=(0,o.default)(),[u,m]=(0,a.useState)(""),[p]=(0,a.useState)(""),[g,f]=(0,a.useState)(""),[h,b]=(0,a.useState)([]),[_,v]=(0,a.useState)(!1),[E,y]=(0,a.useState)({}),[k,C]=(0,a.useState)(!1),[w,N]=(0,a.useState)(!1),[L,z]=(0,a.useState)(null);(0,a.useEffect)((()=>{n.e(3757).then(n.bind(n,83757)).then((({default:e})=>{z((()=>e))}))}),[]),(0,a.useEffect)((()=>{t||s()}),[t]);const D=async()=>{let t=e.filter((e=>h.includes(e.id)));v(!0),f(!0);const n=async()=>{if(t.length>0){const e=t.shift(),a=e.download_url;try{let o=new XMLHttpRequest;o.responseType="blob",o.open("get",a,!0),o.send(),o.onreadystatechange=function(){if(4===this.readyState&&200===this.status){let n=window.URL.createObjectURL(this.response),a=window.document.createElement("a");a.setAttribute("href",n),a.setAttribute("download",e.title),window.document.body.appendChild(a),a.click(),b(t),v(!1),f(!1),setTimeout((function(){window.URL.revokeObjectURL(n)}),6e4)}},await n()}catch(e){console.error(e),f(!1)}}};await n()},S=e=>{let t=[...e];return""!==p&&(t=t.filter((e=>e.region===p))),t.sort(((e,t)=>e.title<t.title?-1:e.title>t.title?1:0)),t.filter((e=>e.title.toLowerCase().includes(u.toLowerCase()))),t},A=[{name:(0,a.createElement)(c.default,{options:{true:""},indeterminate:k,value:w,onChange:t=>(t=>{if(t){N(!0);let t=E.currentPage?E.currentPage:1,n=S(e).slice(5*(t-1),5*t);b(n.map((e=>e.id)))}else N(!1),b([]);C(!1)})(t)}),selector:e=>e.selectControl,grow:1,minWidth:"50px"},{name:(0,r.__)("Document","complianz-gdpr"),selector:e=>e.title,sortable:!0,grow:6},{name:(0,r.__)("Region","complianz-gdpr"),selector:e=>(0,a.createElement)("img",{alt:"region",width:"20px",height:"20px",src:cmplz_settings.plugin_url+"assets/images/"+e.region+".svg"}),sortable:!0,grow:2,right:!0},{name:(0,r.__)("Date","complianz-gdpr"),selector:e=>e.date,sortable:!0,grow:4,right:!0,minWidth:"200px"}];let I=S(e),x=[];I.forEach((t=>{let n={...t};n.selectControl=(0,a.createElement)(c.default,{value:h.includes(n.id),options:{true:""},onChange:t=>((t,n)=>{let a=t,o=[...h];a?o.includes(n)||(o.push(n),b(o)):(o=[...h.filter((e=>e!==n))],b(o));let r=E.currentPage?E.currentPage:1,l=S(e).slice(5*(r-1),5*r),c=!0,s=!1;l.forEach((e=>{o.includes(e.id)?s=!0:c=!1})),c?(N(!0),C(!1)):s?(N(!1),C(!0)):C(!1)})(t,n.id)}),x.push(n)}));let O=h.length>1;return O||1!==h.length||(O=""!==e.filter((e=>h.includes(e.id)))[0].download_url),(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{className:"cmplz-table-header"},(0,a.createElement)("div",{className:"cmplz-table-header-controls"},(0,a.createElement)("input",{className:"cmplz-datatable-search",type:"text",placeholder:(0,r.__)("Search","complianz-gdpr"),value:u,onChange:e=>m(e.target.value)}))),h.length>0&&(0,a.createElement)("div",{className:"cmplz-selected-document"},h.length>1&&(0,r.__)("%s items selected","complianz-gdpr").replace("%s",h.length),1===h.length&&(0,r.__)("1 item selected","complianz-gdpr"),(0,a.createElement)("div",{className:"cmplz-selected-document-controls"},(0,a.createElement)("button",{disabled:g||h.length>1,className:"button button-default",onClick:()=>d(h[0])},(0,r.__)("Edit","complianz-gdpr")),O&&(0,a.createElement)("button",{disabled:g,className:"button button-default cmplz-btn-reset",onClick:()=>D()},(0,r.__)("Download Data Breach Report","complianz-gdpr"),_&&(0,a.createElement)(l.default,{name:"loading",color:"grey"})),!O&&(0,a.createElement)("button",{disabled:!0,className:"button button-default cmplz-btn-reset",onClick:()=>D()},(0,r.__)("Reporting not required","complianz-gdpr")),(0,a.createElement)("button",{className:"button button-default cmplz-reset-button",onClick:()=>(async e=>{b([]),await i(e)})(h)},(0,r.__)("Delete","complianz-gdpr")))),L&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)(L,{columns:A,data:x,dense:!0,pagination:!0,paginationPerPage:5,onChangePage:e=>{y({...E,currentPage:e})},paginationState:E,noDataComponent:(0,a.createElement)("div",{className:"cmplz-no-documents"},(0,r.__)("No documents","complianz-gdpr")),persistTableHead:!0,theme:"really-simple-plugins",customStyles:{headCells:{style:{paddingLeft:"0",paddingRight:"0"}},cells:{style:{paddingLeft:"0",paddingRight:"0"}}}})))}))},5207:(e,t,n)=>{n.r(t),n.d(t,{default:()=>c});var a=n(81621),o=n(16535),r=n(9588),l=n(73710);const c=(0,a.vt)(((e,t)=>({documentsLoaded:!1,savedDocument:{},conclusions:[],region:"",fileName:"",fetching:!1,updating:!1,loadingFields:!1,documents:[],regions:[],fields:[],editDocumentId:!1,resetEditDocumentId:t=>{e({editDocumentId:!1,region:""})},editDocument:async t=>{e({updating:!0}),await r.doAction("load_databreach_report",{id:t}).then((t=>{e({fields:t.fields,region:t.region,updating:!1,fileName:t.file_name})})).catch((e=>{console.error(e)})),e({editDocumentId:t})},setRegion:t=>{e({region:t})},updateField:(n,a)=>{let r=!1,c=!1;e((0,o.Ay)((e=>{e.fields.forEach((function(e,t){e.id===n&&(c=t,r=!0)})),!1!==c&&(e.fields[c].value=a)})));let s=(0,l.updateFieldsListWithConditions)(t().fields);e({fields:s})},save:async n=>{e({updating:!0});let a=t().editDocumentId,o=0;await r.doAction("save_databreach_report",{fields:t().fields,region:n,post_id:a}).then((t=>(o=t.post_id,e({updating:!1,conclusions:t.conclusions}),t))).catch((e=>{console.error(e)})),await t().fetchData();let l=t().documents.filter((e=>e.id===o));l.length>0&&e({savedDocument:l[0]})},deleteDocuments:async n=>{let a=t().documents.filter((e=>n.includes(e.id)));e((e=>({documents:e.documents.filter((e=>!n.includes(e.id)))})));let o={};o.documents=a,await r.doAction("delete_databreach_report",o).then((e=>e)).catch((e=>{console.error(e)}))},fetchData:async()=>{if(t().fetching)return;e({fetching:!0});const{documents:n,regions:a}=await r.doAction("get_databreach_reports",{}).then((e=>e)).catch((e=>{console.error(e)}));e((e=>({documentsLoaded:!0,documents:n,regions:a,fetching:!1})))},fetchFields:async t=>{let n={region:t};e({loadingFields:!0});const{fields:a}=await r.doAction("get_databreach_report_fields",n).then((e=>e)).catch((e=>{console.error(e)}));let o=(0,l.updateFieldsListWithConditions)(a);e((e=>({fields:o,loadingFields:!1})))}})))},79758:(e,t,n)=>{n.r(t),n.d(t,{default:()=>d});var a=n(86087),o=n(9588),r=n(4219),l=n(52043),c=n(56427),s=n(99091),i=n(32828);const d=(0,a.memo)((({type:e="action",style:t="tertiary",label:n,onClick:d,href:u="",target:m="",disabled:p,action:g,field:f,children:h})=>{if(!n&&!h)return null;const b=(f&&f.button_text?f.button_text:n)||h,{fetchFieldsData:_,showSavedSettingsNotice:v}=(0,r.default)(),{setInitialLoadCompleted:E,setProgress:y}=(0,s.UseCookieScanData)(),{setProgressLoaded:k}=(0,i.default)(),{selectedSubMenuItem:C}=(0,l.default)(),[w,N]=(0,a.useState)(!1),L=`button cmplz-button button--${t} button-${e}`,z=async e=>{await o.doAction(f.action,{}).then((e=>{e.success&&(_(C),"reset_settings"===e.id&&(E(!1),y(0),k(!1)),v(e.message))}))},D=f&&f.warn?f.warn:"";return"action"===e?(0,a.createElement)(a.Fragment,null,c.__experimentalConfirmDialog&&(0,a.createElement)(c.__experimentalConfirmDialog,{isOpen:w,onConfirm:async()=>{N(!1),await z()},onCancel:()=>{N(!1)}},D),(0,a.createElement)("button",{className:L,onClick:async t=>{if("action"!==e||!d)return"action"===e&&g?c.__experimentalConfirmDialog?void(f&&f.warn?N(!0):await z()):void await z():void(window.location.href=f.url);d(t)},disabled:p},b)):"link"===e?(0,a.createElement)("a",{className:L,href:u,target:m},b):void 0}))},81366:(e,t,n)=>{n.r(t),n.d(t,{default:()=>D});var a=n(86087),o=n(58168),r=n(51609),l=n(91071),c=n(62133),s=n(9957),i=n(81351),d=n(85357),u=n(31769),m=n(7971),p=n(12579);const g="Checkbox",[f,h]=(0,c.A)(g),[b,_]=f(g),v=(0,r.forwardRef)(((e,t)=>{const{__scopeCheckbox:n,name:a,checked:c,defaultChecked:d,required:u,disabled:m,value:g="on",onCheckedChange:f,...h}=e,[_,v]=(0,r.useState)(null),C=(0,l.s)(t,(e=>v(e))),w=(0,r.useRef)(!1),N=!_||Boolean(_.closest("form")),[L=!1,z]=(0,i.i)({prop:c,defaultProp:d,onChange:f}),D=(0,r.useRef)(L);return(0,r.useEffect)((()=>{const e=null==_?void 0:_.form;if(e){const t=()=>z(D.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}}),[_,z]),(0,r.createElement)(b,{scope:n,state:L,disabled:m},(0,r.createElement)(p.sG.button,(0,o.A)({type:"button",role:"checkbox","aria-checked":y(L)?"mixed":L,"aria-required":u,"data-state":k(L),"data-disabled":m?"":void 0,disabled:m,value:g},h,{ref:C,onKeyDown:(0,s.m)(e.onKeyDown,(e=>{"Enter"===e.key&&e.preventDefault()})),onClick:(0,s.m)(e.onClick,(e=>{z((e=>!!y(e)||!e)),N&&(w.current=e.isPropagationStopped(),w.current||e.stopPropagation())}))})),N&&(0,r.createElement)(E,{control:_,bubbles:!w.current,name:a,value:g,checked:L,required:u,disabled:m,style:{transform:"translateX(-100%)"}}))})),E=e=>{const{control:t,checked:n,bubbles:a=!0,...l}=e,c=(0,r.useRef)(null),s=(0,d.Z)(n),i=(0,u.X)(t);return(0,r.useEffect)((()=>{const e=c.current,t=window.HTMLInputElement.prototype,o=Object.getOwnPropertyDescriptor(t,"checked").set;if(s!==n&&o){const t=new Event("click",{bubbles:a});e.indeterminate=y(n),o.call(e,!y(n)&&n),e.dispatchEvent(t)}}),[s,n,a]),(0,r.createElement)("input",(0,o.A)({type:"checkbox","aria-hidden":!0,defaultChecked:!y(n)&&n},l,{tabIndex:-1,ref:c,style:{...e.style,...i,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function y(e){return"indeterminate"===e}function k(e){return y(e)?"indeterminate":e?"checked":"unchecked"}const C=v,w=(0,r.forwardRef)(((e,t)=>{const{__scopeCheckbox:n,forceMount:a,...l}=e,c=_("CheckboxIndicator",n);return(0,r.createElement)(m.C,{present:a||y(c.state)||!0===c.state},(0,r.createElement)(p.sG.span,(0,o.A)({"data-state":k(c.state),"data-disabled":c.disabled?"":void 0},l,{ref:t,style:{pointerEvents:"none",...e.style}})))}));var N=n(27723),L=n(45111),z=n(79758);const D=(0,a.memo)((({indeterminate:e,label:t,value:n,id:o,onChange:r,required:l,disabled:c,options:s={}})=>{const[i,d]=(0,a.useState)(!1),[u,m]=(0,a.useState)(!1);let p=n;Array.isArray(p)||(p=""===p?[]:[p]),(0,a.useEffect)((()=>{let e=1===Object.keys(s).length&&"true"===Object.keys(s)[0];d(e)}),[]),e&&(n=!0);const g=p;let f=!1;Object.keys(s).length>10&&(f=!0);const h=e=>i?n:g.includes(""+e)||g.includes(parseInt(e)),b=()=>{m(!u)};let _=c&&!Array.isArray(c);return 0===Object.keys(s).length?(0,a.createElement)(a.Fragment,null,(0,N.__)("No options found","complianz-gdpr")):(0,a.createElement)("div",{className:"cmplz-checkbox-group"},Object.entries(s).map((([s,d],m)=>(0,a.createElement)("div",{key:s,className:"cmplz-checkbox-group__item"+(!u&&m>9?" cmplz-hidden":"")},(0,a.createElement)(C,{className:"cmplz-checkbox-group__checkbox",id:o+"_"+s,checked:h(s),"aria-label":t,disabled:_||Array.isArray(c)&&c.includes(s),required:l,onCheckedChange:e=>((e,t)=>{if(i)r(!n);else{const e=g.includes(""+t)||g.includes(parseInt(t))?g.filter((e=>e!==""+t&&e!==parseInt(t))):[...g,t];r(e)}})(0,s)},(0,a.createElement)(w,{className:"cmplz-checkbox-group__indicator"},(0,a.createElement)(L.default,{name:e?"indeterminate":"check",size:14,color:"dark-blue"}))),(0,a.createElement)("label",{className:"cmplz-checkbox-group__label",htmlFor:o+"_"+s},d)))),!u&&f&&(0,a.createElement)(z.default,{onClick:()=>b()},(0,N.__)("Show more","complianz-gdpr")),u&&f&&(0,a.createElement)(z.default,{onClick:()=>b()},(0,N.__)("Show less","complianz-gdpr")))}))},7971:(e,t,n)=>{n.d(t,{C:()=>c});var a=n(51609),o=n(75795),r=n(91071),l=n(88200);const c=e=>{const{present:t,children:n}=e,c=function(e){const[t,n]=(0,a.useState)(),r=(0,a.useRef)({}),c=(0,a.useRef)(e),i=(0,a.useRef)("none"),d=e?"mounted":"unmounted",[u,m]=function(e,t){return(0,a.useReducer)(((e,n)=>{const a=t[e][n];return null!=a?a:e}),e)}(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return(0,a.useEffect)((()=>{const e=s(r.current);i.current="mounted"===u?e:"none"}),[u]),(0,l.N)((()=>{const t=r.current,n=c.current;if(n!==e){const a=i.current,o=s(t);e?m("MOUNT"):"none"===o||"none"===(null==t?void 0:t.display)?m("UNMOUNT"):m(n&&a!==o?"ANIMATION_OUT":"UNMOUNT"),c.current=e}}),[e,m]),(0,l.N)((()=>{if(t){const e=e=>{const n=s(r.current).includes(e.animationName);e.target===t&&n&&(0,o.flushSync)((()=>m("ANIMATION_END")))},n=e=>{e.target===t&&(i.current=s(r.current))};return t.addEventListener("animationstart",n),t.addEventListener("animationcancel",e),t.addEventListener("animationend",e),()=>{t.removeEventListener("animationstart",n),t.removeEventListener("animationcancel",e),t.removeEventListener("animationend",e)}}m("ANIMATION_END")}),[t,m]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:(0,a.useCallback)((e=>{e&&(r.current=getComputedStyle(e)),n(e)}),[])}}(t),i="function"==typeof n?n({present:c.isPresent}):a.Children.only(n),d=(0,r.s)(c.ref,i.ref);return"function"==typeof n||c.isPresent?(0,a.cloneElement)(i,{ref:d}):null};function s(e){return(null==e?void 0:e.animationName)||"none"}c.displayName="Presence"},85357:(e,t,n)=>{n.d(t,{Z:()=>o});var a=n(51609);function o(e){const t=(0,a.useRef)({value:e,previous:e});return(0,a.useMemo)((()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous)),[e])}}}]);