D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
aramrprl
/
www
/
wp-content
/
plugins
/
complianz-gdpr
/
settings
/
build
/
Filename :
2299.54f393cb725af3df69f0.js
back
Copy
"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[2299,6231,9056],{76231:(e,t,n)=>{n.r(t),n.d(t,{steps:()=>i,useNewOnboardingData:()=>c});var s=n(9588),r=n(81621),o=n(27723);const i={welcome:{title:(0,o.__)("Welcome to Complianz","complianz-gdpr"),prevButton:(0,o.__)("No, Thanks","complianz-gdpr"),nextButton:(0,o.__)("Continue","complianz-gdpr"),prevButtonGoTo:"newsletter",nextButtonGoTo:"terms"},terms:{title:(0,o.__)("Terms and Conditions","complianz-gdpr"),prevButton:(0,o.__)("Dismiss","complianz-gdpr"),nextButton:(0,o.__)("Continue","complianz-gdpr"),prevButtonGoTo:"newsletter",nextButtonGoTo:"newsletter"},newsletter:{title:(0,o.__)("Get tips and tricks","complianz-gdpr"),prevButton:(0,o.__)("Skip","complianz-gdpr"),nextButton:(0,o.__)("Continue","complianz-gdpr"),prevButtonGoTo:"plugins",nextButtonGoTo:"plugins"},plugins:{title:(0,o.__)("Install quickly for free","complianz-gdpr"),prevButton:(0,o.__)("Skip","complianz-gdpr"),nextButton:(0,o.__)("Continue","complianz-gdpr"),nextButtonSecondary:(0,o.__)("Install","complianz-gdpr"),nextButtonThird:(0,o.__)("Installing ...","complianz-gdpr"),prevButtonGoTo:"thankYou",nextButtonGoTo:"thankYou"},thankYou:{title:(0,o.__)("You’re almost there...","complianz-gdpr"),nextButton:(0,o.__)("Close","complianz-gdpr"),nextButtonGoTo:!1}},l=[{slug:"complianz-terms-conditions",description:(0,o.__)("Missing Terms & Conditions? Generate now","complianz-gdpr"),status:"not-installed",processing:!1},{slug:"really-simple-ssl",description:(0,o.__)("Really Simple Security? Let’s go","complianz-gdpr"),status:"not-installed",processing:!1}],a=async(e,t,n,r)=>{r(e=>({plugins:e.plugins.map(e=>e.slug===n.slug?{...e,status:"processing"}:e)}));const o={slug:n.slug,plugins:e};try{let e="";if("install_plugin"===t){const r=await s.doAction(t,o);if(!r.request_success)throw new Error("API Error: installing plugin.");const i=r.plugins.find(e=>e.slug===n.slug).status||"not-installed";if("not-installed"===i)throw new Error("Error installing plugin.");e=i}const i=await s.doAction("activate_plugin",o);if(!i.request_success)throw new Error("API Error: installing plugin.");const l=i.plugins.find(e=>e.slug===n.slug).status;if("activated"!==l)throw new Error("Error activating plugin.");e=l,r(t=>({plugins:t.plugins.map(t=>t.slug===n.slug?{...t,status:e}:t)}))}catch(e){r({isInstalling:!1}),console.error("Plugin installation error:",e)}},c=(0,r.vt)((e,t)=>({isModalOpen:!0,isOnboardingComplete:!1,currentStep:"welcome",stepProcessing:!1,isLoading:!1,isContentLoading:!0,setIsContentLoading:t=>e({isContentLoading:t}),nextStepDisabled:!1,prevStepDisabled:!1,wscEmail:"",enableWsc:!1,emailError:"",termsAccepted:!1,wscTerms:"",newsletterAccepted:!1,newsletterEmail:"",newsletterTerms:"",fetchError:!1,fetchErrorMessage:"",fetchDoc:async()=>{e({isLoading:!0,fetchError:!1,fetchErrorMessage:""});const n=t().currentStep;let r="terms"===n?"get_wsc_terms":"get_newsletter_terms";const i=await s.doAction(r);i.request_success||e({fetchError:!0,fetchErrorMessage:(0,o.__)("Something went wrong while downloading the document.","complianz-gdpr")});const l=i.doc;l?"terms"===n?e({wscTerms:l,isLoading:!1}):"newsletter"===n&&e({newsletterTerms:l,isLoading:!1}):e({fetchError:!0,fetchErrorMessage:(0,o.__)("Something went wrong while downloading the document.","complianz-gdpr"),isLoading:!1})},suggestedPlugins:l,plugins:[],fetchPlugins:async()=>{try{const t=await s.doAction("get_recommended_plugins_status",{plugins:l});if(!t.request_success)throw new Error("Error fetching.");const n=t.plugins.map(e=>({...e,checked:"activated"===e.status||!1,toProcess:!1}));e({plugins:n})}catch(e){throw new Error("Api error:",e)}},enablePluginInstallation:!1,isInstalling:!1,setWscEmail:t=>e({wscEmail:t}),setEnableWsc:t=>e({enableWsc:t}),setEmailError:t=>e({emailError:t}),setNewsletterEmail:t=>e({newsletterEmail:t}),setNextStepDisabled:t=>e({nextStepDisabled:t}),setPrevStepDisabled:t=>e({prevStepDisabled:t}),setPlugins:t=>e({plugins:t}),setEnablePluginInstallation:t=>e({enablePluginInstallation:t}),closeModal:async n=>{n&&t().skipStep("onboarding");const s=new URL(window.location.href);s.searchParams.delete("websitescan"),window.history.pushState({},"",s.href),e({isModalOpen:!1})},skipStep:async e=>{if(!(await s.doAction("dismiss_wsc_onboarding",{step:e})).request_success)throw new Error("Error fetching.")},goToPrevStep:()=>e(e=>{const n="welcome"===e.currentStep?"newsletter":i[e.currentStep].prevButtonGoTo;if("newsletter"===n||"plugins"===n){const e="newsletter"===n?"websitescan":"newsletter";t().skipStep(e)}return{...e,currentStep:n,stepProcessing:!1}}),goToNextStep:()=>e(async n=>{let r=i[n.currentStep].nextButtonGoTo;e({stepProcessing:!0});try{switch(n.currentStep){case"welcome":0===n.wscEmail.length?(e({enableWsc:!1}),r="newsletter"):e({enableWsc:!0});break;case"terms":let o=t().wscEmail;if(e({termsAccepted:!0,newsletterEmail:o,isLoading:!0}),!(await s.doAction("signup_wsc",{email:o,timestamp:(new Date).getTime(),url:window.location.href})).request_success)throw new Error("Error fetching.");e({isLoading:!1});break;case"newsletter":let i=t().newsletterEmail;if(e({newsletterAccepted:!0,isLoading:!0}),!(await s.doAction("signup_newsletter",{email:i,timestamp:(new Date).getTime(),url:window.location.href})).request_success)throw new Error("Error fetching.");e({isLoading:!1});break;case"plugins":if(!t().enablePluginInstallation)break;const l=t().plugins.filter(e=>e.toProcess);if(l.length<=0)break;const c=t().suggestedPlugins;e({isInstalling:!0});for(const t of l)"not-installed"===t.status?await a(c,"install_plugin",t,e):"installed"===t.status&&await a(c,"activate_plugin",t,e);return void e({isInstalling:!1,stepProcessing:!1,enablePluginInstallation:!1});case"thankYou":e({isOnboardingComplete:!0}),t().closeModal()}e({currentStep:r,stepProcessing:!1})}catch(t){console.error("Error during step transition:",t),e({stepProcessing:!1})}}),isValidEmail:e=>0===e.length||/^[\w.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(e)}))},82299:(e,t,n)=>{n.r(t),n.d(t,{default:()=>g});var s=n(86087),r=n(27723),o=n(76231),i=n(99418),l=n(99695),a=n(89056),c=n(10790);const g=()=>{const{currentStep:e,wscTerms:t,isContentLoading:n,setIsContentLoading:g,fetchError:p,fetchDoc:u}=(0,o.useNewOnboardingData)();(0,s.useEffect)(()=>{(async()=>{try{g(!0),await u()}catch(e){console.log(e)}finally{g(!1)}})()},[u]);const d=i.A.sanitize(t,{ADD_ATTR:["target"]});return(0,c.jsx)("div",{className:`cmplz-modal-content-step ${e}`,children:n?(0,c.jsx)(l.default,{}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("p",{children:(0,r.__)("Great! You're a few minutes away from getting started with the Website Scan. You just need to look over the Terms and Conditions. If you agree, please continue.","complianz-gdpr")}),p&&(0,c.jsx)(a.default,{children:(0,c.jsx)("button",{className:"button button-default",onClick:u,children:(0,r.__)("Try again!","complianz-gdpr")})}),d&&(0,c.jsx)("div",{className:"wrap-terms",dangerouslySetInnerHTML:{__html:d}})]})})}},89056:(e,t,n)=>{n.r(t),n.d(t,{default:()=>o});var s=n(76231),r=n(10790);const o=({children:e})=>{const{fetchErrorMessage:t}=(0,s.useNewOnboardingData)();return(0,r.jsxs)("div",{className:"cmplz-onboarding__error",children:[(0,r.jsx)("p",{children:t}),(0,r.jsx)("div",{children:e})]})}}}]);