@kameleoon/javascript-sdk-core 5.15.0 → 5.16.0
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 +13 -0
- package/dist/browser.d.ts +1 -0
- package/dist/clientConfiguration/types.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/javascript-sdk-core-browser.cjs.js +62 -2
- package/dist/javascript-sdk-core-browser.cjs.js.map +1 -1
- package/dist/javascript-sdk-core-browser.es.js +62 -2
- package/dist/javascript-sdk-core-browser.es.js.map +1 -1
- package/dist/javascript-sdk-core.cjs.js +62 -2
- package/dist/javascript-sdk-core.cjs.js.map +1 -1
- package/dist/javascript-sdk-core.es.js +62 -2
- package/dist/javascript-sdk-core.es.js.map +1 -1
- package/dist/kameleoonClient.d.ts +5 -4
- package/dist/kameleoonClientInterface.d.ts +13 -7
- package/dist/types.d.ts +36 -4
- package/package.json +1 -1
|
@@ -5120,7 +5120,7 @@ class ConditionFactory {
|
|
|
5120
5120
|
case TargetingType.HEAT_SLICE:
|
|
5121
5121
|
return buildExports.Ok(new ConversionLikelihood(data));
|
|
5122
5122
|
default:
|
|
5123
|
-
KameleoonLogger.
|
|
5123
|
+
KameleoonLogger.info `Unsupported targeted condition type found: ${targetingType}`;
|
|
5124
5124
|
return buildExports.Err(new KameleoonError(exports.KameleoonException.TargetingCondition, targetingType));
|
|
5125
5125
|
}
|
|
5126
5126
|
}
|
|
@@ -7769,7 +7769,7 @@ class BodyProvider {
|
|
|
7769
7769
|
const identifier = isMappingIdentifier
|
|
7770
7770
|
? UrlParameter.MappingValue
|
|
7771
7771
|
: UrlParameter.VisitorCode;
|
|
7772
|
-
return identifier + visitorCode;
|
|
7772
|
+
return identifier + encodeURIComponent(visitorCode);
|
|
7773
7773
|
}
|
|
7774
7774
|
}
|
|
7775
7775
|
|
|
@@ -8353,6 +8353,7 @@ class KameleoonClient {
|
|
|
8353
8353
|
}
|
|
8354
8354
|
const resultVariables = variables.map((variable) => Parser.parseFeatureVariable(variable).throw());
|
|
8355
8355
|
resultFeatureList.set(variation.featureKey, {
|
|
8356
|
+
name: '',
|
|
8356
8357
|
key: variationKey,
|
|
8357
8358
|
id: variationId,
|
|
8358
8359
|
experimentId,
|
|
@@ -8573,6 +8574,62 @@ class KameleoonClient {
|
|
|
8573
8574
|
this.flush(visitorCode);
|
|
8574
8575
|
KameleoonLogger.info `RETURN: KameleoonClient.evaluateAudiences(visitorCode: ${visitorCode})`;
|
|
8575
8576
|
}
|
|
8577
|
+
getDataFile() {
|
|
8578
|
+
const dataFile = {
|
|
8579
|
+
featureFlags: new Map(),
|
|
8580
|
+
};
|
|
8581
|
+
if (this.stubMode) {
|
|
8582
|
+
return dataFile;
|
|
8583
|
+
}
|
|
8584
|
+
KameleoonLogger.debug `CALL: KameleoonClient.getDataFile()`;
|
|
8585
|
+
this.clientConfiguration.featureFlags.forEach((featureFlag, key) => {
|
|
8586
|
+
const variationsMap = new Map();
|
|
8587
|
+
featureFlag.variations.forEach((sourceVariation) => {
|
|
8588
|
+
var _a;
|
|
8589
|
+
const variablesMap = new Map();
|
|
8590
|
+
sourceVariation.variables.forEach((variable) => {
|
|
8591
|
+
try {
|
|
8592
|
+
const parsedVariable = Parser.parseFeatureVariable(variable).throw();
|
|
8593
|
+
variablesMap.set(variable.key, parsedVariable);
|
|
8594
|
+
}
|
|
8595
|
+
catch (err) {
|
|
8596
|
+
KameleoonLogger.error `Error parsing variable ${variable.key} of feature flag ${featureFlag.featureKey}: ${err}`;
|
|
8597
|
+
}
|
|
8598
|
+
});
|
|
8599
|
+
variationsMap.set(sourceVariation.key, {
|
|
8600
|
+
name: (_a = sourceVariation.name) !== null && _a !== void 0 ? _a : '',
|
|
8601
|
+
key: sourceVariation.key,
|
|
8602
|
+
id: null,
|
|
8603
|
+
experimentId: null,
|
|
8604
|
+
variables: variablesMap,
|
|
8605
|
+
});
|
|
8606
|
+
});
|
|
8607
|
+
const rules = featureFlag.rules.map((rule) => {
|
|
8608
|
+
const ruleVariations = new Map();
|
|
8609
|
+
rule.variationByExposition.forEach((varByExp) => {
|
|
8610
|
+
const baseVariation = variationsMap.get(varByExp.variationKey);
|
|
8611
|
+
if (!baseVariation)
|
|
8612
|
+
return;
|
|
8613
|
+
ruleVariations.set(baseVariation.key, {
|
|
8614
|
+
name: baseVariation.name,
|
|
8615
|
+
key: baseVariation.key,
|
|
8616
|
+
id: varByExp.variationId,
|
|
8617
|
+
experimentId: rule.experimentId,
|
|
8618
|
+
variables: baseVariation.variables,
|
|
8619
|
+
});
|
|
8620
|
+
});
|
|
8621
|
+
return { variations: ruleVariations };
|
|
8622
|
+
});
|
|
8623
|
+
dataFile.featureFlags.set(key, {
|
|
8624
|
+
variations: variationsMap,
|
|
8625
|
+
environmentEnabled: featureFlag.environmentEnabled,
|
|
8626
|
+
rules,
|
|
8627
|
+
defaultVariationKey: featureFlag.defaultVariationKey,
|
|
8628
|
+
});
|
|
8629
|
+
});
|
|
8630
|
+
KameleoonLogger.debug `RETURN: KameleoonClient.getDataFile() -> (dataFile: ${dataFile})`;
|
|
8631
|
+
return dataFile;
|
|
8632
|
+
}
|
|
8576
8633
|
setUserConsent({ visitorCode, consent, setData, }) {
|
|
8577
8634
|
if (this.stubMode) {
|
|
8578
8635
|
return;
|
|
@@ -8759,6 +8816,7 @@ class KameleoonClient {
|
|
|
8759
8816
|
return selected;
|
|
8760
8817
|
}
|
|
8761
8818
|
_getFeatureVariation({ visitorCode, featureKey, track, }) {
|
|
8819
|
+
var _a, _b;
|
|
8762
8820
|
KameleoonLogger.debug `CALL: KameleoonClient._getFeatureVariation(visitorCode: ${visitorCode}, featureKey: ${featureKey}, track: ${track})`;
|
|
8763
8821
|
if (!this.initialized) {
|
|
8764
8822
|
return buildExports.Err(new KameleoonError(exports.KameleoonException.Initialization));
|
|
@@ -8809,7 +8867,9 @@ class KameleoonClient {
|
|
|
8809
8867
|
if (track && !isSimulated) {
|
|
8810
8868
|
this.tracker.scheduleVisitor(visitorCode, this._isConsentProvided(visitorCode));
|
|
8811
8869
|
}
|
|
8870
|
+
const variationName = (_b = (_a = featureFlag.variations.find((item) => item.key === variationKey)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '';
|
|
8812
8871
|
const resultData = {
|
|
8872
|
+
name: variationName,
|
|
8813
8873
|
key: variationKey,
|
|
8814
8874
|
id: variationId,
|
|
8815
8875
|
experimentId,
|