Contentful Personalization & Analytics
    Preparing search index...

    Node-specific ContentfulOptimization SDK built on CoreStateless.

    This class adapts the stateless ContentfulOptimization Core for Node runtimes by applying environment-appropriate defaults (e.g., server channel, Node SDK library metadata). No core runtime behavior is modified; only configuration defaults differ.

    import ContentfulOptimization from '@contentful/optimization-node'

    const sdk = new ContentfulOptimization({
    clientId: 'abc-123',
    environment: 'main',
    logLevel: 'info',
    })

    const requestOptions = { locale: 'en-US' }

    await sdk.track({ event: 'server_event', properties: { id: 1 } }, requestOptions)

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Shared Optimization API client instance.

    Resolved core configuration.

    eventBuilder: EventBuilder

    Shared event builder instance.

    flagsResolver: {
        resolve(
            changes?: {
                key: string;
                meta: { experienceId: string; variantIndex: number };
                type: "Variable";
                value: string | number | boolean | Record<string, JSONType> | null;
            }[],
        ): Flags;
    } = FlagsResolver

    Static resolver for evaluating optimized custom flags.

    Type Declaration

    • resolve: function
      • Build a flattened map of flag keys to values from a change list.

        Parameters

        • Optionalchanges: {
              key: string;
              meta: { experienceId: string; variantIndex: number };
              type: "Variable";
              value: string | number | boolean | Record<string, JSONType> | null;
          }[]

          The change list returned by the optimization service.

          • key: string

            Key identifying the subject of the change.

          • meta: { experienceId: string; variantIndex: number }

            Metadata describing the originating experience and variant index.

            • experienceId: string

              Identifier of the personalization or experiment experience.

            • variantIndex: number

              Index of the variant within the experience configuration.

              Typically corresponds to the array index in the experience's distribution.

          • type: "Variable"

            Discriminator for a variable change.

          • value: string | number | boolean | Record<string, JSONType> | null

            New value for the variable identified by ChangeBase.key.

        Returns Flags

        A map of flag keys to their resolved values.

        const flags = FlagsResolver.resolve(data.changes)
        if (flags['theme'] === 'dark') enableDarkMode()

        // Handles wrapped values produced by the API

        const flags = FlagsResolver.resolve([
        { type: 'Variable', key: 'price', value: { value: { amount: 10, currency: 'USD' } } }
        ])
        console.log(flags.price.amount) // 10
    interceptors: LifecycleInterceptors = ...

    Lifecycle interceptors for events and state updates.

    mergeTagValueResolver: {
        getValueFromProfile(
            id: string,
            profile?: {
                audiences: string[];
                id: string;
                location: {
                    city?: string;
                    continent?: string;
                    coordinates?: { latitude: number; longitude: number };
                    country?: string;
                    countryCode?: string;
                    postalCode?: string;
                    region?: string;
                    regionCode?: string;
                    timezone?: string;
                };
                random: number;
                session: {
                    activeSessionLength: number;
                    averageSessionLength: number;
                    count: number;
                    id: string;
                    isReturningVisitor: boolean;
                    landingPage: {
                        path: string;
                        query: Record<string, string>;
                        referrer: string;
                        search: string;
                        title?: string;
                        url: string;
                        [key: string]: JSONType;
                    };
                };
                stableId: string;
                traits: Record<string, JSONType>;
            },
        ): string
        | undefined;
        normalizeSelectors(id: string): string[];
        resolve(
            mergeTagEntry:
                | {
                    fields: {
                        nt_fallback?: string;
                        nt_mergetag_id: string;
                        nt_name: string;
                    };
                    metadata: {
                        concepts?: {
                            sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                        }[];
                        tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                    };
                    sys: {
                        contentType: {
                            sys: { id: "nt_mergetag"; linkType: "ContentType"; type: "Link" };
                        };
                        createdAt: any;
                        environment: {
                            sys: { id: string; linkType: "Environment"; type: "Link" };
                        };
                        id: string;
                        locale?: string;
                        publishedVersion: number;
                        revision: number;
                        space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                        type: "Entry";
                        updatedAt: any;
                    };
                }
                | undefined,
            profile?: {
                audiences: string[];
                id: string;
                location: {
                    city?: string;
                    continent?: string;
                    coordinates?: { latitude: number; longitude: number };
                    country?: string;
                    countryCode?: string;
                    postalCode?: string;
                    region?: string;
                    regionCode?: string;
                    timezone?: string;
                };
                random: number;
                session: {
                    activeSessionLength: number;
                    averageSessionLength: number;
                    count: number;
                    id: string;
                    isReturningVisitor: boolean;
                    landingPage: {
                        path: string;
                        query: Record<string, string>;
                        referrer: string;
                        search: string;
                        title?: string;
                        url: string;
                        [key: string]: JSONType;
                    };
                };
                stableId: string;
                traits: Record<string, JSONType>;
            },
        ): string
        | undefined;
    } = MergeTagValueResolver

    Static resolver for merge-tag lookups against profile data.

    Type Declaration

    • getValueFromProfile: function
      • Look up a merge-tag value from a profile using normalized selectors.

        Parameters

        • id: string

          Merge-tag identifier.

        • Optionalprofile: {
              audiences: string[];
              id: string;
              location: {
                  city?: string;
                  continent?: string;
                  coordinates?: { latitude: number; longitude: number };
                  country?: string;
                  countryCode?: string;
                  postalCode?: string;
                  region?: string;
                  regionCode?: string;
                  timezone?: string;
              };
              random: number;
              session: {
                  activeSessionLength: number;
                  averageSessionLength: number;
                  count: number;
                  id: string;
                  isReturningVisitor: boolean;
                  landingPage: {
                      path: string;
                      query: Record<string, string>;
                      referrer: string;
                      search: string;
                      title?: string;
                      url: string;
                      [key: string]: JSONType;
                  };
              };
              stableId: string;
              traits: Record<string, JSONType>;
          }

          Profile from which to resolve the value.

          • audiences: string[]

            List of audience identifiers that this profile currently belongs to.

          • id: string

            Primary identifier of the profile.

          • location: {
                city?: string;
                continent?: string;
                coordinates?: { latitude: number; longitude: number };
                country?: string;
                countryCode?: string;
                postalCode?: string;
                region?: string;
                regionCode?: string;
                timezone?: string;
            }

            Geo-location information associated with the profile.

            • Optionalcity?: string

              City name associated with the location.

            • Optionalcontinent?: string

              Continent name associated with the location.

            • Optionalcoordinates?: { latitude: number; longitude: number }

              Geographical coordinates for the location.

              • latitude: number

                Latitude component of the coordinates.

              • longitude: number

                Longitude component of the coordinates.

            • Optionalcountry?: string

              Country name associated with the location.

            • OptionalcountryCode?: string

              Country code associated with the location.

              Validated to exactly COUNTRY_CODE_LENGTH characters, typically an ISO 3166-1 alpha-2 code.

            • OptionalpostalCode?: string

              Postal or ZIP code associated with the location.

            • Optionalregion?: string

              Region or state name associated with the location.

            • OptionalregionCode?: string

              Region or state code associated with the location.

            • Optionaltimezone?: string

              Time zone identifier associated with the location.

              Typically an IANA time zone string (e.g., "Europe/Berlin").

          • random: number

            Random value associated with the profile.

            Often used for deterministic bucketing (e.g., in experiments).

          • session: {
                activeSessionLength: number;
                averageSessionLength: number;
                count: number;
                id: string;
                isReturningVisitor: boolean;
                landingPage: {
                    path: string;
                    query: Record<string, string>;
                    referrer: string;
                    search: string;
                    title?: string;
                    url: string;
                    [key: string]: JSONType;
                };
            }

            Aggregated session statistics for the profile.

            • activeSessionLength: number

              Duration of the active session.

            • averageSessionLength: number

              Average session duration across all sessions represented by this record.

              The unit should match SessionStatistics.activeSessionLength.

            • count: number

              Number of sessions associated with this profile or identifier.

              Often used in combination with SessionStatistics.averageSessionLength.

            • id: string

              Unique identifier for this session statistics record.

            • isReturningVisitor: boolean

              Indicates whether the visitor has been seen before.

              true typically means the visitor has at least one prior session.

            • landingPage: {
                  path: string;
                  query: Record<string, string>;
                  referrer: string;
                  search: string;
                  title?: string;
                  url: string;
                  [key: string]: JSONType;
              }

              Landing page for the session.

              Represents the first page the user visited in this session.

              Page

              • path: string

                Path component of the page URL (e.g., /products/123).

              • query: Record<string, string>

                Parsed query parameters for the page.

              • referrer: string

                Referrer URL that led to the current page.

              • search: string

                Raw search string including the leading ? (e.g., "?q=test").

              • Optionaltitle?: string

                Title of the page as seen by the user.

              • url: string

                Full URL of the page.

          • stableId: string

            Stable, long-lived identifier of the profile.

            Intended to remain constant across sessions and devices when possible. Usually equal to id.

          • traits: Record<string, JSONType>

            Traits describing the profile (user-level attributes).

            Traits

        Returns string | undefined

        A stringified primitive if found; otherwise undefined.

        Only string/number/boolean primitives are returned; objects/arrays are ignored.

        const value = MergeTagValueResolver.getValueFromProfile('user_email', profile)
        if (value) sendEmailTo(value)
    • normalizeSelectors: function
      • Generate a list of candidate selectors for a merge-tag ID.

        Parameters

        • id: string

          Merge-tag identifier (segments separated by _).

        Returns string[]

        Array of dot-path selectors to try against a profile.

        // "profile_name_first" -> [
        // 'profile',
        // 'profile.name',
        // 'profile.name.first'
        // ]
        const selectors = MergeTagValueResolver.normalizeSelectors('profile_name_first')
    • resolve: function
      • Resolve the display value for a merge-tag entry using the provided profile, falling back to the entry's configured nt_fallback when necessary.

        Parameters

        • mergeTagEntry:
              | {
                  fields: {
                      nt_fallback?: string;
                      nt_mergetag_id: string;
                      nt_name: string;
                  };
                  metadata: {
                      concepts?: {
                          sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                      }[];
                      tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                  };
                  sys: {
                      contentType: {
                          sys: { id: "nt_mergetag"; linkType: "ContentType"; type: "Link" };
                      };
                      createdAt: any;
                      environment: {
                          sys: { id: string; linkType: "Environment"; type: "Link" };
                      };
                      id: string;
                      locale?: string;
                      publishedVersion: number;
                      revision: number;
                      space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                      type: "Entry";
                      updatedAt: any;
                  };
              }
              | undefined

          The merge-tag entry to resolve.

          • {
                fields: {
                    nt_fallback?: string;
                    nt_mergetag_id: string;
                    nt_name: string;
                };
                metadata: {
                    concepts?: {
                        sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                    }[];
                    tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                };
                sys: {
                    contentType: {
                        sys: { id: "nt_mergetag"; linkType: "ContentType"; type: "Link" };
                    };
                    createdAt: any;
                    environment: {
                        sys: { id: string; linkType: "Environment"; type: "Link" };
                    };
                    id: string;
                    locale?: string;
                    publishedVersion: number;
                    revision: number;
                    space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                    type: "Entry";
                    updatedAt: any;
                };
            }
            • fields: { nt_fallback?: string; nt_mergetag_id: string; nt_name: string }
              • Optionalnt_fallback?: string

                Fallback value to use when the merge tag cannot be resolved.

              • nt_mergetag_id: string

                Internal identifier of the merge tag.

              • nt_name: string

                Human-readable name of the merge tag.

            • metadata: {
                  concepts?: {
                      sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                  }[];
                  tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
              }

              Contentful metadata, including tags.

            • sys: {
                  contentType: {
                      sys: { id: "nt_mergetag"; linkType: "ContentType"; type: "Link" };
                  };
                  createdAt: any;
                  environment: { sys: { id: string; linkType: "Environment"; type: "Link" } };
                  id: string;
                  locale?: string;
                  publishedVersion: number;
                  revision: number;
                  space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                  type: "Entry";
                  updatedAt: any;
              }

              System fields extended to constrain the content type to nt_mergetag.

          • undefined
        • Optionalprofile: {
              audiences: string[];
              id: string;
              location: {
                  city?: string;
                  continent?: string;
                  coordinates?: { latitude: number; longitude: number };
                  country?: string;
                  countryCode?: string;
                  postalCode?: string;
                  region?: string;
                  regionCode?: string;
                  timezone?: string;
              };
              random: number;
              session: {
                  activeSessionLength: number;
                  averageSessionLength: number;
                  count: number;
                  id: string;
                  isReturningVisitor: boolean;
                  landingPage: {
                      path: string;
                      query: Record<string, string>;
                      referrer: string;
                      search: string;
                      title?: string;
                      url: string;
                      [key: string]: JSONType;
                  };
              };
              stableId: string;
              traits: Record<string, JSONType>;
          }

          Optional profile used for lookup.

          • audiences: string[]

            List of audience identifiers that this profile currently belongs to.

          • id: string

            Primary identifier of the profile.

          • location: {
                city?: string;
                continent?: string;
                coordinates?: { latitude: number; longitude: number };
                country?: string;
                countryCode?: string;
                postalCode?: string;
                region?: string;
                regionCode?: string;
                timezone?: string;
            }

            Geo-location information associated with the profile.

            • Optionalcity?: string

              City name associated with the location.

            • Optionalcontinent?: string

              Continent name associated with the location.

            • Optionalcoordinates?: { latitude: number; longitude: number }

              Geographical coordinates for the location.

              • latitude: number

                Latitude component of the coordinates.

              • longitude: number

                Longitude component of the coordinates.

            • Optionalcountry?: string

              Country name associated with the location.

            • OptionalcountryCode?: string

              Country code associated with the location.

              Validated to exactly COUNTRY_CODE_LENGTH characters, typically an ISO 3166-1 alpha-2 code.

            • OptionalpostalCode?: string

              Postal or ZIP code associated with the location.

            • Optionalregion?: string

              Region or state name associated with the location.

            • OptionalregionCode?: string

              Region or state code associated with the location.

            • Optionaltimezone?: string

              Time zone identifier associated with the location.

              Typically an IANA time zone string (e.g., "Europe/Berlin").

          • random: number

            Random value associated with the profile.

            Often used for deterministic bucketing (e.g., in experiments).

          • session: {
                activeSessionLength: number;
                averageSessionLength: number;
                count: number;
                id: string;
                isReturningVisitor: boolean;
                landingPage: {
                    path: string;
                    query: Record<string, string>;
                    referrer: string;
                    search: string;
                    title?: string;
                    url: string;
                    [key: string]: JSONType;
                };
            }

            Aggregated session statistics for the profile.

            • activeSessionLength: number

              Duration of the active session.

            • averageSessionLength: number

              Average session duration across all sessions represented by this record.

              The unit should match SessionStatistics.activeSessionLength.

            • count: number

              Number of sessions associated with this profile or identifier.

              Often used in combination with SessionStatistics.averageSessionLength.

            • id: string

              Unique identifier for this session statistics record.

            • isReturningVisitor: boolean

              Indicates whether the visitor has been seen before.

              true typically means the visitor has at least one prior session.

            • landingPage: {
                  path: string;
                  query: Record<string, string>;
                  referrer: string;
                  search: string;
                  title?: string;
                  url: string;
                  [key: string]: JSONType;
              }

              Landing page for the session.

              Represents the first page the user visited in this session.

              Page

              • path: string

                Path component of the page URL (e.g., /products/123).

              • query: Record<string, string>

                Parsed query parameters for the page.

              • referrer: string

                Referrer URL that led to the current page.

              • search: string

                Raw search string including the leading ? (e.g., "?q=test").

              • Optionaltitle?: string

                Title of the page as seen by the user.

              • url: string

                Full URL of the page.

          • stableId: string

            Stable, long-lived identifier of the profile.

            Intended to remain constant across sessions and devices when possible. Usually equal to id.

          • traits: Record<string, JSONType>

            Traits describing the profile (user-level attributes).

            Traits

        Returns string | undefined

        The resolved string, or undefined if the entry is invalid and no fallback is available.

        The resolved value depends on the current request profile, so callers should not reuse rendered output across users or requests unless the cache varies on the same profile inputs.

        const text = MergeTagValueResolver.resolve(entry, profile)
        render(text ?? 'Guest')
    optimizedEntryResolver: {
        resolve: {
            <
                S extends EntrySkeletonType = EntrySkeletonType,
                L extends string = string,
            >(
                entry: Entry<S, undefined, L>,
                selectedOptimizations?: {
                    experienceId: string;
                    sticky?: boolean;
                    variantIndex: number;
                    variants: Record<string, string>;
                }[],
            ): ResolvedData<S, undefined, L>;
            <
                S extends EntrySkeletonType,
                M extends ChainModifiers = ChainModifiers,
                L extends string = string,
            >(
                entry: Entry<S, M, L>,
                selectedOptimizations?: {
                    experienceId: string;
                    sticky?: boolean;
                    variantIndex: number;
                    variants: Record<string, string>;
                }[],
            ): ResolvedData<S, M, L>;
        };
        getOptimizationEntry(
            params: {
                optimizedEntry: {
                    fields: {
                        nt_experiences: (
                            | { sys: { id: string; linkType: string; type: "Link" } }
                            | {
                                fields: {
                                    nt_audience?:
                                        | {
                                            fields: {
                                                nt_audience_id: ...;
                                                nt_description?: ...;
                                                nt_name?: ...;
                                                [key: ...]: ...;
                                            };
                                            metadata: { concepts?: ...; tags: ... };
                                            sys: {
                                                contentType: ...;
                                                createdAt: ...;
                                                environment: ...;
                                                id: ...;
                                                locale?: ...;
                                                publishedVersion: ...;
                                                revision: ...;
                                                space: ...;
                                                type: ...;
                                                updatedAt: ...;
                                            };
                                        }
                                        | null;
                                    nt_config?: | {
                                        components?: (...)
                                        | (...);
                                        distribution?: (...) | (...);
                                        sticky?: (...) | (...) | (...);
                                        traffic?: (...) | (...);
                                    }
                                    | null;
                                    nt_description?: string
                                    | null;
                                    nt_experience_id: string;
                                    nt_name: string;
                                    nt_type: "nt_experiment" | "nt_personalization";
                                    nt_variants?: ((...) | (...))[];
                                    [key: string]: JSONType;
                                };
                                metadata: {
                                    concepts?: { sys: ... }[];
                                    tags: { sys: { id: ...; linkType: ...; type: ... } }[];
                                };
                                sys: {
                                    contentType: {
                                        sys: { id: string; linkType: "ContentType"; type: "Link" };
                                    };
                                    createdAt: any;
                                    environment: {
                                        sys: { id: string; linkType: "Environment"; type: "Link" };
                                    };
                                    id: string;
                                    locale?: string;
                                    publishedVersion: number;
                                    revision: number;
                                    space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                                    type: "Entry";
                                    updatedAt: any;
                                };
                            }
                        )[];
                        [key: string]: JSONType;
                    };
                    metadata: {
                        concepts?: {
                            sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                        }[];
                        tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                    };
                    sys: {
                        contentType: {
                            sys: { id: string; linkType: "ContentType"; type: "Link" };
                        };
                        createdAt: any;
                        environment: {
                            sys: { id: string; linkType: "Environment"; type: "Link" };
                        };
                        id: string;
                        locale?: string;
                        publishedVersion: number;
                        revision: number;
                        space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                        type: "Entry";
                        updatedAt: any;
                    };
                };
                selectedOptimizations: {
                    experienceId: string;
                    sticky?: boolean;
                    variantIndex: number;
                    variants: Record<string, string>;
                }[];
            },
            skipValidation?: boolean,
        ):
            | {
                fields: {
                    nt_audience?: | {
                        fields: {
                            nt_audience_id: string;
                            nt_description?: string;
                            nt_name?: string;
                            [key: string]: JSONType;
                        };
                        metadata: {
                            concepts?: { sys: { id: ...; linkType: ...; type: ... } }[];
                            tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                        };
                        sys: {
                            contentType: {
                                sys: { id: string; linkType: "ContentType"; type: "Link" };
                            };
                            createdAt: any;
                            environment: {
                                sys: { id: string; linkType: "Environment"; type: "Link" };
                            };
                            id: string;
                            locale?: string;
                            publishedVersion: number;
                            revision: number;
                            space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                            type: "Entry";
                            updatedAt: any;
                        };
                    }
                    | null;
                    nt_config?: | {
                        components?: (
                            | {
                                baseline: { hidden?: ...; id: ... };
                                type?: (...) | (...);
                                variants: (...)[];
                            }
                            | {
                                baseline: { value: ... };
                                key: string;
                                type: "InlineVariable";
                                valueType: (...) | (...) | (...) | (...);
                                variants: (...)[];
                            }
                        )[];
                        distribution?: number[];
                        sticky?: boolean;
                        traffic?: number;
                    }
                    | null;
                    nt_description?: string
                    | null;
                    nt_experience_id: string;
                    nt_name: string;
                    nt_type: "nt_experiment" | "nt_personalization";
                    nt_variants?: (
                        | { sys: { id: string; linkType: string; type: "Link" } }
                        | {
                            fields: { [key: string]: JSONType };
                            metadata: { concepts?: (...)[]; tags: { sys: ... }[] };
                            sys: {
                                contentType: { sys: { id: ...; linkType: ...; type: ... } };
                                createdAt: any;
                                environment: { sys: { id: ...; linkType: ...; type: ... } };
                                id: string;
                                locale?: string;
                                publishedVersion: number;
                                revision: number;
                                space: { sys: { id: ...; linkType: ...; type: ... } };
                                type: "Entry";
                                updatedAt: any;
                            };
                        }
                    )[];
                    [key: string]: JSONType;
                };
                metadata: {
                    concepts?: {
                        sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                    }[];
                    tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                };
                sys: {
                    contentType: {
                        sys: { id: string; linkType: "ContentType"; type: "Link" };
                    };
                    createdAt: any;
                    environment: {
                        sys: { id: string; linkType: "Environment"; type: "Link" };
                    };
                    id: string;
                    locale?: string;
                    publishedVersion: number;
                    revision: number;
                    space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                    type: "Entry";
                    updatedAt: any;
                };
            }
            | undefined;
        getSelectedOptimization(
            params: {
                optimizationEntry: {
                    fields: {
                        nt_audience?:
                            | {
                                fields: {
                                    nt_audience_id: string;
                                    nt_description?: string;
                                    nt_name?: string;
                                    [key: string]: JSONType;
                                };
                                metadata: {
                                    concepts?: { sys: { id: ...; linkType: ...; type: ... } }[];
                                    tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                                };
                                sys: {
                                    contentType: {
                                        sys: { id: string; linkType: "ContentType"; type: "Link" };
                                    };
                                    createdAt: any;
                                    environment: {
                                        sys: { id: string; linkType: "Environment"; type: "Link" };
                                    };
                                    id: string;
                                    locale?: string;
                                    publishedVersion: number;
                                    revision: number;
                                    space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                                    type: "Entry";
                                    updatedAt: any;
                                };
                            }
                            | null;
                        nt_config?: | {
                            components?: (
                                | {
                                    baseline: { hidden?: ...; id: ... };
                                    type?: (...) | (...);
                                    variants: (...)[];
                                }
                                | {
                                    baseline: { value: ... };
                                    key: string;
                                    type: "InlineVariable";
                                    valueType: (...) | (...) | (...) | (...);
                                    variants: (...)[];
                                }
                            )[];
                            distribution?: number[];
                            sticky?: boolean;
                            traffic?: number;
                        }
                        | null;
                        nt_description?: string
                        | null;
                        nt_experience_id: string;
                        nt_name: string;
                        nt_type: "nt_experiment" | "nt_personalization";
                        nt_variants?: (
                            | { sys: { id: string; linkType: string; type: "Link" } }
                            | {
                                fields: { [key: string]: JSONType };
                                metadata: { concepts?: (...)[]; tags: { sys: ... }[] };
                                sys: {
                                    contentType: { sys: { id: ...; linkType: ...; type: ... } };
                                    createdAt: any;
                                    environment: { sys: { id: ...; linkType: ...; type: ... } };
                                    id: string;
                                    locale?: string;
                                    publishedVersion: number;
                                    revision: number;
                                    space: { sys: { id: ...; linkType: ...; type: ... } };
                                    type: "Entry";
                                    updatedAt: any;
                                };
                            }
                        )[];
                        [key: string]: JSONType;
                    };
                    metadata: {
                        concepts?: {
                            sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                        }[];
                        tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                    };
                    sys: {
                        contentType: {
                            sys: { id: string; linkType: "ContentType"; type: "Link" };
                        };
                        createdAt: any;
                        environment: {
                            sys: { id: string; linkType: "Environment"; type: "Link" };
                        };
                        id: string;
                        locale?: string;
                        publishedVersion: number;
                        revision: number;
                        space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                        type: "Entry";
                        updatedAt: any;
                    };
                };
                selectedOptimizations: {
                    experienceId: string;
                    sticky?: boolean;
                    variantIndex: number;
                    variants: Record<string, string>;
                }[];
            },
            skipValidation?: boolean,
        ):
            | {
                experienceId: string;
                sticky?: boolean;
                variantIndex: number;
                variants: Record<string, string>;
            }
            | undefined;
        getSelectedVariant(
            params: {
                optimizationEntry: {
                    fields: {
                        nt_audience?:
                            | {
                                fields: {
                                    nt_audience_id: string;
                                    nt_description?: string;
                                    nt_name?: string;
                                    [key: string]: JSONType;
                                };
                                metadata: {
                                    concepts?: { sys: { id: ...; linkType: ...; type: ... } }[];
                                    tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                                };
                                sys: {
                                    contentType: {
                                        sys: { id: string; linkType: "ContentType"; type: "Link" };
                                    };
                                    createdAt: any;
                                    environment: {
                                        sys: { id: string; linkType: "Environment"; type: "Link" };
                                    };
                                    id: string;
                                    locale?: string;
                                    publishedVersion: number;
                                    revision: number;
                                    space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                                    type: "Entry";
                                    updatedAt: any;
                                };
                            }
                            | null;
                        nt_config?: | {
                            components?: (
                                | {
                                    baseline: { hidden?: ...; id: ... };
                                    type?: (...) | (...);
                                    variants: (...)[];
                                }
                                | {
                                    baseline: { value: ... };
                                    key: string;
                                    type: "InlineVariable";
                                    valueType: (...) | (...) | (...) | (...);
                                    variants: (...)[];
                                }
                            )[];
                            distribution?: number[];
                            sticky?: boolean;
                            traffic?: number;
                        }
                        | null;
                        nt_description?: string
                        | null;
                        nt_experience_id: string;
                        nt_name: string;
                        nt_type: "nt_experiment" | "nt_personalization";
                        nt_variants?: (
                            | { sys: { id: string; linkType: string; type: "Link" } }
                            | {
                                fields: { [key: string]: JSONType };
                                metadata: { concepts?: (...)[]; tags: { sys: ... }[] };
                                sys: {
                                    contentType: { sys: { id: ...; linkType: ...; type: ... } };
                                    createdAt: any;
                                    environment: { sys: { id: ...; linkType: ...; type: ... } };
                                    id: string;
                                    locale?: string;
                                    publishedVersion: number;
                                    revision: number;
                                    space: { sys: { id: ...; linkType: ...; type: ... } };
                                    type: "Entry";
                                    updatedAt: any;
                                };
                            }
                        )[];
                        [key: string]: JSONType;
                    };
                    metadata: {
                        concepts?: {
                            sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                        }[];
                        tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                    };
                    sys: {
                        contentType: {
                            sys: { id: string; linkType: "ContentType"; type: "Link" };
                        };
                        createdAt: any;
                        environment: {
                            sys: { id: string; linkType: "Environment"; type: "Link" };
                        };
                        id: string;
                        locale?: string;
                        publishedVersion: number;
                        revision: number;
                        space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                        type: "Entry";
                        updatedAt: any;
                    };
                };
                optimizedEntry: {
                    fields: {
                        nt_experiences: (
                            | { sys: { id: string; linkType: string; type: "Link" } }
                            | {
                                fields: {
                                    nt_audience?:
                                        | {
                                            fields: {
                                                nt_audience_id: ...;
                                                nt_description?: ...;
                                                nt_name?: ...;
                                                [key: ...]: ...;
                                            };
                                            metadata: { concepts?: ...; tags: ... };
                                            sys: {
                                                contentType: ...;
                                                createdAt: ...;
                                                environment: ...;
                                                id: ...;
                                                locale?: ...;
                                                publishedVersion: ...;
                                                revision: ...;
                                                space: ...;
                                                type: ...;
                                                updatedAt: ...;
                                            };
                                        }
                                        | null;
                                    nt_config?: | {
                                        components?: (...)
                                        | (...);
                                        distribution?: (...) | (...);
                                        sticky?: (...) | (...) | (...);
                                        traffic?: (...) | (...);
                                    }
                                    | null;
                                    nt_description?: string
                                    | null;
                                    nt_experience_id: string;
                                    nt_name: string;
                                    nt_type: "nt_experiment" | "nt_personalization";
                                    nt_variants?: ((...) | (...))[];
                                    [key: string]: JSONType;
                                };
                                metadata: {
                                    concepts?: { sys: ... }[];
                                    tags: { sys: { id: ...; linkType: ...; type: ... } }[];
                                };
                                sys: {
                                    contentType: {
                                        sys: { id: string; linkType: "ContentType"; type: "Link" };
                                    };
                                    createdAt: any;
                                    environment: {
                                        sys: { id: string; linkType: "Environment"; type: "Link" };
                                    };
                                    id: string;
                                    locale?: string;
                                    publishedVersion: number;
                                    revision: number;
                                    space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                                    type: "Entry";
                                    updatedAt: any;
                                };
                            }
                        )[];
                        [key: string]: JSONType;
                    };
                    metadata: {
                        concepts?: {
                            sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                        }[];
                        tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                    };
                    sys: {
                        contentType: {
                            sys: { id: string; linkType: "ContentType"; type: "Link" };
                        };
                        createdAt: any;
                        environment: {
                            sys: { id: string; linkType: "Environment"; type: "Link" };
                        };
                        id: string;
                        locale?: string;
                        publishedVersion: number;
                        revision: number;
                        space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                        type: "Entry";
                        updatedAt: any;
                    };
                };
                selectedVariantIndex: number;
            },
            skipValidation?: boolean,
        ): { hidden?: boolean; id: string } | undefined;
        getSelectedVariantEntry<
            S extends EntrySkeletonType,
            M extends ChainModifiers = ChainModifiers,
            L extends string = string,
        >(
            params: {
                optimizationEntry: {
                    fields: {
                        nt_audience?:
                            | {
                                fields: {
                                    nt_audience_id: string;
                                    nt_description?: string;
                                    nt_name?: string;
                                    [key: string]: JSONType;
                                };
                                metadata: {
                                    concepts?: { sys: { id: ...; linkType: ...; type: ... } }[];
                                    tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                                };
                                sys: {
                                    contentType: {
                                        sys: { id: string; linkType: "ContentType"; type: "Link" };
                                    };
                                    createdAt: any;
                                    environment: {
                                        sys: { id: string; linkType: "Environment"; type: "Link" };
                                    };
                                    id: string;
                                    locale?: string;
                                    publishedVersion: number;
                                    revision: number;
                                    space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                                    type: "Entry";
                                    updatedAt: any;
                                };
                            }
                            | null;
                        nt_config?: | {
                            components?: (
                                | {
                                    baseline: { hidden?: ...; id: ... };
                                    type?: (...) | (...);
                                    variants: (...)[];
                                }
                                | {
                                    baseline: { value: ... };
                                    key: string;
                                    type: "InlineVariable";
                                    valueType: (...) | (...) | (...) | (...);
                                    variants: (...)[];
                                }
                            )[];
                            distribution?: number[];
                            sticky?: boolean;
                            traffic?: number;
                        }
                        | null;
                        nt_description?: string
                        | null;
                        nt_experience_id: string;
                        nt_name: string;
                        nt_type: "nt_experiment" | "nt_personalization";
                        nt_variants?: (
                            | { sys: { id: string; linkType: string; type: "Link" } }
                            | {
                                fields: { [key: string]: JSONType };
                                metadata: { concepts?: (...)[]; tags: { sys: ... }[] };
                                sys: {
                                    contentType: { sys: { id: ...; linkType: ...; type: ... } };
                                    createdAt: any;
                                    environment: { sys: { id: ...; linkType: ...; type: ... } };
                                    id: string;
                                    locale?: string;
                                    publishedVersion: number;
                                    revision: number;
                                    space: { sys: { id: ...; linkType: ...; type: ... } };
                                    type: "Entry";
                                    updatedAt: any;
                                };
                            }
                        )[];
                        [key: string]: JSONType;
                    };
                    metadata: {
                        concepts?: {
                            sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                        }[];
                        tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                    };
                    sys: {
                        contentType: {
                            sys: { id: string; linkType: "ContentType"; type: "Link" };
                        };
                        createdAt: any;
                        environment: {
                            sys: { id: string; linkType: "Environment"; type: "Link" };
                        };
                        id: string;
                        locale?: string;
                        publishedVersion: number;
                        revision: number;
                        space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                        type: "Entry";
                        updatedAt: any;
                    };
                };
                selectedVariant: { hidden?: boolean; id: string };
            },
            skipValidation?: boolean,
        ): Entry<S, M, L> | undefined;
    } = OptimizedEntryResolver

    Static resolver for optimized Contentful entries.

    Type Declaration

    • resolve: {
          <
              S extends EntrySkeletonType = EntrySkeletonType,
              L extends string = string,
          >(
              entry: Entry<S, undefined, L>,
              selectedOptimizations?: {
                  experienceId: string;
                  sticky?: boolean;
                  variantIndex: number;
                  variants: Record<string, string>;
              }[],
          ): ResolvedData<S, undefined, L>;
          <
              S extends EntrySkeletonType,
              M extends ChainModifiers = ChainModifiers,
              L extends string = string,
          >(
              entry: Entry<S, M, L>,
              selectedOptimizations?: {
                  experienceId: string;
                  sticky?: boolean;
                  variantIndex: number;
                  variants: Record<string, string>;
              }[],
          ): ResolvedData<S, M, L>;
      }
    • getOptimizationEntry: function
      • Find the optimization entry corresponding to one of the selected experiences.

        Parameters

        • params: {
              optimizedEntry: {
                  fields: {
                      nt_experiences: (
                          | { sys: { id: string; linkType: string; type: "Link" } }
                          | {
                              fields: {
                                  nt_audience?:
                                      | {
                                          fields: {
                                              nt_audience_id: ...;
                                              nt_description?: ...;
                                              nt_name?: ...;
                                              [key: ...]: ...;
                                          };
                                          metadata: { concepts?: ...; tags: ... };
                                          sys: {
                                              contentType: ...;
                                              createdAt: ...;
                                              environment: ...;
                                              id: ...;
                                              locale?: ...;
                                              publishedVersion: ...;
                                              revision: ...;
                                              space: ...;
                                              type: ...;
                                              updatedAt: ...;
                                          };
                                      }
                                      | null;
                                  nt_config?: | {
                                      components?: (...)
                                      | (...);
                                      distribution?: (...) | (...);
                                      sticky?: (...) | (...) | (...);
                                      traffic?: (...) | (...);
                                  }
                                  | null;
                                  nt_description?: string
                                  | null;
                                  nt_experience_id: string;
                                  nt_name: string;
                                  nt_type: "nt_experiment" | "nt_personalization";
                                  nt_variants?: ((...) | (...))[];
                                  [key: string]: JSONType;
                              };
                              metadata: {
                                  concepts?: { sys: ... }[];
                                  tags: { sys: { id: ...; linkType: ...; type: ... } }[];
                              };
                              sys: {
                                  contentType: {
                                      sys: { id: string; linkType: "ContentType"; type: "Link" };
                                  };
                                  createdAt: any;
                                  environment: {
                                      sys: { id: string; linkType: "Environment"; type: "Link" };
                                  };
                                  id: string;
                                  locale?: string;
                                  publishedVersion: number;
                                  revision: number;
                                  space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                                  type: "Entry";
                                  updatedAt: any;
                              };
                          }
                      )[];
                      [key: string]: JSONType;
                  };
                  metadata: {
                      concepts?: {
                          sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                      }[];
                      tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                  };
                  sys: {
                      contentType: {
                          sys: { id: string; linkType: "ContentType"; type: "Link" };
                      };
                      createdAt: any;
                      environment: {
                          sys: { id: string; linkType: "Environment"; type: "Link" };
                      };
                      id: string;
                      locale?: string;
                      publishedVersion: number;
                      revision: number;
                      space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                      type: "Entry";
                      updatedAt: any;
                  };
              };
              selectedOptimizations: {
                  experienceId: string;
                  sticky?: boolean;
                  variantIndex: number;
                  variants: Record<string, string>;
              }[];
          }

          Object containing the baseline optimized entry and the selections.

        • skipValidation: boolean = false

          When true, skip type/shape validation for perf.

        Returns
            | {
                fields: {
                    nt_audience?: | {
                        fields: {
                            nt_audience_id: string;
                            nt_description?: string;
                            nt_name?: string;
                            [key: string]: JSONType;
                        };
                        metadata: {
                            concepts?: { sys: { id: ...; linkType: ...; type: ... } }[];
                            tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                        };
                        sys: {
                            contentType: {
                                sys: { id: string; linkType: "ContentType"; type: "Link" };
                            };
                            createdAt: any;
                            environment: {
                                sys: { id: string; linkType: "Environment"; type: "Link" };
                            };
                            id: string;
                            locale?: string;
                            publishedVersion: number;
                            revision: number;
                            space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                            type: "Entry";
                            updatedAt: any;
                        };
                    }
                    | null;
                    nt_config?: | {
                        components?: (
                            | {
                                baseline: { hidden?: ...; id: ... };
                                type?: (...) | (...);
                                variants: (...)[];
                            }
                            | {
                                baseline: { value: ... };
                                key: string;
                                type: "InlineVariable";
                                valueType: (...) | (...) | (...) | (...);
                                variants: (...)[];
                            }
                        )[];
                        distribution?: number[];
                        sticky?: boolean;
                        traffic?: number;
                    }
                    | null;
                    nt_description?: string
                    | null;
                    nt_experience_id: string;
                    nt_name: string;
                    nt_type: "nt_experiment" | "nt_personalization";
                    nt_variants?: (
                        | { sys: { id: string; linkType: string; type: "Link" } }
                        | {
                            fields: { [key: string]: JSONType };
                            metadata: { concepts?: (...)[]; tags: { sys: ... }[] };
                            sys: {
                                contentType: { sys: { id: ...; linkType: ...; type: ... } };
                                createdAt: any;
                                environment: { sys: { id: ...; linkType: ...; type: ... } };
                                id: string;
                                locale?: string;
                                publishedVersion: number;
                                revision: number;
                                space: { sys: { id: ...; linkType: ...; type: ... } };
                                type: "Entry";
                                updatedAt: any;
                            };
                        }
                    )[];
                    [key: string]: JSONType;
                };
                metadata: {
                    concepts?: {
                        sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                    }[];
                    tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                };
                sys: {
                    contentType: {
                        sys: { id: string; linkType: "ContentType"; type: "Link" };
                    };
                    createdAt: any;
                    environment: {
                        sys: { id: string; linkType: "Environment"; type: "Link" };
                    };
                    id: string;
                    locale?: string;
                    publishedVersion: number;
                    revision: number;
                    space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                    type: "Entry";
                    updatedAt: any;
                };
            }
            | undefined

        The matching OptimizationEntry, or undefined if not found/invalid.

        • {
              fields: {
                  nt_audience?:
                      | {
                          fields: {
                              nt_audience_id: string;
                              nt_description?: string;
                              nt_name?: string;
                              [key: string]: JSONType;
                          };
                          metadata: {
                              concepts?: { sys: { id: ...; linkType: ...; type: ... } }[];
                              tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                          };
                          sys: {
                              contentType: {
                                  sys: { id: string; linkType: "ContentType"; type: "Link" };
                              };
                              createdAt: any;
                              environment: {
                                  sys: { id: string; linkType: "Environment"; type: "Link" };
                              };
                              id: string;
                              locale?: string;
                              publishedVersion: number;
                              revision: number;
                              space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                              type: "Entry";
                              updatedAt: any;
                          };
                      }
                      | null;
                  nt_config?: | {
                      components?: (
                          | {
                              baseline: { hidden?: ...; id: ... };
                              type?: (...) | (...);
                              variants: (...)[];
                          }
                          | {
                              baseline: { value: ... };
                              key: string;
                              type: "InlineVariable";
                              valueType: (...) | (...) | (...) | (...);
                              variants: (...)[];
                          }
                      )[];
                      distribution?: number[];
                      sticky?: boolean;
                      traffic?: number;
                  }
                  | null;
                  nt_description?: string
                  | null;
                  nt_experience_id: string;
                  nt_name: string;
                  nt_type: "nt_experiment" | "nt_personalization";
                  nt_variants?: (
                      | { sys: { id: string; linkType: string; type: "Link" } }
                      | {
                          fields: { [key: string]: JSONType };
                          metadata: { concepts?: (...)[]; tags: { sys: ... }[] };
                          sys: {
                              contentType: { sys: { id: ...; linkType: ...; type: ... } };
                              createdAt: any;
                              environment: { sys: { id: ...; linkType: ...; type: ... } };
                              id: string;
                              locale?: string;
                              publishedVersion: number;
                              revision: number;
                              space: { sys: { id: ...; linkType: ...; type: ... } };
                              type: "Entry";
                              updatedAt: any;
                          };
                      }
                  )[];
                  [key: string]: JSONType;
              };
              metadata: {
                  concepts?: {
                      sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                  }[];
                  tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
              };
              sys: {
                  contentType: {
                      sys: { id: string; linkType: "ContentType"; type: "Link" };
                  };
                  createdAt: any;
                  environment: {
                      sys: { id: string; linkType: "Environment"; type: "Link" };
                  };
                  id: string;
                  locale?: string;
                  publishedVersion: number;
                  revision: number;
                  space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                  type: "Entry";
                  updatedAt: any;
              };
          }
          • fields: {
                nt_audience?:
                    | {
                        fields: {
                            nt_audience_id: string;
                            nt_description?: string;
                            nt_name?: string;
                            [key: string]: JSONType;
                        };
                        metadata: {
                            concepts?: { sys: { id: ...; linkType: ...; type: ... } }[];
                            tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                        };
                        sys: {
                            contentType: {
                                sys: { id: string; linkType: "ContentType"; type: "Link" };
                            };
                            createdAt: any;
                            environment: {
                                sys: { id: string; linkType: "Environment"; type: "Link" };
                            };
                            id: string;
                            locale?: string;
                            publishedVersion: number;
                            revision: number;
                            space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                            type: "Entry";
                            updatedAt: any;
                        };
                    }
                    | null;
                nt_config?: | {
                    components?: (
                        | {
                            baseline: { hidden?: ...; id: ... };
                            type?: (...) | (...);
                            variants: (...)[];
                        }
                        | {
                            baseline: { value: ... };
                            key: string;
                            type: "InlineVariable";
                            valueType: (...) | (...) | (...) | (...);
                            variants: (...)[];
                        }
                    )[];
                    distribution?: number[];
                    sticky?: boolean;
                    traffic?: number;
                }
                | null;
                nt_description?: string
                | null;
                nt_experience_id: string;
                nt_name: string;
                nt_type: "nt_experiment" | "nt_personalization";
                nt_variants?: (
                    | { sys: { id: string; linkType: string; type: "Link" } }
                    | {
                        fields: { [key: string]: JSONType };
                        metadata: { concepts?: (...)[]; tags: { sys: ... }[] };
                        sys: {
                            contentType: { sys: { id: ...; linkType: ...; type: ... } };
                            createdAt: any;
                            environment: { sys: { id: ...; linkType: ...; type: ... } };
                            id: string;
                            locale?: string;
                            publishedVersion: number;
                            revision: number;
                            space: { sys: { id: ...; linkType: ...; type: ... } };
                            type: "Entry";
                            updatedAt: any;
                        };
                    }
                )[];
                [key: string]: JSONType;
            }
            • Optionalnt_audience?:
                  | {
                      fields: {
                          nt_audience_id: string;
                          nt_description?: string;
                          nt_name?: string;
                          [key: string]: JSONType;
                      };
                      metadata: {
                          concepts?: { sys: { id: ...; linkType: ...; type: ... } }[];
                          tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                      };
                      sys: {
                          contentType: {
                              sys: { id: string; linkType: "ContentType"; type: "Link" };
                          };
                          createdAt: any;
                          environment: {
                              sys: { id: string; linkType: "Environment"; type: "Link" };
                          };
                          id: string;
                          locale?: string;
                          publishedVersion: number;
                          revision: number;
                          space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                          type: "Entry";
                          updatedAt: any;
                      };
                  }
                  | null

              The audience of the optimization (Audience).

              Optional and nullable; when omitted or null, the optimization may apply to all users.

            • Optionalnt_config?:
                  | {
                      components?: (
                          | {
                              baseline: { hidden?: ...; id: ... };
                              type?: (...) | (...);
                              variants: (...)[];
                          }
                          | {
                              baseline: { value: ... };
                              key: string;
                              type: "InlineVariable";
                              valueType: (...) | (...) | (...) | (...);
                              variants: (...)[];
                          }
                      )[];
                      distribution?: number[];
                      sticky?: boolean;
                      traffic?: number;
                  }
                  | null

              The configuration of an OptimizationEntry (JSON).

            • Optionalnt_description?: string | null

              The description of the optimization (Short Text).

              Optional, may be null if no description is provided.

            • nt_experience_id: string

              The optimization/experience ID related to this optimization entry.

            • nt_name: string

              The name of the optimization (Short Text).

            • nt_type: "nt_experiment" | "nt_personalization"

              The type of the optimization (nt_experiment | nt_personalization).

            • Optionalnt_variants?: (
                  | { sys: { id: string; linkType: string; type: "Link" } }
                  | {
                      fields: { [key: string]: JSONType };
                      metadata: { concepts?: (...)[]; tags: { sys: ... }[] };
                      sys: {
                          contentType: { sys: { id: ...; linkType: ...; type: ... } };
                          createdAt: any;
                          environment: { sys: { id: ...; linkType: ...; type: ... } };
                          id: string;
                          locale?: string;
                          publishedVersion: number;
                          revision: number;
                          space: { sys: { id: ...; linkType: ...; type: ... } };
                          type: "Entry";
                          updatedAt: any;
                      };
                  }
              )[]

              All used variants of the optimization (Contentful references to other Content Types).

              Modeled as an array of Contentful links or resolved entries.

          • metadata: {
                concepts?: {
                    sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                }[];
                tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
            }

            Contentful metadata, including tags.

          • sys: {
                contentType: {
                    sys: { id: string; linkType: "ContentType"; type: "Link" };
                };
                createdAt: any;
                environment: { sys: { id: string; linkType: "Environment"; type: "Link" } };
                id: string;
                locale?: string;
                publishedVersion: number;
                revision: number;
                space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                type: "Entry";
                updatedAt: any;
            }

            System-managed properties describing the entry.

        • undefined

        An optimization entry is an optimization configuration object supplied in an OptimizedEntry.nt_experiences array. An optimized entry may relate to multiple optimizations.

        const optimizationEntry = OptimizedEntryResolver.getOptimizationEntry({
        optimizedEntry: entry,
        selectedOptimizations
        })
    • getSelectedOptimization: function
      • Look up the selection metadata for a specific optimization entry.

        Parameters

        • params: {
              optimizationEntry: {
                  fields: {
                      nt_audience?:
                          | {
                              fields: {
                                  nt_audience_id: string;
                                  nt_description?: string;
                                  nt_name?: string;
                                  [key: string]: JSONType;
                              };
                              metadata: {
                                  concepts?: { sys: { id: ...; linkType: ...; type: ... } }[];
                                  tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                              };
                              sys: {
                                  contentType: {
                                      sys: { id: string; linkType: "ContentType"; type: "Link" };
                                  };
                                  createdAt: any;
                                  environment: {
                                      sys: { id: string; linkType: "Environment"; type: "Link" };
                                  };
                                  id: string;
                                  locale?: string;
                                  publishedVersion: number;
                                  revision: number;
                                  space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                                  type: "Entry";
                                  updatedAt: any;
                              };
                          }
                          | null;
                      nt_config?: | {
                          components?: (
                              | {
                                  baseline: { hidden?: ...; id: ... };
                                  type?: (...) | (...);
                                  variants: (...)[];
                              }
                              | {
                                  baseline: { value: ... };
                                  key: string;
                                  type: "InlineVariable";
                                  valueType: (...) | (...) | (...) | (...);
                                  variants: (...)[];
                              }
                          )[];
                          distribution?: number[];
                          sticky?: boolean;
                          traffic?: number;
                      }
                      | null;
                      nt_description?: string
                      | null;
                      nt_experience_id: string;
                      nt_name: string;
                      nt_type: "nt_experiment" | "nt_personalization";
                      nt_variants?: (
                          | { sys: { id: string; linkType: string; type: "Link" } }
                          | {
                              fields: { [key: string]: JSONType };
                              metadata: { concepts?: (...)[]; tags: { sys: ... }[] };
                              sys: {
                                  contentType: { sys: { id: ...; linkType: ...; type: ... } };
                                  createdAt: any;
                                  environment: { sys: { id: ...; linkType: ...; type: ... } };
                                  id: string;
                                  locale?: string;
                                  publishedVersion: number;
                                  revision: number;
                                  space: { sys: { id: ...; linkType: ...; type: ... } };
                                  type: "Entry";
                                  updatedAt: any;
                              };
                          }
                      )[];
                      [key: string]: JSONType;
                  };
                  metadata: {
                      concepts?: {
                          sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                      }[];
                      tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                  };
                  sys: {
                      contentType: {
                          sys: { id: string; linkType: "ContentType"; type: "Link" };
                      };
                      createdAt: any;
                      environment: {
                          sys: { id: string; linkType: "Environment"; type: "Link" };
                      };
                      id: string;
                      locale?: string;
                      publishedVersion: number;
                      revision: number;
                      space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                      type: "Entry";
                      updatedAt: any;
                  };
              };
              selectedOptimizations: {
                  experienceId: string;
                  sticky?: boolean;
                  variantIndex: number;
                  variants: Record<string, string>;
              }[];
          }

          Object with the target optimization entry and selections.

        • skipValidation: boolean = false

          When true, skip type checks.

        Returns
            | {
                experienceId: string;
                sticky?: boolean;
                variantIndex: number;
                variants: Record<string, string>;
            }
            | undefined

        The matching SelectedOptimization, if present.

        • {
              experienceId: string;
              sticky?: boolean;
              variantIndex: number;
              variants: Record<string, string>;
          }
          • experienceId: string

            Identifier of the personalization or experiment experience.

          • Optionalsticky?: boolean

            Indicates whether this optimization selection is sticky for the user.

            false
            

            Sticky selections should be reused on subsequent requests for the same user, rather than re-allocating a new variant.

          • variantIndex: number

            Index of the selected variant within the experience configuration.

            Typically corresponds to the index of the selected OptimizationConfig entry.

          • variants: Record<string, string>

            Mapping of baseline entry IDs to their selected variant entry IDs.

            The keys are component identifiers and the values are the identifiers of the selected variant for that component.

        • undefined

        Selected optimizations are supplied by the Experience API in the experiences response data property.

        const selectedOptimization = OptimizedEntryResolver.getSelectedOptimization({
        optimizationEntry,
        selectedOptimizations
        })
    • getSelectedVariant: function
      • Get the replacement variant config for the given selection index.

        Parameters

        • params: {
              optimizationEntry: {
                  fields: {
                      nt_audience?:
                          | {
                              fields: {
                                  nt_audience_id: string;
                                  nt_description?: string;
                                  nt_name?: string;
                                  [key: string]: JSONType;
                              };
                              metadata: {
                                  concepts?: { sys: { id: ...; linkType: ...; type: ... } }[];
                                  tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                              };
                              sys: {
                                  contentType: {
                                      sys: { id: string; linkType: "ContentType"; type: "Link" };
                                  };
                                  createdAt: any;
                                  environment: {
                                      sys: { id: string; linkType: "Environment"; type: "Link" };
                                  };
                                  id: string;
                                  locale?: string;
                                  publishedVersion: number;
                                  revision: number;
                                  space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                                  type: "Entry";
                                  updatedAt: any;
                              };
                          }
                          | null;
                      nt_config?: | {
                          components?: (
                              | {
                                  baseline: { hidden?: ...; id: ... };
                                  type?: (...) | (...);
                                  variants: (...)[];
                              }
                              | {
                                  baseline: { value: ... };
                                  key: string;
                                  type: "InlineVariable";
                                  valueType: (...) | (...) | (...) | (...);
                                  variants: (...)[];
                              }
                          )[];
                          distribution?: number[];
                          sticky?: boolean;
                          traffic?: number;
                      }
                      | null;
                      nt_description?: string
                      | null;
                      nt_experience_id: string;
                      nt_name: string;
                      nt_type: "nt_experiment" | "nt_personalization";
                      nt_variants?: (
                          | { sys: { id: string; linkType: string; type: "Link" } }
                          | {
                              fields: { [key: string]: JSONType };
                              metadata: { concepts?: (...)[]; tags: { sys: ... }[] };
                              sys: {
                                  contentType: { sys: { id: ...; linkType: ...; type: ... } };
                                  createdAt: any;
                                  environment: { sys: { id: ...; linkType: ...; type: ... } };
                                  id: string;
                                  locale?: string;
                                  publishedVersion: number;
                                  revision: number;
                                  space: { sys: { id: ...; linkType: ...; type: ... } };
                                  type: "Entry";
                                  updatedAt: any;
                              };
                          }
                      )[];
                      [key: string]: JSONType;
                  };
                  metadata: {
                      concepts?: {
                          sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                      }[];
                      tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                  };
                  sys: {
                      contentType: {
                          sys: { id: string; linkType: "ContentType"; type: "Link" };
                      };
                      createdAt: any;
                      environment: {
                          sys: { id: string; linkType: "Environment"; type: "Link" };
                      };
                      id: string;
                      locale?: string;
                      publishedVersion: number;
                      revision: number;
                      space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                      type: "Entry";
                      updatedAt: any;
                  };
              };
              optimizedEntry: {
                  fields: {
                      nt_experiences: (
                          | { sys: { id: string; linkType: string; type: "Link" } }
                          | {
                              fields: {
                                  nt_audience?:
                                      | {
                                          fields: {
                                              nt_audience_id: ...;
                                              nt_description?: ...;
                                              nt_name?: ...;
                                              [key: ...]: ...;
                                          };
                                          metadata: { concepts?: ...; tags: ... };
                                          sys: {
                                              contentType: ...;
                                              createdAt: ...;
                                              environment: ...;
                                              id: ...;
                                              locale?: ...;
                                              publishedVersion: ...;
                                              revision: ...;
                                              space: ...;
                                              type: ...;
                                              updatedAt: ...;
                                          };
                                      }
                                      | null;
                                  nt_config?: | {
                                      components?: (...)
                                      | (...);
                                      distribution?: (...) | (...);
                                      sticky?: (...) | (...) | (...);
                                      traffic?: (...) | (...);
                                  }
                                  | null;
                                  nt_description?: string
                                  | null;
                                  nt_experience_id: string;
                                  nt_name: string;
                                  nt_type: "nt_experiment" | "nt_personalization";
                                  nt_variants?: ((...) | (...))[];
                                  [key: string]: JSONType;
                              };
                              metadata: {
                                  concepts?: { sys: ... }[];
                                  tags: { sys: { id: ...; linkType: ...; type: ... } }[];
                              };
                              sys: {
                                  contentType: {
                                      sys: { id: string; linkType: "ContentType"; type: "Link" };
                                  };
                                  createdAt: any;
                                  environment: {
                                      sys: { id: string; linkType: "Environment"; type: "Link" };
                                  };
                                  id: string;
                                  locale?: string;
                                  publishedVersion: number;
                                  revision: number;
                                  space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                                  type: "Entry";
                                  updatedAt: any;
                              };
                          }
                      )[];
                      [key: string]: JSONType;
                  };
                  metadata: {
                      concepts?: {
                          sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                      }[];
                      tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                  };
                  sys: {
                      contentType: {
                          sys: { id: string; linkType: "ContentType"; type: "Link" };
                      };
                      createdAt: any;
                      environment: {
                          sys: { id: string; linkType: "Environment"; type: "Link" };
                      };
                      id: string;
                      locale?: string;
                      publishedVersion: number;
                      revision: number;
                      space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                      type: "Entry";
                      updatedAt: any;
                  };
              };
              selectedVariantIndex: number;
          }

          Baseline entry, optimization entry, and 1‑based variant index.

        • skipValidation: boolean = false

          When true, skip type checks.

        Returns { hidden?: boolean; id: string } | undefined

        The EntryReplacementVariant for the component, if any.

        • { hidden?: boolean; id: string }
          • Optionalhidden?: boolean

            Indicates whether this variant is hidden from allocation/traffic.

          • id: string

            Unique identifier for the variant.

        • undefined

        Entry replacement variants are variant configurations specified in a optimization configuration component's variants array supplied by the optimized entry via its nt_config field.

        const selectedVariant = OptimizedEntryResolver.getSelectedVariant({
        optimizedEntry: entry,
        optimizationEntry,
        selectedVariantIndex: 2 // second variant (1‑based)
        })
    • getSelectedVariantEntry: function
      • Resolve the concrete Contentful entry that corresponds to a selected variant.

        Type Parameters

        • S extends EntrySkeletonType

          Entry skeleton type.

        • M extends ChainModifiers = ChainModifiers

          Chain modifiers.

        • L extends string = string

          Locale code.

        Parameters

        • params: {
              optimizationEntry: {
                  fields: {
                      nt_audience?:
                          | {
                              fields: {
                                  nt_audience_id: string;
                                  nt_description?: string;
                                  nt_name?: string;
                                  [key: string]: JSONType;
                              };
                              metadata: {
                                  concepts?: { sys: { id: ...; linkType: ...; type: ... } }[];
                                  tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                              };
                              sys: {
                                  contentType: {
                                      sys: { id: string; linkType: "ContentType"; type: "Link" };
                                  };
                                  createdAt: any;
                                  environment: {
                                      sys: { id: string; linkType: "Environment"; type: "Link" };
                                  };
                                  id: string;
                                  locale?: string;
                                  publishedVersion: number;
                                  revision: number;
                                  space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                                  type: "Entry";
                                  updatedAt: any;
                              };
                          }
                          | null;
                      nt_config?: | {
                          components?: (
                              | {
                                  baseline: { hidden?: ...; id: ... };
                                  type?: (...) | (...);
                                  variants: (...)[];
                              }
                              | {
                                  baseline: { value: ... };
                                  key: string;
                                  type: "InlineVariable";
                                  valueType: (...) | (...) | (...) | (...);
                                  variants: (...)[];
                              }
                          )[];
                          distribution?: number[];
                          sticky?: boolean;
                          traffic?: number;
                      }
                      | null;
                      nt_description?: string
                      | null;
                      nt_experience_id: string;
                      nt_name: string;
                      nt_type: "nt_experiment" | "nt_personalization";
                      nt_variants?: (
                          | { sys: { id: string; linkType: string; type: "Link" } }
                          | {
                              fields: { [key: string]: JSONType };
                              metadata: { concepts?: (...)[]; tags: { sys: ... }[] };
                              sys: {
                                  contentType: { sys: { id: ...; linkType: ...; type: ... } };
                                  createdAt: any;
                                  environment: { sys: { id: ...; linkType: ...; type: ... } };
                                  id: string;
                                  locale?: string;
                                  publishedVersion: number;
                                  revision: number;
                                  space: { sys: { id: ...; linkType: ...; type: ... } };
                                  type: "Entry";
                                  updatedAt: any;
                              };
                          }
                      )[];
                      [key: string]: JSONType;
                  };
                  metadata: {
                      concepts?: {
                          sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                      }[];
                      tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
                  };
                  sys: {
                      contentType: {
                          sys: { id: string; linkType: "ContentType"; type: "Link" };
                      };
                      createdAt: any;
                      environment: {
                          sys: { id: string; linkType: "Environment"; type: "Link" };
                      };
                      id: string;
                      locale?: string;
                      publishedVersion: number;
                      revision: number;
                      space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                      type: "Entry";
                      updatedAt: any;
                  };
              };
              selectedVariant: { hidden?: boolean; id: string };
          }

          Optimization entry and selected variant.

        • skipValidation: boolean = false

          When true, skip type checks.

        Returns Entry<S, M, L> | undefined

        The resolved entry typed as Entry or undefined.

        An optimized entry will resolve either to the baseline (the entry supplied as optimizedEntry) or the selected variant.

        const selectedVariantEntry = OptimizedEntryResolver.getSelectedVariantEntry<{ fields: unknown }>({
        optimizationEntry,
        selectedVariant
        })

    Methods

    • Get the value of a custom flag derived from a set of optimization changes.

      Parameters

      • name: string

        The flag key to resolve.

      • Optionalchanges: {
            key: string;
            meta: { experienceId: string; variantIndex: number };
            type: "Variable";
            value: string | number | boolean | Record<string, JSONType> | null;
        }[]

        Optional change list to resolve from.

        • key: string

          Key identifying the subject of the change.

        • meta: { experienceId: string; variantIndex: number }

          Metadata describing the originating experience and variant index.

          • experienceId: string

            Identifier of the personalization or experiment experience.

          • variantIndex: number

            Index of the variant within the experience configuration.

            Typically corresponds to the array index in the experience's distribution.

        • type: "Variable"

          Discriminator for a variable change.

        • value: string | number | boolean | Record<string, JSONType> | null

          New value for the variable identified by ChangeBase.key.

      Returns unknown

      The resolved JSON value for the flag if available.

      This is a convenience wrapper around Core's shared flag resolution.

      const darkMode = core.getFlag('dark-mode', data.changes)
      
    • Resolve a merge-tag value from the given entry node and profile.

      Parameters

      • embeddedEntryNodeTarget: {
            fields: {
                nt_fallback?: string;
                nt_mergetag_id: string;
                nt_name: string;
            };
            metadata: {
                concepts?: {
                    sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
                }[];
                tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
            };
            sys: {
                contentType: {
                    sys: { id: "nt_mergetag"; linkType: "ContentType"; type: "Link" };
                };
                createdAt: any;
                environment: {
                    sys: { id: string; linkType: "Environment"; type: "Link" };
                };
                id: string;
                locale?: string;
                publishedVersion: number;
                revision: number;
                space: { sys: { id: string; linkType: "Space"; type: "Link" } };
                type: "Entry";
                updatedAt: any;
            };
        }

        The merge-tag entry node to resolve.

        • fields: { nt_fallback?: string; nt_mergetag_id: string; nt_name: string }
          • Optionalnt_fallback?: string

            Fallback value to use when the merge tag cannot be resolved.

          • nt_mergetag_id: string

            Internal identifier of the merge tag.

          • nt_name: string

            Human-readable name of the merge tag.

        • metadata: {
              concepts?: {
                  sys: { id: string; linkType: "TaxonomyConcept"; type: "Link" };
              }[];
              tags: { sys: { id: string; linkType: "Tag"; type: "Link" } }[];
          }

          Contentful metadata, including tags.

        • sys: {
              contentType: {
                  sys: { id: "nt_mergetag"; linkType: "ContentType"; type: "Link" };
              };
              createdAt: any;
              environment: { sys: { id: string; linkType: "Environment"; type: "Link" } };
              id: string;
              locale?: string;
              publishedVersion: number;
              revision: number;
              space: { sys: { id: string; linkType: "Space"; type: "Link" } };
              type: "Entry";
              updatedAt: any;
          }

          System fields extended to constrain the content type to nt_mergetag.

      • Optionalprofile: {
            audiences: string[];
            id: string;
            location: {
                city?: string;
                continent?: string;
                coordinates?: { latitude: number; longitude: number };
                country?: string;
                countryCode?: string;
                postalCode?: string;
                region?: string;
                regionCode?: string;
                timezone?: string;
            };
            random: number;
            session: {
                activeSessionLength: number;
                averageSessionLength: number;
                count: number;
                id: string;
                isReturningVisitor: boolean;
                landingPage: {
                    path: string;
                    query: Record<string, string>;
                    referrer: string;
                    search: string;
                    title?: string;
                    url: string;
                    [key: string]: JSONType;
                };
            };
            stableId: string;
            traits: Record<string, JSONType>;
        }

        Optional profile used for value lookup.

        • audiences: string[]

          List of audience identifiers that this profile currently belongs to.

        • id: string

          Primary identifier of the profile.

        • location: {
              city?: string;
              continent?: string;
              coordinates?: { latitude: number; longitude: number };
              country?: string;
              countryCode?: string;
              postalCode?: string;
              region?: string;
              regionCode?: string;
              timezone?: string;
          }

          Geo-location information associated with the profile.

          • Optionalcity?: string

            City name associated with the location.

          • Optionalcontinent?: string

            Continent name associated with the location.

          • Optionalcoordinates?: { latitude: number; longitude: number }

            Geographical coordinates for the location.

            • latitude: number

              Latitude component of the coordinates.

            • longitude: number

              Longitude component of the coordinates.

          • Optionalcountry?: string

            Country name associated with the location.

          • OptionalcountryCode?: string

            Country code associated with the location.

            Validated to exactly COUNTRY_CODE_LENGTH characters, typically an ISO 3166-1 alpha-2 code.

          • OptionalpostalCode?: string

            Postal or ZIP code associated with the location.

          • Optionalregion?: string

            Region or state name associated with the location.

          • OptionalregionCode?: string

            Region or state code associated with the location.

          • Optionaltimezone?: string

            Time zone identifier associated with the location.

            Typically an IANA time zone string (e.g., "Europe/Berlin").

        • random: number

          Random value associated with the profile.

          Often used for deterministic bucketing (e.g., in experiments).

        • session: {
              activeSessionLength: number;
              averageSessionLength: number;
              count: number;
              id: string;
              isReturningVisitor: boolean;
              landingPage: {
                  path: string;
                  query: Record<string, string>;
                  referrer: string;
                  search: string;
                  title?: string;
                  url: string;
                  [key: string]: JSONType;
              };
          }

          Aggregated session statistics for the profile.

          • activeSessionLength: number

            Duration of the active session.

          • averageSessionLength: number

            Average session duration across all sessions represented by this record.

            The unit should match SessionStatistics.activeSessionLength.

          • count: number

            Number of sessions associated with this profile or identifier.

            Often used in combination with SessionStatistics.averageSessionLength.

          • id: string

            Unique identifier for this session statistics record.

          • isReturningVisitor: boolean

            Indicates whether the visitor has been seen before.

            true typically means the visitor has at least one prior session.

          • landingPage: {
                path: string;
                query: Record<string, string>;
                referrer: string;
                search: string;
                title?: string;
                url: string;
                [key: string]: JSONType;
            }

            Landing page for the session.

            Represents the first page the user visited in this session.

            Page

            • path: string

              Path component of the page URL (e.g., /products/123).

            • query: Record<string, string>

              Parsed query parameters for the page.

            • referrer: string

              Referrer URL that led to the current page.

            • search: string

              Raw search string including the leading ? (e.g., "?q=test").

            • Optionaltitle?: string

              Title of the page as seen by the user.

            • url: string

              Full URL of the page.

        • stableId: string

          Stable, long-lived identifier of the profile.

          Intended to remain constant across sessions and devices when possible. Usually equal to id.

        • traits: Record<string, JSONType>

          Traits describing the profile (user-level attributes).

          Traits

      Returns string | undefined

      The resolved value (typically a string) or undefined if not found.

      Use this during request rendering with the current profile. The resolved value is profile-dependent and is not safe for shared-output caching.

      const name = core.getMergeTagValue(mergeTagNode, profile)
      
    • Parameters

      • payload: StatelessExperiencePayload<
            {
                campaign?: {
                    content?: string;
                    medium?: string;
                    name?: string;
                    source?: string;
                    term?: string;
                };
                locale?: string;
                location?: {
                    city?: string;
                    continent?: string;
                    coordinates?: { latitude: number; longitude: number };
                    country?: string;
                    countryCode?: string;
                    postalCode?: string;
                    region?: string;
                    regionCode?: string;
                    timezone?: string;
                };
                page?: {
                    path: string;
                    query: Record<string, string>;
                    referrer: string;
                    search: string;
                    title?: string;
                    url: string;
                    [key: string]: JSONType;
                };
                screen?: { name: string; [key: string]: JSONType };
                traits?: Record<string, JSONType>;
                userAgent?: string;
                userId: string;
            },
        >
      • OptionalrequestOptions: CoreStatelessRequestOptions

      Returns Promise<OptimizationData>

    • Parameters

      • payload: StatelessExperiencePayload<
            {
                campaign?: {
                    content?: string;
                    medium?: string;
                    name?: string;
                    source?: string;
                    term?: string;
                };
                locale?: string;
                location?: {
                    city?: string;
                    continent?: string;
                    coordinates?: { latitude: number; longitude: number };
                    country?: string;
                    countryCode?: string;
                    postalCode?: string;
                    region?: string;
                    regionCode?: string;
                    timezone?: string;
                };
                page?: {
                    path: string;
                    query: Record<string, string>;
                    referrer: string;
                    search: string;
                    title?: string;
                    url: string;
                    [key: string]: JSONType;
                };
                properties?: {
                    path?: string;
                    query?: Record<string, string>;
                    referrer?: string;
                    search?: string;
                    title?: string;
                    url?: string;
                    [key: string]: JSONType;
                };
                screen?: { name: string; [key: string]: JSONType };
                userAgent?: string;
            },
        > = {}
      • OptionalrequestOptions: CoreStatelessRequestOptions

      Returns Promise<OptimizationData>

    • Resolve a Contentful entry to the appropriate optimized variant (or return the baseline entry if no matching variant is selected).

      Type Parameters

      • S extends EntrySkeletonType = EntrySkeletonType

        Entry skeleton type.

      • L extends string = string

        Locale code.

      Parameters

      • entry: Entry<S, undefined, L>

        The baseline entry to resolve.

      • OptionalselectedOptimizations: {
            experienceId: string;
            sticky?: boolean;
            variantIndex: number;
            variants: Record<string, string>;
        }[]

        Optional selected optimization array for the current profile.

        • experienceId: string

          Identifier of the personalization or experiment experience.

        • Optionalsticky?: boolean

          Indicates whether this optimization selection is sticky for the user.

          false
          

          Sticky selections should be reused on subsequent requests for the same user, rather than re-allocating a new variant.

        • variantIndex: number

          Index of the selected variant within the experience configuration.

          Typically corresponds to the index of the selected OptimizationConfig entry.

        • variants: Record<string, string>

          Mapping of baseline entry IDs to their selected variant entry IDs.

          The keys are component identifiers and the values are the identifiers of the selected variant for that component.

      Returns ResolvedData<S, undefined, L>

      ResolvedData containing the resolved entry and selected optimization metadata (if any).

      This helper is intended for request-local resolution. When the supplied entry comes from a shared application cache, avoid mutating the returned entry in place unless you first clone it.

      const { entry, selectedOptimization } = core.resolveOptimizedEntry(
      baselineEntry,
      data.selectedOptimizations,
      )
    • Resolve a Contentful entry to the appropriate optimized variant (or return the baseline entry if no matching variant is selected).

      Type Parameters

      • S extends EntrySkeletonType

        Entry skeleton type.

      • M extends ChainModifiers = ChainModifiers

        Chain modifiers.

      • L extends string = string

        Locale code.

      Parameters

      • entry: Entry<S, M, L>

        The baseline entry to resolve.

      • OptionalselectedOptimizations: {
            experienceId: string;
            sticky?: boolean;
            variantIndex: number;
            variants: Record<string, string>;
        }[]

        Optional selected optimization array for the current profile.

        • experienceId: string

          Identifier of the personalization or experiment experience.

        • Optionalsticky?: boolean

          Indicates whether this optimization selection is sticky for the user.

          false
          

          Sticky selections should be reused on subsequent requests for the same user, rather than re-allocating a new variant.

        • variantIndex: number

          Index of the selected variant within the experience configuration.

          Typically corresponds to the index of the selected OptimizationConfig entry.

        • variants: Record<string, string>

          Mapping of baseline entry IDs to their selected variant entry IDs.

          The keys are component identifiers and the values are the identifiers of the selected variant for that component.

      Returns ResolvedData<S, M, L>

      ResolvedData containing the resolved entry and selected optimization metadata (if any).

      This helper is intended for request-local resolution. When the supplied entry comes from a shared application cache, avoid mutating the returned entry in place unless you first clone it.

      const { entry, selectedOptimization } = core.resolveOptimizedEntry(
      baselineEntry,
      data.selectedOptimizations,
      )
    • Parameters

      • payload: StatelessExperiencePayload<
            {
                campaign?: {
                    content?: string;
                    medium?: string;
                    name?: string;
                    source?: string;
                    term?: string;
                };
                locale?: string;
                location?: {
                    city?: string;
                    continent?: string;
                    coordinates?: { latitude: number; longitude: number };
                    country?: string;
                    countryCode?: string;
                    postalCode?: string;
                    region?: string;
                    regionCode?: string;
                    timezone?: string;
                };
                name: string;
                page?: {
                    path: string;
                    query: Record<string, string>;
                    referrer: string;
                    search: string;
                    title?: string;
                    url: string;
                    [key: string]: JSONType;
                };
                properties: Record<string, JSONType>;
                screen?: { name: string; [key: string]: JSONType };
                userAgent?: string;
            },
        >
      • OptionalrequestOptions: CoreStatelessRequestOptions

      Returns Promise<OptimizationData>

    • Parameters

      • payload: StatelessExperiencePayload<
            {
                campaign?: {
                    content?: string;
                    medium?: string;
                    name?: string;
                    source?: string;
                    term?: string;
                };
                event: string;
                locale?: string;
                location?: {
                    city?: string;
                    continent?: string;
                    coordinates?: { latitude: number; longitude: number };
                    country?: string;
                    countryCode?: string;
                    postalCode?: string;
                    region?: string;
                    regionCode?: string;
                    timezone?: string;
                };
                page?: {
                    path: string;
                    query: Record<string, string>;
                    referrer: string;
                    search: string;
                    title?: string;
                    url: string;
                    [key: string]: JSONType;
                };
                properties?: Record<string, JSONType>;
                screen?: { name: string; [key: string]: JSONType };
                userAgent?: string;
            },
        >
      • OptionalrequestOptions: CoreStatelessRequestOptions

      Returns Promise<OptimizationData>

    • Parameters

      • payload: StatelessInsightsPayload<
            {
                campaign?: {
                    content?: string;
                    medium?: string;
                    name?: string;
                    source?: string;
                    term?: string;
                };
                componentId: string;
                experienceId?: string;
                locale?: string;
                location?: {
                    city?: string;
                    continent?: string;
                    coordinates?: { latitude: number; longitude: number };
                    country?: string;
                    countryCode?: string;
                    postalCode?: string;
                    region?: string;
                    regionCode?: string;
                    timezone?: string;
                };
                page?: {
                    path: string;
                    query: Record<string, string>;
                    referrer: string;
                    search: string;
                    title?: string;
                    url: string;
                    [key: string]: JSONType;
                };
                screen?: { name: string; [key: string]: JSONType };
                userAgent?: string;
                variantIndex?: number;
            },
        >
      • Optional_requestOptions: CoreStatelessRequestOptions

      Returns Promise<void>

    • Parameters

      • payload: StatelessInsightsPayload<
            {
                campaign?: {
                    content?: string;
                    medium?: string;
                    name?: string;
                    source?: string;
                    term?: string;
                };
                componentId: string;
                experienceId?: string;
                locale?: string;
                location?: {
                    city?: string;
                    continent?: string;
                    coordinates?: { latitude: number; longitude: number };
                    country?: string;
                    countryCode?: string;
                    postalCode?: string;
                    region?: string;
                    regionCode?: string;
                    timezone?: string;
                };
                page?: {
                    path: string;
                    query: Record<string, string>;
                    referrer: string;
                    search: string;
                    title?: string;
                    url: string;
                    [key: string]: JSONType;
                };
                screen?: { name: string; [key: string]: JSONType };
                userAgent?: string;
                variantIndex?: number;
                viewDurationMs?: number;
                viewId?: string;
            },
        >
      • Optional_requestOptions: CoreStatelessRequestOptions

      Returns Promise<void>

    • Parameters

      • payload: StatelessInsightsPayload<
            {
                campaign?: {
                    content?: string;
                    medium?: string;
                    name?: string;
                    source?: string;
                    term?: string;
                };
                componentId: string;
                experienceId?: string;
                hoverDurationMs: number;
                hoverId: string;
                locale?: string;
                location?: {
                    city?: string;
                    continent?: string;
                    coordinates?: { latitude: number; longitude: number };
                    country?: string;
                    countryCode?: string;
                    postalCode?: string;
                    region?: string;
                    regionCode?: string;
                    timezone?: string;
                };
                page?: {
                    path: string;
                    query: Record<string, string>;
                    referrer: string;
                    search: string;
                    title?: string;
                    url: string;
                    [key: string]: JSONType;
                };
                screen?: { name: string; [key: string]: JSONType };
                userAgent?: string;
                variantIndex?: number;
            },
        >
      • Optional_requestOptions: CoreStatelessRequestOptions

      Returns Promise<void>