-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into IOBP-238-idpay-cie-onboarding-xstate-flow
- Loading branch information
Showing
16 changed files
with
466 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import I18n from "i18n-js"; | ||
import React from "react"; | ||
import { useDispatch } from "react-redux"; | ||
import { TokenRefreshState } from "../store/reducers"; | ||
import { logoutRequest } from "../../../store/actions/authentication"; | ||
import { openWebUrl } from "../../../utils/url"; | ||
import { askUserToRefreshSessionToken } from "../store/actions"; | ||
import AskUserInteractionScreen from "./AskUserInterarctionScreen"; | ||
import RefreshTokenLoadingScreen from "./RefreshTokenLoadingScreen"; | ||
|
||
const FastLoginModals = ( | ||
tokenRefreshing: TokenRefreshState, | ||
isFastLoginUserInteractionNeeded: boolean | ||
) => { | ||
const dispatch = useDispatch(); | ||
|
||
if (tokenRefreshing.kind === "no-pin-error") { | ||
return ( | ||
<AskUserInteractionScreen | ||
pictogramName="timeout" | ||
title={I18n.t("fastLogin.userInteraction.sessionExpired.noPin.title")} | ||
subtitle={I18n.t( | ||
"fastLogin.userInteraction.sessionExpired.noPin.subtitle" | ||
)} | ||
onSubmit={() => { | ||
dispatch(logoutRequest()); | ||
}} | ||
buttonStylesProps={{ | ||
submitButtonStyle: { | ||
type: "solid", | ||
title: I18n.t( | ||
"fastLogin.userInteraction.sessionExpired.noPin.submitButtonTitle" | ||
) | ||
} | ||
}} | ||
/> | ||
); | ||
} | ||
|
||
if (tokenRefreshing.kind === "transient-error") { | ||
return ( | ||
<AskUserInteractionScreen | ||
pictogramName="umbrella" | ||
title={I18n.t( | ||
"fastLogin.userInteraction.sessionExpired.transientError.title" | ||
)} | ||
subtitle={I18n.t( | ||
"fastLogin.userInteraction.sessionExpired.transientError.subtitle" | ||
)} | ||
onSubmit={() => { | ||
// FIXME: update this URL once available | ||
// https://pagopa.atlassian.net/browse/IOPID-393 | ||
openWebUrl("https://io.italia.it/faq"); | ||
}} | ||
buttonStylesProps={{ | ||
submitButtonStyle: { | ||
type: "solid", | ||
title: I18n.t( | ||
"fastLogin.userInteraction.sessionExpired.transientError.submitButtonTitle" | ||
) | ||
} | ||
}} | ||
/> | ||
); | ||
} | ||
|
||
if (tokenRefreshing.kind === "in-progress") { | ||
return <RefreshTokenLoadingScreen />; | ||
} | ||
|
||
if (isFastLoginUserInteractionNeeded) { | ||
return ( | ||
<AskUserInteractionScreen | ||
pictogramName="timeout" | ||
title={I18n.t( | ||
"fastLogin.userInteraction.sessionExpired.continueNavigation.title" | ||
)} | ||
subtitle={I18n.t( | ||
"fastLogin.userInteraction.sessionExpired.continueNavigation.subtitle" | ||
)} | ||
onSubmit={() => { | ||
dispatch(askUserToRefreshSessionToken.success("yes")); | ||
}} | ||
buttonStylesProps={{ | ||
submitButtonStyle: { | ||
type: "solid", | ||
title: I18n.t( | ||
"fastLogin.userInteraction.sessionExpired.continueNavigation.submitButtonTitle" | ||
) | ||
} | ||
}} | ||
/> | ||
); | ||
} | ||
|
||
return undefined; | ||
}; | ||
|
||
export default FastLoginModals; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.