Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,14 @@
"domain_operations_update_nationalidentificationnumber": "Steuernummer",
"domain_operations_update_identificationnumber": "Identifikationsnummer",
"domain_operations_update_nicowner_click_whoiscontactbilling": "Ändern Sie die Informationen des Rechnungskontakts, indem Sie hier klicken",
"domain_operations_update_nicowner_click_whoiscontacttech": "Ändern Sie die Informationen des technischen Kontakts, indem Sie hier klicken"
"domain_operations_update_nicowner_click_whoiscontacttech": "Ändern Sie die Informationen des technischen Kontakts, indem Sie hier klicken",
"domain_operations_foa_cta": "Als benannter Vertreter bestätigen",
"domain_operations_foa_title": "Bestätigung als benannter Vertreter für die Domain {{t0}}",
"domain_operations_foa_description": "Dieser Inhaberwechsel wartet auf die Beantwortung der an die Inhaber gesendeten Autorisierungsformulare (FOA). Als benannter Vertreter können Sie diesen Wechsel in ihrem Namen akzeptieren oder ablehnen. Es werden nur die noch unbeantworteten Formulare validiert.",
"domain_operations_foa_certification": "Ich bestätige, dass ich ordnungsgemäß bevollmächtigt bin, als benannter Vertreter zu handeln und im Namen des aktuellen und des neuen Inhabers zu antworten.",
"domain_operations_foa_accept": "Akzeptieren",
"domain_operations_foa_reject": "Ablehnen",
"domain_operations_foa_accept_success": "Der Inhaberwechsel wurde als benannter Vertreter akzeptiert.",
"domain_operations_foa_reject_success": "Der Inhaberwechsel wurde als benannter Vertreter abgelehnt.",
"domain_operations_foa_error": "Bestätigung als benannter Vertreter fehlgeschlagen"
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,14 @@
"domain_operations_update_nationalidentificationnumber": "Tax code ",
"domain_operations_update_identificationnumber": "Identification number",
"domain_operations_update_nicowner_click_whoiscontactbilling": "Change the billing contact information by clicking here",
"domain_operations_update_nicowner_click_whoiscontacttech": "Change the technical contact information by clicking here"
"domain_operations_update_nicowner_click_whoiscontacttech": "Change the technical contact information by clicking here",
"domain_operations_foa_cta": "Validate as Designated Agent",
"domain_operations_foa_title": "Designated Agent validation for the {{t0}} domain name",
"domain_operations_foa_description": "This change of registrant is waiting for the Forms of Authorization (FOA) sent to the holders to be answered. As the Designated Agent, you can accept or reject this change on their behalf. Only the forms still awaiting an answer will be validated.",
"domain_operations_foa_certification": "I certify that I am duly authorised to act as the Designated Agent and to answer on behalf of the current and the new registrant.",
"domain_operations_foa_accept": "Accept",
"domain_operations_foa_reject": "Reject",
"domain_operations_foa_accept_success": "The change of registrant has been accepted as Designated Agent.",
"domain_operations_foa_reject_success": "The change of registrant has been rejected as Designated Agent.",
"domain_operations_foa_error": "Designated Agent validation failed"
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,14 @@
"domain_operations_update_nationalidentificationnumber": "NIF",
"domain_operations_update_identificationnumber": "Número de identificación",
"domain_operations_update_nicowner_click_whoiscontactbilling": "Cambiad la información del contacto de facturación haciendo clic aquí",
"domain_operations_update_nicowner_click_whoiscontacttech": "Cambiad la información del contacto técnico haciendo clic aquí"
"domain_operations_update_nicowner_click_whoiscontacttech": "Cambiad la información del contacto técnico haciendo clic aquí",
"domain_operations_foa_cta": "Validar como agente designado",
"domain_operations_foa_title": "Validación como agente designado para el dominio {{t0}}",
"domain_operations_foa_description": "Este cambio de titular está a la espera de la respuesta a los formularios de autorización (FOA) enviados a los titulares. Como agente designado, puede aceptar o rechazar este cambio en su nombre. Solo se validarán los formularios que sigan sin respuesta.",
"domain_operations_foa_certification": "Certifico que estoy debidamente autorizado/a para actuar como agente designado y responder en nombre del titular actual y del nuevo titular.",
"domain_operations_foa_accept": "Aceptar",
"domain_operations_foa_reject": "Rechazar",
"domain_operations_foa_accept_success": "El cambio de titular se ha aceptado como agente designado.",
"domain_operations_foa_reject_success": "El cambio de titular se ha rechazado como agente designado.",
"domain_operations_foa_error": "No se pudo realizar la validación como agente designado"
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,14 @@
"domain_operations_update_nicbilling_click": "Changez les informations du contact facturation en cliquant ici",
"domain_operations_accelerate_success": "L'opération a été accélérée avec succès.",
"domain_operations_cancel_success": "L'opération a été annulée avec succès.",
"domain_operations_relaunch_success": "L'opération a été relancée avec succès."
"domain_operations_relaunch_success": "L'opération a été relancée avec succès.",
"domain_operations_foa_cta": "Valider en tant qu'agent désigné",
"domain_operations_foa_title": "Validation en tant qu'agent désigné pour le nom de domaine {{t0}}",
"domain_operations_foa_description": "Ce changement de titulaire est en attente de la validation des formulaires d'autorisation (FOA) envoyés aux titulaires. En tant qu'agent désigné, vous pouvez accepter ou rejeter ce changement en leur nom. Seuls les formulaires encore sans réponse seront validés.",
"domain_operations_foa_certification": "Je certifie que je suis dûment autorisé(e) à agir en tant qu'agent désigné et à répondre au nom du titulaire actuel et du nouveau titulaire.",
"domain_operations_foa_accept": "Accepter",
"domain_operations_foa_reject": "Rejeter",
"domain_operations_foa_accept_success": "Le changement de titulaire a été accepté en tant qu'agent désigné.",
"domain_operations_foa_reject_success": "Le changement de titulaire a été rejeté en tant qu'agent désigné.",
"domain_operations_foa_error": "Échec de la validation en tant qu'agent désigné"
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,14 @@
"domain_operations_update_nicbilling_click": "Changez les informations du contact facturation en cliquant ici",
"domain_operations_accelerate_success": "L'opération a été accélérée avec succès.",
"domain_operations_cancel_success": "L'opération a été annulée avec succès.",
"domain_operations_relaunch_success": "L'opération a été relancée avec succès."
"domain_operations_relaunch_success": "L'opération a été relancée avec succès.",
"domain_operations_foa_cta": "Valider en tant qu'agent désigné",
"domain_operations_foa_title": "Validation en tant qu'agent désigné pour le nom de domaine {{t0}}",
"domain_operations_foa_description": "Ce changement de titulaire est en attente de la validation des formulaires d'autorisation (FOA) envoyés aux titulaires. En tant qu'agent désigné, vous pouvez accepter ou rejeter ce changement en leur nom. Seuls les formulaires encore sans réponse seront validés.",
"domain_operations_foa_certification": "Je certifie que je suis dûment autorisé(e) à agir en tant qu'agent désigné et à répondre au nom du titulaire actuel et du nouveau titulaire.",
"domain_operations_foa_accept": "Accepter",
"domain_operations_foa_reject": "Rejeter",
"domain_operations_foa_accept_success": "Le changement de titulaire a été accepté en tant qu'agent désigné.",
"domain_operations_foa_reject_success": "Le changement de titulaire a été rejeté en tant qu'agent désigné.",
"domain_operations_foa_error": "Échec de la validation en tant qu'agent désigné"
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,14 @@
"domain_operations_update_nationalidentificationnumber": "Codice fiscale",
"domain_operations_update_identificationnumber": "Numero di identificazione",
"domain_operations_update_nicowner_click_whoiscontactbilling": "Modifica le informazioni del contatto di fatturazione cliccando qui",
"domain_operations_update_nicowner_click_whoiscontacttech": "Modifica le informazioni del contatto tecnico cliccando qui"
"domain_operations_update_nicowner_click_whoiscontacttech": "Modifica le informazioni del contatto tecnico cliccando qui",
"domain_operations_foa_cta": "Convalida come agente designato",
"domain_operations_foa_title": "Convalida come agente designato per il nome di dominio {{t0}}",
"domain_operations_foa_description": "Questo cambio di intestatario è in attesa della risposta ai moduli di autorizzazione (FOA) inviati agli intestatari. In qualità di agente designato, puoi accettare o rifiutare questo cambio per loro conto. Verranno convalidati solo i moduli ancora senza risposta.",
"domain_operations_foa_certification": "Certifico di essere debitamente autorizzato/a ad agire come agente designato e a rispondere per conto dell'intestatario attuale e del nuovo intestatario.",
"domain_operations_foa_accept": "Accetta",
"domain_operations_foa_reject": "Rifiuta",
"domain_operations_foa_accept_success": "Il cambio di intestatario è stato accettato in qualità di agente designato.",
"domain_operations_foa_reject_success": "Il cambio di intestatario è stato rifiutato in qualità di agente designato.",
"domain_operations_foa_error": "Convalida come agente designato non riuscita"
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,14 @@
"domain_operations_update_nationalidentificationnumber": "NIP",
"domain_operations_update_identificationnumber": "Numer identyfikacyjny",
"domain_operations_update_nicowner_click_whoiscontactbilling": "Zmień dane kontaktu do faktur, klikając tutaj",
"domain_operations_update_nicowner_click_whoiscontacttech": "Zmień dane kontaktu technicznego, klikając tutaj"
"domain_operations_update_nicowner_click_whoiscontacttech": "Zmień dane kontaktu technicznego, klikając tutaj",
"domain_operations_foa_cta": "Zatwierdź jako wyznaczony agent",
"domain_operations_foa_title": "Zatwierdzenie jako wyznaczony agent dla domeny {{t0}}",
"domain_operations_foa_description": "Ta zmiana abonenta oczekuje na odpowiedź na formularze autoryzacji (FOA) wysłane do abonentów. Jako wyznaczony agent możesz zaakceptować lub odrzucić tę zmianę w ich imieniu. Zatwierdzone zostaną tylko formularze, na które nie udzielono jeszcze odpowiedzi.",
"domain_operations_foa_certification": "Oświadczam, że jestem należycie upoważniony/a do działania jako wyznaczony agent oraz do udzielania odpowiedzi w imieniu obecnego i nowego abonenta.",
"domain_operations_foa_accept": "Zaakceptuj",
"domain_operations_foa_reject": "Odrzuć",
"domain_operations_foa_accept_success": "Zmiana abonenta została zaakceptowana przez wyznaczonego agenta.",
"domain_operations_foa_reject_success": "Zmiana abonenta została odrzucona przez wyznaczonego agenta.",
"domain_operations_foa_error": "Wystąpił błąd podczas zatwierdzania jako wyznaczony agent"
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,14 @@
"domain_operations_update_nationalidentificationnumber": "Número de identificação fiscal",
"domain_operations_update_identificationnumber": "Número de identificação",
"domain_operations_update_nicowner_click_whoiscontactbilling": "Altere as informações do contacto de faturação clicando aqui",
"domain_operations_update_nicowner_click_whoiscontacttech": "Altere as informações do contacto técnico clicando aqui"
"domain_operations_update_nicowner_click_whoiscontacttech": "Altere as informações do contacto técnico clicando aqui",
"domain_operations_foa_cta": "Validar como agente designado",
"domain_operations_foa_title": "Validação como agente designado para o nome de domínio {{t0}}",
"domain_operations_foa_description": "Esta mudança de titular está a aguardar a resposta aos formulários de autorização (FOA) enviados aos titulares. Como agente designado, pode aceitar ou rejeitar esta mudança em nome deles. Apenas os formulários ainda sem resposta serão validados.",
"domain_operations_foa_certification": "Certifico que estou devidamente autorizado/a a agir como agente designado e a responder em nome do titular atual e do novo titular.",
"domain_operations_foa_accept": "Aceitar",
"domain_operations_foa_reject": "Rejeitar",
"domain_operations_foa_accept_success": "A mudança de titular foi aceite na qualidade de agente designado.",
"domain_operations_foa_reject_success": "A mudança de titular foi rejeitada na qualidade de agente designado.",
"domain_operations_foa_error": "Ocorreu uma falha ao validar como agente designado"
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ vi.mock('react-router-dom', () => ({

vi.mock('@/hooks/data/query', () => ({
useGetDomainInformation: vi.fn(),
usePendingFoas: vi.fn(() => ({
taskId: null,
foas: [],
pendingFoas: [],
isLoading: false,
})),
}));

describe('Datagrid template', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import { useMutation, useQueryClient } from '@tanstack/react-query';
import pLimit from 'p-limit';
import {
Button,
BUTTON_VARIANT,
Checkbox,
CheckboxCheckedChangeDetail,
CheckboxControl,
CheckboxLabel,
Text,
TEXT_PRESET,
} from '@ovhcloud/ods-react';
import { NAMESPACES } from '@ovh-ux/manager-common-translations';
import { ApiError } from '@ovh-ux/manager-core-api';
import { useNotifications } from '@ovh-ux/manager-react-components';
import { validateFoa } from '@/data/api/foa';
import { FoaChoiceEnum } from '@/enum/foa.enum';
import { isPendingFoa } from '@/utils/foa.utils';
import { urls } from '@/routes/routes.constant';
import { useTrackNavigation } from '@/hooks/tracking/useTrackDatagridNavivationLink';
import { TFoa } from '@/types';

interface FoaActionsProps {
readonly domainName: string;
readonly taskId: string;
readonly foas: TFoa[];
readonly product: string;
}

export default function FoaActions({
domainName,
taskId,
foas,
product,
}: FoaActionsProps) {
const { t } = useTranslation(['dashboard', NAMESPACES.ACTIONS]);
const { trackPageNavivationButton } = useTrackNavigation();
const { addError, addSuccess, clearNotifications } = useNotifications();
const navigate = useNavigate();
const queryClient = useQueryClient();
const [isCertified, setIsCertified] = useState(false);

const backToListing = () => {
const url = `${urls.root}${product}`;
trackPageNavivationButton(url);
navigate(url);
};

const {
mutate: validateFoas,
isPending,
variables: submittedChoice,
} = useMutation({
mutationFn: async (choice: FoaChoiceEnum) => {
clearNotifications();
const validateLimit = pLimit(1);
// Answered FOAs are re-checked here so a holder answer landed in the
// meantime is never overwritten by the designated agent
const results = await Promise.allSettled(
foas
.filter(isPendingFoa)
.map((foa) =>
validateLimit(() =>
validateFoa(domainName, taskId, foa.id, choice),
),
),
);
// A 409 means the FOA has just been finalized : idempotent no-op
const [failure] = results.filter(
(result): result is PromiseRejectedResult =>
result.status === 'rejected' &&
(result.reason as ApiError)?.response?.status !== 409,
);
if (failure) {
throw failure.reason;
}
},
onSuccess: async (_data, choice) => {
await queryClient.invalidateQueries({
queryKey: ['me', 'task'],
});
clearNotifications();
addSuccess(
<Text preset={TEXT_PRESET.paragraph}>
{t(
choice === FoaChoiceEnum.Accept
? 'domain_operations_foa_accept_success'
: 'domain_operations_foa_reject_success',
)}
</Text>,
);
backToListing();
// Not awaited : the answered FOAs are refreshed for the listing once
// this page is left, so the entry point disappears from the row
queryClient.invalidateQueries({
queryKey: ['foa'],
});
},
onError: async () => {
// A 400 or a 404 both mean the local FOA data cannot be trusted anymore
await queryClient.invalidateQueries({
queryKey: ['foa'],
});
addError(<Text>{t('domain_operations_foa_error')}</Text>);
},
});

return (
<section className="flex flex-col gap-y-6">
<Checkbox
checked={isCertified}
disabled={isPending}
name="certification"
onCheckedChange={(detail: CheckboxCheckedChangeDetail) =>
setIsCertified(detail.checked === true)
}
>
<CheckboxControl />
<CheckboxLabel>
{t('domain_operations_foa_certification')}
</CheckboxLabel>
</Checkbox>

<div className="flex gap-x-2 mt-8">
<Button
name="cancel"
variant={BUTTON_VARIANT.ghost}
disabled={isPending}
onClick={backToListing}
>
{t(`${NAMESPACES.ACTIONS}:cancel`)}
</Button>
<Button
name="reject"
variant={BUTTON_VARIANT.outline}
disabled={!isCertified || isPending}
loading={isPending && submittedChoice === FoaChoiceEnum.Reject}
onClick={() => validateFoas(FoaChoiceEnum.Reject)}
>
{t('domain_operations_foa_reject')}
</Button>
<Button
name="accept"
disabled={!isCertified || isPending}
loading={isPending && submittedChoice === FoaChoiceEnum.Accept}
onClick={() => validateFoas(FoaChoiceEnum.Accept)}
>
{t('domain_operations_foa_accept')}
</Button>
</div>
</section>
);
}
Loading
Loading