import { ApiManagerInterface } from '../../api'; import { BucketingManagerInterface } from '../../bucketing'; import { DataStoreManagerInterface } from './interfaces/data-store-manager'; import { DataManagerInterface } from './interfaces/data-manager'; import { EventManagerInterface } from '../../event'; import { LogManagerInterface } from '../../logger'; import { RuleManagerInterface } from '../../rules'; import { Entity, Config, ConfigResponseData, ConfigExperience, IdentityField, BucketedVariation, StoreData, GoalData, VisitorSegments, BucketingAttributes, LocationAttributes } from '../../types'; import { BucketingError, RuleError, ConversionSettingKey } from '../../enums'; /** * Provides logic for data. Stores bucket with help of dataStore if it's provided * @category Modules * @constructor * @implements {DataManagerInterface} */ export declare class DataManager implements DataManagerInterface { private _data; private _accountId; private _projectId; private _config; private _bucketingManager; private _loggerManager; private _eventManager; private _dataStoreManager; private _apiManager; private _ruleManager; private _dataEntities; private _localStoreLimit; private _bucketedVisitors; private _asyncStorage; private _environment; private _mapper; /** * @param {Config} config * @param {Object} dependencies * @param {ApiManagerInterface} dependencies.apiManager * @param {BucketingManagerInterface} dependencies.bucketingManager * @param {RuleManagerInterface} dependencies.ruleManager * @param {LogManagerInterface} dependencies.loggerManager */ constructor(config: Config, { bucketingManager, ruleManager, eventManager, apiManager, loggerManager }: { bucketingManager: BucketingManagerInterface; ruleManager: RuleManagerInterface; eventManager: EventManagerInterface; apiManager: ApiManagerInterface; loggerManager?: LogManagerInterface; }, { asyncStorage }?: { asyncStorage?: boolean; }); set data(data: ConfigResponseData); /** * data getter */ get data(): ConfigResponseData; /** * dataStoreManager setter * @param {any=} dataStore */ set dataStoreManager(dataStore: any); /** * dataStoreManager getter */ get dataStoreManager(): DataStoreManagerInterface; /** * Set dataStoreManager at run-time */ setDataStore(dataStore: any): void; /** * Validate locationProperties against locations rules and visitorProperties against audiences rules * @param {string} visitorId * @param {string} identity Value of the field which name is provided in identityField * @param {IdentityField=} identityField Defaults to 'key' * @param {BucketingAttributes} attributes * @param {Record} attributes.locationProperties * @param {Record} attributes.visitorProperties * @param {string=} attributes.environment * @return {ConfigExperience | RuleError} */ matchRulesByField(visitorId: string, identity: string, identityField: IdentityField, attributes: BucketingAttributes): ConfigExperience | RuleError; /** * Retrieve variation for visitor * @param {string} visitorId * @param {string} identity Value of the field which name is provided in identityField * @param {IdentityField=} identityField Defaults to 'key' * @param {BucketingAttributes} attributes * @param {Record} attributes.locationProperties * @param {Record} attributes.visitorProperties * @param {boolean=} attributes.updateVisitorProperties * @param {string=} attributes.forceVariationId * @param {boolean=} attributes.enableTracking Defaults to `true` * @param {boolean=} attributes.asyncStorage Defaults to `true` * @param {string=} attributes.environment * @return {BucketedVariation | RuleError | BucketingError} * @private */ private _getBucketingByField; /** * Retrieve bucketing for Visitor * @param {string} visitorId * @param {Record | null} visitorProperties * @param {boolean} updateVisitorProperties * @param {ConfigExperience} experience * @param {string=} forceVariationId * @param {boolean=} enableTracking Defaults to `true` * @return {BucketedVariation | BucketingError} * @private */ private _retrieveBucketing; /** * @param {string} experienceId * @param {string} variationId * @return {ExperienceVariationConfig} * @private */ private retrieveVariation; reset(): void; /** * @param {string} visitorId * @param {StoreData} newData * @private */ putData(visitorId: string, newData?: StoreData): void; /** * @param {string} visitorId * @return {StoreData} variation id * @private */ getData(visitorId: string): StoreData; /** * @param {string} visitorId * @return {string} storeKey * @private */ getStoreKey(visitorId: string): string; /** * * @param {string} visitorId * @param {Array>} items * @param {Record} attributes.locationProperties * @param {IdentityField=} attributes.identityField * @param {boolean=} attributes.forceEvent * @returns {Array | RuleError>} */ selectLocations(visitorId: string, items: Array>, attributes: LocationAttributes): Array | RuleError>; /** * Retrieve variation for visitor * @param {string} visitorId * @param {string} key * @param {BucketingAttributes} attributes * @param {Record} attributes.locationProperties * @param {Record} attributes.visitorProperties * @param {boolean=} attributes.updateVisitorProperties * @param {boolean=} attributes.enableTracking * @param {string=} attributes.environment * @return {BucketedVariation | RuleError} */ getBucketing(visitorId: string, key: string, attributes: BucketingAttributes): BucketedVariation | RuleError | BucketingError; /** * Retrieve variation for Visitor * @param {string} visitorId * @param {string} id * @param {BucketingAttributes} attributes * @param {Record} attributes.locationProperties * @param {Record} attributes.visitorProperties * @param {boolean=} attributes.updateVisitorProperties * @param {boolean=} attributes.enableTracking * @param {string=} attributes.environment * @return {BucketedVariation | RuleError} */ getBucketingById(visitorId: string, id: string, attributes: BucketingAttributes): BucketedVariation | RuleError | BucketingError; /** * Process conversion event * @param {string} visitorId * @param {string} goalId * @param {Record=} goalRule An object of key-value pairs that are used for goal matching * @param {Array} goalData An array of object of key-value pairs * @param {VisitorSegments} segments * @param {Record} conversionSetting An object of key-value pairs that are used for tracking settings */ convert(visitorId: string, goalId: string, goalRule?: Record, goalData?: Array, segments?: VisitorSegments, conversionSetting?: Record): RuleError | boolean; /** * Get audiences that meet the visitorProperties * @param {Array>} items * @param {Record} visitorProperties * @return {Array | RuleError>} */ filterMatchedRecordsWithRule(items: Array>, visitorProperties: Record, entityType: string, field?: IdentityField): Array | RuleError>; /** * Get audiences that meet the custom segments * @param {Array>} items * @param {string} visitorId * @return {Array>} */ filterMatchedCustomSegments(items: Array>, visitorId: string): Array>; /** * Extract report segments from other attribues in Visitor properties * @param {Record=} visitorProperties An object of key-value pairs that are used for audience targeting * @return {Record} */ filterReportSegments(visitorProperties: Record): Record; /** * Get list of data entities * @param {string} entityType * @return {Array} */ getEntitiesList(entityType: string): Array; /** * Get list of data entities grouped by field * @param {string} entityType * @param {IdentityField=} field * @return {Record} */ getEntitiesListObject(entityType: string, field?: IdentityField): Record; /** * * @param {string} identity Value of the field which name is provided in identityField * @param {string} entityType * @param {IdentityField=} identityField Defaults to 'key' * @return {Entity} * @private */ private _getEntityByField; /** * Find the entity in list by id * @param {string} key * @param {string} entityType * @return {Entity} */ getEntity(key: string, entityType: string): Entity; /** * Find the entity in list by keys * @param {Array} keys * @param {string} entityType * @return {Array} */ getEntities(keys: Array, entityType: string): Array; /** * Find the entity in list by id * @param {string} id * @param {string} entityType * @return {Entity} */ getEntityById(id: string, entityType: string): Entity; /** * Find the entity in list by ids * @param {Array} ids * @param {string} entityType * @return {Array} */ getEntitiesByIds(ids: Array, entityType: string): Array; /** * Find the items in list by keys * @param {Array} keys * @param {string} path * @return {Array>} */ getItemsByKeys(keys: Array, path: string): Array>; /** * Find the items in list by ids * @param {Array} ids * @param {String} path * @return {Array>} */ getItemsByIds(ids: Array, path: string): Array>; /** * Find nested item * @param {string} entityType * @param {string|number} entityIdentity * @param {string} subEntityType * @param {string|number} subEntityIdentity * @param {IdentityField} identityField * @param {IdentityField} subIdentityField * @return {Record} */ getSubItem(entityType: string, entityIdentity: string, subEntityType: string, subEntityIdentity: string, identityField: IdentityField, subIdentityField: IdentityField): Record; /** * Validates data object * @param data * @return {boolean} */ isValidConfigData(data: ConfigResponseData): boolean; }