Class

FeatureManager

FeatureManager(config, dependencies)

Provides features specific logic
Constructor

# new FeatureManager(config, dependencies)

Parameters:
Name Type Attributes Description
config
dependencies Object
dataManager DataManagerInterface
loggerManager LogManagerInterface <optional>
Implements:
  • FeatureManagerInterface

View Source src/feature-manager.ts, line 10

Classes

FeatureManager
FeatureManager

Methods

# castType(value, type) → {any}

Convert value's type
Parameters:
Name Type Description
value
type

View Source src/feature-manager.ts, line 484

any

# getFeature(key) → {ConfigFeature}

Get the entity by key
Parameters:
Name Type Description
key string

View Source src/feature-manager.ts, line 380

ConfigFeature

# getFeatureById(id) → {ConfigFeature}

Get the entity by id
Parameters:
Name Type Description
id string

View Source src/feature-manager.ts, line 387

ConfigFeature

# getFeatures(keys) → {Array.<ConfigFeature>}

Get specific entities by array of keys
Parameters:
Name Type Description
keys Array.<string>

View Source src/feature-manager.ts, line 394

Array.<ConfigFeature>

# getFeatureVariableType(key, variableName) → {string|null}

Get a specific variable type defined in a specific feature
Parameters:
Name Type Description
key string A feature's key
variableName string

View Source src/feature-manager.ts, line 402

string | null

# getFeatureVariableTypeById(id, variableName) → {string|null}

Get a specific variable type defined in a specific feature by id
Parameters:
Name Type Description
id string A feature's id
variableName string

View Source src/feature-manager.ts, line 410

string | null

# getList() → {Array.<ConfigFeature>}

Get a list of all entities

View Source src/feature-manager.ts, line 366

Features list
Array.<ConfigFeature>

# getListAsObject(fieldopt) → {Record.<string, ConfigFeature>}

Get a list of all entities as object of entities grouped by identity field
Parameters:
Name Type Attributes Description
field IdentityField <optional>
A field to group entities defaults to `id`

View Source src/feature-manager.ts, line 373

Features list
Record.<string, ConfigFeature>

# isFeatureDeclared(key) → {boolean}

Check that feature is declared
Parameters:
Name Type Description
key string ConfigFeature key

View Source src/feature-manager.ts, line 417

boolean

# isFeatureEnabled(visitorId, featureKey, attributes, experienceKeysopt) → {boolean}

Check is feature enabled.
Parameters:
Name Type Attributes Description
visitorId string
featureKey string
attributes BucketingAttributes
locationProperties Record.<any, any>
visitorProperties Record.<any, any>
environment string <optional>
experienceKeys Array.<string> <optional>

View Source src/feature-manager.ts, line 445

boolean

# runFeature(visitorId, featureKey, attributes, experienceKeysopt) → {BucketedFeature|RuleError|Array.<(BucketedFeature|RuleError)>}

Get feature and its status
Parameters:
Name Type Attributes Description
visitorId string
featureKey string
attributes BucketingAttributes
locationProperties Record.<any, any>
visitorProperties Record.<any, any>
updateVisitorProperties boolean <optional>
typeCasting boolean <optional>
Defaults to `true`
environment string <optional>
experienceKeys Array.<string> <optional>

View Source src/feature-manager.ts, line 432

BucketedFeature | RuleError | Array.<(BucketedFeature|RuleError)>

# runFeatureById(visitorId, featureId, attributes, experienceIdsopt) → {BucketedFeature|Array.<BucketedFeature>}

Get feature and its status
Parameters:
Name Type Attributes Description
visitorId string
featureId string
attributes BucketingAttributes
locationProperties Record.<any, any>
visitorProperties Record.<any, any>
updateVisitorProperties boolean <optional>
typeCasting boolean <optional>
Defaults to `true`
environment string <optional>
experienceIds Array.<string> <optional>

View Source src/feature-manager.ts, line 460

BucketedFeature | Array.<BucketedFeature>

# runFeatures(visitorId, attributes, filteropt) → {Array.<(BucketedFeature|RuleError)>}

Get features and their statuses
Parameters:
Name Type Attributes Description
visitorId string
attributes BucketingAttributes
locationProperties Record.<any, any>
visitorProperties Record.<any, any>
updateVisitorProperties boolean <optional>
typeCasting boolean <optional>
Defaults to `true`
environment string <optional>
filter Record.<string, Array.<string>> <optional>
Filter records by experiences and/or features keys
experiences Array.<string> Array of experiences keys
features Array.<string> Array of features keys

View Source src/feature-manager.ts, line 476

Array.<(BucketedFeature|RuleError)>