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