diff --git a/package.json b/package.json index 9b8a0f69..1b69191b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stromae", - "version": "2.0.5", + "version": "2.0.6", "private": true, "dependencies": { "@axa-fr/react-oidc-context": "^3.1.6", diff --git a/src/components/genericPages/end.js b/src/components/genericPages/end.js index 807fabfb..0eebed9b 100644 --- a/src/components/genericPages/end.js +++ b/src/components/genericPages/end.js @@ -46,7 +46,11 @@ const EndPage = () => { logoutAndClose, metadata: { inseeContext, variables }, personalization, + stateData: { date }, } = useContext(OrchestratorContext); + + const finalDate = date || 0; + const { pathname } = useLocation(); const { idQ, idSU } = useParams(); @@ -61,10 +65,10 @@ const EndPage = () => { console.log(`${status} : ${error}`); }; - const validatedDate = `${formatDistance(new Date(), new Date(), { + const validatedDate = `${formatDistance(finalDate, new Date(), { addSuffix: true, locale: dateFnsLocal, - })} (${format(new Date(), formatLocal)})`; + })} (${format(finalDate, formatLocal)})`; const getBodyWithVariables = myBody => interpret(['VTL'])({ diff --git a/src/components/orchestrator/collector/index.js b/src/components/orchestrator/collector/index.js index 220a431f..9e15538c 100644 --- a/src/components/orchestrator/collector/index.js +++ b/src/components/orchestrator/collector/index.js @@ -93,7 +93,12 @@ export const Orchestrator = ({ }; const [currentPage, setCurrentPage] = useState(() => { - if (!validated && stateData?.currentPage) return stateData?.currentPage; + if (!validated && stateData?.currentPage) { + if (isLunaticPage(stateData?.currentPage)) { + setPage(stateData?.currentPage); + } + return stateData?.currentPage; + } if (validated) return END_PAGE; return WELCOME_PAGE; }); @@ -220,7 +225,7 @@ export const Orchestrator = ({ setInit(!o)} - goToFirstPage={() => setCurrentPage(0)} + goToFirstPage={() => setPage('1')} /> { + const history = useHistory(); const { authenticationType } = useContext(AppContext); if (authenticationType === NONE) - return { authenticationType, name: 'Fake User' }; + return { + authenticationType, + name: 'Fake User', + logout: () => history.push('/'), + }; if (authenticationType === OIDC) { /** * Assume this conditional hook does not break anything