@mparticle/web-rokt-kit 1.7.1 → 1.7.2

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.
@@ -159,6 +159,18 @@ var constructor = function () {
159
159
  return replaceOtherWithEmailsha256(userIdentities);
160
160
  }
161
161
 
162
+ function returnLocalSessionAttributes() {
163
+ if (
164
+ isEmpty(self.placementEventMappingLookup) ||
165
+ !window.mParticle.Rokt ||
166
+ typeof window.mParticle.Rokt.getLocalSessionAttributes !==
167
+ 'function'
168
+ ) {
169
+ return {};
170
+ }
171
+ return window.mParticle.Rokt.getLocalSessionAttributes();
172
+ }
173
+
162
174
  function replaceOtherWithEmailsha256(_data) {
163
175
  var data = mergeObjects({}, _data || {});
164
176
  if (_data.hasOwnProperty(OTHER_IDENTITY)) {
@@ -215,14 +227,7 @@ var constructor = function () {
215
227
 
216
228
  var filteredUserIdentities = returnUserIdentities(filteredUser);
217
229
 
218
- var localSessionAttributes = {};
219
-
220
- try {
221
- localSessionAttributes =
222
- window.mParticle.Rokt.getLocalSessionAttributes();
223
- } catch (error) {
224
- console.error('Error getting local session attributes:', error);
225
- }
230
+ var localSessionAttributes = returnLocalSessionAttributes();
226
231
 
227
232
  var selectPlacementsAttributes = mergeObjects(
228
233
  filteredUserIdentities,
@@ -260,6 +265,7 @@ var constructor = function () {
260
265
  function processEvent(event) {
261
266
  if (
262
267
  !isKitReady() ||
268
+ isEmpty(self.placementEventMappingLookup) ||
263
269
  typeof window.mParticle.Rokt.setLocalSessionAttribute !== 'function'
264
270
  ) {
265
271
  return;
@@ -396,7 +402,7 @@ var constructor = function () {
396
402
 
397
403
  function generateIntegrationName(customIntegrationName) {
398
404
  var coreSdkVersion = window.mParticle.getVersion();
399
- var kitVersion = "1.7.1";
405
+ var kitVersion = "1.7.2";
400
406
  var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
401
407
 
402
408
  if (customIntegrationName) {
@@ -498,6 +504,10 @@ function hashEventMessage(messageType, eventType, eventName) {
498
504
  );
499
505
  }
500
506
 
507
+ function isEmpty(value) {
508
+ return value == null || !(Object.keys(value) || value).length;
509
+ }
510
+
501
511
  if (window && window.mParticle && window.mParticle.addForwarder) {
502
512
  window.mParticle.addForwarder({
503
513
  name: name,
@@ -158,6 +158,18 @@ var RoktKit = (function (exports) {
158
158
  return replaceOtherWithEmailsha256(userIdentities);
159
159
  }
160
160
 
161
+ function returnLocalSessionAttributes() {
162
+ if (
163
+ isEmpty(self.placementEventMappingLookup) ||
164
+ !window.mParticle.Rokt ||
165
+ typeof window.mParticle.Rokt.getLocalSessionAttributes !==
166
+ 'function'
167
+ ) {
168
+ return {};
169
+ }
170
+ return window.mParticle.Rokt.getLocalSessionAttributes();
171
+ }
172
+
161
173
  function replaceOtherWithEmailsha256(_data) {
162
174
  var data = mergeObjects({}, _data || {});
163
175
  if (_data.hasOwnProperty(OTHER_IDENTITY)) {
@@ -214,14 +226,7 @@ var RoktKit = (function (exports) {
214
226
 
215
227
  var filteredUserIdentities = returnUserIdentities(filteredUser);
216
228
 
217
- var localSessionAttributes = {};
218
-
219
- try {
220
- localSessionAttributes =
221
- window.mParticle.Rokt.getLocalSessionAttributes();
222
- } catch (error) {
223
- console.error('Error getting local session attributes:', error);
224
- }
229
+ var localSessionAttributes = returnLocalSessionAttributes();
225
230
 
226
231
  var selectPlacementsAttributes = mergeObjects(
227
232
  filteredUserIdentities,
@@ -259,6 +264,7 @@ var RoktKit = (function (exports) {
259
264
  function processEvent(event) {
260
265
  if (
261
266
  !isKitReady() ||
267
+ isEmpty(self.placementEventMappingLookup) ||
262
268
  typeof window.mParticle.Rokt.setLocalSessionAttribute !== 'function'
263
269
  ) {
264
270
  return;
@@ -395,7 +401,7 @@ var RoktKit = (function (exports) {
395
401
 
396
402
  function generateIntegrationName(customIntegrationName) {
397
403
  var coreSdkVersion = window.mParticle.getVersion();
398
- var kitVersion = "1.7.1";
404
+ var kitVersion = "1.7.2";
399
405
  var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
400
406
 
401
407
  if (customIntegrationName) {
@@ -497,6 +503,10 @@ var RoktKit = (function (exports) {
497
503
  );
498
504
  }
499
505
 
506
+ function isEmpty(value) {
507
+ return value == null || !(Object.keys(value) || value).length;
508
+ }
509
+
500
510
  if (window && window.mParticle && window.mParticle.addForwarder) {
501
511
  window.mParticle.addForwarder({
502
512
  name: name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-rokt-kit",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "mParticle integration kit for Rokt",
5
5
  "main": "dist/Rokt-Kit.common.js",
6
6
  "files": [