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