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
2 changes: 1 addition & 1 deletion snippet.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
'startTrackingLocation',
'stopTrackingLocation',
];
var ecommerceMethods = ['setCurrencyCode', 'logCheckout'];
var ecommerceMethods = ['setCurrencyCode'];
var identityMethods = ['identify', 'login', 'logout', 'modify'];
var roktMethods = [
'selectPlacements',
Expand Down
2 changes: 1 addition & 1 deletion snippet.rokt.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
'startTrackingLocation',
'stopTrackingLocation',
];
var ecommerceMethods = ['setCurrencyCode', 'logCheckout'];
var ecommerceMethods = ['setCurrencyCode'];
var identityMethods = ['identify', 'login', 'logout', 'modify'];
var roktMethods = [
'selectPlacements',
Expand Down
2 changes: 0 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ const Constants = {
PromotionIdRequired: 'Promotion ID is required',
BadAttribute: 'Attribute value cannot be object or array',
BadKey: 'Key value cannot be object or array',
BadLogPurchase:
'Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions',
AudienceAPINotEnabled:
'Your workspace is not enabled to retrieve user audiences.',
},
Expand Down
27 changes: 0 additions & 27 deletions src/ecommerce.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ export interface SDKCart {

// Used for the public `eCommerce` namespace
export interface SDKECommerceAPI extends IECommerceShared {
logCheckout(
step: number,
option?: string,
attrs?: SDKEventAttrs,
customFlags?: SDKEventCustomFlags
): void;
logImpression(
impression: SDKProductImpression,
attrs?: SDKEventAttrs,
Expand Down Expand Up @@ -98,27 +92,6 @@ export interface SDKECommerceAPI extends IECommerceShared {
*/
Cart: SDKCart;

/*
* @deprecated
*/
logPurchase(
transactionAttributes: TransactionAttributes,
product: SDKProduct | SDKProduct[],
clearCart?: boolean,
attrs?: SDKEventAttrs,
customFlags?: SDKEventCustomFlags
): void;

/*
* @deprecated
*/
logRefund(
transactionAttributes: TransactionAttributes,
product: SDKProduct | SDKProduct[],
clearCart?: boolean,
attrs?: SDKEventAttrs,
customFlags?: SDKEventCustomFlags
): void;
}

interface ExtractedActionAttributes {
Expand Down
23 changes: 0 additions & 23 deletions src/events.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,6 @@ export interface IEvents {
eventType: valueof<typeof EventType>
): void;
logAST(): void;
logCheckoutEvent(
step: number,

// User options specified during the checkout process
// e.g., FedEx, DHL, UPS for delivery options;
// Visa, MasterCard, AmEx for payment options.
option?: string,

attrs?: SDKEventAttrs,
customFlags?: SDKEventCustomFlags
): void;
logCommerceEvent(
commerceEvent: SDKEvent,
attrs?: SDKEventAttrs,
Expand Down Expand Up @@ -66,18 +55,6 @@ export interface IEvents {
customFlags?: SDKEventCustomFlags,
eventOptions?: SDKEventOptions
): void;
logPurchaseEvent(
transactionAttributes: TransactionAttributes,
product: SDKProduct | SDKProduct[],
attrs?: SDKEventAttrs,
customFlags?: SDKEventCustomFlags
): void;
logRefundEvent(
transactionAttributes: TransactionAttributes,
product: SDKProduct | SDKProduct[],
attrs?: SDKEventAttrs,
customFlags?: SDKEventCustomFlags
): void;
startTracking(callback: Callback): void;
stopTracking(): void;
}
90 changes: 0 additions & 90 deletions src/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,27 +99,6 @@ export default function Events(mpInstance) {
self.logEvent({ messageType: Types.MessageType.AppStateTransition });
};

this.logCheckoutEvent = function(step, option, attrs, customFlags) {
var event = mpInstance._Ecommerce.createCommerceEventObject(
customFlags
);

if (event) {
event.EventName += mpInstance._Ecommerce.getProductActionEventName(
Types.ProductActionType.Checkout
);
event.EventCategory = Types.CommerceEventType.ProductCheckout;
event.ProductAction = {
ProductActionType: Types.ProductActionType.Checkout,
CheckoutStep: step,
CheckoutOptions: option,
ProductList: [],
};

self.logCommerceEvent(event, attrs);
}
};

this.logProductActionEvent = function(
productActionType,
product,
Expand Down Expand Up @@ -185,75 +164,6 @@ export default function Events(mpInstance) {
}
};

this.logPurchaseEvent = function(
transactionAttributes,
product,
attrs,
customFlags
) {
var event = mpInstance._Ecommerce.createCommerceEventObject(
customFlags
);

if (event) {
event.EventName += mpInstance._Ecommerce.getProductActionEventName(
Types.ProductActionType.Purchase
);
event.EventCategory = Types.CommerceEventType.ProductPurchase;
event.ProductAction = {
ProductActionType: Types.ProductActionType.Purchase,
};
event.ProductAction.ProductList = mpInstance._Ecommerce.buildProductList(
event,
product
);

mpInstance._Ecommerce.convertTransactionAttributesToProductAction(
transactionAttributes,
event.ProductAction
);

self.logCommerceEvent(event, attrs);
}
};

this.logRefundEvent = function(
transactionAttributes,
product,
attrs,
customFlags
) {
if (!transactionAttributes) {
mpInstance.Logger.error(Messages.ErrorMessages.TransactionRequired);
return;
}

var event = mpInstance._Ecommerce.createCommerceEventObject(
customFlags
);

if (event) {
event.EventName += mpInstance._Ecommerce.getProductActionEventName(
Types.ProductActionType.Refund
);
event.EventCategory = Types.CommerceEventType.ProductRefund;
event.ProductAction = {
ProductActionType: Types.ProductActionType.Refund,
};
event.ProductAction.ProductList = mpInstance._Ecommerce.buildProductList(
event,
product
);

mpInstance._Ecommerce.convertTransactionAttributesToProductAction(
transactionAttributes,
event.ProductAction
);

self.logCommerceEvent(event, attrs);
}
};

this.logPromotionEvent = function(
promotionType,
promotion,
Expand Down
117 changes: 0 additions & 117 deletions src/mp-instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -921,37 +921,6 @@ export default function mParticleInstance(this: IMParticleWebSDKInstance, instan
tax
);
},
/**
* Logs a checkout action
* @for mParticle.eCommerce
* @method logCheckout
* @param {Number} step checkout step number
* @param {String} checkout option string
* @param {Object} attrs
* @param {Object} [customFlags] Custom flags for the event
* @deprecated
*/
logCheckout: function(step, option, attrs, customFlags) {
self.Logger.warning(
'mParticle.logCheckout is deprecated, please use mParticle.logProductAction instead'
);

if (!self._Store.isInitialized) {
self.ready(function() {
self.eCommerce.logCheckout(
step,
option,
attrs,
customFlags
);
});

return;
}

self._SessionManager.resetSessionTimer();
self._Events.logCheckoutEvent(step, option, attrs, customFlags);
},
/**
* Logs a product action
* @for mParticle.eCommerce
Expand Down Expand Up @@ -994,51 +963,6 @@ export default function mParticleInstance(this: IMParticleWebSDKInstance, instan
eventOptions
);
},
/**
* Logs a product purchase
* @for mParticle.eCommerce
* @method logPurchase
* @param {Object} transactionAttributes transactionAttributes object
* @param {Object} product the product being purchased
* @param {Boolean} [clearCart] boolean to clear the cart after logging or not. Defaults to false
* @param {Object} [attrs] other attributes related to the product purchase
* @param {Object} [customFlags] Custom flags for the event
* @deprecated
*/
logPurchase: function(
transactionAttributes,
product,
clearCart,
attrs,
customFlags
) {
self.Logger.warning(
'mParticle.logPurchase is deprecated, please use mParticle.logProductAction instead'
);
if (!self._Store.isInitialized) {
self.ready(function() {
self.eCommerce.logPurchase(
transactionAttributes,
product,
clearCart,
attrs,
customFlags
);
});
return;
}
if (!transactionAttributes || !product) {
self.Logger.error(Messages.ErrorMessages.BadLogPurchase);
return;
}
self._SessionManager.resetSessionTimer();
self._Events.logPurchaseEvent(
transactionAttributes,
product,
attrs,
customFlags
);
},
/**
* Logs a product promotion
* @for mParticle.eCommerce
Expand Down Expand Up @@ -1106,47 +1030,6 @@ export default function mParticleInstance(this: IMParticleWebSDKInstance, instan
eventOptions
);
},
/**
* Logs a refund
* @for mParticle.eCommerce
* @method logRefund
* @param {Object} transactionAttributes transaction attributes related to the refund
* @param {Object} product product being refunded
* @param {Boolean} [clearCart] boolean to clear the cart after refund is logged. Defaults to false.
* @param {Object} [attrs] attributes related to the refund
* @param {Object} [customFlags] Custom flags for the event
* @deprecated
*/
logRefund: function(
transactionAttributes,
product,
clearCart,
attrs,
customFlags
) {
self.Logger.warning(
'mParticle.logRefund is deprecated, please use mParticle.logProductAction instead'
);
if (!self._Store.isInitialized) {
self.ready(function() {
self.eCommerce.logRefund(
transactionAttributes,
product,
clearCart,
attrs,
customFlags
);
});
return;
}
self._SessionManager.resetSessionTimer();
self._Events.logRefundEvent(
transactionAttributes,
product,
attrs,
customFlags
);
},
expandCommerceEvent: function(event) {
return self._Ecommerce.expandCommerceEvent(event);
},
Expand Down
Loading
Loading