@eeacms/volto-eea-chatbot 2.0.0 → 2.0.2

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.
Files changed (81) hide show
  1. package/.eslintrc.js +6 -6
  2. package/CHANGELOG.md +12 -1
  3. package/jest-addon.config.js +1 -0
  4. package/package.json +1 -1
  5. package/src/ChatBlock/ChatBlockEdit.jsx +2 -1
  6. package/src/ChatBlock/chat/AIMessage.tsx +20 -16
  7. package/src/ChatBlock/chat/ChatMessage.tsx +1 -1
  8. package/src/ChatBlock/chat/ChatWindow.tsx +10 -11
  9. package/src/ChatBlock/chat/UserMessage.tsx +4 -4
  10. package/src/ChatBlock/components/AutoResizeTextarea.jsx +1 -1
  11. package/src/ChatBlock/components/ChatMessageFeedback.jsx +2 -2
  12. package/src/ChatBlock/components/EmptyState.jsx +1 -1
  13. package/src/ChatBlock/components/FeedbackModal.jsx +1 -1
  14. package/src/ChatBlock/components/HalloumiFeedback.jsx +2 -2
  15. package/src/ChatBlock/components/Source.jsx +2 -2
  16. package/src/ChatBlock/components/UserActionsToolbar.jsx +3 -3
  17. package/src/ChatBlock/components/WebResultIcon.tsx +2 -2
  18. package/src/ChatBlock/components/markdown/ClaimModal.jsx +3 -3
  19. package/src/ChatBlock/components/markdown/ClaimSegments.jsx +4 -4
  20. package/src/ChatBlock/components/markdown/{index.js → index.jsx} +1 -1
  21. package/src/ChatBlock/hooks/useChatController.ts +7 -4
  22. package/src/ChatBlock/hooks/useChatStreaming.ts +4 -4
  23. package/src/ChatBlock/hooks/useToolDisplayTiming.ts +1 -1
  24. package/src/ChatBlock/index.js +8 -0
  25. package/src/ChatBlock/packets/MultiToolRenderer.tsx +11 -12
  26. package/src/ChatBlock/packets/RendererComponent.tsx +6 -3
  27. package/src/ChatBlock/packets/renderers/CustomToolRenderer.tsx +3 -3
  28. package/src/ChatBlock/packets/renderers/FetchToolRenderer.tsx +3 -3
  29. package/src/ChatBlock/packets/renderers/ImageToolRenderer.tsx +3 -3
  30. package/src/ChatBlock/packets/renderers/MessageTextRenderer.tsx +8 -8
  31. package/src/ChatBlock/packets/renderers/ReasoningRenderer.tsx +5 -5
  32. package/src/ChatBlock/packets/renderers/SearchToolRenderer.tsx +10 -10
  33. package/src/ChatBlock/services/messageProcessor.ts +6 -3
  34. package/src/ChatBlock/services/packetUtils.ts +2 -2
  35. package/src/ChatBlock/services/streamingService.ts +8 -2
  36. package/src/ChatBlock/utils/citations.ts +1 -1
  37. package/src/halloumi/filtering.test.js +199 -1
  38. package/src/ChatBlock/tests/AIMessage.test.jsx +0 -95
  39. package/src/ChatBlock/tests/AutoResizeTextarea.test.jsx +0 -49
  40. package/src/ChatBlock/tests/BlinkingDot.test.jsx +0 -71
  41. package/src/ChatBlock/tests/ChatMessage.test.jsx +0 -75
  42. package/src/ChatBlock/tests/ChatMessageFeedback.test.jsx +0 -73
  43. package/src/ChatBlock/tests/Citation.test.jsx +0 -107
  44. package/src/ChatBlock/tests/ClaimModal.test.jsx +0 -136
  45. package/src/ChatBlock/tests/ClaimSegments.test.jsx +0 -206
  46. package/src/ChatBlock/tests/CustomToolRenderer.test.jsx +0 -241
  47. package/src/ChatBlock/tests/EmptyState.test.jsx +0 -137
  48. package/src/ChatBlock/tests/FeedbackModal.test.jsx +0 -138
  49. package/src/ChatBlock/tests/FetchToolRenderer.test.jsx +0 -161
  50. package/src/ChatBlock/tests/HalloumiFeedback.test.jsx +0 -94
  51. package/src/ChatBlock/tests/ImageToolRenderer.test.jsx +0 -178
  52. package/src/ChatBlock/tests/MessageTextRenderer.test.jsx +0 -227
  53. package/src/ChatBlock/tests/MultiToolRenderer.test.jsx +0 -134
  54. package/src/ChatBlock/tests/QualityCheckToggle.test.jsx +0 -105
  55. package/src/ChatBlock/tests/ReasoningRenderer.test.jsx +0 -163
  56. package/src/ChatBlock/tests/RelatedQuestions.test.jsx +0 -215
  57. package/src/ChatBlock/tests/RenderClaimView.test.jsx +0 -191
  58. package/src/ChatBlock/tests/RendererComponent.test.jsx +0 -139
  59. package/src/ChatBlock/tests/SearchToolRenderer.test.jsx +0 -295
  60. package/src/ChatBlock/tests/Source.test.jsx +0 -79
  61. package/src/ChatBlock/tests/SourceChip.test.jsx +0 -108
  62. package/src/ChatBlock/tests/Spinner.test.jsx +0 -18
  63. package/src/ChatBlock/tests/UserActionsToolbar.test.jsx +0 -135
  64. package/src/ChatBlock/tests/UserMessage.test.jsx +0 -83
  65. package/src/ChatBlock/tests/WebResultIcon.test.jsx +0 -61
  66. package/src/ChatBlock/tests/citations.test.js +0 -114
  67. package/src/ChatBlock/tests/index.test.js +0 -51
  68. package/src/ChatBlock/tests/messageProcessor.test.jsx +0 -438
  69. package/src/ChatBlock/tests/packetUtils.test.js +0 -158
  70. package/src/ChatBlock/tests/schema.test.js +0 -166
  71. package/src/ChatBlock/tests/streamingService.test.js +0 -467
  72. package/src/ChatBlock/tests/useChatController.test.jsx +0 -268
  73. package/src/ChatBlock/tests/useChatStreaming.test.jsx +0 -163
  74. package/src/ChatBlock/tests/useDeepCompareMemoize.test.js +0 -107
  75. package/src/ChatBlock/tests/useMarked.test.jsx +0 -107
  76. package/src/ChatBlock/tests/useQualityMarkers.test.jsx +0 -150
  77. package/src/ChatBlock/tests/useScrollonStream.test.jsx +0 -121
  78. package/src/ChatBlock/tests/useToolDisplayTiming.test.jsx +0 -151
  79. package/src/ChatBlock/tests/utils.test.jsx +0 -241
  80. package/src/ChatBlock/tests/withOnyxData.test.jsx +0 -81
  81. /package/src/ChatBlock/{schema.js → schema.jsx} +0 -0
@@ -1,81 +0,0 @@
1
- import { render, screen, waitFor } from '@testing-library/react';
2
- import '@testing-library/jest-dom';
3
- import withOnyxData from '../hocs/withOnyxData';
4
-
5
- describe('withOnyxData', () => {
6
- it('shows loader initially', () => {
7
- const TestComponent = ({ data }) => <div>Data: {data}</div>;
8
- const callback = () => ['data', null, 'test'];
9
- const WrappedComponent = withOnyxData(callback)(TestComponent);
10
-
11
- render(<WrappedComponent />);
12
-
13
- // The Placeholder component should be rendered
14
- expect(screen.queryByText('Data:')).not.toBeInTheDocument();
15
- });
16
-
17
- it('renders component with fetched data', async () => {
18
- const TestComponent = ({ testData }) => <div>Data: {testData}</div>;
19
- const mockFetcher = Promise.resolve({ body: 'fetched value' });
20
- const callback = () => ['testData', mockFetcher, 'test-key'];
21
- const WrappedComponent = withOnyxData(callback)(TestComponent);
22
-
23
- render(<WrappedComponent />);
24
-
25
- await waitFor(() => {
26
- expect(screen.getByText('Data: fetched value')).toBeInTheDocument();
27
- });
28
- });
29
-
30
- it('passes original props to wrapped component', async () => {
31
- const TestComponent = ({ testData, originalProp }) => (
32
- <div>
33
- Data: {testData}, Original: {originalProp}
34
- </div>
35
- );
36
- const mockFetcher = Promise.resolve({ body: 'fetched value' });
37
- const callback = () => ['testData', mockFetcher, 'test-key'];
38
- const WrappedComponent = withOnyxData(callback)(TestComponent);
39
-
40
- render(<WrappedComponent originalProp="original value" />);
41
-
42
- await waitFor(() => {
43
- expect(
44
- screen.getByText('Data: fetched value, Original: original value'),
45
- ).toBeInTheDocument();
46
- });
47
- });
48
-
49
- it('handles null fetcher', async () => {
50
- const TestComponent = ({ data }) => <div>Data: {data || 'none'}</div>;
51
- const callback = () => ['data', null, 'test'];
52
- const WrappedComponent = withOnyxData(callback)(TestComponent);
53
-
54
- render(<WrappedComponent />);
55
-
56
- // Should stay in loading state
57
- await new Promise((resolve) => setTimeout(resolve, 100));
58
- expect(screen.queryByText('Data: none')).not.toBeInTheDocument();
59
- });
60
-
61
- it('refetches when depKey changes', async () => {
62
- const TestComponent = ({ testData }) => <div>Data: {testData}</div>;
63
- const callback = (props) => {
64
- const mockFetcher = Promise.resolve({ body: `value-${props.depKey}` });
65
- return ['testData', mockFetcher, props.depKey];
66
- };
67
- const WrappedComponent = withOnyxData(callback)(TestComponent);
68
-
69
- const { rerender } = render(<WrappedComponent depKey="key1" />);
70
-
71
- await waitFor(() => {
72
- expect(screen.getByText('Data: value-key1')).toBeInTheDocument();
73
- });
74
-
75
- rerender(<WrappedComponent depKey="key2" />);
76
-
77
- await waitFor(() => {
78
- expect(screen.getByText('Data: value-key2')).toBeInTheDocument();
79
- });
80
- });
81
- });
File without changes