@@ -135,7 +135,7 @@ export {
135
135
export { ChromeStorageEngine } from './chrome-storage-engine' ;
136
136
137
137
// Instantiate the configuration store with memory-only implementation.
138
- const configurationStore = configurationStorageFactory ( {
138
+ const flagConfigurationStore = configurationStorageFactory ( {
139
139
forceMemoryOnly : true ,
140
140
} ) ;
141
141
@@ -147,7 +147,13 @@ export class EppoJSClient extends EppoClient {
147
147
// Ensure that the client is instantiated during class loading.
148
148
// Use an empty memory-only configuration store until the `init` method is called,
149
149
// to avoid serving stale data to the user.
150
- public static instance : EppoJSClient = new EppoJSClient ( configurationStore , undefined , true ) ;
150
+ public static instance : EppoJSClient = new EppoJSClient (
151
+ flagConfigurationStore ,
152
+ undefined ,
153
+ undefined ,
154
+ undefined ,
155
+ true ,
156
+ ) ;
151
157
public static initialized = false ;
152
158
153
159
public getStringAssignment (
@@ -244,16 +250,20 @@ export function offlineInit(config: IClientConfigSync): IEppoClient {
244
250
const memoryOnlyConfigurationStore = configurationStorageFactory ( {
245
251
forceMemoryOnly : true ,
246
252
} ) ;
247
- memoryOnlyConfigurationStore . setEntries ( config . flagsConfiguration ) ;
248
- EppoJSClient . instance . setConfigurationStore ( memoryOnlyConfigurationStore ) ;
253
+ memoryOnlyConfigurationStore
254
+ . setEntries ( config . flagsConfiguration )
255
+ . catch ( ( err ) =>
256
+ applicationLogger . warn ( 'Error setting flags for memory-only configuration store' , err ) ,
257
+ ) ;
258
+ EppoJSClient . instance . setFlagConfigurationStore ( memoryOnlyConfigurationStore ) ;
249
259
250
260
// Allow the caller to override the default obfuscated mode, which is false
251
261
// since the purpose of this method is to bootstrap the SDK from an external source,
252
262
// which is likely a server that has not-obfuscated flag values.
253
263
EppoJSClient . instance . setIsObfuscated ( isObfuscated ) ;
254
264
255
265
if ( config . assignmentLogger ) {
256
- EppoJSClient . instance . setLogger ( config . assignmentLogger ) ;
266
+ EppoJSClient . instance . setAssignmentLogger ( config . assignmentLogger ) ;
257
267
}
258
268
259
269
// There is no SDK key in the offline context.
@@ -262,7 +272,7 @@ export function offlineInit(config: IClientConfigSync): IEppoClient {
262
272
// As this is a synchronous initialization,
263
273
// we are unable to call the async `init` method on the assignment cache
264
274
// which loads the assignment cache from the browser's storage.
265
- // Therefore there is no purpose trying to use a persistent assignment cache.
275
+ // Therefore, there is no purpose trying to use a persistent assignment cache.
266
276
const assignmentCache = assignmentCacheFactory ( {
267
277
storageKeySuffix,
268
278
forceMemoryOnly : true ,
@@ -296,7 +306,7 @@ export async function init(config: IClientConfig): Promise<IEppoClient> {
296
306
// If any existing instances; ensure they are not polling
297
307
instance . stopPolling ( ) ;
298
308
// Set up assignment logger and cache
299
- instance . setLogger ( config . assignmentLogger ) ;
309
+ instance . setAssignmentLogger ( config . assignmentLogger ) ;
300
310
// Default to obfuscated mode when requesting configuration from the server.
301
311
instance . setIsObfuscated ( true ) ;
302
312
@@ -318,7 +328,7 @@ export async function init(config: IClientConfig): Promise<IEppoClient> {
318
328
storageKeySuffix,
319
329
} ,
320
330
) ;
321
- instance . setConfigurationStore ( configurationStore ) ;
331
+ instance . setFlagConfigurationStore ( configurationStore ) ;
322
332
323
333
// instantiate and init assignment cache
324
334
const assignmentCache = assignmentCacheFactory ( {
0 commit comments