auto-component 0.0.31 → 0.0.32
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/package.json +2 -5
- package/src/index.jsx +14 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auto-component",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"main": "src/index.jsx",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"react": "^18.2.0",
|
|
@@ -8,8 +8,5 @@
|
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"src"
|
|
11
|
-
]
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"js-beautify": "^1.14.11"
|
|
14
|
-
}
|
|
11
|
+
]
|
|
15
12
|
}
|
package/src/index.jsx
CHANGED
|
@@ -14,8 +14,9 @@ const AutoComponent = ({ exclusions }) => {
|
|
|
14
14
|
|
|
15
15
|
const [ responseData, setResponseData ] = useState(null)
|
|
16
16
|
const [ requestData, setRequestData ] = useState(null)
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
const [ activeTab, setActiveTab ] = useState('request')
|
|
19
|
+
const [ history, setHistory ] = useState(["No History"])
|
|
19
20
|
|
|
20
21
|
//**-------------------------**/
|
|
21
22
|
// ** HTML/CSS Formatting ** //
|
|
@@ -125,6 +126,7 @@ const AutoComponent = ({ exclusions }) => {
|
|
|
125
126
|
const resData = await sendRequest();
|
|
126
127
|
|
|
127
128
|
if (resData) {
|
|
129
|
+
setHistory(resData.history)
|
|
128
130
|
// setResponseData(formatHtml(resData.response.content));
|
|
129
131
|
setResponseData(resData.response.content);
|
|
130
132
|
setActiveTab('response');
|
|
@@ -162,6 +164,7 @@ const AutoComponent = ({ exclusions }) => {
|
|
|
162
164
|
setRequest('')
|
|
163
165
|
setResponseData('')
|
|
164
166
|
randomUser()
|
|
167
|
+
setHistory([])
|
|
165
168
|
}
|
|
166
169
|
|
|
167
170
|
const handleRequestTab = () => {
|
|
@@ -180,6 +183,15 @@ const AutoComponent = ({ exclusions }) => {
|
|
|
180
183
|
// ** Rendering ** //
|
|
181
184
|
//**-------------**/
|
|
182
185
|
|
|
186
|
+
const getLog = () => {
|
|
187
|
+
return (
|
|
188
|
+
history.map((entry, index) => (
|
|
189
|
+
|
|
190
|
+
index !== 0 && entry.content.split('HTML Context:')[0] + (entry.content.includes("User Request") ? '\n' : '\n\n\n')
|
|
191
|
+
)
|
|
192
|
+
))
|
|
193
|
+
}
|
|
194
|
+
|
|
183
195
|
const requestHTML = currentHtml ? (
|
|
184
196
|
`Review the details below for accuracy and privacy concerns.
|
|
185
197
|
If the contents of an element should be excluded, add the 'exclude' class to the element.
|
|
@@ -217,7 +229,7 @@ User ID:\n `
|
|
|
217
229
|
</div>
|
|
218
230
|
</div>
|
|
219
231
|
<pre>
|
|
220
|
-
{activeTab === 'request' ?
|
|
232
|
+
{activeTab === 'request' ? getLog() : responseHtml}
|
|
221
233
|
</pre>
|
|
222
234
|
</div>
|
|
223
235
|
<div className="copy-btn" onClick={copyToClipboard} style={activeTab !== 'response' ? { display: 'none' } : null}>
|