- Updates

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-01-18 11:43:57 -05:00
parent 8de4ebd30a
commit 71663d64e4
19 changed files with 2773 additions and 11289 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>

13817
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,14 +1,16 @@
{
"name": "bodyshop",
"version": "0.2.1",
"engines": {
"node": "18.18.2"
},
"private": true,
"proxy": "http://localhost:4000",
"dependencies": {
"@ant-design/compatible": "^5.1.2",
"@ant-design/pro-layout": "^7.17.16",
"@apollo/client": "^3.8.9",
"@apollo/client": "^3.7.9",
"@asseinfo/react-kanban": "^2.2.0",
"@craco/craco": "^7.1.0",
"@fingerprintjs/fingerprintjs": "^4.2.1",
"@jsreport/browser-client": "^3.1.0",
"@reduxjs/toolkit": "^2.0.1",
@@ -16,16 +18,21 @@
"@sentry/tracing": "^7.93.0",
"@splitsoftware/splitio-react": "^1.10.2",
"@tanem/react-nprogress": "^5.0.51",
"@vitejs/plugin-legacy": "^5.2.0",
"@vitejs/plugin-react": "^4.2.1",
"@vitejs/plugin-react-refresh": "^1.3.6",
"@vitejs/plugin-react-swc": "^3.5.0",
"antd": "^5.12.8",
"apollo-link-logger": "^2.0.1",
"axios": "^1.6.5",
"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.3.1",
"enquire-js": "^0.2.1",
"env-cmd": "^10.1.0",
"esbuild": "^0.19.11",
"exifr": "^7.1.3",
"firebase": "^10.7.1",
"graphql": "^16.6.0",
@@ -59,7 +66,6 @@
"react-redux": "^9.1.0",
"react-resizable": "^3.0.5",
"react-router-dom": "^6.21.2",
"react-scripts": "^5.0.1",
"react-sticky": "^6.0.3",
"react-sublime-video": "^0.2.5",
"react-virtualized": "^9.22.5",
@@ -74,6 +80,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.1",
"workbox-core": "^7.0.0",
"workbox-expiration": "^7.0.0",
@@ -85,7 +92,7 @@
},
"scripts": {
"analyze": "source-map-explorer 'build/static/js/*.js'",
"start": "craco start",
"start": "vite",
"build": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` craco build",
"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!'",
@@ -118,12 +125,27 @@
},
"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.2",
"@swc/core": "^1.3.104",
"@swc/plugin-styled-components": "^1.5.108",
"@testing-library/cypress": "^10.0.1",
"browserslist": "^4.22.2",
"browserslist-to-esbuild": "^2.1.1",
"craco-less": "^3.0.1",
"cypress": "^13.6.2",
"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

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

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

@@ -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

@@ -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.${process.env.NODE_ENV}-${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

@@ -27,7 +27,7 @@ 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.VITE_APP_AXIOS_BASE_API_URL
: window.location.origin,
{
path: "/ws",

View File

@@ -44,7 +44,7 @@ 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.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);
@@ -386,11 +387,7 @@ 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"});`}`}
</div>
<div id="noticeable-widget" style={{marginLeft: "1rem"}}/>
</div>
<Link to="/disclaimer" target="_blank" style={{color: "#ccc"}}>

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

@@ -3,7 +3,7 @@ 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/";
import.meta.env.VITE_APP_AXIOS_BASE_API_URL || "https://api.imex.online/";
}
export const axiosAuthInterceptorId = axios.interceptors.request.use(

View File

@@ -14,11 +14,11 @@ import { auth } from "../firebase/firebase.utils";
import errorLink from "../graphql/apollo-error-handling";
//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,

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;

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

@@ -0,0 +1,132 @@
import legacy from '@vitejs/plugin-legacy'
// import {createStyleImportPlugin} from 'vite-plugin-style-import'
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";
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({
// jsxImportSource: '@emotion/react',
// babel: {
// plugins: ['@emotion/babel-plugin'],
// },
}),
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', 'not IE 11']
}),
],
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
modifyVars: {
'@text-color': '#000000',
'@ease-in-out': 'cubic-bezier(0.7, 0.3, 0.1, 1)',
'@ease-out': 'cubic-bezier(0.7, 0.3, 0.1, 1)',
'@primary-color': '#1DA57A',
}
}
}
},
server: {
host: true,
port: 3000,
},
optimizeDeps: {
// force: true,
esbuildOptions: {
loader: {
'.js': 'jsx',
},
},
},
build: {
outDir: 'dist',
rollupOptions: {
external: ['antd'],
}
}
})