@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.
@@ -2905,7 +2905,10 @@ class VisitsData {
2905
2905
  constructor(visits) {
2906
2906
  this.status = TrackingStatus.Sent;
2907
2907
  this.visits = visits;
2908
- this.visitNumber = visits.length ? visits.length - 1 : 0;
2908
+ this._visitNumber = visits.length ? visits.length - 1 : 0;
2909
+ }
2910
+ get visitNumber() {
2911
+ return this._visitNumber;
2909
2912
  }
2910
2913
  get url() {
2911
2914
  return '';
@@ -2913,7 +2916,7 @@ class VisitsData {
2913
2916
  get data() {
2914
2917
  return {
2915
2918
  visits: this.visits,
2916
- visitNumber: this.visitNumber,
2919
+ visitNumber: this._visitNumber,
2917
2920
  type: KameleoonData.VisitsData,
2918
2921
  status: this.status,
2919
2922
  };
@@ -2930,11 +2933,11 @@ class VisitsData {
2930
2933
  list: this.visits,
2931
2934
  visit,
2932
2935
  });
2933
- this.visitNumber = this.visits.length ? this.visits.length - 1 : 0;
2936
+ this._visitNumber = this.visits.length ? this.visits.length - 1 : 0;
2934
2937
  }
2935
2938
  updateVisitNumber(visitNumber) {
2936
- if (visitNumber > this.visitNumber) {
2937
- this.visitNumber = visitNumber;
2939
+ if (visitNumber > this._visitNumber) {
2940
+ this._visitNumber = visitNumber;
2938
2941
  }
2939
2942
  }
2940
2943
  }
@@ -3141,10 +3144,12 @@ class VisitProcessor {
3141
3144
  timeLastActivity: (_a = visit.timeLastEvent) !== null && _a !== void 0 ? _a : visit.timeStarted,
3142
3145
  };
3143
3146
  }
3144
- processVisitNumber(visit, isCurrentVisit) {
3145
- if (visit.staticDataEvent) {
3146
- const visitNumber = visit.staticDataEvent.data.visitNumber + (isCurrentVisit ? 0 : 1);
3147
- this.visitsData.updateVisitNumber(visitNumber);
3147
+ processVisitNumber(visit, visitOffset) {
3148
+ var _a, _b, _c;
3149
+ if (this.visitsData.visitNumber <= visitOffset &&
3150
+ ((_a = visit.staticDataEvent) === null || _a === void 0 ? void 0 : _a.data.visitNumber)) {
3151
+ const visitNumber = (_c = (_b = visit.staticDataEvent) === null || _b === void 0 ? void 0 : _b.data.visitNumber) !== null && _c !== void 0 ? _c : 0;
3152
+ this.visitsData.updateVisitNumber(visitNumber + visitOffset);
3148
3153
  }
3149
3154
  }
3150
3155
  processCbs(cbsData) {
@@ -3318,12 +3323,12 @@ class Parser {
3318
3323
  }
3319
3324
  if (currentVisit) {
3320
3325
  visitProcessor.processVisit(currentVisit);
3321
- visitProcessor.processVisitNumber(currentVisit, true);
3326
+ visitProcessor.processVisitNumber(currentVisit, 0);
3322
3327
  }
3323
- previousVisits === null || previousVisits === void 0 ? void 0 : previousVisits.forEach((visit) => {
3328
+ previousVisits === null || previousVisits === void 0 ? void 0 : previousVisits.forEach((visit, index) => {
3324
3329
  visitProcessor.processVisit(visit);
3325
3330
  visitProcessor.processVisitsData(visit);
3326
- visitProcessor.processVisitNumber(visit, false);
3331
+ visitProcessor.processVisitNumber(visit, index + 1);
3327
3332
  });
3328
3333
  visitProcessor.processKcs(kcs);
3329
3334
  visitProcessor.processCbs(cbs);
@@ -9005,7 +9010,9 @@ class KameleoonClient {
9005
9010
  KameleoonLogger.debug `CALL: KameleoonClient._isVisitorNotInHoldout(visitorCode: ${visitorCode}, track: ${track}, save: ${save}, featureFlag: ${featureFlag}, visitorData: ${visitorData})`;
9006
9011
  let isNotInHoldout = true;
9007
9012
  // Checking if the evaluation is blocked due to the consent policy
9008
- const legalConsent = this.getLegalConsent(visitorCode);
9013
+ const legalConsent = this.clientConfiguration.isConsentRequired
9014
+ ? this.getLegalConsent(visitorCode)
9015
+ : LegalConsent.Given;
9009
9016
  if (legalConsent == LegalConsent.NotGiven) {
9010
9017
  const behaviour = this.clientConfiguration.consentBlockingBehaviour;
9011
9018
  if (behaviour == ConsentBlockingBehaviour.CompletelyBlocked) {