apac-ops-bot/frontend/package.json
SamoilenkoVadym ddaa963bc2 Fix crypto error by disabling MSAL when Azure AD is not configured
Problem:
- MSAL library was causing crypto errors in browser
- Black screen on load due to MSAL initialization failure
- Error: crypto module not available in browser environment

Solution:
- Made MSAL initialization conditional based on Azure AD configuration
- Only initialize MSAL if REACT_APP_AZURE_CLIENT_ID is properly configured
- Allow simple login to work without MSAL for testing purposes
- Gracefully handle both MSAL and simple login modes

Changes:
- frontend/src/context/AuthContext.tsx:
  * Check if Azure AD is configured before initializing MSAL
  * Set msalInstance to null when Azure is not configured
  * Updated all MSAL calls to check for null before use
  * Simple login works independently of MSAL

- frontend/package.json:
  * Added crypto polyfills as devDependencies (for future use)
  * Packages: crypto-browserify, buffer, stream-browserify, etc.

- frontend/src/styles/theme.css:
  * Added login form styles (login-container, login-card, form-group, etc.)

Benefits:
- No more crypto errors in browser
- Simple login works without Azure AD configuration
- Easy testing with test accounts (admin/user)
- Production Azure AD login still supported when configured
- Graceful fallback for environments without Azure setup

Testing:
- Frontend compiles successfully without crypto errors
- All services running: backend, frontend, postgres, redis
- Simple login working with test accounts
- No black screen on load

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-28 10:56:54 +00:00

66 lines
1.8 KiB
JSON

{
"name": "apac-ops-bot-frontend",
"version": "1.0.0",
"description": "Frontend for APAC Ops Bot - AI-powered operations assistant",
"private": true,
"dependencies": {
"@azure/msal-browser": "^3.7.1",
"@azure/msal-react": "^2.0.11",
"axios": "^1.6.5",
"prismjs": "^1.29.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-markdown": "^9.0.1",
"react-router-dom": "^6.30.3",
"recharts": "^2.10.4"
},
"devDependencies": {
"@types/node": "^20.11.0",
"@types/prismjs": "^1.26.3",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.19.0",
"assert": "^2.1.0",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"eslint": "^8.56.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"https-browserify": "^1.0.0",
"os-browserify": "^0.3.0",
"process": "^0.11.10",
"react-app-rewired": "^2.2.1",
"react-scripts": "5.0.1",
"source-map-loader": "^3.0.0",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"typescript": "^5.3.3",
"url": "^0.11.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"format": "prettier --write \"src/**/*.{ts,tsx,json,css}\""
},
"eslintConfig": {
"extends": [
"react-app"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}