@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.
@@ -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);
@@ -3719,11 +3724,9 @@ class DataProcessor {
3719
3724
  delete infoData.mappingIdentifiers[visitorCode];
3720
3725
  }
3721
3726
  }
3722
- else {
3723
- if (!nextCleanupTime ||
3724
- (closestCleanupTime && closestCleanupTime < nextCleanupTime)) {
3725
- nextCleanupTime = closestCleanupTime;
3726
- }
3727
+ else if (!nextCleanupTime ||
3728
+ (closestCleanupTime && closestCleanupTime < nextCleanupTime)) {
3729
+ nextCleanupTime = closestCleanupTime;
3727
3730
  }
3728
3731
  }
3729
3732
  return nextCleanupTime;
@@ -3952,10 +3955,9 @@ class DataProcessor {
3952
3955
  if (isExpired) {
3953
3956
  delete existingData[nestedKey];
3954
3957
  }
3955
- else {
3956
- if (!closestCleanupTime || value.expirationTime < closestCleanupTime) {
3957
- closestCleanupTime = value.expirationTime;
3958
- }
3958
+ else if (!closestCleanupTime ||
3959
+ value.expirationTime < closestCleanupTime) {
3960
+ closestCleanupTime = value.expirationTime;
3959
3961
  }
3960
3962
  }
3961
3963
  if (!Object.keys(existingData).length) {
@@ -5568,6 +5570,13 @@ class StorageCleanupManager {
5568
5570
  }
5569
5571
  }
5570
5572
 
5573
+ var LegalConsent;
5574
+ (function (LegalConsent) {
5575
+ LegalConsent[LegalConsent["Unknown"] = 0] = "Unknown";
5576
+ LegalConsent[LegalConsent["Given"] = 1] = "Given";
5577
+ LegalConsent[LegalConsent["NotGiven"] = 2] = "NotGiven";
5578
+ })(LegalConsent || (LegalConsent = {}));
5579
+
5571
5580
  class TargetedSegment {
5572
5581
  constructor(id) {
5573
5582
  this.id = id;
@@ -7148,13 +7157,6 @@ class Hasher {
7148
7157
  }
7149
7158
  }
7150
7159
 
7151
- var LegalConsent;
7152
- (function (LegalConsent) {
7153
- LegalConsent[LegalConsent["Unknown"] = 0] = "Unknown";
7154
- LegalConsent[LegalConsent["Given"] = 1] = "Given";
7155
- LegalConsent[LegalConsent["NotGiven"] = 2] = "NotGiven";
7156
- })(LegalConsent || (LegalConsent = {}));
7157
-
7158
7160
  class VariationConfiguration {
7159
7161
  constructor(externalStorage, externalStorageForcedExperimentVariations, externalStorageForcedFeatureVariations, visitorCodeManager, clientConfiguration) {
7160
7162
  this.storage = externalStorage;
@@ -9043,7 +9045,9 @@ class KameleoonClient {
9043
9045
  KameleoonLogger.debug `CALL: KameleoonClient._isVisitorNotInHoldout(visitorCode: ${visitorCode}, track: ${track}, save: ${save}, featureFlag: ${featureFlag}, visitorData: ${visitorData})`;
9044
9046
  let isNotInHoldout = true;
9045
9047
  // Checking if the evaluation is blocked due to the consent policy
9046
- const legalConsent = this.getLegalConsent(visitorCode);
9048
+ const legalConsent = this.clientConfiguration.isConsentRequired
9049
+ ? this.getLegalConsent(visitorCode)
9050
+ : LegalConsent.Given;
9047
9051
  if (legalConsent == LegalConsent.NotGiven) {
9048
9052
  const behaviour = this.clientConfiguration.consentBlockingBehaviour;
9049
9053
  if (behaviour == ConsentBlockingBehaviour.CompletelyBlocked) {
@@ -9227,5 +9231,5 @@ class KameleoonUtils {
9227
9231
 
9228
9232
  var Err = buildExports.Err;
9229
9233
  var Ok = buildExports.Ok;
9230
- 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 };
9231
- //# sourceMappingURL=javascript-sdk-core-browser.es.js.map
9234
+ 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 };
9235
+ //# sourceMappingURL=javascript-sdk-core.browser.es.js.map