File tree 2 files changed +6
-6
lines changed
packages/optimizely-sdk/lib
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ interface ImpressionOptions {
23
23
clientVersion : string ;
24
24
configObj : ProjectConfig ;
25
25
experimentId : string | null ;
26
- ruleKey : string ;
26
+ ruleKey : string | null ;
27
27
flagKey : string ;
28
28
enabled : boolean ;
29
29
ruleType : string ;
Original file line number Diff line number Diff line change @@ -339,13 +339,13 @@ export default class Optimizely {
339
339
}
340
340
341
341
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 ;
344
344
345
345
let experimentId : string | null = null ;
346
346
let variationId : string | null = null ;
347
347
348
- if ( experimentKey !== '' && variationKey !== '' ) {
348
+ if ( experimentKey && variationKey ) {
349
349
variationId = projectConfig . getVariationIdFromExperimentAndVariationKey ( configObj , experimentKey , variationKey ) ;
350
350
experimentId = projectConfig . getExperimentId ( configObj , experimentKey ) ;
351
351
}
@@ -365,9 +365,9 @@ export default class Optimizely {
365
365
logger : this . logger ,
366
366
} ;
367
367
const impressionEvent = getImpressionEvent ( impressionEventOptions ) ;
368
- const experiment = configObj . experimentKeyMap [ experimentKey ] ;
368
+ const experiment = experimentKey ? configObj . experimentKeyMap [ experimentKey ] : null ;
369
369
let variation ;
370
- if ( experiment && experiment . variationKeyMap && variationKey !== '' ) {
370
+ if ( experiment && experiment . variationKeyMap && variationKey ) {
371
371
variation = experiment . variationKeyMap [ variationKey ] ;
372
372
}
373
373
this . notificationCenter . sendNotifications ( NOTIFICATION_TYPES . ACTIVATE , {
You can’t perform that action at this time.
0 commit comments