@kameleoon/javascript-sdk-core 5.17.0 → 5.17.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 CHANGED
@@ -1,13 +1,19 @@
1
1
  # Change Log
2
2
 
3
+ ## 5.17.1 (2025-12-24)
4
+
5
+ ### Patch Changes
6
+
7
+ - Stability and performance improvements
8
+
3
9
  ## 5.17.0 (2025-12-17)
4
10
 
5
11
  ### Features
6
12
 
7
13
  - Fixed an issue where **[Kameleoon Data](https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/js-sdk/#data-types)** was retained beyond the configured **[`targetingDataCleanupInterval`](https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/js-sdk/#configuration-parameters)** if the **[Data API](https://developers.kameleoon.com/apis/data-api-rest/all-endpoints/post-visit-events/)** encountered internal errors. Expired data is now reliably removed in accordance with the cleanup interval.
8
14
  - Updated evaluation and tracking logic to comply with GDPR requirements when consent is not given:
9
- - If behavior is **partially blocked**, the default variation will be returned.
10
- - If behavior is **completely blocked**, an exception will be thrown.
15
+ - If behavior is **partially blocked**, the default variation will be returned.
16
+ - If behavior is **completely blocked**, an exception will be thrown.
11
17
 
12
18
  ## 5.16.1 (2025-10-23)
13
19
 
@@ -2936,7 +2936,10 @@ class VisitsData {
2936
2936
  constructor(visits) {
2937
2937
  this.status = exports.TrackingStatus.Sent;
2938
2938
  this.visits = visits;
2939
- this.visitNumber = visits.length ? visits.length - 1 : 0;
2939
+ this._visitNumber = visits.length ? visits.length - 1 : 0;
2940
+ }
2941
+ get visitNumber() {
2942
+ return this._visitNumber;
2940
2943
  }
2941
2944
  get url() {
2942
2945
  return '';
@@ -2944,7 +2947,7 @@ class VisitsData {
2944
2947
  get data() {
2945
2948
  return {
2946
2949
  visits: this.visits,
2947
- visitNumber: this.visitNumber,
2950
+ visitNumber: this._visitNumber,
2948
2951
  type: exports.KameleoonData.VisitsData,
2949
2952
  status: this.status,
2950
2953
  };
@@ -2961,11 +2964,11 @@ class VisitsData {
2961
2964
  list: this.visits,
2962
2965
  visit,
2963
2966
  });
2964
- this.visitNumber = this.visits.length ? this.visits.length - 1 : 0;
2967
+ this._visitNumber = this.visits.length ? this.visits.length - 1 : 0;
2965
2968
  }
2966
2969
  updateVisitNumber(visitNumber) {
2967
- if (visitNumber > this.visitNumber) {
2968
- this.visitNumber = visitNumber;
2970
+ if (visitNumber > this._visitNumber) {
2971
+ this._visitNumber = visitNumber;
2969
2972
  }
2970
2973
  }
2971
2974
  }
@@ -3172,10 +3175,12 @@ class VisitProcessor {
3172
3175
  timeLastActivity: (_a = visit.timeLastEvent) !== null && _a !== void 0 ? _a : visit.timeStarted,
3173
3176
  };
3174
3177
  }
3175
- processVisitNumber(visit, isCurrentVisit) {
3176
- if (visit.staticDataEvent) {
3177
- const visitNumber = visit.staticDataEvent.data.visitNumber + (isCurrentVisit ? 0 : 1);
3178
- this.visitsData.updateVisitNumber(visitNumber);
3178
+ processVisitNumber(visit, visitOffset) {
3179
+ var _a, _b, _c;
3180
+ if (this.visitsData.visitNumber <= visitOffset &&
3181
+ ((_a = visit.staticDataEvent) === null || _a === void 0 ? void 0 : _a.data.visitNumber)) {
3182
+ const visitNumber = (_c = (_b = visit.staticDataEvent) === null || _b === void 0 ? void 0 : _b.data.visitNumber) !== null && _c !== void 0 ? _c : 0;
3183
+ this.visitsData.updateVisitNumber(visitNumber + visitOffset);
3179
3184
  }
3180
3185
  }
3181
3186
  processCbs(cbsData) {
@@ -3349,12 +3354,12 @@ class Parser {
3349
3354
  }
3350
3355
  if (currentVisit) {
3351
3356
  visitProcessor.processVisit(currentVisit);
3352
- visitProcessor.processVisitNumber(currentVisit, true);
3357
+ visitProcessor.processVisitNumber(currentVisit, 0);
3353
3358
  }
3354
- previousVisits === null || previousVisits === void 0 ? void 0 : previousVisits.forEach((visit) => {
3359
+ previousVisits === null || previousVisits === void 0 ? void 0 : previousVisits.forEach((visit, index) => {
3355
3360
  visitProcessor.processVisit(visit);
3356
3361
  visitProcessor.processVisitsData(visit);
3357
- visitProcessor.processVisitNumber(visit, false);
3362
+ visitProcessor.processVisitNumber(visit, index + 1);
3358
3363
  });
3359
3364
  visitProcessor.processKcs(kcs);
3360
3365
  visitProcessor.processCbs(cbs);
@@ -9045,7 +9050,9 @@ class KameleoonClient {
9045
9050
  KameleoonLogger.debug `CALL: KameleoonClient._isVisitorNotInHoldout(visitorCode: ${visitorCode}, track: ${track}, save: ${save}, featureFlag: ${featureFlag}, visitorData: ${visitorData})`;
9046
9051
  let isNotInHoldout = true;
9047
9052
  // Checking if the evaluation is blocked due to the consent policy
9048
- const legalConsent = this.getLegalConsent(visitorCode);
9053
+ const legalConsent = this.clientConfiguration.isConsentRequired
9054
+ ? this.getLegalConsent(visitorCode)
9055
+ : LegalConsent.Given;
9049
9056
  if (legalConsent == LegalConsent.NotGiven) {
9050
9057
  const behaviour = this.clientConfiguration.consentBlockingBehaviour;
9051
9058
  if (behaviour == ConsentBlockingBehaviour.CompletelyBlocked) {