@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.
package/CHANGELOG.md CHANGED
@@ -1,7 +1,28 @@
1
1
  # Change Log
2
2
 
3
+ ## 5.14.3 (2025-08-12)
4
+
5
+ > [!WARNING]
6
+ > If you're upgrading from a version earlier than 5.14.0 and run into any unexpected build or SDK-related issues, please reach out to the Kameleoon Support Team. We're here to ensure your transition is smooth and will promptly address any concerns.
7
+
8
+ ### Patch Changes
9
+
10
+ - Fixed an issue where [`Cookie`](https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/js-sdk#cookie) would throw an exception when parsing from a string if the cookie value was empty.
11
+
12
+ ## 5.14.2 (2025-08-01)
13
+
14
+ > [!WARNING]
15
+ > If you're upgrading from a version earlier than 5.14.0 and run into any unexpected build or SDK-related issues, please reach out to the Kameleoon Support Team. We're here to ensure your transition is smooth and will promptly address any concerns.
16
+
17
+ ### Patch Changes
18
+
19
+ - Fixed an issue where [`setLegalConsent()`][setLegalConsent] automatically triggered [`flush()`][flush], which could cause extra latency in serverless or edge environments (e.g., **Lambda@Edge**). It now requires an explicit `flush()`, giving developers full control over data submission.
20
+
3
21
  ## 5.14.1 (2025-07-30)
4
22
 
23
+ > [!WARNING]
24
+ > If you're upgrading from a version earlier than 5.14.0 and run into any unexpected build or SDK-related issues, please reach out to the Kameleoon Support Team. We're here to ensure your transition is smooth and will promptly address any concerns.
25
+
5
26
  ### Patch Changes
6
27
 
7
28
  - Improved error logging when parsing [`defaultDataFile`](defaultDataFile) - now provides more informative messages for easier debugging.
@@ -12,15 +33,15 @@
12
33
 
13
34
  ## 5.14.0 (2025-07-24)
14
35
 
36
+ > [!WARNING]
37
+ > If you're upgrading from a version earlier than 5.14.0 and run into any unexpected build or SDK-related issues, please reach out to the Kameleoon Support Team. We're here to ensure your transition is smooth and will promptly address any concerns.
38
+
15
39
  ### Features
16
40
 
17
41
  - Migrated the build system for the NPM package from Babel (which previously generated multiple minified JS files) to Rollup, producing a single, optimized bundle.
18
42
  - Significantly reduced package size by consolidating files and improving tree-shaking.
19
43
  - Added native ESM support via modern Rollup outputs for better compatibility with modern bundlers.
20
44
 
21
- > [!WARNING]
22
- > If you're upgrading from a version earlier than 5.14.0 and run into any unexpected build or SDK-related issues, please reach out to the Kameleoon Support Team. We're here to ensure your transition is smooth and will promptly address any concerns.
23
-
24
45
  ## 5.13.0 (2025-07-23)
25
46
 
26
47
  ### Features
@@ -3417,21 +3417,23 @@ let Cookie$1 = class Cookie {
3417
3417
  /**
3418
3418
  * @method fromString - a static method for creating an instance of `Cookie` from a string
3419
3419
  * @param {string} cookieString - a string containing a list of cookies
3420
- * @throws {KameleoonError} throws an error if the string is not valid cookie
3421
3420
  * @returns {Cookie} an instance of `Cookie`
3422
3421
  * */
3423
3422
  static fromString(cookieString) {
3424
3423
  if (!cookieString) {
3425
- throw new KameleoonError(exports.KameleoonException.CookieParse, "Cookie string can't be empty");
3424
+ return new Cookie([]);
3426
3425
  }
3427
3426
  const pairs = cookieString.split(';');
3428
- const cookie = pairs.map((item) => {
3427
+ const cookie = pairs
3428
+ .map((item) => {
3429
3429
  const [key, value] = item.trim().split('=');
3430
- if (!key || !value) {
3431
- throw new KameleoonError(exports.KameleoonException.CookieParse, 'Cookie string is not valid');
3430
+ if (!key) {
3431
+ KameleoonLogger.warning `Cookie string has an empty key: ${cookieString}`;
3432
+ return null;
3432
3433
  }
3433
3434
  return { key, value };
3434
- });
3435
+ })
3436
+ .filter((item) => item !== null);
3435
3437
  return new Cookie(cookie);
3436
3438
  }
3437
3439
  get url() {
@@ -4430,6 +4432,9 @@ class SdkLanguage {
4430
4432
  if (!this.versionMatchType) {
4431
4433
  return buildExports.Ok(false);
4432
4434
  }
4435
+ if (sdkType !== this.sdkLanguage) {
4436
+ return buildExports.Ok(false);
4437
+ }
4433
4438
  const result = Utilities.compareSemVer({
4434
4439
  version,
4435
4440
  compareVersion: this.conditionValue,
@@ -4438,7 +4443,7 @@ class SdkLanguage {
4438
4443
  if (!result.ok) {
4439
4444
  return buildExports.Err(result.error);
4440
4445
  }
4441
- return buildExports.Ok(sdkType === this.sdkLanguage && result.data);
4446
+ return buildExports.Ok(result.data);
4442
4447
  }
4443
4448
  }
4444
4449
 
@@ -8598,7 +8603,6 @@ class KameleoonClient {
8598
8603
  });
8599
8604
  }
8600
8605
  }
8601
- this.flush(visitorCode);
8602
8606
  KameleoonLogger.info `RETURN: KameleoonClient.setUserConsent(visitorCode: ${visitorCode}, consent: ${consent}, setData: ${setData})`;
8603
8607
  }
8604
8608
  updateConsentData(visitorCode, consent) {