@mparticle/web-sdk 2.61.0 → 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.
Files changed (62) hide show
  1. package/dist/mparticle.common.js +1 -1
  2. package/dist/mparticle.esm.js +1 -1
  3. package/dist/mparticle.js +1 -1
  4. package/dist/types/src/apiClient.d.ts +34 -0
  5. package/dist/types/src/audience.d.ts +4 -0
  6. package/dist/types/src/audienceManager.d.ts +19 -0
  7. package/dist/types/src/batchUploader.d.ts +72 -0
  8. package/dist/types/src/configAPIClient.d.ts +68 -0
  9. package/dist/types/src/consent.d.ts +71 -0
  10. package/dist/types/src/constants.d.ts +201 -0
  11. package/dist/types/src/cookieConsentManager.d.ts +50 -0
  12. package/dist/types/src/cookieSyncManager.d.ts +34 -0
  13. package/dist/types/src/ecommerce.d.ts +52 -0
  14. package/dist/types/src/ecommerce.interfaces.d.ts +78 -0
  15. package/dist/types/src/events.d.ts +17 -0
  16. package/dist/types/src/events.interfaces.d.ts +21 -0
  17. package/dist/types/src/filteredMparticleUser.d.ts +8 -0
  18. package/dist/types/src/foregroundTimeTracker.d.ts +21 -0
  19. package/dist/types/src/forwarders.d.ts +26 -0
  20. package/dist/types/src/forwarders.interfaces.d.ts +59 -0
  21. package/dist/types/src/forwardingStatsUploader.d.ts +5 -0
  22. package/dist/types/src/helpers.d.ts +54 -0
  23. package/dist/types/src/identity-user-interfaces.d.ts +106 -0
  24. package/dist/types/src/identity-utils.d.ts +36 -0
  25. package/dist/types/src/identity.interfaces.d.ts +117 -0
  26. package/dist/types/src/identityApiClient.d.ts +14 -0
  27. package/dist/types/src/integrationCapture.d.ts +83 -0
  28. package/dist/types/src/internal-types.d.ts +20 -0
  29. package/dist/types/src/kitBlocking.d.ts +116 -0
  30. package/dist/types/src/kitFilterHelper.d.ts +15 -0
  31. package/dist/types/src/logger.d.ts +18 -0
  32. package/dist/types/src/mockBatchCreator.d.ts +7 -0
  33. package/dist/types/src/mp-instance.d.ts +76 -0
  34. package/dist/types/src/mparticle-instance-manager.d.ts +2 -0
  35. package/dist/types/src/nativeSdkHelpers.d.ts +12 -0
  36. package/dist/types/src/nativeSdkHelpers.interfaces.d.ts +10 -0
  37. package/dist/types/src/persistence.d.ts +44 -0
  38. package/dist/types/src/persistence.interfaces.d.ts +73 -0
  39. package/dist/types/src/polyfill.d.ts +15 -0
  40. package/dist/types/src/pre-init-utils.d.ts +11 -0
  41. package/dist/types/src/public-types.d.ts +23 -0
  42. package/dist/types/src/reporting/errorReportingDispatcher.d.ts +8 -0
  43. package/dist/types/src/reporting/loggingDispatcher.d.ts +8 -0
  44. package/dist/types/src/reporting/types.d.ts +37 -0
  45. package/dist/types/src/roktManager.d.ts +176 -0
  46. package/dist/types/src/sdkRuntimeModels.d.ts +319 -0
  47. package/dist/types/src/sdkToEventsApiConverter.d.ts +43 -0
  48. package/dist/types/src/serverModel.d.ts +105 -0
  49. package/dist/types/src/sessionManager.d.ts +16 -0
  50. package/dist/types/src/sideloadedKit.d.ts +30 -0
  51. package/dist/types/src/store.d.ts +157 -0
  52. package/dist/types/src/stub/mparticle.stub.d.ts +182 -0
  53. package/dist/types/src/types.d.ts +154 -0
  54. package/dist/types/src/uploaders.d.ts +21 -0
  55. package/dist/types/src/user-utils.d.ts +5 -0
  56. package/dist/types/src/utils.d.ts +82 -0
  57. package/dist/types/src/validators.d.ts +18 -0
  58. package/dist/types/src/vault.d.ts +41 -0
  59. package/package.json +15 -2
  60. package/src/forwarders.interfaces.ts +42 -0
  61. package/src/internal-types.ts +66 -0
  62. package/src/public-types.ts +84 -0
@@ -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>;
@@ -0,0 +1,182 @@
1
+ export default mParticle;
2
+ declare namespace mParticle {
3
+ export { voidFunction as endSession };
4
+ export { returnString as getAppName };
5
+ export { returnString as getAppVersion };
6
+ export { returnString as getDeviceId };
7
+ export { returnString as getEnvironment };
8
+ export { returnString as getVersion };
9
+ export { voidFunction as init };
10
+ export { voidFunction as logError };
11
+ export { voidFunction as logEvent };
12
+ export { voidFunction as logForm };
13
+ export { voidFunction as logLink };
14
+ export { voidFunction as logPageView };
15
+ export { voidFunction as ready };
16
+ export { voidFunction as reset };
17
+ export { voidFunction as _resetForTests };
18
+ export { voidFunction as setAppName };
19
+ export { voidFunction as setAppVersion };
20
+ export { voidFunction as setLogLevel };
21
+ export { voidFunction as setOptOut };
22
+ export { voidFunction as setPosition };
23
+ export { voidFunction as setSessionAttribute };
24
+ export { voidFunction as startNewSession };
25
+ export { voidFunction as startTrackingLocation };
26
+ export { voidFunction as stopTrackingLocation };
27
+ export let CommerceEventType: {};
28
+ export let EventType: {};
29
+ export let IdentityType: {};
30
+ export let ProductActionType: {};
31
+ export let PromotionType: {};
32
+ export namespace eCommerce {
33
+ export { returnImpression as createImpression };
34
+ export { returnProduct as createProduct };
35
+ export { returnPromotion as createPromotion };
36
+ export { returnTransactionAttributes as createTransactionAttributes };
37
+ export { voidFunction as logCheckout };
38
+ export { voidFunction as logImpression };
39
+ export { voidFunction as logProductAction };
40
+ export { voidFunction as logPromotion };
41
+ export { voidFunction as logPurchase };
42
+ export { voidFunction as logRefund };
43
+ export { voidFunction as setCurrencyCode };
44
+ export let Cart: any;
45
+ }
46
+ export namespace Consent {
47
+ export { createConsentState };
48
+ export { returnGDPRConsent as createGDPRConsent };
49
+ }
50
+ export namespace Identity {
51
+ export { voidFunction as aliasUsers };
52
+ export { createAliasRequest };
53
+ export { returnUser as getCurrentUser };
54
+ export { returnUser as getUser };
55
+ export { returnUsers as getUsers };
56
+ export { voidFunction as identify };
57
+ export { voidFunction as login };
58
+ export { voidFunction as logout };
59
+ export { voidFunction as modify };
60
+ }
61
+ }
62
+ declare function voidFunction(): void;
63
+ declare function returnString(): string;
64
+ declare function returnImpression(): {
65
+ Name: string;
66
+ Product: {
67
+ Name: string;
68
+ Sku: string;
69
+ Price: number;
70
+ Quantity: number;
71
+ Brand: string;
72
+ Variant: string;
73
+ Category: string;
74
+ Position: string;
75
+ CouponCode: string;
76
+ TotalAmount: number;
77
+ Attributes: {};
78
+ };
79
+ };
80
+ declare function returnProduct(): {
81
+ Name: string;
82
+ Sku: string;
83
+ Price: number;
84
+ Quantity: number;
85
+ Brand: string;
86
+ Variant: string;
87
+ Category: string;
88
+ Position: string;
89
+ CouponCode: string;
90
+ TotalAmount: number;
91
+ Attributes: {};
92
+ };
93
+ declare function returnPromotion(): {
94
+ Id: string;
95
+ Creative: string;
96
+ Name: string;
97
+ Position: number;
98
+ };
99
+ declare function returnTransactionAttributes(): {
100
+ Id: string;
101
+ Affiliation: string;
102
+ CouponCode: string;
103
+ Revenue: number;
104
+ Shipping: string;
105
+ Tax: number;
106
+ };
107
+ declare function createConsentState(): {
108
+ addGDPRConsentState: typeof returnThis;
109
+ setGDPRConsentState: typeof returnThis;
110
+ getGDPRConsentState: typeof returnGDPRConsent;
111
+ removeGDPRConsentState: typeof returnThis;
112
+ };
113
+ declare function returnGDPRConsent(): {
114
+ ConsentDocument: string;
115
+ Consented: boolean;
116
+ HardwareId: string;
117
+ Location: string;
118
+ Timestamp: number;
119
+ };
120
+ declare function createAliasRequest(): {
121
+ sourceMpid: string;
122
+ destinationMpid: string;
123
+ startTime: number;
124
+ endTime: number;
125
+ scope: string;
126
+ };
127
+ declare function returnUser(): {
128
+ getUserIdentities: () => {
129
+ userIdentities: {};
130
+ };
131
+ getMPID: typeof returnString;
132
+ setUserTag: typeof voidFunction;
133
+ removeUserTag: typeof voidFunction;
134
+ setUserAttribute: typeof voidFunction;
135
+ setUserAttributes: typeof voidFunction;
136
+ removeUserAttribute: typeof voidFunction;
137
+ setUserAttributeList: typeof voidFunction;
138
+ removeAllUserAttributes: typeof voidFunction;
139
+ getUserAttributesLists: typeof returnObject;
140
+ getAllUserAttributes: typeof returnObject;
141
+ getCart: typeof Cart;
142
+ getConsentState: typeof createConsentState;
143
+ setConsentState: typeof voidFunction;
144
+ };
145
+ declare function returnUsers(): {
146
+ getUserIdentities: () => {
147
+ userIdentities: {};
148
+ };
149
+ getMPID: typeof returnString;
150
+ setUserTag: typeof voidFunction;
151
+ removeUserTag: typeof voidFunction;
152
+ setUserAttribute: typeof voidFunction;
153
+ setUserAttributes: typeof voidFunction;
154
+ removeUserAttribute: typeof voidFunction;
155
+ setUserAttributeList: typeof voidFunction;
156
+ removeAllUserAttributes: typeof voidFunction;
157
+ getUserAttributesLists: typeof returnObject;
158
+ getAllUserAttributes: typeof returnObject;
159
+ getCart: typeof Cart;
160
+ getConsentState: typeof createConsentState;
161
+ setConsentState: typeof voidFunction;
162
+ }[];
163
+ declare function returnThis(): any;
164
+ declare function returnObject(): {};
165
+ declare function Cart_1(): {
166
+ add: typeof voidFunction;
167
+ clear: typeof voidFunction;
168
+ remove: typeof voidFunction;
169
+ getCartProducts: () => {
170
+ Name: string;
171
+ Sku: string;
172
+ Price: number;
173
+ Quantity: number;
174
+ Brand: string;
175
+ Variant: string;
176
+ Category: string;
177
+ Position: string;
178
+ CouponCode: string;
179
+ TotalAmount: number;
180
+ Attributes: {};
181
+ }[];
182
+ };
@@ -0,0 +1,154 @@
1
+ export declare const MessageType: {
2
+ SessionStart: 1;
3
+ SessionEnd: 2;
4
+ PageView: 3;
5
+ PageEvent: 4;
6
+ CrashReport: 5;
7
+ OptOut: 6;
8
+ AppStateTransition: 10;
9
+ Profile: 14;
10
+ Commerce: 16;
11
+ Media: 20;
12
+ UserAttributeChange: 17;
13
+ UserIdentityChange: 18;
14
+ };
15
+ export declare const EventType: {
16
+ Unknown: 0;
17
+ Navigation: 1;
18
+ Location: 2;
19
+ Search: 3;
20
+ Transaction: 4;
21
+ UserContent: 5;
22
+ UserPreference: 6;
23
+ Social: 7;
24
+ Other: 8;
25
+ Media: 9;
26
+ getName(id: number): string;
27
+ };
28
+ export declare const CommerceEventType: {
29
+ ProductAddToCart: 10;
30
+ ProductRemoveFromCart: 11;
31
+ ProductCheckout: 12;
32
+ ProductCheckoutOption: 13;
33
+ ProductClick: 14;
34
+ ProductViewDetail: 15;
35
+ ProductPurchase: 16;
36
+ ProductRefund: 17;
37
+ PromotionView: 18;
38
+ PromotionClick: 19;
39
+ ProductAddToWishlist: 20;
40
+ ProductRemoveFromWishlist: 21;
41
+ ProductImpression: 22;
42
+ };
43
+ export declare const IdentityType: any;
44
+ export declare const ProductActionType: {
45
+ Unknown: 0;
46
+ AddToCart: 1;
47
+ RemoveFromCart: 2;
48
+ Checkout: 3;
49
+ CheckoutOption: 4;
50
+ Click: 5;
51
+ ViewDetail: 6;
52
+ Purchase: 7;
53
+ Refund: 8;
54
+ AddToWishlist: 9;
55
+ RemoveFromWishlist: 10;
56
+ getName: (id: number) => string;
57
+ getExpansionName: (id: number) => "add_to_cart" | "remove_from_cart" | "checkout" | "checkout_option" | "click" | "view_detail" | "purchase" | "refund" | "add_to_wishlist" | "remove_from_wishlist" | "unknown";
58
+ };
59
+ export declare const PromotionActionType: {
60
+ Unknown: 0;
61
+ PromotionView: 1;
62
+ PromotionClick: 2;
63
+ getName: (id: number) => string;
64
+ getExpansionName: (id: number) => string;
65
+ };
66
+ export declare const ProfileMessageType: {
67
+ Logout: 3;
68
+ };
69
+ export declare const ApplicationTransitionType: {
70
+ AppInit: 1;
71
+ };
72
+ export declare const PerformanceMarkType: {
73
+ SdkStart: "mp:sdkStart";
74
+ JointSdkSelectPlacements: "mp:jointSdkSelectPlacements";
75
+ JointSdkRoktKitInit: "mp:jointSdkRoktKitInit";
76
+ };
77
+ declare const _default: {
78
+ readonly MessageType: {
79
+ SessionStart: 1;
80
+ SessionEnd: 2;
81
+ PageView: 3;
82
+ PageEvent: 4;
83
+ CrashReport: 5;
84
+ OptOut: 6;
85
+ AppStateTransition: 10;
86
+ Profile: 14;
87
+ Commerce: 16;
88
+ Media: 20;
89
+ UserAttributeChange: 17;
90
+ UserIdentityChange: 18;
91
+ };
92
+ readonly EventType: {
93
+ Unknown: 0;
94
+ Navigation: 1;
95
+ Location: 2;
96
+ Search: 3;
97
+ Transaction: 4;
98
+ UserContent: 5;
99
+ UserPreference: 6;
100
+ Social: 7;
101
+ Other: 8;
102
+ Media: 9;
103
+ getName(id: number): string;
104
+ };
105
+ readonly CommerceEventType: {
106
+ ProductAddToCart: 10;
107
+ ProductRemoveFromCart: 11;
108
+ ProductCheckout: 12;
109
+ ProductCheckoutOption: 13;
110
+ ProductClick: 14;
111
+ ProductViewDetail: 15;
112
+ ProductPurchase: 16;
113
+ ProductRefund: 17;
114
+ PromotionView: 18;
115
+ PromotionClick: 19;
116
+ ProductAddToWishlist: 20;
117
+ ProductRemoveFromWishlist: 21;
118
+ ProductImpression: 22;
119
+ };
120
+ readonly IdentityType: any;
121
+ readonly ProfileMessageType: {
122
+ Logout: 3;
123
+ };
124
+ readonly ApplicationTransitionType: {
125
+ AppInit: 1;
126
+ };
127
+ readonly ProductActionType: {
128
+ Unknown: 0;
129
+ AddToCart: 1;
130
+ RemoveFromCart: 2;
131
+ Checkout: 3;
132
+ CheckoutOption: 4;
133
+ Click: 5;
134
+ ViewDetail: 6;
135
+ Purchase: 7;
136
+ Refund: 8;
137
+ AddToWishlist: 9;
138
+ RemoveFromWishlist: 10;
139
+ getName: (id: number) => string;
140
+ getExpansionName: (id: number) => "add_to_cart" | "remove_from_cart" | "checkout" | "checkout_option" | "click" | "view_detail" | "purchase" | "refund" | "add_to_wishlist" | "remove_from_wishlist" | "unknown";
141
+ };
142
+ readonly PromotionActionType: {
143
+ Unknown: 0;
144
+ PromotionView: 1;
145
+ PromotionClick: 2;
146
+ getName: (id: number) => string;
147
+ getExpansionName: (id: number) => string;
148
+ };
149
+ readonly Environment: {
150
+ readonly Development: "development";
151
+ readonly Production: "production";
152
+ };
153
+ };
154
+ export default _default;
@@ -0,0 +1,21 @@
1
+ export interface IFetchPayload {
2
+ method: string;
3
+ headers: {
4
+ Accept: string;
5
+ 'Content-Type'?: string;
6
+ 'rokt-account-id'?: string;
7
+ };
8
+ body?: string;
9
+ }
10
+ export declare abstract class AsyncUploader {
11
+ url: string;
12
+ abstract upload(fetchPayload: IFetchPayload, url?: string): Promise<Response>;
13
+ constructor(url: string);
14
+ }
15
+ export declare class FetchUploader extends AsyncUploader {
16
+ upload(fetchPayload: IFetchPayload, _url?: string): Promise<Response>;
17
+ }
18
+ export declare class XHRUploader extends AsyncUploader {
19
+ upload(fetchPayload: IFetchPayload): Promise<Response>;
20
+ private makeRequest;
21
+ }
@@ -0,0 +1,5 @@
1
+ import { IMParticleUser, IdentityResultBody } from './identity-user-interfaces';
2
+ import { SDKEvent } from './sdkRuntimeModels';
3
+ export declare function hasMPIDAndUserLoginChanged(previousUser: IMParticleUser, newUser: IMParticleUser): boolean;
4
+ export declare function hasMPIDChanged(prevUser: IMParticleUser, identityApiResult: IdentityResultBody): boolean;
5
+ export declare function appendUserInfo(user: IMParticleUser, event: SDKEvent): void;
@@ -0,0 +1,82 @@
1
+ import { MPID } from '@mparticle/web-sdk';
2
+ import Constants from './constants';
3
+ import { SDKInitConfig } from './sdkRuntimeModels';
4
+ import { IKitConfigs } from './configAPIClient';
5
+ type valueof<T> = T[keyof T];
6
+ type AttributeValue = string | number | boolean | null | undefined;
7
+ export type Dictionary<V = any> = Record<string, V>;
8
+ export type Environment = valueof<typeof Constants.Environment>;
9
+ declare const createCookieString: (value: string) => string;
10
+ declare const revertCookieString: (value: string) => string;
11
+ declare const inArray: (items: any[], name: any) => boolean;
12
+ declare const findKeyInObject: (obj: any, key: string) => string;
13
+ declare const generateDeprecationMessage: (methodName: string, isDeprecated?: boolean, alternateMethod?: string, docsUrl?: string) => string;
14
+ declare function generateHash(name: string): number;
15
+ declare const generateUniqueId: (a?: string) => string;
16
+ /**
17
+ * Returns a value between 1-100 inclusive.
18
+ */
19
+ declare const getRampNumber: (value?: string) => number;
20
+ declare const isObject: (value: any) => boolean;
21
+ declare const parseNumber: (value: string | number) => number;
22
+ declare const parseSettingsString: (settingsString: string) => Dictionary<string>[];
23
+ declare const parseStringOrNumber: (value: string | number) => string | number | null;
24
+ declare const replaceCommasWithPipes: (value: string) => string;
25
+ declare const replacePipesWithCommas: (value: string) => string;
26
+ declare const replaceApostrophesWithQuotes: (value: string) => string;
27
+ declare const replaceQuotesWithApostrophes: (value: string) => string;
28
+ declare const replaceMPID: (value: string, mpid: MPID) => string;
29
+ declare const replaceAmpWithAmpersand: (value: string) => string;
30
+ declare const createCookieSyncUrl: (mpid: MPID, pixelUrl: string, redirectUrl?: string, domain?: string) => string;
31
+ declare const returnConvertedBoolean: (data: string | boolean | number) => boolean;
32
+ declare const decoded: (s: string) => string;
33
+ declare const converted: (s: string) => string;
34
+ declare const isString: (value: any) => boolean;
35
+ declare const isNumber: (value: any) => boolean;
36
+ declare const isFunction: (fn: any) => boolean;
37
+ declare const isValidAttributeValue: (value: any) => boolean;
38
+ declare const isValidCustomFlagProperty: (value: any) => boolean;
39
+ declare const toDataPlanSlug: (value: any) => string;
40
+ declare const isDataPlanSlug: (str: string) => boolean;
41
+ declare const isStringOrNumber: (value: any) => boolean;
42
+ declare const isEmpty: (value: Dictionary<any> | string | null | undefined) => boolean;
43
+ declare const mergeObjects: <T extends object>(...objects: T[]) => T;
44
+ declare const moveElementToEnd: <T>(array: T[], index: number) => T[];
45
+ declare const queryStringParser: (url: string, keys?: string[]) => Dictionary<string>;
46
+ declare const getCookies: (keys?: string[]) => Dictionary<string>;
47
+ declare const getHref: () => string;
48
+ declare const filterDictionaryWithHash: <T>(dictionary: Dictionary<T>, filterList: any[], hashFn: (key: string) => any) => Dictionary<T>;
49
+ declare const parseConfig: (config: SDKInitConfig, moduleName: string, moduleId: number) => IKitConfigs | null;
50
+ /**
51
+ * Obfuscates an object by replacing all primitive values with their type names,
52
+ * while preserving the structure of nested objects and arrays.
53
+ * This is useful for logging data structures without exposing PII.
54
+ *
55
+ * @param value - The value to obfuscate
56
+ * @returns The obfuscated value with types instead of actual values
57
+ *
58
+ * @example
59
+ * obfuscateData({ email: 'user@email.com', age: 30 })
60
+ * // Returns: { email: 'string', age: 'number' }
61
+ *
62
+ * obfuscateData({ tags: ['premium', 'verified'] })
63
+ * // Returns: { tags: ['string', 'string'] }
64
+ */
65
+ declare const obfuscateData: (value: any) => any;
66
+ /**
67
+ * For verbose logging: returns raw data when isDevelopmentMode is true, else obfuscated data.
68
+ * Used when logging payloads so PII is not exposed in production.
69
+ *
70
+ * @param data - The value to log
71
+ * @param isDevelopmentMode - When true, returns data unchanged, when false or undefined, returns obfuscated data
72
+ * @returns Raw data when isDevelopmentMode is true, otherwise obfuscated structure
73
+ *
74
+ * @example
75
+ * obfuscateDevData({ email: 'user@email.com' }, true)
76
+ * // Returns: { email: 'user@email.com' }
77
+ *
78
+ * obfuscateDevData({ email: 'user@email.com' }, false)
79
+ * // Returns: { email: 'string' }
80
+ */
81
+ declare const obfuscateDevData: (data: any, isDevelopmentMode?: boolean) => any;
82
+ export { createCookieString, revertCookieString, createCookieSyncUrl, valueof, AttributeValue, converted, decoded, obfuscateDevData, filterDictionaryWithHash, findKeyInObject, generateDeprecationMessage, generateHash, generateUniqueId, getRampNumber, inArray, isObject, isStringOrNumber, obfuscateData, parseConfig, parseNumber, parseSettingsString, parseStringOrNumber, replaceCommasWithPipes, replacePipesWithCommas, replaceApostrophesWithQuotes, replaceQuotesWithApostrophes, returnConvertedBoolean, toDataPlanSlug, isString, isNumber, isFunction, isDataPlanSlug, isEmpty, isValidAttributeValue, isValidCustomFlagProperty, mergeObjects, moveElementToEnd, queryStringParser, getCookies, getHref, replaceMPID, replaceAmpWithAmpersand, };
@@ -0,0 +1,18 @@
1
+ import { valueof } from './utils';
2
+ import Constants from './constants';
3
+ import { IdentityApiData } from '@mparticle/web-sdk';
4
+ import { IdentityAPIMethod } from './identity.interfaces';
5
+ type ValidationIdentitiesReturn = {
6
+ valid: boolean;
7
+ error?: valueof<typeof Constants.Messages.ValidationMessages>;
8
+ };
9
+ declare const Validators: {
10
+ isNumber: (value: any) => boolean;
11
+ isFunction: (fn: any) => boolean;
12
+ isStringOrNumber: (value: any) => boolean;
13
+ isValidAttributeValue: (value: any) => boolean;
14
+ isValidKeyValue: (key: any) => boolean;
15
+ removeFalsyIdentityValues: (identityApiData: IdentityApiData, logger: any) => IdentityApiData;
16
+ validateIdentities: (identityApiData: IdentityApiData, method?: IdentityAPIMethod) => ValidationIdentitiesReturn;
17
+ };
18
+ export default Validators;
@@ -0,0 +1,41 @@
1
+ export declare abstract class BaseVault<StorableItem> {
2
+ contents: StorableItem;
3
+ protected readonly _storageKey: string;
4
+ protected storageObject: Storage;
5
+ /**
6
+ *
7
+ * @param {string} storageKey the local storage key string
8
+ * @param {Storage} storageObject Web API Storage object that is being used
9
+ */
10
+ constructor(storageKey: string, storageObject: Storage);
11
+ /**
12
+ * Stores a StorableItem to Storage
13
+ * @method store
14
+ * @param item {StorableItem}
15
+ */
16
+ store(item: StorableItem): void;
17
+ /**
18
+ * Retrieve StorableItem from Storage
19
+ * @method retrieve
20
+ * @returns {StorableItem}
21
+ */
22
+ retrieve(): StorableItem | null;
23
+ /**
24
+ * Removes all persisted data from Storage based on this vault's `key`
25
+ * Will remove storage key from Storage as well
26
+ * @method purge
27
+ */
28
+ purge(): void;
29
+ }
30
+ export declare class LocalStorageVault<StorableItem> extends BaseVault<StorableItem> {
31
+ constructor(storageKey: string);
32
+ }
33
+ export declare class SessionStorageVault<StorableItem> extends BaseVault<StorableItem> {
34
+ constructor(storageKey: string);
35
+ }
36
+ export declare class DisabledVault<StorableItem> extends BaseVault<StorableItem> {
37
+ constructor(storageKey: string);
38
+ store(_item: StorableItem): void;
39
+ retrieve(): StorableItem | null;
40
+ purge(): void;
41
+ }