@mparticle/web-sdk 2.80.1 → 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.
Files changed (37) hide show
  1. package/dist/mparticle.common.js +16 -85
  2. package/dist/mparticle.esm.js +16 -85
  3. package/dist/mparticle.js +60 -271
  4. package/dist/types/src/consent.d.ts +0 -3
  5. package/dist/types/src/constants.d.ts +0 -6
  6. package/dist/types/src/ecommerce.interfaces.d.ts +3 -9
  7. package/dist/types/src/events.interfaces.d.ts +0 -2
  8. package/dist/types/src/identity-user-interfaces.d.ts +2 -27
  9. package/dist/types/src/identity.interfaces.d.ts +1 -5
  10. package/dist/types/src/internal-types.d.ts +1 -1
  11. package/dist/types/src/kitBlocking.d.ts +0 -2
  12. package/dist/types/src/public-types.d.ts +1 -1
  13. package/dist/types/src/roktManager.d.ts +18 -0
  14. package/dist/types/src/sdkRuntimeModels.d.ts +0 -5
  15. package/dist/types/src/sdkToEventsApiConverter.d.ts +0 -1
  16. package/dist/types/src/store.d.ts +0 -1
  17. package/dist/types/src/stub/mparticle.stub.d.ts +0 -23
  18. package/package.json +1 -1
  19. package/src/consent.ts +2 -24
  20. package/src/constants.ts +0 -6
  21. package/src/ecommerce.interfaces.ts +2 -33
  22. package/src/ecommerce.ts +0 -16
  23. package/src/events.interfaces.ts +0 -17
  24. package/src/events.ts +1 -74
  25. package/src/identity-user-interfaces.ts +2 -33
  26. package/src/identity.interfaces.ts +0 -6
  27. package/src/identity.ts +0 -115
  28. package/src/internal-types.ts +0 -1
  29. package/src/mp-instance.ts +2 -156
  30. package/src/mparticle-instance-manager.ts +0 -37
  31. package/src/public-types.ts +0 -1
  32. package/src/roktManager.ts +37 -0
  33. package/src/sdkRuntimeModels.ts +0 -6
  34. package/src/sdkToEventsApiConverter.ts +0 -17
  35. package/src/serverModel.ts +0 -9
  36. package/src/store.ts +0 -7
  37. package/src/stub/mparticle.stub.js +0 -15
@@ -4,7 +4,7 @@ import { ICachedIdentityCall, IKnownIdentities } from './identity-utils';
4
4
  import { BaseVault } from './vault';
5
5
  import { Dictionary, Environment, valueof } from './utils';
6
6
  import Constants from './constants';
7
- import { IdentityCallback, IUserAttributeChangeEvent, IUserIdentityChangeEvent, IMParticleUser, mParticleUserCart, IIdentityResponse } from './identity-user-interfaces';
7
+ import { IdentityCallback, IUserAttributeChangeEvent, IUserIdentityChangeEvent, IMParticleUser, IIdentityResponse } from './identity-user-interfaces';
8
8
  import { IdentitySearchCallback } from './identity/search';
9
9
  declare const HTTPCodes: {
10
10
  readonly noHttpCoverage: -1;
@@ -180,8 +180,4 @@ export interface IIdentity {
180
180
  sendUserIdentityChangeEvent(newUserIdentities: UserIdentities, method: IdentityAPIMethod, mpid: MPID, prevUserIdentities: UserIdentities): void;
181
181
  reinitForwardersOnUserChange(prevUser: IMParticleUser, newUser: IMParticleUser): void;
182
182
  setForwarderCallbacks(user: IMParticleUser, method: IdentityAPIMethod): void;
183
- /**
184
- * @deprecated
185
- */
186
- mParticleUserCart(): mParticleUserCart;
187
183
  }
@@ -17,4 +17,4 @@ export type { KitInterface, } from './forwarders.interfaces';
17
17
  export type { RoktAttributeValue, RoktAttributeValueType, RoktAttributeValueArray, RoktAttributes, IRoktPartnerExtensionData, IRoktSelectPlacementsOptions, IRoktSelection, IRoktLauncher, IRoktMessage, RoktKitFilterSettings, IRoktKitSettings, IRoktKit, IRoktOptions, IRoktLauncherOptions, } from './roktManager';
18
18
  export type { ErrorCodes, WSDKErrorSeverity, } from './reporting/types';
19
19
  export type { ISDKError, ISDKLogEntry, IErrorReportingService, ILoggingService, } from './reporting/types';
20
- export type { SDKEvent, SDKProductAction, SDKProductActionType, SDKPromotionAction, SDKShoppingCart, SDKGeoLocation, SDKDataPlan, SDKLoggerApi, SDKConfigApi, IMParticleInstanceManager, } from './sdkRuntimeModels';
20
+ export type { SDKEvent, SDKProductAction, SDKProductActionType, SDKPromotionAction, SDKGeoLocation, SDKDataPlan, SDKLoggerApi, SDKConfigApi, IMParticleInstanceManager, } from './sdkRuntimeModels';
@@ -58,7 +58,6 @@ export default class KitBlocker {
58
58
  ProductAction?: import("./sdkRuntimeModels").SDKProductAction;
59
59
  PromotionAction?: import("./sdkRuntimeModels").SDKPromotionAction;
60
60
  ProductImpressions?: import("./sdkRuntimeModels").SDKProductImpression[];
61
- ShoppingCart?: import("./sdkRuntimeModels").SDKShoppingCart;
62
61
  UserIdentityChanges?: import("./identity-user-interfaces").ISDKUserIdentityChanges;
63
62
  UserAttributeChanges?: import("./identity-user-interfaces").ISDKUserAttributeChangeData;
64
63
  CurrencyCode: string;
@@ -104,7 +103,6 @@ export default class KitBlocker {
104
103
  ProductAction?: import("./sdkRuntimeModels").SDKProductAction;
105
104
  PromotionAction?: import("./sdkRuntimeModels").SDKPromotionAction;
106
105
  ProductImpressions?: import("./sdkRuntimeModels").SDKProductImpression[];
107
- ShoppingCart?: import("./sdkRuntimeModels").SDKShoppingCart;
108
106
  UserIdentityChanges?: import("./identity-user-interfaces").ISDKUserIdentityChanges;
109
107
  UserAttributeChanges?: import("./identity-user-interfaces").ISDKUserAttributeChangeData;
110
108
  CurrencyCode: string;
@@ -17,7 +17,7 @@ export type { EventType, CommerceEventType, IdentityType, ProductActionType, Pro
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';
20
- export type { SDKECommerceAPI, SDKCart, } from './ecommerce.interfaces';
20
+ export type { SDKECommerceAPI, } from './ecommerce.interfaces';
21
21
  export type { SDKProduct, SDKPromotion, SDKImpression, SDKProductImpression, } from './sdkRuntimeModels';
22
22
  export type { SDKConsentApi, SDKConsentState, SDKConsentStateData, SDKGDPRConsentState, SDKCCPAConsentState, } from './consent';
23
23
  export type { Dictionary, valueof } from './utils';
@@ -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
  /**
@@ -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;
@@ -45,7 +45,6 @@ export interface SDKConfig {
45
45
  userAudienceUrl?: string;
46
46
  isIOS?: boolean;
47
47
  maxAliasWindow: number;
48
- maxProducts: number;
49
48
  requestConfig?: boolean;
50
49
  sessionTimeout?: number;
51
50
  timeout?: number;
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-sdk",
3
- "version": "2.80.1",
3
+ "version": "2.82.0",
4
4
  "description": "mParticle core SDK for web applications",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
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
- ): IConsentState {
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
- // TODO: Remove casting once `removeCCPAState` is removed;
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;
@@ -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, SDKProduct } from './sdkRuntimeModels';
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
  }