@box/metadata-editor 2.11.16 → 2.11.17
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{TEMPLATE_CUSTOM_PROPERTIES}from"../esm/lib/constants.js";import{isCustomExtractAgentPolicy}from"../esm/lib/utils/cascade-policy.js";import{t as CascadePolicyEditor}from"./cascade-policy-editor.js";import{CustomExtractAgentNotice}from"../esm/lib/components/metadata-instance-editor/subcomponents/custom-extract-agent-notice/custom-extract-agent-notice.js";import{t as MetadataInstanceFormAiDisclaimer}from"./metadata-instance-form-ai-disclaimer.js";import{t as MetadataInstanceFormFooter}from"./metadata-instance-form-footer.js";import{t as MetadataInstanceFormHeader}from"./metadata-instance-form-header.js";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import clsx from"clsx";import{Card}from"@box/blueprint-web";import '../styles/metadata-instance-form-card-wrapper.css';var metadata_instance_form_module_default={metadataInstanceForm:`_metadataInstanceForm_10ifw_1`,wrapperGradient:`_wrapperGradient_10ifw_7`,suggestionsFetching:`_suggestionsFetching_10ifw_12`,metadataInstanceFormContent:`_metadataInstanceFormContent_10ifw_18`,metadataInstanceFormContentReducedGap:`_metadataInstanceFormContentReducedGap_10ifw_25`,showOverlay:`_showOverlay_10ifw_29`},noopCascadeToggle=()=>void 0,noopCascadeModeChange=_mode=>void 0,MetadataInstanceFormCardWrapper=props=>{let{areAiSuggestionsAvailable,children,className,formRef,formValues,isAdvancedExtractAgentEnabled=!1,isAiSuggestionsFeatureEnabled,isBetaLanguageEnabled,isConfidenceScoreReviewEnabled=!1,isBoundingBoxEnabled=!1,isLargeFile=!1,isDeleteButtonDisabled,onToggleReviewFilter,shouldShowOnlyReviewFields=!1,suggestions,isFetchingSuggestions,isFormDirty=!1,selectedTemplateInstance,getAiSuggestions,handleCancel,handleDelete,itemType=`file`,onManageExtractAgent,cascadeIsEnabled=!1,cascadeMode=`skip`,isConfiguringCascadeReplacement=!1,onCascadeToggle,onCascadeModeChange}=props,isCustomMetadata=selectedTemplateInstance?.templateKey===TEMPLATE_CUSTOM_PROPERTIES,hasSuggestions=!!suggestions[selectedTemplateInstance?.templateKey],isBoundingBoxOrConfidenceScoreReviewEnabled=isConfidenceScoreReviewEnabled||isBoundingBoxEnabled,isFolder=itemType===`folder`,cascadePolicy=selectedTemplateInstance?.cascadePolicy,isManagedByCustomExtractAgent=isFolder&&isCustomExtractAgentPolicy(cascadePolicy);return jsx(`div`,{className:isFetchingSuggestions&&metadata_instance_form_module_default.wrapperGradient,children:jsxs(Card,{ref:formRef,className:clsx(className,{[metadata_instance_form_module_default.suggestionsFetching]:isFetchingSuggestions}),children:[jsx(MetadataInstanceFormHeader,{areAiSuggestionsAvailable,hasSuggestions,isAdvancedExtractAgentEnabled,isAiSuggestionsFeatureEnabled:isAiSuggestionsFeatureEnabled&&!isCustomMetadata&&!isManagedByCustomExtractAgent,isBetaLanguageEnabled,isConfidenceScoreReviewEnabled,isLargeFile,isLoading:isFetchingSuggestions,onAutofill:isManagedByCustomExtractAgent?void 0:getAiSuggestions,onToggleReviewFilter,shouldShowOnlyReviewFields,templateName:selectedTemplateInstance?.displayName}),isManagedByCustomExtractAgent?jsx(CustomExtractAgentNotice,{agentConfiguration:cascadePolicy?.agentConfiguration,onManageExtractAgent}):jsxs(Fragment,{children:[isFolder&&selectedTemplateInstance&&jsx(CascadePolicyEditor,{canEdit:cascadePolicy?.canEdit!==!1,cascadePolicy,isConfiguringReplacement:isConfiguringCascadeReplacement,isCustomMetadata,isEnabled:cascadeIsEnabled,mode:cascadeMode,onCascadeModeChange:onCascadeModeChange??noopCascadeModeChange,onCascadeToggle:onCascadeToggle??noopCascadeToggle}),selectedTemplateInstance&&children]}),jsx(MetadataInstanceFormAiDisclaimer,{isLoading:isFetchingSuggestions,isBoundingBoxOrConfidenceScoreReviewEnabled,fields:formValues.metadata?.fields??[]}),jsx(MetadataInstanceFormFooter,{isDeleteButtonDisabled:isDeleteButtonDisabled||isManagedByCustomExtractAgent,isLoading:isFetchingSuggestions,isSaveButtonDisabled:isManagedByCustomExtractAgent,onCancel:()=>handleCancel(isFormDirty),onDelete:handleDelete})]})})};export{metadata_instance_form_module_default as n,MetadataInstanceFormCardWrapper as t};
|
|
1
|
+
import{TEMPLATE_CUSTOM_PROPERTIES}from"../esm/lib/constants.js";import{isCustomExtractAgentPolicy}from"../esm/lib/utils/cascade-policy.js";import{isAutofillAllowedForInstance}from"../esm/lib/utils/autofill-namespace.js";import{t as CascadePolicyEditor}from"./cascade-policy-editor.js";import{CustomExtractAgentNotice}from"../esm/lib/components/metadata-instance-editor/subcomponents/custom-extract-agent-notice/custom-extract-agent-notice.js";import{t as MetadataInstanceFormAiDisclaimer}from"./metadata-instance-form-ai-disclaimer.js";import{t as MetadataInstanceFormFooter}from"./metadata-instance-form-footer.js";import{t as MetadataInstanceFormHeader}from"./metadata-instance-form-header.js";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import clsx from"clsx";import{Card}from"@box/blueprint-web";import '../styles/metadata-instance-form-card-wrapper.css';var metadata_instance_form_module_default={metadataInstanceForm:`_metadataInstanceForm_10ifw_1`,wrapperGradient:`_wrapperGradient_10ifw_7`,suggestionsFetching:`_suggestionsFetching_10ifw_12`,metadataInstanceFormContent:`_metadataInstanceFormContent_10ifw_18`,metadataInstanceFormContentReducedGap:`_metadataInstanceFormContentReducedGap_10ifw_25`,showOverlay:`_showOverlay_10ifw_29`},noopCascadeToggle=()=>void 0,noopCascadeModeChange=_mode=>void 0,MetadataInstanceFormCardWrapper=props=>{let{areAiSuggestionsAvailable,children,className,formRef,formValues,isAdvancedExtractAgentEnabled=!1,isAiSuggestionsFeatureEnabled,isBetaLanguageEnabled,isConfidenceScoreReviewEnabled=!1,isBoundingBoxEnabled=!1,isLargeFile=!1,isDeleteButtonDisabled,onToggleReviewFilter,shouldShowOnlyReviewFields=!1,suggestions,isFetchingSuggestions,isFormDirty=!1,selectedTemplateInstance,getAiSuggestions,handleCancel,handleDelete,itemType=`file`,onManageExtractAgent,cascadeIsEnabled=!1,cascadeMode=`skip`,isConfiguringCascadeReplacement=!1,onCascadeToggle,onCascadeModeChange}=props,isCustomMetadata=selectedTemplateInstance?.templateKey===TEMPLATE_CUSTOM_PROPERTIES,hasSuggestions=!!suggestions[selectedTemplateInstance?.templateKey],isBoundingBoxOrConfidenceScoreReviewEnabled=isConfidenceScoreReviewEnabled||isBoundingBoxEnabled,isFolder=itemType===`folder`,cascadePolicy=selectedTemplateInstance?.cascadePolicy,isManagedByCustomExtractAgent=isFolder&&isCustomExtractAgentPolicy(cascadePolicy);return jsx(`div`,{className:isFetchingSuggestions&&metadata_instance_form_module_default.wrapperGradient,children:jsxs(Card,{ref:formRef,className:clsx(className,{[metadata_instance_form_module_default.suggestionsFetching]:isFetchingSuggestions}),children:[jsx(MetadataInstanceFormHeader,{areAiSuggestionsAvailable,hasSuggestions,isAdvancedExtractAgentEnabled,isAiSuggestionsFeatureEnabled:isAiSuggestionsFeatureEnabled&&!isCustomMetadata&&!isManagedByCustomExtractAgent&&isAutofillAllowedForInstance(selectedTemplateInstance),isBetaLanguageEnabled,isConfidenceScoreReviewEnabled,isLargeFile,isLoading:isFetchingSuggestions,onAutofill:isManagedByCustomExtractAgent?void 0:getAiSuggestions,onToggleReviewFilter,shouldShowOnlyReviewFields,templateName:selectedTemplateInstance?.displayName}),isManagedByCustomExtractAgent?jsx(CustomExtractAgentNotice,{agentConfiguration:cascadePolicy?.agentConfiguration,onManageExtractAgent}):jsxs(Fragment,{children:[isFolder&&selectedTemplateInstance&&jsx(CascadePolicyEditor,{canEdit:cascadePolicy?.canEdit!==!1,cascadePolicy,isConfiguringReplacement:isConfiguringCascadeReplacement,isCustomMetadata,isEnabled:cascadeIsEnabled,mode:cascadeMode,onCascadeModeChange:onCascadeModeChange??noopCascadeModeChange,onCascadeToggle:onCascadeToggle??noopCascadeToggle}),selectedTemplateInstance&&children]}),jsx(MetadataInstanceFormAiDisclaimer,{isLoading:isFetchingSuggestions,isBoundingBoxOrConfidenceScoreReviewEnabled,fields:formValues.metadata?.fields??[]}),jsx(MetadataInstanceFormFooter,{isDeleteButtonDisabled:isDeleteButtonDisabled||isManagedByCustomExtractAgent,isLoading:isFetchingSuggestions,isSaveButtonDisabled:isManagedByCustomExtractAgent,onCancel:()=>handleCancel(isFormDirty),onDelete:handleDelete})]})})};export{metadata_instance_form_module_default as n,MetadataInstanceFormCardWrapper as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MetadataEmptyState}from"../esm/lib/components/metadata-empty-state/metadata-empty-state.js";import{useAutofill}from"../esm/lib/utils/autofill-context.js";import{isCascadePolicyEnabled}from"../esm/lib/utils/cascade-policy.js";import{getFieldsNeedingReview}from"../esm/lib/utils/confidence-score/get-fields-needing-review.js";import{MetadataInstanceCascadeNotice}from"../esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-cascade-notice/metadata-instance-cascade-notice.js";import{MetadataInstanceReviewNotice}from"../esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js";import{t as MetadataInstanceContent}from"./metadata-instance-content.js";import{t as MetadataInstanceFooter}from"./metadata-instance-footer.js";import{t as MetadataInstanceHeader}from"./metadata-instance-header.js";import{useState}from"react";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import{Card,Divider}from"@box/blueprint-web";import '../styles/metadata-instance.css';var metadata_instance_module_default={topDivider:`_topDivider_1x96u_1`,reviewNotice:`_reviewNotice_1x96u_5`,cascadeNotice:`_cascadeNotice_1x96u_9`,bottomDivider:`_bottomDivider_1x96u_13`},MetadataInstance=({itemType=`file`,areAiSuggestionsAvailable,isAiSuggestionsFeatureEnabled,isBetaLanguageEnabled,onEdit,onSelectMetadataField,selectedMetadataFieldId,templateInstance,taxonomyNodeFetcher,isAdvancedExtractAgentEnabled=!1,isConfidenceScoreReviewEnabled=!1,isBoundingBoxEnabled=!1})=>{let metadataFields=templateInstance.fields,isCascaded=itemType===`folder`&&isCascadePolicyEnabled(templateInstance.cascadePolicy),hasNonEmptyValue=field=>!field.value||Array.isArray(field.value)&&field.value.length===0,areAllValuesEmpty=metadataFields.every(hasNonEmptyValue),areSomeValuesEmpty=metadataFields.some(hasNonEmptyValue),hasFields=metadataFields.length>0,fieldsNeedingReviewCount=getFieldsNeedingReview(metadataFields).length,shouldShowReviewNotice=isConfidenceScoreReviewEnabled&&fieldsNeedingReviewCount>0&&templateInstance.canEdit,[shouldHideEmptyValues,setShouldHideEmptyValues]=useState(!0),{getAiSuggestions}=useAutofill();return jsxs(Card,{children:[jsx(MetadataInstanceHeader,{areAiSuggestionsAvailable,canEdit:templateInstance.canEdit,isAdvancedExtractAgentEnabled,isAiSuggestionsFeatureEnabled,isBetaLanguageEnabled,isCascaded,itemType,onAutofill:agentId=>{onEdit(templateInstance),getAiSuggestions(templateInstance.templateKey,templateInstance.scope,agentId)},onEdit:()=>onEdit(templateInstance),templateName:templateInstance?.displayName}),jsx(Divider,{className:metadata_instance_module_default.topDivider}),isCascaded&&jsx(`div`,{className:metadata_instance_module_default.cascadeNotice,children:jsx(MetadataInstanceCascadeNotice,{})}),shouldShowReviewNotice&&jsx(`div`,{className:metadata_instance_module_default.reviewNotice,children:jsx(MetadataInstanceReviewNotice,{fieldsNeedingReviewCount,onTextToggleClick:()=>{onEdit(templateInstance,!0)}})}),shouldHideEmptyValues&&areAllValuesEmpty?jsx(MetadataEmptyState,{isAnyEmptyValueHidden:hasFields,isBoxAiSuggestionsFeatureEnabled:isAiSuggestionsFeatureEnabled,level:`instance`,onShowEmptyValues:()=>setShouldHideEmptyValues(!1)}):jsxs(Fragment,{children:[jsx(MetadataInstanceContent,{isConfidenceScoreReviewEnabled,isBoundingBoxEnabled,onSelectMetadataField,selectedMetadataFieldId,shouldHideEmptyValues,taxonomyNodeFetcher,templateInstance}),areSomeValuesEmpty&&jsxs(Fragment,{children:[jsx(Divider,{className:metadata_instance_module_default.bottomDivider}),jsx(MetadataInstanceFooter,{isAnyEmptyValueHidden:shouldHideEmptyValues,onHideEmptyValues:()=>setShouldHideEmptyValues(!0),onShowEmptyValues:()=>setShouldHideEmptyValues(!1)})]})]})]})};export{MetadataInstance as t};
|
|
1
|
+
import{MetadataEmptyState}from"../esm/lib/components/metadata-empty-state/metadata-empty-state.js";import{useAutofill}from"../esm/lib/utils/autofill-context.js";import{isCascadePolicyEnabled}from"../esm/lib/utils/cascade-policy.js";import{getFieldsNeedingReview}from"../esm/lib/utils/confidence-score/get-fields-needing-review.js";import{isAutofillAllowedForInstance}from"../esm/lib/utils/autofill-namespace.js";import{MetadataInstanceCascadeNotice}from"../esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-cascade-notice/metadata-instance-cascade-notice.js";import{MetadataInstanceReviewNotice}from"../esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js";import{t as MetadataInstanceContent}from"./metadata-instance-content.js";import{t as MetadataInstanceFooter}from"./metadata-instance-footer.js";import{t as MetadataInstanceHeader}from"./metadata-instance-header.js";import{useState}from"react";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import{Card,Divider}from"@box/blueprint-web";import '../styles/metadata-instance.css';var metadata_instance_module_default={topDivider:`_topDivider_1x96u_1`,reviewNotice:`_reviewNotice_1x96u_5`,cascadeNotice:`_cascadeNotice_1x96u_9`,bottomDivider:`_bottomDivider_1x96u_13`},MetadataInstance=({itemType=`file`,areAiSuggestionsAvailable,isAiSuggestionsFeatureEnabled,isBetaLanguageEnabled,onEdit,onSelectMetadataField,selectedMetadataFieldId,templateInstance,taxonomyNodeFetcher,isAdvancedExtractAgentEnabled=!1,isConfidenceScoreReviewEnabled=!1,isBoundingBoxEnabled=!1})=>{let metadataFields=templateInstance.fields,isCascaded=itemType===`folder`&&isCascadePolicyEnabled(templateInstance.cascadePolicy),hasNonEmptyValue=field=>!field.value||Array.isArray(field.value)&&field.value.length===0,areAllValuesEmpty=metadataFields.every(hasNonEmptyValue),areSomeValuesEmpty=metadataFields.some(hasNonEmptyValue),hasFields=metadataFields.length>0,fieldsNeedingReviewCount=getFieldsNeedingReview(metadataFields).length,shouldShowReviewNotice=isConfidenceScoreReviewEnabled&&fieldsNeedingReviewCount>0&&templateInstance.canEdit,[shouldHideEmptyValues,setShouldHideEmptyValues]=useState(!0),{getAiSuggestions}=useAutofill();return jsxs(Card,{children:[jsx(MetadataInstanceHeader,{areAiSuggestionsAvailable,canEdit:templateInstance.canEdit,isAdvancedExtractAgentEnabled,isAiSuggestionsFeatureEnabled:isAiSuggestionsFeatureEnabled&&isAutofillAllowedForInstance(templateInstance),isBetaLanguageEnabled,isCascaded,itemType,onAutofill:agentId=>{onEdit(templateInstance),getAiSuggestions(templateInstance.templateKey,templateInstance.scope,agentId)},onEdit:()=>onEdit(templateInstance),templateName:templateInstance?.displayName}),jsx(Divider,{className:metadata_instance_module_default.topDivider}),isCascaded&&jsx(`div`,{className:metadata_instance_module_default.cascadeNotice,children:jsx(MetadataInstanceCascadeNotice,{})}),shouldShowReviewNotice&&jsx(`div`,{className:metadata_instance_module_default.reviewNotice,children:jsx(MetadataInstanceReviewNotice,{fieldsNeedingReviewCount,onTextToggleClick:()=>{onEdit(templateInstance,!0)}})}),shouldHideEmptyValues&&areAllValuesEmpty?jsx(MetadataEmptyState,{isAnyEmptyValueHidden:hasFields,isBoxAiSuggestionsFeatureEnabled:isAiSuggestionsFeatureEnabled,level:`instance`,onShowEmptyValues:()=>setShouldHideEmptyValues(!1)}):jsxs(Fragment,{children:[jsx(MetadataInstanceContent,{isConfidenceScoreReviewEnabled,isBoundingBoxEnabled,onSelectMetadataField,selectedMetadataFieldId,shouldHideEmptyValues,taxonomyNodeFetcher,templateInstance}),areSomeValuesEmpty&&jsxs(Fragment,{children:[jsx(Divider,{className:metadata_instance_module_default.bottomDivider}),jsx(MetadataInstanceFooter,{isAnyEmptyValueHidden:shouldHideEmptyValues,onHideEmptyValues:()=>setShouldHideEmptyValues(!0),onShowEmptyValues:()=>setShouldHideEmptyValues(!1)})]})]})]})};export{MetadataInstance as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var ENTERPRISE_SCOPE=`enterprise`,ENTERPRISE_ROOT_FQN=/^enterprise_\d+$/,isAutofillAllowedForInstance=instance=>{let fqn=(instance?.namespace||instance?.scope||``).trim();return fqn===ENTERPRISE_SCOPE||ENTERPRISE_ROOT_FQN.test(fqn)};export{isAutofillAllowedForInstance};
|
|
@@ -147,6 +147,12 @@ export type MetadataTemplateInstance = {
|
|
|
147
147
|
id: string;
|
|
148
148
|
fields: MetadataTemplateField[];
|
|
149
149
|
scope: string;
|
|
150
|
+
/**
|
|
151
|
+
* Full namespace FQN. Prefer this over `scope`: a child template can report
|
|
152
|
+
* the enterprise root in `scope` (`enterprise_123`) while `namespace` is
|
|
153
|
+
* `enterprise_123.legal`.
|
|
154
|
+
*/
|
|
155
|
+
namespace?: string;
|
|
150
156
|
templateKey: string;
|
|
151
157
|
type: string;
|
|
152
158
|
isExternallyOwned?: boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type AutofillNamespaceInstance = {
|
|
2
|
+
/** SCOPED shorthand (`enterprise`) or an FQN such as `enterprise_123`. */
|
|
3
|
+
scope?: string | null;
|
|
4
|
+
/**
|
|
5
|
+
* Full namespace FQN. Wins over `scope`: a child template can report
|
|
6
|
+
* `enterprise_123` in `scope` and `enterprise_123.legal` here.
|
|
7
|
+
*/
|
|
8
|
+
namespace?: string | null;
|
|
9
|
+
};
|
|
10
|
+
export declare const isAutofillAllowedForInstance: (instance?: AutofillNamespaceInstance | null) => boolean;
|
|
11
|
+
export {};
|