@mparticle/web-sdk 2.47.0 → 2.48.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.47.0";
206
+ var version = "2.48.0";
207
207
 
208
208
  var Constants = {
209
209
  sdkVersion: version,
@@ -211,7 +211,8 @@ var mParticle = (function () {
211
211
  platform: 'web',
212
212
  Messages: {
213
213
  DeprecationMessages: {
214
- MethodIsDeprecatedPostfix: 'is a deprecated method and will be removed in future releases',
214
+ MethodHasBeenDeprecated: 'has been deprecated.',
215
+ MethodMarkedForDeprecationPostfix: 'is a deprecated method and will be removed in future releases.',
215
216
  AlternativeMethodPrefix: 'Please use the alternate method:'
216
217
  },
217
218
  ErrorMessages: {
@@ -400,6 +401,9 @@ var mParticle = (function () {
400
401
  All: 'all',
401
402
  None: 'none',
402
403
  RoktOnly: 'roktonly'
404
+ },
405
+ Rokt: {
406
+ LauncherInstanceGuidKey: '__rokt_li_guid__'
403
407
  }
404
408
  };
405
409
  // https://go.mparticle.com/work/SQDSDKS-6080
@@ -411,7 +415,6 @@ var mParticle = (function () {
411
415
  var HTTP_BAD_REQUEST = 400;
412
416
  var StoragePrivacyMap = {
413
417
  SDKState: 'functional',
414
- Products: 'targeting',
415
418
  OfflineEvents: 'functional',
416
419
  IdentityCache: 'functional',
417
420
  TimeOnSite: 'targeting'
@@ -545,11 +548,19 @@ var mParticle = (function () {
545
548
  }
546
549
  return null;
547
550
  };
548
- var generateDeprecationMessage = function generateDeprecationMessage(methodName, alternateMethod) {
549
- var messageArray = [methodName, Messages$9.DeprecationMessages.MethodIsDeprecatedPostfix];
551
+ var generateDeprecationMessage = function generateDeprecationMessage(methodName, isDeprecated, alternateMethod, docsUrl) {
552
+ var messageArray = [methodName];
553
+ if (isDeprecated) {
554
+ messageArray.push(Messages$9.DeprecationMessages.MethodHasBeenDeprecated);
555
+ } else {
556
+ messageArray.push(Messages$9.DeprecationMessages.MethodMarkedForDeprecationPostfix);
557
+ }
550
558
  if (alternateMethod) {
551
- messageArray.push(alternateMethod);
552
- messageArray.push(Messages$9.DeprecationMessages.MethodIsDeprecatedPostfix);
559
+ messageArray.push(Messages$9.DeprecationMessages.AlternativeMethodPrefix);
560
+ messageArray.push(alternateMethod + ".");
561
+ }
562
+ if (docsUrl) {
563
+ messageArray.push("See - " + docsUrl);
553
564
  }
554
565
  return messageArray.join(' ');
555
566
  };
@@ -1202,6 +1213,9 @@ var mParticle = (function () {
1202
1213
  var ApplicationTransitionType$1 = {
1203
1214
  AppInit: 1
1204
1215
  };
1216
+ var PerformanceMarkType = {
1217
+ SdkStart: 'mp:sdkStart'
1218
+ };
1205
1219
  var Types = {
1206
1220
  MessageType: MessageType$1,
1207
1221
  EventType: EventType,
@@ -3323,13 +3337,6 @@ var mParticle = (function () {
3323
3337
  return StorageNames$1.currentStorageName;
3324
3338
  }
3325
3339
  };
3326
- this.createProductStorageName = function (workspaceToken) {
3327
- if (workspaceToken) {
3328
- return StorageNames$1.currentStorageProductsName + '_' + workspaceToken;
3329
- } else {
3330
- return StorageNames$1.currentStorageProductsName;
3331
- }
3332
- };
3333
3340
 
3334
3341
  // TODO: Refactor SDK to directly use these methods
3335
3342
  // https://go.mparticle.com/work/SQDSDKS-5239
@@ -3735,7 +3742,7 @@ var mParticle = (function () {
3735
3742
  }
3736
3743
  };
3737
3744
  this.getSession = function () {
3738
- mpInstance.Logger.warning(generateDeprecationMessage('SessionManager.getSession()', 'SessionManager.getSessionId()'));
3745
+ mpInstance.Logger.warning(generateDeprecationMessage('SessionManager.getSession()', false, 'SessionManager.getSessionId()'));
3739
3746
  return this.getSessionId();
3740
3747
  };
3741
3748
  this.getSessionId = function () {
@@ -4391,9 +4398,7 @@ var mParticle = (function () {
4391
4398
  // TODO: Merge this with SDKStoreApi in sdkRuntimeModels
4392
4399
  function Store(config, mpInstance, apiKey) {
4393
4400
  var _this = this;
4394
- var _a = mpInstance._Helpers,
4395
- createMainStorageName = _a.createMainStorageName,
4396
- createProductStorageName = _a.createProductStorageName;
4401
+ var createMainStorageName = mpInstance._Helpers.createMainStorageName;
4397
4402
  var isWebviewEnabled = mpInstance._NativeSdkHelpers.isWebviewEnabled;
4398
4403
  var defaultStore = {
4399
4404
  isEnabled: true,
@@ -4430,7 +4435,6 @@ var mParticle = (function () {
4430
4435
  requireDelay: true,
4431
4436
  isLocalStorageAvailable: null,
4432
4437
  storageName: null,
4433
- prodStorageName: null,
4434
4438
  activeForwarders: [],
4435
4439
  kits: {},
4436
4440
  sideloadedKits: [],
@@ -4769,7 +4773,6 @@ var mParticle = (function () {
4769
4773
  }
4770
4774
  // add a new function to apply items to the store that require config to be returned
4771
4775
  _this.storageName = createMainStorageName(workspaceToken);
4772
- _this.prodStorageName = createProductStorageName(workspaceToken);
4773
4776
  _this.SDKConfig.requiredWebviewBridgeName = requiredWebviewBridgeName || workspaceToken;
4774
4777
  _this.webviewBridgeEnabled = isWebviewEnabled(_this.SDKConfig.requiredWebviewBridgeName, _this.SDKConfig.minWebviewBridgeVersion);
4775
4778
  _this.configurationLoaded = true;
@@ -4996,25 +4999,6 @@ var mParticle = (function () {
4996
4999
  self.storeDataInMemory(cookies);
4997
5000
  }
4998
5001
 
4999
- // https://go.mparticle.com/work/SQDSDKS-6048
5000
- try {
5001
- if (mpInstance._Store.isLocalStorageAvailable) {
5002
- var encodedProducts = localStorage.getItem(mpInstance._Store.prodStorageName);
5003
- if (encodedProducts) {
5004
- var decodedProducts = JSON.parse(Base64.decode(encodedProducts));
5005
- }
5006
- if (mpInstance._Store.mpid) {
5007
- self.storeProductsInMemory(decodedProducts, mpInstance._Store.mpid);
5008
- }
5009
- }
5010
- } catch (e) {
5011
- if (mpInstance._Store.isLocalStorageAvailable) {
5012
- localStorage.removeItem(mpInstance._Store.prodStorageName);
5013
- }
5014
- mpInstance._Store.cartProducts = [];
5015
- mpInstance.Logger.error('Error loading products in initialization: ' + e);
5016
- }
5017
-
5018
5002
  // https://go.mparticle.com/work/SQDSDKS-6046
5019
5003
  // Stores all non-current user MPID information into the store
5020
5004
  for (var key in allData) {
@@ -5044,15 +5028,6 @@ var mParticle = (function () {
5044
5028
  self.setLocalStorage();
5045
5029
  }
5046
5030
  };
5047
- this.storeProductsInMemory = function (products, mpid) {
5048
- if (products) {
5049
- try {
5050
- mpInstance._Store.cartProducts = products[mpid] && products[mpid].cp ? products[mpid].cp : [];
5051
- } catch (e) {
5052
- mpInstance.Logger.error(Messages$4.ErrorMessages.CookieParseError);
5053
- }
5054
- }
5055
- };
5056
5031
 
5057
5032
  // https://go.mparticle.com/work/SQDSDKS-6045
5058
5033
  this.storeDataInMemory = function (obj, currentMPID) {
@@ -5123,51 +5098,6 @@ var mParticle = (function () {
5123
5098
  return false;
5124
5099
  }
5125
5100
  };
5126
- this.getUserProductsFromLS = function (mpid) {
5127
- if (!mpInstance._Store.isLocalStorageAvailable) {
5128
- return [];
5129
- }
5130
- var decodedProducts,
5131
- userProducts,
5132
- parsedProducts,
5133
- encodedProducts = localStorage.getItem(mpInstance._Store.prodStorageName);
5134
- if (encodedProducts) {
5135
- decodedProducts = Base64.decode(encodedProducts);
5136
- }
5137
- // if there is an MPID, we are retrieving the user's products, which is an array
5138
- if (mpid) {
5139
- try {
5140
- if (decodedProducts) {
5141
- parsedProducts = JSON.parse(decodedProducts);
5142
- }
5143
- if (decodedProducts && parsedProducts[mpid] && parsedProducts[mpid].cp && Array.isArray(parsedProducts[mpid].cp)) {
5144
- userProducts = parsedProducts[mpid].cp;
5145
- } else {
5146
- userProducts = [];
5147
- }
5148
- return userProducts;
5149
- } catch (e) {
5150
- return [];
5151
- }
5152
- } else {
5153
- return [];
5154
- }
5155
- };
5156
- this.getAllUserProductsFromLS = function () {
5157
- var decodedProducts,
5158
- encodedProducts = localStorage.getItem(mpInstance._Store.prodStorageName),
5159
- parsedDecodedProducts;
5160
- if (encodedProducts) {
5161
- decodedProducts = Base64.decode(encodedProducts);
5162
- }
5163
- // returns an object with keys of MPID and values of array of products
5164
- try {
5165
- parsedDecodedProducts = JSON.parse(decodedProducts);
5166
- } catch (e) {
5167
- parsedDecodedProducts = {};
5168
- }
5169
- return parsedDecodedProducts;
5170
- };
5171
5101
 
5172
5102
  // https://go.mparticle.com/work/SQDSDKS-6021
5173
5103
  this.setLocalStorage = function () {
@@ -5175,22 +5105,9 @@ var mParticle = (function () {
5175
5105
  return;
5176
5106
  }
5177
5107
  var key = mpInstance._Store.storageName,
5178
- allLocalStorageProducts = self.getAllUserProductsFromLS(),
5179
5108
  localStorageData = self.getLocalStorage() || {},
5180
5109
  currentUser = mpInstance.Identity.getCurrentUser(),
5181
- mpid = currentUser ? currentUser.getMPID() : null,
5182
- currentUserProducts = {
5183
- cp: allLocalStorageProducts[mpid] ? allLocalStorageProducts[mpid].cp : []
5184
- };
5185
- if (mpid) {
5186
- allLocalStorageProducts = allLocalStorageProducts || {};
5187
- allLocalStorageProducts[mpid] = currentUserProducts;
5188
- try {
5189
- window.localStorage.setItem(encodeURIComponent(mpInstance._Store.prodStorageName), Base64.encode(JSON.stringify(allLocalStorageProducts)));
5190
- } catch (e) {
5191
- mpInstance.Logger.error('Error with setting products on localStorage.');
5192
- }
5193
- }
5110
+ mpid = currentUser ? currentUser.getMPID() : null;
5194
5111
  if (!mpInstance._Store.SDKConfig.useCookieStorage) {
5195
5112
  localStorageData.gs = localStorageData.gs || {};
5196
5113
  localStorageData.l = mpInstance._Store.isLoggedIn ? 1 : 0;
@@ -5559,27 +5476,6 @@ var mParticle = (function () {
5559
5476
  }
5560
5477
  return '';
5561
5478
  };
5562
- this.getCartProducts = function (mpid) {
5563
- var allCartProducts,
5564
- cartProductsString = localStorage.getItem(mpInstance._Store.prodStorageName);
5565
- if (cartProductsString) {
5566
- allCartProducts = JSON.parse(Base64.decode(cartProductsString));
5567
- if (allCartProducts && allCartProducts[mpid] && allCartProducts[mpid].cp) {
5568
- return allCartProducts[mpid].cp;
5569
- }
5570
- }
5571
- return [];
5572
- };
5573
- this.setCartProducts = function (allProducts) {
5574
- if (!mpInstance._Store.isLocalStorageAvailable) {
5575
- return;
5576
- }
5577
- try {
5578
- window.localStorage.setItem(encodeURIComponent(mpInstance._Store.prodStorageName), Base64.encode(JSON.stringify(allProducts)));
5579
- } catch (e) {
5580
- mpInstance.Logger.error('Error with setting products on localStorage.');
5581
- }
5582
- };
5583
5479
  this.saveUserCookieSyncDatesToPersistence = function (mpid, csd) {
5584
5480
  if (csd) {
5585
5481
  var persistence = self.getPersistence();
@@ -5719,20 +5615,17 @@ var mParticle = (function () {
5719
5615
  removeLocalStorage(StorageNames.localStorageName);
5720
5616
  removeLocalStorage(StorageNames.localStorageNameV3);
5721
5617
  removeLocalStorage(StorageNames.localStorageNameV4);
5722
- removeLocalStorage(mpInstance._Store.prodStorageName);
5723
5618
  removeLocalStorage(mpInstance._Store.storageName);
5724
5619
  removeLocalStorage(StorageNames.localStorageProductsV4);
5725
5620
  self.expireCookies(StorageNames.cookieName);
5726
5621
  self.expireCookies(StorageNames.cookieNameV2);
5727
5622
  self.expireCookies(StorageNames.cookieNameV3);
5728
5623
  self.expireCookies(StorageNames.cookieNameV4);
5729
- self.expireCookies(mpInstance._Store.prodStorageName);
5730
5624
  self.expireCookies(mpInstance._Store.storageName);
5731
5625
  if (mParticle._isTestEnv) {
5732
5626
  var testWorkspaceToken = 'abcdef';
5733
5627
  removeLocalStorage(mpInstance._Helpers.createMainStorageName(testWorkspaceToken));
5734
5628
  self.expireCookies(mpInstance._Helpers.createMainStorageName(testWorkspaceToken));
5735
- removeLocalStorage(mpInstance._Helpers.createProductStorageName(testWorkspaceToken));
5736
5629
  }
5737
5630
  };
5738
5631
 
@@ -8151,7 +8044,7 @@ var mParticle = (function () {
8151
8044
  */
8152
8045
  getCart: function getCart() {
8153
8046
  mpInstance.Logger.warning('Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases');
8154
- return self.mParticleUserCart(mpid);
8047
+ return self.mParticleUserCart();
8155
8048
  },
8156
8049
  /**
8157
8050
  * Returns the Consent State stored locally for this user.
@@ -8206,84 +8099,23 @@ var mParticle = (function () {
8206
8099
  * @class mParticle.Identity.getCurrentUser().getCart()
8207
8100
  * @deprecated
8208
8101
  */
8209
- this.mParticleUserCart = function (mpid) {
8102
+ this.mParticleUserCart = function () {
8210
8103
  return {
8211
8104
  /**
8212
8105
  * Adds a cart product to the user cart
8213
8106
  * @method add
8214
- * @param {Object} product the product
8215
- * @param {Boolean} [logEvent] a boolean to log adding of the cart object. If blank, no logging occurs.
8216
8107
  * @deprecated
8217
8108
  */
8218
- add: function add(product, logEvent) {
8219
- mpInstance.Logger.warning('Deprecated function Identity.getCurrentUser().getCart().add() will be removed in future releases');
8220
- var allProducts, userProducts, arrayCopy;
8221
- arrayCopy = Array.isArray(product) ? product.slice() : [product];
8222
- arrayCopy.forEach(function (product) {
8223
- product.Attributes = mpInstance._Helpers.sanitizeAttributes(product.Attributes);
8224
- });
8225
- if (mpInstance._Store.webviewBridgeEnabled) {
8226
- mpInstance._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.AddToCart, JSON.stringify(arrayCopy));
8227
- } else {
8228
- mpInstance._SessionManager.resetSessionTimer();
8229
- userProducts = mpInstance._Persistence.getUserProductsFromLS(mpid);
8230
- userProducts = userProducts.concat(arrayCopy);
8231
- if (logEvent === true) {
8232
- mpInstance._Events.logProductActionEvent(Types.ProductActionType.AddToCart, arrayCopy);
8233
- }
8234
- var productsForMemory = {};
8235
- productsForMemory[mpid] = {
8236
- cp: userProducts
8237
- };
8238
- if (userProducts.length > mpInstance._Store.SDKConfig.maxProducts) {
8239
- mpInstance.Logger.verbose('The cart contains ' + userProducts.length + ' items. Only ' + mpInstance._Store.SDKConfig.maxProducts + ' can currently be saved in cookies.');
8240
- userProducts = userProducts.slice(-mpInstance._Store.SDKConfig.maxProducts);
8241
- }
8242
- allProducts = mpInstance._Persistence.getAllUserProductsFromLS();
8243
- allProducts[mpid].cp = userProducts;
8244
- mpInstance._Persistence.setCartProducts(allProducts);
8245
- }
8109
+ add: function add() {
8110
+ mpInstance.Logger.warning(generateDeprecationMessage('Identity.getCurrentUser().getCart().add()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'));
8246
8111
  },
8247
8112
  /**
8248
8113
  * Removes a cart product from the current user cart
8249
8114
  * @method remove
8250
- * @param {Object} product the product
8251
- * @param {Boolean} [logEvent] a boolean to log adding of the cart object. If blank, no logging occurs.
8252
8115
  * @deprecated
8253
8116
  */
8254
- remove: function remove(product, logEvent) {
8255
- mpInstance.Logger.warning('Deprecated function Identity.getCurrentUser().getCart().remove() will be removed in future releases');
8256
- var allProducts,
8257
- userProducts,
8258
- cartIndex = -1,
8259
- cartItem = null;
8260
- if (mpInstance._Store.webviewBridgeEnabled) {
8261
- mpInstance._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.RemoveFromCart, JSON.stringify(product));
8262
- } else {
8263
- mpInstance._SessionManager.resetSessionTimer();
8264
- userProducts = mpInstance._Persistence.getUserProductsFromLS(mpid);
8265
- if (userProducts) {
8266
- userProducts.forEach(function (cartProduct, i) {
8267
- if (cartProduct.Sku === product.Sku) {
8268
- cartIndex = i;
8269
- cartItem = cartProduct;
8270
- }
8271
- });
8272
- if (cartIndex > -1) {
8273
- userProducts.splice(cartIndex, 1);
8274
- if (logEvent === true) {
8275
- mpInstance._Events.logProductActionEvent(Types.ProductActionType.RemoveFromCart, cartItem);
8276
- }
8277
- }
8278
- }
8279
- var productsForMemory = {};
8280
- productsForMemory[mpid] = {
8281
- cp: userProducts
8282
- };
8283
- allProducts = mpInstance._Persistence.getAllUserProductsFromLS();
8284
- allProducts[mpid].cp = userProducts;
8285
- mpInstance._Persistence.setCartProducts(allProducts);
8286
- }
8117
+ remove: function remove() {
8118
+ mpInstance.Logger.warning(generateDeprecationMessage('Identity.getCurrentUser().getCart().remove()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'));
8287
8119
  },
8288
8120
  /**
8289
8121
  * Clears the user's cart
@@ -8291,19 +8123,7 @@ var mParticle = (function () {
8291
8123
  * @deprecated
8292
8124
  */
8293
8125
  clear: function clear() {
8294
- mpInstance.Logger.warning('Deprecated function Identity.getCurrentUser().getCart().clear() will be removed in future releases');
8295
- var allProducts;
8296
- if (mpInstance._Store.webviewBridgeEnabled) {
8297
- mpInstance._NativeSdkHelpers.sendToNative(Constants.NativeSdkPaths.ClearCart);
8298
- } else {
8299
- mpInstance._SessionManager.resetSessionTimer();
8300
- allProducts = mpInstance._Persistence.getAllUserProductsFromLS();
8301
- if (allProducts && allProducts[mpid] && allProducts[mpid].cp) {
8302
- allProducts[mpid].cp = [];
8303
- allProducts[mpid].cp = [];
8304
- mpInstance._Persistence.setCartProducts(allProducts);
8305
- }
8306
- }
8126
+ mpInstance.Logger.warning(generateDeprecationMessage('Identity.getCurrentUser().getCart().clear()', true, '', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'));
8307
8127
  },
8308
8128
  /**
8309
8129
  * Returns all cart products
@@ -8312,8 +8132,8 @@ var mParticle = (function () {
8312
8132
  * @deprecated
8313
8133
  */
8314
8134
  getCartProducts: function getCartProducts() {
8315
- mpInstance.Logger.warning('Deprecated function Identity.getCurrentUser().getCart().getCartProducts() will be removed in future releases');
8316
- return mpInstance._Persistence.getCartProducts(mpid);
8135
+ mpInstance.Logger.warning(generateDeprecationMessage('Identity.getCurrentUser().getCart().getCartProducts()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'));
8136
+ return [];
8317
8137
  }
8318
8138
  };
8319
8139
  };
@@ -10647,13 +10467,7 @@ var mParticle = (function () {
10647
10467
  * @deprecated
10648
10468
  */
10649
10469
  add: function add(product, logEventBoolean) {
10650
- self.Logger.warning('Deprecated function eCommerce.Cart.add() will be removed in future releases');
10651
- var mpid;
10652
- var currentUser = self.Identity.getCurrentUser();
10653
- if (currentUser) {
10654
- mpid = currentUser.getMPID();
10655
- }
10656
- self._Identity.mParticleUserCart(mpid).add(product, logEventBoolean);
10470
+ self.Logger.warning(generateDeprecationMessage('eCommerce.Cart.add()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'));
10657
10471
  },
10658
10472
  /**
10659
10473
  * Removes a product from the cart
@@ -10663,13 +10477,7 @@ var mParticle = (function () {
10663
10477
  * @deprecated
10664
10478
  */
10665
10479
  remove: function remove(product, logEventBoolean) {
10666
- self.Logger.warning('Deprecated function eCommerce.Cart.remove() will be removed in future releases');
10667
- var mpid;
10668
- var currentUser = self.Identity.getCurrentUser();
10669
- if (currentUser) {
10670
- mpid = currentUser.getMPID();
10671
- }
10672
- self._Identity.mParticleUserCart(mpid).remove(product, logEventBoolean);
10480
+ self.Logger.warning(generateDeprecationMessage('eCommerce.Cart.remove()', true, 'eCommerce.logProductAction()', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'));
10673
10481
  },
10674
10482
  /**
10675
10483
  * Clears the cart
@@ -10677,13 +10485,7 @@ var mParticle = (function () {
10677
10485
  * @deprecated
10678
10486
  */
10679
10487
  clear: function clear() {
10680
- self.Logger.warning('Deprecated function eCommerce.Cart.clear() will be removed in future releases');
10681
- var mpid;
10682
- var currentUser = self.Identity.getCurrentUser();
10683
- if (currentUser) {
10684
- mpid = currentUser.getMPID();
10685
- }
10686
- self._Identity.mParticleUserCart(mpid).clear();
10488
+ self.Logger.warning(generateDeprecationMessage('eCommerce.Cart.clear()', true, '', 'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'));
10687
10489
  }
10688
10490
  },
10689
10491
  /**
@@ -11075,6 +10877,18 @@ var mParticle = (function () {
11075
10877
  };
11076
10878
  }
11077
10879
  };
10880
+ var launcherInstanceGuidKey = Constants.Rokt.LauncherInstanceGuidKey;
10881
+ this.setLauncherInstanceGuid = function () {
10882
+ if (!window[launcherInstanceGuidKey] || typeof window[launcherInstanceGuidKey] !== 'string') {
10883
+ window[launcherInstanceGuidKey] = self._Helpers.generateUniqueId();
10884
+ }
10885
+ };
10886
+ this.captureTiming = function (metricsName) {
10887
+ var _a;
10888
+ if (typeof window !== 'undefined' && ((_a = window.performance) === null || _a === void 0 ? void 0 : _a.mark)) {
10889
+ window.performance.mark(metricsName);
10890
+ }
10891
+ };
11078
10892
  }
11079
10893
  // Some (server) config settings need to be returned before they are set on SDKConfig in a self hosted environment
11080
10894
  function completeSDKInitialization(apiKey, config, mpInstance) {
@@ -11514,8 +11328,13 @@ var mParticle = (function () {
11514
11328
  client = new mParticleInstance(instanceName);
11515
11329
  self._instances[instanceName] = client;
11516
11330
  }
11331
+ client.captureTiming(PerformanceMarkType.SdkStart);
11332
+ client.setLauncherInstanceGuid();
11517
11333
  client.init(apiKey, config, instanceName);
11518
11334
  };
11335
+ this.captureTiming = function (metricsName) {
11336
+ self.getInstance().captureTiming(metricsName);
11337
+ };
11519
11338
  this.getInstance = function getInstance(instanceName) {
11520
11339
  var client;
11521
11340
  if (!instanceName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-sdk",
3
- "version": "2.47.0",
3
+ "version": "2.48.0",
4
4
  "description": "mParticle core SDK for web applications",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -61,7 +61,7 @@
61
61
  "test:karma:rollup:cjs": "cross-env BUNDLER=rollup karma start test/integrations/cjs/karma.rollup.config.js",
62
62
  "test:karma:webpack:module": "cross-env BUNDLER=webpack karma start test/integrations/module/karma.webpack.config.js",
63
63
  "test:karma:rollup:module": "cross-env BUNDLER=rollup karma start test/integrations/module/karma.rollup.config.js",
64
- "test:jest": "jest --config jest.config.js",
64
+ "test:jest": "npm run build && jest --config jest.config.js",
65
65
  "test:jest:watch": "jest --config jest.config.js --watch",
66
66
  "watch": "cross-env ENVIRONMENT=dev BUILD=iife rollup --config rollup.config.js -w",
67
67
  "watch:all": "cross-env ENVIRONMENT=prod BUILDALL=true rollup --config rollup.config.js -w",
package/src/constants.ts CHANGED
@@ -6,8 +6,9 @@ const Constants = {
6
6
  platform: 'web',
7
7
  Messages: {
8
8
  DeprecationMessages: {
9
- MethodIsDeprecatedPostfix:
10
- 'is a deprecated method and will be removed in future releases',
9
+ MethodHasBeenDeprecated: 'has been deprecated.',
10
+ MethodMarkedForDeprecationPostfix:
11
+ 'is a deprecated method and will be removed in future releases.',
11
12
  AlternativeMethodPrefix: 'Please use the alternate method:',
12
13
  },
13
14
  ErrorMessages: {
@@ -213,6 +214,9 @@ const Constants = {
213
214
  None: 'none',
214
215
  RoktOnly: 'roktonly',
215
216
  },
217
+ Rokt: {
218
+ LauncherInstanceGuidKey: '__rokt_li_guid__',
219
+ },
216
220
  } as const;
217
221
 
218
222
  export default Constants;
@@ -232,11 +236,10 @@ export const HTTP_SERVER_ERROR = 500 as const;
232
236
 
233
237
  export type PrivacyControl = 'functional' | 'targeting';
234
238
 
235
- export type StorageTypes = 'SDKState' | 'Products' | 'OfflineEvents' | 'IdentityCache' | 'TimeOnSite';
239
+ export type StorageTypes = 'SDKState' | 'OfflineEvents' | 'IdentityCache' | 'TimeOnSite';
236
240
 
237
241
  export const StoragePrivacyMap: Record<StorageTypes, PrivacyControl> = {
238
242
  SDKState: 'functional',
239
- Products: 'targeting',
240
243
  OfflineEvents: 'functional',
241
244
  IdentityCache: 'functional',
242
245
  TimeOnSite: 'targeting',
package/src/helpers.js CHANGED
@@ -376,16 +376,6 @@ export default function Helpers(mpInstance) {
376
376
  }
377
377
  };
378
378
 
379
- this.createProductStorageName = function(workspaceToken) {
380
- if (workspaceToken) {
381
- return (
382
- StorageNames.currentStorageProductsName + '_' + workspaceToken
383
- );
384
- } else {
385
- return StorageNames.currentStorageProductsName;
386
- }
387
- };
388
-
389
379
  // TODO: Refactor SDK to directly use these methods
390
380
  // https://go.mparticle.com/work/SQDSDKS-5239
391
381
  // Utility Functions
@@ -115,8 +115,8 @@ export interface IdentityModifyResultBody {
115
115
  }
116
116
 
117
117
  export interface mParticleUserCart {
118
- add(product: SDKProduct | SDKProduct[], logEvent: boolean): void;
119
- remove(product: SDKProduct | SDKProduct[], logEvent: boolean): void;
118
+ add(): void;
119
+ remove(): void;
120
120
  clear(): void;
121
121
  getCartProducts(): SDKProduct[];
122
122
  }
@@ -206,5 +206,5 @@ export interface IIdentity {
206
206
  /**
207
207
  * @deprecated
208
208
  */
209
- mParticleUserCart(mpid: MPID): mParticleUserCart;
209
+ mParticleUserCart(): mParticleUserCart;
210
210
  }