| 1 |
<script setup lang="ts"> |
| 2 |
|
| 3 |
import Card from "@/components/Card.vue"; |
| 4 |
import Button from "@/components/Button/Button.vue"; |
| 5 |
import {isNewerVerison, translate} from "@/utils/helpers"; |
| 6 |
import {computed, ref} from "vue"; |
| 7 |
|
| 8 |
const showNotice = ref(true); |
| 9 |
|
| 10 |
const dismissNotice = () => { |
| 11 |
showNotice.value = false; |
| 12 |
|
| 13 |
fetch(ajaxurl, { |
| 14 |
method: 'POST', |
| 15 |
headers: { |
| 16 |
'Content-Type': 'application/x-www-form-urlencoded', |
| 17 |
}, |
| 18 |
body: new URLSearchParams({ |
| 19 |
'action': 'hostinger_dismiss_plugin_split_notice', |
| 20 |
'nonce': hostinger_tools_data.hts_close_plugin_split_nonce |
| 21 |
}), |
| 22 |
}) |
| 23 |
.then(response => { |
| 24 |
if (!response.ok) { |
| 25 |
throw new Error('Network response was not ok ' + response.statusText); |
| 26 |
} |
| 27 |
return response.json(); |
| 28 |
}) |
| 29 |
.then(data => { |
| 30 |
showNotice.value = false; |
| 31 |
}) |
| 32 |
.catch(error => { |
| 33 |
console.error('Error:', error); |
| 34 |
}); |
| 35 |
}; |
| 36 |
|
| 37 |
const isNoticeShown = computed(() => { |
| 38 |
return showNotice.value && parseInt(hostinger_tools_data.plugin_split_notice) > 0; |
| 39 |
}); |
| 40 |
|
| 41 |
</script> |
| 42 |
<template> |
| 43 |
<Card v-if="isNoticeShown"> |
| 44 |
<template #header> |
| 45 |
<div class="d-flex justify-content-between w-100"> |
| 46 |
<div class="d-flex"> |
| 47 |
<h2 class="h-m-0"> |
| 48 |
{{ translate("hostinger_tools_split_title") }} |
| 49 |
</h2> |
| 50 |
</div> |
| 51 |
</div> |
| 52 |
</template> |
| 53 |
<p class="text-body-2"> |
| 54 |
{{ translate("hostinger_tools_split_body") }} |
| 55 |
</p> |
| 56 |
<Button |
| 57 |
class="h-mt-20" |
| 58 |
@click="dismissNotice" |
| 59 |
> |
| 60 |
{{ translate("hostinger_tools_split_got_it") }} |
| 61 |
</Button> |
| 62 |
</Card> |
| 63 |
</template> |
| 64 |
|
| 65 |
<style scoped lang="scss"> |
| 66 |
|
| 67 |
</style> |
| 68 |
|