File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
packages/optimizely-sdk/lib Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ interface ImpressionOptions {
2323 clientVersion : string ;
2424 configObj : ProjectConfig ;
2525 experimentId : string | null ;
26- ruleKey : string ;
26+ ruleKey : string | null ;
2727 flagKey : string ;
2828 enabled : boolean ;
2929 ruleType : string ;
Original file line number Diff line number Diff line change @@ -339,13 +339,13 @@ export default class Optimizely {
339339 }
340340
341341 const ruleType = decisionObj . decisionSource ;
342- const experimentKey = decision . getExperimentKey ( decisionObj ) ;
343- const variationKey = decision . getVariationKey ( decisionObj ) ;
342+ const experimentKey = decisionObj . experiment ?. key ?? null ;
343+ const variationKey = decisionObj . variation ?. key ?? null ;
344344
345345 let experimentId : string | null = null ;
346346 let variationId : string | null = null ;
347347
348- if ( experimentKey !== '' && variationKey !== '' ) {
348+ if ( experimentKey && variationKey ) {
349349 variationId = projectConfig . getVariationIdFromExperimentAndVariationKey ( configObj , experimentKey , variationKey ) ;
350350 experimentId = projectConfig . getExperimentId ( configObj , experimentKey ) ;
351351 }
@@ -365,9 +365,9 @@ export default class Optimizely {
365365 logger : this . logger ,
366366 } ;
367367 const impressionEvent = getImpressionEvent ( impressionEventOptions ) ;
368- const experiment = configObj . experimentKeyMap [ experimentKey ] ;
368+ const experiment = experimentKey ? configObj . experimentKeyMap [ experimentKey ] : null ;
369369 let variation ;
370- if ( experiment && experiment . variationKeyMap && variationKey !== '' ) {
370+ if ( experiment && experiment . variationKeyMap && variationKey ) {
371371 variation = experiment . variationKeyMap [ variationKey ] ;
372372 }
373373 this . notificationCenter . sendNotifications ( NOTIFICATION_TYPES . ACTIVATE , {
You can’t perform that action at this time.
0 commit comments