"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[7552,9216],{7552:(e,t,a)=>{a.r(t),a.d(t,{default:()=>u});var l=a(51280),n=a(88496),s=a(15832),i=a(93396),r=a(29216);const u=(0,n.memo)((({field:e})=>{const{statusLoaded:t,startPluginAction:a,apiRequestActive:u,pluginAction:c,rating:g,upgradeUrl:d,setStatusLoaded:p}=(0,r.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,E=u;switch(c){case"upgrade-to-premium":A=(0,i.__)("Upgrade","complianz-gdpr");break;case"activate":A=u?(0,i.__)("Activating","complianz-gdpr"):(0,i.__)("Activate","complianz-gdpr");break;case"download":A=u?(0,i.__)("Installing","complianz-gdpr"):(0,i.__)("Install","complianz-gdpr");break;default:E=!0,A=t?(0,i.__)("Installed","complianz-gdpr"):(0,i.__)("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,i.__)("%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:E,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)))}))},29216:(e,t,a)=>{a.r(t),a.d(t,{default:()=>s});var l=a(30809),n=a(61744);const s=(0,l.Su)(((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)}))}})))}}]);