Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ const Constants = {
SetUserAttribute: 'setUserAttribute',
RemoveUserAttribute: 'removeUserAttribute',
SetSessionAttribute: 'setSessionAttribute',
AddToCart: 'addToCart',
RemoveFromCart: 'removeFromCart',
ClearCart: 'clearCart',
LogOut: 'logOut',
SetUserAttributeList: 'setUserAttributeList',
RemoveAllUserAttributes: 'removeAllUserAttributes',
Expand All @@ -111,18 +108,15 @@ const Constants = {
cookieNameV2: 'mprtcl-v2', // v2 Name of the cookie stored on the user's machine. Removed keys with no values, moved cartProducts and productBags to localStorage.
cookieNameV3: 'mprtcl-v3', // v3 Name of the cookie stored on the user's machine. Base64 encoded keys in Base64CookieKeys object, final version on SDKv1
localStorageNameV4: 'mprtcl-v4', // v4 Name of the mP localstorage, Current Version
localStorageProductsV4: 'mprtcl-prodv4', // The name for mP localstorage that contains products for cartProducs and productBags
cookieNameV4: 'mprtcl-v4', // v4 Name of the cookie stored on the user's machine. Base64 encoded keys in Base64CookieKeys object, current version on SDK v2
currentStorageName: 'mprtcl-v4',
currentStorageProductsName: 'mprtcl-prodv4',
},
DefaultConfig: {
cookieDomain: null, // If null, defaults to current location.host
cookieExpiration: 365, // Cookie expiration time in days
logLevel: null, // What logging will be provided in the console
timeout: 300, // timeout in milliseconds for logging functions
sessionTimeout: 30, // Session timeout in minutes
maxProducts: 20, // Number of products persisted in cartProducts and productBags
forwarderStatsTimeout: 5000, // Milliseconds for forwarderStats timeout
integrationDelayTimeout: 5000, // Milliseconds for forcing the integration delay to un-suspend event queueing due to integration partner errors
maxCookieSize: 3000, // Number of bytes for cookie size to not exceed
Expand Down
8 changes: 0 additions & 8 deletions src/ecommerce.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ interface IECommerceShared {
expandCommerceEvent(event: CommerceEvent): SDKEvent[] | null;
}

export interface SDKCart {
add(product: SDKProduct | SDKProduct[], logEvent?: boolean): void;
remove(product: SDKProduct | SDKProduct[], logEvent?: boolean): void;
clear(): void;
}

// Used for the public `eCommerce` namespace
export interface SDKECommerceAPI extends IECommerceShared {
Expand Down Expand Up @@ -90,8 +85,6 @@ export interface SDKECommerceAPI extends IECommerceShared {
/*
* @deprecated
*/
Cart: SDKCart;

}

interface ExtractedActionAttributes {
Expand Down Expand Up @@ -128,7 +121,6 @@ interface ExtractedTransactionId {

// Used for the private `_Ecommerce` namespace
export interface IECommerce extends IECommerceShared {
buildProductList(event: SDKEvent, product: Product | Product[]): Product[];
convertProductActionToEventType(
productActionType: valueof<typeof ProductActionType>
): // https://go.mparticle.com/work/SQDSDKS-4801
Expand Down
13 changes: 0 additions & 13 deletions src/ecommerce.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,18 +235,6 @@ export default function Ecommerce(mpInstance) {
}
};

this.buildProductList = function(event, product) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deadcode from logpurchase/logrefund which were removed

if (product) {
if (Array.isArray(product)) {
return product;
}

return [product];
}

return event.ShoppingCart.ProductList;
};

this.createProduct = function(
name,
sku,
Expand Down Expand Up @@ -549,7 +537,6 @@ export default function Ecommerce(mpInstance) {
baseEvent.EventName = 'eCommerce - ';

baseEvent.CurrencyCode = mpInstance._Store.currencyCode;
baseEvent.ShoppingCart = [];
baseEvent.CustomFlags = extend(baseEvent.CustomFlags, customFlags);

return baseEvent;
Expand Down
5 changes: 0 additions & 5 deletions src/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,6 @@ export default function Events(mpInstance) {
);

if (mpInstance._Helpers.canLog()) {
if (mpInstance._Store.webviewBridgeEnabled) {
// Don't send shopping cart to parent sdks
commerceEvent.ShoppingCart = {};
}

if (attrs) {
commerceEvent.EventAttributes = attrs;
}
Expand Down
33 changes: 1 addition & 32 deletions src/identity-user-interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,10 @@
import { AllUserAttributes, MPID, User } from '@mparticle/web-sdk';
import { SDKIdentityTypeEnum } from './identity.interfaces';
import { MessageType } from './types';
import { BaseEvent, SDKProduct } from './sdkRuntimeModels';
import { BaseEvent } from './sdkRuntimeModels';
import Constants from './constants';
const { HTTPCodes } = Constants;

// Cart is Deprecated and private to mParticle user in @mparticle/web-sdk
// but we need to expose it here for type safety in some of our tests
interface ICart {
/**
* @deprecated Cart persistence in mParticle has been deprecated. Please use mParticle.eCommerce.logProductAction(mParticle.ProductActionType.AddToCart, [products])
*/
add: (product: SDKProduct, logEventBoolean?: boolean) => void;
/**
* @deprecated Cart persistence in mParticle has been deprecated. Please use mParticle.eCommerce.logProductAction(mParticle.ProductActionType.RemoveFromCart, [products])
*/
remove: (product: SDKProduct, logEventBoolean?: boolean) => void;
/**
* @deprecated Cart persistence in mParticle has been deprecated.
*/
clear: () => void;
/**
* @deprecated Cart Products have been deprecated
*/
getCartProducts: () => SDKProduct[];
}

// https://go.mparticle.com/work/SQDSDKS-5033
// https://go.mparticle.com/work/SQDSDKS-6354
Expand All @@ -33,10 +13,6 @@ export interface IMParticleUser extends User {
setUserTag(tagName: string, value?: any): void;
setUserAttribute(key: string, value: any): void;
getUserAudiences?(callback?: IdentityCallback): void;
/*
* @deprecated
*/
getCart(): ICart;
}

export interface ISDKUserIdentity {
Expand Down Expand Up @@ -114,12 +90,5 @@ export interface IdentityModifyResultBody {
};
}

export interface mParticleUserCart {
add(): void;
remove(): void;
clear(): void;
getCartProducts(): SDKProduct[];
}

// https://go.mparticle.com/work/SQDSDKS-5196
export type UserAttributes = AllUserAttributes;
6 changes: 0 additions & 6 deletions src/identity.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
IUserAttributeChangeEvent,
IUserIdentityChangeEvent,
IMParticleUser,
mParticleUserCart,
IIdentityResponse,
} from './identity-user-interfaces';
const { platform, sdkVendor, sdkVersion, HTTPCodes } = Constants;
Expand Down Expand Up @@ -205,9 +204,4 @@ export interface IIdentity {
mpid: MPID,
prevUserIdentities: UserIdentities
): void;

/**
* @deprecated
*/
mParticleUserCart(): mParticleUserCart;
}
85 changes: 0 additions & 85 deletions src/identity.js
Original file line number Diff line number Diff line change
Expand Up @@ -1208,18 +1208,6 @@ export default function Identity(mpInstance) {

return userAttributesCopy;
},
/**
* Returns the cart object for the current user
* @method getCart
* @return a cart object
*/
getCart: function() {
mpInstance.Logger.warning(
'Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases'
);
return self.mParticleUserCart();
},

/**
* Returns the Consent State stored locally for this user.
* @method getConsentState
Expand Down Expand Up @@ -1282,79 +1270,6 @@ export default function Identity(mpInstance) {
};
};

/**
* Invoke these methods on the mParticle.Identity.getCurrentUser().getCart() object.
* Example: mParticle.Identity.getCurrentUser().getCart().add(...);
* @class mParticle.Identity.getCurrentUser().getCart()
* @deprecated
*/
this.mParticleUserCart = function() {
return {
/**
* Adds a cart product to the user cart
* @method add
* @deprecated
*/
add: function() {
mpInstance.Logger.warning(
generateDeprecationMessage(
'Identity.getCurrentUser().getCart().add()',
true,
'eCommerce.logProductAction()',
'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'
)
);
},
/**
* Removes a cart product from the current user cart
* @method remove
* @deprecated
*/
remove: function() {
mpInstance.Logger.warning(
generateDeprecationMessage(
'Identity.getCurrentUser().getCart().remove()',
true,
'eCommerce.logProductAction()',
'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'
)
);
},
/**
* Clears the user's cart
* @method clear
* @deprecated
*/
clear: function() {
mpInstance.Logger.warning(
generateDeprecationMessage(
'Identity.getCurrentUser().getCart().clear()',
true,
'',
'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'
)
);
},
/**
* Returns all cart products
* @method getCartProducts
* @return {Array} array of cart products
* @deprecated
*/
getCartProducts: function() {
mpInstance.Logger.warning(
generateDeprecationMessage(
'Identity.getCurrentUser().getCart().getCartProducts()',
true,
'eCommerce.logProductAction()',
'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'
)
);
return [];
},
};
};

// https://go.mparticle.com/work/SQDSDKS-6355
this.parseIdentityResponse = function(
identityResponse,
Expand Down
57 changes: 0 additions & 57 deletions src/mp-instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -749,63 +749,6 @@ export default function mParticleInstance(this: IMParticleWebSDKInstance, instan
* @class mParticle.eCommerce
*/
this.eCommerce = {
/**
* Invoke these methods on the mParticle.eCommerce.Cart object.
* Example: mParticle.eCommerce.Cart.add(...)
* @class mParticle.eCommerce.Cart
* @deprecated
*/
Cart: {
/**
* Adds a product to the cart
* @method add
* @param {Object} product The product you want to add to the cart
* @param {Boolean} [logEventBoolean] Option to log the event to mParticle's servers. If blank, no logging occurs.
* @deprecated
*/
add: function(product, logEventBoolean) {
self.Logger.warning(
generateDeprecationMessage(
'eCommerce.Cart.add()',
true,
'eCommerce.logProductAction()',
'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'
)
);
},
/**
* Removes a product from the cart
* @method remove
* @param {Object} product The product you want to add to the cart
* @param {Boolean} [logEventBoolean] Option to log the event to mParticle's servers. If blank, no logging occurs.
* @deprecated
*/
remove: function(product, logEventBoolean) {
self.Logger.warning(
generateDeprecationMessage(
'eCommerce.Cart.remove()',
true,
'eCommerce.logProductAction()',
'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'
)
);
},
/**
* Clears the cart
* @method clear
* @deprecated
*/
clear: function() {
self.Logger.warning(
generateDeprecationMessage(
'eCommerce.Cart.clear()',
true,
'',
'https://docs.mparticle.com/developers/sdk/web/commerce-tracking'
)
);
},
},
/**
* Sets the currency code
* @for mParticle.eCommerce
Expand Down
14 changes: 0 additions & 14 deletions src/mparticle-instance-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,20 +197,6 @@ function mParticleInstanceManager(this: IMParticleInstanceManager) {
self.getInstance().upload();
};
this.eCommerce = {
Cart: {
add: function(product, logEventBoolean) {
self.getInstance().eCommerce.Cart.add(product, logEventBoolean);
},
remove: function(product, logEventBoolean) {
self.getInstance().eCommerce.Cart.remove(
product,
logEventBoolean
);
},
clear: function() {
self.getInstance().eCommerce.Cart.clear();
},
},
setCurrencyCode: function(code) {
self.getInstance().eCommerce.setCurrencyCode(code);
},
Expand Down
6 changes: 0 additions & 6 deletions src/sdkRuntimeModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export interface SDKEvent {
ProductAction?: SDKProductAction;
PromotionAction?: SDKPromotionAction;
ProductImpressions?: SDKProductImpression[];
ShoppingCart?: SDKShoppingCart;
UserIdentityChanges?: ISDKUserIdentityChanges;
UserAttributeChanges?: ISDKUserAttributeChangeData;
CurrencyCode: string;
Expand All @@ -107,10 +106,6 @@ export interface SDKDataPlan {
PlanId?: string | null;
}

export interface SDKShoppingCart {
ProductList?: SDKProduct[];
}

export interface SDKPromotionAction {
PromotionActionType: string;
PromotionList?: SDKPromotion[];
Expand Down Expand Up @@ -323,7 +318,6 @@ export interface SDKInitConfig
identityUrl?: string;
integrationDelayTimeout?: number;
isIOS?: boolean;
maxProducts?: number;
requestConfig?: boolean;
sessionTimeout?: number;
useNativeSdk?: boolean;
Expand Down
Loading
Loading