@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
package/CHANGELOG.md
CHANGED
|
@@ -2302,11 +2302,11 @@ let CustomData$1 = class CustomData {
|
|
|
2302
2302
|
const isNumber = typeof first === 'number';
|
|
2303
2303
|
const isBoolean = typeof second === 'boolean';
|
|
2304
2304
|
if (isNumber) {
|
|
2305
|
-
this.
|
|
2305
|
+
this._index = first;
|
|
2306
2306
|
}
|
|
2307
2307
|
else {
|
|
2308
|
-
this.
|
|
2309
|
-
this.
|
|
2308
|
+
this._name = first;
|
|
2309
|
+
this._index = CustomData.UNDEFINED_INDEX;
|
|
2310
2310
|
}
|
|
2311
2311
|
this.overwrite = isBoolean ? second : true;
|
|
2312
2312
|
this.value = isBoolean
|
|
@@ -2317,7 +2317,7 @@ let CustomData$1 = class CustomData {
|
|
|
2317
2317
|
// --- Note ---
|
|
2318
2318
|
// If SDK is used in vanilla JS codebase, then you're also able to create an instance
|
|
2319
2319
|
// with no required data, we don't want send anything to tracking in that case
|
|
2320
|
-
if (typeof this.
|
|
2320
|
+
if (typeof this._index !== 'number') {
|
|
2321
2321
|
return '';
|
|
2322
2322
|
}
|
|
2323
2323
|
const uniqueValues = [...new Set(this.value)];
|
|
@@ -2334,7 +2334,7 @@ let CustomData$1 = class CustomData {
|
|
|
2334
2334
|
}
|
|
2335
2335
|
return (UrlEventType.CustomData +
|
|
2336
2336
|
UrlParameter.Index +
|
|
2337
|
-
this.
|
|
2337
|
+
this._index +
|
|
2338
2338
|
UrlParameter.ValuesCountMap +
|
|
2339
2339
|
encodeURIComponent(JSON.stringify(resultValue)) +
|
|
2340
2340
|
UrlParameter.Overwrite +
|
|
@@ -2342,7 +2342,7 @@ let CustomData$1 = class CustomData {
|
|
|
2342
2342
|
identifierParameter);
|
|
2343
2343
|
}
|
|
2344
2344
|
get data() {
|
|
2345
|
-
return Object.assign(Object.assign({ index: this.
|
|
2345
|
+
return Object.assign(Object.assign({ index: this._index }, (this._name !== undefined ? { name: this._name } : {})), { value: this.value, type: exports.KameleoonData.CustomData, isIdentifier: this.isIdentifier, status: this.status, overwrite: this.overwrite });
|
|
2346
2346
|
}
|
|
2347
2347
|
get status() {
|
|
2348
2348
|
if (this._isMappingIdentifier) {
|
|
@@ -2361,7 +2361,7 @@ let CustomData$1 = class CustomData {
|
|
|
2361
2361
|
let customData;
|
|
2362
2362
|
if (name) {
|
|
2363
2363
|
customData = new CustomData(name, overwrite !== null && overwrite !== void 0 ? overwrite : true, ...value);
|
|
2364
|
-
customData.
|
|
2364
|
+
customData.index = index;
|
|
2365
2365
|
}
|
|
2366
2366
|
else {
|
|
2367
2367
|
customData = new CustomData(index, overwrite !== null && overwrite !== void 0 ? overwrite : true, ...value);
|
|
@@ -2398,13 +2398,28 @@ let CustomData$1 = class CustomData {
|
|
|
2398
2398
|
}
|
|
2399
2399
|
/**
|
|
2400
2400
|
* @private
|
|
2401
|
-
* @method
|
|
2401
|
+
* @method index - an internal setter for setting index of custom data
|
|
2402
2402
|
* @param {number} value - an index value
|
|
2403
2403
|
* */
|
|
2404
|
-
set
|
|
2405
|
-
this.
|
|
2404
|
+
set index(value) {
|
|
2405
|
+
this._index = value;
|
|
2406
|
+
}
|
|
2407
|
+
/**
|
|
2408
|
+
* @private
|
|
2409
|
+
* @method index - an internal getter for index of custom data
|
|
2410
|
+
* */
|
|
2411
|
+
get index() {
|
|
2412
|
+
return this._index;
|
|
2413
|
+
}
|
|
2414
|
+
/**
|
|
2415
|
+
* @private
|
|
2416
|
+
* @method name - an internal getter for a name of custom data
|
|
2417
|
+
* */
|
|
2418
|
+
get name() {
|
|
2419
|
+
return this._name;
|
|
2406
2420
|
}
|
|
2407
2421
|
};
|
|
2422
|
+
CustomData$1.UNDEFINED_INDEX = -1;
|
|
2408
2423
|
|
|
2409
2424
|
/**
|
|
2410
2425
|
* @class
|
|
@@ -2441,6 +2456,9 @@ let Conversion$1 = class Conversion {
|
|
|
2441
2456
|
? UrlParameter.Metadata + this._encodeMetadata()
|
|
2442
2457
|
: ''));
|
|
2443
2458
|
}
|
|
2459
|
+
get _metadata() {
|
|
2460
|
+
return this.metadata;
|
|
2461
|
+
}
|
|
2444
2462
|
get data() {
|
|
2445
2463
|
var _a;
|
|
2446
2464
|
return {
|
|
@@ -5871,7 +5889,9 @@ class DataManager {
|
|
|
5871
5889
|
return null;
|
|
5872
5890
|
}
|
|
5873
5891
|
mutUpdateTargetingData({ infoData, visitorCode, kameleoonData, targetingData, }) {
|
|
5892
|
+
var _a;
|
|
5874
5893
|
for (const dataItem of kameleoonData) {
|
|
5894
|
+
// process custom data
|
|
5875
5895
|
if (dataItem.data.type === exports.KameleoonData.CustomData) {
|
|
5876
5896
|
const customDataIsValid = this.processCustomData({
|
|
5877
5897
|
infoData,
|
|
@@ -5883,6 +5903,10 @@ class DataManager {
|
|
|
5883
5903
|
continue;
|
|
5884
5904
|
}
|
|
5885
5905
|
}
|
|
5906
|
+
// process metadata of conversions
|
|
5907
|
+
if (dataItem.data.type === exports.KameleoonData.Conversion) {
|
|
5908
|
+
(_a = dataItem._metadata) === null || _a === void 0 ? void 0 : _a.forEach((item) => this.trySetCustomDataIndexByName(item));
|
|
5909
|
+
}
|
|
5886
5910
|
const expirationTime = this.dataProcessor.mutUpdateData({
|
|
5887
5911
|
infoData,
|
|
5888
5912
|
visitorCode,
|
|
@@ -5922,13 +5946,9 @@ class DataManager {
|
|
|
5922
5946
|
var _a;
|
|
5923
5947
|
const { data } = customData;
|
|
5924
5948
|
const isDataValid = Boolean(data.value.length && data.value[0].length);
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
return false;
|
|
5929
|
-
}
|
|
5930
|
-
data.index = cdIndex;
|
|
5931
|
-
customData._index = cdIndex;
|
|
5949
|
+
this.trySetCustomDataIndexByName(customData);
|
|
5950
|
+
if (data.index == CustomData$1.UNDEFINED_INDEX) {
|
|
5951
|
+
data.index = customData.index;
|
|
5932
5952
|
}
|
|
5933
5953
|
if (this.mappingIdentifierCustomDataIndex === data.index && isDataValid) {
|
|
5934
5954
|
customData._isMappingIdentifier = true;
|
|
@@ -5955,6 +5975,15 @@ class DataManager {
|
|
|
5955
5975
|
}
|
|
5956
5976
|
return true;
|
|
5957
5977
|
}
|
|
5978
|
+
trySetCustomDataIndexByName(customData) {
|
|
5979
|
+
if (customData.index == CustomData$1.UNDEFINED_INDEX && customData.name) {
|
|
5980
|
+
const cdIndex = this.customDataIndexByName.get(customData.name);
|
|
5981
|
+
if (cdIndex === undefined) {
|
|
5982
|
+
return;
|
|
5983
|
+
}
|
|
5984
|
+
customData.index = cdIndex;
|
|
5985
|
+
}
|
|
5986
|
+
}
|
|
5958
5987
|
get unsentDataVisitors() {
|
|
5959
5988
|
const infoResult = this.infoStorage.read();
|
|
5960
5989
|
if (!infoResult.ok) {
|