@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.
@@ -2934,7 +2934,10 @@ class VisitsData {
2934
2934
  constructor(visits) {
2935
2935
  this.status = TrackingStatus.Sent;
2936
2936
  this.visits = visits;
2937
- this.visitNumber = visits.length ? visits.length - 1 : 0;
2937
+ this._visitNumber = visits.length ? visits.length - 1 : 0;
2938
+ }
2939
+ get visitNumber() {
2940
+ return this._visitNumber;
2938
2941
  }
2939
2942
  get url() {
2940
2943
  return '';
@@ -2942,7 +2945,7 @@ class VisitsData {
2942
2945
  get data() {
2943
2946
  return {
2944
2947
  visits: this.visits,
2945
- visitNumber: this.visitNumber,
2948
+ visitNumber: this._visitNumber,
2946
2949
  type: KameleoonData.VisitsData,
2947
2950
  status: this.status,
2948
2951
  };
@@ -2959,11 +2962,11 @@ class VisitsData {
2959
2962
  list: this.visits,
2960
2963
  visit,
2961
2964
  });
2962
- this.visitNumber = this.visits.length ? this.visits.length - 1 : 0;
2965
+ this._visitNumber = this.visits.length ? this.visits.length - 1 : 0;
2963
2966
  }
2964
2967
  updateVisitNumber(visitNumber) {
2965
- if (visitNumber > this.visitNumber) {
2966
- this.visitNumber = visitNumber;
2968
+ if (visitNumber > this._visitNumber) {
2969
+ this._visitNumber = visitNumber;
2967
2970
  }
2968
2971
  }
2969
2972
  }
@@ -3170,10 +3173,12 @@ class VisitProcessor {
3170
3173
  timeLastActivity: (_a = visit.timeLastEvent) !== null && _a !== void 0 ? _a : visit.timeStarted,
3171
3174
  };
3172
3175
  }
3173
- processVisitNumber(visit, isCurrentVisit) {
3174
- if (visit.staticDataEvent) {
3175
- const visitNumber = visit.staticDataEvent.data.visitNumber + (isCurrentVisit ? 0 : 1);
3176
- this.visitsData.updateVisitNumber(visitNumber);
3176
+ processVisitNumber(visit, visitOffset) {
3177
+ var _a, _b, _c;
3178
+ if (this.visitsData.visitNumber <= visitOffset &&
3179
+ ((_a = visit.staticDataEvent) === null || _a === void 0 ? void 0 : _a.data.visitNumber)) {
3180
+ const visitNumber = (_c = (_b = visit.staticDataEvent) === null || _b === void 0 ? void 0 : _b.data.visitNumber) !== null && _c !== void 0 ? _c : 0;
3181
+ this.visitsData.updateVisitNumber(visitNumber + visitOffset);
3177
3182
  }
3178
3183
  }
3179
3184
  processCbs(cbsData) {
@@ -3347,12 +3352,12 @@ class Parser {
3347
3352
  }
3348
3353
  if (currentVisit) {
3349
3354
  visitProcessor.processVisit(currentVisit);
3350
- visitProcessor.processVisitNumber(currentVisit, true);
3355
+ visitProcessor.processVisitNumber(currentVisit, 0);
3351
3356
  }
3352
- previousVisits === null || previousVisits === void 0 ? void 0 : previousVisits.forEach((visit) => {
3357
+ previousVisits === null || previousVisits === void 0 ? void 0 : previousVisits.forEach((visit, index) => {
3353
3358
  visitProcessor.processVisit(visit);
3354
3359
  visitProcessor.processVisitsData(visit);
3355
- visitProcessor.processVisitNumber(visit, false);
3360
+ visitProcessor.processVisitNumber(visit, index + 1);
3356
3361
  });
3357
3362
  visitProcessor.processKcs(kcs);
3358
3363
  visitProcessor.processCbs(cbs);
@@ -9043,7 +9048,9 @@ class KameleoonClient {
9043
9048
  KameleoonLogger.debug `CALL: KameleoonClient._isVisitorNotInHoldout(visitorCode: ${visitorCode}, track: ${track}, save: ${save}, featureFlag: ${featureFlag}, visitorData: ${visitorData})`;
9044
9049
  let isNotInHoldout = true;
9045
9050
  // Checking if the evaluation is blocked due to the consent policy
9046
- const legalConsent = this.getLegalConsent(visitorCode);
9051
+ const legalConsent = this.clientConfiguration.isConsentRequired
9052
+ ? this.getLegalConsent(visitorCode)
9053
+ : LegalConsent.Given;
9047
9054
  if (legalConsent == LegalConsent.NotGiven) {
9048
9055
  const behaviour = this.clientConfiguration.consentBlockingBehaviour;
9049
9056
  if (behaviour == ConsentBlockingBehaviour.CompletelyBlocked) {