-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Restrict access to "offline" flows (#3196)
- Loading branch information
1 parent
ac9fb31
commit d9641ae
Showing
13 changed files
with
140 additions
and
22 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,16 @@ | ||
import Typography from "@mui/material/Typography"; | ||
import StatusPage from "pages/Preview/StatusPage"; | ||
import React from "react"; | ||
|
||
export const OfflinePage: React.FC = () => ( | ||
<StatusPage bannerHeading="Offline"> | ||
<Typography variant="body2"> | ||
This service is not currently available to new applicants. Please check | ||
back later. | ||
</Typography> | ||
<Typography variant="body2"> | ||
If you're resuming an application you previously started, please use the | ||
link sent to you via email. | ||
</Typography> | ||
</StatusPage> | ||
); |
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,16 @@ | ||
import { useStore } from "pages/FlowEditor/lib/store"; | ||
import { OfflinePage } from "pages/OfflinePage"; | ||
import React, { PropsWithChildren } from "react"; | ||
|
||
const OfflineLayout = ({ children }: PropsWithChildren) => { | ||
const isFlowOnline = useStore.getState().flowStatus === "online"; | ||
const searchParams = new URLSearchParams(window.location.search); | ||
const isUserResuming = Boolean(searchParams.get("sessionId")); | ||
|
||
// Allow users to complete Save & Return journeys, even if a flow is offline | ||
const isFlowAccessible = isFlowOnline || isUserResuming; | ||
|
||
return isFlowAccessible ? children : <OfflinePage />; | ||
}; | ||
|
||
export default OfflineLayout; |
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