@mparticle/web-sdk 2.21.1 → 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.
@@ -0,0 +1,124 @@
1
+ import KitFilterHelper from './kitFilterHelper';
2
+ import {
3
+ IFilteringConsentRuleValues,
4
+ IFilteringEventAttributeValue,
5
+ IFilteringUserAttributeValue,
6
+ IKitFilterSettings,
7
+ } from './configAPIClient';
8
+ import { UnregisteredKit } from './forwarders.interfaces';
9
+ import { EventTypeEnum, IdentityType } from './types.interfaces';
10
+
11
+ export interface IMPSideloadedKit {
12
+ kitInstance: UnregisteredKit;
13
+ filterDictionary: IKitFilterSettings;
14
+
15
+ addEventTypeFilter(eventType: EventTypeEnum): void;
16
+ addEventNameFilter(eventType: EventTypeEnum, eventName: string): void;
17
+ addEventAttributeFilter(
18
+ eventType: EventTypeEnum,
19
+ eventName: string,
20
+ customAttributeKey: string
21
+ ): void;
22
+ addScreenNameFilter(screenName: string): void;
23
+ addScreenAttributeFilter(screenName: string, screenAttribute: string): void;
24
+ addUserIdentityFilter(userIdentity: IdentityType): void;
25
+ addUserAttributeFilter(userAttributeKey: string): void;
26
+ }
27
+
28
+ // This constructor is necessary to be able ot call new on mParticle.SideloadedKit
29
+ // https://stackoverflow.com/questions/13407036/how-does-interfaces-with-construct-signatures-work
30
+ export interface IMPSideloadedKitConstructor {
31
+ new(unregisteredKitInstance: UnregisteredKit): IMPSideloadedKit;
32
+ }
33
+
34
+ export default class MPSideloadedKit implements IMPSideloadedKit{
35
+ public kitInstance: UnregisteredKit;
36
+ public filterDictionary: IKitFilterSettings = {
37
+ eventTypeFilters: [],
38
+ eventNameFilters: [],
39
+ screenNameFilters: [],
40
+ screenAttributeFilters: [],
41
+ userIdentityFilters: [],
42
+ userAttributeFilters: [],
43
+ attributeFilters: [],
44
+ consentRegulationFilters: [],
45
+ consentRegulationPurposeFilters: [],
46
+ messageTypeFilters: [],
47
+ messageTypeStateFilters: [],
48
+
49
+ // The below filtering members are optional, but we instantiate them
50
+ // to simplify public method assignment
51
+ filteringEventAttributeValue: {} as IFilteringEventAttributeValue,
52
+ filteringUserAttributeValue: {} as IFilteringUserAttributeValue,
53
+ filteringConsentRuleValues: {} as IFilteringConsentRuleValues,
54
+ };
55
+
56
+ constructor(unregisteredKitInstance: UnregisteredKit) {
57
+ this.kitInstance = unregisteredKitInstance;
58
+ }
59
+
60
+ public addEventTypeFilter(eventType: EventTypeEnum): void {
61
+ const hashedEventType = KitFilterHelper.hashEventType(eventType);
62
+ this.filterDictionary.eventTypeFilters.push(hashedEventType);
63
+ }
64
+
65
+ public addEventNameFilter(
66
+ eventType: EventTypeEnum,
67
+ eventName: string
68
+ ): void {
69
+ const hashedEventName = KitFilterHelper.hashEventName(
70
+ eventName,
71
+ eventType
72
+ );
73
+ this.filterDictionary.eventNameFilters.push(hashedEventName);
74
+ }
75
+
76
+ public addEventAttributeFilter(
77
+ eventType: EventTypeEnum,
78
+ eventName: string,
79
+ customAttributeKey: string
80
+ ): void {
81
+ const hashedEventAttribute = KitFilterHelper.hashEventAttributeKey(
82
+ eventType,
83
+ eventName,
84
+ customAttributeKey
85
+ );
86
+ this.filterDictionary.attributeFilters.push(hashedEventAttribute);
87
+ }
88
+
89
+ public addScreenNameFilter(screenName: string): void {
90
+ const hashedScreenName = KitFilterHelper.hashEventName(
91
+ screenName,
92
+ EventTypeEnum.Unknown
93
+ );
94
+ this.filterDictionary.screenNameFilters.push(hashedScreenName);
95
+ }
96
+
97
+ public addScreenAttributeFilter(
98
+ screenName: string,
99
+ screenAttribute: string
100
+ ): void {
101
+ const hashedScreenAttribute = KitFilterHelper.hashEventAttributeKey(
102
+ EventTypeEnum.Unknown,
103
+ screenName,
104
+ screenAttribute
105
+ );
106
+ this.filterDictionary.screenAttributeFilters.push(
107
+ hashedScreenAttribute
108
+ );
109
+ }
110
+
111
+ public addUserIdentityFilter(userIdentity: IdentityType): void {
112
+ const hashedIdentityType = KitFilterHelper.hashUserIdentity(
113
+ userIdentity
114
+ );
115
+ this.filterDictionary.userIdentityFilters.push(hashedIdentityType);
116
+ }
117
+
118
+ public addUserAttributeFilter(userAttributeKey: string): void {
119
+ const hashedUserAttributeKey = KitFilterHelper.hashUserAttribute(
120
+ userAttributeKey
121
+ );
122
+ this.filterDictionary.userAttributeFilters.push(hashedUserAttributeKey);
123
+ }
124
+ }
package/src/store.ts CHANGED
@@ -416,13 +416,6 @@ export default function Store(
416
416
  if (!config.hasOwnProperty('flags')) {
417
417
  this.SDKConfig.flags = {};
418
418
  }
419
- if (
420
- !this.SDKConfig.flags.hasOwnProperty(
421
- Constants.FeatureFlags.EventsV3
422
- )
423
- ) {
424
- this.SDKConfig.flags[Constants.FeatureFlags.EventsV3] = 0;
425
- }
426
419
  if (
427
420
  !this.SDKConfig.flags.hasOwnProperty(
428
421
  Constants.FeatureFlags.EventBatchingIntervalMillis
@@ -0,0 +1,52 @@
1
+ export enum EventTypeEnum {
2
+ Unknown,
3
+ Navigation,
4
+ Location,
5
+ Search,
6
+ Transaction,
7
+ UserContent,
8
+ UserPreference,
9
+ Social,
10
+ Other,
11
+ Media,
12
+ }
13
+
14
+ // TODO: https://mparticle-eng.atlassian.net/browse/SQDSDKS-5403
15
+ export enum MessageType {
16
+ SessionStart = 1,
17
+ SessionEnd = 2,
18
+ PageView = 3,
19
+ PageEvent = 4,
20
+ CrashReport = 5,
21
+ OptOut = 6,
22
+ AppStateTransition = 10,
23
+ Profile = 14,
24
+ Commerce = 16,
25
+ UserAttributeChange = 17,
26
+ UserIdentityChange = 18,
27
+ Media = 20,
28
+ };
29
+
30
+ export enum IdentityType {
31
+ Other = 0,
32
+ CustomerId = 1,
33
+ Facebook = 2,
34
+ Twitter = 3,
35
+ Google = 4,
36
+ Microsoft = 5,
37
+ Yahoo = 6,
38
+ Email = 7,
39
+ FacebookCustomAudienceId = 9,
40
+ Other2 = 10,
41
+ Other3 = 11,
42
+ Other4 = 12,
43
+ Other5 = 13,
44
+ Other6 = 14,
45
+ Other7 = 15,
46
+ Other8 = 16,
47
+ Other9 = 17,
48
+ Other10 = 18,
49
+ MobileNumber = 19,
50
+ PhoneNumber2 = 20,
51
+ PhoneNumber3 = 21,
52
+ }