Skip to content

Commit 8e906b7

Browse files
authored
Added Optimizely Config in Typescript (#390)
* Added Optimizely Config in Typescript
1 parent 6fd2901 commit 8e906b7

File tree

1 file changed

+63
-2
lines changed

1 file changed

+63
-2
lines changed

packages/optimizely-sdk/lib/index.d.ts

+63-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2018-2019, Optimizely
2+
* Copyright 2018-2020, 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.
@@ -111,10 +111,11 @@ declare module "@optimizely/optimizely-sdk" {
111111
userId: string,
112112
attributes?: UserAttributes
113113
): string | null;
114+
getOptimizelyConfig(): OptimizelyConfig | null;
114115
onReady(options?: {
115116
timeout?: number;
116117
}): Promise<{ success: boolean; reason?: string }>;
117-
close(): void;
118+
close(): void;
118119
}
119120

120121
// An event to be submitted to Optimizely, enabling tracking the reach and impact of
@@ -214,6 +215,66 @@ declare module "@optimizely/optimizely-sdk" {
214215
};
215216
};
216217
}
218+
219+
/**
220+
* Optimizely Config Entities
221+
*/
222+
export interface OptimizelyVariable {
223+
id: string;
224+
key: string;
225+
type: string;
226+
value: string;
227+
}
228+
229+
export interface OptimizelyVariation {
230+
id: string;
231+
key: string;
232+
featureEnabled?: boolean;
233+
variablesMap: {
234+
[variableKey: string]: {
235+
variable: OptimizelyVariable;
236+
};
237+
};
238+
}
239+
240+
export interface OptimizelyExperiment {
241+
id: string;
242+
key: string;
243+
variationsMap: {
244+
[variationKey: string]: {
245+
variation: OptimizelyVariation;
246+
};
247+
};
248+
}
249+
250+
export interface OptimizelyFeature {
251+
id: string;
252+
key: string;
253+
experimentsMap: {
254+
[experimentKey: string]: {
255+
experiment: OptimizelyExperiment;
256+
};
257+
};
258+
variablesMap: {
259+
[variableKey: string]: {
260+
variable: OptimizelyVariable;
261+
};
262+
};
263+
}
264+
265+
export interface OptimizelyConfig {
266+
experimentsMap: {
267+
[experimentKey: string]: {
268+
experiment: OptimizelyExperiment;
269+
};
270+
};
271+
featuresMap: {
272+
[featureKey: string]: {
273+
feature: OptimizelyFeature;
274+
};
275+
};
276+
revision: string;
277+
}
217278
}
218279

219280
declare module "@optimizely/optimizely-sdk/lib/utils/enums" {

0 commit comments

Comments
 (0)