@mparticle/web-rokt-kit 1.6.1 → 1.6.3

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,6 +22,8 @@ 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';
25
27
 
26
28
  self.name = name;
27
29
  self.moduleId = moduleId;
@@ -60,7 +62,7 @@ var constructor = function () {
60
62
  * hashed attributes from the launcher, or `null` if the kit is not initialized
61
63
  */
62
64
  function hashAttributes(attributes) {
63
- if (!isInitialized()) {
65
+ if (!isKitReady()) {
64
66
  console.error('Rokt Kit: Not initialized');
65
67
  return null;
66
68
  }
@@ -140,7 +142,19 @@ var constructor = function () {
140
142
  return {};
141
143
  }
142
144
 
143
- return filteredUser.getUserIdentities().userIdentities;
145
+ var userIdentities = filteredUser.getUserIdentities().userIdentities;
146
+
147
+ return replaceOtherWithEmailsha256(userIdentities);
148
+ }
149
+
150
+ function replaceOtherWithEmailsha256(_data) {
151
+ var data = mergeObjects({}, _data || {});
152
+ if (_data.hasOwnProperty(OTHER_IDENTITY)) {
153
+ data[EMAIL_SHA256_IDENTITY] = _data[OTHER_IDENTITY];
154
+ delete data[OTHER_IDENTITY];
155
+ }
156
+
157
+ return data;
144
158
  }
145
159
 
146
160
  /**
@@ -190,8 +204,8 @@ var constructor = function () {
190
204
  var filteredUserIdentities = returnUserIdentities(filteredUser);
191
205
 
192
206
  var selectPlacementsAttributes = mergeObjects(
193
- filteredAttributes,
194
207
  filteredUserIdentities,
208
+ replaceOtherWithEmailsha256(filteredAttributes),
195
209
  optimizelyAttributes,
196
210
  {
197
211
  mpid: mpid,
@@ -213,7 +227,7 @@ var constructor = function () {
213
227
  * @returns {void} Nothing is returned
214
228
  */
215
229
  function setExtensionData(partnerExtensionData) {
216
- if (!isInitialized()) {
230
+ if (!isKitReady()) {
217
231
  console.error('Rokt Kit: Not initialized');
218
232
  return;
219
233
  }
@@ -261,10 +275,11 @@ var constructor = function () {
261
275
  );
262
276
  }
263
277
  }
264
- // Attaches the kit to the Rokt manager
265
- window.mParticle.Rokt.attachKit(self);
266
278
 
279
+ // Kit must be initialized before attaching to the Rokt manager
267
280
  self.isInitialized = true;
281
+ // Attaches the kit to the Rokt manager
282
+ window.mParticle.Rokt.attachKit(self);
268
283
  })
269
284
  .catch(function (err) {
270
285
  console.error('Error creating Rokt launcher:', err);
@@ -325,20 +340,20 @@ var constructor = function () {
325
340
  this.removeUserAttribute = removeUserAttribute;
326
341
 
327
342
  /**
328
- * Checks if the kit is properly initialized and ready for use.
343
+ * Checks if the Rokt kit is ready to use.
329
344
  * Both conditions must be true:
330
345
  * 1. self.isInitialized - Set after successful initialization of the kit
331
346
  * 2. self.launcher - The Rokt launcher instance must be available
332
- * @returns {boolean} Whether the kit is fully initialized
347
+ * @returns {boolean} Whether the kit is ready for use
333
348
  */
334
- function isInitialized() {
349
+ function isKitReady() {
335
350
  return !!(self.isInitialized && self.launcher);
336
351
  }
337
352
  };
338
353
 
339
354
  function generateIntegrationName(customIntegrationName) {
340
355
  var coreSdkVersion = window.mParticle.getVersion();
341
- var kitVersion = "1.6.1";
356
+ var kitVersion = "1.6.3";
342
357
  var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
343
358
 
344
359
  if (customIntegrationName) {
@@ -21,6 +21,8 @@ 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';
24
26
 
25
27
  self.name = name;
26
28
  self.moduleId = moduleId;
@@ -59,7 +61,7 @@ var RoktKit = (function (exports) {
59
61
  * hashed attributes from the launcher, or `null` if the kit is not initialized
60
62
  */
61
63
  function hashAttributes(attributes) {
62
- if (!isInitialized()) {
64
+ if (!isKitReady()) {
63
65
  console.error('Rokt Kit: Not initialized');
64
66
  return null;
65
67
  }
@@ -139,7 +141,19 @@ var RoktKit = (function (exports) {
139
141
  return {};
140
142
  }
141
143
 
142
- return filteredUser.getUserIdentities().userIdentities;
144
+ var userIdentities = filteredUser.getUserIdentities().userIdentities;
145
+
146
+ return replaceOtherWithEmailsha256(userIdentities);
147
+ }
148
+
149
+ function replaceOtherWithEmailsha256(_data) {
150
+ var data = mergeObjects({}, _data || {});
151
+ if (_data.hasOwnProperty(OTHER_IDENTITY)) {
152
+ data[EMAIL_SHA256_IDENTITY] = _data[OTHER_IDENTITY];
153
+ delete data[OTHER_IDENTITY];
154
+ }
155
+
156
+ return data;
143
157
  }
144
158
 
145
159
  /**
@@ -189,8 +203,8 @@ var RoktKit = (function (exports) {
189
203
  var filteredUserIdentities = returnUserIdentities(filteredUser);
190
204
 
191
205
  var selectPlacementsAttributes = mergeObjects(
192
- filteredAttributes,
193
206
  filteredUserIdentities,
207
+ replaceOtherWithEmailsha256(filteredAttributes),
194
208
  optimizelyAttributes,
195
209
  {
196
210
  mpid: mpid,
@@ -212,7 +226,7 @@ var RoktKit = (function (exports) {
212
226
  * @returns {void} Nothing is returned
213
227
  */
214
228
  function setExtensionData(partnerExtensionData) {
215
- if (!isInitialized()) {
229
+ if (!isKitReady()) {
216
230
  console.error('Rokt Kit: Not initialized');
217
231
  return;
218
232
  }
@@ -260,10 +274,11 @@ var RoktKit = (function (exports) {
260
274
  );
261
275
  }
262
276
  }
263
- // Attaches the kit to the Rokt manager
264
- window.mParticle.Rokt.attachKit(self);
265
277
 
278
+ // Kit must be initialized before attaching to the Rokt manager
266
279
  self.isInitialized = true;
280
+ // Attaches the kit to the Rokt manager
281
+ window.mParticle.Rokt.attachKit(self);
267
282
  })
268
283
  .catch(function (err) {
269
284
  console.error('Error creating Rokt launcher:', err);
@@ -324,20 +339,20 @@ var RoktKit = (function (exports) {
324
339
  this.removeUserAttribute = removeUserAttribute;
325
340
 
326
341
  /**
327
- * Checks if the kit is properly initialized and ready for use.
342
+ * Checks if the Rokt kit is ready to use.
328
343
  * Both conditions must be true:
329
344
  * 1. self.isInitialized - Set after successful initialization of the kit
330
345
  * 2. self.launcher - The Rokt launcher instance must be available
331
- * @returns {boolean} Whether the kit is fully initialized
346
+ * @returns {boolean} Whether the kit is ready for use
332
347
  */
333
- function isInitialized() {
348
+ function isKitReady() {
334
349
  return !!(self.isInitialized && self.launcher);
335
350
  }
336
351
  };
337
352
 
338
353
  function generateIntegrationName(customIntegrationName) {
339
354
  var coreSdkVersion = window.mParticle.getVersion();
340
- var kitVersion = "1.6.1";
355
+ var kitVersion = "1.6.3";
341
356
  var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
342
357
 
343
358
  if (customIntegrationName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-rokt-kit",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "description": "mParticle integration kit for Rokt",
5
5
  "main": "dist/Rokt-Kit.common.js",
6
6
  "files": [