Contentful Personalization & Analytics
    Preparing search index...
    • Type guard for EntryReplacementComponent.

      Parameters

      • component:
            | {
                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;
                }[];
            }

        Personalization component to test.

        • {
              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.

            • hidden: boolean

              Indicates whether this variant is hidden from allocation/traffic.

              false
              
            • 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.

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

      true if the component is an EntryReplacement component, otherwise false.

      if (isEntryReplacementComponent(component)) {
      console.log(component.baseline.id);
      }