box-ui-elements 23.4.0-beta.31 → 23.4.0-beta.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/dist/explorer.js +1 -1
- package/dist/openwith.js +1 -1
- package/dist/picker.js +1 -1
- package/dist/preview.js +1 -1
- package/dist/sharing.js +1 -1
- package/dist/sidebar.js +1 -1
- package/dist/uploader.js +1 -1
- package/es/common/types/metadata.js.flow +6 -0
- package/es/common/types/metadata.js.map +1 -1
- package/es/features/metadata-instance-editor/CascadePolicy.js +40 -20
- package/es/features/metadata-instance-editor/CascadePolicy.js.flow +52 -24
- package/es/features/metadata-instance-editor/CascadePolicy.js.map +1 -1
- package/es/features/metadata-instance-editor/Instance.js +24 -2
- package/es/features/metadata-instance-editor/Instance.js.flow +31 -1
- package/es/features/metadata-instance-editor/Instance.js.map +1 -1
- package/es/features/metadata-instance-editor/constants.js +4 -1
- package/es/features/metadata-instance-editor/constants.js.flow +10 -1
- package/es/features/metadata-instance-editor/constants.js.map +1 -1
- package/es/features/metadata-instance-editor/messages.js +8 -0
- package/es/features/metadata-instance-editor/messages.js.flow +10 -0
- package/es/features/metadata-instance-editor/messages.js.map +1 -1
- package/i18n/bn-IN.js +2 -0
- package/i18n/da-DK.js +2 -0
- package/i18n/de-DE.js +2 -0
- package/i18n/en-AU.js +2 -0
- package/i18n/en-CA.js +2 -0
- package/i18n/en-GB.js +2 -0
- package/i18n/en-US.js +2 -0
- package/i18n/en-US.properties +4 -0
- package/i18n/en-x-pseudo.js +2 -0
- package/i18n/es-419.js +2 -0
- package/i18n/es-ES.js +2 -0
- package/i18n/fi-FI.js +2 -0
- package/i18n/fr-CA.js +2 -0
- package/i18n/fr-FR.js +2 -0
- package/i18n/hi-IN.js +2 -0
- package/i18n/it-IT.js +2 -0
- package/i18n/ja-JP.js +2 -0
- package/i18n/ko-KR.js +2 -0
- package/i18n/nb-NO.js +2 -0
- package/i18n/nl-NL.js +2 -0
- package/i18n/pl-PL.js +2 -0
- package/i18n/pt-BR.js +2 -0
- package/i18n/ru-RU.js +2 -0
- package/i18n/sv-SE.js +2 -0
- package/i18n/tr-TR.js +2 -0
- package/i18n/zh-CN.js +2 -0
- package/i18n/zh-TW.js +2 -0
- package/package.json +3 -3
- package/src/common/types/metadata.js +6 -0
- package/src/features/metadata-instance-editor/CascadePolicy.js +52 -24
- package/src/features/metadata-instance-editor/Instance.js +31 -1
- package/src/features/metadata-instance-editor/__tests__/CascadePolicy.test.js +50 -3
- package/src/features/metadata-instance-editor/__tests__/Instance.test.js +20 -2
- package/src/features/metadata-instance-editor/__tests__/Instances.test.js +15 -10
- package/src/features/metadata-instance-editor/__tests__/MetadataInstanceEditor.test.js +53 -10
- package/src/features/metadata-instance-editor/__tests__/__snapshots__/Instance.test.js.snap +1 -0
- package/src/features/metadata-instance-editor/constants.js +10 -1
- package/src/features/metadata-instance-editor/messages.js +10 -0
|
@@ -863,12 +863,30 @@ describe('Instance Component - React Testing Library', () => {
|
|
|
863
863
|
|
|
864
864
|
describe('Props passed to CascadePolicy', () => {
|
|
865
865
|
test('should pass canUseAIFolderExtractionAgentSelector to CascadePolicy', async () => {
|
|
866
|
-
render(
|
|
866
|
+
render(
|
|
867
|
+
<Instance
|
|
868
|
+
{...getBaseProps({
|
|
869
|
+
canUseAIFolderExtractionAgentSelector: true,
|
|
870
|
+
cascadePolicy: {
|
|
871
|
+
id: 'policy-1',
|
|
872
|
+
canEdit: true,
|
|
873
|
+
isEnabled: true,
|
|
874
|
+
cascadePolicyType: CASCADE_POLICY_TYPE_AI_EXTRACT,
|
|
875
|
+
},
|
|
876
|
+
})}
|
|
877
|
+
/>,
|
|
878
|
+
);
|
|
867
879
|
|
|
868
880
|
const editButton = screen.queryByRole('button', { name: 'Edit Metadata' });
|
|
869
881
|
if (editButton) await userEvent.click(editButton); // Enter edit mode to ensure CascadePolicy options are visible
|
|
870
882
|
|
|
871
|
-
|
|
883
|
+
const cascadeToggle = screen.getByRole('switch', { name: 'Enable Cascade Policy' });
|
|
884
|
+
expect(cascadeToggle).toBeChecked();
|
|
885
|
+
|
|
886
|
+
const aiToggle = screen.getByRole('switch', { name: 'Box AI Autofill' });
|
|
887
|
+
expect(aiToggle).toBeChecked();
|
|
888
|
+
|
|
889
|
+
expect(screen.getByRole('combobox', { name: 'Standard' })).toBeInTheDocument();
|
|
872
890
|
});
|
|
873
891
|
|
|
874
892
|
test('should disable CascadePolicy options when a cascade already exists', async () => {
|
|
@@ -3,6 +3,7 @@ import userEvent from '@testing-library/user-event';
|
|
|
3
3
|
import { render, screen } from '../../../test-utils/testing-library';
|
|
4
4
|
|
|
5
5
|
import Instances from '../Instances';
|
|
6
|
+
import { CASCADE_POLICY_TYPE_AI_EXTRACT } from '../constants';
|
|
6
7
|
|
|
7
8
|
// Templates
|
|
8
9
|
|
|
@@ -254,18 +255,22 @@ describe('features/metadata-editor-editor/Instances', () => {
|
|
|
254
255
|
|
|
255
256
|
describe('Instances component - canUseAIFolderExtractionAgentSelector prop', () => {
|
|
256
257
|
test('should pass canUseAIFolderExtractionAgentSelector to child Instance components, showing agent selector', async () => {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
/>,
|
|
263
|
-
);
|
|
258
|
+
const props = getInstancesBaseProps({
|
|
259
|
+
canUseAIFolderExtractionAgentSelector: true,
|
|
260
|
+
});
|
|
261
|
+
props.editors[0].instance.cascadePolicy.cascadePolicyType = CASCADE_POLICY_TYPE_AI_EXTRACT;
|
|
262
|
+
render(<Instances {...props} />);
|
|
264
263
|
|
|
265
264
|
const editButton = screen.getByRole('button', { name: 'Edit Metadata' });
|
|
266
265
|
await userEvent.click(editButton);
|
|
267
266
|
|
|
268
|
-
|
|
267
|
+
const cascadeToggle = screen.getByRole('switch', { name: 'Enable Cascade Policy' });
|
|
268
|
+
expect(cascadeToggle).toBeChecked();
|
|
269
|
+
|
|
270
|
+
const aiToggle = screen.getByRole('switch', { name: 'Box AI Autofill' });
|
|
271
|
+
expect(aiToggle).toBeChecked();
|
|
272
|
+
|
|
273
|
+
expect(screen.getByRole('combobox', { name: 'Standard' })).toBeInTheDocument();
|
|
269
274
|
});
|
|
270
275
|
|
|
271
276
|
test('should not show agent selector in child Instance if canUseAIFolderExtractionAgentSelector is false', async () => {
|
|
@@ -280,7 +285,7 @@ describe('Instances component - canUseAIFolderExtractionAgentSelector prop', ()
|
|
|
280
285
|
const editButton = screen.getByRole('button', { name: 'Edit Metadata' });
|
|
281
286
|
await userEvent.click(editButton);
|
|
282
287
|
|
|
283
|
-
expect(screen.queryByRole('combobox', { name: '
|
|
288
|
+
expect(screen.queryByRole('combobox', { name: 'Standard' })).not.toBeInTheDocument();
|
|
284
289
|
});
|
|
285
290
|
|
|
286
291
|
test('should not show agent selector in child Instance if canUseAIFolderExtractionAgentSelector is undefined', async () => {
|
|
@@ -291,6 +296,6 @@ describe('Instances component - canUseAIFolderExtractionAgentSelector prop', ()
|
|
|
291
296
|
const editButton = screen.getByRole('button', { name: 'Edit Metadata' });
|
|
292
297
|
await userEvent.click(editButton);
|
|
293
298
|
|
|
294
|
-
expect(screen.queryByRole('combobox', { name: '
|
|
299
|
+
expect(screen.queryByRole('combobox', { name: 'Standard' })).not.toBeInTheDocument();
|
|
295
300
|
});
|
|
296
301
|
});
|
|
@@ -536,18 +536,23 @@ describe('features/metadata-editor-editor/MetadataInstanceEditor', () => {
|
|
|
536
536
|
|
|
537
537
|
describe('MetadataInstanceEditor - canUseAIFolderExtractionAgentSelector prop', () => {
|
|
538
538
|
test('should propagate canUseAIFolderExtractionAgentSelector, showing agent selector', async () => {
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
);
|
|
539
|
+
const props = getMetadataEditorBaseProps({
|
|
540
|
+
canUseAIFolderExtraction: true,
|
|
541
|
+
canUseAIFolderExtractionAgentSelector: true,
|
|
542
|
+
});
|
|
543
|
+
props.editors[0].instance.cascadePolicy.cascadePolicyType = 'ai_extract';
|
|
544
|
+
render(<MetadataInstanceEditor {...props} />);
|
|
546
545
|
|
|
547
546
|
const editButton = await screen.findByRole('button', { name: 'Edit Metadata' }, { timeout: 3000 });
|
|
548
547
|
await userEvent.click(editButton);
|
|
549
548
|
|
|
550
|
-
|
|
549
|
+
const cascadeToggle = screen.getByRole('switch', { name: 'Enable Cascade Policy' });
|
|
550
|
+
expect(cascadeToggle).toBeChecked();
|
|
551
|
+
|
|
552
|
+
const aiToggle = screen.getByRole('switch', { name: 'Box AI Autofill' });
|
|
553
|
+
expect(aiToggle).toBeChecked();
|
|
554
|
+
|
|
555
|
+
expect(screen.getByRole('combobox', { name: 'Standard' })).toBeInTheDocument();
|
|
551
556
|
});
|
|
552
557
|
|
|
553
558
|
test('should not show agent selector if canUseAIFolderExtractionAgentSelector is false', async () => {
|
|
@@ -562,7 +567,7 @@ describe('MetadataInstanceEditor - canUseAIFolderExtractionAgentSelector prop',
|
|
|
562
567
|
const editButton = await screen.findByRole('button', { name: 'Edit Metadata' });
|
|
563
568
|
await userEvent.click(editButton);
|
|
564
569
|
|
|
565
|
-
expect(screen.queryByRole('combobox', { name: '
|
|
570
|
+
expect(screen.queryByRole('combobox', { name: 'Standard' })).not.toBeInTheDocument();
|
|
566
571
|
});
|
|
567
572
|
|
|
568
573
|
test('should not show agent selector if canUseAIFolderExtractionAgentSelector is undefined', async () => {
|
|
@@ -573,6 +578,44 @@ describe('MetadataInstanceEditor - canUseAIFolderExtractionAgentSelector prop',
|
|
|
573
578
|
const editButton = await screen.findByRole('button', { name: 'Edit Metadata' });
|
|
574
579
|
await userEvent.click(editButton);
|
|
575
580
|
|
|
576
|
-
expect(screen.queryByRole('combobox', { name: '
|
|
581
|
+
expect(screen.queryByRole('combobox', { name: 'Standard' })).not.toBeInTheDocument();
|
|
577
582
|
});
|
|
583
|
+
|
|
584
|
+
test('should show "Enhanced" in the combobox when the second option is selected', async () => {
|
|
585
|
+
const props = getMetadataEditorBaseProps({
|
|
586
|
+
canUseAIFolderExtraction: true,
|
|
587
|
+
canUseAIFolderExtractionAgentSelector: true,
|
|
588
|
+
});
|
|
589
|
+
props.editors[0].instance.cascadePolicy.cascadePolicyType = 'ai_extract';
|
|
590
|
+
props.editors[0].instance.cascadePolicy.id = null;
|
|
591
|
+
|
|
592
|
+
render(<MetadataInstanceEditor {...props} />);
|
|
593
|
+
|
|
594
|
+
const editButton = await screen.findByRole('button', { name: 'Edit Metadata' }, { timeout: 3000 });
|
|
595
|
+
await userEvent.click(editButton);
|
|
596
|
+
|
|
597
|
+
// Click Enable Cascade Policy
|
|
598
|
+
const cascadeToggle = screen.getByRole('switch', { name: 'Enable Cascade Policy' });
|
|
599
|
+
expect(cascadeToggle).not.toBeChecked();
|
|
600
|
+
await userEvent.click(cascadeToggle);
|
|
601
|
+
expect(cascadeToggle).toBeChecked();
|
|
602
|
+
|
|
603
|
+
// Find the combobox and open it
|
|
604
|
+
const comboBox = screen.getByRole('combobox', { name: 'Standard' });
|
|
605
|
+
expect(comboBox).toBeInTheDocument();
|
|
606
|
+
|
|
607
|
+
// Open the combobox options (simulate click)
|
|
608
|
+
expect(comboBox).not.toHaveAttribute('disabled');
|
|
609
|
+
expect(comboBox).toBeVisible();
|
|
610
|
+
await userEvent.click(comboBox);
|
|
611
|
+
|
|
612
|
+
// Find the 'Enhanced' option and select it
|
|
613
|
+
const enhancedOption = await screen.findByRole('option', { name: 'Enhanced' });
|
|
614
|
+
expect(enhancedOption).not.toHaveAttribute('disabled');
|
|
615
|
+
expect(enhancedOption).toBeVisible();
|
|
616
|
+
await userEvent.click(enhancedOption);
|
|
617
|
+
|
|
618
|
+
// The combobox should now show 'Enhanced'
|
|
619
|
+
expect(screen.getByRole('combobox', { name: 'Enhanced' })).toBeInTheDocument();
|
|
620
|
+
}, 15000); // Increase timeout to 15 seconds
|
|
578
621
|
});
|
|
@@ -422,6 +422,7 @@ exports[`features/metadata-instance-editor/fields/Instance should correctly rend
|
|
|
422
422
|
isCascadingOverwritten={false}
|
|
423
423
|
isCustomMetadata={false}
|
|
424
424
|
isExistingCascadePolicy={true}
|
|
425
|
+
onAIAgentSelect={[Function]}
|
|
425
426
|
onAIFolderExtractionToggle={[Function]}
|
|
426
427
|
onCascadeModeChange={[Function]}
|
|
427
428
|
onCascadeToggle={[Function]}
|
|
@@ -2,5 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
const CASCADE_POLICY_TYPE_AI_EXTRACT = 'ai_extract';
|
|
4
4
|
const TEMPLATE_CUSTOM_PROPERTIES: 'properties' = 'properties';
|
|
5
|
+
const ENHANCED_AGENT_CONFIGURATION = 'enhanced_extract_agent';
|
|
6
|
+
const STANDARD_AGENT_ID = '1';
|
|
7
|
+
const ENHANCED_AGENT_ID = '2';
|
|
5
8
|
|
|
6
|
-
export {
|
|
9
|
+
export {
|
|
10
|
+
CASCADE_POLICY_TYPE_AI_EXTRACT,
|
|
11
|
+
TEMPLATE_CUSTOM_PROPERTIES,
|
|
12
|
+
ENHANCED_AGENT_CONFIGURATION,
|
|
13
|
+
STANDARD_AGENT_ID,
|
|
14
|
+
ENHANCED_AGENT_ID,
|
|
15
|
+
};
|
|
@@ -246,6 +246,16 @@ const messages = defineMessages({
|
|
|
246
246
|
'Informational text below cascade policy description and explains to the user that the policy will take some time to take effect.',
|
|
247
247
|
id: 'boxui.metadataInstanceEditor.operationNotImmediate',
|
|
248
248
|
},
|
|
249
|
+
standardAgentName: {
|
|
250
|
+
defaultMessage: 'Standard',
|
|
251
|
+
description: 'Name of the standard AI agent',
|
|
252
|
+
id: 'boxui.metadataInstanceEditor.standardAgentName',
|
|
253
|
+
},
|
|
254
|
+
enhancedAgentName: {
|
|
255
|
+
defaultMessage: 'Enhanced',
|
|
256
|
+
description: 'Name of the enhanced AI agent',
|
|
257
|
+
id: 'boxui.metadataInstanceEditor.enhancedAgentName',
|
|
258
|
+
},
|
|
249
259
|
});
|
|
250
260
|
|
|
251
261
|
export default messages;
|