@@ -56,8 +56,7 @@ type Config = {
56
56
fetch ?: LikeFetch ,
57
57
AsyncStorage ?: AsyncStorageType ,
58
58
eventSource ?: any ,
59
- appName ?: IInitConfig [ 'appName' ] ,
60
- appVersion ?: IInitConfig [ 'appVersion' ]
59
+ applicationMetadata ?: IInitConfig [ 'applicationMetadata' ] ,
61
60
} ;
62
61
63
62
const FLAGSMITH_CONFIG_ANALYTICS_KEY = "flagsmith_value_" ;
@@ -70,8 +69,7 @@ const Flagsmith = class {
70
69
timestamp : number | null = null
71
70
isLoading = false
72
71
eventSource :EventSource | null = null
73
- appName : IInitConfig [ 'appName' ] ;
74
- appVersion : IInitConfig [ 'appVersion' ] ;
72
+ applicationMetadata : IInitConfig [ 'applicationMetadata' ] ;
75
73
constructor ( props : Config ) {
76
74
if ( props . fetch ) {
77
75
_fetch = props . fetch as LikeFetch ;
@@ -80,8 +78,7 @@ const Flagsmith = class {
80
78
}
81
79
82
80
this . canUseStorage = typeof window !== 'undefined' || ! ! props . browserlessStorage ;
83
- this . appName = props . appName ;
84
- this . appVersion = props . appVersion ;
81
+ this . applicationMetadata = props . applicationMetadata ;
85
82
86
83
this . log ( "Constructing flagsmith instance " + props )
87
84
if ( props . eventSource ) {
@@ -316,8 +313,7 @@ const Flagsmith = class {
316
313
angularHttpClient,
317
314
_trigger,
318
315
_triggerLoadingState,
319
- appName,
320
- appVersion,
316
+ applicationMetadata,
321
317
} = config ;
322
318
evaluationContext . environment = environmentID ? { apiKey : environmentID } : evaluationContext . environment ;
323
319
if ( ! evaluationContext . environment || ! evaluationContext . environment . apiKey ) {
@@ -364,8 +360,7 @@ const Flagsmith = class {
364
360
this . ticks = 10000 ;
365
361
this . timer = this . enableLogs ? new Date ( ) . valueOf ( ) : null ;
366
362
this . cacheFlags = typeof AsyncStorage !== 'undefined' && ! ! cacheFlags ;
367
- this . appName = appName ;
368
- this . appVersion = appVersion ;
363
+ this . applicationMetadata = applicationMetadata ;
369
364
370
365
FlagsmithEvent = DEFAULT_FLAGSMITH_EVENT + "_" + evaluationContext . environment . apiKey ;
371
366
@@ -804,12 +799,12 @@ const Flagsmith = class {
804
799
options . headers [ 'Content-Type' ] = 'application/json; charset=utf-8' ;
805
800
806
801
807
- if ( this . appName ) {
808
- options . headers [ 'X-Customer- Application-Name' ] = this . appName ;
802
+ if ( this . applicationMetadata ?. name ) {
803
+ options . headers [ 'Flagsmith- Application-Name' ] = this . applicationMetadata . name ;
809
804
}
810
805
811
- if ( this . appVersion ) {
812
- options . headers [ 'X-Customer- Application-Version' ] = this . appVersion ;
806
+ if ( this . applicationMetadata ?. version ) {
807
+ options . headers [ 'Flagsmith- Application-Version' ] = this . applicationMetadata . version ;
813
808
}
814
809
815
810
if ( headers ) {
0 commit comments