@mparticle/web-sdk 2.32.2 → 2.32.4
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 +46 -74
- package/dist/mparticle.esm.js +46 -74
- package/dist/mparticle.js +558 -579
- package/package.json +1 -1
- package/src/apiClient.ts +8 -4
- package/src/batchUploader.ts +35 -28
- package/src/configAPIClient.ts +3 -3
- package/src/consent.ts +2 -8
- package/src/constants.ts +8 -0
- package/src/cookieSyncManager.ts +2 -2
- package/src/ecommerce.interfaces.ts +201 -0
- package/src/ecommerce.js +9 -0
- package/src/events.interfaces.ts +83 -0
- package/src/events.js +3 -0
- package/src/forwarders.interfaces.ts +0 -3
- package/src/identity-user-interfaces.ts +12 -12
- package/src/identity.js +2 -3
- package/src/identityApiClient.ts +125 -58
- package/src/integrationCapture.ts +19 -15
- package/src/kitBlocking.ts +3 -2
- package/src/kitFilterHelper.ts +6 -7
- package/src/mockBatchCreator.ts +5 -6
- package/src/{mp-instance.js → mp-instance.ts} +110 -61
- package/src/{mparticle-instance-manager.js → mparticle-instance-manager.ts} +29 -16
- package/src/nativeSdkHelpers.interfaces.ts +1 -1
- package/src/pre-init-utils.ts +11 -0
- package/src/sdkRuntimeModels.ts +93 -50
- package/src/sdkToEventsApiConverter.ts +3 -3
- package/src/serverModel.ts +4 -4
- package/src/sessionManager.ts +2 -2
- package/src/sideloadedKit.ts +12 -11
- package/src/store.ts +7 -6
- package/src/types.ts +404 -0
- package/src/uploaders.ts +5 -3
- package/src/utils.ts +1 -1
- package/src/type-utils.ts +0 -66
- package/src/types.interfaces.ts +0 -56
- package/src/types.js +0 -338
package/src/sdkRuntimeModels.ts
CHANGED
|
@@ -3,20 +3,19 @@ import { DataPlanVersion } from '@mparticle/data-planning-models';
|
|
|
3
3
|
import {
|
|
4
4
|
MPConfiguration,
|
|
5
5
|
MPID,
|
|
6
|
-
|
|
6
|
+
SDKEventOptions,
|
|
7
|
+
SDKEventAttrs,
|
|
8
|
+
Callback,
|
|
7
9
|
} from '@mparticle/web-sdk';
|
|
8
|
-
import { IStore } from './store';
|
|
10
|
+
import { IntegrationAttribute, IntegrationAttributes, IStore, WrapperSDKTypes } from './store';
|
|
9
11
|
import Validators from './validators';
|
|
10
|
-
import { Dictionary } from './utils';
|
|
11
|
-
import { IServerModel } from './serverModel';
|
|
12
|
+
import { Dictionary, valueof } from './utils';
|
|
12
13
|
import { IKitConfigs } from './configAPIClient';
|
|
13
14
|
import { SDKConsentApi, SDKConsentState } from './consent';
|
|
14
|
-
import
|
|
15
|
-
import { IMPSideloadedKit } from './sideloadedKit';
|
|
15
|
+
import MPSideloadedKit from './sideloadedKit';
|
|
16
16
|
import { ISessionManager } from './sessionManager';
|
|
17
17
|
import { Kit, MPForwarder } from './forwarders.interfaces';
|
|
18
18
|
import {
|
|
19
|
-
IIdentity,
|
|
20
19
|
SDKIdentityApi,
|
|
21
20
|
IAliasCallback,
|
|
22
21
|
} from './identity.interfaces';
|
|
@@ -28,10 +27,18 @@ import {
|
|
|
28
27
|
IdentityCallback,
|
|
29
28
|
ISDKUserAttributes,
|
|
30
29
|
} from './identity-user-interfaces';
|
|
31
|
-
import {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
import {
|
|
31
|
+
CommerceEventType,
|
|
32
|
+
EventType,
|
|
33
|
+
IdentityType,
|
|
34
|
+
ProductActionType,
|
|
35
|
+
PromotionActionType,
|
|
36
|
+
} from './types';
|
|
37
|
+
import { IPixelConfiguration } from './cookieSyncManager';
|
|
38
|
+
import _BatchValidator from './mockBatchCreator';
|
|
39
|
+
import { SDKECommerceAPI } from './ecommerce.interfaces';
|
|
40
|
+
import { IErrorLogMessage, IMParticleWebSDKInstance, IntegrationDelays } from './mp-instance';
|
|
41
|
+
import Constants from './constants';
|
|
35
42
|
|
|
36
43
|
// TODO: Resolve this with version in @mparticle/web-sdk
|
|
37
44
|
export type SDKEventCustomFlags = Dictionary<any>;
|
|
@@ -61,7 +68,7 @@ export interface SDKEvent {
|
|
|
61
68
|
AppName?: string;
|
|
62
69
|
Package?: string;
|
|
63
70
|
ConsentState?: SDKConsentState;
|
|
64
|
-
IntegrationAttributes?:
|
|
71
|
+
IntegrationAttributes?: IntegrationAttributes;
|
|
65
72
|
ProductAction?: SDKProductAction;
|
|
66
73
|
PromotionAction?: SDKPromotionAction;
|
|
67
74
|
ProductImpressions?: SDKProductImpression[];
|
|
@@ -99,6 +106,11 @@ export interface SDKPromotion {
|
|
|
99
106
|
Position?: string;
|
|
100
107
|
}
|
|
101
108
|
|
|
109
|
+
export interface SDKImpression {
|
|
110
|
+
Name: string;
|
|
111
|
+
Product: SDKProduct;
|
|
112
|
+
}
|
|
113
|
+
|
|
102
114
|
export interface SDKProductImpression {
|
|
103
115
|
ProductImpressionList?: string;
|
|
104
116
|
ProductList?: SDKProduct[];
|
|
@@ -142,72 +154,98 @@ export interface SDKProduct {
|
|
|
142
154
|
Position?: number;
|
|
143
155
|
CouponCode?: string;
|
|
144
156
|
TotalAmount?: number;
|
|
145
|
-
Attributes?: { [key: string]: string };
|
|
146
|
-
}
|
|
147
157
|
|
|
148
|
-
//
|
|
149
|
-
|
|
150
|
-
logEvent?(event: BaseEvent): void;
|
|
158
|
+
// https://go.mparticle.com/work/SQDSDKS-4801
|
|
159
|
+
Attributes?: Record<string, unknown> | null;
|
|
151
160
|
}
|
|
152
161
|
|
|
162
|
+
// https://go.mparticle.com/work/SQDSDKS-6949
|
|
153
163
|
export interface MParticleWebSDK {
|
|
154
164
|
addForwarder(mockForwarder: MPForwarder): void;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
165
|
+
IdentityType: valueof<typeof IdentityType>;
|
|
166
|
+
CommerceEventType: valueof<typeof CommerceEventType>;
|
|
167
|
+
EventType: valueof<typeof EventType>;
|
|
168
|
+
PromotionType: valueof<typeof PromotionActionType>;
|
|
158
169
|
Identity: SDKIdentityApi;
|
|
159
170
|
Logger: SDKLoggerApi;
|
|
160
|
-
MPSideloadedKit: IMPSideloadedKit;
|
|
161
|
-
_APIClient: any; // TODO: Set up API Client
|
|
162
|
-
_CookieSyncManager: ICookieSyncManager;
|
|
163
|
-
_Store: IStore;
|
|
164
|
-
_Forwarders: any;
|
|
165
|
-
_Helpers: SDKHelpersApi;
|
|
166
|
-
_Events: IEvents;
|
|
167
|
-
config: SDKInitConfig;
|
|
168
|
-
_ServerModel: IServerModel;
|
|
169
|
-
_SessionManager: ISessionManager;
|
|
170
|
-
_Consent: SDKConsentApi;
|
|
171
171
|
Consent: SDKConsentApi;
|
|
172
|
-
_NativeSdkHelpers: INativeSdkHelpers;
|
|
173
|
-
_Persistence: IPersistence;
|
|
174
|
-
_preInit: any; // TODO: Set up API
|
|
175
|
-
_instances?: Dictionary<MParticleWebSDK>;
|
|
176
|
-
_isTestEnv?: boolean;
|
|
177
172
|
_resetForTests(
|
|
178
173
|
MPConfig?: SDKInitConfig,
|
|
179
174
|
keepPersistence?: boolean,
|
|
180
|
-
instance?:
|
|
175
|
+
instance?: IMParticleWebSDKInstance,
|
|
181
176
|
): void;
|
|
177
|
+
configurePixel(config: IPixelConfiguration): void;
|
|
182
178
|
endSession(): void;
|
|
183
|
-
identifyRequest: IdentityApiData;
|
|
184
179
|
init(apiKey: string, config: SDKInitConfig, instanceName?: string): void;
|
|
185
180
|
_getActiveForwarders(): MPForwarder[];
|
|
181
|
+
_getIntegrationDelays(): IntegrationDelays;
|
|
182
|
+
_setIntegrationDelay(module: number, shouldDelayIntegration: boolean): void;
|
|
183
|
+
_setWrapperSDKInfo(name: WrapperSDKTypes, version: string): void;
|
|
186
184
|
getAppName(): string;
|
|
187
185
|
getAppVersion(): string;
|
|
188
186
|
getDeviceId(): string;
|
|
189
187
|
setDeviceId(deviceId: string): void;
|
|
188
|
+
getEnvironment(): valueof<typeof Constants.Environment>;
|
|
190
189
|
setSessionAttribute(key: string, value: string): void;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
upload();
|
|
190
|
+
getVersion(): string;
|
|
191
|
+
upload(): void;
|
|
194
192
|
setLogLevel(logLevel: LogLevelType): void;
|
|
195
193
|
setPosition(lat: number | string, lng: number | string): void;
|
|
196
194
|
startNewSession(): void;
|
|
197
195
|
logEvent(
|
|
198
196
|
eventName: string,
|
|
199
|
-
eventType?:
|
|
200
|
-
attrs?:
|
|
201
|
-
customFlags?: SDKEventCustomFlags
|
|
197
|
+
eventType?: valueof<typeof EventType>,
|
|
198
|
+
attrs?: SDKEventAttrs,
|
|
199
|
+
customFlags?: SDKEventCustomFlags,
|
|
200
|
+
eventOptions?: SDKEventOptions
|
|
202
201
|
): void;
|
|
203
|
-
logBaseEvent(event:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
202
|
+
logBaseEvent(event: BaseEvent, eventOptions?: SDKEventOptions): void;
|
|
203
|
+
logError(error: IErrorLogMessage, attrs?: SDKEventAttrs): void;
|
|
204
|
+
logLink(selector: string, eventName: string, eventType: valueof<typeof EventType>, eventInfo: SDKEventAttrs): void;
|
|
205
|
+
logForm(selector: string, eventName: string, eventType: valueof<typeof EventType>, eventInfo: SDKEventAttrs): void;
|
|
206
|
+
logPageView(eventName: string, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, eventOptions?: SDKEventOptions): void;
|
|
207
|
+
setOptOut(isOptingOut: boolean): void;
|
|
208
|
+
eCommerce: SDKECommerceAPI;
|
|
209
|
+
isInitialized(): boolean;
|
|
210
|
+
ProductActionType: valueof<typeof ProductActionType>;
|
|
211
|
+
ready(f: Function): void;
|
|
212
|
+
reset(instance: IMParticleWebSDKInstance): void;
|
|
213
|
+
setAppName(name: string): void;
|
|
214
|
+
setAppVersion(version: string): void;
|
|
215
|
+
setOptOut(isOptingOut: boolean): void;
|
|
216
|
+
|
|
217
|
+
// https://go.mparticle.com/work/SQDSDKS-7063
|
|
218
|
+
startTrackingLocation(callback?: Callback): void;
|
|
219
|
+
|
|
220
|
+
stopTrackingLocation(): void;
|
|
207
221
|
generateHash(value: string): string;
|
|
222
|
+
setIntegrationAttribute(integrationModuleId: number, attrs: IntegrationAttribute): void;
|
|
223
|
+
getIntegrationAttributes(integrationModuleId: number): IntegrationAttribute;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// https://go.mparticle.com/work/SQDSDKS-4805
|
|
227
|
+
|
|
228
|
+
// https://go.mparticle.com/work/SQDSDKS-6949
|
|
229
|
+
export interface IMParticleInstanceManager extends MParticleWebSDK {
|
|
230
|
+
// https://go.mparticle.com/work/SQDSDKS-5053
|
|
231
|
+
// Private Properties
|
|
232
|
+
_BatchValidator: _BatchValidator;
|
|
233
|
+
_instances: Dictionary<IMParticleWebSDKInstance>;
|
|
234
|
+
_isTestEnv?: boolean;
|
|
235
|
+
|
|
236
|
+
// Public Properties
|
|
237
|
+
config: SDKInitConfig;
|
|
208
238
|
isIOS?: boolean;
|
|
239
|
+
MPSideloadedKit: typeof MPSideloadedKit;
|
|
240
|
+
// https://go.mparticle.com/work/SQDSDKS-7060
|
|
241
|
+
sessionManager: Pick<ISessionManager, 'getSession'>;
|
|
242
|
+
Store: IStore;
|
|
243
|
+
|
|
244
|
+
// Public Methods
|
|
245
|
+
getInstance(instanceName?: string): IMParticleWebSDKInstance;
|
|
209
246
|
}
|
|
210
247
|
|
|
248
|
+
|
|
211
249
|
// Used in cases where server requires booleans as strings
|
|
212
250
|
export type BooleanStringLowerCase = 'false' | 'true';
|
|
213
251
|
export type BooleanStringTitleCase = 'False' | 'True';
|
|
@@ -254,6 +292,8 @@ export interface SDKInitConfig
|
|
|
254
292
|
|
|
255
293
|
// https://go.mparticle.com/work/SQDSDKS-6460
|
|
256
294
|
identityCallback?: IdentityCallback;
|
|
295
|
+
|
|
296
|
+
rq?: Function[] | any[];
|
|
257
297
|
}
|
|
258
298
|
|
|
259
299
|
export interface DataPlanConfig {
|
|
@@ -269,6 +309,7 @@ export interface SDKHelpersApi {
|
|
|
269
309
|
createServiceUrl(url: string, devToken?: string): string;
|
|
270
310
|
createXHR?(cb: () => void): XMLHttpRequest;
|
|
271
311
|
extend?(...args: any[]);
|
|
312
|
+
findKeyInObject?(obj: any, key: string): string;
|
|
272
313
|
parseNumber?(value: string | number): number;
|
|
273
314
|
generateUniqueId();
|
|
274
315
|
generateHash?(value: string): string;
|
|
@@ -284,6 +325,7 @@ export interface SDKHelpersApi {
|
|
|
284
325
|
timeoutStart: number,
|
|
285
326
|
now: number
|
|
286
327
|
): boolean;
|
|
328
|
+
isEventType?(type: valueof<typeof EventType>): boolean;
|
|
287
329
|
isObject?(item: any);
|
|
288
330
|
invokeCallback?(
|
|
289
331
|
callback: IdentityCallback,
|
|
@@ -293,7 +335,7 @@ export interface SDKHelpersApi {
|
|
|
293
335
|
previousMpid?: MPID
|
|
294
336
|
): void;
|
|
295
337
|
sanitizeAttributes?(
|
|
296
|
-
attrs:
|
|
338
|
+
attrs: SDKEventAttrs,
|
|
297
339
|
name: string
|
|
298
340
|
): Dictionary<string> | null;
|
|
299
341
|
Validators: typeof Validators;
|
|
@@ -303,6 +345,7 @@ export interface SDKLoggerApi {
|
|
|
303
345
|
error(arg0: string): void;
|
|
304
346
|
verbose(arg0: string): void;
|
|
305
347
|
warning(arg0: string): void;
|
|
348
|
+
setLogLevel(logLevel: LogLevelType): void;
|
|
306
349
|
}
|
|
307
350
|
|
|
308
351
|
// TODO: Merge this with IStore in store.ts
|
|
@@ -326,7 +369,7 @@ export interface BaseEvent {
|
|
|
326
369
|
messageType: number;
|
|
327
370
|
name?: string;
|
|
328
371
|
eventType?: number;
|
|
329
|
-
data?:
|
|
372
|
+
data?: SDKEventAttrs;
|
|
330
373
|
customFlags?: { [key: string]: string };
|
|
331
374
|
toEventAPIObject?(): SDKEvent;
|
|
332
375
|
sourceMessageId?: string;
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
SDKProduct,
|
|
5
5
|
SDKPromotion,
|
|
6
6
|
SDKProductActionType,
|
|
7
|
-
MParticleWebSDK,
|
|
8
7
|
} from './sdkRuntimeModels';
|
|
9
8
|
import * as EventsApi from '@mparticle/event-models';
|
|
10
9
|
import {
|
|
@@ -17,6 +16,7 @@ import { Dictionary, isEmpty } from './utils';
|
|
|
17
16
|
import { ISDKUserIdentity } from './identity-user-interfaces';
|
|
18
17
|
import { SDKIdentityTypeEnum } from './identity.interfaces';
|
|
19
18
|
import Constants from './constants';
|
|
19
|
+
import { IMParticleWebSDKInstance } from './mp-instance';
|
|
20
20
|
|
|
21
21
|
const {
|
|
22
22
|
FeatureFlags
|
|
@@ -35,7 +35,7 @@ interface Batch extends EventsApi.Batch {
|
|
|
35
35
|
export function convertEvents(
|
|
36
36
|
mpid: string,
|
|
37
37
|
sdkEvents: SDKEvent[],
|
|
38
|
-
mpInstance:
|
|
38
|
+
mpInstance: IMParticleWebSDKInstance
|
|
39
39
|
): Batch | null {
|
|
40
40
|
if (!mpid) {
|
|
41
41
|
return null;
|
|
@@ -373,7 +373,7 @@ export function convertProducts(
|
|
|
373
373
|
price: sdkProduct.Price,
|
|
374
374
|
quantity: sdkProduct.Quantity,
|
|
375
375
|
coupon_code: sdkProduct.CouponCode,
|
|
376
|
-
custom_attributes: sdkProduct.Attributes,
|
|
376
|
+
custom_attributes: sdkProduct.Attributes as Record<string, string>,
|
|
377
377
|
};
|
|
378
378
|
products.push(product);
|
|
379
379
|
}
|
package/src/serverModel.ts
CHANGED
|
@@ -6,7 +6,6 @@ import Types from './types';
|
|
|
6
6
|
import Constants from './constants';
|
|
7
7
|
import {
|
|
8
8
|
BaseEvent,
|
|
9
|
-
MParticleWebSDK,
|
|
10
9
|
SDKEvent,
|
|
11
10
|
SDKEventCustomFlags,
|
|
12
11
|
SDKGeoLocation,
|
|
@@ -27,6 +26,7 @@ import {
|
|
|
27
26
|
SDKConsentState,
|
|
28
27
|
} from './consent';
|
|
29
28
|
import { IMParticleUser, ISDKUserIdentity } from './identity-user-interfaces';
|
|
29
|
+
import { IMParticleWebSDKInstance } from './mp-instance';
|
|
30
30
|
|
|
31
31
|
const MessageType = Types.MessageType;
|
|
32
32
|
const ApplicationTransitionType = Types.ApplicationTransitionType;
|
|
@@ -110,7 +110,7 @@ export interface IProductV2DTO {
|
|
|
110
110
|
ps: number;
|
|
111
111
|
cc: string | number;
|
|
112
112
|
tpa: number;
|
|
113
|
-
attrs:
|
|
113
|
+
attrs: Dictionary<string> | null;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
export interface IPromotionV2DTO {
|
|
@@ -181,7 +181,7 @@ function convertProductToV2DTO(product: SDKProduct): IProductV2DTO {
|
|
|
181
181
|
ps: parseNumber(product.Position),
|
|
182
182
|
cc: parseStringOrNumber(product.CouponCode),
|
|
183
183
|
tpa: parseNumber(product.TotalAmount),
|
|
184
|
-
attrs: product.Attributes,
|
|
184
|
+
attrs: product.Attributes as Dictionary<string> | null,
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
187
|
|
|
@@ -197,7 +197,7 @@ function convertProductListToV2DTO(productList: SDKProduct[]): IProductV2DTO[] {
|
|
|
197
197
|
|
|
198
198
|
export default function ServerModel(
|
|
199
199
|
this: IServerModel,
|
|
200
|
-
mpInstance:
|
|
200
|
+
mpInstance: IMParticleWebSDKInstance
|
|
201
201
|
) {
|
|
202
202
|
var self = this;
|
|
203
203
|
|
package/src/sessionManager.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { MPID } from '@mparticle/web-sdk';
|
|
2
2
|
import Constants from './constants';
|
|
3
3
|
import { IPersistenceMinified } from './persistence.interfaces';
|
|
4
|
-
import { MParticleWebSDK } from './sdkRuntimeModels';
|
|
5
4
|
import Types from './types';
|
|
6
5
|
import { generateDeprecationMessage } from './utils';
|
|
7
6
|
import { IMParticleUser } from './identity-user-interfaces';
|
|
7
|
+
import { IMParticleWebSDKInstance } from './mp-instance';
|
|
8
8
|
|
|
9
9
|
const { Messages } = Constants;
|
|
10
10
|
|
|
@@ -26,7 +26,7 @@ export interface ISessionManager {
|
|
|
26
26
|
|
|
27
27
|
export default function SessionManager(
|
|
28
28
|
this: ISessionManager,
|
|
29
|
-
mpInstance:
|
|
29
|
+
mpInstance: IMParticleWebSDKInstance
|
|
30
30
|
) {
|
|
31
31
|
const self = this;
|
|
32
32
|
|
package/src/sideloadedKit.ts
CHANGED
|
@@ -6,22 +6,23 @@ import {
|
|
|
6
6
|
IKitFilterSettings,
|
|
7
7
|
} from './configAPIClient';
|
|
8
8
|
import { UnregisteredKit } from './forwarders.interfaces';
|
|
9
|
-
import {
|
|
9
|
+
import { EventType, IdentityType } from './types';
|
|
10
|
+
import { valueof } from './utils';
|
|
10
11
|
|
|
11
12
|
export interface IMPSideloadedKit {
|
|
12
13
|
kitInstance: UnregisteredKit;
|
|
13
14
|
filterDictionary: IKitFilterSettings;
|
|
14
15
|
|
|
15
|
-
addEventTypeFilter(eventType:
|
|
16
|
-
addEventNameFilter(eventType:
|
|
16
|
+
addEventTypeFilter(eventType: valueof<typeof EventType>): void;
|
|
17
|
+
addEventNameFilter(eventType: valueof<typeof EventType>, eventName: string): void;
|
|
17
18
|
addEventAttributeFilter(
|
|
18
|
-
eventType:
|
|
19
|
+
eventType: valueof<typeof EventType>,
|
|
19
20
|
eventName: string,
|
|
20
21
|
customAttributeKey: string
|
|
21
22
|
): void;
|
|
22
23
|
addScreenNameFilter(screenName: string): void;
|
|
23
24
|
addScreenAttributeFilter(screenName: string, screenAttribute: string): void;
|
|
24
|
-
addUserIdentityFilter(userIdentity: IdentityType): void;
|
|
25
|
+
addUserIdentityFilter(userIdentity: typeof IdentityType): void;
|
|
25
26
|
addUserAttributeFilter(userAttributeKey: string): void;
|
|
26
27
|
}
|
|
27
28
|
|
|
@@ -57,13 +58,13 @@ export default class MPSideloadedKit implements IMPSideloadedKit{
|
|
|
57
58
|
this.kitInstance = unregisteredKitInstance;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
public addEventTypeFilter(eventType:
|
|
61
|
+
public addEventTypeFilter(eventType: valueof<typeof EventType>): void {
|
|
61
62
|
const hashedEventType = KitFilterHelper.hashEventType(eventType);
|
|
62
63
|
this.filterDictionary.eventTypeFilters.push(hashedEventType);
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
public addEventNameFilter(
|
|
66
|
-
eventType:
|
|
67
|
+
eventType: valueof<typeof EventType>,
|
|
67
68
|
eventName: string
|
|
68
69
|
): void {
|
|
69
70
|
const hashedEventName = KitFilterHelper.hashEventName(
|
|
@@ -74,7 +75,7 @@ export default class MPSideloadedKit implements IMPSideloadedKit{
|
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
public addEventAttributeFilter(
|
|
77
|
-
eventType:
|
|
78
|
+
eventType: valueof<typeof EventType>,
|
|
78
79
|
eventName: string,
|
|
79
80
|
customAttributeKey: string
|
|
80
81
|
): void {
|
|
@@ -89,7 +90,7 @@ export default class MPSideloadedKit implements IMPSideloadedKit{
|
|
|
89
90
|
public addScreenNameFilter(screenName: string): void {
|
|
90
91
|
const hashedScreenName = KitFilterHelper.hashEventName(
|
|
91
92
|
screenName,
|
|
92
|
-
|
|
93
|
+
EventType.Unknown,
|
|
93
94
|
);
|
|
94
95
|
this.filterDictionary.screenNameFilters.push(hashedScreenName);
|
|
95
96
|
}
|
|
@@ -99,7 +100,7 @@ export default class MPSideloadedKit implements IMPSideloadedKit{
|
|
|
99
100
|
screenAttribute: string
|
|
100
101
|
): void {
|
|
101
102
|
const hashedScreenAttribute = KitFilterHelper.hashEventAttributeKey(
|
|
102
|
-
|
|
103
|
+
EventType.Unknown,
|
|
103
104
|
screenName,
|
|
104
105
|
screenAttribute
|
|
105
106
|
);
|
|
@@ -108,7 +109,7 @@ export default class MPSideloadedKit implements IMPSideloadedKit{
|
|
|
108
109
|
);
|
|
109
110
|
}
|
|
110
111
|
|
|
111
|
-
public addUserIdentityFilter(userIdentity: IdentityType): void {
|
|
112
|
+
public addUserIdentityFilter(userIdentity: typeof IdentityType): void {
|
|
112
113
|
const hashedIdentityType = KitFilterHelper.hashUserIdentity(
|
|
113
114
|
userIdentity
|
|
114
115
|
);
|
package/src/store.ts
CHANGED
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
DataPlanResult,
|
|
14
14
|
KitBlockerOptions,
|
|
15
15
|
LogLevelType,
|
|
16
|
-
MParticleWebSDK,
|
|
17
16
|
SDKDataPlan,
|
|
18
17
|
SDKEvent,
|
|
19
18
|
SDKGeoLocation,
|
|
@@ -38,6 +37,7 @@ import {
|
|
|
38
37
|
IPersistenceMinified,
|
|
39
38
|
} from './persistence.interfaces';
|
|
40
39
|
import { CookieSyncDates, IPixelConfiguration } from './cookieSyncManager';
|
|
40
|
+
import { IMParticleWebSDKInstance } from './mp-instance';
|
|
41
41
|
|
|
42
42
|
// This represents the runtime configuration of the SDK AFTER
|
|
43
43
|
// initialization has been complete and all settings and
|
|
@@ -121,10 +121,10 @@ function createSDKConfig(config: SDKInitConfig): SDKConfig {
|
|
|
121
121
|
// to TypeScript
|
|
122
122
|
export type ServerSettings = Dictionary;
|
|
123
123
|
export type SessionAttributes = Dictionary;
|
|
124
|
-
export type
|
|
125
|
-
|
|
126
|
-
type WrapperSDKTypes = 'flutter' | 'none';
|
|
127
|
-
interface WrapperSDKInfo {
|
|
124
|
+
export type IntegrationAttribute = Dictionary<string>;
|
|
125
|
+
export type IntegrationAttributes = Dictionary<IntegrationAttribute>;
|
|
126
|
+
export type WrapperSDKTypes = 'flutter' | 'none';
|
|
127
|
+
export interface WrapperSDKInfo {
|
|
128
128
|
name: WrapperSDKTypes;
|
|
129
129
|
version: string | null;
|
|
130
130
|
isInfoSet: boolean;
|
|
@@ -142,6 +142,7 @@ export interface IFeatureFlags {
|
|
|
142
142
|
// Temporary Interface until Store can be refactored as a class
|
|
143
143
|
export interface IStore {
|
|
144
144
|
isEnabled: boolean;
|
|
145
|
+
isInitialized: boolean;
|
|
145
146
|
sessionAttributes: SessionAttributes;
|
|
146
147
|
currentSessionMPIDs: MPID[];
|
|
147
148
|
consentState: SDKConsentState | null;
|
|
@@ -213,7 +214,7 @@ export interface IStore {
|
|
|
213
214
|
export default function Store(
|
|
214
215
|
this: IStore,
|
|
215
216
|
config: SDKInitConfig,
|
|
216
|
-
mpInstance:
|
|
217
|
+
mpInstance: IMParticleWebSDKInstance,
|
|
217
218
|
apiKey?: string
|
|
218
219
|
) {
|
|
219
220
|
const {
|