"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[1222],{21222:(a,t,s)=>{s.r(t),s.d(t,{UseTranslationsData:()=>e});var r=s(81621),n=s(9588);const e=(0,r.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 n.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 n.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 r=await n.doAction("update_cron_interval",{interval:s});return r.request_success?(a({cronInterval:s,saving:!1,error:null}),await t().fetchCronStatus(),{success:!0,message:r.message}):(a({saving:!1,error:r.message||"Failed to update interval"}),{success:!1,message:r.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 n.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 n.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})}}))}}]);