@kameleoon/javascript-sdk-core
Version:
Kameleoon JS SDK Core
51 lines (50 loc) • 2.07 kB
TypeScript
import { VisitType } from '../requester';
import { CustomDataType, IKameleoonData } from './types';
import { TrackingStatus } from '../types';
/**
* @class
* CustomData - a class for creating an instance for user's custom data
* */
export declare class CustomData implements IKameleoonData {
private _status;
private index;
private value;
private isIdentifier;
/**
* @param {number} index - an index of custom data to be stored under in a state, an index of custom data can be specified in `Advanced Tools` section of Kameleoon Application
* @param {string[]} value - custom value to store under the specified id, value can be anything but has to be stringified to match the `string` type. *Note* value is variadic parameter and can be used as follows
* @example
* ```ts
* // - Single value
* const customData = new CustomData(0, 'value_1');
* // - Variadic number of values
* const customData = new CustomData(0, 'value_1', 'value_2', 'value_3');
* // - Array of values
* const values = ['value_1', 'value_2', 'value_3'];
* const customData = new CustomData(0, ...values);
* ```
* */
constructor(index: number, ...value: string[]);
get url(): string;
get data(): CustomDataType;
get status(): TrackingStatus;
/**
* @private
* @method _fromRaw - an internal method for creating a CustomData instance from raw data
* @param {CustomDataType} data - a raw data
* @return {CustomData} a CustomData instance
* */
static _fromRaw(data: CustomDataType): CustomData;
/**
* @property isMappingIdentifier - signifying if the data is a mapping identifier
* @private
* */
set _isMappingIdentifier(value: boolean);
set status(status: TrackingStatus);
/**
* @private
* @method _updateFromVisit - an internal method for updating a list of custom data from a visit
* @param {VisitType} visit - a visit
* */
static _updateFromVisit(visit: VisitType, dataMap: Map<number, CustomData>): void;
}