@mparticle/web-sdk 2.60.1 → 2.62.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 +22 -22
- package/dist/mparticle.esm.js +22 -22
- package/dist/mparticle.js +118 -173
- package/dist/types/src/apiClient.d.ts +34 -0
- package/dist/types/src/audience.d.ts +4 -0
- package/dist/types/src/audienceManager.d.ts +19 -0
- package/dist/types/src/batchUploader.d.ts +72 -0
- package/dist/types/src/configAPIClient.d.ts +68 -0
- package/dist/types/src/consent.d.ts +71 -0
- package/dist/types/src/constants.d.ts +201 -0
- package/dist/types/src/cookieConsentManager.d.ts +50 -0
- package/dist/types/src/cookieSyncManager.d.ts +34 -0
- package/dist/types/src/ecommerce.d.ts +52 -0
- package/dist/types/src/ecommerce.interfaces.d.ts +78 -0
- package/dist/types/src/events.d.ts +17 -0
- package/dist/types/src/events.interfaces.d.ts +21 -0
- package/dist/types/src/filteredMparticleUser.d.ts +8 -0
- package/dist/types/src/foregroundTimeTracker.d.ts +21 -0
- package/dist/types/src/forwarders.d.ts +26 -0
- package/dist/types/src/forwarders.interfaces.d.ts +59 -0
- package/dist/types/src/forwardingStatsUploader.d.ts +5 -0
- package/dist/types/src/helpers.d.ts +54 -0
- package/dist/types/src/identity-user-interfaces.d.ts +106 -0
- package/dist/types/src/identity-utils.d.ts +36 -0
- package/dist/types/src/identity.interfaces.d.ts +117 -0
- package/dist/types/src/identityApiClient.d.ts +14 -0
- package/dist/types/src/integrationCapture.d.ts +83 -0
- package/dist/types/src/internal-types.d.ts +20 -0
- package/dist/types/src/kitBlocking.d.ts +116 -0
- package/dist/types/src/kitFilterHelper.d.ts +15 -0
- package/dist/types/src/logger.d.ts +18 -0
- package/dist/types/src/mockBatchCreator.d.ts +7 -0
- package/dist/types/src/mp-instance.d.ts +76 -0
- package/dist/types/src/mparticle-instance-manager.d.ts +2 -0
- package/dist/types/src/nativeSdkHelpers.d.ts +12 -0
- package/dist/types/src/nativeSdkHelpers.interfaces.d.ts +10 -0
- package/dist/types/src/persistence.d.ts +44 -0
- package/dist/types/src/persistence.interfaces.d.ts +73 -0
- package/dist/types/src/polyfill.d.ts +15 -0
- package/dist/types/src/pre-init-utils.d.ts +11 -0
- package/dist/types/src/public-types.d.ts +23 -0
- package/dist/types/src/reporting/errorReportingDispatcher.d.ts +8 -0
- package/dist/types/src/reporting/loggingDispatcher.d.ts +8 -0
- package/dist/types/src/reporting/types.d.ts +37 -0
- package/dist/types/src/roktManager.d.ts +176 -0
- package/dist/types/src/sdkRuntimeModels.d.ts +319 -0
- package/dist/types/src/sdkToEventsApiConverter.d.ts +43 -0
- package/dist/types/src/serverModel.d.ts +105 -0
- package/dist/types/src/sessionManager.d.ts +16 -0
- package/dist/types/src/sideloadedKit.d.ts +30 -0
- package/dist/types/src/store.d.ts +157 -0
- package/dist/types/src/stub/mparticle.stub.d.ts +182 -0
- package/dist/types/src/types.d.ts +154 -0
- package/dist/types/src/uploaders.d.ts +21 -0
- package/dist/types/src/user-utils.d.ts +5 -0
- package/dist/types/src/utils.d.ts +82 -0
- package/dist/types/src/validators.d.ts +18 -0
- package/dist/types/src/vault.d.ts +41 -0
- package/package.json +16 -3
- package/src/apiClient.ts +1 -1
- package/src/constants.ts +0 -4
- package/src/forwarders.interfaces.ts +42 -0
- package/src/identityApiClient.ts +9 -6
- package/src/internal-types.ts +66 -0
- package/src/logger.ts +3 -12
- package/src/mp-instance.ts +28 -15
- package/src/mparticle-instance-manager.ts +6 -0
- package/src/public-types.ts +84 -0
- package/src/reporting/errorReportingDispatcher.ts +21 -0
- package/src/reporting/loggingDispatcher.ts +21 -0
- package/src/reporting/types.ts +45 -0
- package/src/roktManager.ts +32 -6
- package/src/sdkRuntimeModels.ts +3 -1
- package/src/serverModel.ts +1 -1
- package/src/store.ts +1 -3
- package/src/logging/reportingLogger.ts +0 -192
- package/src/logging/types.ts +0 -32
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import * as EventsApi from '@mparticle/event-models';
|
|
2
|
+
import { DataPlanVersion } from '@mparticle/data-planning-models';
|
|
3
|
+
import { MPConfiguration, MPID, SDKEventOptions, SDKEventAttrs, Callback } from '@mparticle/web-sdk';
|
|
4
|
+
import { IntegrationAttribute, IntegrationAttributes, IStore, WrapperSDKTypes } from './store';
|
|
5
|
+
import Validators from './validators';
|
|
6
|
+
import { Dictionary, valueof } from './utils';
|
|
7
|
+
import { IKitConfigs } from './configAPIClient';
|
|
8
|
+
import { SDKConsentApi, SDKConsentState } from './consent';
|
|
9
|
+
import MPSideloadedKit from './sideloadedKit';
|
|
10
|
+
import { ISessionManager } from './sessionManager';
|
|
11
|
+
import { ConfiguredKit, MPForwarder, UnregisteredKit } from './forwarders.interfaces';
|
|
12
|
+
import { SDKIdentityApi, IAliasCallback } from './identity.interfaces';
|
|
13
|
+
import { ISDKUserAttributeChangeData, ISDKUserIdentityChanges, IMParticleUser, ISDKUserIdentity, IdentityCallback, ISDKUserAttributes } from './identity-user-interfaces';
|
|
14
|
+
import { CommerceEventType, EventType, IdentityType, ProductActionType, PromotionActionType } from './types';
|
|
15
|
+
import { IPixelConfiguration } from './cookieSyncManager';
|
|
16
|
+
import _BatchValidator from './mockBatchCreator';
|
|
17
|
+
import { SDKECommerceAPI } from './ecommerce.interfaces';
|
|
18
|
+
import { IErrorLogMessage, IMParticleWebSDKInstance, IntegrationDelays } from './mp-instance';
|
|
19
|
+
import Constants from './constants';
|
|
20
|
+
import RoktManager, { IRoktLauncherOptions } from './roktManager';
|
|
21
|
+
import { IConsoleLogger } from './logger';
|
|
22
|
+
import { ErrorCodes, IErrorReportingService, ILoggingService } from './reporting/types';
|
|
23
|
+
export type SDKEventCustomFlags = Dictionary<any>;
|
|
24
|
+
export interface SDKEvent {
|
|
25
|
+
DeviceId: string;
|
|
26
|
+
IsFirstRun: boolean;
|
|
27
|
+
EventName: string;
|
|
28
|
+
EventCategory: number;
|
|
29
|
+
UserAttributes?: ISDKUserAttributes;
|
|
30
|
+
UserIdentities?: ISDKUserIdentity[];
|
|
31
|
+
SourceMessageId: string;
|
|
32
|
+
MPID: string;
|
|
33
|
+
EventAttributes?: {
|
|
34
|
+
[key: string]: string;
|
|
35
|
+
};
|
|
36
|
+
SDKVersion: string;
|
|
37
|
+
SessionId: string;
|
|
38
|
+
SessionStartDate: number;
|
|
39
|
+
SessionLength?: number;
|
|
40
|
+
currentSessionMPIDs?: string[];
|
|
41
|
+
Timestamp: number;
|
|
42
|
+
EventDataType: number;
|
|
43
|
+
Debug: boolean;
|
|
44
|
+
Location?: SDKGeoLocation;
|
|
45
|
+
OptOut?: boolean;
|
|
46
|
+
CustomFlags?: SDKEventCustomFlags;
|
|
47
|
+
AppVersion?: string;
|
|
48
|
+
AppName?: string;
|
|
49
|
+
Package?: string;
|
|
50
|
+
ConsentState?: SDKConsentState;
|
|
51
|
+
IntegrationAttributes?: IntegrationAttributes;
|
|
52
|
+
ProductAction?: SDKProductAction;
|
|
53
|
+
PromotionAction?: SDKPromotionAction;
|
|
54
|
+
ProductImpressions?: SDKProductImpression[];
|
|
55
|
+
ShoppingCart?: SDKShoppingCart;
|
|
56
|
+
UserIdentityChanges?: ISDKUserIdentityChanges;
|
|
57
|
+
UserAttributeChanges?: ISDKUserAttributeChangeData;
|
|
58
|
+
CurrencyCode: string;
|
|
59
|
+
DataPlan?: SDKDataPlan;
|
|
60
|
+
LaunchReferral?: string;
|
|
61
|
+
ExpandedEventCount: number;
|
|
62
|
+
ActiveTimeOnSite: number;
|
|
63
|
+
IsBackgroundAST?: boolean;
|
|
64
|
+
AlreadySentToForwarders?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface SDKGeoLocation {
|
|
67
|
+
lat: number | string;
|
|
68
|
+
lng: number | string;
|
|
69
|
+
}
|
|
70
|
+
export interface SDKDataPlan {
|
|
71
|
+
PlanVersion?: number | null;
|
|
72
|
+
PlanId?: string | null;
|
|
73
|
+
}
|
|
74
|
+
export interface SDKShoppingCart {
|
|
75
|
+
ProductList?: SDKProduct[];
|
|
76
|
+
}
|
|
77
|
+
export interface SDKPromotionAction {
|
|
78
|
+
PromotionActionType: string;
|
|
79
|
+
PromotionList?: SDKPromotion[];
|
|
80
|
+
}
|
|
81
|
+
export interface SDKPromotion {
|
|
82
|
+
Id?: string;
|
|
83
|
+
Name?: string;
|
|
84
|
+
Creative?: string;
|
|
85
|
+
Position?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface SDKImpression {
|
|
88
|
+
Name: string;
|
|
89
|
+
Product: SDKProduct;
|
|
90
|
+
}
|
|
91
|
+
export interface SDKProductImpression {
|
|
92
|
+
ProductImpressionList?: string;
|
|
93
|
+
ProductList?: SDKProduct[];
|
|
94
|
+
}
|
|
95
|
+
export declare enum SDKProductActionType {
|
|
96
|
+
Unknown = 0,
|
|
97
|
+
AddToCart = 1,
|
|
98
|
+
RemoveFromCart = 2,
|
|
99
|
+
Checkout = 3,
|
|
100
|
+
CheckoutOption = 4,
|
|
101
|
+
Click = 5,
|
|
102
|
+
ViewDetail = 6,
|
|
103
|
+
Purchase = 7,
|
|
104
|
+
Refund = 8,
|
|
105
|
+
AddToWishlist = 9,
|
|
106
|
+
RemoveFromWishlist = 10
|
|
107
|
+
}
|
|
108
|
+
export interface SDKProductAction {
|
|
109
|
+
ProductActionType: SDKProductActionType;
|
|
110
|
+
CheckoutStep?: number;
|
|
111
|
+
CheckoutOptions?: string;
|
|
112
|
+
ProductList?: SDKProduct[];
|
|
113
|
+
TransactionId?: string;
|
|
114
|
+
Affiliation?: string;
|
|
115
|
+
CouponCode?: string;
|
|
116
|
+
TotalAmount?: number;
|
|
117
|
+
ShippingAmount?: number;
|
|
118
|
+
TaxAmount?: number;
|
|
119
|
+
}
|
|
120
|
+
export interface SDKProduct {
|
|
121
|
+
Sku?: string;
|
|
122
|
+
Name?: string;
|
|
123
|
+
Price?: number;
|
|
124
|
+
Quantity?: number;
|
|
125
|
+
Brand?: string;
|
|
126
|
+
Variant?: string;
|
|
127
|
+
Category?: string;
|
|
128
|
+
Position?: number;
|
|
129
|
+
CouponCode?: string;
|
|
130
|
+
TotalAmount?: number;
|
|
131
|
+
Attributes?: Record<string, unknown> | null;
|
|
132
|
+
}
|
|
133
|
+
export interface MParticleWebSDK {
|
|
134
|
+
addForwarder(forwarder: UnregisteredKit): void;
|
|
135
|
+
IdentityType: typeof IdentityType;
|
|
136
|
+
CommerceEventType: typeof CommerceEventType;
|
|
137
|
+
EventType: typeof EventType;
|
|
138
|
+
PromotionType: typeof PromotionActionType;
|
|
139
|
+
ProductActionType: typeof ProductActionType;
|
|
140
|
+
Identity: SDKIdentityApi;
|
|
141
|
+
Logger: SDKLoggerApi;
|
|
142
|
+
Consent: SDKConsentApi;
|
|
143
|
+
_resetForTests(MPConfig?: SDKInitConfig, keepPersistence?: boolean, instance?: IMParticleWebSDKInstance): void;
|
|
144
|
+
configurePixel(config: IPixelConfiguration): void;
|
|
145
|
+
endSession(): void;
|
|
146
|
+
init(apiKey: string, config: SDKInitConfig, instanceName?: string): void;
|
|
147
|
+
_getActiveForwarders(): ConfiguredKit[];
|
|
148
|
+
_getIntegrationDelays(): IntegrationDelays;
|
|
149
|
+
_setIntegrationDelay(module: number, shouldDelayIntegration: boolean): void;
|
|
150
|
+
_setWrapperSDKInfo(name: WrapperSDKTypes, version: string): void;
|
|
151
|
+
getAppName(): string;
|
|
152
|
+
getAppVersion(): string;
|
|
153
|
+
getDeviceId(): string;
|
|
154
|
+
setDeviceId(deviceId: string): void;
|
|
155
|
+
getEnvironment(): valueof<typeof Constants.Environment>;
|
|
156
|
+
setSessionAttribute(key: string, value: string): void;
|
|
157
|
+
getVersion(): string;
|
|
158
|
+
upload(): void;
|
|
159
|
+
setLogLevel(logLevel: LogLevelType): void;
|
|
160
|
+
setPosition(lat: number | string, lng: number | string): void;
|
|
161
|
+
startNewSession(): void;
|
|
162
|
+
logEvent(eventName: string, eventType?: valueof<typeof EventType>, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, eventOptions?: SDKEventOptions): void;
|
|
163
|
+
logBaseEvent(event: BaseEvent, eventOptions?: SDKEventOptions): void;
|
|
164
|
+
logError(error: IErrorLogMessage, attrs?: SDKEventAttrs): void;
|
|
165
|
+
logLink(selector: string, eventName: string, eventType: valueof<typeof EventType>, eventInfo: SDKEventAttrs): void;
|
|
166
|
+
logForm(selector: string, eventName: string, eventType: valueof<typeof EventType>, eventInfo: SDKEventAttrs): void;
|
|
167
|
+
logPageView(eventName?: string, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, eventOptions?: SDKEventOptions): void;
|
|
168
|
+
setOptOut(isOptingOut: boolean): void;
|
|
169
|
+
eCommerce: SDKECommerceAPI;
|
|
170
|
+
isInitialized(): boolean;
|
|
171
|
+
ready(f: Function): void;
|
|
172
|
+
reset(instance?: IMParticleWebSDKInstance): void;
|
|
173
|
+
setAppName(name: string): void;
|
|
174
|
+
setAppVersion(version: string): void;
|
|
175
|
+
setOptOut(isOptingOut: boolean): void;
|
|
176
|
+
startTrackingLocation(callback?: Callback): void;
|
|
177
|
+
stopTrackingLocation(): void;
|
|
178
|
+
generateHash(value: string): string;
|
|
179
|
+
setIntegrationAttribute(integrationModuleId: number, attrs: IntegrationAttribute): void;
|
|
180
|
+
getIntegrationAttributes(integrationModuleId: number): IntegrationAttribute;
|
|
181
|
+
captureTiming(metricName: string): void;
|
|
182
|
+
_registerErrorReportingService(service: IErrorReportingService): void;
|
|
183
|
+
_registerLoggingService(service: ILoggingService): void;
|
|
184
|
+
}
|
|
185
|
+
export interface IMParticleInstanceManager extends MParticleWebSDK {
|
|
186
|
+
_BatchValidator: _BatchValidator;
|
|
187
|
+
_instances: Dictionary<IMParticleWebSDKInstance>;
|
|
188
|
+
_isTestEnv?: boolean;
|
|
189
|
+
config: SDKInitConfig;
|
|
190
|
+
isIOS?: boolean;
|
|
191
|
+
MPSideloadedKit: typeof MPSideloadedKit;
|
|
192
|
+
Rokt: RoktManager;
|
|
193
|
+
sessionManager: Pick<ISessionManager, 'getSession'>;
|
|
194
|
+
Store: IStore;
|
|
195
|
+
getInstance(instanceName?: string): IMParticleWebSDKInstance;
|
|
196
|
+
}
|
|
197
|
+
export type BooleanStringLowerCase = 'false' | 'true';
|
|
198
|
+
export type BooleanStringTitleCase = 'False' | 'True';
|
|
199
|
+
export type LogLevelType = (typeof LogLevelType)[keyof typeof LogLevelType];
|
|
200
|
+
export declare const LogLevelType: {
|
|
201
|
+
readonly None: "none";
|
|
202
|
+
readonly Verbose: "verbose";
|
|
203
|
+
readonly Warning: "warning";
|
|
204
|
+
readonly Error: "error";
|
|
205
|
+
};
|
|
206
|
+
export interface SDKInitConfig extends Omit<MPConfiguration, 'dataPlan' | 'logLevel'> {
|
|
207
|
+
dataPlan?: DataPlanConfig | KitBlockerDataPlan;
|
|
208
|
+
logLevel?: LogLevelType;
|
|
209
|
+
kitConfigs?: IKitConfigs[];
|
|
210
|
+
kits?: Dictionary<UnregisteredKit>;
|
|
211
|
+
sideloadedKits?: MPForwarder[];
|
|
212
|
+
dataPlanOptions?: KitBlockerOptions;
|
|
213
|
+
flags?: Dictionary;
|
|
214
|
+
pixelConfigs?: IPixelConfiguration[];
|
|
215
|
+
aliasMaxWindow?: number;
|
|
216
|
+
deviceId?: string;
|
|
217
|
+
forceHttps?: boolean;
|
|
218
|
+
aliasUrl?: string;
|
|
219
|
+
configUrl?: string;
|
|
220
|
+
identityUrl?: string;
|
|
221
|
+
integrationDelayTimeout?: number;
|
|
222
|
+
isIOS?: boolean;
|
|
223
|
+
maxProducts?: number;
|
|
224
|
+
requestConfig?: boolean;
|
|
225
|
+
sessionTimeout?: number;
|
|
226
|
+
useNativeSdk?: boolean;
|
|
227
|
+
useCookieStorage?: boolean;
|
|
228
|
+
v1SecureServiceUrl?: string;
|
|
229
|
+
v2SecureServiceUrl?: string;
|
|
230
|
+
v3SecureServiceUrl?: string;
|
|
231
|
+
domain?: string;
|
|
232
|
+
workspaceToken?: string;
|
|
233
|
+
isDevelopmentMode?: boolean;
|
|
234
|
+
identityCallback?: IdentityCallback;
|
|
235
|
+
launcherOptions?: IRoktLauncherOptions;
|
|
236
|
+
isLoggingEnabled?: boolean;
|
|
237
|
+
rq?: Function[] | any[];
|
|
238
|
+
logger?: IConsoleLogger;
|
|
239
|
+
}
|
|
240
|
+
export interface DataPlanConfig {
|
|
241
|
+
planId?: string;
|
|
242
|
+
planVersion?: number;
|
|
243
|
+
document?: DataPlanResult;
|
|
244
|
+
}
|
|
245
|
+
export interface SDKHelpersApi {
|
|
246
|
+
canLog?(): boolean;
|
|
247
|
+
createMainStorageName?(workspaceToken: string): string;
|
|
248
|
+
createServiceUrl(url: string, devToken?: string): string;
|
|
249
|
+
createXHR?(cb: () => void): XMLHttpRequest;
|
|
250
|
+
extend?(...args: any[]): any;
|
|
251
|
+
findKeyInObject?(obj: any, key: string): string;
|
|
252
|
+
parseNumber?(value: string | number): number;
|
|
253
|
+
generateUniqueId(): any;
|
|
254
|
+
generateHash?(value: string): string;
|
|
255
|
+
getFeatureFlag?(feature: string): boolean | string;
|
|
256
|
+
invokeAliasCallback(aliasCallback: IAliasCallback, number: number, errorMessage: string): void;
|
|
257
|
+
isDelayedByIntegration?(delayedIntegrations: Dictionary<boolean>, timeoutStart: number, now: number): boolean;
|
|
258
|
+
isEventType?(type: valueof<typeof EventType>): boolean;
|
|
259
|
+
isObject?(item: any): any;
|
|
260
|
+
invokeCallback?(callback: IdentityCallback, code: number, body: string, mParticleUser?: IMParticleUser, previousMpid?: MPID): void;
|
|
261
|
+
sanitizeAttributes?(attrs: SDKEventAttrs, name: string): Dictionary<string> | null;
|
|
262
|
+
Validators: typeof Validators;
|
|
263
|
+
}
|
|
264
|
+
export interface SDKLoggerApi {
|
|
265
|
+
error(msg: string, code?: ErrorCodes): void;
|
|
266
|
+
verbose(msg: string): void;
|
|
267
|
+
warning(msg: string): void;
|
|
268
|
+
isVerbose(): boolean;
|
|
269
|
+
setLogLevel(logLevel: LogLevelType): void;
|
|
270
|
+
}
|
|
271
|
+
export interface SDKStoreApi {
|
|
272
|
+
isEnabled: boolean;
|
|
273
|
+
isFirstRun: boolean;
|
|
274
|
+
devToken: string;
|
|
275
|
+
SDKConfig: SDKConfigApi;
|
|
276
|
+
sessionId?: string;
|
|
277
|
+
deviceId?: string;
|
|
278
|
+
}
|
|
279
|
+
export interface SDKConfigApi {
|
|
280
|
+
v3SecureServiceUrl?: string;
|
|
281
|
+
isDevelopmentMode: boolean;
|
|
282
|
+
appVersion?: string;
|
|
283
|
+
onCreateBatch(batch: EventsApi.Batch): EventsApi.Batch;
|
|
284
|
+
}
|
|
285
|
+
export interface BaseEvent {
|
|
286
|
+
messageType: number;
|
|
287
|
+
name?: string;
|
|
288
|
+
eventType?: number;
|
|
289
|
+
data?: SDKEventAttrs;
|
|
290
|
+
customFlags?: {
|
|
291
|
+
[key: string]: string;
|
|
292
|
+
};
|
|
293
|
+
toEventAPIObject?(): SDKEvent;
|
|
294
|
+
sourceMessageId?: string;
|
|
295
|
+
userAttributeChanges?: ISDKUserAttributeChangeData;
|
|
296
|
+
userIdentityChanges?: ISDKUserIdentityChanges;
|
|
297
|
+
}
|
|
298
|
+
export interface KitBlockerOptions {
|
|
299
|
+
dataPlanVersion: DataPlanVersion;
|
|
300
|
+
blockUserAttributes: boolean;
|
|
301
|
+
blockEventAttributes: boolean;
|
|
302
|
+
blockEvents: boolean;
|
|
303
|
+
blockUserIdentities: boolean;
|
|
304
|
+
}
|
|
305
|
+
export interface KitBlockerDataPlan {
|
|
306
|
+
document: DataPlanResult;
|
|
307
|
+
}
|
|
308
|
+
export interface DataPlanResult {
|
|
309
|
+
dtpn?: {
|
|
310
|
+
vers: DataPlanVersion;
|
|
311
|
+
blok: {
|
|
312
|
+
ev: boolean;
|
|
313
|
+
ea: boolean;
|
|
314
|
+
ua: boolean;
|
|
315
|
+
id: boolean;
|
|
316
|
+
};
|
|
317
|
+
};
|
|
318
|
+
error_message?: string;
|
|
319
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SDKEvent, SDKGeoLocation, SDKProduct, SDKPromotion, SDKProductActionType } from './sdkRuntimeModels';
|
|
2
|
+
import * as EventsApi from '@mparticle/event-models';
|
|
3
|
+
import { SDKConsentState, SDKGDPRConsentState, SDKCCPAConsentState } from './consent';
|
|
4
|
+
import { Dictionary } from './utils';
|
|
5
|
+
import { ISDKUserIdentity } from './identity-user-interfaces';
|
|
6
|
+
import { SDKIdentityTypeEnum } from './identity.interfaces';
|
|
7
|
+
import { IMParticleWebSDKInstance } from './mp-instance';
|
|
8
|
+
type PartnerIdentities = Dictionary<string>;
|
|
9
|
+
interface Batch extends EventsApi.Batch {
|
|
10
|
+
partner_identities?: PartnerIdentities;
|
|
11
|
+
}
|
|
12
|
+
export declare function convertEvents(mpid: string, sdkEvents: SDKEvent[], mpInstance: IMParticleWebSDKInstance): Batch | null;
|
|
13
|
+
export declare function convertConsentState(sdkConsentState?: SDKConsentState): EventsApi.ConsentState | null;
|
|
14
|
+
export declare function convertGdprConsentState(sdkGdprConsentState: SDKGDPRConsentState): {
|
|
15
|
+
[key: string]: EventsApi.GDPRConsentState | null;
|
|
16
|
+
};
|
|
17
|
+
export declare function convertCcpaConsentState(sdkCcpaConsentState: SDKCCPAConsentState): {
|
|
18
|
+
data_sale_opt_out: EventsApi.CCPAConsentState;
|
|
19
|
+
};
|
|
20
|
+
export declare function convertUserIdentities(sdkUserIdentities?: ISDKUserIdentity[]): EventsApi.BatchUserIdentities | null;
|
|
21
|
+
export declare function convertEvent(sdkEvent: SDKEvent): EventsApi.BaseEvent | null;
|
|
22
|
+
export declare function convertProductActionType(actionType: SDKProductActionType): EventsApi.ProductActionActionEnum;
|
|
23
|
+
export declare function convertProductAction(sdkEvent: SDKEvent): EventsApi.ProductAction | null;
|
|
24
|
+
export declare function convertProducts(sdkProducts: SDKProduct[]): EventsApi.Product[] | null;
|
|
25
|
+
export declare function convertPromotionAction(sdkEvent: SDKEvent): EventsApi.PromotionAction | null;
|
|
26
|
+
export declare function convertPromotions(sdkPromotions: SDKPromotion[]): EventsApi.Promotion[] | null;
|
|
27
|
+
export declare function convertImpressions(sdkEvent: SDKEvent): EventsApi.ProductImpression[] | null;
|
|
28
|
+
export declare function convertShoppingCart(sdkEvent: SDKEvent): EventsApi.ShoppingCart | null;
|
|
29
|
+
export declare function convertCommerceEvent(sdkEvent: SDKEvent): EventsApi.CommerceEvent;
|
|
30
|
+
export declare function convertCrashReportEvent(sdkEvent: SDKEvent): EventsApi.CrashReportEvent;
|
|
31
|
+
export declare function convertAST(sdkEvent: SDKEvent): EventsApi.ApplicationStateTransitionEvent;
|
|
32
|
+
export declare function convertSessionEndEvent(sdkEvent: SDKEvent): EventsApi.SessionEndEvent;
|
|
33
|
+
export declare function convertSessionStartEvent(sdkEvent: SDKEvent): EventsApi.SessionStartEvent;
|
|
34
|
+
export declare function convertPageViewEvent(sdkEvent: SDKEvent): EventsApi.ScreenViewEvent;
|
|
35
|
+
export declare function convertOptOutEvent(sdkEvent: SDKEvent): EventsApi.OptOutEvent;
|
|
36
|
+
export declare function convertCustomEvent(sdkEvent: SDKEvent): EventsApi.CustomEvent;
|
|
37
|
+
export declare function convertSdkEventType(sdkEventType: number): EventsApi.CustomEventDataCustomEventTypeEnum | EventsApi.CommerceEventDataCustomEventTypeEnum;
|
|
38
|
+
export declare function convertBaseEventData(sdkEvent: SDKEvent): EventsApi.CommonEventData;
|
|
39
|
+
export declare function convertSDKLocation(sdkEventLocation: SDKGeoLocation): EventsApi.GeoLocation;
|
|
40
|
+
export declare function convertUserAttributeChangeEvent(sdkEvent: SDKEvent): EventsApi.UserAttributeChangeEvent | null;
|
|
41
|
+
export declare function convertUserIdentityChangeEvent(sdkEvent: SDKEvent): EventsApi.UserIdentityChangeEvent | null;
|
|
42
|
+
export declare function convertUserIdentityTypeToServerIdentityType(identityType: SDKIdentityTypeEnum): EventsApi.IdentityType;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { BaseEvent, SDKEvent, SDKGeoLocation } from './sdkRuntimeModels';
|
|
2
|
+
import { Dictionary } from './utils';
|
|
3
|
+
import { ServerSettings } from './store';
|
|
4
|
+
import { MPID } from '@mparticle/web-sdk';
|
|
5
|
+
import { IConsentStateV2DTO, SDKConsentState } from './consent';
|
|
6
|
+
import { IMParticleUser, ISDKUserIdentity } from './identity-user-interfaces';
|
|
7
|
+
import { IMParticleWebSDKInstance } from './mp-instance';
|
|
8
|
+
export interface IServerV2DTO {
|
|
9
|
+
id: string | number;
|
|
10
|
+
nm: string | number;
|
|
11
|
+
pr: number;
|
|
12
|
+
qt: number;
|
|
13
|
+
br: string | number;
|
|
14
|
+
va: string | number;
|
|
15
|
+
ca: string | number;
|
|
16
|
+
ps: number;
|
|
17
|
+
cc: string | number;
|
|
18
|
+
attrs: Record<string, string> | null;
|
|
19
|
+
dp_id?: string;
|
|
20
|
+
dp_v?: number;
|
|
21
|
+
n?: string;
|
|
22
|
+
et?: number;
|
|
23
|
+
ua?: Dictionary<string | string[]>;
|
|
24
|
+
ui?: ISDKUserIdentity[];
|
|
25
|
+
ia?: Dictionary<Dictionary<string>>;
|
|
26
|
+
str?: ServerSettings;
|
|
27
|
+
sdk?: string;
|
|
28
|
+
sid?: string;
|
|
29
|
+
sl?: number;
|
|
30
|
+
ssd?: number;
|
|
31
|
+
dt?: number;
|
|
32
|
+
dbg?: boolean;
|
|
33
|
+
ct?: number;
|
|
34
|
+
lc?: SDKGeoLocation;
|
|
35
|
+
o?: boolean;
|
|
36
|
+
eec?: number;
|
|
37
|
+
av?: string;
|
|
38
|
+
cgid?: string;
|
|
39
|
+
das?: string;
|
|
40
|
+
mpid?: MPID;
|
|
41
|
+
smpids?: MPID[];
|
|
42
|
+
con?: IConsentStateV2DTO;
|
|
43
|
+
fr?: boolean;
|
|
44
|
+
iu?: boolean;
|
|
45
|
+
at?: number;
|
|
46
|
+
lr?: string;
|
|
47
|
+
flags?: Dictionary<string[]>;
|
|
48
|
+
cu?: string;
|
|
49
|
+
sc?: {
|
|
50
|
+
pl: IProductV2DTO[];
|
|
51
|
+
};
|
|
52
|
+
pd?: {
|
|
53
|
+
an: number;
|
|
54
|
+
cs: number;
|
|
55
|
+
co: string;
|
|
56
|
+
pl: IProductV2DTO[];
|
|
57
|
+
ta: string;
|
|
58
|
+
ti: string;
|
|
59
|
+
tcc: string;
|
|
60
|
+
tr: number;
|
|
61
|
+
ts: number;
|
|
62
|
+
tt: number;
|
|
63
|
+
};
|
|
64
|
+
pm?: {
|
|
65
|
+
an: string;
|
|
66
|
+
pl: IPromotionV2DTO[];
|
|
67
|
+
};
|
|
68
|
+
pi?: IProductImpressionV2DTO[];
|
|
69
|
+
pet?: number;
|
|
70
|
+
}
|
|
71
|
+
export interface IProductV2DTO {
|
|
72
|
+
id: string | number;
|
|
73
|
+
nm: string | number;
|
|
74
|
+
pr: number;
|
|
75
|
+
qt: number;
|
|
76
|
+
br: string | number;
|
|
77
|
+
va: string | number;
|
|
78
|
+
ca: string | number;
|
|
79
|
+
ps: number;
|
|
80
|
+
cc: string | number;
|
|
81
|
+
tpa: number;
|
|
82
|
+
attrs: Dictionary<string> | null;
|
|
83
|
+
}
|
|
84
|
+
export interface IPromotionV2DTO {
|
|
85
|
+
id: string | number;
|
|
86
|
+
nm: string | number;
|
|
87
|
+
ps: string | number;
|
|
88
|
+
cr: string;
|
|
89
|
+
}
|
|
90
|
+
export interface IProductImpressionV2DTO {
|
|
91
|
+
pil: string;
|
|
92
|
+
pl: IProductV2DTO[];
|
|
93
|
+
}
|
|
94
|
+
export interface IUploadObject extends SDKEvent {
|
|
95
|
+
ClientGeneratedId: string;
|
|
96
|
+
Store: ServerSettings;
|
|
97
|
+
ExpandedEventCount: number;
|
|
98
|
+
ProfileMessageType: number;
|
|
99
|
+
}
|
|
100
|
+
export interface IServerModel {
|
|
101
|
+
convertEventToV2DTO: (event: IUploadObject) => IServerV2DTO;
|
|
102
|
+
createEventObject: (event: BaseEvent, user?: IMParticleUser) => SDKEvent;
|
|
103
|
+
convertToConsentStateV2DTO: (state: SDKConsentState) => IConsentStateV2DTO;
|
|
104
|
+
}
|
|
105
|
+
export default function ServerModel(this: IServerModel, mpInstance: IMParticleWebSDKInstance): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IMParticleWebSDKInstance } from './mp-instance';
|
|
2
|
+
export interface ISessionManager {
|
|
3
|
+
initialize: () => void;
|
|
4
|
+
getSessionId: () => string;
|
|
5
|
+
startNewSession: () => void;
|
|
6
|
+
endSession: (override?: boolean) => void;
|
|
7
|
+
setSessionTimer: () => void;
|
|
8
|
+
resetSessionTimer: () => void;
|
|
9
|
+
clearSessionTimeout: () => void;
|
|
10
|
+
startNewSessionIfNeeded: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated
|
|
13
|
+
*/
|
|
14
|
+
getSession: () => string;
|
|
15
|
+
}
|
|
16
|
+
export default function SessionManager(this: ISessionManager, mpInstance: IMParticleWebSDKInstance): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { IKitFilterSettings } from './configAPIClient';
|
|
2
|
+
import { UnregisteredKit } from './forwarders.interfaces';
|
|
3
|
+
import { EventType, IdentityType } from './types';
|
|
4
|
+
import { valueof } from './utils';
|
|
5
|
+
export interface IMPSideloadedKit {
|
|
6
|
+
kitInstance: UnregisteredKit;
|
|
7
|
+
filterDictionary: IKitFilterSettings;
|
|
8
|
+
addEventTypeFilter(eventType: valueof<typeof EventType>): void;
|
|
9
|
+
addEventNameFilter(eventType: valueof<typeof EventType>, eventName: string): void;
|
|
10
|
+
addEventAttributeFilter(eventType: valueof<typeof EventType>, eventName: string, customAttributeKey: string): void;
|
|
11
|
+
addScreenNameFilter(screenName: string): void;
|
|
12
|
+
addScreenAttributeFilter(screenName: string, screenAttribute: string): void;
|
|
13
|
+
addUserIdentityFilter(userIdentity: typeof IdentityType): void;
|
|
14
|
+
addUserAttributeFilter(userAttributeKey: string): void;
|
|
15
|
+
}
|
|
16
|
+
export interface IMPSideloadedKitConstructor {
|
|
17
|
+
new (unregisteredKitInstance: UnregisteredKit): IMPSideloadedKit;
|
|
18
|
+
}
|
|
19
|
+
export default class MPSideloadedKit implements IMPSideloadedKit {
|
|
20
|
+
kitInstance: UnregisteredKit;
|
|
21
|
+
filterDictionary: IKitFilterSettings;
|
|
22
|
+
constructor(unregisteredKitInstance: UnregisteredKit);
|
|
23
|
+
addEventTypeFilter(eventType: valueof<typeof EventType>): void;
|
|
24
|
+
addEventNameFilter(eventType: valueof<typeof EventType>, eventName: string): void;
|
|
25
|
+
addEventAttributeFilter(eventType: valueof<typeof EventType>, eventName: string, customAttributeKey: string): void;
|
|
26
|
+
addScreenNameFilter(screenName: string): void;
|
|
27
|
+
addScreenAttributeFilter(screenName: string, screenAttribute: string): void;
|
|
28
|
+
addUserIdentityFilter(userIdentity: typeof IdentityType): void;
|
|
29
|
+
addUserAttributeFilter(userAttributeKey: string): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { Batch, Context } from '@mparticle/event-models';
|
|
2
|
+
import { MPID, IdentifyRequest, SDKEventCustomFlags, ConsentState, UserIdentities } from '@mparticle/web-sdk';
|
|
3
|
+
import { IKitConfigs } from './configAPIClient';
|
|
4
|
+
import { DataPlanResult, KitBlockerOptions, LogLevelType, SDKDataPlan, SDKEvent, SDKGeoLocation, SDKInitConfig, SDKProduct } from './sdkRuntimeModels';
|
|
5
|
+
import { Dictionary, AttributeValue } from './utils';
|
|
6
|
+
import { SDKConsentState } from './consent';
|
|
7
|
+
import { ConfiguredKit, MPForwarder, UnregisteredKit } from './forwarders.interfaces';
|
|
8
|
+
import { IdentityCallback, UserAttributes } from './identity-user-interfaces';
|
|
9
|
+
import { IPersistenceMinified } from './persistence.interfaces';
|
|
10
|
+
import { CookieSyncDates, IPixelConfiguration } from './cookieSyncManager';
|
|
11
|
+
import { IMParticleWebSDKInstance } from './mp-instance';
|
|
12
|
+
export interface SDKConfig {
|
|
13
|
+
isDevelopmentMode?: boolean;
|
|
14
|
+
logger: {
|
|
15
|
+
error?(msg: any): any;
|
|
16
|
+
warning?(msg: any): any;
|
|
17
|
+
verbose?(msg: any): any;
|
|
18
|
+
};
|
|
19
|
+
onCreateBatch(batch: Batch): Batch;
|
|
20
|
+
customFlags?: SDKEventCustomFlags;
|
|
21
|
+
dataPlan: SDKDataPlan;
|
|
22
|
+
dataPlanOptions: KitBlockerOptions;
|
|
23
|
+
dataPlanResult?: DataPlanResult;
|
|
24
|
+
appName?: string;
|
|
25
|
+
appVersion?: string;
|
|
26
|
+
package?: string;
|
|
27
|
+
flags?: IFeatureFlags;
|
|
28
|
+
kitConfigs: IKitConfigs[];
|
|
29
|
+
kits: Dictionary<UnregisteredKit>;
|
|
30
|
+
logLevel?: LogLevelType;
|
|
31
|
+
cookieDomain?: string;
|
|
32
|
+
maxCookieSize?: number | undefined;
|
|
33
|
+
minWebviewBridgeVersion: 1 | 2 | undefined;
|
|
34
|
+
identifyRequest: IdentifyRequest;
|
|
35
|
+
identityCallback: IdentityCallback;
|
|
36
|
+
integrationDelayTimeout: number;
|
|
37
|
+
sideloadedKits: MPForwarder[];
|
|
38
|
+
aliasMaxWindow: number;
|
|
39
|
+
deviceId?: string;
|
|
40
|
+
forceHttps?: boolean;
|
|
41
|
+
aliasUrl?: string;
|
|
42
|
+
configUrl?: string;
|
|
43
|
+
identityUrl?: string;
|
|
44
|
+
userAudienceUrl?: string;
|
|
45
|
+
isIOS?: boolean;
|
|
46
|
+
maxAliasWindow: number;
|
|
47
|
+
maxProducts: number;
|
|
48
|
+
requestConfig?: boolean;
|
|
49
|
+
sessionTimeout?: number;
|
|
50
|
+
useNativeSdk?: boolean;
|
|
51
|
+
useCookieStorage?: boolean;
|
|
52
|
+
v1SecureServiceUrl?: string;
|
|
53
|
+
v2SecureServiceUrl?: string;
|
|
54
|
+
v3SecureServiceUrl?: string;
|
|
55
|
+
webviewBridgeName?: string;
|
|
56
|
+
workspaceToken?: string;
|
|
57
|
+
requiredWebviewBridgeName?: string;
|
|
58
|
+
isLoggingEnabled?: boolean;
|
|
59
|
+
}
|
|
60
|
+
export type ServerSettings = Dictionary;
|
|
61
|
+
export type SessionAttributes = Dictionary;
|
|
62
|
+
export type LocalSessionAttributes = Dictionary;
|
|
63
|
+
export type IntegrationAttribute = Dictionary<string>;
|
|
64
|
+
export type IntegrationAttributes = Dictionary<IntegrationAttribute>;
|
|
65
|
+
export type WrapperSDKTypes = 'flutter' | 'none';
|
|
66
|
+
export interface WrapperSDKInfo {
|
|
67
|
+
name: WrapperSDKTypes;
|
|
68
|
+
version: string | null;
|
|
69
|
+
isInfoSet: boolean;
|
|
70
|
+
}
|
|
71
|
+
export interface IFeatureFlags {
|
|
72
|
+
reportBatching?: boolean;
|
|
73
|
+
eventBatchingIntervalMillis?: number;
|
|
74
|
+
offlineStorage?: string;
|
|
75
|
+
directURLRouting?: boolean;
|
|
76
|
+
cacheIdentity?: boolean;
|
|
77
|
+
captureIntegrationSpecificIds?: boolean;
|
|
78
|
+
captureIntegrationSpecificIdsV2?: string;
|
|
79
|
+
astBackgroundEvents?: boolean;
|
|
80
|
+
}
|
|
81
|
+
export interface IStore {
|
|
82
|
+
isEnabled: boolean;
|
|
83
|
+
isInitialized: boolean;
|
|
84
|
+
sessionAttributes: SessionAttributes;
|
|
85
|
+
localSessionAttributes: LocalSessionAttributes;
|
|
86
|
+
currentSessionMPIDs: MPID[];
|
|
87
|
+
consentState: SDKConsentState | null;
|
|
88
|
+
sessionId: string | null;
|
|
89
|
+
isFirstRun: boolean;
|
|
90
|
+
clientId: string;
|
|
91
|
+
deviceId: string;
|
|
92
|
+
devToken: string | null;
|
|
93
|
+
serverSettings: ServerSettings;
|
|
94
|
+
dateLastEventSent: Date;
|
|
95
|
+
sessionStartDate: Date;
|
|
96
|
+
currentPosition: SDKGeoLocation | null;
|
|
97
|
+
isTracking: boolean;
|
|
98
|
+
watchPositionId: number | null;
|
|
99
|
+
cartProducts: SDKProduct[];
|
|
100
|
+
eventQueue: SDKEvent[];
|
|
101
|
+
currencyCode: string | null;
|
|
102
|
+
globalTimer: number | null;
|
|
103
|
+
context: Context | null;
|
|
104
|
+
configurationLoaded: boolean;
|
|
105
|
+
identityCallInFlight: boolean;
|
|
106
|
+
identityCallFailed: boolean;
|
|
107
|
+
identifyRequestCount: number;
|
|
108
|
+
SDKConfig: Partial<SDKConfig>;
|
|
109
|
+
nonCurrentUserMPIDs: Record<MPID, Dictionary>;
|
|
110
|
+
identifyCalled: boolean;
|
|
111
|
+
isLoggedIn: boolean;
|
|
112
|
+
sideloadedKitsCount?: number;
|
|
113
|
+
cookieSyncDates: CookieSyncDates;
|
|
114
|
+
integrationAttributes: IntegrationAttributes;
|
|
115
|
+
requireDelay: boolean;
|
|
116
|
+
isLocalStorageAvailable: boolean | null;
|
|
117
|
+
storageName: string | null;
|
|
118
|
+
activeForwarders: ConfiguredKit[];
|
|
119
|
+
kits: Dictionary<MPForwarder>;
|
|
120
|
+
sideloadedKits: MPForwarder[];
|
|
121
|
+
configuredForwarders: MPForwarder[];
|
|
122
|
+
pixelConfigurations: IPixelConfiguration[];
|
|
123
|
+
integrationDelayTimeoutStart: number;
|
|
124
|
+
webviewBridgeEnabled?: boolean;
|
|
125
|
+
wrapperSDKInfo: WrapperSDKInfo;
|
|
126
|
+
roktAccountId: string | null;
|
|
127
|
+
integrationName: string | null;
|
|
128
|
+
persistenceData?: IPersistenceMinified;
|
|
129
|
+
getConsentState?(mpid: MPID): ConsentState | null;
|
|
130
|
+
setConsentState?(mpid: MPID, consentState: ConsentState): void;
|
|
131
|
+
_getFromPersistence?<T>(mpid: MPID, key: string): T;
|
|
132
|
+
_setPersistence?<T>(mpid: MPID, key: string, value: T): void;
|
|
133
|
+
getDeviceId?(): string;
|
|
134
|
+
setDeviceId?(deviceId: string): void;
|
|
135
|
+
getFirstSeenTime?(mpid: MPID): number;
|
|
136
|
+
setFirstSeenTime?(mpid: MPID, time?: number): void;
|
|
137
|
+
getLastSeenTime?(mpid: MPID): number;
|
|
138
|
+
setLastSeenTime?(mpid: MPID, time?: number): void;
|
|
139
|
+
getLocalSessionAttributes?(): LocalSessionAttributes;
|
|
140
|
+
setLocalSessionAttribute?(key: string, value: AttributeValue): void;
|
|
141
|
+
getUserAttributes?(mpid: MPID): UserAttributes;
|
|
142
|
+
setUserAttributes?(mpid: MPID, attributes: UserAttributes): void;
|
|
143
|
+
getUserIdentities?(mpid: MPID): UserIdentities;
|
|
144
|
+
setUserIdentities?(mpid: MPID, userIdentities: UserIdentities): void;
|
|
145
|
+
getRoktAccountId?(): string;
|
|
146
|
+
setRoktAccountId?(accountId: string): void;
|
|
147
|
+
getIntegrationName?(): string;
|
|
148
|
+
setIntegrationName?(integrationName: string): void;
|
|
149
|
+
addMpidToSessionHistory?(mpid: MPID, previousMpid?: MPID): void;
|
|
150
|
+
hasInvalidIdentifyRequest?: () => boolean;
|
|
151
|
+
nullifySession?: () => void;
|
|
152
|
+
processConfig(config: SDKInitConfig): void;
|
|
153
|
+
syncPersistenceData?: () => void;
|
|
154
|
+
}
|
|
155
|
+
export default function Store(this: IStore, config: SDKInitConfig, mpInstance: IMParticleWebSDKInstance, apiKey?: string): void;
|
|
156
|
+
export declare function processFlags(config: SDKInitConfig): IFeatureFlags;
|
|
157
|
+
export declare function processBaseUrls(config: SDKInitConfig, flags: IFeatureFlags, apiKey?: string): Dictionary<string>;
|