Skip to content

Commit

Permalink
Update filenames and remove index files
Browse files Browse the repository at this point in the history
  • Loading branch information
AfraHussaindeen committed Sep 22, 2024
1 parent 52d98ba commit 14a9e8a
Show file tree
Hide file tree
Showing 27 changed files with 78 additions and 152 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

import React, { createContext, useContext, ReactNode } from 'react';
import { ConfigInterface } from './configLoader';
import { ConfigInterface } from './config-loader';

const ConfigContext = createContext(null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

import { AsgardeoAuthException } from "@asgardeo/auth-react";
import React, { FunctionComponent, ReactElement } from "react";
import { AuthenticationFailure } from "./pages/AuthenticationFailure";
import { InvalidSystemTimePage } from "./pages/InvalidSystemTime";
import { AuthenticationFailurePage, InvalidSystemTimePage } from "./pages";

interface ErrorBoundaryProps {
error: AsgardeoAuthException;
Expand All @@ -34,7 +33,7 @@ export const ErrorBoundary: FunctionComponent<ErrorBoundaryProps> = (
if (error?.code === "SPA-CRYPTO-UTILS-VJ-IV01" || error?.message === "ERR_JWT_CLAIM_VALIDATION_FAILED nbf") {
return <InvalidSystemTimePage/>
} else if (error?.code === "SPA-MAIN_THREAD_CLIENT-SI-SE01") {
return <AuthenticationFailure/>
return <AuthenticationFailurePage/>
}

return children;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

import { HttpRequestConfig, HttpResponse } from "@asgardeo/auth-react";
import { IdVClaim, SdkFlowStatus, IdVResponseInterface, ClaimVerificationStatus } from "../model/identity-verification";
import { IdVConstants } from "../constants";
import { IdVConstants } from "../constants/idv-constants";
import { AsgardeoSPAClient } from "@asgardeo/auth-react";
import { ConfigInterface } from "../configLoader";
import { ConfigInterface } from "../config-loader";

const httpClient = AsgardeoSPAClient.getInstance();

Expand Down
19 changes: 0 additions & 19 deletions samples/react-sample-app/src/api/index.ts

This file was deleted.

40 changes: 26 additions & 14 deletions samples/react-sample-app/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,30 @@
* under the License.
*/

import React, { useState, useEffect } from 'react';
import { loadConfig } from './configLoader';
import { AuthProvider, useAuthContext } from "@asgardeo/auth-react";
import { FunctionComponent, ReactElement } from "react";
import ReactDOM from "react-dom/client";
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
import { ThemeProvider } from "@oxygen-ui/react";
import { ErrorBoundary } from "./error-boundary";
import { HomePage, NotFoundPage, GenericErrorPage, VerificationInProgressPage, SuccessPage, VerifyPage, LoginPage, AuthenticationFailure } from "./pages";
import { LoadingSpinner, ProtectedRoute } from "./components";
import Theme from './styles/guardioTheme';
import { ConfigProvider } from './configContext';
import React, { useState, useEffect, FunctionComponent, ReactElement } from 'react';
import ReactDOM from 'react-dom/client';
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';

import { AuthProvider, useAuthContext } from '@asgardeo/auth-react';
import { ThemeProvider } from '@oxygen-ui/react';

import { loadConfig } from './config-loader';
import GuardioTheme from './styles/guardio-theme';

import { ConfigProvider } from './ConfigContext';
import { ErrorBoundary } from './ErrorBoundary';
import { LoadingSpinner } from './components/LoadingSpinner';
import { ProtectedRoute } from './components/ProtectedRoute';

import {
HomePage,
NotFoundPage,
GenericErrorPage,
VerificationInProgressPage,
SuccessPage,
VerifyPage,
LoginPage,
AuthenticationFailurePage } from "./pages";

const AppContent: FunctionComponent = (): ReactElement => {
const { error } = useAuthContext();
Expand All @@ -42,7 +54,7 @@ const AppContent: FunctionComponent = (): ReactElement => {
<Route path="/success" element={<ProtectedRoute><SuccessPage /></ProtectedRoute>} />
<Route path="/verification-in-progress" element={<ProtectedRoute><VerificationInProgressPage /></ProtectedRoute>} />
<Route path="/generic-error" element={<GenericErrorPage />} />
<Route path="/auth-error" element={<AuthenticationFailure />} />
<Route path="/auth-error" element={<AuthenticationFailurePage />} />
<Route path="*" element={<NotFoundPage />} />
</Routes>
</Router>
Expand All @@ -68,7 +80,7 @@ const App = () => {
return (
<ConfigProvider config={config}>
<AuthProvider config={config}>
<ThemeProvider theme={Theme} defaultMode="light">
<ThemeProvider theme={GuardioTheme} defaultMode="light">
<AppContent/>
</ThemeProvider>
</AuthProvider>
Expand Down
2 changes: 1 addition & 1 deletion samples/react-sample-app/src/components/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
Typography,
} from "@oxygen-ui/react";
import { UserIcon, ArrowRightFromBracketIcon } from "@oxygen-ui/react-icons";
import { useConfig } from "../configContext";
import { useConfig } from "../ConfigContext";

export const NavBar = () => {
const { state, signOut } = useAuthContext();
Expand Down
2 changes: 1 addition & 1 deletion samples/react-sample-app/src/components/ProtectedRoute.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Navigate, useLocation } from 'react-router-dom';
import { useAuthContext } from "@asgardeo/auth-react";
import { LoadingSpinner } from './loading-spinner';
import { LoadingSpinner } from './LoadingSpinner';

interface ProtectedRouteProps {
children: React.ReactNode;
Expand Down
24 changes: 0 additions & 24 deletions samples/react-sample-app/src/components/index.tsx

This file was deleted.

19 changes: 0 additions & 19 deletions samples/react-sample-app/src/constants/errors.ts

This file was deleted.

20 changes: 0 additions & 20 deletions samples/react-sample-app/src/constants/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
import React, { FunctionComponent, ReactElement, useState } from "react";
import { useAuthContext } from "@asgardeo/auth-react";
import { Container, Box, Typography, Button } from "@mui/material";
import { NavBar, Footer } from '../components';
import { Footer } from "../components/Footer";
import { NavBar } from "../components/NavBar";

/**
* Page to display Authentication Failure Page.
Expand All @@ -28,7 +29,7 @@ import { NavBar, Footer } from '../components';
*
* @return {React.ReactElement}
*/
export const AuthenticationFailure: FunctionComponent = (): ReactElement => {
export const AuthenticationFailurePage: FunctionComponent = (): ReactElement => {

const { signIn } = useAuthContext();
const [ hasAuthenticationErrors, setHasAuthenticationErrors ] = useState<boolean>(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import React from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import { Box, Button, Container, Paper, Typography } from '@oxygen-ui/react';
import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
import { NavBar, Footer } from '../components';
import { Footer } from "../components/Footer";
import { NavBar } from "../components/NavBar";

interface LocationState {
message?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@
import { useAuthContext } from "@asgardeo/auth-react";
import React, { FunctionComponent, ReactElement, useCallback, useEffect, useState } from "react";
import { useLocation, useNavigate } from "react-router-dom";
import { isClaimVerified } from "../api";
import { AgeVerificationDrawer, Footer, LoadingSpinner, NavBar, Plans } from "../components";
import { isClaimVerified } from "../api/identity-verification-client";
import { Footer } from "../components/Footer";
import { NavBar } from "../components/NavBar";
import { AgeVerificationDrawer } from "../components/AgeVerificationDrawer";
import { LoadingSpinner } from "../components/LoadingSpinner";
import { Plans } from "../components/Plans";
import { ClaimVerificationStatus, WorkflowStatus } from "../model/identity-verification";
import { useConfig } from "../configContext";
import { handleMissingIdvpId } from "../util/idVProviderUtils";
import { useConfig } from "../ConfigContext";
import { handleMissingIdvpId } from "../util/IdvProviderMessages";

/**
* Home page for the Sample.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

import React, { FunctionComponent, ReactElement } from "react";
import { Button, Typography, Container, Box } from '@oxygen-ui/react';
import { Footer, NavBar } from "../components";
import { Footer } from "../components/Footer";
import { NavBar } from "../components/NavBar";
import { useNavigate } from "react-router-dom";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
import { useAuthContext } from "@asgardeo/auth-react";
import React, { FunctionComponent, ReactElement, useEffect } from "react";
import { useNavigate, useLocation } from "react-router-dom";
import { Footer, LoadingSpinner, NavBar } from "../components";
import { Footer } from "../components/Footer";
import { NavBar } from "../components/NavBar";
import { LoadingSpinner } from "../components/LoadingSpinner";
import { Typography, Button, Box } from "@oxygen-ui/react";
import { handleMissingClientId } from "../util";
import { useConfig } from "../configContext";
import { handleMissingClientId } from "../util/IdvProviderMessages";
import { useConfig } from "../ConfigContext";

const GUARDIO_FAMILY_IMAGE = `/images/guardio-family.svg`;

Expand Down Expand Up @@ -92,7 +94,7 @@ export const LoginPage: FunctionComponent = (): ReactElement => {
Secure Your Family&apos;s Future
</Typography>
<Typography variant="body1" paragraph sx={{ mb: 4, fontSize: '1.1rem' }}>
Log in to access your account and manage your insurance policies. We're here to protect what matters most to you.
Log in to access your account and manage your insurance policies. We&apos;re here to protect what matters most to you.
</Typography>
<Button
onClick={handleLogin}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
import React, { FunctionComponent, ReactElement } from "react";
import { useNavigate } from "react-router-dom";
import { Button, Typography, Container, Box } from '@oxygen-ui/react';
import { Footer, NavBar } from "../components";
import { Footer } from "../components/Footer";
import { NavBar } from "../components/NavBar";

/**
* Page to display for 404.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
import React from 'react';
import { useLocation, useNavigate } from "react-router-dom";
import { Button, Typography, Container, Box } from '@oxygen-ui/react';
import { Footer, NavBar } from "../components";
import { Footer } from "../components/Footer";
import { NavBar } from "../components/NavBar";

export const SuccessPage = () => {
const navigate = useNavigate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

import * as React from 'react';
import { Button, Typography, Container, Box } from '@oxygen-ui/react';
import { Footer, NavBar } from "../components";
import { Footer } from "../components/Footer";
import { NavBar } from "../components/NavBar";
import { useNavigate } from "react-router-dom";

export const VerificationInProgressPage = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
import React, { FunctionComponent, useEffect, useState } from "react";
import { Onfido } from 'onfido-sdk-ui'
import { useNavigate, useLocation } from "react-router-dom";
import { completeVerification, initiateVerification, reinitiateVerification } from "../api";
import { completeVerification, initiateVerification, reinitiateVerification } from "../api/identity-verification-client";
import { IdVResponseInterface } from "../model/identity-verification";
import { Footer, LoadingSpinner, NavBar } from "../components";
import { Footer } from "../components/Footer";
import { NavBar } from "../components/NavBar";
import { LoadingSpinner } from "../components/LoadingSpinner";
import { Handle } from "onfido-sdk-ui/types/Onfido";
import { useConfig } from "../configContext";
import { useConfig } from "../ConfigContext";

interface VerifyPageProps {
setVerificationInitiated?: (isInitiated: boolean) => void;
Expand Down
17 changes: 9 additions & 8 deletions samples/react-sample-app/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
* under the License.
*/

export * from "./404";
export * from "./home";
export * from "./verify";
export * from "./genericError";
export * from "./success";
export * from "./verification-in-progress";
export * from "./loginPage";
export * from "./AuthenticationFailure";
export * from "./NotFoundPage";
export * from "./HomePage";
export * from "./VerifyPage";
export * from "./GenericErrorPage";
export * from "./SuccessPage";
export * from "./VerificationInProgressPage";
export * from "./LoginPage";
export * from "./AuthenticationFailurePage";
export * from "./InvalidSystemTimePage";
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { extendTheme } from "@oxygen-ui/react";
import { Theme as OxygenTheme } from "@oxygen-ui/react/models";

const Theme: OxygenTheme = extendTheme({
const GuardioTheme: OxygenTheme = extendTheme({
colorSchemes: {
light: {
palette: {
Expand Down Expand Up @@ -114,4 +114,4 @@ const Theme: OxygenTheme = extendTheme({
},
});

export default Theme;
export default GuardioTheme;
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { Typography, Container, Box, Link } from '@oxygen-ui/react';
import { NavBar, Footer } from "../components";
import { Footer } from "../components/Footer";
import { NavBar } from "../components/NavBar";

export const handleMissingIdvpId = () => {
return (
Expand Down
Loading

0 comments on commit 14a9e8a

Please sign in to comment.