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