import { IItem } from '../../types'; import { FeatureLayerItemData, ImageryLayerItemData, PopupInfo, PopupMediaInfo, WebmapData, WebmapLayerDataByItemId, WebmapOperationalLayer, WebmapOperationalLayerType } from '../../types/item-data'; type ShouldCheckItemPopupOptions = { webmapData?: WebmapData; }; /** * List of operational layer types that require pop-up configuration check in web maps. Only these layer types will be checked for pop-up configuration in web maps, * since other layer types are not expected to have pop-ups, and this can help avoid unnecessary pop-up check and potential false positives for unsupported layer types. */ export declare const OPERATIONAL_LAYERS_TO_CHECK_FOR_POPUP: WebmapOperationalLayerType[]; /** * Check if the item pop-up configuration should be validated based on the item type * Only Feature Services, Imagery Services, and Web Maps are validated for pop-up configuration. * For Feature Services, Feature Tables are excluded from validation. * For Imagery Services, Elevation 3D Layers are excluded from validation. * For Web Maps, validation depends on whether there are operational layers that require popup check. * * @param item ArcGIS item to check * @param options Optional parameters * @param options.webmapData Web map data to check for operational layers (required for Web Map items) * @returns boolean indicating whether to check item pop-up configuration */ export declare const shouldCheckItemPopup: (item: IItem, { webmapData }?: ShouldCheckItemPopupOptions) => boolean; /** * This function checks if the given webmap data has operational layers that require popup check, and if so, it will proceed with popup validation. * @param webmapData The webmap data to check for operational layers and popup configuration * @returns boolean indicating whether the webmap has operational layers that require popup check */ export declare const shouldCheckWebmapPopup: (webmapData: WebmapData | undefined) => boolean; /** * Validates an array of popup media information objects. * * Checks if the provided mediaInfos array exists, is not empty, and contains * at least one media info object with a defined value property. * * @param mediaInfos - An array of PopupMediaInfo objects to validate, or undefined * @returns `true` if the array exists, is not empty, and contains at least one * media info object with a defined value; `false` otherwise */ export declare const validateMediaInfo: (mediaInfos: PopupMediaInfo[] | undefined) => boolean; /** * Validates popup information to determine if it contains meaningful content. * * A popup is considered valid if it contains at least one of the following: * - Valid popup elements (excluding 'fields' and 'attachments' types) * - A non-empty description string * - Valid media information * * Validation rules for popup elements: * - 'fields' and 'attachments' types are always excluded * - 'media' type must contain valid mediaInfos * - 'text' type must contain a non-empty text string * - 'expression' type must contain a valid expressionInfo with a non-empty expression string * * @param popupInfo - The popup information object to validate * @returns `true` if the popup contains valid content, `false` otherwise */ export declare const validatePopupInfo: (popupInfo: PopupInfo | undefined) => boolean; /** * List of popup element types that the living atlas content validator checks for in popup configurations. * This includes 'fields', 'attachments', 'media', 'text', and 'expression' types. */ export type PopupElementType = 'fields' | 'attachments' | 'media' | 'text' | 'expression'; /** * Represents the presence status of each popup element type in a popup configuration. * Maps each PopupElementType to an object containing the type name and whether it is present. */ export type PopupElementPresenceMap = Record; /** * Analyzes popup configuration and determines which element types are present. * * This function examines a PopupInfo object and identifies which popup element types * are configured with valid content. It validates each element type according to specific * criteria and also checks legacy popup configuration properties (description and mediaInfo). * * @param popupInfo - The popup configuration object to analyze. Can be undefined. * @returns A record mapping each PopupElementType to an object containing the type name * and a boolean indicating whether that element type is present with valid content. * Returns a record with all types marked as not present if popupInfo is undefined * or has no popup elements. * * @remarks * Validation criteria for each element type: * - 'fields': Requires fieldInfos array to exist and contain items * - 'attachments': Considered present if the attachments element exists in popupElements * - 'media': Requires mediaInfos to exist and pass validation (contains valid media with values) * - 'text': Requires text content to exist and be non-empty after trimming * - 'expression': Requires expressionInfo with a non-empty expression string after trimming * * Legacy properties handling: * - popupInfo.description is treated as 'text' type if non-empty * - popupInfo.mediaInfo is treated as 'media' type if it passes validation */ export declare const analyzePopupElementPresence: (popupInfo: PopupInfo | undefined) => PopupElementPresenceMap; /** * This function checks if the given popupInfo is empty object without actual content. * @param popupInfo The popupInfo object to check * @returns `true` if the popupInfo is empty, `false` otherwise */ export declare const isEmptyPopupInfo: (popupInfo: PopupInfo | undefined) => boolean; /** * Output type for popup validation results. */ export type CheckPopupOutput = { /** * Indicates if any layer has popup enabled (either user-configured or default popup configuration). * This will be false if all layers have no popup configured or popups are disabled, and true if at least one layer has popup configured. */ hasPopup: boolean; /** * Indicates if any layer has user-configured popup content. This will be false if all layers either have no popup configured, popups are disabled, * or only have default popup configuration (e.g. only fields and attachments without description, media, or other custom popup elements), * and true if at least one layer has user-configured popup content. */ hasUserConfiguredPopup: boolean; /** * Indicates if the webmap has exceeded the maximum number of layers allowed for webmaps in ArcGIS Online, which is currently 100 layers. This is used to determine whether to perform popup validation for webmaps, since webmaps that exceed the maximum number of layers are not eligible for nomination and won't be validated for popup configuration. */ exceedsMaxWebmapLayers?: boolean; }; /** * Validates popup configuration for feature layers to ensure user-configured popup content exists. * * This function checks each layer in the feature service to determine if it has custom popup content. * A layer is considered to have custom popup content if it has: * - Popup elements other than 'fields' or 'attachments' * - A description in the popupInfo * - Media info (charts, images, etc.) * * If all layers lack user-configured popups, a validation message is returned. * * @param featureLayerItemData - The feature layer item data containing layers and their configurations * @returns An object containing: * - `hasPopup`: `true` if at least one layer has popup configured, `false` otherwise * - `hasUserConfiguredPopup`: `true` if at least one layer has user-configured popup content, `false` otherwise */ export declare const checkFeatureLayerPopup: ({ featureLayerItemData, }: { featureLayerItemData: FeatureLayerItemData | undefined; }) => CheckPopupOutput; /** * Validates the popup configuration for an imagery layer item. * * Checks if the imagery layer has valid popup information configured. * Returns validation messages indicating any issues found with the popup setup. * * @param params - The validation parameters * @param params.imageryLayerItemData - The imagery layer item data containing popup configuration, or undefined if unavailable * @returns An object containing: * - `hasPopup`: `true` if the imagery layer has popup configured, `false` otherwise * - `hasUserConfiguredPopup`: `true` if the imagery layer has user-configured popup content, `false` otherwise * * @remarks * Imagery layers do not support the `disablePopup` property, so this check always treats it as `false`. * The function performs validation in the following order: * 1. Checks if imagery layer data is available * 2. Checks if popup info exists (disablePopup is always false for imagery layers) * 3. Validates the popup info structure using `validatePopupInfo` */ export declare const checkImageryLayerPopup: ({ imageryLayerItemData, }: { imageryLayerItemData: ImageryLayerItemData | undefined; }) => CheckPopupOutput; /** * This function checks the pop-up configuration for layers within a web map. It first flattens the operational layers in the web map, then checks if any of those layers have user-configured pop-ups. * @param param.webmapData The web map data containing operational layers and their pop-up configurations * @returns An object containing: * - `hasPopup`: `true` if at least one layer in the web map has a pop-up configured, `false` otherwise * - `hasUserConfiguredPopup`: `true` if at least one layer in the web map has user-configured pop-up content, `false` otherwise */ export declare const checkWebmapPopup: ({ webmapData, webmapLayerDataByItemId, }: { webmapData: WebmapData | undefined; webmapLayerDataByItemId?: WebmapLayerDataByItemId; }) => CheckPopupOutput; /** * Hydrates web map operational layers with popup information from their corresponding item data. * * This function enriches web map layers by fetching and attaching popup configuration from the * source item data when the popup info is not already present in the web map layer definition. * This is necessary because web maps may reference layers without including their full popup * configuration, requiring lookup from the original item data. * * @param params - The hydration parameters * @param params.operationalLayers - Array of operational layers from the web map to hydrate * @param params.webmapLayerDataByItemId - Dictionary mapping item IDs to their corresponding item data, * which contains the popup configuration for each layer * * @returns Array of operational layers with popup information hydrated from item data where applicable. * Layers that already have popup info, have popups disabled, or lack an item ID are returned unchanged. * * @remarks * The function handles different layer types differently: * - **ArcGISImageServiceLayer**: Popup info is retrieved directly from the image service item data * since there's a one-to-one relationship between the layer and item. * - **ArcGISFeatureLayer**: Popup info is retrieved by matching the specific sublayer ID from the * layer URL with the corresponding layer in the feature service item data. * - **Other layer types**: Returned unchanged as they either don't support popups or aren't * currently handled by this function. * * Layers are skipped from hydration if: * - No item ID is present (can't look up item data) * - Popup info already exists (no need to hydrate) * - Popup is explicitly disabled (no point in hydrating) * - Item data is unavailable for the given item ID * */ export declare const hydrateWebmapLayersWithPopupInfo: ({ operationalLayers, webmapLayerDataByItemId, }: { operationalLayers: WebmapOperationalLayer[] | undefined; webmapLayerDataByItemId: WebmapLayerDataByItemId | undefined; }) => WebmapOperationalLayer[]; export {};