Skip to content
Draft
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
1 change: 1 addition & 0 deletions apps/customer-portal/microapp/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_BACKEND_URL=https://example.com/api
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
VITE_BACKEND_URL=https://example.com/api
VITE_BACKEND_URL=https://example.com/api

30 changes: 30 additions & 0 deletions apps/customer-portal/microapp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local
package-lock.json

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# config.js
/public/config.js

.env
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.env
.env

8 changes: 8 additions & 0 deletions apps/customer-portal/microapp/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"endOfLine": "lf",
"singleQuote": false,
"trailingComma": "all",
"printWidth": 120,
"semi": true,
"tabWidth": 2
}
15 changes: 15 additions & 0 deletions apps/customer-portal/microapp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Setting Up Environment Configuration

1. **Create a file named `config.js` inside the `public` folder in root directory.**
2. **Add the following code to `config.js`:**

```javascript
window.config = {
ASGARDEO_BASE_URL: "", // Asgardeo base URL
CLIENT_ID: "", // Asgardeo client ID
SIGN_IN_REDIRECT_URL: "", // Redirect URL after sign in
SIGN_OUT_REDIRECT_URL: "", // Redirect URL after sign out
BACKEND_BASE_URL: "", // Backend API base URL
IS_MICROAPP: true,
};
```
46 changes: 46 additions & 0 deletions apps/customer-portal/microapp/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (c) 2025 WSO2 LLC. (https://www.wso2.com).
//
// WSO2 LLC. licenses this file to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file except
// in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";
import { defineConfig, globalIgnores } from "eslint/config";
import prettier from "eslint-plugin-prettier";
import prettierConfig from "eslint-config-prettier";

export default defineConfig([
globalIgnores(["dist"]),
{
files: ["**/*.{ts,tsx}"],
extends: [js.configs.recommended, ...tseslint.configs.recommended, prettierConfig],
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
prettier: prettier,
},
rules: {
...reactHooks.configs.recommended.rules,
...reactRefresh.configs.vite.rules,
"prettier/prettier": "error",
},
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
},
]);
32 changes: 32 additions & 0 deletions apps/customer-portal/microapp/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!--
Copyright (c) 2025 WSO2 LLC. (https://www.wso2.com).

WSO2 LLC. licenses this file to you under the Apache License,
Version 2.0 (the "License"); you may not use this file except
in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/wso2-logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<script src="/config.js"></script>
</body>
</html>
53 changes: 53 additions & 0 deletions apps/customer-portal/microapp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "microapp",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview",
"prettier": "prettier --write .",
"prettier:check": "prettier --check ."
},
"dependencies": {
"@asgardeo/auth-react": "^5.3.0",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@headlessui/react": "^2.2.3",
"@mui/icons-material": "^7.3.6",
"@mui/material": "^7.3.6",
"@tanstack/react-query": "^5.90.12",
"@types/react": "^19.1.3",
"@types/react-dom": "^19.1.3",
"@types/react-router-dom": "^5.3.3",
"axios": "^1.13.2",
"jwt-decode": "^4.0.0",
"react": "^19.1.1",
"react-dom": "^19.1.1",
"react-router-dom": "^7.9.1",
"vite-plugin-svgr": "^4.5.0",
"vite-tsconfig-paths": "^5.1.4",
"zustand": "^5.0.9"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed let's use Context API for state management

},
"devDependencies": {
"@eslint/js": "^9.39.1",
"@tanstack/eslint-plugin-query": "^5.91.2",
"@types/node": "^24.10.1",
"@types/react": "^19.1.13",
"@types/react-dom": "^19.1.9",
"@vitejs/plugin-react": "^5.0.3",
"eslint": "^9.39.1",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.4",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"globals": "^16.5.0",
"prettier": "3.6.2",
"typescript": "~5.8.3",
"typescript-eslint": "^8.46.4",
"vite": "^7.1.7"
}
}
38 changes: 38 additions & 0 deletions apps/customer-portal/microapp/public/wso2-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions apps/customer-portal/microapp/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
Copyright (c) 2025 WSO2 LLC. (https://www.wso2.com).

WSO2 LLC. licenses this file to you under the Apache License,
Version 2.0 (the "License"); you may not use this file except
in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/

body {
margin: 0;
font-family: "Arial", sans-serif;
background-color: #fff;
}

.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
background-color: #fff;
padding: 0 16px;
}

.loading-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}

.spinner {
border: 4px solid rgba(0, 0, 0, 0.1);
border-left-color: #d25d23;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
}

@keyframes spin {
to {
transform: rotate(360deg);
}
}
31 changes: 31 additions & 0 deletions apps/customer-portal/microapp/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) 2025 WSO2 LLC. (https://www.wso2.com).
//
// WSO2 LLC. licenses this file to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file except
// in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

import React from "react";
import HomePage from "@pages/HomePage";
import { HashRouter as Router, Route, Routes } from "react-router-dom";

const App: React.FC = () => {
return (
<Router>
<Routes>
<Route path="/" element={<HomePage />} />
</Routes>
</Router>
);
};

export default App;
Loading