@@ -4,24 +4,25 @@ import {
4
4
AttributeType ,
5
5
BanditActions ,
6
6
BanditSubjectAttributes ,
7
+ BoundedEventQueue ,
7
8
EppoClient ,
9
+ EppoPrecomputedClient ,
10
+ Event ,
8
11
EventDispatcher ,
9
12
Flag ,
10
13
FlagConfigurationRequestParameters ,
14
+ FormatEnum ,
11
15
IAssignmentDetails ,
12
16
IAssignmentLogger ,
17
+ IBanditLogger ,
18
+ IConfigurationWire ,
13
19
IContainerExperiment ,
14
- EppoPrecomputedClient ,
15
- PrecomputedFlagsRequestParameters ,
20
+ IObfuscatedPrecomputedConfigurationResponse ,
16
21
newDefaultEventDispatcher ,
17
22
ObfuscatedFlag ,
18
- BoundedEventQueue ,
19
- validation ,
20
- Event ,
21
- IConfigurationWire ,
23
+ PrecomputedFlagsRequestParameters ,
22
24
Subject ,
23
- IBanditLogger ,
24
- IObfuscatedPrecomputedConfigurationResponse ,
25
+ validation ,
25
26
} from '@eppo/js-client-sdk-common' ;
26
27
27
28
import { assignmentCacheFactory } from './cache/assignment-cache-factory' ;
@@ -35,12 +36,12 @@ import {
35
36
import {
36
37
chromeStorageIfAvailable ,
37
38
configurationStorageFactory ,
38
- precomputedFlagsStorageFactory ,
39
39
hasChromeStorage ,
40
40
hasWindowLocalStorage ,
41
41
localStorageIfAvailable ,
42
- precomputedBanditStoreFactory ,
43
42
overrideStorageFactory ,
43
+ precomputedBanditStoreFactory ,
44
+ precomputedFlagsStorageFactory ,
44
45
} from './configuration-factory' ;
45
46
import BrowserNetworkStatusListener from './events/browser-network-status-listener' ;
46
47
import LocalStorageBackedNamedEventQueue from './events/local-storage-backed-named-event-queue' ;
@@ -107,7 +108,7 @@ export class EppoJSClient extends EppoClient {
107
108
// Use an empty memory-only configuration store until the `init` method is called,
108
109
// to avoid serving stale data to the user.
109
110
/**
110
- * @deprecated . use `getInstance()` instead.
111
+ * @deprecated Use `getInstance()` instead.
111
112
*/
112
113
public static instance = new EppoJSClient ( {
113
114
flagConfigurationStore,
@@ -325,6 +326,14 @@ export class EppoJSClient extends EppoClient {
325
326
storageKeySuffix,
326
327
} ,
327
328
) ;
329
+
330
+ // Client-side config should be obfuscated by default.
331
+ // This has the effect of casting any entries stored in the persistent store as obfuscated.
332
+ // We do this because we don't store any metadata in the persistent store and can make the assumption that entries
333
+ // in the persistent store are obfuscated since the reason behind obfuscation is to obfuscate any data stored on a
334
+ // user device.
335
+ this . setIsObfuscated ( true ) ; // Use deprecated method to silence warning logs.
336
+ configurationStore . setFormat ( FormatEnum . CLIENT ) ;
328
337
this . setFlagConfigurationStore ( configurationStore ) ;
329
338
330
339
if ( enableOverrides ) {
@@ -478,8 +487,8 @@ export class EppoJSClient extends EppoClient {
478
487
initializationError = initFromFetchError
479
488
? initFromFetchError
480
489
: initFromConfigStoreError
481
- ? initFromConfigStoreError
482
- : new Error ( 'Eppo SDK: No configuration source produced a valid configuration' ) ;
490
+ ? initFromConfigStoreError
491
+ : new Error ( 'Eppo SDK: No configuration source produced a valid configuration' ) ;
483
492
}
484
493
applicationLogger . debug ( 'Initialization source' , initializationSource ) ;
485
494
} catch ( error : unknown ) {
@@ -514,6 +523,7 @@ export class EppoJSClient extends EppoClient {
514
523
const memoryOnlyConfigurationStore = configurationStorageFactory ( {
515
524
forceMemoryOnly : true ,
516
525
} ) ;
526
+ memoryOnlyConfigurationStore . setFormat ( isObfuscated ? FormatEnum . CLIENT : FormatEnum . SERVER ) ;
517
527
memoryOnlyConfigurationStore
518
528
. setEntries ( config . flagsConfiguration )
519
529
. catch ( ( err ) =>
0 commit comments