@mparticle/web-sdk 2.81.0 → 2.82.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 +15 -84
- package/dist/mparticle.esm.js +15 -84
- package/dist/mparticle.js +6 -268
- package/dist/types/src/consent.d.ts +0 -3
- package/dist/types/src/constants.d.ts +0 -6
- package/dist/types/src/ecommerce.interfaces.d.ts +3 -9
- package/dist/types/src/events.interfaces.d.ts +0 -2
- package/dist/types/src/identity-user-interfaces.d.ts +2 -27
- package/dist/types/src/identity.interfaces.d.ts +1 -5
- package/dist/types/src/internal-types.d.ts +1 -1
- package/dist/types/src/kitBlocking.d.ts +0 -2
- package/dist/types/src/public-types.d.ts +1 -1
- package/dist/types/src/sdkRuntimeModels.d.ts +0 -5
- package/dist/types/src/sdkToEventsApiConverter.d.ts +0 -1
- package/dist/types/src/store.d.ts +0 -1
- package/dist/types/src/stub/mparticle.stub.d.ts +0 -23
- package/package.json +1 -1
- package/src/consent.ts +2 -24
- package/src/constants.ts +0 -6
- package/src/ecommerce.interfaces.ts +2 -33
- package/src/ecommerce.ts +0 -16
- package/src/events.interfaces.ts +0 -17
- package/src/events.ts +1 -74
- package/src/identity-user-interfaces.ts +2 -33
- package/src/identity.interfaces.ts +0 -6
- package/src/identity.ts +0 -115
- package/src/internal-types.ts +0 -1
- package/src/mp-instance.ts +2 -156
- package/src/mparticle-instance-manager.ts +0 -37
- package/src/public-types.ts +0 -1
- package/src/sdkRuntimeModels.ts +0 -6
- package/src/sdkToEventsApiConverter.ts +0 -17
- package/src/serverModel.ts +0 -9
- package/src/store.ts +0 -7
- package/src/stub/mparticle.stub.js +0 -15
|
@@ -52,7 +52,6 @@ export interface SDKEvent {
|
|
|
52
52
|
ProductAction?: SDKProductAction;
|
|
53
53
|
PromotionAction?: SDKPromotionAction;
|
|
54
54
|
ProductImpressions?: SDKProductImpression[];
|
|
55
|
-
ShoppingCart?: SDKShoppingCart;
|
|
56
55
|
UserIdentityChanges?: ISDKUserIdentityChanges;
|
|
57
56
|
UserAttributeChanges?: ISDKUserAttributeChangeData;
|
|
58
57
|
CurrencyCode: string;
|
|
@@ -73,9 +72,6 @@ export interface SDKDataPlan {
|
|
|
73
72
|
PlanVersion?: number | null;
|
|
74
73
|
PlanId?: string | null;
|
|
75
74
|
}
|
|
76
|
-
export interface SDKShoppingCart {
|
|
77
|
-
ProductList?: SDKProduct[];
|
|
78
|
-
}
|
|
79
75
|
export interface SDKPromotionAction {
|
|
80
76
|
PromotionActionType: string;
|
|
81
77
|
PromotionList?: SDKPromotion[];
|
|
@@ -233,7 +229,6 @@ export interface SDKInitConfig extends Omit<MPConfiguration, 'dataPlan' | 'logLe
|
|
|
233
229
|
identityUrl?: string;
|
|
234
230
|
integrationDelayTimeout?: number;
|
|
235
231
|
isIOS?: boolean;
|
|
236
|
-
maxProducts?: number;
|
|
237
232
|
requestConfig?: boolean;
|
|
238
233
|
sessionTimeout?: number;
|
|
239
234
|
useNativeSdk?: boolean;
|
|
@@ -25,7 +25,6 @@ export declare function convertProducts(sdkProducts: SDKProduct[]): EventsApi.Pr
|
|
|
25
25
|
export declare function convertPromotionAction(sdkEvent: SDKEvent): EventsApi.PromotionAction | null;
|
|
26
26
|
export declare function convertPromotions(sdkPromotions: SDKPromotion[]): EventsApi.Promotion[] | null;
|
|
27
27
|
export declare function convertImpressions(sdkEvent: SDKEvent): EventsApi.ProductImpression[] | null;
|
|
28
|
-
export declare function convertShoppingCart(sdkEvent: SDKEvent): EventsApi.ShoppingCart | null;
|
|
29
28
|
export declare function convertCommerceEvent(sdkEvent: SDKEvent): EventsApi.CommerceEvent;
|
|
30
29
|
export declare function convertCrashReportEvent(sdkEvent: SDKEvent): EventsApi.CrashReportEvent;
|
|
31
30
|
export declare function convertAST(sdkEvent: SDKEvent): EventsApi.ApplicationStateTransitionEvent;
|
|
@@ -35,14 +35,11 @@ declare namespace mParticle {
|
|
|
35
35
|
export { returnProduct as createProduct };
|
|
36
36
|
export { returnPromotion as createPromotion };
|
|
37
37
|
export { returnTransactionAttributes as createTransactionAttributes };
|
|
38
|
-
export { voidFunction as logCheckout };
|
|
39
38
|
export { voidFunction as logImpression };
|
|
40
39
|
export { voidFunction as logProductAction };
|
|
41
40
|
export { voidFunction as logPromotion };
|
|
42
41
|
export { voidFunction as logPurchase };
|
|
43
|
-
export { voidFunction as logRefund };
|
|
44
42
|
export { voidFunction as setCurrencyCode };
|
|
45
|
-
export let Cart: any;
|
|
46
43
|
}
|
|
47
44
|
export namespace Consent {
|
|
48
45
|
export { createConsentState };
|
|
@@ -140,7 +137,6 @@ declare function returnUser(): {
|
|
|
140
137
|
removeAllUserAttributes: typeof voidFunction;
|
|
141
138
|
getUserAttributesLists: typeof returnObject;
|
|
142
139
|
getAllUserAttributes: typeof returnObject;
|
|
143
|
-
getCart: typeof Cart;
|
|
144
140
|
getConsentState: typeof createConsentState;
|
|
145
141
|
setConsentState: typeof voidFunction;
|
|
146
142
|
};
|
|
@@ -158,27 +154,8 @@ declare function returnUsers(): {
|
|
|
158
154
|
removeAllUserAttributes: typeof voidFunction;
|
|
159
155
|
getUserAttributesLists: typeof returnObject;
|
|
160
156
|
getAllUserAttributes: typeof returnObject;
|
|
161
|
-
getCart: typeof Cart;
|
|
162
157
|
getConsentState: typeof createConsentState;
|
|
163
158
|
setConsentState: typeof voidFunction;
|
|
164
159
|
}[];
|
|
165
160
|
declare function returnThis(): any;
|
|
166
161
|
declare function returnObject(): {};
|
|
167
|
-
declare function Cart_1(): {
|
|
168
|
-
add: typeof voidFunction;
|
|
169
|
-
clear: typeof voidFunction;
|
|
170
|
-
remove: typeof voidFunction;
|
|
171
|
-
getCartProducts: () => {
|
|
172
|
-
Name: string;
|
|
173
|
-
Sku: string;
|
|
174
|
-
Price: number;
|
|
175
|
-
Quantity: number;
|
|
176
|
-
Brand: string;
|
|
177
|
-
Variant: string;
|
|
178
|
-
Category: string;
|
|
179
|
-
Position: string;
|
|
180
|
-
CouponCode: string;
|
|
181
|
-
TotalAmount: number;
|
|
182
|
-
Attributes: {};
|
|
183
|
-
}[];
|
|
184
|
-
};
|
package/package.json
CHANGED
package/src/consent.ts
CHANGED
|
@@ -9,7 +9,6 @@ import KitFilterHelper from './kitFilterHelper';
|
|
|
9
9
|
import Constants from './constants';
|
|
10
10
|
import { IMParticleUser } from './identity-user-interfaces';
|
|
11
11
|
import { IMParticleWebSDKInstance } from './mp-instance';
|
|
12
|
-
import { logDeprecatedMethodUsage } from './reporting/deprecatedMethodLogger';
|
|
13
12
|
|
|
14
13
|
const { CCPAPurpose } = Constants;
|
|
15
14
|
|
|
@@ -98,11 +97,6 @@ export interface IConsentRules {
|
|
|
98
97
|
values: IConsentRulesValues[];
|
|
99
98
|
}
|
|
100
99
|
|
|
101
|
-
// TODO: Remove this if we can safely deprecate `removeCCPAState`
|
|
102
|
-
export interface IConsentState extends ConsentState {
|
|
103
|
-
removeCCPAState: () => ConsentState;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
100
|
// Represents Actual Interface for Consent Module
|
|
107
101
|
// TODO: Should eventually consolidate with SDKConsentStateApi
|
|
108
102
|
export interface IConsent {
|
|
@@ -326,7 +320,7 @@ export default function Consent(this: IConsent, mpInstance: IMParticleWebSDKInst
|
|
|
326
320
|
this.createConsentState = function(
|
|
327
321
|
this: ConsentState,
|
|
328
322
|
consentState?: ConsentState
|
|
329
|
-
):
|
|
323
|
+
): ConsentState {
|
|
330
324
|
let gdpr = {};
|
|
331
325
|
let ccpa = {};
|
|
332
326
|
|
|
@@ -339,8 +333,7 @@ export default function Consent(this: IConsent, mpInstance: IMParticleWebSDKInst
|
|
|
339
333
|
consentState.getCCPAConsentState()
|
|
340
334
|
);
|
|
341
335
|
|
|
342
|
-
|
|
343
|
-
return consentStateCopy as IConsentState;
|
|
336
|
+
return consentStateCopy;
|
|
344
337
|
}
|
|
345
338
|
|
|
346
339
|
function canonicalizeForDeduplication(purpose: string): string {
|
|
@@ -504,20 +497,6 @@ export default function Consent(this: IConsent, mpInstance: IMParticleWebSDKInst
|
|
|
504
497
|
return this;
|
|
505
498
|
}
|
|
506
499
|
|
|
507
|
-
// TODO: Can we remove this? It is deprecated.
|
|
508
|
-
function removeCCPAState(this: ConsentState) {
|
|
509
|
-
logDeprecatedMethodUsage(
|
|
510
|
-
{
|
|
511
|
-
methodName: 'Consent.removeCCPAState',
|
|
512
|
-
warningMessage: 'removeCCPAState is deprecated and will be removed in a future release; use removeCCPAConsentState instead',
|
|
513
|
-
},
|
|
514
|
-
mpInstance.Logger,
|
|
515
|
-
mpInstance._ErrorReportingDispatcher
|
|
516
|
-
);
|
|
517
|
-
// @ts-ignore
|
|
518
|
-
return removeCCPAConsentState();
|
|
519
|
-
}
|
|
520
|
-
|
|
521
500
|
return {
|
|
522
501
|
setGDPRConsentState,
|
|
523
502
|
addGDPRConsentState,
|
|
@@ -525,7 +504,6 @@ export default function Consent(this: IConsent, mpInstance: IMParticleWebSDKInst
|
|
|
525
504
|
getCCPAConsentState,
|
|
526
505
|
getGDPRConsentState,
|
|
527
506
|
removeGDPRConsentState,
|
|
528
|
-
removeCCPAState, // TODO: Can we remove? This is deprecated
|
|
529
507
|
removeCCPAConsentState,
|
|
530
508
|
};
|
|
531
509
|
};
|
package/src/constants.ts
CHANGED
|
@@ -91,9 +91,6 @@ const Constants = {
|
|
|
91
91
|
SetUserAttribute: 'setUserAttribute',
|
|
92
92
|
RemoveUserAttribute: 'removeUserAttribute',
|
|
93
93
|
SetSessionAttribute: 'setSessionAttribute',
|
|
94
|
-
AddToCart: 'addToCart',
|
|
95
|
-
RemoveFromCart: 'removeFromCart',
|
|
96
|
-
ClearCart: 'clearCart',
|
|
97
94
|
LogOut: 'logOut',
|
|
98
95
|
SetUserAttributeList: 'setUserAttributeList',
|
|
99
96
|
RemoveAllUserAttributes: 'removeAllUserAttributes',
|
|
@@ -113,10 +110,8 @@ const Constants = {
|
|
|
113
110
|
cookieNameV2: 'mprtcl-v2', // v2 Name of the cookie stored on the user's machine. Removed keys with no values, moved cartProducts and productBags to localStorage.
|
|
114
111
|
cookieNameV3: 'mprtcl-v3', // v3 Name of the cookie stored on the user's machine. Base64 encoded keys in Base64CookieKeys object, final version on SDKv1
|
|
115
112
|
localStorageNameV4: 'mprtcl-v4', // v4 Name of the mP localstorage, Current Version
|
|
116
|
-
localStorageProductsV4: 'mprtcl-prodv4', // The name for mP localstorage that contains products for cartProducs and productBags
|
|
117
113
|
cookieNameV4: 'mprtcl-v4', // v4 Name of the cookie stored on the user's machine. Base64 encoded keys in Base64CookieKeys object, current version on SDK v2
|
|
118
114
|
currentStorageName: 'mprtcl-v4',
|
|
119
|
-
currentStorageProductsName: 'mprtcl-prodv4',
|
|
120
115
|
},
|
|
121
116
|
DefaultConfig: {
|
|
122
117
|
cookieDomain: null, // If null, defaults to current location.host
|
|
@@ -124,7 +119,6 @@ const Constants = {
|
|
|
124
119
|
logLevel: null, // What logging will be provided in the console
|
|
125
120
|
timeout: 300, // timeout in milliseconds for logging functions
|
|
126
121
|
sessionTimeout: 30, // Session timeout in minutes
|
|
127
|
-
maxProducts: 20, // Number of products persisted in cartProducts and productBags
|
|
128
122
|
forwarderStatsTimeout: 5000, // Milliseconds for forwarderStats timeout
|
|
129
123
|
integrationDelayTimeout: 5000, // Milliseconds for forcing the integration delay to un-suspend event queueing due to integration partner errors
|
|
130
124
|
maxCookieSize: 3000, // Number of bytes for cookie size to not exceed
|
|
@@ -45,20 +45,9 @@ interface IECommerceShared {
|
|
|
45
45
|
expandCommerceEvent(event: SDKEvent): SDKEvent[] | null;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
export interface SDKCart {
|
|
49
|
-
add(product: SDKProduct | SDKProduct[], logEvent?: boolean): void;
|
|
50
|
-
remove(product: SDKProduct | SDKProduct[], logEvent?: boolean): void;
|
|
51
|
-
clear(): void;
|
|
52
|
-
}
|
|
53
48
|
|
|
54
49
|
// Used for the public `eCommerce` namespace
|
|
55
50
|
export interface SDKECommerceAPI extends IECommerceShared {
|
|
56
|
-
logCheckout(
|
|
57
|
-
step: number,
|
|
58
|
-
option?: string,
|
|
59
|
-
attrs?: SDKEventAttrs,
|
|
60
|
-
customFlags?: SDKEventCustomFlags
|
|
61
|
-
): void;
|
|
62
51
|
logImpression(
|
|
63
52
|
impression: SDKImpression | SDKImpression[],
|
|
64
53
|
attrs?: SDKEventAttrs,
|
|
@@ -82,13 +71,8 @@ export interface SDKECommerceAPI extends IECommerceShared {
|
|
|
82
71
|
): void;
|
|
83
72
|
setCurrencyCode(code: string): void;
|
|
84
73
|
|
|
85
|
-
|
|
86
|
-
* @deprecated
|
|
87
|
-
*/
|
|
88
|
-
Cart: SDKCart;
|
|
89
|
-
|
|
90
|
-
/*
|
|
91
|
-
* @deprecated
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated Use `logProductAction` with `ProductActionType.Purchase` instead.
|
|
92
76
|
*/
|
|
93
77
|
logPurchase(
|
|
94
78
|
transactionAttributes: TransactionAttributes,
|
|
@@ -97,17 +81,6 @@ export interface SDKECommerceAPI extends IECommerceShared {
|
|
|
97
81
|
attrs?: SDKEventAttrs,
|
|
98
82
|
customFlags?: SDKEventCustomFlags
|
|
99
83
|
): void;
|
|
100
|
-
|
|
101
|
-
/*
|
|
102
|
-
* @deprecated
|
|
103
|
-
*/
|
|
104
|
-
logRefund(
|
|
105
|
-
transactionAttributes: TransactionAttributes,
|
|
106
|
-
product: SDKProduct | SDKProduct[],
|
|
107
|
-
clearCart?: boolean,
|
|
108
|
-
attrs?: SDKEventAttrs,
|
|
109
|
-
customFlags?: SDKEventCustomFlags
|
|
110
|
-
): void;
|
|
111
84
|
}
|
|
112
85
|
|
|
113
86
|
interface ExtractedActionAttributes {
|
|
@@ -144,10 +117,6 @@ interface ExtractedTransactionId {
|
|
|
144
117
|
|
|
145
118
|
// Used for the private `_Ecommerce` namespace
|
|
146
119
|
export interface IECommerce extends IECommerceShared {
|
|
147
|
-
buildProductList(
|
|
148
|
-
event: SDKEvent,
|
|
149
|
-
product: SDKProduct | SDKProduct[]
|
|
150
|
-
): SDKProduct[];
|
|
151
120
|
convertProductActionToEventType(
|
|
152
121
|
productActionType: valueof<typeof ProductActionType>
|
|
153
122
|
): // https://go.mparticle.com/work/SQDSDKS-4801
|
package/src/ecommerce.ts
CHANGED
|
@@ -337,21 +337,6 @@ export default function Ecommerce(
|
|
|
337
337
|
}
|
|
338
338
|
};
|
|
339
339
|
|
|
340
|
-
this.buildProductList = function(
|
|
341
|
-
event: SDKEvent,
|
|
342
|
-
product: SDKProduct | SDKProduct[]
|
|
343
|
-
): SDKProduct[] {
|
|
344
|
-
if (product) {
|
|
345
|
-
if (Array.isArray(product)) {
|
|
346
|
-
return product;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
return [product];
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
return event.ShoppingCart.ProductList;
|
|
353
|
-
};
|
|
354
|
-
|
|
355
340
|
this.createProduct = function(
|
|
356
341
|
name: string,
|
|
357
342
|
sku: string | number,
|
|
@@ -665,7 +650,6 @@ export default function Ecommerce(
|
|
|
665
650
|
baseEvent.EventName = 'eCommerce - ';
|
|
666
651
|
|
|
667
652
|
baseEvent.CurrencyCode = mpInstance._Store.currencyCode;
|
|
668
|
-
baseEvent.ShoppingCart = [];
|
|
669
653
|
baseEvent.CustomFlags = extend(baseEvent.CustomFlags, customFlags);
|
|
670
654
|
|
|
671
655
|
return baseEvent;
|
package/src/events.interfaces.ts
CHANGED
|
@@ -27,17 +27,6 @@ export interface IEvents {
|
|
|
27
27
|
eventType: valueof<typeof EventType>
|
|
28
28
|
): void;
|
|
29
29
|
logAST(): void;
|
|
30
|
-
logCheckoutEvent(
|
|
31
|
-
step: number,
|
|
32
|
-
|
|
33
|
-
// User options specified during the checkout process
|
|
34
|
-
// e.g., FedEx, DHL, UPS for delivery options;
|
|
35
|
-
// Visa, MasterCard, AmEx for payment options.
|
|
36
|
-
option?: string,
|
|
37
|
-
|
|
38
|
-
attrs?: SDKEventAttrs,
|
|
39
|
-
customFlags?: SDKEventCustomFlags
|
|
40
|
-
): void;
|
|
41
30
|
logCommerceEvent(
|
|
42
31
|
commerceEvent: SDKEvent,
|
|
43
32
|
attrs?: SDKEventAttrs,
|
|
@@ -73,12 +62,6 @@ export interface IEvents {
|
|
|
73
62
|
attrs?: SDKEventAttrs,
|
|
74
63
|
customFlags?: SDKEventCustomFlags
|
|
75
64
|
): void;
|
|
76
|
-
logRefundEvent(
|
|
77
|
-
transactionAttributes: TransactionAttributes,
|
|
78
|
-
product: SDKProduct | SDKProduct[],
|
|
79
|
-
attrs?: SDKEventAttrs,
|
|
80
|
-
customFlags?: SDKEventCustomFlags
|
|
81
|
-
): void;
|
|
82
65
|
startTracking(callback: Callback): void;
|
|
83
66
|
stopTracking(): void;
|
|
84
67
|
}
|
package/src/events.ts
CHANGED
|
@@ -164,33 +164,6 @@ export default function Events(
|
|
|
164
164
|
});
|
|
165
165
|
};
|
|
166
166
|
|
|
167
|
-
this.logCheckoutEvent = function(
|
|
168
|
-
step: number,
|
|
169
|
-
option?: string,
|
|
170
|
-
attrs?: SDKEventAttrs,
|
|
171
|
-
customFlags?: SDKEventCustomFlags
|
|
172
|
-
): void {
|
|
173
|
-
const event = mpInstance._Ecommerce.createCommerceEventObject(
|
|
174
|
-
customFlags
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
if (event) {
|
|
178
|
-
event.EventName += mpInstance._Ecommerce.getProductActionEventName(
|
|
179
|
-
Types.ProductActionType.Checkout
|
|
180
|
-
);
|
|
181
|
-
event.EventCategory = Types.CommerceEventType.ProductCheckout;
|
|
182
|
-
event.ProductAction = {
|
|
183
|
-
ProductActionType: Types.ProductActionType
|
|
184
|
-
.Checkout as SDKProductActionType,
|
|
185
|
-
CheckoutStep: step,
|
|
186
|
-
CheckoutOptions: option,
|
|
187
|
-
ProductList: [],
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
self.logCommerceEvent(event, attrs);
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
|
|
194
167
|
this.logProductActionEvent = function(
|
|
195
168
|
productActionType: valueof<typeof ProductActionType>,
|
|
196
169
|
product: SDKProduct | SDKProduct[],
|
|
@@ -287,49 +260,8 @@ export default function Events(
|
|
|
287
260
|
event.ProductAction = {
|
|
288
261
|
ProductActionType: Types.ProductActionType
|
|
289
262
|
.Purchase as SDKProductActionType,
|
|
263
|
+
ProductList: Array.isArray(product) ? product : [product],
|
|
290
264
|
};
|
|
291
|
-
event.ProductAction.ProductList = mpInstance._Ecommerce.buildProductList(
|
|
292
|
-
event,
|
|
293
|
-
product
|
|
294
|
-
);
|
|
295
|
-
|
|
296
|
-
mpInstance._Ecommerce.convertTransactionAttributesToProductAction(
|
|
297
|
-
transactionAttributes,
|
|
298
|
-
event.ProductAction
|
|
299
|
-
);
|
|
300
|
-
|
|
301
|
-
self.logCommerceEvent(event, attrs);
|
|
302
|
-
}
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
this.logRefundEvent = function(
|
|
306
|
-
transactionAttributes: TransactionAttributes,
|
|
307
|
-
product: SDKProduct | SDKProduct[],
|
|
308
|
-
attrs?: SDKEventAttrs,
|
|
309
|
-
customFlags?: SDKEventCustomFlags
|
|
310
|
-
): void {
|
|
311
|
-
if (!transactionAttributes) {
|
|
312
|
-
mpInstance.Logger.error(Messages.ErrorMessages.TransactionRequired);
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
const event = mpInstance._Ecommerce.createCommerceEventObject(
|
|
317
|
-
customFlags
|
|
318
|
-
);
|
|
319
|
-
|
|
320
|
-
if (event) {
|
|
321
|
-
event.EventName += mpInstance._Ecommerce.getProductActionEventName(
|
|
322
|
-
Types.ProductActionType.Refund
|
|
323
|
-
);
|
|
324
|
-
event.EventCategory = Types.CommerceEventType.ProductRefund;
|
|
325
|
-
event.ProductAction = {
|
|
326
|
-
ProductActionType: Types.ProductActionType
|
|
327
|
-
.Refund as SDKProductActionType,
|
|
328
|
-
};
|
|
329
|
-
event.ProductAction.ProductList = mpInstance._Ecommerce.buildProductList(
|
|
330
|
-
event,
|
|
331
|
-
product
|
|
332
|
-
);
|
|
333
265
|
|
|
334
266
|
mpInstance._Ecommerce.convertTransactionAttributesToProductAction(
|
|
335
267
|
transactionAttributes,
|
|
@@ -430,11 +362,6 @@ export default function Events(
|
|
|
430
362
|
);
|
|
431
363
|
|
|
432
364
|
if (mpInstance._Helpers.canLog()) {
|
|
433
|
-
if (mpInstance._Store.webviewBridgeEnabled) {
|
|
434
|
-
// Don't send shopping cart to parent sdks
|
|
435
|
-
commerceEvent.ShoppingCart = {};
|
|
436
|
-
}
|
|
437
|
-
|
|
438
365
|
if (sanitizedAttrs) {
|
|
439
366
|
commerceEvent.EventAttributes = sanitizedAttrs;
|
|
440
367
|
}
|
|
@@ -1,42 +1,18 @@
|
|
|
1
1
|
import { AllUserAttributes, MPID, User } from '@mparticle/web-sdk';
|
|
2
2
|
import { SDKIdentityTypeEnum } from './identity.interfaces';
|
|
3
3
|
import { MessageType } from './types';
|
|
4
|
-
import { BaseEvent
|
|
4
|
+
import { BaseEvent } from './sdkRuntimeModels';
|
|
5
5
|
import Constants from './constants';
|
|
6
6
|
const { HTTPCodes } = Constants;
|
|
7
7
|
|
|
8
|
-
// Cart is Deprecated and private to mParticle user in @mparticle/web-sdk
|
|
9
|
-
// but we need to expose it here for type safety in some of our tests
|
|
10
|
-
interface ICart {
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated Cart persistence in mParticle has been deprecated. Please use mParticle.eCommerce.logProductAction(mParticle.ProductActionType.AddToCart, [products])
|
|
13
|
-
*/
|
|
14
|
-
add: (product: SDKProduct, logEventBoolean?: boolean) => void;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Cart persistence in mParticle has been deprecated. Please use mParticle.eCommerce.logProductAction(mParticle.ProductActionType.RemoveFromCart, [products])
|
|
17
|
-
*/
|
|
18
|
-
remove: (product: SDKProduct, logEventBoolean?: boolean) => void;
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated Cart persistence in mParticle has been deprecated.
|
|
21
|
-
*/
|
|
22
|
-
clear: () => void;
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated Cart Products have been deprecated
|
|
25
|
-
*/
|
|
26
|
-
getCartProducts: () => SDKProduct[];
|
|
27
|
-
}
|
|
28
8
|
|
|
29
9
|
// https://go.mparticle.com/work/SQDSDKS-5033
|
|
30
10
|
// https://go.mparticle.com/work/SQDSDKS-6354
|
|
31
|
-
export interface IMParticleUser extends User {
|
|
11
|
+
export interface IMParticleUser extends Omit<User, 'getCart'> {
|
|
32
12
|
getAllUserAttributes(): any;
|
|
33
13
|
setUserTag(tagName: string, value?: any): void;
|
|
34
14
|
setUserAttribute(key: string, value: any): void;
|
|
35
15
|
getUserAudiences?(callback?: IdentityCallback): void;
|
|
36
|
-
/*
|
|
37
|
-
* @deprecated
|
|
38
|
-
*/
|
|
39
|
-
getCart(): ICart;
|
|
40
16
|
}
|
|
41
17
|
|
|
42
18
|
export interface ISDKUserIdentity {
|
|
@@ -114,12 +90,5 @@ export interface IdentityModifyResultBody {
|
|
|
114
90
|
};
|
|
115
91
|
}
|
|
116
92
|
|
|
117
|
-
export interface mParticleUserCart {
|
|
118
|
-
add(): void;
|
|
119
|
-
remove(): void;
|
|
120
|
-
clear(): void;
|
|
121
|
-
getCartProducts(): SDKProduct[];
|
|
122
|
-
}
|
|
123
|
-
|
|
124
93
|
// https://go.mparticle.com/work/SQDSDKS-5196
|
|
125
94
|
export type UserAttributes = AllUserAttributes;
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
IUserAttributeChangeEvent,
|
|
10
10
|
IUserIdentityChangeEvent,
|
|
11
11
|
IMParticleUser,
|
|
12
|
-
mParticleUserCart,
|
|
13
12
|
IIdentityResponse,
|
|
14
13
|
} from './identity-user-interfaces';
|
|
15
14
|
import { IdentitySearchCallback } from './identity/search';
|
|
@@ -295,9 +294,4 @@ export interface IIdentity {
|
|
|
295
294
|
user: IMParticleUser,
|
|
296
295
|
method: IdentityAPIMethod
|
|
297
296
|
): void;
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* @deprecated
|
|
301
|
-
*/
|
|
302
|
-
mParticleUserCart(): mParticleUserCart;
|
|
303
297
|
}
|
package/src/identity.ts
CHANGED
|
@@ -27,7 +27,6 @@ import {
|
|
|
27
27
|
IdentityCallback,
|
|
28
28
|
IIdentityResponse,
|
|
29
29
|
IMParticleUser,
|
|
30
|
-
mParticleUserCart,
|
|
31
30
|
} from './identity-user-interfaces';
|
|
32
31
|
import {
|
|
33
32
|
IIdentity,
|
|
@@ -1283,24 +1282,6 @@ export default function Identity(
|
|
|
1283
1282
|
|
|
1284
1283
|
return userAttributesCopy;
|
|
1285
1284
|
},
|
|
1286
|
-
/**
|
|
1287
|
-
* Returns the cart object for the current user
|
|
1288
|
-
* @method getCart
|
|
1289
|
-
* @return a cart object
|
|
1290
|
-
*/
|
|
1291
|
-
getCart: function() {
|
|
1292
|
-
logDeprecatedMethodUsage(
|
|
1293
|
-
{
|
|
1294
|
-
methodName: 'Identity.getCurrentUser().getCart()',
|
|
1295
|
-
warningMessage:
|
|
1296
|
-
'Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases',
|
|
1297
|
-
},
|
|
1298
|
-
mpInstance.Logger,
|
|
1299
|
-
mpInstance._ErrorReportingDispatcher
|
|
1300
|
-
);
|
|
1301
|
-
return self.mParticleUserCart();
|
|
1302
|
-
},
|
|
1303
|
-
|
|
1304
1285
|
/**
|
|
1305
1286
|
* Returns the Consent State stored locally for this user.
|
|
1306
1287
|
* @method getConsentState
|
|
@@ -1365,102 +1346,6 @@ export default function Identity(
|
|
|
1365
1346
|
};
|
|
1366
1347
|
};
|
|
1367
1348
|
|
|
1368
|
-
/**
|
|
1369
|
-
* Invoke these methods on the mParticle.Identity.getCurrentUser().getCart() object.
|
|
1370
|
-
* Example: mParticle.Identity.getCurrentUser().getCart().add(...);
|
|
1371
|
-
* @class mParticle.Identity.getCurrentUser().getCart()
|
|
1372
|
-
* @deprecated
|
|
1373
|
-
*/
|
|
1374
|
-
this.mParticleUserCart = function(): mParticleUserCart {
|
|
1375
|
-
return {
|
|
1376
|
-
/**
|
|
1377
|
-
* Adds a cart product to the user cart
|
|
1378
|
-
* @method add
|
|
1379
|
-
* @deprecated
|
|
1380
|
-
*/
|
|
1381
|
-
add: function() {
|
|
1382
|
-
logDeprecatedMethodUsage(
|
|
1383
|
-
{
|
|
1384
|
-
methodName: 'Identity.getCurrentUser().getCart().add()',
|
|
1385
|
-
warningMessage: generateDeprecationMessage(
|
|
1386
|
-
'Identity.getCurrentUser().getCart().add()',
|
|
1387
|
-
true,
|
|
1388
|
-
'eCommerce.logProductAction()',
|
|
1389
|
-
'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'
|
|
1390
|
-
),
|
|
1391
|
-
},
|
|
1392
|
-
mpInstance.Logger,
|
|
1393
|
-
mpInstance._ErrorReportingDispatcher
|
|
1394
|
-
);
|
|
1395
|
-
},
|
|
1396
|
-
/**
|
|
1397
|
-
* Removes a cart product from the current user cart
|
|
1398
|
-
* @method remove
|
|
1399
|
-
* @deprecated
|
|
1400
|
-
*/
|
|
1401
|
-
remove: function() {
|
|
1402
|
-
logDeprecatedMethodUsage(
|
|
1403
|
-
{
|
|
1404
|
-
methodName:
|
|
1405
|
-
'Identity.getCurrentUser().getCart().remove()',
|
|
1406
|
-
warningMessage: generateDeprecationMessage(
|
|
1407
|
-
'Identity.getCurrentUser().getCart().remove()',
|
|
1408
|
-
true,
|
|
1409
|
-
'eCommerce.logProductAction()',
|
|
1410
|
-
'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'
|
|
1411
|
-
),
|
|
1412
|
-
},
|
|
1413
|
-
mpInstance.Logger,
|
|
1414
|
-
mpInstance._ErrorReportingDispatcher
|
|
1415
|
-
);
|
|
1416
|
-
},
|
|
1417
|
-
/**
|
|
1418
|
-
* Clears the user's cart
|
|
1419
|
-
* @method clear
|
|
1420
|
-
* @deprecated
|
|
1421
|
-
*/
|
|
1422
|
-
clear: function() {
|
|
1423
|
-
logDeprecatedMethodUsage(
|
|
1424
|
-
{
|
|
1425
|
-
methodName:
|
|
1426
|
-
'Identity.getCurrentUser().getCart().clear()',
|
|
1427
|
-
warningMessage: generateDeprecationMessage(
|
|
1428
|
-
'Identity.getCurrentUser().getCart().clear()',
|
|
1429
|
-
true,
|
|
1430
|
-
'',
|
|
1431
|
-
'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'
|
|
1432
|
-
),
|
|
1433
|
-
},
|
|
1434
|
-
mpInstance.Logger,
|
|
1435
|
-
mpInstance._ErrorReportingDispatcher
|
|
1436
|
-
);
|
|
1437
|
-
},
|
|
1438
|
-
/**
|
|
1439
|
-
* Returns all cart products
|
|
1440
|
-
* @method getCartProducts
|
|
1441
|
-
* @return {Array} array of cart products
|
|
1442
|
-
* @deprecated
|
|
1443
|
-
*/
|
|
1444
|
-
getCartProducts: function() {
|
|
1445
|
-
logDeprecatedMethodUsage(
|
|
1446
|
-
{
|
|
1447
|
-
methodName:
|
|
1448
|
-
'Identity.getCurrentUser().getCart().getCartProducts()',
|
|
1449
|
-
warningMessage: generateDeprecationMessage(
|
|
1450
|
-
'Identity.getCurrentUser().getCart().getCartProducts()',
|
|
1451
|
-
true,
|
|
1452
|
-
'eCommerce.logProductAction()',
|
|
1453
|
-
'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'
|
|
1454
|
-
),
|
|
1455
|
-
},
|
|
1456
|
-
mpInstance.Logger,
|
|
1457
|
-
mpInstance._ErrorReportingDispatcher
|
|
1458
|
-
);
|
|
1459
|
-
return [];
|
|
1460
|
-
},
|
|
1461
|
-
};
|
|
1462
|
-
};
|
|
1463
|
-
|
|
1464
1349
|
// https://go.mparticle.com/work/SQDSDKS-6355
|
|
1465
1350
|
this.parseIdentityResponse = function(
|
|
1466
1351
|
identityResponse: IIdentityResponse,
|