@mparticle/web-sdk 2.21.2 → 2.22.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.
- package/dist/mparticle.common.js +73 -38
- package/dist/mparticle.esm.js +73 -38
- package/dist/mparticle.js +284 -95
- package/package.json +7 -7
- package/src/configAPIClient.ts +19 -10
- package/src/consent.ts +6 -9
- package/src/constants.ts +1 -0
- package/src/forwarders.js +38 -21
- package/src/helpers.js +11 -6
- package/src/kitFilterHelper.ts +47 -0
- package/src/mockBatchCreator.ts +3 -0
- package/src/mparticle-instance-manager.js +3 -0
- package/src/persistence.js +9 -1
- package/src/sdkRuntimeModels.ts +3 -1
- package/src/sdkToEventsApiConverter.ts +5 -0
- package/src/sideloadedKit.ts +124 -0
- package/src/store.ts +1 -0
- package/src/types.interfaces.ts +52 -0
package/dist/mparticle.js
CHANGED
|
@@ -203,7 +203,34 @@ var mParticle = (function () {
|
|
|
203
203
|
Base64: Base64$1
|
|
204
204
|
};
|
|
205
205
|
|
|
206
|
+
function _typeof(obj) {
|
|
207
|
+
"@babel/helpers - typeof";
|
|
208
|
+
|
|
209
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
210
|
+
return typeof obj;
|
|
211
|
+
} : function (obj) {
|
|
212
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
213
|
+
}, _typeof(obj);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function _toPrimitive(input, hint) {
|
|
217
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
218
|
+
var prim = input[Symbol.toPrimitive];
|
|
219
|
+
if (prim !== undefined) {
|
|
220
|
+
var res = prim.call(input, hint || "default");
|
|
221
|
+
if (_typeof(res) !== "object") return res;
|
|
222
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
223
|
+
}
|
|
224
|
+
return (hint === "string" ? String : Number)(input);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function _toPropertyKey(arg) {
|
|
228
|
+
var key = _toPrimitive(arg, "string");
|
|
229
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
230
|
+
}
|
|
231
|
+
|
|
206
232
|
function _defineProperty(obj, key, value) {
|
|
233
|
+
key = _toPropertyKey(key);
|
|
207
234
|
if (key in obj) {
|
|
208
235
|
Object.defineProperty(obj, key, {
|
|
209
236
|
value: value,
|
|
@@ -214,12 +241,11 @@ var mParticle = (function () {
|
|
|
214
241
|
} else {
|
|
215
242
|
obj[key] = value;
|
|
216
243
|
}
|
|
217
|
-
|
|
218
244
|
return obj;
|
|
219
245
|
}
|
|
220
246
|
|
|
221
247
|
var _TriggerUploadType;
|
|
222
|
-
var MessageType$
|
|
248
|
+
var MessageType$2 = {
|
|
223
249
|
SessionStart: 1,
|
|
224
250
|
SessionEnd: 2,
|
|
225
251
|
PageView: 3,
|
|
@@ -236,7 +262,7 @@ var mParticle = (function () {
|
|
|
236
262
|
|
|
237
263
|
// Dictionary that contains MessageTypes that will
|
|
238
264
|
// trigger an immediate upload.
|
|
239
|
-
var TriggerUploadType = (_TriggerUploadType = {}, _defineProperty(_TriggerUploadType, MessageType$
|
|
265
|
+
var TriggerUploadType = (_TriggerUploadType = {}, _defineProperty(_TriggerUploadType, MessageType$2.Commerce, 1), _defineProperty(_TriggerUploadType, MessageType$2.UserAttributeChange, 1), _defineProperty(_TriggerUploadType, MessageType$2.UserIdentityChange, 1), _TriggerUploadType);
|
|
240
266
|
var EventType = {
|
|
241
267
|
Unknown: 0,
|
|
242
268
|
Navigation: 1,
|
|
@@ -314,7 +340,7 @@ var mParticle = (function () {
|
|
|
314
340
|
ProductRemoveFromWishlist: 21,
|
|
315
341
|
ProductImpression: 22
|
|
316
342
|
};
|
|
317
|
-
var IdentityType = {
|
|
343
|
+
var IdentityType$1 = {
|
|
318
344
|
Other: 0,
|
|
319
345
|
CustomerId: 1,
|
|
320
346
|
Facebook: 2,
|
|
@@ -337,11 +363,11 @@ var mParticle = (function () {
|
|
|
337
363
|
PhoneNumber2: 20,
|
|
338
364
|
PhoneNumber3: 21
|
|
339
365
|
};
|
|
340
|
-
IdentityType.isValid = function (identityType) {
|
|
366
|
+
IdentityType$1.isValid = function (identityType) {
|
|
341
367
|
if (typeof identityType === 'number') {
|
|
342
|
-
for (var prop in IdentityType) {
|
|
343
|
-
if (IdentityType.hasOwnProperty(prop)) {
|
|
344
|
-
if (IdentityType[prop] === identityType) {
|
|
368
|
+
for (var prop in IdentityType$1) {
|
|
369
|
+
if (IdentityType$1.hasOwnProperty(prop)) {
|
|
370
|
+
if (IdentityType$1[prop] === identityType) {
|
|
345
371
|
return true;
|
|
346
372
|
}
|
|
347
373
|
}
|
|
@@ -349,7 +375,7 @@ var mParticle = (function () {
|
|
|
349
375
|
}
|
|
350
376
|
return false;
|
|
351
377
|
};
|
|
352
|
-
IdentityType.getName = function (identityType) {
|
|
378
|
+
IdentityType$1.getName = function (identityType) {
|
|
353
379
|
switch (identityType) {
|
|
354
380
|
case window.mParticle.IdentityType.CustomerId:
|
|
355
381
|
return 'Customer ID';
|
|
@@ -371,97 +397,97 @@ var mParticle = (function () {
|
|
|
371
397
|
return 'Other ID';
|
|
372
398
|
}
|
|
373
399
|
};
|
|
374
|
-
IdentityType.getIdentityType = function (identityName) {
|
|
400
|
+
IdentityType$1.getIdentityType = function (identityName) {
|
|
375
401
|
switch (identityName) {
|
|
376
402
|
case 'other':
|
|
377
|
-
return IdentityType.Other;
|
|
403
|
+
return IdentityType$1.Other;
|
|
378
404
|
case 'customerid':
|
|
379
|
-
return IdentityType.CustomerId;
|
|
405
|
+
return IdentityType$1.CustomerId;
|
|
380
406
|
case 'facebook':
|
|
381
|
-
return IdentityType.Facebook;
|
|
407
|
+
return IdentityType$1.Facebook;
|
|
382
408
|
case 'twitter':
|
|
383
|
-
return IdentityType.Twitter;
|
|
409
|
+
return IdentityType$1.Twitter;
|
|
384
410
|
case 'google':
|
|
385
|
-
return IdentityType.Google;
|
|
411
|
+
return IdentityType$1.Google;
|
|
386
412
|
case 'microsoft':
|
|
387
|
-
return IdentityType.Microsoft;
|
|
413
|
+
return IdentityType$1.Microsoft;
|
|
388
414
|
case 'yahoo':
|
|
389
|
-
return IdentityType.Yahoo;
|
|
415
|
+
return IdentityType$1.Yahoo;
|
|
390
416
|
case 'email':
|
|
391
|
-
return IdentityType.Email;
|
|
417
|
+
return IdentityType$1.Email;
|
|
392
418
|
case 'facebookcustomaudienceid':
|
|
393
|
-
return IdentityType.FacebookCustomAudienceId;
|
|
419
|
+
return IdentityType$1.FacebookCustomAudienceId;
|
|
394
420
|
case 'other2':
|
|
395
|
-
return IdentityType.Other2;
|
|
421
|
+
return IdentityType$1.Other2;
|
|
396
422
|
case 'other3':
|
|
397
|
-
return IdentityType.Other3;
|
|
423
|
+
return IdentityType$1.Other3;
|
|
398
424
|
case 'other4':
|
|
399
|
-
return IdentityType.Other4;
|
|
425
|
+
return IdentityType$1.Other4;
|
|
400
426
|
case 'other5':
|
|
401
|
-
return IdentityType.Other5;
|
|
427
|
+
return IdentityType$1.Other5;
|
|
402
428
|
case 'other6':
|
|
403
|
-
return IdentityType.Other6;
|
|
429
|
+
return IdentityType$1.Other6;
|
|
404
430
|
case 'other7':
|
|
405
|
-
return IdentityType.Other7;
|
|
431
|
+
return IdentityType$1.Other7;
|
|
406
432
|
case 'other8':
|
|
407
|
-
return IdentityType.Other8;
|
|
433
|
+
return IdentityType$1.Other8;
|
|
408
434
|
case 'other9':
|
|
409
|
-
return IdentityType.Other9;
|
|
435
|
+
return IdentityType$1.Other9;
|
|
410
436
|
case 'other10':
|
|
411
|
-
return IdentityType.Other10;
|
|
437
|
+
return IdentityType$1.Other10;
|
|
412
438
|
case 'mobile_number':
|
|
413
|
-
return IdentityType.MobileNumber;
|
|
439
|
+
return IdentityType$1.MobileNumber;
|
|
414
440
|
case 'phone_number_2':
|
|
415
|
-
return IdentityType.PhoneNumber2;
|
|
441
|
+
return IdentityType$1.PhoneNumber2;
|
|
416
442
|
case 'phone_number_3':
|
|
417
|
-
return IdentityType.PhoneNumber3;
|
|
443
|
+
return IdentityType$1.PhoneNumber3;
|
|
418
444
|
default:
|
|
419
445
|
return false;
|
|
420
446
|
}
|
|
421
447
|
};
|
|
422
|
-
IdentityType.getIdentityName = function (identityType) {
|
|
448
|
+
IdentityType$1.getIdentityName = function (identityType) {
|
|
423
449
|
switch (identityType) {
|
|
424
|
-
case IdentityType.Other:
|
|
450
|
+
case IdentityType$1.Other:
|
|
425
451
|
return 'other';
|
|
426
|
-
case IdentityType.CustomerId:
|
|
452
|
+
case IdentityType$1.CustomerId:
|
|
427
453
|
return 'customerid';
|
|
428
|
-
case IdentityType.Facebook:
|
|
454
|
+
case IdentityType$1.Facebook:
|
|
429
455
|
return 'facebook';
|
|
430
|
-
case IdentityType.Twitter:
|
|
456
|
+
case IdentityType$1.Twitter:
|
|
431
457
|
return 'twitter';
|
|
432
|
-
case IdentityType.Google:
|
|
458
|
+
case IdentityType$1.Google:
|
|
433
459
|
return 'google';
|
|
434
|
-
case IdentityType.Microsoft:
|
|
460
|
+
case IdentityType$1.Microsoft:
|
|
435
461
|
return 'microsoft';
|
|
436
|
-
case IdentityType.Yahoo:
|
|
462
|
+
case IdentityType$1.Yahoo:
|
|
437
463
|
return 'yahoo';
|
|
438
|
-
case IdentityType.Email:
|
|
464
|
+
case IdentityType$1.Email:
|
|
439
465
|
return 'email';
|
|
440
|
-
case IdentityType.FacebookCustomAudienceId:
|
|
466
|
+
case IdentityType$1.FacebookCustomAudienceId:
|
|
441
467
|
return 'facebookcustomaudienceid';
|
|
442
|
-
case IdentityType.Other2:
|
|
468
|
+
case IdentityType$1.Other2:
|
|
443
469
|
return 'other2';
|
|
444
|
-
case IdentityType.Other3:
|
|
470
|
+
case IdentityType$1.Other3:
|
|
445
471
|
return 'other3';
|
|
446
|
-
case IdentityType.Other4:
|
|
472
|
+
case IdentityType$1.Other4:
|
|
447
473
|
return 'other4';
|
|
448
|
-
case IdentityType.Other5:
|
|
474
|
+
case IdentityType$1.Other5:
|
|
449
475
|
return 'other5';
|
|
450
|
-
case IdentityType.Other6:
|
|
476
|
+
case IdentityType$1.Other6:
|
|
451
477
|
return 'other6';
|
|
452
|
-
case IdentityType.Other7:
|
|
478
|
+
case IdentityType$1.Other7:
|
|
453
479
|
return 'other7';
|
|
454
|
-
case IdentityType.Other8:
|
|
480
|
+
case IdentityType$1.Other8:
|
|
455
481
|
return 'other8';
|
|
456
|
-
case IdentityType.Other9:
|
|
482
|
+
case IdentityType$1.Other9:
|
|
457
483
|
return 'other9';
|
|
458
|
-
case IdentityType.Other10:
|
|
484
|
+
case IdentityType$1.Other10:
|
|
459
485
|
return 'other10';
|
|
460
|
-
case IdentityType.MobileNumber:
|
|
486
|
+
case IdentityType$1.MobileNumber:
|
|
461
487
|
return 'mobile_number';
|
|
462
|
-
case IdentityType.PhoneNumber2:
|
|
488
|
+
case IdentityType$1.PhoneNumber2:
|
|
463
489
|
return 'phone_number_2';
|
|
464
|
-
case IdentityType.PhoneNumber3:
|
|
490
|
+
case IdentityType$1.PhoneNumber3:
|
|
465
491
|
return 'phone_number_3';
|
|
466
492
|
}
|
|
467
493
|
};
|
|
@@ -570,10 +596,10 @@ var mParticle = (function () {
|
|
|
570
596
|
Development: 'development'
|
|
571
597
|
};
|
|
572
598
|
var Types = {
|
|
573
|
-
MessageType: MessageType$
|
|
599
|
+
MessageType: MessageType$2,
|
|
574
600
|
EventType: EventType,
|
|
575
601
|
CommerceEventType: CommerceEventType,
|
|
576
|
-
IdentityType: IdentityType,
|
|
602
|
+
IdentityType: IdentityType$1,
|
|
577
603
|
ProfileMessageType: ProfileMessageType,
|
|
578
604
|
ApplicationTransitionType: ApplicationTransitionType$1,
|
|
579
605
|
ProductActionType: ProductActionType,
|
|
@@ -582,7 +608,7 @@ var mParticle = (function () {
|
|
|
582
608
|
Environment: Environment
|
|
583
609
|
};
|
|
584
610
|
|
|
585
|
-
var version = "2.
|
|
611
|
+
var version = "2.22.1";
|
|
586
612
|
|
|
587
613
|
var Constants = {
|
|
588
614
|
sdkVersion: version,
|
|
@@ -733,19 +759,10 @@ var mParticle = (function () {
|
|
|
733
759
|
EventBatchingIntervalMillis: 'eventBatchingIntervalMillis',
|
|
734
760
|
OfflineStorage: 'offlineStorage'
|
|
735
761
|
},
|
|
736
|
-
DefaultInstance: 'default_instance'
|
|
762
|
+
DefaultInstance: 'default_instance',
|
|
763
|
+
CCPAPurpose: 'data_sale_opt_out'
|
|
737
764
|
};
|
|
738
765
|
|
|
739
|
-
function _typeof(obj) {
|
|
740
|
-
"@babel/helpers - typeof";
|
|
741
|
-
|
|
742
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
743
|
-
return typeof obj;
|
|
744
|
-
} : function (obj) {
|
|
745
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
746
|
-
}, _typeof(obj);
|
|
747
|
-
}
|
|
748
|
-
|
|
749
766
|
/******************************************************************************
|
|
750
767
|
Copyright (c) Microsoft Corporation.
|
|
751
768
|
|
|
@@ -868,6 +885,10 @@ var mParticle = (function () {
|
|
|
868
885
|
|
|
869
886
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
870
887
|
|
|
888
|
+
function getDefaultExportFromCjs (x) {
|
|
889
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
890
|
+
}
|
|
891
|
+
|
|
871
892
|
var dist = {};
|
|
872
893
|
|
|
873
894
|
(function (exports) {
|
|
@@ -1095,11 +1116,13 @@ var mParticle = (function () {
|
|
|
1095
1116
|
})(exports.UserAttributeChangeEventEventTypeEnum || (exports.UserAttributeChangeEventEventTypeEnum = {}));
|
|
1096
1117
|
(function (UserIdentityChangeEventEventTypeEnum) {
|
|
1097
1118
|
UserIdentityChangeEventEventTypeEnum["userIdentityChange"] = "user_identity_change";
|
|
1098
|
-
})(exports.UserIdentityChangeEventEventTypeEnum || (exports.UserIdentityChangeEventEventTypeEnum = {}));
|
|
1119
|
+
})(exports.UserIdentityChangeEventEventTypeEnum || (exports.UserIdentityChangeEventEventTypeEnum = {}));
|
|
1099
1120
|
} (dist));
|
|
1100
1121
|
|
|
1101
1122
|
var slugify$1 = {exports: {}};
|
|
1102
1123
|
|
|
1124
|
+
slugify$1.exports;
|
|
1125
|
+
|
|
1103
1126
|
(function (module, exports) {
|
|
1104
1127
|
(function (name, root, factory) {
|
|
1105
1128
|
{
|
|
@@ -1161,10 +1184,11 @@ var mParticle = (function () {
|
|
|
1161
1184
|
};
|
|
1162
1185
|
|
|
1163
1186
|
return replace
|
|
1164
|
-
}));
|
|
1165
|
-
} (slugify$1));
|
|
1187
|
+
}));
|
|
1188
|
+
} (slugify$1, slugify$1.exports));
|
|
1166
1189
|
|
|
1167
|
-
var
|
|
1190
|
+
var slugifyExports = slugify$1.exports;
|
|
1191
|
+
var slugify = /*@__PURE__*/getDefaultExportFromCjs(slugifyExports);
|
|
1168
1192
|
|
|
1169
1193
|
var createCookieString = function createCookieString(value) {
|
|
1170
1194
|
return replaceCommasWithPipes(replaceQuotesWithApostrophes(value));
|
|
@@ -1369,10 +1393,12 @@ var mParticle = (function () {
|
|
|
1369
1393
|
events: uploadEvents,
|
|
1370
1394
|
mp_deviceid: lastEvent.DeviceId,
|
|
1371
1395
|
sdk_version: lastEvent.SDKVersion,
|
|
1396
|
+
// TODO: Refactor this to read from _Store or a global config
|
|
1372
1397
|
application_info: {
|
|
1373
1398
|
application_version: lastEvent.AppVersion,
|
|
1374
1399
|
application_name: lastEvent.AppName,
|
|
1375
|
-
"package": lastEvent.Package
|
|
1400
|
+
"package": lastEvent.Package,
|
|
1401
|
+
is_using_sideloaded_kits: mpInstance._Store.isUsingSideloadedKits || undefined
|
|
1376
1402
|
},
|
|
1377
1403
|
device_info: {
|
|
1378
1404
|
platform: dist.DeviceInformationPlatformEnum.web,
|
|
@@ -2619,6 +2645,43 @@ var mParticle = (function () {
|
|
|
2619
2645
|
}
|
|
2620
2646
|
};
|
|
2621
2647
|
|
|
2648
|
+
var KitFilterHelper = /** @class */function () {
|
|
2649
|
+
function KitFilterHelper() {}
|
|
2650
|
+
KitFilterHelper.hashEventType = function (eventType) {
|
|
2651
|
+
return generateHash(eventType);
|
|
2652
|
+
};
|
|
2653
|
+
KitFilterHelper.hashEventName = function (eventName, eventType) {
|
|
2654
|
+
return generateHash(eventType + eventName);
|
|
2655
|
+
};
|
|
2656
|
+
KitFilterHelper.hashEventAttributeKey = function (eventType, eventName, customAttributeName) {
|
|
2657
|
+
return generateHash(eventType + eventName + customAttributeName);
|
|
2658
|
+
};
|
|
2659
|
+
KitFilterHelper.hashUserAttribute = function (userAttributeKey) {
|
|
2660
|
+
return generateHash(userAttributeKey);
|
|
2661
|
+
};
|
|
2662
|
+
// User Identities are not actually hashed, this method is named this way to
|
|
2663
|
+
// be consistent with the filter class. UserIdentityType is also a number
|
|
2664
|
+
KitFilterHelper.hashUserIdentity = function (userIdentity) {
|
|
2665
|
+
return userIdentity;
|
|
2666
|
+
};
|
|
2667
|
+
KitFilterHelper.hashConsentPurpose = function (prefix, purpose) {
|
|
2668
|
+
return generateHash(prefix + purpose);
|
|
2669
|
+
};
|
|
2670
|
+
// The methods below are for conditional forwarding, a type of filter
|
|
2671
|
+
// hashAttributeCondiitonalForwarding is used for both User and Event
|
|
2672
|
+
// attribute keys and attribute values
|
|
2673
|
+
// The backend returns the hashes as strings for conditional forwarding
|
|
2674
|
+
// but returns "regular" filters as arrays of numbers
|
|
2675
|
+
// See IFilteringEventAttributeValue in configApiClient.ts as an example
|
|
2676
|
+
KitFilterHelper.hashAttributeConditionalForwarding = function (attribute) {
|
|
2677
|
+
return generateHash(attribute).toString();
|
|
2678
|
+
};
|
|
2679
|
+
KitFilterHelper.hashConsentPurposeConditionalForwarding = function (prefix, purpose) {
|
|
2680
|
+
return this.hashConsentPurpose(prefix, purpose).toString();
|
|
2681
|
+
};
|
|
2682
|
+
return KitFilterHelper;
|
|
2683
|
+
}();
|
|
2684
|
+
|
|
2622
2685
|
var StorageNames$1 = Constants.StorageNames;
|
|
2623
2686
|
function Helpers(mpInstance) {
|
|
2624
2687
|
var self = this;
|
|
@@ -2848,7 +2911,7 @@ var mParticle = (function () {
|
|
|
2848
2911
|
if (userIdentitiesObject && Object.keys(userIdentitiesObject).length) {
|
|
2849
2912
|
for (var userIdentityName in userIdentitiesObject) {
|
|
2850
2913
|
if (userIdentitiesObject.hasOwnProperty(userIdentityName)) {
|
|
2851
|
-
var userIdentityType = Types.IdentityType.getIdentityType(userIdentityName);
|
|
2914
|
+
var userIdentityType = KitFilterHelper.hashUserIdentity(Types.IdentityType.getIdentityType(userIdentityName));
|
|
2852
2915
|
if (!self.inArray(filterList, userIdentityType)) {
|
|
2853
2916
|
filteredUserIdentities[userIdentityName] = userIdentitiesObject[userIdentityName];
|
|
2854
2917
|
}
|
|
@@ -2862,7 +2925,7 @@ var mParticle = (function () {
|
|
|
2862
2925
|
if (userAttributes && Object.keys(userAttributes).length) {
|
|
2863
2926
|
for (var userAttribute in userAttributes) {
|
|
2864
2927
|
if (userAttributes.hasOwnProperty(userAttribute)) {
|
|
2865
|
-
var hashedUserAttribute =
|
|
2928
|
+
var hashedUserAttribute = KitFilterHelper.hashUserAttribute(userAttribute);
|
|
2866
2929
|
if (!self.inArray(filterList, hashedUserAttribute)) {
|
|
2867
2930
|
filteredUserAttributes[userAttribute] = userAttributes[userAttribute];
|
|
2868
2931
|
}
|
|
@@ -2872,7 +2935,7 @@ var mParticle = (function () {
|
|
|
2872
2935
|
return filteredUserAttributes;
|
|
2873
2936
|
};
|
|
2874
2937
|
this.isFilteredUserAttribute = function (userAttributeKey, filterList) {
|
|
2875
|
-
var hashedUserAttribute =
|
|
2938
|
+
var hashedUserAttribute = KitFilterHelper.hashUserAttribute(userAttributeKey);
|
|
2876
2939
|
return filterList && self.inArray(filterList, hashedUserAttribute);
|
|
2877
2940
|
};
|
|
2878
2941
|
this.isEventType = function (type) {
|
|
@@ -4120,7 +4183,14 @@ var mParticle = (function () {
|
|
|
4120
4183
|
mpInstance._Store.devToken = mpInstance._Store.devToken || obj.gs.dt;
|
|
4121
4184
|
mpInstance._Store.SDKConfig.appVersion = mpInstance._Store.SDKConfig.appVersion || obj.gs.av;
|
|
4122
4185
|
mpInstance._Store.clientId = obj.gs.cgid || mpInstance._Store.clientId || mpInstance._Helpers.generateUniqueId();
|
|
4123
|
-
|
|
4186
|
+
|
|
4187
|
+
// For most persistence values, we prioritize localstorage/cookie values over
|
|
4188
|
+
// Store. However, we allow device ID to be overriden via a config value and
|
|
4189
|
+
// thus the priority of the deviceId value is
|
|
4190
|
+
// 1. value passed via config.deviceId
|
|
4191
|
+
// 2. previous value in persistence
|
|
4192
|
+
// 3. generate new guid
|
|
4193
|
+
mpInstance._Store.deviceId = mpInstance._Store.deviceId || obj.gs.das || mpInstance._Helpers.generateUniqueId();
|
|
4124
4194
|
mpInstance._Store.integrationAttributes = obj.gs.ia || {};
|
|
4125
4195
|
mpInstance._Store.context = obj.gs.c || mpInstance._Store.context;
|
|
4126
4196
|
mpInstance._Store.currentSessionMPIDs = obj.gs.csm || mpInstance._Store.currentSessionMPIDs;
|
|
@@ -5198,8 +5268,8 @@ var mParticle = (function () {
|
|
|
5198
5268
|
if (userAttributes && mpInstance._Helpers.isObject(userAttributes) && Object.keys(userAttributes).length) {
|
|
5199
5269
|
for (var attrName in userAttributes) {
|
|
5200
5270
|
if (userAttributes.hasOwnProperty(attrName)) {
|
|
5201
|
-
attrHash =
|
|
5202
|
-
valueHash =
|
|
5271
|
+
attrHash = KitFilterHelper.hashAttributeConditionalForwarding(attrName);
|
|
5272
|
+
valueHash = KitFilterHelper.hashAttributeConditionalForwarding(userAttributes[attrName]);
|
|
5203
5273
|
if (attrHash === filterObject.userAttributeName && valueHash === filterObject.userAttributeValue) {
|
|
5204
5274
|
isMatch = true;
|
|
5205
5275
|
break;
|
|
@@ -5249,7 +5319,7 @@ var mParticle = (function () {
|
|
|
5249
5319
|
filterUserIdentities = function filterUserIdentities(event, filterList) {
|
|
5250
5320
|
if (event.UserIdentities && event.UserIdentities.length) {
|
|
5251
5321
|
event.UserIdentities.forEach(function (userIdentity, i) {
|
|
5252
|
-
if (mpInstance._Helpers.inArray(filterList, userIdentity.Type)) {
|
|
5322
|
+
if (mpInstance._Helpers.inArray(filterList, KitFilterHelper.hashUserIdentity(userIdentity.Type))) {
|
|
5253
5323
|
event.UserIdentities.splice(i, 1);
|
|
5254
5324
|
if (i > 0) {
|
|
5255
5325
|
i--;
|
|
@@ -5265,7 +5335,7 @@ var mParticle = (function () {
|
|
|
5265
5335
|
}
|
|
5266
5336
|
for (var attrName in event.EventAttributes) {
|
|
5267
5337
|
if (event.EventAttributes.hasOwnProperty(attrName)) {
|
|
5268
|
-
hash =
|
|
5338
|
+
hash = KitFilterHelper.hashEventAttributeKey(event.EventCategory, event.EventName, attrName);
|
|
5269
5339
|
if (mpInstance._Helpers.inArray(filterList, hash)) {
|
|
5270
5340
|
delete event.EventAttributes[attrName];
|
|
5271
5341
|
}
|
|
@@ -5282,8 +5352,8 @@ var mParticle = (function () {
|
|
|
5282
5352
|
},
|
|
5283
5353
|
forwardingRuleMessageTypes = [Types.MessageType.PageEvent, Types.MessageType.PageView, Types.MessageType.Commerce];
|
|
5284
5354
|
if (!mpInstance._Store.webviewBridgeEnabled && mpInstance._Store.activeForwarders) {
|
|
5285
|
-
hashedEventName =
|
|
5286
|
-
hashedEventType =
|
|
5355
|
+
hashedEventName = KitFilterHelper.hashEventName(event.EventName, event.EventCategory);
|
|
5356
|
+
hashedEventType = KitFilterHelper.hashEventType(event.EventCategory);
|
|
5287
5357
|
for (var i = 0; i < mpInstance._Store.activeForwarders.length; i++) {
|
|
5288
5358
|
// Check attribute forwarding rule. This rule allows users to only forward an event if a
|
|
5289
5359
|
// specific attribute exists and has a specific value. Alternatively, they can specify
|
|
@@ -5298,11 +5368,11 @@ var mParticle = (function () {
|
|
|
5298
5368
|
if (event.EventAttributes) {
|
|
5299
5369
|
for (var prop in event.EventAttributes) {
|
|
5300
5370
|
var hashedEventAttributeName;
|
|
5301
|
-
hashedEventAttributeName =
|
|
5371
|
+
hashedEventAttributeName = KitFilterHelper.hashAttributeConditionalForwarding(prop);
|
|
5302
5372
|
if (hashedEventAttributeName === mpInstance._Store.activeForwarders[i].filteringEventAttributeValue.eventAttributeName) {
|
|
5303
5373
|
foundProp = {
|
|
5304
5374
|
name: hashedEventAttributeName,
|
|
5305
|
-
value:
|
|
5375
|
+
value: KitFilterHelper.hashAttributeConditionalForwarding(event.EventAttributes[prop])
|
|
5306
5376
|
};
|
|
5307
5377
|
}
|
|
5308
5378
|
if (foundProp) {
|
|
@@ -5519,7 +5589,11 @@ var mParticle = (function () {
|
|
|
5519
5589
|
// which is typed { kits: Dictionary<constructor> }.
|
|
5520
5590
|
// The constructors are keyed by the name of the kit.
|
|
5521
5591
|
config.sideloadedKits.forEach(function (sideloadedKit) {
|
|
5522
|
-
|
|
5592
|
+
try {
|
|
5593
|
+
sideloadedKit.kitInstance.register(sideloadedKits);
|
|
5594
|
+
} catch (e) {
|
|
5595
|
+
console.error('Error registering sideloaded kit ' + sideloadedKit.kitInstance.name);
|
|
5596
|
+
}
|
|
5523
5597
|
});
|
|
5524
5598
|
|
|
5525
5599
|
// Then configure each kit
|
|
@@ -5527,6 +5601,12 @@ var mParticle = (function () {
|
|
|
5527
5601
|
var kitConstructor = sideloadedKits.kits[registeredKitKey];
|
|
5528
5602
|
self.configureSideloadedKit(kitConstructor);
|
|
5529
5603
|
}
|
|
5604
|
+
|
|
5605
|
+
// If Sideloaded Kits are successfully registered,
|
|
5606
|
+
// record this in the Store.
|
|
5607
|
+
if (!isEmpty(sideloadedKits.kits)) {
|
|
5608
|
+
mpInstance._Store.isUsingSideloadedKits = true;
|
|
5609
|
+
}
|
|
5530
5610
|
}
|
|
5531
5611
|
} catch (e) {
|
|
5532
5612
|
mpInstance.Logger.error('Sideloaded Kits not configured propertly. Kits may not be initialized. ' + e);
|
|
@@ -5583,7 +5663,7 @@ var mParticle = (function () {
|
|
|
5583
5663
|
}
|
|
5584
5664
|
|
|
5585
5665
|
// TODO: This file is no longer the server model because the web SDK payload
|
|
5586
|
-
var MessageType = Types.MessageType;
|
|
5666
|
+
var MessageType$1 = Types.MessageType;
|
|
5587
5667
|
var ApplicationTransitionType = Types.ApplicationTransitionType;
|
|
5588
5668
|
// TODO: Make this a pure function that returns a new object
|
|
5589
5669
|
function convertCustomFlags(event, dto) {
|
|
@@ -5769,7 +5849,7 @@ var mParticle = (function () {
|
|
|
5769
5849
|
CurrencyCode: mpInstance._Store.currencyCode,
|
|
5770
5850
|
DataPlan: mpInstance._Store.SDKConfig.dataPlan ? mpInstance._Store.SDKConfig.dataPlan : {}
|
|
5771
5851
|
};
|
|
5772
|
-
if (eventObject.EventDataType === MessageType.AppStateTransition) {
|
|
5852
|
+
if (eventObject.EventDataType === MessageType$1.AppStateTransition) {
|
|
5773
5853
|
eventObject.IsFirstRun = mpInstance._Store.isFirstRun;
|
|
5774
5854
|
eventObject.LaunchReferral = window.location.href || null;
|
|
5775
5855
|
}
|
|
@@ -5829,7 +5909,7 @@ var mParticle = (function () {
|
|
|
5829
5909
|
if (consent) {
|
|
5830
5910
|
dto.con = consent;
|
|
5831
5911
|
}
|
|
5832
|
-
if (event.EventDataType === MessageType.AppStateTransition) {
|
|
5912
|
+
if (event.EventDataType === MessageType$1.AppStateTransition) {
|
|
5833
5913
|
dto.fr = event.IsFirstRun;
|
|
5834
5914
|
dto.iu = false;
|
|
5835
5915
|
dto.at = ApplicationTransitionType.AppInit;
|
|
@@ -5841,7 +5921,7 @@ var mParticle = (function () {
|
|
|
5841
5921
|
if (event.CustomFlags) {
|
|
5842
5922
|
convertCustomFlags(event, dto);
|
|
5843
5923
|
}
|
|
5844
|
-
if (event.EventDataType === MessageType.Commerce) {
|
|
5924
|
+
if (event.EventDataType === MessageType$1.Commerce) {
|
|
5845
5925
|
dto.cu = event.CurrencyCode;
|
|
5846
5926
|
// TODO: If Cart is deprecated, we should deprecate this too
|
|
5847
5927
|
if (event.ShoppingCart) {
|
|
@@ -5882,7 +5962,7 @@ var mParticle = (function () {
|
|
|
5882
5962
|
};
|
|
5883
5963
|
});
|
|
5884
5964
|
}
|
|
5885
|
-
} else if (event.EventDataType === MessageType.Profile) {
|
|
5965
|
+
} else if (event.EventDataType === MessageType$1.Profile) {
|
|
5886
5966
|
dto.pet = event.ProfileMessageType;
|
|
5887
5967
|
}
|
|
5888
5968
|
return dto;
|
|
@@ -6987,8 +7067,7 @@ var mParticle = (function () {
|
|
|
6987
7067
|
};
|
|
6988
7068
|
}
|
|
6989
7069
|
|
|
6990
|
-
|
|
6991
|
-
var CCPAPurpose = 'data_sale_opt_out';
|
|
7070
|
+
var CCPAPurpose = Constants.CCPAPurpose;
|
|
6992
7071
|
function Consent(mpInstance) {
|
|
6993
7072
|
var self = this;
|
|
6994
7073
|
// this function is called when consent is required to
|
|
@@ -7009,19 +7088,19 @@ var mParticle = (function () {
|
|
|
7009
7088
|
// GDPR - '1' + purpose name
|
|
7010
7089
|
// CCPA - '2data_sale_opt_out' (there is only 1 purpose of data_sale_opt_out for CCPA)
|
|
7011
7090
|
var GDPRConsentHashPrefix = '1';
|
|
7012
|
-
var
|
|
7091
|
+
var CCPAHashPrefix = '2';
|
|
7013
7092
|
var gdprConsentState = consentState.getGDPRConsentState();
|
|
7014
7093
|
if (gdprConsentState) {
|
|
7015
7094
|
for (var purpose in gdprConsentState) {
|
|
7016
7095
|
if (gdprConsentState.hasOwnProperty(purpose)) {
|
|
7017
|
-
purposeHash =
|
|
7096
|
+
purposeHash = KitFilterHelper.hashConsentPurposeConditionalForwarding(GDPRConsentHashPrefix, purpose);
|
|
7018
7097
|
purposeHashes[purposeHash] = gdprConsentState[purpose].Consented;
|
|
7019
7098
|
}
|
|
7020
7099
|
}
|
|
7021
7100
|
}
|
|
7022
7101
|
var CCPAConsentState = consentState.getCCPAConsentState();
|
|
7023
7102
|
if (CCPAConsentState) {
|
|
7024
|
-
purposeHash =
|
|
7103
|
+
purposeHash = KitFilterHelper.hashConsentPurposeConditionalForwarding(CCPAHashPrefix, CCPAPurpose);
|
|
7025
7104
|
purposeHashes[purposeHash] = CCPAConsentState.Consented;
|
|
7026
7105
|
}
|
|
7027
7106
|
}
|
|
@@ -9034,6 +9113,7 @@ var mParticle = (function () {
|
|
|
9034
9113
|
},
|
|
9035
9114
|
_resetForTests: mockFunction,
|
|
9036
9115
|
_APIClient: null,
|
|
9116
|
+
MPSideloadedKit: null,
|
|
9037
9117
|
_Consent: null,
|
|
9038
9118
|
_Forwarders: null,
|
|
9039
9119
|
_NativeSdkHelpers: null,
|
|
@@ -9112,6 +9192,7 @@ var mParticle = (function () {
|
|
|
9112
9192
|
getAppVersion: mockFunction,
|
|
9113
9193
|
getAppName: mockFunction,
|
|
9114
9194
|
getInstance: mockFunction,
|
|
9195
|
+
getDeviceId: mockFunction,
|
|
9115
9196
|
init: mockFunction,
|
|
9116
9197
|
logBaseEvent: mockFunction,
|
|
9117
9198
|
logEvent: mockFunction,
|
|
@@ -9135,6 +9216,113 @@ var mParticle = (function () {
|
|
|
9135
9216
|
return _BatchValidator;
|
|
9136
9217
|
}();
|
|
9137
9218
|
|
|
9219
|
+
var EventTypeEnum;
|
|
9220
|
+
(function (EventTypeEnum) {
|
|
9221
|
+
EventTypeEnum[EventTypeEnum["Unknown"] = 0] = "Unknown";
|
|
9222
|
+
EventTypeEnum[EventTypeEnum["Navigation"] = 1] = "Navigation";
|
|
9223
|
+
EventTypeEnum[EventTypeEnum["Location"] = 2] = "Location";
|
|
9224
|
+
EventTypeEnum[EventTypeEnum["Search"] = 3] = "Search";
|
|
9225
|
+
EventTypeEnum[EventTypeEnum["Transaction"] = 4] = "Transaction";
|
|
9226
|
+
EventTypeEnum[EventTypeEnum["UserContent"] = 5] = "UserContent";
|
|
9227
|
+
EventTypeEnum[EventTypeEnum["UserPreference"] = 6] = "UserPreference";
|
|
9228
|
+
EventTypeEnum[EventTypeEnum["Social"] = 7] = "Social";
|
|
9229
|
+
EventTypeEnum[EventTypeEnum["Other"] = 8] = "Other";
|
|
9230
|
+
EventTypeEnum[EventTypeEnum["Media"] = 9] = "Media";
|
|
9231
|
+
})(EventTypeEnum || (EventTypeEnum = {}));
|
|
9232
|
+
// TODO: https://mparticle-eng.atlassian.net/browse/SQDSDKS-5403
|
|
9233
|
+
var MessageType;
|
|
9234
|
+
(function (MessageType) {
|
|
9235
|
+
MessageType[MessageType["SessionStart"] = 1] = "SessionStart";
|
|
9236
|
+
MessageType[MessageType["SessionEnd"] = 2] = "SessionEnd";
|
|
9237
|
+
MessageType[MessageType["PageView"] = 3] = "PageView";
|
|
9238
|
+
MessageType[MessageType["PageEvent"] = 4] = "PageEvent";
|
|
9239
|
+
MessageType[MessageType["CrashReport"] = 5] = "CrashReport";
|
|
9240
|
+
MessageType[MessageType["OptOut"] = 6] = "OptOut";
|
|
9241
|
+
MessageType[MessageType["AppStateTransition"] = 10] = "AppStateTransition";
|
|
9242
|
+
MessageType[MessageType["Profile"] = 14] = "Profile";
|
|
9243
|
+
MessageType[MessageType["Commerce"] = 16] = "Commerce";
|
|
9244
|
+
MessageType[MessageType["UserAttributeChange"] = 17] = "UserAttributeChange";
|
|
9245
|
+
MessageType[MessageType["UserIdentityChange"] = 18] = "UserIdentityChange";
|
|
9246
|
+
MessageType[MessageType["Media"] = 20] = "Media";
|
|
9247
|
+
})(MessageType || (MessageType = {}));
|
|
9248
|
+
var IdentityType;
|
|
9249
|
+
(function (IdentityType) {
|
|
9250
|
+
IdentityType[IdentityType["Other"] = 0] = "Other";
|
|
9251
|
+
IdentityType[IdentityType["CustomerId"] = 1] = "CustomerId";
|
|
9252
|
+
IdentityType[IdentityType["Facebook"] = 2] = "Facebook";
|
|
9253
|
+
IdentityType[IdentityType["Twitter"] = 3] = "Twitter";
|
|
9254
|
+
IdentityType[IdentityType["Google"] = 4] = "Google";
|
|
9255
|
+
IdentityType[IdentityType["Microsoft"] = 5] = "Microsoft";
|
|
9256
|
+
IdentityType[IdentityType["Yahoo"] = 6] = "Yahoo";
|
|
9257
|
+
IdentityType[IdentityType["Email"] = 7] = "Email";
|
|
9258
|
+
IdentityType[IdentityType["FacebookCustomAudienceId"] = 9] = "FacebookCustomAudienceId";
|
|
9259
|
+
IdentityType[IdentityType["Other2"] = 10] = "Other2";
|
|
9260
|
+
IdentityType[IdentityType["Other3"] = 11] = "Other3";
|
|
9261
|
+
IdentityType[IdentityType["Other4"] = 12] = "Other4";
|
|
9262
|
+
IdentityType[IdentityType["Other5"] = 13] = "Other5";
|
|
9263
|
+
IdentityType[IdentityType["Other6"] = 14] = "Other6";
|
|
9264
|
+
IdentityType[IdentityType["Other7"] = 15] = "Other7";
|
|
9265
|
+
IdentityType[IdentityType["Other8"] = 16] = "Other8";
|
|
9266
|
+
IdentityType[IdentityType["Other9"] = 17] = "Other9";
|
|
9267
|
+
IdentityType[IdentityType["Other10"] = 18] = "Other10";
|
|
9268
|
+
IdentityType[IdentityType["MobileNumber"] = 19] = "MobileNumber";
|
|
9269
|
+
IdentityType[IdentityType["PhoneNumber2"] = 20] = "PhoneNumber2";
|
|
9270
|
+
IdentityType[IdentityType["PhoneNumber3"] = 21] = "PhoneNumber3";
|
|
9271
|
+
})(IdentityType || (IdentityType = {}));
|
|
9272
|
+
|
|
9273
|
+
var MPSideloadedKit = /** @class */function () {
|
|
9274
|
+
function MPSideloadedKit(unregisteredKitInstance) {
|
|
9275
|
+
this.filterDictionary = {
|
|
9276
|
+
eventTypeFilters: [],
|
|
9277
|
+
eventNameFilters: [],
|
|
9278
|
+
screenNameFilters: [],
|
|
9279
|
+
screenAttributeFilters: [],
|
|
9280
|
+
userIdentityFilters: [],
|
|
9281
|
+
userAttributeFilters: [],
|
|
9282
|
+
attributeFilters: [],
|
|
9283
|
+
consentRegulationFilters: [],
|
|
9284
|
+
consentRegulationPurposeFilters: [],
|
|
9285
|
+
messageTypeFilters: [],
|
|
9286
|
+
messageTypeStateFilters: [],
|
|
9287
|
+
// The below filtering members are optional, but we instantiate them
|
|
9288
|
+
// to simplify public method assignment
|
|
9289
|
+
filteringEventAttributeValue: {},
|
|
9290
|
+
filteringUserAttributeValue: {},
|
|
9291
|
+
filteringConsentRuleValues: {}
|
|
9292
|
+
};
|
|
9293
|
+
this.kitInstance = unregisteredKitInstance;
|
|
9294
|
+
}
|
|
9295
|
+
MPSideloadedKit.prototype.addEventTypeFilter = function (eventType) {
|
|
9296
|
+
var hashedEventType = KitFilterHelper.hashEventType(eventType);
|
|
9297
|
+
this.filterDictionary.eventTypeFilters.push(hashedEventType);
|
|
9298
|
+
};
|
|
9299
|
+
MPSideloadedKit.prototype.addEventNameFilter = function (eventType, eventName) {
|
|
9300
|
+
var hashedEventName = KitFilterHelper.hashEventName(eventName, eventType);
|
|
9301
|
+
this.filterDictionary.eventNameFilters.push(hashedEventName);
|
|
9302
|
+
};
|
|
9303
|
+
MPSideloadedKit.prototype.addEventAttributeFilter = function (eventType, eventName, customAttributeKey) {
|
|
9304
|
+
var hashedEventAttribute = KitFilterHelper.hashEventAttributeKey(eventType, eventName, customAttributeKey);
|
|
9305
|
+
this.filterDictionary.attributeFilters.push(hashedEventAttribute);
|
|
9306
|
+
};
|
|
9307
|
+
MPSideloadedKit.prototype.addScreenNameFilter = function (screenName) {
|
|
9308
|
+
var hashedScreenName = KitFilterHelper.hashEventName(screenName, EventTypeEnum.Unknown);
|
|
9309
|
+
this.filterDictionary.screenNameFilters.push(hashedScreenName);
|
|
9310
|
+
};
|
|
9311
|
+
MPSideloadedKit.prototype.addScreenAttributeFilter = function (screenName, screenAttribute) {
|
|
9312
|
+
var hashedScreenAttribute = KitFilterHelper.hashEventAttributeKey(EventTypeEnum.Unknown, screenName, screenAttribute);
|
|
9313
|
+
this.filterDictionary.screenAttributeFilters.push(hashedScreenAttribute);
|
|
9314
|
+
};
|
|
9315
|
+
MPSideloadedKit.prototype.addUserIdentityFilter = function (userIdentity) {
|
|
9316
|
+
var hashedIdentityType = KitFilterHelper.hashUserIdentity(userIdentity);
|
|
9317
|
+
this.filterDictionary.userIdentityFilters.push(hashedIdentityType);
|
|
9318
|
+
};
|
|
9319
|
+
MPSideloadedKit.prototype.addUserAttributeFilter = function (userAttributeKey) {
|
|
9320
|
+
var hashedUserAttributeKey = KitFilterHelper.hashUserAttribute(userAttributeKey);
|
|
9321
|
+
this.filterDictionary.userAttributeFilters.push(hashedUserAttributeKey);
|
|
9322
|
+
};
|
|
9323
|
+
return MPSideloadedKit;
|
|
9324
|
+
}();
|
|
9325
|
+
|
|
9138
9326
|
if (!Array.prototype.forEach) {
|
|
9139
9327
|
Array.prototype.forEach = Polyfill.forEach;
|
|
9140
9328
|
}
|
|
@@ -9157,6 +9345,7 @@ var mParticle = (function () {
|
|
|
9157
9345
|
this.CommerceEventType = Types.CommerceEventType;
|
|
9158
9346
|
this.PromotionType = Types.PromotionActionType;
|
|
9159
9347
|
this.ProductActionType = Types.ProductActionType;
|
|
9348
|
+
this.MPSideloadedKit = MPSideloadedKit;
|
|
9160
9349
|
if (typeof window !== 'undefined') {
|
|
9161
9350
|
this.isIOS = window.mParticle && window.mParticle.isIOS ? window.mParticle.isIOS : false;
|
|
9162
9351
|
this.config = window.mParticle && window.mParticle.config ? window.mParticle.config : {};
|