@@ -266,14 +266,6 @@ export default class Optimizely implements Client {
266266 return this . projectConfigManager . getConfig ( ) || null ;
267267 }
268268
269- /**
270- * Returns a truthy value if this instance currently has a valid project config
271- * @return {boolean }
272- */
273- private hasProjectConfig ( ) : boolean {
274- return ! ! this . projectConfigManager . getConfig ( ) ;
275- }
276-
277269 /**
278270 * Buckets visitor and sends impression event to Optimizely.
279271 * @param {string } experimentKey
@@ -283,7 +275,7 @@ export default class Optimizely implements Client {
283275 */
284276 activate ( experimentKey : string , userId : string , attributes ?: UserAttributes ) : string | null {
285277 try {
286- const configObj = this . projectConfigManager . getConfig ( ) ;
278+ const configObj = this . getProjectConfig ( ) ;
287279 if ( ! configObj ) {
288280 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'activate' ) ;
289281 return null ;
@@ -348,7 +340,7 @@ export default class Optimizely implements Client {
348340 return ;
349341 }
350342
351- const configObj = this . projectConfigManager . getConfig ( ) ;
343+ const configObj = this . getProjectConfig ( ) ;
352344 if ( ! configObj ) {
353345 return ;
354346 }
@@ -389,7 +381,7 @@ export default class Optimizely implements Client {
389381 return ;
390382 }
391383
392- const configObj = this . projectConfigManager . getConfig ( ) ;
384+ const configObj = this . getProjectConfig ( ) ;
393385 if ( ! configObj ) {
394386 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'track' ) ;
395387 return ;
@@ -444,7 +436,7 @@ export default class Optimizely implements Client {
444436 */
445437 getVariation ( experimentKey : string , userId : string , attributes ?: UserAttributes ) : string | null {
446438 try {
447- const configObj = this . projectConfigManager . getConfig ( ) ;
439+ const configObj = this . getProjectConfig ( ) ;
448440 if ( ! configObj ) {
449441 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'getVariation' ) ;
450442 return null ;
@@ -504,7 +496,7 @@ export default class Optimizely implements Client {
504496 return false ;
505497 }
506498
507- const configObj = this . projectConfigManager . getConfig ( ) ;
499+ const configObj = this . getProjectConfig ( ) ;
508500 if ( ! configObj ) {
509501 return false ;
510502 }
@@ -528,7 +520,7 @@ export default class Optimizely implements Client {
528520 return null ;
529521 }
530522
531- const configObj = this . projectConfigManager . getConfig ( ) ;
523+ const configObj = this . getProjectConfig ( ) ;
532524 if ( ! configObj ) {
533525 return null ;
534526 }
@@ -611,7 +603,7 @@ export default class Optimizely implements Client {
611603 */
612604 isFeatureEnabled ( featureKey : string , userId : string , attributes ?: UserAttributes ) : boolean {
613605 try {
614- const configObj = this . projectConfigManager . getConfig ( ) ;
606+ const configObj = this . getProjectConfig ( ) ;
615607 if ( ! configObj ) {
616608 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'isFeatureEnabled' ) ;
617609 return false ;
@@ -688,7 +680,7 @@ export default class Optimizely implements Client {
688680 try {
689681 const enabledFeatures : string [ ] = [ ] ;
690682
691- const configObj = this . projectConfigManager . getConfig ( ) ;
683+ const configObj = this . getProjectConfig ( ) ;
692684 if ( ! configObj ) {
693685 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'getEnabledFeatures' ) ;
694686 return enabledFeatures ;
@@ -732,7 +724,7 @@ export default class Optimizely implements Client {
732724 attributes ?: UserAttributes
733725 ) : FeatureVariableValue {
734726 try {
735- if ( ! this . hasProjectConfig ( ) ) {
727+ if ( ! this . getProjectConfig ( ) ) {
736728 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'getFeatureVariable' ) ;
737729 return null ;
738730 }
@@ -776,7 +768,7 @@ export default class Optimizely implements Client {
776768 return null ;
777769 }
778770
779- const configObj = this . projectConfigManager . getConfig ( ) ;
771+ const configObj = this . getProjectConfig ( ) ;
780772 if ( ! configObj ) {
781773 return null ;
782774 }
@@ -862,7 +854,7 @@ export default class Optimizely implements Client {
862854 variable : FeatureVariable ,
863855 userId : string
864856 ) : FeatureVariableValue {
865- const configObj = this . projectConfigManager . getConfig ( ) ;
857+ const configObj = this . getProjectConfig ( ) ;
866858 if ( ! configObj ) {
867859 return null ;
868860 }
@@ -926,7 +918,7 @@ export default class Optimizely implements Client {
926918 attributes ?: UserAttributes
927919 ) : boolean | null {
928920 try {
929- if ( ! this . hasProjectConfig ( ) ) {
921+ if ( ! this . getProjectConfig ( ) ) {
930922 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'getFeatureVariableBoolean' ) ;
931923 return null ;
932924 }
@@ -964,7 +956,7 @@ export default class Optimizely implements Client {
964956 attributes ?: UserAttributes
965957 ) : number | null {
966958 try {
967- if ( ! this . hasProjectConfig ( ) ) {
959+ if ( ! this . getProjectConfig ( ) ) {
968960 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'getFeatureVariableDouble' ) ;
969961 return null ;
970962 }
@@ -1002,7 +994,7 @@ export default class Optimizely implements Client {
1002994 attributes ?: UserAttributes
1003995 ) : number | null {
1004996 try {
1005- if ( ! this . hasProjectConfig ( ) ) {
997+ if ( ! this . getProjectConfig ( ) ) {
1006998 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'getFeatureVariableInteger' ) ;
1007999 return null ;
10081000 }
@@ -1040,7 +1032,7 @@ export default class Optimizely implements Client {
10401032 attributes ?: UserAttributes
10411033 ) : string | null {
10421034 try {
1043- if ( ! this . hasProjectConfig ( ) ) {
1035+ if ( ! this . getProjectConfig ( ) ) {
10441036 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'getFeatureVariableString' ) ;
10451037 return null ;
10461038 }
@@ -1073,7 +1065,7 @@ export default class Optimizely implements Client {
10731065 */
10741066 getFeatureVariableJSON ( featureKey : string , variableKey : string , userId : string , attributes : UserAttributes ) : unknown {
10751067 try {
1076- if ( ! this . hasProjectConfig ( ) ) {
1068+ if ( ! this . getProjectConfig ( ) ) {
10771069 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'getFeatureVariableJSON' ) ;
10781070 return null ;
10791071 }
@@ -1100,7 +1092,7 @@ export default class Optimizely implements Client {
11001092 attributes ?: UserAttributes
11011093 ) : { [ variableKey : string ] : unknown } | null {
11021094 try {
1103- const configObj = this . projectConfigManager . getConfig ( ) ;
1095+ const configObj = this . getProjectConfig ( ) ;
11041096
11051097 if ( ! configObj ) {
11061098 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'getAllFeatureVariables' ) ;
@@ -1201,7 +1193,7 @@ export default class Optimizely implements Client {
12011193 */
12021194 getOptimizelyConfig ( ) : OptimizelyConfig | null {
12031195 try {
1204- const configObj = this . projectConfigManager . getConfig ( ) ;
1196+ const configObj = this . getProjectConfig ( ) ;
12051197 if ( ! configObj ) {
12061198 return null ;
12071199 }
@@ -1400,7 +1392,7 @@ export default class Optimizely implements Client {
14001392 }
14011393
14021394 decide ( user : OptimizelyUserContext , key : string , options : OptimizelyDecideOption [ ] = [ ] ) : OptimizelyDecision {
1403- const configObj = this . projectConfigManager . getConfig ( ) ;
1395+ const configObj = this . getProjectConfig ( ) ;
14041396
14051397 if ( ! configObj ) {
14061398 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'decide' ) ;
@@ -1545,7 +1537,7 @@ export default class Optimizely implements Client {
15451537 const flagsWithoutForcedDecision = [ ] ;
15461538 const validKeys = [ ] ;
15471539
1548- const configObj = this . projectConfigManager . getConfig ( )
1540+ const configObj = this . getProjectConfig ( )
15491541
15501542 if ( ! configObj ) {
15511543 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'decideForKeys' ) ;
@@ -1616,7 +1608,7 @@ export default class Optimizely implements Client {
16161608 options : OptimizelyDecideOption [ ] = [ ]
16171609 ) : { [ key : string ] : OptimizelyDecision } {
16181610 const decisionMap : { [ key : string ] : OptimizelyDecision } = { } ;
1619- const configObj = this . projectConfigManager . getConfig ( ) ;
1611+ const configObj = this . getProjectConfig ( ) ;
16201612 if ( ! configObj ) {
16211613 this . errorReporter . report ( NO_PROJECT_CONFIG_FAILURE , 'decideAll' ) ;
16221614 return decisionMap ;
@@ -1631,7 +1623,7 @@ export default class Optimizely implements Client {
16311623 * Updates ODP Config with most recent ODP key, host, pixelUrl, and segments from the project config
16321624 */
16331625 private updateOdpSettings ( ) : void {
1634- const projectConfig = this . projectConfigManager . getConfig ( ) ;
1626+ const projectConfig = this . getProjectConfig ( ) ;
16351627
16361628 if ( ! projectConfig ) {
16371629 return ;
@@ -1673,7 +1665,7 @@ export default class Optimizely implements Client {
16731665 * @returns { boolean } `true` if ODP settings were found in the datafile otherwise `false`
16741666 */
16751667 public isOdpIntegrated ( ) : boolean {
1676- return this . projectConfigManager . getConfig ( ) ?. odpIntegrationConfig ?. integrated ?? false ;
1668+ return this . getProjectConfig ( ) ?. odpIntegrationConfig ?. integrated ?? false ;
16771669 }
16781670
16791671 /**
0 commit comments