Skip to content

Commit c684087

Browse files
[FSSDK-10935] review update
1 parent 052c8dd commit c684087

File tree

20 files changed

+35
-57
lines changed

20 files changed

+35
-57
lines changed

lib/core/audience_evaluator/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import * as conditionTreeEvaluator from '../condition_tree_evaluator';
2323
import * as customAttributeConditionEvaluator from '../custom_attribute_condition_evaluator';
2424
import * as odpSegmentsConditionEvaluator from './odp_segment_condition_evaluator';
2525
import { Audience, Condition, OptimizelyUserContext } from '../../shared_types';
26-
import { CONDITION_EVALUATOR_ERROR } from '../../error_messages';
27-
import { AUDIENCE_EVALUATION_RESULT, EVALUATING_AUDIENCE, UNKNOWN_CONDITION_TYPE } from '../../log_messages';
26+
import { CONDITION_EVALUATOR_ERROR, UNKNOWN_CONDITION_TYPE } from '../../error_messages';
27+
import { AUDIENCE_EVALUATION_RESULT, EVALUATING_AUDIENCE} from '../../log_messages';
2828

2929
const logger = getLogger();
3030
const MODULE_NAME = 'AUDIENCE_EVALUATOR';

lib/core/audience_evaluator/odp_segment_condition_evaluator/index.tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { sprintf } from '../../../utils/fns';
2020
import { LOG_LEVEL } from '../../../utils/enums';
2121
import * as logging from '../../../modules/logging';
2222
import * as odpSegmentEvalutor from './';
23-
import { UNKNOWN_MATCH_TYPE } from '../../../log_messages';
23+
import { UNKNOWN_MATCH_TYPE } from '../../../error_messages';
2424

2525
var odpSegment1Condition = {
2626
"value": "odp-segment-1",

lib/core/audience_evaluator/odp_segment_condition_evaluator/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and *
1414
* limitations under the License. *
1515
***************************************************************************/
16-
import { UNKNOWN_MATCH_TYPE } from '../../../log_messages';
16+
import { UNKNOWN_MATCH_TYPE } from '../../../error_messages';
1717
import { getLogger } from '../../../modules/logging';
1818
import { Condition, OptimizelyUserContext } from '../../../shared_types';
1919

lib/core/bucketer/index.tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ import projectConfig from '../../project_config/project_config';
2525
import { getTestProjectConfig } from '../../tests/test_data';
2626
import { INVALID_BUCKETING_ID, INVALID_GROUP_ID } from '../../error_messages';
2727
import {
28-
USER_ASSIGNED_TO_EXPERIMENT_BUCKET,
2928
USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP,
3029
USER_NOT_BUCKETED_INTO_EXPERIMENT_IN_GROUP,
3130
USER_NOT_IN_ANY_EXPERIMENT,
32-
} from '../../log_messages';
31+
USER_ASSIGNED_TO_EXPERIMENT_BUCKET,
32+
} from '.';
3333

3434
var buildLogMessageFromArgs = args => sprintf(args[1], ...args.splice(2));
3535
var testData = getTestProjectConfig();

lib/core/bucketer/index.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@ import {
2929

3030
import { LOG_LEVEL } from '../../utils/enums';
3131
import { INVALID_BUCKETING_ID, INVALID_GROUP_ID } from '../../error_messages';
32-
import {
33-
INVALID_VARIATION_ID,
34-
USER_ASSIGNED_TO_EXPERIMENT_BUCKET,
35-
USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP,
36-
USER_NOT_BUCKETED_INTO_EXPERIMENT_IN_GROUP,
37-
USER_NOT_IN_ANY_EXPERIMENT,
38-
} from '../../log_messages';
32+
33+
export const USER_NOT_IN_ANY_EXPERIMENT = '%s: User %s is not in any experiment of group %s.';
34+
export const USER_NOT_BUCKETED_INTO_EXPERIMENT_IN_GROUP = '%s: User %s is not in experiment %s of group %s.';
35+
export const USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP = '%s: User %s is in experiment %s of group %s.';
36+
export const USER_ASSIGNED_TO_EXPERIMENT_BUCKET = '%s: Assigned bucket %s to user with bucketing ID %s.';
37+
export const INVALID_VARIATION_ID = '%s: Bucketed into an invalid variation ID. Returning null.';
3938

4039
const HASH_SEED = 1;
4140
const MAX_HASH_VALUE = Math.pow(2, 32);

lib/core/custom_attribute_condition_evaluator/index.tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ import {
2828
UNEXPECTED_CONDITION_VALUE,
2929
UNEXPECTED_TYPE,
3030
UNEXPECTED_TYPE_NULL,
31-
UNKNOWN_MATCH_TYPE,
3231
} from '../../log_messages';
32+
import { UNKNOWN_MATCH_TYPE } from '../../error_messages';
3333

3434
var browserConditionSafari = {
3535
name: 'browser_type',

lib/core/custom_attribute_condition_evaluator/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import {
2424
UNEXPECTED_CONDITION_VALUE,
2525
UNEXPECTED_TYPE,
2626
UNEXPECTED_TYPE_NULL,
27-
UNKNOWN_MATCH_TYPE,
2827
} from '../../log_messages';
28+
import { UNKNOWN_MATCH_TYPE } from '../../error_messages';
2929

3030
const MODULE_NAME = 'CUSTOM_ATTRIBUTE_CONDITION_EVALUATOR';
3131

lib/error_messages.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
1716
export const BROWSER_ODP_MANAGER_INITIALIZATION_FAILED = '%s: Error initializing Browser ODP Manager.';
1817
export const CONDITION_EVALUATOR_ERROR = '%s: Error evaluating audience condition of type %s: %s';
1918
export const DATAFILE_AND_SDK_KEY_MISSING =
@@ -98,11 +97,11 @@ export const INVALID_VARIATION_KEY = '%s: Provided variation key is in an invali
9897
export const UNABLE_TO_GET_VUID = 'Unable to get VUID - ODP Manager is not instantiated yet.';
9998
export const ERROR_FETCHING_DATAFILE = 'Error fetching datafile: %s';
10099
export const DATAFILE_FETCH_REQUEST_FAILED = 'Datafile fetch request failed with status: %s';
101-
export const ONRUNNING_ERROR = 'onRunning error';
102100
export const EVENT_DATA_FOUND_TO_BE_INVALID = 'Event data found to be invalid.';
103101
export const EVENT_ACTION_INVALID = 'Event action invalid.';
104102
export const FAILED_TO_SEND_ODP_EVENTS = 'failed to send odp events';
105-
export const UNABLE_TO_OVERWRITE_GLOBAL_WINDOW = 'Unable to overwrite global.window.';
106103
export const UNABLE_TO_GET_VUID_VUID_MANAGER_NOT_AVAILABLE = 'Unable to get VUID - VuidManager is not available'
107-
108-
104+
export const UNKNOWN_CONDITION_TYPE =
105+
'%s: Audience condition %s has an unknown condition type. You may need to upgrade to a newer release of the Optimizely SDK.';
106+
export const UNKNOWN_MATCH_TYPE =
107+
'%s: Audience condition %s uses an unknown match type. You may need to upgrade to a newer release of the Optimizely SDK.';

lib/event_processor/event_processor_factory.react_native.spec.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ async function mockRequireNetInfo() {
6060
M._load = (uri: string, parent: string) => {
6161
if (uri === '@react-native-community/netinfo') {
6262
if (isNetInfoAvailable) return {};
63-
throw new Error(MODULE_NOT_FOUND_REACT_NATIVE_NETINFO);
63+
throw new Error("Module not found: @react-native-community/netinfo");
6464
}
6565
if (uri === '@react-native-async-storage/async-storage') {
6666
if (isAsyncStorageAvailable) return {};
67-
throw new Error(MODULE_NOT_FOUND_REACT_NATIVE_ASYNC_STORAGE);
67+
throw new Error("Module not found: @react-native-async-storage/async-storage");
6868
}
6969

7070
return M._load_original(uri, parent);
@@ -80,10 +80,7 @@ import { AsyncCache, AsyncPrefixCache, SyncCache, SyncPrefixCache } from '../uti
8080
import { AsyncStorageCache } from '../utils/cache/async_storage_cache.react_native';
8181
import { ReactNativeNetInfoEventProcessor } from './batch_event_processor.react_native';
8282
import { BatchEventProcessor } from './batch_event_processor';
83-
import {
84-
MODULE_NOT_FOUND_REACT_NATIVE_ASYNC_STORAGE,
85-
MODULE_NOT_FOUND_REACT_NATIVE_NETINFO,
86-
} from '../exception_messages';
83+
import { MODULE_NOT_FOUND_REACT_NATIVE_ASYNC_STORAGE } from '../utils/import.react_native/@react-native-async-storage/async-storage';
8784

8885
describe('createForwardingEventProcessor', () => {
8986
const mockGetForwardingEventProcessor = vi.mocked(getForwardingEventProcessor);

lib/exception_messages.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,14 @@ export const INSTANCE_CLOSED = 'Instance closed';
3030
export const DATAFILE_MANAGER_STOPPED = 'Datafile manager stopped before it could be started';
3131
export const DATAFILE_MANAGER_FAILED_TO_START = 'Datafile manager failed to start';
3232
export const FAILED_TO_FETCH_DATAFILE = 'Failed to fetch datafile';
33-
export const FAILED_TO_START = 'Failed to start';
3433
export const FAILED_TO_STOP = 'Failed to stop';
3534
export const YOU_MUST_PROVIDE_DATAFILE_IN_SSR = 'You must provide datafile in SSR';
3635
export const YOU_MUST_PROVIDE_AT_LEAST_ONE_OF_SDKKEY_OR_DATAFILE = 'You must provide at least one of sdkKey or datafile';
3736
export const RETRY_CANCELLED = 'Retry cancelled';
37+
export const REQUEST_TIMEOUT = 'Request timeout';
3838
export const REQUEST_ERROR = 'Request error';
3939
export const REQUEST_FAILED = 'Request failed';
4040
export const UNSUPPORTED_PROTOCOL = 'Unsupported protocol: %s';
41-
export const REQUEST_TIMEOUT = 'Request timed out';
4241
export const NO_STATUS_CODE_IN_RESPONSE = 'No status code in response';
43-
export const MODULE_NOT_FOUND_REACT_NATIVE_ASYNC_STORAGE = 'Module not found: @react-native-async-storage/async-storage';
44-
export const MODULE_NOT_FOUND_REACT_NATIVE_NETINFO = 'Module not found: @react-native-community/netinfo';
45-
export const INVALID_CONFIG_OR_SOMETHING = 'Invalid config or something';
4642
export const PROMISE_SHOULD_NOT_HAVE_RESOLVED = 'Promise should not have resolved';
4743
export const VUID_IS_NOT_SUPPORTED_IN_NODEJS= 'VUID is not supported in Node.js environment';

0 commit comments

Comments
 (0)