@mparticle/web-sdk 2.21.2 → 2.22.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.
- package/dist/mparticle.common.js +25 -16
- package/dist/mparticle.esm.js +25 -16
- package/dist/mparticle.js +228 -78
- package/package.json +1 -1
- package/src/configAPIClient.ts +19 -10
- package/src/consent.ts +6 -9
- package/src/constants.ts +1 -0
- package/src/forwarders.js +32 -21
- package/src/helpers.js +11 -6
- package/src/kitFilterHelper.ts +47 -0
- package/src/mockBatchCreator.ts +2 -0
- package/src/mparticle-instance-manager.js +3 -0
- package/src/sdkRuntimeModels.ts +2 -1
- package/src/sideloadedKit.ts +124 -0
- package/src/types.interfaces.ts +52 -0
package/dist/mparticle.js
CHANGED
|
@@ -219,7 +219,7 @@ var mParticle = (function () {
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
var _TriggerUploadType;
|
|
222
|
-
var MessageType$
|
|
222
|
+
var MessageType$2 = {
|
|
223
223
|
SessionStart: 1,
|
|
224
224
|
SessionEnd: 2,
|
|
225
225
|
PageView: 3,
|
|
@@ -236,7 +236,7 @@ var mParticle = (function () {
|
|
|
236
236
|
|
|
237
237
|
// Dictionary that contains MessageTypes that will
|
|
238
238
|
// trigger an immediate upload.
|
|
239
|
-
var TriggerUploadType = (_TriggerUploadType = {}, _defineProperty(_TriggerUploadType, MessageType$
|
|
239
|
+
var TriggerUploadType = (_TriggerUploadType = {}, _defineProperty(_TriggerUploadType, MessageType$2.Commerce, 1), _defineProperty(_TriggerUploadType, MessageType$2.UserAttributeChange, 1), _defineProperty(_TriggerUploadType, MessageType$2.UserIdentityChange, 1), _TriggerUploadType);
|
|
240
240
|
var EventType = {
|
|
241
241
|
Unknown: 0,
|
|
242
242
|
Navigation: 1,
|
|
@@ -314,7 +314,7 @@ var mParticle = (function () {
|
|
|
314
314
|
ProductRemoveFromWishlist: 21,
|
|
315
315
|
ProductImpression: 22
|
|
316
316
|
};
|
|
317
|
-
var IdentityType = {
|
|
317
|
+
var IdentityType$1 = {
|
|
318
318
|
Other: 0,
|
|
319
319
|
CustomerId: 1,
|
|
320
320
|
Facebook: 2,
|
|
@@ -337,11 +337,11 @@ var mParticle = (function () {
|
|
|
337
337
|
PhoneNumber2: 20,
|
|
338
338
|
PhoneNumber3: 21
|
|
339
339
|
};
|
|
340
|
-
IdentityType.isValid = function (identityType) {
|
|
340
|
+
IdentityType$1.isValid = function (identityType) {
|
|
341
341
|
if (typeof identityType === 'number') {
|
|
342
|
-
for (var prop in IdentityType) {
|
|
343
|
-
if (IdentityType.hasOwnProperty(prop)) {
|
|
344
|
-
if (IdentityType[prop] === identityType) {
|
|
342
|
+
for (var prop in IdentityType$1) {
|
|
343
|
+
if (IdentityType$1.hasOwnProperty(prop)) {
|
|
344
|
+
if (IdentityType$1[prop] === identityType) {
|
|
345
345
|
return true;
|
|
346
346
|
}
|
|
347
347
|
}
|
|
@@ -349,7 +349,7 @@ var mParticle = (function () {
|
|
|
349
349
|
}
|
|
350
350
|
return false;
|
|
351
351
|
};
|
|
352
|
-
IdentityType.getName = function (identityType) {
|
|
352
|
+
IdentityType$1.getName = function (identityType) {
|
|
353
353
|
switch (identityType) {
|
|
354
354
|
case window.mParticle.IdentityType.CustomerId:
|
|
355
355
|
return 'Customer ID';
|
|
@@ -371,97 +371,97 @@ var mParticle = (function () {
|
|
|
371
371
|
return 'Other ID';
|
|
372
372
|
}
|
|
373
373
|
};
|
|
374
|
-
IdentityType.getIdentityType = function (identityName) {
|
|
374
|
+
IdentityType$1.getIdentityType = function (identityName) {
|
|
375
375
|
switch (identityName) {
|
|
376
376
|
case 'other':
|
|
377
|
-
return IdentityType.Other;
|
|
377
|
+
return IdentityType$1.Other;
|
|
378
378
|
case 'customerid':
|
|
379
|
-
return IdentityType.CustomerId;
|
|
379
|
+
return IdentityType$1.CustomerId;
|
|
380
380
|
case 'facebook':
|
|
381
|
-
return IdentityType.Facebook;
|
|
381
|
+
return IdentityType$1.Facebook;
|
|
382
382
|
case 'twitter':
|
|
383
|
-
return IdentityType.Twitter;
|
|
383
|
+
return IdentityType$1.Twitter;
|
|
384
384
|
case 'google':
|
|
385
|
-
return IdentityType.Google;
|
|
385
|
+
return IdentityType$1.Google;
|
|
386
386
|
case 'microsoft':
|
|
387
|
-
return IdentityType.Microsoft;
|
|
387
|
+
return IdentityType$1.Microsoft;
|
|
388
388
|
case 'yahoo':
|
|
389
|
-
return IdentityType.Yahoo;
|
|
389
|
+
return IdentityType$1.Yahoo;
|
|
390
390
|
case 'email':
|
|
391
|
-
return IdentityType.Email;
|
|
391
|
+
return IdentityType$1.Email;
|
|
392
392
|
case 'facebookcustomaudienceid':
|
|
393
|
-
return IdentityType.FacebookCustomAudienceId;
|
|
393
|
+
return IdentityType$1.FacebookCustomAudienceId;
|
|
394
394
|
case 'other2':
|
|
395
|
-
return IdentityType.Other2;
|
|
395
|
+
return IdentityType$1.Other2;
|
|
396
396
|
case 'other3':
|
|
397
|
-
return IdentityType.Other3;
|
|
397
|
+
return IdentityType$1.Other3;
|
|
398
398
|
case 'other4':
|
|
399
|
-
return IdentityType.Other4;
|
|
399
|
+
return IdentityType$1.Other4;
|
|
400
400
|
case 'other5':
|
|
401
|
-
return IdentityType.Other5;
|
|
401
|
+
return IdentityType$1.Other5;
|
|
402
402
|
case 'other6':
|
|
403
|
-
return IdentityType.Other6;
|
|
403
|
+
return IdentityType$1.Other6;
|
|
404
404
|
case 'other7':
|
|
405
|
-
return IdentityType.Other7;
|
|
405
|
+
return IdentityType$1.Other7;
|
|
406
406
|
case 'other8':
|
|
407
|
-
return IdentityType.Other8;
|
|
407
|
+
return IdentityType$1.Other8;
|
|
408
408
|
case 'other9':
|
|
409
|
-
return IdentityType.Other9;
|
|
409
|
+
return IdentityType$1.Other9;
|
|
410
410
|
case 'other10':
|
|
411
|
-
return IdentityType.Other10;
|
|
411
|
+
return IdentityType$1.Other10;
|
|
412
412
|
case 'mobile_number':
|
|
413
|
-
return IdentityType.MobileNumber;
|
|
413
|
+
return IdentityType$1.MobileNumber;
|
|
414
414
|
case 'phone_number_2':
|
|
415
|
-
return IdentityType.PhoneNumber2;
|
|
415
|
+
return IdentityType$1.PhoneNumber2;
|
|
416
416
|
case 'phone_number_3':
|
|
417
|
-
return IdentityType.PhoneNumber3;
|
|
417
|
+
return IdentityType$1.PhoneNumber3;
|
|
418
418
|
default:
|
|
419
419
|
return false;
|
|
420
420
|
}
|
|
421
421
|
};
|
|
422
|
-
IdentityType.getIdentityName = function (identityType) {
|
|
422
|
+
IdentityType$1.getIdentityName = function (identityType) {
|
|
423
423
|
switch (identityType) {
|
|
424
|
-
case IdentityType.Other:
|
|
424
|
+
case IdentityType$1.Other:
|
|
425
425
|
return 'other';
|
|
426
|
-
case IdentityType.CustomerId:
|
|
426
|
+
case IdentityType$1.CustomerId:
|
|
427
427
|
return 'customerid';
|
|
428
|
-
case IdentityType.Facebook:
|
|
428
|
+
case IdentityType$1.Facebook:
|
|
429
429
|
return 'facebook';
|
|
430
|
-
case IdentityType.Twitter:
|
|
430
|
+
case IdentityType$1.Twitter:
|
|
431
431
|
return 'twitter';
|
|
432
|
-
case IdentityType.Google:
|
|
432
|
+
case IdentityType$1.Google:
|
|
433
433
|
return 'google';
|
|
434
|
-
case IdentityType.Microsoft:
|
|
434
|
+
case IdentityType$1.Microsoft:
|
|
435
435
|
return 'microsoft';
|
|
436
|
-
case IdentityType.Yahoo:
|
|
436
|
+
case IdentityType$1.Yahoo:
|
|
437
437
|
return 'yahoo';
|
|
438
|
-
case IdentityType.Email:
|
|
438
|
+
case IdentityType$1.Email:
|
|
439
439
|
return 'email';
|
|
440
|
-
case IdentityType.FacebookCustomAudienceId:
|
|
440
|
+
case IdentityType$1.FacebookCustomAudienceId:
|
|
441
441
|
return 'facebookcustomaudienceid';
|
|
442
|
-
case IdentityType.Other2:
|
|
442
|
+
case IdentityType$1.Other2:
|
|
443
443
|
return 'other2';
|
|
444
|
-
case IdentityType.Other3:
|
|
444
|
+
case IdentityType$1.Other3:
|
|
445
445
|
return 'other3';
|
|
446
|
-
case IdentityType.Other4:
|
|
446
|
+
case IdentityType$1.Other4:
|
|
447
447
|
return 'other4';
|
|
448
|
-
case IdentityType.Other5:
|
|
448
|
+
case IdentityType$1.Other5:
|
|
449
449
|
return 'other5';
|
|
450
|
-
case IdentityType.Other6:
|
|
450
|
+
case IdentityType$1.Other6:
|
|
451
451
|
return 'other6';
|
|
452
|
-
case IdentityType.Other7:
|
|
452
|
+
case IdentityType$1.Other7:
|
|
453
453
|
return 'other7';
|
|
454
|
-
case IdentityType.Other8:
|
|
454
|
+
case IdentityType$1.Other8:
|
|
455
455
|
return 'other8';
|
|
456
|
-
case IdentityType.Other9:
|
|
456
|
+
case IdentityType$1.Other9:
|
|
457
457
|
return 'other9';
|
|
458
|
-
case IdentityType.Other10:
|
|
458
|
+
case IdentityType$1.Other10:
|
|
459
459
|
return 'other10';
|
|
460
|
-
case IdentityType.MobileNumber:
|
|
460
|
+
case IdentityType$1.MobileNumber:
|
|
461
461
|
return 'mobile_number';
|
|
462
|
-
case IdentityType.PhoneNumber2:
|
|
462
|
+
case IdentityType$1.PhoneNumber2:
|
|
463
463
|
return 'phone_number_2';
|
|
464
|
-
case IdentityType.PhoneNumber3:
|
|
464
|
+
case IdentityType$1.PhoneNumber3:
|
|
465
465
|
return 'phone_number_3';
|
|
466
466
|
}
|
|
467
467
|
};
|
|
@@ -570,10 +570,10 @@ var mParticle = (function () {
|
|
|
570
570
|
Development: 'development'
|
|
571
571
|
};
|
|
572
572
|
var Types = {
|
|
573
|
-
MessageType: MessageType$
|
|
573
|
+
MessageType: MessageType$2,
|
|
574
574
|
EventType: EventType,
|
|
575
575
|
CommerceEventType: CommerceEventType,
|
|
576
|
-
IdentityType: IdentityType,
|
|
576
|
+
IdentityType: IdentityType$1,
|
|
577
577
|
ProfileMessageType: ProfileMessageType,
|
|
578
578
|
ApplicationTransitionType: ApplicationTransitionType$1,
|
|
579
579
|
ProductActionType: ProductActionType,
|
|
@@ -582,7 +582,7 @@ var mParticle = (function () {
|
|
|
582
582
|
Environment: Environment
|
|
583
583
|
};
|
|
584
584
|
|
|
585
|
-
var version = "2.
|
|
585
|
+
var version = "2.22.0";
|
|
586
586
|
|
|
587
587
|
var Constants = {
|
|
588
588
|
sdkVersion: version,
|
|
@@ -733,7 +733,8 @@ var mParticle = (function () {
|
|
|
733
733
|
EventBatchingIntervalMillis: 'eventBatchingIntervalMillis',
|
|
734
734
|
OfflineStorage: 'offlineStorage'
|
|
735
735
|
},
|
|
736
|
-
DefaultInstance: 'default_instance'
|
|
736
|
+
DefaultInstance: 'default_instance',
|
|
737
|
+
CCPAPurpose: 'data_sale_opt_out'
|
|
737
738
|
};
|
|
738
739
|
|
|
739
740
|
function _typeof(obj) {
|
|
@@ -2619,6 +2620,43 @@ var mParticle = (function () {
|
|
|
2619
2620
|
}
|
|
2620
2621
|
};
|
|
2621
2622
|
|
|
2623
|
+
var KitFilterHelper = /** @class */function () {
|
|
2624
|
+
function KitFilterHelper() {}
|
|
2625
|
+
KitFilterHelper.hashEventType = function (eventType) {
|
|
2626
|
+
return generateHash(eventType);
|
|
2627
|
+
};
|
|
2628
|
+
KitFilterHelper.hashEventName = function (eventName, eventType) {
|
|
2629
|
+
return generateHash(eventType + eventName);
|
|
2630
|
+
};
|
|
2631
|
+
KitFilterHelper.hashEventAttributeKey = function (eventType, eventName, customAttributeName) {
|
|
2632
|
+
return generateHash(eventType + eventName + customAttributeName);
|
|
2633
|
+
};
|
|
2634
|
+
KitFilterHelper.hashUserAttribute = function (userAttributeKey) {
|
|
2635
|
+
return generateHash(userAttributeKey);
|
|
2636
|
+
};
|
|
2637
|
+
// User Identities are not actually hashed, this method is named this way to
|
|
2638
|
+
// be consistent with the filter class. UserIdentityType is also a number
|
|
2639
|
+
KitFilterHelper.hashUserIdentity = function (userIdentity) {
|
|
2640
|
+
return userIdentity;
|
|
2641
|
+
};
|
|
2642
|
+
KitFilterHelper.hashConsentPurpose = function (prefix, purpose) {
|
|
2643
|
+
return generateHash(prefix + purpose);
|
|
2644
|
+
};
|
|
2645
|
+
// The methods below are for conditional forwarding, a type of filter
|
|
2646
|
+
// hashAttributeCondiitonalForwarding is used for both User and Event
|
|
2647
|
+
// attribute keys and attribute values
|
|
2648
|
+
// The backend returns the hashes as strings for conditional forwarding
|
|
2649
|
+
// but returns "regular" filters as arrays of numbers
|
|
2650
|
+
// See IFilteringEventAttributeValue in configApiClient.ts as an example
|
|
2651
|
+
KitFilterHelper.hashAttributeConditionalForwarding = function (attribute) {
|
|
2652
|
+
return generateHash(attribute).toString();
|
|
2653
|
+
};
|
|
2654
|
+
KitFilterHelper.hashConsentPurposeConditionalForwarding = function (prefix, purpose) {
|
|
2655
|
+
return this.hashConsentPurpose(prefix, purpose).toString();
|
|
2656
|
+
};
|
|
2657
|
+
return KitFilterHelper;
|
|
2658
|
+
}();
|
|
2659
|
+
|
|
2622
2660
|
var StorageNames$1 = Constants.StorageNames;
|
|
2623
2661
|
function Helpers(mpInstance) {
|
|
2624
2662
|
var self = this;
|
|
@@ -2848,7 +2886,7 @@ var mParticle = (function () {
|
|
|
2848
2886
|
if (userIdentitiesObject && Object.keys(userIdentitiesObject).length) {
|
|
2849
2887
|
for (var userIdentityName in userIdentitiesObject) {
|
|
2850
2888
|
if (userIdentitiesObject.hasOwnProperty(userIdentityName)) {
|
|
2851
|
-
var userIdentityType = Types.IdentityType.getIdentityType(userIdentityName);
|
|
2889
|
+
var userIdentityType = KitFilterHelper.hashUserIdentity(Types.IdentityType.getIdentityType(userIdentityName));
|
|
2852
2890
|
if (!self.inArray(filterList, userIdentityType)) {
|
|
2853
2891
|
filteredUserIdentities[userIdentityName] = userIdentitiesObject[userIdentityName];
|
|
2854
2892
|
}
|
|
@@ -2862,7 +2900,7 @@ var mParticle = (function () {
|
|
|
2862
2900
|
if (userAttributes && Object.keys(userAttributes).length) {
|
|
2863
2901
|
for (var userAttribute in userAttributes) {
|
|
2864
2902
|
if (userAttributes.hasOwnProperty(userAttribute)) {
|
|
2865
|
-
var hashedUserAttribute =
|
|
2903
|
+
var hashedUserAttribute = KitFilterHelper.hashUserAttribute(userAttribute);
|
|
2866
2904
|
if (!self.inArray(filterList, hashedUserAttribute)) {
|
|
2867
2905
|
filteredUserAttributes[userAttribute] = userAttributes[userAttribute];
|
|
2868
2906
|
}
|
|
@@ -2872,7 +2910,7 @@ var mParticle = (function () {
|
|
|
2872
2910
|
return filteredUserAttributes;
|
|
2873
2911
|
};
|
|
2874
2912
|
this.isFilteredUserAttribute = function (userAttributeKey, filterList) {
|
|
2875
|
-
var hashedUserAttribute =
|
|
2913
|
+
var hashedUserAttribute = KitFilterHelper.hashUserAttribute(userAttributeKey);
|
|
2876
2914
|
return filterList && self.inArray(filterList, hashedUserAttribute);
|
|
2877
2915
|
};
|
|
2878
2916
|
this.isEventType = function (type) {
|
|
@@ -5198,8 +5236,8 @@ var mParticle = (function () {
|
|
|
5198
5236
|
if (userAttributes && mpInstance._Helpers.isObject(userAttributes) && Object.keys(userAttributes).length) {
|
|
5199
5237
|
for (var attrName in userAttributes) {
|
|
5200
5238
|
if (userAttributes.hasOwnProperty(attrName)) {
|
|
5201
|
-
attrHash =
|
|
5202
|
-
valueHash =
|
|
5239
|
+
attrHash = KitFilterHelper.hashAttributeConditionalForwarding(attrName);
|
|
5240
|
+
valueHash = KitFilterHelper.hashAttributeConditionalForwarding(userAttributes[attrName]);
|
|
5203
5241
|
if (attrHash === filterObject.userAttributeName && valueHash === filterObject.userAttributeValue) {
|
|
5204
5242
|
isMatch = true;
|
|
5205
5243
|
break;
|
|
@@ -5249,7 +5287,7 @@ var mParticle = (function () {
|
|
|
5249
5287
|
filterUserIdentities = function filterUserIdentities(event, filterList) {
|
|
5250
5288
|
if (event.UserIdentities && event.UserIdentities.length) {
|
|
5251
5289
|
event.UserIdentities.forEach(function (userIdentity, i) {
|
|
5252
|
-
if (mpInstance._Helpers.inArray(filterList, userIdentity.Type)) {
|
|
5290
|
+
if (mpInstance._Helpers.inArray(filterList, KitFilterHelper.hashUserIdentity(userIdentity.Type))) {
|
|
5253
5291
|
event.UserIdentities.splice(i, 1);
|
|
5254
5292
|
if (i > 0) {
|
|
5255
5293
|
i--;
|
|
@@ -5265,7 +5303,7 @@ var mParticle = (function () {
|
|
|
5265
5303
|
}
|
|
5266
5304
|
for (var attrName in event.EventAttributes) {
|
|
5267
5305
|
if (event.EventAttributes.hasOwnProperty(attrName)) {
|
|
5268
|
-
hash =
|
|
5306
|
+
hash = KitFilterHelper.hashEventAttributeKey(event.EventCategory, event.EventName, attrName);
|
|
5269
5307
|
if (mpInstance._Helpers.inArray(filterList, hash)) {
|
|
5270
5308
|
delete event.EventAttributes[attrName];
|
|
5271
5309
|
}
|
|
@@ -5282,8 +5320,8 @@ var mParticle = (function () {
|
|
|
5282
5320
|
},
|
|
5283
5321
|
forwardingRuleMessageTypes = [Types.MessageType.PageEvent, Types.MessageType.PageView, Types.MessageType.Commerce];
|
|
5284
5322
|
if (!mpInstance._Store.webviewBridgeEnabled && mpInstance._Store.activeForwarders) {
|
|
5285
|
-
hashedEventName =
|
|
5286
|
-
hashedEventType =
|
|
5323
|
+
hashedEventName = KitFilterHelper.hashEventName(event.EventName, event.EventCategory);
|
|
5324
|
+
hashedEventType = KitFilterHelper.hashEventType(event.EventCategory);
|
|
5287
5325
|
for (var i = 0; i < mpInstance._Store.activeForwarders.length; i++) {
|
|
5288
5326
|
// Check attribute forwarding rule. This rule allows users to only forward an event if a
|
|
5289
5327
|
// specific attribute exists and has a specific value. Alternatively, they can specify
|
|
@@ -5298,11 +5336,11 @@ var mParticle = (function () {
|
|
|
5298
5336
|
if (event.EventAttributes) {
|
|
5299
5337
|
for (var prop in event.EventAttributes) {
|
|
5300
5338
|
var hashedEventAttributeName;
|
|
5301
|
-
hashedEventAttributeName =
|
|
5339
|
+
hashedEventAttributeName = KitFilterHelper.hashAttributeConditionalForwarding(prop);
|
|
5302
5340
|
if (hashedEventAttributeName === mpInstance._Store.activeForwarders[i].filteringEventAttributeValue.eventAttributeName) {
|
|
5303
5341
|
foundProp = {
|
|
5304
5342
|
name: hashedEventAttributeName,
|
|
5305
|
-
value:
|
|
5343
|
+
value: KitFilterHelper.hashAttributeConditionalForwarding(event.EventAttributes[prop])
|
|
5306
5344
|
};
|
|
5307
5345
|
}
|
|
5308
5346
|
if (foundProp) {
|
|
@@ -5519,7 +5557,11 @@ var mParticle = (function () {
|
|
|
5519
5557
|
// which is typed { kits: Dictionary<constructor> }.
|
|
5520
5558
|
// The constructors are keyed by the name of the kit.
|
|
5521
5559
|
config.sideloadedKits.forEach(function (sideloadedKit) {
|
|
5522
|
-
|
|
5560
|
+
try {
|
|
5561
|
+
sideloadedKit.kitInstance.register(sideloadedKits);
|
|
5562
|
+
} catch (e) {
|
|
5563
|
+
console.error('Error registering sideloaded kit ' + sideloadedKit.kitInstance.name);
|
|
5564
|
+
}
|
|
5523
5565
|
});
|
|
5524
5566
|
|
|
5525
5567
|
// Then configure each kit
|
|
@@ -5583,7 +5625,7 @@ var mParticle = (function () {
|
|
|
5583
5625
|
}
|
|
5584
5626
|
|
|
5585
5627
|
// TODO: This file is no longer the server model because the web SDK payload
|
|
5586
|
-
var MessageType = Types.MessageType;
|
|
5628
|
+
var MessageType$1 = Types.MessageType;
|
|
5587
5629
|
var ApplicationTransitionType = Types.ApplicationTransitionType;
|
|
5588
5630
|
// TODO: Make this a pure function that returns a new object
|
|
5589
5631
|
function convertCustomFlags(event, dto) {
|
|
@@ -5769,7 +5811,7 @@ var mParticle = (function () {
|
|
|
5769
5811
|
CurrencyCode: mpInstance._Store.currencyCode,
|
|
5770
5812
|
DataPlan: mpInstance._Store.SDKConfig.dataPlan ? mpInstance._Store.SDKConfig.dataPlan : {}
|
|
5771
5813
|
};
|
|
5772
|
-
if (eventObject.EventDataType === MessageType.AppStateTransition) {
|
|
5814
|
+
if (eventObject.EventDataType === MessageType$1.AppStateTransition) {
|
|
5773
5815
|
eventObject.IsFirstRun = mpInstance._Store.isFirstRun;
|
|
5774
5816
|
eventObject.LaunchReferral = window.location.href || null;
|
|
5775
5817
|
}
|
|
@@ -5829,7 +5871,7 @@ var mParticle = (function () {
|
|
|
5829
5871
|
if (consent) {
|
|
5830
5872
|
dto.con = consent;
|
|
5831
5873
|
}
|
|
5832
|
-
if (event.EventDataType === MessageType.AppStateTransition) {
|
|
5874
|
+
if (event.EventDataType === MessageType$1.AppStateTransition) {
|
|
5833
5875
|
dto.fr = event.IsFirstRun;
|
|
5834
5876
|
dto.iu = false;
|
|
5835
5877
|
dto.at = ApplicationTransitionType.AppInit;
|
|
@@ -5841,7 +5883,7 @@ var mParticle = (function () {
|
|
|
5841
5883
|
if (event.CustomFlags) {
|
|
5842
5884
|
convertCustomFlags(event, dto);
|
|
5843
5885
|
}
|
|
5844
|
-
if (event.EventDataType === MessageType.Commerce) {
|
|
5886
|
+
if (event.EventDataType === MessageType$1.Commerce) {
|
|
5845
5887
|
dto.cu = event.CurrencyCode;
|
|
5846
5888
|
// TODO: If Cart is deprecated, we should deprecate this too
|
|
5847
5889
|
if (event.ShoppingCart) {
|
|
@@ -5882,7 +5924,7 @@ var mParticle = (function () {
|
|
|
5882
5924
|
};
|
|
5883
5925
|
});
|
|
5884
5926
|
}
|
|
5885
|
-
} else if (event.EventDataType === MessageType.Profile) {
|
|
5927
|
+
} else if (event.EventDataType === MessageType$1.Profile) {
|
|
5886
5928
|
dto.pet = event.ProfileMessageType;
|
|
5887
5929
|
}
|
|
5888
5930
|
return dto;
|
|
@@ -6987,8 +7029,7 @@ var mParticle = (function () {
|
|
|
6987
7029
|
};
|
|
6988
7030
|
}
|
|
6989
7031
|
|
|
6990
|
-
|
|
6991
|
-
var CCPAPurpose = 'data_sale_opt_out';
|
|
7032
|
+
var CCPAPurpose = Constants.CCPAPurpose;
|
|
6992
7033
|
function Consent(mpInstance) {
|
|
6993
7034
|
var self = this;
|
|
6994
7035
|
// this function is called when consent is required to
|
|
@@ -7009,19 +7050,19 @@ var mParticle = (function () {
|
|
|
7009
7050
|
// GDPR - '1' + purpose name
|
|
7010
7051
|
// CCPA - '2data_sale_opt_out' (there is only 1 purpose of data_sale_opt_out for CCPA)
|
|
7011
7052
|
var GDPRConsentHashPrefix = '1';
|
|
7012
|
-
var
|
|
7053
|
+
var CCPAHashPrefix = '2';
|
|
7013
7054
|
var gdprConsentState = consentState.getGDPRConsentState();
|
|
7014
7055
|
if (gdprConsentState) {
|
|
7015
7056
|
for (var purpose in gdprConsentState) {
|
|
7016
7057
|
if (gdprConsentState.hasOwnProperty(purpose)) {
|
|
7017
|
-
purposeHash =
|
|
7058
|
+
purposeHash = KitFilterHelper.hashConsentPurposeConditionalForwarding(GDPRConsentHashPrefix, purpose);
|
|
7018
7059
|
purposeHashes[purposeHash] = gdprConsentState[purpose].Consented;
|
|
7019
7060
|
}
|
|
7020
7061
|
}
|
|
7021
7062
|
}
|
|
7022
7063
|
var CCPAConsentState = consentState.getCCPAConsentState();
|
|
7023
7064
|
if (CCPAConsentState) {
|
|
7024
|
-
purposeHash =
|
|
7065
|
+
purposeHash = KitFilterHelper.hashConsentPurposeConditionalForwarding(CCPAHashPrefix, CCPAPurpose);
|
|
7025
7066
|
purposeHashes[purposeHash] = CCPAConsentState.Consented;
|
|
7026
7067
|
}
|
|
7027
7068
|
}
|
|
@@ -9034,6 +9075,7 @@ var mParticle = (function () {
|
|
|
9034
9075
|
},
|
|
9035
9076
|
_resetForTests: mockFunction,
|
|
9036
9077
|
_APIClient: null,
|
|
9078
|
+
MPSideloadedKit: null,
|
|
9037
9079
|
_Consent: null,
|
|
9038
9080
|
_Forwarders: null,
|
|
9039
9081
|
_NativeSdkHelpers: null,
|
|
@@ -9135,6 +9177,113 @@ var mParticle = (function () {
|
|
|
9135
9177
|
return _BatchValidator;
|
|
9136
9178
|
}();
|
|
9137
9179
|
|
|
9180
|
+
var EventTypeEnum;
|
|
9181
|
+
(function (EventTypeEnum) {
|
|
9182
|
+
EventTypeEnum[EventTypeEnum["Unknown"] = 0] = "Unknown";
|
|
9183
|
+
EventTypeEnum[EventTypeEnum["Navigation"] = 1] = "Navigation";
|
|
9184
|
+
EventTypeEnum[EventTypeEnum["Location"] = 2] = "Location";
|
|
9185
|
+
EventTypeEnum[EventTypeEnum["Search"] = 3] = "Search";
|
|
9186
|
+
EventTypeEnum[EventTypeEnum["Transaction"] = 4] = "Transaction";
|
|
9187
|
+
EventTypeEnum[EventTypeEnum["UserContent"] = 5] = "UserContent";
|
|
9188
|
+
EventTypeEnum[EventTypeEnum["UserPreference"] = 6] = "UserPreference";
|
|
9189
|
+
EventTypeEnum[EventTypeEnum["Social"] = 7] = "Social";
|
|
9190
|
+
EventTypeEnum[EventTypeEnum["Other"] = 8] = "Other";
|
|
9191
|
+
EventTypeEnum[EventTypeEnum["Media"] = 9] = "Media";
|
|
9192
|
+
})(EventTypeEnum || (EventTypeEnum = {}));
|
|
9193
|
+
// TODO: https://mparticle-eng.atlassian.net/browse/SQDSDKS-5403
|
|
9194
|
+
var MessageType;
|
|
9195
|
+
(function (MessageType) {
|
|
9196
|
+
MessageType[MessageType["SessionStart"] = 1] = "SessionStart";
|
|
9197
|
+
MessageType[MessageType["SessionEnd"] = 2] = "SessionEnd";
|
|
9198
|
+
MessageType[MessageType["PageView"] = 3] = "PageView";
|
|
9199
|
+
MessageType[MessageType["PageEvent"] = 4] = "PageEvent";
|
|
9200
|
+
MessageType[MessageType["CrashReport"] = 5] = "CrashReport";
|
|
9201
|
+
MessageType[MessageType["OptOut"] = 6] = "OptOut";
|
|
9202
|
+
MessageType[MessageType["AppStateTransition"] = 10] = "AppStateTransition";
|
|
9203
|
+
MessageType[MessageType["Profile"] = 14] = "Profile";
|
|
9204
|
+
MessageType[MessageType["Commerce"] = 16] = "Commerce";
|
|
9205
|
+
MessageType[MessageType["UserAttributeChange"] = 17] = "UserAttributeChange";
|
|
9206
|
+
MessageType[MessageType["UserIdentityChange"] = 18] = "UserIdentityChange";
|
|
9207
|
+
MessageType[MessageType["Media"] = 20] = "Media";
|
|
9208
|
+
})(MessageType || (MessageType = {}));
|
|
9209
|
+
var IdentityType;
|
|
9210
|
+
(function (IdentityType) {
|
|
9211
|
+
IdentityType[IdentityType["Other"] = 0] = "Other";
|
|
9212
|
+
IdentityType[IdentityType["CustomerId"] = 1] = "CustomerId";
|
|
9213
|
+
IdentityType[IdentityType["Facebook"] = 2] = "Facebook";
|
|
9214
|
+
IdentityType[IdentityType["Twitter"] = 3] = "Twitter";
|
|
9215
|
+
IdentityType[IdentityType["Google"] = 4] = "Google";
|
|
9216
|
+
IdentityType[IdentityType["Microsoft"] = 5] = "Microsoft";
|
|
9217
|
+
IdentityType[IdentityType["Yahoo"] = 6] = "Yahoo";
|
|
9218
|
+
IdentityType[IdentityType["Email"] = 7] = "Email";
|
|
9219
|
+
IdentityType[IdentityType["FacebookCustomAudienceId"] = 9] = "FacebookCustomAudienceId";
|
|
9220
|
+
IdentityType[IdentityType["Other2"] = 10] = "Other2";
|
|
9221
|
+
IdentityType[IdentityType["Other3"] = 11] = "Other3";
|
|
9222
|
+
IdentityType[IdentityType["Other4"] = 12] = "Other4";
|
|
9223
|
+
IdentityType[IdentityType["Other5"] = 13] = "Other5";
|
|
9224
|
+
IdentityType[IdentityType["Other6"] = 14] = "Other6";
|
|
9225
|
+
IdentityType[IdentityType["Other7"] = 15] = "Other7";
|
|
9226
|
+
IdentityType[IdentityType["Other8"] = 16] = "Other8";
|
|
9227
|
+
IdentityType[IdentityType["Other9"] = 17] = "Other9";
|
|
9228
|
+
IdentityType[IdentityType["Other10"] = 18] = "Other10";
|
|
9229
|
+
IdentityType[IdentityType["MobileNumber"] = 19] = "MobileNumber";
|
|
9230
|
+
IdentityType[IdentityType["PhoneNumber2"] = 20] = "PhoneNumber2";
|
|
9231
|
+
IdentityType[IdentityType["PhoneNumber3"] = 21] = "PhoneNumber3";
|
|
9232
|
+
})(IdentityType || (IdentityType = {}));
|
|
9233
|
+
|
|
9234
|
+
var MPSideloadedKit = /** @class */function () {
|
|
9235
|
+
function MPSideloadedKit(unregisteredKitInstance) {
|
|
9236
|
+
this.filterDictionary = {
|
|
9237
|
+
eventTypeFilters: [],
|
|
9238
|
+
eventNameFilters: [],
|
|
9239
|
+
screenNameFilters: [],
|
|
9240
|
+
screenAttributeFilters: [],
|
|
9241
|
+
userIdentityFilters: [],
|
|
9242
|
+
userAttributeFilters: [],
|
|
9243
|
+
attributeFilters: [],
|
|
9244
|
+
consentRegulationFilters: [],
|
|
9245
|
+
consentRegulationPurposeFilters: [],
|
|
9246
|
+
messageTypeFilters: [],
|
|
9247
|
+
messageTypeStateFilters: [],
|
|
9248
|
+
// The below filtering members are optional, but we instantiate them
|
|
9249
|
+
// to simplify public method assignment
|
|
9250
|
+
filteringEventAttributeValue: {},
|
|
9251
|
+
filteringUserAttributeValue: {},
|
|
9252
|
+
filteringConsentRuleValues: {}
|
|
9253
|
+
};
|
|
9254
|
+
this.kitInstance = unregisteredKitInstance;
|
|
9255
|
+
}
|
|
9256
|
+
MPSideloadedKit.prototype.addEventTypeFilter = function (eventType) {
|
|
9257
|
+
var hashedEventType = KitFilterHelper.hashEventType(eventType);
|
|
9258
|
+
this.filterDictionary.eventTypeFilters.push(hashedEventType);
|
|
9259
|
+
};
|
|
9260
|
+
MPSideloadedKit.prototype.addEventNameFilter = function (eventType, eventName) {
|
|
9261
|
+
var hashedEventName = KitFilterHelper.hashEventName(eventName, eventType);
|
|
9262
|
+
this.filterDictionary.eventNameFilters.push(hashedEventName);
|
|
9263
|
+
};
|
|
9264
|
+
MPSideloadedKit.prototype.addEventAttributeFilter = function (eventType, eventName, customAttributeKey) {
|
|
9265
|
+
var hashedEventAttribute = KitFilterHelper.hashEventAttributeKey(eventType, eventName, customAttributeKey);
|
|
9266
|
+
this.filterDictionary.attributeFilters.push(hashedEventAttribute);
|
|
9267
|
+
};
|
|
9268
|
+
MPSideloadedKit.prototype.addScreenNameFilter = function (screenName) {
|
|
9269
|
+
var hashedScreenName = KitFilterHelper.hashEventName(screenName, EventTypeEnum.Unknown);
|
|
9270
|
+
this.filterDictionary.screenNameFilters.push(hashedScreenName);
|
|
9271
|
+
};
|
|
9272
|
+
MPSideloadedKit.prototype.addScreenAttributeFilter = function (screenName, screenAttribute) {
|
|
9273
|
+
var hashedScreenAttribute = KitFilterHelper.hashEventAttributeKey(EventTypeEnum.Unknown, screenName, screenAttribute);
|
|
9274
|
+
this.filterDictionary.screenAttributeFilters.push(hashedScreenAttribute);
|
|
9275
|
+
};
|
|
9276
|
+
MPSideloadedKit.prototype.addUserIdentityFilter = function (userIdentity) {
|
|
9277
|
+
var hashedIdentityType = KitFilterHelper.hashUserIdentity(userIdentity);
|
|
9278
|
+
this.filterDictionary.userIdentityFilters.push(hashedIdentityType);
|
|
9279
|
+
};
|
|
9280
|
+
MPSideloadedKit.prototype.addUserAttributeFilter = function (userAttributeKey) {
|
|
9281
|
+
var hashedUserAttributeKey = KitFilterHelper.hashUserAttribute(userAttributeKey);
|
|
9282
|
+
this.filterDictionary.userAttributeFilters.push(hashedUserAttributeKey);
|
|
9283
|
+
};
|
|
9284
|
+
return MPSideloadedKit;
|
|
9285
|
+
}();
|
|
9286
|
+
|
|
9138
9287
|
if (!Array.prototype.forEach) {
|
|
9139
9288
|
Array.prototype.forEach = Polyfill.forEach;
|
|
9140
9289
|
}
|
|
@@ -9157,6 +9306,7 @@ var mParticle = (function () {
|
|
|
9157
9306
|
this.CommerceEventType = Types.CommerceEventType;
|
|
9158
9307
|
this.PromotionType = Types.PromotionActionType;
|
|
9159
9308
|
this.ProductActionType = Types.ProductActionType;
|
|
9309
|
+
this.MPSideloadedKit = MPSideloadedKit;
|
|
9160
9310
|
if (typeof window !== 'undefined') {
|
|
9161
9311
|
this.isIOS = window.mParticle && window.mParticle.isIOS ? window.mParticle.isIOS : false;
|
|
9162
9312
|
this.config = window.mParticle && window.mParticle.config ? window.mParticle.config : {};
|
package/package.json
CHANGED
package/src/configAPIClient.ts
CHANGED
|
@@ -14,7 +14,7 @@ export type SDKCompleteInitCallback = (
|
|
|
14
14
|
mpInstance: MParticleWebSDK
|
|
15
15
|
) => void;
|
|
16
16
|
|
|
17
|
-
export interface IKitConfigs {
|
|
17
|
+
export interface IKitConfigs extends IKitFilterSettings {
|
|
18
18
|
name: string;
|
|
19
19
|
moduleId: number;
|
|
20
20
|
isDebug: boolean;
|
|
@@ -22,30 +22,39 @@ export interface IKitConfigs {
|
|
|
22
22
|
isDebugString: BooleanStringLowerCase;
|
|
23
23
|
hasDebugString: BooleanStringLowerCase;
|
|
24
24
|
settings: Dictionary;
|
|
25
|
+
eventSubscriptionId: number;
|
|
26
|
+
excludeAnonymousUser: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface IKitFilterSettings {
|
|
30
|
+
eventTypeFilters: number[];
|
|
31
|
+
eventNameFilters: number[];
|
|
25
32
|
screenNameFilters: number[];
|
|
26
33
|
screenAttributeFilters: number[];
|
|
27
34
|
userIdentityFilters: number[];
|
|
28
35
|
userAttributeFilters: number[];
|
|
29
|
-
eventNameFilters: number[];
|
|
30
|
-
eventTypeFilters: number[];
|
|
31
36
|
attributeFilters: number[];
|
|
32
|
-
filteringEventAttributeValue
|
|
33
|
-
filteringUserAttributeValue
|
|
34
|
-
filteringConsentRuleValues
|
|
37
|
+
filteringEventAttributeValue?: IFilteringEventAttributeValue;
|
|
38
|
+
filteringUserAttributeValue?: IFilteringUserAttributeValue;
|
|
39
|
+
filteringConsentRuleValues?: IFilteringConsentRuleValues;
|
|
35
40
|
consentRegulationFilters: number[];
|
|
36
41
|
consentRegulationPurposeFilters: number[];
|
|
37
42
|
messageTypeFilters: number[];
|
|
38
43
|
messageTypeStateFilters: number[];
|
|
39
|
-
eventSubscriptionId: number;
|
|
40
|
-
excludeAnonymousUser: boolean;
|
|
41
44
|
}
|
|
42
45
|
|
|
43
|
-
export interface
|
|
46
|
+
export interface IFilteringEventAttributeValue {
|
|
44
47
|
eventAttributeName: string;
|
|
45
48
|
eventAttributeValue: string;
|
|
46
49
|
includeOnMatch: boolean
|
|
47
50
|
}
|
|
48
|
-
|
|
51
|
+
|
|
52
|
+
export interface IFilteringUserAttributeValue {
|
|
53
|
+
userAttributeName: string;
|
|
54
|
+
userAttributeValue: string;
|
|
55
|
+
includeOnMatch: boolean
|
|
56
|
+
}
|
|
57
|
+
export interface IFilteringConsentRuleValues {
|
|
49
58
|
includeOnMatch: boolean;
|
|
50
59
|
values: IConsentRuleValue[];
|
|
51
60
|
}
|