Contentful Personalization & Analytics
    Preparing search index...

    Runtime-safe view of an optimization config.

    This helper deliberately uses empty/falsey defaults that are safe for SDK consumers. Authoring-time placeholder defaults belong outside runtime validation.

    interface NormalizedOptimizationConfig {
        components: (
            | {
                baseline: { hidden?: boolean; id: string };
                type?: "EntryReplacement";
                variants: { hidden?: boolean; id: string }[];
            }
            | {
                baseline: {
                    value: string
                    | number
                    | boolean
                    | Record<string, JSONType>
                    | null;
                };
                key: string;
                type: "InlineVariable";
                valueType: "Boolean"
                | "Number"
                | "Object"
                | "String";
                variants: {
                    value: string | number | boolean | Record<string, JSONType> | null;
                }[];
            }
        )[];
        distribution: number[];
        sticky: boolean;
        traffic: number;
    }
    Index

    Properties

    components: (
        | {
            baseline: { hidden?: boolean; id: string };
            type?: "EntryReplacement";
            variants: { hidden?: boolean; id: string }[];
        }
        | {
            baseline: {
                value: string
                | number
                | boolean
                | Record<string, JSONType>
                | null;
            };
            key: string;
            type: "InlineVariable";
            valueType: "Boolean"
            | "Number"
            | "Object"
            | "String";
            variants: {
                value: string | number | boolean | Record<string, JSONType> | null;
            }[];
        }
    )[]

    Type Declaration

    • {
          baseline: { hidden?: boolean; id: string };
          type?: "EntryReplacement";
          variants: { hidden?: boolean; id: string }[];
      }
      • baseline: { hidden?: boolean; id: string }

        Baseline variant used when no targeting or allocation selects another variant.

        • Optionalhidden?: boolean

          Indicates whether this variant is hidden from allocation/traffic.

        • id: string

          Unique identifier for the variant.

      • Optionaltype?: "EntryReplacement"

        Discriminator for the component type.

        May be omitted, in which case the component is treated as an EntryReplacement.

      • variants: { hidden?: boolean; id: string }[]

        Additional variants that may be served.

    • {
          baseline: {
              value: string | number | boolean | Record<string, JSONType> | null;
          };
          key: string;
          type: "InlineVariable";
          valueType: "Boolean"
          | "Number"
          | "Object"
          | "String";
          variants: {
              value: string | number | boolean | Record<string, JSONType> | null;
          }[];
      }
      • baseline: { value: string | number | boolean | Record<string, JSONType> | null }

        Baseline value used when no targeting or allocation selects another variant.

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

          Variant value for the inline variable.

      • key: string

        Key under which this variable is exposed to the template.

      • type: "InlineVariable"

        Discriminator for the inline variable component.

      • valueType: "Boolean" | "Number" | "Object" | "String"

        Describes the runtime type of the values for this variable.

      • variants: { value: string | number | boolean | Record<string, JSONType> | null }[]

        Additional variable variants for experimentation or personalization.

    distribution: number[]
    sticky: boolean
    traffic: number