@har-analyzer/components 0.0.5 → 0.0.9

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 CHANGED
@@ -12,17 +12,17 @@ yarn add @har-analyzer/components
12
12
  pnpm add @har-analyzer/components
13
13
  ```
14
14
 
15
- ## Components
15
+ ## Components & Hooks
16
16
 
17
- Below are the available components and their usage examples:
17
+ Below are the available exports and their usage examples:
18
18
 
19
- ### HarAnalyzer ([Demo](https://theallanjoshua.github.io/har-analyzer/))
19
+ ### HARAnalyzer ([Demo](https://theallanjoshua.github.io/har-analyzer/))
20
20
 
21
21
  ```jsx
22
- import HarAnalyzer from '@har-analyzer/components/har-analyzer';
22
+ import HARAnalyzer from '@har-analyzer/components/har-analyzer';
23
23
 
24
24
  function App() {
25
- return <HarAnalyzer appName="HAR Analyzer" />;
25
+ return <HARAnalyzer appName="HAR Analyzer" />;
26
26
  }
27
27
  ```
28
28
 
@@ -31,22 +31,20 @@ function App() {
31
31
  | Name | Type | Required | Description |
32
32
  |-----------|-----------------|----------|--------------------------------------|
33
33
  | logo | React.ReactNode | No | A logo to display in the header. |
34
- | appName | string | Yes | The name of the application. |
35
-
34
+ | appName | string | No | The name of the application. |
36
35
 
37
36
  ---
38
37
 
39
- ### HAREntriesViewer
38
+ ### HARContentViewer
40
39
 
41
40
  ```jsx
42
- import HAREntriesViewer from '@har-analyzer/components/har-entries-viewer';
41
+ import HARContentViewer from '@har-analyzer/components/har-content-viewer';
43
42
 
44
43
  function App() {
45
44
  return (
46
- <HAREntriesViewer
45
+ <HARContentViewer
47
46
  harFileName="example.har"
48
47
  harContent={yourHarContent}
49
- onChange={(selectedEntry) => console.log(selectedEntry)}
50
48
  />
51
49
  );
52
50
  }
@@ -58,7 +56,6 @@ function App() {
58
56
  |---------------|-------------------------------|----------|--------------------------------------------------|
59
57
  | harFileName | string | No | The name of the HAR file being viewed. |
60
58
  | harContent | HarContent | No | The HAR file content object. |
61
- | onChange | (entry: HAREntry) => void | Yes | Callback when a HAR entry is selected. |
62
59
 
63
60
  ---
64
61
 
@@ -88,7 +85,7 @@ import HARFileUploader from '@har-analyzer/components/har-file-uploader';
88
85
  function App() {
89
86
  return (
90
87
  <HARFileUploader
91
- onChange={(harContent, fileName) => console.log(harContent, fileName)}
88
+ onChange={({ harContent, harFileName }) => console.log(harContent, harFileName)}
92
89
  />
93
90
  );
94
91
  }
@@ -96,9 +93,63 @@ function App() {
96
93
 
97
94
  **Props:**
98
95
 
99
- | Name | Type | Required | Description |
100
- |-----------|-------------------------------------------|----------|--------------------------------------------------|
101
- | onChange | (harContent: HarContent, fileName?: string) => void | Yes | Callback when a HAR file is uploaded. |
96
+ | Name | Type | Required | Description |
97
+ |-----------|--------------------------------------------------------------------|----------|--------------------------------------------------|
98
+ | onChange | `(args: { harContent: HARContent; harFileName?: string }) => void` | Yes | Callback when a HAR file is uploaded. |
99
+
100
+ ---
101
+
102
+ ### useHAREntriesFilters
103
+
104
+ A custom React hook for filtering and searching HAR network entries.
105
+
106
+ ```jsx
107
+ import { useHAREntriesFilters } from '@har-analyzer/components';
108
+
109
+ function App() {
110
+ const { filteredEntries, HAREntriesFilters } = useHAREntriesFilters(entries);
111
+ // ...
112
+ }
113
+ ```
114
+
115
+ ---
116
+
117
+ ### HARAnalyzerPreferencesProvider
118
+
119
+ Provides a persistent context for managing user preferences (like theme, content width, table preferences and board layouts). By default, preferences rely on browser storage. However, you can provide a custom async store (e.g., to save preferences to a backend database or external extension API) by wrapping your application in `HARAnalyzerPreferencesProvider`.
120
+
121
+ ```jsx
122
+ import HARAnalyzerPreferencesProvider from '@har-analyzer/components/har-analyzer-preferences';
123
+
124
+ // Optional: Custom external store
125
+ const customStore = {
126
+ getPreference: async (key) => fetch(`/api/prefs/${key}`).then(res => res.text()),
127
+ setPreference: async (key, value) => { await fetch(`/api/prefs/${key}`, { method: 'POST', body: value }) }
128
+ };
129
+
130
+ function App() {
131
+ return (
132
+ <HARAnalyzerPreferencesProvider store={customStore}>
133
+ <HARAnalyzer appName="HAR Analyzer" />;
134
+ </HARAnalyzerPreferencesProvider>
135
+ );
136
+ }
137
+
138
+ ```
139
+
140
+ ---
141
+
142
+ ### HAR Utilities
143
+
144
+ Various types and utilities for working with HTTP Archive (.har) files are directly exported.
145
+
146
+ ```typescript
147
+ import {
148
+ getHARContentFromFile,
149
+ type HARContent,
150
+ type HAREntry
151
+ } from '@har-analyzer/components';
152
+ ```
102
153
 
103
154
  ---
104
155
 
@@ -113,4 +164,4 @@ Contributions are welcome! Please open issues or pull requests on [GitHub](https
113
164
 
114
165
  ## License
115
166
 
116
- MIT
167
+ [MIT](https://github.com/theallanjoshua/har-analyzer/blob/main/LICENSE)