@@ -55,56 +55,81 @@ declare module '@optimizely/optimizely-sdk' {
55
55
// TODO[OASIS-6649]: Don't use object type
56
56
// eslint-disable-next-line @typescript-eslint/ban-types
57
57
jsonSchemaValidator ?: object ;
58
- userProfileService ?: UserProfileService | null ;
58
+ userProfileService ?: import ( './shared_types' ) . UserProfileService | null ;
59
59
eventBatchSize ?: number ;
60
60
eventFlushInterval ?: number ;
61
61
sdkKey ?: string ;
62
62
}
63
63
64
64
export interface Client {
65
65
notificationCenter : NotificationCenter ;
66
- activate ( experimentKey : string , userId : string , attributes ?: UserAttributes ) : string | null ;
67
- track ( eventKey : string , userId : string , attributes ?: UserAttributes , eventTags ?: EventTags ) : void ;
68
- getVariation ( experimentKey : string , userId : string , attributes ?: UserAttributes ) : string | null ;
66
+ activate (
67
+ experimentKey : string ,
68
+ userId : string ,
69
+ attributes ?: import ( './shared_types' ) . UserAttributes
70
+ ) : string | null ;
71
+ track (
72
+ eventKey : string ,
73
+ userId : string ,
74
+ attributes ?: import ( './shared_types' ) . UserAttributes ,
75
+ eventTags ?: EventTags
76
+ ) : void ;
77
+ getVariation (
78
+ experimentKey : string ,
79
+ userId : string ,
80
+ attributes ?: import ( './shared_types' ) . UserAttributes
81
+ ) : string | null ;
69
82
setForcedVariation ( experimentKey : string , userId : string , variationKey : string | null ) : boolean ;
70
83
getForcedVariation ( experimentKey : string , userId : string ) : string | null ;
71
- isFeatureEnabled ( featureKey : string , userId : string , attributes ?: UserAttributes ) : boolean ;
72
- getEnabledFeatures ( userId : string , attributes ?: UserAttributes ) : string [ ] ;
73
- getFeatureVariable ( featureKey : string , variableKey : string , userId : string , attributes ?: UserAttributes ) : unknown
84
+ isFeatureEnabled (
85
+ featureKey : string ,
86
+ userId : string ,
87
+ attributes ?: import ( './shared_types' ) . UserAttributes
88
+ ) : boolean ;
89
+ getEnabledFeatures (
90
+ userId : string ,
91
+ attributes ?: import ( './shared_types' ) . UserAttributes
92
+ ) : string [ ] ;
93
+ getFeatureVariable (
94
+ featureKey : string ,
95
+ variableKey : string ,
96
+ userId : string ,
97
+ attributes ?: import ( './shared_types' ) . UserAttributes
98
+ ) : unknown ;
74
99
getFeatureVariableBoolean (
75
100
featureKey : string ,
76
101
variableKey : string ,
77
102
userId : string ,
78
- attributes ?: UserAttributes
103
+ attributes ?: import ( './shared_types' ) . UserAttributes
79
104
) : boolean | null ;
80
105
getFeatureVariableDouble (
81
106
featureKey : string ,
82
107
variableKey : string ,
83
108
userId : string ,
84
- attributes ?: UserAttributes
109
+ attributes ?: import ( './shared_types' ) . UserAttributes
85
110
) : number | null ;
86
111
getFeatureVariableInteger (
87
112
featureKey : string ,
88
113
variableKey : string ,
89
114
userId : string ,
90
- attributes ?: UserAttributes
115
+ attributes ?: import ( './shared_types' ) . UserAttributes
91
116
) : number | null ;
92
117
getFeatureVariableString (
93
118
featureKey : string ,
94
119
variableKey : string ,
95
120
userId : string ,
96
- attributes ?: UserAttributes
121
+ attributes ?: import ( './shared_types' ) . UserAttributes
97
122
) : string | null ;
98
123
getFeatureVariableJSON (
99
124
featureKey : string ,
100
125
variableKey : string ,
101
126
userId : string ,
102
- attributes ?: UserAttributes
127
+ attributes ?: import ( './shared_types' ) . UserAttributes
103
128
) : unknown ;
104
129
getAllFeatureVariables (
105
130
featureKey : string ,
106
131
userId : string ,
107
- attributes ?: UserAttributes
132
+ attributes ?: import ( './shared_types' ) . UserAttributes
108
133
) : { [ variableKey : string ] : unknown } ;
109
134
getOptimizelyConfig ( ) : OptimizelyConfig | null ;
110
135
onReady ( options ?: { timeout ?: number } ) : Promise < { success : boolean ; reason ?: string } > ;
@@ -135,11 +160,6 @@ declare module '@optimizely/optimizely-sdk' {
135
160
dispatchEvent : ( event : Event , callback : ( ) => void ) => void ;
136
161
}
137
162
138
- export interface UserProfileService {
139
- lookup : ( userId : string ) => UserProfile ;
140
- save : ( profile : UserProfile ) => void ;
141
- }
142
-
143
163
// NotificationCenter-related types
144
164
export interface NotificationCenter {
145
165
addNotificationListener < T extends ListenerPayload > (
@@ -155,21 +175,15 @@ declare module '@optimizely/optimizely-sdk' {
155
175
156
176
export interface ListenerPayload {
157
177
userId : string ;
158
- attributes : UserAttributes ;
178
+ attributes : import ( './shared_types' ) . UserAttributes ;
159
179
}
160
180
161
181
export interface ActivateListenerPayload extends ListenerPayload {
162
- experiment : Experiment ;
163
- variation : Variation ;
182
+ experiment : import ( './shared_types' ) . Experiment ;
183
+ variation : import ( './shared_types' ) . Variation ;
164
184
logEvent : Event ;
165
185
}
166
186
167
- export type UserAttributes = {
168
- // TODO[OASIS-6649]: Don't use any type
169
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
170
- [ name : string ] : any ;
171
- } ;
172
-
173
187
export type EventTags = {
174
188
[ key : string ] : string | number | boolean ;
175
189
} ;
@@ -180,37 +194,6 @@ declare module '@optimizely/optimizely-sdk' {
180
194
logEvent : Event ;
181
195
}
182
196
183
- interface Experiment {
184
- id : string ;
185
- key : string ;
186
- status : string ;
187
- layerId : string ;
188
- variations : Variation [ ] ;
189
- trafficAllocation : Array < {
190
- entityId : string ;
191
- endOfRange : number ;
192
- } > ;
193
- audienceIds : string [ ] ;
194
- // TODO[OASIS-6649]: Don't use object type
195
- // eslint-disable-next-line @typescript-eslint/ban-types
196
- forcedVariations : object ;
197
- }
198
-
199
- interface Variation {
200
- id : string ;
201
- key : string ;
202
- }
203
-
204
- // Information about past bucketing decisions for a user.
205
- export interface UserProfile {
206
- user_id : string ;
207
- experiment_bucket_map : {
208
- [ experiment_id : string ] : {
209
- variation_id : string ;
210
- } ;
211
- } ;
212
- }
213
-
214
197
/**
215
198
* Optimizely Config Entities
216
199
*/
0 commit comments