box-ui-elements 23.4.0-beta.30 → 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.css +1 -1
- package/dist/explorer.js +1 -1
- package/dist/openwith.js +1 -1
- package/dist/picker.js +1 -1
- package/dist/preview.css +1 -1
- package/dist/preview.js +1 -1
- package/dist/sharing.js +1 -1
- package/dist/sidebar.css +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/elements/content-sidebar/SidebarNav.js +14 -3
- package/es/elements/content-sidebar/SidebarNav.js.flow +23 -3
- package/es/elements/content-sidebar/SidebarNav.js.map +1 -1
- package/es/elements/content-sidebar/SidebarNavTablist.js +58 -17
- package/es/elements/content-sidebar/SidebarNavTablist.js.flow +80 -21
- package/es/elements/content-sidebar/SidebarNavTablist.js.map +1 -1
- package/es/features/metadata-instance-editor/CascadePolicy.js +53 -23
- package/es/features/metadata-instance-editor/CascadePolicy.js.flow +69 -27
- package/es/features/metadata-instance-editor/CascadePolicy.js.map +1 -1
- package/es/features/metadata-instance-editor/Instance.js +26 -4
- package/es/features/metadata-instance-editor/Instance.js.flow +33 -4
- 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 +16 -0
- package/es/features/metadata-instance-editor/messages.js.flow +21 -0
- package/es/features/metadata-instance-editor/messages.js.map +1 -1
- package/es/features/metadata-instance-editor/stories/tests/CascadePolicy-visual.stories.js +32 -0
- package/es/features/metadata-instance-editor/stories/tests/CascadePolicy-visual.stories.js.flow +36 -0
- package/es/features/metadata-instance-editor/stories/tests/CascadePolicy-visual.stories.js.map +1 -0
- package/i18n/bn-IN.js +4 -0
- package/i18n/da-DK.js +4 -0
- package/i18n/de-DE.js +4 -0
- package/i18n/en-AU.js +4 -0
- package/i18n/en-CA.js +4 -0
- package/i18n/en-GB.js +4 -0
- package/i18n/en-US.js +4 -0
- package/i18n/en-US.properties +8 -0
- package/i18n/en-x-pseudo.js +4 -0
- package/i18n/es-419.js +4 -0
- package/i18n/es-ES.js +4 -0
- package/i18n/fi-FI.js +4 -0
- package/i18n/fr-CA.js +4 -0
- package/i18n/fr-FR.js +4 -0
- package/i18n/hi-IN.js +4 -0
- package/i18n/it-IT.js +4 -0
- package/i18n/ja-JP.js +4 -0
- package/i18n/ko-KR.js +4 -0
- package/i18n/nb-NO.js +4 -0
- package/i18n/nl-NL.js +4 -0
- package/i18n/pl-PL.js +4 -0
- package/i18n/pt-BR.js +4 -0
- package/i18n/ru-RU.js +4 -0
- package/i18n/sv-SE.js +4 -0
- package/i18n/tr-TR.js +4 -0
- package/i18n/zh-CN.js +4 -0
- package/i18n/zh-TW.js +4 -0
- package/package.json +7 -7
- package/src/common/types/metadata.js +6 -0
- package/src/elements/content-sidebar/SidebarNav.js +23 -3
- package/src/elements/content-sidebar/SidebarNavTablist.js +80 -21
- package/src/elements/content-sidebar/__tests__/SidebarNav.test.js +99 -147
- package/src/elements/content-sidebar/__tests__/SidebarNavTablist.test.js +189 -42
- package/src/features/metadata-instance-editor/CascadePolicy.js +69 -27
- package/src/features/metadata-instance-editor/Instance.js +33 -4
- package/src/features/metadata-instance-editor/__tests__/CascadePolicy.test.js +70 -63
- package/src/features/metadata-instance-editor/__tests__/Instance.test.js +34 -19
- 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 +2 -1
- package/src/features/metadata-instance-editor/constants.js +10 -1
- package/src/features/metadata-instance-editor/messages.js +21 -0
- package/src/features/metadata-instance-editor/stories/tests/CascadePolicy-visual.stories.js +36 -0
- package/src/features/metadata-instance-editor/__tests__/__snapshots__/CascadePolicy.test.js.snap +0 -108
|
@@ -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
|
});
|
|
@@ -421,7 +421,8 @@ exports[`features/metadata-instance-editor/fields/Instance should correctly rend
|
|
|
421
421
|
isCascadingEnabled={true}
|
|
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
|
+
};
|
|
@@ -207,6 +207,17 @@ const messages = defineMessages({
|
|
|
207
207
|
'Tooltip text that asks the user what they want to do when applying cascading to their metadata policy',
|
|
208
208
|
id: 'boxui.metadataInstanceEditor.cascadePolicyModeQuestion',
|
|
209
209
|
},
|
|
210
|
+
cascadePolicyOptionsDisabledNotice: {
|
|
211
|
+
defaultMessage:
|
|
212
|
+
'This cascade policy cannot be edited. To modify it, deactivate the current policy and then re-enable it to set up a new one.',
|
|
213
|
+
description: 'Notice that explains that the cascade policy cannot be edited',
|
|
214
|
+
id: 'boxui.metadataInstanceEditor.cascadePolicyOptionsDisabledNotice',
|
|
215
|
+
},
|
|
216
|
+
cascadePolicyOptionsDisabledNoticeIconAriaLabel: {
|
|
217
|
+
defaultMessage: 'Disabled cascade options information',
|
|
218
|
+
description: 'Aria label for the disabled cascade options information icon',
|
|
219
|
+
id: 'boxui.metadataInstanceEditor.cascadePolicyOptionsDisabledNoticeIconAriaLabel',
|
|
220
|
+
},
|
|
210
221
|
cascadePolicySkipMode: {
|
|
211
222
|
defaultMessage: 'Skip and keep all existing template values',
|
|
212
223
|
description: 'Label for radio button that selects skip mode for cascading policy',
|
|
@@ -235,6 +246,16 @@ const messages = defineMessages({
|
|
|
235
246
|
'Informational text below cascade policy description and explains to the user that the policy will take some time to take effect.',
|
|
236
247
|
id: 'boxui.metadataInstanceEditor.operationNotImmediate',
|
|
237
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
|
+
},
|
|
238
259
|
});
|
|
239
260
|
|
|
240
261
|
export default messages;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TooltipProvider } from '@box/blueprint-web';
|
|
3
|
+
import CascadePolicy from '../../CascadePolicy';
|
|
4
|
+
|
|
5
|
+
const baseProps = {
|
|
6
|
+
canEdit: true,
|
|
7
|
+
canUseAIFolderExtraction: true,
|
|
8
|
+
canUseAIFolderExtractionAgentSelector: true,
|
|
9
|
+
isAIFolderExtractionEnabled: false,
|
|
10
|
+
isCascadingEnabled: true,
|
|
11
|
+
isCascadingOverwritten: false,
|
|
12
|
+
isCustomMetadata: false,
|
|
13
|
+
onAIFolderExtractionToggle: () => {},
|
|
14
|
+
onCascadeModeChange: () => {},
|
|
15
|
+
onCascadeToggle: () => {},
|
|
16
|
+
shouldShowCascadeOptions: true,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const Template = props => (
|
|
20
|
+
<TooltipProvider>
|
|
21
|
+
<CascadePolicy {...baseProps} {...props} />
|
|
22
|
+
</TooltipProvider>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const EnabledCascadePolicyOptionsFieldsOnly = () => <Template isExistingCascadePolicy={false} />;
|
|
26
|
+
EnabledCascadePolicyOptionsFieldsOnly.storyName = 'Enabled Cascade Policy Options';
|
|
27
|
+
|
|
28
|
+
const DisabledCascadePolicyOptionsFieldsOnly = () => <Template isExistingCascadePolicy={true} />;
|
|
29
|
+
DisabledCascadePolicyOptionsFieldsOnly.storyName = 'Disabled Cascade Policy Options';
|
|
30
|
+
|
|
31
|
+
export { EnabledCascadePolicyOptionsFieldsOnly, DisabledCascadePolicyOptionsFieldsOnly };
|
|
32
|
+
|
|
33
|
+
export default {
|
|
34
|
+
title: 'Features/Metadata Instance Editor/CascadePolicy/Visual',
|
|
35
|
+
component: CascadePolicy,
|
|
36
|
+
};
|
package/src/features/metadata-instance-editor/__tests__/__snapshots__/CascadePolicy.test.js.snap
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`features/metadata-instance-editor/CascadePolicy should correctly render cascade policy in edit mode 1`] = `
|
|
4
|
-
<div
|
|
5
|
-
className="metadata-cascade-notice"
|
|
6
|
-
>
|
|
7
|
-
<MemoizedFormattedMessage
|
|
8
|
-
defaultMessage="This template and its values are being cascaded to all items in this folder and its subfolders."
|
|
9
|
-
id="boxui.metadataInstanceEditor.metadataCascadePolicyEnabledInfo"
|
|
10
|
-
/>
|
|
11
|
-
</div>
|
|
12
|
-
`;
|
|
13
|
-
|
|
14
|
-
exports[`features/metadata-instance-editor/CascadePolicy should correctly render cascade policy in edit mode and overwrite is on 1`] = `
|
|
15
|
-
<div
|
|
16
|
-
className="metadata-cascade-notice"
|
|
17
|
-
>
|
|
18
|
-
<MemoizedFormattedMessage
|
|
19
|
-
defaultMessage="This template and its values are being cascaded to all items in this folder and its subfolders."
|
|
20
|
-
id="boxui.metadataInstanceEditor.metadataCascadePolicyEnabledInfo"
|
|
21
|
-
/>
|
|
22
|
-
</div>
|
|
23
|
-
`;
|
|
24
|
-
|
|
25
|
-
exports[`features/metadata-instance-editor/CascadePolicy should correctly render cascade policy read only mode 1`] = `
|
|
26
|
-
<div
|
|
27
|
-
className="metadata-cascade-notice"
|
|
28
|
-
>
|
|
29
|
-
<MemoizedFormattedMessage
|
|
30
|
-
defaultMessage="This template and its values are being cascaded to all items in this folder and its subfolders."
|
|
31
|
-
id="boxui.metadataInstanceEditor.metadataCascadePolicyEnabledInfo"
|
|
32
|
-
/>
|
|
33
|
-
</div>
|
|
34
|
-
`;
|
|
35
|
-
|
|
36
|
-
exports[`features/metadata-instance-editor/CascadePolicy should correctly render cascade policy when the template is Custom Metadata 1`] = `
|
|
37
|
-
<Fragment>
|
|
38
|
-
<div
|
|
39
|
-
className="metadata-cascade-editor"
|
|
40
|
-
>
|
|
41
|
-
<div
|
|
42
|
-
className="metadata-cascade-enable"
|
|
43
|
-
data-testid="metadata-cascade-enable"
|
|
44
|
-
>
|
|
45
|
-
<div>
|
|
46
|
-
<MemoizedFormattedMessage
|
|
47
|
-
defaultMessage="Enable Cascade Policy"
|
|
48
|
-
id="boxui.metadataInstanceEditor.enableCascadePolicy"
|
|
49
|
-
tagName="strong"
|
|
50
|
-
/>
|
|
51
|
-
</div>
|
|
52
|
-
<div>
|
|
53
|
-
<MemoizedFormattedMessage
|
|
54
|
-
defaultMessage="Cascade policy cannot be applied to custom metadata at this time."
|
|
55
|
-
id="boxui.metadataInstanceEditor.cannotApplyCascadePolicyText"
|
|
56
|
-
/>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
<div
|
|
61
|
-
className="metadata-cascade-editor"
|
|
62
|
-
>
|
|
63
|
-
<div
|
|
64
|
-
className="metadata-cascading-mode"
|
|
65
|
-
>
|
|
66
|
-
<MemoizedFormattedMessage
|
|
67
|
-
defaultMessage="In the case of conflicts when applying this template and its values to existing items, what would you like to do? This is a one time action."
|
|
68
|
-
id="boxui.metadataInstanceEditor.cascadePolicyModeQuestion"
|
|
69
|
-
/>
|
|
70
|
-
<div
|
|
71
|
-
className="metadata-operation-not-immediate"
|
|
72
|
-
>
|
|
73
|
-
<IconAlertDefault />
|
|
74
|
-
<span>
|
|
75
|
-
<MemoizedFormattedMessage
|
|
76
|
-
defaultMessage="This operation is not immediate and may take some time."
|
|
77
|
-
id="boxui.metadataInstanceEditor.operationNotImmediate"
|
|
78
|
-
/>
|
|
79
|
-
</span>
|
|
80
|
-
</div>
|
|
81
|
-
<RadioGroup
|
|
82
|
-
className="metadata-cascading-options"
|
|
83
|
-
onChange={[Function]}
|
|
84
|
-
value="skip"
|
|
85
|
-
>
|
|
86
|
-
<RadioButton
|
|
87
|
-
label={
|
|
88
|
-
<Memo(MemoizedFormattedMessage)
|
|
89
|
-
defaultMessage="Skip and keep all existing template values"
|
|
90
|
-
id="boxui.metadataInstanceEditor.cascadePolicySkipMode"
|
|
91
|
-
/>
|
|
92
|
-
}
|
|
93
|
-
value="skip"
|
|
94
|
-
/>
|
|
95
|
-
<RadioButton
|
|
96
|
-
label={
|
|
97
|
-
<Memo(MemoizedFormattedMessage)
|
|
98
|
-
defaultMessage="Overwrite all existing template values"
|
|
99
|
-
id="boxui.metadataInstanceEditor.cascadePolicyOverwriteMode"
|
|
100
|
-
/>
|
|
101
|
-
}
|
|
102
|
-
value="overwrite"
|
|
103
|
-
/>
|
|
104
|
-
</RadioGroup>
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
</Fragment>
|
|
108
|
-
`;
|