@eeacms/volto-eea-chatbot 2.0.1 → 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 (80) hide show
  1. package/.eslintrc.js +6 -6
  2. package/CHANGELOG.md +2 -0
  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/packets/MultiToolRenderer.tsx +11 -12
  25. package/src/ChatBlock/packets/RendererComponent.tsx +6 -3
  26. package/src/ChatBlock/packets/renderers/CustomToolRenderer.tsx +3 -3
  27. package/src/ChatBlock/packets/renderers/FetchToolRenderer.tsx +3 -3
  28. package/src/ChatBlock/packets/renderers/ImageToolRenderer.tsx +3 -3
  29. package/src/ChatBlock/packets/renderers/MessageTextRenderer.tsx +8 -8
  30. package/src/ChatBlock/packets/renderers/ReasoningRenderer.tsx +5 -5
  31. package/src/ChatBlock/packets/renderers/SearchToolRenderer.tsx +10 -10
  32. package/src/ChatBlock/services/messageProcessor.ts +6 -3
  33. package/src/ChatBlock/services/packetUtils.ts +2 -2
  34. package/src/ChatBlock/services/streamingService.ts +8 -2
  35. package/src/ChatBlock/utils/citations.ts +1 -1
  36. package/src/halloumi/filtering.test.js +199 -1
  37. package/src/ChatBlock/tests/AIMessage.test.jsx +0 -95
  38. package/src/ChatBlock/tests/AutoResizeTextarea.test.jsx +0 -49
  39. package/src/ChatBlock/tests/BlinkingDot.test.jsx +0 -71
  40. package/src/ChatBlock/tests/ChatMessage.test.jsx +0 -75
  41. package/src/ChatBlock/tests/ChatMessageFeedback.test.jsx +0 -73
  42. package/src/ChatBlock/tests/Citation.test.jsx +0 -107
  43. package/src/ChatBlock/tests/ClaimModal.test.jsx +0 -136
  44. package/src/ChatBlock/tests/ClaimSegments.test.jsx +0 -206
  45. package/src/ChatBlock/tests/CustomToolRenderer.test.jsx +0 -241
  46. package/src/ChatBlock/tests/EmptyState.test.jsx +0 -137
  47. package/src/ChatBlock/tests/FeedbackModal.test.jsx +0 -138
  48. package/src/ChatBlock/tests/FetchToolRenderer.test.jsx +0 -161
  49. package/src/ChatBlock/tests/HalloumiFeedback.test.jsx +0 -94
  50. package/src/ChatBlock/tests/ImageToolRenderer.test.jsx +0 -178
  51. package/src/ChatBlock/tests/MessageTextRenderer.test.jsx +0 -227
  52. package/src/ChatBlock/tests/MultiToolRenderer.test.jsx +0 -134
  53. package/src/ChatBlock/tests/QualityCheckToggle.test.jsx +0 -105
  54. package/src/ChatBlock/tests/ReasoningRenderer.test.jsx +0 -163
  55. package/src/ChatBlock/tests/RelatedQuestions.test.jsx +0 -215
  56. package/src/ChatBlock/tests/RenderClaimView.test.jsx +0 -191
  57. package/src/ChatBlock/tests/RendererComponent.test.jsx +0 -139
  58. package/src/ChatBlock/tests/SearchToolRenderer.test.jsx +0 -295
  59. package/src/ChatBlock/tests/Source.test.jsx +0 -79
  60. package/src/ChatBlock/tests/SourceChip.test.jsx +0 -108
  61. package/src/ChatBlock/tests/Spinner.test.jsx +0 -18
  62. package/src/ChatBlock/tests/UserActionsToolbar.test.jsx +0 -135
  63. package/src/ChatBlock/tests/UserMessage.test.jsx +0 -83
  64. package/src/ChatBlock/tests/WebResultIcon.test.jsx +0 -61
  65. package/src/ChatBlock/tests/citations.test.js +0 -114
  66. package/src/ChatBlock/tests/index.test.js +0 -51
  67. package/src/ChatBlock/tests/messageProcessor.test.jsx +0 -438
  68. package/src/ChatBlock/tests/packetUtils.test.js +0 -158
  69. package/src/ChatBlock/tests/schema.test.js +0 -166
  70. package/src/ChatBlock/tests/streamingService.test.js +0 -467
  71. package/src/ChatBlock/tests/useChatController.test.jsx +0 -268
  72. package/src/ChatBlock/tests/useChatStreaming.test.jsx +0 -163
  73. package/src/ChatBlock/tests/useDeepCompareMemoize.test.js +0 -107
  74. package/src/ChatBlock/tests/useMarked.test.jsx +0 -107
  75. package/src/ChatBlock/tests/useQualityMarkers.test.jsx +0 -150
  76. package/src/ChatBlock/tests/useScrollonStream.test.jsx +0 -121
  77. package/src/ChatBlock/tests/useToolDisplayTiming.test.jsx +0 -151
  78. package/src/ChatBlock/tests/utils.test.jsx +0 -241
  79. package/src/ChatBlock/tests/withOnyxData.test.jsx +0 -81
  80. /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