From 53d2c0be0ffa62ab0f59ff19e145219da4eb9d71 Mon Sep 17 00:00:00 2001 From: Omkar Joshi <65808188+OmkarJ13@users.noreply.github.com> Date: Mon, 18 Dec 2023 17:31:41 +0530 Subject: [PATCH] feat: Track suggested duplicates usage in edit expense page (#2655) --- src/app/core/services/tracking.service.ts | 4 ++++ src/app/fyle/add-edit-expense/add-edit-expense-2.spec.ts | 2 ++ src/app/fyle/add-edit-expense/add-edit-expense.page.ts | 2 ++ src/app/fyle/add-edit-expense/add-edit-expense.setup.spec.ts | 1 + 4 files changed, 9 insertions(+) diff --git a/src/app/core/services/tracking.service.ts b/src/app/core/services/tracking.service.ts index 6094c7f8ca..49807e3308 100644 --- a/src/app/core/services/tracking.service.ts +++ b/src/app/core/services/tracking.service.ts @@ -626,4 +626,8 @@ export class TrackingService { enrollingNonRTFCard(properties: EnrollingNonRTFCardProperties): void { this.eventTrack('Enrolling Non RTF Card', properties); } + + showSuggestedDuplicates(): void { + this.eventTrack('Show Suggested Duplicates'); + } } diff --git a/src/app/fyle/add-edit-expense/add-edit-expense-2.spec.ts b/src/app/fyle/add-edit-expense/add-edit-expense-2.spec.ts index 22b3e36a05..205a14c68e 100644 --- a/src/app/fyle/add-edit-expense/add-edit-expense-2.spec.ts +++ b/src/app/fyle/add-edit-expense/add-edit-expense-2.spec.ts @@ -1468,6 +1468,7 @@ export function TestCases2(getTestBed) { component.showSuggestedDuplicates([expenseData1]); tick(500); + expect(trackingService.showSuggestedDuplicates).toHaveBeenCalledTimes(1); expect(modalController.create).toHaveBeenCalledOnceWith({ component: SuggestedDuplicatesComponent, componentProps: { @@ -1493,6 +1494,7 @@ export function TestCases2(getTestBed) { component.showSuggestedDuplicates([expenseData1]); tick(500); + expect(trackingService.showSuggestedDuplicates).toHaveBeenCalledTimes(1); expect(modalController.create).toHaveBeenCalledOnceWith({ component: SuggestedDuplicatesComponent, componentProps: { diff --git a/src/app/fyle/add-edit-expense/add-edit-expense.page.ts b/src/app/fyle/add-edit-expense/add-edit-expense.page.ts index e964417587..3648eb0528 100644 --- a/src/app/fyle/add-edit-expense/add-edit-expense.page.ts +++ b/src/app/fyle/add-edit-expense/add-edit-expense.page.ts @@ -4905,6 +4905,8 @@ export class AddEditExpensePage implements OnInit { } async showSuggestedDuplicates(duplicateExpenses: Expense[]): Promise { + this.trackingService.showSuggestedDuplicates(); + const txnIDs = duplicateExpenses.map((expense) => expense.tx_id); const currencyModal = await this.modalController.create({ component: SuggestedDuplicatesComponent, diff --git a/src/app/fyle/add-edit-expense/add-edit-expense.setup.spec.ts b/src/app/fyle/add-edit-expense/add-edit-expense.setup.spec.ts index c01fba62ee..2c27af0e83 100644 --- a/src/app/fyle/add-edit-expense/add-edit-expense.setup.spec.ts +++ b/src/app/fyle/add-edit-expense/add-edit-expense.setup.spec.ts @@ -171,6 +171,7 @@ describe('AddEditExpensePage', () => { 'hideMoreClicked', 'showMoreClicked', 'newExpenseCreatedFromPersonalCard', + 'showSuggestedDuplicates', ]); const recentLocalStorageItemsServiceSpy = jasmine.createSpyObj('RecentLocalStorageItemsService', ['get']); const recentlyUsedItemsServiceSpy = jasmine.createSpyObj('RecentlyUsedItemsService', [