@@ -37,6 +37,7 @@ import {
37
37
OptimizelyDecision ,
38
38
Client ,
39
39
UserProfileServiceAsync ,
40
+ isHoldout ,
40
41
} from '../shared_types' ;
41
42
import { newErrorDecision } from '../optimizely_decision' ;
42
43
import OptimizelyUserContext from '../optimizely_user_context' ;
@@ -62,7 +63,7 @@ import {
62
63
import { Fn , Maybe , OpType } from '../utils/type' ;
63
64
import { resolvablePromise } from '../utils/promise/resolvablePromise' ;
64
65
65
- import { NOTIFICATION_TYPES , DecisionNotificationType , DECISION_NOTIFICATION_TYPES } from '../notification_center/type' ;
66
+ import { NOTIFICATION_TYPES , DecisionNotificationType , DECISION_NOTIFICATION_TYPES , ActivateListenerPayload } from '../notification_center/type' ;
66
67
import {
67
68
FEATURE_NOT_IN_DATAFILE ,
68
69
INVALID_INPUT_FORMAT ,
@@ -382,17 +383,29 @@ export default class Optimizely extends BaseService implements Client {
382
383
this . eventProcessor . process ( impressionEvent ) ;
383
384
384
385
const logEvent = buildLogEvent ( [ impressionEvent ] ) ;
385
- this . notificationCenter . sendNotifications ( NOTIFICATION_TYPES . ACTIVATE , {
386
- experiment : decisionObj . experiment ,
386
+
387
+ const activateNotificationPayload : ActivateListenerPayload = {
388
+ experiment : null ,
389
+ holdout : null ,
387
390
userId : userId ,
388
391
attributes : attributes ,
389
392
variation : decisionObj . variation ,
390
393
logEvent,
391
- } ) ;
394
+ } ;
395
+
396
+ if ( decisionObj . experiment ) {
397
+ if ( isHoldout ( decisionObj . experiment ) ) {
398
+ activateNotificationPayload . holdout = decisionObj . experiment ;
399
+ } else {
400
+ activateNotificationPayload . experiment = decisionObj . experiment ;
401
+ }
402
+ }
403
+
404
+ this . notificationCenter . sendNotifications ( NOTIFICATION_TYPES . ACTIVATE , activateNotificationPayload ) ;
392
405
}
393
406
394
407
/**
395
- * Sends conversion event to Optimizely.
408
+ * Sends conversion event to Optimizely.`
396
409
* @param {string } eventKey
397
410
* @param {string } userId
398
411
* @param {UserAttributes } attributes
0 commit comments