11/**
2- * Copyright 2019-2023 , Optimizely
2+ * Copyright 2019-2024 , Optimizely
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
1313 * See the License for the specific language governing permissions and
1414 * limitations under the License.
1515 */
16- import {
17- getLogger ,
18- setErrorHandler ,
19- getErrorHandler ,
20- LogLevel ,
21- setLogHandler ,
22- setLogLevel
23- } from './modules/logging' ;
16+
17+ import { getLogger , setErrorHandler , getErrorHandler , LogLevel , setLogHandler , setLogLevel } from './modules/logging' ;
2418import * as enums from './utils/enums' ;
2519import Optimizely from './optimizely' ;
2620import configValidator from './utils/config_validator' ;
@@ -31,8 +25,7 @@ import eventProcessorConfigValidator from './utils/event_processor_config_valida
3125import { createNotificationCenter } from './core/notification_center' ;
3226import { createEventProcessor } from './plugins/event_processor/index.react_native' ;
3327import { OptimizelyDecideOption , Client , Config } from './shared_types' ;
34- import { createHttpPollingDatafileManager } from
35- './plugins/datafile_manager/react_native_http_polling_datafile_manager' ;
28+ import { createHttpPollingDatafileManager } from './plugins/datafile_manager/react_native_http_polling_datafile_manager' ;
3629import { BrowserOdpManager } from './plugins/odp_manager/index.browser' ;
3730import * as commonExports from './common_exports' ;
3831
@@ -71,7 +64,7 @@ const createInstance = function(config: Config): Client | null {
7164 configValidator . validate ( config ) ;
7265 isValidInstance = true ;
7366 // eslint-disable-next-line @typescript-eslint/no-explicit-any
74- } catch ( ex : any ) {
67+ } catch ( ex ) {
7568 logger . error ( ex ) ;
7669 }
7770
@@ -100,20 +93,27 @@ const createInstance = function(config: Config): Client | null {
10093 batchSize : eventBatchSize ,
10194 maxQueueSize : config . eventMaxQueueSize || DEFAULT_EVENT_MAX_QUEUE_SIZE ,
10295 notificationCenter,
103- }
96+ } ;
10497
10598 const eventProcessor = createEventProcessor ( eventProcessorConfig ) ;
10699
100+ const odpExplicitlyOff = config . odpOptions ?. disabled === true ;
101+ if ( odpExplicitlyOff ) {
102+ logger . info ( enums . LOG_MESSAGES . ODP_DISABLED ) ;
103+ }
104+
107105 const optimizelyOptions = {
108106 clientEngine : enums . REACT_NATIVE_JS_CLIENT_ENGINE ,
109107 ...config ,
110108 eventProcessor,
111109 logger,
112110 errorHandler,
113- datafileManager : config . sdkKey ? createHttpPollingDatafileManager ( config . sdkKey , logger , config . datafile , config . datafileOptions ) : undefined ,
111+ datafileManager : config . sdkKey
112+ ? createHttpPollingDatafileManager ( config . sdkKey , logger , config . datafile , config . datafileOptions )
113+ : undefined ,
114114 notificationCenter,
115115 isValidInstance : isValidInstance ,
116- odpManager : new BrowserOdpManager ( { logger, odpOptions : config . odpOptions } ) ,
116+ odpManager : odpExplicitlyOff ? undefined : new BrowserOdpManager ( { logger, odpOptions : config . odpOptions } ) ,
117117 } ;
118118
119119 // If client engine is react, convert it to react native.
@@ -123,7 +123,7 @@ const createInstance = function(config: Config): Client | null {
123123
124124 return new Optimizely ( optimizelyOptions ) ;
125125 // eslint-disable-next-line @typescript-eslint/no-explicit-any
126- } catch ( e : any ) {
126+ } catch ( e ) {
127127 logger . error ( e ) ;
128128 return null ;
129129 }
@@ -157,4 +157,4 @@ export default {
157157 OptimizelyDecideOption,
158158} ;
159159
160- export * from './export_types'
160+ export * from './export_types' ;
0 commit comments