Skip to content

Commit

Permalink
adds support for deprecated trackEcommerceOrder method
Browse files Browse the repository at this point in the history
  • Loading branch information
lysy-vlc committed Jan 24, 2024
1 parent 26cd448 commit 746a794
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/constants/track-event.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export enum TRACK_EVENT {
ECOMMERCE_REMOVE_FROM_CART = 'ecommerceRemoveFromCart',
ECOMMERCE_PRODUCT_DETAIL_VIEW = 'ecommerceProductDetailView',
UPDATE_ECOMMERCE_CART = 'ecommerceCartUpdate',
ORDER_ECOMMERCE = 'ecommerceOrder',
TRACK_ECOMMERCE_ORDER = 'trackEcommerceOrder',
ECOMMERCE_ORDER = 'ecommerceOrder',
SET_ECOMMERCE_VIEW = 'setEcommerceView',
CLEAR_ECOMMERCE_CART = 'clearEcommerceCart',
SET_CUSTOM_VARIABLE = 'setCustomVariable',
Expand Down
24 changes: 23 additions & 1 deletion src/services/e-commerce/e-commerce.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,33 @@ export function getEcommerceItems(): Promise<object> {
})
}

/**
* @deprecated since version 1.3.1. Please use the ecommerceRemoveFromCart instead.
*/
export function trackEcommerceOrder(
orderId: string,
orderGrandTotal: number,
orderSubTotal?: number,
orderTax?: number,
orderShipping?: number,
orderDiscount?: number
) {
PaqService.push([
TRACK_EVENT.TRACK_ECOMMERCE_ORDER,
orderId,
orderGrandTotal,
orderSubTotal,
orderTax,
orderShipping,
orderDiscount
])
}

export function ecommerceOrder(
products: Product[],
paymentInformation: PaymentInformation
) {
PaqService.push([TRACK_EVENT.ORDER_ECOMMERCE, products, paymentInformation])
PaqService.push([TRACK_EVENT.ECOMMERCE_ORDER, products, paymentInformation])
}

export function updateEcommerceCart(
Expand Down

0 comments on commit 746a794

Please sign in to comment.