@kameleoon/javascript-sdk-core 5.14.1 → 5.14.3

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.
@@ -3415,21 +3415,23 @@ let Cookie$1 = class Cookie {
3415
3415
  /**
3416
3416
  * @method fromString - a static method for creating an instance of `Cookie` from a string
3417
3417
  * @param {string} cookieString - a string containing a list of cookies
3418
- * @throws {KameleoonError} throws an error if the string is not valid cookie
3419
3418
  * @returns {Cookie} an instance of `Cookie`
3420
3419
  * */
3421
3420
  static fromString(cookieString) {
3422
3421
  if (!cookieString) {
3423
- throw new KameleoonError(KameleoonException.CookieParse, "Cookie string can't be empty");
3422
+ return new Cookie([]);
3424
3423
  }
3425
3424
  const pairs = cookieString.split(';');
3426
- const cookie = pairs.map((item) => {
3425
+ const cookie = pairs
3426
+ .map((item) => {
3427
3427
  const [key, value] = item.trim().split('=');
3428
- if (!key || !value) {
3429
- throw new KameleoonError(KameleoonException.CookieParse, 'Cookie string is not valid');
3428
+ if (!key) {
3429
+ KameleoonLogger.warning `Cookie string has an empty key: ${cookieString}`;
3430
+ return null;
3430
3431
  }
3431
3432
  return { key, value };
3432
- });
3433
+ })
3434
+ .filter((item) => item !== null);
3433
3435
  return new Cookie(cookie);
3434
3436
  }
3435
3437
  get url() {
@@ -4428,6 +4430,9 @@ class SdkLanguage {
4428
4430
  if (!this.versionMatchType) {
4429
4431
  return buildExports.Ok(false);
4430
4432
  }
4433
+ if (sdkType !== this.sdkLanguage) {
4434
+ return buildExports.Ok(false);
4435
+ }
4431
4436
  const result = Utilities.compareSemVer({
4432
4437
  version,
4433
4438
  compareVersion: this.conditionValue,
@@ -4436,7 +4441,7 @@ class SdkLanguage {
4436
4441
  if (!result.ok) {
4437
4442
  return buildExports.Err(result.error);
4438
4443
  }
4439
- return buildExports.Ok(sdkType === this.sdkLanguage && result.data);
4444
+ return buildExports.Ok(result.data);
4440
4445
  }
4441
4446
  }
4442
4447
 
@@ -8596,7 +8601,6 @@ class KameleoonClient {
8596
8601
  });
8597
8602
  }
8598
8603
  }
8599
- this.flush(visitorCode);
8600
8604
  KameleoonLogger.info `RETURN: KameleoonClient.setUserConsent(visitorCode: ${visitorCode}, consent: ${consent}, setData: ${setData})`;
8601
8605
  }
8602
8606
  updateConsentData(visitorCode, consent) {