@mparticle/web-rokt-kit 1.10.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Rokt-Kit.common.js +46 -10
- package/dist/Rokt-Kit.iife.js +46 -10
- package/package.json +1 -1
package/dist/Rokt-Kit.common.js
CHANGED
|
@@ -22,8 +22,15 @@ var moduleId = 181;
|
|
|
22
22
|
|
|
23
23
|
var constructor = function () {
|
|
24
24
|
var self = this;
|
|
25
|
-
var
|
|
26
|
-
|
|
25
|
+
var PerformanceMarks = {
|
|
26
|
+
RoktScriptAppended: 'mp:RoktScriptAppended',
|
|
27
|
+
};
|
|
28
|
+
|
|
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;
|
|
27
34
|
|
|
28
35
|
self.name = name;
|
|
29
36
|
self.moduleId = moduleId;
|
|
@@ -90,6 +97,13 @@ var constructor = function () {
|
|
|
90
97
|
placementEventMapping
|
|
91
98
|
);
|
|
92
99
|
|
|
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
|
+
|
|
93
107
|
var domain = window.mParticle.Rokt.domain;
|
|
94
108
|
var launcherOptions = mergeObjects(
|
|
95
109
|
{},
|
|
@@ -141,6 +155,7 @@ var constructor = function () {
|
|
|
141
155
|
};
|
|
142
156
|
|
|
143
157
|
target.appendChild(script);
|
|
158
|
+
captureTiming(PerformanceMarks.RoktScriptAppended);
|
|
144
159
|
} else {
|
|
145
160
|
console.warn('Unable to find Rokt on the page');
|
|
146
161
|
}
|
|
@@ -157,7 +172,7 @@ var constructor = function () {
|
|
|
157
172
|
|
|
158
173
|
var userIdentities = filteredUser.getUserIdentities().userIdentities;
|
|
159
174
|
|
|
160
|
-
return
|
|
175
|
+
return replaceOtherIdentityWithEmailsha256(userIdentities);
|
|
161
176
|
}
|
|
162
177
|
|
|
163
178
|
function returnLocalSessionAttributes() {
|
|
@@ -172,11 +187,21 @@ var constructor = function () {
|
|
|
172
187
|
return window.mParticle.Rokt.getLocalSessionAttributes();
|
|
173
188
|
}
|
|
174
189
|
|
|
175
|
-
function
|
|
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) {
|
|
176
202
|
var data = mergeObjects({}, _data || {});
|
|
177
|
-
if (_data.hasOwnProperty(
|
|
178
|
-
data[
|
|
179
|
-
delete data[OTHER_IDENTITY];
|
|
203
|
+
if (_data.hasOwnProperty(EMAIL_SHA256_KEY)) {
|
|
204
|
+
delete data[EMAIL_KEY];
|
|
180
205
|
}
|
|
181
206
|
|
|
182
207
|
return data;
|
|
@@ -232,7 +257,7 @@ var constructor = function () {
|
|
|
232
257
|
|
|
233
258
|
var selectPlacementsAttributes = mergeObjects(
|
|
234
259
|
filteredUserIdentities,
|
|
235
|
-
|
|
260
|
+
filteredAttributes,
|
|
236
261
|
optimizelyAttributes,
|
|
237
262
|
localSessionAttributes,
|
|
238
263
|
{
|
|
@@ -241,7 +266,7 @@ var constructor = function () {
|
|
|
241
266
|
);
|
|
242
267
|
|
|
243
268
|
var selectPlacementsOptions = mergeObjects(options, {
|
|
244
|
-
attributes: selectPlacementsAttributes,
|
|
269
|
+
attributes: sanitizeEmailIdentities(selectPlacementsAttributes),
|
|
245
270
|
});
|
|
246
271
|
|
|
247
272
|
return self.launcher.selectPlacements(selectPlacementsOptions);
|
|
@@ -448,11 +473,22 @@ var constructor = function () {
|
|
|
448
473
|
var LOCAL_LAUNCHER_TEST_GROUP_THRESHOLD = 0.5;
|
|
449
474
|
return Math.random() > LOCAL_LAUNCHER_TEST_GROUP_THRESHOLD;
|
|
450
475
|
}
|
|
476
|
+
|
|
477
|
+
function captureTiming(metricName) {
|
|
478
|
+
if (
|
|
479
|
+
window &&
|
|
480
|
+
window.mParticle &&
|
|
481
|
+
window.mParticle.captureTiming &&
|
|
482
|
+
metricName
|
|
483
|
+
) {
|
|
484
|
+
window.mParticle.captureTiming(metricName);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
451
487
|
};
|
|
452
488
|
|
|
453
489
|
function generateIntegrationName(customIntegrationName) {
|
|
454
490
|
var coreSdkVersion = window.mParticle.getVersion();
|
|
455
|
-
var kitVersion = "1.
|
|
491
|
+
var kitVersion = "1.13.0";
|
|
456
492
|
var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
|
|
457
493
|
|
|
458
494
|
if (customIntegrationName) {
|
package/dist/Rokt-Kit.iife.js
CHANGED
|
@@ -21,8 +21,15 @@ var RoktKit = (function (exports) {
|
|
|
21
21
|
|
|
22
22
|
var constructor = function () {
|
|
23
23
|
var self = this;
|
|
24
|
-
var
|
|
25
|
-
|
|
24
|
+
var PerformanceMarks = {
|
|
25
|
+
RoktScriptAppended: 'mp:RoktScriptAppended',
|
|
26
|
+
};
|
|
27
|
+
|
|
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;
|
|
26
33
|
|
|
27
34
|
self.name = name;
|
|
28
35
|
self.moduleId = moduleId;
|
|
@@ -89,6 +96,13 @@ var RoktKit = (function (exports) {
|
|
|
89
96
|
placementEventMapping
|
|
90
97
|
);
|
|
91
98
|
|
|
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
|
+
|
|
92
106
|
var domain = window.mParticle.Rokt.domain;
|
|
93
107
|
var launcherOptions = mergeObjects(
|
|
94
108
|
{},
|
|
@@ -140,6 +154,7 @@ var RoktKit = (function (exports) {
|
|
|
140
154
|
};
|
|
141
155
|
|
|
142
156
|
target.appendChild(script);
|
|
157
|
+
captureTiming(PerformanceMarks.RoktScriptAppended);
|
|
143
158
|
} else {
|
|
144
159
|
console.warn('Unable to find Rokt on the page');
|
|
145
160
|
}
|
|
@@ -156,7 +171,7 @@ var RoktKit = (function (exports) {
|
|
|
156
171
|
|
|
157
172
|
var userIdentities = filteredUser.getUserIdentities().userIdentities;
|
|
158
173
|
|
|
159
|
-
return
|
|
174
|
+
return replaceOtherIdentityWithEmailsha256(userIdentities);
|
|
160
175
|
}
|
|
161
176
|
|
|
162
177
|
function returnLocalSessionAttributes() {
|
|
@@ -171,11 +186,21 @@ var RoktKit = (function (exports) {
|
|
|
171
186
|
return window.mParticle.Rokt.getLocalSessionAttributes();
|
|
172
187
|
}
|
|
173
188
|
|
|
174
|
-
function
|
|
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) {
|
|
175
201
|
var data = mergeObjects({}, _data || {});
|
|
176
|
-
if (_data.hasOwnProperty(
|
|
177
|
-
data[
|
|
178
|
-
delete data[OTHER_IDENTITY];
|
|
202
|
+
if (_data.hasOwnProperty(EMAIL_SHA256_KEY)) {
|
|
203
|
+
delete data[EMAIL_KEY];
|
|
179
204
|
}
|
|
180
205
|
|
|
181
206
|
return data;
|
|
@@ -231,7 +256,7 @@ var RoktKit = (function (exports) {
|
|
|
231
256
|
|
|
232
257
|
var selectPlacementsAttributes = mergeObjects(
|
|
233
258
|
filteredUserIdentities,
|
|
234
|
-
|
|
259
|
+
filteredAttributes,
|
|
235
260
|
optimizelyAttributes,
|
|
236
261
|
localSessionAttributes,
|
|
237
262
|
{
|
|
@@ -240,7 +265,7 @@ var RoktKit = (function (exports) {
|
|
|
240
265
|
);
|
|
241
266
|
|
|
242
267
|
var selectPlacementsOptions = mergeObjects(options, {
|
|
243
|
-
attributes: selectPlacementsAttributes,
|
|
268
|
+
attributes: sanitizeEmailIdentities(selectPlacementsAttributes),
|
|
244
269
|
});
|
|
245
270
|
|
|
246
271
|
return self.launcher.selectPlacements(selectPlacementsOptions);
|
|
@@ -447,11 +472,22 @@ var RoktKit = (function (exports) {
|
|
|
447
472
|
var LOCAL_LAUNCHER_TEST_GROUP_THRESHOLD = 0.5;
|
|
448
473
|
return Math.random() > LOCAL_LAUNCHER_TEST_GROUP_THRESHOLD;
|
|
449
474
|
}
|
|
475
|
+
|
|
476
|
+
function captureTiming(metricName) {
|
|
477
|
+
if (
|
|
478
|
+
window &&
|
|
479
|
+
window.mParticle &&
|
|
480
|
+
window.mParticle.captureTiming &&
|
|
481
|
+
metricName
|
|
482
|
+
) {
|
|
483
|
+
window.mParticle.captureTiming(metricName);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
450
486
|
};
|
|
451
487
|
|
|
452
488
|
function generateIntegrationName(customIntegrationName) {
|
|
453
489
|
var coreSdkVersion = window.mParticle.getVersion();
|
|
454
|
-
var kitVersion = "1.
|
|
490
|
+
var kitVersion = "1.13.0";
|
|
455
491
|
var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
|
|
456
492
|
|
|
457
493
|
if (customIntegrationName) {
|