Skip to content

Commit 67105ba

Browse files
authored
fix (config update): Change notification name and log message to refer to Optimizely config instead of project config (#22)
Summary: Notification name and log messages refer to "Optimizely config" instead of "project config". Test plan: Updated unit test
1 parent b6884e9 commit 67105ba

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

packages/optimizely-sdk/lib/optimizely/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ function Optimizely(config) {
7979
});
8080

8181
this.__disposeOnUpdate = this.projectConfigManager.onUpdate(function(configObj) {
82-
this.logger.log(LOG_LEVEL.INFO, sprintf(LOG_MESSAGES.UPDATED_PROJECT_CONFIG, MODULE_NAME, configObj.revision));
83-
this.notificationCenter.sendNotifications(NOTIFICATION_TYPES.PROJECT_CONFIG_UPDATE);
82+
this.logger.log(LOG_LEVEL.INFO, sprintf(LOG_MESSAGES.UPDATED_OPTIMIZELY_CONFIG, MODULE_NAME, configObj.revision, configObj.projectId));
83+
this.notificationCenter.sendNotifications(NOTIFICATION_TYPES.OPTIMIZELY_CONFIG_UPDATE);
8484
}.bind(this));
8585

8686
this.__readyPromise = this.projectConfigManager.onReady();
@@ -694,7 +694,7 @@ Optimizely.prototype._getFeatureVariableForType = function(featureKey, variableK
694694
var featureEnabled = false;
695695
var variableValue = variable.defaultValue;
696696
var decision = this.decisionService.getVariationForFeature(configObj, featureFlag, userId, attributes);
697-
697+
698698
if (decision.variation !== null) {
699699
featureEnabled = decision.variation.featureEnabled;
700700
var value = projectConfig.getVariableValueForVariation(configObj, variable, decision.variation, this.logger);

packages/optimizely-sdk/lib/optimizely/index.tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4906,7 +4906,7 @@ describe('lib/optimizely', function() {
49064906
it('emits a notification when the project config manager emits a new project config object', function() {
49074907
var listener = sinon.spy();
49084908
optlyInstance.notificationCenter.addNotificationListener(
4909-
enums.NOTIFICATION_TYPES.PROJECT_CONFIG_UPDATE,
4909+
enums.NOTIFICATION_TYPES.OPTIMIZELY_CONFIG_UPDATE,
49104910
listener
49114911
);
49124912
var newConfig = projectConfig.createProjectConfig(testData.getTestProjectConfigWithFeatures());

packages/optimizely-sdk/lib/utils/enums/index.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ exports.LOG_MESSAGES = {
136136
UNEXPECTED_TYPE_NULL: '%s: Audience condition %s evaluated to UNKNOWN because a null value was passed for user attribute "%s".',
137137
UNKNOWN_CONDITION_TYPE: '%s: Audience condition %s has an unknown condition type. You may need to upgrade to a newer release of the Optimizely SDK.',
138138
UNKNOWN_MATCH_TYPE: '%s: Audience condition %s uses an unknown match type. You may need to upgrade to a newer release of the Optimizely SDK.',
139-
UPDATED_PROJECT_CONFIG: '%s: Updated project config to revision %s',
139+
UPDATED_OPTIMIZELY_CONFIG: '%s: Updated Optimizely config to revision %s (project id %s)',
140140
OUT_OF_BOUNDS: '%s: Audience condition %s evaluated to UNKNOWN because the number value for user attribute "%s" is not in the range [-2^53, +2^53].',
141141
};
142142

@@ -177,25 +177,22 @@ exports.NODE_CLIENT_VERSION = '3.1.0-beta1';
177177
* - attributes {Object|undefined}
178178
* - eventTags {Object|undefined}
179179
* - logEvent {Object}
180-
* DECISION: A decision is made in the system. i.e. user activation,
180+
* DECISION: A decision is made in the system. i.e. user activation,
181181
* feature access or feature-variable value retrieval
182182
* Callbacks will receive an object argument with the following properties:
183183
* - type {string}
184184
* - userId {string}
185185
* - attributes {Object|undefined}
186186
* - decisionInfo {Object|undefined}
187187
*
188-
* PROJECT_CONFIG_UPDATE: This Optimizely instance has been updated with a new
189-
* project config
190-
* Callbacks will receive an object argument with the following properties:
191-
* - oldProjectConfig {Object}
192-
* - newProjectConfig {Object|null}
188+
* OPTIMIZELY_CONFIG_UPDATE: This Optimizely instance has been updated with a new
189+
* config
193190
*/
194191
exports.NOTIFICATION_TYPES = {
195192
ACTIVATE: 'ACTIVATE:experiment, user_id,attributes, variation, event',
196193
TRACK: 'TRACK:event_key, user_id, attributes, event_tags, event',
197194
DECISION: 'DECISION:type, userId, attributes, decisionInfo',
198-
PROJECT_CONFIG_UPDATE: 'PROJECT_CONFIG_UPDATE',
195+
OPTIMIZELY_CONFIG_UPDATE: 'OPTIMIZELY_CONFIG_UPDATE',
199196
};
200197

201198
exports.DECISION_INFO_TYPES = {

0 commit comments

Comments
 (0)