@@ -119,7 +119,8 @@ export class DecisionService {
119
119
configObj : ProjectConfig ,
120
120
experiment : Experiment ,
121
121
user : OptimizelyUserContext ,
122
- userProfileTracker ?: UserProfileTracker
122
+ shouldIgnoreUPS : boolean ,
123
+ userProfileTracker : UserProfileTracker
123
124
) : DecisionResponse < string | null > {
124
125
const userId = user . getUserId ( ) ;
125
126
const attributes = user . getAttributes ( ) ;
@@ -157,7 +158,7 @@ export class DecisionService {
157
158
158
159
159
160
// check for sticky bucketing if decide options do not include shouldIgnoreUPS
160
- if ( userProfileTracker ) {
161
+ if ( ! shouldIgnoreUPS ) {
161
162
variation = this . getStoredVariation ( configObj , experiment , userId , userProfileTracker . userProfile ) ;
162
163
if ( variation ) {
163
164
this . logger . log (
@@ -254,7 +255,7 @@ export class DecisionService {
254
255
experimentKey ,
255
256
] ) ;
256
257
// persist bucketing if decide options do not include shouldIgnoreUPS
257
- if ( userProfileTracker ) {
258
+ if ( ! shouldIgnoreUPS ) {
258
259
this . updateUserProfile ( experiment , variation , userProfileTracker ) ;
259
260
}
260
261
@@ -288,7 +289,7 @@ export class DecisionService {
288
289
userProfileTracker . userProfile = this . resolveExperimentBucketMap ( user . getUserId ( ) , user . getAttributes ( ) ) ;
289
290
}
290
291
291
- const result = this . resolveVariation ( configObj , experiment , user , userProfileTracker ) ;
292
+ const result = this . resolveVariation ( configObj , experiment , user , shouldIgnoreUPS , userProfileTracker ) ;
292
293
293
294
if ( ! shouldIgnoreUPS ) {
294
295
this . saveUserProfile ( user . getUserId ( ) , userProfileTracker )
@@ -611,7 +612,7 @@ export class DecisionService {
611
612
612
613
for ( const feature of featureFlags ) {
613
614
const decideReasons : ( string | number ) [ ] [ ] = [ ] ;
614
- const decisionVariation = this . getVariationForFeatureExperiment ( configObj , feature , user , userProfileTracker ) ;
615
+ const decisionVariation = this . getVariationForFeatureExperiment ( configObj , feature , user , shouldIgnoreUPS , userProfileTracker ) ;
615
616
decideReasons . push ( ...decisionVariation . reasons ) ;
616
617
const experimentDecision = decisionVariation . result ;
617
618
@@ -678,7 +679,8 @@ export class DecisionService {
678
679
configObj : ProjectConfig ,
679
680
feature : FeatureFlag ,
680
681
user : OptimizelyUserContext ,
681
- userProfileTracker ?: UserProfileTracker
682
+ shouldIgnoreUPS : boolean ,
683
+ userProfileTracker : UserProfileTracker
682
684
) : DecisionResponse < DecisionObj > {
683
685
684
686
const decideReasons : ( string | number ) [ ] [ ] = [ ] ;
@@ -693,7 +695,7 @@ export class DecisionService {
693
695
for ( index = 0 ; index < feature . experimentIds . length ; index ++ ) {
694
696
const experiment = getExperimentFromId ( configObj , feature . experimentIds [ index ] , this . logger ) ;
695
697
if ( experiment ) {
696
- decisionVariation = this . getVariationFromExperimentRule ( configObj , feature . key , experiment , user , userProfileTracker ) ;
698
+ decisionVariation = this . getVariationFromExperimentRule ( configObj , feature . key , experiment , user , shouldIgnoreUPS , userProfileTracker ) ;
697
699
decideReasons . push ( ...decisionVariation . reasons ) ;
698
700
variationKey = decisionVariation . result ;
699
701
if ( variationKey ) {
@@ -1190,7 +1192,8 @@ export class DecisionService {
1190
1192
flagKey : string ,
1191
1193
rule : Experiment ,
1192
1194
user : OptimizelyUserContext ,
1193
- userProfileTracker ?: UserProfileTracker
1195
+ shouldIgnoreUPS : boolean ,
1196
+ userProfileTracker : UserProfileTracker
1194
1197
) : DecisionResponse < string | null > {
1195
1198
const decideReasons : ( string | number ) [ ] [ ] = [ ] ;
1196
1199
@@ -1205,7 +1208,7 @@ export class DecisionService {
1205
1208
reasons : decideReasons ,
1206
1209
} ;
1207
1210
}
1208
- const decisionVariation = this . resolveVariation ( configObj , rule , user , userProfileTracker ) ;
1211
+ const decisionVariation = this . resolveVariation ( configObj , rule , user , shouldIgnoreUPS , userProfileTracker ) ;
1209
1212
decideReasons . push ( ...decisionVariation . reasons ) ;
1210
1213
const variationKey = decisionVariation . result ;
1211
1214
0 commit comments