@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
package/dist/mparticle.js CHANGED
@@ -204,7 +204,7 @@ var mParticle = (function () {
204
204
  Base64: Base64$1
205
205
  };
206
206
 
207
- var version = "2.80.1";
207
+ var version = "2.82.0";
208
208
 
209
209
  var Constants = {
210
210
  sdkVersion: version,
@@ -281,9 +281,6 @@ var mParticle = (function () {
281
281
  SetUserAttribute: 'setUserAttribute',
282
282
  RemoveUserAttribute: 'removeUserAttribute',
283
283
  SetSessionAttribute: 'setSessionAttribute',
284
- AddToCart: 'addToCart',
285
- RemoveFromCart: 'removeFromCart',
286
- ClearCart: 'clearCart',
287
284
  LogOut: 'logOut',
288
285
  SetUserAttributeList: 'setUserAttributeList',
289
286
  RemoveAllUserAttributes: 'removeAllUserAttributes',
@@ -303,10 +300,8 @@ var mParticle = (function () {
303
300
  cookieNameV2: 'mprtcl-v2',
304
301
  cookieNameV3: 'mprtcl-v3',
305
302
  localStorageNameV4: 'mprtcl-v4',
306
- localStorageProductsV4: 'mprtcl-prodv4',
307
303
  cookieNameV4: 'mprtcl-v4',
308
- currentStorageName: 'mprtcl-v4',
309
- currentStorageProductsName: 'mprtcl-prodv4'
304
+ currentStorageName: 'mprtcl-v4'
310
305
  },
311
306
  DefaultConfig: {
312
307
  cookieDomain: null,
@@ -314,7 +309,6 @@ var mParticle = (function () {
314
309
  logLevel: null,
315
310
  timeout: 300,
316
311
  sessionTimeout: 30,
317
- maxProducts: 20,
318
312
  forwarderStatsTimeout: 5000,
319
313
  integrationDelayTimeout: 5000,
320
314
  maxCookieSize: 3000,
@@ -2113,15 +2107,6 @@ var mParticle = (function () {
2113
2107
  }
2114
2108
  return impressions;
2115
2109
  }
2116
- function convertShoppingCart(sdkEvent) {
2117
- if (!sdkEvent.ShoppingCart || !sdkEvent.ShoppingCart.ProductList || !sdkEvent.ShoppingCart.ProductList.length) {
2118
- return null;
2119
- }
2120
- var shoppingCart = {
2121
- products: convertProducts(sdkEvent.ShoppingCart.ProductList)
2122
- };
2123
- return shoppingCart;
2124
- }
2125
2110
  function convertCommerceEvent(sdkEvent) {
2126
2111
  var commonEventData = convertBaseEventData(sdkEvent);
2127
2112
  var commerceEventData = {
@@ -2129,7 +2114,6 @@ var mParticle = (function () {
2129
2114
  product_action: convertProductAction(sdkEvent),
2130
2115
  promotion_action: convertPromotionAction(sdkEvent),
2131
2116
  product_impressions: convertImpressions(sdkEvent),
2132
- shopping_cart: convertShoppingCart(sdkEvent),
2133
2117
  currency_code: sdkEvent.CurrencyCode
2134
2118
  };
2135
2119
  commerceEventData = Object.assign(commerceEventData, commonEventData);
@@ -4699,15 +4683,6 @@ var mParticle = (function () {
4699
4683
  attributes['Position'] = promotion.Position;
4700
4684
  }
4701
4685
  };
4702
- this.buildProductList = function (event, product) {
4703
- if (product) {
4704
- if (Array.isArray(product)) {
4705
- return product;
4706
- }
4707
- return [product];
4708
- }
4709
- return event.ShoppingCart.ProductList;
4710
- };
4711
4686
  this.createProduct = function (name, sku, price, quantity, variant, category, brand, position, couponCode, attributes) {
4712
4687
  attributes = mpInstance._Helpers.sanitizeAttributes(attributes, name);
4713
4688
  if (typeof name !== 'string') {
@@ -4899,7 +4874,6 @@ var mParticle = (function () {
4899
4874
  });
4900
4875
  baseEvent.EventName = 'eCommerce - ';
4901
4876
  baseEvent.CurrencyCode = mpInstance._Store.currencyCode;
4902
- baseEvent.ShoppingCart = [];
4903
4877
  baseEvent.CustomFlags = extend(baseEvent.CustomFlags, customFlags);
4904
4878
  return baseEvent;
4905
4879
  } else {
@@ -5156,11 +5130,6 @@ var mParticle = (function () {
5156
5130
  } else {
5157
5131
  this.SDKConfig.useCookieStorage = false;
5158
5132
  }
5159
- if (config.hasOwnProperty('maxProducts')) {
5160
- this.SDKConfig.maxProducts = config.maxProducts;
5161
- } else {
5162
- this.SDKConfig.maxProducts = Constants.DefaultConfig.maxProducts;
5163
- }
5164
5133
  if (config.hasOwnProperty('maxCookieSize')) {
5165
5134
  this.SDKConfig.maxCookieSize = config.maxCookieSize;
5166
5135
  } else {
@@ -6902,20 +6871,6 @@ var mParticle = (function () {
6902
6871
  eventType: Types.EventType.Unknown
6903
6872
  });
6904
6873
  };
6905
- this.logCheckoutEvent = function (step, option, attrs, customFlags) {
6906
- var event = mpInstance._Ecommerce.createCommerceEventObject(customFlags);
6907
- if (event) {
6908
- event.EventName += mpInstance._Ecommerce.getProductActionEventName(Types.ProductActionType.Checkout);
6909
- event.EventCategory = Types.CommerceEventType.ProductCheckout;
6910
- event.ProductAction = {
6911
- ProductActionType: Types.ProductActionType.Checkout,
6912
- CheckoutStep: step,
6913
- CheckoutOptions: option,
6914
- ProductList: []
6915
- };
6916
- self.logCommerceEvent(event, attrs);
6917
- }
6918
- };
6919
6874
  this.logProductActionEvent = function (productActionType, product, customAttrs, customFlags, transactionAttributes, options) {
6920
6875
  var event = mpInstance._Ecommerce.createCommerceEventObject(customFlags, options);
6921
6876
  var productList = Array.isArray(product) ? product : [product];
@@ -6956,26 +6911,9 @@ var mParticle = (function () {
6956
6911
  event.EventName += mpInstance._Ecommerce.getProductActionEventName(Types.ProductActionType.Purchase);
6957
6912
  event.EventCategory = Types.CommerceEventType.ProductPurchase;
6958
6913
  event.ProductAction = {
6959
- ProductActionType: Types.ProductActionType.Purchase
6914
+ ProductActionType: Types.ProductActionType.Purchase,
6915
+ ProductList: Array.isArray(product) ? product : [product]
6960
6916
  };
6961
- event.ProductAction.ProductList = mpInstance._Ecommerce.buildProductList(event, product);
6962
- mpInstance._Ecommerce.convertTransactionAttributesToProductAction(transactionAttributes, event.ProductAction);
6963
- self.logCommerceEvent(event, attrs);
6964
- }
6965
- };
6966
- this.logRefundEvent = function (transactionAttributes, product, attrs, customFlags) {
6967
- if (!transactionAttributes) {
6968
- mpInstance.Logger.error(Messages$3.ErrorMessages.TransactionRequired);
6969
- return;
6970
- }
6971
- var event = mpInstance._Ecommerce.createCommerceEventObject(customFlags);
6972
- if (event) {
6973
- event.EventName += mpInstance._Ecommerce.getProductActionEventName(Types.ProductActionType.Refund);
6974
- event.EventCategory = Types.CommerceEventType.ProductRefund;
6975
- event.ProductAction = {
6976
- ProductActionType: Types.ProductActionType.Refund
6977
- };
6978
- event.ProductAction.ProductList = mpInstance._Ecommerce.buildProductList(event, product);
6979
6917
  mpInstance._Ecommerce.convertTransactionAttributesToProductAction(transactionAttributes, event.ProductAction);
6980
6918
  self.logCommerceEvent(event, attrs);
6981
6919
  }
@@ -7022,10 +6960,6 @@ var mParticle = (function () {
7022
6960
  }
7023
6961
  var sanitizedAttrs = mpInstance._Helpers.sanitizeAttributes(attrs, commerceEvent.EventName);
7024
6962
  if (mpInstance._Helpers.canLog()) {
7025
- if (mpInstance._Store.webviewBridgeEnabled) {
7026
- // Don't send shopping cart to parent sdks
7027
- commerceEvent.ShoppingCart = {};
7028
- }
7029
6963
  if (sanitizedAttrs) {
7030
6964
  commerceEvent.EventAttributes = sanitizedAttrs;
7031
6965
  }
@@ -7892,12 +7826,6 @@ var mParticle = (function () {
7892
7826
  }
7893
7827
  if (event.EventDataType === MessageType.Commerce) {
7894
7828
  dto.cu = event.CurrencyCode;
7895
- // TODO: If Cart is deprecated, we should deprecate this too
7896
- if (event.ShoppingCart) {
7897
- dto.sc = {
7898
- pl: convertProductListToV2DTO(event.ShoppingCart.ProductList)
7899
- };
7900
- }
7901
7829
  if (event.ProductAction) {
7902
7830
  dto.pd = {
7903
7831
  an: event.ProductAction.ProductActionType,
@@ -8872,18 +8800,6 @@ var mParticle = (function () {
8872
8800
  }
8873
8801
  return userAttributesCopy;
8874
8802
  },
8875
- /**
8876
- * Returns the cart object for the current user
8877
- * @method getCart
8878
- * @return a cart object
8879
- */
8880
- getCart: function getCart() {
8881
- logDeprecatedMethodUsage({
8882
- methodName: 'Identity.getCurrentUser().getCart()',
8883
- warningMessage: 'Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases'
8884
- }, mpInstance.Logger, mpInstance._ErrorReportingDispatcher);
8885
- return self.mParticleUserCart();
8886
- },
8887
8803
  /**
8888
8804
  * Returns the Consent State stored locally for this user.
8889
8805
  * @method getConsentState
@@ -8930,62 +8846,6 @@ var mParticle = (function () {
8930
8846
  }
8931
8847
  };
8932
8848
  };
8933
- /**
8934
- * Invoke these methods on the mParticle.Identity.getCurrentUser().getCart() object.
8935
- * Example: mParticle.Identity.getCurrentUser().getCart().add(...);
8936
- * @class mParticle.Identity.getCurrentUser().getCart()
8937
- * @deprecated
8938
- */
8939
- this.mParticleUserCart = function () {
8940
- return {
8941
- /**
8942
- * Adds a cart product to the user cart
8943
- * @method add
8944
- * @deprecated
8945
- */
8946
- add: function add() {
8947
- logDeprecatedMethodUsage({
8948
- methodName: 'Identity.getCurrentUser().getCart().add()',
8949
- warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().add()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
8950
- }, mpInstance.Logger, mpInstance._ErrorReportingDispatcher);
8951
- },
8952
- /**
8953
- * Removes a cart product from the current user cart
8954
- * @method remove
8955
- * @deprecated
8956
- */
8957
- remove: function remove() {
8958
- logDeprecatedMethodUsage({
8959
- methodName: 'Identity.getCurrentUser().getCart().remove()',
8960
- warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().remove()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
8961
- }, mpInstance.Logger, mpInstance._ErrorReportingDispatcher);
8962
- },
8963
- /**
8964
- * Clears the user's cart
8965
- * @method clear
8966
- * @deprecated
8967
- */
8968
- clear: function clear() {
8969
- logDeprecatedMethodUsage({
8970
- methodName: 'Identity.getCurrentUser().getCart().clear()',
8971
- warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().clear()', true, '', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
8972
- }, mpInstance.Logger, mpInstance._ErrorReportingDispatcher);
8973
- },
8974
- /**
8975
- * Returns all cart products
8976
- * @method getCartProducts
8977
- * @return {Array} array of cart products
8978
- * @deprecated
8979
- */
8980
- getCartProducts: function getCartProducts() {
8981
- logDeprecatedMethodUsage({
8982
- methodName: 'Identity.getCurrentUser().getCart().getCartProducts()',
8983
- warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().getCartProducts()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
8984
- }, mpInstance.Logger, mpInstance._ErrorReportingDispatcher);
8985
- return [];
8986
- }
8987
- };
8988
- };
8989
8849
  // https://go.mparticle.com/work/SQDSDKS-6355
8990
8850
  this.parseIdentityResponse = function (identityResponse, previousMPID, callback, identityApiData, method, knownIdentities, parsingCachedResponse) {
8991
8851
  var _a, _b, _c;
@@ -9342,7 +9202,6 @@ var mParticle = (function () {
9342
9202
  var consentStateCopy = self.createConsentState();
9343
9203
  consentStateCopy.setGDPRConsentState(consentState.getGDPRConsentState());
9344
9204
  consentStateCopy.setCCPAConsentState(consentState.getCCPAConsentState());
9345
- // TODO: Remove casting once `removeCCPAState` is removed;
9346
9205
  return consentStateCopy;
9347
9206
  }
9348
9207
  function canonicalizeForDeduplication(purpose) {
@@ -9458,15 +9317,6 @@ var mParticle = (function () {
9458
9317
  delete ccpa[CCPAPurpose];
9459
9318
  return this;
9460
9319
  }
9461
- // TODO: Can we remove this? It is deprecated.
9462
- function removeCCPAState() {
9463
- logDeprecatedMethodUsage({
9464
- methodName: 'Consent.removeCCPAState',
9465
- warningMessage: 'removeCCPAState is deprecated and will be removed in a future release; use removeCCPAConsentState instead'
9466
- }, mpInstance.Logger, mpInstance._ErrorReportingDispatcher);
9467
- // @ts-ignore
9468
- return removeCCPAConsentState();
9469
- }
9470
9320
  return {
9471
9321
  setGDPRConsentState: setGDPRConsentState,
9472
9322
  addGDPRConsentState: addGDPRConsentState,
@@ -9474,7 +9324,6 @@ var mParticle = (function () {
9474
9324
  getCCPAConsentState: getCCPAConsentState,
9475
9325
  getGDPRConsentState: getGDPRConsentState,
9476
9326
  removeGDPRConsentState: removeGDPRConsentState,
9477
- removeCCPAState: removeCCPAState,
9478
9327
  removeCCPAConsentState: removeCCPAConsentState
9479
9328
  };
9480
9329
  };
@@ -10906,6 +10755,57 @@ var mParticle = (function () {
10906
10755
  return Promise.reject(error instanceof Error ? error : new Error('Error using extension: ' + name));
10907
10756
  }
10908
10757
  };
10758
+ /**
10759
+ * Tears down the current Rokt launcher and removes the placements it rendered.
10760
+ *
10761
+ * Intended for hosts that cannot simply destroy the container element —
10762
+ * SPA route changes and confirmation pages, for example.
10763
+ *
10764
+ * Unlike the other proxied methods, a call made before the kit is ready is
10765
+ * *not* queued. Replaying a teardown against a launcher created later would
10766
+ * silently tear down placements the caller never asked to remove; with no
10767
+ * launcher there is nothing to terminate, so this resolves as a no-op.
10768
+ *
10769
+ * @example
10770
+ * await window.mParticle.Rokt.terminate();
10771
+ *
10772
+ * @returns {Promise<void>} Resolves once the launcher has torn down. Never rejects.
10773
+ */
10774
+ RoktManager.prototype.terminate = function () {
10775
+ var _a, _b, _c;
10776
+ return __awaiter(this, void 0, void 0, function () {
10777
+ var error_2;
10778
+ return __generator(this, function (_d) {
10779
+ switch (_d.label) {
10780
+ case 0:
10781
+ if (!this.isReady()) {
10782
+ (_a = this.logger) === null || _a === void 0 ? void 0 : _a.verbose('mParticle.Rokt.terminate called before the Rokt kit was ready. Nothing to terminate.');
10783
+ return [2 /*return*/];
10784
+ }
10785
+
10786
+ if (!isFunction(this.kit.terminate)) {
10787
+ (_b = this.logger) === null || _b === void 0 ? void 0 : _b.error('mParticle.Rokt.terminate is not supported by the attached Rokt Kit version.');
10788
+ return [2 /*return*/];
10789
+ }
10790
+
10791
+ _d.label = 1;
10792
+ case 1:
10793
+ _d.trys.push([1, 3,, 4]);
10794
+ return [4 /*yield*/, this.kit.terminate()];
10795
+ case 2:
10796
+ _d.sent();
10797
+ return [3 /*break*/, 4];
10798
+ case 3:
10799
+ error_2 = _d.sent();
10800
+ (_c = this.logger) === null || _c === void 0 ? void 0 : _c.error("Failed to terminate the Rokt launcher: ".concat(getErrorMessage(error_2)));
10801
+ return [3 /*break*/, 4];
10802
+ case 4:
10803
+ return [2 /*return*/];
10804
+ }
10805
+ });
10806
+ });
10807
+ };
10808
+
10909
10809
  RoktManager.prototype.onShoppableAdsReady = function (callback) {
10910
10810
  if (!this.kit || !this.isShoppableAdsLoaded) {
10911
10811
  this.deferredCall('onShoppableAdsReady', callback);
@@ -10942,7 +10842,7 @@ var mParticle = (function () {
10942
10842
  */
10943
10843
  RoktManager.prototype.hashSha256 = function (attribute) {
10944
10844
  return __awaiter(this, void 0, void 0, function () {
10945
- var normalizedValue, error_2;
10845
+ var normalizedValue, error_3;
10946
10846
  return __generator(this, function (_a) {
10947
10847
  switch (_a.label) {
10948
10848
  case 0:
@@ -10958,8 +10858,8 @@ var mParticle = (function () {
10958
10858
  case 2:
10959
10859
  return [2 /*return*/, _a.sent()];
10960
10860
  case 3:
10961
- error_2 = _a.sent();
10962
- this.logger.error("Failed to hashSha256, returning undefined: ".concat(getErrorMessage(error_2)));
10861
+ error_3 = _a.sent();
10862
+ this.logger.error("Failed to hashSha256, returning undefined: ".concat(getErrorMessage(error_3)));
10963
10863
  return [2 /*return*/, undefined];
10964
10864
  case 4:
10965
10865
  return [2 /*return*/];
@@ -11760,51 +11660,6 @@ var mParticle = (function () {
11760
11660
  * @class mParticle.eCommerce
11761
11661
  */
11762
11662
  this.eCommerce = {
11763
- /**
11764
- * Invoke these methods on the mParticle.eCommerce.Cart object.
11765
- * Example: mParticle.eCommerce.Cart.add(...)
11766
- * @class mParticle.eCommerce.Cart
11767
- * @deprecated
11768
- */
11769
- Cart: {
11770
- /**
11771
- * Adds a product to the cart
11772
- * @method add
11773
- * @param {Object} product The product you want to add to the cart
11774
- * @param {Boolean} [logEventBoolean] Option to log the event to mParticle's servers. If blank, no logging occurs.
11775
- * @deprecated
11776
- */
11777
- add: function add(product, logEventBoolean) {
11778
- logDeprecatedMethodUsage({
11779
- methodName: 'mPInstance.eCommerce.Cart.add()',
11780
- warningMessage: generateDeprecationMessage('eCommerce.Cart.add()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
11781
- }, self.Logger, self._ErrorReportingDispatcher);
11782
- },
11783
- /**
11784
- * Removes a product from the cart
11785
- * @method remove
11786
- * @param {Object} product The product you want to add to the cart
11787
- * @param {Boolean} [logEventBoolean] Option to log the event to mParticle's servers. If blank, no logging occurs.
11788
- * @deprecated
11789
- */
11790
- remove: function remove(product, logEventBoolean) {
11791
- logDeprecatedMethodUsage({
11792
- methodName: 'mPInstance.eCommerce.Cart.remove()',
11793
- warningMessage: generateDeprecationMessage('eCommerce.Cart.remove()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
11794
- }, self.Logger, self._ErrorReportingDispatcher);
11795
- },
11796
- /**
11797
- * Clears the cart
11798
- * @method clear
11799
- * @deprecated
11800
- */
11801
- clear: function clear() {
11802
- logDeprecatedMethodUsage({
11803
- methodName: 'mPInstance.eCommerce.Cart.clear()',
11804
- warningMessage: generateDeprecationMessage('eCommerce.Cart.clear()', true, '', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
11805
- }, self.Logger, self._ErrorReportingDispatcher);
11806
- }
11807
- },
11808
11663
  /**
11809
11664
  * Sets the currency code
11810
11665
  * @for mParticle.eCommerce
@@ -11877,30 +11732,6 @@ var mParticle = (function () {
11877
11732
  createTransactionAttributes: function createTransactionAttributes(id, affiliation, couponCode, revenue, shipping, tax) {
11878
11733
  return self._Ecommerce.createTransactionAttributes(id, affiliation, couponCode, revenue, shipping, tax);
11879
11734
  },
11880
- /**
11881
- * Logs a checkout action
11882
- * @for mParticle.eCommerce
11883
- * @method logCheckout
11884
- * @param {Number} step checkout step number
11885
- * @param {String} checkout option string
11886
- * @param {Object} attrs
11887
- * @param {Object} [customFlags] Custom flags for the event
11888
- * @deprecated
11889
- */
11890
- logCheckout: function logCheckout(step, option, attrs, customFlags) {
11891
- logDeprecatedMethodUsage({
11892
- methodName: 'mParticle.logCheckout',
11893
- warningMessage: 'mParticle.logCheckout is deprecated, please use mParticle.logProductAction instead'
11894
- }, self.Logger, self._ErrorReportingDispatcher);
11895
- if (!self._Store.isInitialized) {
11896
- self.ready(function () {
11897
- self.eCommerce.logCheckout(step, option, attrs, customFlags);
11898
- });
11899
- return;
11900
- }
11901
- self._SessionManager.resetSessionTimer();
11902
- self._Events.logCheckoutEvent(step, option, attrs, customFlags);
11903
- },
11904
11735
  /**
11905
11736
  * Logs a product action
11906
11737
  * @for mParticle.eCommerce
@@ -11929,12 +11760,12 @@ var mParticle = (function () {
11929
11760
  * @param {Boolean} [clearCart] boolean to clear the cart after logging or not. Defaults to false
11930
11761
  * @param {Object} [attrs] other attributes related to the product purchase
11931
11762
  * @param {Object} [customFlags] Custom flags for the event
11932
- * @deprecated
11763
+ * @deprecated Use `logProductAction` with `ProductActionType.Purchase` instead.
11933
11764
  */
11934
11765
  logPurchase: function logPurchase(transactionAttributes, product, clearCart, attrs, customFlags) {
11935
11766
  logDeprecatedMethodUsage({
11936
11767
  methodName: 'mParticle.logPurchase',
11937
- warningMessage: 'mParticle.logPurchase is deprecated, please use mParticle.logProductAction instead'
11768
+ warningMessage: 'mParticle.logPurchase is deprecated, please use mParticle.logProductAction with ProductActionType.Purchase instead'
11938
11769
  }, self.Logger, self._ErrorReportingDispatcher);
11939
11770
  if (!self._Store.isInitialized) {
11940
11771
  self.ready(function () {
@@ -11984,31 +11815,6 @@ var mParticle = (function () {
11984
11815
  self._SessionManager.resetSessionTimer();
11985
11816
  self._Events.logImpressionEvent(impression, attrs, customFlags, eventOptions);
11986
11817
  },
11987
- /**
11988
- * Logs a refund
11989
- * @for mParticle.eCommerce
11990
- * @method logRefund
11991
- * @param {Object} transactionAttributes transaction attributes related to the refund
11992
- * @param {Object} product product being refunded
11993
- * @param {Boolean} [clearCart] boolean to clear the cart after refund is logged. Defaults to false.
11994
- * @param {Object} [attrs] attributes related to the refund
11995
- * @param {Object} [customFlags] Custom flags for the event
11996
- * @deprecated
11997
- */
11998
- logRefund: function logRefund(transactionAttributes, product, clearCart, attrs, customFlags) {
11999
- logDeprecatedMethodUsage({
12000
- methodName: 'mParticle.logRefund',
12001
- warningMessage: 'mParticle.logRefund is deprecated, please use mParticle.logProductAction instead'
12002
- }, self.Logger, self._ErrorReportingDispatcher);
12003
- if (!self._Store.isInitialized) {
12004
- self.ready(function () {
12005
- self.eCommerce.logRefund(transactionAttributes, product, clearCart, attrs, customFlags);
12006
- });
12007
- return;
12008
- }
12009
- self._SessionManager.resetSessionTimer();
12010
- self._Events.logRefundEvent(transactionAttributes, product, attrs, customFlags);
12011
- },
12012
11818
  expandCommerceEvent: function expandCommerceEvent(event) {
12013
11819
  return self._Ecommerce.expandCommerceEvent(event);
12014
11820
  }
@@ -12817,17 +12623,6 @@ var mParticle = (function () {
12817
12623
  self.getInstance().upload();
12818
12624
  };
12819
12625
  this.eCommerce = {
12820
- Cart: {
12821
- add: function add(product, logEventBoolean) {
12822
- self.getInstance().eCommerce.Cart.add(product, logEventBoolean);
12823
- },
12824
- remove: function remove(product, logEventBoolean) {
12825
- self.getInstance().eCommerce.Cart.remove(product, logEventBoolean);
12826
- },
12827
- clear: function clear() {
12828
- self.getInstance().eCommerce.Cart.clear();
12829
- }
12830
- },
12831
12626
  setCurrencyCode: function setCurrencyCode(code) {
12832
12627
  self.getInstance().eCommerce.setCurrencyCode(code);
12833
12628
  },
@@ -12843,9 +12638,6 @@ var mParticle = (function () {
12843
12638
  createTransactionAttributes: function createTransactionAttributes(id, affiliation, couponCode, revenue, shipping, tax) {
12844
12639
  return self.getInstance().eCommerce.createTransactionAttributes(id, affiliation, couponCode, revenue, shipping, tax);
12845
12640
  },
12846
- logCheckout: function logCheckout(step, options, attrs, customFlags) {
12847
- self.getInstance().eCommerce.logCheckout(step, options, attrs, customFlags);
12848
- },
12849
12641
  logProductAction: function logProductAction(productActionType, product, attrs, customFlags, transactionAttributes, eventOptions) {
12850
12642
  self.getInstance().eCommerce.logProductAction(productActionType, product, attrs, customFlags, transactionAttributes, eventOptions);
12851
12643
  },
@@ -12858,9 +12650,6 @@ var mParticle = (function () {
12858
12650
  logImpression: function logImpression(impression, attrs, customFlags, eventOptions) {
12859
12651
  self.getInstance().eCommerce.logImpression(impression, attrs, customFlags, eventOptions);
12860
12652
  },
12861
- logRefund: function logRefund(transactionAttributes, product, clearCart, attrs, customFlags) {
12862
- self.getInstance().eCommerce.logRefund(transactionAttributes, product, clearCart, attrs, customFlags);
12863
- },
12864
12653
  expandCommerceEvent: function expandCommerceEvent(event) {
12865
12654
  return self.getInstance().eCommerce.expandCommerceEvent(event);
12866
12655
  }
@@ -58,9 +58,6 @@ export interface IConsentRules {
58
58
  includeOnMatch: boolean;
59
59
  values: IConsentRulesValues[];
60
60
  }
61
- export interface IConsentState extends ConsentState {
62
- removeCCPAState: () => ConsentState;
63
- }
64
61
  export interface IConsent {
65
62
  isEnabledForUserConsent: (consentRules: IConsentRules, user: IMParticleUser) => boolean;
66
63
  createPrivacyConsent: ICreatePrivacyConsentFunction;
@@ -73,9 +73,6 @@ declare const Constants: {
73
73
  readonly SetUserAttribute: "setUserAttribute";
74
74
  readonly RemoveUserAttribute: "removeUserAttribute";
75
75
  readonly SetSessionAttribute: "setSessionAttribute";
76
- readonly AddToCart: "addToCart";
77
- readonly RemoveFromCart: "removeFromCart";
78
- readonly ClearCart: "clearCart";
79
76
  readonly LogOut: "logOut";
80
77
  readonly SetUserAttributeList: "setUserAttributeList";
81
78
  readonly RemoveAllUserAttributes: "removeAllUserAttributes";
@@ -95,10 +92,8 @@ declare const Constants: {
95
92
  readonly cookieNameV2: "mprtcl-v2";
96
93
  readonly cookieNameV3: "mprtcl-v3";
97
94
  readonly localStorageNameV4: "mprtcl-v4";
98
- readonly localStorageProductsV4: "mprtcl-prodv4";
99
95
  readonly cookieNameV4: "mprtcl-v4";
100
96
  readonly currentStorageName: "mprtcl-v4";
101
- readonly currentStorageProductsName: "mprtcl-prodv4";
102
97
  };
103
98
  readonly DefaultConfig: {
104
99
  readonly cookieDomain: any;
@@ -106,7 +101,6 @@ declare const Constants: {
106
101
  readonly logLevel: any;
107
102
  readonly timeout: 300;
108
103
  readonly sessionTimeout: 30;
109
- readonly maxProducts: 20;
110
104
  readonly forwarderStatsTimeout: 5000;
111
105
  readonly integrationDelayTimeout: 5000;
112
106
  readonly maxCookieSize: 3000;
@@ -9,20 +9,15 @@ interface IECommerceShared {
9
9
  createTransactionAttributes(id: string | number, affiliation?: string, couponCode?: string, revenue?: string | number, shipping?: string | number, tax?: number): TransactionAttributes | null;
10
10
  expandCommerceEvent(event: SDKEvent): SDKEvent[] | null;
11
11
  }
12
- export interface SDKCart {
13
- add(product: SDKProduct | SDKProduct[], logEvent?: boolean): void;
14
- remove(product: SDKProduct | SDKProduct[], logEvent?: boolean): void;
15
- clear(): void;
16
- }
17
12
  export interface SDKECommerceAPI extends IECommerceShared {
18
- logCheckout(step: number, option?: string, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags): void;
19
13
  logImpression(impression: SDKImpression | SDKImpression[], attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, eventOptions?: SDKEventOptions): void;
20
14
  logProductAction(productActionType: valueof<typeof ProductActionType>, product: SDKProduct | SDKProduct[], attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, transactionAttributes?: TransactionAttributes, eventOptions?: SDKEventOptions): void;
21
15
  logPromotion(type: valueof<typeof PromotionActionType>, promotion: SDKPromotion | SDKPromotion[], attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, eventOptions?: SDKEventOptions): void;
22
16
  setCurrencyCode(code: string): void;
23
- Cart: SDKCart;
17
+ /**
18
+ * @deprecated Use `logProductAction` with `ProductActionType.Purchase` instead.
19
+ */
24
20
  logPurchase(transactionAttributes: TransactionAttributes, product: SDKProduct | SDKProduct[], clearCart?: boolean, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags): void;
25
- logRefund(transactionAttributes: TransactionAttributes, product: SDKProduct | SDKProduct[], clearCart?: boolean, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags): void;
26
21
  }
27
22
  interface ExtractedActionAttributes {
28
23
  Affiliation?: string;
@@ -56,7 +51,6 @@ interface ExtractedTransactionId {
56
51
  'Transaction ID'?: string;
57
52
  }
58
53
  export interface IECommerce extends IECommerceShared {
59
- buildProductList(event: SDKEvent, product: SDKProduct | SDKProduct[]): SDKProduct[];
60
54
  convertProductActionToEventType(productActionType: valueof<typeof ProductActionType>): // https://go.mparticle.com/work/SQDSDKS-4801
61
55
  number | null;
62
56
  convertPromotionActionToEventType(promotionActionType: valueof<typeof PromotionActionType>): number | null;
@@ -6,7 +6,6 @@ type EventHandlerFunction<T> = (element: HTMLLinkElement | HTMLFormElement) => T
6
6
  export interface IEvents {
7
7
  addEventHandler(domEvent: string, selector: string | Node, eventName: EventHandlerFunction<string> | string, data: EventHandlerFunction<SDKEventAttrs> | SDKEventAttrs, eventType: valueof<typeof EventType>): void;
8
8
  logAST(): void;
9
- logCheckoutEvent(step: number, option?: string, attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags): void;
10
9
  logCommerceEvent(commerceEvent: SDKEvent, attrs?: SDKEventAttrs, options?: SDKEventOptions): void;
11
10
  logEvent(event: BaseEvent, eventOptions?: SDKEventOptions): void;
12
11
  logImpressionEvent(impression: SDKImpression | SDKImpression[], attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, eventOptions?: SDKEventOptions): void;
@@ -15,7 +14,6 @@ export interface IEvents {
15
14
  logProductActionEvent(productActionType: valueof<typeof ProductActionType>, product: SDKProduct | SDKProduct[], attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, transactionAttributes?: TransactionAttributes, eventOptions?: SDKEventOptions): void;
16
15
  logPromotionEvent(promotionType: valueof<typeof PromotionActionType>, promotion: SDKPromotion | SDKPromotion[], attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags, eventOptions?: SDKEventOptions): void;
17
16
  logPurchaseEvent(transactionAttributes: TransactionAttributes, product: SDKProduct | SDKProduct[], attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags): void;
18
- logRefundEvent(transactionAttributes: TransactionAttributes, product: SDKProduct | SDKProduct[], attrs?: SDKEventAttrs, customFlags?: SDKEventCustomFlags): void;
19
17
  startTracking(callback: Callback): void;
20
18
  stopTracking(): void;
21
19
  }
@@ -1,7 +1,7 @@
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
  declare const HTTPCodes: {
6
6
  readonly noHttpCoverage: -1;
7
7
  readonly activeIdentityRequest: -2;
@@ -11,30 +11,11 @@ declare const HTTPCodes: {
11
11
  readonly loggingDisabledOrMissingAPIKey: -6;
12
12
  readonly tooManyRequests: 429;
13
13
  };
14
- interface ICart {
15
- /**
16
- * @deprecated Cart persistence in mParticle has been deprecated. Please use mParticle.eCommerce.logProductAction(mParticle.ProductActionType.AddToCart, [products])
17
- */
18
- add: (product: SDKProduct, logEventBoolean?: boolean) => void;
19
- /**
20
- * @deprecated Cart persistence in mParticle has been deprecated. Please use mParticle.eCommerce.logProductAction(mParticle.ProductActionType.RemoveFromCart, [products])
21
- */
22
- remove: (product: SDKProduct, logEventBoolean?: boolean) => void;
23
- /**
24
- * @deprecated Cart persistence in mParticle has been deprecated.
25
- */
26
- clear: () => void;
27
- /**
28
- * @deprecated Cart Products have been deprecated
29
- */
30
- getCartProducts: () => SDKProduct[];
31
- }
32
- export interface IMParticleUser extends User {
14
+ export interface IMParticleUser extends Omit<User, 'getCart'> {
33
15
  getAllUserAttributes(): any;
34
16
  setUserTag(tagName: string, value?: any): void;
35
17
  setUserAttribute(key: string, value: any): void;
36
18
  getUserAudiences?(callback?: IdentityCallback): void;
37
- getCart(): ICart;
38
19
  }
39
20
  export interface ISDKUserIdentity {
40
21
  Identity: string;
@@ -96,11 +77,5 @@ export interface IdentityModifyResultBody {
96
77
  modified_mpid: MPID;
97
78
  };
98
79
  }
99
- export interface mParticleUserCart {
100
- add(): void;
101
- remove(): void;
102
- clear(): void;
103
- getCartProducts(): SDKProduct[];
104
- }
105
80
  export type UserAttributes = AllUserAttributes;
106
81
  export {};