@mparticle/web-rokt-kit 1.12.0 → 1.13.1

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,15 @@ 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
+
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
+
31
34
  self.name = name;
32
35
  self.moduleId = moduleId;
33
36
  self.isInitialized = false;
@@ -93,6 +96,13 @@ var constructor = function () {
93
96
  placementEventMapping
94
97
  );
95
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
+
96
106
  var domain = window.mParticle.Rokt.domain;
97
107
  var launcherOptions = mergeObjects(
98
108
  {},
@@ -161,7 +171,7 @@ var constructor = function () {
161
171
 
162
172
  var userIdentities = filteredUser.getUserIdentities().userIdentities;
163
173
 
164
- return replaceOtherWithEmailsha256(userIdentities);
174
+ return replaceOtherIdentityWithEmailsha256(userIdentities);
165
175
  }
166
176
 
167
177
  function returnLocalSessionAttributes() {
@@ -176,14 +186,15 @@ var constructor = function () {
176
186
  return window.mParticle.Rokt.getLocalSessionAttributes();
177
187
  }
178
188
 
179
- function replaceOtherWithEmailsha256(_data) {
180
- var data = mergeObjects({}, _data || {});
181
- if (_data.hasOwnProperty(OTHER_IDENTITY)) {
182
- data[EMAIL_SHA256_IDENTITY] = _data[OTHER_IDENTITY];
183
- delete data[OTHER_IDENTITY];
189
+ function replaceOtherIdentityWithEmailsha256(userIdentities) {
190
+ var newUserIdentities = mergeObjects({}, userIdentities || {});
191
+ if (userIdentities[mappedEmailSha256Key]) {
192
+ newUserIdentities[EMAIL_SHA256_KEY] =
193
+ userIdentities[mappedEmailSha256Key];
184
194
  }
195
+ delete newUserIdentities[mappedEmailSha256Key];
185
196
 
186
- return data;
197
+ return newUserIdentities;
187
198
  }
188
199
 
189
200
  /**
@@ -236,7 +247,7 @@ var constructor = function () {
236
247
 
237
248
  var selectPlacementsAttributes = mergeObjects(
238
249
  filteredUserIdentities,
239
- replaceOtherWithEmailsha256(filteredAttributes),
250
+ filteredAttributes,
240
251
  optimizelyAttributes,
241
252
  localSessionAttributes,
242
253
  {
@@ -467,7 +478,7 @@ var constructor = function () {
467
478
 
468
479
  function generateIntegrationName(customIntegrationName) {
469
480
  var coreSdkVersion = window.mParticle.getVersion();
470
- var kitVersion = "1.12.0";
481
+ var kitVersion = "1.13.1";
471
482
  var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
472
483
 
473
484
  if (customIntegrationName) {
@@ -21,12 +21,15 @@ 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
+
30
+ // Dynamic identity type for Rokt's emailsha256 identity value which MP doesn't natively support - will be set during initialization
31
+ var mappedEmailSha256Key;
32
+
30
33
  self.name = name;
31
34
  self.moduleId = moduleId;
32
35
  self.isInitialized = false;
@@ -92,6 +95,13 @@ var RoktKit = (function (exports) {
92
95
  placementEventMapping
93
96
  );
94
97
 
98
+ // Set dynamic OTHER_IDENTITY based on server settings
99
+ // Convert to lowercase since server sends TitleCase (e.g., 'Other' -> 'other')
100
+ if (settings.hashedEmailUserIdentityType) {
101
+ mappedEmailSha256Key =
102
+ settings.hashedEmailUserIdentityType.toLowerCase();
103
+ }
104
+
95
105
  var domain = window.mParticle.Rokt.domain;
96
106
  var launcherOptions = mergeObjects(
97
107
  {},
@@ -160,7 +170,7 @@ var RoktKit = (function (exports) {
160
170
 
161
171
  var userIdentities = filteredUser.getUserIdentities().userIdentities;
162
172
 
163
- return replaceOtherWithEmailsha256(userIdentities);
173
+ return replaceOtherIdentityWithEmailsha256(userIdentities);
164
174
  }
165
175
 
166
176
  function returnLocalSessionAttributes() {
@@ -175,14 +185,15 @@ var RoktKit = (function (exports) {
175
185
  return window.mParticle.Rokt.getLocalSessionAttributes();
176
186
  }
177
187
 
178
- function replaceOtherWithEmailsha256(_data) {
179
- var data = mergeObjects({}, _data || {});
180
- if (_data.hasOwnProperty(OTHER_IDENTITY)) {
181
- data[EMAIL_SHA256_IDENTITY] = _data[OTHER_IDENTITY];
182
- delete data[OTHER_IDENTITY];
188
+ function replaceOtherIdentityWithEmailsha256(userIdentities) {
189
+ var newUserIdentities = mergeObjects({}, userIdentities || {});
190
+ if (userIdentities[mappedEmailSha256Key]) {
191
+ newUserIdentities[EMAIL_SHA256_KEY] =
192
+ userIdentities[mappedEmailSha256Key];
183
193
  }
194
+ delete newUserIdentities[mappedEmailSha256Key];
184
195
 
185
- return data;
196
+ return newUserIdentities;
186
197
  }
187
198
 
188
199
  /**
@@ -235,7 +246,7 @@ var RoktKit = (function (exports) {
235
246
 
236
247
  var selectPlacementsAttributes = mergeObjects(
237
248
  filteredUserIdentities,
238
- replaceOtherWithEmailsha256(filteredAttributes),
249
+ filteredAttributes,
239
250
  optimizelyAttributes,
240
251
  localSessionAttributes,
241
252
  {
@@ -466,7 +477,7 @@ var RoktKit = (function (exports) {
466
477
 
467
478
  function generateIntegrationName(customIntegrationName) {
468
479
  var coreSdkVersion = window.mParticle.getVersion();
469
- var kitVersion = "1.12.0";
480
+ var kitVersion = "1.13.1";
470
481
  var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
471
482
 
472
483
  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.1",
4
4
  "description": "mParticle integration kit for Rokt",
5
5
  "main": "dist/Rokt-Kit.common.js",
6
6
  "files": [