@mparticle/web-sdk 2.68.0 → 2.69.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.js CHANGED
@@ -203,7 +203,7 @@ var mParticle = (function () {
203
203
  Base64: Base64$1
204
204
  };
205
205
 
206
- var version = "2.68.0";
206
+ var version = "2.69.0";
207
207
 
208
208
  var Constants = {
209
209
  sdkVersion: version,
@@ -1293,6 +1293,18 @@ var mParticle = (function () {
1293
1293
  Refund: 8,
1294
1294
  AddToWishlist: 9,
1295
1295
  RemoveFromWishlist: 10,
1296
+ // Rokt Brain commerce-adjacent types
1297
+ ViewCart: 11,
1298
+ AddShippingInfo: 12,
1299
+ AddPaymentInfo: 13,
1300
+ PaymentMethodSelected: 14,
1301
+ PaymentAttempted: 15,
1302
+ PaymentSucceeded: 16,
1303
+ PaymentFailed: 17,
1304
+ RefundInitiated: 18,
1305
+ isRoktCommerceType: function isRoktCommerceType(id) {
1306
+ return id >= ProductActionType.ViewCart && id <= ProductActionType.RefundInitiated;
1307
+ },
1296
1308
  getName: function getName(id) {
1297
1309
  switch (id) {
1298
1310
  case ProductActionType.AddToCart:
@@ -1315,6 +1327,22 @@ var mParticle = (function () {
1315
1327
  return 'Add to Wishlist';
1316
1328
  case ProductActionType.RemoveFromWishlist:
1317
1329
  return 'Remove from Wishlist';
1330
+ case ProductActionType.ViewCart:
1331
+ return 'View Cart';
1332
+ case ProductActionType.AddShippingInfo:
1333
+ return 'Add Shipping Info';
1334
+ case ProductActionType.AddPaymentInfo:
1335
+ return 'Add Payment Info';
1336
+ case ProductActionType.PaymentMethodSelected:
1337
+ return 'Payment Method Selected';
1338
+ case ProductActionType.PaymentAttempted:
1339
+ return 'Payment Attempted';
1340
+ case ProductActionType.PaymentSucceeded:
1341
+ return 'Payment Succeeded';
1342
+ case ProductActionType.PaymentFailed:
1343
+ return 'Payment Failed';
1344
+ case ProductActionType.RefundInitiated:
1345
+ return 'Refund Initiated';
1318
1346
  default:
1319
1347
  return 'Unknown';
1320
1348
  }
@@ -1342,11 +1370,40 @@ var mParticle = (function () {
1342
1370
  return 'add_to_wishlist';
1343
1371
  case ProductActionType.RemoveFromWishlist:
1344
1372
  return 'remove_from_wishlist';
1373
+ case ProductActionType.ViewCart:
1374
+ return 'view_cart';
1375
+ case ProductActionType.AddShippingInfo:
1376
+ return 'add_shipping_info';
1377
+ case ProductActionType.AddPaymentInfo:
1378
+ return 'add_payment_info';
1379
+ case ProductActionType.PaymentMethodSelected:
1380
+ return 'payment_method_selected';
1381
+ case ProductActionType.PaymentAttempted:
1382
+ return 'payment_attempted';
1383
+ case ProductActionType.PaymentSucceeded:
1384
+ return 'payment_succeeded';
1385
+ case ProductActionType.PaymentFailed:
1386
+ return 'payment_failed';
1387
+ case ProductActionType.RefundInitiated:
1388
+ return 'refund_initiated';
1345
1389
  default:
1346
1390
  return 'unknown';
1347
1391
  }
1348
1392
  }
1349
1393
  };
1394
+ var RoktEvents = {
1395
+ SignUp: 'sign_up',
1396
+ Subscribe: 'subscribe',
1397
+ StartTrial: 'start_trial',
1398
+ GenerateLead: 'generate_lead',
1399
+ Search: 'search',
1400
+ Upsell: 'upsell',
1401
+ EarnVirtualCurrency: 'earn_virtual_currency',
1402
+ DwellTime: 'dwell_time',
1403
+ Hover: 'hover',
1404
+ Scroll: 'scroll',
1405
+ ClickToExpand: 'click_to_expand'
1406
+ };
1350
1407
  var PromotionActionType = {
1351
1408
  Unknown: 0,
1352
1409
  PromotionView: 1,
@@ -1518,6 +1575,7 @@ var mParticle = (function () {
1518
1575
  ApplicationTransitionType: ApplicationTransitionType$1,
1519
1576
  ProductActionType: ProductActionType,
1520
1577
  PromotionActionType: PromotionActionType,
1578
+ RoktEvents: RoktEvents,
1521
1579
  Environment: Constants.Environment
1522
1580
  };
1523
1581
 
@@ -1534,6 +1592,14 @@ var mParticle = (function () {
1534
1592
  SDKProductActionType[SDKProductActionType["Refund"] = 8] = "Refund";
1535
1593
  SDKProductActionType[SDKProductActionType["AddToWishlist"] = 9] = "AddToWishlist";
1536
1594
  SDKProductActionType[SDKProductActionType["RemoveFromWishlist"] = 10] = "RemoveFromWishlist";
1595
+ SDKProductActionType[SDKProductActionType["ViewCart"] = 11] = "ViewCart";
1596
+ SDKProductActionType[SDKProductActionType["AddShippingInfo"] = 12] = "AddShippingInfo";
1597
+ SDKProductActionType[SDKProductActionType["AddPaymentInfo"] = 13] = "AddPaymentInfo";
1598
+ SDKProductActionType[SDKProductActionType["PaymentMethodSelected"] = 14] = "PaymentMethodSelected";
1599
+ SDKProductActionType[SDKProductActionType["PaymentAttempted"] = 15] = "PaymentAttempted";
1600
+ SDKProductActionType[SDKProductActionType["PaymentSucceeded"] = 16] = "PaymentSucceeded";
1601
+ SDKProductActionType[SDKProductActionType["PaymentFailed"] = 17] = "PaymentFailed";
1602
+ SDKProductActionType[SDKProductActionType["RefundInitiated"] = 18] = "RefundInitiated";
1537
1603
  })(SDKProductActionType || (SDKProductActionType = {}));
1538
1604
  var LogLevelType = {
1539
1605
  None: 'none',
@@ -3128,7 +3194,8 @@ var mParticle = (function () {
3128
3194
  UNHANDLED_EXCEPTION: 'UNHANDLED_EXCEPTION',
3129
3195
  IDENTITY_REQUEST: 'IDENTITY_REQUEST',
3130
3196
  IDENTITY_MISMATCH: 'IDENTITY_MISMATCH',
3131
- ROKT_KIT_ATTACHED: 'ROKT_KIT_ATTACHED'
3197
+ ROKT_KIT_ATTACHED: 'ROKT_KIT_ATTACHED',
3198
+ MP_DEPRECATED_METHOD_USAGE: 'MP_DEPRECATED_METHOD_USAGE'
3132
3199
  };
3133
3200
  var WSDKErrorSeverity = {
3134
3201
  ERROR: 'ERROR',
@@ -4278,6 +4345,14 @@ var mParticle = (function () {
4278
4345
  return new Date().getTime() > new Date(lastSyncDate).getTime() + frequencyCap * DAYS_IN_MILLISECONDS;
4279
4346
  };
4280
4347
 
4348
+ function logDeprecatedMethodUsage(usage, logger, loggingDispatcher) {
4349
+ logger.warning(usage.warningMessage);
4350
+ loggingDispatcher === null || loggingDispatcher === void 0 ? void 0 : loggingDispatcher.log({
4351
+ message: usage.methodName,
4352
+ code: ErrorCodes.MP_DEPRECATED_METHOD_USAGE
4353
+ });
4354
+ }
4355
+
4281
4356
  var Messages$6 = Constants.Messages;
4282
4357
  function SessionManager(mpInstance) {
4283
4358
  var self = this;
@@ -4308,7 +4383,10 @@ var mParticle = (function () {
4308
4383
  }
4309
4384
  };
4310
4385
  this.getSession = function () {
4311
- mpInstance.Logger.warning(generateDeprecationMessage('SessionManager.getSession()', false, 'SessionManager.getSessionId()'));
4386
+ logDeprecatedMethodUsage({
4387
+ methodName: 'SessionManager.getSession()',
4388
+ warningMessage: generateDeprecationMessage('SessionManager.getSession()', false, 'SessionManager.getSessionId()')
4389
+ }, mpInstance.Logger, mpInstance._LoggingDispatcher);
4312
4390
  return this.getSessionId();
4313
4391
  };
4314
4392
  this.getSessionId = function () {
@@ -4493,6 +4571,22 @@ var mParticle = (function () {
4493
4571
  return 'RemoveFromWishlist';
4494
4572
  case Types.ProductActionType.ViewDetail:
4495
4573
  return 'ViewDetail';
4574
+ case Types.ProductActionType.ViewCart:
4575
+ return 'ViewCart';
4576
+ case Types.ProductActionType.AddShippingInfo:
4577
+ return 'AddShippingInfo';
4578
+ case Types.ProductActionType.AddPaymentInfo:
4579
+ return 'AddPaymentInfo';
4580
+ case Types.ProductActionType.PaymentMethodSelected:
4581
+ return 'PaymentMethodSelected';
4582
+ case Types.ProductActionType.PaymentAttempted:
4583
+ return 'PaymentAttempted';
4584
+ case Types.ProductActionType.PaymentSucceeded:
4585
+ return 'PaymentSucceeded';
4586
+ case Types.ProductActionType.PaymentFailed:
4587
+ return 'PaymentFailed';
4588
+ case Types.ProductActionType.RefundInitiated:
4589
+ return 'RefundInitiated';
4496
4590
  case Types.ProductActionType.Unknown:
4497
4591
  default:
4498
4592
  return 'Unknown';
@@ -4534,6 +4628,17 @@ var mParticle = (function () {
4534
4628
  return Types.EventType.Unknown;
4535
4629
  case Types.ProductActionType.ViewDetail:
4536
4630
  return Types.CommerceEventType.ProductViewDetail;
4631
+
4632
+ // Rokt Brain commerce-adjacent types map to Unknown on server
4633
+ case Types.ProductActionType.ViewCart:
4634
+ case Types.ProductActionType.AddShippingInfo:
4635
+ case Types.ProductActionType.AddPaymentInfo:
4636
+ case Types.ProductActionType.PaymentMethodSelected:
4637
+ case Types.ProductActionType.PaymentAttempted:
4638
+ case Types.ProductActionType.PaymentSucceeded:
4639
+ case Types.ProductActionType.PaymentFailed:
4640
+ case Types.ProductActionType.RefundInitiated:
4641
+ return Types.EventType.Unknown;
4537
4642
  default:
4538
4643
  mpInstance.Logger.error('Could not convert product action type ' + productActionType + ' to event type');
4539
4644
  return null;
@@ -6333,6 +6438,10 @@ var mParticle = (function () {
6333
6438
  ProductActionType: productActionType,
6334
6439
  ProductList: productList
6335
6440
  };
6441
+ if (Types.ProductActionType.isRoktCommerceType(productActionType)) {
6442
+ event.CustomFlags = event.CustomFlags || {};
6443
+ event.CustomFlags['Rokt.CommerceEventType'] = Types.ProductActionType.getExpansionName(productActionType);
6444
+ }
6336
6445
  if (mpInstance._Helpers.isObject(transactionAttributes)) {
6337
6446
  mpInstance._Ecommerce.convertTransactionAttributesToProductAction(transactionAttributes, event.ProductAction);
6338
6447
  }
@@ -8770,7 +8879,10 @@ var mParticle = (function () {
8770
8879
  * @return a cart object
8771
8880
  */
8772
8881
  getCart: function getCart() {
8773
- mpInstance.Logger.warning('Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases');
8882
+ logDeprecatedMethodUsage({
8883
+ methodName: 'Identity.getCurrentUser().getCart()',
8884
+ warningMessage: 'Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases'
8885
+ }, mpInstance.Logger, mpInstance._LoggingDispatcher);
8774
8886
  return self.mParticleUserCart();
8775
8887
  },
8776
8888
  /**
@@ -8834,7 +8946,10 @@ var mParticle = (function () {
8834
8946
  * @deprecated
8835
8947
  */
8836
8948
  add: function add() {
8837
- mpInstance.Logger.warning(generateDeprecationMessage('Identity.getCurrentUser().getCart().add()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'));
8949
+ logDeprecatedMethodUsage({
8950
+ methodName: 'Identity.getCurrentUser().getCart().add()',
8951
+ warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().add()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
8952
+ }, mpInstance.Logger, mpInstance._LoggingDispatcher);
8838
8953
  },
8839
8954
  /**
8840
8955
  * Removes a cart product from the current user cart
@@ -8842,7 +8957,10 @@ var mParticle = (function () {
8842
8957
  * @deprecated
8843
8958
  */
8844
8959
  remove: function remove() {
8845
- mpInstance.Logger.warning(generateDeprecationMessage('Identity.getCurrentUser().getCart().remove()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'));
8960
+ logDeprecatedMethodUsage({
8961
+ methodName: 'Identity.getCurrentUser().getCart().remove()',
8962
+ warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().remove()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
8963
+ }, mpInstance.Logger, mpInstance._LoggingDispatcher);
8846
8964
  },
8847
8965
  /**
8848
8966
  * Clears the user's cart
@@ -8850,7 +8968,10 @@ var mParticle = (function () {
8850
8968
  * @deprecated
8851
8969
  */
8852
8970
  clear: function clear() {
8853
- mpInstance.Logger.warning(generateDeprecationMessage('Identity.getCurrentUser().getCart().clear()', true, '', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'));
8971
+ logDeprecatedMethodUsage({
8972
+ methodName: 'Identity.getCurrentUser().getCart().clear()',
8973
+ warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().clear()', true, '', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
8974
+ }, mpInstance.Logger, mpInstance._LoggingDispatcher);
8854
8975
  },
8855
8976
  /**
8856
8977
  * Returns all cart products
@@ -8859,7 +8980,10 @@ var mParticle = (function () {
8859
8980
  * @deprecated
8860
8981
  */
8861
8982
  getCartProducts: function getCartProducts() {
8862
- mpInstance.Logger.warning(generateDeprecationMessage('Identity.getCurrentUser().getCart().getCartProducts()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'));
8983
+ logDeprecatedMethodUsage({
8984
+ methodName: 'Identity.getCurrentUser().getCart().getCartProducts()',
8985
+ warningMessage: generateDeprecationMessage('Identity.getCurrentUser().getCart().getCartProducts()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
8986
+ }, mpInstance.Logger, mpInstance._LoggingDispatcher);
8863
8987
  return [];
8864
8988
  }
8865
8989
  };
@@ -8932,7 +9056,7 @@ var mParticle = (function () {
8932
9056
  newUser = mpInstance.Identity.getCurrentUser();
8933
9057
 
8934
9058
  // https://go.mparticle.com/work/SQDSDKS-6359
8935
- tryOnUserAlias(prevUser, newUser, identityApiData, mpInstance.Logger);
9059
+ tryOnUserAlias(prevUser, newUser, identityApiData, mpInstance.Logger, mpInstance._LoggingDispatcher);
8936
9060
  var persistence = mpInstance._Persistence.getPersistence();
8937
9061
  if (newUser) {
8938
9062
  mpInstance._Persistence.storeDataInMemory(persistence, newUser.getMPID());
@@ -9065,10 +9189,13 @@ var mParticle = (function () {
9065
9189
  }
9066
9190
 
9067
9191
  // https://go.mparticle.com/work/SQDSDKS-6359
9068
- function tryOnUserAlias(previousUser, newUser, identityApiData, logger) {
9192
+ function tryOnUserAlias(previousUser, newUser, identityApiData, logger, loggingDispatcher) {
9069
9193
  if (identityApiData && identityApiData.onUserAlias && isFunction(identityApiData.onUserAlias)) {
9070
9194
  try {
9071
- logger.warning(generateDeprecationMessage('onUserAlias'));
9195
+ logDeprecatedMethodUsage({
9196
+ methodName: 'onUserAlias',
9197
+ warningMessage: generateDeprecationMessage('onUserAlias')
9198
+ }, logger, loggingDispatcher);
9072
9199
  identityApiData.onUserAlias(previousUser, newUser);
9073
9200
  } catch (e) {
9074
9201
  logger.error('There was an error with your onUserAlias function - ' + e);
@@ -9349,7 +9476,10 @@ var mParticle = (function () {
9349
9476
  }
9350
9477
  // TODO: Can we remove this? It is deprecated.
9351
9478
  function removeCCPAState() {
9352
- mpInstance.Logger.warning('removeCCPAState is deprecated and will be removed in a future release; use removeCCPAConsentState instead');
9479
+ logDeprecatedMethodUsage({
9480
+ methodName: 'Consent.removeCCPAState',
9481
+ warningMessage: 'removeCCPAState is deprecated and will be removed in a future release; use removeCCPAConsentState instead'
9482
+ }, mpInstance.Logger, mpInstance._LoggingDispatcher);
9353
9483
  // @ts-ignore
9354
9484
  return removeCCPAConsentState();
9355
9485
  }
@@ -11179,6 +11309,7 @@ var mParticle = (function () {
11179
11309
  this.CommerceEventType = CommerceEventType;
11180
11310
  this.PromotionType = PromotionActionType;
11181
11311
  this.ProductActionType = ProductActionType;
11312
+ this.RoktEvents = RoktEvents;
11182
11313
  this._Identity = new Identity(this);
11183
11314
  this.Identity = this._Identity.IdentityAPI;
11184
11315
  this.generateHash = this._Helpers.generateHash;
@@ -11651,7 +11782,10 @@ var mParticle = (function () {
11651
11782
  * @deprecated
11652
11783
  */
11653
11784
  add: function add(product, logEventBoolean) {
11654
- self.Logger.warning(generateDeprecationMessage('eCommerce.Cart.add()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'));
11785
+ logDeprecatedMethodUsage({
11786
+ methodName: 'mPInstance.eCommerce.Cart.add()',
11787
+ warningMessage: generateDeprecationMessage('eCommerce.Cart.add()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
11788
+ }, self.Logger, self._LoggingDispatcher);
11655
11789
  },
11656
11790
  /**
11657
11791
  * Removes a product from the cart
@@ -11661,7 +11795,10 @@ var mParticle = (function () {
11661
11795
  * @deprecated
11662
11796
  */
11663
11797
  remove: function remove(product, logEventBoolean) {
11664
- self.Logger.warning(generateDeprecationMessage('eCommerce.Cart.remove()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'));
11798
+ logDeprecatedMethodUsage({
11799
+ methodName: 'mPInstance.eCommerce.Cart.remove()',
11800
+ warningMessage: generateDeprecationMessage('eCommerce.Cart.remove()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
11801
+ }, self.Logger, self._LoggingDispatcher);
11665
11802
  },
11666
11803
  /**
11667
11804
  * Clears the cart
@@ -11669,7 +11806,10 @@ var mParticle = (function () {
11669
11806
  * @deprecated
11670
11807
  */
11671
11808
  clear: function clear() {
11672
- self.Logger.warning(generateDeprecationMessage('eCommerce.Cart.clear()', true, '', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'));
11809
+ logDeprecatedMethodUsage({
11810
+ methodName: 'mPInstance.eCommerce.Cart.clear()',
11811
+ warningMessage: generateDeprecationMessage('eCommerce.Cart.clear()', true, '', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking')
11812
+ }, self.Logger, self._LoggingDispatcher);
11673
11813
  }
11674
11814
  },
11675
11815
  /**
@@ -11755,7 +11895,10 @@ var mParticle = (function () {
11755
11895
  * @deprecated
11756
11896
  */
11757
11897
  logCheckout: function logCheckout(step, option, attrs, customFlags) {
11758
- self.Logger.warning('mParticle.logCheckout is deprecated, please use mParticle.logProductAction instead');
11898
+ logDeprecatedMethodUsage({
11899
+ methodName: 'mParticle.logCheckout',
11900
+ warningMessage: 'mParticle.logCheckout is deprecated, please use mParticle.logProductAction instead'
11901
+ }, self.Logger, self._LoggingDispatcher);
11759
11902
  if (!self._Store.isInitialized) {
11760
11903
  self.ready(function () {
11761
11904
  self.eCommerce.logCheckout(step, option, attrs, customFlags);
@@ -11796,7 +11939,10 @@ var mParticle = (function () {
11796
11939
  * @deprecated
11797
11940
  */
11798
11941
  logPurchase: function logPurchase(transactionAttributes, product, clearCart, attrs, customFlags) {
11799
- self.Logger.warning('mParticle.logPurchase is deprecated, please use mParticle.logProductAction instead');
11942
+ logDeprecatedMethodUsage({
11943
+ methodName: 'mParticle.logPurchase',
11944
+ warningMessage: 'mParticle.logPurchase is deprecated, please use mParticle.logProductAction instead'
11945
+ }, self.Logger, self._LoggingDispatcher);
11800
11946
  if (!self._Store.isInitialized) {
11801
11947
  self.ready(function () {
11802
11948
  self.eCommerce.logPurchase(transactionAttributes, product, clearCart, attrs, customFlags);
@@ -11857,7 +12003,10 @@ var mParticle = (function () {
11857
12003
  * @deprecated
11858
12004
  */
11859
12005
  logRefund: function logRefund(transactionAttributes, product, clearCart, attrs, customFlags) {
11860
- self.Logger.warning('mParticle.logRefund is deprecated, please use mParticle.logProductAction instead');
12006
+ logDeprecatedMethodUsage({
12007
+ methodName: 'mParticle.logRefund',
12008
+ warningMessage: 'mParticle.logRefund is deprecated, please use mParticle.logProductAction instead'
12009
+ }, self.Logger, self._LoggingDispatcher);
11861
12010
  if (!self._Store.isInitialized) {
11862
12011
  self.ready(function () {
11863
12012
  self.eCommerce.logRefund(transactionAttributes, product, clearCart, attrs, customFlags);
@@ -12530,6 +12679,7 @@ var mParticle = (function () {
12530
12679
  this.CommerceEventType = CommerceEventType;
12531
12680
  this.PromotionType = PromotionActionType;
12532
12681
  this.ProductActionType = ProductActionType;
12682
+ this.RoktEvents = RoktEvents;
12533
12683
  this.MPSideloadedKit = MPSideloadedKit;
12534
12684
  if (typeof window !== 'undefined') {
12535
12685
  this.isIOS = window.mParticle && window.mParticle.isIOS ? window.mParticle.isIOS : false;
@@ -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;
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-sdk",
3
- "version": "2.68.0",
3
+ "version": "2.69.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,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
- mpInstance.Logger.warning(
509
- 'removeCCPAState is deprecated and will be removed in a future release; use removeCCPAConsentState instead'
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,