@@ -273,14 +273,6 @@ export default class Optimizely extends BaseService implements Client {
273273 return this . projectConfigManager . getConfig ( ) || null ;
274274 }
275275
276- /**
277- * Returns a truthy value if this instance currently has a valid project config
278- * @return {boolean }
279- */
280- private hasProjectConfig ( ) : boolean {
281- return ! ! this . projectConfigManager . getConfig ( ) ;
282- }
283-
284276 /**
285277 * Buckets visitor and sends impression event to Optimizely.
286278 * @param {string } experimentKey
@@ -290,7 +282,7 @@ export default class Optimizely extends BaseService implements Client {
290282 */
291283 activate ( experimentKey : string , userId : string , attributes ?: UserAttributes ) : string | null {
292284 try {
293- const configObj = this . projectConfigManager . getConfig ( ) ;
285+ const configObj = this . getProjectConfig ( ) ;
294286 if ( ! configObj ) {
295287 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'activate' ) ;
296288 return null ;
@@ -355,7 +347,7 @@ export default class Optimizely extends BaseService implements Client {
355347 return ;
356348 }
357349
358- const configObj = this . projectConfigManager . getConfig ( ) ;
350+ const configObj = this . getProjectConfig ( ) ;
359351 if ( ! configObj ) {
360352 return ;
361353 }
@@ -396,7 +388,7 @@ export default class Optimizely extends BaseService implements Client {
396388 return ;
397389 }
398390
399- const configObj = this . projectConfigManager . getConfig ( ) ;
391+ const configObj = this . getProjectConfig ( ) ;
400392 if ( ! configObj ) {
401393 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'track' ) ;
402394 return ;
@@ -451,7 +443,7 @@ export default class Optimizely extends BaseService implements Client {
451443 */
452444 getVariation ( experimentKey : string , userId : string , attributes ?: UserAttributes ) : string | null {
453445 try {
454- const configObj = this . projectConfigManager . getConfig ( ) ;
446+ const configObj = this . getProjectConfig ( ) ;
455447 if ( ! configObj ) {
456448 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'getVariation' ) ;
457449 return null ;
@@ -511,7 +503,7 @@ export default class Optimizely extends BaseService implements Client {
511503 return false ;
512504 }
513505
514- const configObj = this . projectConfigManager . getConfig ( ) ;
506+ const configObj = this . getProjectConfig ( ) ;
515507 if ( ! configObj ) {
516508 return false ;
517509 }
@@ -535,7 +527,7 @@ export default class Optimizely extends BaseService implements Client {
535527 return null ;
536528 }
537529
538- const configObj = this . projectConfigManager . getConfig ( ) ;
530+ const configObj = this . getProjectConfig ( ) ;
539531 if ( ! configObj ) {
540532 return null ;
541533 }
@@ -618,7 +610,7 @@ export default class Optimizely extends BaseService implements Client {
618610 */
619611 isFeatureEnabled ( featureKey : string , userId : string , attributes ?: UserAttributes ) : boolean {
620612 try {
621- const configObj = this . projectConfigManager . getConfig ( ) ;
613+ const configObj = this . getProjectConfig ( ) ;
622614 if ( ! configObj ) {
623615 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'isFeatureEnabled' ) ;
624616 return false ;
@@ -695,7 +687,7 @@ export default class Optimizely extends BaseService implements Client {
695687 try {
696688 const enabledFeatures : string [ ] = [ ] ;
697689
698- const configObj = this . projectConfigManager . getConfig ( ) ;
690+ const configObj = this . getProjectConfig ( ) ;
699691 if ( ! configObj ) {
700692 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'getEnabledFeatures' ) ;
701693 return enabledFeatures ;
@@ -739,7 +731,7 @@ export default class Optimizely extends BaseService implements Client {
739731 attributes ?: UserAttributes
740732 ) : FeatureVariableValue {
741733 try {
742- if ( ! this . hasProjectConfig ( ) ) {
734+ if ( ! this . getProjectConfig ( ) ) {
743735 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'getFeatureVariable' ) ;
744736 return null ;
745737 }
@@ -783,7 +775,7 @@ export default class Optimizely extends BaseService implements Client {
783775 return null ;
784776 }
785777
786- const configObj = this . projectConfigManager . getConfig ( ) ;
778+ const configObj = this . getProjectConfig ( ) ;
787779 if ( ! configObj ) {
788780 return null ;
789781 }
@@ -869,7 +861,7 @@ export default class Optimizely extends BaseService implements Client {
869861 variable : FeatureVariable ,
870862 userId : string
871863 ) : FeatureVariableValue {
872- const configObj = this . projectConfigManager . getConfig ( ) ;
864+ const configObj = this . getProjectConfig ( ) ;
873865 if ( ! configObj ) {
874866 return null ;
875867 }
@@ -933,7 +925,7 @@ export default class Optimizely extends BaseService implements Client {
933925 attributes ?: UserAttributes
934926 ) : boolean | null {
935927 try {
936- if ( ! this . hasProjectConfig ( ) ) {
928+ if ( ! this . getProjectConfig ( ) ) {
937929 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'getFeatureVariableBoolean' ) ;
938930 return null ;
939931 }
@@ -971,7 +963,7 @@ export default class Optimizely extends BaseService implements Client {
971963 attributes ?: UserAttributes
972964 ) : number | null {
973965 try {
974- if ( ! this . hasProjectConfig ( ) ) {
966+ if ( ! this . getProjectConfig ( ) ) {
975967 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'getFeatureVariableDouble' ) ;
976968 return null ;
977969 }
@@ -1009,7 +1001,7 @@ export default class Optimizely extends BaseService implements Client {
10091001 attributes ?: UserAttributes
10101002 ) : number | null {
10111003 try {
1012- if ( ! this . hasProjectConfig ( ) ) {
1004+ if ( ! this . getProjectConfig ( ) ) {
10131005 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'getFeatureVariableInteger' ) ;
10141006 return null ;
10151007 }
@@ -1047,7 +1039,7 @@ export default class Optimizely extends BaseService implements Client {
10471039 attributes ?: UserAttributes
10481040 ) : string | null {
10491041 try {
1050- if ( ! this . hasProjectConfig ( ) ) {
1042+ if ( ! this . getProjectConfig ( ) ) {
10511043 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'getFeatureVariableString' ) ;
10521044 return null ;
10531045 }
@@ -1080,7 +1072,7 @@ export default class Optimizely extends BaseService implements Client {
10801072 */
10811073 getFeatureVariableJSON ( featureKey : string , variableKey : string , userId : string , attributes : UserAttributes ) : unknown {
10821074 try {
1083- if ( ! this . hasProjectConfig ( ) ) {
1075+ if ( ! this . getProjectConfig ( ) ) {
10841076 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'getFeatureVariableJSON' ) ;
10851077 return null ;
10861078 }
@@ -1107,7 +1099,7 @@ export default class Optimizely extends BaseService implements Client {
11071099 attributes ?: UserAttributes
11081100 ) : { [ variableKey : string ] : unknown } | null {
11091101 try {
1110- const configObj = this . projectConfigManager . getConfig ( ) ;
1102+ const configObj = this . getProjectConfig ( ) ;
11111103
11121104 if ( ! configObj ) {
11131105 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'getAllFeatureVariables' ) ;
@@ -1208,7 +1200,7 @@ export default class Optimizely extends BaseService implements Client {
12081200 */
12091201 getOptimizelyConfig ( ) : OptimizelyConfig | null {
12101202 try {
1211- const configObj = this . projectConfigManager . getConfig ( ) ;
1203+ const configObj = this . getProjectConfig ( ) ;
12121204 if ( ! configObj ) {
12131205 return null ;
12141206 }
@@ -1388,7 +1380,7 @@ export default class Optimizely extends BaseService implements Client {
13881380 }
13891381
13901382 decide ( user : OptimizelyUserContext , key : string , options : OptimizelyDecideOption [ ] = [ ] ) : OptimizelyDecision {
1391- const configObj = this . projectConfigManager . getConfig ( ) ;
1383+ const configObj = this . getProjectConfig ( ) ;
13921384
13931385 if ( ! configObj ) {
13941386 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'decide' ) ;
@@ -1533,7 +1525,7 @@ export default class Optimizely extends BaseService implements Client {
15331525 const flagsWithoutForcedDecision = [ ] ;
15341526 const validKeys = [ ] ;
15351527
1536- const configObj = this . projectConfigManager . getConfig ( )
1528+ const configObj = this . getProjectConfig ( )
15371529
15381530 if ( ! configObj ) {
15391531 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'decideForKeys' ) ;
@@ -1604,7 +1596,7 @@ export default class Optimizely extends BaseService implements Client {
16041596 options : OptimizelyDecideOption [ ] = [ ]
16051597 ) : { [ key : string ] : OptimizelyDecision } {
16061598 const decisionMap : { [ key : string ] : OptimizelyDecision } = { } ;
1607- const configObj = this . projectConfigManager . getConfig ( ) ;
1599+ const configObj = this . getProjectConfig ( ) ;
16081600 if ( ! configObj ) {
16091601 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'decideAll' ) ;
16101602 return decisionMap ;
@@ -1619,7 +1611,7 @@ export default class Optimizely extends BaseService implements Client {
16191611 * Updates ODP Config with most recent ODP key, host, pixelUrl, and segments from the project config
16201612 */
16211613 private updateOdpSettings ( ) : void {
1622- const projectConfig = this . projectConfigManager . getConfig ( ) ;
1614+ const projectConfig = this . getProjectConfig ( ) ;
16231615
16241616 if ( ! projectConfig ) {
16251617 return ;
@@ -1661,7 +1653,7 @@ export default class Optimizely extends BaseService implements Client {
16611653 * @returns { boolean } `true` if ODP settings were found in the datafile otherwise `false`
16621654 */
16631655 public isOdpIntegrated ( ) : boolean {
1664- return this . projectConfigManager . getConfig ( ) ?. odpIntegrationConfig ?. integrated ?? false ;
1656+ return this . getProjectConfig ( ) ?. odpIntegrationConfig ?. integrated ?? false ;
16651657 }
16661658
16671659 /**
0 commit comments