@mparticle/web-rokt-kit 1.12.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.
@@ -22,12 +22,16 @@ var moduleId = 181;
22
22
 
23
23
  var constructor = function () {
24
24
  var self = this;
25
- var EMAIL_SHA256_IDENTITY = 'emailsha256';
26
- var OTHER_IDENTITY = 'other';
27
25
  var PerformanceMarks = {
28
26
  RoktScriptAppended: 'mp:RoktScriptAppended',
29
27
  };
30
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;
34
+
31
35
  self.name = name;
32
36
  self.moduleId = moduleId;
33
37
  self.isInitialized = false;
@@ -93,6 +97,13 @@ var constructor = function () {
93
97
  placementEventMapping
94
98
  );
95
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
+
96
107
  var domain = window.mParticle.Rokt.domain;
97
108
  var launcherOptions = mergeObjects(
98
109
  {},
@@ -161,7 +172,7 @@ var constructor = function () {
161
172
 
162
173
  var userIdentities = filteredUser.getUserIdentities().userIdentities;
163
174
 
164
- return replaceOtherWithEmailsha256(userIdentities);
175
+ return replaceOtherIdentityWithEmailsha256(userIdentities);
165
176
  }
166
177
 
167
178
  function returnLocalSessionAttributes() {
@@ -176,11 +187,21 @@ var constructor = function () {
176
187
  return window.mParticle.Rokt.getLocalSessionAttributes();
177
188
  }
178
189
 
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) {
180
202
  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];
184
205
  }
185
206
 
186
207
  return data;
@@ -236,7 +257,7 @@ var constructor = function () {
236
257
 
237
258
  var selectPlacementsAttributes = mergeObjects(
238
259
  filteredUserIdentities,
239
- replaceOtherWithEmailsha256(filteredAttributes),
260
+ filteredAttributes,
240
261
  optimizelyAttributes,
241
262
  localSessionAttributes,
242
263
  {
@@ -245,7 +266,7 @@ var constructor = function () {
245
266
  );
246
267
 
247
268
  var selectPlacementsOptions = mergeObjects(options, {
248
- attributes: selectPlacementsAttributes,
269
+ attributes: sanitizeEmailIdentities(selectPlacementsAttributes),
249
270
  });
250
271
 
251
272
  return self.launcher.selectPlacements(selectPlacementsOptions);
@@ -467,7 +488,7 @@ var constructor = function () {
467
488
 
468
489
  function generateIntegrationName(customIntegrationName) {
469
490
  var coreSdkVersion = window.mParticle.getVersion();
470
- var kitVersion = "1.12.0";
491
+ var kitVersion = "1.13.0";
471
492
  var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
472
493
 
473
494
  if (customIntegrationName) {
@@ -21,12 +21,16 @@ var RoktKit = (function (exports) {
21
21
 
22
22
  var constructor = function () {
23
23
  var self = this;
24
- var EMAIL_SHA256_IDENTITY = 'emailsha256';
25
- var OTHER_IDENTITY = 'other';
26
24
  var PerformanceMarks = {
27
25
  RoktScriptAppended: 'mp:RoktScriptAppended',
28
26
  };
29
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;
33
+
30
34
  self.name = name;
31
35
  self.moduleId = moduleId;
32
36
  self.isInitialized = false;
@@ -92,6 +96,13 @@ var RoktKit = (function (exports) {
92
96
  placementEventMapping
93
97
  );
94
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
+
95
106
  var domain = window.mParticle.Rokt.domain;
96
107
  var launcherOptions = mergeObjects(
97
108
  {},
@@ -160,7 +171,7 @@ var RoktKit = (function (exports) {
160
171
 
161
172
  var userIdentities = filteredUser.getUserIdentities().userIdentities;
162
173
 
163
- return replaceOtherWithEmailsha256(userIdentities);
174
+ return replaceOtherIdentityWithEmailsha256(userIdentities);
164
175
  }
165
176
 
166
177
  function returnLocalSessionAttributes() {
@@ -175,11 +186,21 @@ var RoktKit = (function (exports) {
175
186
  return window.mParticle.Rokt.getLocalSessionAttributes();
176
187
  }
177
188
 
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) {
179
201
  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];
183
204
  }
184
205
 
185
206
  return data;
@@ -235,7 +256,7 @@ var RoktKit = (function (exports) {
235
256
 
236
257
  var selectPlacementsAttributes = mergeObjects(
237
258
  filteredUserIdentities,
238
- replaceOtherWithEmailsha256(filteredAttributes),
259
+ filteredAttributes,
239
260
  optimizelyAttributes,
240
261
  localSessionAttributes,
241
262
  {
@@ -244,7 +265,7 @@ var RoktKit = (function (exports) {
244
265
  );
245
266
 
246
267
  var selectPlacementsOptions = mergeObjects(options, {
247
- attributes: selectPlacementsAttributes,
268
+ attributes: sanitizeEmailIdentities(selectPlacementsAttributes),
248
269
  });
249
270
 
250
271
  return self.launcher.selectPlacements(selectPlacementsOptions);
@@ -466,7 +487,7 @@ var RoktKit = (function (exports) {
466
487
 
467
488
  function generateIntegrationName(customIntegrationName) {
468
489
  var coreSdkVersion = window.mParticle.getVersion();
469
- var kitVersion = "1.12.0";
490
+ var kitVersion = "1.13.0";
470
491
  var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
471
492
 
472
493
  if (customIntegrationName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-rokt-kit",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "mParticle integration kit for Rokt",
5
5
  "main": "dist/Rokt-Kit.common.js",
6
6
  "files": [