@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.
@@ -3388,21 +3388,23 @@ let Cookie$1 = class Cookie {
3388
3388
  /**
3389
3389
  * @method fromString - a static method for creating an instance of `Cookie` from a string
3390
3390
  * @param {string} cookieString - a string containing a list of cookies
3391
- * @throws {KameleoonError} throws an error if the string is not valid cookie
3392
3391
  * @returns {Cookie} an instance of `Cookie`
3393
3392
  * */
3394
3393
  static fromString(cookieString) {
3395
3394
  if (!cookieString) {
3396
- throw new KameleoonError(exports.KameleoonException.CookieParse, "Cookie string can't be empty");
3395
+ return new Cookie([]);
3397
3396
  }
3398
3397
  const pairs = cookieString.split(';');
3399
- const cookie = pairs.map((item) => {
3398
+ const cookie = pairs
3399
+ .map((item) => {
3400
3400
  const [key, value] = item.trim().split('=');
3401
- if (!key || !value) {
3402
- throw new KameleoonError(exports.KameleoonException.CookieParse, 'Cookie string is not valid');
3401
+ if (!key) {
3402
+ KameleoonLogger.warning `Cookie string has an empty key: ${cookieString}`;
3403
+ return null;
3403
3404
  }
3404
3405
  return { key, value };
3405
- });
3406
+ })
3407
+ .filter((item) => item !== null);
3406
3408
  return new Cookie(cookie);
3407
3409
  }
3408
3410
  get url() {
@@ -4401,6 +4403,9 @@ class SdkLanguage {
4401
4403
  if (!this.versionMatchType) {
4402
4404
  return buildExports.Ok(false);
4403
4405
  }
4406
+ if (sdkType !== this.sdkLanguage) {
4407
+ return buildExports.Ok(false);
4408
+ }
4404
4409
  const result = Utilities.compareSemVer({
4405
4410
  version,
4406
4411
  compareVersion: this.conditionValue,
@@ -4409,7 +4414,7 @@ class SdkLanguage {
4409
4414
  if (!result.ok) {
4410
4415
  return buildExports.Err(result.error);
4411
4416
  }
4412
- return buildExports.Ok(sdkType === this.sdkLanguage && result.data);
4417
+ return buildExports.Ok(result.data);
4413
4418
  }
4414
4419
  }
4415
4420
 
@@ -8560,7 +8565,6 @@ class KameleoonClient {
8560
8565
  });
8561
8566
  }
8562
8567
  }
8563
- this.flush(visitorCode);
8564
8568
  KameleoonLogger.info `RETURN: KameleoonClient.setUserConsent(visitorCode: ${visitorCode}, consent: ${consent}, setData: ${setData})`;
8565
8569
  }
8566
8570
  updateConsentData(visitorCode, consent) {