Skip to content

Commit

Permalink
[PPI-976] remove products type as array
Browse files Browse the repository at this point in the history
  • Loading branch information
lysy-vlc committed Dec 14, 2023
1 parent 112c9b5 commit 3ff91cf
Showing 1 changed file with 21 additions and 32 deletions.
53 changes: 21 additions & 32 deletions src/services/e-commerce/e-commerce.service.ts
Original file line number Diff line number Diff line change
@@ -1,57 +1,46 @@
import { TRACK_EVENT } from '../../constants/track-event.constant';
import { PaqService } from '../paqService/paq.service';
import { TRACK_EVENT } from '../../constants/track-event.constant'
import { PaqService } from '../paqService/paq.service'
import { Product } from '../../interfaces/product'
import { PaymentInformation } from '../../interfaces/payment'

export function addEcommerceItem(products: Product[]) {
PaqService.push([
TRACK_EVENT.ADD_ECOMMERCE_ITEM,
products,
])
PaqService.push([TRACK_EVENT.ADD_ECOMMERCE_ITEM, products])
}

export function removeEcommerceItem(products: Product) {
PaqService.push([
TRACK_EVENT.REMOVE_ECOMMERCE_ITEM,
products
])
export function removeEcommerceItem(products: Product[]) {
PaqService.push([TRACK_EVENT.REMOVE_ECOMMERCE_ITEM, products])
}

export function getEcommerceItems(): Promise<object> {
return new Promise((resolve, reject) => {
try {
PaqService.push([
function (this: any): void {
resolve(this.getEcommerceItems());
},
]);
resolve(this.getEcommerceItems())
}
])
} catch (e) {
if (e instanceof ReferenceError) {
reject(e);
reject(e)
}
}
});
})
}

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

export function updateEcommerceCart(products: Product[], grandTotal: number | string) {
PaqService.push([
TRACK_EVENT.UPDATE_ECOMMERCE_CART,
products,
grandTotal,
]);
export function updateEcommerceCart(
products: Product[],
grandTotal: number | string
) {
PaqService.push([TRACK_EVENT.UPDATE_ECOMMERCE_CART, products, grandTotal])
}

export function ecommerceProductDetailView(products: Product[]) {
PaqService.push([
TRACK_EVENT.ECOMMERCE_PRODUCT_DETAIL_VIEW,
products,
]);
PaqService.push([TRACK_EVENT.ECOMMERCE_PRODUCT_DETAIL_VIEW, products])
}

0 comments on commit 3ff91cf

Please sign in to comment.