"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[880,3430],{20880:(e,t,a)=>{a.r(t),a.d(t,{default:()=>l});var n=a(96979),s=a(45111),d=a(4219),c=a(27723),o=a(10790);const l=e=>{const{saving:t,updateDocument:a}=(0,n.UseDocumentsData)(),{showSavedSettingsNotice:l}=(0,d.default)();let i=!!e.page.page_id;return(0,o.jsxs)("div",{className:"cmplz-create-document",children:[i&&(0,o.jsx)(s.default,{name:"success",color:"green"}),!i&&(0,o.jsx)(s.default,{name:"times"}),(0,o.jsx)("input",{disabled:t,onChange:t=>((e,t)=>{a(t,e.target.value)})(t,e.page.page_id),type:"text",value:e.page.title}),(0,o.jsx)("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&&l((0,c.__)("Copied shortcode","complianz-gdpr"))})(t,e.page.shortcode),children:(0,o.jsx)(s.default,{name:"shortcode"})})]})}},83430:(e,t,a)=>{a.r(t),a.d(t,{default:()=>u});var n=a(27723),s=a(96979),d=a(20880),c=a(86087),o=a(4219),l=a(99695),i=a(45111),r=a(10790);const u=(0,c.memo)(()=>{const{saveDocuments:e,saving:t,documentsChanged:a,documentsDataLoaded:u,hasMissingPages:p,fetchDocumentsData:g,requiredPages:m}=(0,s.UseDocumentsData)(),{fields:h,fieldsLoaded:f,changedFields:_,addHelpNotice:b,removeHelpNotice:v,showSavedSettingsNotice:x,setDocumentSettingsChanged:z}=(0,o.default)(),[C,j]=(0,c.useState)(!1);let y;if((0,c.useEffect)(()=>{f&&(_.length>0||g())},[h,_]),(0,c.useEffect)(()=>{if(u)if(0===m.length){let e=(0,n.__)("You haven't selected any legal documents to create.","complianz-gdpr")+" "+(0,n.__)("You can continue to the next step.","complianz-gdpr");b("create-documents","warning",e,(0,n.__)("No required documents","complianz-gdpr")),j(!0)}else C&&v("create-documents")},[m,u]),y=p?(0,n.__)('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,n.__)('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"),!u)return(0,r.jsx)(l.default,{lines:"3"});let D=!p&&!a;return(0,r.jsxs)(r.Fragment,{children:[u&&y,u&&m.map((e,t)=>(0,r.jsx)(d.default,{page:e},t)),m.length>0&&(0,r.jsx)("div",{children:(0,r.jsxs)("button",{disabled:D,onClick:()=>(async()=>{e().then(()=>{z(!0),x((0,n.__)("Documents updated!","complianz-gdpr"))})})(),className:"button button-default",children:[p?(0,n.__)("Create missing pages","complianz-gdpr"):(0,n.__)("Update","complianz-gdpr"),t&&(0,r.jsx)(i.default,{name:"loading",color:"grey"})]})})]})})}}]);