"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[9487,7511],{29487:(e,t,a)=>{a.r(t),a.d(t,{default:()=>r});var l=a(86087),n=a(45111),s=a(27723),i=a(7511);const r=(0,l.memo)((({field:e})=>{const{statusLoaded:t,startPluginAction:a,apiRequestActive:r,pluginAction:u,rating:c,upgradeUrl:g,setStatusLoaded:d}=(0,i.default)(),p=e.plugin_data.title,o=e.plugin_data.summary,m=e.plugin_data.description,_=e.plugin_data.image;(0,l.useEffect)((()=>{t||a(e.plugin_data.slug,"status")}),[t]),(0,l.useEffect)((()=>{d(!1)}),[e.plugin_data.slug]);const v=e=>{let t=[];for(let a=1;a<=e;a++)t.push(a);return t};let z,A=r;switch(u){case"upgrade-to-premium":z=(0,s.__)("Upgrade","complianz-gdpr");break;case"activate":z=r?(0,s.__)("Activating","complianz-gdpr"):(0,s.__)("Activate","complianz-gdpr");break;case"download":z=r?(0,s.__)("Installing","complianz-gdpr"):(0,s.__)("Install","complianz-gdpr");break;default:A=!0,z=t?(0,s.__)("Installed","complianz-gdpr"):(0,s.__)("Checking status","complianz-gdpr")}return(0,l.createElement)("div",{className:"cmplz-suggested-plugin"},(0,l.createElement)("img",{className:"cmplz-suggested-plugin-img",src:cmplz_settings.plugin_url+"/upgrade/img/"+_}),(0,l.createElement)("div",{className:"cmplz-suggested-plugin-group"},(0,l.createElement)("div",{className:"cmplz-suggested-plugin-group-title"},p),(0,l.createElement)("div",{className:"cmplz-suggested-plugin-group-desc"},o),(0,l.createElement)("div",{className:"cmplz-suggested-plugin-group-rating"},(()=>{let e=Math.floor(c),t=Math.ceil(c-e),a=5-e-t;return e=v(e),t=v(t),a=v(a),(0,l.createElement)("div",{className:"star-rating"},(0,l.createElement)("span",{className:"screen-reader-text"},(0,s.__)("%s rating based on %d ratings","complianz-gdpr").replace("%s","5").replace("%d","84")),e.map(((e,t)=>(0,l.createElement)("div",{key:t,className:"star star-full","aria-hidden":"true"}))),t.map(((e,t)=>(0,l.createElement)("div",{key:t,className:"star star-half","aria-hidden":"true"}))),a.map(((e,t)=>(0,l.createElement)("div",{key:t,className:"star star-empty","aria-hidden":"true"}))))})())),(0,l.createElement)("div",{className:"cmplz-suggested-plugin-desc-long"},m),(0,l.createElement)("div",null,"upgrade-to-premium"!==u&&(0,l.createElement)("button",{type:"button",disabled:A,onClick:t=>{a(e.plugin_data.slug)},className:"button-secondary cmplz-install-plugin"},z,r&&(0,l.createElement)(n.default,{name:"loading",color:"grey"})),"upgrade-to-premium"===u&&(0,l.createElement)("a",{target:"_blank",rel:"noopener noreferrer",href:g,type:"button",className:"button-secondary cmplz-install-plugin"},z)))}))},7511:(e,t,a)=>{a.r(t),a.d(t,{default:()=>s});var l=a(81621),n=a(9588);const s=(0,l.vt)(((e,t)=>({apiRequestActive:!1,pluginAction:"status",wordPressUrl:"#",upgradeUrl:"#",rating:[],statusLoaded:!1,setStatusLoaded:t=>{e({statusLoaded:t})},startPluginAction:(a,l)=>{let s={};e({apiRequestActive:!0}),s.pluginAction=void 0!==l?l:t().pluginAction,s.slug=a;let i=!1;"download"===s.pluginAction&&(i="activate"),n.doAction("plugin_actions",s).then((l=>{e({pluginAction:l.pluginAction,wordPressUrl:l.wordpress_url,upgradeUrl:l.upgrade_url});let n=Math.round(l.star_rating.rating/10,0)/2;e({rating:n,ratingCount:l.star_rating.rating_count,apiRequestActive:!1,statusLoaded:!0}),"activate"===i&&"installed"!==l.pluginAction&&t().startPluginAction(a,l.pluginAction)}))}})))}}]);