@mparticle/web-sdk 2.68.0 → 2.70.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 +53 -52
- package/dist/mparticle.esm.js +53 -52
- package/dist/mparticle.js +168 -277
- package/dist/types/src/ecommerce.d.ts +1 -1
- package/dist/types/src/forwarders.d.ts +0 -1
- package/dist/types/src/public-types.d.ts +1 -1
- package/dist/types/src/reporting/deprecatedMethodLogger.d.ts +8 -0
- package/dist/types/src/reporting/types.d.ts +1 -0
- package/dist/types/src/sdkRuntimeModels.d.ts +11 -2
- package/dist/types/src/stub/mparticle.stub.d.ts +1 -0
- package/dist/types/src/types.d.ts +47 -2
- package/package.json +1 -1
- package/src/batchUploader.ts +0 -12
- package/src/consent.ts +8 -2
- package/src/ecommerce.js +28 -0
- package/src/events.js +7 -0
- package/src/forwarders.js +0 -58
- package/src/identity.js +77 -33
- package/src/mp-instance.ts +60 -29
- package/src/mparticle-instance-manager.ts +2 -1
- package/src/public-types.ts +2 -0
- package/src/reporting/deprecatedMethodLogger.ts +19 -0
- package/src/reporting/types.ts +1 -0
- package/src/sdkRuntimeModels.ts +10 -0
- package/src/sessionManager.ts +12 -6
- package/src/stub/mparticle.stub.js +1 -0
- package/src/types.ts +75 -0
|
@@ -2,7 +2,7 @@ export default function Ecommerce(mpInstance: any): void;
|
|
|
2
2
|
export default class Ecommerce {
|
|
3
3
|
constructor(mpInstance: any);
|
|
4
4
|
convertTransactionAttributesToProductAction: (transactionAttributes: any, productAction: any) => void;
|
|
5
|
-
getProductActionEventName: (productActionType: any) => "AddToCart" | "AddToWishlist" | "Checkout" | "CheckoutOption" | "Click" | "Purchase" | "Refund" | "RemoveFromCart" | "RemoveFromWishlist" | "ViewDetail" | "Unknown";
|
|
5
|
+
getProductActionEventName: (productActionType: any) => "AddToCart" | "AddToWishlist" | "Checkout" | "CheckoutOption" | "Click" | "Purchase" | "Refund" | "RemoveFromCart" | "RemoveFromWishlist" | "ViewDetail" | "ViewCart" | "AddShippingInfo" | "AddPaymentInfo" | "PaymentMethodSelected" | "PaymentAttempted" | "PaymentSucceeded" | "PaymentFailed" | "RefundInitiated" | "Unknown";
|
|
6
6
|
getPromotionActionEventName: (promotionActionType: any) => "Unknown" | "PromotionClick" | "PromotionView";
|
|
7
7
|
convertProductActionToEventType: (productActionType: any) => 0 | 20 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 21;
|
|
8
8
|
convertPromotionActionToEventType: (promotionActionType: any) => 18 | 19;
|
|
@@ -7,7 +7,6 @@ export default class Forwarders {
|
|
|
7
7
|
isEnabledForUnknownUser: (excludeAnonymousUserBoolean: any, user: any) => boolean;
|
|
8
8
|
applyToForwarders: (functionName: any, functionArgs: any) => void;
|
|
9
9
|
sendEventToForwarders: (event: any) => void;
|
|
10
|
-
sendBatchToForwarders: (batch: any) => void;
|
|
11
10
|
handleForwarderUserAttributes: (functionNameKey: any, key: any, value: any) => void;
|
|
12
11
|
setForwarderUserIdentities: (userIdentities: any) => void;
|
|
13
12
|
setForwarderOnUserIdentified: (user: any) => void;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* natively defined in this SDK and the DT package is deprecated.
|
|
14
14
|
*/
|
|
15
15
|
export type { Batch, } from '@mparticle/event-models';
|
|
16
|
-
export type { EventType, CommerceEventType, IdentityType, ProductActionType, PromotionActionType, MessageType, } from './types';
|
|
16
|
+
export type { EventType, CommerceEventType, IdentityType, ProductActionType, PromotionActionType, MessageType, RoktEventName, RoktEvents, } from './types';
|
|
17
17
|
export type { SDKInitConfig, DataPlanConfig, BaseEvent, SDKEventCustomFlags, LogLevelType, MParticleWebSDK, } from './sdkRuntimeModels';
|
|
18
18
|
export type { IMParticleUser, IdentityCallback, IdentityResult, IdentityResultBody, IdentityModifyResultBody, ISDKUserIdentity, ISDKUserAttributes, } from './identity-user-interfaces';
|
|
19
19
|
export type { SDKIdentityApi, IAliasRequest, IAliasCallback, IAliasResult, SDKIdentityTypeEnum, IIdentitySearchResult, IIdentitySearchResponseBody, IdentitySearchCallback, IUserIdentities } from './identity.interfaces';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ILoggingService } from './types';
|
|
2
|
+
import { SDKLoggerApi } from '../sdkRuntimeModels';
|
|
3
|
+
interface DeprecatedMethodUsage {
|
|
4
|
+
methodName: string;
|
|
5
|
+
warningMessage: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function logDeprecatedMethodUsage(usage: DeprecatedMethodUsage, logger: Pick<SDKLoggerApi, 'warning'>, loggingDispatcher: ILoggingService | undefined): void;
|
|
8
|
+
export {};
|
|
@@ -5,6 +5,7 @@ export declare const ErrorCodes: {
|
|
|
5
5
|
readonly IDENTITY_REQUEST: "IDENTITY_REQUEST";
|
|
6
6
|
readonly IDENTITY_MISMATCH: "IDENTITY_MISMATCH";
|
|
7
7
|
readonly ROKT_KIT_ATTACHED: "ROKT_KIT_ATTACHED";
|
|
8
|
+
readonly MP_DEPRECATED_METHOD_USAGE: "MP_DEPRECATED_METHOD_USAGE";
|
|
8
9
|
};
|
|
9
10
|
export type ErrorCodes = valueof<typeof ErrorCodes>;
|
|
10
11
|
export declare const WSDKErrorSeverity: {
|
|
@@ -11,7 +11,7 @@ import { ISessionManager } from './sessionManager';
|
|
|
11
11
|
import { ConfiguredKit, MPForwarder, UnregisteredKit } from './forwarders.interfaces';
|
|
12
12
|
import { SDKIdentityApi, IAliasCallback } from './identity.interfaces';
|
|
13
13
|
import { ISDKUserAttributeChangeData, ISDKUserIdentityChanges, IMParticleUser, ISDKUserIdentity, IdentityCallback, ISDKUserAttributes } from './identity-user-interfaces';
|
|
14
|
-
import { CommerceEventType, EventType, IdentityType, ProductActionType, PromotionActionType } from './types';
|
|
14
|
+
import { CommerceEventType, EventType, IdentityType, ProductActionType, PromotionActionType, RoktEvents } from './types';
|
|
15
15
|
import { IPixelConfiguration } from './cookieSyncManager';
|
|
16
16
|
import _BatchValidator from './mockBatchCreator';
|
|
17
17
|
import { SDKECommerceAPI } from './ecommerce.interfaces';
|
|
@@ -103,7 +103,15 @@ export declare enum SDKProductActionType {
|
|
|
103
103
|
Purchase = 7,
|
|
104
104
|
Refund = 8,
|
|
105
105
|
AddToWishlist = 9,
|
|
106
|
-
RemoveFromWishlist = 10
|
|
106
|
+
RemoveFromWishlist = 10,
|
|
107
|
+
ViewCart = 11,
|
|
108
|
+
AddShippingInfo = 12,
|
|
109
|
+
AddPaymentInfo = 13,
|
|
110
|
+
PaymentMethodSelected = 14,
|
|
111
|
+
PaymentAttempted = 15,
|
|
112
|
+
PaymentSucceeded = 16,
|
|
113
|
+
PaymentFailed = 17,
|
|
114
|
+
RefundInitiated = 18
|
|
107
115
|
}
|
|
108
116
|
export interface SDKProductAction {
|
|
109
117
|
ProductActionType: SDKProductActionType;
|
|
@@ -137,6 +145,7 @@ export interface MParticleWebSDK {
|
|
|
137
145
|
EventType: typeof EventType;
|
|
138
146
|
PromotionType: typeof PromotionActionType;
|
|
139
147
|
ProductActionType: typeof ProductActionType;
|
|
148
|
+
RoktEvents: typeof RoktEvents;
|
|
140
149
|
Identity: SDKIdentityApi;
|
|
141
150
|
Logger: SDKLoggerApi;
|
|
142
151
|
Consent: SDKConsentApi;
|
|
@@ -29,6 +29,7 @@ declare namespace mParticle {
|
|
|
29
29
|
export let IdentityType: {};
|
|
30
30
|
export let ProductActionType: {};
|
|
31
31
|
export let PromotionType: {};
|
|
32
|
+
export let RoktEvents: {};
|
|
32
33
|
export namespace eCommerce {
|
|
33
34
|
export { returnImpression as createImpression };
|
|
34
35
|
export { returnProduct as createProduct };
|
|
@@ -53,8 +53,31 @@ export declare const ProductActionType: {
|
|
|
53
53
|
Refund: 8;
|
|
54
54
|
AddToWishlist: 9;
|
|
55
55
|
RemoveFromWishlist: 10;
|
|
56
|
+
ViewCart: 11;
|
|
57
|
+
AddShippingInfo: 12;
|
|
58
|
+
AddPaymentInfo: 13;
|
|
59
|
+
PaymentMethodSelected: 14;
|
|
60
|
+
PaymentAttempted: 15;
|
|
61
|
+
PaymentSucceeded: 16;
|
|
62
|
+
PaymentFailed: 17;
|
|
63
|
+
RefundInitiated: 18;
|
|
64
|
+
isRoktCommerceType: (id: number) => boolean;
|
|
56
65
|
getName: (id: number) => string;
|
|
57
|
-
getExpansionName: (id: number) => "add_to_cart" | "remove_from_cart" | "checkout" | "checkout_option" | "click" | "view_detail" | "purchase" | "refund" | "add_to_wishlist" | "remove_from_wishlist" | "unknown";
|
|
66
|
+
getExpansionName: (id: number) => "add_to_cart" | "remove_from_cart" | "checkout" | "checkout_option" | "click" | "view_detail" | "purchase" | "refund" | "add_to_wishlist" | "remove_from_wishlist" | "view_cart" | "add_shipping_info" | "add_payment_info" | "payment_method_selected" | "payment_attempted" | "payment_succeeded" | "payment_failed" | "refund_initiated" | "unknown";
|
|
67
|
+
};
|
|
68
|
+
export type RoktEventName = 'sign_up' | 'subscribe' | 'start_trial' | 'generate_lead' | 'search' | 'upsell' | 'earn_virtual_currency' | 'dwell_time' | 'hover' | 'scroll' | 'click_to_expand' | (string & {});
|
|
69
|
+
export declare const RoktEvents: {
|
|
70
|
+
SignUp: "sign_up";
|
|
71
|
+
Subscribe: "subscribe";
|
|
72
|
+
StartTrial: "start_trial";
|
|
73
|
+
GenerateLead: "generate_lead";
|
|
74
|
+
Search: "search";
|
|
75
|
+
Upsell: "upsell";
|
|
76
|
+
EarnVirtualCurrency: "earn_virtual_currency";
|
|
77
|
+
DwellTime: "dwell_time";
|
|
78
|
+
Hover: "hover";
|
|
79
|
+
Scroll: "scroll";
|
|
80
|
+
ClickToExpand: "click_to_expand";
|
|
58
81
|
};
|
|
59
82
|
export declare const PromotionActionType: {
|
|
60
83
|
Unknown: 0;
|
|
@@ -139,8 +162,17 @@ declare const _default: {
|
|
|
139
162
|
Refund: 8;
|
|
140
163
|
AddToWishlist: 9;
|
|
141
164
|
RemoveFromWishlist: 10;
|
|
165
|
+
ViewCart: 11;
|
|
166
|
+
AddShippingInfo: 12;
|
|
167
|
+
AddPaymentInfo: 13;
|
|
168
|
+
PaymentMethodSelected: 14;
|
|
169
|
+
PaymentAttempted: 15;
|
|
170
|
+
PaymentSucceeded: 16;
|
|
171
|
+
PaymentFailed: 17;
|
|
172
|
+
RefundInitiated: 18;
|
|
173
|
+
isRoktCommerceType: (id: number) => boolean;
|
|
142
174
|
getName: (id: number) => string;
|
|
143
|
-
getExpansionName: (id: number) => "add_to_cart" | "remove_from_cart" | "checkout" | "checkout_option" | "click" | "view_detail" | "purchase" | "refund" | "add_to_wishlist" | "remove_from_wishlist" | "unknown";
|
|
175
|
+
getExpansionName: (id: number) => "add_to_cart" | "remove_from_cart" | "checkout" | "checkout_option" | "click" | "view_detail" | "purchase" | "refund" | "add_to_wishlist" | "remove_from_wishlist" | "view_cart" | "add_shipping_info" | "add_payment_info" | "payment_method_selected" | "payment_attempted" | "payment_succeeded" | "payment_failed" | "refund_initiated" | "unknown";
|
|
144
176
|
};
|
|
145
177
|
readonly PromotionActionType: {
|
|
146
178
|
Unknown: 0;
|
|
@@ -149,6 +181,19 @@ declare const _default: {
|
|
|
149
181
|
getName: (id: number) => string;
|
|
150
182
|
getExpansionName: (id: number) => string;
|
|
151
183
|
};
|
|
184
|
+
readonly RoktEvents: {
|
|
185
|
+
SignUp: "sign_up";
|
|
186
|
+
Subscribe: "subscribe";
|
|
187
|
+
StartTrial: "start_trial";
|
|
188
|
+
GenerateLead: "generate_lead";
|
|
189
|
+
Search: "search";
|
|
190
|
+
Upsell: "upsell";
|
|
191
|
+
EarnVirtualCurrency: "earn_virtual_currency";
|
|
192
|
+
DwellTime: "dwell_time";
|
|
193
|
+
Hover: "hover";
|
|
194
|
+
Scroll: "scroll";
|
|
195
|
+
ClickToExpand: "click_to_expand";
|
|
196
|
+
};
|
|
152
197
|
readonly Environment: {
|
|
153
198
|
readonly Development: "development";
|
|
154
199
|
readonly Production: "production";
|
package/package.json
CHANGED
package/src/batchUploader.ts
CHANGED
|
@@ -368,18 +368,6 @@ export class BatchUploader {
|
|
|
368
368
|
mpInstance
|
|
369
369
|
);
|
|
370
370
|
|
|
371
|
-
if (uploadBatchObject) {
|
|
372
|
-
try {
|
|
373
|
-
mpInstance._Forwarders.sendBatchToForwarders(
|
|
374
|
-
uploadBatchObject
|
|
375
|
-
);
|
|
376
|
-
} catch (e) {
|
|
377
|
-
mpInstance.Logger.error(
|
|
378
|
-
`Error forwarding batch to kits. ${e}`
|
|
379
|
-
);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
371
|
const onCreateBatchCallback =
|
|
384
372
|
mpInstance._Store.SDKConfig.onCreateBatch;
|
|
385
373
|
|
package/src/consent.ts
CHANGED
|
@@ -9,6 +9,7 @@ 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';
|
|
12
13
|
|
|
13
14
|
const { CCPAPurpose } = Constants;
|
|
14
15
|
|
|
@@ -505,8 +506,13 @@ export default function Consent(this: IConsent, mpInstance: IMParticleWebSDKInst
|
|
|
505
506
|
|
|
506
507
|
// TODO: Can we remove this? It is deprecated.
|
|
507
508
|
function removeCCPAState(this: ConsentState) {
|
|
508
|
-
|
|
509
|
-
|
|
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._LoggingDispatcher
|
|
510
516
|
);
|
|
511
517
|
// @ts-ignore
|
|
512
518
|
return removeCCPAConsentState();
|
package/src/ecommerce.js
CHANGED
|
@@ -69,6 +69,22 @@ export default function Ecommerce(mpInstance) {
|
|
|
69
69
|
return 'RemoveFromWishlist';
|
|
70
70
|
case Types.ProductActionType.ViewDetail:
|
|
71
71
|
return 'ViewDetail';
|
|
72
|
+
case Types.ProductActionType.ViewCart:
|
|
73
|
+
return 'ViewCart';
|
|
74
|
+
case Types.ProductActionType.AddShippingInfo:
|
|
75
|
+
return 'AddShippingInfo';
|
|
76
|
+
case Types.ProductActionType.AddPaymentInfo:
|
|
77
|
+
return 'AddPaymentInfo';
|
|
78
|
+
case Types.ProductActionType.PaymentMethodSelected:
|
|
79
|
+
return 'PaymentMethodSelected';
|
|
80
|
+
case Types.ProductActionType.PaymentAttempted:
|
|
81
|
+
return 'PaymentAttempted';
|
|
82
|
+
case Types.ProductActionType.PaymentSucceeded:
|
|
83
|
+
return 'PaymentSucceeded';
|
|
84
|
+
case Types.ProductActionType.PaymentFailed:
|
|
85
|
+
return 'PaymentFailed';
|
|
86
|
+
case Types.ProductActionType.RefundInitiated:
|
|
87
|
+
return 'RefundInitiated';
|
|
72
88
|
case Types.ProductActionType.Unknown:
|
|
73
89
|
default:
|
|
74
90
|
return 'Unknown';
|
|
@@ -113,6 +129,18 @@ export default function Ecommerce(mpInstance) {
|
|
|
113
129
|
|
|
114
130
|
case Types.ProductActionType.ViewDetail:
|
|
115
131
|
return Types.CommerceEventType.ProductViewDetail;
|
|
132
|
+
|
|
133
|
+
// Rokt Brain commerce-adjacent types map to Unknown on server
|
|
134
|
+
case Types.ProductActionType.ViewCart:
|
|
135
|
+
case Types.ProductActionType.AddShippingInfo:
|
|
136
|
+
case Types.ProductActionType.AddPaymentInfo:
|
|
137
|
+
case Types.ProductActionType.PaymentMethodSelected:
|
|
138
|
+
case Types.ProductActionType.PaymentAttempted:
|
|
139
|
+
case Types.ProductActionType.PaymentSucceeded:
|
|
140
|
+
case Types.ProductActionType.PaymentFailed:
|
|
141
|
+
case Types.ProductActionType.RefundInitiated:
|
|
142
|
+
return Types.EventType.Unknown;
|
|
143
|
+
|
|
116
144
|
default:
|
|
117
145
|
mpInstance.Logger.error(
|
|
118
146
|
'Could not convert product action type ' +
|
package/src/events.js
CHANGED
|
@@ -174,6 +174,13 @@ export default function Events(mpInstance) {
|
|
|
174
174
|
ProductList: productList,
|
|
175
175
|
};
|
|
176
176
|
|
|
177
|
+
if (Types.ProductActionType.isRoktCommerceType(productActionType)) {
|
|
178
|
+
event.CustomFlags = event.CustomFlags || {};
|
|
179
|
+
event.CustomFlags[
|
|
180
|
+
'Rokt.CommerceEventType'
|
|
181
|
+
] = Types.ProductActionType.getExpansionName(productActionType);
|
|
182
|
+
}
|
|
183
|
+
|
|
177
184
|
if (mpInstance._Helpers.isObject(transactionAttributes)) {
|
|
178
185
|
mpInstance._Ecommerce.convertTransactionAttributesToProductAction(
|
|
179
186
|
transactionAttributes,
|
package/src/forwarders.js
CHANGED
|
@@ -8,9 +8,6 @@ import {
|
|
|
8
8
|
isBlockedByEventFilter,
|
|
9
9
|
filterEventAttributes,
|
|
10
10
|
filterUserIdentities,
|
|
11
|
-
isBatchEventAllowed,
|
|
12
|
-
filterBatchEventAttributes,
|
|
13
|
-
filterBatchIdentities,
|
|
14
11
|
} from './forwarder-utils';
|
|
15
12
|
|
|
16
13
|
const { Modify, Identify, Login, Logout } = Constants.IdentityMethods;
|
|
@@ -266,61 +263,6 @@ export default function Forwarders(mpInstance, kitBlocker) {
|
|
|
266
263
|
}
|
|
267
264
|
};
|
|
268
265
|
|
|
269
|
-
this.sendBatchToForwarders = function(batch) {
|
|
270
|
-
if (
|
|
271
|
-
mpInstance._Store.webviewBridgeEnabled ||
|
|
272
|
-
!mpInstance._Store.activeForwarders
|
|
273
|
-
) {
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
for (const forwarder of mpInstance._Store.activeForwarders) {
|
|
278
|
-
if (!forwarder.processBatch) {
|
|
279
|
-
continue;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
try {
|
|
283
|
-
const batchCopy = extend(true, {}, batch);
|
|
284
|
-
|
|
285
|
-
if (batchCopy.events) {
|
|
286
|
-
batchCopy.events = batchCopy.events.filter(function(
|
|
287
|
-
batchEvent
|
|
288
|
-
) {
|
|
289
|
-
return isBatchEventAllowed(batchEvent, forwarder);
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
batchCopy.events.forEach(function(batchEvent) {
|
|
293
|
-
filterBatchEventAttributes(batchEvent, forwarder);
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
batchCopy.user_identities = filterBatchIdentities(
|
|
298
|
-
batchCopy.user_identities,
|
|
299
|
-
forwarder.userIdentityFilters
|
|
300
|
-
);
|
|
301
|
-
|
|
302
|
-
if (batchCopy.user_attributes) {
|
|
303
|
-
batchCopy.user_attributes = KitFilterHelper.filterUserAttributes(
|
|
304
|
-
batchCopy.user_attributes,
|
|
305
|
-
forwarder.userAttributeFilters
|
|
306
|
-
);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
if (!batchCopy.events || batchCopy.events.length === 0) {
|
|
310
|
-
continue;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
const result = forwarder.processBatch(batchCopy);
|
|
314
|
-
|
|
315
|
-
if (result) {
|
|
316
|
-
mpInstance.Logger.verbose(result);
|
|
317
|
-
}
|
|
318
|
-
} catch (e) {
|
|
319
|
-
mpInstance.Logger.verbose(e);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
|
|
324
266
|
this.handleForwarderUserAttributes = function(functionNameKey, key, value) {
|
|
325
267
|
if (
|
|
326
268
|
(kitBlocker && kitBlocker.isAttributeKeyBlocked(key)) ||
|
package/src/identity.js
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
} from './utils';
|
|
21
21
|
import { hasMPIDAndUserLoginChanged, hasMPIDChanged } from './user-utils';
|
|
22
22
|
import { processReadyQueue } from './pre-init-utils';
|
|
23
|
+
import { logDeprecatedMethodUsage } from './reporting/deprecatedMethodLogger';
|
|
23
24
|
|
|
24
25
|
export default function Identity(mpInstance) {
|
|
25
26
|
const { getFeatureFlag, extend } = mpInstance._Helpers;
|
|
@@ -1252,8 +1253,14 @@ export default function Identity(mpInstance) {
|
|
|
1252
1253
|
* @return a cart object
|
|
1253
1254
|
*/
|
|
1254
1255
|
getCart: function() {
|
|
1255
|
-
|
|
1256
|
-
|
|
1256
|
+
logDeprecatedMethodUsage(
|
|
1257
|
+
{
|
|
1258
|
+
methodName: 'Identity.getCurrentUser().getCart()',
|
|
1259
|
+
warningMessage:
|
|
1260
|
+
'Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases',
|
|
1261
|
+
},
|
|
1262
|
+
mpInstance.Logger,
|
|
1263
|
+
mpInstance._LoggingDispatcher
|
|
1257
1264
|
);
|
|
1258
1265
|
return self.mParticleUserCart();
|
|
1259
1266
|
},
|
|
@@ -1334,13 +1341,18 @@ export default function Identity(mpInstance) {
|
|
|
1334
1341
|
* @deprecated
|
|
1335
1342
|
*/
|
|
1336
1343
|
add: function() {
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
'Identity.getCurrentUser().getCart().add()',
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
+
logDeprecatedMethodUsage(
|
|
1345
|
+
{
|
|
1346
|
+
methodName: 'Identity.getCurrentUser().getCart().add()',
|
|
1347
|
+
warningMessage: generateDeprecationMessage(
|
|
1348
|
+
'Identity.getCurrentUser().getCart().add()',
|
|
1349
|
+
true,
|
|
1350
|
+
'eCommerce.logProductAction()',
|
|
1351
|
+
'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'
|
|
1352
|
+
),
|
|
1353
|
+
},
|
|
1354
|
+
mpInstance.Logger,
|
|
1355
|
+
mpInstance._LoggingDispatcher
|
|
1344
1356
|
);
|
|
1345
1357
|
},
|
|
1346
1358
|
/**
|
|
@@ -1349,13 +1361,19 @@ export default function Identity(mpInstance) {
|
|
|
1349
1361
|
* @deprecated
|
|
1350
1362
|
*/
|
|
1351
1363
|
remove: function() {
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1364
|
+
logDeprecatedMethodUsage(
|
|
1365
|
+
{
|
|
1366
|
+
methodName:
|
|
1367
|
+
'Identity.getCurrentUser().getCart().remove()',
|
|
1368
|
+
warningMessage: generateDeprecationMessage(
|
|
1369
|
+
'Identity.getCurrentUser().getCart().remove()',
|
|
1370
|
+
true,
|
|
1371
|
+
'eCommerce.logProductAction()',
|
|
1372
|
+
'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'
|
|
1373
|
+
),
|
|
1374
|
+
},
|
|
1375
|
+
mpInstance.Logger,
|
|
1376
|
+
mpInstance._LoggingDispatcher
|
|
1359
1377
|
);
|
|
1360
1378
|
},
|
|
1361
1379
|
/**
|
|
@@ -1364,13 +1382,19 @@ export default function Identity(mpInstance) {
|
|
|
1364
1382
|
* @deprecated
|
|
1365
1383
|
*/
|
|
1366
1384
|
clear: function() {
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1385
|
+
logDeprecatedMethodUsage(
|
|
1386
|
+
{
|
|
1387
|
+
methodName:
|
|
1388
|
+
'Identity.getCurrentUser().getCart().clear()',
|
|
1389
|
+
warningMessage: generateDeprecationMessage(
|
|
1390
|
+
'Identity.getCurrentUser().getCart().clear()',
|
|
1391
|
+
true,
|
|
1392
|
+
'',
|
|
1393
|
+
'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'
|
|
1394
|
+
),
|
|
1395
|
+
},
|
|
1396
|
+
mpInstance.Logger,
|
|
1397
|
+
mpInstance._LoggingDispatcher
|
|
1374
1398
|
);
|
|
1375
1399
|
},
|
|
1376
1400
|
/**
|
|
@@ -1380,13 +1404,19 @@ export default function Identity(mpInstance) {
|
|
|
1380
1404
|
* @deprecated
|
|
1381
1405
|
*/
|
|
1382
1406
|
getCartProducts: function() {
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1407
|
+
logDeprecatedMethodUsage(
|
|
1408
|
+
{
|
|
1409
|
+
methodName:
|
|
1410
|
+
'Identity.getCurrentUser().getCart().getCartProducts()',
|
|
1411
|
+
warningMessage: generateDeprecationMessage(
|
|
1412
|
+
'Identity.getCurrentUser().getCart().getCartProducts()',
|
|
1413
|
+
true,
|
|
1414
|
+
'eCommerce.logProductAction()',
|
|
1415
|
+
'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'
|
|
1416
|
+
),
|
|
1417
|
+
},
|
|
1418
|
+
mpInstance.Logger,
|
|
1419
|
+
mpInstance._LoggingDispatcher
|
|
1390
1420
|
);
|
|
1391
1421
|
return [];
|
|
1392
1422
|
},
|
|
@@ -1540,7 +1570,8 @@ export default function Identity(mpInstance) {
|
|
|
1540
1570
|
prevUser,
|
|
1541
1571
|
newUser,
|
|
1542
1572
|
identityApiData,
|
|
1543
|
-
mpInstance.Logger
|
|
1573
|
+
mpInstance.Logger,
|
|
1574
|
+
mpInstance._LoggingDispatcher
|
|
1544
1575
|
);
|
|
1545
1576
|
|
|
1546
1577
|
const persistence = mpInstance._Persistence.getPersistence();
|
|
@@ -1775,14 +1806,27 @@ export default function Identity(mpInstance) {
|
|
|
1775
1806
|
}
|
|
1776
1807
|
|
|
1777
1808
|
// https://go.mparticle.com/work/SQDSDKS-6359
|
|
1778
|
-
function tryOnUserAlias(
|
|
1809
|
+
function tryOnUserAlias(
|
|
1810
|
+
previousUser,
|
|
1811
|
+
newUser,
|
|
1812
|
+
identityApiData,
|
|
1813
|
+
logger,
|
|
1814
|
+
loggingDispatcher
|
|
1815
|
+
) {
|
|
1779
1816
|
if (
|
|
1780
1817
|
identityApiData &&
|
|
1781
1818
|
identityApiData.onUserAlias &&
|
|
1782
1819
|
isFunction(identityApiData.onUserAlias)
|
|
1783
1820
|
) {
|
|
1784
1821
|
try {
|
|
1785
|
-
|
|
1822
|
+
logDeprecatedMethodUsage(
|
|
1823
|
+
{
|
|
1824
|
+
methodName: 'onUserAlias',
|
|
1825
|
+
warningMessage: generateDeprecationMessage('onUserAlias'),
|
|
1826
|
+
},
|
|
1827
|
+
logger,
|
|
1828
|
+
loggingDispatcher
|
|
1829
|
+
);
|
|
1786
1830
|
identityApiData.onUserAlias(previousUser, newUser);
|
|
1787
1831
|
} catch (e) {
|
|
1788
1832
|
logger.error(
|