Constructor
# new FeatureManager(config, dependencies)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
config |
|||
dependencies |
Object
|
||
dataManager |
DataManagerInterface
|
||
loggerManager |
LogManagerInterface
|
<optional> |
- Implements:
- FeatureManagerInterface
Classes
Methods
# castType(value, type) → {any}
Convert value's type
Parameters:
Name | Type | Description |
---|---|---|
value |
||
type |
any
# getFeature(key) → {ConfigFeature}
Get the entity by key
Parameters:
Name | Type | Description |
---|---|---|
key |
string
|
ConfigFeature
# getFeatureById(id) → {ConfigFeature}
Get the entity by id
Parameters:
Name | Type | Description |
---|---|---|
id |
string
|
ConfigFeature
# getFeatures(keys) → {Array.<ConfigFeature>}
Get specific entities by array of keys
Parameters:
Name | Type | Description |
---|---|---|
keys |
Array.<string>
|
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
|
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
|
string
|
null
# getList() → {Array.<ConfigFeature>}
Get a list of all entities
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` |
Features list
Record.<string, ConfigFeature>
# isFeatureDeclared(key) → {boolean}
Check that feature is declared
Parameters:
Name | Type | Description |
---|---|---|
key |
string
|
ConfigFeature key |
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> |
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> |
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> |
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 |
Array.<(BucketedFeature|RuleError)>