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: QBD direct tracker update #1126

Merged
merged 4 commits into from
Dec 17, 2024
Merged

feat: QBD direct tracker update #1126

merged 4 commits into from
Dec 17, 2024

Conversation

DhaaraniCIT
Copy link
Contributor

@DhaaraniCIT DhaaraniCIT commented Dec 16, 2024

Description

feat: QBD direct tracker update

Clickup

https://app.clickup.com

Summary by CodeRabbit

  • New Features

    • Introduced new enums for QuickBooks Desktop integration, enhancing tracking and onboarding capabilities.
    • Added tracking functionality across various onboarding components to monitor user interactions and state changes.
    • Enhanced the ability to track onboarding phases and states in the export and import settings components.
    • Implemented session tracking to capture time spent on onboarding processes.
  • Bug Fixes

    • Improved handling of onboarding states and error messages during save operations in multiple components.
  • Documentation

    • Updated method signatures and component properties to reflect new tracking features and onboarding states.

Copy link
Contributor

coderabbitai bot commented Dec 16, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request introduces enhancements to the QuickBooks Desktop (QBD) Direct integration by adding a new enum QbdDirectUpdateEvent and updating the existing Page enum. It modifies various components to support tracking of onboarding and update events, enhancing the flexibility of the UpdateEventAdditionalProperty type. The changes span multiple files, focusing on improving tracking and state management for the QBD Direct integration process.

Changes

File Change Summary
src/app/core/models/enum/enum.model.ts Added QbdDirectUpdateEvent enum with seven members and updated Page enum with five new members.
src/app/core/models/misc/tracking.model.ts Updated UpdateEventAdditionalProperty type to include new QBD Direct-related types.
src/app/core/services/integration/tracking.service.ts Modified method signatures to support QbdDirectOnboardingState and QbdDirectUpdateEvent.
src/app/integrations/qbd-direct/*/qbd-direct-*.component.ts Added tracking functionality, sessionStartTime, and new methods in multiple components.

Possibly related PRs

Suggested labels

deploy, size/XL

Suggested reviewers

  • ashwin1111

Poem

🐰 Hopping through code with glee,
QuickBooks Direct, now tracking free!
Enums dancing, events so bright,
Onboarding flows now take flight!
A rabbit's leap of integration might! 🚀

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f9337be and c751f57.

📒 Files selected for processing (1)
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-connector/qbd-direct-onboarding-connector.component.ts (6 hunks)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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/M Medium PR label Dec 16, 2024
Copy link
Contributor

@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: 2

🧹 Nitpick comments (5)
src/app/core/services/integration/tracking.service.ts (2)

106-107: Consider using discriminated union type for additionalProperties.

The method signature uses a union type for additionalProperties that includes void. This could lead to type-safety issues.

Consider using a discriminated union type or making the parameter optional:

-additionalProperties: LocationEntityPost | ExportSettingPost | ImportSettingPost | AdvancedSettingsPost | NetsuiteSubsidiaryMappingPost | QbdDirectExportSettingsPost | QbdDirectImportSettingPost | QbdDirectAdvancedSettingsPost | void
+additionalProperties?: LocationEntityPost | ExportSettingPost | ImportSettingPost | AdvancedSettingsPost | NetsuiteSubsidiaryMappingPost | QbdDirectExportSettingsPost | QbdDirectImportSettingPost | QbdDirectAdvancedSettingsPost
🧰 Tools
🪛 Biome (1.9.4)

[error] 106-106: void is confusing inside a union type.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


110-111: Consider using discriminated union type for additionalProperties.

Similar to the previous comment, the method signature uses a union type with void.

Consider using a discriminated union type or making the parameter optional:

-additionalProperties: Partial<UpdateEventAdditionalProperty> | void
+additionalProperties?: Partial<UpdateEventAdditionalProperty>
🧰 Tools
🪛 Biome (1.9.4)

[error] 110-110: void is confusing inside a union type.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-connector/qbd-direct-onboarding-connector.component.ts (1)

223-238: Consider handling edge cases in tracking logic.

While the tracking implementation is generally correct, there are a few considerations:

  1. The oldState modification might cause unintended side effects.
  2. No error handling for tracking calls.

Consider this safer implementation:

-const oldWorkspaceResponse = workspaceResponse;
-oldWorkspaceResponse.onboarding_state = QbdDirectOnboardingState.DESTINATION_SYNC_COMPLETE;
+const oldWorkspaceResponse = {
+  ...workspaceResponse,
+  onboarding_state: QbdDirectOnboardingState.DESTINATION_SYNC_COMPLETE
+};
src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-export-settings/qbd-direct-export-settings.component.ts (1)

186-199: Consider handling tracking errors gracefully.

The tracking calls are made within the success callback of the HTTP request, but there's no error handling for the tracking calls themselves.

Consider wrapping tracking calls in try-catch:

-this.trackingService.trackTimeSpent(TrackingApp.QBD_DIRECT, Page.EXPORT_SETTING_QBD_DIRECT, this.sessionStartTime);
+try {
+  this.trackingService.trackTimeSpent(TrackingApp.QBD_DIRECT, Page.EXPORT_SETTING_QBD_DIRECT, this.sessionStartTime);
+  if (this.workspaceService.getOnboardingState() === QbdDirectOnboardingState.EXPORT_SETTINGS) {
+    this.trackingService.integrationsOnboardingCompletion(TrackingApp.QBD_DIRECT, QbdDirectOnboardingState.EXPORT_SETTINGS, 3, exportSettingPayload);
+  } else {
+    this.trackingService.onUpdateEvent(
+      TrackingApp.QBD_DIRECT,
+      QbdDirectUpdateEvent.EXPORT_SETTING_QBD_DIRECT,
+      {
+        phase: this.getPhase(),
+        oldState: this.exportSettings,
+        newState: response
+      }
+    );
+  }
+} catch (error) {
+  console.error('Error tracking export settings:', error);
+}
src/app/core/models/enum/enum.model.ts (1)

137-141: Consider grouping related enum values together.

While the additions to the Page enum are correct and maintain consistency, consider grouping all QBD Direct-related pages together for better maintainability. This would make it easier to manage and understand related functionality.

export enum Page {
  LANDING = 'Landing',
  BAMBOO_HR_LANDING = 'Bamboo HR Landing',
  CONNECT_BAMBOO_HR = 'Connect Bamboo HR',
  CONFIGURE_BAMBOO_HR = 'Bamboo HR Configuration',
  QBD_LANDING = 'QuickBooks Desktop Landing',
  INTACCT_LANDING = 'Sage Intacct Landing',
+  // QuickBooks Desktop Direct pages
+  CONFIRM_PRE_REQUISITES_QBD_DIRECT = 'Confirm Pre Requisites QuickBooks Desktop Connector',
+  CONNECT_QBD_DIRECT = 'Connect QuickBooks Desktop Connector',
+  EXPORT_SETTING_QBD_DIRECT = 'Export Settings QuickBooks Desktop Connector',
+  IMPORT_SETTINGS_QBD_DIRECT = 'Import Settings QuickBooks Desktop Connector',
+  ADVANCED_SETTINGS_QBD_DIRECT = 'Advanced Settings QuickBooks Desktop Connector',
  // ... rest of the enum values
}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 204c5f7 and cb27ca5.

📒 Files selected for processing (8)
  • src/app/core/models/enum/enum.model.ts (2 hunks)
  • src/app/core/models/misc/tracking.model.ts (1 hunks)
  • src/app/core/services/integration/tracking.service.ts (3 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-connector/qbd-direct-onboarding-connector.component.ts (4 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-pre-requisite/qbd-direct-onboarding-pre-requisite.component.ts (3 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-advanced-settings/qbd-direct-advanced-settings.component.ts (3 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-export-settings/qbd-direct-export-settings.component.ts (3 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-import-settings/qbd-direct-import-settings.component.ts (4 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/app/core/services/integration/tracking.service.ts

[error] 106-106: void is confusing inside a union type.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)


[error] 110-110: void is confusing inside a union type.

Unsafe fix: Use undefined instead.

(lint/suspicious/noConfusingVoidType)

🔇 Additional comments (12)
src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-pre-requisite/qbd-direct-onboarding-pre-requisite.component.ts (1)

83-98: Tracking Integration Implemented Correctly

The added tracking code is correctly implemented and aligns with the intended functionality.

src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-advanced-settings/qbd-direct-advanced-settings.component.ts (2)

153-156: Helper Method getPhase() Implemented Correctly

The getPhase() method correctly determines the progress phase based on the onboarding state.


163-177: Tracking Code in save() Method Implemented Correctly

The added tracking code in the save() method correctly logs time spent and tracks onboarding completion or updates.

src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-import-settings/qbd-direct-import-settings.component.ts (2)

240-243: Helper Method getPhase() Implemented Correctly

The getPhase() method correctly determines the progress phase based on the onboarding state.


248-262: Tracking Code in save() Method Implemented Correctly

The added tracking code in the save() method correctly logs time spent and tracks onboarding completion or updates.

src/app/core/models/misc/tracking.model.ts (1)

23-24: Extended UpdateEventAdditionalProperty Type Definition Correctly

The UpdateEventAdditionalProperty type has been correctly extended to include the new QbdDirect types and Workspace.

src/app/core/services/integration/tracking.service.ts (1)

2-2: LGTM: Import statement updated correctly.

The import statement has been properly updated to include the new QBD Direct related enums (QbdDirectOnboardingState, QbdDirectUpdateEvent).

src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-connector/qbd-direct-onboarding-connector.component.ts (2)

6-6: LGTM: Imports properly organized.

The imports for tracking-related functionality have been correctly added.

Also applies to: 21-21


78-79: LGTM: Session tracking setup.

The sessionStartTime property and TrackingService injection are properly implemented.

Also applies to: 85-86

src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-export-settings/qbd-direct-export-settings.component.ts (2)

4-4: LGTM: Imports properly organized.

The imports for tracking-related functionality have been correctly added.


86-87: LGTM: Session tracking setup.

The sessionStartTime property is properly initialized.

src/app/core/models/enum/enum.model.ts (1)

85-91: LGTM! The QbdDirectUpdateEvent enum is well-structured.

The enum follows consistent naming conventions and provides clear, descriptive values for tracking QBD Direct integration events.

Comment on lines +87 to +89
const oldWorkspaceResponse = workspaceResponse;
oldWorkspaceResponse.onboarding_state = QbdDirectOnboardingState.CONFIRM_PRE_REQUISITES;
this.trackingService.onUpdateEvent(
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Modify oldWorkspaceResponse Without Affecting workspaceResponse to Prevent Unintended Side Effects

Assigning oldWorkspaceResponse to workspaceResponse creates a reference to the same object. Modifying oldWorkspaceResponse.onboarding_state will also modify workspaceResponse.onboarding_state, which may not be intended. To prevent unintended side effects, create a copy of workspaceResponse before modifying.

Apply this diff to fix the issue:

- const oldWorkspaceResponse = workspaceResponse;
+ const oldWorkspaceResponse = { ...workspaceResponse };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const oldWorkspaceResponse = workspaceResponse;
oldWorkspaceResponse.onboarding_state = QbdDirectOnboardingState.CONFIRM_PRE_REQUISITES;
this.trackingService.onUpdateEvent(
const oldWorkspaceResponse = { ...workspaceResponse };
oldWorkspaceResponse.onboarding_state = QbdDirectOnboardingState.CONFIRM_PRE_REQUISITES;
this.trackingService.onUpdateEvent(

Comment on lines +178 to +180
private getPhase(): ProgressPhase {
return this.isOnboarding ? ProgressPhase.ONBOARDING : ProgressPhase.POST_ONBOARDING;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider adding type safety to isOnboarding.

The getPhase method uses isOnboarding which is typed as any.

Add proper typing to improve type safety:

-isOnboarding: any;
+isOnboarding: boolean;

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

@@ -82,6 +82,14 @@ export enum TravelperkUpdateEvent {
ADVANCED_SETTINGS_TRAVELPERK = 'Advanced Settings TravelPerk',
}

export enum QbdDirectUpdateEvent {
CONFIRM_PRE_REQUISITES_QBD_DIRECT = 'Confirm Pre Requisites QuickBooks Desktop Connector',
CONNECT_QBD_DIRECT = 'Connect QuickBooks Desktop Connector',
Copy link
Contributor

Choose a reason for hiding this comment

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

let's have all 3 sub steps in 2nd step as trackers

Copy link

Unit Test Coverage % values
Statements 33.97% ( 4220 / 12420 )
Branches 27.59% ( 1217 / 4411 )
Functions 26.64% ( 925 / 3471 )
Lines 34.15% ( 4152 / 12155 )

@DhaaraniCIT DhaaraniCIT merged commit 0e74697 into master Dec 17, 2024
4 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