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

feat: Trackers for onboarding flow #3428

Merged
merged 57 commits into from
Jan 20, 2025

Conversation

bistaastha
Copy link
Contributor

@bistaastha bistaastha commented Jan 20, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced tracking capabilities across onboarding components.
    • Added event tracking for user interactions during the onboarding process.
  • Tests

    • Updated test suites to include TrackingService.
    • Added spy objects for tracking events in component tests.
    • Removed specific test cases related to modal dismissal in the SpenderOnboardingOptInStepComponent.
  • Refactor

    • Integrated TrackingService into multiple onboarding components.
    • Removed some existing tracking-related code and replaced with new tracking events.

Copy link

coderabbitai bot commented Jan 20, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Listen up, superstar! This pull request brings a seismic shift in the onboarding arena! We’re rolling out the powerful TrackingService across multiple components, capturing every user interaction like a true champion. The changes cover the spender onboarding flow, adding event tracking for initialization, step completion, and user actions. It’s like giving our application a digital superpower—MASS!

Changes

File Change Summary
src/app/.../my-profile.page.ts Removed OnboardingStatus import
src/app/.../spender-onboarding-connect-card-step/... Added TrackingService for tracking card connection events
src/app/.../spender-onboarding-opt-in-step/... Enhanced event tracking for OTP and mobile number interactions
src/app/.../spender-onboarding.page.ts Integrated TrackingService to track step skipping events

Sequence Diagram

sequenceDiagram
    participant User
    participant Component
    participant TrackingService
    
    User->>Component: Starts Onboarding
    Component->>TrackingService: Track Initialization Event
    User->>Component: Completes Step
    Component->>TrackingService: Track Step Completion Event
Loading

Possibly related PRs

Suggested Labels

size/L

Suggested Reviewers

  • arjunaj5
  • Chethan-Fyle

Poem

Onboarding's dance, a digital stage,
Tracking events with Rajini's rage! 🔥
Services flow, components unite,
Transforming user journeys, pure delight! 💥
Code becomes magic, watch it ignite! 🚀


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between db7d75f and eea608e.

📒 Files selected for processing (1)
  • src/app/fyle/spender-onboarding/spender-onboarding-connect-card-step/spender-onboarding-connect-card-step.component.spec.ts (4 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the size/XL Extra Large PR label Jan 20, 2025
@bistaastha bistaastha changed the base branch from master to FYLE-qa-branch January 20, 2025 06:26
@github-actions github-actions bot added size/M Medium PR and removed size/XL Extra Large PR labels Jan 20, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🔭 Outside diff range comments (2)
src/app/fyle/spender-onboarding/spender-onboarding-connect-card-step/spender-onboarding-connect-card-step.component.spec.ts (2)

Line range hint 71-266: Thalaiva suggests better test organization!

Your test cases are strong like Rajini's punch dialogues, but we can make them even more powerful! Let's reorganize them into focused describe blocks, superstar style:

describe('Card Enrollment', () => {
  describe('Single Card', () => {
    // Move single card enrollment tests here
  });
  
  describe('Multiple Cards', () => {
    // Move multiple card enrollment tests here
  });
  
  describe('Error Handling', () => {
    // Move error handling tests here
  });
});

Line range hint 27-69: Optimize test setup like my perfect timing in action scenes!

The test setup is good, but we can make it run faster than my signature cigarette flip! Here's how:

  1. Move common spy setup to a helper function:
function setupCommonSpies() {
  const trackingServiceSpy = jasmine.createSpyObj('TrackingService', ['eventTrack']);
  const realTimeFeedServiceSpy = jasmine.createSpyObj('RealTimeFeedService', [
    'enroll',
    'getCardTypeFromNumber',
    'isCardNumberValid',
  ]);
  return { trackingServiceSpy, realTimeFeedServiceSpy };
}
  1. Reuse mock data instead of creating new objects in each test:
const MOCK_CARD = Object.freeze({ ...statementUploadedCard });
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b60588a and db7d75f.

📒 Files selected for processing (7)
  • src/app/fyle/my-profile/my-profile.page.ts (0 hunks)
  • src/app/fyle/spender-onboarding/spender-onboarding-connect-card-step/spender-onboarding-connect-card-step.component.spec.ts (4 hunks)
  • src/app/fyle/spender-onboarding/spender-onboarding-connect-card-step/spender-onboarding-connect-card-step.component.ts (4 hunks)
  • src/app/fyle/spender-onboarding/spender-onboarding-opt-in-step/spender-onboarding-opt-in-step.component.spec.ts (0 hunks)
  • src/app/fyle/spender-onboarding/spender-onboarding-opt-in-step/spender-onboarding-opt-in-step.component.ts (4 hunks)
  • src/app/fyle/spender-onboarding/spender-onboarding.page.spec.ts (5 hunks)
  • src/app/fyle/spender-onboarding/spender-onboarding.page.ts (4 hunks)
💤 Files with no reviewable changes (2)
  • src/app/fyle/my-profile/my-profile.page.ts
  • src/app/fyle/spender-onboarding/spender-onboarding-opt-in-step/spender-onboarding-opt-in-step.component.spec.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: gitStream.cm
🔇 Additional comments (10)
src/app/fyle/spender-onboarding/spender-onboarding.page.ts (3)

14-14: Mind it! The TrackingService integration looks perfect!

The service is properly imported and injected into the constructor. This is how we do it in style!

Also applies to: 48-49


122-122: Superstar! The tracking event for skipping connect cards is spot on!

The event is strategically placed after the skip action, maintaining a clear cause-and-effect relationship.


134-134: Kabali da! The SMS opt-in skip tracking is perfectly placed!

The event follows the same consistent pattern as the connect cards tracking. That's what I call style!

src/app/fyle/spender-onboarding/spender-onboarding-opt-in-step/spender-onboarding-opt-in-step.component.ts (3)

138-138: Thalaiva style! The view tracking is perfectly initialized!

The component view tracking is added right where it should be - in ngOnInit. That's how we roll!


150-150: Mind it! The edit number tracking is perfectly timed!

The tracking event captures the user's intention to edit their number at just the right moment.


289-289: Marana mass! The completion tracking is perfectly executed!

The successful completion event is placed right after the verification success. Perfect timing!

src/app/fyle/spender-onboarding/spender-onboarding-connect-card-step/spender-onboarding-connect-card-step.component.ts (2)

224-224: Style! The connect cards view tracking is perfectly placed!

The component view tracking is initialized at the right moment in ngOnInit.


293-295: Superstar! The completion tracking with card count is mass!

The event includes the number of successfully connected cards, providing valuable context for analytics.

src/app/fyle/spender-onboarding/spender-onboarding.page.spec.ts (2)

17-17: Mind it! The test setup for TrackingService is perfect!

The service is properly imported and a spy object is created for testing.

Also applies to: 28-28


58-58: Kabali da! The test module setup is perfect!

The TrackingService is properly provided in the test module configuration.

@@ -227,6 +218,7 @@ export class SpenderOnboardingOptInStepComponent implements OnInit, OnChanges {
'msb-failure-with-camera-icon'
);
this.disableResendOtp = true;
this.trackingService.eventTrack('Sms Opt In Onboarding Step - Max Otp Attempts Reached');
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Listen up! Let's make this OTP tracking even more powerful!

While the tracking for max OTP attempts is good, we could make it even better by including additional context.

Consider adding these details to the event:

-this.trackingService.eventTrack('Sms Opt In Onboarding Step - Max Otp Attempts Reached');
+this.trackingService.eventTrack('Sms Opt In Onboarding Step - Max Otp Attempts Reached', {
+  attemptsCount: this.otpAttemptsLeft,
+  mobileNumber: this.mobileNumberInputValue?.slice(-4) || 'unknown'
+});

Committable suggestion skipped: line range outside the PR's diff.

@@ -42,6 +44,7 @@ describe('SpenderOnboardingPage', () => {
'getCorporateCards',
]);
const routerSpy = jasmine.createSpyObj('Router', ['navigate']);
const trackingServiceSpy = jasmine.createSpyObj('TrackingService', ['eventTrack']);
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Listen up! We need more power in our tests!

The spy is created but we're missing test cases to verify the tracking events.

Add these test cases to verify tracking events:

it('should track event when connect cards step is skipped', fakeAsync(() => {
  component.currentStep = OnboardingStep.CONNECT_CARD;
  component.skipOnboardingStep();
  tick();
  expect(trackingService.eventTrack).toHaveBeenCalledWith('Connect Cards Onboarding Step - Skipped');
}));

it('should track event when sms opt-in step is skipped', fakeAsync(() => {
  component.currentStep = OnboardingStep.OPT_IN;
  component.skipOnboardingStep();
  tick();
  expect(trackingService.eventTrack).toHaveBeenCalledWith('Sms Opt In Onboarding Step - Skipped');
}));

@@ -13,6 +13,7 @@ import { SimpleChanges } from '@angular/core';
import { orgSettingsData } from 'src/app/core/test-data/org-settings.service.spec.data';
import { PopupAlertComponent } from 'src/app/shared/components/popup-alert/popup-alert.component';
import { enrollmentErrorPopoverData1, enrollmentErrorPopoverData2 } from 'src/app/core/mock-data/modal-controller.data';
import { TrackingService } from 'src/app/core/services/tracking.service';
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Mind it! The TrackingService needs test coverage, macha!

You've added the TrackingService like a boss, but where are the tests to verify the tracking events? Just like how I never miss my signature moves in movies, we shouldn't miss testing these critical tracking calls!

Here's what you need to add, style ah?

  • Test cases for tracking initialization events
  • Test cases for card enrollment completion events
  • Verification of event parameters

Example test case to add:

it('should track card enrollment completion', fakeAsync(() => {
  component.enrollCards();
  tick();
  
  expect(trackingService.eventTrack).toHaveBeenCalledWith('Onboarding Card Enrollment Completed', {
    // Add expected parameters here
  });
}));

Also applies to: 25-25, 32-32, 47-47, 61-61

@bistaastha bistaastha changed the base branch from FYLE-qa-branch to FYLE-86cx2t82k-base-feature-branch January 20, 2025 07:14
@bistaastha bistaastha merged commit c176bc8 into FYLE-86cx2t82k-base-feature-branch Jan 20, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/M Medium PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants