Compare commits

...

21 Commits

Author SHA1 Message Date
Dave Richer
0595d58154 - enable sourcemap / manifest
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-01-31 12:24:16 -05:00
Dave Richer
e0855d370b - Package updates
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-01-31 12:13:20 -05:00
Dave Richer
6e8d55cad9 - updates
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-01-31 12:08:57 -05:00
Dave Richer
4e03756e6e Merge branch 'feature/IO-1828-Front-End-Package-Updates' into vite 2024-01-31 12:06:00 -05:00
Dave Richer
419ae32d32 - Merge and update
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-01-31 11:58:17 -05:00
Dave Richer
9668a01415 - Update vite build
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-01-24 11:50:40 -05:00
Dave Richer
6d7f49a858 Merge branch 'feature/IO-1828-Front-End-Package-Updates' into vite
# Conflicts:
#	client/package-lock.json
#	client/package.json
2024-01-24 11:22:47 -05:00
Dave Richer
56256be106 - Reconcile vite
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-01-24 10:22:09 -05:00
Dave Richer
8dfe98d9d7 Merge branch 'feature/IO-1828-Front-End-Package-Updates' into vite
# Conflicts:
#	client/package-lock.json
2024-01-24 10:15:31 -05:00
Dave Richer
e1c325c11d Merge branch 'feature/IO-1828-Front-End-Package-Updates' into vite
# Conflicts:
#	client/src/App/App.container.jsx
2024-01-20 21:22:03 -05:00
Dave Richer
c72d474dc7 Merge branch 'feature/IO-1828-Front-End-Package-Updates' into vite 2024-01-20 19:23:59 -05:00
Dave Richer
b478d26c4c Merge branch 'feature/IO-1828-Front-End-Package-Updates' into vite 2024-01-19 12:31:06 -05:00
Dave Richer
48a08819f3 Merge branch 'feature/IO-1828-Front-End-Package-Updates' into vite
# Conflicts:
#	client/package-lock.json
#	client/package.json
2024-01-18 16:53:24 -05:00
Dave Richer
bb872a2b18 - vite adjustments
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-01-18 15:30:23 -05:00
Dave Richer
3fb3773744 - vite adjustments
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-01-18 14:58:13 -05:00
Dave Richer
7a708e32e4 Merge branch 'feature/IO-1828-Front-End-Package-Updates' into vite 2024-01-18 14:43:47 -05:00
Dave Richer
ee23d83858 - fixes
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-01-18 14:34:06 -05:00
Dave Richer
61d6fdee95 Merge branch 'feature/IO-1828-Front-End-Package-Updates' into vite 2024-01-18 13:51:20 -05:00
Dave Richer
d7cb8d3753 - update
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-01-18 13:14:28 -05:00
Dave Richer
eb3560bd34 Merge branch 'feature/IO-1828-Front-End-Package-Updates' into vite 2024-01-18 13:11:43 -05:00
Dave Richer
71663d64e4 - Updates
Signed-off-by: Dave Richer <dave@imexsystems.ca>
2024-01-18 11:43:57 -05:00
28 changed files with 3474 additions and 11180 deletions

View File

@@ -1,13 +1,13 @@
REACT_APP_GRAPHQL_ENDPOINT=https://db.dev.bodyshop.app/v1/graphql
REACT_APP_GRAPHQL_ENDPOINT_WS=wss://db.dev.bodyshop.app/v1/graphql
REACT_APP_GA_CODE=231099835
REACT_APP_FIREBASE_CONFIG={"apiKey":"AIzaSyDPLT8GiDHDR1R4nI66Qi0BY1aYviDPioc","authDomain":"imex-dev.firebaseapp.com","databaseURL":"https://imex-dev.firebaseio.com","projectId":"imex-dev","storageBucket":"imex-dev.appspot.com","messagingSenderId":"759548147434","appId":"1:759548147434:web:e8239868a48ceb36700993","measurementId":"G-K5XRBVVB4S"}
REACT_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/io-test
REACT_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/io-test
REACT_APP_CLOUDINARY_API_KEY=957865933348715
REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS=c_fill,h_250,w_250
REACT_APP_FIREBASE_PUBLIC_VAPID_KEY='BG3tzU7L2BXlGZ_3VLK4PNaRceoEXEnmHfxcVbRMF5o5g05ejslhVPki9kBM9cBBT-08Ad9kN3HSpS6JmrWD6h4'
REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxwJGitwvFsIZUEua4dUzaMIAuXp4qwYHXx7lgjyQSwP0Pe900vzm38C7g
REACT_APP_AXIOS_BASE_API_URL=http://localhost:4000
REACT_APP_REPORTS_SERVER_URL=https://reports3.test.imex.online
REACT_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc
VITE_APP_GRAPHQL_ENDPOINT=https://db.dev.bodyshop.app/v1/graphql
VITE_APP_GRAPHQL_ENDPOINT_WS=wss://db.dev.bodyshop.app/v1/graphql
VITE_APP_GA_CODE=231099835
VITE_APP_FIREBASE_CONFIG={"apiKey":"AIzaSyDPLT8GiDHDR1R4nI66Qi0BY1aYviDPioc","authDomain":"imex-dev.firebaseapp.com","databaseURL":"https://imex-dev.firebaseio.com","projectId":"imex-dev","storageBucket":"imex-dev.appspot.com","messagingSenderId":"759548147434","appId":"1:759548147434:web:e8239868a48ceb36700993","measurementId":"G-K5XRBVVB4S"}
VITE_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/io-test
VITE_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/io-test
VITE_APP_CLOUDINARY_API_KEY=957865933348715
VITE_APP_CLOUDINARY_THUMB_TRANSFORMATIONS=c_fill,h_250,w_250
VITE_APP_FIREBASE_PUBLIC_VAPID_KEY='BG3tzU7L2BXlGZ_3VLK4PNaRceoEXEnmHfxcVbRMF5o5g05ejslhVPki9kBM9cBBT-08Ad9kN3HSpS6JmrWD6h4'
VITE_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxwJGitwvFsIZUEua4dUzaMIAuXp4qwYHXx7lgjyQSwP0Pe900vzm38C7g
VITE_APP_AXIOS_BASE_API_URL=http://localhost:4000
VITE_APP_REPORTS_SERVER_URL=https://reports3.test.imex.online
VITE_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc

View File

@@ -2,12 +2,12 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
<link rel="icon" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#002366" />
<meta name="description" content="ImEX Online" />
<!-- <link rel="apple-touch-icon" href="logo192.png" /> -->
<link rel="apple-touch-icon" href="logo192.png" />
<link rel="apple-touch-icon" href="public/logo192.png" />
<script type="text/javascript">
window.$crisp = [];
window.CRISP_WEBSITE_ID = "36724f62-2eb0-4b29-9cdd-9905fb99913e";
@@ -67,7 +67,7 @@
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="manifest" href="/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
@@ -82,5 +82,7 @@
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="src/index.js"></script>
</body>
</html>

14274
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,10 @@
{
"name": "bodyshop",
"version": "0.2.1",
"engines": {
"node": "18.18.2"
},
"type": "commonjs",
"private": true,
"proxy": "http://localhost:4000",
"dependencies": {
@@ -17,17 +21,22 @@
"@sentry/tracing": "^7.99.0",
"@splitsoftware/splitio-react": "^1.11.0",
"@tanem/react-nprogress": "^5.0.51",
"@vitejs/plugin-legacy": "^5.3.0",
"@vitejs/plugin-react": "^4.2.1",
"@vitejs/plugin-react-refresh": "^1.3.6",
"@vitejs/plugin-react-swc": "^3.6.0",
"antd": "^5.13.3",
"apollo-link-logger": "^2.0.1",
"apollo-link-sentry": "^3.3.0",
"axios": "^1.6.7",
"craco-less": "^3.0.1",
"consola": "^3.2.3",
"dayjs": "^1.11.10",
"dayjs-business-days2": "^1.2.2",
"dinero.js": "^1.9.1",
"dotenv": "^16.4.1",
"enquire-js": "^0.2.1",
"env-cmd": "^10.1.0",
"esbuild": "^0.20.0",
"exifr": "^7.1.3",
"firebase": "^10.7.2",
"graphql": "^16.6.0",
@@ -61,8 +70,7 @@
"react-number-format": "^5.1.4",
"react-redux": "^9.1.0",
"react-resizable": "^3.0.5",
"react-router-dom": "^6.21.3",
"react-scripts": "^5.0.1",
"react-router-dom": "^6.21.2",
"react-sticky": "^6.0.3",
"react-sublime-video": "^0.2.5",
"react-virtualized": "^9.22.5",
@@ -77,6 +85,7 @@
"styled-components": "^6.1.8",
"subscriptions-transport-ws": "^0.11.0",
"terser-webpack-plugin": "^5.3.10",
"vite-plugin-svgr": "^4.2.0",
"web-vitals": "^3.5.2",
"workbox-core": "^7.0.0",
"workbox-expiration": "^7.0.0",
@@ -88,11 +97,11 @@
},
"scripts": {
"analyze": "source-map-explorer 'build/static/js/*.js'",
"start": "craco start",
"build": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` craco build && npm run sentry:sourcemaps",
"start": "vite",
"build": "cross-env-shell VITE_APP_GIT_SHA=\\\"`git rev-parse --short HEAD`\\\" vite build && npm run sentry:sourcemaps",
"build:test": "env-cmd -f .env.test npm run build",
"build-deploy:test": "npm run build:test && s3cmd sync build/* s3://imex-online-test && echo '🚀 TESTING Deployed!'",
"buildcra": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` craco build",
"buildcra": "cross-env-shell VITE_APP_GIT_SHA=\\\"`git rev-parse --short HEAD`\\\" vite build",
"test": "cypress open",
"eject": "react-scripts eject",
"madge": "madge --image ./madge-graph.svg --extensions js,jsx,ts,tsx --circular .",
@@ -123,12 +132,28 @@
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/preset-react": "^7.23.3",
"@emotion/babel-plugin": "^11.11.0",
"@emotion/react": "^11.11.3",
"@sentry/webpack-plugin": "^2.10.3",
"@swc/core": "^1.3.107",
"@swc/plugin-styled-components": "^1.5.108",
"@testing-library/cypress": "^10.0.1",
"browserslist": "^4.22.3",
"browserslist-to-esbuild": "^2.1.1",
"craco-less": "^3.0.1",
"cross-env": "^7.0.3",
"cypress": "^13.6.4",
"eslint-plugin-cypress": "^2.15.1",
"memfs": "^4.6.0",
"os-browserify": "^0.3.0",
"react-error-overlay": "6.0.11",
"redux-logger": "^3.0.6",
"source-map-explorer": "^2.5.3"
"source-map-explorer": "^2.5.3",
"vite": "^5.0.11",
"vite-plugin-babel": "^1.2.0",
"vite-plugin-legacy": "^2.1.0",
"vite-plugin-node-polyfills": "^0.19.0",
"vite-plugin-style-import": "^2.0.0"
}
}

View File

@@ -17,7 +17,7 @@ dayjs.locale("en");
const config = {
core: {
authorizationKey: process.env.REACT_APP_SPLIT_API,
authorizationKey: import.meta.env.VITE_APP_SPLIT_API,
key: "anon",
},
};

View File

@@ -50,7 +50,7 @@ const devTheme = {
*/
const prodTheme = {};
const currentTheme = process.env.NODE_ENV === "development" ? devTheme
const currentTheme = import.meta.env.DEV ? devTheme
: prodTheme;
const finaltheme = {

View File

@@ -19,7 +19,7 @@ export function ChatAffixContainer({ bodyshop, chatVisible }) {
try {
const r = await axios.post("/notifications/subscribe", {
fcm_tokens: await getToken(messaging, {
vapidKey: process.env.REACT_APP_FIREBASE_PUBLIC_VAPID_KEY,
vapidKey: import.meta.env.VITE_APP_FIREBASE_PUBLIC_VAPID_KEY,
}),
type: "messaging",
imexshopid: bodyshop.imexshopid,

View File

@@ -21,6 +21,8 @@ export default function DashboardMonthlyJobCosting({ data, ...cardProps }) {
async function getCostingData() {
if (data && data.monthly_sales) {
setLoading(true);
console.log('defaults:')
console.dir(axios.defaults);
const response = await axios.post("/job/costingmulti", {
jobids: data.monthly_sales.map((x) => x.id),
});

View File

@@ -57,7 +57,7 @@ export const uploadToCloudinary = async (
let tags = `${bodyshop.imexshopid},${
tagsArray ? tagsArray.map((tag) => `${tag},`) : ""
}`;
// let eager = process.env.REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS;
// let eager = import.meta.env.VITE_APP_CLOUDINARY_THUMB_TRANSFORMATIONS;
//Get the signed url.
@@ -96,14 +96,14 @@ export const uploadToCloudinary = async (
formData.append("upload_preset", upload_preset);
formData.append("api_key", process.env.REACT_APP_CLOUDINARY_API_KEY);
formData.append("api_key", import.meta.env.VITE_APP_CLOUDINARY_API_KEY);
formData.append("public_id", public_id);
formData.append("tags", tags);
formData.append("timestamp", timestamp);
formData.append("signature", signature);
const cloudinaryUploadResponse = await cleanAxios.post(
`${process.env.REACT_APP_CLOUDINARY_ENDPOINT_API}/${DetermineFileType(
`${import.meta.env.VITE_APP_CLOUDINARY_ENDPOINT_API}/${DetermineFileType(
fileType
)}/upload`,
formData,

View File

@@ -4,7 +4,7 @@ export const GenerateSrcUrl = (value) => {
let extension = value.extension;
if (extension && extension.toLowerCase().includes("heic")) extension = "jpg";
return `${process.env.REACT_APP_CLOUDINARY_ENDPOINT}/${DetermineFileType(
return `${import.meta.env.VITE_APP_CLOUDINARY_ENDPOINT}/${DetermineFileType(
value.type
)}/upload/${value.key}${extension ? `.${extension}` : ""}`;
};
@@ -18,9 +18,9 @@ export const GenerateThumbUrl = (value) => {
)
extension = "jpg";
return `${process.env.REACT_APP_CLOUDINARY_ENDPOINT}/${DetermineFileType(
return `${import.meta.env.VITE_APP_CLOUDINARY_ENDPOINT}/${DetermineFileType(
value.type
)}/upload/${process.env.REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS}/${
)}/upload/${import.meta.env.VITE_APP_CLOUDINARY_THUMB_TRANSFORMATIONS}/${
value.key
}${extension ? `.${extension}` : ""}`;
};

View File

@@ -5,7 +5,7 @@ import { getFirestore } from "firebase/firestore";
import { getMessaging, getToken, onMessage } from "firebase/messaging";
import { store } from "../redux/store";
const config = JSON.parse(process.env.REACT_APP_FIREBASE_CONFIG);
const config = JSON.parse(import.meta.env.VITE_APP_FIREBASE_CONFIG);
initializeApp(config);
export const auth = getAuth();
@@ -49,7 +49,7 @@ export { messaging };
export const requestForToken = () => {
return getToken(messaging, {
vapidKey: process.env.REACT_APP_FIREBASE_PUBLIC_VAPID_KEY,
vapidKey: import.meta.env.VITE_APP_FIREBASE_PUBLIC_VAPID_KEY,
})
.then((currentToken) => {
if (currentToken) {

View File

@@ -22,7 +22,7 @@ import { ConfigProvider } from "antd";
// Dinero.globalLocale = "en-CA";
Dinero.globalRoundingMode = "HALF_EVEN";
if (process.env.NODE_ENV !== "development") {
if (import.meta.env.PROD) {
Sentry.init({
dsn: "https://fd7e89369b6b4bdc9c6c4c9f22fa4ee4@o492140.ingest.sentry.io/5651027",
ignoreErrors: [
@@ -39,7 +39,7 @@ if (process.env.NODE_ENV !== "development") {
],
tracesSampleRate: 1.0,
replaysOnErrorSampleRate: 1.0,
environment: process.env.NODE_ENV,
environment: import.meta.env.MODE,
});
}

View File

@@ -6,7 +6,7 @@ export default function AboutPage() {
<div style={{ textAlign: "center", margin: "1rem 0rem" }}>
<Typography.Title
level={2}
>{`ImEX Online V.${process.env.NODE_ENV}-${process.env.REACT_APP_GIT_SHA}`}</Typography.Title>
>{`ImEX Online V.${import.meta.env.MODE}-${import.meta.env.VITE_APP_GIT_SHA}`}</Typography.Title>
<Typography.Title level={4}>
&copy; 2019 - {new Date().getFullYear()} Snapt Software Inc. used under
license to ImEX Systems Inc.

View File

@@ -26,8 +26,8 @@ const mapDispatchToProps = (dispatch) => ({
export default connect(mapStateToProps, mapDispatchToProps)(DmsContainer);
export const socket = SocketIO(
process.env.NODE_ENV === "production"
? process.env.REACT_APP_AXIOS_BASE_API_URL
import.meta.env.PROD
? import.meta.env.VITE_APP_AXIOS_BASE_API_URL
: window.location.origin,
{
path: "/ws",

View File

@@ -43,8 +43,8 @@ const mapDispatchToProps = (dispatch) => ({
export default connect(mapStateToProps, mapDispatchToProps)(DmsContainer);
export const socket = SocketIO(
process.env.NODE_ENV === "production"
? process.env.REACT_APP_AXIOS_BASE_API_URL
import.meta.env.PROD
? import.meta.env.VITE_APP_AXIOS_BASE_API_URL
: window.location.origin,
// "http://localhost:4000", // for dev testing,
{

View File

@@ -1,5 +1,5 @@
import {FloatButton, Layout} from "antd";
import preval from "preval.macro";
// import preval from "preval.macro";
import React, {lazy, Suspense, useEffect, useState} from "react";
import {useTranslation} from "react-i18next";
import {connect} from "react-redux";
@@ -180,6 +180,7 @@ export function Manage({conflict, bodyshop}) {
const [chatVisible] = useState(false);
useEffect(() => {
const widgetId = "IABVNO4scRKY11XBQkNr";
window.noticeable.render("widget", widgetId);
@@ -388,8 +389,8 @@ export function Manage({conflict, bodyshop}) {
<div style={{display: "flex"}}>
<div>
{`ImEX Online ${
process.env.REACT_APP_GIT_SHA
} - ${preval`module.exports = new Date().toLocaleString("en-US", {timeZone: "America/Los_Angeles"});`}`}
import.meta.env.VITE_APP_GIT_SHA || 'Local Build'
} - ${import.meta.env.VITE_APP_GIT_SHA_DATE}`}
</div>
<div id="noticeable-widget" style={{marginLeft: "1rem"}}/>
</div>

View File

@@ -5,7 +5,7 @@
// const stripePromise = new Promise((resolve, reject) => {
// resolve(
// loadStripe(process.env.REACT_APP_STRIPE_PUBLIC_KEY, {
// loadStripe(import.meta.env.VITE_APP_STRIPE_PUBLIC_KEY, {
// stripeAccount: "acct_1Fa7lFIEahEZW8b4",
// })
// );

View File

@@ -29,7 +29,7 @@ const middlewares = [
createStateSyncMiddleware(reduxSyncConfig),
];
if (process.env.NODE_ENV === "development") {
if (import.meta.env.DEV) {
middlewares.push(createLogger({ collapsed: true, diff: true }));
}
@@ -39,7 +39,7 @@ export const store = configureStore({
serializableCheck: false,
}).concat(middlewares),
// middleware: middlewares,
devTools: process.env.NODE_ENV !== 'production',
devTools: import.meta.env.DEV,
enhancers: (getDefaultEnhancers) => getDefaultEnhancers().concat(sentryReduxEnhancer)
});

View File

@@ -177,7 +177,7 @@ export function* setInstanceIdSaga({ payload: uid }) {
yield put(setLocalFingerprint(result.visitorId));
yield delay(5 * 60 * 1000);
if (process.env.NODE_ENV === "production") yield put(checkInstanceId(uid));
if (import.meta.env.PROD) yield put(checkInstanceId(uid));
} catch (error) {
console.log("error", error);
}

View File

@@ -19,7 +19,7 @@ const isLocalhost = Boolean(
);
export function register(config) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
if (import.meta.env.PROD && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
if (publicUrl.origin !== window.location.origin) {

View File

@@ -20,7 +20,7 @@ i18n
//lng: "en",
detection: {},
fallbackLng: "en-US",
debug: process.env.NODE_ENV === "production" ? false : true,
debug: import.meta.env.PROD ? false : true,
//keySeparator: false, // we do not use keys in form messages.welcome

View File

@@ -1,23 +1,26 @@
import axios from "axios";
import { auth } from "../firebase/firebase.utils";
import {auth} from "../firebase/firebase.utils";
if (process.env.NODE_ENV === "production") {
axios.defaults.baseURL =
process.env.REACT_APP_AXIOS_BASE_API_URL || "https://api.imex.online/";
}
axios.defaults.baseURL =
import.meta.env.VITE_APP_AXIOS_BASE_API_URL ||
(
import.meta.env.MODE === "production" ?
"https://api.imex.online/" :
"http://localhost:4000/"
);
export const axiosAuthInterceptorId = axios.interceptors.request.use(
async (config) => {
if (!config.headers.Authorization) {
const token = auth.currentUser && (await auth.currentUser.getIdToken());
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
}
async (config) => {
if (!config.headers.Authorization) {
const token = auth.currentUser && (await auth.currentUser.getIdToken());
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
}
return config;
},
(error) => Promise.reject(error)
return config;
},
(error) => Promise.reject(error)
);
const cleanAxios = axios.create();

View File

@@ -16,11 +16,11 @@ import { SentryLink } from "apollo-link-sentry";
//import { store } from "../redux/store";
const httpLink = new HttpLink({
uri: process.env.REACT_APP_GRAPHQL_ENDPOINT,
uri: import.meta.env.VITE_APP_GRAPHQL_ENDPOINT,
});
const wsLink = new WebSocketLink({
uri: process.env.REACT_APP_GRAPHQL_ENDPOINT_WS,
uri: import.meta.env.VITE_APP_GRAPHQL_ENDPOINT_WS,
options: {
lazy: true,
reconnect: true,
@@ -147,7 +147,7 @@ const retryLink = new RetryLink({
});
const middlewares = [];
if (process.env.NODE_ENV === "development") {
if (import.meta.env.DEV) {
middlewares.push(apolloLogger);
}
@@ -172,7 +172,7 @@ const cache = new InMemoryCache({
const client = new ApolloClient({
link: ApolloLink.from(middlewares),
cache,
connectToDevTools: process.env.NODE_ENV !== "production",
connectToDevTools: import.meta.env.DEV,
defaultOptions: {
watchQuery: {
fetchPolicy: "network-only",

View File

@@ -9,7 +9,7 @@ import { store } from "../redux/store";
import client from "../utils/GraphQLClient";
import cleanAxios from "./CleanAxios";
import { TemplateList } from "./TemplateConstants";
const server = process.env.REACT_APP_REPORTS_SERVER_URL;
const server = import.meta.env.VITE_APP_REPORTS_SERVER_URL;
jsreport.serverUrl = server;

135
client/vite.config.js Normal file
View File

@@ -0,0 +1,135 @@
import legacy from '@vitejs/plugin-legacy'
import react from '@vitejs/plugin-react'
import {createRequire} from 'module';
import {defineConfig, transformWithEsbuild} from 'vite'
import {promises as fsPromises} from "fs";
import * as url from "url";
import * as path from "path";
import {nodePolyfills} from "vite-plugin-node-polyfills";
import {
AndDesignVueResolve,
AntdResolve,
createStyleImportPlugin,
ElementPlusResolve,
NutuiResolve,
VantResolve
} from "vite-plugin-style-import";
import {convertLegacyToken} from "@ant-design/compatible";
const {theme} = require('antd/lib');
const {defaultAlgorithm, defaultSeed} = theme;
const mapToken = defaultAlgorithm(defaultSeed);
const v4Token = convertLegacyToken(mapToken);
process.env.VITE_APP_GIT_SHA_DATE = new Date().toLocaleString("en-US", {timeZone: "America/Los_Angeles"});
const WRONG_CODE = `import { bpfrpt_proptype_WindowScroller } from "../WindowScroller.js";`
function reactVirtualized() {
return {
name: 'flat:react-virtualized',
configResolved: async () => {
const require = createRequire(import.meta.url)
const reactVirtualizedPath = require.resolve('react-virtualized')
const {pathname: reactVirtualizedFilePath} = new url.URL(reactVirtualizedPath, import.meta.url)
const file = reactVirtualizedFilePath
.replace(
path.join('dist', 'commonjs', 'index.js'),
path.join('dist', 'es', 'WindowScroller', 'utils', 'onScroll.js'),
)
const code = await fsPromises.readFile(file, 'utf-8');
const modified = code.replace(WRONG_CODE, '')
await fsPromises.writeFile(file, modified)
},
}
}
export default defineConfig({
base: '/',
plugins: [
{
name: 'treat-js-files-as-jsx',
async transform(code, id) {
if (!id.match(/src\/.*\.js$/)) return null
return transformWithEsbuild(code, id, {
loader: 'jsx',
jsx: 'automatic',
})
},
},
reactVirtualized(),
react(),
nodePolyfills({
protocolImports: true,
overrides: {
// Since `fs` is not supported in browsers, we can use the `memfs` package to polyfill it.
fs: 'memfs',
// Since `path` is not supported in browsers, we can use the `path-browserify` package to polyfill it.
path: 'path-browserify',
// Since `os` is not supported in browsers, we can use the `os-browserify` package to polyfill it.
os: 'os-browserify/browser',
// Since `crypto` is not supported in browsers, we can use the `crypto-browserify` package to polyfill it.
crypto: 'crypto-browserify',
// Since `stream` is not supported in browsers, we can use the `stream-browserify` package to polyfill it.
stream: 'stream-browserify',
// Since `buffer` is not supported in browsers, we can use the `buffer` package to polyfill it.
}
}),
createStyleImportPlugin({
resolves: [
AndDesignVueResolve(),
VantResolve(),
ElementPlusResolve(),
NutuiResolve(),
AntdResolve(),
],
libs: [
{
libraryName: 'ant-design-vue',
esModule: true,
resolveStyle: (name) => {
return `ant-design-vue/es/${name}/style/index`
},
},
]
}),
legacy({
targets: ['defaults']
}),
],
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
modifyVars: {
...v4Token,
},
}
}
},
server: {
host: true,
port: 3000,
open: true,
},
optimizeDeps: {
// force: true,
esbuildOptions: {
loader: {
'.js': 'jsx',
},
},
},
build: {
outDir: 'dist',
manifest: true,
sourcemap: true,
rollupOptions: {
external: ['antd'],
},
}
})

66
package-lock.json generated
View File

@@ -9,9 +9,9 @@
"version": "0.0.1",
"license": "UNLICENSED",
"dependencies": {
"@aws-sdk/client-secrets-manager": "^3.503.0",
"@aws-sdk/client-ses": "^3.503.0",
"@aws-sdk/credential-provider-node": "^3.503.0",
"@aws-sdk/client-secrets-manager": "^3.503.1",
"@aws-sdk/client-ses": "^3.503.1",
"@aws-sdk/credential-provider-node": "^3.503.1",
"@opensearch-project/opensearch": "^2.5.0",
"aws4": "^1.12.0",
"axios": "^1.6.5",
@@ -152,15 +152,15 @@
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
},
"node_modules/@aws-sdk/client-secrets-manager": {
"version": "3.503.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/client-secrets-manager/-/client-secrets-manager-3.503.0.tgz",
"integrity": "sha512-wM+izwvHwPPaUxArLs3dVIyyTVlO4Au2DYqcy/OsuuiGFeSSrbWArPnLqH7tav+OINzWTD4qP9okKGtH/rEdtA==",
"version": "3.503.1",
"resolved": "https://registry.npmjs.org/@aws-sdk/client-secrets-manager/-/client-secrets-manager-3.503.1.tgz",
"integrity": "sha512-1q/cnwPnypPq3hI3/S3iREeeFYwNXWwRAk2cGDIeNiOqynH8AS5zbokvlfjR90NFXvawrUoT+icA/G08B1Bc3w==",
"dependencies": {
"@aws-crypto/sha256-browser": "3.0.0",
"@aws-crypto/sha256-js": "3.0.0",
"@aws-sdk/client-sts": "3.502.0",
"@aws-sdk/core": "3.496.0",
"@aws-sdk/credential-provider-node": "3.503.0",
"@aws-sdk/credential-provider-node": "3.503.1",
"@aws-sdk/middleware-host-header": "3.502.0",
"@aws-sdk/middleware-logger": "3.502.0",
"@aws-sdk/middleware-recursion-detection": "3.502.0",
@@ -211,15 +211,15 @@
}
},
"node_modules/@aws-sdk/client-ses": {
"version": "3.503.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/client-ses/-/client-ses-3.503.0.tgz",
"integrity": "sha512-ppMy4sDHiFMxPsEKAE7G7v6Xtf4tsdXN2IhrML/SjrNmnSDvKMmcBHdnus1WyjKk0oev7sgYTbcVBryxTb/AhA==",
"version": "3.503.1",
"resolved": "https://registry.npmjs.org/@aws-sdk/client-ses/-/client-ses-3.503.1.tgz",
"integrity": "sha512-O/SRoa99+AwCAuyloBUuyEE/HrCABZRPHeRh7gEIBdv4xyiZE9oKXpXqyo5ncPZ00xat3q0JKO9ECgeDmSCJOg==",
"dependencies": {
"@aws-crypto/sha256-browser": "3.0.0",
"@aws-crypto/sha256-js": "3.0.0",
"@aws-sdk/client-sts": "3.502.0",
"@aws-sdk/core": "3.496.0",
"@aws-sdk/credential-provider-node": "3.503.0",
"@aws-sdk/credential-provider-node": "3.503.1",
"@aws-sdk/middleware-host-header": "3.502.0",
"@aws-sdk/middleware-logger": "3.502.0",
"@aws-sdk/middleware-recursion-detection": "3.502.0",
@@ -443,15 +443,34 @@
"node": ">=14.0.0"
}
},
"node_modules/@aws-sdk/credential-provider-http": {
"version": "3.503.1",
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.503.1.tgz",
"integrity": "sha512-rTdlFFGoPPFMF2YjtlfRuSgKI+XsF49u7d98255hySwhsbwd3Xp+utTTPquxP+CwDxMHbDlI7NxDzFiFdsoZug==",
"dependencies": {
"@aws-sdk/types": "3.502.0",
"@smithy/fetch-http-handler": "^2.4.1",
"@smithy/node-http-handler": "^2.3.1",
"@smithy/property-provider": "^2.1.1",
"@smithy/protocol-http": "^3.1.1",
"@smithy/smithy-client": "^2.3.1",
"@smithy/types": "^2.9.1",
"@smithy/util-stream": "^2.1.1",
"tslib": "^2.5.0"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@aws-sdk/credential-provider-ini": {
"version": "3.503.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.503.0.tgz",
"integrity": "sha512-sfmVLtUx+KDJ74jlbxW6dr1ysXh2EAESA+a5stFehgeXM1BeEdZc938wGcb8Mzm9w6li3IK0otXy8/R5TkQn3g==",
"version": "3.503.1",
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.503.1.tgz",
"integrity": "sha512-1RiC72NdWJ5w2IaX/91Fku+FrrChzaHuMCD5wbjk5TMHjwiDZ622wvMKYVmn30biW0RbJidaw38Y9PAGivdZxw==",
"dependencies": {
"@aws-sdk/client-sts": "3.502.0",
"@aws-sdk/credential-provider-env": "3.502.0",
"@aws-sdk/credential-provider-process": "3.502.0",
"@aws-sdk/credential-provider-sso": "3.502.0",
"@aws-sdk/credential-provider-sso": "3.503.1",
"@aws-sdk/credential-provider-web-identity": "3.502.0",
"@aws-sdk/types": "3.502.0",
"@smithy/credential-provider-imds": "^2.2.1",
@@ -465,14 +484,15 @@
}
},
"node_modules/@aws-sdk/credential-provider-node": {
"version": "3.503.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.503.0.tgz",
"integrity": "sha512-jE+QpqWU7ESxbKtWmeerv4ze7HntGcfh4PFscsy+O3QZYXXntzkDAne9wRvT38rfI+uVOGGNdCtz+8zSS3MaZw==",
"version": "3.503.1",
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.503.1.tgz",
"integrity": "sha512-1qsRWnXl8OUZEDpUFF/gjCGjePjZB6fIpX+XQuTpKokeDzYZk0HwQSakPspfmzT8MkyB9IBJVWb7KbFCjKNt0A==",
"dependencies": {
"@aws-sdk/credential-provider-env": "3.502.0",
"@aws-sdk/credential-provider-ini": "3.503.0",
"@aws-sdk/credential-provider-http": "3.503.1",
"@aws-sdk/credential-provider-ini": "3.503.1",
"@aws-sdk/credential-provider-process": "3.502.0",
"@aws-sdk/credential-provider-sso": "3.502.0",
"@aws-sdk/credential-provider-sso": "3.503.1",
"@aws-sdk/credential-provider-web-identity": "3.502.0",
"@aws-sdk/types": "3.502.0",
"@smithy/credential-provider-imds": "^2.2.1",
@@ -501,9 +521,9 @@
}
},
"node_modules/@aws-sdk/credential-provider-sso": {
"version": "3.502.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.502.0.tgz",
"integrity": "sha512-/2Nyvo+cWQpH283lmZBimTJ9JDhES9FzQUkhUXZgxQo3Ez4sguLVi2V9xoFFyG0cMff5fuNivdKHfj4FeMGjZw==",
"version": "3.503.1",
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.503.1.tgz",
"integrity": "sha512-Wj+rgpD4EcGB+j6mMYPD4SPNEN0sUSq7UMTTfdzZ+1MSTnbPDC9rgde0D3yJPrJ1le/0j+sXPALvr5RKSpENbg==",
"dependencies": {
"@aws-sdk/client-sso": "3.502.0",
"@aws-sdk/token-providers": "3.502.0",

View File

@@ -18,9 +18,9 @@
"start": "node server.js"
},
"dependencies": {
"@aws-sdk/client-secrets-manager": "^3.503.0",
"@aws-sdk/client-ses": "^3.503.0",
"@aws-sdk/credential-provider-node": "^3.503.0",
"@aws-sdk/client-secrets-manager": "^3.503.1",
"@aws-sdk/client-ses": "^3.503.1",
"@aws-sdk/credential-provider-node": "^3.503.1",
"@opensearch-project/opensearch": "^2.5.0",
"aws4": "^1.12.0",
"axios": "^1.6.5",