Skip to content

Commit dd43047

Browse files
committed
Update variationKey type to be string
1 parent 5b407d5 commit dd43047

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

packages/optimizely-sdk/lib/core/event_builder/event_helpers.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { EventTags, UserAttributes } from '../../shared_types';
1818

1919
interface ImpressionConfig {
2020
experimentKey: string;
21-
variationKey: string | null;
21+
variationKey: string;
2222
flagKey: string;
2323
ruleType: string;
2424
userId: string;

packages/optimizely-sdk/lib/core/project_config/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ export var getVariationKeyFromId = function(projectConfig, variationId) {
297297
*/
298298
export var getVariationIdFromExperimentAndVariationKey = function(projectConfig, experimentKey, variationKey) {
299299
var experiment = projectConfig.experimentKeyMap[experimentKey];
300-
if (variationKey && experiment.variationKeyMap.hasOwnProperty(variationKey)) {
300+
if (variationKey !== '' && experiment.variationKeyMap.hasOwnProperty(variationKey)) {
301301
return experiment.variationKeyMap[variationKey].id;
302302
}
303303
return null;

packages/optimizely-sdk/lib/optimizely/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ export default class Optimizely {
348348
const impressionEvent = getImpressionEvent(impressionEventOptions);
349349
const experiment = configObj.experimentKeyMap[experimentKey];
350350
let variation;
351-
if (experiment && experiment.variationKeyMap && variationKey) {
351+
if (experiment && experiment.variationKeyMap && variationKey !== '') {
352352
variation = experiment.variationKeyMap[variationKey];
353353
}
354354
this.notificationCenter.sendNotifications(NOTIFICATION_TYPES.ACTIVATE, {

0 commit comments

Comments
 (0)