/*! * Convert JS SDK * Version 1.0.0 * Copyright(c) 2020 Convert Insights, Inc * License Apache-2.0 */ import { DataManagerInterface } from '../../data'; import { FeatureManagerInterface } from './interfaces/feature-manager'; import { LogManagerInterface } from '../../logger'; import { Config, ConfigFeature, BucketedFeature, IdentityField, VariableType, BucketingAttributes } from '../../types'; import { RuleError } from '../../enums'; /** * Provides features specific logic * @category Modules * @constructor * @implements {FeatureManagerInterface} */ export declare class FeatureManager implements FeatureManagerInterface { private _dataManager; private _loggerManager; /** * @param config * @param {Object} dependencies * @param {DataManagerInterface} dependencies.dataManager * @param {LogManagerInterface=} dependencies.loggerManager */ constructor(config: Config, { dataManager, loggerManager }: { dataManager: DataManagerInterface; loggerManager?: LogManagerInterface; }); /** * Get a list of all entities * @return {Array} Features list */ getList(): Array; /** * Get a list of all entities as object of entities grouped by identity field * @param {IdentityField=} field A field to group entities defaults to `id` * @return {Record} Features list */ getListAsObject(field?: IdentityField): Record; /** * Get the entity by key * @param {string} key * @return {ConfigFeature} */ getFeature(key: string): ConfigFeature; /** * Get the entity by id * @param {string} id * @return {ConfigFeature} */ getFeatureById(id: string): ConfigFeature; /** * Get specific entities by array of keys * @param {Array} keys * @return {Array} */ getFeatures(keys: Array): Array; /** * Get a specific variable type defined in a specific feature * @param {string} key A feature's key * @param {string} variableName * @return {string|null} */ getFeatureVariableType(key: string, variableName: string): string; /** * Get a specific variable type defined in a specific feature by id * @param {string} id A feature's id * @param {string} variableName * @return {string|null} */ getFeatureVariableTypeById(id: string, variableName: string): string; /** * Check that feature is declared * @param {string} key ConfigFeature key * @return {boolean} */ isFeatureDeclared(key: string): boolean; /** * Get feature and its status * @param {string} visitorId * @param {string} featureKey * @param {BucketingAttributes} attributes * @param {Record} attributes.locationProperties * @param {Record} attributes.visitorProperties * @param {boolean=} attributes.updateVisitorProperties * @param {boolean=} attributes.typeCasting Defaults to `true` * @param {string=} attributes.environment * @param {Array=} experienceKeys * @return {BucketedFeature | RuleError | Array} */ runFeature(visitorId: string, featureKey: string, attributes: BucketingAttributes, experienceKeys?: Array): BucketedFeature | RuleError | Array; /** * Check is feature enabled. * @param {string} visitorId * @param {string} featureKey * @param {BucketingAttributes} attributes * @param {Record} attributes.locationProperties * @param {Record} attributes.visitorProperties * @param {string=} attributes.environment * @param {Array=} experienceKeys * @return {boolean} */ isFeatureEnabled(visitorId: string, featureKey: string, attributes: BucketingAttributes, experienceKeys?: Array): boolean; /** * Get feature and its status * @param {string} visitorId * @param {string} featureId * @param {BucketingAttributes} attributes * @param {Record} attributes.locationProperties * @param {Record} attributes.visitorProperties * @param {boolean=} attributes.updateVisitorProperties * @param {boolean=} attributes.typeCasting Defaults to `true` * @param {string=} attributes.environment * @param {Array=} experienceIds * @return {BucketedFeature | Array } */ runFeatureById(visitorId: string, featureId: string, attributes: BucketingAttributes, experienceIds?: Array): BucketedFeature | RuleError | Array; /** * Get features and their statuses * @param {string} visitorId * @param {BucketingAttributes} attributes * @param {Record} attributes.locationProperties * @param {Record} attributes.visitorProperties * @param {boolean=} attributes.updateVisitorProperties * @param {boolean=} attributes.typeCasting Defaults to `true` * @param {string=} attributes.environment * @param {Record>=} filter Filter records by experiences and/or features keys * @param {Array} filter.experiences Array of experiences keys * @param {Array} filter.features Array of features keys * @return {Array} */ runFeatures(visitorId: string, attributes: BucketingAttributes, filter?: Record>): Array; /** * Convert value's type * @param value * @param type */ castType(value: any, type: VariableType): any; }