Skip to content

Commit

Permalink
fix #1
Browse files Browse the repository at this point in the history
added .env to more easily control startup port
updated setupProxy to use import
fixed useCallBack dependencies
  • Loading branch information
Korey Sedaghatian committed Sep 4, 2024
1 parent be7cf18 commit 62bd1c8
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 10 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PORT = 3000
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ff3-ofx",
"version": "0.6.0",
"version": "0.7.0",
"homepage": "./",
"private": true,
"licenses": [
Expand Down Expand Up @@ -60,6 +60,7 @@
"@babel/core": "^7.25.2",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"eslint": "^8.57.0",
"http-proxy-middleware": "^3.0.2",
"typescript": "^4.9.5"
},
"packageManager": "[email protected]"
Expand Down
16 changes: 9 additions & 7 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function App() {
// localStorage.removeItem('token');
// setToken(undefined);
});
}, []);
}, [token]);

const showFile = useCallback((files: File[]) => {
console.log('showFile files[0].name', files[0]);
Expand Down Expand Up @@ -124,13 +124,15 @@ function App() {
setOfxData(tmpOfxData);
} else {
console.log('NO matching account found...');
// It is possible that the account number is masked so do a secondary search
if (tmpOfxData.accountNumber && tmpOfxData.accountNumber.indexOf('*') > -1) {
const tmpAccountNumber = new RegExp(tmpOfxData.accountNumber.replace(/\*{1,}/, '.*'));
// It is possible that the account number is masked, or it contains other characters than a-z or 0-9
// so do a secondary search
if (tmpOfxData.accountNumber && !theAccount) {
const tmpAccountNumber = new RegExp(tmpOfxData.accountNumber.replace(/[^0-9|a-z|*]/gi, '').replace(/\*{1,}/, '.*'));
console.log('account regex: ' + tmpAccountNumber);
// Now loop thru again and see if we can find any matching account
const partialMatchedAccounts = accounts.filter(account => {
return tmpAccountNumber.test(account.attributes.account_number || '');
console.info('matching accounts... Comparing: ', tmpAccountNumber, account.attributes.account_number?.replace(/[^0-9|a-z]/gi, ''));
return tmpAccountNumber.test(account.attributes.account_number?.replace(/[^0-9|a-z]/gi, '') || '');
});
console.log('matching accounts: ' + matchingAccounts);
if (partialMatchedAccounts) {
Expand All @@ -156,14 +158,14 @@ function App() {
}
} else {
console.log('No accounts to find a match with...');
setErrorMessage('ERROR_NO_ACCOUNT');
setErrorMessage(ERROR_NO_ACCOUNT);
}
};

// start reading the new file (This will trigger the onload event above)
reader.readAsText(files[0]);
}
}, [accounts, ofxData, processed, progress, selectedAccount, transactions]);
}, [accounts, ofxData, progress, selectedAccount, transactions, matchingAccounts]);

const selectAccount = async (accnt: FF3Wrapper<FF3Account>) => {
setProcessed(false);
Expand Down
2 changes: 1 addition & 1 deletion src/components/OfxTransactionsRow.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Fragment, useState } from "react";
import { Button, Chip, IconButton, TableCell, TableRow } from "@mui/material";
import { Button, Chip, TableCell, TableRow } from "@mui/material";
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
import AddIcon from '@mui/icons-material/Add';
Expand Down
2 changes: 1 addition & 1 deletion src/setupProxy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// import secrets from './secrets.json';

const { createProxyMiddleware } = require('http-proxy-middleware');
import { createProxyMiddleware } from 'http-proxy-middleware';
const secrets = require('./secrets.json');

module.exports = function(app) {
Expand Down
71 changes: 71 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3456,6 +3456,15 @@ __metadata:
languageName: node
linkType: hard

"@types/http-proxy@npm:^1.17.15":
version: 1.17.15
resolution: "@types/http-proxy@npm:1.17.15"
dependencies:
"@types/node": "npm:*"
checksum: 10c0/e2bf2fcdf23c88141b8d2c85ed5e5418b62ef78285884a2b5a717af55f4d9062136aa475489d10292093343df58fb81975f34bebd6b9df322288fd9821cbee07
languageName: node
linkType: hard

"@types/http-proxy@npm:^1.17.8":
version: 1.17.14
resolution: "@types/http-proxy@npm:1.17.14"
Expand Down Expand Up @@ -4866,6 +4875,15 @@ __metadata:
languageName: node
linkType: hard

"braces@npm:^3.0.3":
version: 3.0.3
resolution: "braces@npm:3.0.3"
dependencies:
fill-range: "npm:^7.1.1"
checksum: 10c0/7c6dfd30c338d2997ba77500539227b9d1f85e388a5f43220865201e407e076783d0881f2d297b9f80951b4c957fcf0b51c1d2d24227631643c3f7c284b0aa04
languageName: node
linkType: hard

"browser-process-hrtime@npm:^1.0.0":
version: 1.0.0
resolution: "browser-process-hrtime@npm:1.0.0"
Expand Down Expand Up @@ -5805,6 +5823,18 @@ __metadata:
languageName: node
linkType: hard

"debug@npm:^4.3.6":
version: 4.3.6
resolution: "debug@npm:4.3.6"
dependencies:
ms: "npm:2.1.2"
peerDependenciesMeta:
supports-color:
optional: true
checksum: 10c0/3293416bff072389c101697d4611c402a6bacd1900ac20c0492f61a9cdd6b3b29750fc7f5e299f8058469ef60ff8fb79b86395a30374fbd2490113c1c7112285
languageName: node
linkType: hard

"decimal.js@npm:^10.2.1":
version: 10.4.3
resolution: "decimal.js@npm:10.4.3"
Expand Down Expand Up @@ -7107,6 +7137,7 @@ __metadata:
"@testing-library/user-event": "npm:^13.5.0"
axios: "npm:^1.7.4"
eslint: "npm:^8.57.0"
http-proxy-middleware: "npm:^3.0.2"
moment: "npm:^2.30.1"
mui-file-dropzone: "npm:^4.0.2"
node-ofx-parser: "npm:^0.5.1"
Expand Down Expand Up @@ -7174,6 +7205,15 @@ __metadata:
languageName: node
linkType: hard

"fill-range@npm:^7.1.1":
version: 7.1.1
resolution: "fill-range@npm:7.1.1"
dependencies:
to-regex-range: "npm:^5.0.1"
checksum: 10c0/b75b691bbe065472f38824f694c2f7449d7f5004aa950426a2c28f0306c60db9b880c0b0e4ed819997ffb882d1da02cfcfc819bddc94d71627f5269682edf018
languageName: node
linkType: hard

"finalhandler@npm:1.2.0":
version: 1.2.0
resolution: "finalhandler@npm:1.2.0"
Expand Down Expand Up @@ -7940,6 +7980,20 @@ __metadata:
languageName: node
linkType: hard

"http-proxy-middleware@npm:^3.0.2":
version: 3.0.2
resolution: "http-proxy-middleware@npm:3.0.2"
dependencies:
"@types/http-proxy": "npm:^1.17.15"
debug: "npm:^4.3.6"
http-proxy: "npm:^1.18.1"
is-glob: "npm:^4.0.3"
is-plain-object: "npm:^5.0.0"
micromatch: "npm:^4.0.8"
checksum: 10c0/74afb03174e5203afc41c7a1bd4b0d8b16f229da8187c47496d3817a3a5844da31ca8a8e1a230fd32ffd74211fbf13342d4dbe129d7e4b4b46f3174f9852c268
languageName: node
linkType: hard

"http-proxy@npm:^1.18.1":
version: 1.18.1
resolution: "http-proxy@npm:1.18.1"
Expand Down Expand Up @@ -8349,6 +8403,13 @@ __metadata:
languageName: node
linkType: hard

"is-plain-object@npm:^5.0.0":
version: 5.0.0
resolution: "is-plain-object@npm:5.0.0"
checksum: 10c0/893e42bad832aae3511c71fd61c0bf61aa3a6d853061c62a307261842727d0d25f761ce9379f7ba7226d6179db2a3157efa918e7fe26360f3bf0842d9f28942c
languageName: node
linkType: hard

"is-potential-custom-element-name@npm:^1.0.1":
version: 1.0.1
resolution: "is-potential-custom-element-name@npm:1.0.1"
Expand Down Expand Up @@ -9821,6 +9882,16 @@ __metadata:
languageName: node
linkType: hard

"micromatch@npm:^4.0.8":
version: 4.0.8
resolution: "micromatch@npm:4.0.8"
dependencies:
braces: "npm:^3.0.3"
picomatch: "npm:^2.3.1"
checksum: 10c0/166fa6eb926b9553f32ef81f5f531d27b4ce7da60e5baf8c021d043b27a388fb95e46a8038d5045877881e673f8134122b59624d5cecbd16eb50a42e7a6b5ca8
languageName: node
linkType: hard

"mime-db@npm:1.52.0, mime-db@npm:>= 1.43.0 < 2":
version: 1.52.0
resolution: "mime-db@npm:1.52.0"
Expand Down

0 comments on commit 62bd1c8

Please sign in to comment.