@uniformdev/canvas 19.164.0 → 19.165.1-alpha.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/index.d.mts CHANGED
@@ -25491,6 +25491,9 @@ declare function localize(options: LocalizeDeprecatedOptions): void;
25491
25491
  *
25492
25492
  * NOTE: this function mutates its input object for maximum performance.
25493
25493
  * If you desire immutability wrap it in immer.
25494
+ *
25495
+ * NOTE: this function is only necessary when content has been fetched in more than one locale from the Uniform API.
25496
+ * If a locale was provided to the Uniform API, the content will already be localized in the desired locale.
25494
25497
  */
25495
25498
  declare function localize(options: LocalizeModernOptions): void;
25496
25499
 
@@ -25511,6 +25514,106 @@ declare class UniqueBatchEntries<TArgs, TResult> {
25511
25514
  resolveRemaining(value: TResult): void;
25512
25515
  }
25513
25516
 
25517
+ declare const CANVAS_VIZ_CONTROL_PARAM = "$viz";
25518
+ /**
25519
+ * @deprecated beta functionality subject to change
25520
+ */
25521
+ type VisibilityRules = {
25522
+ [rule: string]: VisibilityRule;
25523
+ };
25524
+ /**
25525
+ * @deprecated beta functionality subject to change
25526
+ */
25527
+ type VisibilityRule = (criteria: VisibilityCriteria) => VisibilityCriteriaEvaluationResult;
25528
+ /**
25529
+ * @deprecated beta functionality subject to change
25530
+ */
25531
+ type VisibilityParameterValue = {
25532
+ /**
25533
+ * Overrides any criteria value and hides the component explicitly
25534
+ * (e.g. for unfinished content)
25535
+ */
25536
+ explicitlyHidden?: boolean;
25537
+ /** Criteria for the visibility of the component. If these evaluate to false, the component is hidden. */
25538
+ criteria?: VisibilityCriteriaGroup;
25539
+ };
25540
+ /**
25541
+ * @deprecated beta functionality subject to change
25542
+ */
25543
+ type VisibilityCriteriaGroup = {
25544
+ /** The boolean operator to join the clauses with. Defaults to & if not specified. */
25545
+ op?: '&' | '|';
25546
+ clauses: Array<VisibilityCriteria | VisibilityCriteriaGroup>;
25547
+ };
25548
+ /**
25549
+ * @deprecated beta functionality subject to change
25550
+ */
25551
+ type VisibilityCriteria = {
25552
+ /** The rule type to execute */
25553
+ rule: string;
25554
+ /** The source value of the rule. For rules which have multiple classes of match, for example a dynamic input matches on a named DI. The rule is dynamic input. The DI name is the source. */
25555
+ source?: string;
25556
+ /** The rule-definition-specific operator to test against */
25557
+ op: string;
25558
+ /** The value, or if an array several potential values, to test against. In most rules, multiple values are OR'd together ('any of') but this is not a hard requirement. */
25559
+ value: string | string[];
25560
+ };
25561
+ /**
25562
+ * @deprecated beta functionality subject to change
25563
+ */
25564
+ type VisibilityCriteriaEvaluationResult = boolean | null;
25565
+
25566
+ type EvaluateCriteriaGroupOptions = {
25567
+ /** Visibility rule definitions to evaluate */
25568
+ rules: VisibilityRules;
25569
+ /**
25570
+ * When true, the criteria group passed in will be simplified according to rules which pass or fail,
25571
+ * resulting in a result that only contains indeterminate results.
25572
+ *
25573
+ * If false, the criteria group object will not be modified.
25574
+ */
25575
+ simplifyCriteria?: boolean;
25576
+ /** The criteria group to evaluate */
25577
+ criteriaGroup: VisibilityCriteriaGroup;
25578
+ };
25579
+ /**
25580
+ * @deprecated beta functionality subject to change
25581
+ */
25582
+ declare function evaluateVisibilityCriteriaGroup(options: EvaluateCriteriaGroupOptions): VisibilityCriteriaEvaluationResult;
25583
+
25584
+ interface EvaluateNodeVisibilityOptions extends Omit<EvaluateCriteriaGroupOptions, 'criteriaGroup'> {
25585
+ /** The node to evaluate visibility rules on */
25586
+ node: ComponentInstance;
25587
+ }
25588
+
25589
+ interface EvaluateNodeTreeVisibilityOptions extends Pick<EvaluateNodeVisibilityOptions, 'rules'> {
25590
+ context: TreeNodeInfoTypes<unknown>;
25591
+ /**
25592
+ * Controls the overall result when indeterminate criteria are found
25593
+ * (unknown rule types, or rule evaluators that return null)
25594
+ * When true, indeterminate criteria will not fail the summary result
25595
+ * When false, indeterminate criteria will fail the summary result, and the node will be hidden
25596
+ */
25597
+ showIndeterminate?: boolean;
25598
+ }
25599
+ /**
25600
+ * Function to call to evaluate visibility rules when traversing the node tree with walkNodeTree.
25601
+ *
25602
+ * If the function returns false, that means the current node is removed and you should stop any other code handling.
25603
+ *
25604
+ * @deprecated beta functionality subject to change
25605
+ */
25606
+ declare function evaluateWalkTreeVisibility({ rules, showIndeterminate, context, }: EvaluateNodeTreeVisibilityOptions): boolean | undefined;
25607
+
25608
+ declare const CANVAS_VIZ_DI_RULE = "$di";
25609
+ declare function createDynamicInputVisibilityRule(dynamicInputs: Record<string, string>): VisibilityRules;
25610
+
25611
+ type CoreStringOperators = 'is' | 'has' | 'startswith' | 'endswith' | 'empty';
25612
+ type StringOperators = CoreStringOperators | `!${CoreStringOperators}`;
25613
+
25614
+ declare const CANVAS_VIZ_LOCALE_RULE = "$locale";
25615
+ declare function createLocaleVisibilityRule(currentLocale: string | undefined): VisibilityRules;
25616
+
25514
25617
  /** API client to fetch entity across releases */
25515
25618
  declare class EntityReleasesClient extends ApiClient {
25516
25619
  constructor(options: ClientOptions);
@@ -26442,4 +26545,4 @@ declare class WorkflowClient extends ApiClient {
26442
26545
 
26443
26546
  declare const CanvasClientError: typeof ApiClientError;
26444
26547
 
26445
- export { ASSETS_SOURCE_CUSTOM_URL, ASSETS_SOURCE_UNIFORM, ASSET_PARAMETER_TYPE, ATTRIBUTE_COMPONENT_ID, ATTRIBUTE_MULTILINE, ATTRIBUTE_PARAMETER_ID, ATTRIBUTE_PARAMETER_TYPE, ATTRIBUTE_PARAMETER_VALUE, ATTRIBUTE_PLACEHOLDER, type AddComponentMessage, type AssetParamValue, type AssetParamValueItem, type BatchEnhancer, BatchEntry, type BatchInvalidationPayload, type BindVariablesOptions, type BindVariablesResult, type BindVariablesToObjectOptions, type BlockLocationReference, type BlockValue, CANVAS_BLOCK_PARAM_TYPE, CANVAS_DRAFT_STATE, CANVAS_EDITOR_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_SLOT_SECTION_SLOT, CANVAS_SLOT_SECTION_TYPE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, type CanvasDefinitions, type CategoriesDeleteParameters, type CategoriesGetParameters, type CategoriesGetResponse, type CategoriesPutParameters, type Category, CategoryClient, type Channel, type ChannelMessage, type ChannelSubscription, ChildEnhancerBuilder, type ComponentDefinition, type ComponentDefinitionDeleteParameters, type ComponentDefinitionGetParameters, type ComponentDefinitionGetResponse, type ComponentDefinitionParameter, type ComponentDefinitionPermission, type ComponentDefinitionPutParameters, type ComponentDefinitionSlot, type ComponentDefinitionSlugSettings, type ComponentDefinitionVariant, type ComponentEnhancer, type ComponentEnhancerFunction, type ComponentEnhancerOptions, type ComponentInstance, type ComponentInstanceContextualEditing, type ComponentInstanceHistoryEntry, type ComponentInstanceHistoryGetParameters, type ComponentInstanceHistoryGetResponse, type ComponentLocationReference, type ComponentLocationReferenceV2, type ComponentOverridability, type ComponentOverride, type ComponentOverrides, type ComponentParameter, type ComponentParameterBlock, type ComponentParameterContextualEditing, type ComponentParameterEnhancer, type ComponentParameterEnhancerFunction, type ComponentParameterEnhancerOptions, type CompositionDataDiagnostic, type CompositionDeleteParameters, type CompositionDiagnostics, type CompositionFilters, type CompositionGetByComponentIdParameters, type CompositionGetByIdParameters, type CompositionGetByNodeIdParameters, type CompositionGetByNodePathParameters, type CompositionGetBySlugParameters, type CompositionGetListResponse, type CompositionGetOrderBy, type CompositionGetParameters, type CompositionGetResponse, type CompositionGetValidResponses, type CompositionIssue, type CompositionPatternIssue, type CompositionPutParameters, type CompositionResolvedGetResponse, type CompositionResolvedListResponse, type CompositionUIStatus, ContentClient, type ContentType, type ContentTypeField, type ContextualEditingComponentReference, type CopiedComponentSubtree, type DataDiagnostic, type DataElementBindingIssue, type DataElementConnectionDefinition, type DataElementConnectionFailureAction, type DataElementConnectionFailureLogLevel, type DataResolutionConfigIssue, type DataResolutionIssue, type DataResolutionOption, type DataResolutionOptionNegative, type DataResolutionOptionPositive, type DataResolutionParameters, type DataResourceDefinition, type DataResourceDefinitions, type DataResourceIssue, type DataResourceVariables, type DataSource, DataSourceClient, type DataSourceDeleteParameters, type DataSourceGetParameters, type DataSourceGetResponse, type DataSourcePutParameters, type DataSourcesGetParameters, type DataSourcesGetResponse, type DataType, DataTypeClient, type DataTypeDeleteParameters, type DataTypeGetParameters, type DataTypeGetResponse, type DataTypePutParameters, type DataVariableDefinition, type DataWithProperties, type DeleteContentTypeOptions, type DeleteEntryOptions, type DismissPlaceholderMessage, type DynamicInputIssue, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_MAX_CACHE_TTL, EDGE_MIN_CACHE_TTL, EMPTY_COMPOSITION, type EdgehancersDiagnostics, type EdgehancersWholeResponseCacheDiagnostics, type EditorStateUpdatedMessage, EnhancerBuilder, type EnhancerContext, type EnhancerError, EntityReleasesClient, type EntityReleasesGetParameters, type EntityReleasesGetResponse, type EntriesGetParameters, type EntriesGetResponse, type EntriesHistoryGetParameters, type EntriesHistoryGetResponse, type EntriesResolvedListResponse, type Entry, type EntryData, type EntryFilters, type EntryList, type EventNames, type Filters, type FindInNodeTreeReference, type FlattenProperty, type FlattenValues, type FlattenValuesOptions, type GetContentTypesOptions, type GetContentTypesResponse, type GetEntriesOptions, type GetEntriesResponse, type GetParameterAttributesProps, IN_CONTEXT_EDITOR_COMPONENT_END_ROLE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID, IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, IS_RENDERED_BY_UNIFORM_ATTRIBUTE, type InvalidationPayload, LOCALE_DYNAMIC_INPUT_NAME, type LimitPolicy, type LinkComponentParameterValue, type LinkParamConfiguration, type LinkParamValue, type LinkParameterType, type LinkTypeConfiguration, type Locale, LocaleClient, type LocaleDeleteParameters, type LocalePutParameters, type LocalesGetParameters, type LocalesGetResponse, type LocalizeDeprecatedOptions, type LocalizeModernOptions, type MessageHandler, type MoveComponentMessage, type NodeLocationReference, type NonProjectMapLinkParamValue, type OpenParameterEditorMessage, type OverrideOptions, PLACEHOLDER_ID, type PatternIssue, type PreviewEventBus, type PreviewPanelSettings, type ProjectMapLinkComponentParameterValue, type ProjectMapLinkParamValue, type Prompt, PromptClient, type PromptsDeleteParameters, type PromptsGetParameters, type PromptsGetResponse, type PromptsPutParameters, type PutContentTypeBody, type PutEntryBody, type ReadyMessage, RelationshipClient, type RelationshipResultInstance, type Release, ReleaseClient, type ReleaseContent, ReleaseContentsClient, type ReleaseContentsDeleteBody, type ReleaseContentsGetParameters, type ReleaseContentsGetResponse, type ReleaseDeleteParameters, type ReleasePatchParameters, type ReleasePutParameters, type ReleaseState, type ReleasesGetParameters, type ReleasesGetResponse, type ReportRenderedCompositionsMessage, type RequestComponentSuggestionMessage, type ResolvedRouteGetResponse, type RichTextBuiltInElement, type RichTextBuiltInFormat, type RichTextParamConfiguration, type RichTextParamValue, type RootComponentInstance, type RootEntryReference, type RootLocationReference, RouteClient, type RouteDynamicInputs, type RouteGetParameters, type RouteGetResponse, type RouteGetResponseComposition, type RouteGetResponseEdgehancedComposition, type RouteGetResponseEdgehancedNotFound, type RouteGetResponseNotFound, type RouteGetResponseRedirect, SECRET_QUERY_STRING_PARAM, type SelectComponentMessage, type SelectParameterMessage, type SpecificProjectMap, type SubscribeToCompositionOptions, type SuggestComponentMessage, type TreeNodeInfoTypes, type TriggerComponentActionMessage, type TriggerCompositionActionMessage, UncachedCanvasClient, UncachedCategoryClient, UncachedContentClient, UniqueBatchEntries, type UnsubscribeCallback, type UpdateComponentParameterMessage, type UpdateComponentReferencesMessage, type UpdateCompositionInternalMessage, type UpdateCompositionMessage, type UpdateContextualEditingStateInternalMessage, type UpdateFeatureFlagsMessage, type UpdatePreviewSettingsMessage, type WalkComponentTreeActions, type WalkNodeTreeActions, type WalkNodeTreeOptions, WorkflowClient, type WorkflowDefinition, type WorkflowStage, type WorkflowStagePermission, type WorkflowStageTransition, type WorkflowStageTransitionPermission, type WorkflowsDeleteParameters, type WorkflowsGetParameters, type WorkflowsGetResponse, type WorkflowsPutParameters, bindVariables, bindVariablesToObject, compose, convertEntryToPutEntry, createBatchEnhancer, createCanvasChannel, createEventBus, createLimitPolicy, createUniformApiEnhancer, createVariableReference, enhance, extractLocales, findParameterInNodeTree, flattenValues, generateComponentPlaceholderId, generateHash, getBlockValue, getChannelName, getComponentJsonPointer, getComponentPath, getLocalizedPropertyValues, getNounForLocation, getNounForNode, getParameterAttributes, getPropertiesValue, getPropertyValue, isAddComponentMessage, isAllowedReferrer, isAssetParamValue, isAssetParamValueItem, isComponentActionMessage, isComponentPlaceholderId, isDismissPlaceholderMessage, isEntryData, isMovingComponentMessage, isNestedNodeType, isOpenParameterEditorMessage, isReadyMessage, isReportRenderedCompositionsMessage, isRequestComponentSuggestionMessage, isRootEntryReference, isSelectComponentMessage, isSelectParameterMessage, isSuggestComponentMessage, isSystemComponentDefinition, isTriggerCompositionActionMessage, isUpdateComponentParameterMessage, isUpdateComponentReferencesMessage, isUpdateCompositionInternalMessage, isUpdateCompositionMessage, isUpdateContextualEditingStateInternalMessage, isUpdateFeatureFlagsMessage, isUpdatePreviewSettingsMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, parseComponentPlaceholderId, parseVariableExpression, subscribeToComposition, walkComponentTree, walkNodeTree };
26548
+ export { ASSETS_SOURCE_CUSTOM_URL, ASSETS_SOURCE_UNIFORM, ASSET_PARAMETER_TYPE, ATTRIBUTE_COMPONENT_ID, ATTRIBUTE_MULTILINE, ATTRIBUTE_PARAMETER_ID, ATTRIBUTE_PARAMETER_TYPE, ATTRIBUTE_PARAMETER_VALUE, ATTRIBUTE_PLACEHOLDER, type AddComponentMessage, type AssetParamValue, type AssetParamValueItem, type BatchEnhancer, BatchEntry, type BatchInvalidationPayload, type BindVariablesOptions, type BindVariablesResult, type BindVariablesToObjectOptions, type BlockLocationReference, type BlockValue, CANVAS_BLOCK_PARAM_TYPE, CANVAS_DRAFT_STATE, CANVAS_EDITOR_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_SLOT_SECTION_SLOT, CANVAS_SLOT_SECTION_TYPE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CANVAS_VIZ_CONTROL_PARAM, CANVAS_VIZ_DI_RULE, CANVAS_VIZ_LOCALE_RULE, CanvasClient, CanvasClientError, type CanvasDefinitions, type CategoriesDeleteParameters, type CategoriesGetParameters, type CategoriesGetResponse, type CategoriesPutParameters, type Category, CategoryClient, type Channel, type ChannelMessage, type ChannelSubscription, ChildEnhancerBuilder, type ComponentDefinition, type ComponentDefinitionDeleteParameters, type ComponentDefinitionGetParameters, type ComponentDefinitionGetResponse, type ComponentDefinitionParameter, type ComponentDefinitionPermission, type ComponentDefinitionPutParameters, type ComponentDefinitionSlot, type ComponentDefinitionSlugSettings, type ComponentDefinitionVariant, type ComponentEnhancer, type ComponentEnhancerFunction, type ComponentEnhancerOptions, type ComponentInstance, type ComponentInstanceContextualEditing, type ComponentInstanceHistoryEntry, type ComponentInstanceHistoryGetParameters, type ComponentInstanceHistoryGetResponse, type ComponentLocationReference, type ComponentLocationReferenceV2, type ComponentOverridability, type ComponentOverride, type ComponentOverrides, type ComponentParameter, type ComponentParameterBlock, type ComponentParameterContextualEditing, type ComponentParameterEnhancer, type ComponentParameterEnhancerFunction, type ComponentParameterEnhancerOptions, type CompositionDataDiagnostic, type CompositionDeleteParameters, type CompositionDiagnostics, type CompositionFilters, type CompositionGetByComponentIdParameters, type CompositionGetByIdParameters, type CompositionGetByNodeIdParameters, type CompositionGetByNodePathParameters, type CompositionGetBySlugParameters, type CompositionGetListResponse, type CompositionGetOrderBy, type CompositionGetParameters, type CompositionGetResponse, type CompositionGetValidResponses, type CompositionIssue, type CompositionPatternIssue, type CompositionPutParameters, type CompositionResolvedGetResponse, type CompositionResolvedListResponse, type CompositionUIStatus, ContentClient, type ContentType, type ContentTypeField, type ContextualEditingComponentReference, type CopiedComponentSubtree, type DataDiagnostic, type DataElementBindingIssue, type DataElementConnectionDefinition, type DataElementConnectionFailureAction, type DataElementConnectionFailureLogLevel, type DataResolutionConfigIssue, type DataResolutionIssue, type DataResolutionOption, type DataResolutionOptionNegative, type DataResolutionOptionPositive, type DataResolutionParameters, type DataResourceDefinition, type DataResourceDefinitions, type DataResourceIssue, type DataResourceVariables, type DataSource, DataSourceClient, type DataSourceDeleteParameters, type DataSourceGetParameters, type DataSourceGetResponse, type DataSourcePutParameters, type DataSourcesGetParameters, type DataSourcesGetResponse, type DataType, DataTypeClient, type DataTypeDeleteParameters, type DataTypeGetParameters, type DataTypeGetResponse, type DataTypePutParameters, type DataVariableDefinition, type DataWithProperties, type DeleteContentTypeOptions, type DeleteEntryOptions, type DismissPlaceholderMessage, type DynamicInputIssue, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_MAX_CACHE_TTL, EDGE_MIN_CACHE_TTL, EMPTY_COMPOSITION, type EdgehancersDiagnostics, type EdgehancersWholeResponseCacheDiagnostics, type EditorStateUpdatedMessage, EnhancerBuilder, type EnhancerContext, type EnhancerError, EntityReleasesClient, type EntityReleasesGetParameters, type EntityReleasesGetResponse, type EntriesGetParameters, type EntriesGetResponse, type EntriesHistoryGetParameters, type EntriesHistoryGetResponse, type EntriesResolvedListResponse, type Entry, type EntryData, type EntryFilters, type EntryList, type EvaluateCriteriaGroupOptions, type EvaluateNodeTreeVisibilityOptions, type EventNames, type Filters, type FindInNodeTreeReference, type FlattenProperty, type FlattenValues, type FlattenValuesOptions, type GetContentTypesOptions, type GetContentTypesResponse, type GetEntriesOptions, type GetEntriesResponse, type GetParameterAttributesProps, IN_CONTEXT_EDITOR_COMPONENT_END_ROLE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID, IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, IS_RENDERED_BY_UNIFORM_ATTRIBUTE, type InvalidationPayload, LOCALE_DYNAMIC_INPUT_NAME, type LimitPolicy, type LinkComponentParameterValue, type LinkParamConfiguration, type LinkParamValue, type LinkParameterType, type LinkTypeConfiguration, type Locale, LocaleClient, type LocaleDeleteParameters, type LocalePutParameters, type LocalesGetParameters, type LocalesGetResponse, type LocalizeDeprecatedOptions, type LocalizeModernOptions, type MessageHandler, type MoveComponentMessage, type NodeLocationReference, type NonProjectMapLinkParamValue, type OpenParameterEditorMessage, type OverrideOptions, PLACEHOLDER_ID, type PatternIssue, type PreviewEventBus, type PreviewPanelSettings, type ProjectMapLinkComponentParameterValue, type ProjectMapLinkParamValue, type Prompt, PromptClient, type PromptsDeleteParameters, type PromptsGetParameters, type PromptsGetResponse, type PromptsPutParameters, type PutContentTypeBody, type PutEntryBody, type ReadyMessage, RelationshipClient, type RelationshipResultInstance, type Release, ReleaseClient, type ReleaseContent, ReleaseContentsClient, type ReleaseContentsDeleteBody, type ReleaseContentsGetParameters, type ReleaseContentsGetResponse, type ReleaseDeleteParameters, type ReleasePatchParameters, type ReleasePutParameters, type ReleaseState, type ReleasesGetParameters, type ReleasesGetResponse, type ReportRenderedCompositionsMessage, type RequestComponentSuggestionMessage, type ResolvedRouteGetResponse, type RichTextBuiltInElement, type RichTextBuiltInFormat, type RichTextParamConfiguration, type RichTextParamValue, type RootComponentInstance, type RootEntryReference, type RootLocationReference, RouteClient, type RouteDynamicInputs, type RouteGetParameters, type RouteGetResponse, type RouteGetResponseComposition, type RouteGetResponseEdgehancedComposition, type RouteGetResponseEdgehancedNotFound, type RouteGetResponseNotFound, type RouteGetResponseRedirect, SECRET_QUERY_STRING_PARAM, type SelectComponentMessage, type SelectParameterMessage, type SpecificProjectMap, type StringOperators, type SubscribeToCompositionOptions, type SuggestComponentMessage, type TreeNodeInfoTypes, type TriggerComponentActionMessage, type TriggerCompositionActionMessage, UncachedCanvasClient, UncachedCategoryClient, UncachedContentClient, UniqueBatchEntries, type UnsubscribeCallback, type UpdateComponentParameterMessage, type UpdateComponentReferencesMessage, type UpdateCompositionInternalMessage, type UpdateCompositionMessage, type UpdateContextualEditingStateInternalMessage, type UpdateFeatureFlagsMessage, type UpdatePreviewSettingsMessage, type VisibilityCriteria, type VisibilityCriteriaEvaluationResult, type VisibilityCriteriaGroup, type VisibilityParameterValue, type VisibilityRule, type VisibilityRules, type WalkComponentTreeActions, type WalkNodeTreeActions, type WalkNodeTreeOptions, WorkflowClient, type WorkflowDefinition, type WorkflowStage, type WorkflowStagePermission, type WorkflowStageTransition, type WorkflowStageTransitionPermission, type WorkflowsDeleteParameters, type WorkflowsGetParameters, type WorkflowsGetResponse, type WorkflowsPutParameters, bindVariables, bindVariablesToObject, compose, convertEntryToPutEntry, createBatchEnhancer, createCanvasChannel, createDynamicInputVisibilityRule, createEventBus, createLimitPolicy, createLocaleVisibilityRule, createUniformApiEnhancer, createVariableReference, enhance, evaluateVisibilityCriteriaGroup, evaluateWalkTreeVisibility, extractLocales, findParameterInNodeTree, flattenValues, generateComponentPlaceholderId, generateHash, getBlockValue, getChannelName, getComponentJsonPointer, getComponentPath, getLocalizedPropertyValues, getNounForLocation, getNounForNode, getParameterAttributes, getPropertiesValue, getPropertyValue, isAddComponentMessage, isAllowedReferrer, isAssetParamValue, isAssetParamValueItem, isComponentActionMessage, isComponentPlaceholderId, isDismissPlaceholderMessage, isEntryData, isMovingComponentMessage, isNestedNodeType, isOpenParameterEditorMessage, isReadyMessage, isReportRenderedCompositionsMessage, isRequestComponentSuggestionMessage, isRootEntryReference, isSelectComponentMessage, isSelectParameterMessage, isSuggestComponentMessage, isSystemComponentDefinition, isTriggerCompositionActionMessage, isUpdateComponentParameterMessage, isUpdateComponentReferencesMessage, isUpdateCompositionInternalMessage, isUpdateCompositionMessage, isUpdateContextualEditingStateInternalMessage, isUpdateFeatureFlagsMessage, isUpdatePreviewSettingsMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, parseComponentPlaceholderId, parseVariableExpression, subscribeToComposition, walkComponentTree, walkNodeTree };
package/dist/index.d.ts CHANGED
@@ -25491,6 +25491,9 @@ declare function localize(options: LocalizeDeprecatedOptions): void;
25491
25491
  *
25492
25492
  * NOTE: this function mutates its input object for maximum performance.
25493
25493
  * If you desire immutability wrap it in immer.
25494
+ *
25495
+ * NOTE: this function is only necessary when content has been fetched in more than one locale from the Uniform API.
25496
+ * If a locale was provided to the Uniform API, the content will already be localized in the desired locale.
25494
25497
  */
25495
25498
  declare function localize(options: LocalizeModernOptions): void;
25496
25499
 
@@ -25511,6 +25514,106 @@ declare class UniqueBatchEntries<TArgs, TResult> {
25511
25514
  resolveRemaining(value: TResult): void;
25512
25515
  }
25513
25516
 
25517
+ declare const CANVAS_VIZ_CONTROL_PARAM = "$viz";
25518
+ /**
25519
+ * @deprecated beta functionality subject to change
25520
+ */
25521
+ type VisibilityRules = {
25522
+ [rule: string]: VisibilityRule;
25523
+ };
25524
+ /**
25525
+ * @deprecated beta functionality subject to change
25526
+ */
25527
+ type VisibilityRule = (criteria: VisibilityCriteria) => VisibilityCriteriaEvaluationResult;
25528
+ /**
25529
+ * @deprecated beta functionality subject to change
25530
+ */
25531
+ type VisibilityParameterValue = {
25532
+ /**
25533
+ * Overrides any criteria value and hides the component explicitly
25534
+ * (e.g. for unfinished content)
25535
+ */
25536
+ explicitlyHidden?: boolean;
25537
+ /** Criteria for the visibility of the component. If these evaluate to false, the component is hidden. */
25538
+ criteria?: VisibilityCriteriaGroup;
25539
+ };
25540
+ /**
25541
+ * @deprecated beta functionality subject to change
25542
+ */
25543
+ type VisibilityCriteriaGroup = {
25544
+ /** The boolean operator to join the clauses with. Defaults to & if not specified. */
25545
+ op?: '&' | '|';
25546
+ clauses: Array<VisibilityCriteria | VisibilityCriteriaGroup>;
25547
+ };
25548
+ /**
25549
+ * @deprecated beta functionality subject to change
25550
+ */
25551
+ type VisibilityCriteria = {
25552
+ /** The rule type to execute */
25553
+ rule: string;
25554
+ /** The source value of the rule. For rules which have multiple classes of match, for example a dynamic input matches on a named DI. The rule is dynamic input. The DI name is the source. */
25555
+ source?: string;
25556
+ /** The rule-definition-specific operator to test against */
25557
+ op: string;
25558
+ /** The value, or if an array several potential values, to test against. In most rules, multiple values are OR'd together ('any of') but this is not a hard requirement. */
25559
+ value: string | string[];
25560
+ };
25561
+ /**
25562
+ * @deprecated beta functionality subject to change
25563
+ */
25564
+ type VisibilityCriteriaEvaluationResult = boolean | null;
25565
+
25566
+ type EvaluateCriteriaGroupOptions = {
25567
+ /** Visibility rule definitions to evaluate */
25568
+ rules: VisibilityRules;
25569
+ /**
25570
+ * When true, the criteria group passed in will be simplified according to rules which pass or fail,
25571
+ * resulting in a result that only contains indeterminate results.
25572
+ *
25573
+ * If false, the criteria group object will not be modified.
25574
+ */
25575
+ simplifyCriteria?: boolean;
25576
+ /** The criteria group to evaluate */
25577
+ criteriaGroup: VisibilityCriteriaGroup;
25578
+ };
25579
+ /**
25580
+ * @deprecated beta functionality subject to change
25581
+ */
25582
+ declare function evaluateVisibilityCriteriaGroup(options: EvaluateCriteriaGroupOptions): VisibilityCriteriaEvaluationResult;
25583
+
25584
+ interface EvaluateNodeVisibilityOptions extends Omit<EvaluateCriteriaGroupOptions, 'criteriaGroup'> {
25585
+ /** The node to evaluate visibility rules on */
25586
+ node: ComponentInstance;
25587
+ }
25588
+
25589
+ interface EvaluateNodeTreeVisibilityOptions extends Pick<EvaluateNodeVisibilityOptions, 'rules'> {
25590
+ context: TreeNodeInfoTypes<unknown>;
25591
+ /**
25592
+ * Controls the overall result when indeterminate criteria are found
25593
+ * (unknown rule types, or rule evaluators that return null)
25594
+ * When true, indeterminate criteria will not fail the summary result
25595
+ * When false, indeterminate criteria will fail the summary result, and the node will be hidden
25596
+ */
25597
+ showIndeterminate?: boolean;
25598
+ }
25599
+ /**
25600
+ * Function to call to evaluate visibility rules when traversing the node tree with walkNodeTree.
25601
+ *
25602
+ * If the function returns false, that means the current node is removed and you should stop any other code handling.
25603
+ *
25604
+ * @deprecated beta functionality subject to change
25605
+ */
25606
+ declare function evaluateWalkTreeVisibility({ rules, showIndeterminate, context, }: EvaluateNodeTreeVisibilityOptions): boolean | undefined;
25607
+
25608
+ declare const CANVAS_VIZ_DI_RULE = "$di";
25609
+ declare function createDynamicInputVisibilityRule(dynamicInputs: Record<string, string>): VisibilityRules;
25610
+
25611
+ type CoreStringOperators = 'is' | 'has' | 'startswith' | 'endswith' | 'empty';
25612
+ type StringOperators = CoreStringOperators | `!${CoreStringOperators}`;
25613
+
25614
+ declare const CANVAS_VIZ_LOCALE_RULE = "$locale";
25615
+ declare function createLocaleVisibilityRule(currentLocale: string | undefined): VisibilityRules;
25616
+
25514
25617
  /** API client to fetch entity across releases */
25515
25618
  declare class EntityReleasesClient extends ApiClient {
25516
25619
  constructor(options: ClientOptions);
@@ -26442,4 +26545,4 @@ declare class WorkflowClient extends ApiClient {
26442
26545
 
26443
26546
  declare const CanvasClientError: typeof ApiClientError;
26444
26547
 
26445
- export { ASSETS_SOURCE_CUSTOM_URL, ASSETS_SOURCE_UNIFORM, ASSET_PARAMETER_TYPE, ATTRIBUTE_COMPONENT_ID, ATTRIBUTE_MULTILINE, ATTRIBUTE_PARAMETER_ID, ATTRIBUTE_PARAMETER_TYPE, ATTRIBUTE_PARAMETER_VALUE, ATTRIBUTE_PLACEHOLDER, type AddComponentMessage, type AssetParamValue, type AssetParamValueItem, type BatchEnhancer, BatchEntry, type BatchInvalidationPayload, type BindVariablesOptions, type BindVariablesResult, type BindVariablesToObjectOptions, type BlockLocationReference, type BlockValue, CANVAS_BLOCK_PARAM_TYPE, CANVAS_DRAFT_STATE, CANVAS_EDITOR_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_SLOT_SECTION_SLOT, CANVAS_SLOT_SECTION_TYPE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, type CanvasDefinitions, type CategoriesDeleteParameters, type CategoriesGetParameters, type CategoriesGetResponse, type CategoriesPutParameters, type Category, CategoryClient, type Channel, type ChannelMessage, type ChannelSubscription, ChildEnhancerBuilder, type ComponentDefinition, type ComponentDefinitionDeleteParameters, type ComponentDefinitionGetParameters, type ComponentDefinitionGetResponse, type ComponentDefinitionParameter, type ComponentDefinitionPermission, type ComponentDefinitionPutParameters, type ComponentDefinitionSlot, type ComponentDefinitionSlugSettings, type ComponentDefinitionVariant, type ComponentEnhancer, type ComponentEnhancerFunction, type ComponentEnhancerOptions, type ComponentInstance, type ComponentInstanceContextualEditing, type ComponentInstanceHistoryEntry, type ComponentInstanceHistoryGetParameters, type ComponentInstanceHistoryGetResponse, type ComponentLocationReference, type ComponentLocationReferenceV2, type ComponentOverridability, type ComponentOverride, type ComponentOverrides, type ComponentParameter, type ComponentParameterBlock, type ComponentParameterContextualEditing, type ComponentParameterEnhancer, type ComponentParameterEnhancerFunction, type ComponentParameterEnhancerOptions, type CompositionDataDiagnostic, type CompositionDeleteParameters, type CompositionDiagnostics, type CompositionFilters, type CompositionGetByComponentIdParameters, type CompositionGetByIdParameters, type CompositionGetByNodeIdParameters, type CompositionGetByNodePathParameters, type CompositionGetBySlugParameters, type CompositionGetListResponse, type CompositionGetOrderBy, type CompositionGetParameters, type CompositionGetResponse, type CompositionGetValidResponses, type CompositionIssue, type CompositionPatternIssue, type CompositionPutParameters, type CompositionResolvedGetResponse, type CompositionResolvedListResponse, type CompositionUIStatus, ContentClient, type ContentType, type ContentTypeField, type ContextualEditingComponentReference, type CopiedComponentSubtree, type DataDiagnostic, type DataElementBindingIssue, type DataElementConnectionDefinition, type DataElementConnectionFailureAction, type DataElementConnectionFailureLogLevel, type DataResolutionConfigIssue, type DataResolutionIssue, type DataResolutionOption, type DataResolutionOptionNegative, type DataResolutionOptionPositive, type DataResolutionParameters, type DataResourceDefinition, type DataResourceDefinitions, type DataResourceIssue, type DataResourceVariables, type DataSource, DataSourceClient, type DataSourceDeleteParameters, type DataSourceGetParameters, type DataSourceGetResponse, type DataSourcePutParameters, type DataSourcesGetParameters, type DataSourcesGetResponse, type DataType, DataTypeClient, type DataTypeDeleteParameters, type DataTypeGetParameters, type DataTypeGetResponse, type DataTypePutParameters, type DataVariableDefinition, type DataWithProperties, type DeleteContentTypeOptions, type DeleteEntryOptions, type DismissPlaceholderMessage, type DynamicInputIssue, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_MAX_CACHE_TTL, EDGE_MIN_CACHE_TTL, EMPTY_COMPOSITION, type EdgehancersDiagnostics, type EdgehancersWholeResponseCacheDiagnostics, type EditorStateUpdatedMessage, EnhancerBuilder, type EnhancerContext, type EnhancerError, EntityReleasesClient, type EntityReleasesGetParameters, type EntityReleasesGetResponse, type EntriesGetParameters, type EntriesGetResponse, type EntriesHistoryGetParameters, type EntriesHistoryGetResponse, type EntriesResolvedListResponse, type Entry, type EntryData, type EntryFilters, type EntryList, type EventNames, type Filters, type FindInNodeTreeReference, type FlattenProperty, type FlattenValues, type FlattenValuesOptions, type GetContentTypesOptions, type GetContentTypesResponse, type GetEntriesOptions, type GetEntriesResponse, type GetParameterAttributesProps, IN_CONTEXT_EDITOR_COMPONENT_END_ROLE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID, IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, IS_RENDERED_BY_UNIFORM_ATTRIBUTE, type InvalidationPayload, LOCALE_DYNAMIC_INPUT_NAME, type LimitPolicy, type LinkComponentParameterValue, type LinkParamConfiguration, type LinkParamValue, type LinkParameterType, type LinkTypeConfiguration, type Locale, LocaleClient, type LocaleDeleteParameters, type LocalePutParameters, type LocalesGetParameters, type LocalesGetResponse, type LocalizeDeprecatedOptions, type LocalizeModernOptions, type MessageHandler, type MoveComponentMessage, type NodeLocationReference, type NonProjectMapLinkParamValue, type OpenParameterEditorMessage, type OverrideOptions, PLACEHOLDER_ID, type PatternIssue, type PreviewEventBus, type PreviewPanelSettings, type ProjectMapLinkComponentParameterValue, type ProjectMapLinkParamValue, type Prompt, PromptClient, type PromptsDeleteParameters, type PromptsGetParameters, type PromptsGetResponse, type PromptsPutParameters, type PutContentTypeBody, type PutEntryBody, type ReadyMessage, RelationshipClient, type RelationshipResultInstance, type Release, ReleaseClient, type ReleaseContent, ReleaseContentsClient, type ReleaseContentsDeleteBody, type ReleaseContentsGetParameters, type ReleaseContentsGetResponse, type ReleaseDeleteParameters, type ReleasePatchParameters, type ReleasePutParameters, type ReleaseState, type ReleasesGetParameters, type ReleasesGetResponse, type ReportRenderedCompositionsMessage, type RequestComponentSuggestionMessage, type ResolvedRouteGetResponse, type RichTextBuiltInElement, type RichTextBuiltInFormat, type RichTextParamConfiguration, type RichTextParamValue, type RootComponentInstance, type RootEntryReference, type RootLocationReference, RouteClient, type RouteDynamicInputs, type RouteGetParameters, type RouteGetResponse, type RouteGetResponseComposition, type RouteGetResponseEdgehancedComposition, type RouteGetResponseEdgehancedNotFound, type RouteGetResponseNotFound, type RouteGetResponseRedirect, SECRET_QUERY_STRING_PARAM, type SelectComponentMessage, type SelectParameterMessage, type SpecificProjectMap, type SubscribeToCompositionOptions, type SuggestComponentMessage, type TreeNodeInfoTypes, type TriggerComponentActionMessage, type TriggerCompositionActionMessage, UncachedCanvasClient, UncachedCategoryClient, UncachedContentClient, UniqueBatchEntries, type UnsubscribeCallback, type UpdateComponentParameterMessage, type UpdateComponentReferencesMessage, type UpdateCompositionInternalMessage, type UpdateCompositionMessage, type UpdateContextualEditingStateInternalMessage, type UpdateFeatureFlagsMessage, type UpdatePreviewSettingsMessage, type WalkComponentTreeActions, type WalkNodeTreeActions, type WalkNodeTreeOptions, WorkflowClient, type WorkflowDefinition, type WorkflowStage, type WorkflowStagePermission, type WorkflowStageTransition, type WorkflowStageTransitionPermission, type WorkflowsDeleteParameters, type WorkflowsGetParameters, type WorkflowsGetResponse, type WorkflowsPutParameters, bindVariables, bindVariablesToObject, compose, convertEntryToPutEntry, createBatchEnhancer, createCanvasChannel, createEventBus, createLimitPolicy, createUniformApiEnhancer, createVariableReference, enhance, extractLocales, findParameterInNodeTree, flattenValues, generateComponentPlaceholderId, generateHash, getBlockValue, getChannelName, getComponentJsonPointer, getComponentPath, getLocalizedPropertyValues, getNounForLocation, getNounForNode, getParameterAttributes, getPropertiesValue, getPropertyValue, isAddComponentMessage, isAllowedReferrer, isAssetParamValue, isAssetParamValueItem, isComponentActionMessage, isComponentPlaceholderId, isDismissPlaceholderMessage, isEntryData, isMovingComponentMessage, isNestedNodeType, isOpenParameterEditorMessage, isReadyMessage, isReportRenderedCompositionsMessage, isRequestComponentSuggestionMessage, isRootEntryReference, isSelectComponentMessage, isSelectParameterMessage, isSuggestComponentMessage, isSystemComponentDefinition, isTriggerCompositionActionMessage, isUpdateComponentParameterMessage, isUpdateComponentReferencesMessage, isUpdateCompositionInternalMessage, isUpdateCompositionMessage, isUpdateContextualEditingStateInternalMessage, isUpdateFeatureFlagsMessage, isUpdatePreviewSettingsMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, parseComponentPlaceholderId, parseVariableExpression, subscribeToComposition, walkComponentTree, walkNodeTree };
26548
+ export { ASSETS_SOURCE_CUSTOM_URL, ASSETS_SOURCE_UNIFORM, ASSET_PARAMETER_TYPE, ATTRIBUTE_COMPONENT_ID, ATTRIBUTE_MULTILINE, ATTRIBUTE_PARAMETER_ID, ATTRIBUTE_PARAMETER_TYPE, ATTRIBUTE_PARAMETER_VALUE, ATTRIBUTE_PLACEHOLDER, type AddComponentMessage, type AssetParamValue, type AssetParamValueItem, type BatchEnhancer, BatchEntry, type BatchInvalidationPayload, type BindVariablesOptions, type BindVariablesResult, type BindVariablesToObjectOptions, type BlockLocationReference, type BlockValue, CANVAS_BLOCK_PARAM_TYPE, CANVAS_DRAFT_STATE, CANVAS_EDITOR_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_SLOT_SECTION_SLOT, CANVAS_SLOT_SECTION_TYPE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CANVAS_VIZ_CONTROL_PARAM, CANVAS_VIZ_DI_RULE, CANVAS_VIZ_LOCALE_RULE, CanvasClient, CanvasClientError, type CanvasDefinitions, type CategoriesDeleteParameters, type CategoriesGetParameters, type CategoriesGetResponse, type CategoriesPutParameters, type Category, CategoryClient, type Channel, type ChannelMessage, type ChannelSubscription, ChildEnhancerBuilder, type ComponentDefinition, type ComponentDefinitionDeleteParameters, type ComponentDefinitionGetParameters, type ComponentDefinitionGetResponse, type ComponentDefinitionParameter, type ComponentDefinitionPermission, type ComponentDefinitionPutParameters, type ComponentDefinitionSlot, type ComponentDefinitionSlugSettings, type ComponentDefinitionVariant, type ComponentEnhancer, type ComponentEnhancerFunction, type ComponentEnhancerOptions, type ComponentInstance, type ComponentInstanceContextualEditing, type ComponentInstanceHistoryEntry, type ComponentInstanceHistoryGetParameters, type ComponentInstanceHistoryGetResponse, type ComponentLocationReference, type ComponentLocationReferenceV2, type ComponentOverridability, type ComponentOverride, type ComponentOverrides, type ComponentParameter, type ComponentParameterBlock, type ComponentParameterContextualEditing, type ComponentParameterEnhancer, type ComponentParameterEnhancerFunction, type ComponentParameterEnhancerOptions, type CompositionDataDiagnostic, type CompositionDeleteParameters, type CompositionDiagnostics, type CompositionFilters, type CompositionGetByComponentIdParameters, type CompositionGetByIdParameters, type CompositionGetByNodeIdParameters, type CompositionGetByNodePathParameters, type CompositionGetBySlugParameters, type CompositionGetListResponse, type CompositionGetOrderBy, type CompositionGetParameters, type CompositionGetResponse, type CompositionGetValidResponses, type CompositionIssue, type CompositionPatternIssue, type CompositionPutParameters, type CompositionResolvedGetResponse, type CompositionResolvedListResponse, type CompositionUIStatus, ContentClient, type ContentType, type ContentTypeField, type ContextualEditingComponentReference, type CopiedComponentSubtree, type DataDiagnostic, type DataElementBindingIssue, type DataElementConnectionDefinition, type DataElementConnectionFailureAction, type DataElementConnectionFailureLogLevel, type DataResolutionConfigIssue, type DataResolutionIssue, type DataResolutionOption, type DataResolutionOptionNegative, type DataResolutionOptionPositive, type DataResolutionParameters, type DataResourceDefinition, type DataResourceDefinitions, type DataResourceIssue, type DataResourceVariables, type DataSource, DataSourceClient, type DataSourceDeleteParameters, type DataSourceGetParameters, type DataSourceGetResponse, type DataSourcePutParameters, type DataSourcesGetParameters, type DataSourcesGetResponse, type DataType, DataTypeClient, type DataTypeDeleteParameters, type DataTypeGetParameters, type DataTypeGetResponse, type DataTypePutParameters, type DataVariableDefinition, type DataWithProperties, type DeleteContentTypeOptions, type DeleteEntryOptions, type DismissPlaceholderMessage, type DynamicInputIssue, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_MAX_CACHE_TTL, EDGE_MIN_CACHE_TTL, EMPTY_COMPOSITION, type EdgehancersDiagnostics, type EdgehancersWholeResponseCacheDiagnostics, type EditorStateUpdatedMessage, EnhancerBuilder, type EnhancerContext, type EnhancerError, EntityReleasesClient, type EntityReleasesGetParameters, type EntityReleasesGetResponse, type EntriesGetParameters, type EntriesGetResponse, type EntriesHistoryGetParameters, type EntriesHistoryGetResponse, type EntriesResolvedListResponse, type Entry, type EntryData, type EntryFilters, type EntryList, type EvaluateCriteriaGroupOptions, type EvaluateNodeTreeVisibilityOptions, type EventNames, type Filters, type FindInNodeTreeReference, type FlattenProperty, type FlattenValues, type FlattenValuesOptions, type GetContentTypesOptions, type GetContentTypesResponse, type GetEntriesOptions, type GetEntriesResponse, type GetParameterAttributesProps, IN_CONTEXT_EDITOR_COMPONENT_END_ROLE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID, IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, IS_RENDERED_BY_UNIFORM_ATTRIBUTE, type InvalidationPayload, LOCALE_DYNAMIC_INPUT_NAME, type LimitPolicy, type LinkComponentParameterValue, type LinkParamConfiguration, type LinkParamValue, type LinkParameterType, type LinkTypeConfiguration, type Locale, LocaleClient, type LocaleDeleteParameters, type LocalePutParameters, type LocalesGetParameters, type LocalesGetResponse, type LocalizeDeprecatedOptions, type LocalizeModernOptions, type MessageHandler, type MoveComponentMessage, type NodeLocationReference, type NonProjectMapLinkParamValue, type OpenParameterEditorMessage, type OverrideOptions, PLACEHOLDER_ID, type PatternIssue, type PreviewEventBus, type PreviewPanelSettings, type ProjectMapLinkComponentParameterValue, type ProjectMapLinkParamValue, type Prompt, PromptClient, type PromptsDeleteParameters, type PromptsGetParameters, type PromptsGetResponse, type PromptsPutParameters, type PutContentTypeBody, type PutEntryBody, type ReadyMessage, RelationshipClient, type RelationshipResultInstance, type Release, ReleaseClient, type ReleaseContent, ReleaseContentsClient, type ReleaseContentsDeleteBody, type ReleaseContentsGetParameters, type ReleaseContentsGetResponse, type ReleaseDeleteParameters, type ReleasePatchParameters, type ReleasePutParameters, type ReleaseState, type ReleasesGetParameters, type ReleasesGetResponse, type ReportRenderedCompositionsMessage, type RequestComponentSuggestionMessage, type ResolvedRouteGetResponse, type RichTextBuiltInElement, type RichTextBuiltInFormat, type RichTextParamConfiguration, type RichTextParamValue, type RootComponentInstance, type RootEntryReference, type RootLocationReference, RouteClient, type RouteDynamicInputs, type RouteGetParameters, type RouteGetResponse, type RouteGetResponseComposition, type RouteGetResponseEdgehancedComposition, type RouteGetResponseEdgehancedNotFound, type RouteGetResponseNotFound, type RouteGetResponseRedirect, SECRET_QUERY_STRING_PARAM, type SelectComponentMessage, type SelectParameterMessage, type SpecificProjectMap, type StringOperators, type SubscribeToCompositionOptions, type SuggestComponentMessage, type TreeNodeInfoTypes, type TriggerComponentActionMessage, type TriggerCompositionActionMessage, UncachedCanvasClient, UncachedCategoryClient, UncachedContentClient, UniqueBatchEntries, type UnsubscribeCallback, type UpdateComponentParameterMessage, type UpdateComponentReferencesMessage, type UpdateCompositionInternalMessage, type UpdateCompositionMessage, type UpdateContextualEditingStateInternalMessage, type UpdateFeatureFlagsMessage, type UpdatePreviewSettingsMessage, type VisibilityCriteria, type VisibilityCriteriaEvaluationResult, type VisibilityCriteriaGroup, type VisibilityParameterValue, type VisibilityRule, type VisibilityRules, type WalkComponentTreeActions, type WalkNodeTreeActions, type WalkNodeTreeOptions, WorkflowClient, type WorkflowDefinition, type WorkflowStage, type WorkflowStagePermission, type WorkflowStageTransition, type WorkflowStageTransitionPermission, type WorkflowsDeleteParameters, type WorkflowsGetParameters, type WorkflowsGetResponse, type WorkflowsPutParameters, bindVariables, bindVariablesToObject, compose, convertEntryToPutEntry, createBatchEnhancer, createCanvasChannel, createDynamicInputVisibilityRule, createEventBus, createLimitPolicy, createLocaleVisibilityRule, createUniformApiEnhancer, createVariableReference, enhance, evaluateVisibilityCriteriaGroup, evaluateWalkTreeVisibility, extractLocales, findParameterInNodeTree, flattenValues, generateComponentPlaceholderId, generateHash, getBlockValue, getChannelName, getComponentJsonPointer, getComponentPath, getLocalizedPropertyValues, getNounForLocation, getNounForNode, getParameterAttributes, getPropertiesValue, getPropertyValue, isAddComponentMessage, isAllowedReferrer, isAssetParamValue, isAssetParamValueItem, isComponentActionMessage, isComponentPlaceholderId, isDismissPlaceholderMessage, isEntryData, isMovingComponentMessage, isNestedNodeType, isOpenParameterEditorMessage, isReadyMessage, isReportRenderedCompositionsMessage, isRequestComponentSuggestionMessage, isRootEntryReference, isSelectComponentMessage, isSelectParameterMessage, isSuggestComponentMessage, isSystemComponentDefinition, isTriggerCompositionActionMessage, isUpdateComponentParameterMessage, isUpdateComponentReferencesMessage, isUpdateCompositionInternalMessage, isUpdateCompositionMessage, isUpdateContextualEditingStateInternalMessage, isUpdateFeatureFlagsMessage, isUpdatePreviewSettingsMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, parseComponentPlaceholderId, parseVariableExpression, subscribeToComposition, walkComponentTree, walkNodeTree };
package/dist/index.esm.js CHANGED
@@ -1608,6 +1608,174 @@ function findParameterInNodeTree(data, predicate) {
1608
1608
  return results;
1609
1609
  }
1610
1610
 
1611
+ // src/enhancement/visibility/evaluateVisibilityCriteriaGroup.ts
1612
+ function evaluateVisibilityCriteriaGroup(options) {
1613
+ const { criteriaGroup, simplifyCriteria } = options;
1614
+ const earlyExitResult = criteriaGroup.op === "&" || !criteriaGroup.op ? false : true;
1615
+ let hasIndeterminateClauses = false;
1616
+ for (let index = criteriaGroup.clauses.length - 1; index >= 0; index--) {
1617
+ const clause = criteriaGroup.clauses[index];
1618
+ const criteriaResult = evaluateCriterion(clause, options);
1619
+ if (criteriaResult === null) {
1620
+ hasIndeterminateClauses = true;
1621
+ } else if (criteriaResult === earlyExitResult) {
1622
+ return earlyExitResult;
1623
+ } else if (criteriaResult !== null && simplifyCriteria) {
1624
+ criteriaGroup.clauses.splice(index, 1);
1625
+ }
1626
+ }
1627
+ return hasIndeterminateClauses ? null : !earlyExitResult;
1628
+ }
1629
+ function evaluateCriterion(clause, rootOptions) {
1630
+ if ("clauses" in clause) {
1631
+ return evaluateVisibilityCriteriaGroup({
1632
+ ...rootOptions,
1633
+ criteriaGroup: clause
1634
+ });
1635
+ }
1636
+ const rule = rootOptions.rules[clause.rule];
1637
+ if (rule) {
1638
+ return rule(clause);
1639
+ }
1640
+ return null;
1641
+ }
1642
+
1643
+ // src/enhancement/visibility/types.ts
1644
+ var CANVAS_VIZ_CONTROL_PARAM = "$viz";
1645
+
1646
+ // src/enhancement/visibility/evaluateNodeVisibility.ts
1647
+ function evaluateNodeVisibility({
1648
+ node,
1649
+ ...evaluateGroupOptions
1650
+ }) {
1651
+ var _a;
1652
+ const properties = getPropertiesValue(node);
1653
+ const vizCriteria = (_a = properties == null ? void 0 : properties[CANVAS_VIZ_CONTROL_PARAM]) == null ? void 0 : _a.value;
1654
+ if (vizCriteria == null ? void 0 : vizCriteria.explicitlyHidden) {
1655
+ return false;
1656
+ }
1657
+ if (!(vizCriteria == null ? void 0 : vizCriteria.criteria)) {
1658
+ return true;
1659
+ }
1660
+ const result = evaluateVisibilityCriteriaGroup({
1661
+ ...evaluateGroupOptions,
1662
+ criteriaGroup: vizCriteria.criteria
1663
+ });
1664
+ if (vizCriteria.criteria.clauses.length === 0 && evaluateGroupOptions.simplifyCriteria) {
1665
+ properties == null ? true : delete properties[CANVAS_VIZ_CONTROL_PARAM];
1666
+ }
1667
+ return result;
1668
+ }
1669
+
1670
+ // src/enhancement/visibility/evaluateWalkTreeVisibility.ts
1671
+ function evaluateWalkTreeVisibility({
1672
+ rules,
1673
+ showIndeterminate,
1674
+ context
1675
+ }) {
1676
+ const { type, node, actions } = context;
1677
+ if (type !== "component") {
1678
+ return;
1679
+ }
1680
+ const result = evaluateNodeVisibility({ node, rules, simplifyCriteria: true });
1681
+ if (result === null && !showIndeterminate || result === false) {
1682
+ actions.remove();
1683
+ return false;
1684
+ }
1685
+ return true;
1686
+ }
1687
+
1688
+ // src/enhancement/visibility/rules/evaluateStringMatch.ts
1689
+ var isEvaluator = (criteria, matchValue) => {
1690
+ if (Array.isArray(criteria)) {
1691
+ return criteria.includes(matchValue);
1692
+ }
1693
+ return criteria === matchValue;
1694
+ };
1695
+ var containsEvaluator = (criteria, matchValue) => {
1696
+ if (Array.isArray(criteria)) {
1697
+ return criteria.some((criterion) => matchValue.includes(criterion));
1698
+ }
1699
+ return matchValue.includes(criteria);
1700
+ };
1701
+ var startsWithEvaluator = (criteria, matchValue) => {
1702
+ if (Array.isArray(criteria)) {
1703
+ return criteria.some((criterion) => matchValue.startsWith(criterion));
1704
+ }
1705
+ return matchValue.startsWith(criteria);
1706
+ };
1707
+ var endsWithEvaluator = (criteria, matchValue) => {
1708
+ if (Array.isArray(criteria)) {
1709
+ return criteria.some((criterion) => matchValue.endsWith(criterion));
1710
+ }
1711
+ return matchValue.endsWith(criteria);
1712
+ };
1713
+ var emptyEvaluator = (_, matchValue) => {
1714
+ return matchValue === "";
1715
+ };
1716
+ var stringOperatorEvaluators = {
1717
+ is: isEvaluator,
1718
+ has: containsEvaluator,
1719
+ startswith: startsWithEvaluator,
1720
+ endswith: endsWithEvaluator,
1721
+ empty: emptyEvaluator
1722
+ };
1723
+ function evaluateStringMatch(criteria, matchValue, allow) {
1724
+ const { op, value } = criteria;
1725
+ if (allow && !allow.has(op)) {
1726
+ return null;
1727
+ }
1728
+ let opMatch = op;
1729
+ const negation = op.startsWith("!");
1730
+ if (negation) {
1731
+ opMatch = opMatch.slice(1);
1732
+ }
1733
+ const evaluator = stringOperatorEvaluators[opMatch];
1734
+ if (!evaluator) {
1735
+ return null;
1736
+ }
1737
+ const result = evaluator(value, matchValue);
1738
+ return negation ? !result : result;
1739
+ }
1740
+
1741
+ // src/enhancement/visibility/rules/dynamicInputVisibilityRule.ts
1742
+ var dynamicInputVisibilityOperators = /* @__PURE__ */ new Set([
1743
+ "is",
1744
+ "!is",
1745
+ "has",
1746
+ "!has",
1747
+ "startswith",
1748
+ "!startswith",
1749
+ "endswith",
1750
+ "!endswith",
1751
+ "empty",
1752
+ "!empty"
1753
+ ]);
1754
+ var CANVAS_VIZ_DI_RULE = "$di";
1755
+ function createDynamicInputVisibilityRule(dynamicInputs) {
1756
+ return {
1757
+ [CANVAS_VIZ_DI_RULE]: (criterion) => {
1758
+ const { source } = criterion;
1759
+ const diValue = source ? dynamicInputs[source] : void 0;
1760
+ return evaluateStringMatch(criterion, diValue != null ? diValue : "", dynamicInputVisibilityOperators);
1761
+ }
1762
+ };
1763
+ }
1764
+
1765
+ // src/enhancement/visibility/rules/localeVisibilityRule.ts
1766
+ var localeVisibilityOperators = /* @__PURE__ */ new Set(["is", "!is"]);
1767
+ var CANVAS_VIZ_LOCALE_RULE = "$locale";
1768
+ function createLocaleVisibilityRule(currentLocale) {
1769
+ return {
1770
+ [CANVAS_VIZ_LOCALE_RULE]: (criterion) => {
1771
+ if (!currentLocale) {
1772
+ return false;
1773
+ }
1774
+ return evaluateStringMatch(criterion, currentLocale, localeVisibilityOperators);
1775
+ }
1776
+ };
1777
+ }
1778
+
1611
1779
  // src/enhancement/localize.ts
1612
1780
  function extractLocales({ component }) {
1613
1781
  var _a;
@@ -1626,17 +1794,29 @@ function extractLocales({ component }) {
1626
1794
  function localize(options) {
1627
1795
  const nodes = "nodes" in options ? options.nodes : options.composition;
1628
1796
  const locale = options.locale;
1629
- walkNodeTree(nodes, ({ type, node, actions }) => {
1797
+ const isUsingModernOptions = typeof locale === "string";
1798
+ const vizControlLocaleRule = isUsingModernOptions ? createLocaleVisibilityRule(locale) : {};
1799
+ walkNodeTree(nodes, (context) => {
1800
+ const { type, node, actions } = context;
1630
1801
  if (type !== "component") {
1631
- if (typeof locale === "string") {
1802
+ if (isUsingModernOptions) {
1632
1803
  localizeProperties(node.fields, locale);
1633
1804
  }
1634
1805
  return;
1635
1806
  }
1636
- const shouldRunPropertyLocalization = typeof locale === "string";
1807
+ if (isUsingModernOptions) {
1808
+ const result = evaluateWalkTreeVisibility({
1809
+ context,
1810
+ rules: vizControlLocaleRule,
1811
+ showIndeterminate: true
1812
+ });
1813
+ if (!result) {
1814
+ return;
1815
+ }
1816
+ }
1637
1817
  if (node.type === CANVAS_LOCALIZATION_TYPE) {
1638
1818
  const locales = extractLocales({ component: node });
1639
- const resolvedLocale = typeof locale === "string" ? locale : locale == null ? void 0 : locale({ component: node, locales });
1819
+ const resolvedLocale = isUsingModernOptions ? locale : locale == null ? void 0 : locale({ component: node, locales });
1640
1820
  let replaceComponent;
1641
1821
  if (resolvedLocale) {
1642
1822
  replaceComponent = locales[resolvedLocale];
@@ -1644,7 +1824,7 @@ function localize(options) {
1644
1824
  if (replaceComponent == null ? void 0 : replaceComponent.length) {
1645
1825
  replaceComponent.forEach((component) => {
1646
1826
  removeLocaleProperty(component);
1647
- if (shouldRunPropertyLocalization) {
1827
+ if (isUsingModernOptions) {
1648
1828
  localizeProperties(getPropertiesValue(component), locale);
1649
1829
  }
1650
1830
  });
@@ -1656,7 +1836,7 @@ function localize(options) {
1656
1836
  } else {
1657
1837
  actions.remove();
1658
1838
  }
1659
- } else if (shouldRunPropertyLocalization) {
1839
+ } else if (isUsingModernOptions) {
1660
1840
  localizeProperties(getPropertiesValue(node), locale);
1661
1841
  }
1662
1842
  });
@@ -2825,6 +3005,9 @@ export {
2825
3005
  CANVAS_TEST_SLOT,
2826
3006
  CANVAS_TEST_TYPE,
2827
3007
  CANVAS_TEST_VARIANT_PARAM,
3008
+ CANVAS_VIZ_CONTROL_PARAM,
3009
+ CANVAS_VIZ_DI_RULE,
3010
+ CANVAS_VIZ_LOCALE_RULE,
2828
3011
  CanvasClient,
2829
3012
  CanvasClientError,
2830
3013
  CategoryClient,
@@ -2867,11 +3050,15 @@ export {
2867
3050
  convertEntryToPutEntry,
2868
3051
  createBatchEnhancer,
2869
3052
  createCanvasChannel,
3053
+ createDynamicInputVisibilityRule,
2870
3054
  createEventBus,
2871
3055
  createLimitPolicy,
3056
+ createLocaleVisibilityRule,
2872
3057
  createUniformApiEnhancer,
2873
3058
  createVariableReference,
2874
3059
  enhance,
3060
+ evaluateVisibilityCriteriaGroup,
3061
+ evaluateWalkTreeVisibility,
2875
3062
  extractLocales,
2876
3063
  findParameterInNodeTree,
2877
3064
  flattenValues,
package/dist/index.js CHANGED
@@ -305,6 +305,9 @@ __export(src_exports, {
305
305
  CANVAS_TEST_SLOT: () => CANVAS_TEST_SLOT,
306
306
  CANVAS_TEST_TYPE: () => CANVAS_TEST_TYPE,
307
307
  CANVAS_TEST_VARIANT_PARAM: () => CANVAS_TEST_VARIANT_PARAM,
308
+ CANVAS_VIZ_CONTROL_PARAM: () => CANVAS_VIZ_CONTROL_PARAM,
309
+ CANVAS_VIZ_DI_RULE: () => CANVAS_VIZ_DI_RULE,
310
+ CANVAS_VIZ_LOCALE_RULE: () => CANVAS_VIZ_LOCALE_RULE,
308
311
  CanvasClient: () => CanvasClient,
309
312
  CanvasClientError: () => CanvasClientError,
310
313
  CategoryClient: () => CategoryClient,
@@ -347,11 +350,15 @@ __export(src_exports, {
347
350
  convertEntryToPutEntry: () => convertEntryToPutEntry,
348
351
  createBatchEnhancer: () => createBatchEnhancer,
349
352
  createCanvasChannel: () => createCanvasChannel,
353
+ createDynamicInputVisibilityRule: () => createDynamicInputVisibilityRule,
350
354
  createEventBus: () => createEventBus,
351
355
  createLimitPolicy: () => createLimitPolicy,
356
+ createLocaleVisibilityRule: () => createLocaleVisibilityRule,
352
357
  createUniformApiEnhancer: () => createUniformApiEnhancer,
353
358
  createVariableReference: () => createVariableReference,
354
359
  enhance: () => enhance,
360
+ evaluateVisibilityCriteriaGroup: () => evaluateVisibilityCriteriaGroup,
361
+ evaluateWalkTreeVisibility: () => evaluateWalkTreeVisibility,
355
362
  extractLocales: () => extractLocales,
356
363
  findParameterInNodeTree: () => findParameterInNodeTree,
357
364
  flattenValues: () => flattenValues,
@@ -1746,6 +1753,174 @@ function findParameterInNodeTree(data, predicate) {
1746
1753
  return results;
1747
1754
  }
1748
1755
 
1756
+ // src/enhancement/visibility/evaluateVisibilityCriteriaGroup.ts
1757
+ function evaluateVisibilityCriteriaGroup(options) {
1758
+ const { criteriaGroup, simplifyCriteria } = options;
1759
+ const earlyExitResult = criteriaGroup.op === "&" || !criteriaGroup.op ? false : true;
1760
+ let hasIndeterminateClauses = false;
1761
+ for (let index = criteriaGroup.clauses.length - 1; index >= 0; index--) {
1762
+ const clause = criteriaGroup.clauses[index];
1763
+ const criteriaResult = evaluateCriterion(clause, options);
1764
+ if (criteriaResult === null) {
1765
+ hasIndeterminateClauses = true;
1766
+ } else if (criteriaResult === earlyExitResult) {
1767
+ return earlyExitResult;
1768
+ } else if (criteriaResult !== null && simplifyCriteria) {
1769
+ criteriaGroup.clauses.splice(index, 1);
1770
+ }
1771
+ }
1772
+ return hasIndeterminateClauses ? null : !earlyExitResult;
1773
+ }
1774
+ function evaluateCriterion(clause, rootOptions) {
1775
+ if ("clauses" in clause) {
1776
+ return evaluateVisibilityCriteriaGroup({
1777
+ ...rootOptions,
1778
+ criteriaGroup: clause
1779
+ });
1780
+ }
1781
+ const rule = rootOptions.rules[clause.rule];
1782
+ if (rule) {
1783
+ return rule(clause);
1784
+ }
1785
+ return null;
1786
+ }
1787
+
1788
+ // src/enhancement/visibility/types.ts
1789
+ var CANVAS_VIZ_CONTROL_PARAM = "$viz";
1790
+
1791
+ // src/enhancement/visibility/evaluateNodeVisibility.ts
1792
+ function evaluateNodeVisibility({
1793
+ node,
1794
+ ...evaluateGroupOptions
1795
+ }) {
1796
+ var _a;
1797
+ const properties = getPropertiesValue(node);
1798
+ const vizCriteria = (_a = properties == null ? void 0 : properties[CANVAS_VIZ_CONTROL_PARAM]) == null ? void 0 : _a.value;
1799
+ if (vizCriteria == null ? void 0 : vizCriteria.explicitlyHidden) {
1800
+ return false;
1801
+ }
1802
+ if (!(vizCriteria == null ? void 0 : vizCriteria.criteria)) {
1803
+ return true;
1804
+ }
1805
+ const result = evaluateVisibilityCriteriaGroup({
1806
+ ...evaluateGroupOptions,
1807
+ criteriaGroup: vizCriteria.criteria
1808
+ });
1809
+ if (vizCriteria.criteria.clauses.length === 0 && evaluateGroupOptions.simplifyCriteria) {
1810
+ properties == null ? true : delete properties[CANVAS_VIZ_CONTROL_PARAM];
1811
+ }
1812
+ return result;
1813
+ }
1814
+
1815
+ // src/enhancement/visibility/evaluateWalkTreeVisibility.ts
1816
+ function evaluateWalkTreeVisibility({
1817
+ rules,
1818
+ showIndeterminate,
1819
+ context
1820
+ }) {
1821
+ const { type, node, actions } = context;
1822
+ if (type !== "component") {
1823
+ return;
1824
+ }
1825
+ const result = evaluateNodeVisibility({ node, rules, simplifyCriteria: true });
1826
+ if (result === null && !showIndeterminate || result === false) {
1827
+ actions.remove();
1828
+ return false;
1829
+ }
1830
+ return true;
1831
+ }
1832
+
1833
+ // src/enhancement/visibility/rules/evaluateStringMatch.ts
1834
+ var isEvaluator = (criteria, matchValue) => {
1835
+ if (Array.isArray(criteria)) {
1836
+ return criteria.includes(matchValue);
1837
+ }
1838
+ return criteria === matchValue;
1839
+ };
1840
+ var containsEvaluator = (criteria, matchValue) => {
1841
+ if (Array.isArray(criteria)) {
1842
+ return criteria.some((criterion) => matchValue.includes(criterion));
1843
+ }
1844
+ return matchValue.includes(criteria);
1845
+ };
1846
+ var startsWithEvaluator = (criteria, matchValue) => {
1847
+ if (Array.isArray(criteria)) {
1848
+ return criteria.some((criterion) => matchValue.startsWith(criterion));
1849
+ }
1850
+ return matchValue.startsWith(criteria);
1851
+ };
1852
+ var endsWithEvaluator = (criteria, matchValue) => {
1853
+ if (Array.isArray(criteria)) {
1854
+ return criteria.some((criterion) => matchValue.endsWith(criterion));
1855
+ }
1856
+ return matchValue.endsWith(criteria);
1857
+ };
1858
+ var emptyEvaluator = (_, matchValue) => {
1859
+ return matchValue === "";
1860
+ };
1861
+ var stringOperatorEvaluators = {
1862
+ is: isEvaluator,
1863
+ has: containsEvaluator,
1864
+ startswith: startsWithEvaluator,
1865
+ endswith: endsWithEvaluator,
1866
+ empty: emptyEvaluator
1867
+ };
1868
+ function evaluateStringMatch(criteria, matchValue, allow) {
1869
+ const { op, value } = criteria;
1870
+ if (allow && !allow.has(op)) {
1871
+ return null;
1872
+ }
1873
+ let opMatch = op;
1874
+ const negation = op.startsWith("!");
1875
+ if (negation) {
1876
+ opMatch = opMatch.slice(1);
1877
+ }
1878
+ const evaluator = stringOperatorEvaluators[opMatch];
1879
+ if (!evaluator) {
1880
+ return null;
1881
+ }
1882
+ const result = evaluator(value, matchValue);
1883
+ return negation ? !result : result;
1884
+ }
1885
+
1886
+ // src/enhancement/visibility/rules/dynamicInputVisibilityRule.ts
1887
+ var dynamicInputVisibilityOperators = /* @__PURE__ */ new Set([
1888
+ "is",
1889
+ "!is",
1890
+ "has",
1891
+ "!has",
1892
+ "startswith",
1893
+ "!startswith",
1894
+ "endswith",
1895
+ "!endswith",
1896
+ "empty",
1897
+ "!empty"
1898
+ ]);
1899
+ var CANVAS_VIZ_DI_RULE = "$di";
1900
+ function createDynamicInputVisibilityRule(dynamicInputs) {
1901
+ return {
1902
+ [CANVAS_VIZ_DI_RULE]: (criterion) => {
1903
+ const { source } = criterion;
1904
+ const diValue = source ? dynamicInputs[source] : void 0;
1905
+ return evaluateStringMatch(criterion, diValue != null ? diValue : "", dynamicInputVisibilityOperators);
1906
+ }
1907
+ };
1908
+ }
1909
+
1910
+ // src/enhancement/visibility/rules/localeVisibilityRule.ts
1911
+ var localeVisibilityOperators = /* @__PURE__ */ new Set(["is", "!is"]);
1912
+ var CANVAS_VIZ_LOCALE_RULE = "$locale";
1913
+ function createLocaleVisibilityRule(currentLocale) {
1914
+ return {
1915
+ [CANVAS_VIZ_LOCALE_RULE]: (criterion) => {
1916
+ if (!currentLocale) {
1917
+ return false;
1918
+ }
1919
+ return evaluateStringMatch(criterion, currentLocale, localeVisibilityOperators);
1920
+ }
1921
+ };
1922
+ }
1923
+
1749
1924
  // src/enhancement/localize.ts
1750
1925
  function extractLocales({ component }) {
1751
1926
  var _a;
@@ -1764,17 +1939,29 @@ function extractLocales({ component }) {
1764
1939
  function localize(options) {
1765
1940
  const nodes = "nodes" in options ? options.nodes : options.composition;
1766
1941
  const locale = options.locale;
1767
- walkNodeTree(nodes, ({ type, node, actions }) => {
1942
+ const isUsingModernOptions = typeof locale === "string";
1943
+ const vizControlLocaleRule = isUsingModernOptions ? createLocaleVisibilityRule(locale) : {};
1944
+ walkNodeTree(nodes, (context) => {
1945
+ const { type, node, actions } = context;
1768
1946
  if (type !== "component") {
1769
- if (typeof locale === "string") {
1947
+ if (isUsingModernOptions) {
1770
1948
  localizeProperties(node.fields, locale);
1771
1949
  }
1772
1950
  return;
1773
1951
  }
1774
- const shouldRunPropertyLocalization = typeof locale === "string";
1952
+ if (isUsingModernOptions) {
1953
+ const result = evaluateWalkTreeVisibility({
1954
+ context,
1955
+ rules: vizControlLocaleRule,
1956
+ showIndeterminate: true
1957
+ });
1958
+ if (!result) {
1959
+ return;
1960
+ }
1961
+ }
1775
1962
  if (node.type === CANVAS_LOCALIZATION_TYPE) {
1776
1963
  const locales = extractLocales({ component: node });
1777
- const resolvedLocale = typeof locale === "string" ? locale : locale == null ? void 0 : locale({ component: node, locales });
1964
+ const resolvedLocale = isUsingModernOptions ? locale : locale == null ? void 0 : locale({ component: node, locales });
1778
1965
  let replaceComponent;
1779
1966
  if (resolvedLocale) {
1780
1967
  replaceComponent = locales[resolvedLocale];
@@ -1782,7 +1969,7 @@ function localize(options) {
1782
1969
  if (replaceComponent == null ? void 0 : replaceComponent.length) {
1783
1970
  replaceComponent.forEach((component) => {
1784
1971
  removeLocaleProperty(component);
1785
- if (shouldRunPropertyLocalization) {
1972
+ if (isUsingModernOptions) {
1786
1973
  localizeProperties(getPropertiesValue(component), locale);
1787
1974
  }
1788
1975
  });
@@ -1794,7 +1981,7 @@ function localize(options) {
1794
1981
  } else {
1795
1982
  actions.remove();
1796
1983
  }
1797
- } else if (shouldRunPropertyLocalization) {
1984
+ } else if (isUsingModernOptions) {
1798
1985
  localizeProperties(getPropertiesValue(node), locale);
1799
1986
  }
1800
1987
  });
@@ -2964,6 +3151,9 @@ var CanvasClientError = import_api15.ApiClientError;
2964
3151
  CANVAS_TEST_SLOT,
2965
3152
  CANVAS_TEST_TYPE,
2966
3153
  CANVAS_TEST_VARIANT_PARAM,
3154
+ CANVAS_VIZ_CONTROL_PARAM,
3155
+ CANVAS_VIZ_DI_RULE,
3156
+ CANVAS_VIZ_LOCALE_RULE,
2967
3157
  CanvasClient,
2968
3158
  CanvasClientError,
2969
3159
  CategoryClient,
@@ -3006,11 +3196,15 @@ var CanvasClientError = import_api15.ApiClientError;
3006
3196
  convertEntryToPutEntry,
3007
3197
  createBatchEnhancer,
3008
3198
  createCanvasChannel,
3199
+ createDynamicInputVisibilityRule,
3009
3200
  createEventBus,
3010
3201
  createLimitPolicy,
3202
+ createLocaleVisibilityRule,
3011
3203
  createUniformApiEnhancer,
3012
3204
  createVariableReference,
3013
3205
  enhance,
3206
+ evaluateVisibilityCriteriaGroup,
3207
+ evaluateWalkTreeVisibility,
3014
3208
  extractLocales,
3015
3209
  findParameterInNodeTree,
3016
3210
  flattenValues,
package/dist/index.mjs CHANGED
@@ -1608,6 +1608,174 @@ function findParameterInNodeTree(data, predicate) {
1608
1608
  return results;
1609
1609
  }
1610
1610
 
1611
+ // src/enhancement/visibility/evaluateVisibilityCriteriaGroup.ts
1612
+ function evaluateVisibilityCriteriaGroup(options) {
1613
+ const { criteriaGroup, simplifyCriteria } = options;
1614
+ const earlyExitResult = criteriaGroup.op === "&" || !criteriaGroup.op ? false : true;
1615
+ let hasIndeterminateClauses = false;
1616
+ for (let index = criteriaGroup.clauses.length - 1; index >= 0; index--) {
1617
+ const clause = criteriaGroup.clauses[index];
1618
+ const criteriaResult = evaluateCriterion(clause, options);
1619
+ if (criteriaResult === null) {
1620
+ hasIndeterminateClauses = true;
1621
+ } else if (criteriaResult === earlyExitResult) {
1622
+ return earlyExitResult;
1623
+ } else if (criteriaResult !== null && simplifyCriteria) {
1624
+ criteriaGroup.clauses.splice(index, 1);
1625
+ }
1626
+ }
1627
+ return hasIndeterminateClauses ? null : !earlyExitResult;
1628
+ }
1629
+ function evaluateCriterion(clause, rootOptions) {
1630
+ if ("clauses" in clause) {
1631
+ return evaluateVisibilityCriteriaGroup({
1632
+ ...rootOptions,
1633
+ criteriaGroup: clause
1634
+ });
1635
+ }
1636
+ const rule = rootOptions.rules[clause.rule];
1637
+ if (rule) {
1638
+ return rule(clause);
1639
+ }
1640
+ return null;
1641
+ }
1642
+
1643
+ // src/enhancement/visibility/types.ts
1644
+ var CANVAS_VIZ_CONTROL_PARAM = "$viz";
1645
+
1646
+ // src/enhancement/visibility/evaluateNodeVisibility.ts
1647
+ function evaluateNodeVisibility({
1648
+ node,
1649
+ ...evaluateGroupOptions
1650
+ }) {
1651
+ var _a;
1652
+ const properties = getPropertiesValue(node);
1653
+ const vizCriteria = (_a = properties == null ? void 0 : properties[CANVAS_VIZ_CONTROL_PARAM]) == null ? void 0 : _a.value;
1654
+ if (vizCriteria == null ? void 0 : vizCriteria.explicitlyHidden) {
1655
+ return false;
1656
+ }
1657
+ if (!(vizCriteria == null ? void 0 : vizCriteria.criteria)) {
1658
+ return true;
1659
+ }
1660
+ const result = evaluateVisibilityCriteriaGroup({
1661
+ ...evaluateGroupOptions,
1662
+ criteriaGroup: vizCriteria.criteria
1663
+ });
1664
+ if (vizCriteria.criteria.clauses.length === 0 && evaluateGroupOptions.simplifyCriteria) {
1665
+ properties == null ? true : delete properties[CANVAS_VIZ_CONTROL_PARAM];
1666
+ }
1667
+ return result;
1668
+ }
1669
+
1670
+ // src/enhancement/visibility/evaluateWalkTreeVisibility.ts
1671
+ function evaluateWalkTreeVisibility({
1672
+ rules,
1673
+ showIndeterminate,
1674
+ context
1675
+ }) {
1676
+ const { type, node, actions } = context;
1677
+ if (type !== "component") {
1678
+ return;
1679
+ }
1680
+ const result = evaluateNodeVisibility({ node, rules, simplifyCriteria: true });
1681
+ if (result === null && !showIndeterminate || result === false) {
1682
+ actions.remove();
1683
+ return false;
1684
+ }
1685
+ return true;
1686
+ }
1687
+
1688
+ // src/enhancement/visibility/rules/evaluateStringMatch.ts
1689
+ var isEvaluator = (criteria, matchValue) => {
1690
+ if (Array.isArray(criteria)) {
1691
+ return criteria.includes(matchValue);
1692
+ }
1693
+ return criteria === matchValue;
1694
+ };
1695
+ var containsEvaluator = (criteria, matchValue) => {
1696
+ if (Array.isArray(criteria)) {
1697
+ return criteria.some((criterion) => matchValue.includes(criterion));
1698
+ }
1699
+ return matchValue.includes(criteria);
1700
+ };
1701
+ var startsWithEvaluator = (criteria, matchValue) => {
1702
+ if (Array.isArray(criteria)) {
1703
+ return criteria.some((criterion) => matchValue.startsWith(criterion));
1704
+ }
1705
+ return matchValue.startsWith(criteria);
1706
+ };
1707
+ var endsWithEvaluator = (criteria, matchValue) => {
1708
+ if (Array.isArray(criteria)) {
1709
+ return criteria.some((criterion) => matchValue.endsWith(criterion));
1710
+ }
1711
+ return matchValue.endsWith(criteria);
1712
+ };
1713
+ var emptyEvaluator = (_, matchValue) => {
1714
+ return matchValue === "";
1715
+ };
1716
+ var stringOperatorEvaluators = {
1717
+ is: isEvaluator,
1718
+ has: containsEvaluator,
1719
+ startswith: startsWithEvaluator,
1720
+ endswith: endsWithEvaluator,
1721
+ empty: emptyEvaluator
1722
+ };
1723
+ function evaluateStringMatch(criteria, matchValue, allow) {
1724
+ const { op, value } = criteria;
1725
+ if (allow && !allow.has(op)) {
1726
+ return null;
1727
+ }
1728
+ let opMatch = op;
1729
+ const negation = op.startsWith("!");
1730
+ if (negation) {
1731
+ opMatch = opMatch.slice(1);
1732
+ }
1733
+ const evaluator = stringOperatorEvaluators[opMatch];
1734
+ if (!evaluator) {
1735
+ return null;
1736
+ }
1737
+ const result = evaluator(value, matchValue);
1738
+ return negation ? !result : result;
1739
+ }
1740
+
1741
+ // src/enhancement/visibility/rules/dynamicInputVisibilityRule.ts
1742
+ var dynamicInputVisibilityOperators = /* @__PURE__ */ new Set([
1743
+ "is",
1744
+ "!is",
1745
+ "has",
1746
+ "!has",
1747
+ "startswith",
1748
+ "!startswith",
1749
+ "endswith",
1750
+ "!endswith",
1751
+ "empty",
1752
+ "!empty"
1753
+ ]);
1754
+ var CANVAS_VIZ_DI_RULE = "$di";
1755
+ function createDynamicInputVisibilityRule(dynamicInputs) {
1756
+ return {
1757
+ [CANVAS_VIZ_DI_RULE]: (criterion) => {
1758
+ const { source } = criterion;
1759
+ const diValue = source ? dynamicInputs[source] : void 0;
1760
+ return evaluateStringMatch(criterion, diValue != null ? diValue : "", dynamicInputVisibilityOperators);
1761
+ }
1762
+ };
1763
+ }
1764
+
1765
+ // src/enhancement/visibility/rules/localeVisibilityRule.ts
1766
+ var localeVisibilityOperators = /* @__PURE__ */ new Set(["is", "!is"]);
1767
+ var CANVAS_VIZ_LOCALE_RULE = "$locale";
1768
+ function createLocaleVisibilityRule(currentLocale) {
1769
+ return {
1770
+ [CANVAS_VIZ_LOCALE_RULE]: (criterion) => {
1771
+ if (!currentLocale) {
1772
+ return false;
1773
+ }
1774
+ return evaluateStringMatch(criterion, currentLocale, localeVisibilityOperators);
1775
+ }
1776
+ };
1777
+ }
1778
+
1611
1779
  // src/enhancement/localize.ts
1612
1780
  function extractLocales({ component }) {
1613
1781
  var _a;
@@ -1626,17 +1794,29 @@ function extractLocales({ component }) {
1626
1794
  function localize(options) {
1627
1795
  const nodes = "nodes" in options ? options.nodes : options.composition;
1628
1796
  const locale = options.locale;
1629
- walkNodeTree(nodes, ({ type, node, actions }) => {
1797
+ const isUsingModernOptions = typeof locale === "string";
1798
+ const vizControlLocaleRule = isUsingModernOptions ? createLocaleVisibilityRule(locale) : {};
1799
+ walkNodeTree(nodes, (context) => {
1800
+ const { type, node, actions } = context;
1630
1801
  if (type !== "component") {
1631
- if (typeof locale === "string") {
1802
+ if (isUsingModernOptions) {
1632
1803
  localizeProperties(node.fields, locale);
1633
1804
  }
1634
1805
  return;
1635
1806
  }
1636
- const shouldRunPropertyLocalization = typeof locale === "string";
1807
+ if (isUsingModernOptions) {
1808
+ const result = evaluateWalkTreeVisibility({
1809
+ context,
1810
+ rules: vizControlLocaleRule,
1811
+ showIndeterminate: true
1812
+ });
1813
+ if (!result) {
1814
+ return;
1815
+ }
1816
+ }
1637
1817
  if (node.type === CANVAS_LOCALIZATION_TYPE) {
1638
1818
  const locales = extractLocales({ component: node });
1639
- const resolvedLocale = typeof locale === "string" ? locale : locale == null ? void 0 : locale({ component: node, locales });
1819
+ const resolvedLocale = isUsingModernOptions ? locale : locale == null ? void 0 : locale({ component: node, locales });
1640
1820
  let replaceComponent;
1641
1821
  if (resolvedLocale) {
1642
1822
  replaceComponent = locales[resolvedLocale];
@@ -1644,7 +1824,7 @@ function localize(options) {
1644
1824
  if (replaceComponent == null ? void 0 : replaceComponent.length) {
1645
1825
  replaceComponent.forEach((component) => {
1646
1826
  removeLocaleProperty(component);
1647
- if (shouldRunPropertyLocalization) {
1827
+ if (isUsingModernOptions) {
1648
1828
  localizeProperties(getPropertiesValue(component), locale);
1649
1829
  }
1650
1830
  });
@@ -1656,7 +1836,7 @@ function localize(options) {
1656
1836
  } else {
1657
1837
  actions.remove();
1658
1838
  }
1659
- } else if (shouldRunPropertyLocalization) {
1839
+ } else if (isUsingModernOptions) {
1660
1840
  localizeProperties(getPropertiesValue(node), locale);
1661
1841
  }
1662
1842
  });
@@ -2825,6 +3005,9 @@ export {
2825
3005
  CANVAS_TEST_SLOT,
2826
3006
  CANVAS_TEST_TYPE,
2827
3007
  CANVAS_TEST_VARIANT_PARAM,
3008
+ CANVAS_VIZ_CONTROL_PARAM,
3009
+ CANVAS_VIZ_DI_RULE,
3010
+ CANVAS_VIZ_LOCALE_RULE,
2828
3011
  CanvasClient,
2829
3012
  CanvasClientError,
2830
3013
  CategoryClient,
@@ -2867,11 +3050,15 @@ export {
2867
3050
  convertEntryToPutEntry,
2868
3051
  createBatchEnhancer,
2869
3052
  createCanvasChannel,
3053
+ createDynamicInputVisibilityRule,
2870
3054
  createEventBus,
2871
3055
  createLimitPolicy,
3056
+ createLocaleVisibilityRule,
2872
3057
  createUniformApiEnhancer,
2873
3058
  createVariableReference,
2874
3059
  enhance,
3060
+ evaluateVisibilityCriteriaGroup,
3061
+ evaluateWalkTreeVisibility,
2875
3062
  extractLocales,
2876
3063
  findParameterInNodeTree,
2877
3064
  flattenValues,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "19.164.0",
3
+ "version": "19.165.1-alpha.0+f8f7ef22e4",
4
4
  "description": "Common functionality and types for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -38,8 +38,8 @@
38
38
  "pusher-js": "8.2.0"
39
39
  },
40
40
  "dependencies": {
41
- "@uniformdev/assets": "19.164.0",
42
- "@uniformdev/context": "19.164.0",
41
+ "@uniformdev/assets": "19.165.1-alpha.0+f8f7ef22e4",
42
+ "@uniformdev/context": "19.165.1-alpha.0+f8f7ef22e4",
43
43
  "immer": "10.0.4"
44
44
  },
45
45
  "files": [
@@ -48,5 +48,5 @@
48
48
  "publishConfig": {
49
49
  "access": "public"
50
50
  },
51
- "gitHead": "016e3b85373592ca9beb19593aa120247b638c06"
51
+ "gitHead": "f8f7ef22e4180653122a8f30f8c184acc8e5b25b"
52
52
  }