Skip to content

Commit 9c6daef

Browse files
chore(build): Generate latest bundle [skip ci]
1 parent e9fd3d4 commit 9c6daef

2 files changed

Lines changed: 62 additions & 20 deletions

File tree

dist/Rokt-Kit.common.js

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@ var moduleId = 181;
2222

2323
var constructor = function () {
2424
var self = this;
25-
var EMAIL_SHA256_IDENTITY = 'emailsha256';
26-
var OTHER_IDENTITY = 'other';
2725
var PerformanceMarks = {
2826
RoktScriptAppended: 'mp:RoktScriptAppended',
2927
};
3028

29+
var EMAIL_SHA256_KEY = 'emailsha256';
30+
var EMAIL_KEY = 'email';
31+
32+
// Dynamic identity type for Rokt's emailsha256 identity value which MP doesn't natively support - will be set during initialization
33+
var mappedEmailSha256Key;
34+
3135
self.name = name;
3236
self.moduleId = moduleId;
3337
self.isInitialized = false;
@@ -93,6 +97,13 @@ var constructor = function () {
9397
placementEventMapping
9498
);
9599

100+
// Set dynamic OTHER_IDENTITY based on server settings
101+
// Convert to lowercase since server sends TitleCase (e.g., 'Other' -> 'other')
102+
if (settings.hashedEmailUserIdentityType) {
103+
mappedEmailSha256Key =
104+
settings.hashedEmailUserIdentityType.toLowerCase();
105+
}
106+
96107
var domain = window.mParticle.Rokt.domain;
97108
var launcherOptions = mergeObjects(
98109
{},
@@ -161,7 +172,7 @@ var constructor = function () {
161172

162173
var userIdentities = filteredUser.getUserIdentities().userIdentities;
163174

164-
return replaceOtherWithEmailsha256(userIdentities);
175+
return replaceOtherIdentityWithEmailsha256(userIdentities);
165176
}
166177

167178
function returnLocalSessionAttributes() {
@@ -176,11 +187,21 @@ var constructor = function () {
176187
return window.mParticle.Rokt.getLocalSessionAttributes();
177188
}
178189

179-
function replaceOtherWithEmailsha256(_data) {
190+
function replaceOtherIdentityWithEmailsha256(userIdentities) {
191+
var newUserIdentities = mergeObjects({}, userIdentities || {});
192+
if (userIdentities.hasOwnProperty(mappedEmailSha256Key)) {
193+
newUserIdentities[EMAIL_SHA256_KEY] =
194+
userIdentities[mappedEmailSha256Key];
195+
delete newUserIdentities[mappedEmailSha256Key];
196+
}
197+
198+
return newUserIdentities;
199+
}
200+
201+
function sanitizeEmailIdentities(_data) {
180202
var data = mergeObjects({}, _data || {});
181-
if (_data.hasOwnProperty(OTHER_IDENTITY)) {
182-
data[EMAIL_SHA256_IDENTITY] = _data[OTHER_IDENTITY];
183-
delete data[OTHER_IDENTITY];
203+
if (_data.hasOwnProperty(EMAIL_SHA256_KEY)) {
204+
delete data[EMAIL_KEY];
184205
}
185206

186207
return data;
@@ -236,7 +257,7 @@ var constructor = function () {
236257

237258
var selectPlacementsAttributes = mergeObjects(
238259
filteredUserIdentities,
239-
replaceOtherWithEmailsha256(filteredAttributes),
260+
filteredAttributes,
240261
optimizelyAttributes,
241262
localSessionAttributes,
242263
{
@@ -245,7 +266,7 @@ var constructor = function () {
245266
);
246267

247268
var selectPlacementsOptions = mergeObjects(options, {
248-
attributes: selectPlacementsAttributes,
269+
attributes: sanitizeEmailIdentities(selectPlacementsAttributes),
249270
});
250271

251272
return self.launcher.selectPlacements(selectPlacementsOptions);
@@ -467,7 +488,7 @@ var constructor = function () {
467488

468489
function generateIntegrationName(customIntegrationName) {
469490
var coreSdkVersion = window.mParticle.getVersion();
470-
var kitVersion = "1.12.0";
491+
var kitVersion = "1.13.0";
471492
var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
472493

473494
if (customIntegrationName) {

dist/Rokt-Kit.iife.js

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)