@mparticle/web-sdk
Advanced tools
Comparing version 2.21.2 to 2.22.0
{ | ||
"name": "@mparticle/web-sdk", | ||
"version": "2.21.2", | ||
"version": "2.22.0", | ||
"description": "mParticle core SDK for web applications", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -17,3 +17,3 @@ import { DataPlanConfig } from '@mparticle/web-sdk'; | ||
export interface IKitConfigs { | ||
export interface IKitConfigs extends IKitFilterSettings { | ||
name: string; | ||
@@ -26,2 +26,9 @@ moduleId: number; | ||
settings: Dictionary; | ||
eventSubscriptionId: number; | ||
excludeAnonymousUser: boolean; | ||
} | ||
export interface IKitFilterSettings { | ||
eventTypeFilters: number[]; | ||
eventNameFilters: number[]; | ||
screenNameFilters: number[]; | ||
@@ -31,8 +38,6 @@ screenAttributeFilters: number[]; | ||
userAttributeFilters: number[]; | ||
eventNameFilters: number[]; | ||
eventTypeFilters: number[]; | ||
attributeFilters: number[]; | ||
filteringEventAttributeValue: IFilteringAttributeValue; | ||
filteringUserAttributeValue: IFilteringAttributeValue; | ||
filteringConsentRuleValues: IFilteringConsentRulesValue; | ||
filteringEventAttributeValue?: IFilteringEventAttributeValue; | ||
filteringUserAttributeValue?: IFilteringUserAttributeValue; | ||
filteringConsentRuleValues?: IFilteringConsentRuleValues; | ||
consentRegulationFilters: number[]; | ||
@@ -42,7 +47,5 @@ consentRegulationPurposeFilters: number[]; | ||
messageTypeStateFilters: number[]; | ||
eventSubscriptionId: number; | ||
excludeAnonymousUser: boolean; | ||
} | ||
export interface IFilteringAttributeValue { | ||
export interface IFilteringEventAttributeValue { | ||
eventAttributeName: string; | ||
@@ -52,3 +55,9 @@ eventAttributeValue: string; | ||
} | ||
export interface IFilteringConsentRulesValue { | ||
export interface IFilteringUserAttributeValue { | ||
userAttributeName: string; | ||
userAttributeValue: string; | ||
includeOnMatch: boolean | ||
} | ||
export interface IFilteringConsentRuleValues { | ||
includeOnMatch: boolean; | ||
@@ -55,0 +64,0 @@ values: IConsentRuleValue[]; |
@@ -9,5 +9,6 @@ import { | ||
import { Dictionary, isObject } from './utils'; | ||
import KitFilterHelper from './kitFilterHelper'; | ||
import Constants from './constants'; | ||
// Specifies to compiler that CCPAPurpose can only be one specific value | ||
export const CCPAPurpose = 'data_sale_opt_out' as const; | ||
const { CCPAPurpose } = Constants; | ||
@@ -148,3 +149,3 @@ export interface IMinifiedConsentJSONObject { | ||
const GDPRConsentHashPrefix = '1'; | ||
const CCPAHashString = '2' + CCPAPurpose; | ||
const CCPAHashPrefix = '2'; | ||
@@ -155,5 +156,3 @@ const gdprConsentState = consentState.getGDPRConsentState(); | ||
if (gdprConsentState.hasOwnProperty(purpose)) { | ||
purposeHash = mpInstance._Helpers | ||
.generateHash(GDPRConsentHashPrefix + purpose) | ||
.toString(); | ||
purposeHash = KitFilterHelper.hashConsentPurposeConditionalForwarding(GDPRConsentHashPrefix, purpose); | ||
purposeHashes[purposeHash] = | ||
@@ -166,5 +165,3 @@ gdprConsentState[purpose].Consented; | ||
if (CCPAConsentState) { | ||
purposeHash = mpInstance._Helpers | ||
.generateHash(CCPAHashString) | ||
.toString(); | ||
purposeHash = KitFilterHelper.hashConsentPurposeConditionalForwarding(CCPAHashPrefix, CCPAPurpose); | ||
purposeHashes[purposeHash] = CCPAConsentState.Consented; | ||
@@ -171,0 +168,0 @@ } |
@@ -166,4 +166,5 @@ import { version } from '../package.json'; | ||
DefaultInstance: 'default_instance', | ||
CCPAPurpose: 'data_sale_opt_out' | ||
} as const; | ||
export default Constants; |
import Types from './types'; | ||
import filteredMparticleUser from './filteredMparticleUser'; | ||
import { isEmpty } from './utils'; | ||
import KitFilterHelper from './kitFilterHelper'; | ||
@@ -113,8 +114,8 @@ export default function Forwarders(mpInstance, kitBlocker) { | ||
if (userAttributes.hasOwnProperty(attrName)) { | ||
attrHash = mpInstance._Helpers | ||
.generateHash(attrName) | ||
.toString(); | ||
valueHash = mpInstance._Helpers | ||
.generateHash(userAttributes[attrName]) | ||
.toString(); | ||
attrHash = KitFilterHelper.hashAttributeConditionalForwarding( | ||
attrName | ||
); | ||
valueHash = KitFilterHelper.hashAttributeConditionalForwarding( | ||
userAttributes[attrName] | ||
); | ||
@@ -181,3 +182,5 @@ if ( | ||
filterList, | ||
userIdentity.Type | ||
KitFilterHelper.hashUserIdentity( | ||
userIdentity.Type | ||
) | ||
) | ||
@@ -203,4 +206,6 @@ ) { | ||
if (event.EventAttributes.hasOwnProperty(attrName)) { | ||
hash = mpInstance._Helpers.generateHash( | ||
event.EventCategory + event.EventName + attrName | ||
hash = KitFilterHelper.hashEventAttributeKey( | ||
event.EventCategory, | ||
event.EventName, | ||
attrName | ||
); | ||
@@ -233,6 +238,7 @@ | ||
) { | ||
hashedEventName = mpInstance._Helpers.generateHash( | ||
event.EventCategory + event.EventName | ||
hashedEventName = KitFilterHelper.hashEventName( | ||
event.EventName, | ||
event.EventCategory | ||
); | ||
hashedEventType = mpInstance._Helpers.generateHash( | ||
hashedEventType = KitFilterHelper.hashEventType( | ||
event.EventCategory | ||
@@ -268,5 +274,5 @@ ); | ||
var hashedEventAttributeName; | ||
hashedEventAttributeName = mpInstance._Helpers | ||
.generateHash(prop) | ||
.toString(); | ||
hashedEventAttributeName = KitFilterHelper.hashAttributeConditionalForwarding( | ||
prop | ||
); | ||
@@ -281,7 +287,5 @@ if ( | ||
name: hashedEventAttributeName, | ||
value: mpInstance._Helpers | ||
.generateHash( | ||
event.EventAttributes[prop] | ||
) | ||
.toString(), | ||
value: KitFilterHelper.hashAttributeConditionalForwarding( | ||
event.EventAttributes[prop] | ||
), | ||
}; | ||
@@ -629,3 +633,10 @@ } | ||
config.sideloadedKits.forEach(function(sideloadedKit) { | ||
sideloadedKit.register(sideloadedKits); | ||
try { | ||
sideloadedKit.kitInstance.register(sideloadedKits); | ||
} catch (e) { | ||
console.error( | ||
'Error registering sideloaded kit ' + | ||
sideloadedKit.kitInstance.name | ||
); | ||
} | ||
}); | ||
@@ -632,0 +643,0 @@ |
@@ -5,2 +5,3 @@ import Types from './types'; | ||
import Validators from './validators'; | ||
import KitFilterHelper from './kitFilterHelper'; | ||
@@ -310,9 +311,9 @@ var StorageNames = Constants.StorageNames; | ||
) { | ||
var filteredUserIdentities = {}; | ||
const filteredUserIdentities = {}; | ||
if (userIdentitiesObject && Object.keys(userIdentitiesObject).length) { | ||
for (var userIdentityName in userIdentitiesObject) { | ||
for (const userIdentityName in userIdentitiesObject) { | ||
if (userIdentitiesObject.hasOwnProperty(userIdentityName)) { | ||
var userIdentityType = Types.IdentityType.getIdentityType( | ||
userIdentityName | ||
const userIdentityType = KitFilterHelper.hashUserIdentity( | ||
Types.IdentityType.getIdentityType(userIdentityName) | ||
); | ||
@@ -336,3 +337,5 @@ if (!self.inArray(filterList, userIdentityType)) { | ||
if (userAttributes.hasOwnProperty(userAttribute)) { | ||
var hashedUserAttribute = self.generateHash(userAttribute); | ||
const hashedUserAttribute = KitFilterHelper.hashUserAttribute( | ||
userAttribute | ||
); | ||
if (!self.inArray(filterList, hashedUserAttribute)) { | ||
@@ -350,3 +353,5 @@ filteredUserAttributes[userAttribute] = | ||
this.isFilteredUserAttribute = function(userAttributeKey, filterList) { | ||
const hashedUserAttribute = self.generateHash(userAttributeKey); | ||
const hashedUserAttribute = KitFilterHelper.hashUserAttribute( | ||
userAttributeKey | ||
); | ||
return filterList && self.inArray(filterList, hashedUserAttribute); | ||
@@ -353,0 +358,0 @@ }; |
@@ -8,2 +8,3 @@ // This file is used ONLY for the mParticle ESLint plugin. It should NOT be used otherwise! | ||
import { Batch } from '@mparticle/event-models'; | ||
import { IMPSideloadedKit} from './sideloadedKit'; | ||
@@ -35,2 +36,3 @@ const mockFunction = function() { | ||
_APIClient: null, | ||
MPSideloadedKit: null, | ||
_Consent: null, | ||
@@ -37,0 +39,0 @@ _Forwarders: null, |
@@ -6,2 +6,3 @@ import Polyfill from './polyfill'; | ||
import _BatchValidator from './mockBatchCreator'; | ||
import MPSideloadedKit from './sideloadedKit'; | ||
@@ -34,2 +35,4 @@ if (!Array.prototype.forEach) { | ||
this.ProductActionType = Types.ProductActionType; | ||
this.MPSideloadedKit = MPSideloadedKit; | ||
if (typeof window !== 'undefined') { | ||
@@ -36,0 +39,0 @@ this.isIOS = |
@@ -11,3 +11,3 @@ import * as EventsApi from '@mparticle/event-models'; | ||
import { IPersistence } from './persistence.interfaces'; | ||
import { IMPSideloadedKit } from './sideloadedKit'; | ||
// TODO: Resolve this with version in @mparticle/web-sdk | ||
@@ -134,2 +134,3 @@ export type SDKEventCustomFlags = Dictionary<any>; | ||
Logger: SDKLoggerApi; | ||
MPSideloadedKit: IMPSideloadedKit; | ||
_APIClient: any; // TODO: Set up API Client | ||
@@ -136,0 +137,0 @@ _Store: IStore; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1474176
43
26134