"use strict";(self.webpackChunkcomplianz_gdpr=self.webpackChunkcomplianz_gdpr||[]).push([[3430,880],{20880:(e,t,a)=>{a.r(t),a.d(t,{default:()=>s});var n=a(51609),c=a(96979),l=a(45111),d=a(4219),o=a(27723);const s=e=>{const{saving:t,updateDocument:a}=(0,c.UseDocumentsData)(),{showSavedSettingsNotice:s}=(0,d.default)();let r=!!e.page.page_id;return(0,n.createElement)("div",{className:"cmplz-create-document"},r&&(0,n.createElement)(l.default,{name:"success",color:"green"}),!r&&(0,n.createElement)(l.default,{name:"times"}),(0,n.createElement)("input",{disabled:t,onChange:t=>((e,t)=>{a(t,e.target.value)})(t,e.page.page_id),type:"text",value:e.page.title}),(0,n.createElement)("div",{className:"cmplz-shortcode-container",onClick:t=>((e,t)=>{let a;e.target.classList.add("cmplz-click-animation");let n=document.createElement("input");document.getElementsByTagName("body")[0].appendChild(n),n.value=t,n.select();try{a=document.execCommand("copy")}catch(e){a=!1}n.parentElement.removeChild(n),a&&s((0,o.__)("Copied shortcode","complianz-gdpr"))})(t,e.page.shortcode)},(0,n.createElement)(l.default,{name:"shortcode"})))}},83430:(e,t,a)=>{a.r(t),a.d(t,{default:()=>i});var n=a(51609),c=a(27723),l=a(96979),d=a(20880),o=a(86087),s=a(4219),r=a(99695),m=a(45111);const i=(0,o.memo)((()=>{const{saveDocuments:e,saving:t,documentsChanged:a,documentsDataLoaded:i,hasMissingPages:u,fetchDocumentsData:p,requiredPages:g}=(0,l.UseDocumentsData)(),{fields:h,fieldsLoaded:f,changedFields:_,addHelpNotice:v,removeHelpNotice:E,showSavedSettingsNotice:b,setDocumentSettingsChanged:z}=(0,s.default)(),[y,C]=(0,o.useState)(!1);let k;if((0,o.useEffect)((()=>{f&&(_.length>0||p())}),[h,_]),(0,o.useEffect)((()=>{if(i)if(0===g.length){let e=(0,c.__)("You haven't selected any legal documents to create.","complianz-gdpr")+" "+(0,c.__)("You can continue to the next step.","complianz-gdpr");v("create-documents","warning",e,(0,c.__)("No required documents","complianz-gdpr")),C(!0)}else y&&E("create-documents")}),[g,i]),k=u?(0,c.__)('The pages marked with X should be added to your website. You can create these pages with a shortcode, a Gutenberg block or use the below "Create missing pages" button.',"complianz-gdpr"):(0,c.__)('All necessary pages have been created already. You can update the page titles here if you want, then click the "Update pages" button.',"complianz-gdpr"),!i)return(0,n.createElement)(r.default,{lines:"3"});let D=!u&&!a;return(0,n.createElement)(n.Fragment,null,i&&k,i&&g.map(((e,t)=>(0,n.createElement)(d.default,{page:e,key:t}))),g.length>0&&(0,n.createElement)("div",null,(0,n.createElement)("button",{disabled:D,onClick:()=>(async()=>{e().then((()=>{z(!0),b((0,c.__)("Documents updated!","complianz-gdpr"))}))})(),className:"button button-default"},u?(0,c.__)("Create missing pages","complianz-gdpr"):(0,c.__)("Update","complianz-gdpr"),t&&(0,n.createElement)(m.default,{name:"loading",color:"grey"}))))}))}}]);