@semiont/react-ui 0.2.45 → 0.3.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/dist/{PdfAnnotationCanvas.client-COQREPXU.mjs → PdfAnnotationCanvas.client-PVTVPDBQ.mjs} +3 -4
- package/dist/PdfAnnotationCanvas.client-PVTVPDBQ.mjs.map +1 -0
- package/dist/{ar-7SUXNE34.mjs → ar-APUOG2AP.mjs} +46 -6
- package/dist/ar-APUOG2AP.mjs.map +1 -0
- package/dist/{bn-XOET3DOI.mjs → bn-EFK2LJGK.mjs} +46 -6
- package/dist/bn-EFK2LJGK.mjs.map +1 -0
- package/dist/{chunk-JH7BXE2P.mjs → chunk-7DW2P4UE.mjs} +45 -5
- package/dist/chunk-7DW2P4UE.mjs.map +1 -0
- package/dist/{chunk-Q2KV6Y2J.mjs → chunk-7GEYABC6.mjs} +32 -32
- package/dist/{chunk-3JTO27MH.mjs → chunk-D4GAAQMM.mjs} +2 -9
- package/dist/{cs-X63DXX7L.mjs → cs-A26MEEQE.mjs} +46 -6
- package/dist/cs-A26MEEQE.mjs.map +1 -0
- package/dist/{da-OWTCV57A.mjs → da-U3L2FHSZ.mjs} +46 -6
- package/dist/da-U3L2FHSZ.mjs.map +1 -0
- package/dist/{de-77BMFDVF.mjs → de-Y5BHEBT7.mjs} +46 -6
- package/dist/de-Y5BHEBT7.mjs.map +1 -0
- package/dist/dist-YLEIY3JJ.mjs +547 -0
- package/dist/dist-YLEIY3JJ.mjs.map +1 -0
- package/dist/{el-FIBNLH2V.mjs → el-HU7LAWQY.mjs} +46 -6
- package/dist/el-HU7LAWQY.mjs.map +1 -0
- package/dist/{en-XWEPVTB4.mjs → en-HAKDCFKL.mjs} +5 -3
- package/dist/{es-726NTS53.mjs → es-4BN64QH5.mjs} +46 -6
- package/dist/es-4BN64QH5.mjs.map +1 -0
- package/dist/{fa-3N4CIWE6.mjs → fa-6ELTBARU.mjs} +46 -6
- package/dist/fa-6ELTBARU.mjs.map +1 -0
- package/dist/{fi-JOM3M7Z4.mjs → fi-DJ4WGIFW.mjs} +46 -6
- package/dist/fi-DJ4WGIFW.mjs.map +1 -0
- package/dist/{fr-56QSXS7E.mjs → fr-23XM6H6H.mjs} +46 -6
- package/dist/fr-23XM6H6H.mjs.map +1 -0
- package/dist/{he-SNAXPJEK.mjs → he-JSWJC2XU.mjs} +46 -6
- package/dist/he-JSWJC2XU.mjs.map +1 -0
- package/dist/{hi-CRBRD5TB.mjs → hi-BENHG3OJ.mjs} +46 -6
- package/dist/hi-BENHG3OJ.mjs.map +1 -0
- package/dist/{id-BRCVLICF.mjs → id-4HHQJQNF.mjs} +46 -6
- package/dist/id-4HHQJQNF.mjs.map +1 -0
- package/dist/index.css +108 -12
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +399 -147
- package/dist/index.mjs +3573 -2226
- package/dist/index.mjs.map +1 -1
- package/dist/{it-M2Z27BNB.mjs → it-U6I5PDKU.mjs} +46 -6
- package/dist/it-U6I5PDKU.mjs.map +1 -0
- package/dist/{ja-TZUKW7HD.mjs → ja-K3YBDWDP.mjs} +46 -6
- package/dist/ja-K3YBDWDP.mjs.map +1 -0
- package/dist/{ko-NKBGGOL6.mjs → ko-KC2HXRXG.mjs} +46 -6
- package/dist/ko-KC2HXRXG.mjs.map +1 -0
- package/dist/{magic-string.es-7FJ3LUGB.mjs → magic-string.es-K77I4ZQN.mjs} +2 -2
- package/dist/{ms-XFXPN6RX.mjs → ms-KY5QGBNN.mjs} +46 -6
- package/dist/ms-KY5QGBNN.mjs.map +1 -0
- package/dist/{nl-MVYXAS5C.mjs → nl-6PZFLGY2.mjs} +46 -6
- package/dist/nl-6PZFLGY2.mjs.map +1 -0
- package/dist/{no-XOLO4JPV.mjs → no-5QR7PLVJ.mjs} +46 -6
- package/dist/no-5QR7PLVJ.mjs.map +1 -0
- package/dist/{pl-TRWLMMC4.mjs → pl-4GV2NQXE.mjs} +46 -6
- package/dist/pl-4GV2NQXE.mjs.map +1 -0
- package/dist/{pt-M3TE24UI.mjs → pt-F3F5QD2P.mjs} +46 -6
- package/dist/pt-F3F5QD2P.mjs.map +1 -0
- package/dist/{ro-QBFG2T64.mjs → ro-TFYL2IQB.mjs} +46 -6
- package/dist/ro-TFYL2IQB.mjs.map +1 -0
- package/dist/{sv-IUECBXWX.mjs → sv-PRVF2QLR.mjs} +46 -6
- package/dist/sv-PRVF2QLR.mjs.map +1 -0
- package/dist/test-utils.mjs +16994 -22140
- package/dist/test-utils.mjs.map +1 -1
- package/dist/{th-US7KIN5Q.mjs → th-SUQOQFUZ.mjs} +46 -6
- package/dist/th-SUQOQFUZ.mjs.map +1 -0
- package/dist/{tr-DWJ2FFUK.mjs → tr-AYUJZOFJ.mjs} +46 -6
- package/dist/tr-AYUJZOFJ.mjs.map +1 -0
- package/dist/{uk-M4ZE4DPZ.mjs → uk-YY5WGLBM.mjs} +46 -6
- package/dist/uk-YY5WGLBM.mjs.map +1 -0
- package/dist/{vi-FERZNPSH.mjs → vi-6RO77ITD.mjs} +46 -6
- package/dist/{vi-FERZNPSH.mjs.map → vi-6RO77ITD.mjs.map} +1 -1
- package/dist/{zh-3J2I3WYK.mjs → zh-L6GA65H6.mjs} +46 -6
- package/dist/zh-L6GA65H6.mjs.map +1 -0
- package/package.json +18 -14
- package/src/components/Button/Button.tsx +23 -25
- package/src/components/annotation/AnnotateToolbar.tsx +1 -1
- package/src/components/annotation-popups/SharedPopupElements.tsx +5 -7
- package/src/components/image-annotation/SvgDrawingCanvas.tsx +3 -4
- package/src/components/modals/ConfigureGenerationStep.tsx +190 -0
- package/src/components/modals/ConfigureSearchStep.tsx +105 -0
- package/src/components/modals/ContextSummary.tsx +183 -0
- package/src/components/modals/GatherContextStep.tsx +89 -0
- package/src/components/modals/KeyboardShortcutsHelpModal.tsx +4 -6
- package/src/components/modals/ProposeEntitiesModal.tsx +4 -6
- package/src/components/modals/ReferenceWizardModal.tsx +326 -0
- package/src/components/modals/ResourceSearchModal.tsx +4 -6
- package/src/components/modals/SearchModal.css +43 -0
- package/src/components/modals/SearchModal.tsx +4 -6
- package/src/components/modals/SearchResultsStep.tsx +126 -0
- package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +3 -4
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +36 -14
- package/src/components/resource/AnnotateView.tsx +4 -4
- package/src/components/resource/AnnotationHistory.tsx +2 -2
- package/src/components/resource/BrowseView.tsx +4 -4
- package/src/components/resource/ResourceViewer.tsx +5 -8
- package/src/components/resource/__tests__/AnnotationHistory.test.tsx +16 -16
- package/src/components/resource/__tests__/BrowseView.test.tsx +2 -2
- package/src/components/resource/__tests__/HistoryEvent.test.tsx +1 -1
- package/src/components/resource/__tests__/ResourceViewer.mode-switch.test.tsx +1 -1
- package/src/components/resource/panels/AssessmentEntry.tsx +9 -11
- package/src/components/resource/panels/AssessmentPanel.tsx +1 -1
- package/src/components/resource/panels/CommentEntry.tsx +10 -12
- package/src/components/resource/panels/CommentsPanel.tsx +1 -1
- package/src/components/resource/panels/HighlightEntry.tsx +9 -11
- package/src/components/resource/panels/HighlightPanel.tsx +2 -2
- package/src/components/resource/panels/ReferenceEntry.tsx +57 -104
- package/src/components/resource/panels/ReferencesPanel.css +85 -13
- package/src/components/resource/panels/ReferencesPanel.tsx +2 -3
- package/src/components/resource/panels/TagEntry.tsx +9 -11
- package/src/components/resource/panels/TaggingPanel.tsx +1 -1
- package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +4 -4
- package/src/components/resource/panels/__tests__/AssistSection.test.tsx +7 -7
- package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +3 -3
- package/src/components/resource/panels/__tests__/HighlightPanel.annotationProgress.test.tsx +2 -2
- package/src/components/resource/panels/__tests__/ReferenceEntry.test.tsx +64 -101
- package/src/components/resource/panels/__tests__/StatisticsPanel.test.tsx +1 -1
- package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +7 -7
- package/src/components/viewers/ImageViewer.tsx +3 -6
- package/src/components/viewers/__tests__/ImageViewer.test.tsx +3 -3
- package/src/features/admin-devops/__tests__/AdminDevOpsPage.test.tsx +5 -5
- package/src/features/admin-exchange/__tests__/AdminExchangePage.test.tsx +141 -0
- package/src/features/admin-exchange/__tests__/ExportCard.test.tsx +41 -0
- package/src/features/admin-exchange/__tests__/ImportCard.test.tsx +148 -0
- package/src/features/admin-exchange/__tests__/ImportProgress.test.tsx +106 -0
- package/src/features/admin-exchange/components/AdminExchangePage.tsx +120 -0
- package/src/features/admin-exchange/components/ExportCard.tsx +35 -0
- package/src/features/admin-exchange/components/ImportCard.tsx +188 -0
- package/src/features/admin-exchange/components/ImportProgress.tsx +86 -0
- package/src/features/admin-security/__tests__/AdminSecurityPage.test.tsx +3 -3
- package/src/features/moderate-entity-tags/__tests__/EntityTagsPage.test.tsx +2 -2
- package/src/features/moderate-recent/__tests__/RecentDocumentsPage.test.tsx +4 -4
- package/src/features/moderate-tag-schemas/__tests__/TagSchemasPage.test.tsx +3 -3
- package/src/features/moderation-linked-data/__tests__/LinkedDataPage.test.tsx +117 -0
- package/src/features/moderation-linked-data/components/LinkedDataPage.tsx +121 -0
- package/src/features/resource-compose/__tests__/ResourceComposePage.test.tsx +5 -5
- package/src/features/resource-compose/components/ResourceComposePage.tsx +56 -1
- package/src/features/resource-discovery/__tests__/ResourceCard.test.tsx +1 -1
- package/src/features/resource-discovery/__tests__/ResourceDiscoveryPage.test.tsx +2 -2
- package/src/features/resource-viewer/__tests__/AnnotationCreationPending.test.tsx +14 -14
- package/src/features/resource-viewer/__tests__/AnnotationDeletionIntegration.test.tsx +12 -11
- package/src/features/resource-viewer/__tests__/AnnotationProgressDismissal.test.tsx +2 -2
- package/src/features/resource-viewer/__tests__/BindFlowIntegration.test.tsx +22 -115
- package/src/features/resource-viewer/__tests__/DetectionFlowBug.test.tsx +3 -3
- package/src/features/resource-viewer/__tests__/DetectionFlowIntegration.test.tsx +20 -20
- package/src/features/resource-viewer/__tests__/ResourceMutations.test.tsx +7 -7
- package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +43 -20
- package/src/features/resource-viewer/__tests__/ToastNotifications.test.tsx +2 -2
- package/src/features/resource-viewer/__tests__/YieldFlowIntegration.test.tsx +45 -82
- package/src/features/resource-viewer/__tests__/annotation-progress-flow.test.tsx +4 -4
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +151 -74
- package/src/integrations/tailwind-plugin.js +3 -3
- package/src/styles/core/buttons.css +31 -0
- package/src/styles/features/exchange.css +404 -0
- package/src/styles/index.css +1 -0
- package/translations/ar.json +42 -4
- package/translations/bn.json +42 -4
- package/translations/cs.json +42 -4
- package/translations/da.json +128 -90
- package/translations/de.json +122 -84
- package/translations/el.json +42 -4
- package/translations/en.json +42 -4
- package/translations/es.json +42 -4
- package/translations/fa.json +42 -4
- package/translations/fi.json +68 -30
- package/translations/fr.json +42 -4
- package/translations/he.json +42 -4
- package/translations/hi.json +42 -4
- package/translations/id.json +43 -5
- package/translations/it.json +62 -24
- package/translations/ja.json +43 -5
- package/translations/ko.json +42 -4
- package/translations/ms.json +43 -5
- package/translations/nl.json +41 -3
- package/translations/no.json +104 -66
- package/translations/pl.json +42 -4
- package/translations/pt.json +43 -5
- package/translations/ro.json +42 -4
- package/translations/sv.json +42 -4
- package/translations/th.json +42 -4
- package/translations/tr.json +42 -4
- package/translations/uk.json +42 -4
- package/translations/vi.json +42 -4
- package/translations/zh.json +42 -4
- package/dist/PdfAnnotationCanvas.client-COQREPXU.mjs.map +0 -1
- package/dist/ar-7SUXNE34.mjs.map +0 -1
- package/dist/bn-XOET3DOI.mjs.map +0 -1
- package/dist/chunk-JH7BXE2P.mjs.map +0 -1
- package/dist/cs-X63DXX7L.mjs.map +0 -1
- package/dist/da-OWTCV57A.mjs.map +0 -1
- package/dist/de-77BMFDVF.mjs.map +0 -1
- package/dist/el-FIBNLH2V.mjs.map +0 -1
- package/dist/es-726NTS53.mjs.map +0 -1
- package/dist/fa-3N4CIWE6.mjs.map +0 -1
- package/dist/fi-JOM3M7Z4.mjs.map +0 -1
- package/dist/fr-56QSXS7E.mjs.map +0 -1
- package/dist/he-SNAXPJEK.mjs.map +0 -1
- package/dist/hi-CRBRD5TB.mjs.map +0 -1
- package/dist/id-BRCVLICF.mjs.map +0 -1
- package/dist/it-M2Z27BNB.mjs.map +0 -1
- package/dist/ja-TZUKW7HD.mjs.map +0 -1
- package/dist/ko-NKBGGOL6.mjs.map +0 -1
- package/dist/ms-XFXPN6RX.mjs.map +0 -1
- package/dist/nl-MVYXAS5C.mjs.map +0 -1
- package/dist/no-XOLO4JPV.mjs.map +0 -1
- package/dist/pl-TRWLMMC4.mjs.map +0 -1
- package/dist/pt-M3TE24UI.mjs.map +0 -1
- package/dist/ro-QBFG2T64.mjs.map +0 -1
- package/dist/sv-IUECBXWX.mjs.map +0 -1
- package/dist/th-US7KIN5Q.mjs.map +0 -1
- package/dist/tr-DWJ2FFUK.mjs.map +0 -1
- package/dist/uk-M4ZE4DPZ.mjs.map +0 -1
- package/dist/zh-3J2I3WYK.mjs.map +0 -1
- package/src/examples/ButtonUsageExample.tsx +0 -242
- package/src/examples/button-css-modules.module.css +0 -164
- package/src/examples/button-styled-components.tsx +0 -215
- package/src/examples/button-tailwind.css +0 -51
- /package/dist/{chunk-Q2KV6Y2J.mjs.map → chunk-7GEYABC6.mjs.map} +0 -0
- /package/dist/{chunk-3JTO27MH.mjs.map → chunk-D4GAAQMM.mjs.map} +0 -0
- /package/dist/{en-XWEPVTB4.mjs.map → en-HAKDCFKL.mjs.map} +0 -0
- /package/dist/{magic-string.es-7FJ3LUGB.mjs.map → magic-string.es-K77I4ZQN.mjs.map} +0 -0
|
@@ -19,7 +19,7 @@ import { render, waitFor, act } from '@testing-library/react';
|
|
|
19
19
|
import { EventBusProvider, resetEventBusForTesting, useEventBus } from '../../../contexts/EventBusContext';
|
|
20
20
|
import { ApiClientProvider } from '../../../contexts/ApiClientContext';
|
|
21
21
|
import { AuthTokenProvider } from '../../../contexts/AuthTokenContext';
|
|
22
|
-
import {
|
|
22
|
+
import { resourceId } from '@semiont/core';
|
|
23
23
|
import { useMarkFlow } from '../../../hooks/useMarkFlow';
|
|
24
24
|
import { useYieldFlow } from '../../../hooks/useYieldFlow';
|
|
25
25
|
|
|
@@ -38,7 +38,7 @@ vi.mock('../../../components/Toast', () => ({
|
|
|
38
38
|
|
|
39
39
|
describe('Toast Notifications - Verifies Toast Integration', () => {
|
|
40
40
|
let eventBusInstance: any;
|
|
41
|
-
const rUri =
|
|
41
|
+
const rUri = resourceId('test');
|
|
42
42
|
|
|
43
43
|
beforeEach(() => {
|
|
44
44
|
resetEventBusForTesting();
|
|
@@ -27,8 +27,8 @@ import { ApiClientProvider } from '../../../contexts/ApiClientContext';
|
|
|
27
27
|
import { AuthTokenProvider } from '../../../contexts/AuthTokenContext';
|
|
28
28
|
import { useBindFlow } from '../../../hooks/useBindFlow';
|
|
29
29
|
import { SSEClient } from '@semiont/api-client';
|
|
30
|
-
import type {
|
|
31
|
-
import {
|
|
30
|
+
import type { AnnotationId, ResourceId } from '@semiont/core';
|
|
31
|
+
import { resourceId, annotationId } from '@semiont/core';
|
|
32
32
|
import type { Emitter } from 'mitt';
|
|
33
33
|
import type { EventMap } from '@semiont/core';
|
|
34
34
|
|
|
@@ -76,38 +76,17 @@ describe('Generation Flow - Feature Integration', () => {
|
|
|
76
76
|
vi.restoreAllMocks();
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
it('should open modal when yield:modal-open event is emitted', async () => {
|
|
80
|
-
const testResourceUri = resourceUri('http://localhost:4000/resources/test-resource');
|
|
81
|
-
const testAnnotationUri = annotationUri('http://localhost:4000/resources/test-resource/annotations/test-annotation');
|
|
82
|
-
|
|
83
|
-
const { emitModalOpen } = renderYieldFlow(
|
|
84
|
-
testResourceUri
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
// Emit modal open event
|
|
88
|
-
act(() => {
|
|
89
|
-
emitModalOpen(testAnnotationUri, testResourceUri, 'Test Reference');
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// Verify modal state updated
|
|
93
|
-
await waitFor(() => {
|
|
94
|
-
expect(screen.getByTestId('modal-open')).toHaveTextContent('true');
|
|
95
|
-
expect(screen.getByTestId('reference-id')).toHaveTextContent(testAnnotationUri);
|
|
96
|
-
expect(screen.getByTestId('default-title')).toHaveTextContent('Test Reference');
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
|
|
100
79
|
it('should call yieldResourceFromAnnotation exactly ONCE when generation starts', async () => {
|
|
101
|
-
const
|
|
102
|
-
const
|
|
80
|
+
const testResourceId = resourceId('test-resource');
|
|
81
|
+
const testAnnotationId = annotationId('test-annotation');
|
|
103
82
|
|
|
104
83
|
const { emitGenerationStart, getEventBus } = renderYieldFlow(
|
|
105
|
-
|
|
84
|
+
testResourceId
|
|
106
85
|
);
|
|
107
86
|
|
|
108
87
|
// Trigger generation with full options
|
|
109
88
|
act(() => {
|
|
110
|
-
emitGenerationStart(
|
|
89
|
+
emitGenerationStart(testAnnotationId, testResourceId, {
|
|
111
90
|
title: 'Generated Document',
|
|
112
91
|
prompt: 'Create a comprehensive document',
|
|
113
92
|
language: 'en',
|
|
@@ -125,10 +104,10 @@ describe('Generation Flow - Feature Integration', () => {
|
|
|
125
104
|
expect(generateResourceSpy).toHaveBeenCalledTimes(1);
|
|
126
105
|
});
|
|
127
106
|
|
|
128
|
-
// Verify correct parameters
|
|
107
|
+
// Verify correct parameters — resourceId and annotationId are now bare IDs
|
|
129
108
|
expect(generateResourceSpy).toHaveBeenCalledWith(
|
|
130
|
-
|
|
131
|
-
|
|
109
|
+
testResourceId,
|
|
110
|
+
testAnnotationId,
|
|
132
111
|
{
|
|
133
112
|
title: 'Generated Document',
|
|
134
113
|
prompt: 'Create a comprehensive document',
|
|
@@ -145,16 +124,16 @@ describe('Generation Flow - Feature Integration', () => {
|
|
|
145
124
|
});
|
|
146
125
|
|
|
147
126
|
it('should propagate SSE progress events to useYieldProgress state', async () => {
|
|
148
|
-
const
|
|
149
|
-
const
|
|
127
|
+
const testResourceId = resourceId('test-resource');
|
|
128
|
+
const testAnnotationId = annotationId('test-annotation');
|
|
150
129
|
|
|
151
130
|
const { emitGenerationStart, getEventBus } = renderYieldFlow(
|
|
152
|
-
|
|
131
|
+
testResourceId
|
|
153
132
|
);
|
|
154
133
|
|
|
155
134
|
// Start generation
|
|
156
135
|
act(() => {
|
|
157
|
-
emitGenerationStart(
|
|
136
|
+
emitGenerationStart(testAnnotationId, testResourceId, {
|
|
158
137
|
title: 'Test Doc',
|
|
159
138
|
context: { sourceText: 'test' },
|
|
160
139
|
});
|
|
@@ -182,16 +161,16 @@ describe('Generation Flow - Feature Integration', () => {
|
|
|
182
161
|
});
|
|
183
162
|
|
|
184
163
|
it('should handle multiple progress updates correctly', async () => {
|
|
185
|
-
const
|
|
186
|
-
const
|
|
164
|
+
const testResourceId = resourceId('test-resource');
|
|
165
|
+
const testAnnotationId = annotationId('test-annotation');
|
|
187
166
|
|
|
188
167
|
const { emitGenerationStart, getEventBus } = renderYieldFlow(
|
|
189
|
-
|
|
168
|
+
testResourceId
|
|
190
169
|
);
|
|
191
170
|
|
|
192
171
|
// Start generation
|
|
193
172
|
act(() => {
|
|
194
|
-
emitGenerationStart(
|
|
173
|
+
emitGenerationStart(testAnnotationId, testResourceId, {
|
|
195
174
|
title: 'Test',
|
|
196
175
|
context: { sourceText: 'test' },
|
|
197
176
|
});
|
|
@@ -231,7 +210,7 @@ describe('Generation Flow - Feature Integration', () => {
|
|
|
231
210
|
act(() => {
|
|
232
211
|
getEventBus().get('yield:finished').next({
|
|
233
212
|
status: 'complete',
|
|
234
|
-
referenceId:
|
|
213
|
+
referenceId: testAnnotationId,
|
|
235
214
|
message: 'Document created successfully',
|
|
236
215
|
percentage: 100,
|
|
237
216
|
resourceName: 'Generated Document',
|
|
@@ -245,16 +224,16 @@ describe('Generation Flow - Feature Integration', () => {
|
|
|
245
224
|
});
|
|
246
225
|
|
|
247
226
|
it('should show success toast on generation complete', async () => {
|
|
248
|
-
const
|
|
249
|
-
const
|
|
227
|
+
const testResourceId = resourceId('test-resource');
|
|
228
|
+
const testAnnotationId = annotationId('test-annotation');
|
|
250
229
|
|
|
251
230
|
const { emitGenerationStart, getEventBus } = renderYieldFlow(
|
|
252
|
-
|
|
231
|
+
testResourceId
|
|
253
232
|
);
|
|
254
233
|
|
|
255
234
|
// Start generation
|
|
256
235
|
act(() => {
|
|
257
|
-
emitGenerationStart(
|
|
236
|
+
emitGenerationStart(testAnnotationId, testResourceId, {
|
|
258
237
|
title: 'Test',
|
|
259
238
|
context: { sourceText: 'test' },
|
|
260
239
|
});
|
|
@@ -277,7 +256,7 @@ describe('Generation Flow - Feature Integration', () => {
|
|
|
277
256
|
act(() => {
|
|
278
257
|
getEventBus().get('yield:finished').next({
|
|
279
258
|
status: 'complete',
|
|
280
|
-
referenceId:
|
|
259
|
+
referenceId: testAnnotationId,
|
|
281
260
|
resourceName: 'Generated Document',
|
|
282
261
|
percentage: 100,
|
|
283
262
|
});
|
|
@@ -288,16 +267,16 @@ describe('Generation Flow - Feature Integration', () => {
|
|
|
288
267
|
});
|
|
289
268
|
|
|
290
269
|
it('should clear progress on generation failure', async () => {
|
|
291
|
-
const
|
|
292
|
-
const
|
|
270
|
+
const testResourceId = resourceId('test-resource');
|
|
271
|
+
const testAnnotationId = annotationId('test-annotation');
|
|
293
272
|
|
|
294
273
|
const { emitGenerationStart, getEventBus } = renderYieldFlow(
|
|
295
|
-
|
|
274
|
+
testResourceId
|
|
296
275
|
);
|
|
297
276
|
|
|
298
277
|
// Start generation
|
|
299
278
|
act(() => {
|
|
300
|
-
emitGenerationStart(
|
|
279
|
+
emitGenerationStart(testAnnotationId, testResourceId, {
|
|
301
280
|
title: 'Test',
|
|
302
281
|
context: { sourceText: 'test' },
|
|
303
282
|
});
|
|
@@ -328,11 +307,11 @@ describe('Generation Flow - Feature Integration', () => {
|
|
|
328
307
|
});
|
|
329
308
|
|
|
330
309
|
it('should only call API once even with multiple event listeners', async () => {
|
|
331
|
-
const
|
|
332
|
-
const
|
|
310
|
+
const testResourceId = resourceId('test-resource');
|
|
311
|
+
const testAnnotationId = annotationId('test-annotation');
|
|
333
312
|
|
|
334
313
|
const { emitGenerationStart, getEventBus } = renderYieldFlow(
|
|
335
|
-
|
|
314
|
+
testResourceId
|
|
336
315
|
);
|
|
337
316
|
|
|
338
317
|
// Add an additional event listener (simulating multiple subscribers)
|
|
@@ -341,7 +320,7 @@ describe('Generation Flow - Feature Integration', () => {
|
|
|
341
320
|
|
|
342
321
|
// Trigger generation
|
|
343
322
|
act(() => {
|
|
344
|
-
emitGenerationStart(
|
|
323
|
+
emitGenerationStart(testAnnotationId, testResourceId, {
|
|
345
324
|
title: 'Test',
|
|
346
325
|
context: { sourceText: 'test' },
|
|
347
326
|
});
|
|
@@ -362,16 +341,16 @@ describe('Generation Flow - Feature Integration', () => {
|
|
|
362
341
|
});
|
|
363
342
|
|
|
364
343
|
it('should forward final chunk as progress before emitting complete', async () => {
|
|
365
|
-
const
|
|
366
|
-
const
|
|
344
|
+
const testResourceId = resourceId('test-resource');
|
|
345
|
+
const testAnnotationId = annotationId('test-annotation');
|
|
367
346
|
|
|
368
347
|
const { emitGenerationStart, getEventBus } = renderYieldFlow(
|
|
369
|
-
|
|
348
|
+
testResourceId
|
|
370
349
|
);
|
|
371
350
|
|
|
372
351
|
// Start generation
|
|
373
352
|
act(() => {
|
|
374
|
-
emitGenerationStart(
|
|
353
|
+
emitGenerationStart(testAnnotationId, testResourceId, {
|
|
375
354
|
title: 'Test',
|
|
376
355
|
context: { sourceText: 'test' },
|
|
377
356
|
});
|
|
@@ -385,7 +364,7 @@ describe('Generation Flow - Feature Integration', () => {
|
|
|
385
364
|
act(() => {
|
|
386
365
|
getEventBus().get('yield:finished').next({
|
|
387
366
|
status: 'complete',
|
|
388
|
-
referenceId:
|
|
367
|
+
referenceId: testAnnotationId,
|
|
389
368
|
message: 'Document created: My Document',
|
|
390
369
|
resourceName: 'My Document',
|
|
391
370
|
percentage: 100,
|
|
@@ -405,7 +384,7 @@ describe('Generation Flow - Feature Integration', () => {
|
|
|
405
384
|
* Returns methods to interact with the rendered component
|
|
406
385
|
*/
|
|
407
386
|
function renderYieldFlow(
|
|
408
|
-
|
|
387
|
+
testResourceId: ResourceId
|
|
409
388
|
) {
|
|
410
389
|
let eventBusInstance: Emitter<EventMap>;
|
|
411
390
|
|
|
@@ -414,7 +393,7 @@ function renderYieldFlow(
|
|
|
414
393
|
eventBusInstance = useEventBus();
|
|
415
394
|
|
|
416
395
|
// Set up resolution flow (resolve:update-body, resolve:link)
|
|
417
|
-
useBindFlow(
|
|
396
|
+
useBindFlow(testResourceId);
|
|
418
397
|
|
|
419
398
|
return null;
|
|
420
399
|
}
|
|
@@ -422,23 +401,18 @@ function renderYieldFlow(
|
|
|
422
401
|
// Test harness component that uses the hook
|
|
423
402
|
function YieldFlowTestHarness() {
|
|
424
403
|
const {
|
|
404
|
+
isGenerating,
|
|
425
405
|
generationProgress,
|
|
426
|
-
generationModalOpen,
|
|
427
|
-
generationReferenceId,
|
|
428
|
-
generationDefaultTitle,
|
|
429
406
|
} = useYieldFlow(
|
|
430
407
|
'en',
|
|
431
|
-
|
|
408
|
+
testResourceId,
|
|
432
409
|
vi.fn()
|
|
433
410
|
);
|
|
434
411
|
|
|
435
412
|
return (
|
|
436
413
|
<div>
|
|
437
|
-
<div data-testid="modal-open">{generationModalOpen ? 'true' : 'false'}</div>
|
|
438
|
-
<div data-testid="reference-id">{generationReferenceId || 'none'}</div>
|
|
439
|
-
<div data-testid="default-title">{generationDefaultTitle || 'none'}</div>
|
|
440
414
|
<div data-testid="is-generating">
|
|
441
|
-
{
|
|
415
|
+
{isGenerating ? 'true' : 'false'}
|
|
442
416
|
</div>
|
|
443
417
|
<div data-testid="progress">
|
|
444
418
|
{generationProgress?.message || 'No progress'}
|
|
@@ -459,20 +433,9 @@ function renderYieldFlow(
|
|
|
459
433
|
);
|
|
460
434
|
|
|
461
435
|
return {
|
|
462
|
-
emitModalOpen: (
|
|
463
|
-
annotationUri: AnnotationUri,
|
|
464
|
-
resourceUri: ResourceUri,
|
|
465
|
-
defaultTitle: string
|
|
466
|
-
) => {
|
|
467
|
-
eventBusInstance.get('yield:modal-open').next({
|
|
468
|
-
annotationUri,
|
|
469
|
-
resourceUri,
|
|
470
|
-
defaultTitle,
|
|
471
|
-
});
|
|
472
|
-
},
|
|
473
436
|
emitGenerationStart: (
|
|
474
|
-
|
|
475
|
-
|
|
437
|
+
aId: AnnotationId,
|
|
438
|
+
rId: ResourceId,
|
|
476
439
|
options: {
|
|
477
440
|
title: string;
|
|
478
441
|
prompt?: string;
|
|
@@ -483,8 +446,8 @@ function renderYieldFlow(
|
|
|
483
446
|
}
|
|
484
447
|
) => {
|
|
485
448
|
eventBusInstance.get('yield:request').next({
|
|
486
|
-
|
|
487
|
-
|
|
449
|
+
annotationId: aId,
|
|
450
|
+
resourceId: rId,
|
|
488
451
|
options,
|
|
489
452
|
});
|
|
490
453
|
},
|
|
@@ -180,7 +180,7 @@ describe('Detection Progress Flow Integration (Layer 3)', () => {
|
|
|
180
180
|
expect(screen.queryByText(/Analyzing/)).not.toBeInTheDocument();
|
|
181
181
|
|
|
182
182
|
// Click annotate button
|
|
183
|
-
const annotateButton = screen.getByRole('button', { name:
|
|
183
|
+
const annotateButton = screen.getByRole('button', { name: /✨\s*Annotate/ });
|
|
184
184
|
await user.click(annotateButton);
|
|
185
185
|
|
|
186
186
|
// Simulate SSE progress chunk #1: Starting
|
|
@@ -244,7 +244,7 @@ describe('Detection Progress Flow Integration (Layer 3)', () => {
|
|
|
244
244
|
renderDetectionFlow();
|
|
245
245
|
|
|
246
246
|
// Click annotate button
|
|
247
|
-
const annotateButton = screen.getByRole('button', { name:
|
|
247
|
+
const annotateButton = screen.getByRole('button', { name: /✨\s*Annotate/ });
|
|
248
248
|
await user.click(annotateButton);
|
|
249
249
|
|
|
250
250
|
// Simulate initial progress
|
|
@@ -284,7 +284,7 @@ describe('Detection Progress Flow Integration (Layer 3)', () => {
|
|
|
284
284
|
|
|
285
285
|
renderDetectionFlow();
|
|
286
286
|
|
|
287
|
-
const annotateButton = screen.getByRole('button', { name:
|
|
287
|
+
const annotateButton = screen.getByRole('button', { name: /✨\s*Annotate/ });
|
|
288
288
|
await user.click(annotateButton);
|
|
289
289
|
|
|
290
290
|
// Simulate progress with request parameters
|
|
@@ -310,7 +310,7 @@ describe('Detection Progress Flow Integration (Layer 3)', () => {
|
|
|
310
310
|
|
|
311
311
|
renderDetectionFlow();
|
|
312
312
|
|
|
313
|
-
const annotateButton = screen.getByRole('button', { name:
|
|
313
|
+
const annotateButton = screen.getByRole('button', { name: /✨\s*Annotate/ });
|
|
314
314
|
await user.click(annotateButton);
|
|
315
315
|
|
|
316
316
|
// Show progress
|