@@ -468,18 +468,14 @@ function isSelectPlacementsAttributePersistenceDenied(key: string): boolean {
468468function removeSelectPlacementsAttributePersistenceDeniedAttributes (
469469 attributes : Record < string , unknown > | null | undefined ,
470470) : Record < string , unknown > {
471- const filteredAttributes : Record < string , unknown > = { } ;
472471 const sourceAttributes = attributes || { } ;
473- const attributeKeys = Object . keys ( sourceAttributes ) ;
474472
475- for ( let i = 0 ; i < attributeKeys . length ; i ++ ) {
476- const key = attributeKeys [ i ] ;
473+ return Object . keys ( sourceAttributes ) . reduce ( ( filteredAttributes : Record < string , unknown > , key ) => {
477474 if ( ! isSelectPlacementsAttributePersistenceDenied ( key ) ) {
478475 filteredAttributes [ key ] = sourceAttributes [ key ] ;
479476 }
480- }
481-
482- return filteredAttributes ;
477+ return filteredAttributes ;
478+ } , { } ) ;
483479}
484480
485481function generateIntegrationName ( customIntegrationName ?: string ) : string {
@@ -1272,12 +1268,9 @@ class RoktKit implements KitInterface {
12721268 }
12731269
12741270 public setUserAttribute ( key : string , value : unknown ) : string {
1275- if ( isSelectPlacementsAttributePersistenceDenied ( key ) ) {
1276- this . userAttributes = removeSelectPlacementsAttributePersistenceDeniedAttributes ( this . userAttributes ) ;
1277- return 'Successfully set user attribute for forwarder: ' + name ;
1271+ if ( ! isSelectPlacementsAttributePersistenceDenied ( key ) ) {
1272+ this . userAttributes [ key ] = value ;
12781273 }
1279-
1280- this . userAttributes [ key ] = value ;
12811274 return 'Successfully set user attribute for forwarder: ' + name ;
12821275 }
12831276
0 commit comments