"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[1222,5540],{5540:(a,t,s)=>{s.r(t),s.d(t,{default:()=>l});var n=s(86087),r=s(27723),e=s(21222),o=s(10790);const l=(0,n.memo)(a=>{const{cronStatus:t,translationDataLoading:s,error:l,fetchCronStatus:i,clearError:c}=(0,e.UseTranslationsData)();(0,n.useEffect)(()=>{i()},[]);return s?(0,o.jsx)("div",{className:"cmplz-translation-automation",children:(0,o.jsx)("p",{children:(0,r.__)("Loading automation status...","complianz-gdpr")})}):l?(0,o.jsxs)("div",{className:"cmplz-translation-automation",children:[(0,o.jsx)("p",{className:"cmplz-error",children:l}),(0,o.jsx)("button",{className:"button button-secondary",onClick:()=>{c(),i()},children:(0,r.__)("Retry","complianz-gdpr")})]}):t?(0,o.jsx)("div",{className:"cmplz-translation-automation",children:(0,o.jsxs)("div",{className:"cmplz-automation-status",children:[(0,o.jsx)("h4",{children:(0,r.__)("Translation Automation Status","complianz-gdpr")}),(0,o.jsxs)("div",{className:"cmplz-status-info",children:[(0,o.jsxs)("p",{children:[(0,o.jsx)("strong",{children:(0,r.__)("Status:","complianz-gdpr")}),t.is_enabled?(0,o.jsxs)("span",{className:"cmplz-status-enabled",children:["✓ ",(0,r.__)("Enabled","complianz-gdpr")]}):(0,o.jsxs)("span",{className:"cmplz-status-disabled",children:["✗ ",(0,r.__)("Disabled","complianz-gdpr")]})]}),t.is_enabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("p",{children:[(0,o.jsx)("strong",{children:(0,r.__)("Interval:","complianz-gdpr")})," ",t.interval_display]}),(0,o.jsxs)("p",{children:[(0,o.jsx)("strong",{children:(0,r.__)("Next Run:","complianz-gdpr")})," ",t.next_run_formatted]})]})]})]})}):(0,o.jsx)("div",{className:"cmplz-translation-automation",children:(0,o.jsx)("p",{children:(0,r.__)("No automation status available","complianz-gdpr")})})})},21222:(a,t,s)=>{s.r(t),s.d(t,{UseTranslationsData:()=>e});var n=s(81621),r=s(9588);const e=(0,n.vt)((a,t)=>({translationDataLoaded:!1,translationDataLoading:!1,saving:!1,error:null,translationStatus:null,cronStatus:null,cronInterval:"cmplz_weekly",testResults:null,fetchTranslationStatus:async()=>{if(!t().translationDataLoading){a({translationDataLoading:!0,error:null});try{const t=await r.doAction("get_translation_status",{});t.request_success?a({translationStatus:t.data,translationDataLoaded:!0,translationDataLoading:!1,error:null}):a({translationDataLoaded:!0,translationDataLoading:!1,error:t.message||"Failed to load translation status"})}catch(t){a({translationDataLoaded:!0,translationDataLoading:!1,error:"Error loading translation status"})}}},fetchCronStatus:async()=>{a({translationDataLoading:!0,error:null});try{const t=await r.doAction("get_cron_status",{});t.request_success?a({cronStatus:t.data,cronInterval:t.data.interval_setting||"cmplz_weekly",translationDataLoaded:!0,translationDataLoading:!1,error:null}):a({translationDataLoaded:!0,translationDataLoading:!1,error:t.message||"Failed to load cron status"})}catch(t){a({translationDataLoaded:!0,translationDataLoading:!1,error:"Error loading cron status"})}},updateCronInterval:async s=>{a({saving:!0,error:null});try{const n=await r.doAction("update_cron_interval",{interval:s});return n.request_success?(a({cronInterval:s,saving:!1,error:null}),await t().fetchCronStatus(),{success:!0,message:n.message}):(a({saving:!1,error:n.message||"Failed to update interval"}),{success:!1,message:n.message})}catch(t){return a({saving:!1,error:"Error updating interval"}),{success:!1,message:"Error updating interval"}}},fetchTranslations:async()=>{a({saving:!0,error:null});try{const s=await r.doAction("fetch_translations",{});return s.request_success?(a({saving:!1,error:null}),await t().fetchTranslationStatus(),{success:!0,message:s.message||"Translations fetched successfully!"}):(a({saving:!1,error:s.message||"Failed to fetch translations"}),{success:!1,message:s.message})}catch(t){return a({saving:!1,error:"Error fetching translations"}),{success:!1,message:"Error fetching translations"}}},refreshCronStatus:async()=>{await t().fetchCronStatus()},testTranslations:async()=>{a({saving:!0,error:null});try{const t=await r.doAction("test_translations",{});return t.request_success?(a({testResults:t.data,saving:!1,error:null}),{success:!0,message:"Translation test completed!"}):(a({saving:!1,error:t.message||"Failed to test translations"}),{success:!1,message:t.message})}catch(t){return a({saving:!1,error:"Error testing translations"}),{success:!1,message:"Error testing translations"}}},clearError:()=>{a({error:null})},reset:()=>{a({translationDataLoaded:!1,translationDataLoading:!1,saving:!1,error:null,translationStatus:null,cronStatus:null,cronInterval:"cmplz_weekly",testResults:null})}}))}}]);