@mparticle/web-sdk 2.80.0 → 2.81.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 +75 -488
- package/dist/mparticle.esm.js +75 -488
- package/dist/mparticle.js +244 -673
- package/dist/types/src/configAPIClient.d.ts +1 -0
- package/dist/types/src/ecommerce.d.ts +3 -53
- package/dist/types/src/ecommerce.interfaces.d.ts +11 -12
- package/dist/types/src/events.interfaces.d.ts +1 -1
- package/dist/types/src/forwarders.d.ts +4 -26
- package/dist/types/src/forwarders.interfaces.d.ts +41 -10
- package/dist/types/src/identity-utils.d.ts +3 -3
- package/dist/types/src/identity.d.ts +3 -0
- package/dist/types/src/identity.interfaces.d.ts +45 -11
- package/dist/types/src/identityApiClient.d.ts +5 -4
- package/dist/types/src/mp-instance.d.ts +2 -2
- package/dist/types/src/persistence.interfaces.d.ts +2 -3
- package/dist/types/src/roktManager.d.ts +18 -0
- package/dist/types/src/sdkRuntimeModels.d.ts +2 -2
- package/dist/types/src/store.d.ts +4 -3
- package/package.json +1 -1
- package/src/configAPIClient.ts +1 -0
- package/src/ecommerce.interfaces.ts +12 -21
- package/src/{ecommerce.js → ecommerce.ts} +144 -73
- package/src/events.interfaces.ts +1 -1
- package/src/events.ts +1 -1
- package/src/forwarders.interfaces.ts +73 -10
- package/src/{forwarders.js → forwarders.ts} +214 -176
- package/src/helpers.ts +7 -3
- package/src/identity-utils.ts +2 -2
- package/src/identity.interfaces.ts +58 -14
- package/src/{identity.js → identity.ts} +237 -192
- package/src/identityApiClient.ts +9 -9
- package/src/mp-instance.ts +2 -2
- package/src/persistence.interfaces.ts +2 -3
- package/src/roktManager.ts +37 -0
- package/src/sdkRuntimeModels.ts +2 -1
- package/src/store.ts +4 -3
|
@@ -1,53 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
convertTransactionAttributesToProductAction: (transactionAttributes: any, productAction: any) => void;
|
|
5
|
-
calculateProductActionTotalAmount: (productAction: any) => any;
|
|
6
|
-
getProductActionEventName: (productActionType: any) => "AddToCart" | "AddToWishlist" | "Checkout" | "CheckoutOption" | "Click" | "Purchase" | "Refund" | "RemoveFromCart" | "RemoveFromWishlist" | "ViewDetail" | "ViewCart" | "AddShippingInfo" | "AddPaymentInfo" | "PaymentMethodSelected" | "PaymentAttempted" | "PaymentSucceeded" | "PaymentFailed" | "RefundInitiated" | "Unknown";
|
|
7
|
-
getPromotionActionEventName: (promotionActionType: any) => "Unknown" | "PromotionClick" | "PromotionView";
|
|
8
|
-
convertProductActionToEventType: (productActionType: any) => 0 | 20 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 21;
|
|
9
|
-
convertPromotionActionToEventType: (promotionActionType: any) => 18 | 19;
|
|
10
|
-
generateExpandedEcommerceName: (eventName: any, plusOne: any) => string;
|
|
11
|
-
extractProductAttributes: (attributes: any, product: any) => void;
|
|
12
|
-
extractTransactionId: (attributes: any, productAction: any) => void;
|
|
13
|
-
extractActionAttributes: (attributes: any, productAction: any) => void;
|
|
14
|
-
extractPromotionAttributes: (attributes: any, promotion: any) => void;
|
|
15
|
-
buildProductList: (event: any, product: any) => any;
|
|
16
|
-
createProduct: (name: any, sku: any, price: any, quantity: any, variant: any, category: any, brand: any, position: any, couponCode: any, attributes: any) => {
|
|
17
|
-
Name: string;
|
|
18
|
-
Sku: any;
|
|
19
|
-
Price: any;
|
|
20
|
-
Quantity: any;
|
|
21
|
-
Brand: any;
|
|
22
|
-
Variant: any;
|
|
23
|
-
Category: any;
|
|
24
|
-
Position: any;
|
|
25
|
-
CouponCode: any;
|
|
26
|
-
TotalAmount: number;
|
|
27
|
-
Attributes: any;
|
|
28
|
-
};
|
|
29
|
-
createPromotion: (id: any, creative: any, name: any, position: any) => {
|
|
30
|
-
Id: any;
|
|
31
|
-
Creative: any;
|
|
32
|
-
Name: any;
|
|
33
|
-
Position: any;
|
|
34
|
-
};
|
|
35
|
-
createImpression: (name: any, product: any) => {
|
|
36
|
-
Name: string;
|
|
37
|
-
Product: any;
|
|
38
|
-
};
|
|
39
|
-
createTransactionAttributes: (id: any, affiliation: any, couponCode: any, revenue: any, shipping: any, tax: any) => {
|
|
40
|
-
Id: any;
|
|
41
|
-
Affiliation: any;
|
|
42
|
-
CouponCode: any;
|
|
43
|
-
Revenue: any;
|
|
44
|
-
Shipping: any;
|
|
45
|
-
Tax: any;
|
|
46
|
-
};
|
|
47
|
-
expandProductImpression: (commerceEvent: any) => any[];
|
|
48
|
-
expandCommerceEvent: (event: any) => any[];
|
|
49
|
-
expandPromotionAction: (commerceEvent: any) => any[];
|
|
50
|
-
expandProductAction: (commerceEvent: any) => any[];
|
|
51
|
-
createCommerceEventObject: (customFlags: any, options: any) => any;
|
|
52
|
-
sanitizeAmount: (amount: any, category: any) => any;
|
|
53
|
-
}
|
|
1
|
+
import { IMParticleWebSDKInstance } from './mp-instance';
|
|
2
|
+
import { IECommerce } from './ecommerce.interfaces';
|
|
3
|
+
export default function Ecommerce(this: IECommerce, mpInstance: IMParticleWebSDKInstance): void;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { ProductAction, Product, Promotion, CommerceEvent } from '@mparticle/event-models';
|
|
2
1
|
import { SDKEventAttrs, SDKEventOptions, TransactionAttributes } from '@mparticle/web-sdk';
|
|
3
2
|
import { valueof } from './utils';
|
|
4
3
|
import { ProductActionType, PromotionActionType } from './types';
|
|
5
4
|
import { SDKEvent, SDKEventCustomFlags, SDKImpression, SDKProduct, SDKProductAction, SDKPromotion } from './sdkRuntimeModels';
|
|
6
5
|
interface IECommerceShared {
|
|
7
6
|
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:
|
|
7
|
+
createImpression(name: string, product: SDKProduct): SDKImpression | null;
|
|
9
8
|
createPromotion(id: string | number, creative?: string, name?: string, position?: number): SDKPromotion | null;
|
|
10
9
|
createTransactionAttributes(id: string | number, affiliation?: string, couponCode?: string, revenue?: string | number, shipping?: string | number, tax?: number): TransactionAttributes | null;
|
|
11
|
-
expandCommerceEvent(event:
|
|
10
|
+
expandCommerceEvent(event: SDKEvent): SDKEvent[] | null;
|
|
12
11
|
}
|
|
13
12
|
export interface SDKCart {
|
|
14
13
|
add(product: SDKProduct | SDKProduct[], logEvent?: boolean): void;
|
|
@@ -19,7 +18,7 @@ export interface SDKECommerceAPI extends IECommerceShared {
|
|
|
19
18
|
logCheckout(step: number, option?: string, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags): void;
|
|
20
19
|
logImpression(impression: SDKImpression | SDKImpression[], attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, eventOptions?: SDKEventOptions): void;
|
|
21
20
|
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;
|
|
21
|
+
logPromotion(type: valueof<typeof PromotionActionType>, promotion: SDKPromotion | SDKPromotion[], attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, eventOptions?: SDKEventOptions): void;
|
|
23
22
|
setCurrencyCode(code: string): void;
|
|
24
23
|
Cart: SDKCart;
|
|
25
24
|
logPurchase(transactionAttributes: TransactionAttributes, product: SDKProduct | SDKProduct[], clearCart?: boolean, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags): void;
|
|
@@ -64,14 +63,14 @@ export interface IECommerce extends IECommerceShared {
|
|
|
64
63
|
calculateProductActionTotalAmount(productAction: SDKProductAction): SDKProductAction;
|
|
65
64
|
convertTransactionAttributesToProductAction(transactionAttributes: TransactionAttributes, productAction: SDKProductAction): void;
|
|
66
65
|
createCommerceEventObject(customFlags: SDKEventCustomFlags, options?: SDKEventOptions): SDKEvent | null;
|
|
67
|
-
expandProductAction(commerceEvent:
|
|
68
|
-
expandProductImpression(commerceEvent:
|
|
69
|
-
expandPromotionAction(commerceEvent:
|
|
70
|
-
extractActionAttributes(attributes: ExtractedActionAttributes, productAction:
|
|
71
|
-
extractProductAttributes(attributes: ExtractedProductAttributes, product:
|
|
72
|
-
extractPromotionAttributes(attributes: ExtractedPromotionAttributes, promotion:
|
|
73
|
-
extractTransactionId(attributes: ExtractedTransactionId, productAction:
|
|
74
|
-
generateExpandedEcommerceName(eventName: string, plusOne
|
|
66
|
+
expandProductAction(commerceEvent: SDKEvent): SDKEvent[];
|
|
67
|
+
expandProductImpression(commerceEvent: SDKEvent): SDKEvent[];
|
|
68
|
+
expandPromotionAction(commerceEvent: SDKEvent): SDKEvent[];
|
|
69
|
+
extractActionAttributes(attributes: ExtractedActionAttributes, productAction: SDKProductAction): void;
|
|
70
|
+
extractProductAttributes(attributes: ExtractedProductAttributes, product: SDKProduct): void;
|
|
71
|
+
extractPromotionAttributes(attributes: ExtractedPromotionAttributes, promotion: SDKPromotion): void;
|
|
72
|
+
extractTransactionId(attributes: ExtractedTransactionId, productAction: SDKProductAction): void;
|
|
73
|
+
generateExpandedEcommerceName(eventName: string, plusOne?: boolean): string;
|
|
75
74
|
getProductActionEventName(productActionType: valueof<typeof ProductActionType>): string;
|
|
76
75
|
getPromotionActionEventName(promotionActionType: valueof<typeof PromotionActionType>): string;
|
|
77
76
|
sanitizeAmount(amount: string | number, category: string): number;
|
|
@@ -13,7 +13,7 @@ export interface IEvents {
|
|
|
13
13
|
logOptOut(): void;
|
|
14
14
|
logPageView(): void;
|
|
15
15
|
logProductActionEvent(productActionType: valueof<typeof ProductActionType>, product: SDKProduct | SDKProduct[], attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, transactionAttributes?: TransactionAttributes, eventOptions?: SDKEventOptions): void;
|
|
16
|
-
logPromotionEvent(promotionType: valueof<typeof PromotionActionType>, promotion: SDKPromotion, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, eventOptions?: SDKEventOptions): void;
|
|
16
|
+
logPromotionEvent(promotionType: valueof<typeof PromotionActionType>, promotion: SDKPromotion | SDKPromotion[], attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, eventOptions?: SDKEventOptions): void;
|
|
17
17
|
logPurchaseEvent(transactionAttributes: TransactionAttributes, product: SDKProduct | SDKProduct[], attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags): void;
|
|
18
18
|
logRefundEvent(transactionAttributes: TransactionAttributes, product: SDKProduct | SDKProduct[], attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags): void;
|
|
19
19
|
startTracking(callback: Callback): void;
|
|
@@ -1,26 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
}
|
|
1
|
+
import { IMParticleWebSDKInstance } from './mp-instance';
|
|
2
|
+
import KitBlocker from './kitBlocking';
|
|
3
|
+
import { IForwarders } from './forwarders.interfaces';
|
|
4
|
+
export default function Forwarders(this: IForwarders, mpInstance: IMParticleWebSDKInstance, kitBlocker: KitBlocker): void;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { SDKEvent, SDKEventCustomFlags } from './sdkRuntimeModels';
|
|
1
|
+
import { SDKEvent, SDKEventCustomFlags, SDKInitConfig, SDKLoggerApi } from './sdkRuntimeModels';
|
|
2
2
|
import { Dictionary } from './utils';
|
|
3
|
-
import { IKitConfigs, IKitFilterSettings } from './configAPIClient';
|
|
4
|
-
import { IdentityApiData, IdentityType } from '@mparticle/web-sdk';
|
|
3
|
+
import { IKitConfigs, IKitFilterSettings, IFilteringUserAttributeValue } from './configAPIClient';
|
|
4
|
+
import { IdentityApiData, IdentityType, UserIdentities } from '@mparticle/web-sdk';
|
|
5
5
|
import { Batch } from '@mparticle/event-models';
|
|
6
|
+
import { IForwardingStatsData } from './apiClient';
|
|
7
|
+
import { AsyncUploader } from './uploaders';
|
|
8
|
+
import { IPixelConfiguration } from './cookieSyncManager';
|
|
6
9
|
import { IMParticleUser, ISDKUserIdentity, UserAttributes } from './identity-user-interfaces';
|
|
10
|
+
import type { IFilteredMparticleUser } from './filteredMparticleUser';
|
|
7
11
|
export type MPForwarder = Dictionary;
|
|
8
12
|
export interface UnregisteredKit {
|
|
9
13
|
constructor: () => void;
|
|
@@ -22,19 +26,22 @@ export interface KitRegistrationConfig {
|
|
|
22
26
|
export interface ConfiguredKit extends Omit<IKitConfigs, 'isDebugString' | 'hasDebugString'> {
|
|
23
27
|
common: Dictionary<unknown>;
|
|
24
28
|
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:
|
|
27
|
-
onLoginComplete(user:
|
|
28
|
-
onLogoutComplete(user:
|
|
29
|
-
onModifyComplete(user:
|
|
30
|
-
onUserIdentified(user:
|
|
29
|
+
init(settings: Dictionary<unknown>, service: forwardingStatsCallback, testMode: boolean, trackerId: string | null, userAttributes: UserAttributes, userIdentities: ISDKUserIdentity[], appVersion: string, appName: string, customFlags: SDKEventCustomFlags, clientId: string): string;
|
|
30
|
+
onIdentifyComplete(user: IFilteredMparticleUser, filteredIdentityRequest: IdentityApiData): string;
|
|
31
|
+
onLoginComplete(user: IFilteredMparticleUser, filteredIdentityRequest: IdentityApiData): string;
|
|
32
|
+
onLogoutComplete(user: IFilteredMparticleUser, filteredIdentityRequest: IdentityApiData): string;
|
|
33
|
+
onModifyComplete(user: IFilteredMparticleUser, filteredIdentityRequest: IdentityApiData): string;
|
|
34
|
+
onUserIdentified(user: IFilteredMparticleUser): string;
|
|
31
35
|
process(event: SDKEvent): string;
|
|
32
36
|
setOptOut(isOptingOut: boolean): string;
|
|
33
37
|
removeUserAttribute(key: string): string;
|
|
34
38
|
setUserAttribute(key: string, value: string): string;
|
|
35
|
-
setUserIdentity(id: UserIdentityId, type: UserIdentityType): void;
|
|
39
|
+
setUserIdentity(id: UserIdentityId, type: UserIdentityType): string | void;
|
|
40
|
+
logOut?(evt: SDKEvent): void;
|
|
36
41
|
isSandbox: boolean;
|
|
37
42
|
hasSandbox: boolean;
|
|
43
|
+
initialized?: boolean;
|
|
44
|
+
logger?: SDKLoggerApi;
|
|
38
45
|
}
|
|
39
46
|
export interface KitInterface {
|
|
40
47
|
id: number;
|
|
@@ -57,3 +64,27 @@ export type UserIdentityType = number;
|
|
|
57
64
|
export type UserAttributeFilters = number[];
|
|
58
65
|
export type UserIdentityFilters = typeof IdentityType[];
|
|
59
66
|
export type forwardingStatsCallback = (forwarder: ConfiguredKit, event: SDKEvent) => void;
|
|
67
|
+
export interface IForwarders {
|
|
68
|
+
forwarderStatsUploader: AsyncUploader;
|
|
69
|
+
initForwarders(userIdentities: UserIdentities, forwardingStatsCallback: forwardingStatsCallback): void;
|
|
70
|
+
isEnabledForUserAttributes(filterObject: Partial<IFilteringUserAttributeValue>, user: IMParticleUser): boolean;
|
|
71
|
+
isEnabledForUnknownUser(excludeAnonymousUserBoolean: boolean, user: IMParticleUser): boolean;
|
|
72
|
+
applyToForwarders(functionName: string, functionArgs: unknown): void;
|
|
73
|
+
sendEventToForwarders(event: SDKEvent): void;
|
|
74
|
+
handleForwarderUserAttributes(functionNameKey: string, key: string, value: string): void;
|
|
75
|
+
setForwarderUserIdentities(userIdentities: UserIdentities): void;
|
|
76
|
+
setForwarderOnUserIdentified(user: IMParticleUser): void;
|
|
77
|
+
setForwarderOnIdentityComplete(user: IMParticleUser, identityMethod: string): void;
|
|
78
|
+
getForwarderStatsQueue(): IForwardingStatsData[];
|
|
79
|
+
setForwarderStatsQueue(queue: IForwardingStatsData[]): void;
|
|
80
|
+
processForwarders(config: SDKInitConfig, forwardingStatsCallback: forwardingStatsCallback): void;
|
|
81
|
+
processUIEnabledKits(config: SDKInitConfig): void;
|
|
82
|
+
returnKitConstructors(): Dictionary<RegisteredKit>;
|
|
83
|
+
configureUIEnabledKit(configuration: IKitConfigs, kits: Dictionary<RegisteredKit>): void;
|
|
84
|
+
processSideloadedKits(mpConfig: SDKInitConfig): void;
|
|
85
|
+
configureSideloadedKit(kitConstructor: RegisteredKit): void;
|
|
86
|
+
returnConfiguredKit(forwarder: RegisteredKit, config?: Partial<IKitConfigs>): ConfiguredKit;
|
|
87
|
+
configurePixel(settings: IPixelConfiguration): void;
|
|
88
|
+
processPixelConfigs(config: SDKInitConfig): void;
|
|
89
|
+
sendSingleForwardingStatsToServer(forwardingStatsData: IForwardingStatsData): Promise<void>;
|
|
90
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Dictionary, Environment } from './utils';
|
|
2
2
|
import { BaseVault } from './vault';
|
|
3
|
-
import { IdentityApiData, UserIdentities
|
|
3
|
+
import { IdentityApiData, UserIdentities } from '@mparticle/web-sdk';
|
|
4
4
|
import { IdentityAPIMethod } from './identity.interfaces';
|
|
5
|
-
import { IIdentityResponse, IMParticleUser } from './identity-user-interfaces';
|
|
5
|
+
import { IdentityCallback, IIdentityResponse, IMParticleUser } from './identity-user-interfaces';
|
|
6
6
|
import { IStore } from './store';
|
|
7
7
|
import type { IMParticleWebSDKInstance } from './mp-instance';
|
|
8
8
|
import { IIdentitySearchRequestBody, IdentitySearchCallback } from './identity/search';
|
|
9
9
|
export declare const CACHE_HEADER: "x-mp-max-age";
|
|
10
10
|
export type IdentityCache = BaseVault<Dictionary<ICachedIdentityCall>>;
|
|
11
|
-
export type IParseCachedIdentityResponse = (cachedIdentity: IIdentityResponse, mpid: string, callback: IdentityCallback, identityApiData: IdentityApiData, identityMethod:
|
|
11
|
+
export type IParseCachedIdentityResponse = (cachedIdentity: IIdentityResponse, mpid: string, callback: IdentityCallback, identityApiData: IdentityApiData, identityMethod: IdentityAPIMethod, knownIdentities: IKnownIdentities, fromCachedIdentity: boolean) => void;
|
|
12
12
|
export interface IKnownIdentities extends UserIdentities {
|
|
13
13
|
device_application_stamp?: string;
|
|
14
14
|
}
|
|
@@ -6,7 +6,7 @@ import { Dictionary, Environment, valueof } from './utils';
|
|
|
6
6
|
import Constants from './constants';
|
|
7
7
|
import { IdentityCallback, IUserAttributeChangeEvent, IUserIdentityChangeEvent, IMParticleUser, mParticleUserCart, IIdentityResponse } from './identity-user-interfaces';
|
|
8
8
|
import { IdentitySearchCallback } from './identity/search';
|
|
9
|
-
declare const
|
|
9
|
+
declare const HTTPCodes: {
|
|
10
10
|
readonly noHttpCoverage: -1;
|
|
11
11
|
readonly activeIdentityRequest: -2;
|
|
12
12
|
readonly activeSession: -3;
|
|
@@ -18,6 +18,7 @@ declare const platform: "web", sdkVendor: "mparticle", sdkVersion: string, HTTPC
|
|
|
18
18
|
export type IdentityPreProcessResult = {
|
|
19
19
|
valid: boolean;
|
|
20
20
|
error?: string;
|
|
21
|
+
cleanedIdentities?: IdentityApiData;
|
|
21
22
|
};
|
|
22
23
|
export type IdentityAPIMethod = valueof<typeof Constants.IdentityMethods>;
|
|
23
24
|
export declare enum SDKIdentityTypeEnum {
|
|
@@ -46,14 +47,14 @@ export declare enum SDKIdentityTypeEnum {
|
|
|
46
47
|
}
|
|
47
48
|
export interface IIdentityAPIRequestData {
|
|
48
49
|
client_sdk: {
|
|
49
|
-
platform:
|
|
50
|
-
sdk_vendor:
|
|
51
|
-
sdk_version:
|
|
50
|
+
platform: string;
|
|
51
|
+
sdk_vendor: string;
|
|
52
|
+
sdk_version: string;
|
|
52
53
|
};
|
|
53
54
|
context: string | null;
|
|
54
55
|
environment: Environment;
|
|
55
56
|
request_id: string;
|
|
56
|
-
|
|
57
|
+
request_timestamp_ms: number;
|
|
57
58
|
previous_mpid: MPID | null;
|
|
58
59
|
known_identities: IKnownIdentities;
|
|
59
60
|
}
|
|
@@ -69,9 +70,13 @@ export interface IIdentityRequest {
|
|
|
69
70
|
combineUserIdentities(previousUIByName: UserIdentities, newUIByName: UserIdentities): UserIdentities;
|
|
70
71
|
createIdentityRequest(identityApiData: IdentityApiData, platform: string, sdkVendor: string, sdkVersion: string, deviceId: string, context: string | null, mpid: MPID): IIdentityAPIRequestData;
|
|
71
72
|
createModifyIdentityRequest(currentUserIdentities: UserIdentities, newUserIdentities: UserIdentities, platform: string, sdkVendor: string, sdkVersion: string, context: string | null): IIdentityAPIModifyRequestData;
|
|
72
|
-
createIdentityChanges(previousIdentities: UserIdentities,
|
|
73
|
+
createIdentityChanges(previousIdentities: UserIdentities, newIdentities: UserIdentities): IIdentityAPIIdentityChangeData[];
|
|
73
74
|
preProcessIdentityRequest(identityApiData: IdentityApiData, callback: IdentityCallback, method: IdentityAPIMethod): IdentityPreProcessResult;
|
|
75
|
+
createAliasNetworkRequest(aliasRequest: IAliasRequest): IAliasNetworkRequest;
|
|
76
|
+
convertAliasToNative(aliasRequest: IAliasRequest): IAliasNativeRequest;
|
|
77
|
+
convertToNative(identityApiData: IdentityApiData): IIdentityNativeRequest | undefined;
|
|
74
78
|
}
|
|
79
|
+
export type UserAttributeChangeValue = string | string[] | null;
|
|
75
80
|
export type AliasRequestScope = 'device' | 'mpid';
|
|
76
81
|
export interface IAliasRequest {
|
|
77
82
|
destinationMpid: MPID;
|
|
@@ -80,6 +85,33 @@ export interface IAliasRequest {
|
|
|
80
85
|
endTime: number;
|
|
81
86
|
scope?: AliasRequestScope;
|
|
82
87
|
}
|
|
88
|
+
export interface IAliasNetworkRequest {
|
|
89
|
+
request_id: string;
|
|
90
|
+
request_type: 'alias';
|
|
91
|
+
environment: Environment;
|
|
92
|
+
api_key: string;
|
|
93
|
+
data: {
|
|
94
|
+
destination_mpid: MPID;
|
|
95
|
+
source_mpid: MPID;
|
|
96
|
+
start_unixtime_ms: number;
|
|
97
|
+
end_unixtime_ms: number;
|
|
98
|
+
scope?: AliasRequestScope;
|
|
99
|
+
device_application_stamp: string;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export interface IAliasNativeRequest {
|
|
103
|
+
DestinationMpid: MPID;
|
|
104
|
+
SourceMpid: MPID;
|
|
105
|
+
StartUnixtimeMs: number;
|
|
106
|
+
EndUnixtimeMs: number;
|
|
107
|
+
Scope?: AliasRequestScope;
|
|
108
|
+
}
|
|
109
|
+
export interface IIdentityNativeRequest {
|
|
110
|
+
UserIdentities: Array<{
|
|
111
|
+
Type: number;
|
|
112
|
+
Identity: string;
|
|
113
|
+
}>;
|
|
114
|
+
}
|
|
83
115
|
export interface IAliasCallback {
|
|
84
116
|
(result: IAliasResult): void;
|
|
85
117
|
}
|
|
@@ -96,7 +128,7 @@ export interface SDKIdentityApi {
|
|
|
96
128
|
getCurrentUser?(): IMParticleUser;
|
|
97
129
|
getUser?(mpid: string): IMParticleUser;
|
|
98
130
|
getUsers?(): IMParticleUser[];
|
|
99
|
-
aliasUsers?(aliasRequest?: IAliasRequest, callback?:
|
|
131
|
+
aliasUsers?(aliasRequest?: IAliasRequest, callback?: IAliasCallback): void;
|
|
100
132
|
createAliasRequest?(sourceUser: IMParticleUser, destinationUser: IMParticleUser, scope?: AliasRequestScope): IAliasRequest;
|
|
101
133
|
/**
|
|
102
134
|
* Sends a request to mParticle's IDSync `/v1/search` endpoint to look up
|
|
@@ -140,12 +172,14 @@ export interface IIdentity {
|
|
|
140
172
|
idCache: BaseVault<Dictionary<ICachedIdentityCall>>;
|
|
141
173
|
IdentityAPI: SDKIdentityApi;
|
|
142
174
|
IdentityRequest: IIdentityRequest;
|
|
143
|
-
mParticleUser(mpid
|
|
144
|
-
createUserAttributeChange(key: string, newValue:
|
|
175
|
+
mParticleUser(mpid?: MPID, IsLoggedIn?: boolean): IMParticleUser;
|
|
176
|
+
createUserAttributeChange(key: string, newValue: UserAttributeChangeValue, previousUserAttributeValue: UserAttributeChangeValue, isNewAttribute: boolean, deleted: boolean, user: IMParticleUser): IUserAttributeChangeEvent;
|
|
145
177
|
createUserIdentityChange(identityType: SDKIdentityTypeEnum, newIdentity: string, oldIdentity: string, newCreatedThisBatch: boolean, userInMemory: IMParticleUser): IUserIdentityChangeEvent;
|
|
146
|
-
parseIdentityResponse(identityResponse: IIdentityResponse, previousMPID: MPID, callback: IdentityCallback, identityApiData: IdentityApiData, method: IdentityAPIMethod, knownIdentities:
|
|
147
|
-
sendUserAttributeChangeEvent(attributeKey: string, newUserAttributeValue:
|
|
178
|
+
parseIdentityResponse(identityResponse: IIdentityResponse, previousMPID: MPID, callback: IdentityCallback, identityApiData: IdentityApiData, method: IdentityAPIMethod, knownIdentities: IKnownIdentities, parsingCachedResponse: boolean): void;
|
|
179
|
+
sendUserAttributeChangeEvent(attributeKey: string, newUserAttributeValue: UserAttributeChangeValue, previousUserAttributeValue: UserAttributeChangeValue, isNewAttribute: boolean, deleted: boolean, user: IMParticleUser): void;
|
|
148
180
|
sendUserIdentityChangeEvent(newUserIdentities: UserIdentities, method: IdentityAPIMethod, mpid: MPID, prevUserIdentities: UserIdentities): void;
|
|
181
|
+
reinitForwardersOnUserChange(prevUser: IMParticleUser, newUser: IMParticleUser): void;
|
|
182
|
+
setForwarderCallbacks(user: IMParticleUser, method: IdentityAPIMethod): void;
|
|
149
183
|
/**
|
|
150
184
|
* @deprecated
|
|
151
185
|
*/
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IKnownIdentities } from './identity-utils';
|
|
2
|
+
import { IAliasCallback, IAliasNetworkRequest, IdentityAPIMethod, IIdentity, IIdentityAPIRequestData, IIdentityAPIModifyRequestData } from './identity.interfaces';
|
|
3
|
+
import { IdentityApiData, MPID } from '@mparticle/web-sdk';
|
|
3
4
|
import { IdentityCallback, IdentityResultBody, IIdentityResponse } from './identity-user-interfaces';
|
|
4
5
|
import { IMParticleWebSDKInstance } from './mp-instance';
|
|
5
6
|
export interface IIdentityApiClient {
|
|
6
|
-
sendAliasRequest: (aliasRequest:
|
|
7
|
-
sendIdentityRequest: (identityApiRequest: IIdentityAPIRequestData, method: IdentityAPIMethod, callback: IdentityCallback, originalIdentityApiData: IdentityApiData, parseIdentityResponse: IIdentity['parseIdentityResponse'], mpid: MPID, knownIdentities
|
|
7
|
+
sendAliasRequest: (aliasRequest: IAliasNetworkRequest, aliasCallback: IAliasCallback) => Promise<void>;
|
|
8
|
+
sendIdentityRequest: (identityApiRequest: IIdentityAPIRequestData | IIdentityAPIModifyRequestData, method: IdentityAPIMethod, callback: IdentityCallback, originalIdentityApiData: IdentityApiData, parseIdentityResponse: IIdentity['parseIdentityResponse'], mpid: MPID, knownIdentities?: IKnownIdentities) => Promise<void>;
|
|
8
9
|
getUploadUrl: (method: IdentityAPIMethod, mpid: MPID) => string;
|
|
9
10
|
getIdentityResponseFromFetch: (response: Response, responseBody: IdentityResultBody) => IIdentityResponse;
|
|
10
11
|
getIdentityResponseFromXHR: (response: XMLHttpRequest) => IIdentityResponse;
|
|
@@ -5,7 +5,7 @@ import { IStore } from './store';
|
|
|
5
5
|
import { IServerModel } from './serverModel';
|
|
6
6
|
import { IForwardingStatsUploader } from './forwardingStatsUploader';
|
|
7
7
|
import { IConsent } from './consent';
|
|
8
|
-
import
|
|
8
|
+
import { IIdentityApiClient } from './identityApiClient';
|
|
9
9
|
import IntegrationCapture from './integrationCapture';
|
|
10
10
|
import { IPreInit } from './pre-init-utils';
|
|
11
11
|
import { MParticleWebSDK, SDKHelpersApi } from './sdkRuntimeModels';
|
|
@@ -42,7 +42,7 @@ export interface IMParticleWebSDKInstance extends MParticleWebSDK {
|
|
|
42
42
|
_ForwardingStatsUploader: IForwardingStatsUploader;
|
|
43
43
|
_Helpers: SDKHelpersApi;
|
|
44
44
|
_Identity: IIdentity;
|
|
45
|
-
_IdentityAPIClient:
|
|
45
|
+
_IdentityAPIClient: IIdentityApiClient;
|
|
46
46
|
_IntegrationCapture: IntegrationCapture;
|
|
47
47
|
_NativeSdkHelpers: INativeSdkHelpers;
|
|
48
48
|
_PageViewTracker?: PageViewTracker;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Context } from '@mparticle/event-models';
|
|
2
1
|
import { IdentityApiData, MPID, Product, UserIdentities } from '@mparticle/web-sdk';
|
|
3
2
|
import { IForwardingStatsData } from './apiClient';
|
|
4
3
|
import { IntegrationAttributes, ServerSettings, SessionAttributes, LocalSessionAttributes } from './store';
|
|
@@ -22,7 +21,7 @@ export interface IGlobalStoreV2MinifiedKeys {
|
|
|
22
21
|
cgid: string;
|
|
23
22
|
das: string;
|
|
24
23
|
ia: IntegrationAttributes;
|
|
25
|
-
c:
|
|
24
|
+
c: string | null;
|
|
26
25
|
csm: MPID[];
|
|
27
26
|
les: number;
|
|
28
27
|
ssd: number;
|
|
@@ -59,7 +58,7 @@ export interface IPersistence {
|
|
|
59
58
|
getCookieDomain(): string;
|
|
60
59
|
getDomain(doc: Document, locationHostname: string): string;
|
|
61
60
|
saveUserCookieSyncDatesToPersistence(mpid: MPID, csd: CookieSyncDates): void;
|
|
62
|
-
savePersistence(
|
|
61
|
+
savePersistence(persistence: IPersistenceMinified): void;
|
|
63
62
|
getPersistence(): IPersistenceMinified | null;
|
|
64
63
|
getFirstSeenTime(mpid: MPID): number | null;
|
|
65
64
|
setFirstSeenTime(mpid: MPID, time?: number): void;
|
|
@@ -57,6 +57,7 @@ export interface IRoktKit {
|
|
|
57
57
|
setExtensionData<T>(extensionData: IRoktPartnerExtensionData<T>): void;
|
|
58
58
|
use: <T>(name: string) => Promise<T>;
|
|
59
59
|
onShoppableAdsReady(callback: () => void): void;
|
|
60
|
+
terminate?: () => Promise<void>;
|
|
60
61
|
launcherOptions?: Dictionary<any>;
|
|
61
62
|
settings?: IRoktKitSettings;
|
|
62
63
|
integrationName?: string;
|
|
@@ -136,6 +137,23 @@ export default class RoktManager {
|
|
|
136
137
|
hashAttributes(attributes: RoktAttributes): Promise<RoktAttributes>;
|
|
137
138
|
setExtensionData<T>(extensionData: IRoktPartnerExtensionData<T>): void;
|
|
138
139
|
use<T>(name: string): Promise<T>;
|
|
140
|
+
/**
|
|
141
|
+
* Tears down the current Rokt launcher and removes the placements it rendered.
|
|
142
|
+
*
|
|
143
|
+
* Intended for hosts that cannot simply destroy the container element —
|
|
144
|
+
* SPA route changes and confirmation pages, for example.
|
|
145
|
+
*
|
|
146
|
+
* Unlike the other proxied methods, a call made before the kit is ready is
|
|
147
|
+
* *not* queued. Replaying a teardown against a launcher created later would
|
|
148
|
+
* silently tear down placements the caller never asked to remove; with no
|
|
149
|
+
* launcher there is nothing to terminate, so this resolves as a no-op.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* await window.mParticle.Rokt.terminate();
|
|
153
|
+
*
|
|
154
|
+
* @returns {Promise<void>} Resolves once the launcher has torn down. Never rejects.
|
|
155
|
+
*/
|
|
156
|
+
terminate(): Promise<void>;
|
|
139
157
|
onShoppableAdsReady(callback: () => void): void;
|
|
140
158
|
flushOnShoppableAdsReadyMessageQueue(kit: IRoktKit): void;
|
|
141
159
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as EventsApi from '@mparticle/event-models';
|
|
2
2
|
import { DataPlanVersion } from '@mparticle/data-planning-models';
|
|
3
|
-
import { MPConfiguration, MPID, SDKEventOptions, SDKEventAttrs, Callback } from '@mparticle/web-sdk';
|
|
3
|
+
import { MPConfiguration, MPID, SDKEventOptions, SDKEventAttrs, Callback, UserIdentities } from '@mparticle/web-sdk';
|
|
4
4
|
import { IntegrationAttribute, IntegrationAttributes, IStore, WrapperSDKTypes } from './store';
|
|
5
5
|
import Validators from './validators';
|
|
6
6
|
import { Dictionary, valueof } from './utils';
|
|
@@ -272,7 +272,7 @@ export interface SDKHelpersApi {
|
|
|
272
272
|
converted?(s: string): string;
|
|
273
273
|
filterUserIdentitiesForForwarders(userIdentities: Dictionary, filterList: number[]): Dictionary;
|
|
274
274
|
filterUserAttributes(userAttributes: Dictionary, filterList: number[]): Dictionary;
|
|
275
|
-
filterUserIdentities?(userIdentitiesObject: Dictionary<string>, filterList: number[]): ISDKUserIdentity[];
|
|
275
|
+
filterUserIdentities?(userIdentitiesObject: UserIdentities | Dictionary<string>, filterList: number[]): ISDKUserIdentity[];
|
|
276
276
|
invokeAliasCallback(aliasCallback: IAliasCallback, number: number, errorMessage?: string): void;
|
|
277
277
|
isDelayedByIntegration?(delayedIntegrations: Dictionary<boolean>, timeoutStart: number, now: number): boolean;
|
|
278
278
|
isEventType?(type: valueof<typeof EventType>): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Batch
|
|
1
|
+
import { Batch } from '@mparticle/event-models';
|
|
2
2
|
import { MPID, IdentifyRequest, SDKEventCustomFlags, ConsentState, UserIdentities } from '@mparticle/web-sdk';
|
|
3
3
|
import { IKitConfigs } from './configAPIClient';
|
|
4
4
|
import { DataPlanResult, KitBlockerOptions, LogLevelType, SDKDataPlan, SDKEvent, SDKGeoLocation, SDKInitConfig, SDKProduct } from './sdkRuntimeModels';
|
|
@@ -84,6 +84,7 @@ export interface IFeatureFlags {
|
|
|
84
84
|
export interface IStore {
|
|
85
85
|
isEnabled: boolean;
|
|
86
86
|
isInitialized: boolean;
|
|
87
|
+
mpid: MPID;
|
|
87
88
|
sessionAttributes: SessionAttributes;
|
|
88
89
|
localSessionAttributes: LocalSessionAttributes;
|
|
89
90
|
currentSessionMPIDs: MPID[];
|
|
@@ -103,7 +104,7 @@ export interface IStore {
|
|
|
103
104
|
eventQueue: SDKEvent[];
|
|
104
105
|
currencyCode: string | null;
|
|
105
106
|
globalTimer: number | null;
|
|
106
|
-
context:
|
|
107
|
+
context: string | null;
|
|
107
108
|
configurationLoaded: boolean;
|
|
108
109
|
identityCallInFlight: boolean;
|
|
109
110
|
identityCallFailed: boolean;
|
|
@@ -121,7 +122,7 @@ export interface IStore {
|
|
|
121
122
|
activeForwarders: ConfiguredKit[];
|
|
122
123
|
kits: Dictionary<MPForwarder>;
|
|
123
124
|
sideloadedKits: MPForwarder[];
|
|
124
|
-
configuredForwarders:
|
|
125
|
+
configuredForwarders: ConfiguredKit[];
|
|
125
126
|
pixelConfigurations: IPixelConfiguration[];
|
|
126
127
|
integrationDelayTimeoutStart: number;
|
|
127
128
|
webviewBridgeEnabled?: boolean;
|
package/package.json
CHANGED
package/src/configAPIClient.ts
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ProductAction,
|
|
3
|
-
Product,
|
|
4
|
-
Promotion,
|
|
5
|
-
CommerceEvent,
|
|
6
|
-
} from '@mparticle/event-models';
|
|
7
1
|
import {
|
|
8
2
|
SDKEventAttrs,
|
|
9
3
|
SDKEventOptions,
|
|
10
4
|
TransactionAttributes,
|
|
11
5
|
} from '@mparticle/web-sdk';
|
|
12
6
|
import { valueof } from './utils';
|
|
13
|
-
import {
|
|
14
|
-
ProductActionType,
|
|
15
|
-
PromotionActionType,
|
|
16
|
-
} from './types';
|
|
7
|
+
import { ProductActionType, PromotionActionType } from './types';
|
|
17
8
|
import {
|
|
18
9
|
SDKEvent,
|
|
19
10
|
SDKEventCustomFlags,
|
|
@@ -36,7 +27,7 @@ interface IECommerceShared {
|
|
|
36
27
|
couponCode?: string,
|
|
37
28
|
attributes?: SDKEventAttrs
|
|
38
29
|
): SDKProduct | null;
|
|
39
|
-
createImpression(name: string, product:
|
|
30
|
+
createImpression(name: string, product: SDKProduct): SDKImpression | null;
|
|
40
31
|
createPromotion(
|
|
41
32
|
id: string | number,
|
|
42
33
|
creative?: string,
|
|
@@ -51,7 +42,7 @@ interface IECommerceShared {
|
|
|
51
42
|
shipping?: string | number,
|
|
52
43
|
tax?: number
|
|
53
44
|
): TransactionAttributes | null;
|
|
54
|
-
expandCommerceEvent(event:
|
|
45
|
+
expandCommerceEvent(event: SDKEvent): SDKEvent[] | null;
|
|
55
46
|
}
|
|
56
47
|
|
|
57
48
|
export interface SDKCart {
|
|
@@ -84,7 +75,7 @@ export interface SDKECommerceAPI extends IECommerceShared {
|
|
|
84
75
|
): void;
|
|
85
76
|
logPromotion(
|
|
86
77
|
type: valueof<typeof PromotionActionType>,
|
|
87
|
-
promotion: SDKPromotion,
|
|
78
|
+
promotion: SDKPromotion | SDKPromotion[],
|
|
88
79
|
attrs?: SDKEventAttrs,
|
|
89
80
|
customFlags?: SDKEventCustomFlags,
|
|
90
81
|
eventOptions?: SDKEventOptions
|
|
@@ -175,26 +166,26 @@ export interface IECommerce extends IECommerceShared {
|
|
|
175
166
|
customFlags: SDKEventCustomFlags,
|
|
176
167
|
options?: SDKEventOptions
|
|
177
168
|
): SDKEvent | null;
|
|
178
|
-
expandProductAction(commerceEvent:
|
|
179
|
-
expandProductImpression(commerceEvent:
|
|
180
|
-
expandPromotionAction(commerceEvent:
|
|
169
|
+
expandProductAction(commerceEvent: SDKEvent): SDKEvent[];
|
|
170
|
+
expandProductImpression(commerceEvent: SDKEvent): SDKEvent[];
|
|
171
|
+
expandPromotionAction(commerceEvent: SDKEvent): SDKEvent[];
|
|
181
172
|
extractActionAttributes(
|
|
182
173
|
attributes: ExtractedActionAttributes,
|
|
183
|
-
productAction:
|
|
174
|
+
productAction: SDKProductAction
|
|
184
175
|
): void;
|
|
185
176
|
extractProductAttributes(
|
|
186
177
|
attributes: ExtractedProductAttributes,
|
|
187
|
-
product:
|
|
178
|
+
product: SDKProduct
|
|
188
179
|
): void;
|
|
189
180
|
extractPromotionAttributes(
|
|
190
181
|
attributes: ExtractedPromotionAttributes,
|
|
191
|
-
promotion:
|
|
182
|
+
promotion: SDKPromotion
|
|
192
183
|
): void;
|
|
193
184
|
extractTransactionId(
|
|
194
185
|
attributes: ExtractedTransactionId,
|
|
195
|
-
productAction:
|
|
186
|
+
productAction: SDKProductAction
|
|
196
187
|
): void;
|
|
197
|
-
generateExpandedEcommerceName(eventName: string, plusOne
|
|
188
|
+
generateExpandedEcommerceName(eventName: string, plusOne?: boolean): string;
|
|
198
189
|
getProductActionEventName(
|
|
199
190
|
productActionType: valueof<typeof ProductActionType>
|
|
200
191
|
): string;
|