destination-utils.ts
Shared utility functions for resolving destination tab structure. Used by the Destination view, Map view, and Create from Source modal to ensure consistent grouping and ordering of destination fields.
What it does
Section titled “What it does”Provides three pure functions (no Lit or Umbraco dependencies) that operate on DestinationConfig from workflow.types.ts:
getDestinationTabs(destination)
Section titled “getDestinationTabs(destination)”Extracts the tab structure from a destination config. Returns tabs in document order with kebab-case IDs, appending “Page Content” if blockGrids exist but no explicit “Page Content” tab is present.
resolveDestinationTab(dest, destination)
Section titled “resolveDestinationTab(dest, destination)”Maps a MappingDestination to its destination tab ID. Block properties (those with blockKey) always resolve to 'page-content'. Top-level fields resolve to their field’s tab. Returns null for orphaned mappings.
resolveBlockLabel(blockKey, destination)
Section titled “resolveBlockLabel(blockKey, destination)”Finds a block’s display label given its key. Used for sub-grouping block properties within the Page Content tab.
Used by
Section titled “Used by”up-doc-workflow-destination-view.element.ts— usesgetDestinationTabs()for inner tab renderingup-doc-modal.element.ts— uses all three functions for Content tab grouped previewup-doc-workflow-map-view.element.ts— uses all three functions for grouped mapping sections
Imports
Section titled “Imports”import type { DestinationConfig, MappingDestination } from './workflow.types.js';