"use strict";(self.webpackChunkcomplianz_gdpr=self.webpackChunkcomplianz_gdpr||[]).push([[9487,7511],{29487:(e,t,a)=>{a.r(t),a.d(t,{default:()=>u});var l=a(51609),n=a(86087),s=a(45111),r=a(27723),i=a(7511);const u=(0,n.memo)((({field:e})=>{const{statusLoaded:t,startPluginAction:a,apiRequestActive:u,pluginAction:c,rating:g,upgradeUrl:d,setStatusLoaded:p}=(0,i.default)(),o=e.plugin_data.title,m=e.plugin_data.summary,_=e.plugin_data.description,v=e.plugin_data.image;(0,n.useEffect)((()=>{t||a(e.plugin_data.slug,"status")}),[t]),(0,n.useEffect)((()=>{p(!1)}),[e.plugin_data.slug]);const z=e=>{let t=[];for(let a=1;a<=e;a++)t.push(a);return t};let A,f=u;switch(c){case"upgrade-to-premium":A=(0,r.__)("Upgrade","complianz-gdpr");break;case"activate":A=u?(0,r.__)("Activating","complianz-gdpr"):(0,r.__)("Activate","complianz-gdpr");break;case"download":A=u?(0,r.__)("Installing","complianz-gdpr"):(0,r.__)("Install","complianz-gdpr");break;default:f=!0,A=t?(0,r.__)("Installed","complianz-gdpr"):(0,r.__)("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/"+v}),(0,l.createElement)("div",{className:"cmplz-suggested-plugin-group"},(0,l.createElement)("div",{className:"cmplz-suggested-plugin-group-title"},o),(0,l.createElement)("div",{className:"cmplz-suggested-plugin-group-desc"},m),(0,l.createElement)("div",{className:"cmplz-suggested-plugin-group-rating"},(()=>{let e=Math.floor(g),t=Math.ceil(g-e),a=5-e-t;return e=z(e),t=z(t),a=z(a),(0,l.createElement)("div",{className:"star-rating"},(0,l.createElement)("span",{className:"screen-reader-text"},(0,r.__)("%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"},_),(0,l.createElement)("div",null,"upgrade-to-premium"!==c&&(0,l.createElement)("button",{type:"button",disabled:f,onClick:t=>{a(e.plugin_data.slug)},className:"button-secondary cmplz-install-plugin"},A,u&&(0,l.createElement)(s.default,{name:"loading",color:"grey"})),"upgrade-to-premium"===c&&(0,l.createElement)("a",{target:"_blank",rel:"noopener noreferrer",href:d,type:"button",className:"button-secondary cmplz-install-plugin"},A)))}))},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 r=!1;"download"===s.pluginAction&&(r="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"===r&&"installed"!==l.pluginAction&&t().startPluginAction(a,l.pluginAction)}))}})))}}]);