@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.
- package/dist/mparticle.common.js +1 -1
- package/dist/mparticle.esm.js +1 -1
- package/dist/mparticle.js +1 -1
- 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 +15 -2
- package/src/forwarders.interfaces.ts +42 -0
- package/src/internal-types.ts +66 -0
- package/src/public-types.ts +84 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export default function Ecommerce(mpInstance: any): void;
|
|
2
|
+
export default class Ecommerce {
|
|
3
|
+
constructor(mpInstance: any);
|
|
4
|
+
convertTransactionAttributesToProductAction: (transactionAttributes: any, productAction: any) => void;
|
|
5
|
+
getProductActionEventName: (productActionType: any) => "AddToCart" | "AddToWishlist" | "Checkout" | "CheckoutOption" | "Click" | "Purchase" | "Refund" | "RemoveFromCart" | "RemoveFromWishlist" | "ViewDetail" | "Unknown";
|
|
6
|
+
getPromotionActionEventName: (promotionActionType: any) => "Unknown" | "PromotionClick" | "PromotionView";
|
|
7
|
+
convertProductActionToEventType: (productActionType: any) => 0 | 20 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 21;
|
|
8
|
+
convertPromotionActionToEventType: (promotionActionType: any) => 18 | 19;
|
|
9
|
+
generateExpandedEcommerceName: (eventName: any, plusOne: any) => string;
|
|
10
|
+
extractProductAttributes: (attributes: any, product: any) => void;
|
|
11
|
+
extractTransactionId: (attributes: any, productAction: any) => void;
|
|
12
|
+
extractActionAttributes: (attributes: any, productAction: any) => void;
|
|
13
|
+
extractPromotionAttributes: (attributes: any, promotion: any) => void;
|
|
14
|
+
buildProductList: (event: any, product: any) => any;
|
|
15
|
+
createProduct: (name: any, sku: any, price: any, quantity: any, variant: any, category: any, brand: any, position: any, couponCode: any, attributes: any) => {
|
|
16
|
+
Name: string;
|
|
17
|
+
Sku: any;
|
|
18
|
+
Price: any;
|
|
19
|
+
Quantity: any;
|
|
20
|
+
Brand: any;
|
|
21
|
+
Variant: any;
|
|
22
|
+
Category: any;
|
|
23
|
+
Position: any;
|
|
24
|
+
CouponCode: any;
|
|
25
|
+
TotalAmount: number;
|
|
26
|
+
Attributes: any;
|
|
27
|
+
};
|
|
28
|
+
createPromotion: (id: any, creative: any, name: any, position: any) => {
|
|
29
|
+
Id: any;
|
|
30
|
+
Creative: any;
|
|
31
|
+
Name: any;
|
|
32
|
+
Position: any;
|
|
33
|
+
};
|
|
34
|
+
createImpression: (name: any, product: any) => {
|
|
35
|
+
Name: string;
|
|
36
|
+
Product: any;
|
|
37
|
+
};
|
|
38
|
+
createTransactionAttributes: (id: any, affiliation: any, couponCode: any, revenue: any, shipping: any, tax: any) => {
|
|
39
|
+
Id: any;
|
|
40
|
+
Affiliation: any;
|
|
41
|
+
CouponCode: any;
|
|
42
|
+
Revenue: any;
|
|
43
|
+
Shipping: any;
|
|
44
|
+
Tax: any;
|
|
45
|
+
};
|
|
46
|
+
expandProductImpression: (commerceEvent: any) => any[];
|
|
47
|
+
expandCommerceEvent: (event: any) => any[];
|
|
48
|
+
expandPromotionAction: (commerceEvent: any) => any[];
|
|
49
|
+
expandProductAction: (commerceEvent: any) => any[];
|
|
50
|
+
createCommerceEventObject: (customFlags: any, options: any) => any;
|
|
51
|
+
sanitizeAmount: (amount: any, category: any) => any;
|
|
52
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ProductAction, Product, Promotion, CommerceEvent } from '@mparticle/event-models';
|
|
2
|
+
import { SDKEventAttrs, SDKEventOptions, TransactionAttributes } from '@mparticle/web-sdk';
|
|
3
|
+
import { valueof } from './utils';
|
|
4
|
+
import { ProductActionType, PromotionActionType, CommerceEventType, EventType } from './types';
|
|
5
|
+
import { SDKEvent, SDKEventCustomFlags, SDKImpression, SDKProduct, SDKProductImpression, SDKPromotion } from './sdkRuntimeModels';
|
|
6
|
+
interface IECommerceShared {
|
|
7
|
+
createProduct(name: string, sku: string | number, price: string | number, quantity?: string | number, variant?: string, category?: string, brand?: string, position?: number, couponCode?: string, attributes?: SDKEventAttrs): SDKProduct | null;
|
|
8
|
+
createImpression(name: string, product: Product): SDKImpression | null;
|
|
9
|
+
createPromotion(id: string | number, creative?: string, name?: string, position?: number): SDKPromotion | null;
|
|
10
|
+
createTransactionAttributes(id: string | number, affiliation?: string, couponCode?: string, revenue?: string | number, shipping?: string | number, tax?: number): TransactionAttributes | null;
|
|
11
|
+
expandCommerceEvent(event: CommerceEvent): SDKEvent[] | null;
|
|
12
|
+
}
|
|
13
|
+
export interface SDKCart {
|
|
14
|
+
add(product: SDKProduct | SDKProduct[], logEvent?: boolean): void;
|
|
15
|
+
remove(product: SDKProduct | SDKProduct[], logEvent?: boolean): void;
|
|
16
|
+
clear(): void;
|
|
17
|
+
}
|
|
18
|
+
export interface SDKECommerceAPI extends IECommerceShared {
|
|
19
|
+
logCheckout(step: number, option?: string, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags): void;
|
|
20
|
+
logImpression(impression: SDKProductImpression, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, eventOptions?: SDKEventOptions): void;
|
|
21
|
+
logProductAction(productActionType: valueof<typeof ProductActionType>, product: SDKProduct | SDKProduct[], attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, transactionAttributes?: TransactionAttributes, eventOptions?: SDKEventOptions): void;
|
|
22
|
+
logPromotion(type: valueof<typeof PromotionActionType>, promotion: SDKPromotion, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, eventOptions?: SDKEventOptions): void;
|
|
23
|
+
setCurrencyCode(code: string): void;
|
|
24
|
+
Cart: SDKCart;
|
|
25
|
+
logPurchase(transactionAttributes: TransactionAttributes, product: SDKProduct | SDKProduct[], clearCart?: boolean, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags): void;
|
|
26
|
+
logRefund(transactionAttributes: TransactionAttributes, product: SDKProduct | SDKProduct[], clearCart?: boolean, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags): void;
|
|
27
|
+
}
|
|
28
|
+
interface ExtractedActionAttributes {
|
|
29
|
+
Affiliation?: string;
|
|
30
|
+
'Coupon Code'?: string;
|
|
31
|
+
'Total Amount'?: number;
|
|
32
|
+
'Shipping Amount'?: number;
|
|
33
|
+
'Tax Amount'?: number;
|
|
34
|
+
'Checkout Option'?: string;
|
|
35
|
+
'Checkout Step'?: number;
|
|
36
|
+
'Transaction ID'?: string;
|
|
37
|
+
}
|
|
38
|
+
interface ExtractedProductAttributes {
|
|
39
|
+
'Coupon Code'?: string;
|
|
40
|
+
Brand?: string;
|
|
41
|
+
Category?: string;
|
|
42
|
+
Name?: string;
|
|
43
|
+
Id?: string;
|
|
44
|
+
'Item Price'?: number;
|
|
45
|
+
Quantity?: number;
|
|
46
|
+
Position?: number;
|
|
47
|
+
Variant?: string;
|
|
48
|
+
'Total Product Amount': number;
|
|
49
|
+
}
|
|
50
|
+
interface ExtractedPromotionAttributes {
|
|
51
|
+
Id?: string;
|
|
52
|
+
Creative?: string;
|
|
53
|
+
Name?: string;
|
|
54
|
+
Position?: number;
|
|
55
|
+
}
|
|
56
|
+
interface ExtractedTransactionId {
|
|
57
|
+
'Transaction ID'?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface IECommerce extends IECommerceShared {
|
|
60
|
+
buildProductList(event: SDKEvent, product: Product | Product[]): Product[];
|
|
61
|
+
convertProductActionToEventType(productActionType: valueof<typeof ProductActionType>): // https://go.mparticle.com/work/SQDSDKS-4801
|
|
62
|
+
typeof CommerceEventType | typeof EventType | null;
|
|
63
|
+
convertPromotionActionToEventType(promotionActionType: valueof<typeof PromotionActionType>): typeof CommerceEventType | null;
|
|
64
|
+
convertTransactionAttributesToProductAction(transactionAttributes: TransactionAttributes, productAction: ProductAction): void;
|
|
65
|
+
createCommerceEventObject(customFlags: SDKEventCustomFlags, options?: SDKEventOptions): SDKEvent | null;
|
|
66
|
+
expandProductAction(commerceEvent: CommerceEvent): SDKEvent[];
|
|
67
|
+
expandProductImpression(commerceEvent: CommerceEvent): SDKEvent[];
|
|
68
|
+
expandPromotionAction(commerceEvent: CommerceEvent): SDKEvent[];
|
|
69
|
+
extractActionAttributes(attributes: ExtractedActionAttributes, productAction: ProductAction): void;
|
|
70
|
+
extractProductAttributes(attributes: ExtractedProductAttributes, product: Product): void;
|
|
71
|
+
extractPromotionAttributes(attributes: ExtractedPromotionAttributes, promotion: Promotion): void;
|
|
72
|
+
extractTransactionId(attributes: ExtractedTransactionId, productAction: ProductAction): void;
|
|
73
|
+
generateExpandedEcommerceName(eventName: string, plusOne: boolean): string;
|
|
74
|
+
getProductActionEventName(productActionType: valueof<typeof ProductActionType>): string;
|
|
75
|
+
getPromotionActionEventName(promotionActionType: valueof<typeof PromotionActionType>): string;
|
|
76
|
+
sanitizeAmount(amount: string | number, category: string): number;
|
|
77
|
+
}
|
|
78
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default function Events(mpInstance: any): void;
|
|
2
|
+
export default class Events {
|
|
3
|
+
constructor(mpInstance: any);
|
|
4
|
+
logEvent: (event: any, options: any) => void;
|
|
5
|
+
startTracking: (callback: any) => void;
|
|
6
|
+
stopTracking: () => void;
|
|
7
|
+
logOptOut: () => void;
|
|
8
|
+
logAST: () => void;
|
|
9
|
+
logCheckoutEvent: (step: any, option: any, attrs: any, customFlags: any) => void;
|
|
10
|
+
logProductActionEvent: (productActionType: any, product: any, customAttrs: any, customFlags: any, transactionAttributes: any, options: any) => void;
|
|
11
|
+
logPurchaseEvent: (transactionAttributes: any, product: any, attrs: any, customFlags: any) => void;
|
|
12
|
+
logRefundEvent: (transactionAttributes: any, product: any, attrs: any, customFlags: any) => void;
|
|
13
|
+
logPromotionEvent: (promotionType: any, promotion: any, attrs: any, customFlags: any, eventOptions: any) => void;
|
|
14
|
+
logImpressionEvent: (impression: any, attrs: any, customFlags: any, options: any) => void;
|
|
15
|
+
logCommerceEvent: (commerceEvent: any, attrs: any, options: any) => void;
|
|
16
|
+
addEventHandler: (domEvent: any, selector: any, eventName: any, data: any, eventType: any) => void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Callback, SDKEventAttrs, SDKEventOptions, TransactionAttributes } from '@mparticle/web-sdk';
|
|
2
|
+
import { BaseEvent, SDKEvent, SDKEventCustomFlags, SDKProduct, SDKProductImpression, SDKPromotion } from './sdkRuntimeModels';
|
|
3
|
+
import { valueof } from './utils';
|
|
4
|
+
import { EventType, ProductActionType, PromotionActionType } from './types';
|
|
5
|
+
type EventHandlerFunction<T> = (element: HTMLLinkElement | HTMLFormElement) => T;
|
|
6
|
+
export interface IEvents {
|
|
7
|
+
addEventHandler(domEvent: string, selector: string | Node, eventName: EventHandlerFunction<string> | string, data: EventHandlerFunction<SDKEventAttrs> | SDKEventAttrs, eventType: valueof<typeof EventType>): void;
|
|
8
|
+
logAST(): void;
|
|
9
|
+
logCheckoutEvent(step: number, option?: string, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags): void;
|
|
10
|
+
logCommerceEvent(commerceEvent: SDKEvent, attrs?: SDKEventAttrs, options?: SDKEventOptions): void;
|
|
11
|
+
logEvent(event: BaseEvent, eventOptions?: SDKEventOptions): void;
|
|
12
|
+
logImpressionEvent(impression: SDKProductImpression, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, eventOptions?: SDKEventOptions): any;
|
|
13
|
+
logOptOut(): void;
|
|
14
|
+
logProductActionEvent(productActionType: valueof<typeof ProductActionType>, product: SDKProduct | SDKProduct[], attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, transactionAttributes?: TransactionAttributes, eventOptions?: SDKEventOptions): void;
|
|
15
|
+
logPromotionEvent(promotionType: valueof<typeof PromotionActionType>, promotion: SDKPromotion, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, eventOptions?: SDKEventOptions): void;
|
|
16
|
+
logPurchaseEvent(transactionAttributes: TransactionAttributes, product: SDKProduct | SDKProduct[], attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags): void;
|
|
17
|
+
logRefundEvent(transactionAttributes: TransactionAttributes, product: SDKProduct | SDKProduct[], attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags): void;
|
|
18
|
+
startTracking(callback: Callback): void;
|
|
19
|
+
stopTracking(): void;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default function filteredMparticleUser(mpid: any, forwarder: any, mpInstance: any, kitBlocker: any): {
|
|
2
|
+
getUserIdentities: () => {
|
|
3
|
+
userIdentities: {};
|
|
4
|
+
};
|
|
5
|
+
getMPID: () => any;
|
|
6
|
+
getUserAttributesLists: (forwarder: any) => {};
|
|
7
|
+
getAllUserAttributes: () => {};
|
|
8
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default class ForegroundTimeTracker {
|
|
2
|
+
private noFunctional;
|
|
3
|
+
private isTrackerActive;
|
|
4
|
+
private localStorageName;
|
|
5
|
+
private timerVault;
|
|
6
|
+
startTime: number;
|
|
7
|
+
totalTime: number;
|
|
8
|
+
constructor(timerKey: string, noFunctional?: boolean);
|
|
9
|
+
private addHandlers;
|
|
10
|
+
private handleVisibilityChange;
|
|
11
|
+
private handleWindowBlur;
|
|
12
|
+
private handleWindowFocus;
|
|
13
|
+
private syncAcrossTabs;
|
|
14
|
+
updateTimeInPersistence(): void;
|
|
15
|
+
private loadTimeFromStorage;
|
|
16
|
+
private startTracking;
|
|
17
|
+
private stopTracking;
|
|
18
|
+
private setTotalTime;
|
|
19
|
+
getTimeInForeground(): number;
|
|
20
|
+
resetTimer(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default function Forwarders(mpInstance: any, kitBlocker: any): void;
|
|
2
|
+
export default class Forwarders {
|
|
3
|
+
constructor(mpInstance: any, kitBlocker: any);
|
|
4
|
+
forwarderStatsUploader: any;
|
|
5
|
+
initForwarders: (userIdentities: any, forwardingStatsCallback: any) => void;
|
|
6
|
+
isEnabledForUserAttributes: (filterObject: any, user: any) => boolean;
|
|
7
|
+
isEnabledForUnknownUser: (excludeAnonymousUserBoolean: any, user: any) => boolean;
|
|
8
|
+
applyToForwarders: (functionName: any, functionArgs: any) => void;
|
|
9
|
+
sendEventToForwarders: (event: any) => void;
|
|
10
|
+
handleForwarderUserAttributes: (functionNameKey: any, key: any, value: any) => void;
|
|
11
|
+
setForwarderUserIdentities: (userIdentities: any) => void;
|
|
12
|
+
setForwarderOnUserIdentified: (user: any) => void;
|
|
13
|
+
setForwarderOnIdentityComplete: (user: any, identityMethod: any) => void;
|
|
14
|
+
getForwarderStatsQueue: () => any;
|
|
15
|
+
setForwarderStatsQueue: (queue: any) => void;
|
|
16
|
+
processForwarders: (config: any, forwardingStatsCallback: any) => void;
|
|
17
|
+
processUIEnabledKits: (config: any) => void;
|
|
18
|
+
returnKitConstructors: () => {};
|
|
19
|
+
configureUIEnabledKit: (configuration: any, kits: any) => void;
|
|
20
|
+
processSideloadedKits: (mpConfig: any) => void;
|
|
21
|
+
configureSideloadedKit: (kitConstructor: any) => void;
|
|
22
|
+
returnConfiguredKit: (forwarder: any, config?: {}) => any;
|
|
23
|
+
configurePixel: (settings: any) => void;
|
|
24
|
+
processPixelConfigs: (config: any) => void;
|
|
25
|
+
sendSingleForwardingStatsToServer: (forwardingStatsData: any) => Promise<void>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { SDKEvent, SDKEventCustomFlags } from './sdkRuntimeModels';
|
|
2
|
+
import { Dictionary } from './utils';
|
|
3
|
+
import { IKitConfigs, IKitFilterSettings } from './configAPIClient';
|
|
4
|
+
import { IdentityApiData, IdentityType } from '@mparticle/web-sdk';
|
|
5
|
+
import { Batch } from '@mparticle/event-models';
|
|
6
|
+
import { IMParticleUser, ISDKUserIdentity, UserAttributes } from './identity-user-interfaces';
|
|
7
|
+
export type MPForwarder = Dictionary;
|
|
8
|
+
export interface UnregisteredKit {
|
|
9
|
+
constructor: () => void;
|
|
10
|
+
register(config: KitRegistrationConfig): void;
|
|
11
|
+
name: string;
|
|
12
|
+
moduleId?: number;
|
|
13
|
+
suffix?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface RegisteredKit {
|
|
16
|
+
constructor: () => void;
|
|
17
|
+
filters?: IKitFilterSettings;
|
|
18
|
+
}
|
|
19
|
+
export interface KitRegistrationConfig {
|
|
20
|
+
kits: Dictionary<RegisteredKit>;
|
|
21
|
+
}
|
|
22
|
+
export interface ConfiguredKit extends Omit<IKitConfigs, 'isDebugString' | 'hasDebugString'> {
|
|
23
|
+
common: Dictionary<unknown>;
|
|
24
|
+
id: number;
|
|
25
|
+
init(settings: Dictionary<unknown>, service: forwardingStatsCallback, testMode: boolean, trackerId: string | null, userAttributes: UserAttributes, userIdentities: ISDKUserIdentity, appVersion: string, appName: string, customFlags: SDKEventCustomFlags, clientId: string): string;
|
|
26
|
+
onIdentifyComplete(user: IMParticleUser, filteredIdentityRequest: IdentityApiData): string;
|
|
27
|
+
onLoginComplete(user: IMParticleUser, filteredIdentityRequest: IdentityApiData): string;
|
|
28
|
+
onLogoutComplete(user: IMParticleUser, filteredIdentityRequest: IdentityApiData): string;
|
|
29
|
+
onModifyComplete(user: IMParticleUser, filteredIdentityRequest: IdentityApiData): string;
|
|
30
|
+
onUserIdentified(user: IMParticleUser): string;
|
|
31
|
+
process(event: SDKEvent): string;
|
|
32
|
+
setOptOut(isOptingOut: boolean): string;
|
|
33
|
+
removeUserAttribute(key: string): string;
|
|
34
|
+
setUserAttribute(key: string, value: string): string;
|
|
35
|
+
setUserIdentity(id: UserIdentityId, type: UserIdentityType): void;
|
|
36
|
+
isSandbox: boolean;
|
|
37
|
+
hasSandbox: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface KitInterface {
|
|
40
|
+
id: number;
|
|
41
|
+
name: string;
|
|
42
|
+
init(settings: Dictionary<unknown>, service: forwardingStatsCallback, testMode?: boolean, trackerId?: string | null, userAttributes?: UserAttributes, userIdentities?: ISDKUserIdentity, appVersion?: string, appName?: string, customFlags?: SDKEventCustomFlags, clientId?: string): string;
|
|
43
|
+
onIdentifyComplete?(user: IMParticleUser, filteredIdentityRequest: IdentityApiData): string;
|
|
44
|
+
onLoginComplete?(user: IMParticleUser, filteredIdentityRequest: IdentityApiData): string;
|
|
45
|
+
onLogoutComplete?(user: IMParticleUser, filteredIdentityRequest: IdentityApiData): string;
|
|
46
|
+
onModifyComplete?(user: IMParticleUser, filteredIdentityRequest: IdentityApiData): string;
|
|
47
|
+
onUserIdentified?(user: IMParticleUser): string;
|
|
48
|
+
process?(event: SDKEvent): string;
|
|
49
|
+
processBatch?(batch: Batch): string;
|
|
50
|
+
setOptOut?(isOptingOut: boolean): string;
|
|
51
|
+
removeUserAttribute?(key: string): string;
|
|
52
|
+
setUserAttribute?(key: string, value: string): string;
|
|
53
|
+
setUserIdentity?(id: UserIdentityId, type: UserIdentityType): void;
|
|
54
|
+
}
|
|
55
|
+
export type UserIdentityId = string;
|
|
56
|
+
export type UserIdentityType = number;
|
|
57
|
+
export type UserAttributeFilters = number[];
|
|
58
|
+
export type UserIdentityFilters = typeof IdentityType[];
|
|
59
|
+
export type forwardingStatsCallback = (forwarder: ConfiguredKit, event: SDKEvent) => void;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export default function Helpers(mpInstance: any): void;
|
|
2
|
+
export default class Helpers {
|
|
3
|
+
constructor(mpInstance: any);
|
|
4
|
+
canLog: () => boolean;
|
|
5
|
+
getFeatureFlag: (feature: any) => any;
|
|
6
|
+
invokeCallback: (callback: any, code: any, body: any, mParticleUser: any, previousMpid: any) => void;
|
|
7
|
+
invokeAliasCallback: (callback: any, code: any, message: any) => void;
|
|
8
|
+
extend: (...args: any[]) => any;
|
|
9
|
+
createServiceUrl: (secureServiceUrl: any, devToken: any) => string;
|
|
10
|
+
createXHR: (cb: any) => any;
|
|
11
|
+
filterUserIdentities: (userIdentitiesObject: any, filterList: any) => {
|
|
12
|
+
Type: any;
|
|
13
|
+
Identity: any;
|
|
14
|
+
}[];
|
|
15
|
+
filterUserIdentitiesForForwarders: (userIdentities: utils.Dictionary<string>, filterList: number[]) => utils.Dictionary<string>;
|
|
16
|
+
filterUserAttributes: (userAttributes: utils.Dictionary<string>, filterList: number[]) => utils.Dictionary<string>;
|
|
17
|
+
isEventType: (type: any) => boolean;
|
|
18
|
+
sanitizeAttributes: (attrs: any, name: any) => {};
|
|
19
|
+
isDelayedByIntegration: (delayedIntegrations: any, timeoutStart: any, now: any) => boolean;
|
|
20
|
+
createMainStorageName: (workspaceToken: any) => string;
|
|
21
|
+
converted: (s: string) => string;
|
|
22
|
+
findKeyInObject: (obj: any, key: string) => string;
|
|
23
|
+
parseNumber: (value: string | number) => number;
|
|
24
|
+
inArray: (items: any[], name: any) => boolean;
|
|
25
|
+
isObject: (value: any) => boolean;
|
|
26
|
+
decoded: (s: string) => string;
|
|
27
|
+
parseStringOrNumber: (value: string | number) => string | number;
|
|
28
|
+
generateHash: typeof utils.generateHash;
|
|
29
|
+
generateUniqueId: (a?: string) => string;
|
|
30
|
+
Validators: {
|
|
31
|
+
isNumber: (value: any) => boolean;
|
|
32
|
+
isFunction: (fn: any) => boolean;
|
|
33
|
+
isStringOrNumber: (value: any) => boolean;
|
|
34
|
+
isValidAttributeValue: (value: any) => boolean;
|
|
35
|
+
isValidKeyValue: (key: any) => boolean;
|
|
36
|
+
removeFalsyIdentityValues: (identityApiData: import("@mparticle/web-sdk").IdentityApiData, logger: any) => import("@mparticle/web-sdk").IdentityApiData;
|
|
37
|
+
validateIdentities: (identityApiData: import("@mparticle/web-sdk").IdentityApiData, method?: import("./identity.interfaces").IdentityAPIMethod) => {
|
|
38
|
+
valid: boolean;
|
|
39
|
+
error?: utils.valueof<{
|
|
40
|
+
readonly ModifyIdentityRequestUserIdentitiesPresent: "identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again";
|
|
41
|
+
readonly IdentityRequesetInvalidKey: "There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.";
|
|
42
|
+
readonly OnUserAliasType: "The onUserAlias value must be a function.";
|
|
43
|
+
readonly UserIdentities: "The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.";
|
|
44
|
+
readonly UserIdentitiesInvalidKey: "There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.";
|
|
45
|
+
readonly UserIdentitiesInvalidValues: "All user identity values must be strings or null. Request not sent to server. Please fix and try again.";
|
|
46
|
+
readonly AliasMissingMpid: "Alias Request must contain both a destinationMpid and a sourceMpid";
|
|
47
|
+
readonly AliasNonUniqueMpid: "Alias Request's destinationMpid and sourceMpid must be unique";
|
|
48
|
+
readonly AliasMissingTime: "Alias Request must have both a startTime and an endTime";
|
|
49
|
+
readonly AliasStartBeforeEndTime: "Alias Request's endTime must be later than its startTime";
|
|
50
|
+
}>;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
import * as utils from './utils';
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { AllUserAttributes, MPID, User } from '@mparticle/web-sdk';
|
|
2
|
+
import { SDKIdentityTypeEnum } from './identity.interfaces';
|
|
3
|
+
import { MessageType } from './types';
|
|
4
|
+
import { BaseEvent, SDKProduct } from './sdkRuntimeModels';
|
|
5
|
+
declare const HTTPCodes: {
|
|
6
|
+
readonly noHttpCoverage: -1;
|
|
7
|
+
readonly activeIdentityRequest: -2;
|
|
8
|
+
readonly activeSession: -3;
|
|
9
|
+
readonly validationIssue: -4;
|
|
10
|
+
readonly nativeIdentityRequest: -5;
|
|
11
|
+
readonly loggingDisabledOrMissingAPIKey: -6;
|
|
12
|
+
readonly tooManyRequests: 429;
|
|
13
|
+
};
|
|
14
|
+
interface ICart {
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Cart persistence in mParticle has been deprecated. Please use mParticle.eCommerce.logProductAction(mParticle.ProductActionType.AddToCart, [products])
|
|
17
|
+
*/
|
|
18
|
+
add: (product: SDKProduct, logEventBoolean?: boolean) => void;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Cart persistence in mParticle has been deprecated. Please use mParticle.eCommerce.logProductAction(mParticle.ProductActionType.RemoveFromCart, [products])
|
|
21
|
+
*/
|
|
22
|
+
remove: (product: SDKProduct, logEventBoolean?: boolean) => void;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Cart persistence in mParticle has been deprecated.
|
|
25
|
+
*/
|
|
26
|
+
clear: () => void;
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Cart Products have been deprecated
|
|
29
|
+
*/
|
|
30
|
+
getCartProducts: () => SDKProduct[];
|
|
31
|
+
}
|
|
32
|
+
export interface IMParticleUser extends User {
|
|
33
|
+
getAllUserAttributes(): any;
|
|
34
|
+
setUserTag(tagName: string, value?: any): void;
|
|
35
|
+
setUserAttribute(key: string, value: any): void;
|
|
36
|
+
getUserAudiences?(callback?: IdentityCallback): void;
|
|
37
|
+
getCart(): ICart;
|
|
38
|
+
}
|
|
39
|
+
export interface ISDKUserIdentity {
|
|
40
|
+
Identity: string;
|
|
41
|
+
Type: number;
|
|
42
|
+
}
|
|
43
|
+
export interface ISDKUserIdentityChanges {
|
|
44
|
+
New: ISDKUserIdentityChangeData;
|
|
45
|
+
Old: ISDKUserIdentityChangeData;
|
|
46
|
+
}
|
|
47
|
+
export interface ISDKUserIdentityChangeData {
|
|
48
|
+
IdentityType: SDKIdentityTypeEnum;
|
|
49
|
+
Identity: string;
|
|
50
|
+
CreatedThisBatch: boolean;
|
|
51
|
+
Timestamp?: number;
|
|
52
|
+
}
|
|
53
|
+
export interface IUserIdentityChangeEvent extends BaseEvent {
|
|
54
|
+
messageType: typeof MessageType.UserIdentityChange;
|
|
55
|
+
userIdentityChanges: ISDKUserIdentityChanges;
|
|
56
|
+
}
|
|
57
|
+
export interface ISDKUserAttributes {
|
|
58
|
+
[key: string]: string | string[] | null;
|
|
59
|
+
}
|
|
60
|
+
export interface ISDKUserAttributeChangeData {
|
|
61
|
+
UserAttributeName: string;
|
|
62
|
+
New: string;
|
|
63
|
+
Old: string;
|
|
64
|
+
Deleted: boolean;
|
|
65
|
+
IsNewAttribute: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface IUserAttributeChangeEvent extends BaseEvent {
|
|
68
|
+
messageType: typeof MessageType.UserAttributeChange;
|
|
69
|
+
userAttributeChanges: ISDKUserAttributeChangeData;
|
|
70
|
+
}
|
|
71
|
+
export interface IdentityCallback {
|
|
72
|
+
(result: IdentityResult): void;
|
|
73
|
+
}
|
|
74
|
+
export interface IIdentityResponse {
|
|
75
|
+
responseText: IdentityResultBody;
|
|
76
|
+
status: number;
|
|
77
|
+
cacheMaxAge?: number;
|
|
78
|
+
expireTimestamp?: number;
|
|
79
|
+
}
|
|
80
|
+
export interface IdentityResult {
|
|
81
|
+
httpCode: typeof HTTPCodes;
|
|
82
|
+
getPreviousUser(): User;
|
|
83
|
+
getUser(): User;
|
|
84
|
+
body: IdentityResultBody | IdentityModifyResultBody;
|
|
85
|
+
}
|
|
86
|
+
export interface IdentityResultBody {
|
|
87
|
+
context: string | null;
|
|
88
|
+
is_ephemeral: boolean;
|
|
89
|
+
is_logged_in: boolean;
|
|
90
|
+
matched_identities: Record<string, unknown>;
|
|
91
|
+
mpid?: MPID;
|
|
92
|
+
}
|
|
93
|
+
export interface IdentityModifyResultBody {
|
|
94
|
+
change_results?: {
|
|
95
|
+
identity_type: SDKIdentityTypeEnum;
|
|
96
|
+
modified_mpid: MPID;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export interface mParticleUserCart {
|
|
100
|
+
add(): void;
|
|
101
|
+
remove(): void;
|
|
102
|
+
clear(): void;
|
|
103
|
+
getCartProducts(): SDKProduct[];
|
|
104
|
+
}
|
|
105
|
+
export type UserAttributes = AllUserAttributes;
|
|
106
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Dictionary } from './utils';
|
|
2
|
+
import { BaseVault } from './vault';
|
|
3
|
+
import { IdentityApiData, UserIdentities, IdentityCallback } from '@mparticle/web-sdk';
|
|
4
|
+
import { IdentityAPIMethod } from './identity.interfaces';
|
|
5
|
+
import { IIdentityResponse, IMParticleUser } from './identity-user-interfaces';
|
|
6
|
+
import { IStore } from './store';
|
|
7
|
+
export declare const CACHE_HEADER: "x-mp-max-age";
|
|
8
|
+
export type IdentityCache = BaseVault<Dictionary<ICachedIdentityCall>>;
|
|
9
|
+
export type IParseCachedIdentityResponse = (cachedIdentity: IIdentityResponse, mpid: string, callback: IdentityCallback, identityApiData: IdentityApiData, identityMethod: string, knownIdentities: IKnownIdentities, fromCachedIdentity: boolean) => void;
|
|
10
|
+
export interface IKnownIdentities extends UserIdentities {
|
|
11
|
+
device_application_stamp?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ICachedIdentityCall {
|
|
14
|
+
responseText: string;
|
|
15
|
+
status: number;
|
|
16
|
+
expireTimestamp: number;
|
|
17
|
+
}
|
|
18
|
+
export declare const cacheOrClearIdCache: (method: string, knownIdentities: IKnownIdentities, idCache: BaseVault<Dictionary<ICachedIdentityCall>>, identityResponse: IIdentityResponse, parsingCachedResponse: boolean) => void;
|
|
19
|
+
export declare const cacheIdentityRequest: (method: IdentityAPIMethod, identities: IKnownIdentities, expireTimestamp: number, idCache: IdentityCache, identityResponse: IIdentityResponse) => void;
|
|
20
|
+
export declare const concatenateIdentities: (method: IdentityAPIMethod, userIdentities: IKnownIdentities) => string;
|
|
21
|
+
export declare const hasValidCachedIdentity: (method: IdentityAPIMethod, proposedUserIdentities: IKnownIdentities, idCache?: IdentityCache) => boolean;
|
|
22
|
+
export declare const getCachedIdentity: (method: IdentityAPIMethod, proposedUserIdentities: IKnownIdentities, idCache: IdentityCache) => IIdentityResponse | null;
|
|
23
|
+
export declare const createKnownIdentities: (identityApiData: IdentityApiData, deviceId: string) => IKnownIdentities;
|
|
24
|
+
export declare const removeExpiredIdentityCacheDates: (idCache: BaseVault<Dictionary<ICachedIdentityCall>>) => void;
|
|
25
|
+
export declare const tryCacheIdentity: (knownIdentities: IKnownIdentities, idCache: IdentityCache, parseIdentityResponse: IParseCachedIdentityResponse, mpid: string, callback: IdentityCallback, identityApiData: IdentityApiData, identityMethod: IdentityAPIMethod) => boolean;
|
|
26
|
+
export declare const hasIdentityRequestChanged: (currentUser: IMParticleUser, newIdentityRequest: IdentityApiData) => boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Checks if deviceId or other user identifiers (like email) were explicitly provided
|
|
29
|
+
* by the partner via config.deviceId or config.identifyRequest.userIdentities.
|
|
30
|
+
* When noFunctional is true, then cookies are blocked, so the partner must explicitly
|
|
31
|
+
* pass deviceId or other identifiers to prevent new users from being created on each page load.
|
|
32
|
+
*
|
|
33
|
+
* @param store - The SDK store (provides SDKConfig.deviceId and SDKConfig.identifyRequest.userIdentities)
|
|
34
|
+
* @returns true if deviceId or other identifiers were explicitly provided in config, false otherwise
|
|
35
|
+
*/
|
|
36
|
+
export declare const hasExplicitIdentifier: (store: IStore | undefined | null) => boolean;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { IdentityApiData, MPID, UserIdentities } from '@mparticle/web-sdk';
|
|
2
|
+
import AudienceManager from './audienceManager';
|
|
3
|
+
import { ICachedIdentityCall, IKnownIdentities } from './identity-utils';
|
|
4
|
+
import { BaseVault } from './vault';
|
|
5
|
+
import { Dictionary, Environment, valueof } from './utils';
|
|
6
|
+
import Constants from './constants';
|
|
7
|
+
import { IdentityCallback, IUserAttributeChangeEvent, IUserIdentityChangeEvent, IMParticleUser, mParticleUserCart, IIdentityResponse } from './identity-user-interfaces';
|
|
8
|
+
declare const platform: "web", sdkVendor: "mparticle", sdkVersion: string, HTTPCodes: {
|
|
9
|
+
readonly noHttpCoverage: -1;
|
|
10
|
+
readonly activeIdentityRequest: -2;
|
|
11
|
+
readonly activeSession: -3;
|
|
12
|
+
readonly validationIssue: -4;
|
|
13
|
+
readonly nativeIdentityRequest: -5;
|
|
14
|
+
readonly loggingDisabledOrMissingAPIKey: -6;
|
|
15
|
+
readonly tooManyRequests: 429;
|
|
16
|
+
};
|
|
17
|
+
export type IdentityPreProcessResult = {
|
|
18
|
+
valid: boolean;
|
|
19
|
+
error?: string;
|
|
20
|
+
};
|
|
21
|
+
export type IdentityAPIMethod = valueof<typeof Constants.IdentityMethods>;
|
|
22
|
+
export declare enum SDKIdentityTypeEnum {
|
|
23
|
+
other = "other",
|
|
24
|
+
customerId = "customerid",
|
|
25
|
+
facebook = "facebook",
|
|
26
|
+
twitter = "twitter",
|
|
27
|
+
google = "google",
|
|
28
|
+
microsoft = "microsoft",
|
|
29
|
+
yahoo = "yahoo",
|
|
30
|
+
email = "email",
|
|
31
|
+
alias = "alias",
|
|
32
|
+
facebookCustomAudienceId = "facebookcustomaudienceid",
|
|
33
|
+
otherId2 = "other2",
|
|
34
|
+
otherId3 = "other3",
|
|
35
|
+
otherId4 = "other4",
|
|
36
|
+
otherId5 = "other5",
|
|
37
|
+
otherId6 = "other6",
|
|
38
|
+
otherId7 = "other7",
|
|
39
|
+
otherId8 = "other8",
|
|
40
|
+
otherId9 = "other9",
|
|
41
|
+
otherId10 = "other10",
|
|
42
|
+
mobileNumber = "mobile_number",
|
|
43
|
+
phoneNumber2 = "phone_number_2",
|
|
44
|
+
phoneNumber3 = "phone_number_3"
|
|
45
|
+
}
|
|
46
|
+
export interface IIdentityAPIRequestData {
|
|
47
|
+
client_sdk: {
|
|
48
|
+
platform: typeof platform;
|
|
49
|
+
sdk_vendor: typeof sdkVendor;
|
|
50
|
+
sdk_version: typeof sdkVersion;
|
|
51
|
+
};
|
|
52
|
+
context: string | null;
|
|
53
|
+
environment: Environment;
|
|
54
|
+
request_id: string;
|
|
55
|
+
request_timestamp_unixtime_ms: number;
|
|
56
|
+
previous_mpid: MPID | null;
|
|
57
|
+
known_identities: IKnownIdentities;
|
|
58
|
+
}
|
|
59
|
+
export interface IIdentityAPIModifyRequestData extends Omit<IIdentityAPIRequestData, 'known_identities' | 'previous_mpid'> {
|
|
60
|
+
identity_changes: IIdentityAPIIdentityChangeData[];
|
|
61
|
+
}
|
|
62
|
+
export interface IIdentityAPIIdentityChangeData {
|
|
63
|
+
identity_type: SDKIdentityTypeEnum;
|
|
64
|
+
old_value: string;
|
|
65
|
+
new_value: string;
|
|
66
|
+
}
|
|
67
|
+
export interface IIdentityRequest {
|
|
68
|
+
combineUserIdentities(previousUIByName: UserIdentities, newUIByName: UserIdentities): UserIdentities;
|
|
69
|
+
createIdentityRequest(identityApiData: IdentityApiData, platform: string, sdkVendor: string, sdkVersion: string, deviceId: string, context: string | null, mpid: MPID): IIdentityAPIRequestData;
|
|
70
|
+
createModifyIdentityRequest(currentUserIdentities: UserIdentities, newUserIdentities: UserIdentities, platform: string, sdkVendor: string, sdkVersion: string, context: string | null): IIdentityAPIModifyRequestData;
|
|
71
|
+
createIdentityChanges(previousIdentities: UserIdentities, newIdentitie: UserIdentities): IIdentityAPIIdentityChangeData;
|
|
72
|
+
preProcessIdentityRequest(identityApiData: IdentityApiData, callback: IdentityCallback, method: IdentityAPIMethod): IdentityPreProcessResult;
|
|
73
|
+
}
|
|
74
|
+
export type AliasRequestScope = 'device' | 'mpid';
|
|
75
|
+
export interface IAliasRequest {
|
|
76
|
+
destinationMpid: MPID;
|
|
77
|
+
sourceMpid: MPID;
|
|
78
|
+
startTime: number;
|
|
79
|
+
endTime: number;
|
|
80
|
+
scope?: AliasRequestScope;
|
|
81
|
+
}
|
|
82
|
+
export interface IAliasCallback {
|
|
83
|
+
(result: IAliasResult): void;
|
|
84
|
+
}
|
|
85
|
+
export interface IAliasResult {
|
|
86
|
+
httpCode: number;
|
|
87
|
+
message: string;
|
|
88
|
+
}
|
|
89
|
+
export interface SDKIdentityApi {
|
|
90
|
+
HTTPCodes: typeof HTTPCodes;
|
|
91
|
+
identify?(identityApiData?: IdentityApiData, callback?: IdentityCallback): void;
|
|
92
|
+
login?(identityApiData?: IdentityApiData, callback?: IdentityCallback): void;
|
|
93
|
+
logout?(identityApiData?: IdentityApiData, callback?: IdentityCallback): void;
|
|
94
|
+
modify?(identityApiData?: IdentityApiData, callback?: IdentityCallback): void;
|
|
95
|
+
getCurrentUser?(): IMParticleUser;
|
|
96
|
+
getUser?(mpid: string): IMParticleUser;
|
|
97
|
+
getUsers?(): IMParticleUser[];
|
|
98
|
+
aliasUsers?(aliasRequest?: IAliasRequest, callback?: IdentityCallback): void;
|
|
99
|
+
createAliasRequest?(sourceUser: IMParticleUser, destinationUser: IMParticleUser, scope?: AliasRequestScope): IAliasRequest;
|
|
100
|
+
}
|
|
101
|
+
export interface IIdentity {
|
|
102
|
+
audienceManager: AudienceManager;
|
|
103
|
+
idCache: BaseVault<Dictionary<ICachedIdentityCall>>;
|
|
104
|
+
IdentityAPI: SDKIdentityApi;
|
|
105
|
+
IdentityRequest: IIdentityRequest;
|
|
106
|
+
mParticleUser(mpid: MPID, IsLoggedIn: boolean): IMParticleUser;
|
|
107
|
+
createUserAttributeChange(key: string, newValue: string, previousUserAttributeValue: string, isNewAttribute: boolean, deleted: boolean, user: IMParticleUser): IUserAttributeChangeEvent;
|
|
108
|
+
createUserIdentityChange(identityType: SDKIdentityTypeEnum, newIdentity: string, oldIdentity: string, newCreatedThisBatch: boolean, userInMemory: IMParticleUser): IUserIdentityChangeEvent;
|
|
109
|
+
parseIdentityResponse(identityResponse: IIdentityResponse, previousMPID: MPID, callback: IdentityCallback, identityApiData: IdentityApiData, method: IdentityAPIMethod, knownIdentities: UserIdentities, parsingCachedResponse: boolean): void;
|
|
110
|
+
sendUserAttributeChangeEvent(attributeKey: string, newUserAttributeValue: string, previousUserAttributeValue: string, isNewAttribute: boolean, deleted: boolean, user: IMParticleUser): void;
|
|
111
|
+
sendUserIdentityChangeEvent(newUserIdentities: UserIdentities, method: IdentityAPIMethod, mpid: MPID, prevUserIdentities: UserIdentities): void;
|
|
112
|
+
/**
|
|
113
|
+
* @deprecated
|
|
114
|
+
*/
|
|
115
|
+
mParticleUserCart(): mParticleUserCart;
|
|
116
|
+
}
|
|
117
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IAliasCallback, IAliasRequest, IdentityAPIMethod, IIdentity, IIdentityAPIRequestData } from './identity.interfaces';
|
|
2
|
+
import { IdentityApiData, MPID, UserIdentities } from '@mparticle/web-sdk';
|
|
3
|
+
import { IdentityCallback, IdentityResultBody, IIdentityResponse } from './identity-user-interfaces';
|
|
4
|
+
import { IMParticleWebSDKInstance } from './mp-instance';
|
|
5
|
+
export interface IIdentityApiClient {
|
|
6
|
+
sendAliasRequest: (aliasRequest: IAliasRequest, aliasCallback: IAliasCallback) => Promise<void>;
|
|
7
|
+
sendIdentityRequest: (identityApiRequest: IIdentityAPIRequestData, method: IdentityAPIMethod, callback: IdentityCallback, originalIdentityApiData: IdentityApiData, parseIdentityResponse: IIdentity['parseIdentityResponse'], mpid: MPID, knownIdentities: UserIdentities) => Promise<void>;
|
|
8
|
+
getUploadUrl: (method: IdentityAPIMethod, mpid: MPID) => string;
|
|
9
|
+
getIdentityResponseFromFetch: (response: Response, responseBody: IdentityResultBody) => IIdentityResponse;
|
|
10
|
+
getIdentityResponseFromXHR: (response: XMLHttpRequest) => IIdentityResponse;
|
|
11
|
+
}
|
|
12
|
+
export interface IAliasResponseBody {
|
|
13
|
+
}
|
|
14
|
+
export default function IdentityAPIClient(this: IIdentityApiClient, mpInstance: IMParticleWebSDKInstance): void;
|