Interface for segmentation logic. Provides a method to validate segmentation based on given parameters.

Implements

Constructors

Properties

context: ContextModel
feature: FeatureModel
settings: SettingsModel

Methods

  • Checks if the feature is enabled for the user by querying the storage.

    Parameters

    • settings: SettingsModel

      The settings model containing configuration.

    • featureKey: string

      The key of the feature to check.

    • context: ContextModel

    Returns Promise<any>

    A Promise resolving to a boolean indicating if the feature is enabled for the user.

  • Checks if the user's location matches the expected location criteria.

    Parameters

    • locationMap: Record<string, dynamic>

      Map of expected location values.

    Returns Promise<boolean>

    A Promise resolving to a boolean indicating if the location matches.

  • Checks if the user's device information matches the expected criteria.

    Parameters

    • uaParserMap: Record<string, string[]>

      Map of expected user agent values.

    Returns Promise<boolean>

    A Promise resolving to a boolean indicating if the user agent matches.

  • Checks if the actual values match the expected values specified in the map.

    Parameters

    • expectedMap: Record<string, string[]>

      A map of expected values for different keys.

    • actualMap: Record<string, string>

      A map of actual values to compare against.

    Returns Promise<boolean>

    A Promise resolving to a boolean indicating if all actual values match the expected values.

  • Evaluates all DSL nodes using the AND logic.

    Parameters

    • dslNodes: Record<string, dynamic>[]

      Array of DSL nodes to evaluate.

    • customVariables: Record<string, dynamic>

      Custom variables provided for evaluation.

    Returns Promise<boolean>

    A Promise resolving to a boolean indicating if all nodes are valid.

  • Validates if the segmentation defined in the DSL is applicable based on the provided properties.

    Parameters

    • dsl: Record<string, dynamic>

      The domain-specific language defining the segmentation rules.

    • properties: Record<string, dynamic>

      The properties against which the DSL rules are evaluated.

    Returns Promise<boolean>

    A Promise resolving to a boolean indicating if the segmentation is valid.

  • Evaluates if any of the DSL nodes are valid using the OR logic.

    Parameters

    • dslNodes: Record<string, dynamic>[]

      Array of DSL nodes to evaluate.

    • customVariables: Record<string, dynamic>

      Custom variables provided for evaluation.

    Returns Promise<boolean>

    A Promise resolving to a boolean indicating if any of the nodes are valid.

  • Compares expected location values with user's location to determine a match.

    Parameters

    • expectedLocationMap: any

      A map of expected location values.

    • userLocation: any

      The user's actual location.

    Returns Promise<boolean>

    A boolean indicating if the user's location matches the expected values.