@@ -55,56 +55,81 @@ declare module '@optimizely/optimizely-sdk' {
5555 // TODO[OASIS-6649]: Don't use object type
5656 // eslint-disable-next-line @typescript-eslint/ban-types
5757 jsonSchemaValidator ?: object ;
58- userProfileService ?: UserProfileService | null ;
58+ userProfileService ?: import ( './shared_types' ) . UserProfileService | null ;
5959 eventBatchSize ?: number ;
6060 eventFlushInterval ?: number ;
6161 sdkKey ?: string ;
6262 }
6363
6464 export interface Client {
6565 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 ;
6982 setForcedVariation ( experimentKey : string , userId : string , variationKey : string | null ) : boolean ;
7083 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 ;
7499 getFeatureVariableBoolean (
75100 featureKey : string ,
76101 variableKey : string ,
77102 userId : string ,
78- attributes ?: UserAttributes
103+ attributes ?: import ( './shared_types' ) . UserAttributes
79104 ) : boolean | null ;
80105 getFeatureVariableDouble (
81106 featureKey : string ,
82107 variableKey : string ,
83108 userId : string ,
84- attributes ?: UserAttributes
109+ attributes ?: import ( './shared_types' ) . UserAttributes
85110 ) : number | null ;
86111 getFeatureVariableInteger (
87112 featureKey : string ,
88113 variableKey : string ,
89114 userId : string ,
90- attributes ?: UserAttributes
115+ attributes ?: import ( './shared_types' ) . UserAttributes
91116 ) : number | null ;
92117 getFeatureVariableString (
93118 featureKey : string ,
94119 variableKey : string ,
95120 userId : string ,
96- attributes ?: UserAttributes
121+ attributes ?: import ( './shared_types' ) . UserAttributes
97122 ) : string | null ;
98123 getFeatureVariableJSON (
99124 featureKey : string ,
100125 variableKey : string ,
101126 userId : string ,
102- attributes ?: UserAttributes
127+ attributes ?: import ( './shared_types' ) . UserAttributes
103128 ) : unknown ;
104129 getAllFeatureVariables (
105130 featureKey : string ,
106131 userId : string ,
107- attributes ?: UserAttributes
132+ attributes ?: import ( './shared_types' ) . UserAttributes
108133 ) : { [ variableKey : string ] : unknown } ;
109134 getOptimizelyConfig ( ) : OptimizelyConfig | null ;
110135 onReady ( options ?: { timeout ?: number } ) : Promise < { success : boolean ; reason ?: string } > ;
@@ -135,11 +160,6 @@ declare module '@optimizely/optimizely-sdk' {
135160 dispatchEvent : ( event : Event , callback : ( ) => void ) => void ;
136161 }
137162
138- export interface UserProfileService {
139- lookup : ( userId : string ) => UserProfile ;
140- save : ( profile : UserProfile ) => void ;
141- }
142-
143163 // NotificationCenter-related types
144164 export interface NotificationCenter {
145165 addNotificationListener < T extends ListenerPayload > (
@@ -155,21 +175,15 @@ declare module '@optimizely/optimizely-sdk' {
155175
156176 export interface ListenerPayload {
157177 userId : string ;
158- attributes : UserAttributes ;
178+ attributes : import ( './shared_types' ) . UserAttributes ;
159179 }
160180
161181 export interface ActivateListenerPayload extends ListenerPayload {
162- experiment : Experiment ;
163- variation : Variation ;
182+ experiment : import ( './shared_types' ) . Experiment ;
183+ variation : import ( './shared_types' ) . Variation ;
164184 logEvent : Event ;
165185 }
166186
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-
173187 export type EventTags = {
174188 [ key : string ] : string | number | boolean ;
175189 } ;
@@ -180,37 +194,6 @@ declare module '@optimizely/optimizely-sdk' {
180194 logEvent : Event ;
181195 }
182196
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-
214197 /**
215198 * Optimizely Config Entities
216199 */
0 commit comments