Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested custom event check related change #432

Merged
merged 1 commit into from
Aug 19, 2024
Merged
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
4 changes: 1 addition & 3 deletions src/anonymousUserTracking/complexCriteria.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,7 @@ describe('complexCriteria', () => {
{
eventName: 'button-clicked',
dataFields: {
'button-clicked': {
lastPageViewed: 'welcome page'
}
lastPageViewed: 'welcome page'
},
eventType: 'customEvent'
},
Expand Down
5 changes: 4 additions & 1 deletion src/anonymousUserTracking/criteriaCompletionChecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
}

class CriteriaCompletionChecker {
private localStoredEventList: any[];

Check warning on line 39 in src/anonymousUserTracking/criteriaCompletionChecker.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type

constructor(localStoredEventList: string) {
this.localStoredEventList = JSON.parse(localStoredEventList);
Expand Down Expand Up @@ -72,9 +72,9 @@
return matchingCriteria ? matchingCriteria.criteriaId : null;
}

private prepareEventsToProcess(): any[] {

Check warning on line 75 in src/anonymousUserTracking/criteriaCompletionChecker.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
const eventsToProcess: any[] = this.getEventsWithCartItems();

Check warning on line 76 in src/anonymousUserTracking/criteriaCompletionChecker.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
const nonPurchaseEvents: any[] = this.getNonCartEvents();

Check warning on line 77 in src/anonymousUserTracking/criteriaCompletionChecker.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type

nonPurchaseEvents.forEach((event) => {
eventsToProcess.push(event);
Expand All @@ -83,7 +83,7 @@
return eventsToProcess;
}

private getEventsWithCartItems(): any[] {

Check warning on line 86 in src/anonymousUserTracking/criteriaCompletionChecker.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
const processedEvents: any[] = [];

this.localStoredEventList.forEach((localEventData) => {
Expand Down Expand Up @@ -372,7 +372,10 @@
}

private getFieldValue(data: any, field: string): any {
const fields = field.split('.');
let fields = field.split('.');
if (data?.eventType === TRACK_EVENT && data?.eventName === fields[0]) {

Choose a reason for hiding this comment

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

Is this relevant only to TRACK_EVENT? Or are there other events that are also affected by this issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is for all whose event type is customEvent

fields = [fields[fields.length - 1]];
}
return fields.reduce(
(value, currentField) =>
value && value[currentField] !== undefined
Expand Down
2 changes: 1 addition & 1 deletion src/anonymousUserTracking/tests/complexCriteria.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ describe('complexCriteria', () => {
{
eventName: 'button-clicked',
dataFields: {
'button-clicked': { lastPageViewed: 'welcome page' }
lastPageViewed: 'welcome page'
},
eventType: 'customEvent'
},
Expand Down
Loading