reqwise-react 1.1.4 → 1.2.1

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > reqwise-react@1.1.3 build C:\Users\PC\Desktop\Code\reqwise\packages\react
2
+ > reqwise-react@1.2.1 build C:\Users\PC\Desktop\Code\reqwise\packages\react
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -12,7 +12,7 @@
12
12
  ESM Build start
13
13
  ESM dist\index.mjs 2.96 KB
14
14
  ESM dist\index.mjs.map 5.45 KB
15
- ESM ⚡️ Build success in 11ms
15
+ ESM ⚡️ Build success in 10ms
16
16
  CJS dist\index.js 4.92 KB
17
17
  CJS dist\index.js.map 5.62 KB
18
18
  CJS ⚡️ Build success in 11ms
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  It operates like a mini **Postman** or **Chrome DevTools Network** panel embedded directly inside your React app. Through a floating aside panel, developers can inspect requests in real-time, browse page history, analyze API endpoints, and send manual test requests with a single click.
6
6
 
7
- **Version:** 1.1.3 | **Status:** Production Ready | **React:** 17+
7
+ **Version:** 1.2.1 | **Status:** Production Ready | **React:** 17+
8
8
 
9
9
  ---
10
10
 
@@ -18,6 +18,7 @@ It operates like a mini **Postman** or **Chrome DevTools Network** panel embedde
18
18
 
19
19
  ### 💾 Smart Persistence
20
20
  - **localStorage Integration:** Stores all request history under `reqwise_history_v1` key
21
+ - **In-Memory Mode:** Optional in-memory storage without localStorage pollution (for restricted environments)
21
22
  - **Auto-Cleanup:** Configurable `maxItems` limit with oldest-first eviction strategy
22
23
  - **TTL Support:** Automatic deletion of entries older than configurable `historyTTL` (in days)
23
24
 
@@ -39,17 +40,20 @@ It operates like a mini **Postman** or **Chrome DevTools Network** panel embedde
39
40
  ### 🎨 UI & UX Enhancements
40
41
  - **4 Tabbed Interface:**
41
42
  - **Current Tab:** Requests from current page
42
- - **History Tab:** All captured requests with filtering (method, status, page)
43
+ - **History Tab:** All captured requests with filtering (method, status, page, source)
43
44
  - **Send Tab:** Mini HTTP client — compose and send test requests
44
- - **Endpoints Tab:** Auto-discovered API endpoints with statistics
45
- - **Placement Flexibility:** 4 positions (top, right, bottom, left)
46
- - **Theme Support:** Dark, Light, and System themes
47
- - **Responsive Sizing:** 4 size presets (sm, md, lg, full)
48
- - **Opacity Control:** Configurable opacity (0.0–1.0)
45
+ - **Endpoints Tab:** Auto-discovered API endpoints with statistics (hit count, methods, params, examples)
46
+ - **Placement Flexibility:** 4 positions (top, right, bottom, left) — sidebars or drawers
47
+ - **Theme Support:** Dark, Light, and System (prefers-color-scheme) themes
48
+ - **Responsive Sizing:** 4 size presets (sm: 320px, md: 420px, lg: 560px, full: 100%)
49
+ - **Opacity Control:** Semi-transparent panels with configurable opacity (0.0–1.0) and backdrop blur
50
+ - **Request Cards:** Compact view (method + URL + status + duration) or detailed view with collapsible sections
49
51
 
50
52
  ### 🔍 Filtering & Search
51
53
  - **Method Filter:** GET, POST, PUT, PATCH, DELETE
52
54
  - **Status Filter:** All, Success (2xx), Client Errors (4xx), Server Errors (5xx)
55
+ - **Page Filter:** View requests by page (useful in SPAs)
56
+ - **Source Filter:** Auto-captured vs. manual (Send tab) requests
53
57
  - **URL Search:** Text filter by URL patterns
54
58
 
55
59
  ### 📊 Endpoint Intelligence
@@ -195,6 +199,110 @@ export default function App() {
195
199
 
196
200
  ---
197
201
 
202
+ ## 🚀 Architecture Flow
203
+
204
+ Reqwise acts as a transparent interceptor layer:
205
+
206
+ ```
207
+ React Application
208
+
209
+ ReqwiseDevTools Component (mounts Reqwise)
210
+
211
+ [Capture request metadata via Axios interceptor]
212
+
213
+ axios.post(...)
214
+
215
+ Backend API
216
+
217
+ Response received
218
+
219
+ [Record response, status, duration]
220
+
221
+ [Dispatch reqwise:update event]
222
+
223
+ [Panel re-renders with new entry]
224
+
225
+ [Save to localStorage]
226
+
227
+ Application receives response
228
+ ```
229
+
230
+ ### Data Lifecycle
231
+ 1. **Request Started** → captured metadata (method, URL, headers, body)
232
+ 2. **HTTP Executed** → Axios sends actual request
233
+ 3. **Response Received** → status, headers, body captured
234
+ 4. **Callbacks Fired** → `onRequest` → storage → `onResponse/onError`
235
+ 5. **UI Updated** → panel detects new entry via custom event
236
+ 6. **Persistence** → `localStorage.setItem('reqwise_history_v1', ...)`
237
+
238
+ ---
239
+
240
+ ## 💻 TypeScript Data Models
241
+
242
+ ### ReqwiseEntry
243
+ ```typescript
244
+ interface ReqwiseEntry {
245
+ id: string // Unique ID (auto-generated)
246
+ source: "auto" | "manual" // auto: captured, manual: Send tab
247
+ page: string // window.location.href at capture time
248
+ timestamp: string // ISO 8601 timestamp
249
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"
250
+ url: string // Full URL or relative path
251
+ params?: Record<string, unknown> // Query parameters
252
+ requestHeaders?: Record<string, string>
253
+ requestBody?: unknown // JSON or FormData
254
+ status?: number // HTTP status (200, 404, 500, etc.)
255
+ statusText?: string // Status text ("OK", "Not Found", etc.)
256
+ responseHeaders?: Record<string, string>
257
+ responseBody?: unknown // Response JSON/text
258
+ duration?: number // Round-trip time in milliseconds
259
+ error?: { message: string; stack?: string }
260
+ }
261
+ ```
262
+
263
+ ### ReqwiseConfig
264
+ ```typescript
265
+ interface ReqwiseConfig {
266
+ // UI & Display
267
+ theme?: "light" | "dark" | "system" // default: "system"
268
+ placement?: "top" | "right" | "bottom" | "left" // default: "right"
269
+ defaultOpen?: boolean // default: false
270
+ show?: "general" | "detailed" // default: "general"
271
+ size?: "sm" | "md" | "lg" | "full" // default: "md"
272
+ opacity?: number // 0.0-1.0, default: 1.0
273
+
274
+ // Control
275
+ enabled?: boolean // default: true
276
+ hotkey?: string // default: "ctrl+shift+e"
277
+ axiosInstance?: unknown // Axios instance to monitor
278
+
279
+ // Storage
280
+ persistHistory?: boolean // default: true
281
+ maxItems?: number // default: 200
282
+ historyTTL?: number // TTL in days, default: undefined (no expiry)
283
+
284
+ // Filtering
285
+ ignore?: string[] // default: []
286
+ maskHeaders?: string[] // default: []
287
+ maskFields?: string[] // default: []
288
+
289
+ // i18n
290
+ langs?: SupportedLang[] // default: ["en"]
291
+ defaultLang?: SupportedLang // Auto-detected from browser
292
+
293
+ // Callbacks
294
+ onRequest?: (entry: Partial<ReqwiseEntry>) => void
295
+ onResponse?: (entry: ReqwiseEntry) => void
296
+ onError?: (entry: ReqwiseEntry) => void
297
+
298
+ // UX
299
+ groupBy?: "url" | "method" | "status" | "page"
300
+ highlight?: "error" | "slow" | "none" // default: "error"
301
+ }
302
+ ```
303
+
304
+ ---
305
+
198
306
  ## 🎯 Use Cases
199
307
 
200
308
  ### 1. Development Debugging
@@ -301,6 +409,192 @@ export function App() {
301
409
 
302
410
  ---
303
411
 
412
+ ## ⚙️ Core Modules (via reqwise-core)
413
+
414
+ ### `client.ts` — HTTP Interception Engine
415
+ - `initClient(config)` — Initialize with configuration
416
+ - `recordPartial(entry)` — Record partial entry (request or response)
417
+ - `wrapAxios(instance)` — Setup Axios interceptors
418
+ - `get/post/put/patch/delete(url, data?, config?)` — HTTP methods with fallback to fetch
419
+
420
+ ### `storage.ts` — Persistent & In-Memory Storage
421
+ - `initStorage(config)` — Setup storage backend
422
+ - `saveEntry(entry)` — Save entry to memory and localStorage (if enabled)
423
+ - `getEntries()` — Retrieve all entries (newest first)
424
+ - `subscribe(callback)` — Listen for storage changes
425
+ - TTL enforcement — auto-delete entries older than `historyTTL` days
426
+ - Limit enforcement — keep only latest `maxItems` entries
427
+
428
+ ### `filter.ts` — Security & Pattern Matching
429
+ - `shouldIgnore(url)` — Check if URL matches ignore patterns
430
+ - `maskHeaders(headers)` — Redact sensitive headers with `****`
431
+ - `maskFields(obj)` — Recursively redact nested object fields
432
+ - Pattern matching — supports regex and substring matching
433
+
434
+ ### `panel.ts` — DOM & Hotkey Management
435
+ - `mount(config)` — Inject panel into document.body
436
+ - `unmount()` — Remove panel and clean up event listeners
437
+ - `open()` / `close()` / `toggle()` — Panel state management
438
+ - Hotkey listener — parse and bind keyboard shortcut
439
+ - Placement handling — position panel relative to viewport
440
+ - Theme application — data-theme attribute for CSS scoping
441
+
442
+ ### `renderer.ts` — Tab System & UI Rendering
443
+ - `renderTabs()` — Render and switch between 4 tabs
444
+ - `renderCurrent()` — Show requests from current page
445
+ - `renderHistory()` — Show all requests with filters
446
+ - `renderSendRequest()` — Mini HTTP client form
447
+ - `renderEndpoints()` — API endpoint analytics
448
+ - Event listeners — "Send" button, tab switching, form submission
449
+
450
+ ### `i18n.ts` — Translation Catalog
451
+ - `t(key, lang)` — Get translated string
452
+ - `setLanguage(lang)` — Update active language
453
+ - `getLanguage()` — Get current language
454
+ - **Supported languages:** en, tr, az, ru, de, fr, es, pt, zh, ja, ar, ko, it, pl, nl
455
+
456
+ ---
457
+
458
+ ## 🔌 API Reference (React Component)
459
+
460
+ ### ReqwiseDevTools Props
461
+ ```typescript
462
+ interface ReqwiseDevToolsProps {
463
+ axiosInstance: AxiosInstance // Axios instance to monitor
464
+ enabled?: boolean // Enable/disable panel (default: true)
465
+ placement?: Placement // Panel position (default: "right")
466
+ defaultOpen?: boolean // Open on mount (default: false)
467
+ theme?: Theme // Color theme (default: "system")
468
+ hotkey?: string // Keyboard shortcut (default: "ctrl+shift+e")
469
+ show?: "general" | "detailed" // Request card detail (default: "general")
470
+ size?: "sm" | "md" | "lg" | "full" // Panel size (default: "md")
471
+ opacity?: number // Panel opacity 0-1 (default: 1)
472
+ maxItems?: number // Max requests to store (default: 200)
473
+ persistHistory?: boolean // Save to localStorage (default: true)
474
+ ignore?: string[] // URL patterns to ignore (default: [])
475
+ maskHeaders?: string[] // Headers to mask (default: [])
476
+ maskFields?: string[] // JSON fields to mask (default: [])
477
+ groupBy?: "url" | "method" | "status" | "page" // Group requests by
478
+ highlight?: "error" | "slow" | "none" // Highlight type (default: "error")
479
+ langs?: string[] // Supported languages (default: ["en"])
480
+ defaultLang?: string // Initial language (default: auto-detect)
481
+ onRequest?: (entry: Partial<ReqwiseEntry>) => void
482
+ onResponse?: (entry: ReqwiseEntry) => void
483
+ onError?: (entry: ReqwiseEntry) => void
484
+ }
485
+ ```
486
+
487
+ ### Storage API Methods
488
+ ```typescript
489
+ // Available from reqwise-core → storage module
490
+ storage.initStorage(config?)
491
+ storage.saveEntry(entry)
492
+ storage.getEntries() // returns all entries
493
+ storage.subscribe(callback) // listen for changes
494
+ ```
495
+
496
+ ### Panel Control Methods
497
+ ```typescript
498
+ // Available from reqwise-core → panel module
499
+ panel.open()
500
+ panel.close()
501
+ panel.toggle()
502
+ panel.isMounted()
503
+ panel.isOpen()
504
+ ```
505
+
506
+ ### i18n Methods
507
+ ```typescript
508
+ // Available from reqwise-core → i18n module
509
+ i18n.t(key, lang?) // Get translation
510
+ i18n.setLanguage(lang) // Set active language
511
+ i18n.getLanguage() // Get current language
512
+ ```
513
+
514
+ ---
515
+
516
+ ## 🌐 Supported Languages
517
+
518
+ | Code | Language | Code | Language |
519
+ |------|----------|------|----------|
520
+ | en | English | tr | Türkçe (Turkish) |
521
+ | az | Azərbaycanca | ru | Русский (Russian) |
522
+ | de | Deutsch | fr | Français |
523
+ | es | Español | pt | Português |
524
+ | zh | 中文 (Chinese) | ja | 日本語 (Japanese) |
525
+ | ar | العربية (Arabic) | ko | 한국어 (Korean) |
526
+ | it | Italiano | pl | Polski |
527
+ | nl | Nederlands |
528
+
529
+ ---
530
+
531
+ ## 📊 Browser & Environment Support
532
+
533
+ - **Node.js:** 14+ (for SSR checks, no DOM operations)
534
+ - **Browsers:** Chrome, Firefox, Safari, Edge (all modern versions)
535
+ - **React:** 17+ (the ReqwiseDevTools component)
536
+ - **Framework:** Works with any React version 17+
537
+
538
+ ---
539
+
540
+ ## 🚀 Performance Considerations
541
+
542
+ - **Bundle Size:** ~8KB gzipped (React wrapper only; includes ~15KB core)
543
+ - **Runtime Overhead:** <2ms per request (timing measurement)
544
+ - **Memory Usage:** ~100KB for 200 entries (default limit)
545
+ - **Storage:** ~50KB in localStorage for 200 typical entries
546
+ - **No Memory Leaks:** Proper cleanup on component unmount
547
+ - **Lazy Loading:** Core modules load dynamically when needed
548
+
549
+ ---
550
+
551
+ ## 📝 Changelog
552
+
553
+ ### v1.2.1 (Current)
554
+ - Fixed npm registry compatibility: replaced workspace:^ with explicit version for reqwise-core dependency
555
+
556
+ ### v1.2.0
557
+ - Fixed scroll functionality in all tabs with proper flex layout constraints
558
+ - Fixed panel sizing for top/bottom placements (100vw width)
559
+ - Fixed toggle button positioning for all placement types (left, right, top, bottom)
560
+ - Fixed panel transform directions on toggle for top/bottom placements
561
+ - Added expand/collapse buttons for request/response content in Current tab
562
+ - Fixed full-size panel button positioning (inside panel when open, outside when closed)
563
+ - Comprehensive React README documentation with core package structure
564
+ - Added Architecture Flow, TypeScript data models, and Core Modules documentation
565
+ - Added API Reference and Supported Languages to React README
566
+ - Performance Considerations and comprehensive feature documentation
567
+
568
+ ### v1.1.4
569
+ - Updated React README with comprehensive documentation
570
+ - Full API reference aligned with core package
571
+ - Architecture flow diagrams
572
+ - TypeScript data models documentation
573
+ - Supported languages table
574
+
575
+ ### v1.1.3
576
+ - Improved documentation with comprehensive examples
577
+ - Enhanced TypeScript types and interfaces
578
+ - Stable callback system (onRequest, onResponse, onError)
579
+ - TTL support for automatic history cleanup
580
+ - Better error handling and logging
581
+
582
+ ### v1.1.2
583
+ - Added callback hooks (onRequest, onResponse, onError)
584
+ - Introduced TTL (Time-To-Live) for history entries
585
+ - Enhanced filtering capabilities
586
+ - Improved renderer performance
587
+
588
+ ### v1.1.0
589
+ - Introduced Endpoints tab with auto-discovery
590
+ - Added size and opacity props
591
+ - Improved UI responsiveness
592
+
593
+ ### v1.0.0
594
+ - Initial React component release
595
+
596
+ ---
597
+
304
598
  ## 📚 Resources
305
599
 
306
600
  - [Reqwise Core](https://www.npmjs.com/package/reqwise-core) — Core package
@@ -314,4 +608,10 @@ MIT © Ali Zadeh
314
608
 
315
609
  ---
316
610
 
611
+ ## 🤝 Contributing
612
+
613
+ Contributions are welcome! Since Reqwise React is a wrapper around reqwise-core, please refer to the [main repository](https://github.com) for contribution guidelines. Bug reports, feature requests, and pull requests are appreciated.
614
+
615
+ ---
616
+
317
617
  **Reqwise** makes debugging HTTP requests in React apps dramatically easier. Enjoy! 🎉
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reqwise-react",
3
- "version": "1.1.4",
3
+ "version": "1.2.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "exports": {
@@ -11,6 +11,10 @@
11
11
  }
12
12
  },
13
13
  "types": "dist/index.d.ts",
14
+ "scripts": {
15
+ "build": "tsup",
16
+ "type-check": "tsc -p tsconfig.json --noEmit"
17
+ },
14
18
  "peerDependencies": {
15
19
  "axios": ">=1.0.0",
16
20
  "react": ">=17.0.0"
@@ -21,16 +25,12 @@
21
25
  }
22
26
  },
23
27
  "dependencies": {
24
- "reqwise-core": "^1.1.5"
28
+ "reqwise-core": "^1.2.1"
25
29
  },
26
30
  "devDependencies": {
27
31
  "@types/node": "^25.8.0",
28
32
  "@types/react": "^18.0.0",
29
33
  "typescript": "^5.0.0",
30
34
  "tsup": "^8.5.0"
31
- },
32
- "scripts": {
33
- "build": "tsup",
34
- "type-check": "tsc -p tsconfig.json --noEmit"
35
35
  }
36
- }
36
+ }