@@ -21,12 +21,16 @@ var RoktKit = (function (exports) {
2121
2222 var constructor = function ( ) {
2323 var self = this ;
24- var EMAIL_SHA256_IDENTITY = 'emailsha256' ;
25- var OTHER_IDENTITY = 'other' ;
2624 var PerformanceMarks = {
2725 RoktScriptAppended : 'mp:RoktScriptAppended' ,
2826 } ;
2927
28+ var EMAIL_SHA256_KEY = 'emailsha256' ;
29+ var EMAIL_KEY = 'email' ;
30+
31+ // Dynamic identity type for Rokt's emailsha256 identity value which MP doesn't natively support - will be set during initialization
32+ var mappedEmailSha256Key ;
33+
3034 self . name = name ;
3135 self . moduleId = moduleId ;
3236 self . isInitialized = false ;
@@ -92,6 +96,13 @@ var RoktKit = (function (exports) {
9296 placementEventMapping
9397 ) ;
9498
99+ // Set dynamic OTHER_IDENTITY based on server settings
100+ // Convert to lowercase since server sends TitleCase (e.g., 'Other' -> 'other')
101+ if ( settings . hashedEmailUserIdentityType ) {
102+ mappedEmailSha256Key =
103+ settings . hashedEmailUserIdentityType . toLowerCase ( ) ;
104+ }
105+
95106 var domain = window . mParticle . Rokt . domain ;
96107 var launcherOptions = mergeObjects (
97108 { } ,
@@ -160,7 +171,7 @@ var RoktKit = (function (exports) {
160171
161172 var userIdentities = filteredUser . getUserIdentities ( ) . userIdentities ;
162173
163- return replaceOtherWithEmailsha256 ( userIdentities ) ;
174+ return replaceOtherIdentityWithEmailsha256 ( userIdentities ) ;
164175 }
165176
166177 function returnLocalSessionAttributes ( ) {
@@ -175,11 +186,21 @@ var RoktKit = (function (exports) {
175186 return window . mParticle . Rokt . getLocalSessionAttributes ( ) ;
176187 }
177188
178- function replaceOtherWithEmailsha256 ( _data ) {
189+ function replaceOtherIdentityWithEmailsha256 ( userIdentities ) {
190+ var newUserIdentities = mergeObjects ( { } , userIdentities || { } ) ;
191+ if ( userIdentities . hasOwnProperty ( mappedEmailSha256Key ) ) {
192+ newUserIdentities [ EMAIL_SHA256_KEY ] =
193+ userIdentities [ mappedEmailSha256Key ] ;
194+ delete newUserIdentities [ mappedEmailSha256Key ] ;
195+ }
196+
197+ return newUserIdentities ;
198+ }
199+
200+ function sanitizeEmailIdentities ( _data ) {
179201 var data = mergeObjects ( { } , _data || { } ) ;
180- if ( _data . hasOwnProperty ( OTHER_IDENTITY ) ) {
181- data [ EMAIL_SHA256_IDENTITY ] = _data [ OTHER_IDENTITY ] ;
182- delete data [ OTHER_IDENTITY ] ;
202+ if ( _data . hasOwnProperty ( EMAIL_SHA256_KEY ) ) {
203+ delete data [ EMAIL_KEY ] ;
183204 }
184205
185206 return data ;
@@ -235,7 +256,7 @@ var RoktKit = (function (exports) {
235256
236257 var selectPlacementsAttributes = mergeObjects (
237258 filteredUserIdentities ,
238- replaceOtherWithEmailsha256 ( filteredAttributes ) ,
259+ filteredAttributes ,
239260 optimizelyAttributes ,
240261 localSessionAttributes ,
241262 {
@@ -244,7 +265,7 @@ var RoktKit = (function (exports) {
244265 ) ;
245266
246267 var selectPlacementsOptions = mergeObjects ( options , {
247- attributes : selectPlacementsAttributes ,
268+ attributes : sanitizeEmailIdentities ( selectPlacementsAttributes ) ,
248269 } ) ;
249270
250271 return self . launcher . selectPlacements ( selectPlacementsOptions ) ;
@@ -466,7 +487,7 @@ var RoktKit = (function (exports) {
466487
467488 function generateIntegrationName ( customIntegrationName ) {
468489 var coreSdkVersion = window . mParticle . getVersion ( ) ;
469- var kitVersion = "1.12 .0" ;
490+ var kitVersion = "1.13 .0" ;
470491 var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion ;
471492
472493 if ( customIntegrationName ) {
0 commit comments