@mparticle/web-sdk 2.61.0 → 2.63.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 +7 -6
- package/dist/mparticle.esm.js +7 -6
- package/dist/mparticle.js +131 -102
- 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 +27 -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 +15 -2
- package/src/batchUploader.ts +13 -0
- package/src/forwarders.interfaces.ts +42 -0
- package/src/forwarders.js +28 -1
- package/src/internal-types.ts +66 -0
- package/src/public-types.ts +84 -0
- package/src/roktManager.ts +25 -13
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { SDKEventCustomFlags } from './sdkRuntimeModels';
|
|
2
|
+
import Constants from './constants';
|
|
3
|
+
import { IntegrationAttributes } from './store';
|
|
4
|
+
import { Dictionary, valueof } from './utils';
|
|
5
|
+
export interface IntegrationCaptureProcessorFunction {
|
|
6
|
+
(clickId: string, url: string, timestamp?: number): string;
|
|
7
|
+
}
|
|
8
|
+
export declare const facebookClickIdProcessor: IntegrationCaptureProcessorFunction;
|
|
9
|
+
declare const IntegrationOutputs: {
|
|
10
|
+
readonly CUSTOM_FLAGS: "custom_flags";
|
|
11
|
+
readonly PARTNER_IDENTITIES: "partner_identities";
|
|
12
|
+
readonly INTEGRATION_ATTRIBUTES: "integration_attributes";
|
|
13
|
+
};
|
|
14
|
+
interface IntegrationMappingItem {
|
|
15
|
+
mappedKey: string;
|
|
16
|
+
output: valueof<typeof IntegrationOutputs>;
|
|
17
|
+
processor?: IntegrationCaptureProcessorFunction;
|
|
18
|
+
moduleId?: number;
|
|
19
|
+
}
|
|
20
|
+
interface IntegrationIdMapping {
|
|
21
|
+
[key: string]: IntegrationMappingItem;
|
|
22
|
+
}
|
|
23
|
+
export default class IntegrationCapture {
|
|
24
|
+
clickIds: Dictionary<string>;
|
|
25
|
+
readonly initialTimestamp: number;
|
|
26
|
+
readonly filteredPartnerIdentityMappings: IntegrationIdMapping;
|
|
27
|
+
readonly filteredCustomFlagMappings: IntegrationIdMapping;
|
|
28
|
+
readonly filteredIntegrationAttributeMappings: IntegrationIdMapping;
|
|
29
|
+
captureMode?: valueof<typeof Constants.CaptureIntegrationSpecificIdsV2Modes>;
|
|
30
|
+
constructor(captureMode: valueof<typeof Constants.CaptureIntegrationSpecificIdsV2Modes>);
|
|
31
|
+
/**
|
|
32
|
+
* Captures Integration Ids from cookies and query params and stores them in clickIds object
|
|
33
|
+
*/
|
|
34
|
+
capture(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Captures cookies based on the integration ID mapping.
|
|
37
|
+
*/
|
|
38
|
+
captureCookies(): Dictionary<string>;
|
|
39
|
+
/**
|
|
40
|
+
* Captures query parameters based on the integration ID mapping.
|
|
41
|
+
*/
|
|
42
|
+
captureQueryParams(): Dictionary<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Captures local storage based on the integration ID mapping.
|
|
45
|
+
*/
|
|
46
|
+
captureLocalStorage(): Dictionary<string>;
|
|
47
|
+
/**
|
|
48
|
+
* Gets the query parameters based on the integration ID mapping.
|
|
49
|
+
* @returns {Dictionary<string>} The query parameters.
|
|
50
|
+
*/
|
|
51
|
+
getQueryParams(): Dictionary<string>;
|
|
52
|
+
/**
|
|
53
|
+
* Converts captured click IDs to custom flags for SDK events.
|
|
54
|
+
* @returns {SDKEventCustomFlags} The custom flags.
|
|
55
|
+
*/
|
|
56
|
+
getClickIdsAsCustomFlags(): SDKEventCustomFlags;
|
|
57
|
+
/**
|
|
58
|
+
* Returns only the `partner_identities` mapped integration output.
|
|
59
|
+
* @returns {Dictionary<string>} The partner identities.
|
|
60
|
+
*/
|
|
61
|
+
getClickIdsAsPartnerIdentities(): Dictionary<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Returns only the `integration_attributes` mapped integration output.
|
|
64
|
+
* @returns {IntegrationAttributes} The integration attributes.
|
|
65
|
+
*/
|
|
66
|
+
getClickIdsAsIntegrationAttributes(): IntegrationAttributes;
|
|
67
|
+
private getClickIds;
|
|
68
|
+
private applyProcessors;
|
|
69
|
+
private filterMappings;
|
|
70
|
+
/**
|
|
71
|
+
* Returns the allowed keys to capture based on the current mode.
|
|
72
|
+
* For RoktOnly, limit capture to Rokt keys; for All, capture all mapped keys.
|
|
73
|
+
*/
|
|
74
|
+
private getAllowedKeysForMode;
|
|
75
|
+
/**
|
|
76
|
+
* Selects the active integration mapping for the current captureMode.
|
|
77
|
+
* - 'roktonly': only Rokt IDs are considered
|
|
78
|
+
* - 'all': both External and Rokt IDs are considered
|
|
79
|
+
* - else: returns an empty mapping and nothing will be captured
|
|
80
|
+
*/
|
|
81
|
+
private getActiveIntegrationMapping;
|
|
82
|
+
}
|
|
83
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal types for @mparticle/web-sdk
|
|
3
|
+
*
|
|
4
|
+
* These types are shared between mParticle and Rokt SDKs but are NOT part of
|
|
5
|
+
* the public API. They may change without notice between minor versions.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import type { IKitFilterSettings, IRoktKit, SDKProduct } from '@mparticle/web-sdk/internal';
|
|
9
|
+
*
|
|
10
|
+
* This entry point re-exports all public types so that internal consumers
|
|
11
|
+
* only need a single import path.
|
|
12
|
+
*
|
|
13
|
+
* Customers should NOT import from this path.
|
|
14
|
+
*/
|
|
15
|
+
export * from './public-types';
|
|
16
|
+
export type { KitInterface, } from './forwarders.interfaces';
|
|
17
|
+
export type { RoktAttributeValue, RoktAttributeValueType, RoktAttributeValueArray, RoktAttributes, IRoktPartnerExtensionData, IRoktSelectPlacementsOptions, IRoktSelection, IRoktLauncher, IRoktMessage, RoktKitFilterSettings, IRoktKitSettings, IRoktKit, IRoktOptions, IRoktLauncherOptions, } from './roktManager';
|
|
18
|
+
export type { ErrorCodes, WSDKErrorSeverity, } from './reporting/types';
|
|
19
|
+
export type { ISDKError, ISDKLogEntry, IErrorReportingService, ILoggingService, } from './reporting/types';
|
|
20
|
+
export type { SDKEvent, SDKProductAction, SDKProductActionType, SDKPromotionAction, SDKShoppingCart, SDKGeoLocation, SDKDataPlan, SDKLoggerApi, SDKConfigApi, IMParticleInstanceManager, } from './sdkRuntimeModels';
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { SDKEvent, KitBlockerDataPlan } from './sdkRuntimeModels';
|
|
2
|
+
import { BaseEvent } from '@mparticle/event-models';
|
|
3
|
+
import { DataPlanPoint } from '@mparticle/data-planning-models';
|
|
4
|
+
import { IMParticleWebSDKInstance } from './mp-instance';
|
|
5
|
+
export default class KitBlocker {
|
|
6
|
+
dataPlanMatchLookups: {
|
|
7
|
+
[key: string]: {};
|
|
8
|
+
};
|
|
9
|
+
blockEvents: boolean;
|
|
10
|
+
blockEventAttributes: boolean;
|
|
11
|
+
blockUserAttributes: boolean;
|
|
12
|
+
blockUserIdentities: boolean;
|
|
13
|
+
kitBlockingEnabled: boolean;
|
|
14
|
+
mpInstance: IMParticleWebSDKInstance;
|
|
15
|
+
constructor(dataPlan: KitBlockerDataPlan, mpInstance: IMParticleWebSDKInstance);
|
|
16
|
+
addToMatchLookups(point: DataPlanPoint): void;
|
|
17
|
+
generateMatchKey(match: any): string | null;
|
|
18
|
+
generateProductAttributeMatchKey(match: any): string | null;
|
|
19
|
+
getPlannedProperties(type: any, validator: any): boolean | {
|
|
20
|
+
[key: string]: true;
|
|
21
|
+
} | null;
|
|
22
|
+
getProductProperties(type: any, validator: any): boolean | {
|
|
23
|
+
[key: string]: true;
|
|
24
|
+
} | null;
|
|
25
|
+
getMatchKey(eventToMatch: BaseEvent): string | null;
|
|
26
|
+
getProductAttributeMatchKey(eventToMatch: BaseEvent): string | null;
|
|
27
|
+
createBlockedEvent(event: SDKEvent): SDKEvent;
|
|
28
|
+
transformEventAndEventAttributes(event: SDKEvent): SDKEvent;
|
|
29
|
+
transformProductAttributes(event: SDKEvent): SDKEvent;
|
|
30
|
+
transformUserAttributes(event: SDKEvent): {
|
|
31
|
+
DeviceId: string;
|
|
32
|
+
IsFirstRun: boolean;
|
|
33
|
+
EventName: string;
|
|
34
|
+
EventCategory: number;
|
|
35
|
+
UserAttributes?: import("./identity-user-interfaces").ISDKUserAttributes;
|
|
36
|
+
UserIdentities?: import("./identity-user-interfaces").ISDKUserIdentity[];
|
|
37
|
+
SourceMessageId: string;
|
|
38
|
+
MPID: string;
|
|
39
|
+
EventAttributes?: {
|
|
40
|
+
[key: string]: string;
|
|
41
|
+
};
|
|
42
|
+
SDKVersion: string;
|
|
43
|
+
SessionId: string;
|
|
44
|
+
SessionStartDate: number;
|
|
45
|
+
SessionLength?: number;
|
|
46
|
+
currentSessionMPIDs?: string[];
|
|
47
|
+
Timestamp: number;
|
|
48
|
+
EventDataType: number;
|
|
49
|
+
Debug: boolean;
|
|
50
|
+
Location?: import("./sdkRuntimeModels").SDKGeoLocation;
|
|
51
|
+
OptOut?: boolean;
|
|
52
|
+
CustomFlags?: import("./sdkRuntimeModels").SDKEventCustomFlags;
|
|
53
|
+
AppVersion?: string;
|
|
54
|
+
AppName?: string;
|
|
55
|
+
Package?: string;
|
|
56
|
+
ConsentState?: import("./consent").SDKConsentState;
|
|
57
|
+
IntegrationAttributes?: import("./store").IntegrationAttributes;
|
|
58
|
+
ProductAction?: import("./sdkRuntimeModels").SDKProductAction;
|
|
59
|
+
PromotionAction?: import("./sdkRuntimeModels").SDKPromotionAction;
|
|
60
|
+
ProductImpressions?: import("./sdkRuntimeModels").SDKProductImpression[];
|
|
61
|
+
ShoppingCart?: import("./sdkRuntimeModels").SDKShoppingCart;
|
|
62
|
+
UserIdentityChanges?: import("./identity-user-interfaces").ISDKUserIdentityChanges;
|
|
63
|
+
UserAttributeChanges?: import("./identity-user-interfaces").ISDKUserAttributeChangeData;
|
|
64
|
+
CurrencyCode: string;
|
|
65
|
+
DataPlan?: import("./sdkRuntimeModels").SDKDataPlan;
|
|
66
|
+
LaunchReferral?: string;
|
|
67
|
+
ExpandedEventCount: number;
|
|
68
|
+
ActiveTimeOnSite: number;
|
|
69
|
+
IsBackgroundAST?: boolean;
|
|
70
|
+
AlreadySentToForwarders?: boolean;
|
|
71
|
+
};
|
|
72
|
+
isAttributeKeyBlocked(key: string): boolean;
|
|
73
|
+
isIdentityBlocked(key: string): boolean;
|
|
74
|
+
transformUserIdentities(event: SDKEvent): {
|
|
75
|
+
DeviceId: string;
|
|
76
|
+
IsFirstRun: boolean;
|
|
77
|
+
EventName: string;
|
|
78
|
+
EventCategory: number;
|
|
79
|
+
UserAttributes?: import("./identity-user-interfaces").ISDKUserAttributes;
|
|
80
|
+
UserIdentities?: import("./identity-user-interfaces").ISDKUserIdentity[];
|
|
81
|
+
SourceMessageId: string;
|
|
82
|
+
MPID: string;
|
|
83
|
+
EventAttributes?: {
|
|
84
|
+
[key: string]: string;
|
|
85
|
+
};
|
|
86
|
+
SDKVersion: string;
|
|
87
|
+
SessionId: string;
|
|
88
|
+
SessionStartDate: number;
|
|
89
|
+
SessionLength?: number;
|
|
90
|
+
currentSessionMPIDs?: string[];
|
|
91
|
+
Timestamp: number;
|
|
92
|
+
EventDataType: number;
|
|
93
|
+
Debug: boolean;
|
|
94
|
+
Location?: import("./sdkRuntimeModels").SDKGeoLocation;
|
|
95
|
+
OptOut?: boolean;
|
|
96
|
+
CustomFlags?: import("./sdkRuntimeModels").SDKEventCustomFlags;
|
|
97
|
+
AppVersion?: string;
|
|
98
|
+
AppName?: string;
|
|
99
|
+
Package?: string;
|
|
100
|
+
ConsentState?: import("./consent").SDKConsentState;
|
|
101
|
+
IntegrationAttributes?: import("./store").IntegrationAttributes;
|
|
102
|
+
ProductAction?: import("./sdkRuntimeModels").SDKProductAction;
|
|
103
|
+
PromotionAction?: import("./sdkRuntimeModels").SDKPromotionAction;
|
|
104
|
+
ProductImpressions?: import("./sdkRuntimeModels").SDKProductImpression[];
|
|
105
|
+
ShoppingCart?: import("./sdkRuntimeModels").SDKShoppingCart;
|
|
106
|
+
UserIdentityChanges?: import("./identity-user-interfaces").ISDKUserIdentityChanges;
|
|
107
|
+
UserAttributeChanges?: import("./identity-user-interfaces").ISDKUserAttributeChangeData;
|
|
108
|
+
CurrencyCode: string;
|
|
109
|
+
DataPlan?: import("./sdkRuntimeModels").SDKDataPlan;
|
|
110
|
+
LaunchReferral?: string;
|
|
111
|
+
ExpandedEventCount: number;
|
|
112
|
+
ActiveTimeOnSite: number;
|
|
113
|
+
IsBackgroundAST?: boolean;
|
|
114
|
+
AlreadySentToForwarders?: boolean;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Dictionary, valueof } from "./utils";
|
|
2
|
+
import { EventType, IdentityType } from "./types";
|
|
3
|
+
export default class KitFilterHelper {
|
|
4
|
+
static hashEventType(eventType: valueof<typeof EventType>): number;
|
|
5
|
+
static hashEventName(eventName: string, eventType: valueof<typeof EventType>): number;
|
|
6
|
+
static hashEventAttributeKey(eventType: valueof<typeof EventType>, eventName: string, customAttributeName: string): number;
|
|
7
|
+
static hashUserAttribute(userAttributeKey: string): number;
|
|
8
|
+
static hashUserIdentity(userIdentity: typeof IdentityType): typeof IdentityType;
|
|
9
|
+
static hashConsentPurpose(prefix: string, purpose: string): number;
|
|
10
|
+
static hashAttributeConditionalForwarding(attribute: string): string;
|
|
11
|
+
static hashConsentPurposeConditionalForwarding(prefix: string, purpose: string): string;
|
|
12
|
+
static readonly filterUserAttributes: (userAttributes: Dictionary<string>, filterList: number[]) => Dictionary<string>;
|
|
13
|
+
static readonly filterUserIdentities: (userIdentities: Dictionary<string>, filterList: number[]) => Dictionary<string>;
|
|
14
|
+
static readonly isFilteredUserAttribute: (userAttributeKey: string, filterList: number[]) => boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LogLevelType, SDKInitConfig, SDKLoggerApi } from './sdkRuntimeModels';
|
|
2
|
+
export type ILoggerConfig = Pick<SDKInitConfig, 'logLevel' | 'logger'>;
|
|
3
|
+
export type IConsoleLogger = Partial<Pick<SDKLoggerApi, 'error' | 'warning' | 'verbose'>>;
|
|
4
|
+
export declare class Logger {
|
|
5
|
+
private logLevel;
|
|
6
|
+
private logger;
|
|
7
|
+
constructor(config: ILoggerConfig);
|
|
8
|
+
verbose(msg: string): void;
|
|
9
|
+
warning(msg: string): void;
|
|
10
|
+
error(msg: string): void;
|
|
11
|
+
isVerbose(): boolean;
|
|
12
|
+
setLogLevel(newLogLevel: LogLevelType): void;
|
|
13
|
+
}
|
|
14
|
+
export declare class ConsoleLogger implements IConsoleLogger {
|
|
15
|
+
verbose(msg: string): void;
|
|
16
|
+
error(msg: string): void;
|
|
17
|
+
warning(msg: string): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { IAPIClient } from './apiClient';
|
|
2
|
+
import { ICookieSyncManager } from './cookieSyncManager';
|
|
3
|
+
import { ISessionManager } from './sessionManager';
|
|
4
|
+
import { IStore } from './store';
|
|
5
|
+
import { IServerModel } from './serverModel';
|
|
6
|
+
import ForwardingStatsUploader from './forwardingStatsUploader';
|
|
7
|
+
import { IConsent } from './consent';
|
|
8
|
+
import IdentityAPIClient from './identityApiClient';
|
|
9
|
+
import IntegrationCapture from './integrationCapture';
|
|
10
|
+
import { IPreInit } from './pre-init-utils';
|
|
11
|
+
import { MParticleWebSDK, SDKHelpersApi } from './sdkRuntimeModels';
|
|
12
|
+
import { Dictionary } from '@mparticle/web-sdk';
|
|
13
|
+
import { IIdentity } from './identity.interfaces';
|
|
14
|
+
import { IEvents } from './events.interfaces';
|
|
15
|
+
import { IECommerce } from './ecommerce.interfaces';
|
|
16
|
+
import { INativeSdkHelpers } from './nativeSdkHelpers.interfaces';
|
|
17
|
+
import { IPersistence } from './persistence.interfaces';
|
|
18
|
+
import ForegroundTimer from './foregroundTimeTracker';
|
|
19
|
+
import RoktManager from './roktManager';
|
|
20
|
+
import { ICookieConsentManager } from './cookieConsentManager';
|
|
21
|
+
import { ErrorReportingDispatcher } from './reporting/errorReportingDispatcher';
|
|
22
|
+
import { LoggingDispatcher } from './reporting/loggingDispatcher';
|
|
23
|
+
export interface IErrorLogMessage {
|
|
24
|
+
message?: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
stack?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface IErrorLogMessageMinified {
|
|
29
|
+
m?: string;
|
|
30
|
+
s?: string;
|
|
31
|
+
t?: string;
|
|
32
|
+
}
|
|
33
|
+
export type IntegrationDelays = Dictionary<boolean>;
|
|
34
|
+
export interface IMParticleWebSDKInstance extends MParticleWebSDK {
|
|
35
|
+
_APIClient: IAPIClient;
|
|
36
|
+
_Consent: IConsent;
|
|
37
|
+
_CookieSyncManager: ICookieSyncManager;
|
|
38
|
+
_Ecommerce: IECommerce;
|
|
39
|
+
_Events: IEvents;
|
|
40
|
+
_Forwarders: any;
|
|
41
|
+
_ForwardingStatsUploader: ForwardingStatsUploader;
|
|
42
|
+
_Helpers: SDKHelpersApi;
|
|
43
|
+
_Identity: IIdentity;
|
|
44
|
+
_IdentityAPIClient: typeof IdentityAPIClient;
|
|
45
|
+
_IntegrationCapture: IntegrationCapture;
|
|
46
|
+
_NativeSdkHelpers: INativeSdkHelpers;
|
|
47
|
+
_Persistence: IPersistence;
|
|
48
|
+
_CookieConsentManager: ICookieConsentManager;
|
|
49
|
+
_ErrorReportingDispatcher: ErrorReportingDispatcher;
|
|
50
|
+
_LoggingDispatcher: LoggingDispatcher;
|
|
51
|
+
_RoktManager: RoktManager;
|
|
52
|
+
_SessionManager: ISessionManager;
|
|
53
|
+
_ServerModel: IServerModel;
|
|
54
|
+
_Store: IStore;
|
|
55
|
+
_instanceName: string;
|
|
56
|
+
_preInit: IPreInit;
|
|
57
|
+
_timeOnSiteTimer: ForegroundTimer;
|
|
58
|
+
setLauncherInstanceGuid: () => void;
|
|
59
|
+
getLauncherInstanceGuid: () => string;
|
|
60
|
+
captureTiming(metricName: string): any;
|
|
61
|
+
processQueueOnIdentityFailure?: () => void;
|
|
62
|
+
processQueueOnNoFunctional?: () => void;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* <p>All of the following methods can be called on the primary mParticle class. In version 2.10.0, we introduced <a href="https://docs.mparticle.com/developers/sdk/web/multiple-instances/">multiple instances</a>. If you are using multiple instances (self hosted environments only), you should call these methods on each instance.</p>
|
|
66
|
+
* <p>In current versions of mParticle, if your site has one instance, that instance name is 'default_instance'. Any methods called on mParticle on a site with one instance will be mapped to the `default_instance`.</p>
|
|
67
|
+
* <p>This is for simplicity and backwards compatibility. For example, calling mParticle.logPageView() automatically maps to mParticle.getInstance('default_instance').logPageView().</p>
|
|
68
|
+
* <p>If you have multiple instances, instances must first be initialized and then a method can be called on that instance. For example:</p>
|
|
69
|
+
* <code>
|
|
70
|
+
* mParticle.init('apiKey', config, 'another_instance');
|
|
71
|
+
* mParticle.getInstance('another_instance').logPageView();
|
|
72
|
+
* </code>
|
|
73
|
+
*
|
|
74
|
+
* @class mParticle & mParticleInstance
|
|
75
|
+
*/
|
|
76
|
+
export default function mParticleInstance(this: IMParticleWebSDKInstance, instanceName: string): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default function NativeSdkHelpers(mpInstance: any): void;
|
|
2
|
+
export default class NativeSdkHelpers {
|
|
3
|
+
constructor(mpInstance: any);
|
|
4
|
+
initializeSessionAttributes: (apiKey: any) => void;
|
|
5
|
+
isBridgeV2Available: (bridgeName: any) => boolean;
|
|
6
|
+
isWebviewEnabled: (requiredWebviewBridgeName: any, minWebviewBridgeVersion: any) => any;
|
|
7
|
+
isBridgeV1Available: () => boolean;
|
|
8
|
+
sendToNative: (path: any, value: any) => void;
|
|
9
|
+
sendViaBridgeV1: (path: any, value: any) => void;
|
|
10
|
+
sendViaIframeToIOS: (path: any, value: any) => void;
|
|
11
|
+
sendViaBridgeV2: (path: any, value: any, requiredWebviewBridgeName: any) => void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface INativeSdkHelpers {
|
|
2
|
+
initializeSessionAttributes: (apiKey: string) => void;
|
|
3
|
+
isBridgeV2Available: (bridgeName: string) => boolean;
|
|
4
|
+
isWebviewEnabled: (requiredWebviewBridgeName: string, minWebviewBridgeVersion: number) => boolean;
|
|
5
|
+
isBridgeV1Available: () => boolean;
|
|
6
|
+
sendToNative: (path: string, value?: string) => void;
|
|
7
|
+
sendViaBridgeV1: (path: string, value: string) => void;
|
|
8
|
+
sendViaIframeToIOS: (path: string, value: string) => void;
|
|
9
|
+
sendViaBridgeV2: (path: string, value: string, requiredWebviewBridgeName: boolean) => void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export default function _Persistence(mpInstance: any): void;
|
|
2
|
+
export default class _Persistence {
|
|
3
|
+
constructor(mpInstance: any);
|
|
4
|
+
useLocalStorage: () => any;
|
|
5
|
+
initializeStorage: () => void;
|
|
6
|
+
update: () => void;
|
|
7
|
+
storeDataInMemory: (obj: any, currentMPID: any) => void;
|
|
8
|
+
determineLocalStorageAvailability: (storage: any) => any;
|
|
9
|
+
setLocalStorage: () => void;
|
|
10
|
+
getLocalStorage: () => {};
|
|
11
|
+
expireCookies: (cookieName: any) => void;
|
|
12
|
+
getCookie: () => any;
|
|
13
|
+
setCookie: () => void;
|
|
14
|
+
reduceAndEncodePersistence: (persistence: any, expires: any, domain: any, maxCookieSize: any) => string;
|
|
15
|
+
findPrevCookiesBasedOnUI: (identityApiData: any) => void;
|
|
16
|
+
encodePersistence: (persistence: any) => string;
|
|
17
|
+
decodePersistence: (persistence: any) => string;
|
|
18
|
+
getCookieDomain: () => any;
|
|
19
|
+
getDomain: (doc: any, locationHostname: any) => any;
|
|
20
|
+
saveUserCookieSyncDatesToPersistence: (mpid: any, csd: any) => void;
|
|
21
|
+
swapCurrentUser: (previousMPID: any, currentMPID: any, currentSessionMPIDs: any) => void;
|
|
22
|
+
savePersistence: (persistence: any) => void;
|
|
23
|
+
getPersistence: () => any;
|
|
24
|
+
getFirstSeenTime: (mpid: any) => any;
|
|
25
|
+
/**
|
|
26
|
+
* set the "first seen" time for a user. the time will only be set once for a given
|
|
27
|
+
* mpid after which subsequent calls will be ignored
|
|
28
|
+
*/
|
|
29
|
+
setFirstSeenTime: (mpid: any, time: any) => void;
|
|
30
|
+
/**
|
|
31
|
+
* returns the "last seen" time for a user. If the mpid represents the current user, the
|
|
32
|
+
* return value will always be the current time, otherwise it will be to stored "last seen"
|
|
33
|
+
* time
|
|
34
|
+
*/
|
|
35
|
+
getLastSeenTime: (mpid: any) => any;
|
|
36
|
+
setLastSeenTime: (mpid: any, time: any) => void;
|
|
37
|
+
getDeviceId: () => any;
|
|
38
|
+
setDeviceId: (guid: any) => void;
|
|
39
|
+
resetPersistence: () => void;
|
|
40
|
+
forwardingStatsBatches: {
|
|
41
|
+
uploadsTable: {};
|
|
42
|
+
forwardingStatsEventQueue: any[];
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Context } from '@mparticle/event-models';
|
|
2
|
+
import { IdentityApiData, MPID, Product, UserIdentities } from '@mparticle/web-sdk';
|
|
3
|
+
import { IForwardingStatsData } from './apiClient';
|
|
4
|
+
import { IntegrationAttributes, ServerSettings, SessionAttributes, LocalSessionAttributes } from './store';
|
|
5
|
+
import { Dictionary } from './utils';
|
|
6
|
+
import { IMinifiedConsentJSONObject } from './consent';
|
|
7
|
+
import { UserAttributes } from './identity-user-interfaces';
|
|
8
|
+
import { CookieSyncDates } from './cookieSyncManager';
|
|
9
|
+
export type UploadsTable = Dictionary<any>;
|
|
10
|
+
export interface iForwardingStatsBatches {
|
|
11
|
+
uploadsTable: UploadsTable;
|
|
12
|
+
forwardingStatsEventQueue: IForwardingStatsData[];
|
|
13
|
+
}
|
|
14
|
+
export interface IGlobalStoreV2MinifiedKeys {
|
|
15
|
+
sid: string;
|
|
16
|
+
ie: boolean;
|
|
17
|
+
sa: SessionAttributes;
|
|
18
|
+
lsa?: LocalSessionAttributes;
|
|
19
|
+
ss: ServerSettings;
|
|
20
|
+
dt: string;
|
|
21
|
+
av: string;
|
|
22
|
+
cgid: string;
|
|
23
|
+
das: string;
|
|
24
|
+
ia: IntegrationAttributes;
|
|
25
|
+
c: Context;
|
|
26
|
+
csm: MPID[];
|
|
27
|
+
les: number;
|
|
28
|
+
ssd: number;
|
|
29
|
+
}
|
|
30
|
+
export interface IPersistenceMinified extends Dictionary {
|
|
31
|
+
cu: MPID;
|
|
32
|
+
gs: IGlobalStoreV2MinifiedKeys;
|
|
33
|
+
l: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface IUserPersistenceMinified extends Dictionary {
|
|
36
|
+
csd: CookieSyncDates;
|
|
37
|
+
con: IMinifiedConsentJSONObject;
|
|
38
|
+
ui: UserIdentities;
|
|
39
|
+
ua: UserAttributes;
|
|
40
|
+
cp: Product[];
|
|
41
|
+
fst: number;
|
|
42
|
+
lst: number;
|
|
43
|
+
}
|
|
44
|
+
export interface IPersistence {
|
|
45
|
+
useLocalStorage(): boolean;
|
|
46
|
+
initializeStorage(): void;
|
|
47
|
+
update(): void;
|
|
48
|
+
storeDataInMemory(obj: IPersistenceMinified, currentMPID: MPID): void;
|
|
49
|
+
determineLocalStorageAvailability(storage: Storage): boolean;
|
|
50
|
+
setLocalStorage(): void;
|
|
51
|
+
getLocalStorage(): IPersistenceMinified | null;
|
|
52
|
+
expireCookies(cookieName: string): void;
|
|
53
|
+
getCookie(): IPersistenceMinified | null;
|
|
54
|
+
setCookie(): void;
|
|
55
|
+
reduceAndEncodePersistence(persistence: IPersistenceMinified, expires: string, domain: string, maxCookieSize: number): string;
|
|
56
|
+
findPrevCookiesBasedOnUI(identityApiData: IdentityApiData): void;
|
|
57
|
+
encodePersistence(persistence: IPersistenceMinified): string;
|
|
58
|
+
decodePersistence(persistenceString: string): string;
|
|
59
|
+
getCookieDomain(): string;
|
|
60
|
+
getDomain(doc: string, locationHostname: string): string;
|
|
61
|
+
saveUserCookieSyncDatesToPersistence(mpid: MPID, csd: CookieSyncDates): void;
|
|
62
|
+
savePersistence(persistance: IPersistenceMinified): void;
|
|
63
|
+
getPersistence(): IPersistenceMinified;
|
|
64
|
+
getFirstSeenTime(mpid: MPID): string | null;
|
|
65
|
+
setFirstSeenTime(mpid: MPID, time: number): void;
|
|
66
|
+
getLastSeenTime(mpid: MPID): number | null;
|
|
67
|
+
setLastSeenTime(mpid: MPID, time: number): void;
|
|
68
|
+
getDeviceId(): string;
|
|
69
|
+
setDeviceId(guid: string): void;
|
|
70
|
+
resetPersistence(): void;
|
|
71
|
+
swapCurrentUser(previousMPID: MPID, currentMPID: MPID, currentSessionMPIDs?: MPID[]): void;
|
|
72
|
+
forwardingStatsBatches: iForwardingStatsBatches;
|
|
73
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export function forEach(callback: any, thisArg: any, ...args: any[]): void;
|
|
3
|
+
export function map(callback: any, thisArg: any, ...args: any[]): any[];
|
|
4
|
+
export function filter(fun: any, ...args: any[]): any[];
|
|
5
|
+
export function isArray(arg: any): boolean;
|
|
6
|
+
export { Base64 };
|
|
7
|
+
}
|
|
8
|
+
export default _default;
|
|
9
|
+
declare namespace Base64 {
|
|
10
|
+
let _keyStr: string;
|
|
11
|
+
function encode(input: any): string;
|
|
12
|
+
function _encode(input: any): string;
|
|
13
|
+
function decode(input: any): string;
|
|
14
|
+
function _decode(input: any): string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IPixelConfiguration } from './cookieSyncManager';
|
|
2
|
+
import { MPForwarder } from './forwarders.interfaces';
|
|
3
|
+
import { IntegrationDelays } from './mp-instance';
|
|
4
|
+
export interface IPreInit {
|
|
5
|
+
readyQueue: Function[] | any[];
|
|
6
|
+
integrationDelays: IntegrationDelays;
|
|
7
|
+
forwarderConstructors: MPForwarder[];
|
|
8
|
+
pixelConfigurations?: IPixelConfiguration[];
|
|
9
|
+
isDevelopmentMode?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const processReadyQueue: (readyQueue: any) => Function[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public types for @mparticle/web-sdk
|
|
3
|
+
*
|
|
4
|
+
* These types are part of the stable public API and are safe for customers
|
|
5
|
+
* to import. Only add types here that are intended for external consumption.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import type { SDKInitConfig, EventType } from '@mparticle/web-sdk';
|
|
9
|
+
*
|
|
10
|
+
* Note: Types from @types/mparticle__web-sdk (e.g., MPConfiguration, MPID,
|
|
11
|
+
* ConsentState) are NOT re-exported here to avoid circular references.
|
|
12
|
+
* Consumers get those automatically via DefinitelyTyped until they are
|
|
13
|
+
* natively defined in this SDK and the DT package is deprecated.
|
|
14
|
+
*/
|
|
15
|
+
export type { Batch, } from '@mparticle/event-models';
|
|
16
|
+
export type { EventType, CommerceEventType, IdentityType, ProductActionType, PromotionActionType, MessageType, } from './types';
|
|
17
|
+
export type { SDKInitConfig, DataPlanConfig, BaseEvent, SDKEventCustomFlags, LogLevelType, MParticleWebSDK, } from './sdkRuntimeModels';
|
|
18
|
+
export type { IMParticleUser, IdentityCallback, IdentityResult, IdentityResultBody, IdentityModifyResultBody, ISDKUserIdentity, ISDKUserAttributes, } from './identity-user-interfaces';
|
|
19
|
+
export type { SDKIdentityApi, IAliasRequest, IAliasCallback, IAliasResult, SDKIdentityTypeEnum, } from './identity.interfaces';
|
|
20
|
+
export type { SDKECommerceAPI, SDKCart, } from './ecommerce.interfaces';
|
|
21
|
+
export type { SDKProduct, SDKPromotion, SDKImpression, SDKProductImpression, } from './sdkRuntimeModels';
|
|
22
|
+
export type { SDKConsentApi, SDKConsentState, SDKConsentStateData, SDKGDPRConsentState, SDKCCPAConsentState, } from './consent';
|
|
23
|
+
export type { Dictionary, valueof } from './utils';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SDKLoggerApi } from '../sdkRuntimeModels';
|
|
2
|
+
import { IErrorReportingService, ISDKError } from './types';
|
|
3
|
+
export declare class ErrorReportingDispatcher implements IErrorReportingService {
|
|
4
|
+
private readonly services;
|
|
5
|
+
logger?: SDKLoggerApi;
|
|
6
|
+
register(service: IErrorReportingService): void;
|
|
7
|
+
report(error: ISDKError): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SDKLoggerApi } from '../sdkRuntimeModels';
|
|
2
|
+
import { ILoggingService, ISDKLogEntry } from './types';
|
|
3
|
+
export declare class LoggingDispatcher implements ILoggingService {
|
|
4
|
+
private readonly services;
|
|
5
|
+
logger?: SDKLoggerApi;
|
|
6
|
+
register(service: ILoggingService): void;
|
|
7
|
+
log(entry: ISDKLogEntry): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { valueof } from '../utils';
|
|
2
|
+
export declare const ErrorCodes: {
|
|
3
|
+
readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
|
|
4
|
+
readonly UNHANDLED_EXCEPTION: "UNHANDLED_EXCEPTION";
|
|
5
|
+
readonly IDENTITY_REQUEST: "IDENTITY_REQUEST";
|
|
6
|
+
readonly IDENTITY_MISMATCH: "IDENTITY_MISMATCH";
|
|
7
|
+
readonly ROKT_KIT_ATTACHED: "ROKT_KIT_ATTACHED";
|
|
8
|
+
};
|
|
9
|
+
export type ErrorCodes = valueof<typeof ErrorCodes>;
|
|
10
|
+
export declare const WSDKErrorSeverity: {
|
|
11
|
+
readonly ERROR: "ERROR";
|
|
12
|
+
readonly INFO: "INFO";
|
|
13
|
+
readonly WARNING: "WARNING";
|
|
14
|
+
};
|
|
15
|
+
export type WSDKErrorSeverity = (typeof WSDKErrorSeverity)[keyof typeof WSDKErrorSeverity];
|
|
16
|
+
/** Structured error object for reporting. */
|
|
17
|
+
export interface ISDKError {
|
|
18
|
+
message: string;
|
|
19
|
+
code?: ErrorCodes;
|
|
20
|
+
severity: WSDKErrorSeverity;
|
|
21
|
+
stackTrace?: string;
|
|
22
|
+
additionalInformation?: Record<string, string>;
|
|
23
|
+
}
|
|
24
|
+
/** Structured log entry for informational logging. */
|
|
25
|
+
export interface ISDKLogEntry {
|
|
26
|
+
message: string;
|
|
27
|
+
code?: ErrorCodes;
|
|
28
|
+
additionalInformation?: Record<string, string>;
|
|
29
|
+
}
|
|
30
|
+
/** Contract for error/warning reporting services. */
|
|
31
|
+
export interface IErrorReportingService {
|
|
32
|
+
report(error: ISDKError): void;
|
|
33
|
+
}
|
|
34
|
+
/** Contract for informational logging services. */
|
|
35
|
+
export interface ILoggingService {
|
|
36
|
+
log(entry: ISDKLogEntry): void;
|
|
37
|
+
}
|