import type { ComponentType } from 'react'; import type { DocumentNode } from 'graphql'; import type { ContentLinkWithLocale, ContentLink } from '@remkoj/optimizely-graph-client'; import type { ContentType, BaseCmsComponent, CmsComponentWithQuery, CmsComponentWithFragment, WithGqlFragment, ContentQueryProps } from './types.js'; import type { ComponentFactory } from './factory/types.js'; export * from './components/rich-text/utils.js'; export declare function isNonEmptyString(toTest: any): toTest is string; export declare function isNotNullOrUndefined(toTest?: T | null): toTest is T; export declare function isContentType(toTest: any): toTest is ContentType; /** * Normalizes the content type by: * - Converting strings to ContentType * - Stripping the leading underscore, if any * * @param toNormalize The Content Type value to process * @param stripContent When set to true, the global base type "Content" will be removed as well * @returns */ export declare function normalizeContentType(toNormalize: (string | null)[] | string | null | undefined, stripContent?: boolean): ContentType | undefined; /** * Normalizes and prefixes the content type by: * - Converting strings to ContentType * - Stripping the leading underscore, if any * - Removing the global base type "Content" * - Ensuring that in the remaining type the least specific type is equal to the provided prefix * * @param contentType * @param prefix * @returns */ export declare function normalizeAndPrefixContentType(contentType: Array | string | null | undefined, prefix: string): ContentType; /** * Perform the resolution of the Component, based on the type and list of * variants. It will return the first matching variant, and fall back to * the main component if none match. * * @param factory The ComponentFactory to use for the resolution * process * @param type The Component Type to resolve * @param variants The variants to test * @returns The resolved Component or undefined if not found */ export declare function resolveComponentType(factory: ComponentFactory, type: ContentType, variants?: Array): ReturnType; export declare function isCmsComponentWithDataQuery(toTest?: BaseCmsComponent): toTest is CmsComponentWithQuery; export declare function isCmsComponentWithFragment(toTest?: BaseCmsComponent): toTest is CmsComponentWithFragment; export declare function validatesFragment>(toTest?: T): toTest is T & Pick>, "validateFragment">; export declare function contentLinkToRequestVariables(contentLink: ContentLinkWithLocale): ContentQueryProps; export declare function toUniqueValues(value: R, index: number, array: Array): value is R; export declare function trim(valueToTrim: T): T; export declare function getContentEditId(contentLink: ContentLink): string; /** * Generate a pseudo-random identifier usable to satisfy the unique key * requirement for children within a React node. However this effectively will * tell React that the childrend will be unique for each render and thus cause * them to update. * * Only use this method to generate keys if there's no other way to test the * uniqueness of the child * * @param prefix The prefix to apply to the children * @returns The unique key */ export declare function getRandomKey(prefix?: string): string;