File tree Expand file tree Collapse file tree 2 files changed +37
-4
lines changed
packages/remote-config/src Expand file tree Collapse file tree 2 files changed +37
-4
lines changed Original file line number Diff line number Diff line change 18
18
import {
19
19
CustomSignals ,
20
20
FetchResponse ,
21
- FirebaseRemoteConfigObject
21
+ FirebaseRemoteConfigObject ,
22
+ FirebaseExperimentDescription
22
23
} from '../public_types' ;
23
24
import {
24
25
RemoteConfigFetchClient ,
@@ -140,6 +141,7 @@ export class RestClient implements RemoteConfigFetchClient {
140
141
141
142
let config : FirebaseRemoteConfigObject | undefined ;
142
143
let state : string | undefined ;
144
+ let experiments : FirebaseExperimentDescription [ ] | undefined ;
143
145
144
146
// JSON parsing throws SyntaxError if the response body isn't a JSON string.
145
147
// Requesting application/json and checking for a 200 ensures there's JSON data.
@@ -154,6 +156,7 @@ export class RestClient implements RemoteConfigFetchClient {
154
156
}
155
157
config = responseBody [ 'entries' ] ;
156
158
state = responseBody [ 'state' ] ;
159
+ experiments = responseBody [ 'experimentDescriptions' ] ;
157
160
}
158
161
159
162
// Normalizes based on legacy state.
@@ -176,6 +179,6 @@ export class RestClient implements RemoteConfigFetchClient {
176
179
} ) ;
177
180
}
178
181
179
- return { status, eTag : responseEtag , config } ;
182
+ return { status, eTag : responseEtag , config, experiments } ;
180
183
}
181
184
}
Original file line number Diff line number Diff line change @@ -57,6 +57,32 @@ export interface FirebaseRemoteConfigObject {
57
57
[ key : string ] : string ;
58
58
}
59
59
60
+ /**
61
+ * Defines experiment and variant attached to a config parameter.
62
+ */
63
+ export interface FirebaseExperimentDescription {
64
+ // A string of max length 22 characters and of format: _exp_<experiment_id>
65
+ experimentId : string ;
66
+
67
+ // The variant of the experiment assigned to the app instance.
68
+ variantId : string ;
69
+
70
+ // When the experiment was started.
71
+ experimentStartTime : string ;
72
+
73
+ // How long the experiment can remain in STANDBY state. Valid range from 1 ms
74
+ // to 6 months.
75
+ triggerTimeoutMillis : string ;
76
+
77
+ // How long the experiment can remain in ON state. Valid range from 1 ms to 6
78
+ // months.
79
+ timeToLiveMillis : string ;
80
+
81
+ // A repeated of Remote Config parameter keys that this experiment is
82
+ // affecting the value of.
83
+ affectedParameterKeys ?: string [ ] ;
84
+ }
85
+
60
86
/**
61
87
* Defines a successful response (200 or 304).
62
88
*
@@ -90,8 +116,12 @@ export interface FetchResponse {
90
116
*/
91
117
config ?: FirebaseRemoteConfigObject ;
92
118
93
- // Note: we're not extracting experiment metadata until
94
- // ABT and Analytics have Web SDKs.
119
+ /**
120
+ * A/B Test and Rollout experiment metadata.
121
+ *
122
+ * <p>Only defined for 200 responses.
123
+ */
124
+ experiments ?: FirebaseExperimentDescription [ ] ;
95
125
}
96
126
97
127
/**
You can’t perform that action at this time.
0 commit comments