@kameleoon/javascript-sdk-core 5.17.0 → 5.17.2

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);
@@ -3690,11 +3695,9 @@ class DataProcessor {
3690
3695
  delete infoData.mappingIdentifiers[visitorCode];
3691
3696
  }
3692
3697
  }
3693
- else {
3694
- if (!nextCleanupTime ||
3695
- (closestCleanupTime && closestCleanupTime < nextCleanupTime)) {
3696
- nextCleanupTime = closestCleanupTime;
3697
- }
3698
+ else if (!nextCleanupTime ||
3699
+ (closestCleanupTime && closestCleanupTime < nextCleanupTime)) {
3700
+ nextCleanupTime = closestCleanupTime;
3698
3701
  }
3699
3702
  }
3700
3703
  return nextCleanupTime;
@@ -3923,10 +3926,9 @@ class DataProcessor {
3923
3926
  if (isExpired) {
3924
3927
  delete existingData[nestedKey];
3925
3928
  }
3926
- else {
3927
- if (!closestCleanupTime || value.expirationTime < closestCleanupTime) {
3928
- closestCleanupTime = value.expirationTime;
3929
- }
3929
+ else if (!closestCleanupTime ||
3930
+ value.expirationTime < closestCleanupTime) {
3931
+ closestCleanupTime = value.expirationTime;
3930
3932
  }
3931
3933
  }
3932
3934
  if (!Object.keys(existingData).length) {
@@ -5539,6 +5541,13 @@ class StorageCleanupManager {
5539
5541
  }
5540
5542
  }
5541
5543
 
5544
+ var LegalConsent;
5545
+ (function (LegalConsent) {
5546
+ LegalConsent[LegalConsent["Unknown"] = 0] = "Unknown";
5547
+ LegalConsent[LegalConsent["Given"] = 1] = "Given";
5548
+ LegalConsent[LegalConsent["NotGiven"] = 2] = "NotGiven";
5549
+ })(LegalConsent || (LegalConsent = {}));
5550
+
5542
5551
  class TargetedSegment {
5543
5552
  constructor(id) {
5544
5553
  this.id = id;
@@ -7110,13 +7119,6 @@ class Hasher {
7110
7119
  }
7111
7120
  }
7112
7121
 
7113
- var LegalConsent;
7114
- (function (LegalConsent) {
7115
- LegalConsent[LegalConsent["Unknown"] = 0] = "Unknown";
7116
- LegalConsent[LegalConsent["Given"] = 1] = "Given";
7117
- LegalConsent[LegalConsent["NotGiven"] = 2] = "NotGiven";
7118
- })(LegalConsent || (LegalConsent = {}));
7119
-
7120
7122
  class VariationConfiguration {
7121
7123
  constructor(externalStorage, externalStorageForcedExperimentVariations, externalStorageForcedFeatureVariations, visitorCodeManager, clientConfiguration) {
7122
7124
  this.storage = externalStorage;
@@ -9005,7 +9007,9 @@ class KameleoonClient {
9005
9007
  KameleoonLogger.debug `CALL: KameleoonClient._isVisitorNotInHoldout(visitorCode: ${visitorCode}, track: ${track}, save: ${save}, featureFlag: ${featureFlag}, visitorData: ${visitorData})`;
9006
9008
  let isNotInHoldout = true;
9007
9009
  // Checking if the evaluation is blocked due to the consent policy
9008
- const legalConsent = this.getLegalConsent(visitorCode);
9010
+ const legalConsent = this.clientConfiguration.isConsentRequired
9011
+ ? this.getLegalConsent(visitorCode)
9012
+ : LegalConsent.Given;
9009
9013
  if (legalConsent == LegalConsent.NotGiven) {
9010
9014
  const behaviour = this.clientConfiguration.consentBlockingBehaviour;
9011
9015
  if (behaviour == ConsentBlockingBehaviour.CompletelyBlocked) {
@@ -9189,5 +9193,5 @@ class KameleoonUtils {
9189
9193
 
9190
9194
  var Err = buildExports.Err;
9191
9195
  var Ok = buildExports.Ok;
9192
- export { ApplicationVersion$1 as ApplicationVersion, Browser$1 as Browser, BrowserType, Conversion$1 as Conversion, Cookie$1 as Cookie, CustomData$1 as CustomData, CustomDataScope, DataManager, DataProcessor, DataStorage, Device$1 as Device, DeviceType, Environment, Err, EventType, GeolocationData, Header, HttpMethod, KameleoonClient as KameleoonCore, KameleoonData, KameleoonError, KameleoonException, KameleoonLogger, KameleoonStorageKey, KameleoonUtils, ListUtilities, LogLevel, Milliseconds, NUMBER_OF_RETRIES, Ok, OperatingSystem$1 as OperatingSystem, OperatingSystemType, PageView, Parser, RequestType, SdkLanguageType, StaticData, TrackingStatus, Tree, UniqueIdentifier, UserAgent, Utilities, VISITOR_CODE_LENGTH, VISIT_DURATION, Validator, VariableType, VisitorCodeManager };
9196
+ export { ApplicationVersion$1 as ApplicationVersion, Browser$1 as Browser, BrowserType, Conversion$1 as Conversion, Cookie$1 as Cookie, CustomData$1 as CustomData, CustomDataScope, DataManager, DataProcessor, DataStorage, Device$1 as Device, DeviceType, Environment, Err, EventType, GeolocationData, Header, HttpMethod, KameleoonClient as KameleoonCore, KameleoonData, KameleoonError, KameleoonException, KameleoonLogger, KameleoonStorageKey, KameleoonUtils, LegalConsent, ListUtilities, LogLevel, Milliseconds, NUMBER_OF_RETRIES, Ok, OperatingSystem$1 as OperatingSystem, OperatingSystemType, PageView, Parser, RequestType, SdkLanguageType, StaticData, TrackingStatus, Tree, UniqueIdentifier, UserAgent, Utilities, VISITOR_CODE_LENGTH, VISIT_DURATION, Validator, VariableType, VisitorCodeManager };
9193
9197
  //# sourceMappingURL=javascript-sdk-core.es.js.map