"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),c=a(4219),d=a(27723),o=a(10790);const l=e=>{const{saving:t,updateDocument:a}=(0,n.UseDocumentsData)(),{showSavedSettingsNotice:l}=(0,c.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,d.__)("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),c=a(20880),d=a(86087),o=a(4219),l=a(99695),i=a(45111),r=a(10790);const u=(0,d.memo)(()=>{const{saveDocuments:e,saving:t,documentsChanged:a,documentsDataLoaded:u,hasMissingPages:p,fetchDocumentsData:g,requiredPages:m}=(0,s.UseDocumentsData)(),{fieldsLoaded:h,changedFields:_,addHelpNotice:f,removeHelpNotice:b,showSavedSettingsNotice:v,setDocumentSettingsChanged:x}=(0,o.default)(),[z,C]=(0,d.useState)(!1);let j;if((0,d.useEffect)(()=>{h&&(_.length>0||g())},[h,_]),(0,d.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");f("create-documents","warning",e,(0,n.__)("No required documents","complianz-gdpr")),C(!0)}else z&&b("create-documents")},[m,u]),j=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 y=!p&&!a;return(0,r.jsxs)(r.Fragment,{children:[u&&j,u&&m.map((e,t)=>(0,r.jsx)(c.default,{page:e},t)),m.length>0&&(0,r.jsx)("div",{children:(0,r.jsxs)("button",{disabled:y,onClick:()=>(async()=>{e().then(()=>{x(!0),v((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"})]})})]})})}}]);