@@ -25,23 +25,23 @@ import {
25
25
} from '@optimizely/js-sdk-logging' ;
26
26
27
27
import { assign } from './utils/fns' ;
28
- import { Optimizely } from '@optimizely/optimizely-sdk /optimizely' ;
28
+ import Optimizely from '. /optimizely' ;
29
29
import * as enums from './utils/enums' ;
30
30
import loggerPlugin from './plugins/logger' ;
31
31
import configValidator from './utils/config_validator' ;
32
32
import defaultErrorHandler from './plugins/error_handler' ;
33
33
import defaultEventDispatcher from './plugins/event_dispatcher/index.node' ;
34
34
import eventProcessorConfigValidator from './utils/event_processor_config_validator' ;
35
- import { ProjectConfig } from '@optimizely/optimizely-sdk/lib /core/project_config' ;
35
+ import * as projectConfig from '. /core/project_config' ;
36
36
37
37
const logger = getLogger ( ) ;
38
38
setLogLevel ( LogLevel . ERROR ) ;
39
39
40
40
const DEFAULT_EVENT_BATCH_SIZE = 10 ;
41
41
const DEFAULT_EVENT_FLUSH_INTERVAL = 30000 ; // Unit is ms, default is 30s
42
42
43
- export interface Config {
44
- datafile ?: ProjectConfig ;
43
+ interface Config {
44
+ datafile ?: projectConfig . ProjectConfig ;
45
45
errorHandler ?: ErrorHandler ;
46
46
eventDispatcher ?: ( ...args : unknown [ ] ) => unknown ;
47
47
logger ?: LogHandler ;
@@ -102,19 +102,19 @@ const createInstance = function (config: Config): Optimizely | null {
102
102
logger : logger ,
103
103
errorHandler : getErrorHandler ( ) ,
104
104
}
105
- ) ;
105
+ ) as projectConfig . ProjectConfig ;
106
106
107
107
if ( ! eventProcessorConfigValidator . validateEventBatchSize ( config . eventBatchSize ) ) {
108
108
logger . warn ( 'Invalid eventBatchSize %s, defaulting to %s' , config . eventBatchSize , DEFAULT_EVENT_BATCH_SIZE ) ;
109
- config . eventBatchSize = DEFAULT_EVENT_BATCH_SIZE ;
109
+ optimizelyConfig . eventBatchSize = DEFAULT_EVENT_BATCH_SIZE ;
110
110
}
111
111
if ( ! eventProcessorConfigValidator . validateEventFlushInterval ( config . eventFlushInterval ) ) {
112
112
logger . warn (
113
113
'Invalid eventFlushInterval %s, defaulting to %s' ,
114
114
config . eventFlushInterval ,
115
115
DEFAULT_EVENT_FLUSH_INTERVAL
116
116
) ;
117
- config . eventFlushInterval = DEFAULT_EVENT_FLUSH_INTERVAL ;
117
+ optimizelyConfig . eventFlushInterval = DEFAULT_EVENT_FLUSH_INTERVAL ;
118
118
}
119
119
120
120
return new Optimizely ( optimizelyConfig ) ;
0 commit comments