feat: enhance LGPD compliance features by adding configurable data protection officer details, consent term settings, and improved error handling across various components
This commit is contained in:
@@ -14,15 +14,25 @@
|
||||
const registrarConsentimento = useMutation(api.lgpd.registrarConsentimento);
|
||||
|
||||
const jaAceitou = $derived(
|
||||
consentimentoQuery?.data?.aceito === true && consentimentoQuery?.data?.versao === '1.0'
|
||||
consentimentoQuery?.data?.aceito === true &&
|
||||
consentimentoQuery?.data?.versao === consentimentoQuery?.data?.versaoTermoAtual
|
||||
);
|
||||
|
||||
const termoObrigatorio = $derived(consentimentoQuery?.data?.termoObrigatorio ?? false);
|
||||
const versaoTermoAtual = $derived(consentimentoQuery?.data?.versaoTermoAtual ?? '1.0');
|
||||
|
||||
async function aceitarTermo() {
|
||||
if (!aceito) {
|
||||
if (termoObrigatorio && !aceito) {
|
||||
erro = 'Você precisa aceitar o termo para continuar';
|
||||
return;
|
||||
}
|
||||
|
||||
if (!aceito) {
|
||||
// Se não é obrigatório e não aceitou, apenas redireciona
|
||||
window.location.href = resolve('/');
|
||||
return;
|
||||
}
|
||||
|
||||
carregando = true;
|
||||
erro = null;
|
||||
|
||||
@@ -30,11 +40,11 @@
|
||||
await registrarConsentimento({
|
||||
tipo: 'termo_uso',
|
||||
aceito: true,
|
||||
versao: '1.0'
|
||||
versao: versaoTermoAtual
|
||||
});
|
||||
sucesso = true;
|
||||
} catch (e: any) {
|
||||
erro = e.message || 'Erro ao registrar consentimento';
|
||||
} catch (e: unknown) {
|
||||
erro = e instanceof Error ? e.message : 'Erro ao registrar consentimento';
|
||||
} finally {
|
||||
carregando = false;
|
||||
}
|
||||
@@ -68,7 +78,7 @@
|
||||
<CheckCircle class="h-16 w-16 text-success mx-auto mb-4" strokeWidth={2} />
|
||||
<h2 class="card-title text-2xl justify-center mb-4">Termo Já Aceito</h2>
|
||||
<p class="text-base-content/80 mb-6">
|
||||
Você já aceitou este termo de consentimento. Se desejar revogar seu consentimento ou
|
||||
Você já aceitou este termo de consentimento (versão {versaoTermoAtual}). Se desejar revogar seu consentimento ou
|
||||
gerenciar suas preferências de privacidade, acesse a página de privacidade.
|
||||
</p>
|
||||
<div class="flex flex-col sm:flex-row gap-4 justify-center">
|
||||
@@ -208,14 +218,24 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="alert alert-warning mb-6">
|
||||
<AlertCircle class="h-5 w-5" />
|
||||
<p class="text-sm">
|
||||
<strong>Atenção:</strong> O aceite deste termo é obrigatório para utilização do
|
||||
sistema. Ao aceitar, você confirma que leu, compreendeu e concorda com todos os
|
||||
termos e condições estabelecidos.
|
||||
</p>
|
||||
</div>
|
||||
{#if termoObrigatorio}
|
||||
<div class="alert alert-warning mb-6">
|
||||
<AlertCircle class="h-5 w-5" />
|
||||
<p class="text-sm">
|
||||
<strong>Atenção:</strong> O aceite deste termo é obrigatório para utilização do
|
||||
sistema. Ao aceitar, você confirma que leu, compreendeu e concorda com todos os
|
||||
termos e condições estabelecidos.
|
||||
</p>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="alert alert-info mb-6">
|
||||
<AlertCircle class="h-5 w-5" />
|
||||
<p class="text-sm">
|
||||
<strong>Informação:</strong> O aceite deste termo é opcional. Você pode aceitar
|
||||
voluntariamente ou continuar sem aceitar.
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -253,7 +273,7 @@
|
||||
<div class="flex flex-col sm:flex-row gap-4">
|
||||
<button
|
||||
onclick={aceitarTermo}
|
||||
disabled={!aceito || carregando}
|
||||
disabled={(termoObrigatorio && !aceito) || carregando}
|
||||
class="btn btn-primary btn-lg flex-1"
|
||||
>
|
||||
{#if carregando}
|
||||
|
||||
Reference in New Issue
Block a user