Update environment variables, add fingerprinting, and refactor API endpoints

- Changed server socket and REST API base URLs in .env file.
- Added FingerprintJS dependencies to package.json and package-lock.json.
- Implemented fingerprint generation in UserAuth component.
- Updated API endpoints from v1 to v2 in various service files.
- Refactored API calls to include authorization tokens.
- Commented out console log statements for cleaner production code.
This commit is contained in:
Gomathi 2025-05-26 17:58:46 +05:30
parent b99981a661
commit b76213f49f
22 changed files with 206 additions and 94 deletions

View File

@ -2,12 +2,12 @@
PORT=8200 PORT=8200
# Base URL for the server socket API, used for real-time communication (e.g., WebSockets). # Base URL for the server socket API, used for real-time communication (e.g., WebSockets).
REACT_APP_SERVER_SOCKET_API_BASE_URL=192.168.0.110:8000 REACT_APP_SERVER_SOCKET_API_BASE_URL=192.168.0.102:8000
# REACT_APP_SERVER_SOCKET_API_BASE_URL=185.100.212.76:8000 # REACT_APP_SERVER_SOCKET_API_BASE_URL=185.100.212.76:8000
# Base URL for the server REST API, used for HTTP requests to the backend server. # Base URL for the server REST API, used for HTTP requests to the backend server.
REACT_APP_SERVER_REST_API_BASE_URL=192.168.0.110:5000 # REACT_APP_SERVER_REST_API_BASE_URL=192.168.0.110:5000
# REACT_APP_SERVER_REST_API_BASE_URL=192.168.0.102:5000 REACT_APP_SERVER_REST_API_BASE_URL=192.168.0.102:5000
# REACT_APP_SERVER_REST_API_BASE_URL=185.100.212.76:5000 # REACT_APP_SERVER_REST_API_BASE_URL=185.100.212.76:5000
# Base URL for the server marketplace, used for market place model blob. # Base URL for the server marketplace, used for market place model blob.

107
app/package-lock.json generated
View File

@ -10,6 +10,8 @@
"dependencies": { "dependencies": {
"@dnd-kit/core": "^6.3.1", "@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0", "@dnd-kit/sortable": "^10.0.0",
"@fingerprintjs/fingerprintjs": "^4.6.2",
"@fingerprintjs/fingerprintjs-pro-react": "^2.6.3",
"@react-three/csg": "^3.2.0", "@react-three/csg": "^3.2.0",
"@react-three/drei": "^9.113.0", "@react-three/drei": "^9.113.0",
"@react-three/fiber": "^8.17.7", "@react-three/fiber": "^8.17.7",
@ -30,6 +32,7 @@
"glob": "^11.0.0", "glob": "^11.0.0",
"gsap": "^3.12.5", "gsap": "^3.12.5",
"html2canvas": "^1.4.1", "html2canvas": "^1.4.1",
"immer": "^10.1.1",
"leva": "^0.10.0", "leva": "^0.10.0",
"mqtt": "^5.10.4", "mqtt": "^5.10.4",
"postprocessing": "^6.36.4", "postprocessing": "^6.36.4",
@ -2021,7 +2024,7 @@
"version": "0.8.1", "version": "0.8.1",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
"integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
"dev": true, "devOptional": true,
"dependencies": { "dependencies": {
"@jridgewell/trace-mapping": "0.3.9" "@jridgewell/trace-mapping": "0.3.9"
}, },
@ -2033,7 +2036,7 @@
"version": "0.3.9", "version": "0.3.9",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
"dev": true, "devOptional": true,
"dependencies": { "dependencies": {
"@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/resolve-uri": "^3.0.3",
"@jridgewell/sourcemap-codec": "^1.4.10" "@jridgewell/sourcemap-codec": "^1.4.10"
@ -2535,6 +2538,45 @@
"node": "^12.22.0 || ^14.17.0 || >=16.0.0" "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
} }
}, },
"node_modules/@fingerprintjs/fingerprintjs": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/@fingerprintjs/fingerprintjs/-/fingerprintjs-4.6.2.tgz",
"integrity": "sha512-g8mXuqcFKbgH2CZKwPfVtsUJDHyvcgIABQI7Y0tzWEFXpGxJaXuAuzlifT2oTakjDBLTK4Gaa9/5PERDhqUjtw==",
"license": "BUSL-1.1",
"dependencies": {
"tslib": "^2.4.1"
}
},
"node_modules/@fingerprintjs/fingerprintjs-pro": {
"version": "3.11.10",
"resolved": "https://registry.npmjs.org/@fingerprintjs/fingerprintjs-pro/-/fingerprintjs-pro-3.11.10.tgz",
"integrity": "sha512-zuQWT0YQLT0T//KcjEnyn4YBPlxXuXCtPiwEt2eTv03I/k2m370X+pCOfgU26AEjkmPrhCE77FLpRnm0IwiWrg==",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"tslib": "^2.4.1"
}
},
"node_modules/@fingerprintjs/fingerprintjs-pro-react": {
"version": "2.6.3",
"resolved": "https://registry.npmjs.org/@fingerprintjs/fingerprintjs-pro-react/-/fingerprintjs-pro-react-2.6.3.tgz",
"integrity": "sha512-/axCq/cfjZkIM+WFZM/05FQvqtNfdKbIFKU6b2yrwPKlgT8BqWkAq8XvFX6JCPlq8/udVLJjFEDCK+1JQh1L6g==",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
"@fingerprintjs/fingerprintjs-pro-spa": "^1.3.1",
"fast-deep-equal": "3.1.3"
}
},
"node_modules/@fingerprintjs/fingerprintjs-pro-spa": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/@fingerprintjs/fingerprintjs-pro-spa/-/fingerprintjs-pro-spa-1.3.2.tgz",
"integrity": "sha512-s1YGsx1XQLmjU+av4UrUHNxyzwPHyZRB0GXJQFOJK8ZHCYc2SNukxnJmZA++bNBa8twU3wW+QgSJhA4Prjnd0g==",
"license": "MIT",
"dependencies": {
"@fingerprintjs/fingerprintjs-pro": "^3.11.0",
"tslib": "^2.7.0"
}
},
"node_modules/@floating-ui/core": { "node_modules/@floating-ui/core": {
"version": "0.7.3", "version": "0.7.3",
"resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-0.7.3.tgz", "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-0.7.3.tgz",
@ -4136,6 +4178,26 @@
"url": "https://github.com/sponsors/gregberge" "url": "https://github.com/sponsors/gregberge"
} }
}, },
"node_modules/@testing-library/dom": {
"version": "10.4.0",
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.0.tgz",
"integrity": "sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/code-frame": "^7.10.4",
"@babel/runtime": "^7.12.5",
"@types/aria-query": "^5.0.1",
"aria-query": "5.3.0",
"chalk": "^4.1.0",
"dom-accessibility-api": "^0.5.9",
"lz-string": "^1.5.0",
"pretty-format": "^27.0.2"
},
"engines": {
"node": ">=18"
}
},
"node_modules/@testing-library/jest-dom": { "node_modules/@testing-library/jest-dom": {
"version": "5.17.0", "version": "5.17.0",
"resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.17.0.tgz", "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.17.0.tgz",
@ -4247,25 +4309,25 @@
"version": "1.0.11", "version": "1.0.11",
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz",
"integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==",
"dev": true "devOptional": true
}, },
"node_modules/@tsconfig/node12": { "node_modules/@tsconfig/node12": {
"version": "1.0.11", "version": "1.0.11",
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
"dev": true "devOptional": true
}, },
"node_modules/@tsconfig/node14": { "node_modules/@tsconfig/node14": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
"dev": true "devOptional": true
}, },
"node_modules/@tsconfig/node16": { "node_modules/@tsconfig/node16": {
"version": "1.0.4", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
"dev": true "devOptional": true
}, },
"node_modules/@turf/along": { "node_modules/@turf/along": {
"version": "7.2.0", "version": "7.2.0",
@ -9019,7 +9081,7 @@
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
"dev": true "devOptional": true
}, },
"node_modules/cross-env": { "node_modules/cross-env": {
"version": "7.0.3", "version": "7.0.3",
@ -9896,7 +9958,7 @@
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
"dev": true, "devOptional": true,
"engines": { "engines": {
"node": ">=0.3.1" "node": ">=0.3.1"
} }
@ -12726,9 +12788,10 @@
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ=="
}, },
"node_modules/immer": { "node_modules/immer": {
"version": "9.0.21", "version": "10.1.1",
"resolved": "https://registry.npmjs.org/immer/-/immer-9.0.21.tgz", "resolved": "https://registry.npmjs.org/immer/-/immer-10.1.1.tgz",
"integrity": "sha512-bc4NBHqOqSfRW7POMkHd51LvClaeMXpm8dx0e8oE2GORbq5aRK7Bxl4FyzVLdGtLmvLKL7BTDBG5ACQm4HWjTA==", "integrity": "sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw==",
"license": "MIT",
"funding": { "funding": {
"type": "opencollective", "type": "opencollective",
"url": "https://opencollective.com/immer" "url": "https://opencollective.com/immer"
@ -15259,7 +15322,7 @@
"version": "1.3.6", "version": "1.3.6",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
"dev": true "devOptional": true
}, },
"node_modules/makeerror": { "node_modules/makeerror": {
"version": "1.0.12", "version": "1.0.12",
@ -17990,6 +18053,16 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/react-dev-utils/node_modules/immer": {
"version": "9.0.21",
"resolved": "https://registry.npmjs.org/immer/-/immer-9.0.21.tgz",
"integrity": "sha512-bc4NBHqOqSfRW7POMkHd51LvClaeMXpm8dx0e8oE2GORbq5aRK7Bxl4FyzVLdGtLmvLKL7BTDBG5ACQm4HWjTA==",
"license": "MIT",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/immer"
}
},
"node_modules/react-dev-utils/node_modules/loader-utils": { "node_modules/react-dev-utils/node_modules/loader-utils": {
"version": "3.3.1", "version": "3.3.1",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-3.3.1.tgz", "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-3.3.1.tgz",
@ -20727,7 +20800,7 @@
"version": "10.9.2", "version": "10.9.2",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
"integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
"dev": true, "devOptional": true,
"dependencies": { "dependencies": {
"@cspotcode/source-map-support": "^0.8.0", "@cspotcode/source-map-support": "^0.8.0",
"@tsconfig/node10": "^1.0.7", "@tsconfig/node10": "^1.0.7",
@ -20770,7 +20843,7 @@
"version": "8.3.4", "version": "8.3.4",
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz",
"integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==",
"dev": true, "devOptional": true,
"dependencies": { "dependencies": {
"acorn": "^8.11.0" "acorn": "^8.11.0"
}, },
@ -20782,7 +20855,7 @@
"version": "4.1.3", "version": "4.1.3",
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
"dev": true "devOptional": true
}, },
"node_modules/tsconfig-paths": { "node_modules/tsconfig-paths": {
"version": "3.15.0", "version": "3.15.0",
@ -21278,7 +21351,7 @@
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
"dev": true "devOptional": true
}, },
"node_modules/v8-to-istanbul": { "node_modules/v8-to-istanbul": {
"version": "8.1.1", "version": "8.1.1",
@ -22337,7 +22410,7 @@
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
"dev": true, "devOptional": true,
"engines": { "engines": {
"node": ">=6" "node": ">=6"
} }

View File

@ -5,6 +5,8 @@
"dependencies": { "dependencies": {
"@dnd-kit/core": "^6.3.1", "@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0", "@dnd-kit/sortable": "^10.0.0",
"@fingerprintjs/fingerprintjs": "^4.6.2",
"@fingerprintjs/fingerprintjs-pro-react": "^2.6.3",
"@react-three/csg": "^3.2.0", "@react-three/csg": "^3.2.0",
"@react-three/drei": "^9.113.0", "@react-three/drei": "^9.113.0",
"@react-three/fiber": "^8.17.7", "@react-three/fiber": "^8.17.7",

View File

@ -29,6 +29,7 @@ const DashboardHome: React.FC = () => {
const fetchRecentProjects = async () => { const fetchRecentProjects = async () => {
try { try {
const projects = await recentlyViewed(organization, userId); const projects = await recentlyViewed(organization, userId);
console.log('RecentlyViewed: ', projects);
if (JSON.stringify(projects) !== JSON.stringify(recentProjects)) { if (JSON.stringify(projects) !== JSON.stringify(recentProjects)) {
setRecentProjects(projects); setRecentProjects(projects);

View File

@ -57,7 +57,7 @@ const ZoneProperties: React.FC = () => {
}; };
// Call your API to update the zone // Call your API to update the zone
let response = await zoneCameraUpdate(zonesdata, organization); let response = await zoneCameraUpdate(zonesdata, organization);
console.log("response: ", response); // console.log("response: ", response);
if (response.message === "updated successfully") { if (response.message === "updated successfully") {
setZones((prevZones: any[]) => setZones((prevZones: any[]) =>
prevZones.map((zone) => prevZones.map((zone) =>

View File

@ -134,7 +134,7 @@ const List: React.FC<ListProps> = ({ items = [], remove }) => {
zoneAssetId.id, zoneAssetId.id,
newName newName
); );
console.log("response: ", response); // console.log("response: ", response);
setFloorItems((prevFloorItems: any[]) => setFloorItems((prevFloorItems: any[]) =>
prevFloorItems.map((floorItems) => prevFloorItems.map((floorItems) =>
floorItems.modelUuid === zoneAssetId.id floorItems.modelUuid === zoneAssetId.id

View File

@ -174,7 +174,7 @@ const DisplayZone: React.FC<DisplayZoneProps> = ({
const email = localStorage.getItem("email") || ""; const email = localStorage.getItem("email") || "";
const organization = email?.split("@")[1]?.split(".")[0]; const organization = email?.split("@")[1]?.split(".")[0];
let response = await getSelect2dZoneData(zoneId, organization); let response = await getSelect2dZoneData(zoneId, organization);
console.log("response: ", response); // console.log("response: ", response);
let res = await getFloatingZoneData(zoneId, organization); let res = await getFloatingZoneData(zoneId, organization);
console.log("res: ", res); console.log("res: ", res);

View File

@ -1,4 +1,4 @@
import React, { useState, FormEvent } from "react"; import React, { useState, FormEvent, useEffect } from "react";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { LogoIconLarge } from "../components/icons/Logo"; import { LogoIconLarge } from "../components/icons/Logo";
import { EyeIcon } from "../components/icons/ExportCommonIcons"; import { EyeIcon } from "../components/icons/ExportCommonIcons";
@ -9,6 +9,7 @@ import {
} from "../store/builder/store"; } from "../store/builder/store";
import { signInApi } from "../services/factoryBuilder/signInSignUp/signInApi"; import { signInApi } from "../services/factoryBuilder/signInSignUp/signInApi";
import { signUpApi } from "../services/factoryBuilder/signInSignUp/signUpApi"; import { signUpApi } from "../services/factoryBuilder/signInSignUp/signUpApi";
import FingerprintJS from "@fingerprintjs/fingerprintjs";
const UserAuth: React.FC = () => { const UserAuth: React.FC = () => {
const [email, setEmail] = useState(""); const [email, setEmail] = useState("");
@ -19,33 +20,62 @@ const UserAuth: React.FC = () => {
const { userName, setUserName } = useUserName(); const { userName, setUserName } = useUserName();
const { setOrganization } = useOrganization(); const { setOrganization } = useOrganization();
const { setLoadingProgress } = useLoadingProgress(); const { setLoadingProgress } = useLoadingProgress();
const [fingerprint, setFingerprint] = useState("");
const navigate = useNavigate(); const navigate = useNavigate();
const initializeFingerprint = async () => {
const fp = await FingerprintJS.load();
const result = await fp.get();
setFingerprint(result.visitorId); // Set the fingerprint
};
useEffect(() => {
initializeFingerprint();
}, [])
const handleLogin = async (e: FormEvent<HTMLFormElement>) => { const handleLogin = async (e: FormEvent<HTMLFormElement>) => {
e.preventDefault(); e.preventDefault();
const organization = email.split("@")[1].split(".")[0]; const organization = email.split("@")[1].split(".")[0];
console.log('email, password, organization: ', email, password, organization);
try { try {
const res = await signInApi(email, password, organization); const res = await signInApi(email, password, organization, fingerprint);
if (res.message.message === "login successfull") {
if (res.message === "login successfull") {
setError(""); setError("");
setOrganization(organization); setOrganization(organization);
setUserName(res.name); setUserName(res.message.name);
console.log(' res.userId: ', res.userId); // console.log(' res.userId: ', res.message.userId);
localStorage.setItem("userId", res.userId); localStorage.setItem("userId", res.message.userId);
localStorage.setItem("email", res.email); localStorage.setItem("email", res.message.email);
localStorage.setItem("userName", res.name); localStorage.setItem("userName", res.message.name);
if (res.isShare) { localStorage.setItem("token", res.message.token);
localStorage.setItem("refreshToken", res.message.refreshToken);
if (res.message.isShare) {
setLoadingProgress(1); setLoadingProgress(1);
// navigate("/Project"); // navigate("/Project");
navigate("/Dashboard"); navigate("/Dashboard");
} }
} else if (res.message === "User Not Found!!! Kindly signup...") { } else if (res.message === "User Not Found!!! Kindly signup...") {
setError("Account not found"); setError("Account not found");
} else if (res.message === "Already LoggedIn on another browser....Please logout!!!") {
setError("Already logged in on another browser. Please logout first.");
navigate("/");
setError("")
// setError("");
// setOrganization(organization);
// setUserName(res.ForceLogoutData.userName);
// console.log(' res.userId: ', res.ForceLogoutData.userId);
// localStorage.setItem("userId", res.ForceLogoutData.userId);
// localStorage.setItem("email", res.ForceLogoutData.Email);
// localStorage.setItem("userName", res.ForceLogoutData.userName);
// localStorage.setItem("token", res.ForceLogoutData.token);
// localStorage.setItem("refreshToken", res.ForceLogoutData.refreshToken);
// if (res.ForceLogoutData.isShare) {
// setLoadingProgress(1);
// navigate("/Dashboard");
// }
} }
} catch (error) { } catch (error) {
echo.error("Login failed"); echo.error("Login failed");

View File

@ -1,25 +1,17 @@
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`; let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
// let url_Backend_dwinzo = `http://192.168.0.110:5000`;
export const createProject = async (
projectUuid: string, export const createProject = async (projectUuid: string, userId: string, thumbnail: string, organization: string) => {
userId: string,
thumbnail: string,
organization: string
) => {
try { try {
const response = await fetch(`${url_Backend_dwinzo}/api/v1/upsertProject`, { const response = await fetch(`${url_Backend_dwinzo}/api/v2/upsertProject`, {
method: "POST", method: "POST",
headers: { headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json", "Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
}, },
body: JSON.stringify({ body: JSON.stringify({ projectUuid, userId, thumbnail, organization, }),
projectUuid,
userId,
thumbnail,
organization,
}),
}); });
if (!response.ok) { if (!response.ok) {

View File

@ -8,11 +8,14 @@ export const deleteProject = async (
) => { ) => {
try { try {
const response = await fetch( const response = await fetch(
`${url_Backend_dwinzo}/api/v1//Project/archive/${projectId}`, `${url_Backend_dwinzo}/api/v2/Project/archive/${projectId}`,
{ {
method: "PATCH", method: "PATCH",
headers: { headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json", "Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
}, },
body: JSON.stringify({ userId, organization }), body: JSON.stringify({ userId, organization }),
} }

View File

@ -3,11 +3,14 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
export const getAllProjects = async (userId: string, organization: string) => { export const getAllProjects = async (userId: string, organization: string) => {
try { try {
const response = await fetch( const response = await fetch(
`${url_Backend_dwinzo}/api/v1/Projects/${userId}/${organization}`, `${url_Backend_dwinzo}/api/v2/Projects`,
{ {
method: "GET", method: "GET",
headers: { headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json", "Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
}, },
} }
); );

View File

@ -6,11 +6,14 @@ export const getTrash = async (organization: string) => {
try { try {
const response = await fetch( const response = await fetch(
`${url_Backend_dwinzo}/api/v1/Trash/Lists?organization=${organization}`, `${url_Backend_dwinzo}/api/v2/TrashItems`,
{ {
method: "GET", method: "GET",
headers: { headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json", "Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
}, },
} }
); );
@ -20,6 +23,7 @@ export const getTrash = async (organization: string) => {
} }
const data = await response.json(); const data = await response.json();
console.log('TrashItems: ', data);
return data; return data;
} catch (error: any) { } catch (error: any) {
console.error("Failed to fetch trash data:", error); console.error("Failed to fetch trash data:", error);

View File

@ -9,7 +9,7 @@ export const projectTutorial = async () => {
}, },
}); });
console.log("response: ", response); // console.log("response: ", response);
if (!response.ok) { if (!response.ok) {
throw new Error("Failed to add project"); throw new Error("Failed to add project");

View File

@ -3,11 +3,14 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
export const recentlyViewed = async (organization: string, userId: string) => { export const recentlyViewed = async (organization: string, userId: string) => {
try { try {
const response = await fetch( const response = await fetch(
`${url_Backend_dwinzo}/api/v1/RecentlyViewed/${userId}/${organization}`, `${url_Backend_dwinzo}/api/v2/RecentlyViewed`,
{ {
method: "GET", method: "GET",
headers: { headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json", "Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
}, },
} }
); );
@ -16,10 +19,10 @@ export const recentlyViewed = async (organization: string, userId: string) => {
throw new Error("Failed to fetch project"); throw new Error("Failed to fetch project");
} }
return await response.json(); return await response.json();
} catch (error: any) { } catch (error: any) {
console.error("Failed to get project"); console.error("Failed to get project");
throw new Error(error.message); throw new Error(error.message);
} }
}; };

View File

@ -4,11 +4,14 @@ const url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_
export const restoreTrash = async (organization: string, projectId: string) => { export const restoreTrash = async (organization: string, projectId: string) => {
try { try {
const response = await fetch( const response = await fetch(
`${url_Backend_dwinzo}/api/v1/restore?organization=${organization}&projectId=${projectId}`, `${url_Backend_dwinzo}api/v2/Trash/restore?projectId=${projectId}`,
{ {
method: "PATCH", method: "PATCH",
headers: { headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json", "Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
}, },
} }
); );
@ -18,10 +21,10 @@ export const restoreTrash = async (organization: string, projectId: string) => {
} }
const data = await response.json(); const data = await response.json();
console.log('restore: ', data);
return data; return data;
} catch (error: any) { } catch (error: any) {
console.error("Failed to fetch trash data:", error); console.error("Failed to fetch trash data:", error);
throw new Error(error.message || "Unknown error"); throw new Error(error.message || "Unknown error");
} }
}; };

View File

@ -7,11 +7,14 @@ export const searchProject = async (
) => { ) => {
try { try {
const response = await fetch( const response = await fetch(
`${url_Backend_dwinzo}/api/v1/searchProjects?organization=${organization}&userId=${userId}&searchName=${searchName}`, `${url_Backend_dwinzo}/api/v2/searchProjects?searchName=${searchName}`,
{ {
method: "GET", method: "GET",
headers: { headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json", "Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
}, },
} }
); );
@ -20,9 +23,9 @@ export const searchProject = async (
throw new Error("Failed to Search project"); throw new Error("Failed to Search project");
} }
console.log("response: ", response);
const result = await response.json(); const result = await response.json();
console.log("result: ", result); console.log("searchProjects: ", result);
return result; return result;
} catch (error) { } catch (error) {

View File

@ -7,11 +7,14 @@ export const trashSearchProject = async (
) => { ) => {
try { try {
const response = await fetch( const response = await fetch(
`${url_Backend_dwinzo}/api/v1/searchTrashProjects?organization=${organization}&userId=${userId}&searchName=${searchName}`, `${url_Backend_dwinzo}/api/v2/searchTrashProjects?searchName=${searchName}`,
{ {
method: "GET", method: "GET",
headers: { headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json", "Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
}, },
} }
); );
@ -21,6 +24,7 @@ export const trashSearchProject = async (
} }
const result = await response.json(); const result = await response.json();
console.log('searchTrashProjects: ', result);
return result; return result;
} catch (error) { } catch (error) {
if (error instanceof Error) { if (error instanceof Error) {

View File

@ -19,11 +19,14 @@ export const updateProject = async (
try { try {
const response = await fetch( const response = await fetch(
`${url_Backend_dwinzo}/api/v1/Project/modify`, `${url_Backend_dwinzo}/api/v2/Project/${projectId}`,
{ {
method: "PATCH", method: "PATCH",
headers: { headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json", "Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
}, },
body: JSON.stringify(body), body: JSON.stringify(body),
} }

View File

@ -1,17 +1,15 @@
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`; let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
export const viewProject = async ( export const viewProject = async (organization: string,projectId: string,userId: string) => {
organization: string,
projectId: string,
userId: string
) => {
try { try {
const response = await fetch( const response = await fetch(`${url_Backend_dwinzo}/api/v2/Project/${projectId}`,
`${url_Backend_dwinzo}/api/v1/Project/view?organization=${organization}&projectId=${projectId}&userId=${userId}`,
{ {
method: "GET", method: "GET",
headers: { headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json", "Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
}, },
} }
); );

View File

@ -3,9 +3,7 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_MARKETPLACE_URL}
export const getAssetImages = async (cursor?: string) => { export const getAssetImages = async (cursor?: string) => {
try { try {
const response = await fetch( const response = await fetch(
`${url_Backend_dwinzo}/api/v3/AssetDatas?limit=10${ `${url_Backend_dwinzo}/api/v3/AssetDatas?limit=10${cursor ? `&cursor=${cursor}` : ""}`,
cursor ? `&cursor=${cursor}` : ""
}`,
{ {
method: "GET", method: "GET",
headers: { headers: {

View File

@ -1,23 +1,18 @@
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`; let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
export const signInApi = async ( export const signInApi = async (Email: string,Password: Object,organization: Object,fingerprint:any) => {
email: string,
password: Object,
organization: Object
) => {
try { try {
const response = await fetch(`${url_Backend_dwinzo}/api/v1/login`, { const response = await fetch(`${url_Backend_dwinzo}/api/v2/Auth/login`, {
method: "POST", method: "POST",
headers: { headers: {"Content-Type": "application/json",},
"Content-Type": "application/json", body: JSON.stringify({ Email, Password, organization,fingerprint}),
},
body: JSON.stringify({ email, password, organization }),
}); });
const result = await response.json(); const result = await response.json();
return result; return result;
} catch (error) { } catch (error) {
echo.error("Failed to sign-in"); echo.error("Failed to sign-in");
if (error instanceof Error) { if (error instanceof Error) {
return { error: error.message }; return { error: error.message };
} else { } else {

View File

@ -2,17 +2,15 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
export const signUpApi = async ( export const signUpApi = async (
userName: string, userName: string,
email: string, Email: string,
password: Object, Password: Object,
organization: Object organization: Object
) => { ) => {
try { try {
const response = await fetch(`${url_Backend_dwinzo}/api/v1/signup`, { const response = await fetch(`${url_Backend_dwinzo}/api/v2/Auth/signup`, {
method: "POST", method: "POST",
headers: { headers: { "Content-Type": "application/json", },
"Content-Type": "application/json", body: JSON.stringify({ userName, Email, Password, organization }),
},
body: JSON.stringify({ userName, email, password, organization }),
}); });
if (!response.ok) { if (!response.ok) {
@ -20,7 +18,6 @@ export const signUpApi = async (
} }
const result = await response.json(); const result = await response.json();
console.log("result: ", result);
return result; return result;
} catch (error) { } catch (error) {
echo.error("Failed to sign-up"); echo.error("Failed to sign-up");