@kameleoon/javascript-sdk-core 5.16.0 → 5.16.1
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 +6 -0
- package/dist/javascript-sdk-core-browser.cjs.js +46 -17
- package/dist/javascript-sdk-core-browser.cjs.js.map +1 -1
- package/dist/javascript-sdk-core-browser.es.js +46 -17
- package/dist/javascript-sdk-core-browser.es.js.map +1 -1
- package/dist/javascript-sdk-core.cjs.js +46 -17
- package/dist/javascript-sdk-core.cjs.js.map +1 -1
- package/dist/javascript-sdk-core.es.js +46 -17
- package/dist/javascript-sdk-core.es.js.map +1 -1
- package/dist/kameleoonData/conversion.d.ts +2 -0
- package/dist/kameleoonData/customData.d.ts +15 -4
- package/dist/kameleoonData/dataManager.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2300,11 +2300,11 @@ let CustomData$1 = class CustomData {
|
|
|
2300
2300
|
const isNumber = typeof first === 'number';
|
|
2301
2301
|
const isBoolean = typeof second === 'boolean';
|
|
2302
2302
|
if (isNumber) {
|
|
2303
|
-
this.
|
|
2303
|
+
this._index = first;
|
|
2304
2304
|
}
|
|
2305
2305
|
else {
|
|
2306
|
-
this.
|
|
2307
|
-
this.
|
|
2306
|
+
this._name = first;
|
|
2307
|
+
this._index = CustomData.UNDEFINED_INDEX;
|
|
2308
2308
|
}
|
|
2309
2309
|
this.overwrite = isBoolean ? second : true;
|
|
2310
2310
|
this.value = isBoolean
|
|
@@ -2315,7 +2315,7 @@ let CustomData$1 = class CustomData {
|
|
|
2315
2315
|
// --- Note ---
|
|
2316
2316
|
// If SDK is used in vanilla JS codebase, then you're also able to create an instance
|
|
2317
2317
|
// with no required data, we don't want send anything to tracking in that case
|
|
2318
|
-
if (typeof this.
|
|
2318
|
+
if (typeof this._index !== 'number') {
|
|
2319
2319
|
return '';
|
|
2320
2320
|
}
|
|
2321
2321
|
const uniqueValues = [...new Set(this.value)];
|
|
@@ -2332,7 +2332,7 @@ let CustomData$1 = class CustomData {
|
|
|
2332
2332
|
}
|
|
2333
2333
|
return (UrlEventType.CustomData +
|
|
2334
2334
|
UrlParameter.Index +
|
|
2335
|
-
this.
|
|
2335
|
+
this._index +
|
|
2336
2336
|
UrlParameter.ValuesCountMap +
|
|
2337
2337
|
encodeURIComponent(JSON.stringify(resultValue)) +
|
|
2338
2338
|
UrlParameter.Overwrite +
|
|
@@ -2340,7 +2340,7 @@ let CustomData$1 = class CustomData {
|
|
|
2340
2340
|
identifierParameter);
|
|
2341
2341
|
}
|
|
2342
2342
|
get data() {
|
|
2343
|
-
return Object.assign(Object.assign({ index: this.
|
|
2343
|
+
return Object.assign(Object.assign({ index: this._index }, (this._name !== undefined ? { name: this._name } : {})), { value: this.value, type: KameleoonData.CustomData, isIdentifier: this.isIdentifier, status: this.status, overwrite: this.overwrite });
|
|
2344
2344
|
}
|
|
2345
2345
|
get status() {
|
|
2346
2346
|
if (this._isMappingIdentifier) {
|
|
@@ -2359,7 +2359,7 @@ let CustomData$1 = class CustomData {
|
|
|
2359
2359
|
let customData;
|
|
2360
2360
|
if (name) {
|
|
2361
2361
|
customData = new CustomData(name, overwrite !== null && overwrite !== void 0 ? overwrite : true, ...value);
|
|
2362
|
-
customData.
|
|
2362
|
+
customData.index = index;
|
|
2363
2363
|
}
|
|
2364
2364
|
else {
|
|
2365
2365
|
customData = new CustomData(index, overwrite !== null && overwrite !== void 0 ? overwrite : true, ...value);
|
|
@@ -2396,13 +2396,28 @@ let CustomData$1 = class CustomData {
|
|
|
2396
2396
|
}
|
|
2397
2397
|
/**
|
|
2398
2398
|
* @private
|
|
2399
|
-
* @method
|
|
2399
|
+
* @method index - an internal setter for setting index of custom data
|
|
2400
2400
|
* @param {number} value - an index value
|
|
2401
2401
|
* */
|
|
2402
|
-
set
|
|
2403
|
-
this.
|
|
2402
|
+
set index(value) {
|
|
2403
|
+
this._index = value;
|
|
2404
|
+
}
|
|
2405
|
+
/**
|
|
2406
|
+
* @private
|
|
2407
|
+
* @method index - an internal getter for index of custom data
|
|
2408
|
+
* */
|
|
2409
|
+
get index() {
|
|
2410
|
+
return this._index;
|
|
2411
|
+
}
|
|
2412
|
+
/**
|
|
2413
|
+
* @private
|
|
2414
|
+
* @method name - an internal getter for a name of custom data
|
|
2415
|
+
* */
|
|
2416
|
+
get name() {
|
|
2417
|
+
return this._name;
|
|
2404
2418
|
}
|
|
2405
2419
|
};
|
|
2420
|
+
CustomData$1.UNDEFINED_INDEX = -1;
|
|
2406
2421
|
|
|
2407
2422
|
/**
|
|
2408
2423
|
* @class
|
|
@@ -2439,6 +2454,9 @@ let Conversion$1 = class Conversion {
|
|
|
2439
2454
|
? UrlParameter.Metadata + this._encodeMetadata()
|
|
2440
2455
|
: ''));
|
|
2441
2456
|
}
|
|
2457
|
+
get _metadata() {
|
|
2458
|
+
return this.metadata;
|
|
2459
|
+
}
|
|
2442
2460
|
get data() {
|
|
2443
2461
|
var _a;
|
|
2444
2462
|
return {
|
|
@@ -5869,7 +5887,9 @@ class DataManager {
|
|
|
5869
5887
|
return null;
|
|
5870
5888
|
}
|
|
5871
5889
|
mutUpdateTargetingData({ infoData, visitorCode, kameleoonData, targetingData, }) {
|
|
5890
|
+
var _a;
|
|
5872
5891
|
for (const dataItem of kameleoonData) {
|
|
5892
|
+
// process custom data
|
|
5873
5893
|
if (dataItem.data.type === KameleoonData.CustomData) {
|
|
5874
5894
|
const customDataIsValid = this.processCustomData({
|
|
5875
5895
|
infoData,
|
|
@@ -5881,6 +5901,10 @@ class DataManager {
|
|
|
5881
5901
|
continue;
|
|
5882
5902
|
}
|
|
5883
5903
|
}
|
|
5904
|
+
// process metadata of conversions
|
|
5905
|
+
if (dataItem.data.type === KameleoonData.Conversion) {
|
|
5906
|
+
(_a = dataItem._metadata) === null || _a === void 0 ? void 0 : _a.forEach((item) => this.trySetCustomDataIndexByName(item));
|
|
5907
|
+
}
|
|
5884
5908
|
const expirationTime = this.dataProcessor.mutUpdateData({
|
|
5885
5909
|
infoData,
|
|
5886
5910
|
visitorCode,
|
|
@@ -5920,13 +5944,9 @@ class DataManager {
|
|
|
5920
5944
|
var _a;
|
|
5921
5945
|
const { data } = customData;
|
|
5922
5946
|
const isDataValid = Boolean(data.value.length && data.value[0].length);
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
return false;
|
|
5927
|
-
}
|
|
5928
|
-
data.index = cdIndex;
|
|
5929
|
-
customData._index = cdIndex;
|
|
5947
|
+
this.trySetCustomDataIndexByName(customData);
|
|
5948
|
+
if (data.index == CustomData$1.UNDEFINED_INDEX) {
|
|
5949
|
+
data.index = customData.index;
|
|
5930
5950
|
}
|
|
5931
5951
|
if (this.mappingIdentifierCustomDataIndex === data.index && isDataValid) {
|
|
5932
5952
|
customData._isMappingIdentifier = true;
|
|
@@ -5953,6 +5973,15 @@ class DataManager {
|
|
|
5953
5973
|
}
|
|
5954
5974
|
return true;
|
|
5955
5975
|
}
|
|
5976
|
+
trySetCustomDataIndexByName(customData) {
|
|
5977
|
+
if (customData.index == CustomData$1.UNDEFINED_INDEX && customData.name) {
|
|
5978
|
+
const cdIndex = this.customDataIndexByName.get(customData.name);
|
|
5979
|
+
if (cdIndex === undefined) {
|
|
5980
|
+
return;
|
|
5981
|
+
}
|
|
5982
|
+
customData.index = cdIndex;
|
|
5983
|
+
}
|
|
5984
|
+
}
|
|
5956
5985
|
get unsentDataVisitors() {
|
|
5957
5986
|
const infoResult = this.infoStorage.read();
|
|
5958
5987
|
if (!infoResult.ok) {
|