15
15
***************************************************************************/
16
16
import { sprintf , objectValues } from '@optimizely/js-sdk-utils' ;
17
17
import { LogHandler , ErrorHandler } from '@optimizely/js-sdk-logging' ;
18
- // import {EventDispatcher} from '@optimizely/js-sdk-event-processor';
19
18
import { FeatureFlag , FeatureVariable } from '../core/project_config/entities' ;
20
19
import {
21
20
UserAttributes ,
22
21
EventTags ,
23
22
OptimizelyConfig ,
24
23
UserProfileService ,
25
24
DatafileOptions ,
26
- EventDispatcher
25
+ EventDispatcher ,
26
+ OnReadyResult
27
27
} from '../shared_types' ;
28
28
import { Variation } from '../core/project_config/entities' ;
29
29
import { createProjectConfigManager , ProjectConfigManager } from '../core/project_config/project_config_manager' ;
@@ -540,8 +540,7 @@ export default class Optimizely {
540
540
*/
541
541
private validateInputs (
542
542
// TODO: Make feature_key, user_id, variable_key, experiment_key camelCase
543
- // stringInputs: Record<'feature_key' | 'user_id' | 'variable_key' | 'experiment_key', unknown>,
544
- stringInputs : unknown ,
543
+ stringInputs : Partial < Record < 'feature_key' | 'user_id' | 'variable_key' | 'experiment_key' | 'event_key' , unknown > > ,
545
544
userAttributes ?: unknown ,
546
545
eventTags ?: unknown
547
546
) : boolean {
@@ -1341,9 +1340,9 @@ export default class Optimizely {
1341
1340
timeoutValue = DEFAULT_ONREADY_TIMEOUT ;
1342
1341
}
1343
1342
1344
- let resolveTimeoutPromise : ( value ?: { success : boolean ; reason ?: string | undefined ; } ) => void ;
1345
- const timeoutPromise = new Promise (
1346
- function ( resolve : ( value ?: { success : boolean ; reason ?: string | undefined ; } ) => void ) {
1343
+ let resolveTimeoutPromise : ( value : OnReadyResult ) => void ;
1344
+ const timeoutPromise = new Promise < OnReadyResult > (
1345
+ ( resolve ) => {
1347
1346
resolveTimeoutPromise = resolve ;
1348
1347
}
1349
1348
) ;
@@ -1357,7 +1356,7 @@ export default class Optimizely {
1357
1356
success : false ,
1358
1357
reason : sprintf ( 'onReady timeout expired after %s ms' , timeoutValue ) ,
1359
1358
} ) ;
1360
- } ) . bind ( this ) ;
1359
+ } ) ;
1361
1360
const readyTimeout = setTimeout ( onReadyTimeout , timeoutValue ) ;
1362
1361
const onClose = function ( ) {
1363
1362
resolveTimeoutPromise ( {
0 commit comments