@kameleoon/javascript-sdk-core 5.16.0 → 5.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -1
- package/dist/clientConfiguration/clientConfiguration.d.ts +4 -1
- package/dist/clientConfiguration/constants.d.ts +2 -3
- package/dist/clientConfiguration/types.d.ts +5 -0
- package/dist/javascript-sdk-core-browser.cjs.js +225 -96
- package/dist/javascript-sdk-core-browser.cjs.js.map +1 -1
- package/dist/javascript-sdk-core-browser.es.js +225 -96
- package/dist/javascript-sdk-core-browser.es.js.map +1 -1
- package/dist/javascript-sdk-core.cjs.js +225 -96
- package/dist/javascript-sdk-core.cjs.js.map +1 -1
- package/dist/javascript-sdk-core.es.js +225 -96
- package/dist/javascript-sdk-core.es.js.map +1 -1
- package/dist/kameleoonClient.d.ts +2 -0
- package/dist/kameleoonData/conversion.d.ts +12 -0
- package/dist/kameleoonData/customData.d.ts +20 -4
- package/dist/kameleoonData/dataManager.d.ts +3 -2
- package/dist/kameleoonData/dataProcessor.d.ts +2 -2
- package/dist/kameleoonData/types.d.ts +5 -3
- package/dist/requester/constants.d.ts +1 -1
- package/dist/requester/urlProvider.d.ts +1 -0
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/types.d.ts +13 -5
- package/dist/variationConfiguration/types.d.ts +2 -0
- package/dist/variationConfiguration/variationConfiguration.d.ts +1 -1
- package/package.json +1 -1
|
@@ -54,6 +54,8 @@ export declare class KameleoonClient implements IKameleoonClient {
|
|
|
54
54
|
getDataFile(): DataFile;
|
|
55
55
|
protected setUserConsent({ visitorCode, consent, setData, }: SetUserConsentParametersType): void;
|
|
56
56
|
private updateConsentData;
|
|
57
|
+
private getLegalConsent;
|
|
58
|
+
private extractLegalConsent;
|
|
57
59
|
protected _isConsentProvided(visitorCode: string): boolean;
|
|
58
60
|
private _getFeatureVariables;
|
|
59
61
|
private _getActiveFeatureVariations;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { VisitType } from '../requester';
|
|
2
2
|
import { ConversionDataType, ConversionParametersType, IKameleoonData } from './types';
|
|
3
3
|
import { TrackingStatus } from '../types';
|
|
4
|
+
import { CustomData } from '../kameleoonData/customData';
|
|
4
5
|
/**
|
|
5
6
|
* @class
|
|
6
7
|
* Conversion - a class for creating an instance for conversion tracking
|
|
@@ -20,6 +21,17 @@ export declare class Conversion implements IKameleoonData {
|
|
|
20
21
|
set _id(id: number);
|
|
21
22
|
set _nonce(nonce: string);
|
|
22
23
|
get url(): string;
|
|
24
|
+
/**
|
|
25
|
+
* @private
|
|
26
|
+
* @method metadata - an internal getter for a metadata of conversion
|
|
27
|
+
* */
|
|
28
|
+
get _metadata(): CustomData[] | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* @private
|
|
31
|
+
* @method metadata - an internal setter for setting metadata of conversion
|
|
32
|
+
* @param {number} value - an index value
|
|
33
|
+
* */
|
|
34
|
+
set _metadata(value: CustomData[] | undefined);
|
|
23
35
|
get data(): ConversionDataType;
|
|
24
36
|
private _encodeMetadata;
|
|
25
37
|
/**
|
|
@@ -6,12 +6,13 @@ import { TrackingStatus } from '../types';
|
|
|
6
6
|
* CustomData - a class for creating an instance for user's custom data
|
|
7
7
|
* */
|
|
8
8
|
export declare class CustomData implements IKameleoonData {
|
|
9
|
+
static readonly UNDEFINED_INDEX = -1;
|
|
9
10
|
private _status;
|
|
10
|
-
private
|
|
11
|
+
private _index;
|
|
11
12
|
private value;
|
|
12
13
|
private isIdentifier;
|
|
13
14
|
private overwrite;
|
|
14
|
-
private
|
|
15
|
+
private _name?;
|
|
15
16
|
/**
|
|
16
17
|
* @param {number|string} indexOrName - either:
|
|
17
18
|
* - `number` — an index of custom data (configured in *Advanced Tools* section of Kameleoon Application)
|
|
@@ -68,8 +69,23 @@ export declare class CustomData implements IKameleoonData {
|
|
|
68
69
|
static _updateFromVisit(visit: VisitType, dataMap: Map<number, CustomData>): void;
|
|
69
70
|
/**
|
|
70
71
|
* @private
|
|
71
|
-
* @method
|
|
72
|
+
* @method index - an internal setter for setting index of custom data
|
|
72
73
|
* @param {number} value - an index value
|
|
73
74
|
* */
|
|
74
|
-
set
|
|
75
|
+
set index(value: number);
|
|
76
|
+
/**
|
|
77
|
+
* @private
|
|
78
|
+
* @method index - an internal getter for index of custom data
|
|
79
|
+
* */
|
|
80
|
+
get index(): number;
|
|
81
|
+
/**
|
|
82
|
+
* @private
|
|
83
|
+
* @method name - an internal getter for a name of custom data
|
|
84
|
+
* */
|
|
85
|
+
get name(): string | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* @private
|
|
88
|
+
* @method name - an internal getter for a name of custom data
|
|
89
|
+
* */
|
|
90
|
+
get values(): string[];
|
|
75
91
|
}
|
|
@@ -11,7 +11,7 @@ import { DataInfoType, MappingIdentifierType } from '../storage/types';
|
|
|
11
11
|
import { ExternalPackageInfoType } from '../sdkInfoTypes';
|
|
12
12
|
import { StaticData } from '../kameleoonData/staticData';
|
|
13
13
|
export interface IDataManager {
|
|
14
|
-
storeData(data: VisitorsDataType): Result<void, KameleoonError>;
|
|
14
|
+
storeData(data: VisitorsDataType, extendTtl: boolean): Result<void, KameleoonError>;
|
|
15
15
|
storeTrackedData(data: VisitorsDataType): void;
|
|
16
16
|
getTree(segment: SegmentType): Tree;
|
|
17
17
|
clearTrees(): void;
|
|
@@ -45,7 +45,7 @@ export declare class DataManager implements IDataManager {
|
|
|
45
45
|
getPendingData(visitorCode: string): KameleoonDataType[];
|
|
46
46
|
private getDataFromRaw;
|
|
47
47
|
storeTrackedData(data: VisitorsDataType): void;
|
|
48
|
-
storeData(data: VisitorsDataType): Result<void, KameleoonError>;
|
|
48
|
+
storeData(data: VisitorsDataType, extendTtl: boolean): Result<void, KameleoonError>;
|
|
49
49
|
storeData(visitorCode: string, ...data: KameleoonDataType[]): Result<void, KameleoonError>;
|
|
50
50
|
getTree(segment: SegmentType): Tree;
|
|
51
51
|
clearTrees(): void;
|
|
@@ -60,6 +60,7 @@ export declare class DataManager implements IDataManager {
|
|
|
60
60
|
private mutUpdateTargetingData;
|
|
61
61
|
private cleanupData;
|
|
62
62
|
private processCustomData;
|
|
63
|
+
private trySetCustomDataIndexByName;
|
|
63
64
|
get unsentDataVisitors(): string[];
|
|
64
65
|
get identifierCustomDataIndex(): number | null;
|
|
65
66
|
get trees(): Map<string, Tree>;
|
|
@@ -3,7 +3,7 @@ import { DereferenceTargetingDataResultType, MutAddUnsentDataType, MutUpdateData
|
|
|
3
3
|
import { DataInfoType } from '../storage';
|
|
4
4
|
import { ExternalPackageInfoType } from '../sdkInfoTypes';
|
|
5
5
|
interface IDataProcessor {
|
|
6
|
-
mutUpdateData({ visitorCode, mutData, dataItem, }: MutUpdateDataParametersType): number;
|
|
6
|
+
mutUpdateData({ visitorCode, mutData, dataItem, extendTtl, }: MutUpdateDataParametersType): number | undefined;
|
|
7
7
|
mutCleanupData(mutData: TargetingDataType, infoData: DataInfoType): number | null;
|
|
8
8
|
createReference({ mutData, visitorCode, linkedVisitor, infoData, }: ReferenceParametersType): void;
|
|
9
9
|
dereferenceData(data: TargetingDataType, visitorCode: string): DereferenceTargetingDataResultType;
|
|
@@ -13,7 +13,7 @@ export declare class DataProcessor implements IDataProcessor {
|
|
|
13
13
|
private cleanupInterval;
|
|
14
14
|
private packageInfo;
|
|
15
15
|
constructor(cleanupInterval: number | null | undefined, packageInfo: ExternalPackageInfoType);
|
|
16
|
-
mutUpdateData({ infoData, visitorCode, mutData, dataItem, }: MutUpdateDataParametersType): number;
|
|
16
|
+
mutUpdateData({ infoData, visitorCode, mutData, dataItem, extendTtl, }: MutUpdateDataParametersType): number | undefined;
|
|
17
17
|
mutCleanupData(mutData: TargetingDataType, infoData: DataInfoType): number | null;
|
|
18
18
|
mutAddUnsentData({ mutData, visitorCode, dataType, }: MutAddUnsentDataType): void;
|
|
19
19
|
createReference({ mutData, visitorCode, linkedVisitor, }: ReferenceParametersType): void;
|
|
@@ -8,7 +8,7 @@ import { Personalization } from '../kameleoonData/personalization';
|
|
|
8
8
|
import { CBScores } from '../kameleoonData/cbScores';
|
|
9
9
|
import { TargetedSegment } from '../kameleoonData/targetedSegment';
|
|
10
10
|
export type FieldParametersType = {
|
|
11
|
-
expirationTime
|
|
11
|
+
expirationTime?: number;
|
|
12
12
|
key: KameleoonData;
|
|
13
13
|
value: BrowserDataType | CookieDataType | DeviceDataType | GeolocationDataType | OperatingSystemDataType | UserAgentDataType | VisitsDataType;
|
|
14
14
|
visitorCode: string;
|
|
@@ -20,7 +20,7 @@ export type VisitorProcessorParametersType = {
|
|
|
20
20
|
visitorCode: string;
|
|
21
21
|
};
|
|
22
22
|
export type NestedFieldParametersType = {
|
|
23
|
-
expirationTime
|
|
23
|
+
expirationTime?: number;
|
|
24
24
|
visitorCode: string;
|
|
25
25
|
key: KameleoonData.CustomData | KameleoonData.PageView | KameleoonData.Conversion | KameleoonData.Personalization | KameleoonData.TargetedSegment;
|
|
26
26
|
nestedKey: string;
|
|
@@ -135,7 +135,7 @@ export declare enum KameleoonData {
|
|
|
135
135
|
type CommonUpdateParametersType = {
|
|
136
136
|
mutData: DereferencedTargetingDataType;
|
|
137
137
|
visitorCode: string;
|
|
138
|
-
expirationTime
|
|
138
|
+
expirationTime?: number;
|
|
139
139
|
};
|
|
140
140
|
export type UpdateCustomDataParametersType = {
|
|
141
141
|
customData: CustomData;
|
|
@@ -169,12 +169,14 @@ export type MutUpdateDataParametersType = {
|
|
|
169
169
|
mutData: TargetingDataType;
|
|
170
170
|
dataItem: KameleoonDataType;
|
|
171
171
|
visitorCode: string;
|
|
172
|
+
extendTtl: boolean;
|
|
172
173
|
};
|
|
173
174
|
export type MutUpdateTargetingDataParametersType = {
|
|
174
175
|
visitorCode: string;
|
|
175
176
|
infoData: DataInfoType;
|
|
176
177
|
kameleoonData: KameleoonDataType[];
|
|
177
178
|
targetingData: TargetingDataType;
|
|
179
|
+
extendTtl: boolean;
|
|
178
180
|
};
|
|
179
181
|
export type ReferenceParametersType = {
|
|
180
182
|
mutData: TargetingDataType;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DomainsType, EventType, ParameterType, QueryType, StrictEventTypeRecord, StrictFirstParameterRecord, StrictParameterRecord, StrictQueryRecord, StrictTrackingRecord, TrackingType } from './types';
|
|
2
|
-
export declare const NUMBER_OF_RETRIES =
|
|
2
|
+
export declare const NUMBER_OF_RETRIES = 1;
|
|
3
3
|
export declare enum Header {
|
|
4
4
|
UserAgent = "User-Agent",
|
|
5
5
|
ContentType = "Content-Type",
|
|
@@ -17,6 +17,7 @@ export declare class UrlProvider implements IUrlProvider {
|
|
|
17
17
|
private packageInfo?;
|
|
18
18
|
initialize({ domain, siteCode, packageInfo, environment, }: UrlProviderInitializeParamsType): void;
|
|
19
19
|
set dataApiDomain(domain: string);
|
|
20
|
+
get dataApiDomain(): string;
|
|
20
21
|
getClientConfigurationUrl(timeStamp?: number): string;
|
|
21
22
|
getEventSourceUrl(): string;
|
|
22
23
|
getRemoteDataUrl(key: string): string;
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { KameleoonStorageKey, VISIT_DURATION } from './constants';
|
|
|
2
2
|
export { DataStorage } from './storage';
|
|
3
3
|
export { IntegrityChecker } from './integrityChecker';
|
|
4
4
|
export { StorageCleanupManager } from './storageCleanupManager';
|
|
5
|
-
export { ClientDataType, TrackingDataType, VariationDataType,
|
|
5
|
+
export { ClientDataType, TrackingDataType, VariationDataType, StorageConsentDataType, DataInfoType, StorageDataType, FeatureFlagVariationsType, IStorage, IExternalStorage, } from './types';
|
package/dist/storage/types.d.ts
CHANGED
|
@@ -76,10 +76,18 @@ export type ForcedVariationDataType = {
|
|
|
76
76
|
[featureKey: string]: ForcedFeatureVariationType;
|
|
77
77
|
};
|
|
78
78
|
};
|
|
79
|
-
export
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
export declare enum LegalConsent {
|
|
80
|
+
Unknown = 0,
|
|
81
|
+
Given = 1,
|
|
82
|
+
NotGiven = 2
|
|
83
|
+
}
|
|
84
|
+
export type LegalConsentDataType = boolean | {
|
|
85
|
+
consent: LegalConsent;
|
|
86
|
+
} | {
|
|
87
|
+
consent: boolean;
|
|
88
|
+
};
|
|
89
|
+
export type StorageConsentDataType = {
|
|
90
|
+
[visitorCode: string]: LegalConsentDataType;
|
|
83
91
|
};
|
|
84
92
|
export type ScheduledVisitorsType = {
|
|
85
93
|
[visitorCode: string]: {
|
|
@@ -94,7 +102,7 @@ export type TrackingDataType = {
|
|
|
94
102
|
*
|
|
95
103
|
* `string` represents visitor code storage with only one string value
|
|
96
104
|
* */
|
|
97
|
-
export type StorageDataType = ClientDataType | TargetingDataType | TrackingDataType | VariationDataType |
|
|
105
|
+
export type StorageDataType = ClientDataType | TargetingDataType | TrackingDataType | VariationDataType | StorageConsentDataType | DataInfoType | string;
|
|
98
106
|
/**
|
|
99
107
|
* @interface an interface of External Storage which must be implemented to be used as external storage an SDK
|
|
100
108
|
* */
|
|
@@ -3,6 +3,7 @@ import { DataManager } from '../kameleoonData';
|
|
|
3
3
|
import { KameleoonVisitorDataType } from '../kameleoonData/types';
|
|
4
4
|
import { TrackingStatus } from '../types';
|
|
5
5
|
import { ExternalPackageInfoType } from '../sdkInfoTypes';
|
|
6
|
+
import { LegalConsent } from '../storage/types';
|
|
6
7
|
export type UpdateDataStatusParametersType = {
|
|
7
8
|
visitorCode: string;
|
|
8
9
|
experimentIdList: string[];
|
|
@@ -27,6 +28,7 @@ export type GetVariationParametersType = {
|
|
|
27
28
|
packageInfo: ExternalPackageInfoType;
|
|
28
29
|
clientConfiguration: ClientConfiguration;
|
|
29
30
|
dataManager: DataManager;
|
|
31
|
+
legalConsent: LegalConsent;
|
|
30
32
|
};
|
|
31
33
|
export type BaseVariationDataType = {
|
|
32
34
|
experimentId: number;
|
|
@@ -63,7 +63,7 @@ export declare class VariationConfiguration implements IVariationConfiguration {
|
|
|
63
63
|
getVisitorsWithUnsentData(): string[];
|
|
64
64
|
getPendingData(visitorCode: string): BaseVariationDataType[];
|
|
65
65
|
getStoredVariations(visitorCode: string): Result<FeatureFlagVariationsType, KameleoonError>;
|
|
66
|
-
getVariation({ visitorCode, visitorIdentifier, featureFlag, targetingData, packageInfo, clientConfiguration, dataManager, track, withAssignment, }: GetVariationParametersType): Result<FeatureFlagVariationType, KameleoonError>;
|
|
66
|
+
getVariation({ visitorCode, visitorIdentifier, featureFlag, targetingData, packageInfo, clientConfiguration, dataManager, legalConsent, track, withAssignment, }: GetVariationParametersType): Result<FeatureFlagVariationType, KameleoonError>;
|
|
67
67
|
private createAndSaveForcedTargetedVariation;
|
|
68
68
|
updateStoredVariations(visitorCode: string, variationData: FeatureFlagVariationsType): Result<void, KameleoonError>;
|
|
69
69
|
private getVariationData;
|