@eeacms/volto-eea-chatbot 1.0.13 → 2.0.0
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/CHANGELOG.md +17 -3
- package/DEVELOP.md +28 -26
- package/README.md +19 -7
- package/docker-compose.yml +1 -1
- package/jest-addon.config.js +16 -4
- package/package.json +1 -1
- package/src/ChatBlock/hocs/withOnyxData.jsx +6 -2
- package/src/ChatBlock/packets/renderers/ImageToolRenderer.tsx +2 -2
- package/src/ChatBlock/tests/AIMessage.test.jsx +1 -1
- package/src/ChatBlock/tests/BlinkingDot.test.jsx +1 -1
- package/src/ChatBlock/tests/ChatMessage.test.jsx +1 -1
- package/src/ChatBlock/tests/Citation.test.jsx +1 -1
- package/src/ChatBlock/tests/ClaimModal.test.jsx +1 -1
- package/src/ChatBlock/tests/ClaimSegments.test.jsx +1 -1
- package/src/ChatBlock/tests/CustomToolRenderer.test.jsx +1 -1
- package/src/ChatBlock/tests/EmptyState.test.jsx +1 -1
- package/src/ChatBlock/tests/FeedbackModal.test.jsx +1 -1
- package/src/ChatBlock/tests/FetchToolRenderer.test.jsx +1 -1
- package/src/ChatBlock/tests/ImageToolRenderer.test.jsx +1 -1
- package/src/ChatBlock/tests/QualityCheckToggle.test.jsx +1 -1
- package/src/ChatBlock/tests/RelatedQuestions.test.jsx +1 -1
- package/src/ChatBlock/tests/RenderClaimView.test.jsx +1 -1
- package/src/ChatBlock/tests/SearchToolRenderer.test.jsx +1 -1
- package/src/ChatBlock/tests/Source.test.jsx +1 -1
- package/src/ChatBlock/tests/SourceChip.test.jsx +1 -1
- package/src/ChatBlock/tests/Spinner.test.jsx +1 -1
- package/src/ChatBlock/tests/UserActionsToolbar.test.jsx +1 -1
- package/src/ChatBlock/tests/UserMessage.test.jsx +1 -1
- package/src/ChatBlock/tests/WebResultIcon.test.jsx +1 -1
- package/src/ChatBlock/tests/index.test.js +1 -1
- package/src/ChatBlock/tests/schema.test.js +1 -1
- package/src/ChatBlock/tests/useDeepCompareMemoize.test.js +1 -1
- package/src/ChatBlock/tests/utils.test.jsx +1 -1
- package/src/ChatBlock/tests/withOnyxData.test.jsx +1 -1
- package/src/middleware.js +8 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,24 +4,38 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
### [2.0.0](https://github.com/eea/volto-eea-chatbot/compare/1.0.13...2.0.0) - 16 March 2026
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat: Volto 18 support - refs #287700 [Alin Voinea - [`e37ee8e`](https://github.com/eea/volto-eea-chatbot/commit/e37ee8e97e43c6108f336a341f31c4411fb22141)]
|
|
12
|
+
|
|
13
|
+
#### :bug: Bug Fixes
|
|
14
|
+
|
|
15
|
+
- fix(withOnyxData): handle API errors gracefully and set proper HTTP status codes [Claudia Ifrim - [`eec4e22`](https://github.com/eea/volto-eea-chatbot/commit/eec4e220649634714165857e5e14a6a444de4f92)]
|
|
16
|
+
|
|
17
|
+
#### :house: Internal changes
|
|
18
|
+
|
|
19
|
+
- style: Automated code fix [eea-jenkins - [`0579cad`](https://github.com/eea/volto-eea-chatbot/commit/0579cadfeb3f6f092f4bc66ffacebe59232e8650)]
|
|
20
|
+
|
|
21
|
+
#### :hammer_and_wrench: Others
|
|
22
|
+
|
|
23
|
+
- tests: Fix Sonar Qube tags - refs #297339 [Alin Voinea - [`958cd4f`](https://github.com/eea/volto-eea-chatbot/commit/958cd4f97fdd6892aa248083fb13bdf9313727bb)]
|
|
7
24
|
### [1.0.13](https://github.com/eea/volto-eea-chatbot/compare/1.0.12...1.0.13) - 4 March 2026
|
|
8
25
|
|
|
9
26
|
#### :house: Internal changes
|
|
10
27
|
|
|
11
28
|
- style: Automated code fix [eea-jenkins - [`8a8c3c4`](https://github.com/eea/volto-eea-chatbot/commit/8a8c3c4172a4f669661378cf1b5a3569d85609e6)]
|
|
12
|
-
- chore: [JENKINSFILE] add package version in sonarqube [valentinab25 - [`535d986`](https://github.com/eea/volto-eea-chatbot/commit/535d986b7adc77743a668bc4ac63f835eef58df3)]
|
|
13
29
|
|
|
14
30
|
#### :hammer_and_wrench: Others
|
|
15
31
|
|
|
16
32
|
- update [Miu Razvan - [`04e6c3f`](https://github.com/eea/volto-eea-chatbot/commit/04e6c3f776bb9920b89a014cc97f8e5dbb284a48)]
|
|
17
33
|
- update [Miu Razvan - [`f9e9beb`](https://github.com/eea/volto-eea-chatbot/commit/f9e9beb0676b215a50226a0db8c5be7c540f26ff)]
|
|
18
|
-
- Forward client ip to onyx/llmgw requests, ref #298095 [Miu Razvan - [`e90a672`](https://github.com/eea/volto-eea-chatbot/commit/e90a672273f2220d2cced4ad53c4b3ed3f295691)]
|
|
19
34
|
### [1.0.12](https://github.com/eea/volto-eea-chatbot/compare/1.0.11...1.0.12) - 23 February 2026
|
|
20
35
|
|
|
21
36
|
#### :house: Internal changes
|
|
22
37
|
|
|
23
38
|
- style: Automated code fix [eea-jenkins - [`fdcd884`](https://github.com/eea/volto-eea-chatbot/commit/fdcd8848fd4c3f990ca5ea021f407487aebd6010)]
|
|
24
|
-
- chore: [JENKINSFILE] use sonarqube branches [EEA Jenkins - [`3d428d7`](https://github.com/eea/volto-eea-chatbot/commit/3d428d72f32c3d05452b0961c76f5db1c416e05c)]
|
|
25
39
|
|
|
26
40
|
#### :hammer_and_wrench: Others
|
|
27
41
|
|
package/DEVELOP.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# volto-
|
|
1
|
+
# volto-eea-chatbot
|
|
2
2
|
|
|
3
3
|
## Develop
|
|
4
4
|
|
|
5
5
|
1. Make sure you have `docker` and `docker compose` installed and running on your machine:
|
|
6
6
|
|
|
7
7
|
```Bash
|
|
8
|
-
git clone https://github.com/eea/volto-
|
|
9
|
-
cd volto-
|
|
8
|
+
git clone https://github.com/eea/volto-eea-chatbot.git
|
|
9
|
+
cd volto-eea-chatbot
|
|
10
10
|
git checkout -b bugfix-123456 develop
|
|
11
11
|
make
|
|
12
12
|
make start
|
|
@@ -24,64 +24,66 @@
|
|
|
24
24
|
|
|
25
25
|
1. Happy hacking!
|
|
26
26
|
|
|
27
|
-
### Or add @eeacms/volto-
|
|
27
|
+
### Or add @eeacms/volto-eea-chatbot to your Volto project
|
|
28
28
|
|
|
29
|
-
Before starting make sure your development environment is properly set. See [Volto
|
|
29
|
+
Before starting make sure your development environment is properly set. See the official Plone documentation for [creating a project with Cookieplone](https://6.docs.plone.org/install/create-project-cookieplone.html) and [installing an add-on in development mode in Volto 18 and 19](https://6.docs.plone.org/volto/development/add-ons/install-an-add-on-dev-18.html).
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
For new Volto 18+ projects, use Cookieplone. It includes `mrs-developer` by default.
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
1. Create a new Volto project with Cookieplone
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
yo @plone/volto my-volto-project --addon @eeacms/volto-addon-template --skip-install
|
|
38
|
-
cd my-volto-project
|
|
35
|
+
uvx cookieplone project
|
|
36
|
+
cd project-title
|
|
39
37
|
|
|
40
38
|
1. Add the following to `mrs.developer.json`:
|
|
41
39
|
|
|
42
40
|
{
|
|
43
|
-
"volto-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
41
|
+
"volto-eea-chatbot": {
|
|
42
|
+
"output": "packages",
|
|
43
|
+
"url": "https://github.com/eea/volto-eea-chatbot.git",
|
|
44
|
+
"package": "@eeacms/volto-eea-chatbot",
|
|
46
45
|
"branch": "develop",
|
|
47
46
|
"path": "src"
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
1.
|
|
50
|
+
1. Add `@eeacms/volto-eea-chatbot` to the `addons` key in your project `package.json`
|
|
51
|
+
|
|
52
|
+
1. Install or refresh the project setup
|
|
52
53
|
|
|
53
|
-
make
|
|
54
|
-
yarn
|
|
54
|
+
make install
|
|
55
55
|
|
|
56
|
-
1. Start backend
|
|
56
|
+
1. Start backend in one terminal
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
make backend-start
|
|
59
59
|
|
|
60
|
-
...wait for backend to setup and start
|
|
60
|
+
...wait for backend to setup and start, ending with `Ready to handle requests`
|
|
61
61
|
|
|
62
62
|
...you can also check http://localhost:8080/Plone
|
|
63
63
|
|
|
64
|
-
1. Start frontend
|
|
64
|
+
1. Start frontend in a second terminal
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
make frontend-start
|
|
67
67
|
|
|
68
68
|
1. Go to http://localhost:3000
|
|
69
69
|
|
|
70
70
|
1. Happy hacking!
|
|
71
71
|
|
|
72
|
-
cd
|
|
72
|
+
cd packages/volto-eea-chatbot
|
|
73
|
+
|
|
74
|
+
For legacy Volto 17 projects, keep using the yarn-based workflow from the Volto 17 documentation.
|
|
73
75
|
|
|
74
76
|
## Cypress
|
|
75
77
|
|
|
76
78
|
To run cypress locally, first make sure you don't have any Volto/Plone running on ports `8080` and `3000`.
|
|
77
79
|
|
|
78
80
|
You don't have to be in a `clean-volto-project`, you can be in any Volto Frontend
|
|
79
|
-
project where you added `volto-
|
|
81
|
+
project where you added `volto-eea-chatbot` to `mrs.developer.json`
|
|
80
82
|
|
|
81
83
|
Go to:
|
|
82
84
|
|
|
83
85
|
```BASH
|
|
84
|
-
cd
|
|
86
|
+
cd packages/volto-eea-chatbot/
|
|
85
87
|
```
|
|
86
88
|
|
|
87
89
|
Start:
|
|
@@ -91,7 +93,7 @@ make
|
|
|
91
93
|
make start
|
|
92
94
|
```
|
|
93
95
|
|
|
94
|
-
This will build and start with Docker a clean `Plone backend` and `Volto Frontend` with `volto-
|
|
96
|
+
This will build and start with Docker a clean `Plone backend` and `Volto Frontend` with `volto-eea-chatbot` block installed.
|
|
95
97
|
|
|
96
98
|
Open Cypress Interface:
|
|
97
99
|
|
package/README.md
CHANGED
|
@@ -67,6 +67,11 @@ make start
|
|
|
67
67
|
|
|
68
68
|
Go to http://localhost:3000
|
|
69
69
|
|
|
70
|
+
`make start` now defaults to Volto 18. To run the same setup against Volto 17, use:
|
|
71
|
+
|
|
72
|
+
VOLTO_VERSION=17 make
|
|
73
|
+
VOLTO_VERSION=17 make start
|
|
74
|
+
|
|
70
75
|
### Add volto-eea-chatbot to your Volto project
|
|
71
76
|
|
|
72
77
|
1. Make sure you have a [Plone backend](https://plone.org/download) up-and-running at http://localhost:8080/Plone
|
|
@@ -89,21 +94,28 @@ Go to http://localhost:3000
|
|
|
89
94
|
}
|
|
90
95
|
```
|
|
91
96
|
|
|
92
|
-
- If not, create one
|
|
97
|
+
- If not, create one with Cookieplone, as recommended by the official Plone documentation for Volto 18+:
|
|
93
98
|
|
|
94
99
|
```
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
cd my-volto-project
|
|
100
|
+
uvx cookieplone project
|
|
101
|
+
cd project-title
|
|
98
102
|
```
|
|
99
103
|
|
|
100
|
-
1. Install
|
|
104
|
+
1. Install or update dependencies, then start the project:
|
|
101
105
|
|
|
102
106
|
```
|
|
103
|
-
|
|
104
|
-
yarn start
|
|
107
|
+
make install
|
|
105
108
|
```
|
|
106
109
|
|
|
110
|
+
For a Cookieplone project, start the backend and frontend in separate terminals:
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
make backend-start
|
|
114
|
+
make frontend-start
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
For a legacy Volto 17 project, install the package with `yarn` and restart the frontend as usual.
|
|
118
|
+
|
|
107
119
|
## Environment Configuration
|
|
108
120
|
|
|
109
121
|
To properly configure the middleware and authenticate with the Onyx service, ensure that the following environment variables are set:
|
package/docker-compose.yml
CHANGED
package/jest-addon.config.js
CHANGED
|
@@ -27,6 +27,20 @@ const addonName =
|
|
|
27
27
|
? pathParts[addonsIdx + 1]
|
|
28
28
|
: path.basename(path.dirname(__filename)); // Fallback to folder name
|
|
29
29
|
const addonBasePath = `src/addons/${addonName}/src`;
|
|
30
|
+
const voltoSlatePath = fs.existsSync(
|
|
31
|
+
path.join(
|
|
32
|
+
__dirname,
|
|
33
|
+
'..',
|
|
34
|
+
'..',
|
|
35
|
+
'..',
|
|
36
|
+
'node_modules',
|
|
37
|
+
'@plone',
|
|
38
|
+
'volto-slate',
|
|
39
|
+
'src',
|
|
40
|
+
),
|
|
41
|
+
)
|
|
42
|
+
? '<rootDir>/node_modules/@plone/volto-slate/src'
|
|
43
|
+
: '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src';
|
|
30
44
|
|
|
31
45
|
// --- Performance caches ---
|
|
32
46
|
const fileSearchCache = new Map();
|
|
@@ -421,10 +435,8 @@ module.exports = {
|
|
|
421
435
|
'@eeacms/search/(.*)$': '<rootDir>/src/addons/volto-searchlib/searchlib/$1',
|
|
422
436
|
'@eeacms/search': '<rootDir>/src/addons/volto-searchlib/searchlib',
|
|
423
437
|
'@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
|
|
424
|
-
'@plone/volto-slate$':
|
|
425
|
-
|
|
426
|
-
'@plone/volto-slate/(.*)$':
|
|
427
|
-
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src/$1',
|
|
438
|
+
'@plone/volto-slate$': voltoSlatePath,
|
|
439
|
+
'@plone/volto-slate/(.*)$': `${voltoSlatePath}/$1`,
|
|
428
440
|
'~/(.*)$': '<rootDir>/src/$1',
|
|
429
441
|
'load-volto-addons':
|
|
430
442
|
'<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
|
package/package.json
CHANGED
|
@@ -25,8 +25,12 @@ export default function withOnyxData(callback) {
|
|
|
25
25
|
React.useEffect(() => {
|
|
26
26
|
async function handler() {
|
|
27
27
|
if (fetcher) {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
try {
|
|
29
|
+
const response = await fetcher;
|
|
30
|
+
setState({ [name]: response.body });
|
|
31
|
+
} catch (error) {
|
|
32
|
+
setState({ [`${name}-error`]: error.message, [name]: null });
|
|
33
|
+
}
|
|
30
34
|
}
|
|
31
35
|
}
|
|
32
36
|
handler();
|
|
@@ -45,9 +45,9 @@ export const ImageToolRenderer: MessageRenderer<ImageGenerationToolPacket> = ({
|
|
|
45
45
|
alt={image.revised_prompt}
|
|
46
46
|
className={`image-shape-${image.shape || 'square'}`}
|
|
47
47
|
/>
|
|
48
|
-
{image.revised_prompt
|
|
48
|
+
{image.revised_prompt ? (
|
|
49
49
|
<div className="image-prompt">{image.revised_prompt}</div>
|
|
50
|
-
)}
|
|
50
|
+
) : null}
|
|
51
51
|
</div>
|
|
52
52
|
))}
|
|
53
53
|
</div>
|
|
@@ -2,7 +2,7 @@ import { MemoryRouter } from 'react-router-dom';
|
|
|
2
2
|
import configureStore from 'redux-mock-store';
|
|
3
3
|
import renderer from 'react-test-renderer';
|
|
4
4
|
|
|
5
|
-
import '@testing-library/jest-dom
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
6
|
import { Provider } from 'react-intl-redux';
|
|
7
7
|
import { AIMessage } from '../chat/AIMessage';
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import { MemoryRouter } from 'react-router-dom';
|
|
|
2
2
|
import configureStore from 'redux-mock-store';
|
|
3
3
|
import renderer from 'react-test-renderer';
|
|
4
4
|
|
|
5
|
-
import '@testing-library/jest-dom
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
6
|
import { Provider } from 'react-intl-redux';
|
|
7
7
|
import { BlinkingDot } from '../components/BlinkingDot';
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import { MemoryRouter } from 'react-router-dom';
|
|
|
2
2
|
import configureStore from 'redux-mock-store';
|
|
3
3
|
import renderer from 'react-test-renderer';
|
|
4
4
|
|
|
5
|
-
import '@testing-library/jest-dom
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
6
|
import { Provider } from 'react-intl-redux';
|
|
7
7
|
import { ChatMessage } from '../chat/ChatMessage';
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import { MemoryRouter } from 'react-router-dom';
|
|
|
2
2
|
import configureStore from 'redux-mock-store';
|
|
3
3
|
import renderer from 'react-test-renderer';
|
|
4
4
|
|
|
5
|
-
import '@testing-library/jest-dom
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
6
|
import { Provider } from 'react-intl-redux';
|
|
7
7
|
import { Citation } from '../components/markdown/Citation';
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderer, { act } from 'react-test-renderer';
|
|
3
|
-
import '@testing-library/jest-dom
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
4
|
import { CustomToolRenderer } from '../packets/renderers/CustomToolRenderer';
|
|
5
5
|
import { PacketType } from '../types/streamingModels';
|
|
6
6
|
|
|
@@ -2,7 +2,7 @@ import { MemoryRouter } from 'react-router-dom';
|
|
|
2
2
|
import configureStore from 'redux-mock-store';
|
|
3
3
|
import renderer from 'react-test-renderer';
|
|
4
4
|
|
|
5
|
-
import '@testing-library/jest-dom
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
6
|
import { Provider } from 'react-intl-redux';
|
|
7
7
|
import EmptyState from '../components/EmptyState';
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderer, { act } from 'react-test-renderer';
|
|
3
|
-
import '@testing-library/jest-dom
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
4
|
import { FetchToolRenderer } from '../packets/renderers/FetchToolRenderer';
|
|
5
5
|
import { PacketType } from '../types/streamingModels';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderer, { act } from 'react-test-renderer';
|
|
3
|
-
import '@testing-library/jest-dom
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
4
|
import { ImageToolRenderer } from '../packets/renderers/ImageToolRenderer';
|
|
5
5
|
import { PacketType } from '../types/streamingModels';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, fireEvent } from '@testing-library/react';
|
|
3
|
-
import '@testing-library/jest-dom
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
4
|
import QualityCheckToggle from '../components/QualityCheckToggle';
|
|
5
5
|
|
|
6
6
|
describe('QualityCheckToggle', () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, fireEvent } from '@testing-library/react';
|
|
3
|
-
import '@testing-library/jest-dom
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
4
|
import RelatedQuestions from '../components/RelatedQuestions';
|
|
5
5
|
|
|
6
6
|
import { trackEvent } from '@eeacms/volto-matomo/utils';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderer from 'react-test-renderer';
|
|
3
3
|
import { render, screen } from '@testing-library/react';
|
|
4
|
-
import '@testing-library/jest-dom
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
5
|
import { RenderClaimView } from '../components/markdown/RenderClaimView';
|
|
6
6
|
|
|
7
7
|
describe('RenderClaimView', () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderer, { act } from 'react-test-renderer';
|
|
3
|
-
import '@testing-library/jest-dom
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
4
|
import { SearchToolRenderer } from '../packets/renderers/SearchToolRenderer';
|
|
5
5
|
import { PacketType } from '../types/streamingModels';
|
|
6
6
|
|
|
@@ -2,7 +2,7 @@ import { MemoryRouter } from 'react-router-dom';
|
|
|
2
2
|
import configureStore from 'redux-mock-store';
|
|
3
3
|
import renderer from 'react-test-renderer';
|
|
4
4
|
|
|
5
|
-
import '@testing-library/jest-dom
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
6
|
import { Provider } from 'react-intl-redux';
|
|
7
7
|
import SourceDetails from '../components/Source';
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderer, { act } from 'react-test-renderer';
|
|
3
3
|
import { render, fireEvent, screen } from '@testing-library/react';
|
|
4
|
-
import '@testing-library/jest-dom
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
5
|
import { SourceChip } from '../components/SourceChip';
|
|
6
6
|
|
|
7
7
|
describe('SourceChip', () => {
|
|
@@ -3,7 +3,7 @@ import { MemoryRouter } from 'react-router-dom';
|
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import renderer from 'react-test-renderer';
|
|
5
5
|
import { render, fireEvent, screen } from '@testing-library/react';
|
|
6
|
-
import '@testing-library/jest-dom
|
|
6
|
+
import '@testing-library/jest-dom';
|
|
7
7
|
import { Provider } from 'react-intl-redux';
|
|
8
8
|
import UserActionsToolbar from '../components/UserActionsToolbar';
|
|
9
9
|
|
|
@@ -2,7 +2,7 @@ import { MemoryRouter } from 'react-router-dom';
|
|
|
2
2
|
import configureStore from 'redux-mock-store';
|
|
3
3
|
import renderer from 'react-test-renderer';
|
|
4
4
|
|
|
5
|
-
import '@testing-library/jest-dom
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
6
|
import { Provider } from 'react-intl-redux';
|
|
7
7
|
import { UserMessage } from '../chat/UserMessage';
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderer from 'react-test-renderer';
|
|
3
3
|
import { render, fireEvent, screen } from '@testing-library/react';
|
|
4
|
-
import '@testing-library/jest-dom
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
5
|
import { WebResultIcon } from '../components/WebResultIcon';
|
|
6
6
|
|
|
7
7
|
describe('WebResultIcon', () => {
|
package/src/middleware.js
CHANGED
|
@@ -240,9 +240,9 @@ export default async function middleware(req, res, next) {
|
|
|
240
240
|
|
|
241
241
|
const api_key = process.env.ONYX_API_KEY;
|
|
242
242
|
if (!api_key) {
|
|
243
|
-
res.
|
|
244
|
-
|
|
245
|
-
});
|
|
243
|
+
res.statusCode = 500;
|
|
244
|
+
res.statusMessage = MSG_INVALID_CONFIGURATION;
|
|
245
|
+
res.send({ error: MSG_INVALID_CONFIGURATION });
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
248
|
|
|
@@ -254,8 +254,10 @@ export default async function middleware(req, res, next) {
|
|
|
254
254
|
});
|
|
255
255
|
} catch (error) {
|
|
256
256
|
// eslint-disable-next-line
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
res.
|
|
257
|
+
const errorMessage = `Onyx error: ${error?.response?.text || 'error'}`;
|
|
258
|
+
console.error(MSG_ERROR_REQUEST, errorMessage);
|
|
259
|
+
res.statusCode = 500;
|
|
260
|
+
res.statusMessage = errorMessage;
|
|
261
|
+
res.send({ error: errorMessage });
|
|
260
262
|
}
|
|
261
263
|
}
|