diff --git a/login-workflow/src/contexts/SharedDictionaries/chinese.ts b/login-workflow/src/contexts/SharedDictionaries/chinese.ts index a4f40f6d..0f0fcbf0 100644 --- a/login-workflow/src/contexts/SharedDictionaries/chinese.ts +++ b/login-workflow/src/contexts/SharedDictionaries/chinese.ts @@ -49,6 +49,7 @@ const resources: CommonTranslationsFile = { LOADING: '正在加载……', REQUEST_ERROR: '抱歉,发送您的请求时出现了程序错误。', PASSWORD_REQUIRED_ERROR: '密码为必填项', + RETRY: '重试', }, FORMS: { FIRST_NAME: '名', diff --git a/login-workflow/src/contexts/SharedDictionaries/english.ts b/login-workflow/src/contexts/SharedDictionaries/english.ts index 3e4e0c56..0f58e9b6 100644 --- a/login-workflow/src/contexts/SharedDictionaries/english.ts +++ b/login-workflow/src/contexts/SharedDictionaries/english.ts @@ -49,6 +49,7 @@ const resources: CommonTranslationsFile = { LOADING: 'Loading...', REQUEST_ERROR: 'Sorry, there was a problem sending your request.', PASSWORD_REQUIRED_ERROR: 'Password Required', + RETRY: 'Retry', }, FORMS: { FIRST_NAME: 'First Name', diff --git a/login-workflow/src/contexts/SharedDictionaries/french.ts b/login-workflow/src/contexts/SharedDictionaries/french.ts index fcf6e6cc..b1673fc6 100644 --- a/login-workflow/src/contexts/SharedDictionaries/french.ts +++ b/login-workflow/src/contexts/SharedDictionaries/french.ts @@ -49,6 +49,7 @@ const resources: CommonTranslationsFile = { LOADING: 'le chargement...', REQUEST_ERROR: `Désolé, un problème est survenu lors de l'envoi de votre demande.`, PASSWORD_REQUIRED_ERROR: 'Mot de passe requis', + RETRY: 'Recommencez', }, FORMS: { FIRST_NAME: 'Prénom', diff --git a/login-workflow/src/contexts/SharedDictionaries/portuguese.ts b/login-workflow/src/contexts/SharedDictionaries/portuguese.ts index 24f9eeff..95b96337 100644 --- a/login-workflow/src/contexts/SharedDictionaries/portuguese.ts +++ b/login-workflow/src/contexts/SharedDictionaries/portuguese.ts @@ -49,6 +49,7 @@ const resources: CommonTranslationsFile = { LOADING: 'A carregar...', REQUEST_ERROR: 'Pedimos desculpa, existe um problema ao submeter o seu pedido', PASSWORD_REQUIRED_ERROR: 'Senha requerida', + RETRY: 'Tentar novamente', }, FORMS: { FIRST_NAME: 'Primeiro Nome', diff --git a/login-workflow/src/contexts/SharedDictionaries/spanish.ts b/login-workflow/src/contexts/SharedDictionaries/spanish.ts index dfda5388..94cbd241 100644 --- a/login-workflow/src/contexts/SharedDictionaries/spanish.ts +++ b/login-workflow/src/contexts/SharedDictionaries/spanish.ts @@ -49,6 +49,7 @@ const resources: CommonTranslationsFile = { LOADING: 'Cargando...', REQUEST_ERROR: 'Lo sentimos, hubo un problema al enviar su solicitud.', PASSWORD_REQUIRED_ERROR: 'Se requiere contraseña', + RETRY: 'Rever', }, FORMS: { FIRST_NAME: 'Nombre', diff --git a/login-workflow/src/contexts/SharedDictionaries/types.ts b/login-workflow/src/contexts/SharedDictionaries/types.ts index 25457b9e..3df7ae57 100644 --- a/login-workflow/src/contexts/SharedDictionaries/types.ts +++ b/login-workflow/src/contexts/SharedDictionaries/types.ts @@ -46,6 +46,7 @@ export type CommonTranslations = { LOADING: string; REQUEST_ERROR: string; PASSWORD_REQUIRED_ERROR: string; + RETRY: string; }; FORMS: { FIRST_NAME: string; diff --git a/login-workflow/src/screens/EulaScreen/EulaScreen.tsx b/login-workflow/src/screens/EulaScreen/EulaScreen.tsx index 34b4a3af..f4d734db 100644 --- a/login-workflow/src/screens/EulaScreen/EulaScreen.tsx +++ b/login-workflow/src/screens/EulaScreen/EulaScreen.tsx @@ -19,7 +19,7 @@ import { useTranslation } from 'react-i18next'; * @param WorkflowCardInstructionProps props that will be passed to the WorkflowCardInstructions component * @param WorkflowCardActionsProps props that will be passed to the WorkflowCardActions component * @param errorDisplayConfig configuration for customizing how errors are displayed - * @param onRefetch used to refetch Eula content. + * @param refreshConfig used to refresh Eula content. * * @category Component */ @@ -162,13 +162,7 @@ export const EulaScreen: React.FC = (props) => { void loadAndCacheEula(); }, [loadAndCacheEula]); - const { - checkboxProps = { ...props.checkboxProps, disabled: eulaFetchError }, - onRefetch = (): void => { - setEulaFetchError(false); - void loadAndCacheEula(); - }, - } = props; + const { checkboxProps = { ...props.checkboxProps, disabled: eulaFetchError } } = props; const workflowCardHeaderProps = { title: t('bluiRegistration:REGISTRATION.STEPS.LICENSE'), @@ -195,6 +189,16 @@ export const EulaScreen: React.FC = (props) => { }, }; + const { + refreshConfig = { + showRefreshButton: eulaFetchError, + onRefresh: (): void => { + setEulaFetchError(false); + void loadAndCacheEula(); + }, + }, + } = props; + return ( = (props) => { onEulaAcceptedChange={updateEulaAcceptedStatus} WorkflowCardActionsProps={workflowCardActionsProps} errorDisplayConfig={errorDisplayConfig} - onRefetch={onRefetch} + refreshConfig={refreshConfig} {...otherEulaScreenProps} /> ); diff --git a/login-workflow/src/screens/EulaScreen/EulaScreenBase.tsx b/login-workflow/src/screens/EulaScreen/EulaScreenBase.tsx index 200112d5..56d49f2a 100644 --- a/login-workflow/src/screens/EulaScreen/EulaScreenBase.tsx +++ b/login-workflow/src/screens/EulaScreen/EulaScreenBase.tsx @@ -14,6 +14,7 @@ import DOMPurify from 'dompurify'; import ErrorManager from '../../components/Error/ErrorManager'; import { Typography } from '@mui/material'; import ReplaySharpIcon from '@mui/icons-material/ReplaySharp'; +import { useTranslation } from 'react-i18next'; /** * Component that renders a screen displaying the EULA and requests acceptance via a checkbox. @@ -29,7 +30,7 @@ import ReplaySharpIcon from '@mui/icons-material/ReplaySharp'; * @param WorkflowCardInstructionProps props that will be passed to the WorkflowCardInstructions component * @param WorkflowCardActionsProps props that will be passed to the WorkflowCardActions component * @param errorDisplayConfig configuration for customizing how errors are displayed - * @param onRefetch used to refetch Eula content. + * @param onRefresh used to refresh Eula content. * * @category Component */ @@ -43,9 +44,10 @@ export const EulaScreenBase: React.FC = (props) => { initialCheckboxValue, checkboxProps, errorDisplayConfig, - onRefetch, + refreshConfig, } = props; + const { t } = useTranslation(); const cardBaseProps = props.WorkflowCardBaseProps || {}; const headerProps = props.WorkflowCardHeaderProps || {}; const instructionsProps = props.WorkflowCardInstructionProps || {}; @@ -71,7 +73,7 @@ export const EulaScreenBase: React.FC = (props) => { {Object.keys(instructionsProps).length !== 0 && } - {checkboxProps?.disabled ? ( + {refreshConfig?.showRefreshButton ? ( = (props) => { cursor: 'pointer', p: 1, }} - onClick={onRefetch} + onClick={refreshConfig?.onRefresh} > - Retry + {refreshConfig?.refreshButtonLabel || t('bluiCommon:MESSAGES.RETRY')} diff --git a/login-workflow/src/screens/EulaScreen/types.ts b/login-workflow/src/screens/EulaScreen/types.ts index 5befc015..bfb73c63 100644 --- a/login-workflow/src/screens/EulaScreen/types.ts +++ b/login-workflow/src/screens/EulaScreen/types.ts @@ -43,8 +43,21 @@ export type EulaScreenProps = WorkflowCardProps & { errorDisplayConfig?: ErrorManagerProps; /** - * Function to refetch Eula content - * @returns void - */ - onRefetch?: () => void; + * used to show refresh button and refresh the Eula content + */ + refreshConfig?: { + /** + * Function to refresh Eula content + * @returns {void} + */ + onRefresh?: () => void; + /** + * the refresh button to be rendered + */ + showRefreshButton?: boolean; + /** + * Label of refresh button + */ + refreshButtonLabel?: string; + }; };