@@ -1286,6 +1286,7 @@ export default function Identity(mpInstance) {
12861286 * @class mParticle.Identity.getCurrentUser().getCart()
12871287 * @deprecated
12881288 */
1289+ // eslint-disable-next-line no-unused-vars
12891290 this . mParticleUserCart = function ( mpid ) {
12901291 return {
12911292 /**
@@ -1295,66 +1296,11 @@ export default function Identity(mpInstance) {
12951296 * @param {Boolean } [logEvent] a boolean to log adding of the cart object. If blank, no logging occurs.
12961297 * @deprecated
12971298 */
1299+ // eslint-disable-next-line no-unused-vars
12981300 add : function ( product , logEvent ) {
12991301 mpInstance . Logger . warning (
1300- 'Deprecated function Identity.getCurrentUser().getCart().add() will be removed in future releases '
1302+ 'Deprecated function Identity.getCurrentUser().getCart().add()'
13011303 ) ;
1302- var allProducts , userProducts , arrayCopy ;
1303-
1304- arrayCopy = Array . isArray ( product )
1305- ? product . slice ( )
1306- : [ product ] ;
1307- arrayCopy . forEach ( function ( product ) {
1308- product . Attributes = mpInstance . _Helpers . sanitizeAttributes (
1309- product . Attributes
1310- ) ;
1311- } ) ;
1312-
1313- if ( mpInstance . _Store . webviewBridgeEnabled ) {
1314- mpInstance . _NativeSdkHelpers . sendToNative (
1315- Constants . NativeSdkPaths . AddToCart ,
1316- JSON . stringify ( arrayCopy )
1317- ) ;
1318- } else {
1319- mpInstance . _SessionManager . resetSessionTimer ( ) ;
1320-
1321- userProducts = mpInstance . _Persistence . getUserProductsFromLS (
1322- mpid
1323- ) ;
1324-
1325- userProducts = userProducts . concat ( arrayCopy ) ;
1326-
1327- if ( logEvent === true ) {
1328- mpInstance . _Events . logProductActionEvent (
1329- Types . ProductActionType . AddToCart ,
1330- arrayCopy
1331- ) ;
1332- }
1333-
1334- var productsForMemory = { } ;
1335- productsForMemory [ mpid ] = { cp : userProducts } ;
1336-
1337- if (
1338- userProducts . length >
1339- mpInstance . _Store . SDKConfig . maxProducts
1340- ) {
1341- mpInstance . Logger . verbose (
1342- 'The cart contains ' +
1343- userProducts . length +
1344- ' items. Only ' +
1345- mpInstance . _Store . SDKConfig . maxProducts +
1346- ' can currently be saved in cookies.'
1347- ) ;
1348- userProducts = userProducts . slice (
1349- - mpInstance . _Store . SDKConfig . maxProducts
1350- ) ;
1351- }
1352-
1353- allProducts = mpInstance . _Persistence . getAllUserProductsFromLS ( ) ;
1354- allProducts [ mpid ] . cp = userProducts ;
1355-
1356- mpInstance . _Persistence . setCartProducts ( allProducts ) ;
1357- }
13581304 } ,
13591305 /**
13601306 * Removes a cart product from the current user cart
@@ -1363,56 +1309,11 @@ export default function Identity(mpInstance) {
13631309 * @param {Boolean } [logEvent] a boolean to log adding of the cart object. If blank, no logging occurs.
13641310 * @deprecated
13651311 */
1312+ // eslint-disable-next-line no-unused-vars
13661313 remove : function ( product , logEvent ) {
13671314 mpInstance . Logger . warning (
1368- 'Deprecated function Identity.getCurrentUser().getCart().remove() will be removed in future releases '
1315+ 'Deprecated function Identity.getCurrentUser().getCart().remove()'
13691316 ) ;
1370- var allProducts ,
1371- userProducts ,
1372- cartIndex = - 1 ,
1373- cartItem = null ;
1374-
1375- if ( mpInstance . _Store . webviewBridgeEnabled ) {
1376- mpInstance . _NativeSdkHelpers . sendToNative (
1377- Constants . NativeSdkPaths . RemoveFromCart ,
1378- JSON . stringify ( product )
1379- ) ;
1380- } else {
1381- mpInstance . _SessionManager . resetSessionTimer ( ) ;
1382-
1383- userProducts = mpInstance . _Persistence . getUserProductsFromLS (
1384- mpid
1385- ) ;
1386-
1387- if ( userProducts ) {
1388- userProducts . forEach ( function ( cartProduct , i ) {
1389- if ( cartProduct . Sku === product . Sku ) {
1390- cartIndex = i ;
1391- cartItem = cartProduct ;
1392- }
1393- } ) ;
1394-
1395- if ( cartIndex > - 1 ) {
1396- userProducts . splice ( cartIndex , 1 ) ;
1397-
1398- if ( logEvent === true ) {
1399- mpInstance . _Events . logProductActionEvent (
1400- Types . ProductActionType . RemoveFromCart ,
1401- cartItem
1402- ) ;
1403- }
1404- }
1405- }
1406-
1407- var productsForMemory = { } ;
1408- productsForMemory [ mpid ] = { cp : userProducts } ;
1409-
1410- allProducts = mpInstance . _Persistence . getAllUserProductsFromLS ( ) ;
1411-
1412- allProducts [ mpid ] . cp = userProducts ;
1413-
1414- mpInstance . _Persistence . setCartProducts ( allProducts ) ;
1415- }
14161317 } ,
14171318 /**
14181319 * Clears the user's cart
@@ -1421,31 +1322,8 @@ export default function Identity(mpInstance) {
14211322 */
14221323 clear : function ( ) {
14231324 mpInstance . Logger . warning (
1424- 'Deprecated function Identity.getCurrentUser().getCart().clear() will be removed in future releases '
1325+ 'Deprecated function Identity.getCurrentUser().getCart().clear()'
14251326 ) ;
1426-
1427- var allProducts ;
1428-
1429- if ( mpInstance . _Store . webviewBridgeEnabled ) {
1430- mpInstance . _NativeSdkHelpers . sendToNative (
1431- Constants . NativeSdkPaths . ClearCart
1432- ) ;
1433- } else {
1434- mpInstance . _SessionManager . resetSessionTimer ( ) ;
1435- allProducts = mpInstance . _Persistence . getAllUserProductsFromLS ( ) ;
1436-
1437- if (
1438- allProducts &&
1439- allProducts [ mpid ] &&
1440- allProducts [ mpid ] . cp
1441- ) {
1442- allProducts [ mpid ] . cp = [ ] ;
1443-
1444- allProducts [ mpid ] . cp = [ ] ;
1445-
1446- mpInstance . _Persistence . setCartProducts ( allProducts ) ;
1447- }
1448- }
14491327 } ,
14501328 /**
14511329 * Returns all cart products
@@ -1455,9 +1333,9 @@ export default function Identity(mpInstance) {
14551333 */
14561334 getCartProducts : function ( ) {
14571335 mpInstance . Logger . warning (
1458- 'Deprecated function Identity.getCurrentUser().getCart().getCartProducts() will be removed in future releases '
1336+ 'Deprecated function Identity.getCurrentUser().getCart().getCartProducts()'
14591337 ) ;
1460- return mpInstance . _Persistence . getCartProducts ( mpid ) ;
1338+ return [ ] ;
14611339 } ,
14621340 } ;
14631341 } ;
0 commit comments