@visns-studio/visns-components 5.15.21 → 5.15.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -10
- package/package.json +14 -14
- package/src/components/Fetch.jsx +1 -1
- package/src/components/ImportWizardModal.jsx +627 -0
- package/src/components/styles/ImportWizardModal.module.scss +622 -0
- package/src/index.js +2 -0
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ VISNS Components is a React-based UI component library that provides a set of re
|
|
|
69
69
|
|
|
70
70
|
### Utility Components
|
|
71
71
|
|
|
72
|
-
- **Fetch** -
|
|
72
|
+
- **Fetch** - Advanced data fetching with intelligent caching, error handling, and TanStack Query integration
|
|
73
73
|
- **Download** - File download functionality
|
|
74
74
|
- **Loader** - Loading indicators
|
|
75
75
|
- **Notification** - Toast notifications
|
|
@@ -2489,18 +2489,20 @@ const BulkCardProcessor = () => {
|
|
|
2489
2489
|
|
|
2490
2490
|
### Utility Components
|
|
2491
2491
|
|
|
2492
|
-
#### CustomFetch
|
|
2492
|
+
#### CustomFetch (Fetch.jsx)
|
|
2493
2493
|
|
|
2494
|
-
|
|
2494
|
+
Advanced data fetching utility with intelligent caching, error handling, and payload validation powered by TanStack Query (v5.15.21+).
|
|
2495
2495
|
|
|
2496
2496
|
```jsx
|
|
2497
|
-
|
|
2497
|
+
import CustomFetch from '@visns-studio/visns-components';
|
|
2498
|
+
|
|
2499
|
+
// Basic usage - async/await
|
|
2498
2500
|
const result = await CustomFetch('/api/data', 'GET', { param1: 'value1' });
|
|
2499
2501
|
|
|
2500
2502
|
// Using callbacks
|
|
2501
2503
|
CustomFetch(
|
|
2502
2504
|
'/api/data',
|
|
2503
|
-
'
|
|
2505
|
+
'POST',
|
|
2504
2506
|
{ param1: 'value1' },
|
|
2505
2507
|
(result) => {
|
|
2506
2508
|
// Success callback
|
|
@@ -2511,16 +2513,71 @@ CustomFetch(
|
|
|
2511
2513
|
console.error(error);
|
|
2512
2514
|
}
|
|
2513
2515
|
);
|
|
2516
|
+
|
|
2517
|
+
// Manual cache management
|
|
2518
|
+
CustomFetch.invalidateCache('/api/data'); // Invalidate specific pattern
|
|
2519
|
+
CustomFetch.clearCache(); // Clear all cache
|
|
2514
2520
|
```
|
|
2515
2521
|
|
|
2516
|
-
|
|
2522
|
+
**Core Features:**
|
|
2517
2523
|
|
|
2518
|
-
- **
|
|
2519
|
-
- **
|
|
2524
|
+
- **Intelligent Caching**: Selective caching with TanStack Query for optimal performance
|
|
2525
|
+
- **Payload Size Validation**: Automatically validates request size (default: 4.5MB, configurable via `VITE_MAX_PAYLOAD_SIZE_MB`)
|
|
2526
|
+
- **Toast Notifications**: Error messages displayed using react-toastify
|
|
2520
2527
|
- **Promise Tracking**: Integrates with react-promise-tracker for loading indicators
|
|
2521
2528
|
- **HTML Error Parsing**: Properly renders HTML content in error messages
|
|
2522
|
-
- **CSRF Protection**:
|
|
2523
|
-
- **Authentication Handling**:
|
|
2529
|
+
- **CSRF Protection**: Automatic token handling and redirect on mismatch
|
|
2530
|
+
- **Authentication Handling**: Silent handling of unauthenticated errors
|
|
2531
|
+
|
|
2532
|
+
**Caching Strategy (v5.15.21+):**
|
|
2533
|
+
|
|
2534
|
+
The Fetch component implements an intelligent caching strategy designed to balance performance with data freshness:
|
|
2535
|
+
|
|
2536
|
+
- **GET Requests**: NOT cached by default to ensure data freshness
|
|
2537
|
+
- **Selective POST Caching**: Only specific safe endpoints are cached:
|
|
2538
|
+
- `/dropdown` - Reference data (10 min stale time) - Industries, facilities, user lists
|
|
2539
|
+
- `/table` - Table queries (1 min stale time) - Grid data with stable results
|
|
2540
|
+
- `/availabilities` - Report availability (2 min stale time) - Report metadata
|
|
2541
|
+
- `/reports/` - Report data (2 min stale time) - Generated report results
|
|
2542
|
+
- `/dashboard/` - Dashboard metrics (5 min stale time) - Aggregated metrics
|
|
2543
|
+
- Wharf usage endpoints (30 sec stale time) - Real-time usage data
|
|
2544
|
+
|
|
2545
|
+
- **Auto-invalidation**: Mutations (POST/PUT/PATCH/DELETE) automatically invalidate related caches:
|
|
2546
|
+
- Lead mutations → invalidate lead tables and dashboards
|
|
2547
|
+
- Client mutations → invalidate client dropdowns and tables
|
|
2548
|
+
- Agreement mutations → invalidate agreement tables and reports
|
|
2549
|
+
- Facility mutations → invalidate availability and report caches
|
|
2550
|
+
- Any data mutation → invalidate related report caches
|
|
2551
|
+
|
|
2552
|
+
- **Cache Configuration**:
|
|
2553
|
+
- **Cache Time**: 10 minutes - data stays in memory
|
|
2554
|
+
- **Stale Time**: Varies by endpoint type (30 seconds to 10 minutes)
|
|
2555
|
+
- **Retry Policy**: Conservative 1 retry on failure
|
|
2556
|
+
- **Window Focus**: No automatic refetch on focus
|
|
2557
|
+
- **Network Reconnect**: Automatic refetch on reconnection
|
|
2558
|
+
|
|
2559
|
+
**Advanced Cache Control:**
|
|
2560
|
+
|
|
2561
|
+
```jsx
|
|
2562
|
+
// Invalidate specific cache patterns
|
|
2563
|
+
CustomFetch.invalidateCache('/clients/dropdown'); // String pattern
|
|
2564
|
+
CustomFetch.invalidateCache(['clients', 'table']); // Array key
|
|
2565
|
+
|
|
2566
|
+
// Clear entire cache
|
|
2567
|
+
CustomFetch.clearCache();
|
|
2568
|
+
|
|
2569
|
+
// Access QueryClient for advanced operations
|
|
2570
|
+
const queryClient = CustomFetch.getQueryClient();
|
|
2571
|
+
queryClient.invalidateQueries({ queryKey: ['specific', 'key'] });
|
|
2572
|
+
```
|
|
2573
|
+
|
|
2574
|
+
**Implementation Details:**
|
|
2575
|
+
|
|
2576
|
+
- **Singleton QueryClient**: Single instance shared across entire application
|
|
2577
|
+
- **Cache Key Generation**: Consistent keys based on URL, method, and parameters
|
|
2578
|
+
- **Smart Invalidation**: Related caches automatically cleared on mutations
|
|
2579
|
+
- **Error Preservation**: Original error handling callbacks maintained
|
|
2580
|
+
- **Backward Compatibility**: All existing CustomFetch usage continues to work unchanged
|
|
2524
2581
|
|
|
2525
2582
|
#### CameraPlacement
|
|
2526
2583
|
Interactive camera placement and visualization tool for security system design. Features a comprehensive Verkada camera database, FOV triangle visualization, and professional export capabilities with enhanced UI consistency.
|
package/package.json
CHANGED
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
"@dnd-kit/core": "^6.3.1",
|
|
4
4
|
"@dnd-kit/sortable": "^10.0.0",
|
|
5
5
|
"@dnd-kit/utilities": "^3.2.2",
|
|
6
|
-
"@emotion/is-prop-valid": "^1.
|
|
7
|
-
"@fontsource/barlow": "^5.2.
|
|
6
|
+
"@emotion/is-prop-valid": "^1.4.0",
|
|
7
|
+
"@fontsource/barlow": "^5.2.8",
|
|
8
8
|
"@inovua/reactdatagrid-community": "^5.10.2",
|
|
9
9
|
"@inovua/reactdatagrid-enterprise": "^5.10.2",
|
|
10
|
-
"@mapbox/mapbox-gl-geocoder": "^5.1.
|
|
10
|
+
"@mapbox/mapbox-gl-geocoder": "^5.1.2",
|
|
11
11
|
"@nivo/bar": "^0.99.0",
|
|
12
12
|
"@nivo/core": "^0.99.0",
|
|
13
13
|
"@nivo/line": "^0.99.0",
|
|
14
14
|
"@nivo/pie": "^0.99.0",
|
|
15
15
|
"@react-pdf/renderer": "^4.3.0",
|
|
16
|
-
"@tanstack/react-query": "^5.
|
|
16
|
+
"@tanstack/react-query": "^5.89.0",
|
|
17
17
|
"@tinymce/miniature": "^6.0.0",
|
|
18
18
|
"@tinymce/tinymce-react": "^6.3.0",
|
|
19
19
|
"@uiw/react-color": "^2.8.0",
|
|
@@ -24,18 +24,18 @@
|
|
|
24
24
|
"array-move": "^4.0.0",
|
|
25
25
|
"awesome-debounce-promise": "^2.1.0",
|
|
26
26
|
"browser-image-compression": "^2.0.2",
|
|
27
|
-
"dayjs": "^1.11.
|
|
27
|
+
"dayjs": "^1.11.18",
|
|
28
28
|
"fabric": "^6.7.1",
|
|
29
29
|
"file-saver": "^2.0.5",
|
|
30
|
-
"framer-motion": "^12.23.
|
|
30
|
+
"framer-motion": "^12.23.14",
|
|
31
31
|
"html-react-parser": "^5.2.6",
|
|
32
32
|
"html2canvas": "^1.4.1",
|
|
33
33
|
"lodash": "^4.17.21",
|
|
34
34
|
"lodash.debounce": "^4.0.8",
|
|
35
|
-
"lucide-react": "^0.
|
|
36
|
-
"mapbox-gl": "^3.
|
|
35
|
+
"lucide-react": "^0.544.0",
|
|
36
|
+
"mapbox-gl": "^3.15.0",
|
|
37
37
|
"moment": "^2.30.1",
|
|
38
|
-
"motion": "^12.23.
|
|
38
|
+
"motion": "^12.23.14",
|
|
39
39
|
"numeral": "^2.0.6",
|
|
40
40
|
"pluralize": "^8.0.0",
|
|
41
41
|
"qrcode.react": "^4.2.0",
|
|
@@ -64,18 +64,18 @@
|
|
|
64
64
|
"reactjs-popup": "^2.0.6",
|
|
65
65
|
"style-loader": "^4.0.0",
|
|
66
66
|
"swapy": "^1.0.5",
|
|
67
|
-
"sweetalert2": "^11.
|
|
67
|
+
"sweetalert2": "^11.23.0",
|
|
68
68
|
"tesseract.js": "^6.0.1",
|
|
69
69
|
"truncate": "^3.0.0",
|
|
70
70
|
"uuid": "^11.1.0",
|
|
71
71
|
"validator": "^13.15.15",
|
|
72
|
-
"vite": "^6.3.
|
|
72
|
+
"vite": "^6.3.6",
|
|
73
73
|
"xlsx": "^0.18.5",
|
|
74
74
|
"yarn": "^1.22.22",
|
|
75
75
|
"yet-another-react-lightbox": "^3.25.0"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@babel/core": "^7.28.
|
|
78
|
+
"@babel/core": "^7.28.4",
|
|
79
79
|
"@babel/plugin-transform-runtime": "^7.28.3",
|
|
80
80
|
"@babel/preset-env": "^7.28.3",
|
|
81
81
|
"@babel/preset-react": "^7.27.1",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"mini-css-extract-plugin": "^2.9.4",
|
|
87
87
|
"react": "^18.3.1",
|
|
88
88
|
"react-dom": "^18.3.1",
|
|
89
|
-
"sass": "^1.
|
|
89
|
+
"sass": "^1.92.1",
|
|
90
90
|
"sass-loader": "^16.0.5"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
95
95
|
},
|
|
96
96
|
"name": "@visns-studio/visns-components",
|
|
97
|
-
"version": "5.15.
|
|
97
|
+
"version": "5.15.23",
|
|
98
98
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
99
99
|
"main": "src/index.js",
|
|
100
100
|
"files": [
|
package/src/components/Fetch.jsx
CHANGED
|
@@ -75,7 +75,7 @@ const shouldCache = (method, url) => {
|
|
|
75
75
|
|
|
76
76
|
// Dynamic stale time based on endpoint type
|
|
77
77
|
const getStaleTime = (url) => {
|
|
78
|
-
if (url.includes('/dropdown')) return
|
|
78
|
+
if (url.includes('/dropdown')) return 1 * 60 * 1000; // 1 minute for dropdown data
|
|
79
79
|
if (url.includes('/dashboard/')) return 5 * 60 * 1000; // 5 minutes for dashboard data
|
|
80
80
|
if (url.includes('/availabilities') || url.includes('/reports/')) return 2 * 60 * 1000; // 2 minutes for reports
|
|
81
81
|
if (url.includes('/table')) return 1 * 60 * 1000; // 1 minute for table data
|