Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18,188 changes: 5,442 additions & 12,746 deletions frontend/package-lock.json

Large diffs are not rendered by default.

59 changes: 29 additions & 30 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@
]
},
"dependencies": {
"@aws-amplify/auth": "^6.12.3",
"@aws-amplify/core": "^6.11.3",
"@aws-amplify/ui-react": "^6.11.1",
"@aws-sdk/client-bedrock-runtime": "^3.797.0",
"@aws-sdk/client-s3": "^3.797.0",
"@aws-sdk/s3-request-presigner": "^3.797.0",
"@aws-sdk/client-bedrock-runtime": "^3.799.0",
"@aws-sdk/client-cognito-identity-provider": "^3.799.0",
"@aws-sdk/client-s3": "^3.802.0",
"@aws-sdk/s3-request-presigner": "^3.802.0",
"@capacitor/android": "^7.2.0",
"@capacitor/app": "^7.0.1",
"@capacitor/assets": "^3.0.5",
Expand All @@ -59,63 +57,64 @@
"@fortawesome/free-regular-svg-icons": "^6.7.2",
"@fortawesome/free-solid-svg-icons": "^6.7.2",
"@fortawesome/react-fontawesome": "^0.2.2",
"@ionic/react": "^8.5.5",
"@ionic/react-router": "^8.5.5",
"@tanstack/react-query": "^5.74.4",
"@tanstack/react-query-devtools": "^5.74.6",
"@ionic/react": "^8.5.6",
"@ionic/react-router": "^8.5.6",
"@tanstack/react-query": "^5.75.2",
"@tanstack/react-query-devtools": "^5.75.2",
"axios": "1.9.0",
"classnames": "2.5.1",
"date-fns": "^4.1.0",
"dayjs": "^1.11.13",
"formik": "^2.4.6",
"i18next": "24.2.1",
"i18next-browser-languagedetector": "8.0.2",
"i18next": "25.0.2",
"i18next-browser-languagedetector": "8.1.0",
"lodash": "4.17.21",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-error-boundary": "5.0.0",
"react-i18next": "15.4.0",
"react": "19.1.0",
"react-dom": "19.1.0",
"react-error-boundary": "6.0.0",
"react-i18next": "15.5.1",
"react-router": "5.3.4",
"react-router-dom": "5.3.4",
"uuid": "^11.1.0",
"yup": "^1.6.1"
},
"devDependencies": {
"@capacitor/cli": "^7.2.0",
"@eslint/js": "^9.25.1",
"@eslint/js": "^9.26.0",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0",
"@testing-library/user-event": "^14.6.1",
"@types/eslint__js": "8.42.3",
"@types/lodash": "4.17.14",
"@types/react": "18.3.11",
"@types/react-dom": "18.3.1",
"@types/eslint": "^9.6.1",
"@types/eslint__js": "9.14.0",
"@types/lodash": "4.17.16",
"@types/react": "19.1.2",
"@types/react-dom": "19.1.3",
"@types/react-router": "5.1.20",
"@types/react-router-dom": "5.3.3",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^8.31.0",
"@typescript-eslint/parser": "^8.31.0",
"@vitejs/plugin-legacy": "6.1.0",
"@typescript-eslint/eslint-plugin": "^8.31.1",
"@typescript-eslint/parser": "^8.31.1",
"@vitejs/plugin-legacy": "6.1.1",
"@vitejs/plugin-react": "4.4.1",
"@vitest/coverage-v8": "^3.1.2",
"eslint": "^9.25.1",
"eslint": "^9.26.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"globals": "15.14.0",
"globals": "16.0.0",
"husky": "^9.1.7",
"jsdom": "^26.1.0",
"lint-staged": "^15.5.1",
"msw": "^2.7.5",
"prettier": "^3.5.3",
"sass": "1.83.1",
"sass": "1.87.0",
"stylelint": "^16.19.1",
"stylelint-config-standard-scss": "^14.0.0",
"stylelint-scss": "^6.11.1",
"terser": "5.37.0",
"typescript": "5.7.2",
"typescript-eslint": "^8.31.0",
"terser": "5.39.0",
"typescript": "5.8.3",
"typescript-eslint": "^8.31.1",
"vite": "6.3.4",
"vitest": "^3.1.2"
}
Expand Down
11 changes: 0 additions & 11 deletions frontend/src/common/api/__tests__/reportService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@ vi.mock('axios', () => ({
},
}));

// Mock auth
vi.mock('@aws-amplify/auth', () => ({
fetchAuthSession: vi.fn().mockResolvedValue({
tokens: {
idToken: {
toString: () => 'mock-id-token',
},
},
}),
}));

// Mock dynamic imports to handle the service functions
vi.mock('../reportService', async (importOriginal) => {
const actual = (await importOriginal()) as typeof ReportServiceModule;
Expand Down
9 changes: 6 additions & 3 deletions frontend/src/common/api/reportService.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import axios, { AxiosProgressEvent } from 'axios';
import { MedicalReport } from '../models/medicalReport';
import { fetchAuthSession } from '@aws-amplify/auth';
import { DirectCognitoAuthService } from '../services/auth/direct-cognito-auth-service';

// Get the API URL from environment variables
const API_URL = import.meta.env.VITE_BASE_URL_API || '';

Expand All @@ -21,8 +22,10 @@ export const getAuthConfig = async (
signal?: AbortSignal;
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void;
}> => {
const session = await fetchAuthSession();
const idToken = session.tokens?.idToken?.toString() || '';
// Get tokens from DirectCognitoAuthService
const tokens = DirectCognitoAuthService.getTokens();
const idToken = tokens?.id_token || '';

return {
headers: {
Accept: 'application/json',
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/common/api/useGetCurrentUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useQuery } from '@tanstack/react-query';

import { CognitoUser } from 'common/models/user';
import { QueryKey } from 'common/utils/constants';
import CognitoAuthService from 'common/services/auth/cognito-auth-service';
import { DirectCognitoAuthService } from 'common/services/auth/direct-cognito-auth-service';
import { mapCognitoUserToAppUser } from 'common/utils/user-mapper';

/**
Expand All @@ -17,7 +17,7 @@ export const useGetCurrentUser = () => {
const getCurentUser = async (): Promise<CognitoUser> => {
try {
// Get current user from Cognito
const cognitoUser = await CognitoAuthService.getCurrentUser();
const cognitoUser = await DirectCognitoAuthService.getCurrentUser();

if (!cognitoUser) {
throw new Error('User not found');
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/common/api/useGetUserTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useQuery } from '@tanstack/react-query';

import { UserTokens } from 'common/models/auth';
import { QueryKey } from 'common/utils/constants';
import CognitoAuthService from 'common/services/auth/cognito-auth-service';
import { DirectCognitoAuthService } from 'common/services/auth/direct-cognito-auth-service';

/**
* An API hook which fetches tokens from AWS Cognito.
Expand All @@ -11,8 +11,8 @@ import CognitoAuthService from 'common/services/auth/cognito-auth-service';
export const useGetUserTokens = () => {
const getUserTokens = async (): Promise<UserTokens> => {
try {
// Get tokens from Cognito
const tokens = await CognitoAuthService.getUserTokens();
// Get tokens directly from DirectCognitoAuthService
const tokens = DirectCognitoAuthService.getTokens();

if (!tokens) {
throw new Error('Tokens not found.');
Expand Down
35 changes: 0 additions & 35 deletions frontend/src/common/config/aws-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,38 +41,3 @@ export const COGNITO_CONFIG = {
// Social providers
SOCIAL_PROVIDERS: ['Google', 'SignInWithApple'],
};

/**
* Get redirect URLs for OAuth
*/
const redirectUrls = {
signIn: [APP_CONFIG.hostedRedirectSignIn],
signOut: [APP_CONFIG.hostedRedirectSignOut],
};

/**
* Amplify Configuration object for initializing Amplify (V6 format)
*/
export const amplifyConfig = {
Auth: {
Cognito: {
userPoolId: COGNITO_CONFIG.USER_POOL_ID,
userPoolClientId: COGNITO_CONFIG.USER_POOL_WEB_CLIENT_ID,
identityPoolId: COGNITO_CONFIG.IDENTITY_POOL_ID,
loginWith: {
email: true,
phone: false,
username: false,
oauth: {
domain: COGNITO_CONFIG.OAUTH_DOMAIN,
scopes: COGNITO_CONFIG.OAUTH_SCOPES,
redirectSignIn: redirectUrls.signIn,
redirectSignOut: redirectUrls.signOut,
responseType: 'code' as const,
},
},
},
},
// Configure only the region you need to use
region: REGION,
};
Loading